@mortenbrudvik/waveui 0.7.0 → 0.9.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 (439) hide show
  1. package/README.md +564 -155
  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/InfoButton.cjs +2 -0
  63. package/dist/components/data-display/InfoButton.cjs.map +1 -0
  64. package/dist/components/data-display/InfoButton.mjs +173 -0
  65. package/dist/components/data-display/InfoButton.mjs.map +1 -0
  66. package/dist/components/data-display/InfoLabel.cjs +1 -1
  67. package/dist/components/data-display/InfoLabel.cjs.map +1 -1
  68. package/dist/components/data-display/InfoLabel.mjs +36 -92
  69. package/dist/components/data-display/InfoLabel.mjs.map +1 -1
  70. package/dist/components/data-display/List.cjs +1 -1
  71. package/dist/components/data-display/List.cjs.map +1 -1
  72. package/dist/components/data-display/List.mjs +175 -174
  73. package/dist/components/data-display/List.mjs.map +1 -1
  74. package/dist/components/data-display/Persona.cjs +1 -1
  75. package/dist/components/data-display/Persona.cjs.map +1 -1
  76. package/dist/components/data-display/Persona.mjs +31 -29
  77. package/dist/components/data-display/Persona.mjs.map +1 -1
  78. package/dist/components/data-display/PresenceBadge.cjs +1 -1
  79. package/dist/components/data-display/PresenceBadge.cjs.map +1 -1
  80. package/dist/components/data-display/PresenceBadge.mjs +25 -24
  81. package/dist/components/data-display/PresenceBadge.mjs.map +1 -1
  82. package/dist/components/data-display/Tag.cjs +1 -1
  83. package/dist/components/data-display/Tag.cjs.map +1 -1
  84. package/dist/components/data-display/Tag.mjs +87 -82
  85. package/dist/components/data-display/Tag.mjs.map +1 -1
  86. package/dist/components/feedback/MessageBar.cjs +1 -1
  87. package/dist/components/feedback/MessageBar.cjs.map +1 -1
  88. package/dist/components/feedback/MessageBar.mjs +129 -71
  89. package/dist/components/feedback/MessageBar.mjs.map +1 -1
  90. package/dist/components/feedback/MessageBar.parts.cjs +2 -0
  91. package/dist/components/feedback/MessageBar.parts.cjs.map +1 -0
  92. package/dist/components/feedback/MessageBar.parts.mjs +84 -0
  93. package/dist/components/feedback/MessageBar.parts.mjs.map +1 -0
  94. package/dist/components/feedback/MessageBar.reflow.cjs +2 -0
  95. package/dist/components/feedback/MessageBar.reflow.cjs.map +1 -0
  96. package/dist/components/feedback/MessageBar.reflow.mjs +74 -0
  97. package/dist/components/feedback/MessageBar.reflow.mjs.map +1 -0
  98. package/dist/components/feedback/MessageBar.status.cjs +1 -1
  99. package/dist/components/feedback/MessageBar.status.cjs.map +1 -1
  100. package/dist/components/feedback/MessageBar.status.mjs +2 -1
  101. package/dist/components/feedback/MessageBar.status.mjs.map +1 -1
  102. package/dist/components/feedback/ProgressBar.cjs +1 -1
  103. package/dist/components/feedback/ProgressBar.cjs.map +1 -1
  104. package/dist/components/feedback/ProgressBar.mjs +44 -43
  105. package/dist/components/feedback/ProgressBar.mjs.map +1 -1
  106. package/dist/components/feedback/Skeleton.cjs +1 -1
  107. package/dist/components/feedback/Skeleton.cjs.map +1 -1
  108. package/dist/components/feedback/Skeleton.mjs +26 -24
  109. package/dist/components/feedback/Skeleton.mjs.map +1 -1
  110. package/dist/components/feedback/Spinner.cjs +1 -1
  111. package/dist/components/feedback/Spinner.cjs.map +1 -1
  112. package/dist/components/feedback/Spinner.mjs +32 -31
  113. package/dist/components/feedback/Spinner.mjs.map +1 -1
  114. package/dist/components/feedback/Toast.cjs +1 -1
  115. package/dist/components/feedback/Toast.cjs.map +1 -1
  116. package/dist/components/feedback/Toast.context.cjs +2 -0
  117. package/dist/components/feedback/Toast.context.cjs.map +1 -0
  118. package/dist/components/feedback/Toast.context.mjs +23 -0
  119. package/dist/components/feedback/Toast.context.mjs.map +1 -0
  120. package/dist/components/feedback/Toast.mjs +10 -342
  121. package/dist/components/feedback/Toast.mjs.map +1 -1
  122. package/dist/components/feedback/Toast.parts.cjs +2 -0
  123. package/dist/components/feedback/Toast.parts.cjs.map +1 -0
  124. package/dist/components/feedback/Toast.parts.mjs +98 -0
  125. package/dist/components/feedback/Toast.parts.mjs.map +1 -0
  126. package/dist/components/feedback/Toast.root.cjs +2 -0
  127. package/dist/components/feedback/Toast.root.cjs.map +1 -0
  128. package/dist/components/feedback/Toast.root.mjs +109 -0
  129. package/dist/components/feedback/Toast.root.mjs.map +1 -0
  130. package/dist/components/feedback/Toaster.cjs +2 -0
  131. package/dist/components/feedback/Toaster.cjs.map +1 -0
  132. package/dist/components/feedback/Toaster.mjs +564 -0
  133. package/dist/components/feedback/Toaster.mjs.map +1 -0
  134. package/dist/components/input/AlphaSlider.cjs +2 -0
  135. package/dist/components/input/AlphaSlider.cjs.map +1 -0
  136. package/dist/components/input/AlphaSlider.mjs +115 -0
  137. package/dist/components/input/AlphaSlider.mjs.map +1 -0
  138. package/dist/components/input/Checkbox.cjs +1 -1
  139. package/dist/components/input/Checkbox.cjs.map +1 -1
  140. package/dist/components/input/Checkbox.mjs +87 -70
  141. package/dist/components/input/Checkbox.mjs.map +1 -1
  142. package/dist/components/input/ColorArea.cjs +2 -0
  143. package/dist/components/input/ColorArea.cjs.map +1 -0
  144. package/dist/components/input/ColorArea.mjs +204 -0
  145. package/dist/components/input/ColorArea.mjs.map +1 -0
  146. package/dist/components/input/ColorPicker.cjs +5 -5
  147. package/dist/components/input/ColorPicker.cjs.map +1 -1
  148. package/dist/components/input/ColorPicker.mjs +142 -165
  149. package/dist/components/input/ColorPicker.mjs.map +1 -1
  150. package/dist/components/input/ColorPicker.parts.cjs +2 -0
  151. package/dist/components/input/ColorPicker.parts.cjs.map +1 -0
  152. package/dist/components/input/ColorPicker.parts.mjs +192 -0
  153. package/dist/components/input/ColorPicker.parts.mjs.map +1 -0
  154. package/dist/components/input/ColorSlider.cjs +2 -0
  155. package/dist/components/input/ColorSlider.cjs.map +1 -0
  156. package/dist/components/input/ColorSlider.mjs +138 -0
  157. package/dist/components/input/ColorSlider.mjs.map +1 -0
  158. package/dist/components/input/Combobox.cjs +1 -1
  159. package/dist/components/input/Combobox.cjs.map +1 -1
  160. package/dist/components/input/Combobox.expand.cjs +1 -1
  161. package/dist/components/input/Combobox.expand.cjs.map +1 -1
  162. package/dist/components/input/Combobox.expand.mjs +22 -22
  163. package/dist/components/input/Combobox.expand.mjs.map +1 -1
  164. package/dist/components/input/Combobox.mjs +151 -141
  165. package/dist/components/input/Combobox.mjs.map +1 -1
  166. package/dist/components/input/DatePicker.cjs +1 -1
  167. package/dist/components/input/DatePicker.cjs.map +1 -1
  168. package/dist/components/input/DatePicker.mjs +239 -234
  169. package/dist/components/input/DatePicker.mjs.map +1 -1
  170. package/dist/components/input/Dropdown.cjs +1 -1
  171. package/dist/components/input/Dropdown.cjs.map +1 -1
  172. package/dist/components/input/Dropdown.mjs +109 -100
  173. package/dist/components/input/Dropdown.mjs.map +1 -1
  174. package/dist/components/input/Field.cjs +1 -1
  175. package/dist/components/input/Field.cjs.map +1 -1
  176. package/dist/components/input/Field.mjs +139 -105
  177. package/dist/components/input/Field.mjs.map +1 -1
  178. package/dist/components/input/Input.cjs +1 -1
  179. package/dist/components/input/Input.cjs.map +1 -1
  180. package/dist/components/input/Input.mjs +80 -55
  181. package/dist/components/input/Input.mjs.map +1 -1
  182. package/dist/components/input/Label.cjs +1 -1
  183. package/dist/components/input/Label.cjs.map +1 -1
  184. package/dist/components/input/Label.mjs +19 -12
  185. package/dist/components/input/Label.mjs.map +1 -1
  186. package/dist/components/input/Option.cjs +1 -1
  187. package/dist/components/input/Option.cjs.map +1 -1
  188. package/dist/components/input/Option.mjs +100 -98
  189. package/dist/components/input/Option.mjs.map +1 -1
  190. package/dist/components/input/RadioGroup.cjs +1 -1
  191. package/dist/components/input/RadioGroup.cjs.map +1 -1
  192. package/dist/components/input/RadioGroup.mjs +89 -88
  193. package/dist/components/input/RadioGroup.mjs.map +1 -1
  194. package/dist/components/input/Rating.cjs +1 -1
  195. package/dist/components/input/Rating.cjs.map +1 -1
  196. package/dist/components/input/Rating.item.cjs +2 -0
  197. package/dist/components/input/Rating.item.cjs.map +1 -0
  198. package/dist/components/input/Rating.item.mjs +255 -0
  199. package/dist/components/input/Rating.item.mjs.map +1 -0
  200. package/dist/components/input/Rating.mjs +152 -152
  201. package/dist/components/input/Rating.mjs.map +1 -1
  202. package/dist/components/input/SearchBox.cjs +1 -1
  203. package/dist/components/input/SearchBox.cjs.map +1 -1
  204. package/dist/components/input/SearchBox.mjs +162 -132
  205. package/dist/components/input/SearchBox.mjs.map +1 -1
  206. package/dist/components/input/Select.cjs +1 -1
  207. package/dist/components/input/Select.cjs.map +1 -1
  208. package/dist/components/input/Select.mjs +34 -24
  209. package/dist/components/input/Select.mjs.map +1 -1
  210. package/dist/components/input/Slider.cjs +1 -1
  211. package/dist/components/input/Slider.cjs.map +1 -1
  212. package/dist/components/input/Slider.mjs +78 -54
  213. package/dist/components/input/Slider.mjs.map +1 -1
  214. package/dist/components/input/SpinButton.cjs +1 -1
  215. package/dist/components/input/SpinButton.cjs.map +1 -1
  216. package/dist/components/input/SpinButton.mjs +202 -99
  217. package/dist/components/input/SpinButton.mjs.map +1 -1
  218. package/dist/components/input/SwatchPicker.cjs +1 -1
  219. package/dist/components/input/SwatchPicker.cjs.map +1 -1
  220. package/dist/components/input/SwatchPicker.mjs +38 -37
  221. package/dist/components/input/SwatchPicker.mjs.map +1 -1
  222. package/dist/components/input/Switch.cjs +1 -1
  223. package/dist/components/input/Switch.cjs.map +1 -1
  224. package/dist/components/input/Switch.mjs +75 -58
  225. package/dist/components/input/Switch.mjs.map +1 -1
  226. package/dist/components/input/TagPicker.cjs +1 -1
  227. package/dist/components/input/TagPicker.cjs.map +1 -1
  228. package/dist/components/input/TagPicker.mjs +199 -169
  229. package/dist/components/input/TagPicker.mjs.map +1 -1
  230. package/dist/components/input/Textarea.cjs +1 -1
  231. package/dist/components/input/Textarea.cjs.map +1 -1
  232. package/dist/components/input/Textarea.mjs +31 -23
  233. package/dist/components/input/Textarea.mjs.map +1 -1
  234. package/dist/components/input/TimePicker.cjs +1 -1
  235. package/dist/components/input/TimePicker.cjs.map +1 -1
  236. package/dist/components/input/TimePicker.mjs +185 -177
  237. package/dist/components/input/TimePicker.mjs.map +1 -1
  238. package/dist/components/input/colorName.cjs +2 -0
  239. package/dist/components/input/colorName.cjs.map +1 -0
  240. package/dist/components/input/colorName.mjs +30 -0
  241. package/dist/components/input/colorName.mjs.map +1 -0
  242. package/dist/components/input/colorUtils.cjs +1 -1
  243. package/dist/components/input/colorUtils.cjs.map +1 -1
  244. package/dist/components/input/colorUtils.mjs +154 -56
  245. package/dist/components/input/colorUtils.mjs.map +1 -1
  246. package/dist/components/input/fieldLabel.cjs +2 -0
  247. package/dist/components/input/fieldLabel.cjs.map +1 -0
  248. package/dist/components/input/fieldLabel.mjs +17 -0
  249. package/dist/components/input/fieldLabel.mjs.map +1 -0
  250. package/dist/components/input/inputLook.cjs +2 -0
  251. package/dist/components/input/inputLook.cjs.map +1 -0
  252. package/dist/components/input/inputLook.mjs +28 -0
  253. package/dist/components/input/inputLook.mjs.map +1 -0
  254. package/dist/components/input/pickerStyles.cjs +1 -1
  255. package/dist/components/input/pickerStyles.cjs.map +1 -1
  256. package/dist/components/input/pickerStyles.mjs +42 -4
  257. package/dist/components/input/pickerStyles.mjs.map +1 -1
  258. package/dist/components/layout/Accordion.cjs +1 -1
  259. package/dist/components/layout/Accordion.cjs.map +1 -1
  260. package/dist/components/layout/Accordion.mjs +130 -129
  261. package/dist/components/layout/Accordion.mjs.map +1 -1
  262. package/dist/components/layout/Card.cjs +1 -1
  263. package/dist/components/layout/Card.cjs.map +1 -1
  264. package/dist/components/layout/Card.mjs +78 -77
  265. package/dist/components/layout/Card.mjs.map +1 -1
  266. package/dist/components/layout/Carousel.cjs +1 -1
  267. package/dist/components/layout/Carousel.cjs.map +1 -1
  268. package/dist/components/layout/Carousel.mjs +111 -110
  269. package/dist/components/layout/Carousel.mjs.map +1 -1
  270. package/dist/components/layout/Flex.cjs +1 -1
  271. package/dist/components/layout/Flex.cjs.map +1 -1
  272. package/dist/components/layout/Flex.mjs +22 -21
  273. package/dist/components/layout/Flex.mjs.map +1 -1
  274. package/dist/components/layout/Grid.cjs +1 -1
  275. package/dist/components/layout/Grid.cjs.map +1 -1
  276. package/dist/components/layout/Grid.mjs +19 -18
  277. package/dist/components/layout/Grid.mjs.map +1 -1
  278. package/dist/components/layout/Overflow.cjs +1 -1
  279. package/dist/components/layout/Overflow.cjs.map +1 -1
  280. package/dist/components/layout/Overflow.mjs +92 -91
  281. package/dist/components/layout/Overflow.mjs.map +1 -1
  282. package/dist/components/layout/Stack.cjs +1 -1
  283. package/dist/components/layout/Stack.cjs.map +1 -1
  284. package/dist/components/layout/Stack.mjs +14 -13
  285. package/dist/components/layout/Stack.mjs.map +1 -1
  286. package/dist/components/layout/TabList.cjs +1 -1
  287. package/dist/components/layout/TabList.cjs.map +1 -1
  288. package/dist/components/layout/TabList.mjs +118 -117
  289. package/dist/components/layout/TabList.mjs.map +1 -1
  290. package/dist/components/layout/Tree.cjs +1 -1
  291. package/dist/components/layout/Tree.cjs.map +1 -1
  292. package/dist/components/layout/Tree.context.cjs +2 -0
  293. package/dist/components/layout/Tree.context.cjs.map +1 -0
  294. package/dist/components/layout/Tree.context.mjs +33 -0
  295. package/dist/components/layout/Tree.context.mjs.map +1 -0
  296. package/dist/components/layout/Tree.core.cjs +2 -0
  297. package/dist/components/layout/Tree.core.cjs.map +1 -0
  298. package/dist/components/layout/Tree.core.mjs +416 -0
  299. package/dist/components/layout/Tree.core.mjs.map +1 -0
  300. package/dist/components/layout/Tree.itemPersonaLayout.cjs +2 -0
  301. package/dist/components/layout/Tree.itemPersonaLayout.cjs.map +1 -0
  302. package/dist/components/layout/Tree.itemPersonaLayout.mjs +46 -0
  303. package/dist/components/layout/Tree.itemPersonaLayout.mjs.map +1 -0
  304. package/dist/components/layout/Tree.mjs +7 -215
  305. package/dist/components/layout/Tree.mjs.map +1 -1
  306. package/dist/components/layout/Tree.selection.cjs +2 -0
  307. package/dist/components/layout/Tree.selection.cjs.map +1 -0
  308. package/dist/components/layout/Tree.selection.mjs +73 -0
  309. package/dist/components/layout/Tree.selection.mjs.map +1 -0
  310. package/dist/components/navigation/Breadcrumb.cjs +1 -1
  311. package/dist/components/navigation/Breadcrumb.cjs.map +1 -1
  312. package/dist/components/navigation/Breadcrumb.mjs +76 -75
  313. package/dist/components/navigation/Breadcrumb.mjs.map +1 -1
  314. package/dist/components/navigation/Menu.group.cjs +1 -1
  315. package/dist/components/navigation/Menu.group.cjs.map +1 -1
  316. package/dist/components/navigation/Menu.group.mjs +39 -37
  317. package/dist/components/navigation/Menu.group.mjs.map +1 -1
  318. package/dist/components/navigation/Menu.items.cjs +1 -1
  319. package/dist/components/navigation/Menu.items.cjs.map +1 -1
  320. package/dist/components/navigation/Menu.items.mjs +67 -61
  321. package/dist/components/navigation/Menu.items.mjs.map +1 -1
  322. package/dist/components/navigation/Menu.link.cjs +1 -1
  323. package/dist/components/navigation/Menu.link.cjs.map +1 -1
  324. package/dist/components/navigation/Menu.link.mjs +34 -28
  325. package/dist/components/navigation/Menu.link.mjs.map +1 -1
  326. package/dist/components/navigation/Menu.popover.cjs +1 -1
  327. package/dist/components/navigation/Menu.popover.cjs.map +1 -1
  328. package/dist/components/navigation/Menu.popover.mjs +114 -113
  329. package/dist/components/navigation/Menu.popover.mjs.map +1 -1
  330. package/dist/components/navigation/Menu.root.cjs +1 -1
  331. package/dist/components/navigation/Menu.root.cjs.map +1 -1
  332. package/dist/components/navigation/Menu.root.mjs +171 -170
  333. package/dist/components/navigation/Menu.root.mjs.map +1 -1
  334. package/dist/components/navigation/Menu.selectable.cjs +1 -1
  335. package/dist/components/navigation/Menu.selectable.cjs.map +1 -1
  336. package/dist/components/navigation/Menu.selectable.mjs +85 -63
  337. package/dist/components/navigation/Menu.selectable.mjs.map +1 -1
  338. package/dist/components/navigation/Menu.splitGroup.cjs +1 -1
  339. package/dist/components/navigation/Menu.splitGroup.cjs.map +1 -1
  340. package/dist/components/navigation/Menu.splitGroup.mjs +27 -26
  341. package/dist/components/navigation/Menu.splitGroup.mjs.map +1 -1
  342. package/dist/components/navigation/Menu.trigger.cjs +1 -1
  343. package/dist/components/navigation/Menu.trigger.cjs.map +1 -1
  344. package/dist/components/navigation/Menu.trigger.mjs +6 -6
  345. package/dist/components/navigation/Nav.cjs +1 -1
  346. package/dist/components/navigation/Nav.cjs.map +1 -1
  347. package/dist/components/navigation/Nav.mjs +170 -155
  348. package/dist/components/navigation/Nav.mjs.map +1 -1
  349. package/dist/components/navigation/Pagination.cjs +1 -1
  350. package/dist/components/navigation/Pagination.cjs.map +1 -1
  351. package/dist/components/navigation/Pagination.mjs +73 -65
  352. package/dist/components/navigation/Pagination.mjs.map +1 -1
  353. package/dist/components/navigation/Stepper.cjs +1 -1
  354. package/dist/components/navigation/Stepper.cjs.map +1 -1
  355. package/dist/components/navigation/Stepper.mjs +110 -109
  356. package/dist/components/navigation/Stepper.mjs.map +1 -1
  357. package/dist/components/overlays/Dialog.cjs +1 -1
  358. package/dist/components/overlays/Dialog.cjs.map +1 -1
  359. package/dist/components/overlays/Dialog.mjs +109 -108
  360. package/dist/components/overlays/Dialog.mjs.map +1 -1
  361. package/dist/components/overlays/Drawer.cjs +1 -1
  362. package/dist/components/overlays/Drawer.cjs.map +1 -1
  363. package/dist/components/overlays/Drawer.mjs +110 -109
  364. package/dist/components/overlays/Drawer.mjs.map +1 -1
  365. package/dist/components/overlays/Popover.cjs +1 -1
  366. package/dist/components/overlays/Popover.cjs.map +1 -1
  367. package/dist/components/overlays/Popover.mjs +148 -151
  368. package/dist/components/overlays/Popover.mjs.map +1 -1
  369. package/dist/components/overlays/Popover.shared.cjs +1 -1
  370. package/dist/components/overlays/Popover.shared.cjs.map +1 -1
  371. package/dist/components/overlays/Popover.shared.mjs +82 -77
  372. package/dist/components/overlays/Popover.shared.mjs.map +1 -1
  373. package/dist/components/overlays/TeachingPopover.cjs +1 -1
  374. package/dist/components/overlays/TeachingPopover.cjs.map +1 -1
  375. package/dist/components/overlays/TeachingPopover.mjs +41 -37
  376. package/dist/components/overlays/TeachingPopover.mjs.map +1 -1
  377. package/dist/components/overlays/Tooltip.cjs +1 -1
  378. package/dist/components/overlays/Tooltip.cjs.map +1 -1
  379. package/dist/components/overlays/Tooltip.mjs +87 -86
  380. package/dist/components/overlays/Tooltip.mjs.map +1 -1
  381. package/dist/components/portal/Portal.cjs +1 -1
  382. package/dist/components/portal/Portal.cjs.map +1 -1
  383. package/dist/components/portal/Portal.mjs +33 -32
  384. package/dist/components/portal/Portal.mjs.map +1 -1
  385. package/dist/components/provider/WaveProvider.cjs +1 -1
  386. package/dist/components/provider/WaveProvider.cjs.map +1 -1
  387. package/dist/components/provider/WaveProvider.mjs +36 -29
  388. package/dist/components/provider/WaveProvider.mjs.map +1 -1
  389. package/dist/components/table/DataGrid.cjs +1 -1
  390. package/dist/components/table/DataGrid.cjs.map +1 -1
  391. package/dist/components/table/DataGrid.mjs +228 -227
  392. package/dist/components/table/DataGrid.mjs.map +1 -1
  393. package/dist/components/table/Table.cjs +1 -1
  394. package/dist/components/table/Table.cjs.map +1 -1
  395. package/dist/components/table/Table.mjs +60 -59
  396. package/dist/components/table/Table.mjs.map +1 -1
  397. package/dist/components/typography/Text.cjs +1 -1
  398. package/dist/components/typography/Text.cjs.map +1 -1
  399. package/dist/components/typography/Text.mjs +12 -11
  400. package/dist/components/typography/Text.mjs.map +1 -1
  401. package/dist/hooks/useFieldControl.cjs.map +1 -1
  402. package/dist/hooks/useFieldControl.mjs.map +1 -1
  403. package/dist/hooks/useMediaQuery.cjs +2 -0
  404. package/dist/hooks/useMediaQuery.cjs.map +1 -0
  405. package/dist/hooks/useMediaQuery.mjs +20 -0
  406. package/dist/hooks/useMediaQuery.mjs.map +1 -0
  407. package/dist/hooks/usePrefersReducedMotion.cjs +1 -1
  408. package/dist/hooks/usePrefersReducedMotion.cjs.map +1 -1
  409. package/dist/hooks/usePrefersReducedMotion.mjs +4 -18
  410. package/dist/hooks/usePrefersReducedMotion.mjs.map +1 -1
  411. package/dist/hooks/useRovingTabIndex.cjs +1 -1
  412. package/dist/hooks/useRovingTabIndex.cjs.map +1 -1
  413. package/dist/hooks/useRovingTabIndex.mjs +3 -3
  414. package/dist/hooks/useRovingTabIndex.mjs.map +1 -1
  415. package/dist/index.cjs +1 -1
  416. package/dist/index.d.cts +2890 -197
  417. package/dist/index.d.ts +2890 -197
  418. package/dist/index.mjs +101 -87
  419. package/dist/lib/classNames.cjs +2 -0
  420. package/dist/lib/classNames.cjs.map +1 -0
  421. package/dist/lib/classNames.mjs +423 -0
  422. package/dist/lib/classNames.mjs.map +1 -0
  423. package/dist/lib/color.cjs +2 -0
  424. package/dist/lib/color.cjs.map +1 -0
  425. package/dist/lib/color.mjs +86 -0
  426. package/dist/lib/color.mjs.map +1 -0
  427. package/dist/lib/globalRegistry.cjs.map +1 -1
  428. package/dist/lib/globalRegistry.mjs.map +1 -1
  429. package/dist/lib/styles.cjs +1 -1
  430. package/dist/lib/styles.cjs.map +1 -1
  431. package/dist/lib/styles.mjs +21 -4
  432. package/dist/lib/styles.mjs.map +1 -1
  433. package/dist/lib/toaster.cjs +2 -0
  434. package/dist/lib/toaster.cjs.map +1 -0
  435. package/dist/lib/toaster.mjs +77 -0
  436. package/dist/lib/toaster.mjs.map +1 -0
  437. package/dist/styles.css +1 -1
  438. package/package.json +1 -1
  439. package/src/styles/tokens.css +13 -0
@@ -1,32 +1,33 @@
1
1
  "use client";
2
2
  import { cn as e } from "../../lib/cn.mjs";
3
3
  import { isDev as t, reportMissingContext as n, warnOnce as r } from "../../lib/dev.mjs";
4
- import { useMergedRefs as i } from "../../hooks/useMergedRefs.mjs";
5
- import * as a from "react";
6
- import { jsx as o, jsxs as s } from "react/jsx-runtime";
4
+ import { overflowClassNames as i, overflowItemClassNames as a } from "../../lib/classNames.mjs";
5
+ import { useMergedRefs as o } from "../../hooks/useMergedRefs.mjs";
6
+ import * as s from "react";
7
+ import { jsx as c, jsxs as l } from "react/jsx-runtime";
7
8
  //#region src/components/layout/Overflow.tsx
8
- var c = [];
9
- function l() {
10
- return a.useReducer((e) => e + 1, 0)[1];
9
+ var u = [];
10
+ function d() {
11
+ return s.useReducer((e) => e + 1, 0)[1];
11
12
  }
12
- function u() {
13
+ function f() {
13
14
  return typeof ResizeObserver < "u";
14
15
  }
15
- function d(e, t) {
16
+ function p(e, t) {
16
17
  return e === t ? 0 : e.compareDocumentPosition(t) & Node.DOCUMENT_POSITION_FOLLOWING ? -1 : 1;
17
18
  }
18
- var f = {
19
+ var m = {
19
20
  childList: !0,
20
21
  subtree: !0
21
22
  };
22
- function p(e, t) {
23
+ function h(e, t) {
23
24
  return e.length === t.length && e.every((e, n) => e === t[n]);
24
25
  }
25
- function m(e) {
26
+ function g(e) {
26
27
  r(`Overflow:duplicate:${e}`, `Overflow: several items share the itemId "${e}". Item ids must be unique within an Overflow; items with the same itemId are hidden and shown together.`);
27
28
  }
28
- var h = () => {};
29
- function g(e) {
29
+ var _ = () => {};
30
+ function v(e) {
30
31
  let t = 0, n = 0, r = e.ownerDocument.defaultView;
31
32
  if (r) {
32
33
  let i = r.getComputedStyle(e);
@@ -37,7 +38,7 @@ function g(e) {
37
38
  gap: n
38
39
  };
39
40
  }
40
- var _ = class {
41
+ var y = class {
41
42
  container = null;
42
43
  button = null;
43
44
  buttonWidth = 0;
@@ -45,7 +46,7 @@ var _ = class {
45
46
  itemIdCounts = /* @__PURE__ */ new Map();
46
47
  widths = /* @__PURE__ */ new WeakMap();
47
48
  listeners = /* @__PURE__ */ new Set();
48
- hidden = c;
49
+ hidden = u;
49
50
  pinned = !1;
50
51
  order = [];
51
52
  connected = !1;
@@ -56,27 +57,27 @@ var _ = class {
56
57
  this.listeners.delete(e);
57
58
  });
58
59
  getSnapshot = () => this.hidden;
59
- getServerSnapshot = () => c;
60
+ getServerSnapshot = () => u;
60
61
  getPinned = () => this.pinned;
61
62
  getServerPinned = () => !1;
62
63
  connect = () => {
63
- if (this.connected = !0, u()) {
64
+ if (this.connected = !0, f()) {
64
65
  this.observer = new ResizeObserver(() => this.measure());
65
66
  for (let e of this.observedElements()) this.observer.observe(e);
66
67
  } else if (typeof window < "u") {
67
68
  let e = () => this.measure();
68
69
  window.addEventListener("resize", e), this.removeResizeListener = () => window.removeEventListener("resize", e);
69
70
  }
70
- return typeof MutationObserver < "u" && (this.reorderObserver = new MutationObserver(() => this.checkOrder()), this.container && this.reorderObserver.observe(this.container, f)), this.measure(), () => {
71
+ return typeof MutationObserver < "u" && (this.reorderObserver = new MutationObserver(() => this.checkOrder()), this.container && this.reorderObserver.observe(this.container, m)), this.measure(), () => {
71
72
  this.connected = !1, this.observer?.disconnect(), this.observer = null, this.reorderObserver?.disconnect(), this.reorderObserver = null, this.removeResizeListener?.(), this.removeResizeListener = null;
72
73
  };
73
74
  };
74
75
  setContainer = (e) => {
75
- e !== this.container && (this.container && this.observer?.unobserve(this.container), this.container = e, e && this.observer?.observe(e), this.reorderObserver && (this.reorderObserver.disconnect(), e && this.reorderObserver.observe(e, f)), this.measure());
76
+ e !== this.container && (this.container && this.observer?.unobserve(this.container), this.container = e, e && this.observer?.observe(e), this.reorderObserver && (this.reorderObserver.disconnect(), e && this.reorderObserver.observe(e, m)), this.measure());
76
77
  };
77
78
  checkOrder = () => {
78
79
  let e = this.order;
79
- for (let t = 1; t < e.length; t++) if (d(e[t - 1], e[t]) > 0) {
80
+ for (let t = 1; t < e.length; t++) if (p(e[t - 1], e[t]) > 0) {
80
81
  this.measure();
81
82
  return;
82
83
  }
@@ -90,9 +91,9 @@ var _ = class {
90
91
  };
91
92
  }
92
93
  registerItemId = (e) => {
93
- if (!t) return h;
94
+ if (!t) return _;
94
95
  let n = this.itemIdCounts, r = (n.get(e) ?? 0) + 1;
95
- return n.set(e, r), r > 1 && m(e), () => {
96
+ return n.set(e, r), r > 1 && g(e), () => {
96
97
  let t = (n.get(e) ?? 1) - 1;
97
98
  t > 0 ? n.set(e, t) : n.delete(e);
98
99
  };
@@ -104,11 +105,11 @@ var _ = class {
104
105
  measure() {
105
106
  let e = this.container;
106
107
  if (!this.connected || !e) return;
107
- let t = Array.from(this.items).filter(([t]) => t.isConnected && e.contains(t)).sort(([e], [t]) => d(e, t));
108
+ let t = Array.from(this.items).filter(([t]) => t.isConnected && e.contains(t)).sort(([e], [t]) => p(e, t));
108
109
  this.order = t.map(([e]) => e);
109
110
  for (let [e] of t) e.hasAttribute("data-overflow-hidden") || this.widths.set(e, e.offsetWidth);
110
111
  this.button?.isConnected && (this.buttonWidth = this.button.offsetWidth);
111
- let { available: n, gap: r } = g(e), i = t.map(([e]) => this.widths.get(e) ?? 0), a = i.reduce((e, t, n) => e + t + (n > 0 ? r : 0), 0), o = c, s = !1;
112
+ let { available: n, gap: r } = v(e), i = t.map(([e]) => this.widths.get(e) ?? 0), a = i.reduce((e, t, n) => e + t + (n > 0 ? r : 0), 0), o = u, s = !1;
112
113
  if (a > n) {
113
114
  let e = n - (this.buttonWidth > 0 ? this.buttonWidth + r : 0), a = 0, c = t.length;
114
115
  for (let n = 0; n < t.length; n++) {
@@ -121,42 +122,42 @@ var _ = class {
121
122
  }
122
123
  o = t.slice(c).map(([, e]) => e), s = o.length > 0 && i[0] + this.buttonWidth > n;
123
124
  }
124
- let l = !p(o, this.hidden);
125
- if (l || s !== this.pinned) {
126
- l && (this.hidden = o.length > 0 ? o : c), this.pinned = s;
125
+ let c = !h(o, this.hidden);
126
+ if (c || s !== this.pinned) {
127
+ c && (this.hidden = o.length > 0 ? o : u), this.pinned = s;
127
128
  for (let e of Array.from(this.listeners)) e();
128
129
  }
129
130
  }
130
- }, v = a.createContext(null), y = {
131
- store: /* @__PURE__ */ new _(),
132
- hiddenIds: c,
131
+ }, b = s.createContext(null), x = {
132
+ store: /* @__PURE__ */ new y(),
133
+ hiddenIds: u,
133
134
  hiddenSet: /* @__PURE__ */ new Set()
134
135
  };
135
- function b(e) {
136
- return a.useContext(v) || (n(e, "Overflow"), y);
136
+ function S(e) {
137
+ return s.useContext(b) || (n(e, "Overflow"), x);
137
138
  }
138
- function x() {
139
- let { hiddenIds: e } = b("useOverflowMenu");
140
- return a.useMemo(() => ({
139
+ function C() {
140
+ let { hiddenIds: e } = S("useOverflowMenu");
141
+ return s.useMemo(() => ({
141
142
  hiddenIds: [...e],
142
143
  count: e.length
143
144
  }), [e]);
144
145
  }
145
- function S(e) {
146
- let { hiddenSet: t } = b("useIsOverflowItemVisible");
146
+ function w(e) {
147
+ let { hiddenSet: t } = S("useIsOverflowItemVisible");
147
148
  return !t.has(e);
148
149
  }
149
- function C(e) {
150
+ function T(e) {
150
151
  return e.nodeType === Node.ELEMENT_NODE;
151
152
  }
152
- function w(e, t, n) {
153
+ function E(e, t, n) {
153
154
  for (let r of n) r.type === "childList" && r.target === t && (r.removedNodes.forEach((t) => {
154
- C(t) && e.unobserve(t);
155
+ T(t) && e.unobserve(t);
155
156
  }), r.addedNodes.forEach((n) => {
156
- C(n) && n.parentNode === t && e.observe(n);
157
+ T(n) && n.parentNode === t && e.observe(n);
157
158
  }));
158
159
  }
159
- var T = class {
160
+ var D = class {
160
161
  element = null;
161
162
  value = !1;
162
163
  listeners = /* @__PURE__ */ new Set();
@@ -173,7 +174,7 @@ var T = class {
173
174
  this.teardown?.(), this.teardown = null, this.element = null;
174
175
  }
175
176
  observe(e) {
176
- let t = () => this.check(), n = [], r = u() ? new ResizeObserver(t) : null;
177
+ let t = () => this.check(), n = [], r = f() ? new ResizeObserver(t) : null;
177
178
  if (r) {
178
179
  r.observe(e);
179
180
  for (let t of Array.from(e.children)) r.observe(t);
@@ -181,7 +182,7 @@ var T = class {
181
182
  } else typeof window < "u" && (window.addEventListener("resize", t), n.push(() => window.removeEventListener("resize", t)));
182
183
  if (typeof MutationObserver < "u") {
183
184
  let i = new MutationObserver((n) => {
184
- r && w(r, e, n), t();
185
+ r && E(r, e, n), t();
185
186
  });
186
187
  i.observe(e, {
187
188
  childList: !0,
@@ -199,71 +200,71 @@ var T = class {
199
200
  }
200
201
  }
201
202
  };
202
- function E(e) {
203
+ function O(e) {
203
204
  return typeof e == "object" && !!e && "current" in e;
204
205
  }
205
- function D(e) {
206
- let [t] = a.useState(() => new T()), n = a.useSyncExternalStore(t.subscribe, t.getSnapshot, t.getServerSnapshot), r = l();
207
- return a.useLayoutEffect(() => {
206
+ function k(e) {
207
+ let [t] = s.useState(() => new D()), n = s.useSyncExternalStore(t.subscribe, t.getSnapshot, t.getServerSnapshot), r = d();
208
+ return s.useLayoutEffect(() => {
208
209
  let n = t.subscribe(r);
209
- t.setElement(E(e) ? e.current : e), n();
210
- }), a.useLayoutEffect(() => () => t.disconnect(), [t]), n;
210
+ t.setElement(O(e) ? e.current : e), n();
211
+ }), s.useLayoutEffect(() => () => t.disconnect(), [t]), n;
211
212
  }
212
- var O = ({ overflowButton: t, children: n, className: r, ref: c, ...u }) => {
213
- let [d] = a.useState(() => new _()), f = a.useSyncExternalStore(d.subscribe, d.getSnapshot, d.getServerSnapshot), p = a.useSyncExternalStore(d.subscribe, d.getPinned, d.getServerPinned), m = a.useCallback((e) => d.setContainer(e), [d]), h = a.useCallback((e) => d.setButton(e), [d]), g = i(c, m), y = l();
214
- a.useLayoutEffect(() => {
215
- let e = d.subscribe(y), t = d.connect();
213
+ var A = ({ overflowButton: t, children: n, className: r, ref: a, ...u }) => {
214
+ let [f] = s.useState(() => new y()), p = s.useSyncExternalStore(f.subscribe, f.getSnapshot, f.getServerSnapshot), m = s.useSyncExternalStore(f.subscribe, f.getPinned, f.getServerPinned), h = s.useCallback((e) => f.setContainer(e), [f]), g = s.useCallback((e) => f.setButton(e), [f]), _ = o(a, h), v = d();
215
+ s.useLayoutEffect(() => {
216
+ let e = f.subscribe(v), t = f.connect();
216
217
  return e(), t;
217
- }, [d, y]), a.useLayoutEffect(() => {
218
- d.checkOrder();
218
+ }, [f, v]), s.useLayoutEffect(() => {
219
+ f.checkOrder();
219
220
  });
220
- let b = a.useMemo(() => new Set(f), [f]), x = a.useMemo(() => [...f], [f]), S = a.useMemo(() => ({
221
- store: d,
222
- hiddenIds: f,
223
- hiddenSet: b
221
+ let x = s.useMemo(() => new Set(p), [p]), S = s.useMemo(() => [...p], [p]), C = s.useMemo(() => ({
222
+ store: f,
223
+ hiddenIds: p,
224
+ hiddenSet: x
224
225
  }), [
225
- d,
226
226
  f,
227
- b
228
- ]), C = f.length;
229
- return /* @__PURE__ */ o(v.Provider, {
230
- value: S,
231
- children: /* @__PURE__ */ s("div", {
232
- ref: g,
233
- className: e("flex items-center overflow-hidden p-1", r),
227
+ p,
228
+ x
229
+ ]), w = p.length;
230
+ return /* @__PURE__ */ c(b.Provider, {
231
+ value: C,
232
+ children: /* @__PURE__ */ l("div", {
233
+ ref: _,
234
+ className: e(i.root, "flex items-center overflow-hidden p-1", r),
234
235
  ...u,
235
- children: [n, C > 0 && t && /* @__PURE__ */ o("div", {
236
- ref: h,
236
+ children: [n, w > 0 && t && /* @__PURE__ */ c("div", {
237
+ ref: g,
237
238
  "data-overflow-button": "",
238
- "data-overflow-pinned": p ? "" : void 0,
239
- className: "sticky -end-1 flex shrink-0 items-center self-stretch ps-1 data-[overflow-pinned]:bg-background data-[overflow-pinned]:pe-1",
240
- children: t(C, x)
239
+ "data-overflow-pinned": m ? "" : void 0,
240
+ className: e(i.overflowButton, "sticky -end-1 flex shrink-0 items-center self-stretch ps-1 data-[overflow-pinned]:bg-background data-[overflow-pinned]:pe-1"),
241
+ children: t(w, S)
241
242
  })]
242
243
  })
243
244
  });
244
245
  };
245
- O.displayName = "Overflow";
246
- var k = ({ itemId: t, children: n, className: r, style: s, ref: c, "aria-hidden": l, inert: u, ...d }) => {
247
- let { store: f, hiddenSet: p } = b("OverflowItem"), m = p.has(t);
248
- a.useEffect(() => f.registerItemId(t), [f, t]);
249
- let h = a.useCallback((e) => e ? f.registerItem(e, t) : void 0, [f, t]), g = i(c, h);
250
- return /* @__PURE__ */ o("div", {
251
- ref: g,
252
- className: e("shrink-0", r),
253
- ...d,
254
- style: m ? {
255
- ...s,
246
+ A.displayName = "Overflow";
247
+ var j = ({ itemId: t, children: n, className: r, style: i, ref: l, "aria-hidden": u, inert: d, ...f }) => {
248
+ let { store: p, hiddenSet: m } = S("OverflowItem"), h = m.has(t);
249
+ s.useEffect(() => p.registerItemId(t), [p, t]);
250
+ let g = s.useCallback((e) => e ? p.registerItem(e, t) : void 0, [p, t]), _ = o(l, g);
251
+ return /* @__PURE__ */ c("div", {
252
+ ref: _,
253
+ className: e(a.root, "shrink-0", r),
254
+ ...f,
255
+ style: h ? {
256
+ ...i,
256
257
  display: "none"
257
- } : s,
258
- "aria-hidden": m ? !0 : l,
259
- inert: m ? !0 : u,
260
- "data-overflow-hidden": m ? "" : void 0,
258
+ } : i,
259
+ "aria-hidden": h ? !0 : u,
260
+ inert: h ? !0 : d,
261
+ "data-overflow-hidden": h ? "" : void 0,
261
262
  children: n
262
263
  });
263
264
  };
264
- k.displayName = "OverflowItem";
265
- var A = /* @__PURE__ */ Object.assign(O, { Item: k });
265
+ j.displayName = "OverflowItem";
266
+ var M = /* @__PURE__ */ Object.assign(A, { Item: j });
266
267
  //#endregion
267
- export { A as Overflow, k as OverflowItem, S as useIsOverflowItemVisible, D as useIsOverflowing, x as useOverflowMenu };
268
+ export { M as Overflow, j as OverflowItem, w as useIsOverflowItemVisible, k as useIsOverflowing, C as useOverflowMenu };
268
269
 
269
270
  //# sourceMappingURL=Overflow.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"Overflow.mjs","names":["React","NO_IDS","useForceRender","n","hasResizeObserver","documentOrder","a","b","REORDER_OBSERVER_OPTIONS","sameIds","id","i","warnDuplicateItemId","itemId","noop","readContainer","paddingInline","gap","view","container","style","OverflowStore","listener","el","onResize","node","order","isDev","counts","count","remaining","elements","entries","widths","total","sum","width","next","pinned","available","limit","used","cut","end","hiddenChanged","OverflowContext","INERT_CONTEXT","useOverflowContext","reportMissingContext","componentName","useOverflowMenu","hiddenIds","useIsOverflowItemVisible","hiddenSet","isElement","followDirectChildren","record","records","parent","observer","OverflowingStore","element","check","cleanups","resizeObserver","child","mutationObserver","cleanup","isRefObject","target","useIsOverflowing","store","isOverflowing","forceRender","unsubscribe","OverflowRoot","rest","setContainer","setButton","containerRef","useMergedRefs","ref","disconnect","buttonIds","ctx","hiddenCount","cn","className","children","overflowButton","OverflowItem","ariaHidden","isHidden","registerRef","mergedRef","inert","Overflow"],"sources":["../../../src/components/layout/Overflow.tsx"],"sourcesContent":["import * as React from 'react';\nimport { cn } from '../../lib/cn';\nimport { isDev, reportMissingContext, warnOnce } from '../../lib/dev';\nimport { useMergedRefs } from '../../hooks/useMergedRefs';\n\n/** Properties for the Overflow component. */\nexport interface OverflowProps extends React.HTMLAttributes<HTMLDivElement> {\n /**\n * Renders the overflow button (for example a \"+3\" menu trigger) while at least one item is\n * hidden. Receives the number of hidden items and their `itemId`s in DOM order, so the button\n * can open a menu of the hidden items. `hiddenIds` is the button's own array (sorting it in\n * place affects nobody else). Its width is measured and reserved when items overflow.\n * Components rendered by it can also read the hidden items with {@link useOverflowMenu}.\n */\n overflowButton?: (count: number, hiddenIds: string[]) => React.ReactNode;\n /**\n * The {@link OverflowItem}s to lay out in one row. Only items and the overflow button are\n * measured: the container's whole content box is the room for them, so other content placed in\n * the row is not accounted for and could clip items that still count as visible. Keep fixed\n * content outside the Overflow (for example in a surrounding flex row), or wrap it in an\n * `OverflowItem` (the first item is never hidden).\n */\n children: React.ReactNode;\n ref?: React.Ref<HTMLDivElement>;\n}\n\n/** Properties for the OverflowItem sub-component. */\nexport interface OverflowItemProps extends React.HTMLAttributes<HTMLDivElement> {\n /**\n * Identifier for tracking this item's overflow visibility, unique within the Overflow (a\n * duplicate warns in development: items that share one are hidden and shown together).\n */\n itemId: string;\n /** Content of the overflow item. */\n children: React.ReactNode;\n ref?: React.Ref<HTMLDivElement>;\n}\n\n/** Result of {@link useOverflowMenu}. */\nexport interface UseOverflowMenuResult {\n /** `itemId`s of the hidden items, in DOM order (the caller's own array). */\n hiddenIds: string[];\n /** Number of hidden items. */\n count: number;\n}\n\n// ---------------------------------------------------------------------------\n// Measurement store\n// ---------------------------------------------------------------------------\n\n/**\n * The empty snapshot. Snapshots are internal: they are compared by identity and never handed to\n * consumers, who receive their own copies (see `useOverflowMenu` and `overflowButton`).\n */\nconst NO_IDS: string[] = [];\n\n/** A stable function that re-renders the calling component. */\nfunction useForceRender(): () => void {\n return React.useReducer((n: number) => n + 1, 0)[1];\n}\n\nfunction hasResizeObserver(): boolean {\n return typeof ResizeObserver !== 'undefined';\n}\n\nfunction documentOrder(a: Element, b: Element): number {\n if (a === b) return 0;\n return a.compareDocumentPosition(b) & Node.DOCUMENT_POSITION_FOLLOWING ? -1 : 1;\n}\n\n/** Moves anywhere in the row: items reordered directly or inside wrappers. */\nconst REORDER_OBSERVER_OPTIONS: MutationObserverInit = { childList: true, subtree: true };\n\nfunction sameIds(a: readonly string[], b: readonly string[]): boolean {\n return a.length === b.length && a.every((id, i) => id === b[i]);\n}\n\nfunction warnDuplicateItemId(itemId: string): void {\n warnOnce(\n `Overflow:duplicate:${itemId}`,\n `Overflow: several items share the itemId \"${itemId}\". Item ids must be unique within an ` +\n 'Overflow; items with the same itemId are hidden and shown together.',\n );\n}\n\nconst noop = () => {};\n\n/** Width available to items: the content box of the container, and the flex gap between items. */\nfunction readContainer(container: HTMLElement): { available: number; gap: number } {\n let paddingInline = 0;\n let gap = 0;\n const view = container.ownerDocument.defaultView;\n if (view) {\n const style = view.getComputedStyle(container);\n paddingInline = (parseFloat(style.paddingLeft) || 0) + (parseFloat(style.paddingRight) || 0);\n gap = parseFloat(style.columnGap) || 0;\n }\n return { available: container.clientWidth - paddingInline, gap };\n}\n\n/**\n * Tracks the container, the items and the overflow button of one `Overflow` and publishes the ids\n * of the hidden items (DOM order), and whether the button covers the first item, to\n * `useSyncExternalStore`.\n *\n * - **Measurement never writes styles.** An item's width is read (`offsetWidth`) only while it is\n * visible and cached; a hidden item (`data-overflow-hidden` and an inline `display: none`, both\n * rendered by React) keeps its last visible width. All reads happen before React applies the\n * result.\n * - **Membership-only updates.** A new snapshot is published only when the hidden set (or whether\n * the button covers the first item) changes, so a resize that hides the same items renders\n * nothing.\n * - **One observer.** A single `ResizeObserver` (created when the root mounts) watches the\n * container, every item and the overflow button. Without `ResizeObserver` the store measures\n * whenever something registers and on window `resize`.\n * - **Reorders.** A keyed reorder moves item elements without registering them again or changing\n * a size. The order of the last measurement is re-checked (n − 1 `compareDocumentPosition`\n * calls, no layout reads) after every commit of the root and, through a `MutationObserver`\n * (`childList`, `subtree`) on the container, after moves that do not render the root (a list\n * component inside the row that owns its order); only an inversion re-measures.\n */\nclass OverflowStore {\n private container: HTMLElement | null = null;\n private button: HTMLElement | null = null;\n private buttonWidth = 0;\n private readonly items = new Map<HTMLElement, string>();\n /** How many mounted items use each `itemId` (development only: a repeated one warns). */\n private readonly itemIdCounts = new Map<string, number>();\n private readonly widths = new WeakMap<HTMLElement, number>();\n private readonly listeners = new Set<() => void>();\n private hidden: string[] = NO_IDS;\n /** The first item is wider than the room beside the button, so the button covers its end. */\n private pinned = false;\n /** The item elements of the last measurement, in the DOM order they had then. */\n private order: HTMLElement[] = [];\n private connected = false;\n private observer: ResizeObserver | null = null;\n private reorderObserver: MutationObserver | null = null;\n private removeResizeListener: (() => void) | null = null;\n\n subscribe = (listener: () => void): (() => void) => {\n this.listeners.add(listener);\n return () => {\n this.listeners.delete(listener);\n };\n };\n\n getSnapshot = (): string[] => this.hidden;\n\n getServerSnapshot = (): string[] => NO_IDS;\n\n getPinned = (): boolean => this.pinned;\n\n getServerPinned = (): boolean => false;\n\n /** Starts observing (root layout effect); returns the teardown. */\n connect = (): (() => void) => {\n this.connected = true;\n if (hasResizeObserver()) {\n this.observer = new ResizeObserver(() => this.measure());\n for (const el of this.observedElements()) this.observer.observe(el);\n } else if (typeof window !== 'undefined') {\n const onResize = () => this.measure();\n window.addEventListener('resize', onResize);\n this.removeResizeListener = () => window.removeEventListener('resize', onResize);\n }\n if (typeof MutationObserver !== 'undefined') {\n this.reorderObserver = new MutationObserver(() => this.checkOrder());\n if (this.container) this.reorderObserver.observe(this.container, REORDER_OBSERVER_OPTIONS);\n }\n this.measure();\n return () => {\n this.connected = false;\n this.observer?.disconnect();\n this.observer = null;\n this.reorderObserver?.disconnect();\n this.reorderObserver = null;\n this.removeResizeListener?.();\n this.removeResizeListener = null;\n };\n };\n\n /** Ref callback of the container. */\n setContainer = (node: HTMLDivElement | null): void => {\n if (node === this.container) return;\n if (this.container) this.observer?.unobserve(this.container);\n this.container = node;\n if (node) this.observer?.observe(node);\n if (this.reorderObserver) {\n this.reorderObserver.disconnect();\n if (node) this.reorderObserver.observe(node, REORDER_OBSERVER_OPTIONS);\n }\n this.measure();\n };\n\n /**\n * Re-measures when the items of the last measurement are no longer in DOM order (a keyed\n * reorder). Cheap: neighbour comparisons only, no layout reads.\n */\n checkOrder = (): void => {\n const order = this.order;\n for (let i = 1; i < order.length; i++) {\n if (documentOrder(order[i - 1], order[i]) > 0) {\n this.measure();\n return;\n }\n }\n };\n\n /** Ref callback of the overflow button wrapper. The last measured width outlives it. */\n setButton = (node: HTMLDivElement | null): void => {\n if (node === this.button) return;\n if (this.button) this.observer?.unobserve(this.button);\n this.button = node;\n if (node) this.observer?.observe(node);\n this.measure();\n };\n\n /** Registers an item element; returns its unregistration. */\n registerItem(el: HTMLElement, id: string): () => void {\n this.items.set(el, id);\n this.observer?.observe(el);\n this.measure();\n return () => {\n if (this.items.get(el) !== id) return;\n this.items.delete(el);\n this.observer?.unobserve(el);\n this.measure();\n };\n }\n\n /**\n * Counts the `itemId` of a mounted item (called from the item's effect, C-DEV); a second item\n * with an id already in use warns once per id. Returns the cleanup.\n */\n registerItemId = (itemId: string): (() => void) => {\n if (!isDev) return noop;\n const counts = this.itemIdCounts;\n const count = (counts.get(itemId) ?? 0) + 1;\n counts.set(itemId, count);\n if (count > 1) warnDuplicateItemId(itemId);\n return () => {\n const remaining = (counts.get(itemId) ?? 1) - 1;\n if (remaining > 0) counts.set(itemId, remaining);\n else counts.delete(itemId);\n };\n };\n\n private observedElements(): HTMLElement[] {\n const elements = Array.from(this.items.keys());\n if (this.container) elements.push(this.container);\n if (this.button) elements.push(this.button);\n return elements;\n }\n\n private measure(): void {\n const container = this.container;\n if (!this.connected || !container) return;\n\n // Reads first: widths of the visible items, the button and the container.\n const entries = Array.from(this.items)\n .filter(([el]) => el.isConnected && container.contains(el))\n .sort(([a], [b]) => documentOrder(a, b));\n this.order = entries.map(([el]) => el);\n for (const [el] of entries) {\n if (!el.hasAttribute('data-overflow-hidden')) this.widths.set(el, el.offsetWidth);\n }\n if (this.button?.isConnected) this.buttonWidth = this.button.offsetWidth;\n const { available, gap } = readContainer(container);\n\n const widths = entries.map(([el]) => this.widths.get(el) ?? 0);\n const total = widths.reduce((sum, width, i) => sum + width + (i > 0 ? gap : 0), 0);\n\n let next: string[] = NO_IDS;\n let pinned = false;\n if (total > available) {\n // Items that fit next to the overflow button stay; the first item always stays.\n const limit = available - (this.buttonWidth > 0 ? this.buttonWidth + gap : 0);\n let used = 0;\n let cut = entries.length;\n for (let i = 0; i < entries.length; i++) {\n const end = used + widths[i] + (i > 0 ? gap : 0);\n if (i > 0 && end > limit) {\n cut = i;\n break;\n }\n used = end;\n }\n next = entries.slice(cut).map(([, id]) => id);\n // The sticky button eats the gap before it first; it covers the first item only when the\n // two do not fit side by side.\n pinned = next.length > 0 && widths[0] + this.buttonWidth > available;\n }\n\n const hiddenChanged = !sameIds(next, this.hidden);\n if (!hiddenChanged && pinned === this.pinned) return;\n // The same hidden set keeps its array, so the items and useOverflowMenu() do not update.\n if (hiddenChanged) this.hidden = next.length > 0 ? next : NO_IDS;\n this.pinned = pinned;\n for (const listener of Array.from(this.listeners)) listener();\n }\n}\n\n// ---------------------------------------------------------------------------\n// Context (C-CONTEXT)\n// ---------------------------------------------------------------------------\n\ninterface OverflowContextValue {\n store: OverflowStore;\n hiddenIds: string[];\n hiddenSet: ReadonlySet<string>;\n}\n\nconst OverflowContext = React.createContext<OverflowContextValue | null>(null);\n\n/** Production fallback for a misplaced sub-component: a store that is never connected. */\nconst INERT_CONTEXT: OverflowContextValue = {\n store: /* @__PURE__ */ new OverflowStore(),\n hiddenIds: NO_IDS,\n hiddenSet: /* @__PURE__ */ new Set<string>(),\n};\n\n/**\n * The enclosing Overflow's context. Outside an Overflow it throws in development and, in\n * production, logs an error once and returns an inert value (C-CONTEXT).\n */\nfunction useOverflowContext(componentName: string): OverflowContextValue {\n const ctx = React.useContext(OverflowContext);\n if (ctx) return ctx;\n reportMissingContext(componentName, 'Overflow');\n return INERT_CONTEXT;\n}\n\n// ---------------------------------------------------------------------------\n// Hooks\n// ---------------------------------------------------------------------------\n\n/**\n * The items an {@link Overflow} currently hides: their `itemId`s in DOM order and their count. Use\n * it in the component that `overflowButton` renders to list the hidden items in a menu. Must be\n * called inside `Overflow`.\n */\nexport function useOverflowMenu(): UseOverflowMenuResult {\n const { hiddenIds } = useOverflowContext('useOverflowMenu');\n // A copy per caller and snapshot: sorting or reversing it cannot affect other consumers.\n return React.useMemo(() => ({ hiddenIds: [...hiddenIds], count: hiddenIds.length }), [hiddenIds]);\n}\n\n/**\n * Whether the {@link OverflowItem} with `itemId` is currently shown (`false` while it overflows).\n * Must be called inside `Overflow`.\n */\nexport function useIsOverflowItemVisible(itemId: string): boolean {\n const { hiddenSet } = useOverflowContext('useIsOverflowItemVisible');\n return !hiddenSet.has(itemId);\n}\n\nfunction isElement(node: Node): node is Element {\n return node.nodeType === Node.ELEMENT_NODE;\n}\n\n/**\n * Keeps `observer` on the element children of `parent`: unobserves the removed ones and observes\n * the added ones that are still attached to `parent` (records are replayed in order, so a child\n * moved or re-added within one batch ends up observed exactly when it is present).\n */\nfunction followDirectChildren(\n observer: ResizeObserver,\n parent: Element,\n records: readonly MutationRecord[],\n): void {\n for (const record of records) {\n if (record.type !== 'childList' || record.target !== parent) continue;\n record.removedNodes.forEach((node) => {\n if (isElement(node)) observer.unobserve(node);\n });\n record.addedNodes.forEach((node) => {\n if (isElement(node) && node.parentNode === parent) observer.observe(node);\n });\n }\n}\n\n/** Tracks `scrollWidth > clientWidth` of one element. */\nclass OverflowingStore {\n private element: HTMLElement | null = null;\n private value = false;\n private readonly listeners = new Set<() => void>();\n private teardown: (() => void) | null = null;\n\n subscribe = (listener: () => void): (() => void) => {\n this.listeners.add(listener);\n return () => {\n this.listeners.delete(listener);\n };\n };\n\n getSnapshot = (): boolean => this.value;\n\n getServerSnapshot = (): boolean => false;\n\n /** Follows `element` (layout effect of every render); re-subscribes when it changes. */\n setElement(element: HTMLElement | null): void {\n if (element === this.element) return;\n this.disconnect();\n this.element = element;\n if (element) this.teardown = this.observe(element);\n this.check();\n }\n\n disconnect(): void {\n this.teardown?.();\n this.teardown = null;\n this.element = null;\n }\n\n private observe(element: HTMLElement): () => void {\n const check = () => this.check();\n const cleanups: Array<() => void> = [];\n\n // Resizes of the element and of its direct children (content that grows or shrinks).\n const resizeObserver = hasResizeObserver() ? new ResizeObserver(check) : null;\n if (resizeObserver) {\n resizeObserver.observe(element);\n for (const child of Array.from(element.children)) resizeObserver.observe(child);\n cleanups.push(() => resizeObserver.disconnect());\n } else if (typeof window !== 'undefined') {\n window.addEventListener('resize', check);\n cleanups.push(() => window.removeEventListener('resize', check));\n }\n\n // Content added, removed or edited. Only a change of the direct children changes what the\n // ResizeObserver watches, and only those children are (un)observed; text edits and deeper\n // changes just re-check.\n if (typeof MutationObserver !== 'undefined') {\n const mutationObserver = new MutationObserver((records) => {\n if (resizeObserver) followDirectChildren(resizeObserver, element, records);\n check();\n });\n mutationObserver.observe(element, { childList: true, subtree: true, characterData: true });\n cleanups.push(() => mutationObserver.disconnect());\n }\n\n return () => cleanups.forEach((cleanup) => cleanup());\n }\n\n private check(): void {\n const el = this.element;\n const next = el !== null && el.scrollWidth > el.clientWidth;\n if (next === this.value) return;\n this.value = next;\n for (const listener of Array.from(this.listeners)) listener();\n }\n}\n\nfunction isRefObject(\n target: React.RefObject<HTMLElement | null> | HTMLElement | null | undefined,\n): target is React.RefObject<HTMLElement | null> {\n return target != null && typeof target === 'object' && 'current' in target;\n}\n\n/**\n * Whether `target`'s content is wider than the element (`scrollWidth > clientWidth`).\n *\n * `target` is a ref object or the element itself (for example from callback-ref state:\n * `const [el, setEl] = useState(null)` + `ref={setEl}`). The hook re-checks when the element\n * resizes, when its direct children resize, and when content is added, removed or edited; an\n * element that mounts later (a ref attached conditionally) is picked up after the render that\n * mounts it. Without `ResizeObserver` it re-checks on window `resize` and content changes. Returns\n * `false` on the server.\n */\nexport function useIsOverflowing(\n target: React.RefObject<HTMLElement | null> | HTMLElement | null,\n): boolean {\n const [store] = React.useState(() => new OverflowingStore());\n const isOverflowing = React.useSyncExternalStore(\n store.subscribe,\n store.getSnapshot,\n store.getServerSnapshot,\n );\n const forceRender = useForceRender();\n\n // Every render: follow the element the ref points to now (cheap identity check). A change found\n // here re-renders from the layout phase, before paint: useSyncExternalStore only subscribes in a\n // passive effect, so on mount it would pick the first value up after the browser painted.\n React.useLayoutEffect(() => {\n const unsubscribe = store.subscribe(forceRender);\n store.setElement(isRefObject(target) ? target.current : target);\n unsubscribe();\n });\n\n React.useLayoutEffect(() => () => store.disconnect(), [store]);\n\n return isOverflowing;\n}\n\n// ---------------------------------------------------------------------------\n// Components\n// ---------------------------------------------------------------------------\n\nconst OverflowRoot = ({ overflowButton, children, className, ref, ...rest }: OverflowProps) => {\n const [store] = React.useState(() => new OverflowStore());\n const hiddenIds = React.useSyncExternalStore(\n store.subscribe,\n store.getSnapshot,\n store.getServerSnapshot,\n );\n const pinned = React.useSyncExternalStore(\n store.subscribe,\n store.getPinned,\n store.getServerPinned,\n );\n const setContainer = React.useCallback(\n (node: HTMLDivElement | null) => store.setContainer(node),\n [store],\n );\n const setButton = React.useCallback(\n (node: HTMLDivElement | null) => store.setButton(node),\n [store],\n );\n const containerRef = useMergedRefs<HTMLDivElement>(ref, setContainer);\n const forceRender = useForceRender();\n\n // Observers are created once per instance (not per render or per children change). The first\n // measurement (in connect) re-renders from this layout effect, before paint: useSyncExternalStore\n // only subscribes in a passive effect, which can run after the browser painted every item.\n React.useLayoutEffect(() => {\n const unsubscribe = store.subscribe(forceRender);\n const disconnect = store.connect();\n unsubscribe();\n return disconnect;\n }, [store, forceRender]);\n\n // After every commit of the root (new children, a keyed reorder): items moved without any size\n // change or registration are re-measured before paint. Cheap when nothing moved.\n React.useLayoutEffect(() => {\n store.checkOrder();\n });\n\n const hiddenSet = React.useMemo(() => new Set(hiddenIds), [hiddenIds]);\n // The overflowButton's own copy (consumers may sort it in place).\n const buttonIds = React.useMemo(() => [...hiddenIds], [hiddenIds]);\n const ctx = React.useMemo<OverflowContextValue>(\n () => ({ store, hiddenIds, hiddenSet }),\n [store, hiddenIds, hiddenSet],\n );\n\n const hiddenCount = hiddenIds.length;\n\n return (\n <OverflowContext.Provider value={ctx}>\n <div\n ref={containerRef}\n // The row clips its content at its padding edge: the 4px padding leaves room for the focus\n // indicator a focused item draws 4px around itself. No negative margin offsets it: the\n // row's box would then reach past its container, which a scroll container around an\n // edge-to-edge row (or the page) counts as overflow. The store measures the room without\n // the padding.\n className={cn('flex items-center overflow-hidden p-1', className)}\n {...rest}\n >\n {children}\n {hiddenCount > 0 && overflowButton && (\n // In the row's flow (it adds to the row height and follows justify-*), sticking to the\n // inline end when the first item is wider than the room beside it. Browsers stop a\n // sticky element at the scroll container's padding, so -end-1 lets it reach the\n // clipping edge, and while pinned it keeps 4px inside for its own focus indicator.\n // (WebKit stops a sticky element short of the inline end of a right-to-left row; it\n // stays in the row.)\n <div\n ref={setButton}\n data-overflow-button=\"\"\n data-overflow-pinned={pinned ? '' : undefined}\n className=\"sticky -end-1 flex shrink-0 items-center self-stretch ps-1 data-[overflow-pinned]:bg-background data-[overflow-pinned]:pe-1\"\n >\n {overflowButton(hiddenCount, buttonIds)}\n </div>\n )}\n </div>\n </OverflowContext.Provider>\n );\n};\nOverflowRoot.displayName = 'Overflow';\n\n/**\n * One entry of an {@link Overflow}. While it does not fit it stays mounted but is hidden\n * (`data-overflow-hidden` and an inline `display: none` placed after the consumer's own `style`),\n * `aria-hidden` and `inert`. The inline style wins over the consumer's `style.display` and over\n * display utilities in any cascade layer (a prefixed Tailwind app's `tw:flex` included), so a\n * hidden item is never shown while it is counted in \"+N\". Must be rendered inside `Overflow`.\n */\nexport const OverflowItem = ({\n itemId,\n children,\n className,\n style,\n ref,\n 'aria-hidden': ariaHidden,\n inert,\n ...rest\n}: OverflowItemProps) => {\n const { store, hiddenSet } = useOverflowContext('OverflowItem');\n const isHidden = hiddenSet.has(itemId);\n React.useEffect(() => store.registerItemId(itemId), [store, itemId]);\n\n const registerRef = React.useCallback(\n (node: HTMLDivElement | null) => (node ? store.registerItem(node, itemId) : undefined),\n [store, itemId],\n );\n const mergedRef = useMergedRefs<HTMLDivElement>(ref, registerRef);\n\n return (\n <div\n ref={mergedRef}\n className={cn('shrink-0', className)}\n {...rest}\n style={isHidden ? { ...style, display: 'none' } : style}\n aria-hidden={isHidden ? true : ariaHidden}\n inert={isHidden ? true : inert}\n data-overflow-hidden={isHidden ? '' : undefined}\n >\n {children}\n </div>\n );\n};\nOverflowItem.displayName = 'OverflowItem';\n\n/**\n * A single row that hides the items which do not fit and shows an overflow button instead.\n *\n * Wrap each entry in {@link OverflowItem} with a unique `itemId`; the row holds only items (other\n * content is not measured, see `children`). Items are measured while visible, hidden from the end\n * (in DOM order; the first item always stays) and hidden items get `data-overflow-hidden`, an\n * inline `display: none`, `aria-hidden` and `inert`. Reordered items (for example a keyed sort) are\n * re-measured in their new order. `overflowButton(count, hiddenIds)` renders the button after the\n * visible items (its measured width is reserved); components inside it can use\n * {@link useOverflowMenu} to list the hidden items (e.g. in a Menu), and\n * {@link useIsOverflowItemVisible} reports a single item. The button sticks to the inline end of\n * the row, so a first item wider than the room beside it cannot push it out of view: it then covers\n * the end of that item and gets `data-overflow-pinned`, with the `background` token behind it. (In\n * a right-to-left row, WebKit stops the pinned button short of the end, still inside the row.)\n *\n * The row clips what does not fit. So that the focus indicators of its items are not cut off, it\n * has a 4px padding: the items sit 4px in from its edges, and the row is 8px taller than they are.\n * An explicit width (such as `w-full` or a style width) includes that padding. The row never\n * reaches past its own box, so an edge-to-edge row adds no scrollbar to the page or to a scroll\n * container around it. A negative margin of 4px lines the items up with the content around the\n * row; add it only where nothing within 4px of the row scrolls (the row's box then reaches 4px past\n * its container on every side). `p-0` removes the room (focus indicators at the row's edges are\n * then clipped).\n *\n * Works without `ResizeObserver` (jsdom, old browsers): it then re-measures on window resize and\n * when items mount, unmount or move.\n *\n * The item is also `Overflow.Item`. The same component is exported as `OverflowItem`; React Server\n * Components import that flat name (dotted access needs a client file).\n */\nexport const Overflow = /* @__PURE__ */ Object.assign(OverflowRoot, {\n Item: OverflowItem,\n});\n"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ow.mjs","names":["React","NO_IDS","useForceRender","n","hasResizeObserver","documentOrder","a","b","REORDER_OBSERVER_OPTIONS","sameIds","id","i","warnDuplicateItemId","itemId","noop","readContainer","paddingInline","gap","view","container","style","OverflowStore","listener","el","onResize","node","order","isDev","counts","count","remaining","elements","entries","widths","total","sum","width","next","pinned","available","limit","used","cut","end","hiddenChanged","OverflowContext","INERT_CONTEXT","useOverflowContext","reportMissingContext","componentName","useOverflowMenu","hiddenIds","useIsOverflowItemVisible","hiddenSet","isElement","followDirectChildren","record","records","parent","observer","OverflowingStore","element","check","cleanups","resizeObserver","child","mutationObserver","cleanup","isRefObject","target","useIsOverflowing","store","isOverflowing","forceRender","unsubscribe","OverflowRoot","rest","setContainer","setButton","containerRef","useMergedRefs","ref","disconnect","buttonIds","ctx","hiddenCount","cn","overflowClassNames","className","children","overflowButton","OverflowItem","ariaHidden","isHidden","registerRef","mergedRef","overflowItemClassNames","inert","Overflow"],"sources":["../../../src/components/layout/Overflow.tsx"],"sourcesContent":["import * as React from 'react';\nimport { overflowClassNames, overflowItemClassNames } from '../../lib/classNames';\nimport { cn } from '../../lib/cn';\nimport { isDev, reportMissingContext, warnOnce } from '../../lib/dev';\nimport { useMergedRefs } from '../../hooks/useMergedRefs';\n\n/** Properties for the Overflow component. */\nexport interface OverflowProps extends React.HTMLAttributes<HTMLDivElement> {\n /**\n * Renders the overflow button (for example a \"+3\" menu trigger) while at least one item is\n * hidden. Receives the number of hidden items and their `itemId`s in DOM order, so the button\n * can open a menu of the hidden items. `hiddenIds` is the button's own array (sorting it in\n * place affects nobody else). Its width is measured and reserved when items overflow.\n * Components rendered by it can also read the hidden items with {@link useOverflowMenu}.\n */\n overflowButton?: (count: number, hiddenIds: string[]) => React.ReactNode;\n /**\n * The {@link OverflowItem}s to lay out in one row. Only items and the overflow button are\n * measured: the container's whole content box is the room for them, so other content placed in\n * the row is not accounted for and could clip items that still count as visible. Keep fixed\n * content outside the Overflow (for example in a surrounding flex row), or wrap it in an\n * `OverflowItem` (the first item is never hidden).\n */\n children: React.ReactNode;\n ref?: React.Ref<HTMLDivElement>;\n}\n\n/** Properties for the OverflowItem sub-component. */\nexport interface OverflowItemProps extends React.HTMLAttributes<HTMLDivElement> {\n /**\n * Identifier for tracking this item's overflow visibility, unique within the Overflow (a\n * duplicate warns in development: items that share one are hidden and shown together).\n */\n itemId: string;\n /** Content of the overflow item. */\n children: React.ReactNode;\n ref?: React.Ref<HTMLDivElement>;\n}\n\n/** Result of {@link useOverflowMenu}. */\nexport interface UseOverflowMenuResult {\n /** `itemId`s of the hidden items, in DOM order (the caller's own array). */\n hiddenIds: string[];\n /** Number of hidden items. */\n count: number;\n}\n\n// ---------------------------------------------------------------------------\n// Measurement store\n// ---------------------------------------------------------------------------\n\n/**\n * The empty snapshot. Snapshots are internal: they are compared by identity and never handed to\n * consumers, who receive their own copies (see `useOverflowMenu` and `overflowButton`).\n */\nconst NO_IDS: string[] = [];\n\n/** A stable function that re-renders the calling component. */\nfunction useForceRender(): () => void {\n return React.useReducer((n: number) => n + 1, 0)[1];\n}\n\nfunction hasResizeObserver(): boolean {\n return typeof ResizeObserver !== 'undefined';\n}\n\nfunction documentOrder(a: Element, b: Element): number {\n if (a === b) return 0;\n return a.compareDocumentPosition(b) & Node.DOCUMENT_POSITION_FOLLOWING ? -1 : 1;\n}\n\n/** Moves anywhere in the row: items reordered directly or inside wrappers. */\nconst REORDER_OBSERVER_OPTIONS: MutationObserverInit = { childList: true, subtree: true };\n\nfunction sameIds(a: readonly string[], b: readonly string[]): boolean {\n return a.length === b.length && a.every((id, i) => id === b[i]);\n}\n\nfunction warnDuplicateItemId(itemId: string): void {\n warnOnce(\n `Overflow:duplicate:${itemId}`,\n `Overflow: several items share the itemId \"${itemId}\". Item ids must be unique within an ` +\n 'Overflow; items with the same itemId are hidden and shown together.',\n );\n}\n\nconst noop = () => {};\n\n/** Width available to items: the content box of the container, and the flex gap between items. */\nfunction readContainer(container: HTMLElement): { available: number; gap: number } {\n let paddingInline = 0;\n let gap = 0;\n const view = container.ownerDocument.defaultView;\n if (view) {\n const style = view.getComputedStyle(container);\n paddingInline = (parseFloat(style.paddingLeft) || 0) + (parseFloat(style.paddingRight) || 0);\n gap = parseFloat(style.columnGap) || 0;\n }\n return { available: container.clientWidth - paddingInline, gap };\n}\n\n/**\n * Tracks the container, the items and the overflow button of one `Overflow` and publishes the ids\n * of the hidden items (DOM order), and whether the button covers the first item, to\n * `useSyncExternalStore`.\n *\n * - **Measurement never writes styles.** An item's width is read (`offsetWidth`) only while it is\n * visible and cached; a hidden item (`data-overflow-hidden` and an inline `display: none`, both\n * rendered by React) keeps its last visible width. All reads happen before React applies the\n * result.\n * - **Membership-only updates.** A new snapshot is published only when the hidden set (or whether\n * the button covers the first item) changes, so a resize that hides the same items renders\n * nothing.\n * - **One observer.** A single `ResizeObserver` (created when the root mounts) watches the\n * container, every item and the overflow button. Without `ResizeObserver` the store measures\n * whenever something registers and on window `resize`.\n * - **Reorders.** A keyed reorder moves item elements without registering them again or changing\n * a size. The order of the last measurement is re-checked (n − 1 `compareDocumentPosition`\n * calls, no layout reads) after every commit of the root and, through a `MutationObserver`\n * (`childList`, `subtree`) on the container, after moves that do not render the root (a list\n * component inside the row that owns its order); only an inversion re-measures.\n */\nclass OverflowStore {\n private container: HTMLElement | null = null;\n private button: HTMLElement | null = null;\n private buttonWidth = 0;\n private readonly items = new Map<HTMLElement, string>();\n /** How many mounted items use each `itemId` (development only: a repeated one warns). */\n private readonly itemIdCounts = new Map<string, number>();\n private readonly widths = new WeakMap<HTMLElement, number>();\n private readonly listeners = new Set<() => void>();\n private hidden: string[] = NO_IDS;\n /** The first item is wider than the room beside the button, so the button covers its end. */\n private pinned = false;\n /** The item elements of the last measurement, in the DOM order they had then. */\n private order: HTMLElement[] = [];\n private connected = false;\n private observer: ResizeObserver | null = null;\n private reorderObserver: MutationObserver | null = null;\n private removeResizeListener: (() => void) | null = null;\n\n subscribe = (listener: () => void): (() => void) => {\n this.listeners.add(listener);\n return () => {\n this.listeners.delete(listener);\n };\n };\n\n getSnapshot = (): string[] => this.hidden;\n\n getServerSnapshot = (): string[] => NO_IDS;\n\n getPinned = (): boolean => this.pinned;\n\n getServerPinned = (): boolean => false;\n\n /** Starts observing (root layout effect); returns the teardown. */\n connect = (): (() => void) => {\n this.connected = true;\n if (hasResizeObserver()) {\n this.observer = new ResizeObserver(() => this.measure());\n for (const el of this.observedElements()) this.observer.observe(el);\n } else if (typeof window !== 'undefined') {\n const onResize = () => this.measure();\n window.addEventListener('resize', onResize);\n this.removeResizeListener = () => window.removeEventListener('resize', onResize);\n }\n if (typeof MutationObserver !== 'undefined') {\n this.reorderObserver = new MutationObserver(() => this.checkOrder());\n if (this.container) this.reorderObserver.observe(this.container, REORDER_OBSERVER_OPTIONS);\n }\n this.measure();\n return () => {\n this.connected = false;\n this.observer?.disconnect();\n this.observer = null;\n this.reorderObserver?.disconnect();\n this.reorderObserver = null;\n this.removeResizeListener?.();\n this.removeResizeListener = null;\n };\n };\n\n /** Ref callback of the container. */\n setContainer = (node: HTMLDivElement | null): void => {\n if (node === this.container) return;\n if (this.container) this.observer?.unobserve(this.container);\n this.container = node;\n if (node) this.observer?.observe(node);\n if (this.reorderObserver) {\n this.reorderObserver.disconnect();\n if (node) this.reorderObserver.observe(node, REORDER_OBSERVER_OPTIONS);\n }\n this.measure();\n };\n\n /**\n * Re-measures when the items of the last measurement are no longer in DOM order (a keyed\n * reorder). Cheap: neighbour comparisons only, no layout reads.\n */\n checkOrder = (): void => {\n const order = this.order;\n for (let i = 1; i < order.length; i++) {\n if (documentOrder(order[i - 1], order[i]) > 0) {\n this.measure();\n return;\n }\n }\n };\n\n /** Ref callback of the overflow button wrapper. The last measured width outlives it. */\n setButton = (node: HTMLDivElement | null): void => {\n if (node === this.button) return;\n if (this.button) this.observer?.unobserve(this.button);\n this.button = node;\n if (node) this.observer?.observe(node);\n this.measure();\n };\n\n /** Registers an item element; returns its unregistration. */\n registerItem(el: HTMLElement, id: string): () => void {\n this.items.set(el, id);\n this.observer?.observe(el);\n this.measure();\n return () => {\n if (this.items.get(el) !== id) return;\n this.items.delete(el);\n this.observer?.unobserve(el);\n this.measure();\n };\n }\n\n /**\n * Counts the `itemId` of a mounted item (called from the item's effect, C-DEV); a second item\n * with an id already in use warns once per id. Returns the cleanup.\n */\n registerItemId = (itemId: string): (() => void) => {\n if (!isDev) return noop;\n const counts = this.itemIdCounts;\n const count = (counts.get(itemId) ?? 0) + 1;\n counts.set(itemId, count);\n if (count > 1) warnDuplicateItemId(itemId);\n return () => {\n const remaining = (counts.get(itemId) ?? 1) - 1;\n if (remaining > 0) counts.set(itemId, remaining);\n else counts.delete(itemId);\n };\n };\n\n private observedElements(): HTMLElement[] {\n const elements = Array.from(this.items.keys());\n if (this.container) elements.push(this.container);\n if (this.button) elements.push(this.button);\n return elements;\n }\n\n private measure(): void {\n const container = this.container;\n if (!this.connected || !container) return;\n\n // Reads first: widths of the visible items, the button and the container.\n const entries = Array.from(this.items)\n .filter(([el]) => el.isConnected && container.contains(el))\n .sort(([a], [b]) => documentOrder(a, b));\n this.order = entries.map(([el]) => el);\n for (const [el] of entries) {\n if (!el.hasAttribute('data-overflow-hidden')) this.widths.set(el, el.offsetWidth);\n }\n if (this.button?.isConnected) this.buttonWidth = this.button.offsetWidth;\n const { available, gap } = readContainer(container);\n\n const widths = entries.map(([el]) => this.widths.get(el) ?? 0);\n const total = widths.reduce((sum, width, i) => sum + width + (i > 0 ? gap : 0), 0);\n\n let next: string[] = NO_IDS;\n let pinned = false;\n if (total > available) {\n // Items that fit next to the overflow button stay; the first item always stays.\n const limit = available - (this.buttonWidth > 0 ? this.buttonWidth + gap : 0);\n let used = 0;\n let cut = entries.length;\n for (let i = 0; i < entries.length; i++) {\n const end = used + widths[i] + (i > 0 ? gap : 0);\n if (i > 0 && end > limit) {\n cut = i;\n break;\n }\n used = end;\n }\n next = entries.slice(cut).map(([, id]) => id);\n // The sticky button eats the gap before it first; it covers the first item only when the\n // two do not fit side by side.\n pinned = next.length > 0 && widths[0] + this.buttonWidth > available;\n }\n\n const hiddenChanged = !sameIds(next, this.hidden);\n if (!hiddenChanged && pinned === this.pinned) return;\n // The same hidden set keeps its array, so the items and useOverflowMenu() do not update.\n if (hiddenChanged) this.hidden = next.length > 0 ? next : NO_IDS;\n this.pinned = pinned;\n for (const listener of Array.from(this.listeners)) listener();\n }\n}\n\n// ---------------------------------------------------------------------------\n// Context (C-CONTEXT)\n// ---------------------------------------------------------------------------\n\ninterface OverflowContextValue {\n store: OverflowStore;\n hiddenIds: string[];\n hiddenSet: ReadonlySet<string>;\n}\n\nconst OverflowContext = React.createContext<OverflowContextValue | null>(null);\n\n/** Production fallback for a misplaced sub-component: a store that is never connected. */\nconst INERT_CONTEXT: OverflowContextValue = {\n store: /* @__PURE__ */ new OverflowStore(),\n hiddenIds: NO_IDS,\n hiddenSet: /* @__PURE__ */ new Set<string>(),\n};\n\n/**\n * The enclosing Overflow's context. Outside an Overflow it throws in development and, in\n * production, logs an error once and returns an inert value (C-CONTEXT).\n */\nfunction useOverflowContext(componentName: string): OverflowContextValue {\n const ctx = React.useContext(OverflowContext);\n if (ctx) return ctx;\n reportMissingContext(componentName, 'Overflow');\n return INERT_CONTEXT;\n}\n\n// ---------------------------------------------------------------------------\n// Hooks\n// ---------------------------------------------------------------------------\n\n/**\n * The items an {@link Overflow} currently hides: their `itemId`s in DOM order and their count. Use\n * it in the component that `overflowButton` renders to list the hidden items in a menu. Must be\n * called inside `Overflow`.\n */\nexport function useOverflowMenu(): UseOverflowMenuResult {\n const { hiddenIds } = useOverflowContext('useOverflowMenu');\n // A copy per caller and snapshot: sorting or reversing it cannot affect other consumers.\n return React.useMemo(() => ({ hiddenIds: [...hiddenIds], count: hiddenIds.length }), [hiddenIds]);\n}\n\n/**\n * Whether the {@link OverflowItem} with `itemId` is currently shown (`false` while it overflows).\n * Must be called inside `Overflow`.\n */\nexport function useIsOverflowItemVisible(itemId: string): boolean {\n const { hiddenSet } = useOverflowContext('useIsOverflowItemVisible');\n return !hiddenSet.has(itemId);\n}\n\nfunction isElement(node: Node): node is Element {\n return node.nodeType === Node.ELEMENT_NODE;\n}\n\n/**\n * Keeps `observer` on the element children of `parent`: unobserves the removed ones and observes\n * the added ones that are still attached to `parent` (records are replayed in order, so a child\n * moved or re-added within one batch ends up observed exactly when it is present).\n */\nfunction followDirectChildren(\n observer: ResizeObserver,\n parent: Element,\n records: readonly MutationRecord[],\n): void {\n for (const record of records) {\n if (record.type !== 'childList' || record.target !== parent) continue;\n record.removedNodes.forEach((node) => {\n if (isElement(node)) observer.unobserve(node);\n });\n record.addedNodes.forEach((node) => {\n if (isElement(node) && node.parentNode === parent) observer.observe(node);\n });\n }\n}\n\n/** Tracks `scrollWidth > clientWidth` of one element. */\nclass OverflowingStore {\n private element: HTMLElement | null = null;\n private value = false;\n private readonly listeners = new Set<() => void>();\n private teardown: (() => void) | null = null;\n\n subscribe = (listener: () => void): (() => void) => {\n this.listeners.add(listener);\n return () => {\n this.listeners.delete(listener);\n };\n };\n\n getSnapshot = (): boolean => this.value;\n\n getServerSnapshot = (): boolean => false;\n\n /** Follows `element` (layout effect of every render); re-subscribes when it changes. */\n setElement(element: HTMLElement | null): void {\n if (element === this.element) return;\n this.disconnect();\n this.element = element;\n if (element) this.teardown = this.observe(element);\n this.check();\n }\n\n disconnect(): void {\n this.teardown?.();\n this.teardown = null;\n this.element = null;\n }\n\n private observe(element: HTMLElement): () => void {\n const check = () => this.check();\n const cleanups: Array<() => void> = [];\n\n // Resizes of the element and of its direct children (content that grows or shrinks).\n const resizeObserver = hasResizeObserver() ? new ResizeObserver(check) : null;\n if (resizeObserver) {\n resizeObserver.observe(element);\n for (const child of Array.from(element.children)) resizeObserver.observe(child);\n cleanups.push(() => resizeObserver.disconnect());\n } else if (typeof window !== 'undefined') {\n window.addEventListener('resize', check);\n cleanups.push(() => window.removeEventListener('resize', check));\n }\n\n // Content added, removed or edited. Only a change of the direct children changes what the\n // ResizeObserver watches, and only those children are (un)observed; text edits and deeper\n // changes just re-check.\n if (typeof MutationObserver !== 'undefined') {\n const mutationObserver = new MutationObserver((records) => {\n if (resizeObserver) followDirectChildren(resizeObserver, element, records);\n check();\n });\n mutationObserver.observe(element, { childList: true, subtree: true, characterData: true });\n cleanups.push(() => mutationObserver.disconnect());\n }\n\n return () => cleanups.forEach((cleanup) => cleanup());\n }\n\n private check(): void {\n const el = this.element;\n const next = el !== null && el.scrollWidth > el.clientWidth;\n if (next === this.value) return;\n this.value = next;\n for (const listener of Array.from(this.listeners)) listener();\n }\n}\n\nfunction isRefObject(\n target: React.RefObject<HTMLElement | null> | HTMLElement | null | undefined,\n): target is React.RefObject<HTMLElement | null> {\n return target != null && typeof target === 'object' && 'current' in target;\n}\n\n/**\n * Whether `target`'s content is wider than the element (`scrollWidth > clientWidth`).\n *\n * `target` is a ref object or the element itself (for example from callback-ref state:\n * `const [el, setEl] = useState(null)` + `ref={setEl}`). The hook re-checks when the element\n * resizes, when its direct children resize, and when content is added, removed or edited; an\n * element that mounts later (a ref attached conditionally) is picked up after the render that\n * mounts it. Without `ResizeObserver` it re-checks on window `resize` and content changes. Returns\n * `false` on the server.\n */\nexport function useIsOverflowing(\n target: React.RefObject<HTMLElement | null> | HTMLElement | null,\n): boolean {\n const [store] = React.useState(() => new OverflowingStore());\n const isOverflowing = React.useSyncExternalStore(\n store.subscribe,\n store.getSnapshot,\n store.getServerSnapshot,\n );\n const forceRender = useForceRender();\n\n // Every render: follow the element the ref points to now (cheap identity check). A change found\n // here re-renders from the layout phase, before paint: useSyncExternalStore only subscribes in a\n // passive effect, so on mount it would pick the first value up after the browser painted.\n React.useLayoutEffect(() => {\n const unsubscribe = store.subscribe(forceRender);\n store.setElement(isRefObject(target) ? target.current : target);\n unsubscribe();\n });\n\n React.useLayoutEffect(() => () => store.disconnect(), [store]);\n\n return isOverflowing;\n}\n\n// ---------------------------------------------------------------------------\n// Components\n// ---------------------------------------------------------------------------\n\nconst OverflowRoot = ({ overflowButton, children, className, ref, ...rest }: OverflowProps) => {\n const [store] = React.useState(() => new OverflowStore());\n const hiddenIds = React.useSyncExternalStore(\n store.subscribe,\n store.getSnapshot,\n store.getServerSnapshot,\n );\n const pinned = React.useSyncExternalStore(\n store.subscribe,\n store.getPinned,\n store.getServerPinned,\n );\n const setContainer = React.useCallback(\n (node: HTMLDivElement | null) => store.setContainer(node),\n [store],\n );\n const setButton = React.useCallback(\n (node: HTMLDivElement | null) => store.setButton(node),\n [store],\n );\n const containerRef = useMergedRefs<HTMLDivElement>(ref, setContainer);\n const forceRender = useForceRender();\n\n // Observers are created once per instance (not per render or per children change). The first\n // measurement (in connect) re-renders from this layout effect, before paint: useSyncExternalStore\n // only subscribes in a passive effect, which can run after the browser painted every item.\n React.useLayoutEffect(() => {\n const unsubscribe = store.subscribe(forceRender);\n const disconnect = store.connect();\n unsubscribe();\n return disconnect;\n }, [store, forceRender]);\n\n // After every commit of the root (new children, a keyed reorder): items moved without any size\n // change or registration are re-measured before paint. Cheap when nothing moved.\n React.useLayoutEffect(() => {\n store.checkOrder();\n });\n\n const hiddenSet = React.useMemo(() => new Set(hiddenIds), [hiddenIds]);\n // The overflowButton's own copy (consumers may sort it in place).\n const buttonIds = React.useMemo(() => [...hiddenIds], [hiddenIds]);\n const ctx = React.useMemo<OverflowContextValue>(\n () => ({ store, hiddenIds, hiddenSet }),\n [store, hiddenIds, hiddenSet],\n );\n\n const hiddenCount = hiddenIds.length;\n\n return (\n <OverflowContext.Provider value={ctx}>\n <div\n ref={containerRef}\n // The row clips its content at its padding edge: the 4px padding leaves room for the focus\n // indicator a focused item draws 4px around itself. No negative margin offsets it: the\n // row's box would then reach past its container, which a scroll container around an\n // edge-to-edge row (or the page) counts as overflow. The store measures the room without\n // the padding.\n className={cn(overflowClassNames.root, 'flex items-center overflow-hidden p-1', className)}\n {...rest}\n >\n {children}\n {hiddenCount > 0 && overflowButton && (\n // In the row's flow (it adds to the row height and follows justify-*), sticking to the\n // inline end when the first item is wider than the room beside it. Browsers stop a\n // sticky element at the scroll container's padding, so -end-1 lets it reach the\n // clipping edge, and while pinned it keeps 4px inside for its own focus indicator.\n // (WebKit stops a sticky element short of the inline end of a right-to-left row; it\n // stays in the row.)\n <div\n ref={setButton}\n data-overflow-button=\"\"\n data-overflow-pinned={pinned ? '' : undefined}\n className={cn(\n overflowClassNames.overflowButton,\n 'sticky -end-1 flex shrink-0 items-center self-stretch ps-1 data-[overflow-pinned]:bg-background data-[overflow-pinned]:pe-1',\n )}\n >\n {overflowButton(hiddenCount, buttonIds)}\n </div>\n )}\n </div>\n </OverflowContext.Provider>\n );\n};\nOverflowRoot.displayName = 'Overflow';\n\n/**\n * One entry of an {@link Overflow}. While it does not fit it stays mounted but is hidden\n * (`data-overflow-hidden` and an inline `display: none` placed after the consumer's own `style`),\n * `aria-hidden` and `inert`. The inline style wins over the consumer's `style.display` and over\n * display utilities in any cascade layer (a prefixed Tailwind app's `tw:flex` included), so a\n * hidden item is never shown while it is counted in \"+N\". Must be rendered inside `Overflow`.\n */\nexport const OverflowItem = ({\n itemId,\n children,\n className,\n style,\n ref,\n 'aria-hidden': ariaHidden,\n inert,\n ...rest\n}: OverflowItemProps) => {\n const { store, hiddenSet } = useOverflowContext('OverflowItem');\n const isHidden = hiddenSet.has(itemId);\n React.useEffect(() => store.registerItemId(itemId), [store, itemId]);\n\n const registerRef = React.useCallback(\n (node: HTMLDivElement | null) => (node ? store.registerItem(node, itemId) : undefined),\n [store, itemId],\n );\n const mergedRef = useMergedRefs<HTMLDivElement>(ref, registerRef);\n\n return (\n <div\n ref={mergedRef}\n className={cn(overflowItemClassNames.root, 'shrink-0', className)}\n {...rest}\n style={isHidden ? { ...style, display: 'none' } : style}\n aria-hidden={isHidden ? true : ariaHidden}\n inert={isHidden ? true : inert}\n data-overflow-hidden={isHidden ? '' : undefined}\n >\n {children}\n </div>\n );\n};\nOverflowItem.displayName = 'OverflowItem';\n\n/**\n * A single row that hides the items which do not fit and shows an overflow button instead.\n *\n * Wrap each entry in {@link OverflowItem} with a unique `itemId`; the row holds only items (other\n * content is not measured, see `children`). Items are measured while visible, hidden from the end\n * (in DOM order; the first item always stays) and hidden items get `data-overflow-hidden`, an\n * inline `display: none`, `aria-hidden` and `inert`. Reordered items (for example a keyed sort) are\n * re-measured in their new order. `overflowButton(count, hiddenIds)` renders the button after the\n * visible items (its measured width is reserved); components inside it can use\n * {@link useOverflowMenu} to list the hidden items (e.g. in a Menu), and\n * {@link useIsOverflowItemVisible} reports a single item. The button sticks to the inline end of\n * the row, so a first item wider than the room beside it cannot push it out of view: it then covers\n * the end of that item and gets `data-overflow-pinned`, with the `background` token behind it. (In\n * a right-to-left row, WebKit stops the pinned button short of the end, still inside the row.)\n *\n * The row clips what does not fit. So that the focus indicators of its items are not cut off, it\n * has a 4px padding: the items sit 4px in from its edges, and the row is 8px taller than they are.\n * An explicit width (such as `w-full` or a style width) includes that padding. The row never\n * reaches past its own box, so an edge-to-edge row adds no scrollbar to the page or to a scroll\n * container around it. A negative margin of 4px lines the items up with the content around the\n * row; add it only where nothing within 4px of the row scrolls (the row's box then reaches 4px past\n * its container on every side). `p-0` removes the room (focus indicators at the row's edges are\n * then clipped).\n *\n * Works without `ResizeObserver` (jsdom, old browsers): it then re-measures on window resize and\n * when items mount, unmount or move.\n *\n * The item is also `Overflow.Item`. The same component is exported as `OverflowItem`; React Server\n * Components import that flat name (dotted access needs a client file).\n */\nexport const Overflow = /* @__PURE__ */ Object.assign(OverflowRoot, {\n Item: OverflowItem,\n});\n"],"mappings":";;;;;;;;AAuDA,IAAMC,IAAmB,CAAC;AAG1B,SAASC,IAA6B;CACpC,OAAOF,EAAM,YAAY,MAAcG,IAAI,GAAG,CAAC,CAAC,CAAC;AACnD;AAEA,SAASC,IAA6B;CACpC,OAAO,OAAO,iBAAmB;AACnC;AAEA,SAASC,EAAc,GAAY,GAAoB;CAErD,OADIC,MAAMC,IAAU,IACbD,EAAE,wBAAwBC,CAAC,IAAI,KAAK,8BAA8B,KAAK;A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lB,kBAAC,OAAD;IACE,KAAKZ;IACL,wBAAqB;IACrB,wBAAsBxC,IAAS,KAAK,KAAA;IACpC,WAAWgD,EACTC,EAAmB,gBACnB,6HACF;IAEC,UAAAG,EAAeL,GAAaF,CAAS;GACnC,CAAA,CAEJ;;CACmB,CAAA;AAE9B;AACA,EAAa,cAAc;AAS3B,IAAaQ,KAAgB,EAC3B,WACA,aACA,cACA,UACA,QACA,eAAeC,GACf,UACA,GAAGhB,QACoB;CACvB,IAAM,EAAE,UAAO,iBAAc7B,EAAmB,cAAc,GACxD8C,IAAWxC,EAAU,IAAIxC,CAAM;CACrC,EAAM,gBAAgB0D,EAAM,eAAe1D,CAAM,GAAG,CAAC0D,GAAO1D,CAAM,CAAC;CAEnE,IAAMiF,IAAc9F,EAAM,aACvB,MAAiCyB,IAAO8C,EAAM,aAAa9C,GAAMZ,CAAM,IAAI,KAAA,GAC5E,CAAC0D,GAAO1D,CAAM,CAChB,GACMkF,IAAYf,EAA8BC,GAAKa,CAAW;CAEhE,OACE,kBAAC,OAAD;EACE,KAAKC;EACL,WAAWT,EAAGU,EAAuB,MAAM,YAAYR,CAAS;EAChE,GAAIZ;EACJ,OAAOiB,IAAW;GAAE,GAAGzE;GAAO,SAAS;EAAO,IAAIA;EAClD,eAAayE,IAAW,KAAOD;EAC/B,OAAOC,IAAW,KAAOI;EACzB,wBAAsBJ,IAAW,KAAK,KAAA;EAErC;CACE,CAAA;AAET;AACA,EAAa,cAAc;AAgC3B,IAAaK,IAA2B,uBAAO,OAAOvB,GAAc,EAClE,MAAMgB,EACR,CAAC"}
@@ -1,2 +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={none:`gap-0`,xs:`gap-1`,sm:`gap-2`,md:`gap-3`,lg:`gap-4`,xl:`gap-6`},o={start:`items-start`,center:`items-center`,end:`items-end`,stretch:`items-stretch`},s={start:`justify-start`,center:`justify-center`,end:`justify-end`,between:`justify-between`,around:`justify-around`,evenly:`justify-evenly`},c=e=>{let{as:r,orientation:c,direction:l,gap:u=`md`,align:d,justify:f,wrap:p,inline:m,className:h,children:g,ref:_,...v}=e,y=r??`div`,b=n.resolveDeprecatedProp(`Stack`,c,l,`direction`,`orientation`)??`vertical`;return(0,i.jsx)(y,{ref:_,className:t.cn(m?`inline-flex`:`flex`,b===`horizontal`?`flex-row`:`flex-col`,a[u],d&&o[d],f&&s[f],p&&`flex-wrap`,h),...v,children:g})};c.displayName=`Stack`,exports.Stack=c;
1
+ "use client";const e=require("../../_virtual/_rolldown/runtime.cjs"),t=require("../../lib/cn.cjs"),n=require("../../lib/dev.cjs"),r=require("../../lib/classNames.cjs");let i=require("react");i=e.__toESM(i,1);let a=require("react/jsx-runtime");var o={none:`gap-0`,xs:`gap-1`,sm:`gap-2`,md:`gap-3`,lg:`gap-4`,xl:`gap-6`},s={start:`items-start`,center:`items-center`,end:`items-end`,stretch:`items-stretch`},c={start:`justify-start`,center:`justify-center`,end:`justify-end`,between:`justify-between`,around:`justify-around`,evenly:`justify-evenly`},l=e=>{let{as:i,orientation:l,direction:u,gap:d=`md`,align:f,justify:p,wrap:m,inline:h,className:g,children:_,ref:v,...y}=e,b=i??`div`,x=n.resolveDeprecatedProp(`Stack`,l,u,`direction`,`orientation`)??`vertical`;return(0,a.jsx)(b,{ref:v,className:t.cn(r.stackClassNames.root,h?`inline-flex`:`flex`,x===`horizontal`?`flex-row`:`flex-col`,o[d],f&&s[f],p&&c[p],m&&`flex-wrap`,g),...y,children:_})};l.displayName=`Stack`,exports.Stack=l;
2
2
  //# sourceMappingURL=Stack.cjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"Stack.cjs","names":["resolveDeprecatedProp","cn","require_runtime","require_cn","require_dev","react","react_jsx_runtime","gapMap","alignMap","justifyMap","Stack","orientationProp","rest","props","Component","as","orientation","direction","inline","gap","align","justify","wrap","className"],"sources":["../../../src/components/layout/Stack.tsx"],"sourcesContent":["import * as React from 'react';\nimport { cn } from '../../lib/cn';\nimport { resolveDeprecatedProp } from '../../lib/dev';\nimport type { PolymorphicComponent, PolymorphicProps } from '../../lib/polymorphic';\nimport type { Orientation } from '../../lib/types';\n\nconst gapMap = {\n none: 'gap-0',\n xs: 'gap-1',\n sm: 'gap-2',\n md: 'gap-3',\n lg: 'gap-4',\n xl: 'gap-6',\n} as const;\n\nconst alignMap = {\n start: 'items-start',\n center: 'items-center',\n end: 'items-end',\n stretch: 'items-stretch',\n} as const;\n\nconst justifyMap = {\n start: 'justify-start',\n center: 'justify-center',\n end: 'justify-end',\n between: 'justify-between',\n around: 'justify-around',\n evenly: 'justify-evenly',\n} as const;\n\n/**\n * The Stack's own props (the XOwnProps rule of `PolymorphicProps`: component-specific props only).\n * Every other prop comes from the rendered element (`as`).\n */\nexport interface StackOwnProps {\n /**\n * Layout axis of the stack.\n * @default 'vertical'\n */\n orientation?: Orientation;\n /**\n * @deprecated Use `orientation` (same values). Still works, warns once in development, and\n * `orientation` wins when both are given.\n */\n direction?: Orientation;\n /**\n * Gap size between stack items.\n * @default 'md'\n */\n gap?: 'none' | 'xs' | 'sm' | 'md' | 'lg' | 'xl';\n /** Cross-axis alignment of items. */\n align?: 'start' | 'center' | 'end' | 'stretch';\n /** Main-axis justification of items. */\n justify?: 'start' | 'center' | 'end' | 'between' | 'around' | 'evenly';\n /** Whether items should wrap to the next line. */\n wrap?: boolean;\n /** Whether to use inline-flex instead of flex. */\n inline?: boolean;\n}\n\n/**\n * Props of {@link Stack} rendered as `C` (default `'div'`). `StackProps` without a type argument\n * is the 0.4 name: the props of a Stack rendered as a `<div>`, including `ref`.\n */\nexport type StackProps<C extends React.ElementType = 'div'> = PolymorphicProps<C, StackOwnProps>;\n\ntype StackImplProps = StackOwnProps &\n React.HTMLAttributes<HTMLElement> & {\n as?: React.ElementType;\n ref?: React.Ref<HTMLElement>;\n };\n\n/**\n * A one-dimensional layout: items stacked vertically (default) or horizontally with a token gap.\n *\n * @example\n * <Stack orientation=\"horizontal\" gap=\"sm\" align=\"center\">\n * <Avatar name=\"Ada\" />\n * <Text>Ada Lovelace</Text>\n * </Stack>\n */\nexport const Stack: PolymorphicComponent<'div', StackOwnProps> = (props) => {\n const {\n as,\n orientation: orientationProp,\n direction,\n gap = 'md',\n align,\n justify,\n wrap,\n inline,\n className,\n children,\n ref,\n ...rest\n } = props as StackImplProps;\n const Component: React.ElementType = as ?? 'div';\n const orientation =\n resolveDeprecatedProp('Stack', orientationProp, direction, 'direction', 'orientation') ??\n 'vertical';\n\n return (\n <Component\n ref={ref}\n className={cn(\n inline ? 'inline-flex' : 'flex',\n orientation === 'horizontal' ? 'flex-row' : 'flex-col',\n gapMap[gap],\n align && alignMap[align],\n justify && justifyMap[justify],\n wrap && 'flex-wrap',\n className,\n )}\n {...rest}\n >\n {children}\n </Component>\n );\n};\nStack.displayName = 'Stack';\n"],"mappings":"6MAMA,IAAMO,EAAS,CACb,KAAM,QACN,GAAI,QACJ,GAAI,QACJ,GAAI,QACJ,GAAI,QACJ,GAAI,OACN,EAEMC,EAAW,CACf,MAAO,cACP,OAAQ,eACR,IAAK,YACL,QAAS,eACX,EAEMC,EAAa,CACjB,MAAO,gBACP,OAAQ,iBACR,IAAK,cACL,QAAS,kBACT,OAAQ,iBACR,OAAQ,gBACV,EAqDaC,EAAqD,GAAU,CAC1E,GAAM,CACJ,KACA,YAAaC,EACb,YACA,MAAM,KACN,QACA,UACA,OACA,SACA,YACA,WACA,MACA,GAAGC,GACDC,EACEC,EAA+BC,GAAM,MACrCC,EACJhB,EAAAA,sBAAsB,QAASW,EAAiBM,EAAW,YAAa,aAAa,GACrF,WAEF,OACE,EAAAX,EAAA,IAAA,CAACQ,EAAD,CACO,MACL,UAAWb,EAAAA,GACTiB,EAAS,cAAgB,OACzBF,IAAgB,aAAe,WAAa,WAC5CT,EAAOY,GACPC,GAASZ,EAASY,GAClBC,GAAWZ,EAAWY,GACtBC,GAAQ,YACRC,CACF,EACA,GAAIX,EAEH,UACQ,CAAA,CAEf,EACA,EAAM,YAAc"}
1
+ {"version":3,"file":"Stack.cjs","names":["resolveDeprecatedProp","cn","stackClassNames","require_runtime","require_cn","require_dev","require_classNames","react","react_jsx_runtime","gapMap","alignMap","justifyMap","Stack","orientationProp","rest","props","Component","as","orientation","direction","inline","gap","align","justify","wrap","className"],"sources":["../../../src/components/layout/Stack.tsx"],"sourcesContent":["import * as React from 'react';\nimport { stackClassNames } from '../../lib/classNames';\nimport { cn } from '../../lib/cn';\nimport { resolveDeprecatedProp } from '../../lib/dev';\nimport type { PolymorphicComponent, PolymorphicProps } from '../../lib/polymorphic';\nimport type { Orientation } from '../../lib/types';\n\nconst gapMap = {\n none: 'gap-0',\n xs: 'gap-1',\n sm: 'gap-2',\n md: 'gap-3',\n lg: 'gap-4',\n xl: 'gap-6',\n} as const;\n\nconst alignMap = {\n start: 'items-start',\n center: 'items-center',\n end: 'items-end',\n stretch: 'items-stretch',\n} as const;\n\nconst justifyMap = {\n start: 'justify-start',\n center: 'justify-center',\n end: 'justify-end',\n between: 'justify-between',\n around: 'justify-around',\n evenly: 'justify-evenly',\n} as const;\n\n/**\n * The Stack's own props (the XOwnProps rule of `PolymorphicProps`: component-specific props only).\n * Every other prop comes from the rendered element (`as`).\n */\nexport interface StackOwnProps {\n /**\n * Layout axis of the stack.\n * @default 'vertical'\n */\n orientation?: Orientation;\n /**\n * @deprecated Use `orientation` (same values). Still works, warns once in development, and\n * `orientation` wins when both are given.\n */\n direction?: Orientation;\n /**\n * Gap size between stack items.\n * @default 'md'\n */\n gap?: 'none' | 'xs' | 'sm' | 'md' | 'lg' | 'xl';\n /** Cross-axis alignment of items. */\n align?: 'start' | 'center' | 'end' | 'stretch';\n /** Main-axis justification of items. */\n justify?: 'start' | 'center' | 'end' | 'between' | 'around' | 'evenly';\n /** Whether items should wrap to the next line. */\n wrap?: boolean;\n /** Whether to use inline-flex instead of flex. */\n inline?: boolean;\n}\n\n/**\n * Props of {@link Stack} rendered as `C` (default `'div'`). `StackProps` without a type argument\n * is the 0.4 name: the props of a Stack rendered as a `<div>`, including `ref`.\n */\nexport type StackProps<C extends React.ElementType = 'div'> = PolymorphicProps<C, StackOwnProps>;\n\ntype StackImplProps = StackOwnProps &\n React.HTMLAttributes<HTMLElement> & {\n as?: React.ElementType;\n ref?: React.Ref<HTMLElement>;\n };\n\n/**\n * A one-dimensional layout: items stacked vertically (default) or horizontally with a token gap.\n *\n * @example\n * <Stack orientation=\"horizontal\" gap=\"sm\" align=\"center\">\n * <Avatar name=\"Ada\" />\n * <Text>Ada Lovelace</Text>\n * </Stack>\n */\nexport const Stack: PolymorphicComponent<'div', StackOwnProps> = (props) => {\n const {\n as,\n orientation: orientationProp,\n direction,\n gap = 'md',\n align,\n justify,\n wrap,\n inline,\n className,\n children,\n ref,\n ...rest\n } = props as StackImplProps;\n const Component: React.ElementType = as ?? 'div';\n const orientation =\n resolveDeprecatedProp('Stack', orientationProp, direction, 'direction', 'orientation') ??\n 'vertical';\n\n return (\n <Component\n ref={ref}\n className={cn(\n stackClassNames.root,\n inline ? 'inline-flex' : 'flex',\n orientation === 'horizontal' ? 'flex-row' : 'flex-col',\n gapMap[gap],\n align && alignMap[align],\n justify && justifyMap[justify],\n wrap && 'flex-wrap',\n className,\n )}\n {...rest}\n >\n {children}\n </Component>\n );\n};\nStack.displayName = 'Stack';\n"],"mappings":"mPAOA,IAAMS,EAAS,CACb,KAAM,QACN,GAAI,QACJ,GAAI,QACJ,GAAI,QACJ,GAAI,QACJ,GAAI,OACN,EAEMC,EAAW,CACf,MAAO,cACP,OAAQ,eACR,IAAK,YACL,QAAS,eACX,EAEMC,EAAa,CACjB,MAAO,gBACP,OAAQ,iBACR,IAAK,cACL,QAAS,kBACT,OAAQ,iBACR,OAAQ,gBACV,EAqDaC,EAAqD,GAAU,CAC1E,GAAM,CACJ,KACA,YAAaC,EACb,YACA,MAAM,KACN,QACA,UACA,OACA,SACA,YACA,WACA,MACA,GAAGC,GACDC,EACEC,EAA+BC,GAAM,MACrCC,EACJlB,EAAAA,sBAAsB,QAASa,EAAiBM,EAAW,YAAa,aAAa,GACrF,WAEF,OACE,EAAAX,EAAA,IAAA,CAACQ,EAAD,CACO,MACL,UAAWf,EAAAA,GACTC,EAAAA,gBAAgB,KAChBkB,EAAS,cAAgB,OACzBF,IAAgB,aAAe,WAAa,WAC5CT,EAAOY,GACPC,GAASZ,EAASY,GAClBC,GAAWZ,EAAWY,GACtBC,GAAQ,YACRC,CACF,EACA,GAAIX,EAEH,UACQ,CAAA,CAEf,EACA,EAAM,YAAc"}
@@ -1,39 +1,40 @@
1
1
  "use client";
2
2
  import { cn as e } from "../../lib/cn.mjs";
3
3
  import { resolveDeprecatedProp as t } from "../../lib/dev.mjs";
4
+ import { stackClassNames as n } from "../../lib/classNames.mjs";
4
5
  import "react";
5
- import { jsx as n } from "react/jsx-runtime";
6
+ import { jsx as r } from "react/jsx-runtime";
6
7
  //#region src/components/layout/Stack.tsx
7
- var r = {
8
+ var i = {
8
9
  none: "gap-0",
9
10
  xs: "gap-1",
10
11
  sm: "gap-2",
11
12
  md: "gap-3",
12
13
  lg: "gap-4",
13
14
  xl: "gap-6"
14
- }, i = {
15
+ }, a = {
15
16
  start: "items-start",
16
17
  center: "items-center",
17
18
  end: "items-end",
18
19
  stretch: "items-stretch"
19
- }, a = {
20
+ }, o = {
20
21
  start: "justify-start",
21
22
  center: "justify-center",
22
23
  end: "justify-end",
23
24
  between: "justify-between",
24
25
  around: "justify-around",
25
26
  evenly: "justify-evenly"
26
- }, o = (o) => {
27
- let { as: s, orientation: c, direction: l, gap: u = "md", align: d, justify: f, wrap: p, inline: m, className: h, children: g, ref: _, ...v } = o, y = s ?? "div", b = t("Stack", c, l, "direction", "orientation") ?? "vertical";
28
- return /* @__PURE__ */ n(y, {
29
- ref: _,
30
- className: e(m ? "inline-flex" : "flex", b === "horizontal" ? "flex-row" : "flex-col", r[u], d && i[d], f && a[f], p && "flex-wrap", h),
31
- ...v,
32
- children: g
27
+ }, s = (s) => {
28
+ let { as: c, orientation: l, direction: u, gap: d = "md", align: f, justify: p, wrap: m, inline: h, className: g, children: _, ref: v, ...y } = s, b = c ?? "div", x = t("Stack", l, u, "direction", "orientation") ?? "vertical";
29
+ return /* @__PURE__ */ r(b, {
30
+ ref: v,
31
+ className: e(n.root, h ? "inline-flex" : "flex", x === "horizontal" ? "flex-row" : "flex-col", i[d], f && a[f], p && o[p], m && "flex-wrap", g),
32
+ ...y,
33
+ children: _
33
34
  });
34
35
  };
35
- o.displayName = "Stack";
36
+ s.displayName = "Stack";
36
37
  //#endregion
37
- export { o as Stack };
38
+ export { s as Stack };
38
39
 
39
40
  //# sourceMappingURL=Stack.mjs.map