513 lines
37 KiB
Go
513 lines
37 KiB
Go
// Code generated by templ - DO NOT EDIT.
|
|
|
|
// templ: version: v0.3.865
|
|
// templui component popover - version: main installed by templui v0.71.0
|
|
|
|
package popover
|
|
|
|
//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 (
|
|
"git.jmbit.de/jmb/scanfile/server/web/templui/utils"
|
|
"strconv"
|
|
)
|
|
|
|
type Placement string
|
|
|
|
const (
|
|
PlacementTop Placement = "top"
|
|
PlacementTopStart Placement = "top-start"
|
|
PlacementTopEnd Placement = "top-end"
|
|
PlacementRight Placement = "right"
|
|
PlacementRightStart Placement = "right-start"
|
|
PlacementRightEnd Placement = "right-end"
|
|
PlacementBottom Placement = "bottom"
|
|
PlacementBottomStart Placement = "bottom-start"
|
|
PlacementBottomEnd Placement = "bottom-end"
|
|
PlacementLeft Placement = "left"
|
|
PlacementLeftStart Placement = "left-start"
|
|
PlacementLeftEnd Placement = "left-end"
|
|
)
|
|
|
|
type TriggerType string
|
|
|
|
const (
|
|
TriggerTypeHover TriggerType = "hover"
|
|
TriggerTypeClick TriggerType = "click"
|
|
)
|
|
|
|
type Props struct {
|
|
Class string
|
|
}
|
|
|
|
type TriggerProps struct {
|
|
ID string
|
|
For string
|
|
TriggerType TriggerType
|
|
}
|
|
|
|
type ContentProps struct {
|
|
ID string
|
|
Class string
|
|
Attributes templ.Attributes
|
|
Placement Placement
|
|
Offset int
|
|
DisableClickAway bool
|
|
DisableESC bool
|
|
ShowArrow bool
|
|
HoverDelay int
|
|
HoverOutDelay int
|
|
MatchWidth bool
|
|
}
|
|
|
|
func Popover(props ...Props) 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 = Script().Render(ctx, templ_7745c5c3_Buffer)
|
|
if templ_7745c5c3_Err != nil {
|
|
return templ_7745c5c3_Err
|
|
}
|
|
var p Props
|
|
if len(props) > 0 {
|
|
p = props[0]
|
|
}
|
|
var templ_7745c5c3_Var2 = []any{p.Class}
|
|
templ_7745c5c3_Err = templ.RenderCSSItems(ctx, templ_7745c5c3_Buffer, templ_7745c5c3_Var2...)
|
|
if templ_7745c5c3_Err != nil {
|
|
return templ_7745c5c3_Err
|
|
}
|
|
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 1, "<div class=\"")
|
|
if templ_7745c5c3_Err != nil {
|
|
return templ_7745c5c3_Err
|
|
}
|
|
var templ_7745c5c3_Var3 string
|
|
templ_7745c5c3_Var3, templ_7745c5c3_Err = templ.JoinStringErrs(templ.CSSClasses(templ_7745c5c3_Var2).String())
|
|
if templ_7745c5c3_Err != nil {
|
|
return templ.Error{Err: templ_7745c5c3_Err, FileName: `server/web/templui/components/popover/popover.templ`, Line: 1, Col: 0}
|
|
}
|
|
_, 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, 2, "\">")
|
|
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, 3, "</div>")
|
|
if templ_7745c5c3_Err != nil {
|
|
return templ_7745c5c3_Err
|
|
}
|
|
return nil
|
|
})
|
|
}
|
|
|
|
func Trigger(props ...TriggerProps) 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_Var4 := templ.GetChildren(ctx)
|
|
if templ_7745c5c3_Var4 == nil {
|
|
templ_7745c5c3_Var4 = templ.NopComponent
|
|
}
|
|
ctx = templ.ClearChildren(ctx)
|
|
var p TriggerProps
|
|
if len(props) > 0 {
|
|
p = props[0]
|
|
}
|
|
if p.TriggerType == "" {
|
|
p.TriggerType = TriggerTypeClick
|
|
}
|
|
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 4, "<span")
|
|
if templ_7745c5c3_Err != nil {
|
|
return templ_7745c5c3_Err
|
|
}
|
|
if p.ID != "" {
|
|
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 5, " id=\"")
|
|
if templ_7745c5c3_Err != nil {
|
|
return templ_7745c5c3_Err
|
|
}
|
|
var templ_7745c5c3_Var5 string
|
|
templ_7745c5c3_Var5, templ_7745c5c3_Err = templ.JoinStringErrs(p.ID)
|
|
if templ_7745c5c3_Err != nil {
|
|
return templ.Error{Err: templ_7745c5c3_Err, FileName: `server/web/templui/components/popover/popover.templ`, Line: 78, Col: 12}
|
|
}
|
|
_, 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, 6, "\"")
|
|
if templ_7745c5c3_Err != nil {
|
|
return templ_7745c5c3_Err
|
|
}
|
|
}
|
|
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 7, " data-popover-trigger data-popover-for=\"")
|
|
if templ_7745c5c3_Err != nil {
|
|
return templ_7745c5c3_Err
|
|
}
|
|
var templ_7745c5c3_Var6 string
|
|
templ_7745c5c3_Var6, templ_7745c5c3_Err = templ.JoinStringErrs(p.For)
|
|
if templ_7745c5c3_Err != nil {
|
|
return templ.Error{Err: templ_7745c5c3_Err, FileName: `server/web/templui/components/popover/popover.templ`, Line: 81, Col: 26}
|
|
}
|
|
_, 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, 8, "\" data-popover-type=\"")
|
|
if templ_7745c5c3_Err != nil {
|
|
return templ_7745c5c3_Err
|
|
}
|
|
var templ_7745c5c3_Var7 string
|
|
templ_7745c5c3_Var7, templ_7745c5c3_Err = templ.JoinStringErrs(string(p.TriggerType))
|
|
if templ_7745c5c3_Err != nil {
|
|
return templ.Error{Err: templ_7745c5c3_Err, FileName: `server/web/templui/components/popover/popover.templ`, Line: 82, Col: 43}
|
|
}
|
|
_, 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, 9, "\">")
|
|
if templ_7745c5c3_Err != nil {
|
|
return templ_7745c5c3_Err
|
|
}
|
|
templ_7745c5c3_Err = templ_7745c5c3_Var4.Render(ctx, templ_7745c5c3_Buffer)
|
|
if templ_7745c5c3_Err != nil {
|
|
return templ_7745c5c3_Err
|
|
}
|
|
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 10, "</span>")
|
|
if templ_7745c5c3_Err != nil {
|
|
return templ_7745c5c3_Err
|
|
}
|
|
return nil
|
|
})
|
|
}
|
|
|
|
func Content(props ...ContentProps) 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_Var8 := templ.GetChildren(ctx)
|
|
if templ_7745c5c3_Var8 == nil {
|
|
templ_7745c5c3_Var8 = templ.NopComponent
|
|
}
|
|
ctx = templ.ClearChildren(ctx)
|
|
var p ContentProps
|
|
if len(props) > 0 {
|
|
p = props[0]
|
|
}
|
|
if p.Placement == "" {
|
|
p.Placement = PlacementBottom
|
|
}
|
|
if p.Offset == 0 {
|
|
if p.ShowArrow {
|
|
p.Offset = 8
|
|
} else {
|
|
p.Offset = 4
|
|
}
|
|
}
|
|
var templ_7745c5c3_Var9 = []any{utils.TwMerge(
|
|
"bg-background rounded-lg border text-sm shadow-lg pointer-events-auto absolute z-[9999] hidden top-0 left-0",
|
|
p.Class,
|
|
)}
|
|
templ_7745c5c3_Err = templ.RenderCSSItems(ctx, templ_7745c5c3_Buffer, templ_7745c5c3_Var9...)
|
|
if templ_7745c5c3_Err != nil {
|
|
return templ_7745c5c3_Err
|
|
}
|
|
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 11, "<div id=\"")
|
|
if templ_7745c5c3_Err != nil {
|
|
return templ_7745c5c3_Err
|
|
}
|
|
var templ_7745c5c3_Var10 string
|
|
templ_7745c5c3_Var10, templ_7745c5c3_Err = templ.JoinStringErrs(p.ID)
|
|
if templ_7745c5c3_Err != nil {
|
|
return templ.Error{Err: templ_7745c5c3_Err, FileName: `server/web/templui/components/popover/popover.templ`, Line: 104, Col: 11}
|
|
}
|
|
_, 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, 12, "\" data-popover-id=\"")
|
|
if templ_7745c5c3_Err != nil {
|
|
return templ_7745c5c3_Err
|
|
}
|
|
var templ_7745c5c3_Var11 string
|
|
templ_7745c5c3_Var11, templ_7745c5c3_Err = templ.JoinStringErrs(p.ID)
|
|
if templ_7745c5c3_Err != nil {
|
|
return templ.Error{Err: templ_7745c5c3_Err, FileName: `server/web/templui/components/popover/popover.templ`, Line: 105, Col: 24}
|
|
}
|
|
_, 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, 13, "\" data-popover-placement=\"")
|
|
if templ_7745c5c3_Err != nil {
|
|
return templ_7745c5c3_Err
|
|
}
|
|
var templ_7745c5c3_Var12 string
|
|
templ_7745c5c3_Var12, templ_7745c5c3_Err = templ.JoinStringErrs(string(p.Placement))
|
|
if templ_7745c5c3_Err != nil {
|
|
return templ.Error{Err: templ_7745c5c3_Err, FileName: `server/web/templui/components/popover/popover.templ`, Line: 106, Col: 46}
|
|
}
|
|
_, 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, 14, "\" data-popover-offset=\"")
|
|
if templ_7745c5c3_Err != nil {
|
|
return templ_7745c5c3_Err
|
|
}
|
|
var templ_7745c5c3_Var13 string
|
|
templ_7745c5c3_Var13, templ_7745c5c3_Err = templ.JoinStringErrs(strconv.Itoa(p.Offset))
|
|
if templ_7745c5c3_Err != nil {
|
|
return templ.Error{Err: templ_7745c5c3_Err, FileName: `server/web/templui/components/popover/popover.templ`, Line: 107, Col: 46}
|
|
}
|
|
_, 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, 15, "\" data-popover-disable-clickaway=\"")
|
|
if templ_7745c5c3_Err != nil {
|
|
return templ_7745c5c3_Err
|
|
}
|
|
var templ_7745c5c3_Var14 string
|
|
templ_7745c5c3_Var14, templ_7745c5c3_Err = templ.JoinStringErrs(strconv.FormatBool(p.DisableClickAway))
|
|
if templ_7745c5c3_Err != nil {
|
|
return templ.Error{Err: templ_7745c5c3_Err, FileName: `server/web/templui/components/popover/popover.templ`, Line: 108, Col: 73}
|
|
}
|
|
_, 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, 16, "\" data-popover-disable-esc=\"")
|
|
if templ_7745c5c3_Err != nil {
|
|
return templ_7745c5c3_Err
|
|
}
|
|
var templ_7745c5c3_Var15 string
|
|
templ_7745c5c3_Var15, templ_7745c5c3_Err = templ.JoinStringErrs(strconv.FormatBool(p.DisableESC))
|
|
if templ_7745c5c3_Err != nil {
|
|
return templ.Error{Err: templ_7745c5c3_Err, FileName: `server/web/templui/components/popover/popover.templ`, Line: 109, Col: 61}
|
|
}
|
|
_, 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, 17, "\" data-popover-show-arrow=\"")
|
|
if templ_7745c5c3_Err != nil {
|
|
return templ_7745c5c3_Err
|
|
}
|
|
var templ_7745c5c3_Var16 string
|
|
templ_7745c5c3_Var16, templ_7745c5c3_Err = templ.JoinStringErrs(strconv.FormatBool(p.ShowArrow))
|
|
if templ_7745c5c3_Err != nil {
|
|
return templ.Error{Err: templ_7745c5c3_Err, FileName: `server/web/templui/components/popover/popover.templ`, Line: 110, Col: 59}
|
|
}
|
|
_, 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, 18, "\" data-popover-hover-delay=\"")
|
|
if templ_7745c5c3_Err != nil {
|
|
return templ_7745c5c3_Err
|
|
}
|
|
var templ_7745c5c3_Var17 string
|
|
templ_7745c5c3_Var17, templ_7745c5c3_Err = templ.JoinStringErrs(strconv.Itoa(p.HoverDelay))
|
|
if templ_7745c5c3_Err != nil {
|
|
return templ.Error{Err: templ_7745c5c3_Err, FileName: `server/web/templui/components/popover/popover.templ`, Line: 111, Col: 55}
|
|
}
|
|
_, 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, 19, "\" data-popover-hover-out-delay=\"")
|
|
if templ_7745c5c3_Err != nil {
|
|
return templ_7745c5c3_Err
|
|
}
|
|
var templ_7745c5c3_Var18 string
|
|
templ_7745c5c3_Var18, templ_7745c5c3_Err = templ.JoinStringErrs(strconv.Itoa(p.HoverOutDelay))
|
|
if templ_7745c5c3_Err != nil {
|
|
return templ.Error{Err: templ_7745c5c3_Err, FileName: `server/web/templui/components/popover/popover.templ`, Line: 112, Col: 62}
|
|
}
|
|
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var18))
|
|
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
|
|
}
|
|
if p.MatchWidth {
|
|
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 21, " data-popover-match-width=\"true\"")
|
|
if templ_7745c5c3_Err != nil {
|
|
return templ_7745c5c3_Err
|
|
}
|
|
}
|
|
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 22, " class=\"")
|
|
if templ_7745c5c3_Err != nil {
|
|
return templ_7745c5c3_Err
|
|
}
|
|
var templ_7745c5c3_Var19 string
|
|
templ_7745c5c3_Var19, templ_7745c5c3_Err = templ.JoinStringErrs(templ.CSSClasses(templ_7745c5c3_Var9).String())
|
|
if templ_7745c5c3_Err != nil {
|
|
return templ.Error{Err: templ_7745c5c3_Err, FileName: `server/web/templui/components/popover/popover.templ`, Line: 1, Col: 0}
|
|
}
|
|
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var19))
|
|
if templ_7745c5c3_Err != nil {
|
|
return templ_7745c5c3_Err
|
|
}
|
|
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 23, "\"")
|
|
if templ_7745c5c3_Err != nil {
|
|
return templ_7745c5c3_Err
|
|
}
|
|
templ_7745c5c3_Err = templ.RenderAttributes(ctx, templ_7745c5c3_Buffer, p.Attributes)
|
|
if templ_7745c5c3_Err != nil {
|
|
return templ_7745c5c3_Err
|
|
}
|
|
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 24, "><div class=\"w-full overflow-hidden\">")
|
|
if templ_7745c5c3_Err != nil {
|
|
return templ_7745c5c3_Err
|
|
}
|
|
templ_7745c5c3_Err = templ_7745c5c3_Var8.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 p.ShowArrow {
|
|
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 26, "<div data-popover-arrow class=\"absolute h-2.5 w-2.5 rotate-45 bg-background border\"></div>")
|
|
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
|
|
}
|
|
return nil
|
|
})
|
|
}
|
|
|
|
var handle = templ.NewOnceHandle()
|
|
|
|
func Script() 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_Var20 := templ.GetChildren(ctx)
|
|
if templ_7745c5c3_Var20 == nil {
|
|
templ_7745c5c3_Var20 = templ.NopComponent
|
|
}
|
|
ctx = templ.ClearChildren(ctx)
|
|
templ_7745c5c3_Var21 := 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 = FloatingUICore().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
|
|
}
|
|
templ_7745c5c3_Err = FloatingUIDom().Render(ctx, templ_7745c5c3_Buffer)
|
|
if templ_7745c5c3_Err != nil {
|
|
return templ_7745c5c3_Err
|
|
}
|
|
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 29, " <script nonce=\"")
|
|
if templ_7745c5c3_Err != nil {
|
|
return templ_7745c5c3_Err
|
|
}
|
|
var templ_7745c5c3_Var22 string
|
|
templ_7745c5c3_Var22, templ_7745c5c3_Err = templ.JoinStringErrs(templ.GetNonce(ctx))
|
|
if templ_7745c5c3_Err != nil {
|
|
return templ.Error{Err: templ_7745c5c3_Err, FileName: `server/web/templui/components/popover/popover.templ`, Line: 137, Col: 37}
|
|
}
|
|
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var22))
|
|
if templ_7745c5c3_Err != nil {
|
|
return templ_7745c5c3_Err
|
|
}
|
|
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 30, "\">\n\t\t\tif (typeof window.popoverState === 'undefined') {\n\t\t\t\twindow.popoverState = new Map();\n\t\t\t}\n\n\t\t\t(function() { // IIFE Start\n\t\t\t\tif (window.popoverSystemInitialized) return;\n\n\t\t\t\t// --- Ensure Global Portal Container ---\n\t\t\t\tlet portalContainer = document.querySelector('[data-popover-portal-container]');\n\t\t\t\tif (!portalContainer) {\n\t\t\t\t\tportalContainer = document.createElement('div');\n\t\t\t\t\tportalContainer.setAttribute('data-popover-portal-container', '');\n\t\t\t\t\tportalContainer.className = 'fixed inset-0 z-[9999] pointer-events-none';\n\t\t\t\t\tdocument.body.appendChild(portalContainer);\n\t\t\t\t}\n\t\t\t\t// --- End Ensure Global Portal Container ---\n\n\t\t\t\t// --- Floating UI Check & Helper ---\n\t\t\t\tlet FloatingUIDOM = null;\n\n\t\t\t\tfunction whenFloatingUiReady(callback, attempt = 1) {\n\t\t\t\t\tif (window.FloatingUIDOM) {\n\t\t\t\t\t\tFloatingUIDOM = window.FloatingUIDOM;\n\t\t\t\t\t\tcallback();\n\t\t\t\t\t} else if (attempt < 40) {\n\t\t\t\t\t\tsetTimeout(() => whenFloatingUiReady(callback, attempt + 1), 50);\n\t\t\t\t\t} else {\n\t\t\t\t\t\tconsole.error(\"Floating UI DOM failed to load after several attempts.\");\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\t// --- Helper Functions ---\n\t\t\t\tfunction findReferenceElement(triggerSpan) {\n\t\t\t\t\tconst children = triggerSpan.children;\n\t\t\t\t\tif (children.length === 0) return triggerSpan;\n\t\t\t\t\tlet bestElement = triggerSpan;\n\t\t\t\t\tlet largestArea = 0;\n\t\t\t\t\tfor (const child of children) {\n\t\t\t\t\t\tif (typeof child.getBoundingClientRect !== 'function') continue;\n\t\t\t\t\t\tconst rect = child.getBoundingClientRect();\n\t\t\t\t\t\tconst area = rect.width * rect.height;\n\t\t\t\t\t\tif (area > largestArea) {\n\t\t\t\t\t\t\tlargestArea = area;\n\t\t\t\t\t\t\tbestElement = child;\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t\treturn bestElement;\n\t\t\t\t}\n\n\t\t\t\tfunction positionArrow(arrowElement, placement, arrowData, content) {\n\t\t\t\t\tconst { x: arrowX, y: arrowY } = arrowData;\n\t\t\t\t\tconst staticSide = { top: 'bottom', right: 'left', bottom: 'top', left: 'right' }[placement.split('-')[0]];\n\t\t\t\t\tObject.assign(arrowElement.style, { left: arrowX != null ? `${arrowX}px` : '', top: arrowY != null ? `${arrowY}px` : '', right: '', bottom: '', [staticSide]: '-5px' });\n\t\t\t\t\tconst popoverStyle = window.getComputedStyle(content);\n\t\t\t\t\tconst popoverBorderColor = popoverStyle.borderColor;\n\t\t\t\t\tarrowElement.style.backgroundColor = popoverStyle.backgroundColor;\n\t\t\t\t\tarrowElement.style.borderTopColor = popoverBorderColor;\n\t\t\t\t\tarrowElement.style.borderRightColor = popoverBorderColor;\n\t\t\t\t\tarrowElement.style.borderBottomColor = popoverBorderColor;\n\t\t\t\t\tarrowElement.style.borderLeftColor = popoverBorderColor;\n\t\t\t\t\tswitch (staticSide) {\n\t\t\t\t\t\tcase 'top': arrowElement.style.borderBottomColor = 'transparent'; arrowElement.style.borderRightColor = 'transparent'; break;\n\t\t\t\t\t\tcase 'bottom': arrowElement.style.borderTopColor = 'transparent'; arrowElement.style.borderLeftColor = 'transparent'; break;\n\t\t\t\t\t\tcase 'left': arrowElement.style.borderTopColor = 'transparent'; arrowElement.style.borderRightColor = 'transparent'; break;\n\t\t\t\t\t\tcase 'right': arrowElement.style.borderBottomColor = 'transparent'; arrowElement.style.borderLeftColor = 'transparent'; break;\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\tfunction addAnimationStyles() {\n\t\t\t\t\tif (document.getElementById('popover-animations')) return;\n\t\t\t\t\tconst style = document.createElement('style');\n\t\t\t\t\tstyle.id = 'popover-animations';\n\t\t\t\t\tstyle.textContent = `\n\t\t\t\t\t\t@keyframes popover-in { 0% { opacity: 0; transform: scale(0.95); } 100% { opacity: 1; transform: scale(1); } }\n\t\t\t\t\t\t@keyframes popover-out { 0% { opacity: 1; transform: scale(1); } 100% { opacity: 0; transform: scale(0.95); } }\n\t\t\t\t\t\t[data-popover-id].popover-animate-in { animation: popover-in 0.15s cubic-bezier(0.16, 1, 0.3, 1); }\n\t\t\t\t\t\t[data-popover-id].popover-animate-out { animation: popover-out 0.1s cubic-bezier(0.16, 1, 0.3, 1) forwards; }\n\t\t\t\t\t`;\n\t\t\t\t\tdocument.head.appendChild(style);\n\t\t\t\t}\n\t\t\t\t\n\t\t\t\t// --- Core Popover Logic ---\t\t\t\t\n\t\t\t\tfunction updatePosition(state) {\n\t\t\t\t\tif (!FloatingUIDOM || !state || !state.trigger || !state.content) return;\n\t\t\t\t\tconst { computePosition, offset, flip, shift, arrow } = FloatingUIDOM;\n\t\t\t\t\tconst referenceElement = findReferenceElement(state.trigger);\n\t\t\t\t\tconst arrowElement = state.content.querySelector('[data-popover-arrow]');\n\t\t\t\t\tconst placement = state.content.dataset.popoverPlacement || 'bottom';\n\t\t\t\t\tconst offsetValue = parseInt(state.content.dataset.popoverOffset) || (arrowElement ? 8 : 4);\n\t\t\t\t\tconst shouldMatchWidth = state.content.dataset.popoverMatchWidth === 'true';\n\t\t\t\t\t\n\t\t\t\t\tconst middleware = [offset(offsetValue), flip({ padding: 10 }), shift({ padding: 10 })];\n\t\t\t\t\tif (arrowElement) middleware.push(arrow({ element: arrowElement, padding: 5 }));\n\n\t\t\t\t\tcomputePosition(referenceElement, state.content, { placement, middleware }).then(({ x, y, placement, middlewareData }) => {\n\t\t\t\t\t\tObject.assign(state.content.style, { left: `${x}px`, top: `${y}px` });\n\t\t\t\t\t\t\n\t\t\t\t\t\tif (shouldMatchWidth) {\n\t\t\t\t\t\t\tconst triggerWidth = referenceElement.offsetWidth;\n\t\t\t\t\t\t\tstate.content.style.setProperty('--popover-trigger-width', `${triggerWidth}px`);\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\tif (arrowElement && middlewareData.arrow) {\n\t\t\t\t\t\t\tpositionArrow(arrowElement, placement, middlewareData.arrow, state.content);\n\t\t\t\t\t\t}\n\t\t\t\t\t});\n\t\t\t\t}\n\n\t\t\t\tfunction addGlobalListeners(popoverId, state) {\n\t\t\t\t\tremoveGlobalListeners(state); // Ensure no duplicates\n\t\t\t\t\tif (state.content.dataset.popoverDisableClickaway !== 'true') {\n\t\t\t\t\t\tconst handler = (e) => {\n\t\t\t\t\t\t\t// Close if click is outside trigger and content\n\t\t\t\t\t\t\tif (!state.trigger.contains(e.target) && !state.content.contains(e.target)) {\n\t\t\t\t\t\t\t\tclosePopover(popoverId);\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t};\n\t\t\t\t\t\t// Use setTimeout to avoid capturing the click that opened the popover\n\t\t\t\t\t\tsetTimeout(() => document.addEventListener('click', handler), 0);\n\t\t\t\t\t\tstate.eventListeners.clickAway = handler;\n\t\t\t\t\t}\n\t\t\t\t\tif (state.content.dataset.popoverDisableEsc !== 'true') {\n\t\t\t\t\t\tconst handler = (e) => { if (e.key === 'Escape') closePopover(popoverId); };\n\t\t\t\t\t\tdocument.addEventListener('keydown', handler);\n\t\t\t\t\t\tstate.eventListeners.esc = handler;\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\tfunction removeGlobalListeners(state) {\n\t\t\t\t\tif (state.eventListeners.clickAway) document.removeEventListener('click', state.eventListeners.clickAway);\n\t\t\t\t\tif (state.eventListeners.esc) document.removeEventListener('keydown', state.eventListeners.esc);\n\t\t\t\t\tstate.eventListeners = {}; // Clear stored handlers\n\t\t\t\t}\n\n\t\t\t\tfunction openPopover(popoverId, trigger) {\n\t\t\t\t\tif (!FloatingUIDOM) return; \n\t\t\t\t\tconst { autoUpdate } = FloatingUIDOM;\n\t\t\t\t\tconst content = document.getElementById(popoverId);\n\t\t\t\t\tif (!content) return;\n\n\t\t\t\t\tlet state = window.popoverState.get(popoverId);\n\t\t\t\t\tif (!state) { // Should be created by initTrigger, but as a fallback\n\t\t\t\t\t\tstate = { trigger, content, isOpen: false, cleanup: null, hoverState: {}, eventListeners: {} };\n\t\t\t\t\t\twindow.popoverState.set(popoverId, state);\n\t\t\t\t\t} else if (state.isOpen) return;\n\n\t\t\t\t\tstate.trigger = trigger; // Ensure trigger reference is current\n\t\t\t\t\tstate.content = content; // Ensure content reference is current\n\n\t\t\t\t\tconst portal = document.querySelector('[data-popover-portal-container]');\n\t\t\t\t\tif (portal && content.parentNode !== portal) portal.appendChild(content);\n\t\t\t\t\t\n\t\t\t\t\tcontent.style.display = 'block';\n\t\t\t\t\tcontent.classList.remove('popover-animate-out');\n\t\t\t\t\tcontent.classList.add('popover-animate-in');\n\n\t\t\t\t\t// Initial position update before autoUpdate starts\n\t\t\t\t\tupdatePosition(state); \n\n\t\t\t\t\tif (state.cleanup) state.cleanup();\n\t\t\t\t\tstate.cleanup = autoUpdate(findReferenceElement(trigger), content, () => updatePosition(state), { animationFrame: true }); // Use animationFrame for smoother updates\n\n\t\t\t\t\taddGlobalListeners(popoverId, state);\n\t\t\t\t\tstate.isOpen = true;\n\t\t\t\t}\n\n\t\t\t\tfunction closePopover(popoverId, immediate = false) {\n\t\t\t\t\tconst state = window.popoverState.get(popoverId);\n\t\t\t\t\tif (!state || !state.isOpen) return;\n\n\t\t\t\t\tif (state.cleanup) { state.cleanup(); state.cleanup = null; }\n\t\t\t\t\tremoveGlobalListeners(state);\n\n\t\t\t\t\tconst content = state.content;\n\t\t\t\t\tfunction hideContent() { content.style.display = 'none'; content.classList.remove('popover-animate-in', 'popover-animate-out'); }\n\t\t\t\t\t\n\t\t\t\t\tif (immediate) hideContent();\n\t\t\t\t\telse {\n\t\t\t\t\t\tcontent.classList.remove('popover-animate-in');\n\t\t\t\t\t\tcontent.classList.add('popover-animate-out');\n\t\t\t\t\t\tsetTimeout(hideContent, 150); // Match animation duration\n\t\t\t\t\t}\n\t\t\t\t\tstate.isOpen = false;\n\t\t\t\t}\n\t\t\t\t\n\t\t\t\t// Expose closePopover globally\n\t\t\t\twindow.closePopover = closePopover;\n\n\t\t\t\t// --- Trigger Initialization & Handling ---\n\n\t\t\t\tfunction attachClickTrigger(trigger, popoverId) {\n\t\t\t\t\tconst handler = (e) => {\n\t\t\t\t\t\te.stopPropagation();\n\t\t\t\t\t\tconst state = window.popoverState.get(popoverId);\n\t\t\t\t\t\tif (state?.isOpen) closePopover(popoverId);\n\t\t\t\t\t\telse openPopover(popoverId, trigger);\n\t\t\t\t\t};\n\t\t\t\t\ttrigger.addEventListener('click', handler);\n\t\t\t\t\ttrigger._popoverListener = handler; \n\t\t\t\t}\n\n\t\t\t\tfunction attachHoverTrigger(trigger, popoverId) {\n\t\t\t\t\tconst content = document.getElementById(popoverId);\n\t\t\t\t\tif (!content) return;\n\t\t\t\t\tlet state = window.popoverState.get(popoverId);\n\t\t\t\t\tif (!state) return; // State should exist from initTrigger\n\t\t\t\t\t\n\t\t\t\t\tconst hoverDelay = parseInt(content.dataset.popoverHoverDelay) || 100;\n\t\t\t\t\tconst hoverOutDelay = parseInt(content.dataset.popoverHoverOutDelay) || 200;\n\n\t\t\t\t\tconst handleTriggerEnter = () => { clearTimeout(state.hoverState.leaveTimeout); state.hoverState.enterTimeout = setTimeout(() => openPopover(popoverId, trigger), hoverDelay); };\n\t\t\t\t\tconst handleTriggerLeave = (e) => { clearTimeout(state.hoverState.enterTimeout); state.hoverState.leaveTimeout = setTimeout(() => { if (!content.contains(e.relatedTarget)) closePopover(popoverId); }, hoverOutDelay); };\n\t\t\t\t\tconst handleContentEnter = () => clearTimeout(state.hoverState.leaveTimeout);\n\t\t\t\t\tconst handleContentLeave = (e) => { state.hoverState.leaveTimeout = setTimeout(() => { if (!trigger.contains(e.relatedTarget)) closePopover(popoverId); }, hoverOutDelay); };\n\n\t\t\t\t\ttrigger.addEventListener('mouseenter', handleTriggerEnter);\n\t\t\t\t\ttrigger.addEventListener('mouseleave', handleTriggerLeave);\n\t\t\t\t\tcontent.addEventListener('mouseenter', handleContentEnter);\n\t\t\t\t\tcontent.addEventListener('mouseleave', handleContentLeave);\n\n\t\t\t\t\t// Store handlers for cleanup\n\t\t\t\t\ttrigger._popoverHoverListeners = { handleTriggerEnter, handleTriggerLeave };\n\t\t\t\t\tcontent._popoverHoverListeners = { handleContentEnter, handleContentLeave };\n\t\t\t\t}\n\t\t\t\t\n\t\t\t\tfunction initTrigger(trigger) {\n\t\t\t\t\tconst popoverId = trigger.dataset.popoverFor;\n\t\t\t\t\tconst content = document.getElementById(popoverId);\n\t\t\t\t\tif (!popoverId || !content) return;\n\t\t\t\t\t\n\t\t\t\t\t// Prevent re-attaching listeners to the same DOM element instance\n\t\t\t\t\tif (trigger._popoverListenerAttached) return;\n\n\t\t\t\t\t// Ensure state object exists\n\t\t\t\t\tif (!window.popoverState.has(popoverId)) {\n\t\t\t\t\t\twindow.popoverState.set(popoverId, {\n\t\t\t\t\t\t\ttrigger, content, isOpen: false, cleanup: null, \n\t\t\t\t\t\t\thoverState: {}, eventListeners: {}\n\t\t\t\t\t\t});\n\t\t\t\t\t} else {\n\t\t\t\t\t\t// Update refs in existing state if trigger persisted\n\t\t\t\t\t\tconst state = window.popoverState.get(popoverId);\n\t\t\t\t\t\tstate.trigger = trigger;\n\t\t\t\t\t\tstate.content = content;\n\t\t\t\t\t\t// Ensure closed state after potential swap/cleanup\n\t\t\t\t\t\tif (state.isOpen) closePopover(popoverId, true);\n\t\t\t\t\t}\n\t\t\t\t\t\n\t\t\t\t\t// Cleanup any stray listeners before attaching new ones\n\t\t\t\t\tif (trigger._popoverListener) trigger.removeEventListener('click', trigger._popoverListener);\n\t\t\t\t\tif (trigger._popoverHoverListeners) { trigger.removeEventListener('mouseenter', trigger._popoverHoverListeners.handleTriggerEnter); trigger.removeEventListener('mouseleave', trigger._popoverHoverListeners.handleTriggerLeave); }\n\t\t\t\t\tif (content._popoverHoverListeners) { content.removeEventListener('mouseenter', content._popoverHoverListeners.handleContentEnter); content.removeEventListener('mouseleave', content._popoverHoverListeners.handleContentLeave); }\n\t\t\t\t\tdelete trigger._popoverListener;\n\t\t\t\t\tdelete trigger._popoverHoverListeners;\n\t\t\t\t\tif (content) delete content._popoverHoverListeners;\n\n\t\t\t\t\t// Attach the correct listener type\n\t\t\t\t\tconst triggerType = trigger.dataset.popoverType || 'click';\n\t\t\t\t\tif (triggerType === 'click') {\n\t\t\t\t\t\tattachClickTrigger(trigger, popoverId);\n\t\t\t\t\t} else if (triggerType === 'hover') {\n\t\t\t\t\t\tattachHoverTrigger(trigger, popoverId);\n\t\t\t\t\t}\n\t\t\t\t\ttrigger._popoverListenerAttached = true;\n\t\t\t\t}\n\t\t\t\t\n\t\t\t\t// --- Cleanup ---\n\t\t\t\t\n\t\t\t\tfunction cleanupPopovers(element) {\n\t\t\t\t\tconst cleanupTrigger = (trigger) => {\n\t\t\t\t\t\tconst popoverId = trigger.dataset.popoverFor;\n\t\t\t\t\t\tif (popoverId) {\n\t\t\t\t\t\t\tclosePopover(popoverId, true); // Close popover, remove global listeners, stop Floating UI\n\t\t\t\t\t\t}\n\t\t\t\t\t\t\n\t\t\t\t\t\t// Remove listeners directly attached to the trigger\n\t\t\t\t\t\tif (trigger._popoverListener) trigger.removeEventListener('click', trigger._popoverListener);\n\t\t\t\t\t\tif (trigger._popoverHoverListeners) { \n\t\t\t\t\t\t\ttrigger.removeEventListener('mouseenter', trigger._popoverHoverListeners.handleTriggerEnter);\n\t\t\t\t\t\t\ttrigger.removeEventListener('mouseleave', trigger._popoverHoverListeners.handleTriggerLeave);\n\t\t\t\t\t\t}\n\t\t\t\t\t\t\n\t\t\t\t\t\t// Remove listeners attached to the content (for hover)\n\t\t\t\t\t\tconst content = document.getElementById(popoverId);\n\t\t\t\t\t\tif (content && content._popoverHoverListeners) {\n\t\t\t\t\t\t\tcontent.removeEventListener('mouseenter', content._popoverHoverListeners.handleContentEnter);\n\t\t\t\t\t\t\tcontent.removeEventListener('mouseleave', content._popoverHoverListeners.handleContentLeave);\n\t\t\t\t\t\t\tdelete content._popoverHoverListeners;\n\t\t\t\t\t\t}\n\t\t\t\t\t\t\n\t\t\t\t\t\t// Clean up stored references and flags on the trigger\n\t\t\t\t\t\tdelete trigger._popoverListener;\n\t\t\t\t\t\tdelete trigger._popoverHoverListeners;\n\t\t\t\t\t\tdelete trigger._popoverListenerAttached;\n\t\t\t\t\t\t\n\t\t\t\t\t\t// Optionally remove state - might be desired if the element is definitely gone\n\t\t\t\t\t\t// window.popoverState.delete(popoverId);\n\t\t\t\t\t};\n\n\t\t\t\t\t// Cleanup element itself if it's a trigger\n\t\t\t\t\tif (element.matches && element.matches('[data-popover-trigger]')) {\n\t\t\t\t\t\tcleanupTrigger(element);\n\t\t\t\t\t}\n\t\t\t\t\t// Cleanup descendants\n\t\t\t\t\tif (element.querySelectorAll) {\n\t\t\t\t\t\telement.querySelectorAll('[data-popover-trigger]').forEach(cleanupTrigger);\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\tfunction initAllComponents(root = document) {\n\t\t\t\t\tif (!FloatingUIDOM) return; // Don't init if library isn't ready\n\t\t\t\t\tif (root instanceof Element && root.matches('[data-popover-trigger]')) {\n\t\t\t\t\t\tinitTrigger(root);\n\t\t\t\t\t}\n\t\t\t\t\tif (root && typeof root.querySelectorAll === 'function') {\n\t\t\t\t\t\tfor (const trigger of root.querySelectorAll('[data-popover-trigger]')) {\n\t\t\t\t\t\t\tinitTrigger(trigger);\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\tconst handleHtmxSwap = (event) => {\n\t\t\t\t\tconst target = event.detail.target || event.detail.elt;\n\t\t\t\t\tif (target instanceof Element) {\n\t\t\t\t\t\twhenFloatingUiReady(() => initAllComponents(target));\n\t\t\t\t\t}\n\t\t\t\t};\n\t\t\t\t\n\t\t\t\tinitAllComponents();\n\t\t\t\t\n\t\t\t\tdocument.addEventListener('DOMContentLoaded', () => {\n\t\t\t\t\twhenFloatingUiReady(() => {\n\t\t\t\t\t\taddAnimationStyles();\n\t\t\t\t\t\tinitAllComponents(); \n\t\t\t\t\t});\n\t\t\t\t});\n\n\t\t\t\tdocument.body.addEventListener('htmx:beforeSwap', (event) => {\n\t\t\t\t\tconst target = event.detail.target || event.detail.elt;;\n\t\t\t\t\tif (target instanceof Element) {\n\t\t\t\t\t\tcleanupPopovers(target);\n\t\t\t\t\t}\n\t\t\t\t});\n\n\t\t\t\tdocument.body.addEventListener('htmx:afterSwap', handleHtmxSwap);\n\t\t\t\tdocument.body.addEventListener('htmx:oobAfterSwap', handleHtmxSwap);\n\n\t\t\t\twindow.popoverSystemInitialized = true;\n\t\t\t})(); // IIFE End\n\t\t</script>")
|
|
if templ_7745c5c3_Err != nil {
|
|
return templ_7745c5c3_Err
|
|
}
|
|
return nil
|
|
})
|
|
templ_7745c5c3_Err = handle.Once().Render(templ.WithChildren(ctx, templ_7745c5c3_Var21), templ_7745c5c3_Buffer)
|
|
if templ_7745c5c3_Err != nil {
|
|
return templ_7745c5c3_Err
|
|
}
|
|
return nil
|
|
})
|
|
}
|
|
|
|
var _ = templruntime.GeneratedTemplate
|