@midas-ds/components 10.1.1 → 10.3.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 (383) hide show
  1. package/AccordionItem-BGWiWjxA.cjs +1 -0
  2. package/AccordionItem-ChHpW8EW.js +320 -0
  3. package/BadgeContainer-DM8TdyMT.js +37 -0
  4. package/BadgeContainer-I1XA3OCl.cjs +1 -0
  5. package/Breadcrumbs-CwDUNIqF.js +250 -0
  6. package/Breadcrumbs-DtjJ1UmU.cjs +1 -0
  7. package/Button-BoJl6JGM.cjs +1 -0
  8. package/Button-Csih3v23.js +38 -0
  9. package/Button-DjBChs7s.js +340 -0
  10. package/Button-htW9qIsS.cjs +1 -0
  11. package/Button.module-DEQtBYe5.cjs +1 -0
  12. package/Button.module-tti8HGxs.js +14 -0
  13. package/ButtonGroup-DUqW5dzM.cjs +1 -0
  14. package/ButtonGroup-DvVvear6.js +22 -0
  15. package/CHANGELOG.md +68 -0
  16. package/Card-0G0mj9q5.cjs +1 -0
  17. package/Card-yrtGzt70.js +131 -0
  18. package/CharacterCounter-BL_nZHya.js +22 -0
  19. package/CharacterCounter-CHcTDHO-.cjs +1 -0
  20. package/Checkbox-5HINZdGu.js +263 -0
  21. package/Checkbox-DqcPg5hz.cjs +1 -0
  22. package/CheckboxGroup-BBrSMuDY.cjs +1 -0
  23. package/CheckboxGroup-CLgixk2p.js +243 -0
  24. package/Collection-BIDsXNhi.cjs +1 -0
  25. package/Collection-Brgjpkne.js +576 -0
  26. package/ColorSchemeSwitch-BpzQ7g0b.js +106 -0
  27. package/ColorSchemeSwitch-C-qWuqkU.cjs +16 -0
  28. package/ComboBox-CVDyp2a-.js +1379 -0
  29. package/ComboBox-CWJUg9Xx.cjs +1 -0
  30. package/DateField-DeDhiYnW.cjs +1 -0
  31. package/DateField-DhU3q-rG.js +47 -0
  32. package/DateInputDivider-ADvOavHw.cjs +1 -0
  33. package/DateInputDivider-CF4xWsMT.js +2904 -0
  34. package/DateRangePicker-BsAHhy99.cjs +6 -0
  35. package/DateRangePicker-ziD1_k1W.js +881 -0
  36. package/Dialog-B8GTYbvu.cjs +1 -0
  37. package/Dialog-BOrYdX50.cjs +1 -0
  38. package/Dialog-CXNu48AC.js +208 -0
  39. package/Dialog-D14MbJ7o.js +1633 -0
  40. package/DragAndDrop-DNth776R.cjs +1 -0
  41. package/DragAndDrop-o3ruz_SR.js +60 -0
  42. package/Dropdown-CJ6My6EI.cjs +6 -0
  43. package/Dropdown-Df58j43I.js +84 -0
  44. package/FieldError-CAcjosk_.js +46 -0
  45. package/FieldError-CKBb2-mp.cjs +1 -0
  46. package/FileUpload-CxCOtyB9.cjs +2 -0
  47. package/FileUpload-D6qoEAjn.js +2373 -0
  48. package/FocusScope-5c9SVBcR.cjs +1 -0
  49. package/FocusScope-CxkURfoc.js +625 -0
  50. package/Form-BuOomA4T.cjs +1 -0
  51. package/Form-CXcEMuBf.js +5 -0
  52. package/Grid--OhtgCo6.js +27 -0
  53. package/Grid-DVQtOcu9.cjs +1 -0
  54. package/GridItem-DlbSdRmB.js +246 -0
  55. package/GridItem-XgHmZWXY.cjs +1 -0
  56. package/Group-B6EslsHZ.js +44 -0
  57. package/Group-CgiqQHH1.cjs +1 -0
  58. package/Heading-BFtiin0g.js +46 -0
  59. package/Heading-mHhCbGjY.cjs +1 -0
  60. package/Hidden-BxRZGdEW.cjs +1 -0
  61. package/Hidden-C9KWUR7b.js +34 -0
  62. package/InfoBanner-BLM-TJJ6.js +83 -0
  63. package/InfoBanner-C2kTIsrB.cjs +1 -0
  64. package/Input-BTzwcf72.js +41 -0
  65. package/Input-DKSAYvsw.cjs +1 -0
  66. package/Label-7Ybb99CE.cjs +1 -0
  67. package/Label-BwJrdqEE.js +70 -0
  68. package/Layout-1g6bMH62.cjs +16 -0
  69. package/Layout-Ey8flY7E.js +468 -0
  70. package/Link-B88l_oaE.cjs +6 -0
  71. package/Link-BQhauBuw.cjs +1 -0
  72. package/Link-DX5BbBnn.js +59 -0
  73. package/Link-yNO2-sqx.js +71 -0
  74. package/LinkButton-CBpGLETx.cjs +6 -0
  75. package/LinkButton-o6uS1XsR.js +69 -0
  76. package/ListBox-DP9M4H6R.cjs +1 -0
  77. package/ListBox-GnVK_Pdq.js +529 -0
  78. package/ListBoxButton-DPBrtXyv.cjs +1 -0
  79. package/ListBoxButton-D_J3jlP0.js +15 -0
  80. package/ListBoxSection-BGaigBnG.cjs +1 -0
  81. package/ListBoxSection-C0BGnpB4.js +1058 -0
  82. package/ListKeyboardDelegate-DNI8GQtX.js +167 -0
  83. package/ListKeyboardDelegate-DTg9h4v6.cjs +1 -0
  84. package/Logo-BIrOEINM.js +133 -0
  85. package/Logo-DT2_2O43.cjs +1 -0
  86. package/OverlayArrow-CDLXPTew.js +506 -0
  87. package/OverlayArrow-D75k-EMl.cjs +1 -0
  88. package/Popover-BGGXeD54.js +38 -0
  89. package/Popover-CqNWzPf-.cjs +1 -0
  90. package/ProgressBar-DMSg-Prr.js +53 -0
  91. package/ProgressBar-Jbg28j2a.cjs +1 -0
  92. package/RSPContexts-BW2SEIqe.js +11 -0
  93. package/RSPContexts-D8hmBfGm.cjs +1 -0
  94. package/Radio-BwqrdhQE.cjs +1 -0
  95. package/Radio-Cz29wPXd.js +311 -0
  96. package/RangeCalendar-BehUaydF.cjs +11 -0
  97. package/RangeCalendar-RAlAHlNL.js +1683 -0
  98. package/SearchField-CxMwDeUM.cjs +6 -0
  99. package/SearchField-IlvZ3Kh6.js +362 -0
  100. package/Select-2q1iSzAX.cjs +1 -0
  101. package/Select-BVQZtoi9.js +646 -0
  102. package/SelectionManager-B4ORduja.js +1032 -0
  103. package/SelectionManager-CwYux2h3.cjs +1 -0
  104. package/Separator-Cu9fYKUM.js +59 -0
  105. package/Separator-DECIYLtZ.cjs +1 -0
  106. package/Skeleton-BAwbfKBW.cjs +1 -0
  107. package/Skeleton-BePDRmrO.js +40 -0
  108. package/Spinner-D31SXm-U.js +41 -0
  109. package/Spinner-P35rvvsl.cjs +6 -0
  110. package/Table-B40CGLT-.cjs +16 -0
  111. package/Table-F4oYBtUM.js +2447 -0
  112. package/Tabs-B4oZJkZG.js +404 -0
  113. package/Tabs-DA2qXhzb.cjs +1 -0
  114. package/Tag-DPAGmcMK.cjs +1 -0
  115. package/Tag-Du7GvSv2.js +745 -0
  116. package/Text-3MNwRMpI.cjs +1 -0
  117. package/Text-B2K-BJKQ.cjs +1 -0
  118. package/Text-BoXuUVVH.js +15 -0
  119. package/Text-jWWg0B20.js +32 -0
  120. package/TextArea-C7JZ_pQd.cjs +1 -0
  121. package/TextArea-XeBCSyzl.js +191 -0
  122. package/TextField-BgNdhZi_.cjs +1 -0
  123. package/TextField-C-hTPukq.js +119 -0
  124. package/TextField.module-BcpPBWnD.js +13 -0
  125. package/TextField.module-Dw5Rtn9y.cjs +1 -0
  126. package/Toast-AbDA1BOs.cjs +1 -0
  127. package/Toast-Btg21Xge.js +989 -0
  128. package/ToggleButtonGroup-B5yz1tm2.js +210 -0
  129. package/ToggleButtonGroup-BFDoj0P6.cjs +1 -0
  130. package/Tooltip-CMLs7WMw.js +283 -0
  131. package/Tooltip-DeBuBKhS.cjs +1 -0
  132. package/VisuallyHidden-CLWHbz2n.cjs +1 -0
  133. package/VisuallyHidden-ZCYf65q4.js +40 -0
  134. package/accordion/index.cjs +1 -0
  135. package/accordion/index.js +5 -0
  136. package/arrow-right-Dg8sttFO.js +14 -0
  137. package/arrow-right-QJ2gXPKQ.cjs +6 -0
  138. package/assets/AccordionItem.css +1 -0
  139. package/assets/BadgeContainer.css +1 -0
  140. package/assets/Breadcrumbs.css +1 -0
  141. package/assets/Button.css +1 -0
  142. package/assets/ButtonGroup.css +1 -0
  143. package/assets/Card.css +1 -0
  144. package/assets/CharacterCounter.css +1 -0
  145. package/assets/Checkbox.css +1 -0
  146. package/assets/ColorSchemeSwitch.css +1 -0
  147. package/assets/ComboBox.css +1 -0
  148. package/assets/DateField.css +1 -0
  149. package/assets/DateInputDivider.css +1 -0
  150. package/assets/DateRangePicker.css +1 -0
  151. package/assets/Dialog.css +1 -0
  152. package/assets/Dropdown.css +1 -0
  153. package/assets/FieldError.css +1 -0
  154. package/assets/FileUpload.css +1 -0
  155. package/assets/GridItem.css +1 -0
  156. package/assets/Heading.css +1 -0
  157. package/assets/InfoBanner.css +1 -0
  158. package/assets/Label.css +1 -0
  159. package/assets/Layout.css +1 -0
  160. package/assets/Link.css +1 -0
  161. package/assets/LinkButton.css +1 -0
  162. package/assets/ListBoxSection.css +1 -0
  163. package/assets/Logo.css +1 -0
  164. package/assets/Popover.css +1 -0
  165. package/assets/ProgressBar.css +1 -0
  166. package/assets/Radio.css +1 -0
  167. package/assets/RangeCalendar.css +1 -0
  168. package/assets/SearchField.css +1 -0
  169. package/assets/Select.css +1 -0
  170. package/assets/Skeleton.css +1 -0
  171. package/assets/Spinner.css +1 -0
  172. package/assets/Table.css +1 -0
  173. package/assets/Tabs.css +1 -0
  174. package/assets/Tag.css +1 -0
  175. package/assets/Text.css +1 -0
  176. package/assets/TextField.css +1 -0
  177. package/assets/Toast.css +1 -0
  178. package/assets/ToggleButtonGroup.css +1 -0
  179. package/assets/Tooltip.css +1 -0
  180. package/badge/index.cjs +1 -0
  181. package/badge/index.js +5 -0
  182. package/breadcrumbs/index.cjs +1 -0
  183. package/breadcrumbs/index.js +4 -0
  184. package/button/index.cjs +1 -0
  185. package/button/index.js +6 -0
  186. package/calendar/CalendarHeader.d.ts +2 -1
  187. package/calendar/index.cjs +1 -0
  188. package/calendar/index.js +5 -0
  189. package/card/index.cjs +1 -0
  190. package/card/index.js +10 -0
  191. package/character-counter/index.cjs +1 -0
  192. package/character-counter/index.js +4 -0
  193. package/check-CLF6Yxza.js +11 -0
  194. package/check-D_KoootC.cjs +6 -0
  195. package/checkbox/Checkbox.d.ts +2 -2
  196. package/checkbox/CheckboxGroup.d.ts +8 -8
  197. package/checkbox/CheckboxGroupFieldError.d.ts +8 -0
  198. package/checkbox/CheckboxGroupItem.d.ts +3 -0
  199. package/checkbox/CheckboxInner.d.ts +2 -0
  200. package/checkbox/SingleCheckbox.d.ts +3 -0
  201. package/checkbox/context.d.ts +3 -0
  202. package/checkbox/index.cjs +1 -0
  203. package/checkbox/index.d.ts +2 -1
  204. package/checkbox/index.js +6 -0
  205. package/checkbox/intl/translations.json.d.ts +35 -0
  206. package/checkbox/types.d.ts +14 -0
  207. package/checkbox/useSelectAll.d.ts +7 -0
  208. package/chevron-down-Cd1bkzXT.js +13 -0
  209. package/chevron-down-jl83cllc.cjs +6 -0
  210. package/circle-check-B9HYcH7Z.js +26 -0
  211. package/circle-check-BGo8gML8.cjs +11 -0
  212. package/clsx-C11secjj.cjs +1 -0
  213. package/clsx-OuTLNxxd.js +16 -0
  214. package/color-scheme-switch/index.cjs +1 -0
  215. package/color-scheme-switch/index.js +4 -0
  216. package/combobox/ComboBox.d.ts +3 -1
  217. package/combobox/index.cjs +1 -0
  218. package/combobox/index.js +7 -0
  219. package/common/types.d.ts +2 -0
  220. package/context-C81gPYvC.js +80 -0
  221. package/context-DjwhtgxQ.cjs +1 -0
  222. package/createLucideIcon-Cg_wkoIA.cjs +21 -0
  223. package/createLucideIcon-DeWljiyi.js +79 -0
  224. package/date-field/DateField.d.ts +3 -0
  225. package/date-field/index.cjs +1 -0
  226. package/date-field/index.js +8 -0
  227. package/date-picker/DatePicker.d.ts +3 -0
  228. package/date-picker/DateRangePicker.d.ts +3 -0
  229. package/date-picker/index.cjs +1 -0
  230. package/date-picker/index.js +5 -0
  231. package/dropdown/index.cjs +1 -0
  232. package/dropdown/index.js +5 -0
  233. package/field-error/FieldError.d.ts +4 -1
  234. package/field-error/index.cjs +1 -0
  235. package/field-error/index.js +4 -0
  236. package/file-upload/FileUpload.d.ts +3 -0
  237. package/file-upload/index.cjs +1 -0
  238. package/file-upload/index.js +4 -0
  239. package/filterDOMProps-BS2lrgFA.cjs +1 -0
  240. package/filterDOMProps-D6KHYVBX.js +24 -0
  241. package/getScrollParent-BhFcYrwL.js +9 -0
  242. package/getScrollParent-DDJu9WHU.cjs +1 -0
  243. package/grid/Grid.d.ts +15 -4
  244. package/grid/GridItem.d.ts +31 -2
  245. package/grid/index.cjs +1 -0
  246. package/grid/index.d.ts +2 -2
  247. package/grid/index.js +8 -0
  248. package/heading/index.cjs +1 -0
  249. package/heading/index.js +4 -0
  250. package/index-CGRFP4CC.js +120 -0
  251. package/index-Dsz3aiWt.cjs +17 -0
  252. package/index.cjs +1 -169
  253. package/index.d.ts +1 -1
  254. package/index.js +129 -29979
  255. package/inertValue-B3AFhVG4.cjs +1 -0
  256. package/inertValue-B7loUihk.js +8 -0
  257. package/info-BZwphdye.js +15 -0
  258. package/info-CIEIENo6.cjs +6 -0
  259. package/info-banner/index.cjs +1 -0
  260. package/info-banner/index.js +4 -0
  261. package/label/InfoPopover.d.ts +9 -0
  262. package/label/LabelWrapper.d.ts +11 -0
  263. package/label/index.cjs +1 -0
  264. package/label/index.d.ts +1 -0
  265. package/label/index.js +4 -0
  266. package/layout/index.cjs +1 -0
  267. package/layout/index.js +8 -0
  268. package/link/index.cjs +1 -0
  269. package/link/index.js +6 -0
  270. package/link-button/index.cjs +1 -0
  271. package/link-button/index.js +6 -0
  272. package/list-box/index.cjs +1 -0
  273. package/list-box/index.js +9 -0
  274. package/logo/index.cjs +1 -0
  275. package/logo/index.js +4 -0
  276. package/modal/index.cjs +1 -0
  277. package/modal/index.js +6 -0
  278. package/number-BE8InLgI.js +6 -0
  279. package/number-E0x3H9cL.cjs +1 -0
  280. package/package.json +4 -4
  281. package/popover/Popover.d.ts +7 -0
  282. package/popover/index.cjs +1 -0
  283. package/popover/index.d.ts +1 -0
  284. package/popover/index.js +4 -0
  285. package/progress-bar/index.cjs +1 -0
  286. package/progress-bar/index.js +4 -0
  287. package/radio/Radio.d.ts +3 -0
  288. package/radio/index.cjs +1 -0
  289. package/radio/index.js +5 -0
  290. package/scrollIntoView-C8doLzDd.cjs +1 -0
  291. package/scrollIntoView-Hwb_aaNf.js +87 -0
  292. package/search-field/index.cjs +1 -0
  293. package/search-field/index.js +4 -0
  294. package/select/index.cjs +1 -0
  295. package/select/index.js +4 -0
  296. package/skeleton/Skeleton.d.ts +5 -0
  297. package/skeleton/index.cjs +1 -0
  298. package/skeleton/index.js +4 -0
  299. package/spinner/index.cjs +1 -0
  300. package/spinner/index.js +4 -0
  301. package/square-arrow-out-up-right-BkyqV2PN.js +15 -0
  302. package/square-arrow-out-up-right-V4Gd08uI.cjs +6 -0
  303. package/table/Table.d.ts +7 -1
  304. package/table/index.cjs +1 -0
  305. package/table/index.js +9 -0
  306. package/tabs/index.cjs +1 -0
  307. package/tabs/index.js +4 -0
  308. package/tag/index.cjs +1 -0
  309. package/tag/index.js +5 -0
  310. package/text/index.cjs +1 -0
  311. package/text/index.js +4 -0
  312. package/textfield/TextFieldBase.d.ts +2 -0
  313. package/textfield/index.cjs +1 -0
  314. package/textfield/index.js +7 -0
  315. package/theme/index.cjs +1 -0
  316. package/theme/index.d.ts +4 -0
  317. package/{theme.js → theme/index.js} +2 -2
  318. package/theme/tokens.d.ts +10 -0
  319. package/toast/index.cjs +1 -0
  320. package/toast/index.js +9 -0
  321. package/toggle-button/index.cjs +1 -0
  322. package/toggle-button/index.js +5 -0
  323. package/tokens-p6pg1Cea.cjs +1 -0
  324. package/{tokens-C0U7hdoO.js → tokens-xp-7KMK7.js} +18 -8
  325. package/tooltip/index.cjs +1 -0
  326. package/tooltip/index.js +5 -0
  327. package/triangle-alert-DJW8U7jL.cjs +6 -0
  328. package/triangle-alert-wxyxspAl.js +21 -0
  329. package/useButton-B8dB9sot.js +47 -0
  330. package/useButton-cpNi-fY4.cjs +1 -0
  331. package/useControlledState-D0L6S_5r.cjs +1 -0
  332. package/useControlledState-u436Wbp1.js +30 -0
  333. package/useDateFormatter-CnxoJ4jF.cjs +1 -0
  334. package/useDateFormatter-EHm4auIg.js +1571 -0
  335. package/useEvent-DxBxMX2V.cjs +1 -0
  336. package/useEvent-IsD2Awnh.js +21 -0
  337. package/useField-CXKYU74k.cjs +1 -0
  338. package/useField-DvpGZkw_.js +35 -0
  339. package/useFilter-BTgDWHVx.cjs +1 -0
  340. package/useFilter-CUq74PQ2.js +35 -0
  341. package/useFocusRing-CbImDrwF.cjs +1 -0
  342. package/useFocusRing-XnR3cZjO.js +82 -0
  343. package/useFocusable-C8uh8K4g.js +125 -0
  344. package/useFocusable-NUVSFcRC.cjs +1 -0
  345. package/useFormValidation-BIGzfO9h.js +215 -0
  346. package/useFormValidation-ClximP89.cjs +1 -0
  347. package/useHasTabbableChild-C-1mZUQe.js +34 -0
  348. package/useHasTabbableChild-DCBTulUQ.cjs +1 -0
  349. package/useHighlightSelectionDescription-CnBDT86u.js +567 -0
  350. package/useHighlightSelectionDescription-CzYucm61.cjs +1 -0
  351. package/useHover-DjIHtjGN.js +490 -0
  352. package/useHover-_mv5J4_q.cjs +1 -0
  353. package/useLabels-BDwkBYbE.js +17 -0
  354. package/useLabels-BLOfc6Y-.cjs +1 -0
  355. package/useListState-Bx8u4IFG.cjs +1 -0
  356. package/useListState-CrZFZffI.js +132 -0
  357. package/useLocalizedStringFormatter-BKoxGZf1.js +96 -0
  358. package/useLocalizedStringFormatter-BsxLt89S.cjs +1 -0
  359. package/useLocalizedStringFormatter-D3JQyjb4.js +21 -0
  360. package/useLocalizedStringFormatter-ioacM-Yt.cjs +1 -0
  361. package/useObserveElement-BdI4zgd7.js +27 -0
  362. package/useObserveElement-MhzEsCkX.cjs +1 -0
  363. package/usePress-0AjDbW9R.cjs +7 -0
  364. package/usePress-CNjmDzap.js +542 -0
  365. package/useSingleSelectListState-0AGHxvy3.js +34 -0
  366. package/useSingleSelectListState-Cl3KV5E1.cjs +1 -0
  367. package/useTextField--czJtyNd.cjs +1 -0
  368. package/useTextField-Cw-33OP_.js +86 -0
  369. package/useToggleState-Bz5rAf4C.js +18 -0
  370. package/useToggleState-DoIkSQdj.cjs +1 -0
  371. package/useUpdateEffect-C5YQs_1w.cjs +1 -0
  372. package/useUpdateEffect-CCDx8D4X.js +13 -0
  373. package/utils-BNtZbAib.cjs +1 -0
  374. package/utils-DIMfEPAt.js +308 -0
  375. package/x-H8Zrx8-x.cjs +6 -0
  376. package/x-JK7i-TQC.js +14 -0
  377. package/flex/Flex.d.ts +0 -17
  378. package/flex/FlexItem.d.ts +0 -15
  379. package/flex/index.d.ts +0 -2
  380. package/index.css +0 -1
  381. package/theme.cjs +0 -1
  382. package/tokens-COoF1t17.cjs +0 -1
  383. /package/{global.css → assets/global.css} +0 -0
@@ -0,0 +1,1032 @@
1
+ import V, { useRef as S, useEffect as q, useMemo as j, useState as se } from "react";
2
+ import { $ as ye, c as Y, e as we, f as he } from "./utils-DIMfEPAt.js";
3
+ import { t as ke, b as Ae, d as xe, v as ue, e as Ie, C as Ce, r as pe } from "./useHover-DjIHtjGN.js";
4
+ import { a as Fe, b as Pe, e as Me } from "./usePress-CNjmDzap.js";
5
+ import { $ as J } from "./useEvent-IsD2Awnh.js";
6
+ import { a as Be, b as Re, c as ve } from "./scrollIntoView-Hwb_aaNf.js";
7
+ import { flushSync as Le } from "react-dom";
8
+ import { a as ae } from "./useFocusable-C8uh8K4g.js";
9
+ import { $ as Oe } from "./FocusScope-CxkURfoc.js";
10
+ import { $ as ze } from "./context-C81gPYvC.js";
11
+ import { $ as Ue } from "./useControlledState-u436Wbp1.js";
12
+ function be(n, e) {
13
+ const t = S(!0), l = S(null);
14
+ ye(() => (t.current = !0, () => {
15
+ t.current = !1;
16
+ }), []), ye(() => {
17
+ t.current ? t.current = !1 : (!l.current || e.some((i, c) => !Object.is(i, l[c]))) && n(), l.current = e;
18
+ }, e);
19
+ }
20
+ const Ve = "react-aria-clear-focus", He = "react-aria-focus";
21
+ function H(n) {
22
+ return ke() ? n.metaKey : n.ctrlKey;
23
+ }
24
+ const We = 500;
25
+ function Ge(n) {
26
+ let { isDisabled: e, onLongPressStart: t, onLongPressEnd: l, onLongPress: i, threshold: c = We, accessibilityDescription: r } = n;
27
+ const f = S(void 0);
28
+ let { addGlobalListener: a, removeGlobalListener: g } = Ae(), { pressProps: E } = Fe({
29
+ isDisabled: e,
30
+ onPressStart(v) {
31
+ if (v.continuePropagation(), (v.pointerType === "mouse" || v.pointerType === "touch") && (t && t({
32
+ ...v,
33
+ type: "longpressstart"
34
+ }), f.current = setTimeout(() => {
35
+ v.target.dispatchEvent(new PointerEvent("pointercancel", {
36
+ bubbles: !0
37
+ })), xe(v.target).activeElement !== v.target && ue(v.target), i && i({
38
+ ...v,
39
+ type: "longpress"
40
+ }), f.current = void 0;
41
+ }, c), v.pointerType === "touch")) {
42
+ let $ = (b) => {
43
+ b.preventDefault();
44
+ };
45
+ a(v.target, "contextmenu", $, {
46
+ once: !0
47
+ }), a(window, "pointerup", () => {
48
+ setTimeout(() => {
49
+ g(v.target, "contextmenu", $);
50
+ }, 30);
51
+ }, {
52
+ once: !0
53
+ });
54
+ }
55
+ },
56
+ onPressEnd(v) {
57
+ f.current && clearTimeout(f.current), l && (v.pointerType === "mouse" || v.pointerType === "touch") && l({
58
+ ...v,
59
+ type: "longpressend"
60
+ });
61
+ }
62
+ }), m = Be(i && !e ? r : void 0);
63
+ return {
64
+ longPressProps: Y(E, m)
65
+ };
66
+ }
67
+ function De(n) {
68
+ let e = Ye(xe(n));
69
+ e !== n && (e && qe(e, n), n && je(n, e));
70
+ }
71
+ function qe(n, e) {
72
+ n.dispatchEvent(new FocusEvent("blur", {
73
+ relatedTarget: e
74
+ })), n.dispatchEvent(new FocusEvent("focusout", {
75
+ bubbles: !0,
76
+ relatedTarget: e
77
+ }));
78
+ }
79
+ function je(n, e) {
80
+ n.dispatchEvent(new FocusEvent("focus", {
81
+ relatedTarget: e
82
+ })), n.dispatchEvent(new FocusEvent("focusin", {
83
+ bubbles: !0,
84
+ relatedTarget: e
85
+ }));
86
+ }
87
+ function Ye(n) {
88
+ let e = Ie(n), t = e == null ? void 0 : e.getAttribute("aria-activedescendant");
89
+ return t && n.getElementById(t) || e;
90
+ }
91
+ function fe(n) {
92
+ return Ce() ? n.altKey : n.ctrlKey;
93
+ }
94
+ function re(n, e) {
95
+ var t, l;
96
+ let i = `[data-key="${CSS.escape(String(e))}"]`, c = (t = n.current) === null || t === void 0 ? void 0 : t.dataset.collection;
97
+ return c && (i = `[data-collection="${CSS.escape(c)}"]${i}`), (l = n.current) === null || l === void 0 ? void 0 : l.querySelector(i);
98
+ }
99
+ const Te = /* @__PURE__ */ new WeakMap();
100
+ function Ze(n) {
101
+ let e = we();
102
+ return Te.set(n, e), e;
103
+ }
104
+ function Je(n) {
105
+ return Te.get(n);
106
+ }
107
+ const Qe = 1e3;
108
+ function Xe(n) {
109
+ let { keyboardDelegate: e, selectionManager: t, onTypeSelect: l } = n, i = S({
110
+ search: "",
111
+ timeout: void 0
112
+ }).current, c = (r) => {
113
+ let f = Ne(r.key);
114
+ if (!(!f || r.ctrlKey || r.metaKey || !r.currentTarget.contains(r.target))) {
115
+ if (f === " " && i.search.trim().length > 0 && (r.preventDefault(), "continuePropagation" in r || r.stopPropagation()), i.search += f, e.getKeyForSearch != null) {
116
+ let a = e.getKeyForSearch(i.search, t.focusedKey);
117
+ a == null && (a = e.getKeyForSearch(i.search)), a != null && (t.setFocusedKey(a), l && l(a));
118
+ }
119
+ clearTimeout(i.timeout), i.timeout = setTimeout(() => {
120
+ i.search = "";
121
+ }, Qe);
122
+ }
123
+ };
124
+ return {
125
+ typeSelectProps: {
126
+ // Using a capturing listener to catch the keydown event before
127
+ // other hooks in order to handle the Spacebar event.
128
+ onKeyDownCapture: e.getKeyForSearch ? c : void 0
129
+ }
130
+ };
131
+ }
132
+ function Ne(n) {
133
+ return n.length === 1 || !/^[A-Z]/i.test(n) ? n : "";
134
+ }
135
+ function vt(n) {
136
+ let { selectionManager: e, keyboardDelegate: t, ref: l, autoFocus: i = !1, shouldFocusWrap: c = !1, disallowEmptySelection: r = !1, disallowSelectAll: f = !1, escapeKeyBehavior: a = "clearSelection", selectOnFocus: g = e.selectionBehavior === "replace", disallowTypeAhead: E = !1, shouldUseVirtualFocus: m, allowsTabNavigation: v = !1, isVirtualized: $, scrollRef: b = l, linkBehavior: k = "action" } = n, { direction: y } = ze(), d = Pe(), K = (o) => {
137
+ var s;
138
+ if (o.altKey && o.key === "Tab" && o.preventDefault(), !(!((s = l.current) === null || s === void 0) && s.contains(o.target))) return;
139
+ const p = (u, z) => {
140
+ if (u != null) {
141
+ if (e.isLink(u) && k === "selection" && g && !fe(o)) {
142
+ Le(() => {
143
+ e.setFocusedKey(u, z);
144
+ });
145
+ let U = re(l, u), de = e.getItemProps(u);
146
+ U && d.open(U, o, de.href, de.routerOptions);
147
+ return;
148
+ }
149
+ if (e.setFocusedKey(u, z), e.isLink(u) && k === "override") return;
150
+ o.shiftKey && e.selectionMode === "multiple" ? e.extendSelection(u) : g && !fe(o) && e.replaceSelection(u);
151
+ }
152
+ };
153
+ switch (o.key) {
154
+ case "ArrowDown":
155
+ if (t.getKeyBelow) {
156
+ var x, T, D;
157
+ let u = e.focusedKey != null ? (x = t.getKeyBelow) === null || x === void 0 ? void 0 : x.call(t, e.focusedKey) : (T = t.getFirstKey) === null || T === void 0 ? void 0 : T.call(t);
158
+ u == null && c && (u = (D = t.getFirstKey) === null || D === void 0 ? void 0 : D.call(t, e.focusedKey)), u != null && (o.preventDefault(), p(u));
159
+ }
160
+ break;
161
+ case "ArrowUp":
162
+ if (t.getKeyAbove) {
163
+ var B, L, N;
164
+ let u = e.focusedKey != null ? (B = t.getKeyAbove) === null || B === void 0 ? void 0 : B.call(t, e.focusedKey) : (L = t.getLastKey) === null || L === void 0 ? void 0 : L.call(t);
165
+ u == null && c && (u = (N = t.getLastKey) === null || N === void 0 ? void 0 : N.call(t, e.focusedKey)), u != null && (o.preventDefault(), p(u));
166
+ }
167
+ break;
168
+ case "ArrowLeft":
169
+ if (t.getKeyLeftOf) {
170
+ var _, ee, te;
171
+ let u = e.focusedKey != null ? (_ = t.getKeyLeftOf) === null || _ === void 0 ? void 0 : _.call(t, e.focusedKey) : null;
172
+ u == null && c && (u = y === "rtl" ? (ee = t.getFirstKey) === null || ee === void 0 ? void 0 : ee.call(t, e.focusedKey) : (te = t.getLastKey) === null || te === void 0 ? void 0 : te.call(t, e.focusedKey)), u != null && (o.preventDefault(), p(u, y === "rtl" ? "first" : "last"));
173
+ }
174
+ break;
175
+ case "ArrowRight":
176
+ if (t.getKeyRightOf) {
177
+ var le, ie, ne;
178
+ let u = e.focusedKey != null ? (le = t.getKeyRightOf) === null || le === void 0 ? void 0 : le.call(t, e.focusedKey) : null;
179
+ u == null && c && (u = y === "rtl" ? (ie = t.getLastKey) === null || ie === void 0 ? void 0 : ie.call(t, e.focusedKey) : (ne = t.getFirstKey) === null || ne === void 0 ? void 0 : ne.call(t, e.focusedKey)), u != null && (o.preventDefault(), p(u, y === "rtl" ? "last" : "first"));
180
+ }
181
+ break;
182
+ case "Home":
183
+ if (t.getFirstKey) {
184
+ if (e.focusedKey === null && o.shiftKey) return;
185
+ o.preventDefault();
186
+ let u = t.getFirstKey(e.focusedKey, H(o));
187
+ e.setFocusedKey(u), u != null && (H(o) && o.shiftKey && e.selectionMode === "multiple" ? e.extendSelection(u) : g && e.replaceSelection(u));
188
+ }
189
+ break;
190
+ case "End":
191
+ if (t.getLastKey) {
192
+ if (e.focusedKey === null && o.shiftKey) return;
193
+ o.preventDefault();
194
+ let u = t.getLastKey(e.focusedKey, H(o));
195
+ e.setFocusedKey(u), u != null && (H(o) && o.shiftKey && e.selectionMode === "multiple" ? e.extendSelection(u) : g && e.replaceSelection(u));
196
+ }
197
+ break;
198
+ case "PageDown":
199
+ if (t.getKeyPageBelow && e.focusedKey != null) {
200
+ let u = t.getKeyPageBelow(e.focusedKey);
201
+ u != null && (o.preventDefault(), p(u));
202
+ }
203
+ break;
204
+ case "PageUp":
205
+ if (t.getKeyPageAbove && e.focusedKey != null) {
206
+ let u = t.getKeyPageAbove(e.focusedKey);
207
+ u != null && (o.preventDefault(), p(u));
208
+ }
209
+ break;
210
+ case "a":
211
+ H(o) && e.selectionMode === "multiple" && f !== !0 && (o.preventDefault(), e.selectAll());
212
+ break;
213
+ case "Escape":
214
+ a === "clearSelection" && !r && e.selectedKeys.size !== 0 && (o.stopPropagation(), o.preventDefault(), e.clearSelection());
215
+ break;
216
+ case "Tab":
217
+ if (!v) {
218
+ if (o.shiftKey) l.current.focus();
219
+ else {
220
+ let u = Oe(l.current, {
221
+ tabbable: !0
222
+ }), z, U;
223
+ do
224
+ U = u.lastChild(), U && (z = U);
225
+ while (U);
226
+ z && !z.contains(document.activeElement) && ue(z);
227
+ }
228
+ break;
229
+ }
230
+ }
231
+ }, h = S({
232
+ top: 0,
233
+ left: 0
234
+ });
235
+ J(b, "scroll", $ ? void 0 : () => {
236
+ var o, s, p, x;
237
+ h.current = {
238
+ top: (p = (o = b.current) === null || o === void 0 ? void 0 : o.scrollTop) !== null && p !== void 0 ? p : 0,
239
+ left: (x = (s = b.current) === null || s === void 0 ? void 0 : s.scrollLeft) !== null && x !== void 0 ? x : 0
240
+ };
241
+ });
242
+ let w = (o) => {
243
+ if (e.isFocused) {
244
+ o.currentTarget.contains(o.target) || e.setFocused(!1);
245
+ return;
246
+ }
247
+ if (o.currentTarget.contains(o.target)) {
248
+ if (e.setFocused(!0), e.focusedKey == null) {
249
+ var s, p;
250
+ let D = (L) => {
251
+ L != null && (e.setFocusedKey(L), g && !e.isSelected(L) && e.replaceSelection(L));
252
+ }, B = o.relatedTarget;
253
+ var x, T;
254
+ B && o.currentTarget.compareDocumentPosition(B) & Node.DOCUMENT_POSITION_FOLLOWING ? D((x = e.lastSelectedKey) !== null && x !== void 0 ? x : (s = t.getLastKey) === null || s === void 0 ? void 0 : s.call(t)) : D((T = e.firstSelectedKey) !== null && T !== void 0 ? T : (p = t.getFirstKey) === null || p === void 0 ? void 0 : p.call(t));
255
+ } else !$ && b.current && (b.current.scrollTop = h.current.top, b.current.scrollLeft = h.current.left);
256
+ if (e.focusedKey != null && b.current) {
257
+ let D = re(l, e.focusedKey);
258
+ D instanceof HTMLElement && (!D.contains(document.activeElement) && !m && ue(D), pe() === "keyboard" && ve(D, {
259
+ containingElement: l.current
260
+ }));
261
+ }
262
+ }
263
+ }, A = (o) => {
264
+ o.currentTarget.contains(o.relatedTarget) || e.setFocused(!1);
265
+ }, I = S(!1);
266
+ J(l, He, m ? (o) => {
267
+ let { detail: s } = o;
268
+ o.stopPropagation(), e.setFocused(!0), (s == null ? void 0 : s.focusStrategy) === "first" && (I.current = !0);
269
+ } : void 0);
270
+ let M = he(() => {
271
+ var o, s;
272
+ let p = (s = (o = t.getFirstKey) === null || o === void 0 ? void 0 : o.call(t)) !== null && s !== void 0 ? s : null;
273
+ p == null ? (De(l.current), e.collection.size > 0 && (I.current = !1)) : (e.setFocusedKey(p), I.current = !1);
274
+ });
275
+ be(() => {
276
+ I.current && M();
277
+ }, [
278
+ e.collection,
279
+ M
280
+ ]);
281
+ let F = he(() => {
282
+ e.collection.size > 0 && (I.current = !1);
283
+ });
284
+ be(() => {
285
+ F();
286
+ }, [
287
+ e.focusedKey,
288
+ F
289
+ ]), J(l, Ve, m ? (o) => {
290
+ var s;
291
+ o.stopPropagation(), e.setFocused(!1), !((s = o.detail) === null || s === void 0) && s.clearFocusKey && e.setFocusedKey(null);
292
+ } : void 0);
293
+ const W = S(i), R = S(!1);
294
+ q(() => {
295
+ if (W.current) {
296
+ var o, s;
297
+ let T = null;
298
+ var p;
299
+ i === "first" && (T = (p = (o = t.getFirstKey) === null || o === void 0 ? void 0 : o.call(t)) !== null && p !== void 0 ? p : null);
300
+ var x;
301
+ i === "last" && (T = (x = (s = t.getLastKey) === null || s === void 0 ? void 0 : s.call(t)) !== null && x !== void 0 ? x : null);
302
+ let D = e.selectedKeys;
303
+ if (D.size) {
304
+ for (let B of D) if (e.canSelectItem(B)) {
305
+ T = B;
306
+ break;
307
+ }
308
+ }
309
+ e.setFocused(!0), e.setFocusedKey(T), T == null && !m && l.current && ae(l.current), e.collection.size > 0 && (W.current = !1, R.current = !0);
310
+ }
311
+ });
312
+ let P = S(e.focusedKey), O = S(null);
313
+ q(() => {
314
+ if (e.isFocused && e.focusedKey != null && (e.focusedKey !== P.current || R.current) && b.current && l.current) {
315
+ let o = pe(), s = re(l, e.focusedKey);
316
+ if (!(s instanceof HTMLElement))
317
+ return;
318
+ (o === "keyboard" || R.current) && (O.current && cancelAnimationFrame(O.current), O.current = requestAnimationFrame(() => {
319
+ b.current && (Re(b.current, s), o !== "virtual" && ve(s, {
320
+ containingElement: l.current
321
+ }));
322
+ }));
323
+ }
324
+ !m && e.isFocused && e.focusedKey == null && P.current != null && l.current && ae(l.current), P.current = e.focusedKey, R.current = !1;
325
+ }), q(() => () => {
326
+ O.current && cancelAnimationFrame(O.current);
327
+ }, []), J(l, "react-aria-focus-scope-restore", (o) => {
328
+ o.preventDefault(), e.setFocused(!0);
329
+ });
330
+ let G = {
331
+ onKeyDown: K,
332
+ onFocus: w,
333
+ onBlur: A,
334
+ onMouseDown(o) {
335
+ b.current === o.target && o.preventDefault();
336
+ }
337
+ }, { typeSelectProps: Q } = Xe({
338
+ keyboardDelegate: t,
339
+ selectionManager: e
340
+ });
341
+ E || (G = Y(Q, G));
342
+ let Z;
343
+ m || (Z = e.focusedKey == null ? 0 : -1);
344
+ let X = Ze(e.collection);
345
+ return {
346
+ collectionProps: Y(G, {
347
+ tabIndex: Z,
348
+ "data-collection": X
349
+ })
350
+ };
351
+ }
352
+ function bt(n) {
353
+ let { id: e, selectionManager: t, key: l, ref: i, shouldSelectOnPressUp: c, shouldUseVirtualFocus: r, focus: f, isDisabled: a, onAction: g, allowsDifferentPressOrigin: E, linkBehavior: m = "action" } = n, v = Pe();
354
+ e = we(e);
355
+ let $ = (s) => {
356
+ if (s.pointerType === "keyboard" && fe(s)) t.toggleSelection(l);
357
+ else {
358
+ if (t.selectionMode === "none") return;
359
+ if (t.isLink(l)) {
360
+ if (m === "selection" && i.current) {
361
+ let p = t.getItemProps(l);
362
+ v.open(i.current, s, p.href, p.routerOptions), t.setSelectedKeys(t.selectedKeys);
363
+ return;
364
+ } else if (m === "override" || m === "none") return;
365
+ }
366
+ t.selectionMode === "single" ? t.isSelected(l) && !t.disallowEmptySelection ? t.toggleSelection(l) : t.replaceSelection(l) : s && s.shiftKey ? t.extendSelection(l) : t.selectionBehavior === "toggle" || s && (H(s) || s.pointerType === "touch" || s.pointerType === "virtual") ? t.toggleSelection(l) : t.replaceSelection(l);
367
+ }
368
+ };
369
+ q(() => {
370
+ l === t.focusedKey && t.isFocused && (r ? De(i.current) : f ? f() : document.activeElement !== i.current && i.current && ae(i.current));
371
+ }, [
372
+ i,
373
+ l,
374
+ t.focusedKey,
375
+ t.childFocusStrategy,
376
+ t.isFocused,
377
+ r
378
+ ]), a = a || t.isDisabled(l);
379
+ let b = {};
380
+ !r && !a ? b = {
381
+ tabIndex: l === t.focusedKey ? 0 : -1,
382
+ onFocus(s) {
383
+ s.target === i.current && t.setFocusedKey(l);
384
+ }
385
+ } : a && (b.onMouseDown = (s) => {
386
+ s.preventDefault();
387
+ });
388
+ let k = t.isLink(l) && m === "override", y = t.isLink(l) && m !== "selection" && m !== "none", d = !a && t.canSelectItem(l) && !k, K = (g || y) && !a, h = K && (t.selectionBehavior === "replace" ? !d : !d || t.isEmpty), w = K && d && t.selectionBehavior === "replace", A = h || w, I = S(null), M = A && d, F = S(!1), W = S(!1), R = (s) => {
389
+ if (g && g(), y && i.current) {
390
+ let p = t.getItemProps(l);
391
+ v.open(i.current, s, p.href, p.routerOptions);
392
+ }
393
+ }, P = {
394
+ ref: i
395
+ };
396
+ c ? (P.onPressStart = (s) => {
397
+ I.current = s.pointerType, F.current = M, s.pointerType === "keyboard" && (!A || me()) && $(s);
398
+ }, E ? (P.onPressUp = h ? void 0 : (s) => {
399
+ s.pointerType === "mouse" && d && $(s);
400
+ }, P.onPress = h ? R : (s) => {
401
+ s.pointerType !== "keyboard" && s.pointerType !== "mouse" && d && $(s);
402
+ }) : P.onPress = (s) => {
403
+ if (h || w && s.pointerType !== "mouse") {
404
+ if (s.pointerType === "keyboard" && !$e()) return;
405
+ R(s);
406
+ } else s.pointerType !== "keyboard" && d && $(s);
407
+ }) : (P.onPressStart = (s) => {
408
+ I.current = s.pointerType, F.current = M, W.current = h, d && (s.pointerType === "mouse" && !h || s.pointerType === "keyboard" && (!K || me())) && $(s);
409
+ }, P.onPress = (s) => {
410
+ (s.pointerType === "touch" || s.pointerType === "pen" || s.pointerType === "virtual" || s.pointerType === "keyboard" && A && $e() || s.pointerType === "mouse" && W.current) && (A ? R(s) : d && $(s));
411
+ }), b["data-collection"] = Je(t.collection), b["data-key"] = l, P.preventFocusOnPress = r, r && (P = Y(P, {
412
+ onPressStart(s) {
413
+ s.pointerType !== "touch" && (t.setFocused(!0), t.setFocusedKey(l));
414
+ },
415
+ onPress(s) {
416
+ s.pointerType === "touch" && (t.setFocused(!0), t.setFocusedKey(l));
417
+ }
418
+ }));
419
+ let { pressProps: O, isPressed: G } = Fe(P), Q = w ? (s) => {
420
+ I.current === "mouse" && (s.stopPropagation(), s.preventDefault(), R(s));
421
+ } : void 0, { longPressProps: Z } = Ge({
422
+ isDisabled: !M,
423
+ onLongPress(s) {
424
+ s.pointerType === "touch" && ($(s), t.setSelectionBehavior("toggle"));
425
+ }
426
+ }), X = (s) => {
427
+ I.current === "touch" && F.current && s.preventDefault();
428
+ }, o = t.isLink(l) ? (s) => {
429
+ Me.isOpening || s.preventDefault();
430
+ } : void 0;
431
+ return {
432
+ itemProps: Y(
433
+ b,
434
+ d || h || r && !a ? O : {},
435
+ M ? Z : {},
436
+ {
437
+ onDoubleClick: Q,
438
+ onDragStartCapture: X,
439
+ onClick: o,
440
+ id: e
441
+ },
442
+ // Prevent DOM focus from moving on mouse down when using virtual focus
443
+ r ? {
444
+ onMouseDown: (s) => s.preventDefault()
445
+ } : void 0
446
+ ),
447
+ isPressed: G,
448
+ isSelected: t.isSelected(l),
449
+ isFocused: t.isFocused && t.focusedKey === l,
450
+ isDisabled: a,
451
+ allowsSelection: d,
452
+ hasAction: A
453
+ };
454
+ }
455
+ function $e() {
456
+ let n = window.event;
457
+ return (n == null ? void 0 : n.key) === "Enter";
458
+ }
459
+ function me() {
460
+ let n = window.event;
461
+ return (n == null ? void 0 : n.key) === " " || (n == null ? void 0 : n.code) === "Space";
462
+ }
463
+ class _e {
464
+ build(e, t) {
465
+ return this.context = t, ge(() => this.iterateCollection(e));
466
+ }
467
+ *iterateCollection(e) {
468
+ let { children: t, items: l } = e;
469
+ if (V.isValidElement(t) && t.type === V.Fragment) yield* this.iterateCollection({
470
+ children: t.props.children,
471
+ items: l
472
+ });
473
+ else if (typeof t == "function") {
474
+ if (!l) throw new Error("props.children was a function but props.items is missing");
475
+ let i = 0;
476
+ for (let c of l)
477
+ yield* this.getFullNode({
478
+ value: c,
479
+ index: i
480
+ }, {
481
+ renderer: t
482
+ }), i++;
483
+ } else {
484
+ let i = [];
485
+ V.Children.forEach(t, (r) => {
486
+ r && i.push(r);
487
+ });
488
+ let c = 0;
489
+ for (let r of i) {
490
+ let f = this.getFullNode({
491
+ element: r,
492
+ index: c
493
+ }, {});
494
+ for (let a of f)
495
+ c++, yield a;
496
+ }
497
+ }
498
+ }
499
+ getKey(e, t, l, i) {
500
+ if (e.key != null) return e.key;
501
+ if (t.type === "cell" && t.key != null) return `${i}${t.key}`;
502
+ let c = t.value;
503
+ if (c != null) {
504
+ var r;
505
+ let f = (r = c.key) !== null && r !== void 0 ? r : c.id;
506
+ if (f == null) throw new Error("No key found for item");
507
+ return f;
508
+ }
509
+ return i ? `${i}.${t.index}` : `$.${t.index}`;
510
+ }
511
+ getChildState(e, t) {
512
+ return {
513
+ renderer: t.renderer || e.renderer
514
+ };
515
+ }
516
+ *getFullNode(e, t, l, i) {
517
+ if (V.isValidElement(e.element) && e.element.type === V.Fragment) {
518
+ let y = [];
519
+ V.Children.forEach(e.element.props.children, (K) => {
520
+ y.push(K);
521
+ });
522
+ var c;
523
+ let d = (c = e.index) !== null && c !== void 0 ? c : 0;
524
+ for (const K of y) yield* this.getFullNode({
525
+ element: K,
526
+ index: d++
527
+ }, t, l, i);
528
+ return;
529
+ }
530
+ let r = e.element;
531
+ if (!r && e.value && t && t.renderer) {
532
+ let y = this.cache.get(e.value);
533
+ if (y && (!y.shouldInvalidate || !y.shouldInvalidate(this.context))) {
534
+ y.index = e.index, y.parentKey = i ? i.key : null, yield y;
535
+ return;
536
+ }
537
+ r = t.renderer(e.value);
538
+ }
539
+ if (V.isValidElement(r)) {
540
+ let y = r.type;
541
+ if (typeof y != "function" && typeof y.getCollectionNode != "function") {
542
+ let w = r.type;
543
+ throw new Error(`Unknown element <${w}> in collection.`);
544
+ }
545
+ let d = y.getCollectionNode(r.props, this.context);
546
+ var f;
547
+ let K = (f = e.index) !== null && f !== void 0 ? f : 0, h = d.next();
548
+ for (; !h.done && h.value; ) {
549
+ let w = h.value;
550
+ e.index = K;
551
+ var a;
552
+ let A = (a = w.key) !== null && a !== void 0 ? a : null;
553
+ A == null && (A = w.element ? null : this.getKey(r, e, t, l));
554
+ let M = [
555
+ ...this.getFullNode({
556
+ ...w,
557
+ key: A,
558
+ index: K,
559
+ wrapper: et(e.wrapper, w.wrapper)
560
+ }, this.getChildState(t, w), l ? `${l}${r.key}` : r.key, i)
561
+ ];
562
+ for (let F of M) {
563
+ var g, E;
564
+ F.value = (E = (g = w.value) !== null && g !== void 0 ? g : e.value) !== null && E !== void 0 ? E : null, F.value && this.cache.set(F.value, F);
565
+ var m;
566
+ if (e.type && F.type !== e.type) throw new Error(`Unsupported type <${oe(F.type)}> in <${oe((m = i == null ? void 0 : i.type) !== null && m !== void 0 ? m : "unknown parent type")}>. Only <${oe(e.type)}> is supported.`);
567
+ K++, yield F;
568
+ }
569
+ h = d.next(M);
570
+ }
571
+ return;
572
+ }
573
+ if (e.key == null || e.type == null) return;
574
+ let v = this;
575
+ var $, b;
576
+ let k = {
577
+ type: e.type,
578
+ props: e.props,
579
+ key: e.key,
580
+ parentKey: i ? i.key : null,
581
+ value: ($ = e.value) !== null && $ !== void 0 ? $ : null,
582
+ level: i ? i.level + 1 : 0,
583
+ index: e.index,
584
+ rendered: e.rendered,
585
+ textValue: (b = e.textValue) !== null && b !== void 0 ? b : "",
586
+ "aria-label": e["aria-label"],
587
+ wrapper: e.wrapper,
588
+ shouldInvalidate: e.shouldInvalidate,
589
+ hasChildNodes: e.hasChildNodes || !1,
590
+ childNodes: ge(function* () {
591
+ if (!e.hasChildNodes || !e.childNodes) return;
592
+ let y = 0;
593
+ for (let d of e.childNodes()) {
594
+ d.key != null && (d.key = `${k.key}${d.key}`);
595
+ let K = v.getFullNode({
596
+ ...d,
597
+ index: y
598
+ }, v.getChildState(t, d), k.key, k);
599
+ for (let h of K)
600
+ y++, yield h;
601
+ }
602
+ })
603
+ };
604
+ yield k;
605
+ }
606
+ constructor() {
607
+ this.cache = /* @__PURE__ */ new WeakMap();
608
+ }
609
+ }
610
+ function ge(n) {
611
+ let e = [], t = null;
612
+ return {
613
+ *[Symbol.iterator]() {
614
+ for (let l of e) yield l;
615
+ t || (t = n());
616
+ for (let l of t)
617
+ e.push(l), yield l;
618
+ }
619
+ };
620
+ }
621
+ function et(n, e) {
622
+ if (n && e) return (t) => n(e(t));
623
+ if (n) return n;
624
+ if (e) return e;
625
+ }
626
+ function oe(n) {
627
+ return n[0].toUpperCase() + n.slice(1);
628
+ }
629
+ function $t(n, e, t) {
630
+ let l = j(() => new _e(), []), { children: i, items: c, collection: r } = n;
631
+ return j(() => {
632
+ if (r) return r;
633
+ let a = l.build({
634
+ children: i,
635
+ items: c
636
+ }, t);
637
+ return e(a);
638
+ }, [
639
+ l,
640
+ i,
641
+ c,
642
+ r,
643
+ t,
644
+ e
645
+ ]);
646
+ }
647
+ function tt(n, e) {
648
+ return typeof e.getChildren == "function" ? e.getChildren(n.key) : n.childNodes;
649
+ }
650
+ function lt(n) {
651
+ return it(n, 0);
652
+ }
653
+ function it(n, e) {
654
+ if (e < 0) return;
655
+ let t = 0;
656
+ for (let l of n) {
657
+ if (t === e) return l;
658
+ t++;
659
+ }
660
+ }
661
+ function mt(n) {
662
+ let e;
663
+ for (let t of n) e = t;
664
+ return e;
665
+ }
666
+ function ce(n, e, t) {
667
+ if (e.parentKey === t.parentKey) return e.index - t.index;
668
+ let l = [
669
+ ...Ke(n, e),
670
+ e
671
+ ], i = [
672
+ ...Ke(n, t),
673
+ t
674
+ ], c = l.slice(0, i.length).findIndex((r, f) => r !== i[f]);
675
+ return c !== -1 ? (e = l[c], t = i[c], e.index - t.index) : l.findIndex((r) => r === t) >= 0 ? 1 : (i.findIndex((r) => r === e) >= 0, -1);
676
+ }
677
+ function Ke(n, e) {
678
+ let t = [], l = e;
679
+ for (; (l == null ? void 0 : l.parentKey) != null; )
680
+ l = n.getItem(l.parentKey), l && t.unshift(l);
681
+ return t;
682
+ }
683
+ class C extends Set {
684
+ constructor(e, t, l) {
685
+ super(e), e instanceof C ? (this.anchorKey = t ?? e.anchorKey, this.currentKey = l ?? e.currentKey) : (this.anchorKey = t ?? null, this.currentKey = l ?? null);
686
+ }
687
+ }
688
+ function nt(n, e) {
689
+ if (n.size !== e.size) return !1;
690
+ for (let t of n)
691
+ if (!e.has(t)) return !1;
692
+ return !0;
693
+ }
694
+ function gt(n) {
695
+ let { selectionMode: e = "none", disallowEmptySelection: t = !1, allowDuplicateSelectionEvents: l, selectionBehavior: i = "toggle", disabledBehavior: c = "all" } = n, r = S(!1), [, f] = se(!1), a = S(null), g = S(null), [, E] = se(null), m = j(() => Se(n.selectedKeys), [
696
+ n.selectedKeys
697
+ ]), v = j(() => Se(n.defaultSelectedKeys, new C()), [
698
+ n.defaultSelectedKeys
699
+ ]), [$, b] = Ue(m, v, n.onSelectionChange), k = j(() => n.disabledKeys ? new Set(n.disabledKeys) : /* @__PURE__ */ new Set(), [
700
+ n.disabledKeys
701
+ ]), [y, d] = se(i);
702
+ i === "replace" && y === "toggle" && typeof $ == "object" && $.size === 0 && d("replace");
703
+ let K = S(i);
704
+ return q(() => {
705
+ i !== K.current && (d(i), K.current = i);
706
+ }, [
707
+ i
708
+ ]), {
709
+ selectionMode: e,
710
+ disallowEmptySelection: t,
711
+ selectionBehavior: y,
712
+ setSelectionBehavior: d,
713
+ get isFocused() {
714
+ return r.current;
715
+ },
716
+ setFocused(h) {
717
+ r.current = h, f(h);
718
+ },
719
+ get focusedKey() {
720
+ return a.current;
721
+ },
722
+ get childFocusStrategy() {
723
+ return g.current;
724
+ },
725
+ setFocusedKey(h, w = "first") {
726
+ a.current = h, g.current = w, E(h);
727
+ },
728
+ selectedKeys: $,
729
+ setSelectedKeys(h) {
730
+ (l || !nt(h, $)) && b(h);
731
+ },
732
+ disabledKeys: k,
733
+ disabledBehavior: c
734
+ };
735
+ }
736
+ function Se(n, e) {
737
+ return n ? n === "all" ? "all" : new C(n) : e;
738
+ }
739
+ class Ee {
740
+ /**
741
+ * The type of selection that is allowed in the collection.
742
+ */
743
+ get selectionMode() {
744
+ return this.state.selectionMode;
745
+ }
746
+ /**
747
+ * Whether the collection allows empty selection.
748
+ */
749
+ get disallowEmptySelection() {
750
+ return this.state.disallowEmptySelection;
751
+ }
752
+ /**
753
+ * The selection behavior for the collection.
754
+ */
755
+ get selectionBehavior() {
756
+ return this.state.selectionBehavior;
757
+ }
758
+ /**
759
+ * Sets the selection behavior for the collection.
760
+ */
761
+ setSelectionBehavior(e) {
762
+ this.state.setSelectionBehavior(e);
763
+ }
764
+ /**
765
+ * Whether the collection is currently focused.
766
+ */
767
+ get isFocused() {
768
+ return this.state.isFocused;
769
+ }
770
+ /**
771
+ * Sets whether the collection is focused.
772
+ */
773
+ setFocused(e) {
774
+ this.state.setFocused(e);
775
+ }
776
+ /**
777
+ * The current focused key in the collection.
778
+ */
779
+ get focusedKey() {
780
+ return this.state.focusedKey;
781
+ }
782
+ /** Whether the first or last child of the focused key should receive focus. */
783
+ get childFocusStrategy() {
784
+ return this.state.childFocusStrategy;
785
+ }
786
+ /**
787
+ * Sets the focused key.
788
+ */
789
+ setFocusedKey(e, t) {
790
+ (e == null || this.collection.getItem(e)) && this.state.setFocusedKey(e, t);
791
+ }
792
+ /**
793
+ * The currently selected keys in the collection.
794
+ */
795
+ get selectedKeys() {
796
+ return this.state.selectedKeys === "all" ? new Set(this.getSelectAllKeys()) : this.state.selectedKeys;
797
+ }
798
+ /**
799
+ * The raw selection value for the collection.
800
+ * Either 'all' for select all, or a set of keys.
801
+ */
802
+ get rawSelection() {
803
+ return this.state.selectedKeys;
804
+ }
805
+ /**
806
+ * Returns whether a key is selected.
807
+ */
808
+ isSelected(e) {
809
+ if (this.state.selectionMode === "none") return !1;
810
+ let t = this.getKey(e);
811
+ return t == null ? !1 : this.state.selectedKeys === "all" ? this.canSelectItem(t) : this.state.selectedKeys.has(t);
812
+ }
813
+ /**
814
+ * Whether the selection is empty.
815
+ */
816
+ get isEmpty() {
817
+ return this.state.selectedKeys !== "all" && this.state.selectedKeys.size === 0;
818
+ }
819
+ /**
820
+ * Whether all items in the collection are selected.
821
+ */
822
+ get isSelectAll() {
823
+ if (this.isEmpty) return !1;
824
+ if (this.state.selectedKeys === "all") return !0;
825
+ if (this._isSelectAll != null) return this._isSelectAll;
826
+ let e = this.getSelectAllKeys(), t = this.state.selectedKeys;
827
+ return this._isSelectAll = e.every((l) => t.has(l)), this._isSelectAll;
828
+ }
829
+ get firstSelectedKey() {
830
+ let e = null;
831
+ for (let l of this.state.selectedKeys) {
832
+ let i = this.collection.getItem(l);
833
+ (!e || i && ce(this.collection, i, e) < 0) && (e = i);
834
+ }
835
+ var t;
836
+ return (t = e == null ? void 0 : e.key) !== null && t !== void 0 ? t : null;
837
+ }
838
+ get lastSelectedKey() {
839
+ let e = null;
840
+ for (let l of this.state.selectedKeys) {
841
+ let i = this.collection.getItem(l);
842
+ (!e || i && ce(this.collection, i, e) > 0) && (e = i);
843
+ }
844
+ var t;
845
+ return (t = e == null ? void 0 : e.key) !== null && t !== void 0 ? t : null;
846
+ }
847
+ get disabledKeys() {
848
+ return this.state.disabledKeys;
849
+ }
850
+ get disabledBehavior() {
851
+ return this.state.disabledBehavior;
852
+ }
853
+ /**
854
+ * Extends the selection to the given key.
855
+ */
856
+ extendSelection(e) {
857
+ if (this.selectionMode === "none") return;
858
+ if (this.selectionMode === "single") {
859
+ this.replaceSelection(e);
860
+ return;
861
+ }
862
+ let t = this.getKey(e);
863
+ if (t == null) return;
864
+ let l;
865
+ if (this.state.selectedKeys === "all") l = new C([
866
+ t
867
+ ], t, t);
868
+ else {
869
+ let r = this.state.selectedKeys;
870
+ var i;
871
+ let f = (i = r.anchorKey) !== null && i !== void 0 ? i : t;
872
+ l = new C(r, f, t);
873
+ var c;
874
+ for (let a of this.getKeyRange(f, (c = r.currentKey) !== null && c !== void 0 ? c : t)) l.delete(a);
875
+ for (let a of this.getKeyRange(t, f)) this.canSelectItem(a) && l.add(a);
876
+ }
877
+ this.state.setSelectedKeys(l);
878
+ }
879
+ getKeyRange(e, t) {
880
+ let l = this.collection.getItem(e), i = this.collection.getItem(t);
881
+ return l && i ? ce(this.collection, l, i) <= 0 ? this.getKeyRangeInternal(e, t) : this.getKeyRangeInternal(t, e) : [];
882
+ }
883
+ getKeyRangeInternal(e, t) {
884
+ var l;
885
+ if (!((l = this.layoutDelegate) === null || l === void 0) && l.getKeyRange) return this.layoutDelegate.getKeyRange(e, t);
886
+ let i = [], c = e;
887
+ for (; c != null; ) {
888
+ let r = this.collection.getItem(c);
889
+ if (r && (r.type === "item" || r.type === "cell" && this.allowsCellSelection) && i.push(c), c === t) return i;
890
+ c = this.collection.getKeyAfter(c);
891
+ }
892
+ return [];
893
+ }
894
+ getKey(e) {
895
+ let t = this.collection.getItem(e);
896
+ if (!t || t.type === "cell" && this.allowsCellSelection) return e;
897
+ for (; t && t.type !== "item" && t.parentKey != null; ) t = this.collection.getItem(t.parentKey);
898
+ return !t || t.type !== "item" ? null : t.key;
899
+ }
900
+ /**
901
+ * Toggles whether the given key is selected.
902
+ */
903
+ toggleSelection(e) {
904
+ if (this.selectionMode === "none") return;
905
+ if (this.selectionMode === "single" && !this.isSelected(e)) {
906
+ this.replaceSelection(e);
907
+ return;
908
+ }
909
+ let t = this.getKey(e);
910
+ if (t == null) return;
911
+ let l = new C(this.state.selectedKeys === "all" ? this.getSelectAllKeys() : this.state.selectedKeys);
912
+ l.has(t) ? l.delete(t) : this.canSelectItem(t) && (l.add(t), l.anchorKey = t, l.currentKey = t), !(this.disallowEmptySelection && l.size === 0) && this.state.setSelectedKeys(l);
913
+ }
914
+ /**
915
+ * Replaces the selection with only the given key.
916
+ */
917
+ replaceSelection(e) {
918
+ if (this.selectionMode === "none") return;
919
+ let t = this.getKey(e);
920
+ if (t == null) return;
921
+ let l = this.canSelectItem(t) ? new C([
922
+ t
923
+ ], t, t) : new C();
924
+ this.state.setSelectedKeys(l);
925
+ }
926
+ /**
927
+ * Replaces the selection with the given keys.
928
+ */
929
+ setSelectedKeys(e) {
930
+ if (this.selectionMode === "none") return;
931
+ let t = new C();
932
+ for (let l of e) {
933
+ let i = this.getKey(l);
934
+ if (i != null && (t.add(i), this.selectionMode === "single"))
935
+ break;
936
+ }
937
+ this.state.setSelectedKeys(t);
938
+ }
939
+ getSelectAllKeys() {
940
+ let e = [], t = (l) => {
941
+ for (; l != null; ) {
942
+ if (this.canSelectItem(l)) {
943
+ var i;
944
+ let r = this.collection.getItem(l);
945
+ (r == null ? void 0 : r.type) === "item" && e.push(l);
946
+ var c;
947
+ r != null && r.hasChildNodes && (this.allowsCellSelection || r.type !== "item") && t((c = (i = lt(tt(r, this.collection))) === null || i === void 0 ? void 0 : i.key) !== null && c !== void 0 ? c : null);
948
+ }
949
+ l = this.collection.getKeyAfter(l);
950
+ }
951
+ };
952
+ return t(this.collection.getFirstKey()), e;
953
+ }
954
+ /**
955
+ * Selects all items in the collection.
956
+ */
957
+ selectAll() {
958
+ !this.isSelectAll && this.selectionMode === "multiple" && this.state.setSelectedKeys("all");
959
+ }
960
+ /**
961
+ * Removes all keys from the selection.
962
+ */
963
+ clearSelection() {
964
+ !this.disallowEmptySelection && (this.state.selectedKeys === "all" || this.state.selectedKeys.size > 0) && this.state.setSelectedKeys(new C());
965
+ }
966
+ /**
967
+ * Toggles between select all and an empty selection.
968
+ */
969
+ toggleSelectAll() {
970
+ this.isSelectAll ? this.clearSelection() : this.selectAll();
971
+ }
972
+ select(e, t) {
973
+ this.selectionMode !== "none" && (this.selectionMode === "single" ? this.isSelected(e) && !this.disallowEmptySelection ? this.toggleSelection(e) : this.replaceSelection(e) : this.selectionBehavior === "toggle" || t && (t.pointerType === "touch" || t.pointerType === "virtual") ? this.toggleSelection(e) : this.replaceSelection(e));
974
+ }
975
+ /**
976
+ * Returns whether the current selection is equal to the given selection.
977
+ */
978
+ isSelectionEqual(e) {
979
+ if (e === this.state.selectedKeys) return !0;
980
+ let t = this.selectedKeys;
981
+ if (e.size !== t.size) return !1;
982
+ for (let l of e)
983
+ if (!t.has(l)) return !1;
984
+ for (let l of t)
985
+ if (!e.has(l)) return !1;
986
+ return !0;
987
+ }
988
+ canSelectItem(e) {
989
+ var t;
990
+ if (this.state.selectionMode === "none" || this.state.disabledKeys.has(e)) return !1;
991
+ let l = this.collection.getItem(e);
992
+ return !(!l || !(l == null || (t = l.props) === null || t === void 0) && t.isDisabled || l.type === "cell" && !this.allowsCellSelection);
993
+ }
994
+ isDisabled(e) {
995
+ var t, l;
996
+ return this.state.disabledBehavior === "all" && (this.state.disabledKeys.has(e) || !!(!((l = this.collection.getItem(e)) === null || l === void 0 || (t = l.props) === null || t === void 0) && t.isDisabled));
997
+ }
998
+ isLink(e) {
999
+ var t, l;
1000
+ return !!(!((l = this.collection.getItem(e)) === null || l === void 0 || (t = l.props) === null || t === void 0) && t.href);
1001
+ }
1002
+ getItemProps(e) {
1003
+ var t;
1004
+ return (t = this.collection.getItem(e)) === null || t === void 0 ? void 0 : t.props;
1005
+ }
1006
+ withCollection(e) {
1007
+ return new Ee(e, this.state, {
1008
+ allowsCellSelection: this.allowsCellSelection,
1009
+ layoutDelegate: this.layoutDelegate || void 0
1010
+ });
1011
+ }
1012
+ constructor(e, t, l) {
1013
+ this.collection = e, this.state = t;
1014
+ var i;
1015
+ this.allowsCellSelection = (i = l == null ? void 0 : l.allowsCellSelection) !== null && i !== void 0 ? i : !1, this._isSelectAll = null, this.layoutDelegate = (l == null ? void 0 : l.layoutDelegate) || null;
1016
+ }
1017
+ }
1018
+ export {
1019
+ gt as $,
1020
+ $t as a,
1021
+ Ee as b,
1022
+ re as c,
1023
+ bt as d,
1024
+ vt as e,
1025
+ tt as f,
1026
+ Xe as g,
1027
+ je as h,
1028
+ mt as i,
1029
+ lt as j,
1030
+ it as k,
1031
+ Ge as l
1032
+ };