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-copy-button
|
|
|
|
|
|
|
|
|
|
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"
|
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
// Copies text data to the clipboard when the user clicks the trigger.
|
|
|
|
|
//
|
|
|
|
|
// Web Awesome component: <wa-copy-button>
|
|
|
|
|
|
|
|
|
|
// CopyButtonProps holds all properties for the wa-copy-button component
|
|
|
|
|
type CopyButtonProps struct {
|
|
|
|
|
// The text value to copy.
|
|
|
|
|
Value string `attr:"value"`
|
|
|
|
|
// An id that references an element in the same document from which data will be copied. If both this and value are
|
|
|
|
|
From string `attr:"from"`
|
|
|
|
|
// Disables the copy button.
|
|
|
|
|
Disabled bool `attr:"disabled"`
|
|
|
|
|
// A custom label to show in the tooltip.
|
|
|
|
|
CopyLabel string `attr:"copy-label"`
|
|
|
|
|
// A custom label to show in the tooltip after copying.
|
|
|
|
|
SuccessLabel string `attr:"success-label"`
|
|
|
|
|
// A custom label to show in the tooltip when a copy error occurs.
|
|
|
|
|
ErrorLabel string `attr:"error-label"`
|
|
|
|
|
// The length of time to show feedback before restoring the default trigger.
|
|
|
|
|
FeedbackDuration float64 `attr:"feedback-duration"`
|
|
|
|
|
// The preferred placement of the tooltip.
|
|
|
|
|
// Valid values: "top", "right", "bottom", "left"
|
|
|
|
|
TooltipPlacement string `attr:"tooltip-placement"`
|
|
|
|
|
|
|
|
|
|
// Events
|
|
|
|
|
// Emitted when the data has been copied.
|
|
|
|
|
OnCopy string `attr:"x-on:wa-copy"`
|
|
|
|
|
// Emitted when the data could not be copied.
|
|
|
|
|
OnError string `attr:"x-on:wa-error"`
|
|
|
|
|
|
|
|
|
|
// Slots contains named slot content
|
|
|
|
|
Slots CopyButtonSlots
|
|
|
|
|
|
|
|
|
|
// Attrs contains additional HTML attributes
|
|
|
|
|
Attrs templ.Attributes
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// CopyButtonSlots holds named slot content for the component
|
|
|
|
|
type CopyButtonSlots struct {
|
|
|
|
|
// The icon to show in the default copy state. Works best with <wa-icon>.
|
|
|
|
|
CopyIcon templ.Component
|
|
|
|
|
// The icon to show when the content is copied. Works best with <wa-icon>.
|
|
|
|
|
SuccessIcon templ.Component
|
|
|
|
|
// The icon to show when a copy error occurs. Works best with <wa-icon>.
|
|
|
|
|
ErrorIcon templ.Component
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// CopyButtonBuilder provides a fluent API for constructing CopyButtonProps
|
|
|
|
|
type CopyButtonBuilder struct {
|
|
|
|
|
props CopyButtonProps
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// NewCopyButton creates a new builder for wa-copy-button
|
|
|
|
|
func NewCopyButton() *CopyButtonBuilder {
|
|
|
|
|
return &CopyButtonBuilder{}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// Value sets the value attribute
|
|
|
|
|
// The text value to copy.
|
|
|
|
|
func (b *CopyButtonBuilder) Value(v string) *CopyButtonBuilder {
|
|
|
|
|
b.props.Value = v
|
|
|
|
|
return b
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// From sets the from attribute
|
|
|
|
|
// An id that references an element in the same document from which data will be copied. If both this and value are
|
|
|
|
|
func (b *CopyButtonBuilder) From(v string) *CopyButtonBuilder {
|
|
|
|
|
b.props.From = v
|
|
|
|
|
return b
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// Disabled sets the disabled attribute
|
|
|
|
|
// Disables the copy button.
|
|
|
|
|
func (b *CopyButtonBuilder) Disabled(v bool) *CopyButtonBuilder {
|
|
|
|
|
b.props.Disabled = v
|
|
|
|
|
return b
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// CopyLabel sets the copy-label attribute
|
|
|
|
|
// A custom label to show in the tooltip.
|
|
|
|
|
func (b *CopyButtonBuilder) CopyLabel(v string) *CopyButtonBuilder {
|
|
|
|
|
b.props.CopyLabel = v
|
|
|
|
|
return b
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// SuccessLabel sets the success-label attribute
|
|
|
|
|
// A custom label to show in the tooltip after copying.
|
|
|
|
|
func (b *CopyButtonBuilder) SuccessLabel(v string) *CopyButtonBuilder {
|
|
|
|
|
b.props.SuccessLabel = v
|
|
|
|
|
return b
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// ErrorLabel sets the error-label attribute
|
|
|
|
|
// A custom label to show in the tooltip when a copy error occurs.
|
|
|
|
|
func (b *CopyButtonBuilder) ErrorLabel(v string) *CopyButtonBuilder {
|
|
|
|
|
b.props.ErrorLabel = v
|
|
|
|
|
return b
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// FeedbackDuration sets the feedback-duration attribute
|
|
|
|
|
// The length of time to show feedback before restoring the default trigger.
|
|
|
|
|
func (b *CopyButtonBuilder) FeedbackDuration(v float64) *CopyButtonBuilder {
|
|
|
|
|
b.props.FeedbackDuration = v
|
|
|
|
|
return b
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// TooltipPlacement sets the tooltip-placement attribute
|
|
|
|
|
// The preferred placement of the tooltip.
|
|
|
|
|
func (b *CopyButtonBuilder) TooltipPlacement(v string) *CopyButtonBuilder {
|
|
|
|
|
b.props.TooltipPlacement = v
|
|
|
|
|
return b
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// OnCopy sets the handler for wa-copy event
|
|
|
|
|
// Emitted when the data has been copied.
|
|
|
|
|
func (b *CopyButtonBuilder) OnCopy(handler string) *CopyButtonBuilder {
|
|
|
|
|
b.props.OnCopy = handler
|
|
|
|
|
return b
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// OnError sets the handler for wa-error event
|
|
|
|
|
// Emitted when the data could not be copied.
|
|
|
|
|
func (b *CopyButtonBuilder) OnError(handler string) *CopyButtonBuilder {
|
|
|
|
|
b.props.OnError = handler
|
|
|
|
|
return b
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// CopyIconSlot sets the copy-icon slot content
|
|
|
|
|
// The icon to show in the default copy state. Works best with <wa-icon>.
|
|
|
|
|
func (b *CopyButtonBuilder) CopyIconSlot(c templ.Component) *CopyButtonBuilder {
|
|
|
|
|
b.props.Slots.CopyIcon = c
|
|
|
|
|
return b
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// SuccessIconSlot sets the success-icon slot content
|
|
|
|
|
// The icon to show when the content is copied. Works best with <wa-icon>.
|
|
|
|
|
func (b *CopyButtonBuilder) SuccessIconSlot(c templ.Component) *CopyButtonBuilder {
|
|
|
|
|
b.props.Slots.SuccessIcon = c
|
|
|
|
|
return b
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// ErrorIconSlot sets the error-icon slot content
|
|
|
|
|
// The icon to show when a copy error occurs. Works best with <wa-icon>.
|
|
|
|
|
func (b *CopyButtonBuilder) ErrorIconSlot(c templ.Component) *CopyButtonBuilder {
|
|
|
|
|
b.props.Slots.ErrorIcon = c
|
|
|
|
|
return b
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// Attr adds a custom HTML attribute
|
|
|
|
|
func (b *CopyButtonBuilder) Attr(name, value string) *CopyButtonBuilder {
|
|
|
|
|
if b.props.Attrs == nil {
|
|
|
|
|
b.props.Attrs = templ.Attributes{}
|
|
|
|
|
}
|
|
|
|
|
b.props.Attrs[name] = value
|
|
|
|
|
return b
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// Attrs merges multiple attributes
|
|
|
|
|
func (b *CopyButtonBuilder) Attrs(attrs templ.Attributes) *CopyButtonBuilder {
|
|
|
|
|
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 *CopyButtonBuilder) Props() CopyButtonProps {
|
|
|
|
|
return b.props
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// Build returns the props (alias for Props for semantic clarity)
|
|
|
|
|
func (b *CopyButtonBuilder) Build() CopyButtonProps {
|
|
|
|
|
return b.props
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// CopyButton renders the wa-copy-button component
|
|
|
|
|
func CopyButton(props CopyButtonProps) 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-copy-button")
|
|
|
|
|
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/copy-button.templ`, Line: 192, 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.From != "" {
|
|
|
|
|
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 4, " from=\"")
|
|
|
|
|
if templ_7745c5c3_Err != nil {
|
|
|
|
|
return templ_7745c5c3_Err
|
|
|
|
|
}
|
|
|
|
|
var templ_7745c5c3_Var3 string
|
|
|
|
|
templ_7745c5c3_Var3, templ_7745c5c3_Err = templ.JoinStringErrs(props.From)
|
|
|
|
|
if templ_7745c5c3_Err != nil {
|
|
|
|
|
return templ.Error{Err: templ_7745c5c3_Err, FileName: `pkg/wa/copy-button.templ`, Line: 195, Col: 20}
|
|
|
|
|
}
|
|
|
|
|
_, 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.Disabled {
|
|
|
|
|
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 6, " disabled")
|
|
|
|
|
if templ_7745c5c3_Err != nil {
|
|
|
|
|
return templ_7745c5c3_Err
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
if props.CopyLabel != "" {
|
|
|
|
|
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 7, " copy-label=\"")
|
|
|
|
|
if templ_7745c5c3_Err != nil {
|
|
|
|
|
return templ_7745c5c3_Err
|
|
|
|
|
}
|
|
|
|
|
var templ_7745c5c3_Var4 string
|
|
|
|
|
templ_7745c5c3_Var4, templ_7745c5c3_Err = templ.JoinStringErrs(props.CopyLabel)
|
|
|
|
|
if templ_7745c5c3_Err != nil {
|
|
|
|
|
return templ.Error{Err: templ_7745c5c3_Err, FileName: `pkg/wa/copy-button.templ`, Line: 201, Col: 31}
|
|
|
|
|
}
|
|
|
|
|
_, 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, 8, "\"")
|
|
|
|
|
if templ_7745c5c3_Err != nil {
|
|
|
|
|
return templ_7745c5c3_Err
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
if props.SuccessLabel != "" {
|
|
|
|
|
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 9, " success-label=\"")
|
|
|
|
|
if templ_7745c5c3_Err != nil {
|
|
|
|
|
return templ_7745c5c3_Err
|
|
|
|
|
}
|
|
|
|
|
var templ_7745c5c3_Var5 string
|
|
|
|
|
templ_7745c5c3_Var5, templ_7745c5c3_Err = templ.JoinStringErrs(props.SuccessLabel)
|
|
|
|
|
if templ_7745c5c3_Err != nil {
|
|
|
|
|
return templ.Error{Err: templ_7745c5c3_Err, FileName: `pkg/wa/copy-button.templ`, Line: 204, 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.ErrorLabel != "" {
|
|
|
|
|
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 11, " error-label=\"")
|
|
|
|
|
if templ_7745c5c3_Err != nil {
|
|
|
|
|
return templ_7745c5c3_Err
|
|
|
|
|
}
|
|
|
|
|
var templ_7745c5c3_Var6 string
|
|
|
|
|
templ_7745c5c3_Var6, templ_7745c5c3_Err = templ.JoinStringErrs(props.ErrorLabel)
|
|
|
|
|
if templ_7745c5c3_Err != nil {
|
|
|
|
|
return templ.Error{Err: templ_7745c5c3_Err, FileName: `pkg/wa/copy-button.templ`, Line: 207, Col: 33}
|
|
|
|
|
}
|
|
|
|
|
_, 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.FeedbackDuration != 0 {
|
|
|
|
|
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 13, " feedback-duration=\"")
|
|
|
|
|
if templ_7745c5c3_Err != nil {
|
|
|
|
|
return templ_7745c5c3_Err
|
|
|
|
|
}
|
|
|
|
|
var templ_7745c5c3_Var7 string
|
|
|
|
|
templ_7745c5c3_Var7, templ_7745c5c3_Err = templ.JoinStringErrs(templ.Sprintf("%v", props.FeedbackDuration))
|
|
|
|
|
if templ_7745c5c3_Err != nil {
|
|
|
|
|
return templ.Error{Err: templ_7745c5c3_Err, FileName: `pkg/wa/copy-button.templ`, Line: 210, Col: 66}
|
|
|
|
|
}
|
|
|
|
|
_, 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, 14, "\"")
|
|
|
|
|
if templ_7745c5c3_Err != nil {
|
|
|
|
|
return templ_7745c5c3_Err
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
if props.TooltipPlacement != "" {
|
|
|
|
|
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 15, " tooltip-placement=\"")
|
|
|
|
|
if templ_7745c5c3_Err != nil {
|
|
|
|
|
return templ_7745c5c3_Err
|
|
|
|
|
}
|
|
|
|
|
var templ_7745c5c3_Var8 string
|
|
|
|
|
templ_7745c5c3_Var8, templ_7745c5c3_Err = templ.JoinStringErrs(props.TooltipPlacement)
|
|
|
|
|
if templ_7745c5c3_Err != nil {
|
|
|
|
|
return templ.Error{Err: templ_7745c5c3_Err, FileName: `pkg/wa/copy-button.templ`, Line: 213, Col: 45}
|
|
|
|
|
}
|
|
|
|
|
_, 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, 16, "\"")
|
|
|
|
|
if templ_7745c5c3_Err != nil {
|
|
|
|
|
return templ_7745c5c3_Err
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
if props.OnCopy != "" {
|
|
|
|
|
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 17, " x-on:wa-copy=\"")
|
|
|
|
|
if templ_7745c5c3_Err != nil {
|
|
|
|
|
return templ_7745c5c3_Err
|
|
|
|
|
}
|
|
|
|
|
var templ_7745c5c3_Var9 string
|
|
|
|
|
templ_7745c5c3_Var9, templ_7745c5c3_Err = templ.JoinStringErrs(props.OnCopy)
|
|
|
|
|
if templ_7745c5c3_Err != nil {
|
|
|
|
|
return templ.Error{Err: templ_7745c5c3_Err, FileName: `pkg/wa/copy-button.templ`, Line: 216, 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, 18, "\"")
|
|
|
|
|
if templ_7745c5c3_Err != nil {
|
|
|
|
|
return templ_7745c5c3_Err
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
if props.OnError != "" {
|
|
|
|
|
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 19, " x-on:wa-error=\"")
|
|
|
|
|
if templ_7745c5c3_Err != nil {
|
|
|
|
|
return templ_7745c5c3_Err
|
|
|
|
|
}
|
|
|
|
|
var templ_7745c5c3_Var10 string
|
|
|
|
|
templ_7745c5c3_Var10, templ_7745c5c3_Err = templ.JoinStringErrs(props.OnError)
|
|
|
|
|
if templ_7745c5c3_Err != nil {
|
|
|
|
|
return templ.Error{Err: templ_7745c5c3_Err, FileName: `pkg/wa/copy-button.templ`, Line: 219, Col: 32}
|
|
|
|
|
}
|
|
|
|
|
_, 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, 20, "\"")
|
|
|
|
|
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, 21, ">")
|
|
|
|
|
if templ_7745c5c3_Err != nil {
|
|
|
|
|
return templ_7745c5c3_Err
|
|
|
|
|
}
|
|
|
|
|
if props.Slots.CopyIcon != nil {
|
|
|
|
|
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 22, "<div slot=\"copy-icon\">")
|
|
|
|
|
if templ_7745c5c3_Err != nil {
|
|
|
|
|
return templ_7745c5c3_Err
|
|
|
|
|
}
|
|
|
|
|
templ_7745c5c3_Err = props.Slots.CopyIcon.Render(ctx, templ_7745c5c3_Buffer)
|
|
|
|
|
if templ_7745c5c3_Err != nil {
|
|
|
|
|
return templ_7745c5c3_Err
|
|
|
|
|
}
|
|
|
|
|
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 23, "</div>")
|
|
|
|
|
if templ_7745c5c3_Err != nil {
|
|
|
|
|
return templ_7745c5c3_Err
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
if props.Slots.SuccessIcon != nil {
|
|
|
|
|
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 24, "<div slot=\"success-icon\">")
|
|
|
|
|
if templ_7745c5c3_Err != nil {
|
|
|
|
|
return templ_7745c5c3_Err
|
|
|
|
|
}
|
|
|
|
|
templ_7745c5c3_Err = props.Slots.SuccessIcon.Render(ctx, templ_7745c5c3_Buffer)
|
|
|
|
|
if templ_7745c5c3_Err != nil {
|
|
|
|
|
return templ_7745c5c3_Err
|
|
|
|
|
}
|
|
|
|
|
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 25, "</div>")
|
|
|
|
|
if templ_7745c5c3_Err != nil {
|
|
|
|
|
return templ_7745c5c3_Err
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
if props.Slots.ErrorIcon != nil {
|
|
|
|
|
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 26, "<div slot=\"error-icon\">")
|
|
|
|
|
if templ_7745c5c3_Err != nil {
|
|
|
|
|
return templ_7745c5c3_Err
|
|
|
|
|
}
|
|
|
|
|
templ_7745c5c3_Err = props.Slots.ErrorIcon.Render(ctx, templ_7745c5c3_Buffer)
|
|
|
|
|
if templ_7745c5c3_Err != nil {
|
|
|
|
|
return templ_7745c5c3_Err
|
|
|
|
|
}
|
|
|
|
|
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 27, "</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, 28, "</wa-copy-button>")
|
|
|
|
|
if templ_7745c5c3_Err != nil {
|
|
|
|
|
return templ_7745c5c3_Err
|
|
|
|
|
}
|
|
|
|
|
return nil
|
|
|
|
|
})
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// CopyButtonFunc renders with a builder function for inline configuration
|
|
|
|
|
func CopyButtonFunc(fn func(*CopyButtonBuilder)) 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_Var11 := templ.GetChildren(ctx)
|
|
|
|
|
if templ_7745c5c3_Var11 == nil {
|
|
|
|
|
templ_7745c5c3_Var11 = templ.NopComponent
|
|
|
|
|
}
|
|
|
|
|
ctx = templ.ClearChildren(ctx)
|
|
|
|
|
b := NewCopyButton()
|
|
|
|
|
fn(b)
|
|
|
|
|
templ_7745c5c3_Var12 := 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_Var11.Render(ctx, templ_7745c5c3_Buffer)
|
|
|
|
|
if templ_7745c5c3_Err != nil {
|
|
|
|
|
return templ_7745c5c3_Err
|
|
|
|
|
}
|
|
|
|
|
return nil
|
|
|
|
|
})
|
|
|
|
|
templ_7745c5c3_Err = CopyButton(b.Props()).Render(templ.WithChildren(ctx, templ_7745c5c3_Var12), templ_7745c5c3_Buffer)
|
|
|
|
|
if templ_7745c5c3_Err != nil {
|
|
|
|
|
return templ_7745c5c3_Err
|
|
|
|
|
}
|
|
|
|
|
return nil
|
|
|
|
|
})
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
var _ = templruntime.GeneratedTemplate
|