// Code generated by templ - DO NOT EDIT. // templ: version: v0.3.960 // Code generated by wa-generator. DO NOT EDIT. // Source: Web Awesome wa-tooltip 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" ) // Tooltips display additional information based on a specific action. // // Web Awesome component: // TooltipProps holds all properties for the wa-tooltip component type TooltipProps struct { // The preferred placement of the tooltip. Note that the actual placement may vary as needed to keep the tooltip // Valid values: "top", "top-start", "top-end", "right", "right-start", "right-end", "bottom", "bottom-start", "bottom-end", "left", "left-start", "left-end" Placement string `attr:"placement"` // Disables the tooltip so it won't show when triggered. Disabled bool `attr:"disabled"` // The distance in pixels from which to offset the tooltip away from its target. Distance float64 `attr:"distance"` // Indicates whether or not the tooltip is open. You can use this in lieu of the show/hide methods. Open bool `attr:"open"` // The distance in pixels from which to offset the tooltip along its target. Skidding float64 `attr:"skidding"` // The amount of time to wait before showing the tooltip when the user mouses in. ShowDelay float64 `attr:"show-delay"` // The amount of time to wait before hiding the tooltip when the user mouses out.. HideDelay float64 `attr:"hide-delay"` // Controls how the tooltip is activated. Possible options include click, hover, focus, and manual. Multiple Trigger string `attr:"trigger"` // Removes the arrow from the tooltip. WithoutArrow bool `attr:"without-arrow"` // For string `attr:"for"` // Events // Emitted when the tooltip begins to show. OnShow string `attr:"x-on:wa-show"` // Emitted after the tooltip has shown and all animations are complete. OnAfterShow string `attr:"x-on:wa-after-show"` // Emitted when the tooltip begins to hide. OnHide string `attr:"x-on:wa-hide"` // Emitted after the tooltip has hidden and all animations are complete. OnAfterHide string `attr:"x-on:wa-after-hide"` // Slots contains named slot content Slots TooltipSlots // Attrs contains additional HTML attributes Attrs templ.Attributes } // TooltipBuilder provides a fluent API for constructing TooltipProps type TooltipBuilder struct { props TooltipProps } // NewTooltip creates a new builder for wa-tooltip func NewTooltip() *TooltipBuilder { return &TooltipBuilder{} } // Placement sets the placement attribute // The preferred placement of the tooltip. Note that the actual placement may vary as needed to keep the tooltip func (b *TooltipBuilder) Placement(v string) *TooltipBuilder { b.props.Placement = v return b } // Disabled sets the disabled attribute // Disables the tooltip so it won't show when triggered. func (b *TooltipBuilder) Disabled(v bool) *TooltipBuilder { b.props.Disabled = v return b } // Distance sets the distance attribute // The distance in pixels from which to offset the tooltip away from its target. func (b *TooltipBuilder) Distance(v float64) *TooltipBuilder { b.props.Distance = v return b } // Open sets the open attribute // Indicates whether or not the tooltip is open. You can use this in lieu of the show/hide methods. func (b *TooltipBuilder) Open(v bool) *TooltipBuilder { b.props.Open = v return b } // Skidding sets the skidding attribute // The distance in pixels from which to offset the tooltip along its target. func (b *TooltipBuilder) Skidding(v float64) *TooltipBuilder { b.props.Skidding = v return b } // ShowDelay sets the show-delay attribute // The amount of time to wait before showing the tooltip when the user mouses in. func (b *TooltipBuilder) ShowDelay(v float64) *TooltipBuilder { b.props.ShowDelay = v return b } // HideDelay sets the hide-delay attribute // The amount of time to wait before hiding the tooltip when the user mouses out.. func (b *TooltipBuilder) HideDelay(v float64) *TooltipBuilder { b.props.HideDelay = v return b } // Trigger sets the trigger attribute // Controls how the tooltip is activated. Possible options include click, hover, focus, and manual. Multiple func (b *TooltipBuilder) Trigger(v string) *TooltipBuilder { b.props.Trigger = v return b } // WithoutArrow sets the without-arrow attribute // Removes the arrow from the tooltip. func (b *TooltipBuilder) WithoutArrow(v bool) *TooltipBuilder { b.props.WithoutArrow = v return b } // For sets the for attribute func (b *TooltipBuilder) For(v string) *TooltipBuilder { b.props.For = v return b } // OnShow sets the handler for wa-show event // Emitted when the tooltip begins to show. func (b *TooltipBuilder) OnShow(handler string) *TooltipBuilder { b.props.OnShow = handler return b } // OnAfterShow sets the handler for wa-after-show event // Emitted after the tooltip has shown and all animations are complete. func (b *TooltipBuilder) OnAfterShow(handler string) *TooltipBuilder { b.props.OnAfterShow = handler return b } // OnHide sets the handler for wa-hide event // Emitted when the tooltip begins to hide. func (b *TooltipBuilder) OnHide(handler string) *TooltipBuilder { b.props.OnHide = handler return b } // OnAfterHide sets the handler for wa-after-hide event // Emitted after the tooltip has hidden and all animations are complete. func (b *TooltipBuilder) OnAfterHide(handler string) *TooltipBuilder { b.props.OnAfterHide = handler return b } // Attr adds a custom HTML attribute func (b *TooltipBuilder) Attr(name, value string) *TooltipBuilder { if b.props.Attrs == nil { b.props.Attrs = templ.Attributes{} } b.props.Attrs[name] = value return b } // Attrs merges multiple attributes func (b *TooltipBuilder) Attrs(attrs templ.Attributes) *TooltipBuilder { 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 *TooltipBuilder) Props() TooltipProps { return b.props } // Build returns the props (alias for Props for semantic clarity) func (b *TooltipBuilder) Build() TooltipProps { return b.props } // Tooltip renders the wa-tooltip component func Tooltip(props TooltipProps) 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 } 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, 28, "") if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } return nil }) } // TooltipFunc renders with a builder function for inline configuration func TooltipFunc(fn func(*TooltipBuilder)) 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_Var13 := templ.GetChildren(ctx) if templ_7745c5c3_Var13 == nil { templ_7745c5c3_Var13 = templ.NopComponent } ctx = templ.ClearChildren(ctx) b := NewTooltip() fn(b) templ_7745c5c3_Var14 := 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_Var13.Render(ctx, templ_7745c5c3_Buffer) if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } return nil }) templ_7745c5c3_Err = Tooltip(b.Props()).Render(templ.WithChildren(ctx, templ_7745c5c3_Var14), templ_7745c5c3_Buffer) if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } return nil }) } var _ = templruntime.GeneratedTemplate