@mortenbrudvik/waveui 0.7.0 → 0.8.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (408) hide show
  1. package/README.md +395 -132
  2. package/dist/components/button/Button.cjs +1 -1
  3. package/dist/components/button/Button.cjs.map +1 -1
  4. package/dist/components/button/Button.mjs +36 -35
  5. package/dist/components/button/Button.mjs.map +1 -1
  6. package/dist/components/button/Button.slots.cjs +1 -1
  7. package/dist/components/button/Button.slots.cjs.map +1 -1
  8. package/dist/components/button/Button.slots.mjs +31 -21
  9. package/dist/components/button/Button.slots.mjs.map +1 -1
  10. package/dist/components/button/CompoundButton.cjs +1 -1
  11. package/dist/components/button/CompoundButton.cjs.map +1 -1
  12. package/dist/components/button/CompoundButton.mjs +31 -29
  13. package/dist/components/button/CompoundButton.mjs.map +1 -1
  14. package/dist/components/button/Link.cjs +1 -1
  15. package/dist/components/button/Link.cjs.map +1 -1
  16. package/dist/components/button/Link.mjs +24 -23
  17. package/dist/components/button/Link.mjs.map +1 -1
  18. package/dist/components/button/MenuButton.cjs +1 -1
  19. package/dist/components/button/MenuButton.cjs.map +1 -1
  20. package/dist/components/button/MenuButton.mjs +29 -28
  21. package/dist/components/button/MenuButton.mjs.map +1 -1
  22. package/dist/components/button/SplitButton.cjs +1 -1
  23. package/dist/components/button/SplitButton.cjs.map +1 -1
  24. package/dist/components/button/SplitButton.mjs +46 -45
  25. package/dist/components/button/SplitButton.mjs.map +1 -1
  26. package/dist/components/button/ToggleButton.cjs +1 -1
  27. package/dist/components/button/ToggleButton.cjs.map +1 -1
  28. package/dist/components/button/ToggleButton.mjs +38 -35
  29. package/dist/components/button/ToggleButton.mjs.map +1 -1
  30. package/dist/components/button/Toolbar.cjs +1 -1
  31. package/dist/components/button/Toolbar.cjs.map +1 -1
  32. package/dist/components/button/Toolbar.mjs +43 -42
  33. package/dist/components/button/Toolbar.mjs.map +1 -1
  34. package/dist/components/button/Toolbar.parts.cjs +1 -1
  35. package/dist/components/button/Toolbar.parts.cjs.map +1 -1
  36. package/dist/components/button/Toolbar.parts.mjs +76 -81
  37. package/dist/components/button/Toolbar.parts.mjs.map +1 -1
  38. package/dist/components/data-display/Avatar.cjs +1 -1
  39. package/dist/components/data-display/Avatar.cjs.map +1 -1
  40. package/dist/components/data-display/Avatar.mjs +72 -67
  41. package/dist/components/data-display/Avatar.mjs.map +1 -1
  42. package/dist/components/data-display/AvatarGroup.cjs +1 -1
  43. package/dist/components/data-display/AvatarGroup.cjs.map +1 -1
  44. package/dist/components/data-display/AvatarGroup.mjs +89 -88
  45. package/dist/components/data-display/AvatarGroup.mjs.map +1 -1
  46. package/dist/components/data-display/Badge.cjs +1 -1
  47. package/dist/components/data-display/Badge.cjs.map +1 -1
  48. package/dist/components/data-display/Badge.mjs +17 -16
  49. package/dist/components/data-display/Badge.mjs.map +1 -1
  50. package/dist/components/data-display/CounterBadge.cjs +1 -1
  51. package/dist/components/data-display/CounterBadge.cjs.map +1 -1
  52. package/dist/components/data-display/CounterBadge.mjs +18 -17
  53. package/dist/components/data-display/CounterBadge.mjs.map +1 -1
  54. package/dist/components/data-display/Divider.cjs +1 -1
  55. package/dist/components/data-display/Divider.cjs.map +1 -1
  56. package/dist/components/data-display/Divider.mjs +31 -30
  57. package/dist/components/data-display/Divider.mjs.map +1 -1
  58. package/dist/components/data-display/Image.cjs +1 -1
  59. package/dist/components/data-display/Image.cjs.map +1 -1
  60. package/dist/components/data-display/Image.mjs +16 -15
  61. package/dist/components/data-display/Image.mjs.map +1 -1
  62. package/dist/components/data-display/InfoLabel.cjs +1 -1
  63. package/dist/components/data-display/InfoLabel.cjs.map +1 -1
  64. package/dist/components/data-display/InfoLabel.mjs +74 -73
  65. package/dist/components/data-display/InfoLabel.mjs.map +1 -1
  66. package/dist/components/data-display/List.cjs +1 -1
  67. package/dist/components/data-display/List.cjs.map +1 -1
  68. package/dist/components/data-display/List.mjs +175 -174
  69. package/dist/components/data-display/List.mjs.map +1 -1
  70. package/dist/components/data-display/Persona.cjs +1 -1
  71. package/dist/components/data-display/Persona.cjs.map +1 -1
  72. package/dist/components/data-display/Persona.mjs +31 -29
  73. package/dist/components/data-display/Persona.mjs.map +1 -1
  74. package/dist/components/data-display/PresenceBadge.cjs +1 -1
  75. package/dist/components/data-display/PresenceBadge.cjs.map +1 -1
  76. package/dist/components/data-display/PresenceBadge.mjs +25 -24
  77. package/dist/components/data-display/PresenceBadge.mjs.map +1 -1
  78. package/dist/components/data-display/Tag.cjs +1 -1
  79. package/dist/components/data-display/Tag.cjs.map +1 -1
  80. package/dist/components/data-display/Tag.mjs +87 -82
  81. package/dist/components/data-display/Tag.mjs.map +1 -1
  82. package/dist/components/feedback/MessageBar.cjs +1 -1
  83. package/dist/components/feedback/MessageBar.cjs.map +1 -1
  84. package/dist/components/feedback/MessageBar.mjs +129 -71
  85. package/dist/components/feedback/MessageBar.mjs.map +1 -1
  86. package/dist/components/feedback/MessageBar.parts.cjs +2 -0
  87. package/dist/components/feedback/MessageBar.parts.cjs.map +1 -0
  88. package/dist/components/feedback/MessageBar.parts.mjs +84 -0
  89. package/dist/components/feedback/MessageBar.parts.mjs.map +1 -0
  90. package/dist/components/feedback/MessageBar.reflow.cjs +2 -0
  91. package/dist/components/feedback/MessageBar.reflow.cjs.map +1 -0
  92. package/dist/components/feedback/MessageBar.reflow.mjs +74 -0
  93. package/dist/components/feedback/MessageBar.reflow.mjs.map +1 -0
  94. package/dist/components/feedback/MessageBar.status.cjs +1 -1
  95. package/dist/components/feedback/MessageBar.status.cjs.map +1 -1
  96. package/dist/components/feedback/MessageBar.status.mjs +2 -1
  97. package/dist/components/feedback/MessageBar.status.mjs.map +1 -1
  98. package/dist/components/feedback/ProgressBar.cjs +1 -1
  99. package/dist/components/feedback/ProgressBar.cjs.map +1 -1
  100. package/dist/components/feedback/ProgressBar.mjs +44 -43
  101. package/dist/components/feedback/ProgressBar.mjs.map +1 -1
  102. package/dist/components/feedback/Skeleton.cjs +1 -1
  103. package/dist/components/feedback/Skeleton.cjs.map +1 -1
  104. package/dist/components/feedback/Skeleton.mjs +26 -24
  105. package/dist/components/feedback/Skeleton.mjs.map +1 -1
  106. package/dist/components/feedback/Spinner.cjs +1 -1
  107. package/dist/components/feedback/Spinner.cjs.map +1 -1
  108. package/dist/components/feedback/Spinner.mjs +32 -31
  109. package/dist/components/feedback/Spinner.mjs.map +1 -1
  110. package/dist/components/feedback/Toast.cjs +1 -1
  111. package/dist/components/feedback/Toast.cjs.map +1 -1
  112. package/dist/components/feedback/Toast.context.cjs +2 -0
  113. package/dist/components/feedback/Toast.context.cjs.map +1 -0
  114. package/dist/components/feedback/Toast.context.mjs +23 -0
  115. package/dist/components/feedback/Toast.context.mjs.map +1 -0
  116. package/dist/components/feedback/Toast.mjs +10 -342
  117. package/dist/components/feedback/Toast.mjs.map +1 -1
  118. package/dist/components/feedback/Toast.parts.cjs +2 -0
  119. package/dist/components/feedback/Toast.parts.cjs.map +1 -0
  120. package/dist/components/feedback/Toast.parts.mjs +98 -0
  121. package/dist/components/feedback/Toast.parts.mjs.map +1 -0
  122. package/dist/components/feedback/Toast.root.cjs +2 -0
  123. package/dist/components/feedback/Toast.root.cjs.map +1 -0
  124. package/dist/components/feedback/Toast.root.mjs +109 -0
  125. package/dist/components/feedback/Toast.root.mjs.map +1 -0
  126. package/dist/components/feedback/Toaster.cjs +2 -0
  127. package/dist/components/feedback/Toaster.cjs.map +1 -0
  128. package/dist/components/feedback/Toaster.mjs +564 -0
  129. package/dist/components/feedback/Toaster.mjs.map +1 -0
  130. package/dist/components/input/AlphaSlider.cjs +2 -0
  131. package/dist/components/input/AlphaSlider.cjs.map +1 -0
  132. package/dist/components/input/AlphaSlider.mjs +115 -0
  133. package/dist/components/input/AlphaSlider.mjs.map +1 -0
  134. package/dist/components/input/Checkbox.cjs +1 -1
  135. package/dist/components/input/Checkbox.cjs.map +1 -1
  136. package/dist/components/input/Checkbox.mjs +47 -46
  137. package/dist/components/input/Checkbox.mjs.map +1 -1
  138. package/dist/components/input/ColorArea.cjs +2 -0
  139. package/dist/components/input/ColorArea.cjs.map +1 -0
  140. package/dist/components/input/ColorArea.mjs +204 -0
  141. package/dist/components/input/ColorArea.mjs.map +1 -0
  142. package/dist/components/input/ColorPicker.cjs +5 -5
  143. package/dist/components/input/ColorPicker.cjs.map +1 -1
  144. package/dist/components/input/ColorPicker.mjs +142 -165
  145. package/dist/components/input/ColorPicker.mjs.map +1 -1
  146. package/dist/components/input/ColorPicker.parts.cjs +2 -0
  147. package/dist/components/input/ColorPicker.parts.cjs.map +1 -0
  148. package/dist/components/input/ColorPicker.parts.mjs +192 -0
  149. package/dist/components/input/ColorPicker.parts.mjs.map +1 -0
  150. package/dist/components/input/ColorSlider.cjs +2 -0
  151. package/dist/components/input/ColorSlider.cjs.map +1 -0
  152. package/dist/components/input/ColorSlider.mjs +138 -0
  153. package/dist/components/input/ColorSlider.mjs.map +1 -0
  154. package/dist/components/input/Combobox.cjs +1 -1
  155. package/dist/components/input/Combobox.cjs.map +1 -1
  156. package/dist/components/input/Combobox.expand.cjs +1 -1
  157. package/dist/components/input/Combobox.expand.cjs.map +1 -1
  158. package/dist/components/input/Combobox.expand.mjs +9 -9
  159. package/dist/components/input/Combobox.expand.mjs.map +1 -1
  160. package/dist/components/input/Combobox.mjs +90 -85
  161. package/dist/components/input/Combobox.mjs.map +1 -1
  162. package/dist/components/input/DatePicker.cjs +1 -1
  163. package/dist/components/input/DatePicker.cjs.map +1 -1
  164. package/dist/components/input/DatePicker.mjs +186 -185
  165. package/dist/components/input/DatePicker.mjs.map +1 -1
  166. package/dist/components/input/Dropdown.cjs +1 -1
  167. package/dist/components/input/Dropdown.cjs.map +1 -1
  168. package/dist/components/input/Dropdown.mjs +71 -68
  169. package/dist/components/input/Dropdown.mjs.map +1 -1
  170. package/dist/components/input/Field.cjs +1 -1
  171. package/dist/components/input/Field.cjs.map +1 -1
  172. package/dist/components/input/Field.mjs +113 -112
  173. package/dist/components/input/Field.mjs.map +1 -1
  174. package/dist/components/input/Input.cjs +1 -1
  175. package/dist/components/input/Input.cjs.map +1 -1
  176. package/dist/components/input/Input.mjs +55 -54
  177. package/dist/components/input/Input.mjs.map +1 -1
  178. package/dist/components/input/Label.cjs +1 -1
  179. package/dist/components/input/Label.cjs.map +1 -1
  180. package/dist/components/input/Label.mjs +12 -11
  181. package/dist/components/input/Label.mjs.map +1 -1
  182. package/dist/components/input/Option.cjs +1 -1
  183. package/dist/components/input/Option.cjs.map +1 -1
  184. package/dist/components/input/Option.mjs +100 -98
  185. package/dist/components/input/Option.mjs.map +1 -1
  186. package/dist/components/input/RadioGroup.cjs +1 -1
  187. package/dist/components/input/RadioGroup.cjs.map +1 -1
  188. package/dist/components/input/RadioGroup.mjs +89 -88
  189. package/dist/components/input/RadioGroup.mjs.map +1 -1
  190. package/dist/components/input/Rating.cjs +1 -1
  191. package/dist/components/input/Rating.cjs.map +1 -1
  192. package/dist/components/input/Rating.mjs +110 -109
  193. package/dist/components/input/Rating.mjs.map +1 -1
  194. package/dist/components/input/SearchBox.cjs +1 -1
  195. package/dist/components/input/SearchBox.cjs.map +1 -1
  196. package/dist/components/input/SearchBox.mjs +118 -119
  197. package/dist/components/input/SearchBox.mjs.map +1 -1
  198. package/dist/components/input/Select.cjs +1 -1
  199. package/dist/components/input/Select.cjs.map +1 -1
  200. package/dist/components/input/Select.mjs +25 -24
  201. package/dist/components/input/Select.mjs.map +1 -1
  202. package/dist/components/input/Slider.cjs +1 -1
  203. package/dist/components/input/Slider.cjs.map +1 -1
  204. package/dist/components/input/Slider.mjs +47 -46
  205. package/dist/components/input/Slider.mjs.map +1 -1
  206. package/dist/components/input/SpinButton.cjs +1 -1
  207. package/dist/components/input/SpinButton.cjs.map +1 -1
  208. package/dist/components/input/SpinButton.mjs +76 -75
  209. package/dist/components/input/SpinButton.mjs.map +1 -1
  210. package/dist/components/input/SwatchPicker.cjs +1 -1
  211. package/dist/components/input/SwatchPicker.cjs.map +1 -1
  212. package/dist/components/input/SwatchPicker.mjs +38 -37
  213. package/dist/components/input/SwatchPicker.mjs.map +1 -1
  214. package/dist/components/input/Switch.cjs +1 -1
  215. package/dist/components/input/Switch.cjs.map +1 -1
  216. package/dist/components/input/Switch.mjs +65 -64
  217. package/dist/components/input/Switch.mjs.map +1 -1
  218. package/dist/components/input/TagPicker.cjs +1 -1
  219. package/dist/components/input/TagPicker.cjs.map +1 -1
  220. package/dist/components/input/TagPicker.mjs +161 -157
  221. package/dist/components/input/TagPicker.mjs.map +1 -1
  222. package/dist/components/input/Textarea.cjs +1 -1
  223. package/dist/components/input/Textarea.cjs.map +1 -1
  224. package/dist/components/input/Textarea.mjs +24 -23
  225. package/dist/components/input/Textarea.mjs.map +1 -1
  226. package/dist/components/input/TimePicker.cjs +1 -1
  227. package/dist/components/input/TimePicker.cjs.map +1 -1
  228. package/dist/components/input/TimePicker.mjs +202 -199
  229. package/dist/components/input/TimePicker.mjs.map +1 -1
  230. package/dist/components/input/colorName.cjs +2 -0
  231. package/dist/components/input/colorName.cjs.map +1 -0
  232. package/dist/components/input/colorName.mjs +30 -0
  233. package/dist/components/input/colorName.mjs.map +1 -0
  234. package/dist/components/input/colorUtils.cjs +1 -1
  235. package/dist/components/input/colorUtils.cjs.map +1 -1
  236. package/dist/components/input/colorUtils.mjs +154 -56
  237. package/dist/components/input/colorUtils.mjs.map +1 -1
  238. package/dist/components/layout/Accordion.cjs +1 -1
  239. package/dist/components/layout/Accordion.cjs.map +1 -1
  240. package/dist/components/layout/Accordion.mjs +130 -129
  241. package/dist/components/layout/Accordion.mjs.map +1 -1
  242. package/dist/components/layout/Card.cjs +1 -1
  243. package/dist/components/layout/Card.cjs.map +1 -1
  244. package/dist/components/layout/Card.mjs +78 -77
  245. package/dist/components/layout/Card.mjs.map +1 -1
  246. package/dist/components/layout/Carousel.cjs +1 -1
  247. package/dist/components/layout/Carousel.cjs.map +1 -1
  248. package/dist/components/layout/Carousel.mjs +111 -110
  249. package/dist/components/layout/Carousel.mjs.map +1 -1
  250. package/dist/components/layout/Flex.cjs +1 -1
  251. package/dist/components/layout/Flex.cjs.map +1 -1
  252. package/dist/components/layout/Flex.mjs +22 -21
  253. package/dist/components/layout/Flex.mjs.map +1 -1
  254. package/dist/components/layout/Grid.cjs +1 -1
  255. package/dist/components/layout/Grid.cjs.map +1 -1
  256. package/dist/components/layout/Grid.mjs +19 -18
  257. package/dist/components/layout/Grid.mjs.map +1 -1
  258. package/dist/components/layout/Overflow.cjs +1 -1
  259. package/dist/components/layout/Overflow.cjs.map +1 -1
  260. package/dist/components/layout/Overflow.mjs +92 -91
  261. package/dist/components/layout/Overflow.mjs.map +1 -1
  262. package/dist/components/layout/Stack.cjs +1 -1
  263. package/dist/components/layout/Stack.cjs.map +1 -1
  264. package/dist/components/layout/Stack.mjs +14 -13
  265. package/dist/components/layout/Stack.mjs.map +1 -1
  266. package/dist/components/layout/TabList.cjs +1 -1
  267. package/dist/components/layout/TabList.cjs.map +1 -1
  268. package/dist/components/layout/TabList.mjs +118 -117
  269. package/dist/components/layout/TabList.mjs.map +1 -1
  270. package/dist/components/layout/Tree.cjs +1 -1
  271. package/dist/components/layout/Tree.cjs.map +1 -1
  272. package/dist/components/layout/Tree.context.cjs +2 -0
  273. package/dist/components/layout/Tree.context.cjs.map +1 -0
  274. package/dist/components/layout/Tree.context.mjs +33 -0
  275. package/dist/components/layout/Tree.context.mjs.map +1 -0
  276. package/dist/components/layout/Tree.core.cjs +2 -0
  277. package/dist/components/layout/Tree.core.cjs.map +1 -0
  278. package/dist/components/layout/Tree.core.mjs +416 -0
  279. package/dist/components/layout/Tree.core.mjs.map +1 -0
  280. package/dist/components/layout/Tree.itemPersonaLayout.cjs +2 -0
  281. package/dist/components/layout/Tree.itemPersonaLayout.cjs.map +1 -0
  282. package/dist/components/layout/Tree.itemPersonaLayout.mjs +46 -0
  283. package/dist/components/layout/Tree.itemPersonaLayout.mjs.map +1 -0
  284. package/dist/components/layout/Tree.mjs +7 -215
  285. package/dist/components/layout/Tree.mjs.map +1 -1
  286. package/dist/components/layout/Tree.selection.cjs +2 -0
  287. package/dist/components/layout/Tree.selection.cjs.map +1 -0
  288. package/dist/components/layout/Tree.selection.mjs +73 -0
  289. package/dist/components/layout/Tree.selection.mjs.map +1 -0
  290. package/dist/components/navigation/Breadcrumb.cjs +1 -1
  291. package/dist/components/navigation/Breadcrumb.cjs.map +1 -1
  292. package/dist/components/navigation/Breadcrumb.mjs +76 -75
  293. package/dist/components/navigation/Breadcrumb.mjs.map +1 -1
  294. package/dist/components/navigation/Menu.group.cjs +1 -1
  295. package/dist/components/navigation/Menu.group.cjs.map +1 -1
  296. package/dist/components/navigation/Menu.group.mjs +39 -37
  297. package/dist/components/navigation/Menu.group.mjs.map +1 -1
  298. package/dist/components/navigation/Menu.items.cjs +1 -1
  299. package/dist/components/navigation/Menu.items.cjs.map +1 -1
  300. package/dist/components/navigation/Menu.items.mjs +67 -61
  301. package/dist/components/navigation/Menu.items.mjs.map +1 -1
  302. package/dist/components/navigation/Menu.link.cjs +1 -1
  303. package/dist/components/navigation/Menu.link.cjs.map +1 -1
  304. package/dist/components/navigation/Menu.link.mjs +34 -28
  305. package/dist/components/navigation/Menu.link.mjs.map +1 -1
  306. package/dist/components/navigation/Menu.popover.cjs +1 -1
  307. package/dist/components/navigation/Menu.popover.cjs.map +1 -1
  308. package/dist/components/navigation/Menu.popover.mjs +110 -109
  309. package/dist/components/navigation/Menu.popover.mjs.map +1 -1
  310. package/dist/components/navigation/Menu.root.cjs +1 -1
  311. package/dist/components/navigation/Menu.root.cjs.map +1 -1
  312. package/dist/components/navigation/Menu.root.mjs +171 -170
  313. package/dist/components/navigation/Menu.root.mjs.map +1 -1
  314. package/dist/components/navigation/Menu.selectable.cjs +1 -1
  315. package/dist/components/navigation/Menu.selectable.cjs.map +1 -1
  316. package/dist/components/navigation/Menu.selectable.mjs +85 -63
  317. package/dist/components/navigation/Menu.selectable.mjs.map +1 -1
  318. package/dist/components/navigation/Menu.splitGroup.cjs +1 -1
  319. package/dist/components/navigation/Menu.splitGroup.cjs.map +1 -1
  320. package/dist/components/navigation/Menu.splitGroup.mjs +27 -26
  321. package/dist/components/navigation/Menu.splitGroup.mjs.map +1 -1
  322. package/dist/components/navigation/Menu.trigger.cjs +1 -1
  323. package/dist/components/navigation/Menu.trigger.cjs.map +1 -1
  324. package/dist/components/navigation/Menu.trigger.mjs +6 -6
  325. package/dist/components/navigation/Nav.cjs +1 -1
  326. package/dist/components/navigation/Nav.cjs.map +1 -1
  327. package/dist/components/navigation/Nav.mjs +170 -155
  328. package/dist/components/navigation/Nav.mjs.map +1 -1
  329. package/dist/components/navigation/Pagination.cjs +1 -1
  330. package/dist/components/navigation/Pagination.cjs.map +1 -1
  331. package/dist/components/navigation/Pagination.mjs +73 -65
  332. package/dist/components/navigation/Pagination.mjs.map +1 -1
  333. package/dist/components/navigation/Stepper.cjs +1 -1
  334. package/dist/components/navigation/Stepper.cjs.map +1 -1
  335. package/dist/components/navigation/Stepper.mjs +110 -109
  336. package/dist/components/navigation/Stepper.mjs.map +1 -1
  337. package/dist/components/overlays/Dialog.cjs +1 -1
  338. package/dist/components/overlays/Dialog.cjs.map +1 -1
  339. package/dist/components/overlays/Dialog.mjs +109 -108
  340. package/dist/components/overlays/Dialog.mjs.map +1 -1
  341. package/dist/components/overlays/Drawer.cjs +1 -1
  342. package/dist/components/overlays/Drawer.cjs.map +1 -1
  343. package/dist/components/overlays/Drawer.mjs +110 -109
  344. package/dist/components/overlays/Drawer.mjs.map +1 -1
  345. package/dist/components/overlays/Popover.cjs +1 -1
  346. package/dist/components/overlays/Popover.cjs.map +1 -1
  347. package/dist/components/overlays/Popover.mjs +229 -227
  348. package/dist/components/overlays/Popover.mjs.map +1 -1
  349. package/dist/components/overlays/TeachingPopover.cjs +1 -1
  350. package/dist/components/overlays/TeachingPopover.cjs.map +1 -1
  351. package/dist/components/overlays/TeachingPopover.mjs +41 -37
  352. package/dist/components/overlays/TeachingPopover.mjs.map +1 -1
  353. package/dist/components/overlays/Tooltip.cjs +1 -1
  354. package/dist/components/overlays/Tooltip.cjs.map +1 -1
  355. package/dist/components/overlays/Tooltip.mjs +87 -86
  356. package/dist/components/overlays/Tooltip.mjs.map +1 -1
  357. package/dist/components/portal/Portal.cjs +1 -1
  358. package/dist/components/portal/Portal.cjs.map +1 -1
  359. package/dist/components/portal/Portal.mjs +33 -32
  360. package/dist/components/portal/Portal.mjs.map +1 -1
  361. package/dist/components/provider/WaveProvider.cjs +1 -1
  362. package/dist/components/provider/WaveProvider.cjs.map +1 -1
  363. package/dist/components/provider/WaveProvider.mjs +31 -30
  364. package/dist/components/provider/WaveProvider.mjs.map +1 -1
  365. package/dist/components/table/DataGrid.cjs +1 -1
  366. package/dist/components/table/DataGrid.cjs.map +1 -1
  367. package/dist/components/table/DataGrid.mjs +228 -227
  368. package/dist/components/table/DataGrid.mjs.map +1 -1
  369. package/dist/components/table/Table.cjs +1 -1
  370. package/dist/components/table/Table.cjs.map +1 -1
  371. package/dist/components/table/Table.mjs +60 -59
  372. package/dist/components/table/Table.mjs.map +1 -1
  373. package/dist/components/typography/Text.cjs +1 -1
  374. package/dist/components/typography/Text.cjs.map +1 -1
  375. package/dist/components/typography/Text.mjs +12 -11
  376. package/dist/components/typography/Text.mjs.map +1 -1
  377. package/dist/hooks/useMediaQuery.cjs +2 -0
  378. package/dist/hooks/useMediaQuery.cjs.map +1 -0
  379. package/dist/hooks/useMediaQuery.mjs +20 -0
  380. package/dist/hooks/useMediaQuery.mjs.map +1 -0
  381. package/dist/hooks/usePrefersReducedMotion.cjs +1 -1
  382. package/dist/hooks/usePrefersReducedMotion.cjs.map +1 -1
  383. package/dist/hooks/usePrefersReducedMotion.mjs +4 -18
  384. package/dist/hooks/usePrefersReducedMotion.mjs.map +1 -1
  385. package/dist/hooks/useRovingTabIndex.cjs +1 -1
  386. package/dist/hooks/useRovingTabIndex.cjs.map +1 -1
  387. package/dist/hooks/useRovingTabIndex.mjs +3 -3
  388. package/dist/hooks/useRovingTabIndex.mjs.map +1 -1
  389. package/dist/index.cjs +1 -1
  390. package/dist/index.d.cts +2089 -102
  391. package/dist/index.d.ts +2089 -102
  392. package/dist/index.mjs +99 -87
  393. package/dist/lib/classNames.cjs +2 -0
  394. package/dist/lib/classNames.cjs.map +1 -0
  395. package/dist/lib/classNames.mjs +415 -0
  396. package/dist/lib/classNames.mjs.map +1 -0
  397. package/dist/lib/color.cjs +2 -0
  398. package/dist/lib/color.cjs.map +1 -0
  399. package/dist/lib/color.mjs +86 -0
  400. package/dist/lib/color.mjs.map +1 -0
  401. package/dist/lib/globalRegistry.cjs.map +1 -1
  402. package/dist/lib/globalRegistry.mjs.map +1 -1
  403. package/dist/lib/toaster.cjs +2 -0
  404. package/dist/lib/toaster.cjs.map +1 -0
  405. package/dist/lib/toaster.mjs +77 -0
  406. package/dist/lib/toaster.mjs.map +1 -0
  407. package/dist/styles.css +1 -1
  408. package/package.json +1 -1
@@ -1 +1 @@
1
- {"version":3,"file":"Tree.cjs","names":["React","useControllable","useEventCallback","isDev","useRovingTabIndex","useMergedRefs","cn","composeEventHandlers","useId","isElementOfType","slotRendersContent","renderSlot","getDirection","forcedColors","ChevronRightIcon","require_runtime","require_cn","require_children","require_dev","require_slot","require_composeEventHandlers","require_useEventCallback","require_useControllable","require_useId","require_direction","require_useRovingTabIndex","require_useMergedRefs","require_styles","require_icons","react","react_jsx_runtime","TreeContext","TreeParentContext","TreeLabelContext","EMPTY","INERT_CONTEXT","useTreeContext","component","ITEM_IN_LABEL_MESSAGE","warnDuplicateValue","value","TreeRoot","rest","initialExpanded","defaultExpandedItems","expandedList","setExpandedList","expandedItems","onExpandedItemsChange","next","expanded","toggle","prev","v","expand","added","values","activate","onItemSelect","focusedItem","setFocusedItem","valueCounts","registerValue","counts","count","remaining","selected","context","current","getTabIndex","focusValue","mergedRef","ref","containerProps","handleKeyDown","event","syncTypeaheadText","handleKeyDownCapture","handleBlur","className","onKeyDown","onKeyDownCapture","onFocus","onBlur","tree","label","treeitem","text","isOwnKeyEvent","isOwnClick","target","TreeItem","props","typeaheadText","ctx","parent","insideLabel","isExpanded","labelId","nestedItems","labelContent","firstChildValue","children","child","keyed","key","iconNode","icon","hasChildren","leaf","isSelected","isCurrent","handleClick","onClick","rtl","forward","back","siblings","el","handleFocus","Tree"],"sources":["../../../src/components/layout/Tree.tsx"],"sourcesContent":["import * as React from 'react';\nimport { flattenChildren, isElementOfType } from '../../lib/children';\nimport { cn } from '../../lib/cn';\nimport { composeEventHandlers } from '../../lib/composeEventHandlers';\nimport { isDev, reportMissingContext, warnOnce } from '../../lib/dev';\nimport { getDirection } from '../../lib/direction';\nimport { ChevronRightIcon } from '../../lib/icons';\nimport { renderSlot, slotRendersContent, type Slot } from '../../lib/slot';\nimport { forcedColors } from '../../lib/styles';\nimport { useControllable } from '../../hooks/useControllable';\nimport { useEventCallback } from '../../hooks/useEventCallback';\nimport { useId } from '../../hooks/useId';\nimport { useMergedRefs } from '../../hooks/useMergedRefs';\nimport { useRovingTabIndex } from '../../hooks/useRovingTabIndex';\n\n/* ------------------------------------------------------------------ */\n/* Contexts */\n/* ------------------------------------------------------------------ */\n\ninterface TreeContextValue {\n expanded: ReadonlySet<string>;\n toggle: (value: string) => void;\n expand: (values: readonly string[]) => void;\n activate: (value: string) => void;\n selected: string | null | undefined;\n current: string | null | undefined;\n getTabIndex: (value: string) => 0 | -1;\n focusValue: (value: string) => void;\n onItemFocus: (value: string) => void;\n /**\n * Development only: counts a mounted item's value and warns once per value that several items\n * share. Returns the unregistration.\n */\n registerValue: (value: string) => () => void;\n}\n\nconst TreeContext = React.createContext<TreeContextValue | null>(null);\n\n/** Value of the enclosing Tree.Item (`null` at the top level), for ArrowLeft → parent. */\nconst TreeParentContext = React.createContext<string | null>(null);\n\n/**\n * `true` inside the label of a Tree.Item, where a nested Tree.Item ends up when a component\n * renders it (the parent cannot see it among its children); its child group and every Tree root\n * reset it.\n */\nconst TreeLabelContext = React.createContext(false);\n\nconst EMPTY: readonly string[] = [];\n\nconst INERT_CONTEXT: TreeContextValue = {\n expanded: new Set(),\n toggle: () => {},\n expand: () => {},\n activate: () => {},\n selected: undefined,\n current: undefined,\n getTabIndex: () => -1,\n focusValue: () => {},\n onItemFocus: () => {},\n registerValue: () => () => {},\n};\n\n/** C-CONTEXT: throws in development, logs once and returns an inert value in production. */\nfunction useTreeContext(component: string): TreeContextValue {\n const context = React.useContext(TreeContext);\n if (context) return context;\n reportMissingContext(component, '<Tree>');\n return INERT_CONTEXT;\n}\n\nconst ITEM_IN_LABEL_MESSAGE =\n 'Tree.Item was rendered inside the label of another Tree.Item, so it is not part of that ' +\n \"item's child group: the parent cannot expand, its name includes the nested text, and a \" +\n 'treeitem sits inside a label (axe aria-required-parent). A Tree.Item finds its nested items ' +\n 'among its own children (written directly, in Fragments, or returned by a render function such ' +\n 'as `children.map(renderNode)`), but not inside a component that renders Tree.Item itself. ' +\n 'Build a data-driven tree with a render function instead of a recursive component.';\n\nfunction warnDuplicateValue(value: string): void {\n warnOnce(\n `Tree:duplicate:${value}`,\n `Tree: several items share the value \"${value}\". Item values must be unique within a Tree; ` +\n 'items with the same value share their expanded, selected and focus state.',\n );\n}\n\n/* ------------------------------------------------------------------ */\n/* Tree */\n/* ------------------------------------------------------------------ */\n\n/** Properties for the Tree component. */\nexport interface TreeProps extends React.HTMLAttributes<HTMLDivElement> {\n /** Controlled list of expanded item values. */\n expandedItems?: readonly string[];\n /**\n * Item values that are expanded initially (uncontrolled).\n * @default []\n */\n defaultExpandedItems?: readonly string[];\n /** Called with the new list of expanded item values when an item expands or collapses. */\n onExpandedItemsChange?: (expandedItems: string[]) => void;\n /**\n * Called with an item's value every time it is activated (click, Enter or Space), also when the\n * same item is activated again.\n */\n onItemSelect?: (value: string) => void;\n /**\n * Value of the selected item. When set (also to `null`), every item carries `aria-selected`, and\n * the selected item is where keyboard focus enters the tree.\n */\n selected?: string | null;\n /** Value of the current item (for example the open page): it gets `aria-current=\"true\"`. */\n current?: string | null;\n /** Ref to the `role=\"tree\"` element. */\n ref?: React.Ref<HTMLDivElement>;\n}\n\nconst TreeRoot = ({\n expandedItems,\n defaultExpandedItems,\n onExpandedItemsChange,\n onItemSelect,\n selected,\n current,\n className,\n children,\n onKeyDown,\n onKeyDownCapture,\n onFocus,\n onBlur,\n ref,\n ...rest\n}: TreeProps) => {\n const [initialExpanded] = React.useState<readonly string[]>(() => defaultExpandedItems ?? EMPTY);\n const [expandedList, setExpandedList] = useControllable<readonly string[]>(\n expandedItems,\n initialExpanded,\n (next) => onExpandedItemsChange?.([...next]),\n );\n const expanded = React.useMemo(() => new Set(expandedList), [expandedList]);\n\n const toggle = React.useCallback(\n (value: string) => {\n setExpandedList((prev) =>\n prev.includes(value) ? prev.filter((v) => v !== value) : [...prev, value],\n );\n },\n [setExpandedList],\n );\n\n const expand = React.useCallback(\n (values: readonly string[]) => {\n setExpandedList((prev) => {\n const added = values.filter((v) => !prev.includes(v));\n return added.length > 0 ? [...prev, ...added] : prev;\n });\n },\n [setExpandedList],\n );\n\n const activate = useEventCallback((value: string) => {\n onItemSelect?.(value);\n });\n\n // The item that has focus while focus is inside the tree: it holds the tab stop, so Shift+Tab\n // leaves the tree. Cleared when focus leaves; the next entry goes to `selected`, else the first.\n const [focusedItem, setFocusedItem] = React.useState<string | null>(null);\n\n // How many mounted items carry each value (written from the items' effects only).\n const valueCounts = React.useRef<Map<string, number> | null>(null);\n const registerValue = React.useCallback((value: string) => {\n if (!isDev) return () => {};\n valueCounts.current ??= new Map();\n const counts = valueCounts.current;\n const count = (counts.get(value) ?? 0) + 1;\n counts.set(value, count);\n if (count > 1) warnDuplicateValue(value);\n return () => {\n const remaining = (counts.get(value) ?? 1) - 1;\n if (remaining > 0) counts.set(value, remaining);\n else counts.delete(value);\n };\n }, []);\n\n const { containerProps, getTabIndex, focusValue } = useRovingTabIndex({\n activeValue: focusedItem ?? selected ?? null,\n orientation: 'vertical',\n loop: false,\n typeahead: true,\n });\n\n const context = React.useMemo<TreeContextValue>(\n () => ({\n expanded,\n toggle,\n expand,\n activate,\n selected,\n current,\n getTabIndex,\n focusValue,\n onItemFocus: setFocusedItem,\n registerValue,\n }),\n [expanded, toggle, expand, activate, selected, current, getTabIndex, focusValue, registerValue],\n );\n\n const mergedRef = useMergedRefs<HTMLDivElement>(ref, containerProps.ref);\n\n const handleKeyDown = (event: React.KeyboardEvent<HTMLDivElement>) => {\n // Typeahead reads `data-roving-text` at key time: fill it from each item's label first.\n if (event.key.length === 1) syncTypeaheadText(event.currentTarget);\n containerProps.onKeyDown(event);\n };\n\n // A Space that continues a search is typeahead too, taken before the item would activate on it.\n const handleKeyDownCapture = (event: React.KeyboardEvent<HTMLDivElement>) => {\n if (event.key === ' ') syncTypeaheadText(event.currentTarget);\n containerProps.onKeyDownCapture(event);\n };\n\n const handleBlur = (event: React.FocusEvent<HTMLDivElement>) => {\n const next = event.relatedTarget as Node | null;\n if (!next || !event.currentTarget.contains(next)) setFocusedItem(null);\n };\n\n return (\n <TreeContext.Provider value={context}>\n <TreeParentContext.Provider value={null}>\n <div\n role=\"tree\"\n className={cn('text-body-1', className)}\n {...rest}\n data-roving-container=\"\"\n onKeyDown={composeEventHandlers(onKeyDown, handleKeyDown)}\n onKeyDownCapture={composeEventHandlers(onKeyDownCapture, handleKeyDownCapture)}\n onFocus={composeEventHandlers(onFocus, containerProps.onFocus, {\n checkDefaultPrevented: false,\n })}\n onBlur={composeEventHandlers(onBlur, handleBlur, { checkDefaultPrevented: false })}\n ref={mergedRef}\n >\n {/* A Tree has its own items, also when it renders inside a label (a portaled popup). */}\n <TreeLabelContext.Provider value={false}>{children}</TreeLabelContext.Provider>\n </div>\n </TreeParentContext.Provider>\n </TreeContext.Provider>\n );\n};\nTreeRoot.displayName = 'Tree';\n\n/* ------------------------------------------------------------------ */\n/* Tree.Item */\n/* ------------------------------------------------------------------ */\n\n/** Properties for the TreeItem sub-component. */\nexport interface TreeItemProps extends React.HTMLAttributes<HTMLDivElement> {\n /** Unique value identifying this tree item. */\n value: string;\n /**\n * Icon displayed before the label. Rendered in a `<span>` hidden from assistive technology\n * (`aria-hidden`); pass a slot object (`{ className, children, … }`) to customise it. A falsy\n * icon (`''`, `0`) or a list of nothing renders no span.\n */\n icon?: Slot<'span'>;\n /**\n * Renders the item as a leaf even when it has nested `Tree.Item`s: they are not rendered, and\n * the item has no `aria-expanded` and does not expand. An item is expandable only while it has\n * nested items, so `leaf={false}` does not make an item without them expandable. To load the\n * children on first expansion, give the item a placeholder child (a \"Loading…\" `Tree.Item`)\n * until they arrive.\n * @default false\n */\n leaf?: boolean;\n /** Ref to the `role=\"treeitem\"` element. */\n ref?: React.Ref<HTMLDivElement>;\n}\n\n/**\n * Sets the typeahead text (`data-roving-text`, read by the roving hook) of every rendered\n * treeitem to the text of its label, so neither the icon nor the nested items take part. A\n * consumer `data-roving-text` on a Tree.Item is kept on its label and wins.\n */\nfunction syncTypeaheadText(tree: HTMLElement): void {\n tree.querySelectorAll<HTMLElement>('[role=\"treeitem\"]').forEach((treeitem) => {\n const label = treeitem.querySelector<HTMLElement>(\n ':scope > [data-tree-row] > [data-tree-label]',\n );\n if (!label) return;\n const text = label.getAttribute('data-roving-text') ?? label.textContent ?? '';\n if (treeitem.getAttribute('data-roving-text') !== text) {\n treeitem.setAttribute('data-roving-text', text);\n }\n });\n}\n\n/**\n * Whether a keyboard event belongs to this treeitem: its target (the focused element) is this\n * treeitem or inside its row, not a nested item.\n */\nfunction isOwnKeyEvent(event: React.KeyboardEvent<HTMLElement>): boolean {\n const target = event.target as Element | null;\n return target?.closest?.('[role=\"treeitem\"]') === event.currentTarget;\n}\n\n/**\n * Whether a click landed on this treeitem's own row (or on the treeitem element itself). Clicks\n * in its child group, including the indentation gutter beside the nested rows, and clicks on\n * nested items are not its own.\n */\nfunction isOwnClick(event: React.MouseEvent<HTMLElement>): boolean {\n const target = event.target as Element | null;\n if (target === event.currentTarget) return true;\n return target?.closest?.('[data-tree-row]')?.parentElement === event.currentTarget;\n}\n\n/**\n * One node of a Tree. Text and other content are the label; nested `Tree.Item` children form its\n * child group, which is shown while the item is expanded.\n *\n * Nested items must be `Tree.Item` elements among the item's own children: written directly, in\n * Fragments, or returned by a render function (`{node.children.map(renderNode)}`). A component\n * that renders `Tree.Item` itself (a recursive `<NodeView node={child} />`) is not recognised:\n * its output becomes part of the label, so the parent cannot expand (a development warning names\n * this). Render data-driven trees with a render function instead.\n *\n * `ref` and every other prop land on the `role=\"treeitem\"` element, which contains the label row\n * and the child group. Its `onClick` receives only clicks on its own row (not on its child group\n * or nested items) and its `onKeyDown` only keys pressed while focus is on it or in its row; both\n * run before the built-in behaviour (call `event.preventDefault()` to skip it). Its other event\n * handlers (`onFocus`, `onDoubleClick`, `onContextMenu` and the rest) are not filtered: as DOM\n * events bubble, they also receive events from its child group and nested items (compare\n * `event.target` with `event.currentTarget` to tell them apart).\n *\n * The item is named by its label (`aria-labelledby`), not by its icon or nested items; an\n * `aria-label` or `aria-labelledby` prop replaces that name. Typeahead matches the label text too\n * (a `data-roving-text` prop replaces it).\n */\nconst TreeItem = ({\n value,\n icon,\n leaf = false,\n className,\n children,\n onClick,\n onKeyDown,\n onFocus,\n ref,\n ...props\n}: TreeItemProps) => {\n const { 'data-roving-text': typeaheadText, ...rest } = props as typeof props & {\n 'data-roving-text'?: string;\n };\n const ctx = useTreeContext('Tree.Item');\n const parent = React.useContext(TreeParentContext);\n const insideLabel = React.useContext(TreeLabelContext);\n const isExpanded = ctx.expanded.has(value);\n const labelId = useId('tree-item-label');\n\n const { registerValue } = ctx;\n React.useEffect(() => registerValue(value), [registerValue, value]);\n React.useEffect(() => {\n if (insideLabel) warnOnce('Tree.Item:inside-label', ITEM_IN_LABEL_MESSAGE);\n }, [insideLabel]);\n\n // Nested Tree.Items (and, as in 0.4, nested Trees) form the child group; the rest is the label.\n // Parts are identified through their element type, so parts written in a Server Component\n // (lazy references) count too.\n const nestedItems: React.ReactNode[] = [];\n const labelContent: React.ReactNode[] = [];\n let firstChildValue: string | undefined;\n flattenChildren(children).forEach(({ key, node: child }) => {\n const keyed = <React.Fragment key={key}>{child}</React.Fragment>;\n if (isElementOfType<TreeItemProps>(child, TreeItem)) {\n firstChildValue ??= child.props.value;\n nestedItems.push(keyed);\n } else if (isElementOfType(child, TreeRoot)) {\n nestedItems.push(keyed);\n } else {\n labelContent.push(keyed);\n }\n });\n\n // A falsy icon (`icon={name && <Icon />}` with `name` '' or a count of 0) is no icon, as in 0.4\n // and as in Avatar, and so is a collection whose items render nothing: no empty span adds a gap\n // to the row. The check does not consume a generator: renderSlot still renders its items.\n const iconNode =\n icon && slotRendersContent(icon)\n ? renderSlot(icon, 'span', 'inline-flex shrink-0', { 'aria-hidden': true })\n : null;\n const hasChildren = nestedItems.length > 0 && !leaf;\n const isSelected = ctx.selected !== undefined ? ctx.selected === value : undefined;\n const isCurrent = ctx.current !== undefined && ctx.current !== null && ctx.current === value;\n\n const activate = () => {\n if (hasChildren) ctx.toggle(value);\n ctx.activate(value);\n };\n\n const handleClick = (event: React.MouseEvent<HTMLDivElement>) => {\n if (!isOwnClick(event)) return;\n onClick?.(event);\n if (!event.defaultPrevented) activate();\n };\n\n const handleKeyDown = (event: React.KeyboardEvent<HTMLDivElement>) => {\n if (!isOwnKeyEvent(event)) return;\n onKeyDown?.(event);\n if (event.defaultPrevented || event.altKey || event.ctrlKey || event.metaKey) return;\n\n const rtl = getDirection(event.currentTarget) === 'rtl';\n const forward = rtl ? 'ArrowLeft' : 'ArrowRight';\n const back = rtl ? 'ArrowRight' : 'ArrowLeft';\n\n switch (event.key) {\n case 'Enter':\n case ' ':\n event.preventDefault();\n activate();\n return;\n case forward:\n event.preventDefault();\n if (!hasChildren) return;\n if (!isExpanded) ctx.toggle(value);\n else if (firstChildValue !== undefined) ctx.focusValue(firstChildValue);\n return;\n case back:\n event.preventDefault();\n if (hasChildren && isExpanded) ctx.toggle(value);\n else if (parent !== null) ctx.focusValue(parent);\n return;\n case '*': {\n event.preventDefault();\n const siblings = event.currentTarget.parentElement?.querySelectorAll<HTMLElement>(\n ':scope > [role=\"treeitem\"][aria-expanded=\"false\"][data-roving-value]',\n );\n ctx.expand(\n Array.from(siblings ?? [], (el) => el.getAttribute('data-roving-value') ?? '').filter(\n Boolean,\n ),\n );\n return;\n }\n default:\n }\n };\n\n const handleFocus = (event: React.FocusEvent<HTMLDivElement>) => {\n if (event.target === event.currentTarget) ctx.onItemFocus(value);\n };\n\n return (\n <div\n role=\"treeitem\"\n aria-selected={isSelected}\n aria-current={isCurrent ? true : undefined}\n className={cn(\n // The focus ring is drawn on the row: an outline on the treeitem would surround its\n // whole subtree.\n 'block outline-none',\n '[&:focus-visible>[data-tree-row]]:outline-2 [&:focus-visible>[data-tree-row]]:-outline-offset-2 [&:focus-visible>[data-tree-row]]:outline-ring',\n className,\n )}\n {...rest}\n // Named by its label only: the treeitem also contains its icon and its child group. A\n // consumer aria-labelledby or aria-label replaces it.\n aria-labelledby={\n rest['aria-labelledby'] ?? (rest['aria-label'] === undefined ? labelId : undefined)\n }\n aria-expanded={hasChildren ? isExpanded : undefined}\n tabIndex={ctx.getTabIndex(value)}\n data-roving-value={value}\n data-selected={isSelected ? '' : undefined}\n data-current={isCurrent ? '' : undefined}\n onClick={handleClick}\n onKeyDown={handleKeyDown}\n onFocus={composeEventHandlers(onFocus, handleFocus, { checkDefaultPrevented: false })}\n ref={ref}\n >\n <div\n data-tree-row=\"\"\n className={cn(\n 'flex cursor-pointer items-center gap-1.5 rounded px-2 py-1 hover:bg-subtle-hover',\n isSelected && cn('bg-subtle-selected font-semibold', forcedColors.selectedContainer),\n )}\n >\n {hasChildren ? (\n <ChevronRightIcon\n className={cn(\n 'shrink-0 transition-transform motion-reduce:transition-none',\n isExpanded ? 'rotate-90' : 'wave-rtl:-scale-x-100',\n )}\n />\n ) : (\n <span className=\"w-3 shrink-0\" aria-hidden=\"true\" />\n )}\n {iconNode}\n <span id={labelId} data-tree-label=\"\" data-roving-text={typeaheadText} className=\"truncate\">\n <TreeLabelContext.Provider value>{labelContent}</TreeLabelContext.Provider>\n </span>\n </div>\n {hasChildren && isExpanded && (\n <TreeParentContext.Provider value={value}>\n <TreeLabelContext.Provider value={false}>\n <div role=\"group\" className=\"ps-4\">\n {nestedItems}\n </div>\n </TreeLabelContext.Provider>\n </TreeParentContext.Provider>\n )}\n </div>\n );\n};\nTreeItem.displayName = 'TreeItem';\n\n/* ------------------------------------------------------------------ */\n/* Export */\n/* ------------------------------------------------------------------ */\n\n/**\n * A hierarchical list (WAI-ARIA Tree View pattern) with a single tab stop: Up/Down move between\n * visible items, Home/End to the first/last, Right expands or moves to the first child, Left\n * collapses or moves to the parent (both mirrored in RTL), Enter/Space activate (and toggle a\n * parent), `*` expands the siblings, and typing jumps to an item by its text.\n *\n * Keyboard focus enters at the `selected` item, else the first item; while focus is inside, the\n * tab stop follows it, so Shift+Tab leaves the tree.\n *\n * Items are `Tree.Item` elements; nested items are written in their parent's children (directly,\n * in Fragments, or returned by a render function), not rendered by a component of their own.\n * Every item needs a `value` that is unique within the Tree.\n *\n * `Tree.Item` is also exported as `TreeItem` for React Server Components, which cannot use the\n * dotted form.\n */\nexport const Tree = /* @__PURE__ */ Object.assign(TreeRoot, {\n Item: TreeItem,\n});\n\nexport { TreeItem };\n"],"mappings":"ioBAoCA,IAAM+B,EAAc/B,EAAM,cAAuC,IAAI,EAG/DgC,EAAoBhC,EAAM,cAA6B,IAAI,EAO3DiC,EAAmBjC,EAAM,cAAc,EAAK,EAE5CkC,EAA2B,CAAC,EAE5BC,EAAkC,CACtC,SAAU,IAAI,IACd,WAAc,CAAC,EACf,WAAc,CAAC,EACf,aAAgB,CAAC,EACjB,SAAU,IAAA,GACV,QAAS,IAAA,GACT,gBAAmB,GACnB,eAAkB,CAAC,EACnB,gBAAmB,CAAC,EACpB,sBAA2B,CAAC,CAC9B,EAGA,SAASC,EAAe,EAAqC,CAI3D,OAHgBpC,EAAM,WAAW+B,CAC7B,IACJb,EAAA,qBAAqBmB,EAAW,QAAQ,EACjCF,EACT,C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AAM,CAAC,EAC/E,MAzBP,SAAA,EA2BE,EAAAzF,EAAA,KAAA,CAAC,MAAD,CACE,gBAAc,GACd,UAAWxB,EAAAA,GACT,mFACAwG,GAAcxG,EAAAA,GAAG,mCAAoCO,EAAAA,aAAa,iBAAiB,CACrF,EALF,SAAA,CAOG+F,GACC,EAAA9E,EAAA,IAAA,CAAChB,EAAAA,iBAAD,CACE,UAAWR,EAAAA,GACT,8DACA2F,EAAa,YAAc,uBAC7B,CACD,CAAA,GAED,EAAAnE,EAAA,IAAA,CAAC,OAAD,CAAM,UAAU,eAAe,cAAY,MAAQ,CAAA,EAEpD4E,GACD,EAAA5E,EAAA,IAAA,CAAC,OAAD,CAAM,GAAIoE,EAAS,kBAAgB,GAAG,mBAAkBL,EAAe,UAAU,WAC/E,UAAA,EAAA/D,EAAA,IAAA,CAACG,EAAiB,SAAlB,CAA2B,MAAA,GAAO,SAAAmE,CAAwC,CAAA,CACtE,CAAA,CACH,CACJ,CAAA,EAAAQ,GAAeX,IACd,EAAAnE,EAAA,IAAA,CAACE,EAAkB,SAAnB,CAAmC,QACjC,UAAA,EAAAF,EAAA,IAAA,CAACG,EAAiB,SAAlB,CAA2B,MAAO,GAChC,UAAA,EAAAH,EAAA,IAAA,CAAC,MAAD,CAAK,KAAK,QAAQ,UAAU,OACzB,SAAAqE,CACE,CAAA,CACoB,CAAA,CACD,CAAA,CAE3B,GAET,EACA,EAAS,YAAc,WAsBvB,IAAaqB,EAAuB,OAAO,OAAO/E,EAAU,CAC1D,KAAMkD,CACR,CAAC"}
1
+ {"version":3,"file":"Tree.cjs","names":["TreeRoot","TreeItem","TreeItemPersonaLayout","require_Tree_core","require_Tree_itemPersonaLayout","Tree"],"sources":["../../../src/components/layout/Tree.tsx"],"sourcesContent":["import { TreeItem, TreeRoot } from './Tree.core';\nimport { TreeItemPersonaLayout } from './Tree.itemPersonaLayout';\n\nexport type { TreeCheckedItemsChangeDetails, TreeItemProps, TreeProps } from './Tree.core';\nexport type { TreeItemPersonaLayoutProps } from './Tree.itemPersonaLayout';\n\n/**\n * A hierarchical list (WAI-ARIA Tree View pattern) with a single tab stop: Up/Down move between\n * visible items, Home/End to the first/last, Right expands or moves to the first child (or into\n * the row's actions, see below), Left collapses or moves to the parent (both mirrored in RTL),\n * Enter activates (and toggles a parent), and so does Space unless the tree has checkboxes, `*`\n * expands the siblings, and typing jumps to an item by its text.\n *\n * Keyboard focus enters at the `selected` item, else the first item; while focus is inside, the\n * tab stop follows it, so Shift+Tab leaves the tree.\n *\n * `selectionMode=\"multiple\"` draws a checkbox on every item, bound to `checkedItems`: Space\n * toggles the focused item's check, a click on the checkbox toggles it, and a click elsewhere on\n * the row activates the item (as Enter does). Checks cascade: checking an item checks every item\n * nested in it, and an item shows checked when all of its nested items are checked, mixed when\n * some are. `onCheckedItemsChange` receives every checked item in tree order (fully checked parents\n * included), followed by listed values that match no item, and `details` (`value`, `checked`,\n * `event`).\n *\n * Row content: `actions` (buttons at the end of the row, in a toolbar named by the item, shown on\n * hover and focus, and always where there is no hover or colors are forced), `aside` (a count or a\n * badge that describes the item), `iconAfter` and `expandIcon`. Tab from the focused item enters\n * its actions and Shift+Tab returns. Keys and clicks on the actions never activate or check the\n * item. With `navigationMode=\"treegrid\"`, Right (Left in right-to-left layouts) moves from an\n * item into its actions and Left returns, the actions take no Tab stop, and on an open parent Right\n * moves into its actions rather than to its first child (Down does); the roles stay `tree` and\n * `treeitem`.\n *\n * Items are `Tree.Item` elements; nested items are written in their parent's children (directly,\n * in Fragments, or returned by a render function), not rendered by a component of their own.\n * Every item needs a `value` that is unique within the Tree. `Tree.ItemPersonaLayout` lays out a\n * person (media, name and description) as an item's label.\n *\n * `Tree.Item` and `Tree.ItemPersonaLayout` are also exported as `TreeItem` and\n * `TreeItemPersonaLayout` for React Server Components, which cannot use the dotted form.\n */\nexport const Tree = /* @__PURE__ */ Object.assign(TreeRoot, {\n Item: TreeItem,\n ItemPersonaLayout: TreeItemPersonaLayout,\n});\n\nexport { TreeItem, TreeItemPersonaLayout };\n"],"mappings":"0FAyCA,IAAaK,EAAuB,OAAO,OAAOL,EAAAA,SAAU,CAC1D,KAAMC,EAAAA,SACN,kBAAmBC,EAAAA,qBACrB,CAAC"}
@@ -0,0 +1,2 @@
1
+ "use client";const e=require("../../_virtual/_rolldown/runtime.cjs"),t=require("../../lib/dev.cjs");let n=require("react");n=e.__toESM(n,1);var r=n.createContext(!1),i=n.createContext(null),a=n.createContext(null),o=n.createContext(!1),s=n.createContext(null),c={registerLayout:()=>()=>{}};function l(e){return n.useContext(s)||(t.reportMissingContext(e,`<Tree.Item>`),c)}var u={expanded:new Set,toggle:()=>{},expand:()=>{},activate:()=>{},selected:void 0,current:void 0,getTabIndex:()=>-1,focusValue:()=>{},onItemFocus:()=>{},focusedItem:null,navigationMode:`tree`,registerValue:()=>()=>{},selectionMode:`none`,checked:new Set,toggleChecked:()=>{},registerTopLevel:()=>()=>{}};function d(e){return n.useContext(i)||(t.reportMissingContext(e,`<Tree>`),u)}exports.TreeCheckForcedContext=r,exports.TreeContext=i,exports.TreeItemContext=s,exports.TreeLabelContext=o,exports.TreeParentContext=a,exports.useTreeContext=d,exports.useTreeItemContext=l;
2
+ //# sourceMappingURL=Tree.context.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Tree.context.cjs","names":["React","require_runtime","require_dev","react","TreeCheckForcedContext","TreeContext","TreeParentContext","TreeLabelContext","TreeItemContext","INERT_ITEM_CONTEXT","useTreeItemContext","component","INERT_CONTEXT","useTreeContext"],"sources":["../../../src/components/layout/Tree.context.ts"],"sourcesContent":["import * as React from 'react';\nimport { reportMissingContext } from '../../lib/dev';\nimport type { SelectionMode } from '../../lib/types';\nimport type { TreeNode } from './Tree.selection';\n\n/** What a top-level item hands to the root for the tree order of a toggle. */\nexport interface TreeSelectionEntry {\n /** The item's value and the Tree.Item elements among its children, recursively. */\n node: TreeNode;\n /** The treeitem element, which orders the top-level items. */\n element: HTMLElement | null;\n}\n\n/**\n * `true` inside the child group of an item that the checked list checks (its own value or an\n * ancestor's is listed): every item there is checked.\n */\nexport const TreeCheckForcedContext = React.createContext(false);\n\nexport interface TreeContextValue {\n expanded: ReadonlySet<string>;\n toggle: (value: string) => void;\n expand: (values: readonly string[]) => void;\n activate: (value: string) => void;\n selected: string | null | undefined;\n current: string | null | undefined;\n getTabIndex: (value: string) => 0 | -1;\n focusValue: (value: string) => void;\n onItemFocus: (value: string) => void;\n /** The item that focus is on or inside (its actions); `null` while focus is outside the tree. */\n focusedItem: string | null;\n /** `'tree'` (Tab enters a row's actions) or `'treegrid'` (the arrow keys do). */\n navigationMode: 'tree' | 'treegrid';\n /**\n * Development only: counts a mounted item's value and warns once per value that several items\n * share. Returns the unregistration.\n */\n registerValue: (value: string) => () => void;\n /** The resolved selection mode. */\n selectionMode: 'none' | SelectionMode;\n /** The checked item values (`selectionMode=\"multiple\"`); every item computes its state from them. */\n checked: ReadonlySet<string>;\n /** Toggles an item's check; `event` becomes `details.event` of `onCheckedItemsChange`. */\n toggleChecked: (value: string, event: Event) => void;\n /**\n * Registers a top-level item's selection entry, read when a check toggles to put the items in\n * tree order. Returns the unregistration.\n */\n registerTopLevel: (entry: React.RefObject<TreeSelectionEntry | null>) => () => void;\n}\n\nexport const TreeContext = React.createContext<TreeContextValue | null>(null);\n\n/** Value of the enclosing Tree.Item (`null` at the top level), for ArrowLeft → parent. */\nexport const TreeParentContext = React.createContext<string | null>(null);\n\n/**\n * `true` inside the label of a Tree.Item, where a nested Tree.Item ends up when a component\n * renders it (the parent cannot see it among its children); its child group and every Tree root\n * reset it.\n */\nexport const TreeLabelContext = React.createContext(false);\n\n/** The ids a Tree.ItemPersonaLayout registers with its item. */\nexport interface PersonaLayoutIds {\n /** The name element: the item's name. */\n nameId: string;\n /** The description element, while it renders: it joins the item's description. */\n descriptionId: string | undefined;\n}\n\n/** What a Tree.Item gives the content of its label. */\nexport interface TreeItemContextValue {\n /** Registers a persona layout's ids with the item; returns the unregistration. */\n registerLayout: (ids: PersonaLayoutIds) => () => void;\n}\n\nexport const TreeItemContext = React.createContext<TreeItemContextValue | null>(null);\n\nconst INERT_ITEM_CONTEXT: TreeItemContextValue = { registerLayout: () => () => {} };\n\n/** C-CONTEXT: throws in development, logs once and returns an inert value in production. */\nexport function useTreeItemContext(component: string): TreeItemContextValue {\n const context = React.useContext(TreeItemContext);\n if (context) return context;\n reportMissingContext(component, '<Tree.Item>');\n return INERT_ITEM_CONTEXT;\n}\n\nconst INERT_CONTEXT: TreeContextValue = {\n expanded: new Set(),\n toggle: () => {},\n expand: () => {},\n activate: () => {},\n selected: undefined,\n current: undefined,\n getTabIndex: () => -1,\n focusValue: () => {},\n onItemFocus: () => {},\n focusedItem: null,\n navigationMode: 'tree',\n registerValue: () => () => {},\n selectionMode: 'none',\n checked: new Set(),\n toggleChecked: () => {},\n registerTopLevel: () => () => {},\n};\n\n/** C-CONTEXT: throws in development, logs once and returns an inert value in production. */\nexport function useTreeContext(component: string): TreeContextValue {\n const context = React.useContext(TreeContext);\n if (context) return context;\n reportMissingContext(component, '<Tree>');\n return INERT_CONTEXT;\n}\n"],"mappings":"4IAiBA,IAAaI,EAAyBJ,EAAM,cAAc,EAAK,EAkClDK,EAAcL,EAAM,cAAuC,IAAI,EAG/DM,EAAoBN,EAAM,cAA6B,IAAI,EAO3DO,EAAmBP,EAAM,cAAc,EAAK,EAgB5CQ,EAAkBR,EAAM,cAA2C,IAAI,EAE9ES,EAA2C,CAAE,uBAA4B,CAAC,CAAE,EAGlF,SAAgBC,EAAmB,EAAyC,CAI1E,OAHgBV,EAAM,WAAWQ,CAC7B,IACJN,EAAA,qBAAqBS,EAAW,aAAa,EACtCF,EACT,CAEA,IAAMG,EAAkC,CACtC,SAAU,IAAI,IACd,WAAc,CAAC,EACf,WAAc,CAAC,EACf,aAAgB,CAAC,EACjB,SAAU,IAAA,GACV,QAAS,IAAA,GACT,gBAAmB,GACnB,eAAkB,CAAC,EACnB,gBAAmB,CAAC,EACpB,YAAa,KACb,eAAgB,OAChB,sBAA2B,CAAC,EAC5B,cAAe,OACf,QAAS,IAAI,IACb,kBAAqB,CAAC,EACtB,yBAA8B,CAAC,CACjC,EAGA,SAAgBC,EAAe,EAAqC,CAIlE,OAHgBb,EAAM,WAAWK,CAC7B,IACJH,EAAA,qBAAqBS,EAAW,QAAQ,EACjCC,EACT"}
@@ -0,0 +1,33 @@
1
+ "use client";
2
+ import { reportMissingContext as e } from "../../lib/dev.mjs";
3
+ import * as t from "react";
4
+ //#region src/components/layout/Tree.context.ts
5
+ var n = t.createContext(!1), r = t.createContext(null), i = t.createContext(null), a = t.createContext(!1), o = t.createContext(null), s = { registerLayout: () => () => {} };
6
+ function c(n) {
7
+ return t.useContext(o) || (e(n, "<Tree.Item>"), s);
8
+ }
9
+ var l = {
10
+ expanded: /* @__PURE__ */ new Set(),
11
+ toggle: () => {},
12
+ expand: () => {},
13
+ activate: () => {},
14
+ selected: void 0,
15
+ current: void 0,
16
+ getTabIndex: () => -1,
17
+ focusValue: () => {},
18
+ onItemFocus: () => {},
19
+ focusedItem: null,
20
+ navigationMode: "tree",
21
+ registerValue: () => () => {},
22
+ selectionMode: "none",
23
+ checked: /* @__PURE__ */ new Set(),
24
+ toggleChecked: () => {},
25
+ registerTopLevel: () => () => {}
26
+ };
27
+ function u(n) {
28
+ return t.useContext(r) || (e(n, "<Tree>"), l);
29
+ }
30
+ //#endregion
31
+ export { n as TreeCheckForcedContext, r as TreeContext, o as TreeItemContext, a as TreeLabelContext, i as TreeParentContext, u as useTreeContext, c as useTreeItemContext };
32
+
33
+ //# sourceMappingURL=Tree.context.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Tree.context.mjs","names":["React","TreeCheckForcedContext","TreeContext","TreeParentContext","TreeLabelContext","TreeItemContext","INERT_ITEM_CONTEXT","useTreeItemContext","reportMissingContext","component","INERT_CONTEXT","useTreeContext"],"sources":["../../../src/components/layout/Tree.context.ts"],"sourcesContent":["import * as React from 'react';\nimport { reportMissingContext } from '../../lib/dev';\nimport type { SelectionMode } from '../../lib/types';\nimport type { TreeNode } from './Tree.selection';\n\n/** What a top-level item hands to the root for the tree order of a toggle. */\nexport interface TreeSelectionEntry {\n /** The item's value and the Tree.Item elements among its children, recursively. */\n node: TreeNode;\n /** The treeitem element, which orders the top-level items. */\n element: HTMLElement | null;\n}\n\n/**\n * `true` inside the child group of an item that the checked list checks (its own value or an\n * ancestor's is listed): every item there is checked.\n */\nexport const TreeCheckForcedContext = React.createContext(false);\n\nexport interface TreeContextValue {\n expanded: ReadonlySet<string>;\n toggle: (value: string) => void;\n expand: (values: readonly string[]) => void;\n activate: (value: string) => void;\n selected: string | null | undefined;\n current: string | null | undefined;\n getTabIndex: (value: string) => 0 | -1;\n focusValue: (value: string) => void;\n onItemFocus: (value: string) => void;\n /** The item that focus is on or inside (its actions); `null` while focus is outside the tree. */\n focusedItem: string | null;\n /** `'tree'` (Tab enters a row's actions) or `'treegrid'` (the arrow keys do). */\n navigationMode: 'tree' | 'treegrid';\n /**\n * Development only: counts a mounted item's value and warns once per value that several items\n * share. Returns the unregistration.\n */\n registerValue: (value: string) => () => void;\n /** The resolved selection mode. */\n selectionMode: 'none' | SelectionMode;\n /** The checked item values (`selectionMode=\"multiple\"`); every item computes its state from them. */\n checked: ReadonlySet<string>;\n /** Toggles an item's check; `event` becomes `details.event` of `onCheckedItemsChange`. */\n toggleChecked: (value: string, event: Event) => void;\n /**\n * Registers a top-level item's selection entry, read when a check toggles to put the items in\n * tree order. Returns the unregistration.\n */\n registerTopLevel: (entry: React.RefObject<TreeSelectionEntry | null>) => () => void;\n}\n\nexport const TreeContext = React.createContext<TreeContextValue | null>(null);\n\n/** Value of the enclosing Tree.Item (`null` at the top level), for ArrowLeft → parent. */\nexport const TreeParentContext = React.createContext<string | null>(null);\n\n/**\n * `true` inside the label of a Tree.Item, where a nested Tree.Item ends up when a component\n * renders it (the parent cannot see it among its children); its child group and every Tree root\n * reset it.\n */\nexport const TreeLabelContext = React.createContext(false);\n\n/** The ids a Tree.ItemPersonaLayout registers with its item. */\nexport interface PersonaLayoutIds {\n /** The name element: the item's name. */\n nameId: string;\n /** The description element, while it renders: it joins the item's description. */\n descriptionId: string | undefined;\n}\n\n/** What a Tree.Item gives the content of its label. */\nexport interface TreeItemContextValue {\n /** Registers a persona layout's ids with the item; returns the unregistration. */\n registerLayout: (ids: PersonaLayoutIds) => () => void;\n}\n\nexport const TreeItemContext = React.createContext<TreeItemContextValue | null>(null);\n\nconst INERT_ITEM_CONTEXT: TreeItemContextValue = { registerLayout: () => () => {} };\n\n/** C-CONTEXT: throws in development, logs once and returns an inert value in production. */\nexport function useTreeItemContext(component: string): TreeItemContextValue {\n const context = React.useContext(TreeItemContext);\n if (context) return context;\n reportMissingContext(component, '<Tree.Item>');\n return INERT_ITEM_CONTEXT;\n}\n\nconst INERT_CONTEXT: TreeContextValue = {\n expanded: new Set(),\n toggle: () => {},\n expand: () => {},\n activate: () => {},\n selected: undefined,\n current: undefined,\n getTabIndex: () => -1,\n focusValue: () => {},\n onItemFocus: () => {},\n focusedItem: null,\n navigationMode: 'tree',\n registerValue: () => () => {},\n selectionMode: 'none',\n checked: new Set(),\n toggleChecked: () => {},\n registerTopLevel: () => () => {},\n};\n\n/** C-CONTEXT: throws in development, logs once and returns an inert value in production. */\nexport function useTreeContext(component: string): TreeContextValue {\n const context = React.useContext(TreeContext);\n if (context) return context;\n reportMissingContext(component, '<Tree>');\n return INERT_CONTEXT;\n}\n"],"mappings":";;;;AAiBA,IAAaC,IAAyBD,EAAM,cAAc,EAAK,GAkClDE,IAAcF,EAAM,cAAuC,IAAI,GAG/DG,IAAoBH,EAAM,cAA6B,IAAI,GAO3DI,IAAmBJ,EAAM,cAAc,EAAK,GAgB5CK,IAAkBL,EAAM,cAA2C,IAAI,GAE9EM,IAA2C,EAAE,4BAA4B,CAAC,EAAE;AAGlF,SAAgBC,EAAmB,GAAyC;CAI1E,OAHgBP,EAAM,WAAWK,CAC7B,MACJG,EAAqBC,GAAW,aAAa,GACtCH;AACT;AAEA,IAAMI,IAAkC;CACtC,0BAAU,IAAI,IAAI;CAClB,cAAc,CAAC;CACf,cAAc,CAAC;CACf,gBAAgB,CAAC;CACjB,UAAU,KAAA;CACV,SAAS,KAAA;CACT,mBAAmB;CACnB,kBAAkB,CAAC;CACnB,mBAAmB,CAAC;CACpB,aAAa;CACb,gBAAgB;CAChB,2BAA2B,CAAC;CAC5B,eAAe;CACf,yBAAS,IAAI,IAAI;CACjB,qBAAqB,CAAC;CACtB,8BAA8B,CAAC;AACjC;AAGA,SAAgBC,EAAe,GAAqC;CAIlE,OAHgBX,EAAM,WAAWE,CAC7B,MACJM,EAAqBC,GAAW,QAAQ,GACjCC;AACT"}
@@ -0,0 +1,2 @@
1
+ "use client";const e=require("../../_virtual/_rolldown/runtime.cjs"),t=require("../../lib/cn.cjs"),n=require("../../lib/children.cjs"),r=require("../../lib/dev.cjs"),i=require("../../lib/slot.cjs"),a=require("../../lib/composeEventHandlers.cjs"),o=require("../../lib/classNames.cjs"),s=require("../../hooks/useEventCallback.cjs"),c=require("../../hooks/useControllable.cjs"),l=require("../../hooks/useId.cjs"),u=require("../../lib/direction.cjs"),d=require("../../lib/focus.cjs"),f=require("../../hooks/useRovingTabIndex.cjs"),p=require("../../hooks/useMergedRefs.cjs"),m=require("../../lib/aria.cjs"),h=require("../../lib/styles.cjs"),g=require("../../lib/icons.cjs"),_=require("../../lib/events.cjs"),v=require("./Tree.context.cjs"),ee=require("./Tree.selection.cjs");let y=require("react");y=e.__toESM(y,1);let b=require("react/jsx-runtime");var x=[],te="Tree.Item was rendered inside the label of another Tree.Item, so it is not part of that item's child group: the parent cannot expand, its name includes the nested text, and a treeitem sits inside a label (axe aria-required-parent). A Tree.Item finds its nested items among its own children (written directly, in Fragments, or returned by a render function such as `children.map(renderNode)`), but not inside a component that renders Tree.Item itself. Build a data-driven tree with a render function instead of a recursive component.";function ne(e){r.warnOnce(`Tree:duplicate:${e}`,`Tree: several items share the value "${e}". Item values must be unique within a Tree; items with the same value share their expanded, selected and focus state.`)}var S='Tree: `selected` has no effect with selectionMode="multiple"; use `checkedItems`, and `current` for the item the user is on.',re='Tree: `checkedItems` and `defaultCheckedItems` need selectionMode="multiple"; without it the tree draws no checkboxes and ignores them.',ie='Tree: selectionMode="single" draws a radio on every item for `selected`; pass `selected` (null while nothing is selected) and update it from `onItemSelect`.';function ae(e){return e?Array.from(e,e=>e.current).filter(e=>e!==null).sort((e,t)=>!e.element||!t.element||e.element===t.element?0:e.element.compareDocumentPosition(t.element)&Node.DOCUMENT_POSITION_FOLLOWING?-1:1).map(e=>e.node):[]}var oe=`[role="treeitem"]`,C=`button, [href], input, select, textarea, [role="button"], [tabindex]`,se=`[&:focus-within:not(:has(>[role=group]_:focus))>[data-tree-row]_[data-tree-actions]]:visible`,ce=`[@media(hover:hover)]:not-forced-colors:[&:focus-within:not(:has(>[role=group]_:focus))>[data-tree-row]_[data-tree-aside]]:invisible`,le=`invisible group-hover/row:visible focus-within:visible forced-colors:visible [@media(hover:none)]:visible has-[[aria-expanded=true]]:visible data-[focus-in-popup]:visible`,ue=`not-forced-colors:group-hover/row:invisible [@media(hover:hover)]:not-forced-colors:group-focus-within/end:invisible [@media(hover:hover)]:not-forced-colors:group-has-[[aria-expanded=true]]/end:invisible [@media(hover:hover)]:not-forced-colors:group-has-[[data-focus-in-popup]]/end:invisible`,de=`[&>*]:[grid-area:1/1] forced-colors:flex [@media(hover:none)]:flex`;function fe(e){let t=e.querySelector(`:scope > [data-tree-row] [data-tree-actions]`);if(!t)return!1;let n=new Map;for(let e of Array.from(t.querySelectorAll(C))){if(d.isHiddenInput(e)||e.matches(`:disabled`))continue;let r=e.closest(`[hidden], [inert]`);if(r&&t.contains(r))continue;let i=e.getAttribute(`data-roving-disabled`);if((i===null||i===`false`)&&(e.getAttribute(`aria-disabled`)!==`true`||e.hasAttribute(`data-disabled-focusable`))&&!f.isHiddenByCss(e,t,n)&&(e.focus(),e.ownerDocument.activeElement===e))return!0}return!1}var w=({expandedItems:e,defaultExpandedItems:n,onExpandedItemsChange:i,onItemSelect:l,selected:u,current:d,selectionMode:m=`none`,navigationMode:h=`tree`,checkedItems:g,defaultCheckedItems:_,onCheckedItemsChange:te,className:C,children:se,onKeyDown:ce,onKeyDownCapture:le,onFocus:ue,onBlur:de,ref:fe,...w})=>{let[me]=y.useState(()=>n??x),[he,T]=c.useControllable(e,me,e=>i?.([...e])),E=y.useMemo(()=>new Set(he),[he]),D=y.useCallback(e=>{T(t=>t.includes(e)?t.filter(t=>t!==e):[...t,e])},[T]),O=y.useCallback(e=>{T(t=>{let n=e.filter(e=>!t.includes(e));return n.length>0?[...t,...n]:t})},[T]),k=s.useEventCallback(e=>{l?.(e)}),[A]=y.useState(()=>_??x),j=y.useRef(void 0),[M,ge]=c.useControllable(g,A,e=>te?.([...e],j.current)),N=y.useMemo(()=>new Set(M),[M]),P=y.useRef(null),_e=y.useCallback(e=>{P.current??=new Set;let t=P.current;return t.add(e),()=>{t.delete(e)}},[]),F=s.useEventCallback((e,t)=>{let n=ae(P.current);ge(r=>{let i=ee.toggleCheck(n,r,e);return j.current={value:e,checked:i.includes(e),event:t},i}),j.current=void 0}),I=m===`multiple`?void 0:m===`single`?u??null:u;y.useEffect(()=>{m===`multiple`&&u!==void 0&&r.warnOnce(`Tree:selected-with-multiple`,S)},[m,u]),y.useEffect(()=>{m===`single`&&u===void 0&&r.warnOnce(`Tree:single-without-selected`,ie)},[m,u]);let L=g!==void 0||_!==void 0;y.useEffect(()=>{m!==`multiple`&&L&&r.warnOnce(`Tree:checked-without-multiple`,re)},[m,L]);let[R,z]=y.useState(null),B=y.useRef(null),V=y.useCallback(e=>{if(!r.isDev)return()=>{};B.current??=new Map;let t=B.current,n=(t.get(e)??0)+1;return t.set(e,n),n>1&&ne(e),()=>{let n=(t.get(e)??1)-1;n>0?t.set(e,n):t.delete(e)}},[]),{containerProps:H,getTabIndex:U,focusValue:W}=f.useRovingTabIndex({activeValue:R??I??null,itemSelector:oe,orientation:`vertical`,loop:!1,typeahead:!0}),ve=y.useMemo(()=>({expanded:E,toggle:D,expand:O,activate:k,selected:I,current:d,getTabIndex:U,focusValue:W,onItemFocus:z,focusedItem:R,navigationMode:h,registerValue:V,selectionMode:m,checked:N,toggleChecked:F,registerTopLevel:_e}),[E,D,O,k,I,d,U,W,R,h,V,m,N,F,_e]),ye=p.useMergedRefs(fe,H.ref),G=e=>{e.key.length===1&&pe(e.currentTarget),H.onKeyDown(e)},K=e=>{e.key===` `&&pe(e.currentTarget),H.onKeyDownCapture(e)},q=e=>{let t=e.relatedTarget;(!t||!e.currentTarget.contains(t))&&z(null)};return(0,b.jsx)(v.TreeContext.Provider,{value:ve,children:(0,b.jsx)(v.TreeParentContext.Provider,{value:null,children:(0,b.jsx)(v.TreeCheckForcedContext.Provider,{value:!1,children:(0,b.jsx)(`div`,{role:`tree`,"data-selection-mode":m,"aria-multiselectable":m===`multiple`||void 0,className:t.cn(o.treeClassNames.root,`text-body-1`,C),...w,"data-roving-container":``,onKeyDown:a.composeEventHandlers(ce,G),onKeyDownCapture:a.composeEventHandlers(le,K),onFocus:a.composeEventHandlers(ue,H.onFocus,{checkDefaultPrevented:!1}),onBlur:a.composeEventHandlers(de,q,{checkDefaultPrevented:!1}),ref:ye,children:(0,b.jsx)(v.TreeLabelContext.Provider,{value:!1,children:se})})})})})};w.displayName=`Tree`;function pe(e){e.querySelectorAll(`[role="treeitem"]`).forEach(e=>{let t=e.querySelector(`:scope > [data-tree-row] > [data-tree-label]`);if(!t)return;let n=t.querySelector(`[data-tree-persona-name]`),r=t.getAttribute(`data-roving-text`)??n?.textContent??t.textContent??``;e.getAttribute(`data-roving-text`)!==r&&e.setAttribute(`data-roving-text`,r)})}function me(e){let t=e.target;return!t?.closest?.(`[data-tree-actions]`)&&t?.closest?.(`[role="treeitem"]`)===e.currentTarget}function he(e){let t=e.target;return t===e.currentTarget||!t?.closest?.(`[data-tree-checkbox], [data-tree-actions]`)&&t?.closest?.(`[data-tree-row]`)?.parentElement===e.currentTarget}var T=({labelledBy:e,tabStop:n,navigationMode:r,onReturn:i,children:a})=>{let s=r===`treegrid`,{containerProps:{ref:c},handleKeyDown:l,handleFocus:d}=f.useRovingTabIndex({itemSelector:C,manageTabIndex:!0,orientation:`horizontal`,loop:!s,tabStop:n}),[p,m]=y.useState(null);y.useEffect(()=>{if(p!==`leaving`)return;let e=requestAnimationFrame(()=>m(null));return()=>cancelAnimationFrame(e)},[p]);let h=e=>{d(e),m(e.currentTarget.contains(e.target)?null:`inside`)},g=e=>{if(e.currentTarget.contains(e.target))return;let t=e.relatedTarget;t instanceof Node&&e.currentTarget.contains(t)||m(`leaving`)},v=e=>{if(e.defaultPrevented||!_.isOwnEvent(e))return!1;let t=e.target,n=t.getAttribute(`aria-haspopup`);return(e.key===`ArrowDown`||e.key===`ArrowUp`)&&n!==null&&n!==`false`?(e.preventDefault(),!1):!s||e.altKey||e.ctrlKey||e.metaKey||_.isEditableTarget(t)?!1:u.getArrowIntent(e.key,{orientation:`horizontal`,dir:u.getDirection(e.currentTarget)})===`prev`};return(0,b.jsx)(`span`,{role:`toolbar`,"aria-labelledby":e,"aria-orientation":`horizontal`,"data-tree-actions":``,"data-roving-container":``,ref:c,"data-focus-in-popup":p===null?void 0:``,onKeyDown:e=>{let t=v(e);e.defaultPrevented||(l(e),t&&e.target===document.activeElement&&(e.preventDefault(),i()))},onFocus:h,onBlur:g,className:t.cn(o.treeItemClassNames.actions,`inline-flex items-center gap-1`,le),children:a})};T.displayName=`TreeItemActions`;var E=({value:e,icon:s,iconAfter:c,expandIcon:d,aside:f,actions:_,leaf:x=!1,className:ne,children:S,onClick:re,onKeyDown:ie,onFocus:ae,onBlur:oe,ref:C,...le})=>{let{"data-roving-text":pe,...D}=le,O=v.useTreeContext(`Tree.Item`),k=y.useContext(v.TreeParentContext),A=y.useContext(v.TreeLabelContext),j=O.expanded.has(e),M=l.useId(`tree-item-label`),ge=l.useId(`tree-item-aside`),N=y.useContext(v.TreeCheckForcedContext),P=y.useRef(null),_e=p.useMergedRefs(C,P),[F,I]=y.useState(null),L=y.useCallback(e=>(I(e),()=>I(t=>t===e?null:t)),[]),R=y.useMemo(()=>({registerLayout:L}),[L]),z=F?.nameId??M,{registerValue:B,registerTopLevel:V}=O;y.useEffect(()=>B(e),[B,e]),y.useEffect(()=>{A&&r.warnOnce(`Tree.Item:inside-label`,te)},[A]);let H=[],U=[],W;n.flattenChildren(S).forEach(({key:e,node:t})=>{let r=(0,b.jsx)(y.Fragment,{children:t},e);n.isElementOfType(t,E)?(W??=t.props.value,H.push(r)):n.isElementOfType(t,w)?H.push(r):U.push(r)});let ve=s&&i.slotRendersContent(s)?i.renderSlot(s,`span`,t.cn(o.treeItemClassNames.icon,`inline-flex shrink-0`),{"aria-hidden":!0}):null,ye=c&&i.slotRendersContent(c)?i.renderSlot(c,`span`,t.cn(o.treeItemClassNames.iconAfter,`inline-flex shrink-0`),{"aria-hidden":!0}):null,G=i.slotRendersContent(f),K=i.slotRendersContent(_),q=H.length>0&&!x,be=(0,b.jsx)(`span`,{className:`w-3 shrink-0`,"aria-hidden":`true`});q&&d==null?be=(0,b.jsx)(g.ChevronRightIcon,{className:t.cn(o.treeItemClassNames.expandIcon,`shrink-0 transition-transform motion-reduce:transition-none`,j?`rotate-90`:`wave-rtl:-scale-x-100`)}):q&&i.slotRendersContent(d)&&(be=i.renderSlot(d,`span`,t.cn(o.treeItemClassNames.expandIcon,`inline-flex shrink-0`),{"aria-hidden":!0}));let J=O.selectionMode===`multiple`,Y=y.useMemo(()=>J?{value:e,children:x?[]:ee.collectItems(S,{item:E,tree:w})}:null,[J,e,x,S]),X=Y?ee.computeCheckStates([Y],O.checked,N).get(e):void 0,xe=y.useRef(null);y.useLayoutEffect(()=>{xe.current=Y?{node:Y,element:P.current}:null});let Se=k===null&&!A;y.useLayoutEffect(()=>J&&Se?V(xe):void 0,[J,Se,V]);let Z=O.selected===void 0?void 0:O.selected===e,Ce=O.current!==void 0&&O.current!==null&&O.current===e,we=()=>{q&&O.toggle(e),O.activate(e)},Te=e=>{he(e)&&(re?.(e),e.defaultPrevented||we())},Ee=t=>{if(!me(t)||(ie?.(t),t.defaultPrevented||t.altKey||t.ctrlKey||t.metaKey))return;switch(t.key){case`Enter`:t.preventDefault(),we();return;case` `:t.preventDefault(),X===void 0?we():O.toggleChecked(e,t.nativeEvent);return;case`*`:{t.preventDefault();let e=t.currentTarget.parentElement?.querySelectorAll(`:scope > [role="treeitem"][aria-expanded="false"][data-roving-value]`);O.expand(Array.from(e??[],e=>e.getAttribute(`data-roving-value`)??``).filter(Boolean));return}}let n=u.getArrowIntent(t.key,{orientation:`horizontal`,dir:u.getDirection(t.currentTarget)});if(n===`next`){if(t.preventDefault(),q&&!j){O.toggle(e);return}if(O.navigationMode===`treegrid`&&fe(t.currentTarget))return;q&&W!==void 0&&O.focusValue(W)}else n===`prev`&&(t.preventDefault(),q&&j?O.toggle(e):k!==null&&O.focusValue(k))},Q=y.useRef(null),$=e=>e.target.closest(`[data-tree-actions]`)?.closest(`[role="treeitem"]`)===e.currentTarget,De=t=>{(t.target===t.currentTarget||$(t))&&O.onItemFocus(e),$(t)&&(Q.current=t.target)},Oe=e=>{$(e)&&(e.relatedTarget!==null||e.target.isConnected)&&(Q.current=null)};y.useLayoutEffect(()=>{let e=Q.current;if(!e)return;let t=P.current,n=t?.ownerDocument.activeElement;n&&n!==t.ownerDocument.body?Q.current=null:t&&!e.isConnected&&(Q.current=null,t.focus({preventScroll:!0}))});let ke=X===void 0?null:(0,b.jsx)(`span`,{role:`checkbox`,"aria-checked":X===`mixed`?`mixed`:X===`checked`,"aria-labelledby":z,tabIndex:-1,"data-tree-checkbox":``,onMouseDown:e=>{e.preventDefault(),P.current?.focus({preventScroll:!0})},onClick:t=>{O.toggleChecked(e,t.nativeEvent)},className:t.cn(o.treeItemClassNames.indicator,`relative inline-flex size-4 shrink-0 items-center justify-center rounded-xs border transition-colors motion-reduce:transition-none`,`before:absolute before:-inset-1`,X===`unchecked`?t.cn(`border-stroke-accessible bg-transparent`,h.forcedColors.control):`border-primary bg-primary text-primary-foreground forced-colors:border-[Highlight] forced-colors:bg-[Highlight]`),children:X===`mixed`?(0,b.jsx)(g.SubtractIcon,{size:12,className:h.forcedColors.selectedLeaf}):X===`checked`?(0,b.jsx)(g.CheckIcon,{size:12,className:h.forcedColors.selectedLeaf}):null}),Ae=O.selectionMode===`single`?(0,b.jsx)(`span`,{"aria-hidden":`true`,className:t.cn(o.treeItemClassNames.indicator,`inline-flex size-4 shrink-0 items-center justify-center rounded-full border transition-colors motion-reduce:transition-none`,Z?`border-2 border-primary forced-colors:border-[Highlight]`:t.cn(`border-stroke-accessible`,h.forcedColors.control)),children:Z&&(0,b.jsx)(`span`,{className:t.cn(`block size-2 rounded-full bg-primary`,h.forcedColors.selectedLeaf)})}):null,je=ke??Ae,Me=N||J&&O.checked.has(e);return(0,b.jsxs)(`div`,{role:`treeitem`,"aria-selected":Z,"aria-current":Ce?!0:void 0,"data-checked":X===`checked`?``:void 0,"data-mixed":X===`mixed`?``:void 0,className:t.cn(o.treeItemClassNames.root,`block outline-none`,`[&:focus-visible>[data-tree-row]]:outline-2 [&:focus-visible>[data-tree-row]]:-outline-offset-2 [&:focus-visible>[data-tree-row]]:outline-ring`,K&&se,K&&G&&ce,ne),...D,"aria-labelledby":D[`aria-labelledby`]??(D[`aria-label`]===void 0?z:void 0),"aria-describedby":m.joinIds(D[`aria-describedby`],G?ge:void 0,F?.descriptionId),"aria-expanded":q?j:void 0,"aria-checked":X===void 0?void 0:X===`mixed`?`mixed`:X===`checked`,tabIndex:O.getTabIndex(e),"data-roving-value":e,"data-selected":Z?``:void 0,"data-current":Ce?``:void 0,onClick:Te,onKeyDown:Ee,onFocus:e=>a.composeEventHandlers(ae,De,{checkDefaultPrevented:!1})(e),onBlur:e=>a.composeEventHandlers(oe,Oe,{checkDefaultPrevented:!1})(e),ref:_e,children:[(0,b.jsxs)(`div`,{"data-tree-row":``,className:t.cn(o.treeItemClassNames.row,`flex cursor-pointer items-center gap-1.5 rounded px-2 py-1 hover:bg-subtle-hover`,K&&`group/row`,Z&&t.cn(`bg-subtle-selected font-semibold`,h.forcedColors.selectedContainer)),children:[be,je,ve,(0,b.jsx)(`span`,{id:M,"data-tree-label":``,"data-roving-text":pe,className:t.cn(o.treeItemClassNames.label,`truncate`,(ye||G||K)&&`min-w-0`),children:(0,b.jsx)(v.TreeCheckForcedContext.Provider,{value:!1,children:(0,b.jsx)(v.TreeLabelContext.Provider,{value:!0,children:(0,b.jsx)(v.TreeItemContext.Provider,{value:R,children:U})})})}),ye,(G||K)&&(0,b.jsxs)(`span`,{"data-tree-end":``,className:t.cn(`group/end ms-auto inline-grid shrink-0 items-center gap-1`,G&&K&&de),children:[G&&(0,b.jsx)(`span`,{id:ge,"data-tree-aside":``,className:t.cn(o.treeItemClassNames.aside,`inline-flex items-center text-caption-1 text-muted-foreground`,K&&ue),children:i.materialiseSlotContent(f)}),K&&(0,b.jsx)(T,{labelledBy:z,tabStop:O.navigationMode===`tree`&&O.focusedItem===e?`last-focused`:`none`,navigationMode:O.navigationMode,onReturn:()=>O.focusValue(e),children:i.materialiseSlotContent(_)})]})]}),q&&j&&(0,b.jsx)(v.TreeParentContext.Provider,{value:e,children:(0,b.jsx)(v.TreeCheckForcedContext.Provider,{value:Me,children:(0,b.jsx)(v.TreeLabelContext.Provider,{value:!1,children:(0,b.jsx)(`div`,{role:`group`,className:t.cn(o.treeItemClassNames.group,`ps-4`),children:H})})})})]})};E.displayName=`TreeItem`,exports.TreeItem=E,exports.TreeRoot=w;
2
+ //# sourceMappingURL=Tree.core.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Tree.core.cjs","names":["isHiddenInput","isHiddenByCss","React","useControllable","useEventCallback","toggleCheck","isDev","useRovingTabIndex","useMergedRefs","TreeContext","TreeParentContext","TreeCheckForcedContext","cn","treeClassNames","composeEventHandlers","TreeLabelContext","isOwnEvent","isEditableTarget","getArrowIntent","getDirection","treeItemClassNames","useTreeContext","useId","isElementOfType","slotRendersContent","renderSlot","ChevronRightIcon","collectItems","computeCheckStates","forcedColors","SubtractIcon","CheckIcon","joinIds","TreeItemContext","materialiseSlotContent","require_runtime","require_cn","require_children","require_dev","require_slot","require_composeEventHandlers","require_classNames","require_useEventCallback","require_useControllable","require_useId","require_direction","require_focus","require_useRovingTabIndex","require_useMergedRefs","require_aria","require_styles","require_icons","require_events","require_Tree_context","require_Tree_selection","react","react_jsx_runtime","EMPTY","ITEM_IN_LABEL_MESSAGE","warnDuplicateValue","value","SELECTED_WITH_MULTIPLE_MESSAGE","CHECKED_WITHOUT_MULTIPLE_MESSAGE","SINGLE_WITHOUT_SELECTED_MESSAGE","forestInTreeOrder","entries","entry","a","b","TREE_ITEM_SELECTOR","ACTION_ITEM_SELECTOR","ACTIONS_ON_ITEM_FOCUS","ASIDE_OFF_ON_ITEM_FOCUS","ACTIONS_VISIBILITY","ASIDE_OFF_WITH_ACTIONS","END_CELL_SHARED","focusFirstAction","toolbar","item","cssHidden","el","concealed","marker","TreeRoot","rest","initialExpanded","defaultExpandedItems","expandedList","setExpandedList","expandedItems","onExpandedItemsChange","next","expanded","toggle","prev","v","expand","added","values","activate","onItemSelect","initialChecked","defaultCheckedItems","pendingDetails","checkedList","setCheckedList","checkedItems","onCheckedItemsChange","checked","topLevel","registerTopLevel","toggleChecked","forest","previous","effectiveSelected","selectionMode","selected","hasCheckedProps","focusedItem","setFocusedItem","valueCounts","registerValue","counts","count","remaining","context","current","getTabIndex","focusValue","navigationMode","mergedRef","ref","containerProps","handleKeyDown","event","syncTypeaheadText","handleKeyDownCapture","handleBlur","className","onKeyDown","onKeyDownCapture","onFocus","onBlur","tree","label","treeitem","personaName","text","isOwnKeyEvent","target","isOwnClick","TreeItemActions","treegrid","rovingRef","rovingKeyDown","rovingFocus","popupFocus","setPopupFocus","frame","handleToolbarFocus","handleToolbarBlur","popup","labelledBy","isPrev","onReturn","TreeItem","props","typeaheadText","ctx","parent","insideLabel","isExpanded","labelId","asideId","ancestorListed","itemRef","layoutIds","setLayoutIds","registerLayout","ids","itemContext","nameId","nestedItems","labelContent","firstChildValue","children","child","keyed","key","iconNode","icon","iconAfterNode","iconAfter","hasAside","aside","hasActions","actions","hasChildren","leaf","chevron","expandIcon","multiple","ownNode","checkState","selectionEntry","isTopLevel","isSelected","isCurrent","handleClick","onClick","siblings","intent","focusedAction","inOwnActions","handleFocus","handleActionsBlur","action","active","checkbox","radio","indicator","groupListed"],"sources":["../../../src/components/layout/Tree.core.tsx"],"sourcesContent":["import * as React from 'react';\nimport { joinIds } from '../../lib/aria';\nimport { flattenChildren, isElementOfType } from '../../lib/children';\nimport { treeClassNames, treeItemClassNames } from '../../lib/classNames';\nimport { cn } from '../../lib/cn';\nimport { composeEventHandlers } from '../../lib/composeEventHandlers';\nimport { isDev, warnOnce } from '../../lib/dev';\nimport { getArrowIntent, getDirection } from '../../lib/direction';\nimport { isEditableTarget, isOwnEvent } from '../../lib/events';\nimport { isHiddenInput } from '../../lib/focus';\nimport { CheckIcon, ChevronRightIcon, SubtractIcon } from '../../lib/icons';\nimport type { SelectionMode } from '../../lib/types';\nimport { materialiseSlotContent, renderSlot, slotRendersContent, type Slot } from '../../lib/slot';\nimport { forcedColors } from '../../lib/styles';\nimport { useControllable } from '../../hooks/useControllable';\nimport { useEventCallback } from '../../hooks/useEventCallback';\nimport { useId } from '../../hooks/useId';\nimport { useMergedRefs } from '../../hooks/useMergedRefs';\nimport { isHiddenByCss, useRovingTabIndex } from '../../hooks/useRovingTabIndex';\nimport {\n TreeCheckForcedContext,\n TreeContext,\n TreeItemContext,\n TreeLabelContext,\n TreeParentContext,\n useTreeContext,\n type PersonaLayoutIds,\n type TreeContextValue,\n type TreeItemContextValue,\n type TreeSelectionEntry,\n} from './Tree.context';\nimport {\n collectItems,\n computeCheckStates,\n toggleCheck,\n type CheckState,\n type TreeNode,\n} from './Tree.selection';\n\nconst EMPTY: readonly string[] = [];\n\nconst ITEM_IN_LABEL_MESSAGE =\n 'Tree.Item was rendered inside the label of another Tree.Item, so it is not part of that ' +\n \"item's child group: the parent cannot expand, its name includes the nested text, and a \" +\n 'treeitem sits inside a label (axe aria-required-parent). A Tree.Item finds its nested items ' +\n 'among its own children (written directly, in Fragments, or returned by a render function such ' +\n 'as `children.map(renderNode)`), but not inside a component that renders Tree.Item itself. ' +\n 'Build a data-driven tree with a render function instead of a recursive component.';\n\nfunction warnDuplicateValue(value: string): void {\n warnOnce(\n `Tree:duplicate:${value}`,\n `Tree: several items share the value \"${value}\". Item values must be unique within a Tree; ` +\n 'items with the same value share their expanded, selected and focus state.',\n );\n}\n\nconst SELECTED_WITH_MULTIPLE_MESSAGE =\n 'Tree: `selected` has no effect with selectionMode=\"multiple\"; use `checkedItems`, and ' +\n '`current` for the item the user is on.';\n\nconst CHECKED_WITHOUT_MULTIPLE_MESSAGE =\n 'Tree: `checkedItems` and `defaultCheckedItems` need selectionMode=\"multiple\"; without it the ' +\n 'tree draws no checkboxes and ignores them.';\n\nconst SINGLE_WITHOUT_SELECTED_MESSAGE =\n 'Tree: selectionMode=\"single\" draws a radio on every item for `selected`; pass `selected` ' +\n '(null while nothing is selected) and update it from `onItemSelect`.';\n\n/** The registered top-level subtrees in document order, which is the tree order of their items. */\nfunction forestInTreeOrder(\n entries: ReadonlySet<React.RefObject<TreeSelectionEntry | null>> | null,\n): TreeNode[] {\n if (!entries) return [];\n return Array.from(entries, (entry) => entry.current)\n .filter((entry): entry is TreeSelectionEntry => entry !== null)\n .sort((a, b) => {\n if (!a.element || !b.element || a.element === b.element) return 0;\n return a.element.compareDocumentPosition(b.element) & Node.DOCUMENT_POSITION_FOLLOWING\n ? -1\n : 1;\n })\n .map((entry) => entry.node);\n}\n\n/**\n * The tree's own items for the tab stop and the arrow keys: the treeitems. A row's actions are a\n * roving container of their own, which the default selector would count as one more item.\n */\nconst TREE_ITEM_SELECTOR = '[role=\"treeitem\"]';\n\n/** Every focusable control a row's actions can hold (Toolbar's rule). */\nconst ACTION_ITEM_SELECTOR = 'button, [href], input, select, textarea, [role=\"button\"], [tabindex]';\n\n/**\n * Shows a row's actions while focus is on its item (also after a click) or inside the item's own\n * row, never in its child group, so Tab and the treegrid arrows reach them. The item's\n * `:focus-within`, not its `:focus`: while focus moves from the item into an action, Chromium has\n * already ended the item's `:focus` (but keeps `:focus-within` on it, the common ancestor) when it\n * checks that the action can take focus, and a hidden action refuses it.\n */\nconst ACTIONS_ON_ITEM_FOCUS =\n '[&:focus-within:not(:has(>[role=group]_:focus))>[data-tree-row]_[data-tree-actions]]:visible';\n\n/** Makes the aside invisible while its actions show for focus, where they take its place. */\nconst ASIDE_OFF_ON_ITEM_FOCUS =\n '[@media(hover:hover)]:not-forced-colors:[&:focus-within:not(:has(>[role=group]_:focus))>[data-tree-row]_[data-tree-aside]]:invisible';\n\n/**\n * The actions stay invisible until the row is hovered or the item or an action has focus, and\n * always show in forced colors and without hover (touch). An invisible action takes no focus.\n * They also show while a surface opened from an action is open (its trigger is expanded) and\n * while focus is in such a surface (`data-focus-in-popup`), so the surface's focus return, which\n * runs after its trigger already reports it closed, reaches the action.\n */\nconst ACTIONS_VISIBILITY =\n 'invisible group-hover/row:visible focus-within:visible forced-colors:visible [@media(hover:none)]:visible has-[[aria-expanded=true]]:visible data-[focus-in-popup]:visible';\n\n/** The aside gives way to the actions where the two share one place. */\nconst ASIDE_OFF_WITH_ACTIONS =\n 'not-forced-colors:group-hover/row:invisible [@media(hover:hover)]:not-forced-colors:group-focus-within/end:invisible [@media(hover:hover)]:not-forced-colors:group-has-[[aria-expanded=true]]/end:invisible [@media(hover:hover)]:not-forced-colors:group-has-[[data-focus-in-popup]]/end:invisible';\n\n/** Aside and actions share one cell, and sit side by side where the actions always show. */\nconst END_CELL_SHARED = '[&>*]:[grid-area:1/1] forced-colors:flex [@media(hover:none)]:flex';\n\n/**\n * Focuses the first action of an item's own row that takes focus, trying them in order and\n * skipping what the roving hook skips: natively disabled, marked `data-roving-disabled`,\n * `aria-disabled` unless focusable-disabled, hidden form inputs, anything inside a `hidden` or\n * `inert` element of the toolbar, and what CSS hides (the hook's own `isHiddenByCss`). `false` when\n * focus did not move into the row's actions.\n */\nfunction focusFirstAction(item: HTMLElement): boolean {\n const toolbar = item.querySelector<HTMLElement>(':scope > [data-tree-row] [data-tree-actions]');\n if (!toolbar) return false;\n const cssHidden = new Map<Element, boolean>();\n for (const el of Array.from(toolbar.querySelectorAll<HTMLElement>(ACTION_ITEM_SELECTOR))) {\n if (isHiddenInput(el) || el.matches(':disabled')) continue;\n const concealed = el.closest('[hidden], [inert]');\n if (concealed && toolbar.contains(concealed)) continue;\n const marker = el.getAttribute('data-roving-disabled');\n if (marker !== null && marker !== 'false') continue;\n if (\n el.getAttribute('aria-disabled') === 'true' &&\n !el.hasAttribute('data-disabled-focusable')\n ) {\n continue;\n }\n if (isHiddenByCss(el, toolbar, cssHidden)) continue;\n el.focus();\n if (el.ownerDocument.activeElement === el) return true;\n }\n return false;\n}\n\n/* ------------------------------------------------------------------ */\n/* Tree */\n/* ------------------------------------------------------------------ */\n\n/** The second argument of `onCheckedItemsChange`. */\nexport interface TreeCheckedItemsChangeDetails {\n /** The item that was toggled. */\n value: string;\n /** Its new state (a toggle never leaves it mixed). */\n checked: boolean;\n /** The DOM event of the toggle: a keyboard event for Space, a mouse event for a click. */\n event: Event;\n}\n\n/** Properties for the Tree component. */\nexport interface TreeProps extends React.HTMLAttributes<HTMLDivElement> {\n /** Controlled list of expanded item values. */\n expandedItems?: readonly string[];\n /**\n * Item values that are expanded initially (uncontrolled).\n * @default []\n */\n defaultExpandedItems?: readonly string[];\n /** Called with the new list of expanded item values when an item expands or collapses. */\n onExpandedItemsChange?: (expandedItems: string[]) => void;\n /**\n * Called with an item's value every time it is activated (a click on its row, Enter, or Space\n * unless the tree has checkboxes), also when the same item is activated again.\n */\n onItemSelect?: (value: string) => void;\n /**\n * Value of the selected item. When set (also to `null`), every item carries `aria-selected`, and\n * the selected item is where keyboard focus enters the tree. It has no effect with\n * `selectionMode=\"multiple\"` (a development warning): items carry `aria-checked` instead. With\n * `selectionMode=\"single\"` every item carries `aria-selected` even while it is not set (a\n * development warning: the radios need it).\n */\n selected?: string | null;\n /** Value of the current item (for example the open page): it gets `aria-current=\"true\"`. */\n current?: string | null;\n /**\n * How items are selected. `'none'`: activation only (0.7; `selected` highlights one item).\n * `'single'`: a radio indicator on every item for `selected`/`onItemSelect`. `'multiple'`: a\n * checkbox on every item, bound to `checkedItems`; checking an item checks its descendants, and a\n * parent shows checked, mixed or unchecked from them. Fluent's `'multiselect'` is `'multiple'`.\n * @default 'none'\n */\n selectionMode?: 'none' | SelectionMode;\n /** Controlled checked items (`selectionMode=\"multiple\"`); see the cascade rule in the component docs. */\n checkedItems?: readonly string[];\n /**\n * Initially checked items (uncontrolled).\n * @default []\n */\n defaultCheckedItems?: readonly string[];\n /**\n * Called with every checked item (in tree order) when a check changes (Fluent's `onCheckedChange`).\n * WaveUI always passes `details`; it is typed optional until 1.0.\n */\n onCheckedItemsChange?: (checkedItems: string[], details?: TreeCheckedItemsChangeDetails) => void;\n /**\n * `'tree'`: Tab from a focused item enters its actions. `'treegrid'`: the \"next\" arrow\n * (ArrowRight, ArrowLeft in RTL) moves into an item's actions and \"previous\" returns; on an\n * expanded parent \"next\" no longer moves to the first child (ArrowDown does). The roles stay\n * `tree` and `treeitem` (Fluent's `navigationMode`).\n * @default 'tree'\n */\n navigationMode?: 'tree' | 'treegrid';\n /** Ref to the `role=\"tree\"` element. */\n ref?: React.Ref<HTMLDivElement>;\n}\n\nexport const TreeRoot = ({\n expandedItems,\n defaultExpandedItems,\n onExpandedItemsChange,\n onItemSelect,\n selected,\n current,\n selectionMode = 'none',\n navigationMode = 'tree',\n checkedItems,\n defaultCheckedItems,\n onCheckedItemsChange,\n className,\n children,\n onKeyDown,\n onKeyDownCapture,\n onFocus,\n onBlur,\n ref,\n ...rest\n}: TreeProps) => {\n const [initialExpanded] = React.useState<readonly string[]>(() => defaultExpandedItems ?? EMPTY);\n const [expandedList, setExpandedList] = useControllable<readonly string[]>(\n expandedItems,\n initialExpanded,\n (next) => onExpandedItemsChange?.([...next]),\n );\n const expanded = React.useMemo(() => new Set(expandedList), [expandedList]);\n\n const toggle = React.useCallback(\n (value: string) => {\n setExpandedList((prev) =>\n prev.includes(value) ? prev.filter((v) => v !== value) : [...prev, value],\n );\n },\n [setExpandedList],\n );\n\n const expand = React.useCallback(\n (values: readonly string[]) => {\n setExpandedList((prev) => {\n const added = values.filter((v) => !prev.includes(v));\n return added.length > 0 ? [...prev, ...added] : prev;\n });\n },\n [setExpandedList],\n );\n\n const activate = useEventCallback((value: string) => {\n onItemSelect?.(value);\n });\n\n // Checked items (`selectionMode=\"multiple\"`). useControllable passes the value only, so a toggle\n // hands `details` to the change callback through a ref it writes and clears in the same event.\n const [initialChecked] = React.useState<readonly string[]>(() => defaultCheckedItems ?? EMPTY);\n const pendingDetails = React.useRef<TreeCheckedItemsChangeDetails | undefined>(undefined);\n const [checkedList, setCheckedList] = useControllable<readonly string[]>(\n checkedItems,\n initialChecked,\n (next) => onCheckedItemsChange?.([...next], pendingDetails.current),\n );\n const checked = React.useMemo(() => new Set(checkedList), [checkedList]);\n\n // The top-level items' subtrees (each item scans its own children), read when a check toggles:\n // they give the emitted list its tree order.\n const topLevel = React.useRef<Set<React.RefObject<TreeSelectionEntry | null>> | null>(null);\n const registerTopLevel = React.useCallback(\n (entry: React.RefObject<TreeSelectionEntry | null>) => {\n topLevel.current ??= new Set();\n const entries = topLevel.current;\n entries.add(entry);\n return () => {\n entries.delete(entry);\n };\n },\n [],\n );\n const toggleChecked = useEventCallback((value: string, event: Event) => {\n const forest = forestInTreeOrder(topLevel.current);\n setCheckedList((previous) => {\n const next = toggleCheck(forest, previous, value);\n pendingDetails.current = { value, checked: next.includes(value), event };\n return next;\n });\n pendingDetails.current = undefined;\n });\n\n // An item carries aria-checked or aria-selected, never both (APG); in single mode every item\n // carries aria-selected from the first render, so the radios and the state agree.\n const effectiveSelected =\n selectionMode === 'multiple'\n ? undefined\n : selectionMode === 'single'\n ? (selected ?? null)\n : selected;\n\n React.useEffect(() => {\n if (selectionMode === 'multiple' && selected !== undefined) {\n warnOnce('Tree:selected-with-multiple', SELECTED_WITH_MULTIPLE_MESSAGE);\n }\n }, [selectionMode, selected]);\n React.useEffect(() => {\n if (selectionMode === 'single' && selected === undefined) {\n warnOnce('Tree:single-without-selected', SINGLE_WITHOUT_SELECTED_MESSAGE);\n }\n }, [selectionMode, selected]);\n const hasCheckedProps = checkedItems !== undefined || defaultCheckedItems !== undefined;\n React.useEffect(() => {\n if (selectionMode !== 'multiple' && hasCheckedProps) {\n warnOnce('Tree:checked-without-multiple', CHECKED_WITHOUT_MULTIPLE_MESSAGE);\n }\n }, [selectionMode, hasCheckedProps]);\n\n // The item that has focus while focus is inside the tree: it holds the tab stop, so Shift+Tab\n // leaves the tree. Cleared when focus leaves; the next entry goes to `selected`, else the first.\n const [focusedItem, setFocusedItem] = React.useState<string | null>(null);\n\n // How many mounted items carry each value (written from the items' effects only).\n const valueCounts = React.useRef<Map<string, number> | null>(null);\n const registerValue = React.useCallback((value: string) => {\n if (!isDev) return () => {};\n valueCounts.current ??= new Map();\n const counts = valueCounts.current;\n const count = (counts.get(value) ?? 0) + 1;\n counts.set(value, count);\n if (count > 1) warnDuplicateValue(value);\n return () => {\n const remaining = (counts.get(value) ?? 1) - 1;\n if (remaining > 0) counts.set(value, remaining);\n else counts.delete(value);\n };\n }, []);\n\n const { containerProps, getTabIndex, focusValue } = useRovingTabIndex({\n activeValue: focusedItem ?? effectiveSelected ?? null,\n itemSelector: TREE_ITEM_SELECTOR,\n orientation: 'vertical',\n loop: false,\n typeahead: true,\n });\n\n const context = React.useMemo<TreeContextValue>(\n () => ({\n expanded,\n toggle,\n expand,\n activate,\n selected: effectiveSelected,\n current,\n getTabIndex,\n focusValue,\n onItemFocus: setFocusedItem,\n focusedItem,\n navigationMode,\n registerValue,\n selectionMode,\n checked,\n toggleChecked,\n registerTopLevel,\n }),\n [\n expanded,\n toggle,\n expand,\n activate,\n effectiveSelected,\n current,\n getTabIndex,\n focusValue,\n focusedItem,\n navigationMode,\n registerValue,\n selectionMode,\n checked,\n toggleChecked,\n registerTopLevel,\n ],\n );\n\n const mergedRef = useMergedRefs<HTMLDivElement>(ref, containerProps.ref);\n\n const handleKeyDown = (event: React.KeyboardEvent<HTMLDivElement>) => {\n // Typeahead reads `data-roving-text` at key time: fill it from each item's label first.\n if (event.key.length === 1) syncTypeaheadText(event.currentTarget);\n containerProps.onKeyDown(event);\n };\n\n // A Space that continues a search is typeahead too, taken before the item would activate on it.\n const handleKeyDownCapture = (event: React.KeyboardEvent<HTMLDivElement>) => {\n if (event.key === ' ') syncTypeaheadText(event.currentTarget);\n containerProps.onKeyDownCapture(event);\n };\n\n const handleBlur = (event: React.FocusEvent<HTMLDivElement>) => {\n const next = event.relatedTarget as Node | null;\n if (!next || !event.currentTarget.contains(next)) setFocusedItem(null);\n };\n\n return (\n <TreeContext.Provider value={context}>\n <TreeParentContext.Provider value={null}>\n <TreeCheckForcedContext.Provider value={false}>\n <div\n role=\"tree\"\n data-selection-mode={selectionMode}\n aria-multiselectable={selectionMode === 'multiple' ? true : undefined}\n className={cn(treeClassNames.root, 'text-body-1', className)}\n {...rest}\n data-roving-container=\"\"\n onKeyDown={composeEventHandlers(onKeyDown, handleKeyDown)}\n onKeyDownCapture={composeEventHandlers(onKeyDownCapture, handleKeyDownCapture)}\n onFocus={composeEventHandlers(onFocus, containerProps.onFocus, {\n checkDefaultPrevented: false,\n })}\n onBlur={composeEventHandlers(onBlur, handleBlur, { checkDefaultPrevented: false })}\n ref={mergedRef}\n >\n {/* A Tree has its own items, also when it renders inside a label (a portaled popup). */}\n <TreeLabelContext.Provider value={false}>{children}</TreeLabelContext.Provider>\n </div>\n </TreeCheckForcedContext.Provider>\n </TreeParentContext.Provider>\n </TreeContext.Provider>\n );\n};\nTreeRoot.displayName = 'Tree';\n\n/* ------------------------------------------------------------------ */\n/* Tree.Item */\n/* ------------------------------------------------------------------ */\n\n/** Properties for the TreeItem sub-component. */\nexport interface TreeItemProps extends React.HTMLAttributes<HTMLDivElement> {\n /** Unique value identifying this tree item. */\n value: string;\n /**\n * Icon displayed before the label. Rendered in a `<span>` hidden from assistive technology\n * (`aria-hidden`); pass a slot object (`{ className, children, … }`) to customise it. A falsy\n * icon (`''`, `0`) or a list of nothing renders no span.\n */\n icon?: Slot<'span'>;\n /** Icon after the label (decorative, `aria-hidden`; a falsy value renders nothing, as `icon`). */\n iconAfter?: Slot<'span'>;\n /**\n * Replaces the expand chevron (decorative). `null`/`undefined` keep the chevron; `false`, or\n * anything that renders nothing, hides it (`aria-expanded` still reports the state). Not rotated.\n */\n expandIcon?: Slot<'span'>;\n /**\n * Non-interactive content at the end of the row, such as a count or a badge. It describes the item\n * (`aria-describedby`); it hides while the actions show on hover or focus.\n */\n aside?: React.ReactNode;\n /**\n * Buttons at the end of the row (a toolbar named by the item's label). Shown while the row is\n * hovered or the item or its actions have focus, and always in forced colors and without hover\n * (touch). Tab reaches them from the focused item (`navigationMode=\"tree\"`), or the arrow keys do\n * (`\"treegrid\"`). Keys and clicks on them never activate or check the item.\n *\n * They also stay shown while a Menu, Popover or Dialog rendered inside them holds focus or its\n * trigger among them is expanded, so its focus return reaches the action. A dialog your app\n * renders elsewhere and opens from an action through state (a \"Delete…\" menu item that opens a\n * confirm Dialog) closes after the actions have hidden again (on devices with hover, outside\n * forced colors): a hidden action cannot take focus, so focus returns to the nearest element\n * that can, normally the item. Render such a Dialog inside `actions` (its `Dialog.Trigger`\n * there, or the controlled Dialog next to the Menu that opens it) to return focus to the action;\n * `finalFocusRef` cannot name it, since it is still hidden when the dialog closes.\n */\n actions?: React.ReactNode;\n /**\n * Renders the item as a leaf even when it has nested `Tree.Item`s: they are not rendered, and\n * the item has no `aria-expanded` and does not expand. An item is expandable only while it has\n * nested items, so `leaf={false}` does not make an item without them expandable. To load the\n * children on first expansion, give the item a placeholder child (a \"Loading…\" `Tree.Item`)\n * until they arrive.\n * @default false\n */\n leaf?: boolean;\n /** Ref to the `role=\"treeitem\"` element. */\n ref?: React.Ref<HTMLDivElement>;\n}\n\n/**\n * Sets the typeahead text (`data-roving-text`, read by the roving hook) of every rendered\n * treeitem to the text of its label (a persona layout's name when the label holds one), so neither\n * the icon nor the nested items take part. A consumer `data-roving-text` on a Tree.Item is kept on\n * its label and wins.\n */\nfunction syncTypeaheadText(tree: HTMLElement): void {\n tree.querySelectorAll<HTMLElement>('[role=\"treeitem\"]').forEach((treeitem) => {\n const label = treeitem.querySelector<HTMLElement>(\n ':scope > [data-tree-row] > [data-tree-label]',\n );\n if (!label) return;\n // A persona layout's name is the item's name, so it is its typeahead text too (not the media,\n // such as an avatar's initials, or the description).\n const personaName = label.querySelector<HTMLElement>('[data-tree-persona-name]');\n const text =\n label.getAttribute('data-roving-text') ?? personaName?.textContent ?? label.textContent ?? '';\n if (treeitem.getAttribute('data-roving-text') !== text) {\n treeitem.setAttribute('data-roving-text', text);\n }\n });\n}\n\n/**\n * Whether a keyboard event belongs to this treeitem: its target (the focused element) is this\n * treeitem or inside its row, not a nested item and not the row's actions (their keys are theirs).\n */\nfunction isOwnKeyEvent(event: React.KeyboardEvent<HTMLElement>): boolean {\n const target = event.target as Element | null;\n if (target?.closest?.('[data-tree-actions]')) return false;\n return target?.closest?.('[role=\"treeitem\"]') === event.currentTarget;\n}\n\n/**\n * Whether a click landed on this treeitem's own row (or on the treeitem element itself). Clicks\n * in its child group, including the indentation gutter beside the nested rows, clicks on nested\n * items, on its checkbox and on its actions are not its own.\n */\nfunction isOwnClick(event: React.MouseEvent<HTMLElement>): boolean {\n const target = event.target as Element | null;\n if (target === event.currentTarget) return true;\n if (target?.closest?.('[data-tree-checkbox], [data-tree-actions]')) return false;\n return target?.closest?.('[data-tree-row]')?.parentElement === event.currentTarget;\n}\n\ninterface TreeItemActionsProps {\n /** Id of the element that names the item. */\n labelledBy: string;\n /**\n * `'last-focused'` while the actions hold a Tab stop (their item has focus, tree mode), else\n * `'none'`.\n */\n tabStop: 'last-focused' | 'none';\n /** `'treegrid'`: the arrows do not wrap, and \"previous\" on the first action returns to the item. */\n navigationMode: 'tree' | 'treegrid';\n /** Moves focus back to the item. */\n onReturn: () => void;\n children: React.ReactNode;\n}\n\n/**\n * A row's actions: the consumer's controls rove with the arrow keys and hold at most one Tab\n * stop. A key pressed on an action is the action's: ArrowDown and ArrowUp on an action that opens\n * a popup (`aria-haspopup`) never move focus to another item. In treegrid navigation, \"previous\"\n * on the first action returns to the item.\n */\nconst TreeItemActions = ({\n labelledBy,\n tabStop,\n navigationMode,\n onReturn,\n children,\n}: TreeItemActionsProps) => {\n const treegrid = navigationMode === 'treegrid';\n const {\n containerProps: { ref: rovingRef },\n handleKeyDown: rovingKeyDown,\n handleFocus: rovingFocus,\n } = useRovingTabIndex({\n itemSelector: ACTION_ITEM_SELECTOR,\n manageTabIndex: true,\n orientation: 'horizontal',\n loop: !treegrid,\n tabStop,\n });\n\n // Focus in a surface opened from an action (a Menu, Popover or Dialog rendered in a portal, whose\n // focus events reach the toolbar through the React tree): `'inside'`. Once focus leaves such a\n // surface for anywhere but the toolbar, `'leaving'` until the next frame, because the surface's\n // focus return comes later in that close (its layout phase, or a microtask).\n const [popupFocus, setPopupFocus] = React.useState<'inside' | 'leaving' | null>(null);\n React.useEffect(() => {\n if (popupFocus !== 'leaving') return;\n const frame = requestAnimationFrame(() => setPopupFocus(null));\n return () => cancelAnimationFrame(frame);\n }, [popupFocus]);\n\n const handleToolbarFocus = (event: React.FocusEvent<HTMLSpanElement>) => {\n rovingFocus(event);\n setPopupFocus(event.currentTarget.contains(event.target) ? null : 'inside');\n };\n\n const handleToolbarBlur = (event: React.FocusEvent<HTMLSpanElement>) => {\n // An action's own blur: its focus-within reveal decides.\n if (event.currentTarget.contains(event.target)) return;\n const next = event.relatedTarget;\n // Back to an action: its focus clears the hold.\n if (next instanceof Node && event.currentTarget.contains(next)) return;\n setPopupFocus('leaving');\n };\n\n /** Whether the key is treegrid's \"previous\" for an action (the roving order settles it). */\n const handleKeyDown = (event: React.KeyboardEvent<HTMLSpanElement>): boolean => {\n // A key from a popup an action opened reaches here through the React tree: not ours.\n if (event.defaultPrevented || !isOwnEvent(event)) return false;\n const target = event.target as HTMLElement;\n const popup = target.getAttribute('aria-haspopup');\n if (\n (event.key === 'ArrowDown' || event.key === 'ArrowUp') &&\n popup !== null &&\n popup !== 'false'\n ) {\n event.preventDefault();\n return false;\n }\n if (!treegrid || event.altKey || event.ctrlKey || event.metaKey || isEditableTarget(target)) {\n return false;\n }\n const intent = getArrowIntent(event.key, {\n orientation: 'horizontal',\n dir: getDirection(event.currentTarget),\n });\n return intent === 'prev';\n };\n\n const handleToolbarKeyDown = (event: React.KeyboardEvent<HTMLSpanElement>) => {\n const isPrev = handleKeyDown(event);\n if (event.defaultPrevented) return;\n rovingKeyDown(event);\n // \"Previous\" that the roving order did not take (the first action it reaches) returns.\n if (isPrev && event.target === document.activeElement) {\n event.preventDefault();\n onReturn();\n }\n };\n\n return (\n <span\n role=\"toolbar\"\n aria-labelledby={labelledBy}\n aria-orientation=\"horizontal\"\n data-tree-actions=\"\"\n data-roving-container=\"\"\n ref={rovingRef}\n data-focus-in-popup={popupFocus === null ? undefined : ''}\n onKeyDown={handleToolbarKeyDown}\n onFocus={handleToolbarFocus}\n onBlur={handleToolbarBlur}\n className={cn(\n treeItemClassNames.actions,\n 'inline-flex items-center gap-1',\n ACTIONS_VISIBILITY,\n )}\n >\n {children}\n </span>\n );\n};\nTreeItemActions.displayName = 'TreeItemActions';\n\n/**\n * One node of a Tree. Text and other content are the label; nested `Tree.Item` children form its\n * child group, which is shown while the item is expanded.\n *\n * Nested items must be `Tree.Item` elements among the item's own children: written directly, in\n * Fragments, or returned by a render function (`{node.children.map(renderNode)}`). A component\n * that renders `Tree.Item` itself (a recursive `<NodeView node={child} />`) is not recognised:\n * its output becomes part of the label, so the parent cannot expand (a development warning names\n * this). Render data-driven trees with a render function instead. The checks of a\n * `selectionMode=\"multiple\"` tree cascade by the same rule, so an item that such a component\n * renders is not checked with its parent.\n *\n * `ref` and every other prop land on the `role=\"treeitem\"` element, which contains the label row\n * and the child group. Its `onClick` receives only clicks on its own row (not on its child group\n * or nested items) and its `onKeyDown` only keys pressed while focus is on it or in its row; both\n * run before the built-in behaviour (call `event.preventDefault()` to skip it). In a checkbox\n * tree, a click on the item's checkbox toggles its check and is not passed to `onClick`, and\n * neither is a click on its actions; `onKeyDown` receives no keys pressed in the actions. Its\n * other event handlers (`onFocus`, `onDoubleClick`, `onContextMenu` and the rest) are not\n * filtered: as DOM events bubble, they also receive events from its child group and nested items\n * (compare `event.target` with `event.currentTarget` to tell them apart).\n *\n * `actions` render in a toolbar at the end of the row, named by the item; keys and clicks on them\n * belong to them and never activate or check the item. `aside` sits before them and describes the\n * item.\n *\n * The item is named by its label (`aria-labelledby`), not by its icon or nested items; an\n * `aria-label` or `aria-labelledby` prop replaces that name. Typeahead matches the label text too\n * (a `data-roving-text` prop replaces it).\n */\nexport const TreeItem = ({\n value,\n icon,\n iconAfter,\n expandIcon,\n aside,\n actions,\n leaf = false,\n className,\n children,\n onClick,\n onKeyDown,\n onFocus,\n onBlur,\n ref,\n ...props\n}: TreeItemProps) => {\n const { 'data-roving-text': typeaheadText, ...rest } = props as typeof props & {\n 'data-roving-text'?: string;\n };\n const ctx = useTreeContext('Tree.Item');\n const parent = React.useContext(TreeParentContext);\n const insideLabel = React.useContext(TreeLabelContext);\n const isExpanded = ctx.expanded.has(value);\n const labelId = useId('tree-item-label');\n const asideId = useId('tree-item-aside');\n const ancestorListed = React.useContext(TreeCheckForcedContext);\n const itemRef = React.useRef<HTMLDivElement>(null);\n const mergedRef = useMergedRefs<HTMLDivElement>(ref, itemRef);\n // A Tree.ItemPersonaLayout in the label registers its name and description: the item is named\n // by the name only and described by the description.\n const [layoutIds, setLayoutIds] = React.useState<PersonaLayoutIds | null>(null);\n const registerLayout = React.useCallback((ids: PersonaLayoutIds) => {\n setLayoutIds(ids);\n return () => setLayoutIds((current) => (current === ids ? null : current));\n }, []);\n const itemContext = React.useMemo<TreeItemContextValue>(\n () => ({ registerLayout }),\n [registerLayout],\n );\n const nameId = layoutIds?.nameId ?? labelId;\n\n const { registerValue, registerTopLevel } = ctx;\n React.useEffect(() => registerValue(value), [registerValue, value]);\n React.useEffect(() => {\n if (insideLabel) warnOnce('Tree.Item:inside-label', ITEM_IN_LABEL_MESSAGE);\n }, [insideLabel]);\n\n // Nested Tree.Items (and, as in 0.4, nested Trees) form the child group; the rest is the label.\n // Parts are identified through their element type, so parts written in a Server Component\n // (lazy references) count too.\n const nestedItems: React.ReactNode[] = [];\n const labelContent: React.ReactNode[] = [];\n let firstChildValue: string | undefined;\n flattenChildren(children).forEach(({ key, node: child }) => {\n const keyed = <React.Fragment key={key}>{child}</React.Fragment>;\n if (isElementOfType<TreeItemProps>(child, TreeItem)) {\n firstChildValue ??= child.props.value;\n nestedItems.push(keyed);\n } else if (isElementOfType(child, TreeRoot)) {\n nestedItems.push(keyed);\n } else {\n labelContent.push(keyed);\n }\n });\n\n // A falsy icon (`icon={name && <Icon />}` with `name` '' or a count of 0) is no icon, as in 0.4\n // and as in Avatar, and so is a collection whose items render nothing: no empty span adds a gap\n // to the row. The check does not consume a generator: renderSlot still renders its items.\n const iconNode =\n icon && slotRendersContent(icon)\n ? renderSlot(icon, 'span', cn(treeItemClassNames.icon, 'inline-flex shrink-0'), {\n 'aria-hidden': true,\n })\n : null;\n const iconAfterNode =\n iconAfter && slotRendersContent(iconAfter)\n ? renderSlot(iconAfter, 'span', cn(treeItemClassNames.iconAfter, 'inline-flex shrink-0'), {\n 'aria-hidden': true,\n })\n : null;\n // No empty aside and no empty toolbar (`actions={cond && <Button />}` with `cond` false).\n const hasAside = slotRendersContent(aside);\n const hasActions = slotRendersContent(actions);\n const hasChildren = nestedItems.length > 0 && !leaf;\n\n // The optional-indicator slot rule (C-SLOTS): `null`/`undefined` keep the chevron, `false` or\n // content that renders nothing hides it (the spacer keeps the column), and a custom glyph is\n // rendered as given, not rotated.\n let chevron: React.ReactNode = <span className=\"w-3 shrink-0\" aria-hidden=\"true\" />;\n if (hasChildren && (expandIcon === undefined || expandIcon === null)) {\n chevron = (\n <ChevronRightIcon\n className={cn(\n treeItemClassNames.expandIcon,\n 'shrink-0 transition-transform motion-reduce:transition-none',\n isExpanded ? 'rotate-90' : 'wave-rtl:-scale-x-100',\n )}\n />\n );\n } else if (hasChildren && slotRendersContent(expandIcon)) {\n chevron = renderSlot(\n expandIcon,\n 'span',\n cn(treeItemClassNames.expandIcon, 'inline-flex shrink-0'),\n { 'aria-hidden': true },\n );\n }\n\n // Checkbox tree: the item computes its state from its own subtree (the child-group rule) and\n // the checked list, so every state renders on the server and needs no other item. A top-level\n // item also hands its subtree to the root, which orders a toggle's list by it.\n const multiple = ctx.selectionMode === 'multiple';\n const ownNode = React.useMemo<TreeNode | null>(\n () =>\n multiple\n ? {\n value,\n children: leaf ? [] : collectItems(children, { item: TreeItem, tree: TreeRoot }),\n }\n : null,\n [multiple, value, leaf, children],\n );\n const checkState: CheckState | undefined = ownNode\n ? computeCheckStates([ownNode], ctx.checked, ancestorListed).get(value)\n : undefined;\n const selectionEntry = React.useRef<TreeSelectionEntry | null>(null);\n React.useLayoutEffect(() => {\n selectionEntry.current = ownNode ? { node: ownNode, element: itemRef.current } : null;\n });\n const isTopLevel = parent === null && !insideLabel;\n React.useLayoutEffect(\n () => (multiple && isTopLevel ? registerTopLevel(selectionEntry) : undefined),\n [multiple, isTopLevel, registerTopLevel],\n );\n const isSelected = ctx.selected !== undefined ? ctx.selected === value : undefined;\n const isCurrent = ctx.current !== undefined && ctx.current !== null && ctx.current === value;\n\n const activate = () => {\n if (hasChildren) ctx.toggle(value);\n ctx.activate(value);\n };\n\n const handleClick = (event: React.MouseEvent<HTMLDivElement>) => {\n if (!isOwnClick(event)) return;\n onClick?.(event);\n if (!event.defaultPrevented) activate();\n };\n\n const handleKeyDown = (event: React.KeyboardEvent<HTMLDivElement>) => {\n if (!isOwnKeyEvent(event)) return;\n onKeyDown?.(event);\n if (event.defaultPrevented || event.altKey || event.ctrlKey || event.metaKey) return;\n\n switch (event.key) {\n case 'Enter':\n event.preventDefault();\n activate();\n return;\n case ' ':\n event.preventDefault();\n // A checkbox tree toggles the focused item's check (APG); the other modes activate.\n if (checkState !== undefined) ctx.toggleChecked(value, event.nativeEvent);\n else activate();\n return;\n case '*': {\n event.preventDefault();\n const siblings = event.currentTarget.parentElement?.querySelectorAll<HTMLElement>(\n ':scope > [role=\"treeitem\"][aria-expanded=\"false\"][data-roving-value]',\n );\n ctx.expand(\n Array.from(siblings ?? [], (el) => el.getAttribute('data-roving-value') ?? '').filter(\n Boolean,\n ),\n );\n return;\n }\n default:\n }\n\n const intent = getArrowIntent(event.key, {\n orientation: 'horizontal',\n dir: getDirection(event.currentTarget),\n });\n if (intent === 'next') {\n event.preventDefault();\n if (hasChildren && !isExpanded) {\n ctx.toggle(value);\n return;\n }\n // Treegrid navigation moves into the row's actions, also from an open parent (Down reaches\n // its first child), where APG's tree moves to the first child.\n if (ctx.navigationMode === 'treegrid' && focusFirstAction(event.currentTarget)) return;\n if (hasChildren && firstChildValue !== undefined) ctx.focusValue(firstChildValue);\n } else if (intent === 'prev') {\n event.preventDefault();\n if (hasChildren && isExpanded) ctx.toggle(value);\n else if (parent !== null) ctx.focusValue(parent);\n }\n };\n\n // Focus in the actions: tracked from the events, because a removed element fires no reliable\n // blur. A blur that leaves for another element, or from an element still in the document, ends it.\n const focusedAction = React.useRef<Element | null>(null);\n const inOwnActions = (event: React.FocusEvent<HTMLElement>) =>\n (event.target as Element).closest('[data-tree-actions]')?.closest('[role=\"treeitem\"]') ===\n event.currentTarget;\n // Focus on the item, or on one of its own actions (a click), makes it the active item.\n const handleFocus = (event: React.FocusEvent<HTMLDivElement>) => {\n if (event.target === event.currentTarget || inOwnActions(event)) ctx.onItemFocus(value);\n if (inOwnActions(event)) focusedAction.current = event.target as Element;\n };\n\n const handleActionsBlur = (event: React.FocusEvent<HTMLDivElement>) => {\n if (inOwnActions(event) && (event.relatedTarget !== null || event.target.isConnected)) {\n focusedAction.current = null;\n }\n };\n // An action that had focus is gone (no longer in the document) and focus fell to the page: it\n // goes to the item instead. Focus anywhere else ends the record at the next render.\n React.useLayoutEffect(() => {\n const action = focusedAction.current;\n if (!action) return;\n const item = itemRef.current;\n const active = item?.ownerDocument.activeElement;\n if (active && active !== item.ownerDocument.body) {\n focusedAction.current = null;\n } else if (item && !action.isConnected) {\n focusedAction.current = null;\n item.focus({ preventScroll: true });\n }\n });\n\n // The checkbox never takes focus (APG: focus stays on tree items): a press on it focuses its\n // item instead, and its click toggles the check without activating the item.\n const keepFocusOnItem = (event: React.MouseEvent<HTMLSpanElement>) => {\n event.preventDefault();\n itemRef.current?.focus({ preventScroll: true });\n };\n const handleCheckboxClick = (event: React.MouseEvent<HTMLSpanElement>) => {\n ctx.toggleChecked(value, event.nativeEvent);\n };\n\n const checkbox =\n checkState === undefined ? null : (\n <span\n role=\"checkbox\"\n aria-checked={checkState === 'mixed' ? 'mixed' : checkState === 'checked'}\n aria-labelledby={nameId}\n tabIndex={-1}\n data-tree-checkbox=\"\"\n onMouseDown={keepFocusOnItem}\n onClick={handleCheckboxClick}\n className={cn(\n treeItemClassNames.indicator,\n // Checkbox's box: 16px inside a 24px target (the pseudo-element), WCAG 2.5.8.\n 'relative inline-flex size-4 shrink-0 items-center justify-center rounded-xs border transition-colors motion-reduce:transition-none',\n 'before:absolute before:-inset-1',\n checkState === 'unchecked'\n ? cn('border-stroke-accessible bg-transparent', forcedColors.control)\n : 'border-primary bg-primary text-primary-foreground forced-colors:border-[Highlight] forced-colors:bg-[Highlight]',\n )}\n >\n {checkState === 'mixed' ? (\n <SubtractIcon size={12} className={forcedColors.selectedLeaf} />\n ) : checkState === 'checked' ? (\n <CheckIcon size={12} className={forcedColors.selectedLeaf} />\n ) : null}\n </span>\n );\n\n // Single mode: a decorative radio (the treeitem's aria-selected carries the state). A click on\n // it is a click on the row, so it activates the item.\n const radio =\n ctx.selectionMode === 'single' ? (\n <span\n aria-hidden=\"true\"\n className={cn(\n treeItemClassNames.indicator,\n 'inline-flex size-4 shrink-0 items-center justify-center rounded-full border transition-colors motion-reduce:transition-none',\n isSelected\n ? 'border-2 border-primary forced-colors:border-[Highlight]'\n : cn('border-stroke-accessible', forcedColors.control),\n )}\n >\n {isSelected && (\n <span className={cn('block size-2 rounded-full bg-primary', forcedColors.selectedLeaf)} />\n )}\n </span>\n ) : null;\n // A tree item shows its checkbox in multiple mode, its radio in single mode, and nothing else.\n const indicator = checkbox ?? radio;\n\n // Items in this item's group are checked when the list checks this item or an ancestor.\n const groupListed = ancestorListed || (multiple && ctx.checked.has(value));\n\n return (\n <div\n role=\"treeitem\"\n aria-selected={isSelected}\n aria-current={isCurrent ? true : undefined}\n data-checked={checkState === 'checked' ? '' : undefined}\n data-mixed={checkState === 'mixed' ? '' : undefined}\n className={cn(\n treeItemClassNames.root,\n // The focus ring is drawn on the row: an outline on the treeitem would surround its\n // whole subtree.\n 'block outline-none',\n '[&:focus-visible>[data-tree-row]]:outline-2 [&:focus-visible>[data-tree-row]]:-outline-offset-2 [&:focus-visible>[data-tree-row]]:outline-ring',\n hasActions && ACTIONS_ON_ITEM_FOCUS,\n hasActions && hasAside && ASIDE_OFF_ON_ITEM_FOCUS,\n className,\n )}\n {...rest}\n // Named by its label only: the treeitem also contains its icon and its child group. A\n // consumer aria-labelledby or aria-label replaces it.\n aria-labelledby={\n rest['aria-labelledby'] ?? (rest['aria-label'] === undefined ? nameId : undefined)\n }\n // The aside describes the item, after a consumer description.\n aria-describedby={joinIds(\n rest['aria-describedby'],\n hasAside ? asideId : undefined,\n layoutIds?.descriptionId,\n )}\n aria-expanded={hasChildren ? isExpanded : undefined}\n // From the checked list, after the rest props, so a consumer cannot contradict it.\n aria-checked={\n checkState === undefined\n ? undefined\n : checkState === 'mixed'\n ? 'mixed'\n : checkState === 'checked'\n }\n tabIndex={ctx.getTabIndex(value)}\n data-roving-value={value}\n data-selected={isSelected ? '' : undefined}\n data-current={isCurrent ? '' : undefined}\n onClick={handleClick}\n onKeyDown={handleKeyDown}\n onFocus={(event) =>\n composeEventHandlers(onFocus, handleFocus, { checkDefaultPrevented: false })(event)\n }\n onBlur={(event) =>\n composeEventHandlers(onBlur, handleActionsBlur, { checkDefaultPrevented: false })(event)\n }\n ref={mergedRef}\n >\n <div\n data-tree-row=\"\"\n className={cn(\n treeItemClassNames.row,\n 'flex cursor-pointer items-center gap-1.5 rounded px-2 py-1 hover:bg-subtle-hover',\n hasActions && 'group/row',\n isSelected && cn('bg-subtle-selected font-semibold', forcedColors.selectedContainer),\n )}\n >\n {chevron}\n {indicator}\n {iconNode}\n <span\n id={labelId}\n data-tree-label=\"\"\n data-roving-text={typeaheadText}\n // The label shrinks (and truncates) when the row has content after it.\n className={cn(\n treeItemClassNames.label,\n 'truncate',\n (iconAfterNode || hasAside || hasActions) && 'min-w-0',\n )}\n >\n <TreeCheckForcedContext.Provider value={false}>\n <TreeLabelContext.Provider value>\n <TreeItemContext.Provider value={itemContext}>\n {labelContent}\n </TreeItemContext.Provider>\n </TreeLabelContext.Provider>\n </TreeCheckForcedContext.Provider>\n </span>\n {iconAfterNode}\n {(hasAside || hasActions) && (\n <span\n data-tree-end=\"\"\n className={cn(\n 'group/end ms-auto inline-grid shrink-0 items-center gap-1',\n hasAside && hasActions && END_CELL_SHARED,\n )}\n >\n {hasAside && (\n <span\n id={asideId}\n data-tree-aside=\"\"\n className={cn(\n treeItemClassNames.aside,\n 'inline-flex items-center text-caption-1 text-muted-foreground',\n hasActions && ASIDE_OFF_WITH_ACTIONS,\n )}\n >\n {materialiseSlotContent(aside)}\n </span>\n )}\n {hasActions && (\n <TreeItemActions\n labelledBy={nameId}\n tabStop={\n ctx.navigationMode === 'tree' && ctx.focusedItem === value\n ? 'last-focused'\n : 'none'\n }\n navigationMode={ctx.navigationMode}\n onReturn={() => ctx.focusValue(value)}\n >\n {materialiseSlotContent(actions)}\n </TreeItemActions>\n )}\n </span>\n )}\n </div>\n {hasChildren && isExpanded && (\n <TreeParentContext.Provider value={value}>\n <TreeCheckForcedContext.Provider value={groupListed}>\n <TreeLabelContext.Provider value={false}>\n <div role=\"group\" className={cn(treeItemClassNames.group, 'ps-4')}>\n {nestedItems}\n </div>\n </TreeLabelContext.Provider>\n </TreeCheckForcedContext.Provider>\n </TreeParentContext.Provider>\n )}\n </div>\n );\n};\nTreeItem.displayName = 'TreeItem';\n"],"mappings":"60BAuCA,IAAMyD,EAA2B,CAAC,EAE5BC,GACJ,uhBAOF,SAASC,GAAmB,EAAqB,CAC/CrB,EAAA,SACE,kBAAkBsB,IAClB,wCAAwCA,EAAM,uHAEhD,CACF,CAEA,IAAMC,EACJ,+HAGIC,GACJ,0IAGIC,GACJ,+JAIF,SAASC,GACP,EACY,CAEZ,OADKC,EACE,MAAM,KAAKA,EAAU,GAAUC,EAAM,OAAO,CAAC,CACjD,OAAQ,GAAuCA,IAAU,IAAI,CAAC,CAC9D,MAAM,EAAG,IACJ,CAACC,EAAE,SAAW,CAACC,EAAE,SAAWD,EAAE,UAAYC,EAAE,QAAgB,EACzDD,EAAE,QAAQ,wBAAwBC,EAAE,OAAO,EAAI,KAAK,4BACvD,GACA,CACL,CAAC,CACD,IAAK,GAAUF,EAAM,IAAI,EATP,CAAC,CAUxB,CAMA,IAAMG,GAAqB,oBAGrBC,EAAuB,uEASvBC,GACJ,+FAGIC,GACJ,uIASIC,GACJ,6KAGIC,GACJ,sSAGIC,GAAkB,qEASxB,SAASC,GAAiB,EAA4B,CACpD,IAAMC,EAAUC,EAAK,cAA2B,8CAA8C,EAC9F,GAAI,CAACD,EAAS,MAAO,GACrB,IAAME,EAAY,IAAI,IACtB,IAAK,IAAMC,KAAM,MAAM,KAAKH,EAAQ,iBAA8BP,CAAoB,CAAC,EAAG,CACxF,GAAItE,EAAAA,cAAcgF,CAAE,GAAKA,EA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