@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,336 @@
1
+ "use client";
2
+ import { getArrowIntent as e, getDirection as t } from "../../lib/direction.mjs";
3
+ import { FOCUSABLE_SELECTOR as n, getFirstTabbable as r, isFocusable as i } from "../../lib/focus.mjs";
4
+ import * as a from "react";
5
+ //#region src/components/table/useGridNavigation.ts
6
+ var o = /* @__PURE__ */ new Set([
7
+ "checkbox",
8
+ "radio",
9
+ "button",
10
+ "submit",
11
+ "reset",
12
+ "image",
13
+ "file",
14
+ "color"
15
+ ]), s = /* @__PURE__ */ new Set([
16
+ "textbox",
17
+ "searchbox",
18
+ "combobox",
19
+ "spinbutton",
20
+ "slider"
21
+ ]), c = ["[data-roving-container]", ...[
22
+ "toolbar",
23
+ "radiogroup",
24
+ "listbox",
25
+ "grid",
26
+ "treegrid",
27
+ "tablist",
28
+ "menu",
29
+ "menubar",
30
+ "tree"
31
+ ].map((e) => `[role="${e}"]`)].join(", "), l = `${n}, ${c}`, u = [
32
+ "disabled",
33
+ "tabindex",
34
+ "hidden",
35
+ "inert",
36
+ "type",
37
+ "contenteditable",
38
+ "role",
39
+ "data-roving-container",
40
+ "aria-selected"
41
+ ];
42
+ function d(e) {
43
+ let t = e.localName;
44
+ if (t === "textarea" || t === "select") return !0;
45
+ if (t === "input") return !o.has(e.type);
46
+ let n = e.getAttribute("contenteditable");
47
+ if (n !== null && n !== "false") return !0;
48
+ let r = e.getAttribute("role");
49
+ return r !== null && s.has(r);
50
+ }
51
+ function f(e) {
52
+ return e.matches(c);
53
+ }
54
+ function p(e, t) {
55
+ if (e === t) return !1;
56
+ for (let n = e.parentElement; n && n !== t; n = n.parentElement) if (f(n)) return !0;
57
+ return !1;
58
+ }
59
+ function m(e) {
60
+ let t = e.querySelector("[tabindex=\"0\"]");
61
+ return t && i(t) ? t : r(e, { includeContainer: !0 });
62
+ }
63
+ function h(e) {
64
+ return e.localName === "input" && e.type === "hidden" || e.matches(":disabled") ? !1 : e.closest("[hidden], [inert]") === null;
65
+ }
66
+ function g(e) {
67
+ if (!e.name) return !1;
68
+ let t = e.getRootNode();
69
+ if (typeof t.querySelectorAll != "function") return !1;
70
+ let n = t.querySelectorAll("input[type=\"radio\"]:checked");
71
+ for (let t of Array.from(n)) if (t !== e && t.name === e.name && t.form === e.form) return !0;
72
+ return !1;
73
+ }
74
+ function _(e) {
75
+ return e.localName === "td" || e.localName === "th";
76
+ }
77
+ function v(e) {
78
+ return e.getRootNode().activeElement === e;
79
+ }
80
+ function y(e, t) {
81
+ let n = t instanceof Element ? t : null;
82
+ for (; n && n !== e;) {
83
+ if (_(n) && n.closest("table") === e) return n;
84
+ n = n.parentElement;
85
+ }
86
+ return null;
87
+ }
88
+ function b(e) {
89
+ return Array.from(e.rows).filter((e) => e.cells.length > 0 && !e.hidden);
90
+ }
91
+ var x = 1e3;
92
+ function S(e) {
93
+ let t = new Map(e.map((e, t) => [e, t])), n = e.map(() => []), r = (e, t, r, i) => {
94
+ for (let a = 0; a < r; a += 1) n[e][t + a] = i;
95
+ };
96
+ return e.forEach((e, i) => {
97
+ let a = n[i], o = 0;
98
+ for (let n of Array.from(e.cells)) {
99
+ for (; a[o];) o += 1;
100
+ let s = Math.min(Math.max(n.colSpan, 1), x);
101
+ r(i, o, s, n);
102
+ let c = n.rowSpan === 0 ? Infinity : n.rowSpan - 1;
103
+ for (let i = e.nextElementSibling; i && c > 0; i = i.nextElementSibling) {
104
+ if (i.localName !== "tr") continue;
105
+ --c;
106
+ let e = t.get(i);
107
+ e !== void 0 && r(e, o, s, n);
108
+ }
109
+ o += s;
110
+ }
111
+ }), n;
112
+ }
113
+ function C(e, t) {
114
+ for (let n = Math.min(t, e.length - 1); n >= 0; --n) {
115
+ let t = e[n];
116
+ if (t) return t;
117
+ }
118
+ return null;
119
+ }
120
+ function w(e, t, n) {
121
+ if (t instanceof Element) {
122
+ _(t) && t.closest("table") === e && n.add(t);
123
+ for (let r of Array.from(t.querySelectorAll("td, th"))) r.closest("table") === e && n.add(r);
124
+ }
125
+ }
126
+ function T(n = {}) {
127
+ let r = Math.max(1, n.pageSize ?? 10), [o, s] = a.useState(null), c = a.useRef(null), x = a.useRef(null), [T] = a.useState(() => /* @__PURE__ */ new WeakSet()), [E] = a.useState(() => /* @__PURE__ */ new WeakMap()), [D] = a.useState(() => /* @__PURE__ */ new WeakSet()), O = a.useRef(r);
128
+ a.useLayoutEffect(() => {
129
+ O.current = r;
130
+ }, [r]);
131
+ let k = a.useCallback((e, t) => {
132
+ let n = [], r = null;
133
+ for (let a of Array.from(e.querySelectorAll(l))) {
134
+ if (r && r.contains(a)) continue;
135
+ if (f(a)) {
136
+ r = a, (t ? m(a) !== null : h(a)) && n.push({
137
+ element: a,
138
+ composite: !0
139
+ });
140
+ continue;
141
+ }
142
+ let e = a.getAttribute("tabindex");
143
+ e !== null && Number(e) < 0 && !T.has(a) || (t ? i(a) : h(a)) && n.push({
144
+ element: a,
145
+ composite: !1
146
+ });
147
+ }
148
+ return n;
149
+ }, [T]), A = a.useCallback((e, t, n) => {
150
+ if (t.length !== 1) return e;
151
+ let [{ element: r, composite: i }] = t;
152
+ return i || d(r) || n && r instanceof HTMLInputElement && r.type === "radio" && !r.checked && g(r) ? e : r;
153
+ }, []), j = a.useCallback((e, t) => {
154
+ let n = String(t);
155
+ e.getAttribute("tabindex") !== n && (E.set(e, n), e.setAttribute("tabindex", n)), T.add(e);
156
+ }, [T, E]), M = a.useCallback((e, t, n) => {
157
+ let r = k(e, t);
158
+ if (n) {
159
+ D.delete(e), j(e, -1);
160
+ for (let e of r) e.composite || j(e.element, 0);
161
+ return;
162
+ }
163
+ let i = A(e, r, t), a = !1;
164
+ i === e ? (D.delete(e), j(e, t ? 0 : -1)) : T.has(e) && v(e) ? (a = !0, D.add(e), j(e, t ? 0 : -1)) : T.has(e) && (D.delete(e), T.delete(e), e.hasAttribute("tabindex") && (E.set(e, null), e.removeAttribute("tabindex")));
165
+ for (let e of r) {
166
+ if (e.composite) continue;
167
+ let n = e.element === i && t && !a;
168
+ j(e.element, n ? 0 : -1);
169
+ }
170
+ }, [
171
+ A,
172
+ k,
173
+ D,
174
+ j,
175
+ T,
176
+ E
177
+ ]), N = a.useCallback((e, t) => {
178
+ let n = b(e), r = c.current, i = /* @__PURE__ */ new Set();
179
+ if ((!r || !r.isConnected || !n.includes(r.parentElement)) && (r = n[0]?.cells[0] ?? null, c.current = r, r && i.add(r)), x.current !== null && x.current !== r) {
180
+ let e = x.current;
181
+ x.current = null, i.add(e);
182
+ }
183
+ let a = x.current;
184
+ if (t === void 0) for (let e of n) for (let t of Array.from(e.cells)) i.add(t);
185
+ else for (let e of t) e && i.add(e);
186
+ for (let t of i) t.isConnected && y(e, t) === t && M(t, t === r, t === a);
187
+ }, [M]);
188
+ a.useLayoutEffect(() => {
189
+ if (!o || (N(o), typeof MutationObserver > "u")) return;
190
+ let e = new MutationObserver((e) => {
191
+ let t = !1, n = !1, r = /* @__PURE__ */ new Set();
192
+ for (let i of e) {
193
+ let e = i.target;
194
+ if (!(e instanceof Element) || p(e, o)) continue;
195
+ if (i.type === "attributes") {
196
+ if (i.attributeName === "tabindex" && E.has(e) && E.get(e) === e.getAttribute("tabindex")) continue;
197
+ t = !0;
198
+ let a = y(o, e);
199
+ a ? r.add(a) : e.localName === "tr" ? w(o, e, r) : n = !0;
200
+ continue;
201
+ }
202
+ t = !0;
203
+ let a = y(o, e);
204
+ if (a) {
205
+ r.add(a);
206
+ continue;
207
+ }
208
+ for (let e of Array.from(i.addedNodes)) w(o, e, r);
209
+ }
210
+ t && (c.current && r.add(c.current), N(o, n ? void 0 : r));
211
+ });
212
+ return e.observe(o, {
213
+ childList: !0,
214
+ subtree: !0,
215
+ attributes: !0,
216
+ attributeFilter: u
217
+ }), () => e.disconnect();
218
+ }, [
219
+ o,
220
+ N,
221
+ E
222
+ ]);
223
+ let P = a.useCallback((e, t, n) => {
224
+ let r = c.current, i = x.current;
225
+ c.current = t, x.current = n ? t : null, N(e, [
226
+ r,
227
+ i,
228
+ t
229
+ ]);
230
+ }, [N]), F = a.useCallback((e, t) => {
231
+ P(e, t, !1), A(t, k(t, !0), !0).focus();
232
+ }, [
233
+ P,
234
+ A,
235
+ k
236
+ ]), I = a.useCallback((n) => {
237
+ let r = n.currentTarget;
238
+ if (n.defaultPrevented) return;
239
+ let i = y(r, n.target);
240
+ if (!i) return;
241
+ let a = k(i, !0), o = A(i, a, !1), s = n.target === i;
242
+ if (!s && n.target !== o) {
243
+ n.key === "Escape" && (n.preventDefault(), F(r, i));
244
+ return;
245
+ }
246
+ if (n.altKey || n.metaKey) return;
247
+ if ((n.key === "Enter" || n.key === "F2") && s) {
248
+ let e = null;
249
+ for (let t of a) if (e = t.composite ? m(t.element) : t.element, e) break;
250
+ if (!e) return;
251
+ n.preventDefault(), P(r, i, !0), e.focus();
252
+ return;
253
+ }
254
+ let c = b(r), l = c.findIndex((e) => e === i.parentElement);
255
+ if (l < 0) return;
256
+ let u = Array.from(c[l].cells).indexOf(i), d = c.length - 1, f = n.ctrlKey, p = null, h = null;
257
+ switch (n.key) {
258
+ case "ArrowLeft":
259
+ case "ArrowRight":
260
+ if (f) break;
261
+ p = [l, u + (e(n.key, {
262
+ orientation: "horizontal",
263
+ dir: t(r)
264
+ }) === "next" ? 1 : -1)];
265
+ break;
266
+ case "ArrowDown":
267
+ f || (h = [l + 1, 1]);
268
+ break;
269
+ case "ArrowUp":
270
+ f || (h = [l - 1, -1]);
271
+ break;
272
+ case "Home":
273
+ p = f ? [0, 0] : [l, 0];
274
+ break;
275
+ case "End":
276
+ p = f ? [d, Infinity] : [l, Infinity];
277
+ break;
278
+ case "PageDown":
279
+ f || (h = [Math.min(l + O.current, d), 1]);
280
+ break;
281
+ case "PageUp": f || (h = [Math.max(l - O.current, 0), -1]);
282
+ }
283
+ if (!p && !h) return;
284
+ n.preventDefault();
285
+ let g = null;
286
+ if (h) {
287
+ let e = S(c), t = Math.max(e[l].indexOf(i), 0);
288
+ for (let n = h[0]; n >= 0 && n <= d; n += h[1]) {
289
+ let r = C(e[n], t);
290
+ if (r && r !== i) {
291
+ g = r;
292
+ break;
293
+ }
294
+ }
295
+ } else if (p) {
296
+ let [e, t] = p, n = c[e].cells;
297
+ g = t === Infinity ? n[n.length - 1] : n.item(t);
298
+ }
299
+ g && g !== i && F(r, g);
300
+ }, [
301
+ P,
302
+ F,
303
+ A,
304
+ k
305
+ ]), L = a.useCallback((e) => {
306
+ let t = e.currentTarget, n = e.target, r = y(t, n);
307
+ if (!r) return;
308
+ let i = n !== r && n !== A(r, k(r, !0), !1);
309
+ P(t, r, i);
310
+ }, [
311
+ P,
312
+ A,
313
+ k
314
+ ]), R = a.useCallback((e) => {
315
+ let t = e.currentTarget, n = e.target, r = [];
316
+ n instanceof Element && _(n) && D.has(n) && r.push(n);
317
+ let i = e.relatedTarget, a = x.current;
318
+ a !== null && !(i instanceof Node && t.contains(i)) && (x.current = null, r.push(a)), r.length > 0 && N(t, r);
319
+ }, [D, N]);
320
+ return {
321
+ gridRef: s,
322
+ gridProps: a.useMemo(() => ({
323
+ onKeyDown: I,
324
+ onFocus: L,
325
+ onBlur: R
326
+ }), [
327
+ R,
328
+ L,
329
+ I
330
+ ])
331
+ };
332
+ }
333
+ //#endregion
334
+ export { d as isTextEntryElement, T as useGridNavigation };
335
+
336
+ //# sourceMappingURL=useGridNavigation.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"useGridNavigation.mjs","names":["React","NON_TEXT_INPUT_TYPES","KEY_CONSUMING_ROLES","COMPOSITE_SELECTOR","role","WIDGET_CANDIDATE_SELECTOR","FOCUSABLE_SELECTOR","OBSERVED_ATTRIBUTES","isTextEntryElement","tag","el","editable","isNestedComposite","isInsideNestedComposite","node","grid","getCompositeEntry","stop","composite","isFocusable","getFirstTabbable","isLikelyFocusable","hasCheckedPeer","radio","root","checked","other","isCellElement","isFocused","getCell","getRows","row","MAX_COL_SPAN","getColumnMap","indexOf","rows","index","map","cover","offset","colSpan","rowIndex","column","cell","own","remaining","next","covered","getCellAtColumn","rowMap","collectCells","into","useGridNavigation","pageSize","options","setGrid","activeCellRef","interactionCellRef","stamped","written","retained","pageSizeRef","getWidgets","widgets","precise","tabIndex","getTarget","element","checkRadioGroup","setTabIndex","value","syncCell","isActive","isInteraction","widget","target","keepCell","isStop","sync","table","active","targets","previous","interaction","cells","observer","relevant","all","dirty","record","records","activate","previousActive","previousInteraction","focusCell","onKeyDown","event","widgetTarget","onCell","entry","columnIndex","lastRow","ctrl","vertical","getArrowIntent","getDirection","destination","columns","candidate","nextRow","nextColumn","rowCells","onFocus","onBlur","left"],"sources":["../../../src/components/table/useGridNavigation.ts"],"sourcesContent":["import * as React from 'react';\nimport { getArrowIntent, getDirection } from '../../lib/direction';\nimport { FOCUSABLE_SELECTOR, getFirstTabbable, isFocusable } from '../../lib/focus';\n\n/** Options of {@link useGridNavigation}. */\nexport interface UseGridNavigationOptions {\n /**\n * How many rows PageUp and PageDown move focus.\n * @default 10\n */\n pageSize?: number;\n}\n\n/** Handlers {@link useGridNavigation} needs on the grid element (compose them with the consumer's). */\nexport interface GridNavigationHandlers {\n onKeyDown: React.KeyboardEventHandler<HTMLTableElement>;\n onFocus: React.FocusEventHandler<HTMLTableElement>;\n onBlur: React.FocusEventHandler<HTMLTableElement>;\n}\n\n/** Result of {@link useGridNavigation}. */\nexport interface UseGridNavigationResult {\n /** Callback ref for the `<table role=\"grid\">` element. Stable identity. */\n gridRef: React.RefCallback<HTMLTableElement>;\n /** Keyboard and focus handlers for the grid element. Stable identities. */\n gridProps: GridNavigationHandlers;\n}\n\n/** Input types that do not take arrow or character keys, so a lone one can be a cell's focus target. */\nconst NON_TEXT_INPUT_TYPES: ReadonlySet<string> = new Set([\n 'checkbox',\n 'radio',\n 'button',\n 'submit',\n 'reset',\n 'image',\n 'file',\n 'color',\n]);\n\n/** Widget roles that use arrow or character keys themselves (treated like text entry). */\nconst KEY_CONSUMING_ROLES: ReadonlySet<string> = new Set([\n 'textbox',\n 'searchbox',\n 'combobox',\n 'spinbutton',\n 'slider',\n]);\n\n/**\n * Roles of composite widgets that manage their own children (and usually their tab indexes): an\n * element with one of them, or with `data-roving-container`, is a nested composite. Close to the\n * list of `useRovingTabIndex`, which is kept separately and differs on purpose: here a `toolbar`\n * is a composite (a toolbar in a cell is one widget), while `spinbutton` is not (it is one\n * focusable control that uses the arrow keys, handled by `KEY_CONSUMING_ROLES` like a text\n * field). Keep both lists in mind when adding a role.\n */\nconst COMPOSITE_ROLES: readonly string[] = [\n 'toolbar',\n 'radiogroup',\n 'listbox',\n 'grid',\n 'treegrid',\n 'tablist',\n 'menu',\n 'menubar',\n 'tree',\n];\n\nconst COMPOSITE_SELECTOR = [\n '[data-roving-container]',\n ...COMPOSITE_ROLES.map((role) => `[role=\"${role}\"]`),\n].join(', ');\n\n/** Every element that can be a cell widget: a focusable element or a nested composite root. */\nconst WIDGET_CANDIDATE_SELECTOR = `${FOCUSABLE_SELECTOR}, ${COMPOSITE_SELECTOR}`;\n\n/**\n * Attributes whose changes can change a cell's widgets or the grid's rows. `aria-selected` on a row\n * signals a selection change, which can change the active cell's target (radio groups).\n */\nconst OBSERVED_ATTRIBUTES = [\n 'disabled',\n 'tabindex',\n 'hidden',\n 'inert',\n 'type',\n 'contenteditable',\n 'role',\n 'data-roving-container',\n 'aria-selected',\n];\n\n/**\n * Whether `el` is a text-entry control (or another widget that uses arrow keys itself): a text-like\n * `input`, `textarea`, `select`, a `contenteditable` element, or an element with role textbox,\n * searchbox, combobox, spinbutton or slider. Such widgets are never a cell's navigation target: the\n * cell takes focus and Enter/F2 moves into the widget, so the arrow keys keep moving the caret.\n */\nexport function isTextEntryElement(el: Element): boolean {\n const tag = el.localName;\n if (tag === 'textarea' || tag === 'select') return true;\n if (tag === 'input') return !NON_TEXT_INPUT_TYPES.has((el as HTMLInputElement).type);\n const editable = el.getAttribute('contenteditable');\n if (editable !== null && editable !== 'false') return true;\n const role = el.getAttribute('role');\n return role !== null && KEY_CONSUMING_ROLES.has(role);\n}\n\n/** Whether `el` is a nested composite widget (own roving container or a composite role). */\nfunction isNestedComposite(el: Element): boolean {\n return el.matches(COMPOSITE_SELECTOR);\n}\n\n/** Whether `node` is strictly inside a nested composite of `grid` (the composite root excluded). */\nfunction isInsideNestedComposite(node: Element, grid: HTMLTableElement): boolean {\n if (node === grid) return false;\n for (let el = node.parentElement; el && el !== grid; el = el.parentElement) {\n if (isNestedComposite(el)) return true;\n }\n return false;\n}\n\n/**\n * The element a nested composite is entered at: its own tab stop (`tabindex=\"0\"`), else its first\n * tabbable element (the root itself when it is the focusable element).\n */\nfunction getCompositeEntry(composite: HTMLElement): HTMLElement | null {\n const stop = composite.querySelector<HTMLElement>('[tabindex=\"0\"]');\n if (stop && isFocusable(stop)) return stop;\n return getFirstTabbable(composite, { includeContainer: true });\n}\n\n/**\n * A cheap focusability check for cells that do not hold the tab stop: no style reads, only the\n * attributes that take an element out of the focus order. The cell that holds (or receives) the tab\n * stop is checked precisely with `isFocusable`.\n */\nfunction isLikelyFocusable(el: HTMLElement): boolean {\n if (el.localName === 'input' && (el as HTMLInputElement).type === 'hidden') return false;\n if (el.matches(':disabled')) return false;\n return el.closest('[hidden], [inert]') === null;\n}\n\n/** Whether another radio of `radio`'s named group is checked (the browser's tab stop of the group). */\nfunction hasCheckedPeer(radio: HTMLInputElement): boolean {\n if (!radio.name) return false;\n const root = radio.getRootNode() as Document | ShadowRoot;\n if (typeof root.querySelectorAll !== 'function') return false;\n const checked = root.querySelectorAll<HTMLInputElement>('input[type=\"radio\"]:checked');\n for (const other of Array.from(checked)) {\n if (other !== radio && other.name === radio.name && other.form === radio.form) return true;\n }\n return false;\n}\n\nfunction isCellElement(el: Element): el is HTMLTableCellElement {\n return el.localName === 'td' || el.localName === 'th';\n}\n\n/** Whether `el` is the focused element of its document (or shadow root). */\nfunction isFocused(el: Element): boolean {\n return (el.getRootNode() as Partial<DocumentOrShadowRoot>).activeElement === el;\n}\n\n/** The cell of `grid` that contains `node` (a nested table's cells belong to the outer cell). */\nfunction getCell(grid: HTMLTableElement, node: EventTarget | null): HTMLTableCellElement | null {\n let el: Element | null = node instanceof Element ? node : null;\n while (el && el !== grid) {\n if (isCellElement(el) && el.closest('table') === grid) return el;\n el = el.parentElement;\n }\n return null;\n}\n\n/** The rows of `grid` (header, body and footer rows; a nested table's rows are not included). */\nfunction getRows(grid: HTMLTableElement): HTMLTableRowElement[] {\n return Array.from(grid.rows).filter((row) => row.cells.length > 0 && !row.hidden);\n}\n\n/** Browsers clamp `colSpan` to 1..1000 (`rowSpan` 0 covers the rest of its row group). */\nconst MAX_COL_SPAN = 1000;\n\n/** Per row, the cell covering each visual column (see {@link getColumnMap}). */\ntype ColumnMap = ReadonlyArray<ReadonlyArray<HTMLTableCellElement | undefined>>;\n\n/**\n * The HTML table model of `rows`: per row, the cell covering each visual column, with `colSpan` and\n * `rowSpan` counted. A row span covers the next rows of its row group in the DOM (a hidden row\n * counts, but gets no entry). A column no cell covers is empty. O(number of cells).\n */\nfunction getColumnMap(rows: readonly HTMLTableRowElement[]): ColumnMap {\n const indexOf = new Map<Element, number>(rows.map((row, index) => [row, index]));\n const map: Array<Array<HTMLTableCellElement | undefined>> = rows.map(() => []);\n const cover = (rowIndex: number, column: number, colSpan: number, cell: HTMLTableCellElement) => {\n for (let offset = 0; offset < colSpan; offset += 1) map[rowIndex][column + offset] = cell;\n };\n rows.forEach((row, rowIndex) => {\n const own = map[rowIndex];\n let column = 0;\n for (const cell of Array.from(row.cells)) {\n while (own[column]) column += 1;\n const colSpan = Math.min(Math.max(cell.colSpan, 1), MAX_COL_SPAN);\n cover(rowIndex, column, colSpan, cell);\n let remaining = cell.rowSpan === 0 ? Infinity : cell.rowSpan - 1;\n for (\n let next = row.nextElementSibling;\n next && remaining > 0;\n next = next.nextElementSibling\n ) {\n if (next.localName !== 'tr') continue;\n remaining -= 1;\n const covered = indexOf.get(next);\n if (covered !== undefined) cover(covered, column, colSpan, cell);\n }\n column += colSpan;\n }\n });\n return map;\n}\n\n/** The cell of a row (as {@link getColumnMap} maps it) at `column`, else the last one before it. */\nfunction getCellAtColumn(\n rowMap: ReadonlyArray<HTMLTableCellElement | undefined>,\n column: number,\n): HTMLTableCellElement | null {\n for (let index = Math.min(column, rowMap.length - 1); index >= 0; index -= 1) {\n const cell = rowMap[index];\n if (cell) return cell;\n }\n return null;\n}\n\n/** The grid cells in `node` (itself, or its descendants that belong to `grid`). */\nfunction collectCells(grid: HTMLTableElement, node: Node, into: Set<HTMLTableCellElement>): void {\n if (!(node instanceof Element)) return;\n if (isCellElement(node) && node.closest('table') === grid) into.add(node);\n for (const el of Array.from(node.querySelectorAll<HTMLTableCellElement>('td, th'))) {\n if (el.closest('table') === grid) into.add(el);\n }\n}\n\n/** A widget of a cell: a focusable element, or a nested composite counted as one widget. */\ninterface CellWidget {\n /** The focusable element, or the nested composite's root. */\n element: HTMLElement;\n /** A nested composite: the grid never writes `tabindex` on or inside it. */\n composite: boolean;\n}\n\n/**\n * Grid keyboard model of the APG Grid pattern for a `<table role=\"grid\">` (DataGrid).\n *\n * - **One tab stop.** Exactly one cell of the grid is in the tab order (initially the first cell).\n * Its focus target is its only focusable widget when that widget is not a text-entry control\n * (a checkbox, a sort button, a link); otherwise — no widget, several widgets, a text-entry\n * control or a nested composite — the cell itself. An unchecked radio whose named group has a\n * checked radio is not a target either (browsers skip it in the Tab order), so its cell is.\n * Every other cell and every widget inside a cell gets `tabindex=\"-1\"`. Rows are never focusable.\n * When a widget becomes the target of the focused cell (Space on the cell checks its radio), the\n * cell keeps focus and the tab stop (removing its `tabindex` would blur it) while its target stays\n * at `tabindex=\"-1\"`; the target takes the tab stop once the cell is blurred.\n * - **Navigation mode** (focus on a cell or on its target widget): ArrowLeft/ArrowRight (the\n * previous/next cell of the row, mirrored in RTL), ArrowUp/ArrowDown, Home/End (first/last cell\n * of the row), Ctrl+Home/Ctrl+End (first cell of the grid / last cell of the last row) and\n * PageUp/PageDown ({@link UseGridNavigationOptions.pageSize} rows) move focus between cells.\n * ArrowUp/ArrowDown and PageUp/PageDown keep the visual column (`colSpan` and `rowSpan` counted,\n * so a grouped header works), clamped to a shorter row. Space and Enter on a target widget reach\n * the widget.\n * - **Interaction mode**: Enter or F2 on a cell that is its own target moves focus into its first\n * widget; clicking a widget that is not the cell's target (a text input) enters it too. The\n * grid keys are then ignored, so the arrow keys move the caret, and Tab moves between the cell's\n * widgets. Escape returns focus to the cell. Leaving the grid ends interaction mode.\n * - **Nested composites** (an element with `data-roving-container` or role toolbar, radiogroup,\n * listbox, grid, treegrid, tablist, menu, menubar or tree) count as one widget that uses the arrow\n * keys: its cell takes focus, and Enter/F2 enters the composite at its own tab stop. The grid never\n * writes `tabindex` on or inside a composite (the composite manages its own), so a composite\n * keeps its own Tab stop — the same documented limitation as `useRovingTabIndex`.\n *\n * Keys are ignored when the event's default was prevented (a widget that handled the key, a\n * consumer handler), or with Alt/Meta held. The tab indexes are written to the DOM (layout effect\n * plus a `MutationObserver`), so rows and widgets added later are covered without a re-render. Focus\n * moves re-sync only the cells involved, the observer only the cells that changed, and the grid's\n * own `tabindex` writes do not trigger a re-sync.\n *\n * Internal to the table package.\n */\nexport function useGridNavigation(options: UseGridNavigationOptions = {}): UseGridNavigationResult {\n const pageSize = Math.max(1, options.pageSize ?? 10);\n const [grid, setGrid] = React.useState<HTMLTableElement | null>(null);\n /** The cell that holds the tab stop. */\n const activeCellRef = React.useRef<HTMLTableCellElement | null>(null);\n /** The cell whose widgets are being interacted with, or `null` (navigation mode). */\n const interactionCellRef = React.useRef<HTMLTableCellElement | null>(null);\n /** Elements whose `tabindex` this hook wrote. */\n const [stamped] = React.useState(() => new WeakSet<Element>());\n /** The `tabindex` value this hook last wrote per element (`null`: removed), to skip own records. */\n const [written] = React.useState(() => new WeakMap<Element, string | null>());\n /**\n * Cells kept focusable (holding the tab stop, their target at -1) because they were focused when\n * a widget became their target (a radio that got checked, a widget added): they lose the\n * attribute once blurred.\n */\n const [retained] = React.useState(() => new WeakSet<Element>());\n const pageSizeRef = React.useRef(pageSize);\n\n React.useLayoutEffect(() => {\n pageSizeRef.current = pageSize;\n }, [pageSize]);\n\n /**\n * The widgets of `cell` in DOM order. `precise` checks focusability with `isFocusable` (style\n * reads); otherwise only attributes are checked (cells that do not hold the tab stop).\n */\n const getWidgets = React.useCallback(\n (cell: HTMLTableCellElement, precise: boolean): CellWidget[] => {\n const widgets: CellWidget[] = [];\n let composite: HTMLElement | null = null;\n for (const el of Array.from(cell.querySelectorAll<HTMLElement>(WIDGET_CANDIDATE_SELECTOR))) {\n // Descendants of a nested composite belong to it (candidates come in document order).\n if (composite && composite.contains(el)) continue;\n if (isNestedComposite(el)) {\n composite = el;\n const available = precise ? getCompositeEntry(el) !== null : isLikelyFocusable(el);\n if (available) widgets.push({ element: el, composite: true });\n continue;\n }\n const tabIndex = el.getAttribute('tabindex');\n // An author tabindex=\"-1\" (not written by this hook) opts the element out.\n if (tabIndex !== null && Number(tabIndex) < 0 && !stamped.has(el)) continue;\n if (precise ? isFocusable(el) : isLikelyFocusable(el)) {\n widgets.push({ element: el, composite: false });\n }\n }\n return widgets;\n },\n [stamped],\n );\n\n /**\n * The element of `cell` that takes focus in navigation mode. `checkRadioGroup` applies the radio\n * group rule, which only decides where the tab stop goes (the cell that holds it); a focused\n * lone radio is in navigation mode either way.\n */\n const getTarget = React.useCallback(\n (cell: HTMLTableCellElement, widgets: CellWidget[], checkRadioGroup: boolean): HTMLElement => {\n if (widgets.length !== 1) return cell;\n const [{ element, composite }] = widgets;\n if (composite || isTextEntryElement(element)) return cell;\n if (\n checkRadioGroup &&\n element instanceof HTMLInputElement &&\n element.type === 'radio' &&\n !element.checked &&\n hasCheckedPeer(element)\n ) {\n return cell;\n }\n return element;\n },\n [],\n );\n\n const setTabIndex = React.useCallback(\n (el: HTMLElement, value: 0 | -1) => {\n const next = String(value);\n if (el.getAttribute('tabindex') !== next) {\n written.set(el, next);\n el.setAttribute('tabindex', next);\n }\n stamped.add(el);\n },\n [stamped, written],\n );\n\n /** Writes the tab indexes of one cell and its widgets (only attributes that change). */\n const syncCell = React.useCallback(\n (cell: HTMLTableCellElement, isActive: boolean, isInteraction: boolean) => {\n const widgets = getWidgets(cell, isActive);\n if (isInteraction) {\n retained.delete(cell);\n setTabIndex(cell, -1);\n for (const widget of widgets) {\n if (!widget.composite) setTabIndex(widget.element, 0);\n }\n return;\n }\n const target = getTarget(cell, widgets, isActive);\n /** The focused cell stands in for its target until it is blurred (see below). */\n let keepCell = false;\n if (target === cell) {\n retained.delete(cell);\n setTabIndex(cell, isActive ? 0 : -1);\n } else if (stamped.has(cell) && isFocused(cell)) {\n // A widget became the focused cell's target (its radio got checked, a widget was added).\n // Removing the tabindex of the focused element blurs it (browsers move focus to the body,\n // which ends the grid session), so the cell stays focusable and stays the grid's position.\n // It keeps the tab stop (`tabindex=\"0\"`, when active) and its target stays at -1: the grid\n // still has exactly one Tab stop even if focus is lost without a focusout, and Tab and\n // Shift+Tab from the cell leave the grid (nothing after or before it inside is tabbable).\n // Once the cell is blurred, onBlur re-syncs it and the target takes the tab stop.\n keepCell = true;\n retained.add(cell);\n setTabIndex(cell, isActive ? 0 : -1);\n } else if (stamped.has(cell)) {\n // The cell's widget is its target: the cell itself is not focusable.\n retained.delete(cell);\n stamped.delete(cell);\n if (cell.hasAttribute('tabindex')) {\n written.set(cell, null);\n cell.removeAttribute('tabindex');\n }\n }\n for (const widget of widgets) {\n if (widget.composite) continue;\n const isStop = widget.element === target && isActive && !keepCell;\n setTabIndex(widget.element, isStop ? 0 : -1);\n }\n },\n [getTarget, getWidgets, retained, setTabIndex, stamped, written],\n );\n\n /**\n * Re-resolves the active cell (the first cell when it is gone) and syncs `cells` — every cell\n * when omitted. A new active cell is always synced.\n */\n const sync = React.useCallback(\n (table: HTMLTableElement, cells?: Iterable<HTMLTableCellElement | null>) => {\n const rows = getRows(table);\n let active = activeCellRef.current;\n const targets = new Set<HTMLTableCellElement>();\n if (\n !active ||\n !active.isConnected ||\n !rows.includes(active.parentElement as HTMLTableRowElement)\n ) {\n active = rows[0]?.cells[0] ?? null;\n activeCellRef.current = active;\n if (active) targets.add(active);\n }\n if (interactionCellRef.current !== null && interactionCellRef.current !== active) {\n const previous = interactionCellRef.current;\n interactionCellRef.current = null;\n targets.add(previous);\n }\n const interaction = interactionCellRef.current;\n\n if (cells === undefined) {\n for (const row of rows) for (const cell of Array.from(row.cells)) targets.add(cell);\n } else {\n for (const cell of cells) if (cell) targets.add(cell);\n }\n for (const cell of targets) {\n if (!cell.isConnected || getCell(table, cell) !== cell) continue;\n syncCell(cell, cell === active, cell === interaction);\n }\n },\n [syncCell],\n );\n\n React.useLayoutEffect(() => {\n if (!grid) return;\n sync(grid);\n if (typeof MutationObserver === 'undefined') return;\n const observer = new MutationObserver((records) => {\n let relevant = false;\n let all = false;\n const dirty = new Set<HTMLTableCellElement>();\n for (const record of records) {\n const target = record.target;\n if (!(target instanceof Element)) continue;\n // A nested composite manages its own items (and their tab indexes).\n if (isInsideNestedComposite(target, grid)) continue;\n if (record.type === 'attributes') {\n // The record of one of our own writes.\n if (\n record.attributeName === 'tabindex' &&\n written.has(target) &&\n written.get(target) === target.getAttribute('tabindex')\n ) {\n continue;\n }\n relevant = true;\n const cell = getCell(grid, target);\n if (cell) dirty.add(cell);\n else if (target.localName === 'tr') collectCells(grid, target, dirty);\n else all = true;\n continue;\n }\n relevant = true;\n const cell = getCell(grid, target);\n if (cell) {\n dirty.add(cell);\n continue;\n }\n // Rows, sections or cells added (removed ones need no sync; `sync` re-resolves the\n // active cell when it went away).\n for (const node of Array.from(record.addedNodes)) collectCells(grid, node, dirty);\n }\n if (!relevant) return;\n // The active cell's target can depend on other cells (a radio group whose checked radio\n // changed, reflected by the rows' `aria-selected`), so it is always re-checked.\n if (activeCellRef.current) dirty.add(activeCellRef.current);\n sync(grid, all ? undefined : dirty);\n });\n observer.observe(grid, {\n childList: true,\n subtree: true,\n attributes: true,\n attributeFilter: OBSERVED_ATTRIBUTES,\n });\n return () => observer.disconnect();\n }, [grid, sync, written]);\n\n /**\n * Makes `cell` the active cell (in interaction mode when `interaction`) and re-syncs only the\n * cells involved: the previous active and interaction cells and `cell`.\n */\n const activate = React.useCallback(\n (table: HTMLTableElement, cell: HTMLTableCellElement, interaction: boolean) => {\n const previousActive = activeCellRef.current;\n const previousInteraction = interactionCellRef.current;\n activeCellRef.current = cell;\n interactionCellRef.current = interaction ? cell : null;\n sync(table, [previousActive, previousInteraction, cell]);\n },\n [sync],\n );\n\n const focusCell = React.useCallback(\n (table: HTMLTableElement, cell: HTMLTableCellElement) => {\n activate(table, cell, false);\n getTarget(cell, getWidgets(cell, true), true).focus();\n },\n [activate, getTarget, getWidgets],\n );\n\n const onKeyDown = React.useCallback<React.KeyboardEventHandler<HTMLTableElement>>(\n (event) => {\n const table = event.currentTarget;\n if (event.defaultPrevented) return;\n const cell = getCell(table, event.target);\n if (!cell) return;\n const widgets = getWidgets(cell, true);\n // A lone non-text widget is in navigation mode when focused, even an unchecked radio that\n // the radio group rule keeps from holding the tab stop.\n const widgetTarget = getTarget(cell, widgets, false);\n const onCell = event.target === cell;\n\n if (!onCell && event.target !== widgetTarget) {\n // Interaction mode: the widget keeps its keys; Escape returns to the cell.\n if (event.key === 'Escape') {\n event.preventDefault();\n focusCell(table, cell);\n }\n return;\n }\n if (event.altKey || event.metaKey) return;\n\n if ((event.key === 'Enter' || event.key === 'F2') && onCell) {\n let entry: HTMLElement | null = null;\n for (const widget of widgets) {\n entry = widget.composite ? getCompositeEntry(widget.element) : widget.element;\n if (entry) break;\n }\n if (!entry) return;\n event.preventDefault();\n activate(table, cell, true);\n entry.focus();\n return;\n }\n\n const rows = getRows(table);\n const rowIndex = rows.findIndex((row) => row === cell.parentElement);\n if (rowIndex < 0) return;\n const columnIndex = Array.from(rows[rowIndex].cells).indexOf(cell);\n const lastRow = rows.length - 1;\n const ctrl = event.ctrlKey;\n /** Left/Right, Home/End: target row and cell index in it (`Infinity`: the row's last cell). */\n let next: [row: number, column: number] | null = null;\n /** Up/Down, PageUp/PageDown: the first row to try and the direction to keep going in. */\n let vertical: [row: number, step: 1 | -1] | null = null;\n\n switch (event.key) {\n case 'ArrowLeft':\n case 'ArrowRight': {\n if (ctrl) break;\n const intent = getArrowIntent(event.key, {\n orientation: 'horizontal',\n dir: getDirection(table),\n });\n next = [rowIndex, columnIndex + (intent === 'next' ? 1 : -1)];\n break;\n }\n case 'ArrowDown':\n if (!ctrl) vertical = [rowIndex + 1, 1];\n break;\n case 'ArrowUp':\n if (!ctrl) vertical = [rowIndex - 1, -1];\n break;\n case 'Home':\n next = ctrl ? [0, 0] : [rowIndex, 0];\n break;\n case 'End':\n next = ctrl ? [lastRow, Infinity] : [rowIndex, Infinity];\n break;\n case 'PageDown':\n if (!ctrl) vertical = [Math.min(rowIndex + pageSizeRef.current, lastRow), 1];\n break;\n case 'PageUp':\n if (!ctrl) vertical = [Math.max(rowIndex - pageSizeRef.current, 0), -1];\n break;\n default:\n break;\n }\n if (!next && !vertical) return;\n // A handled key never scrolls the page or reaches the widget, even at the grid's edge.\n event.preventDefault();\n let destination: HTMLTableCellElement | null = null;\n if (vertical) {\n // Up/Down keep the visual column (spans counted), clamped to a shorter row; the rows a\n // row-spanning cell covers are skipped when moving away from it.\n const columns = getColumnMap(rows);\n const column = Math.max(columns[rowIndex].indexOf(cell), 0);\n for (let row = vertical[0]; row >= 0 && row <= lastRow; row += vertical[1]) {\n const candidate = getCellAtColumn(columns[row], column);\n if (candidate && candidate !== cell) {\n destination = candidate;\n break;\n }\n }\n } else if (next) {\n // Left/Right stop at the row's edges (no cell there).\n const [nextRow, nextColumn] = next;\n const rowCells = rows[nextRow].cells;\n destination =\n nextColumn === Infinity ? rowCells[rowCells.length - 1] : rowCells.item(nextColumn);\n }\n if (destination && destination !== cell) focusCell(table, destination);\n },\n [activate, focusCell, getTarget, getWidgets],\n );\n\n const onFocus = React.useCallback<React.FocusEventHandler<HTMLTableElement>>(\n (event) => {\n const table = event.currentTarget;\n // React types `target` as the handler's element type; it is the focused descendant.\n const target: EventTarget = event.target;\n const cell = getCell(table, target);\n if (!cell) return;\n const interaction =\n target !== cell && target !== getTarget(cell, getWidgets(cell, true), false);\n activate(table, cell, interaction);\n },\n [activate, getTarget, getWidgets],\n );\n\n const onBlur = React.useCallback<React.FocusEventHandler<HTMLTableElement>>(\n (event) => {\n const table = event.currentTarget;\n // React types `target` as the handler's element type; it is the blurred descendant.\n const left: EventTarget = event.target;\n const cells: HTMLTableCellElement[] = [];\n // A cell kept focusable while focused (see syncCell) is re-synced now that it is blurred\n // (during focusout the blurred element is no longer the active element).\n if (left instanceof Element && isCellElement(left) && retained.has(left)) cells.push(left);\n const next = event.relatedTarget;\n const interaction = interactionCellRef.current;\n if (interaction !== null && !(next instanceof Node && table.contains(next))) {\n interactionCellRef.current = null;\n cells.push(interaction);\n }\n if (cells.length > 0) sync(table, cells);\n },\n [retained, sync],\n );\n\n const gridProps = React.useMemo<GridNavigationHandlers>(\n () => ({ onKeyDown, onFocus, onBlur }),\n [onBlur, onFocus, onKeyDown],\n );\n\n return { gridRef: setGrid, gridProps };\n}\n"],"mappings":";;;;;AA6BA,IAAMC,oBAA4C,IAAI,IAAI;CACxD;CACA;CACA;CACA;CACA;CACA;CACA;CACA;AACF,CAAC,GAGKC,oBAA2C,IAAI,IAAI;CACvD;CACA;CACA;CACA;CACA;AACF,CAAC,GAsBKC,IAAqB,CACzB,2BACA,GAAG;CAbH;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;AAKG,CAAA,CAAgB,KAAK,MAAS,UAAUC,EAAK,GAAG,CACrD,CAAC,CAAC,KAAK,IAAI,GAGLC,IAA4B,GAAGC,EAAmB,IAAIH,KAMtDI,IAAsB;CAC1B;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;AACF;AAQA,SAAgBC,EAAmB,GAAsB;CACvD,IAAMC,IAAMC,EAAG;CACf,IAAID,MAAQ,cAAcA,MAAQ,UAAU,OAAO;CACnD,IAAIA,MAAQ,SAAS,OAAO,CAACR,EAAqB,IAAKS,EAAwB,IAAI;CACnF,IAAMC,IAAWD,EAAG,aAAa,iBAAiB;CAClD,IAAIC,MAAa,QAAQA,MAAa,SAAS,OAAO;CACtD,IAAMP,IAAOM,EAAG,aAAa,MAAM;CACnC,OAAON,MAAS,QAAQF,EAAoB,IAAIE,CAAI;AACtD;AAGA,SAASQ,EAAkB,GAAsB;CAC/C,OA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,aAAgB,QAAQiC,EAAM,SAASjC,CAAI,OACvE,EAAmB,UAAU,MAC7BsC,EAAM,KAAKD,CAAW,IAEpBC,EAAM,SAAS,KAAGN,EAAKC,GAAOK,CAAK;CACzC,GACA,CAACxB,GAAUkB,CAAI,CACjB;CAOA,OAAO;EAAE,SAASvB;EAAS,WALTvD,EAAM,eACf;GAAE;GAAW;GAAS;EAAO,IACpC;GAACiH;GAAQD;GAASjB;EAAS,CAGF;CAAU;AACvC"}
@@ -0,0 +1,2 @@
1
+ "use client";const e=require("../../_virtual/_rolldown/runtime.cjs"),t=require("../../lib/cn.cjs"),n=require("../../lib/dev.cjs");let r=require("react");r=e.__toESM(r,1);let i=require("react/jsx-runtime");var a={"caption-2":`text-caption-2`,"caption-1":`text-caption-1`,"body-1":`text-body-1`,"body-2":`text-body-2`,"subtitle-2":`text-subtitle-2`,"subtitle-1":`text-subtitle-1`,"title-3":`text-title-3`,"title-2":`text-title-2`,"title-1":`text-title-1`,"large-title":`text-large-title`,display:`text-display`},o={regular:`font-normal`,semibold:`font-semibold`,bold:`font-bold`},s={400:`regular`,600:`semibold`,700:`bold`},c=e=>{let{as:r,variant:c=`body-1`,weight:l,className:u,...d}=e,f;return typeof l==`number`?(f=Object.hasOwn(s,l)?s[l]:void 0,f&&n.warnDeprecated(`Text`,`weight={${l}}`,`weight="${f}"`)):l!==void 0&&Object.hasOwn(o,l)&&(f=l),(0,i.jsx)(r??`span`,{...d,className:t.cn(a[c],f&&o[f],u)})};c.displayName=`Text`,exports.Text=c;
2
+ //# sourceMappingURL=Text.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Text.cjs","names":["cn","require_runtime","require_cn","require_dev","react","react_jsx_runtime","variantClasses","weightClasses","numericWeights","Text","rest","props","resolvedWeight","weight","as","variant","className"],"sources":["../../../src/components/typography/Text.tsx"],"sourcesContent":["import * as React from 'react';\nimport { cn } from '../../lib/cn';\nimport { warnDeprecated } from '../../lib/dev';\nimport type { PolymorphicComponent, PolymorphicProps } from '../../lib/polymorphic';\nimport type { TextWeight, TypographyVariant } from '../../lib/types';\n\n/**\n * The Text's own props (the XOwnProps rule of `PolymorphicProps`: component-specific props only).\n * Every other prop comes from the rendered element (`as`, default `'span'`).\n */\nexport interface TextOwnProps {\n /** Typography variant controlling font size and line height (the Wave type ramp).\n * @default 'body-1'\n */\n variant?: TypographyVariant;\n /**\n * Font weight: `'regular'`, `'semibold'` or `'bold'`. Unset, the variant's own weight applies:\n * semibold for `'subtitle-2'` and every larger variant (`'subtitle-1'`, the titles,\n * `'large-title'`, `'display'`), inherited for the caption and body variants. Pass `'regular'`\n * for a title at regular weight. The numeric 0.4 values `400`, `600` and `700` still work but\n * are deprecated.\n */\n weight?: TextWeight | 400 | 600 | 700;\n}\n\n/**\n * The 0.4 numeric weights, kept as deprecated aliases of {@link TextWeight} (written out in\n * {@link TextOwnProps}, not a public name).\n */\ntype DeprecatedNumericWeight = Exclude<NonNullable<TextOwnProps['weight']>, TextWeight>;\n\n/**\n * Props of {@link Text} rendered as `C` (default `'span'`). `TextProps` without a type argument\n * is the 0.4 name: the props of a Text rendered as a `<span>`, including `ref`.\n */\nexport type TextProps<C extends React.ElementType = 'span'> = PolymorphicProps<C, TextOwnProps>;\n\n/** The props the implementation reads, for any `as`. */\ntype TextImplProps = TextOwnProps & {\n as?: React.ElementType;\n className?: string;\n};\n\nconst variantClasses: Record<TypographyVariant, string> = {\n 'caption-2': 'text-caption-2',\n 'caption-1': 'text-caption-1',\n 'body-1': 'text-body-1',\n 'body-2': 'text-body-2',\n 'subtitle-2': 'text-subtitle-2',\n 'subtitle-1': 'text-subtitle-1',\n 'title-3': 'text-title-3',\n 'title-2': 'text-title-2',\n 'title-1': 'text-title-1',\n 'large-title': 'text-large-title',\n display: 'text-display',\n};\n\nconst weightClasses: Record<TextWeight, string> = {\n regular: 'font-normal',\n semibold: 'font-semibold',\n bold: 'font-bold',\n};\n\nconst numericWeights: Record<DeprecatedNumericWeight, TextWeight> = {\n 400: 'regular',\n 600: 'semibold',\n 700: 'bold',\n};\n\n/**\n * Text in the Wave type ramp. Renders a `<span>` by default; `as` renders any element with\n * correctly typed props (`<Text as=\"h1\" variant=\"title-1\">`, `<Text as=\"label\" htmlFor=\"…\">`).\n *\n * Text sets no color: it inherits the surrounding color (the provider's foreground by default),\n * so it follows the theme. Add a color with `className` (`text-muted-foreground`); the variant\n * stays applied.\n *\n * @example\n * <Text as=\"h2\" variant=\"title-2\">Settings</Text>\n * <Text variant=\"body-1\" weight=\"semibold\">Unsaved changes</Text>\n * <Text variant=\"caption-1\" className=\"text-muted-foreground\">Last saved 2 minutes ago</Text>\n */\nexport const Text: PolymorphicComponent<'span', TextOwnProps> = (props) => {\n const { as, variant = 'body-1', weight, className, ...rest } = props as TextImplProps;\n\n let resolvedWeight: TextWeight | undefined;\n if (typeof weight === 'number') {\n resolvedWeight = Object.hasOwn(numericWeights, weight) ? numericWeights[weight] : undefined;\n // Warn-once during render is the sanctioned alias pattern (C-DEV).\n if (resolvedWeight) warnDeprecated('Text', `weight={${weight}}`, `weight=\"${resolvedWeight}\"`);\n } else if (weight !== undefined && Object.hasOwn(weightClasses, weight)) {\n resolvedWeight = weight;\n }\n\n const Component: React.ElementType = as ?? 'span';\n return (\n <Component\n {...rest}\n className={cn(\n variantClasses[variant],\n resolvedWeight && weightClasses[resolvedWeight],\n className,\n )}\n />\n );\n};\n\nText.displayName = 'Text';\n"],"mappings":"6MA2CA,IAAMM,EAAoD,CACxD,YAAa,iBACb,YAAa,iBACb,SAAU,cACV,SAAU,cACV,aAAc,kBACd,aAAc,kBACd,UAAW,eACX,UAAW,eACX,UAAW,eACX,cAAe,mBACf,QAAS,cACX,EAEMC,EAA4C,CAChD,QAAS,cACT,SAAU,gBACV,KAAM,WACR,EAEMC,EAA8D,CAClE,IAAK,UACL,IAAK,WACL,IAAK,MACP,EAeaC,EAAoD,GAAU,CACzE,GAAM,CAAE,KAAI,UAAU,SAAU,SAAQ,YAAW,GAAGC,GAASC,EAE3DC,EAUJ,OATI,OAAOC,GAAW,UACpB,EAAiB,OAAO,OAAOL,EAAgBK,CAAM,EAAIL,EAAeK,GAAU,IAAA,GAE9ED,GAAgBT,EAAA,eAAe,OAAQ,WAAWU,EAAO,GAAI,WAAWD,EAAe,EAAE,GACpFC,IAAW,IAAA,IAAa,OAAO,OAAON,EAAeM,CAAM,IACpE,EAAiBA,IAKjB,EAAAR,EAAA,IAAA,CAFmCS,GAAM,OAEzC,CACE,GAAIJ,EACJ,UAAWV,EAAAA,GACTM,EAAeS,GACfH,GAAkBL,EAAcK,GAChCI,CACF,CACD,CAAA,CAEL,EAEA,EAAK,YAAc"}
@@ -0,0 +1,38 @@
1
+ "use client";
2
+ import { cn as e } from "../../lib/cn.mjs";
3
+ import { warnDeprecated as t } from "../../lib/dev.mjs";
4
+ import "react";
5
+ import { jsx as n } from "react/jsx-runtime";
6
+ //#region src/components/typography/Text.tsx
7
+ var r = {
8
+ "caption-2": "text-caption-2",
9
+ "caption-1": "text-caption-1",
10
+ "body-1": "text-body-1",
11
+ "body-2": "text-body-2",
12
+ "subtitle-2": "text-subtitle-2",
13
+ "subtitle-1": "text-subtitle-1",
14
+ "title-3": "text-title-3",
15
+ "title-2": "text-title-2",
16
+ "title-1": "text-title-1",
17
+ "large-title": "text-large-title",
18
+ display: "text-display"
19
+ }, i = {
20
+ regular: "font-normal",
21
+ semibold: "font-semibold",
22
+ bold: "font-bold"
23
+ }, a = {
24
+ 400: "regular",
25
+ 600: "semibold",
26
+ 700: "bold"
27
+ }, o = (o) => {
28
+ let { as: s, variant: c = "body-1", weight: l, className: u, ...d } = o, f;
29
+ return typeof l == "number" ? (f = Object.hasOwn(a, l) ? a[l] : void 0, f && t("Text", `weight={${l}}`, `weight="${f}"`)) : l !== void 0 && Object.hasOwn(i, l) && (f = l), /* @__PURE__ */ n(s ?? "span", {
30
+ ...d,
31
+ className: e(r[c], f && i[f], u)
32
+ });
33
+ };
34
+ o.displayName = "Text";
35
+ //#endregion
36
+ export { o as Text };
37
+
38
+ //# sourceMappingURL=Text.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Text.mjs","names":["variantClasses","weightClasses","numericWeights","Text","rest","props","resolvedWeight","weight","warnDeprecated","as","cn","variant","className"],"sources":["../../../src/components/typography/Text.tsx"],"sourcesContent":["import * as React from 'react';\nimport { cn } from '../../lib/cn';\nimport { warnDeprecated } from '../../lib/dev';\nimport type { PolymorphicComponent, PolymorphicProps } from '../../lib/polymorphic';\nimport type { TextWeight, TypographyVariant } from '../../lib/types';\n\n/**\n * The Text's own props (the XOwnProps rule of `PolymorphicProps`: component-specific props only).\n * Every other prop comes from the rendered element (`as`, default `'span'`).\n */\nexport interface TextOwnProps {\n /** Typography variant controlling font size and line height (the Wave type ramp).\n * @default 'body-1'\n */\n variant?: TypographyVariant;\n /**\n * Font weight: `'regular'`, `'semibold'` or `'bold'`. Unset, the variant's own weight applies:\n * semibold for `'subtitle-2'` and every larger variant (`'subtitle-1'`, the titles,\n * `'large-title'`, `'display'`), inherited for the caption and body variants. Pass `'regular'`\n * for a title at regular weight. The numeric 0.4 values `400`, `600` and `700` still work but\n * are deprecated.\n */\n weight?: TextWeight | 400 | 600 | 700;\n}\n\n/**\n * The 0.4 numeric weights, kept as deprecated aliases of {@link TextWeight} (written out in\n * {@link TextOwnProps}, not a public name).\n */\ntype DeprecatedNumericWeight = Exclude<NonNullable<TextOwnProps['weight']>, TextWeight>;\n\n/**\n * Props of {@link Text} rendered as `C` (default `'span'`). `TextProps` without a type argument\n * is the 0.4 name: the props of a Text rendered as a `<span>`, including `ref`.\n */\nexport type TextProps<C extends React.ElementType = 'span'> = PolymorphicProps<C, TextOwnProps>;\n\n/** The props the implementation reads, for any `as`. */\ntype TextImplProps = TextOwnProps & {\n as?: React.ElementType;\n className?: string;\n};\n\nconst variantClasses: Record<TypographyVariant, string> = {\n 'caption-2': 'text-caption-2',\n 'caption-1': 'text-caption-1',\n 'body-1': 'text-body-1',\n 'body-2': 'text-body-2',\n 'subtitle-2': 'text-subtitle-2',\n 'subtitle-1': 'text-subtitle-1',\n 'title-3': 'text-title-3',\n 'title-2': 'text-title-2',\n 'title-1': 'text-title-1',\n 'large-title': 'text-large-title',\n display: 'text-display',\n};\n\nconst weightClasses: Record<TextWeight, string> = {\n regular: 'font-normal',\n semibold: 'font-semibold',\n bold: 'font-bold',\n};\n\nconst numericWeights: Record<DeprecatedNumericWeight, TextWeight> = {\n 400: 'regular',\n 600: 'semibold',\n 700: 'bold',\n};\n\n/**\n * Text in the Wave type ramp. Renders a `<span>` by default; `as` renders any element with\n * correctly typed props (`<Text as=\"h1\" variant=\"title-1\">`, `<Text as=\"label\" htmlFor=\"…\">`).\n *\n * Text sets no color: it inherits the surrounding color (the provider's foreground by default),\n * so it follows the theme. Add a color with `className` (`text-muted-foreground`); the variant\n * stays applied.\n *\n * @example\n * <Text as=\"h2\" variant=\"title-2\">Settings</Text>\n * <Text variant=\"body-1\" weight=\"semibold\">Unsaved changes</Text>\n * <Text variant=\"caption-1\" className=\"text-muted-foreground\">Last saved 2 minutes ago</Text>\n */\nexport const Text: PolymorphicComponent<'span', TextOwnProps> = (props) => {\n const { as, variant = 'body-1', weight, className, ...rest } = props as TextImplProps;\n\n let resolvedWeight: TextWeight | undefined;\n if (typeof weight === 'number') {\n resolvedWeight = Object.hasOwn(numericWeights, weight) ? numericWeights[weight] : undefined;\n // Warn-once during render is the sanctioned alias pattern (C-DEV).\n if (resolvedWeight) warnDeprecated('Text', `weight={${weight}}`, `weight=\"${resolvedWeight}\"`);\n } else if (weight !== undefined && Object.hasOwn(weightClasses, weight)) {\n resolvedWeight = weight;\n }\n\n const Component: React.ElementType = as ?? 'span';\n return (\n <Component\n {...rest}\n className={cn(\n variantClasses[variant],\n resolvedWeight && weightClasses[resolvedWeight],\n className,\n )}\n />\n );\n};\n\nText.displayName = 'Text';\n"],"mappings":";;;;;;AA2CA,IAAMA,IAAoD;CACxD,aAAa;CACb,aAAa;CACb,UAAU;CACV,UAAU;CACV,cAAc;CACd,cAAc;CACd,WAAW;CACX,WAAW;CACX,WAAW;CACX,eAAe;CACf,SAAS;AACX,GAEMC,IAA4C;CAChD,SAAS;CACT,UAAU;CACV,MAAM;AACR,GAEMC,IAA8D;CAClE,KAAK;CACL,KAAK;CACL,KAAK;AACP,GAeaC,KAAoD,MAAU;CACzE,IAAM,EAAE,OAAI,aAAU,UAAU,WAAQ,cAAW,GAAGC,MAASC,GAE3DC;CAUJ,OATI,OAAOC,KAAW,YACpB,IAAiB,OAAO,OAAOL,GAAgBK,CAAM,IAAIL,EAAeK,KAAU,KAAA,GAE9ED,KAAgBE,EAAe,QAAQ,WAAWD,EAAO,IAAI,WAAWD,EAAe,EAAE,KACpFC,MAAW,KAAA,KAAa,OAAO,OAAON,GAAeM,CAAM,MACpE,IAAiBA,IAKjB,kBAFmCE,KAAM,QAEzC;EACE,GAAIL;EACJ,WAAWM,EACTV,EAAeW,IACfL,KAAkBL,EAAcK,IAChCM,CACF;CACD,CAAA;AAEL;AAEA,EAAK,cAAc"}
@@ -0,0 +1,2 @@
1
+ "use client";const e=require("../lib/globalRegistry.cjs");let t=require("react");var n=[`polite`,`assertive`],r={position:`absolute`,width:`1px`,height:`1px`,padding:`0`,margin:`-1px`,overflow:`hidden`,clip:`rect(0, 0, 0, 0)`,whiteSpace:`nowrap`,border:`0`};function i(){return e.getGlobalRegistry(`announcer`,()=>({root:null,regions:null,users:0,settled:!1,queued:{},cancelFrame:null}))}function a(){return typeof document<`u`&&document.body!=null}function o(e){if(typeof requestAnimationFrame==`function`){let t=requestAnimationFrame(()=>e());return()=>cancelAnimationFrame(t)}let t=setTimeout(e,16);return()=>clearTimeout(t)}function s(e){e.cancelFrame||=o(()=>{e.cancelFrame=null,e.settled=!0;let t=e.regions,r=e.queued;if(e.queued={},t)for(let e of n){let n=r[e];n!==void 0&&(t[e].textContent=n)}})}function c(e){e.cancelFrame?.(),e.cancelFrame=null,e.root?.remove(),e.root=null,e.regions=null,e.settled=!1,e.queued={}}function l(e){if(e.root&&e.regions&&e.root.isConnected)return e.regions;c(e);let t=document.createElement(`div`);t.setAttribute(`data-wave-announcer`,``),Object.assign(t.style,r);let n=document.createElement(`div`);n.setAttribute(`role`,`status`),n.setAttribute(`aria-live`,`polite`),n.setAttribute(`aria-atomic`,`true`);let i=document.createElement(`div`);return i.setAttribute(`aria-live`,`assertive`),i.setAttribute(`aria-atomic`,`true`),t.append(n,i),document.body.appendChild(t),e.root=t,e.regions={polite:n,assertive:i},e.settled=!1,s(e),e.regions}function u(e,t=`polite`){if(!a())return;let n=i(),r=l(n)[t];if(!n.settled||n.queued[t]!==void 0){n.queued[t]=e;return}if(r.textContent===e){r.textContent=``,n.queued[t]=e,s(n);return}r.textContent=e}function d(){return(0,t.useEffect)(()=>{if(!a())return;let e=i();return e.users+=1,l(e),()=>{e.users=Math.max(0,e.users-1),e.users===0&&c(e)}},[]),u}exports.announce=u,exports.useAnnounce=d;
2
+ //# sourceMappingURL=useAnnounce.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"useAnnounce.cjs","names":["getGlobalRegistry","require_globalRegistry","react","POLITENESS","VISUALLY_HIDDEN","getState","canUseDom","requestFrame","handle","callback","scheduleFlush","state","regions","queued","politeness","message","removeRegions","ensureRegions","root","polite","assertive","announce","region","useAnnounce"],"sources":["../../src/hooks/useAnnounce.ts"],"sourcesContent":["import { useEffect } from 'react';\nimport { getGlobalRegistry } from '../lib/globalRegistry';\n\n/** How urgently assistive technology should read a message. */\nexport type Politeness = 'polite' | 'assertive';\n\ninterface AnnouncerState {\n root: HTMLElement | null;\n regions: Record<Politeness, HTMLElement> | null;\n /** Number of mounted `useAnnounce` callers. */\n users: number;\n /** `false` until one frame has passed since the regions were created. */\n settled: boolean;\n queued: Partial<Record<Politeness, string>>;\n cancelFrame: (() => void) | null;\n}\n\nconst POLITENESS: readonly Politeness[] = ['polite', 'assertive'];\n\nconst VISUALLY_HIDDEN: Partial<CSSStyleDeclaration> = {\n position: 'absolute',\n width: '1px',\n height: '1px',\n padding: '0',\n margin: '-1px',\n overflow: 'hidden',\n clip: 'rect(0, 0, 0, 0)',\n whiteSpace: 'nowrap',\n border: '0',\n};\n\nfunction getState(): AnnouncerState {\n return getGlobalRegistry<AnnouncerState>('announcer', () => ({\n root: null,\n regions: null,\n users: 0,\n settled: false,\n queued: {},\n cancelFrame: null,\n }));\n}\n\nfunction canUseDom(): boolean {\n return typeof document !== 'undefined' && document.body != null;\n}\n\nfunction requestFrame(callback: () => void): () => void {\n if (typeof requestAnimationFrame === 'function') {\n const handle = requestAnimationFrame(() => callback());\n return () => cancelAnimationFrame(handle);\n }\n const handle = setTimeout(callback, 16);\n return () => clearTimeout(handle);\n}\n\nfunction scheduleFlush(state: AnnouncerState): void {\n if (state.cancelFrame) return;\n state.cancelFrame = requestFrame(() => {\n state.cancelFrame = null;\n state.settled = true;\n const regions = state.regions;\n const queued = state.queued;\n state.queued = {};\n if (!regions) return;\n for (const politeness of POLITENESS) {\n const message = queued[politeness];\n if (message !== undefined) regions[politeness].textContent = message;\n }\n });\n}\n\nfunction removeRegions(state: AnnouncerState): void {\n state.cancelFrame?.();\n state.cancelFrame = null;\n state.root?.remove();\n state.root = null;\n state.regions = null;\n state.settled = false;\n state.queued = {};\n}\n\n/** Creates the singleton regions when they do not exist (or were removed from the document). */\nfunction ensureRegions(state: AnnouncerState): Record<Politeness, HTMLElement> {\n if (state.root && state.regions && state.root.isConnected) return state.regions;\n removeRegions(state);\n\n const root = document.createElement('div');\n root.setAttribute('data-wave-announcer', '');\n Object.assign(root.style, VISUALLY_HIDDEN);\n\n const polite = document.createElement('div');\n polite.setAttribute('role', 'status');\n polite.setAttribute('aria-live', 'polite');\n polite.setAttribute('aria-atomic', 'true');\n\n const assertive = document.createElement('div');\n assertive.setAttribute('aria-live', 'assertive');\n assertive.setAttribute('aria-atomic', 'true');\n\n root.append(polite, assertive);\n document.body.appendChild(root);\n\n state.root = root;\n state.regions = { polite, assertive };\n state.settled = false;\n // Live regions must exist before their content changes: the first write waits one frame.\n scheduleFlush(state);\n return state.regions;\n}\n\n/**\n * Announces `message` to screen readers through a shared, visually hidden live region\n * (`[data-wave-announcer]`, which modal isolation never makes inert).\n *\n * The regions are created on first use — the first `useAnnounce` mount or the first `announce()`\n * call. A message sent while they are being created is written on the next animation frame, so it\n * is not lost; repeating the current message clears the region and writes it again on the next\n * frame, so it is read again. A message sent while one is waiting for that frame replaces it (the\n * last call wins). No-op on the server.\n *\n * @param message The text to read.\n * @param politeness `'polite'` (default, `role=\"status\"`) or `'assertive'`.\n */\nexport function announce(message: string, politeness: Politeness = 'polite'): void {\n if (!canUseDom()) return;\n const state = getState();\n const regions = ensureRegions(state);\n const region = regions[politeness];\n\n // A message still waiting for the next frame (regions being created, or a repeat whose region\n // was cleared) is replaced, so the last call wins and the flush never writes an older message.\n if (!state.settled || state.queued[politeness] !== undefined) {\n state.queued[politeness] = message;\n return;\n }\n if (region.textContent === message) {\n region.textContent = '';\n state.queued[politeness] = message;\n scheduleFlush(state);\n return;\n }\n region.textContent = message;\n}\n\n/**\n * Returns {@link announce} and keeps the shared live regions alive while the caller is mounted\n * (they are created on mount and removed when the last caller unmounts).\n *\n * @example\n * const say = useAnnounce();\n * say(`${label} removed, ${count} selected`);\n */\nexport function useAnnounce(): (message: string, politeness?: Politeness) => void {\n useEffect(() => {\n if (!canUseDom()) return;\n const state = getState();\n state.users += 1;\n ensureRegions(state);\n return () => {\n state.users = Math.max(0, state.users - 1);\n if (state.users === 0) removeRegions(state);\n };\n }, []);\n return announce;\n}\n\n/** Test helper: the current text of a region (`''` when the regions do not exist). */\nexport function __getAnnouncerText(politeness: Politeness = 'polite'): string {\n return getState().regions?.[politeness].textContent ?? '';\n}\n\n/** Test helper: removes the regions and forgets queued messages and mounted callers. */\nexport function __resetAnnouncer(): void {\n const state = getState();\n removeRegions(state);\n state.users = 0;\n}\n"],"mappings":"iFAiBA,IAAMG,EAAoC,CAAC,SAAU,WAAW,EAE1DC,EAAg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AOd,CAAe,EAEzC,IAAMe,EAAS,SAAS,cAAc,KAAK,EAC3CA,EAAO,aAAa,OAAQ,QAAQ,EACpCA,EAAO,aAAa,YAAa,QAAQ,EACzCA,EAAO,aAAa,cAAe,MAAM,EAEzC,IAAMC,EAAY,SAAS,cAAc,KAAK,EAY9C,OAXAA,EAAU,aAAa,YAAa,WAAW,EAC/CA,EAAU,aAAa,cAAe,MAAM,EAE5CF,EAAK,OAAOC,EAAQC,CAAS,EAC7B,SAAS,KAAK,YAAYF,CAAI,EAE9B,EAAM,KAAOA,EACb,EAAM,QAAU,CAAE,SAAQ,WAAU,EACpC,EAAM,QAAU,GAEhBR,EAAcC,CAAK,EACZA,EAAM,OACf,CAeA,SAAgBU,EAAS,EAAiB,EAAyB,SAAgB,CACjF,GAAI,CAACf,EAAU,EAAG,OAClB,IAAMK,EAAQN,EAAS,EAEjBiB,EADUL,EAAcN,CACf,CAAA,CAAQG,GAIvB,GAAI,CAACH,EAAM,SAAWA,EAAM,OAAOG,KAAgB,IAAA,GAAW,CAC5D,EAAM,OAAOA,GAAcC,EAC3B,MACF,CACA,GAAIO,EAAO,cAAgBP,EAAS,CAClC,EAAO,YAAc,GACrB,EAAM,OAAOD,GAAcC,EAC3BL,EAAcC,CAAK,EACnB,MACF,CACA,EAAO,YAAcI,CACvB,CAUA,SAAgBQ,GAAkE,CAWhF,OAVA,EAAArB,EAAA,UAAA,KAAgB,CACd,GAAI,CAACI,EAAU,EAAG,OAClB,IAAMK,EAAQN,EAAS,EAGvB,MAFA,GAAM,OAAS,EACfY,EAAcN,CAAK,MACN,CACX,EAAM,MAAQ,KAAK,IAAI,EAAGA,EAAM,MAAQ,CAAC,EACrCA,EAAM,QAAU,GAAGK,EAAcL,CAAK,CAC5C,CACF,EAAG,CAAC,CAAC,EACEU,CACT"}
@@ -0,0 +1,88 @@
1
+ "use client";
2
+ import { getGlobalRegistry as e } from "../lib/globalRegistry.mjs";
3
+ import { useEffect as t } from "react";
4
+ //#region src/hooks/useAnnounce.ts
5
+ var n = ["polite", "assertive"], r = {
6
+ position: "absolute",
7
+ width: "1px",
8
+ height: "1px",
9
+ padding: "0",
10
+ margin: "-1px",
11
+ overflow: "hidden",
12
+ clip: "rect(0, 0, 0, 0)",
13
+ whiteSpace: "nowrap",
14
+ border: "0"
15
+ };
16
+ function i() {
17
+ return e("announcer", () => ({
18
+ root: null,
19
+ regions: null,
20
+ users: 0,
21
+ settled: !1,
22
+ queued: {},
23
+ cancelFrame: null
24
+ }));
25
+ }
26
+ function a() {
27
+ return typeof document < "u" && document.body != null;
28
+ }
29
+ function o(e) {
30
+ if (typeof requestAnimationFrame == "function") {
31
+ let t = requestAnimationFrame(() => e());
32
+ return () => cancelAnimationFrame(t);
33
+ }
34
+ let t = setTimeout(e, 16);
35
+ return () => clearTimeout(t);
36
+ }
37
+ function s(e) {
38
+ e.cancelFrame ||= o(() => {
39
+ e.cancelFrame = null, e.settled = !0;
40
+ let t = e.regions, r = e.queued;
41
+ if (e.queued = {}, t) for (let e of n) {
42
+ let n = r[e];
43
+ n !== void 0 && (t[e].textContent = n);
44
+ }
45
+ });
46
+ }
47
+ function c(e) {
48
+ e.cancelFrame?.(), e.cancelFrame = null, e.root?.remove(), e.root = null, e.regions = null, e.settled = !1, e.queued = {};
49
+ }
50
+ function l(e) {
51
+ if (e.root && e.regions && e.root.isConnected) return e.regions;
52
+ c(e);
53
+ let t = document.createElement("div");
54
+ t.setAttribute("data-wave-announcer", ""), Object.assign(t.style, r);
55
+ let n = document.createElement("div");
56
+ n.setAttribute("role", "status"), n.setAttribute("aria-live", "polite"), n.setAttribute("aria-atomic", "true");
57
+ let i = document.createElement("div");
58
+ return i.setAttribute("aria-live", "assertive"), i.setAttribute("aria-atomic", "true"), t.append(n, i), document.body.appendChild(t), e.root = t, e.regions = {
59
+ polite: n,
60
+ assertive: i
61
+ }, e.settled = !1, s(e), e.regions;
62
+ }
63
+ function u(e, t = "polite") {
64
+ if (!a()) return;
65
+ let n = i(), r = l(n)[t];
66
+ if (!n.settled || n.queued[t] !== void 0) {
67
+ n.queued[t] = e;
68
+ return;
69
+ }
70
+ if (r.textContent === e) {
71
+ r.textContent = "", n.queued[t] = e, s(n);
72
+ return;
73
+ }
74
+ r.textContent = e;
75
+ }
76
+ function d() {
77
+ return t(() => {
78
+ if (!a()) return;
79
+ let e = i();
80
+ return e.users += 1, l(e), () => {
81
+ e.users = Math.max(0, e.users - 1), e.users === 0 && c(e);
82
+ };
83
+ }, []), u;
84
+ }
85
+ //#endregion
86
+ export { u as announce, d as useAnnounce };
87
+
88
+ //# sourceMappingURL=useAnnounce.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"useAnnounce.mjs","names":["POLITENESS","VISUALLY_HIDDEN","getState","getGlobalRegistry","canUseDom","requestFrame","handle","callback","scheduleFlush","state","regions","queued","politeness","message","removeRegions","ensureRegions","root","polite","assertive","announce","region","useAnnounce","useEffect"],"sources":["../../src/hooks/useAnnounce.ts"],"sourcesContent":["import { useEffect } from 'react';\nimport { getGlobalRegistry } from '../lib/globalRegistry';\n\n/** How urgently assistive technology should read a message. */\nexport type Politeness = 'polite' | 'assertive';\n\ninterface AnnouncerState {\n root: HTMLElement | null;\n regions: Record<Politeness, HTMLElement> | null;\n /** Number of mounted `useAnnounce` callers. */\n users: number;\n /** `false` until one frame has passed since the regions were created. */\n settled: boolean;\n queued: Partial<Record<Politeness, string>>;\n cancelFrame: (() => void) | null;\n}\n\nconst POLITENESS: readonly Politeness[] = ['polite', 'assertive'];\n\nconst VISUALLY_HIDDEN: Partial<CSSStyleDeclaration> = {\n position: 'absolute',\n width: '1px',\n height: '1px',\n padding: '0',\n margin: '-1px',\n overflow: 'hidden',\n clip: 'rect(0, 0, 0, 0)',\n whiteSpace: 'nowrap',\n border: '0',\n};\n\nfunction getState(): AnnouncerState {\n return getGlobalRegistry<AnnouncerState>('announcer', () => ({\n root: null,\n regions: null,\n users: 0,\n settled: false,\n queued: {},\n cancelFrame: null,\n }));\n}\n\nfunction canUseDom(): boolean {\n return typeof document !== 'undefined' && document.body != null;\n}\n\nfunction requestFrame(callback: () => void): () => void {\n if (typeof requestAnimationFrame === 'function') {\n const handle = requestAnimationFrame(() => callback());\n return () => cancelAnimationFrame(handle);\n }\n const handle = setTimeout(callback, 16);\n return () => clearTimeout(handle);\n}\n\nfunction scheduleFlush(state: AnnouncerState): void {\n if (state.cancelFrame) return;\n state.cancelFrame = requestFrame(() => {\n state.cancelFrame = null;\n state.settled = true;\n const regions = state.regions;\n const queued = state.queued;\n state.queued = {};\n if (!regions) return;\n for (const politeness of POLITENESS) {\n const message = queued[politeness];\n if (message !== undefined) regions[politeness].textContent = message;\n }\n });\n}\n\nfunction removeRegions(state: AnnouncerState): void {\n state.cancelFrame?.();\n state.cancelFrame = null;\n state.root?.remove();\n state.root = null;\n state.regions = null;\n state.settled = false;\n state.queued = {};\n}\n\n/** Creates the singleton regions when they do not exist (or were removed from the document). */\nfunction ensureRegions(state: AnnouncerState): Record<Politeness, HTMLElement> {\n if (state.root && state.regions && state.root.isConnected) return state.regions;\n removeRegions(state);\n\n const root = document.createElement('div');\n root.setAttribute('data-wave-announcer', '');\n Object.assign(root.style, VISUALLY_HIDDEN);\n\n const polite = document.createElement('div');\n polite.setAttribute('role', 'status');\n polite.setAttribute('aria-live', 'polite');\n polite.setAttribute('aria-atomic', 'true');\n\n const assertive = document.createElement('div');\n assertive.setAttribute('aria-live', 'assertive');\n assertive.setAttribute('aria-atomic', 'true');\n\n root.append(polite, assertive);\n document.body.appendChild(root);\n\n state.root = root;\n state.regions = { polite, assertive };\n state.settled = false;\n // Live regions must exist before their content changes: the first write waits one frame.\n scheduleFlush(state);\n return state.regions;\n}\n\n/**\n * Announces `message` to screen readers through a shared, visually hidden live region\n * (`[data-wave-announcer]`, which modal isolation never makes inert).\n *\n * The regions are created on first use — the first `useAnnounce` mount or the first `announce()`\n * call. A message sent while they are being created is written on the next animation frame, so it\n * is not lost; repeating the current message clears the region and writes it again on the next\n * frame, so it is read again. A message sent while one is waiting for that frame replaces it (the\n * last call wins). No-op on the server.\n *\n * @param message The text to read.\n * @param politeness `'polite'` (default, `role=\"status\"`) or `'assertive'`.\n */\nexport function announce(message: string, politeness: Politeness = 'polite'): void {\n if (!canUseDom()) return;\n const state = getState();\n const regions = ensureRegions(state);\n const region = regions[politeness];\n\n // A message still waiting for the next frame (regions being created, or a repeat whose region\n // was cleared) is replaced, so the last call wins and the flush never writes an older message.\n if (!state.settled || state.queued[politeness] !== undefined) {\n state.queued[politeness] = message;\n return;\n }\n if (region.textContent === message) {\n region.textContent = '';\n state.queued[politeness] = message;\n scheduleFlush(state);\n return;\n }\n region.textContent = message;\n}\n\n/**\n * Returns {@link announce} and keeps the shared live regions alive while the caller is mounted\n * (they are created on mount and removed when the last caller unmounts).\n *\n * @example\n * const say = useAnnounce();\n * say(`${label} removed, ${count} selected`);\n */\nexport function useAnnounce(): (message: string, politeness?: Politeness) => void {\n useEffect(() => {\n if (!canUseDom()) return;\n const state = getState();\n state.users += 1;\n ensureRegions(state);\n return () => {\n state.users = Math.max(0, state.users - 1);\n if (state.users === 0) removeRegions(state);\n };\n }, []);\n return announce;\n}\n\n/** Test helper: the current text of a region (`''` when the regions do not exist). */\nexport function __getAnnouncerText(politeness: Politeness = 'polite'): string {\n return getState().regions?.[politeness].textContent ?? '';\n}\n\n/** Test helper: removes the regions and forgets queued messages and mounted callers. */\nexport function __resetAnnouncer(): void {\n const state = getState();\n removeRegions(state);\n state.users = 0;\n}\n"],"mappings":";;;;AAiBA,IAAMA,IAAoC,CAAC,UAAU,WAAW,GAE1DC,IAAgD;CACpD,UAAU;CACV,OAAO;CACP,QAAQ;CACR,SAAS;CACT,QAAQ;CACR,UAAU;CACV,MAAM;CACN,YAAY;CACZ,QAAQ;AACV;AAEA,SAASC,IAA2B;CAClC,OAAOC,EAAkC,oBAAoB;EAC3D,MAAM;EACN,SAAS;EACT,OAAO;EACP,SAAS;EACT,QAAQ,CAAC;EACT,aAAa;CACf,EAA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