@mortenbrudvik/waveui 0.7.0 → 0.8.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (408) hide show
  1. package/README.md +395 -132
  2. package/dist/components/button/Button.cjs +1 -1
  3. package/dist/components/button/Button.cjs.map +1 -1
  4. package/dist/components/button/Button.mjs +36 -35
  5. package/dist/components/button/Button.mjs.map +1 -1
  6. package/dist/components/button/Button.slots.cjs +1 -1
  7. package/dist/components/button/Button.slots.cjs.map +1 -1
  8. package/dist/components/button/Button.slots.mjs +31 -21
  9. package/dist/components/button/Button.slots.mjs.map +1 -1
  10. package/dist/components/button/CompoundButton.cjs +1 -1
  11. package/dist/components/button/CompoundButton.cjs.map +1 -1
  12. package/dist/components/button/CompoundButton.mjs +31 -29
  13. package/dist/components/button/CompoundButton.mjs.map +1 -1
  14. package/dist/components/button/Link.cjs +1 -1
  15. package/dist/components/button/Link.cjs.map +1 -1
  16. package/dist/components/button/Link.mjs +24 -23
  17. package/dist/components/button/Link.mjs.map +1 -1
  18. package/dist/components/button/MenuButton.cjs +1 -1
  19. package/dist/components/button/MenuButton.cjs.map +1 -1
  20. package/dist/components/button/MenuButton.mjs +29 -28
  21. package/dist/components/button/MenuButton.mjs.map +1 -1
  22. package/dist/components/button/SplitButton.cjs +1 -1
  23. package/dist/components/button/SplitButton.cjs.map +1 -1
  24. package/dist/components/button/SplitButton.mjs +46 -45
  25. package/dist/components/button/SplitButton.mjs.map +1 -1
  26. package/dist/components/button/ToggleButton.cjs +1 -1
  27. package/dist/components/button/ToggleButton.cjs.map +1 -1
  28. package/dist/components/button/ToggleButton.mjs +38 -35
  29. package/dist/components/button/ToggleButton.mjs.map +1 -1
  30. package/dist/components/button/Toolbar.cjs +1 -1
  31. package/dist/components/button/Toolbar.cjs.map +1 -1
  32. package/dist/components/button/Toolbar.mjs +43 -42
  33. package/dist/components/button/Toolbar.mjs.map +1 -1
  34. package/dist/components/button/Toolbar.parts.cjs +1 -1
  35. package/dist/components/button/Toolbar.parts.cjs.map +1 -1
  36. package/dist/components/button/Toolbar.parts.mjs +76 -81
  37. package/dist/components/button/Toolbar.parts.mjs.map +1 -1
  38. package/dist/components/data-display/Avatar.cjs +1 -1
  39. package/dist/components/data-display/Avatar.cjs.map +1 -1
  40. package/dist/components/data-display/Avatar.mjs +72 -67
  41. package/dist/components/data-display/Avatar.mjs.map +1 -1
  42. package/dist/components/data-display/AvatarGroup.cjs +1 -1
  43. package/dist/components/data-display/AvatarGroup.cjs.map +1 -1
  44. package/dist/components/data-display/AvatarGroup.mjs +89 -88
  45. package/dist/components/data-display/AvatarGroup.mjs.map +1 -1
  46. package/dist/components/data-display/Badge.cjs +1 -1
  47. package/dist/components/data-display/Badge.cjs.map +1 -1
  48. package/dist/components/data-display/Badge.mjs +17 -16
  49. package/dist/components/data-display/Badge.mjs.map +1 -1
  50. package/dist/components/data-display/CounterBadge.cjs +1 -1
  51. package/dist/components/data-display/CounterBadge.cjs.map +1 -1
  52. package/dist/components/data-display/CounterBadge.mjs +18 -17
  53. package/dist/components/data-display/CounterBadge.mjs.map +1 -1
  54. package/dist/components/data-display/Divider.cjs +1 -1
  55. package/dist/components/data-display/Divider.cjs.map +1 -1
  56. package/dist/components/data-display/Divider.mjs +31 -30
  57. package/dist/components/data-display/Divider.mjs.map +1 -1
  58. package/dist/components/data-display/Image.cjs +1 -1
  59. package/dist/components/data-display/Image.cjs.map +1 -1
  60. package/dist/components/data-display/Image.mjs +16 -15
  61. package/dist/components/data-display/Image.mjs.map +1 -1
  62. package/dist/components/data-display/InfoLabel.cjs +1 -1
  63. package/dist/components/data-display/InfoLabel.cjs.map +1 -1
  64. package/dist/components/data-display/InfoLabel.mjs +74 -73
  65. package/dist/components/data-display/InfoLabel.mjs.map +1 -1
  66. package/dist/components/data-display/List.cjs +1 -1
  67. package/dist/components/data-display/List.cjs.map +1 -1
  68. package/dist/components/data-display/List.mjs +175 -174
  69. package/dist/components/data-display/List.mjs.map +1 -1
  70. package/dist/components/data-display/Persona.cjs +1 -1
  71. package/dist/components/data-display/Persona.cjs.map +1 -1
  72. package/dist/components/data-display/Persona.mjs +31 -29
  73. package/dist/components/data-display/Persona.mjs.map +1 -1
  74. package/dist/components/data-display/PresenceBadge.cjs +1 -1
  75. package/dist/components/data-display/PresenceBadge.cjs.map +1 -1
  76. package/dist/components/data-display/PresenceBadge.mjs +25 -24
  77. package/dist/components/data-display/PresenceBadge.mjs.map +1 -1
  78. package/dist/components/data-display/Tag.cjs +1 -1
  79. package/dist/components/data-display/Tag.cjs.map +1 -1
  80. package/dist/components/data-display/Tag.mjs +87 -82
  81. package/dist/components/data-display/Tag.mjs.map +1 -1
  82. package/dist/components/feedback/MessageBar.cjs +1 -1
  83. package/dist/components/feedback/MessageBar.cjs.map +1 -1
  84. package/dist/components/feedback/MessageBar.mjs +129 -71
  85. package/dist/components/feedback/MessageBar.mjs.map +1 -1
  86. package/dist/components/feedback/MessageBar.parts.cjs +2 -0
  87. package/dist/components/feedback/MessageBar.parts.cjs.map +1 -0
  88. package/dist/components/feedback/MessageBar.parts.mjs +84 -0
  89. package/dist/components/feedback/MessageBar.parts.mjs.map +1 -0
  90. package/dist/components/feedback/MessageBar.reflow.cjs +2 -0
  91. package/dist/components/feedback/MessageBar.reflow.cjs.map +1 -0
  92. package/dist/components/feedback/MessageBar.reflow.mjs +74 -0
  93. package/dist/components/feedback/MessageBar.reflow.mjs.map +1 -0
  94. package/dist/components/feedback/MessageBar.status.cjs +1 -1
  95. package/dist/components/feedback/MessageBar.status.cjs.map +1 -1
  96. package/dist/components/feedback/MessageBar.status.mjs +2 -1
  97. package/dist/components/feedback/MessageBar.status.mjs.map +1 -1
  98. package/dist/components/feedback/ProgressBar.cjs +1 -1
  99. package/dist/components/feedback/ProgressBar.cjs.map +1 -1
  100. package/dist/components/feedback/ProgressBar.mjs +44 -43
  101. package/dist/components/feedback/ProgressBar.mjs.map +1 -1
  102. package/dist/components/feedback/Skeleton.cjs +1 -1
  103. package/dist/components/feedback/Skeleton.cjs.map +1 -1
  104. package/dist/components/feedback/Skeleton.mjs +26 -24
  105. package/dist/components/feedback/Skeleton.mjs.map +1 -1
  106. package/dist/components/feedback/Spinner.cjs +1 -1
  107. package/dist/components/feedback/Spinner.cjs.map +1 -1
  108. package/dist/components/feedback/Spinner.mjs +32 -31
  109. package/dist/components/feedback/Spinner.mjs.map +1 -1
  110. package/dist/components/feedback/Toast.cjs +1 -1
  111. package/dist/components/feedback/Toast.cjs.map +1 -1
  112. package/dist/components/feedback/Toast.context.cjs +2 -0
  113. package/dist/components/feedback/Toast.context.cjs.map +1 -0
  114. package/dist/components/feedback/Toast.context.mjs +23 -0
  115. package/dist/components/feedback/Toast.context.mjs.map +1 -0
  116. package/dist/components/feedback/Toast.mjs +10 -342
  117. package/dist/components/feedback/Toast.mjs.map +1 -1
  118. package/dist/components/feedback/Toast.parts.cjs +2 -0
  119. package/dist/components/feedback/Toast.parts.cjs.map +1 -0
  120. package/dist/components/feedback/Toast.parts.mjs +98 -0
  121. package/dist/components/feedback/Toast.parts.mjs.map +1 -0
  122. package/dist/components/feedback/Toast.root.cjs +2 -0
  123. package/dist/components/feedback/Toast.root.cjs.map +1 -0
  124. package/dist/components/feedback/Toast.root.mjs +109 -0
  125. package/dist/components/feedback/Toast.root.mjs.map +1 -0
  126. package/dist/components/feedback/Toaster.cjs +2 -0
  127. package/dist/components/feedback/Toaster.cjs.map +1 -0
  128. package/dist/components/feedback/Toaster.mjs +564 -0
  129. package/dist/components/feedback/Toaster.mjs.map +1 -0
  130. package/dist/components/input/AlphaSlider.cjs +2 -0
  131. package/dist/components/input/AlphaSlider.cjs.map +1 -0
  132. package/dist/components/input/AlphaSlider.mjs +115 -0
  133. package/dist/components/input/AlphaSlider.mjs.map +1 -0
  134. package/dist/components/input/Checkbox.cjs +1 -1
  135. package/dist/components/input/Checkbox.cjs.map +1 -1
  136. package/dist/components/input/Checkbox.mjs +47 -46
  137. package/dist/components/input/Checkbox.mjs.map +1 -1
  138. package/dist/components/input/ColorArea.cjs +2 -0
  139. package/dist/components/input/ColorArea.cjs.map +1 -0
  140. package/dist/components/input/ColorArea.mjs +204 -0
  141. package/dist/components/input/ColorArea.mjs.map +1 -0
  142. package/dist/components/input/ColorPicker.cjs +5 -5
  143. package/dist/components/input/ColorPicker.cjs.map +1 -1
  144. package/dist/components/input/ColorPicker.mjs +142 -165
  145. package/dist/components/input/ColorPicker.mjs.map +1 -1
  146. package/dist/components/input/ColorPicker.parts.cjs +2 -0
  147. package/dist/components/input/ColorPicker.parts.cjs.map +1 -0
  148. package/dist/components/input/ColorPicker.parts.mjs +192 -0
  149. package/dist/components/input/ColorPicker.parts.mjs.map +1 -0
  150. package/dist/components/input/ColorSlider.cjs +2 -0
  151. package/dist/components/input/ColorSlider.cjs.map +1 -0
  152. package/dist/components/input/ColorSlider.mjs +138 -0
  153. package/dist/components/input/ColorSlider.mjs.map +1 -0
  154. package/dist/components/input/Combobox.cjs +1 -1
  155. package/dist/components/input/Combobox.cjs.map +1 -1
  156. package/dist/components/input/Combobox.expand.cjs +1 -1
  157. package/dist/components/input/Combobox.expand.cjs.map +1 -1
  158. package/dist/components/input/Combobox.expand.mjs +9 -9
  159. package/dist/components/input/Combobox.expand.mjs.map +1 -1
  160. package/dist/components/input/Combobox.mjs +90 -85
  161. package/dist/components/input/Combobox.mjs.map +1 -1
  162. package/dist/components/input/DatePicker.cjs +1 -1
  163. package/dist/components/input/DatePicker.cjs.map +1 -1
  164. package/dist/components/input/DatePicker.mjs +186 -185
  165. package/dist/components/input/DatePicker.mjs.map +1 -1
  166. package/dist/components/input/Dropdown.cjs +1 -1
  167. package/dist/components/input/Dropdown.cjs.map +1 -1
  168. package/dist/components/input/Dropdown.mjs +71 -68
  169. package/dist/components/input/Dropdown.mjs.map +1 -1
  170. package/dist/components/input/Field.cjs +1 -1
  171. package/dist/components/input/Field.cjs.map +1 -1
  172. package/dist/components/input/Field.mjs +113 -112
  173. package/dist/components/input/Field.mjs.map +1 -1
  174. package/dist/components/input/Input.cjs +1 -1
  175. package/dist/components/input/Input.cjs.map +1 -1
  176. package/dist/components/input/Input.mjs +55 -54
  177. package/dist/components/input/Input.mjs.map +1 -1
  178. package/dist/components/input/Label.cjs +1 -1
  179. package/dist/components/input/Label.cjs.map +1 -1
  180. package/dist/components/input/Label.mjs +12 -11
  181. package/dist/components/input/Label.mjs.map +1 -1
  182. package/dist/components/input/Option.cjs +1 -1
  183. package/dist/components/input/Option.cjs.map +1 -1
  184. package/dist/components/input/Option.mjs +100 -98
  185. package/dist/components/input/Option.mjs.map +1 -1
  186. package/dist/components/input/RadioGroup.cjs +1 -1
  187. package/dist/components/input/RadioGroup.cjs.map +1 -1
  188. package/dist/components/input/RadioGroup.mjs +89 -88
  189. package/dist/components/input/RadioGroup.mjs.map +1 -1
  190. package/dist/components/input/Rating.cjs +1 -1
  191. package/dist/components/input/Rating.cjs.map +1 -1
  192. package/dist/components/input/Rating.mjs +110 -109
  193. package/dist/components/input/Rating.mjs.map +1 -1
  194. package/dist/components/input/SearchBox.cjs +1 -1
  195. package/dist/components/input/SearchBox.cjs.map +1 -1
  196. package/dist/components/input/SearchBox.mjs +118 -119
  197. package/dist/components/input/SearchBox.mjs.map +1 -1
  198. package/dist/components/input/Select.cjs +1 -1
  199. package/dist/components/input/Select.cjs.map +1 -1
  200. package/dist/components/input/Select.mjs +25 -24
  201. package/dist/components/input/Select.mjs.map +1 -1
  202. package/dist/components/input/Slider.cjs +1 -1
  203. package/dist/components/input/Slider.cjs.map +1 -1
  204. package/dist/components/input/Slider.mjs +47 -46
  205. package/dist/components/input/Slider.mjs.map +1 -1
  206. package/dist/components/input/SpinButton.cjs +1 -1
  207. package/dist/components/input/SpinButton.cjs.map +1 -1
  208. package/dist/components/input/SpinButton.mjs +76 -75
  209. package/dist/components/input/SpinButton.mjs.map +1 -1
  210. package/dist/components/input/SwatchPicker.cjs +1 -1
  211. package/dist/components/input/SwatchPicker.cjs.map +1 -1
  212. package/dist/components/input/SwatchPicker.mjs +38 -37
  213. package/dist/components/input/SwatchPicker.mjs.map +1 -1
  214. package/dist/components/input/Switch.cjs +1 -1
  215. package/dist/components/input/Switch.cjs.map +1 -1
  216. package/dist/components/input/Switch.mjs +65 -64
  217. package/dist/components/input/Switch.mjs.map +1 -1
  218. package/dist/components/input/TagPicker.cjs +1 -1
  219. package/dist/components/input/TagPicker.cjs.map +1 -1
  220. package/dist/components/input/TagPicker.mjs +161 -157
  221. package/dist/components/input/TagPicker.mjs.map +1 -1
  222. package/dist/components/input/Textarea.cjs +1 -1
  223. package/dist/components/input/Textarea.cjs.map +1 -1
  224. package/dist/components/input/Textarea.mjs +24 -23
  225. package/dist/components/input/Textarea.mjs.map +1 -1
  226. package/dist/components/input/TimePicker.cjs +1 -1
  227. package/dist/components/input/TimePicker.cjs.map +1 -1
  228. package/dist/components/input/TimePicker.mjs +202 -199
  229. package/dist/components/input/TimePicker.mjs.map +1 -1
  230. package/dist/components/input/colorName.cjs +2 -0
  231. package/dist/components/input/colorName.cjs.map +1 -0
  232. package/dist/components/input/colorName.mjs +30 -0
  233. package/dist/components/input/colorName.mjs.map +1 -0
  234. package/dist/components/input/colorUtils.cjs +1 -1
  235. package/dist/components/input/colorUtils.cjs.map +1 -1
  236. package/dist/components/input/colorUtils.mjs +154 -56
  237. package/dist/components/input/colorUtils.mjs.map +1 -1
  238. package/dist/components/layout/Accordion.cjs +1 -1
  239. package/dist/components/layout/Accordion.cjs.map +1 -1
  240. package/dist/components/layout/Accordion.mjs +130 -129
  241. package/dist/components/layout/Accordion.mjs.map +1 -1
  242. package/dist/components/layout/Card.cjs +1 -1
  243. package/dist/components/layout/Card.cjs.map +1 -1
  244. package/dist/components/layout/Card.mjs +78 -77
  245. package/dist/components/layout/Card.mjs.map +1 -1
  246. package/dist/components/layout/Carousel.cjs +1 -1
  247. package/dist/components/layout/Carousel.cjs.map +1 -1
  248. package/dist/components/layout/Carousel.mjs +111 -110
  249. package/dist/components/layout/Carousel.mjs.map +1 -1
  250. package/dist/components/layout/Flex.cjs +1 -1
  251. package/dist/components/layout/Flex.cjs.map +1 -1
  252. package/dist/components/layout/Flex.mjs +22 -21
  253. package/dist/components/layout/Flex.mjs.map +1 -1
  254. package/dist/components/layout/Grid.cjs +1 -1
  255. package/dist/components/layout/Grid.cjs.map +1 -1
  256. package/dist/components/layout/Grid.mjs +19 -18
  257. package/dist/components/layout/Grid.mjs.map +1 -1
  258. package/dist/components/layout/Overflow.cjs +1 -1
  259. package/dist/components/layout/Overflow.cjs.map +1 -1
  260. package/dist/components/layout/Overflow.mjs +92 -91
  261. package/dist/components/layout/Overflow.mjs.map +1 -1
  262. package/dist/components/layout/Stack.cjs +1 -1
  263. package/dist/components/layout/Stack.cjs.map +1 -1
  264. package/dist/components/layout/Stack.mjs +14 -13
  265. package/dist/components/layout/Stack.mjs.map +1 -1
  266. package/dist/components/layout/TabList.cjs +1 -1
  267. package/dist/components/layout/TabList.cjs.map +1 -1
  268. package/dist/components/layout/TabList.mjs +118 -117
  269. package/dist/components/layout/TabList.mjs.map +1 -1
  270. package/dist/components/layout/Tree.cjs +1 -1
  271. package/dist/components/layout/Tree.cjs.map +1 -1
  272. package/dist/components/layout/Tree.context.cjs +2 -0
  273. package/dist/components/layout/Tree.context.cjs.map +1 -0
  274. package/dist/components/layout/Tree.context.mjs +33 -0
  275. package/dist/components/layout/Tree.context.mjs.map +1 -0
  276. package/dist/components/layout/Tree.core.cjs +2 -0
  277. package/dist/components/layout/Tree.core.cjs.map +1 -0
  278. package/dist/components/layout/Tree.core.mjs +416 -0
  279. package/dist/components/layout/Tree.core.mjs.map +1 -0
  280. package/dist/components/layout/Tree.itemPersonaLayout.cjs +2 -0
  281. package/dist/components/layout/Tree.itemPersonaLayout.cjs.map +1 -0
  282. package/dist/components/layout/Tree.itemPersonaLayout.mjs +46 -0
  283. package/dist/components/layout/Tree.itemPersonaLayout.mjs.map +1 -0
  284. package/dist/components/layout/Tree.mjs +7 -215
  285. package/dist/components/layout/Tree.mjs.map +1 -1
  286. package/dist/components/layout/Tree.selection.cjs +2 -0
  287. package/dist/components/layout/Tree.selection.cjs.map +1 -0
  288. package/dist/components/layout/Tree.selection.mjs +73 -0
  289. package/dist/components/layout/Tree.selection.mjs.map +1 -0
  290. package/dist/components/navigation/Breadcrumb.cjs +1 -1
  291. package/dist/components/navigation/Breadcrumb.cjs.map +1 -1
  292. package/dist/components/navigation/Breadcrumb.mjs +76 -75
  293. package/dist/components/navigation/Breadcrumb.mjs.map +1 -1
  294. package/dist/components/navigation/Menu.group.cjs +1 -1
  295. package/dist/components/navigation/Menu.group.cjs.map +1 -1
  296. package/dist/components/navigation/Menu.group.mjs +39 -37
  297. package/dist/components/navigation/Menu.group.mjs.map +1 -1
  298. package/dist/components/navigation/Menu.items.cjs +1 -1
  299. package/dist/components/navigation/Menu.items.cjs.map +1 -1
  300. package/dist/components/navigation/Menu.items.mjs +67 -61
  301. package/dist/components/navigation/Menu.items.mjs.map +1 -1
  302. package/dist/components/navigation/Menu.link.cjs +1 -1
  303. package/dist/components/navigation/Menu.link.cjs.map +1 -1
  304. package/dist/components/navigation/Menu.link.mjs +34 -28
  305. package/dist/components/navigation/Menu.link.mjs.map +1 -1
  306. package/dist/components/navigation/Menu.popover.cjs +1 -1
  307. package/dist/components/navigation/Menu.popover.cjs.map +1 -1
  308. package/dist/components/navigation/Menu.popover.mjs +110 -109
  309. package/dist/components/navigation/Menu.popover.mjs.map +1 -1
  310. package/dist/components/navigation/Menu.root.cjs +1 -1
  311. package/dist/components/navigation/Menu.root.cjs.map +1 -1
  312. package/dist/components/navigation/Menu.root.mjs +171 -170
  313. package/dist/components/navigation/Menu.root.mjs.map +1 -1
  314. package/dist/components/navigation/Menu.selectable.cjs +1 -1
  315. package/dist/components/navigation/Menu.selectable.cjs.map +1 -1
  316. package/dist/components/navigation/Menu.selectable.mjs +85 -63
  317. package/dist/components/navigation/Menu.selectable.mjs.map +1 -1
  318. package/dist/components/navigation/Menu.splitGroup.cjs +1 -1
  319. package/dist/components/navigation/Menu.splitGroup.cjs.map +1 -1
  320. package/dist/components/navigation/Menu.splitGroup.mjs +27 -26
  321. package/dist/components/navigation/Menu.splitGroup.mjs.map +1 -1
  322. package/dist/components/navigation/Menu.trigger.cjs +1 -1
  323. package/dist/components/navigation/Menu.trigger.cjs.map +1 -1
  324. package/dist/components/navigation/Menu.trigger.mjs +6 -6
  325. package/dist/components/navigation/Nav.cjs +1 -1
  326. package/dist/components/navigation/Nav.cjs.map +1 -1
  327. package/dist/components/navigation/Nav.mjs +170 -155
  328. package/dist/components/navigation/Nav.mjs.map +1 -1
  329. package/dist/components/navigation/Pagination.cjs +1 -1
  330. package/dist/components/navigation/Pagination.cjs.map +1 -1
  331. package/dist/components/navigation/Pagination.mjs +73 -65
  332. package/dist/components/navigation/Pagination.mjs.map +1 -1
  333. package/dist/components/navigation/Stepper.cjs +1 -1
  334. package/dist/components/navigation/Stepper.cjs.map +1 -1
  335. package/dist/components/navigation/Stepper.mjs +110 -109
  336. package/dist/components/navigation/Stepper.mjs.map +1 -1
  337. package/dist/components/overlays/Dialog.cjs +1 -1
  338. package/dist/components/overlays/Dialog.cjs.map +1 -1
  339. package/dist/components/overlays/Dialog.mjs +109 -108
  340. package/dist/components/overlays/Dialog.mjs.map +1 -1
  341. package/dist/components/overlays/Drawer.cjs +1 -1
  342. package/dist/components/overlays/Drawer.cjs.map +1 -1
  343. package/dist/components/overlays/Drawer.mjs +110 -109
  344. package/dist/components/overlays/Drawer.mjs.map +1 -1
  345. package/dist/components/overlays/Popover.cjs +1 -1
  346. package/dist/components/overlays/Popover.cjs.map +1 -1
  347. package/dist/components/overlays/Popover.mjs +229 -227
  348. package/dist/components/overlays/Popover.mjs.map +1 -1
  349. package/dist/components/overlays/TeachingPopover.cjs +1 -1
  350. package/dist/components/overlays/TeachingPopover.cjs.map +1 -1
  351. package/dist/components/overlays/TeachingPopover.mjs +41 -37
  352. package/dist/components/overlays/TeachingPopover.mjs.map +1 -1
  353. package/dist/components/overlays/Tooltip.cjs +1 -1
  354. package/dist/components/overlays/Tooltip.cjs.map +1 -1
  355. package/dist/components/overlays/Tooltip.mjs +87 -86
  356. package/dist/components/overlays/Tooltip.mjs.map +1 -1
  357. package/dist/components/portal/Portal.cjs +1 -1
  358. package/dist/components/portal/Portal.cjs.map +1 -1
  359. package/dist/components/portal/Portal.mjs +33 -32
  360. package/dist/components/portal/Portal.mjs.map +1 -1
  361. package/dist/components/provider/WaveProvider.cjs +1 -1
  362. package/dist/components/provider/WaveProvider.cjs.map +1 -1
  363. package/dist/components/provider/WaveProvider.mjs +31 -30
  364. package/dist/components/provider/WaveProvider.mjs.map +1 -1
  365. package/dist/components/table/DataGrid.cjs +1 -1
  366. package/dist/components/table/DataGrid.cjs.map +1 -1
  367. package/dist/components/table/DataGrid.mjs +228 -227
  368. package/dist/components/table/DataGrid.mjs.map +1 -1
  369. package/dist/components/table/Table.cjs +1 -1
  370. package/dist/components/table/Table.cjs.map +1 -1
  371. package/dist/components/table/Table.mjs +60 -59
  372. package/dist/components/table/Table.mjs.map +1 -1
  373. package/dist/components/typography/Text.cjs +1 -1
  374. package/dist/components/typography/Text.cjs.map +1 -1
  375. package/dist/components/typography/Text.mjs +12 -11
  376. package/dist/components/typography/Text.mjs.map +1 -1
  377. package/dist/hooks/useMediaQuery.cjs +2 -0
  378. package/dist/hooks/useMediaQuery.cjs.map +1 -0
  379. package/dist/hooks/useMediaQuery.mjs +20 -0
  380. package/dist/hooks/useMediaQuery.mjs.map +1 -0
  381. package/dist/hooks/usePrefersReducedMotion.cjs +1 -1
  382. package/dist/hooks/usePrefersReducedMotion.cjs.map +1 -1
  383. package/dist/hooks/usePrefersReducedMotion.mjs +4 -18
  384. package/dist/hooks/usePrefersReducedMotion.mjs.map +1 -1
  385. package/dist/hooks/useRovingTabIndex.cjs +1 -1
  386. package/dist/hooks/useRovingTabIndex.cjs.map +1 -1
  387. package/dist/hooks/useRovingTabIndex.mjs +3 -3
  388. package/dist/hooks/useRovingTabIndex.mjs.map +1 -1
  389. package/dist/index.cjs +1 -1
  390. package/dist/index.d.cts +2089 -102
  391. package/dist/index.d.ts +2089 -102
  392. package/dist/index.mjs +99 -87
  393. package/dist/lib/classNames.cjs +2 -0
  394. package/dist/lib/classNames.cjs.map +1 -0
  395. package/dist/lib/classNames.mjs +415 -0
  396. package/dist/lib/classNames.mjs.map +1 -0
  397. package/dist/lib/color.cjs +2 -0
  398. package/dist/lib/color.cjs.map +1 -0
  399. package/dist/lib/color.mjs +86 -0
  400. package/dist/lib/color.mjs.map +1 -0
  401. package/dist/lib/globalRegistry.cjs.map +1 -1
  402. package/dist/lib/globalRegistry.mjs.map +1 -1
  403. package/dist/lib/toaster.cjs +2 -0
  404. package/dist/lib/toaster.cjs.map +1 -0
  405. package/dist/lib/toaster.mjs +77 -0
  406. package/dist/lib/toaster.mjs.map +1 -0
  407. package/dist/styles.css +1 -1
  408. package/package.json +1 -1
@@ -1 +1 @@
1
- {"version":3,"file":"WaveProvider.cjs","names":["React","isWaveTheme","getThemeClassName","WAVE_THEMES","cn","require_runtime","require_cn","require_dev","require_theme","react","react_jsx_runtime","WaveContext","useWaveTheme","WaveProvider","themeProp","dirProp","portalContainerProp","rest","parent","theme","dir","portalContainer","resolvedTheme","themeClassName","value","className"],"sources":["../../../src/components/provider/WaveProvider.tsx"],"sourcesContent":["import * as React from 'react';\nimport { cn } from '../../lib/cn';\nimport { warnOnce } from '../../lib/dev';\nimport { getThemeClassName, isWaveTheme, WAVE_THEMES, type WaveTheme } from '../../lib/theme';\n\n// The theme helper lives in server-safe src/lib (no \"use client\"), so React Server Components can\n// call it; it stays exported from here too.\nexport { getThemeClassName } from '../../lib/theme';\nexport type { WaveTheme } from '../../lib/theme';\n\n/** Text direction for bidirectional layout support. */\nexport type WaveDir = 'ltr' | 'rtl';\n\n/** Props accepted by {@link WaveProvider}. */\nexport interface WaveProviderProps extends React.HTMLAttributes<HTMLDivElement> {\n /**\n * Visual theme applied to the subtree. Providers can be nested in any order: each root declares\n * its theme's tokens, so a light panel inside a dark app (and the reverse) renders correctly.\n * @default the enclosing WaveProvider's theme, else 'light'\n */\n theme?: WaveTheme;\n /**\n * Text direction for the subtree (also read by portaled overlays and keyboard navigation).\n * @default the enclosing WaveProvider's direction, else 'ltr'\n */\n dir?: WaveDir;\n /**\n * Element that portaled overlays (dialogs, popovers, menus, toasts) render into. `null` renders\n * them into `document.body`, also inside a provider that sets a container.\n * @default the enclosing WaveProvider's container, else document.body\n */\n portalContainer?: HTMLElement | null;\n /** Content rendered inside the themed container. */\n children: React.ReactNode;\n /** Ref to the themed root `<div>`. */\n ref?: React.Ref<HTMLDivElement>;\n}\n\n/** Value provided by {@link WaveProvider} and returned by {@link useWaveTheme}. */\nexport interface WaveContextValue {\n /** The active theme. */\n theme: WaveTheme;\n /** The active text direction. */\n dir: WaveDir;\n /**\n * Theme classes of the nearest provider (see {@link getThemeClassName}); portals put them on\n * their wrapper so overlays inherit the theme. `''` outside a provider (the page's own theme).\n */\n themeClassName: string;\n /** Element portaled overlays render into; `null` means `document.body`. */\n portalContainer: HTMLElement | null;\n /** `false` when no {@link WaveProvider} is above the caller (the defaults are returned). */\n hasProvider: boolean;\n}\n\nconst DEFAULT_CONTEXT: WaveContextValue = {\n theme: 'light',\n dir: 'ltr',\n themeClassName: '',\n portalContainer: null,\n hasProvider: false,\n};\n\nconst WaveContext = React.createContext<WaveContextValue>(DEFAULT_CONTEXT);\n\n/**\n * Reads the theme, direction, theme classes and portal container of the nearest\n * {@link WaveProvider}. Outside a provider it returns light/ltr defaults with `hasProvider: false`.\n *\n * @returns The {@link WaveContextValue} of the nearest provider.\n */\nexport function useWaveTheme(): WaveContextValue {\n return React.useContext(WaveContext);\n}\n\n/**\n * Applies Wave theming to an application or subtree.\n *\n * - Renders a `<div class=\"wave-root wave-<theme>\">` that declares the theme's tokens and paints\n * the themed background, text colour and font (`bg-background text-foreground font-wave\n * text-body-1`; a `className` passed by you wins). The precompiled `./styles` entry scopes its base\n * styles and native-element reset to this root, so it is required there.\n * - Sets `dir` and `data-wave-theme` on the root. An unknown `theme` value (from untyped code)\n * falls back to `'light'` — classes, `data-wave-theme` and the context value — and warns once in\n * development.\n * - Provides theme, direction, theme classes and the portal container through context, so\n * portaled overlays render with the same theme and direction.\n * - Nests: a provider inherits every prop it omits (`theme`, `dir`, `portalContainer`) from the\n * enclosing provider, so `<WaveProvider theme=\"light\">` inside an RTL app is a light panel that\n * stays right-to-left and keeps the app's portal container. At the top level the defaults are\n * `'light'`, `'ltr'` and `document.body`.\n */\nexport const WaveProvider = ({\n theme: themeProp,\n dir: dirProp,\n portalContainer: portalContainerProp,\n children,\n className,\n ref,\n ...rest\n}: WaveProviderProps) => {\n // Omitted props come from the enclosing provider; outside one, DEFAULT_CONTEXT supplies the\n // top-level defaults. An explicit `portalContainer={null}` means document.body, so only\n // `undefined` inherits.\n const parent = React.useContext(WaveContext);\n const theme = themeProp ?? parent.theme;\n const dir = dirProp ?? parent.dir;\n const portalContainer =\n portalContainerProp === undefined ? parent.portalContainer : portalContainerProp;\n\n // An unknown value (untyped callers) renders, and is reported, as the light theme.\n const resolvedTheme: WaveTheme = isWaveTheme(theme) ? theme : 'light';\n const themeClassName = getThemeClassName(resolvedTheme);\n\n React.useEffect(() => {\n if (!isWaveTheme(theme)) {\n warnOnce(\n `WaveProvider:theme:${String(theme)}`,\n `WaveProvider: unknown theme \"${String(theme)}\". Valid themes: ${WAVE_THEMES.join(', ')}. Using \"light\".`,\n );\n }\n }, [theme]);\n\n const value = React.useMemo<WaveContextValue>(\n () => ({ theme: resolvedTheme, dir, themeClassName, portalContainer, hasProvider: true }),\n [resolvedTheme, dir, themeClassName, portalContainer],\n );\n\n return (\n <WaveContext.Provider value={value}>\n <div\n {...rest}\n ref={ref}\n dir={dir}\n data-wave-theme={resolvedTheme}\n className={cn(\n 'wave-root',\n themeClassName,\n 'bg-background text-foreground font-wave text-body-1',\n className,\n )}\n >\n {children}\n </div>\n </WaveContext.Provider>\n );\n};\n\nWaveProvider.displayName = 'WaveProvider';\n"],"mappings":"8OA+DA,IAAMW,EAAcX,EAAM,cAAgC,CAPxD,MAAO,QACP,IAAK,MACL,eAAgB,GAChB,gBAAiB,KACjB,YAAa,EAG2C,CAAe,EAQzE,SAAgBY,GAAiC,CAC/C,OAAOZ,EAAM,WAAWW,CAAW,CACrC,CAmBA,IAAaE,GAAgB,CAC3B,MAAOC,EACP,IAAKC,EACL,gBAAiBC,EACjB,WACA,YACA,MACA,GAAGC,KACoB,CAIvB,IAAMC,EAASlB,EAAM,WAAWW,CAAW,EACrCQ,EAAQL,GAAaI,EAAO,MAC5BE,EAAML,GAAWG,EAAO,IACxBG,EACJL,IAAwB,IAAA,GAAYE,EAAO,gBAAkBF,EAGzDM,EAA2BrB,EAAAA,YAAYkB,CAAK,EAAIA,EAAQ,QACxDI,EAAiBrB,EAAAA,kBAAkBoB,CAAa,EAEtDb,EAAM,cAAgB,CACfR,EAAAA,YAAYkB,CAAK,GACpBZ,EAAA,SACE,sBAAsB,OAAOY,CAAK,IAClC,gCAAgC,OAAOA,CAAK,EAAE,mBAAmBhB,EAAAA,YAAY,KAAK,IAAI,EAAE,iBAC1F,CAEJ,EAAG,CAACgB,CAAK,CAAC,EAEV,IAAMK,EAAQxB,EAAM,aACX,CAAE,MAAOsB,EAAe,MAAK,iBAAgB,kBAAiB,YAAa,EAAK,GACvF,CAACA,EAAeF,EAAKG,EAAgBF,CAAe,CACtD,EAEA,OACE,EAAAX,EAAA,IAAA,CAACC,EAAY,SAAb,CAA6B,QAC3B,UAAA,EAAAD,EAAA,IAAA,CAAC,MAAD,CACE,GAAIO,EACC,MACA,MACL,kBAAiBK,EACjB,UAAWlB,EAAAA,GACT,YACAmB,EACA,sDACAE,CACF,EAEC,UACE,CAAA,CACe,CAAA,CAE1B,EAEA,EAAa,YAAc"}
1
+ {"version":3,"file":"WaveProvider.cjs","names":["React","isWaveTheme","getThemeClassName","WAVE_THEMES","cn","waveProviderClassNames","require_runtime","require_cn","require_dev","require_classNames","require_theme","react","react_jsx_runtime","WaveContext","useWaveTheme","WaveProvider","themeProp","dirProp","portalContainerProp","rest","parent","theme","dir","portalContainer","resolvedTheme","themeClassName","value","className"],"sources":["../../../src/components/provider/WaveProvider.tsx"],"sourcesContent":["import * as React from 'react';\nimport { cn } from '../../lib/cn';\nimport { warnOnce } from '../../lib/dev';\nimport { waveProviderClassNames } from '../../lib/classNames';\nimport { getThemeClassName, isWaveTheme, WAVE_THEMES, type WaveTheme } from '../../lib/theme';\n\n// The theme helper lives in server-safe src/lib (no \"use client\"), so React Server Components can\n// call it; it stays exported from here too.\nexport { getThemeClassName } from '../../lib/theme';\nexport type { WaveTheme } from '../../lib/theme';\n\n/** Text direction for bidirectional layout support. */\nexport type WaveDir = 'ltr' | 'rtl';\n\n/** Props accepted by {@link WaveProvider}. */\nexport interface WaveProviderProps extends React.HTMLAttributes<HTMLDivElement> {\n /**\n * Visual theme applied to the subtree. Providers can be nested in any order: each root declares\n * its theme's tokens, so a light panel inside a dark app (and the reverse) renders correctly.\n * @default the enclosing WaveProvider's theme, else 'light'\n */\n theme?: WaveTheme;\n /**\n * Text direction for the subtree (also read by portaled overlays and keyboard navigation).\n * @default the enclosing WaveProvider's direction, else 'ltr'\n */\n dir?: WaveDir;\n /**\n * Element that portaled overlays (dialogs, popovers, menus, toasts) render into. `null` renders\n * them into `document.body`, also inside a provider that sets a container.\n * @default the enclosing WaveProvider's container, else document.body\n */\n portalContainer?: HTMLElement | null;\n /** Content rendered inside the themed container. */\n children: React.ReactNode;\n /** Ref to the themed root `<div>`. */\n ref?: React.Ref<HTMLDivElement>;\n}\n\n/** Value provided by {@link WaveProvider} and returned by {@link useWaveTheme}. */\nexport interface WaveContextValue {\n /** The active theme. */\n theme: WaveTheme;\n /** The active text direction. */\n dir: WaveDir;\n /**\n * Theme classes of the nearest provider (see {@link getThemeClassName}); portals put them on\n * their wrapper so overlays inherit the theme. `''` outside a provider (the page's own theme).\n */\n themeClassName: string;\n /** Element portaled overlays render into; `null` means `document.body`. */\n portalContainer: HTMLElement | null;\n /** `false` when no {@link WaveProvider} is above the caller (the defaults are returned). */\n hasProvider: boolean;\n}\n\nconst DEFAULT_CONTEXT: WaveContextValue = {\n theme: 'light',\n dir: 'ltr',\n themeClassName: '',\n portalContainer: null,\n hasProvider: false,\n};\n\nconst WaveContext = React.createContext<WaveContextValue>(DEFAULT_CONTEXT);\n\n/**\n * Reads the theme, direction, theme classes and portal container of the nearest\n * {@link WaveProvider}. Outside a provider it returns light/ltr defaults with `hasProvider: false`.\n *\n * @returns The {@link WaveContextValue} of the nearest provider.\n */\nexport function useWaveTheme(): WaveContextValue {\n return React.useContext(WaveContext);\n}\n\n/**\n * Applies Wave theming to an application or subtree.\n *\n * - Renders a `<div class=\"wave-root wave-<theme>\">` that declares the theme's tokens and paints\n * the themed background, text colour and font (`bg-background text-foreground font-wave\n * text-body-1`; a `className` passed by you wins). The precompiled `./styles` entry scopes its base\n * styles and native-element reset to this root, so it is required there.\n * - Sets `dir` and `data-wave-theme` on the root. An unknown `theme` value (from untyped code)\n * falls back to `'light'` — classes, `data-wave-theme` and the context value — and warns once in\n * development.\n * - Provides theme, direction, theme classes and the portal container through context, so\n * portaled overlays render with the same theme and direction.\n * - Nests: a provider inherits every prop it omits (`theme`, `dir`, `portalContainer`) from the\n * enclosing provider, so `<WaveProvider theme=\"light\">` inside an RTL app is a light panel that\n * stays right-to-left and keeps the app's portal container. At the top level the defaults are\n * `'light'`, `'ltr'` and `document.body`.\n */\nexport const WaveProvider = ({\n theme: themeProp,\n dir: dirProp,\n portalContainer: portalContainerProp,\n children,\n className,\n ref,\n ...rest\n}: WaveProviderProps) => {\n // Omitted props come from the enclosing provider; outside one, DEFAULT_CONTEXT supplies the\n // top-level defaults. An explicit `portalContainer={null}` means document.body, so only\n // `undefined` inherits.\n const parent = React.useContext(WaveContext);\n const theme = themeProp ?? parent.theme;\n const dir = dirProp ?? parent.dir;\n const portalContainer =\n portalContainerProp === undefined ? parent.portalContainer : portalContainerProp;\n\n // An unknown value (untyped callers) renders, and is reported, as the light theme.\n const resolvedTheme: WaveTheme = isWaveTheme(theme) ? theme : 'light';\n const themeClassName = getThemeClassName(resolvedTheme);\n\n React.useEffect(() => {\n if (!isWaveTheme(theme)) {\n warnOnce(\n `WaveProvider:theme:${String(theme)}`,\n `WaveProvider: unknown theme \"${String(theme)}\". Valid themes: ${WAVE_THEMES.join(', ')}. Using \"light\".`,\n );\n }\n }, [theme]);\n\n const value = React.useMemo<WaveContextValue>(\n () => ({ theme: resolvedTheme, dir, themeClassName, portalContainer, hasProvider: true }),\n [resolvedTheme, dir, themeClassName, portalContainer],\n );\n\n return (\n <WaveContext.Provider value={value}>\n <div\n {...rest}\n ref={ref}\n dir={dir}\n data-wave-theme={resolvedTheme}\n className={cn(\n waveProviderClassNames.root,\n themeClassName,\n 'bg-background text-foreground font-wave text-body-1',\n className,\n )}\n >\n {children}\n </div>\n </WaveContext.Provider>\n );\n};\n\nWaveProvider.displayName = 'WaveProvider';\n"],"mappings":"oRAgEA,IAAMa,EAAcb,EAAM,cAAgC,CAPxD,MAAO,QACP,IAAK,MACL,eAAgB,GAChB,gBAAiB,KACjB,YAAa,EAG2C,CAAe,EAQzE,SAAgBc,GAAiC,CAC/C,OAAOd,EAAM,WAAWa,CAAW,CACrC,CAmBA,IAAaE,GAAgB,CAC3B,MAAOC,EACP,IAAKC,EACL,gBAAiBC,EACjB,WACA,YACA,MACA,GAAGC,KACoB,CAIvB,IAAMC,EAASpB,EAAM,WAAWa,CAAW,EACrCQ,EAAQL,GAAaI,EAAO,MAC5BE,EAAML,GAAWG,EAAO,IACxBG,EACJL,IAAwB,IAAA,GAAYE,EAAO,gBAAkBF,EAGzDM,EAA2BvB,EAAAA,YAAYoB,CAAK,EAAIA,EAAQ,QACxDI,EAAiBvB,EAAAA,kBAAkBsB,CAAa,EAEtDb,EAAM,cAAgB,CACfV,EAAAA,YAAYoB,CAAK,GACpBb,EAAA,SACE,sBAAsB,OAAOa,CAAK,IAClC,gCAAgC,OAAOA,CAAK,EAAE,mBAAmBlB,EAAAA,YAAY,KAAK,IAAI,EAAE,iBAC1F,CAEJ,EAAG,CAACkB,CAAK,CAAC,EAEV,IAAMK,EAAQ1B,EAAM,aACX,CAAE,MAAOwB,EAAe,MAAK,iBAAgB,kBAAiB,YAAa,EAAK,GACvF,CAACA,EAAeF,EAAKG,EAAgBF,CAAe,CACtD,EAEA,OACE,EAAAX,EAAA,IAAA,CAACC,EAAY,SAAb,CAA6B,QAC3B,UAAA,EAAAD,EAAA,IAAA,CAAC,MAAD,CACE,GAAIO,EACC,MACA,MACL,kBAAiBK,EACjB,UAAWpB,EAAAA,GACTC,EAAAA,uBAAuB,KACvBoB,EACA,sDACAE,CACF,EAEC,UACE,CAAA,CACe,CAAA,CAE1B,EAEA,EAAa,YAAc"}
@@ -1,51 +1,52 @@
1
1
  "use client";
2
2
  import { cn as e } from "../../lib/cn.mjs";
3
3
  import { warnOnce as t } from "../../lib/dev.mjs";
4
- import { WAVE_THEMES as n, getThemeClassName as r, isWaveTheme as i } from "../../lib/theme.mjs";
5
- import * as a from "react";
6
- import { jsx as o } from "react/jsx-runtime";
4
+ import { waveProviderClassNames as n } from "../../lib/classNames.mjs";
5
+ import { WAVE_THEMES as r, getThemeClassName as i, isWaveTheme as a } from "../../lib/theme.mjs";
6
+ import * as o from "react";
7
+ import { jsx as s } from "react/jsx-runtime";
7
8
  //#region src/components/provider/WaveProvider.tsx
8
- var s = a.createContext({
9
+ var c = o.createContext({
9
10
  theme: "light",
10
11
  dir: "ltr",
11
12
  themeClassName: "",
12
13
  portalContainer: null,
13
14
  hasProvider: !1
14
15
  });
15
- function c() {
16
- return a.useContext(s);
16
+ function l() {
17
+ return o.useContext(c);
17
18
  }
18
- var l = ({ theme: c, dir: l, portalContainer: u, children: d, className: f, ref: p, ...m }) => {
19
- let h = a.useContext(s), g = c ?? h.theme, _ = l ?? h.dir, v = u === void 0 ? h.portalContainer : u, y = i(g) ? g : "light", b = r(y);
20
- a.useEffect(() => {
21
- i(g) || t(`WaveProvider:theme:${String(g)}`, `WaveProvider: unknown theme "${String(g)}". Valid themes: ${n.join(", ")}. Using "light".`);
22
- }, [g]);
23
- let x = a.useMemo(() => ({
24
- theme: y,
25
- dir: _,
26
- themeClassName: b,
27
- portalContainer: v,
19
+ var u = ({ theme: l, dir: u, portalContainer: d, children: f, className: p, ref: m, ...h }) => {
20
+ let g = o.useContext(c), _ = l ?? g.theme, v = u ?? g.dir, y = d === void 0 ? g.portalContainer : d, b = a(_) ? _ : "light", x = i(b);
21
+ o.useEffect(() => {
22
+ a(_) || t(`WaveProvider:theme:${String(_)}`, `WaveProvider: unknown theme "${String(_)}". Valid themes: ${r.join(", ")}. Using "light".`);
23
+ }, [_]);
24
+ let S = o.useMemo(() => ({
25
+ theme: b,
26
+ dir: v,
27
+ themeClassName: x,
28
+ portalContainer: y,
28
29
  hasProvider: !0
29
30
  }), [
30
- y,
31
- _,
32
31
  b,
33
- v
32
+ v,
33
+ x,
34
+ y
34
35
  ]);
35
- return /* @__PURE__ */ o(s.Provider, {
36
- value: x,
37
- children: /* @__PURE__ */ o("div", {
38
- ...m,
39
- ref: p,
40
- dir: _,
41
- "data-wave-theme": y,
42
- className: e("wave-root", b, "bg-background text-foreground font-wave text-body-1", f),
43
- children: d
36
+ return /* @__PURE__ */ s(c.Provider, {
37
+ value: S,
38
+ children: /* @__PURE__ */ s("div", {
39
+ ...h,
40
+ ref: m,
41
+ dir: v,
42
+ "data-wave-theme": b,
43
+ className: e(n.root, x, "bg-background text-foreground font-wave text-body-1", p),
44
+ children: f
44
45
  })
45
46
  });
46
47
  };
47
- l.displayName = "WaveProvider";
48
+ u.displayName = "WaveProvider";
48
49
  //#endregion
49
- export { l as WaveProvider, r as getThemeClassName, c as useWaveTheme };
50
+ export { u as WaveProvider, i as getThemeClassName, l as useWaveTheme };
50
51
 
51
52
  //# sourceMappingURL=WaveProvider.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"WaveProvider.mjs","names":["React","WaveContext","useWaveTheme","WaveProvider","themeProp","dirProp","portalContainerProp","rest","parent","theme","dir","portalContainer","resolvedTheme","isWaveTheme","themeClassName","getThemeClassName","warnOnce","WAVE_THEMES","value","cn","className"],"sources":["../../../src/components/provider/WaveProvider.tsx"],"sourcesContent":["import * as React from 'react';\nimport { cn } from '../../lib/cn';\nimport { warnOnce } from '../../lib/dev';\nimport { getThemeClassName, isWaveTheme, WAVE_THEMES, type WaveTheme } from '../../lib/theme';\n\n// The theme helper lives in server-safe src/lib (no \"use client\"), so React Server Components can\n// call it; it stays exported from here too.\nexport { getThemeClassName } from '../../lib/theme';\nexport type { WaveTheme } from '../../lib/theme';\n\n/** Text direction for bidirectional layout support. */\nexport type WaveDir = 'ltr' | 'rtl';\n\n/** Props accepted by {@link WaveProvider}. */\nexport interface WaveProviderProps extends React.HTMLAttributes<HTMLDivElement> {\n /**\n * Visual theme applied to the subtree. Providers can be nested in any order: each root declares\n * its theme's tokens, so a light panel inside a dark app (and the reverse) renders correctly.\n * @default the enclosing WaveProvider's theme, else 'light'\n */\n theme?: WaveTheme;\n /**\n * Text direction for the subtree (also read by portaled overlays and keyboard navigation).\n * @default the enclosing WaveProvider's direction, else 'ltr'\n */\n dir?: WaveDir;\n /**\n * Element that portaled overlays (dialogs, popovers, menus, toasts) render into. `null` renders\n * them into `document.body`, also inside a provider that sets a container.\n * @default the enclosing WaveProvider's container, else document.body\n */\n portalContainer?: HTMLElement | null;\n /** Content rendered inside the themed container. */\n children: React.ReactNode;\n /** Ref to the themed root `<div>`. */\n ref?: React.Ref<HTMLDivElement>;\n}\n\n/** Value provided by {@link WaveProvider} and returned by {@link useWaveTheme}. */\nexport interface WaveContextValue {\n /** The active theme. */\n theme: WaveTheme;\n /** The active text direction. */\n dir: WaveDir;\n /**\n * Theme classes of the nearest provider (see {@link getThemeClassName}); portals put them on\n * their wrapper so overlays inherit the theme. `''` outside a provider (the page's own theme).\n */\n themeClassName: string;\n /** Element portaled overlays render into; `null` means `document.body`. */\n portalContainer: HTMLElement | null;\n /** `false` when no {@link WaveProvider} is above the caller (the defaults are returned). */\n hasProvider: boolean;\n}\n\nconst DEFAULT_CONTEXT: WaveContextValue = {\n theme: 'light',\n dir: 'ltr',\n themeClassName: '',\n portalContainer: null,\n hasProvider: false,\n};\n\nconst WaveContext = React.createContext<WaveContextValue>(DEFAULT_CONTEXT);\n\n/**\n * Reads the theme, direction, theme classes and portal container of the nearest\n * {@link WaveProvider}. Outside a provider it returns light/ltr defaults with `hasProvider: false`.\n *\n * @returns The {@link WaveContextValue} of the nearest provider.\n */\nexport function useWaveTheme(): WaveContextValue {\n return React.useContext(WaveContext);\n}\n\n/**\n * Applies Wave theming to an application or subtree.\n *\n * - Renders a `<div class=\"wave-root wave-<theme>\">` that declares the theme's tokens and paints\n * the themed background, text colour and font (`bg-background text-foreground font-wave\n * text-body-1`; a `className` passed by you wins). The precompiled `./styles` entry scopes its base\n * styles and native-element reset to this root, so it is required there.\n * - Sets `dir` and `data-wave-theme` on the root. An unknown `theme` value (from untyped code)\n * falls back to `'light'` — classes, `data-wave-theme` and the context value — and warns once in\n * development.\n * - Provides theme, direction, theme classes and the portal container through context, so\n * portaled overlays render with the same theme and direction.\n * - Nests: a provider inherits every prop it omits (`theme`, `dir`, `portalContainer`) from the\n * enclosing provider, so `<WaveProvider theme=\"light\">` inside an RTL app is a light panel that\n * stays right-to-left and keeps the app's portal container. At the top level the defaults are\n * `'light'`, `'ltr'` and `document.body`.\n */\nexport const WaveProvider = ({\n theme: themeProp,\n dir: dirProp,\n portalContainer: portalContainerProp,\n children,\n className,\n ref,\n ...rest\n}: WaveProviderProps) => {\n // Omitted props come from the enclosing provider; outside one, DEFAULT_CONTEXT supplies the\n // top-level defaults. An explicit `portalContainer={null}` means document.body, so only\n // `undefined` inherits.\n const parent = React.useContext(WaveContext);\n const theme = themeProp ?? parent.theme;\n const dir = dirProp ?? parent.dir;\n const portalContainer =\n portalContainerProp === undefined ? parent.portalContainer : portalContainerProp;\n\n // An unknown value (untyped callers) renders, and is reported, as the light theme.\n const resolvedTheme: WaveTheme = isWaveTheme(theme) ? theme : 'light';\n const themeClassName = getThemeClassName(resolvedTheme);\n\n React.useEffect(() => {\n if (!isWaveTheme(theme)) {\n warnOnce(\n `WaveProvider:theme:${String(theme)}`,\n `WaveProvider: unknown theme \"${String(theme)}\". Valid themes: ${WAVE_THEMES.join(', ')}. Using \"light\".`,\n );\n }\n }, [theme]);\n\n const value = React.useMemo<WaveContextValue>(\n () => ({ theme: resolvedTheme, dir, themeClassName, portalContainer, hasProvider: true }),\n [resolvedTheme, dir, themeClassName, portalContainer],\n );\n\n return (\n <WaveContext.Provider value={value}>\n <div\n {...rest}\n ref={ref}\n dir={dir}\n data-wave-theme={resolvedTheme}\n className={cn(\n 'wave-root',\n themeClassName,\n 'bg-background text-foreground font-wave text-body-1',\n className,\n )}\n >\n {children}\n </div>\n </WaveContext.Provider>\n );\n};\n\nWaveProvider.displayName = 'WaveProvider';\n"],"mappings":";;;;;;;AA+DA,IAAMC,IAAcD,EAAM,cAAgC;CAPxD,OAAO;CACP,KAAK;CACL,gBAAgB;CAChB,iBAAiB;CACjB,aAAa;AAG2C,CAAe;AAQzE,SAAgBE,IAAiC;CAC/C,OAAOF,EAAM,WAAWC,CAAW;AACrC;AAmBA,IAAaE,KAAgB,EAC3B,OAAOC,GACP,KAAKC,GACL,iBAAiBC,GACjB,aACA,cACA,QACA,GAAGC,QACoB;CAIvB,IAAMC,IAASR,EAAM,WAAWC,CAAW,GACrCQ,IAAQL,KAAaI,EAAO,OAC5BE,IAAML,KAAWG,EAAO,KACxBG,IACJL,MAAwB,KAAA,IAAYE,EAAO,kBAAkBF,GAGzDM,IAA2BC,EAAYJ,CAAK,IAAIA,IAAQ,SACxDK,IAAiBC,EAAkBH,CAAa;CAEtD,EAAM,gBAAgB;EACpB,AAAKC,EAAYJ,CAAK,KACpBO,EACE,sBAAsB,OAAOP,CAAK,KAClC,gCAAgC,OAAOA,CAAK,EAAE,mBAAmBQ,EAAY,KAAK,IAAI,EAAE,iBAC1F;CAEJ,GAAG,CAACR,CAAK,CAAC;CAEV,IAAMS,IAAQlB,EAAM,eACX;EAAE,OAAOY;EAAe;EAAK;EAAgB;EAAiB,aAAa;CAAK,IACvF;EAACA;EAAeF;EAAKI;EAAgBH;CAAe,CACtD;CAEA,OACE,kBAACV,EAAY,UAAb;EAA6B;EAC3B,UAAA,kBAAC,OAAD;GACE,GAAIM;GACC;GACA;GACL,mBAAiBK;GACjB,WAAWO,EACT,aACAL,GACA,uDACAM,CACF;GAEC;EACE,CAAA;CACe,CAAA;AAE1B;AAEA,EAAa,cAAc"}
1
+ {"version":3,"file":"WaveProvider.mjs","names":["React","WaveContext","useWaveTheme","WaveProvider","themeProp","dirProp","portalContainerProp","rest","parent","theme","dir","portalContainer","resolvedTheme","isWaveTheme","themeClassName","getThemeClassName","warnOnce","WAVE_THEMES","value","cn","waveProviderClassNames","className"],"sources":["../../../src/components/provider/WaveProvider.tsx"],"sourcesContent":["import * as React from 'react';\nimport { cn } from '../../lib/cn';\nimport { warnOnce } from '../../lib/dev';\nimport { waveProviderClassNames } from '../../lib/classNames';\nimport { getThemeClassName, isWaveTheme, WAVE_THEMES, type WaveTheme } from '../../lib/theme';\n\n// The theme helper lives in server-safe src/lib (no \"use client\"), so React Server Components can\n// call it; it stays exported from here too.\nexport { getThemeClassName } from '../../lib/theme';\nexport type { WaveTheme } from '../../lib/theme';\n\n/** Text direction for bidirectional layout support. */\nexport type WaveDir = 'ltr' | 'rtl';\n\n/** Props accepted by {@link WaveProvider}. */\nexport interface WaveProviderProps extends React.HTMLAttributes<HTMLDivElement> {\n /**\n * Visual theme applied to the subtree. Providers can be nested in any order: each root declares\n * its theme's tokens, so a light panel inside a dark app (and the reverse) renders correctly.\n * @default the enclosing WaveProvider's theme, else 'light'\n */\n theme?: WaveTheme;\n /**\n * Text direction for the subtree (also read by portaled overlays and keyboard navigation).\n * @default the enclosing WaveProvider's direction, else 'ltr'\n */\n dir?: WaveDir;\n /**\n * Element that portaled overlays (dialogs, popovers, menus, toasts) render into. `null` renders\n * them into `document.body`, also inside a provider that sets a container.\n * @default the enclosing WaveProvider's container, else document.body\n */\n portalContainer?: HTMLElement | null;\n /** Content rendered inside the themed container. */\n children: React.ReactNode;\n /** Ref to the themed root `<div>`. */\n ref?: React.Ref<HTMLDivElement>;\n}\n\n/** Value provided by {@link WaveProvider} and returned by {@link useWaveTheme}. */\nexport interface WaveContextValue {\n /** The active theme. */\n theme: WaveTheme;\n /** The active text direction. */\n dir: WaveDir;\n /**\n * Theme classes of the nearest provider (see {@link getThemeClassName}); portals put them on\n * their wrapper so overlays inherit the theme. `''` outside a provider (the page's own theme).\n */\n themeClassName: string;\n /** Element portaled overlays render into; `null` means `document.body`. */\n portalContainer: HTMLElement | null;\n /** `false` when no {@link WaveProvider} is above the caller (the defaults are returned). */\n hasProvider: boolean;\n}\n\nconst DEFAULT_CONTEXT: WaveContextValue = {\n theme: 'light',\n dir: 'ltr',\n themeClassName: '',\n portalContainer: null,\n hasProvider: false,\n};\n\nconst WaveContext = React.createContext<WaveContextValue>(DEFAULT_CONTEXT);\n\n/**\n * Reads the theme, direction, theme classes and portal container of the nearest\n * {@link WaveProvider}. Outside a provider it returns light/ltr defaults with `hasProvider: false`.\n *\n * @returns The {@link WaveContextValue} of the nearest provider.\n */\nexport function useWaveTheme(): WaveContextValue {\n return React.useContext(WaveContext);\n}\n\n/**\n * Applies Wave theming to an application or subtree.\n *\n * - Renders a `<div class=\"wave-root wave-<theme>\">` that declares the theme's tokens and paints\n * the themed background, text colour and font (`bg-background text-foreground font-wave\n * text-body-1`; a `className` passed by you wins). The precompiled `./styles` entry scopes its base\n * styles and native-element reset to this root, so it is required there.\n * - Sets `dir` and `data-wave-theme` on the root. An unknown `theme` value (from untyped code)\n * falls back to `'light'` — classes, `data-wave-theme` and the context value — and warns once in\n * development.\n * - Provides theme, direction, theme classes and the portal container through context, so\n * portaled overlays render with the same theme and direction.\n * - Nests: a provider inherits every prop it omits (`theme`, `dir`, `portalContainer`) from the\n * enclosing provider, so `<WaveProvider theme=\"light\">` inside an RTL app is a light panel that\n * stays right-to-left and keeps the app's portal container. At the top level the defaults are\n * `'light'`, `'ltr'` and `document.body`.\n */\nexport const WaveProvider = ({\n theme: themeProp,\n dir: dirProp,\n portalContainer: portalContainerProp,\n children,\n className,\n ref,\n ...rest\n}: WaveProviderProps) => {\n // Omitted props come from the enclosing provider; outside one, DEFAULT_CONTEXT supplies the\n // top-level defaults. An explicit `portalContainer={null}` means document.body, so only\n // `undefined` inherits.\n const parent = React.useContext(WaveContext);\n const theme = themeProp ?? parent.theme;\n const dir = dirProp ?? parent.dir;\n const portalContainer =\n portalContainerProp === undefined ? parent.portalContainer : portalContainerProp;\n\n // An unknown value (untyped callers) renders, and is reported, as the light theme.\n const resolvedTheme: WaveTheme = isWaveTheme(theme) ? theme : 'light';\n const themeClassName = getThemeClassName(resolvedTheme);\n\n React.useEffect(() => {\n if (!isWaveTheme(theme)) {\n warnOnce(\n `WaveProvider:theme:${String(theme)}`,\n `WaveProvider: unknown theme \"${String(theme)}\". Valid themes: ${WAVE_THEMES.join(', ')}. Using \"light\".`,\n );\n }\n }, [theme]);\n\n const value = React.useMemo<WaveContextValue>(\n () => ({ theme: resolvedTheme, dir, themeClassName, portalContainer, hasProvider: true }),\n [resolvedTheme, dir, themeClassName, portalContainer],\n );\n\n return (\n <WaveContext.Provider value={value}>\n <div\n {...rest}\n ref={ref}\n dir={dir}\n data-wave-theme={resolvedTheme}\n className={cn(\n waveProviderClassNames.root,\n themeClassName,\n 'bg-background text-foreground font-wave text-body-1',\n className,\n )}\n >\n {children}\n </div>\n </WaveContext.Provider>\n );\n};\n\nWaveProvider.displayName = 'WaveProvider';\n"],"mappings":";;;;;;;;AAgEA,IAAMC,IAAcD,EAAM,cAAgC;CAPxD,OAAO;CACP,KAAK;CACL,gBAAgB;CAChB,iBAAiB;CACjB,aAAa;AAG2C,CAAe;AAQzE,SAAgBE,IAAiC;CAC/C,OAAOF,EAAM,WAAWC,CAAW;AACrC;AAmBA,IAAaE,KAAgB,EAC3B,OAAOC,GACP,KAAKC,GACL,iBAAiBC,GACjB,aACA,cACA,QACA,GAAGC,QACoB;CAIvB,IAAMC,IAASR,EAAM,WAAWC,CAAW,GACrCQ,IAAQL,KAAaI,EAAO,OAC5BE,IAAML,KAAWG,EAAO,KACxBG,IACJL,MAAwB,KAAA,IAAYE,EAAO,kBAAkBF,GAGzDM,IAA2BC,EAAYJ,CAAK,IAAIA,IAAQ,SACxDK,IAAiBC,EAAkBH,CAAa;CAEtD,EAAM,gBAAgB;EACpB,AAAKC,EAAYJ,CAAK,KACpBO,EACE,sBAAsB,OAAOP,CAAK,KAClC,gCAAgC,OAAOA,CAAK,EAAE,mBAAmBQ,EAAY,KAAK,IAAI,EAAE,iBAC1F;CAEJ,GAAG,CAACR,CAAK,CAAC;CAEV,IAAMS,IAAQlB,EAAM,eACX;EAAE,OAAOY;EAAe;EAAK;EAAgB;EAAiB,aAAa;CAAK,IACvF;EAACA;EAAeF;EAAKI;EAAgBH;CAAe,CACtD;CAEA,OACE,kBAACV,EAAY,UAAb;EAA6B;EAC3B,UAAA,kBAAC,OAAD;GACE,GAAIM;GACC;GACA;GACL,mBAAiBK;GACjB,WAAWO,EACTC,EAAuB,MACvBN,GACA,uDACAO,CACF;GAEC;EACE,CAAA;CACe,CAAA;AAE1B;AAEA,EAAa,cAAc"}
@@ -1,2 +1,2 @@
1
- "use client";const e=require("../../_virtual/_rolldown/runtime.cjs"),t=require("../../lib/cn.cjs"),n=require("../../lib/children.cjs"),r=require("../../lib/dev.cjs"),i=require("../../lib/composeEventHandlers.cjs"),a=require("../../hooks/useControllable.cjs"),o=require("../../hooks/useId.cjs"),s=require("../../hooks/useMergedRefs.cjs"),c=require("../../lib/styles.cjs"),l=require("./useGridNavigation.cjs");let u=require("react");u=e.__toESM(u,1);let d=require("react/jsx-runtime");var f=`Select all rows`,p=`Selection`;function m(e,t=!1){let n=new Set(e),r=new Map,i=0,a=`none`,o=t,s,c=new Set,l=new Set,u=e=>{for(let t of Array.from(e))t()},d=()=>{if(s!==void 0)return s;let e=null;for(let t of n){if(r.has(t)){e=t;break}e??=t}return s=e,e},f=e=>{if(n.size<2||!n.has(e))return;let t=s;s=void 0,o&&d()!==t&&u(c)},p=()=>{let e=i===0?`none`:i===r.size?`all`:`some`;e!==a&&(a=e,u(l))},m=e=>t=>(e.add(t),()=>{e.delete(t)});return{subscribe:m(c),subscribeSelectAll:m(l),register(e){let t=r.get(e)??0;r.set(e,t+1),t===0&&n.has(e)&&(i+=1),p(),t===0&&f(e);let a=!1;return()=>{if(a)return;a=!0;let t=(r.get(e)??0)-1;if(t>0){r.set(e,t);return}r.delete(e),n.has(e)&&--i,p(),f(e)}},setSelected(e){let t=new Set(e);if(!(t.size===n.size&&e.every(e=>n.has(e)))){n=t,s=void 0,i=0;for(let e of t)r.has(e)&&(i+=1);u(c),p()}},setSingleMode(e){o=e},isSelected(e,t=!1){return t?d()===e:n.has(e)},countRegistrations(e){return r.get(e)??0},getSelectAllState(){return a},getRegistered(){return Array.from(r.keys())},prune(e){return e.filter(e=>r.has(e))}}}function h(){let e=new Map,t=new Set,n=null,r=()=>{let r=null,i=null;for(let[t,a]of e){let o=a();if(!o){if(n!==null&&e.has(n))return;continue}(!i||o.compareDocumentPosition(i)&Node.DOCUMENT_POSITION_FOLLOWING)&&(r=t,i=o)}if(r===null&&(r=e.keys().next().value??null),r!==n){n=r;for(let e of Array.from(t))e()}};return{subscribe(e){return t.add(e),()=>{t.delete(e)}},register(t,n){return e.set(t,n),r(),()=>{e.delete(t),r()}},getFirst:()=>n,refresh:r}}var g=u.createContext(null),_=u.createContext(null),v=u.createContext(`body`),y=u.createContext(null),b=u.createContext(!0),x={selectionMode:`none`,store:m([]),toggleRow:()=>{},toggleAll:()=>{},radioName:``,selectAllLabel:f,selectionHeaderLabel:p},S={sort:null,requestSort:()=>{}};function C(e){return u.useContext(g)||(r.reportMissingContext(e,`DataGrid`),x)}function w(e){return u.useContext(_)||(r.reportMissingContext(e,`DataGrid`),S)}var T=[];function E(e){return e===void 0?void 0:Array.from(e)}function D(e,t){return e.length===t.length&&e.every((e,n)=>e===t[n])}function O({key:e,node:t}){return(0,d.jsx)(u.Fragment,{children:t},e)}function ee(e){r.warnOnce(`DataGrid:duplicate-rowId:${e}`,`DataGrid: several rows share the rowId "${e}". Row ids must be unique within a DataGrid; rows with the same rowId are selected and deselected together.`)}var k=`px-4 py-3 border-b border-border`,A=`w-10 px-3 py-3 border-b border-border`,j=`accent-primary cursor-pointer`,M=e=>{let{sort:c,defaultSort:h,sortColumn:v,defaultSortColumn:y,sortDirection:b,defaultSortDirection:x,onSortChange:S,selectionMode:C=`none`,selectedItems:w,defaultSelectedItems:ee,onSelectedItemsChange:k,selectedKeys:A,defaultSelectedKeys:j,onSelectionChange:M,labels:N,columns:P,containerProps:F,children:I,className:R,onKeyDown:B,onFocus:V,onBlur:H,ref:te,...ne}=e,U=c!==void 0||h!==void 0,[re,ie]=u.useState(U);U&&!re&&ie(!0);let ae=re||U,oe=v!==void 0||b!==void 0;v!==void 0&&r.warnDeprecated(`DataGrid`,`sortColumn`,`sort`),b!==void 0&&r.warnDeprecated(`DataGrid`,`sortDirection`,`sort`),y!==void 0&&r.warnDeprecated(`DataGrid`,`defaultSortColumn`,`defaultSort`),x!==void 0&&r.warnDeprecated(`DataGrid`,`defaultSortDirection`,`defaultSort`);let se=U&&(oe||y!==void 0||x!==void 0);u.useEffect(()=>{se&&r.warnOnce(`DataGrid:mixed-sort`,"DataGrid: do not mix `sort`/`defaultSort` with the deprecated `sortColumn`/`sortDirection`/`defaultSortColumn`/`defaultSortDirection`. `sort`/`defaultSort` win.")},[se]),u.useEffect(()=>{U||(v!==void 0&&b===void 0?r.warnOnce(`DataGrid:sortColumn-without-sortDirection`,"DataGrid: `sortColumn` is controlled but `sortDirection` is not (mixed control). The direction is kept internally and toggles on repeated clicks, as in 0.4. Pass `sort` (`{ columnId, direction }`) to control both."):b!==void 0&&v===void 0&&r.warnOnce(`DataGrid:sortDirection-without-sortColumn`,"DataGrid: `sortDirection` is controlled but `sortColumn` is not (mixed control). The column is kept internally and follows the clicked header, as in 0.4. Pass `sort` (`{ columnId, direction }`) to control both."))},[U,v,b]);let[W,ce]=u.useState(()=>({column:y??``,direction:x??`ascending`})),le=u.useMemo(()=>{if(v===void 0&&b===void 0)return;let e=v??W.column;return e===``?null:{columnId:e,direction:b??W.direction}},[v,b,W]),ue=u.useMemo(()=>y?{columnId:y,direction:x??`ascending`}:null,[y,x]),de=U?c:le,fe=h===void 0?ue:h,[pe,me]=a.useControllable(de,fe,e=>{e&&(U||ce(t=>t.column===e.columnId&&t.direction===e.direction?t:{column:e.columnId,direction:e.direction}),S&&(ae?S(e):S(e.columnId,e.direction)))}),he=u.useCallback(e=>{me(t=>({columnId:e,direction:t?.columnId===e&&t.direction===`ascending`?`descending`:`ascending`}))},[me]),ge=u.useMemo(()=>({sort:pe,requestSort:he}),[pe,he]);M!==void 0&&r.warnDeprecated(`DataGrid`,`onSelectionChange`,`onSelectedItemsChange`);let _e=u.useMemo(()=>E(A),[A]),ve=u.useMemo(()=>E(j),[j]),ye=r.resolveDeprecatedProp(`DataGrid`,w,_e,`selectedKeys`,`selectedItems`),be=r.resolveDeprecatedProp(`DataGrid`,ee,ve,`defaultSelectedKeys`,`defaultSelectedItems`)??T,[G,K]=a.useControllable(ye,be,e=>{k?.([...e]),M?.(new Set(e))}),q=C===`single`,[J]=u.useState(()=>m(G,q));u.useLayoutEffect(()=>{J.setSelected(G)},[J,G]),u.useLayoutEffect(()=>{J.setSingleMode(q)},[J,q]);let xe=u.useCallback(e=>{K(t=>{let n=J.prune(t),r;return r=q?n[0]===e?[]:[e]:n.includes(e)?n.filter(t=>t!==e):[...n,e],D(r,t)?t:r})},[q,K,J]),Y=G.length;u.useEffect(()=>{q&&Y>1&&r.warnOnce(`DataGrid:single-several-selected`,`DataGrid: a single-selection grid (selectionMode "single") has ${Y} selected row ids; only the first one that is rendered is selected. Pass at most one id in \`selectedItems\`/\`defaultSelectedItems\`, or use selectionMode="multiple".`)},[q,Y]);let Se=u.useCallback(()=>{K(e=>{let t=J.prune(e),n=J.getRegistered(),r=n.length>0&&n.every(e=>t.includes(e))?[]:n;return D(r,e)?e:r})},[K,J]),Ce=o.useId(`wave-datagrid-selection`),we=N?.selectAll??f,Te=N?.selectionHeader??p,Ee=u.useMemo(()=>({selectionMode:C,store:J,toggleRow:xe,toggleAll:Se,radioName:Ce,selectAllLabel:we,selectionHeaderLabel:Te}),[C,J,xe,Se,Ce,we,Te]),{gridRef:De,gridProps:X}=l.useGridNavigation(),Oe=s.useMergedRefs(te,De),ke=I,Z=P?n.flattenChildren(I):[];if(P&&!Z.some(({node:e})=>n.isElementOfType(e,L))){let e=({node:e})=>n.isElementOfType(e,`caption`);ke=(0,d.jsxs)(d.Fragment,{children:[Z.filter(e).map(O),(0,d.jsx)(L,{children:(0,d.jsx)(`tr`,{children:P.map(e=>(0,d.jsx)(z,{columnId:e.id,sortable:e.sortable,children:e.label},e.id))})}),Z.filter(t=>!e(t)).map(O)]})}let{className:Ae,"aria-label":je,"aria-labelledby":Q,...Me}=F??{},$=Me.role!==void 0,Ne=!$&&(je!==void 0||Q!==void 0);return u.useEffect(()=>{Ne&&r.warnOnce(`DataGrid:container-name-without-role`,'DataGrid: `containerProps["aria-label"]`/`["aria-labelledby"]` is ignored because the wrapper has no role. Name the grid itself (`aria-label` on DataGrid), or pass a `role` (e.g. "region") in `containerProps` too.')},[Ne]),(0,d.jsx)(g.Provider,{value:Ee,children:(0,d.jsx)(_.Provider,{value:ge,children:(0,d.jsx)(`div`,{...Me,"aria-label":$?je:void 0,"aria-labelledby":$?Q:void 0,className:t.cn(`overflow-x-auto rounded-md border border-border`,Ae),children:(0,d.jsx)(`table`,{ref:Oe,role:`grid`,"aria-multiselectable":C===`multiple`||void 0,className:t.cn(`w-full border-separate border-spacing-0`,R),...ne,onKeyDown:i.composeEventHandlers(B,X.onKeyDown),onFocus:i.composeEventHandlers(V,X.onFocus,{checkDefaultPrevented:!1}),onBlur:i.composeEventHandlers(H,X.onBlur,{checkDefaultPrevented:!1}),children:ke})})})})};M.displayName=`DataGrid`;function N({selectionMode:e,ref:n}){let{store:r,toggleAll:i,selectAllLabel:a,selectionHeaderLabel:o}=C(`DataGrid.Header`),s=u.useSyncExternalStore(r.subscribeSelectAll,r.getSelectAllState,r.getSelectAllState),l=u.useRef(null),[f,p]=u.useState(0);return u.useLayoutEffect(()=>{l.current&&(l.current.indeterminate=s===`some`)},[s,f]),(0,d.jsx)(`th`,{ref:n,scope:`col`,"data-selection-cell":``,className:t.cn(A,`text-start`,c.focusRingInset),children:e===`multiple`?(0,d.jsx)(`input`,{ref:l,type:`checkbox`,"aria-label":a,checked:s===`all`,onChange:()=>{p(e=>e+1),i()},className:t.cn(j,c.focusRingInset)}):(0,d.jsx)(`span`,{className:`sr-only`,children:o})})}var P={subscribe:()=>()=>{},register:()=>()=>{},getFirst:()=>null,refresh:()=>{}};function F({selectionMode:e,initialFirst:n}){let r=u.useContext(y)??P,[i]=u.useState(()=>({})),a=u.useRef(null),o=u.useCallback(()=>{let e=r.getFirst();return e===null?n:e===i},[r,i,n]),s=u.useCallback(()=>n,[n]),l=u.useSyncExternalStore(r.subscribe,o,s);return u.useLayoutEffect(()=>r.register(i,()=>a.current),[r,i]),l?(0,d.jsx)(N,{ref:a,selectionMode:e}):(0,d.jsx)(`td`,{ref:a,"data-selection-cell":``,className:t.cn(A,c.focusRingInset)})}function I(e,t){let r=!0,i=e=>u.Children.map(e,e=>{if(n.isElementOfType(e,u.Fragment))return u.cloneElement(e,void 0,i(e.props.children));if(!u.isValidElement(e))return e;let a=r;if(r=!1,n.isElementOfType(e,`tr`)){let n=t===`none`?null:(0,d.jsx)(F,{selectionMode:t,initialFirst:a});return u.cloneElement(e,void 0,n,e.props.children)}return(0,d.jsx)(b.Provider,{value:a,children:e})});return i(e)}var L=({children:e,className:n,ref:i,...a})=>{let{selectionMode:o}=C(`DataGrid.Header`),[c,l]=u.useState(null),f=s.useMergedRefs(i,l),[p]=u.useState(h),m=I(e,o);return u.useLayoutEffect(()=>{p.refresh()}),u.useEffect(()=>{r.isDev&&c&&o!==`none`&&Array.from(c.rows).some(e=>e.cells.length>0&&!e.cells[0].hasAttribute(`data-selection-cell`))&&r.warnOnce(`DataGrid.Header:missing-selection-cell`,"DataGrid.Header: a header row has no selection column header cell, so the header has one column fewer than the selectable rows. Render header rows as `<tr>` children of DataGrid.Header (a Fragment is fine), or use `DataGrid.Row` for a header row that another component renders.")}),(0,d.jsx)(v.Provider,{value:`header`,children:(0,d.jsx)(y.Provider,{value:p,children:(0,d.jsx)(`thead`,{ref:f,className:t.cn(`bg-card`,n),...a,children:m})})})};L.displayName=`DataGridHeader`;var R=e=>(0,d.jsx)(`svg`,{className:`h-3 w-3 shrink-0`,viewBox:`0 0 12 12`,fill:`currentColor`,"aria-hidden":`true`,focusable:`false`,children:e===`ascending`?(0,d.jsx)(`path`,{d:`M6 2L10 8H2L6 2Z`}):(0,d.jsx)(`path`,{d:`M6 10L2 4H10L6 10Z`})}),z=({columnId:e,sortable:n=!1,children:a,className:o,onClick:s,ref:l,...f})=>{let{sort:p,requestSort:m}=w(`DataGrid.HeaderCell`),h=n&&e?e:void 0,g=h!==void 0&&p?.columnId===h?p.direction:null,_=e=>{let t=e.currentTarget.firstElementChild;h!==void 0&&t?.localName===`button`&&t.contains(e.target)&&m(h)};return u.useEffect(()=>{n&&!e&&r.warnOnce(`DataGrid.HeaderCell:sortable-without-columnId`,"DataGrid.HeaderCell: `sortable` needs a `columnId`; the header is rendered as not sortable.")},[n,e]),(0,d.jsx)(`th`,{ref:l,scope:`col`,"aria-sort":h===void 0?void 0:g??`none`,className:t.cn(k,`text-start align-middle font-semibold text-caption-1 uppercase tracking-wider`,c.focusRingInset,h!==void 0&&`p-0 hover:bg-subtle-hover`,o),...f,onClick:h===void 0?s:i.composeEventHandlers(s,_),children:h===void 0?(0,d.jsx)(`span`,{className:`inline-flex items-center gap-1`,children:a}):(0,d.jsxs)(`button`,{type:`button`,className:t.cn(`inline-flex w-full cursor-pointer select-none items-center gap-1 border-0 bg-transparent px-4 py-3 text-start text-inherit [font:inherit] uppercase tracking-wider`,c.focusRingInset),children:[a,g&&R(g)]})})};z.displayName=`DataGridHeaderCell`;var B=({children:e,className:t,ref:n,...r})=>(0,d.jsx)(v.Provider,{value:`body`,children:(0,d.jsx)(`tbody`,{ref:n,className:t,...r,children:e})});B.displayName=`DataGridBody`;var V=({rowId:e,selectionLabel:a,children:s,className:l,onKeyDown:f,ref:p,...m})=>{let{selectionMode:h,store:g,toggleRow:_,radioName:y}=C(`DataGrid.Row`),x=u.useContext(v),S=u.useContext(b),w=x===`header`,T=h!==`none`&&!w,E=o.useId(`wave-datagrid-row-label`),D=h===`single`,k=u.useCallback(()=>e!==void 0&&g.isSelected(e,D),[e,g,D]),M=u.useSyncExternalStore(g.subscribe,k,k);u.useLayoutEffect(()=>{if(e===void 0||w)return;let t=g.register(e);return r.isDev&&g.countRegistrations(e)>1&&ee(e),t},[g,e,w]),u.useEffect(()=>{T&&e===void 0&&r.warnOnce(`DataGrid.Row:missing-rowId`,"DataGrid.Row: a selectable grid needs a `rowId` on every row; this row has no selection control.")},[T,e]);let N=T&&e!==void 0&&a===void 0,P=t=>{if(!T||e===void 0||t.key!==` `)return;let n=t.target;(n===t.currentTarget||n.parentElement===t.currentTarget)&&(t.preventDefault(),_(e))},I=n.flattenChildren(s),L,R=-1;if(N){let e=I.findIndex(({node:e})=>n.isElementOfType(e,H,`td`,`th`));if(e>=0){let t=I[e].node;L=t.props.id??E,t.props.id===void 0&&(R=e)}}let z=I.map(({key:e,node:t},n)=>O({key:e,node:n===R?u.cloneElement(t,{id:E}):t})),B=N&&L===void 0;u.useEffect(()=>{B&&r.warnOnce(`DataGrid.Row:selection-label`,'DataGrid.Row: no child is a `DataGrid.Cell`, `<td>` or `<th>` element, so the row selection control is named "Select row". Pass `selectionLabel` (a cell rendered by another component is not seen).')},[B]);let V=null;return w&&h!==`none`?V=(0,d.jsx)(F,{selectionMode:h,initialFirst:S}):T&&(V=(0,d.jsx)(`td`,{role:`gridcell`,"data-selection-cell":``,className:t.cn(A,c.focusRingInset),children:e!==void 0&&(0,d.jsx)(`input`,{type:h===`multiple`?`checkbox`:`radio`,name:h===`single`?y:void 0,form:h===`single`?``:void 0,checked:M,onChange:()=>_(e),"aria-label":a??(L?void 0:`Select row`),"aria-labelledby":a===void 0?L:void 0,className:t.cn(j,`focus-visible:outline-2 focus-visible:-outline-offset-2 focus-visible:outline-ring`)})})),(0,d.jsxs)(`tr`,{ref:p,className:t.cn(!w&&`hover:bg-subtle-hover data-[selected]:bg-selected transition-colors motion-reduce:transition-none`,T&&M&&c.forcedColors.selectedContainer,l),"aria-selected":T?M:void 0,"data-selected":T&&M?``:void 0,...m,onKeyDown:i.composeEventHandlers(f,P),children:[V,z]})};V.displayName=`DataGridRow`;var H=({children:e,className:n,ref:r,...i})=>(0,d.jsx)(`td`,{ref:r,role:`gridcell`,className:t.cn(k,`text-body-1`,c.focusRingInset,n),...i,children:e});H.displayName=`DataGridCell`;var te=Object.assign(M,{Header:L,HeaderCell:z,Body:B,Row:V,Cell:H});exports.DataGrid=te,exports.DataGridBody=B,exports.DataGridCell=H,exports.DataGridHeader=L,exports.DataGridHeaderCell=z,exports.DataGridRow=V,exports.createSelectionStore=m;
1
+ "use client";const e=require("../../_virtual/_rolldown/runtime.cjs"),t=require("../../lib/cn.cjs"),n=require("../../lib/children.cjs"),r=require("../../lib/dev.cjs"),i=require("../../lib/composeEventHandlers.cjs"),a=require("../../lib/classNames.cjs"),o=require("../../hooks/useControllable.cjs"),s=require("../../hooks/useId.cjs"),c=require("../../hooks/useMergedRefs.cjs"),l=require("../../lib/styles.cjs"),u=require("./useGridNavigation.cjs");let d=require("react");d=e.__toESM(d,1);let f=require("react/jsx-runtime");var p=`Select all rows`,m=`Selection`;function h(e,t=!1){let n=new Set(e),r=new Map,i=0,a=`none`,o=t,s,c=new Set,l=new Set,u=e=>{for(let t of Array.from(e))t()},d=()=>{if(s!==void 0)return s;let e=null;for(let t of n){if(r.has(t)){e=t;break}e??=t}return s=e,e},f=e=>{if(n.size<2||!n.has(e))return;let t=s;s=void 0,o&&d()!==t&&u(c)},p=()=>{let e=i===0?`none`:i===r.size?`all`:`some`;e!==a&&(a=e,u(l))},m=e=>t=>(e.add(t),()=>{e.delete(t)});return{subscribe:m(c),subscribeSelectAll:m(l),register(e){let t=r.get(e)??0;r.set(e,t+1),t===0&&n.has(e)&&(i+=1),p(),t===0&&f(e);let a=!1;return()=>{if(a)return;a=!0;let t=(r.get(e)??0)-1;if(t>0){r.set(e,t);return}r.delete(e),n.has(e)&&--i,p(),f(e)}},setSelected(e){let t=new Set(e);if(!(t.size===n.size&&e.every(e=>n.has(e)))){n=t,s=void 0,i=0;for(let e of t)r.has(e)&&(i+=1);u(c),p()}},setSingleMode(e){o=e},isSelected(e,t=!1){return t?d()===e:n.has(e)},countRegistrations(e){return r.get(e)??0},getSelectAllState(){return a},getRegistered(){return Array.from(r.keys())},prune(e){return e.filter(e=>r.has(e))}}}function g(){let e=new Map,t=new Set,n=null,r=()=>{let r=null,i=null;for(let[t,a]of e){let o=a();if(!o){if(n!==null&&e.has(n))return;continue}(!i||o.compareDocumentPosition(i)&Node.DOCUMENT_POSITION_FOLLOWING)&&(r=t,i=o)}if(r===null&&(r=e.keys().next().value??null),r!==n){n=r;for(let e of Array.from(t))e()}};return{subscribe(e){return t.add(e),()=>{t.delete(e)}},register(t,n){return e.set(t,n),r(),()=>{e.delete(t),r()}},getFirst:()=>n,refresh:r}}var _=d.createContext(null),v=d.createContext(null),y=d.createContext(`body`),b=d.createContext(null),x=d.createContext(!0),S={selectionMode:`none`,store:h([]),toggleRow:()=>{},toggleAll:()=>{},radioName:``,selectAllLabel:p,selectionHeaderLabel:m},C={sort:null,requestSort:()=>{}};function w(e){return d.useContext(_)||(r.reportMissingContext(e,`DataGrid`),S)}function T(e){return d.useContext(v)||(r.reportMissingContext(e,`DataGrid`),C)}var E=[];function D(e){return e===void 0?void 0:Array.from(e)}function O(e,t){return e.length===t.length&&e.every((e,n)=>e===t[n])}function k({key:e,node:t}){return(0,f.jsx)(d.Fragment,{children:t},e)}function ee(e){r.warnOnce(`DataGrid:duplicate-rowId:${e}`,`DataGrid: several rows share the rowId "${e}". Row ids must be unique within a DataGrid; rows with the same rowId are selected and deselected together.`)}var A=`px-4 py-3 border-b border-border`,j=`w-10 px-3 py-3 border-b border-border`,M=`accent-primary cursor-pointer`,N=e=>{let{sort:l,defaultSort:g,sortColumn:y,defaultSortColumn:b,sortDirection:x,defaultSortDirection:S,onSortChange:C,selectionMode:w=`none`,selectedItems:T,defaultSelectedItems:ee,onSelectedItemsChange:A,selectedKeys:j,defaultSelectedKeys:M,onSelectionChange:N,labels:P,columns:F,containerProps:I,children:L,className:z,onKeyDown:V,onFocus:H,onBlur:U,ref:te,...ne}=e,W=l!==void 0||g!==void 0,[re,ie]=d.useState(W);W&&!re&&ie(!0);let ae=re||W,oe=y!==void 0||x!==void 0;y!==void 0&&r.warnDeprecated(`DataGrid`,`sortColumn`,`sort`),x!==void 0&&r.warnDeprecated(`DataGrid`,`sortDirection`,`sort`),b!==void 0&&r.warnDeprecated(`DataGrid`,`defaultSortColumn`,`defaultSort`),S!==void 0&&r.warnDeprecated(`DataGrid`,`defaultSortDirection`,`defaultSort`);let se=W&&(oe||b!==void 0||S!==void 0);d.useEffect(()=>{se&&r.warnOnce(`DataGrid:mixed-sort`,"DataGrid: do not mix `sort`/`defaultSort` with the deprecated `sortColumn`/`sortDirection`/`defaultSortColumn`/`defaultSortDirection`. `sort`/`defaultSort` win.")},[se]),d.useEffect(()=>{W||(y!==void 0&&x===void 0?r.warnOnce(`DataGrid:sortColumn-without-sortDirection`,"DataGrid: `sortColumn` is controlled but `sortDirection` is not (mixed control). The direction is kept internally and toggles on repeated clicks, as in 0.4. Pass `sort` (`{ columnId, direction }`) to control both."):x!==void 0&&y===void 0&&r.warnOnce(`DataGrid:sortDirection-without-sortColumn`,"DataGrid: `sortDirection` is controlled but `sortColumn` is not (mixed control). The column is kept internally and follows the clicked header, as in 0.4. Pass `sort` (`{ columnId, direction }`) to control both."))},[W,y,x]);let[G,ce]=d.useState(()=>({column:b??``,direction:S??`ascending`})),le=d.useMemo(()=>{if(y===void 0&&x===void 0)return;let e=y??G.column;return e===``?null:{columnId:e,direction:x??G.direction}},[y,x,G]),ue=d.useMemo(()=>b?{columnId:b,direction:S??`ascending`}:null,[b,S]),de=W?l:le,fe=g===void 0?ue:g,[pe,me]=o.useControllable(de,fe,e=>{e&&(W||ce(t=>t.column===e.columnId&&t.direction===e.direction?t:{column:e.columnId,direction:e.direction}),C&&(ae?C(e):C(e.columnId,e.direction)))}),he=d.useCallback(e=>{me(t=>({columnId:e,direction:t?.columnId===e&&t.direction===`ascending`?`descending`:`ascending`}))},[me]),ge=d.useMemo(()=>({sort:pe,requestSort:he}),[pe,he]);N!==void 0&&r.warnDeprecated(`DataGrid`,`onSelectionChange`,`onSelectedItemsChange`);let _e=d.useMemo(()=>D(j),[j]),ve=d.useMemo(()=>D(M),[M]),ye=r.resolveDeprecatedProp(`DataGrid`,T,_e,`selectedKeys`,`selectedItems`),be=r.resolveDeprecatedProp(`DataGrid`,ee,ve,`defaultSelectedKeys`,`defaultSelectedItems`)??E,[K,q]=o.useControllable(ye,be,e=>{A?.([...e]),N?.(new Set(e))}),J=w===`single`,[Y]=d.useState(()=>h(K,J));d.useLayoutEffect(()=>{Y.setSelected(K)},[Y,K]),d.useLayoutEffect(()=>{Y.setSingleMode(J)},[Y,J]);let xe=d.useCallback(e=>{q(t=>{let n=Y.prune(t),r;return r=J?n[0]===e?[]:[e]:n.includes(e)?n.filter(t=>t!==e):[...n,e],O(r,t)?t:r})},[J,q,Y]),X=K.length;d.useEffect(()=>{J&&X>1&&r.warnOnce(`DataGrid:single-several-selected`,`DataGrid: a single-selection grid (selectionMode "single") has ${X} selected row ids; only the first one that is rendered is selected. Pass at most one id in \`selectedItems\`/\`defaultSelectedItems\`, or use selectionMode="multiple".`)},[J,X]);let Se=d.useCallback(()=>{q(e=>{let t=Y.prune(e),n=Y.getRegistered(),r=n.length>0&&n.every(e=>t.includes(e))?[]:n;return O(r,e)?e:r})},[q,Y]),Ce=s.useId(`wave-datagrid-selection`),we=P?.selectAll??p,Te=P?.selectionHeader??m,Ee=d.useMemo(()=>({selectionMode:w,store:Y,toggleRow:xe,toggleAll:Se,radioName:Ce,selectAllLabel:we,selectionHeaderLabel:Te}),[w,Y,xe,Se,Ce,we,Te]),{gridRef:De,gridProps:Z}=u.useGridNavigation(),Oe=c.useMergedRefs(te,De),ke=L,Q=F?n.flattenChildren(L):[];if(F&&!Q.some(({node:e})=>n.isElementOfType(e,R))){let e=({node:e})=>n.isElementOfType(e,`caption`);ke=(0,f.jsxs)(f.Fragment,{children:[Q.filter(e).map(k),(0,f.jsx)(R,{children:(0,f.jsx)(`tr`,{children:F.map(e=>(0,f.jsx)(B,{columnId:e.id,sortable:e.sortable,children:e.label},e.id))})}),Q.filter(t=>!e(t)).map(k)]})}let{className:Ae,"aria-label":je,"aria-labelledby":Me,...Ne}=I??{},$=Ne.role!==void 0,Pe=!$&&(je!==void 0||Me!==void 0);return d.useEffect(()=>{Pe&&r.warnOnce(`DataGrid:container-name-without-role`,'DataGrid: `containerProps["aria-label"]`/`["aria-labelledby"]` is ignored because the wrapper has no role. Name the grid itself (`aria-label` on DataGrid), or pass a `role` (e.g. "region") in `containerProps` too.')},[Pe]),(0,f.jsx)(_.Provider,{value:Ee,children:(0,f.jsx)(v.Provider,{value:ge,children:(0,f.jsx)(`div`,{...Ne,"aria-label":$?je:void 0,"aria-labelledby":$?Me:void 0,className:t.cn(a.dataGridClassNames.container,`overflow-x-auto rounded-md border border-border`,Ae),children:(0,f.jsx)(`table`,{ref:Oe,role:`grid`,"aria-multiselectable":w===`multiple`||void 0,className:t.cn(a.dataGridClassNames.root,`w-full border-separate border-spacing-0`,z),...ne,onKeyDown:i.composeEventHandlers(V,Z.onKeyDown),onFocus:i.composeEventHandlers(H,Z.onFocus,{checkDefaultPrevented:!1}),onBlur:i.composeEventHandlers(U,Z.onBlur,{checkDefaultPrevented:!1}),children:ke})})})})};N.displayName=`DataGrid`;function P({selectionMode:e,ref:n}){let{store:r,toggleAll:i,selectAllLabel:o,selectionHeaderLabel:s}=w(`DataGrid.Header`),c=d.useSyncExternalStore(r.subscribeSelectAll,r.getSelectAllState,r.getSelectAllState),u=d.useRef(null),[p,m]=d.useState(0);return d.useLayoutEffect(()=>{u.current&&(u.current.indeterminate=c===`some`)},[c,p]),(0,f.jsx)(`th`,{ref:n,scope:`col`,"data-selection-cell":``,className:t.cn(a.dataGridHeaderClassNames.selectionCell,j,`text-start`,l.focusRingInset),children:e===`multiple`?(0,f.jsx)(`input`,{ref:u,type:`checkbox`,"aria-label":o,checked:c===`all`,onChange:()=>{m(e=>e+1),i()},className:t.cn(a.dataGridHeaderClassNames.selectAllCheckbox,M,l.focusRingInset)}):(0,f.jsx)(`span`,{className:`sr-only`,children:s})})}var F={subscribe:()=>()=>{},register:()=>()=>{},getFirst:()=>null,refresh:()=>{}};function I({selectionMode:e,initialFirst:n}){let r=d.useContext(b)??F,[i]=d.useState(()=>({})),o=d.useRef(null),s=d.useCallback(()=>{let e=r.getFirst();return e===null?n:e===i},[r,i,n]),c=d.useCallback(()=>n,[n]),u=d.useSyncExternalStore(r.subscribe,s,c);return d.useLayoutEffect(()=>r.register(i,()=>o.current),[r,i]),u?(0,f.jsx)(P,{ref:o,selectionMode:e}):(0,f.jsx)(`td`,{ref:o,"data-selection-cell":``,className:t.cn(a.dataGridHeaderClassNames.selectionCell,j,l.focusRingInset)})}function L(e,t){let r=!0,i=e=>d.Children.map(e,e=>{if(n.isElementOfType(e,d.Fragment))return d.cloneElement(e,void 0,i(e.props.children));if(!d.isValidElement(e))return e;let a=r;if(r=!1,n.isElementOfType(e,`tr`)){let n=t===`none`?null:(0,f.jsx)(I,{selectionMode:t,initialFirst:a});return d.cloneElement(e,void 0,n,e.props.children)}return(0,f.jsx)(x.Provider,{value:a,children:e})});return i(e)}var R=({children:e,className:n,ref:i,...o})=>{let{selectionMode:s}=w(`DataGrid.Header`),[l,u]=d.useState(null),p=c.useMergedRefs(i,u),[m]=d.useState(g),h=L(e,s);return d.useLayoutEffect(()=>{m.refresh()}),d.useEffect(()=>{r.isDev&&l&&s!==`none`&&Array.from(l.rows).some(e=>e.cells.length>0&&!e.cells[0].hasAttribute(`data-selection-cell`))&&r.warnOnce(`DataGrid.Header:missing-selection-cell`,"DataGrid.Header: a header row has no selection column header cell, so the header has one column fewer than the selectable rows. Render header rows as `<tr>` children of DataGrid.Header (a Fragment is fine), or use `DataGrid.Row` for a header row that another component renders.")}),(0,f.jsx)(y.Provider,{value:`header`,children:(0,f.jsx)(b.Provider,{value:m,children:(0,f.jsx)(`thead`,{ref:p,className:t.cn(a.dataGridHeaderClassNames.root,`bg-card`,n),...o,children:h})})})};R.displayName=`DataGridHeader`;var z=e=>(0,f.jsx)(`svg`,{className:t.cn(a.dataGridHeaderCellClassNames.sortIcon,`h-3 w-3 shrink-0`),viewBox:`0 0 12 12`,fill:`currentColor`,"aria-hidden":`true`,focusable:`false`,children:e===`ascending`?(0,f.jsx)(`path`,{d:`M6 2L10 8H2L6 2Z`}):(0,f.jsx)(`path`,{d:`M6 10L2 4H10L6 10Z`})}),B=({columnId:e,sortable:n=!1,children:o,className:s,onClick:c,ref:u,...p})=>{let{sort:m,requestSort:h}=T(`DataGrid.HeaderCell`),g=n&&e?e:void 0,_=g!==void 0&&m?.columnId===g?m.direction:null,v=e=>{let t=e.currentTarget.firstElementChild;g!==void 0&&t?.localName===`button`&&t.contains(e.target)&&h(g)};return d.useEffect(()=>{n&&!e&&r.warnOnce(`DataGrid.HeaderCell:sortable-without-columnId`,"DataGrid.HeaderCell: `sortable` needs a `columnId`; the header is rendered as not sortable.")},[n,e]),(0,f.jsx)(`th`,{ref:u,scope:`col`,"aria-sort":g===void 0?void 0:_??`none`,className:t.cn(a.dataGridHeaderCellClassNames.root,A,`text-start align-middle font-semibold text-caption-1 uppercase tracking-wider`,l.focusRingInset,g!==void 0&&`p-0 hover:bg-subtle-hover`,s),...p,onClick:g===void 0?c:i.composeEventHandlers(c,v),children:g===void 0?(0,f.jsx)(`span`,{className:`inline-flex items-center gap-1`,children:o}):(0,f.jsxs)(`button`,{type:`button`,className:t.cn(a.dataGridHeaderCellClassNames.button,`inline-flex w-full cursor-pointer select-none items-center gap-1 border-0 bg-transparent px-4 py-3 text-start text-inherit [font:inherit] uppercase tracking-wider`,l.focusRingInset),children:[o,_&&z(_)]})})};B.displayName=`DataGridHeaderCell`;var V=({children:e,className:n,ref:r,...i})=>(0,f.jsx)(y.Provider,{value:`body`,children:(0,f.jsx)(`tbody`,{ref:r,className:t.cn(a.dataGridBodyClassNames.root,n),...i,children:e})});V.displayName=`DataGridBody`;var H=({rowId:e,selectionLabel:o,children:c,className:u,onKeyDown:p,ref:m,...h})=>{let{selectionMode:g,store:_,toggleRow:v,radioName:b}=w(`DataGrid.Row`),S=d.useContext(y),C=d.useContext(x),T=S===`header`,E=g!==`none`&&!T,D=s.useId(`wave-datagrid-row-label`),O=g===`single`,A=d.useCallback(()=>e!==void 0&&_.isSelected(e,O),[e,_,O]),N=d.useSyncExternalStore(_.subscribe,A,A);d.useLayoutEffect(()=>{if(e===void 0||T)return;let t=_.register(e);return r.isDev&&_.countRegistrations(e)>1&&ee(e),t},[_,e,T]),d.useEffect(()=>{E&&e===void 0&&r.warnOnce(`DataGrid.Row:missing-rowId`,"DataGrid.Row: a selectable grid needs a `rowId` on every row; this row has no selection control.")},[E,e]);let P=E&&e!==void 0&&o===void 0,F=t=>{if(!E||e===void 0||t.key!==` `)return;let n=t.target;(n===t.currentTarget||n.parentElement===t.currentTarget)&&(t.preventDefault(),v(e))},L=n.flattenChildren(c),R,z=-1;if(P){let e=L.findIndex(({node:e})=>n.isElementOfType(e,U,`td`,`th`));if(e>=0){let t=L[e].node;R=t.props.id??D,t.props.id===void 0&&(z=e)}}let B=L.map(({key:e,node:t},n)=>k({key:e,node:n===z?d.cloneElement(t,{id:D}):t})),V=P&&R===void 0;d.useEffect(()=>{V&&r.warnOnce(`DataGrid.Row:selection-label`,'DataGrid.Row: no child is a `DataGrid.Cell`, `<td>` or `<th>` element, so the row selection control is named "Select row". Pass `selectionLabel` (a cell rendered by another component is not seen).')},[V]);let H=null;return T&&g!==`none`?H=(0,f.jsx)(I,{selectionMode:g,initialFirst:C}):E&&(H=(0,f.jsx)(`td`,{role:`gridcell`,"data-selection-cell":``,className:t.cn(a.dataGridRowClassNames.selectionCell,j,l.focusRingInset),children:e!==void 0&&(0,f.jsx)(`input`,{type:g===`multiple`?`checkbox`:`radio`,name:g===`single`?b:void 0,form:g===`single`?``:void 0,checked:N,onChange:()=>v(e),"aria-label":o??(R?void 0:`Select row`),"aria-labelledby":o===void 0?R:void 0,className:t.cn(a.dataGridRowClassNames.selectionControl,M,`focus-visible:outline-2 focus-visible:-outline-offset-2 focus-visible:outline-ring`)})})),(0,f.jsxs)(`tr`,{ref:m,className:t.cn(a.dataGridRowClassNames.root,!T&&`hover:bg-subtle-hover data-[selected]:bg-selected transition-colors motion-reduce:transition-none`,E&&N&&l.forcedColors.selectedContainer,u),"aria-selected":E?N:void 0,"data-selected":E&&N?``:void 0,...h,onKeyDown:i.composeEventHandlers(p,F),children:[H,B]})};H.displayName=`DataGridRow`;var U=({children:e,className:n,ref:r,...i})=>(0,f.jsx)(`td`,{ref:r,role:`gridcell`,className:t.cn(a.dataGridCellClassNames.root,A,`text-body-1`,l.focusRingInset,n),...i,children:e});U.displayName=`DataGridCell`;var te=Object.assign(N,{Header:R,HeaderCell:B,Body:V,Row:H,Cell:U});exports.DataGrid=te,exports.DataGridBody=V,exports.DataGridCell=U,exports.DataGridHeader=R,exports.DataGridHeaderCell=B,exports.DataGridRow=H,exports.createSelectionStore=h;
2
2
  //# sourceMappingURL=DataGrid.cjs.map