119 lines
2.8 KiB
Plaintext
119 lines
2.8 KiB
Plaintext
// Code generated by wa-generator. DO NOT EDIT.
|
|
// Source: Web Awesome wa-scroller
|
|
|
|
package wa
|
|
|
|
import (
|
|
"github.com/a-h/templ"
|
|
)
|
|
|
|
// Scrollers create an accessible container while providing visual cues that help users identify and navigate
|
|
//
|
|
// Web Awesome component: <wa-scroller>
|
|
|
|
// ScrollerProps holds all properties for the wa-scroller component
|
|
type ScrollerProps struct {
|
|
// The scroller's orientation.
|
|
// Valid values: "horizontal", "vertical"
|
|
Orientation string `attr:"orientation"`
|
|
// Removes the visible scrollbar.
|
|
WithoutScrollbar bool `attr:"without-scrollbar"`
|
|
// Removes the shadows.
|
|
WithoutShadow bool `attr:"without-shadow"`
|
|
|
|
// Events
|
|
|
|
// Slots contains named slot content
|
|
Slots ScrollerSlots
|
|
|
|
// Attrs contains additional HTML attributes
|
|
Attrs templ.Attributes
|
|
}
|
|
|
|
// ScrollerBuilder provides a fluent API for constructing ScrollerProps
|
|
type ScrollerBuilder struct {
|
|
props ScrollerProps
|
|
}
|
|
|
|
// NewScroller creates a new builder for wa-scroller
|
|
func NewScroller() *ScrollerBuilder {
|
|
return &ScrollerBuilder{}
|
|
}
|
|
|
|
// Orientation sets the orientation attribute
|
|
// The scroller's orientation.
|
|
func (b *ScrollerBuilder) Orientation(v string) *ScrollerBuilder {
|
|
b.props.Orientation = v
|
|
return b
|
|
}
|
|
|
|
// WithoutScrollbar sets the without-scrollbar attribute
|
|
// Removes the visible scrollbar.
|
|
func (b *ScrollerBuilder) WithoutScrollbar(v bool) *ScrollerBuilder {
|
|
b.props.WithoutScrollbar = v
|
|
return b
|
|
}
|
|
|
|
// WithoutShadow sets the without-shadow attribute
|
|
// Removes the shadows.
|
|
func (b *ScrollerBuilder) WithoutShadow(v bool) *ScrollerBuilder {
|
|
b.props.WithoutShadow = v
|
|
return b
|
|
}
|
|
|
|
// Attr adds a custom HTML attribute
|
|
func (b *ScrollerBuilder) Attr(name, value string) *ScrollerBuilder {
|
|
if b.props.Attrs == nil {
|
|
b.props.Attrs = templ.Attributes{}
|
|
}
|
|
b.props.Attrs[name] = value
|
|
return b
|
|
}
|
|
|
|
// Attrs merges multiple attributes
|
|
func (b *ScrollerBuilder) Attrs(attrs templ.Attributes) *ScrollerBuilder {
|
|
if b.props.Attrs == nil {
|
|
b.props.Attrs = templ.Attributes{}
|
|
}
|
|
for k, v := range attrs {
|
|
b.props.Attrs[k] = v
|
|
}
|
|
return b
|
|
}
|
|
|
|
// Props returns the built properties
|
|
func (b *ScrollerBuilder) Props() ScrollerProps {
|
|
return b.props
|
|
}
|
|
|
|
// Build returns the props (alias for Props for semantic clarity)
|
|
func (b *ScrollerBuilder) Build() ScrollerProps {
|
|
return b.props
|
|
}
|
|
|
|
// Scroller renders the wa-scroller component
|
|
templ Scroller(props ScrollerProps) {
|
|
<wa-scroller
|
|
if props.Orientation != "" {
|
|
orientation={ props.Orientation }
|
|
}
|
|
if props.WithoutScrollbar {
|
|
without-scrollbar
|
|
}
|
|
if props.WithoutShadow {
|
|
without-shadow
|
|
}
|
|
{ props.Attrs... }
|
|
>
|
|
{ children... }
|
|
</wa-scroller>
|
|
}
|
|
|
|
// ScrollerFunc renders with a builder function for inline configuration
|
|
templ ScrollerFunc(fn func(*ScrollerBuilder)) {
|
|
{{ b := NewScroller(); fn(b) }}
|
|
@Scroller(b.Props()) {
|
|
{ children... }
|
|
}
|
|
}
|