// Code generated by templ - DO NOT EDIT. // templ: version: v0.3.977 // Code generated by wa-generator. DO NOT EDIT. // Source: Web Awesome wa-details 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" ) // Details show a brief summary and expand to show additional content. // // Web Awesome component: // DetailsProps holds all properties for the wa-details component type DetailsProps struct { // Indicates whether or not the details is open. You can toggle this attribute to show and hide the details, or you Open bool `attr:"open"` // The summary to show in the header. If you need to display HTML, use the summary slot instead. Summary string `attr:"summary"` // Groups related details elements. When one opens, others with the same name will close. Name string `attr:"name"` // Disables the details so it can't be toggled. Disabled bool `attr:"disabled"` // The element's visual appearance. // Valid values: "filled", "outlined", "filled-outlined", "plain" Appearance string `attr:"appearance"` // The location of the expand/collapse icon. // Valid values: "start", "end" IconPlacement string `attr:"icon-placement"` // Events // Emitted when the details opens. OnShow string `attr:"x-on:wa-show"` // Emitted after the details opens and all animations are complete. OnAfterShow string `attr:"x-on:wa-after-show"` // Emitted when the details closes. OnHide string `attr:"x-on:wa-hide"` // Emitted after the details closes and all animations are complete. OnAfterHide string `attr:"x-on:wa-after-hide"` // Slots contains named slot content Slots DetailsSlots // Attrs contains additional HTML attributes Attrs templ.Attributes } // DetailsSlots holds named slot content for the component type DetailsSlots struct { // The details' summary. Alternatively, you can use the summary attribute. Summary templ.Component // Optional expand icon to use instead of the default. Works best with . ExpandIcon templ.Component // Optional collapse icon to use instead of the default. Works best with . CollapseIcon templ.Component } // DetailsBuilder provides a fluent API for constructing DetailsProps type DetailsBuilder struct { props DetailsProps } // NewDetails creates a new builder for wa-details func NewDetails() *DetailsBuilder { return &DetailsBuilder{} } // Open sets the open attribute // Indicates whether or not the details is open. You can toggle this attribute to show and hide the details, or you func (b *DetailsBuilder) Open(v bool) *DetailsBuilder { b.props.Open = v return b } // Summary sets the summary attribute // The summary to show in the header. If you need to display HTML, use the summary slot instead. func (b *DetailsBuilder) Summary(v string) *DetailsBuilder { b.props.Summary = v return b } // Name sets the name attribute // Groups related details elements. When one opens, others with the same name will close. func (b *DetailsBuilder) Name(v string) *DetailsBuilder { b.props.Name = v return b } // Disabled sets the disabled attribute // Disables the details so it can't be toggled. func (b *DetailsBuilder) Disabled(v bool) *DetailsBuilder { b.props.Disabled = v return b } // Appearance sets the appearance attribute // The element's visual appearance. func (b *DetailsBuilder) Appearance(v string) *DetailsBuilder { b.props.Appearance = v return b } // IconPlacement sets the icon-placement attribute // The location of the expand/collapse icon. func (b *DetailsBuilder) IconPlacement(v string) *DetailsBuilder { b.props.IconPlacement = v return b } // OnShow sets the handler for wa-show event // Emitted when the details opens. func (b *DetailsBuilder) OnShow(handler string) *DetailsBuilder { b.props.OnShow = handler return b } // OnAfterShow sets the handler for wa-after-show event // Emitted after the details opens and all animations are complete. func (b *DetailsBuilder) OnAfterShow(handler string) *DetailsBuilder { b.props.OnAfterShow = handler return b } // OnHide sets the handler for wa-hide event // Emitted when the details closes. func (b *DetailsBuilder) OnHide(handler string) *DetailsBuilder { b.props.OnHide = handler return b } // OnAfterHide sets the handler for wa-after-hide event // Emitted after the details closes and all animations are complete. func (b *DetailsBuilder) OnAfterHide(handler string) *DetailsBuilder { b.props.OnAfterHide = handler return b } // SummarySlot sets the summary slot content // The details' summary. Alternatively, you can use the summary attribute. func (b *DetailsBuilder) SummarySlot(c templ.Component) *DetailsBuilder { b.props.Slots.Summary = c return b } // ExpandIconSlot sets the expand-icon slot content // Optional expand icon to use instead of the default. Works best with . func (b *DetailsBuilder) ExpandIconSlot(c templ.Component) *DetailsBuilder { b.props.Slots.ExpandIcon = c return b } // CollapseIconSlot sets the collapse-icon slot content // Optional collapse icon to use instead of the default. Works best with . func (b *DetailsBuilder) CollapseIconSlot(c templ.Component) *DetailsBuilder { b.props.Slots.CollapseIcon = c return b } // Attr adds a custom HTML attribute func (b *DetailsBuilder) Attr(name, value string) *DetailsBuilder { if b.props.Attrs == nil { b.props.Attrs = templ.Attributes{} } b.props.Attrs[name] = value return b } // Attrs merges multiple attributes func (b *DetailsBuilder) Attrs(attrs templ.Attributes) *DetailsBuilder { 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 *DetailsBuilder) Props() DetailsProps { return b.props } // Build returns the props (alias for Props for semantic clarity) func (b *DetailsBuilder) Build() DetailsProps { return b.props } // Details renders the wa-details component func Details(props DetailsProps) 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, "") if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } if props.Slots.Summary != nil { templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 21, "
") if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } templ_7745c5c3_Err = props.Slots.Summary.Render(ctx, templ_7745c5c3_Buffer) 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.Slots.ExpandIcon != nil { templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 23, "
") 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, 24, "
") if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } } if props.Slots.CollapseIcon != nil { templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 25, "
") if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } templ_7745c5c3_Err = props.Slots.CollapseIcon.Render(ctx, templ_7745c5c3_Buffer) if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 26, "
") 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, 27, "
") if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } return nil }) } // DetailsFunc renders with a builder function for inline configuration func DetailsFunc(fn func(*DetailsBuilder)) 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_Var10 := templ.GetChildren(ctx) if templ_7745c5c3_Var10 == nil { templ_7745c5c3_Var10 = templ.NopComponent } ctx = templ.ClearChildren(ctx) b := NewDetails() fn(b) templ_7745c5c3_Var11 := 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_Var10.Render(ctx, templ_7745c5c3_Buffer) if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } return nil }) templ_7745c5c3_Err = Details(b.Props()).Render(templ.WithChildren(ctx, templ_7745c5c3_Var11), templ_7745c5c3_Buffer) if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } return nil }) } var _ = templruntime.GeneratedTemplate