@thewhatmatters/wmds 0.4.6 → 0.4.7

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (148) hide show
  1. package/CHANGELOG.md +20 -0
  2. package/CONSUMING.md +1 -0
  3. package/README.md +2 -2
  4. package/dist/components/organisms/Carousel/Carousel.d.ts +58 -0
  5. package/dist/components/organisms/Carousel/Carousel.d.ts.map +1 -0
  6. package/dist/components/organisms/Carousel/Carousel.js +310 -0
  7. package/dist/components/organisms/Carousel/carouselMath.d.ts +39 -0
  8. package/dist/components/organisms/Carousel/carouselMath.d.ts.map +1 -0
  9. package/dist/components/organisms/Carousel/carouselMath.js +47 -0
  10. package/dist/components/organisms/Carousel/carouselStyles.d.ts +49 -0
  11. package/dist/components/organisms/Carousel/carouselStyles.d.ts.map +1 -0
  12. package/dist/components/organisms/Carousel/carouselStyles.js +25 -0
  13. package/dist/index.d.ts +1 -0
  14. package/dist/index.d.ts.map +1 -1
  15. package/dist/index.js +45 -43
  16. package/dist/styles.css +1 -1
  17. package/docs/components.md +2 -1
  18. package/docs/exports.json +14 -2
  19. package/docs/patterns/components-accordion--flush.tsx +1 -1
  20. package/docs/patterns/components-avatar--dropdown-row.tsx +1 -1
  21. package/docs/patterns/components-badge--outline-tags.tsx +1 -1
  22. package/docs/patterns/components-badge--with-avatar.tsx +1 -1
  23. package/docs/patterns/components-breadcrumb--editorial.tsx +1 -1
  24. package/docs/patterns/components-breadcrumb--long-path.tsx +1 -1
  25. package/docs/patterns/components-breadcrumb--path.tsx +1 -1
  26. package/docs/patterns/components-breadcrumb--router-links.tsx +1 -1
  27. package/docs/patterns/components-button-button--copy-button.tsx +1 -1
  28. package/docs/patterns/components-button-button--destructive-action.tsx +1 -1
  29. package/docs/patterns/components-button-button--external-link.tsx +1 -1
  30. package/docs/patterns/components-button-button--ghost-action.tsx +1 -1
  31. package/docs/patterns/components-button-button--inverse-action.tsx +1 -1
  32. package/docs/patterns/components-button-button--link-render.tsx +1 -1
  33. package/docs/patterns/components-button-button--multi-state-badge.tsx +1 -1
  34. package/docs/patterns/components-button-button--outline-mono.tsx +1 -1
  35. package/docs/patterns/components-button-button--primary-action.tsx +1 -1
  36. package/docs/patterns/components-button-button--row-hug.tsx +1 -1
  37. package/docs/patterns/components-button-button--row-layout.tsx +1 -1
  38. package/docs/patterns/components-button-button--secondary-action.tsx +1 -1
  39. package/docs/patterns/components-button-button--suggestion-pills.tsx +1 -1
  40. package/docs/patterns/components-button-button--with-count.tsx +1 -1
  41. package/docs/patterns/components-button-button--with-icon.tsx +1 -1
  42. package/docs/patterns/components-button-floatingactionbutton--vertical-actions.tsx +1 -1
  43. package/docs/patterns/components-calembed--pattern-skip-in-footer.tsx +1 -1
  44. package/docs/patterns/components-card-card--body-slot-occupancy-history.tsx +1 -1
  45. package/docs/patterns/components-card-card--headerless-media.tsx +1 -1
  46. package/docs/patterns/components-card-card--outlined-layout.tsx +1 -1
  47. package/docs/patterns/components-card-card--pinned-height.tsx +1 -1
  48. package/docs/patterns/components-card-selectablecard--selectable-cards-pattern.tsx +1 -1
  49. package/docs/patterns/components-carousel--image-carousel.tsx +30 -0
  50. package/docs/patterns/components-chart--audience-activity-heatmap.tsx +1 -1
  51. package/docs/patterns/components-chart--cartesian-no-data-gaps.tsx +1 -1
  52. package/docs/patterns/components-chart--occupancy-history-in-card.tsx +1 -1
  53. package/docs/patterns/components-chart--occupancy-in-card.tsx +1 -1
  54. package/docs/patterns/components-chart--post-reach-distribution.tsx +1 -1
  55. package/docs/patterns/components-chart--ranked-audience-breakdown.tsx +1 -1
  56. package/docs/patterns/components-chart--unit-grid-composition.tsx +1 -1
  57. package/docs/patterns/components-chatdock--pattern-chat-dock.tsx +1 -1
  58. package/docs/patterns/components-chatdock--pattern-start-project-gate.tsx +1 -1
  59. package/docs/patterns/components-chatqa--pattern-qa-with-reply.tsx +1 -1
  60. package/docs/patterns/components-checkbox-checkbox--default.tsx +1 -1
  61. package/docs/patterns/components-checkbox-checkbox--with-count.tsx +1 -1
  62. package/docs/patterns/components-checkbox-checkbox--with-description.tsx +1 -1
  63. package/docs/patterns/components-checkbox-checkboxgroup--default.tsx +1 -1
  64. package/docs/patterns/components-checkbox-checkboxgroup--option-counts.tsx +1 -1
  65. package/docs/patterns/components-descriptionlist--details.tsx +1 -1
  66. package/docs/patterns/components-descriptionlist--post-metadata.tsx +1 -1
  67. package/docs/patterns/components-dialog--alert-dialog-destructive.tsx +1 -1
  68. package/docs/patterns/components-dialog--default-dialog.tsx +1 -1
  69. package/docs/patterns/components-dialog--form-dialog.tsx +1 -1
  70. package/docs/patterns/components-displaycontrols--page-utilities.tsx +1 -1
  71. package/docs/patterns/components-field--horizontal-input.tsx +1 -1
  72. package/docs/patterns/components-field--horizontal-text-area.tsx +1 -1
  73. package/docs/patterns/components-field--multi-control.tsx +1 -1
  74. package/docs/patterns/components-footerreveal--marketing-hero-pattern.tsx +1 -1
  75. package/docs/patterns/components-footerreveal--marketing-hero-ruled-pattern.tsx +1 -1
  76. package/docs/patterns/components-footerreveal--marketing-hero-with-gallery-intro.tsx +1 -1
  77. package/docs/patterns/components-footerreveal--marketing-page-pattern.tsx +1 -1
  78. package/docs/patterns/components-footerreveal--ruled-grid-footer-pattern.tsx +1 -1
  79. package/docs/patterns/components-footerreveal--sequenced-marketing-hero.tsx +1 -1
  80. package/docs/patterns/components-herointro--two-line-intro.tsx +1 -1
  81. package/docs/patterns/components-herotilestack--marketing-hero-pattern.tsx +1 -1
  82. package/docs/patterns/components-herotilestack--marketing-hero-text-sequence.tsx +1 -1
  83. package/docs/patterns/components-herotilestack--marketing-hero-with-gallery-intro.tsx +1 -1
  84. package/docs/patterns/components-indexlist--post-index.tsx +1 -1
  85. package/docs/patterns/components-intakeconfirmation--booked-pattern.tsx +1 -1
  86. package/docs/patterns/components-intakeconfirmation--emailed-pattern.tsx +1 -1
  87. package/docs/patterns/components-intakeform--about-you-pattern.tsx +1 -1
  88. package/docs/patterns/components-intakeform--short-form-pattern.tsx +1 -1
  89. package/docs/patterns/components-intakemodal--intake-modal-pattern.tsx +1 -1
  90. package/docs/patterns/components-kbd--command-row.tsx +1 -1
  91. package/docs/patterns/components-kbd--numbered-choices.tsx +1 -1
  92. package/docs/patterns/components-kbd--shortcut.tsx +1 -1
  93. package/docs/patterns/components-moremenu--action-menu.tsx +1 -1
  94. package/docs/patterns/components-moremenu--in-card-header.tsx +1 -1
  95. package/docs/patterns/components-navlist--side-nav-settings.tsx +1 -1
  96. package/docs/patterns/components-pageheader--app-header-pattern.tsx +1 -1
  97. package/docs/patterns/components-pageheader--page-section-header.tsx +1 -1
  98. package/docs/patterns/components-pageheader--toolbar-header.tsx +1 -1
  99. package/docs/patterns/components-panel--end-detail-rail.tsx +1 -1
  100. package/docs/patterns/components-pillgroup--pill-group-pattern.tsx +1 -1
  101. package/docs/patterns/components-promptbar--pattern-prompt-bar.tsx +1 -1
  102. package/docs/patterns/components-prose--article-body.tsx +1 -1
  103. package/docs/patterns/components-radio-radiogroup--default.tsx +1 -1
  104. package/docs/patterns/components-scrollhorizontal--project-gallery-pattern.tsx +1 -1
  105. package/docs/patterns/components-scrollhorizontal--with-intro.tsx +1 -1
  106. package/docs/patterns/components-sectioncaption--column-caption.tsx +1 -1
  107. package/docs/patterns/components-sectioncaption--with-action.tsx +1 -1
  108. package/docs/patterns/components-sheet--bottom-sheet.tsx +1 -1
  109. package/docs/patterns/components-sheet--end-sheet.tsx +1 -1
  110. package/docs/patterns/components-sitenav--brand-and-cta.tsx +1 -1
  111. package/docs/patterns/components-sitenav--centered-links.tsx +1 -1
  112. package/docs/patterns/components-sitenav--compact.tsx +1 -1
  113. package/docs/patterns/components-sitenav--marketing-header.tsx +1 -1
  114. package/docs/patterns/components-sitenav--mega-menu.tsx +1 -1
  115. package/docs/patterns/components-stat--insights-row.tsx +1 -1
  116. package/docs/patterns/components-stepprogress--step-progress-pattern.tsx +1 -1
  117. package/docs/patterns/components-switch--default.tsx +1 -1
  118. package/docs/patterns/components-switch--settings-row.tsx +1 -1
  119. package/docs/patterns/components-tab--settings-pages.tsx +1 -1
  120. package/docs/patterns/components-taskrows--action-details.tsx +1 -1
  121. package/docs/patterns/components-taskrows--capsules.tsx +1 -1
  122. package/docs/patterns/components-taskrows--card-with-status-rows.tsx +1 -1
  123. package/docs/patterns/components-taskrows--controlled-expand.tsx +1 -1
  124. package/docs/patterns/components-taskrows--custom-slots.tsx +1 -1
  125. package/docs/patterns/components-taskrows--status-list.tsx +1 -1
  126. package/docs/patterns/components-taskrows--tag-chips.tsx +1 -1
  127. package/docs/patterns/components-textlink--external-destination.tsx +1 -1
  128. package/docs/patterns/components-textlink--inline-prose.tsx +1 -1
  129. package/docs/patterns/components-textlink--quiet-title.tsx +1 -1
  130. package/docs/patterns/components-textlink--supporting-copy.tsx +1 -1
  131. package/docs/patterns/components-textsequence--default.tsx +1 -1
  132. package/docs/patterns/components-textsequence--reduced-motion.tsx +1 -1
  133. package/docs/patterns/components-textsequence--shapes.tsx +1 -1
  134. package/docs/patterns/components-toast--stacked-notifications.tsx +1 -1
  135. package/docs/patterns/components-tooltip--controlled.tsx +1 -1
  136. package/docs/patterns/components-tooltip--disabled-control.tsx +1 -1
  137. package/docs/patterns/components-tooltip--icon-action.tsx +1 -1
  138. package/docs/patterns/components-tooltip--keyboard-shortcut.tsx +1 -1
  139. package/docs/patterns/components-tooltip--placement.tsx +1 -1
  140. package/docs/patterns/foundations-scroll-fade--horizontal-rail.tsx +1 -1
  141. package/docs/patterns/foundations-scroll-fade--overflowing-list.tsx +1 -1
  142. package/docs/patterns/guides-chart-explorations--comparison-gallery.tsx +1 -1
  143. package/docs/patterns/guides-filter-panel--filtered-index.tsx +1 -1
  144. package/docs/patterns/guides-overlay-flows--notification-preferences.tsx +1 -1
  145. package/docs/patterns/guides-post-page--post-page.tsx +1 -1
  146. package/docs/patterns/guides-profile-typography--editorial-profile.tsx +1 -1
  147. package/docs/patterns/index.json +9 -1
  148. package/package.json +1 -1
package/CHANGELOG.md CHANGED
@@ -7,6 +7,26 @@ Every release of `@thewhatmatters/wmds` is listed here, newest first.
7
7
  - **Pasted patterns:** when a release changes a **Pattern — …** story's Show code, it is named under Consumer actions so apps re-copy it.
8
8
  - **How to add an entry** (contributors): add your change to the top entry. If that version is already on npm (`npm view @thewhatmatters/wmds versions`), start a new entry above it and bump `version` in `package.json` to match. `npm run check:changelog` enforces the format.
9
9
 
10
+ ## 0.4.7
11
+
12
+ **Carousel: a row of items with a progress scrubber.** New component, built on the open `motion` package. The WhatMatters About page is the first use. See **ADR-0043**.
13
+
14
+ - **Carousel** (new) with **Carousel.Item** — a horizontal row the visitor drags, scrolls (touch, trackpad, shift-wheel), or steps through with the keyboard. A mouse drag glides on and stops softly at each end; the row does not loop. Name it with `aria-label` or `aria-labelledby` (one is required).
15
+ - `itemWidth` — a percentage of the row, one number or `{ base, sm, md, lg }`. Default `{ base: 80, sm: 55, lg: 40 }`, so the next item always shows. The gap is the grid gutter.
16
+ - `snap` (default on) rests the row on an item's leading edge. `bleed` runs it to the page edges while items start on the grid. `fade` (default on) fades clipped items the way `scroll-fade-x` does.
17
+ - `progress` — the scrubber under the row: `center` (default) or `start` for a shorter track (full width on phones), `full`, or `none`. The filled part's place is the row's progress and its width the share of the row in view. Drag it, or press the track. It hides itself, keeping its space, while every item fits.
18
+ - **Decisions taken** (the request left them open): one component with the scrubber as a prop, not a separate part; the scrubber is hidden from assistive tech and is not a tab stop — the row takes Left, Right, Home, and End, and each item says its place ("2 of 4"); no previous and next buttons in this version.
19
+ - **Also:** a drag never clicks a link inside an item, and images are not picked up by the browser's own drag. Reduced motion moves the row at once, with no glide. Right-to-left flips the direction and the arrow keys. On the server and the first paint the row is at its start with the scrubber at zero; it measures again on resize and when an image loads.
20
+ - New **Components/Carousel → Pattern — image carousel**: rounded outlined **Card** tiles with an image in the body.
21
+
22
+ ### Consumer actions
23
+
24
+ 1. **WhatMatters site, About page: replace the hand-built image strip.** Copy **Components/Carousel → Pattern — image carousel** (`node_modules/@thewhatmatters/wmds/docs/patterns/components-carousel--image-carousel.tsx`) into `components/image-carousel.tsx`, keep its header comment, and render `<ImageCarousel label="Selected work" images={…} />` where the strip is. Delete the scroll-snap list and its classes (`scroll-fade-x`, `snap-x`, `overflow-x-auto`, the per-image **Card** markup) — the pattern has the cards.
25
+ 2. **Name the row once.** If a heading already sits over the strip, give the heading an `id` and pass `aria-labelledby` in place of `aria-label` (change the pattern's one prop). Do not also put that `aria-labelledby` on a `section` around it: two landmarks with one name fail the accessibility check.
26
+ 3. **`next/image` is fine.** To use it, swap the pattern's `<img>` for `<Image>` with the same `className`, a `width` and `height` (or `fill` inside a sized box), and `sizes="(min-width: 1024px) 40vw, (min-width: 640px) 55vw, 80vw"` to match the default `itemWidth`. Change `sizes` if you change `itemWidth`.
27
+ 4. **Page layout.** Place it on the grid like any other block: `className="col-span-full"` inside a `band`. Add `bleed` if the row should run to the page edges. The scrubber's hit area is 44px tall, so drop any margin the old strip had under it.
28
+ 5. Other apps: none. Everything here is new.
29
+
10
30
  ## 0.4.6
11
31
 
12
32
  **TextArea shows one focus ring.** A focused **TextArea** drew two: the ring on its shell, and the browser's own outline on the field inside it.
package/CONSUMING.md CHANGED
@@ -269,6 +269,7 @@ import {
269
269
  | `Card` | `variant`, `shape`, `padding` | Components/Card/Card — `Card.Header` (`start` | `end`), **`Card.Body` slot** (no default fill), `Card.Footer` |
270
270
  | `Accordion` | `variant`, `flush` (plain), `Accordion.Item` `leading` / `label` / `trailing` / `open` | Components/Accordion — FAQ, settings sections; **Pattern — flush** for filter groups. Closed panels leave the tab order |
271
271
  | `Breadcrumb` | `items` (`{ label, href }`, current page last), `maxItems`, `separator` (`chevron` \| `slash`), `variant` (`sans` \| `mono`), `renderLink`, `labels` | Components/Breadcrumb — **Pattern — path**, **long path**, **router links**, **editorial** |
272
+ | `Carousel` | `aria-label` or `aria-labelledby` (required), `itemWidth` (percentage of the row: a number or `{ base, sm, md, lg }`), `snap`, `bleed`, `fade`, `progress` (`center` \| `start` \| `full` \| `none`), `labels`, `Carousel.Item` | Components/Carousel — **Pattern — image carousel**. Drag, scroll, keys, or the scrubber; no loop. Not a scroll-driven gallery (**ScrollHorizontal**) |
272
273
  | `DescriptionList` | `layout` (`inline` \| `stacked`), `rule` (`solid` \| `dotted` \| `none`), `variant` (`sans` \| `mono`), `DescriptionList.Item` `name` / `layout` | Components/DescriptionList — **Pattern — post metadata**, **Pattern — details** |
273
274
  | `SectionCaption` | `children`, `as`, `id`, `end`, `marker`, `rule` | Components/SectionCaption — **Pattern — column caption**, **Pattern — caption with an action** |
274
275
  | `Prose` | `size` (`lg` \| `md`), `measure` (`reading` \| `none`), `as` | Components/Prose — **Pattern — article body**. Full page: **Guides/Post page → Pattern — post page** |
package/README.md CHANGED
@@ -47,8 +47,8 @@ npm run validate:composition # molecules/organisms must compose atoms (CI)
47
47
  |------|------------|
48
48
  | Atoms | `Avatar`, `Badge`, `Button`, `Checkbox`, `IconButton`, `Input`, `Kbd`, `Radio`, `RiveHand`, `Skeleton`, `Status`, `Switch`, `TextArea`, `TextLink`, `Tooltip` |
49
49
  | Molecules | `Accordion`, `CalEmbed`, `Card`, `ChatQa`, `CheckboxGroup`, `Chip`, `DisplayControls`, `Dropdown`, `Field`, `FloatingActionButton`, `HeroIntro`, `IntakeForm`, `NavList`, `PageHeader`, `PillGroup`, `PromptBar`, `RadioGroup`, `Search`, `Select`, `SelectableCard`, `SegmentedControl`, `Stat`, `StepProgress`, `TaskRows`, `TextSequence` |
50
- | Organisms | `Chart`, `Confetti`, `Dialog`, `FooterReveal`, `HeroTileStack`, `IntakeConfirmation`, `IntakeModal`, `MoreMenu`, `Panel`, `ScrollHorizontal`, `Sheet`, `SiteNav`, `Tab`, `Toast` |
51
- | Planned, not built | `Carousel`, `Pagination`, `Table` |
50
+ | Organisms | `Carousel`, `Chart`, `Confetti`, `Dialog`, `FooterReveal`, `HeroTileStack`, `IntakeConfirmation`, `IntakeModal`, `MoreMenu`, `Panel`, `ScrollHorizontal`, `Sheet`, `SiteNav`, `Tab`, `Toast` |
51
+ | Planned, not built | `Pagination`, `Table` |
52
52
 
53
53
  The list is `src/package.manifest.ts`. `npm run build` fails when it and `src/index.ts` disagree.
54
54
 
@@ -0,0 +1,58 @@
1
+ import { type ReactNode } from "react";
2
+ import { type CarouselItemWidth, type CarouselProgressPlacement } from "./carouselStyles";
3
+ export { carouselBreakpoints, carouselDefaultItemWidth, carouselProgressPlacements, type CarouselBreakpoint, type CarouselItemWidth, type CarouselProgressPlacement, } from "./carouselStyles";
4
+ /** Layout-only — width, margin, or grid placement. */
5
+ export type CarouselLayoutClassName = string;
6
+ export interface CarouselLabels {
7
+ /** Names each item by its place. Default: "2 of 4". */
8
+ item: (position: number, count: number) => string;
9
+ }
10
+ /** The row is a labelled region: name it, or point at the heading that does. */
11
+ type CarouselName = {
12
+ "aria-label": string;
13
+ "aria-labelledby"?: never;
14
+ } | {
15
+ "aria-labelledby": string;
16
+ "aria-label"?: never;
17
+ };
18
+ interface CarouselBaseProps {
19
+ /**
20
+ * Item width as a percentage of the row — one number, or one per breakpoint
21
+ * (`{ base, sm, md, lg }`; a breakpoint left out keeps the one below it). Keep it under 100 so
22
+ * the next item shows. Default: `{ base: 80, sm: 55, lg: 40 }`.
23
+ */
24
+ itemWidth?: CarouselItemWidth;
25
+ /** Rest on an item's leading edge when a drag, a scrub, or a scroll settles. Default: `true`. */
26
+ snap?: boolean;
27
+ /** Let the row run to the page edges; items still start on the grid. Default: `false`. */
28
+ bleed?: boolean;
29
+ /** Fade items where the row clips them. Default: `true`. */
30
+ fade?: boolean;
31
+ /**
32
+ * The scrubber under the row: a shorter track at the `center` (default) or the `start`, the
33
+ * `full` row width, or `none`. It hides itself while every item fits.
34
+ */
35
+ progress?: CarouselProgressPlacement;
36
+ labels?: Partial<CarouselLabels>;
37
+ /** **Carousel.Item** children, one per item. */
38
+ children?: ReactNode;
39
+ className?: CarouselLayoutClassName;
40
+ }
41
+ export type CarouselProps = CarouselBaseProps & CarouselName;
42
+ export interface CarouselItemProps {
43
+ /** Anything — an image tile, a card, a quote. */
44
+ children?: ReactNode;
45
+ className?: CarouselLayoutClassName;
46
+ }
47
+ /**
48
+ * A horizontal row of items the visitor drags, scrolls, or steps through with the keyboard, with
49
+ * a progress scrubber under it. The row is a native scroller, so touch, trackpad, and
50
+ * shift-wheel scrolling come from the browser; the pointer drag, the glide, and the scrubber are
51
+ * built on it.
52
+ */
53
+ declare function CarouselRoot({ "aria-label": ariaLabel, "aria-labelledby": ariaLabelledBy, itemWidth, snap, bleed, fade, progress, labels, children, className, }: CarouselProps): import("react").JSX.Element;
54
+ declare function CarouselItem({ children, className }: CarouselItemProps): import("react").JSX.Element;
55
+ export declare const Carousel: typeof CarouselRoot & {
56
+ Item: typeof CarouselItem;
57
+ };
58
+ //# sourceMappingURL=Carousel.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Carousel.d.ts","sourceRoot":"","sources":["../../../../src/components/organisms/Carousel/Carousel.tsx"],"names":[],"mappings":"AAAA,OAAO,EAeL,KAAK,SAAS,EACf,MAAM,OAAO,CAAC;AAwBf,OAAO,EAeL,KAAK,iBAAiB,EACtB,KAAK,yBAAyB,EAC/B,MAAM,kBAAkB,CAAC;AAE1B,OAAO,EACL,mBAAmB,EACnB,wBAAwB,EACxB,0BAA0B,EAC1B,KAAK,kBAAkB,EACvB,KAAK,iBAAiB,EACtB,KAAK,yBAAyB,GAC/B,MAAM,kBAAkB,CAAC;AAE1B,sDAAsD;AACtD,MAAM,MAAM,uBAAuB,GAAG,MAAM,CAAC;AAE7C,MAAM,WAAW,cAAc;IAC7B,uDAAuD;IACvD,IAAI,EAAE,CAAC,QAAQ,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,KAAK,MAAM,CAAC;CACnD;AAED,gFAAgF;AAChF,KAAK,YAAY,GACb;IAAE,YAAY,EAAE,MAAM,CAAC;IAAC,iBAAiB,CAAC,EAAE,KAAK,CAAA;CAAE,GACnD;IAAE,iBAAiB,EAAE,MAAM,CAAC;IAAC,YAAY,CAAC,EAAE,KAAK,CAAA;CAAE,CAAC;AAExD,UAAU,iBAAiB;IACzB;;;;OAIG;IACH,SAAS,CAAC,EAAE,iBAAiB,CAAC;IAC9B,iGAAiG;IACjG,IAAI,CAAC,EAAE,OAAO,CAAC;IACf,0FAA0F;IAC1F,KAAK,CAAC,EAAE,OAAO,CAAC;IAChB,4DAA4D;IAC5D,IAAI,CAAC,EAAE,OAAO,CAAC;IACf;;;OAGG;IACH,QAAQ,CAAC,EAAE,yBAAyB,CAAC;IACrC,MAAM,CAAC,EAAE,OAAO,CAAC,cAAc,CAAC,CAAC;IACjC,gDAAgD;IAChD,QAAQ,CAAC,EAAE,SAAS,CAAC;IACrB,SAAS,CAAC,EAAE,uBAAuB,CAAC;CACrC;AAED,MAAM,MAAM,aAAa,GAAG,iBAAiB,GAAG,YAAY,CAAC;AAE7D,MAAM,WAAW,iBAAiB;IAChC,iDAAiD;IACjD,QAAQ,CAAC,EAAE,SAAS,CAAC;IACrB,SAAS,CAAC,EAAE,uBAAuB,CAAC;CACrC;AAkED;;;;;GAKG;AACH,iBAAS,YAAY,CAAC,EACpB,YAAY,EAAE,SAAS,EACvB,iBAAiB,EAAE,cAAc,EACjC,SAAoC,EACpC,IAAW,EACX,KAAa,EACb,IAAW,EACX,QAAmB,EACnB,MAAM,EACN,QAAQ,EACR,SAAS,GACV,EAAE,aAAa,+BA0Yf;AAOD,iBAAS,YAAY,CAAC,EAAE,QAAQ,EAAE,SAAS,EAAE,EAAE,iBAAiB,+BAO/D;AAED,eAAO,MAAM,QAAQ;;CAEnB,CAAC"}
@@ -0,0 +1,310 @@
1
+ "use client";
2
+ import { cn as e } from "../../../lib/cn.js";
3
+ import { motionTransitionProp as t } from "../../../lib/motion.js";
4
+ import { carouselClamp as n, carouselMaxScroll as r, carouselNearestSnap as i, carouselOverflows as a, carouselOverscrollOffset as o, carouselProgress as s, carouselProgressAtPointer as c, carouselSnapPoints as l, carouselStep as u, carouselThumbShare as d } from "./carouselMath.js";
5
+ import { carouselBreakpoints as f, carouselDefaultItemWidth as p, carouselExtentClasses as m, carouselFrameClasses as h, carouselItemClasses as g, carouselProgressClasses as ee, carouselProgressPlacementClasses as te, carouselProgressPlacements as _, carouselProgressThumbClasses as ne, carouselProgressTrackClasses as re, carouselRootClasses as ie, carouselTrackClasses as ae, carouselViewportClasses as oe } from "./carouselStyles.js";
6
+ import { Children as se, createContext as v, isValidElement as ce, useCallback as y, useContext as b, useEffect as le, useLayoutEffect as ue, useMemo as x, useRef as S, useState as de } from "react";
7
+ import { jsx as C, jsxs as fe } from "react/jsx-runtime";
8
+ import { animate as pe, motion as me, useMotionValue as he, useMotionValueEvent as ge, useReducedMotion as _e, useTransform as ve } from "motion/react";
9
+ //#region src/components/organisms/Carousel/Carousel.tsx
10
+ var w = v(null), ye = { item: (e, t) => `${e} of ${t}` }, be = 10;
11
+ function T(e, t) {
12
+ try {
13
+ e.setPointerCapture(t);
14
+ } catch {}
15
+ }
16
+ function xe(e) {
17
+ if (typeof e == "number") return {
18
+ base: e,
19
+ sm: e,
20
+ md: e,
21
+ lg: e
22
+ };
23
+ let t = e.base ?? p.base, n = e.sm ?? t, r = e.md ?? n;
24
+ return {
25
+ base: t,
26
+ sm: n,
27
+ md: r,
28
+ lg: e.lg ?? r
29
+ };
30
+ }
31
+ function E(e, t, n) {
32
+ n ? e.style.removeProperty(t) : e.style.setProperty(t, "0px");
33
+ }
34
+ function D({ "aria-label": f, "aria-labelledby": g, itemWidth: _ = p, snap: v = !0, bleed: b = !1, fade: x = !0, progress: w = "center", labels: D, children: O, className: k }) {
35
+ let A = _e() ?? !1, j = S(null), M = S(null), N = S(null), P = S(null), F = S(null), I = S({
36
+ max: 0,
37
+ points: [0],
38
+ direction: 1
39
+ }), L = S(null), R = S(null), z = S(null), B = S(null), V = S(!1), [H, Ce] = de(null), U = he(0), W = he(0), we = ve(W, (e) => -I.current.direction * o(e)), G = y(() => Math.abs(M.current?.scrollLeft ?? 0), []), K = y(() => {
40
+ let e = j.current, t = M.current;
41
+ if (!e || !t) return;
42
+ let { max: n } = I.current, r = Math.abs(t.scrollLeft);
43
+ e.style.setProperty("--carousel-progress", String(s(r, n))), E(t, "--scroll-fade-s", r > 1), E(t, "--scroll-fade-e", r < n - 1);
44
+ }, []), Te = y((e) => {
45
+ let t = M.current;
46
+ t && (t.scrollLeft = I.current.direction * e, K());
47
+ }, [K]);
48
+ ge(U, "change", (e) => {
49
+ let t = n(e, 0, I.current.max);
50
+ Te(t), W.set(A ? 0 : e - t);
51
+ });
52
+ function q(e) {
53
+ let t = M.current;
54
+ t && (e ? t.dataset.moving = "" : delete t.dataset.moving);
55
+ }
56
+ function J() {
57
+ L.current?.stop(), L.current = null, R.current = null;
58
+ }
59
+ function Y() {
60
+ L.current = null, R.current = null, q(!1);
61
+ }
62
+ function Ee() {
63
+ L.current != null && (J(), U.jump(G()), q(!1));
64
+ }
65
+ function X(e, r = !0) {
66
+ let i = n(e, 0, I.current.max);
67
+ if (J(), U.jump(G()), A || !r) {
68
+ q(!1), U.jump(i);
69
+ return;
70
+ }
71
+ R.current = i, q(!0), L.current = pe(U, i, {
72
+ ...t("medium"),
73
+ onComplete: Y
74
+ });
75
+ }
76
+ function De(e) {
77
+ let { max: t, points: r } = I.current, a = (e) => i(r, n(e, 0, t));
78
+ if (J(), A) {
79
+ X(v ? a(U.get()) : U.get(), !1);
80
+ return;
81
+ }
82
+ let o = U.get(), s = v ? a(o) : n(o, 0, t);
83
+ if (e === 0 && s === o) {
84
+ Y();
85
+ return;
86
+ }
87
+ q(!0), L.current = pe(U, s === o ? o + Math.sign(e) : s, {
88
+ type: "inertia",
89
+ velocity: e,
90
+ min: 0,
91
+ max: t,
92
+ modifyTarget: v ? a : void 0,
93
+ onComplete: Y
94
+ });
95
+ }
96
+ let Z = y(() => {
97
+ let e = j.current, t = M.current, n = N.current;
98
+ if (!e || !t || !n || W.get() !== 0) return;
99
+ if (b) {
100
+ let t = e.getBoundingClientRect(), n = Math.max(0, Math.floor(t.left)), r = Math.max(0, Math.floor(document.documentElement.clientWidth - t.right));
101
+ e.style.setProperty("--carousel-bleed-left", `${n}px`), e.style.setProperty("--carousel-bleed-right", `${r}px`);
102
+ } else e.style.removeProperty("--carousel-bleed-left"), e.style.removeProperty("--carousel-bleed-right");
103
+ let i = getComputedStyle(t).direction === "rtl" ? -1 : 1, o = t.clientWidth, s = t.scrollWidth, c = r(o, s), u = Array.from(n.querySelectorAll(":scope > [data-carousel-item]")), f = u[0]?.getBoundingClientRect(), p = f == null ? [] : u.map((e) => {
104
+ let t = e.getBoundingClientRect();
105
+ return i === 1 ? t.left - f.left : f.right - t.right;
106
+ });
107
+ I.current = {
108
+ max: c,
109
+ direction: i,
110
+ points: l(p, c)
111
+ };
112
+ let m = P.current;
113
+ m && e.style.setProperty("--carousel-thumb", String(d(o, s, m.clientWidth))), K();
114
+ let h = a(o, s);
115
+ Ce((e) => e === h ? e : h);
116
+ }, [
117
+ b,
118
+ W,
119
+ K
120
+ ]);
121
+ ue(() => {
122
+ if (Z(), window.addEventListener("resize", Z), typeof ResizeObserver > "u") return () => window.removeEventListener("resize", Z);
123
+ let e = new ResizeObserver(Z);
124
+ for (let t of [
125
+ j.current,
126
+ M.current,
127
+ N.current,
128
+ P.current
129
+ ]) t && e.observe(t);
130
+ return () => {
131
+ e.disconnect(), window.removeEventListener("resize", Z);
132
+ };
133
+ }, [Z, w]), le(() => () => L.current?.stop(), []);
134
+ function Oe(e) {
135
+ if (e.pointerType !== "mouse" || e.button !== 0 || I.current.max <= 0) return;
136
+ let t = L.current != null;
137
+ J(), U.jump(G()), z.current = {
138
+ pointerId: e.pointerId,
139
+ startX: e.clientX,
140
+ startPosition: G(),
141
+ active: !1,
142
+ interrupted: t
143
+ };
144
+ }
145
+ function ke(e) {
146
+ let t = z.current;
147
+ if (!(!t || t.pointerId !== e.pointerId)) {
148
+ if (e.buttons === 0) {
149
+ Q(e);
150
+ return;
151
+ }
152
+ if (!t.active) {
153
+ if (Math.abs(e.clientX - t.startX) < 4) return;
154
+ t.active = !0, t.startX = e.clientX, T(e.currentTarget, e.pointerId), e.currentTarget.dataset.dragging = "", q(!0);
155
+ }
156
+ U.set(t.startPosition - I.current.direction * (e.clientX - t.startX));
157
+ }
158
+ }
159
+ function Q(e) {
160
+ let t = z.current;
161
+ if (!t || t.pointerId !== e.pointerId) return;
162
+ if (z.current = null, !t.active) {
163
+ t.interrupted && De(0);
164
+ return;
165
+ }
166
+ let n = e.currentTarget;
167
+ n.hasPointerCapture(e.pointerId) && n.releasePointerCapture(e.pointerId), delete n.dataset.dragging, V.current = !0, window.setTimeout(() => {
168
+ V.current = !1;
169
+ }, 0), De(e.type === "pointercancel" ? 0 : U.getVelocity());
170
+ }
171
+ function Ae(e) {
172
+ V.current && (V.current = !1, e.preventDefault(), e.stopPropagation());
173
+ }
174
+ function je(e) {
175
+ if (e.target !== e.currentTarget || e.altKey || e.ctrlKey || e.metaKey) return;
176
+ let { max: t, points: n, direction: r } = I.current, i = R.current ?? G(), a;
177
+ switch (e.key) {
178
+ case "ArrowRight":
179
+ a = u(n, i, r);
180
+ break;
181
+ case "ArrowLeft":
182
+ a = u(n, i, r === 1 ? -1 : 1);
183
+ break;
184
+ case "Home":
185
+ a = 0;
186
+ break;
187
+ case "End":
188
+ a = t;
189
+ break;
190
+ default: return;
191
+ }
192
+ e.preventDefault(), X(a);
193
+ }
194
+ function Me(e) {
195
+ let t = P.current, n = F.current, { max: r, points: a, direction: o } = I.current;
196
+ if (!t || !n || r <= 0 || e.button !== 0) return;
197
+ e.preventDefault();
198
+ let l = t.getBoundingClientRect(), u = n.getBoundingClientRect();
199
+ if (e.clientX >= u.left - be && e.clientX <= u.right + be) {
200
+ J(), U.jump(G()), q(!0), T(e.currentTarget, e.pointerId), e.currentTarget.dataset.scrubbing = "", B.current = {
201
+ pointerId: e.pointerId,
202
+ startX: e.clientX,
203
+ startProgress: s(G(), r),
204
+ travel: l.width - u.width
205
+ };
206
+ return;
207
+ }
208
+ let d = o === 1 ? e.clientX - l.left : l.right - e.clientX, f = c(d, l.width, u.width) * r;
209
+ X(v ? i(a, f) : f);
210
+ }
211
+ function Ne(e) {
212
+ let t = B.current;
213
+ if (!t || t.pointerId !== e.pointerId || t.travel <= 0) return;
214
+ let { max: r, direction: i } = I.current, a = i * (e.clientX - t.startX) / t.travel;
215
+ U.set(n(t.startProgress + a, 0, 1) * r);
216
+ }
217
+ function Pe(e) {
218
+ let t = B.current;
219
+ if (!t || t.pointerId !== e.pointerId) return;
220
+ B.current = null;
221
+ let n = e.currentTarget;
222
+ n.hasPointerCapture(e.pointerId) && n.releasePointerCapture(e.pointerId), delete n.dataset.scrubbing, v ? X(i(I.current.points, G())) : q(!1);
223
+ }
224
+ let $ = xe(_), Fe = {
225
+ "--carousel-item": String($.base),
226
+ "--carousel-item-sm": String($.sm),
227
+ "--carousel-item-md": String($.md),
228
+ "--carousel-item-lg": String($.lg)
229
+ }, Ie = D?.item ?? ye.item, Le = se.toArray(O), Re = H == null ? void 0 : String(H);
230
+ return /* @__PURE__ */ fe("div", {
231
+ ref: j,
232
+ className: e(ie, k),
233
+ style: Fe,
234
+ "data-carousel": "",
235
+ children: [/* @__PURE__ */ C("div", {
236
+ className: h,
237
+ children: /* @__PURE__ */ C("div", {
238
+ ref: M,
239
+ role: "region",
240
+ "aria-label": f,
241
+ "aria-labelledby": g,
242
+ tabIndex: H === !1 ? void 0 : 0,
243
+ "data-carousel-viewport": "",
244
+ "data-overflowing": Re,
245
+ className: e(oe, v && "snap-x snap-mandatory data-[moving]:snap-none", x && "scroll-fade-x"),
246
+ style: { "--scroll-fade-s": "0px" },
247
+ onScroll: K,
248
+ onKeyDown: je,
249
+ onPointerDown: Oe,
250
+ onPointerMove: ke,
251
+ onPointerUp: Q,
252
+ onPointerCancel: Q,
253
+ onClickCapture: Ae,
254
+ onDragStart: (e) => e.preventDefault(),
255
+ onWheel: Ee,
256
+ onTouchStart: Ee,
257
+ children: /* @__PURE__ */ C("div", {
258
+ className: m,
259
+ children: /* @__PURE__ */ C(me.div, {
260
+ ref: N,
261
+ className: ae,
262
+ style: { x: we },
263
+ children: Le.map((e, t) => /* @__PURE__ */ C(Se, {
264
+ label: Ie(t + 1, Le.length),
265
+ children: e
266
+ }, ce(e) && e.key != null ? e.key : t))
267
+ })
268
+ })
269
+ })
270
+ }), w === "none" ? null : /* @__PURE__ */ C("div", {
271
+ "aria-hidden": "true",
272
+ "data-carousel-progress": "",
273
+ "data-overflowing": Re,
274
+ className: e(ee, te[w]),
275
+ onPointerDown: Me,
276
+ onPointerMove: Ne,
277
+ onPointerUp: Pe,
278
+ onPointerCancel: Pe,
279
+ children: /* @__PURE__ */ C("div", {
280
+ ref: P,
281
+ className: re,
282
+ children: /* @__PURE__ */ C("div", {
283
+ ref: F,
284
+ className: ne,
285
+ "data-carousel-progress-thumb": ""
286
+ })
287
+ })
288
+ })]
289
+ });
290
+ }
291
+ function Se({ label: e, children: t }) {
292
+ let n = x(() => ({ label: e }), [e]);
293
+ return /* @__PURE__ */ C(w.Provider, {
294
+ value: n,
295
+ children: t
296
+ });
297
+ }
298
+ function O({ children: t, className: n }) {
299
+ let r = b(w);
300
+ return /* @__PURE__ */ C("div", {
301
+ role: "group",
302
+ "aria-label": r?.label,
303
+ "data-carousel-item": "",
304
+ className: e(g, n),
305
+ children: t
306
+ });
307
+ }
308
+ var k = Object.assign(D, { Item: O });
309
+ //#endregion
310
+ export { k as Carousel, f as carouselBreakpoints, p as carouselDefaultItemWidth, _ as carouselProgressPlacements };
@@ -0,0 +1,39 @@
1
+ /**
2
+ * Carousel geometry — positions are logical: `0` is the row's start and the value grows toward
3
+ * its end, in px, in both writing directions. The component maps them to `scrollLeft`.
4
+ */
5
+ /** Share of an overscroll the row follows before it springs back. */
6
+ export declare const carouselOverscrollElasticity = 0.5;
7
+ /** Pointer travel, in px, before a press on the row becomes a drag. */
8
+ export declare const carouselDragThreshold = 4;
9
+ /** The filled part of the scrubber never gets narrower than this, in px. */
10
+ export declare const carouselThumbMinWidth = 24;
11
+ export declare function carouselClamp(value: number, min: number, max: number): number;
12
+ /** How far the row can scroll. `0` when every item fits. */
13
+ export declare function carouselMaxScroll(viewWidth: number, contentWidth: number): number;
14
+ /** True when the row has more than it can show. */
15
+ export declare function carouselOverflows(viewWidth: number, contentWidth: number): boolean;
16
+ /**
17
+ * Where the row rests: each item's leading edge, capped at the end of the row. Items that
18
+ * share a resting place (those past the last full view) collapse into one point.
19
+ */
20
+ export declare function carouselSnapPoints(itemOffsets: readonly number[], maxScroll: number): number[];
21
+ /** The resting place closest to `position`. */
22
+ export declare function carouselNearestSnap(points: readonly number[], position: number): number;
23
+ /** One item toward the end (`1`) or the start (`-1`) from `position`; stays put at either end. */
24
+ export declare function carouselStep(points: readonly number[], position: number, direction: 1 | -1): number;
25
+ /** Row progress, 0–1. */
26
+ export declare function carouselProgress(position: number, maxScroll: number): number;
27
+ /**
28
+ * Width of the scrubber's filled part as a share of its track (0–1): the share of the row in
29
+ * view, held to `carouselThumbMinWidth` so it stays easy to grab.
30
+ */
31
+ export declare function carouselThumbShare(viewWidth: number, contentWidth: number, trackWidth: number): number;
32
+ /**
33
+ * Row progress for a press on the scrubber's track at `pointer` px from the track's start: the
34
+ * filled part centers on the pointer.
35
+ */
36
+ export declare function carouselProgressAtPointer(pointer: number, trackWidth: number, thumbWidth: number): number;
37
+ /** How far the row shifts for an overscroll of `overshoot` px. */
38
+ export declare function carouselOverscrollOffset(overshoot: number): number;
39
+ //# sourceMappingURL=carouselMath.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"carouselMath.d.ts","sourceRoot":"","sources":["../../../../src/components/organisms/Carousel/carouselMath.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,qEAAqE;AACrE,eAAO,MAAM,4BAA4B,MAAM,CAAC;AAEhD,uEAAuE;AACvE,eAAO,MAAM,qBAAqB,IAAI,CAAC;AAEvC,4EAA4E;AAC5E,eAAO,MAAM,qBAAqB,KAAK,CAAC;AAKxC,wBAAgB,aAAa,CAAC,KAAK,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,GAAG,MAAM,CAE7E;AAED,4DAA4D;AAC5D,wBAAgB,iBAAiB,CAAC,SAAS,EAAE,MAAM,EAAE,YAAY,EAAE,MAAM,GAAG,MAAM,CAEjF;AAED,mDAAmD;AACnD,wBAAgB,iBAAiB,CAAC,SAAS,EAAE,MAAM,EAAE,YAAY,EAAE,MAAM,GAAG,OAAO,CAElF;AAED;;;GAGG;AACH,wBAAgB,kBAAkB,CAAC,WAAW,EAAE,SAAS,MAAM,EAAE,EAAE,SAAS,EAAE,MAAM,GAAG,MAAM,EAAE,CAS9F;AAED,+CAA+C;AAC/C,wBAAgB,mBAAmB,CAAC,MAAM,EAAE,SAAS,MAAM,EAAE,EAAE,QAAQ,EAAE,MAAM,GAAG,MAAM,CAMvF;AAED,kGAAkG;AAClG,wBAAgB,YAAY,CAAC,MAAM,EAAE,SAAS,MAAM,EAAE,EAAE,QAAQ,EAAE,MAAM,EAAE,SAAS,EAAE,CAAC,GAAG,CAAC,CAAC,GAAG,MAAM,CAQnG;AAED,yBAAyB;AACzB,wBAAgB,gBAAgB,CAAC,QAAQ,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,GAAG,MAAM,CAG5E;AAED;;;GAGG;AACH,wBAAgB,kBAAkB,CAAC,SAAS,EAAE,MAAM,EAAE,YAAY,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,GAAG,MAAM,CAItG;AAED;;;GAGG;AACH,wBAAgB,yBAAyB,CAAC,OAAO,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,GAAG,MAAM,CAIzG;AAED,kEAAkE;AAClE,wBAAgB,wBAAwB,CAAC,SAAS,EAAE,MAAM,GAAG,MAAM,CAElE"}
@@ -0,0 +1,47 @@
1
+ "use client";
2
+ //#region src/components/organisms/Carousel/carouselMath.ts
3
+ var e = .5;
4
+ function t(e, t, n) {
5
+ return Math.min(Math.max(e, t), n);
6
+ }
7
+ function n(e, t) {
8
+ return Math.max(0, t - e);
9
+ }
10
+ function r(e, t) {
11
+ return n(e, t) > 1;
12
+ }
13
+ function i(e, n) {
14
+ let r = [];
15
+ for (let i of [...e].sort((e, t) => e - t)) {
16
+ let e = t(i, 0, n), a = r[r.length - 1];
17
+ (a === void 0 || e - a > 1) && r.push(e);
18
+ }
19
+ return r.length === 0 ? [0] : r;
20
+ }
21
+ function a(e, t) {
22
+ let n = e[0] ?? 0;
23
+ for (let r of e) Math.abs(r - t) < Math.abs(n - t) && (n = r);
24
+ return n;
25
+ }
26
+ function o(e, t, n) {
27
+ if (n === 1) return e.find((e) => e > t + 1) ?? e[e.length - 1] ?? 0;
28
+ for (let n = e.length - 1; n >= 0; --n) if (e[n] < t - 1) return e[n];
29
+ return e[0] ?? 0;
30
+ }
31
+ function s(e, n) {
32
+ return n <= 0 ? 0 : t(e / n, 0, 1);
33
+ }
34
+ function c(e, n, r) {
35
+ if (n <= 0 || r <= 0) return 1;
36
+ let i = t(e / n, 0, 1);
37
+ return t(Math.max(i, 24 / r), 0, 1);
38
+ }
39
+ function l(e, n, r) {
40
+ let i = n - r;
41
+ return i <= 0 ? 0 : t((e - r / 2) / i, 0, 1);
42
+ }
43
+ function u(t) {
44
+ return t * e;
45
+ }
46
+ //#endregion
47
+ export { t as carouselClamp, n as carouselMaxScroll, a as carouselNearestSnap, r as carouselOverflows, e as carouselOverscrollElasticity, u as carouselOverscrollOffset, s as carouselProgress, l as carouselProgressAtPointer, i as carouselSnapPoints, o as carouselStep, c as carouselThumbShare };
@@ -0,0 +1,49 @@
1
+ export declare const carouselProgressPlacements: readonly ["center", "start", "full", "none"];
2
+ /**
3
+ * Where the scrubber sits under the row: a shorter track at the `center` (default) or the
4
+ * `start`, the `full` row width, or `none`. The shorter tracks are full width on phones.
5
+ */
6
+ export type CarouselProgressPlacement = (typeof carouselProgressPlacements)[number];
7
+ export declare const carouselBreakpoints: readonly ["base", "sm", "md", "lg"];
8
+ export type CarouselBreakpoint = (typeof carouselBreakpoints)[number];
9
+ /** Item width as a percentage of the row, per breakpoint. A breakpoint left out keeps the one below it. */
10
+ export type CarouselItemWidth = number | Partial<Record<CarouselBreakpoint, number>>;
11
+ /** About one item on phones, two from `sm`, two and a half from `lg` — the next one always shows. */
12
+ export declare const carouselDefaultItemWidth: {
13
+ readonly base: 80;
14
+ readonly sm: 55;
15
+ readonly lg: 40;
16
+ };
17
+ /** The root is the size container the item widths are a share of. */
18
+ export declare const carouselRootClasses = "@container/carousel flex w-full min-w-0 flex-col";
19
+ /**
20
+ * Holds the row and draws its focus ring — the row itself is masked by the edge fade, which would
21
+ * cut a ring off. With `bleed` it reaches past the root to the page edges.
22
+ */
23
+ export declare const carouselFrameClasses: string;
24
+ /**
25
+ * The scroller. Its own scrollbar is hidden — the scrubber stands in for it. The block padding
26
+ * (taken back by the margins) leaves room for an item's shadow, which the scroller would clip.
27
+ */
28
+ export declare const carouselViewportClasses: string;
29
+ /** Rest on item edges — off while the pointer or an animation is moving the row. */
30
+ export declare const carouselViewportSnapClasses = "snap-x snap-mandatory data-[moving]:snap-none";
31
+ export declare const carouselViewportFadeClasses = "scroll-fade-x";
32
+ /**
33
+ * As wide as the items, plus the bleed on either side. It stays put while the track inside it
34
+ * shifts on an overscroll, so the scroll width does not change under the pointer.
35
+ */
36
+ export declare const carouselExtentClasses = "w-max min-w-full pl-[var(--carousel-bleed-left,0px)] pr-[var(--carousel-bleed-right,0px)]";
37
+ /** Items in a row on the page grid's gutter. Images and links inside are not picked up by a drag. */
38
+ export declare const carouselTrackClasses: string;
39
+ export declare const carouselItemClasses: string;
40
+ /**
41
+ * The scrubber's hit area: 44px tall around a slim track. It keeps its place when every item
42
+ * fits, so the page under it does not move when the row starts to overflow.
43
+ */
44
+ export declare const carouselProgressClasses = "group/carousel-progress relative flex h-11 w-full cursor-pointer touch-none select-none items-center data-[overflowing=false]:invisible";
45
+ export declare const carouselProgressPlacementClasses: Record<Exclude<CarouselProgressPlacement, "none">, string>;
46
+ export declare const carouselProgressTrackClasses: string;
47
+ /** The filled part: its width is the share of the row in view, its place the row's progress. */
48
+ export declare const carouselProgressThumbClasses: string;
49
+ //# sourceMappingURL=carouselStyles.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"carouselStyles.d.ts","sourceRoot":"","sources":["../../../../src/components/organisms/Carousel/carouselStyles.ts"],"names":[],"mappings":"AAGA,eAAO,MAAM,0BAA0B,8CAA+C,CAAC;AAEvF;;;GAGG;AACH,MAAM,MAAM,yBAAyB,GAAG,CAAC,OAAO,0BAA0B,CAAC,CAAC,MAAM,CAAC,CAAC;AAEpF,eAAO,MAAM,mBAAmB,qCAAsC,CAAC;AAEvE,MAAM,MAAM,kBAAkB,GAAG,CAAC,OAAO,mBAAmB,CAAC,CAAC,MAAM,CAAC,CAAC;AAEtE,2GAA2G;AAC3G,MAAM,MAAM,iBAAiB,GAAG,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC,kBAAkB,EAAE,MAAM,CAAC,CAAC,CAAC;AAErF,qGAAqG;AACrG,eAAO,MAAM,wBAAwB;;;;CAAoE,CAAC;AAE1G,qEAAqE;AACrE,eAAO,MAAM,mBAAmB,qDAAqD,CAAC;AAEtF;;;GAGG;AACH,eAAO,MAAM,oBAAoB,QAMhC,CAAC;AAEF;;;GAGG;AACH,eAAO,MAAM,uBAAuB,QAKnC,CAAC;AAEF,oFAAoF;AACpF,eAAO,MAAM,2BAA2B,kDAAkD,CAAC;AAE3F,eAAO,MAAM,2BAA2B,kBAAkB,CAAC;AAE3D;;;GAGG;AACH,eAAO,MAAM,qBAAqB,8FAC2D,CAAC;AAE9F,qGAAqG;AACrG,eAAO,MAAM,oBAAoB,QAGhC,CAAC;AAEF,eAAO,MAAM,mBAAmB,QAI/B,CAAC;AAEF;;;GAGG;AACH,eAAO,MAAM,uBAAuB,4IACuG,CAAC;AAE5I,eAAO,MAAM,gCAAgC,EAAE,MAAM,CAAC,OAAO,CAAC,yBAAyB,EAAE,MAAM,CAAC,EAAE,MAAM,CAIvG,CAAC;AAEF,eAAO,MAAM,4BAA4B,QAIxC,CAAC;AAEF,gGAAgG;AAChG,eAAO,MAAM,4BAA4B,QAMxC,CAAC"}
@@ -0,0 +1,25 @@
1
+ "use client";
2
+ import { cn as e } from "../../../lib/cn.js";
3
+ import { focusRingTransitionClasses as t, motionTransition as n } from "../../../lib/motion.js";
4
+ //#region src/components/organisms/Carousel/carouselStyles.ts
5
+ var r = [
6
+ "center",
7
+ "start",
8
+ "full",
9
+ "none"
10
+ ], i = [
11
+ "base",
12
+ "sm",
13
+ "md",
14
+ "lg"
15
+ ], a = {
16
+ base: 80,
17
+ sm: 55,
18
+ lg: 40
19
+ }, o = "@container/carousel flex w-full min-w-0 flex-col", s = e("relative rounded-[var(--radius-card-shell)]", "ml-[calc(var(--carousel-bleed-left,0px)*-1)] mr-[calc(var(--carousel-bleed-right,0px)*-1)]", "has-[>[data-carousel-viewport]:focus-visible]:ring-2 has-[>[data-carousel-viewport]:focus-visible]:ring-focus-ring", "has-[>[data-carousel-viewport]:focus-visible]:ring-offset-2 has-[>[data-carousel-viewport]:focus-visible]:ring-offset-body", t), c = e("-mt-2 -mb-6 overflow-x-auto overflow-y-hidden overscroll-x-contain pt-2 pb-6 outline-none", "[scrollbar-width:none] [&::-webkit-scrollbar]:hidden", "scroll-pl-[var(--carousel-bleed-left,0px)] scroll-pr-[var(--carousel-bleed-right,0px)]", "data-[overflowing=true]:cursor-grab data-[dragging]:cursor-grabbing data-[dragging]:select-none"), l = "snap-x snap-mandatory data-[moving]:snap-none", u = "scroll-fade-x", d = "w-max min-w-full pl-[var(--carousel-bleed-left,0px)] pr-[var(--carousel-bleed-right,0px)]", f = e("flex w-max min-w-full gap-[var(--grid-column-gap,1.5rem)]", "[&_a]:[-webkit-user-drag:none] [&_img]:[-webkit-user-drag:none]"), p = e("min-w-0 shrink-0 grow-0 snap-start", "basis-[calc(var(--carousel-item)*1cqw)] sm:basis-[calc(var(--carousel-item-sm)*1cqw)]", "md:basis-[calc(var(--carousel-item-md)*1cqw)] lg:basis-[calc(var(--carousel-item-lg)*1cqw)]"), m = "group/carousel-progress relative flex h-11 w-full cursor-pointer touch-none select-none items-center data-[overflowing=false]:invisible", h = {
20
+ center: "self-center sm:w-60",
21
+ start: "self-start sm:w-60",
22
+ full: ""
23
+ }, g = e("relative h-1 w-full rounded-full bg-neutral transition-[height]", "group-data-[scrubbing]/carousel-progress:h-1.5", n("fast")), _ = e("absolute inset-y-0 w-[calc(var(--carousel-thumb,0)*100%)] cursor-grab rounded-full bg-muted", "start-[calc(var(--carousel-progress,0)*(1_-_var(--carousel-thumb,0))*100%)]", "transition-colors group-hover/carousel-progress:bg-fg", "group-data-[scrubbing]/carousel-progress:cursor-grabbing group-data-[scrubbing]/carousel-progress:bg-fg", n("fast"));
24
+ //#endregion
25
+ export { i as carouselBreakpoints, a as carouselDefaultItemWidth, d as carouselExtentClasses, s as carouselFrameClasses, p as carouselItemClasses, m as carouselProgressClasses, h as carouselProgressPlacementClasses, r as carouselProgressPlacements, _ as carouselProgressThumbClasses, g as carouselProgressTrackClasses, o as carouselRootClasses, f as carouselTrackClasses, c as carouselViewportClasses, u as carouselViewportFadeClasses, l as carouselViewportSnapClasses };
package/dist/index.d.ts CHANGED
@@ -47,6 +47,7 @@ export { Stat, statGroupColumns, statGroupGridClasses, statSizes, statTrendDirec
47
47
  export { StepProgress, isStepProgressSegmentFilled, stepProgressLabel, type StepProgressLayoutClassName, type StepProgressProps, } from "./components/molecules/StepProgress/StepProgress";
48
48
  export { TaskRows, taskRowStatuses, taskRowsDetailLayouts, taskRowsDetailVariants, taskRowsVariants, type TaskRowStatus, type TaskRowsDetailLayout, type TaskRowsDetailProps, type TaskRowsDetailVariant, type TaskRowsItemProps, type TaskRowsLabels, type TaskRowsLayoutClassName, type TaskRowsProps, type TaskRowsVariant, } from "./components/molecules/TaskRows/TaskRows";
49
49
  export { TextSequence, sequencePlainText, textSequenceDefaultDelay, textSequenceDefaultStagger, textSequenceEmphases, textSequenceShapeTones, textSequenceShapeVariants, textSequenceTriggers, type TextSequenceEmphasis, type TextSequenceLayoutClassName, type TextSequenceProps, type TextSequenceShapeLayoutClassName, type TextSequenceShapeProps, type TextSequenceShapeTone, type TextSequenceShapeVariant, type TextSequenceTrigger, } from "./components/molecules/TextSequence/TextSequence";
50
+ export { Carousel, carouselBreakpoints, carouselDefaultItemWidth, carouselProgressPlacements, type CarouselBreakpoint, type CarouselItemProps, type CarouselItemWidth, type CarouselLabels, type CarouselLayoutClassName, type CarouselProgressPlacement, type CarouselProps, } from "./components/organisms/Carousel/Carousel";
50
51
  export { Chart, ChartCartesian, ChartCartesianNoData, ChartDistributionStrip, ChartHeatmap, ChartLoading, ChartLegend, ChartRankedBars, ChartTooltipContent, ChartUnitGrid, chartCartesianDefinedSegments, chartCartesianGapBands, chartCartesianGapRuns, chartCartesianHasPlottableValues, chartCartesianNoDataLabelDefault, chartFormatPercent, isChartCartesianNumber, isChartCartesianSeriesDefined, resolveChartCartesianGapKeys, resolveChartCartesianNoData, chartKpiHeroRowClasses, chartKpiHeroValueClasses, chartKpiTrendLabelClasses, chartKpiTrendRowClasses, chartKpiTrendValueClasses, chartMaxTicksForWidth, chartSegmentBarWidth, chartSegmentFillVariants, chartSegmentPresets, chartSegmentTickSpec, resolveCapacityBarLayout, resolveSegmentBarConfig, type ChartLayoutClassName, type ChartDistributionItem, type ChartDistributionReference, type ChartDistributionStripLayoutClassName, type ChartDistributionStripProps, type ChartHeatmapAxisItem, type ChartHeatmapCell, type ChartHeatmapLayoutClassName, type ChartHeatmapProps, type ChartRankedBarItem, type ChartRankedBarsAnimate, type ChartRankedBarsLayoutClassName, type ChartRankedBarsProps, type ChartSegmentFillVariant, type ChartSegmentPreset, type ChartSegmentedBarProps, type ChartTone, type ChartUnitGridLayoutClassName, type ChartUnitGridPart, type ChartUnitGridProps, } from "./components/organisms/Chart/Chart";
51
52
  export { ChatDock, ChatDockGate, chatDockDefaultLabels, chatDockFollowUpsPlacements, chatDockGateDefaultLabels, chatDockPlacements, type ChatDockFeedback, type ChatDockFollowUpsPlacement, type ChatDockGateLabels, type ChatDockGateProps, type ChatDockLabels, type ChatDockLayoutClassName, type ChatDockMessage, type ChatDockMessageMeta, type ChatDockPlacement, type ChatDockProps, type ChatDockSuggestion, } from "./components/organisms/ChatDock/ChatDock";
52
53
  export { ConfettiProvider, confettiDefaultColors, confettiDefaults, useConfetti, useConfettiOnMount, type ConfettiFireOptions, type ConfettiOrigin, type ConfettiProviderProps, } from "./components/organisms/Confetti/Confetti";