@proyecto-viviana/solidaria 0.3.0 → 0.4.1

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 (743) hide show
  1. package/dist/_chunk/DragManager.js +627 -0
  2. package/dist/_chunk/DragManager.js.map +1 -0
  3. package/dist/_chunk/DragManager.jsx +627 -0
  4. package/dist/_chunk/DragManager.jsx.map +1 -0
  5. package/dist/_chunk/FocusScope.js +400 -0
  6. package/dist/_chunk/FocusScope.js.map +1 -0
  7. package/dist/_chunk/FocusScope.jsx +375 -0
  8. package/dist/_chunk/FocusScope.jsx.map +1 -0
  9. package/dist/_chunk/actiongroup.js +141 -0
  10. package/dist/_chunk/actiongroup.js.map +1 -0
  11. package/dist/_chunk/actiongroup.jsx +141 -0
  12. package/dist/_chunk/actiongroup.jsx.map +1 -0
  13. package/dist/_chunk/announce.js +207 -0
  14. package/dist/_chunk/announce.js.map +1 -0
  15. package/dist/_chunk/announce.jsx +207 -0
  16. package/dist/_chunk/announce.jsx.map +1 -0
  17. package/dist/_chunk/ariaHideOutside.js +122 -0
  18. package/dist/_chunk/ariaHideOutside.js.map +1 -0
  19. package/dist/_chunk/ariaHideOutside.jsx +122 -0
  20. package/dist/_chunk/ariaHideOutside.jsx.map +1 -0
  21. package/dist/_chunk/autocomplete.js +244 -0
  22. package/dist/_chunk/autocomplete.js.map +1 -0
  23. package/dist/_chunk/autocomplete.jsx +244 -0
  24. package/dist/_chunk/autocomplete.jsx.map +1 -0
  25. package/dist/_chunk/breadcrumbs.js +121 -0
  26. package/dist/_chunk/breadcrumbs.js.map +1 -0
  27. package/dist/_chunk/breadcrumbs.jsx +121 -0
  28. package/dist/_chunk/breadcrumbs.jsx.map +1 -0
  29. package/dist/_chunk/button.js +275 -0
  30. package/dist/_chunk/button.js.map +1 -0
  31. package/dist/_chunk/button.jsx +275 -0
  32. package/dist/_chunk/button.jsx.map +1 -0
  33. package/dist/_chunk/calendar.js +1037 -0
  34. package/dist/_chunk/calendar.js.map +1 -0
  35. package/dist/_chunk/calendar.jsx +1037 -0
  36. package/dist/_chunk/calendar.jsx.map +1 -0
  37. package/dist/_chunk/checkbox.js +235 -0
  38. package/dist/_chunk/checkbox.js.map +1 -0
  39. package/dist/_chunk/checkbox.jsx +235 -0
  40. package/dist/_chunk/checkbox.jsx.map +1 -0
  41. package/dist/_chunk/color.js +1458 -0
  42. package/dist/_chunk/color.js.map +1 -0
  43. package/dist/_chunk/color.jsx +1458 -0
  44. package/dist/_chunk/color.jsx.map +1 -0
  45. package/dist/_chunk/combobox.js +1062 -0
  46. package/dist/_chunk/combobox.js.map +1 -0
  47. package/dist/_chunk/combobox.jsx +1062 -0
  48. package/dist/_chunk/combobox.jsx.map +1 -0
  49. package/dist/_chunk/constants.js +19 -0
  50. package/dist/_chunk/constants.js.map +1 -0
  51. package/dist/_chunk/constants.jsx +19 -0
  52. package/dist/_chunk/constants.jsx.map +1 -0
  53. package/dist/_chunk/createCollator.js +61 -0
  54. package/dist/_chunk/createCollator.js.map +1 -0
  55. package/dist/_chunk/createCollator.jsx +61 -0
  56. package/dist/_chunk/createCollator.jsx.map +1 -0
  57. package/dist/_chunk/createCollectionRowInteraction.js +133 -0
  58. package/dist/_chunk/createCollectionRowInteraction.js.map +1 -0
  59. package/dist/_chunk/createCollectionRowInteraction.jsx +133 -0
  60. package/dist/_chunk/createCollectionRowInteraction.jsx.map +1 -0
  61. package/dist/_chunk/createField.js +55 -0
  62. package/dist/_chunk/createField.js.map +1 -0
  63. package/dist/_chunk/createField.jsx +55 -0
  64. package/dist/_chunk/createField.jsx.map +1 -0
  65. package/dist/_chunk/createFocus.js +105 -0
  66. package/dist/_chunk/createFocus.js.map +1 -0
  67. package/dist/_chunk/createFocus.jsx +105 -0
  68. package/dist/_chunk/createFocus.jsx.map +1 -0
  69. package/dist/_chunk/createFocusRing.js +54 -0
  70. package/dist/_chunk/createFocusRing.js.map +1 -0
  71. package/dist/_chunk/createFocusRing.jsx +54 -0
  72. package/dist/_chunk/createFocusRing.jsx.map +1 -0
  73. package/dist/_chunk/createFocusWithin.js +120 -0
  74. package/dist/_chunk/createFocusWithin.js.map +1 -0
  75. package/dist/_chunk/createFocusWithin.jsx +120 -0
  76. package/dist/_chunk/createFocusWithin.jsx.map +1 -0
  77. package/dist/_chunk/createFocusable.js +131 -0
  78. package/dist/_chunk/createFocusable.js.map +1 -0
  79. package/dist/_chunk/createFocusable.jsx +131 -0
  80. package/dist/_chunk/createFocusable.jsx.map +1 -0
  81. package/dist/_chunk/createFormReset.js +39 -0
  82. package/dist/_chunk/createFormReset.js.map +1 -0
  83. package/dist/_chunk/createFormReset.jsx +39 -0
  84. package/dist/_chunk/createFormReset.jsx.map +1 -0
  85. package/dist/_chunk/createFormValidation.js +135 -0
  86. package/dist/_chunk/createFormValidation.js.map +1 -0
  87. package/dist/_chunk/createFormValidation.jsx +135 -0
  88. package/dist/_chunk/createFormValidation.jsx.map +1 -0
  89. package/dist/_chunk/createHover.js +131 -0
  90. package/dist/_chunk/createHover.js.map +1 -0
  91. package/dist/_chunk/createHover.jsx +131 -0
  92. package/dist/_chunk/createHover.jsx.map +1 -0
  93. package/dist/_chunk/createInteractionModality.js +268 -0
  94. package/dist/_chunk/createInteractionModality.js.map +1 -0
  95. package/dist/_chunk/createInteractionModality.jsx +268 -0
  96. package/dist/_chunk/createInteractionModality.jsx.map +1 -0
  97. package/dist/_chunk/createLabel.js +47 -0
  98. package/dist/_chunk/createLabel.js.map +1 -0
  99. package/dist/_chunk/createLabel.jsx +47 -0
  100. package/dist/_chunk/createLabel.jsx.map +1 -0
  101. package/dist/_chunk/createLabels.js +32 -0
  102. package/dist/_chunk/createLabels.js.map +1 -0
  103. package/dist/_chunk/createLabels.jsx +32 -0
  104. package/dist/_chunk/createLabels.jsx.map +1 -0
  105. package/dist/_chunk/createLandmark.js +198 -0
  106. package/dist/_chunk/createLandmark.js.map +1 -0
  107. package/dist/_chunk/createLandmark.jsx +198 -0
  108. package/dist/_chunk/createLandmark.jsx.map +1 -0
  109. package/dist/_chunk/createOverlay.js +327 -0
  110. package/dist/_chunk/createOverlay.js.map +1 -0
  111. package/dist/_chunk/createOverlay.jsx +327 -0
  112. package/dist/_chunk/createOverlay.jsx.map +1 -0
  113. package/dist/_chunk/createPress.js +526 -0
  114. package/dist/_chunk/createPress.js.map +1 -0
  115. package/dist/_chunk/createPress.jsx +526 -0
  116. package/dist/_chunk/createPress.jsx.map +1 -0
  117. package/dist/_chunk/createProgressBar.js +82 -0
  118. package/dist/_chunk/createProgressBar.js.map +1 -0
  119. package/dist/_chunk/createProgressBar.jsx +82 -0
  120. package/dist/_chunk/createProgressBar.jsx.map +1 -0
  121. package/dist/_chunk/createSelectableItem.js +302 -0
  122. package/dist/_chunk/createSelectableItem.js.map +1 -0
  123. package/dist/_chunk/createSelectableItem.jsx +302 -0
  124. package/dist/_chunk/createSelectableItem.jsx.map +1 -0
  125. package/dist/_chunk/createStringFormatter.js +61 -0
  126. package/dist/_chunk/createStringFormatter.js.map +1 -0
  127. package/dist/_chunk/createStringFormatter.jsx +61 -0
  128. package/dist/_chunk/createStringFormatter.jsx.map +1 -0
  129. package/dist/_chunk/createToggle.js +159 -0
  130. package/dist/_chunk/createToggle.js.map +1 -0
  131. package/dist/_chunk/createToggle.jsx +159 -0
  132. package/dist/_chunk/createToggle.jsx.map +1 -0
  133. package/dist/_chunk/createTypeSelect.js +125 -0
  134. package/dist/_chunk/createTypeSelect.js.map +1 -0
  135. package/dist/_chunk/createTypeSelect.jsx +125 -0
  136. package/dist/_chunk/createTypeSelect.jsx.map +1 -0
  137. package/dist/_chunk/datepicker.js +1706 -0
  138. package/dist/_chunk/datepicker.js.map +1 -0
  139. package/dist/_chunk/datepicker.jsx +1706 -0
  140. package/dist/_chunk/datepicker.jsx.map +1 -0
  141. package/dist/_chunk/dialog.js +62 -0
  142. package/dist/_chunk/dialog.js.map +1 -0
  143. package/dist/_chunk/dialog.jsx +62 -0
  144. package/dist/_chunk/dialog.jsx.map +1 -0
  145. package/dist/_chunk/disclosure.js +185 -0
  146. package/dist/_chunk/disclosure.js.map +1 -0
  147. package/dist/_chunk/disclosure.jsx +185 -0
  148. package/dist/_chunk/disclosure.jsx.map +1 -0
  149. package/dist/_chunk/dnd.js +2395 -0
  150. package/dist/_chunk/dnd.js.map +1 -0
  151. package/dist/_chunk/dnd.jsx +2395 -0
  152. package/dist/_chunk/dnd.jsx.map +1 -0
  153. package/dist/_chunk/env.js +87 -0
  154. package/dist/_chunk/env.js.map +1 -0
  155. package/dist/_chunk/env.jsx +87 -0
  156. package/dist/_chunk/env.jsx.map +1 -0
  157. package/dist/_chunk/filterDOMProps.js +82 -0
  158. package/dist/_chunk/filterDOMProps.js.map +1 -0
  159. package/dist/_chunk/filterDOMProps.jsx +82 -0
  160. package/dist/_chunk/filterDOMProps.jsx.map +1 -0
  161. package/dist/_chunk/focus.js +399 -0
  162. package/dist/_chunk/focus.js.map +1 -0
  163. package/dist/_chunk/focus.jsx +399 -0
  164. package/dist/_chunk/focus.jsx.map +1 -0
  165. package/dist/_chunk/focus2.js +631 -0
  166. package/dist/_chunk/focus2.js.map +1 -0
  167. package/dist/_chunk/focus2.jsx +631 -0
  168. package/dist/_chunk/focus2.jsx.map +1 -0
  169. package/dist/_chunk/grid.js +623 -0
  170. package/dist/_chunk/grid.js.map +1 -0
  171. package/dist/_chunk/grid.jsx +623 -0
  172. package/dist/_chunk/grid.jsx.map +1 -0
  173. package/dist/_chunk/gridlist.js +369 -0
  174. package/dist/_chunk/gridlist.js.map +1 -0
  175. package/dist/_chunk/gridlist.jsx +369 -0
  176. package/dist/_chunk/gridlist.jsx.map +1 -0
  177. package/dist/_chunk/i18n.js +199 -0
  178. package/dist/_chunk/i18n.js.map +1 -0
  179. package/dist/_chunk/i18n.jsx +199 -0
  180. package/dist/_chunk/i18n.jsx.map +1 -0
  181. package/dist/_chunk/interactions.js +331 -0
  182. package/dist/_chunk/interactions.js.map +1 -0
  183. package/dist/_chunk/interactions.jsx +325 -0
  184. package/dist/_chunk/interactions.jsx.map +1 -0
  185. package/dist/_chunk/link.js +97 -0
  186. package/dist/_chunk/link.js.map +1 -0
  187. package/dist/_chunk/link.jsx +97 -0
  188. package/dist/_chunk/link.jsx.map +1 -0
  189. package/dist/_chunk/listbox.js +356 -0
  190. package/dist/_chunk/listbox.js.map +1 -0
  191. package/dist/_chunk/listbox.jsx +356 -0
  192. package/dist/_chunk/listbox.jsx.map +1 -0
  193. package/dist/_chunk/locale.js +173 -0
  194. package/dist/_chunk/locale.js.map +1 -0
  195. package/dist/_chunk/locale.jsx +167 -0
  196. package/dist/_chunk/locale.jsx.map +1 -0
  197. package/dist/_chunk/menu.js +519 -0
  198. package/dist/_chunk/menu.js.map +1 -0
  199. package/dist/_chunk/menu.jsx +519 -0
  200. package/dist/_chunk/menu.jsx.map +1 -0
  201. package/dist/_chunk/meter.js +33 -0
  202. package/dist/_chunk/meter.js.map +1 -0
  203. package/dist/_chunk/meter.jsx +33 -0
  204. package/dist/_chunk/meter.jsx.map +1 -0
  205. package/dist/_chunk/numberfield.js +259 -0
  206. package/dist/_chunk/numberfield.js.map +1 -0
  207. package/dist/_chunk/numberfield.jsx +259 -0
  208. package/dist/_chunk/numberfield.jsx.map +1 -0
  209. package/dist/_chunk/overlays.js +186 -0
  210. package/dist/_chunk/overlays.js.map +1 -0
  211. package/dist/_chunk/overlays.jsx +162 -0
  212. package/dist/_chunk/overlays.jsx.map +1 -0
  213. package/dist/_chunk/popover.js +574 -0
  214. package/dist/_chunk/popover.js.map +1 -0
  215. package/dist/_chunk/popover.jsx +574 -0
  216. package/dist/_chunk/popover.jsx.map +1 -0
  217. package/dist/_chunk/radio.js +320 -0
  218. package/dist/_chunk/radio.js.map +1 -0
  219. package/dist/_chunk/radio.jsx +320 -0
  220. package/dist/_chunk/radio.jsx.map +1 -0
  221. package/dist/_chunk/reactivity.js +21 -0
  222. package/dist/_chunk/reactivity.js.map +1 -0
  223. package/dist/_chunk/reactivity.jsx +21 -0
  224. package/dist/_chunk/reactivity.jsx.map +1 -0
  225. package/dist/_chunk/searchfield.js +210 -0
  226. package/dist/_chunk/searchfield.js.map +1 -0
  227. package/dist/_chunk/searchfield.jsx +210 -0
  228. package/dist/_chunk/searchfield.jsx.map +1 -0
  229. package/dist/_chunk/select.js +406 -0
  230. package/dist/_chunk/select.js.map +1 -0
  231. package/dist/_chunk/select.jsx +397 -0
  232. package/dist/_chunk/select.jsx.map +1 -0
  233. package/dist/_chunk/selection.js +666 -0
  234. package/dist/_chunk/selection.js.map +1 -0
  235. package/dist/_chunk/selection.jsx +666 -0
  236. package/dist/_chunk/selection.jsx.map +1 -0
  237. package/dist/_chunk/separator.js +29 -0
  238. package/dist/_chunk/separator.js.map +1 -0
  239. package/dist/_chunk/separator.jsx +29 -0
  240. package/dist/_chunk/separator.jsx.map +1 -0
  241. package/dist/_chunk/slider.js +256 -0
  242. package/dist/_chunk/slider.js.map +1 -0
  243. package/dist/_chunk/slider.jsx +256 -0
  244. package/dist/_chunk/slider.jsx.map +1 -0
  245. package/dist/_chunk/spinbutton.js +153 -0
  246. package/dist/_chunk/spinbutton.js.map +1 -0
  247. package/dist/_chunk/spinbutton.jsx +153 -0
  248. package/dist/_chunk/spinbutton.jsx.map +1 -0
  249. package/dist/_chunk/steplist.js +66 -0
  250. package/dist/_chunk/steplist.js.map +1 -0
  251. package/dist/_chunk/steplist.jsx +66 -0
  252. package/dist/_chunk/steplist.jsx.map +1 -0
  253. package/dist/_chunk/switch.js +34 -0
  254. package/dist/_chunk/switch.js.map +1 -0
  255. package/dist/_chunk/switch.jsx +34 -0
  256. package/dist/_chunk/switch.jsx.map +1 -0
  257. package/dist/_chunk/table.js +1088 -0
  258. package/dist/_chunk/table.js.map +1 -0
  259. package/dist/_chunk/table.jsx +1088 -0
  260. package/dist/_chunk/table.jsx.map +1 -0
  261. package/dist/_chunk/tabs.js +263 -0
  262. package/dist/_chunk/tabs.js.map +1 -0
  263. package/dist/_chunk/tabs.jsx +263 -0
  264. package/dist/_chunk/tabs.jsx.map +1 -0
  265. package/dist/_chunk/tag.js +322 -0
  266. package/dist/_chunk/tag.js.map +1 -0
  267. package/dist/_chunk/tag.jsx +322 -0
  268. package/dist/_chunk/tag.jsx.map +1 -0
  269. package/dist/_chunk/textfield.js +110 -0
  270. package/dist/_chunk/textfield.js.map +1 -0
  271. package/dist/_chunk/textfield.jsx +110 -0
  272. package/dist/_chunk/textfield.jsx.map +1 -0
  273. package/dist/_chunk/toast.js +250 -0
  274. package/dist/_chunk/toast.js.map +1 -0
  275. package/dist/_chunk/toast.jsx +250 -0
  276. package/dist/_chunk/toast.jsx.map +1 -0
  277. package/dist/_chunk/toolbar.js +226 -0
  278. package/dist/_chunk/toolbar.js.map +1 -0
  279. package/dist/_chunk/toolbar.jsx +226 -0
  280. package/dist/_chunk/toolbar.jsx.map +1 -0
  281. package/dist/_chunk/tooltip.js +185 -0
  282. package/dist/_chunk/tooltip.js.map +1 -0
  283. package/dist/_chunk/tooltip.jsx +185 -0
  284. package/dist/_chunk/tooltip.jsx.map +1 -0
  285. package/dist/_chunk/tree.js +452 -0
  286. package/dist/_chunk/tree.js.map +1 -0
  287. package/dist/_chunk/tree.jsx +452 -0
  288. package/dist/_chunk/tree.jsx.map +1 -0
  289. package/dist/_chunk/utils.js +705 -0
  290. package/dist/_chunk/utils.js.map +1 -0
  291. package/dist/_chunk/utils.jsx +705 -0
  292. package/dist/_chunk/utils.jsx.map +1 -0
  293. package/dist/_chunk/visually-hidden.js +93 -0
  294. package/dist/_chunk/visually-hidden.js.map +1 -0
  295. package/dist/_chunk/visually-hidden.jsx +93 -0
  296. package/dist/_chunk/visually-hidden.jsx.map +1 -0
  297. package/dist/actiongroup/createActionGroup.d.ts.map +1 -1
  298. package/dist/actiongroup/index.js +2 -0
  299. package/dist/actiongroup/index.jsx +2 -0
  300. package/dist/autocomplete/createAutocomplete.d.ts +12 -7
  301. package/dist/autocomplete/createAutocomplete.d.ts.map +1 -1
  302. package/dist/autocomplete/index.js +2 -0
  303. package/dist/autocomplete/index.jsx +2 -0
  304. package/dist/breadcrumbs/createBreadcrumbs.d.ts.map +1 -1
  305. package/dist/breadcrumbs/index.js +2 -0
  306. package/dist/breadcrumbs/index.jsx +2 -0
  307. package/dist/button/createToggleButtonGroup.d.ts.map +1 -1
  308. package/dist/button/index.js +2 -0
  309. package/dist/button/index.jsx +2 -0
  310. package/dist/calendar/createCalendar.d.ts.map +1 -1
  311. package/dist/calendar/createCalendarCell.d.ts.map +1 -1
  312. package/dist/calendar/createCalendarGrid.d.ts.map +1 -1
  313. package/dist/calendar/createCalendarMonthPicker.d.ts +41 -0
  314. package/dist/calendar/createCalendarMonthPicker.d.ts.map +1 -0
  315. package/dist/calendar/createCalendarYearPicker.d.ts +49 -0
  316. package/dist/calendar/createCalendarYearPicker.d.ts.map +1 -0
  317. package/dist/calendar/createRangeCalendar.d.ts.map +1 -1
  318. package/dist/calendar/createRangeCalendarCell.d.ts.map +1 -1
  319. package/dist/calendar/index.d.ts +2 -0
  320. package/dist/calendar/index.d.ts.map +1 -1
  321. package/dist/calendar/index.js +2 -0
  322. package/dist/calendar/index.jsx +2 -0
  323. package/dist/calendar/intl/index.d.ts +1 -1
  324. package/dist/calendar/intl/index.d.ts.map +1 -1
  325. package/dist/calendar/utils.d.ts +4 -0
  326. package/dist/calendar/utils.d.ts.map +1 -1
  327. package/dist/checkbox/createCheckbox.d.ts +4 -0
  328. package/dist/checkbox/createCheckbox.d.ts.map +1 -1
  329. package/dist/checkbox/createCheckboxGroupItem.d.ts.map +1 -1
  330. package/dist/checkbox/index.js +2 -0
  331. package/dist/checkbox/index.jsx +2 -0
  332. package/dist/collections/index.js +160 -0
  333. package/dist/collections/index.js.map +1 -0
  334. package/dist/collections/index.jsx +160 -0
  335. package/dist/collections/index.jsx.map +1 -0
  336. package/dist/color/createColorArea.d.ts.map +1 -1
  337. package/dist/color/createColorField.d.ts.map +1 -1
  338. package/dist/color/createColorSlider.d.ts.map +1 -1
  339. package/dist/color/createColorSwatch.d.ts.map +1 -1
  340. package/dist/color/createColorWheel.d.ts.map +1 -1
  341. package/dist/color/index.js +2 -0
  342. package/dist/color/index.jsx +2 -0
  343. package/dist/color/intl/index.d.ts +30 -0
  344. package/dist/color/intl/index.d.ts.map +1 -0
  345. package/dist/combobox/createComboBox.d.ts.map +1 -1
  346. package/dist/combobox/index.js +2 -0
  347. package/dist/combobox/index.jsx +2 -0
  348. package/dist/combobox/intl/generated-locales.d.ts +16 -0
  349. package/dist/combobox/intl/generated-locales.d.ts.map +1 -0
  350. package/dist/combobox/intl/index.d.ts +2 -2
  351. package/dist/combobox/intl/index.d.ts.map +1 -1
  352. package/dist/datepicker/createDateField.d.ts +45 -23
  353. package/dist/datepicker/createDateField.d.ts.map +1 -1
  354. package/dist/datepicker/createDatePicker.d.ts +34 -6
  355. package/dist/datepicker/createDatePicker.d.ts.map +1 -1
  356. package/dist/datepicker/createDatePickerGroup.d.ts +13 -13
  357. package/dist/datepicker/createDatePickerGroup.d.ts.map +1 -1
  358. package/dist/datepicker/createDateRangePicker.d.ts +55 -7
  359. package/dist/datepicker/createDateRangePicker.d.ts.map +1 -1
  360. package/dist/datepicker/createDateSegment.d.ts +6 -15
  361. package/dist/datepicker/createDateSegment.d.ts.map +1 -1
  362. package/dist/datepicker/createDisplayNames.d.ts +17 -0
  363. package/dist/datepicker/createDisplayNames.d.ts.map +1 -0
  364. package/dist/datepicker/createTimeField.d.ts +12 -49
  365. package/dist/datepicker/createTimeField.d.ts.map +1 -1
  366. package/dist/datepicker/index.d.ts +3 -3
  367. package/dist/datepicker/index.d.ts.map +1 -1
  368. package/dist/datepicker/index.js +2 -0
  369. package/dist/datepicker/index.jsx +2 -0
  370. package/dist/datepicker/intl.d.ts +12 -0
  371. package/dist/datepicker/intl.d.ts.map +1 -0
  372. package/dist/dialog/index.js +2 -0
  373. package/dist/dialog/index.jsx +2 -0
  374. package/dist/disclosure/index.js +2 -0
  375. package/dist/disclosure/index.jsx +2 -0
  376. package/dist/dnd/DragManager.d.ts +86 -0
  377. package/dist/dnd/DragManager.d.ts.map +1 -0
  378. package/dist/dnd/DropTargetKeyboardNavigation.d.ts +42 -0
  379. package/dist/dnd/DropTargetKeyboardNavigation.d.ts.map +1 -0
  380. package/dist/dnd/createDrag.d.ts.map +1 -1
  381. package/dist/dnd/createDraggableCollection.d.ts.map +1 -1
  382. package/dist/dnd/createDraggableItem.d.ts +12 -7
  383. package/dist/dnd/createDraggableItem.d.ts.map +1 -1
  384. package/dist/dnd/createDroppableCollection.d.ts +7 -15
  385. package/dist/dnd/createDroppableCollection.d.ts.map +1 -1
  386. package/dist/dnd/index.d.ts +5 -1
  387. package/dist/dnd/index.d.ts.map +1 -1
  388. package/dist/dnd/index.js +3 -0
  389. package/dist/dnd/index.jsx +3 -0
  390. package/dist/dnd/intl/index.d.ts +39 -0
  391. package/dist/dnd/intl/index.d.ts.map +1 -0
  392. package/dist/dnd/utils.d.ts +7 -2
  393. package/dist/dnd/utils.d.ts.map +1 -1
  394. package/dist/focus/FocusScope.d.ts +7 -0
  395. package/dist/focus/FocusScope.d.ts.map +1 -1
  396. package/dist/focus/index.d.ts +2 -1
  397. package/dist/focus/index.d.ts.map +1 -1
  398. package/dist/focus/index.js +3 -0
  399. package/dist/focus/index.jsx +3 -0
  400. package/dist/focus/virtualFocus.d.ts +26 -0
  401. package/dist/focus/virtualFocus.d.ts.map +1 -0
  402. package/dist/form/createFormValidation.d.ts.map +1 -1
  403. package/dist/form/index.js +3 -0
  404. package/dist/form/index.jsx +3 -0
  405. package/dist/grid/index.js +2 -0
  406. package/dist/grid/index.jsx +2 -0
  407. package/dist/gridlist/createGridList.d.ts +7 -1
  408. package/dist/gridlist/createGridList.d.ts.map +1 -1
  409. package/dist/gridlist/createGridListItem.d.ts +1 -1
  410. package/dist/gridlist/createGridListItem.d.ts.map +1 -1
  411. package/dist/gridlist/createGridListSection.d.ts +15 -0
  412. package/dist/gridlist/createGridListSection.d.ts.map +1 -0
  413. package/dist/gridlist/index.d.ts +2 -1
  414. package/dist/gridlist/index.d.ts.map +1 -1
  415. package/dist/gridlist/index.js +2 -0
  416. package/dist/gridlist/index.jsx +2 -0
  417. package/dist/gridlist/types.d.ts +50 -0
  418. package/dist/gridlist/types.d.ts.map +1 -1
  419. package/dist/i18n/index.js +5 -0
  420. package/dist/i18n/index.jsx +5 -0
  421. package/dist/index.d.ts +10 -6
  422. package/dist/index.d.ts.map +1 -1
  423. package/dist/index.js +77 -18311
  424. package/dist/index.jsx +77 -18242
  425. package/dist/interactions/FocusableProvider.d.ts.map +1 -1
  426. package/dist/interactions/PressEvent.d.ts +11 -0
  427. package/dist/interactions/PressEvent.d.ts.map +1 -1
  428. package/dist/interactions/createFocus.d.ts.map +1 -1
  429. package/dist/interactions/createFocusWithin.d.ts.map +1 -1
  430. package/dist/interactions/createInteractionModality.d.ts +0 -1
  431. package/dist/interactions/createInteractionModality.d.ts.map +1 -1
  432. package/dist/interactions/createKeyboard.d.ts.map +1 -1
  433. package/dist/interactions/createPress.d.ts.map +1 -1
  434. package/dist/interactions/index.js +9 -0
  435. package/dist/interactions/index.jsx +9 -0
  436. package/dist/label/createLabels.d.ts.map +1 -1
  437. package/dist/label/index.js +4 -0
  438. package/dist/label/index.jsx +4 -0
  439. package/dist/landmark/index.js +2 -0
  440. package/dist/landmark/index.jsx +2 -0
  441. package/dist/link/index.js +2 -0
  442. package/dist/link/index.jsx +2 -0
  443. package/dist/listbox/createListBox.d.ts +37 -0
  444. package/dist/listbox/createListBox.d.ts.map +1 -1
  445. package/dist/listbox/createOption.d.ts +7 -1
  446. package/dist/listbox/createOption.d.ts.map +1 -1
  447. package/dist/listbox/index.js +2 -0
  448. package/dist/listbox/index.jsx +2 -0
  449. package/dist/live-announcer/index.js +2 -0
  450. package/dist/live-announcer/index.jsx +2 -0
  451. package/dist/menu/createMenu.d.ts +7 -4
  452. package/dist/menu/createMenu.d.ts.map +1 -1
  453. package/dist/menu/createMenuItem.d.ts +9 -1
  454. package/dist/menu/createMenuItem.d.ts.map +1 -1
  455. package/dist/menu/index.js +2 -0
  456. package/dist/menu/index.jsx +2 -0
  457. package/dist/meter/index.js +2 -0
  458. package/dist/meter/index.jsx +2 -0
  459. package/dist/numberfield/createNumberField.d.ts.map +1 -1
  460. package/dist/numberfield/index.js +2 -0
  461. package/dist/numberfield/index.jsx +2 -0
  462. package/dist/overlays/index.js +4 -0
  463. package/dist/overlays/index.jsx +4 -0
  464. package/dist/popover/calculatePosition.d.ts +2 -0
  465. package/dist/popover/calculatePosition.d.ts.map +1 -1
  466. package/dist/popover/createOverlayPosition.d.ts +8 -0
  467. package/dist/popover/createOverlayPosition.d.ts.map +1 -1
  468. package/dist/popover/index.js +2 -0
  469. package/dist/popover/index.jsx +2 -0
  470. package/dist/progress/index.js +2 -0
  471. package/dist/progress/index.jsx +2 -0
  472. package/dist/radio/createRadio.d.ts +2 -0
  473. package/dist/radio/createRadio.d.ts.map +1 -1
  474. package/dist/radio/index.js +2 -0
  475. package/dist/radio/index.jsx +2 -0
  476. package/dist/searchfield/index.js +2 -0
  477. package/dist/searchfield/index.jsx +2 -0
  478. package/dist/select/createSelect.d.ts +2 -0
  479. package/dist/select/createSelect.d.ts.map +1 -1
  480. package/dist/select/index.js +2 -0
  481. package/dist/select/index.jsx +2 -0
  482. package/dist/selection/DOMLayoutDelegate.d.ts +58 -0
  483. package/dist/selection/DOMLayoutDelegate.d.ts.map +1 -0
  484. package/dist/selection/ListKeyboardDelegate.d.ts +95 -0
  485. package/dist/selection/ListKeyboardDelegate.d.ts.map +1 -0
  486. package/dist/selection/constants.d.ts +15 -0
  487. package/dist/selection/constants.d.ts.map +1 -0
  488. package/dist/selection/createCollectionRowInteraction.d.ts +13 -0
  489. package/dist/selection/createCollectionRowInteraction.d.ts.map +1 -0
  490. package/dist/selection/createScrollIntoViewOnFocus.d.ts +31 -0
  491. package/dist/selection/createScrollIntoViewOnFocus.d.ts.map +1 -0
  492. package/dist/selection/createSelectableCollection.d.ts +69 -0
  493. package/dist/selection/createSelectableCollection.d.ts.map +1 -0
  494. package/dist/selection/createSelectableItem.d.ts +154 -0
  495. package/dist/selection/createSelectableItem.d.ts.map +1 -0
  496. package/dist/selection/createSelectableList.d.ts +43 -0
  497. package/dist/selection/createSelectableList.d.ts.map +1 -0
  498. package/dist/selection/createTypeSelect.d.ts.map +1 -1
  499. package/dist/selection/index.d.ts +9 -0
  500. package/dist/selection/index.d.ts.map +1 -1
  501. package/dist/selection/index.js +5 -0
  502. package/dist/selection/index.jsx +5 -0
  503. package/dist/selection/selectItem.d.ts +29 -0
  504. package/dist/selection/selectItem.d.ts.map +1 -0
  505. package/dist/selection/utils.d.ts +40 -0
  506. package/dist/selection/utils.d.ts.map +1 -0
  507. package/dist/separator/index.js +2 -0
  508. package/dist/separator/index.jsx +2 -0
  509. package/dist/slider/createSlider.d.ts.map +1 -1
  510. package/dist/slider/index.js +2 -0
  511. package/dist/slider/index.jsx +2 -0
  512. package/dist/spinbutton/createSpinButton.d.ts +41 -0
  513. package/dist/spinbutton/createSpinButton.d.ts.map +1 -0
  514. package/dist/spinbutton/index.d.ts +3 -0
  515. package/dist/spinbutton/index.d.ts.map +1 -0
  516. package/dist/spinbutton/index.js +2 -0
  517. package/dist/spinbutton/index.jsx +2 -0
  518. package/dist/spinbutton/intl.d.ts +5 -0
  519. package/dist/spinbutton/intl.d.ts.map +1 -0
  520. package/dist/ssr/index.d.ts +17 -0
  521. package/dist/ssr/index.d.ts.map +1 -1
  522. package/dist/ssr/index.js +299 -0
  523. package/dist/ssr/index.js.map +1 -0
  524. package/dist/ssr/index.jsx +292 -0
  525. package/dist/ssr/index.jsx.map +1 -0
  526. package/dist/steplist/index.js +2 -0
  527. package/dist/steplist/index.jsx +2 -0
  528. package/dist/switch/createSwitch.d.ts +4 -0
  529. package/dist/switch/createSwitch.d.ts.map +1 -1
  530. package/dist/switch/index.js +2 -0
  531. package/dist/switch/index.jsx +2 -0
  532. package/dist/table/createTable.d.ts.map +1 -1
  533. package/dist/table/createTableColumnHeader.d.ts.map +1 -1
  534. package/dist/table/createTableRow.d.ts +1 -1
  535. package/dist/table/createTableRow.d.ts.map +1 -1
  536. package/dist/table/createTableSelectAllCheckbox.d.ts.map +1 -1
  537. package/dist/table/createTableSelectionCheckbox.d.ts.map +1 -1
  538. package/dist/table/index.js +2 -0
  539. package/dist/table/index.jsx +2 -0
  540. package/dist/table/types.d.ts +35 -1
  541. package/dist/table/types.d.ts.map +1 -1
  542. package/dist/table/utils.d.ts +15 -0
  543. package/dist/table/utils.d.ts.map +1 -0
  544. package/dist/tabs/createTabs.d.ts +5 -3
  545. package/dist/tabs/createTabs.d.ts.map +1 -1
  546. package/dist/tabs/index.js +2 -0
  547. package/dist/tabs/index.jsx +2 -0
  548. package/dist/tag/createTag.d.ts +2 -0
  549. package/dist/tag/createTag.d.ts.map +1 -1
  550. package/dist/tag/createTagGroup.d.ts +7 -0
  551. package/dist/tag/createTagGroup.d.ts.map +1 -1
  552. package/dist/tag/index.js +2 -0
  553. package/dist/tag/index.jsx +2 -0
  554. package/dist/textfield/index.js +2 -0
  555. package/dist/textfield/index.jsx +2 -0
  556. package/dist/toast/createToast.d.ts.map +1 -1
  557. package/dist/toast/index.js +2 -0
  558. package/dist/toast/index.jsx +2 -0
  559. package/dist/toggle/createToggle.d.ts +4 -0
  560. package/dist/toggle/createToggle.d.ts.map +1 -1
  561. package/dist/toggle/index.js +3 -0
  562. package/dist/toggle/index.jsx +3 -0
  563. package/dist/toolbar/createToolbar.d.ts +1 -1
  564. package/dist/toolbar/createToolbar.d.ts.map +1 -1
  565. package/dist/toolbar/index.js +2 -0
  566. package/dist/toolbar/index.jsx +2 -0
  567. package/dist/tooltip/index.js +2 -0
  568. package/dist/tooltip/index.jsx +2 -0
  569. package/dist/tree/createTree.d.ts +5 -1
  570. package/dist/tree/createTree.d.ts.map +1 -1
  571. package/dist/tree/createTreeItem.d.ts +1 -1
  572. package/dist/tree/createTreeItem.d.ts.map +1 -1
  573. package/dist/tree/createTreeSelectionCheckbox.d.ts.map +1 -1
  574. package/dist/tree/index.js +2 -0
  575. package/dist/tree/index.jsx +2 -0
  576. package/dist/tree/types.d.ts +10 -0
  577. package/dist/tree/types.d.ts.map +1 -1
  578. package/dist/utils/animation.d.ts +60 -0
  579. package/dist/utils/animation.d.ts.map +1 -0
  580. package/dist/utils/dom.d.ts +49 -2
  581. package/dist/utils/dom.d.ts.map +1 -1
  582. package/dist/utils/index.d.ts +4 -1
  583. package/dist/utils/index.d.ts.map +1 -1
  584. package/dist/utils/index.js +6 -0
  585. package/dist/utils/index.jsx +6 -0
  586. package/dist/utils/keyboard.d.ts +17 -0
  587. package/dist/utils/keyboard.d.ts.map +1 -0
  588. package/dist/utils/mergeProps.d.ts.map +1 -1
  589. package/dist/utils/scrollIntoView.d.ts +30 -0
  590. package/dist/utils/scrollIntoView.d.ts.map +1 -0
  591. package/dist/visually-hidden/index.js +2 -0
  592. package/dist/visually-hidden/index.jsx +2 -0
  593. package/package.json +304 -3
  594. package/src/actiongroup/createActionGroup.ts +26 -109
  595. package/src/autocomplete/createAutocomplete.ts +202 -35
  596. package/src/breadcrumbs/createBreadcrumbs.ts +12 -4
  597. package/src/button/createToggleButtonGroup.ts +19 -14
  598. package/src/calendar/createCalendar.ts +5 -4
  599. package/src/calendar/createCalendarCell.ts +36 -5
  600. package/src/calendar/createCalendarGrid.ts +47 -12
  601. package/src/calendar/createCalendarMonthPicker.ts +105 -0
  602. package/src/calendar/createCalendarYearPicker.ts +144 -0
  603. package/src/calendar/createRangeCalendar.ts +27 -15
  604. package/src/calendar/createRangeCalendarCell.ts +17 -3
  605. package/src/calendar/index.ts +17 -0
  606. package/src/calendar/intl/index.ts +8 -0
  607. package/src/calendar/utils.ts +4 -0
  608. package/src/checkbox/createCheckbox.ts +10 -0
  609. package/src/checkbox/createCheckboxGroupItem.ts +12 -16
  610. package/src/color/createColorArea.ts +17 -10
  611. package/src/color/createColorField.ts +8 -1
  612. package/src/color/createColorSlider.ts +1 -2
  613. package/src/color/createColorSwatch.ts +4 -2
  614. package/src/color/createColorWheel.ts +0 -6
  615. package/src/color/intl/index.ts +316 -0
  616. package/src/combobox/createComboBox.ts +35 -4
  617. package/src/combobox/intl/generated-locales.ts +635 -0
  618. package/src/combobox/intl/index.ts +8 -2
  619. package/src/datepicker/createDateField.ts +228 -213
  620. package/src/datepicker/createDatePicker.ts +157 -146
  621. package/src/datepicker/createDatePickerGroup.ts +88 -82
  622. package/src/datepicker/createDateRangePicker.ts +230 -179
  623. package/src/datepicker/createDateSegment.ts +386 -384
  624. package/src/datepicker/createDisplayNames.ts +45 -0
  625. package/src/datepicker/createTimeField.ts +36 -129
  626. package/src/datepicker/index.ts +13 -14
  627. package/src/datepicker/intl.ts +633 -0
  628. package/src/dnd/DragManager.ts +693 -0
  629. package/src/dnd/DropTargetKeyboardNavigation.ts +337 -0
  630. package/src/dnd/createDrag.ts +31 -5
  631. package/src/dnd/createDraggableCollection.ts +33 -15
  632. package/src/dnd/createDraggableItem.ts +92 -5
  633. package/src/dnd/createDroppableCollection.ts +488 -371
  634. package/src/dnd/index.ts +11 -0
  635. package/src/dnd/intl/ar-AE.json +29 -0
  636. package/src/dnd/intl/bg-BG.json +29 -0
  637. package/src/dnd/intl/cs-CZ.json +29 -0
  638. package/src/dnd/intl/da-DK.json +29 -0
  639. package/src/dnd/intl/de-DE.json +29 -0
  640. package/src/dnd/intl/el-GR.json +29 -0
  641. package/src/dnd/intl/en-US.json +29 -0
  642. package/src/dnd/intl/es-ES.json +29 -0
  643. package/src/dnd/intl/et-EE.json +29 -0
  644. package/src/dnd/intl/fi-FI.json +29 -0
  645. package/src/dnd/intl/fr-FR.json +29 -0
  646. package/src/dnd/intl/he-IL.json +29 -0
  647. package/src/dnd/intl/hr-HR.json +29 -0
  648. package/src/dnd/intl/hu-HU.json +29 -0
  649. package/src/dnd/intl/index.ts +139 -0
  650. package/src/dnd/intl/it-IT.json +29 -0
  651. package/src/dnd/intl/ja-JP.json +29 -0
  652. package/src/dnd/intl/ko-KR.json +29 -0
  653. package/src/dnd/intl/lt-LT.json +29 -0
  654. package/src/dnd/intl/lv-LV.json +29 -0
  655. package/src/dnd/intl/nb-NO.json +29 -0
  656. package/src/dnd/intl/nl-NL.json +29 -0
  657. package/src/dnd/intl/pl-PL.json +29 -0
  658. package/src/dnd/intl/pt-BR.json +29 -0
  659. package/src/dnd/intl/pt-PT.json +29 -0
  660. package/src/dnd/intl/ro-RO.json +29 -0
  661. package/src/dnd/intl/ru-RU.json +29 -0
  662. package/src/dnd/intl/sk-SK.json +29 -0
  663. package/src/dnd/intl/sl-SI.json +29 -0
  664. package/src/dnd/intl/sr-SP.json +29 -0
  665. package/src/dnd/intl/sv-SE.json +29 -0
  666. package/src/dnd/intl/tr-TR.json +29 -0
  667. package/src/dnd/intl/uk-UA.json +29 -0
  668. package/src/dnd/intl/zh-CN.json +29 -0
  669. package/src/dnd/intl/zh-TW.json +29 -0
  670. package/src/dnd/utils.ts +63 -3
  671. package/src/focus/FocusScope.tsx +266 -24
  672. package/src/focus/index.ts +8 -0
  673. package/src/focus/virtualFocus.ts +55 -0
  674. package/src/form/createFormValidation.ts +8 -1
  675. package/src/gridlist/createGridList.ts +187 -48
  676. package/src/gridlist/createGridListItem.ts +87 -155
  677. package/src/gridlist/createGridListSection.ts +54 -0
  678. package/src/gridlist/index.ts +3 -0
  679. package/src/gridlist/types.ts +47 -0
  680. package/src/index.ts +51 -3
  681. package/src/interactions/FocusableProvider.tsx +11 -6
  682. package/src/interactions/PressEvent.ts +14 -0
  683. package/src/interactions/createFocus.ts +26 -21
  684. package/src/interactions/createFocusWithin.ts +23 -24
  685. package/src/interactions/createInteractionModality.ts +26 -15
  686. package/src/interactions/createKeyboard.ts +10 -0
  687. package/src/interactions/createPress.ts +29 -6
  688. package/src/label/createLabels.ts +7 -4
  689. package/src/listbox/createListBox.ts +203 -10
  690. package/src/listbox/createOption.ts +84 -74
  691. package/src/menu/createMenu.ts +93 -16
  692. package/src/menu/createMenuItem.ts +253 -41
  693. package/src/numberfield/createNumberField.ts +82 -14
  694. package/src/popover/calculatePosition.ts +19 -7
  695. package/src/popover/createOverlayPosition.ts +9 -0
  696. package/src/radio/createRadio.ts +19 -2
  697. package/src/select/createSelect.ts +41 -4
  698. package/src/selection/DOMLayoutDelegate.ts +102 -0
  699. package/src/selection/ListKeyboardDelegate.ts +398 -0
  700. package/src/selection/constants.ts +16 -0
  701. package/src/selection/createCollectionRowInteraction.ts +209 -0
  702. package/src/selection/createScrollIntoViewOnFocus.ts +65 -0
  703. package/src/selection/createSelectableCollection.ts +645 -0
  704. package/src/selection/createSelectableItem.ts +512 -0
  705. package/src/selection/createSelectableList.ts +93 -0
  706. package/src/selection/createTypeSelect.ts +112 -51
  707. package/src/selection/index.ts +31 -0
  708. package/src/selection/selectItem.ts +80 -0
  709. package/src/selection/utils.ts +82 -0
  710. package/src/slider/createSlider.ts +48 -1
  711. package/src/spinbutton/createSpinButton.ts +163 -0
  712. package/src/spinbutton/index.ts +10 -0
  713. package/src/spinbutton/intl.ts +115 -0
  714. package/src/ssr/index.tsx +31 -0
  715. package/src/switch/createSwitch.ts +10 -0
  716. package/src/table/createTable.ts +82 -27
  717. package/src/table/createTableColumnHeader.ts +10 -0
  718. package/src/table/createTableRow.ts +208 -203
  719. package/src/table/createTableSelectAllCheckbox.ts +3 -4
  720. package/src/table/createTableSelectionCheckbox.ts +24 -1
  721. package/src/table/types.ts +37 -1
  722. package/src/table/utils.ts +41 -0
  723. package/src/tabs/createTabs.ts +95 -24
  724. package/src/tag/createTag.ts +30 -36
  725. package/src/tag/createTagGroup.ts +92 -0
  726. package/src/toast/createToast.ts +1 -0
  727. package/src/toggle/createToggle.ts +20 -0
  728. package/src/toolbar/createToolbar.ts +43 -94
  729. package/src/tree/createTree.ts +165 -52
  730. package/src/tree/createTreeItem.ts +105 -120
  731. package/src/tree/createTreeSelectionCheckbox.ts +14 -1
  732. package/src/tree/types.ts +10 -0
  733. package/src/utils/animation.ts +243 -0
  734. package/src/utils/dom.ts +216 -25
  735. package/src/utils/index.ts +10 -0
  736. package/src/utils/keyboard.ts +25 -0
  737. package/src/utils/mergeProps.ts +8 -1
  738. package/src/utils/scrollIntoView.ts +181 -0
  739. package/dist/datepicker/createTimeSegment.d.ts +0 -29
  740. package/dist/datepicker/createTimeSegment.d.ts.map +0 -1
  741. package/dist/index.js.map +0 -1
  742. package/dist/index.jsx.map +0 -1
  743. package/src/datepicker/createTimeSegment.ts +0 -352
@@ -0,0 +1,375 @@
1
+ import { g as isTabbable, i as getActiveElement, o as getFocusableTreeWalker, p as isFocusable, s as getOwnerDocument, t as focusSafely } from "./focus.jsx";
2
+ import { createContext, createEffect, createSignal, onCleanup, onMount, useContext } from "solid-js";
3
+ import { isServer } from "solid-js/web";
4
+ //#region src/focus/FocusScope.tsx
5
+ /**
6
+ * FocusScope component for managing focus containment, restoration, and auto-focus.
7
+ * Based on @react-aria/focus FocusScope.
8
+ */
9
+ /**
10
+ * Walks a TreeWalker to its final (deepest-last) node, mirroring the `last`
11
+ * helper in @react-aria/focus.
12
+ */
13
+ function lastFocusable(walker) {
14
+ let next;
15
+ let last;
16
+ do {
17
+ last = walker.lastChild();
18
+ if (last) next = last;
19
+ } while (last);
20
+ return next ?? null;
21
+ }
22
+ /**
23
+ * Creates a FocusManager rooted at the given ref element, independent of any
24
+ * FocusScope. Mirrors @react-aria/focus's `createFocusManager`: it walks the
25
+ * focusable tree with `getFocusableTreeWalker` so segment/spinbutton navigation
26
+ * inside a date field group behaves exactly like upstream.
27
+ */
28
+ function createFocusManager(ref, defaultOptions = {}) {
29
+ return {
30
+ focusNext(opts = {}) {
31
+ const root = ref();
32
+ if (!root) return null;
33
+ const { from, tabbable = defaultOptions.tabbable, wrap = defaultOptions.wrap, accept = defaultOptions.accept } = opts;
34
+ const node = from || getActiveElement(getOwnerDocument(root));
35
+ const walker = getFocusableTreeWalker(root, {
36
+ tabbable,
37
+ accept
38
+ });
39
+ if (node && root.contains(node)) walker.currentNode = node;
40
+ let nextNode = walker.nextNode();
41
+ if (!nextNode && wrap) {
42
+ walker.currentNode = root;
43
+ nextNode = walker.nextNode();
44
+ }
45
+ if (nextNode) focusSafely(nextNode);
46
+ return nextNode;
47
+ },
48
+ focusPrevious(opts = {}) {
49
+ const root = ref();
50
+ if (!root) return null;
51
+ const { from, tabbable = defaultOptions.tabbable, wrap = defaultOptions.wrap, accept = defaultOptions.accept } = opts;
52
+ const node = from || getActiveElement(getOwnerDocument(root));
53
+ const walker = getFocusableTreeWalker(root, {
54
+ tabbable,
55
+ accept
56
+ });
57
+ if (node && root.contains(node)) walker.currentNode = node;
58
+ else {
59
+ const next = lastFocusable(walker);
60
+ if (next) focusSafely(next);
61
+ return next;
62
+ }
63
+ let previousNode = walker.previousNode();
64
+ if (!previousNode && wrap) {
65
+ walker.currentNode = root;
66
+ const lastNode = lastFocusable(walker);
67
+ if (!lastNode) return null;
68
+ previousNode = lastNode;
69
+ }
70
+ if (previousNode) focusSafely(previousNode);
71
+ return previousNode;
72
+ },
73
+ focusFirst(opts = {}) {
74
+ const root = ref();
75
+ if (!root) return null;
76
+ const { tabbable = defaultOptions.tabbable, accept = defaultOptions.accept } = opts;
77
+ const nextNode = getFocusableTreeWalker(root, {
78
+ tabbable,
79
+ accept
80
+ }).nextNode();
81
+ if (nextNode) focusSafely(nextNode);
82
+ return nextNode;
83
+ },
84
+ focusLast(opts = {}) {
85
+ const root = ref();
86
+ if (!root) return null;
87
+ const { tabbable = defaultOptions.tabbable, accept = defaultOptions.accept } = opts;
88
+ const next = lastFocusable(getFocusableTreeWalker(root, {
89
+ tabbable,
90
+ accept
91
+ }));
92
+ if (next) focusSafely(next);
93
+ return next;
94
+ }
95
+ };
96
+ }
97
+ const FocusScopeContext = createContext(null);
98
+ /**
99
+ * Returns a FocusManager interface for the parent FocusScope.
100
+ * A FocusManager can be used to programmatically move focus within
101
+ * a FocusScope, e.g. in response to user events like keyboard navigation.
102
+ */
103
+ function useFocusManager() {
104
+ return useContext(FocusScopeContext)?.focusManager;
105
+ }
106
+ /**
107
+ * Gets all focusable elements within a scope.
108
+ */
109
+ function getFocusableElements(scope, tabbable = false) {
110
+ const elements = [];
111
+ const filter = tabbable ? isTabbable : isFocusable;
112
+ for (const scopeElement of scope) {
113
+ if (filter(scopeElement)) elements.push(scopeElement);
114
+ const descendants = scopeElement.querySelectorAll("*");
115
+ for (let i = 0; i < descendants.length; i++) {
116
+ const el = descendants[i];
117
+ if (filter(el)) elements.push(el);
118
+ }
119
+ }
120
+ return elements;
121
+ }
122
+ /**
123
+ * Checks if an element is within a scope.
124
+ */
125
+ function isElementInScope(element, scope) {
126
+ if (!element) return false;
127
+ return scope.some((node) => node.contains(element));
128
+ }
129
+ /**
130
+ * A registry of the live FocusScopes and their parent/child relationships,
131
+ * mirroring @react-aria/focus's `focusScopeTree`. The DOM tree alone can't
132
+ * express scope nesting because a child scope (e.g. a menu opened from inside a
133
+ * modal popover) is rendered in a portal, outside its parent scope's subtree.
134
+ * The tree records that nesting so containment can recognize a portaled
135
+ * descendant scope as "inside".
136
+ */
137
+ var FocusScopeTree = class {
138
+ root;
139
+ fastMap = /* @__PURE__ */ new Map();
140
+ constructor() {
141
+ this.root = {
142
+ scopeRef: null,
143
+ parent: null,
144
+ children: /* @__PURE__ */ new Set()
145
+ };
146
+ this.fastMap.set(null, this.root);
147
+ }
148
+ getTreeNode(scopeRef) {
149
+ return this.fastMap.get(scopeRef);
150
+ }
151
+ addTreeNode(scopeRef, parent) {
152
+ const parentNode = this.fastMap.get(parent) ?? this.root;
153
+ const node = {
154
+ scopeRef,
155
+ parent: parentNode,
156
+ children: /* @__PURE__ */ new Set()
157
+ };
158
+ parentNode.children.add(node);
159
+ this.fastMap.set(scopeRef, node);
160
+ }
161
+ removeTreeNode(scopeRef) {
162
+ if (scopeRef === null) return;
163
+ const node = this.fastMap.get(scopeRef);
164
+ if (!node) return;
165
+ const parentNode = node.parent;
166
+ if (parentNode) {
167
+ parentNode.children.delete(node);
168
+ for (const child of node.children) {
169
+ child.parent = parentNode;
170
+ parentNode.children.add(child);
171
+ }
172
+ }
173
+ this.fastMap.delete(scopeRef);
174
+ }
175
+ *traverse(node = this.root) {
176
+ if (node.scopeRef != null) yield node;
177
+ for (const child of node.children) yield* this.traverse(child);
178
+ }
179
+ };
180
+ const focusScopeTree = new FocusScopeTree();
181
+ /**
182
+ * Whether the element is inside `scope` or any of its descendant scopes.
183
+ *
184
+ * `isElementInScope`'s `node.contains` already covers descendant scopes that
185
+ * are DOM children, but not those rendered in a portal. Walking the scope
186
+ * subtree closes that gap so focus moving into a portaled child scope still
187
+ * counts as "inside". Mirrors @react-aria/focus's `isElementInChildScope`.
188
+ */
189
+ function isElementInChildScope(element, scope = null) {
190
+ if (element instanceof Element && element.closest("[data-react-aria-top-layer]")) return true;
191
+ for (const node of focusScopeTree.traverse(focusScopeTree.getTreeNode(scope))) if (node.scopeRef && isElementInScope(element, node.scopeRef())) return true;
192
+ return false;
193
+ }
194
+ /**
195
+ * A FocusScope manages focus for its descendants. It supports containing focus inside
196
+ * the scope, restoring focus to the previously focused element on unmount, and auto
197
+ * focusing children on mount. It also acts as a container for a programmatic focus
198
+ * management interface that can be used to move focus forward and back in response
199
+ * to user events.
200
+ */
201
+ const FocusScope = (props) => {
202
+ if (isServer) return <>{props.children}</>;
203
+ let startRef;
204
+ let endRef;
205
+ const [scopeElements, setScopeElements] = createSignal([]);
206
+ const parentScopeRef = useContext(FocusScopeContext)?.scopeRef ?? null;
207
+ let nodeToRestore = null;
208
+ const getRestorableElement = (element, doc) => {
209
+ if (!element || element === doc.body || element === doc.documentElement) return null;
210
+ return element;
211
+ };
212
+ const focusManager = {
213
+ focusNext(opts = {}) {
214
+ const scope = scopeElements();
215
+ if (scope.length === 0) return null;
216
+ const { from, tabbable = true, wrap = false, accept } = opts;
217
+ const elements = getFocusableElements(scope, tabbable).filter((el) => !accept || accept(el));
218
+ const doc = getOwnerDocument(scope[0]);
219
+ const current = from || getActiveElement(doc);
220
+ if (!current || elements.length === 0) return null;
221
+ let nextIndex = elements.indexOf(current) + 1;
222
+ if (nextIndex >= elements.length) if (wrap) nextIndex = 0;
223
+ else return null;
224
+ const nextElement = elements[nextIndex];
225
+ if (nextElement) {
226
+ focusSafely(nextElement);
227
+ return nextElement;
228
+ }
229
+ return null;
230
+ },
231
+ focusPrevious(opts = {}) {
232
+ const scope = scopeElements();
233
+ if (scope.length === 0) return null;
234
+ const { from, tabbable = true, wrap = false, accept } = opts;
235
+ const elements = getFocusableElements(scope, tabbable).filter((el) => !accept || accept(el));
236
+ const doc = getOwnerDocument(scope[0]);
237
+ const current = from || getActiveElement(doc);
238
+ if (!current || elements.length === 0) return null;
239
+ let prevIndex = elements.indexOf(current) - 1;
240
+ if (prevIndex < 0) if (wrap) prevIndex = elements.length - 1;
241
+ else return null;
242
+ const prevElement = elements[prevIndex];
243
+ if (prevElement) {
244
+ focusSafely(prevElement);
245
+ return prevElement;
246
+ }
247
+ return null;
248
+ },
249
+ focusFirst(opts = {}) {
250
+ const scope = scopeElements();
251
+ if (scope.length === 0) return null;
252
+ const { tabbable = true, accept } = opts;
253
+ const elements = getFocusableElements(scope, tabbable).filter((el) => !accept || accept(el));
254
+ if (elements.length > 0) {
255
+ focusSafely(elements[0]);
256
+ return elements[0];
257
+ }
258
+ return null;
259
+ },
260
+ focusLast(opts = {}) {
261
+ const scope = scopeElements();
262
+ if (scope.length === 0) return null;
263
+ const { tabbable = true, accept } = opts;
264
+ const elements = getFocusableElements(scope, tabbable).filter((el) => !accept || accept(el));
265
+ if (elements.length > 0) {
266
+ const lastElement = elements[elements.length - 1];
267
+ focusSafely(lastElement);
268
+ return lastElement;
269
+ }
270
+ return null;
271
+ }
272
+ };
273
+ onMount(() => {});
274
+ onMount(() => {
275
+ focusScopeTree.addTreeNode(scopeElements, parentScopeRef);
276
+ });
277
+ onCleanup(() => {
278
+ focusScopeTree.removeTreeNode(scopeElements);
279
+ });
280
+ onMount(() => {
281
+ if (!props.restoreFocus) return;
282
+ const scopeDoc = document;
283
+ const scopeActive = getActiveElement(scopeDoc);
284
+ const topActive = getActiveElement(document);
285
+ if (scopeDoc !== document && document.activeElement instanceof HTMLIFrameElement && document.activeElement.contentDocument === scopeDoc && scopeActive && scopeActive !== scopeDoc.body) {
286
+ nodeToRestore = getRestorableElement(scopeActive, scopeDoc);
287
+ return;
288
+ }
289
+ nodeToRestore = getRestorableElement(topActive, document);
290
+ });
291
+ createEffect(() => {
292
+ if (!props.autoFocus) return;
293
+ const scope = scopeElements();
294
+ if (scope.length === 0) return;
295
+ if (!isElementInScope(getActiveElement(getOwnerDocument(scope[0])), scope)) focusManager.focusFirst();
296
+ });
297
+ createEffect(() => {
298
+ if (!props.contain) return;
299
+ const scope = scopeElements();
300
+ if (scope.length === 0) return;
301
+ const doc = getOwnerDocument(scope[0]);
302
+ let focusedNode = null;
303
+ const onKeyDown = (e) => {
304
+ if (e.key !== "Tab" || e.altKey || e.ctrlKey || e.metaKey) return;
305
+ const scope = scopeElements();
306
+ const activeElement = getActiveElement(doc);
307
+ if (!isElementInScope(activeElement, scope)) return;
308
+ const elements = getFocusableElements(scope, true);
309
+ if (elements.length === 0) return;
310
+ const firstElement = elements[0];
311
+ const lastElement = elements[elements.length - 1];
312
+ if (e.shiftKey && activeElement === firstElement) {
313
+ e.preventDefault();
314
+ focusSafely(lastElement);
315
+ } else if (!e.shiftKey && activeElement === lastElement) {
316
+ e.preventDefault();
317
+ focusSafely(firstElement);
318
+ }
319
+ };
320
+ const onFocusIn = (e) => {
321
+ const scope = scopeElements();
322
+ const target = e.target;
323
+ if (isElementInScope(target, scope)) focusedNode = target;
324
+ else if (isElementInChildScope(target, scopeElements)) focusedNode = target;
325
+ else if (focusedNode) focusSafely(focusedNode);
326
+ else focusManager.focusFirst();
327
+ };
328
+ let restoreRaf = null;
329
+ const onFocusOut = (e) => {
330
+ const target = e.target;
331
+ if (!isElementInScope(target, scopeElements())) return;
332
+ const win = doc.defaultView ?? window;
333
+ if (restoreRaf != null) win.cancelAnimationFrame(restoreRaf);
334
+ restoreRaf = win.requestAnimationFrame(() => {
335
+ restoreRaf = null;
336
+ const scope = scopeElements();
337
+ const activeElement = getActiveElement(doc);
338
+ if (activeElement && (isElementInScope(activeElement, scope) || isElementInChildScope(activeElement, scopeElements))) return;
339
+ if (doc.body.contains(target)) {
340
+ focusedNode = target;
341
+ focusSafely(target);
342
+ } else focusManager.focusFirst();
343
+ });
344
+ };
345
+ doc.addEventListener("keydown", onKeyDown, true);
346
+ doc.addEventListener("focusin", onFocusIn, true);
347
+ doc.addEventListener("focusout", onFocusOut, true);
348
+ onCleanup(() => {
349
+ doc.removeEventListener("keydown", onKeyDown, true);
350
+ doc.removeEventListener("focusin", onFocusIn, true);
351
+ doc.removeEventListener("focusout", onFocusOut, true);
352
+ if (restoreRaf != null) (doc.defaultView ?? window).cancelAnimationFrame(restoreRaf);
353
+ });
354
+ });
355
+ onCleanup(() => {
356
+ if (props.restoreFocus && nodeToRestore && nodeToRestore.focus) {
357
+ const doc = getOwnerDocument(nodeToRestore);
358
+ (doc.defaultView ?? window).requestAnimationFrame(() => {
359
+ if (nodeToRestore && doc.body.contains(nodeToRestore)) nodeToRestore.focus();
360
+ });
361
+ }
362
+ });
363
+ return <FocusScopeContext.Provider value={{
364
+ focusManager,
365
+ scopeRef: scopeElements
366
+ }}>
367
+ <span data-focus-scope-start hidden ref={startRef} />
368
+ {props.children}
369
+ <span data-focus-scope-end hidden ref={endRef} />
370
+ </FocusScopeContext.Provider>;
371
+ };
372
+ //#endregion
373
+ export { createFocusManager as n, useFocusManager as r, FocusScope as t };
374
+
375
+ //# sourceMappingURL=FocusScope.jsx.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"FocusScope.jsx","names":[],"sources":["../../src/focus/FocusScope.tsx"],"sourcesContent":["/**\n * FocusScope component for managing focus containment, restoration, and auto-focus.\n * Based on @react-aria/focus FocusScope.\n */\n\nimport {\n createContext,\n useContext,\n createEffect,\n onCleanup,\n type JSX,\n type Accessor,\n type ParentComponent,\n createSignal,\n onMount,\n} from \"solid-js\";\nimport { isServer } from \"solid-js/web\";\nimport {\n getOwnerDocument,\n isFocusable,\n isTabbable,\n getFocusableTreeWalker,\n getActiveElement,\n} from \"../utils\";\nimport { focusSafely } from \"../utils/focus\";\n\nexport interface FocusScopeProps {\n /** The contents of the focus scope. */\n children: JSX.Element;\n /**\n * Whether to contain focus inside the scope, so users cannot\n * move focus outside, for example in a modal dialog.\n */\n contain?: boolean;\n /**\n * Whether to restore focus back to the element that was focused\n * when the focus scope mounted, after the focus scope unmounts.\n */\n restoreFocus?: boolean;\n /** Whether to auto focus the first focusable element in the focus scope on mount. */\n autoFocus?: boolean;\n}\n\nexport interface FocusManagerOptions {\n /** The element to start searching from. The currently focused element by default. */\n from?: Element;\n /** Whether to only include tabbable elements, or all focusable elements. */\n tabbable?: boolean;\n /** Whether focus should wrap around when it reaches the end of the scope. */\n wrap?: boolean;\n /** A callback that determines whether the given element is focused. */\n accept?: (node: Element) => boolean;\n}\n\nexport interface FocusManager {\n /** Moves focus to the next focusable or tabbable element in the focus scope. */\n focusNext(opts?: FocusManagerOptions): HTMLElement | null;\n /** Moves focus to the previous focusable or tabbable element in the focus scope. */\n focusPrevious(opts?: FocusManagerOptions): HTMLElement | null;\n /** Moves focus to the first focusable or tabbable element in the focus scope. */\n focusFirst(opts?: FocusManagerOptions): HTMLElement | null;\n /** Moves focus to the last focusable or tabbable element in the focus scope. */\n focusLast(opts?: FocusManagerOptions): HTMLElement | null;\n}\n\ninterface FocusScopeContextValue {\n focusManager: FocusManager;\n scopeRef: Accessor<Element[]>;\n}\n\n/**\n * Walks a TreeWalker to its final (deepest-last) node, mirroring the `last`\n * helper in @react-aria/focus.\n */\nfunction lastFocusable(walker: TreeWalker): HTMLElement | null {\n let next: HTMLElement | undefined;\n let last: Node | null;\n do {\n last = walker.lastChild();\n if (last) {\n next = last as HTMLElement;\n }\n } while (last);\n return next ?? null;\n}\n\n/**\n * Creates a FocusManager rooted at the given ref element, independent of any\n * FocusScope. Mirrors @react-aria/focus's `createFocusManager`: it walks the\n * focusable tree with `getFocusableTreeWalker` so segment/spinbutton navigation\n * inside a date field group behaves exactly like upstream.\n */\nexport function createFocusManager(\n ref: () => HTMLElement | null | undefined,\n defaultOptions: FocusManagerOptions = {},\n): FocusManager {\n return {\n focusNext(opts: FocusManagerOptions = {}) {\n const root = ref();\n if (!root) return null;\n const {\n from,\n tabbable = defaultOptions.tabbable,\n wrap = defaultOptions.wrap,\n accept = defaultOptions.accept,\n } = opts;\n const node = from || getActiveElement(getOwnerDocument(root));\n const walker = getFocusableTreeWalker(root, { tabbable, accept });\n if (node && root.contains(node)) {\n walker.currentNode = node;\n }\n let nextNode = walker.nextNode() as HTMLElement | null;\n if (!nextNode && wrap) {\n walker.currentNode = root;\n nextNode = walker.nextNode() as HTMLElement | null;\n }\n if (nextNode) {\n focusSafely(nextNode);\n }\n return nextNode;\n },\n\n focusPrevious(opts: FocusManagerOptions = {}) {\n const root = ref();\n if (!root) return null;\n const {\n from,\n tabbable = defaultOptions.tabbable,\n wrap = defaultOptions.wrap,\n accept = defaultOptions.accept,\n } = opts;\n const node = from || getActiveElement(getOwnerDocument(root));\n const walker = getFocusableTreeWalker(root, { tabbable, accept });\n if (node && root.contains(node)) {\n walker.currentNode = node;\n } else {\n const next = lastFocusable(walker);\n if (next) {\n focusSafely(next);\n }\n return next;\n }\n let previousNode = walker.previousNode() as HTMLElement | null;\n if (!previousNode && wrap) {\n walker.currentNode = root;\n const lastNode = lastFocusable(walker);\n if (!lastNode) {\n return null;\n }\n previousNode = lastNode;\n }\n if (previousNode) {\n focusSafely(previousNode);\n }\n return previousNode;\n },\n\n focusFirst(opts: FocusManagerOptions = {}) {\n const root = ref();\n if (!root) return null;\n const { tabbable = defaultOptions.tabbable, accept = defaultOptions.accept } = opts;\n const walker = getFocusableTreeWalker(root, { tabbable, accept });\n const nextNode = walker.nextNode() as HTMLElement | null;\n if (nextNode) {\n focusSafely(nextNode);\n }\n return nextNode;\n },\n\n focusLast(opts: FocusManagerOptions = {}) {\n const root = ref();\n if (!root) return null;\n const { tabbable = defaultOptions.tabbable, accept = defaultOptions.accept } = opts;\n const walker = getFocusableTreeWalker(root, { tabbable, accept });\n const next = lastFocusable(walker);\n if (next) {\n focusSafely(next);\n }\n return next;\n },\n };\n}\n\nconst FocusScopeContext = createContext<FocusScopeContextValue | null>(null);\n\n/**\n * Returns a FocusManager interface for the parent FocusScope.\n * A FocusManager can be used to programmatically move focus within\n * a FocusScope, e.g. in response to user events like keyboard navigation.\n */\nexport function useFocusManager(): FocusManager | undefined {\n return useContext(FocusScopeContext)?.focusManager;\n}\n\n/**\n * Gets all focusable elements within a scope.\n */\nfunction getFocusableElements(scope: Element[], tabbable = false): HTMLElement[] {\n const elements: HTMLElement[] = [];\n const filter = tabbable ? isTabbable : isFocusable;\n\n for (const scopeElement of scope) {\n // Check the element itself\n if (filter(scopeElement)) {\n elements.push(scopeElement as HTMLElement);\n }\n\n // Check all descendants\n const descendants = scopeElement.querySelectorAll(\"*\");\n for (let i = 0; i < descendants.length; i++) {\n const el = descendants[i];\n if (filter(el)) {\n elements.push(el as HTMLElement);\n }\n }\n }\n\n return elements;\n}\n\n/**\n * Checks if an element is within a scope.\n */\nfunction isElementInScope(element: Element | null, scope: Element[]): boolean {\n if (!element) return false;\n return scope.some((node) => node.contains(element));\n}\n\n/**\n * A scope is identified by its (stable) scope-elements accessor; `null` is the\n * tree root. Mirrors @react-aria/focus's `ScopeRef`.\n */\ntype ScopeRef = Accessor<Element[]> | null;\n\ninterface FocusScopeTreeNode {\n scopeRef: ScopeRef;\n parent: FocusScopeTreeNode | null;\n children: Set<FocusScopeTreeNode>;\n}\n\n/**\n * A registry of the live FocusScopes and their parent/child relationships,\n * mirroring @react-aria/focus's `focusScopeTree`. The DOM tree alone can't\n * express scope nesting because a child scope (e.g. a menu opened from inside a\n * modal popover) is rendered in a portal, outside its parent scope's subtree.\n * The tree records that nesting so containment can recognize a portaled\n * descendant scope as \"inside\".\n */\nclass FocusScopeTree {\n root: FocusScopeTreeNode;\n private fastMap = new Map<ScopeRef, FocusScopeTreeNode>();\n\n constructor() {\n this.root = { scopeRef: null, parent: null, children: new Set() };\n this.fastMap.set(null, this.root);\n }\n\n getTreeNode(scopeRef: ScopeRef): FocusScopeTreeNode | undefined {\n return this.fastMap.get(scopeRef);\n }\n\n addTreeNode(scopeRef: ScopeRef, parent: ScopeRef): void {\n const parentNode = this.fastMap.get(parent) ?? this.root;\n const node: FocusScopeTreeNode = { scopeRef, parent: parentNode, children: new Set() };\n parentNode.children.add(node);\n this.fastMap.set(scopeRef, node);\n }\n\n removeTreeNode(scopeRef: ScopeRef): void {\n // never remove the root\n if (scopeRef === null) return;\n const node = this.fastMap.get(scopeRef);\n if (!node) return;\n const parentNode = node.parent;\n if (parentNode) {\n parentNode.children.delete(node);\n // Re-parent any children so a mid-tree unmount doesn't orphan descendants.\n for (const child of node.children) {\n child.parent = parentNode;\n parentNode.children.add(child);\n }\n }\n this.fastMap.delete(scopeRef);\n }\n\n // Pre-order depth-first; skips the null-scoped root, like upstream.\n *traverse(node: FocusScopeTreeNode = this.root): Generator<FocusScopeTreeNode> {\n if (node.scopeRef != null) {\n yield node;\n }\n for (const child of node.children) {\n yield* this.traverse(child);\n }\n }\n}\n\nconst focusScopeTree = new FocusScopeTree();\n\n/**\n * Whether the element is inside `scope` or any of its descendant scopes.\n *\n * `isElementInScope`'s `node.contains` already covers descendant scopes that\n * are DOM children, but not those rendered in a portal. Walking the scope\n * subtree closes that gap so focus moving into a portaled child scope still\n * counts as \"inside\". Mirrors @react-aria/focus's `isElementInChildScope`.\n */\nfunction isElementInChildScope(element: Element, scope: ScopeRef = null): boolean {\n // Always allow focus to move into a top-layer element (e.g. toasts).\n if (element instanceof Element && element.closest(\"[data-react-aria-top-layer]\")) {\n return true;\n }\n\n for (const node of focusScopeTree.traverse(focusScopeTree.getTreeNode(scope))) {\n if (node.scopeRef && isElementInScope(element, node.scopeRef())) {\n return true;\n }\n }\n\n return false;\n}\n\n/**\n * A FocusScope manages focus for its descendants. It supports containing focus inside\n * the scope, restoring focus to the previously focused element on unmount, and auto\n * focusing children on mount. It also acts as a container for a programmatic focus\n * management interface that can be used to move focus forward and back in response\n * to user events.\n */\nexport const FocusScope: ParentComponent<FocusScopeProps> = (props) => {\n if (isServer) {\n return <>{props.children}</>;\n }\n\n let startRef: HTMLSpanElement | undefined;\n let endRef: HTMLSpanElement | undefined;\n const [scopeElements, setScopeElements] = createSignal<Element[]>([]);\n\n // The nearest enclosing FocusScope (through context, which Solid propagates\n // across portals) is this scope's parent in the focus-scope tree. Read it\n // before we shadow the context with our own provider below.\n const parentScopeRef = useContext(FocusScopeContext)?.scopeRef ?? null;\n\n // Store the element that was focused when the scope mounted\n let nodeToRestore: Element | null = null;\n\n const getRestorableElement = (element: Element | null, doc: Document): Element | null => {\n if (!element || element === doc.body || element === doc.documentElement) {\n return null;\n }\n return element;\n };\n\n // Create focus manager\n const focusManager: FocusManager = {\n focusNext(opts = {}) {\n const scope = scopeElements();\n if (scope.length === 0) return null;\n\n const { from, tabbable = true, wrap = false, accept } = opts;\n const elements = getFocusableElements(scope, tabbable).filter((el) => !accept || accept(el));\n const doc = getOwnerDocument(scope[0]);\n const current = from || getActiveElement(doc);\n\n if (!current || elements.length === 0) return null;\n\n const currentIndex = elements.indexOf(current as HTMLElement);\n let nextIndex = currentIndex + 1;\n\n if (nextIndex >= elements.length) {\n if (wrap) {\n nextIndex = 0;\n } else {\n return null;\n }\n }\n\n const nextElement = elements[nextIndex];\n if (nextElement) {\n focusSafely(nextElement);\n return nextElement;\n }\n\n return null;\n },\n\n focusPrevious(opts = {}) {\n const scope = scopeElements();\n if (scope.length === 0) return null;\n\n const { from, tabbable = true, wrap = false, accept } = opts;\n const elements = getFocusableElements(scope, tabbable).filter((el) => !accept || accept(el));\n const doc = getOwnerDocument(scope[0]);\n const current = from || getActiveElement(doc);\n\n if (!current || elements.length === 0) return null;\n\n const currentIndex = elements.indexOf(current as HTMLElement);\n let prevIndex = currentIndex - 1;\n\n if (prevIndex < 0) {\n if (wrap) {\n prevIndex = elements.length - 1;\n } else {\n return null;\n }\n }\n\n const prevElement = elements[prevIndex];\n if (prevElement) {\n focusSafely(prevElement);\n return prevElement;\n }\n\n return null;\n },\n\n focusFirst(opts = {}) {\n const scope = scopeElements();\n if (scope.length === 0) return null;\n\n const { tabbable = true, accept } = opts;\n const elements = getFocusableElements(scope, tabbable).filter((el) => !accept || accept(el));\n\n if (elements.length > 0) {\n focusSafely(elements[0]);\n return elements[0];\n }\n\n return null;\n },\n\n focusLast(opts = {}) {\n const scope = scopeElements();\n if (scope.length === 0) return null;\n\n const { tabbable = true, accept } = opts;\n const elements = getFocusableElements(scope, tabbable).filter((el) => !accept || accept(el));\n\n if (elements.length > 0) {\n const lastElement = elements[elements.length - 1];\n focusSafely(lastElement);\n return lastElement;\n }\n\n return null;\n },\n };\n\n // Collect scope elements after render\n onMount(() => {\n if (!startRef || !endRef) return;\n\n const nodes: Element[] = [];\n let node = startRef.nextSibling;\n while (node && node !== endRef) {\n if (node.nodeType === Node.ELEMENT_NODE) {\n nodes.push(node as Element);\n }\n node = node.nextSibling;\n }\n setScopeElements(nodes);\n });\n\n // Register this scope in the focus-scope tree so containment can recognize a\n // portaled descendant scope as \"inside\" it. The scope-elements accessor is a\n // stable identity, so it works as the tree key even before it's populated.\n onMount(() => {\n focusScopeTree.addTreeNode(scopeElements, parentScopeRef);\n });\n onCleanup(() => {\n focusScopeTree.removeTreeNode(scopeElements);\n });\n\n // Save the currently focused element for restoration (must happen before autoFocus/contain effects run).\n onMount(() => {\n if (!props.restoreFocus) return;\n\n // Focus can be in the main document, or inside this iframe's document.\n const scopeDoc = startRef ? getOwnerDocument(startRef) : document;\n const scopeActive = getActiveElement(scopeDoc);\n const topActive = getActiveElement(document);\n\n // If the scope is in an iframe and that iframe is currently focused, prefer the iframe document's active element.\n if (\n scopeDoc !== document &&\n document.activeElement instanceof HTMLIFrameElement &&\n document.activeElement.contentDocument === scopeDoc &&\n scopeActive &&\n scopeActive !== scopeDoc.body\n ) {\n nodeToRestore = getRestorableElement(scopeActive, scopeDoc);\n return;\n }\n\n nodeToRestore = getRestorableElement(topActive, document);\n });\n\n // Auto-focus first element\n createEffect(() => {\n if (!props.autoFocus) return;\n\n const scope = scopeElements();\n if (scope.length === 0) return;\n\n const doc = getOwnerDocument(scope[0]);\n const activeElement = getActiveElement(doc);\n\n // Only auto-focus if focus is not already inside the scope\n if (!isElementInScope(activeElement, scope)) {\n focusManager.focusFirst();\n }\n });\n\n // Focus containment\n createEffect(() => {\n if (!props.contain) return;\n\n const scope = scopeElements();\n if (scope.length === 0) return;\n\n const doc = getOwnerDocument(scope[0]);\n let focusedNode: Element | null = null;\n\n const onKeyDown = (e: KeyboardEvent) => {\n if (e.key !== \"Tab\" || e.altKey || e.ctrlKey || e.metaKey) {\n return;\n }\n\n const scope = scopeElements();\n const activeElement = getActiveElement(doc);\n if (!isElementInScope(activeElement, scope)) {\n return;\n }\n\n const elements = getFocusableElements(scope, true);\n if (elements.length === 0) return;\n\n const firstElement = elements[0];\n const lastElement = elements[elements.length - 1];\n\n if (e.shiftKey && activeElement === firstElement) {\n e.preventDefault();\n focusSafely(lastElement);\n } else if (!e.shiftKey && activeElement === lastElement) {\n e.preventDefault();\n focusSafely(firstElement);\n }\n };\n\n const onFocusIn = (e: FocusEvent) => {\n const scope = scopeElements();\n const target = e.target as Element;\n\n if (isElementInScope(target, scope)) {\n focusedNode = target;\n } else if (isElementInChildScope(target, scopeElements)) {\n // Focus moved into a descendant scope — e.g. a menu opened from inside\n // this modal popover, rendered in a portal outside this scope's DOM\n // subtree. Track it but don't pull focus back, which would tear the\n // nested overlay down.\n focusedNode = target;\n } else if (focusedNode) {\n // Focus escaped the scope, bring it back\n focusSafely(focusedNode as HTMLElement);\n } else {\n // No previous focus, focus first element\n focusManager.focusFirst();\n }\n };\n\n let restoreRaf: number | null = null;\n\n const onFocusOut = (e: FocusEvent) => {\n const target = e.target as Element;\n if (!isElementInScope(target, scopeElements())) return;\n\n // Focus left an element inside the scope. Wait a frame (like upstream's\n // onBlur) so a synchronous refocus elsewhere can settle; if focus ended\n // up outside every scope (e.g. blur() to body), pull it back.\n const win = doc.defaultView ?? window;\n if (restoreRaf != null) win.cancelAnimationFrame(restoreRaf);\n restoreRaf = win.requestAnimationFrame(() => {\n restoreRaf = null;\n const scope = scopeElements();\n const activeElement = getActiveElement(doc);\n if (\n activeElement &&\n (isElementInScope(activeElement, scope) ||\n isElementInChildScope(activeElement, scopeElements))\n ) {\n return;\n }\n\n if (doc.body.contains(target)) {\n focusedNode = target;\n focusSafely(target as HTMLElement);\n } else {\n focusManager.focusFirst();\n }\n });\n };\n\n doc.addEventListener(\"keydown\", onKeyDown, true);\n doc.addEventListener(\"focusin\", onFocusIn, true);\n doc.addEventListener(\"focusout\", onFocusOut, true);\n\n onCleanup(() => {\n doc.removeEventListener(\"keydown\", onKeyDown, true);\n doc.removeEventListener(\"focusin\", onFocusIn, true);\n doc.removeEventListener(\"focusout\", onFocusOut, true);\n if (restoreRaf != null) {\n (doc.defaultView ?? window).cancelAnimationFrame(restoreRaf);\n }\n });\n });\n\n // Restore focus on unmount\n onCleanup(() => {\n if (props.restoreFocus && nodeToRestore && (nodeToRestore as HTMLElement).focus) {\n const doc = getOwnerDocument(nodeToRestore as Element);\n const win = doc.defaultView ?? window;\n\n // Use requestAnimationFrame to ensure the element is still in the DOM\n win.requestAnimationFrame(() => {\n if (nodeToRestore && doc.body.contains(nodeToRestore as Node)) {\n (nodeToRestore as HTMLElement).focus();\n }\n });\n }\n });\n\n return (\n <FocusScopeContext.Provider value={{ focusManager, scopeRef: scopeElements }}>\n <span data-focus-scope-start hidden ref={startRef} />\n {props.children}\n <span data-focus-scope-end hidden ref={endRef} />\n </FocusScopeContext.Provider>\n );\n};\n\nexport default FocusScope;\n"],"mappings":";;;;;;;;;;;;AA0EA,SAAS,cAAc,QAAwC;C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CAAC,KAAK,qBAAqB,OAAO,KAAK,UAAU;IACnD,EAAE,kBAAkB;AAExB"}
@@ -0,0 +1,141 @@
1
+ import { i as mergeProps$1 } from "./env.js";
2
+ import { t as filterDOMProps } from "./filterDOMProps.js";
3
+ import { a as getEventTarget, p as isFocusable, t as focusSafely, y as nodeContains } from "./focus.js";
4
+ import { i as createButton } from "./button.js";
5
+ import { i as useLocale } from "./locale.js";
6
+ import { onCleanup } from "solid-js";
7
+ //#region src/actiongroup/createActionGroup.ts
8
+ const actionGroupData = /* @__PURE__ */ new WeakMap();
9
+ const GROUP_ROLE_BY_MODE = {
10
+ none: "toolbar",
11
+ single: "radiogroup",
12
+ multiple: "toolbar"
13
+ };
14
+ const ITEM_ROLE_BY_MODE = {
15
+ none: void 0,
16
+ single: "radio",
17
+ multiple: "checkbox"
18
+ };
19
+ function isActionGroupDisabled(props, state) {
20
+ if (props.isDisabled) return true;
21
+ const keys = [...state.collection().getKeys()];
22
+ if (keys.length === 0) return true;
23
+ return !keys.some((key) => !state.isDisabled(key));
24
+ }
25
+ function createActionGroup(props, state, _ref) {
26
+ const locale = useLocale();
27
+ let groupRef;
28
+ const applyRoleAttributes = () => {
29
+ if (!groupRef) return;
30
+ const mappedRole = GROUP_ROLE_BY_MODE[state.selectionMode()];
31
+ const nestedToolbar = Boolean(groupRef.parentElement?.closest("[role=\"toolbar\"]"));
32
+ const role = mappedRole === "toolbar" && nestedToolbar ? "group" : mappedRole;
33
+ groupRef.setAttribute("role", role);
34
+ if (mappedRole === "toolbar" && !nestedToolbar) groupRef.setAttribute("aria-orientation", props.orientation ?? "horizontal");
35
+ else groupRef.removeAttribute("aria-orientation");
36
+ };
37
+ const getFocusableItems = (root) => {
38
+ const out = [];
39
+ const pushIfFocusable = (el) => {
40
+ if (!el || !(el instanceof HTMLElement)) return;
41
+ if (isFocusable(el) && el.getAttribute("aria-disabled") !== "true") out.push(el);
42
+ };
43
+ pushIfFocusable(root);
44
+ for (const node of root.querySelectorAll("*")) pushIfFocusable(node);
45
+ return out;
46
+ };
47
+ const focusRelative = (root, direction) => {
48
+ const focusables = getFocusableItems(root);
49
+ if (focusables.length === 0) return null;
50
+ const active = root.ownerDocument.activeElement;
51
+ const currentIndex = active ? focusables.indexOf(active) : -1;
52
+ const next = focusables[currentIndex === -1 ? direction === "next" ? 0 : focusables.length - 1 : (currentIndex + (direction === "next" ? 1 : -1) + focusables.length) % focusables.length];
53
+ focusSafely(next);
54
+ return next;
55
+ };
56
+ const onKeyDown = (e) => {
57
+ const root = groupRef;
58
+ if (!root || isActionGroupDisabled(props, state)) return;
59
+ if (!nodeContains(e.currentTarget, getEventTarget(e))) return;
60
+ const orientation = props.orientation ?? "horizontal";
61
+ const flipDirection = locale().direction === "rtl" && orientation === "horizontal";
62
+ switch (e.key) {
63
+ case "ArrowRight":
64
+ case "ArrowDown":
65
+ e.preventDefault();
66
+ e.stopPropagation();
67
+ if (e.key === "ArrowRight" && flipDirection) focusRelative(root, "previous");
68
+ else focusRelative(root, "next");
69
+ return;
70
+ case "ArrowLeft":
71
+ case "ArrowUp":
72
+ e.preventDefault();
73
+ e.stopPropagation();
74
+ if (e.key === "ArrowLeft" && flipDirection) focusRelative(root, "next");
75
+ else focusRelative(root, "previous");
76
+ return;
77
+ }
78
+ };
79
+ const actionGroupProps = mergeProps$1(filterDOMProps(props, { labelable: true }), {
80
+ ref: (el) => {
81
+ groupRef = el;
82
+ applyRoleAttributes();
83
+ queueMicrotask(() => {
84
+ if (!groupRef) return;
85
+ applyRoleAttributes();
86
+ });
87
+ },
88
+ onKeyDown,
89
+ get "aria-label"() {
90
+ return props["aria-label"];
91
+ },
92
+ get "aria-labelledby"() {
93
+ return props["aria-label"] ? void 0 : props["aria-labelledby"];
94
+ },
95
+ get "aria-disabled"() {
96
+ return isActionGroupDisabled(props, state) || void 0;
97
+ }
98
+ });
99
+ actionGroupData.set(state, { get onAction() {
100
+ return props.onAction;
101
+ } });
102
+ onCleanup(() => {
103
+ actionGroupData.delete(state);
104
+ });
105
+ return { actionGroupProps };
106
+ }
107
+ function createActionGroupItem(props, state) {
108
+ const button = createButton({
109
+ elementType: "button",
110
+ isDisabled: state.isDisabled(props.key),
111
+ onPress: () => {
112
+ state.setFocusedKey(props.key);
113
+ actionGroupData.get(state)?.onAction?.(props.key);
114
+ if (state.selectionMode() !== "none") state.select(props.key);
115
+ }
116
+ });
117
+ const isFocused = () => props.key === state.focusedKey();
118
+ onCleanup(() => {
119
+ if (isFocused()) state.setFocusedKey(null);
120
+ });
121
+ return { buttonProps: mergeProps$1(button.buttonProps, {
122
+ get role() {
123
+ return ITEM_ROLE_BY_MODE[state.selectionMode()];
124
+ },
125
+ get "aria-checked"() {
126
+ if (state.selectionMode() === "none") return void 0;
127
+ return state.isSelected(props.key);
128
+ },
129
+ get tabIndex() {
130
+ return isFocused() || state.focusedKey() == null ? 0 : -1;
131
+ },
132
+ "data-key": String(props.key),
133
+ onFocus: () => {
134
+ state.setFocusedKey(props.key);
135
+ }
136
+ }) };
137
+ }
138
+ //#endregion
139
+ export { createActionGroupItem as n, createActionGroup as t };
140
+
141
+ //# sourceMappingURL=actiongroup.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"actiongroup.js","names":["mergeProps"],"sources":["../../src/actiongroup/createActionGroup.ts"],"sourcesContent":["import { onCleanup, type JSX, type Accessor } from \"solid-js\";\nimport { createButton } from \"../button\";\nimport {\n filterDOMProps,\n getEventTarget,\n mergeProps,\n nodeContains,\n isFocusable,\n focusSafely,\n} from \"../utils\";\nimport { useLocale } from \"../i18n\";\nimport type { Orientation } from \"../toolbar\";\nimport type { Key, ListState } from \"@proyecto-viviana/solid-stately\";\n\nexport interface AriaActionGroupProps<T = unknown> {\n /** List items (optional, parity with React Aria prop shape). */\n items?: T[];\n /** Whether the whole action group is disabled. */\n isDisabled?: boolean;\n /** Group orientation. */\n orientation?: Orientation;\n /** Accessible label. */\n \"aria-label\"?: string;\n /** Labelled-by id. */\n \"aria-labelledby\"?: string;\n /** Handler called when an item action is triggered. */\n onAction?: (key: Key) => void;\n}\n\nexport interface ActionGroupAria {\n actionGroupProps: JSX.HTMLAttributes<HTMLElement>;\n}\n\nexport interface AriaActionGroupItemProps {\n key: Key;\n}\n\nexport interface ActionGroupItemAria {\n buttonProps: JSX.HTMLAttributes<HTMLElement>;\n}\n\ninterface ActionGroupData {\n onAction?: (key: Key) => void;\n}\n\nconst actionGroupData = new WeakMap<object, ActionGroupData>();\n\nconst GROUP_ROLE_BY_MODE = {\n none: \"toolbar\",\n single: \"radiogroup\",\n multiple: \"toolbar\",\n} as const;\n\nconst ITEM_ROLE_BY_MODE = {\n none: undefined,\n single: \"radio\",\n multiple: \"checkbox\",\n} as const;\n\nfunction isActionGroupDisabled<T>(props: AriaActionGroupProps<T>, state: ListState<T>): boolean {\n if (props.isDisabled) return true;\n const keys = [...state.collection().getKeys()];\n if (keys.length === 0) return true;\n return !keys.some((key) => !state.isDisabled(key));\n}\n\nexport function createActionGroup<T>(\n props: AriaActionGroupProps<T>,\n state: ListState<T>,\n _ref?: Accessor<HTMLElement | null>,\n): ActionGroupAria {\n const locale = useLocale();\n let groupRef: HTMLElement | undefined;\n const applyRoleAttributes = (): void => {\n if (!groupRef) return;\n const selectionMode = state.selectionMode();\n const mappedRole = GROUP_ROLE_BY_MODE[selectionMode];\n const nestedToolbar = Boolean(groupRef.parentElement?.closest('[role=\"toolbar\"]'));\n const role = mappedRole === \"toolbar\" && nestedToolbar ? \"group\" : mappedRole;\n groupRef.setAttribute(\"role\", role);\n if (mappedRole === \"toolbar\" && !nestedToolbar) {\n groupRef.setAttribute(\"aria-orientation\", props.orientation ?? \"horizontal\");\n } else {\n groupRef.removeAttribute(\"aria-orientation\");\n }\n };\n\n const getFocusableItems = (root: HTMLElement): HTMLElement[] => {\n const out: HTMLElement[] = [];\n const pushIfFocusable = (el: Element | null | undefined): void => {\n if (!el || !(el instanceof HTMLElement)) return;\n if (isFocusable(el) && el.getAttribute(\"aria-disabled\") !== \"true\") {\n out.push(el);\n }\n };\n\n pushIfFocusable(root);\n for (const node of root.querySelectorAll(\"*\")) {\n pushIfFocusable(node);\n }\n return out;\n };\n\n const focusRelative = (\n root: HTMLElement,\n direction: \"next\" | \"previous\",\n ): HTMLElement | null => {\n const focusables = getFocusableItems(root);\n if (focusables.length === 0) return null;\n\n const active = root.ownerDocument.activeElement as HTMLElement | null;\n const currentIndex = active ? focusables.indexOf(active) : -1;\n const delta = direction === \"next\" ? 1 : -1;\n const nextIndex =\n currentIndex === -1\n ? direction === \"next\"\n ? 0\n : focusables.length - 1\n : (currentIndex + delta + focusables.length) % focusables.length;\n const next = focusables[nextIndex];\n focusSafely(next);\n return next;\n };\n\n // Mirrors react-aria `useActionGroup.onKeyDown` (3.50.0): only the four arrows\n // are handled and they are ORIENTATION-AGNOSTIC — ArrowRight/ArrowDown always\n // move next, ArrowLeft/ArrowUp always move previous (orientation only drives\n // `aria-orientation`). `flipDirection` swaps ArrowRight/ArrowLeft under RTL for\n // horizontal groups. No Home/End (they fall through to the browser). Focus\n // moves via `focusRelative` → `focusSafely` → the item's own `onFocus`, which\n // sets the focused key — so there is no selection-follows-focus here.\n const onKeyDown: JSX.EventHandler<HTMLElement, KeyboardEvent> = (e) => {\n const root = groupRef;\n if (!root || isActionGroupDisabled(props, state)) return;\n if (!nodeContains(e.currentTarget, getEventTarget(e))) return;\n\n const orientation = props.orientation ?? \"horizontal\";\n const flipDirection = locale().direction === \"rtl\" && orientation === \"horizontal\";\n\n switch (e.key) {\n case \"ArrowRight\":\n case \"ArrowDown\": {\n e.preventDefault();\n e.stopPropagation();\n if (e.key === \"ArrowRight\" && flipDirection) {\n focusRelative(root, \"previous\");\n } else {\n focusRelative(root, \"next\");\n }\n return;\n }\n case \"ArrowLeft\":\n case \"ArrowUp\": {\n e.preventDefault();\n e.stopPropagation();\n if (e.key === \"ArrowLeft\" && flipDirection) {\n focusRelative(root, \"next\");\n } else {\n focusRelative(root, \"previous\");\n }\n return;\n }\n }\n };\n\n const actionGroupProps: JSX.HTMLAttributes<HTMLElement> = mergeProps(\n filterDOMProps(props as Record<string, unknown>, { labelable: true }),\n {\n ref: (el: HTMLElement) => {\n groupRef = el;\n applyRoleAttributes();\n queueMicrotask(() => {\n if (!groupRef) return;\n applyRoleAttributes();\n });\n },\n onKeyDown,\n get \"aria-label\"() {\n return props[\"aria-label\"];\n },\n get \"aria-labelledby\"() {\n return props[\"aria-label\"] ? undefined : props[\"aria-labelledby\"];\n },\n get \"aria-disabled\"() {\n return isActionGroupDisabled(props, state) || undefined;\n },\n },\n );\n\n actionGroupData.set(state, {\n get onAction() {\n return props.onAction;\n },\n });\n\n onCleanup(() => {\n actionGroupData.delete(state);\n });\n\n return { actionGroupProps };\n}\n\nexport function createActionGroupItem<T>(\n props: AriaActionGroupItemProps,\n state: ListState<T>,\n): ActionGroupItemAria {\n const button = createButton({\n elementType: \"button\",\n isDisabled: state.isDisabled(props.key),\n onPress: () => {\n state.setFocusedKey(props.key);\n actionGroupData.get(state)?.onAction?.(props.key);\n if (state.selectionMode() !== \"none\") {\n state.select(props.key);\n }\n },\n });\n\n const isFocused = () => props.key === state.focusedKey();\n\n onCleanup(() => {\n if (isFocused()) {\n state.setFocusedKey(null);\n }\n });\n\n const buttonProps: JSX.HTMLAttributes<HTMLElement> = mergeProps(button.buttonProps, {\n get role() {\n return ITEM_ROLE_BY_MODE[state.selectionMode()];\n },\n get \"aria-checked\"() {\n const mode = state.selectionMode();\n if (mode === \"none\") return undefined;\n return state.isSelected(props.key);\n },\n // Mirrors react-aria `useActionGroupItem` (3.50.0): every enabled item is\n // tabbable until focus engages the group, then the roving stop follows the\n // focused key. There is NO single default tab stop and NO selection bias —\n // disabled items are made non-tabbable by their native `disabled` attribute\n // (via createButton), not by this getter.\n get tabIndex() {\n return isFocused() || state.focusedKey() == null ? 0 : -1;\n },\n \"data-key\": String(props.key),\n onFocus: () => {\n state.setFocusedKey(props.key);\n },\n });\n\n return { buttonProps };\n}\n"],"mappings":";;;;;;;AA6C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