@mortenbrudvik/waveui 0.14.0 → 0.15.0

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 (125) hide show
  1. package/README.md +142 -32
  2. package/dist/components/data-display/InfoButton.cjs +1 -1
  3. package/dist/components/data-display/InfoButton.cjs.map +1 -1
  4. package/dist/components/data-display/InfoButton.mjs +90 -82
  5. package/dist/components/data-display/InfoButton.mjs.map +1 -1
  6. package/dist/components/data-display/InfoLabel.cjs +1 -1
  7. package/dist/components/data-display/InfoLabel.cjs.map +1 -1
  8. package/dist/components/data-display/InfoLabel.mjs +19 -18
  9. package/dist/components/data-display/InfoLabel.mjs.map +1 -1
  10. package/dist/components/feedback/MessageBarGroup.cjs +2 -0
  11. package/dist/components/feedback/MessageBarGroup.cjs.map +1 -0
  12. package/dist/components/feedback/MessageBarGroup.mjs +63 -0
  13. package/dist/components/feedback/MessageBarGroup.mjs.map +1 -0
  14. package/dist/components/feedback/ProgressBar.cjs +1 -1
  15. package/dist/components/feedback/ProgressBar.cjs.map +1 -1
  16. package/dist/components/feedback/ProgressBar.mjs +41 -39
  17. package/dist/components/feedback/ProgressBar.mjs.map +1 -1
  18. package/dist/components/feedback/Toaster.cjs +1 -1
  19. package/dist/components/feedback/Toaster.cjs.map +1 -1
  20. package/dist/components/feedback/Toaster.mjs +222 -216
  21. package/dist/components/feedback/Toaster.mjs.map +1 -1
  22. package/dist/components/layout/Accordion.cjs +1 -1
  23. package/dist/components/layout/Accordion.cjs.map +1 -1
  24. package/dist/components/layout/Accordion.mjs +124 -109
  25. package/dist/components/layout/Accordion.mjs.map +1 -1
  26. package/dist/components/layout/Carousel.cjs +1 -1
  27. package/dist/components/layout/Carousel.cjs.map +1 -1
  28. package/dist/components/layout/Carousel.mjs +207 -193
  29. package/dist/components/layout/Carousel.mjs.map +1 -1
  30. package/dist/components/layout/TabList.cjs +1 -1
  31. package/dist/components/layout/TabList.cjs.map +1 -1
  32. package/dist/components/layout/TabList.mjs +149 -108
  33. package/dist/components/layout/TabList.mjs.map +1 -1
  34. package/dist/components/layout/Tree.cjs.map +1 -1
  35. package/dist/components/layout/Tree.context.cjs +1 -1
  36. package/dist/components/layout/Tree.context.cjs.map +1 -1
  37. package/dist/components/layout/Tree.context.mjs +2 -1
  38. package/dist/components/layout/Tree.context.mjs.map +1 -1
  39. package/dist/components/layout/Tree.core.cjs +1 -1
  40. package/dist/components/layout/Tree.core.cjs.map +1 -1
  41. package/dist/components/layout/Tree.core.mjs +178 -165
  42. package/dist/components/layout/Tree.core.mjs.map +1 -1
  43. package/dist/components/layout/Tree.mjs.map +1 -1
  44. package/dist/components/navigation/Menu.popover.cjs +1 -1
  45. package/dist/components/navigation/Menu.popover.cjs.map +1 -1
  46. package/dist/components/navigation/Menu.popover.mjs +154 -168
  47. package/dist/components/navigation/Menu.popover.mjs.map +1 -1
  48. package/dist/components/navigation/Nav.cjs +1 -1
  49. package/dist/components/navigation/Nav.cjs.map +1 -1
  50. package/dist/components/navigation/Nav.mjs +156 -136
  51. package/dist/components/navigation/Nav.mjs.map +1 -1
  52. package/dist/components/navigation/NavDrawer.cjs +1 -1
  53. package/dist/components/navigation/NavDrawer.cjs.map +1 -1
  54. package/dist/components/navigation/NavDrawer.mjs +48 -45
  55. package/dist/components/navigation/NavDrawer.mjs.map +1 -1
  56. package/dist/components/overlays/Dialog.cjs +1 -1
  57. package/dist/components/overlays/Dialog.cjs.map +1 -1
  58. package/dist/components/overlays/Dialog.mjs +128 -122
  59. package/dist/components/overlays/Dialog.mjs.map +1 -1
  60. package/dist/components/overlays/Dialog.slots.cjs +1 -1
  61. package/dist/components/overlays/Dialog.slots.cjs.map +1 -1
  62. package/dist/components/overlays/Dialog.slots.mjs +12 -12
  63. package/dist/components/overlays/Dialog.slots.mjs.map +1 -1
  64. package/dist/components/overlays/Drawer.cjs.map +1 -1
  65. package/dist/components/overlays/Drawer.mjs.map +1 -1
  66. package/dist/components/overlays/Drawer.panel.cjs +1 -1
  67. package/dist/components/overlays/Drawer.panel.cjs.map +1 -1
  68. package/dist/components/overlays/Drawer.panel.mjs +97 -81
  69. package/dist/components/overlays/Drawer.panel.mjs.map +1 -1
  70. package/dist/components/overlays/Drawer.root.cjs +1 -1
  71. package/dist/components/overlays/Drawer.root.cjs.map +1 -1
  72. package/dist/components/overlays/Drawer.root.mjs +34 -31
  73. package/dist/components/overlays/Drawer.root.mjs.map +1 -1
  74. package/dist/components/overlays/Popover.cjs +1 -1
  75. package/dist/components/overlays/Popover.cjs.map +1 -1
  76. package/dist/components/overlays/Popover.mjs +231 -216
  77. package/dist/components/overlays/Popover.mjs.map +1 -1
  78. package/dist/components/overlays/TeachingPopover.cjs.map +1 -1
  79. package/dist/components/overlays/TeachingPopover.mjs.map +1 -1
  80. package/dist/components/overlays/TeachingPopover.parts.cjs +1 -1
  81. package/dist/components/overlays/TeachingPopover.parts.cjs.map +1 -1
  82. package/dist/components/overlays/TeachingPopover.parts.mjs +202 -173
  83. package/dist/components/overlays/TeachingPopover.parts.mjs.map +1 -1
  84. package/dist/components/overlays/TeachingPopover.root.cjs +1 -1
  85. package/dist/components/overlays/TeachingPopover.root.cjs.map +1 -1
  86. package/dist/components/overlays/TeachingPopover.root.mjs +108 -99
  87. package/dist/components/overlays/TeachingPopover.root.mjs.map +1 -1
  88. package/dist/components/overlays/Tooltip.cjs +1 -1
  89. package/dist/components/overlays/Tooltip.cjs.map +1 -1
  90. package/dist/components/overlays/Tooltip.mjs +66 -61
  91. package/dist/components/overlays/Tooltip.mjs.map +1 -1
  92. package/dist/components/provider/WaveProvider.cjs +1 -1
  93. package/dist/components/provider/WaveProvider.cjs.map +1 -1
  94. package/dist/components/provider/WaveProvider.mjs +26 -23
  95. package/dist/components/provider/WaveProvider.mjs.map +1 -1
  96. package/dist/hooks/useCollapsePresence.cjs +2 -0
  97. package/dist/hooks/useCollapsePresence.cjs.map +1 -0
  98. package/dist/hooks/useCollapsePresence.mjs +21 -0
  99. package/dist/hooks/useCollapsePresence.mjs.map +1 -0
  100. package/dist/hooks/useFocusBeforeClose.cjs +2 -0
  101. package/dist/hooks/useFocusBeforeClose.cjs.map +1 -0
  102. package/dist/hooks/useFocusBeforeClose.mjs +33 -0
  103. package/dist/hooks/useFocusBeforeClose.mjs.map +1 -0
  104. package/dist/hooks/useMotion.cjs +2 -0
  105. package/dist/hooks/useMotion.cjs.map +1 -0
  106. package/dist/hooks/useMotion.mjs +14 -0
  107. package/dist/hooks/useMotion.mjs.map +1 -0
  108. package/dist/hooks/usePresenceGroup.cjs +2 -0
  109. package/dist/hooks/usePresenceGroup.cjs.map +1 -0
  110. package/dist/hooks/usePresenceGroup.mjs +68 -0
  111. package/dist/hooks/usePresenceGroup.mjs.map +1 -0
  112. package/dist/index.cjs +1 -1
  113. package/dist/index.d.cts +721 -131
  114. package/dist/index.d.ts +721 -131
  115. package/dist/index.mjs +136 -135
  116. package/dist/lib/classNames.cjs +1 -1
  117. package/dist/lib/classNames.cjs.map +1 -1
  118. package/dist/lib/classNames.mjs +101 -90
  119. package/dist/lib/classNames.mjs.map +1 -1
  120. package/dist/lib/motion.cjs +2 -0
  121. package/dist/lib/motion.cjs.map +1 -0
  122. package/dist/lib/motion.mjs +43 -0
  123. package/dist/lib/motion.mjs.map +1 -0
  124. package/dist/styles.css +1 -1
  125. package/package.json +2 -1
@@ -1 +1 @@
1
- {"version":3,"file":"Accordion.mjs","names":["useId","useId$1","React","AccordionContext","AccordionItemContext","AccordionPanelSlotContext","EMPTY","INERT_ACCORDION","INERT_ITEM","IN_PANEL","AccordionHeadingOutsideContext","HEADING_CLASS","useAccordionContext","reportMissingContext","component","useAccordionItemContext","warnDuplicateValue","value","toItems","AccordionRoot","openItemsProp","rest","props","multiple","type","warnDeprecated","defaultOpenItems","onOpenItemsChange","controlledSingle","openItem","controlled","initialItems","defaultOpenItem","openItems","setOpenItems","useControllable","list","next","onOpenItemChange","openCount","warnOnce","toggle","prev","v","itemCountsRef","registerItem","counts","count","remaining","baseId","context","headingLevel","cn","accordionClassNames","className","findPart","node","child","found","part","barrier","getElementType","AccordionItem","idOf","id","element","wrapsTriggerOnly","AccordionTrigger","AccordionPanel","misplacedMessage","headingLevelProp","accordion","isOpen","toggleValue","Heading","triggerElement","panelElement","parts","extra","flattenChildren","children","keyed","key","trigger","panel","accordionTriggerClassNames","hasTrigger","hasPanel","triggerIdProp","panelIdProp","hasPanelContent","extraPanelContent","itemContext","getPartId","panelSlot","accordionItemClassNames","idProp","item","inPanel","headingOutside","state","button","disabledStyles","focusRingInset","composeEventHandlers","onClick","ChevronDownIcon","slot","accordionPanelClassNames","Accordion"],"sources":["../../../src/components/layout/Accordion.tsx"],"sourcesContent":["import * as React from 'react';\nimport {\n accordionClassNames,\n accordionItemClassNames,\n accordionPanelClassNames,\n accordionTriggerClassNames,\n} from '../../lib/classNames';\nimport { flattenChildren, getElementType } from '../../lib/children';\nimport { cn } from '../../lib/cn';\nimport { composeEventHandlers } from '../../lib/composeEventHandlers';\nimport { reportMissingContext, warnDeprecated, warnOnce } from '../../lib/dev';\nimport { ChevronDownIcon } from '../../lib/icons';\nimport { disabledStyles, focusRingInset } from '../../lib/styles';\nimport type { HeadingLevel, SelectionMode } from '../../lib/types';\nimport { useControllable } from '../../hooks/useControllable';\nimport { useId } from '../../hooks/useId';\nimport { getPartId } from './disclosureIds';\n\n/** Heading level of the element that wraps each Accordion trigger: the shared {@link HeadingLevel}. */\nexport type AccordionHeadingLevel = HeadingLevel;\n\n/* ------------------------------------------------------------------ */\n/* Contexts */\n/* ------------------------------------------------------------------ */\n\ninterface AccordionContextValue {\n openItems: readonly string[];\n toggle: (value: string) => void;\n /** Counts a mounted Item's value (warns when several Items share it); returns the unregister. */\n registerItem: (value: string) => () => void;\n baseId: string;\n headingLevel: AccordionHeadingLevel;\n}\n\ninterface AccordionItemContextValue {\n value: string;\n isOpen: boolean;\n /** Id of the trigger button: the consumer `id` of the Item's Trigger, else a generated one. */\n triggerId: string;\n /** Id of the panel region: the consumer `id` of the Item's Panel, else a generated one. */\n panelId: string;\n /** Whether the Item renders a panel region while open (a Panel, or other content). */\n hasPanelContent: boolean;\n headingLevel: AccordionHeadingLevel;\n toggle: () => void;\n}\n\n/**\n * What an Accordion.Panel renders after its own children. Kept out of the item context, so a new\n * `extra` (a new array on every Item render) re-renders only the Panel.\n */\ninterface AccordionPanelSlotValue {\n /** Children of the Item that are neither Trigger nor Panel: rendered after the Panel content. */\n extra: React.ReactNode;\n /** `true` inside a Panel's content, where a Trigger or Panel is misplaced. */\n inPanel: boolean;\n}\n\nconst AccordionContext = React.createContext<AccordionContextValue | null>(null);\nconst AccordionItemContext = React.createContext<AccordionItemContextValue | null>(null);\nconst AccordionPanelSlotContext = React.createContext<AccordionPanelSlotValue | null>(null);\n\nconst EMPTY: readonly string[] = [];\n\nconst INERT_ACCORDION: AccordionContextValue = {\n openItems: EMPTY,\n toggle: () => {},\n registerItem: () => () => {},\n baseId: 'wave-accordion-inert',\n headingLevel: 3,\n};\n\nconst INERT_ITEM: AccordionItemContextValue = {\n value: '',\n isOpen: false,\n triggerId: 'wave-accordion-inert-trigger',\n panelId: 'wave-accordion-inert-panel',\n hasPanelContent: false,\n headingLevel: 3,\n toggle: () => {},\n};\n\nconst IN_PANEL: AccordionPanelSlotValue = { extra: null, inPanel: true };\n\n/**\n * `true` inside a wrapper component chain that holds only the item's Trigger (a Tooltip): the Item\n * renders the heading around the wrapper, so the Trigger renders its button without one.\n */\nconst AccordionHeadingOutsideContext = React.createContext(false);\n\n/**\n * Classes of the heading around each trigger button. `grid` stretches its child to the full row,\n * so a wrapper between the heading and the button (a Tooltip's inline-block `<span>`) does not\n * shrink the full-width button and move its chevron away from the row end.\n */\nconst HEADING_CLASS = 'm-0 grid';\n\n/**\n * C-CONTEXT: throws in development; in production logs once (`reportMissingContext`) and returns\n * the inert value.\n */\nfunction useAccordionContext(component: string): AccordionContextValue {\n const context = React.useContext(AccordionContext);\n if (context) return context;\n reportMissingContext(component, '<Accordion>');\n return INERT_ACCORDION;\n}\n\nfunction useAccordionItemContext(component: string): AccordionItemContextValue {\n const context = React.useContext(AccordionItemContext);\n if (context) return context;\n reportMissingContext(component, '<Accordion.Item>');\n return INERT_ITEM;\n}\n\nfunction warnDuplicateValue(value: string): void {\n warnOnce(\n `Accordion:duplicate:${value}`,\n `Accordion: several items share the value \"${value}\". Item values must be unique within an ` +\n 'Accordion; items with the same value open and close together and share their trigger and ' +\n 'panel ids.',\n );\n}\n\n/* ------------------------------------------------------------------ */\n/* Accordion */\n/* ------------------------------------------------------------------ */\n\n/** Props shared by {@link AccordionSingleProps} and {@link AccordionMultipleProps}. */\nexport interface AccordionBaseProps extends React.HTMLAttributes<HTMLDivElement> {\n /**\n * Level of the heading element (`<h1>`–`<h6>`) that wraps every trigger button (WAI-ARIA\n * Accordion pattern). Each `Accordion.Item` can override it.\n * @default 3\n */\n headingLevel?: AccordionHeadingLevel;\n /** Ref to the root `<div>`. */\n ref?: React.Ref<HTMLDivElement>;\n}\n\n/** Props of an Accordion in which at most one item is open (the default). */\nexport interface AccordionSingleProps extends AccordionBaseProps {\n /**\n * Whether only one or multiple items can be open at a time.\n * @default 'single'\n */\n type?: Extract<SelectionMode, 'single'>;\n /** Controlled open item (`null`: every item closed). */\n openItem?: string | null;\n /** Initially open item for uncontrolled usage. */\n defaultOpenItem?: string | null;\n /** Called with the new open item (`null` when it closed) when it changes. */\n onOpenItemChange?: (openItem: string | null) => void;\n /** @deprecated Use `openItem` (single mode); `openItems` belongs to `type=\"multiple\"`. */\n openItems?: readonly string[];\n /**\n * @deprecated Use `defaultOpenItem` (single mode); `defaultOpenItems` belongs to\n * `type=\"multiple\"`.\n */\n defaultOpenItems?: readonly string[];\n /**\n * @deprecated Use `onOpenItemChange` (single mode); `onOpenItemsChange` belongs to\n * `type=\"multiple\"`.\n */\n onOpenItemsChange?: (openItems: string[]) => void;\n}\n\n/** Props of an Accordion in which any number of items can be open. */\nexport interface AccordionMultipleProps extends AccordionBaseProps {\n /** Whether only one or multiple items can be open at a time. */\n type: Extract<SelectionMode, 'multiple'>;\n /** Controlled array of open item values (a readonly array is accepted). */\n openItems?: readonly string[];\n /**\n * Initially open items for uncontrolled usage.\n * @default []\n */\n defaultOpenItems?: readonly string[];\n /** Called with the new open items (a new array) when they change. */\n onOpenItemsChange?: (openItems: string[]) => void;\n openItem?: never;\n defaultOpenItem?: never;\n onOpenItemChange?: never;\n}\n\n/**\n * Properties for the Accordion component: a discriminated union on `type`. Single mode\n * (default) uses `openItem`/`defaultOpenItem`/`onOpenItemChange`; `type=\"multiple\"` uses\n * `openItems`/`defaultOpenItems`/`onOpenItemsChange`.\n *\n * A union cannot be extended by an `interface` (TS2312), which 0.4's interface allowed: extend\n * `AccordionSingleProps` or `AccordionMultipleProps` instead\n * (`interface MyProps extends AccordionSingleProps {}`), or intersect the union\n * (`type MyProps = AccordionProps & { … }`).\n */\nexport type AccordionProps = AccordionSingleProps | AccordionMultipleProps;\n\nfunction toItems(value: string | null | undefined): readonly string[] | undefined {\n if (value === undefined) return undefined;\n return value === null ? EMPTY : [value];\n}\n\n// The Accordion root, documented on the exported `Accordion` const.\nconst AccordionRoot = (props: AccordionProps) => {\n const {\n type,\n openItem,\n defaultOpenItem,\n onOpenItemChange,\n openItems: openItemsProp,\n defaultOpenItems,\n onOpenItemsChange,\n headingLevel = 3,\n className,\n children,\n ref,\n ...rest\n } = props as Omit<AccordionSingleProps, 'type'> & { type?: SelectionMode };\n const multiple = type === 'multiple';\n\n if (!multiple) {\n if (openItemsProp !== undefined) {\n warnDeprecated(\n 'Accordion',\n 'openItems',\n 'openItem',\n 'In single mode the Accordion takes one value.',\n );\n }\n if (defaultOpenItems !== undefined) {\n warnDeprecated(\n 'Accordion',\n 'defaultOpenItems',\n 'defaultOpenItem',\n 'In single mode the Accordion takes one value.',\n );\n }\n if (onOpenItemsChange !== undefined) {\n warnDeprecated(\n 'Accordion',\n 'onOpenItemsChange',\n 'onOpenItemChange',\n 'In single mode the Accordion reports one value.',\n );\n }\n }\n\n const controlledSingle = multiple ? undefined : openItem;\n const controlled = React.useMemo(\n () => toItems(controlledSingle) ?? openItemsProp,\n [controlledSingle, openItemsProp],\n );\n const [initialItems] = React.useState(\n () => (multiple ? undefined : toItems(defaultOpenItem)) ?? defaultOpenItems ?? EMPTY,\n );\n\n const handleChange = (next: readonly string[]) => {\n const list = [...next];\n if (!multiple) onOpenItemChange?.(list[0] ?? null);\n onOpenItemsChange?.(list);\n };\n\n const [openItems, setOpenItems] = useControllable<readonly string[]>(\n controlled,\n initialItems,\n handleChange,\n );\n\n const openCount = openItems.length;\n React.useEffect(() => {\n if (!multiple && openCount > 1) {\n warnOnce(\n 'Accordion:single-multiple-open',\n `Accordion: type=\"single\" allows one open item, but ${openCount} are open. Pass \\`openItem\\`, or use type=\"multiple\".`,\n );\n }\n }, [multiple, openCount]);\n\n const toggle = React.useCallback(\n (value: string) => {\n setOpenItems((prev) => {\n if (prev.includes(value)) return prev.filter((v) => v !== value);\n return multiple ? [...prev, value] : [value];\n });\n },\n [multiple, setOpenItems],\n );\n\n // How many mounted Items hold each value, to warn about a repeated value (C-DEV). Only the Items'\n // effects touch it (through `registerItem`), never render.\n const itemCountsRef = React.useRef<Map<string, number>>(null);\n const registerItem = React.useCallback((value: string) => {\n itemCountsRef.current ??= new Map();\n const counts = itemCountsRef.current;\n const count = (counts.get(value) ?? 0) + 1;\n counts.set(value, count);\n if (count > 1) warnDuplicateValue(value);\n return () => {\n const remaining = (counts.get(value) ?? 1) - 1;\n if (remaining > 0) counts.set(value, remaining);\n else counts.delete(value);\n };\n }, []);\n\n const baseId = useId('accordion');\n const context = React.useMemo<AccordionContextValue>(\n () => ({ openItems, toggle, registerItem, baseId, headingLevel }),\n [openItems, toggle, registerItem, baseId, headingLevel],\n );\n\n return (\n <AccordionContext.Provider value={context}>\n {/* A nested Accordion's direct children are not inside the outer Item. */}\n <AccordionItemContext.Provider value={null}>\n <AccordionPanelSlotContext.Provider value={null}>\n <AccordionHeadingOutsideContext.Provider value={false}>\n <div\n ref={ref}\n className={cn(accordionClassNames.root, 'divide-y divide-border', className)}\n {...rest}\n >\n {children}\n </div>\n </AccordionHeadingOutsideContext.Provider>\n </AccordionPanelSlotContext.Provider>\n </AccordionItemContext.Provider>\n </AccordionContext.Provider>\n );\n};\nAccordionRoot.displayName = 'Accordion';\n\n/* ------------------------------------------------------------------ */\n/* Accordion.Item */\n/* ------------------------------------------------------------------ */\n\n/** Properties for the AccordionItem sub-component. */\nexport interface AccordionItemProps extends React.HTMLAttributes<HTMLDivElement> {\n /** Unique value identifying this accordion item. */\n value: string;\n /** Heading level of this item's trigger; overrides the Accordion's `headingLevel`. */\n headingLevel?: AccordionHeadingLevel;\n /** Ref to the item `<div>`. */\n ref?: React.Ref<HTMLDivElement>;\n}\n\ninterface PartProps {\n id?: unknown;\n children?: unknown;\n}\n\n/**\n * The first `part` element in `node`: the node itself, or an element found through Fragments\n * and the `children` of wrapper elements (a Tooltip around a Trigger). The search does not enter\n * `barrier` elements or a nested Accordion/Item, and cannot see what a component renders itself.\n * Parts are identified by their unwrapped element type, so parts written in a Server Component\n * (lazy client references) are found too. A `React.lazy` still loading (content inside the\n * consumer's own `<Suspense>`) is no part and never suspends the Item: its children are searched.\n */\nfunction findPart(\n node: unknown,\n part: React.ElementType,\n barrier: React.ElementType,\n): React.ReactElement<PartProps> | undefined {\n if (Array.isArray(node)) {\n for (const child of node) {\n const found = findPart(child, part, barrier);\n if (found) return found;\n }\n return undefined;\n }\n if (!React.isValidElement<PartProps>(node)) return undefined;\n const type = getElementType(node, { suspend: false });\n if (type === part) return node;\n if (type === barrier || type === AccordionRoot || type === AccordionItem) return undefined;\n return findPart(node.props.children, part, barrier);\n}\n\n/**\n * The consumer `id` of a Trigger or Panel element, if it has one. An empty `id` counts as none,\n * here and where the Trigger and Panel render their id (`idProp || generated`).\n */\nfunction idOf(element: React.ReactElement<PartProps> | undefined): string | undefined {\n const id = element?.props.id;\n return typeof id === 'string' && id !== '' ? id : undefined;\n}\n\n/**\n * Whether `node` is a chain of wrapper components, each with the next as its only child, that ends\n * at an Accordion.Trigger: a Tooltip around the Trigger. The Item puts the heading around such a\n * chain instead of inside it, so no heading ends up in a wrapper's phrasing `<span>`. Elements\n * (`<div>`, `<span>`) render as written: the heading stays inside them.\n */\nfunction wrapsTriggerOnly(node: unknown): boolean {\n if (!React.isValidElement<PartProps>(node)) return false;\n const type = getElementType(node, { suspend: false });\n if (\n typeof type === 'string' ||\n type === AccordionTrigger ||\n type === AccordionPanel ||\n type === AccordionRoot ||\n type === AccordionItem\n ) {\n return false;\n }\n const child = node.props.children as React.ReactNode;\n return getElementType(child, { suspend: false }) === AccordionTrigger || wrapsTriggerOnly(child);\n}\n\nfunction misplacedMessage(component: 'Accordion.Trigger' | 'Accordion.Panel'): string {\n return (\n `${component} was rendered inside the panel of an Accordion.Item, so it is not the item's ` +\n `${component === 'Accordion.Trigger' ? 'header' : 'panel'}. Place Accordion.Trigger and ` +\n 'Accordion.Panel directly in Accordion.Item, in a Fragment, or in an element that wraps them ' +\n 'as `children` (such as a Tooltip). The Item cannot see inside a component that renders them ' +\n 'itself and treats that component as panel content.'\n );\n}\n\n/**\n * One section of an Accordion. Place an `Accordion.Trigger` and an `Accordion.Panel` inside it:\n * directly, in a Fragment, or in an element that wraps them as `children` (for example a Tooltip\n * around the Trigger). A component that renders a Trigger or Panel itself is not seen through: it\n * counts as panel content, and a development warning says so.\n *\n * The trigger button sits in a heading (`headingLevel`). A wrapper component whose only child is\n * the Trigger (a Tooltip, also several nested) goes inside that heading, around the button, so\n * the heading never ends up in the wrapper's inline `<span>` and the button keeps the full row.\n * An element such as a `<div>`, or a wrapper that holds more than the Trigger, renders as written,\n * with the heading inside it.\n *\n * Without a Trigger the item's `value` is the button label. Other children (plain text included)\n * are rendered in the panel, after the Panel's own content.\n */\nconst AccordionItem = ({\n value,\n headingLevel: headingLevelProp,\n className,\n children,\n ref,\n ...rest\n}: AccordionItemProps) => {\n const accordion = useAccordionContext('Accordion.Item');\n const isOpen = accordion.openItems.includes(value);\n const { toggle: toggleValue, baseId, registerItem } = accordion;\n React.useEffect(() => registerItem(value), [registerItem, value]);\n const headingLevel = headingLevelProp ?? accordion.headingLevel;\n const Heading: `h${AccordionHeadingLevel}` = `h${headingLevel}`;\n\n let triggerElement: React.ReactElement<PartProps> | undefined;\n let panelElement: React.ReactElement<PartProps> | undefined;\n const parts: React.ReactNode[] = [];\n const extra: React.ReactNode[] = [];\n for (const { key, node: child } of flattenChildren(children)) {\n const keyed = <React.Fragment key={key}>{child}</React.Fragment>;\n const trigger = findPart(child, AccordionTrigger, AccordionPanel);\n const panel = findPart(child, AccordionPanel, AccordionTrigger);\n if (trigger || panel) {\n triggerElement ??= trigger;\n panelElement ??= panel;\n parts.push(\n wrapsTriggerOnly(child) ? (\n <Heading key={key} className={cn(accordionTriggerClassNames.heading, HEADING_CLASS)}>\n <AccordionHeadingOutsideContext.Provider value={true}>\n {child}\n </AccordionHeadingOutsideContext.Provider>\n </Heading>\n ) : (\n keyed\n ),\n );\n } else {\n extra.push(keyed);\n }\n }\n const hasTrigger = triggerElement !== undefined;\n const hasPanel = panelElement !== undefined;\n const triggerIdProp = idOf(triggerElement);\n const panelIdProp = idOf(panelElement);\n const hasPanelContent = hasPanel || extra.length > 0;\n const extraPanelContent = hasPanel && extra.length > 0 ? extra : null;\n\n const itemContext = React.useMemo<AccordionItemContextValue>(\n () => ({\n value,\n isOpen,\n triggerId: triggerIdProp ?? getPartId(baseId, 'trigger', value),\n panelId: panelIdProp ?? getPartId(baseId, 'panel', value),\n hasPanelContent,\n headingLevel,\n toggle: () => toggleValue(value),\n }),\n [value, isOpen, baseId, triggerIdProp, panelIdProp, hasPanelContent, headingLevel, toggleValue],\n );\n const panelSlot = React.useMemo<AccordionPanelSlotValue>(\n () => ({ extra: extraPanelContent, inPanel: false }),\n [extraPanelContent],\n );\n\n return (\n <AccordionItemContext.Provider value={itemContext}>\n <AccordionPanelSlotContext.Provider value={panelSlot}>\n <div\n ref={ref}\n data-state={isOpen ? 'open' : 'closed'}\n className={cn(accordionItemClassNames.root, className)}\n {...rest}\n >\n {hasTrigger ? null : <AccordionTrigger>{value}</AccordionTrigger>}\n {parts}\n {!hasPanel && extra.length > 0 ? <AccordionPanel>{extra}</AccordionPanel> : null}\n </div>\n </AccordionPanelSlotContext.Provider>\n </AccordionItemContext.Provider>\n );\n};\nAccordionItem.displayName = 'AccordionItem';\n\n/* ------------------------------------------------------------------ */\n/* Accordion.Trigger */\n/* ------------------------------------------------------------------ */\n\n/** Properties for the AccordionTrigger sub-component (merged onto the trigger `<button>`). */\nexport interface AccordionTriggerProps extends React.ButtonHTMLAttributes<HTMLButtonElement> {\n /** Ref to the trigger `<button>`. */\n ref?: React.Ref<HTMLButtonElement>;\n}\n\n/**\n * The button that opens and closes its Accordion.Item, wrapped in a heading (`headingLevel`); when\n * it is the only child of a wrapper component in the Item (a Tooltip), the heading goes around\n * that wrapper instead (see `Accordion.Item`). Its props land on the `<button>`: `className` is\n * merged (yours wins), `onClick` runs before the toggle (call `event.preventDefault()` to keep the\n * item as it is), `ref` receives the button, and a non-empty `id` replaces the generated one (the\n * panel's `aria-labelledby` follows it).\n */\nconst AccordionTrigger = ({\n id: idProp,\n className,\n children,\n onClick,\n ref,\n ...rest\n}: AccordionTriggerProps) => {\n const item = useAccordionItemContext('Accordion.Trigger');\n const inPanel = React.useContext(AccordionPanelSlotContext)?.inPanel ?? false;\n React.useEffect(() => {\n if (inPanel) {\n warnOnce('Accordion.Trigger:inside-panel', misplacedMessage('Accordion.Trigger'));\n }\n }, [inPanel]);\n const headingOutside = React.useContext(AccordionHeadingOutsideContext);\n const Heading: `h${AccordionHeadingLevel}` = `h${item.headingLevel}`;\n const state = item.isOpen ? 'open' : 'closed';\n\n const button = (\n <button\n type=\"button\"\n className={cn(\n accordionTriggerClassNames.root,\n 'flex w-full items-center justify-between gap-2 px-4 py-3 text-start text-body-1 font-semibold text-foreground',\n 'not-disabled:not-aria-disabled:hover:bg-subtle-hover not-disabled:not-aria-disabled:active:bg-subtle-pressed',\n disabledStyles,\n focusRingInset,\n className,\n )}\n {...rest}\n // A misplaced Trigger (inside the panel) still toggles, but only the item's own trigger\n // carries the item's id and panel reference.\n id={idProp || (inPanel ? undefined : item.triggerId)}\n // Only a panel region the item renders is referenced (none without panel content).\n aria-controls={!inPanel && item.hasPanelContent ? item.panelId : undefined}\n aria-expanded={item.isOpen}\n data-state={state}\n onClick={composeEventHandlers(onClick, item.toggle)}\n ref={ref}\n >\n {children}\n <ChevronDownIcon\n size={16}\n className={cn(\n accordionTriggerClassNames.expandIcon,\n 'shrink-0 transition-transform motion-reduce:transition-none',\n item.isOpen && 'rotate-180',\n )}\n />\n </button>\n );\n // Inside a wrapper chain (a Tooltip) the Item has rendered the heading around the wrapper.\n return headingOutside ? (\n button\n ) : (\n <Heading className={cn(accordionTriggerClassNames.heading, HEADING_CLASS)}>{button}</Heading>\n );\n};\nAccordionTrigger.displayName = 'AccordionTrigger';\n\n/* ------------------------------------------------------------------ */\n/* Accordion.Panel */\n/* ------------------------------------------------------------------ */\n\n/** Properties for the AccordionPanel sub-component (merged onto the `role=\"region\"` element). */\nexport interface AccordionPanelProps extends React.HTMLAttributes<HTMLDivElement> {\n /** Ref to the panel `<div role=\"region\">`. */\n ref?: React.Ref<HTMLDivElement>;\n}\n\n/**\n * The content region of an Accordion.Item, rendered only while the item is open and labelled by\n * its trigger. Its props (className merged, `ref`, `data-*`, handlers) land on the region, and a\n * non-empty `id` replaces the generated one (the trigger's `aria-controls` follows it).\n */\nconst AccordionPanel = ({ id: idProp, className, children, ref, ...rest }: AccordionPanelProps) => {\n const item = useAccordionItemContext('Accordion.Panel');\n const slot = React.useContext(AccordionPanelSlotContext);\n const inPanel = slot?.inPanel ?? false;\n React.useEffect(() => {\n if (inPanel) warnOnce('Accordion.Panel:inside-panel', misplacedMessage('Accordion.Panel'));\n }, [inPanel]);\n if (!item.isOpen) return null;\n if (inPanel) {\n // Misplaced: its content joins the enclosing region (one region and one panel id per item).\n return (\n <div\n className={cn(accordionPanelClassNames.root, className)}\n {...rest}\n id={idProp || undefined}\n ref={ref}\n >\n {children}\n </div>\n );\n }\n return (\n <AccordionPanelSlotContext.Provider value={IN_PANEL}>\n <div\n role=\"region\"\n className={cn(\n accordionPanelClassNames.root,\n 'px-4 pb-3 text-body-1 text-muted-foreground',\n className,\n )}\n {...rest}\n id={idProp || item.panelId}\n aria-labelledby={item.triggerId}\n data-state=\"open\"\n ref={ref}\n >\n {children}\n {slot?.extra}\n </div>\n </AccordionPanelSlotContext.Provider>\n );\n};\nAccordionPanel.displayName = 'AccordionPanel';\n\n/* ------------------------------------------------------------------ */\n/* Export */\n/* ------------------------------------------------------------------ */\n\n/**\n * A vertically stacked set of disclosure sections (WAI-ARIA Accordion pattern). Each\n * `Accordion.Item` renders an `Accordion.Trigger` button inside a heading (`headingLevel`) and an\n * `Accordion.Panel` region that is shown while the item is open.\n *\n * Single mode (the default) keeps at most one item open (`openItem`, `defaultOpenItem`,\n * `onOpenItemChange`); `type=\"multiple\"` lets any number of items open (`openItems`,\n * `defaultOpenItems`, `onOpenItemsChange`). Each Item's `value` must be unique within its\n * Accordion: a development warning names a repeated value.\n *\n * Sub-components are also exported under flat names (`AccordionItem`, `AccordionTrigger`,\n * `AccordionPanel`) for React Server Components, which cannot use the dotted form.\n */\nexport const Accordion = /* @__PURE__ */ Object.assign(AccordionRoot, {\n Item: AccordionItem,\n Trigger: AccordionTrigger,\n Panel: AccordionPanel,\n});\n\nexport { AccordionItem, AccordionTrigger, AccordionPanel };\n"],"mappings":";;;;;;;;;;;;;;AA0DA,IAAMG,IAAmBD,EAAM,cAA4C,IAAI,GACzEE,IAAuBF,EAAM,cAAgD,IAAI,GACjFG,IAA4BH,EAAM,cAA8C,IAAI,GAEpFI,IAA2B,CAAC,GAE5BC,IAAyC;CAC7C,WAAWD;CACX,cAAc,CAAC;CACf,0BAA0B,CAAC;CAC3B,QAAQ;CACR,cAAc;AAChB,GA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CACT,OAAOC;AACT,CAAC"}
1
+ {"version":3,"file":"Accordion.mjs","names":["useId","useId$1","React","AccordionContext","AccordionItemContext","AccordionPanelSlotContext","EMPTY","INERT_ACCORDION","INERT_ITEM","IN_PANEL","AccordionHeadingOutsideContext","HEADING_CLASS","useAccordionContext","reportMissingContext","component","useAccordionItemContext","warnDuplicateValue","value","toItems","AccordionRoot","openItemsProp","rest","props","multiple","type","warnDeprecated","defaultOpenItems","onOpenItemsChange","controlledSingle","openItem","controlled","initialItems","defaultOpenItem","openItems","setOpenItems","useControllable","list","next","onOpenItemChange","openCount","warnOnce","toggle","prev","v","itemCountsRef","registerItem","counts","count","remaining","baseId","context","headingLevel","cn","accordionClassNames","className","findPart","node","child","found","part","barrier","getElementType","AccordionItem","idOf","id","element","wrapsTriggerOnly","AccordionTrigger","AccordionPanel","misplacedMessage","headingLevelProp","accordion","isOpen","toggleValue","Heading","triggerElement","panelElement","parts","extra","flattenChildren","children","keyed","key","trigger","panel","accordionTriggerClassNames","hasTrigger","hasPanel","triggerIdProp","panelIdProp","hasPanelContent","extraPanelContent","itemContext","getPartId","panelSlot","accordionItemClassNames","idProp","item","inPanel","headingOutside","state","button","disabledStyles","focusRingInset","composeEventHandlers","onClick","ChevronDownIcon","slot","regionRef","documentRef","attachRegion","mergedRegionRef","useMergedRefs","ref","collapseClassName","useCollapsePresence","triggerId","accordionPanelClassNames","isMounted","wrapperRef","presenceProps","Accordion"],"sources":["../../../src/components/layout/Accordion.tsx"],"sourcesContent":["import * as React from 'react';\nimport {\n accordionClassNames,\n accordionItemClassNames,\n accordionPanelClassNames,\n accordionTriggerClassNames,\n} from '../../lib/classNames';\nimport { flattenChildren, getElementType } from '../../lib/children';\nimport { cn } from '../../lib/cn';\nimport { composeEventHandlers } from '../../lib/composeEventHandlers';\nimport { reportMissingContext, warnDeprecated, warnOnce } from '../../lib/dev';\nimport { ChevronDownIcon } from '../../lib/icons';\nimport { disabledStyles, focusRingInset } from '../../lib/styles';\nimport type { HeadingLevel, MotionSlot, SelectionMode } from '../../lib/types';\nimport { useCollapsePresence } from '../../hooks/useCollapsePresence';\nimport { useControllable } from '../../hooks/useControllable';\nimport { useId } from '../../hooks/useId';\nimport { useMergedRefs } from '../../hooks/useMergedRefs';\nimport { getPartId } from './disclosureIds';\n\n/** Heading level of the element that wraps each Accordion trigger: the shared {@link HeadingLevel}. */\nexport type AccordionHeadingLevel = HeadingLevel;\n\n/* ------------------------------------------------------------------ */\n/* Contexts */\n/* ------------------------------------------------------------------ */\n\ninterface AccordionContextValue {\n openItems: readonly string[];\n toggle: (value: string) => void;\n /** Counts a mounted Item's value (warns when several Items share it); returns the unregister. */\n registerItem: (value: string) => () => void;\n baseId: string;\n headingLevel: AccordionHeadingLevel;\n}\n\ninterface AccordionItemContextValue {\n value: string;\n isOpen: boolean;\n /** Id of the trigger button: the consumer `id` of the Item's Trigger, else a generated one. */\n triggerId: string;\n /** Id of the panel region: the consumer `id` of the Item's Panel, else a generated one. */\n panelId: string;\n /** Whether the Item renders a panel region while open (a Panel, or other content). */\n hasPanelContent: boolean;\n headingLevel: AccordionHeadingLevel;\n toggle: () => void;\n}\n\n/**\n * What an Accordion.Panel renders after its own children. Kept out of the item context, so a new\n * `extra` (a new array on every Item render) re-renders only the Panel.\n */\ninterface AccordionPanelSlotValue {\n /** Children of the Item that are neither Trigger nor Panel: rendered after the Panel content. */\n extra: React.ReactNode;\n /** `true` inside a Panel's content, where a Trigger or Panel is misplaced. */\n inPanel: boolean;\n}\n\nconst AccordionContext = React.createContext<AccordionContextValue | null>(null);\nconst AccordionItemContext = React.createContext<AccordionItemContextValue | null>(null);\nconst AccordionPanelSlotContext = React.createContext<AccordionPanelSlotValue | null>(null);\n\nconst EMPTY: readonly string[] = [];\n\nconst INERT_ACCORDION: AccordionContextValue = {\n openItems: EMPTY,\n toggle: () => {},\n registerItem: () => () => {},\n baseId: 'wave-accordion-inert',\n headingLevel: 3,\n};\n\nconst INERT_ITEM: AccordionItemContextValue = {\n value: '',\n isOpen: false,\n triggerId: 'wave-accordion-inert-trigger',\n panelId: 'wave-accordion-inert-panel',\n hasPanelContent: false,\n headingLevel: 3,\n toggle: () => {},\n};\n\nconst IN_PANEL: AccordionPanelSlotValue = { extra: null, inPanel: true };\n\n/**\n * `true` inside a wrapper component chain that holds only the item's Trigger (a Tooltip): the Item\n * renders the heading around the wrapper, so the Trigger renders its button without one.\n */\nconst AccordionHeadingOutsideContext = React.createContext(false);\n\n/**\n * Classes of the heading around each trigger button. `grid` stretches its child to the full row,\n * so a wrapper between the heading and the button (a Tooltip's inline-block `<span>`) does not\n * shrink the full-width button and move its chevron away from the row end.\n */\nconst HEADING_CLASS = 'm-0 grid';\n\n/**\n * C-CONTEXT: throws in development; in production logs once (`reportMissingContext`) and returns\n * the inert value.\n */\nfunction useAccordionContext(component: string): AccordionContextValue {\n const context = React.useContext(AccordionContext);\n if (context) return context;\n reportMissingContext(component, '<Accordion>');\n return INERT_ACCORDION;\n}\n\nfunction useAccordionItemContext(component: string): AccordionItemContextValue {\n const context = React.useContext(AccordionItemContext);\n if (context) return context;\n reportMissingContext(component, '<Accordion.Item>');\n return INERT_ITEM;\n}\n\nfunction warnDuplicateValue(value: string): void {\n warnOnce(\n `Accordion:duplicate:${value}`,\n `Accordion: several items share the value \"${value}\". Item values must be unique within an ` +\n 'Accordion; items with the same value open and close together and share their trigger and ' +\n 'panel ids.',\n );\n}\n\n/* ------------------------------------------------------------------ */\n/* Accordion */\n/* ------------------------------------------------------------------ */\n\n/** Props shared by {@link AccordionSingleProps} and {@link AccordionMultipleProps}. */\nexport interface AccordionBaseProps extends React.HTMLAttributes<HTMLDivElement> {\n /**\n * Level of the heading element (`<h1>`–`<h6>`) that wraps every trigger button (WAI-ARIA\n * Accordion pattern). Each `Accordion.Item` can override it.\n * @default 3\n */\n headingLevel?: AccordionHeadingLevel;\n /** Ref to the root `<div>`. */\n ref?: React.Ref<HTMLDivElement>;\n}\n\n/** Props of an Accordion in which at most one item is open (the default). */\nexport interface AccordionSingleProps extends AccordionBaseProps {\n /**\n * Whether only one or multiple items can be open at a time.\n * @default 'single'\n */\n type?: Extract<SelectionMode, 'single'>;\n /** Controlled open item (`null`: every item closed). */\n openItem?: string | null;\n /** Initially open item for uncontrolled usage. */\n defaultOpenItem?: string | null;\n /** Called with the new open item (`null` when it closed) when it changes. */\n onOpenItemChange?: (openItem: string | null) => void;\n /** @deprecated Use `openItem` (single mode); `openItems` belongs to `type=\"multiple\"`. */\n openItems?: readonly string[];\n /**\n * @deprecated Use `defaultOpenItem` (single mode); `defaultOpenItems` belongs to\n * `type=\"multiple\"`.\n */\n defaultOpenItems?: readonly string[];\n /**\n * @deprecated Use `onOpenItemChange` (single mode); `onOpenItemsChange` belongs to\n * `type=\"multiple\"`.\n */\n onOpenItemsChange?: (openItems: string[]) => void;\n}\n\n/** Props of an Accordion in which any number of items can be open. */\nexport interface AccordionMultipleProps extends AccordionBaseProps {\n /** Whether only one or multiple items can be open at a time. */\n type: Extract<SelectionMode, 'multiple'>;\n /** Controlled array of open item values (a readonly array is accepted). */\n openItems?: readonly string[];\n /**\n * Initially open items for uncontrolled usage.\n * @default []\n */\n defaultOpenItems?: readonly string[];\n /** Called with the new open items (a new array) when they change. */\n onOpenItemsChange?: (openItems: string[]) => void;\n openItem?: never;\n defaultOpenItem?: never;\n onOpenItemChange?: never;\n}\n\n/**\n * Properties for the Accordion component: a discriminated union on `type`. Single mode\n * (default) uses `openItem`/`defaultOpenItem`/`onOpenItemChange`; `type=\"multiple\"` uses\n * `openItems`/`defaultOpenItems`/`onOpenItemsChange`.\n *\n * A union cannot be extended by an `interface` (TS2312), which 0.4's interface allowed: extend\n * `AccordionSingleProps` or `AccordionMultipleProps` instead\n * (`interface MyProps extends AccordionSingleProps {}`), or intersect the union\n * (`type MyProps = AccordionProps & { … }`).\n */\nexport type AccordionProps = AccordionSingleProps | AccordionMultipleProps;\n\nfunction toItems(value: string | null | undefined): readonly string[] | undefined {\n if (value === undefined) return undefined;\n return value === null ? EMPTY : [value];\n}\n\n// The Accordion root, documented on the exported `Accordion` const.\nconst AccordionRoot = (props: AccordionProps) => {\n const {\n type,\n openItem,\n defaultOpenItem,\n onOpenItemChange,\n openItems: openItemsProp,\n defaultOpenItems,\n onOpenItemsChange,\n headingLevel = 3,\n className,\n children,\n ref,\n ...rest\n } = props as Omit<AccordionSingleProps, 'type'> & { type?: SelectionMode };\n const multiple = type === 'multiple';\n\n if (!multiple) {\n if (openItemsProp !== undefined) {\n warnDeprecated(\n 'Accordion',\n 'openItems',\n 'openItem',\n 'In single mode the Accordion takes one value.',\n );\n }\n if (defaultOpenItems !== undefined) {\n warnDeprecated(\n 'Accordion',\n 'defaultOpenItems',\n 'defaultOpenItem',\n 'In single mode the Accordion takes one value.',\n );\n }\n if (onOpenItemsChange !== undefined) {\n warnDeprecated(\n 'Accordion',\n 'onOpenItemsChange',\n 'onOpenItemChange',\n 'In single mode the Accordion reports one value.',\n );\n }\n }\n\n const controlledSingle = multiple ? undefined : openItem;\n const controlled = React.useMemo(\n () => toItems(controlledSingle) ?? openItemsProp,\n [controlledSingle, openItemsProp],\n );\n const [initialItems] = React.useState(\n () => (multiple ? undefined : toItems(defaultOpenItem)) ?? defaultOpenItems ?? EMPTY,\n );\n\n const handleChange = (next: readonly string[]) => {\n const list = [...next];\n if (!multiple) onOpenItemChange?.(list[0] ?? null);\n onOpenItemsChange?.(list);\n };\n\n const [openItems, setOpenItems] = useControllable<readonly string[]>(\n controlled,\n initialItems,\n handleChange,\n );\n\n const openCount = openItems.length;\n React.useEffect(() => {\n if (!multiple && openCount > 1) {\n warnOnce(\n 'Accordion:single-multiple-open',\n `Accordion: type=\"single\" allows one open item, but ${openCount} are open. Pass \\`openItem\\`, or use type=\"multiple\".`,\n );\n }\n }, [multiple, openCount]);\n\n const toggle = React.useCallback(\n (value: string) => {\n setOpenItems((prev) => {\n if (prev.includes(value)) return prev.filter((v) => v !== value);\n return multiple ? [...prev, value] : [value];\n });\n },\n [multiple, setOpenItems],\n );\n\n // How many mounted Items hold each value, to warn about a repeated value (C-DEV). Only the Items'\n // effects touch it (through `registerItem`), never render.\n const itemCountsRef = React.useRef<Map<string, number>>(null);\n const registerItem = React.useCallback((value: string) => {\n itemCountsRef.current ??= new Map();\n const counts = itemCountsRef.current;\n const count = (counts.get(value) ?? 0) + 1;\n counts.set(value, count);\n if (count > 1) warnDuplicateValue(value);\n return () => {\n const remaining = (counts.get(value) ?? 1) - 1;\n if (remaining > 0) counts.set(value, remaining);\n else counts.delete(value);\n };\n }, []);\n\n const baseId = useId('accordion');\n const context = React.useMemo<AccordionContextValue>(\n () => ({ openItems, toggle, registerItem, baseId, headingLevel }),\n [openItems, toggle, registerItem, baseId, headingLevel],\n );\n\n return (\n <AccordionContext.Provider value={context}>\n {/* A nested Accordion's direct children are not inside the outer Item. */}\n <AccordionItemContext.Provider value={null}>\n <AccordionPanelSlotContext.Provider value={null}>\n <AccordionHeadingOutsideContext.Provider value={false}>\n <div\n ref={ref}\n className={cn(accordionClassNames.root, 'divide-y divide-border', className)}\n {...rest}\n >\n {children}\n </div>\n </AccordionHeadingOutsideContext.Provider>\n </AccordionPanelSlotContext.Provider>\n </AccordionItemContext.Provider>\n </AccordionContext.Provider>\n );\n};\nAccordionRoot.displayName = 'Accordion';\n\n/* ------------------------------------------------------------------ */\n/* Accordion.Item */\n/* ------------------------------------------------------------------ */\n\n/** Properties for the AccordionItem sub-component. */\nexport interface AccordionItemProps extends React.HTMLAttributes<HTMLDivElement> {\n /** Unique value identifying this accordion item. */\n value: string;\n /** Heading level of this item's trigger; overrides the Accordion's `headingLevel`. */\n headingLevel?: AccordionHeadingLevel;\n /** Ref to the item `<div>`. */\n ref?: React.Ref<HTMLDivElement>;\n}\n\ninterface PartProps {\n id?: unknown;\n children?: unknown;\n}\n\n/**\n * The first `part` element in `node`: the node itself, or an element found through Fragments\n * and the `children` of wrapper elements (a Tooltip around a Trigger). The search does not enter\n * `barrier` elements or a nested Accordion/Item, and cannot see what a component renders itself.\n * Parts are identified by their unwrapped element type, so parts written in a Server Component\n * (lazy client references) are found too. A `React.lazy` still loading (content inside the\n * consumer's own `<Suspense>`) is no part and never suspends the Item: its children are searched.\n */\nfunction findPart(\n node: unknown,\n part: React.ElementType,\n barrier: React.ElementType,\n): React.ReactElement<PartProps> | undefined {\n if (Array.isArray(node)) {\n for (const child of node) {\n const found = findPart(child, part, barrier);\n if (found) return found;\n }\n return undefined;\n }\n if (!React.isValidElement<PartProps>(node)) return undefined;\n const type = getElementType(node, { suspend: false });\n if (type === part) return node;\n if (type === barrier || type === AccordionRoot || type === AccordionItem) return undefined;\n return findPart(node.props.children, part, barrier);\n}\n\n/**\n * The consumer `id` of a Trigger or Panel element, if it has one. An empty `id` counts as none,\n * here and where the Trigger and Panel render their id (`idProp || generated`).\n */\nfunction idOf(element: React.ReactElement<PartProps> | undefined): string | undefined {\n const id = element?.props.id;\n return typeof id === 'string' && id !== '' ? id : undefined;\n}\n\n/**\n * Whether `node` is a chain of wrapper components, each with the next as its only child, that ends\n * at an Accordion.Trigger: a Tooltip around the Trigger. The Item puts the heading around such a\n * chain instead of inside it, so no heading ends up in a wrapper's phrasing `<span>`. Elements\n * (`<div>`, `<span>`) render as written: the heading stays inside them.\n */\nfunction wrapsTriggerOnly(node: unknown): boolean {\n if (!React.isValidElement<PartProps>(node)) return false;\n const type = getElementType(node, { suspend: false });\n if (\n typeof type === 'string' ||\n type === AccordionTrigger ||\n type === AccordionPanel ||\n type === AccordionRoot ||\n type === AccordionItem\n ) {\n return false;\n }\n const child = node.props.children as React.ReactNode;\n return getElementType(child, { suspend: false }) === AccordionTrigger || wrapsTriggerOnly(child);\n}\n\nfunction misplacedMessage(component: 'Accordion.Trigger' | 'Accordion.Panel'): string {\n return (\n `${component} was rendered inside the panel of an Accordion.Item, so it is not the item's ` +\n `${component === 'Accordion.Trigger' ? 'header' : 'panel'}. Place Accordion.Trigger and ` +\n 'Accordion.Panel directly in Accordion.Item, in a Fragment, or in an element that wraps them ' +\n 'as `children` (such as a Tooltip). The Item cannot see inside a component that renders them ' +\n 'itself and treats that component as panel content.'\n );\n}\n\n/**\n * One section of an Accordion. Place an `Accordion.Trigger` and an `Accordion.Panel` inside it:\n * directly, in a Fragment, or in an element that wraps them as `children` (for example a Tooltip\n * around the Trigger). A component that renders a Trigger or Panel itself is not seen through: it\n * counts as panel content, and a development warning says so.\n *\n * The trigger button sits in a heading (`headingLevel`). A wrapper component whose only child is\n * the Trigger (a Tooltip, also several nested) goes inside that heading, around the button, so\n * the heading never ends up in the wrapper's inline `<span>` and the button keeps the full row.\n * An element such as a `<div>`, or a wrapper that holds more than the Trigger, renders as written,\n * with the heading inside it.\n *\n * Without a Trigger the item's `value` is the button label. Other children (plain text included)\n * are rendered in the panel, after the Panel's own content.\n */\nconst AccordionItem = ({\n value,\n headingLevel: headingLevelProp,\n className,\n children,\n ref,\n ...rest\n}: AccordionItemProps) => {\n const accordion = useAccordionContext('Accordion.Item');\n const isOpen = accordion.openItems.includes(value);\n const { toggle: toggleValue, baseId, registerItem } = accordion;\n React.useEffect(() => registerItem(value), [registerItem, value]);\n const headingLevel = headingLevelProp ?? accordion.headingLevel;\n const Heading: `h${AccordionHeadingLevel}` = `h${headingLevel}`;\n\n let triggerElement: React.ReactElement<PartProps> | undefined;\n let panelElement: React.ReactElement<PartProps> | undefined;\n const parts: React.ReactNode[] = [];\n const extra: React.ReactNode[] = [];\n for (const { key, node: child } of flattenChildren(children)) {\n const keyed = <React.Fragment key={key}>{child}</React.Fragment>;\n const trigger = findPart(child, AccordionTrigger, AccordionPanel);\n const panel = findPart(child, AccordionPanel, AccordionTrigger);\n if (trigger || panel) {\n triggerElement ??= trigger;\n panelElement ??= panel;\n parts.push(\n wrapsTriggerOnly(child) ? (\n <Heading key={key} className={cn(accordionTriggerClassNames.heading, HEADING_CLASS)}>\n <AccordionHeadingOutsideContext.Provider value={true}>\n {child}\n </AccordionHeadingOutsideContext.Provider>\n </Heading>\n ) : (\n keyed\n ),\n );\n } else {\n extra.push(keyed);\n }\n }\n const hasTrigger = triggerElement !== undefined;\n const hasPanel = panelElement !== undefined;\n const triggerIdProp = idOf(triggerElement);\n const panelIdProp = idOf(panelElement);\n const hasPanelContent = hasPanel || extra.length > 0;\n const extraPanelContent = hasPanel && extra.length > 0 ? extra : null;\n\n const itemContext = React.useMemo<AccordionItemContextValue>(\n () => ({\n value,\n isOpen,\n triggerId: triggerIdProp ?? getPartId(baseId, 'trigger', value),\n panelId: panelIdProp ?? getPartId(baseId, 'panel', value),\n hasPanelContent,\n headingLevel,\n toggle: () => toggleValue(value),\n }),\n [value, isOpen, baseId, triggerIdProp, panelIdProp, hasPanelContent, headingLevel, toggleValue],\n );\n const panelSlot = React.useMemo<AccordionPanelSlotValue>(\n () => ({ extra: extraPanelContent, inPanel: false }),\n [extraPanelContent],\n );\n\n return (\n <AccordionItemContext.Provider value={itemContext}>\n <AccordionPanelSlotContext.Provider value={panelSlot}>\n <div\n ref={ref}\n data-state={isOpen ? 'open' : 'closed'}\n className={cn(accordionItemClassNames.root, className)}\n {...rest}\n >\n {hasTrigger ? null : <AccordionTrigger>{value}</AccordionTrigger>}\n {parts}\n {!hasPanel && extra.length > 0 ? <AccordionPanel>{extra}</AccordionPanel> : null}\n </div>\n </AccordionPanelSlotContext.Provider>\n </AccordionItemContext.Provider>\n );\n};\nAccordionItem.displayName = 'AccordionItem';\n\n/* ------------------------------------------------------------------ */\n/* Accordion.Trigger */\n/* ------------------------------------------------------------------ */\n\n/** Properties for the AccordionTrigger sub-component (merged onto the trigger `<button>`). */\nexport interface AccordionTriggerProps extends React.ButtonHTMLAttributes<HTMLButtonElement> {\n /** Ref to the trigger `<button>`. */\n ref?: React.Ref<HTMLButtonElement>;\n}\n\n/**\n * The button that opens and closes its Accordion.Item, wrapped in a heading (`headingLevel`); when\n * it is the only child of a wrapper component in the Item (a Tooltip), the heading goes around\n * that wrapper instead (see `Accordion.Item`). Its props land on the `<button>`: `className` is\n * merged (yours wins), `onClick` runs before the toggle (call `event.preventDefault()` to keep the\n * item as it is), `ref` receives the button, and a non-empty `id` replaces the generated one (the\n * panel's `aria-labelledby` follows it).\n */\nconst AccordionTrigger = ({\n id: idProp,\n className,\n children,\n onClick,\n ref,\n ...rest\n}: AccordionTriggerProps) => {\n const item = useAccordionItemContext('Accordion.Trigger');\n const inPanel = React.useContext(AccordionPanelSlotContext)?.inPanel ?? false;\n React.useEffect(() => {\n if (inPanel) {\n warnOnce('Accordion.Trigger:inside-panel', misplacedMessage('Accordion.Trigger'));\n }\n }, [inPanel]);\n const headingOutside = React.useContext(AccordionHeadingOutsideContext);\n const Heading: `h${AccordionHeadingLevel}` = `h${item.headingLevel}`;\n const state = item.isOpen ? 'open' : 'closed';\n\n const button = (\n <button\n type=\"button\"\n className={cn(\n accordionTriggerClassNames.root,\n 'flex w-full items-center justify-between gap-2 px-4 py-3 text-start text-body-1 font-semibold text-foreground',\n 'not-disabled:not-aria-disabled:hover:bg-subtle-hover not-disabled:not-aria-disabled:active:bg-subtle-pressed',\n disabledStyles,\n focusRingInset,\n className,\n )}\n {...rest}\n // A misplaced Trigger (inside the panel) still toggles, but only the item's own trigger\n // carries the item's id and panel reference.\n id={idProp || (inPanel ? undefined : item.triggerId)}\n // Only a panel region the item renders is referenced (none without panel content).\n aria-controls={!inPanel && item.hasPanelContent ? item.panelId : undefined}\n aria-expanded={item.isOpen}\n data-state={state}\n onClick={composeEventHandlers(onClick, item.toggle)}\n ref={ref}\n >\n {children}\n <ChevronDownIcon\n size={16}\n className={cn(\n accordionTriggerClassNames.expandIcon,\n 'shrink-0 transition-transform motion-reduce:transition-none',\n item.isOpen && 'rotate-180',\n )}\n />\n </button>\n );\n // Inside a wrapper chain (a Tooltip) the Item has rendered the heading around the wrapper.\n return headingOutside ? (\n button\n ) : (\n <Heading className={cn(accordionTriggerClassNames.heading, HEADING_CLASS)}>{button}</Heading>\n );\n};\nAccordionTrigger.displayName = 'AccordionTrigger';\n\n/* ------------------------------------------------------------------ */\n/* Accordion.Panel */\n/* ------------------------------------------------------------------ */\n\n/** Properties for the AccordionPanel sub-component (merged onto the `role=\"region\"` element). */\nexport interface AccordionPanelProps extends React.HTMLAttributes<HTMLDivElement> {\n /**\n * Replaces the panel's collapse (Fluent's `AccordionPanel collapseMotion`), on the element\n * around the region: by default the space the region takes opens from nothing and closes back\n * to it, with a fade, over the normal duration (200 ms) with the max easy-ease curve, both ways.\n * `null` turns it off (the region appears and disappears at once); a class string or\n * `{ className }` replaces it, written as `MotionSlot` describes. A `WaveProvider` with\n * `motion=\"none\"` turns the default off, and a value here still applies under it. A panel\n * rendered inside another panel has no motion of its own.\n * @default the collapse described above\n */\n motion?: MotionSlot | null;\n /** Ref to the panel `<div role=\"region\">`. */\n ref?: React.Ref<HTMLDivElement>;\n}\n\n/**\n * The content region of an Accordion.Item, labelled by its trigger and rendered while the item is\n * open and while it collapses after a close. Its props (className merged, `ref`, `data-*`,\n * handlers) land on the region, and a non-empty `id` replaces the generated one (the trigger's\n * `aria-controls` follows it).\n *\n * The region renders as the only child of a collapse element (its stable class\n * `wave-accordion-panel__collapse`), which opens and closes the region's space (`motion`) and has\n * no box of its own while the item is open, so the region lays out in the Item as before. An item\n * opened by default appears without motion. After a close the region stays in the document until\n * the collapse ends, `inert` and with `data-state=\"closed\"`, while its trigger already reports the\n * item collapsed; opening the item again during the collapse keeps the same region and the state\n * of its content. Focus inside the region when the item closes moves to the item's trigger.\n */\nconst AccordionPanel = ({\n id: idProp,\n className,\n children,\n motion,\n ref,\n ...rest\n}: AccordionPanelProps) => {\n const item = useAccordionItemContext('Accordion.Panel');\n const slot = React.useContext(AccordionPanelSlotContext);\n const inPanel = slot?.inPanel ?? false;\n React.useEffect(() => {\n if (inPanel) warnOnce('Accordion.Panel:inside-panel', misplacedMessage('Accordion.Panel'));\n }, [inPanel]);\n\n // The region, and its document for the trigger lookup (kept after the region unmounts, so an\n // item's panel removed while open with focus inside still finds its trigger).\n const regionRef = React.useRef<HTMLDivElement | null>(null);\n const documentRef = React.useRef<Document | null>(null);\n const attachRegion = React.useCallback((node: HTMLDivElement | null) => {\n regionRef.current = node;\n if (node) documentRef.current = node.ownerDocument;\n }, []);\n const mergedRegionRef = useMergedRefs(ref, attachRegion);\n const { triggerId } = item;\n // A misplaced panel collapses with the region it sits in: it has no wrapper of its own.\n const {\n isMounted,\n wrapperRef,\n presenceProps,\n className: collapseClassName,\n } = useCollapsePresence(item.isOpen && !inPanel, {\n motion,\n partRef: regionRef,\n getTrigger: () => documentRef.current?.getElementById(triggerId),\n });\n\n if (inPanel) {\n // Misplaced: its content joins the enclosing region (one region and one panel id per item),\n // and stays while that region is mounted, so it also stays while the region collapses.\n return (\n <div\n className={cn(accordionPanelClassNames.root, className)}\n {...rest}\n id={idProp || undefined}\n ref={ref}\n >\n {children}\n </div>\n );\n }\n if (!isMounted) return null;\n return (\n <AccordionPanelSlotContext.Provider value={IN_PANEL}>\n <div\n ref={wrapperRef}\n {...presenceProps}\n className={cn(accordionPanelClassNames.collapse, collapseClassName)}\n >\n <div\n role=\"region\"\n className={cn(\n accordionPanelClassNames.root,\n 'px-4 pb-3 text-body-1 text-muted-foreground',\n className,\n )}\n {...rest}\n id={idProp || item.panelId}\n aria-labelledby={item.triggerId}\n data-state={item.isOpen ? 'open' : 'closed'}\n ref={mergedRegionRef}\n >\n {children}\n {slot?.extra}\n </div>\n </div>\n </AccordionPanelSlotContext.Provider>\n );\n};\nAccordionPanel.displayName = 'AccordionPanel';\n\n/* ------------------------------------------------------------------ */\n/* Export */\n/* ------------------------------------------------------------------ */\n\n/**\n * A vertically stacked set of disclosure sections (WAI-ARIA Accordion pattern). Each\n * `Accordion.Item` renders an `Accordion.Trigger` button inside a heading (`headingLevel`) and an\n * `Accordion.Panel` region that is shown while the item is open. A panel opens and closes its\n * space with a short collapse and fade (`Accordion.Panel`'s `motion`; none under reduced motion or\n * a `WaveProvider` with `motion=\"none\"`), and focus inside a closing panel moves to its trigger.\n *\n * Single mode (the default) keeps at most one item open (`openItem`, `defaultOpenItem`,\n * `onOpenItemChange`); `type=\"multiple\"` lets any number of items open (`openItems`,\n * `defaultOpenItems`, `onOpenItemsChange`). Each Item's `value` must be unique within its\n * Accordion: a development warning names a repeated value.\n *\n * Sub-components are also exported under flat names (`AccordionItem`, `AccordionTrigger`,\n * `AccordionPanel`) for React Server Components, which cannot use the dotted form.\n */\nexport const Accordion = /* @__PURE__ */ Object.assign(AccordionRoot, {\n Item: AccordionItem,\n Trigger: AccordionTrigger,\n Panel: AccordionPanel,\n});\n\nexport { AccordionItem, AccordionTrigger, AccordionPanel };\n"],"mappings":";;;;;;;;;;;;;;;;AA4DA,IAAMG,IAAmBD,EAAM,cAA4C,IAAI,GACzEE,IAAuBF,EAAM,cAAgD,IAAI,GACjFG,IAA4BH,EAAM,cAA8C,IAAI,GAEpFI,IAA2B,CAAC,GAE5BC,IAAyC;CAC7C,WAAWD;CACX,cAAc,CAAC;CACf,0BAA0B,CAAC;CAC3B,QAAQ;CACR,cAAc;AAChB,GAEME,IAAwC;CAC5C,OAAO;CACP,QAAQ;CACR,WAAW;CACX,SAAS;CACT,iBAAiB;CACjB,cAAc;CACd,cAAc,CAAC;AACjB,GAEMC,IAAoC;CAAE,OAAO;CAAM,SAAS;AAAK,GAMjEC,IAAiCR,EAAM,cAAc,EAAK,GAO1DS,IAAgB;AAMtB,SAASC,EAAoB,GAA0C;CAIrE,OAHgBV,EAAM,WAAWC,CAC7B,MACJU,EAAqBC,GAAW,aAAa,GACtCP;AACT;AAEA,SAASQ,EAAwB,GAA8C;CAI7E,OAHgBb,EAAM,WAAWE,CAC7B,MACJS,EAAqBC,GAAW,kBAAkB,GAC3CN;AACT;AAEA,SAASQ,EAAmB,GAAqB;CAC/C,EACE,uBAAuBC,KACvB,6CAA6CA,EAAM,4IAGrD;AACF;AA2EA,SAASC,EAAQ,GAAiE;CAChF,IAAID,MAAU,KAAA,GACd,OAAOA,MAAU,OAAOX,IAAQ,CAACW,CAAK;AACxC;AAGA,IAAME,KAAiB,M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lib/cn.cjs"),n=require("../../lib/children.cjs"),r=require("../../lib/dev.cjs"),i=require("../../lib/slot.cjs"),a=require("../../lib/composeEventHandlers.cjs"),o=require("../../lib/classNames.cjs"),s=require("../../hooks/useEventCallback.cjs"),ee=require("../../hooks/useControllable.cjs"),te=require("../../hooks/useId.cjs"),ne=require("../../lib/direction.cjs"),re=require("../../hooks/useRovingTabIndex.cjs"),ie=require("../../hooks/useMergedRefs.cjs"),c=require("../../lib/aria.cjs"),ae=require("../../hooks/usePrefersReducedMotion.cjs"),oe=require("../../hooks/useDirection.cjs"),l=require("../../lib/styles.cjs"),se=require("../../lib/icons.cjs"),ce=require("./Carousel.context.cjs"),u=require("./Carousel.styles.cjs"),le=require("./Carousel.button.cjs"),ue=require("./Carousel.drag.cjs"),d=require("./Carousel.groups.cjs");let f=require("react");f=e.__toESM(f,1);let p=require("react/jsx-runtime");var de=`Pause slide rotation`,fe=`Start slide rotation`,pe=`Previous slide`,me=`Next slide`,he=`Choose slide`,ge=(e,t)=>`Slide ${e+1} of ${t}`,_e=`carousel`,ve=`slide`,ye=(e,t,n)=>`Slides ${e} to ${t} of ${n}`;function be(e,t,n){let r=f.useCallback(r=>{if(!e||!t||typeof ResizeObserver>`u`)return()=>{};let i=new ResizeObserver(r);return i.observe(t),n&&i.observe(n),()=>i.disconnect()},[e,t,n]),[i,a,o]=f.useSyncExternalStore(r,()=>{if(!e||!t||!n)return`1:0:0`;let r=n.offsetWidth,i=t.clientWidth;return`${r>0?Math.max(1,Math.floor(i/r)):1}:${r}:${i}`},()=>`1:0:0`).split(`:`).map(Number);return{perPage:i,slideWidth:a,rootWidth:o}}function xe(e){return e instanceof Element&&e.closest(`[data-carousel-rotation]`)!==null}function Se(e){return typeof e==`string`?{src:e}:e}var Ce=()=>(0,p.jsxs)(`svg`,{width:`16`,height:`16`,viewBox:`0 0 16 16`,fill:`currentColor`,"aria-hidden":`true`,children:[(0,p.jsx)(`rect`,{x:`4`,y:`3`,width:`3`,height:`10`,rx:`1`}),(0,p.jsx)(`rect`,{x:`9`,y:`3`,width:`3`,height:`10`,rx:`1`})]}),we=()=>(0,p.jsx)(`svg`,{width:`16`,height:`16`,viewBox:`0 0 16 16`,fill:`currentColor`,"aria-hidden":`true`,children:(0,p.jsx)(`path`,{d:`M5 3.5v9a.5.5 0 0 0 .77.42l7-4.5a.5.5 0 0 0 0-.84l-7-4.5A.5.5 0 0 0 5 3.5Z`})}),m=({value:e,defaultValue:m=0,onValueChange:Te,autoPlay:Ee=!1,autoPlayInterval:De=5e3,autoPlayLabels:Oe,labels:g,loop:_=!1,groupSize:ke=1,align:Ae=`start`,draggable:je=!1,controlsLayout:v=`overlay`,appearance:y=`flat`,className:Me,children:Ne,onMouseEnter:Pe,onMouseLeave:Fe,onFocus:Ie,onBlur:Le,ref:Re,...b})=>{let[ze,Be]=ee.useControllable(e,m,Te),x=te.useId(`carousel-slides`),[Ve,He]=f.useState(null),Ue=ie.useMergedRefs(Re,He),We=oe.useDirection(Ve),S=b.dir===`rtl`||b.dir===`ltr`?b.dir:We,Ge=ae.usePrefersReducedMotion(),[Ke,qe]=f.useState(null),[C,Je]=f.useState(null),[Ye,Xe]=f.useState(null),w=ke===`auto`,T=be(w,Ye,Ke),E=w?T.perPage:Math.max(1,Math.floor(ke)||1),[Ze,Qe]=f.useState(null),[$e,D]=f.useState(null),[et,tt]=f.useState(!1),[nt,rt]=f.useState(!1),[it,at]=f.useState(!1),[ot,O]=f.useState(!1),k=[],A={},j=!1;for(let e of n.flattenChildren(Ne))if(n.isElementOfType(e.node,h))k.push({...e,thumbnail:e.node.props.thumbnail});else if(n.isElementOfType(e.node,le.CarouselButton)){let t=e.node.props.direction===`next`?`next`:`previous`;A[t]?j=!0:A[t]=f.cloneElement(e.node,{key:e.key})}else i.slotRendersContent(e.node)&&(j=!0);let st=k.some(e=>e.thumbnail!==void 0),M=k.length;f.useEffect(()=>{j&&r.warnOnce(`Carousel:non-item-children`,"Carousel: only `Carousel.Item` (`CarouselItem`) children are slides, directly or in Fragments; other children are not rendered. A component that renders `Carousel.Item` itself is not recognised: render the `Carousel.Item` in the Carousel and put the component inside it.")},[j]);let N=d.clampToPage(ze,E,M),P=d.pageCount(M,E),F=d.lastPageStart(M,E),I=N<=0,L=N>=F,R=P<=1||!_&&I,z=P<=1||!_&&L,ct=$e===M&&!_,B=(Ze??Ge)||ct,V=Ee&&P>1;V&&!_&&L&&!B?D(M):$e!==null&&!ct&&D(null);let H=ue.useCarouselDrag({enabled:je&&P>1,dir:S,onCommit:e=>{e===1?L?_&&W(0):W(N+E):e===-1&&(I?_&&W(F):W(N-E))}}),lt=et&&!nt||H.dragging,U=V&&!B&&!lt&&!(it&&!ot),W=e=>{e>=0&&e<M&&e!==N&&Be(e)},G=()=>W(I?F:N-E),K=()=>W(L?0:N+E),ut=s.useEventCallback(()=>{Be(e=>{let t=d.clampToPage(e,E,M);return t<F?t+E:_?0:e})});f.useEffect(()=>{if(!U)return;let e=setInterval(ut,De);return()=>clearInterval(e)},[U,De,ut]);let dt=()=>{B?(!_&&L&&W(0),D(null),Qe(!1),O(!0)):(Qe(!0),O(!1))},ft={onMouseEnter:a.composeEventHandlers(Pe,()=>tt(!0)),onMouseLeave:a.composeEventHandlers(Fe,()=>tt(!1)),onFocus:a.composeEventHandlers(Ie,e=>{let t=e.relatedTarget,n=!(t instanceof Node&&e.currentTarget.contains(t));at(!0),(n||!xe(e.target))&&O(!1)}),onBlur:a.composeEventHandlers(Le,e=>{let t=e.relatedTarget;t instanceof Node&&e.currentTarget.contains(t)||(at(!1),O(!1))})},q=E>1,J=Math.min(N+E,M),pt=f.useMemo(()=>q?Array.from({length:J-N},(e,t)=>String(N+t)):[],[q,N,J]),Y=re.useRovingTabIndex({items:pt,activeValue:String(N),orientation:`horizontal`,loop:!1,dir:S,tabStop:`last-focused`}),mt=ie.useMergedRefs(Y.containerProps.ref,Je),X=f.useRef(null);f.useLayoutEffect(()=>{let e=X.current;if(!e||!C)return;X.current=null;let t=e===`first`?N:J-1;C.querySelector(`[data-roving-value="${t}"]`)?.focus()},[N,J,C]);let ht=e=>{let t=e.target.getAttribute(`data-roving-value`),n=ne.getArrowIntent(e.key,{orientation:`horizontal`,dir:S});if(t!==null&&n&&!e.defaultPrevented&&!e.altKey&&!e.ctrlKey&&!e.metaKey){let r=Number(t);if(n===`next`&&r===J-1){e.preventDefault(),z||(X.current=`first`,K());return}if(n===`prev`&&r===N){e.preventDefault(),R||(X.current=`last`,G());return}}Y.containerProps.onKeyDown(e)},Z=g?.previous??pe,gt=g?.next??me,_t=s.useEventCallback(()=>G()),vt=s.useEventCallback(()=>K()),yt=f.useMemo(()=>({trackId:x,previousLabel:Z,nextLabel:gt,previousDisabled:R,nextDisabled:z,goPrevious:_t,goNext:vt,controlsLayout:v,dir:S}),[x,Z,gt,R,z,_t,vt,v,S]);if(M===0)return(0,p.jsx)(`div`,{ref:Ue,"data-controls-layout":v,"data-appearance":y,className:t.cn(o.carouselClassNames.root,`relative`,Me),...ft,...b});let bt=S===`rtl`?1:-1,Q=`translateX(${N/E*bt*100}%)`;if(H.offsetPx!==0&&(Q=`translateX(calc(${N/E*bt*100}% + ${H.offsetPx}px))`),w){let e=Math.max(0,T.rootWidth-E*T.slideWidth),t=Ae===`center`?e/2:Ae===`end`?e:0;Q=`translateX(${bt*N*T.slideWidth+(S===`rtl`?-t:t)+H.offsetPx+0}px)`}let xt=g?.slides??ye,St=e=>{let t=Math.min(e+E,M);return t-e===1?Dt(e,M):xt(e+1,t,M)},Ct=S===`rtl`?`-scale-x-100`:void 0,wt=Oe?.pause??de,Tt=Oe?.play??fe,Et=g?.picker??he,Dt=g?.slide??ge,Ot=g?.carouselRoleDescription??_e,kt=g?.slideRoleDescription??ve,$=v===`inline`||v===`inline-wide`,At=u.CAROUSEL_CONTROL_LAYOUT[v],jt=A.previous??(0,p.jsx)(`button`,{type:`button`,"aria-label":Z,"aria-controls":x,...c.focusableDisabledProps(R),onClick:c.preventIfDisabled(R,G),className:t.cn(o.carouselClassNames.previousButton,u.CAROUSEL_CONTROL_BASE,At.previous),children:(0,p.jsx)(se.ChevronLeftIcon,{size:16,className:Ct})},`previous`),Mt=A.next??(0,p.jsx)(`button`,{type:`button`,"aria-label":gt,"aria-controls":x,...c.focusableDisabledProps(z),onClick:c.preventIfDisabled(z,K),className:t.cn(o.carouselClassNames.nextButton,u.CAROUSEL_CONTROL_BASE,At.next),children:(0,p.jsx)(se.ChevronRightIcon,{size:16,className:Ct})},`next`),Nt=(0,p.jsxs)(`div`,{ref:Xe,className:t.cn(o.carouselClassNames.viewport,`relative min-w-0 flex-1 overflow-hidden`),children:[(0,p.jsx)(`div`,{id:x,className:t.cn(o.carouselClassNames.track,H.dragging?`flex`:`flex transition-transform duration-300 ease-in-out motion-reduce:transition-none`,je&&`touch-pan-y`),style:{transform:Q},"data-dragging":H.dragging?``:void 0,...H.handlers,...q?Y.containerProps:null,ref:q?mt:Je,onKeyDown:q?ht:void 0,children:k.map(({key:e,node:n},r)=>{let i=r>=N&&r<N+E;return(0,p.jsx)(`div`,{ref:r===0?qe:void 0,role:`group`,"aria-roledescription":kt,"aria-label":Dt(r,M),"aria-hidden":!i||void 0,inert:!i,"data-roving-value":q&&i?String(r):void 0,tabIndex:q&&i?Y.getTabIndex(String(r)):void 0,className:t.cn(o.carouselClassNames.slide,w?`w-auto shrink-0`:E===1?`w-full shrink-0`:`shrink-0`,q&&`focus-visible:outline-2 focus-visible:-outline-offset-2 focus-visible:outline-ring`),style:!w&&E>1?{width:`calc(100% / ${E})`}:void 0,children:n},e)})}),!$&&jt,!$&&Mt]});return(0,p.jsx)(ce.CarouselContext.Provider,{value:yt,children:(0,p.jsxs)(`div`,{ref:Ue,role:`region`,"aria-roledescription":Ot,"aria-label":`Carousel`,"data-controls-layout":v,"data-appearance":y,className:t.cn(o.carouselClassNames.root,`relative isolate overflow-hidden`,y===`elevated`&&`rounded-md shadow-4`,Me),...ft,...b,children:[V&&(0,p.jsx)(`button`,{type:`button`,"data-carousel-rotation":``,"aria-label":B?Tt:wt,"aria-controls":x,onClick:dt,onMouseEnter:()=>rt(!0),onMouseLeave:()=>rt(!1),className:t.cn(o.carouselClassNames.autoPlayButton,u.CAROUSEL_CONTROL_BASE,`absolute z-20 h-8 w-8 rounded-full border border-border bg-background shadow-2 top-2`,$?`start-12`:`start-2`),children:B?(0,p.jsx)(we,{}):(0,p.jsx)(Ce,{})}),$?(0,p.jsxs)(`div`,{className:`flex items-stretch`,children:[jt,Nt,Mt]}):Nt,(0,p.jsx)(`div`,{"aria-live":U?`off`:`polite`,"aria-atomic":`true`,className:`sr-only`,children:St(N)}),(0,p.jsx)(`div`,{role:`group`,"aria-label":Et,className:t.cn(o.carouselClassNames.picker,st?`relative mx-auto flex w-fit flex-wrap justify-center gap-2 p-2`:`absolute inset-x-0 bottom-1 z-10 mx-auto flex w-fit`),children:k.filter((e,t)=>t%E===0).map(({key:e,thumbnail:n},r)=>{let a=r*E,s=a===N;return(0,p.jsx)(`button`,{type:`button`,"aria-label":St(a),"aria-current":s?`true`:void 0,onClick:()=>W(a),className:t.cn(o.carouselClassNames.pickerButton,`group inline-flex items-center justify-center`,n===void 0?`h-6 min-w-6`:`rounded-md p-0.5`,l.focusRing),children:n===void 0?(0,p.jsx)(`span`,{"aria-hidden":`true`,className:t.cn(o.carouselClassNames.pickerIndicator,`block h-2 rounded-full transition-[width,background-color] duration-200 motion-reduce:transition-none`,s?t.cn(`w-5 bg-primary`,l.forcedColors.selectedLeaf):`w-2 bg-stroke-accessible group-hover:bg-foreground forced-colors:bg-[ButtonText] forced-colors:forced-color-adjust-none`)}):i.renderSlot(Se(n),`img`,t.cn(o.carouselItemClassNames.thumbnail,`block h-12 w-16 rounded object-cover`,s?t.cn(`outline-2 outline-primary`,l.forcedColors.selectedContainer):`opacity-70 group-hover:opacity-100`),{alt:``,draggable:!1})},e)})})]})})};m.displayName=`Carousel`;var h=({thumbnail:e,className:n,children:r,ref:i,...a})=>(0,p.jsx)(`div`,{ref:i,className:t.cn(o.carouselItemClassNames.root,`p-4`,n),...a,children:r});h.displayName=`CarouselItem`;var Te=Object.assign(m,{Item:h,Button:le.CarouselButton});exports.Carousel=Te,exports.CarouselItem=h;
1
+ "use client";const e=require("../../_virtual/_rolldown/runtime.cjs"),t=require("../../lib/cn.cjs"),n=require("../../lib/children.cjs"),r=require("../../lib/dev.cjs"),i=require("../../lib/slot.cjs"),a=require("../../lib/composeEventHandlers.cjs"),o=require("../../lib/classNames.cjs"),s=require("../../hooks/useEventCallback.cjs"),ee=require("../../hooks/useControllable.cjs"),te=require("../../hooks/useId.cjs"),ne=require("../../lib/direction.cjs"),re=require("../../hooks/useRovingTabIndex.cjs"),ie=require("../../hooks/useMergedRefs.cjs"),c=require("../../lib/aria.cjs"),ae=require("../../hooks/usePrefersReducedMotion.cjs"),oe=require("../../hooks/useDirection.cjs"),se=require("../../lib/styles.cjs"),ce=require("../../lib/icons.cjs");require("../../lib/motion.cjs");const le=require("../../hooks/useMotion.cjs"),ue=require("./Carousel.context.cjs"),l=require("./Carousel.styles.cjs"),de=require("./Carousel.button.cjs"),fe=require("./Carousel.drag.cjs"),u=require("./Carousel.groups.cjs");let d=require("react");d=e.__toESM(d,1);let f=require("react/jsx-runtime");var pe=`Pause slide rotation`,me=`Start slide rotation`,he=`Previous slide`,ge=`Next slide`,_e=`Choose slide`,ve=(e,t)=>`Slide ${e+1} of ${t}`,ye=`carousel`,be=`slide`,xe=300,Se=(e,t,n)=>`Slides ${e} to ${t} of ${n}`;function Ce(e,t,n){let r=d.useCallback(r=>{if(!e||!t||typeof ResizeObserver>`u`)return()=>{};let i=new ResizeObserver(r);return i.observe(t),n&&i.observe(n),()=>i.disconnect()},[e,t,n]),[i,a,o]=d.useSyncExternalStore(r,()=>{if(!e||!t||!n)return`1:0:0`;let r=n.offsetWidth,i=t.clientWidth;return`${r>0?Math.max(1,Math.floor(i/r)):1}:${r}:${i}`},()=>`1:0:0`).split(`:`).map(Number);return{perPage:i,slideWidth:a,rootWidth:o}}function we(e,t){return e===void 0?t===`none`?`none`:`slide`:e===null?`none`:e===`fade`?`fade`:`slide`}function Te(e){return e instanceof Element&&e.closest(`[data-carousel-rotation]`)!==null}function Ee(e){return typeof e==`string`?{src:e}:e}var De=()=>(0,f.jsxs)(`svg`,{width:`16`,height:`16`,viewBox:`0 0 16 16`,fill:`currentColor`,"aria-hidden":`true`,children:[(0,f.jsx)(`rect`,{x:`4`,y:`3`,width:`3`,height:`10`,rx:`1`}),(0,f.jsx)(`rect`,{x:`9`,y:`3`,width:`3`,height:`10`,rx:`1`})]}),Oe=()=>(0,f.jsx)(`svg`,{width:`16`,height:`16`,viewBox:`0 0 16 16`,fill:`currentColor`,"aria-hidden":`true`,children:(0,f.jsx)(`path`,{d:`M5 3.5v9a.5.5 0 0 0 .77.42l7-4.5a.5.5 0 0 0 0-.84l-7-4.5A.5.5 0 0 0 5 3.5Z`})}),p=({value:e,defaultValue:p=0,onValueChange:ke,autoPlay:Ae=!1,autoPlayInterval:je=5e3,autoPlayLabels:Me,labels:h,loop:g=!1,groupSize:Ne=1,align:Pe=`start`,draggable:Fe=!1,controlsLayout:_=`overlay`,appearance:v=`flat`,motion:Ie,motionDuration:Le=xe,className:Re,children:ze,onMouseEnter:Be,onMouseLeave:Ve,onFocus:He,onBlur:Ue,ref:We,...y})=>{let[Ge,Ke]=ee.useControllable(e,p,ke),b=te.useId(`carousel-slides`),[qe,Je]=d.useState(null),Ye=ie.useMergedRefs(We,Je),Xe=oe.useDirection(qe),x=y.dir===`rtl`||y.dir===`ltr`?y.dir:Xe,Ze=ae.usePrefersReducedMotion(),[Qe,$e]=d.useState(null),[S,et]=d.useState(null),[tt,nt]=d.useState(null),C=Ne===`auto`,w=Ce(C,tt,Qe),T=C?w.perPage:Math.max(1,Math.floor(Ne)||1),rt=we(Ie,le.useMotionPreference()),it=rt===`fade`&&(C||T>1),E=it?`slide`:rt;d.useEffect(()=>{it&&r.warnOnce(`Carousel:fade-group`,'Carousel: `motion="fade"` needs one slide per page; with `groupSize` above 1 or `"auto"` the slides slide.')},[it]);let[at,ot]=d.useState(null),[st,D]=d.useState(null),[ct,lt]=d.useState(!1),[ut,dt]=d.useState(!1),[ft,pt]=d.useState(!1),[mt,O]=d.useState(!1),k=[],A={},j=!1;for(let e of n.flattenChildren(ze))if(n.isElementOfType(e.node,m))k.push({...e,thumbnail:e.node.props.thumbnail});else if(n.isElementOfType(e.node,de.CarouselButton)){let t=e.node.props.direction===`next`?`next`:`previous`;A[t]?j=!0:A[t]=d.cloneElement(e.node,{key:e.key})}else i.slotRendersContent(e.node)&&(j=!0);let ht=k.some(e=>e.thumbnail!==void 0),M=k.length;d.useEffect(()=>{j&&r.warnOnce(`Carousel:non-item-children`,"Carousel: only `Carousel.Item` (`CarouselItem`) children are slides, directly or in Fragments; other children are not rendered. A component that renders `Carousel.Item` itself is not recognised: render the `Carousel.Item` in the Carousel and put the component inside it.")},[j]);let N=u.clampToPage(Ge,T,M),P=u.pageCount(M,T),F=u.lastPageStart(M,T),I=N<=0,L=N>=F,R=P<=1||!g&&I,z=P<=1||!g&&L,gt=st===M&&!g,B=(at??Ze)||gt,V=Ae&&P>1;V&&!g&&L&&!B?D(M):st!==null&&!gt&&D(null);let H=fe.useCarouselDrag({enabled:Fe&&P>1,dir:x,onCommit:e=>{e===1?L?g&&W(0):W(N+T):e===-1&&(I?g&&W(F):W(N-T))}}),_t=ct&&!ut||H.dragging,U=V&&!B&&!_t&&!(ft&&!mt),W=e=>{e>=0&&e<M&&e!==N&&Ke(e)},G=()=>W(I?F:N-T),K=()=>W(L?0:N+T),vt=s.useEventCallback(()=>{Ke(e=>{let t=u.clampToPage(e,T,M);return t<F?t+T:g?0:e})});d.useEffect(()=>{if(!U)return;let e=setInterval(vt,je);return()=>clearInterval(e)},[U,je,vt]);let yt=()=>{B?(!g&&L&&W(0),D(null),ot(!1),O(!0)):(ot(!0),O(!1))},bt={onMouseEnter:a.composeEventHandlers(Be,()=>lt(!0)),onMouseLeave:a.composeEventHandlers(Ve,()=>lt(!1)),onFocus:a.composeEventHandlers(He,e=>{let t=e.relatedTarget,n=!(t instanceof Node&&e.currentTarget.contains(t));pt(!0),(n||!Te(e.target))&&O(!1)}),onBlur:a.composeEventHandlers(Ue,e=>{let t=e.relatedTarget;t instanceof Node&&e.currentTarget.contains(t)||(pt(!1),O(!1))})},q=T>1,J=Math.min(N+T,M),xt=d.useMemo(()=>q?Array.from({length:J-N},(e,t)=>String(N+t)):[],[q,N,J]),Y=re.useRovingTabIndex({items:xt,activeValue:String(N),orientation:`horizontal`,loop:!1,dir:x,tabStop:`last-focused`}),St=ie.useMergedRefs(Y.containerProps.ref,et),X=d.useRef(null);d.useLayoutEffect(()=>{let e=X.current;if(!e||!S)return;X.current=null;let t=e===`first`?N:J-1;S.querySelector(`[data-roving-value="${t}"]`)?.focus()},[N,J,S]);let Ct=e=>{let t=e.target.getAttribute(`data-roving-value`),n=ne.getArrowIntent(e.key,{orientation:`horizontal`,dir:x});if(t!==null&&n&&!e.defaultPrevented&&!e.altKey&&!e.ctrlKey&&!e.metaKey){let r=Number(t);if(n===`next`&&r===J-1){e.preventDefault(),z||(X.current=`first`,K());return}if(n===`prev`&&r===N){e.preventDefault(),R||(X.current=`last`,G());return}}Y.containerProps.onKeyDown(e)},wt=h?.previous??he,Z=h?.next??ge,Tt=s.useEventCallback(()=>G()),Et=s.useEventCallback(()=>K()),Dt=d.useMemo(()=>({trackId:b,previousLabel:wt,nextLabel:Z,previousDisabled:R,nextDisabled:z,goPrevious:Tt,goNext:Et,controlsLayout:_,dir:x}),[b,wt,Z,R,z,Tt,Et,_,x]);if(M===0)return(0,f.jsx)(`div`,{ref:Ye,"data-controls-layout":_,"data-appearance":v,"data-motion":E,className:t.cn(o.carouselClassNames.root,`relative`,Re),...bt,...y});let Ot=x===`rtl`?1:-1,kt=`translateX(${N/T*Ot*100}%)`;if(H.offsetPx!==0&&(kt=`translateX(calc(${N/T*Ot*100}% + ${H.offsetPx}px))`),C){let e=Math.max(0,w.rootWidth-T*w.slideWidth),t=Pe===`center`?e/2:Pe===`end`?e:0;kt=`translateX(${Ot*N*w.slideWidth+(x===`rtl`?-t:t)+H.offsetPx+0}px)`}let Q=E===`fade`,At=E===`slide`&&!H.dragging,jt=Le===xe?void 0:{transitionDuration:`${Le}ms`},Mt=Q?`col-start-1 row-start-1`:C?`w-auto shrink-0`:T===1?`w-full shrink-0`:`shrink-0`,Nt=!C&&T>1?{width:`calc(100% / ${T})`}:void 0,Pt=h?.slides??Se,Ft=e=>{let t=Math.min(e+T,M);return t-e===1?Bt(e,M):Pt(e+1,t,M)},It=x===`rtl`?`-scale-x-100`:void 0,Lt=Me?.pause??pe,Rt=Me?.play??me,zt=h?.picker??_e,Bt=h?.slide??ve,Vt=h?.carouselRoleDescription??ye,Ht=h?.slideRoleDescription??be,$=_===`inline`||_===`inline-wide`,Ut=l.CAROUSEL_CONTROL_LAYOUT[_],Wt=A.previous??(0,f.jsx)(`button`,{type:`button`,"aria-label":wt,"aria-controls":b,...c.focusableDisabledProps(R),onClick:c.preventIfDisabled(R,G),className:t.cn(o.carouselClassNames.previousButton,l.CAROUSEL_CONTROL_BASE,Ut.previous),children:(0,f.jsx)(ce.ChevronLeftIcon,{size:16,className:It})},`previous`),Gt=A.next??(0,f.jsx)(`button`,{type:`button`,"aria-label":Z,"aria-controls":b,...c.focusableDisabledProps(z),onClick:c.preventIfDisabled(z,K),className:t.cn(o.carouselClassNames.nextButton,l.CAROUSEL_CONTROL_BASE,Ut.next),children:(0,f.jsx)(ce.ChevronRightIcon,{size:16,className:It})},`next`),Kt=(0,f.jsxs)(`div`,{ref:nt,className:t.cn(o.carouselClassNames.viewport,`relative min-w-0 flex-1 overflow-hidden`),children:[(0,f.jsx)(`div`,{id:b,className:t.cn(o.carouselClassNames.track,Q?`grid grid-cols-[minmax(0,1fr)]`:`flex`,At&&`transition-transform duration-wave-slow ease-wave-easy-ease motion-reduce:transition-none`,Fe&&`touch-pan-y`),style:Q?void 0:{transform:kt,...At?jt:void 0},"data-dragging":H.dragging?``:void 0,...H.handlers,...q?Y.containerProps:null,ref:q?St:et,onKeyDown:q?Ct:void 0,children:k.map(({key:e,node:n},r)=>{let i=r>=N&&r<N+T;return(0,f.jsx)(`div`,{ref:r===0?$e:void 0,role:`group`,"aria-roledescription":Ht,"aria-label":Bt(r,M),"aria-hidden":!i||void 0,inert:!i,"data-roving-value":q&&i?String(r):void 0,tabIndex:q&&i?Y.getTabIndex(String(r)):void 0,className:t.cn(o.carouselClassNames.slide,Mt,Q&&`transition-opacity duration-wave-slow ease-wave-easy-ease motion-reduce:transition-none`,Q&&!i&&`opacity-0`,q&&`focus-visible:outline-2 focus-visible:-outline-offset-2 focus-visible:outline-ring`),style:Q?jt:Nt,children:n},e)})}),!$&&Wt,!$&&Gt]});return(0,f.jsx)(ue.CarouselContext.Provider,{value:Dt,children:(0,f.jsxs)(`div`,{ref:Ye,role:`region`,"aria-roledescription":Vt,"aria-label":`Carousel`,"data-controls-layout":_,"data-appearance":v,"data-motion":E,className:t.cn(o.carouselClassNames.root,`relative isolate overflow-hidden`,v===`elevated`&&`rounded-md shadow-4`,Re),...bt,...y,children:[V&&(0,f.jsx)(`button`,{type:`button`,"data-carousel-rotation":``,"aria-label":B?Rt:Lt,"aria-controls":b,onClick:yt,onMouseEnter:()=>dt(!0),onMouseLeave:()=>dt(!1),className:t.cn(o.carouselClassNames.autoPlayButton,l.CAROUSEL_CONTROL_BASE,`absolute z-20 h-8 w-8 rounded-full border border-border bg-background shadow-2 top-2`,$?`start-12`:`start-2`),children:B?(0,f.jsx)(Oe,{}):(0,f.jsx)(De,{})}),$?(0,f.jsxs)(`div`,{className:`flex items-stretch`,children:[Wt,Kt,Gt]}):Kt,(0,f.jsx)(`div`,{"aria-live":U?`off`:`polite`,"aria-atomic":`true`,className:`sr-only`,children:Ft(N)}),(0,f.jsx)(`div`,{role:`group`,"aria-label":zt,className:t.cn(o.carouselClassNames.picker,ht?`relative mx-auto flex w-fit flex-wrap justify-center gap-2 p-2`:`absolute inset-x-0 bottom-1 z-10 mx-auto flex w-fit`),children:k.filter((e,t)=>t%T===0).map(({key:e,thumbnail:n},r)=>{let a=r*T,s=a===N;return(0,f.jsx)(`button`,{type:`button`,"aria-label":Ft(a),"aria-current":s?`true`:void 0,onClick:()=>W(a),className:t.cn(o.carouselClassNames.pickerButton,`group inline-flex items-center justify-center`,n===void 0?`h-6 min-w-6`:`rounded-md p-0.5`,se.focusRing),children:n===void 0?(0,f.jsx)(`span`,{"aria-hidden":`true`,className:t.cn(o.carouselClassNames.pickerIndicator,`block h-2 rounded-full transition-[width,background-color] duration-200 motion-reduce:transition-none`,s?t.cn(`w-5 bg-primary`,se.forcedColors.selectedLeaf):`w-2 bg-stroke-accessible group-hover:bg-foreground forced-colors:bg-[ButtonText] forced-colors:forced-color-adjust-none`)}):i.renderSlot(Ee(n),`img`,t.cn(o.carouselItemClassNames.thumbnail,`block h-12 w-16 rounded object-cover`,s?t.cn(`outline-2 outline-primary`,se.forcedColors.selectedContainer):`opacity-70 group-hover:opacity-100`),{alt:``,draggable:!1})},e)})})]})})};p.displayName=`Carousel`;var m=({thumbnail:e,className:n,children:r,ref:i,...a})=>(0,f.jsx)(`div`,{ref:i,className:t.cn(o.carouselItemClassNames.root,`p-4`,n),...a,children:r});m.displayName=`CarouselItem`;var ke=Object.assign(p,{Item:m,Button:de.CarouselButton});exports.Carousel=ke,exports.CarouselItem=m;
2
2
  //# sourceMappingURL=Carousel.cjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"Carousel.cjs","names":["React","useControllable","useId","useMergedRefs","useDirection","usePrefersReducedMotion","flattenChildren","isElementOfType","CarouselButton","slotRendersContent","clampToPage","pageCount","lastPageStart","useCarouselDrag","useEventCallback","composeEventHandlers","useRovingTabIndex","getArrowIntent","cn","carouselClassNames","CAROUSEL_CONTROL_LAYOUT","focusableDisabledProps","preventIfDisabled","CAROUSEL_CONTROL_BASE","ChevronLeftIcon","ChevronRightIcon","CarouselContext","focusRing","renderSlot","carouselItemClassNames","forcedColors","require_runtime","require_cn","require_children","require_dev","require_slot","require_composeEventHandlers","require_classNames","require_useEventCallback","require_useControllable","require_useId","require_direction","require_useRovingTabIndex","require_useMergedRefs","require_aria","require_usePrefersReducedMotion","require_useDirection","require_styles","require_icons","require_Carousel_context","require_Carousel_styles","require_Carousel_button","require_Carousel_drag","require_Carousel_groups","react","react_jsx_runtime","DEFAULT_PAUSE_LABEL","DEFAULT_PLAY_LABEL","DEFAULT_PREVIOUS_LABEL","DEFAULT_NEXT_LABEL","DEFAULT_PICKER_LABEL","defaultSlideLabel","index","total","DEFAULT_CAROUSEL_ROLE_DESCRIPTION","DEFAULT_SLIDE_ROLE_DESCRIPTION","defaultSlidesLabel","start","end","useAutoPageSize","subscribe","enabled","root","observer","notify","slide","perPage","slideWidth","rootWidth","isRotationControl","target","thumbnailSlot","thumbnail","PauseGlyph","PlayGlyph","CarouselRoot","controlledValue","rest","storedIndex","setActiveIndex","defaultValue","onValueChange","trackId","rootEl","setRootEl","rootRef","ref","renderedDir","dir","prefersReducedMotion","firstSlideEl","setFirstSlideEl","trackEl","setTrackEl","viewportEl","setViewportEl","auto","groupSize","measured","size","userPaused","setUserPaused","endedAt","setEndedAt","hovered","setHovered","pointerOnControl","setPointerOnControl","focusWithin","setFocusWithin","startedFromControl","setStartedFromControl","items","customButtons","droppedChildren","child","children","CarouselItem","direction","hasThumbnails","item","pages","lastStart","atStart","atEnd","prevDisabled","loop","nextDisabled","ended","stopped","hasRotation","autoPlay","drag","draggable","delta","goTo","pausedByPointer","rotating","goPrev","goNext","advance","current","prev","id","autoPlayInterval","toggleRotation","rootHandlers","onMouseEnter","onMouseLeave","onFocus","from","event","entering","onBlur","next","grouped","pageEnd","visibleValues","k","roving","trackRef","pendingFocus","pending","handleTrackKeyDown","slideIndex","intent","previousLabel","labels","nextLabel","goPrevious","goToNext","context","controlsLayout","appearance","className","sign","transform","leftover","alignShift","align","slidesLabel","pageLabel","slideLabel","chevronClass","pauseLabel","autoPlayLabels","playLabel","pickerLabel","carouselRoleDescription","slideRoleDescription","inline","layoutClasses","previousControl","nextControl","viewport","active","i","node","key","page","_thumbnail","Carousel"],"sources":["../../../src/components/layout/Carousel.tsx"],"sourcesContent":["import * as React from 'react';\nimport { carouselClassNames, carouselItemClassNames } from '../../lib/classNames';\nimport { flattenChildren, isElementOfType } from '../../lib/children';\nimport { cn } from '../../lib/cn';\nimport { composeEventHandlers } from '../../lib/composeEventHandlers';\nimport { warnOnce } from '../../lib/dev';\nimport { getArrowIntent } from '../../lib/direction';\nimport { renderSlot, slotRendersContent } from '../../lib/slot';\nimport type { Slot } from '../../lib/types';\nimport { focusableDisabledProps, preventIfDisabled } from '../../lib/aria';\nimport { focusRing, forcedColors } from '../../lib/styles';\nimport { ChevronLeftIcon, ChevronRightIcon } from '../../lib/icons';\nimport { useControllable } from '../../hooks/useControllable';\nimport { useEventCallback } from '../../hooks/useEventCallback';\nimport { useDirection } from '../../hooks/useDirection';\nimport { useId } from '../../hooks/useId';\nimport { useMergedRefs } from '../../hooks/useMergedRefs';\nimport { usePrefersReducedMotion } from '../../hooks/usePrefersReducedMotion';\nimport { useRovingTabIndex } from '../../hooks/useRovingTabIndex';\nimport { CarouselButton } from './Carousel.button';\nimport { CarouselContext } from './Carousel.context';\nimport type { CarouselContextValue, CarouselControlsLayout } from './Carousel.context';\nimport { useCarouselDrag } from './Carousel.drag';\nimport { clampToPage, lastPageStart, pageCount } from './Carousel.groups';\nimport { CAROUSEL_CONTROL_BASE, CAROUSEL_CONTROL_LAYOUT } from './Carousel.styles';\n\nexport type { CarouselControlsLayout };\n\n/** How a Carousel is drawn: `flat`, or `elevated` with rounded corners and a shadow. */\nexport type CarouselAppearance = 'flat' | 'elevated';\n\n/** Accessible names of the rotation control shown while `autoPlay` is on. */\nexport interface CarouselAutoPlayLabels {\n /** Name of the control while slides rotate (activating it stops the rotation).\n * @default 'Pause slide rotation'\n */\n pause?: string;\n /** Name of the control while rotation is stopped (activating it starts the rotation).\n * @default 'Start slide rotation'\n */\n play?: string;\n}\n\n/**\n * Accessible names of the Carousel's built-in controls and slides, and the role descriptions of\n * the carousel and its slides, for localization. Each member is optional and falls back to its\n * English default. The rotation control has its own `autoPlayLabels`; the region's name comes\n * from `aria-label` or `aria-labelledby`.\n */\nexport interface CarouselLabels {\n /** Name of the Previous button.\n * @default 'Previous slide'\n */\n previous?: string;\n /** Name of the Next button.\n * @default 'Next slide'\n */\n next?: string;\n /** Name of the group that holds the slide picker buttons.\n * @default 'Choose slide'\n */\n picker?: string;\n /**\n * Name of the slide at `index` (zero-based, like `value`) out of `total` slides. It names the\n * slide itself and its picker button, and is announced by the live region when that slide is\n * shown.\n * @default (index, total) => `Slide ${index + 1} of ${total}`\n */\n slide?: (index: number, total: number) => string;\n /**\n * Name of a page of several slides, from the one-based number of its first and last slide, out\n * of `total` slides (`groupSize` above 1). It names the page's picker button and is announced\n * by the live region when the page is shown. A page of one slide uses `slide`.\n * @default (start, end, total) => `Slides ${start} to ${end} of ${total}`\n */\n slides?: (start: number, end: number, total: number) => string;\n /** How assistive technology announces the carousel region (`aria-roledescription`).\n * @default 'carousel'\n */\n carouselRoleDescription?: string;\n /** How assistive technology announces each slide (`aria-roledescription`).\n * @default 'slide'\n */\n slideRoleDescription?: string;\n}\n\n/** Properties for the Carousel component. */\nexport interface CarouselProps extends React.HTMLAttributes<HTMLDivElement> {\n /**\n * Controlled index of the active slide: with `groupSize` above 1, the first slide of the shown\n * page. A value in the middle of a page shows that page and out-of-range values show the\n * nearest one.\n */\n value?: number;\n /** Default active slide index for uncontrolled usage.\n * @default 0\n */\n defaultValue?: number;\n /**\n * Called with the new index when the active slide changes (not when it stays the same): the\n * first slide of the new page when `groupSize` is above 1.\n */\n onValueChange?: (index: number) => void;\n /**\n * How many slides one page shows: a number, or `'auto'` to show as many as fit the width of the\n * carousel (the slides keep their own width, which must be equal). Previous, Next, the picker\n * (one button per page), looping and autoplay move by page, and the slides of the shown page\n * form one arrow-key focus group. With `1` each slide fills the width, as before.\n * @default 1\n */\n groupSize?: number | 'auto';\n /**\n * With `groupSize=\"auto\"`, where the shown page sits when its slides do not fill the width.\n * @default 'start'\n */\n align?: 'start' | 'center' | 'end';\n /**\n * Lets the pointer drag the slides (mouse, touch and pen). The track follows the pointer and,\n * on release, the page changes when the drag passed a quarter of the width or left fast, else\n * it snaps back; the direction follows the carousel's. The click that ends a drag is not\n * delivered to the slide, and a vertical swipe still scrolls the page. Dragging pauses\n * autoplay like the pointer over the carousel does. The buttons and the keyboard stay the way\n * to operate the carousel without a pointer.\n * @default false\n */\n draggable?: boolean;\n /**\n * Where the Previous and Next buttons go. `overlay` floats round buttons over the slides;\n * `overlay-wide` makes them full-height strips at the edges; `inline` puts them in a row with\n * the slides, outside them; `inline-wide` is `inline` with full-height buttons. The rotation\n * control stays the first focusable element at the start corner in every layout.\n * @default 'overlay'\n */\n controlsLayout?: CarouselControlsLayout;\n /**\n * `elevated` rounds the corners and adds a shadow.\n * @default 'flat'\n */\n appearance?: CarouselAppearance;\n /**\n * Rotates the slides automatically. A Pause/Start control is rendered as the first focusable\n * element. Rotation pauses while focus is anywhere inside the carousel (the control included;\n * clicking a control also moves focus there in most browsers) or the pointer is over it (except\n * over the control), and resumes when they leave, unless rotation is stopped. Activating Start\n * rotates at once, also while focus stays on the control; moving focus on to other content\n * pauses again. It starts stopped when the user prefers reduced motion. Without `loop`, rotation\n * ends at the last slide: the control shows Start, and rotation stays stopped (also after the\n * user moves back to an earlier slide) until Start is activated, which continues from the shown\n * slide, or from the first one while the last is shown. The end is tied to its cause: when the\n * number of slides changes (slides loaded later) or `loop` is turned on, rotation continues on\n * its own, unless the user stopped it with Pause.\n * @default false\n */\n autoPlay?: boolean;\n /** Interval in milliseconds between auto-play transitions.\n * @default 5000\n */\n autoPlayInterval?: number;\n /** Accessible names of the rotation control. */\n autoPlayLabels?: CarouselAutoPlayLabels;\n /**\n * Accessible names of the Previous and Next buttons, the slide picker and the slides (also\n * announced by the live region), and the role descriptions of the carousel and its slides, for\n * localization. Unset members keep their English defaults.\n */\n labels?: CarouselLabels;\n /** Whether the carousel loops back to the first slide after the last.\n * @default false\n */\n loop?: boolean;\n ref?: React.Ref<HTMLDivElement>;\n}\n\n/** Properties for the CarouselItem sub-component. */\nexport interface CarouselItemProps extends React.HTMLAttributes<HTMLDivElement> {\n /**\n * An image for this slide's button in the picker, in place of the dot. A string is the image\n * `src`; an object sets the `<img>`'s attributes. The button keeps its slide-label name, so the\n * image is decorative (`alt=\"\"`). When any slide has one, the picker becomes a row of\n * thumbnails below the slides; a slide without one keeps its dot. With `groupSize` above 1, a\n * page shows the thumbnail of its first slide.\n */\n thumbnail?: Slot<'img'>;\n ref?: React.Ref<HTMLDivElement>;\n}\n\nconst DEFAULT_PAUSE_LABEL = 'Pause slide rotation';\nconst DEFAULT_PLAY_LABEL = 'Start slide rotation';\nconst DEFAULT_PREVIOUS_LABEL = 'Previous slide';\nconst DEFAULT_NEXT_LABEL = 'Next slide';\nconst DEFAULT_PICKER_LABEL = 'Choose slide';\nconst defaultSlideLabel = (index: number, total: number) => `Slide ${index + 1} of ${total}`;\nconst DEFAULT_CAROUSEL_ROLE_DESCRIPTION = 'carousel';\nconst DEFAULT_SLIDE_ROLE_DESCRIPTION = 'slide';\n\nconst defaultSlidesLabel = (start: number, end: number, total: number) =>\n `Slides ${start} to ${end} of ${total}`;\n\n/**\n * With `groupSize=\"auto\"`: how many slides fit the width of the carousel, from the width of the\n * first slide, and the two widths. A snapshot string (`perPage:slideWidth:rootWidth`) so that\n * `useSyncExternalStore` compares it by value; one slide per page before anything is measured.\n */\nfunction useAutoPageSize(\n enabled: boolean,\n root: HTMLElement | null,\n slide: HTMLElement | null,\n): { perPage: number; slideWidth: number; rootWidth: number } {\n const subscribe = React.useCallback(\n (notify: () => void) => {\n if (!enabled || !root || typeof ResizeObserver === 'undefined') return () => {};\n const observer = new ResizeObserver(notify);\n observer.observe(root);\n if (slide) observer.observe(slide);\n return () => observer.disconnect();\n },\n [enabled, root, slide],\n );\n const getSnapshot = () => {\n if (!enabled || !root || !slide) return '1:0:0';\n const slideWidth = slide.offsetWidth;\n const rootWidth = root.clientWidth;\n const perPage = slideWidth > 0 ? Math.max(1, Math.floor(rootWidth / slideWidth)) : 1;\n return `${perPage}:${slideWidth}:${rootWidth}`;\n };\n const snapshot = React.useSyncExternalStore(subscribe, getSnapshot, () => '1:0:0');\n const [perPage, slideWidth, rootWidth] = snapshot.split(':').map(Number) as [\n number,\n number,\n number,\n ];\n return { perPage, slideWidth, rootWidth };\n}\n\nfunction isRotationControl(target: EventTarget | null): boolean {\n return target instanceof Element && target.closest('[data-carousel-rotation]') !== null;\n}\n\n/** The `<img>` slot of a thumbnail: a string is its `src`. */\nfunction thumbnailSlot(thumbnail: Slot<'img'>): Slot<'img'> {\n return typeof thumbnail === 'string' ? { src: thumbnail } : thumbnail;\n}\n\nconst PauseGlyph = () => (\n <svg width=\"16\" height=\"16\" viewBox=\"0 0 16 16\" fill=\"currentColor\" aria-hidden=\"true\">\n <rect x=\"4\" y=\"3\" width=\"3\" height=\"10\" rx=\"1\" />\n <rect x=\"9\" y=\"3\" width=\"3\" height=\"10\" rx=\"1\" />\n </svg>\n);\n\nconst PlayGlyph = () => (\n <svg width=\"16\" height=\"16\" viewBox=\"0 0 16 16\" fill=\"currentColor\" aria-hidden=\"true\">\n <path d=\"M5 3.5v9a.5.5 0 0 0 .77.42l7-4.5a.5.5 0 0 0 0-.84l-7-4.5A.5.5 0 0 0 5 3.5Z\" />\n </svg>\n);\n\n// The Carousel root, documented on the exported `Carousel` const.\nconst CarouselRoot = ({\n value: controlledValue,\n defaultValue = 0,\n onValueChange,\n autoPlay = false,\n autoPlayInterval = 5000,\n autoPlayLabels,\n labels,\n loop = false,\n groupSize = 1,\n align = 'start',\n draggable = false,\n controlsLayout = 'overlay',\n appearance = 'flat',\n className,\n children,\n onMouseEnter,\n onMouseLeave,\n onFocus,\n onBlur,\n ref,\n ...rest\n}: CarouselProps) => {\n const [storedIndex, setActiveIndex] = useControllable(\n controlledValue,\n defaultValue,\n onValueChange,\n );\n const trackId = useId('carousel-slides');\n const [rootEl, setRootEl] = React.useState<HTMLDivElement | null>(null);\n const rootRef = useMergedRefs<HTMLDivElement>(ref, setRootEl);\n // The direction that applies to the rendered root (its own or an ancestor's `dir`, e.g. an RTL\n // section inside an LTR WaveProvider); before mount and on the server, the provider's/document's.\n const renderedDir = useDirection(rootEl);\n const dir = rest.dir === 'rtl' || rest.dir === 'ltr' ? rest.dir : renderedDir;\n const prefersReducedMotion = usePrefersReducedMotion();\n const [firstSlideEl, setFirstSlideEl] = React.useState<HTMLElement | null>(null);\n const [trackEl, setTrackEl] = React.useState<HTMLElement | null>(null);\n const [viewportEl, setViewportEl] = React.useState<HTMLElement | null>(null);\n const auto = groupSize === 'auto';\n const measured = useAutoPageSize(auto, viewportEl, firstSlideEl);\n const size = auto ? measured.perPage : Math.max(1, Math.floor(groupSize) || 1);\n\n // Rotation state: stopped or not (the user's choice, stopped by default under reduced motion, or\n // ended at the last slide without loop) and the temporary pauses while the pointer is over the\n // content or focus is inside. An explicit Start overrides the focus pause while focus stays on\n // the rotation control (APG `hasUserActivatedPlay`), so pressing Start visibly starts the\n // rotation.\n const [userPaused, setUserPaused] = React.useState<boolean | null>(null);\n // The slide count at which rotation ended at the last slide (null while it has not ended), kept\n // apart from the user's choice so the end lasts only while its cause does.\n const [endedAt, setEndedAt] = React.useState<number | null>(null);\n const [hovered, setHovered] = React.useState(false);\n const [pointerOnControl, setPointerOnControl] = React.useState(false);\n const [focusWithin, setFocusWithin] = React.useState(false);\n const [startedFromControl, setStartedFromControl] = React.useState(false);\n\n // Slides are the `CarouselItem` children, Fragments flattened; the element type is unwrapped, so\n // slides written in a Server Component (lazy client references) count too (C-COMPOUND).\n const items: Array<{ key: string; node: React.ReactNode; thumbnail?: Slot<'img'> }> = [];\n // A `Carousel.Button` of each direction replaces the built-in button; a second one of the same\n // direction is not rendered.\n const customButtons: { previous?: React.ReactElement; next?: React.ReactElement } = {};\n let droppedChildren = false;\n for (const child of flattenChildren(children)) {\n if (isElementOfType<CarouselItemProps>(child.node, CarouselItem)) {\n items.push({ ...child, thumbnail: child.node.props.thumbnail });\n } else if (isElementOfType<{ direction?: 'previous' | 'next' }>(child.node, CarouselButton)) {\n const direction = child.node.props.direction === 'next' ? 'next' : 'previous';\n if (customButtons[direction]) droppedChildren = true;\n else customButtons[direction] = React.cloneElement(child.node, { key: child.key });\n } else if (slotRendersContent(child.node)) droppedChildren = true;\n }\n const hasThumbnails = items.some((item) => item.thumbnail !== undefined);\n const total = items.length;\n\n React.useEffect(() => {\n if (droppedChildren) {\n warnOnce(\n 'Carousel:non-item-children',\n 'Carousel: only `Carousel.Item` (`CarouselItem`) children are slides, directly or in ' +\n 'Fragments; other children are not rendered. A component that renders `Carousel.Item` ' +\n 'itself is not recognised: render the `Carousel.Item` in the Carousel and put the ' +\n 'component inside it.',\n );\n }\n }, [droppedChildren]);\n\n // Derived during render (C-HOOKS): removed slides or an out-of-range value show the nearest one.\n const index = clampToPage(storedIndex, size, total);\n const pages = pageCount(total, size);\n const lastStart = lastPageStart(total, size);\n const atStart = index <= 0;\n const atEnd = index >= lastStart;\n const prevDisabled = pages <= 1 || (!loop && atStart);\n const nextDisabled = pages <= 1 || (!loop && atEnd);\n\n // Without loop, rotation ends at the last slide (however it got there) and stays stopped: moving\n // back to an earlier slide does not restart it, only Start does. The end applies to the slide\n // count it happened at: once slides are added or removed, or loop is turned on, it is dropped\n // and rotation continues unless the user stopped it (adjusting state during render, C-HOOKS).\n const ended = endedAt === total && !loop;\n const stopped = (userPaused ?? prefersReducedMotion) || ended;\n const hasRotation = autoPlay && pages > 1;\n if (hasRotation && !loop && atEnd && !stopped) setEndedAt(total);\n else if (endedAt !== null && !ended) setEndedAt(null);\n // A release moves one page towards the drag; past the ends it only loops with `loop`.\n const drag = useCarouselDrag({\n enabled: draggable && pages > 1,\n dir,\n onCommit: (delta) => {\n if (delta === 1) {\n if (!atEnd) goTo(index + size);\n else if (loop) goTo(0);\n } else if (delta === -1) {\n if (!atStart) goTo(index - size);\n else if (loop) goTo(lastStart);\n }\n },\n });\n const pausedByPointer = (hovered && !pointerOnControl) || drag.dragging;\n const pausedByFocus = focusWithin && !startedFromControl;\n const rotating = hasRotation && !stopped && !pausedByPointer && !pausedByFocus;\n\n // Compares with the shown (clamped) index, so re-picking the visible slide reports nothing.\n const goTo = (target: number) => {\n if (target >= 0 && target < total && target !== index) setActiveIndex(target);\n };\n const goPrev = () => goTo(atStart ? lastStart : index - size);\n const goNext = () => goTo(atEnd ? 0 : index + size);\n\n // Reads the latest index at tick time (the updater's base), so the interval does not restart on\n // every slide or parent render and consecutive ticks chain even before a re-render.\n const advance = useEventCallback(() => {\n setActiveIndex((prev) => {\n const current = clampToPage(prev, size, total);\n if (current < lastStart) return current + size;\n return loop ? 0 : prev;\n });\n });\n\n React.useEffect(() => {\n if (!rotating) return;\n const id = setInterval(advance, autoPlayInterval);\n return () => clearInterval(id);\n }, [rotating, autoPlayInterval, advance]);\n\n const toggleRotation = () => {\n if (stopped) {\n // Start: from the first slide when rotation had ended at the last one.\n if (!loop && atEnd) goTo(0);\n setEndedAt(null);\n setUserPaused(false);\n setStartedFromControl(true);\n } else {\n setUserPaused(true);\n setStartedFromControl(false);\n }\n };\n\n // The consumer's pointer and focus handlers composed with the pause tracking (C-COMPOSE). The\n // empty root gets them too: the consumer's handlers still run, and a pointer or focus that leaves\n // while there are no slides (slides being reloaded) does not keep rotation paused afterwards.\n const rootHandlers = {\n onMouseEnter: composeEventHandlers(onMouseEnter, () => setHovered(true)),\n onMouseLeave: composeEventHandlers(onMouseLeave, () => setHovered(false)),\n onFocus: composeEventHandlers(onFocus, (event: React.FocusEvent<HTMLDivElement>) => {\n // Any focus inside pauses (APG), the rotation control included. Focus that enters from\n // outside or moves on to other content ends the exemption of an explicit Start.\n const from = event.relatedTarget;\n const entering = !(from instanceof Node && event.currentTarget.contains(from));\n setFocusWithin(true);\n if (entering || !isRotationControl(event.target)) setStartedFromControl(false);\n }),\n onBlur: composeEventHandlers(onBlur, (event: React.FocusEvent<HTMLDivElement>) => {\n const next = event.relatedTarget;\n if (!(next instanceof Node && event.currentTarget.contains(next))) {\n setFocusWithin(false);\n setStartedFromControl(false);\n }\n }),\n };\n\n // The slides of the shown page form one arrow-key focus group (groupSize above 1). Only they\n // carry a roving value; the others are inert.\n const grouped = size > 1;\n const pageEnd = Math.min(index + size, total);\n const visibleValues = React.useMemo(\n () => (grouped ? Array.from({ length: pageEnd - index }, (_, k) => String(index + k)) : []),\n [grouped, index, pageEnd],\n );\n const roving = useRovingTabIndex({\n items: visibleValues,\n activeValue: String(index),\n orientation: 'horizontal',\n loop: false,\n dir,\n tabStop: 'last-focused',\n });\n const trackRef = useMergedRefs<HTMLDivElement>(roving.containerProps.ref, setTrackEl);\n // Which slide of the new page takes focus after an arrow past the end of a page.\n const pendingFocus = React.useRef<'first' | 'last' | null>(null);\n React.useLayoutEffect(() => {\n const pending = pendingFocus.current;\n if (!pending || !trackEl) return;\n pendingFocus.current = null;\n const target = pending === 'first' ? index : pageEnd - 1;\n trackEl.querySelector<HTMLElement>(`[data-roving-value=\"${target}\"]`)?.focus();\n }, [index, pageEnd, trackEl]);\n const handleTrackKeyDown = (event: React.KeyboardEvent<HTMLElement>) => {\n const slideIndex = (event.target as HTMLElement).getAttribute('data-roving-value');\n const intent = getArrowIntent(event.key, { orientation: 'horizontal', dir });\n if (\n slideIndex !== null &&\n intent &&\n !event.defaultPrevented &&\n !event.altKey &&\n !event.ctrlKey &&\n !event.metaKey\n ) {\n const current = Number(slideIndex);\n if (intent === 'next' && current === pageEnd - 1) {\n event.preventDefault();\n if (!nextDisabled) {\n pendingFocus.current = 'first';\n goNext();\n }\n return;\n }\n if (intent === 'prev' && current === index) {\n event.preventDefault();\n if (!prevDisabled) {\n pendingFocus.current = 'last';\n goPrev();\n }\n return;\n }\n }\n roving.containerProps.onKeyDown(event);\n };\n\n const previousLabel = labels?.previous ?? DEFAULT_PREVIOUS_LABEL;\n const nextLabel = labels?.next ?? DEFAULT_NEXT_LABEL;\n const goPrevious = useEventCallback(() => goPrev());\n const goToNext = useEventCallback(() => goNext());\n // What `Carousel.Button` reads (C-MEMO).\n const context = React.useMemo<CarouselContextValue>(\n () => ({\n trackId,\n previousLabel,\n nextLabel,\n previousDisabled: prevDisabled,\n nextDisabled,\n goPrevious,\n goNext: goToNext,\n controlsLayout,\n dir,\n }),\n [\n trackId,\n previousLabel,\n nextLabel,\n prevDisabled,\n nextDisabled,\n goPrevious,\n goToNext,\n controlsLayout,\n dir,\n ],\n );\n\n if (total === 0) {\n return (\n <div\n ref={rootRef}\n data-controls-layout={controlsLayout}\n data-appearance={appearance}\n className={cn(carouselClassNames.root, 'relative', className)}\n {...rootHandlers}\n {...rest}\n />\n );\n }\n\n const sign = dir === 'rtl' ? 1 : -1;\n // A page is as wide as the carousel: the track moves by pages. With `auto` the slides keep their\n // own width and the track moves by whole slides, in pixels, plus the alignment of the page.\n let transform = `translateX(${sign * (index / size) * 100}%)`;\n if (drag.offsetPx !== 0) {\n transform = `translateX(calc(${sign * (index / size) * 100}% + ${drag.offsetPx}px))`;\n }\n if (auto) {\n const leftover = Math.max(0, measured.rootWidth - size * measured.slideWidth);\n const alignShift = align === 'center' ? leftover / 2 : align === 'end' ? leftover : 0;\n const px = sign * index * measured.slideWidth + (dir === 'rtl' ? -alignShift : alignShift);\n transform = `translateX(${px + drag.offsetPx + 0}px)`;\n }\n const slidesLabel = labels?.slides ?? defaultSlidesLabel;\n /** The name of the page that starts at `start`: its slides, or the one slide it holds. */\n const pageLabel = (start: number) => {\n const end = Math.min(start + size, total);\n return end - start === 1 ? slideLabel(start, total) : slidesLabel(start + 1, end, total);\n };\n // The chevrons mirror by the same resolved direction as the track. A CSS `rtl:` variant would\n // also match `[dir=rtl] *`, so an LTR carousel inside an RTL ancestor got mirrored chevrons.\n const chevronClass = dir === 'rtl' ? '-scale-x-100' : undefined;\n const pauseLabel = autoPlayLabels?.pause ?? DEFAULT_PAUSE_LABEL;\n const playLabel = autoPlayLabels?.play ?? DEFAULT_PLAY_LABEL;\n const pickerLabel = labels?.picker ?? DEFAULT_PICKER_LABEL;\n const slideLabel = labels?.slide ?? defaultSlideLabel;\n const carouselRoleDescription =\n labels?.carouselRoleDescription ?? DEFAULT_CAROUSEL_ROLE_DESCRIPTION;\n const slideRoleDescription = labels?.slideRoleDescription ?? DEFAULT_SLIDE_ROLE_DESCRIPTION;\n\n const inline = controlsLayout === 'inline' || controlsLayout === 'inline-wide';\n const layoutClasses = CAROUSEL_CONTROL_LAYOUT[controlsLayout];\n const previousControl = customButtons.previous ?? (\n <button\n key=\"previous\"\n type=\"button\"\n aria-label={previousLabel}\n aria-controls={trackId}\n {...focusableDisabledProps(prevDisabled)}\n onClick={preventIfDisabled(prevDisabled, goPrev)}\n className={cn(\n carouselClassNames.previousButton,\n CAROUSEL_CONTROL_BASE,\n layoutClasses.previous,\n )}\n >\n <ChevronLeftIcon size={16} className={chevronClass} />\n </button>\n );\n const nextControl = customButtons.next ?? (\n <button\n key=\"next\"\n type=\"button\"\n aria-label={nextLabel}\n aria-controls={trackId}\n {...focusableDisabledProps(nextDisabled)}\n onClick={preventIfDisabled(nextDisabled, goNext)}\n className={cn(carouselClassNames.nextButton, CAROUSEL_CONTROL_BASE, layoutClasses.next)}\n >\n <ChevronRightIcon size={16} className={chevronClass} />\n </button>\n );\n\n const viewport = (\n <div\n ref={setViewportEl}\n className={cn(carouselClassNames.viewport, 'relative min-w-0 flex-1 overflow-hidden')}\n >\n <div\n id={trackId}\n className={cn(\n carouselClassNames.track,\n drag.dragging\n ? 'flex'\n : 'flex transition-transform duration-300 ease-in-out motion-reduce:transition-none',\n // Horizontal pointer moves belong to the drag; a vertical swipe still scrolls the page.\n draggable && 'touch-pan-y',\n )}\n style={{ transform }}\n data-dragging={drag.dragging ? '' : undefined}\n {...drag.handlers}\n {...(grouped ? roving.containerProps : null)}\n ref={grouped ? trackRef : setTrackEl}\n onKeyDown={grouped ? handleTrackKeyDown : undefined}\n >\n {items.map(({ key, node }, i) => {\n const active = i >= index && i < index + size;\n return (\n <div\n key={key}\n ref={i === 0 ? setFirstSlideEl : undefined}\n role=\"group\"\n aria-roledescription={slideRoleDescription}\n aria-label={slideLabel(i, total)}\n aria-hidden={active ? undefined : true}\n inert={!active}\n data-roving-value={grouped && active ? String(i) : undefined}\n tabIndex={grouped && active ? roving.getTabIndex(String(i)) : undefined}\n className={cn(\n carouselClassNames.slide,\n auto ? 'w-auto shrink-0' : size === 1 ? 'w-full shrink-0' : 'shrink-0',\n grouped &&\n 'focus-visible:outline-2 focus-visible:-outline-offset-2 focus-visible:outline-ring',\n )}\n style={!auto && size > 1 ? { width: `calc(100% / ${size})` } : undefined}\n >\n {node}\n </div>\n );\n })}\n </div>\n {/* Overlaid on the slides, after them in the tab order, like before the layouts. */}\n {!inline && previousControl}\n {!inline && nextControl}\n </div>\n );\n\n return (\n <CarouselContext.Provider value={context}>\n <div\n ref={rootRef}\n role=\"region\"\n aria-roledescription={carouselRoleDescription}\n aria-label=\"Carousel\"\n data-controls-layout={controlsLayout}\n data-appearance={appearance}\n // A stacking context of its own: the controls' z-index cannot lift them over page headers.\n className={cn(\n carouselClassNames.root,\n 'relative isolate overflow-hidden',\n appearance === 'elevated' && 'rounded-md shadow-4',\n className,\n )}\n {...rootHandlers}\n {...rest}\n >\n {hasRotation && (\n <button\n type=\"button\"\n data-carousel-rotation=\"\"\n aria-label={stopped ? playLabel : pauseLabel}\n aria-controls={trackId}\n onClick={toggleRotation}\n // The pointer over the control does not pause (APG): the user is operating it.\n onMouseEnter={() => setPointerOnControl(true)}\n onMouseLeave={() => setPointerOnControl(false)}\n className={cn(\n carouselClassNames.autoPlayButton,\n CAROUSEL_CONTROL_BASE,\n // Above the edge strips of the wide layouts, which would dim and cover it.\n 'absolute z-20 h-8 w-8 rounded-full border border-border bg-background shadow-2 top-2',\n // Over the viewport's corner: past the Previous button of an inline layout.\n inline ? 'start-12' : 'start-2',\n )}\n >\n {stopped ? <PlayGlyph /> : <PauseGlyph />}\n </button>\n )}\n {inline ? (\n <div className=\"flex items-stretch\">\n {previousControl}\n {viewport}\n {nextControl}\n </div>\n ) : (\n viewport\n )}\n {/* Announces the current slide, except while slides rotate on their own. */}\n <div aria-live={rotating ? 'off' : 'polite'} aria-atomic=\"true\" className=\"sr-only\">\n {pageLabel(index)}\n </div>\n <div\n role=\"group\"\n aria-label={pickerLabel}\n className={cn(\n carouselClassNames.picker,\n hasThumbnails\n ? 'relative mx-auto flex w-fit flex-wrap justify-center gap-2 p-2'\n : 'absolute inset-x-0 bottom-1 z-10 mx-auto flex w-fit',\n )}\n >\n {items\n .filter((_, i) => i % size === 0)\n .map(({ key, thumbnail }, page) => {\n const start = page * size;\n const active = start === index;\n return (\n <button\n key={key}\n type=\"button\"\n aria-label={pageLabel(start)}\n aria-current={active ? 'true' : undefined}\n onClick={() => goTo(start)}\n className={cn(\n carouselClassNames.pickerButton,\n 'group inline-flex items-center justify-center',\n thumbnail !== undefined ? 'rounded-md p-0.5' : 'h-6 min-w-6',\n focusRing,\n )}\n >\n {thumbnail !== undefined ? (\n renderSlot(\n thumbnailSlot(thumbnail),\n 'img',\n cn(\n carouselItemClassNames.thumbnail,\n 'block h-12 w-16 rounded object-cover',\n active\n ? cn('outline-2 outline-primary', forcedColors.selectedContainer)\n : 'opacity-70 group-hover:opacity-100',\n ),\n { alt: '', draggable: false },\n )\n ) : (\n <span\n aria-hidden=\"true\"\n className={cn(\n carouselClassNames.pickerIndicator,\n 'block h-2 rounded-full transition-[width,background-color] duration-200 motion-reduce:transition-none',\n active\n ? cn('w-5 bg-primary', forcedColors.selectedLeaf)\n : 'w-2 bg-stroke-accessible group-hover:bg-foreground forced-colors:bg-[ButtonText] forced-colors:forced-color-adjust-none',\n )}\n />\n )}\n </button>\n );\n })}\n </div>\n </div>\n </CarouselContext.Provider>\n );\n};\nCarouselRoot.displayName = 'Carousel';\n\n/**\n * One slide of a {@link Carousel}. Write it in the Carousel, directly or in a Fragment: a component\n * that renders `Carousel.Item` itself is not recognised as a slide (put that component inside the\n * `Carousel.Item` instead).\n */\nexport const CarouselItem = ({\n thumbnail: _thumbnail,\n className,\n children,\n ref,\n ...rest\n}: CarouselItemProps) => {\n return (\n <div ref={ref} className={cn(carouselItemClassNames.root, 'p-4', className)} {...rest}>\n {children}\n </div>\n );\n};\nCarouselItem.displayName = 'CarouselItem';\n\n/**\n * A slideshow that shows one slide at a time (WAI-ARIA APG carousel with previous/next buttons\n * and a slide picker).\n *\n * - Slides are the `Carousel.Item` (`CarouselItem`) children, written directly in the Carousel or\n * in Fragments. Other children are not rendered (a development warning says so). A component\n * that renders `Carousel.Item` itself is not recognised: write the `Carousel.Item` in the\n * Carousel and put the component inside it.\n * - Previous/Next stay focusable at the ends (`aria-disabled`), so keyboard focus is not lost.\n * - The slide picker is a group of buttons named \"Slide n of m\"; the active one has\n * `aria-current=\"true\"`.\n * - Inactive slides are `aria-hidden` and `inert`, so neither Tab nor a screen reader reaches\n * their content.\n * - With `autoPlay`, a Pause/Start control comes first (WAI-ARIA APG): rotation pauses while\n * focus is inside the carousel (in most browsers also after a click on one of its controls) or\n * the pointer is over its content, activating Start rotates at once, and the live region is\n * silent (`aria-live=\"off\"`) while slides rotate. Without `loop` rotation ends at the last slide\n * and stays stopped until the control's Start is activated (or the number of slides changes, or\n * `loop` is turned on).\n * - Right-to-left layouts slide the other way and mirror the Previous/Next chevrons: the direction\n * is read from the rendered element (its `dir` prop, the nearest ancestor's `dir`, WaveProvider\n * `dir` or the document's), so an LTR section inside an RTL page stays LTR throughout.\n * - Name the carousel with `aria-label` or `aria-labelledby` (the fallback name is \"Carousel\").\n * The built-in names and role descriptions are English: `labels` and `autoPlayLabels`\n * translate them.\n * - The controls are layered over the slides inside the carousel's own stacking context, so they\n * never paint over page headers that stay in view while the page scrolls.\n *\n * - `groupSize` shows several slides per page, `draggable` lets the pointer drag them, and a\n * `thumbnail` on a `Carousel.Item` turns the picker into a row of thumbnails.\n * - `controlsLayout` places the Previous and Next buttons over the slides (`overlay`,\n * `overlay-wide`) or beside them (`inline`, `inline-wide`); `Carousel.Button` replaces the\n * built-in button of its `direction` with one of your own glyph.\n *\n * Compound access (`Carousel.Item`, `Carousel.Button`) needs a client module; React Server\n * Components import the flat names `CarouselItem` and `CarouselButton` instead.\n */\nexport const Carousel = /* @__PURE__ */ Object.assign(CarouselRoot, {\n Item: CarouselItem,\n Button: CarouselButton,\n});\n"],"mappings":"+9BA0LA,IAAMwD,GAAsB,uBACtBC,GAAqB,uBACrBC,GAAyB,iBACzBC,GAAqB,aACrBC,GAAuB,eACvBC,IAAqB,EAAe,IAAkB,SAASC,EAAQ,EAAE,MAAMC,IAC/EC,GAAoC,WACpCC,GAAiC,QAEjCC,IAAsB,EAAe,EAAa,IACtD,UAAUC,EAAM,MAAMC,EAAI,MAAML,IAOlC,SAASM,GACP,EACA,EACA,EAC4D,CAC5D,IAAMC,EAAYtE,EAAM,YACrB,GAAuB,CACtB,GAAI,CAACuE,GAAW,CAACC,GAAQ,OAAO,eAAmB,IAAa,UAAa,CAAC,EAC9E,IAAMC,EAAW,IAAI,eAAeC,CAAM,EAG1C,OAFAD,EAAS,QAAQD,CAAI,EACjBG,GAAOF,EAAS,QAAQE,CAAK,MACpBF,EAAS,WAAW,CACnC,EACA,CAACF,EAASC,EAAMG,CAAK,CACvB,EASM,CAACC,EAASC,EAAYC,GADX9E,EAAM,qBAAqBsE,MAPlB,CACxB,GAAI,CAACC,GAAW,CAACC,GAAQ,CAACG,EAAO,MAAO,QACxC,IAAME,EAAaF,EAAM,YACnBG,EAAYN,EAAK,YAEvB,MAAO,GADSK,EAAa,EAAI,KAAK,IAAI,EAAG,KAAK,MAAMC,EAAYD,CAAU,CAAC,EAAI,EACjE,GAAGA,EAAW,GAAGC,GACrC,MAC0E,OACjC,CAAA,CAAS,MAAM,GAAG,CAAC,CAAC,IAAI,MAAM,EAKvE,MAAO,C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AEC,SAAAuD,IAAc,IAAA,IAcb,EAAA3B,EAAA,IAAA,CAAC,OAAD,CACE,cAAY,OACZ,UAAWrC,EAAAA,GACTC,EAAAA,mBAAmB,gBACnB,wGACA0L,EACI3L,EAAAA,GAAG,iBAAkBY,EAAAA,aAAa,YAAY,EAC9C,yHACN,CACD,CAAA,EAtBDF,EAAAA,WACEqD,GAAcC,CAAS,EACvB,MACAhE,EAAAA,GACEW,EAAAA,uBAAuB,UACvB,uCACAgL,EACI3L,EAAAA,GAAG,4BAA6BY,EAAAA,aAAa,iBAAiB,EAC9D,oCACN,EACA,CAAE,IAAK,GAAI,UAAW,EAAM,CAC9B,CAaI,EArCDkL,CAqCC,CAEZ,CAAC,CACA,CAAA,CACF,GACmB,CAAA,CAE9B,EACA,EAAa,YAAc,WAO3B,IAAajF,GAAgB,CAC3B,UAAWmF,EACX,YACA,WACA,MACA,GAAG3H,MAGD,EAAAhC,EAAA,IAAA,CAAC,MAAD,CAAU,MAAK,UAAWrC,EAAAA,GAAGW,EAAAA,uBAAuB,KAAM,MAAO2J,CAAS,EAAG,GAAIjG,EAC9E,UACE,CAAA,EAGT,EAAa,YAAc,eAuC3B,IAAa4H,GAA2B,OAAO,OAAO9H,EAAc,CAClE,KAAM0C,EACN,OAAQvH,GAAAA,cACV,CAAC"}
1
+ {"version":3,"file":"Carousel.cjs","names":["React","useControllable","useId","useMergedRefs","useDirection","usePrefersReducedMotion","useMotionPreference","flattenChildren","isElementOfType","CarouselButton","slotRendersContent","clampToPage","pageCount","lastPageStart","useCarouselDrag","useEventCallback","composeEventHandlers","useRovingTabIndex","getArrowIntent","cn","carouselClassNames","CAROUSEL_CONTROL_LAYOUT","focusableDisabledProps","preventIfDisabled","CAROUSEL_CONTROL_BASE","ChevronLeftIcon","ChevronRightIcon","CarouselContext","focusRing","renderSlot","carouselItemClassNames","forcedColors","require_runtime","require_cn","require_children","require_dev","require_slot","require_composeEventHandlers","require_classNames","require_useEventCallback","require_useControllable","require_useId","require_direction","require_useRovingTabIndex","require_useMergedRefs","require_aria","require_usePrefersReducedMotion","require_useDirection","require_styles","require_icons","require_useMotion","require_Carousel_context","require_Carousel_styles","require_Carousel_button","require_Carousel_drag","require_Carousel_groups","react","react_jsx_runtime","DEFAULT_PAUSE_LABEL","DEFAULT_PLAY_LABEL","DEFAULT_PREVIOUS_LABEL","DEFAULT_NEXT_LABEL","DEFAULT_PICKER_LABEL","defaultSlideLabel","index","total","DEFAULT_CAROUSEL_ROLE_DESCRIPTION","DEFAULT_SLIDE_ROLE_DESCRIPTION","DEFAULT_MOTION_DURATION","defaultSlidesLabel","start","end","useAutoPageSize","subscribe","enabled","root","observer","notify","slide","perPage","slideWidth","rootWidth","requestedCarouselMotion","motion","preference","isRotationControl","target","thumbnailSlot","thumbnail","PauseGlyph","PlayGlyph","CarouselRoot","controlledValue","rest","storedIndex","setActiveIndex","defaultValue","onValueChange","trackId","rootEl","setRootEl","rootRef","ref","renderedDir","dir","prefersReducedMotion","firstSlideEl","setFirstSlideEl","trackEl","setTrackEl","viewportEl","setViewportEl","auto","groupSize","measured","size","requestedMotion","fadeFallback","resolvedMotion","userPaused","setUserPaused","endedAt","setEndedAt","hovered","setHovered","pointerOnControl","setPointerOnControl","focusWithin","setFocusWithin","startedFromControl","setStartedFromControl","items","customButtons","droppedChildren","child","children","CarouselItem","direction","hasThumbnails","item","pages","lastStart","atStart","atEnd","prevDisabled","loop","nextDisabled","ended","stopped","hasRotation","autoPlay","drag","draggable","delta","goTo","pausedByPointer","rotating","goPrev","goNext","advance","current","prev","id","autoPlayInterval","toggleRotation","rootHandlers","onMouseEnter","onMouseLeave","onFocus","from","event","entering","onBlur","next","grouped","pageEnd","visibleValues","k","roving","trackRef","pendingFocus","pending","handleTrackKeyDown","slideIndex","intent","previousLabel","labels","nextLabel","goPrevious","goToNext","context","controlsLayout","appearance","className","sign","transform","leftover","alignShift","align","fading","trackMoves","durationStyle","motionDuration","slideLayout","slidesLabel","pageLabel","slideLabel","chevronClass","pauseLabel","autoPlayLabels","playLabel","pickerLabel","carouselRoleDescription","slideRoleDescription","inline","layoutClasses","previousControl","nextControl","viewport","active","i","node","key","page","_thumbnail","Carousel"],"sources":["../../../src/components/layout/Carousel.tsx"],"sourcesContent":["import * as React from 'react';\nimport { carouselClassNames, carouselItemClassNames } from '../../lib/classNames';\nimport { flattenChildren, isElementOfType } from '../../lib/children';\nimport { cn } from '../../lib/cn';\nimport { composeEventHandlers } from '../../lib/composeEventHandlers';\nimport { warnOnce } from '../../lib/dev';\nimport { getArrowIntent } from '../../lib/direction';\nimport { carouselFadeMotion, carouselSlideMotion } from '../../lib/motion';\nimport { renderSlot, slotRendersContent } from '../../lib/slot';\nimport type { MotionPreference, Slot } from '../../lib/types';\nimport { focusableDisabledProps, preventIfDisabled } from '../../lib/aria';\nimport { focusRing, forcedColors } from '../../lib/styles';\nimport { ChevronLeftIcon, ChevronRightIcon } from '../../lib/icons';\nimport { useControllable } from '../../hooks/useControllable';\nimport { useEventCallback } from '../../hooks/useEventCallback';\nimport { useDirection } from '../../hooks/useDirection';\nimport { useId } from '../../hooks/useId';\nimport { useMergedRefs } from '../../hooks/useMergedRefs';\nimport { useMotionPreference } from '../../hooks/useMotion';\nimport { usePrefersReducedMotion } from '../../hooks/usePrefersReducedMotion';\nimport { useRovingTabIndex } from '../../hooks/useRovingTabIndex';\nimport { CarouselButton } from './Carousel.button';\nimport { CarouselContext } from './Carousel.context';\nimport type { CarouselContextValue, CarouselControlsLayout } from './Carousel.context';\nimport { useCarouselDrag } from './Carousel.drag';\nimport { clampToPage, lastPageStart, pageCount } from './Carousel.groups';\nimport { CAROUSEL_CONTROL_BASE, CAROUSEL_CONTROL_LAYOUT } from './Carousel.styles';\n\nexport type { CarouselControlsLayout };\n\n/** How a Carousel is drawn: `flat`, or `elevated` with rounded corners and a shadow. */\nexport type CarouselAppearance = 'flat' | 'elevated';\n\n/**\n * How a Carousel moves between pages: `slide` moves the slides in from the side of the page order,\n * `fade` cross-fades them in place (one slide per page only).\n */\nexport type CarouselMotion = 'slide' | 'fade';\n\n/** Accessible names of the rotation control shown while `autoPlay` is on. */\nexport interface CarouselAutoPlayLabels {\n /** Name of the control while slides rotate (activating it stops the rotation).\n * @default 'Pause slide rotation'\n */\n pause?: string;\n /** Name of the control while rotation is stopped (activating it starts the rotation).\n * @default 'Start slide rotation'\n */\n play?: string;\n}\n\n/**\n * Accessible names of the Carousel's built-in controls and slides, and the role descriptions of\n * the carousel and its slides, for localization. Each member is optional and falls back to its\n * English default. The rotation control has its own `autoPlayLabels`; the region's name comes\n * from `aria-label` or `aria-labelledby`.\n */\nexport interface CarouselLabels {\n /** Name of the Previous button.\n * @default 'Previous slide'\n */\n previous?: string;\n /** Name of the Next button.\n * @default 'Next slide'\n */\n next?: string;\n /** Name of the group that holds the slide picker buttons.\n * @default 'Choose slide'\n */\n picker?: string;\n /**\n * Name of the slide at `index` (zero-based, like `value`) out of `total` slides. It names the\n * slide itself and its picker button, and is announced by the live region when that slide is\n * shown.\n * @default (index, total) => `Slide ${index + 1} of ${total}`\n */\n slide?: (index: number, total: number) => string;\n /**\n * Name of a page of several slides, from the one-based number of its first and last slide, out\n * of `total` slides (`groupSize` above 1). It names the page's picker button and is announced\n * by the live region when the page is shown. A page of one slide uses `slide`.\n * @default (start, end, total) => `Slides ${start} to ${end} of ${total}`\n */\n slides?: (start: number, end: number, total: number) => string;\n /** How assistive technology announces the carousel region (`aria-roledescription`).\n * @default 'carousel'\n */\n carouselRoleDescription?: string;\n /** How assistive technology announces each slide (`aria-roledescription`).\n * @default 'slide'\n */\n slideRoleDescription?: string;\n}\n\n/** Properties for the Carousel component. */\nexport interface CarouselProps extends React.HTMLAttributes<HTMLDivElement> {\n /**\n * Controlled index of the active slide: with `groupSize` above 1, the first slide of the shown\n * page. A value in the middle of a page shows that page and out-of-range values show the\n * nearest one.\n */\n value?: number;\n /** Default active slide index for uncontrolled usage.\n * @default 0\n */\n defaultValue?: number;\n /**\n * Called with the new index when the active slide changes (not when it stays the same): the\n * first slide of the new page when `groupSize` is above 1.\n */\n onValueChange?: (index: number) => void;\n /**\n * How many slides one page shows: a number, or `'auto'` to show as many as fit the width of the\n * carousel (the slides keep their own width, which must be equal). Previous, Next, the picker\n * (one button per page), looping and autoplay move by page, and the slides of the shown page\n * form one arrow-key focus group. With `1` each slide fills the width, as before.\n * @default 1\n */\n groupSize?: number | 'auto';\n /**\n * With `groupSize=\"auto\"`, where the shown page sits when its slides do not fill the width.\n * @default 'start'\n */\n align?: 'start' | 'center' | 'end';\n /**\n * Lets the pointer drag the slides (mouse, touch and pen). The track follows the pointer and,\n * on release, the page changes when the drag passed a quarter of the width or left fast, else\n * it snaps back; the direction follows the carousel's. Under `motion=\"fade\"` the slides do not\n * follow the pointer (they share one place): the same drag still changes the page on release,\n * and the slides cross-fade. The click that ends a drag is not delivered to the slide, and a\n * vertical swipe still scrolls the page. Dragging pauses autoplay like the pointer over the\n * carousel does. The buttons and the keyboard stay the way to operate the carousel without a\n * pointer.\n * @default false\n */\n draggable?: boolean;\n /**\n * Where the Previous and Next buttons go. `overlay` floats round buttons over the slides;\n * `overlay-wide` makes them full-height strips at the edges; `inline` puts them in a row with\n * the slides, outside them; `inline-wide` is `inline` with full-height buttons. The rotation\n * control stays the first focusable element at the start corner in every layout.\n * @default 'overlay'\n */\n controlsLayout?: CarouselControlsLayout;\n /**\n * `elevated` rounds the corners and adds a shadow.\n * @default 'flat'\n */\n appearance?: CarouselAppearance;\n /**\n * Rotates the slides automatically. A Pause/Start control is rendered as the first focusable\n * element. Rotation pauses while focus is anywhere inside the carousel (the control included;\n * clicking a control also moves focus there in most browsers) or the pointer is over it (except\n * over the control), and resumes when they leave, unless rotation is stopped. Activating Start\n * rotates at once, also while focus stays on the control; moving focus on to other content\n * pauses again. It starts stopped when the user prefers reduced motion. Without `loop`, rotation\n * ends at the last slide: the control shows Start, and rotation stays stopped (also after the\n * user moves back to an earlier slide) until Start is activated, which continues from the shown\n * slide, or from the first one while the last is shown. The end is tied to its cause: when the\n * number of slides changes (slides loaded later) or `loop` is turned on, rotation continues on\n * its own, unless the user stopped it with Pause.\n * @default false\n */\n autoPlay?: boolean;\n /** Interval in milliseconds between auto-play transitions.\n * @default 5000\n */\n autoPlayInterval?: number;\n /** Accessible names of the rotation control. */\n autoPlayLabels?: CarouselAutoPlayLabels;\n /**\n * Accessible names of the Previous and Next buttons, the slide picker and the slides (also\n * announced by the live region), and the role descriptions of the carousel and its slides, for\n * localization. Unset members keep their English defaults.\n */\n labels?: CarouselLabels;\n /** Whether the carousel loops back to the first slide after the last.\n * @default false\n */\n loop?: boolean;\n /**\n * How the carousel moves between pages: `slide` glides the slides in from the side of the page\n * order (mirrored in right-to-left layouts), `fade` cross-fades them in place, and `null` turns\n * the motion off (the page changes at once). Fluent's `motion`; its object form with a\n * `duration` is not offered: use `motionDuration`. `fade` needs one slide per page: with\n * `groupSize` above 1 or `'auto'` the slides slide, and a development warning says so. Under\n * `fade` a drag still changes the page on release, but the slides do not follow the pointer.\n * Below a `WaveProvider` with `motion=\"none\"` the carousel does not move unless this prop is\n * set. Either motion is off while the user prefers reduced motion. The root renders the motion\n * it resolves from this prop, `groupSize` and the provider as `data-motion` (`slide`, `fade` or\n * `none`); reduced motion leaves it unchanged.\n * @default 'slide'\n */\n motion?: CarouselMotion | null;\n /**\n * How long the slide or the fade takes, in milliseconds. Fluent's `duration` is a different\n * unit (Embla's unitless speed, 20 to 60), so a value ported from Fluent is far too short.\n * @default 300\n */\n motionDuration?: number;\n ref?: React.Ref<HTMLDivElement>;\n}\n\n/** Properties for the CarouselItem sub-component. */\nexport interface CarouselItemProps extends React.HTMLAttributes<HTMLDivElement> {\n /**\n * An image for this slide's button in the picker, in place of the dot. A string is the image\n * `src`; an object sets the `<img>`'s attributes. The button keeps its slide-label name, so the\n * image is decorative (`alt=\"\"`). When any slide has one, the picker becomes a row of\n * thumbnails below the slides; a slide without one keeps its dot. With `groupSize` above 1, a\n * page shows the thumbnail of its first slide.\n */\n thumbnail?: Slot<'img'>;\n ref?: React.Ref<HTMLDivElement>;\n}\n\nconst DEFAULT_PAUSE_LABEL = 'Pause slide rotation';\nconst DEFAULT_PLAY_LABEL = 'Start slide rotation';\nconst DEFAULT_PREVIOUS_LABEL = 'Previous slide';\nconst DEFAULT_NEXT_LABEL = 'Next slide';\nconst DEFAULT_PICKER_LABEL = 'Choose slide';\nconst defaultSlideLabel = (index: number, total: number) => `Slide ${index + 1} of ${total}`;\nconst DEFAULT_CAROUSEL_ROLE_DESCRIPTION = 'carousel';\nconst DEFAULT_SLIDE_ROLE_DESCRIPTION = 'slide';\n/** The default `motionDuration`: the slow duration token, which the motion classes carry. */\nconst DEFAULT_MOTION_DURATION = 300;\n\nconst defaultSlidesLabel = (start: number, end: number, total: number) =>\n `Slides ${start} to ${end} of ${total}`;\n\n/**\n * With `groupSize=\"auto\"`: how many slides fit the width of the carousel, from the width of the\n * first slide, and the two widths. A snapshot string (`perPage:slideWidth:rootWidth`) so that\n * `useSyncExternalStore` compares it by value; one slide per page before anything is measured.\n */\nfunction useAutoPageSize(\n enabled: boolean,\n root: HTMLElement | null,\n slide: HTMLElement | null,\n): { perPage: number; slideWidth: number; rootWidth: number } {\n const subscribe = React.useCallback(\n (notify: () => void) => {\n if (!enabled || !root || typeof ResizeObserver === 'undefined') return () => {};\n const observer = new ResizeObserver(notify);\n observer.observe(root);\n if (slide) observer.observe(slide);\n return () => observer.disconnect();\n },\n [enabled, root, slide],\n );\n const getSnapshot = () => {\n if (!enabled || !root || !slide) return '1:0:0';\n const slideWidth = slide.offsetWidth;\n const rootWidth = root.clientWidth;\n const perPage = slideWidth > 0 ? Math.max(1, Math.floor(rootWidth / slideWidth)) : 1;\n return `${perPage}:${slideWidth}:${rootWidth}`;\n };\n const snapshot = React.useSyncExternalStore(subscribe, getSnapshot, () => '1:0:0');\n const [perPage, slideWidth, rootWidth] = snapshot.split(':').map(Number) as [\n number,\n number,\n number,\n ];\n return { perPage, slideWidth, rootWidth };\n}\n\n/**\n * The motion a carousel asks for: its own `motion` (`null` none), else none below a provider that\n * turns motion off, else the slide.\n */\nfunction requestedCarouselMotion(\n motion: CarouselMotion | null | undefined,\n preference: MotionPreference,\n): CarouselMotion | 'none' {\n if (motion === undefined) return preference === 'none' ? 'none' : 'slide';\n if (motion === null) return 'none';\n return motion === 'fade' ? 'fade' : 'slide';\n}\n\nfunction isRotationControl(target: EventTarget | null): boolean {\n return target instanceof Element && target.closest('[data-carousel-rotation]') !== null;\n}\n\n/** The `<img>` slot of a thumbnail: a string is its `src`. */\nfunction thumbnailSlot(thumbnail: Slot<'img'>): Slot<'img'> {\n return typeof thumbnail === 'string' ? { src: thumbnail } : thumbnail;\n}\n\nconst PauseGlyph = () => (\n <svg width=\"16\" height=\"16\" viewBox=\"0 0 16 16\" fill=\"currentColor\" aria-hidden=\"true\">\n <rect x=\"4\" y=\"3\" width=\"3\" height=\"10\" rx=\"1\" />\n <rect x=\"9\" y=\"3\" width=\"3\" height=\"10\" rx=\"1\" />\n </svg>\n);\n\nconst PlayGlyph = () => (\n <svg width=\"16\" height=\"16\" viewBox=\"0 0 16 16\" fill=\"currentColor\" aria-hidden=\"true\">\n <path d=\"M5 3.5v9a.5.5 0 0 0 .77.42l7-4.5a.5.5 0 0 0 0-.84l-7-4.5A.5.5 0 0 0 5 3.5Z\" />\n </svg>\n);\n\n// The Carousel root, documented on the exported `Carousel` const.\nconst CarouselRoot = ({\n value: controlledValue,\n defaultValue = 0,\n onValueChange,\n autoPlay = false,\n autoPlayInterval = 5000,\n autoPlayLabels,\n labels,\n loop = false,\n groupSize = 1,\n align = 'start',\n draggable = false,\n controlsLayout = 'overlay',\n appearance = 'flat',\n motion,\n motionDuration = DEFAULT_MOTION_DURATION,\n className,\n children,\n onMouseEnter,\n onMouseLeave,\n onFocus,\n onBlur,\n ref,\n ...rest\n}: CarouselProps) => {\n const [storedIndex, setActiveIndex] = useControllable(\n controlledValue,\n defaultValue,\n onValueChange,\n );\n const trackId = useId('carousel-slides');\n const [rootEl, setRootEl] = React.useState<HTMLDivElement | null>(null);\n const rootRef = useMergedRefs<HTMLDivElement>(ref, setRootEl);\n // The direction that applies to the rendered root (its own or an ancestor's `dir`, e.g. an RTL\n // section inside an LTR WaveProvider); before mount and on the server, the provider's/document's.\n const renderedDir = useDirection(rootEl);\n const dir = rest.dir === 'rtl' || rest.dir === 'ltr' ? rest.dir : renderedDir;\n const prefersReducedMotion = usePrefersReducedMotion();\n const [firstSlideEl, setFirstSlideEl] = React.useState<HTMLElement | null>(null);\n const [trackEl, setTrackEl] = React.useState<HTMLElement | null>(null);\n const [viewportEl, setViewportEl] = React.useState<HTMLElement | null>(null);\n const auto = groupSize === 'auto';\n const measured = useAutoPageSize(auto, viewportEl, firstSlideEl);\n const size = auto ? measured.perPage : Math.max(1, Math.floor(groupSize) || 1);\n\n // The motion: the carousel's own, else none under a provider that turns motion off, else the\n // slide. A fade needs one slide per page, so pages of several slides slide (warned below).\n const requestedMotion = requestedCarouselMotion(motion, useMotionPreference());\n const fadeFallback = requestedMotion === 'fade' && (auto || size > 1);\n const resolvedMotion = fadeFallback ? 'slide' : requestedMotion;\n\n React.useEffect(() => {\n if (fadeFallback) {\n warnOnce(\n 'Carousel:fade-group',\n 'Carousel: `motion=\"fade\"` needs one slide per page; with `groupSize` above 1 or ' +\n '`\"auto\"` the slides slide.',\n );\n }\n }, [fadeFallback]);\n\n // Rotation state: stopped or not (the user's choice, stopped by default under reduced motion, or\n // ended at the last slide without loop) and the temporary pauses while the pointer is over the\n // content or focus is inside. An explicit Start overrides the focus pause while focus stays on\n // the rotation control (APG `hasUserActivatedPlay`), so pressing Start visibly starts the\n // rotation.\n const [userPaused, setUserPaused] = React.useState<boolean | null>(null);\n // The slide count at which rotation ended at the last slide (null while it has not ended), kept\n // apart from the user's choice so the end lasts only while its cause does.\n const [endedAt, setEndedAt] = React.useState<number | null>(null);\n const [hovered, setHovered] = React.useState(false);\n const [pointerOnControl, setPointerOnControl] = React.useState(false);\n const [focusWithin, setFocusWithin] = React.useState(false);\n const [startedFromControl, setStartedFromControl] = React.useState(false);\n\n // Slides are the `CarouselItem` children, Fragments flattened; the element type is unwrapped, so\n // slides written in a Server Component (lazy client references) count too (C-COMPOUND).\n const items: Array<{ key: string; node: React.ReactNode; thumbnail?: Slot<'img'> }> = [];\n // A `Carousel.Button` of each direction replaces the built-in button; a second one of the same\n // direction is not rendered.\n const customButtons: { previous?: React.ReactElement; next?: React.ReactElement } = {};\n let droppedChildren = false;\n for (const child of flattenChildren(children)) {\n if (isElementOfType<CarouselItemProps>(child.node, CarouselItem)) {\n items.push({ ...child, thumbnail: child.node.props.thumbnail });\n } else if (isElementOfType<{ direction?: 'previous' | 'next' }>(child.node, CarouselButton)) {\n const direction = child.node.props.direction === 'next' ? 'next' : 'previous';\n if (customButtons[direction]) droppedChildren = true;\n else customButtons[direction] = React.cloneElement(child.node, { key: child.key });\n } else if (slotRendersContent(child.node)) droppedChildren = true;\n }\n const hasThumbnails = items.some((item) => item.thumbnail !== undefined);\n const total = items.length;\n\n React.useEffect(() => {\n if (droppedChildren) {\n warnOnce(\n 'Carousel:non-item-children',\n 'Carousel: only `Carousel.Item` (`CarouselItem`) children are slides, directly or in ' +\n 'Fragments; other children are not rendered. A component that renders `Carousel.Item` ' +\n 'itself is not recognised: render the `Carousel.Item` in the Carousel and put the ' +\n 'component inside it.',\n );\n }\n }, [droppedChildren]);\n\n // Derived during render (C-HOOKS): removed slides or an out-of-range value show the nearest one.\n const index = clampToPage(storedIndex, size, total);\n const pages = pageCount(total, size);\n const lastStart = lastPageStart(total, size);\n const atStart = index <= 0;\n const atEnd = index >= lastStart;\n const prevDisabled = pages <= 1 || (!loop && atStart);\n const nextDisabled = pages <= 1 || (!loop && atEnd);\n\n // Without loop, rotation ends at the last slide (however it got there) and stays stopped: moving\n // back to an earlier slide does not restart it, only Start does. The end applies to the slide\n // count it happened at: once slides are added or removed, or loop is turned on, it is dropped\n // and rotation continues unless the user stopped it (adjusting state during render, C-HOOKS).\n const ended = endedAt === total && !loop;\n const stopped = (userPaused ?? prefersReducedMotion) || ended;\n const hasRotation = autoPlay && pages > 1;\n if (hasRotation && !loop && atEnd && !stopped) setEndedAt(total);\n else if (endedAt !== null && !ended) setEndedAt(null);\n // A release moves one page towards the drag; past the ends it only loops with `loop`.\n const drag = useCarouselDrag({\n enabled: draggable && pages > 1,\n dir,\n onCommit: (delta) => {\n if (delta === 1) {\n if (!atEnd) goTo(index + size);\n else if (loop) goTo(0);\n } else if (delta === -1) {\n if (!atStart) goTo(index - size);\n else if (loop) goTo(lastStart);\n }\n },\n });\n const pausedByPointer = (hovered && !pointerOnControl) || drag.dragging;\n const pausedByFocus = focusWithin && !startedFromControl;\n const rotating = hasRotation && !stopped && !pausedByPointer && !pausedByFocus;\n\n // Compares with the shown (clamped) index, so re-picking the visible slide reports nothing.\n const goTo = (target: number) => {\n if (target >= 0 && target < total && target !== index) setActiveIndex(target);\n };\n const goPrev = () => goTo(atStart ? lastStart : index - size);\n const goNext = () => goTo(atEnd ? 0 : index + size);\n\n // Reads the latest index at tick time (the updater's base), so the interval does not restart on\n // every slide or parent render and consecutive ticks chain even before a re-render.\n const advance = useEventCallback(() => {\n setActiveIndex((prev) => {\n const current = clampToPage(prev, size, total);\n if (current < lastStart) return current + size;\n return loop ? 0 : prev;\n });\n });\n\n React.useEffect(() => {\n if (!rotating) return;\n const id = setInterval(advance, autoPlayInterval);\n return () => clearInterval(id);\n }, [rotating, autoPlayInterval, advance]);\n\n const toggleRotation = () => {\n if (stopped) {\n // Start: from the first slide when rotation had ended at the last one.\n if (!loop && atEnd) goTo(0);\n setEndedAt(null);\n setUserPaused(false);\n setStartedFromControl(true);\n } else {\n setUserPaused(true);\n setStartedFromControl(false);\n }\n };\n\n // The consumer's pointer and focus handlers composed with the pause tracking (C-COMPOSE). The\n // empty root gets them too: the consumer's handlers still run, and a pointer or focus that leaves\n // while there are no slides (slides being reloaded) does not keep rotation paused afterwards.\n const rootHandlers = {\n onMouseEnter: composeEventHandlers(onMouseEnter, () => setHovered(true)),\n onMouseLeave: composeEventHandlers(onMouseLeave, () => setHovered(false)),\n onFocus: composeEventHandlers(onFocus, (event: React.FocusEvent<HTMLDivElement>) => {\n // Any focus inside pauses (APG), the rotation control included. Focus that enters from\n // outside or moves on to other content ends the exemption of an explicit Start.\n const from = event.relatedTarget;\n const entering = !(from instanceof Node && event.currentTarget.contains(from));\n setFocusWithin(true);\n if (entering || !isRotationControl(event.target)) setStartedFromControl(false);\n }),\n onBlur: composeEventHandlers(onBlur, (event: React.FocusEvent<HTMLDivElement>) => {\n const next = event.relatedTarget;\n if (!(next instanceof Node && event.currentTarget.contains(next))) {\n setFocusWithin(false);\n setStartedFromControl(false);\n }\n }),\n };\n\n // The slides of the shown page form one arrow-key focus group (groupSize above 1). Only they\n // carry a roving value; the others are inert.\n const grouped = size > 1;\n const pageEnd = Math.min(index + size, total);\n const visibleValues = React.useMemo(\n () => (grouped ? Array.from({ length: pageEnd - index }, (_, k) => String(index + k)) : []),\n [grouped, index, pageEnd],\n );\n const roving = useRovingTabIndex({\n items: visibleValues,\n activeValue: String(index),\n orientation: 'horizontal',\n loop: false,\n dir,\n tabStop: 'last-focused',\n });\n const trackRef = useMergedRefs<HTMLDivElement>(roving.containerProps.ref, setTrackEl);\n // Which slide of the new page takes focus after an arrow past the end of a page.\n const pendingFocus = React.useRef<'first' | 'last' | null>(null);\n React.useLayoutEffect(() => {\n const pending = pendingFocus.current;\n if (!pending || !trackEl) return;\n pendingFocus.current = null;\n const target = pending === 'first' ? index : pageEnd - 1;\n trackEl.querySelector<HTMLElement>(`[data-roving-value=\"${target}\"]`)?.focus();\n }, [index, pageEnd, trackEl]);\n const handleTrackKeyDown = (event: React.KeyboardEvent<HTMLElement>) => {\n const slideIndex = (event.target as HTMLElement).getAttribute('data-roving-value');\n const intent = getArrowIntent(event.key, { orientation: 'horizontal', dir });\n if (\n slideIndex !== null &&\n intent &&\n !event.defaultPrevented &&\n !event.altKey &&\n !event.ctrlKey &&\n !event.metaKey\n ) {\n const current = Number(slideIndex);\n if (intent === 'next' && current === pageEnd - 1) {\n event.preventDefault();\n if (!nextDisabled) {\n pendingFocus.current = 'first';\n goNext();\n }\n return;\n }\n if (intent === 'prev' && current === index) {\n event.preventDefault();\n if (!prevDisabled) {\n pendingFocus.current = 'last';\n goPrev();\n }\n return;\n }\n }\n roving.containerProps.onKeyDown(event);\n };\n\n const previousLabel = labels?.previous ?? DEFAULT_PREVIOUS_LABEL;\n const nextLabel = labels?.next ?? DEFAULT_NEXT_LABEL;\n const goPrevious = useEventCallback(() => goPrev());\n const goToNext = useEventCallback(() => goNext());\n // What `Carousel.Button` reads (C-MEMO).\n const context = React.useMemo<CarouselContextValue>(\n () => ({\n trackId,\n previousLabel,\n nextLabel,\n previousDisabled: prevDisabled,\n nextDisabled,\n goPrevious,\n goNext: goToNext,\n controlsLayout,\n dir,\n }),\n [\n trackId,\n previousLabel,\n nextLabel,\n prevDisabled,\n nextDisabled,\n goPrevious,\n goToNext,\n controlsLayout,\n dir,\n ],\n );\n\n if (total === 0) {\n return (\n <div\n ref={rootRef}\n data-controls-layout={controlsLayout}\n data-appearance={appearance}\n data-motion={resolvedMotion}\n className={cn(carouselClassNames.root, 'relative', className)}\n {...rootHandlers}\n {...rest}\n />\n );\n }\n\n const sign = dir === 'rtl' ? 1 : -1;\n // A page is as wide as the carousel: the track moves by pages. With `auto` the slides keep their\n // own width and the track moves by whole slides, in pixels, plus the alignment of the page.\n let transform = `translateX(${sign * (index / size) * 100}%)`;\n if (drag.offsetPx !== 0) {\n transform = `translateX(calc(${sign * (index / size) * 100}% + ${drag.offsetPx}px))`;\n }\n if (auto) {\n const leftover = Math.max(0, measured.rootWidth - size * measured.slideWidth);\n const alignShift = align === 'center' ? leftover / 2 : align === 'end' ? leftover : 0;\n const px = sign * index * measured.slideWidth + (dir === 'rtl' ? -alignShift : alignShift);\n transform = `translateX(${px + drag.offsetPx + 0}px)`;\n }\n // The slide moves the track; the fade stacks the slides in the track's one cell and hides the\n // inactive ones by their opacity (they are inert either way), with no transform, so a drag\n // pages on release but the slides do not follow the pointer. The track's transition is off\n // while it follows a drag.\n const fading = resolvedMotion === 'fade';\n const trackMoves = resolvedMotion === 'slide' && !drag.dragging;\n // A `motionDuration` other than the motion classes' own is an inline duration on the element\n // that transitions (D4), written only while that element has its transition: without a\n // property list, an inline duration would time every property.\n const durationStyle =\n motionDuration === DEFAULT_MOTION_DURATION\n ? undefined\n : { transitionDuration: `${motionDuration}ms` };\n // A slide is as wide as its content (`auto`), the viewport (one per page) or its share of it;\n // under the fade it fills the track's one cell, which every slide shares.\n const slideLayout = fading\n ? 'col-start-1 row-start-1'\n : auto\n ? 'w-auto shrink-0'\n : size === 1\n ? 'w-full shrink-0'\n : 'shrink-0';\n const slideWidth = !auto && size > 1 ? { width: `calc(100% / ${size})` } : undefined;\n const slidesLabel = labels?.slides ?? defaultSlidesLabel;\n /** The name of the page that starts at `start`: its slides, or the one slide it holds. */\n const pageLabel = (start: number) => {\n const end = Math.min(start + size, total);\n return end - start === 1 ? slideLabel(start, total) : slidesLabel(start + 1, end, total);\n };\n // The chevrons mirror by the same resolved direction as the track. A CSS `rtl:` variant would\n // also match `[dir=rtl] *`, so an LTR carousel inside an RTL ancestor got mirrored chevrons.\n const chevronClass = dir === 'rtl' ? '-scale-x-100' : undefined;\n const pauseLabel = autoPlayLabels?.pause ?? DEFAULT_PAUSE_LABEL;\n const playLabel = autoPlayLabels?.play ?? DEFAULT_PLAY_LABEL;\n const pickerLabel = labels?.picker ?? DEFAULT_PICKER_LABEL;\n const slideLabel = labels?.slide ?? defaultSlideLabel;\n const carouselRoleDescription =\n labels?.carouselRoleDescription ?? DEFAULT_CAROUSEL_ROLE_DESCRIPTION;\n const slideRoleDescription = labels?.slideRoleDescription ?? DEFAULT_SLIDE_ROLE_DESCRIPTION;\n\n const inline = controlsLayout === 'inline' || controlsLayout === 'inline-wide';\n const layoutClasses = CAROUSEL_CONTROL_LAYOUT[controlsLayout];\n const previousControl = customButtons.previous ?? (\n <button\n key=\"previous\"\n type=\"button\"\n aria-label={previousLabel}\n aria-controls={trackId}\n {...focusableDisabledProps(prevDisabled)}\n onClick={preventIfDisabled(prevDisabled, goPrev)}\n className={cn(\n carouselClassNames.previousButton,\n CAROUSEL_CONTROL_BASE,\n layoutClasses.previous,\n )}\n >\n <ChevronLeftIcon size={16} className={chevronClass} />\n </button>\n );\n const nextControl = customButtons.next ?? (\n <button\n key=\"next\"\n type=\"button\"\n aria-label={nextLabel}\n aria-controls={trackId}\n {...focusableDisabledProps(nextDisabled)}\n onClick={preventIfDisabled(nextDisabled, goNext)}\n className={cn(carouselClassNames.nextButton, CAROUSEL_CONTROL_BASE, layoutClasses.next)}\n >\n <ChevronRightIcon size={16} className={chevronClass} />\n </button>\n );\n\n const viewport = (\n <div\n ref={setViewportEl}\n className={cn(carouselClassNames.viewport, 'relative min-w-0 flex-1 overflow-hidden')}\n >\n <div\n id={trackId}\n className={cn(\n carouselClassNames.track,\n // One column with a zero minimum: the slides keep the viewport's width, whatever their\n // content's longest line.\n fading ? 'grid grid-cols-[minmax(0,1fr)]' : 'flex',\n trackMoves && carouselSlideMotion,\n // Horizontal pointer moves belong to the drag; a vertical swipe still scrolls the page.\n draggable && 'touch-pan-y',\n )}\n style={fading ? undefined : { transform, ...(trackMoves ? durationStyle : undefined) }}\n data-dragging={drag.dragging ? '' : undefined}\n {...drag.handlers}\n {...(grouped ? roving.containerProps : null)}\n ref={grouped ? trackRef : setTrackEl}\n onKeyDown={grouped ? handleTrackKeyDown : undefined}\n >\n {items.map(({ key, node }, i) => {\n const active = i >= index && i < index + size;\n return (\n <div\n key={key}\n ref={i === 0 ? setFirstSlideEl : undefined}\n role=\"group\"\n aria-roledescription={slideRoleDescription}\n aria-label={slideLabel(i, total)}\n aria-hidden={active ? undefined : true}\n inert={!active}\n data-roving-value={grouped && active ? String(i) : undefined}\n tabIndex={grouped && active ? roving.getTabIndex(String(i)) : undefined}\n className={cn(\n carouselClassNames.slide,\n slideLayout,\n fading && carouselFadeMotion,\n fading && !active && 'opacity-0',\n grouped &&\n 'focus-visible:outline-2 focus-visible:-outline-offset-2 focus-visible:outline-ring',\n )}\n style={fading ? durationStyle : slideWidth}\n >\n {node}\n </div>\n );\n })}\n </div>\n {/* Overlaid on the slides, after them in the tab order, like before the layouts. */}\n {!inline && previousControl}\n {!inline && nextControl}\n </div>\n );\n\n return (\n <CarouselContext.Provider value={context}>\n <div\n ref={rootRef}\n role=\"region\"\n aria-roledescription={carouselRoleDescription}\n aria-label=\"Carousel\"\n data-controls-layout={controlsLayout}\n data-appearance={appearance}\n data-motion={resolvedMotion}\n // A stacking context of its own: the controls' z-index cannot lift them over page headers.\n className={cn(\n carouselClassNames.root,\n 'relative isolate overflow-hidden',\n appearance === 'elevated' && 'rounded-md shadow-4',\n className,\n )}\n {...rootHandlers}\n {...rest}\n >\n {hasRotation && (\n <button\n type=\"button\"\n data-carousel-rotation=\"\"\n aria-label={stopped ? playLabel : pauseLabel}\n aria-controls={trackId}\n onClick={toggleRotation}\n // The pointer over the control does not pause (APG): the user is operating it.\n onMouseEnter={() => setPointerOnControl(true)}\n onMouseLeave={() => setPointerOnControl(false)}\n className={cn(\n carouselClassNames.autoPlayButton,\n CAROUSEL_CONTROL_BASE,\n // Above the edge strips of the wide layouts, which would dim and cover it.\n 'absolute z-20 h-8 w-8 rounded-full border border-border bg-background shadow-2 top-2',\n // Over the viewport's corner: past the Previous button of an inline layout.\n inline ? 'start-12' : 'start-2',\n )}\n >\n {stopped ? <PlayGlyph /> : <PauseGlyph />}\n </button>\n )}\n {inline ? (\n <div className=\"flex items-stretch\">\n {previousControl}\n {viewport}\n {nextControl}\n </div>\n ) : (\n viewport\n )}\n {/* Announces the current slide, except while slides rotate on their own. */}\n <div aria-live={rotating ? 'off' : 'polite'} aria-atomic=\"true\" className=\"sr-only\">\n {pageLabel(index)}\n </div>\n <div\n role=\"group\"\n aria-label={pickerLabel}\n className={cn(\n carouselClassNames.picker,\n hasThumbnails\n ? 'relative mx-auto flex w-fit flex-wrap justify-center gap-2 p-2'\n : 'absolute inset-x-0 bottom-1 z-10 mx-auto flex w-fit',\n )}\n >\n {items\n .filter((_, i) => i % size === 0)\n .map(({ key, thumbnail }, page) => {\n const start = page * size;\n const active = start === index;\n return (\n <button\n key={key}\n type=\"button\"\n aria-label={pageLabel(start)}\n aria-current={active ? 'true' : undefined}\n onClick={() => goTo(start)}\n className={cn(\n carouselClassNames.pickerButton,\n 'group inline-flex items-center justify-center',\n thumbnail !== undefined ? 'rounded-md p-0.5' : 'h-6 min-w-6',\n focusRing,\n )}\n >\n {thumbnail !== undefined ? (\n renderSlot(\n thumbnailSlot(thumbnail),\n 'img',\n cn(\n carouselItemClassNames.thumbnail,\n 'block h-12 w-16 rounded object-cover',\n active\n ? cn('outline-2 outline-primary', forcedColors.selectedContainer)\n : 'opacity-70 group-hover:opacity-100',\n ),\n { alt: '', draggable: false },\n )\n ) : (\n <span\n aria-hidden=\"true\"\n className={cn(\n carouselClassNames.pickerIndicator,\n 'block h-2 rounded-full transition-[width,background-color] duration-200 motion-reduce:transition-none',\n active\n ? cn('w-5 bg-primary', forcedColors.selectedLeaf)\n : 'w-2 bg-stroke-accessible group-hover:bg-foreground forced-colors:bg-[ButtonText] forced-colors:forced-color-adjust-none',\n )}\n />\n )}\n </button>\n );\n })}\n </div>\n </div>\n </CarouselContext.Provider>\n );\n};\nCarouselRoot.displayName = 'Carousel';\n\n/**\n * One slide of a {@link Carousel}. Write it in the Carousel, directly or in a Fragment: a component\n * that renders `Carousel.Item` itself is not recognised as a slide (put that component inside the\n * `Carousel.Item` instead).\n */\nexport const CarouselItem = ({\n thumbnail: _thumbnail,\n className,\n children,\n ref,\n ...rest\n}: CarouselItemProps) => {\n return (\n <div ref={ref} className={cn(carouselItemClassNames.root, 'p-4', className)} {...rest}>\n {children}\n </div>\n );\n};\nCarouselItem.displayName = 'CarouselItem';\n\n/**\n * A slideshow that shows one slide at a time (WAI-ARIA APG carousel with previous/next buttons\n * and a slide picker).\n *\n * - Slides are the `Carousel.Item` (`CarouselItem`) children, written directly in the Carousel or\n * in Fragments. Other children are not rendered (a development warning says so). A component\n * that renders `Carousel.Item` itself is not recognised: write the `Carousel.Item` in the\n * Carousel and put the component inside it.\n * - Previous/Next stay focusable at the ends (`aria-disabled`), so keyboard focus is not lost.\n * - The slide picker is a group of buttons named \"Slide n of m\"; the active one has\n * `aria-current=\"true\"`.\n * - Inactive slides are `aria-hidden` and `inert`, so neither Tab nor a screen reader reaches\n * their content.\n * - With `autoPlay`, a Pause/Start control comes first (WAI-ARIA APG): rotation pauses while\n * focus is inside the carousel (in most browsers also after a click on one of its controls) or\n * the pointer is over its content, activating Start rotates at once, and the live region is\n * silent (`aria-live=\"off\"`) while slides rotate. Without `loop` rotation ends at the last slide\n * and stays stopped until the control's Start is activated (or the number of slides changes, or\n * `loop` is turned on).\n * - Right-to-left layouts slide the other way and mirror the Previous/Next chevrons: the direction\n * is read from the rendered element (its `dir` prop, the nearest ancestor's `dir`, WaveProvider\n * `dir` or the document's), so an LTR section inside an RTL page stays LTR throughout.\n * - Name the carousel with `aria-label` or `aria-labelledby` (the fallback name is \"Carousel\").\n * The built-in names and role descriptions are English: `labels` and `autoPlayLabels`\n * translate them.\n * - The controls are layered over the slides inside the carousel's own stacking context, so they\n * never paint over page headers that stay in view while the page scrolls.\n *\n * - `groupSize` shows several slides per page, `draggable` lets the pointer drag them, and a\n * `thumbnail` on a `Carousel.Item` turns the picker into a row of thumbnails.\n * - `controlsLayout` places the Previous and Next buttons over the slides (`overlay`,\n * `overlay-wide`) or beside them (`inline`, `inline-wide`); `Carousel.Button` replaces the\n * built-in button of its `direction` with one of your own glyph.\n * - The slides glide to the new page over 300 ms; `motion=\"fade\"` cross-fades them instead (one\n * slide per page), `motion={null}` turns the motion off and `motionDuration` times it. Under\n * reduced motion, or below a `WaveProvider` with `motion=\"none\"` (unless `motion` is set), the\n * page changes at once.\n *\n * Compound access (`Carousel.Item`, `Carousel.Button`) needs a client module; React Server\n * Components import the flat names `CarouselItem` and `CarouselButton` instead.\n */\nexport const Carousel = /* @__PURE__ */ Object.assign(CarouselRoot, {\n Item: CarouselItem,\n Button: CarouselButton,\n});\n"],"mappings":"8iCAwNA,IAAM0D,GAAsB,uBACtBC,GAAqB,uBACrBC,GAAyB,iBACzBC,GAAqB,aACrBC,GAAuB,eACvBC,IAAqB,EAAe,IAAkB,SAASC,EAAQ,EAAE,MAAMC,IAC/EC,GAAoC,WACpCC,GAAiC,QAEjCC,GAA0B,IAE1BC,IAAsB,EAAe,EAAa,IACtD,UAAUC,EAAM,MAAMC,EAAI,MAAMN,IAOlC,SAASO,GACP,EACA,EACA,EAC4D,CAC5D,IAAMC,EAAYzE,EAAM,YACrB,GAAuB,CACtB,GAAI,CAAC0E,GAAW,CAACC,GAAQ,OAAO,eAAmB,IAAa,UAAa,CAAC,EAC9E,IAAMC,EAAW,IAAI,eAAeC,CAAM,EAG1C,OAFAD,EAAS,QAAQD,CAAI,EACjBG,GAAOF,EAAS,QAAQE,CAAK,MACpBF,EAAS,WAAW,CACnC,EACA,CAACF,EAASC,EAAMG,CAAK,CACvB,EASM,CAACC,EAASC,EAAYC,GADXjF,EAAM,qBAAqByE,MAPlB,CACxB,GAAI,CAACC,GAAW,CAACC,GAAQ,CAACG,EAAO,MAAO,QACxC,IAAME,EAAaF,EAAM,YACnBG,EAAYN,EAAK,YAEvB,MAAO,GADSK,EAAa,EAAI,KAAK,IAAI,EAAG,KAAK,MAAMC,EAAYD,CAAU,CAAC,EAAI,EACjE,GAAGA,EAAW,GAAGC,GACrC,MAC0E,OACjC,CAAA,CAAS,MAAM,GAAG,CAAC,CAAC,IAAI,MAAM,EAKvE,MAAO,CAAE,UAAS,aAAY,WAAU,CAC1C,CAMA,SAASC,GACP,EACA,EACyB,CAGzB,OAFIC,IAAW,IAAA,GAAkBC,IAAe,OAAS,OAAS,QAC9DD,IAAW,KAAa,OACrBA,IAAW,OAAS,OAAS,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