Files
nebula/pkg/wa/color-picker_templ.go

786 lines
28 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-color-picker
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"
)
// Color pickers allow the user to select a color.
//
// Web Awesome component: <wa-color-picker>
// ColorPickerProps holds all properties for the wa-color-picker component
type ColorPickerProps struct {
// The default value of the form control. Primarily used for resetting the form control.
Value string `attr:"value"`
//
WithLabel bool `attr:"with-label"`
//
WithHint bool `attr:"with-hint"`
// The color picker's label. This will not be displayed, but it will be announced by assistive devices. If you need to
Label string `attr:"label"`
// The color picker's hint. If you need to display HTML, use the hint slot instead.
Hint string `attr:"hint"`
// The format to use. If opacity is enabled, these will translate to HEXA, RGBA, HSLA, and HSVA respectively. The color
// Valid values: "hex", "rgb", "hsl", "hsv"
Format string `attr:"format"`
// Determines the size of the color picker's trigger
// Valid values: "small", "medium", "large"
Size string `attr:"size"`
// Removes the button that lets users toggle between format.
WithoutFormatToggle bool `attr:"without-format-toggle"`
// The name of the form control, submitted as a name/value pair with form data.
Name string `attr:"name"`
// Disables the color picker.
Disabled bool `attr:"disabled"`
// Indicates whether or not the popup is open. You can toggle this attribute to show and hide the popup, or you
Open bool `attr:"open"`
// Shows the opacity slider. Enabling this will cause the formatted value to be HEXA, RGBA, or HSLA.
Opacity bool `attr:"opacity"`
// By default, values are lowercase. With this attribute, values will be uppercase instead.
Uppercase bool `attr:"uppercase"`
// One or more predefined color swatches to display as presets in the color picker. Can include any format the color
Swatches string `attr:"swatches"`
// Makes the color picker a required field.
Required bool `attr:"required"`
// Events
// Emitted when the color picker's value changes.
OnChange string `attr:"x-on:change"`
// Emitted when the color picker receives input.
OnInput string `attr:"x-on:input"`
//
OnShow string `attr:"x-on:wa-show"`
//
OnAfterShow string `attr:"x-on:wa-after-show"`
//
OnHide string `attr:"x-on:wa-hide"`
//
OnAfterHide string `attr:"x-on:wa-after-hide"`
// Emitted when the color picker loses focus.
OnBlur string `attr:"x-on:blur"`
// Emitted when the color picker receives focus.
OnFocus string `attr:"x-on:focus"`
// 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 ColorPickerSlots
// Attrs contains additional HTML attributes
Attrs templ.Attributes
}
// ColorPickerSlots holds named slot content for the component
type ColorPickerSlots struct {
// The color picker's form label. Alternatively, you can use the label attribute.
Label templ.Component
// The color picker's form hint. Alternatively, you can use the hint attribute.
Hint templ.Component
}
// ColorPickerBuilder provides a fluent API for constructing ColorPickerProps
type ColorPickerBuilder struct {
props ColorPickerProps
}
// NewColorPicker creates a new builder for wa-color-picker
func NewColorPicker() *ColorPickerBuilder {
return &ColorPickerBuilder{}
}
// Value sets the value attribute
// The default value of the form control. Primarily used for resetting the form control.
func (b *ColorPickerBuilder) Value(v string) *ColorPickerBuilder {
b.props.Value = v
return b
}
// WithLabel sets the with-label attribute
func (b *ColorPickerBuilder) WithLabel(v bool) *ColorPickerBuilder {
b.props.WithLabel = v
return b
}
// WithHint sets the with-hint attribute
func (b *ColorPickerBuilder) WithHint(v bool) *ColorPickerBuilder {
b.props.WithHint = v
return b
}
// Label sets the label attribute
// The color picker's label. This will not be displayed, but it will be announced by assistive devices. If you need to
func (b *ColorPickerBuilder) Label(v string) *ColorPickerBuilder {
b.props.Label = v
return b
}
// Hint sets the hint attribute
// The color picker's hint. If you need to display HTML, use the hint slot instead.
func (b *ColorPickerBuilder) Hint(v string) *ColorPickerBuilder {
b.props.Hint = v
return b
}
// Format sets the format attribute
// The format to use. If opacity is enabled, these will translate to HEXA, RGBA, HSLA, and HSVA respectively. The color
func (b *ColorPickerBuilder) Format(v string) *ColorPickerBuilder {
b.props.Format = v
return b
}
// Size sets the size attribute
// Determines the size of the color picker's trigger
func (b *ColorPickerBuilder) Size(v string) *ColorPickerBuilder {
b.props.Size = v
return b
}
// WithoutFormatToggle sets the without-format-toggle attribute
// Removes the button that lets users toggle between format.
func (b *ColorPickerBuilder) WithoutFormatToggle(v bool) *ColorPickerBuilder {
b.props.WithoutFormatToggle = v
return b
}
// Name sets the name attribute
// The name of the form control, submitted as a name/value pair with form data.
func (b *ColorPickerBuilder) Name(v string) *ColorPickerBuilder {
b.props.Name = v
return b
}
// Disabled sets the disabled attribute
// Disables the color picker.
func (b *ColorPickerBuilder) Disabled(v bool) *ColorPickerBuilder {
b.props.Disabled = v
return b
}
// Open sets the open attribute
// Indicates whether or not the popup is open. You can toggle this attribute to show and hide the popup, or you
func (b *ColorPickerBuilder) Open(v bool) *ColorPickerBuilder {
b.props.Open = v
return b
}
// Opacity sets the opacity attribute
// Shows the opacity slider. Enabling this will cause the formatted value to be HEXA, RGBA, or HSLA.
func (b *ColorPickerBuilder) Opacity(v bool) *ColorPickerBuilder {
b.props.Opacity = v
return b
}
// Uppercase sets the uppercase attribute
// By default, values are lowercase. With this attribute, values will be uppercase instead.
func (b *ColorPickerBuilder) Uppercase(v bool) *ColorPickerBuilder {
b.props.Uppercase = v
return b
}
// Swatches sets the swatches attribute
// One or more predefined color swatches to display as presets in the color picker. Can include any format the color
func (b *ColorPickerBuilder) Swatches(v string) *ColorPickerBuilder {
b.props.Swatches = v
return b
}
// Required sets the required attribute
// Makes the color picker a required field.
func (b *ColorPickerBuilder) Required(v bool) *ColorPickerBuilder {
b.props.Required = v
return b
}
// OnChange sets the handler for change event
// Emitted when the color picker's value changes.
func (b *ColorPickerBuilder) OnChange(handler string) *ColorPickerBuilder {
b.props.OnChange = handler
return b
}
// OnInput sets the handler for input event
// Emitted when the color picker receives input.
func (b *ColorPickerBuilder) OnInput(handler string) *ColorPickerBuilder {
b.props.OnInput = handler
return b
}
// OnShow sets the handler for wa-show event
func (b *ColorPickerBuilder) OnShow(handler string) *ColorPickerBuilder {
b.props.OnShow = handler
return b
}
// OnAfterShow sets the handler for wa-after-show event
func (b *ColorPickerBuilder) OnAfterShow(handler string) *ColorPickerBuilder {
b.props.OnAfterShow = handler
return b
}
// OnHide sets the handler for wa-hide event
func (b *ColorPickerBuilder) OnHide(handler string) *ColorPickerBuilder {
b.props.OnHide = handler
return b
}
// OnAfterHide sets the handler for wa-after-hide event
func (b *ColorPickerBuilder) OnAfterHide(handler string) *ColorPickerBuilder {
b.props.OnAfterHide = handler
return b
}
// OnBlur sets the handler for blur event
// Emitted when the color picker loses focus.
func (b *ColorPickerBuilder) OnBlur(handler string) *ColorPickerBuilder {
b.props.OnBlur = handler
return b
}
// OnFocus sets the handler for focus event
// Emitted when the color picker receives focus.
func (b *ColorPickerBuilder) OnFocus(handler string) *ColorPickerBuilder {
b.props.OnFocus = 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 *ColorPickerBuilder) OnInvalid(handler string) *ColorPickerBuilder {
b.props.OnInvalid = handler
return b
}
// LabelSlot sets the label slot content
// The color picker's form label. Alternatively, you can use the label attribute.
func (b *ColorPickerBuilder) LabelSlot(c templ.Component) *ColorPickerBuilder {
b.props.Slots.Label = c
return b
}
// HintSlot sets the hint slot content
// The color picker's form hint. Alternatively, you can use the hint attribute.
func (b *ColorPickerBuilder) HintSlot(c templ.Component) *ColorPickerBuilder {
b.props.Slots.Hint = c
return b
}
// Attr adds a custom HTML attribute
func (b *ColorPickerBuilder) Attr(name, value string) *ColorPickerBuilder {
if b.props.Attrs == nil {
b.props.Attrs = templ.Attributes{}
}
b.props.Attrs[name] = value
return b
}
// Attrs merges multiple attributes
func (b *ColorPickerBuilder) Attrs(attrs templ.Attributes) *ColorPickerBuilder {
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 *ColorPickerBuilder) Props() ColorPickerProps {
return b.props
}
// Build returns the props (alias for Props for semantic clarity)
func (b *ColorPickerBuilder) Build() ColorPickerProps {
return b.props
}
// ColorPicker renders the wa-color-picker component
func ColorPicker(props ColorPickerProps) 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-color-picker")
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
if props.Value != "" {
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 2, " value=\"")
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
var templ_7745c5c3_Var2 string
templ_7745c5c3_Var2, templ_7745c5c3_Err = templ.JoinStringErrs(props.Value)
if templ_7745c5c3_Err != nil {
return templ.Error{Err: templ_7745c5c3_Err, FileName: `pkg/wa/color-picker.templ`, Line: 308, Col: 22}
}
_, 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.WithLabel {
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 4, " with-label")
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
}
if props.WithHint {
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 5, " with-hint")
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
}
if props.Label != "" {
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 6, " label=\"")
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
var templ_7745c5c3_Var3 string
templ_7745c5c3_Var3, templ_7745c5c3_Err = templ.JoinStringErrs(props.Label)
if templ_7745c5c3_Err != nil {
return templ.Error{Err: templ_7745c5c3_Err, FileName: `pkg/wa/color-picker.templ`, Line: 317, 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, 7, "\"")
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
}
if props.Hint != "" {
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 8, " hint=\"")
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
var templ_7745c5c3_Var4 string
templ_7745c5c3_Var4, templ_7745c5c3_Err = templ.JoinStringErrs(props.Hint)
if templ_7745c5c3_Err != nil {
return templ.Error{Err: templ_7745c5c3_Err, FileName: `pkg/wa/color-picker.templ`, Line: 320, 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, 9, "\"")
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
}
if props.Format != "" {
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 10, " format=\"")
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
var templ_7745c5c3_Var5 string
templ_7745c5c3_Var5, templ_7745c5c3_Err = templ.JoinStringErrs(props.Format)
if templ_7745c5c3_Err != nil {
return templ.Error{Err: templ_7745c5c3_Err, FileName: `pkg/wa/color-picker.templ`, Line: 323, Col: 24}
}
_, 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, 11, "\"")
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
}
if props.Size != "" {
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 12, " size=\"")
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
var templ_7745c5c3_Var6 string
templ_7745c5c3_Var6, templ_7745c5c3_Err = templ.JoinStringErrs(props.Size)
if templ_7745c5c3_Err != nil {
return templ.Error{Err: templ_7745c5c3_Err, FileName: `pkg/wa/color-picker.templ`, Line: 326, Col: 20}
}
_, 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, 13, "\"")
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
}
if props.WithoutFormatToggle {
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 14, " without-format-toggle")
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
}
if props.Name != "" {
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 15, " name=\"")
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
var templ_7745c5c3_Var7 string
templ_7745c5c3_Var7, templ_7745c5c3_Err = templ.JoinStringErrs(props.Name)
if templ_7745c5c3_Err != nil {
return templ.Error{Err: templ_7745c5c3_Err, FileName: `pkg/wa/color-picker.templ`, Line: 332, Col: 20}
}
_, 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, 16, "\"")
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
}
if props.Disabled {
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 17, " disabled")
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
}
if props.Open {
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 18, " open")
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
}
if props.Opacity {
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 19, " opacity")
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
}
if props.Uppercase {
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 20, " uppercase")
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
}
if props.Swatches != "" {
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 21, " swatches=\"")
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
var templ_7745c5c3_Var8 string
templ_7745c5c3_Var8, templ_7745c5c3_Err = templ.JoinStringErrs(props.Swatches)
if templ_7745c5c3_Err != nil {
return templ.Error{Err: templ_7745c5c3_Err, FileName: `pkg/wa/color-picker.templ`, Line: 347, Col: 28}
}
_, 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, 22, "\"")
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
}
if props.Required {
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 23, " required")
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
}
if props.OnChange != "" {
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 24, " x-on:change=\"")
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
var templ_7745c5c3_Var9 string
templ_7745c5c3_Var9, templ_7745c5c3_Err = templ.JoinStringErrs(props.OnChange)
if templ_7745c5c3_Err != nil {
return templ.Error{Err: templ_7745c5c3_Err, FileName: `pkg/wa/color-picker.templ`, Line: 353, Col: 31}
}
_, 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, 25, "\"")
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
}
if props.OnInput != "" {
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 26, " x-on:input=\"")
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
var templ_7745c5c3_Var10 string
templ_7745c5c3_Var10, templ_7745c5c3_Err = templ.JoinStringErrs(props.OnInput)
if templ_7745c5c3_Err != nil {
return templ.Error{Err: templ_7745c5c3_Err, FileName: `pkg/wa/color-picker.templ`, Line: 356, Col: 29}
}
_, 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, 27, "\"")
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
}
if props.OnShow != "" {
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 28, " x-on:wa-show=\"")
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
var templ_7745c5c3_Var11 string
templ_7745c5c3_Var11, templ_7745c5c3_Err = templ.JoinStringErrs(props.OnShow)
if templ_7745c5c3_Err != nil {
return templ.Error{Err: templ_7745c5c3_Err, FileName: `pkg/wa/color-picker.templ`, Line: 359, Col: 30}
}
_, 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.OnAfterShow != "" {
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 30, " x-on:wa-after-show=\"")
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
var templ_7745c5c3_Var12 string
templ_7745c5c3_Var12, templ_7745c5c3_Err = templ.JoinStringErrs(props.OnAfterShow)
if templ_7745c5c3_Err != nil {
return templ.Error{Err: templ_7745c5c3_Err, FileName: `pkg/wa/color-picker.templ`, Line: 362, Col: 41}
}
_, 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.OnHide != "" {
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 32, " x-on:wa-hide=\"")
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
var templ_7745c5c3_Var13 string
templ_7745c5c3_Var13, templ_7745c5c3_Err = templ.JoinStringErrs(props.OnHide)
if templ_7745c5c3_Err != nil {
return templ.Error{Err: templ_7745c5c3_Err, FileName: `pkg/wa/color-picker.templ`, Line: 365, Col: 30}
}
_, 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.OnAfterHide != "" {
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 34, " x-on:wa-after-hide=\"")
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
var templ_7745c5c3_Var14 string
templ_7745c5c3_Var14, templ_7745c5c3_Err = templ.JoinStringErrs(props.OnAfterHide)
if templ_7745c5c3_Err != nil {
return templ.Error{Err: templ_7745c5c3_Err, FileName: `pkg/wa/color-picker.templ`, Line: 368, Col: 41}
}
_, 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.OnBlur != "" {
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 36, " x-on:blur=\"")
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
var templ_7745c5c3_Var15 string
templ_7745c5c3_Var15, templ_7745c5c3_Err = templ.JoinStringErrs(props.OnBlur)
if templ_7745c5c3_Err != nil {
return templ.Error{Err: templ_7745c5c3_Err, FileName: `pkg/wa/color-picker.templ`, Line: 371, Col: 27}
}
_, 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.OnFocus != "" {
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 38, " x-on:focus=\"")
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
var templ_7745c5c3_Var16 string
templ_7745c5c3_Var16, templ_7745c5c3_Err = templ.JoinStringErrs(props.OnFocus)
if templ_7745c5c3_Err != nil {
return templ.Error{Err: templ_7745c5c3_Err, FileName: `pkg/wa/color-picker.templ`, Line: 374, Col: 29}
}
_, 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.OnInvalid != "" {
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 40, " x-on:wa-invalid=\"")
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
var templ_7745c5c3_Var17 string
templ_7745c5c3_Var17, templ_7745c5c3_Err = templ.JoinStringErrs(props.OnInvalid)
if templ_7745c5c3_Err != nil {
return templ.Error{Err: templ_7745c5c3_Err, FileName: `pkg/wa/color-picker.templ`, Line: 377, Col: 36}
}
_, 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
}
}
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, 42, ">")
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
if props.Slots.Label != nil {
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 43, "<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, 44, "</div>")
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
}
if props.Slots.Hint != nil {
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 45, "<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, 46, "</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, 47, "</wa-color-picker>")
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
return nil
})
}
// ColorPickerFunc renders with a builder function for inline configuration
func ColorPickerFunc(fn func(*ColorPickerBuilder)) 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_Var18 := templ.GetChildren(ctx)
if templ_7745c5c3_Var18 == nil {
templ_7745c5c3_Var18 = templ.NopComponent
}
ctx = templ.ClearChildren(ctx)
b := NewColorPicker()
fn(b)
templ_7745c5c3_Var19 := 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_Var18.Render(ctx, templ_7745c5c3_Buffer)
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
return nil
})
templ_7745c5c3_Err = ColorPicker(b.Props()).Render(templ.WithChildren(ctx, templ_7745c5c3_Var19), templ_7745c5c3_Buffer)
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
return nil
})
}
var _ = templruntime.GeneratedTemplate