@mortenbrudvik/waveui 0.4.0 → 0.7.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 (574) hide show
  1. package/README.md +1221 -173
  2. package/dist/_virtual/_rolldown/runtime.cjs +1 -0
  3. package/dist/components/button/Button.cjs +2 -0
  4. package/dist/components/button/Button.cjs.map +1 -0
  5. package/dist/components/button/Button.mjs +50 -0
  6. package/dist/components/button/Button.mjs.map +1 -0
  7. package/dist/components/button/Button.semantics.cjs +2 -0
  8. package/dist/components/button/Button.semantics.cjs.map +1 -0
  9. package/dist/components/button/Button.semantics.mjs +61 -0
  10. package/dist/components/button/Button.semantics.mjs.map +1 -0
  11. package/dist/components/button/Button.slots.cjs +2 -0
  12. package/dist/components/button/Button.slots.cjs.map +1 -0
  13. package/dist/components/button/Button.slots.mjs +47 -0
  14. package/dist/components/button/Button.slots.mjs.map +1 -0
  15. package/dist/components/button/CompoundButton.cjs +2 -0
  16. package/dist/components/button/CompoundButton.cjs.map +1 -0
  17. package/dist/components/button/CompoundButton.mjs +53 -0
  18. package/dist/components/button/CompoundButton.mjs.map +1 -0
  19. package/dist/components/button/Link.cjs +2 -0
  20. package/dist/components/button/Link.cjs.map +1 -0
  21. package/dist/components/button/Link.mjs +37 -0
  22. package/dist/components/button/Link.mjs.map +1 -0
  23. package/dist/components/button/MenuButton.cjs +2 -0
  24. package/dist/components/button/MenuButton.cjs.map +1 -0
  25. package/dist/components/button/MenuButton.mjs +45 -0
  26. package/dist/components/button/MenuButton.mjs.map +1 -0
  27. package/dist/components/button/SplitButton.cjs +2 -0
  28. package/dist/components/button/SplitButton.cjs.map +1 -0
  29. package/dist/components/button/SplitButton.mjs +66 -0
  30. package/dist/components/button/SplitButton.mjs.map +1 -0
  31. package/dist/components/button/ToggleButton.cjs +2 -0
  32. package/dist/components/button/ToggleButton.cjs.map +1 -0
  33. package/dist/components/button/ToggleButton.mjs +65 -0
  34. package/dist/components/button/ToggleButton.mjs.map +1 -0
  35. package/dist/components/button/Toolbar.cjs +2 -0
  36. package/dist/components/button/Toolbar.cjs.map +1 -0
  37. package/dist/components/button/Toolbar.context.cjs +2 -0
  38. package/dist/components/button/Toolbar.context.cjs.map +1 -0
  39. package/dist/components/button/Toolbar.context.mjs +31 -0
  40. package/dist/components/button/Toolbar.context.mjs.map +1 -0
  41. package/dist/components/button/Toolbar.mjs +63 -0
  42. package/dist/components/button/Toolbar.mjs.map +1 -0
  43. package/dist/components/button/Toolbar.parts.cjs +2 -0
  44. package/dist/components/button/Toolbar.parts.cjs.map +1 -0
  45. package/dist/components/button/Toolbar.parts.mjs +131 -0
  46. package/dist/components/button/Toolbar.parts.mjs.map +1 -0
  47. package/dist/components/button/buttonStyles.cjs +2 -0
  48. package/dist/components/button/buttonStyles.cjs.map +1 -0
  49. package/dist/components/button/buttonStyles.mjs +39 -0
  50. package/dist/components/button/buttonStyles.mjs.map +1 -0
  51. package/dist/components/data-display/Avatar.cjs +2 -0
  52. package/dist/components/data-display/Avatar.cjs.map +1 -0
  53. package/dist/components/data-display/Avatar.mjs +157 -0
  54. package/dist/components/data-display/Avatar.mjs.map +1 -0
  55. package/dist/components/data-display/AvatarGroup.cjs +2 -0
  56. package/dist/components/data-display/AvatarGroup.cjs.map +1 -0
  57. package/dist/components/data-display/AvatarGroup.mjs +134 -0
  58. package/dist/components/data-display/AvatarGroup.mjs.map +1 -0
  59. package/dist/components/data-display/Badge.cjs +2 -0
  60. package/dist/components/data-display/Badge.cjs.map +1 -0
  61. package/dist/components/data-display/Badge.colors.cjs +2 -0
  62. package/dist/components/data-display/Badge.colors.cjs.map +1 -0
  63. package/dist/components/data-display/Badge.colors.mjs +58 -0
  64. package/dist/components/data-display/Badge.colors.mjs.map +1 -0
  65. package/dist/components/data-display/Badge.mjs +32 -0
  66. package/dist/components/data-display/Badge.mjs.map +1 -0
  67. package/dist/components/data-display/CounterBadge.cjs +2 -0
  68. package/dist/components/data-display/CounterBadge.cjs.map +1 -0
  69. package/dist/components/data-display/CounterBadge.mjs +28 -0
  70. package/dist/components/data-display/CounterBadge.mjs.map +1 -0
  71. package/dist/components/data-display/Divider.cjs +2 -0
  72. package/dist/components/data-display/Divider.cjs.map +1 -0
  73. package/dist/components/data-display/Divider.mjs +52 -0
  74. package/dist/components/data-display/Divider.mjs.map +1 -0
  75. package/dist/components/data-display/Image.cjs +2 -0
  76. package/dist/components/data-display/Image.cjs.map +1 -0
  77. package/dist/components/data-display/Image.mjs +32 -0
  78. package/dist/components/data-display/Image.mjs.map +1 -0
  79. package/dist/components/data-display/InfoLabel.cjs +2 -0
  80. package/dist/components/data-display/InfoLabel.cjs.map +1 -0
  81. package/dist/components/data-display/InfoLabel.mjs +104 -0
  82. package/dist/components/data-display/InfoLabel.mjs.map +1 -0
  83. package/dist/components/data-display/List.cjs +2 -0
  84. package/dist/components/data-display/List.cjs.map +1 -0
  85. package/dist/components/data-display/List.mjs +381 -0
  86. package/dist/components/data-display/List.mjs.map +1 -0
  87. package/dist/components/data-display/List.registry.cjs +2 -0
  88. package/dist/components/data-display/List.registry.cjs.map +1 -0
  89. package/dist/components/data-display/List.registry.mjs +101 -0
  90. package/dist/components/data-display/List.registry.mjs.map +1 -0
  91. package/dist/components/data-display/Persona.cjs +2 -0
  92. package/dist/components/data-display/Persona.cjs.map +1 -0
  93. package/dist/components/data-display/Persona.mjs +48 -0
  94. package/dist/components/data-display/Persona.mjs.map +1 -0
  95. package/dist/components/data-display/PresenceBadge.cjs +2 -0
  96. package/dist/components/data-display/PresenceBadge.cjs.map +1 -0
  97. package/dist/components/data-display/PresenceBadge.mjs +71 -0
  98. package/dist/components/data-display/PresenceBadge.mjs.map +1 -0
  99. package/dist/components/data-display/Tag.cjs +2 -0
  100. package/dist/components/data-display/Tag.cjs.map +1 -0
  101. package/dist/components/data-display/Tag.mjs +147 -0
  102. package/dist/components/data-display/Tag.mjs.map +1 -0
  103. package/dist/components/feedback/MessageBar.cjs +2 -0
  104. package/dist/components/feedback/MessageBar.cjs.map +1 -0
  105. package/dist/components/feedback/MessageBar.mjs +144 -0
  106. package/dist/components/feedback/MessageBar.mjs.map +1 -0
  107. package/dist/components/feedback/MessageBar.status.cjs +2 -0
  108. package/dist/components/feedback/MessageBar.status.cjs.map +1 -0
  109. package/dist/components/feedback/MessageBar.status.mjs +45 -0
  110. package/dist/components/feedback/MessageBar.status.mjs.map +1 -0
  111. package/dist/components/feedback/ProgressBar.cjs +2 -0
  112. package/dist/components/feedback/ProgressBar.cjs.map +1 -0
  113. package/dist/components/feedback/ProgressBar.mjs +72 -0
  114. package/dist/components/feedback/ProgressBar.mjs.map +1 -0
  115. package/dist/components/feedback/Skeleton.cjs +2 -0
  116. package/dist/components/feedback/Skeleton.cjs.map +1 -0
  117. package/dist/components/feedback/Skeleton.mjs +47 -0
  118. package/dist/components/feedback/Skeleton.mjs.map +1 -0
  119. package/dist/components/feedback/Spinner.cjs +2 -0
  120. package/dist/components/feedback/Spinner.cjs.map +1 -0
  121. package/dist/components/feedback/Spinner.mjs +60 -0
  122. package/dist/components/feedback/Spinner.mjs.map +1 -0
  123. package/dist/components/feedback/Toast.cjs +2 -0
  124. package/dist/components/feedback/Toast.cjs.map +1 -0
  125. package/dist/components/feedback/Toast.mjs +347 -0
  126. package/dist/components/feedback/Toast.mjs.map +1 -0
  127. package/dist/components/input/Checkbox.cjs +2 -0
  128. package/dist/components/input/Checkbox.cjs.map +1 -0
  129. package/dist/components/input/Checkbox.mjs +96 -0
  130. package/dist/components/input/Checkbox.mjs.map +1 -0
  131. package/dist/components/input/ColorPicker.cjs +6 -0
  132. package/dist/components/input/ColorPicker.cjs.map +1 -0
  133. package/dist/components/input/ColorPicker.mjs +236 -0
  134. package/dist/components/input/ColorPicker.mjs.map +1 -0
  135. package/dist/components/input/Combobox.cjs +2 -0
  136. package/dist/components/input/Combobox.cjs.map +1 -0
  137. package/dist/components/input/Combobox.expand.cjs +2 -0
  138. package/dist/components/input/Combobox.expand.cjs.map +1 -0
  139. package/dist/components/input/Combobox.expand.mjs +38 -0
  140. package/dist/components/input/Combobox.expand.mjs.map +1 -0
  141. package/dist/components/input/Combobox.mjs +187 -0
  142. package/dist/components/input/Combobox.mjs.map +1 -0
  143. package/dist/components/input/DatePicker.cjs +2 -0
  144. package/dist/components/input/DatePicker.cjs.map +1 -0
  145. package/dist/components/input/DatePicker.mjs +340 -0
  146. package/dist/components/input/DatePicker.mjs.map +1 -0
  147. package/dist/components/input/Dropdown.cjs +2 -0
  148. package/dist/components/input/Dropdown.cjs.map +1 -0
  149. package/dist/components/input/Dropdown.mjs +128 -0
  150. package/dist/components/input/Dropdown.mjs.map +1 -0
  151. package/dist/components/input/Field.cjs +2 -0
  152. package/dist/components/input/Field.cjs.map +1 -0
  153. package/dist/components/input/Field.mjs +200 -0
  154. package/dist/components/input/Field.mjs.map +1 -0
  155. package/dist/components/input/Input.cjs +2 -0
  156. package/dist/components/input/Input.cjs.map +1 -0
  157. package/dist/components/input/Input.mjs +81 -0
  158. package/dist/components/input/Input.mjs.map +1 -0
  159. package/dist/components/input/Label.cjs +2 -0
  160. package/dist/components/input/Label.cjs.map +1 -0
  161. package/dist/components/input/Label.mjs +28 -0
  162. package/dist/components/input/Label.mjs.map +1 -0
  163. package/dist/components/input/Option.cjs +2 -0
  164. package/dist/components/input/Option.cjs.map +1 -0
  165. package/dist/components/input/Option.mjs +169 -0
  166. package/dist/components/input/Option.mjs.map +1 -0
  167. package/dist/components/input/RadioGroup.cjs +2 -0
  168. package/dist/components/input/RadioGroup.cjs.map +1 -0
  169. package/dist/components/input/RadioGroup.mjs +139 -0
  170. package/dist/components/input/RadioGroup.mjs.map +1 -0
  171. package/dist/components/input/Rating.cjs +2 -0
  172. package/dist/components/input/Rating.cjs.map +1 -0
  173. package/dist/components/input/Rating.mjs +196 -0
  174. package/dist/components/input/Rating.mjs.map +1 -0
  175. package/dist/components/input/SearchBox.cjs +2 -0
  176. package/dist/components/input/SearchBox.cjs.map +1 -0
  177. package/dist/components/input/SearchBox.mjs +205 -0
  178. package/dist/components/input/SearchBox.mjs.map +1 -0
  179. package/dist/components/input/Select.cjs +2 -0
  180. package/dist/components/input/Select.cjs.map +1 -0
  181. package/dist/components/input/Select.mjs +33 -0
  182. package/dist/components/input/Select.mjs.map +1 -0
  183. package/dist/components/input/Slider.cjs +2 -0
  184. package/dist/components/input/Slider.cjs.map +1 -0
  185. package/dist/components/input/Slider.mjs +79 -0
  186. package/dist/components/input/Slider.mjs.map +1 -0
  187. package/dist/components/input/SpinButton.cjs +2 -0
  188. package/dist/components/input/SpinButton.cjs.map +1 -0
  189. package/dist/components/input/SpinButton.mjs +157 -0
  190. package/dist/components/input/SpinButton.mjs.map +1 -0
  191. package/dist/components/input/SwatchPicker.cjs +2 -0
  192. package/dist/components/input/SwatchPicker.cjs.map +1 -0
  193. package/dist/components/input/SwatchPicker.mjs +113 -0
  194. package/dist/components/input/SwatchPicker.mjs.map +1 -0
  195. package/dist/components/input/Switch.cjs +2 -0
  196. package/dist/components/input/Switch.cjs.map +1 -0
  197. package/dist/components/input/Switch.mjs +92 -0
  198. package/dist/components/input/Switch.mjs.map +1 -0
  199. package/dist/components/input/TagPicker.cjs +2 -0
  200. package/dist/components/input/TagPicker.cjs.map +1 -0
  201. package/dist/components/input/TagPicker.mjs +249 -0
  202. package/dist/components/input/TagPicker.mjs.map +1 -0
  203. package/dist/components/input/Textarea.cjs +2 -0
  204. package/dist/components/input/Textarea.cjs.map +1 -0
  205. package/dist/components/input/Textarea.mjs +32 -0
  206. package/dist/components/input/Textarea.mjs.map +1 -0
  207. package/dist/components/input/TimePicker.cjs +2 -0
  208. package/dist/components/input/TimePicker.cjs.map +1 -0
  209. package/dist/components/input/TimePicker.mjs +292 -0
  210. package/dist/components/input/TimePicker.mjs.map +1 -0
  211. package/dist/components/input/colorUtils.cjs +2 -0
  212. package/dist/components/input/colorUtils.cjs.map +1 -0
  213. package/dist/components/input/colorUtils.mjs +96 -0
  214. package/dist/components/input/colorUtils.mjs.map +1 -0
  215. package/dist/components/input/dateUtils.cjs +2 -0
  216. package/dist/components/input/dateUtils.cjs.map +1 -0
  217. package/dist/components/input/dateUtils.mjs +250 -0
  218. package/dist/components/input/dateUtils.mjs.map +1 -0
  219. package/dist/components/input/pickerStyles.cjs +2 -0
  220. package/dist/components/input/pickerStyles.cjs.map +1 -0
  221. package/dist/components/input/pickerStyles.mjs +10 -0
  222. package/dist/components/input/pickerStyles.mjs.map +1 -0
  223. package/dist/components/internal/HiddenInput.cjs +2 -0
  224. package/dist/components/internal/HiddenInput.cjs.map +1 -0
  225. package/dist/components/internal/HiddenInput.mjs +88 -0
  226. package/dist/components/internal/HiddenInput.mjs.map +1 -0
  227. package/dist/components/layout/Accordion.cjs +2 -0
  228. package/dist/components/layout/Accordion.cjs.map +1 -0
  229. package/dist/components/layout/Accordion.mjs +236 -0
  230. package/dist/components/layout/Accordion.mjs.map +1 -0
  231. package/dist/components/layout/Card.cjs +2 -0
  232. package/dist/components/layout/Card.cjs.map +1 -0
  233. package/dist/components/layout/Card.mjs +121 -0
  234. package/dist/components/layout/Card.mjs.map +1 -0
  235. package/dist/components/layout/Carousel.cjs +2 -0
  236. package/dist/components/layout/Carousel.cjs.map +1 -0
  237. package/dist/components/layout/Carousel.mjs +205 -0
  238. package/dist/components/layout/Carousel.mjs.map +1 -0
  239. package/dist/components/layout/Flex.cjs +2 -0
  240. package/dist/components/layout/Flex.cjs.map +1 -0
  241. package/dist/components/layout/Flex.mjs +54 -0
  242. package/dist/components/layout/Flex.mjs.map +1 -0
  243. package/dist/components/layout/Grid.cjs +2 -0
  244. package/dist/components/layout/Grid.cjs.map +1 -0
  245. package/dist/components/layout/Grid.mjs +62 -0
  246. package/dist/components/layout/Grid.mjs.map +1 -0
  247. package/dist/components/layout/Overflow.cjs +2 -0
  248. package/dist/components/layout/Overflow.cjs.map +1 -0
  249. package/dist/components/layout/Overflow.mjs +269 -0
  250. package/dist/components/layout/Overflow.mjs.map +1 -0
  251. package/dist/components/layout/Stack.cjs +2 -0
  252. package/dist/components/layout/Stack.cjs.map +1 -0
  253. package/dist/components/layout/Stack.mjs +39 -0
  254. package/dist/components/layout/Stack.mjs.map +1 -0
  255. package/dist/components/layout/TabList.cjs +2 -0
  256. package/dist/components/layout/TabList.cjs.map +1 -0
  257. package/dist/components/layout/TabList.mjs +238 -0
  258. package/dist/components/layout/TabList.mjs.map +1 -0
  259. package/dist/components/layout/Tree.cjs +2 -0
  260. package/dist/components/layout/Tree.cjs.map +1 -0
  261. package/dist/components/layout/Tree.mjs +220 -0
  262. package/dist/components/layout/Tree.mjs.map +1 -0
  263. package/dist/components/layout/disclosureIds.cjs +2 -0
  264. package/dist/components/layout/disclosureIds.cjs.map +1 -0
  265. package/dist/components/layout/disclosureIds.mjs +12 -0
  266. package/dist/components/layout/disclosureIds.mjs.map +1 -0
  267. package/dist/components/motion/Presence.cjs +2 -0
  268. package/dist/components/motion/Presence.cjs.map +1 -0
  269. package/dist/components/motion/Presence.mjs +35 -0
  270. package/dist/components/motion/Presence.mjs.map +1 -0
  271. package/dist/components/navigation/Breadcrumb.cjs +2 -0
  272. package/dist/components/navigation/Breadcrumb.cjs.map +1 -0
  273. package/dist/components/navigation/Breadcrumb.mjs +144 -0
  274. package/dist/components/navigation/Breadcrumb.mjs.map +1 -0
  275. package/dist/components/navigation/Menu.cjs +2 -0
  276. package/dist/components/navigation/Menu.cjs.map +1 -0
  277. package/dist/components/navigation/Menu.context.cjs +2 -0
  278. package/dist/components/navigation/Menu.context.cjs.map +1 -0
  279. package/dist/components/navigation/Menu.context.mjs +82 -0
  280. package/dist/components/navigation/Menu.context.mjs.map +1 -0
  281. package/dist/components/navigation/Menu.group.cjs +2 -0
  282. package/dist/components/navigation/Menu.group.cjs.map +1 -0
  283. package/dist/components/navigation/Menu.group.mjs +58 -0
  284. package/dist/components/navigation/Menu.group.mjs.map +1 -0
  285. package/dist/components/navigation/Menu.items.cjs +2 -0
  286. package/dist/components/navigation/Menu.items.cjs.map +1 -0
  287. package/dist/components/navigation/Menu.items.mjs +127 -0
  288. package/dist/components/navigation/Menu.items.mjs.map +1 -0
  289. package/dist/components/navigation/Menu.link.cjs +2 -0
  290. package/dist/components/navigation/Menu.link.cjs.map +1 -0
  291. package/dist/components/navigation/Menu.link.mjs +41 -0
  292. package/dist/components/navigation/Menu.link.mjs.map +1 -0
  293. package/dist/components/navigation/Menu.mjs +27 -0
  294. package/dist/components/navigation/Menu.mjs.map +1 -0
  295. package/dist/components/navigation/Menu.popover.cjs +2 -0
  296. package/dist/components/navigation/Menu.popover.cjs.map +1 -0
  297. package/dist/components/navigation/Menu.popover.mjs +231 -0
  298. package/dist/components/navigation/Menu.popover.mjs.map +1 -0
  299. package/dist/components/navigation/Menu.root.cjs +2 -0
  300. package/dist/components/navigation/Menu.root.cjs.map +1 -0
  301. package/dist/components/navigation/Menu.root.mjs +308 -0
  302. package/dist/components/navigation/Menu.root.mjs.map +1 -0
  303. package/dist/components/navigation/Menu.selectable.cjs +2 -0
  304. package/dist/components/navigation/Menu.selectable.cjs.map +1 -0
  305. package/dist/components/navigation/Menu.selectable.mjs +89 -0
  306. package/dist/components/navigation/Menu.selectable.mjs.map +1 -0
  307. package/dist/components/navigation/Menu.shared.cjs +2 -0
  308. package/dist/components/navigation/Menu.shared.cjs.map +1 -0
  309. package/dist/components/navigation/Menu.shared.mjs +23 -0
  310. package/dist/components/navigation/Menu.shared.mjs.map +1 -0
  311. package/dist/components/navigation/Menu.splitGroup.cjs +2 -0
  312. package/dist/components/navigation/Menu.splitGroup.cjs.map +1 -0
  313. package/dist/components/navigation/Menu.splitGroup.mjs +51 -0
  314. package/dist/components/navigation/Menu.splitGroup.mjs.map +1 -0
  315. package/dist/components/navigation/Menu.trigger.cjs +2 -0
  316. package/dist/components/navigation/Menu.trigger.cjs.map +1 -0
  317. package/dist/components/navigation/Menu.trigger.mjs +79 -0
  318. package/dist/components/navigation/Menu.trigger.mjs.map +1 -0
  319. package/dist/components/navigation/Nav.cjs +2 -0
  320. package/dist/components/navigation/Nav.cjs.map +1 -0
  321. package/dist/components/navigation/Nav.mjs +276 -0
  322. package/dist/components/navigation/Nav.mjs.map +1 -0
  323. package/dist/components/navigation/Pagination.cjs +2 -0
  324. package/dist/components/navigation/Pagination.cjs.map +1 -0
  325. package/dist/components/navigation/Pagination.mjs +110 -0
  326. package/dist/components/navigation/Pagination.mjs.map +1 -0
  327. package/dist/components/navigation/Stepper.cjs +2 -0
  328. package/dist/components/navigation/Stepper.cjs.map +1 -0
  329. package/dist/components/navigation/Stepper.mjs +204 -0
  330. package/dist/components/navigation/Stepper.mjs.map +1 -0
  331. package/dist/components/overlays/Dialog.cjs +2 -0
  332. package/dist/components/overlays/Dialog.cjs.map +1 -0
  333. package/dist/components/overlays/Dialog.mjs +180 -0
  334. package/dist/components/overlays/Dialog.mjs.map +1 -0
  335. package/dist/components/overlays/Dialog.shared.cjs +2 -0
  336. package/dist/components/overlays/Dialog.shared.cjs.map +1 -0
  337. package/dist/components/overlays/Dialog.shared.mjs +227 -0
  338. package/dist/components/overlays/Dialog.shared.mjs.map +1 -0
  339. package/dist/components/overlays/Drawer.cjs +2 -0
  340. package/dist/components/overlays/Drawer.cjs.map +1 -0
  341. package/dist/components/overlays/Drawer.mjs +192 -0
  342. package/dist/components/overlays/Drawer.mjs.map +1 -0
  343. package/dist/components/overlays/Popover.cjs +2 -0
  344. package/dist/components/overlays/Popover.cjs.map +1 -0
  345. package/dist/components/overlays/Popover.mjs +365 -0
  346. package/dist/components/overlays/Popover.mjs.map +1 -0
  347. package/dist/components/overlays/Popover.shared.cjs +2 -0
  348. package/dist/components/overlays/Popover.shared.cjs.map +1 -0
  349. package/dist/components/overlays/Popover.shared.mjs +182 -0
  350. package/dist/components/overlays/Popover.shared.mjs.map +1 -0
  351. package/dist/components/overlays/TeachingPopover.cjs +2 -0
  352. package/dist/components/overlays/TeachingPopover.cjs.map +1 -0
  353. package/dist/components/overlays/TeachingPopover.mjs +181 -0
  354. package/dist/components/overlays/TeachingPopover.mjs.map +1 -0
  355. package/dist/components/overlays/Tooltip.cjs +2 -0
  356. package/dist/components/overlays/Tooltip.cjs.map +1 -0
  357. package/dist/components/overlays/Tooltip.mjs +160 -0
  358. package/dist/components/overlays/Tooltip.mjs.map +1 -0
  359. package/dist/components/portal/Portal.cjs +2 -0
  360. package/dist/components/portal/Portal.cjs.map +1 -0
  361. package/dist/components/portal/Portal.mjs +45 -0
  362. package/dist/components/portal/Portal.mjs.map +1 -0
  363. package/dist/components/provider/WaveProvider.cjs +2 -0
  364. package/dist/components/provider/WaveProvider.cjs.map +1 -0
  365. package/dist/components/provider/WaveProvider.mjs +51 -0
  366. package/dist/components/provider/WaveProvider.mjs.map +1 -0
  367. package/dist/components/table/DataGrid.cjs +2 -0
  368. package/dist/components/table/DataGrid.cjs.map +1 -0
  369. package/dist/components/table/DataGrid.mjs +489 -0
  370. package/dist/components/table/DataGrid.mjs.map +1 -0
  371. package/dist/components/table/Table.cjs +2 -0
  372. package/dist/components/table/Table.cjs.map +1 -0
  373. package/dist/components/table/Table.mjs +99 -0
  374. package/dist/components/table/Table.mjs.map +1 -0
  375. package/dist/components/table/useGridNavigation.cjs +2 -0
  376. package/dist/components/table/useGridNavigation.cjs.map +1 -0
  377. package/dist/components/table/useGridNavigation.mjs +336 -0
  378. package/dist/components/table/useGridNavigation.mjs.map +1 -0
  379. package/dist/components/typography/Text.cjs +2 -0
  380. package/dist/components/typography/Text.cjs.map +1 -0
  381. package/dist/components/typography/Text.mjs +38 -0
  382. package/dist/components/typography/Text.mjs.map +1 -0
  383. package/dist/hooks/useAnnounce.cjs +2 -0
  384. package/dist/hooks/useAnnounce.cjs.map +1 -0
  385. package/dist/hooks/useAnnounce.mjs +88 -0
  386. package/dist/hooks/useAnnounce.mjs.map +1 -0
  387. package/dist/hooks/useCheckedValues.cjs +2 -0
  388. package/dist/hooks/useCheckedValues.cjs.map +1 -0
  389. package/dist/hooks/useCheckedValues.mjs +102 -0
  390. package/dist/hooks/useCheckedValues.mjs.map +1 -0
  391. package/dist/hooks/useContextMenuAnchor.cjs +2 -0
  392. package/dist/hooks/useContextMenuAnchor.cjs.map +1 -0
  393. package/dist/hooks/useContextMenuAnchor.mjs +132 -0
  394. package/dist/hooks/useContextMenuAnchor.mjs.map +1 -0
  395. package/dist/hooks/useControllable.cjs +2 -0
  396. package/dist/hooks/useControllable.cjs.map +1 -0
  397. package/dist/hooks/useControllable.mjs +37 -0
  398. package/dist/hooks/useControllable.mjs.map +1 -0
  399. package/dist/hooks/useDirection.cjs +2 -0
  400. package/dist/hooks/useDirection.cjs.map +1 -0
  401. package/dist/hooks/useDirection.mjs +57 -0
  402. package/dist/hooks/useDirection.mjs.map +1 -0
  403. package/dist/hooks/useDismiss.cjs +2 -0
  404. package/dist/hooks/useDismiss.cjs.map +1 -0
  405. package/dist/hooks/useDismiss.mjs +57 -0
  406. package/dist/hooks/useDismiss.mjs.map +1 -0
  407. package/dist/hooks/useEventCallback.cjs +2 -0
  408. package/dist/hooks/useEventCallback.cjs.map +1 -0
  409. package/dist/hooks/useEventCallback.mjs +16 -0
  410. package/dist/hooks/useEventCallback.mjs.map +1 -0
  411. package/dist/hooks/useFieldControl.cjs +2 -0
  412. package/dist/hooks/useFieldControl.cjs.map +1 -0
  413. package/dist/hooks/useFieldControl.mjs +62 -0
  414. package/dist/hooks/useFieldControl.mjs.map +1 -0
  415. package/dist/hooks/useFocusTrap.cjs +2 -0
  416. package/dist/hooks/useFocusTrap.cjs.map +1 -0
  417. package/dist/hooks/useFocusTrap.mjs +266 -0
  418. package/dist/hooks/useFocusTrap.mjs.map +1 -0
  419. package/dist/hooks/useFormReset.cjs +2 -0
  420. package/dist/hooks/useFormReset.cjs.map +1 -0
  421. package/dist/hooks/useFormReset.mjs +33 -0
  422. package/dist/hooks/useFormReset.mjs.map +1 -0
  423. package/dist/hooks/useHoverIntent.cjs +2 -0
  424. package/dist/hooks/useHoverIntent.cjs.map +1 -0
  425. package/dist/hooks/useHoverIntent.mjs +201 -0
  426. package/dist/hooks/useHoverIntent.mjs.map +1 -0
  427. package/dist/hooks/useId.cjs +2 -0
  428. package/dist/hooks/useId.cjs.map +1 -0
  429. package/dist/hooks/useId.mjs +11 -0
  430. package/dist/hooks/useId.mjs.map +1 -0
  431. package/dist/hooks/useIsClient.cjs +2 -0
  432. package/dist/hooks/useIsClient.cjs.map +1 -0
  433. package/dist/hooks/useIsClient.mjs +19 -0
  434. package/dist/hooks/useIsClient.mjs.map +1 -0
  435. package/dist/hooks/useListbox.cjs +2 -0
  436. package/dist/hooks/useListbox.cjs.map +1 -0
  437. package/dist/hooks/useListbox.mjs +492 -0
  438. package/dist/hooks/useListbox.mjs.map +1 -0
  439. package/dist/hooks/useMergedRefs.cjs +2 -0
  440. package/dist/hooks/useMergedRefs.cjs.map +1 -0
  441. package/dist/hooks/useMergedRefs.mjs +57 -0
  442. package/dist/hooks/useMergedRefs.mjs.map +1 -0
  443. package/dist/hooks/useModalIsolation.cjs +2 -0
  444. package/dist/hooks/useModalIsolation.cjs.map +1 -0
  445. package/dist/hooks/useModalIsolation.mjs +87 -0
  446. package/dist/hooks/useModalIsolation.mjs.map +1 -0
  447. package/dist/hooks/useModalLayer.cjs +2 -0
  448. package/dist/hooks/useModalLayer.cjs.map +1 -0
  449. package/dist/hooks/useModalLayer.mjs +30 -0
  450. package/dist/hooks/useModalLayer.mjs.map +1 -0
  451. package/dist/hooks/usePopupPosition.cjs +2 -0
  452. package/dist/hooks/usePopupPosition.cjs.map +1 -0
  453. package/dist/hooks/usePopupPosition.mjs +117 -0
  454. package/dist/hooks/usePopupPosition.mjs.map +1 -0
  455. package/dist/hooks/usePrefersReducedMotion.cjs +2 -0
  456. package/dist/hooks/usePrefersReducedMotion.cjs.map +1 -0
  457. package/dist/hooks/usePrefersReducedMotion.mjs +24 -0
  458. package/dist/hooks/usePrefersReducedMotion.mjs.map +1 -0
  459. package/dist/hooks/usePresence.cjs +2 -0
  460. package/dist/hooks/usePresence.cjs.map +1 -0
  461. package/dist/hooks/usePresence.mjs +136 -0
  462. package/dist/hooks/usePresence.mjs.map +1 -0
  463. package/dist/hooks/usePreserveFocus.cjs +2 -0
  464. package/dist/hooks/usePreserveFocus.cjs.map +1 -0
  465. package/dist/hooks/usePreserveFocus.mjs +50 -0
  466. package/dist/hooks/usePreserveFocus.mjs.map +1 -0
  467. package/dist/hooks/useRestoreFocus.cjs +2 -0
  468. package/dist/hooks/useRestoreFocus.cjs.map +1 -0
  469. package/dist/hooks/useRestoreFocus.mjs +271 -0
  470. package/dist/hooks/useRestoreFocus.mjs.map +1 -0
  471. package/dist/hooks/useRovingTabIndex.cjs +2 -0
  472. package/dist/hooks/useRovingTabIndex.cjs.map +1 -0
  473. package/dist/hooks/useRovingTabIndex.mjs +389 -0
  474. package/dist/hooks/useRovingTabIndex.mjs.map +1 -0
  475. package/dist/hooks/useScrollLock.cjs +2 -0
  476. package/dist/hooks/useScrollLock.cjs.map +1 -0
  477. package/dist/hooks/useScrollLock.mjs +71 -0
  478. package/dist/hooks/useScrollLock.mjs.map +1 -0
  479. package/dist/hooks/useTriggerElement.cjs +2 -0
  480. package/dist/hooks/useTriggerElement.cjs.map +1 -0
  481. package/dist/hooks/useTriggerElement.mjs +126 -0
  482. package/dist/hooks/useTriggerElement.mjs.map +1 -0
  483. package/dist/hooks/useTypeahead.cjs +2 -0
  484. package/dist/hooks/useTypeahead.cjs.map +1 -0
  485. package/dist/hooks/useTypeahead.mjs +38 -0
  486. package/dist/hooks/useTypeahead.mjs.map +1 -0
  487. package/dist/index.cjs +1 -1
  488. package/dist/index.d.cts +9099 -0
  489. package/dist/index.d.ts +7688 -1027
  490. package/dist/index.mjs +91 -5695
  491. package/dist/lib/aria.cjs +2 -0
  492. package/dist/lib/aria.cjs.map +1 -0
  493. package/dist/lib/aria.mjs +29 -0
  494. package/dist/lib/aria.mjs.map +1 -0
  495. package/dist/lib/children.cjs +2 -0
  496. package/dist/lib/children.cjs.map +1 -0
  497. package/dist/lib/children.mjs +37 -0
  498. package/dist/lib/children.mjs.map +1 -0
  499. package/dist/lib/cn.cjs +2 -0
  500. package/dist/lib/cn.cjs.map +1 -0
  501. package/dist/lib/cn.mjs +64 -0
  502. package/dist/lib/cn.mjs.map +1 -0
  503. package/dist/lib/composeEventHandlers.cjs +2 -0
  504. package/dist/lib/composeEventHandlers.cjs.map +1 -0
  505. package/dist/lib/composeEventHandlers.mjs +11 -0
  506. package/dist/lib/composeEventHandlers.mjs.map +1 -0
  507. package/dist/lib/dev.cjs +2 -0
  508. package/dist/lib/dev.cjs.map +1 -0
  509. package/dist/lib/dev.mjs +42 -0
  510. package/dist/lib/dev.mjs.map +1 -0
  511. package/dist/lib/direction.cjs +2 -0
  512. package/dist/lib/direction.cjs.map +1 -0
  513. package/dist/lib/direction.mjs +35 -0
  514. package/dist/lib/direction.mjs.map +1 -0
  515. package/dist/lib/events.cjs +2 -0
  516. package/dist/lib/events.cjs.map +1 -0
  517. package/dist/lib/events.mjs +31 -0
  518. package/dist/lib/events.mjs.map +1 -0
  519. package/dist/lib/focus.cjs +2 -0
  520. package/dist/lib/focus.cjs.map +1 -0
  521. package/dist/lib/focus.mjs +119 -0
  522. package/dist/lib/focus.mjs.map +1 -0
  523. package/dist/lib/globalRegistry.cjs +2 -0
  524. package/dist/lib/globalRegistry.cjs.map +1 -0
  525. package/dist/lib/globalRegistry.mjs +13 -0
  526. package/dist/lib/globalRegistry.mjs.map +1 -0
  527. package/dist/lib/icons.cjs +2 -0
  528. package/dist/lib/icons.cjs.map +1 -0
  529. package/dist/lib/icons.mjs +254 -0
  530. package/dist/lib/icons.mjs.map +1 -0
  531. package/dist/lib/labelInName.cjs +2 -0
  532. package/dist/lib/labelInName.cjs.map +1 -0
  533. package/dist/lib/labelInName.mjs +54 -0
  534. package/dist/lib/labelInName.mjs.map +1 -0
  535. package/dist/lib/layers.cjs +2 -0
  536. package/dist/lib/layers.cjs.map +1 -0
  537. package/dist/lib/layers.mjs +224 -0
  538. package/dist/lib/layers.mjs.map +1 -0
  539. package/dist/lib/mergeProps.cjs +2 -0
  540. package/dist/lib/mergeProps.cjs.map +1 -0
  541. package/dist/lib/mergeProps.mjs +21 -0
  542. package/dist/lib/mergeProps.mjs.map +1 -0
  543. package/dist/lib/mergeRefs.cjs +2 -0
  544. package/dist/lib/mergeRefs.cjs.map +1 -0
  545. package/dist/lib/mergeRefs.mjs +29 -0
  546. package/dist/lib/mergeRefs.mjs.map +1 -0
  547. package/dist/lib/renderTrigger.cjs +2 -0
  548. package/dist/lib/renderTrigger.cjs.map +1 -0
  549. package/dist/lib/renderTrigger.mjs +29 -0
  550. package/dist/lib/renderTrigger.mjs.map +1 -0
  551. package/dist/lib/slot.cjs +2 -0
  552. package/dist/lib/slot.cjs.map +1 -0
  553. package/dist/lib/slot.mjs +122 -0
  554. package/dist/lib/slot.mjs.map +1 -0
  555. package/dist/lib/styles.cjs +2 -0
  556. package/dist/lib/styles.cjs.map +1 -0
  557. package/dist/lib/styles.mjs +16 -0
  558. package/dist/lib/styles.mjs.map +1 -0
  559. package/dist/lib/theme.cjs +2 -0
  560. package/dist/lib/theme.cjs.map +1 -0
  561. package/dist/lib/theme.mjs +16 -0
  562. package/dist/lib/theme.mjs.map +1 -0
  563. package/dist/preflight.css +2 -0
  564. package/dist/styles.css +2 -0
  565. package/package.json +149 -100
  566. package/src/styles/animations.css +7 -39
  567. package/src/styles/base.css +103 -0
  568. package/src/styles/globals.css +10 -22
  569. package/src/styles/legacy-tokens.css +184 -0
  570. package/src/styles/preflight.css +7 -0
  571. package/src/styles/styles.css +32 -0
  572. package/src/styles/tailwind.css +17 -0
  573. package/src/styles/tokens.css +561 -221
  574. package/src/styles/variants.css +29 -0
@@ -0,0 +1,88 @@
1
+ "use client";
2
+ import { useId as e } from "../../hooks/useId.mjs";
3
+ import { getFirstTabbable as t } from "../../lib/focus.mjs";
4
+ import "../../hooks/useFormReset.mjs";
5
+ import "react";
6
+ import { Fragment as n, jsx as r } from "react/jsx-runtime";
7
+ //#region src/components/internal/HiddenInput.tsx
8
+ var i = {
9
+ position: "absolute",
10
+ insetInlineStart: 0,
11
+ bottom: 0,
12
+ width: 1,
13
+ height: 1,
14
+ margin: 0,
15
+ padding: 0,
16
+ border: 0,
17
+ opacity: 0,
18
+ pointerEvents: "none"
19
+ };
20
+ function a() {}
21
+ function o(e) {
22
+ let n = e.currentTarget, r = n.parentElement;
23
+ if (!r) return;
24
+ let i = e.relatedTarget, a = i instanceof HTMLElement && i !== n && r.contains(i) ? i : t(r);
25
+ a && a !== n && a.focus();
26
+ }
27
+ function s(e) {
28
+ return e == null ? null : typeof e == "string" ? e : e[0] ?? null;
29
+ }
30
+ function c(e) {
31
+ return e == null ? [""] : typeof e == "string" ? [e] : e;
32
+ }
33
+ function l(t) {
34
+ let { name: l, form: u, disabled: d, value: f, type: p = "hidden", checked: m, required: h = !1, onInvalid: g } = t, _ = e("wave-required");
35
+ if (!l && !h) return null;
36
+ let v = p === "checkbox" || p === "radio", y = s(f), b = p === "checkbox" ? m ?? !1 : m ?? (y !== null && y !== ""), x = p === "checkbox" ? y ?? "on" : y ?? "";
37
+ if (!h) {
38
+ let e = v ? b ? [x] : [] : c(f);
39
+ return /* @__PURE__ */ r(n, { children: e.map((e, t) => /* @__PURE__ */ r("input", {
40
+ type: "hidden",
41
+ name: l,
42
+ form: u,
43
+ disabled: d,
44
+ value: e,
45
+ "data-wave-hidden-input": ""
46
+ }, `${t}:${e}`)) });
47
+ }
48
+ let S = {
49
+ form: u,
50
+ disabled: d,
51
+ required: !0,
52
+ "aria-hidden": !0,
53
+ tabIndex: -1,
54
+ style: i,
55
+ onChange: a,
56
+ onInvalid: g,
57
+ onFocus: o,
58
+ "data-wave-hidden-input": ""
59
+ };
60
+ if (v) {
61
+ let e = l || (p === "radio" && !b ? _ : void 0);
62
+ return /* @__PURE__ */ r("input", {
63
+ ...S,
64
+ type: p,
65
+ name: e,
66
+ value: x,
67
+ checked: b
68
+ });
69
+ }
70
+ let C = c(f);
71
+ return C.length === 0 ? /* @__PURE__ */ r("input", {
72
+ ...S,
73
+ type: "text",
74
+ autoComplete: "off",
75
+ value: ""
76
+ }) : /* @__PURE__ */ r(n, { children: C.map((e, t) => /* @__PURE__ */ r("input", {
77
+ ...S,
78
+ type: "text",
79
+ autoComplete: "off",
80
+ name: l,
81
+ value: e
82
+ }, `${t}:${e}`)) });
83
+ }
84
+ l.displayName = "HiddenInput";
85
+ //#endregion
86
+ export { l as HiddenInput };
87
+
88
+ //# sourceMappingURL=HiddenInput.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"HiddenInput.mjs","names":["useId","_Fragment","useId$1","REQUIRED_STYLE","noop","redirectFocus","input","event","root","from","target","getFirstTabbable","firstValue","value","valueList","HiddenInput","props","radioGroupName","name","required","choice","type","single","isChecked","checked","choiceValue","values","Fragment","v","index","common","inputName"],"sources":["../../../src/components/internal/HiddenInput.tsx"],"sourcesContent":["import * as React from 'react';\nimport { useId } from '../../hooks/useId';\nimport { getFirstTabbable } from '../../lib/focus';\n\nexport { useFormReset } from '../../hooks/useFormReset';\n\n/** Properties of {@link HiddenInput} (internal; spec §2.5, C-FORMS). */\nexport interface HiddenInputProps {\n /** Field name. Without `name` (and without `required`) nothing is rendered. */\n name?: string;\n /** Id of the form the input belongs to, when the control is outside it. */\n form?: string;\n /** Disabled inputs are neither submitted nor validated. */\n disabled?: boolean;\n /**\n * The submitted value. Arrays → one input per value (an empty array submits nothing).\n * `null`/`undefined` → `''` for free values; for checkbox/radio kinds the input's `value`.\n */\n value: string | readonly string[] | null | undefined;\n /**\n * The kind of control. Without `required` every kind renders native `type=\"hidden\"` inputs.\n * With `required` a real (visually hidden) input validates natively:\n * `'radio'` for single-choice groups (RadioGroup, Rating, SwatchPicker — the browser says\n * \"select one of these options\"), `'checkbox'` for booleans (Checkbox, Switch), `'text'` for free\n * values (pickers, SpinButton). `'hidden'` with `required` behaves like `'text'`.\n * @default 'hidden'\n */\n type?: 'hidden' | 'text' | 'checkbox' | 'radio';\n /**\n * Checkbox kind: whether the value is submitted / the requirement is met (default `false`).\n * Radio kind: default \"a non-empty value is given\".\n */\n checked?: boolean;\n /** Renders a real input that takes part in native constraint validation. */\n required?: boolean;\n /** Called when the form's validation fails on this input — focus the visible control here. */\n onInvalid?: (event: React.FormEvent<HTMLInputElement>) => void;\n}\n\n/**\n * Required inputs sit at the control's inline-start bottom corner inside its `relative` root, so the\n * browser's validation bubble and scroll-into-view point at the control (spec §2.5).\n */\nconst REQUIRED_STYLE: React.CSSProperties = {\n position: 'absolute',\n insetInlineStart: 0,\n bottom: 0,\n width: 1,\n height: 1,\n margin: 0,\n padding: 0,\n border: 0,\n opacity: 0,\n pointerEvents: 'none',\n};\n\nfunction noop() {}\n\n/**\n * The browser focuses an invalid input when it reports the problem, after the `invalid` event (so\n * after `onInvalid` focused the control). This input is `aria-hidden` and invisible, so focus goes\n * straight back to the visible control: the element it came from when that is part of the same\n * control root, else the root's first tabbable element.\n *\n * The redirect must complete inside the browser's `focus()` call. Firefox\n * (`FormValidationChild.notifyInvalidSubmit`) calls `element.focus()`, then adds the `blur` listener\n * that hides its popup, then shows the popup; Chromium focuses the input, then shows the bubble,\n * which a later blur hides. Checked in Chromium 153 and Firefox 155 with a real submit click: a\n * synchronous redirect keeps the message and leaves focus on the control; without a redirect focus\n * stays on this invisible input; a deferred redirect (timer, next key) hides the message. Firefox\n * then closes its popup on the next click, scroll or zoom rather than on the control's blur.\n */\nfunction redirectFocus(event: React.FocusEvent<HTMLInputElement>) {\n const input = event.currentTarget;\n const root = input.parentElement;\n if (!root) return;\n const from = event.relatedTarget;\n const target =\n from instanceof HTMLElement && from !== input && root.contains(from)\n ? from\n : getFirstTabbable(root);\n if (target && target !== input) target.focus();\n}\n\nfunction firstValue(value: HiddenInputProps['value']): string | null {\n if (value == null) return null;\n if (typeof value === 'string') return value;\n return value[0] ?? null;\n}\n\nfunction valueList(value: HiddenInputProps['value']): readonly string[] {\n if (value == null) return [''];\n if (typeof value === 'string') return [value];\n return value;\n}\n\n/**\n * Native form participation for controls built on buttons and divs (C-FORMS). Renders `null`\n * unless the consumer passes `name` or `required` — components never invent a default name, so a\n * control inside an existing form adds no field of its own.\n *\n * - Without `required`: `type=\"hidden\"` inputs carry the value (arrays: one per value; checkbox\n * and radio kinds only while checked/chosen).\n * - With `required`: real inputs (`aria-hidden`, `tabIndex={-1}`, `pointer-events: none`,\n * opacity 0, a no-op `onChange`) absolutely positioned inside the control's **`relative`\n * root**, so native validation blocks submission with the right message and points at the\n * control. `onInvalid` should focus the visible control; focus the browser moves to the input\n * is sent back to the control. Browsers never report an unnamed radio as missing, so a required\n * radio without `name` gets a unique group name while nothing is chosen (unchecked radios are\n * not submitted, and the name is dropped once checked, so it never reaches `FormData`).\n *\n * Form reset is wired on the control with `useFormReset` (re-exported here), not by this input, so\n * uncontrolled controls without a name reset too.\n *\n * Internal (not exported from the package).\n */\nexport function HiddenInput(props: HiddenInputProps): React.ReactElement | null {\n const {\n name,\n form,\n disabled,\n value,\n type = 'hidden',\n checked,\n required = false,\n onInvalid,\n } = props;\n const radioGroupName = useId('wave-required');\n if (!name && !required) return null;\n\n const choice = type === 'checkbox' || type === 'radio';\n const single = firstValue(value);\n const isChecked =\n type === 'checkbox' ? (checked ?? false) : (checked ?? (single !== null && single !== ''));\n const choiceValue = type === 'checkbox' ? (single ?? 'on') : (single ?? '');\n\n if (!required) {\n const values = choice ? (isChecked ? [choiceValue] : []) : valueList(value);\n return (\n <>\n {values.map((v, index) => (\n <input\n key={`${index}:${v}`}\n type=\"hidden\"\n name={name}\n form={form}\n disabled={disabled}\n value={v}\n data-wave-hidden-input=\"\"\n />\n ))}\n </>\n );\n }\n\n const common = {\n form,\n disabled,\n required: true,\n 'aria-hidden': true,\n tabIndex: -1,\n style: REQUIRED_STYLE,\n onChange: noop,\n onInvalid,\n onFocus: redirectFocus,\n 'data-wave-hidden-input': '',\n } as const;\n\n if (choice) {\n // Chrome and Firefox treat an unnamed required radio as never missing; a unique group name\n // (only while unchecked, so it is never submitted) restores \"select one of these options\".\n const inputName = name || (type === 'radio' && !isChecked ? radioGroupName : undefined);\n return (\n <input {...common} type={type} name={inputName} value={choiceValue} checked={isChecked} />\n );\n }\n\n const values = valueList(value);\n if (values.length === 0) {\n // Nothing chosen: one empty, unnamed input keeps the requirement without submitting a value.\n return <input {...common} type=\"text\" autoComplete=\"off\" value=\"\" />;\n }\n return (\n <>\n {values.map((v, index) => (\n <input\n key={`${index}:${v}`}\n {...common}\n type=\"text\"\n autoComplete=\"off\"\n name={name}\n value={v}\n />\n ))}\n </>\n );\n}\n\nHiddenInput.displayName = 'HiddenInput';\n"],"mappings":";;;;;;;AA2CA,IAAMG,IAAsC;CAC1C,UAAU;CACV,kBAAkB;CAClB,QAAQ;CACR,OAAO;CACP,QAAQ;CACR,QAAQ;CACR,SAAS;CACT,QAAQ;CACR,SAAS;CACT,eAAe;AACjB;AAEA,SAASC,IAAO,CAAC;AAgBjB,SAASC,EAAc,GAA2C;CAChE,IAAMC,IAAQC,EAAM,eACdC,IAAOF,EAAM;CACnB,IAAI,CAACE,GAAM;CACX,IAAMC,IAAOF,EAAM,eACbG,IACJD,aAAgB,eAAeA,MAASH,KAASE,EAAK,SAASC,CAAI,IAC/DA,IACAE,EAAiBH,CAAI;CAC3B,AAAIE,KAAUA,MAAWJ,KAAOI,EAAO,MAAM;AAC/C;AAEA,SAASE,EAAW,GAAiD;CAGnE,OAFIC,KAAS,OAAa,OACtB,OAAOA,KAAU,WAAiBA,IAC/BA,EAAM,MAAM;AACrB;AAEA,SAASC,EAAU,GAAqD;CAGtE,OAFID,KAAS,OAAa,CAAC,EAAE,IACzB,OAAOA,KAAU,WAAiB,CAACA,CAAK,IACrCA;AACT;AAsBA,SAAgBE,EAAY,GAAoD;CAC9E,IAAM,EACJ,SACA,SACA,aACA,UACA,UAAO,UACP,YACA,cAAW,IACX,iBACEC,GACEC,IAAiBjB,EAAM,eAAe;CAC5C,IAAI,CAACkB,KAAQ,CAACC,GAAU,OAAO;CAE/B,IAAMC,IAASC,MAAS,cAAcA,MAAS,SACzCC,IAASV,EAAWC,CAAK,GACzBU,IACJF,MAAS,aAAcG,KAAW,KAAUA,MAAYF,MAAW,QAAQA,MAAW,KAClFG,IAAcJ,MAAS,aAAcC,KAAU,OAASA,KAAU;CAExE,IAAI,CAACH,GAAU;EACb,IAAMO,IAASN,IAAUG,IAAY,CAACE,CAAW,IAAI,CAAC,IAAKX,EAAUD,CAAK;EAC1E,OACE,kBAAAZ,GAAA,EAAA,UACGyB,EAAO,KAAK,GAAG,MACd,kBAAC,SAAD;GAEE,MAAK;GACC;GACA;GACI;GACV,OAAOE;GACP,0BAAuB;EACxB,GAPM,GAAGC,EAAM,GAAGD,GAOlB,CACF,EACD,CAAA;CAEN;CAEA,IAAME,IAAS;EACb;EACA;EACA,UAAU;EACV,eAAe;EACf,UAAU;EACV,OAAO3B;EACP,UAAUC;EACV;EACA,SAASC;EACT,0BAA0B;CAC5B;CAEA,IAAIe,GAAQ;EAGV,IAAMW,IAAYb,MAASG,MAAS,WAAW,CAACE,IAAYN,IAAiB,KAAA;EAC7E,OACE,kBAAC,SAAD;GAAO,GAAIa;GAAc;GAAM,MAAMC;GAAW,OAAON;GAAa,SAASF;EAAY,CAAA;CAE7F;CAEA,IAAMG,IAASZ,EAAUD,CAAK;CAK9B,OAJIa,EAAO,WAAW,IAEb,kBAAC,SAAD;EAAO,GAAII;EAAQ,MAAK;EAAO,cAAa;EAAM,OAAM;CAAI,CAAA,IAGnE,kBAAA7B,GAAA,EAAA,UACGyB,EAAO,KAAK,GAAG,MACd,kBAAC,SAAD;EAEE,GAAII;EACJ,MAAK;EACL,cAAa;EACP;EACN,OAAOF;CACR,GANM,GAAGC,EAAM,GAAGD,GAMlB,CACF,EACD,CAAA;AAEN;AAEA,EAAY,cAAc"}
@@ -0,0 +1,2 @@
1
+ "use client";const e=require("../../_virtual/_rolldown/runtime.cjs"),t=require("../../lib/cn.cjs"),n=require("../../lib/children.cjs"),r=require("../../lib/dev.cjs"),i=require("../../lib/composeEventHandlers.cjs"),a=require("../../hooks/useControllable.cjs"),o=require("../../hooks/useId.cjs"),s=require("../../lib/styles.cjs"),c=require("../../lib/icons.cjs"),l=require("./disclosureIds.cjs");let u=require("react");u=e.__toESM(u,1);let d=require("react/jsx-runtime");var f=u.createContext(null),p=u.createContext(null),m=u.createContext(null),h=[],g={openItems:h,toggle:()=>{},registerItem:()=>()=>{},baseId:`wave-accordion-inert`,headingLevel:3},_={value:``,isOpen:!1,triggerId:`wave-accordion-inert-trigger`,panelId:`wave-accordion-inert-panel`,hasPanelContent:!1,headingLevel:3,toggle:()=>{}},v={extra:null,inPanel:!0},y=u.createContext(!1),b=`m-0 grid`;function x(e){return u.useContext(f)||(r.reportMissingContext(e,`<Accordion>`),g)}function S(e){return u.useContext(p)||(r.reportMissingContext(e,`<Accordion.Item>`),_)}function C(e){r.warnOnce(`Accordion:duplicate:${e}`,`Accordion: several items share the value "${e}". Item values must be unique within an Accordion; items with the same value open and close together and share their trigger and panel ids.`)}function w(e){if(e!==void 0)return e===null?h:[e]}var T=e=>{let{type:n,openItem:i,defaultOpenItem:s,onOpenItemChange:c,openItems:l,defaultOpenItems:g,onOpenItemsChange:_,headingLevel:v=3,className:b,children:x,ref:S,...T}=e,E=n===`multiple`;E||(l!==void 0&&r.warnDeprecated(`Accordion`,`openItems`,`openItem`,`In single mode the Accordion takes one value.`),g!==void 0&&r.warnDeprecated(`Accordion`,`defaultOpenItems`,`defaultOpenItem`,`In single mode the Accordion takes one value.`),_!==void 0&&r.warnDeprecated(`Accordion`,`onOpenItemsChange`,`onOpenItemChange`,`In single mode the Accordion reports one value.`));let D=E?void 0:i,O=u.useMemo(()=>w(D)??l,[D,l]),[k]=u.useState(()=>(E?void 0:w(s))??g??h),[A,j]=a.useControllable(O,k,e=>{let t=[...e];E||c?.(t[0]??null),_?.(t)}),M=A.length;u.useEffect(()=>{!E&&M>1&&r.warnOnce(`Accordion:single-multiple-open`,`Accordion: type="single" allows one open item, but ${M} are open. Pass \`openItem\`, or use type="multiple".`)},[E,M]);let N=u.useCallback(e=>{j(t=>t.includes(e)?t.filter(t=>t!==e):E?[...t,e]:[e])},[E,j]),P=u.useRef(null),F=u.useCallback(e=>{P.current??=new Map;let t=P.current,n=(t.get(e)??0)+1;return t.set(e,n),n>1&&C(e),()=>{let n=(t.get(e)??1)-1;n>0?t.set(e,n):t.delete(e)}},[]),I=o.useId(`accordion`),L=u.useMemo(()=>({openItems:A,toggle:N,registerItem:F,baseId:I,headingLevel:v}),[A,N,F,I,v]);return(0,d.jsx)(f.Provider,{value:L,children:(0,d.jsx)(p.Provider,{value:null,children:(0,d.jsx)(m.Provider,{value:null,children:(0,d.jsx)(y.Provider,{value:!1,children:(0,d.jsx)(`div`,{ref:S,className:t.cn(`divide-y divide-border`,b),...T,children:x})})})})})};T.displayName=`Accordion`;function E(e,t,r){if(Array.isArray(e)){for(let n of e){let e=E(n,t,r);if(e)return e}return}if(!u.isValidElement(e))return;let i=n.getElementType(e,{suspend:!1});if(i===t)return e;if(i!==r&&i!==T&&i!==A)return E(e.props.children,t,r)}function D(e){let t=e?.props.id;return typeof t==`string`&&t!==``?t:void 0}function O(e){if(!u.isValidElement(e))return!1;let t=n.getElementType(e,{suspend:!1});if(typeof t==`string`||t===j||t===M||t===T||t===A)return!1;let r=e.props.children;return n.getElementType(r,{suspend:!1})===j||O(r)}function k(e){return`${e} was rendered inside the panel of an Accordion.Item, so it is not the item's ${e===`Accordion.Trigger`?`header`:`panel`}. Place Accordion.Trigger and Accordion.Panel directly in Accordion.Item, in a Fragment, or in an element that wraps them as \`children\` (such as a Tooltip). The Item cannot see inside a component that renders them itself and treats that component as panel content.`}var A=({value:e,headingLevel:r,className:i,children:a,ref:o,...s})=>{let c=x(`Accordion.Item`),f=c.openItems.includes(e),{toggle:h,baseId:g,registerItem:_}=c;u.useEffect(()=>_(e),[_,e]);let v=r??c.headingLevel,S=`h${v}`,C,w,T=[],k=[];for(let{key:e,node:t}of n.flattenChildren(a)){let n=(0,d.jsx)(u.Fragment,{children:t},e),r=E(t,j,M),i=E(t,M,j);r||i?(C??=r,w??=i,T.push(O(t)?(0,d.jsx)(S,{className:b,children:(0,d.jsx)(y.Provider,{value:!0,children:t})},e):n)):k.push(n)}let A=C!==void 0,N=w!==void 0,P=D(C),F=D(w),I=N||k.length>0,L=N&&k.length>0?k:null,R=u.useMemo(()=>({value:e,isOpen:f,triggerId:P??l.getPartId(g,`trigger`,e),panelId:F??l.getPartId(g,`panel`,e),hasPanelContent:I,headingLevel:v,toggle:()=>h(e)}),[e,f,g,P,F,I,v,h]),z=u.useMemo(()=>({extra:L,inPanel:!1}),[L]);return(0,d.jsx)(p.Provider,{value:R,children:(0,d.jsx)(m.Provider,{value:z,children:(0,d.jsxs)(`div`,{ref:o,"data-state":f?`open`:`closed`,className:t.cn(i),...s,children:[A?null:(0,d.jsx)(j,{children:e}),T,!N&&k.length>0?(0,d.jsx)(M,{children:k}):null]})})})};A.displayName=`AccordionItem`;var j=({id:e,className:n,children:a,onClick:o,ref:l,...f})=>{let p=S(`Accordion.Trigger`),h=u.useContext(m)?.inPanel??!1;u.useEffect(()=>{h&&r.warnOnce(`Accordion.Trigger:inside-panel`,k(`Accordion.Trigger`))},[h]);let g=u.useContext(y),_=`h${p.headingLevel}`,v=p.isOpen?`open`:`closed`,x=(0,d.jsxs)(`button`,{type:`button`,className:t.cn(`flex w-full items-center justify-between gap-2 px-4 py-3 text-start text-body-1 font-semibold text-foreground`,`not-disabled:not-aria-disabled:hover:bg-subtle-hover not-disabled:not-aria-disabled:active:bg-subtle-pressed`,s.disabledStyles,s.focusRingInset,n),...f,id:e||(h?void 0:p.triggerId),"aria-controls":!h&&p.hasPanelContent?p.panelId:void 0,"aria-expanded":p.isOpen,"data-state":v,onClick:i.composeEventHandlers(o,p.toggle),ref:l,children:[a,(0,d.jsx)(c.ChevronDownIcon,{size:16,className:t.cn(`shrink-0 transition-transform motion-reduce:transition-none`,p.isOpen&&`rotate-180`)})]});return g?x:(0,d.jsx)(_,{className:b,children:x})};j.displayName=`AccordionTrigger`;var M=({id:e,className:n,children:i,ref:a,...o})=>{let s=S(`Accordion.Panel`),c=u.useContext(m),l=c?.inPanel??!1;return u.useEffect(()=>{l&&r.warnOnce(`Accordion.Panel:inside-panel`,k(`Accordion.Panel`))},[l]),s.isOpen?l?(0,d.jsx)(`div`,{className:t.cn(n),...o,id:e||void 0,ref:a,children:i}):(0,d.jsx)(m.Provider,{value:v,children:(0,d.jsxs)(`div`,{role:`region`,className:t.cn(`px-4 pb-3 text-body-1 text-muted-foreground`,n),...o,id:e||s.panelId,"aria-labelledby":s.triggerId,"data-state":`open`,ref:a,children:[i,c?.extra]})}):null};M.displayName=`AccordionPanel`;var N=Object.assign(T,{Item:A,Trigger:j,Panel:M});exports.Accordion=N,exports.AccordionItem=A,exports.AccordionPanel=M,exports.AccordionTrigger=j;
2
+ //# sourceMappingURL=Accordion.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Accordion.cjs","names":["React","useControllable","useId","cn","getElementType","flattenChildren","getPartId","disabledStyles","focusRingInset","composeEventHandlers","ChevronDownIcon","require_runtime","require_cn","require_children","require_dev","require_composeEventHandlers","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 { 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 ref={ref} className={cn('divide-y divide-border', className)} {...rest}>\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={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 ref={ref} data-state={isOpen ? 'open' : 'closed'} className={cn(className)} {...rest}>\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 '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 '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 ? button : <Heading className={HEADING_CLASS}>{button}</Heading>;\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 className={cn(className)} {...rest} id={idProp || undefined} ref={ref}>\n {children}\n </div>\n );\n }\n return (\n <AccordionPanelSlotContext.Provider value={IN_PANEL}>\n <div\n role=\"region\"\n className={cn('px-4 pb-3 text-body-1 text-muted-foreground', className)}\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":"qdAoDA,IAAMuB,EAAmBvB,EAAM,cAA4C,IAAI,EACzEwB,EAAuBxB,EAAM,cAAgD,IAAI,EACjFyB,EAA4BzB,EAAM,cAA8C,IAAI,EAEpF0B,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,EAAiC9B,EAAM,cAAc,EAAK,EAO1D+B,EAAgB,WAMtB,SAASC,EAAoB,EAA0C,CAIrE,OAHgBhC,EAAM,WAAWuB,CAC7B,IACJT,EAAA,qBAAqBmB,EAAW,aAAa,EACtCN,EACT,CAEA,SAASO,EAAwB,EAA8C,CAI7E,OAHgBlC,EAAM,WAAWwB,CAC7B,IACJV,EAAA,qBAAqBmB,EAAW,kBAAkB,EAC3CL,EACT,CAEA,SAASO,EAAmB,EAAqB,CAC/CrB,EAAA,SACE,uBAAuBsB,IACvB,6CAA6CA,EAAM,4IAGrD,CACF,CA2EA,SAASC,EAAQ,EAA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ACN,UAAWP,EAAAA,GACT,8DACAuG,EAAK,QAAU,YACjB,CACD,CAAA,CACK,IAGV,OAAOE,EAAiBE,GAAS,EAAAxF,EAAA,IAAA,CAACiE,EAAD,CAAS,UAAWxD,EAAgB,SAAA+E,CAAgB,CAAA,CACvF,EACA,EAAiB,YAAc,mBAiB/B,IAAM7B,GAAkB,CAAE,GAAIwB,EAAQ,YAAW,WAAU,MAAK,GAAGjE,KAAgC,CACjG,IAAMkE,EAAOxE,EAAwB,iBAAiB,EAChD8E,EAAOhH,EAAM,WAAWyB,CAAyB,EACjDkF,EAAUK,GAAM,SAAW,GAajC,OAZA3F,EAAM,cAAgB,CAChBsF,GAAS7F,EAAA,SAAS,+BAAgCoE,EAAiB,iBAAiB,CAAC,CAC3F,EAAG,CAACyB,CAAO,CAAC,EACPD,EAAK,OACNC,GAGA,EAAArF,EAAA,IAAA,CAAC,MAAD,CAAK,UAAWnB,EAAAA,GAAGiE,CAAS,EAAG,GAAI5B,EAAM,GAAIiE,GAAU,IAAA,GAAgB,MACpE,UACE,CAAA,GAIP,EAAAnF,EAAA,IAAA,CAACG,EAA0B,SAA3B,CAAoC,MAAOI,EACzC,UAAA,EAAAP,EAAA,KAAA,CAAC,MAAD,CACE,KAAK,SACL,UAAWnB,EAAAA,GAAG,8CAA+CiE,CAAS,EACtE,GAAI5B,EACJ,GAAIiE,GAAUC,EAAK,QACnB,kBAAiBA,EAAK,UACtB,aAAW,OACN,MAPP,SAAA,CASGd,EACAoB,GAAM,KACJ,GAC6B,CAAA,EAvBb,IAyB3B,EACA,EAAe,YAAc,iBAmB7B,IAAaC,EAA4B,OAAO,OAAO3E,EAAe,CACpE,KAAMqC,EACN,QAASK,EACT,MAAOC,CACT,CAAC"}
@@ -0,0 +1,236 @@
1
+ "use client";
2
+ import { cn as e } from "../../lib/cn.mjs";
3
+ import { flattenChildren as t, getElementType as n } from "../../lib/children.mjs";
4
+ import { reportMissingContext as r, warnDeprecated as i, warnOnce as a } from "../../lib/dev.mjs";
5
+ import { composeEventHandlers as o } from "../../lib/composeEventHandlers.mjs";
6
+ import { useControllable as s } from "../../hooks/useControllable.mjs";
7
+ import { useId as c } from "../../hooks/useId.mjs";
8
+ import { disabledStyles as l, focusRingInset as u } from "../../lib/styles.mjs";
9
+ import { ChevronDownIcon as d } from "../../lib/icons.mjs";
10
+ import { getPartId as f } from "./disclosureIds.mjs";
11
+ import * as p from "react";
12
+ import { jsx as m, jsxs as h } from "react/jsx-runtime";
13
+ //#region src/components/layout/Accordion.tsx
14
+ var g = p.createContext(null), _ = p.createContext(null), v = p.createContext(null), y = [], b = {
15
+ openItems: y,
16
+ toggle: () => {},
17
+ registerItem: () => () => {},
18
+ baseId: "wave-accordion-inert",
19
+ headingLevel: 3
20
+ }, x = {
21
+ value: "",
22
+ isOpen: !1,
23
+ triggerId: "wave-accordion-inert-trigger",
24
+ panelId: "wave-accordion-inert-panel",
25
+ hasPanelContent: !1,
26
+ headingLevel: 3,
27
+ toggle: () => {}
28
+ }, S = {
29
+ extra: null,
30
+ inPanel: !0
31
+ }, C = p.createContext(!1), w = "m-0 grid";
32
+ function T(e) {
33
+ return p.useContext(g) || (r(e, "<Accordion>"), b);
34
+ }
35
+ function E(e) {
36
+ return p.useContext(_) || (r(e, "<Accordion.Item>"), x);
37
+ }
38
+ function D(e) {
39
+ a(`Accordion:duplicate:${e}`, `Accordion: several items share the value "${e}". Item values must be unique within an Accordion; items with the same value open and close together and share their trigger and panel ids.`);
40
+ }
41
+ function O(e) {
42
+ if (e !== void 0) return e === null ? y : [e];
43
+ }
44
+ var k = (t) => {
45
+ let { type: n, openItem: r, defaultOpenItem: o, onOpenItemChange: l, openItems: u, defaultOpenItems: d, onOpenItemsChange: f, headingLevel: h = 3, className: b, children: x, ref: S, ...w } = t, T = n === "multiple";
46
+ T || (u !== void 0 && i("Accordion", "openItems", "openItem", "In single mode the Accordion takes one value."), d !== void 0 && i("Accordion", "defaultOpenItems", "defaultOpenItem", "In single mode the Accordion takes one value."), f !== void 0 && i("Accordion", "onOpenItemsChange", "onOpenItemChange", "In single mode the Accordion reports one value."));
47
+ let E = T ? void 0 : r, k = p.useMemo(() => O(E) ?? u, [E, u]), [A] = p.useState(() => (T ? void 0 : O(o)) ?? d ?? y), [j, M] = s(k, A, (e) => {
48
+ let t = [...e];
49
+ T || l?.(t[0] ?? null), f?.(t);
50
+ }), N = j.length;
51
+ p.useEffect(() => {
52
+ !T && N > 1 && a("Accordion:single-multiple-open", `Accordion: type="single" allows one open item, but ${N} are open. Pass \`openItem\`, or use type="multiple".`);
53
+ }, [T, N]);
54
+ let P = p.useCallback((e) => {
55
+ M((t) => t.includes(e) ? t.filter((t) => t !== e) : T ? [...t, e] : [e]);
56
+ }, [T, M]), F = p.useRef(null), I = p.useCallback((e) => {
57
+ F.current ??= /* @__PURE__ */ new Map();
58
+ let t = F.current, n = (t.get(e) ?? 0) + 1;
59
+ return t.set(e, n), n > 1 && D(e), () => {
60
+ let n = (t.get(e) ?? 1) - 1;
61
+ n > 0 ? t.set(e, n) : t.delete(e);
62
+ };
63
+ }, []), L = c("accordion"), R = p.useMemo(() => ({
64
+ openItems: j,
65
+ toggle: P,
66
+ registerItem: I,
67
+ baseId: L,
68
+ headingLevel: h
69
+ }), [
70
+ j,
71
+ P,
72
+ I,
73
+ L,
74
+ h
75
+ ]);
76
+ return /* @__PURE__ */ m(g.Provider, {
77
+ value: R,
78
+ children: /* @__PURE__ */ m(_.Provider, {
79
+ value: null,
80
+ children: /* @__PURE__ */ m(v.Provider, {
81
+ value: null,
82
+ children: /* @__PURE__ */ m(C.Provider, {
83
+ value: !1,
84
+ children: /* @__PURE__ */ m("div", {
85
+ ref: S,
86
+ className: e("divide-y divide-border", b),
87
+ ...w,
88
+ children: x
89
+ })
90
+ })
91
+ })
92
+ })
93
+ });
94
+ };
95
+ k.displayName = "Accordion";
96
+ function A(e, t, r) {
97
+ if (Array.isArray(e)) {
98
+ for (let n of e) {
99
+ let e = A(n, t, r);
100
+ if (e) return e;
101
+ }
102
+ return;
103
+ }
104
+ if (!p.isValidElement(e)) return;
105
+ let i = n(e, { suspend: !1 });
106
+ if (i === t) return e;
107
+ if (i !== r && i !== k && i !== P) return A(e.props.children, t, r);
108
+ }
109
+ function j(e) {
110
+ let t = e?.props.id;
111
+ return typeof t == "string" && t !== "" ? t : void 0;
112
+ }
113
+ function M(e) {
114
+ if (!p.isValidElement(e)) return !1;
115
+ let t = n(e, { suspend: !1 });
116
+ if (typeof t == "string" || t === F || t === I || t === k || t === P) return !1;
117
+ let r = e.props.children;
118
+ return n(r, { suspend: !1 }) === F || M(r);
119
+ }
120
+ function N(e) {
121
+ return `${e} was rendered inside the panel of an Accordion.Item, so it is not the item's ${e === "Accordion.Trigger" ? "header" : "panel"}. Place Accordion.Trigger and Accordion.Panel directly in Accordion.Item, in a Fragment, or in an element that wraps them as \`children\` (such as a Tooltip). The Item cannot see inside a component that renders them itself and treats that component as panel content.`;
122
+ }
123
+ var P = ({ value: n, headingLevel: r, className: i, children: a, ref: o, ...s }) => {
124
+ let c = T("Accordion.Item"), l = c.openItems.includes(n), { toggle: u, baseId: d, registerItem: g } = c;
125
+ p.useEffect(() => g(n), [g, n]);
126
+ let y = r ?? c.headingLevel, b = `h${y}`, x, S, E = [], D = [];
127
+ for (let { key: e, node: n } of t(a)) {
128
+ let t = /* @__PURE__ */ m(p.Fragment, { children: n }, e), r = A(n, F, I), i = A(n, I, F);
129
+ r || i ? (x ??= r, S ??= i, E.push(M(n) ? /* @__PURE__ */ m(b, {
130
+ className: w,
131
+ children: /* @__PURE__ */ m(C.Provider, {
132
+ value: !0,
133
+ children: n
134
+ })
135
+ }, e) : t)) : D.push(t);
136
+ }
137
+ let O = x !== void 0, k = S !== void 0, N = j(x), P = j(S), L = k || D.length > 0, R = k && D.length > 0 ? D : null, z = p.useMemo(() => ({
138
+ value: n,
139
+ isOpen: l,
140
+ triggerId: N ?? f(d, "trigger", n),
141
+ panelId: P ?? f(d, "panel", n),
142
+ hasPanelContent: L,
143
+ headingLevel: y,
144
+ toggle: () => u(n)
145
+ }), [
146
+ n,
147
+ l,
148
+ d,
149
+ N,
150
+ P,
151
+ L,
152
+ y,
153
+ u
154
+ ]), B = p.useMemo(() => ({
155
+ extra: R,
156
+ inPanel: !1
157
+ }), [R]);
158
+ return /* @__PURE__ */ m(_.Provider, {
159
+ value: z,
160
+ children: /* @__PURE__ */ m(v.Provider, {
161
+ value: B,
162
+ children: /* @__PURE__ */ h("div", {
163
+ ref: o,
164
+ "data-state": l ? "open" : "closed",
165
+ className: e(i),
166
+ ...s,
167
+ children: [
168
+ O ? null : /* @__PURE__ */ m(F, { children: n }),
169
+ E,
170
+ !k && D.length > 0 ? /* @__PURE__ */ m(I, { children: D }) : null
171
+ ]
172
+ })
173
+ })
174
+ });
175
+ };
176
+ P.displayName = "AccordionItem";
177
+ var F = ({ id: t, className: n, children: r, onClick: i, ref: s, ...c }) => {
178
+ let f = E("Accordion.Trigger"), g = p.useContext(v)?.inPanel ?? !1;
179
+ p.useEffect(() => {
180
+ g && a("Accordion.Trigger:inside-panel", N("Accordion.Trigger"));
181
+ }, [g]);
182
+ let _ = p.useContext(C), y = `h${f.headingLevel}`, b = f.isOpen ? "open" : "closed", x = /* @__PURE__ */ h("button", {
183
+ type: "button",
184
+ className: e("flex w-full items-center justify-between gap-2 px-4 py-3 text-start text-body-1 font-semibold text-foreground", "not-disabled:not-aria-disabled:hover:bg-subtle-hover not-disabled:not-aria-disabled:active:bg-subtle-pressed", l, u, n),
185
+ ...c,
186
+ id: t || (g ? void 0 : f.triggerId),
187
+ "aria-controls": !g && f.hasPanelContent ? f.panelId : void 0,
188
+ "aria-expanded": f.isOpen,
189
+ "data-state": b,
190
+ onClick: o(i, f.toggle),
191
+ ref: s,
192
+ children: [r, /* @__PURE__ */ m(d, {
193
+ size: 16,
194
+ className: e("shrink-0 transition-transform motion-reduce:transition-none", f.isOpen && "rotate-180")
195
+ })]
196
+ });
197
+ return _ ? x : /* @__PURE__ */ m(y, {
198
+ className: w,
199
+ children: x
200
+ });
201
+ };
202
+ F.displayName = "AccordionTrigger";
203
+ var I = ({ id: t, className: n, children: r, ref: i, ...o }) => {
204
+ let s = E("Accordion.Panel"), c = p.useContext(v), l = c?.inPanel ?? !1;
205
+ return p.useEffect(() => {
206
+ l && a("Accordion.Panel:inside-panel", N("Accordion.Panel"));
207
+ }, [l]), s.isOpen ? l ? /* @__PURE__ */ m("div", {
208
+ className: e(n),
209
+ ...o,
210
+ id: t || void 0,
211
+ ref: i,
212
+ children: r
213
+ }) : /* @__PURE__ */ m(v.Provider, {
214
+ value: S,
215
+ children: /* @__PURE__ */ h("div", {
216
+ role: "region",
217
+ className: e("px-4 pb-3 text-body-1 text-muted-foreground", n),
218
+ ...o,
219
+ id: t || s.panelId,
220
+ "aria-labelledby": s.triggerId,
221
+ "data-state": "open",
222
+ ref: i,
223
+ children: [r, c?.extra]
224
+ })
225
+ }) : null;
226
+ };
227
+ I.displayName = "AccordionPanel";
228
+ var L = /* @__PURE__ */ Object.assign(k, {
229
+ Item: P,
230
+ Trigger: F,
231
+ Panel: I
232
+ });
233
+ //#endregion
234
+ export { L as Accordion, P as AccordionItem, I as AccordionPanel, F as AccordionTrigger };
235
+
236
+ //# sourceMappingURL=Accordion.mjs.map
@@ -0,0 +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","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","hasTrigger","hasPanel","triggerIdProp","panelIdProp","hasPanelContent","extraPanelContent","itemContext","getPartId","panelSlot","idProp","item","inPanel","headingOutside","state","button","disabledStyles","focusRingInset","composeEventHandlers","onClick","ChevronDownIcon","slot","Accordion"],"sources":["../../../src/components/layout/Accordion.tsx"],"sourcesContent":["import * as React from 'react';\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 ref={ref} className={cn('divide-y divide-border', className)} {...rest}>\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={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 ref={ref} data-state={isOpen ? 'open' : 'closed'} className={cn(className)} {...rest}>\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 '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 '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 ? button : <Heading className={HEADING_CLASS}>{button}</Heading>;\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 className={cn(className)} {...rest} id={idProp || undefined} ref={ref}>\n {children}\n </div>\n );\n }\n return (\n <AccordionPanelSlotContext.Provider value={IN_PANEL}>\n <div\n role=\"region\"\n className={cn('px-4 pb-3 text-body-1 text-muted-foreground', className)}\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":";;;;;;;;;;;;;AAoDA,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,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,iBAAiB,GAChDyF,IAAOtG,EAAM,WAAWG,CAAyB,GACjD0F,IAAUS,GAAM,WAAW;CAajC,OAZAtG,EAAM,gBAAgB;EACpB,AAAI6F,KAASvD,EAAS,gCAAgC4B,EAAiB,iBAAiB,CAAC;CAC3F,GAAG,CAAC2B,CAAO,CAAC,GACPD,EAAK,SACNC,IAGA,kBAAC,OAAD;EAAK,WAAW3C,EAAGC,CAAS;EAAG,GAAIhC;EAAM,IAAIwE,KAAU,KAAA;EAAgB;EACpE;CACE,CAAA,IAIP,kBAACxF,EAA0B,UAA3B;EAAoC,OAAOI;EACzC,UAAA,kBAAC,OAAD;GACE,MAAK;GACL,WAAW2C,EAAG,+CAA+CC,CAAS;GACtE,GAAIhC;GACJ,IAAIwE,KAAUC,EAAK;GACnB,mBAAiBA,EAAK;GACtB,cAAW;GACN;GAPP,UAAA,CASGf,GACAyB,GAAM,KACJ;;CAC6B,CAAA,IAvBb;AAyB3B;AACA,EAAe,cAAc;AAmB7B,IAAaC,IAA4B,uBAAO,OAAOtF,GAAe;CACpE,MAAM0C;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("../../hooks/useEventCallback.cjs"),o=require("../../hooks/useId.cjs"),s=require("../../lib/focus.cjs"),c=require("../../hooks/useMergedRefs.cjs"),l=require("../../lib/styles.cjs"),u=require("../../lib/icons.cjs");let d=require("react");d=e.__toESM(d,1);let f=require("react/jsx-runtime");var p=`button, a[href], input, select, textarea, label, summary, [role="button"], [tabindex]`,m=1;function h(e,t){let n=e.target;if(!n||typeof n.nodeType!=`number`||!t.contains(n))return!0;if(n.nodeType!==m)return!1;let r=n.closest(p);return r!==null&&r!==t&&t.contains(r)}var g=`Card:nested-interactive`,_=d.createContext(null),v=e=>{let{as:r,selected:p,onSelect:m,selectionControl:v=`card`,selectLabel:y,className:b,children:x,ref:S,onClick:C,onKeyDown:w,onKeyUp:T,onBlur:E,...D}=e,O=r??`div`,k=m!==void 0,A=k&&v===`checkbox`,j=k&&!A,M=O===`button`,N=o.useId(`card-title`),P=d.useRef(null),F=c.useMergedRefs(S,P);d.useEffect(()=>{let e=P.current;n.isDev&&e&&k&&(j&&!n.hasWarned(g)&&s.getTabbableElements(e).length>0&&n.warnOnce(g,'Card: a selectable card (`onSelect`) is a button and must not contain focusable elements (buttons, links, inputs). Use `selectionControl="checkbox"` for cards with interactive content.'),A&&!y&&!e.ownerDocument.getElementById(N)&&n.warnOnce(`Card:checkbox-name`,"Card: the selection checkbox has no accessible name. Render a `Card.Header` with a `title`, or pass `selectLabel`."))});let I=d.useRef(!1),L=a.useEventCallback(e=>{I.current=e}),R=a.useEventCallback(()=>{let e=I.current;return I.current=!1,e}),z=i.composeEventHandlers(C,e=>{k&&!h(e,e.currentTarget)&&m()}),B=j&&!M,V=i.composeEventHandlers(w,e=>{B&&(e.key===`Enter`||e.key===` `)&&(h(e,e.currentTarget)||(e.preventDefault(),e.key===` `?L(!0):e.repeat||m?.()))}),H=i.composeEventHandlers(T,e=>{B&&e.key===` `&&(!R()||e.defaultPrevented||h(e,e.currentTarget)||(e.preventDefault(),m?.()))},{checkDefaultPrevented:!1}),U=i.composeEventHandlers(E,()=>{B&&L(!1)},{checkDefaultPrevented:!1}),W={};return j&&(M?W.type=`button`:(W.role=`button`,W.tabIndex=0),p!==void 0&&(W[`aria-pressed`]=p)),(0,f.jsx)(_.Provider,{value:A?N:null,children:(0,f.jsxs)(O,{...W,...D,ref:F,"data-selected":p?``:void 0,className:t.cn(`overflow-hidden rounded-md border border-border bg-card shadow-4`,(k||p!==void 0)&&`relative`,p&&t.cn(`border-primary bg-selected text-selected-foreground ring-1 ring-inset ring-primary`,l.forcedColors.selectedContainer),k&&`cursor-pointer`,j&&`focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-ring`,b),onClick:z,onKeyDown:V,onKeyUp:H,onBlur:U,children:[A&&(0,f.jsx)(`input`,{type:`checkbox`,checked:p??!1,onChange:()=>m(),"aria-label":y,"aria-labelledby":y?void 0:N,className:t.cn(`absolute end-3 top-3 m-0 size-4 cursor-pointer accent-primary`,`focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-ring`)}),p&&!A&&(0,f.jsx)(u.CheckIcon,{size:12,className:`absolute end-2 top-2 text-primary`}),x]})})};v.displayName=`Card`;var y=e=>{let{as:n,title:i,subtitle:a,className:o,children:s,ref:c,...l}=e,u=n??`div`,p=d.useContext(_),m=r.slotRendersContent(i),h=r.slotRendersContent(a);return(0,f.jsxs)(u,{ref:c,className:t.cn(`p-4`,p&&`pe-10`,o),...l,children:[m&&(0,f.jsx)(`div`,{id:p??void 0,className:`text-subtitle-1`,children:r.materialiseSlotContent(i)}),h&&(0,f.jsx)(`div`,{className:`text-caption-1 text-muted-foreground`,children:r.materialiseSlotContent(a)}),s]})};y.displayName=`CardHeader`;var b=e=>{let{as:n,className:r,ref:i,...a}=e;return(0,f.jsx)(n??`div`,{ref:i,className:t.cn(`p-4 pt-0`,r),...a})};b.displayName=`CardBody`;var x=e=>{let{as:n,className:r,ref:i,...a}=e;return(0,f.jsx)(n??`div`,{ref:i,className:t.cn(`flex justify-end gap-2 p-4 pt-0`,r),...a})};x.displayName=`CardFooter`;var S=Object.assign(v,{Header:y,Body:b,Footer:x});exports.Card=S,exports.CardBody=b,exports.CardFooter=x,exports.CardHeader=y;
2
+ //# sourceMappingURL=Card.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Card.cjs","names":["React","useId","useMergedRefs","isDev","hasWarned","getTabbableElements","useEventCallback","composeEventHandlers","cn","forcedColors","CheckIcon","slotRendersContent","materialiseSlotContent","require_runtime","require_cn","require_dev","require_slot","require_composeEventHandlers","require_useEventCallback","require_useId","require_focus","require_useMergedRefs","require_styles","require_icons","react","react_jsx_runtime","INTERACTIVE_SELECTOR","ELEMENT_NODE","isForeignEvent","target","event","root","control","NESTED_INTERACTIVE_WARNING","CardTitleIdContext","CardRoot","rest","props","Component","as","selectable","onSelect","checkboxMode","selectionControl","cardMode","nativeButton","titleId","rootRef","mergedRef","ref","selectLabel","spaceArmedRef","setSpaceArmed","armed","takeSpaceArmed","handleClick","onClick","keyboardActivation","handleKeyDown","onKeyDown","handleKeyUp","onKeyUp","handleBlur","onBlur","defaults","selected","className","children","CardHeader","hasTitle","title","hasSubtitle","subtitle","CardBody","CardFooter","Card"],"sources":["../../../src/components/layout/Card.tsx"],"sourcesContent":["import * as React from 'react';\nimport { cn } from '../../lib/cn';\nimport { composeEventHandlers } from '../../lib/composeEventHandlers';\nimport { hasWarned, isDev, warnOnce } from '../../lib/dev';\nimport { getTabbableElements } from '../../lib/focus';\nimport { CheckIcon } from '../../lib/icons';\nimport { materialiseSlotContent, slotRendersContent } from '../../lib/slot';\nimport { focusRing, forcedColors } from '../../lib/styles';\nimport type { PolymorphicComponent, PolymorphicProps } from '../../lib/polymorphic';\nimport { useEventCallback } from '../../hooks/useEventCallback';\nimport { useId } from '../../hooks/useId';\nimport { useMergedRefs } from '../../hooks/useMergedRefs';\n\n/**\n * Elements whose own events a selectable card ignores: a click or key press that starts inside a\n * nested control belongs to that control, never to the card (layout#35). A `<label>` counts too:\n * its click already activates the control it labels.\n */\nconst INTERACTIVE_SELECTOR =\n 'button, a[href], input, select, textarea, label, summary, [role=\"button\"], [tabindex]';\n\n/** `Node.ELEMENT_NODE`, spelled out so no realm's `Node` global is read. */\nconst ELEMENT_NODE = 1;\n\n/**\n * Whether the card must ignore `event`: it started outside the card's DOM, or inside an\n * interactive element nested in `root` (the card itself, which carries `role=\"button\"`/`tabindex`\n * in the default mode, does not count).\n *\n * React events bubble through portals along the component tree, so a menu, popover or dialog\n * opened from inside the card (e.g. a footer overflow menu) reaches the card's handlers although\n * its DOM lives elsewhere. Such a target is not a DOM descendant of the card and never selects it.\n *\n * The target is duck typed (`nodeType`) rather than checked with `instanceof`, so a card rendered\n * into another realm's document (an iframe, or a popout window reached through `createPortal`)\n * still selects: its nodes are not instances of the main realm's `Node`/`Element`.\n */\nfunction isForeignEvent(event: React.SyntheticEvent, root: Element): boolean {\n const target = event.target as Partial<Node> | null;\n if (!target || typeof target.nodeType !== 'number' || !root.contains(target as Node)) {\n return true;\n }\n if (target.nodeType !== ELEMENT_NODE) return false;\n const control = (target as Element).closest(INTERACTIVE_SELECTOR);\n return control !== null && control !== root && root.contains(control);\n}\n\n/** Warn-once key of the \"selectable card contains tabbable elements\" diagnostic. */\nconst NESTED_INTERACTIVE_WARNING = 'Card:nested-interactive';\n\n/**\n * The id of the header title that names the built-in checkbox of a `selectionControl=\"checkbox\"`\n * card; `null` everywhere else (other cards, and a `Card.Header` rendered on its own, which does\n * not require a Card). A string, never an object, so the provider value needs no memoisation.\n */\nconst CardTitleIdContext = React.createContext<string | null>(null);\n\n/**\n * The Card's own props (the XOwnProps rule of `PolymorphicProps`: component-specific props only).\n * Every other prop comes from the rendered element (`as`).\n */\nexport interface CardOwnProps {\n /**\n * Whether the card is selected. Shown with the selected colors plus non-color cues: a 2px primary\n * border (a 1px border plus an inset 1px ring), a Highlight outline in forced-colors mode, and a\n * check glyph (with `selectionControl=\"checkbox\"` the checked checkbox instead).\n *\n * The state reaches assistive technology only on a selectable card (`onSelect`): as\n * `aria-pressed` (default mode) or as the built-in checkbox's checked state. Without `onSelect`,\n * `selected` is a visual state only (the glyph is decorative); state it in the content if it\n * matters to screen-reader users, or make the card selectable.\n */\n selected?: boolean;\n /**\n * Makes the card selectable: called when the card is activated by a click, Enter (on key down)\n * or Space (on key up, like a native button) in the default mode, or when its built-in checkbox\n * changes (`selectionControl=\"checkbox\"`). Clicks and key presses that start inside a nested\n * interactive element (a button, link, input or any element with `tabindex`), or in content\n * portaled out of the card (a menu, popover or dialog opened from it), are ignored, so a footer\n * action never selects the card.\n */\n onSelect?: () => void;\n /**\n * How a selectable card (`onSelect`) exposes its selection:\n * - `'card'` (default): the card itself is the control — `role=\"button\"`, a tab stop, Enter and\n * Space activation and `aria-pressed={selected}` when `selected` is defined. Use it only for\n * cards **without** interactive content: a button inside a `role=\"button\"` card is invalid\n * (axe `nested-interactive`), and a development warning points here. A button's children are\n * presentational, so the card's content is flattened into its name: a heading (e.g.\n * `<Card.Header as=\"h3\">`), list or other structure inside it is not exposed and cannot be\n * reached by heading navigation (no warning covers this). Keep such cards short.\n * - `'checkbox'`: the card is not a widget; a built-in native checkbox (top end corner) carries\n * `selected` and is named by the `Card.Header` title (or `selectLabel`). Pointer clicks on\n * non-interactive card areas still toggle it. Use it for cards with actions, and for cards\n * whose headings or other structure must stay navigable.\n * @default 'card'\n */\n selectionControl?: 'card' | 'checkbox';\n /**\n * Accessible name of the built-in checkbox (`selectionControl=\"checkbox\"`). Defaults to the\n * `Card.Header` title, which the checkbox references with `aria-labelledby`.\n */\n selectLabel?: string;\n}\n\n/**\n * Props of {@link Card} rendered as `C` (default `'div'`). `CardProps` without a type argument is\n * the 0.4 name: the props of a Card rendered as a `<div>`, including `ref`.\n */\nexport type CardProps<C extends React.ElementType = 'div'> = PolymorphicProps<C, CardOwnProps>;\n\n/** The props the implementation reads, for any `as` (the public typing is `PolymorphicComponent`). */\ntype CardImplProps = CardOwnProps &\n Omit<React.HTMLAttributes<HTMLElement>, 'onSelect'> & {\n as?: React.ElementType;\n ref?: React.Ref<HTMLElement>;\n type?: string;\n };\n\n// The Card root, documented on the exported `Card` const.\nconst CardRoot: PolymorphicComponent<'div', CardOwnProps> = (props) => {\n const {\n as,\n selected,\n onSelect,\n selectionControl = 'card',\n selectLabel,\n className,\n children,\n ref,\n onClick,\n onKeyDown,\n onKeyUp,\n onBlur,\n ...rest\n } = props as CardImplProps;\n\n const Component: React.ElementType = as ?? 'div';\n const selectable = onSelect !== undefined;\n const checkboxMode = selectable && selectionControl === 'checkbox';\n const cardMode = selectable && !checkboxMode;\n /** A native `<button>` already has the role, tab stop and keyboard activation. */\n const nativeButton = Component === 'button';\n\n const titleId = useId('card-title');\n const rootRef = React.useRef<HTMLElement | null>(null);\n const mergedRef = useMergedRefs<HTMLElement>(ref, rootRef);\n\n // Development diagnostics (C-DEV): read the mounted DOM after every commit (content can change\n // without prop changes), warn once. Once a key has warned, its DOM scan is skipped.\n React.useEffect(() => {\n const root = rootRef.current;\n if (!isDev || !root || !selectable) return;\n if (\n cardMode &&\n !hasWarned(NESTED_INTERACTIVE_WARNING) &&\n getTabbableElements(root).length > 0\n ) {\n warnOnce(\n NESTED_INTERACTIVE_WARNING,\n 'Card: a selectable card (`onSelect`) is a button and must not contain focusable elements (buttons, links, inputs). Use `selectionControl=\"checkbox\"` for cards with interactive content.',\n );\n }\n if (checkboxMode && !selectLabel && !root.ownerDocument.getElementById(titleId)) {\n warnOnce(\n 'Card:checkbox-name',\n 'Card: the selection checkbox has no accessible name. Render a `Card.Header` with a `title`, or pass `selectLabel`.',\n );\n }\n });\n\n /**\n * Set by an unprevented Space keydown on the card; Space selects on the following keyup only\n * while it is set (like a native button and P01's Button: a keyup alone never selects, and\n * moving focus away in between cancels). The ref is only touched from event handlers, through\n * these two stable callbacks (C-HOOKS).\n */\n const spaceArmedRef = React.useRef(false);\n /** Arms (or disarms) Space activation. */\n const setSpaceArmed = useEventCallback((armed: boolean) => {\n spaceArmedRef.current = armed;\n });\n /** Reads and clears the Space arm. */\n const takeSpaceArmed = useEventCallback(() => {\n const armed = spaceArmedRef.current;\n spaceArmedRef.current = false;\n return armed;\n });\n\n const handleClick = composeEventHandlers<React.MouseEvent<HTMLElement>>(onClick, (event) => {\n if (!selectable || isForeignEvent(event, event.currentTarget)) return;\n onSelect();\n });\n\n /** Keyboard activation applies to a `role=\"button\"` card (a native `<button>` has its own). */\n const keyboardActivation = cardMode && !nativeButton;\n\n const handleKeyDown = composeEventHandlers<React.KeyboardEvent<HTMLElement>>(\n onKeyDown,\n (event) => {\n if (!keyboardActivation) return;\n if (event.key !== 'Enter' && event.key !== ' ') return;\n if (isForeignEvent(event, event.currentTarget)) return;\n // Space would scroll the page: prevent it now, select on keyup. Enter selects on keydown; a\n // held Enter does not toggle repeatedly.\n event.preventDefault();\n if (event.key === ' ') setSpaceArmed(true);\n else if (!event.repeat) onSelect?.();\n },\n );\n\n const handleKeyUp = composeEventHandlers<React.KeyboardEvent<HTMLElement>>(\n onKeyUp,\n (event) => {\n if (!keyboardActivation || event.key !== ' ') return;\n // Always consume the arm, also when the consumer prevented this keyup.\n const armed = takeSpaceArmed();\n if (!armed || event.defaultPrevented || isForeignEvent(event, event.currentTarget)) return;\n event.preventDefault();\n onSelect?.();\n },\n { checkDefaultPrevented: false },\n );\n\n // Moving focus away between Space keydown and keyup cancels the activation (native behavior).\n const handleBlur = composeEventHandlers<React.FocusEvent<HTMLElement>>(\n onBlur,\n () => {\n if (keyboardActivation) setSpaceArmed(false);\n },\n { checkDefaultPrevented: false },\n );\n\n /** Defaults the consumer may override (C-COMPOSE: before `{...rest}`). */\n const defaults: Record<string, unknown> = {};\n if (cardMode) {\n if (nativeButton) {\n defaults.type = 'button';\n } else {\n defaults.role = 'button';\n defaults.tabIndex = 0;\n }\n if (selected !== undefined) defaults['aria-pressed'] = selected;\n }\n\n return (\n <CardTitleIdContext.Provider value={checkboxMode ? titleId : null}>\n <Component\n {...defaults}\n {...rest}\n ref={mergedRef}\n data-selected={selected ? '' : undefined}\n className={cn(\n 'overflow-hidden rounded-md border border-border bg-card shadow-4',\n // Positions the check glyph / checkbox; plain cards keep their 0.4 positioning.\n (selectable || selected !== undefined) && 'relative',\n selected &&\n cn(\n 'border-primary bg-selected text-selected-foreground ring-1 ring-inset ring-primary',\n forcedColors.selectedContainer,\n ),\n selectable && 'cursor-pointer',\n cardMode && focusRing,\n className,\n )}\n onClick={handleClick}\n onKeyDown={handleKeyDown}\n onKeyUp={handleKeyUp}\n onBlur={handleBlur}\n >\n {checkboxMode && (\n <input\n type=\"checkbox\"\n checked={selected ?? false}\n onChange={() => onSelect()}\n aria-label={selectLabel}\n aria-labelledby={selectLabel ? undefined : titleId}\n className={cn(\n 'absolute end-3 top-3 m-0 size-4 cursor-pointer accent-primary',\n focusRing,\n )}\n />\n )}\n {selected && !checkboxMode && (\n <CheckIcon size={12} className=\"absolute end-2 top-2 text-primary\" />\n )}\n {children}\n </Component>\n </CardTitleIdContext.Provider>\n );\n};\nCardRoot.displayName = 'Card';\n\n/** The Card.Header's own props (component-specific props only). */\nexport interface CardHeaderOwnProps {\n /**\n * Title content displayed in the card header. It also names a selectable card's built-in\n * checkbox (`selectionControl=\"checkbox\"`). Content that renders nothing (`''`, `[]`, a list of\n * nothing) renders no title element; `0` is content.\n */\n title?: React.ReactNode;\n /** Subtitle content displayed below the title (none when it renders nothing, as `title`). */\n subtitle?: React.ReactNode;\n}\n\n/** Props of {@link CardHeader} rendered as `C` (default `'div'`), including `ref`. */\nexport type CardHeaderProps<C extends React.ElementType = 'div'> = PolymorphicProps<\n C,\n CardHeaderOwnProps\n>;\n\ntype CardHeaderImplProps = CardHeaderOwnProps &\n Omit<React.HTMLAttributes<HTMLElement>, 'title'> & {\n as?: React.ElementType;\n ref?: React.Ref<HTMLElement>;\n };\n\n/**\n * The header of a {@link Card}: a title and an optional subtitle, followed by any children.\n * Flat export for React Server Components (`Card.Header` in client files).\n */\nexport const CardHeader: PolymorphicComponent<'div', CardHeaderOwnProps> = (props) => {\n const { as, title, subtitle, className, children, ref, ...rest } = props as CardHeaderImplProps;\n const Component: React.ElementType = as ?? 'div';\n /** Set only inside a `selectionControl=\"checkbox\"` card: the title names its checkbox. */\n const titleId = React.useContext(CardTitleIdContext);\n // A title or subtitle that renders nothing (`''`, `[]`, a list of nothing) gets no element, so a\n // checkbox card with such a title warns about its missing name; `0` is content.\n const hasTitle = slotRendersContent(title);\n const hasSubtitle = slotRendersContent(subtitle);\n return (\n // In a checkbox card the header keeps clear of the checkbox in the top end corner.\n <Component ref={ref} className={cn('p-4', titleId && 'pe-10', className)} {...rest}>\n {hasTitle && (\n <div id={titleId ?? undefined} className=\"text-subtitle-1\">\n {materialiseSlotContent(title)}\n </div>\n )}\n {hasSubtitle && (\n <div className=\"text-caption-1 text-muted-foreground\">\n {materialiseSlotContent(subtitle)}\n </div>\n )}\n {children}\n </Component>\n );\n};\nCardHeader.displayName = 'CardHeader';\n\n/** The Card.Body's own props: none besides the element's (component-specific props only). */\nexport type CardBodyOwnProps = Record<never, never>;\n\n/** Props of {@link CardBody} rendered as `C` (default `'div'`), including `ref`. */\nexport type CardBodyProps<C extends React.ElementType = 'div'> = PolymorphicProps<\n C,\n CardBodyOwnProps\n>;\n\ntype CardSectionImplProps = React.HTMLAttributes<HTMLElement> & {\n as?: React.ElementType;\n ref?: React.Ref<HTMLElement>;\n};\n\n/**\n * The main content of a {@link Card}. Flat export for React Server Components (`Card.Body` in\n * client files).\n */\nexport const CardBody: PolymorphicComponent<'div', CardBodyOwnProps> = (props) => {\n const { as, className, ref, ...rest } = props as CardSectionImplProps;\n const Component: React.ElementType = as ?? 'div';\n return <Component ref={ref} className={cn('p-4 pt-0', className)} {...rest} />;\n};\nCardBody.displayName = 'CardBody';\n\n/** The Card.Footer's own props: none besides the element's (component-specific props only). */\nexport type CardFooterOwnProps = Record<never, never>;\n\n/** Props of {@link CardFooter} rendered as `C` (default `'div'`), including `ref`. */\nexport type CardFooterProps<C extends React.ElementType = 'div'> = PolymorphicProps<\n C,\n CardFooterOwnProps\n>;\n\n/**\n * The action row of a {@link Card} (end-aligned). A selectable card with actions here needs\n * `selectionControl=\"checkbox\"`. Flat export for React Server Components (`Card.Footer` in client\n * files).\n */\nexport const CardFooter: PolymorphicComponent<'div', CardFooterOwnProps> = (props) => {\n const { as, className, ref, ...rest } = props as CardSectionImplProps;\n const Component: React.ElementType = as ?? 'div';\n return (\n <Component ref={ref} className={cn('flex justify-end gap-2 p-4 pt-0', className)} {...rest} />\n );\n};\nCardFooter.displayName = 'CardFooter';\n\n/**\n * A surface that groups related content, with `Card.Header`, `Card.Body` and `Card.Footer`.\n *\n * **Selectable cards** (`onSelect`) come in two patterns:\n * - A card without interactive content is itself the control (`selectionControl=\"card\"`, the\n * default): it is a `role=\"button\"` tab stop activated by click, Enter (key down) or Space (key\n * up, cancelled by moving focus away first), with `aria-pressed` reflecting `selected`. Its\n * content becomes the button's name, so headings and other structure inside it are flattened.\n * - A card that contains buttons or links, or headings that must stay navigable, uses\n * `selectionControl=\"checkbox\"`: a built-in checkbox named by the header title carries the\n * selection, and the card's actions and structure stay separate from it.\n *\n * In both modes events that start inside a nested interactive element, or in content portaled out\n * of the card, are ignored. `onClick`, `onKeyDown` and `onKeyUp` are composed with the built-in\n * selection (call `event.preventDefault()` to skip it). A `selected` card without `onSelect` shows\n * the selected look only; its state is not exposed to assistive technology.\n *\n * React Server Components cannot dot into a client module: import the flat names `CardHeader`,\n * `CardBody` and `CardFooter` there; `Card.Header` etc. work in client files.\n *\n * @example\n * <Card onSelect={toggle} selected={selected}>\n * <Card.Header title=\"Pro plan\" subtitle=\"Billed monthly\" />\n * </Card>\n *\n * <Card onSelect={toggle} selected={selected} selectionControl=\"checkbox\">\n * <Card.Header title=\"Pro plan\" />\n * <Card.Footer><Button>Details</Button></Card.Footer>\n * </Card>\n */\nexport const Card = /* @__PURE__ */ Object.assign(CardRoot, {\n Header: CardHeader,\n Body: CardBody,\n Footer: CardFooter,\n});\n"],"mappings":"6fAkBA,IAAM0B,EACJ,wFAGIC,EAAe,EAerB,SAASC,EAAe,EAA6B,EAAwB,CAC3E,IAAMC,EAASC,EAAM,OACrB,GAAI,CAACD,GAAU,OAAOA,EAAO,UAAa,UAAY,CAACE,EAAK,SAASF,CAAc,EACjF,MAAO,GAET,GAAIA,EAAO,WAAaF,EAAc,MAAO,GAC7C,IAAMK,EAAWH,EAAmB,QAAQH,CAAoB,EAChE,OAAOM,IAAY,MAAQA,IAAYD,GAAQA,EAAK,SAASC,CAAO,CACtE,CAGA,IAAMC,EAA6B,0BAO7BC,EAAqBlC,EAAM,cAA6B,IAAI,EAiE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