Files
nebula/pkg/wa/tab-group_templ.go

356 lines
12 KiB
Go
Raw Normal View History

2026-01-01 14:41:31 -05:00
// Code generated by templ - DO NOT EDIT.
2026-01-01 20:49:44 -05:00
// templ: version: v0.3.960
2026-01-01 14:41:31 -05:00
// Code generated by wa-generator. DO NOT EDIT.
// Source: Web Awesome wa-tab-group
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"
)
// Tab groups organize content into a container that shows one section at a time.
//
// Web Awesome component: <wa-tab-group>
// TabGroupProps holds all properties for the wa-tab-group component
type TabGroupProps struct {
// Sets the active tab.
Active string `attr:"active"`
// The placement of the tabs.
// Valid values: "top", "bottom", "start", "end"
Placement string `attr:"placement"`
// When set to auto, navigating tabs with the arrow keys will instantly show the corresponding tab panel. When set to
// Valid values: "auto", "manual"
Activation string `attr:"activation"`
// Disables the scroll arrows that appear when tabs overflow.
WithoutScrollControls bool `attr:"without-scroll-controls"`
// Events
// Emitted when a tab is shown.
OnTabShow string `attr:"x-on:wa-tab-show"`
// Emitted when a tab is hidden.
OnTabHide string `attr:"x-on:wa-tab-hide"`
// Slots contains named slot content
Slots TabGroupSlots
// Attrs contains additional HTML attributes
Attrs templ.Attributes
}
// TabGroupSlots holds named slot content for the component
type TabGroupSlots struct {
// Used for grouping tabs in the tab group. Must be <wa-tab> elements. Note that <wa-tab> will set this slot on itself a...
Nav templ.Component
}
// TabGroupBuilder provides a fluent API for constructing TabGroupProps
type TabGroupBuilder struct {
props TabGroupProps
}
// NewTabGroup creates a new builder for wa-tab-group
func NewTabGroup() *TabGroupBuilder {
return &TabGroupBuilder{}
}
// Active sets the active attribute
// Sets the active tab.
func (b *TabGroupBuilder) Active(v string) *TabGroupBuilder {
b.props.Active = v
return b
}
// Placement sets the placement attribute
// The placement of the tabs.
func (b *TabGroupBuilder) Placement(v string) *TabGroupBuilder {
b.props.Placement = v
return b
}
// Activation sets the activation attribute
// When set to auto, navigating tabs with the arrow keys will instantly show the corresponding tab panel. When set to
func (b *TabGroupBuilder) Activation(v string) *TabGroupBuilder {
b.props.Activation = v
return b
}
// WithoutScrollControls sets the without-scroll-controls attribute
// Disables the scroll arrows that appear when tabs overflow.
func (b *TabGroupBuilder) WithoutScrollControls(v bool) *TabGroupBuilder {
b.props.WithoutScrollControls = v
return b
}
// OnTabShow sets the handler for wa-tab-show event
// Emitted when a tab is shown.
func (b *TabGroupBuilder) OnTabShow(handler string) *TabGroupBuilder {
b.props.OnTabShow = handler
return b
}
// OnTabHide sets the handler for wa-tab-hide event
// Emitted when a tab is hidden.
func (b *TabGroupBuilder) OnTabHide(handler string) *TabGroupBuilder {
b.props.OnTabHide = handler
return b
}
// NavSlot sets the nav slot content
// Used for grouping tabs in the tab group. Must be <wa-tab> elements. Note that <wa-tab> will set this slot on itself a...
func (b *TabGroupBuilder) NavSlot(c templ.Component) *TabGroupBuilder {
b.props.Slots.Nav = c
return b
}
// Attr adds a custom HTML attribute
func (b *TabGroupBuilder) Attr(name, value string) *TabGroupBuilder {
if b.props.Attrs == nil {
b.props.Attrs = templ.Attributes{}
}
b.props.Attrs[name] = value
return b
}
// Attrs merges multiple attributes
func (b *TabGroupBuilder) Attrs(attrs templ.Attributes) *TabGroupBuilder {
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 *TabGroupBuilder) Props() TabGroupProps {
return b.props
}
// Build returns the props (alias for Props for semantic clarity)
func (b *TabGroupBuilder) Build() TabGroupProps {
return b.props
}
// TabGroup renders the wa-tab-group component
func TabGroup(props TabGroupProps) 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-tab-group")
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
if props.Active != "" {
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 2, " active=\"")
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
var templ_7745c5c3_Var2 string
templ_7745c5c3_Var2, templ_7745c5c3_Err = templ.JoinStringErrs(props.Active)
if templ_7745c5c3_Err != nil {
return templ.Error{Err: templ_7745c5c3_Err, FileName: `pkg/wa/tab-group.templ`, Line: 139, Col: 24}
}
_, 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.Placement != "" {
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 4, " placement=\"")
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
var templ_7745c5c3_Var3 string
templ_7745c5c3_Var3, templ_7745c5c3_Err = templ.JoinStringErrs(props.Placement)
if templ_7745c5c3_Err != nil {
return templ.Error{Err: templ_7745c5c3_Err, FileName: `pkg/wa/tab-group.templ`, Line: 142, Col: 30}
}
_, 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.Activation != "" {
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 6, " activation=\"")
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
var templ_7745c5c3_Var4 string
templ_7745c5c3_Var4, templ_7745c5c3_Err = templ.JoinStringErrs(props.Activation)
if templ_7745c5c3_Err != nil {
return templ.Error{Err: templ_7745c5c3_Err, FileName: `pkg/wa/tab-group.templ`, Line: 145, Col: 32}
}
_, 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.WithoutScrollControls {
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 8, " without-scroll-controls")
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
}
if props.OnTabShow != "" {
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 9, " x-on:wa-tab-show=\"")
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
var templ_7745c5c3_Var5 string
templ_7745c5c3_Var5, templ_7745c5c3_Err = templ.JoinStringErrs(props.OnTabShow)
if templ_7745c5c3_Err != nil {
return templ.Error{Err: templ_7745c5c3_Err, FileName: `pkg/wa/tab-group.templ`, Line: 151, Col: 37}
}
_, 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, 10, "\"")
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
}
if props.OnTabHide != "" {
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 11, " x-on:wa-tab-hide=\"")
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
var templ_7745c5c3_Var6 string
templ_7745c5c3_Var6, templ_7745c5c3_Err = templ.JoinStringErrs(props.OnTabHide)
if templ_7745c5c3_Err != nil {
return templ.Error{Err: templ_7745c5c3_Err, FileName: `pkg/wa/tab-group.templ`, Line: 154, Col: 37}
}
_, 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
}
}
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, 13, ">")
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
if props.Slots.Nav != nil {
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 14, "<div slot=\"nav\">")
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
templ_7745c5c3_Err = props.Slots.Nav.Render(ctx, templ_7745c5c3_Buffer)
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 15, "</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, 16, "</wa-tab-group>")
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
return nil
})
}
// TabGroupFunc renders with a builder function for inline configuration
func TabGroupFunc(fn func(*TabGroupBuilder)) 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_Var7 := templ.GetChildren(ctx)
if templ_7745c5c3_Var7 == nil {
templ_7745c5c3_Var7 = templ.NopComponent
}
ctx = templ.ClearChildren(ctx)
b := NewTabGroup()
fn(b)
templ_7745c5c3_Var8 := 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_Var7.Render(ctx, templ_7745c5c3_Buffer)
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
return nil
})
templ_7745c5c3_Err = TabGroup(b.Props()).Render(templ.WithChildren(ctx, templ_7745c5c3_Var8), templ_7745c5c3_Buffer)
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
return nil
})
}
var _ = templruntime.GeneratedTemplate