Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Adds the
carouselrecipe to the Shadcn kit.Embla
Upstream shadcn builds
Carouselon Embla Carousel, an npm dependency. No Toolkit recipe ships one — every controller in the kit imports only@hotwired/stimulus— so the behaviour is reimplemented as a self-containedcarouselcontroller: a flex track translated with a CSS transform, whose snap positions are measured from the rendered slides rather than configured, so anybasis-*utility on aCarousel:Itemworks with no extra wiring, and they are re-measured on resize.Consequences for the public API:
optsbecome props onCarousel:alignandloop.autoplayprop (delay in ms). The upstream "Plugins" section is therefore documented as Autoplay.setApibecomes acarousel:selectevent carrying{ index, count }. The recipe ships a smallcarousel-displaycontroller that renders the current position from it, mirroring whatsliderdoes withslider-display.Notes
-ms-4,ps-4,-start-12,-end-12), which also keeps the "Spacing" example overridable in both directions.Carousel:Previousrendersdisabledwhen the carousel does not loop, so the first slide has no enabled → disabled flash on load; the controller then syncs both buttons on every change.Testing
Snapshots regenerated;
bin/ux-toolkit-kit-lint --fail-on-warning kits/shadcn,twig-cs-fixer,oxfmtandoxlintare clean.Behaviour driven in headless Chromium against a real Tailwind v4 build of the rendered examples, with no console errors:
Companion PR
Needed, since the recipe ships Stimulus controllers and new Tailwind classes: register
carousel/carousel-displayinassets/toolkit-shadcn.jsand rebuild the CSS onsymfony/ux.symfony.com. Will link it here.