82 lines
1.7 KiB
Plaintext
82 lines
1.7 KiB
Plaintext
// Code generated by wa-generator. DO NOT EDIT.
|
|
// Source: Web Awesome wa-spinner
|
|
|
|
package wa
|
|
|
|
import (
|
|
"github.com/a-h/templ"
|
|
)
|
|
|
|
// Spinners are used to show the progress of an indeterminate operation.
|
|
//
|
|
// Web Awesome component: <wa-spinner>
|
|
|
|
// SpinnerProps holds all properties for the wa-spinner component
|
|
type SpinnerProps struct {
|
|
|
|
// Events
|
|
|
|
// Slots contains named slot content
|
|
Slots SpinnerSlots
|
|
|
|
// Attrs contains additional HTML attributes
|
|
Attrs templ.Attributes
|
|
}
|
|
|
|
// SpinnerBuilder provides a fluent API for constructing SpinnerProps
|
|
type SpinnerBuilder struct {
|
|
props SpinnerProps
|
|
}
|
|
|
|
// NewSpinner creates a new builder for wa-spinner
|
|
func NewSpinner() *SpinnerBuilder {
|
|
return &SpinnerBuilder{}
|
|
}
|
|
|
|
// Attr adds a custom HTML attribute
|
|
func (b *SpinnerBuilder) Attr(name, value string) *SpinnerBuilder {
|
|
if b.props.Attrs == nil {
|
|
b.props.Attrs = templ.Attributes{}
|
|
}
|
|
b.props.Attrs[name] = value
|
|
return b
|
|
}
|
|
|
|
// Attrs merges multiple attributes
|
|
func (b *SpinnerBuilder) Attrs(attrs templ.Attributes) *SpinnerBuilder {
|
|
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 *SpinnerBuilder) Props() SpinnerProps {
|
|
return b.props
|
|
}
|
|
|
|
// Build returns the props (alias for Props for semantic clarity)
|
|
func (b *SpinnerBuilder) Build() SpinnerProps {
|
|
return b.props
|
|
}
|
|
|
|
// Spinner renders the wa-spinner component
|
|
templ Spinner(props SpinnerProps) {
|
|
<wa-spinner
|
|
{ props.Attrs... }
|
|
>
|
|
{ children... }
|
|
</wa-spinner>
|
|
}
|
|
|
|
// SpinnerFunc renders with a builder function for inline configuration
|
|
templ SpinnerFunc(fn func(*SpinnerBuilder)) {
|
|
{{ b := NewSpinner(); fn(b) }}
|
|
@Spinner(b.Props()) {
|
|
{ children... }
|
|
}
|
|
}
|