@mortenbrudvik/waveui 0.4.0 → 0.8.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 (650) hide show
  1. package/README.md +1484 -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 +51 -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 +57 -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 +55 -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 +38 -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 +46 -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 +67 -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 +68 -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 +64 -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 +126 -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 +162 -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 +135 -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 +33 -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 +29 -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 +53 -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 +33 -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 +105 -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 +382 -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 +50 -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 +72 -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 +152 -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 +202 -0
  106. package/dist/components/feedback/MessageBar.mjs.map +1 -0
  107. package/dist/components/feedback/MessageBar.parts.cjs +2 -0
  108. package/dist/components/feedback/MessageBar.parts.cjs.map +1 -0
  109. package/dist/components/feedback/MessageBar.parts.mjs +84 -0
  110. package/dist/components/feedback/MessageBar.parts.mjs.map +1 -0
  111. package/dist/components/feedback/MessageBar.reflow.cjs +2 -0
  112. package/dist/components/feedback/MessageBar.reflow.cjs.map +1 -0
  113. package/dist/components/feedback/MessageBar.reflow.mjs +74 -0
  114. package/dist/components/feedback/MessageBar.reflow.mjs.map +1 -0
  115. package/dist/components/feedback/MessageBar.status.cjs +2 -0
  116. package/dist/components/feedback/MessageBar.status.cjs.map +1 -0
  117. package/dist/components/feedback/MessageBar.status.mjs +46 -0
  118. package/dist/components/feedback/MessageBar.status.mjs.map +1 -0
  119. package/dist/components/feedback/ProgressBar.cjs +2 -0
  120. package/dist/components/feedback/ProgressBar.cjs.map +1 -0
  121. package/dist/components/feedback/ProgressBar.mjs +73 -0
  122. package/dist/components/feedback/ProgressBar.mjs.map +1 -0
  123. package/dist/components/feedback/Skeleton.cjs +2 -0
  124. package/dist/components/feedback/Skeleton.cjs.map +1 -0
  125. package/dist/components/feedback/Skeleton.mjs +49 -0
  126. package/dist/components/feedback/Skeleton.mjs.map +1 -0
  127. package/dist/components/feedback/Spinner.cjs +2 -0
  128. package/dist/components/feedback/Spinner.cjs.map +1 -0
  129. package/dist/components/feedback/Spinner.mjs +61 -0
  130. package/dist/components/feedback/Spinner.mjs.map +1 -0
  131. package/dist/components/feedback/Toast.cjs +2 -0
  132. package/dist/components/feedback/Toast.cjs.map +1 -0
  133. package/dist/components/feedback/Toast.context.cjs +2 -0
  134. package/dist/components/feedback/Toast.context.cjs.map +1 -0
  135. package/dist/components/feedback/Toast.context.mjs +23 -0
  136. package/dist/components/feedback/Toast.context.mjs.map +1 -0
  137. package/dist/components/feedback/Toast.mjs +15 -0
  138. package/dist/components/feedback/Toast.mjs.map +1 -0
  139. package/dist/components/feedback/Toast.parts.cjs +2 -0
  140. package/dist/components/feedback/Toast.parts.cjs.map +1 -0
  141. package/dist/components/feedback/Toast.parts.mjs +98 -0
  142. package/dist/components/feedback/Toast.parts.mjs.map +1 -0
  143. package/dist/components/feedback/Toast.root.cjs +2 -0
  144. package/dist/components/feedback/Toast.root.cjs.map +1 -0
  145. package/dist/components/feedback/Toast.root.mjs +109 -0
  146. package/dist/components/feedback/Toast.root.mjs.map +1 -0
  147. package/dist/components/feedback/Toaster.cjs +2 -0
  148. package/dist/components/feedback/Toaster.cjs.map +1 -0
  149. package/dist/components/feedback/Toaster.mjs +564 -0
  150. package/dist/components/feedback/Toaster.mjs.map +1 -0
  151. package/dist/components/input/AlphaSlider.cjs +2 -0
  152. package/dist/components/input/AlphaSlider.cjs.map +1 -0
  153. package/dist/components/input/AlphaSlider.mjs +115 -0
  154. package/dist/components/input/AlphaSlider.mjs.map +1 -0
  155. package/dist/components/input/Checkbox.cjs +2 -0
  156. package/dist/components/input/Checkbox.cjs.map +1 -0
  157. package/dist/components/input/Checkbox.mjs +97 -0
  158. package/dist/components/input/Checkbox.mjs.map +1 -0
  159. package/dist/components/input/ColorArea.cjs +2 -0
  160. package/dist/components/input/ColorArea.cjs.map +1 -0
  161. package/dist/components/input/ColorArea.mjs +204 -0
  162. package/dist/components/input/ColorArea.mjs.map +1 -0
  163. package/dist/components/input/ColorPicker.cjs +6 -0
  164. package/dist/components/input/ColorPicker.cjs.map +1 -0
  165. package/dist/components/input/ColorPicker.mjs +213 -0
  166. package/dist/components/input/ColorPicker.mjs.map +1 -0
  167. package/dist/components/input/ColorPicker.parts.cjs +2 -0
  168. package/dist/components/input/ColorPicker.parts.cjs.map +1 -0
  169. package/dist/components/input/ColorPicker.parts.mjs +192 -0
  170. package/dist/components/input/ColorPicker.parts.mjs.map +1 -0
  171. package/dist/components/input/ColorSlider.cjs +2 -0
  172. package/dist/components/input/ColorSlider.cjs.map +1 -0
  173. package/dist/components/input/ColorSlider.mjs +138 -0
  174. package/dist/components/input/ColorSlider.mjs.map +1 -0
  175. package/dist/components/input/Combobox.cjs +2 -0
  176. package/dist/components/input/Combobox.cjs.map +1 -0
  177. package/dist/components/input/Combobox.expand.cjs +2 -0
  178. package/dist/components/input/Combobox.expand.cjs.map +1 -0
  179. package/dist/components/input/Combobox.expand.mjs +38 -0
  180. package/dist/components/input/Combobox.expand.mjs.map +1 -0
  181. package/dist/components/input/Combobox.mjs +192 -0
  182. package/dist/components/input/Combobox.mjs.map +1 -0
  183. package/dist/components/input/DatePicker.cjs +2 -0
  184. package/dist/components/input/DatePicker.cjs.map +1 -0
  185. package/dist/components/input/DatePicker.mjs +341 -0
  186. package/dist/components/input/DatePicker.mjs.map +1 -0
  187. package/dist/components/input/Dropdown.cjs +2 -0
  188. package/dist/components/input/Dropdown.cjs.map +1 -0
  189. package/dist/components/input/Dropdown.mjs +131 -0
  190. package/dist/components/input/Dropdown.mjs.map +1 -0
  191. package/dist/components/input/Field.cjs +2 -0
  192. package/dist/components/input/Field.cjs.map +1 -0
  193. package/dist/components/input/Field.mjs +201 -0
  194. package/dist/components/input/Field.mjs.map +1 -0
  195. package/dist/components/input/Input.cjs +2 -0
  196. package/dist/components/input/Input.cjs.map +1 -0
  197. package/dist/components/input/Input.mjs +82 -0
  198. package/dist/components/input/Input.mjs.map +1 -0
  199. package/dist/components/input/Label.cjs +2 -0
  200. package/dist/components/input/Label.cjs.map +1 -0
  201. package/dist/components/input/Label.mjs +29 -0
  202. package/dist/components/input/Label.mjs.map +1 -0
  203. package/dist/components/input/Option.cjs +2 -0
  204. package/dist/components/input/Option.cjs.map +1 -0
  205. package/dist/components/input/Option.mjs +171 -0
  206. package/dist/components/input/Option.mjs.map +1 -0
  207. package/dist/components/input/RadioGroup.cjs +2 -0
  208. package/dist/components/input/RadioGroup.cjs.map +1 -0
  209. package/dist/components/input/RadioGroup.mjs +140 -0
  210. package/dist/components/input/RadioGroup.mjs.map +1 -0
  211. package/dist/components/input/Rating.cjs +2 -0
  212. package/dist/components/input/Rating.cjs.map +1 -0
  213. package/dist/components/input/Rating.mjs +197 -0
  214. package/dist/components/input/Rating.mjs.map +1 -0
  215. package/dist/components/input/SearchBox.cjs +2 -0
  216. package/dist/components/input/SearchBox.cjs.map +1 -0
  217. package/dist/components/input/SearchBox.mjs +204 -0
  218. package/dist/components/input/SearchBox.mjs.map +1 -0
  219. package/dist/components/input/Select.cjs +2 -0
  220. package/dist/components/input/Select.cjs.map +1 -0
  221. package/dist/components/input/Select.mjs +34 -0
  222. package/dist/components/input/Select.mjs.map +1 -0
  223. package/dist/components/input/Slider.cjs +2 -0
  224. package/dist/components/input/Slider.cjs.map +1 -0
  225. package/dist/components/input/Slider.mjs +80 -0
  226. package/dist/components/input/Slider.mjs.map +1 -0
  227. package/dist/components/input/SpinButton.cjs +2 -0
  228. package/dist/components/input/SpinButton.cjs.map +1 -0
  229. package/dist/components/input/SpinButton.mjs +158 -0
  230. package/dist/components/input/SpinButton.mjs.map +1 -0
  231. package/dist/components/input/SwatchPicker.cjs +2 -0
  232. package/dist/components/input/SwatchPicker.cjs.map +1 -0
  233. package/dist/components/input/SwatchPicker.mjs +114 -0
  234. package/dist/components/input/SwatchPicker.mjs.map +1 -0
  235. package/dist/components/input/Switch.cjs +2 -0
  236. package/dist/components/input/Switch.cjs.map +1 -0
  237. package/dist/components/input/Switch.mjs +93 -0
  238. package/dist/components/input/Switch.mjs.map +1 -0
  239. package/dist/components/input/TagPicker.cjs +2 -0
  240. package/dist/components/input/TagPicker.cjs.map +1 -0
  241. package/dist/components/input/TagPicker.mjs +253 -0
  242. package/dist/components/input/TagPicker.mjs.map +1 -0
  243. package/dist/components/input/Textarea.cjs +2 -0
  244. package/dist/components/input/Textarea.cjs.map +1 -0
  245. package/dist/components/input/Textarea.mjs +33 -0
  246. package/dist/components/input/Textarea.mjs.map +1 -0
  247. package/dist/components/input/TimePicker.cjs +2 -0
  248. package/dist/components/input/TimePicker.cjs.map +1 -0
  249. package/dist/components/input/TimePicker.mjs +295 -0
  250. package/dist/components/input/TimePicker.mjs.map +1 -0
  251. package/dist/components/input/colorName.cjs +2 -0
  252. package/dist/components/input/colorName.cjs.map +1 -0
  253. package/dist/components/input/colorName.mjs +30 -0
  254. package/dist/components/input/colorName.mjs.map +1 -0
  255. package/dist/components/input/colorUtils.cjs +2 -0
  256. package/dist/components/input/colorUtils.cjs.map +1 -0
  257. package/dist/components/input/colorUtils.mjs +194 -0
  258. package/dist/components/input/colorUtils.mjs.map +1 -0
  259. package/dist/components/input/dateUtils.cjs +2 -0
  260. package/dist/components/input/dateUtils.cjs.map +1 -0
  261. package/dist/components/input/dateUtils.mjs +250 -0
  262. package/dist/components/input/dateUtils.mjs.map +1 -0
  263. package/dist/components/input/pickerStyles.cjs +2 -0
  264. package/dist/components/input/pickerStyles.cjs.map +1 -0
  265. package/dist/components/input/pickerStyles.mjs +10 -0
  266. package/dist/components/input/pickerStyles.mjs.map +1 -0
  267. package/dist/components/internal/HiddenInput.cjs +2 -0
  268. package/dist/components/internal/HiddenInput.cjs.map +1 -0
  269. package/dist/components/internal/HiddenInput.mjs +88 -0
  270. package/dist/components/internal/HiddenInput.mjs.map +1 -0
  271. package/dist/components/layout/Accordion.cjs +2 -0
  272. package/dist/components/layout/Accordion.cjs.map +1 -0
  273. package/dist/components/layout/Accordion.mjs +237 -0
  274. package/dist/components/layout/Accordion.mjs.map +1 -0
  275. package/dist/components/layout/Card.cjs +2 -0
  276. package/dist/components/layout/Card.cjs.map +1 -0
  277. package/dist/components/layout/Card.mjs +122 -0
  278. package/dist/components/layout/Card.mjs.map +1 -0
  279. package/dist/components/layout/Carousel.cjs +2 -0
  280. package/dist/components/layout/Carousel.cjs.map +1 -0
  281. package/dist/components/layout/Carousel.mjs +206 -0
  282. package/dist/components/layout/Carousel.mjs.map +1 -0
  283. package/dist/components/layout/Flex.cjs +2 -0
  284. package/dist/components/layout/Flex.cjs.map +1 -0
  285. package/dist/components/layout/Flex.mjs +55 -0
  286. package/dist/components/layout/Flex.mjs.map +1 -0
  287. package/dist/components/layout/Grid.cjs +2 -0
  288. package/dist/components/layout/Grid.cjs.map +1 -0
  289. package/dist/components/layout/Grid.mjs +63 -0
  290. package/dist/components/layout/Grid.mjs.map +1 -0
  291. package/dist/components/layout/Overflow.cjs +2 -0
  292. package/dist/components/layout/Overflow.cjs.map +1 -0
  293. package/dist/components/layout/Overflow.mjs +270 -0
  294. package/dist/components/layout/Overflow.mjs.map +1 -0
  295. package/dist/components/layout/Stack.cjs +2 -0
  296. package/dist/components/layout/Stack.cjs.map +1 -0
  297. package/dist/components/layout/Stack.mjs +40 -0
  298. package/dist/components/layout/Stack.mjs.map +1 -0
  299. package/dist/components/layout/TabList.cjs +2 -0
  300. package/dist/components/layout/TabList.cjs.map +1 -0
  301. package/dist/components/layout/TabList.mjs +239 -0
  302. package/dist/components/layout/TabList.mjs.map +1 -0
  303. package/dist/components/layout/Tree.cjs +2 -0
  304. package/dist/components/layout/Tree.cjs.map +1 -0
  305. package/dist/components/layout/Tree.context.cjs +2 -0
  306. package/dist/components/layout/Tree.context.cjs.map +1 -0
  307. package/dist/components/layout/Tree.context.mjs +33 -0
  308. package/dist/components/layout/Tree.context.mjs.map +1 -0
  309. package/dist/components/layout/Tree.core.cjs +2 -0
  310. package/dist/components/layout/Tree.core.cjs.map +1 -0
  311. package/dist/components/layout/Tree.core.mjs +416 -0
  312. package/dist/components/layout/Tree.core.mjs.map +1 -0
  313. package/dist/components/layout/Tree.itemPersonaLayout.cjs +2 -0
  314. package/dist/components/layout/Tree.itemPersonaLayout.cjs.map +1 -0
  315. package/dist/components/layout/Tree.itemPersonaLayout.mjs +46 -0
  316. package/dist/components/layout/Tree.itemPersonaLayout.mjs.map +1 -0
  317. package/dist/components/layout/Tree.mjs +12 -0
  318. package/dist/components/layout/Tree.mjs.map +1 -0
  319. package/dist/components/layout/Tree.selection.cjs +2 -0
  320. package/dist/components/layout/Tree.selection.cjs.map +1 -0
  321. package/dist/components/layout/Tree.selection.mjs +73 -0
  322. package/dist/components/layout/Tree.selection.mjs.map +1 -0
  323. package/dist/components/layout/disclosureIds.cjs +2 -0
  324. package/dist/components/layout/disclosureIds.cjs.map +1 -0
  325. package/dist/components/layout/disclosureIds.mjs +12 -0
  326. package/dist/components/layout/disclosureIds.mjs.map +1 -0
  327. package/dist/components/motion/Presence.cjs +2 -0
  328. package/dist/components/motion/Presence.cjs.map +1 -0
  329. package/dist/components/motion/Presence.mjs +35 -0
  330. package/dist/components/motion/Presence.mjs.map +1 -0
  331. package/dist/components/navigation/Breadcrumb.cjs +2 -0
  332. package/dist/components/navigation/Breadcrumb.cjs.map +1 -0
  333. package/dist/components/navigation/Breadcrumb.mjs +145 -0
  334. package/dist/components/navigation/Breadcrumb.mjs.map +1 -0
  335. package/dist/components/navigation/Menu.cjs +2 -0
  336. package/dist/components/navigation/Menu.cjs.map +1 -0
  337. package/dist/components/navigation/Menu.context.cjs +2 -0
  338. package/dist/components/navigation/Menu.context.cjs.map +1 -0
  339. package/dist/components/navigation/Menu.context.mjs +82 -0
  340. package/dist/components/navigation/Menu.context.mjs.map +1 -0
  341. package/dist/components/navigation/Menu.group.cjs +2 -0
  342. package/dist/components/navigation/Menu.group.cjs.map +1 -0
  343. package/dist/components/navigation/Menu.group.mjs +60 -0
  344. package/dist/components/navigation/Menu.group.mjs.map +1 -0
  345. package/dist/components/navigation/Menu.items.cjs +2 -0
  346. package/dist/components/navigation/Menu.items.cjs.map +1 -0
  347. package/dist/components/navigation/Menu.items.mjs +133 -0
  348. package/dist/components/navigation/Menu.items.mjs.map +1 -0
  349. package/dist/components/navigation/Menu.link.cjs +2 -0
  350. package/dist/components/navigation/Menu.link.cjs.map +1 -0
  351. package/dist/components/navigation/Menu.link.mjs +47 -0
  352. package/dist/components/navigation/Menu.link.mjs.map +1 -0
  353. package/dist/components/navigation/Menu.mjs +27 -0
  354. package/dist/components/navigation/Menu.mjs.map +1 -0
  355. package/dist/components/navigation/Menu.popover.cjs +2 -0
  356. package/dist/components/navigation/Menu.popover.cjs.map +1 -0
  357. package/dist/components/navigation/Menu.popover.mjs +232 -0
  358. package/dist/components/navigation/Menu.popover.mjs.map +1 -0
  359. package/dist/components/navigation/Menu.root.cjs +2 -0
  360. package/dist/components/navigation/Menu.root.cjs.map +1 -0
  361. package/dist/components/navigation/Menu.root.mjs +309 -0
  362. package/dist/components/navigation/Menu.root.mjs.map +1 -0
  363. package/dist/components/navigation/Menu.selectable.cjs +2 -0
  364. package/dist/components/navigation/Menu.selectable.cjs.map +1 -0
  365. package/dist/components/navigation/Menu.selectable.mjs +111 -0
  366. package/dist/components/navigation/Menu.selectable.mjs.map +1 -0
  367. package/dist/components/navigation/Menu.shared.cjs +2 -0
  368. package/dist/components/navigation/Menu.shared.cjs.map +1 -0
  369. package/dist/components/navigation/Menu.shared.mjs +23 -0
  370. package/dist/components/navigation/Menu.shared.mjs.map +1 -0
  371. package/dist/components/navigation/Menu.splitGroup.cjs +2 -0
  372. package/dist/components/navigation/Menu.splitGroup.cjs.map +1 -0
  373. package/dist/components/navigation/Menu.splitGroup.mjs +52 -0
  374. package/dist/components/navigation/Menu.splitGroup.mjs.map +1 -0
  375. package/dist/components/navigation/Menu.trigger.cjs +2 -0
  376. package/dist/components/navigation/Menu.trigger.cjs.map +1 -0
  377. package/dist/components/navigation/Menu.trigger.mjs +79 -0
  378. package/dist/components/navigation/Menu.trigger.mjs.map +1 -0
  379. package/dist/components/navigation/Nav.cjs +2 -0
  380. package/dist/components/navigation/Nav.cjs.map +1 -0
  381. package/dist/components/navigation/Nav.mjs +291 -0
  382. package/dist/components/navigation/Nav.mjs.map +1 -0
  383. package/dist/components/navigation/Pagination.cjs +2 -0
  384. package/dist/components/navigation/Pagination.cjs.map +1 -0
  385. package/dist/components/navigation/Pagination.mjs +118 -0
  386. package/dist/components/navigation/Pagination.mjs.map +1 -0
  387. package/dist/components/navigation/Stepper.cjs +2 -0
  388. package/dist/components/navigation/Stepper.cjs.map +1 -0
  389. package/dist/components/navigation/Stepper.mjs +205 -0
  390. package/dist/components/navigation/Stepper.mjs.map +1 -0
  391. package/dist/components/overlays/Dialog.cjs +2 -0
  392. package/dist/components/overlays/Dialog.cjs.map +1 -0
  393. package/dist/components/overlays/Dialog.mjs +181 -0
  394. package/dist/components/overlays/Dialog.mjs.map +1 -0
  395. package/dist/components/overlays/Dialog.shared.cjs +2 -0
  396. package/dist/components/overlays/Dialog.shared.cjs.map +1 -0
  397. package/dist/components/overlays/Dialog.shared.mjs +227 -0
  398. package/dist/components/overlays/Dialog.shared.mjs.map +1 -0
  399. package/dist/components/overlays/Drawer.cjs +2 -0
  400. package/dist/components/overlays/Drawer.cjs.map +1 -0
  401. package/dist/components/overlays/Drawer.mjs +193 -0
  402. package/dist/components/overlays/Drawer.mjs.map +1 -0
  403. package/dist/components/overlays/Popover.cjs +2 -0
  404. package/dist/components/overlays/Popover.cjs.map +1 -0
  405. package/dist/components/overlays/Popover.mjs +367 -0
  406. package/dist/components/overlays/Popover.mjs.map +1 -0
  407. package/dist/components/overlays/Popover.shared.cjs +2 -0
  408. package/dist/components/overlays/Popover.shared.cjs.map +1 -0
  409. package/dist/components/overlays/Popover.shared.mjs +182 -0
  410. package/dist/components/overlays/Popover.shared.mjs.map +1 -0
  411. package/dist/components/overlays/TeachingPopover.cjs +2 -0
  412. package/dist/components/overlays/TeachingPopover.cjs.map +1 -0
  413. package/dist/components/overlays/TeachingPopover.mjs +185 -0
  414. package/dist/components/overlays/TeachingPopover.mjs.map +1 -0
  415. package/dist/components/overlays/Tooltip.cjs +2 -0
  416. package/dist/components/overlays/Tooltip.cjs.map +1 -0
  417. package/dist/components/overlays/Tooltip.mjs +161 -0
  418. package/dist/components/overlays/Tooltip.mjs.map +1 -0
  419. package/dist/components/portal/Portal.cjs +2 -0
  420. package/dist/components/portal/Portal.cjs.map +1 -0
  421. package/dist/components/portal/Portal.mjs +46 -0
  422. package/dist/components/portal/Portal.mjs.map +1 -0
  423. package/dist/components/provider/WaveProvider.cjs +2 -0
  424. package/dist/components/provider/WaveProvider.cjs.map +1 -0
  425. package/dist/components/provider/WaveProvider.mjs +52 -0
  426. package/dist/components/provider/WaveProvider.mjs.map +1 -0
  427. package/dist/components/table/DataGrid.cjs +2 -0
  428. package/dist/components/table/DataGrid.cjs.map +1 -0
  429. package/dist/components/table/DataGrid.mjs +490 -0
  430. package/dist/components/table/DataGrid.mjs.map +1 -0
  431. package/dist/components/table/Table.cjs +2 -0
  432. package/dist/components/table/Table.cjs.map +1 -0
  433. package/dist/components/table/Table.mjs +100 -0
  434. package/dist/components/table/Table.mjs.map +1 -0
  435. package/dist/components/table/useGridNavigation.cjs +2 -0
  436. package/dist/components/table/useGridNavigation.cjs.map +1 -0
  437. package/dist/components/table/useGridNavigation.mjs +336 -0
  438. package/dist/components/table/useGridNavigation.mjs.map +1 -0
  439. package/dist/components/typography/Text.cjs +2 -0
  440. package/dist/components/typography/Text.cjs.map +1 -0
  441. package/dist/components/typography/Text.mjs +39 -0
  442. package/dist/components/typography/Text.mjs.map +1 -0
  443. package/dist/hooks/useAnnounce.cjs +2 -0
  444. package/dist/hooks/useAnnounce.cjs.map +1 -0
  445. package/dist/hooks/useAnnounce.mjs +88 -0
  446. package/dist/hooks/useAnnounce.mjs.map +1 -0
  447. package/dist/hooks/useCheckedValues.cjs +2 -0
  448. package/dist/hooks/useCheckedValues.cjs.map +1 -0
  449. package/dist/hooks/useCheckedValues.mjs +102 -0
  450. package/dist/hooks/useCheckedValues.mjs.map +1 -0
  451. package/dist/hooks/useContextMenuAnchor.cjs +2 -0
  452. package/dist/hooks/useContextMenuAnchor.cjs.map +1 -0
  453. package/dist/hooks/useContextMenuAnchor.mjs +132 -0
  454. package/dist/hooks/useContextMenuAnchor.mjs.map +1 -0
  455. package/dist/hooks/useControllable.cjs +2 -0
  456. package/dist/hooks/useControllable.cjs.map +1 -0
  457. package/dist/hooks/useControllable.mjs +37 -0
  458. package/dist/hooks/useControllable.mjs.map +1 -0
  459. package/dist/hooks/useDirection.cjs +2 -0
  460. package/dist/hooks/useDirection.cjs.map +1 -0
  461. package/dist/hooks/useDirection.mjs +57 -0
  462. package/dist/hooks/useDirection.mjs.map +1 -0
  463. package/dist/hooks/useDismiss.cjs +2 -0
  464. package/dist/hooks/useDismiss.cjs.map +1 -0
  465. package/dist/hooks/useDismiss.mjs +57 -0
  466. package/dist/hooks/useDismiss.mjs.map +1 -0
  467. package/dist/hooks/useEventCallback.cjs +2 -0
  468. package/dist/hooks/useEventCallback.cjs.map +1 -0
  469. package/dist/hooks/useEventCallback.mjs +16 -0
  470. package/dist/hooks/useEventCallback.mjs.map +1 -0
  471. package/dist/hooks/useFieldControl.cjs +2 -0
  472. package/dist/hooks/useFieldControl.cjs.map +1 -0
  473. package/dist/hooks/useFieldControl.mjs +62 -0
  474. package/dist/hooks/useFieldControl.mjs.map +1 -0
  475. package/dist/hooks/useFocusTrap.cjs +2 -0
  476. package/dist/hooks/useFocusTrap.cjs.map +1 -0
  477. package/dist/hooks/useFocusTrap.mjs +266 -0
  478. package/dist/hooks/useFocusTrap.mjs.map +1 -0
  479. package/dist/hooks/useFormReset.cjs +2 -0
  480. package/dist/hooks/useFormReset.cjs.map +1 -0
  481. package/dist/hooks/useFormReset.mjs +33 -0
  482. package/dist/hooks/useFormReset.mjs.map +1 -0
  483. package/dist/hooks/useHoverIntent.cjs +2 -0
  484. package/dist/hooks/useHoverIntent.cjs.map +1 -0
  485. package/dist/hooks/useHoverIntent.mjs +201 -0
  486. package/dist/hooks/useHoverIntent.mjs.map +1 -0
  487. package/dist/hooks/useId.cjs +2 -0
  488. package/dist/hooks/useId.cjs.map +1 -0
  489. package/dist/hooks/useId.mjs +11 -0
  490. package/dist/hooks/useId.mjs.map +1 -0
  491. package/dist/hooks/useIsClient.cjs +2 -0
  492. package/dist/hooks/useIsClient.cjs.map +1 -0
  493. package/dist/hooks/useIsClient.mjs +19 -0
  494. package/dist/hooks/useIsClient.mjs.map +1 -0
  495. package/dist/hooks/useListbox.cjs +2 -0
  496. package/dist/hooks/useListbox.cjs.map +1 -0
  497. package/dist/hooks/useListbox.mjs +492 -0
  498. package/dist/hooks/useListbox.mjs.map +1 -0
  499. package/dist/hooks/useMediaQuery.cjs +2 -0
  500. package/dist/hooks/useMediaQuery.cjs.map +1 -0
  501. package/dist/hooks/useMediaQuery.mjs +20 -0
  502. package/dist/hooks/useMediaQuery.mjs.map +1 -0
  503. package/dist/hooks/useMergedRefs.cjs +2 -0
  504. package/dist/hooks/useMergedRefs.cjs.map +1 -0
  505. package/dist/hooks/useMergedRefs.mjs +57 -0
  506. package/dist/hooks/useMergedRefs.mjs.map +1 -0
  507. package/dist/hooks/useModalIsolation.cjs +2 -0
  508. package/dist/hooks/useModalIsolation.cjs.map +1 -0
  509. package/dist/hooks/useModalIsolation.mjs +87 -0
  510. package/dist/hooks/useModalIsolation.mjs.map +1 -0
  511. package/dist/hooks/useModalLayer.cjs +2 -0
  512. package/dist/hooks/useModalLayer.cjs.map +1 -0
  513. package/dist/hooks/useModalLayer.mjs +30 -0
  514. package/dist/hooks/useModalLayer.mjs.map +1 -0
  515. package/dist/hooks/usePopupPosition.cjs +2 -0
  516. package/dist/hooks/usePopupPosition.cjs.map +1 -0
  517. package/dist/hooks/usePopupPosition.mjs +117 -0
  518. package/dist/hooks/usePopupPosition.mjs.map +1 -0
  519. package/dist/hooks/usePrefersReducedMotion.cjs +2 -0
  520. package/dist/hooks/usePrefersReducedMotion.cjs.map +1 -0
  521. package/dist/hooks/usePrefersReducedMotion.mjs +10 -0
  522. package/dist/hooks/usePrefersReducedMotion.mjs.map +1 -0
  523. package/dist/hooks/usePresence.cjs +2 -0
  524. package/dist/hooks/usePresence.cjs.map +1 -0
  525. package/dist/hooks/usePresence.mjs +136 -0
  526. package/dist/hooks/usePresence.mjs.map +1 -0
  527. package/dist/hooks/usePreserveFocus.cjs +2 -0
  528. package/dist/hooks/usePreserveFocus.cjs.map +1 -0
  529. package/dist/hooks/usePreserveFocus.mjs +50 -0
  530. package/dist/hooks/usePreserveFocus.mjs.map +1 -0
  531. package/dist/hooks/useRestoreFocus.cjs +2 -0
  532. package/dist/hooks/useRestoreFocus.cjs.map +1 -0
  533. package/dist/hooks/useRestoreFocus.mjs +271 -0
  534. package/dist/hooks/useRestoreFocus.mjs.map +1 -0
  535. package/dist/hooks/useRovingTabIndex.cjs +2 -0
  536. package/dist/hooks/useRovingTabIndex.cjs.map +1 -0
  537. package/dist/hooks/useRovingTabIndex.mjs +389 -0
  538. package/dist/hooks/useRovingTabIndex.mjs.map +1 -0
  539. package/dist/hooks/useScrollLock.cjs +2 -0
  540. package/dist/hooks/useScrollLock.cjs.map +1 -0
  541. package/dist/hooks/useScrollLock.mjs +71 -0
  542. package/dist/hooks/useScrollLock.mjs.map +1 -0
  543. package/dist/hooks/useTriggerElement.cjs +2 -0
  544. package/dist/hooks/useTriggerElement.cjs.map +1 -0
  545. package/dist/hooks/useTriggerElement.mjs +126 -0
  546. package/dist/hooks/useTriggerElement.mjs.map +1 -0
  547. package/dist/hooks/useTypeahead.cjs +2 -0
  548. package/dist/hooks/useTypeahead.cjs.map +1 -0
  549. package/dist/hooks/useTypeahead.mjs +38 -0
  550. package/dist/hooks/useTypeahead.mjs.map +1 -0
  551. package/dist/index.cjs +1 -1
  552. package/dist/index.d.cts +11086 -0
  553. package/dist/index.d.ts +10405 -1757
  554. package/dist/index.mjs +103 -5695
  555. package/dist/lib/aria.cjs +2 -0
  556. package/dist/lib/aria.cjs.map +1 -0
  557. package/dist/lib/aria.mjs +29 -0
  558. package/dist/lib/aria.mjs.map +1 -0
  559. package/dist/lib/children.cjs +2 -0
  560. package/dist/lib/children.cjs.map +1 -0
  561. package/dist/lib/children.mjs +37 -0
  562. package/dist/lib/children.mjs.map +1 -0
  563. package/dist/lib/classNames.cjs +2 -0
  564. package/dist/lib/classNames.cjs.map +1 -0
  565. package/dist/lib/classNames.mjs +415 -0
  566. package/dist/lib/classNames.mjs.map +1 -0
  567. package/dist/lib/cn.cjs +2 -0
  568. package/dist/lib/cn.cjs.map +1 -0
  569. package/dist/lib/cn.mjs +64 -0
  570. package/dist/lib/cn.mjs.map +1 -0
  571. package/dist/lib/color.cjs +2 -0
  572. package/dist/lib/color.cjs.map +1 -0
  573. package/dist/lib/color.mjs +86 -0
  574. package/dist/lib/color.mjs.map +1 -0
  575. package/dist/lib/composeEventHandlers.cjs +2 -0
  576. package/dist/lib/composeEventHandlers.cjs.map +1 -0
  577. package/dist/lib/composeEventHandlers.mjs +11 -0
  578. package/dist/lib/composeEventHandlers.mjs.map +1 -0
  579. package/dist/lib/dev.cjs +2 -0
  580. package/dist/lib/dev.cjs.map +1 -0
  581. package/dist/lib/dev.mjs +42 -0
  582. package/dist/lib/dev.mjs.map +1 -0
  583. package/dist/lib/direction.cjs +2 -0
  584. package/dist/lib/direction.cjs.map +1 -0
  585. package/dist/lib/direction.mjs +35 -0
  586. package/dist/lib/direction.mjs.map +1 -0
  587. package/dist/lib/events.cjs +2 -0
  588. package/dist/lib/events.cjs.map +1 -0
  589. package/dist/lib/events.mjs +31 -0
  590. package/dist/lib/events.mjs.map +1 -0
  591. package/dist/lib/focus.cjs +2 -0
  592. package/dist/lib/focus.cjs.map +1 -0
  593. package/dist/lib/focus.mjs +119 -0
  594. package/dist/lib/focus.mjs.map +1 -0
  595. package/dist/lib/globalRegistry.cjs +2 -0
  596. package/dist/lib/globalRegistry.cjs.map +1 -0
  597. package/dist/lib/globalRegistry.mjs +13 -0
  598. package/dist/lib/globalRegistry.mjs.map +1 -0
  599. package/dist/lib/icons.cjs +2 -0
  600. package/dist/lib/icons.cjs.map +1 -0
  601. package/dist/lib/icons.mjs +254 -0
  602. package/dist/lib/icons.mjs.map +1 -0
  603. package/dist/lib/labelInName.cjs +2 -0
  604. package/dist/lib/labelInName.cjs.map +1 -0
  605. package/dist/lib/labelInName.mjs +54 -0
  606. package/dist/lib/labelInName.mjs.map +1 -0
  607. package/dist/lib/layers.cjs +2 -0
  608. package/dist/lib/layers.cjs.map +1 -0
  609. package/dist/lib/layers.mjs +224 -0
  610. package/dist/lib/layers.mjs.map +1 -0
  611. package/dist/lib/mergeProps.cjs +2 -0
  612. package/dist/lib/mergeProps.cjs.map +1 -0
  613. package/dist/lib/mergeProps.mjs +21 -0
  614. package/dist/lib/mergeProps.mjs.map +1 -0
  615. package/dist/lib/mergeRefs.cjs +2 -0
  616. package/dist/lib/mergeRefs.cjs.map +1 -0
  617. package/dist/lib/mergeRefs.mjs +29 -0
  618. package/dist/lib/mergeRefs.mjs.map +1 -0
  619. package/dist/lib/renderTrigger.cjs +2 -0
  620. package/dist/lib/renderTrigger.cjs.map +1 -0
  621. package/dist/lib/renderTrigger.mjs +29 -0
  622. package/dist/lib/renderTrigger.mjs.map +1 -0
  623. package/dist/lib/slot.cjs +2 -0
  624. package/dist/lib/slot.cjs.map +1 -0
  625. package/dist/lib/slot.mjs +122 -0
  626. package/dist/lib/slot.mjs.map +1 -0
  627. package/dist/lib/styles.cjs +2 -0
  628. package/dist/lib/styles.cjs.map +1 -0
  629. package/dist/lib/styles.mjs +16 -0
  630. package/dist/lib/styles.mjs.map +1 -0
  631. package/dist/lib/theme.cjs +2 -0
  632. package/dist/lib/theme.cjs.map +1 -0
  633. package/dist/lib/theme.mjs +16 -0
  634. package/dist/lib/theme.mjs.map +1 -0
  635. package/dist/lib/toaster.cjs +2 -0
  636. package/dist/lib/toaster.cjs.map +1 -0
  637. package/dist/lib/toaster.mjs +77 -0
  638. package/dist/lib/toaster.mjs.map +1 -0
  639. package/dist/preflight.css +2 -0
  640. package/dist/styles.css +2 -0
  641. package/package.json +149 -100
  642. package/src/styles/animations.css +7 -39
  643. package/src/styles/base.css +103 -0
  644. package/src/styles/globals.css +10 -22
  645. package/src/styles/legacy-tokens.css +184 -0
  646. package/src/styles/preflight.css +7 -0
  647. package/src/styles/styles.css +32 -0
  648. package/src/styles/tailwind.css +17 -0
  649. package/src/styles/tokens.css +561 -221
  650. package/src/styles/variants.css +29 -0
@@ -0,0 +1 @@
1
+ {"version":3,"file":"dateUtils.mjs","names":["makeDate","date","year","monthIndex","day","startOfDay","startOfMonth","daysInMonth","addDays","amount","addMonths","target","isSameDay","a","b","isSameMonth","isDateInRange","min","max","clampDate","getCalendarDays","first","viewMonth","offset","firstDayOfWeek","days","i","pad","value","length","formatISODate","fromFields","month","parseISODate","match","text","isValidLocaleTag","locale","DEFAULT_DATE_OPTIONS","GRID_CALENDARS","calendarCache","getCalendar","key","calendar","resolved","formatterCache","getFormatter","options","formatter","withCalendar","BIDI_MARKS","infoCache","SAMPLE_DATE","toAsciiDigits","out","char","digits","getLocaleInfo","cached","numberFormat","parts","order","literals","pattern","yearOffset","yearLength","part","info","getLocaleDateFormat","formatDate","digitGroups","normalized","groups","parseDate","iso","values","field","roundTrip","group","getWeekdayNames","short","long","formatMonthYear","formatDayLabel","numberFormatCache","formatDayNumber","TIME_24H","TIME_12H","timeToMinutes","twelve","hours","minutes","seconds","pm","minutesToValue","minutesToTime","format","period","normalizeTimeStep","step","generateTimeOptions","increment","minTime","maxTime"],"sources":["../../../src/components/input/dateUtils.ts"],"sourcesContent":["/**\n * Date and time helpers shared by `DatePicker` and `TimePicker` (spec §5.6).\n *\n * - Every date these helpers return is a **local-midnight** `Date` (the start of a calendar day in\n * the runtime's time zone). Comparisons are by calendar day, never by time of day.\n * - The default display format is `Intl.DateTimeFormat(locale, { year: 'numeric', month:\n * '2-digit', day: '2-digit' })`, and {@link parseDate} is its exact inverse for the same\n * `locale` (field order from `formatToParts`), so a formatted date always parses back to the\n * same day. ISO `yyyy-mm-dd` text is accepted too.\n * - Every formatter uses the locale's calendar only when it has the Gregorian months and days of\n * the grid (Gregorian, or the Buddhist calendar of `th-TH`, whose years are offset); any other\n * calendar (the Persian default of `fa-IR`, `-u-ca-islamic`, Japanese eras) is replaced by the\n * Gregorian one, so the text, the heading and the day labels name the day the grid shows.\n * - Pass an explicit `locale` when rendering on the server: the runtime default locale of the\n * server and the browser may differ, which would change the formatted text between them.\n *\n * Internal module (not exported from the package).\n */\n\n/* ------------------------------------------------------------------ */\n/* Day arithmetic */\n/* ------------------------------------------------------------------ */\n\n/**\n * Builds a local-midnight date without the `new Date(y, …)` two-digit-year mapping (years 0–99\n * would otherwise become 1900–1999).\n */\nfunction makeDate(year: number, monthIndex: number, day: number): Date {\n const date = new Date(2000, 0, 1);\n date.setFullYear(year, monthIndex, day);\n date.setHours(0, 0, 0, 0);\n return date;\n}\n\n/** The start (local midnight) of `date`'s calendar day, as a new `Date`. */\nexport function startOfDay(date: Date): Date {\n return makeDate(date.getFullYear(), date.getMonth(), date.getDate());\n}\n\n/** The first day (local midnight) of `date`'s month. */\nexport function startOfMonth(date: Date): Date {\n return makeDate(date.getFullYear(), date.getMonth(), 1);\n}\n\n/** The number of days in the given month (`monthIndex` may be out of range; it is normalized). */\nfunction daysInMonth(year: number, monthIndex: number): number {\n return makeDate(year, monthIndex + 1, 0).getDate();\n}\n\n/** `date` plus `amount` calendar days, at local midnight (month/year boundaries included). */\nexport function addDays(date: Date, amount: number): Date {\n return makeDate(date.getFullYear(), date.getMonth(), date.getDate() + amount);\n}\n\n/**\n * `date` plus `amount` months, at local midnight. The day is clamped to the length of the target\n * month, so Jan 31 + 1 month is Feb 28 (29 in a leap year) and Mar 31 − 1 month is Feb 28/29 —\n * never a day of the following month.\n */\nexport function addMonths(date: Date, amount: number): Date {\n const target = makeDate(date.getFullYear(), date.getMonth() + amount, 1);\n const day = Math.min(date.getDate(), daysInMonth(target.getFullYear(), target.getMonth()));\n return makeDate(target.getFullYear(), target.getMonth(), day);\n}\n\n/** Whether both dates are on the same calendar day. `false` when either is missing. */\nexport function isSameDay(a: Date | null | undefined, b: Date | null | undefined): boolean {\n return (\n !!a &&\n !!b &&\n a.getFullYear() === b.getFullYear() &&\n a.getMonth() === b.getMonth() &&\n a.getDate() === b.getDate()\n );\n}\n\n/** Whether both dates are in the same month of the same year. */\nexport function isSameMonth(a: Date, b: Date): boolean {\n return a.getFullYear() === b.getFullYear() && a.getMonth() === b.getMonth();\n}\n\n/**\n * Whether `date`'s day lies within `[min, max]`, comparing calendar days (a `max` with a time of\n * day still includes that whole day). Missing bounds are open.\n */\nexport function isDateInRange(date: Date, min?: Date | null, max?: Date | null): boolean {\n const day = startOfDay(date).getTime();\n if (min && day < startOfDay(min).getTime()) return false;\n if (max && day > startOfDay(max).getTime()) return false;\n return true;\n}\n\n/** `date`'s day clamped into `[min, max]` (calendar days), at local midnight. */\nexport function clampDate(date: Date, min?: Date | null, max?: Date | null): Date {\n const day = startOfDay(date);\n if (min && day.getTime() < startOfDay(min).getTime()) return startOfDay(min);\n if (max && day.getTime() > startOfDay(max).getTime()) return startOfDay(max);\n return day;\n}\n\n/**\n * The 42 days (6 weeks) of the calendar grid showing `viewMonth`'s month: the first row starts on\n * `firstDayOfWeek` (0 = Sunday) on or before the 1st.\n */\nexport function getCalendarDays(viewMonth: Date, firstDayOfWeek: number): Date[] {\n const first = startOfMonth(viewMonth);\n const offset = (first.getDay() - firstDayOfWeek + 7) % 7;\n const days: Date[] = [];\n for (let i = 0; i < 42; i++) days.push(addDays(first, i - offset));\n return days;\n}\n\n/* ------------------------------------------------------------------ */\n/* ISO dates */\n/* ------------------------------------------------------------------ */\n\nfunction pad(value: number, length: number): string {\n return String(value).padStart(length, '0');\n}\n\n/** `yyyy-mm-dd` from the **local** calendar fields (the `HiddenInput` form value). */\nexport function formatISODate(date: Date): string {\n return `${pad(date.getFullYear(), 4)}-${pad(date.getMonth() + 1, 2)}-${pad(date.getDate(), 2)}`;\n}\n\n/** Builds a date from calendar fields; `null` when they do not name a real day. */\nfunction fromFields(year: number, month: number, day: number): Date | null {\n if (!Number.isInteger(year) || year < 1 || year > 9999) return null;\n if (!Number.isInteger(month) || month < 1 || month > 12) return null;\n if (!Number.isInteger(day) || day < 1 || day > daysInMonth(year, month - 1)) return null;\n return makeDate(year, month - 1, day);\n}\n\n/** Parses `yyyy-mm-dd` (surrounding whitespace allowed) to local midnight; `null` otherwise. */\nexport function parseISODate(text: string): Date | null {\n const match = /^(\\d{4})-(\\d{2})-(\\d{2})$/.exec(text.trim());\n if (!match) return null;\n return fromFields(Number(match[1]), Number(match[2]), Number(match[3]));\n}\n\n/* ------------------------------------------------------------------ */\n/* Locale formats */\n/* ------------------------------------------------------------------ */\n\n/** A numeric date field. */\nexport type DateField = 'year' | 'month' | 'day';\n\n/** How a locale writes the default (numeric) date format. */\nexport interface LocaleDateFormat {\n /** The order of the fields, e.g. `['day', 'month', 'year']` for `en-GB`. */\n order: DateField[];\n /** A readable pattern with the locale's own separators, e.g. `DD/MM/YYYY`. */\n pattern: string;\n}\n\n/**\n * Whether `Intl` accepts `locale` as a language tag. Every helper below falls back to the runtime\n * default locale for a tag it rejects (the POSIX `de_DE`, `''`, a typo), so DatePicker warns about\n * one in development.\n */\nexport function isValidLocaleTag(locale: string): boolean {\n try {\n Intl.getCanonicalLocales(locale);\n return true;\n } catch {\n return false;\n }\n}\n\nconst DEFAULT_DATE_OPTIONS: Intl.DateTimeFormatOptions = {\n year: 'numeric',\n month: '2-digit',\n day: '2-digit',\n};\n\n/**\n * Calendars with the Gregorian months and days, which the grid shows (`getCalendarDays`): a locale\n * whose calendar is one of these keeps it. The Buddhist calendar (default of `th-TH`) only numbers\n * the years differently.\n */\nconst GRID_CALENDARS = new Set(['gregory', 'buddhist']);\n\nconst calendarCache = new Map<string, string>();\n\n/**\n * The calendar every date helper formats `locale` in: the locale's own (its default or a `-u-ca-`\n * extension) when it has the Gregorian months and days, else `'gregory'`. So a Persian default\n * (`fa-IR`, `fa-AF`, `ps-AF`), an explicit `-u-ca-islamic` or the Japanese eras never label the\n * Gregorian grid with other months or years, and the text stays parseable; the locale's digits\n * stay. An invalid locale tag uses the runtime default's.\n */\nfunction getCalendar(locale: string | undefined): string {\n const key = locale ?? '';\n let calendar = calendarCache.get(key);\n if (calendar === undefined) {\n let resolved: string;\n try {\n resolved = new Intl.DateTimeFormat(locale).resolvedOptions().calendar;\n } catch {\n resolved = new Intl.DateTimeFormat().resolvedOptions().calendar;\n }\n calendar = GRID_CALENDARS.has(resolved) ? resolved : 'gregory';\n calendarCache.set(key, calendar);\n }\n return calendar;\n}\n\nconst formatterCache = new Map<string, Intl.DateTimeFormat>();\n\n/**\n * A cached `Intl.DateTimeFormat` in the calendar of {@link getCalendar}; an invalid locale tag falls\n * back to the runtime default.\n */\nfunction getFormatter(\n locale: string | undefined,\n options: Intl.DateTimeFormatOptions,\n): Intl.DateTimeFormat {\n const key = `${locale ?? ''}|${JSON.stringify(options)}`;\n let formatter = formatterCache.get(key);\n if (!formatter) {\n const withCalendar = { ...options, calendar: getCalendar(locale) };\n try {\n formatter = new Intl.DateTimeFormat(locale, withCalendar);\n } catch {\n formatter = new Intl.DateTimeFormat(undefined, withCalendar);\n }\n formatterCache.set(key, formatter);\n }\n return formatter;\n}\n\n/** Bidirectional control characters Intl inserts around fields (Arabic, Hebrew locales). */\nconst BIDI_MARKS = /[\\u061c\\u200b-\\u200f\\u202a-\\u202e\\u2066-\\u2069]/g;\n\ninterface LocaleInfo extends LocaleDateFormat {\n /** Non-digit characters of the formatted date (allowed between the typed fields). */\n literals: Set<string>;\n /** Locale digit → ASCII digit (for non-Latin numbering systems). */\n digits: Map<string, string>;\n /** Formatted year minus the Gregorian year (e.g. 543 for the Buddhist calendar). */\n yearOffset: number;\n /** Digit count of a formatted year: shorter typed years are rejected (`25` is not 2025). */\n yearLength: number;\n}\n\nconst infoCache = new Map<string, LocaleInfo>();\nconst SAMPLE_DATE = makeDate(2001, 10, 23); // 23 Nov 2001: every field distinct\n\nfunction toAsciiDigits(text: string, digits: Map<string, string>): string {\n let out = '';\n for (const char of text.replace(BIDI_MARKS, '')) out += digits.get(char) ?? char;\n return out;\n}\n\nfunction getLocaleInfo(locale: string | undefined): LocaleInfo {\n const key = locale ?? '';\n const cached = infoCache.get(key);\n if (cached) return cached;\n\n const digits = new Map<string, string>();\n let numberFormat: Intl.NumberFormat;\n try {\n numberFormat = new Intl.NumberFormat(locale, { useGrouping: false });\n } catch {\n numberFormat = new Intl.NumberFormat(undefined, { useGrouping: false });\n }\n for (let i = 0; i <= 9; i++) digits.set(numberFormat.format(i), String(i));\n\n const parts = getFormatter(locale, DEFAULT_DATE_OPTIONS).formatToParts(SAMPLE_DATE);\n const order: DateField[] = [];\n const literals = new Set<string>();\n let pattern = '';\n let yearOffset = 0;\n let yearLength = 4;\n for (const part of parts) {\n if (part.type === 'day' || part.type === 'month' || part.type === 'year') {\n order.push(part.type);\n if (part.type === 'year') {\n const year = toAsciiDigits(part.value, digits);\n yearLength = year.length;\n yearOffset = Number(year) - SAMPLE_DATE.getFullYear();\n }\n pattern += part.type === 'day' ? 'DD' : part.type === 'month' ? 'MM' : 'YYYY';\n } else {\n const text = part.value.replace(BIDI_MARKS, '');\n pattern += text;\n for (const char of text) literals.add(char);\n }\n }\n const info: LocaleInfo = {\n order,\n pattern: pattern.trim(),\n literals,\n digits,\n yearOffset,\n yearLength,\n };\n infoCache.set(key, info);\n return info;\n}\n\n/**\n * The field order and a readable pattern (`DD/MM/YYYY`, `MM/DD/YYYY`, `DD.MM.YYYY`, …) of the\n * default date format for `locale` (runtime default when omitted).\n */\nexport function getLocaleDateFormat(locale?: string): LocaleDateFormat {\n const { order, pattern } = getLocaleInfo(locale);\n return { order: [...order], pattern };\n}\n\n/**\n * The default DatePicker display text: `Intl.DateTimeFormat(locale, { year: 'numeric', month:\n * '2-digit', day: '2-digit' })` in the grid-compatible calendar of {@link getCalendar} (`fa-IR`:\n * `۲۰۲۵/۰۶/۱۵`, not the Persian `۱۴۰۴/۰۳/۲۵`). {@link parseDate} with the same `locale` reverses it.\n */\nexport function formatDate(date: Date, locale?: string): string {\n return getFormatter(locale, DEFAULT_DATE_OPTIONS).format(date);\n}\n\n/** The numeric fields of `text` in order, or `null` when anything but separators surrounds them. */\nfunction digitGroups(text: string, info: LocaleInfo): string[] | null {\n const normalized = toAsciiDigits(text.trim(), info.digits);\n const groups = normalized.match(/\\d+/g);\n if (!groups) return null;\n for (const char of normalized.replace(/\\d+/g, '')) {\n if (/\\s/.test(char) || info.literals.has(char) || '/.-'.includes(char)) continue;\n return null;\n }\n return groups;\n}\n\n/**\n * Parses text typed in the default display format of `locale` — the exact inverse of\n * {@link formatDate} for the same locale — to local midnight. Also accepts single-digit day/month\n * fields, `/`, `.` and `-` separators, and ISO `yyyy-mm-dd`. Returns `null` for anything else:\n * impossible dates (31/02), a year shorter than the locale writes it (`25`), letters or extra\n * fields.\n */\nexport function parseDate(text: string, locale?: string): Date | null {\n if (!text.trim()) return null;\n const iso = parseISODate(text);\n if (iso) return iso;\n\n const info = getLocaleInfo(locale);\n if (info.order.length !== 3) return null;\n const groups = digitGroups(text, info);\n if (!groups || groups.length !== 3) return null;\n\n const values: Partial<Record<DateField, number>> = {};\n for (let i = 0; i < 3; i++) {\n const field = info.order[i];\n if (field === 'year' && groups[i].length < info.yearLength) return null;\n values[field] = Number(groups[i]);\n }\n const date = fromFields(\n (values.year ?? NaN) - info.yearOffset,\n values.month ?? NaN,\n values.day ?? NaN,\n );\n if (!date) return null;\n\n // Exact inverse: formatting the result must give back the typed numbers (guards calendars\n // whose months or days differ from the Gregorian ones).\n const roundTrip = digitGroups(formatDate(date, locale), info);\n if (!roundTrip || roundTrip.some((group, i) => Number(group) !== Number(groups[i]))) return null;\n return date;\n}\n\n/** The 12 long month names of `locale` (January … December). */\nexport function getMonthNames(locale?: string): string[] {\n const formatter = getFormatter(locale, { month: 'long' });\n return Array.from({ length: 12 }, (_, month) => formatter.format(makeDate(2001, month, 1)));\n}\n\n/** A weekday name in both lengths. */\nexport interface WeekdayName {\n /** Short name for the column header (`Mon`). */\n short: string;\n /** Full name for assistive technology (`Monday`). */\n long: string;\n}\n\n/** The seven weekday names of `locale`, starting at `firstDayOfWeek` (0 = Sunday). */\nexport function getWeekdayNames(locale: string | undefined, firstDayOfWeek = 0): WeekdayName[] {\n const short = getFormatter(locale, { weekday: 'short' });\n const long = getFormatter(locale, { weekday: 'long' });\n // 1 January 2023 was a Sunday.\n return Array.from({ length: 7 }, (_, i) => {\n const day = makeDate(2023, 0, 1 + ((firstDayOfWeek + i) % 7));\n return { short: short.format(day), long: long.format(day) };\n });\n}\n\n/** The calendar heading, e.g. `May 2025` / `Mai 2025`. */\nexport function formatMonthYear(date: Date, locale?: string): string {\n return getFormatter(locale, { month: 'long', year: 'numeric' }).format(date);\n}\n\n/** The accessible name of a day cell, e.g. `Monday, May 26, 2025`. */\nexport function formatDayLabel(date: Date, locale?: string): string {\n return getFormatter(locale, {\n weekday: 'long',\n year: 'numeric',\n month: 'long',\n day: 'numeric',\n }).format(date);\n}\n\nconst numberFormatCache = new Map<string, Intl.NumberFormat>();\n\n/** The day-of-month number in the locale's digits, without suffixes (`3`, not `3日`). */\nexport function formatDayNumber(date: Date, locale?: string): string {\n const key = locale ?? '';\n let formatter = numberFormatCache.get(key);\n if (!formatter) {\n try {\n formatter = new Intl.NumberFormat(locale, { useGrouping: false });\n } catch {\n formatter = new Intl.NumberFormat(undefined, { useGrouping: false });\n }\n numberFormatCache.set(key, formatter);\n }\n return formatter.format(date.getDate());\n}\n\n/* ------------------------------------------------------------------ */\n/* Time */\n/* ------------------------------------------------------------------ */\n\n/** TimePicker label style. */\nexport type TimeFormat = '12h' | '24h';\n\nconst TIME_24H = /^(\\d{1,2}):(\\d{2})(?::(\\d{2}))?$/;\nconst TIME_12H = /^(\\d{1,2}):(\\d{2})(?::(\\d{2}))?\\s*([ap])\\.?\\s*m\\.?$/i;\n\n/**\n * Minutes since midnight of a time string: `HH:mm`, `H:mm`, `HH:mm:ss` (seconds ignored) or a\n * 12-hour time such as `9:00 AM`, `12:30 pm`, `11:59 p.m.`. `NaN` when invalid.\n */\nexport function timeToMinutes(text: string): number {\n const value = text.trim();\n const twelve = TIME_12H.exec(value);\n const match = twelve ?? TIME_24H.exec(value);\n if (!match) return NaN;\n let hours = Number(match[1]);\n const minutes = Number(match[2]);\n const seconds = match[3] === undefined ? 0 : Number(match[3]);\n if (minutes > 59 || seconds > 59) return NaN;\n if (twelve) {\n if (hours < 1 || hours > 12) return NaN;\n const pm = match[4].toLowerCase() === 'p';\n hours = (hours % 12) + (pm ? 12 : 0);\n } else if (hours > 23) {\n return NaN;\n }\n return hours * 60 + minutes;\n}\n\n/** `HH:mm` (24-hour, zero-padded): the TimePicker value format. */\nexport function minutesToValue(minutes: number): string {\n const hours = Math.floor(minutes / 60) % 24;\n return `${pad(hours, 2)}:${pad(minutes % 60, 2)}`;\n}\n\n/** Display text of a time: `13:00` (`'24h'`) or `1:00 PM` (`'12h'`). */\nexport function minutesToTime(minutes: number, format: TimeFormat): string {\n if (format === '24h') return minutesToValue(minutes);\n const hours = Math.floor(minutes / 60) % 24;\n const period = hours >= 12 ? 'PM' : 'AM';\n const hours12 = hours % 12 === 0 ? 12 : hours % 12;\n return `${hours12}:${pad(minutes % 60, 2)} ${period}`;\n}\n\n/** The TimePicker step fallback for invalid values. */\nexport const DEFAULT_TIME_STEP = 30;\n\n/**\n * Guards a TimePicker `step`: a non-finite or non-positive step falls back to\n * {@link DEFAULT_TIME_STEP} (`valid: false`, so the component can report it); fractions are\n * floored to a whole number of minutes, at least 1.\n */\nexport function normalizeTimeStep(step: number): { step: number; valid: boolean } {\n if (!Number.isFinite(step) || step <= 0) return { step: DEFAULT_TIME_STEP, valid: false };\n return { step: Math.max(1, Math.floor(step)), valid: true };\n}\n\n/** One generated TimePicker option. */\nexport interface TimeOption {\n /** `HH:mm`. */\n value: string;\n /** Display text in the requested format. */\n label: string;\n}\n\n/**\n * The options from `minTime` to `maxTime` (inclusive) every `step` minutes. The step is guarded\n * with {@link normalizeTimeStep} (the loop always terminates); invalid or reversed bounds give\n * `[]`.\n */\nexport function generateTimeOptions(\n step: number,\n minTime: string,\n maxTime: string,\n format: TimeFormat,\n): TimeOption[] {\n const increment = normalizeTimeStep(step).step;\n const min = timeToMinutes(minTime);\n const max = timeToMinutes(maxTime);\n if (Number.isNaN(min) || Number.isNaN(max) || min > max) return [];\n const options: TimeOption[] = [];\n for (let minutes = min; minutes <= max; minutes += increment) {\n options.push({ value: minutesToValue(minutes), label: minutesToTime(minutes, format) });\n }\n return options;\n}\n"],"mappings":";;AA2BA,SAASA,EAAS,GAAc,GAAoB,GAAmB;CACrE,IAAMC,IAAO,IAAI,KAAK,KAAM,GAAG,CAAC;CAGhC,OAFAA,EAAK,YAAYC,GAAMC,GAAYC,CAAG,GACtCH,EAAK,SAAS,GAAG,GAAG,GAAG,CAAC,GACjBA;AACT;AAGA,SAAgBI,EAAW,GAAkB;CAC3C,OAAOL,EAASC,EAAK,YAAY,GAAGA,EAAK,SAAS,GAAGA,EAAK,QAAQ,CAAC;AACrE;AAGA,SAAgBK,EAAa,GAAkB;CAC7C,OAAON,EAASC,EAAK,YAAY,GAAGA,EAAK,SAAS,GAAG,CAAC;AACxD;AAGA,SAASM,EAAY,GAAc,GAA4B;CAC7D,OAAOP,EAASE,GAAMC,IAAa,GAAG,CAAC,CAAC,CAAC,QAAQ;AACnD;AAGA,SAAgBK,EAAQ,GAAY,GAAsB;CACxD,OAAOR,EAASC,EAAK,YAAY,GAAGA,EAAK,SAAS,GAAGA,EAAK,QAAQ,IAAIQ,CAAM;AAC9E;AAOA,SAAgBC,EAAU,GAAY,GAAsB;CAC1D,IAAMC,IAASX,EAASC,EAAK,YAAY,GAAGA,EAAK,SAAS,IAAIQ,GAAQ,CAAC,GACjEL,IAAM,KAAK,IAAIH,EAAK,QAAQ,GAAGM,EAAYI,EAAO,YAAY,GAAGA,EAAO,SAAS,CAAC,CAAC;CACzF,OAAOX,EAASW,EAAO,YAAY,GAAGA,EAAO,SAAS,GAAGP,CAAG;AAC9D;AAGA,SAAgBQ,EAAU,GAA4B,GAAqC;CACzF,OACE,CAAC,CAACC,KACF,CAAC,CAACC,KACFD,EAAE,YAAY,MAAMC,EAAE,YAAY,KAClCD,EAAE,SAAS,MAAMC,EAAE,SAAS,KAC5BD,EAA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Q,KAAKC;AACtB;AAGA,SAAgBG,EAAe,GAAyB;CAEtD,OAAO,GAAGnE,EADI,KAAK,MAAMgE,IAAU,EAAE,IAAI,IACpB,CAAC,EAAE,GAAGhE,EAAIgE,IAAU,IAAI,CAAC;AAChD;AAGA,SAAgBI,EAAc,GAAiB,GAA4B;CACzE,IAAIC,MAAW,OAAO,OAAOF,EAAeH,CAAO;CACnD,IAAMD,IAAQ,KAAK,MAAMC,IAAU,EAAE,IAAI,IACnCM,IAASP,KAAS,KAAK,OAAO;CAEpC,OAAO,GADSA,IAAQ,MAAO,IAAI,KAAKA,IAAQ,GAC9B,GAAG/D,EAAIgE,IAAU,IAAI,CAAC,EAAE,GAAGM;AAC/C;AAUA,SAAgBC,EAAkB,GAAgD;CAEhF,OADI,CAAC,OAAO,SAASC,CAAI,KAAKA,KAAQ,IAAU;EAAE,MAAA;EAAyB,OAAO;CAAM,IACjF;EAAE,MAAM,KAAK,IAAI,GAAG,KAAK,MAAMA,CAAI,CAAC;EAAG,OAAO;CAAK;AAC5D;AAeA,SAAgBC,EACd,GACA,GACA,GACA,GACc;CACd,IAAMC,IAAYH,EAAkBC,CAAI,CAAC,CAAC,MACpClF,IAAMuE,EAAcc,CAAO,GAC3BpF,IAAMsE,EAAce,CAAO;CACjC,IAAI,OAAO,MAAMtF,CAAG,KAAK,OAAO,MAAMC,CAAG,KAAKD,IAAMC,GAAK,OAAO,CAAC;CACjE,IAAM6B,IAAwB,CAAC;CAC/B,KAAK,IAAI4C,IAAU1E,GAAK0E,KAAWzE,GAAK,KAAWmF,GACjD,EAAQ,KAAK;EAAE,OAAOP,EAAeH,CAAO;EAAG,OAAOI,EAAcJ,GAASK,CAAM;CAAE,CAAC;CAExF,OAAOjD;AACT"}
@@ -0,0 +1,2 @@
1
+ "use client";var e=`absolute flex h-6 w-6 items-center justify-center rounded bg-transparent p-0 text-muted-foreground not-disabled:not-aria-disabled:hover:bg-subtle-hover not-disabled:not-aria-disabled:hover:text-foreground`;function t(e){return e>=2?`pe-14`:e===1?`pe-8`:void 0}exports.PICKER_ICON_BUTTON_CLASSES=e,exports.pickerEndPadding=t;
2
+ //# sourceMappingURL=pickerStyles.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"pickerStyles.cjs","names":["PICKER_ICON_BUTTON_CLASSES","pickerEndPadding","buttons"],"sources":["../../../src/components/input/pickerStyles.ts"],"sourcesContent":["/**\n * Classes shared by the pickers of the combobox family (Combobox, Dropdown, TimePicker).\n * Component-private: not exported from the package.\n */\n\n/**\n * An icon button at the end of a picker's control (its clear and expand buttons): a 24×24px\n * target that the caller positions (`end-1`, `end-7`) and gives `focusRing` and `disabledStyles`.\n * It sets its own padding and background (C-NATIVE: an app-wide `button` rule would otherwise pad\n * and fill it) and gates its hover colors on the enabled state.\n */\nexport const PICKER_ICON_BUTTON_CLASSES =\n 'absolute flex h-6 w-6 items-center justify-center rounded bg-transparent p-0 text-muted-foreground not-disabled:not-aria-disabled:hover:bg-subtle-hover not-disabled:not-aria-disabled:hover:text-foreground';\n\n/**\n * The end padding that keeps a picker's text clear of the buttons at its end: `pe-8` for one\n * button, `pe-14` for two, nothing without one.\n */\nexport function pickerEndPadding(buttons: number): string | undefined {\n if (buttons >= 2) return 'pe-14';\n return buttons === 1 ? 'pe-8' : undefined;\n}\n"],"mappings":"aAWA,IAAaA,EACX,+MAMF,SAAgBC,EAAiB,EAAqC,CAEpE,OADIC,GAAW,EAAU,QAClBA,IAAY,EAAI,OAAS,IAAA,EAClC"}
@@ -0,0 +1,10 @@
1
+ "use client";
2
+ //#region src/components/input/pickerStyles.ts
3
+ var e = "absolute flex h-6 w-6 items-center justify-center rounded bg-transparent p-0 text-muted-foreground not-disabled:not-aria-disabled:hover:bg-subtle-hover not-disabled:not-aria-disabled:hover:text-foreground";
4
+ function t(e) {
5
+ return e >= 2 ? "pe-14" : e === 1 ? "pe-8" : void 0;
6
+ }
7
+ //#endregion
8
+ export { e as PICKER_ICON_BUTTON_CLASSES, t as pickerEndPadding };
9
+
10
+ //# sourceMappingURL=pickerStyles.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"pickerStyles.mjs","names":["PICKER_ICON_BUTTON_CLASSES","pickerEndPadding","buttons"],"sources":["../../../src/components/input/pickerStyles.ts"],"sourcesContent":["/**\n * Classes shared by the pickers of the combobox family (Combobox, Dropdown, TimePicker).\n * Component-private: not exported from the package.\n */\n\n/**\n * An icon button at the end of a picker's control (its clear and expand buttons): a 24×24px\n * target that the caller positions (`end-1`, `end-7`) and gives `focusRing` and `disabledStyles`.\n * It sets its own padding and background (C-NATIVE: an app-wide `button` rule would otherwise pad\n * and fill it) and gates its hover colors on the enabled state.\n */\nexport const PICKER_ICON_BUTTON_CLASSES =\n 'absolute flex h-6 w-6 items-center justify-center rounded bg-transparent p-0 text-muted-foreground not-disabled:not-aria-disabled:hover:bg-subtle-hover not-disabled:not-aria-disabled:hover:text-foreground';\n\n/**\n * The end padding that keeps a picker's text clear of the buttons at its end: `pe-8` for one\n * button, `pe-14` for two, nothing without one.\n */\nexport function pickerEndPadding(buttons: number): string | undefined {\n if (buttons >= 2) return 'pe-14';\n return buttons === 1 ? 'pe-8' : undefined;\n}\n"],"mappings":";;AAWA,IAAaA,IACX;AAMF,SAAgBC,EAAiB,GAAqC;CAEpE,OADIC,KAAW,IAAU,UAClBA,MAAY,IAAI,SAAS,KAAA;AAClC"}
@@ -0,0 +1,2 @@
1
+ "use client";const e=require("../../_virtual/_rolldown/runtime.cjs"),t=require("../../hooks/useId.cjs"),n=require("../../lib/focus.cjs");require("../../hooks/useFormReset.cjs");let r=require("react");r=e.__toESM(r,1);let i=require("react/jsx-runtime");var a={position:`absolute`,insetInlineStart:0,bottom:0,width:1,height:1,margin:0,padding:0,border:0,opacity:0,pointerEvents:`none`};function o(){}function s(e){let t=e.currentTarget,r=t.parentElement;if(!r)return;let i=e.relatedTarget,a=i instanceof HTMLElement&&i!==t&&r.contains(i)?i:n.getFirstTabbable(r);a&&a!==t&&a.focus()}function c(e){return e==null?null:typeof e==`string`?e:e[0]??null}function l(e){return e==null?[``]:typeof e==`string`?[e]:e}function u(e){let{name:n,form:r,disabled:u,value:d,type:f=`hidden`,checked:p,required:m=!1,onInvalid:h}=e,g=t.useId(`wave-required`);if(!n&&!m)return null;let _=f===`checkbox`||f===`radio`,v=c(d),y=f===`checkbox`?p??!1:p??(v!==null&&v!==``),b=f===`checkbox`?v??`on`:v??``;if(!m){let e=_?y?[b]:[]:l(d);return(0,i.jsx)(i.Fragment,{children:e.map((e,t)=>(0,i.jsx)(`input`,{type:`hidden`,name:n,form:r,disabled:u,value:e,"data-wave-hidden-input":``},`${t}:${e}`))})}let x={form:r,disabled:u,required:!0,"aria-hidden":!0,tabIndex:-1,style:a,onChange:o,onInvalid:h,onFocus:s,"data-wave-hidden-input":``};if(_){let e=n||(f===`radio`&&!y?g:void 0);return(0,i.jsx)(`input`,{...x,type:f,name:e,value:b,checked:y})}let S=l(d);return S.length===0?(0,i.jsx)(`input`,{...x,type:`text`,autoComplete:`off`,value:``}):(0,i.jsx)(i.Fragment,{children:S.map((e,t)=>(0,i.jsx)(`input`,{...x,type:`text`,autoComplete:`off`,name:n,value:e},`${t}:${e}`))})}u.displayName=`HiddenInput`,exports.HiddenInput=u;
2
+ //# sourceMappingURL=HiddenInput.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"HiddenInput.cjs","names":["getFirstTabbable","useId","_Fragment","require_runtime","require_useId","require_focus","react","react_jsx_runtime","REQUIRED_STYLE","noop","redirectFocus","input","event","root","from","target","firstValue","value","valueList","HiddenInput","props","radioGroupName","name","required","choice","type","single","isChecked","checked","choiceValue","values","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":"4PA2CA,IAAMQ,EAAsC,CAC1C,SAAU,WACV,iBAAkB,EAClB,OAAQ,EACR,MAAO,EACP,OAAQ,EACR,OAAQ,EACR,QAAS,EACT,OAAQ,EACR,QAAS,EACT,cAAe,MACjB,EAEA,SAASC,GAAO,CAAC,CAgBjB,SAASC,EAAc,EAA2C,CAChE,IAAMC,EAAQC,EAAM,cACdC,EAAOF,EAAM,cACnB,GAAI,CAACE,EAAM,OACX,IAAMC,EAAOF,EAAM,cACbG,EACJD,aAAgB,aAAeA,I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AAA,IAC7E,OACE,EAAAd,EAAA,IAAA,CAAC,QAAD,CAAO,GAAI0B,EAAc,OAAM,KAAMC,EAAW,MAAOL,EAAa,QAASF,CAAY,CAAA,CAE7F,CAEA,IAAMG,EAASZ,EAAUD,CAAK,EAK9B,OAJIa,EAAO,SAAW,GAEb,EAAAvB,EAAA,IAAA,CAAC,QAAD,CAAO,GAAI0B,EAAQ,KAAK,OAAO,aAAa,MAAM,MAAM,EAAI,CAAA,GAGnE,EAAA1B,EAAA,IAAA,CAAAL,EAAAA,SAAA,CAAA,SACG4B,EAAO,KAAK,EAAG,KACd,EAAAvB,EAAA,IAAA,CAAC,QAAD,CAEE,GAAI0B,EACJ,KAAK,OACL,aAAa,MACP,OACN,MAAOF,CACR,EANM,GAAGC,EAAM,GAAGD,GAMlB,CACF,CACD,CAAA,CAEN,CAEA,EAAY,YAAc"}
@@ -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,S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U;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("../../lib/classNames.cjs"),o=require("../../hooks/useControllable.cjs"),s=require("../../hooks/useId.cjs"),c=require("../../lib/styles.cjs"),l=require("../../lib/icons.cjs"),u=require("./disclosureIds.cjs");let d=require("react");d=e.__toESM(d,1);let f=require("react/jsx-runtime");var p=d.createContext(null),m=d.createContext(null),h=d.createContext(null),g=[],_={openItems:g,toggle:()=>{},registerItem:()=>()=>{},baseId:`wave-accordion-inert`,headingLevel:3},v={value:``,isOpen:!1,triggerId:`wave-accordion-inert-trigger`,panelId:`wave-accordion-inert-panel`,hasPanelContent:!1,headingLevel:3,toggle:()=>{}},y={extra:null,inPanel:!0},b=d.createContext(!1),x=`m-0 grid`;function S(e){return d.useContext(p)||(r.reportMissingContext(e,`<Accordion>`),_)}function C(e){return d.useContext(m)||(r.reportMissingContext(e,`<Accordion.Item>`),v)}function w(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 T(e){if(e!==void 0)return e===null?g:[e]}var E=e=>{let{type:n,openItem:i,defaultOpenItem:c,onOpenItemChange:l,openItems:u,defaultOpenItems:_,onOpenItemsChange:v,headingLevel:y=3,className:x,children:S,ref:C,...E}=e,D=n===`multiple`;D||(u!==void 0&&r.warnDeprecated(`Accordion`,`openItems`,`openItem`,`In single mode the Accordion takes one value.`),_!==void 0&&r.warnDeprecated(`Accordion`,`defaultOpenItems`,`defaultOpenItem`,`In single mode the Accordion takes one value.`),v!==void 0&&r.warnDeprecated(`Accordion`,`onOpenItemsChange`,`onOpenItemChange`,`In single mode the Accordion reports one value.`));let O=D?void 0:i,k=d.useMemo(()=>T(O)??u,[O,u]),[A]=d.useState(()=>(D?void 0:T(c))??_??g),[j,M]=o.useControllable(k,A,e=>{let t=[...e];D||l?.(t[0]??null),v?.(t)}),N=j.length;d.useEffect(()=>{!D&&N>1&&r.warnOnce(`Accordion:single-multiple-open`,`Accordion: type="single" allows one open item, but ${N} are open. Pass \`openItem\`, or use type="multiple".`)},[D,N]);let P=d.useCallback(e=>{M(t=>t.includes(e)?t.filter(t=>t!==e):D?[...t,e]:[e])},[D,M]),F=d.useRef(null),I=d.useCallback(e=>{F.current??=new Map;let t=F.current,n=(t.get(e)??0)+1;return t.set(e,n),n>1&&w(e),()=>{let n=(t.get(e)??1)-1;n>0?t.set(e,n):t.delete(e)}},[]),L=s.useId(`accordion`),R=d.useMemo(()=>({openItems:j,toggle:P,registerItem:I,baseId:L,headingLevel:y}),[j,P,I,L,y]);return(0,f.jsx)(p.Provider,{value:R,children:(0,f.jsx)(m.Provider,{value:null,children:(0,f.jsx)(h.Provider,{value:null,children:(0,f.jsx)(b.Provider,{value:!1,children:(0,f.jsx)(`div`,{ref:C,className:t.cn(a.accordionClassNames.root,`divide-y divide-border`,x),...E,children:S})})})})})};E.displayName=`Accordion`;function D(e,t,r){if(Array.isArray(e)){for(let n of e){let e=D(n,t,r);if(e)return e}return}if(!d.isValidElement(e))return;let i=n.getElementType(e,{suspend:!1});if(i===t)return e;if(i!==r&&i!==E&&i!==j)return D(e.props.children,t,r)}function O(e){let t=e?.props.id;return typeof t==`string`&&t!==``?t:void 0}function k(e){if(!d.isValidElement(e))return!1;let t=n.getElementType(e,{suspend:!1});if(typeof t==`string`||t===M||t===N||t===E||t===j)return!1;let r=e.props.children;return n.getElementType(r,{suspend:!1})===M||k(r)}function A(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 j=({value:e,headingLevel:r,className:i,children:o,ref:s,...c})=>{let l=S(`Accordion.Item`),p=l.openItems.includes(e),{toggle:g,baseId:_,registerItem:v}=l;d.useEffect(()=>v(e),[v,e]);let y=r??l.headingLevel,C=`h${y}`,w,T,E=[],A=[];for(let{key:e,node:r}of n.flattenChildren(o)){let n=(0,f.jsx)(d.Fragment,{children:r},e),i=D(r,M,N),o=D(r,N,M);i||o?(w??=i,T??=o,E.push(k(r)?(0,f.jsx)(C,{className:t.cn(a.accordionTriggerClassNames.heading,x),children:(0,f.jsx)(b.Provider,{value:!0,children:r})},e):n)):A.push(n)}let j=w!==void 0,P=T!==void 0,F=O(w),I=O(T),L=P||A.length>0,R=P&&A.length>0?A:null,z=d.useMemo(()=>({value:e,isOpen:p,triggerId:F??u.getPartId(_,`trigger`,e),panelId:I??u.getPartId(_,`panel`,e),hasPanelContent:L,headingLevel:y,toggle:()=>g(e)}),[e,p,_,F,I,L,y,g]),B=d.useMemo(()=>({extra:R,inPanel:!1}),[R]);return(0,f.jsx)(m.Provider,{value:z,children:(0,f.jsx)(h.Provider,{value:B,children:(0,f.jsxs)(`div`,{ref:s,"data-state":p?`open`:`closed`,className:t.cn(a.accordionItemClassNames.root,i),...c,children:[j?null:(0,f.jsx)(M,{children:e}),E,!P&&A.length>0?(0,f.jsx)(N,{children:A}):null]})})})};j.displayName=`AccordionItem`;var M=({id:e,className:n,children:o,onClick:s,ref:u,...p})=>{let m=C(`Accordion.Trigger`),g=d.useContext(h)?.inPanel??!1;d.useEffect(()=>{g&&r.warnOnce(`Accordion.Trigger:inside-panel`,A(`Accordion.Trigger`))},[g]);let _=d.useContext(b),v=`h${m.headingLevel}`,y=m.isOpen?`open`:`closed`,S=(0,f.jsxs)(`button`,{type:`button`,className:t.cn(a.accordionTriggerClassNames.root,`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`,c.disabledStyles,c.focusRingInset,n),...p,id:e||(g?void 0:m.triggerId),"aria-controls":!g&&m.hasPanelContent?m.panelId:void 0,"aria-expanded":m.isOpen,"data-state":y,onClick:i.composeEventHandlers(s,m.toggle),ref:u,children:[o,(0,f.jsx)(l.ChevronDownIcon,{size:16,className:t.cn(a.accordionTriggerClassNames.expandIcon,`shrink-0 transition-transform motion-reduce:transition-none`,m.isOpen&&`rotate-180`)})]});return _?S:(0,f.jsx)(v,{className:t.cn(a.accordionTriggerClassNames.heading,x),children:S})};M.displayName=`AccordionTrigger`;var N=({id:e,className:n,children:i,ref:o,...s})=>{let c=C(`Accordion.Panel`),l=d.useContext(h),u=l?.inPanel??!1;return d.useEffect(()=>{u&&r.warnOnce(`Accordion.Panel:inside-panel`,A(`Accordion.Panel`))},[u]),c.isOpen?u?(0,f.jsx)(`div`,{className:t.cn(a.accordionPanelClassNames.root,n),...s,id:e||void 0,ref:o,children:i}):(0,f.jsx)(h.Provider,{value:y,children:(0,f.jsxs)(`div`,{role:`region`,className:t.cn(a.accordionPanelClassNames.root,`px-4 pb-3 text-body-1 text-muted-foreground`,n),...s,id:e||c.panelId,"aria-labelledby":c.triggerId,"data-state":`open`,ref:o,children:[i,l?.extra]})}):null};N.displayName=`AccordionPanel`;var P=Object.assign(E,{Item:j,Trigger:M,Panel:N});exports.Accordion=P,exports.AccordionItem=j,exports.AccordionPanel=N,exports.AccordionTrigger=M;
2
+ //# sourceMappingURL=Accordion.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Accordion.cjs","names":["React","useControllable","useId","cn","accordionClassNames","getElementType","flattenChildren","accordionTriggerClassNames","getPartId","accordionItemClassNames","disabledStyles","focusRingInset","composeEventHandlers","ChevronDownIcon","accordionPanelClassNames","require_runtime","require_cn","require_children","require_dev","require_composeEventHandlers","require_classNames","require_useControllable","require_useId","require_styles","require_icons","require_disclosureIds","react","react_jsx_runtime","AccordionContext","AccordionItemContext","AccordionPanelSlotContext","EMPTY","INERT_ACCORDION","INERT_ITEM","IN_PANEL","AccordionHeadingOutsideContext","HEADING_CLASS","useAccordionContext","component","useAccordionItemContext","warnDuplicateValue","value","toItems","AccordionRoot","openItemsProp","rest","props","multiple","type","defaultOpenItems","onOpenItemsChange","controlledSingle","openItem","controlled","initialItems","defaultOpenItem","openItems","setOpenItems","list","next","onOpenItemChange","openCount","toggle","prev","v","itemCountsRef","registerItem","counts","count","remaining","baseId","context","headingLevel","className","findPart","node","child","found","part","barrier","AccordionItem","idOf","id","element","wrapsTriggerOnly","AccordionTrigger","AccordionPanel","misplacedMessage","headingLevelProp","accordion","isOpen","toggleValue","Heading","triggerElement","panelElement","parts","extra","children","keyed","key","trigger","panel","hasTrigger","hasPanel","triggerIdProp","panelIdProp","hasPanelContent","extraPanelContent","itemContext","panelSlot","idProp","item","inPanel","headingOutside","state","button","onClick","slot","Accordion"],"sources":["../../../src/components/layout/Accordion.tsx"],"sourcesContent":["import * as React from 'react';\nimport {\n accordionClassNames,\n accordionItemClassNames,\n accordionPanelClassNames,\n accordionTriggerClassNames,\n} from '../../lib/classNames';\nimport { flattenChildren, getElementType } from '../../lib/children';\nimport { cn } from '../../lib/cn';\nimport { composeEventHandlers } from '../../lib/composeEventHandlers';\nimport { reportMissingContext, warnDeprecated, warnOnce } from '../../lib/dev';\nimport { ChevronDownIcon } from '../../lib/icons';\nimport { disabledStyles, focusRingInset } from '../../lib/styles';\nimport type { SelectionMode } from '../../lib/types';\nimport { useControllable } from '../../hooks/useControllable';\nimport { useId } from '../../hooks/useId';\nimport { getPartId } from './disclosureIds';\n\n/** Heading level of the element that wraps each Accordion trigger. */\nexport type AccordionHeadingLevel = 1 | 2 | 3 | 4 | 5 | 6;\n\n/* ------------------------------------------------------------------ */\n/* Contexts */\n/* ------------------------------------------------------------------ */\n\ninterface AccordionContextValue {\n openItems: readonly string[];\n toggle: (value: string) => void;\n /** Counts a mounted Item's value (warns when several Items share it); returns the unregister. */\n registerItem: (value: string) => () => void;\n baseId: string;\n headingLevel: AccordionHeadingLevel;\n}\n\ninterface AccordionItemContextValue {\n value: string;\n isOpen: boolean;\n /** Id of the trigger button: the consumer `id` of the Item's Trigger, else a generated one. */\n triggerId: string;\n /** Id of the panel region: the consumer `id` of the Item's Panel, else a generated one. */\n panelId: string;\n /** Whether the Item renders a panel region while open (a Panel, or other content). */\n hasPanelContent: boolean;\n headingLevel: AccordionHeadingLevel;\n toggle: () => void;\n}\n\n/**\n * What an Accordion.Panel renders after its own children. Kept out of the item context, so a new\n * `extra` (a new array on every Item render) re-renders only the Panel.\n */\ninterface AccordionPanelSlotValue {\n /** Children of the Item that are neither Trigger nor Panel: rendered after the Panel content. */\n extra: React.ReactNode;\n /** `true` inside a Panel's content, where a Trigger or Panel is misplaced. */\n inPanel: boolean;\n}\n\nconst AccordionContext = React.createContext<AccordionContextValue | null>(null);\nconst AccordionItemContext = React.createContext<AccordionItemContextValue | null>(null);\nconst AccordionPanelSlotContext = React.createContext<AccordionPanelSlotValue | null>(null);\n\nconst EMPTY: readonly string[] = [];\n\nconst INERT_ACCORDION: AccordionContextValue = {\n openItems: EMPTY,\n toggle: () => {},\n registerItem: () => () => {},\n baseId: 'wave-accordion-inert',\n headingLevel: 3,\n};\n\nconst INERT_ITEM: AccordionItemContextValue = {\n value: '',\n isOpen: false,\n triggerId: 'wave-accordion-inert-trigger',\n panelId: 'wave-accordion-inert-panel',\n hasPanelContent: false,\n headingLevel: 3,\n toggle: () => {},\n};\n\nconst IN_PANEL: AccordionPanelSlotValue = { extra: null, inPanel: true };\n\n/**\n * `true` inside a wrapper component chain that holds only the item's Trigger (a Tooltip): the Item\n * renders the heading around the wrapper, so the Trigger renders its button without one.\n */\nconst AccordionHeadingOutsideContext = React.createContext(false);\n\n/**\n * Classes of the heading around each trigger button. `grid` stretches its child to the full row,\n * so a wrapper between the heading and the button (a Tooltip's inline-block `<span>`) does not\n * shrink the full-width button and move its chevron away from the row end.\n */\nconst HEADING_CLASS = 'm-0 grid';\n\n/**\n * C-CONTEXT: throws in development; in production logs once (`reportMissingContext`) and returns\n * the inert value.\n */\nfunction useAccordionContext(component: string): AccordionContextValue {\n const context = React.useContext(AccordionContext);\n if (context) return context;\n reportMissingContext(component, '<Accordion>');\n return INERT_ACCORDION;\n}\n\nfunction useAccordionItemContext(component: string): AccordionItemContextValue {\n const context = React.useContext(AccordionItemContext);\n if (context) return context;\n reportMissingContext(component, '<Accordion.Item>');\n return INERT_ITEM;\n}\n\nfunction warnDuplicateValue(value: string): void {\n warnOnce(\n `Accordion:duplicate:${value}`,\n `Accordion: several items share the value \"${value}\". Item values must be unique within an ` +\n 'Accordion; items with the same value open and close together and share their trigger and ' +\n 'panel ids.',\n );\n}\n\n/* ------------------------------------------------------------------ */\n/* Accordion */\n/* ------------------------------------------------------------------ */\n\n/** Props shared by {@link AccordionSingleProps} and {@link AccordionMultipleProps}. */\nexport interface AccordionBaseProps extends React.HTMLAttributes<HTMLDivElement> {\n /**\n * Level of the heading element (`<h1>`–`<h6>`) that wraps every trigger button (WAI-ARIA\n * Accordion pattern). Each `Accordion.Item` can override it.\n * @default 3\n */\n headingLevel?: AccordionHeadingLevel;\n /** Ref to the root `<div>`. */\n ref?: React.Ref<HTMLDivElement>;\n}\n\n/** Props of an Accordion in which at most one item is open (the default). */\nexport interface AccordionSingleProps extends AccordionBaseProps {\n /**\n * Whether only one or multiple items can be open at a time.\n * @default 'single'\n */\n type?: Extract<SelectionMode, 'single'>;\n /** Controlled open item (`null`: every item closed). */\n openItem?: string | null;\n /** Initially open item for uncontrolled usage. */\n defaultOpenItem?: string | null;\n /** Called with the new open item (`null` when it closed) when it changes. */\n onOpenItemChange?: (openItem: string | null) => void;\n /** @deprecated Use `openItem` (single mode); `openItems` belongs to `type=\"multiple\"`. */\n openItems?: readonly string[];\n /**\n * @deprecated Use `defaultOpenItem` (single mode); `defaultOpenItems` belongs to\n * `type=\"multiple\"`.\n */\n defaultOpenItems?: readonly string[];\n /**\n * @deprecated Use `onOpenItemChange` (single mode); `onOpenItemsChange` belongs to\n * `type=\"multiple\"`.\n */\n onOpenItemsChange?: (openItems: string[]) => void;\n}\n\n/** Props of an Accordion in which any number of items can be open. */\nexport interface AccordionMultipleProps extends AccordionBaseProps {\n /** Whether only one or multiple items can be open at a time. */\n type: Extract<SelectionMode, 'multiple'>;\n /** Controlled array of open item values (a readonly array is accepted). */\n openItems?: readonly string[];\n /**\n * Initially open items for uncontrolled usage.\n * @default []\n */\n defaultOpenItems?: readonly string[];\n /** Called with the new open items (a new array) when they change. */\n onOpenItemsChange?: (openItems: string[]) => void;\n openItem?: never;\n defaultOpenItem?: never;\n onOpenItemChange?: never;\n}\n\n/**\n * Properties for the Accordion component: a discriminated union on `type`. Single mode\n * (default) uses `openItem`/`defaultOpenItem`/`onOpenItemChange`; `type=\"multiple\"` uses\n * `openItems`/`defaultOpenItems`/`onOpenItemsChange`.\n *\n * A union cannot be extended by an `interface` (TS2312), which 0.4's interface allowed: extend\n * `AccordionSingleProps` or `AccordionMultipleProps` instead\n * (`interface MyProps extends AccordionSingleProps {}`), or intersect the union\n * (`type MyProps = AccordionProps & { … }`).\n */\nexport type AccordionProps = AccordionSingleProps | AccordionMultipleProps;\n\nfunction toItems(value: string | null | undefined): readonly string[] | undefined {\n if (value === undefined) return undefined;\n return value === null ? EMPTY : [value];\n}\n\n// The Accordion root, documented on the exported `Accordion` const.\nconst AccordionRoot = (props: AccordionProps) => {\n const {\n type,\n openItem,\n defaultOpenItem,\n onOpenItemChange,\n openItems: openItemsProp,\n defaultOpenItems,\n onOpenItemsChange,\n headingLevel = 3,\n className,\n children,\n ref,\n ...rest\n } = props as Omit<AccordionSingleProps, 'type'> & { type?: SelectionMode };\n const multiple = type === 'multiple';\n\n if (!multiple) {\n if (openItemsProp !== undefined) {\n warnDeprecated(\n 'Accordion',\n 'openItems',\n 'openItem',\n 'In single mode the Accordion takes one value.',\n );\n }\n if (defaultOpenItems !== undefined) {\n warnDeprecated(\n 'Accordion',\n 'defaultOpenItems',\n 'defaultOpenItem',\n 'In single mode the Accordion takes one value.',\n );\n }\n if (onOpenItemsChange !== undefined) {\n warnDeprecated(\n 'Accordion',\n 'onOpenItemsChange',\n 'onOpenItemChange',\n 'In single mode the Accordion reports one value.',\n );\n }\n }\n\n const controlledSingle = multiple ? undefined : openItem;\n const controlled = React.useMemo(\n () => toItems(controlledSingle) ?? openItemsProp,\n [controlledSingle, openItemsProp],\n );\n const [initialItems] = React.useState(\n () => (multiple ? undefined : toItems(defaultOpenItem)) ?? defaultOpenItems ?? EMPTY,\n );\n\n const handleChange = (next: readonly string[]) => {\n const list = [...next];\n if (!multiple) onOpenItemChange?.(list[0] ?? null);\n onOpenItemsChange?.(list);\n };\n\n const [openItems, setOpenItems] = useControllable<readonly string[]>(\n controlled,\n initialItems,\n handleChange,\n );\n\n const openCount = openItems.length;\n React.useEffect(() => {\n if (!multiple && openCount > 1) {\n warnOnce(\n 'Accordion:single-multiple-open',\n `Accordion: type=\"single\" allows one open item, but ${openCount} are open. Pass \\`openItem\\`, or use type=\"multiple\".`,\n );\n }\n }, [multiple, openCount]);\n\n const toggle = React.useCallback(\n (value: string) => {\n setOpenItems((prev) => {\n if (prev.includes(value)) return prev.filter((v) => v !== value);\n return multiple ? [...prev, value] : [value];\n });\n },\n [multiple, setOpenItems],\n );\n\n // How many mounted Items hold each value, to warn about a repeated value (C-DEV). Only the Items'\n // effects touch it (through `registerItem`), never render.\n const itemCountsRef = React.useRef<Map<string, number>>(null);\n const registerItem = React.useCallback((value: string) => {\n itemCountsRef.current ??= new Map();\n const counts = itemCountsRef.current;\n const count = (counts.get(value) ?? 0) + 1;\n counts.set(value, count);\n if (count > 1) warnDuplicateValue(value);\n return () => {\n const remaining = (counts.get(value) ?? 1) - 1;\n if (remaining > 0) counts.set(value, remaining);\n else counts.delete(value);\n };\n }, []);\n\n const baseId = useId('accordion');\n const context = React.useMemo<AccordionContextValue>(\n () => ({ openItems, toggle, registerItem, baseId, headingLevel }),\n [openItems, toggle, registerItem, baseId, headingLevel],\n );\n\n return (\n <AccordionContext.Provider value={context}>\n {/* A nested Accordion's direct children are not inside the outer Item. */}\n <AccordionItemContext.Provider value={null}>\n <AccordionPanelSlotContext.Provider value={null}>\n <AccordionHeadingOutsideContext.Provider value={false}>\n <div\n ref={ref}\n className={cn(accordionClassNames.root, 'divide-y divide-border', className)}\n {...rest}\n >\n {children}\n </div>\n </AccordionHeadingOutsideContext.Provider>\n </AccordionPanelSlotContext.Provider>\n </AccordionItemContext.Provider>\n </AccordionContext.Provider>\n );\n};\nAccordionRoot.displayName = 'Accordion';\n\n/* ------------------------------------------------------------------ */\n/* Accordion.Item */\n/* ------------------------------------------------------------------ */\n\n/** Properties for the AccordionItem sub-component. */\nexport interface AccordionItemProps extends React.HTMLAttributes<HTMLDivElement> {\n /** Unique value identifying this accordion item. */\n value: string;\n /** Heading level of this item's trigger; overrides the Accordion's `headingLevel`. */\n headingLevel?: AccordionHeadingLevel;\n /** Ref to the item `<div>`. */\n ref?: React.Ref<HTMLDivElement>;\n}\n\ninterface PartProps {\n id?: unknown;\n children?: unknown;\n}\n\n/**\n * The first `part` element in `node`: the node itself, or an element found through Fragments\n * and the `children` of wrapper elements (a Tooltip around a Trigger). The search does not enter\n * `barrier` elements or a nested Accordion/Item, and cannot see what a component renders itself.\n * Parts are identified by their unwrapped element type, so parts written in a Server Component\n * (lazy client references) are found too. A `React.lazy` still loading (content inside the\n * consumer's own `<Suspense>`) is no part and never suspends the Item: its children are searched.\n */\nfunction findPart(\n node: unknown,\n part: React.ElementType,\n barrier: React.ElementType,\n): React.ReactElement<PartProps> | undefined {\n if (Array.isArray(node)) {\n for (const child of node) {\n const found = findPart(child, part, barrier);\n if (found) return found;\n }\n return undefined;\n }\n if (!React.isValidElement<PartProps>(node)) return undefined;\n const type = getElementType(node, { suspend: false });\n if (type === part) return node;\n if (type === barrier || type === AccordionRoot || type === AccordionItem) return undefined;\n return findPart(node.props.children, part, barrier);\n}\n\n/**\n * The consumer `id` of a Trigger or Panel element, if it has one. An empty `id` counts as none,\n * here and where the Trigger and Panel render their id (`idProp || generated`).\n */\nfunction idOf(element: React.ReactElement<PartProps> | undefined): string | undefined {\n const id = element?.props.id;\n return typeof id === 'string' && id !== '' ? id : undefined;\n}\n\n/**\n * Whether `node` is a chain of wrapper components, each with the next as its only child, that ends\n * at an Accordion.Trigger: a Tooltip around the Trigger. The Item puts the heading around such a\n * chain instead of inside it, so no heading ends up in a wrapper's phrasing `<span>`. Elements\n * (`<div>`, `<span>`) render as written: the heading stays inside them.\n */\nfunction wrapsTriggerOnly(node: unknown): boolean {\n if (!React.isValidElement<PartProps>(node)) return false;\n const type = getElementType(node, { suspend: false });\n if (\n typeof type === 'string' ||\n type === AccordionTrigger ||\n type === AccordionPanel ||\n type === AccordionRoot ||\n type === AccordionItem\n ) {\n return false;\n }\n const child = node.props.children as React.ReactNode;\n return getElementType(child, { suspend: false }) === AccordionTrigger || wrapsTriggerOnly(child);\n}\n\nfunction misplacedMessage(component: 'Accordion.Trigger' | 'Accordion.Panel'): string {\n return (\n `${component} was rendered inside the panel of an Accordion.Item, so it is not the item's ` +\n `${component === 'Accordion.Trigger' ? 'header' : 'panel'}. Place Accordion.Trigger and ` +\n 'Accordion.Panel directly in Accordion.Item, in a Fragment, or in an element that wraps them ' +\n 'as `children` (such as a Tooltip). The Item cannot see inside a component that renders them ' +\n 'itself and treats that component as panel content.'\n );\n}\n\n/**\n * One section of an Accordion. Place an `Accordion.Trigger` and an `Accordion.Panel` inside it:\n * directly, in a Fragment, or in an element that wraps them as `children` (for example a Tooltip\n * around the Trigger). A component that renders a Trigger or Panel itself is not seen through: it\n * counts as panel content, and a development warning says so.\n *\n * The trigger button sits in a heading (`headingLevel`). A wrapper component whose only child is\n * the Trigger (a Tooltip, also several nested) goes inside that heading, around the button, so\n * the heading never ends up in the wrapper's inline `<span>` and the button keeps the full row.\n * An element such as a `<div>`, or a wrapper that holds more than the Trigger, renders as written,\n * with the heading inside it.\n *\n * Without a Trigger the item's `value` is the button label. Other children (plain text included)\n * are rendered in the panel, after the Panel's own content.\n */\nconst AccordionItem = ({\n value,\n headingLevel: headingLevelProp,\n className,\n children,\n ref,\n ...rest\n}: AccordionItemProps) => {\n const accordion = useAccordionContext('Accordion.Item');\n const isOpen = accordion.openItems.includes(value);\n const { toggle: toggleValue, baseId, registerItem } = accordion;\n React.useEffect(() => registerItem(value), [registerItem, value]);\n const headingLevel = headingLevelProp ?? accordion.headingLevel;\n const Heading: `h${AccordionHeadingLevel}` = `h${headingLevel}`;\n\n let triggerElement: React.ReactElement<PartProps> | undefined;\n let panelElement: React.ReactElement<PartProps> | undefined;\n const parts: React.ReactNode[] = [];\n const extra: React.ReactNode[] = [];\n for (const { key, node: child } of flattenChildren(children)) {\n const keyed = <React.Fragment key={key}>{child}</React.Fragment>;\n const trigger = findPart(child, AccordionTrigger, AccordionPanel);\n const panel = findPart(child, AccordionPanel, AccordionTrigger);\n if (trigger || panel) {\n triggerElement ??= trigger;\n panelElement ??= panel;\n parts.push(\n wrapsTriggerOnly(child) ? (\n <Heading key={key} className={cn(accordionTriggerClassNames.heading, HEADING_CLASS)}>\n <AccordionHeadingOutsideContext.Provider value={true}>\n {child}\n </AccordionHeadingOutsideContext.Provider>\n </Heading>\n ) : (\n keyed\n ),\n );\n } else {\n extra.push(keyed);\n }\n }\n const hasTrigger = triggerElement !== undefined;\n const hasPanel = panelElement !== undefined;\n const triggerIdProp = idOf(triggerElement);\n const panelIdProp = idOf(panelElement);\n const hasPanelContent = hasPanel || extra.length > 0;\n const extraPanelContent = hasPanel && extra.length > 0 ? extra : null;\n\n const itemContext = React.useMemo<AccordionItemContextValue>(\n () => ({\n value,\n isOpen,\n triggerId: triggerIdProp ?? getPartId(baseId, 'trigger', value),\n panelId: panelIdProp ?? getPartId(baseId, 'panel', value),\n hasPanelContent,\n headingLevel,\n toggle: () => toggleValue(value),\n }),\n [value, isOpen, baseId, triggerIdProp, panelIdProp, hasPanelContent, headingLevel, toggleValue],\n );\n const panelSlot = React.useMemo<AccordionPanelSlotValue>(\n () => ({ extra: extraPanelContent, inPanel: false }),\n [extraPanelContent],\n );\n\n return (\n <AccordionItemContext.Provider value={itemContext}>\n <AccordionPanelSlotContext.Provider value={panelSlot}>\n <div\n ref={ref}\n data-state={isOpen ? 'open' : 'closed'}\n className={cn(accordionItemClassNames.root, className)}\n {...rest}\n >\n {hasTrigger ? null : <AccordionTrigger>{value}</AccordionTrigger>}\n {parts}\n {!hasPanel && extra.length > 0 ? <AccordionPanel>{extra}</AccordionPanel> : null}\n </div>\n </AccordionPanelSlotContext.Provider>\n </AccordionItemContext.Provider>\n );\n};\nAccordionItem.displayName = 'AccordionItem';\n\n/* ------------------------------------------------------------------ */\n/* Accordion.Trigger */\n/* ------------------------------------------------------------------ */\n\n/** Properties for the AccordionTrigger sub-component (merged onto the trigger `<button>`). */\nexport interface AccordionTriggerProps extends React.ButtonHTMLAttributes<HTMLButtonElement> {\n /** Ref to the trigger `<button>`. */\n ref?: React.Ref<HTMLButtonElement>;\n}\n\n/**\n * The button that opens and closes its Accordion.Item, wrapped in a heading (`headingLevel`); when\n * it is the only child of a wrapper component in the Item (a Tooltip), the heading goes around\n * that wrapper instead (see `Accordion.Item`). Its props land on the `<button>`: `className` is\n * merged (yours wins), `onClick` runs before the toggle (call `event.preventDefault()` to keep the\n * item as it is), `ref` receives the button, and a non-empty `id` replaces the generated one (the\n * panel's `aria-labelledby` follows it).\n */\nconst AccordionTrigger = ({\n id: idProp,\n className,\n children,\n onClick,\n ref,\n ...rest\n}: AccordionTriggerProps) => {\n const item = useAccordionItemContext('Accordion.Trigger');\n const inPanel = React.useContext(AccordionPanelSlotContext)?.inPanel ?? false;\n React.useEffect(() => {\n if (inPanel) {\n warnOnce('Accordion.Trigger:inside-panel', misplacedMessage('Accordion.Trigger'));\n }\n }, [inPanel]);\n const headingOutside = React.useContext(AccordionHeadingOutsideContext);\n const Heading: `h${AccordionHeadingLevel}` = `h${item.headingLevel}`;\n const state = item.isOpen ? 'open' : 'closed';\n\n const button = (\n <button\n type=\"button\"\n className={cn(\n accordionTriggerClassNames.root,\n 'flex w-full items-center justify-between gap-2 px-4 py-3 text-start text-body-1 font-semibold text-foreground',\n 'not-disabled:not-aria-disabled:hover:bg-subtle-hover not-disabled:not-aria-disabled:active:bg-subtle-pressed',\n disabledStyles,\n focusRingInset,\n className,\n )}\n {...rest}\n // A misplaced Trigger (inside the panel) still toggles, but only the item's own trigger\n // carries the item's id and panel reference.\n id={idProp || (inPanel ? undefined : item.triggerId)}\n // Only a panel region the item renders is referenced (none without panel content).\n aria-controls={!inPanel && item.hasPanelContent ? item.panelId : undefined}\n aria-expanded={item.isOpen}\n data-state={state}\n onClick={composeEventHandlers(onClick, item.toggle)}\n ref={ref}\n >\n {children}\n <ChevronDownIcon\n size={16}\n className={cn(\n accordionTriggerClassNames.expandIcon,\n 'shrink-0 transition-transform motion-reduce:transition-none',\n item.isOpen && 'rotate-180',\n )}\n />\n </button>\n );\n // Inside a wrapper chain (a Tooltip) the Item has rendered the heading around the wrapper.\n return headingOutside ? (\n button\n ) : (\n <Heading className={cn(accordionTriggerClassNames.heading, HEADING_CLASS)}>{button}</Heading>\n );\n};\nAccordionTrigger.displayName = 'AccordionTrigger';\n\n/* ------------------------------------------------------------------ */\n/* Accordion.Panel */\n/* ------------------------------------------------------------------ */\n\n/** Properties for the AccordionPanel sub-component (merged onto the `role=\"region\"` element). */\nexport interface AccordionPanelProps extends React.HTMLAttributes<HTMLDivElement> {\n /** Ref to the panel `<div role=\"region\">`. */\n ref?: React.Ref<HTMLDivElement>;\n}\n\n/**\n * The content region of an Accordion.Item, rendered only while the item is open and labelled by\n * its trigger. Its props (className merged, `ref`, `data-*`, handlers) land on the region, and a\n * non-empty `id` replaces the generated one (the trigger's `aria-controls` follows it).\n */\nconst AccordionPanel = ({ id: idProp, className, children, ref, ...rest }: AccordionPanelProps) => {\n const item = useAccordionItemContext('Accordion.Panel');\n const slot = React.useContext(AccordionPanelSlotContext);\n const inPanel = slot?.inPanel ?? false;\n React.useEffect(() => {\n if (inPanel) warnOnce('Accordion.Panel:inside-panel', misplacedMessage('Accordion.Panel'));\n }, [inPanel]);\n if (!item.isOpen) return null;\n if (inPanel) {\n // Misplaced: its content joins the enclosing region (one region and one panel id per item).\n return (\n <div\n className={cn(accordionPanelClassNames.root, className)}\n {...rest}\n id={idProp || undefined}\n ref={ref}\n >\n {children}\n </div>\n );\n }\n return (\n <AccordionPanelSlotContext.Provider value={IN_PANEL}>\n <div\n role=\"region\"\n className={cn(\n accordionPanelClassNames.root,\n 'px-4 pb-3 text-body-1 text-muted-foreground',\n className,\n )}\n {...rest}\n id={idProp || item.panelId}\n aria-labelledby={item.triggerId}\n data-state=\"open\"\n ref={ref}\n >\n {children}\n {slot?.extra}\n </div>\n </AccordionPanelSlotContext.Provider>\n );\n};\nAccordionPanel.displayName = 'AccordionPanel';\n\n/* ------------------------------------------------------------------ */\n/* Export */\n/* ------------------------------------------------------------------ */\n\n/**\n * A vertically stacked set of disclosure sections (WAI-ARIA Accordion pattern). Each\n * `Accordion.Item` renders an `Accordion.Trigger` button inside a heading (`headingLevel`) and an\n * `Accordion.Panel` region that is shown while the item is open.\n *\n * Single mode (the default) keeps at most one item open (`openItem`, `defaultOpenItem`,\n * `onOpenItemChange`); `type=\"multiple\"` lets any number of items open (`openItems`,\n * `defaultOpenItems`, `onOpenItemsChange`). Each Item's `value` must be unique within its\n * Accordion: a development warning names a repeated value.\n *\n * Sub-components are also exported under flat names (`AccordionItem`, `AccordionTrigger`,\n * `AccordionPanel`) for React Server Components, which cannot use the dotted form.\n */\nexport const Accordion = /* @__PURE__ */ Object.assign(AccordionRoot, {\n Item: AccordionItem,\n Trigger: AccordionTrigger,\n Panel: AccordionPanel,\n});\n\nexport { AccordionItem, AccordionTrigger, AccordionPanel };\n"],"mappings":"2fA0DA,IAAM4B,EAAmB5B,EAAM,cAA4C,IAAI,EACzE6B,EAAuB7B,EAAM,cAAgD,IAAI,EACjF8B,EAA4B9B,EAAM,cAA8C,IAAI,EAEpF+B,EAA2B,CAAC,EAE5BC,EAAyC,CAC7C,UAAWD,EACX,WAAc,CAAC,EACf,qBAA0B,CAAC,EAC3B,OAAQ,uBACR,aAAc,CAChB,EAEME,EAAwC,CAC5C,MAAO,GACP,OAAQ,GACR,UAAW,+BACX,QAAS,6BACT,gBAAiB,GACjB,aAAc,EACd,WAAc,CAAC,CACjB,EAEMC,EAAoC,CAAE,MAAO,KAAM,QAAS,EAAK,EAMjEC,EAAiCnC,EAAM,cAAc,EAAK,EAO1DoC,EAAgB,WAMtB,SAASC,EAAoB,EAA0C,CAIrE,OAHgBrC,EAAM,WAAW4B,CAC7B,IACJV,EAAA,qBAAqBoB,EAAW,aAAa,EACtCN,EACT,CAEA,SAASO,EAAwB,EAA8C,CAI7E,OAHgBvC,EAAM,WAAW6B,CAC7B,IACJX,EAAA,qBAAqBoB,EAAW,kBAAkB,EAC3CL,EACT,CAEA,SAASO,EAAmB,EAAqB,CAC/CtB,EAAA,SACE,uBAAuBuB,IACvB,6CAA6CA,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e,YAAc,iBAmB7B,IAAaC,EAA4B,OAAO,OAAO3E,EAAe,CACpE,KAAMqC,EACN,QAASK,EACT,MAAOC,CACT,CAAC"}
@@ -0,0 +1,237 @@
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 { accordionClassNames as s, accordionItemClassNames as c, accordionPanelClassNames as l, accordionTriggerClassNames as u } from "../../lib/classNames.mjs";
7
+ import { useControllable as d } from "../../hooks/useControllable.mjs";
8
+ import { useId as f } from "../../hooks/useId.mjs";
9
+ import { disabledStyles as p, focusRingInset as m } from "../../lib/styles.mjs";
10
+ import { ChevronDownIcon as h } from "../../lib/icons.mjs";
11
+ import { getPartId as g } from "./disclosureIds.mjs";
12
+ import * as _ from "react";
13
+ import { jsx as v, jsxs as y } from "react/jsx-runtime";
14
+ //#region src/components/layout/Accordion.tsx
15
+ var b = _.createContext(null), x = _.createContext(null), S = _.createContext(null), C = [], w = {
16
+ openItems: C,
17
+ toggle: () => {},
18
+ registerItem: () => () => {},
19
+ baseId: "wave-accordion-inert",
20
+ headingLevel: 3
21
+ }, T = {
22
+ value: "",
23
+ isOpen: !1,
24
+ triggerId: "wave-accordion-inert-trigger",
25
+ panelId: "wave-accordion-inert-panel",
26
+ hasPanelContent: !1,
27
+ headingLevel: 3,
28
+ toggle: () => {}
29
+ }, E = {
30
+ extra: null,
31
+ inPanel: !0
32
+ }, D = _.createContext(!1), O = "m-0 grid";
33
+ function k(e) {
34
+ return _.useContext(b) || (r(e, "<Accordion>"), w);
35
+ }
36
+ function A(e) {
37
+ return _.useContext(x) || (r(e, "<Accordion.Item>"), T);
38
+ }
39
+ function j(e) {
40
+ 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.`);
41
+ }
42
+ function M(e) {
43
+ if (e !== void 0) return e === null ? C : [e];
44
+ }
45
+ var N = (t) => {
46
+ let { type: n, openItem: r, defaultOpenItem: o, onOpenItemChange: c, openItems: l, defaultOpenItems: u, onOpenItemsChange: p, headingLevel: m = 3, className: h, children: g, ref: y, ...w } = t, T = n === "multiple";
47
+ T || (l !== void 0 && i("Accordion", "openItems", "openItem", "In single mode the Accordion takes one value."), u !== void 0 && i("Accordion", "defaultOpenItems", "defaultOpenItem", "In single mode the Accordion takes one value."), p !== void 0 && i("Accordion", "onOpenItemsChange", "onOpenItemChange", "In single mode the Accordion reports one value."));
48
+ let E = T ? void 0 : r, O = _.useMemo(() => M(E) ?? l, [E, l]), [k] = _.useState(() => (T ? void 0 : M(o)) ?? u ?? C), [A, N] = d(O, k, (e) => {
49
+ let t = [...e];
50
+ T || c?.(t[0] ?? null), p?.(t);
51
+ }), P = A.length;
52
+ _.useEffect(() => {
53
+ !T && P > 1 && a("Accordion:single-multiple-open", `Accordion: type="single" allows one open item, but ${P} are open. Pass \`openItem\`, or use type="multiple".`);
54
+ }, [T, P]);
55
+ let F = _.useCallback((e) => {
56
+ N((t) => t.includes(e) ? t.filter((t) => t !== e) : T ? [...t, e] : [e]);
57
+ }, [T, N]), I = _.useRef(null), L = _.useCallback((e) => {
58
+ I.current ??= /* @__PURE__ */ new Map();
59
+ let t = I.current, n = (t.get(e) ?? 0) + 1;
60
+ return t.set(e, n), n > 1 && j(e), () => {
61
+ let n = (t.get(e) ?? 1) - 1;
62
+ n > 0 ? t.set(e, n) : t.delete(e);
63
+ };
64
+ }, []), R = f("accordion"), z = _.useMemo(() => ({
65
+ openItems: A,
66
+ toggle: F,
67
+ registerItem: L,
68
+ baseId: R,
69
+ headingLevel: m
70
+ }), [
71
+ A,
72
+ F,
73
+ L,
74
+ R,
75
+ m
76
+ ]);
77
+ return /* @__PURE__ */ v(b.Provider, {
78
+ value: z,
79
+ children: /* @__PURE__ */ v(x.Provider, {
80
+ value: null,
81
+ children: /* @__PURE__ */ v(S.Provider, {
82
+ value: null,
83
+ children: /* @__PURE__ */ v(D.Provider, {
84
+ value: !1,
85
+ children: /* @__PURE__ */ v("div", {
86
+ ref: y,
87
+ className: e(s.root, "divide-y divide-border", h),
88
+ ...w,
89
+ children: g
90
+ })
91
+ })
92
+ })
93
+ })
94
+ });
95
+ };
96
+ N.displayName = "Accordion";
97
+ function P(e, t, r) {
98
+ if (Array.isArray(e)) {
99
+ for (let n of e) {
100
+ let e = P(n, t, r);
101
+ if (e) return e;
102
+ }
103
+ return;
104
+ }
105
+ if (!_.isValidElement(e)) return;
106
+ let i = n(e, { suspend: !1 });
107
+ if (i === t) return e;
108
+ if (i !== r && i !== N && i !== R) return P(e.props.children, t, r);
109
+ }
110
+ function F(e) {
111
+ let t = e?.props.id;
112
+ return typeof t == "string" && t !== "" ? t : void 0;
113
+ }
114
+ function I(e) {
115
+ if (!_.isValidElement(e)) return !1;
116
+ let t = n(e, { suspend: !1 });
117
+ if (typeof t == "string" || t === z || t === B || t === N || t === R) return !1;
118
+ let r = e.props.children;
119
+ return n(r, { suspend: !1 }) === z || I(r);
120
+ }
121
+ function L(e) {
122
+ 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.`;
123
+ }
124
+ var R = ({ value: n, headingLevel: r, className: i, children: a, ref: o, ...s }) => {
125
+ let l = k("Accordion.Item"), d = l.openItems.includes(n), { toggle: f, baseId: p, registerItem: m } = l;
126
+ _.useEffect(() => m(n), [m, n]);
127
+ let h = r ?? l.headingLevel, b = `h${h}`, C, w, T = [], E = [];
128
+ for (let { key: n, node: r } of t(a)) {
129
+ let t = /* @__PURE__ */ v(_.Fragment, { children: r }, n), i = P(r, z, B), a = P(r, B, z);
130
+ i || a ? (C ??= i, w ??= a, T.push(I(r) ? /* @__PURE__ */ v(b, {
131
+ className: e(u.heading, O),
132
+ children: /* @__PURE__ */ v(D.Provider, {
133
+ value: !0,
134
+ children: r
135
+ })
136
+ }, n) : t)) : E.push(t);
137
+ }
138
+ let A = C !== void 0, j = w !== void 0, M = F(C), N = F(w), L = j || E.length > 0, R = j && E.length > 0 ? E : null, V = _.useMemo(() => ({
139
+ value: n,
140
+ isOpen: d,
141
+ triggerId: M ?? g(p, "trigger", n),
142
+ panelId: N ?? g(p, "panel", n),
143
+ hasPanelContent: L,
144
+ headingLevel: h,
145
+ toggle: () => f(n)
146
+ }), [
147
+ n,
148
+ d,
149
+ p,
150
+ M,
151
+ N,
152
+ L,
153
+ h,
154
+ f
155
+ ]), H = _.useMemo(() => ({
156
+ extra: R,
157
+ inPanel: !1
158
+ }), [R]);
159
+ return /* @__PURE__ */ v(x.Provider, {
160
+ value: V,
161
+ children: /* @__PURE__ */ v(S.Provider, {
162
+ value: H,
163
+ children: /* @__PURE__ */ y("div", {
164
+ ref: o,
165
+ "data-state": d ? "open" : "closed",
166
+ className: e(c.root, i),
167
+ ...s,
168
+ children: [
169
+ A ? null : /* @__PURE__ */ v(z, { children: n }),
170
+ T,
171
+ !j && E.length > 0 ? /* @__PURE__ */ v(B, { children: E }) : null
172
+ ]
173
+ })
174
+ })
175
+ });
176
+ };
177
+ R.displayName = "AccordionItem";
178
+ var z = ({ id: t, className: n, children: r, onClick: i, ref: s, ...c }) => {
179
+ let l = A("Accordion.Trigger"), d = _.useContext(S)?.inPanel ?? !1;
180
+ _.useEffect(() => {
181
+ d && a("Accordion.Trigger:inside-panel", L("Accordion.Trigger"));
182
+ }, [d]);
183
+ let f = _.useContext(D), g = `h${l.headingLevel}`, b = l.isOpen ? "open" : "closed", x = /* @__PURE__ */ y("button", {
184
+ type: "button",
185
+ className: e(u.root, "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", p, m, n),
186
+ ...c,
187
+ id: t || (d ? void 0 : l.triggerId),
188
+ "aria-controls": !d && l.hasPanelContent ? l.panelId : void 0,
189
+ "aria-expanded": l.isOpen,
190
+ "data-state": b,
191
+ onClick: o(i, l.toggle),
192
+ ref: s,
193
+ children: [r, /* @__PURE__ */ v(h, {
194
+ size: 16,
195
+ className: e(u.expandIcon, "shrink-0 transition-transform motion-reduce:transition-none", l.isOpen && "rotate-180")
196
+ })]
197
+ });
198
+ return f ? x : /* @__PURE__ */ v(g, {
199
+ className: e(u.heading, O),
200
+ children: x
201
+ });
202
+ };
203
+ z.displayName = "AccordionTrigger";
204
+ var B = ({ id: t, className: n, children: r, ref: i, ...o }) => {
205
+ let s = A("Accordion.Panel"), c = _.useContext(S), u = c?.inPanel ?? !1;
206
+ return _.useEffect(() => {
207
+ u && a("Accordion.Panel:inside-panel", L("Accordion.Panel"));
208
+ }, [u]), s.isOpen ? u ? /* @__PURE__ */ v("div", {
209
+ className: e(l.root, n),
210
+ ...o,
211
+ id: t || void 0,
212
+ ref: i,
213
+ children: r
214
+ }) : /* @__PURE__ */ v(S.Provider, {
215
+ value: E,
216
+ children: /* @__PURE__ */ y("div", {
217
+ role: "region",
218
+ className: e(l.root, "px-4 pb-3 text-body-1 text-muted-foreground", n),
219
+ ...o,
220
+ id: t || s.panelId,
221
+ "aria-labelledby": s.triggerId,
222
+ "data-state": "open",
223
+ ref: i,
224
+ children: [r, c?.extra]
225
+ })
226
+ }) : null;
227
+ };
228
+ B.displayName = "AccordionPanel";
229
+ var V = /* @__PURE__ */ Object.assign(N, {
230
+ Item: R,
231
+ Trigger: z,
232
+ Panel: B
233
+ });
234
+ //#endregion
235
+ export { V as Accordion, R as AccordionItem, B as AccordionPanel, z as AccordionTrigger };
236
+
237
+ //# sourceMappingURL=Accordion.mjs.map