@proyecto-viviana/solidaria 0.4.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 (480) 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 +13 -79
  10. package/dist/_chunk/actiongroup.js.map +1 -1
  11. package/dist/_chunk/actiongroup.jsx +13 -79
  12. package/dist/_chunk/actiongroup.jsx.map +1 -1
  13. package/dist/_chunk/{live-announcer.js → announce.js} +1 -1
  14. package/dist/_chunk/announce.js.map +1 -0
  15. package/dist/_chunk/{live-announcer.jsx → announce.jsx} +1 -1
  16. package/dist/_chunk/announce.jsx.map +1 -0
  17. package/dist/_chunk/autocomplete.js +56 -8
  18. package/dist/_chunk/autocomplete.js.map +1 -1
  19. package/dist/_chunk/autocomplete.jsx +56 -8
  20. package/dist/_chunk/autocomplete.jsx.map +1 -1
  21. package/dist/_chunk/breadcrumbs.js +6 -4
  22. package/dist/_chunk/breadcrumbs.js.map +1 -1
  23. package/dist/_chunk/breadcrumbs.jsx +6 -4
  24. package/dist/_chunk/breadcrumbs.jsx.map +1 -1
  25. package/dist/_chunk/button.js +8 -9
  26. package/dist/_chunk/button.js.map +1 -1
  27. package/dist/_chunk/button.jsx +8 -9
  28. package/dist/_chunk/button.jsx.map +1 -1
  29. package/dist/_chunk/calendar.js +27 -26
  30. package/dist/_chunk/calendar.js.map +1 -1
  31. package/dist/_chunk/calendar.jsx +27 -26
  32. package/dist/_chunk/calendar.jsx.map +1 -1
  33. package/dist/_chunk/checkbox.js +5 -4
  34. package/dist/_chunk/checkbox.js.map +1 -1
  35. package/dist/_chunk/checkbox.jsx +5 -4
  36. package/dist/_chunk/checkbox.jsx.map +1 -1
  37. package/dist/_chunk/color.js +302 -18
  38. package/dist/_chunk/color.js.map +1 -1
  39. package/dist/_chunk/color.jsx +302 -18
  40. package/dist/_chunk/color.jsx.map +1 -1
  41. package/dist/_chunk/combobox.js +638 -12
  42. package/dist/_chunk/combobox.js.map +1 -1
  43. package/dist/_chunk/combobox.jsx +638 -12
  44. package/dist/_chunk/combobox.jsx.map +1 -1
  45. package/dist/_chunk/constants.js +19 -0
  46. package/dist/_chunk/constants.js.map +1 -0
  47. package/dist/_chunk/constants.jsx +19 -0
  48. package/dist/_chunk/constants.jsx.map +1 -0
  49. package/dist/_chunk/createCollator.js +3 -171
  50. package/dist/_chunk/createCollator.js.map +1 -1
  51. package/dist/_chunk/createCollator.jsx +3 -165
  52. package/dist/_chunk/createCollator.jsx.map +1 -1
  53. package/dist/_chunk/createField.js +2 -1
  54. package/dist/_chunk/createField.js.map +1 -1
  55. package/dist/_chunk/createField.jsx +2 -1
  56. package/dist/_chunk/createField.jsx.map +1 -1
  57. package/dist/_chunk/createFocus.js +12 -8
  58. package/dist/_chunk/createFocus.js.map +1 -1
  59. package/dist/_chunk/createFocus.jsx +12 -8
  60. package/dist/_chunk/createFocus.jsx.map +1 -1
  61. package/dist/_chunk/createFocusWithin.js +12 -13
  62. package/dist/_chunk/createFocusWithin.js.map +1 -1
  63. package/dist/_chunk/createFocusWithin.jsx +12 -13
  64. package/dist/_chunk/createFocusWithin.jsx.map +1 -1
  65. package/dist/_chunk/createFocusable.js +3 -3
  66. package/dist/_chunk/createFocusable.js.map +1 -1
  67. package/dist/_chunk/createFocusable.jsx +3 -3
  68. package/dist/_chunk/createFocusable.jsx.map +1 -1
  69. package/dist/_chunk/{form.js → createFormReset.js} +1 -1
  70. package/dist/_chunk/createFormReset.js.map +1 -0
  71. package/dist/_chunk/{form.jsx → createFormReset.jsx} +1 -1
  72. package/dist/_chunk/createFormReset.jsx.map +1 -0
  73. package/dist/_chunk/createHover.js +2 -1
  74. package/dist/_chunk/createHover.js.map +1 -1
  75. package/dist/_chunk/createHover.jsx +2 -1
  76. package/dist/_chunk/createHover.jsx.map +1 -1
  77. package/dist/_chunk/createInteractionModality.js +2 -3
  78. package/dist/_chunk/createInteractionModality.js.map +1 -1
  79. package/dist/_chunk/createInteractionModality.jsx +2 -3
  80. package/dist/_chunk/createInteractionModality.jsx.map +1 -1
  81. package/dist/_chunk/createLabel.js +2 -1
  82. package/dist/_chunk/createLabel.js.map +1 -1
  83. package/dist/_chunk/createLabel.jsx +2 -1
  84. package/dist/_chunk/createLabel.jsx.map +1 -1
  85. package/dist/_chunk/createLabels.js +3 -2
  86. package/dist/_chunk/createLabels.js.map +1 -1
  87. package/dist/_chunk/createLabels.jsx +3 -2
  88. package/dist/_chunk/createLabels.jsx.map +1 -1
  89. package/dist/_chunk/createLandmark.js +1 -1
  90. package/dist/_chunk/createLandmark.jsx +1 -1
  91. package/dist/_chunk/createProgressBar.js +2 -1
  92. package/dist/_chunk/createProgressBar.js.map +1 -1
  93. package/dist/_chunk/createProgressBar.jsx +2 -1
  94. package/dist/_chunk/createProgressBar.jsx.map +1 -1
  95. package/dist/_chunk/createSelectableItem.js +7 -3
  96. package/dist/_chunk/createSelectableItem.js.map +1 -1
  97. package/dist/_chunk/createSelectableItem.jsx +7 -3
  98. package/dist/_chunk/createSelectableItem.jsx.map +1 -1
  99. package/dist/_chunk/createStringFormatter.js +61 -0
  100. package/dist/_chunk/createStringFormatter.js.map +1 -0
  101. package/dist/_chunk/createStringFormatter.jsx +61 -0
  102. package/dist/_chunk/createStringFormatter.jsx.map +1 -0
  103. package/dist/_chunk/createToggle.js +5 -4
  104. package/dist/_chunk/createToggle.js.map +1 -1
  105. package/dist/_chunk/createToggle.jsx +5 -4
  106. package/dist/_chunk/createToggle.jsx.map +1 -1
  107. package/dist/_chunk/datepicker.js +1413 -1100
  108. package/dist/_chunk/datepicker.js.map +1 -1
  109. package/dist/_chunk/datepicker.jsx +1413 -1100
  110. package/dist/_chunk/datepicker.jsx.map +1 -1
  111. package/dist/_chunk/disclosure.js +2 -2
  112. package/dist/_chunk/disclosure.js.map +1 -1
  113. package/dist/_chunk/disclosure.jsx +2 -2
  114. package/dist/_chunk/disclosure.jsx.map +1 -1
  115. package/dist/_chunk/dnd.js +1586 -495
  116. package/dist/_chunk/dnd.js.map +1 -1
  117. package/dist/_chunk/dnd.jsx +1586 -495
  118. package/dist/_chunk/dnd.jsx.map +1 -1
  119. package/dist/_chunk/env.js +1 -19
  120. package/dist/_chunk/env.js.map +1 -1
  121. package/dist/_chunk/env.jsx +1 -19
  122. package/dist/_chunk/env.jsx.map +1 -1
  123. package/dist/_chunk/focus.js +1 -1
  124. package/dist/_chunk/focus.js.map +1 -1
  125. package/dist/_chunk/focus.jsx +1 -1
  126. package/dist/_chunk/focus.jsx.map +1 -1
  127. package/dist/_chunk/focus2.js +54 -318
  128. package/dist/_chunk/focus2.js.map +1 -1
  129. package/dist/_chunk/focus2.jsx +53 -292
  130. package/dist/_chunk/focus2.jsx.map +1 -1
  131. package/dist/_chunk/grid.js +1 -1
  132. package/dist/_chunk/grid.jsx +1 -1
  133. package/dist/_chunk/gridlist.js +14 -9
  134. package/dist/_chunk/gridlist.js.map +1 -1
  135. package/dist/_chunk/gridlist.jsx +14 -9
  136. package/dist/_chunk/gridlist.jsx.map +1 -1
  137. package/dist/_chunk/i18n.js +3 -58
  138. package/dist/_chunk/i18n.js.map +1 -1
  139. package/dist/_chunk/i18n.jsx +3 -58
  140. package/dist/_chunk/i18n.jsx.map +1 -1
  141. package/dist/_chunk/interactions.js +99 -9
  142. package/dist/_chunk/interactions.js.map +1 -1
  143. package/dist/_chunk/interactions.jsx +97 -9
  144. package/dist/_chunk/interactions.jsx.map +1 -1
  145. package/dist/_chunk/link.js +2 -1
  146. package/dist/_chunk/link.js.map +1 -1
  147. package/dist/_chunk/link.jsx +2 -1
  148. package/dist/_chunk/link.jsx.map +1 -1
  149. package/dist/_chunk/listbox.js +42 -10
  150. package/dist/_chunk/listbox.js.map +1 -1
  151. package/dist/_chunk/listbox.jsx +42 -10
  152. package/dist/_chunk/listbox.jsx.map +1 -1
  153. package/dist/_chunk/locale.js +173 -0
  154. package/dist/_chunk/locale.js.map +1 -0
  155. package/dist/_chunk/locale.jsx +167 -0
  156. package/dist/_chunk/locale.jsx.map +1 -0
  157. package/dist/_chunk/menu.js +5 -4
  158. package/dist/_chunk/menu.js.map +1 -1
  159. package/dist/_chunk/menu.jsx +5 -4
  160. package/dist/_chunk/menu.jsx.map +1 -1
  161. package/dist/_chunk/numberfield.js +3 -2
  162. package/dist/_chunk/numberfield.js.map +1 -1
  163. package/dist/_chunk/numberfield.jsx +3 -2
  164. package/dist/_chunk/numberfield.jsx.map +1 -1
  165. package/dist/_chunk/overlays.js +1 -1
  166. package/dist/_chunk/overlays.jsx +1 -1
  167. package/dist/_chunk/popover.js +3 -3
  168. package/dist/_chunk/popover.js.map +1 -1
  169. package/dist/_chunk/popover.jsx +3 -3
  170. package/dist/_chunk/popover.jsx.map +1 -1
  171. package/dist/_chunk/radio.js +7 -6
  172. package/dist/_chunk/radio.js.map +1 -1
  173. package/dist/_chunk/radio.jsx +7 -6
  174. package/dist/_chunk/radio.jsx.map +1 -1
  175. package/dist/_chunk/reactivity.js +21 -0
  176. package/dist/_chunk/reactivity.js.map +1 -0
  177. package/dist/_chunk/reactivity.jsx +21 -0
  178. package/dist/_chunk/reactivity.jsx.map +1 -0
  179. package/dist/_chunk/searchfield.js +2 -1
  180. package/dist/_chunk/searchfield.js.map +1 -1
  181. package/dist/_chunk/searchfield.jsx +2 -1
  182. package/dist/_chunk/searchfield.jsx.map +1 -1
  183. package/dist/_chunk/select.js +8 -5
  184. package/dist/_chunk/select.js.map +1 -1
  185. package/dist/_chunk/select.jsx +8 -5
  186. package/dist/_chunk/select.jsx.map +1 -1
  187. package/dist/_chunk/selection.js +8 -21
  188. package/dist/_chunk/selection.js.map +1 -1
  189. package/dist/_chunk/selection.jsx +8 -21
  190. package/dist/_chunk/selection.jsx.map +1 -1
  191. package/dist/_chunk/separator.js +1 -1
  192. package/dist/_chunk/separator.jsx +1 -1
  193. package/dist/_chunk/slider.js +5 -4
  194. package/dist/_chunk/slider.js.map +1 -1
  195. package/dist/_chunk/slider.jsx +5 -4
  196. package/dist/_chunk/slider.jsx.map +1 -1
  197. package/dist/_chunk/spinbutton.js +153 -0
  198. package/dist/_chunk/spinbutton.js.map +1 -0
  199. package/dist/_chunk/spinbutton.jsx +153 -0
  200. package/dist/_chunk/spinbutton.jsx.map +1 -0
  201. package/dist/_chunk/table.js +45 -8
  202. package/dist/_chunk/table.js.map +1 -1
  203. package/dist/_chunk/table.jsx +45 -8
  204. package/dist/_chunk/table.jsx.map +1 -1
  205. package/dist/_chunk/tabs.js +11 -8
  206. package/dist/_chunk/tabs.js.map +1 -1
  207. package/dist/_chunk/tabs.jsx +11 -8
  208. package/dist/_chunk/tabs.jsx.map +1 -1
  209. package/dist/_chunk/tag.js +54 -18
  210. package/dist/_chunk/tag.js.map +1 -1
  211. package/dist/_chunk/tag.jsx +54 -18
  212. package/dist/_chunk/tag.jsx.map +1 -1
  213. package/dist/_chunk/textfield.js +2 -1
  214. package/dist/_chunk/textfield.js.map +1 -1
  215. package/dist/_chunk/textfield.jsx +2 -1
  216. package/dist/_chunk/textfield.jsx.map +1 -1
  217. package/dist/_chunk/toolbar.js +4 -36
  218. package/dist/_chunk/toolbar.js.map +1 -1
  219. package/dist/_chunk/toolbar.jsx +4 -36
  220. package/dist/_chunk/toolbar.jsx.map +1 -1
  221. package/dist/_chunk/tooltip.js +2 -2
  222. package/dist/_chunk/tooltip.js.map +1 -1
  223. package/dist/_chunk/tooltip.jsx +2 -2
  224. package/dist/_chunk/tooltip.jsx.map +1 -1
  225. package/dist/_chunk/tree.js +42 -14
  226. package/dist/_chunk/tree.js.map +1 -1
  227. package/dist/_chunk/tree.jsx +42 -14
  228. package/dist/_chunk/tree.jsx.map +1 -1
  229. package/dist/_chunk/utils.js +59 -19
  230. package/dist/_chunk/utils.js.map +1 -1
  231. package/dist/_chunk/utils.jsx +59 -19
  232. package/dist/_chunk/utils.jsx.map +1 -1
  233. package/dist/_chunk/visually-hidden.js +3 -2
  234. package/dist/_chunk/visually-hidden.js.map +1 -1
  235. package/dist/_chunk/visually-hidden.jsx +3 -2
  236. package/dist/_chunk/visually-hidden.jsx.map +1 -1
  237. package/dist/actiongroup/createActionGroup.d.ts.map +1 -1
  238. package/dist/autocomplete/createAutocomplete.d.ts +10 -7
  239. package/dist/autocomplete/createAutocomplete.d.ts.map +1 -1
  240. package/dist/breadcrumbs/createBreadcrumbs.d.ts.map +1 -1
  241. package/dist/button/createToggleButtonGroup.d.ts.map +1 -1
  242. package/dist/calendar/createCalendar.d.ts.map +1 -1
  243. package/dist/calendar/createCalendarCell.d.ts.map +1 -1
  244. package/dist/calendar/createCalendarGrid.d.ts.map +1 -1
  245. package/dist/calendar/createRangeCalendar.d.ts.map +1 -1
  246. package/dist/calendar/createRangeCalendarCell.d.ts.map +1 -1
  247. package/dist/calendar/intl/index.d.ts +1 -1
  248. package/dist/calendar/intl/index.d.ts.map +1 -1
  249. package/dist/collections/index.js +1 -1
  250. package/dist/collections/index.jsx +1 -1
  251. package/dist/color/createColorArea.d.ts.map +1 -1
  252. package/dist/color/createColorField.d.ts.map +1 -1
  253. package/dist/color/createColorSlider.d.ts.map +1 -1
  254. package/dist/color/createColorSwatch.d.ts.map +1 -1
  255. package/dist/color/createColorWheel.d.ts.map +1 -1
  256. package/dist/color/intl/index.d.ts +30 -0
  257. package/dist/color/intl/index.d.ts.map +1 -0
  258. package/dist/combobox/createComboBox.d.ts.map +1 -1
  259. package/dist/combobox/intl/generated-locales.d.ts +16 -0
  260. package/dist/combobox/intl/generated-locales.d.ts.map +1 -0
  261. package/dist/combobox/intl/index.d.ts +2 -2
  262. package/dist/combobox/intl/index.d.ts.map +1 -1
  263. package/dist/datepicker/createDateField.d.ts +45 -23
  264. package/dist/datepicker/createDateField.d.ts.map +1 -1
  265. package/dist/datepicker/createDatePicker.d.ts +34 -6
  266. package/dist/datepicker/createDatePicker.d.ts.map +1 -1
  267. package/dist/datepicker/createDatePickerGroup.d.ts +13 -13
  268. package/dist/datepicker/createDatePickerGroup.d.ts.map +1 -1
  269. package/dist/datepicker/createDateRangePicker.d.ts +55 -7
  270. package/dist/datepicker/createDateRangePicker.d.ts.map +1 -1
  271. package/dist/datepicker/createDateSegment.d.ts +6 -15
  272. package/dist/datepicker/createDateSegment.d.ts.map +1 -1
  273. package/dist/datepicker/createDisplayNames.d.ts +17 -0
  274. package/dist/datepicker/createDisplayNames.d.ts.map +1 -0
  275. package/dist/datepicker/createTimeField.d.ts +12 -49
  276. package/dist/datepicker/createTimeField.d.ts.map +1 -1
  277. package/dist/datepicker/index.d.ts +3 -3
  278. package/dist/datepicker/index.d.ts.map +1 -1
  279. package/dist/datepicker/index.js +2 -2
  280. package/dist/datepicker/index.jsx +2 -2
  281. package/dist/datepicker/intl.d.ts +12 -0
  282. package/dist/datepicker/intl.d.ts.map +1 -0
  283. package/dist/dnd/DragManager.d.ts +86 -0
  284. package/dist/dnd/DragManager.d.ts.map +1 -0
  285. package/dist/dnd/DropTargetKeyboardNavigation.d.ts +42 -0
  286. package/dist/dnd/DropTargetKeyboardNavigation.d.ts.map +1 -0
  287. package/dist/dnd/createDrag.d.ts.map +1 -1
  288. package/dist/dnd/createDraggableCollection.d.ts.map +1 -1
  289. package/dist/dnd/createDraggableItem.d.ts +12 -7
  290. package/dist/dnd/createDraggableItem.d.ts.map +1 -1
  291. package/dist/dnd/createDroppableCollection.d.ts +7 -15
  292. package/dist/dnd/createDroppableCollection.d.ts.map +1 -1
  293. package/dist/dnd/index.d.ts +5 -1
  294. package/dist/dnd/index.d.ts.map +1 -1
  295. package/dist/dnd/index.js +3 -2
  296. package/dist/dnd/index.jsx +3 -2
  297. package/dist/dnd/intl/index.d.ts +39 -0
  298. package/dist/dnd/intl/index.d.ts.map +1 -0
  299. package/dist/dnd/utils.d.ts +5 -0
  300. package/dist/dnd/utils.d.ts.map +1 -1
  301. package/dist/focus/FocusScope.d.ts +7 -0
  302. package/dist/focus/FocusScope.d.ts.map +1 -1
  303. package/dist/focus/index.d.ts +2 -1
  304. package/dist/focus/index.d.ts.map +1 -1
  305. package/dist/focus/index.js +3 -2
  306. package/dist/focus/index.jsx +3 -2
  307. package/dist/focus/virtualFocus.d.ts +26 -0
  308. package/dist/focus/virtualFocus.d.ts.map +1 -0
  309. package/dist/form/index.js +1 -1
  310. package/dist/form/index.jsx +1 -1
  311. package/dist/gridlist/createGridList.d.ts.map +1 -1
  312. package/dist/i18n/index.js +4 -2
  313. package/dist/i18n/index.jsx +4 -2
  314. package/dist/index.d.ts +3 -3
  315. package/dist/index.d.ts.map +1 -1
  316. package/dist/index.js +18 -12
  317. package/dist/index.jsx +18 -12
  318. package/dist/interactions/FocusableProvider.d.ts.map +1 -1
  319. package/dist/interactions/createFocus.d.ts.map +1 -1
  320. package/dist/interactions/createFocusWithin.d.ts.map +1 -1
  321. package/dist/interactions/createInteractionModality.d.ts.map +1 -1
  322. package/dist/interactions/index.js +1 -2
  323. package/dist/interactions/index.jsx +1 -2
  324. package/dist/label/createLabels.d.ts.map +1 -1
  325. package/dist/listbox/createListBox.d.ts.map +1 -1
  326. package/dist/listbox/createOption.d.ts +1 -1
  327. package/dist/listbox/createOption.d.ts.map +1 -1
  328. package/dist/live-announcer/index.js +1 -1
  329. package/dist/live-announcer/index.jsx +1 -1
  330. package/dist/select/createSelect.d.ts +2 -0
  331. package/dist/select/createSelect.d.ts.map +1 -1
  332. package/dist/selection/createSelectableItem.d.ts.map +1 -1
  333. package/dist/selection/index.js +2 -1
  334. package/dist/selection/index.jsx +2 -1
  335. package/dist/spinbutton/createSpinButton.d.ts +41 -0
  336. package/dist/spinbutton/createSpinButton.d.ts.map +1 -0
  337. package/dist/spinbutton/index.d.ts +3 -0
  338. package/dist/spinbutton/index.d.ts.map +1 -0
  339. package/dist/spinbutton/index.js +2 -0
  340. package/dist/spinbutton/index.jsx +2 -0
  341. package/dist/spinbutton/intl.d.ts +5 -0
  342. package/dist/spinbutton/intl.d.ts.map +1 -0
  343. package/dist/table/createTable.d.ts.map +1 -1
  344. package/dist/table/createTableColumnHeader.d.ts.map +1 -1
  345. package/dist/table/createTableRow.d.ts.map +1 -1
  346. package/dist/table/createTableSelectionCheckbox.d.ts.map +1 -1
  347. package/dist/table/types.d.ts +8 -0
  348. package/dist/table/types.d.ts.map +1 -1
  349. package/dist/table/utils.d.ts +15 -0
  350. package/dist/table/utils.d.ts.map +1 -0
  351. package/dist/tabs/createTabs.d.ts +1 -0
  352. package/dist/tabs/createTabs.d.ts.map +1 -1
  353. package/dist/tag/createTag.d.ts.map +1 -1
  354. package/dist/tag/createTagGroup.d.ts +7 -0
  355. package/dist/tag/createTagGroup.d.ts.map +1 -1
  356. package/dist/toolbar/createToolbar.d.ts.map +1 -1
  357. package/dist/tree/createTree.d.ts.map +1 -1
  358. package/dist/tree/createTreeSelectionCheckbox.d.ts.map +1 -1
  359. package/dist/utils/animation.d.ts.map +1 -1
  360. package/dist/utils/dom.d.ts +1 -0
  361. package/dist/utils/dom.d.ts.map +1 -1
  362. package/dist/utils/index.d.ts +1 -1
  363. package/dist/utils/index.d.ts.map +1 -1
  364. package/dist/utils/index.js +4 -3
  365. package/dist/utils/index.jsx +4 -3
  366. package/package.json +2 -2
  367. package/src/actiongroup/createActionGroup.ts +26 -109
  368. package/src/autocomplete/createAutocomplete.ts +136 -15
  369. package/src/breadcrumbs/createBreadcrumbs.ts +12 -4
  370. package/src/button/createToggleButtonGroup.ts +19 -14
  371. package/src/calendar/createCalendar.ts +3 -4
  372. package/src/calendar/createCalendarCell.ts +17 -3
  373. package/src/calendar/createCalendarGrid.ts +5 -4
  374. package/src/calendar/createRangeCalendar.ts +27 -17
  375. package/src/calendar/createRangeCalendarCell.ts +17 -3
  376. package/src/calendar/intl/index.ts +8 -0
  377. package/src/color/createColorArea.ts +17 -10
  378. package/src/color/createColorField.ts +8 -1
  379. package/src/color/createColorSlider.ts +1 -2
  380. package/src/color/createColorSwatch.ts +4 -2
  381. package/src/color/createColorWheel.ts +0 -6
  382. package/src/color/intl/index.ts +316 -0
  383. package/src/combobox/createComboBox.ts +35 -4
  384. package/src/combobox/intl/generated-locales.ts +635 -0
  385. package/src/combobox/intl/index.ts +8 -2
  386. package/src/datepicker/createDateField.ts +228 -213
  387. package/src/datepicker/createDatePicker.ts +157 -146
  388. package/src/datepicker/createDatePickerGroup.ts +88 -82
  389. package/src/datepicker/createDateRangePicker.ts +230 -179
  390. package/src/datepicker/createDateSegment.ts +386 -389
  391. package/src/datepicker/createDisplayNames.ts +45 -0
  392. package/src/datepicker/createTimeField.ts +36 -129
  393. package/src/datepicker/index.ts +13 -14
  394. package/src/datepicker/intl.ts +633 -0
  395. package/src/dnd/DragManager.ts +693 -0
  396. package/src/dnd/DropTargetKeyboardNavigation.ts +337 -0
  397. package/src/dnd/createDrag.ts +31 -5
  398. package/src/dnd/createDraggableCollection.ts +33 -15
  399. package/src/dnd/createDraggableItem.ts +92 -5
  400. package/src/dnd/createDroppableCollection.ts +487 -373
  401. package/src/dnd/index.ts +11 -0
  402. package/src/dnd/intl/ar-AE.json +29 -0
  403. package/src/dnd/intl/bg-BG.json +29 -0
  404. package/src/dnd/intl/cs-CZ.json +29 -0
  405. package/src/dnd/intl/da-DK.json +29 -0
  406. package/src/dnd/intl/de-DE.json +29 -0
  407. package/src/dnd/intl/el-GR.json +29 -0
  408. package/src/dnd/intl/en-US.json +29 -0
  409. package/src/dnd/intl/es-ES.json +29 -0
  410. package/src/dnd/intl/et-EE.json +29 -0
  411. package/src/dnd/intl/fi-FI.json +29 -0
  412. package/src/dnd/intl/fr-FR.json +29 -0
  413. package/src/dnd/intl/he-IL.json +29 -0
  414. package/src/dnd/intl/hr-HR.json +29 -0
  415. package/src/dnd/intl/hu-HU.json +29 -0
  416. package/src/dnd/intl/index.ts +139 -0
  417. package/src/dnd/intl/it-IT.json +29 -0
  418. package/src/dnd/intl/ja-JP.json +29 -0
  419. package/src/dnd/intl/ko-KR.json +29 -0
  420. package/src/dnd/intl/lt-LT.json +29 -0
  421. package/src/dnd/intl/lv-LV.json +29 -0
  422. package/src/dnd/intl/nb-NO.json +29 -0
  423. package/src/dnd/intl/nl-NL.json +29 -0
  424. package/src/dnd/intl/pl-PL.json +29 -0
  425. package/src/dnd/intl/pt-BR.json +29 -0
  426. package/src/dnd/intl/pt-PT.json +29 -0
  427. package/src/dnd/intl/ro-RO.json +29 -0
  428. package/src/dnd/intl/ru-RU.json +29 -0
  429. package/src/dnd/intl/sk-SK.json +29 -0
  430. package/src/dnd/intl/sl-SI.json +29 -0
  431. package/src/dnd/intl/sr-SP.json +29 -0
  432. package/src/dnd/intl/sv-SE.json +29 -0
  433. package/src/dnd/intl/tr-TR.json +29 -0
  434. package/src/dnd/intl/uk-UA.json +29 -0
  435. package/src/dnd/intl/zh-CN.json +29 -0
  436. package/src/dnd/intl/zh-TW.json +29 -0
  437. package/src/dnd/utils.ts +36 -0
  438. package/src/focus/FocusScope.tsx +120 -12
  439. package/src/focus/index.ts +8 -0
  440. package/src/focus/virtualFocus.ts +55 -0
  441. package/src/gridlist/createGridList.ts +52 -16
  442. package/src/index.ts +11 -3
  443. package/src/interactions/FocusableProvider.tsx +11 -6
  444. package/src/interactions/createFocus.ts +26 -21
  445. package/src/interactions/createFocusWithin.ts +23 -24
  446. package/src/interactions/createInteractionModality.ts +5 -3
  447. package/src/label/createLabels.ts +7 -4
  448. package/src/listbox/createListBox.ts +74 -2
  449. package/src/listbox/createOption.ts +16 -1
  450. package/src/select/createSelect.ts +23 -2
  451. package/src/selection/createSelectableItem.ts +14 -0
  452. package/src/spinbutton/createSpinButton.ts +163 -0
  453. package/src/spinbutton/index.ts +10 -0
  454. package/src/spinbutton/intl.ts +115 -0
  455. package/src/table/createTable.ts +26 -1
  456. package/src/table/createTableColumnHeader.ts +10 -0
  457. package/src/table/createTableRow.ts +10 -0
  458. package/src/table/createTableSelectionCheckbox.ts +24 -1
  459. package/src/table/types.ts +8 -0
  460. package/src/table/utils.ts +41 -0
  461. package/src/tabs/createTabs.ts +53 -12
  462. package/src/tag/createTag.ts +21 -32
  463. package/src/tag/createTagGroup.ts +92 -0
  464. package/src/toolbar/createToolbar.ts +6 -58
  465. package/src/tree/createTree.ts +69 -14
  466. package/src/tree/createTreeSelectionCheckbox.ts +14 -1
  467. package/src/utils/animation.ts +119 -27
  468. package/src/utils/dom.ts +3 -2
  469. package/src/utils/index.ts +2 -0
  470. package/dist/_chunk/createLongPress.js +0 -91
  471. package/dist/_chunk/createLongPress.js.map +0 -1
  472. package/dist/_chunk/createLongPress.jsx +0 -91
  473. package/dist/_chunk/createLongPress.jsx.map +0 -1
  474. package/dist/_chunk/form.js.map +0 -1
  475. package/dist/_chunk/form.jsx.map +0 -1
  476. package/dist/_chunk/live-announcer.js.map +0 -1
  477. package/dist/_chunk/live-announcer.jsx.map +0 -1
  478. package/dist/datepicker/createTimeSegment.d.ts +0 -29
  479. package/dist/datepicker/createTimeSegment.d.ts.map +0 -1
  480. package/src/datepicker/createTimeSegment.ts +0 -352
@@ -0,0 +1,693 @@
1
+ /**
2
+ * Global keyboard/virtual drag session manager.
3
+ *
4
+ * Faithful port of @react-aria/dnd `DragManager` (react-aria 3.50). A single
5
+ * module-level singleton owns the active drag session: it registers drop targets
6
+ * and drop items across every collection on the page, drives Tab/Shift+Tab
7
+ * cycling between them, Enter-to-drop / Escape-to-cancel, and the aria-live
8
+ * announcements — providing the accessible keyboard alternative to native
9
+ * pointer drag and drop.
10
+ *
11
+ * The only framework-specific adaptation from upstream is the reactive
12
+ * subscription: React's `useDragSession` (useState + a subscription Set) becomes
13
+ * a module-level Solid signal exposed through `createDragSession()`. Element refs
14
+ * (upstream `RefObject.current`) become Solid element accessors (`() => el`).
15
+ */
16
+
17
+ import { createSignal, type Accessor } from "solid-js";
18
+
19
+ import { announce } from "../live-announcer/announce";
20
+ import { ariaHideOutside } from "../overlays/ariaHideOutside";
21
+ import type {
22
+ DragEndEvent,
23
+ DragItem,
24
+ DropActivateEvent,
25
+ DropEnterEvent,
26
+ DropEvent,
27
+ DropExitEvent,
28
+ DropItem,
29
+ DropOperation,
30
+ DropTarget as DroppableCollectionTarget,
31
+ } from "@proyecto-viviana/solid-stately";
32
+ import { getActiveElement, getEventTarget, nodeContains } from "../utils/dom";
33
+ import { getDragModality, getTypes } from "./utils";
34
+ import { isVirtualClick, isVirtualPointerEvent } from "../utils/events";
35
+ import type { LocalizedStringFormatter } from "@internationalized/string";
36
+
37
+ /** A Solid element accessor, replacing upstream's `RefObject<T>.current`. */
38
+ type ElementAccessor = () => HTMLElement | null;
39
+
40
+ let dropTargets = new Map<Element, DropTarget>();
41
+ let dropItems = new Map<Element, DroppableItem>();
42
+ let dragSession: DragSession | null = null;
43
+
44
+ // Reactive mirror of `dragSession` for `createDragSession()`. Solid's signal is
45
+ // the notification mechanism, replacing upstream's `subscriptions` Set.
46
+ const [trackedDragSession, setTrackedDragSession] = createSignal<DragSession | null>(null);
47
+
48
+ interface DropTarget {
49
+ element: HTMLElement;
50
+ preventFocusOnDrop?: boolean;
51
+ getDropOperation?: (types: Set<string>, allowedOperations: DropOperation[]) => DropOperation;
52
+ onDropEnter?: (e: DropEnterEvent, dragTarget: DragTarget) => void;
53
+ onDropExit?: (e: DropExitEvent) => void;
54
+ onDropTargetEnter?: (target: DroppableCollectionTarget | null) => void;
55
+ onDropActivate?: (e: DropActivateEvent, target: DroppableCollectionTarget | null) => void;
56
+ onDrop?: (e: DropEvent, target: DroppableCollectionTarget | null) => void;
57
+ onKeyDown?: (e: KeyboardEvent, dragTarget: DragTarget) => void;
58
+ activateButtonRef?: ElementAccessor;
59
+ }
60
+
61
+ export function registerDropTarget(target: DropTarget): () => void {
62
+ dropTargets.set(target.element, target);
63
+ dragSession?.updateValidDropTargets();
64
+ return (): void => {
65
+ dropTargets.delete(target.element);
66
+ dragSession?.updateValidDropTargets();
67
+ };
68
+ }
69
+
70
+ interface DroppableItem {
71
+ element: HTMLElement;
72
+ target: DroppableCollectionTarget;
73
+ getDropOperation?: (types: Set<string>, allowedOperations: DropOperation[]) => DropOperation;
74
+ activateButtonRef?: ElementAccessor;
75
+ }
76
+
77
+ export function registerDropItem(item: DroppableItem): () => void {
78
+ dropItems.set(item.element, item);
79
+ return (): void => {
80
+ dropItems.delete(item.element);
81
+ };
82
+ }
83
+
84
+ interface DragTarget {
85
+ element: HTMLElement;
86
+ items: DragItem[];
87
+ allowedDropOperations: DropOperation[];
88
+ onDragEnd?: (e: DragEndEvent) => void;
89
+ }
90
+
91
+ export function beginDragging(target: DragTarget, stringFormatter: LocalizedStringFormatter): void {
92
+ if (dragSession) {
93
+ throw new Error("Cannot begin dragging while already dragging");
94
+ }
95
+
96
+ dragSession = new DragSession(target, stringFormatter);
97
+ setTrackedDragSession(dragSession);
98
+ requestAnimationFrame(() => {
99
+ if (dragSession) {
100
+ dragSession.setup();
101
+ if (getDragModality() === "keyboard") {
102
+ dragSession.next();
103
+ }
104
+ }
105
+ });
106
+ }
107
+
108
+ /** Reactive accessor for the active drag session, or null. */
109
+ export function createDragSession(): Accessor<DragSession | null> {
110
+ return trackedDragSession;
111
+ }
112
+
113
+ /** @private */
114
+ export function isVirtualDragging(): boolean {
115
+ return !!dragSession;
116
+ }
117
+
118
+ function endDragging() {
119
+ dragSession = null;
120
+ setTrackedDragSession(null);
121
+ }
122
+
123
+ export function isValidDropTarget(element: Element): boolean {
124
+ for (let target of dropTargets.keys()) {
125
+ if (nodeContains(target, element)) {
126
+ return true;
127
+ }
128
+ }
129
+
130
+ return false;
131
+ }
132
+
133
+ const CANCELED_EVENTS = [
134
+ "pointerdown",
135
+ "pointermove",
136
+ "pointerenter",
137
+ "pointerleave",
138
+ "pointerover",
139
+ "pointerout",
140
+ "pointerup",
141
+ "mousedown",
142
+ "mousemove",
143
+ "mouseenter",
144
+ "mouseleave",
145
+ "mouseover",
146
+ "mouseout",
147
+ "mouseup",
148
+ "touchstart",
149
+ "touchmove",
150
+ "touchend",
151
+ "focusin",
152
+ "focusout",
153
+ ];
154
+
155
+ const CLICK_EVENTS = ["pointerup", "mouseup", "touchend"];
156
+
157
+ const MESSAGES = {
158
+ keyboard: "dragStartedKeyboard",
159
+ touch: "dragStartedTouch",
160
+ virtual: "dragStartedVirtual",
161
+ };
162
+
163
+ class DragSession {
164
+ dragTarget: DragTarget;
165
+ validDropTargets: DropTarget[] = [];
166
+ currentDropTarget: DropTarget | null = null;
167
+ currentDropItem: DroppableItem | null = null;
168
+ dropOperation: DropOperation | null = null;
169
+ private mutationObserver: MutationObserver | null = null;
170
+ private restoreAriaHidden: (() => void) | null = null;
171
+ private stringFormatter: LocalizedStringFormatter;
172
+ private isVirtualClick: boolean = false;
173
+ private initialFocused: boolean;
174
+
175
+ constructor(target: DragTarget, stringFormatter: LocalizedStringFormatter) {
176
+ this.dragTarget = target;
177
+ this.stringFormatter = stringFormatter;
178
+
179
+ this.onKeyDown = this.onKeyDown.bind(this);
180
+ this.onKeyUp = this.onKeyUp.bind(this);
181
+ this.onFocus = this.onFocus.bind(this);
182
+ this.onBlur = this.onBlur.bind(this);
183
+ this.onClick = this.onClick.bind(this);
184
+ this.onPointerDown = this.onPointerDown.bind(this);
185
+ this.cancelEvent = this.cancelEvent.bind(this);
186
+ this.initialFocused = false;
187
+ }
188
+
189
+ setup(): void {
190
+ document.addEventListener("keydown", this.onKeyDown, true);
191
+ document.addEventListener("keyup", this.onKeyUp, true);
192
+ window.addEventListener("focus", this.onFocus, true);
193
+ window.addEventListener("blur", this.onBlur, true);
194
+ document.addEventListener("click", this.onClick, true);
195
+ document.addEventListener("pointerdown", this.onPointerDown, true);
196
+
197
+ for (let event of CANCELED_EVENTS) {
198
+ document.addEventListener(event, this.cancelEvent, true);
199
+ }
200
+
201
+ this.mutationObserver = new MutationObserver(() => this.updateValidDropTargets());
202
+ this.updateValidDropTargets();
203
+
204
+ announce(this.stringFormatter.format(MESSAGES[getDragModality() as keyof typeof MESSAGES]));
205
+ }
206
+
207
+ teardown(): void {
208
+ document.removeEventListener("keydown", this.onKeyDown, true);
209
+ document.removeEventListener("keyup", this.onKeyUp, true);
210
+ window.removeEventListener("focus", this.onFocus, true);
211
+ window.removeEventListener("blur", this.onBlur, true);
212
+ document.removeEventListener("click", this.onClick, true);
213
+ document.removeEventListener("pointerdown", this.onPointerDown, true);
214
+
215
+ for (let event of CANCELED_EVENTS) {
216
+ document.removeEventListener(event, this.cancelEvent, true);
217
+ }
218
+
219
+ this.mutationObserver?.disconnect();
220
+ this.restoreAriaHidden?.();
221
+ }
222
+
223
+ onKeyDown(e: KeyboardEvent): void {
224
+ this.cancelEvent(e);
225
+
226
+ if (e.key === "Escape") {
227
+ this.cancel();
228
+ return;
229
+ }
230
+
231
+ if (e.key === "Tab" && !(e.metaKey || e.altKey || e.ctrlKey)) {
232
+ if (e.shiftKey) {
233
+ this.previous();
234
+ } else {
235
+ this.next();
236
+ }
237
+ }
238
+
239
+ if (typeof this.currentDropTarget?.onKeyDown === "function") {
240
+ this.currentDropTarget.onKeyDown(e, this.dragTarget);
241
+ }
242
+ }
243
+
244
+ onKeyUp(e: KeyboardEvent): void {
245
+ this.cancelEvent(e);
246
+
247
+ if (e.key === "Enter") {
248
+ if (
249
+ e.altKey ||
250
+ nodeContains(this.getCurrentActivateButton(), getEventTarget<Node>(e))
251
+ ) {
252
+ this.activate(this.currentDropTarget, this.currentDropItem);
253
+ } else {
254
+ this.drop();
255
+ }
256
+ }
257
+ }
258
+
259
+ getCurrentActivateButton(): HTMLElement | null {
260
+ return (
261
+ this.currentDropItem?.activateButtonRef?.() ??
262
+ this.currentDropTarget?.activateButtonRef?.() ??
263
+ null
264
+ );
265
+ }
266
+
267
+ onFocus(e: FocusEvent): void {
268
+ let activateButton = this.getCurrentActivateButton();
269
+ let eventTarget = getEventTarget<HTMLElement>(e);
270
+ if (eventTarget === activateButton) {
271
+ // TODO: canceling this breaks the focus ring. Revisit when we support tabbing.
272
+ this.cancelEvent(e);
273
+ return;
274
+ }
275
+
276
+ // Prevent focus events, except to the original drag target.
277
+ if (eventTarget !== this.dragTarget.element) {
278
+ this.cancelEvent(e);
279
+ }
280
+
281
+ // Ignore focus events on the window/document (JSDOM). Will be handled in onBlur, below.
282
+ if (!(eventTarget instanceof HTMLElement) || eventTarget === this.dragTarget.element) {
283
+ return;
284
+ }
285
+
286
+ let dropTarget =
287
+ this.validDropTargets.find((target) => target.element === eventTarget) ||
288
+ this.validDropTargets.find((target) => nodeContains(target.element, eventTarget));
289
+
290
+ if (!dropTarget) {
291
+ if (this.currentDropTarget) {
292
+ this.currentDropTarget.element.focus();
293
+ } else {
294
+ this.dragTarget.element.focus();
295
+ }
296
+ return;
297
+ }
298
+
299
+ let item = dropItems.get(eventTarget);
300
+ if (dropTarget) {
301
+ this.setCurrentDropTarget(dropTarget, item);
302
+ }
303
+ }
304
+
305
+ onBlur(e: FocusEvent): void {
306
+ let activateButton = this.getCurrentActivateButton();
307
+ // Guard activateButton non-null so this doesn't trip on the case where
308
+ // there's no activate button and the focused element loses focus to nothing
309
+ // (browsers and jsdom 26+ both set relatedTarget to null in that case).
310
+ if (activateButton && e.relatedTarget === activateButton) {
311
+ this.cancelEvent(e);
312
+ return;
313
+ }
314
+
315
+ if (getEventTarget(e) !== this.dragTarget.element) {
316
+ this.cancelEvent(e);
317
+ }
318
+
319
+ // If nothing is gaining focus, or e.relatedTarget is the window/document (JSDOM),
320
+ // restore focus back to the current drop target if any, or the original drag target.
321
+ if (!e.relatedTarget || !(e.relatedTarget instanceof HTMLElement)) {
322
+ if (this.currentDropTarget) {
323
+ this.currentDropTarget.element.focus();
324
+ } else {
325
+ this.dragTarget.element.focus();
326
+ }
327
+ }
328
+ }
329
+
330
+ onClick(e: MouseEvent): void {
331
+ this.cancelEvent(e);
332
+ if (isVirtualClick(e) || this.isVirtualClick) {
333
+ let dropElements = dropItems.values();
334
+ let eventTarget = getEventTarget<HTMLElement>(e);
335
+ let item = [...dropElements].find(
336
+ (item) =>
337
+ item.element === eventTarget ||
338
+ nodeContains(item.activateButtonRef?.() ?? null, eventTarget),
339
+ );
340
+ let dropTarget = this.validDropTargets.find((target) =>
341
+ nodeContains(target.element, eventTarget),
342
+ );
343
+ let activateButton = item?.activateButtonRef?.() ?? dropTarget?.activateButtonRef?.() ?? null;
344
+ if (nodeContains(activateButton, eventTarget) && dropTarget) {
345
+ this.activate(dropTarget, item);
346
+ return;
347
+ }
348
+
349
+ if (getEventTarget(e) === this.dragTarget.element) {
350
+ this.cancel();
351
+ return;
352
+ }
353
+
354
+ if (dropTarget) {
355
+ this.setCurrentDropTarget(dropTarget, item);
356
+ this.drop(item);
357
+ }
358
+ }
359
+ }
360
+
361
+ onPointerDown(e: PointerEvent): void {
362
+ // Android Talkback double tap has e.detail = 1 for onClick. Detect the virtual click in onPointerDown before onClick fires
363
+ // so we can properly perform cancel and drop operations.
364
+ this.cancelEvent(e);
365
+ this.isVirtualClick = isVirtualPointerEvent(e);
366
+ }
367
+
368
+ cancelEvent(e: Event): void {
369
+ // Allow focusin and focusout on the drag target so focus ring works properly.
370
+ let eventTarget = getEventTarget(e);
371
+ if (
372
+ (e.type === "focusin" || e.type === "focusout") &&
373
+ (eventTarget === this.dragTarget?.element || eventTarget === this.getCurrentActivateButton())
374
+ ) {
375
+ return;
376
+ }
377
+
378
+ // Allow default for events that might cancel a click event
379
+ if (!CLICK_EVENTS.includes(e.type)) {
380
+ e.preventDefault();
381
+ }
382
+
383
+ e.stopPropagation();
384
+ e.stopImmediatePropagation();
385
+ }
386
+
387
+ updateValidDropTargets(): void {
388
+ if (!this.mutationObserver) {
389
+ return;
390
+ }
391
+
392
+ this.mutationObserver.disconnect();
393
+ if (this.restoreAriaHidden) {
394
+ this.restoreAriaHidden();
395
+ }
396
+
397
+ this.validDropTargets = findValidDropTargets(this.dragTarget);
398
+
399
+ // Shuffle drop target order based on starting drag target.
400
+ if (this.validDropTargets.length > 0) {
401
+ let nearestIndex = this.findNearestDropTarget();
402
+ this.validDropTargets = [
403
+ ...this.validDropTargets.slice(nearestIndex),
404
+ ...this.validDropTargets.slice(0, nearestIndex),
405
+ ];
406
+ }
407
+
408
+ if (this.currentDropTarget && !this.validDropTargets.includes(this.currentDropTarget)) {
409
+ this.setCurrentDropTarget(this.validDropTargets[0]);
410
+ }
411
+
412
+ // Find valid drop items within collections
413
+ let types = getTypes(this.dragTarget.items);
414
+ let validDropItems = [...dropItems.values()].filter((item) => {
415
+ if (typeof item.getDropOperation === "function") {
416
+ return item.getDropOperation(types, this.dragTarget.allowedDropOperations) !== "cancel";
417
+ }
418
+
419
+ return true;
420
+ });
421
+
422
+ // Filter out drop targets that contain valid items. We don't want to stop hiding elements
423
+ // other than the drop items that exist inside the collection.
424
+ let visibleDropTargets = this.validDropTargets.filter(
425
+ (target) => !validDropItems.some((item) => nodeContains(target.element, item.element)),
426
+ );
427
+
428
+ this.restoreAriaHidden = ariaHideOutside(
429
+ [
430
+ this.dragTarget.element,
431
+ ...validDropItems.flatMap((item) => {
432
+ let button = item.activateButtonRef?.();
433
+ return button ? [item.element, button] : [item.element];
434
+ }),
435
+ ...visibleDropTargets.flatMap((target) => {
436
+ let button = target.activateButtonRef?.();
437
+ return button ? [target.element, button] : [target.element];
438
+ }),
439
+ ],
440
+ { shouldUseInert: true },
441
+ );
442
+
443
+ this.mutationObserver.observe(document.body, {
444
+ subtree: true,
445
+ attributes: true,
446
+ attributeFilter: ["aria-hidden", "inert"],
447
+ });
448
+ }
449
+
450
+ next(): void {
451
+ // TODO: Allow tabbing to the activate button. Revisit once we fix the focus ring.
452
+ // For now, the activate button is reachable by screen readers and ArrowLeft/ArrowRight
453
+ // is usable specifically by Tree. Will need tabbing for other components.
454
+
455
+ if (!this.currentDropTarget) {
456
+ this.setCurrentDropTarget(this.validDropTargets[0]);
457
+ return;
458
+ }
459
+
460
+ let index = this.validDropTargets.indexOf(this.currentDropTarget);
461
+ if (index < 0) {
462
+ this.setCurrentDropTarget(this.validDropTargets[0]);
463
+ return;
464
+ }
465
+
466
+ // If we've reached the end of the valid drop targets, cycle back to the original drag target.
467
+ // This lets the user cancel the drag in case they don't have an Escape key (e.g. iPad keyboard case).
468
+ if (index === this.validDropTargets.length - 1) {
469
+ if (!this.dragTarget.element.closest('[aria-hidden="true"], [inert]')) {
470
+ this.setCurrentDropTarget(null);
471
+ this.dragTarget.element.focus();
472
+ } else {
473
+ this.setCurrentDropTarget(this.validDropTargets[0]);
474
+ }
475
+ } else {
476
+ this.setCurrentDropTarget(this.validDropTargets[index + 1]);
477
+ }
478
+ }
479
+
480
+ previous(): void {
481
+ if (!this.currentDropTarget) {
482
+ this.setCurrentDropTarget(this.validDropTargets[this.validDropTargets.length - 1]);
483
+ return;
484
+ }
485
+
486
+ let index = this.validDropTargets.indexOf(this.currentDropTarget);
487
+ if (index < 0) {
488
+ this.setCurrentDropTarget(this.validDropTargets[this.validDropTargets.length - 1]);
489
+ return;
490
+ }
491
+
492
+ // If we've reached the start of the valid drop targets, cycle back to the original drag target.
493
+ // This lets the user cancel the drag in case they don't have an Escape key (e.g. iPad keyboard case).
494
+ if (index === 0) {
495
+ if (!this.dragTarget.element.closest('[aria-hidden="true"], [inert]')) {
496
+ this.setCurrentDropTarget(null);
497
+ this.dragTarget.element.focus();
498
+ } else {
499
+ this.setCurrentDropTarget(this.validDropTargets[this.validDropTargets.length - 1]);
500
+ }
501
+ } else {
502
+ this.setCurrentDropTarget(this.validDropTargets[index - 1]);
503
+ }
504
+ }
505
+
506
+ findNearestDropTarget(): number {
507
+ let dragTargetRect = this.dragTarget.element.getBoundingClientRect();
508
+
509
+ let minDistance = Infinity;
510
+ let nearest = -1;
511
+ for (let i = 0; i < this.validDropTargets.length; i++) {
512
+ let dropTarget = this.validDropTargets[i];
513
+ let rect = dropTarget.element.getBoundingClientRect();
514
+ let dx = rect.left - dragTargetRect.left;
515
+ let dy = rect.top - dragTargetRect.top;
516
+ let dist = dx * dx + dy * dy;
517
+ if (dist < minDistance) {
518
+ minDistance = dist;
519
+ nearest = i;
520
+ }
521
+ }
522
+
523
+ return nearest;
524
+ }
525
+
526
+ setCurrentDropTarget(dropTarget: DropTarget | null, item?: DroppableItem): void {
527
+ if (dropTarget !== this.currentDropTarget) {
528
+ if (this.currentDropTarget && typeof this.currentDropTarget.onDropExit === "function") {
529
+ let rect = this.currentDropTarget.element.getBoundingClientRect();
530
+ this.currentDropTarget.onDropExit({
531
+ type: "dropexit",
532
+ x: rect.left + rect.width / 2,
533
+ y: rect.top + rect.height / 2,
534
+ });
535
+ }
536
+
537
+ this.currentDropTarget = dropTarget;
538
+
539
+ if (dropTarget) {
540
+ if (typeof dropTarget.onDropEnter === "function") {
541
+ let rect = dropTarget.element.getBoundingClientRect();
542
+ dropTarget.onDropEnter(
543
+ {
544
+ type: "dropenter",
545
+ x: rect.left + rect.width / 2,
546
+ y: rect.top + rect.height / 2,
547
+ },
548
+ this.dragTarget,
549
+ );
550
+ }
551
+
552
+ if (!item) {
553
+ dropTarget?.element.focus();
554
+ }
555
+ }
556
+ }
557
+
558
+ if (item != null && item !== this.currentDropItem) {
559
+ if (this.currentDropTarget && typeof this.currentDropTarget.onDropTargetEnter === "function") {
560
+ this.currentDropTarget.onDropTargetEnter(item.target);
561
+ }
562
+ item.element.focus();
563
+ this.currentDropItem = item;
564
+
565
+ // Announce first drop target after drag start announcement finishes.
566
+ // Otherwise, it will never get announced because drag start announcement is assertive.
567
+ if (!this.initialFocused) {
568
+ let label = item?.element.getAttribute("aria-label");
569
+ if (label) {
570
+ announce(label, "polite");
571
+ }
572
+ this.initialFocused = true;
573
+ }
574
+ }
575
+ }
576
+
577
+ end(): void {
578
+ this.teardown();
579
+ endDragging();
580
+
581
+ if (typeof this.dragTarget.onDragEnd === "function") {
582
+ let target =
583
+ this.currentDropTarget && this.dropOperation !== "cancel"
584
+ ? this.currentDropTarget
585
+ : this.dragTarget;
586
+ let rect = target.element.getBoundingClientRect();
587
+ this.dragTarget.onDragEnd({
588
+ type: "dragend",
589
+ x: rect.x + rect.width / 2,
590
+ y: rect.y + rect.height / 2,
591
+ dropOperation: this.dropOperation || "cancel",
592
+ });
593
+ }
594
+
595
+ if (this.currentDropTarget && !this.currentDropTarget.preventFocusOnDrop) {
596
+ // Re-trigger focus event on active element, since it will not have received it during dragging (see cancelEvent).
597
+ // This corrects state such as whether focus ring should appear.
598
+ // useDroppableCollection handles this itself, so this is only for standalone drop zones.
599
+ getActiveElement()?.dispatchEvent(new FocusEvent("focusin", { bubbles: true }));
600
+ }
601
+
602
+ this.setCurrentDropTarget(null);
603
+ }
604
+
605
+ cancel(): void {
606
+ this.setCurrentDropTarget(null);
607
+ this.end();
608
+ if (!this.dragTarget.element.closest('[aria-hidden="true"], [inert]')) {
609
+ this.dragTarget.element.focus();
610
+ }
611
+
612
+ // Re-trigger focus event on active element, since it will not have received it during dragging (see cancelEvent).
613
+ getActiveElement()?.dispatchEvent(new FocusEvent("focusin", { bubbles: true }));
614
+
615
+ announce(this.stringFormatter.format("dropCanceled"));
616
+ }
617
+
618
+ drop(item?: DroppableItem): void {
619
+ if (!this.currentDropTarget) {
620
+ this.cancel();
621
+ return;
622
+ }
623
+
624
+ if (typeof item?.getDropOperation === "function") {
625
+ let types = getTypes(this.dragTarget.items);
626
+ this.dropOperation = item.getDropOperation(types, this.dragTarget.allowedDropOperations);
627
+ } else if (typeof this.currentDropTarget.getDropOperation === "function") {
628
+ let types = getTypes(this.dragTarget.items);
629
+ this.dropOperation = this.currentDropTarget.getDropOperation(
630
+ types,
631
+ this.dragTarget.allowedDropOperations,
632
+ );
633
+ } else {
634
+ // TODO: show menu ??
635
+ this.dropOperation = this.dragTarget.allowedDropOperations[0];
636
+ }
637
+
638
+ if (typeof this.currentDropTarget.onDrop === "function") {
639
+ let items: DropItem[] = this.dragTarget.items.map((item) => ({
640
+ kind: "text",
641
+ types: new Set(Object.keys(item)),
642
+ getText: (type: string) => Promise.resolve(item[type]),
643
+ }));
644
+
645
+ let rect = this.currentDropTarget.element.getBoundingClientRect();
646
+ this.currentDropTarget.onDrop(
647
+ {
648
+ type: "drop",
649
+ x: rect.left + rect.width / 2,
650
+ y: rect.top + rect.height / 2,
651
+ items,
652
+ dropOperation: this.dropOperation,
653
+ },
654
+ item?.target ?? null,
655
+ );
656
+ }
657
+
658
+ this.end();
659
+ announce(this.stringFormatter.format("dropComplete"));
660
+ }
661
+
662
+ activate(dropTarget: DropTarget | null, dropItem: DroppableItem | null | undefined): void {
663
+ if (dropTarget && typeof dropTarget.onDropActivate === "function") {
664
+ let target = dropItem?.target ?? null;
665
+ let rect = dropTarget.element.getBoundingClientRect();
666
+ dropTarget.onDropActivate(
667
+ {
668
+ type: "dropactivate",
669
+ x: rect.left + rect.width / 2,
670
+ y: rect.top + rect.height / 2,
671
+ },
672
+ target,
673
+ );
674
+ }
675
+ }
676
+ }
677
+
678
+ function findValidDropTargets(options: DragTarget): DropTarget[] {
679
+ let types = getTypes(options.items);
680
+ return [...dropTargets.values()].filter((target) => {
681
+ if (target.element.closest('[aria-hidden="true"], [inert]')) {
682
+ return false;
683
+ }
684
+
685
+ if (typeof target.getDropOperation === "function") {
686
+ return target.getDropOperation(types, options.allowedDropOperations) !== "cancel";
687
+ }
688
+
689
+ return true;
690
+ });
691
+ }
692
+
693
+ export type { DragTarget, DropTarget, DroppableItem, DragSession };