// Code generated by templ - DO NOT EDIT. // templ: version: v0.3.960 // Code generated by wa-generator. DO NOT EDIT. // Source: Web Awesome wa-carousel 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" ) // Carousels display an arbitrary number of content slides along a horizontal or vertical axis. // // Web Awesome component: // CarouselProps holds all properties for the wa-carousel component type CarouselProps struct { // When set, allows the user to navigate the carousel in the same direction indefinitely. Loop bool `attr:"loop"` // Slides float64 `attr:"slides"` // CurrentSlide float64 `attr:"currentSlide"` // When set, show the carousel's navigation. Navigation bool `attr:"navigation"` // When set, show the carousel's pagination indicators. Pagination bool `attr:"pagination"` // When set, the slides will scroll automatically when the user is not interacting with them. Autoplay bool `attr:"autoplay"` // Specifies the amount of time, in milliseconds, between each automatic scroll. AutoplayInterval float64 `attr:"autoplay-interval"` // Specifies how many slides should be shown at a given time. SlidesPerPage float64 `attr:"slides-per-page"` // Specifies the number of slides the carousel will advance when scrolling, useful when specifying a slides-per-page SlidesPerMove float64 `attr:"slides-per-move"` // Specifies the orientation in which the carousel will lay out. // Valid values: "horizontal", "vertical" Orientation string `attr:"orientation"` // When set, it is possible to scroll through the slides by dragging them with the mouse. MouseDragging bool `attr:"mouse-dragging"` // Events // Emitted when the active slide changes. OnSlideChange string `attr:"x-on:wa-slide-change"` // Slots contains named slot content Slots CarouselSlots // Attrs contains additional HTML attributes Attrs templ.Attributes } // CarouselSlots holds named slot content for the component type CarouselSlots struct { // Optional next icon to use instead of the default. Works best with . NextIcon templ.Component // Optional previous icon to use instead of the default. Works best with . PreviousIcon templ.Component } // CarouselBuilder provides a fluent API for constructing CarouselProps type CarouselBuilder struct { props CarouselProps } // NewCarousel creates a new builder for wa-carousel func NewCarousel() *CarouselBuilder { return &CarouselBuilder{} } // Loop sets the loop attribute // When set, allows the user to navigate the carousel in the same direction indefinitely. func (b *CarouselBuilder) Loop(v bool) *CarouselBuilder { b.props.Loop = v return b } // Slides sets the slides attribute func (b *CarouselBuilder) Slides(v float64) *CarouselBuilder { b.props.Slides = v return b } // CurrentSlide sets the currentSlide attribute func (b *CarouselBuilder) CurrentSlide(v float64) *CarouselBuilder { b.props.CurrentSlide = v return b } // Navigation sets the navigation attribute // When set, show the carousel's navigation. func (b *CarouselBuilder) Navigation(v bool) *CarouselBuilder { b.props.Navigation = v return b } // Pagination sets the pagination attribute // When set, show the carousel's pagination indicators. func (b *CarouselBuilder) Pagination(v bool) *CarouselBuilder { b.props.Pagination = v return b } // Autoplay sets the autoplay attribute // When set, the slides will scroll automatically when the user is not interacting with them. func (b *CarouselBuilder) Autoplay(v bool) *CarouselBuilder { b.props.Autoplay = v return b } // AutoplayInterval sets the autoplay-interval attribute // Specifies the amount of time, in milliseconds, between each automatic scroll. func (b *CarouselBuilder) AutoplayInterval(v float64) *CarouselBuilder { b.props.AutoplayInterval = v return b } // SlidesPerPage sets the slides-per-page attribute // Specifies how many slides should be shown at a given time. func (b *CarouselBuilder) SlidesPerPage(v float64) *CarouselBuilder { b.props.SlidesPerPage = v return b } // SlidesPerMove sets the slides-per-move attribute // Specifies the number of slides the carousel will advance when scrolling, useful when specifying a slides-per-page func (b *CarouselBuilder) SlidesPerMove(v float64) *CarouselBuilder { b.props.SlidesPerMove = v return b } // Orientation sets the orientation attribute // Specifies the orientation in which the carousel will lay out. func (b *CarouselBuilder) Orientation(v string) *CarouselBuilder { b.props.Orientation = v return b } // MouseDragging sets the mouse-dragging attribute // When set, it is possible to scroll through the slides by dragging them with the mouse. func (b *CarouselBuilder) MouseDragging(v bool) *CarouselBuilder { b.props.MouseDragging = v return b } // OnSlideChange sets the handler for wa-slide-change event // Emitted when the active slide changes. func (b *CarouselBuilder) OnSlideChange(handler string) *CarouselBuilder { b.props.OnSlideChange = handler return b } // NextIconSlot sets the next-icon slot content // Optional next icon to use instead of the default. Works best with . func (b *CarouselBuilder) NextIconSlot(c templ.Component) *CarouselBuilder { b.props.Slots.NextIcon = c return b } // PreviousIconSlot sets the previous-icon slot content // Optional previous icon to use instead of the default. Works best with . func (b *CarouselBuilder) PreviousIconSlot(c templ.Component) *CarouselBuilder { b.props.Slots.PreviousIcon = c return b } // Attr adds a custom HTML attribute func (b *CarouselBuilder) Attr(name, value string) *CarouselBuilder { if b.props.Attrs == nil { b.props.Attrs = templ.Attributes{} } b.props.Attrs[name] = value return b } // Attrs merges multiple attributes func (b *CarouselBuilder) Attrs(attrs templ.Attributes) *CarouselBuilder { 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 *CarouselBuilder) Props() CarouselProps { return b.props } // Build returns the props (alias for Props for semantic clarity) func (b *CarouselBuilder) Build() CarouselProps { return b.props } // Carousel renders the wa-carousel component func Carousel(props CarouselProps) 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 } if props.Slots.NextIcon != nil { templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 22, "
") if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } templ_7745c5c3_Err = props.Slots.NextIcon.Render(ctx, templ_7745c5c3_Buffer) 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 } } if props.Slots.PreviousIcon != nil { templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 24, "
") if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } templ_7745c5c3_Err = props.Slots.PreviousIcon.Render(ctx, templ_7745c5c3_Buffer) 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 } } 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, 26, "
") if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } return nil }) } // CarouselFunc renders with a builder function for inline configuration func CarouselFunc(fn func(*CarouselBuilder)) 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_Var9 := templ.GetChildren(ctx) if templ_7745c5c3_Var9 == nil { templ_7745c5c3_Var9 = templ.NopComponent } ctx = templ.ClearChildren(ctx) b := NewCarousel() fn(b) templ_7745c5c3_Var10 := 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_Var9.Render(ctx, templ_7745c5c3_Buffer) if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } return nil }) templ_7745c5c3_Err = Carousel(b.Props()).Render(templ.WithChildren(ctx, templ_7745c5c3_Var10), templ_7745c5c3_Buffer) if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } return nil }) } var _ = templruntime.GeneratedTemplate