Files
nebula/pkg/wa/select_templ.go

969 lines
34 KiB
Go
Raw Normal View History

2026-01-01 14:41:31 -05:00
// Code generated by templ - DO NOT EDIT.
// templ: version: v0.3.977
// Code generated by wa-generator. DO NOT EDIT.
// Source: Web Awesome wa-select
package wa
//lint:file-ignore SA4006 This context is only used if a nested component is present.
import "github.com/a-h/templ"
import templruntime "github.com/a-h/templ/runtime"
import (
"github.com/a-h/templ"
)
// Selects allow you to choose items from a menu of predefined options.
//
// Web Awesome component: <wa-select>
// SelectProps holds all properties for the wa-select component
type SelectProps struct {
// The name of the select, submitted as a name/value pair with form data.
Name string `attr:"name"`
// The select's value. This will be a string for single select or an array for multi-select.
Value string `attr:"value"`
// The select's size.
// Valid values: "small", "medium", "large"
Size string `attr:"size"`
// Placeholder text to show as a hint when the select is empty.
Placeholder string `attr:"placeholder"`
// Allows more than one option to be selected.
Multiple bool `attr:"multiple"`
// The maximum number of selected options to show when multiple is true. After the maximum, "+n" will be shown to
MaxOptionsVisible float64 `attr:"max-options-visible"`
// Disables the select control.
Disabled bool `attr:"disabled"`
// Adds a clear button when the select is not empty.
WithClear bool `attr:"with-clear"`
// Indicates whether or not the select is open. You can toggle this attribute to show and hide the menu, or you can
Open bool `attr:"open"`
// The select's visual appearance.
// Valid values: "filled", "outlined", "filled-outlined"
Appearance string `attr:"appearance"`
// Draws a pill-style select with rounded edges.
Pill bool `attr:"pill"`
// The select's label. If you need to display HTML, use the label slot instead.
Label string `attr:"label"`
// The preferred placement of the select's menu. Note that the actual placement may vary as needed to keep the listbox
// Valid values: "top", "bottom"
Placement string `attr:"placement"`
// The select's hint. If you need to display HTML, use the hint slot instead.
Hint string `attr:"hint"`
// Used for SSR purposes when a label is slotted in. Will show the label on first render.
WithLabel bool `attr:"with-label"`
// Used for SSR purposes when hint is slotted in. Will show the hint on first render.
WithHint bool `attr:"with-hint"`
// The select's required attribute.
Required bool `attr:"required"`
// Events
// Emitted when the control receives input.
OnInput string `attr:"x-on:input"`
// Emitted when the control's value changes.
OnChange string `attr:"x-on:change"`
// Emitted when the control gains focus.
OnFocus string `attr:"x-on:focus"`
// Emitted when the control loses focus.
OnBlur string `attr:"x-on:blur"`
// Emitted when the control's value is cleared.
OnClear string `attr:"x-on:wa-clear"`
// Emitted when the select's menu opens.
OnShow string `attr:"x-on:wa-show"`
// Emitted after the select's menu opens and all animations are complete.
OnAfterShow string `attr:"x-on:wa-after-show"`
// Emitted when the select's menu closes.
OnHide string `attr:"x-on:wa-hide"`
// Emitted after the select's menu closes and all animations are complete.
OnAfterHide string `attr:"x-on:wa-after-hide"`
// Emitted when the form control has been checked for validity and its constraints aren't satisfied.
OnInvalid string `attr:"x-on:wa-invalid"`
// Slots contains named slot content
Slots SelectSlots
// Attrs contains additional HTML attributes
Attrs templ.Attributes
}
// SelectSlots holds named slot content for the component
type SelectSlots struct {
// The input's label. Alternatively, you can use the label attribute.
Label templ.Component
// An element, such as <wa-icon>, placed at the start of the combobox.
Start templ.Component
// An element, such as <wa-icon>, placed at the end of the combobox.
End templ.Component
// An icon to use in lieu of the default clear icon.
ClearIcon templ.Component
// The icon to show when the control is expanded and collapsed. Rotates on open and close.
ExpandIcon templ.Component
// Text that describes how to use the input. Alternatively, you can use the hint attribute.
Hint templ.Component
}
// SelectBuilder provides a fluent API for constructing SelectProps
type SelectBuilder struct {
props SelectProps
}
// NewSelect creates a new builder for wa-select
func NewSelect() *SelectBuilder {
return &SelectBuilder{}
}
// Name sets the name attribute
// The name of the select, submitted as a name/value pair with form data.
func (b *SelectBuilder) Name(v string) *SelectBuilder {
b.props.Name = v
return b
}
// Value sets the value attribute
// The select's value. This will be a string for single select or an array for multi-select.
func (b *SelectBuilder) Value(v string) *SelectBuilder {
b.props.Value = v
return b
}
// Size sets the size attribute
// The select's size.
func (b *SelectBuilder) Size(v string) *SelectBuilder {
b.props.Size = v
return b
}
// Placeholder sets the placeholder attribute
// Placeholder text to show as a hint when the select is empty.
func (b *SelectBuilder) Placeholder(v string) *SelectBuilder {
b.props.Placeholder = v
return b
}
// Multiple sets the multiple attribute
// Allows more than one option to be selected.
func (b *SelectBuilder) Multiple(v bool) *SelectBuilder {
b.props.Multiple = v
return b
}
// MaxOptionsVisible sets the max-options-visible attribute
// The maximum number of selected options to show when multiple is true. After the maximum, "+n" will be shown to
func (b *SelectBuilder) MaxOptionsVisible(v float64) *SelectBuilder {
b.props.MaxOptionsVisible = v
return b
}
// Disabled sets the disabled attribute
// Disables the select control.
func (b *SelectBuilder) Disabled(v bool) *SelectBuilder {
b.props.Disabled = v
return b
}
// WithClear sets the with-clear attribute
// Adds a clear button when the select is not empty.
func (b *SelectBuilder) WithClear(v bool) *SelectBuilder {
b.props.WithClear = v
return b
}
// Open sets the open attribute
// Indicates whether or not the select is open. You can toggle this attribute to show and hide the menu, or you can
func (b *SelectBuilder) Open(v bool) *SelectBuilder {
b.props.Open = v
return b
}
// Appearance sets the appearance attribute
// The select's visual appearance.
func (b *SelectBuilder) Appearance(v string) *SelectBuilder {
b.props.Appearance = v
return b
}
// Pill sets the pill attribute
// Draws a pill-style select with rounded edges.
func (b *SelectBuilder) Pill(v bool) *SelectBuilder {
b.props.Pill = v
return b
}
// Label sets the label attribute
// The select's label. If you need to display HTML, use the label slot instead.
func (b *SelectBuilder) Label(v string) *SelectBuilder {
b.props.Label = v
return b
}
// Placement sets the placement attribute
// The preferred placement of the select's menu. Note that the actual placement may vary as needed to keep the listbox
func (b *SelectBuilder) Placement(v string) *SelectBuilder {
b.props.Placement = v
return b
}
// Hint sets the hint attribute
// The select's hint. If you need to display HTML, use the hint slot instead.
func (b *SelectBuilder) Hint(v string) *SelectBuilder {
b.props.Hint = v
return b
}
// WithLabel sets the with-label attribute
// Used for SSR purposes when a label is slotted in. Will show the label on first render.
func (b *SelectBuilder) WithLabel(v bool) *SelectBuilder {
b.props.WithLabel = v
return b
}
// WithHint sets the with-hint attribute
// Used for SSR purposes when hint is slotted in. Will show the hint on first render.
func (b *SelectBuilder) WithHint(v bool) *SelectBuilder {
b.props.WithHint = v
return b
}
// Required sets the required attribute
// The select's required attribute.
func (b *SelectBuilder) Required(v bool) *SelectBuilder {
b.props.Required = v
return b
}
// OnInput sets the handler for input event
// Emitted when the control receives input.
func (b *SelectBuilder) OnInput(handler string) *SelectBuilder {
b.props.OnInput = handler
return b
}
// OnChange sets the handler for change event
// Emitted when the control's value changes.
func (b *SelectBuilder) OnChange(handler string) *SelectBuilder {
b.props.OnChange = handler
return b
}
// OnFocus sets the handler for focus event
// Emitted when the control gains focus.
func (b *SelectBuilder) OnFocus(handler string) *SelectBuilder {
b.props.OnFocus = handler
return b
}
// OnBlur sets the handler for blur event
// Emitted when the control loses focus.
func (b *SelectBuilder) OnBlur(handler string) *SelectBuilder {
b.props.OnBlur = handler
return b
}
// OnClear sets the handler for wa-clear event
// Emitted when the control's value is cleared.
func (b *SelectBuilder) OnClear(handler string) *SelectBuilder {
b.props.OnClear = handler
return b
}
// OnShow sets the handler for wa-show event
// Emitted when the select's menu opens.
func (b *SelectBuilder) OnShow(handler string) *SelectBuilder {
b.props.OnShow = handler
return b
}
// OnAfterShow sets the handler for wa-after-show event
// Emitted after the select's menu opens and all animations are complete.
func (b *SelectBuilder) OnAfterShow(handler string) *SelectBuilder {
b.props.OnAfterShow = handler
return b
}
// OnHide sets the handler for wa-hide event
// Emitted when the select's menu closes.
func (b *SelectBuilder) OnHide(handler string) *SelectBuilder {
b.props.OnHide = handler
return b
}
// OnAfterHide sets the handler for wa-after-hide event
// Emitted after the select's menu closes and all animations are complete.
func (b *SelectBuilder) OnAfterHide(handler string) *SelectBuilder {
b.props.OnAfterHide = handler
return b
}
// OnInvalid sets the handler for wa-invalid event
// Emitted when the form control has been checked for validity and its constraints aren't satisfied.
func (b *SelectBuilder) OnInvalid(handler string) *SelectBuilder {
b.props.OnInvalid = handler
return b
}
// LabelSlot sets the label slot content
// The input's label. Alternatively, you can use the label attribute.
func (b *SelectBuilder) LabelSlot(c templ.Component) *SelectBuilder {
b.props.Slots.Label = c
return b
}
// StartSlot sets the start slot content
// An element, such as <wa-icon>, placed at the start of the combobox.
func (b *SelectBuilder) StartSlot(c templ.Component) *SelectBuilder {
b.props.Slots.Start = c
return b
}
// EndSlot sets the end slot content
// An element, such as <wa-icon>, placed at the end of the combobox.
func (b *SelectBuilder) EndSlot(c templ.Component) *SelectBuilder {
b.props.Slots.End = c
return b
}
// ClearIconSlot sets the clear-icon slot content
// An icon to use in lieu of the default clear icon.
func (b *SelectBuilder) ClearIconSlot(c templ.Component) *SelectBuilder {
b.props.Slots.ClearIcon = c
return b
}
// ExpandIconSlot sets the expand-icon slot content
// The icon to show when the control is expanded and collapsed. Rotates on open and close.
func (b *SelectBuilder) ExpandIconSlot(c templ.Component) *SelectBuilder {
b.props.Slots.ExpandIcon = c
return b
}
// HintSlot sets the hint slot content
// Text that describes how to use the input. Alternatively, you can use the hint attribute.
func (b *SelectBuilder) HintSlot(c templ.Component) *SelectBuilder {
b.props.Slots.Hint = c
return b
}
// Attr adds a custom HTML attribute
func (b *SelectBuilder) Attr(name, value string) *SelectBuilder {
if b.props.Attrs == nil {
b.props.Attrs = templ.Attributes{}
}
b.props.Attrs[name] = value
return b
}
// Attrs merges multiple attributes
func (b *SelectBuilder) Attrs(attrs templ.Attributes) *SelectBuilder {
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 *SelectBuilder) Props() SelectProps {
return b.props
}
// Build returns the props (alias for Props for semantic clarity)
func (b *SelectBuilder) Build() SelectProps {
return b.props
}
// Select renders the wa-select component
func Select(props SelectProps) templ.Component {
return templruntime.GeneratedTemplate(func(templ_7745c5c3_Input templruntime.GeneratedComponentInput) (templ_7745c5c3_Err error) {
templ_7745c5c3_W, ctx := templ_7745c5c3_Input.Writer, templ_7745c5c3_Input.Context
if templ_7745c5c3_CtxErr := ctx.Err(); templ_7745c5c3_CtxErr != nil {
return templ_7745c5c3_CtxErr
}
templ_7745c5c3_Buffer, templ_7745c5c3_IsBuffer := templruntime.GetBuffer(templ_7745c5c3_W)
if !templ_7745c5c3_IsBuffer {
defer func() {
templ_7745c5c3_BufErr := templruntime.ReleaseBuffer(templ_7745c5c3_Buffer)
if templ_7745c5c3_Err == nil {
templ_7745c5c3_Err = templ_7745c5c3_BufErr
}
}()
}
ctx = templ.InitializeContext(ctx)
templ_7745c5c3_Var1 := templ.GetChildren(ctx)
if templ_7745c5c3_Var1 == nil {
templ_7745c5c3_Var1 = templ.NopComponent
}
ctx = templ.ClearChildren(ctx)
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 1, "<wa-select")
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
if props.Name != "" {
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 2, " name=\"")
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
var templ_7745c5c3_Var2 string
templ_7745c5c3_Var2, templ_7745c5c3_Err = templ.JoinStringErrs(props.Name)
if templ_7745c5c3_Err != nil {
return templ.Error{Err: templ_7745c5c3_Err, FileName: `pkg/wa/select.templ`, Line: 374, Col: 20}
}
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var2))
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 3, "\"")
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
}
if props.Value != "" {
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 4, " value=\"")
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
var templ_7745c5c3_Var3 string
templ_7745c5c3_Var3, templ_7745c5c3_Err = templ.JoinStringErrs(props.Value)
if templ_7745c5c3_Err != nil {
return templ.Error{Err: templ_7745c5c3_Err, FileName: `pkg/wa/select.templ`, Line: 377, Col: 22}
}
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var3))
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 5, "\"")
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
}
if props.Size != "" {
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 6, " size=\"")
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
var templ_7745c5c3_Var4 string
templ_7745c5c3_Var4, templ_7745c5c3_Err = templ.JoinStringErrs(props.Size)
if templ_7745c5c3_Err != nil {
return templ.Error{Err: templ_7745c5c3_Err, FileName: `pkg/wa/select.templ`, Line: 380, Col: 20}
}
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var4))
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 7, "\"")
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
}
if props.Placeholder != "" {
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 8, " placeholder=\"")
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
var templ_7745c5c3_Var5 string
templ_7745c5c3_Var5, templ_7745c5c3_Err = templ.JoinStringErrs(props.Placeholder)
if templ_7745c5c3_Err != nil {
return templ.Error{Err: templ_7745c5c3_Err, FileName: `pkg/wa/select.templ`, Line: 383, Col: 34}
}
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var5))
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 9, "\"")
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
}
if props.Multiple {
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 10, " multiple")
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
}
if props.MaxOptionsVisible != 0 {
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 11, " max-options-visible=\"")
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
var templ_7745c5c3_Var6 string
templ_7745c5c3_Var6, templ_7745c5c3_Err = templ.JoinStringErrs(templ.Sprintf("%v", props.MaxOptionsVisible))
if templ_7745c5c3_Err != nil {
return templ.Error{Err: templ_7745c5c3_Err, FileName: `pkg/wa/select.templ`, Line: 389, Col: 69}
}
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var6))
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 12, "\"")
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
}
if props.Disabled {
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 13, " disabled")
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
}
if props.WithClear {
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 14, " with-clear")
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
}
if props.Open {
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 15, " open")
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
}
if props.Appearance != "" {
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 16, " appearance=\"")
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
var templ_7745c5c3_Var7 string
templ_7745c5c3_Var7, templ_7745c5c3_Err = templ.JoinStringErrs(props.Appearance)
if templ_7745c5c3_Err != nil {
return templ.Error{Err: templ_7745c5c3_Err, FileName: `pkg/wa/select.templ`, Line: 401, Col: 32}
}
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var7))
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 17, "\"")
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
}
if props.Pill {
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 18, " pill")
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
}
if props.Label != "" {
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 19, " label=\"")
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
var templ_7745c5c3_Var8 string
templ_7745c5c3_Var8, templ_7745c5c3_Err = templ.JoinStringErrs(props.Label)
if templ_7745c5c3_Err != nil {
return templ.Error{Err: templ_7745c5c3_Err, FileName: `pkg/wa/select.templ`, Line: 407, Col: 22}
}
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var8))
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 20, "\"")
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
}
if props.Placement != "" {
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 21, " placement=\"")
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
var templ_7745c5c3_Var9 string
templ_7745c5c3_Var9, templ_7745c5c3_Err = templ.JoinStringErrs(props.Placement)
if templ_7745c5c3_Err != nil {
return templ.Error{Err: templ_7745c5c3_Err, FileName: `pkg/wa/select.templ`, Line: 410, Col: 30}
}
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var9))
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 22, "\"")
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
}
if props.Hint != "" {
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 23, " hint=\"")
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
var templ_7745c5c3_Var10 string
templ_7745c5c3_Var10, templ_7745c5c3_Err = templ.JoinStringErrs(props.Hint)
if templ_7745c5c3_Err != nil {
return templ.Error{Err: templ_7745c5c3_Err, FileName: `pkg/wa/select.templ`, Line: 413, Col: 20}
}
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var10))
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 24, "\"")
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
}
if props.WithLabel {
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 25, " with-label")
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
}
if props.WithHint {
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 26, " with-hint")
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
}
if props.Required {
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 27, " required")
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
}
if props.OnInput != "" {
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 28, " x-on:input=\"")
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
var templ_7745c5c3_Var11 string
templ_7745c5c3_Var11, templ_7745c5c3_Err = templ.JoinStringErrs(props.OnInput)
if templ_7745c5c3_Err != nil {
return templ.Error{Err: templ_7745c5c3_Err, FileName: `pkg/wa/select.templ`, Line: 425, Col: 29}
}
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var11))
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 29, "\"")
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
}
if props.OnChange != "" {
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 30, " x-on:change=\"")
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
var templ_7745c5c3_Var12 string
templ_7745c5c3_Var12, templ_7745c5c3_Err = templ.JoinStringErrs(props.OnChange)
if templ_7745c5c3_Err != nil {
return templ.Error{Err: templ_7745c5c3_Err, FileName: `pkg/wa/select.templ`, Line: 428, Col: 31}
}
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var12))
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 31, "\"")
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
}
if props.OnFocus != "" {
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 32, " x-on:focus=\"")
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
var templ_7745c5c3_Var13 string
templ_7745c5c3_Var13, templ_7745c5c3_Err = templ.JoinStringErrs(props.OnFocus)
if templ_7745c5c3_Err != nil {
return templ.Error{Err: templ_7745c5c3_Err, FileName: `pkg/wa/select.templ`, Line: 431, Col: 29}
}
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var13))
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 33, "\"")
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
}
if props.OnBlur != "" {
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 34, " x-on:blur=\"")
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
var templ_7745c5c3_Var14 string
templ_7745c5c3_Var14, templ_7745c5c3_Err = templ.JoinStringErrs(props.OnBlur)
if templ_7745c5c3_Err != nil {
return templ.Error{Err: templ_7745c5c3_Err, FileName: `pkg/wa/select.templ`, Line: 434, Col: 27}
}
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var14))
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 35, "\"")
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
}
if props.OnClear != "" {
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 36, " x-on:wa-clear=\"")
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
var templ_7745c5c3_Var15 string
templ_7745c5c3_Var15, templ_7745c5c3_Err = templ.JoinStringErrs(props.OnClear)
if templ_7745c5c3_Err != nil {
return templ.Error{Err: templ_7745c5c3_Err, FileName: `pkg/wa/select.templ`, Line: 437, Col: 32}
}
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var15))
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 37, "\"")
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
}
if props.OnShow != "" {
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 38, " x-on:wa-show=\"")
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
var templ_7745c5c3_Var16 string
templ_7745c5c3_Var16, templ_7745c5c3_Err = templ.JoinStringErrs(props.OnShow)
if templ_7745c5c3_Err != nil {
return templ.Error{Err: templ_7745c5c3_Err, FileName: `pkg/wa/select.templ`, Line: 440, Col: 30}
}
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var16))
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 39, "\"")
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
}
if props.OnAfterShow != "" {
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 40, " x-on:wa-after-show=\"")
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
var templ_7745c5c3_Var17 string
templ_7745c5c3_Var17, templ_7745c5c3_Err = templ.JoinStringErrs(props.OnAfterShow)
if templ_7745c5c3_Err != nil {
return templ.Error{Err: templ_7745c5c3_Err, FileName: `pkg/wa/select.templ`, Line: 443, Col: 41}
}
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var17))
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 41, "\"")
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
}
if props.OnHide != "" {
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 42, " x-on:wa-hide=\"")
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
var templ_7745c5c3_Var18 string
templ_7745c5c3_Var18, templ_7745c5c3_Err = templ.JoinStringErrs(props.OnHide)
if templ_7745c5c3_Err != nil {
return templ.Error{Err: templ_7745c5c3_Err, FileName: `pkg/wa/select.templ`, Line: 446, Col: 30}
}
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var18))
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 43, "\"")
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
}
if props.OnAfterHide != "" {
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 44, " x-on:wa-after-hide=\"")
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
var templ_7745c5c3_Var19 string
templ_7745c5c3_Var19, templ_7745c5c3_Err = templ.JoinStringErrs(props.OnAfterHide)
if templ_7745c5c3_Err != nil {
return templ.Error{Err: templ_7745c5c3_Err, FileName: `pkg/wa/select.templ`, Line: 449, Col: 41}
}
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var19))
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 45, "\"")
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
}
if props.OnInvalid != "" {
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 46, " x-on:wa-invalid=\"")
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
var templ_7745c5c3_Var20 string
templ_7745c5c3_Var20, templ_7745c5c3_Err = templ.JoinStringErrs(props.OnInvalid)
if templ_7745c5c3_Err != nil {
return templ.Error{Err: templ_7745c5c3_Err, FileName: `pkg/wa/select.templ`, Line: 452, Col: 36}
}
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var20))
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 47, "\"")
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
}
templ_7745c5c3_Err = templ.RenderAttributes(ctx, templ_7745c5c3_Buffer, props.Attrs)
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 48, ">")
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
if props.Slots.Label != nil {
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 49, "<div slot=\"label\">")
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
templ_7745c5c3_Err = props.Slots.Label.Render(ctx, templ_7745c5c3_Buffer)
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 50, "</div>")
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
}
if props.Slots.Start != nil {
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 51, "<div slot=\"start\">")
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
templ_7745c5c3_Err = props.Slots.Start.Render(ctx, templ_7745c5c3_Buffer)
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 52, "</div>")
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
}
if props.Slots.End != nil {
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 53, "<div slot=\"end\">")
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
templ_7745c5c3_Err = props.Slots.End.Render(ctx, templ_7745c5c3_Buffer)
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 54, "</div>")
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
}
if props.Slots.ClearIcon != nil {
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 55, "<div slot=\"clear-icon\">")
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
templ_7745c5c3_Err = props.Slots.ClearIcon.Render(ctx, templ_7745c5c3_Buffer)
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 56, "</div>")
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
}
if props.Slots.ExpandIcon != nil {
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 57, "<div slot=\"expand-icon\">")
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
templ_7745c5c3_Err = props.Slots.ExpandIcon.Render(ctx, templ_7745c5c3_Buffer)
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 58, "</div>")
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
}
if props.Slots.Hint != nil {
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 59, "<div slot=\"hint\">")
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
templ_7745c5c3_Err = props.Slots.Hint.Render(ctx, templ_7745c5c3_Buffer)
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 60, "</div>")
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
}
templ_7745c5c3_Err = templ_7745c5c3_Var1.Render(ctx, templ_7745c5c3_Buffer)
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 61, "</wa-select>")
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
return nil
})
}
// SelectFunc renders with a builder function for inline configuration
func SelectFunc(fn func(*SelectBuilder)) templ.Component {
return templruntime.GeneratedTemplate(func(templ_7745c5c3_Input templruntime.GeneratedComponentInput) (templ_7745c5c3_Err error) {
templ_7745c5c3_W, ctx := templ_7745c5c3_Input.Writer, templ_7745c5c3_Input.Context
if templ_7745c5c3_CtxErr := ctx.Err(); templ_7745c5c3_CtxErr != nil {
return templ_7745c5c3_CtxErr
}
templ_7745c5c3_Buffer, templ_7745c5c3_IsBuffer := templruntime.GetBuffer(templ_7745c5c3_W)
if !templ_7745c5c3_IsBuffer {
defer func() {
templ_7745c5c3_BufErr := templruntime.ReleaseBuffer(templ_7745c5c3_Buffer)
if templ_7745c5c3_Err == nil {
templ_7745c5c3_Err = templ_7745c5c3_BufErr
}
}()
}
ctx = templ.InitializeContext(ctx)
templ_7745c5c3_Var21 := templ.GetChildren(ctx)
if templ_7745c5c3_Var21 == nil {
templ_7745c5c3_Var21 = templ.NopComponent
}
ctx = templ.ClearChildren(ctx)
b := NewSelect()
fn(b)
templ_7745c5c3_Var22 := templruntime.GeneratedTemplate(func(templ_7745c5c3_Input templruntime.GeneratedComponentInput) (templ_7745c5c3_Err error) {
templ_7745c5c3_W, ctx := templ_7745c5c3_Input.Writer, templ_7745c5c3_Input.Context
templ_7745c5c3_Buffer, templ_7745c5c3_IsBuffer := templruntime.GetBuffer(templ_7745c5c3_W)
if !templ_7745c5c3_IsBuffer {
defer func() {
templ_7745c5c3_BufErr := templruntime.ReleaseBuffer(templ_7745c5c3_Buffer)
if templ_7745c5c3_Err == nil {
templ_7745c5c3_Err = templ_7745c5c3_BufErr
}
}()
}
ctx = templ.InitializeContext(ctx)
templ_7745c5c3_Err = templ_7745c5c3_Var21.Render(ctx, templ_7745c5c3_Buffer)
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
return nil
})
templ_7745c5c3_Err = Select(b.Props()).Render(templ.WithChildren(ctx, templ_7745c5c3_Var22), templ_7745c5c3_Buffer)
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
return nil
})
}
var _ = templruntime.GeneratedTemplate