@mortenbrudvik/waveui 0.10.0 → 0.11.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 (184) hide show
  1. package/README.md +357 -72
  2. package/dist/components/button/Toolbar.cjs +1 -1
  3. package/dist/components/button/Toolbar.cjs.map +1 -1
  4. package/dist/components/button/Toolbar.mjs +25 -30
  5. package/dist/components/button/Toolbar.mjs.map +1 -1
  6. package/dist/components/button/Toolbar.navigation.cjs +2 -0
  7. package/dist/components/button/Toolbar.navigation.cjs.map +1 -0
  8. package/dist/components/button/Toolbar.navigation.mjs +17 -0
  9. package/dist/components/button/Toolbar.navigation.mjs.map +1 -0
  10. package/dist/components/data-display/Avatar.cjs +1 -1
  11. package/dist/components/data-display/Avatar.cjs.map +1 -1
  12. package/dist/components/data-display/Avatar.context.cjs +2 -0
  13. package/dist/components/data-display/Avatar.context.cjs.map +1 -0
  14. package/dist/components/data-display/Avatar.context.mjs +9 -0
  15. package/dist/components/data-display/Avatar.context.mjs.map +1 -0
  16. package/dist/components/data-display/Avatar.mjs +66 -61
  17. package/dist/components/data-display/Avatar.mjs.map +1 -1
  18. package/dist/components/data-display/InteractionTag.cjs +2 -0
  19. package/dist/components/data-display/InteractionTag.cjs.map +1 -0
  20. package/dist/components/data-display/InteractionTag.mjs +234 -0
  21. package/dist/components/data-display/InteractionTag.mjs.map +1 -0
  22. package/dist/components/data-display/Tag.cjs +1 -1
  23. package/dist/components/data-display/Tag.cjs.map +1 -1
  24. package/dist/components/data-display/Tag.mjs +222 -90
  25. package/dist/components/data-display/Tag.mjs.map +1 -1
  26. package/dist/components/data-display/TagGroup.cjs +2 -0
  27. package/dist/components/data-display/TagGroup.cjs.map +1 -0
  28. package/dist/components/data-display/TagGroup.context.cjs +2 -0
  29. package/dist/components/data-display/TagGroup.context.cjs.map +1 -0
  30. package/dist/components/data-display/TagGroup.context.mjs +113 -0
  31. package/dist/components/data-display/TagGroup.context.mjs.map +1 -0
  32. package/dist/components/data-display/TagGroup.mjs +149 -0
  33. package/dist/components/data-display/TagGroup.mjs.map +1 -0
  34. package/dist/components/data-display/tagStyles.cjs +2 -0
  35. package/dist/components/data-display/tagStyles.cjs.map +1 -0
  36. package/dist/components/data-display/tagStyles.mjs +108 -0
  37. package/dist/components/data-display/tagStyles.mjs.map +1 -0
  38. package/dist/components/feedback/Toaster.cjs +1 -1
  39. package/dist/components/feedback/Toaster.cjs.map +1 -1
  40. package/dist/components/feedback/Toaster.mjs +213 -181
  41. package/dist/components/feedback/Toaster.mjs.map +1 -1
  42. package/dist/components/input/Combobox.expand.cjs +1 -1
  43. package/dist/components/input/Combobox.expand.cjs.map +1 -1
  44. package/dist/components/input/Combobox.expand.mjs +7 -7
  45. package/dist/components/input/Combobox.expand.mjs.map +1 -1
  46. package/dist/components/input/Option.cjs +1 -1
  47. package/dist/components/input/Option.cjs.map +1 -1
  48. package/dist/components/input/Option.mjs +16 -11
  49. package/dist/components/input/Option.mjs.map +1 -1
  50. package/dist/components/input/SwatchPicker.cjs.map +1 -1
  51. package/dist/components/input/SwatchPicker.context.cjs.map +1 -1
  52. package/dist/components/input/SwatchPicker.context.mjs.map +1 -1
  53. package/dist/components/input/SwatchPicker.mjs.map +1 -1
  54. package/dist/components/input/TagPicker.cjs +1 -1
  55. package/dist/components/input/TagPicker.cjs.map +1 -1
  56. package/dist/components/input/TagPicker.context.cjs +2 -0
  57. package/dist/components/input/TagPicker.context.cjs.map +1 -0
  58. package/dist/components/input/TagPicker.context.mjs +20 -0
  59. package/dist/components/input/TagPicker.context.mjs.map +1 -0
  60. package/dist/components/input/TagPicker.create.cjs +2 -0
  61. package/dist/components/input/TagPicker.create.cjs.map +1 -0
  62. package/dist/components/input/TagPicker.create.mjs +24 -0
  63. package/dist/components/input/TagPicker.create.mjs.map +1 -0
  64. package/dist/components/input/TagPicker.mjs +13 -279
  65. package/dist/components/input/TagPicker.mjs.map +1 -1
  66. package/dist/components/input/TagPicker.option.cjs +2 -0
  67. package/dist/components/input/TagPicker.option.cjs.map +1 -0
  68. package/dist/components/input/TagPicker.option.mjs +45 -0
  69. package/dist/components/input/TagPicker.option.mjs.map +1 -0
  70. package/dist/components/input/TagPicker.overflow.cjs +2 -0
  71. package/dist/components/input/TagPicker.overflow.cjs.map +1 -0
  72. package/dist/components/input/TagPicker.overflow.mjs +153 -0
  73. package/dist/components/input/TagPicker.overflow.mjs.map +1 -0
  74. package/dist/components/input/TagPicker.parts.cjs +2 -0
  75. package/dist/components/input/TagPicker.parts.cjs.map +1 -0
  76. package/dist/components/input/TagPicker.parts.mjs +425 -0
  77. package/dist/components/input/TagPicker.parts.mjs.map +1 -0
  78. package/dist/components/input/TagPicker.root.cjs +2 -0
  79. package/dist/components/input/TagPicker.root.cjs.map +1 -0
  80. package/dist/components/input/TagPicker.root.mjs +416 -0
  81. package/dist/components/input/TagPicker.root.mjs.map +1 -0
  82. package/dist/components/layout/Accordion.cjs.map +1 -1
  83. package/dist/components/layout/Accordion.mjs.map +1 -1
  84. package/dist/components/navigation/Hamburger.cjs +2 -0
  85. package/dist/components/navigation/Hamburger.cjs.map +1 -0
  86. package/dist/components/navigation/Hamburger.mjs +54 -0
  87. package/dist/components/navigation/Hamburger.mjs.map +1 -0
  88. package/dist/components/navigation/Nav.cjs +1 -1
  89. package/dist/components/navigation/Nav.cjs.map +1 -1
  90. package/dist/components/navigation/Nav.context.cjs +2 -0
  91. package/dist/components/navigation/Nav.context.cjs.map +1 -0
  92. package/dist/components/navigation/Nav.context.mjs +137 -0
  93. package/dist/components/navigation/Nav.context.mjs.map +1 -0
  94. package/dist/components/navigation/Nav.mjs +151 -258
  95. package/dist/components/navigation/Nav.mjs.map +1 -1
  96. package/dist/components/navigation/Nav.parts.cjs +2 -0
  97. package/dist/components/navigation/Nav.parts.cjs.map +1 -0
  98. package/dist/components/navigation/Nav.parts.mjs +77 -0
  99. package/dist/components/navigation/Nav.parts.mjs.map +1 -0
  100. package/dist/components/navigation/Nav.root.cjs +2 -0
  101. package/dist/components/navigation/Nav.root.cjs.map +1 -0
  102. package/dist/components/navigation/Nav.root.mjs +78 -0
  103. package/dist/components/navigation/Nav.root.mjs.map +1 -0
  104. package/dist/components/navigation/NavDrawer.cjs +2 -0
  105. package/dist/components/navigation/NavDrawer.cjs.map +1 -0
  106. package/dist/components/navigation/NavDrawer.context.cjs +2 -0
  107. package/dist/components/navigation/NavDrawer.context.cjs.map +1 -0
  108. package/dist/components/navigation/NavDrawer.context.mjs +11 -0
  109. package/dist/components/navigation/NavDrawer.context.mjs.map +1 -0
  110. package/dist/components/navigation/NavDrawer.mjs +179 -0
  111. package/dist/components/navigation/NavDrawer.mjs.map +1 -0
  112. package/dist/components/overlays/Dialog.cjs +1 -1
  113. package/dist/components/overlays/Dialog.cjs.map +1 -1
  114. package/dist/components/overlays/Dialog.mjs +190 -125
  115. package/dist/components/overlays/Dialog.mjs.map +1 -1
  116. package/dist/components/overlays/Dialog.shared.cjs +1 -1
  117. package/dist/components/overlays/Dialog.shared.cjs.map +1 -1
  118. package/dist/components/overlays/Dialog.shared.mjs +157 -81
  119. package/dist/components/overlays/Dialog.shared.mjs.map +1 -1
  120. package/dist/components/overlays/Dialog.slots.cjs +2 -0
  121. package/dist/components/overlays/Dialog.slots.cjs.map +1 -0
  122. package/dist/components/overlays/Dialog.slots.mjs +129 -0
  123. package/dist/components/overlays/Dialog.slots.mjs.map +1 -0
  124. package/dist/components/overlays/Drawer.cjs +1 -1
  125. package/dist/components/overlays/Drawer.cjs.map +1 -1
  126. package/dist/components/overlays/Drawer.context.cjs +2 -0
  127. package/dist/components/overlays/Drawer.context.cjs.map +1 -0
  128. package/dist/components/overlays/Drawer.context.mjs +29 -0
  129. package/dist/components/overlays/Drawer.context.mjs.map +1 -0
  130. package/dist/components/overlays/Drawer.mjs +12 -187
  131. package/dist/components/overlays/Drawer.mjs.map +1 -1
  132. package/dist/components/overlays/Drawer.panel.cjs +2 -0
  133. package/dist/components/overlays/Drawer.panel.cjs.map +1 -0
  134. package/dist/components/overlays/Drawer.panel.mjs +159 -0
  135. package/dist/components/overlays/Drawer.panel.mjs.map +1 -0
  136. package/dist/components/overlays/Drawer.parts.cjs +2 -0
  137. package/dist/components/overlays/Drawer.parts.cjs.map +1 -0
  138. package/dist/components/overlays/Drawer.parts.mjs +152 -0
  139. package/dist/components/overlays/Drawer.parts.mjs.map +1 -0
  140. package/dist/components/overlays/Drawer.root.cjs +2 -0
  141. package/dist/components/overlays/Drawer.root.cjs.map +1 -0
  142. package/dist/components/overlays/Drawer.root.mjs +207 -0
  143. package/dist/components/overlays/Drawer.root.mjs.map +1 -0
  144. package/dist/components/overlays/Drawer.scroll.cjs +2 -0
  145. package/dist/components/overlays/Drawer.scroll.cjs.map +1 -0
  146. package/dist/components/overlays/Drawer.scroll.mjs +42 -0
  147. package/dist/components/overlays/Drawer.scroll.mjs.map +1 -0
  148. package/dist/hooks/useDismiss.cjs.map +1 -1
  149. package/dist/hooks/useDismiss.mjs.map +1 -1
  150. package/dist/hooks/useFocusTrap.cjs +1 -1
  151. package/dist/hooks/useFocusTrap.cjs.map +1 -1
  152. package/dist/hooks/useFocusTrap.mjs +115 -98
  153. package/dist/hooks/useFocusTrap.mjs.map +1 -1
  154. package/dist/hooks/useModalLayer.cjs +1 -1
  155. package/dist/hooks/useModalLayer.cjs.map +1 -1
  156. package/dist/hooks/useModalLayer.mjs +35 -22
  157. package/dist/hooks/useModalLayer.mjs.map +1 -1
  158. package/dist/hooks/useRestoreFocus.cjs +1 -1
  159. package/dist/hooks/useRestoreFocus.cjs.map +1 -1
  160. package/dist/hooks/useRestoreFocus.mjs +91 -78
  161. package/dist/hooks/useRestoreFocus.mjs.map +1 -1
  162. package/dist/hooks/useRovingTabIndex.cjs +1 -1
  163. package/dist/hooks/useRovingTabIndex.cjs.map +1 -1
  164. package/dist/hooks/useRovingTabIndex.mjs +102 -78
  165. package/dist/hooks/useRovingTabIndex.mjs.map +1 -1
  166. package/dist/index.cjs +1 -1
  167. package/dist/index.d.cts +2226 -221
  168. package/dist/index.d.ts +2226 -221
  169. package/dist/index.mjs +115 -107
  170. package/dist/lib/classNames.cjs +1 -1
  171. package/dist/lib/classNames.cjs.map +1 -1
  172. package/dist/lib/classNames.mjs +137 -77
  173. package/dist/lib/classNames.mjs.map +1 -1
  174. package/dist/lib/icons.cjs +1 -1
  175. package/dist/lib/icons.cjs.map +1 -1
  176. package/dist/lib/icons.mjs +13 -6
  177. package/dist/lib/icons.mjs.map +1 -1
  178. package/dist/lib/layers.cjs +1 -1
  179. package/dist/lib/layers.cjs.map +1 -1
  180. package/dist/lib/layers.mjs +53 -47
  181. package/dist/lib/layers.mjs.map +1 -1
  182. package/dist/styles.css +1 -1
  183. package/package.json +1 -1
  184. package/src/styles/tokens.css +25 -0
@@ -0,0 +1 @@
1
+ {"version":3,"file":"TagPicker.root.mjs","names":["useId","_Fragment","useId$1","React","TAG_PICKER_SIZES","EMPTY_OPTIONS","EMPTY_LABELS","TAG_SIZE","defaultRemoveLabel","label","defaultSummaryLabel","labels","defaultCreateLabel","text","defaultOverflowCountLabel","count","matchesText","item","triggerMessage","ALLOW_CREATE_BUTTON_MESSAGE","LIST_PLACEMENT_MESSAGE","findList","children","flattenChildren","isElementOfType","node","TagPickerList","TagPickerRoot","valueProp","openProp","queryProp","sizeProp","appearanceProp","overflowProp","ariaLabel","ariaLabelledBy","ariaDescribedBy","ariaInvalid","ariaRequired","ariaErrorMessage","ariaDetails","rest","props","onChange","warnDeprecated","overflow","field","useFieldContext","validates","required","readOnly","triggerId","triggerLabel","triggerLabelledBy","triggerDescribedBy","triggerInvalid","triggerRequired","useFieldControl","invalidLook","isInvalidLook","useInputLook","coreSize","size","tagSize","tagAppearance","appearance","selected","setSelected","useControllable","defaultValue","EMPTY_VALUES","list","next","onValueChange","selectedSet","interactive","disabled","openState","setOpen","defaultOpen","onOpenChange","isClient","useIsClient","open","triggersRef","triggerKind","setTriggerKind","registerTrigger","token","triggers","firstKind","kind","listCountRef","registerList","warnOnce","isButtonTrigger","queryState","setQuery","defaultQuery","onQueryChange","query","lock","setLock","lockedOpen","useAnnounce","rootRef","triggerRef","controlElementRef","groupRef","chipRef","summaryId","createValue","allowCreate","listElement","listChildren","registration","collected","collectOptionLabels","optionByValue","map","option","options","resolvedLabels","offersCreate","dataCreateText","createOptionText","items","available","listFilter","matches","filter","addTag","value","announceToggle","commitCreate","listbox","useListbox","details","getItem","labelOf","createText","listed","showCreate","expanded","noMatchesText","surfaceOpen","noMatches","useListboxPopup","rootMergedRef","useMergedRefs","ref","initial","sameValues","current","form","trackFocus","trackBlur","useFocusWithin","collapsed","focusWithin","tagLabels","hiddenValues","useTagOverflow","focusTrigger","useEventCallback","toggleOpen","removeTag","v","clear","editText","candidates","findExactMatch","focusLastTagControl","group","last","tagListControls","setOpenStable","entryOf","triggerProps","tabIndex","autoFocus","inputProps","autoComplete","autoCapitalize","autoCorrect","maxLength","inputMode","spellCheck","enterKeyHint","onFocus","onBlur","onKeyDown","onKeyUp","controlRef","listLabelledBy","listLabel","hasSummary","context","placeholder","layerId","surfaceRef","floatingProps","setReference","expandIcon","clearable","parts","Fragment","TagPickerControl","cn","tagPickerClassNames","className","TagPickerContext","HiddenInput"],"sources":["../../../src/components/input/TagPicker.root.tsx"],"sourcesContent":["import * as React from 'react';\nimport { flattenChildren, isElementOfType } from '../../lib/children';\nimport { cn } from '../../lib/cn';\nimport { tagPickerClassNames } from '../../lib/classNames';\nimport { warnDeprecated, warnOnce } from '../../lib/dev';\nimport type { Slot } from '../../lib/slot';\nimport type { CoreSize, InputAppearance, Size, TagAppearance, TagSize } from '../../lib/types';\nimport { useAnnounce } from '../../hooks/useAnnounce';\nimport { useControllable } from '../../hooks/useControllable';\nimport { useEventCallback } from '../../hooks/useEventCallback';\nimport { useFieldContext, useFieldControl } from '../../hooks/useFieldControl';\nimport { useFormReset } from '../../hooks/useFormReset';\nimport { useId } from '../../hooks/useId';\nimport { useIsClient } from '../../hooks/useIsClient';\nimport { collectOptionLabels, useListbox, type ListboxItem } from '../../hooks/useListbox';\nimport { useMergedRefs } from '../../hooks/useMergedRefs';\nimport { HiddenInput } from '../internal/HiddenInput';\nimport { useInputLook } from './inputLook';\nimport { isInvalidLook } from './Input';\nimport { useListboxPopup } from './Option';\nimport { announceToggle } from './pickerLabels';\nimport { EMPTY_VALUES, sameValues } from './pickerValues';\nimport type { RoutedHandlers } from './routedHandlers';\nimport { TagPickerContext } from './TagPicker.context';\nimport type {\n ResolvedTagPickerLabels,\n TagPickerContextValue,\n TagPickerInputOnlyProps,\n TagPickerTriggerKind,\n TagPickerTriggerProps,\n} from './TagPicker.context';\nimport { createOptionText, findExactMatch } from './TagPicker.create';\nimport type { ExactMatchCandidate } from './TagPicker.create';\nimport type { TagPickerOption } from './TagPicker.option';\nimport { useFocusWithin, useTagOverflow } from './TagPicker.overflow';\nimport { TagPickerControl, TagPickerList, tagListControls } from './TagPicker.parts';\n\n/**\n * The TagPicker's built-in names, descriptions and announcements, for localization. Each member is\n * optional and falls back to its English default.\n */\nexport interface TagPickerLabels {\n /** Name of a tag's remove button.\n * @default (label) => `Remove ${label}`\n */\n remove?: (label: string) => string;\n /** Name of the list of selected tags.\n * @default 'Selected'\n */\n selected?: string;\n /** Description of the input that sums up the selected tags (their labels, in order).\n * @default (labels) => `Selected: ${labels.join(', ')}`\n */\n summary?: (labels: string[]) => string;\n /** Announcement when a tag is added; `count` is the number of tags after the change.\n * @default (label, count) => `${label} added, ${count} selected`\n */\n added?: (label: string, count: number) => string;\n /** Announcement when a tag is removed; `count` is the number of tags after the change.\n * @default (label, count) => `${label} removed, ${count} selected`\n */\n removed?: (label: string, count: number) => string;\n /** Status text (announced, and shown in the popup) when the typed text matches no option.\n * @default 'No matches'\n */\n noMatches?: string;\n /**\n * Text and name of the create option (`allowCreate`), from the trimmed typed text.\n * @default (text) => `Create \"${text}\"`\n */\n create?: (text: string) => string;\n /** Name of the clear button (`clearable`). @default 'Clear selection' */\n clear?: string;\n /** Name of the expand button at the end of the field. @default 'Show options' */\n expand?: string;\n /**\n * The \"+N\" text of the single-line layout (`overflow=\"count\"`); hidden from assistive\n * technology, which hears the input's summary of every tag.\n * @default (count) => `+${count}`\n */\n overflowCount?: (count: number) => string;\n}\n\n/** Sizes of TagPicker (Fluent's): medium (the 0.7 look), large and extra-large. */\nexport type TagPickerSize = Extract<Size, 'medium' | 'large' | 'extra-large'>;\n\n/** Properties for the TagPicker component. */\nexport interface TagPickerProps extends Omit<\n React.HTMLAttributes<HTMLDivElement>,\n 'onChange' | 'defaultValue' | RoutedHandlers\n> {\n /**\n * The options, the array form (`{ value, label, media?, secondaryContent? }`). With parts whose\n * `TagPicker.List` has children it only names values (tags, announcements). Changed in 0.11:\n * optional.\n */\n options?: readonly TagPickerOption[];\n /**\n * The parts: `TagPicker.Control` and `TagPicker.List`, directly inside TagPicker (a Fragment is\n * fine). Without children TagPicker renders both with their defaults; without a\n * `TagPicker.List` it renders the default list after the children.\n */\n children?: React.ReactNode;\n /**\n * Controlled array of selected option values (`[]` for none). Fluent's `selectedOptions`.\n */\n value?: readonly string[];\n /**\n * Initial selected values for uncontrolled usage; a form reset restores them.\n * @default []\n */\n defaultValue?: readonly string[];\n /**\n * Called with the new selection when it changes: a tag is added (an option, or a created tag)\n * or removed, or a form reset restores different tags. Fluent's `onOptionSelect`.\n */\n onValueChange?: (value: string[]) => void;\n /**\n * Called with the new selection when it changes: a tag is added or removed, or a form reset\n * restores different tags.\n * @deprecated Use `onValueChange`.\n */\n onChange?: (value: string[]) => void;\n /**\n * Controlled open state of the option list. The list renders only in the browser: an open\n * picker is closed in the server HTML and opens once it has hydrated.\n */\n open?: boolean;\n /**\n * Initial open state for uncontrolled usage. A picker that starts disabled or read-only starts\n * closed. The list renders only in the browser: it is closed in the server HTML and opens once\n * the picker has hydrated.\n * @default false\n */\n defaultOpen?: boolean;\n /** Called when the option list opens or closes. */\n onOpenChange?: (open: boolean) => void;\n /**\n * Shown by TagPicker.Input or TagPicker.Button while no tag is selected; the part's own\n * `placeholder` wins.\n * @default 'Select...'\n */\n placeholder?: string;\n /**\n * Whether an option matches the typed text (the query). Called with every listed option, also\n * the options of `TagPicker.List`'s children (its `value`, `label` and `textValue`), and the\n * text whenever the text is not empty, never with a selected option or the create option; an\n * option it returns `false` for is filtered out. It may keep options that do not contain the\n * text: `filter={() => true}` with `query` and `onQueryChange` leaves the matching to you (a\n * server-side search that replaces `options`); for a create entry, use `allowCreate`. With a\n * server-side search, keep the selected options in `options` (they are never listed): a\n * selected value without an option shows its raw value as the tag label, with a development\n * warning (the \"Async search\" story does this).\n * @default a case-insensitive substring match on the option's `textValue ?? label`\n */\n filter?: (option: ListboxItem, query: string) => boolean;\n /**\n * Controlled query: the text typed since the last tag was added, which filters the options and\n * shows in the input (hidden while `disabled` or `readOnly`). Not used with TagPicker.Button.\n */\n query?: string;\n /**\n * Initial query for uncontrolled usage. A TagPicker that starts disabled or read-only starts\n * without it (as it starts closed). Not used with TagPicker.Button.\n * @default ''\n */\n defaultQuery?: string;\n /**\n * Called with the new query when it changes: as the user types, and with `''` when it resets (a\n * tag added or created, Escape on the closed list, the clear button, a form reset, or `disabled`\n * or `readOnly` turned on while text is typed). A blur or a close keeps the text. A TagPicker\n * that mounts disabled or read-only reports nothing: it keeps a controlled query, which shows\n * once it unlocks. Not used with TagPicker.Button.\n */\n onQueryChange?: (query: string) => void;\n /**\n * Whether the tag picker is disabled: nothing can be added or removed, the remove buttons leave\n * the tab order, and the expand and clear buttons are disabled. The field dims once.\n * @default false\n */\n disabled?: boolean;\n /**\n * Size of the tags and the field: `medium` (the 0.7 look), `large` or `extra-large` (Fluent's\n * union; TagPicker has no `small`). Default: the surrounding Field's `size`, else `WaveProvider\n * inputDefaults.size`, else `'medium'`; a Field or provider `small` gives `'medium'` too. Its\n * tags are one Tag size smaller: medium → extra-small, large → small, extra-large → medium. The\n * option list keeps its size.\n */\n size?: TagPickerSize;\n /**\n * Look of the field: `outline` (a full border), `underline` (a bottom stroke only),\n * `filled-darker` or `filled-lighter` (a fill without a visible stroke: give the field a visible\n * label). Default: `WaveProvider inputDefaults.appearance`, else `'outline'`. The tags are\n * filled, outlined on `filled-darker`.\n */\n appearance?: InputAppearance;\n /** Name of the values in form submissions (one hidden input per value). */\n name?: string;\n /** Id of the form the values belong to, when the TagPicker is outside it. */\n form?: string;\n /**\n * At least one tag is required to submit the form (native constraint validation). Like a native\n * readonly input, a `readOnly` TagPicker does not block submission.\n */\n required?: boolean;\n /**\n * The `autocomplete` attribute of TagPicker.Input's `<input role=\"combobox\">`. Browser autofill\n * is off unless you set it (for example `'on'`). With TagPicker.Button, not used.\n * @default 'off'\n */\n autoComplete?: string;\n /**\n * The maximum length of the typed text (`maxlength` of TagPicker.Input's `<input>`). With\n * TagPicker.Button, not used.\n */\n maxLength?: number;\n /**\n * The selection cannot be changed: the trigger is read-only, the tags have no remove buttons,\n * the expand button is disabled and the clear button hidden, and the option list neither opens\n * (click, keyboard, a controlled `open`) nor adds tags; Escape is left to the page. Turning it\n * (or `disabled`) on while the list is open closes it (`onOpenChange(false)`); a focused remove\n * button hands focus to the trigger.\n */\n readOnly?: boolean;\n /**\n * Lets the user add a tag of their own text: while the trimmed text matches no option label\n * and no selected value (ignoring case) and no option value, the list ends with a create option\n * (`labels.create`); Enter on it or a click adds the text as a tag, calls `onOptionCreate`, and\n * clears the text. Needs `TagPicker.Input` (not `TagPicker.Button`). WaveUI-only: Fluent's\n * TagPicker has no free tagging.\n * @default false\n */\n allowCreate?: boolean;\n /**\n * Called with the trimmed text when the user creates a tag, before `onValueChange` reports the\n * new value. Add an option for it if you keep options: until then the tag shows the raw text.\n * WaveUI-only (see `allowCreate`).\n */\n onOptionCreate?: (text: string) => void;\n /**\n * Shows a clear button at the end of the field while a tag is selected (not while `readOnly`;\n * disabled while `disabled`): it removes every tag (`onValueChange([])`), clears the typed\n * text, closes the list and focuses the trigger (the input, or `TagPicker.Button`). A Tab stop\n * after the trigger. The name of Fluent's Combobox and Dropdown prop.\n * @default false\n */\n clearable?: boolean;\n /**\n * The glyph of the expand button at the end of the field (default: a chevron). The button\n * opens and closes the list, keeps focus on the trigger and is not a Tab stop. `null` or\n * `undefined` keep the chevron; `false`, or a value that renders nothing, hides the button.\n * Decorative: a `<button>` passed here is unwrapped. `TagPicker.Control`'s `expandIcon` wins.\n */\n expandIcon?: Slot<'span'>;\n /**\n * `'wrap'`: the tags wrap onto more lines. `'count'`: while focus is outside the picker and its\n * list is closed, the tags stay on one line and the ones that do not fit give way to \"+N\"\n * (`labels.overflowCount`); focusing the picker shows them all. The tags are measured by\n * position: your own Tags in `TagPicker.Group` render in `value` order. WaveUI-only: Fluent's\n * single-line layout is a story, not a prop.\n * @default 'wrap'\n */\n overflow?: 'wrap' | 'count';\n /**\n * Names of the remove buttons and the tag list, the summary that describes the trigger, the\n * announcements, the \"No matches\" text, the create option, the clear and expand buttons and the\n * \"+N\" count, for localization. Unset members keep their English defaults.\n */\n labels?: TagPickerLabels;\n /**\n * Called when TagPicker.Input's `<input role=\"combobox\">` receives focus (the root keeps other\n * handlers). With TagPicker.Button, pass it (and `ref`) on the Button.\n */\n onFocus?: React.FocusEventHandler<HTMLInputElement>;\n /** Called when TagPicker.Input's `<input>` loses focus. With TagPicker.Button, pass it on the Button. */\n onBlur?: React.FocusEventHandler<HTMLInputElement>;\n /**\n * Called on a key press in TagPicker.Input's `<input>`, after the Input's own `onKeyDown` and\n * before the built-in listbox and tag keys; `event.preventDefault()` skips them. With\n * TagPicker.Button, pass it on the Button.\n */\n onKeyDown?: React.KeyboardEventHandler<HTMLInputElement>;\n /** Called when a key is released in TagPicker.Input's `<input>`. With TagPicker.Button, pass it on the Button. */\n onKeyUp?: React.KeyboardEventHandler<HTMLInputElement>;\n /**\n * Ref to TagPicker.Input's `<input role=\"combobox\">` (the focusable element). With\n * TagPicker.Button, pass `ref` on the Button.\n */\n controlRef?: React.Ref<HTMLInputElement>;\n /** Ref to the root `<div>`. */\n ref?: React.Ref<HTMLDivElement>;\n}\n\n/**\n * How the picker came to be locked (`disabled` or `readOnly`): not at all, by a change while\n * mounted, or since it mounted.\n */\ntype LockState = 'unlocked' | 'locked' | 'mounted-locked';\n\nconst TAG_PICKER_SIZES: readonly TagPickerSize[] = ['medium', 'large', 'extra-large'];\nconst EMPTY_OPTIONS: readonly TagPickerOption[] = [];\nconst EMPTY_LABELS: ReadonlyMap<string, string> = new Map();\n\n/** The tag size of each picker size (Fluent's mapping, D54). */\nconst TAG_SIZE: Readonly<Record<TagPickerSize, TagSize>> = {\n medium: 'extra-small',\n large: 'small',\n 'extra-large': 'medium',\n};\n\nconst defaultRemoveLabel = (label: string) => `Remove ${label}`;\nconst defaultSummaryLabel = (labels: string[]) => `Selected: ${labels.join(', ')}`;\nconst defaultCreateLabel = (text: string) => `Create \"${text}\"`;\nconst defaultOverflowCountLabel = (count: number) => `+${count}`;\n\n/** The default `filter` (Phase 5 D13): a case-insensitive substring of `textValue ?? label`. */\nfunction matchesText(item: ListboxItem, text: string): boolean {\n return (item.textValue ?? item.label).toLowerCase().includes(text.toLowerCase());\n}\n\nfunction triggerMessage(count: number): string {\n return `TagPicker: render exactly one trigger, \\`TagPicker.Input\\` or \\`TagPicker.Button\\`, inside \\`TagPicker.Control\\` (found ${count}).`;\n}\n\nconst ALLOW_CREATE_BUTTON_MESSAGE =\n 'TagPicker: `allowCreate` needs `TagPicker.Input`: `TagPicker.Button` has no text to create a tag from, so no create option is offered.';\n\nconst LIST_PLACEMENT_MESSAGE =\n 'TagPicker.List: render one TagPicker.List, directly inside TagPicker (a Fragment is fine). A second list, or one inside a component of your own, splits the options over two lists.';\n\n/** The `TagPicker.List` among the direct children and Fragments, if any (D50). */\nfunction findList(\n children: React.ReactNode,\n): React.ReactElement<{ children?: React.ReactNode }> | undefined {\n if (children === null || children === undefined) return undefined;\n for (const { node } of flattenChildren(children)) {\n if (isElementOfType<{ children?: React.ReactNode }>(node, TagPickerList)) return node;\n }\n return undefined;\n}\n\nexport const TagPickerRoot = (props: TagPickerProps) => {\n const {\n options = EMPTY_OPTIONS,\n children,\n value: valueProp,\n defaultValue,\n onValueChange,\n onChange,\n open: openProp,\n defaultOpen,\n onOpenChange,\n placeholder = 'Select...',\n filter,\n query: queryProp,\n defaultQuery,\n onQueryChange,\n disabled = false,\n size: sizeProp,\n appearance: appearanceProp,\n name,\n form,\n required,\n autoComplete = 'off',\n autoCapitalize,\n autoCorrect,\n maxLength,\n readOnly = false,\n allowCreate = false,\n onOptionCreate,\n clearable = false,\n expandIcon,\n overflow: overflowProp = 'wrap',\n labels,\n inputMode,\n spellCheck,\n enterKeyHint,\n autoFocus,\n tabIndex,\n id,\n 'aria-label': ariaLabel,\n 'aria-labelledby': ariaLabelledBy,\n 'aria-describedby': ariaDescribedBy,\n 'aria-invalid': ariaInvalid,\n 'aria-required': ariaRequired,\n 'aria-errormessage': ariaErrorMessage,\n 'aria-details': ariaDetails,\n onFocus,\n onBlur,\n onKeyDown,\n onKeyUp,\n controlRef,\n className,\n ref,\n ...rest\n } = props;\n\n if (onChange !== undefined) warnDeprecated('TagPicker', 'onChange', 'onValueChange');\n const overflow = overflowProp === 'count' ? 'count' : 'wrap';\n\n const field = useFieldContext();\n const isRequired = required ?? field?.required ?? false;\n // Like a native readonly input, a read-only TagPicker is barred from constraint validation (the\n // user could not fix it); its values are still submitted.\n const validates = isRequired && !readOnly;\n const fieldProps = useFieldControl({\n id,\n 'aria-label': ariaLabel,\n 'aria-labelledby': ariaLabelledBy,\n 'aria-describedby': ariaDescribedBy,\n 'aria-invalid': ariaInvalid,\n // An explicit `required={false}` wins over a required Field, so aria-required matches\n // `isRequired`.\n 'aria-required': ariaRequired ?? required,\n });\n const {\n id: triggerId,\n 'aria-label': triggerLabel,\n 'aria-labelledby': triggerLabelledBy,\n 'aria-describedby': triggerDescribedBy,\n 'aria-invalid': triggerInvalid,\n 'aria-required': triggerRequired,\n } = fieldProps;\n // The error look follows the resolved state: the consumer's `aria-invalid` or the Field's.\n const invalidLook = isInvalidLook(false, triggerInvalid);\n const { size, appearance } = useInputLook(sizeProp, appearanceProp, {\n sizes: TAG_PICKER_SIZES,\n defaultSize: 'medium',\n });\n const coreSize: CoreSize = size === 'medium' ? 'medium' : 'large';\n const tagSize = TAG_SIZE[size];\n // A muted tag would barely show on the darker fill: outlined there (D54).\n const tagAppearance: TagAppearance = appearance === 'filled-darker' ? 'outline' : 'filled';\n\n const [selected, setSelected] = useControllable<readonly string[]>(\n valueProp,\n defaultValue ?? EMPTY_VALUES,\n (next) => {\n // The props are read only; the callbacks receive an array of their own.\n const list = [...next];\n onValueChange?.(list);\n onChange?.(list);\n },\n );\n const selectedSet = React.useMemo(() => new Set(selected), [selected]);\n const interactive = !disabled && !readOnly;\n // A picker that starts disabled or read-only never shows its list, so it starts closed (no close\n // to report later).\n const [openState, setOpen] = useControllable(\n openProp,\n (defaultOpen ?? false) && interactive,\n onOpenChange,\n );\n // The open list lives in a portal, which renders only in the browser: until then (the server\n // HTML, hydration) the picker shows the closed inline list and reports it closed, so\n // aria-controls and aria-activedescendant never name a missing element.\n const isClient = useIsClient();\n const open = openState && interactive && isClient;\n // The trigger parts (D63): their kind decides the listbox mode; the server HTML and the first\n // render use the editable mode of `TagPicker.Input`.\n const triggersRef = React.useRef(new Map<object, TagPickerTriggerKind>());\n const [triggerKind, setTriggerKind] = React.useState<TagPickerTriggerKind>('input');\n const registerTrigger = React.useCallback((kind: TagPickerTriggerKind) => {\n const token = {};\n const triggers = triggersRef.current;\n const firstKind = () => triggers.values().next().value ?? 'input';\n triggers.set(token, kind);\n setTriggerKind(firstKind());\n return () => {\n triggers.delete(token);\n setTriggerKind(firstKind());\n };\n }, []);\n const listCountRef = React.useRef(0);\n const registerList = React.useCallback(() => {\n listCountRef.current += 1;\n return () => {\n listCountRef.current -= 1;\n };\n }, []);\n // After every commit (every part's layout effect has run): exactly one trigger and one List.\n React.useEffect(() => {\n const triggers = triggersRef.current.size;\n if (triggers !== 1) warnOnce('TagPicker:trigger', triggerMessage(triggers));\n if (listCountRef.current > 1) warnOnce('TagPicker.List:placement', LIST_PLACEMENT_MESSAGE);\n });\n const isButtonTrigger = triggerKind === 'button';\n\n // The query (D12): the text typed since the last tag was added, which filters the options. A\n // picker that starts locked starts without a query, as it starts closed.\n const [queryState, setQuery] = useControllable(\n queryProp,\n interactive ? (defaultQuery ?? '') : '',\n onQueryChange,\n );\n // Locking the control (readOnly/disabled) while typing drops the typed text: hidden during\n // render here, and the reset reported from an effect, since `onQueryChange` never runs during\n // render (D12). `lock` is how the picker came to be locked (previous-value pattern, C-HOOKS):\n // `'locked'` by a change while mounted, whose reset is reported once, or `'mounted-locked'`\n // since it mounted, which reports nothing and keeps a controlled query, hidden until the picker\n // unlocks (R20).\n // `TagPicker.Button` has no text entry, so no query filters its list (D63).\n const query = interactive && !isButtonTrigger ? queryState : '';\n const [lock, setLock] = React.useState<LockState>(interactive ? 'unlocked' : 'mounted-locked');\n if (interactive && lock !== 'unlocked') setLock('unlocked');\n else if (!interactive && lock === 'unlocked') setLock('locked');\n React.useEffect(() => {\n if (lock === 'locked') setQuery('');\n }, [lock, setQuery]);\n // Locking also closes the list itself, not only the derived `open`, so unlocking does not reopen\n // it without a user action. The close is reported through onOpenChange (a consumer callback from\n // an effect, C-HOOKS); a controlled `open` that stays true is still not shown while locked.\n const lockedOpen = !interactive && openState;\n React.useEffect(() => {\n if (lockedOpen) setOpen(false);\n }, [lockedOpen, setOpen]);\n // Keeps the shared live regions alive while mounted: every addition and removal is announced\n // (`announceToggle`).\n useAnnounce();\n\n const rootRef = React.useRef<HTMLDivElement | null>(null);\n const triggerRef = React.useRef<HTMLElement | null>(null);\n const controlElementRef = React.useRef<HTMLDivElement | null>(null);\n const groupRef = React.useRef<HTMLDivElement | null>(null);\n const chipRef = React.useRef<HTMLSpanElement | null>(null);\n const summaryId = useId('tagpicker-summary');\n const createValue = useId('tagpicker-create');\n\n React.useEffect(() => {\n if (allowCreate && isButtonTrigger) {\n warnOnce('TagPicker:allowCreate-button', ALLOW_CREATE_BUTTON_MESSAGE);\n }\n }, [allowCreate, isButtonTrigger]);\n\n // The parts form (D50): a List among the direct children with children of its own switches the\n // listbox to registration mode; `options` then only names values.\n const listElement = findList(children);\n const listChildren = listElement?.props.children;\n const registration = listChildren !== undefined && listChildren !== null;\n const collected = React.useMemo(\n () => (registration ? collectOptionLabels(listChildren) : EMPTY_LABELS),\n [registration, listChildren],\n );\n\n const optionByValue = React.useMemo(() => {\n const map = new Map<string, TagPickerOption>();\n for (const option of options) if (!map.has(option.value)) map.set(option.value, option);\n return map;\n }, [options]);\n\n const resolvedLabels = React.useMemo<ResolvedTagPickerLabels>(\n () => ({\n remove: labels?.remove ?? defaultRemoveLabel,\n selected: labels?.selected ?? 'Selected',\n create: labels?.create ?? defaultCreateLabel,\n clear: labels?.clear ?? 'Clear selection',\n expand: labels?.expand ?? 'Show options',\n overflowCount: labels?.overflowCount ?? defaultOverflowCountLabel,\n noMatches: labels?.noMatches ?? 'No matches',\n }),\n [labels],\n );\n\n // The create option (D59) needs the text input, an interactive picker and an open list.\n const offersCreate =\n allowCreate && interactive && !isButtonTrigger && open && query.trim() !== '';\n // Data mode: the duplicate check reads every `options` entry, before the listbox, since the\n // create item is one of its items.\n const dataCreateText =\n offersCreate && !registration\n ? createOptionText(query, {\n labels: options.map((option) => option.label),\n values: options.map((option) => option.value),\n selected,\n })\n : null;\n\n const items = React.useMemo<ListboxItem[] | undefined>(() => {\n if (registration) return undefined;\n const available: ListboxItem[] = options\n .filter((option) => !selectedSet.has(option.value))\n .map((option) => ({ value: option.value, label: option.label }));\n if (dataCreateText !== null) {\n available.push({ value: createValue, label: resolvedLabels.create(dataCreateText) });\n }\n return available;\n }, [registration, options, selectedSet, dataCreateText, createValue, resolvedLabels]);\n\n // useListbox's navigability predicate (D58): the create option always, never a selected option,\n // and `filter` (else the default) bound to the typed text while there is any.\n const listFilter = React.useMemo(() => {\n if (!registration && !query) return undefined;\n const matches = filter ?? matchesText;\n return (item: ListboxItem) =>\n item.value === createValue ||\n (!selectedSet.has(item.value) && (query === '' || matches(item, query)));\n }, [registration, query, filter, selectedSet, createValue]);\n\n // Adds a listed option (`label`: the committed item's).\n const addTag = (value: string, label: string) => {\n if (!interactive || selected.includes(value)) return;\n const next = [...selected, value];\n setSelected(next);\n setQuery('');\n announceToggle(labels, label, true, next.length);\n };\n\n // Creates a tag of the trimmed text (D59): the create option was offered for it.\n const commitCreate = () => {\n const text = query.trim();\n if (!interactive || text === '') return;\n onOptionCreate?.(text);\n const next = [...selected, text];\n setSelected(next);\n setQuery('');\n announceToggle(labels, text, true, next.length);\n };\n\n const listbox = useListbox({\n open,\n onOpenChange: (next) => setOpen(next),\n mode: isButtonTrigger ? 'select-only' : 'editable',\n multiselect: true,\n selectedValues: selected,\n onSelect: (value, details) => {\n if (value === createValue) commitCreate();\n else addTag(value, details?.item.label ?? value);\n },\n items,\n filter: listFilter,\n // Typing a filter makes its first match active (as in Combobox), so Enter adds what the list\n // shows instead of submitting the form. Nothing is active on open or with the text cleared.\n // The Button trigger starts on the first listed option, as Dropdown does.\n autoHighlight: isButtonTrigger ? 'selected' : query ? 'first' : false,\n idPrefix: 'tagpicker-listbox',\n onClearDraft: query && !isButtonTrigger ? () => setQuery('') : undefined,\n });\n\n // A value's label (D58): its registered option's, else the List children's (the server and the\n // first render), else the `options` entry's, else the raw value.\n const getItem = listbox.getItem;\n const labelOf = React.useCallback(\n (value: string): string =>\n (registration ? getItem(value)?.label : undefined) ??\n collected.get(value) ??\n optionByValue.get(value)?.label ??\n value,\n [registration, getItem, collected, optionByValue],\n );\n\n // Registration mode: the create option is a rendered Option, so the duplicate check runs after\n // the listbox, over the labels it lists in this render and those of the selected values.\n let createText: string | null = dataCreateText;\n if (offersCreate && registration) {\n const listed = listbox.items.filter((item) => item.value !== createValue);\n createText = createOptionText(query, {\n labels: [\n ...options.map((option) => option.label),\n ...collected.values(),\n ...listed.map((item) => item.label),\n ...selected.map(labelOf),\n ],\n values: [\n ...options.map((option) => option.value),\n ...collected.keys(),\n ...listed.map((item) => item.value),\n ],\n selected,\n });\n }\n const showCreate = createText !== null;\n\n // aria-expanded only while a listbox with options (or the create option) is shown\n // (input-pickers#21).\n const expanded = open && (listbox.items.length > 0 || showCreate);\n const noMatchesText = resolvedLabels.noMatches;\n // The popup shows the options, or \"No matches\" for a query.\n const surfaceOpen = open && (expanded || query !== '');\n const noMatches = surfaceOpen && !expanded && !showCreate;\n const { layerId, setReference, surfaceRef, floatingProps } = useListboxPopup({\n open,\n surfaceOpen,\n onDismiss: () => setOpen(false),\n rootRef,\n anchorRef: triggerRef,\n });\n\n const rootMergedRef = useMergedRefs<HTMLDivElement>(rootRef, ref);\n\n useFormReset(\n rootRef,\n () => {\n // Compared by content (C-FORMS): an inline default is a new array on every render, and a\n // reset that keeps the same tags reports nothing.\n const initial = defaultValue ?? EMPTY_VALUES;\n setSelected((current) => (sameValues(current, initial) ? current : [...initial]));\n setQuery('');\n },\n form,\n );\n\n // The single-line layout (D62): collapsed while focus is outside the root and the list closed.\n const {\n focusWithin,\n onFocus: trackFocus,\n onBlur: trackBlur,\n } = useFocusWithin(overflow === 'count');\n const collapsed = overflow === 'count' && !focusWithin && !open;\n const tagLabels = React.useMemo(() => selected.map(labelOf), [selected, labelOf]);\n const hiddenValues = useTagOverflow({\n active: collapsed,\n values: selected,\n labels: tagLabels,\n control: controlElementRef,\n group: groupRef,\n chip: chipRef,\n trigger: triggerRef,\n });\n\n const focusTrigger = useEventCallback(() => {\n triggerRef.current?.focus();\n });\n const toggleOpen = useEventCallback(() => {\n if (interactive) setOpen(!open);\n });\n const removeTag = useEventCallback((value: string) => {\n if (!interactive || !selected.includes(value)) return;\n const next = selected.filter((v) => v !== value);\n setSelected(next);\n announceToggle(labels, labelOf(value), false, next.length);\n });\n const clear = useEventCallback(() => {\n focusTrigger();\n if (!interactive) return;\n if (selected.length > 0) setSelected([]);\n setQuery('');\n setOpen(false);\n });\n const editText = useEventCallback((text: string) => {\n if (!interactive) return;\n setQuery(text);\n if (!open) setOpen(true);\n // The option whose label equals the typed text becomes active (D60); a user edit only.\n const candidates: Iterable<ExactMatchCandidate> = registration\n ? Array.from(collected, ([value, label]) => ({ value, label }))\n : options;\n listbox.setActiveValue(findExactMatch(text, candidates, selectedSet));\n });\n const focusLastTagControl = useEventCallback(() => {\n const group = groupRef.current;\n const last = group ? tagListControls(group).at(-1) : undefined;\n last?.focus();\n return last !== undefined;\n });\n const setOpenStable = useEventCallback((next: boolean) => setOpen(next));\n const entryOf = React.useCallback((value: string) => optionByValue.get(value), [optionByValue]);\n\n const triggerProps = React.useMemo<TagPickerTriggerProps>(\n () => ({\n id: triggerId,\n 'aria-label': triggerLabel,\n 'aria-labelledby': triggerLabelledBy,\n 'aria-describedby': triggerDescribedBy,\n 'aria-invalid': triggerInvalid,\n 'aria-required': triggerRequired,\n 'aria-errormessage': ariaErrorMessage,\n 'aria-details': ariaDetails,\n tabIndex,\n autoFocus,\n }),\n [\n triggerId,\n triggerLabel,\n triggerLabelledBy,\n triggerDescribedBy,\n triggerInvalid,\n triggerRequired,\n ariaErrorMessage,\n ariaDetails,\n tabIndex,\n autoFocus,\n ],\n );\n const inputProps = React.useMemo<TagPickerInputOnlyProps>(\n () => ({\n autoComplete,\n autoCapitalize,\n autoCorrect,\n maxLength,\n inputMode,\n spellCheck,\n enterKeyHint,\n onFocus,\n onBlur,\n onKeyDown,\n onKeyUp,\n controlRef,\n }),\n [\n autoComplete,\n autoCapitalize,\n autoCorrect,\n maxLength,\n inputMode,\n spellCheck,\n enterKeyHint,\n onFocus,\n onBlur,\n onKeyDown,\n onKeyUp,\n controlRef,\n ],\n );\n const listLabelledBy =\n triggerLabel === undefined ? (triggerLabelledBy ?? field?.labelId) : triggerLabelledBy;\n const listLabel = React.useMemo(\n () => ({ 'aria-label': triggerLabel, 'aria-labelledby': listLabelledBy }),\n [triggerLabel, listLabelledBy],\n );\n\n const hasSummary = selected.length > 0;\n const context = React.useMemo<TagPickerContextValue>(\n () => ({\n size,\n appearance,\n coreSize,\n tagSize,\n tagAppearance,\n disabled,\n readOnly,\n interactive,\n invalidLook,\n selected,\n labelOf,\n entryOf,\n labels: resolvedLabels,\n placeholder,\n options,\n warnsUnknownValues: !registration && !allowCreate,\n dataMode: !registration,\n listbox,\n open,\n expanded,\n query,\n surfaceOpen,\n showCreate,\n createText: createText ?? '',\n createValue,\n emptyContent: query !== '' && !showCreate,\n layerId,\n surfaceRef,\n floatingProps,\n listLabel,\n triggerProps,\n inputProps,\n summaryId: hasSummary ? summaryId : undefined,\n triggerRef,\n setReference,\n controlRef: controlElementRef,\n groupRef,\n chipRef,\n registerTrigger,\n registerList,\n triggerKind,\n setOpen: setOpenStable,\n toggleOpen,\n focusTrigger,\n removeTag,\n clear,\n editText,\n focusLastTagControl,\n expandIcon,\n clearable,\n overflow,\n collapsed,\n hiddenValues,\n }),\n [\n size,\n appearance,\n coreSize,\n tagSize,\n tagAppearance,\n disabled,\n readOnly,\n interactive,\n invalidLook,\n selected,\n labelOf,\n entryOf,\n resolvedLabels,\n placeholder,\n options,\n registration,\n allowCreate,\n listbox,\n open,\n expanded,\n query,\n surfaceOpen,\n showCreate,\n createText,\n createValue,\n layerId,\n surfaceRef,\n floatingProps,\n listLabel,\n triggerProps,\n inputProps,\n hasSummary,\n summaryId,\n setReference,\n registerTrigger,\n registerList,\n triggerKind,\n setOpenStable,\n toggleOpen,\n focusTrigger,\n removeTag,\n clear,\n editText,\n focusLastTagControl,\n expandIcon,\n clearable,\n overflow,\n collapsed,\n hiddenValues,\n ],\n );\n\n const parts =\n children === undefined || children === null ? (\n <>\n <TagPickerControl />\n <TagPickerList />\n </>\n ) : (\n <>\n {children}\n {/* A parts form without a List still has its listbox, so aria-controls never dangles. */}\n {listElement === undefined && <TagPickerList />}\n </>\n );\n\n return (\n <div\n data-size={size}\n data-appearance={appearance}\n data-overflow={overflow}\n data-collapsed={collapsed ? '' : undefined}\n {...rest}\n ref={rootMergedRef}\n className={cn(tagPickerClassNames.root, 'relative', className)}\n // Focus inside the root (DOM containment) expands the single-line layout.\n onFocus={trackFocus}\n onBlur={trackBlur}\n >\n <TagPickerContext.Provider value={context}>{parts}</TagPickerContext.Provider>\n {hasSummary && (\n // Describes the trigger. The list itself would read every \"Remove …\" button name too.\n <span id={summaryId} hidden>\n {(labels?.summary ?? defaultSummaryLabel)(selected.map(labelOf))}\n </span>\n )}\n {/* Mounted before its text: a live region added together with its text is not announced by\n every screen reader. The row in the popup is the visible copy. */}\n <span role=\"status\" className=\"sr-only\">\n {noMatches && noMatchesText}\n </span>\n <HiddenInput\n name={name}\n form={form}\n disabled={disabled}\n value={selected}\n type=\"text\"\n required={validates}\n onInvalid={focusTrigger}\n />\n </div>\n );\n};\nTagPickerRoot.displayName = 'TagPicker';\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;AA2SA,IAAMI,KAA6C;CAAC;CAAU;CAAS;AAAa,GAC9EC,KAA4C,CAAC,GAC7CC,qBAA4C,IAAI,IAAI,GAGpDC,KAAqD;CACzD,QAAQ;CACR,OAAO;CACP,eAAe;AACjB,GAEMC,MAAsB,MAAkB,UAAUC,KAClDC,MAAuB,MAAqB,aAAaC,EAAO,KAAK,IAAI,KACzEC,MAAsB,MAAiB,WAAWC,EAAK,IACvDC,MAA6B,MAAkB,IAAIC;AAGzD,SAASC,GAAY,GAAmB,GAAuB;CAC7D,QAAQC,EAAK,aAAaA,EAAK,MAAA,CAAO,YAAY,CAAC,CAAC,SAASJ,EAAK,YAAY,CAAC;AACjF;AAEA,SAASK,GAAe,GAAuB;CAC7C,OAAO,2HAA2HH,EAAM;AAC1I;AAEA,IAAMI,KACJ,0IAEIC,KACJ;AAGF,SAASC,GACP,GACgE;CAChE,IAAIC,KAAa,MACjB;OAAK,IAAM,EAAE,aAAUC,EAAgBD,CAAQ,GAC7C,IAAIE,EAAgDC,GAAMC,CAAa,GAAG,OAAOD;CAAA;AAGrF;AAEA,IAAaE,KAAiB,MAA0B;CACtD,IAAM,EACJ,aAAUtB,IACV,aACA,OAAOuB,I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YhM,EAAM,eACf;EAAE,cAAciD;EAAc,mBAAmB8I;CAAe,IACvE,CAAC9I,GAAc8I,EAAc,CAC/B,GAEME,KAAalI,EAAS,SAAS,GAC/BmI,KAAUlM,EAAM,eACb;EACL;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA,QAAQuH;EACR;EACA;EACA,oBAAoB,CAACP,KAAgB,CAACH;EACtC,UAAU,CAACG;EACX;EACA;EACA;EACA;EACA;EACA;EACA,YAAYyB,KAAc;EAC1B;EACA,cAAcxC,MAAU,MAAM,CAAC0C;EAC/B;EACA;EACA;EACA;EACA;EACA;EACA,WAAWsD,KAAatF,IAAY,KAAA;EACpC;EACA;EACA,YAAYH;EACZ;EACA;EACA;EACA;EACA;EACA,SAASqE;EACT;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;CACF,IACA;EACElH;EACAG;EACAJ;EACAE;EACAC;EACAY;EACA1B;EACAyB;EACAjB;EACAQ;EACAyE;EACAsC;EACAvD;EACA4E;EACA7E;EACAN;EACAH;EACAuB;EACApD;EACA4D;EACA3C;EACA6C;EACAH;EACAF;EACA7B;EACAwF;EACAC;EACAC;EACAN;EACAjB;EACAG;EACAe;EACAtF;EACA4F;EACAnH;EACAM;EACAR;EACA2F;EACAX;EACAF;EACAG;EACAE;EACAC;EACAG;EACA+B;EACAC;EACA/J;EACAiH;EACAG;CACF,CACF,GAEM4C,KACJvL,KAAuC,OACrC,kBAAArB,IAAA,EAAA,UAAA,CACE,kBAAC8M,IAAD,CAAmB,CAAA,GACnB,kBAACrL,GAAD,CAAgB,CAAA,CAChB,EAAA,CAAA,IAEF,kBAAAzB,IAAA,EAAA,UAAA,CACGqB,GAEA2F,OAAgB,KAAA,KAAa,kBAACvF,GAAD,CAAgB,CAAA,CAC9C,EAAA,CAAA;CAGN,OACE,kBAAC,OAAD;EACE,aAAWoC;EACX,mBAAiBG;EACjB,iBAAepB;EACf,kBAAgBiH,IAAY,KAAK,KAAA;EACjC,GAAIrH;EACJ,KAAK2G;EACL,WAAW4D,EAAGC,GAAoB,MAAM,YAAYC,EAAS;EAE7D,SAASvD;EACT,QAAQC;EAVV,UAAA;GAYE,kBAACuD,GAAiB,UAAlB;IAA2B,OAAOd;IAAU,UAAAQ;GAAiC,CAAA;GAC5ET,MAEC,kBAAC,QAAD;IAAM,IAAItF;IAAW,QAAA;IACjB,WAAAnG,GAAQ,WAAWD,GAAA,CAAqBwD,EAAS,IAAIyE,CAAO,CAAC;GAC3D,CAAA;GAIR,kBAAC,QAAD;IAAM,MAAK;IAAS,WAAU;IAC3B,UAAAO,MAAaF;GACV,CAAA;GACN,kBAACoE,IAAD;IACQ;IACA;IACI;IACV,OAAOlJ;IACP,MAAK;IACL,UAAUlB;IACV,WAAWmH;GACZ,CAAA;EACE;;AAET;AACA,EAAc,cAAc"}
@@ -1 +1 @@
1
- {"version":3,"file":"Accordion.cjs","names":["React","useControllable","useId","cn","accordionClassNames","getElementType","flattenChildren","accordionTriggerClassNames","getPartId","accordionItemClassNames","disabledStyles","focusRingInset","composeEventHandlers","ChevronDownIcon","accordionPanelClassNames","require_runtime","require_cn","require_children","require_dev","require_composeEventHandlers","require_classNames","require_useControllable","require_useId","require_styles","require_icons","require_disclosureIds","react","react_jsx_runtime","AccordionContext","AccordionItemContext","AccordionPanelSlotContext","EMPTY","INERT_ACCORDION","INERT_ITEM","IN_PANEL","AccordionHeadingOutsideContext","HEADING_CLASS","useAccordionContext","component","useAccordionItemContext","warnDuplicateValue","value","toItems","AccordionRoot","openItemsProp","rest","props","multiple","type","defaultOpenItems","onOpenItemsChange","controlledSingle","openItem","controlled","initialItems","defaultOpenItem","openItems","setOpenItems","list","next","onOpenItemChange","openCount","toggle","prev","v","itemCountsRef","registerItem","counts","count","remaining","baseId","context","headingLevel","className","findPart","node","child","found","part","barrier","AccordionItem","idOf","id","element","wrapsTriggerOnly","AccordionTrigger","AccordionPanel","misplacedMessage","headingLevelProp","accordion","isOpen","toggleValue","Heading","triggerElement","panelElement","parts","extra","children","keyed","key","trigger","panel","hasTrigger","hasPanel","triggerIdProp","panelIdProp","hasPanelContent","extraPanelContent","itemContext","panelSlot","idProp","item","inPanel","headingOutside","state","button","onClick","slot","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 { 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. */\nexport type AccordionHeadingLevel = 1 | 2 | 3 | 4 | 5 | 6;\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":"2fA0DA,IAAM4B,EAAmB5B,EAAM,cAA4C,IAAI,EACzE6B,EAAuB7B,EAAM,cAAgD,IAAI,EACjF8B,EAA4B9B,EAAM,cAA8C,IAAI,EAEpF+B,EAA2B,CAAC,EAE5BC,EAAyC,CAC7C,UAAWD,EACX,WAAc,CAAC,EACf,qBAA0B,CAAC,EAC3B,OAAQ,uBACR,aAAc,CAChB,EAEME,EAAwC,CAC5C,MAAO,GACP,OAAQ,GACR,UAAW,+BACX,QAAS,6BACT,gBAAiB,GACjB,aAAc,EACd,WAAc,CAAC,CACjB,EAEMC,EAAoC,CAAE,MAAO,KAAM,QAAS,EAAK,EAMjEC,EAAiCnC,EAAM,cAAc,EAAK,EAO1DoC,EAAgB,WAMtB,SAASC,EAAoB,EAA0C,CAIrE,OAHgBr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,EAAAP,EAAA,KAAA,CAAC,MAAD,CACE,KAAK,SACL,UAAWxB,EAAAA,GACTW,EAAAA,yBAAyB,KACzB,8CACA2D,CACF,EACA,GAAI5B,EACJ,GAAIiE,GAAUC,EAAK,QACnB,kBAAiBA,EAAK,UACtB,aAAW,OACN,MAXP,SAAA,CAaGd,EACAoB,GAAM,KACJ,GAC6B,CAAA,EAhCb,IAkC3B,EACA,EAAe,YAAc,iBAmB7B,IAAaC,EAA4B,OAAO,OAAO3E,EAAe,CACpE,KAAMqC,EACN,QAASK,EACT,MAAOC,CACT,CAAC"}
1
+ {"version":3,"file":"Accordion.cjs","names":["React","useControllable","useId","cn","accordionClassNames","getElementType","flattenChildren","accordionTriggerClassNames","getPartId","accordionItemClassNames","disabledStyles","focusRingInset","composeEventHandlers","ChevronDownIcon","accordionPanelClassNames","require_runtime","require_cn","require_children","require_dev","require_composeEventHandlers","require_classNames","require_useControllable","require_useId","require_styles","require_icons","require_disclosureIds","react","react_jsx_runtime","AccordionContext","AccordionItemContext","AccordionPanelSlotContext","EMPTY","INERT_ACCORDION","INERT_ITEM","IN_PANEL","AccordionHeadingOutsideContext","HEADING_CLASS","useAccordionContext","component","useAccordionItemContext","warnDuplicateValue","value","toItems","AccordionRoot","openItemsProp","rest","props","multiple","type","defaultOpenItems","onOpenItemsChange","controlledSingle","openItem","controlled","initialItems","defaultOpenItem","openItems","setOpenItems","list","next","onOpenItemChange","openCount","toggle","prev","v","itemCountsRef","registerItem","counts","count","remaining","baseId","context","headingLevel","className","findPart","node","child","found","part","barrier","AccordionItem","idOf","id","element","wrapsTriggerOnly","AccordionTrigger","AccordionPanel","misplacedMessage","headingLevelProp","accordion","isOpen","toggleValue","Heading","triggerElement","panelElement","parts","extra","children","keyed","key","trigger","panel","hasTrigger","hasPanel","triggerIdProp","panelIdProp","hasPanelContent","extraPanelContent","itemContext","panelSlot","idProp","item","inPanel","headingOutside","state","button","onClick","slot","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":"2fA0DA,IAAM4B,EAAmB5B,EAAM,cAA4C,IAAI,EACzE6B,EAAuB7B,EAAM,cAAgD,IAAI,EACjF8B,EAA4B9B,EAAM,cAA8C,IAAI,EAEpF+B,EAA2B,CAAC,EAE5BC,EAAyC,CAC7C,UAAWD,EACX,WAAc,CAAC,EACf,qBAA0B,CAAC,EAC3B,OAAQ,uBACR,aAAc,CAChB,EAEME,EAAwC,CAC5C,MAAO,GACP,OAAQ,GACR,UAAW,+BACX,QAAS,6BACT,gBAAiB,GACjB,aAAc,EACd,WAAc,CAAC,CACjB,EAEMC,EAAoC,CAAE,MAAO,KAAM,QAAS,EAAK,EAMjEC,EAAiCnC,EAAM,cAAc,EAAK,EAO1DoC,EAAgB,WAMtB,SAASC,EAAoB,EAA0C,CAIrE,OAHgBrC,EAAM,WAAW4B,CAC7B,IACJV,EAAA,qBAAqBoB,EAAW,aAAa,EACtCN,EACT,CAEA,SAASO,EAAwB,EAA8C,CAI7E,OAHgBvC,EAAM,WAAW6B,CAC7B,IACJX,EAAA,qBAAqBoB,EAAW,kBAAkB,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aAAW,OACN,MAXP,SAAA,CAaGd,EACAoB,GAAM,KACJ,GAC6B,CAAA,EAhCb,IAkC3B,EACA,EAAe,YAAc,iBAmB7B,IAAaC,EAA4B,OAAO,OAAO3E,EAAe,CACpE,KAAMqC,EACN,QAASK,EACT,MAAOC,CACT,CAAC"}
@@ -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 { 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. */\nexport type AccordionHeadingLevel = 1 | 2 | 3 | 4 | 5 | 6;\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,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,MAA0B;CAC/C,IAAM,EACJ,SACA,aACA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D,EAAS,gCAAgC6B,EAAiB,iBAAiB,CAAC;CAC3F,GAAG,CAAC6B,CAAO,CAAC,GACPD,EAAK,SACNC,IAGA,kBAAC,OAAD;EACE,WAAW9C,EAAGwD,EAAyB,MAAMtD,CAAS;EACtD,GAAIjC;EACJ,IAAI2E,KAAU,KAAA;EACT;EAEJ;CACE,CAAA,IAIP,kBAAC3F,EAA0B,UAA3B;EAAoC,OAAOI;EACzC,UAAA,kBAAC,OAAD;GACE,MAAK;GACL,WAAW2C,EACTwD,EAAyB,MACzB,+CACAtD,CACF;GACA,GAAIjC;GACJ,IAAI2E,KAAUC,EAAK;GACnB,mBAAiBA,EAAK;GACtB,cAAW;GACN;GAXP,UAAA,CAaGjB,GACA2B,GAAM,KACJ;;CAC6B,CAAA,IAhCb;AAkC3B;AACA,EAAe,cAAc;AAmB7B,IAAaE,IAA4B,uBAAO,OAAO1F,GAAe;CACpE,MAAM2C;CACN,SAASK;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","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,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,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ACAY,EAAK,UAAU,YACjB;EACD,CAAA,CACK;;CAGV,OAAOE,IACLE,IAEA,kBAAC3B,GAAD;EAAS,WAAWtB,EAAGiC,EAA2B,SAAS1E,CAAa;EAAI,UAAA0F;CAAgB,CAAA;AAEhG;AACA,EAAiB,cAAc;AAiB/B,IAAMjC,KAAkB,EAAE,IAAI4B,GAAQ,cAAW,aAAU,QAAK,GAAG3E,QAAgC;CACjG,IAAM4E,IAAOlF,EAAwB,iBAAiB,GAChD4F,IAAOzG,EAAM,WAAWG,CAAyB,GACjD6F,IAAUS,GAAM,WAAW;CAkBjC,OAjBAzG,EAAM,gBAAgB;EACpB,AAAIgG,KAAS1D,EAAS,gCAAgC6B,EAAiB,iBAAiB,CAAC;CAC3F,GAAG,CAAC6B,CAAO,CAAC,GACPD,EAAK,SACNC,IAGA,kBAAC,OAAD;EACE,WAAW9C,EAAGwD,EAAyB,MAAMtD,CAAS;EACtD,GAAIjC;EACJ,IAAI2E,KAAU,KAAA;EACT;EAEJ;CACE,CAAA,IAIP,kBAAC3F,EAA0B,UAA3B;EAAoC,OAAOI;EACzC,UAAA,kBAAC,OAAD;GACE,MAAK;GACL,WAAW2C,EACTwD,EAAyB,MACzB,+CACAtD,CACF;GACA,GAAIjC;GACJ,IAAI2E,KAAUC,EAAK;GACnB,mBAAiBA,EAAK;GACtB,cAAW;GACN;GAXP,UAAA,CAaGjB,GACA2B,GAAM,KACJ;;CAC6B,CAAA,IAhCb;AAkC3B;AACA,EAAe,cAAc;AAmB7B,IAAaE,IAA4B,uBAAO,OAAO1F,GAAe;CACpE,MAAM2C;CACN,SAASK;CACT,OAAOC;AACT,CAAC"}
@@ -0,0 +1,2 @@
1
+ "use client";const e=require("../../_virtual/_rolldown/runtime.cjs"),t=require("../../lib/cn.cjs"),n=require("../../lib/dev.cjs"),r=require("../../lib/slot.cjs"),i=require("../../lib/composeEventHandlers.cjs"),a=require("../../lib/classNames.cjs"),o=require("../button/Button.cjs"),s=require("../button/Button.slots.cjs"),c=require("../../lib/icons.cjs"),l=require("./NavDrawer.context.cjs");let u=require("react");u=e.__toESM(u,1);let d=require("react/jsx-runtime");var f={"extra-small":12,small:16,medium:20,large:24,"extra-large":28},p=({appearance:e=`subtle`,size:p=`medium`,icon:m,onClick:h,className:g,children:_,ref:v,...y})=>{let b=u.useContext(l.NavDrawerContext),{glyph:x,button:S}=s.unwrapButtonGlyph(m),C=r.slotRendersContent(x),w=S===null&&m!=null&&!C;u.useEffect(()=>{w&&n.warnOnce(`Hamburger:icon-empty`,"Hamburger: `icon` renders nothing, so the default navigation glyph shows. Unlike `Button`, a Hamburger always shows a glyph: pass an icon, or leave `icon` unset.")},[w]),u.useEffect(()=>{S&&n.warnOnce(`Hamburger:icon-button`,`Hamburger: \`icon\` received ${S}; its children render as the glyph and its props were dropped (buttons cannot be nested). Pass icon content instead, e.g. \`icon={<MyIcon />}\`.`)},[S]);let T=r.materialiseSlotContent(_),E=!!y[`aria-label`]||!!y[`aria-labelledby`]||!!y.title||r.slotRendersContent(T),D=b?e=>{e.target instanceof Node&&e.currentTarget.contains(e.target)&&b.requestOpen(!b.open,{reason:`trigger`,event:e.nativeEvent})}:void 0,O=b?{"aria-expanded":b.open,"aria-controls":b.panelId,"aria-haspopup":void 0}:void 0;return(0,d.jsx)(o.Button,{...y,"aria-label":E?y[`aria-label`]:`Navigation`,...O,ref:v,appearance:e,size:p,icon:s.withPartClass(C?x:(0,d.jsx)(c.NavigationIcon,{size:f[p]}),a.hamburgerClassNames.icon),onClick:i.composeEventHandlers(h,D),className:t.cn(a.hamburgerClassNames.root,g),children:T})};p.displayName=`Hamburger`,exports.Hamburger=p;
2
+ //# sourceMappingURL=Hamburger.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Hamburger.cjs","names":["React","NavDrawerContext","unwrapButtonGlyph","slotRendersContent","materialiseSlotContent","Button","withPartClass","NavigationIcon","hamburgerClassNames","composeEventHandlers","cn","require_runtime","require_cn","require_dev","require_slot","require_composeEventHandlers","require_classNames","require_Button","require_Button_slots","require_icons","require_NavDrawer_context","react","react_jsx_runtime","GLYPH_SIZES","Hamburger","rest","drawer","iconButton","icon","glyphRenders","glyph","iconEmpty","label","children","named","toggle","event","stateProps","size","onClick","className"],"sources":["../../../src/components/navigation/Hamburger.tsx"],"sourcesContent":["import * as React from 'react';\nimport { cn } from '../../lib/cn';\nimport { hamburgerClassNames } from '../../lib/classNames';\nimport { composeEventHandlers } from '../../lib/composeEventHandlers';\nimport { warnOnce } from '../../lib/dev';\nimport { NavigationIcon } from '../../lib/icons';\nimport { materialiseSlotContent, slotRendersContent, type Slot } from '../../lib/slot';\nimport type { Appearance, Size } from '../../lib/types';\nimport { Button } from '../button/Button';\nimport { unwrapButtonGlyph, withPartClass } from '../button/Button.slots';\nimport { NavDrawerContext } from './NavDrawer.context';\n\n/*\n * Hamburger: a Button with the navigation glyph that toggles the NavDrawer it sits in. Reads only\n * the NavDrawer's context module (never `NavDrawer.tsx`), so it holds no drawer machinery.\n */\n\n/** Properties for the Hamburger component. */\nexport interface HamburgerProps extends React.ButtonHTMLAttributes<HTMLButtonElement> {\n /**\n * Visual style. Fluent's `transparent` look is WaveUI's `subtle` (WaveUI's `transparent` is\n * link-coloured).\n * @default 'subtle'\n */\n appearance?: Appearance;\n /**\n * Size: the button's height and the glyph (12, 16, 20, 24 or 28px).\n * @default 'medium'\n */\n size?: Size;\n /**\n * Replaces the navigation glyph (three bars). Decorative (`aria-hidden`). Unlike Button's `icon`,\n * a Hamburger always shows a glyph: `null`, `undefined` and a value that renders nothing keep\n * the default (the last warns in development). A `<button>` or `Button` passed here is not\n * nested: its children become the glyph and its props are dropped, with a warning.\n */\n icon?: Slot<'span'>;\n /**\n * The button's name. Without `aria-label`, `aria-labelledby`, `title` or a visible label\n * (children), the Hamburger is named \"Navigation\"; localize it here. The name stays the same\n * while the drawer opens and closes (the state is `aria-expanded`).\n * @default 'Navigation'\n */\n 'aria-label'?: string;\n /**\n * Unavailable but focusable (see `Button.disabledFocusable`): no toggle, no `onClick`.\n * @default false\n */\n disabledFocusable?: boolean;\n /** Ref to the `<button>`. */\n ref?: React.Ref<HTMLButtonElement>;\n}\n\n/** The default glyph's size per button size. */\nconst GLYPH_SIZES: Readonly<Record<Size, number>> = {\n 'extra-small': 12,\n small: 16,\n medium: 20,\n large: 24,\n 'extra-large': 28,\n};\n\n/**\n * A button that opens and closes a navigation drawer: a `Button` (`subtle`, icon-only) with the\n * navigation glyph, named \"Navigation\" by default. Inside a `NavDrawer` (in its header) it toggles\n * that drawer and reports it with `aria-expanded` and `aria-controls`. Elsewhere (your page\n * header) it is a plain button: pass `aria-expanded={open}`, `aria-controls` (while the drawer's\n * panel is rendered) and, for an overlay drawer, `aria-haspopup=\"dialog\"`, and toggle your state\n * in `onClick`. Fluent's `Hamburger`.\n *\n * @example\n * <Hamburger\n * aria-expanded={open}\n * aria-controls={open ? 'main-nav' : undefined}\n * aria-haspopup=\"dialog\"\n * onClick={() => setOpen(!open)}\n * />\n */\nexport const Hamburger = ({\n appearance = 'subtle',\n size = 'medium',\n icon,\n onClick,\n className,\n children,\n ref,\n ...rest\n}: HamburgerProps) => {\n const drawer = React.useContext(NavDrawerContext);\n\n // A required indicator (C-SLOTS): a button passed as `icon` is unwrapped, never nested, and a\n // value that renders nothing keeps the default glyph.\n const { glyph, button: iconButton } = unwrapButtonGlyph(icon);\n const glyphRenders = slotRendersContent(glyph);\n // An unwrapped button reports its own warning only.\n const iconEmpty = iconButton === null && icon != null && !glyphRenders;\n React.useEffect(() => {\n if (iconEmpty) {\n warnOnce(\n 'Hamburger:icon-empty',\n 'Hamburger: `icon` renders nothing, so the default navigation glyph shows. Unlike `Button`, a Hamburger always shows a glyph: pass an icon, or leave `icon` unset.',\n );\n }\n }, [iconEmpty]);\n React.useEffect(() => {\n if (iconButton) {\n warnOnce(\n 'Hamburger:icon-button',\n `Hamburger: \\`icon\\` received ${iconButton}; its children render as the glyph and its props were dropped (buttons cannot be nested). Pass icon content instead, e.g. \\`icon={<MyIcon />}\\`.`,\n );\n }\n }, [iconButton]);\n\n // The default name, while nothing else names the button. A generator label is read once; its\n // items are what renders.\n const label = materialiseSlotContent(children);\n const named =\n Boolean(rest['aria-label']) ||\n Boolean(rest['aria-labelledby']) ||\n Boolean(rest.title) ||\n slotRendersContent(label);\n\n // Inside a NavDrawer: the toggle, after the consumer's onClick (`preventDefault()` skips it). A\n // click that bubbles through the React tree from a portal opened inside it is not its own\n // (C-COMPOSE).\n const toggle = drawer\n ? (event: React.MouseEvent<HTMLButtonElement>) => {\n if (!(event.target instanceof Node) || !event.currentTarget.contains(event.target)) return;\n drawer.requestOpen(!drawer.open, { reason: 'trigger', event: event.nativeEvent });\n }\n : undefined;\n // The drawer's state wins over a consumer's (the modal triggers' rule); no `aria-haspopup`, as\n // the Hamburger is inside the surface it toggles.\n const stateProps = drawer\n ? {\n 'aria-expanded': drawer.open,\n 'aria-controls': drawer.panelId,\n 'aria-haspopup': undefined,\n }\n : undefined;\n\n return (\n <Button\n {...rest}\n aria-label={named ? rest['aria-label'] : 'Navigation'}\n {...stateProps}\n ref={ref}\n appearance={appearance}\n size={size}\n icon={withPartClass(\n glyphRenders ? glyph : <NavigationIcon size={GLYPH_SIZES[size]} />,\n hamburgerClassNames.icon,\n )}\n onClick={composeEventHandlers(onClick, toggle)}\n className={cn(hamburgerClassNames.root, className)}\n >\n {label}\n </Button>\n );\n};\nHamburger.displayName = 'Hamburger';\n"],"mappings":"mdAsDA,IAAMuB,EAA8C,CAClD,cAAe,GACf,MAAO,GACP,OAAQ,GACR,MAAO,GACP,cAAe,EACjB,EAkBaC,GAAa,CACxB,aAAa,SACb,OAAO,SACP,OACA,UACA,YACA,WACA,MACA,GAAGC,KACiB,CACpB,IAAMC,EAAS1B,EAAM,WAAWC,EAAAA,gBAAgB,EAI1C,CAAE,QAAO,OAAQ0B,GAAezB,EAAAA,kBAAkB0B,CAAI,EACtDC,EAAe1B,EAAAA,mBAAmB2B,CAAK,EAEvCC,EAAYJ,IAAe,MAAQC,GAAQ,MAAQ,CAACC,EAC1DR,EAAM,cAAgB,CAChBU,GACFlB,EAAA,SACE,uBACA,mKACF,CAEJ,EAAG,CAACkB,CAAS,CAAC,EACdV,EAAM,cAAgB,CAChBM,GACFd,EAAA,SACE,wBACA,gCAAgCc,EAAW,iJAC7C,CAEJ,EAAG,CAACA,CAAU,CAAC,EAIf,IAAMK,EAAQ5B,EAAAA,uBAAuB6B,CAAQ,EACvCC,EACJ,EAAQT,EAAK,eACb,EAAQA,EAAK,oBACb,EAAQA,EAAK,OACbtB,EAAAA,mBAAmB6B,CAAK,EAKpBG,EAAST,EACV,GAA+C,CACxCU,EAAM,kBAAkB,MAAUA,EAAM,cAAc,SAASA,EAAM,MAAM,GACjFV,EAAO,YAAY,CAACA,EAAO,KAAM,CAAE,OAAQ,UAAW,MAAOU,EAAM,WAAY,CAAC,CAClF,EACA,IAAA,GAGEC,EAAaX,EACf,CACE,gBAAiBA,EAAO,KACxB,gBAAiBA,EAAO,QACxB,gBAAiB,IAAA,EACnB,EACA,IAAA,GAEJ,OACE,EAAAJ,EAAA,IAAA,CAACjB,EAAAA,OAAD,CACE,GAAIoB,EACJ,aAAYS,EAAQT,EAAK,cAAgB,aACzC,GAAIY,EACC,MACO,aACN,OACN,KAAM/B,EAAAA,cACJuB,EAAeC,GAAQ,EAAAR,EAAA,IAAA,CAACf,EAAAA,eAAD,CAAgB,KAAMgB,EAAYe,EAAQ,CAAA,EACjE9B,EAAAA,oBAAoB,IACtB,EACA,QAASC,EAAAA,qBAAqB8B,EAASJ,CAAM,EAC7C,UAAWzB,EAAAA,GAAGF,EAAAA,oBAAoB,KAAMgC,CAAS,EAEhD,SAAAR,CACK,CAAA,CAEZ,EACA,EAAU,YAAc"}
@@ -0,0 +1,54 @@
1
+ "use client";
2
+ import { cn as e } from "../../lib/cn.mjs";
3
+ import { warnOnce as t } from "../../lib/dev.mjs";
4
+ import { materialiseSlotContent as n, slotRendersContent as r } from "../../lib/slot.mjs";
5
+ import { composeEventHandlers as i } from "../../lib/composeEventHandlers.mjs";
6
+ import { hamburgerClassNames as a } from "../../lib/classNames.mjs";
7
+ import { Button as o } from "../button/Button.mjs";
8
+ import { unwrapButtonGlyph as s, withPartClass as c } from "../button/Button.slots.mjs";
9
+ import { NavigationIcon as l } from "../../lib/icons.mjs";
10
+ import { NavDrawerContext as u } from "./NavDrawer.context.mjs";
11
+ import * as d from "react";
12
+ import { jsx as f } from "react/jsx-runtime";
13
+ //#region src/components/navigation/Hamburger.tsx
14
+ var p = {
15
+ "extra-small": 12,
16
+ small: 16,
17
+ medium: 20,
18
+ large: 24,
19
+ "extra-large": 28
20
+ }, m = ({ appearance: m = "subtle", size: h = "medium", icon: g, onClick: _, className: v, children: y, ref: b, ...x }) => {
21
+ let S = d.useContext(u), { glyph: C, button: w } = s(g), T = r(C), E = w === null && g != null && !T;
22
+ d.useEffect(() => {
23
+ E && t("Hamburger:icon-empty", "Hamburger: `icon` renders nothing, so the default navigation glyph shows. Unlike `Button`, a Hamburger always shows a glyph: pass an icon, or leave `icon` unset.");
24
+ }, [E]), d.useEffect(() => {
25
+ w && t("Hamburger:icon-button", `Hamburger: \`icon\` received ${w}; its children render as the glyph and its props were dropped (buttons cannot be nested). Pass icon content instead, e.g. \`icon={<MyIcon />}\`.`);
26
+ }, [w]);
27
+ let D = n(y), O = !!x["aria-label"] || !!x["aria-labelledby"] || !!x.title || r(D), k = S ? (e) => {
28
+ e.target instanceof Node && e.currentTarget.contains(e.target) && S.requestOpen(!S.open, {
29
+ reason: "trigger",
30
+ event: e.nativeEvent
31
+ });
32
+ } : void 0, A = S ? {
33
+ "aria-expanded": S.open,
34
+ "aria-controls": S.panelId,
35
+ "aria-haspopup": void 0
36
+ } : void 0;
37
+ return /* @__PURE__ */ f(o, {
38
+ ...x,
39
+ "aria-label": O ? x["aria-label"] : "Navigation",
40
+ ...A,
41
+ ref: b,
42
+ appearance: m,
43
+ size: h,
44
+ icon: c(T ? C : /* @__PURE__ */ f(l, { size: p[h] }), a.icon),
45
+ onClick: i(_, k),
46
+ className: e(a.root, v),
47
+ children: D
48
+ });
49
+ };
50
+ m.displayName = "Hamburger";
51
+ //#endregion
52
+ export { m as Hamburger };
53
+
54
+ //# sourceMappingURL=Hamburger.mjs.map