@mortenbrudvik/waveui 0.4.0 → 0.7.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (574) hide show
  1. package/README.md +1221 -173
  2. package/dist/_virtual/_rolldown/runtime.cjs +1 -0
  3. package/dist/components/button/Button.cjs +2 -0
  4. package/dist/components/button/Button.cjs.map +1 -0
  5. package/dist/components/button/Button.mjs +50 -0
  6. package/dist/components/button/Button.mjs.map +1 -0
  7. package/dist/components/button/Button.semantics.cjs +2 -0
  8. package/dist/components/button/Button.semantics.cjs.map +1 -0
  9. package/dist/components/button/Button.semantics.mjs +61 -0
  10. package/dist/components/button/Button.semantics.mjs.map +1 -0
  11. package/dist/components/button/Button.slots.cjs +2 -0
  12. package/dist/components/button/Button.slots.cjs.map +1 -0
  13. package/dist/components/button/Button.slots.mjs +47 -0
  14. package/dist/components/button/Button.slots.mjs.map +1 -0
  15. package/dist/components/button/CompoundButton.cjs +2 -0
  16. package/dist/components/button/CompoundButton.cjs.map +1 -0
  17. package/dist/components/button/CompoundButton.mjs +53 -0
  18. package/dist/components/button/CompoundButton.mjs.map +1 -0
  19. package/dist/components/button/Link.cjs +2 -0
  20. package/dist/components/button/Link.cjs.map +1 -0
  21. package/dist/components/button/Link.mjs +37 -0
  22. package/dist/components/button/Link.mjs.map +1 -0
  23. package/dist/components/button/MenuButton.cjs +2 -0
  24. package/dist/components/button/MenuButton.cjs.map +1 -0
  25. package/dist/components/button/MenuButton.mjs +45 -0
  26. package/dist/components/button/MenuButton.mjs.map +1 -0
  27. package/dist/components/button/SplitButton.cjs +2 -0
  28. package/dist/components/button/SplitButton.cjs.map +1 -0
  29. package/dist/components/button/SplitButton.mjs +66 -0
  30. package/dist/components/button/SplitButton.mjs.map +1 -0
  31. package/dist/components/button/ToggleButton.cjs +2 -0
  32. package/dist/components/button/ToggleButton.cjs.map +1 -0
  33. package/dist/components/button/ToggleButton.mjs +65 -0
  34. package/dist/components/button/ToggleButton.mjs.map +1 -0
  35. package/dist/components/button/Toolbar.cjs +2 -0
  36. package/dist/components/button/Toolbar.cjs.map +1 -0
  37. package/dist/components/button/Toolbar.context.cjs +2 -0
  38. package/dist/components/button/Toolbar.context.cjs.map +1 -0
  39. package/dist/components/button/Toolbar.context.mjs +31 -0
  40. package/dist/components/button/Toolbar.context.mjs.map +1 -0
  41. package/dist/components/button/Toolbar.mjs +63 -0
  42. package/dist/components/button/Toolbar.mjs.map +1 -0
  43. package/dist/components/button/Toolbar.parts.cjs +2 -0
  44. package/dist/components/button/Toolbar.parts.cjs.map +1 -0
  45. package/dist/components/button/Toolbar.parts.mjs +131 -0
  46. package/dist/components/button/Toolbar.parts.mjs.map +1 -0
  47. package/dist/components/button/buttonStyles.cjs +2 -0
  48. package/dist/components/button/buttonStyles.cjs.map +1 -0
  49. package/dist/components/button/buttonStyles.mjs +39 -0
  50. package/dist/components/button/buttonStyles.mjs.map +1 -0
  51. package/dist/components/data-display/Avatar.cjs +2 -0
  52. package/dist/components/data-display/Avatar.cjs.map +1 -0
  53. package/dist/components/data-display/Avatar.mjs +157 -0
  54. package/dist/components/data-display/Avatar.mjs.map +1 -0
  55. package/dist/components/data-display/AvatarGroup.cjs +2 -0
  56. package/dist/components/data-display/AvatarGroup.cjs.map +1 -0
  57. package/dist/components/data-display/AvatarGroup.mjs +134 -0
  58. package/dist/components/data-display/AvatarGroup.mjs.map +1 -0
  59. package/dist/components/data-display/Badge.cjs +2 -0
  60. package/dist/components/data-display/Badge.cjs.map +1 -0
  61. package/dist/components/data-display/Badge.colors.cjs +2 -0
  62. package/dist/components/data-display/Badge.colors.cjs.map +1 -0
  63. package/dist/components/data-display/Badge.colors.mjs +58 -0
  64. package/dist/components/data-display/Badge.colors.mjs.map +1 -0
  65. package/dist/components/data-display/Badge.mjs +32 -0
  66. package/dist/components/data-display/Badge.mjs.map +1 -0
  67. package/dist/components/data-display/CounterBadge.cjs +2 -0
  68. package/dist/components/data-display/CounterBadge.cjs.map +1 -0
  69. package/dist/components/data-display/CounterBadge.mjs +28 -0
  70. package/dist/components/data-display/CounterBadge.mjs.map +1 -0
  71. package/dist/components/data-display/Divider.cjs +2 -0
  72. package/dist/components/data-display/Divider.cjs.map +1 -0
  73. package/dist/components/data-display/Divider.mjs +52 -0
  74. package/dist/components/data-display/Divider.mjs.map +1 -0
  75. package/dist/components/data-display/Image.cjs +2 -0
  76. package/dist/components/data-display/Image.cjs.map +1 -0
  77. package/dist/components/data-display/Image.mjs +32 -0
  78. package/dist/components/data-display/Image.mjs.map +1 -0
  79. package/dist/components/data-display/InfoLabel.cjs +2 -0
  80. package/dist/components/data-display/InfoLabel.cjs.map +1 -0
  81. package/dist/components/data-display/InfoLabel.mjs +104 -0
  82. package/dist/components/data-display/InfoLabel.mjs.map +1 -0
  83. package/dist/components/data-display/List.cjs +2 -0
  84. package/dist/components/data-display/List.cjs.map +1 -0
  85. package/dist/components/data-display/List.mjs +381 -0
  86. package/dist/components/data-display/List.mjs.map +1 -0
  87. package/dist/components/data-display/List.registry.cjs +2 -0
  88. package/dist/components/data-display/List.registry.cjs.map +1 -0
  89. package/dist/components/data-display/List.registry.mjs +101 -0
  90. package/dist/components/data-display/List.registry.mjs.map +1 -0
  91. package/dist/components/data-display/Persona.cjs +2 -0
  92. package/dist/components/data-display/Persona.cjs.map +1 -0
  93. package/dist/components/data-display/Persona.mjs +48 -0
  94. package/dist/components/data-display/Persona.mjs.map +1 -0
  95. package/dist/components/data-display/PresenceBadge.cjs +2 -0
  96. package/dist/components/data-display/PresenceBadge.cjs.map +1 -0
  97. package/dist/components/data-display/PresenceBadge.mjs +71 -0
  98. package/dist/components/data-display/PresenceBadge.mjs.map +1 -0
  99. package/dist/components/data-display/Tag.cjs +2 -0
  100. package/dist/components/data-display/Tag.cjs.map +1 -0
  101. package/dist/components/data-display/Tag.mjs +147 -0
  102. package/dist/components/data-display/Tag.mjs.map +1 -0
  103. package/dist/components/feedback/MessageBar.cjs +2 -0
  104. package/dist/components/feedback/MessageBar.cjs.map +1 -0
  105. package/dist/components/feedback/MessageBar.mjs +144 -0
  106. package/dist/components/feedback/MessageBar.mjs.map +1 -0
  107. package/dist/components/feedback/MessageBar.status.cjs +2 -0
  108. package/dist/components/feedback/MessageBar.status.cjs.map +1 -0
  109. package/dist/components/feedback/MessageBar.status.mjs +45 -0
  110. package/dist/components/feedback/MessageBar.status.mjs.map +1 -0
  111. package/dist/components/feedback/ProgressBar.cjs +2 -0
  112. package/dist/components/feedback/ProgressBar.cjs.map +1 -0
  113. package/dist/components/feedback/ProgressBar.mjs +72 -0
  114. package/dist/components/feedback/ProgressBar.mjs.map +1 -0
  115. package/dist/components/feedback/Skeleton.cjs +2 -0
  116. package/dist/components/feedback/Skeleton.cjs.map +1 -0
  117. package/dist/components/feedback/Skeleton.mjs +47 -0
  118. package/dist/components/feedback/Skeleton.mjs.map +1 -0
  119. package/dist/components/feedback/Spinner.cjs +2 -0
  120. package/dist/components/feedback/Spinner.cjs.map +1 -0
  121. package/dist/components/feedback/Spinner.mjs +60 -0
  122. package/dist/components/feedback/Spinner.mjs.map +1 -0
  123. package/dist/components/feedback/Toast.cjs +2 -0
  124. package/dist/components/feedback/Toast.cjs.map +1 -0
  125. package/dist/components/feedback/Toast.mjs +347 -0
  126. package/dist/components/feedback/Toast.mjs.map +1 -0
  127. package/dist/components/input/Checkbox.cjs +2 -0
  128. package/dist/components/input/Checkbox.cjs.map +1 -0
  129. package/dist/components/input/Checkbox.mjs +96 -0
  130. package/dist/components/input/Checkbox.mjs.map +1 -0
  131. package/dist/components/input/ColorPicker.cjs +6 -0
  132. package/dist/components/input/ColorPicker.cjs.map +1 -0
  133. package/dist/components/input/ColorPicker.mjs +236 -0
  134. package/dist/components/input/ColorPicker.mjs.map +1 -0
  135. package/dist/components/input/Combobox.cjs +2 -0
  136. package/dist/components/input/Combobox.cjs.map +1 -0
  137. package/dist/components/input/Combobox.expand.cjs +2 -0
  138. package/dist/components/input/Combobox.expand.cjs.map +1 -0
  139. package/dist/components/input/Combobox.expand.mjs +38 -0
  140. package/dist/components/input/Combobox.expand.mjs.map +1 -0
  141. package/dist/components/input/Combobox.mjs +187 -0
  142. package/dist/components/input/Combobox.mjs.map +1 -0
  143. package/dist/components/input/DatePicker.cjs +2 -0
  144. package/dist/components/input/DatePicker.cjs.map +1 -0
  145. package/dist/components/input/DatePicker.mjs +340 -0
  146. package/dist/components/input/DatePicker.mjs.map +1 -0
  147. package/dist/components/input/Dropdown.cjs +2 -0
  148. package/dist/components/input/Dropdown.cjs.map +1 -0
  149. package/dist/components/input/Dropdown.mjs +128 -0
  150. package/dist/components/input/Dropdown.mjs.map +1 -0
  151. package/dist/components/input/Field.cjs +2 -0
  152. package/dist/components/input/Field.cjs.map +1 -0
  153. package/dist/components/input/Field.mjs +200 -0
  154. package/dist/components/input/Field.mjs.map +1 -0
  155. package/dist/components/input/Input.cjs +2 -0
  156. package/dist/components/input/Input.cjs.map +1 -0
  157. package/dist/components/input/Input.mjs +81 -0
  158. package/dist/components/input/Input.mjs.map +1 -0
  159. package/dist/components/input/Label.cjs +2 -0
  160. package/dist/components/input/Label.cjs.map +1 -0
  161. package/dist/components/input/Label.mjs +28 -0
  162. package/dist/components/input/Label.mjs.map +1 -0
  163. package/dist/components/input/Option.cjs +2 -0
  164. package/dist/components/input/Option.cjs.map +1 -0
  165. package/dist/components/input/Option.mjs +169 -0
  166. package/dist/components/input/Option.mjs.map +1 -0
  167. package/dist/components/input/RadioGroup.cjs +2 -0
  168. package/dist/components/input/RadioGroup.cjs.map +1 -0
  169. package/dist/components/input/RadioGroup.mjs +139 -0
  170. package/dist/components/input/RadioGroup.mjs.map +1 -0
  171. package/dist/components/input/Rating.cjs +2 -0
  172. package/dist/components/input/Rating.cjs.map +1 -0
  173. package/dist/components/input/Rating.mjs +196 -0
  174. package/dist/components/input/Rating.mjs.map +1 -0
  175. package/dist/components/input/SearchBox.cjs +2 -0
  176. package/dist/components/input/SearchBox.cjs.map +1 -0
  177. package/dist/components/input/SearchBox.mjs +205 -0
  178. package/dist/components/input/SearchBox.mjs.map +1 -0
  179. package/dist/components/input/Select.cjs +2 -0
  180. package/dist/components/input/Select.cjs.map +1 -0
  181. package/dist/components/input/Select.mjs +33 -0
  182. package/dist/components/input/Select.mjs.map +1 -0
  183. package/dist/components/input/Slider.cjs +2 -0
  184. package/dist/components/input/Slider.cjs.map +1 -0
  185. package/dist/components/input/Slider.mjs +79 -0
  186. package/dist/components/input/Slider.mjs.map +1 -0
  187. package/dist/components/input/SpinButton.cjs +2 -0
  188. package/dist/components/input/SpinButton.cjs.map +1 -0
  189. package/dist/components/input/SpinButton.mjs +157 -0
  190. package/dist/components/input/SpinButton.mjs.map +1 -0
  191. package/dist/components/input/SwatchPicker.cjs +2 -0
  192. package/dist/components/input/SwatchPicker.cjs.map +1 -0
  193. package/dist/components/input/SwatchPicker.mjs +113 -0
  194. package/dist/components/input/SwatchPicker.mjs.map +1 -0
  195. package/dist/components/input/Switch.cjs +2 -0
  196. package/dist/components/input/Switch.cjs.map +1 -0
  197. package/dist/components/input/Switch.mjs +92 -0
  198. package/dist/components/input/Switch.mjs.map +1 -0
  199. package/dist/components/input/TagPicker.cjs +2 -0
  200. package/dist/components/input/TagPicker.cjs.map +1 -0
  201. package/dist/components/input/TagPicker.mjs +249 -0
  202. package/dist/components/input/TagPicker.mjs.map +1 -0
  203. package/dist/components/input/Textarea.cjs +2 -0
  204. package/dist/components/input/Textarea.cjs.map +1 -0
  205. package/dist/components/input/Textarea.mjs +32 -0
  206. package/dist/components/input/Textarea.mjs.map +1 -0
  207. package/dist/components/input/TimePicker.cjs +2 -0
  208. package/dist/components/input/TimePicker.cjs.map +1 -0
  209. package/dist/components/input/TimePicker.mjs +292 -0
  210. package/dist/components/input/TimePicker.mjs.map +1 -0
  211. package/dist/components/input/colorUtils.cjs +2 -0
  212. package/dist/components/input/colorUtils.cjs.map +1 -0
  213. package/dist/components/input/colorUtils.mjs +96 -0
  214. package/dist/components/input/colorUtils.mjs.map +1 -0
  215. package/dist/components/input/dateUtils.cjs +2 -0
  216. package/dist/components/input/dateUtils.cjs.map +1 -0
  217. package/dist/components/input/dateUtils.mjs +250 -0
  218. package/dist/components/input/dateUtils.mjs.map +1 -0
  219. package/dist/components/input/pickerStyles.cjs +2 -0
  220. package/dist/components/input/pickerStyles.cjs.map +1 -0
  221. package/dist/components/input/pickerStyles.mjs +10 -0
  222. package/dist/components/input/pickerStyles.mjs.map +1 -0
  223. package/dist/components/internal/HiddenInput.cjs +2 -0
  224. package/dist/components/internal/HiddenInput.cjs.map +1 -0
  225. package/dist/components/internal/HiddenInput.mjs +88 -0
  226. package/dist/components/internal/HiddenInput.mjs.map +1 -0
  227. package/dist/components/layout/Accordion.cjs +2 -0
  228. package/dist/components/layout/Accordion.cjs.map +1 -0
  229. package/dist/components/layout/Accordion.mjs +236 -0
  230. package/dist/components/layout/Accordion.mjs.map +1 -0
  231. package/dist/components/layout/Card.cjs +2 -0
  232. package/dist/components/layout/Card.cjs.map +1 -0
  233. package/dist/components/layout/Card.mjs +121 -0
  234. package/dist/components/layout/Card.mjs.map +1 -0
  235. package/dist/components/layout/Carousel.cjs +2 -0
  236. package/dist/components/layout/Carousel.cjs.map +1 -0
  237. package/dist/components/layout/Carousel.mjs +205 -0
  238. package/dist/components/layout/Carousel.mjs.map +1 -0
  239. package/dist/components/layout/Flex.cjs +2 -0
  240. package/dist/components/layout/Flex.cjs.map +1 -0
  241. package/dist/components/layout/Flex.mjs +54 -0
  242. package/dist/components/layout/Flex.mjs.map +1 -0
  243. package/dist/components/layout/Grid.cjs +2 -0
  244. package/dist/components/layout/Grid.cjs.map +1 -0
  245. package/dist/components/layout/Grid.mjs +62 -0
  246. package/dist/components/layout/Grid.mjs.map +1 -0
  247. package/dist/components/layout/Overflow.cjs +2 -0
  248. package/dist/components/layout/Overflow.cjs.map +1 -0
  249. package/dist/components/layout/Overflow.mjs +269 -0
  250. package/dist/components/layout/Overflow.mjs.map +1 -0
  251. package/dist/components/layout/Stack.cjs +2 -0
  252. package/dist/components/layout/Stack.cjs.map +1 -0
  253. package/dist/components/layout/Stack.mjs +39 -0
  254. package/dist/components/layout/Stack.mjs.map +1 -0
  255. package/dist/components/layout/TabList.cjs +2 -0
  256. package/dist/components/layout/TabList.cjs.map +1 -0
  257. package/dist/components/layout/TabList.mjs +238 -0
  258. package/dist/components/layout/TabList.mjs.map +1 -0
  259. package/dist/components/layout/Tree.cjs +2 -0
  260. package/dist/components/layout/Tree.cjs.map +1 -0
  261. package/dist/components/layout/Tree.mjs +220 -0
  262. package/dist/components/layout/Tree.mjs.map +1 -0
  263. package/dist/components/layout/disclosureIds.cjs +2 -0
  264. package/dist/components/layout/disclosureIds.cjs.map +1 -0
  265. package/dist/components/layout/disclosureIds.mjs +12 -0
  266. package/dist/components/layout/disclosureIds.mjs.map +1 -0
  267. package/dist/components/motion/Presence.cjs +2 -0
  268. package/dist/components/motion/Presence.cjs.map +1 -0
  269. package/dist/components/motion/Presence.mjs +35 -0
  270. package/dist/components/motion/Presence.mjs.map +1 -0
  271. package/dist/components/navigation/Breadcrumb.cjs +2 -0
  272. package/dist/components/navigation/Breadcrumb.cjs.map +1 -0
  273. package/dist/components/navigation/Breadcrumb.mjs +144 -0
  274. package/dist/components/navigation/Breadcrumb.mjs.map +1 -0
  275. package/dist/components/navigation/Menu.cjs +2 -0
  276. package/dist/components/navigation/Menu.cjs.map +1 -0
  277. package/dist/components/navigation/Menu.context.cjs +2 -0
  278. package/dist/components/navigation/Menu.context.cjs.map +1 -0
  279. package/dist/components/navigation/Menu.context.mjs +82 -0
  280. package/dist/components/navigation/Menu.context.mjs.map +1 -0
  281. package/dist/components/navigation/Menu.group.cjs +2 -0
  282. package/dist/components/navigation/Menu.group.cjs.map +1 -0
  283. package/dist/components/navigation/Menu.group.mjs +58 -0
  284. package/dist/components/navigation/Menu.group.mjs.map +1 -0
  285. package/dist/components/navigation/Menu.items.cjs +2 -0
  286. package/dist/components/navigation/Menu.items.cjs.map +1 -0
  287. package/dist/components/navigation/Menu.items.mjs +127 -0
  288. package/dist/components/navigation/Menu.items.mjs.map +1 -0
  289. package/dist/components/navigation/Menu.link.cjs +2 -0
  290. package/dist/components/navigation/Menu.link.cjs.map +1 -0
  291. package/dist/components/navigation/Menu.link.mjs +41 -0
  292. package/dist/components/navigation/Menu.link.mjs.map +1 -0
  293. package/dist/components/navigation/Menu.mjs +27 -0
  294. package/dist/components/navigation/Menu.mjs.map +1 -0
  295. package/dist/components/navigation/Menu.popover.cjs +2 -0
  296. package/dist/components/navigation/Menu.popover.cjs.map +1 -0
  297. package/dist/components/navigation/Menu.popover.mjs +231 -0
  298. package/dist/components/navigation/Menu.popover.mjs.map +1 -0
  299. package/dist/components/navigation/Menu.root.cjs +2 -0
  300. package/dist/components/navigation/Menu.root.cjs.map +1 -0
  301. package/dist/components/navigation/Menu.root.mjs +308 -0
  302. package/dist/components/navigation/Menu.root.mjs.map +1 -0
  303. package/dist/components/navigation/Menu.selectable.cjs +2 -0
  304. package/dist/components/navigation/Menu.selectable.cjs.map +1 -0
  305. package/dist/components/navigation/Menu.selectable.mjs +89 -0
  306. package/dist/components/navigation/Menu.selectable.mjs.map +1 -0
  307. package/dist/components/navigation/Menu.shared.cjs +2 -0
  308. package/dist/components/navigation/Menu.shared.cjs.map +1 -0
  309. package/dist/components/navigation/Menu.shared.mjs +23 -0
  310. package/dist/components/navigation/Menu.shared.mjs.map +1 -0
  311. package/dist/components/navigation/Menu.splitGroup.cjs +2 -0
  312. package/dist/components/navigation/Menu.splitGroup.cjs.map +1 -0
  313. package/dist/components/navigation/Menu.splitGroup.mjs +51 -0
  314. package/dist/components/navigation/Menu.splitGroup.mjs.map +1 -0
  315. package/dist/components/navigation/Menu.trigger.cjs +2 -0
  316. package/dist/components/navigation/Menu.trigger.cjs.map +1 -0
  317. package/dist/components/navigation/Menu.trigger.mjs +79 -0
  318. package/dist/components/navigation/Menu.trigger.mjs.map +1 -0
  319. package/dist/components/navigation/Nav.cjs +2 -0
  320. package/dist/components/navigation/Nav.cjs.map +1 -0
  321. package/dist/components/navigation/Nav.mjs +276 -0
  322. package/dist/components/navigation/Nav.mjs.map +1 -0
  323. package/dist/components/navigation/Pagination.cjs +2 -0
  324. package/dist/components/navigation/Pagination.cjs.map +1 -0
  325. package/dist/components/navigation/Pagination.mjs +110 -0
  326. package/dist/components/navigation/Pagination.mjs.map +1 -0
  327. package/dist/components/navigation/Stepper.cjs +2 -0
  328. package/dist/components/navigation/Stepper.cjs.map +1 -0
  329. package/dist/components/navigation/Stepper.mjs +204 -0
  330. package/dist/components/navigation/Stepper.mjs.map +1 -0
  331. package/dist/components/overlays/Dialog.cjs +2 -0
  332. package/dist/components/overlays/Dialog.cjs.map +1 -0
  333. package/dist/components/overlays/Dialog.mjs +180 -0
  334. package/dist/components/overlays/Dialog.mjs.map +1 -0
  335. package/dist/components/overlays/Dialog.shared.cjs +2 -0
  336. package/dist/components/overlays/Dialog.shared.cjs.map +1 -0
  337. package/dist/components/overlays/Dialog.shared.mjs +227 -0
  338. package/dist/components/overlays/Dialog.shared.mjs.map +1 -0
  339. package/dist/components/overlays/Drawer.cjs +2 -0
  340. package/dist/components/overlays/Drawer.cjs.map +1 -0
  341. package/dist/components/overlays/Drawer.mjs +192 -0
  342. package/dist/components/overlays/Drawer.mjs.map +1 -0
  343. package/dist/components/overlays/Popover.cjs +2 -0
  344. package/dist/components/overlays/Popover.cjs.map +1 -0
  345. package/dist/components/overlays/Popover.mjs +365 -0
  346. package/dist/components/overlays/Popover.mjs.map +1 -0
  347. package/dist/components/overlays/Popover.shared.cjs +2 -0
  348. package/dist/components/overlays/Popover.shared.cjs.map +1 -0
  349. package/dist/components/overlays/Popover.shared.mjs +182 -0
  350. package/dist/components/overlays/Popover.shared.mjs.map +1 -0
  351. package/dist/components/overlays/TeachingPopover.cjs +2 -0
  352. package/dist/components/overlays/TeachingPopover.cjs.map +1 -0
  353. package/dist/components/overlays/TeachingPopover.mjs +181 -0
  354. package/dist/components/overlays/TeachingPopover.mjs.map +1 -0
  355. package/dist/components/overlays/Tooltip.cjs +2 -0
  356. package/dist/components/overlays/Tooltip.cjs.map +1 -0
  357. package/dist/components/overlays/Tooltip.mjs +160 -0
  358. package/dist/components/overlays/Tooltip.mjs.map +1 -0
  359. package/dist/components/portal/Portal.cjs +2 -0
  360. package/dist/components/portal/Portal.cjs.map +1 -0
  361. package/dist/components/portal/Portal.mjs +45 -0
  362. package/dist/components/portal/Portal.mjs.map +1 -0
  363. package/dist/components/provider/WaveProvider.cjs +2 -0
  364. package/dist/components/provider/WaveProvider.cjs.map +1 -0
  365. package/dist/components/provider/WaveProvider.mjs +51 -0
  366. package/dist/components/provider/WaveProvider.mjs.map +1 -0
  367. package/dist/components/table/DataGrid.cjs +2 -0
  368. package/dist/components/table/DataGrid.cjs.map +1 -0
  369. package/dist/components/table/DataGrid.mjs +489 -0
  370. package/dist/components/table/DataGrid.mjs.map +1 -0
  371. package/dist/components/table/Table.cjs +2 -0
  372. package/dist/components/table/Table.cjs.map +1 -0
  373. package/dist/components/table/Table.mjs +99 -0
  374. package/dist/components/table/Table.mjs.map +1 -0
  375. package/dist/components/table/useGridNavigation.cjs +2 -0
  376. package/dist/components/table/useGridNavigation.cjs.map +1 -0
  377. package/dist/components/table/useGridNavigation.mjs +336 -0
  378. package/dist/components/table/useGridNavigation.mjs.map +1 -0
  379. package/dist/components/typography/Text.cjs +2 -0
  380. package/dist/components/typography/Text.cjs.map +1 -0
  381. package/dist/components/typography/Text.mjs +38 -0
  382. package/dist/components/typography/Text.mjs.map +1 -0
  383. package/dist/hooks/useAnnounce.cjs +2 -0
  384. package/dist/hooks/useAnnounce.cjs.map +1 -0
  385. package/dist/hooks/useAnnounce.mjs +88 -0
  386. package/dist/hooks/useAnnounce.mjs.map +1 -0
  387. package/dist/hooks/useCheckedValues.cjs +2 -0
  388. package/dist/hooks/useCheckedValues.cjs.map +1 -0
  389. package/dist/hooks/useCheckedValues.mjs +102 -0
  390. package/dist/hooks/useCheckedValues.mjs.map +1 -0
  391. package/dist/hooks/useContextMenuAnchor.cjs +2 -0
  392. package/dist/hooks/useContextMenuAnchor.cjs.map +1 -0
  393. package/dist/hooks/useContextMenuAnchor.mjs +132 -0
  394. package/dist/hooks/useContextMenuAnchor.mjs.map +1 -0
  395. package/dist/hooks/useControllable.cjs +2 -0
  396. package/dist/hooks/useControllable.cjs.map +1 -0
  397. package/dist/hooks/useControllable.mjs +37 -0
  398. package/dist/hooks/useControllable.mjs.map +1 -0
  399. package/dist/hooks/useDirection.cjs +2 -0
  400. package/dist/hooks/useDirection.cjs.map +1 -0
  401. package/dist/hooks/useDirection.mjs +57 -0
  402. package/dist/hooks/useDirection.mjs.map +1 -0
  403. package/dist/hooks/useDismiss.cjs +2 -0
  404. package/dist/hooks/useDismiss.cjs.map +1 -0
  405. package/dist/hooks/useDismiss.mjs +57 -0
  406. package/dist/hooks/useDismiss.mjs.map +1 -0
  407. package/dist/hooks/useEventCallback.cjs +2 -0
  408. package/dist/hooks/useEventCallback.cjs.map +1 -0
  409. package/dist/hooks/useEventCallback.mjs +16 -0
  410. package/dist/hooks/useEventCallback.mjs.map +1 -0
  411. package/dist/hooks/useFieldControl.cjs +2 -0
  412. package/dist/hooks/useFieldControl.cjs.map +1 -0
  413. package/dist/hooks/useFieldControl.mjs +62 -0
  414. package/dist/hooks/useFieldControl.mjs.map +1 -0
  415. package/dist/hooks/useFocusTrap.cjs +2 -0
  416. package/dist/hooks/useFocusTrap.cjs.map +1 -0
  417. package/dist/hooks/useFocusTrap.mjs +266 -0
  418. package/dist/hooks/useFocusTrap.mjs.map +1 -0
  419. package/dist/hooks/useFormReset.cjs +2 -0
  420. package/dist/hooks/useFormReset.cjs.map +1 -0
  421. package/dist/hooks/useFormReset.mjs +33 -0
  422. package/dist/hooks/useFormReset.mjs.map +1 -0
  423. package/dist/hooks/useHoverIntent.cjs +2 -0
  424. package/dist/hooks/useHoverIntent.cjs.map +1 -0
  425. package/dist/hooks/useHoverIntent.mjs +201 -0
  426. package/dist/hooks/useHoverIntent.mjs.map +1 -0
  427. package/dist/hooks/useId.cjs +2 -0
  428. package/dist/hooks/useId.cjs.map +1 -0
  429. package/dist/hooks/useId.mjs +11 -0
  430. package/dist/hooks/useId.mjs.map +1 -0
  431. package/dist/hooks/useIsClient.cjs +2 -0
  432. package/dist/hooks/useIsClient.cjs.map +1 -0
  433. package/dist/hooks/useIsClient.mjs +19 -0
  434. package/dist/hooks/useIsClient.mjs.map +1 -0
  435. package/dist/hooks/useListbox.cjs +2 -0
  436. package/dist/hooks/useListbox.cjs.map +1 -0
  437. package/dist/hooks/useListbox.mjs +492 -0
  438. package/dist/hooks/useListbox.mjs.map +1 -0
  439. package/dist/hooks/useMergedRefs.cjs +2 -0
  440. package/dist/hooks/useMergedRefs.cjs.map +1 -0
  441. package/dist/hooks/useMergedRefs.mjs +57 -0
  442. package/dist/hooks/useMergedRefs.mjs.map +1 -0
  443. package/dist/hooks/useModalIsolation.cjs +2 -0
  444. package/dist/hooks/useModalIsolation.cjs.map +1 -0
  445. package/dist/hooks/useModalIsolation.mjs +87 -0
  446. package/dist/hooks/useModalIsolation.mjs.map +1 -0
  447. package/dist/hooks/useModalLayer.cjs +2 -0
  448. package/dist/hooks/useModalLayer.cjs.map +1 -0
  449. package/dist/hooks/useModalLayer.mjs +30 -0
  450. package/dist/hooks/useModalLayer.mjs.map +1 -0
  451. package/dist/hooks/usePopupPosition.cjs +2 -0
  452. package/dist/hooks/usePopupPosition.cjs.map +1 -0
  453. package/dist/hooks/usePopupPosition.mjs +117 -0
  454. package/dist/hooks/usePopupPosition.mjs.map +1 -0
  455. package/dist/hooks/usePrefersReducedMotion.cjs +2 -0
  456. package/dist/hooks/usePrefersReducedMotion.cjs.map +1 -0
  457. package/dist/hooks/usePrefersReducedMotion.mjs +24 -0
  458. package/dist/hooks/usePrefersReducedMotion.mjs.map +1 -0
  459. package/dist/hooks/usePresence.cjs +2 -0
  460. package/dist/hooks/usePresence.cjs.map +1 -0
  461. package/dist/hooks/usePresence.mjs +136 -0
  462. package/dist/hooks/usePresence.mjs.map +1 -0
  463. package/dist/hooks/usePreserveFocus.cjs +2 -0
  464. package/dist/hooks/usePreserveFocus.cjs.map +1 -0
  465. package/dist/hooks/usePreserveFocus.mjs +50 -0
  466. package/dist/hooks/usePreserveFocus.mjs.map +1 -0
  467. package/dist/hooks/useRestoreFocus.cjs +2 -0
  468. package/dist/hooks/useRestoreFocus.cjs.map +1 -0
  469. package/dist/hooks/useRestoreFocus.mjs +271 -0
  470. package/dist/hooks/useRestoreFocus.mjs.map +1 -0
  471. package/dist/hooks/useRovingTabIndex.cjs +2 -0
  472. package/dist/hooks/useRovingTabIndex.cjs.map +1 -0
  473. package/dist/hooks/useRovingTabIndex.mjs +389 -0
  474. package/dist/hooks/useRovingTabIndex.mjs.map +1 -0
  475. package/dist/hooks/useScrollLock.cjs +2 -0
  476. package/dist/hooks/useScrollLock.cjs.map +1 -0
  477. package/dist/hooks/useScrollLock.mjs +71 -0
  478. package/dist/hooks/useScrollLock.mjs.map +1 -0
  479. package/dist/hooks/useTriggerElement.cjs +2 -0
  480. package/dist/hooks/useTriggerElement.cjs.map +1 -0
  481. package/dist/hooks/useTriggerElement.mjs +126 -0
  482. package/dist/hooks/useTriggerElement.mjs.map +1 -0
  483. package/dist/hooks/useTypeahead.cjs +2 -0
  484. package/dist/hooks/useTypeahead.cjs.map +1 -0
  485. package/dist/hooks/useTypeahead.mjs +38 -0
  486. package/dist/hooks/useTypeahead.mjs.map +1 -0
  487. package/dist/index.cjs +1 -1
  488. package/dist/index.d.cts +9099 -0
  489. package/dist/index.d.ts +7688 -1027
  490. package/dist/index.mjs +91 -5695
  491. package/dist/lib/aria.cjs +2 -0
  492. package/dist/lib/aria.cjs.map +1 -0
  493. package/dist/lib/aria.mjs +29 -0
  494. package/dist/lib/aria.mjs.map +1 -0
  495. package/dist/lib/children.cjs +2 -0
  496. package/dist/lib/children.cjs.map +1 -0
  497. package/dist/lib/children.mjs +37 -0
  498. package/dist/lib/children.mjs.map +1 -0
  499. package/dist/lib/cn.cjs +2 -0
  500. package/dist/lib/cn.cjs.map +1 -0
  501. package/dist/lib/cn.mjs +64 -0
  502. package/dist/lib/cn.mjs.map +1 -0
  503. package/dist/lib/composeEventHandlers.cjs +2 -0
  504. package/dist/lib/composeEventHandlers.cjs.map +1 -0
  505. package/dist/lib/composeEventHandlers.mjs +11 -0
  506. package/dist/lib/composeEventHandlers.mjs.map +1 -0
  507. package/dist/lib/dev.cjs +2 -0
  508. package/dist/lib/dev.cjs.map +1 -0
  509. package/dist/lib/dev.mjs +42 -0
  510. package/dist/lib/dev.mjs.map +1 -0
  511. package/dist/lib/direction.cjs +2 -0
  512. package/dist/lib/direction.cjs.map +1 -0
  513. package/dist/lib/direction.mjs +35 -0
  514. package/dist/lib/direction.mjs.map +1 -0
  515. package/dist/lib/events.cjs +2 -0
  516. package/dist/lib/events.cjs.map +1 -0
  517. package/dist/lib/events.mjs +31 -0
  518. package/dist/lib/events.mjs.map +1 -0
  519. package/dist/lib/focus.cjs +2 -0
  520. package/dist/lib/focus.cjs.map +1 -0
  521. package/dist/lib/focus.mjs +119 -0
  522. package/dist/lib/focus.mjs.map +1 -0
  523. package/dist/lib/globalRegistry.cjs +2 -0
  524. package/dist/lib/globalRegistry.cjs.map +1 -0
  525. package/dist/lib/globalRegistry.mjs +13 -0
  526. package/dist/lib/globalRegistry.mjs.map +1 -0
  527. package/dist/lib/icons.cjs +2 -0
  528. package/dist/lib/icons.cjs.map +1 -0
  529. package/dist/lib/icons.mjs +254 -0
  530. package/dist/lib/icons.mjs.map +1 -0
  531. package/dist/lib/labelInName.cjs +2 -0
  532. package/dist/lib/labelInName.cjs.map +1 -0
  533. package/dist/lib/labelInName.mjs +54 -0
  534. package/dist/lib/labelInName.mjs.map +1 -0
  535. package/dist/lib/layers.cjs +2 -0
  536. package/dist/lib/layers.cjs.map +1 -0
  537. package/dist/lib/layers.mjs +224 -0
  538. package/dist/lib/layers.mjs.map +1 -0
  539. package/dist/lib/mergeProps.cjs +2 -0
  540. package/dist/lib/mergeProps.cjs.map +1 -0
  541. package/dist/lib/mergeProps.mjs +21 -0
  542. package/dist/lib/mergeProps.mjs.map +1 -0
  543. package/dist/lib/mergeRefs.cjs +2 -0
  544. package/dist/lib/mergeRefs.cjs.map +1 -0
  545. package/dist/lib/mergeRefs.mjs +29 -0
  546. package/dist/lib/mergeRefs.mjs.map +1 -0
  547. package/dist/lib/renderTrigger.cjs +2 -0
  548. package/dist/lib/renderTrigger.cjs.map +1 -0
  549. package/dist/lib/renderTrigger.mjs +29 -0
  550. package/dist/lib/renderTrigger.mjs.map +1 -0
  551. package/dist/lib/slot.cjs +2 -0
  552. package/dist/lib/slot.cjs.map +1 -0
  553. package/dist/lib/slot.mjs +122 -0
  554. package/dist/lib/slot.mjs.map +1 -0
  555. package/dist/lib/styles.cjs +2 -0
  556. package/dist/lib/styles.cjs.map +1 -0
  557. package/dist/lib/styles.mjs +16 -0
  558. package/dist/lib/styles.mjs.map +1 -0
  559. package/dist/lib/theme.cjs +2 -0
  560. package/dist/lib/theme.cjs.map +1 -0
  561. package/dist/lib/theme.mjs +16 -0
  562. package/dist/lib/theme.mjs.map +1 -0
  563. package/dist/preflight.css +2 -0
  564. package/dist/styles.css +2 -0
  565. package/package.json +149 -100
  566. package/src/styles/animations.css +7 -39
  567. package/src/styles/base.css +103 -0
  568. package/src/styles/globals.css +10 -22
  569. package/src/styles/legacy-tokens.css +184 -0
  570. package/src/styles/preflight.css +7 -0
  571. package/src/styles/styles.css +32 -0
  572. package/src/styles/tailwind.css +17 -0
  573. package/src/styles/tokens.css +561 -221
  574. package/src/styles/variants.css +29 -0
@@ -0,0 +1,81 @@
1
+ "use client";
2
+ import { cn as e } from "../../lib/cn.mjs";
3
+ import { renderSlot as t, slotRendersContent as n } from "../../lib/slot.mjs";
4
+ import { useId as r } from "../../hooks/useId.mjs";
5
+ import { joinIds as i } from "../../lib/aria.mjs";
6
+ import { useFieldContext as a, useFieldControl as o } from "../../hooks/useFieldControl.mjs";
7
+ import { inputFocus as s, inputFocusWithin as c } from "../../lib/styles.mjs";
8
+ import "react";
9
+ import { Fragment as l, jsx as u, jsxs as d } from "react/jsx-runtime";
10
+ //#region src/components/input/Input.tsx
11
+ function f(e) {
12
+ return e === !1 || e === "false";
13
+ }
14
+ function p(t, n, i) {
15
+ let o = a(), s = r("error"), c = !f(i) && (t === !0 || typeof t == "string" && t !== "");
16
+ if (!c || typeof t != "string" || o?.hasErrorMessage) return {
17
+ invalid: c,
18
+ messageId: void 0,
19
+ message: null
20
+ };
21
+ let { id: l, className: d, ...p } = n ?? {}, m = l ?? s;
22
+ return {
23
+ invalid: c,
24
+ messageId: m,
25
+ message: /* @__PURE__ */ u("span", {
26
+ role: "alert",
27
+ ...p,
28
+ id: m,
29
+ className: e("mt-1 block text-caption-1 text-error", d),
30
+ children: t
31
+ })
32
+ };
33
+ }
34
+ function m(e, t) {
35
+ return f(t) ? !1 : e || t === !0 || t === "true";
36
+ }
37
+ var h = ({ error: r, errorMessageProps: a, contentBefore: f, contentAfter: h, onChange: g, onValueChange: _, className: v, ref: y, id: b, "aria-label": x, "aria-labelledby": S, "aria-describedby": C, "aria-invalid": w, "aria-required": T, "aria-errormessage": E, required: D, ...O }) => {
38
+ let { invalid: k, messageId: A, message: j } = p(r, a, w), M = o({
39
+ id: b,
40
+ "aria-label": x,
41
+ "aria-labelledby": S,
42
+ "aria-describedby": i(C, A),
43
+ "aria-invalid": w ?? (k || void 0),
44
+ "aria-required": T,
45
+ required: D
46
+ }, { nativeRequired: !0 }), N = m(k, M["aria-invalid"]), P = g || _ ? (e) => {
47
+ g?.(e), _?.(e.currentTarget.value);
48
+ } : void 0, F = {
49
+ ...O,
50
+ ...M,
51
+ "aria-errormessage": i(E, A),
52
+ onChange: P
53
+ }, I = n(f), L = n(h), R;
54
+ if (I || L) {
55
+ let { style: n, hidden: r, ...i } = F;
56
+ R = /* @__PURE__ */ d("span", {
57
+ hidden: r,
58
+ style: n,
59
+ className: e("inline-flex h-8 w-full items-center rounded border border-input border-b-stroke-accessible bg-background text-body-1 text-foreground", c, N && "border-destructive focus-within:border-b-destructive", O.disabled && "cursor-not-allowed opacity-50 has-focus-visible:opacity-100", v),
60
+ children: [
61
+ I && t(f, "span", "shrink-0 ps-2"),
62
+ /* @__PURE__ */ u("input", {
63
+ ref: y,
64
+ className: e("h-full w-full min-w-0 bg-transparent px-2 text-body-1 text-foreground", "placeholder:text-muted-foreground", "focus:outline-hidden", "disabled:cursor-not-allowed"),
65
+ ...i
66
+ }),
67
+ L && t(h, "span", "shrink-0 pe-2")
68
+ ]
69
+ });
70
+ } else R = /* @__PURE__ */ u("input", {
71
+ ref: y,
72
+ className: e("h-8 w-full rounded border border-input border-b-stroke-accessible bg-background px-3 text-body-1 text-foreground", "placeholder:text-muted-foreground", s, "disabled:cursor-not-allowed disabled:opacity-50", N && "border-destructive focus:border-b-destructive", v),
73
+ ...F
74
+ });
75
+ return j ? /* @__PURE__ */ d(l, { children: [R, j] }) : R;
76
+ };
77
+ h.displayName = "Input";
78
+ //#endregion
79
+ export { h as Input, m as isInvalidLook, p as useControlErrorMessage };
80
+
81
+ //# sourceMappingURL=Input.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Input.mjs","names":["useId","_jsx","_Fragment","useId$1","isAriaValid","ariaInvalid","useControlErrorMessage","field","useFieldContext","generatedId","invalid","consumerAriaInvalid","error","ownId","messageClassName","messageRest","errorMessageProps","messageId","cn","isInvalidLook","ownError","Input","ariaLabel","ariaLabelledBy","ariaDescribedBy","ariaRequired","ariaErrorMessage","props","fieldProps","useFieldControl","joinIds","invalidLook","handleChange","onChange","onValueChange","event","controlProps","hasBefore","slotRendersContent","contentBefore","hasAfter","contentAfter","control","inputProps","inputFocusWithin","className","renderSlot","inputFocus","message","Fragment"],"sources":["../../../src/components/input/Input.tsx"],"sourcesContent":["import * as React from 'react';\nimport { cn } from '../../lib/cn';\nimport { joinIds } from '../../lib/aria';\nimport { renderSlot, slotRendersContent } from '../../lib/slot';\nimport { inputFocus, inputFocusWithin, inputInvalid, inputInvalidWithin } from '../../lib/styles';\nimport type { Slot } from '../../lib/types';\nimport { useId } from '../../hooks/useId';\nimport { useFieldContext, useFieldControl } from '../../hooks/useFieldControl';\n\n/**\n * Props of the error message element that {@link Input}, `Select` and `Textarea` render after the\n * control for a string `error` (`id`, `className`, `role`, data attributes, …).\n */\nexport interface InputErrorMessageProps extends React.HTMLAttributes<HTMLSpanElement> {\n /** Ref to the message `<span>`. */\n ref?: React.Ref<HTMLSpanElement>;\n /** Any `data-*` attribute. */\n [dataAttribute: `data-${string}`]: unknown;\n}\n\n/**\n * Result of {@link useControlErrorMessage}.\n *\n * @internal Not exported from the package.\n */\nexport interface ControlErrorMessage {\n /**\n * Whether `error` marks the control invalid (a non-empty string or `true`), unless the consumer\n * set `aria-invalid` to `false`/`\"false\"`.\n */\n invalid: boolean;\n /** The id of the rendered message, joined into `aria-describedby`/`aria-errormessage`. */\n messageId: string | undefined;\n /** The message element to render after the control, or `null`. */\n message: React.ReactElement | null;\n}\n\n/** Whether an `aria-invalid` value explicitly reports the control as valid. */\nfunction isAriaValid(ariaInvalid: React.AriaAttributes['aria-invalid']): boolean {\n return ariaInvalid === false || ariaInvalid === 'false';\n}\n\n/**\n * Shared by Input, Select and Textarea (internal): a non-empty string `error` renders a sibling\n * `<span role=\"alert\">` message, unless the surrounding `Field` already renders its own error\n * (`FieldContext.hasErrorMessage`); `true` only marks the control invalid. The consumer's\n * `aria-invalid` of `false`/`\"false\"` wins over `error`: the control is valid, so nothing is\n * marked invalid and no message is rendered or referenced (ARIA: an error message of a valid\n * control is hidden).\n *\n * @internal Not exported from the package.\n */\nexport function useControlErrorMessage(\n error: string | boolean | undefined,\n errorMessageProps: InputErrorMessageProps | undefined,\n consumerAriaInvalid?: React.AriaAttributes['aria-invalid'],\n): ControlErrorMessage {\n const field = useFieldContext();\n const generatedId = useId('error');\n const invalid =\n !isAriaValid(consumerAriaInvalid) &&\n (error === true || (typeof error === 'string' && error !== ''));\n const showMessage = invalid && typeof error === 'string' && !field?.hasErrorMessage;\n if (!showMessage) return { invalid, messageId: undefined, message: null };\n\n const { id: ownId, className: messageClassName, ...messageRest } = errorMessageProps ?? {};\n const messageId = ownId ?? generatedId;\n const message = (\n <span\n role=\"alert\"\n {...messageRest}\n id={messageId}\n className={cn('mt-1 block text-caption-1 text-error', messageClassName)}\n >\n {error}\n </span>\n );\n return { invalid, messageId, message };\n}\n\n/**\n * Whether a text control shows the invalid look (error border), shared by Input, Select, Textarea\n * and SearchBox (internal): its own `error`, or a resolved `aria-invalid` of `true`/`\"true\"` —\n * from the consumer or from the surrounding `Field` (`useFieldControl`) — so the look always\n * matches the state assistive technology reports. A resolved `false`/`\"false\"` (the consumer's\n * override) never shows it, even with an own `error`. `\"grammar\"`/`\"spelling\"` alone do not\n * count; with an own `error` they keep the look (the control is reported invalid).\n *\n * @internal Not exported from the package.\n */\nexport function isInvalidLook(\n ownError: boolean,\n ariaInvalid: React.AriaAttributes['aria-invalid'],\n): boolean {\n if (isAriaValid(ariaInvalid)) return false;\n return ownError || ariaInvalid === true || ariaInvalid === 'true';\n}\n\n/** Properties for the Input component. */\nexport interface InputProps extends React.InputHTMLAttributes<HTMLInputElement> {\n /**\n * Validation error.\n * - A non-empty string renders the message in a `role=\"alert\"` element **after** the field (a\n * sibling, so it does not change which element receives `ref`, `className` or `style`) and\n * links it through `aria-describedby` and `aria-errormessage`. Inside a `Field` that renders\n * its own `error`, the message is not repeated.\n * - `true` only marks the input invalid (`aria-invalid` and the error border), as in 0.4.\n *\n * The error border also shows whenever the input ends up `aria-invalid=\"true\"` without this\n * prop (an `error` on the surrounding `Field`, or your own `aria-invalid`).\n * Your own `aria-invalid={false}` (or `\"false\"`) wins over this prop: the input is reported\n * valid and shows neither the error border nor the message.\n * Use `Field` (`label`, `hint`, `error`) for a complete field layout.\n */\n error?: string | boolean;\n /** Props of the error message element (`id`, `className`, …) rendered for a string `error`. */\n errorMessageProps?: InputErrorMessageProps;\n /**\n * Slot rendered before the input text (e.g., an icon). With content in either slot, a bordered\n * `<span>` around the input draws the field: it receives `className`, `style` and `hidden`,\n * while `ref`, `id`, `aria-*`, `data-*`, handlers and native attributes stay on the `<input>`.\n * A value that renders nothing (`false`, `''`, `[]`) is no slot.\n */\n contentBefore?: Slot<'span'>;\n /** Slot rendered after the input text (e.g., a suffix). Same wrapper as `contentBefore`. */\n contentAfter?: Slot<'span'>;\n /**\n * Called with the new string value on every change, next to the native `onChange` event\n * handler (`onValueChange={setName}` instead of `onChange={(e) => setName(e.target.value)}`).\n */\n onValueChange?: (value: string) => void;\n /** Ref to the `<input>` element (also with `contentBefore`/`contentAfter`). */\n ref?: React.Ref<HTMLInputElement>;\n}\n\n/**\n * A single-line text input with Fluent styling: a 1px border with an accessible bottom stroke, a\n * primary bottom border while focused, optional `contentBefore`/`contentAfter` slots and an\n * optional error message. Inside a `Field` it picks up the label, hint, error, `required` (native\n * attribute) and invalid state automatically.\n *\n * Every prop reaches the `<input>`, except with slot content: then a bordered `<span>` wrapper\n * draws the field and receives `className`, `style` and `hidden` (`ref` stays on the input).\n *\n * @example\n * <Field label=\"Email\" hint=\"We never share it\" required>\n * <Input type=\"email\" value={email} onValueChange={setEmail} />\n * </Field>\n */\nexport const Input = ({\n error,\n errorMessageProps,\n contentBefore,\n contentAfter,\n onChange,\n onValueChange,\n className,\n ref,\n id,\n 'aria-label': ariaLabel,\n 'aria-labelledby': ariaLabelledBy,\n 'aria-describedby': ariaDescribedBy,\n 'aria-invalid': ariaInvalid,\n 'aria-required': ariaRequired,\n 'aria-errormessage': ariaErrorMessage,\n required,\n ...props\n}: InputProps) => {\n const { invalid, messageId, message } = useControlErrorMessage(\n error,\n errorMessageProps,\n ariaInvalid,\n );\n const fieldProps = useFieldControl(\n {\n id,\n 'aria-label': ariaLabel,\n 'aria-labelledby': ariaLabelledBy,\n 'aria-describedby': joinIds(ariaDescribedBy, messageId),\n 'aria-invalid': ariaInvalid ?? (invalid || undefined),\n 'aria-required': ariaRequired,\n required,\n },\n { nativeRequired: true },\n );\n const invalidLook = isInvalidLook(invalid, fieldProps['aria-invalid']);\n\n const handleChange =\n onChange || onValueChange\n ? (event: React.ChangeEvent<HTMLInputElement>) => {\n onChange?.(event);\n onValueChange?.(event.currentTarget.value);\n }\n : undefined;\n\n const controlProps = {\n ...props,\n ...fieldProps,\n 'aria-errormessage': joinIds(ariaErrorMessage, messageId),\n onChange: handleChange,\n };\n\n const hasBefore = slotRendersContent(contentBefore);\n const hasAfter = slotRendersContent(contentAfter);\n\n let control: React.ReactElement;\n if (hasBefore || hasAfter) {\n // The bordered wrapper is the visible field: `className`, `style` and `hidden` size, style and\n // hide it; `ref`, `id`, `aria-*`, `data-*`, handlers and native attributes go to the input.\n const { style, hidden, ...inputProps } = controlProps;\n control = (\n <span\n hidden={hidden}\n style={style}\n className={cn(\n 'inline-flex h-8 w-full items-center rounded border border-input border-b-stroke-accessible bg-background text-body-1 text-foreground',\n inputFocusWithin,\n invalidLook && inputInvalidWithin,\n // The dimmed look lifts while a focus ring shows inside the wrapper (focusable slot\n // content; the disabled input never takes focus): opacity would dim the ring below 3:1.\n props.disabled && 'cursor-not-allowed opacity-50 has-focus-visible:opacity-100',\n className,\n )}\n >\n {hasBefore && renderSlot(contentBefore, 'span', 'shrink-0 ps-2')}\n <input\n ref={ref}\n className={cn(\n 'h-full w-full min-w-0 bg-transparent px-2 text-body-1 text-foreground',\n 'placeholder:text-muted-foreground',\n 'focus:outline-hidden',\n 'disabled:cursor-not-allowed',\n )}\n {...inputProps}\n />\n {hasAfter && renderSlot(contentAfter, 'span', 'shrink-0 pe-2')}\n </span>\n );\n } else {\n control = (\n <input\n ref={ref}\n className={cn(\n 'h-8 w-full rounded border border-input border-b-stroke-accessible bg-background px-3 text-body-1 text-foreground',\n 'placeholder:text-muted-foreground',\n inputFocus,\n 'disabled:cursor-not-allowed disabled:opacity-50',\n invalidLook && inputInvalid,\n className,\n )}\n {...controlProps}\n />\n );\n }\n\n if (!message) return control;\n return (\n <>\n {control}\n {message}\n </>\n );\n};\n\nInput.displayName = 'Input';\n"],"mappings":";;;;;;;;;;AAsCA,SAASI,EAAY,GAA4D;CAC/E,OAAOC,MAAgB,MAASA,MAAgB;AAClD;AAYA,SAAgBC,EACd,GACA,GACA,GACqB;CACrB,IAAMC,IAAQC,EAAgB,GACxBC,IAAcT,EAAM,OAAO,GAC3BU,IACJ,CAACN,EAAYO,CAAmB,MAC/BC,MAAU,MAAS,OAAOA,KAAU,YAAYA,MAAU;CAE7D,IADoB,MAAW,OAAOA,KAAU,YAAaL,GAAO,iBAClD,OAAO;EAAE;EAAS,WAAW,KAAA;EAAW,SAAS;CAAK;CAExE,IAAM,EAAE,IAAIM,GAAO,WAAWC,GAAkB,GAAGC,MAAgBC,KAAqB,CAAC,GACnFC,IAAYJ,KAASJ;CAW3B,OAAO;EAAE;EAAS;EAAW,SAT3BR,kBAAC,QAAD;GACE,MAAK;GACL,GAAIc;GACJ,IAAIE;GACJ,WAAWC,EAAG,wCAAwCJ,CAAgB;GAErE,UAAAF;EACG,CAEqB;CAAQ;AACvC;AAYA,SAAgBO,EACd,GACA,GACS;CAET,OADIf,EAAYC,CAAW,IAAU,KAC9Be,KAAYf,MAAgB,MAAQA,MAAgB;AAC7D;AAqDA,IAAagB,KAAS,EACpB,UACA,sBACA,kBACA,iBACA,aACA,kBACA,cACA,QACA,OACA,cAAcC,GACd,mBAAmBC,GACnB,oBAAoBC,GACpB,gBAAgBnB,GAChB,iBAAiBoB,GACjB,qBAAqBC,GACrB,aACA,GAAGC,QACa;CAChB,IAAM,EAAE,YAAS,cAAW,eAAYrB,EACtCM,GACAI,GACAX,CACF,GACMuB,IAAaC,EACjB;EACE;EACA,cAAcP;EACd,mBAAmBC;EACnB,oBAAoBO,EAAQN,GAAiBP,CAAS;EACtD,gBAAgBZ,MAAgBK,KAAW,KAAA;EAC3C,iBAAiBe;EACjB;CACF,GACA,EAAE,gBAAgB,GAAK,CACzB,GACMM,IAAcZ,EAAcT,GAASkB,EAAW,eAAe,GAE/DI,IACJC,KAAYC,KACP,MAA+C;EAE9C,AADAD,IAAWE,CAAK,GAChBD,IAAgBC,EAAM,cAAc,KAAK;CAC3C,IACA,KAAA,GAEAC,IAAe;EACnB,GAAGT;EACH,GAAGC;EACH,qBAAqBE,EAAQJ,GAAkBT,CAAS;EACxD,UAAUe;CACZ,GAEMK,IAAYC,EAAmBC,CAAa,GAC5CC,IAAWF,EAAmBG,CAAY,GAE5CC;CACJ,IAAIL,KAAaG,GAAU;EAGzB,IAAM,EAAE,UAAO,WAAQ,GAAGG,MAAeP;EACzC,IACE,kBAAC,QAAD;GACU;GACD;GACP,WAAWlB,EACT,wIACA0B,GACAb,KAAA,wDAGAJ,EAAM,YAAY,+DAClBkB,CACF;GAXF,UAAA;IAaGR,KAAaS,EAAWP,GAAe,QAAQ,eAAe;IAC/D,kBAAC,SAAD;KACO;KACL,WAAWrB,EACT,yEACA,qCACA,wBACA,6BACF;KACA,GAAIyB;IACL,CAAA;IACAH,KAAYM,EAAWL,GAAc,QAAQ,eAAe;GACzD;;CAEV,OACE,IACE,kBAAC,SAAD;EACO;EACL,WAAWvB,EACT,oHACA,qCACA6B,GACA,mDACAhB,KAAA,iDACAc,CACF;EACA,GAAIT;CACL,CAAA;CAKL,OADKY,IAEH,kBAAA9C,GAAA,EAAA,UAAA,CACGwC,GACAM,CACD,EAAA,CAAA,IALiBN;AAOvB;AAEA,EAAM,cAAc"}
@@ -0,0 +1,2 @@
1
+ "use client";const e=require("../../_virtual/_rolldown/runtime.cjs"),t=require("../../lib/cn.cjs");let n=require("react");n=e.__toESM(n,1);let r=require("react/jsx-runtime");var i={small:`text-caption-1`,medium:`text-body-1`,large:`text-body-2`},a={regular:void 0,semibold:`font-semibold`,bold:`font-bold`},o=({required:e=!1,disabled:n=!1,size:o=`medium`,weight:s=`regular`,className:c,children:l,ref:u,...d})=>(0,r.jsxs)(`label`,{ref:u,className:t.cn(n?`text-muted-foreground`:`text-foreground`,i[o],a[s],c),...d,children:[l,e&&(0,r.jsx)(`span`,{className:`ms-1 text-error`,"aria-hidden":`true`,children:`*`})]});o.displayName=`Label`,exports.Label=o;
2
+ //# sourceMappingURL=Label.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Label.cjs","names":["cn","require_runtime","require_cn","react","react_jsx_runtime","sizeMap","weightMap","Label","rest","disabled","size","weight","className","children","required"],"sources":["../../../src/components/input/Label.tsx"],"sourcesContent":["import * as React from 'react';\nimport { cn } from '../../lib/cn';\nimport type { Size, TextWeight } from '../../lib/types';\n\n/** Properties for the Label component. */\nexport interface LabelProps extends React.LabelHTMLAttributes<HTMLLabelElement> {\n /** Whether to show a required indicator asterisk (hidden from assistive technology; mark the\n * control itself `required`).\n * @default false\n */\n required?: boolean;\n /** Whether the label is visually dimmed.\n * @default false\n */\n disabled?: boolean;\n /** Text size of the label: `small` = caption-1, `medium` = body-1, `large` = body-2.\n * @default 'medium'\n */\n size?: Extract<Size, 'small' | 'medium' | 'large'>;\n /** Font weight of the label (the shared `TextWeight` vocabulary).\n * @default 'regular'\n */\n weight?: TextWeight;\n /** Ref to the `<label>` element. */\n ref?: React.Ref<HTMLLabelElement>;\n}\n\nconst sizeMap: Record<'small' | 'medium' | 'large', string> = {\n small: 'text-caption-1',\n medium: 'text-body-1',\n large: 'text-body-2',\n};\n\nconst weightMap: Record<TextWeight, string | undefined> = {\n regular: undefined,\n semibold: 'font-semibold',\n bold: 'font-bold',\n};\n\n/**\n * A text label for a form control (`htmlFor`), on the Fluent type ramp. The optional required\n * asterisk is decorative (`aria-hidden`). `Field` renders its own label; use `Label` for custom\n * layouts.\n *\n * @example\n * <Label htmlFor=\"email\" required>Email</Label>\n * <Input id=\"email\" required />\n */\nexport const Label = ({\n required = false,\n disabled = false,\n size = 'medium',\n weight = 'regular',\n className,\n children,\n ref,\n ...rest\n}: LabelProps) => {\n return (\n <label\n ref={ref}\n className={cn(\n disabled ? 'text-muted-foreground' : 'text-foreground',\n sizeMap[size],\n weightMap[weight],\n className,\n )}\n {...rest}\n >\n {children}\n {required && (\n <span className=\"ms-1 text-error\" aria-hidden=\"true\">\n *\n </span>\n )}\n </label>\n );\n};\n\nLabel.displayName = 'Label';\n"],"mappings":"8KA2BA,IAAMK,EAAwD,CAC5D,MAAO,iBACP,OAAQ,cACR,MAAO,aACT,EAEMC,EAAoD,CACxD,QAAS,IAAA,GACT,SAAU,gBACV,KAAM,WACR,EAWaC,GAAS,CACpB,WAAW,GACX,WAAW,GACX,OAAO,SACP,SAAS,UACT,YACA,WACA,MACA,GAAGC,MAGD,EAAAJ,EAAA,KAAA,CAAC,QAAD,CACO,MACL,UAAWJ,EAAAA,GACTS,EAAW,wBAA0B,kBACrCJ,EAAQK,GACRJ,EAAUK,GACVC,CACF,EACA,GAAIJ,EARN,SAAA,CAUGK,EACAC,IACC,EAAAV,EAAA,IAAA,CAAC,OAAD,CAAM,UAAU,kBAAkB,cAAY,OAAO,SAAA,GAE/C,CAAA,CAEH,IAIX,EAAM,YAAc"}
@@ -0,0 +1,28 @@
1
+ "use client";
2
+ import { cn as e } from "../../lib/cn.mjs";
3
+ import "react";
4
+ import { jsx as t, jsxs as n } from "react/jsx-runtime";
5
+ //#region src/components/input/Label.tsx
6
+ var r = {
7
+ small: "text-caption-1",
8
+ medium: "text-body-1",
9
+ large: "text-body-2"
10
+ }, i = {
11
+ regular: void 0,
12
+ semibold: "font-semibold",
13
+ bold: "font-bold"
14
+ }, a = ({ required: a = !1, disabled: o = !1, size: s = "medium", weight: c = "regular", className: l, children: u, ref: d, ...f }) => /* @__PURE__ */ n("label", {
15
+ ref: d,
16
+ className: e(o ? "text-muted-foreground" : "text-foreground", r[s], i[c], l),
17
+ ...f,
18
+ children: [u, a && /* @__PURE__ */ t("span", {
19
+ className: "ms-1 text-error",
20
+ "aria-hidden": "true",
21
+ children: "*"
22
+ })]
23
+ });
24
+ a.displayName = "Label";
25
+ //#endregion
26
+ export { a as Label };
27
+
28
+ //# sourceMappingURL=Label.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Label.mjs","names":["sizeMap","weightMap","Label","rest","cn","disabled","size","weight","className","children","required"],"sources":["../../../src/components/input/Label.tsx"],"sourcesContent":["import * as React from 'react';\nimport { cn } from '../../lib/cn';\nimport type { Size, TextWeight } from '../../lib/types';\n\n/** Properties for the Label component. */\nexport interface LabelProps extends React.LabelHTMLAttributes<HTMLLabelElement> {\n /** Whether to show a required indicator asterisk (hidden from assistive technology; mark the\n * control itself `required`).\n * @default false\n */\n required?: boolean;\n /** Whether the label is visually dimmed.\n * @default false\n */\n disabled?: boolean;\n /** Text size of the label: `small` = caption-1, `medium` = body-1, `large` = body-2.\n * @default 'medium'\n */\n size?: Extract<Size, 'small' | 'medium' | 'large'>;\n /** Font weight of the label (the shared `TextWeight` vocabulary).\n * @default 'regular'\n */\n weight?: TextWeight;\n /** Ref to the `<label>` element. */\n ref?: React.Ref<HTMLLabelElement>;\n}\n\nconst sizeMap: Record<'small' | 'medium' | 'large', string> = {\n small: 'text-caption-1',\n medium: 'text-body-1',\n large: 'text-body-2',\n};\n\nconst weightMap: Record<TextWeight, string | undefined> = {\n regular: undefined,\n semibold: 'font-semibold',\n bold: 'font-bold',\n};\n\n/**\n * A text label for a form control (`htmlFor`), on the Fluent type ramp. The optional required\n * asterisk is decorative (`aria-hidden`). `Field` renders its own label; use `Label` for custom\n * layouts.\n *\n * @example\n * <Label htmlFor=\"email\" required>Email</Label>\n * <Input id=\"email\" required />\n */\nexport const Label = ({\n required = false,\n disabled = false,\n size = 'medium',\n weight = 'regular',\n className,\n children,\n ref,\n ...rest\n}: LabelProps) => {\n return (\n <label\n ref={ref}\n className={cn(\n disabled ? 'text-muted-foreground' : 'text-foreground',\n sizeMap[size],\n weightMap[weight],\n className,\n )}\n {...rest}\n >\n {children}\n {required && (\n <span className=\"ms-1 text-error\" aria-hidden=\"true\">\n *\n </span>\n )}\n </label>\n );\n};\n\nLabel.displayName = 'Label';\n"],"mappings":";;;;;AA2BA,IAAMA,IAAwD;CAC5D,OAAO;CACP,QAAQ;CACR,OAAO;AACT,GAEMC,IAAoD;CACxD,SAAS,KAAA;CACT,UAAU;CACV,MAAM;AACR,GAWaC,KAAS,EACpB,cAAW,IACX,cAAW,IACX,UAAO,UACP,YAAS,WACT,cACA,aACA,QACA,GAAGC,QAGD,kBAAC,SAAD;CACO;CACL,WAAWC,EACTC,IAAW,0BAA0B,mBACrCL,EAAQM,IACRL,EAAUM,IACVC,CACF;CACA,GAAIL;CARN,UAAA,CAUGM,GACAC,KACC,kBAAC,QAAD;EAAM,WAAU;EAAkB,eAAY;EAAO,UAAA;CAE/C,CAAA,CAEH;;AAIX,EAAM,cAAc"}
@@ -0,0 +1,2 @@
1
+ "use client";const e=require("../../_virtual/_rolldown/runtime.cjs"),t=require("../../lib/cn.cjs"),n=require("../../lib/composeEventHandlers.cjs"),r=require("../../hooks/useId.cjs"),i=require("../../hooks/useMergedRefs.cjs"),a=require("../../hooks/useDismiss.cjs"),o=require("../portal/Portal.cjs"),s=require("../../lib/styles.cjs"),c=require("../../lib/icons.cjs"),l=require("../../hooks/useListbox.cjs"),u=require("../../hooks/usePopupPosition.cjs");let d=require("react");d=e.__toESM(d,1);let f=require("react/jsx-runtime");var p=d.createContext(!0);p.displayName=`OptionCheckContext`;var m=t.cn(`flex cursor-pointer select-none items-center gap-2 px-3 py-1.5 text-body-1 text-foreground`,`bg-(--option-bg) [--option-bg:transparent]`,`not-disabled:not-aria-disabled:hover:[--option-bg:var(--wave-subtle-hover)]`,`data-[selected]:[--option-bg:var(--wave-subtle-selected)]`,`data-[active]:[--option-bg:var(--wave-subtle-hover)]`,`data-[active]:outline-2 data-[active]:-outline-offset-2 data-[active]:outline-ring`,`aria-disabled:cursor-not-allowed aria-disabled:text-muted-foreground`),h=class{counts=new Map;listeners=new Set;subscribe=e=>(this.listeners.add(e),()=>{this.listeners.delete(e)});add(e){return this.counts.set(e,(this.counts.get(e)??0)+1),this.notify(),()=>{let t=(this.counts.get(e)??1)-1;t>0?this.counts.set(e,t):this.counts.delete(e),this.notify()}}allHidden(e){if(e===void 0||this.counts.size===0)return!1;for(let t of this.counts.keys())if(!e.isHidden(t))return!1;return!0}notify(){for(let e of[...this.listeners])e()}},g=d.createContext([]);g.displayName=`OptionGroupContext`;var _=d.createContext(!1);_.displayName=`OptionGroupHiddenContext`;function v(e){let t=d.useContext(g);d.useLayoutEffect(()=>{if(t.length===0)return;let n=t.map(t=>t.add(e));return()=>{for(let e of n)e()}},[t,e])}function y(e){let{value:r,label:i,textValue:a,disabled:o=!1,hidden:u=!1,className:h,children:g,onClick:y,onPointerMove:b,ref:x,...S}=e,C=d.useContext(p),w=d.useContext(_),{selected:T,optionProps:E}=l.useListboxOption({value:r,label:i,textValue:a,disabled:o,hidden:u||w},x);v(r);let{ref:D,onClick:O,onPointerMove:k,...A}=E;return(0,f.jsxs)(`li`,{"data-value":r,...S,...A,ref:D,onClick:n.composeEventHandlers(y,O),onPointerMove:n.composeEventHandlers(b,k),className:t.cn(m,T&&s.forcedColors.selectedContainer,h),children:[C&&(0,f.jsx)(c.CheckIcon,{className:t.cn(`shrink-0`,!T&&`invisible`)}),(0,f.jsx)(`span`,{className:`min-w-0 flex-1`,children:g??r})]})}y.displayName=`Option`;var b=d.memo(y);b.displayName=`Option`;var x=l.markListboxElement(b,`option`);function S({label:e,className:t,children:n,hidden:i,ref:a,...o}){let s=r.useId(`option-group`),c=d.useContext(l.ListboxContext)?.store,u=d.useContext(g),p=d.useContext(_)||!!i,[m]=d.useState(()=>new h),v=d.useMemo(()=>[...u,m],[u,m]),y=d.useCallback(e=>{let t=m.subscribe(e),n=c?.subscribe(e);return()=>{t(),n?.()}},[m,c]),b=d.useSyncExternalStore(y,()=>m.allHidden(c),()=>!1);return(0,f.jsxs)(`li`,{...o,ref:a,role:`presentation`,hidden:i||b||void 0,className:t,children:[(0,f.jsx)(`div`,{id:s,role:`presentation`,className:`px-3 py-1 text-caption-1 font-semibold text-muted-foreground`,children:e}),(0,f.jsx)(`ul`,{role:`group`,"aria-labelledby":s,children:(0,f.jsx)(_.Provider,{value:p,children:(0,f.jsx)(g.Provider,{value:v,children:n})})})]})}S.displayName=`OptionGroup`;var C=l.markListboxElement(S,`group`);function w(e){let{open:t,surfaceOpen:n,onDismiss:r,rootRef:o,anchorRef:s}=e,c=d.useRef(null),{setReference:l,setFloating:f,floatingProps:p}=u.usePopupPosition({open:n,side:`bottom`,align:`start`,matchReferenceWidth:!0,fitViewport:!0}),{layerId:m}=a.useDismiss({open:t,onDismiss:e=>r(e),refs:[o,c],anchorRef:s,kind:`listbox`,escape:n,focusOutside:!0});return{layerId:m,setReference:l,surfaceRef:i.useMergedRefs(c,f),floatingProps:p}}function T(e){e.preventDefault()}function E(e){let{listbox:t,layerId:n,surfaceRef:r,floatingProps:i,open:a,expanded:s,emptyContent:c,"aria-label":u,"aria-labelledby":d,showCheck:m=!0,children:h}=e,g=(0,f.jsx)(p.Provider,{value:m,children:(0,f.jsx)(l.ListboxContext.Provider,{value:t.context,children:(0,f.jsx)(`ul`,{...t.getListboxProps(),"aria-label":u,"aria-labelledby":d,hidden:!s||void 0,className:`min-h-0 max-h-60 overflow-auto`,children:h})})});return!s&&(!a||s||c==null)?g:(0,f.jsxs)(f.Fragment,{children:[!s&&g,(0,f.jsx)(o.Portal,{layerId:n,children:(0,f.jsx)(`div`,{ref:r,...i,"data-wave-listbox-surface":``,onMouseDown:T,className:`flex flex-col overflow-hidden rounded border border-border bg-background py-1 text-foreground shadow-4`,children:s?g:c})})]})}E.displayName=`ListboxSurface`,exports.ListboxSurface=E,exports.Option=x,exports.OptionGroup=C,exports.useListboxPopup=w;
2
+ //# sourceMappingURL=Option.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Option.cjs","names":["React","cn","useListboxOption","composeEventHandlers","forcedColors","CheckIcon","useId","ListboxContext","usePopupPosition","useDismiss","useMergedRefs","_Fragment","Portal","require_runtime","require_cn","require_composeEventHandlers","require_useId","require_useMergedRefs","require_useDismiss","require_Portal","require_styles","require_icons","require_useListbox","require_usePopupPosition","react","react_jsx_runtime","OptionCheckContext","OPTION_CLASSES","OptionGroupMembers","listener","value","count","store","OptionGroupContext","OptionGroupHiddenContext","useOptionGroupMembership","groups","removes","group","remove","OptionImpl","rest","props","showCheck","groupHidden","hidden","ref","optionRef","selectOption","highlightOption","optionAttributes","optionProps","onClick","onPointerMove","selected","className","children","MemoOption","Option","OptionGroupImpl","labelId","parentGroups","hiddenByConsumer","members","subscribe","unsubscribeMembers","unsubscribeStore","empty","label","OptionGroup","useListboxPopup","options","surfaceElementRef","surfaceOpen","onDismiss","reason","rootRef","setFloating","preventMouseDown","event","ListboxSurface","ariaLabel","ariaLabelledBy","list","listbox","expanded","emptyContent","surfaceRef","floatingProps"],"sources":["../../../src/components/input/Option.tsx"],"sourcesContent":["import * as React from 'react';\nimport { cn } from '../../lib/cn';\nimport { composeEventHandlers } from '../../lib/composeEventHandlers';\nimport { CheckIcon } from '../../lib/icons';\nimport { forcedColors } from '../../lib/styles';\nimport { useId } from '../../hooks/useId';\nimport { useMergedRefs } from '../../hooks/useMergedRefs';\nimport { useDismiss } from '../../hooks/useDismiss';\nimport type { DismissReason } from '../../hooks/useDismiss';\nimport { usePopupPosition } from '../../hooks/usePopupPosition';\nimport {\n ListboxContext,\n markListboxElement,\n useListboxOption,\n type ListboxStore,\n type UseListboxResult,\n} from '../../hooks/useListbox';\nimport { Portal } from '../portal/Portal';\n\n/* ------------------------------------------------------------------ */\n/* Option */\n/* ------------------------------------------------------------------ */\n\n/** Properties for the Option component used within Combobox and Dropdown. */\nexport interface OptionProps extends Omit<React.LiHTMLAttributes<HTMLLIElement>, 'value'> {\n /** Value associated with this option. Unique within its listbox. */\n value: string;\n /**\n * Text shown in the combobox (Combobox input, Dropdown trigger) when this option is selected.\n * Defaults to `textValue`, then the option's text content, then `value`. Pass it when the\n * children are not plain text (icons, custom components).\n */\n label?: string;\n /** Text matched by typeahead and filtering instead of the label. */\n textValue?: string;\n /**\n * Whether the option is disabled: it stays visible but is skipped by keyboard navigation and\n * cannot be selected.\n * @default false\n */\n disabled?: boolean;\n /**\n * Hides the option, like a native `<option hidden>`: it is not shown, keyboard navigation and\n * typeahead skip it, and it never becomes the active option. Its label stays known, so a\n * selected hidden option (a placeholder) still shows in the combobox. The options of a hidden\n * `OptionGroup` are hidden the same way.\n * @default false\n */\n hidden?: boolean;\n /** Ref to the option `<li>` element. */\n ref?: React.Ref<HTMLLIElement>;\n}\n\n/** Whether options draw the selected check mark (P05-internal; TagPicker lists no selected options). */\nconst OptionCheckContext = React.createContext(true);\nOptionCheckContext.displayName = 'OptionCheckContext';\n\n/*\n * State is exposed as data attributes (C-CLASS): `data-active` (keyboard/pointer highlight),\n * `data-selected`, `data-disabled`. State classes come before the consumer's `className` in `cn()`.\n *\n * Backgrounds (input-pickers#20): one unconditional `bg-(--option-bg)` paints the option, and the\n * hover/selected/active variants only set `--option-bg`. A variant that set `background-color`\n * itself (class + attribute or pseudo-class) would out-specify a consumer's plain `bg-*` class in\n * the cascade even though `cn()` keeps it; instead tailwind-merge replaces `bg-(--option-bg)` with\n * the consumer's class, which is then the only background declaration on the option. A consumer\n * `data-[active]:bg-…` / `data-[selected]:bg-…` restyles a single state (it out-specifies the\n * unconditional reader). The active outline is the focus indicator and stays a state variant.\n *\n * A filtered-out option carries the `hidden` attribute; base.css's scoped `[hidden]` rule hides\n * it over `flex` and over a consumer's display class.\n */\nconst OPTION_CLASSES = cn(\n 'flex cursor-pointer select-none items-center gap-2 px-3 py-1.5 text-body-1 text-foreground',\n 'bg-(--option-bg) [--option-bg:transparent]',\n 'not-disabled:not-aria-disabled:hover:[--option-bg:var(--wave-subtle-hover)]',\n 'data-[selected]:[--option-bg:var(--wave-subtle-selected)]',\n 'data-[active]:[--option-bg:var(--wave-subtle-hover)]',\n 'data-[active]:outline-2 data-[active]:-outline-offset-2 data-[active]:outline-ring',\n 'aria-disabled:cursor-not-allowed aria-disabled:text-muted-foreground',\n);\n\n/**\n * The values of the options rendered inside an `OptionGroup`, whatever wraps them (custom\n * components, Fragments, nested groups): each option adds its value from a layout effect.\n */\nclass OptionGroupMembers {\n private readonly counts = new Map<string, number>();\n private readonly listeners = new Set<() => void>();\n\n subscribe = (listener: () => void): (() => void) => {\n this.listeners.add(listener);\n return () => {\n this.listeners.delete(listener);\n };\n };\n\n add(value: string): () => void {\n this.counts.set(value, (this.counts.get(value) ?? 0) + 1);\n this.notify();\n return () => {\n const count = (this.counts.get(value) ?? 1) - 1;\n if (count > 0) this.counts.set(value, count);\n else this.counts.delete(value);\n this.notify();\n };\n }\n\n /** At least one option, and every one of them is hidden (filtered out, or by the consumer). */\n allHidden(store: ListboxStore | undefined): boolean {\n if (store === undefined || this.counts.size === 0) return false;\n for (const value of this.counts.keys()) if (!store.isHidden(value)) return false;\n return true;\n }\n\n private notify(): void {\n for (const listener of [...this.listeners]) listener();\n }\n}\n\n/** The groups around an option, outermost first (P05-internal). */\nconst OptionGroupContext = React.createContext<readonly OptionGroupMembers[]>([]);\nOptionGroupContext.displayName = 'OptionGroupContext';\n\n/** A group around the option has the consumer's `hidden` attribute (P05-internal). */\nconst OptionGroupHiddenContext = React.createContext(false);\nOptionGroupHiddenContext.displayName = 'OptionGroupHiddenContext';\n\n/** Adds an option's value to every group around it while the option is mounted. */\nfunction useOptionGroupMembership(value: string): void {\n const groups = React.useContext(OptionGroupContext);\n React.useLayoutEffect(() => {\n if (groups.length === 0) return;\n const removes = groups.map((group) => group.add(value));\n return () => {\n for (const remove of removes) remove();\n };\n }, [groups, value]);\n}\n\nfunction OptionImpl(props: OptionProps) {\n const {\n value,\n label,\n textValue,\n disabled = false,\n hidden = false,\n className,\n children,\n onClick,\n onPointerMove,\n ref,\n ...rest\n } = props;\n const showCheck = React.useContext(OptionCheckContext);\n const groupHidden = React.useContext(OptionGroupHiddenContext);\n // A consumer-hidden option is not navigable; optionProps renders `hidden`.\n const { selected, optionProps } = useListboxOption<HTMLLIElement>(\n { value, label, textValue, disabled, hidden: hidden || groupHidden },\n ref,\n );\n useOptionGroupMembership(value);\n const {\n ref: optionRef,\n onClick: selectOption,\n onPointerMove: highlightOption,\n ...optionAttributes\n } = optionProps;\n\n return (\n <li\n data-value={value}\n {...rest}\n {...optionAttributes}\n ref={optionRef}\n onClick={composeEventHandlers(onClick, selectOption)}\n onPointerMove={composeEventHandlers(onPointerMove, highlightOption)}\n className={cn(OPTION_CLASSES, selected && forcedColors.selectedContainer, className)}\n >\n {showCheck && <CheckIcon className={cn('shrink-0', !selected && 'invisible')} />}\n <span className=\"min-w-0 flex-1\">{children ?? value}</span>\n </li>\n );\n}\nOptionImpl.displayName = 'Option';\n\nconst MemoOption = /* @__PURE__ */ React.memo(OptionImpl);\nMemoOption.displayName = 'Option';\n\n/**\n * An option of a `Combobox`, `Dropdown` (and `TagPicker`'s generated list). Renders\n * `<li role=\"option\">` with a stable id (`aria-activedescendant` target), `aria-selected`, a check\n * mark while selected and `data-active`/`data-selected`/`data-disabled` attributes for styling.\n *\n * Options register with the surrounding listbox (in DOM order, groups included), so they can be\n * wrapped, grouped or rendered conditionally. The option is memoized: moving the highlight\n * re-renders only the previously and the newly active option.\n *\n * Styling: `className` comes last. A plain background class (`className=\"bg-primary\"`) replaces\n * the built-in hover, selected and active backgrounds in every state. To restyle one state only,\n * use its data variant (`data-[active]:bg-…`, `data-[selected]:bg-…`). The active option keeps\n * its focus outline.\n *\n * Use it inside a `Combobox` or `Dropdown` only; it throws in development elsewhere.\n */\nexport const Option: React.NamedExoticComponent<OptionProps> = /* @__PURE__ */ markListboxElement(\n MemoOption,\n 'option',\n);\n\n/* ------------------------------------------------------------------ */\n/* OptionGroup */\n/* ------------------------------------------------------------------ */\n\n/** Properties for the OptionGroup component used to group options. */\nexport interface OptionGroupProps extends React.LiHTMLAttributes<HTMLLIElement> {\n /** Heading label for the option group (names the group). */\n label: string;\n /**\n * Hides the group and every option in it (see `Option`'s `hidden`): keyboard navigation and\n * typeahead skip its options.\n * @default false\n */\n hidden?: boolean;\n /** Ref to the group's `<li role=\"presentation\">` element. */\n ref?: React.Ref<HTMLLIElement>;\n}\n\nfunction OptionGroupImpl({ label, className, children, hidden, ref, ...rest }: OptionGroupProps) {\n const labelId = useId('option-group');\n const store = React.useContext(ListboxContext)?.store;\n const parentGroups = React.useContext(OptionGroupContext);\n const hiddenByConsumer = React.useContext(OptionGroupHiddenContext) || !!hidden;\n const [members] = React.useState(() => new OptionGroupMembers());\n const groups = React.useMemo(() => [...parentGroups, members], [parentGroups, members]);\n const subscribe = React.useCallback(\n (listener: () => void) => {\n const unsubscribeMembers = members.subscribe(listener);\n const unsubscribeStore = store?.subscribe(listener);\n return () => {\n unsubscribeMembers();\n unsubscribeStore?.();\n };\n },\n [members, store],\n );\n // Hidden while every option inside it is filtered out or hidden, also options wrapped in a\n // component (the options register with the group; re-read when they do and when the listbox\n // state changes).\n // The server render and the first client render show the group: no option has registered yet.\n const empty = React.useSyncExternalStore(\n subscribe,\n () => members.allHidden(store),\n () => false,\n );\n\n return (\n <li\n {...rest}\n ref={ref}\n role=\"presentation\"\n hidden={hidden || empty || undefined}\n className={className}\n >\n <div\n id={labelId}\n role=\"presentation\"\n className=\"px-3 py-1 text-caption-1 font-semibold text-muted-foreground\"\n >\n {label}\n </div>\n <ul role=\"group\" aria-labelledby={labelId}>\n <OptionGroupHiddenContext.Provider value={hiddenByConsumer}>\n <OptionGroupContext.Provider value={groups}>{children}</OptionGroupContext.Provider>\n </OptionGroupHiddenContext.Provider>\n </ul>\n </li>\n );\n}\nOptionGroupImpl.displayName = 'OptionGroup';\n\n/**\n * Groups options under a heading: `<li role=\"presentation\">` with the heading and a\n * `<ul role=\"group\" aria-labelledby>` of the options. Hidden while a filter (or their own `hidden`)\n * hides all its options, also options wrapped in a component or in nested groups.\n */\nexport const OptionGroup: React.FC<OptionGroupProps> = /* @__PURE__ */ markListboxElement(\n OptionGroupImpl,\n 'group',\n);\n\n/* ------------------------------------------------------------------ */\n/* Listbox popup (P05-internal, shared by Combobox, Dropdown, TagPicker) */\n/* ------------------------------------------------------------------ */\n\n/** Options of {@link useListboxPopup}. */\nexport interface UseListboxPopupOptions {\n /** The listbox is open (dismiss layer registered: outside press, focus outside). */\n open: boolean;\n /**\n * The portaled surface is shown: positioning runs and the layer takes Escape. While the listbox\n * is open with nothing shown (no options), Escape is left to an enclosing layer (overlays#1).\n */\n surfaceOpen: boolean;\n /** Close the listbox. */\n onDismiss: (reason: DismissReason) => void;\n /** The component root: presses and focus inside it are not \"outside\". */\n rootRef: React.RefObject<HTMLElement | null>;\n /** The combobox element (the layer's anchor). */\n anchorRef: React.RefObject<HTMLElement | null>;\n}\n\n/** Result of {@link useListboxPopup}. Destructure it (react-hooks/refs). */\nexport interface ListboxPopup {\n /** The dismiss layer id (pass to {@link ListboxSurface}). */\n layerId: string;\n /** Ref callback for the element the surface is positioned against. */\n setReference: (el: HTMLElement | null) => void;\n /** Ref callback for the surface. */\n surfaceRef: React.RefCallback<HTMLElement>;\n /** `data-side`, `data-align` and the position style for the surface. */\n floatingProps: { 'data-side': string; 'data-align': string; style: React.CSSProperties };\n}\n\n/**\n * Dismissal and positioning of a listbox surface (C-POPUPS, spec §5.4): `useDismiss` (Escape,\n * outside press, focus outside; `kind: 'listbox'`) and `usePopupPosition` (bottom-start, flip,\n * shift, the anchor's width, limited to the available space).\n */\nexport function useListboxPopup(options: UseListboxPopupOptions): ListboxPopup {\n const { open, surfaceOpen, onDismiss, rootRef, anchorRef } = options;\n const surfaceElementRef = React.useRef<HTMLElement | null>(null);\n const { setReference, setFloating, floatingProps } = usePopupPosition({\n open: surfaceOpen,\n side: 'bottom',\n align: 'start',\n matchReferenceWidth: true,\n fitViewport: true,\n });\n const { layerId } = useDismiss({\n open,\n onDismiss: (reason) => onDismiss(reason),\n refs: [rootRef, surfaceElementRef],\n anchorRef,\n kind: 'listbox',\n escape: surfaceOpen,\n focusOutside: true,\n });\n const surfaceRef = useMergedRefs<HTMLElement>(surfaceElementRef, setFloating);\n return { layerId, setReference, surfaceRef, floatingProps };\n}\n\n/** Props of {@link ListboxSurface}. */\nexport interface ListboxSurfaceProps {\n /** The listbox (from `useListbox`). */\n listbox: UseListboxResult;\n /** From {@link useListboxPopup}. */\n layerId: string;\n surfaceRef: React.RefCallback<HTMLElement>;\n floatingProps: ListboxPopup['floatingProps'];\n /** The listbox is open: `emptyContent` is shown only while it is (input-pickers#21). */\n open: boolean;\n /** The listbox is displayed: the list renders in the portaled surface. */\n expanded: boolean;\n /** While open but not expanded, show the surface with this content (e.g. \"No matches\"). */\n emptyContent?: React.ReactNode;\n /** Accessible name of the listbox. */\n 'aria-label'?: string;\n 'aria-labelledby'?: string;\n /** Options draw a check mark while selected. @default true */\n showCheck?: boolean;\n children?: React.ReactNode;\n}\n\nfunction preventMouseDown(event: React.MouseEvent) {\n event.preventDefault();\n}\n\n/**\n * Renders the option list in a single container at a time (spec §2.5, §5.5): inline and `hidden`\n * inside the component root while closed (registration and ids exist from the first client\n * commit), and in a `Portal` surface while expanded — never both.\n */\nexport function ListboxSurface(props: ListboxSurfaceProps) {\n const {\n listbox,\n layerId,\n surfaceRef,\n floatingProps,\n open,\n expanded,\n emptyContent,\n 'aria-label': ariaLabel,\n 'aria-labelledby': ariaLabelledBy,\n showCheck = true,\n children,\n } = props;\n\n const list = (\n <OptionCheckContext.Provider value={showCheck}>\n <ListboxContext.Provider value={listbox.context}>\n <ul\n {...listbox.getListboxProps()}\n aria-label={ariaLabel}\n aria-labelledby={ariaLabelledBy}\n hidden={!expanded || undefined}\n className=\"min-h-0 max-h-60 overflow-auto\"\n >\n {children}\n </ul>\n </ListboxContext.Provider>\n </OptionCheckContext.Provider>\n );\n\n // A closed listbox never leaves a surface behind: the text typed before closing survives it.\n const showEmpty = open && !expanded && emptyContent !== undefined && emptyContent !== null;\n if (!expanded && !showEmpty) return list;\n\n return (\n <>\n {!expanded && list}\n <Portal layerId={layerId}>\n <div\n ref={surfaceRef}\n {...floatingProps}\n data-wave-listbox-surface=\"\"\n onMouseDown={preventMouseDown}\n className=\"flex flex-col overflow-hidden rounded border border-border bg-background py-1 text-foreground shadow-4\"\n >\n {expanded ? list : emptyContent}\n </div>\n </Portal>\n </>\n );\n}\nListboxSurface.displayName = 'ListboxSurface';\n"],"mappings":"+gBAsDA,IAAM0B,EAAqB1B,EAAM,cAAc,EAAI,EACnD,EAAmB,YAAc,qBAiBjC,IAAM2B,EAAiB1B,EAAAA,GACrB,6FACA,6CACA,8EACA,4DACA,uDACA,qFACA,sEACF,EAMM2B,EAAN,KAAyB,CACvB,OAA0B,IAAI,IAC9B,UAA6B,IAAI,IAEjC,UAAa,IACX,KAAK,UAAU,IAAIC,CAAQ,MACd,CACX,KAAK,UAAU,OAAOA,CAAQ,CAChC,GAGF,IAAI,EAA2B,CAG7B,OAFA,KAAK,OAAO,IAAIC,GAAQ,KAAK,OAAO,IAAIA,CAAK,GAAK,GAAK,CAAC,EACxD,KAAK,OAAO,MACC,CACX,IAAMC,GAAS,KAAK,OAAO,IAAID,CAAK,GAAK,GAAK,EAC1CC,EAAQ,EAAG,KAAK,OAAO,IAAID,EAAOC,CAAK,EACtC,KAAK,OAAO,OAAOD,CAAK,EAC7B,KAAK,OAAO,CACd,CACF,CAGA,UAAU,EAA0C,CAClD,GAAIE,IAAU,IAAA,IAAa,KAAK,OAAO,OAAS,EAAG,MAAO,GAC1D,IAAK,IAAMF,KAAS,KAAK,OAAO,KAAK,EAAG,GAAI,CAACE,EAAM,SAASF,CAAK,EAAG,MAAO,GAC3E,MAAO,EACT,CAEA,QAAuB,CACrB,IAAK,IAAMD,IAAY,CAAC,GAAG,KAAK,SAAS,EAAGA,EAAS,CACvD,CACF,EAGMI,EAAqBjC,EAAM,cAA6C,CAAC,CAAC,EAChF,EAAmB,YAAc,qBAGjC,IAAMkC,EAA2BlC,EAAM,cAAc,EAAK,EAC1D,EAAyB,YAAc,2BAGvC,SAASmC,EAAyB,EAAqB,CAC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,EAAAa,EAAA,IAAA,CAAC,MAAD,CACE,IAAK8D,EACL,GAAIC,EACJ,4BAA0B,GAC1B,YAAaV,EACb,UAAU,yGAET,SAAAO,EAAWF,EAAOG,CAChB,CAAA,CACC,CAAA,CACR,CAAA,CAAA,CAEN,CACA,EAAe,YAAc"}
@@ -0,0 +1,169 @@
1
+ "use client";
2
+ import { cn as e } from "../../lib/cn.mjs";
3
+ import { composeEventHandlers as t } from "../../lib/composeEventHandlers.mjs";
4
+ import { useId as n } from "../../hooks/useId.mjs";
5
+ import { useMergedRefs as r } from "../../hooks/useMergedRefs.mjs";
6
+ import { useDismiss as i } from "../../hooks/useDismiss.mjs";
7
+ import { Portal as a } from "../portal/Portal.mjs";
8
+ import { forcedColors as o } from "../../lib/styles.mjs";
9
+ import { CheckIcon as s } from "../../lib/icons.mjs";
10
+ import { ListboxContext as c, markListboxElement as l, useListboxOption as u } from "../../hooks/useListbox.mjs";
11
+ import { usePopupPosition as d } from "../../hooks/usePopupPosition.mjs";
12
+ import * as f from "react";
13
+ import { Fragment as p, jsx as m, jsxs as h } from "react/jsx-runtime";
14
+ //#region src/components/input/Option.tsx
15
+ var g = f.createContext(!0);
16
+ g.displayName = "OptionCheckContext";
17
+ var _ = e("flex cursor-pointer select-none items-center gap-2 px-3 py-1.5 text-body-1 text-foreground", "bg-(--option-bg) [--option-bg:transparent]", "not-disabled:not-aria-disabled:hover:[--option-bg:var(--wave-subtle-hover)]", "data-[selected]:[--option-bg:var(--wave-subtle-selected)]", "data-[active]:[--option-bg:var(--wave-subtle-hover)]", "data-[active]:outline-2 data-[active]:-outline-offset-2 data-[active]:outline-ring", "aria-disabled:cursor-not-allowed aria-disabled:text-muted-foreground"), v = class {
18
+ counts = /* @__PURE__ */ new Map();
19
+ listeners = /* @__PURE__ */ new Set();
20
+ subscribe = (e) => (this.listeners.add(e), () => {
21
+ this.listeners.delete(e);
22
+ });
23
+ add(e) {
24
+ return this.counts.set(e, (this.counts.get(e) ?? 0) + 1), this.notify(), () => {
25
+ let t = (this.counts.get(e) ?? 1) - 1;
26
+ t > 0 ? this.counts.set(e, t) : this.counts.delete(e), this.notify();
27
+ };
28
+ }
29
+ allHidden(e) {
30
+ if (e === void 0 || this.counts.size === 0) return !1;
31
+ for (let t of this.counts.keys()) if (!e.isHidden(t)) return !1;
32
+ return !0;
33
+ }
34
+ notify() {
35
+ for (let e of [...this.listeners]) e();
36
+ }
37
+ }, y = f.createContext([]);
38
+ y.displayName = "OptionGroupContext";
39
+ var b = f.createContext(!1);
40
+ b.displayName = "OptionGroupHiddenContext";
41
+ function x(e) {
42
+ let t = f.useContext(y);
43
+ f.useLayoutEffect(() => {
44
+ if (t.length === 0) return;
45
+ let n = t.map((t) => t.add(e));
46
+ return () => {
47
+ for (let e of n) e();
48
+ };
49
+ }, [t, e]);
50
+ }
51
+ function S(n) {
52
+ let { value: r, label: i, textValue: a, disabled: c = !1, hidden: l = !1, className: d, children: p, onClick: v, onPointerMove: y, ref: S, ...C } = n, w = f.useContext(g), T = f.useContext(b), { selected: E, optionProps: D } = u({
53
+ value: r,
54
+ label: i,
55
+ textValue: a,
56
+ disabled: c,
57
+ hidden: l || T
58
+ }, S);
59
+ x(r);
60
+ let { ref: O, onClick: k, onPointerMove: A, ...j } = D;
61
+ return /* @__PURE__ */ h("li", {
62
+ "data-value": r,
63
+ ...C,
64
+ ...j,
65
+ ref: O,
66
+ onClick: t(v, k),
67
+ onPointerMove: t(y, A),
68
+ className: e(_, E && o.selectedContainer, d),
69
+ children: [w && /* @__PURE__ */ m(s, { className: e("shrink-0", !E && "invisible") }), /* @__PURE__ */ m("span", {
70
+ className: "min-w-0 flex-1",
71
+ children: p ?? r
72
+ })]
73
+ });
74
+ }
75
+ S.displayName = "Option";
76
+ var C = /* @__PURE__ */ f.memo(S);
77
+ C.displayName = "Option";
78
+ var w = /* @__PURE__ */ l(C, "option");
79
+ function T({ label: e, className: t, children: r, hidden: i, ref: a, ...o }) {
80
+ let s = n("option-group"), l = f.useContext(c)?.store, u = f.useContext(y), d = f.useContext(b) || !!i, [p] = f.useState(() => new v()), g = f.useMemo(() => [...u, p], [u, p]), _ = f.useCallback((e) => {
81
+ let t = p.subscribe(e), n = l?.subscribe(e);
82
+ return () => {
83
+ t(), n?.();
84
+ };
85
+ }, [p, l]), x = f.useSyncExternalStore(_, () => p.allHidden(l), () => !1);
86
+ return /* @__PURE__ */ h("li", {
87
+ ...o,
88
+ ref: a,
89
+ role: "presentation",
90
+ hidden: i || x || void 0,
91
+ className: t,
92
+ children: [/* @__PURE__ */ m("div", {
93
+ id: s,
94
+ role: "presentation",
95
+ className: "px-3 py-1 text-caption-1 font-semibold text-muted-foreground",
96
+ children: e
97
+ }), /* @__PURE__ */ m("ul", {
98
+ role: "group",
99
+ "aria-labelledby": s,
100
+ children: /* @__PURE__ */ m(b.Provider, {
101
+ value: d,
102
+ children: /* @__PURE__ */ m(y.Provider, {
103
+ value: g,
104
+ children: r
105
+ })
106
+ })
107
+ })]
108
+ });
109
+ }
110
+ T.displayName = "OptionGroup";
111
+ var E = /* @__PURE__ */ l(T, "group");
112
+ function D(e) {
113
+ let { open: t, surfaceOpen: n, onDismiss: a, rootRef: o, anchorRef: s } = e, c = f.useRef(null), { setReference: l, setFloating: u, floatingProps: p } = d({
114
+ open: n,
115
+ side: "bottom",
116
+ align: "start",
117
+ matchReferenceWidth: !0,
118
+ fitViewport: !0
119
+ }), { layerId: m } = i({
120
+ open: t,
121
+ onDismiss: (e) => a(e),
122
+ refs: [o, c],
123
+ anchorRef: s,
124
+ kind: "listbox",
125
+ escape: n,
126
+ focusOutside: !0
127
+ });
128
+ return {
129
+ layerId: m,
130
+ setReference: l,
131
+ surfaceRef: r(c, u),
132
+ floatingProps: p
133
+ };
134
+ }
135
+ function O(e) {
136
+ e.preventDefault();
137
+ }
138
+ function k(e) {
139
+ let { listbox: t, layerId: n, surfaceRef: r, floatingProps: i, open: o, expanded: s, emptyContent: l, "aria-label": u, "aria-labelledby": d, showCheck: f = !0, children: _ } = e, v = /* @__PURE__ */ m(g.Provider, {
140
+ value: f,
141
+ children: /* @__PURE__ */ m(c.Provider, {
142
+ value: t.context,
143
+ children: /* @__PURE__ */ m("ul", {
144
+ ...t.getListboxProps(),
145
+ "aria-label": u,
146
+ "aria-labelledby": d,
147
+ hidden: !s || void 0,
148
+ className: "min-h-0 max-h-60 overflow-auto",
149
+ children: _
150
+ })
151
+ })
152
+ });
153
+ return !s && (!o || s || l == null) ? v : /* @__PURE__ */ h(p, { children: [!s && v, /* @__PURE__ */ m(a, {
154
+ layerId: n,
155
+ children: /* @__PURE__ */ m("div", {
156
+ ref: r,
157
+ ...i,
158
+ "data-wave-listbox-surface": "",
159
+ onMouseDown: O,
160
+ className: "flex flex-col overflow-hidden rounded border border-border bg-background py-1 text-foreground shadow-4",
161
+ children: s ? v : l
162
+ })
163
+ })] });
164
+ }
165
+ k.displayName = "ListboxSurface";
166
+ //#endregion
167
+ export { k as ListboxSurface, w as Option, E as OptionGroup, D as useListboxPopup };
168
+
169
+ //# sourceMappingURL=Option.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Option.mjs","names":["useId","_Fragment","useId$1","React","OptionCheckContext","OPTION_CLASSES","cn","OptionGroupMembers","listener","value","count","store","OptionGroupContext","OptionGroupHiddenContext","useOptionGroupMembership","groups","removes","group","remove","OptionImpl","rest","props","showCheck","groupHidden","useListboxOption","hidden","ref","optionRef","selectOption","highlightOption","optionAttributes","optionProps","composeEventHandlers","onClick","onPointerMove","selected","forcedColors","className","CheckIcon","children","MemoOption","Option","OptionGroupImpl","labelId","ListboxContext","parentGroups","hiddenByConsumer","members","subscribe","unsubscribeMembers","unsubscribeStore","empty","label","OptionGroup","useListboxPopup","options","surfaceElementRef","usePopupPosition","surfaceOpen","useDismiss","onDismiss","reason","rootRef","useMergedRefs","setFloating","preventMouseDown","ListboxSurface","ariaLabel","ariaLabelledBy","list","listbox","expanded","emptyContent","Fragment","Portal","surfaceRef","floatingProps"],"sources":["../../../src/components/input/Option.tsx"],"sourcesContent":["import * as React from 'react';\nimport { cn } from '../../lib/cn';\nimport { composeEventHandlers } from '../../lib/composeEventHandlers';\nimport { CheckIcon } from '../../lib/icons';\nimport { forcedColors } from '../../lib/styles';\nimport { useId } from '../../hooks/useId';\nimport { useMergedRefs } from '../../hooks/useMergedRefs';\nimport { useDismiss } from '../../hooks/useDismiss';\nimport type { DismissReason } from '../../hooks/useDismiss';\nimport { usePopupPosition } from '../../hooks/usePopupPosition';\nimport {\n ListboxContext,\n markListboxElement,\n useListboxOption,\n type ListboxStore,\n type UseListboxResult,\n} from '../../hooks/useListbox';\nimport { Portal } from '../portal/Portal';\n\n/* ------------------------------------------------------------------ */\n/* Option */\n/* ------------------------------------------------------------------ */\n\n/** Properties for the Option component used within Combobox and Dropdown. */\nexport interface OptionProps extends Omit<React.LiHTMLAttributes<HTMLLIElement>, 'value'> {\n /** Value associated with this option. Unique within its listbox. */\n value: string;\n /**\n * Text shown in the combobox (Combobox input, Dropdown trigger) when this option is selected.\n * Defaults to `textValue`, then the option's text content, then `value`. Pass it when the\n * children are not plain text (icons, custom components).\n */\n label?: string;\n /** Text matched by typeahead and filtering instead of the label. */\n textValue?: string;\n /**\n * Whether the option is disabled: it stays visible but is skipped by keyboard navigation and\n * cannot be selected.\n * @default false\n */\n disabled?: boolean;\n /**\n * Hides the option, like a native `<option hidden>`: it is not shown, keyboard navigation and\n * typeahead skip it, and it never becomes the active option. Its label stays known, so a\n * selected hidden option (a placeholder) still shows in the combobox. The options of a hidden\n * `OptionGroup` are hidden the same way.\n * @default false\n */\n hidden?: boolean;\n /** Ref to the option `<li>` element. */\n ref?: React.Ref<HTMLLIElement>;\n}\n\n/** Whether options draw the selected check mark (P05-internal; TagPicker lists no selected options). */\nconst OptionCheckContext = React.createContext(true);\nOptionCheckContext.displayName = 'OptionCheckContext';\n\n/*\n * State is exposed as data attributes (C-CLASS): `data-active` (keyboard/pointer highlight),\n * `data-selected`, `data-disabled`. State classes come before the consumer's `className` in `cn()`.\n *\n * Backgrounds (input-pickers#20): one unconditional `bg-(--option-bg)` paints the option, and the\n * hover/selected/active variants only set `--option-bg`. A variant that set `background-color`\n * itself (class + attribute or pseudo-class) would out-specify a consumer's plain `bg-*` class in\n * the cascade even though `cn()` keeps it; instead tailwind-merge replaces `bg-(--option-bg)` with\n * the consumer's class, which is then the only background declaration on the option. A consumer\n * `data-[active]:bg-…` / `data-[selected]:bg-…` restyles a single state (it out-specifies the\n * unconditional reader). The active outline is the focus indicator and stays a state variant.\n *\n * A filtered-out option carries the `hidden` attribute; base.css's scoped `[hidden]` rule hides\n * it over `flex` and over a consumer's display class.\n */\nconst OPTION_CLASSES = cn(\n 'flex cursor-pointer select-none items-center gap-2 px-3 py-1.5 text-body-1 text-foreground',\n 'bg-(--option-bg) [--option-bg:transparent]',\n 'not-disabled:not-aria-disabled:hover:[--option-bg:var(--wave-subtle-hover)]',\n 'data-[selected]:[--option-bg:var(--wave-subtle-selected)]',\n 'data-[active]:[--option-bg:var(--wave-subtle-hover)]',\n 'data-[active]:outline-2 data-[active]:-outline-offset-2 data-[active]:outline-ring',\n 'aria-disabled:cursor-not-allowed aria-disabled:text-muted-foreground',\n);\n\n/**\n * The values of the options rendered inside an `OptionGroup`, whatever wraps them (custom\n * components, Fragments, nested groups): each option adds its value from a layout effect.\n */\nclass OptionGroupMembers {\n private readonly counts = new Map<string, number>();\n private readonly listeners = new Set<() => void>();\n\n subscribe = (listener: () => void): (() => void) => {\n this.listeners.add(listener);\n return () => {\n this.listeners.delete(listener);\n };\n };\n\n add(value: string): () => void {\n this.counts.set(value, (this.counts.get(value) ?? 0) + 1);\n this.notify();\n return () => {\n const count = (this.counts.get(value) ?? 1) - 1;\n if (count > 0) this.counts.set(value, count);\n else this.counts.delete(value);\n this.notify();\n };\n }\n\n /** At least one option, and every one of them is hidden (filtered out, or by the consumer). */\n allHidden(store: ListboxStore | undefined): boolean {\n if (store === undefined || this.counts.size === 0) return false;\n for (const value of this.counts.keys()) if (!store.isHidden(value)) return false;\n return true;\n }\n\n private notify(): void {\n for (const listener of [...this.listeners]) listener();\n }\n}\n\n/** The groups around an option, outermost first (P05-internal). */\nconst OptionGroupContext = React.createContext<readonly OptionGroupMembers[]>([]);\nOptionGroupContext.displayName = 'OptionGroupContext';\n\n/** A group around the option has the consumer's `hidden` attribute (P05-internal). */\nconst OptionGroupHiddenContext = React.createContext(false);\nOptionGroupHiddenContext.displayName = 'OptionGroupHiddenContext';\n\n/** Adds an option's value to every group around it while the option is mounted. */\nfunction useOptionGroupMembership(value: string): void {\n const groups = React.useContext(OptionGroupContext);\n React.useLayoutEffect(() => {\n if (groups.length === 0) return;\n const removes = groups.map((group) => group.add(value));\n return () => {\n for (const remove of removes) remove();\n };\n }, [groups, value]);\n}\n\nfunction OptionImpl(props: OptionProps) {\n const {\n value,\n label,\n textValue,\n disabled = false,\n hidden = false,\n className,\n children,\n onClick,\n onPointerMove,\n ref,\n ...rest\n } = props;\n const showCheck = React.useContext(OptionCheckContext);\n const groupHidden = React.useContext(OptionGroupHiddenContext);\n // A consumer-hidden option is not navigable; optionProps renders `hidden`.\n const { selected, optionProps } = useListboxOption<HTMLLIElement>(\n { value, label, textValue, disabled, hidden: hidden || groupHidden },\n ref,\n );\n useOptionGroupMembership(value);\n const {\n ref: optionRef,\n onClick: selectOption,\n onPointerMove: highlightOption,\n ...optionAttributes\n } = optionProps;\n\n return (\n <li\n data-value={value}\n {...rest}\n {...optionAttributes}\n ref={optionRef}\n onClick={composeEventHandlers(onClick, selectOption)}\n onPointerMove={composeEventHandlers(onPointerMove, highlightOption)}\n className={cn(OPTION_CLASSES, selected && forcedColors.selectedContainer, className)}\n >\n {showCheck && <CheckIcon className={cn('shrink-0', !selected && 'invisible')} />}\n <span className=\"min-w-0 flex-1\">{children ?? value}</span>\n </li>\n );\n}\nOptionImpl.displayName = 'Option';\n\nconst MemoOption = /* @__PURE__ */ React.memo(OptionImpl);\nMemoOption.displayName = 'Option';\n\n/**\n * An option of a `Combobox`, `Dropdown` (and `TagPicker`'s generated list). Renders\n * `<li role=\"option\">` with a stable id (`aria-activedescendant` target), `aria-selected`, a check\n * mark while selected and `data-active`/`data-selected`/`data-disabled` attributes for styling.\n *\n * Options register with the surrounding listbox (in DOM order, groups included), so they can be\n * wrapped, grouped or rendered conditionally. The option is memoized: moving the highlight\n * re-renders only the previously and the newly active option.\n *\n * Styling: `className` comes last. A plain background class (`className=\"bg-primary\"`) replaces\n * the built-in hover, selected and active backgrounds in every state. To restyle one state only,\n * use its data variant (`data-[active]:bg-…`, `data-[selected]:bg-…`). The active option keeps\n * its focus outline.\n *\n * Use it inside a `Combobox` or `Dropdown` only; it throws in development elsewhere.\n */\nexport const Option: React.NamedExoticComponent<OptionProps> = /* @__PURE__ */ markListboxElement(\n MemoOption,\n 'option',\n);\n\n/* ------------------------------------------------------------------ */\n/* OptionGroup */\n/* ------------------------------------------------------------------ */\n\n/** Properties for the OptionGroup component used to group options. */\nexport interface OptionGroupProps extends React.LiHTMLAttributes<HTMLLIElement> {\n /** Heading label for the option group (names the group). */\n label: string;\n /**\n * Hides the group and every option in it (see `Option`'s `hidden`): keyboard navigation and\n * typeahead skip its options.\n * @default false\n */\n hidden?: boolean;\n /** Ref to the group's `<li role=\"presentation\">` element. */\n ref?: React.Ref<HTMLLIElement>;\n}\n\nfunction OptionGroupImpl({ label, className, children, hidden, ref, ...rest }: OptionGroupProps) {\n const labelId = useId('option-group');\n const store = React.useContext(ListboxContext)?.store;\n const parentGroups = React.useContext(OptionGroupContext);\n const hiddenByConsumer = React.useContext(OptionGroupHiddenContext) || !!hidden;\n const [members] = React.useState(() => new OptionGroupMembers());\n const groups = React.useMemo(() => [...parentGroups, members], [parentGroups, members]);\n const subscribe = React.useCallback(\n (listener: () => void) => {\n const unsubscribeMembers = members.subscribe(listener);\n const unsubscribeStore = store?.subscribe(listener);\n return () => {\n unsubscribeMembers();\n unsubscribeStore?.();\n };\n },\n [members, store],\n );\n // Hidden while every option inside it is filtered out or hidden, also options wrapped in a\n // component (the options register with the group; re-read when they do and when the listbox\n // state changes).\n // The server render and the first client render show the group: no option has registered yet.\n const empty = React.useSyncExternalStore(\n subscribe,\n () => members.allHidden(store),\n () => false,\n );\n\n return (\n <li\n {...rest}\n ref={ref}\n role=\"presentation\"\n hidden={hidden || empty || undefined}\n className={className}\n >\n <div\n id={labelId}\n role=\"presentation\"\n className=\"px-3 py-1 text-caption-1 font-semibold text-muted-foreground\"\n >\n {label}\n </div>\n <ul role=\"group\" aria-labelledby={labelId}>\n <OptionGroupHiddenContext.Provider value={hiddenByConsumer}>\n <OptionGroupContext.Provider value={groups}>{children}</OptionGroupContext.Provider>\n </OptionGroupHiddenContext.Provider>\n </ul>\n </li>\n );\n}\nOptionGroupImpl.displayName = 'OptionGroup';\n\n/**\n * Groups options under a heading: `<li role=\"presentation\">` with the heading and a\n * `<ul role=\"group\" aria-labelledby>` of the options. Hidden while a filter (or their own `hidden`)\n * hides all its options, also options wrapped in a component or in nested groups.\n */\nexport const OptionGroup: React.FC<OptionGroupProps> = /* @__PURE__ */ markListboxElement(\n OptionGroupImpl,\n 'group',\n);\n\n/* ------------------------------------------------------------------ */\n/* Listbox popup (P05-internal, shared by Combobox, Dropdown, TagPicker) */\n/* ------------------------------------------------------------------ */\n\n/** Options of {@link useListboxPopup}. */\nexport interface UseListboxPopupOptions {\n /** The listbox is open (dismiss layer registered: outside press, focus outside). */\n open: boolean;\n /**\n * The portaled surface is shown: positioning runs and the layer takes Escape. While the listbox\n * is open with nothing shown (no options), Escape is left to an enclosing layer (overlays#1).\n */\n surfaceOpen: boolean;\n /** Close the listbox. */\n onDismiss: (reason: DismissReason) => void;\n /** The component root: presses and focus inside it are not \"outside\". */\n rootRef: React.RefObject<HTMLElement | null>;\n /** The combobox element (the layer's anchor). */\n anchorRef: React.RefObject<HTMLElement | null>;\n}\n\n/** Result of {@link useListboxPopup}. Destructure it (react-hooks/refs). */\nexport interface ListboxPopup {\n /** The dismiss layer id (pass to {@link ListboxSurface}). */\n layerId: string;\n /** Ref callback for the element the surface is positioned against. */\n setReference: (el: HTMLElement | null) => void;\n /** Ref callback for the surface. */\n surfaceRef: React.RefCallback<HTMLElement>;\n /** `data-side`, `data-align` and the position style for the surface. */\n floatingProps: { 'data-side': string; 'data-align': string; style: React.CSSProperties };\n}\n\n/**\n * Dismissal and positioning of a listbox surface (C-POPUPS, spec §5.4): `useDismiss` (Escape,\n * outside press, focus outside; `kind: 'listbox'`) and `usePopupPosition` (bottom-start, flip,\n * shift, the anchor's width, limited to the available space).\n */\nexport function useListboxPopup(options: UseListboxPopupOptions): ListboxPopup {\n const { open, surfaceOpen, onDismiss, rootRef, anchorRef } = options;\n const surfaceElementRef = React.useRef<HTMLElement | null>(null);\n const { setReference, setFloating, floatingProps } = usePopupPosition({\n open: surfaceOpen,\n side: 'bottom',\n align: 'start',\n matchReferenceWidth: true,\n fitViewport: true,\n });\n const { layerId } = useDismiss({\n open,\n onDismiss: (reason) => onDismiss(reason),\n refs: [rootRef, surfaceElementRef],\n anchorRef,\n kind: 'listbox',\n escape: surfaceOpen,\n focusOutside: true,\n });\n const surfaceRef = useMergedRefs<HTMLElement>(surfaceElementRef, setFloating);\n return { layerId, setReference, surfaceRef, floatingProps };\n}\n\n/** Props of {@link ListboxSurface}. */\nexport interface ListboxSurfaceProps {\n /** The listbox (from `useListbox`). */\n listbox: UseListboxResult;\n /** From {@link useListboxPopup}. */\n layerId: string;\n surfaceRef: React.RefCallback<HTMLElement>;\n floatingProps: ListboxPopup['floatingProps'];\n /** The listbox is open: `emptyContent` is shown only while it is (input-pickers#21). */\n open: boolean;\n /** The listbox is displayed: the list renders in the portaled surface. */\n expanded: boolean;\n /** While open but not expanded, show the surface with this content (e.g. \"No matches\"). */\n emptyContent?: React.ReactNode;\n /** Accessible name of the listbox. */\n 'aria-label'?: string;\n 'aria-labelledby'?: string;\n /** Options draw a check mark while selected. @default true */\n showCheck?: boolean;\n children?: React.ReactNode;\n}\n\nfunction preventMouseDown(event: React.MouseEvent) {\n event.preventDefault();\n}\n\n/**\n * Renders the option list in a single container at a time (spec §2.5, §5.5): inline and `hidden`\n * inside the component root while closed (registration and ids exist from the first client\n * commit), and in a `Portal` surface while expanded — never both.\n */\nexport function ListboxSurface(props: ListboxSurfaceProps) {\n const {\n listbox,\n layerId,\n surfaceRef,\n floatingProps,\n open,\n expanded,\n emptyContent,\n 'aria-label': ariaLabel,\n 'aria-labelledby': ariaLabelledBy,\n showCheck = true,\n children,\n } = props;\n\n const list = (\n <OptionCheckContext.Provider value={showCheck}>\n <ListboxContext.Provider value={listbox.context}>\n <ul\n {...listbox.getListboxProps()}\n aria-label={ariaLabel}\n aria-labelledby={ariaLabelledBy}\n hidden={!expanded || undefined}\n className=\"min-h-0 max-h-60 overflow-auto\"\n >\n {children}\n </ul>\n </ListboxContext.Provider>\n </OptionCheckContext.Provider>\n );\n\n // A closed listbox never leaves a surface behind: the text typed before closing survives it.\n const showEmpty = open && !expanded && emptyContent !== undefined && emptyContent !== null;\n if (!expanded && !showEmpty) return list;\n\n return (\n <>\n {!expanded && list}\n <Portal layerId={layerId}>\n <div\n ref={surfaceRef}\n {...floatingProps}\n data-wave-listbox-surface=\"\"\n onMouseDown={preventMouseDown}\n className=\"flex flex-col overflow-hidden rounded border border-border bg-background py-1 text-foreground shadow-4\"\n >\n {expanded ? list : emptyContent}\n </div>\n </Portal>\n </>\n );\n}\nListboxSurface.displayName = 'ListboxSurface';\n"],"mappings":";;;;;;;;;;;;;;AAsDA,IAAMI,IAAqBD,EAAM,cAAc,EAAI;AACnD,EAAmB,cAAc;AAiBjC,IAAME,IAAiBC,EACrB,8FACA,8CACA,+EACA,6DACA,wDACA,sFACA,sEACF,GAMMC,IAAN,MAAyB;CACvB,yBAA0B,IAAI,IAAoB;CAClD,4BAA6B,IAAI,IAAgB;CAEjD,aAAa,OACX,KAAK,UAAU,IAAIC,CAAQ,SACd;EACX,KAAK,UAAU,OAAOA,CAAQ;CAChC;CAGF,IAAI,GAA2B;EA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GACtC,UAAA,kBAAC,MAAD;IACE,GAAIA,EAAQ,gBAAgB;IAC5B,cAAYH;IACZ,mBAAiBC;IACjB,QAAQ,CAACG,KAAY,KAAA;IACrB,WAAU;IAET;GACC,CAAA;EACmB,CAAA;CACE,CAAA;CAO/B,OAFI,CAACA,MADa,MAASA,KAAYC,KAA+C,QAClDH,IAGlC,kBAAApE,GAAA,EAAA,UAAA,CACG,CAACsE,KAAYF,GACd,kBAACK,GAAD;EAAiB;EACf,UAAA,kBAAC,OAAD;GACE,KAAKC;GACL,GAAIC;GACJ,6BAA0B;GAC1B,aAAaX;GACb,WAAU;GAET,UAAAM,IAAWF,IAAOG;EAChB,CAAA;CACC,CAAA,CACR,EAAA,CAAA;AAEN;AACA,EAAe,cAAc"}
@@ -0,0 +1,2 @@
1
+ "use client";const e=require("../../_virtual/_rolldown/runtime.cjs"),t=require("../../lib/cn.cjs"),n=require("../../lib/dev.cjs"),r=require("../../lib/slot.cjs"),i=require("../../lib/composeEventHandlers.cjs"),a=require("../../hooks/useControllable.cjs"),o=require("../../hooks/useId.cjs"),s=require("../../hooks/useRovingTabIndex.cjs"),c=require("../../hooks/useMergedRefs.cjs"),l=require("../../lib/aria.cjs"),u=require("../../hooks/useFieldControl.cjs"),d=require("../../lib/styles.cjs"),f=require("../../hooks/useFormReset.cjs"),p=require("../internal/HiddenInput.cjs");let m=require("react");m=e.__toESM(m,1);let h=require("react/jsx-runtime");var g=m.createContext(null);g.displayName=`RadioGroupContext`;var _={value:``,disabled:!1,select:()=>{},getTabIndex:()=>-1};function v(e){return m.useContext(g)||(n.reportMissingContext(e,`a RadioGroup`),_)}function y(e){n.warnOnce(`RadioGroup:duplicate:${e}`,`RadioGroup: several items share the value "${e}". Item values must be unique within a RadioGroup; items that share a value are checked together.`)}var b=({value:e,defaultValue:r,onValueChange:o,onChange:l,orientation:d=`vertical`,disabled:_=!1,name:v,required:b,form:x,children:S,className:C,id:w,"aria-label":T,"aria-labelledby":E,"aria-describedby":D,"aria-invalid":O,"aria-required":k,onKeyDown:A,onFocus:j,ref:M,...N})=>{l!==void 0&&n.warnDeprecated(`RadioGroup`,`onChange`,`onValueChange`);let P=r??``,[F,I]=a.useControllable(e,P,e=>{o?.(e),l?.(e)}),{containerProps:L,getTabIndex:R}=s.useRovingTabIndex({activeValue:F,orientation:`both`,loop:!0,onFocusMove:e=>I(e)}),z=m.useRef(null),B=c.useMergedRefs(M,L.ref,z),V=u.useFieldContext(),H=u.useFieldControl({id:w,"aria-label":T,"aria-labelledby":E,"aria-describedby":D,"aria-invalid":O,"aria-required":k??b},{labelable:!1}),U=b??V?.required??!1;f.useFormReset(z,()=>I(P),x),m.useEffect(()=>{let e=z.current;if(!n.isDev||!e)return;let t=new Set;for(let n of e.querySelectorAll(`[role="radio"][data-roving-value]`)){if(n.closest(`[data-roving-container]`)!==e)continue;let r=n.getAttribute(`data-roving-value`)??``;t.has(r)&&y(r),t.add(r)}});let W=()=>{z.current?.querySelector(`[data-roving-value][tabindex="0"]`)?.focus()},G=e=>{let t=e.target,n=t.closest(`[data-roving-value]`),r=n!==null&&n.closest(`[data-roving-container]`)===e.currentTarget;(t===e.currentTarget||r)&&L.onKeyDown(e)},K=m.useMemo(()=>({value:F,disabled:_,select:I,getTabIndex:R}),[F,_,I,R]);return(0,h.jsx)(g.Provider,{value:K,children:(0,h.jsxs)(`div`,{role:`radiogroup`,...H,"aria-orientation":d,"aria-disabled":_||void 0,className:t.cn(`relative flex`,d===`vertical`?`flex-col gap-2`:`flex-row gap-4`,C),...N,ref:B,"data-roving-container":``,onKeyDown:i.composeEventHandlers(A,G),onFocus:i.composeEventHandlers(j,L.onFocus,{checkDefaultPrevented:!1}),children:[S,(0,h.jsx)(p.HiddenInput,{type:`radio`,name:v,form:x,disabled:_,value:F,required:U,onInvalid:W})]})})};b.displayName=`RadioGroup`;var x=`forced-colors:bg-[GrayText] forced-colors:forced-color-adjust-none`;function S({value:e,label:a,disabled:s,className:c,labelClassName:u,onClick:f,"aria-labelledby":p,children:g,ref:_,...y}){let b=v(`RadioItem`),S=r.slotRendersContent(g);m.useEffect(()=>{S&&n.warnOnce(`RadioItem:children`,"RadioItem: children are not rendered. Pass the label in `label`.")},[S]);let C=o.useId(`radio-item`),w=o.useId(`radio-item-label`),T=!!(s||b.disabled),E=b.value===e,D=r.slotRendersContent(a),O=D&&y[`aria-label`]===void 0?l.joinIds(p,w):p;return(0,h.jsxs)(`label`,{className:t.cn(`inline-flex items-start gap-2 select-none`,T?`cursor-not-allowed opacity-50 has-focus-visible:opacity-100`:`cursor-pointer`,c),children:[(0,h.jsx)(`button`,{id:C,type:`button`,role:`radio`,...y,ref:_,"aria-labelledby":O,"aria-checked":E,disabled:T,tabIndex:T?-1:b.getTabIndex(e),"data-roving-value":e,onClick:i.composeEventHandlers(f,()=>b.select(e)),className:t.cn(`flex h-[18px] w-[18px] shrink-0 items-center justify-center rounded-full border bg-transparent p-0 transition-colors motion-reduce:transition-none`,D&&`mt-px`,d.focusRing,E?`border-2 border-primary`:`border-stroke-accessible`,T?d.forcedColors.disabled:E?`forced-colors:border-[Highlight]`:d.forcedColors.control),children:E&&(0,h.jsx)(`span`,{"aria-hidden":`true`,className:t.cn(`block h-2 w-2 rounded-full bg-primary`,T?x:d.forcedColors.selectedLeaf)})}),D&&(0,h.jsx)(`span`,{id:w,className:t.cn(`text-body-1 text-foreground`,u),children:r.materialiseSlotContent(a)})]})}S.displayName=`RadioItem`;var C=S,w=Object.assign(b,{Item:S});exports.RadioGroup=w,exports.RadioGroupItem=C,exports.RadioItem=S;
2
+ //# sourceMappingURL=RadioGroup.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"RadioGroup.cjs","names":["React","useControllable","useRovingTabIndex","useMergedRefs","useFieldContext","useFieldControl","isDev","cn","composeEventHandlers","HiddenInput","slotRendersContent","useId","joinIds","focusRing","forcedColors","materialiseSlotContent","require_runtime","require_cn","require_dev","require_slot","require_composeEventHandlers","require_useControllable","require_useId","require_useRovingTabIndex","require_useMergedRefs","require_aria","require_useFieldControl","require_styles","require_useFormReset","require_HiddenInput","react","react_jsx_runtime","RadioGroupContext","INERT_CONTEXT","useRadioGroupContext","componentName","warnDuplicateValue","value","RadioGroupRoot","valueProp","ariaLabel","ariaLabelledBy","ariaDescribedBy","ariaInvalid","ariaRequired","rest","onChange","initialValue","defaultValue","setValue","onValueChange","next","rootRef","mergedRef","ref","containerProps","field","fieldProps","required","isRequired","form","root","seen","item","itemValue","focusTabStop","handleKeyDown","target","event","fromOwnItem","contextValue","disabled","getTabIndex","orientation","className","onKeyDown","onFocus","children","disabledDot","RadioItem","ctx","hasChildren","generatedId","labelTextId","isDisabled","selected","hasLabel","label","labelledBy","onClick","labelClassName","RadioGroupItem","RadioGroup"],"sources":["../../../src/components/input/RadioGroup.tsx"],"sourcesContent":["import * as React from 'react';\nimport { joinIds } from '../../lib/aria';\nimport { cn } from '../../lib/cn';\nimport { composeEventHandlers } from '../../lib/composeEventHandlers';\nimport { isDev, reportMissingContext, warnDeprecated, warnOnce } from '../../lib/dev';\nimport { materialiseSlotContent, slotRendersContent } from '../../lib/slot';\nimport { focusRing, forcedColors } from '../../lib/styles';\nimport type { Orientation } from '../../lib/types';\nimport { useControllable } from '../../hooks/useControllable';\nimport { useFieldContext, useFieldControl } from '../../hooks/useFieldControl';\nimport { useFormReset } from '../../hooks/useFormReset';\nimport { useId } from '../../hooks/useId';\nimport { useMergedRefs } from '../../hooks/useMergedRefs';\nimport { useRovingTabIndex } from '../../hooks/useRovingTabIndex';\nimport { HiddenInput } from '../internal/HiddenInput';\n\n/* ---- Context ---- */\ninterface RadioGroupContextValue {\n /** The selected value (`''` when nothing is selected). */\n value: string;\n /** Group-level disabled state. */\n disabled: boolean;\n /**\n * Selects a value when an item is activated (click, Space, Enter). Arrow keys select through\n * the roving hook's `onFocusMove` instead. Both paths use the same `setValue`, so\n * `onValueChange` and the deprecated `onChange` alias fire only when the value changes\n * (C-NAMING).\n */\n select: (value: string) => void;\n /** Roving tab index of an item. */\n getTabIndex: (value: string) => 0 | -1;\n}\n\nconst RadioGroupContext = React.createContext<RadioGroupContextValue | null>(null);\nRadioGroupContext.displayName = 'RadioGroupContext';\n\nconst INERT_CONTEXT: RadioGroupContextValue = {\n value: '',\n disabled: false,\n select: () => {},\n getTabIndex: () => -1,\n};\n\n/**\n * The surrounding RadioGroup's context; throws in development outside one, logs once and returns\n * an inert value in production (C-CONTEXT).\n */\nfunction useRadioGroupContext(componentName: string): RadioGroupContextValue {\n const context = React.useContext(RadioGroupContext);\n if (context) return context;\n reportMissingContext(componentName, 'a RadioGroup');\n return INERT_CONTEXT;\n}\n\nfunction warnDuplicateValue(value: string): void {\n warnOnce(\n `RadioGroup:duplicate:${value}`,\n `RadioGroup: several items share the value \"${value}\". Item values must be unique within a ` +\n 'RadioGroup; items that share a value are checked together.',\n );\n}\n\n/* ---- RadioGroup ---- */\n/** Properties for the RadioGroup component. */\nexport interface RadioGroupProps extends Omit<\n React.HTMLAttributes<HTMLDivElement>,\n 'onChange' | 'defaultValue'\n> {\n /** Controlled selected value (`''` for no selection). */\n value?: string;\n /** Initial selected value for uncontrolled usage (also the value a form reset restores).\n * @default ''\n */\n defaultValue?: string;\n /** Called with the newly selected value when the selection changes (not when re-selecting). */\n onValueChange?: (value: string) => void;\n /**\n * Called with the newly selected value, exactly like `onValueChange`: only when the selection\n * changes (0.4 also called it when the selected item was chosen again).\n * @deprecated Use `onValueChange`.\n */\n onChange?: (value: string) => void;\n /**\n * Layout of the radio items (also `aria-orientation`). Arrow keys follow the APG radio pattern\n * in both layouts: Down/Right select the next item, Up/Left the previous one (Left/Right\n * mirrored under `dir=\"rtl\"`).\n * @default 'vertical'\n */\n orientation?: Orientation;\n /** Disables every item of the group. */\n disabled?: boolean;\n /**\n * Form field name. With a name, the selected value is submitted with the form. No name is\n * generated: without one the group adds nothing to `FormData`.\n */\n name?: string;\n /** A value must be selected before the form can be submitted (native validation). */\n required?: boolean;\n /** Id of the form the group belongs to, when it is rendered outside that form. */\n form?: string;\n /** Ref to the `role=\"radiogroup\"` element. */\n ref?: React.Ref<HTMLDivElement>;\n}\n\n// The `role=\"radiogroup\"` root, documented on the exported `RadioGroup` const.\nconst RadioGroupRoot = ({\n value: valueProp,\n defaultValue,\n onValueChange,\n onChange,\n orientation = 'vertical',\n disabled = false,\n name,\n required,\n form,\n children,\n className,\n id,\n 'aria-label': ariaLabel,\n 'aria-labelledby': ariaLabelledBy,\n 'aria-describedby': ariaDescribedBy,\n 'aria-invalid': ariaInvalid,\n 'aria-required': ariaRequired,\n onKeyDown,\n onFocus,\n ref,\n ...rest\n}: RadioGroupProps) => {\n if (onChange !== undefined) warnDeprecated('RadioGroup', 'onChange', 'onValueChange');\n const initialValue = defaultValue ?? '';\n const [value, setValue] = useControllable(valueProp, initialValue, (next: string) => {\n onValueChange?.(next);\n onChange?.(next);\n });\n\n const { containerProps, getTabIndex } = useRovingTabIndex({\n activeValue: value,\n orientation: 'both',\n loop: true,\n // APG radio group: moving focus also selects the item.\n onFocusMove: (next) => setValue(next),\n });\n\n const rootRef = React.useRef<HTMLDivElement>(null);\n const mergedRef = useMergedRefs<HTMLDivElement>(ref, containerProps.ref, rootRef);\n\n const field = useFieldContext();\n const fieldProps = useFieldControl(\n {\n id,\n 'aria-label': ariaLabel,\n 'aria-labelledby': ariaLabelledBy,\n 'aria-describedby': ariaDescribedBy,\n 'aria-invalid': ariaInvalid,\n // An explicit `required={false}` wins over a required Field, so aria-required always\n // matches the native validation below (`isRequired`).\n 'aria-required': ariaRequired ?? required,\n },\n { labelable: false },\n );\n const isRequired = required ?? field?.required ?? false;\n\n useFormReset(rootRef, () => setValue(initialValue), form);\n\n // Development diagnostic (C-DEV): the items may sit anywhere inside the group (Fragments, wrapper\n // elements), so they are read from the DOM after each commit.\n React.useEffect(() => {\n const root = rootRef.current;\n if (!isDev || !root) return;\n const seen = new Set<string>();\n for (const item of root.querySelectorAll<HTMLElement>('[role=\"radio\"][data-roving-value]')) {\n // Its own items only: the roving marker cannot be overridden by the consumer (`role` can).\n if (item.closest('[data-roving-container]') !== root) continue;\n const itemValue = item.getAttribute('data-roving-value') ?? '';\n if (seen.has(itemValue)) warnDuplicateValue(itemValue);\n seen.add(itemValue);\n }\n });\n\n const focusTabStop = () => {\n rootRef.current?.querySelector<HTMLElement>('[data-roving-value][tabindex=\"0\"]')?.focus();\n };\n\n // Arrow keys, Home and End move between the radios (and select) only when they are pressed on a\n // radio or on the group itself. A key pressed on other focusable content inside the group (a\n // link in an item's label) keeps its own meaning, such as scrolling the page.\n const handleKeyDown = (event: React.KeyboardEvent<HTMLDivElement>) => {\n const target = event.target as Element;\n const item = target.closest('[data-roving-value]');\n const fromOwnItem =\n item !== null && item.closest('[data-roving-container]') === event.currentTarget;\n if (target === event.currentTarget || fromOwnItem) containerProps.onKeyDown(event);\n };\n\n const contextValue = React.useMemo<RadioGroupContextValue>(\n () => ({ value, disabled, select: setValue, getTabIndex }),\n [value, disabled, setValue, getTabIndex],\n );\n\n return (\n <RadioGroupContext.Provider value={contextValue}>\n <div\n role=\"radiogroup\"\n {...fieldProps}\n aria-orientation={orientation}\n aria-disabled={disabled || undefined}\n className={cn(\n 'relative flex',\n orientation === 'vertical' ? 'flex-col gap-2' : 'flex-row gap-4',\n className,\n )}\n {...rest}\n ref={mergedRef}\n data-roving-container=\"\"\n onKeyDown={composeEventHandlers(onKeyDown, handleKeyDown)}\n onFocus={composeEventHandlers(onFocus, containerProps.onFocus, {\n checkDefaultPrevented: false,\n })}\n >\n {children}\n <HiddenInput\n type=\"radio\"\n name={name}\n form={form}\n disabled={disabled}\n value={value}\n required={isRequired}\n onInvalid={focusTabStop}\n />\n </div>\n </RadioGroupContext.Provider>\n );\n};\n\nRadioGroupRoot.displayName = 'RadioGroup';\n\n/* ---- RadioItem ---- */\n/** Forced-colors look of the dot of a disabled selected radio: GrayText, no Highlight fill. */\nconst disabledDot = 'forced-colors:bg-[GrayText] forced-colors:forced-color-adjust-none';\n\n/** Properties for the RadioItem component. */\nexport interface RadioItemProps extends Omit<\n React.ButtonHTMLAttributes<HTMLButtonElement>,\n 'value' | 'onChange'\n> {\n /** Value associated with this radio option. */\n value: string;\n /**\n * Label next to the radio indicator (any phrasing content, links included, but no other form\n * controls). It names the radio through `aria-labelledby`, after a consumer `aria-labelledby`;\n * a consumer `aria-label` names it instead. Clicking its text selects the radio; clicking a link\n * inside it follows the link, and arrow keys on that link do not move between the radios. The\n * radio lines up with the first line of the label. `children` are not rendered: pass the label\n * here.\n */\n label?: React.ReactNode;\n /** Whether the radio item is disabled and non-interactive (also when the group is disabled). */\n disabled?: boolean;\n /** Class name of the item's root `<label>` element. */\n className?: string;\n /** Class name of the element that renders the `label` text. */\n labelClassName?: string;\n /** Ref to the `role=\"radio\"` button. */\n ref?: React.Ref<HTMLButtonElement>;\n}\n\n/**\n * One option of a {@link RadioGroup}: a `role=\"radio\"` button inside a `<label>`.\n *\n * Native button props (`id`, `aria-*`, `data-*`, handlers, `style`) and `ref` go to the radio\n * button; `className` stays on the root `<label>` and `labelClassName` styles the label text. A\n * consumer `onClick` runs before the selection; `preventDefault()` in it cancels the selection.\n * Must be rendered inside a RadioGroup (also inside Fragments or wrapper elements). `label` takes\n * rich content (a second line of subtext, a link); `children` are not rendered (a development\n * warning says so).\n */\nexport function RadioItem({\n value,\n label,\n disabled,\n className,\n labelClassName,\n onClick,\n 'aria-labelledby': ariaLabelledBy,\n children,\n ref,\n ...rest\n}: RadioItemProps) {\n const ctx = useRadioGroupContext('RadioItem');\n const hasChildren = slotRendersContent(children);\n React.useEffect(() => {\n if (hasChildren) {\n warnOnce(\n 'RadioItem:children',\n 'RadioItem: children are not rendered. Pass the label in `label`.',\n );\n }\n }, [hasChildren]);\n const generatedId = useId('radio-item');\n const labelTextId = useId('radio-item-label');\n\n const isDisabled = Boolean(disabled || ctx.disabled);\n const selected = ctx.value === value;\n // `0` is a label; `null`, `false`, `''` and empty collections are not (C-SLOTS).\n const hasLabel = slotRendersContent(label);\n // The label text names the radio through aria-labelledby, disabled or not: axe exempts the dimmed\n // text of a disabled radio only when the radio references it this way (its <label> exemption\n // covers native inputs only). A consumer aria-label still names the radio alone; a consumer\n // aria-labelledby comes first.\n const labelledBy =\n hasLabel && rest['aria-label'] === undefined\n ? joinIds(ariaLabelledBy, labelTextId)\n : ariaLabelledBy;\n\n return (\n <label\n className={cn(\n // items-start: the radio lines up with the first line of a label that wraps or has a\n // second line, not with its middle.\n 'inline-flex items-start gap-2 select-none',\n // The dimmed look lifts while a focus ring shows inside the root (a link's in the label; a\n // disabled radio never takes focus): opacity would dim the ring below 3:1.\n isDisabled\n ? 'cursor-not-allowed opacity-50 has-focus-visible:opacity-100'\n : 'cursor-pointer',\n className,\n )}\n >\n <button\n id={generatedId}\n type=\"button\"\n role=\"radio\"\n {...rest}\n ref={ref}\n aria-labelledby={labelledBy}\n aria-checked={selected}\n disabled={isDisabled}\n tabIndex={isDisabled ? -1 : ctx.getTabIndex(value)}\n data-roving-value={value}\n onClick={composeEventHandlers(onClick, () => ctx.select(value))}\n className={cn(\n // p-0 and bg-transparent are set here, not left to the native reset, which any app button\n // style overrides (C-NATIVE).\n 'flex h-[18px] w-[18px] shrink-0 items-center justify-center rounded-full border bg-transparent p-0 transition-colors motion-reduce:transition-none',\n // Centred on the 20px first line of the label text.\n hasLabel && 'mt-px',\n focusRing,\n selected ? 'border-2 border-primary' : 'border-stroke-accessible',\n // Forced colors: the focusable circle keeps system colors (its focus outline stays\n // forced); only the dot opts out. A disabled radio draws GrayText, never Highlight.\n isDisabled\n ? forcedColors.disabled\n : selected\n ? 'forced-colors:border-[Highlight]'\n : forcedColors.control,\n )}\n >\n {selected && (\n <span\n aria-hidden=\"true\"\n className={cn(\n 'block h-2 w-2 rounded-full bg-primary',\n isDisabled ? disabledDot : forcedColors.selectedLeaf,\n )}\n />\n )}\n </button>\n {hasLabel && (\n <span id={labelTextId} className={cn('text-body-1 text-foreground', labelClassName)}>\n {materialiseSlotContent(label)}\n </span>\n )}\n </label>\n );\n}\n\nRadioItem.displayName = 'RadioItem';\n\n/**\n * Flat name of `RadioGroup.Item` (C-COMPOUND), for React Server Components, which cannot access\n * the dotted form. Same component as {@link RadioItem}.\n */\nexport const RadioGroupItem = RadioItem;\n\n/** Props of {@link RadioGroupItem} (same as {@link RadioItemProps}). */\nexport type RadioGroupItemProps = RadioItemProps;\n\n/**\n * A single-choice group of {@link RadioItem}s (`role=\"radiogroup\"`).\n *\n * - One tab stop (the selected item, else the first enabled one); arrow keys move focus and select\n * (APG radio group), Home/End jump to the ends, disabled items are skipped. A key pressed on a\n * link inside an item's label stays the link's: it neither moves focus nor selects. Items may\n * sit inside Fragments or wrapper elements. Every item needs its own `value` (a development\n * warning names a value that several items share).\n * - Inside a `Field` it is named by the Field label (`aria-labelledby`) and described by its hint\n * and error.\n * - With `name` (or `required`) it takes part in native forms; a form reset restores\n * `defaultValue`.\n *\n * Use `RadioGroup.Item` (or the flat `RadioGroupItem`/`RadioItem` names) for the items. React\n * Server Components cannot access the dotted form, so they import the flat names; dotted access\n * needs a client file.\n */\nexport const RadioGroup = /* @__PURE__ */ Object.assign(RadioGroupRoot, { Item: RadioItem });\n"],"mappings":"yoBAiCA,IAAMgC,EAAoBhC,EAAM,cAA6C,IAAI,EACjF,EAAkB,YAAc,oBAEhC,IAAMiC,EAAwC,CAC5C,MAAO,GACP,SAAU,GACV,WAAc,CAAC,EACf,gBAAmB,EACrB,EAMA,SAASC,EAAqB,EAA+C,CAI3E,OAHgBlC,EAAM,WAAWgC,CAC7B,IACJd,EAAA,qBAAqBiB,EAAe,cAAc,EAC3CF,EACT,CAEA,SAASG,EAAmB,EAAqB,CAC/ClB,EAAA,SACE,wBAAwBmB,IACxB,8CAA8CA,EAAM,kGAEtD,CACF,CA6CA,IAAMC,GAAkB,CACtB,MAAOC,EACP,eACA,gBACA,WACA,cAAc,WACd,WAAW,GACX,OACA,WACA,OACA,WACA,YACA,KACA,aAAcC,EACd,kBAAmBC,EACnB,mBAAoBC,EACpB,eAAgBC,EA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