@bevelo/react 0.0.0-stage → 0.1.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 (803) hide show
  1. package/LICENSE +21 -0
  2. package/dist/accordion-parts.cjs +33 -0
  3. package/dist/accordion-parts.d.cts +21 -0
  4. package/dist/accordion-parts.d.ts +21 -0
  5. package/dist/accordion-parts.js +28 -0
  6. package/dist/accordion.cjs +182 -0
  7. package/dist/accordion.d.cts +79 -0
  8. package/dist/accordion.d.ts +79 -0
  9. package/dist/accordion.js +176 -0
  10. package/dist/agent.cjs +56 -0
  11. package/dist/agent.d.cts +16 -0
  12. package/dist/agent.d.ts +16 -0
  13. package/dist/agent.js +1 -0
  14. package/dist/alert-dialog-CXU7gjLv.js +466 -0
  15. package/dist/alert-dialog-DrZoqcTb.cjs +543 -0
  16. package/dist/alert-dialog-Dxcfl30r.d.cts +145 -0
  17. package/dist/alert-dialog-parts.cjs +50 -0
  18. package/dist/alert-dialog-parts.d.cts +38 -0
  19. package/dist/alert-dialog-parts.d.ts +38 -0
  20. package/dist/alert-dialog-parts.js +44 -0
  21. package/dist/alert-dialog-rH0B74ee.d.ts +145 -0
  22. package/dist/alert-dialog.cjs +12 -0
  23. package/dist/alert-dialog.d.cts +2 -0
  24. package/dist/alert-dialog.d.ts +2 -0
  25. package/dist/alert-dialog.js +1 -0
  26. package/dist/alert-parts.cjs +22 -0
  27. package/dist/alert-parts.d.cts +14 -0
  28. package/dist/alert-parts.d.ts +14 -0
  29. package/dist/alert-parts.js +17 -0
  30. package/dist/alert.cjs +36 -0
  31. package/dist/alert.d.cts +25 -0
  32. package/dist/alert.d.ts +25 -0
  33. package/dist/alert.js +35 -0
  34. package/dist/aspect-ratio-parts.cjs +11 -0
  35. package/dist/aspect-ratio-parts.d.cts +11 -0
  36. package/dist/aspect-ratio-parts.d.ts +11 -0
  37. package/dist/aspect-ratio-parts.js +9 -0
  38. package/dist/aspect-ratio.cjs +15 -0
  39. package/dist/aspect-ratio.d.cts +13 -0
  40. package/dist/aspect-ratio.d.ts +13 -0
  41. package/dist/aspect-ratio.js +14 -0
  42. package/dist/async-options.cjs +127 -0
  43. package/dist/async-options.d.cts +34 -0
  44. package/dist/async-options.d.ts +34 -0
  45. package/dist/async-options.js +90 -0
  46. package/dist/autocomplete-parts.cjs +37 -0
  47. package/dist/autocomplete-parts.d.cts +15 -0
  48. package/dist/autocomplete-parts.d.ts +15 -0
  49. package/dist/autocomplete-parts.js +27 -0
  50. package/dist/autocomplete.cjs +383 -0
  51. package/dist/autocomplete.d.cts +158 -0
  52. package/dist/autocomplete.d.ts +158 -0
  53. package/dist/autocomplete.js +367 -0
  54. package/dist/avatar.cjs +172 -0
  55. package/dist/avatar.d.cts +77 -0
  56. package/dist/avatar.d.ts +77 -0
  57. package/dist/avatar.js +169 -0
  58. package/dist/badge.cjs +49 -0
  59. package/dist/badge.d.cts +48 -0
  60. package/dist/badge.d.ts +48 -0
  61. package/dist/badge.js +47 -0
  62. package/dist/breadcrumb-parts.cjs +47 -0
  63. package/dist/breadcrumb-parts.d.cts +29 -0
  64. package/dist/breadcrumb-parts.d.ts +29 -0
  65. package/dist/breadcrumb-parts.js +40 -0
  66. package/dist/breadcrumb.cjs +63 -0
  67. package/dist/breadcrumb.d.cts +28 -0
  68. package/dist/breadcrumb.d.ts +28 -0
  69. package/dist/breadcrumb.js +62 -0
  70. package/dist/button-group.cjs +25 -0
  71. package/dist/button-group.d.cts +54 -0
  72. package/dist/button-group.d.ts +54 -0
  73. package/dist/button-group.js +24 -0
  74. package/dist/button.cjs +98 -0
  75. package/dist/button.d.cts +69 -0
  76. package/dist/button.d.ts +69 -0
  77. package/dist/button.js +96 -0
  78. package/dist/calendar-BkpTwyKZ.cjs +1059 -0
  79. package/dist/calendar-D7gRz8P-.js +964 -0
  80. package/dist/calendar-DSGMQvRe.d.cts +167 -0
  81. package/dist/calendar-kEC-wyey.d.ts +167 -0
  82. package/dist/calendar-parts.cjs +31 -0
  83. package/dist/calendar-parts.d.cts +13 -0
  84. package/dist/calendar-parts.d.ts +13 -0
  85. package/dist/calendar-parts.js +23 -0
  86. package/dist/calendar.cjs +15 -0
  87. package/dist/calendar.d.cts +2 -0
  88. package/dist/calendar.d.ts +2 -0
  89. package/dist/calendar.js +1 -0
  90. package/dist/card-Ct7BZgwB.cjs +90 -0
  91. package/dist/card-Dbqbi_C2.js +85 -0
  92. package/dist/card-parts.cjs +32 -0
  93. package/dist/card-parts.d.cts +21 -0
  94. package/dist/card-parts.d.ts +21 -0
  95. package/dist/card-parts.js +26 -0
  96. package/dist/card.cjs +3 -0
  97. package/dist/card.d.cts +31 -0
  98. package/dist/card.d.ts +31 -0
  99. package/dist/card.js +1 -0
  100. package/dist/carousel-parts.cjs +52 -0
  101. package/dist/carousel-parts.d.cts +31 -0
  102. package/dist/carousel-parts.d.ts +31 -0
  103. package/dist/carousel-parts.js +40 -0
  104. package/dist/carousel.cjs +288 -0
  105. package/dist/carousel.d.cts +160 -0
  106. package/dist/carousel.d.ts +160 -0
  107. package/dist/carousel.js +277 -0
  108. package/dist/checkbox-group-C_H-SE-v.cjs +105 -0
  109. package/dist/checkbox-group-lW8QoRfJ.js +94 -0
  110. package/dist/checkbox-group-parts.cjs +19 -0
  111. package/dist/checkbox-group-parts.d.cts +9 -0
  112. package/dist/checkbox-group-parts.d.ts +9 -0
  113. package/dist/checkbox-group-parts.js +15 -0
  114. package/dist/checkbox-group.cjs +3 -0
  115. package/dist/checkbox-group.d.cts +32 -0
  116. package/dist/checkbox-group.d.ts +32 -0
  117. package/dist/checkbox-group.js +1 -0
  118. package/dist/checkbox-parts.cjs +13 -0
  119. package/dist/checkbox-parts.d.cts +7 -0
  120. package/dist/checkbox-parts.d.ts +7 -0
  121. package/dist/checkbox-parts.js +11 -0
  122. package/dist/checkbox.cjs +104 -0
  123. package/dist/checkbox.d.cts +58 -0
  124. package/dist/checkbox.d.ts +58 -0
  125. package/dist/checkbox.js +101 -0
  126. package/dist/children.cjs +177 -0
  127. package/dist/children.d.cts +18 -0
  128. package/dist/children.d.ts +18 -0
  129. package/dist/children.js +175 -0
  130. package/dist/collapsible-parts.cjs +29 -0
  131. package/dist/collapsible-parts.d.cts +19 -0
  132. package/dist/collapsible-parts.d.ts +19 -0
  133. package/dist/collapsible-parts.js +25 -0
  134. package/dist/collapsible.cjs +128 -0
  135. package/dist/collapsible.d.cts +65 -0
  136. package/dist/collapsible.d.ts +65 -0
  137. package/dist/collapsible.js +124 -0
  138. package/dist/color-picker.cjs +305 -0
  139. package/dist/color-picker.d.cts +164 -0
  140. package/dist/color-picker.d.ts +164 -0
  141. package/dist/color-picker.js +290 -0
  142. package/dist/color.cjs +62 -0
  143. package/dist/color.d.cts +2 -0
  144. package/dist/color.d.ts +2 -0
  145. package/dist/color.js +1 -0
  146. package/dist/combobox-parts.cjs +31 -0
  147. package/dist/combobox-parts.d.cts +15 -0
  148. package/dist/combobox-parts.d.ts +15 -0
  149. package/dist/combobox-parts.js +23 -0
  150. package/dist/combobox.cjs +533 -0
  151. package/dist/combobox.d.cts +211 -0
  152. package/dist/combobox.d.ts +211 -0
  153. package/dist/combobox.js +508 -0
  154. package/dist/command-parts.cjs +40 -0
  155. package/dist/command-parts.d.cts +16 -0
  156. package/dist/command-parts.d.ts +16 -0
  157. package/dist/command-parts.js +29 -0
  158. package/dist/command.cjs +837 -0
  159. package/dist/command.d.cts +201 -0
  160. package/dist/command.d.ts +201 -0
  161. package/dist/command.js +823 -0
  162. package/dist/compound-helpers-C--V3vAy.d.ts +75 -0
  163. package/dist/compound-helpers-C0Sx_vxV.js +490 -0
  164. package/dist/compound-helpers-Dhm54_n4.cjs +699 -0
  165. package/dist/compound-helpers-g8EZGzme.d.cts +75 -0
  166. package/dist/compound-registry-BDVOjXHa.js +118 -0
  167. package/dist/compound-registry-jhlDoTDR.cjs +141 -0
  168. package/dist/context-menu-parts.cjs +16 -0
  169. package/dist/context-menu-parts.d.cts +7 -0
  170. package/dist/context-menu-parts.d.ts +7 -0
  171. package/dist/context-menu-parts.js +14 -0
  172. package/dist/context-menu.cjs +85 -0
  173. package/dist/context-menu.d.cts +45 -0
  174. package/dist/context-menu.d.ts +45 -0
  175. package/dist/context-menu.js +83 -0
  176. package/dist/controller-C8Z-wsos.d.cts +5 -0
  177. package/dist/controller-C8Z-wsos.d.ts +5 -0
  178. package/dist/controller-DEAYKbYU.js +52 -0
  179. package/dist/controller-DvBz7LNG.cjs +63 -0
  180. package/dist/date-input-parts.cjs +13 -0
  181. package/dist/date-input-parts.d.cts +7 -0
  182. package/dist/date-input-parts.d.ts +7 -0
  183. package/dist/date-input-parts.js +11 -0
  184. package/dist/date-input.cjs +156 -0
  185. package/dist/date-input.d.cts +91 -0
  186. package/dist/date-input.d.ts +91 -0
  187. package/dist/date-input.js +153 -0
  188. package/dist/date-picker-parts.cjs +22 -0
  189. package/dist/date-picker-parts.d.cts +10 -0
  190. package/dist/date-picker-parts.d.ts +10 -0
  191. package/dist/date-picker-parts.js +17 -0
  192. package/dist/date-picker.cjs +1040 -0
  193. package/dist/date-picker.d.cts +99 -0
  194. package/dist/date-picker.d.ts +99 -0
  195. package/dist/date-picker.js +1024 -0
  196. package/dist/date.cjs +56 -0
  197. package/dist/date.d.cts +2 -0
  198. package/dist/date.d.ts +2 -0
  199. package/dist/date.js +1 -0
  200. package/dist/dialog-CUgRlS5R.js +474 -0
  201. package/dist/dialog-DQ0OOOSi.cjs +533 -0
  202. package/dist/dialog-parts.cjs +33 -0
  203. package/dist/dialog-parts.d.cts +27 -0
  204. package/dist/dialog-parts.d.ts +27 -0
  205. package/dist/dialog-parts.js +30 -0
  206. package/dist/dialog-view-DwlJaE43.cjs +157 -0
  207. package/dist/dialog-view-XeUVTMHa.js +140 -0
  208. package/dist/dialog.cjs +12 -0
  209. package/dist/dialog.d.cts +147 -0
  210. package/dist/dialog.d.ts +147 -0
  211. package/dist/dialog.js +1 -0
  212. package/dist/direction-parts.cjs +11 -0
  213. package/dist/direction-parts.d.cts +11 -0
  214. package/dist/direction-parts.d.ts +11 -0
  215. package/dist/direction-parts.js +9 -0
  216. package/dist/direction.cjs +15 -0
  217. package/dist/direction.d.cts +13 -0
  218. package/dist/direction.d.ts +13 -0
  219. package/dist/direction.js +14 -0
  220. package/dist/dnd.cjs +148 -0
  221. package/dist/dnd.d.cts +68 -0
  222. package/dist/dnd.d.ts +68 -0
  223. package/dist/dnd.js +143 -0
  224. package/dist/drawer-parts.cjs +17 -0
  225. package/dist/drawer-parts.d.cts +12 -0
  226. package/dist/drawer-parts.d.ts +12 -0
  227. package/dist/drawer-parts.js +14 -0
  228. package/dist/drawer.cjs +313 -0
  229. package/dist/drawer.d.cts +156 -0
  230. package/dist/drawer.d.ts +156 -0
  231. package/dist/drawer.js +302 -0
  232. package/dist/empty-state-parts.cjs +25 -0
  233. package/dist/empty-state-parts.d.cts +15 -0
  234. package/dist/empty-state-parts.d.ts +15 -0
  235. package/dist/empty-state-parts.js +19 -0
  236. package/dist/empty-state.cjs +35 -0
  237. package/dist/empty-state.d.cts +20 -0
  238. package/dist/empty-state.d.ts +20 -0
  239. package/dist/empty-state.js +34 -0
  240. package/dist/engine-C1L7buUc.cjs +55 -0
  241. package/dist/engine-DC0U0oW4.js +44 -0
  242. package/dist/error-state-parts.cjs +16 -0
  243. package/dist/error-state-parts.d.cts +12 -0
  244. package/dist/error-state-parts.d.ts +12 -0
  245. package/dist/error-state-parts.js +13 -0
  246. package/dist/error-state.cjs +40 -0
  247. package/dist/error-state.d.cts +23 -0
  248. package/dist/error-state.d.ts +23 -0
  249. package/dist/error-state.js +39 -0
  250. package/dist/field-6rggafk5.js +490 -0
  251. package/dist/field-DYx_FkJo.d.cts +117 -0
  252. package/dist/field-K5Ih8hd4.cjs +543 -0
  253. package/dist/field-a4QJ2c-m.d.ts +117 -0
  254. package/dist/field.cjs +11 -0
  255. package/dist/field.d.cts +2 -0
  256. package/dist/field.d.ts +2 -0
  257. package/dist/field.js +1 -0
  258. package/dist/file-input-parts.cjs +31 -0
  259. package/dist/file-input-parts.d.cts +13 -0
  260. package/dist/file-input-parts.d.ts +13 -0
  261. package/dist/file-input-parts.js +23 -0
  262. package/dist/file-input.cjs +305 -0
  263. package/dist/file-input.d.cts +121 -0
  264. package/dist/file-input.d.ts +121 -0
  265. package/dist/file-input.js +292 -0
  266. package/dist/gauge-helpers-B5LtX6LH.js +112 -0
  267. package/dist/gauge-helpers-CH1_d6Gu.cjs +165 -0
  268. package/dist/gesture.cjs +14 -0
  269. package/dist/gesture.d.cts +2 -0
  270. package/dist/gesture.d.ts +2 -0
  271. package/dist/gesture.js +1 -0
  272. package/dist/headless-B-TKPycd.d.ts +126 -0
  273. package/dist/headless-BlJkiUjO.cjs +716 -0
  274. package/dist/headless-CljY7Ctc.d.cts +126 -0
  275. package/dist/headless-CrvR466Z.js +645 -0
  276. package/dist/headless.cjs +7 -0
  277. package/dist/headless.d.cts +3 -0
  278. package/dist/headless.d.ts +3 -0
  279. package/dist/headless.js +3 -0
  280. package/dist/history.cjs +88 -0
  281. package/dist/history.d.cts +43 -0
  282. package/dist/history.d.ts +43 -0
  283. package/dist/history.js +85 -0
  284. package/dist/host-channels-2qF0Zogd.js +40 -0
  285. package/dist/host-channels-CGGNArN9.d.ts +34 -0
  286. package/dist/host-channels-D_BJumjy.d.cts +34 -0
  287. package/dist/host-channels-_jRfb-gI.cjs +57 -0
  288. package/dist/hover-card-BLDhTCGz.d.ts +93 -0
  289. package/dist/hover-card-D1bBICJL.d.cts +93 -0
  290. package/dist/hover-card.cjs +353 -0
  291. package/dist/hover-card.d.cts +2 -0
  292. package/dist/hover-card.d.ts +2 -0
  293. package/dist/hover-card.js +348 -0
  294. package/dist/icon-button.cjs +59 -0
  295. package/dist/icon-button.d.cts +40 -0
  296. package/dist/icon-button.d.ts +40 -0
  297. package/dist/icon-button.js +58 -0
  298. package/dist/image-cropper-parts.cjs +21 -0
  299. package/dist/image-cropper-parts.d.cts +15 -0
  300. package/dist/image-cropper-parts.d.ts +15 -0
  301. package/dist/image-cropper-parts.js +17 -0
  302. package/dist/image-cropper.cjs +126 -0
  303. package/dist/image-cropper.d.cts +78 -0
  304. package/dist/image-cropper.d.ts +78 -0
  305. package/dist/image-cropper.js +116 -0
  306. package/dist/image-parts.cjs +19 -0
  307. package/dist/image-parts.d.cts +13 -0
  308. package/dist/image-parts.d.ts +13 -0
  309. package/dist/image-parts.js +15 -0
  310. package/dist/image.cjs +120 -0
  311. package/dist/image.d.cts +56 -0
  312. package/dist/image.d.ts +56 -0
  313. package/dist/image.js +70 -0
  314. package/dist/index.cjs +2091 -0
  315. package/dist/index.d.cts +425 -0
  316. package/dist/index.d.ts +425 -0
  317. package/dist/index.js +745 -0
  318. package/dist/input-group-BGBOYB4n.d.cts +39 -0
  319. package/dist/input-group-BGOv7JzR.js +59 -0
  320. package/dist/input-group-CfU-Io-O.d.ts +39 -0
  321. package/dist/input-group-IrBJ7FhC.cjs +70 -0
  322. package/dist/input-group-parts.cjs +22 -0
  323. package/dist/input-group-parts.d.cts +10 -0
  324. package/dist/input-group-parts.d.ts +10 -0
  325. package/dist/input-group-parts.js +17 -0
  326. package/dist/input-group.cjs +3 -0
  327. package/dist/input-group.d.cts +2 -0
  328. package/dist/input-group.d.ts +2 -0
  329. package/dist/input-group.js +1 -0
  330. package/dist/input-parts.cjs +13 -0
  331. package/dist/input-parts.d.cts +7 -0
  332. package/dist/input-parts.d.ts +7 -0
  333. package/dist/input-parts.js +11 -0
  334. package/dist/input.cjs +122 -0
  335. package/dist/input.d.cts +61 -0
  336. package/dist/input.d.ts +61 -0
  337. package/dist/input.js +118 -0
  338. package/dist/intl-cache-BnmpE1aq.cjs +50 -0
  339. package/dist/intl-cache-CDLsfK96.js +33 -0
  340. package/dist/item-parts.cjs +48 -0
  341. package/dist/item-parts.d.cts +29 -0
  342. package/dist/item-parts.d.ts +29 -0
  343. package/dist/item-parts.js +38 -0
  344. package/dist/item.cjs +90 -0
  345. package/dist/item.d.cts +46 -0
  346. package/dist/item.d.ts +46 -0
  347. package/dist/item.js +88 -0
  348. package/dist/kbd-parts.cjs +13 -0
  349. package/dist/kbd-parts.d.cts +7 -0
  350. package/dist/kbd-parts.d.ts +7 -0
  351. package/dist/kbd-parts.js +11 -0
  352. package/dist/kbd.cjs +53 -0
  353. package/dist/kbd.d.cts +21 -0
  354. package/dist/kbd.d.ts +21 -0
  355. package/dist/kbd.js +52 -0
  356. package/dist/label.cjs +51 -0
  357. package/dist/label.d.cts +20 -0
  358. package/dist/label.d.ts +20 -0
  359. package/dist/label.js +50 -0
  360. package/dist/list-field-BOenMv1V.d.cts +33 -0
  361. package/dist/list-field-CAglN-Lq.d.ts +33 -0
  362. package/dist/list-field-Du4-URtf.cjs +1347 -0
  363. package/dist/list-field-j21SJ5eb.js +1216 -0
  364. package/dist/listbox-parts.cjs +18 -0
  365. package/dist/listbox-parts.d.cts +12 -0
  366. package/dist/listbox-parts.d.ts +12 -0
  367. package/dist/listbox-parts.js +15 -0
  368. package/dist/listbox.cjs +288 -0
  369. package/dist/listbox.d.cts +102 -0
  370. package/dist/listbox.d.ts +102 -0
  371. package/dist/listbox.js +280 -0
  372. package/dist/loader-parts.cjs +16 -0
  373. package/dist/loader-parts.d.cts +8 -0
  374. package/dist/loader-parts.d.ts +8 -0
  375. package/dist/loader-parts.js +13 -0
  376. package/dist/loader.cjs +31 -0
  377. package/dist/loader.d.cts +31 -0
  378. package/dist/loader.d.ts +31 -0
  379. package/dist/loader.js +30 -0
  380. package/dist/mark-presence-BBxPeAWU.js +40 -0
  381. package/dist/mark-presence-CA2qIL-U.cjs +45 -0
  382. package/dist/mention-menu-parts.cjs +46 -0
  383. package/dist/mention-menu-parts.d.cts +18 -0
  384. package/dist/mention-menu-parts.d.ts +18 -0
  385. package/dist/mention-menu-parts.js +33 -0
  386. package/dist/mention-menu.cjs +98 -0
  387. package/dist/mention-menu.d.cts +67 -0
  388. package/dist/mention-menu.d.ts +67 -0
  389. package/dist/mention-menu.js +96 -0
  390. package/dist/menu-parts.cjs +28 -0
  391. package/dist/menu-parts.d.cts +11 -0
  392. package/dist/menu-parts.d.ts +11 -0
  393. package/dist/menu-parts.js +22 -0
  394. package/dist/menu-surface-65w5dvFt.js +198 -0
  395. package/dist/menu-surface-CdCMDe9e.cjs +215 -0
  396. package/dist/menu.cjs +796 -0
  397. package/dist/menu.d.cts +249 -0
  398. package/dist/menu.d.ts +249 -0
  399. package/dist/menu.js +778 -0
  400. package/dist/menubar-DbOuiq7c.d.ts +45 -0
  401. package/dist/menubar-bar-DEAk5SJ_.js +419 -0
  402. package/dist/menubar-bar-Jl_AAP52.cjs +436 -0
  403. package/dist/menubar-parts.cjs +16 -0
  404. package/dist/menubar-parts.d.cts +8 -0
  405. package/dist/menubar-parts.d.ts +8 -0
  406. package/dist/menubar-parts.js +13 -0
  407. package/dist/menubar-wL-MNWma.d.cts +45 -0
  408. package/dist/menubar.cjs +86 -0
  409. package/dist/menubar.d.cts +2 -0
  410. package/dist/menubar.d.ts +2 -0
  411. package/dist/menubar.js +84 -0
  412. package/dist/meter-parts.cjs +19 -0
  413. package/dist/meter-parts.d.cts +9 -0
  414. package/dist/meter-parts.d.ts +9 -0
  415. package/dist/meter-parts.js +15 -0
  416. package/dist/meter.cjs +91 -0
  417. package/dist/meter.d.cts +61 -0
  418. package/dist/meter.d.ts +61 -0
  419. package/dist/meter.js +86 -0
  420. package/dist/native-select-parts.cjs +13 -0
  421. package/dist/native-select-parts.d.cts +7 -0
  422. package/dist/native-select-parts.d.ts +7 -0
  423. package/dist/native-select-parts.js +11 -0
  424. package/dist/native-select.cjs +53 -0
  425. package/dist/native-select.d.cts +43 -0
  426. package/dist/native-select.d.ts +43 -0
  427. package/dist/native-select.js +52 -0
  428. package/dist/navigation-menu-parts.cjs +19 -0
  429. package/dist/navigation-menu-parts.d.cts +9 -0
  430. package/dist/navigation-menu-parts.d.ts +9 -0
  431. package/dist/navigation-menu-parts.js +15 -0
  432. package/dist/navigation-menu.cjs +632 -0
  433. package/dist/navigation-menu.d.cts +129 -0
  434. package/dist/navigation-menu.d.ts +129 -0
  435. package/dist/navigation-menu.js +622 -0
  436. package/dist/number-input-parts.cjs +25 -0
  437. package/dist/number-input-parts.d.cts +11 -0
  438. package/dist/number-input-parts.d.ts +11 -0
  439. package/dist/number-input-parts.js +19 -0
  440. package/dist/number-input.cjs +210 -0
  441. package/dist/number-input.d.cts +96 -0
  442. package/dist/number-input.d.ts +96 -0
  443. package/dist/number-input.js +202 -0
  444. package/dist/number.cjs +44 -0
  445. package/dist/number.d.cts +2 -0
  446. package/dist/number.d.ts +2 -0
  447. package/dist/number.js +1 -0
  448. package/dist/observe.cjs +30 -0
  449. package/dist/observe.d.cts +5 -0
  450. package/dist/observe.d.ts +5 -0
  451. package/dist/observe.js +11 -0
  452. package/dist/option-rows-CC2bEewo.cjs +50 -0
  453. package/dist/option-rows-XSPajLnJ.js +45 -0
  454. package/dist/otp-input-parts.cjs +19 -0
  455. package/dist/otp-input-parts.d.cts +9 -0
  456. package/dist/otp-input-parts.d.ts +9 -0
  457. package/dist/otp-input-parts.js +15 -0
  458. package/dist/otp-input.cjs +117 -0
  459. package/dist/otp-input.d.cts +99 -0
  460. package/dist/otp-input.d.ts +99 -0
  461. package/dist/otp-input.js +111 -0
  462. package/dist/overlays-BA9yrPGi.d.cts +162 -0
  463. package/dist/overlays-BjCNK-1Y.d.ts +162 -0
  464. package/dist/overlays.cjs +46 -0
  465. package/dist/overlays.d.cts +5 -0
  466. package/dist/overlays.d.ts +5 -0
  467. package/dist/overlays.js +5 -0
  468. package/dist/pagination-parts.cjs +22 -0
  469. package/dist/pagination-parts.d.cts +10 -0
  470. package/dist/pagination-parts.d.ts +10 -0
  471. package/dist/pagination-parts.js +17 -0
  472. package/dist/pagination.cjs +318 -0
  473. package/dist/pagination.d.cts +92 -0
  474. package/dist/pagination.d.ts +92 -0
  475. package/dist/pagination.js +302 -0
  476. package/dist/password-input-parts.cjs +16 -0
  477. package/dist/password-input-parts.d.cts +8 -0
  478. package/dist/password-input-parts.d.ts +8 -0
  479. package/dist/password-input-parts.js +13 -0
  480. package/dist/password-input.cjs +233 -0
  481. package/dist/password-input.d.cts +89 -0
  482. package/dist/password-input.d.ts +89 -0
  483. package/dist/password-input.js +229 -0
  484. package/dist/popover-B3GoPvi2.d.cts +124 -0
  485. package/dist/popover-BZl6Dt-0.d.ts +124 -0
  486. package/dist/popover-Ck8WMrE1.cjs +558 -0
  487. package/dist/popover-CypGE1n4.js +505 -0
  488. package/dist/popover.cjs +11 -0
  489. package/dist/popover.d.cts +2 -0
  490. package/dist/popover.d.ts +2 -0
  491. package/dist/popover.js +1 -0
  492. package/dist/preferences.cjs +132 -0
  493. package/dist/preferences.d.cts +33 -0
  494. package/dist/preferences.d.ts +33 -0
  495. package/dist/preferences.js +78 -0
  496. package/dist/presence.cjs +60 -0
  497. package/dist/presence.d.cts +27 -0
  498. package/dist/presence.d.ts +27 -0
  499. package/dist/presence.js +58 -0
  500. package/dist/primitive-6ogzHDuC.cjs +155 -0
  501. package/dist/primitive-BZcvjGFR.js +126 -0
  502. package/dist/primitive-Cqz6wKSr.d.cts +97 -0
  503. package/dist/primitive-Cqz6wKSr.d.ts +97 -0
  504. package/dist/primitive-entry.cjs +10 -0
  505. package/dist/primitive-entry.d.cts +3 -0
  506. package/dist/primitive-entry.d.ts +3 -0
  507. package/dist/primitive-entry.js +3 -0
  508. package/dist/progress-DBt5j1bZ.d.cts +60 -0
  509. package/dist/progress-DDMC5ANu.d.ts +60 -0
  510. package/dist/progress-parts.cjs +22 -0
  511. package/dist/progress-parts.d.cts +10 -0
  512. package/dist/progress-parts.d.ts +10 -0
  513. package/dist/progress-parts.js +17 -0
  514. package/dist/progress.cjs +118 -0
  515. package/dist/progress.d.cts +2 -0
  516. package/dist/progress.d.ts +2 -0
  517. package/dist/progress.js +113 -0
  518. package/dist/query.cjs +251 -0
  519. package/dist/query.d.cts +69 -0
  520. package/dist/query.d.ts +69 -0
  521. package/dist/query.js +230 -0
  522. package/dist/radio-parts.cjs +25 -0
  523. package/dist/radio-parts.d.cts +11 -0
  524. package/dist/radio-parts.d.ts +11 -0
  525. package/dist/radio-parts.js +19 -0
  526. package/dist/radio.cjs +273 -0
  527. package/dist/radio.d.cts +67 -0
  528. package/dist/radio.d.ts +67 -0
  529. package/dist/radio.js +269 -0
  530. package/dist/rating-parts.cjs +19 -0
  531. package/dist/rating-parts.d.cts +9 -0
  532. package/dist/rating-parts.d.ts +9 -0
  533. package/dist/rating-parts.js +15 -0
  534. package/dist/rating.cjs +99 -0
  535. package/dist/rating.d.cts +87 -0
  536. package/dist/rating.d.ts +87 -0
  537. package/dist/rating.js +96 -0
  538. package/dist/resizable-parts.cjs +20 -0
  539. package/dist/resizable-parts.d.cts +15 -0
  540. package/dist/resizable-parts.d.ts +15 -0
  541. package/dist/resizable-parts.js +16 -0
  542. package/dist/resizable.cjs +386 -0
  543. package/dist/resizable.d.cts +105 -0
  544. package/dist/resizable.d.ts +105 -0
  545. package/dist/resizable.js +376 -0
  546. package/dist/scroll-area-parts.cjs +20 -0
  547. package/dist/scroll-area-parts.d.cts +15 -0
  548. package/dist/scroll-area-parts.d.ts +15 -0
  549. package/dist/scroll-area-parts.js +17 -0
  550. package/dist/scroll-area.cjs +121 -0
  551. package/dist/scroll-area.d.cts +81 -0
  552. package/dist/scroll-area.d.ts +81 -0
  553. package/dist/scroll-area.js +113 -0
  554. package/dist/segmented-control-parts.cjs +18 -0
  555. package/dist/segmented-control-parts.d.cts +8 -0
  556. package/dist/segmented-control-parts.d.ts +8 -0
  557. package/dist/segmented-control-parts.js +14 -0
  558. package/dist/segmented-control.cjs +166 -0
  559. package/dist/segmented-control.d.cts +58 -0
  560. package/dist/segmented-control.d.ts +58 -0
  561. package/dist/segmented-control.js +162 -0
  562. package/dist/segmented-input-BEvH60gW.js +871 -0
  563. package/dist/segmented-input-B_LrxViw.d.cts +25 -0
  564. package/dist/segmented-input-B_LrxViw.d.ts +25 -0
  565. package/dist/segmented-input-CLyC59Tw.cjs +882 -0
  566. package/dist/select-parts.cjs +59 -0
  567. package/dist/select-parts.d.cts +20 -0
  568. package/dist/select-parts.d.ts +20 -0
  569. package/dist/select-parts.js +45 -0
  570. package/dist/select.cjs +878 -0
  571. package/dist/select.d.cts +210 -0
  572. package/dist/select.d.ts +210 -0
  573. package/dist/select.js +858 -0
  574. package/dist/separator-parts.cjs +13 -0
  575. package/dist/separator-parts.d.cts +7 -0
  576. package/dist/separator-parts.d.ts +7 -0
  577. package/dist/separator-parts.js +11 -0
  578. package/dist/separator.cjs +15 -0
  579. package/dist/separator.d.cts +16 -0
  580. package/dist/separator.d.ts +16 -0
  581. package/dist/separator.js +14 -0
  582. package/dist/sheet-parts.cjs +20 -0
  583. package/dist/sheet-parts.d.cts +13 -0
  584. package/dist/sheet-parts.d.ts +13 -0
  585. package/dist/sheet-parts.js +16 -0
  586. package/dist/sheet.cjs +51 -0
  587. package/dist/sheet.d.cts +72 -0
  588. package/dist/sheet.d.ts +72 -0
  589. package/dist/sheet.js +50 -0
  590. package/dist/shortcuts.cjs +96 -0
  591. package/dist/shortcuts.d.cts +21 -0
  592. package/dist/shortcuts.d.ts +21 -0
  593. package/dist/shortcuts.js +75 -0
  594. package/dist/sidebar-parts.cjs +20 -0
  595. package/dist/sidebar-parts.d.cts +15 -0
  596. package/dist/sidebar-parts.d.ts +15 -0
  597. package/dist/sidebar-parts.js +17 -0
  598. package/dist/sidebar.cjs +47 -0
  599. package/dist/sidebar.d.cts +38 -0
  600. package/dist/sidebar.d.ts +38 -0
  601. package/dist/sidebar.js +45 -0
  602. package/dist/skeleton-parts.cjs +16 -0
  603. package/dist/skeleton-parts.d.cts +8 -0
  604. package/dist/skeleton-parts.d.ts +8 -0
  605. package/dist/skeleton-parts.js +13 -0
  606. package/dist/skeleton.cjs +33 -0
  607. package/dist/skeleton.d.cts +20 -0
  608. package/dist/skeleton.d.ts +20 -0
  609. package/dist/skeleton.js +32 -0
  610. package/dist/slider.cjs +153 -0
  611. package/dist/slider.d.cts +89 -0
  612. package/dist/slider.d.ts +89 -0
  613. package/dist/slider.js +145 -0
  614. package/dist/slot-content-B2QEzvsJ.js +28 -0
  615. package/dist/slot-content-TPoO9_3v.cjs +39 -0
  616. package/dist/sortable-8vB7oWM-.js +141 -0
  617. package/dist/sortable-BItLUSjX.cjs +188 -0
  618. package/dist/sortable-CzHsBo4d.d.cts +126 -0
  619. package/dist/sortable-DsQVJ7Nj.d.ts +126 -0
  620. package/dist/sortable-parts.cjs +4 -0
  621. package/dist/sortable-parts.d.cts +2 -0
  622. package/dist/sortable-parts.d.ts +2 -0
  623. package/dist/sortable-parts.js +1 -0
  624. package/dist/sortable-root-BO3Jsvjq.js +84 -0
  625. package/dist/sortable-root-CR-Mj60O.d.cts +40 -0
  626. package/dist/sortable-root-CrnWoHtt.d.ts +40 -0
  627. package/dist/sortable-root-Dr_yMiUu.cjs +119 -0
  628. package/dist/sortable.cjs +17 -0
  629. package/dist/sortable.d.cts +3 -0
  630. package/dist/sortable.d.ts +3 -0
  631. package/dist/sortable.js +3 -0
  632. package/dist/spinner-parts.cjs +18 -0
  633. package/dist/spinner-parts.d.cts +12 -0
  634. package/dist/spinner-parts.d.ts +12 -0
  635. package/dist/spinner-parts.js +16 -0
  636. package/dist/spinner.cjs +31 -0
  637. package/dist/spinner.d.cts +24 -0
  638. package/dist/spinner.d.ts +24 -0
  639. package/dist/spinner.js +30 -0
  640. package/dist/steps-parts.cjs +37 -0
  641. package/dist/steps-parts.d.cts +26 -0
  642. package/dist/steps-parts.d.ts +26 -0
  643. package/dist/steps-parts.js +31 -0
  644. package/dist/steps.cjs +58 -0
  645. package/dist/steps.d.cts +27 -0
  646. package/dist/steps.d.ts +27 -0
  647. package/dist/steps.js +57 -0
  648. package/dist/switch-DOfO8P-X.js +111 -0
  649. package/dist/switch-DWgAvCo-.cjs +128 -0
  650. package/dist/switch-parts.cjs +13 -0
  651. package/dist/switch-parts.d.cts +7 -0
  652. package/dist/switch-parts.d.ts +7 -0
  653. package/dist/switch-parts.js +11 -0
  654. package/dist/switch.cjs +6 -0
  655. package/dist/switch.d.cts +67 -0
  656. package/dist/switch.d.ts +67 -0
  657. package/dist/switch.js +2 -0
  658. package/dist/table-parts.cjs +22 -0
  659. package/dist/table-parts.d.cts +13 -0
  660. package/dist/table-parts.d.ts +13 -0
  661. package/dist/table-parts.js +18 -0
  662. package/dist/table.cjs +149 -0
  663. package/dist/table.d.cts +53 -0
  664. package/dist/table.d.ts +53 -0
  665. package/dist/table.js +148 -0
  666. package/dist/tabs.cjs +307 -0
  667. package/dist/tabs.d.cts +121 -0
  668. package/dist/tabs.d.ts +121 -0
  669. package/dist/tabs.js +300 -0
  670. package/dist/text-match.cjs +44 -0
  671. package/dist/text-match.d.cts +2 -0
  672. package/dist/text-match.d.ts +2 -0
  673. package/dist/text-match.js +1 -0
  674. package/dist/textarea-parts.cjs +13 -0
  675. package/dist/textarea-parts.d.cts +7 -0
  676. package/dist/textarea-parts.d.ts +7 -0
  677. package/dist/textarea-parts.js +11 -0
  678. package/dist/textarea.cjs +101 -0
  679. package/dist/textarea.d.cts +61 -0
  680. package/dist/textarea.d.ts +61 -0
  681. package/dist/textarea.js +98 -0
  682. package/dist/time-input-parts.cjs +19 -0
  683. package/dist/time-input-parts.d.cts +9 -0
  684. package/dist/time-input-parts.d.ts +9 -0
  685. package/dist/time-input-parts.js +15 -0
  686. package/dist/time-input.cjs +123 -0
  687. package/dist/time-input.d.cts +58 -0
  688. package/dist/time-input.d.ts +58 -0
  689. package/dist/time-input.js +122 -0
  690. package/dist/timeline-parts.cjs +44 -0
  691. package/dist/timeline-parts.d.cts +27 -0
  692. package/dist/timeline-parts.d.ts +27 -0
  693. package/dist/timeline-parts.js +35 -0
  694. package/dist/timeline.cjs +286 -0
  695. package/dist/timeline.d.cts +44 -0
  696. package/dist/timeline.d.ts +44 -0
  697. package/dist/timeline.js +277 -0
  698. package/dist/toast-parts.cjs +64 -0
  699. package/dist/toast-parts.d.cts +37 -0
  700. package/dist/toast-parts.d.ts +37 -0
  701. package/dist/toast-parts.js +52 -0
  702. package/dist/toast.cjs +288 -0
  703. package/dist/toast.d.cts +2 -0
  704. package/dist/toast.d.ts +2 -0
  705. package/dist/toast.js +280 -0
  706. package/dist/toggle-group-parts.cjs +18 -0
  707. package/dist/toggle-group-parts.d.cts +8 -0
  708. package/dist/toggle-group-parts.d.ts +8 -0
  709. package/dist/toggle-group-parts.js +14 -0
  710. package/dist/toggle-group.cjs +91 -0
  711. package/dist/toggle-group.d.cts +42 -0
  712. package/dist/toggle-group.d.ts +42 -0
  713. package/dist/toggle-group.js +90 -0
  714. package/dist/toggle-parts.cjs +52 -0
  715. package/dist/toggle-parts.d.cts +23 -0
  716. package/dist/toggle-parts.d.ts +23 -0
  717. package/dist/toggle-parts.js +49 -0
  718. package/dist/toggle.cjs +140 -0
  719. package/dist/toggle.d.cts +56 -0
  720. package/dist/toggle.d.ts +56 -0
  721. package/dist/toggle.js +137 -0
  722. package/dist/token-input-parts.cjs +30 -0
  723. package/dist/token-input-parts.d.cts +12 -0
  724. package/dist/token-input-parts.d.ts +12 -0
  725. package/dist/token-input-parts.js +22 -0
  726. package/dist/token-input.cjs +292 -0
  727. package/dist/token-input.d.cts +100 -0
  728. package/dist/token-input.d.ts +100 -0
  729. package/dist/token-input.js +284 -0
  730. package/dist/toolbar-BIAPDqB1.d.cts +125 -0
  731. package/dist/toolbar-DmD0BTK8.d.ts +125 -0
  732. package/dist/toolbar-context-AdI8_pQK.js +23 -0
  733. package/dist/toolbar-context-B2oM2qUt.cjs +46 -0
  734. package/dist/toolbar-parts.cjs +25 -0
  735. package/dist/toolbar-parts.d.cts +11 -0
  736. package/dist/toolbar-parts.d.ts +11 -0
  737. package/dist/toolbar-parts.js +19 -0
  738. package/dist/toolbar.cjs +398 -0
  739. package/dist/toolbar.d.cts +2 -0
  740. package/dist/toolbar.d.ts +2 -0
  741. package/dist/toolbar.js +391 -0
  742. package/dist/tooltip-BBd4ttIN.d.ts +95 -0
  743. package/dist/tooltip-BfeH1U_K.d.cts +95 -0
  744. package/dist/tooltip-C0lNNlBr.js +594 -0
  745. package/dist/tooltip-RaXnPVvX.cjs +629 -0
  746. package/dist/tooltip.cjs +8 -0
  747. package/dist/tooltip.d.cts +2 -0
  748. package/dist/tooltip.d.ts +2 -0
  749. package/dist/tooltip.js +1 -0
  750. package/dist/tree-grid-parts.cjs +22 -0
  751. package/dist/tree-grid-parts.d.cts +13 -0
  752. package/dist/tree-grid-parts.d.ts +13 -0
  753. package/dist/tree-grid-parts.js +18 -0
  754. package/dist/tree-grid.cjs +102 -0
  755. package/dist/tree-grid.d.cts +52 -0
  756. package/dist/tree-grid.d.ts +52 -0
  757. package/dist/tree-grid.js +101 -0
  758. package/dist/tree-parts.cjs +19 -0
  759. package/dist/tree-parts.d.cts +11 -0
  760. package/dist/tree-parts.d.ts +11 -0
  761. package/dist/tree-parts.js +16 -0
  762. package/dist/tree.cjs +1199 -0
  763. package/dist/tree.d.cts +146 -0
  764. package/dist/tree.d.ts +146 -0
  765. package/dist/tree.js +1190 -0
  766. package/dist/trigger-menu-BAptgs-8.d.cts +152 -0
  767. package/dist/trigger-menu-Bik8DeBO.cjs +1473 -0
  768. package/dist/trigger-menu-e_WojzA8.js +1390 -0
  769. package/dist/trigger-menu-g9hS4Cvv.d.ts +152 -0
  770. package/dist/trigger-menu.cjs +16 -0
  771. package/dist/trigger-menu.d.cts +2 -0
  772. package/dist/trigger-menu.d.ts +2 -0
  773. package/dist/trigger-menu.js +1 -0
  774. package/dist/virtual-list-parts.cjs +36 -0
  775. package/dist/virtual-list-parts.d.cts +18 -0
  776. package/dist/virtual-list-parts.d.ts +18 -0
  777. package/dist/virtual-list-parts.js +33 -0
  778. package/dist/virtual-list.cjs +68 -0
  779. package/dist/virtual-list.d.cts +49 -0
  780. package/dist/virtual-list.d.ts +49 -0
  781. package/dist/virtual-list.js +66 -0
  782. package/dist/virtual.cjs +32 -0
  783. package/dist/virtual.d.cts +9 -0
  784. package/dist/virtual.d.ts +9 -0
  785. package/dist/virtual.js +31 -0
  786. package/dist/waterfall-chart-parts.cjs +65 -0
  787. package/dist/waterfall-chart-parts.d.cts +36 -0
  788. package/dist/waterfall-chart-parts.d.ts +36 -0
  789. package/dist/waterfall-chart-parts.js +51 -0
  790. package/dist/waterfall-chart.cjs +80 -0
  791. package/dist/waterfall-chart.d.cts +44 -0
  792. package/dist/waterfall-chart.d.ts +44 -0
  793. package/dist/waterfall-chart.js +78 -0
  794. package/dist/waterfall-parts.cjs +25 -0
  795. package/dist/waterfall-parts.d.cts +16 -0
  796. package/dist/waterfall-parts.d.ts +16 -0
  797. package/dist/waterfall-parts.js +21 -0
  798. package/dist/waterfall.cjs +582 -0
  799. package/dist/waterfall.d.cts +113 -0
  800. package/dist/waterfall.d.ts +113 -0
  801. package/dist/waterfall.js +569 -0
  802. package/package.json +923 -3
  803. package/README.md +0 -3
package/dist/tree.js ADDED
@@ -0,0 +1,1190 @@
1
+ import { n as useControllerAttach, t as createController } from "./controller-DEAYKbYU.js";
2
+ import { n as usePart, r as usePrimitive } from "./headless-CrvR466Z.js";
3
+ import { a as useIsomorphicLayoutEffect, n as mergeRefs, r as renderElement } from "./primitive-BZcvjGFR.js";
4
+ import { b as nodeText } from "./compound-helpers-C0Sx_vxV.js";
5
+ import { n as useCollection, r as useCollectionItem } from "./compound-registry-BDVOjXHa.js";
6
+ import { Fragment, createContext, createElement, isValidElement, useCallback, useContext, useEffect, useId, useMemo, useRef, useState } from "react";
7
+ import { createDetails, foldSearchText, treeChecked, treeCollection, treeToggleChecked } from "@bevelo/core";
8
+ import { announce } from "@bevelo/dom";
9
+ import { initialTreeExpanded, treePrimitive } from "@bevelo/core/primitives/tree";
10
+ // src/tree.tsx
11
+ /**
12
+ * @stable
13
+ */
14
+ /** Builds a hierarchical tree of `TreeItemData` from file/folder path strings. */
15
+ function treeFromPaths(paths) {
16
+ const roots = [];
17
+ const rootMap = /* @__PURE__ */ new Map();
18
+ for (const raw of paths) {
19
+ const clean = raw.replace(/\/+$/, "");
20
+ if (!clean) continue;
21
+ const parts = clean.split("/");
22
+ let curMap = rootMap;
23
+ let curList = roots;
24
+ let acc = "";
25
+ for (let i = 0; i < parts.length; i += 1) {
26
+ const seg = parts[i] ?? "";
27
+ acc = acc ? `${acc}/${seg}` : seg;
28
+ let node = curMap.get(seg);
29
+ if (!node) {
30
+ node = {
31
+ value: acc,
32
+ label: seg,
33
+ children: [],
34
+ map: /* @__PURE__ */ new Map()
35
+ };
36
+ curMap.set(seg, node);
37
+ curList.push(node);
38
+ }
39
+ curMap = node.map;
40
+ curList = node.children;
41
+ }
42
+ }
43
+ const finalize = (d) => ({
44
+ id: d.value,
45
+ value: d.value,
46
+ label: d.label,
47
+ ...d.children.length > 0 ? { children: d.children.map(finalize) } : {}
48
+ });
49
+ return roots.map(finalize);
50
+ }
51
+ /** Flattens visible tree nodes according to the expanded id list/set. */
52
+ function visibleTreeRows(items, expanded = []) {
53
+ const exp = expanded instanceof Set ? expanded : new Set(expanded);
54
+ const out = [];
55
+ const walk = (list) => {
56
+ for (const item of list) {
57
+ out.push(item);
58
+ const id = item.id ?? item.value ?? "";
59
+ if (item.children && item.children.length > 0 && exp.has(id)) walk(item.children);
60
+ }
61
+ };
62
+ walk(items);
63
+ return out;
64
+ }
65
+ /** Creates an imperative controller for a `Tree`. */
66
+ function createTreeController() {
67
+ return createController();
68
+ }
69
+ const INDICATOR = "▸";
70
+ const EMPTY_ITEMS = [];
71
+ const EMPTY_IDS = [];
72
+ const NO_WALK = {
73
+ tree: [],
74
+ entries: []
75
+ };
76
+ const COUNT_EVERY_LEAF = () => true;
77
+ function hasTreeGroupChild(node) {
78
+ if (Array.isArray(node)) return node.some((c) => hasTreeGroupChild(c));
79
+ if (!isValidElement(node)) return false;
80
+ if (node.type === TreeGroup) return true;
81
+ if (node.type === Fragment) return hasTreeGroupChild(node.props.children);
82
+ return false;
83
+ }
84
+ /** The host's item shape, as the primitive takes it. */
85
+ function toCoreItems(list) {
86
+ return list.map((it) => ({
87
+ ...it,
88
+ id: it.id ?? it.value ?? it.label,
89
+ label: it.label,
90
+ ...it.disabled ? { disabled: true } : {},
91
+ ...it.expanded !== void 0 ? { expanded: it.expanded } : {},
92
+ ...it.children ? { children: toCoreItems(it.children) } : {}
93
+ }));
94
+ }
95
+ /** The data path's items, or undefined when the tree is composed from parts. */
96
+ function dataSource(items, paths) {
97
+ if (items !== void 0) return items;
98
+ return paths === void 0 ? void 0 : treeFromPaths(paths);
99
+ }
100
+ /** A row's label: its TreeItemLabel's text, else all of its text. */
101
+ function treeLabel(children) {
102
+ const labelEl = Array.isArray(children) ? children.find((c) => isValidElement(c) && c.type === TreeItemLabel) : isValidElement(children) && children.type === TreeItemLabel ? children : void 0;
103
+ return isValidElement(labelEl) ? nodeText(labelEl.props.children) : nodeText(children);
104
+ }
105
+ function treeEntry(id, props, parent) {
106
+ const branch = typeof props.branch === "boolean" ? props.branch : hasTreeGroupChild(props.children);
107
+ return {
108
+ value: id,
109
+ label: treeLabel(props.children) || id,
110
+ ...parent === void 0 ? {} : { parent },
111
+ ...branch ? { branch: true } : {},
112
+ ...props.disabled === true ? { disabled: true } : {}
113
+ };
114
+ }
115
+ /** The rows a tree's own children name, nested, with each row's entry in document order. */
116
+ function extractTreeItems(node) {
117
+ const entries = [];
118
+ const walkLevel = (n, parent, out) => {
119
+ if (Array.isArray(n)) {
120
+ for (const c of n) walkLevel(c, parent, out);
121
+ return;
122
+ }
123
+ if (!isValidElement(n)) return;
124
+ const el = n;
125
+ if (el.type === Fragment) {
126
+ walkLevel(el.props["children"], parent, out);
127
+ return;
128
+ }
129
+ if (el.type === TreeItem) {
130
+ const id = typeof el.props["id"] === "string" ? el.props["id"] : typeof el.props["value"] === "string" ? el.props["value"] : `node-${entries.length}`;
131
+ const entry = treeEntry(id, el.props, parent);
132
+ entries.push(entry);
133
+ const groupEl = Array.isArray(el.props["children"]) ? el.props["children"].find((c) => isValidElement(c) && c.type === TreeGroup) : void 0;
134
+ const nested = [];
135
+ if (isValidElement(groupEl)) walkLevel(groupEl.props.children, id, nested);
136
+ out.push({
137
+ id,
138
+ label: entry.label,
139
+ ...entry.disabled ? { disabled: true } : {},
140
+ ...nested.length > 0 ? { children: nested } : {}
141
+ });
142
+ }
143
+ };
144
+ const tree = [];
145
+ walkLevel(node, void 0, tree);
146
+ return {
147
+ tree,
148
+ entries
149
+ };
150
+ }
151
+ /** The walked rows that are mounted: a row under a collapsed branch is not. */
152
+ function visibleEntries(entries, expanded) {
153
+ const shown = /* @__PURE__ */ new Set();
154
+ const out = [];
155
+ for (const entry of entries) {
156
+ if (entry.parent !== void 0 && !(shown.has(entry.parent) && expanded.has(entry.parent))) continue;
157
+ shown.add(entry.value);
158
+ out.push(entry);
159
+ }
160
+ return out;
161
+ }
162
+ /** The rows of `items` data, in document order, as composed rows would register them. */
163
+ function dataEntries(list, parent, out = []) {
164
+ for (const item of list) {
165
+ const value = item.value ?? item.id ?? item.label;
166
+ out.push({
167
+ value,
168
+ label: item.label,
169
+ ...parent === void 0 ? {} : { parent },
170
+ ...item.children === void 0 ? {} : { branch: true },
171
+ ...item.disabled ? { disabled: true } : {}
172
+ });
173
+ if (item.children) dataEntries(item.children, value, out);
174
+ }
175
+ return out;
176
+ }
177
+ /**
178
+ * The shape from the registered rows, with the walk's rows grafted under a
179
+ * branch none of whose rows registered (a collapsed branch).
180
+ */
181
+ function shapeOf(registered, walked) {
182
+ const entry = /* @__PURE__ */ new Map();
183
+ const children = /* @__PURE__ */ new Map();
184
+ const add = (row) => {
185
+ if (entry.has(row.value)) return;
186
+ entry.set(row.value, row);
187
+ const key = row.parent ?? null;
188
+ const siblings = children.get(key);
189
+ if (siblings) siblings.push(row.value);
190
+ else children.set(key, [row.value]);
191
+ };
192
+ for (const row of registered) add(row);
193
+ const registeredParents = new Set(registered.map((row) => row.parent ?? null));
194
+ for (const row of walked) if (!registeredParents.has(row.parent ?? null)) add(row);
195
+ const order = [];
196
+ const parent = /* @__PURE__ */ new Map();
197
+ const visit = (key) => (children.get(key) ?? []).map((id) => {
198
+ order.push(id);
199
+ parent.set(id, key);
200
+ const row = entry.get(id);
201
+ const below = visit(id);
202
+ return {
203
+ id,
204
+ ...row.disabled ? { disabled: true } : {},
205
+ ...below.length > 0 || row.branch ? { children: below } : {}
206
+ };
207
+ });
208
+ return {
209
+ order,
210
+ entry,
211
+ parent,
212
+ children,
213
+ nodes: visit(null)
214
+ };
215
+ }
216
+ function ancestorsIn(shape, id) {
217
+ const out = [];
218
+ const seen = /* @__PURE__ */ new Set([id]);
219
+ for (let up = shape.parent.get(id) ?? null; up !== null && !seen.has(up); up = shape.parent.get(up) ?? null) {
220
+ seen.add(up);
221
+ out.unshift(up);
222
+ }
223
+ return out;
224
+ }
225
+ function descendantsIn(shape, id, out = []) {
226
+ for (const child of shape.children.get(id) ?? []) {
227
+ out.push(child);
228
+ descendantsIn(shape, child, out);
229
+ }
230
+ return out;
231
+ }
232
+ function isBranchIn(shape, id) {
233
+ return shape.entry.get(id)?.branch === true || (shape.children.get(id)?.length ?? 0) > 0;
234
+ }
235
+ function toKeys(value) {
236
+ if (value === null || value === void 0) return [];
237
+ return typeof value === "string" ? [value] : value;
238
+ }
239
+ function sameKeys(a, b) {
240
+ return a.length === b.length && a.every((key, index) => key === b[index]);
241
+ }
242
+ function sameSet(a, b) {
243
+ return a.length === b.length && a.every((key) => b.includes(key));
244
+ }
245
+ function isApple() {
246
+ return typeof navigator !== "undefined" && /Mac|iPhone|iPad|iPod/.test(navigator.platform || navigator.userAgent);
247
+ }
248
+ function idPart(value) {
249
+ return value.replace(/[^\w-]/g, (char) => `_${char.charCodeAt(0).toString(16)}`);
250
+ }
251
+ /**
252
+ * Typeahead as the WAI-ARIA practices describe it for trees: typed characters
253
+ * build a query that clears after half a second, and the next row whose label
254
+ * starts with it takes focus. The same character again steps through the rows
255
+ * that start with it.
256
+ */
257
+ function createTypeahead(timeout = 500) {
258
+ let query = "";
259
+ let lastKey = "";
260
+ let stepping = false;
261
+ let timer;
262
+ const reset = () => {
263
+ query = "";
264
+ lastKey = "";
265
+ stepping = false;
266
+ clearTimeout(timer);
267
+ };
268
+ const scan = (labels, prefix, start) => {
269
+ for (let step = 0; step < labels.length; step += 1) {
270
+ const index = ((start + step) % labels.length + labels.length) % labels.length;
271
+ if (foldSearchText(labels[index] ?? "").startsWith(prefix)) return index;
272
+ }
273
+ return -1;
274
+ };
275
+ const search = (key, labels, current) => {
276
+ if ([...key].length !== 1 || key === " " && query === "") return -1;
277
+ clearTimeout(timer);
278
+ timer = setTimeout(reset, timeout);
279
+ const char = foldSearchText(key) || key;
280
+ stepping = char === lastKey && (stepping || query.length === 1);
281
+ lastKey = char;
282
+ query += char;
283
+ if (stepping) {
284
+ const whole = scan(labels, query, Math.max(current, 0));
285
+ return whole !== -1 ? whole : scan(labels, char, current + 1);
286
+ }
287
+ return scan(labels, query, query.length === 1 ? current + 1 : Math.max(current, 0));
288
+ };
289
+ return {
290
+ search,
291
+ reset,
292
+ active: () => query !== ""
293
+ };
294
+ }
295
+ /** One visible row: the twisty (a branch only) and the label span. */
296
+ function TreeRowView(props) {
297
+ const { extras } = props;
298
+ const address = { index: props.index };
299
+ const disabled = (props.handle.part("row", address)?.state)?.disabled === true;
300
+ const indicator = usePart(props.handle, "indicator", {
301
+ children: INDICATOR,
302
+ "data-loading": extras.loading ? "" : void 0,
303
+ "data-failed": extras.failed ? "" : void 0
304
+ }, void 0, address);
305
+ const checkbox = extras.checkbox ? createElement("input", {
306
+ type: "checkbox",
307
+ "data-slot": "tree-checkbox",
308
+ "data-part": "checkbox",
309
+ ...extras.checked ? { "data-checked": "" } : {},
310
+ ...disabled ? {
311
+ "data-disabled": "",
312
+ disabled: true
313
+ } : {},
314
+ checked: extras.checked,
315
+ style: {
316
+ appearance: "none",
317
+ margin: 0
318
+ },
319
+ onClick: (e) => e.stopPropagation(),
320
+ onChange: () => {
321
+ if (!disabled) extras.toggleChecked(props.id);
322
+ }
323
+ }) : null;
324
+ const label = usePart(props.handle, "label", { children: (partState) => partState.label }, void 0, address);
325
+ return usePart(props.handle, "row", {
326
+ "aria-selected": extras.selected ? "true" : "false",
327
+ "data-selected": extras.selected ? "" : void 0,
328
+ "aria-busy": extras.loading ? "true" : void 0,
329
+ children: createElement(Fragment, null, indicator, checkbox, label)
330
+ }, void 0, address);
331
+ }
332
+ function branchIds(list, out = []) {
333
+ for (const item of list) {
334
+ if (item.children && item.children.length > 0) out.push(item.id);
335
+ if (item.children) branchIds(item.children, out);
336
+ }
337
+ return out;
338
+ }
339
+ function ancestorsOf(list, target, trail = []) {
340
+ for (const item of list) {
341
+ if (item.id === target) return trail;
342
+ if (item.children) {
343
+ const found = ancestorsOf(item.children, target, [...trail, item.id]);
344
+ if (found) return found;
345
+ }
346
+ }
347
+ return null;
348
+ }
349
+ function useTreeLoader(loadChildren) {
350
+ const [loadingIds, setLoadingIds] = useState(EMPTY_IDS);
351
+ const [failedIds, setFailedIds] = useState(EMPTY_IDS);
352
+ const loads = useRef(/* @__PURE__ */ new Set());
353
+ useEffect(() => {
354
+ const running = loads.current;
355
+ return () => {
356
+ for (const ac of running) ac.abort();
357
+ };
358
+ }, []);
359
+ return {
360
+ loadingIds,
361
+ failedIds,
362
+ loadBranch: useCallback((id, fn = loadChildren) => {
363
+ if (!fn) return;
364
+ setLoadingIds((prev) => prev.includes(id) ? prev : [...prev, id]);
365
+ setFailedIds((prev) => prev.filter((x) => x !== id));
366
+ const ac = new AbortController();
367
+ loads.current.add(ac);
368
+ const settle = (ok) => {
369
+ loads.current.delete(ac);
370
+ setLoadingIds((prev) => prev.filter((x) => x !== id));
371
+ if (!ok) setFailedIds((prev) => prev.includes(id) ? prev : [...prev, id]);
372
+ };
373
+ new Promise((resolve) => resolve(fn(id, { signal: ac.signal }))).then(() => settle(true), () => settle(false));
374
+ }, [loadChildren])
375
+ };
376
+ }
377
+ function Tree(props) {
378
+ return props.children !== void 0 ? createElement(CompoundTree, props) : createElement(DataTree, props);
379
+ }
380
+ Tree.displayName = "tree";
381
+ /** The data path: the primitive renders the visible rows of `items` or `paths`. */
382
+ function DataTree(props) {
383
+ const { items: itemsProp, paths, children: _children, expanded, defaultExpanded = EMPTY_IDS, selected, defaultValue, mode = "single", activation: _activation, expandOnPress: _expandOnPress, loadChildren, onAction, checkboxes = false, checked: checkedProp, defaultChecked = EMPTY_IDS, onCheckedChange, current: _current, keepMounted: _keepMounted, disabled = false, label = "", indent = 16, onChange, onValueChange, onSelect, controller, className, style, render, ref: hostRef, ...element } = props;
384
+ const [uncontrolledExpanded, setUncontrolledExpanded] = useState(() => {
385
+ const source = dataSource(itemsProp, paths);
386
+ return source === void 0 ? defaultExpanded : initialTreeExpanded(toCoreItems(source), defaultExpanded);
387
+ });
388
+ const [uncontrolledSelected, setUncontrolledSelected] = useState(defaultValue ?? void 0);
389
+ const [uncontrolledChecked, setUncontrolledChecked] = useState(defaultChecked);
390
+ const { loadingIds, failedIds, loadBranch } = useTreeLoader(loadChildren);
391
+ const currentExpanded = expanded ?? uncontrolledExpanded;
392
+ const currentSelected = selected ?? uncontrolledSelected;
393
+ const selectedSet = useMemo(() => new Set(Array.isArray(currentSelected) ? currentSelected : currentSelected !== void 0 ? [currentSelected] : []), [currentSelected]);
394
+ const firstSelected = Array.isArray(currentSelected) ? currentSelected[0] : currentSelected;
395
+ const currentChecked = checkedProp ?? uncontrolledChecked;
396
+ const toggleChecked = (id) => {
397
+ const next = currentChecked.includes(id) ? currentChecked.filter((x) => x !== id) : [...currentChecked, id];
398
+ const details = createDetails({ reason: "item-press" });
399
+ onCheckedChange?.(next, details);
400
+ if (details.canceled) return;
401
+ if (checkedProp === void 0) setUncontrolledChecked(next);
402
+ };
403
+ const selectItem = (id) => {
404
+ if (disabled) return;
405
+ if (mode === "none") {
406
+ onAction?.(id, {});
407
+ return;
408
+ }
409
+ const next = mode === "multiple" ? selectedSet.has(id) ? [...selectedSet].filter((x) => x !== id) : [...selectedSet, id] : id;
410
+ const details = createDetails({ reason: "item-press" });
411
+ onValueChange?.(next, details);
412
+ if (details.canceled) return;
413
+ if (selected === void 0) setUncontrolledSelected(next);
414
+ onSelect?.(id);
415
+ if (mode !== "multiple") onAction?.(id, {});
416
+ };
417
+ const treeRef = useRef(null);
418
+ const mergedTreeRef = useMemo(() => hostRef ? mergeRefs(treeRef, hostRef) : treeRef, [hostRef]);
419
+ const items = useMemo(() => {
420
+ const src = dataSource(itemsProp, paths);
421
+ return src === void 0 ? EMPTY_ITEMS : toCoreItems(src);
422
+ }, [itemsProp, paths]);
423
+ const commitExpanded = (next, reason) => {
424
+ const details = createDetails({ reason });
425
+ onChange?.([...next], details);
426
+ if (details.canceled) return;
427
+ if (expanded === void 0) setUncontrolledExpanded(next);
428
+ for (const id of next) if (!currentExpanded.includes(id)) loadBranch(id);
429
+ };
430
+ const latest = useRef({
431
+ commitExpanded,
432
+ selectItem
433
+ });
434
+ latest.current = {
435
+ commitExpanded,
436
+ selectItem
437
+ };
438
+ const onDataChange = useCallback((next) => {
439
+ latest.current.commitExpanded(next, "item-press");
440
+ }, []);
441
+ const onDataSelect = useCallback((id) => {
442
+ latest.current.selectItem(id);
443
+ }, []);
444
+ const handle = usePrimitive(treePrimitive, {
445
+ items,
446
+ expanded: currentExpanded,
447
+ ...firstSelected === void 0 ? {} : { selected: firstSelected },
448
+ disabled,
449
+ label,
450
+ indent,
451
+ onChange: onDataChange,
452
+ onSelect: onDataSelect
453
+ });
454
+ const pendingFocus = useRef(null);
455
+ useIsomorphicLayoutEffect(() => {
456
+ const id = pendingFocus.current;
457
+ if (id === null) return;
458
+ const rowEl = [...treeRef.current?.querySelectorAll("[data-id]") ?? []].find((el) => el.dataset["id"] === id);
459
+ if (rowEl) {
460
+ pendingFocus.current = null;
461
+ rowEl.focus();
462
+ }
463
+ });
464
+ const controllerApi = {
465
+ ...handle.api,
466
+ expandAll: () => latest.current.commitExpanded(branchIds(items), "imperative"),
467
+ collapseAll: () => latest.current.commitExpanded([], "imperative"),
468
+ setValue: (next) => {
469
+ if (selected === void 0) setUncontrolledSelected(next === null ? void 0 : next);
470
+ if (typeof next === "string") onSelect?.(next);
471
+ },
472
+ reveal: (targetId) => {
473
+ const ancestors = ancestorsOf(items, targetId);
474
+ if (ancestors !== null && ancestors.length > 0) latest.current.commitExpanded(Array.from(/* @__PURE__ */ new Set([...currentExpanded, ...ancestors])), "imperative");
475
+ handle.api.focus(targetId);
476
+ pendingFocus.current = targetId;
477
+ },
478
+ isExpanded: (value) => currentExpanded.includes(value)
479
+ };
480
+ const apiRef = useRef(controllerApi);
481
+ apiRef.current = controllerApi;
482
+ const stableApi = useMemo(() => ({
483
+ expandedIds: () => apiRef.current.expandedIds(),
484
+ visibleIds: () => apiRef.current.visibleIds(),
485
+ toggle: (id) => apiRef.current.toggle(id),
486
+ focus: (id) => apiRef.current.focus(id),
487
+ rovingId: () => apiRef.current.rovingId(),
488
+ expandAll: () => apiRef.current.expandAll(),
489
+ collapseAll: () => apiRef.current.collapseAll(),
490
+ setValue: (next) => apiRef.current.setValue(next),
491
+ reveal: (id) => apiRef.current.reveal(id),
492
+ isExpanded: (value) => apiRef.current.isExpanded(value)
493
+ }), []);
494
+ useControllerAttach(controller, stableApi);
495
+ const checkedSet = new Set(currentChecked);
496
+ const rows = handle.api.visibleIds().map((id, index) => createElement(TreeRowView, {
497
+ key: id,
498
+ handle,
499
+ index,
500
+ id,
501
+ extras: {
502
+ selected: selectedSet.has(id),
503
+ checkbox: checkboxes,
504
+ checked: checkedSet.has(id),
505
+ loading: loadingIds.includes(id),
506
+ failed: failedIds.includes(id),
507
+ toggleChecked
508
+ }
509
+ }));
510
+ return usePart(handle, "root", {
511
+ ...element,
512
+ className,
513
+ style,
514
+ ref: mergedTreeRef,
515
+ children: rows
516
+ }, render);
517
+ }
518
+ const TreeCompoundContext = createContext(null);
519
+ const TreeLevelContext = createContext(1);
520
+ /** Events a part already acted on, which the row's own press then leaves alone. */
521
+ const partPresses = /* @__PURE__ */ new WeakSet();
522
+ /** The compound path: the host composes TreeItem, TreeGroup and the item parts. */
523
+ function CompoundTree(props) {
524
+ const { items: itemsProp, paths, children, expanded, defaultExpanded = EMPTY_IDS, selected, defaultValue, mode: modeProp = "single", activation = "manual", expandOnPress = true, loadChildren, onAction, checkboxes = false, checked: checkedProp, defaultChecked = EMPTY_IDS, onCheckedChange, current = null, keepMounted = false, disabled = false, label = "", indent: _indent, onChange, onValueChange, onSelect, controller, className, style, render: _render, ref: hostRef, ...element } = props;
525
+ const mode = modeProp === "multiple" || modeProp === "none" ? modeProp : "single";
526
+ const id = useId();
527
+ const dataShape = useMemo(() => {
528
+ const source = dataSource(itemsProp, paths);
529
+ return source === void 0 ? void 0 : shapeOf(dataEntries(source), []);
530
+ }, [itemsProp, paths]);
531
+ const walk = useMemo(() => dataShape === void 0 ? extractTreeItems(children) : NO_WALK, [dataShape, children]);
532
+ const [ownExpanded, setOwnExpanded] = useState(() => {
533
+ const shape = dataShape ?? shapeOf(walk.entries, []);
534
+ const seeded = new Set(defaultExpanded);
535
+ if (current !== null) for (const ancestor of ancestorsIn(shape, current)) seeded.add(ancestor);
536
+ return [...seeded];
537
+ });
538
+ const [ownValue, setOwnValue] = useState(() => {
539
+ const keys = toKeys(defaultValue);
540
+ return mode === "multiple" ? keys : keys[0] ?? null;
541
+ });
542
+ const [ownChecked, setOwnChecked] = useState(defaultChecked);
543
+ const { loadingIds, failedIds, loadBranch: loadBranchWith } = useTreeLoader(props.loadChildren);
544
+ const [focusedId, setFocusedId] = useState(void 0);
545
+ const [probeOpen, setProbeOpen] = useState(null);
546
+ const probe = useRef(null);
547
+ const currentExpanded = expanded ?? ownExpanded;
548
+ const value = selected === void 0 ? ownValue : mode === "multiple" ? toKeys(selected) : toKeys(selected)[0] ?? null;
549
+ const selectedKeys = useMemo(() => toKeys(value), [value]);
550
+ const selectedSet = useMemo(() => new Set(selectedKeys), [selectedKeys]);
551
+ const shown = useMemo(() => new Set(probeOpen === null ? currentExpanded : [...currentExpanded, ...probeOpen]), [probeOpen, currentExpanded]);
552
+ const checkedValue = checkedProp ?? ownChecked;
553
+ const mountedWalk = useMemo(() => keepMounted ? walk.entries : visibleEntries(walk.entries, shown), [
554
+ keepMounted,
555
+ walk,
556
+ shown
557
+ ]);
558
+ const collection = useCollection(mountedWalk);
559
+ const shape = useMemo(() => dataShape ?? shapeOf(collection.items, walk.entries), [
560
+ dataShape,
561
+ collection.items,
562
+ walk
563
+ ]);
564
+ const shows = (key) => ancestorsIn(shape, key).every((ancestor) => shown.has(ancestor));
565
+ const isDisabled = (key) => disabled || shape.entry.get(key)?.disabled === true;
566
+ const checkStates = useMemo(() => {
567
+ const tree = treeCollection(shape.nodes);
568
+ return treeChecked(tree, checkedValue, { counted: COUNT_EVERY_LEAF });
569
+ }, [shape, checkedValue]);
570
+ const checks = useCallback((key) => checkStates.get(key) ?? checkedValue.includes(key), [checkStates, checkedValue]);
571
+ let tabStop;
572
+ if (!disabled) {
573
+ for (let key = focusedId; key !== void 0 && tabStop === void 0; key = shape.parent.get(key) ?? void 0) if (shape.entry.has(key) && shows(key)) tabStop = key;
574
+ tabStop ??= [current, ...selectedKeys].find((key) => key !== null && shape.entry.has(key) && shows(key) && !isDisabled(key)) ?? shape.order.find((key) => shows(key) && !isDisabled(key));
575
+ }
576
+ const treeRef = useRef(null);
577
+ const mergedTreeRef = useMemo(() => hostRef ? mergeRefs(treeRef, hostRef) : treeRef, [hostRef]);
578
+ const deep = useRef(/* @__PURE__ */ new Set());
579
+ const anchor = useRef(null);
580
+ const typeahead = useRef(null);
581
+ typeahead.current ??= createTypeahead();
582
+ useEffect(() => () => typeahead.current?.reset(), []);
583
+ const pendingFocus = useRef(null);
584
+ const latest = useRef({
585
+ shape,
586
+ expanded: currentExpanded,
587
+ value,
588
+ checked: checkedValue,
589
+ focusedId,
590
+ props,
591
+ mode
592
+ });
593
+ latest.current = {
594
+ shape,
595
+ expanded: currentExpanded,
596
+ value,
597
+ checked: checkedValue,
598
+ focusedId,
599
+ props,
600
+ mode
601
+ };
602
+ const actions = useMemo(() => {
603
+ const s = () => latest.current;
604
+ const disabledKey = (key) => s().props.disabled === true || s().shape.entry.get(key)?.disabled === true;
605
+ const itemElement = (key) => [...treeRef.current?.querySelectorAll("[role=\"treeitem\"]") ?? []].find((el) => el.dataset["value"] === key);
606
+ const visibleItems = () => [...treeRef.current?.querySelectorAll("[role=\"treeitem\"]") ?? []].filter((el) => el.closest("[role=\"group\"][hidden]") === null);
607
+ const keyOf = (el) => el?.dataset["value"];
608
+ const details = (reason, event) => createDetails({
609
+ reason,
610
+ event
611
+ });
612
+ const loadBranch = (key) => loadBranchWith(key, s().props.loadChildren);
613
+ const setExpanded = (next, why) => {
614
+ const before = s().expanded;
615
+ const unique = [...new Set(next)];
616
+ if (sameSet(unique, before)) return false;
617
+ s().props.onChange?.(unique, why);
618
+ if (why.canceled) return false;
619
+ if (s().props.expanded === void 0) setOwnExpanded(unique);
620
+ latest.current = {
621
+ ...latest.current,
622
+ expanded: unique
623
+ };
624
+ for (const key of unique) if (!before.includes(key)) loadBranch(key);
625
+ return true;
626
+ };
627
+ const setOpen = (key, opening, why) => {
628
+ if (!opening) deep.current.delete(key);
629
+ const before = s().expanded;
630
+ if (before.includes(key) === opening) return false;
631
+ if (opening && s().shape.entry.has(key) && !isBranchIn(s().shape, key)) return false;
632
+ const changed = setExpanded(opening ? [...before, key] : before.filter((other) => other !== key), why);
633
+ if (!changed || typeof document === "undefined") return changed;
634
+ const el = itemElement(key);
635
+ const active = document.activeElement;
636
+ if (el !== void 0 && el === active && isApple()) announce(opening ? "Expanded" : "Collapsed");
637
+ if (!opening && el !== void 0 && active !== el && el.contains(active)) el.focus();
638
+ return changed;
639
+ };
640
+ const expandDeep = (key, why) => {
641
+ deep.current.add(key);
642
+ const below = descendantsIn(s().shape, key).filter((child) => isBranchIn(s().shape, child));
643
+ setExpanded([
644
+ ...s().expanded,
645
+ key,
646
+ ...below
647
+ ], why);
648
+ };
649
+ const collapseDeep = (key, why) => {
650
+ const below = /* @__PURE__ */ new Set([key, ...descendantsIn(s().shape, key)]);
651
+ for (const branch of below) deep.current.delete(branch);
652
+ setExpanded(s().expanded.filter((other) => !below.has(other)), why);
653
+ };
654
+ const setValue = (next, why) => {
655
+ if (sameKeys(toKeys(next), toKeys(s().value))) return false;
656
+ s().props.onValueChange?.(next, why);
657
+ if (why.canceled) return false;
658
+ if (s().props.selected === void 0) setOwnValue(next);
659
+ latest.current = {
660
+ ...latest.current,
661
+ value: next
662
+ };
663
+ return true;
664
+ };
665
+ const selectable = (key) => s().mode !== "none" && !disabledKey(key);
666
+ const choose = (key, why) => {
667
+ if (!selectable(key)) return;
668
+ anchor.current = key;
669
+ if (setValue(s().mode === "multiple" ? [key] : key, why)) s().props.onSelect?.(key);
670
+ };
671
+ const toggle = (key, why) => {
672
+ if (!selectable(key)) return;
673
+ anchor.current = key;
674
+ const keys = toKeys(s().value);
675
+ const has = keys.includes(key);
676
+ const next = s().mode === "multiple" ? has ? keys.filter((other) => other !== key) : [...keys, key] : has ? null : key;
677
+ if (setValue(next, why)) s().props.onSelect?.(key);
678
+ };
679
+ const extend = (target, from, why) => {
680
+ const keys = visibleItems().map((el) => keyOf(el) ?? "");
681
+ const start = keys.indexOf(anchor.current ?? from);
682
+ const end = keys.indexOf(target);
683
+ if (start === -1 || end === -1) return;
684
+ const range = keys.slice(Math.min(start, end), Math.max(start, end) + 1).filter(selectable);
685
+ setValue(range, why);
686
+ };
687
+ const toggleAll = (why) => {
688
+ const keys = visibleItems().map((el) => keyOf(el) ?? "").filter(selectable);
689
+ const selectedNow = toKeys(s().value);
690
+ setValue(keys.every((key) => selectedNow.includes(key)) ? [] : keys, why);
691
+ };
692
+ const follow = (key, event) => {
693
+ if (s().mode === "single" && s().props.activation === "automatic") choose(key, details("list-navigation", event));
694
+ };
695
+ const toggleChecked = (key, why) => {
696
+ if (disabledKey(key) || !s().shape.entry.has(key)) return false;
697
+ const tree = treeCollection(s().shape.nodes);
698
+ const before = s().checked;
699
+ const next = [...treeToggleChecked(tree, before, key, { counted: COUNT_EVERY_LEAF })];
700
+ if (sameKeys(next, before)) return false;
701
+ s().props.onCheckedChange?.(next, why);
702
+ if (why.canceled) return false;
703
+ if (s().props.checked === void 0) setOwnChecked(next);
704
+ latest.current = {
705
+ ...latest.current,
706
+ checked: next
707
+ };
708
+ return true;
709
+ };
710
+ const focusRow = (el) => {
711
+ if (el === void 0) return;
712
+ const key = keyOf(el);
713
+ if (key !== void 0) setFocusedId(key);
714
+ el.focus();
715
+ };
716
+ const press = (key, el, event) => {
717
+ if (s().props.disabled === true) return;
718
+ const active = typeof document === "undefined" ? null : document.activeElement;
719
+ const editing = active instanceof HTMLElement && active !== el && (active.isContentEditable || active.matches("input, textarea, select"));
720
+ const from = s().focusedId ?? key;
721
+ if (active !== el && !editing) el.focus({ preventScroll: true });
722
+ setFocusedId(key);
723
+ if (disabledKey(key)) return;
724
+ const mouse = event;
725
+ if (s().mode === "multiple" && mouse.shiftKey) extend(key, from, details("item-press", event));
726
+ else if (s().mode === "multiple" || mouse.ctrlKey || mouse.metaKey) toggle(key, details("item-press", event));
727
+ else choose(key, details("item-press", event));
728
+ if (isBranchIn(s().shape, key) && s().props.expandOnPress !== false) setOpen(key, !s().expanded.includes(key), details("item-press", event));
729
+ s().props.onAction?.(key, { event });
730
+ };
731
+ const pressIndicator = (key, el, event) => {
732
+ partPresses.add(event);
733
+ if (s().props.disabled === true) return;
734
+ if (el) focusRow(el);
735
+ if (disabledKey(key)) return;
736
+ const why = details("trigger-press", event);
737
+ if (event.altKey) {
738
+ if (s().expanded.includes(key)) collapseDeep(key, why);
739
+ else expandDeep(key, why);
740
+ } else setOpen(key, !s().expanded.includes(key), why);
741
+ };
742
+ const pressCheckbox = (key, el, event) => {
743
+ partPresses.add(event);
744
+ if (s().props.disabled === true) return;
745
+ if (el) focusRow(el);
746
+ toggleChecked(key, details("item-press", event));
747
+ };
748
+ const keydown = (event) => {
749
+ if (event.defaultPrevented || s().props.disabled === true) return;
750
+ const target = event.target;
751
+ const el = target.closest("[role=\"treeitem\"]") ?? document.activeElement?.closest("[role=\"treeitem\"]") ?? null;
752
+ if (el === null || !treeRef.current?.contains(el)) return;
753
+ if (target !== el && target.matches("input, textarea, select, [contenteditable]:not([contenteditable='false'])")) return;
754
+ const key = keyOf(el);
755
+ if (key === void 0) return;
756
+ const native = event.nativeEvent;
757
+ const shape = s().shape;
758
+ const mod = event.ctrlKey || event.metaKey;
759
+ const visible = visibleItems();
760
+ const index = visible.indexOf(el);
761
+ const nav = () => details("list-navigation", native);
762
+ const parentItem = () => el.parentElement?.closest("[role=\"treeitem\"]") ?? void 0;
763
+ const moves = {
764
+ ArrowDown: visible[index + 1],
765
+ ArrowUp: index > 0 ? visible[index - 1] : void 0,
766
+ Home: visible[0],
767
+ End: visible[visible.length - 1]
768
+ };
769
+ if (event.key in moves && !event.altKey) {
770
+ event.preventDefault();
771
+ const to = moves[event.key];
772
+ const toKey = keyOf(to);
773
+ if (to === void 0 || toKey === void 0 || to === el) return;
774
+ focusRow(to);
775
+ const homeOrEnd = event.key === "Home" || event.key === "End";
776
+ if (s().mode === "multiple" && event.shiftKey && (!homeOrEnd || mod)) extend(toKey, key, nav());
777
+ else if (!event.shiftKey) follow(toKey, native);
778
+ return;
779
+ }
780
+ const rtl = getComputedStyle(el).direction === "rtl";
781
+ const forward = rtl ? "ArrowLeft" : "ArrowRight";
782
+ const backward = rtl ? "ArrowRight" : "ArrowLeft";
783
+ const branch = isBranchIn(shape, key);
784
+ const open = branch && s().expanded.includes(key);
785
+ const off = disabledKey(key);
786
+ if (event.key === forward && !mod) {
787
+ if (!branch) return;
788
+ if (event.altKey) {
789
+ if (!off) expandDeep(key, nav());
790
+ } else if (!open) {
791
+ if (off) return;
792
+ setOpen(key, true, nav());
793
+ } else {
794
+ const next = visible[index + 1];
795
+ if (next !== void 0 && next.parentElement?.closest("[role=\"treeitem\"]") === el) {
796
+ focusRow(next);
797
+ const nextKey = keyOf(next);
798
+ if (nextKey !== void 0) follow(nextKey, native);
799
+ }
800
+ }
801
+ } else if (event.key === backward && !mod) {
802
+ if (branch && event.altKey && !off) collapseDeep(key, nav());
803
+ else if (open && !off) setOpen(key, false, nav());
804
+ else {
805
+ const up = parentItem();
806
+ if (up === void 0 || !treeRef.current?.contains(up)) return;
807
+ focusRow(up);
808
+ const upKey = keyOf(up);
809
+ if (upKey !== void 0) follow(upKey, native);
810
+ }
811
+ } else if (event.key === "*") {
812
+ const siblings = (shape.children.get(shape.parent.get(key) ?? null) ?? []).filter((sibling) => isBranchIn(shape, sibling) && !disabledKey(sibling));
813
+ setExpanded([...s().expanded, ...siblings], nav());
814
+ } else if (mod && !event.shiftKey && !event.altKey && event.key.toLowerCase() === "a") {
815
+ if (s().mode !== "multiple") return;
816
+ toggleAll(nav());
817
+ } else if (event.key === "Enter" && !mod && !event.altKey) {
818
+ const link = [...el.querySelectorAll("[data-slot=\"tree-label\"]")].find((labelEl) => labelEl.closest("[role=\"treeitem\"]") === el);
819
+ if (link?.matches("a[href]")) link.click();
820
+ else press(key, el, native);
821
+ } else if (event.key === " " && !typeahead.current?.active()) {
822
+ const why = details("item-press", native);
823
+ if (s().props.checkboxes === true) toggleChecked(key, why);
824
+ else if (s().mode === "multiple" && event.shiftKey) extend(key, key, why);
825
+ else if (s().mode !== "none") toggle(key, why);
826
+ else return;
827
+ } else if ([...event.key].length === 1 && !mod && !event.altKey) {
828
+ const labels = visible.map((item) => {
829
+ const itemKey = keyOf(item) ?? "";
830
+ return shape.entry.get(itemKey)?.label ?? item.textContent ?? "";
831
+ });
832
+ const found = typeahead.current?.search(event.key, labels, index) ?? -1;
833
+ if (found === -1) return;
834
+ const to = visible[found];
835
+ focusRow(to);
836
+ const toKey = keyOf(to);
837
+ if (toKey !== void 0) follow(toKey, native);
838
+ } else return;
839
+ event.preventDefault();
840
+ };
841
+ const startProbe = (next) => {
842
+ probe.current = next;
843
+ setProbeOpen((running) => running ?? []);
844
+ };
845
+ return {
846
+ press,
847
+ pressIndicator,
848
+ pressCheckbox,
849
+ focused: setFocusedId,
850
+ keydown,
851
+ setExpanded,
852
+ api: {
853
+ expandedIds: () => [...s().expanded],
854
+ visibleIds: () => s().shape.order.filter((key) => ancestorsIn(s().shape, key).every((up) => s().expanded.includes(up))),
855
+ toggle: (key) => {
856
+ setOpen(key, !s().expanded.includes(key), details("imperative"));
857
+ },
858
+ focus: (key) => {
859
+ setFocusedId(key);
860
+ pendingFocus.current = key;
861
+ },
862
+ rovingId: () => s().focusedId,
863
+ expandAll: () => {
864
+ if (s().props.items !== void 0 || s().props.paths !== void 0) {
865
+ setExpanded(s().shape.order.filter((key) => isBranchIn(s().shape, key)), details("imperative"));
866
+ return;
867
+ }
868
+ startProbe({ kind: "expandAll" });
869
+ },
870
+ collapseAll: () => {
871
+ probe.current = null;
872
+ setProbeOpen(null);
873
+ deep.current.clear();
874
+ setExpanded([], details("imperative"));
875
+ },
876
+ setValue: (next) => {
877
+ const normalized = next === null ? null : typeof next === "string" ? next : [...next];
878
+ if (setValue(normalized, details("imperative")) && typeof next === "string") s().props.onSelect?.(next);
879
+ },
880
+ reveal: (target) => {
881
+ const shape = s().shape;
882
+ if (!shape.entry.has(target)) {
883
+ startProbe({
884
+ kind: "reveal",
885
+ target,
886
+ base: s().expanded
887
+ });
888
+ return;
889
+ }
890
+ const hidden = ancestorsIn(shape, target).filter((up) => !s().expanded.includes(up));
891
+ if (hidden.length > 0 && !setExpanded([...s().expanded, ...hidden], details("imperative"))) return;
892
+ setFocusedId(target);
893
+ pendingFocus.current = target;
894
+ },
895
+ isExpanded: (key) => s().expanded.includes(key)
896
+ }
897
+ };
898
+ }, []);
899
+ useControllerAttach(controller, actions.api);
900
+ useIsomorphicLayoutEffect(() => {
901
+ if (deep.current.size === 0) return;
902
+ const add = shape.order.filter((key) => isBranchIn(shape, key) && !currentExpanded.includes(key) && !isDisabled(key) && ancestorsIn(shape, key).some((up) => deep.current.has(up)));
903
+ if (add.length > 0) actions.setExpanded([...currentExpanded, ...add], createDetails({ reason: "list-navigation" }));
904
+ });
905
+ const seenCurrent = useRef(current);
906
+ useEffect(() => {
907
+ if (current === seenCurrent.current) return;
908
+ seenCurrent.current = current;
909
+ if (current === null) return;
910
+ const hidden = ancestorsIn(latest.current.shape, current).filter((up) => !latest.current.expanded.includes(up));
911
+ if (hidden.length > 0) actions.setExpanded([...latest.current.expanded, ...hidden], createDetails({ reason: "imperative" }));
912
+ }, [current, actions]);
913
+ useIsomorphicLayoutEffect(() => {
914
+ const key = pendingFocus.current;
915
+ if (key === null) return;
916
+ const rowEl = [...treeRef.current?.querySelectorAll("[role=\"treeitem\"]") ?? []].find((el) => el.dataset["value"] === key && el.closest("[role=\"group\"][hidden]") === null);
917
+ if (rowEl) {
918
+ pendingFocus.current = null;
919
+ rowEl.focus();
920
+ }
921
+ });
922
+ useIsomorphicLayoutEffect(() => {
923
+ const running = probe.current;
924
+ if (running === null) return;
925
+ const known = dataShape ?? shapeOf(collection.current(), walk.entries);
926
+ if (running.kind === "reveal" && known.entry.has(running.target)) {
927
+ probe.current = null;
928
+ setProbeOpen(null);
929
+ const ancestors = ancestorsIn(known, running.target);
930
+ if (ancestors.length > 0) actions.setExpanded([.../* @__PURE__ */ new Set([...running.base, ...ancestors])], createDetails({ reason: "imperative" }));
931
+ setFocusedId(running.target);
932
+ pendingFocus.current = running.target;
933
+ return;
934
+ }
935
+ const branches = known.order.filter((key) => isBranchIn(known, key));
936
+ const opened = new Set(probeOpen ?? []);
937
+ if (branches.some((key) => !opened.has(key))) {
938
+ setProbeOpen(branches);
939
+ return;
940
+ }
941
+ probe.current = null;
942
+ setProbeOpen(null);
943
+ if (running.kind === "expandAll") actions.setExpanded(branches, createDetails({ reason: "imperative" }));
944
+ });
945
+ const position = useCallback((key) => {
946
+ const siblings = shape.children.get(shape.parent.get(key) ?? null) ?? [];
947
+ const index = siblings.indexOf(key);
948
+ return index === -1 ? void 0 : {
949
+ index: index + 1,
950
+ size: siblings.length
951
+ };
952
+ }, [shape]);
953
+ const scope = {
954
+ id,
955
+ mode,
956
+ checkable: checkboxes,
957
+ disabled,
958
+ keepMounted,
959
+ shown,
960
+ selected: selectedSet,
961
+ checks,
962
+ current,
963
+ tabStop,
964
+ loading: useMemo(() => new Set(loadingIds), [loadingIds]),
965
+ failed: useMemo(() => new Set(failedIds), [failedIds]),
966
+ position,
967
+ register: collection.register,
968
+ actions
969
+ };
970
+ return createElement(TreeCompoundContext.Provider, { value: scope }, createElement("ul", {
971
+ role: "tree",
972
+ "data-slot": "tree",
973
+ ...label ? { "aria-label": label } : {},
974
+ "aria-multiselectable": mode === "multiple" ? "true" : void 0,
975
+ "aria-disabled": disabled ? "true" : void 0,
976
+ "data-disabled": disabled ? "" : void 0,
977
+ className,
978
+ style: {
979
+ listStyle: "none",
980
+ margin: 0,
981
+ ...style
982
+ },
983
+ ref: mergedTreeRef,
984
+ onKeyDown: actions.keydown,
985
+ ...element
986
+ }, children));
987
+ }
988
+ const TreeRowItemContext = createContext(null);
989
+ function TreeGroup({ style, keepMounted, ...props }) {
990
+ const item = useContext(TreeRowItemContext);
991
+ const tree = useContext(TreeCompoundContext);
992
+ const collapsed = item !== null && item.branch && !item.expanded;
993
+ if (collapsed && !(keepMounted ?? tree?.keepMounted ?? false)) return null;
994
+ const nextLevel = (item?.level ?? 1) + 1;
995
+ return createElement(TreeLevelContext.Provider, { value: nextLevel }, createElement("ul", {
996
+ role: "group",
997
+ "data-part": "group",
998
+ "data-slot": "tree-group",
999
+ ...item?.expanded ? { "data-expanded": "" } : {},
1000
+ ...collapsed ? { hidden: true } : {},
1001
+ ...props,
1002
+ style: {
1003
+ listStyle: "none",
1004
+ margin: 0,
1005
+ padding: 0,
1006
+ ...style
1007
+ }
1008
+ }));
1009
+ }
1010
+ function TreeItem({ children, id, value, branch, disabled: itemDisabled = false, style, onClick, onFocus, ...rest }) {
1011
+ const ctx = useContext(TreeCompoundContext);
1012
+ const level = useContext(TreeLevelContext);
1013
+ const parentRow = useContext(TreeRowItemContext);
1014
+ const itemId = id ?? value ?? "";
1015
+ const hasChildren = branch ?? hasTreeGroupChild(children);
1016
+ const rowRef = useCollectionItem(itemId === "" ? void 0 : ctx?.register, treeEntry(itemId, {
1017
+ children,
1018
+ branch,
1019
+ disabled: itemDisabled
1020
+ }, parentRow?.id));
1021
+ const [labelled, setLabelled] = useState(() => (Array.isArray(children) ? children : [children]).some((c) => isValidElement(c) && c.type === TreeItemLabel));
1022
+ const isExpanded = hasChildren && Boolean(itemId && ctx?.shown.has(itemId));
1023
+ const mode = ctx?.mode ?? "single";
1024
+ const isSelected = Boolean(itemId && ctx?.selected.has(itemId));
1025
+ const isDisabled = Boolean(ctx?.disabled || itemDisabled);
1026
+ const isTabStop = Boolean(itemId && ctx?.tabStop === itemId);
1027
+ const isCurrent = Boolean(itemId && ctx?.current === itemId);
1028
+ const checked = itemId && ctx ? ctx.checks(itemId) : false;
1029
+ const position = itemId && ctx ? ctx.position(itemId) : void 0;
1030
+ const loading = Boolean(itemId && ctx?.loading.has(itemId));
1031
+ const labelId = `${ctx?.id ?? ""}-label-${idPart(itemId)}`;
1032
+ const row = useMemo(() => ({
1033
+ id: itemId,
1034
+ level,
1035
+ branch: hasChildren,
1036
+ expanded: isExpanded,
1037
+ selected: isSelected,
1038
+ disabled: isDisabled,
1039
+ checked,
1040
+ labelId,
1041
+ row: () => rowRef.current,
1042
+ setLabelled
1043
+ }), [
1044
+ itemId,
1045
+ level,
1046
+ hasChildren,
1047
+ isExpanded,
1048
+ isSelected,
1049
+ isDisabled,
1050
+ checked,
1051
+ labelId,
1052
+ rowRef
1053
+ ]);
1054
+ return createElement(TreeRowItemContext.Provider, { value: row }, createElement("li", {
1055
+ role: "treeitem",
1056
+ "data-slot": "tree-item",
1057
+ "data-part": "row",
1058
+ "data-id": itemId,
1059
+ "data-value": itemId,
1060
+ "data-level": level,
1061
+ "aria-level": level,
1062
+ ...labelled ? { "aria-labelledby": labelId } : {},
1063
+ ...position ? {
1064
+ "aria-posinset": position.index,
1065
+ "aria-setsize": position.size
1066
+ } : {},
1067
+ ...hasChildren ? {
1068
+ "data-branch": "",
1069
+ "aria-expanded": isExpanded ? "true" : "false"
1070
+ } : {},
1071
+ ...mode === "none" ? {} : { "aria-selected": isSelected ? "true" : "false" },
1072
+ ...ctx?.checkable ? { "aria-checked": checked === "mixed" ? "mixed" : checked ? "true" : "false" } : {},
1073
+ ...isDisabled ? {
1074
+ "aria-disabled": "true",
1075
+ "data-disabled": ""
1076
+ } : {},
1077
+ ...isCurrent ? { "aria-current": "page" } : {},
1078
+ ...loading ? {
1079
+ "aria-busy": "true",
1080
+ "data-loading": ""
1081
+ } : {},
1082
+ ...hasChildren ? { "data-expanded": isExpanded ? "true" : "false" } : {},
1083
+ ...isSelected ? { "data-selected": "" } : {},
1084
+ ...isTabStop ? { "data-current": "" } : {},
1085
+ ...checked === true ? { "data-checked": "" } : checked === "mixed" ? { "data-indeterminate": "" } : {},
1086
+ tabIndex: isTabStop ? 0 : -1,
1087
+ ...rest,
1088
+ onClick: (event) => {
1089
+ onClick?.(event);
1090
+ const el = event.currentTarget;
1091
+ if (!(event.target.closest("[role=\"treeitem\"]") === el) || event.defaultPrevented || partPresses.has(event.nativeEvent) || !ctx || itemId === "") return;
1092
+ ctx.actions.press(itemId, el, event.nativeEvent);
1093
+ },
1094
+ onFocus: (event) => {
1095
+ onFocus?.(event);
1096
+ if (event.target === event.currentTarget && itemId !== "") ctx?.actions.focused(itemId);
1097
+ },
1098
+ ref: rowRef,
1099
+ style: {
1100
+ "--tree-level": level,
1101
+ ...style
1102
+ }
1103
+ }, children));
1104
+ }
1105
+ function TreeItemIndicator({ children, onClick, ...props }) {
1106
+ const item = useContext(TreeRowItemContext);
1107
+ const tree = useContext(TreeCompoundContext);
1108
+ const state = {
1109
+ expanded: Boolean(item?.branch && item.expanded),
1110
+ disabled: Boolean(item?.disabled),
1111
+ loading: Boolean(item?.id && tree?.loading.has(item.id)),
1112
+ failed: Boolean(item?.id && tree?.failed.has(item.id))
1113
+ };
1114
+ const content = typeof children === "function" ? children(state) : children;
1115
+ return createElement("span", {
1116
+ "data-slot": "tree-indicator",
1117
+ "data-part": "indicator",
1118
+ "aria-hidden": "true",
1119
+ ...state.expanded ? { "data-expanded": "" } : {},
1120
+ ...state.disabled ? { "data-disabled": "" } : {},
1121
+ ...state.loading ? { "data-loading": "" } : {},
1122
+ ...state.failed ? { "data-failed": "" } : {},
1123
+ ...props,
1124
+ onClick: (event) => {
1125
+ onClick?.(event);
1126
+ if (event.defaultPrevented || !item?.branch || !tree || !item.id) return;
1127
+ tree.actions.pressIndicator(item.id, item.row(), event.nativeEvent);
1128
+ }
1129
+ }, content);
1130
+ }
1131
+ /** The row's checkbox. Hidden from screen readers, which hear the row's `aria-checked`. */
1132
+ function TreeItemCheckbox({ onClick, ...props }) {
1133
+ const tree = useContext(TreeCompoundContext);
1134
+ const item = useContext(TreeRowItemContext);
1135
+ const checked = item?.checked ?? false;
1136
+ return createElement("span", {
1137
+ "data-slot": "tree-checkbox",
1138
+ "data-part": "checkbox",
1139
+ "aria-hidden": "true",
1140
+ ...checked === true ? { "data-checked": "" } : checked === "mixed" ? { "data-indeterminate": "" } : {},
1141
+ ...item?.disabled ? { "data-disabled": "" } : {},
1142
+ ...props,
1143
+ onClick: (event) => {
1144
+ onClick?.(event);
1145
+ if (event.defaultPrevented || !tree || !item?.id) return;
1146
+ tree.actions.pressCheckbox(item.id, item.row(), event.nativeEvent);
1147
+ }
1148
+ });
1149
+ }
1150
+ /** The row's text, which names it. Render it as a link to make the row one. */
1151
+ function TreeItemLabel({ children, render, ref, ...rest }) {
1152
+ const ctx = useContext(TreeCompoundContext);
1153
+ const item = useContext(TreeRowItemContext);
1154
+ const selected = item?.selected ?? false;
1155
+ const expanded = item?.expanded ?? false;
1156
+ const branch = item?.branch ?? false;
1157
+ const disabled = item?.disabled ?? false;
1158
+ const current = Boolean(item && ctx?.tabStop === item.id);
1159
+ const state = {
1160
+ pending: Boolean(item?.id && ctx?.loading.has(item.id)),
1161
+ selected,
1162
+ expanded
1163
+ };
1164
+ const setLabelled = item?.setLabelled;
1165
+ useIsomorphicLayoutEffect(() => {
1166
+ setLabelled?.(true);
1167
+ return () => setLabelled?.(false);
1168
+ }, [setLabelled]);
1169
+ const own = useRef(null);
1170
+ useIsomorphicLayoutEffect(() => {
1171
+ const el = own.current;
1172
+ if (el?.matches("a[href]") && !el.hasAttribute("tabindex")) el.tabIndex = -1;
1173
+ });
1174
+ const mergedRef = useMemo(() => ref ? mergeRefs(own, ref) : own, [ref]);
1175
+ const resolvedChildren = typeof children === "function" ? children(state) : children;
1176
+ return renderElement("span", {
1177
+ "data-slot": "tree-label",
1178
+ "data-part": "label",
1179
+ ...item ? { id: item.labelId } : {},
1180
+ ...branch ? { "data-branch": "" } : {},
1181
+ ...selected ? { "data-selected": "" } : {},
1182
+ ...branch && expanded ? { "data-expanded": "" } : {},
1183
+ ...current ? { "data-current": "" } : {},
1184
+ ...disabled ? { "data-disabled": "" } : {},
1185
+ ...rest,
1186
+ ref: mergedRef,
1187
+ children: resolvedChildren
1188
+ }, render, state);
1189
+ }
1190
+ export { Tree, TreeGroup, TreeItem, TreeItemCheckbox, TreeItemIndicator, TreeItemLabel, createTreeController, treeFromPaths, visibleTreeRows };