@mortenbrudvik/waveui 0.7.0 → 0.9.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (439) hide show
  1. package/README.md +564 -155
  2. package/dist/components/button/Button.cjs +1 -1
  3. package/dist/components/button/Button.cjs.map +1 -1
  4. package/dist/components/button/Button.mjs +36 -35
  5. package/dist/components/button/Button.mjs.map +1 -1
  6. package/dist/components/button/Button.slots.cjs +1 -1
  7. package/dist/components/button/Button.slots.cjs.map +1 -1
  8. package/dist/components/button/Button.slots.mjs +31 -21
  9. package/dist/components/button/Button.slots.mjs.map +1 -1
  10. package/dist/components/button/CompoundButton.cjs +1 -1
  11. package/dist/components/button/CompoundButton.cjs.map +1 -1
  12. package/dist/components/button/CompoundButton.mjs +31 -29
  13. package/dist/components/button/CompoundButton.mjs.map +1 -1
  14. package/dist/components/button/Link.cjs +1 -1
  15. package/dist/components/button/Link.cjs.map +1 -1
  16. package/dist/components/button/Link.mjs +24 -23
  17. package/dist/components/button/Link.mjs.map +1 -1
  18. package/dist/components/button/MenuButton.cjs +1 -1
  19. package/dist/components/button/MenuButton.cjs.map +1 -1
  20. package/dist/components/button/MenuButton.mjs +29 -28
  21. package/dist/components/button/MenuButton.mjs.map +1 -1
  22. package/dist/components/button/SplitButton.cjs +1 -1
  23. package/dist/components/button/SplitButton.cjs.map +1 -1
  24. package/dist/components/button/SplitButton.mjs +46 -45
  25. package/dist/components/button/SplitButton.mjs.map +1 -1
  26. package/dist/components/button/ToggleButton.cjs +1 -1
  27. package/dist/components/button/ToggleButton.cjs.map +1 -1
  28. package/dist/components/button/ToggleButton.mjs +38 -35
  29. package/dist/components/button/ToggleButton.mjs.map +1 -1
  30. package/dist/components/button/Toolbar.cjs +1 -1
  31. package/dist/components/button/Toolbar.cjs.map +1 -1
  32. package/dist/components/button/Toolbar.mjs +43 -42
  33. package/dist/components/button/Toolbar.mjs.map +1 -1
  34. package/dist/components/button/Toolbar.parts.cjs +1 -1
  35. package/dist/components/button/Toolbar.parts.cjs.map +1 -1
  36. package/dist/components/button/Toolbar.parts.mjs +76 -81
  37. package/dist/components/button/Toolbar.parts.mjs.map +1 -1
  38. package/dist/components/data-display/Avatar.cjs +1 -1
  39. package/dist/components/data-display/Avatar.cjs.map +1 -1
  40. package/dist/components/data-display/Avatar.mjs +72 -67
  41. package/dist/components/data-display/Avatar.mjs.map +1 -1
  42. package/dist/components/data-display/AvatarGroup.cjs +1 -1
  43. package/dist/components/data-display/AvatarGroup.cjs.map +1 -1
  44. package/dist/components/data-display/AvatarGroup.mjs +89 -88
  45. package/dist/components/data-display/AvatarGroup.mjs.map +1 -1
  46. package/dist/components/data-display/Badge.cjs +1 -1
  47. package/dist/components/data-display/Badge.cjs.map +1 -1
  48. package/dist/components/data-display/Badge.mjs +17 -16
  49. package/dist/components/data-display/Badge.mjs.map +1 -1
  50. package/dist/components/data-display/CounterBadge.cjs +1 -1
  51. package/dist/components/data-display/CounterBadge.cjs.map +1 -1
  52. package/dist/components/data-display/CounterBadge.mjs +18 -17
  53. package/dist/components/data-display/CounterBadge.mjs.map +1 -1
  54. package/dist/components/data-display/Divider.cjs +1 -1
  55. package/dist/components/data-display/Divider.cjs.map +1 -1
  56. package/dist/components/data-display/Divider.mjs +31 -30
  57. package/dist/components/data-display/Divider.mjs.map +1 -1
  58. package/dist/components/data-display/Image.cjs +1 -1
  59. package/dist/components/data-display/Image.cjs.map +1 -1
  60. package/dist/components/data-display/Image.mjs +16 -15
  61. package/dist/components/data-display/Image.mjs.map +1 -1
  62. package/dist/components/data-display/InfoButton.cjs +2 -0
  63. package/dist/components/data-display/InfoButton.cjs.map +1 -0
  64. package/dist/components/data-display/InfoButton.mjs +173 -0
  65. package/dist/components/data-display/InfoButton.mjs.map +1 -0
  66. package/dist/components/data-display/InfoLabel.cjs +1 -1
  67. package/dist/components/data-display/InfoLabel.cjs.map +1 -1
  68. package/dist/components/data-display/InfoLabel.mjs +36 -92
  69. package/dist/components/data-display/InfoLabel.mjs.map +1 -1
  70. package/dist/components/data-display/List.cjs +1 -1
  71. package/dist/components/data-display/List.cjs.map +1 -1
  72. package/dist/components/data-display/List.mjs +175 -174
  73. package/dist/components/data-display/List.mjs.map +1 -1
  74. package/dist/components/data-display/Persona.cjs +1 -1
  75. package/dist/components/data-display/Persona.cjs.map +1 -1
  76. package/dist/components/data-display/Persona.mjs +31 -29
  77. package/dist/components/data-display/Persona.mjs.map +1 -1
  78. package/dist/components/data-display/PresenceBadge.cjs +1 -1
  79. package/dist/components/data-display/PresenceBadge.cjs.map +1 -1
  80. package/dist/components/data-display/PresenceBadge.mjs +25 -24
  81. package/dist/components/data-display/PresenceBadge.mjs.map +1 -1
  82. package/dist/components/data-display/Tag.cjs +1 -1
  83. package/dist/components/data-display/Tag.cjs.map +1 -1
  84. package/dist/components/data-display/Tag.mjs +87 -82
  85. package/dist/components/data-display/Tag.mjs.map +1 -1
  86. package/dist/components/feedback/MessageBar.cjs +1 -1
  87. package/dist/components/feedback/MessageBar.cjs.map +1 -1
  88. package/dist/components/feedback/MessageBar.mjs +129 -71
  89. package/dist/components/feedback/MessageBar.mjs.map +1 -1
  90. package/dist/components/feedback/MessageBar.parts.cjs +2 -0
  91. package/dist/components/feedback/MessageBar.parts.cjs.map +1 -0
  92. package/dist/components/feedback/MessageBar.parts.mjs +84 -0
  93. package/dist/components/feedback/MessageBar.parts.mjs.map +1 -0
  94. package/dist/components/feedback/MessageBar.reflow.cjs +2 -0
  95. package/dist/components/feedback/MessageBar.reflow.cjs.map +1 -0
  96. package/dist/components/feedback/MessageBar.reflow.mjs +74 -0
  97. package/dist/components/feedback/MessageBar.reflow.mjs.map +1 -0
  98. package/dist/components/feedback/MessageBar.status.cjs +1 -1
  99. package/dist/components/feedback/MessageBar.status.cjs.map +1 -1
  100. package/dist/components/feedback/MessageBar.status.mjs +2 -1
  101. package/dist/components/feedback/MessageBar.status.mjs.map +1 -1
  102. package/dist/components/feedback/ProgressBar.cjs +1 -1
  103. package/dist/components/feedback/ProgressBar.cjs.map +1 -1
  104. package/dist/components/feedback/ProgressBar.mjs +44 -43
  105. package/dist/components/feedback/ProgressBar.mjs.map +1 -1
  106. package/dist/components/feedback/Skeleton.cjs +1 -1
  107. package/dist/components/feedback/Skeleton.cjs.map +1 -1
  108. package/dist/components/feedback/Skeleton.mjs +26 -24
  109. package/dist/components/feedback/Skeleton.mjs.map +1 -1
  110. package/dist/components/feedback/Spinner.cjs +1 -1
  111. package/dist/components/feedback/Spinner.cjs.map +1 -1
  112. package/dist/components/feedback/Spinner.mjs +32 -31
  113. package/dist/components/feedback/Spinner.mjs.map +1 -1
  114. package/dist/components/feedback/Toast.cjs +1 -1
  115. package/dist/components/feedback/Toast.cjs.map +1 -1
  116. package/dist/components/feedback/Toast.context.cjs +2 -0
  117. package/dist/components/feedback/Toast.context.cjs.map +1 -0
  118. package/dist/components/feedback/Toast.context.mjs +23 -0
  119. package/dist/components/feedback/Toast.context.mjs.map +1 -0
  120. package/dist/components/feedback/Toast.mjs +10 -342
  121. package/dist/components/feedback/Toast.mjs.map +1 -1
  122. package/dist/components/feedback/Toast.parts.cjs +2 -0
  123. package/dist/components/feedback/Toast.parts.cjs.map +1 -0
  124. package/dist/components/feedback/Toast.parts.mjs +98 -0
  125. package/dist/components/feedback/Toast.parts.mjs.map +1 -0
  126. package/dist/components/feedback/Toast.root.cjs +2 -0
  127. package/dist/components/feedback/Toast.root.cjs.map +1 -0
  128. package/dist/components/feedback/Toast.root.mjs +109 -0
  129. package/dist/components/feedback/Toast.root.mjs.map +1 -0
  130. package/dist/components/feedback/Toaster.cjs +2 -0
  131. package/dist/components/feedback/Toaster.cjs.map +1 -0
  132. package/dist/components/feedback/Toaster.mjs +564 -0
  133. package/dist/components/feedback/Toaster.mjs.map +1 -0
  134. package/dist/components/input/AlphaSlider.cjs +2 -0
  135. package/dist/components/input/AlphaSlider.cjs.map +1 -0
  136. package/dist/components/input/AlphaSlider.mjs +115 -0
  137. package/dist/components/input/AlphaSlider.mjs.map +1 -0
  138. package/dist/components/input/Checkbox.cjs +1 -1
  139. package/dist/components/input/Checkbox.cjs.map +1 -1
  140. package/dist/components/input/Checkbox.mjs +87 -70
  141. package/dist/components/input/Checkbox.mjs.map +1 -1
  142. package/dist/components/input/ColorArea.cjs +2 -0
  143. package/dist/components/input/ColorArea.cjs.map +1 -0
  144. package/dist/components/input/ColorArea.mjs +204 -0
  145. package/dist/components/input/ColorArea.mjs.map +1 -0
  146. package/dist/components/input/ColorPicker.cjs +5 -5
  147. package/dist/components/input/ColorPicker.cjs.map +1 -1
  148. package/dist/components/input/ColorPicker.mjs +142 -165
  149. package/dist/components/input/ColorPicker.mjs.map +1 -1
  150. package/dist/components/input/ColorPicker.parts.cjs +2 -0
  151. package/dist/components/input/ColorPicker.parts.cjs.map +1 -0
  152. package/dist/components/input/ColorPicker.parts.mjs +192 -0
  153. package/dist/components/input/ColorPicker.parts.mjs.map +1 -0
  154. package/dist/components/input/ColorSlider.cjs +2 -0
  155. package/dist/components/input/ColorSlider.cjs.map +1 -0
  156. package/dist/components/input/ColorSlider.mjs +138 -0
  157. package/dist/components/input/ColorSlider.mjs.map +1 -0
  158. package/dist/components/input/Combobox.cjs +1 -1
  159. package/dist/components/input/Combobox.cjs.map +1 -1
  160. package/dist/components/input/Combobox.expand.cjs +1 -1
  161. package/dist/components/input/Combobox.expand.cjs.map +1 -1
  162. package/dist/components/input/Combobox.expand.mjs +22 -22
  163. package/dist/components/input/Combobox.expand.mjs.map +1 -1
  164. package/dist/components/input/Combobox.mjs +151 -141
  165. package/dist/components/input/Combobox.mjs.map +1 -1
  166. package/dist/components/input/DatePicker.cjs +1 -1
  167. package/dist/components/input/DatePicker.cjs.map +1 -1
  168. package/dist/components/input/DatePicker.mjs +239 -234
  169. package/dist/components/input/DatePicker.mjs.map +1 -1
  170. package/dist/components/input/Dropdown.cjs +1 -1
  171. package/dist/components/input/Dropdown.cjs.map +1 -1
  172. package/dist/components/input/Dropdown.mjs +109 -100
  173. package/dist/components/input/Dropdown.mjs.map +1 -1
  174. package/dist/components/input/Field.cjs +1 -1
  175. package/dist/components/input/Field.cjs.map +1 -1
  176. package/dist/components/input/Field.mjs +139 -105
  177. package/dist/components/input/Field.mjs.map +1 -1
  178. package/dist/components/input/Input.cjs +1 -1
  179. package/dist/components/input/Input.cjs.map +1 -1
  180. package/dist/components/input/Input.mjs +80 -55
  181. package/dist/components/input/Input.mjs.map +1 -1
  182. package/dist/components/input/Label.cjs +1 -1
  183. package/dist/components/input/Label.cjs.map +1 -1
  184. package/dist/components/input/Label.mjs +19 -12
  185. package/dist/components/input/Label.mjs.map +1 -1
  186. package/dist/components/input/Option.cjs +1 -1
  187. package/dist/components/input/Option.cjs.map +1 -1
  188. package/dist/components/input/Option.mjs +100 -98
  189. package/dist/components/input/Option.mjs.map +1 -1
  190. package/dist/components/input/RadioGroup.cjs +1 -1
  191. package/dist/components/input/RadioGroup.cjs.map +1 -1
  192. package/dist/components/input/RadioGroup.mjs +89 -88
  193. package/dist/components/input/RadioGroup.mjs.map +1 -1
  194. package/dist/components/input/Rating.cjs +1 -1
  195. package/dist/components/input/Rating.cjs.map +1 -1
  196. package/dist/components/input/Rating.item.cjs +2 -0
  197. package/dist/components/input/Rating.item.cjs.map +1 -0
  198. package/dist/components/input/Rating.item.mjs +255 -0
  199. package/dist/components/input/Rating.item.mjs.map +1 -0
  200. package/dist/components/input/Rating.mjs +152 -152
  201. package/dist/components/input/Rating.mjs.map +1 -1
  202. package/dist/components/input/SearchBox.cjs +1 -1
  203. package/dist/components/input/SearchBox.cjs.map +1 -1
  204. package/dist/components/input/SearchBox.mjs +162 -132
  205. package/dist/components/input/SearchBox.mjs.map +1 -1
  206. package/dist/components/input/Select.cjs +1 -1
  207. package/dist/components/input/Select.cjs.map +1 -1
  208. package/dist/components/input/Select.mjs +34 -24
  209. package/dist/components/input/Select.mjs.map +1 -1
  210. package/dist/components/input/Slider.cjs +1 -1
  211. package/dist/components/input/Slider.cjs.map +1 -1
  212. package/dist/components/input/Slider.mjs +78 -54
  213. package/dist/components/input/Slider.mjs.map +1 -1
  214. package/dist/components/input/SpinButton.cjs +1 -1
  215. package/dist/components/input/SpinButton.cjs.map +1 -1
  216. package/dist/components/input/SpinButton.mjs +202 -99
  217. package/dist/components/input/SpinButton.mjs.map +1 -1
  218. package/dist/components/input/SwatchPicker.cjs +1 -1
  219. package/dist/components/input/SwatchPicker.cjs.map +1 -1
  220. package/dist/components/input/SwatchPicker.mjs +38 -37
  221. package/dist/components/input/SwatchPicker.mjs.map +1 -1
  222. package/dist/components/input/Switch.cjs +1 -1
  223. package/dist/components/input/Switch.cjs.map +1 -1
  224. package/dist/components/input/Switch.mjs +75 -58
  225. package/dist/components/input/Switch.mjs.map +1 -1
  226. package/dist/components/input/TagPicker.cjs +1 -1
  227. package/dist/components/input/TagPicker.cjs.map +1 -1
  228. package/dist/components/input/TagPicker.mjs +199 -169
  229. package/dist/components/input/TagPicker.mjs.map +1 -1
  230. package/dist/components/input/Textarea.cjs +1 -1
  231. package/dist/components/input/Textarea.cjs.map +1 -1
  232. package/dist/components/input/Textarea.mjs +31 -23
  233. package/dist/components/input/Textarea.mjs.map +1 -1
  234. package/dist/components/input/TimePicker.cjs +1 -1
  235. package/dist/components/input/TimePicker.cjs.map +1 -1
  236. package/dist/components/input/TimePicker.mjs +185 -177
  237. package/dist/components/input/TimePicker.mjs.map +1 -1
  238. package/dist/components/input/colorName.cjs +2 -0
  239. package/dist/components/input/colorName.cjs.map +1 -0
  240. package/dist/components/input/colorName.mjs +30 -0
  241. package/dist/components/input/colorName.mjs.map +1 -0
  242. package/dist/components/input/colorUtils.cjs +1 -1
  243. package/dist/components/input/colorUtils.cjs.map +1 -1
  244. package/dist/components/input/colorUtils.mjs +154 -56
  245. package/dist/components/input/colorUtils.mjs.map +1 -1
  246. package/dist/components/input/fieldLabel.cjs +2 -0
  247. package/dist/components/input/fieldLabel.cjs.map +1 -0
  248. package/dist/components/input/fieldLabel.mjs +17 -0
  249. package/dist/components/input/fieldLabel.mjs.map +1 -0
  250. package/dist/components/input/inputLook.cjs +2 -0
  251. package/dist/components/input/inputLook.cjs.map +1 -0
  252. package/dist/components/input/inputLook.mjs +28 -0
  253. package/dist/components/input/inputLook.mjs.map +1 -0
  254. package/dist/components/input/pickerStyles.cjs +1 -1
  255. package/dist/components/input/pickerStyles.cjs.map +1 -1
  256. package/dist/components/input/pickerStyles.mjs +42 -4
  257. package/dist/components/input/pickerStyles.mjs.map +1 -1
  258. package/dist/components/layout/Accordion.cjs +1 -1
  259. package/dist/components/layout/Accordion.cjs.map +1 -1
  260. package/dist/components/layout/Accordion.mjs +130 -129
  261. package/dist/components/layout/Accordion.mjs.map +1 -1
  262. package/dist/components/layout/Card.cjs +1 -1
  263. package/dist/components/layout/Card.cjs.map +1 -1
  264. package/dist/components/layout/Card.mjs +78 -77
  265. package/dist/components/layout/Card.mjs.map +1 -1
  266. package/dist/components/layout/Carousel.cjs +1 -1
  267. package/dist/components/layout/Carousel.cjs.map +1 -1
  268. package/dist/components/layout/Carousel.mjs +111 -110
  269. package/dist/components/layout/Carousel.mjs.map +1 -1
  270. package/dist/components/layout/Flex.cjs +1 -1
  271. package/dist/components/layout/Flex.cjs.map +1 -1
  272. package/dist/components/layout/Flex.mjs +22 -21
  273. package/dist/components/layout/Flex.mjs.map +1 -1
  274. package/dist/components/layout/Grid.cjs +1 -1
  275. package/dist/components/layout/Grid.cjs.map +1 -1
  276. package/dist/components/layout/Grid.mjs +19 -18
  277. package/dist/components/layout/Grid.mjs.map +1 -1
  278. package/dist/components/layout/Overflow.cjs +1 -1
  279. package/dist/components/layout/Overflow.cjs.map +1 -1
  280. package/dist/components/layout/Overflow.mjs +92 -91
  281. package/dist/components/layout/Overflow.mjs.map +1 -1
  282. package/dist/components/layout/Stack.cjs +1 -1
  283. package/dist/components/layout/Stack.cjs.map +1 -1
  284. package/dist/components/layout/Stack.mjs +14 -13
  285. package/dist/components/layout/Stack.mjs.map +1 -1
  286. package/dist/components/layout/TabList.cjs +1 -1
  287. package/dist/components/layout/TabList.cjs.map +1 -1
  288. package/dist/components/layout/TabList.mjs +118 -117
  289. package/dist/components/layout/TabList.mjs.map +1 -1
  290. package/dist/components/layout/Tree.cjs +1 -1
  291. package/dist/components/layout/Tree.cjs.map +1 -1
  292. package/dist/components/layout/Tree.context.cjs +2 -0
  293. package/dist/components/layout/Tree.context.cjs.map +1 -0
  294. package/dist/components/layout/Tree.context.mjs +33 -0
  295. package/dist/components/layout/Tree.context.mjs.map +1 -0
  296. package/dist/components/layout/Tree.core.cjs +2 -0
  297. package/dist/components/layout/Tree.core.cjs.map +1 -0
  298. package/dist/components/layout/Tree.core.mjs +416 -0
  299. package/dist/components/layout/Tree.core.mjs.map +1 -0
  300. package/dist/components/layout/Tree.itemPersonaLayout.cjs +2 -0
  301. package/dist/components/layout/Tree.itemPersonaLayout.cjs.map +1 -0
  302. package/dist/components/layout/Tree.itemPersonaLayout.mjs +46 -0
  303. package/dist/components/layout/Tree.itemPersonaLayout.mjs.map +1 -0
  304. package/dist/components/layout/Tree.mjs +7 -215
  305. package/dist/components/layout/Tree.mjs.map +1 -1
  306. package/dist/components/layout/Tree.selection.cjs +2 -0
  307. package/dist/components/layout/Tree.selection.cjs.map +1 -0
  308. package/dist/components/layout/Tree.selection.mjs +73 -0
  309. package/dist/components/layout/Tree.selection.mjs.map +1 -0
  310. package/dist/components/navigation/Breadcrumb.cjs +1 -1
  311. package/dist/components/navigation/Breadcrumb.cjs.map +1 -1
  312. package/dist/components/navigation/Breadcrumb.mjs +76 -75
  313. package/dist/components/navigation/Breadcrumb.mjs.map +1 -1
  314. package/dist/components/navigation/Menu.group.cjs +1 -1
  315. package/dist/components/navigation/Menu.group.cjs.map +1 -1
  316. package/dist/components/navigation/Menu.group.mjs +39 -37
  317. package/dist/components/navigation/Menu.group.mjs.map +1 -1
  318. package/dist/components/navigation/Menu.items.cjs +1 -1
  319. package/dist/components/navigation/Menu.items.cjs.map +1 -1
  320. package/dist/components/navigation/Menu.items.mjs +67 -61
  321. package/dist/components/navigation/Menu.items.mjs.map +1 -1
  322. package/dist/components/navigation/Menu.link.cjs +1 -1
  323. package/dist/components/navigation/Menu.link.cjs.map +1 -1
  324. package/dist/components/navigation/Menu.link.mjs +34 -28
  325. package/dist/components/navigation/Menu.link.mjs.map +1 -1
  326. package/dist/components/navigation/Menu.popover.cjs +1 -1
  327. package/dist/components/navigation/Menu.popover.cjs.map +1 -1
  328. package/dist/components/navigation/Menu.popover.mjs +114 -113
  329. package/dist/components/navigation/Menu.popover.mjs.map +1 -1
  330. package/dist/components/navigation/Menu.root.cjs +1 -1
  331. package/dist/components/navigation/Menu.root.cjs.map +1 -1
  332. package/dist/components/navigation/Menu.root.mjs +171 -170
  333. package/dist/components/navigation/Menu.root.mjs.map +1 -1
  334. package/dist/components/navigation/Menu.selectable.cjs +1 -1
  335. package/dist/components/navigation/Menu.selectable.cjs.map +1 -1
  336. package/dist/components/navigation/Menu.selectable.mjs +85 -63
  337. package/dist/components/navigation/Menu.selectable.mjs.map +1 -1
  338. package/dist/components/navigation/Menu.splitGroup.cjs +1 -1
  339. package/dist/components/navigation/Menu.splitGroup.cjs.map +1 -1
  340. package/dist/components/navigation/Menu.splitGroup.mjs +27 -26
  341. package/dist/components/navigation/Menu.splitGroup.mjs.map +1 -1
  342. package/dist/components/navigation/Menu.trigger.cjs +1 -1
  343. package/dist/components/navigation/Menu.trigger.cjs.map +1 -1
  344. package/dist/components/navigation/Menu.trigger.mjs +6 -6
  345. package/dist/components/navigation/Nav.cjs +1 -1
  346. package/dist/components/navigation/Nav.cjs.map +1 -1
  347. package/dist/components/navigation/Nav.mjs +170 -155
  348. package/dist/components/navigation/Nav.mjs.map +1 -1
  349. package/dist/components/navigation/Pagination.cjs +1 -1
  350. package/dist/components/navigation/Pagination.cjs.map +1 -1
  351. package/dist/components/navigation/Pagination.mjs +73 -65
  352. package/dist/components/navigation/Pagination.mjs.map +1 -1
  353. package/dist/components/navigation/Stepper.cjs +1 -1
  354. package/dist/components/navigation/Stepper.cjs.map +1 -1
  355. package/dist/components/navigation/Stepper.mjs +110 -109
  356. package/dist/components/navigation/Stepper.mjs.map +1 -1
  357. package/dist/components/overlays/Dialog.cjs +1 -1
  358. package/dist/components/overlays/Dialog.cjs.map +1 -1
  359. package/dist/components/overlays/Dialog.mjs +109 -108
  360. package/dist/components/overlays/Dialog.mjs.map +1 -1
  361. package/dist/components/overlays/Drawer.cjs +1 -1
  362. package/dist/components/overlays/Drawer.cjs.map +1 -1
  363. package/dist/components/overlays/Drawer.mjs +110 -109
  364. package/dist/components/overlays/Drawer.mjs.map +1 -1
  365. package/dist/components/overlays/Popover.cjs +1 -1
  366. package/dist/components/overlays/Popover.cjs.map +1 -1
  367. package/dist/components/overlays/Popover.mjs +148 -151
  368. package/dist/components/overlays/Popover.mjs.map +1 -1
  369. package/dist/components/overlays/Popover.shared.cjs +1 -1
  370. package/dist/components/overlays/Popover.shared.cjs.map +1 -1
  371. package/dist/components/overlays/Popover.shared.mjs +82 -77
  372. package/dist/components/overlays/Popover.shared.mjs.map +1 -1
  373. package/dist/components/overlays/TeachingPopover.cjs +1 -1
  374. package/dist/components/overlays/TeachingPopover.cjs.map +1 -1
  375. package/dist/components/overlays/TeachingPopover.mjs +41 -37
  376. package/dist/components/overlays/TeachingPopover.mjs.map +1 -1
  377. package/dist/components/overlays/Tooltip.cjs +1 -1
  378. package/dist/components/overlays/Tooltip.cjs.map +1 -1
  379. package/dist/components/overlays/Tooltip.mjs +87 -86
  380. package/dist/components/overlays/Tooltip.mjs.map +1 -1
  381. package/dist/components/portal/Portal.cjs +1 -1
  382. package/dist/components/portal/Portal.cjs.map +1 -1
  383. package/dist/components/portal/Portal.mjs +33 -32
  384. package/dist/components/portal/Portal.mjs.map +1 -1
  385. package/dist/components/provider/WaveProvider.cjs +1 -1
  386. package/dist/components/provider/WaveProvider.cjs.map +1 -1
  387. package/dist/components/provider/WaveProvider.mjs +36 -29
  388. package/dist/components/provider/WaveProvider.mjs.map +1 -1
  389. package/dist/components/table/DataGrid.cjs +1 -1
  390. package/dist/components/table/DataGrid.cjs.map +1 -1
  391. package/dist/components/table/DataGrid.mjs +228 -227
  392. package/dist/components/table/DataGrid.mjs.map +1 -1
  393. package/dist/components/table/Table.cjs +1 -1
  394. package/dist/components/table/Table.cjs.map +1 -1
  395. package/dist/components/table/Table.mjs +60 -59
  396. package/dist/components/table/Table.mjs.map +1 -1
  397. package/dist/components/typography/Text.cjs +1 -1
  398. package/dist/components/typography/Text.cjs.map +1 -1
  399. package/dist/components/typography/Text.mjs +12 -11
  400. package/dist/components/typography/Text.mjs.map +1 -1
  401. package/dist/hooks/useFieldControl.cjs.map +1 -1
  402. package/dist/hooks/useFieldControl.mjs.map +1 -1
  403. package/dist/hooks/useMediaQuery.cjs +2 -0
  404. package/dist/hooks/useMediaQuery.cjs.map +1 -0
  405. package/dist/hooks/useMediaQuery.mjs +20 -0
  406. package/dist/hooks/useMediaQuery.mjs.map +1 -0
  407. package/dist/hooks/usePrefersReducedMotion.cjs +1 -1
  408. package/dist/hooks/usePrefersReducedMotion.cjs.map +1 -1
  409. package/dist/hooks/usePrefersReducedMotion.mjs +4 -18
  410. package/dist/hooks/usePrefersReducedMotion.mjs.map +1 -1
  411. package/dist/hooks/useRovingTabIndex.cjs +1 -1
  412. package/dist/hooks/useRovingTabIndex.cjs.map +1 -1
  413. package/dist/hooks/useRovingTabIndex.mjs +3 -3
  414. package/dist/hooks/useRovingTabIndex.mjs.map +1 -1
  415. package/dist/index.cjs +1 -1
  416. package/dist/index.d.cts +2890 -197
  417. package/dist/index.d.ts +2890 -197
  418. package/dist/index.mjs +101 -87
  419. package/dist/lib/classNames.cjs +2 -0
  420. package/dist/lib/classNames.cjs.map +1 -0
  421. package/dist/lib/classNames.mjs +423 -0
  422. package/dist/lib/classNames.mjs.map +1 -0
  423. package/dist/lib/color.cjs +2 -0
  424. package/dist/lib/color.cjs.map +1 -0
  425. package/dist/lib/color.mjs +86 -0
  426. package/dist/lib/color.mjs.map +1 -0
  427. package/dist/lib/globalRegistry.cjs.map +1 -1
  428. package/dist/lib/globalRegistry.mjs.map +1 -1
  429. package/dist/lib/styles.cjs +1 -1
  430. package/dist/lib/styles.cjs.map +1 -1
  431. package/dist/lib/styles.mjs +21 -4
  432. package/dist/lib/styles.mjs.map +1 -1
  433. package/dist/lib/toaster.cjs +2 -0
  434. package/dist/lib/toaster.cjs.map +1 -0
  435. package/dist/lib/toaster.mjs +77 -0
  436. package/dist/lib/toaster.mjs.map +1 -0
  437. package/dist/styles.css +1 -1
  438. package/package.json +1 -1
  439. package/src/styles/tokens.css +13 -0
@@ -1 +1 @@
1
- {"version":3,"file":"TabList.mjs","names":["useId","useId$1","React","warnDuplicateTabValue","value","createRegistry","entries","listeners","ready","emit","listener","map","part","ids","id","index","INERT_REGISTRY","TabListContext","INERT_CONTEXT","useTabListContext","reportMissingContext","component","isUnavailable","ariaDisabled","props","consumerId","collectStructure","node","child","into","type","getElementType","Tab","TabPanel","TabListRoot","containsPart","TabPanels","rendersAfterTablist","TabListAreaContext","PANEL_IN_TABLIST_MESSAGE","valueProp","defaultValueProp","orientationProp","rest","resolveDeprecatedProp","selectedValue","defaultValue","defaultSelectedValue","orientation","vertical","onTabSelect","warnDeprecated","selected","setSelected","isControlled","useControllable","onValueChange","structureKey","children","structure","parsed","derivesSelection","useRovingTabIndex","selectTabOnFocus","select","next","isSelected","getTabIndex","tabValue","useEventCallback","baseId","registry","context","getPartId","itemValue","panel","mergedRef","useMergedRefs","ref","containerProps","tabs","panels","keyed","key","isVertical","cn","className","composeEventHandlers","onKeyDown","onFocus","idProp","ctx","unavailable","mountedPanelId","panelId","disabledStyles","focusRingInset","onClick","insideTablist","warnOnce","mountedTabId","tabId","focusRing","TabList"],"sources":["../../../src/components/layout/TabList.tsx"],"sourcesContent":["import * as React from 'react';\nimport { flattenChildren, getElementType } from '../../lib/children';\nimport { cn } from '../../lib/cn';\nimport { composeEventHandlers } from '../../lib/composeEventHandlers';\nimport {\n reportMissingContext,\n resolveDeprecatedProp,\n warnDeprecated,\n warnOnce,\n} from '../../lib/dev';\nimport { disabledStyles, focusRing, focusRingInset } from '../../lib/styles';\nimport type { Orientation } from '../../lib/types';\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';\nimport { getPartId } from './disclosureIds';\n\n/* ------------------------------------------------------------------ */\n/* Context */\n/* ------------------------------------------------------------------ */\n\ntype TabListPart = 'tab' | 'panel';\n\n/**\n * The ids of the mounted Tabs and Panels by value. A Tab references a panel only while one with\n * its value is mounted (a TabList used as a filter bar has none), and each side references the\n * other's actual id, a consumer `id` included. Read with `useSyncExternalStore`.\n *\n * Before the TabList has mounted (server HTML, hydration and the first client render) the\n * registry is not ready and the static structure of the children stands in for it; once it is\n * ready, it alone decides, so a Panel that is in the element tree but never mounts (inside a\n * wrapper that renders nothing) is not referenced.\n */\ninterface TabListRegistry {\n /** Registers a mounted Tab or Panel; returns the unregister function. */\n register: (part: TabListPart, value: string, id: string) => () => void;\n /**\n * Id of the first mounted Tab or Panel with this value, `null` when none is mounted, or\n * `undefined` while the registry is not ready (use the static structure then).\n */\n get: (part: TabListPart, value: string) => string | null | undefined;\n /** Called by the TabList once it (and so every Tab and Panel mounted with it) has mounted. */\n markReady: () => void;\n subscribe: (listener: () => void) => () => void;\n}\n\n/** Tabs that share a value share one id, and are selected and tab stops together. */\nfunction warnDuplicateTabValue(value: string): void {\n warnOnce(\n `TabList:duplicate:${value}`,\n `TabList: several tabs share the value \"${value}\". Tab values must be unique within a ` +\n 'TabList; tabs with the same value share one id and are selected (and tab stops) together.',\n );\n}\n\nfunction createRegistry(): TabListRegistry {\n const entries: Record<TabListPart, Map<string, string[]>> = { tab: new Map(), panel: new Map() };\n const listeners = new Set<() => void>();\n let ready = false;\n const emit = () => {\n listeners.forEach((listener) => listener());\n };\n return {\n register(part, value, id) {\n const map = entries[part];\n const ids = map.get(value) ?? [];\n // Called from the part's layout effect (C-DEV). Two Panels may share a value (the Tab links\n // to the first mounted one); two Tabs may not.\n if (part === 'tab' && ids.length > 0) warnDuplicateTabValue(value);\n map.set(value, [...ids, id]);\n emit();\n return () => {\n const ids = [...(map.get(value) ?? [])];\n const index = ids.indexOf(id);\n if (index !== -1) ids.splice(index, 1);\n if (ids.length > 0) map.set(value, ids);\n else map.delete(value);\n emit();\n };\n },\n get: (part, value) => (ready ? (entries[part].get(value)?.[0] ?? null) : undefined),\n markReady() {\n if (ready) return;\n ready = true;\n emit();\n },\n subscribe(listener) {\n listeners.add(listener);\n return () => {\n listeners.delete(listener);\n };\n },\n };\n}\n\nconst INERT_REGISTRY: TabListRegistry = {\n register: () => () => {},\n get: () => undefined,\n markReady: () => {},\n subscribe: () => () => {},\n};\n\n/**\n * What the TabList's children show before anything mounts (server HTML and the first render):\n * found in the element tree through Fragments and the `children` of wrapper elements, but not\n * inside a component that renders a Tab or Panel itself (the registry covers those once mounted).\n */\ninterface TabListStructure {\n /** Value of the first Tab without `disabled`/`aria-disabled`: the uncontrolled default. */\n firstEnabled?: string;\n /** Consumer `id`s of Tabs, by value. */\n tabIds: Array<[string, string]>;\n /** Values of the Panels, each with its consumer `id` or `null`. */\n panels: Array<[string, string | null]>;\n}\n\ninterface TabListContextValue {\n orientation: Orientation;\n /** Whether the tab with this value is the selected one (explicit value, else the tab stop). */\n isSelected: (value: string) => boolean;\n /**\n * Activates a tab: a click (Enter and Space click the tab button), or with automatic activation\n * focus moved by the keys.\n */\n select: (value: string) => void;\n getTabIndex: (value: string) => 0 | -1;\n /** The generated id of a Tab or Panel (used when it has no consumer `id`). */\n getGeneratedId: (part: TabListPart, value: string) => string;\n /**\n * Id of the Tab with this value before the TabList mounts: its consumer `id`, else the\n * generated one.\n */\n getStaticTabId: (value: string) => string;\n /**\n * Id of the Panel with this value before the TabList mounts, or `undefined` when the children\n * have none.\n */\n getStaticPanelId: (value: string) => string | undefined;\n registry: TabListRegistry;\n}\n\nconst TabListContext = React.createContext<TabListContextValue | null>(null);\n\nconst INERT_CONTEXT: TabListContextValue = {\n orientation: 'horizontal',\n isSelected: () => false,\n select: () => {},\n getTabIndex: () => -1,\n getGeneratedId: (part, value) => `wave-tablist-inert-${part}-${value}`,\n getStaticTabId: (value) => `wave-tablist-inert-tab-${value}`,\n getStaticPanelId: () => undefined,\n registry: INERT_REGISTRY,\n};\n\n/** C-CONTEXT: throws in development, logs once and returns an inert value in production. */\nfunction useTabListContext(component: string): TabListContextValue {\n const context = React.useContext(TabListContext);\n if (context) return context;\n reportMissingContext(component, '<TabList>');\n return INERT_CONTEXT;\n}\n\ninterface StructureProps {\n value?: unknown;\n id?: unknown;\n disabled?: unknown;\n 'aria-disabled'?: unknown;\n children?: unknown;\n}\n\n/** Whether a Tab's props make it unavailable (it cannot be selected and is skipped by keys). */\nfunction isUnavailable(props: StructureProps): boolean {\n const ariaDisabled = props['aria-disabled'];\n return props.disabled === true || ariaDisabled === true || ariaDisabled === 'true';\n}\n\n/** A consumer `id` that replaces the generated one: a non-empty string (`''` counts as none). */\nfunction consumerId(id: unknown): string | null {\n return typeof id === 'string' && id !== '' ? id : null;\n}\n\n/**\n * Walks the element tree of the TabList's children (see {@link TabListStructure}). Parts are\n * identified through their element type, so parts written in a Server Component (lazy\n * references) count too. A `React.lazy` still loading (inside the consumer's own `<Suspense>`,\n * such as code-split panels in `TabList.Panels`) is no part and never suspends the TabList: its\n * children are walked instead. Runs during render only.\n */\nfunction collectStructure(node: unknown, into: TabListStructure): TabListStructure {\n if (Array.isArray(node)) {\n node.forEach((child) => collectStructure(child, into));\n return into;\n }\n if (!React.isValidElement<StructureProps>(node)) return into;\n const { props } = node;\n const type = getElementType(node, { suspend: false });\n const value = typeof props.value === 'string' ? props.value : undefined;\n if (type === Tab) {\n if (value !== undefined) {\n if (into.firstEnabled === undefined && !isUnavailable(props)) into.firstEnabled = value;\n const id = consumerId(props.id);\n if (id !== null) into.tabIds.push([value, id]);\n }\n return into;\n }\n if (type === TabPanel) {\n if (value !== undefined) into.panels.push([value, consumerId(props.id)]);\n return into;\n }\n if (type === TabListRoot) return into;\n return collectStructure(props.children, into);\n}\n\n/**\n * Whether an element tree shows a Tab, or a Panel (`TabList.Panel` or `TabList.Panels`), found as\n * in {@link collectStructure}: through Fragments and the `children` of wrapper elements, not inside\n * a nested TabList or a component that renders the part itself.\n */\nfunction containsPart(node: unknown, part: TabListPart): boolean {\n if (Array.isArray(node)) return node.some((child) => containsPart(child, part));\n if (!React.isValidElement<StructureProps>(node)) return false;\n const type = getElementType(node, { suspend: false });\n if (type === Tab) return part === 'tab';\n if (type === TabPanel || type === TabPanels) return part === 'panel';\n if (type === TabListRoot) return false;\n return containsPart(node.props.children, part);\n}\n\n/**\n * Whether a child of the TabList renders after the tablist: a Panel, `TabList.Panels`, or a\n * wrapper (an element, `Suspense`, an error boundary) that holds panels and no tab.\n */\nfunction rendersAfterTablist(child: React.ReactNode): boolean {\n return containsPart(child, 'panel') && !containsPart(child, 'tab');\n}\n\n/**\n * Where the TabList renders its children: inside the `role=\"tablist\"` element (`'tabs'`) or after\n * it (`'panels'`). A Panel that ends up inside the tablist warns in development.\n */\nconst TabListAreaContext = React.createContext<'tabs' | 'panels' | null>(null);\n\nconst PANEL_IN_TABLIST_MESSAGE =\n 'TabList.Panel was rendered inside the role=\"tablist\" element, where only tabs belong (axe ' +\n 'aria-required-children). The TabList moves a Panel after the tablist when it is its child, or ' +\n 'in a wrapper that holds no Tab, but it cannot see a Panel that a component renders itself, or ' +\n \"separate a wrapper's Panels from its Tabs. Place such panels inside TabList.Panels, which \" +\n 'renders after the tablist.';\n\n/* ------------------------------------------------------------------ */\n/* TabList */\n/* ------------------------------------------------------------------ */\n\n/** Properties for the TabList component. */\nexport interface TabListProps extends Omit<React.HTMLAttributes<HTMLDivElement>, 'defaultValue'> {\n /**\n * Controlled value of the selected tab (`''`: no tab selected). A controlled value that becomes\n * `undefined` also selects no tab: the TabList stays controlled.\n */\n value?: string;\n /**\n * Selected tab for uncontrolled usage. When it is omitted (or `''`), the first enabled tab\n * written in the TabList's children is selected, from the first render (and in server-rendered\n * HTML) on. Tabs written directly in the children, in Fragments or in wrapper elements that\n * pass them as `children` (such as a Tooltip) count; a tab rendered by a custom component that\n * renders `TabList.Tab` itself does not, even when it comes first in the DOM, so that server\n * and client pick the same tab. When every tab comes from such a component, the first enabled\n * tab in the DOM is selected once the tabs mount. To select a tab that a custom component\n * renders, pass `defaultValue`.\n */\n defaultValue?: string;\n /** Called with the new value when the selected tab changes (not when it is activated again). */\n onValueChange?: (value: string) => void;\n /**\n * Layout and arrow-key axis: `'horizontal'` (Left/Right, mirrored in RTL) or `'vertical'`\n * (Up/Down).\n * @default 'horizontal'\n */\n orientation?: Orientation;\n /**\n * Whether moving focus with the arrow keys, Home and End also selects the tab (automatic\n * activation, as in 0.5). With `false`, the keys only move focus and Enter, Space or a click\n * selects the focused tab (manual activation, for panels that are slow to show). Fluent's\n * default is `false`.\n * @default true\n */\n selectTabOnFocus?: boolean;\n /** @deprecated Use `value`. */\n selectedValue?: string;\n /** @deprecated Use `defaultValue`. */\n defaultSelectedValue?: string;\n /**\n * @deprecated Use `onValueChange`. Unlike `onValueChange`, it is called on every activation,\n * including a click on the tab that is already selected.\n */\n onTabSelect?: (value: string) => void;\n /** @deprecated Use `orientation=\"vertical\"`. */\n vertical?: boolean;\n /** Ref to the `role=\"tablist\"` element. */\n ref?: React.Ref<HTMLDivElement>;\n}\n\nconst TabListRoot = ({\n value: valueProp,\n defaultValue: defaultValueProp,\n onValueChange,\n orientation: orientationProp,\n selectTabOnFocus = true,\n selectedValue,\n defaultSelectedValue,\n onTabSelect,\n vertical,\n className,\n children,\n onKeyDown,\n onFocus,\n ref,\n ...rest\n}: TabListProps) => {\n const value = resolveDeprecatedProp(\n 'TabList',\n valueProp,\n selectedValue,\n 'selectedValue',\n 'value',\n );\n const defaultValue = resolveDeprecatedProp(\n 'TabList',\n defaultValueProp,\n defaultSelectedValue,\n 'defaultSelectedValue',\n 'defaultValue',\n );\n const orientation =\n resolveDeprecatedProp<Orientation>(\n 'TabList',\n orientationProp,\n vertical === undefined ? undefined : vertical ? 'vertical' : 'horizontal',\n 'vertical',\n 'orientation',\n ) ?? 'horizontal';\n if (onTabSelect) {\n warnDeprecated(\n 'TabList',\n 'onTabSelect',\n 'onValueChange',\n '`onValueChange` is called only when the selected tab changes.',\n );\n }\n\n // The sticky mode: a controlled value that becomes `undefined` clears the selection (`''`).\n const [selected, setSelected, isControlled] = useControllable(\n value,\n defaultValue ?? '',\n onValueChange,\n );\n\n // The children are a new element tree on every parent render: memoized by content, so the\n // context value stays stable while the tabs and panels stay the same.\n const structureKey = JSON.stringify(collectStructure(children, { tabIds: [], panels: [] }));\n const structure = React.useMemo(() => {\n const parsed = JSON.parse(structureKey) as TabListStructure;\n return {\n firstEnabled: parsed.firstEnabled,\n tabIds: new Map(parsed.tabIds),\n panels: new Map(parsed.panels),\n };\n }, [structureKey]);\n\n // Uncontrolled without a selection: the first enabled tab is selected. It is the tab stop the\n // roving store resolves from `activeValue` (the first enabled tab of the children, replaced by\n // the first enabled tab in the DOM once the store sees it disabled), so the selection is\n // derived during render, present from the first render on, and follows tabs that disable\n // themselves.\n const derivesSelection = !isControlled && selected === '';\n\n const { containerProps, getTabIndex } = useRovingTabIndex({\n activeValue: derivesSelection ? (structure.firstEnabled ?? null) : selected,\n orientation,\n loop: true,\n // Automatic activation (APG Tabs): moving focus selects the tab. With manual activation the\n // keys only move focus; the tab stop stays on the selected tab (`tabStop: 'active'`), and Enter\n // or Space selects the focused tab through its native click.\n onFocusMove: selectTabOnFocus ? (next) => select(next) : undefined,\n });\n\n const isSelected = React.useCallback(\n (tabValue: string) => (derivesSelection ? getTabIndex(tabValue) === 0 : selected === tabValue),\n [derivesSelection, getTabIndex, selected],\n );\n\n const select = useEventCallback((next: string) => {\n onTabSelect?.(next);\n if (!isSelected(next)) setSelected(next);\n });\n\n const baseId = useId('tablist');\n const [registry] = React.useState(createRegistry);\n // Runs after the layout effects of the Tabs and Panels mounted with the TabList, which have\n // registered by then: from here on the registry, not the static structure, decides the links.\n React.useLayoutEffect(() => registry.markReady(), [registry]);\n const context = React.useMemo<TabListContextValue>(\n () => ({\n orientation,\n isSelected,\n select,\n getTabIndex,\n getGeneratedId: (part, itemValue) => getPartId(baseId, part, itemValue),\n getStaticTabId: (tabValue) =>\n structure.tabIds.get(tabValue) ?? getPartId(baseId, 'tab', tabValue),\n getStaticPanelId: (tabValue) => {\n const panel = structure.panels.get(tabValue);\n if (panel === undefined) return undefined;\n return panel ?? getPartId(baseId, 'panel', tabValue);\n },\n registry,\n }),\n [orientation, isSelected, select, getTabIndex, baseId, structure, registry],\n );\n\n const mergedRef = useMergedRefs<HTMLDivElement>(ref, containerProps.ref);\n\n const tabs: React.ReactNode[] = [];\n const panels: React.ReactNode[] = [];\n flattenChildren(children).forEach(({ key, node: child }) => {\n const keyed = <React.Fragment key={key}>{child}</React.Fragment>;\n (rendersAfterTablist(child) ? panels : tabs).push(keyed);\n });\n\n const isVertical = orientation === 'vertical';\n return (\n <TabListContext.Provider value={context}>\n <div className={cn(isVertical && 'flex')}>\n <div\n role=\"tablist\"\n aria-orientation={orientation}\n className={cn(\n isVertical\n ? 'flex w-40 flex-col border-e border-border'\n : 'flex border-b border-border',\n className,\n )}\n {...rest}\n data-roving-container=\"\"\n onKeyDown={composeEventHandlers(onKeyDown, containerProps.onKeyDown)}\n onFocus={composeEventHandlers(onFocus, containerProps.onFocus, {\n checkDefaultPrevented: false,\n })}\n ref={mergedRef}\n >\n <TabListAreaContext.Provider value=\"tabs\">{tabs}</TabListAreaContext.Provider>\n </div>\n <TabListAreaContext.Provider value=\"panels\">{panels}</TabListAreaContext.Provider>\n </div>\n </TabListContext.Provider>\n );\n};\nTabListRoot.displayName = 'TabList';\n\n/* ------------------------------------------------------------------ */\n/* TabList.Tab */\n/* ------------------------------------------------------------------ */\n\n/** Properties for the Tab sub-component. */\nexport interface TabProps extends React.ButtonHTMLAttributes<HTMLButtonElement> {\n /** Unique value identifying this tab (and its panel). */\n value: string;\n /** Ref to the tab `<button>`. */\n ref?: React.Ref<HTMLButtonElement>;\n}\n\n/**\n * A tab button. `onClick` runs before the selection (call `event.preventDefault()` to keep the\n * current tab). A `disabled` (or `aria-disabled=\"true\"`) tab is skipped by the keyboard and cannot\n * be selected. A non-empty `id` replaces the generated one (its panel's `aria-labelledby` follows\n * it). The selected tab references its panel with `aria-controls` only while a `TabList.Panel`\n * with its value is mounted.\n */\nconst Tab = ({ value, id: idProp, className, children, onClick, ref, ...rest }: TabProps) => {\n const ctx = useTabListContext('TabList.Tab');\n const selected = ctx.isSelected(value);\n const isVertical = ctx.orientation === 'vertical';\n const unavailable = isUnavailable(rest);\n\n const { registry } = ctx;\n const id = consumerId(idProp) ?? ctx.getGeneratedId('tab', value);\n React.useLayoutEffect(() => registry.register('tab', value, id), [registry, value, id]);\n const mountedPanelId = React.useSyncExternalStore(\n registry.subscribe,\n () => registry.get('panel', value),\n () => undefined,\n );\n // Before the TabList mounts the static structure stands in; after that only a mounted panel is\n // referenced (`null`: none).\n const panelId =\n mountedPanelId === undefined ? ctx.getStaticPanelId(value) : (mountedPanelId ?? undefined);\n\n return (\n <button\n type=\"button\"\n role=\"tab\"\n className={cn(\n 'px-4 py-2 text-body-1 font-semibold transition-colors motion-reduce:transition-none',\n isVertical && 'text-start',\n selected\n ? cn(\n 'text-primary',\n isVertical ? 'border-s-2 border-s-primary' : 'border-b-2 border-b-primary',\n )\n : 'text-muted-foreground not-disabled:not-aria-disabled:hover:text-foreground',\n disabledStyles,\n focusRingInset,\n className,\n )}\n {...rest}\n id={id}\n aria-selected={selected}\n aria-controls={selected ? panelId : undefined}\n tabIndex={ctx.getTabIndex(value)}\n data-roving-value={value}\n data-selected={selected ? '' : undefined}\n onClick={composeEventHandlers(onClick, () => {\n if (!unavailable) ctx.select(value);\n })}\n ref={ref}\n >\n {children}\n </button>\n );\n};\nTab.displayName = 'Tab';\n\n/* ------------------------------------------------------------------ */\n/* TabList.Panel */\n/* ------------------------------------------------------------------ */\n\n/** Properties for the TabPanel sub-component. */\nexport interface TabPanelProps extends React.HTMLAttributes<HTMLDivElement> {\n /** Value of the Tab that shows this panel. */\n value: string;\n /** Ref to the `role=\"tabpanel\"` element. */\n ref?: React.Ref<HTMLDivElement>;\n}\n\n/**\n * The content of one tab, rendered only while its tab is selected and labelled by it (while a Tab\n * with its value is mounted). A non-empty `id` replaces the generated one (the tab's\n * `aria-controls` follows it).\n */\nconst TabPanel = ({ value, id: idProp, children, className, ref, ...rest }: TabPanelProps) => {\n const ctx = useTabListContext('TabList.Panel');\n const insideTablist = React.useContext(TabListAreaContext) === 'tabs';\n React.useEffect(() => {\n if (insideTablist) warnOnce('TabList.Panel:inside-tablist', PANEL_IN_TABLIST_MESSAGE);\n }, [insideTablist]);\n const { registry } = ctx;\n const id = consumerId(idProp) ?? ctx.getGeneratedId('panel', value);\n // Registered while mounted, also while hidden: the tab that selects it links to it.\n React.useLayoutEffect(() => registry.register('panel', value, id), [registry, value, id]);\n const mountedTabId = React.useSyncExternalStore(\n registry.subscribe,\n () => registry.get('tab', value),\n () => undefined,\n );\n if (!ctx.isSelected(value)) return null;\n // As for the Tab's aria-controls: the static structure only before the TabList mounts.\n const tabId =\n mountedTabId === undefined ? ctx.getStaticTabId(value) : (mountedTabId ?? undefined);\n return (\n <div\n role=\"tabpanel\"\n tabIndex={0}\n className={cn('p-4', focusRing, className)}\n {...rest}\n id={id}\n aria-labelledby={tabId}\n ref={ref}\n >\n {children}\n </div>\n );\n};\nTabPanel.displayName = 'TabPanel';\n\n/* ------------------------------------------------------------------ */\n/* TabList.Panels */\n/* ------------------------------------------------------------------ */\n\n/** Properties for the TabPanels sub-component. */\nexport interface TabPanelsProps extends React.HTMLAttributes<HTMLDivElement> {\n /** Ref to the container `<div>`. */\n ref?: React.Ref<HTMLDivElement>;\n}\n\n/**\n * Optional container for the panels, rendered after the tablist. Use it to style the panel area,\n * and for panels that components render themselves: the TabList finds a Panel in its children, in\n * a Fragment or in a wrapper that holds no Tab, but a component that renders a Panel itself\n * renders inside the tablist unless it is placed in `TabList.Panels`.\n */\nconst TabPanels = ({ className, children, ref, ...rest }: TabPanelsProps) => (\n <div ref={ref} className={cn('min-w-0 flex-1', className)} {...rest}>\n {children}\n </div>\n);\nTabPanels.displayName = 'TabPanels';\n\n/* ------------------------------------------------------------------ */\n/* Export */\n/* ------------------------------------------------------------------ */\n\n/**\n * A set of tabs with their panels (WAI-ARIA Tabs pattern): the arrow keys (Left/Right, mirrored\n * in RTL; Up/Down when vertical), Home and End move focus and select (automatic activation); with\n * `selectTabOnFocus={false}` they only move focus, and Enter, Space or a click selects the focused\n * tab (manual activation). The selected tab is the only tab stop; disabled tabs are skipped. Every\n * tab needs a `value` that is unique within the TabList (a development warning names a value that\n * several tabs share).\n *\n * Tabs register through context and are found in DOM order, so they may be wrapped (a Fragment,\n * a Tooltip). The children render inside the `role=\"tablist\"` element, except panels, which render\n * after it: a `TabList.Panel` or `TabList.Panels` child, or a wrapper (an element, `Suspense`, an\n * error boundary) that holds panels and no Tab. A Panel that a component renders itself cannot be\n * seen from the children: put that component inside `TabList.Panels` (a development warning names\n * a Panel that ends up inside the tablist). Content that is not a tab, such as a button next to\n * the tabs, does not belong in a tablist either: render it outside the TabList.\n *\n * Sub-components are also exported under flat names (`TabListTab`, `TabListPanel`,\n * `TabListPanels`) for React Server Components, which cannot use the dotted form.\n */\nexport const TabList = /* @__PURE__ */ Object.assign(TabListRoot, {\n Tab,\n Panel: TabPanel,\n Panels: TabPanels,\n});\n\nexport { Tab as TabListTab, TabPanel as TabListPanel, TabPanels as TabListPanels };\n"],"mappings":";;;;;;;;;;;;;;;AAiDA,SAASG,EAAsB,GAAqB;CAClD,EACE,qBAAqBC,KACrB,0CAA0CA,EAAM,gIAElD;AACF;AAEA,SAAS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ACA,EAAS,cAAc;AAkBvB,IAAMjE,KAAa,EAAE,cAAW,aAAU,QAAK,GAAGO,QAChD,kBAAC,OAAD;CAAU;CAAK,WAAW0C,EAAG,kBAAkBC,CAAS;CAAG,GAAI3C;CAC5D;AACE,CAAA;AAEP,EAAU,cAAc;AAyBxB,IAAa4D,IAA0B,uBAAO,OAAOrE,GAAa;CAChE;CACA,OAAOD;CACP,QAAQG;AACV,CAAC"}
1
+ {"version":3,"file":"TabList.mjs","names":["useId","useId$1","React","warnDuplicateTabValue","value","createRegistry","entries","listeners","ready","emit","listener","map","part","ids","id","index","INERT_REGISTRY","TabListContext","INERT_CONTEXT","useTabListContext","reportMissingContext","component","isUnavailable","ariaDisabled","props","consumerId","collectStructure","node","child","into","type","getElementType","Tab","TabPanel","TabListRoot","containsPart","TabPanels","rendersAfterTablist","TabListAreaContext","PANEL_IN_TABLIST_MESSAGE","valueProp","defaultValueProp","orientationProp","rest","resolveDeprecatedProp","selectedValue","defaultValue","defaultSelectedValue","orientation","vertical","onTabSelect","warnDeprecated","selected","setSelected","isControlled","useControllable","onValueChange","structureKey","children","structure","parsed","derivesSelection","useRovingTabIndex","selectTabOnFocus","select","next","isSelected","getTabIndex","tabValue","useEventCallback","baseId","registry","context","getPartId","itemValue","panel","mergedRef","useMergedRefs","ref","containerProps","tabs","panels","keyed","key","isVertical","cn","tabListClassNames","className","composeEventHandlers","onKeyDown","onFocus","idProp","ctx","unavailable","mountedPanelId","panelId","tabListTabClassNames","disabledStyles","focusRingInset","onClick","insideTablist","warnOnce","mountedTabId","tabId","tabListPanelClassNames","focusRing","tabListPanelsClassNames","TabList"],"sources":["../../../src/components/layout/TabList.tsx"],"sourcesContent":["import * as React from 'react';\nimport {\n tabListClassNames,\n tabListPanelClassNames,\n tabListPanelsClassNames,\n tabListTabClassNames,\n} from '../../lib/classNames';\nimport { flattenChildren, getElementType } from '../../lib/children';\nimport { cn } from '../../lib/cn';\nimport { composeEventHandlers } from '../../lib/composeEventHandlers';\nimport {\n reportMissingContext,\n resolveDeprecatedProp,\n warnDeprecated,\n warnOnce,\n} from '../../lib/dev';\nimport { disabledStyles, focusRing, focusRingInset } from '../../lib/styles';\nimport type { Orientation } from '../../lib/types';\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';\nimport { getPartId } from './disclosureIds';\n\n/* ------------------------------------------------------------------ */\n/* Context */\n/* ------------------------------------------------------------------ */\n\ntype TabListPart = 'tab' | 'panel';\n\n/**\n * The ids of the mounted Tabs and Panels by value. A Tab references a panel only while one with\n * its value is mounted (a TabList used as a filter bar has none), and each side references the\n * other's actual id, a consumer `id` included. Read with `useSyncExternalStore`.\n *\n * Before the TabList has mounted (server HTML, hydration and the first client render) the\n * registry is not ready and the static structure of the children stands in for it; once it is\n * ready, it alone decides, so a Panel that is in the element tree but never mounts (inside a\n * wrapper that renders nothing) is not referenced.\n */\ninterface TabListRegistry {\n /** Registers a mounted Tab or Panel; returns the unregister function. */\n register: (part: TabListPart, value: string, id: string) => () => void;\n /**\n * Id of the first mounted Tab or Panel with this value, `null` when none is mounted, or\n * `undefined` while the registry is not ready (use the static structure then).\n */\n get: (part: TabListPart, value: string) => string | null | undefined;\n /** Called by the TabList once it (and so every Tab and Panel mounted with it) has mounted. */\n markReady: () => void;\n subscribe: (listener: () => void) => () => void;\n}\n\n/** Tabs that share a value share one id, and are selected and tab stops together. */\nfunction warnDuplicateTabValue(value: string): void {\n warnOnce(\n `TabList:duplicate:${value}`,\n `TabList: several tabs share the value \"${value}\". Tab values must be unique within a ` +\n 'TabList; tabs with the same value share one id and are selected (and tab stops) together.',\n );\n}\n\nfunction createRegistry(): TabListRegistry {\n const entries: Record<TabListPart, Map<string, string[]>> = { tab: new Map(), panel: new Map() };\n const listeners = new Set<() => void>();\n let ready = false;\n const emit = () => {\n listeners.forEach((listener) => listener());\n };\n return {\n register(part, value, id) {\n const map = entries[part];\n const ids = map.get(value) ?? [];\n // Called from the part's layout effect (C-DEV). Two Panels may share a value (the Tab links\n // to the first mounted one); two Tabs may not.\n if (part === 'tab' && ids.length > 0) warnDuplicateTabValue(value);\n map.set(value, [...ids, id]);\n emit();\n return () => {\n const ids = [...(map.get(value) ?? [])];\n const index = ids.indexOf(id);\n if (index !== -1) ids.splice(index, 1);\n if (ids.length > 0) map.set(value, ids);\n else map.delete(value);\n emit();\n };\n },\n get: (part, value) => (ready ? (entries[part].get(value)?.[0] ?? null) : undefined),\n markReady() {\n if (ready) return;\n ready = true;\n emit();\n },\n subscribe(listener) {\n listeners.add(listener);\n return () => {\n listeners.delete(listener);\n };\n },\n };\n}\n\nconst INERT_REGISTRY: TabListRegistry = {\n register: () => () => {},\n get: () => undefined,\n markReady: () => {},\n subscribe: () => () => {},\n};\n\n/**\n * What the TabList's children show before anything mounts (server HTML and the first render):\n * found in the element tree through Fragments and the `children` of wrapper elements, but not\n * inside a component that renders a Tab or Panel itself (the registry covers those once mounted).\n */\ninterface TabListStructure {\n /** Value of the first Tab without `disabled`/`aria-disabled`: the uncontrolled default. */\n firstEnabled?: string;\n /** Consumer `id`s of Tabs, by value. */\n tabIds: Array<[string, string]>;\n /** Values of the Panels, each with its consumer `id` or `null`. */\n panels: Array<[string, string | null]>;\n}\n\ninterface TabListContextValue {\n orientation: Orientation;\n /** Whether the tab with this value is the selected one (explicit value, else the tab stop). */\n isSelected: (value: string) => boolean;\n /**\n * Activates a tab: a click (Enter and Space click the tab button), or with automatic activation\n * focus moved by the keys.\n */\n select: (value: string) => void;\n getTabIndex: (value: string) => 0 | -1;\n /** The generated id of a Tab or Panel (used when it has no consumer `id`). */\n getGeneratedId: (part: TabListPart, value: string) => string;\n /**\n * Id of the Tab with this value before the TabList mounts: its consumer `id`, else the\n * generated one.\n */\n getStaticTabId: (value: string) => string;\n /**\n * Id of the Panel with this value before the TabList mounts, or `undefined` when the children\n * have none.\n */\n getStaticPanelId: (value: string) => string | undefined;\n registry: TabListRegistry;\n}\n\nconst TabListContext = React.createContext<TabListContextValue | null>(null);\n\nconst INERT_CONTEXT: TabListContextValue = {\n orientation: 'horizontal',\n isSelected: () => false,\n select: () => {},\n getTabIndex: () => -1,\n getGeneratedId: (part, value) => `wave-tablist-inert-${part}-${value}`,\n getStaticTabId: (value) => `wave-tablist-inert-tab-${value}`,\n getStaticPanelId: () => undefined,\n registry: INERT_REGISTRY,\n};\n\n/** C-CONTEXT: throws in development, logs once and returns an inert value in production. */\nfunction useTabListContext(component: string): TabListContextValue {\n const context = React.useContext(TabListContext);\n if (context) return context;\n reportMissingContext(component, '<TabList>');\n return INERT_CONTEXT;\n}\n\ninterface StructureProps {\n value?: unknown;\n id?: unknown;\n disabled?: unknown;\n 'aria-disabled'?: unknown;\n children?: unknown;\n}\n\n/** Whether a Tab's props make it unavailable (it cannot be selected and is skipped by keys). */\nfunction isUnavailable(props: StructureProps): boolean {\n const ariaDisabled = props['aria-disabled'];\n return props.disabled === true || ariaDisabled === true || ariaDisabled === 'true';\n}\n\n/** A consumer `id` that replaces the generated one: a non-empty string (`''` counts as none). */\nfunction consumerId(id: unknown): string | null {\n return typeof id === 'string' && id !== '' ? id : null;\n}\n\n/**\n * Walks the element tree of the TabList's children (see {@link TabListStructure}). Parts are\n * identified through their element type, so parts written in a Server Component (lazy\n * references) count too. A `React.lazy` still loading (inside the consumer's own `<Suspense>`,\n * such as code-split panels in `TabList.Panels`) is no part and never suspends the TabList: its\n * children are walked instead. Runs during render only.\n */\nfunction collectStructure(node: unknown, into: TabListStructure): TabListStructure {\n if (Array.isArray(node)) {\n node.forEach((child) => collectStructure(child, into));\n return into;\n }\n if (!React.isValidElement<StructureProps>(node)) return into;\n const { props } = node;\n const type = getElementType(node, { suspend: false });\n const value = typeof props.value === 'string' ? props.value : undefined;\n if (type === Tab) {\n if (value !== undefined) {\n if (into.firstEnabled === undefined && !isUnavailable(props)) into.firstEnabled = value;\n const id = consumerId(props.id);\n if (id !== null) into.tabIds.push([value, id]);\n }\n return into;\n }\n if (type === TabPanel) {\n if (value !== undefined) into.panels.push([value, consumerId(props.id)]);\n return into;\n }\n if (type === TabListRoot) return into;\n return collectStructure(props.children, into);\n}\n\n/**\n * Whether an element tree shows a Tab, or a Panel (`TabList.Panel` or `TabList.Panels`), found as\n * in {@link collectStructure}: through Fragments and the `children` of wrapper elements, not inside\n * a nested TabList or a component that renders the part itself.\n */\nfunction containsPart(node: unknown, part: TabListPart): boolean {\n if (Array.isArray(node)) return node.some((child) => containsPart(child, part));\n if (!React.isValidElement<StructureProps>(node)) return false;\n const type = getElementType(node, { suspend: false });\n if (type === Tab) return part === 'tab';\n if (type === TabPanel || type === TabPanels) return part === 'panel';\n if (type === TabListRoot) return false;\n return containsPart(node.props.children, part);\n}\n\n/**\n * Whether a child of the TabList renders after the tablist: a Panel, `TabList.Panels`, or a\n * wrapper (an element, `Suspense`, an error boundary) that holds panels and no tab.\n */\nfunction rendersAfterTablist(child: React.ReactNode): boolean {\n return containsPart(child, 'panel') && !containsPart(child, 'tab');\n}\n\n/**\n * Where the TabList renders its children: inside the `role=\"tablist\"` element (`'tabs'`) or after\n * it (`'panels'`). A Panel that ends up inside the tablist warns in development.\n */\nconst TabListAreaContext = React.createContext<'tabs' | 'panels' | null>(null);\n\nconst PANEL_IN_TABLIST_MESSAGE =\n 'TabList.Panel was rendered inside the role=\"tablist\" element, where only tabs belong (axe ' +\n 'aria-required-children). The TabList moves a Panel after the tablist when it is its child, or ' +\n 'in a wrapper that holds no Tab, but it cannot see a Panel that a component renders itself, or ' +\n \"separate a wrapper's Panels from its Tabs. Place such panels inside TabList.Panels, which \" +\n 'renders after the tablist.';\n\n/* ------------------------------------------------------------------ */\n/* TabList */\n/* ------------------------------------------------------------------ */\n\n/** Properties for the TabList component. */\nexport interface TabListProps extends Omit<React.HTMLAttributes<HTMLDivElement>, 'defaultValue'> {\n /**\n * Controlled value of the selected tab (`''`: no tab selected). A controlled value that becomes\n * `undefined` also selects no tab: the TabList stays controlled.\n */\n value?: string;\n /**\n * Selected tab for uncontrolled usage. When it is omitted (or `''`), the first enabled tab\n * written in the TabList's children is selected, from the first render (and in server-rendered\n * HTML) on. Tabs written directly in the children, in Fragments or in wrapper elements that\n * pass them as `children` (such as a Tooltip) count; a tab rendered by a custom component that\n * renders `TabList.Tab` itself does not, even when it comes first in the DOM, so that server\n * and client pick the same tab. When every tab comes from such a component, the first enabled\n * tab in the DOM is selected once the tabs mount. To select a tab that a custom component\n * renders, pass `defaultValue`.\n */\n defaultValue?: string;\n /** Called with the new value when the selected tab changes (not when it is activated again). */\n onValueChange?: (value: string) => void;\n /**\n * Layout and arrow-key axis: `'horizontal'` (Left/Right, mirrored in RTL) or `'vertical'`\n * (Up/Down).\n * @default 'horizontal'\n */\n orientation?: Orientation;\n /**\n * Whether moving focus with the arrow keys, Home and End also selects the tab (automatic\n * activation, as in 0.5). With `false`, the keys only move focus and Enter, Space or a click\n * selects the focused tab (manual activation, for panels that are slow to show). Fluent's\n * default is `false`.\n * @default true\n */\n selectTabOnFocus?: boolean;\n /** @deprecated Use `value`. */\n selectedValue?: string;\n /** @deprecated Use `defaultValue`. */\n defaultSelectedValue?: string;\n /**\n * @deprecated Use `onValueChange`. Unlike `onValueChange`, it is called on every activation,\n * including a click on the tab that is already selected.\n */\n onTabSelect?: (value: string) => void;\n /** @deprecated Use `orientation=\"vertical\"`. */\n vertical?: boolean;\n /** Ref to the `role=\"tablist\"` element. */\n ref?: React.Ref<HTMLDivElement>;\n}\n\nconst TabListRoot = ({\n value: valueProp,\n defaultValue: defaultValueProp,\n onValueChange,\n orientation: orientationProp,\n selectTabOnFocus = true,\n selectedValue,\n defaultSelectedValue,\n onTabSelect,\n vertical,\n className,\n children,\n onKeyDown,\n onFocus,\n ref,\n ...rest\n}: TabListProps) => {\n const value = resolveDeprecatedProp(\n 'TabList',\n valueProp,\n selectedValue,\n 'selectedValue',\n 'value',\n );\n const defaultValue = resolveDeprecatedProp(\n 'TabList',\n defaultValueProp,\n defaultSelectedValue,\n 'defaultSelectedValue',\n 'defaultValue',\n );\n const orientation =\n resolveDeprecatedProp<Orientation>(\n 'TabList',\n orientationProp,\n vertical === undefined ? undefined : vertical ? 'vertical' : 'horizontal',\n 'vertical',\n 'orientation',\n ) ?? 'horizontal';\n if (onTabSelect) {\n warnDeprecated(\n 'TabList',\n 'onTabSelect',\n 'onValueChange',\n '`onValueChange` is called only when the selected tab changes.',\n );\n }\n\n // The sticky mode: a controlled value that becomes `undefined` clears the selection (`''`).\n const [selected, setSelected, isControlled] = useControllable(\n value,\n defaultValue ?? '',\n onValueChange,\n );\n\n // The children are a new element tree on every parent render: memoized by content, so the\n // context value stays stable while the tabs and panels stay the same.\n const structureKey = JSON.stringify(collectStructure(children, { tabIds: [], panels: [] }));\n const structure = React.useMemo(() => {\n const parsed = JSON.parse(structureKey) as TabListStructure;\n return {\n firstEnabled: parsed.firstEnabled,\n tabIds: new Map(parsed.tabIds),\n panels: new Map(parsed.panels),\n };\n }, [structureKey]);\n\n // Uncontrolled without a selection: the first enabled tab is selected. It is the tab stop the\n // roving store resolves from `activeValue` (the first enabled tab of the children, replaced by\n // the first enabled tab in the DOM once the store sees it disabled), so the selection is\n // derived during render, present from the first render on, and follows tabs that disable\n // themselves.\n const derivesSelection = !isControlled && selected === '';\n\n const { containerProps, getTabIndex } = useRovingTabIndex({\n activeValue: derivesSelection ? (structure.firstEnabled ?? null) : selected,\n orientation,\n loop: true,\n // Automatic activation (APG Tabs): moving focus selects the tab. With manual activation the\n // keys only move focus; the tab stop stays on the selected tab (`tabStop: 'active'`), and Enter\n // or Space selects the focused tab through its native click.\n onFocusMove: selectTabOnFocus ? (next) => select(next) : undefined,\n });\n\n const isSelected = React.useCallback(\n (tabValue: string) => (derivesSelection ? getTabIndex(tabValue) === 0 : selected === tabValue),\n [derivesSelection, getTabIndex, selected],\n );\n\n const select = useEventCallback((next: string) => {\n onTabSelect?.(next);\n if (!isSelected(next)) setSelected(next);\n });\n\n const baseId = useId('tablist');\n const [registry] = React.useState(createRegistry);\n // Runs after the layout effects of the Tabs and Panels mounted with the TabList, which have\n // registered by then: from here on the registry, not the static structure, decides the links.\n React.useLayoutEffect(() => registry.markReady(), [registry]);\n const context = React.useMemo<TabListContextValue>(\n () => ({\n orientation,\n isSelected,\n select,\n getTabIndex,\n getGeneratedId: (part, itemValue) => getPartId(baseId, part, itemValue),\n getStaticTabId: (tabValue) =>\n structure.tabIds.get(tabValue) ?? getPartId(baseId, 'tab', tabValue),\n getStaticPanelId: (tabValue) => {\n const panel = structure.panels.get(tabValue);\n if (panel === undefined) return undefined;\n return panel ?? getPartId(baseId, 'panel', tabValue);\n },\n registry,\n }),\n [orientation, isSelected, select, getTabIndex, baseId, structure, registry],\n );\n\n const mergedRef = useMergedRefs<HTMLDivElement>(ref, containerProps.ref);\n\n const tabs: React.ReactNode[] = [];\n const panels: React.ReactNode[] = [];\n flattenChildren(children).forEach(({ key, node: child }) => {\n const keyed = <React.Fragment key={key}>{child}</React.Fragment>;\n (rendersAfterTablist(child) ? panels : tabs).push(keyed);\n });\n\n const isVertical = orientation === 'vertical';\n return (\n <TabListContext.Provider value={context}>\n <div className={cn(isVertical && 'flex')}>\n <div\n role=\"tablist\"\n aria-orientation={orientation}\n className={cn(\n tabListClassNames.root,\n isVertical\n ? 'flex w-40 flex-col border-e border-border'\n : 'flex border-b border-border',\n className,\n )}\n {...rest}\n data-roving-container=\"\"\n onKeyDown={composeEventHandlers(onKeyDown, containerProps.onKeyDown)}\n onFocus={composeEventHandlers(onFocus, containerProps.onFocus, {\n checkDefaultPrevented: false,\n })}\n ref={mergedRef}\n >\n <TabListAreaContext.Provider value=\"tabs\">{tabs}</TabListAreaContext.Provider>\n </div>\n <TabListAreaContext.Provider value=\"panels\">{panels}</TabListAreaContext.Provider>\n </div>\n </TabListContext.Provider>\n );\n};\nTabListRoot.displayName = 'TabList';\n\n/* ------------------------------------------------------------------ */\n/* TabList.Tab */\n/* ------------------------------------------------------------------ */\n\n/** Properties for the Tab sub-component. */\nexport interface TabProps extends React.ButtonHTMLAttributes<HTMLButtonElement> {\n /** Unique value identifying this tab (and its panel). */\n value: string;\n /** Ref to the tab `<button>`. */\n ref?: React.Ref<HTMLButtonElement>;\n}\n\n/**\n * A tab button. `onClick` runs before the selection (call `event.preventDefault()` to keep the\n * current tab). A `disabled` (or `aria-disabled=\"true\"`) tab is skipped by the keyboard and cannot\n * be selected. A non-empty `id` replaces the generated one (its panel's `aria-labelledby` follows\n * it). The selected tab references its panel with `aria-controls` only while a `TabList.Panel`\n * with its value is mounted.\n */\nconst Tab = ({ value, id: idProp, className, children, onClick, ref, ...rest }: TabProps) => {\n const ctx = useTabListContext('TabList.Tab');\n const selected = ctx.isSelected(value);\n const isVertical = ctx.orientation === 'vertical';\n const unavailable = isUnavailable(rest);\n\n const { registry } = ctx;\n const id = consumerId(idProp) ?? ctx.getGeneratedId('tab', value);\n React.useLayoutEffect(() => registry.register('tab', value, id), [registry, value, id]);\n const mountedPanelId = React.useSyncExternalStore(\n registry.subscribe,\n () => registry.get('panel', value),\n () => undefined,\n );\n // Before the TabList mounts the static structure stands in; after that only a mounted panel is\n // referenced (`null`: none).\n const panelId =\n mountedPanelId === undefined ? ctx.getStaticPanelId(value) : (mountedPanelId ?? undefined);\n\n return (\n <button\n type=\"button\"\n role=\"tab\"\n className={cn(\n tabListTabClassNames.root,\n 'px-4 py-2 text-body-1 font-semibold transition-colors motion-reduce:transition-none',\n isVertical && 'text-start',\n selected\n ? cn(\n 'text-primary',\n isVertical ? 'border-s-2 border-s-primary' : 'border-b-2 border-b-primary',\n )\n : 'text-muted-foreground not-disabled:not-aria-disabled:hover:text-foreground',\n disabledStyles,\n focusRingInset,\n className,\n )}\n {...rest}\n id={id}\n aria-selected={selected}\n aria-controls={selected ? panelId : undefined}\n tabIndex={ctx.getTabIndex(value)}\n data-roving-value={value}\n data-selected={selected ? '' : undefined}\n onClick={composeEventHandlers(onClick, () => {\n if (!unavailable) ctx.select(value);\n })}\n ref={ref}\n >\n {children}\n </button>\n );\n};\nTab.displayName = 'Tab';\n\n/* ------------------------------------------------------------------ */\n/* TabList.Panel */\n/* ------------------------------------------------------------------ */\n\n/** Properties for the TabPanel sub-component. */\nexport interface TabPanelProps extends React.HTMLAttributes<HTMLDivElement> {\n /** Value of the Tab that shows this panel. */\n value: string;\n /** Ref to the `role=\"tabpanel\"` element. */\n ref?: React.Ref<HTMLDivElement>;\n}\n\n/**\n * The content of one tab, rendered only while its tab is selected and labelled by it (while a Tab\n * with its value is mounted). A non-empty `id` replaces the generated one (the tab's\n * `aria-controls` follows it).\n */\nconst TabPanel = ({ value, id: idProp, children, className, ref, ...rest }: TabPanelProps) => {\n const ctx = useTabListContext('TabList.Panel');\n const insideTablist = React.useContext(TabListAreaContext) === 'tabs';\n React.useEffect(() => {\n if (insideTablist) warnOnce('TabList.Panel:inside-tablist', PANEL_IN_TABLIST_MESSAGE);\n }, [insideTablist]);\n const { registry } = ctx;\n const id = consumerId(idProp) ?? ctx.getGeneratedId('panel', value);\n // Registered while mounted, also while hidden: the tab that selects it links to it.\n React.useLayoutEffect(() => registry.register('panel', value, id), [registry, value, id]);\n const mountedTabId = React.useSyncExternalStore(\n registry.subscribe,\n () => registry.get('tab', value),\n () => undefined,\n );\n if (!ctx.isSelected(value)) return null;\n // As for the Tab's aria-controls: the static structure only before the TabList mounts.\n const tabId =\n mountedTabId === undefined ? ctx.getStaticTabId(value) : (mountedTabId ?? undefined);\n return (\n <div\n role=\"tabpanel\"\n tabIndex={0}\n className={cn(tabListPanelClassNames.root, 'p-4', focusRing, className)}\n {...rest}\n id={id}\n aria-labelledby={tabId}\n ref={ref}\n >\n {children}\n </div>\n );\n};\nTabPanel.displayName = 'TabPanel';\n\n/* ------------------------------------------------------------------ */\n/* TabList.Panels */\n/* ------------------------------------------------------------------ */\n\n/** Properties for the TabPanels sub-component. */\nexport interface TabPanelsProps extends React.HTMLAttributes<HTMLDivElement> {\n /** Ref to the container `<div>`. */\n ref?: React.Ref<HTMLDivElement>;\n}\n\n/**\n * Optional container for the panels, rendered after the tablist. Use it to style the panel area,\n * and for panels that components render themselves: the TabList finds a Panel in its children, in\n * a Fragment or in a wrapper that holds no Tab, but a component that renders a Panel itself\n * renders inside the tablist unless it is placed in `TabList.Panels`.\n */\nconst TabPanels = ({ className, children, ref, ...rest }: TabPanelsProps) => (\n <div\n ref={ref}\n className={cn(tabListPanelsClassNames.root, 'min-w-0 flex-1', className)}\n {...rest}\n >\n {children}\n </div>\n);\nTabPanels.displayName = 'TabPanels';\n\n/* ------------------------------------------------------------------ */\n/* Export */\n/* ------------------------------------------------------------------ */\n\n/**\n * A set of tabs with their panels (WAI-ARIA Tabs pattern): the arrow keys (Left/Right, mirrored\n * in RTL; Up/Down when vertical), Home and End move focus and select (automatic activation); with\n * `selectTabOnFocus={false}` they only move focus, and Enter, Space or a click selects the focused\n * tab (manual activation). The selected tab is the only tab stop; disabled tabs are skipped. Every\n * tab needs a `value` that is unique within the TabList (a development warning names a value that\n * several tabs share).\n *\n * Tabs register through context and are found in DOM order, so they may be wrapped (a Fragment,\n * a Tooltip). The children render inside the `role=\"tablist\"` element, except panels, which render\n * after it: a `TabList.Panel` or `TabList.Panels` child, or a wrapper (an element, `Suspense`, an\n * error boundary) that holds panels and no Tab. A Panel that a component renders itself cannot be\n * seen from the children: put that component inside `TabList.Panels` (a development warning names\n * a Panel that ends up inside the tablist). Content that is not a tab, such as a button next to\n * the tabs, does not belong in a tablist either: render it outside the TabList.\n *\n * Sub-components are also exported under flat names (`TabListTab`, `TabListPanel`,\n * `TabListPanels`) for React Server Components, which cannot use the dotted form.\n */\nexport const TabList = /* @__PURE__ */ Object.assign(TabListRoot, {\n Tab,\n Panel: TabPanel,\n Panels: TabPanels,\n});\n\nexport { Tab as TabListTab, TabPanel as TabListPanel, TabPanels as TabListPanels };\n"],"mappings":";;;;;;;;;;;;;;;;AAuDA,SAASG,EAAsB,GA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WAAWjB,EAAGmB,EAAuB,MAAM,OAAOC,GAAWlB,CAAS;EACtE,GAAI5C;EACA;EACJ,mBAAiB4D;EACZ;EAEJ;CACE,CAAA;AAET;AACA,EAAS,cAAc;AAkBvB,IAAMnE,KAAa,EAAE,cAAW,aAAU,QAAK,GAAGO,QAChD,kBAAC,OAAD;CACO;CACL,WAAW0C,EAAGqB,EAAwB,MAAM,kBAAkBnB,CAAS;CACvE,GAAI5C;CAEH;AACE,CAAA;AAEP,EAAU,cAAc;AAyBxB,IAAagE,IAA0B,uBAAO,OAAOzE,GAAa;CAChE;CACA,OAAOD;CACP,QAAQG;AACV,CAAC"}
@@ -1,2 +1,2 @@
1
- "use client";const e=require("../../_virtual/_rolldown/runtime.cjs"),t=require("../../lib/cn.cjs"),n=require("../../lib/children.cjs"),r=require("../../lib/dev.cjs"),i=require("../../lib/slot.cjs"),a=require("../../lib/composeEventHandlers.cjs"),o=require("../../hooks/useEventCallback.cjs"),s=require("../../hooks/useControllable.cjs"),c=require("../../hooks/useId.cjs"),l=require("../../lib/direction.cjs"),u=require("../../hooks/useRovingTabIndex.cjs"),d=require("../../hooks/useMergedRefs.cjs"),f=require("../../lib/styles.cjs"),p=require("../../lib/icons.cjs");let m=require("react");m=e.__toESM(m,1);let h=require("react/jsx-runtime");var g=m.createContext(null),_=m.createContext(null),v=m.createContext(!1),y=[],b={expanded:new Set,toggle:()=>{},expand:()=>{},activate:()=>{},selected:void 0,current:void 0,getTabIndex:()=>-1,focusValue:()=>{},onItemFocus:()=>{},registerValue:()=>()=>{}};function x(e){return m.useContext(g)||(r.reportMissingContext(e,`<Tree>`),b)}var S="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 C(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 w=({expandedItems:e,defaultExpandedItems:n,onExpandedItemsChange:i,onItemSelect:c,selected:l,current:f,className:p,children:b,onKeyDown:x,onKeyDownCapture:S,onFocus:w,onBlur:E,ref:D,...O})=>{let[k]=m.useState(()=>n??y),[A,j]=s.useControllable(e,k,e=>i?.([...e])),M=m.useMemo(()=>new Set(A),[A]),N=m.useCallback(e=>{j(t=>t.includes(e)?t.filter(t=>t!==e):[...t,e])},[j]),P=m.useCallback(e=>{j(t=>{let n=e.filter(e=>!t.includes(e));return n.length>0?[...t,...n]:t})},[j]),F=o.useEventCallback(e=>{c?.(e)}),[I,L]=m.useState(null),R=m.useRef(null),z=m.useCallback(e=>{if(!r.isDev)return()=>{};R.current??=new Map;let t=R.current,n=(t.get(e)??0)+1;return t.set(e,n),n>1&&C(e),()=>{let n=(t.get(e)??1)-1;n>0?t.set(e,n):t.delete(e)}},[]),{containerProps:B,getTabIndex:V,focusValue:H}=u.useRovingTabIndex({activeValue:I??l??null,orientation:`vertical`,loop:!1,typeahead:!0}),U=m.useMemo(()=>({expanded:M,toggle:N,expand:P,activate:F,selected:l,current:f,getTabIndex:V,focusValue:H,onItemFocus:L,registerValue:z}),[M,N,P,F,l,f,V,H,z]),W=d.useMergedRefs(D,B.ref),G=e=>{e.key.length===1&&T(e.currentTarget),B.onKeyDown(e)},K=e=>{e.key===` `&&T(e.currentTarget),B.onKeyDownCapture(e)},q=e=>{let t=e.relatedTarget;(!t||!e.currentTarget.contains(t))&&L(null)};return(0,h.jsx)(g.Provider,{value:U,children:(0,h.jsx)(_.Provider,{value:null,children:(0,h.jsx)(`div`,{role:`tree`,className:t.cn(`text-body-1`,p),...O,"data-roving-container":``,onKeyDown:a.composeEventHandlers(x,G),onKeyDownCapture:a.composeEventHandlers(S,K),onFocus:a.composeEventHandlers(w,B.onFocus,{checkDefaultPrevented:!1}),onBlur:a.composeEventHandlers(E,q,{checkDefaultPrevented:!1}),ref:W,children:(0,h.jsx)(v.Provider,{value:!1,children:b})})})})};w.displayName=`Tree`;function T(e){e.querySelectorAll(`[role="treeitem"]`).forEach(e=>{let t=e.querySelector(`:scope > [data-tree-row] > [data-tree-label]`);if(!t)return;let n=t.getAttribute(`data-roving-text`)??t.textContent??``;e.getAttribute(`data-roving-text`)!==n&&e.setAttribute(`data-roving-text`,n)})}function E(e){return e.target?.closest?.(`[role="treeitem"]`)===e.currentTarget}function D(e){let t=e.target;return t===e.currentTarget||t?.closest?.(`[data-tree-row]`)?.parentElement===e.currentTarget}var O=({value:e,icon:o,leaf:s=!1,className:u,children:d,onClick:g,onKeyDown:y,onFocus:b,ref:C,...T})=>{let{"data-roving-text":k,...A}=T,j=x(`Tree.Item`),M=m.useContext(_),N=m.useContext(v),P=j.expanded.has(e),F=c.useId(`tree-item-label`),{registerValue:I}=j;m.useEffect(()=>I(e),[I,e]),m.useEffect(()=>{N&&r.warnOnce(`Tree.Item:inside-label`,S)},[N]);let L=[],R=[],z;n.flattenChildren(d).forEach(({key:e,node:t})=>{let r=(0,h.jsx)(m.Fragment,{children:t},e);n.isElementOfType(t,O)?(z??=t.props.value,L.push(r)):n.isElementOfType(t,w)?L.push(r):R.push(r)});let B=o&&i.slotRendersContent(o)?i.renderSlot(o,`span`,`inline-flex shrink-0`,{"aria-hidden":!0}):null,V=L.length>0&&!s,H=j.selected===void 0?void 0:j.selected===e,U=j.current!==void 0&&j.current!==null&&j.current===e,W=()=>{V&&j.toggle(e),j.activate(e)},G=e=>{D(e)&&(g?.(e),e.defaultPrevented||W())},K=t=>{if(!E(t)||(y?.(t),t.defaultPrevented||t.altKey||t.ctrlKey||t.metaKey))return;let n=l.getDirection(t.currentTarget)===`rtl`,r=n?`ArrowLeft`:`ArrowRight`,i=n?`ArrowRight`:`ArrowLeft`;switch(t.key){case`Enter`:case` `:t.preventDefault(),W();return;case r:if(t.preventDefault(),!V)return;P?z!==void 0&&j.focusValue(z):j.toggle(e);return;case i:t.preventDefault(),V&&P?j.toggle(e):M!==null&&j.focusValue(M);return;case`*`:{t.preventDefault();let e=t.currentTarget.parentElement?.querySelectorAll(`:scope > [role="treeitem"][aria-expanded="false"][data-roving-value]`);j.expand(Array.from(e??[],e=>e.getAttribute(`data-roving-value`)??``).filter(Boolean));return}}},q=t=>{t.target===t.currentTarget&&j.onItemFocus(e)};return(0,h.jsxs)(`div`,{role:`treeitem`,"aria-selected":H,"aria-current":U?!0:void 0,className:t.cn(`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`,u),...A,"aria-labelledby":A[`aria-labelledby`]??(A[`aria-label`]===void 0?F:void 0),"aria-expanded":V?P:void 0,tabIndex:j.getTabIndex(e),"data-roving-value":e,"data-selected":H?``:void 0,"data-current":U?``:void 0,onClick:G,onKeyDown:K,onFocus:a.composeEventHandlers(b,q,{checkDefaultPrevented:!1}),ref:C,children:[(0,h.jsxs)(`div`,{"data-tree-row":``,className:t.cn(`flex cursor-pointer items-center gap-1.5 rounded px-2 py-1 hover:bg-subtle-hover`,H&&t.cn(`bg-subtle-selected font-semibold`,f.forcedColors.selectedContainer)),children:[V?(0,h.jsx)(p.ChevronRightIcon,{className:t.cn(`shrink-0 transition-transform motion-reduce:transition-none`,P?`rotate-90`:`wave-rtl:-scale-x-100`)}):(0,h.jsx)(`span`,{className:`w-3 shrink-0`,"aria-hidden":`true`}),B,(0,h.jsx)(`span`,{id:F,"data-tree-label":``,"data-roving-text":k,className:`truncate`,children:(0,h.jsx)(v.Provider,{value:!0,children:R})})]}),V&&P&&(0,h.jsx)(_.Provider,{value:e,children:(0,h.jsx)(v.Provider,{value:!1,children:(0,h.jsx)(`div`,{role:`group`,className:`ps-4`,children:L})})})]})};O.displayName=`TreeItem`;var k=Object.assign(w,{Item:O});exports.Tree=k,exports.TreeItem=O;
1
+ "use client";const e=require("./Tree.core.cjs"),t=require("./Tree.itemPersonaLayout.cjs");var n=Object.assign(e.TreeRoot,{Item:e.TreeItem,ItemPersonaLayout:t.TreeItemPersonaLayout});exports.Tree=n,exports.TreeItem=e.TreeItem,exports.TreeItemPersonaLayout=t.TreeItemPersonaLayout;
2
2
  //# sourceMappingURL=Tree.cjs.map
@@ -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,CAEA,IAAMG,EACJ,uhBAOF,SAASC,EAAmB,EAAqB,CAC/CrB,EAAA,SACE,kBAAkBsB,IAClB,wCAAwCA,EAAM,uHAEhD,CACF,CAiCA,IAAMC,GAAY,CAChB,gBACA,uBACA,wBACA,eACA,WACA,UACA,YACA,WACA,YACA,mBACA,UACA,SACA,MACA,GAAGC,KACY,CACf,GAAM,CAACC,GAAmB3C,EAAM,aAAkC4C,GAAwBV,CAAK,EACzF,CAACW,EAAcC,GAAmB7C,EAAAA,gBACtC8C,EACAJ,EACC,GAASK,IAAwB,CAAC,GAAGC,CAAI,CAAC,CAC7C,EACMC,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D4E,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,EAE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