@proyecto-viviana/solidaria 0.2.8 → 0.4.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +31 -236
- package/dist/_chunk/actiongroup.js +207 -0
- package/dist/_chunk/actiongroup.js.map +1 -0
- package/dist/_chunk/actiongroup.jsx +207 -0
- package/dist/_chunk/actiongroup.jsx.map +1 -0
- package/dist/_chunk/ariaHideOutside.js +122 -0
- package/dist/_chunk/ariaHideOutside.js.map +1 -0
- package/dist/_chunk/ariaHideOutside.jsx +122 -0
- package/dist/_chunk/ariaHideOutside.jsx.map +1 -0
- package/dist/_chunk/autocomplete.js +196 -0
- package/dist/_chunk/autocomplete.js.map +1 -0
- package/dist/_chunk/autocomplete.jsx +196 -0
- package/dist/_chunk/autocomplete.jsx.map +1 -0
- package/dist/_chunk/breadcrumbs.js +119 -0
- package/dist/_chunk/breadcrumbs.js.map +1 -0
- package/dist/_chunk/breadcrumbs.jsx +119 -0
- package/dist/_chunk/breadcrumbs.jsx.map +1 -0
- package/dist/_chunk/button.js +276 -0
- package/dist/_chunk/button.js.map +1 -0
- package/dist/_chunk/button.jsx +276 -0
- package/dist/_chunk/button.jsx.map +1 -0
- package/dist/_chunk/calendar.js +1036 -0
- package/dist/_chunk/calendar.js.map +1 -0
- package/dist/_chunk/calendar.jsx +1036 -0
- package/dist/_chunk/calendar.jsx.map +1 -0
- package/dist/_chunk/checkbox.js +234 -0
- package/dist/_chunk/checkbox.js.map +1 -0
- package/dist/_chunk/checkbox.jsx +234 -0
- package/dist/_chunk/checkbox.jsx.map +1 -0
- package/dist/_chunk/color.js +1174 -0
- package/dist/_chunk/color.js.map +1 -0
- package/dist/_chunk/color.jsx +1174 -0
- package/dist/_chunk/color.jsx.map +1 -0
- package/dist/_chunk/combobox.js +436 -0
- package/dist/_chunk/combobox.js.map +1 -0
- package/dist/_chunk/combobox.jsx +436 -0
- package/dist/_chunk/combobox.jsx.map +1 -0
- package/dist/_chunk/createCollator.js +229 -0
- package/dist/_chunk/createCollator.js.map +1 -0
- package/dist/_chunk/createCollator.jsx +223 -0
- package/dist/_chunk/createCollator.jsx.map +1 -0
- package/dist/_chunk/createCollectionRowInteraction.js +133 -0
- package/dist/_chunk/createCollectionRowInteraction.js.map +1 -0
- package/dist/_chunk/createCollectionRowInteraction.jsx +133 -0
- package/dist/_chunk/createCollectionRowInteraction.jsx.map +1 -0
- package/dist/_chunk/createField.js +54 -0
- package/dist/_chunk/createField.js.map +1 -0
- package/dist/_chunk/createField.jsx +54 -0
- package/dist/_chunk/createField.jsx.map +1 -0
- package/dist/_chunk/createFocus.js +101 -0
- package/dist/_chunk/createFocus.js.map +1 -0
- package/dist/_chunk/createFocus.jsx +101 -0
- package/dist/_chunk/createFocus.jsx.map +1 -0
- package/dist/_chunk/createFocusRing.js +54 -0
- package/dist/_chunk/createFocusRing.js.map +1 -0
- package/dist/_chunk/createFocusRing.jsx +54 -0
- package/dist/_chunk/createFocusRing.jsx.map +1 -0
- package/dist/_chunk/createFocusWithin.js +121 -0
- package/dist/_chunk/createFocusWithin.js.map +1 -0
- package/dist/_chunk/createFocusWithin.jsx +121 -0
- package/dist/_chunk/createFocusWithin.jsx.map +1 -0
- package/dist/_chunk/createFocusable.js +131 -0
- package/dist/_chunk/createFocusable.js.map +1 -0
- package/dist/_chunk/createFocusable.jsx +131 -0
- package/dist/_chunk/createFocusable.jsx.map +1 -0
- package/dist/_chunk/createFormValidation.js +135 -0
- package/dist/_chunk/createFormValidation.js.map +1 -0
- package/dist/_chunk/createFormValidation.jsx +135 -0
- package/dist/_chunk/createFormValidation.jsx.map +1 -0
- package/dist/_chunk/createHover.js +130 -0
- package/dist/_chunk/createHover.js.map +1 -0
- package/dist/_chunk/createHover.jsx +130 -0
- package/dist/_chunk/createHover.jsx.map +1 -0
- package/dist/_chunk/createInteractionModality.js +269 -0
- package/dist/_chunk/createInteractionModality.js.map +1 -0
- package/dist/_chunk/createInteractionModality.jsx +269 -0
- package/dist/_chunk/createInteractionModality.jsx.map +1 -0
- package/dist/_chunk/createLabel.js +46 -0
- package/dist/_chunk/createLabel.js.map +1 -0
- package/dist/_chunk/createLabel.jsx +46 -0
- package/dist/_chunk/createLabel.jsx.map +1 -0
- package/dist/_chunk/createLabels.js +31 -0
- package/dist/_chunk/createLabels.js.map +1 -0
- package/dist/_chunk/createLabels.jsx +31 -0
- package/dist/_chunk/createLabels.jsx.map +1 -0
- package/dist/_chunk/createLandmark.js +198 -0
- package/dist/_chunk/createLandmark.js.map +1 -0
- package/dist/_chunk/createLandmark.jsx +198 -0
- package/dist/_chunk/createLandmark.jsx.map +1 -0
- package/dist/_chunk/createLongPress.js +91 -0
- package/dist/_chunk/createLongPress.js.map +1 -0
- package/dist/_chunk/createLongPress.jsx +91 -0
- package/dist/_chunk/createLongPress.jsx.map +1 -0
- package/dist/_chunk/createOverlay.js +327 -0
- package/dist/_chunk/createOverlay.js.map +1 -0
- package/dist/_chunk/createOverlay.jsx +327 -0
- package/dist/_chunk/createOverlay.jsx.map +1 -0
- package/dist/_chunk/createPress.js +526 -0
- package/dist/_chunk/createPress.js.map +1 -0
- package/dist/_chunk/createPress.jsx +526 -0
- package/dist/_chunk/createPress.jsx.map +1 -0
- package/dist/_chunk/createProgressBar.js +81 -0
- package/dist/_chunk/createProgressBar.js.map +1 -0
- package/dist/_chunk/createProgressBar.jsx +81 -0
- package/dist/_chunk/createProgressBar.jsx.map +1 -0
- package/dist/_chunk/createSelectableItem.js +298 -0
- package/dist/_chunk/createSelectableItem.js.map +1 -0
- package/dist/_chunk/createSelectableItem.jsx +298 -0
- package/dist/_chunk/createSelectableItem.jsx.map +1 -0
- package/dist/_chunk/createToggle.js +158 -0
- package/dist/_chunk/createToggle.js.map +1 -0
- package/dist/_chunk/createToggle.jsx +158 -0
- package/dist/_chunk/createToggle.jsx.map +1 -0
- package/dist/_chunk/createTypeSelect.js +125 -0
- package/dist/_chunk/createTypeSelect.js.map +1 -0
- package/dist/_chunk/createTypeSelect.jsx +125 -0
- package/dist/_chunk/createTypeSelect.jsx.map +1 -0
- package/dist/_chunk/datepicker.js +1393 -0
- package/dist/_chunk/datepicker.js.map +1 -0
- package/dist/_chunk/datepicker.jsx +1393 -0
- package/dist/_chunk/datepicker.jsx.map +1 -0
- package/dist/_chunk/dialog.js +62 -0
- package/dist/_chunk/dialog.js.map +1 -0
- package/dist/_chunk/dialog.jsx +62 -0
- package/dist/_chunk/dialog.jsx.map +1 -0
- package/dist/_chunk/disclosure.js +185 -0
- package/dist/_chunk/disclosure.js.map +1 -0
- package/dist/_chunk/disclosure.jsx +185 -0
- package/dist/_chunk/disclosure.jsx.map +1 -0
- package/dist/_chunk/dnd.js +1304 -0
- package/dist/_chunk/dnd.js.map +1 -0
- package/dist/_chunk/dnd.jsx +1304 -0
- package/dist/_chunk/dnd.jsx.map +1 -0
- package/dist/_chunk/env.js +105 -0
- package/dist/_chunk/env.js.map +1 -0
- package/dist/_chunk/env.jsx +105 -0
- package/dist/_chunk/env.jsx.map +1 -0
- package/dist/_chunk/filterDOMProps.js +82 -0
- package/dist/_chunk/filterDOMProps.js.map +1 -0
- package/dist/_chunk/filterDOMProps.jsx +82 -0
- package/dist/_chunk/filterDOMProps.jsx.map +1 -0
- package/dist/_chunk/focus.js +399 -0
- package/dist/_chunk/focus.js.map +1 -0
- package/dist/_chunk/focus.jsx +399 -0
- package/dist/_chunk/focus.jsx.map +1 -0
- package/dist/_chunk/focus2.js +895 -0
- package/dist/_chunk/focus2.js.map +1 -0
- package/dist/_chunk/focus2.jsx +870 -0
- package/dist/_chunk/focus2.jsx.map +1 -0
- package/dist/_chunk/form.js +39 -0
- package/dist/_chunk/form.js.map +1 -0
- package/dist/_chunk/form.jsx +39 -0
- package/dist/_chunk/form.jsx.map +1 -0
- package/dist/_chunk/grid.js +623 -0
- package/dist/_chunk/grid.js.map +1 -0
- package/dist/_chunk/grid.jsx +623 -0
- package/dist/_chunk/grid.jsx.map +1 -0
- package/dist/_chunk/gridlist.js +364 -0
- package/dist/_chunk/gridlist.js.map +1 -0
- package/dist/_chunk/gridlist.jsx +364 -0
- package/dist/_chunk/gridlist.jsx.map +1 -0
- package/dist/_chunk/i18n.js +254 -0
- package/dist/_chunk/i18n.js.map +1 -0
- package/dist/_chunk/i18n.jsx +254 -0
- package/dist/_chunk/i18n.jsx.map +1 -0
- package/dist/_chunk/interactions.js +241 -0
- package/dist/_chunk/interactions.js.map +1 -0
- package/dist/_chunk/interactions.jsx +237 -0
- package/dist/_chunk/interactions.jsx.map +1 -0
- package/dist/_chunk/link.js +96 -0
- package/dist/_chunk/link.js.map +1 -0
- package/dist/_chunk/link.jsx +96 -0
- package/dist/_chunk/link.jsx.map +1 -0
- package/dist/_chunk/listbox.js +324 -0
- package/dist/_chunk/listbox.js.map +1 -0
- package/dist/_chunk/listbox.jsx +324 -0
- package/dist/_chunk/listbox.jsx.map +1 -0
- package/dist/_chunk/live-announcer.js +207 -0
- package/dist/_chunk/live-announcer.js.map +1 -0
- package/dist/_chunk/live-announcer.jsx +207 -0
- package/dist/_chunk/live-announcer.jsx.map +1 -0
- package/dist/_chunk/menu.js +518 -0
- package/dist/_chunk/menu.js.map +1 -0
- package/dist/_chunk/menu.jsx +518 -0
- package/dist/_chunk/menu.jsx.map +1 -0
- package/dist/_chunk/meter.js +33 -0
- package/dist/_chunk/meter.js.map +1 -0
- package/dist/_chunk/meter.jsx +33 -0
- package/dist/_chunk/meter.jsx.map +1 -0
- package/dist/_chunk/numberfield.js +258 -0
- package/dist/_chunk/numberfield.js.map +1 -0
- package/dist/_chunk/numberfield.jsx +258 -0
- package/dist/_chunk/numberfield.jsx.map +1 -0
- package/dist/_chunk/overlays.js +186 -0
- package/dist/_chunk/overlays.js.map +1 -0
- package/dist/_chunk/overlays.jsx +162 -0
- package/dist/_chunk/overlays.jsx.map +1 -0
- package/dist/_chunk/popover.js +574 -0
- package/dist/_chunk/popover.js.map +1 -0
- package/dist/_chunk/popover.jsx +574 -0
- package/dist/_chunk/popover.jsx.map +1 -0
- package/dist/_chunk/radio.js +319 -0
- package/dist/_chunk/radio.js.map +1 -0
- package/dist/_chunk/radio.jsx +319 -0
- package/dist/_chunk/radio.jsx.map +1 -0
- package/dist/_chunk/searchfield.js +209 -0
- package/dist/_chunk/searchfield.js.map +1 -0
- package/dist/_chunk/searchfield.jsx +209 -0
- package/dist/_chunk/searchfield.jsx.map +1 -0
- package/dist/_chunk/select.js +403 -0
- package/dist/_chunk/select.js.map +1 -0
- package/dist/_chunk/select.jsx +394 -0
- package/dist/_chunk/select.jsx.map +1 -0
- package/dist/_chunk/selection.js +679 -0
- package/dist/_chunk/selection.js.map +1 -0
- package/dist/_chunk/selection.jsx +679 -0
- package/dist/_chunk/selection.jsx.map +1 -0
- package/dist/_chunk/separator.js +29 -0
- package/dist/_chunk/separator.js.map +1 -0
- package/dist/_chunk/separator.jsx +29 -0
- package/dist/_chunk/separator.jsx.map +1 -0
- package/dist/_chunk/slider.js +255 -0
- package/dist/_chunk/slider.js.map +1 -0
- package/dist/_chunk/slider.jsx +255 -0
- package/dist/_chunk/slider.jsx.map +1 -0
- package/dist/_chunk/steplist.js +66 -0
- package/dist/_chunk/steplist.js.map +1 -0
- package/dist/_chunk/steplist.jsx +66 -0
- package/dist/_chunk/steplist.jsx.map +1 -0
- package/dist/_chunk/switch.js +34 -0
- package/dist/_chunk/switch.js.map +1 -0
- package/dist/_chunk/switch.jsx +34 -0
- package/dist/_chunk/switch.jsx.map +1 -0
- package/dist/_chunk/table.js +1051 -0
- package/dist/_chunk/table.js.map +1 -0
- package/dist/_chunk/table.jsx +1051 -0
- package/dist/_chunk/table.jsx.map +1 -0
- package/dist/_chunk/tabs.js +260 -0
- package/dist/_chunk/tabs.js.map +1 -0
- package/dist/_chunk/tabs.jsx +260 -0
- package/dist/_chunk/tabs.jsx.map +1 -0
- package/dist/_chunk/tag.js +286 -0
- package/dist/_chunk/tag.js.map +1 -0
- package/dist/_chunk/tag.jsx +286 -0
- package/dist/_chunk/tag.jsx.map +1 -0
- package/dist/_chunk/textfield.js +109 -0
- package/dist/_chunk/textfield.js.map +1 -0
- package/dist/_chunk/textfield.jsx +109 -0
- package/dist/_chunk/textfield.jsx.map +1 -0
- package/dist/_chunk/toast.js +250 -0
- package/dist/_chunk/toast.js.map +1 -0
- package/dist/_chunk/toast.jsx +250 -0
- package/dist/_chunk/toast.jsx.map +1 -0
- package/dist/_chunk/toolbar.js +258 -0
- package/dist/_chunk/toolbar.js.map +1 -0
- package/dist/_chunk/toolbar.jsx +258 -0
- package/dist/_chunk/toolbar.jsx.map +1 -0
- package/dist/_chunk/tooltip.js +185 -0
- package/dist/_chunk/tooltip.js.map +1 -0
- package/dist/_chunk/tooltip.jsx +185 -0
- package/dist/_chunk/tooltip.jsx.map +1 -0
- package/dist/_chunk/tree.js +424 -0
- package/dist/_chunk/tree.js.map +1 -0
- package/dist/_chunk/tree.jsx +424 -0
- package/dist/_chunk/tree.jsx.map +1 -0
- package/dist/_chunk/utils.js +665 -0
- package/dist/_chunk/utils.js.map +1 -0
- package/dist/_chunk/utils.jsx +665 -0
- package/dist/_chunk/utils.jsx.map +1 -0
- package/dist/_chunk/visually-hidden.js +92 -0
- package/dist/_chunk/visually-hidden.js.map +1 -0
- package/dist/_chunk/visually-hidden.jsx +92 -0
- package/dist/_chunk/visually-hidden.jsx.map +1 -0
- package/dist/actiongroup/createActionGroup.d.ts +5 -5
- package/dist/actiongroup/createActionGroup.d.ts.map +1 -1
- package/dist/actiongroup/index.d.ts +1 -1
- package/dist/actiongroup/index.js +2 -0
- package/dist/actiongroup/index.jsx +2 -0
- package/dist/autocomplete/createAutocomplete.d.ts +12 -10
- package/dist/autocomplete/createAutocomplete.d.ts.map +1 -1
- package/dist/autocomplete/index.d.ts +1 -1
- package/dist/autocomplete/index.d.ts.map +1 -1
- package/dist/autocomplete/index.js +2 -0
- package/dist/autocomplete/index.jsx +2 -0
- package/dist/breadcrumbs/createBreadcrumbs.d.ts +9 -7
- package/dist/breadcrumbs/createBreadcrumbs.d.ts.map +1 -1
- package/dist/breadcrumbs/index.d.ts +1 -1
- package/dist/breadcrumbs/index.js +2 -0
- package/dist/breadcrumbs/index.jsx +2 -0
- package/dist/button/createButton.d.ts +1 -1
- package/dist/button/createButton.d.ts.map +1 -1
- package/dist/button/createToggleButton.d.ts +3 -3
- package/dist/button/createToggleButtonGroup.d.ts +7 -7
- package/dist/button/createToggleButtonGroup.d.ts.map +1 -1
- package/dist/button/index.d.ts +6 -6
- package/dist/button/index.d.ts.map +1 -1
- package/dist/button/index.js +2 -0
- package/dist/button/index.jsx +2 -0
- package/dist/button/types.d.ts +18 -12
- package/dist/button/types.d.ts.map +1 -1
- package/dist/calendar/createCalendar.d.ts +15 -5
- package/dist/calendar/createCalendar.d.ts.map +1 -1
- package/dist/calendar/createCalendarCell.d.ts +6 -2
- package/dist/calendar/createCalendarCell.d.ts.map +1 -1
- package/dist/calendar/createCalendarGrid.d.ts +4 -4
- package/dist/calendar/createCalendarGrid.d.ts.map +1 -1
- package/dist/calendar/createCalendarMonthPicker.d.ts +41 -0
- package/dist/calendar/createCalendarMonthPicker.d.ts.map +1 -0
- package/dist/calendar/createCalendarYearPicker.d.ts +49 -0
- package/dist/calendar/createCalendarYearPicker.d.ts.map +1 -0
- package/dist/calendar/createRangeCalendar.d.ts +15 -5
- package/dist/calendar/createRangeCalendar.d.ts.map +1 -1
- package/dist/calendar/createRangeCalendarCell.d.ts +4 -2
- package/dist/calendar/createRangeCalendarCell.d.ts.map +1 -1
- package/dist/calendar/index.d.ts +7 -5
- package/dist/calendar/index.d.ts.map +1 -1
- package/dist/calendar/index.js +2 -0
- package/dist/calendar/index.jsx +2 -0
- package/dist/calendar/intl/index.d.ts +12 -0
- package/dist/calendar/intl/index.d.ts.map +1 -0
- package/dist/calendar/utils.d.ts +16 -0
- package/dist/calendar/utils.d.ts.map +1 -0
- package/dist/checkbox/createCheckbox.d.ts +10 -6
- package/dist/checkbox/createCheckbox.d.ts.map +1 -1
- package/dist/checkbox/createCheckboxGroup.d.ts +7 -7
- package/dist/checkbox/createCheckboxGroup.d.ts.map +1 -1
- package/dist/checkbox/createCheckboxGroupItem.d.ts +4 -4
- package/dist/checkbox/createCheckboxGroupItem.d.ts.map +1 -1
- package/dist/checkbox/createCheckboxGroupState.d.ts +2 -2
- package/dist/checkbox/createCheckboxGroupState.d.ts.map +1 -1
- package/dist/checkbox/index.d.ts +8 -8
- package/dist/checkbox/index.d.ts.map +1 -1
- package/dist/checkbox/index.js +2 -0
- package/dist/checkbox/index.jsx +2 -0
- package/dist/collections/index.d.ts +3 -3
- package/dist/collections/index.d.ts.map +1 -1
- package/dist/collections/index.js +160 -0
- package/dist/collections/index.js.map +1 -0
- package/dist/collections/index.jsx +160 -0
- package/dist/collections/index.jsx.map +1 -0
- package/dist/color/createColorArea.d.ts +3 -3
- package/dist/color/createColorArea.d.ts.map +1 -1
- package/dist/color/createColorField.d.ts +4 -4
- package/dist/color/createColorField.d.ts.map +1 -1
- package/dist/color/createColorSlider.d.ts +4 -4
- package/dist/color/createColorSlider.d.ts.map +1 -1
- package/dist/color/createColorSwatch.d.ts +2 -2
- package/dist/color/createColorSwatch.d.ts.map +1 -1
- package/dist/color/createColorWheel.d.ts +3 -3
- package/dist/color/createColorWheel.d.ts.map +1 -1
- package/dist/color/index.d.ts +6 -6
- package/dist/color/index.js +2 -0
- package/dist/color/index.jsx +2 -0
- package/dist/color/types.d.ts +98 -16
- package/dist/color/types.d.ts.map +1 -1
- package/dist/combobox/createComboBox.d.ts +10 -7
- package/dist/combobox/createComboBox.d.ts.map +1 -1
- package/dist/combobox/index.d.ts +1 -1
- package/dist/combobox/index.js +2 -0
- package/dist/combobox/index.jsx +2 -0
- package/dist/combobox/intl/index.d.ts +1 -1
- package/dist/datepicker/createDateField.d.ts +18 -6
- package/dist/datepicker/createDateField.d.ts.map +1 -1
- package/dist/datepicker/createDatePicker.d.ts +51 -5
- package/dist/datepicker/createDatePicker.d.ts.map +1 -1
- package/dist/datepicker/createDatePickerGroup.d.ts +19 -0
- package/dist/datepicker/createDatePickerGroup.d.ts.map +1 -0
- package/dist/datepicker/createDateRangePicker.d.ts +8 -6
- package/dist/datepicker/createDateRangePicker.d.ts.map +1 -1
- package/dist/datepicker/createDateSegment.d.ts +10 -2
- package/dist/datepicker/createDateSegment.d.ts.map +1 -1
- package/dist/datepicker/createTimeField.d.ts +11 -5
- package/dist/datepicker/createTimeField.d.ts.map +1 -1
- package/dist/datepicker/createTimeSegment.d.ts +2 -2
- package/dist/datepicker/createTimeSegment.d.ts.map +1 -1
- package/dist/datepicker/index.d.ts +7 -6
- package/dist/datepicker/index.d.ts.map +1 -1
- package/dist/datepicker/index.js +2 -0
- package/dist/datepicker/index.jsx +2 -0
- package/dist/dialog/createDialog.d.ts +5 -5
- package/dist/dialog/createDialog.d.ts.map +1 -1
- package/dist/dialog/index.d.ts +2 -2
- package/dist/dialog/index.d.ts.map +1 -1
- package/dist/dialog/index.js +2 -0
- package/dist/dialog/index.jsx +2 -0
- package/dist/dialog/types.d.ts +4 -4
- package/dist/disclosure/createDisclosure.d.ts +5 -2
- package/dist/disclosure/createDisclosure.d.ts.map +1 -1
- package/dist/disclosure/createDisclosureGroup.d.ts +4 -4
- package/dist/disclosure/createDisclosureGroup.d.ts.map +1 -1
- package/dist/disclosure/index.d.ts +2 -2
- package/dist/disclosure/index.js +2 -0
- package/dist/disclosure/index.jsx +2 -0
- package/dist/dnd/createDrag.d.ts +2 -2
- package/dist/dnd/createDrag.d.ts.map +1 -1
- package/dist/dnd/createDraggableCollection.d.ts +2 -2
- package/dist/dnd/createDraggableItem.d.ts +3 -3
- package/dist/dnd/createDraggableItem.d.ts.map +1 -1
- package/dist/dnd/createDrop.d.ts +2 -2
- package/dist/dnd/createDrop.d.ts.map +1 -1
- package/dist/dnd/createDroppableCollection.d.ts +26 -6
- package/dist/dnd/createDroppableCollection.d.ts.map +1 -1
- package/dist/dnd/createDroppableItem.d.ts +3 -3
- package/dist/dnd/index.d.ts +12 -12
- package/dist/dnd/index.d.ts.map +1 -1
- package/dist/dnd/index.js +2 -0
- package/dist/dnd/index.jsx +2 -0
- package/dist/dnd/types.d.ts +2 -2
- package/dist/dnd/types.d.ts.map +1 -1
- package/dist/dnd/utils.d.ts +2 -2
- package/dist/dnd/utils.d.ts.map +1 -1
- package/dist/focus/FocusScope.d.ts +1 -1
- package/dist/focus/FocusScope.d.ts.map +1 -1
- package/dist/focus/createAutoFocus.d.ts.map +1 -1
- package/dist/focus/createFocusRestore.d.ts.map +1 -1
- package/dist/focus/createVirtualFocus.d.ts +4 -4
- package/dist/focus/createVirtualFocus.d.ts.map +1 -1
- package/dist/focus/index.d.ts +4 -4
- package/dist/focus/index.d.ts.map +1 -1
- package/dist/focus/index.js +2 -0
- package/dist/focus/index.jsx +2 -0
- package/dist/form/createFormReset.d.ts +1 -1
- package/dist/form/createFormValidation.d.ts +3 -3
- package/dist/form/createFormValidation.d.ts.map +1 -1
- package/dist/form/index.d.ts +2 -2
- package/dist/form/index.d.ts.map +1 -1
- package/dist/form/index.js +3 -0
- package/dist/form/index.jsx +3 -0
- package/dist/grid/GridKeyboardDelegate.d.ts +5 -5
- package/dist/grid/createGrid.d.ts +3 -3
- package/dist/grid/createGridCell.d.ts +3 -3
- package/dist/grid/createGridRow.d.ts +3 -3
- package/dist/grid/index.d.ts +5 -5
- package/dist/grid/index.js +2 -0
- package/dist/grid/index.jsx +2 -0
- package/dist/grid/types.d.ts +8 -8
- package/dist/gridlist/createGridList.d.ts +12 -4
- package/dist/gridlist/createGridList.d.ts.map +1 -1
- package/dist/gridlist/createGridListItem.d.ts +4 -4
- package/dist/gridlist/createGridListItem.d.ts.map +1 -1
- package/dist/gridlist/createGridListSection.d.ts +15 -0
- package/dist/gridlist/createGridListSection.d.ts.map +1 -0
- package/dist/gridlist/createGridListSelectionCheckbox.d.ts +3 -3
- package/dist/gridlist/createGridListSelectionCheckbox.d.ts.map +1 -1
- package/dist/gridlist/index.d.ts +5 -4
- package/dist/gridlist/index.d.ts.map +1 -1
- package/dist/gridlist/index.js +2 -0
- package/dist/gridlist/index.jsx +2 -0
- package/dist/gridlist/types.d.ts +61 -7
- package/dist/gridlist/types.d.ts.map +1 -1
- package/dist/i18n/createCollator.d.ts.map +1 -1
- package/dist/i18n/createDateFormatter.d.ts.map +1 -1
- package/dist/i18n/createFilter.d.ts.map +1 -1
- package/dist/i18n/createNumberFormatter.d.ts +1 -1
- package/dist/i18n/createNumberFormatter.d.ts.map +1 -1
- package/dist/i18n/createStringFormatter.d.ts +2 -2
- package/dist/i18n/createStringFormatter.d.ts.map +1 -1
- package/dist/i18n/index.d.ts +8 -8
- package/dist/i18n/index.d.ts.map +1 -1
- package/dist/i18n/index.js +3 -0
- package/dist/i18n/index.jsx +3 -0
- package/dist/i18n/locale.d.ts +2 -2
- package/dist/i18n/locale.d.ts.map +1 -1
- package/dist/i18n/utils.d.ts.map +1 -1
- package/dist/index.d.ts +56 -51
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +71 -17119
- package/dist/index.jsx +71 -0
- package/dist/interactions/FocusableProvider.d.ts +2 -2
- package/dist/interactions/FocusableProvider.d.ts.map +1 -1
- package/dist/interactions/PressEvent.d.ts +13 -2
- package/dist/interactions/PressEvent.d.ts.map +1 -1
- package/dist/interactions/createFocus.d.ts +1 -1
- package/dist/interactions/createFocus.d.ts.map +1 -1
- package/dist/interactions/createFocusRing.d.ts +1 -1
- package/dist/interactions/createFocusRing.d.ts.map +1 -1
- package/dist/interactions/createFocusWithin.d.ts +1 -1
- package/dist/interactions/createFocusWithin.d.ts.map +1 -1
- package/dist/interactions/createFocusable.d.ts +3 -3
- package/dist/interactions/createFocusable.d.ts.map +1 -1
- package/dist/interactions/createHover.d.ts +5 -5
- package/dist/interactions/createHover.d.ts.map +1 -1
- package/dist/interactions/createInteractionModality.d.ts +3 -4
- package/dist/interactions/createInteractionModality.d.ts.map +1 -1
- package/dist/interactions/createKeyboard.d.ts +1 -1
- package/dist/interactions/createKeyboard.d.ts.map +1 -1
- package/dist/interactions/createLongPress.d.ts +5 -5
- package/dist/interactions/createMove.d.ts +5 -5
- package/dist/interactions/createMove.d.ts.map +1 -1
- package/dist/interactions/createPress.d.ts +4 -4
- package/dist/interactions/createPress.d.ts.map +1 -1
- package/dist/interactions/index.d.ts +12 -12
- package/dist/interactions/index.d.ts.map +1 -1
- package/dist/interactions/index.js +10 -0
- package/dist/interactions/index.jsx +10 -0
- package/dist/label/createField.d.ts +4 -4
- package/dist/label/createField.d.ts.map +1 -1
- package/dist/label/createLabel.d.ts +7 -7
- package/dist/label/createLabel.d.ts.map +1 -1
- package/dist/label/createLabels.d.ts +1 -1
- package/dist/label/createLabels.d.ts.map +1 -1
- package/dist/label/index.d.ts +5 -5
- package/dist/label/index.js +4 -0
- package/dist/label/index.jsx +4 -0
- package/dist/landmark/createLandmark.d.ts +5 -5
- package/dist/landmark/createLandmark.d.ts.map +1 -1
- package/dist/landmark/index.d.ts +1 -1
- package/dist/landmark/index.js +2 -0
- package/dist/landmark/index.jsx +2 -0
- package/dist/link/createLink.d.ts +14 -8
- package/dist/link/createLink.d.ts.map +1 -1
- package/dist/link/index.d.ts +1 -1
- package/dist/link/index.js +2 -0
- package/dist/link/index.jsx +2 -0
- package/dist/listbox/createListBox.d.ts +48 -6
- package/dist/listbox/createListBox.d.ts.map +1 -1
- package/dist/listbox/createOption.d.ts +27 -4
- package/dist/listbox/createOption.d.ts.map +1 -1
- package/dist/listbox/index.d.ts +2 -2
- package/dist/listbox/index.d.ts.map +1 -1
- package/dist/listbox/index.js +2 -0
- package/dist/listbox/index.jsx +2 -0
- package/dist/live-announcer/announce.d.ts +2 -2
- package/dist/live-announcer/announce.d.ts.map +1 -1
- package/dist/live-announcer/index.d.ts +1 -1
- package/dist/live-announcer/index.js +2 -0
- package/dist/live-announcer/index.jsx +2 -0
- package/dist/menu/createMenu.d.ts +14 -11
- package/dist/menu/createMenu.d.ts.map +1 -1
- package/dist/menu/createMenuItem.d.ts +25 -5
- package/dist/menu/createMenuItem.d.ts.map +1 -1
- package/dist/menu/createMenuTrigger.d.ts +4 -4
- package/dist/menu/index.d.ts +3 -3
- package/dist/menu/index.d.ts.map +1 -1
- package/dist/menu/index.js +2 -0
- package/dist/menu/index.jsx +2 -0
- package/dist/meter/createMeter.d.ts +6 -6
- package/dist/meter/createMeter.d.ts.map +1 -1
- package/dist/meter/index.d.ts +1 -1
- package/dist/meter/index.js +2 -0
- package/dist/meter/index.jsx +2 -0
- package/dist/numberfield/createNumberField.d.ts +9 -8
- package/dist/numberfield/createNumberField.d.ts.map +1 -1
- package/dist/numberfield/index.d.ts +1 -1
- package/dist/numberfield/index.js +2 -0
- package/dist/numberfield/index.jsx +2 -0
- package/dist/overlays/ariaHideOutside.d.ts.map +1 -1
- package/dist/overlays/createModal.d.ts +3 -3
- package/dist/overlays/createModal.d.ts.map +1 -1
- package/dist/overlays/createOverlay.d.ts +1 -1
- package/dist/overlays/createOverlay.d.ts.map +1 -1
- package/dist/overlays/createOverlayTrigger.d.ts +6 -6
- package/dist/overlays/index.d.ts +6 -6
- package/dist/overlays/index.d.ts.map +1 -1
- package/dist/overlays/index.js +4 -0
- package/dist/overlays/index.jsx +4 -0
- package/dist/popover/calculatePosition.d.ts +6 -4
- package/dist/popover/calculatePosition.d.ts.map +1 -1
- package/dist/popover/createOverlayPosition.d.ts +11 -3
- package/dist/popover/createOverlayPosition.d.ts.map +1 -1
- package/dist/popover/createPopover.d.ts +4 -4
- package/dist/popover/createPopover.d.ts.map +1 -1
- package/dist/popover/index.d.ts +3 -3
- package/dist/popover/index.js +2 -0
- package/dist/popover/index.jsx +2 -0
- package/dist/progress/createProgressBar.d.ts +7 -5
- package/dist/progress/createProgressBar.d.ts.map +1 -1
- package/dist/progress/index.d.ts +1 -1
- package/dist/progress/index.js +2 -0
- package/dist/progress/index.jsx +2 -0
- package/dist/radio/createRadio.d.ts +9 -7
- package/dist/radio/createRadio.d.ts.map +1 -1
- package/dist/radio/createRadioGroup.d.ts +10 -10
- package/dist/radio/createRadioGroup.d.ts.map +1 -1
- package/dist/radio/createRadioGroupState.d.ts +3 -3
- package/dist/radio/createRadioGroupState.d.ts.map +1 -1
- package/dist/radio/index.d.ts +3 -3
- package/dist/radio/index.d.ts.map +1 -1
- package/dist/radio/index.js +2 -0
- package/dist/radio/index.jsx +2 -0
- package/dist/searchfield/createSearchField.d.ts +7 -7
- package/dist/searchfield/createSearchField.d.ts.map +1 -1
- package/dist/searchfield/index.d.ts +2 -2
- package/dist/searchfield/index.js +2 -0
- package/dist/searchfield/index.jsx +2 -0
- package/dist/select/createHiddenSelect.d.ts +4 -4
- package/dist/select/createHiddenSelect.d.ts.map +1 -1
- package/dist/select/createSelect.d.ts +14 -6
- package/dist/select/createSelect.d.ts.map +1 -1
- package/dist/select/index.d.ts +2 -2
- package/dist/select/index.d.ts.map +1 -1
- package/dist/select/index.js +2 -0
- package/dist/select/index.jsx +2 -0
- package/dist/selection/DOMLayoutDelegate.d.ts +58 -0
- package/dist/selection/DOMLayoutDelegate.d.ts.map +1 -0
- package/dist/selection/ListKeyboardDelegate.d.ts +95 -0
- package/dist/selection/ListKeyboardDelegate.d.ts.map +1 -0
- package/dist/selection/constants.d.ts +15 -0
- package/dist/selection/constants.d.ts.map +1 -0
- package/dist/selection/createCollectionRowInteraction.d.ts +13 -0
- package/dist/selection/createCollectionRowInteraction.d.ts.map +1 -0
- package/dist/selection/createScrollIntoViewOnFocus.d.ts +31 -0
- package/dist/selection/createScrollIntoViewOnFocus.d.ts.map +1 -0
- package/dist/selection/createSelectableCollection.d.ts +69 -0
- package/dist/selection/createSelectableCollection.d.ts.map +1 -0
- package/dist/selection/createSelectableItem.d.ts +154 -0
- package/dist/selection/createSelectableItem.d.ts.map +1 -0
- package/dist/selection/createSelectableList.d.ts +43 -0
- package/dist/selection/createSelectableList.d.ts.map +1 -0
- package/dist/selection/createTypeSelect.d.ts +2 -2
- package/dist/selection/createTypeSelect.d.ts.map +1 -1
- package/dist/selection/index.d.ts +10 -1
- package/dist/selection/index.d.ts.map +1 -1
- package/dist/selection/index.js +4 -0
- package/dist/selection/index.jsx +4 -0
- package/dist/selection/selectItem.d.ts +29 -0
- package/dist/selection/selectItem.d.ts.map +1 -0
- package/dist/selection/utils.d.ts +40 -0
- package/dist/selection/utils.d.ts.map +1 -0
- package/dist/separator/createSeparator.d.ts +9 -5
- package/dist/separator/createSeparator.d.ts.map +1 -1
- package/dist/separator/index.d.ts +1 -1
- package/dist/separator/index.js +2 -0
- package/dist/separator/index.jsx +2 -0
- package/dist/slider/createSlider.d.ts +11 -7
- package/dist/slider/createSlider.d.ts.map +1 -1
- package/dist/slider/index.d.ts +2 -2
- package/dist/slider/index.js +2 -0
- package/dist/slider/index.jsx +2 -0
- package/dist/ssr/index.d.ts +18 -1
- package/dist/ssr/index.d.ts.map +1 -1
- package/dist/ssr/index.js +299 -0
- package/dist/ssr/index.js.map +1 -0
- package/dist/ssr/index.jsx +292 -0
- package/dist/ssr/index.jsx.map +1 -0
- package/dist/steplist/createStepList.d.ts +36 -0
- package/dist/steplist/createStepList.d.ts.map +1 -0
- package/dist/steplist/index.d.ts +2 -0
- package/dist/steplist/index.d.ts.map +1 -0
- package/dist/steplist/index.js +2 -0
- package/dist/steplist/index.jsx +2 -0
- package/dist/switch/createSwitch.d.ts +10 -4
- package/dist/switch/createSwitch.d.ts.map +1 -1
- package/dist/switch/index.d.ts +1 -1
- package/dist/switch/index.js +2 -0
- package/dist/switch/index.jsx +2 -0
- package/dist/table/createTable.d.ts +3 -3
- package/dist/table/createTable.d.ts.map +1 -1
- package/dist/table/createTableCell.d.ts +3 -3
- package/dist/table/createTableCell.d.ts.map +1 -1
- package/dist/table/createTableColumnHeader.d.ts +3 -3
- package/dist/table/createTableColumnHeader.d.ts.map +1 -1
- package/dist/table/createTableColumnResize.d.ts +41 -0
- package/dist/table/createTableColumnResize.d.ts.map +1 -0
- package/dist/table/createTableHeaderRow.d.ts +3 -3
- package/dist/table/createTableRow.d.ts +4 -4
- package/dist/table/createTableRow.d.ts.map +1 -1
- package/dist/table/createTableRowGroup.d.ts +2 -2
- package/dist/table/createTableRowGroup.d.ts.map +1 -1
- package/dist/table/createTableSelectAllCheckbox.d.ts +3 -3
- package/dist/table/createTableSelectionCheckbox.d.ts +3 -3
- package/dist/table/index.d.ts +11 -9
- package/dist/table/index.d.ts.map +1 -1
- package/dist/table/index.js +2 -0
- package/dist/table/index.jsx +2 -0
- package/dist/table/types.d.ts +41 -7
- package/dist/table/types.d.ts.map +1 -1
- package/dist/tabs/createTabs.d.ts +32 -28
- package/dist/tabs/createTabs.d.ts.map +1 -1
- package/dist/tabs/index.d.ts +1 -1
- package/dist/tabs/index.js +2 -0
- package/dist/tabs/index.jsx +2 -0
- package/dist/tag/createTag.d.ts +4 -2
- package/dist/tag/createTag.d.ts.map +1 -1
- package/dist/tag/createTagGroup.d.ts +5 -5
- package/dist/tag/createTagGroup.d.ts.map +1 -1
- package/dist/tag/index.d.ts +2 -2
- package/dist/tag/index.d.ts.map +1 -1
- package/dist/tag/index.js +2 -0
- package/dist/tag/index.jsx +2 -0
- package/dist/textfield/createTextField.d.ts +17 -11
- package/dist/textfield/createTextField.d.ts.map +1 -1
- package/dist/textfield/index.d.ts +1 -1
- package/dist/textfield/index.d.ts.map +1 -1
- package/dist/textfield/index.js +2 -0
- package/dist/textfield/index.jsx +2 -0
- package/dist/toast/createToast.d.ts +2 -2
- package/dist/toast/createToast.d.ts.map +1 -1
- package/dist/toast/createToastRegion.d.ts +5 -3
- package/dist/toast/createToastRegion.d.ts.map +1 -1
- package/dist/toast/index.d.ts +2 -2
- package/dist/toast/index.d.ts.map +1 -1
- package/dist/toast/index.js +2 -0
- package/dist/toast/index.jsx +2 -0
- package/dist/toggle/createToggle.d.ts +13 -9
- package/dist/toggle/createToggle.d.ts.map +1 -1
- package/dist/toggle/createToggleState.d.ts +2 -2
- package/dist/toggle/createToggleState.d.ts.map +1 -1
- package/dist/toggle/index.d.ts +4 -4
- package/dist/toggle/index.d.ts.map +1 -1
- package/dist/toggle/index.js +3 -0
- package/dist/toggle/index.jsx +3 -0
- package/dist/toolbar/createToolbar.d.ts +9 -9
- package/dist/toolbar/createToolbar.d.ts.map +1 -1
- package/dist/toolbar/index.d.ts +1 -1
- package/dist/toolbar/index.d.ts.map +1 -1
- package/dist/toolbar/index.js +2 -0
- package/dist/toolbar/index.jsx +2 -0
- package/dist/tooltip/createTooltip.d.ts +5 -5
- package/dist/tooltip/createTooltip.d.ts.map +1 -1
- package/dist/tooltip/createTooltipTrigger.d.ts +10 -5
- package/dist/tooltip/createTooltipTrigger.d.ts.map +1 -1
- package/dist/tooltip/index.d.ts +2 -2
- package/dist/tooltip/index.js +2 -0
- package/dist/tooltip/index.jsx +2 -0
- package/dist/tree/createTree.d.ts +8 -4
- package/dist/tree/createTree.d.ts.map +1 -1
- package/dist/tree/createTreeItem.d.ts +4 -4
- package/dist/tree/createTreeItem.d.ts.map +1 -1
- package/dist/tree/createTreeSelectionCheckbox.d.ts +3 -3
- package/dist/tree/createTreeSelectionCheckbox.d.ts.map +1 -1
- package/dist/tree/index.d.ts +4 -4
- package/dist/tree/index.js +2 -0
- package/dist/tree/index.jsx +2 -0
- package/dist/tree/types.d.ts +20 -6
- package/dist/tree/types.d.ts.map +1 -1
- package/dist/utils/animation.d.ts +60 -0
- package/dist/utils/animation.d.ts.map +1 -0
- package/dist/utils/createDescription.d.ts +2 -2
- package/dist/utils/createDescription.d.ts.map +1 -1
- package/dist/utils/dom.d.ts +48 -2
- package/dist/utils/dom.d.ts.map +1 -1
- package/dist/utils/env.d.ts.map +1 -1
- package/dist/utils/focus.d.ts +1 -1
- package/dist/utils/focus.d.ts.map +1 -1
- package/dist/utils/geometry.d.ts.map +1 -1
- package/dist/utils/index.d.ts +15 -12
- package/dist/utils/index.d.ts.map +1 -1
- package/dist/utils/index.js +5 -0
- package/dist/utils/index.jsx +5 -0
- package/dist/utils/keyboard.d.ts +17 -0
- package/dist/utils/keyboard.d.ts.map +1 -0
- package/dist/utils/mergeProps.d.ts.map +1 -1
- package/dist/utils/reactivity.d.ts +1 -1
- package/dist/utils/scrollIntoView.d.ts +30 -0
- package/dist/utils/scrollIntoView.d.ts.map +1 -0
- package/dist/visually-hidden/createVisuallyHidden.d.ts +2 -2
- package/dist/visually-hidden/createVisuallyHidden.d.ts.map +1 -1
- package/dist/visually-hidden/index.d.ts +1 -1
- package/dist/visually-hidden/index.js +2 -0
- package/dist/visually-hidden/index.jsx +2 -0
- package/package.json +334 -33
- package/src/actiongroup/createActionGroup.ts +101 -91
- package/src/actiongroup/index.ts +1 -1
- package/src/autocomplete/createAutocomplete.ts +177 -148
- package/src/autocomplete/index.ts +1 -1
- package/src/breadcrumbs/createBreadcrumbs.ts +33 -42
- package/src/breadcrumbs/index.ts +1 -1
- package/src/button/createButton.ts +102 -73
- package/src/button/createToggleButton.ts +10 -10
- package/src/button/createToggleButtonGroup.ts +25 -32
- package/src/button/index.ts +6 -9
- package/src/button/types.ts +18 -12
- package/src/calendar/createCalendar.ts +64 -29
- package/src/calendar/createCalendarCell.ts +115 -46
- package/src/calendar/createCalendarGrid.ts +97 -41
- package/src/calendar/createCalendarMonthPicker.ts +105 -0
- package/src/calendar/createCalendarYearPicker.ts +144 -0
- package/src/calendar/createRangeCalendar.ts +68 -31
- package/src/calendar/createRangeCalendarCell.ts +92 -31
- package/src/calendar/index.ts +21 -8
- package/src/calendar/intl/index.ts +210 -0
- package/src/calendar/utils.ts +231 -0
- package/src/checkbox/createCheckbox.ts +23 -21
- package/src/checkbox/createCheckboxGroup.ts +68 -44
- package/src/checkbox/createCheckboxGroupItem.ts +26 -41
- package/src/checkbox/createCheckboxGroupState.ts +3 -22
- package/src/checkbox/index.ts +8 -10
- package/src/collections/index.ts +33 -29
- package/src/color/createColorArea.ts +232 -154
- package/src/color/createColorField.ts +107 -58
- package/src/color/createColorSlider.ts +231 -73
- package/src/color/createColorSwatch.ts +38 -13
- package/src/color/createColorWheel.ts +208 -83
- package/src/color/index.ts +6 -6
- package/src/color/types.ts +98 -16
- package/src/combobox/createComboBox.ts +157 -100
- package/src/combobox/index.ts +1 -1
- package/src/combobox/intl/index.ts +5 -5
- package/src/datepicker/createDateField.ts +192 -39
- package/src/datepicker/createDatePicker.ts +260 -67
- package/src/datepicker/createDatePickerGroup.ts +149 -0
- package/src/datepicker/createDateRangePicker.ts +105 -57
- package/src/datepicker/createDateSegment.ts +188 -96
- package/src/datepicker/createTimeField.ts +38 -34
- package/src/datepicker/createTimeSegment.ts +67 -85
- package/src/datepicker/index.ts +13 -14
- package/src/dialog/createDialog.ts +45 -38
- package/src/dialog/index.ts +2 -2
- package/src/dialog/types.ts +4 -4
- package/src/disclosure/createDisclosure.ts +138 -33
- package/src/disclosure/createDisclosureGroup.ts +8 -21
- package/src/disclosure/index.ts +2 -2
- package/src/dnd/createDrag.ts +19 -25
- package/src/dnd/createDraggableCollection.ts +4 -4
- package/src/dnd/createDraggableItem.ts +20 -19
- package/src/dnd/createDrop.ts +42 -51
- package/src/dnd/createDroppableCollection.ts +293 -173
- package/src/dnd/createDroppableItem.ts +34 -34
- package/src/dnd/index.ts +23 -12
- package/src/dnd/types.ts +4 -7
- package/src/dnd/utils.ts +58 -47
- package/src/focus/FocusScope.tsx +301 -176
- package/src/focus/createAutoFocus.ts +4 -20
- package/src/focus/createFocusRestore.ts +15 -28
- package/src/focus/createVirtualFocus.ts +20 -36
- package/src/focus/index.ts +4 -8
- package/src/form/createFormReset.ts +4 -4
- package/src/form/createFormValidation.ts +23 -39
- package/src/form/index.ts +2 -5
- package/src/grid/GridKeyboardDelegate.ts +30 -30
- package/src/grid/createGrid.ts +36 -36
- package/src/grid/createGridCell.ts +18 -18
- package/src/grid/createGridRow.ts +14 -14
- package/src/grid/index.ts +5 -5
- package/src/grid/types.ts +8 -8
- package/src/gridlist/createGridList.ts +172 -64
- package/src/gridlist/createGridListItem.ts +98 -121
- package/src/gridlist/createGridListSection.ts +54 -0
- package/src/gridlist/createGridListSelectionCheckbox.ts +12 -9
- package/src/gridlist/index.ts +7 -4
- package/src/gridlist/types.ts +58 -7
- package/src/i18n/createCollator.ts +5 -18
- package/src/i18n/createDateFormatter.ts +5 -13
- package/src/i18n/createFilter.ts +11 -24
- package/src/i18n/createNumberFormatter.ts +4 -6
- package/src/i18n/createStringFormatter.ts +19 -15
- package/src/i18n/index.ts +8 -11
- package/src/i18n/locale.tsx +15 -40
- package/src/i18n/utils.ts +35 -39
- package/src/index.ts +111 -172
- package/src/interactions/FocusableProvider.tsx +3 -7
- package/src/interactions/PressEvent.ts +18 -4
- package/src/interactions/createFocus.ts +12 -8
- package/src/interactions/createFocusRing.ts +21 -19
- package/src/interactions/createFocusWithin.ts +20 -13
- package/src/interactions/createFocusable.ts +15 -16
- package/src/interactions/createHover.ts +70 -55
- package/src/interactions/createInteractionModality.ts +96 -94
- package/src/interactions/createKeyboard.ts +12 -2
- package/src/interactions/createLongPress.ts +23 -23
- package/src/interactions/createMove.ts +72 -62
- package/src/interactions/createPress.ts +192 -92
- package/src/interactions/index.ts +24 -16
- package/src/label/createField.ts +18 -19
- package/src/label/createLabel.ts +18 -30
- package/src/label/createLabels.ts +8 -12
- package/src/label/index.ts +5 -5
- package/src/landmark/createLandmark.ts +30 -51
- package/src/landmark/index.ts +1 -1
- package/src/link/createLink.ts +83 -56
- package/src/link/index.ts +1 -1
- package/src/listbox/createListBox.ts +198 -66
- package/src/listbox/createOption.ts +112 -71
- package/src/listbox/index.ts +2 -6
- package/src/live-announcer/announce.ts +44 -71
- package/src/live-announcer/index.ts +1 -1
- package/src/menu/createMenu.ts +171 -65
- package/src/menu/createMenuItem.ts +315 -51
- package/src/menu/createMenuTrigger.ts +15 -15
- package/src/menu/index.ts +3 -12
- package/src/meter/createMeter.ts +7 -15
- package/src/meter/index.ts +1 -1
- package/src/numberfield/createNumberField.ts +205 -80
- package/src/numberfield/index.ts +1 -1
- package/src/overlays/ariaHideOutside.ts +14 -10
- package/src/overlays/createInteractOutside.ts +21 -18
- package/src/overlays/createModal.tsx +17 -17
- package/src/overlays/createOverlay.ts +38 -8
- package/src/overlays/createOverlayTrigger.ts +16 -16
- package/src/overlays/createPreventScroll.ts +46 -24
- package/src/overlays/index.ts +6 -17
- package/src/popover/calculatePosition.ts +134 -124
- package/src/popover/createOverlayPosition.ts +55 -40
- package/src/popover/createPopover.ts +42 -17
- package/src/popover/index.ts +3 -3
- package/src/progress/createProgressBar.ts +31 -32
- package/src/progress/index.ts +1 -1
- package/src/radio/createRadio.ts +114 -75
- package/src/radio/createRadioGroup.ts +83 -77
- package/src/radio/createRadioGroupState.ts +7 -31
- package/src/radio/index.ts +3 -8
- package/src/searchfield/createSearchField.ts +57 -29
- package/src/searchfield/index.ts +2 -2
- package/src/select/createHiddenSelect.tsx +57 -44
- package/src/select/createSelect.ts +146 -73
- package/src/select/index.ts +2 -7
- package/src/selection/DOMLayoutDelegate.ts +102 -0
- package/src/selection/ListKeyboardDelegate.ts +398 -0
- package/src/selection/constants.ts +16 -0
- package/src/selection/createCollectionRowInteraction.ts +209 -0
- package/src/selection/createScrollIntoViewOnFocus.ts +65 -0
- package/src/selection/createSelectableCollection.ts +645 -0
- package/src/selection/createSelectableItem.ts +498 -0
- package/src/selection/createSelectableList.ts +93 -0
- package/src/selection/createTypeSelect.ts +120 -59
- package/src/selection/index.ts +32 -1
- package/src/selection/selectItem.ts +80 -0
- package/src/selection/utils.ts +82 -0
- package/src/separator/createSeparator.ts +20 -25
- package/src/separator/index.ts +1 -1
- package/src/slider/createSlider.ts +128 -112
- package/src/slider/index.ts +2 -2
- package/src/ssr/index.tsx +38 -46
- package/src/steplist/createStepList.ts +106 -0
- package/src/steplist/index.ts +8 -0
- package/src/switch/createSwitch.ts +19 -14
- package/src/switch/index.ts +1 -1
- package/src/table/createTable.ts +192 -95
- package/src/table/createTableCell.ts +17 -16
- package/src/table/createTableColumnHeader.ts +67 -20
- package/src/table/createTableColumnResize.ts +256 -0
- package/src/table/createTableHeaderRow.ts +7 -7
- package/src/table/createTableRow.ts +206 -91
- package/src/table/createTableRowGroup.ts +5 -7
- package/src/table/createTableSelectAllCheckbox.ts +14 -14
- package/src/table/createTableSelectionCheckbox.ts +8 -8
- package/src/table/index.ts +14 -9
- package/src/table/types.ts +43 -7
- package/src/tabs/createTabs.ts +123 -111
- package/src/tabs/index.ts +1 -1
- package/src/tag/createTag.ts +57 -50
- package/src/tag/createTagGroup.ts +47 -41
- package/src/tag/index.ts +2 -6
- package/src/textfield/createTextField.ts +67 -35
- package/src/textfield/index.ts +1 -5
- package/src/toast/createToast.ts +29 -26
- package/src/toast/createToastRegion.ts +169 -26
- package/src/toast/index.ts +2 -6
- package/src/toggle/createToggle.ts +115 -53
- package/src/toggle/createToggleState.ts +2 -10
- package/src/toggle/index.ts +4 -5
- package/src/toolbar/createToolbar.ts +214 -230
- package/src/toolbar/index.ts +1 -1
- package/src/tooltip/createTooltip.ts +11 -24
- package/src/tooltip/createTooltipTrigger.ts +61 -49
- package/src/tooltip/index.ts +2 -2
- package/src/tree/createTree.ts +128 -72
- package/src/tree/createTreeItem.ts +120 -135
- package/src/tree/createTreeSelectionCheckbox.ts +11 -8
- package/src/tree/index.ts +4 -4
- package/src/tree/types.ts +20 -6
- package/src/utils/animation.ts +151 -0
- package/src/utils/createDescription.ts +6 -23
- package/src/utils/dom.ts +265 -68
- package/src/utils/env.ts +9 -11
- package/src/utils/events.ts +7 -7
- package/src/utils/filterDOMProps.ts +49 -49
- package/src/utils/focus.ts +60 -68
- package/src/utils/geometry.ts +1 -4
- package/src/utils/globalListeners.ts +9 -9
- package/src/utils/index.ts +20 -22
- package/src/utils/keyboard.ts +25 -0
- package/src/utils/mergeProps.ts +49 -15
- package/src/utils/platform.ts +2 -2
- package/src/utils/reactivity.ts +3 -3
- package/src/utils/scrollIntoView.ts +181 -0
- package/src/utils/textSelection.ts +16 -16
- package/src/visually-hidden/createVisuallyHidden.ts +16 -28
- package/src/visually-hidden/index.ts +1 -1
- package/dist/i18n/NumberFormatter.d.ts +0 -43
- package/dist/i18n/NumberFormatter.d.ts.map +0 -1
- package/dist/index.js.map +0 -1
- package/dist/index.ssr.js +0 -17082
- package/dist/index.ssr.js.map +0 -1
- package/src/i18n/NumberFormatter.ts +0 -266
|
@@ -0,0 +1,1304 @@
|
|
|
1
|
+
import { createEffect, createMemo, onCleanup } from "solid-js";
|
|
2
|
+
import { DIRECTORY_DRAG_TYPE, createDragState, createDropState } from "@proyecto-viviana/solid-stately";
|
|
3
|
+
//#region src/dnd/utils.ts
|
|
4
|
+
const NATIVE_DRAG_TYPES = new Set([
|
|
5
|
+
"text/plain",
|
|
6
|
+
"text/uri-list",
|
|
7
|
+
"text/html"
|
|
8
|
+
]);
|
|
9
|
+
const CUSTOM_DRAG_TYPE = "application/vnd.solidaria.items+json";
|
|
10
|
+
const GENERIC_TYPE = "application/octet-stream";
|
|
11
|
+
let DROP_OPERATION = /* @__PURE__ */ function(DROP_OPERATION) {
|
|
12
|
+
DROP_OPERATION[DROP_OPERATION["none"] = 0] = "none";
|
|
13
|
+
DROP_OPERATION[DROP_OPERATION["cancel"] = 0] = "cancel";
|
|
14
|
+
DROP_OPERATION[DROP_OPERATION["move"] = 1] = "move";
|
|
15
|
+
DROP_OPERATION[DROP_OPERATION["copy"] = 2] = "copy";
|
|
16
|
+
DROP_OPERATION[DROP_OPERATION["link"] = 4] = "link";
|
|
17
|
+
DROP_OPERATION[DROP_OPERATION["all"] = 7] = "all";
|
|
18
|
+
return DROP_OPERATION;
|
|
19
|
+
}({});
|
|
20
|
+
const DROP_OPERATION_ALLOWED = {
|
|
21
|
+
none: 0,
|
|
22
|
+
copy: 2,
|
|
23
|
+
copyLink: 6,
|
|
24
|
+
copyMove: 3,
|
|
25
|
+
link: 4,
|
|
26
|
+
linkMove: 5,
|
|
27
|
+
move: 1,
|
|
28
|
+
all: 7,
|
|
29
|
+
uninitialized: 7
|
|
30
|
+
};
|
|
31
|
+
const EFFECT_ALLOWED = {
|
|
32
|
+
[0]: "none",
|
|
33
|
+
[1]: "move",
|
|
34
|
+
[2]: "copy",
|
|
35
|
+
[3]: "copyMove",
|
|
36
|
+
[4]: "link",
|
|
37
|
+
[5]: "linkMove",
|
|
38
|
+
[6]: "copyLink",
|
|
39
|
+
[7]: "all"
|
|
40
|
+
};
|
|
41
|
+
const DROP_EFFECT_TO_DROP_OPERATION = {
|
|
42
|
+
none: "cancel",
|
|
43
|
+
link: "link",
|
|
44
|
+
copy: "copy",
|
|
45
|
+
move: "move"
|
|
46
|
+
};
|
|
47
|
+
const DROP_OPERATION_TO_DROP_EFFECT = {
|
|
48
|
+
cancel: "none",
|
|
49
|
+
link: "link",
|
|
50
|
+
copy: "copy",
|
|
51
|
+
move: "move"
|
|
52
|
+
};
|
|
53
|
+
/**
|
|
54
|
+
* Get the types present in drag items.
|
|
55
|
+
*/
|
|
56
|
+
function getTypes(items) {
|
|
57
|
+
const types = /* @__PURE__ */ new Set();
|
|
58
|
+
for (const item of items) for (const type of Object.keys(item)) types.add(type);
|
|
59
|
+
return types;
|
|
60
|
+
}
|
|
61
|
+
/**
|
|
62
|
+
* Write drag items to a DataTransfer object.
|
|
63
|
+
*/
|
|
64
|
+
function writeToDataTransfer(dataTransfer, items) {
|
|
65
|
+
const groupedByType = /* @__PURE__ */ new Map();
|
|
66
|
+
let needsCustomData = false;
|
|
67
|
+
const customData = [];
|
|
68
|
+
for (const item of items) {
|
|
69
|
+
const types = Object.keys(item);
|
|
70
|
+
if (types.length > 1) needsCustomData = true;
|
|
71
|
+
const dataByType = {};
|
|
72
|
+
for (const type of types) {
|
|
73
|
+
let typeItems = groupedByType.get(type);
|
|
74
|
+
if (!typeItems) {
|
|
75
|
+
typeItems = [];
|
|
76
|
+
groupedByType.set(type, typeItems);
|
|
77
|
+
} else needsCustomData = true;
|
|
78
|
+
const data = item[type];
|
|
79
|
+
dataByType[type] = data;
|
|
80
|
+
typeItems.push(data);
|
|
81
|
+
}
|
|
82
|
+
customData.push(dataByType);
|
|
83
|
+
}
|
|
84
|
+
for (const [type, typeItems] of groupedByType) if (NATIVE_DRAG_TYPES.has(type)) {
|
|
85
|
+
const data = typeItems.join("\n");
|
|
86
|
+
dataTransfer.items.add(data, type);
|
|
87
|
+
} else dataTransfer.items.add(typeItems[0], type);
|
|
88
|
+
if (needsCustomData) {
|
|
89
|
+
const data = JSON.stringify(customData);
|
|
90
|
+
dataTransfer.items.add(data, CUSTOM_DRAG_TYPE);
|
|
91
|
+
}
|
|
92
|
+
}
|
|
93
|
+
/**
|
|
94
|
+
* Read drop items from a DataTransfer object.
|
|
95
|
+
*/
|
|
96
|
+
function readFromDataTransfer(dataTransfer) {
|
|
97
|
+
const items = [];
|
|
98
|
+
if (!dataTransfer) return items;
|
|
99
|
+
let hasCustomType = false;
|
|
100
|
+
if (dataTransfer.types.includes("application/vnd.solidaria.items+json")) try {
|
|
101
|
+
const data = dataTransfer.getData(CUSTOM_DRAG_TYPE);
|
|
102
|
+
const parsed = JSON.parse(data);
|
|
103
|
+
for (const item of parsed) items.push({
|
|
104
|
+
kind: "text",
|
|
105
|
+
types: new Set(Object.keys(item)),
|
|
106
|
+
getText: (type) => Promise.resolve(item[type])
|
|
107
|
+
});
|
|
108
|
+
hasCustomType = true;
|
|
109
|
+
} catch {}
|
|
110
|
+
if (!hasCustomType) {
|
|
111
|
+
const stringItems = /* @__PURE__ */ new Map();
|
|
112
|
+
for (const item of dataTransfer.items) if (item.kind === "string") {
|
|
113
|
+
const type = item.type || "application/octet-stream";
|
|
114
|
+
stringItems.set(type, dataTransfer.getData(item.type));
|
|
115
|
+
} else if (item.kind === "file") {
|
|
116
|
+
const file = item.getAsFile();
|
|
117
|
+
if (file) items.push(createFileItem(file));
|
|
118
|
+
}
|
|
119
|
+
if (stringItems.size > 0) items.push({
|
|
120
|
+
kind: "text",
|
|
121
|
+
types: new Set(stringItems.keys()),
|
|
122
|
+
getText: (type) => Promise.resolve(stringItems.get(type) ?? "")
|
|
123
|
+
});
|
|
124
|
+
}
|
|
125
|
+
return items;
|
|
126
|
+
}
|
|
127
|
+
/**
|
|
128
|
+
* Create a FileDropItem from a File object.
|
|
129
|
+
*/
|
|
130
|
+
function createFileItem(file) {
|
|
131
|
+
return {
|
|
132
|
+
kind: "file",
|
|
133
|
+
type: file.type || "application/octet-stream",
|
|
134
|
+
name: file.name,
|
|
135
|
+
getText: () => file.text(),
|
|
136
|
+
getFile: () => Promise.resolve(file)
|
|
137
|
+
};
|
|
138
|
+
}
|
|
139
|
+
/**
|
|
140
|
+
* DragTypes implementation for checking drag types.
|
|
141
|
+
*/
|
|
142
|
+
var DragTypesImpl = class {
|
|
143
|
+
types;
|
|
144
|
+
includesUnknownTypes;
|
|
145
|
+
constructor(dataTransfer) {
|
|
146
|
+
this.types = /* @__PURE__ */ new Set();
|
|
147
|
+
let hasFiles = false;
|
|
148
|
+
for (const item of dataTransfer.items) if (item.type !== "application/vnd.solidaria.items+json") {
|
|
149
|
+
if (item.kind === "file") hasFiles = true;
|
|
150
|
+
if (item.type) this.types.add(item.type);
|
|
151
|
+
else this.types.add(GENERIC_TYPE);
|
|
152
|
+
}
|
|
153
|
+
this.includesUnknownTypes = !hasFiles && dataTransfer.types.includes("Files");
|
|
154
|
+
}
|
|
155
|
+
has(type) {
|
|
156
|
+
if (Array.isArray(type)) return type.some((t) => this.has(t));
|
|
157
|
+
if (this.includesUnknownTypes || type === DIRECTORY_DRAG_TYPE && this.types.has("application/octet-stream") || type === "*/*") return true;
|
|
158
|
+
if (typeof type === "string") {
|
|
159
|
+
if (type.endsWith("/*")) {
|
|
160
|
+
for (const key of this.types) if (key.startsWith(type.slice(0, -2))) return true;
|
|
161
|
+
return false;
|
|
162
|
+
}
|
|
163
|
+
return this.types.has(type);
|
|
164
|
+
}
|
|
165
|
+
return false;
|
|
166
|
+
}
|
|
167
|
+
};
|
|
168
|
+
/**
|
|
169
|
+
* Check if a drop item is a text item.
|
|
170
|
+
*/
|
|
171
|
+
function isTextDropItem(dropItem) {
|
|
172
|
+
return dropItem.kind === "text";
|
|
173
|
+
}
|
|
174
|
+
/**
|
|
175
|
+
* Check if a drop item is a file item.
|
|
176
|
+
*/
|
|
177
|
+
function isFileDropItem(dropItem) {
|
|
178
|
+
return dropItem.kind === "file";
|
|
179
|
+
}
|
|
180
|
+
/**
|
|
181
|
+
* Check if a drop item is a directory item.
|
|
182
|
+
*/
|
|
183
|
+
function isDirectoryDropItem(dropItem) {
|
|
184
|
+
return dropItem.kind === "directory";
|
|
185
|
+
}
|
|
186
|
+
let globalDropEffect;
|
|
187
|
+
let globalAllowedDropOperations = 0;
|
|
188
|
+
function setGlobalDropEffect(effect) {
|
|
189
|
+
globalDropEffect = effect;
|
|
190
|
+
}
|
|
191
|
+
function getGlobalDropEffect() {
|
|
192
|
+
return globalDropEffect;
|
|
193
|
+
}
|
|
194
|
+
function setGlobalAllowedDropOperations(ops) {
|
|
195
|
+
globalAllowedDropOperations = ops;
|
|
196
|
+
}
|
|
197
|
+
function getGlobalAllowedDropOperations() {
|
|
198
|
+
return globalAllowedDropOperations;
|
|
199
|
+
}
|
|
200
|
+
//#endregion
|
|
201
|
+
//#region src/dnd/createDraggableCollection.ts
|
|
202
|
+
/**
|
|
203
|
+
* createDraggableCollection - ARIA hook for draggable collection items.
|
|
204
|
+
*
|
|
205
|
+
* Provides accessibility support for dragging items from a collection
|
|
206
|
+
* component like ListBox, GridList, or Table.
|
|
207
|
+
*/
|
|
208
|
+
let globalDraggingCollectionRef = null;
|
|
209
|
+
let globalDraggingKeys = /* @__PURE__ */ new Set();
|
|
210
|
+
let globalDraggingTypes = /* @__PURE__ */ new Set();
|
|
211
|
+
function setGlobalDraggingCollectionRef(ref) {
|
|
212
|
+
globalDraggingCollectionRef = ref;
|
|
213
|
+
}
|
|
214
|
+
function getGlobalDraggingCollectionRef() {
|
|
215
|
+
return globalDraggingCollectionRef;
|
|
216
|
+
}
|
|
217
|
+
function setGlobalDraggingKeys(keys) {
|
|
218
|
+
globalDraggingKeys = new Set(keys);
|
|
219
|
+
}
|
|
220
|
+
function getGlobalDraggingKeys() {
|
|
221
|
+
return new Set(globalDraggingKeys);
|
|
222
|
+
}
|
|
223
|
+
function setGlobalDraggingTypes(types) {
|
|
224
|
+
globalDraggingTypes = new Set(types);
|
|
225
|
+
}
|
|
226
|
+
function getGlobalDraggingTypes() {
|
|
227
|
+
return new Set(globalDraggingTypes);
|
|
228
|
+
}
|
|
229
|
+
/**
|
|
230
|
+
* Creates ARIA support for a draggable collection.
|
|
231
|
+
*
|
|
232
|
+
* @param _options - Collection options
|
|
233
|
+
* @param state - Draggable collection state
|
|
234
|
+
* @returns Draggable collection ARIA result
|
|
235
|
+
*/
|
|
236
|
+
function createDraggableCollection(options, state) {
|
|
237
|
+
const ref = createMemo(() => options.ref());
|
|
238
|
+
createEffect(() => {
|
|
239
|
+
const currentRef = ref();
|
|
240
|
+
if (state.draggingKeys.size > 0) {
|
|
241
|
+
if (globalDraggingCollectionRef !== currentRef) setGlobalDraggingCollectionRef(currentRef);
|
|
242
|
+
setGlobalDraggingKeys(state.draggingKeys);
|
|
243
|
+
setGlobalDraggingTypes(getTypes(state.getItems(state.draggingKeys)));
|
|
244
|
+
return;
|
|
245
|
+
}
|
|
246
|
+
if (globalDraggingCollectionRef === currentRef) {
|
|
247
|
+
setGlobalDraggingCollectionRef(null);
|
|
248
|
+
setGlobalDraggingKeys(/* @__PURE__ */ new Set());
|
|
249
|
+
setGlobalDraggingTypes(/* @__PURE__ */ new Set());
|
|
250
|
+
}
|
|
251
|
+
});
|
|
252
|
+
onCleanup(() => {
|
|
253
|
+
if (globalDraggingCollectionRef === ref()) {
|
|
254
|
+
setGlobalDraggingCollectionRef(null);
|
|
255
|
+
setGlobalDraggingKeys(/* @__PURE__ */ new Set());
|
|
256
|
+
setGlobalDraggingTypes(/* @__PURE__ */ new Set());
|
|
257
|
+
}
|
|
258
|
+
});
|
|
259
|
+
return { state };
|
|
260
|
+
}
|
|
261
|
+
//#endregion
|
|
262
|
+
//#region src/dnd/createDrag.ts
|
|
263
|
+
/**
|
|
264
|
+
* createDrag - ARIA hook for drag operations.
|
|
265
|
+
*
|
|
266
|
+
* Provides accessibility props for draggable elements with support for
|
|
267
|
+
* mouse, touch, and keyboard interactions.
|
|
268
|
+
*/
|
|
269
|
+
/**
|
|
270
|
+
* Creates ARIA props for a draggable element.
|
|
271
|
+
*
|
|
272
|
+
* @param props - Accessor returning drag options
|
|
273
|
+
* @returns Drag ARIA props and state
|
|
274
|
+
*/
|
|
275
|
+
function createDrag(props) {
|
|
276
|
+
const getProps = createMemo(() => props());
|
|
277
|
+
const state = createDragState(() => ({
|
|
278
|
+
getItems: getProps().getItems,
|
|
279
|
+
getAllowedDropOperations: getProps().getAllowedDropOperations,
|
|
280
|
+
onDragStart: getProps().onDragStart,
|
|
281
|
+
onDragMove: getProps().onDragMove,
|
|
282
|
+
onDragEnd: getProps().onDragEnd,
|
|
283
|
+
isDisabled: getProps().isDisabled,
|
|
284
|
+
hasDragButton: getProps().hasDragButton,
|
|
285
|
+
preview: getProps().preview
|
|
286
|
+
}));
|
|
287
|
+
let lastX = 0;
|
|
288
|
+
let lastY = 0;
|
|
289
|
+
const onDragStart = (e) => {
|
|
290
|
+
if (e.defaultPrevented) return;
|
|
291
|
+
e.stopPropagation();
|
|
292
|
+
const p = getProps();
|
|
293
|
+
state.startDrag(e.clientX, e.clientY);
|
|
294
|
+
const items = state.getItems();
|
|
295
|
+
setGlobalDraggingTypes(getTypes(items));
|
|
296
|
+
e.dataTransfer?.clearData?.();
|
|
297
|
+
if (e.dataTransfer) writeToDataTransfer(e.dataTransfer, items);
|
|
298
|
+
let allowed = 7;
|
|
299
|
+
const allowedOps = state.getAllowedDropOperations();
|
|
300
|
+
if (allowedOps.length > 0) {
|
|
301
|
+
allowed = 0;
|
|
302
|
+
for (const op of allowedOps) allowed |= DROP_OPERATION[op] || 0;
|
|
303
|
+
}
|
|
304
|
+
setGlobalAllowedDropOperations(allowed);
|
|
305
|
+
const effectAllowed = EFFECT_ALLOWED[allowed] || "none";
|
|
306
|
+
if (e.dataTransfer) e.dataTransfer.effectAllowed = effectAllowed === "cancel" ? "none" : effectAllowed;
|
|
307
|
+
if (typeof p.preview?.current === "function" && e.dataTransfer) p.preview.current(items, (node, userX, userY) => {
|
|
308
|
+
if (!node || !e.dataTransfer) return;
|
|
309
|
+
const size = node.getBoundingClientRect();
|
|
310
|
+
const rect = e.currentTarget.getBoundingClientRect();
|
|
311
|
+
let defaultX = e.clientX - rect.x;
|
|
312
|
+
let defaultY = e.clientY - rect.y;
|
|
313
|
+
if (defaultX > size.width || defaultY > size.height) {
|
|
314
|
+
defaultX = size.width / 2;
|
|
315
|
+
defaultY = size.height / 2;
|
|
316
|
+
}
|
|
317
|
+
let offsetX = typeof userX === "number" ? userX : defaultX;
|
|
318
|
+
let offsetY = typeof userY === "number" ? userY : defaultY;
|
|
319
|
+
offsetX = Math.max(0, Math.min(offsetX, size.width));
|
|
320
|
+
offsetY = Math.max(0, Math.min(offsetY, size.height));
|
|
321
|
+
e.dataTransfer.setDragImage(node, offsetX, offsetY);
|
|
322
|
+
});
|
|
323
|
+
lastX = e.clientX;
|
|
324
|
+
lastY = e.clientY;
|
|
325
|
+
};
|
|
326
|
+
const onDrag = (e) => {
|
|
327
|
+
e.stopPropagation();
|
|
328
|
+
if (e.clientX === lastX && e.clientY === lastY) return;
|
|
329
|
+
state.moveDrag(e.clientX, e.clientY);
|
|
330
|
+
lastX = e.clientX;
|
|
331
|
+
lastY = e.clientY;
|
|
332
|
+
};
|
|
333
|
+
const onDragEnd = (e) => {
|
|
334
|
+
e.stopPropagation();
|
|
335
|
+
let dropEffect = e.dataTransfer?.dropEffect ?? "none";
|
|
336
|
+
if (getGlobalDropEffect()) dropEffect = getGlobalDropEffect();
|
|
337
|
+
const dropOperation = DROP_EFFECT_TO_DROP_OPERATION[dropEffect];
|
|
338
|
+
state.endDrag(e.clientX, e.clientY, dropOperation);
|
|
339
|
+
setGlobalAllowedDropOperations(0);
|
|
340
|
+
setGlobalDraggingTypes(/* @__PURE__ */ new Set());
|
|
341
|
+
setGlobalDropEffect(void 0);
|
|
342
|
+
};
|
|
343
|
+
const onKeyDown = (e) => {
|
|
344
|
+
if (e.key === "Enter" && e.target === e.currentTarget) {
|
|
345
|
+
e.preventDefault();
|
|
346
|
+
e.stopPropagation();
|
|
347
|
+
}
|
|
348
|
+
};
|
|
349
|
+
const onKeyUp = (e) => {
|
|
350
|
+
if (e.key === "Enter" && e.target === e.currentTarget) {
|
|
351
|
+
e.preventDefault();
|
|
352
|
+
e.stopPropagation();
|
|
353
|
+
const rect = e.target.getBoundingClientRect();
|
|
354
|
+
state.startDrag(rect.x + rect.width / 2, rect.y + rect.height / 2);
|
|
355
|
+
setGlobalDraggingTypes(getTypes(state.getItems()));
|
|
356
|
+
let allowed = 7;
|
|
357
|
+
const allowedOps = state.getAllowedDropOperations();
|
|
358
|
+
if (allowedOps.length > 0) {
|
|
359
|
+
allowed = 0;
|
|
360
|
+
for (const op of allowedOps) allowed |= DROP_OPERATION[op] || 0;
|
|
361
|
+
}
|
|
362
|
+
setGlobalAllowedDropOperations(allowed);
|
|
363
|
+
}
|
|
364
|
+
};
|
|
365
|
+
const dragProps = createMemo(() => {
|
|
366
|
+
const p = getProps();
|
|
367
|
+
if (p.isDisabled) return { draggable: false };
|
|
368
|
+
const baseProps = {
|
|
369
|
+
draggable: true,
|
|
370
|
+
onDragStart,
|
|
371
|
+
onDrag,
|
|
372
|
+
onDragEnd
|
|
373
|
+
};
|
|
374
|
+
if (!p.hasDragButton) {
|
|
375
|
+
baseProps.onKeyDown = onKeyDown;
|
|
376
|
+
baseProps.onKeyUp = onKeyUp;
|
|
377
|
+
}
|
|
378
|
+
return baseProps;
|
|
379
|
+
});
|
|
380
|
+
const dragButtonProps = createMemo(() => {
|
|
381
|
+
if (getProps().isDisabled) return { disabled: true };
|
|
382
|
+
return {
|
|
383
|
+
type: "button",
|
|
384
|
+
"aria-label": "Drag",
|
|
385
|
+
onKeyDown,
|
|
386
|
+
onKeyUp
|
|
387
|
+
};
|
|
388
|
+
});
|
|
389
|
+
return {
|
|
390
|
+
get dragProps() {
|
|
391
|
+
return dragProps();
|
|
392
|
+
},
|
|
393
|
+
get dragButtonProps() {
|
|
394
|
+
return dragButtonProps();
|
|
395
|
+
},
|
|
396
|
+
get isDragging() {
|
|
397
|
+
return state.isDragging;
|
|
398
|
+
}
|
|
399
|
+
};
|
|
400
|
+
}
|
|
401
|
+
//#endregion
|
|
402
|
+
//#region src/dnd/createDrop.ts
|
|
403
|
+
/**
|
|
404
|
+
* createDrop - ARIA hook for drop operations.
|
|
405
|
+
*
|
|
406
|
+
* Provides accessibility props for drop target elements with support for
|
|
407
|
+
* mouse, touch, and keyboard interactions.
|
|
408
|
+
*/
|
|
409
|
+
const DROP_ACTIVATE_TIMEOUT = 800;
|
|
410
|
+
/**
|
|
411
|
+
* Creates ARIA props for a drop target element.
|
|
412
|
+
*
|
|
413
|
+
* @param props - Accessor returning drop options
|
|
414
|
+
* @returns Drop ARIA props and state
|
|
415
|
+
*/
|
|
416
|
+
function createDrop(props) {
|
|
417
|
+
const getProps = createMemo(() => props());
|
|
418
|
+
const state = createDropState(() => ({
|
|
419
|
+
getDropOperation: getProps().getDropOperation,
|
|
420
|
+
onDropEnter: getProps().onDropEnter,
|
|
421
|
+
onDropMove: getProps().onDropMove,
|
|
422
|
+
onDropActivate: getProps().onDropActivate,
|
|
423
|
+
onDropExit: getProps().onDropExit,
|
|
424
|
+
onDrop: getProps().onDrop,
|
|
425
|
+
hasDropButton: getProps().hasDropButton,
|
|
426
|
+
isDisabled: getProps().isDisabled
|
|
427
|
+
}));
|
|
428
|
+
let x = 0;
|
|
429
|
+
let y = 0;
|
|
430
|
+
let dragOverElements = /* @__PURE__ */ new Set();
|
|
431
|
+
let dropEffect = "none";
|
|
432
|
+
let allowedOperations = 7;
|
|
433
|
+
let dropActivateTimer;
|
|
434
|
+
const fireDropEnter = (e) => {
|
|
435
|
+
const rect = e.currentTarget.getBoundingClientRect();
|
|
436
|
+
state.enterTarget(e.clientX - rect.x, e.clientY - rect.y);
|
|
437
|
+
};
|
|
438
|
+
const fireDropExit = (e) => {
|
|
439
|
+
const rect = e.currentTarget.getBoundingClientRect();
|
|
440
|
+
state.exitTarget(e.clientX - rect.x, e.clientY - rect.y);
|
|
441
|
+
};
|
|
442
|
+
const getAllowedOperations = (e) => {
|
|
443
|
+
let allowed = DROP_OPERATION_ALLOWED[e.dataTransfer?.effectAllowed ?? "none"] ?? 0;
|
|
444
|
+
const globalAllowed = getGlobalAllowedDropOperations();
|
|
445
|
+
if (globalAllowed) allowed &= globalAllowed;
|
|
446
|
+
let modifierAllowed = 0;
|
|
447
|
+
if (typeof navigator !== "undefined" && /mac/i.test(navigator.platform)) {
|
|
448
|
+
if (e.altKey) modifierAllowed |= 2;
|
|
449
|
+
if (e.ctrlKey) modifierAllowed |= 4;
|
|
450
|
+
if (e.metaKey) modifierAllowed |= 1;
|
|
451
|
+
} else {
|
|
452
|
+
if (e.altKey) modifierAllowed |= 4;
|
|
453
|
+
if (e.shiftKey) modifierAllowed |= 1;
|
|
454
|
+
if (e.ctrlKey) modifierAllowed |= 2;
|
|
455
|
+
}
|
|
456
|
+
if (modifierAllowed) return allowed & modifierAllowed;
|
|
457
|
+
return allowed;
|
|
458
|
+
};
|
|
459
|
+
const allowedOperationsToArray = (ops) => {
|
|
460
|
+
const result = [];
|
|
461
|
+
if (ops & 1) result.push("move");
|
|
462
|
+
if (ops & 2) result.push("copy");
|
|
463
|
+
if (ops & 4) result.push("link");
|
|
464
|
+
return result;
|
|
465
|
+
};
|
|
466
|
+
const getDropOperationForAllowed = (allowed, operation) => {
|
|
467
|
+
return allowed & DROP_OPERATION[operation] ? operation : "cancel";
|
|
468
|
+
};
|
|
469
|
+
const onDragEnter = (e) => {
|
|
470
|
+
e.preventDefault();
|
|
471
|
+
e.stopPropagation();
|
|
472
|
+
dragOverElements.add(e.target);
|
|
473
|
+
if (dragOverElements.size > 1) return;
|
|
474
|
+
const p = getProps();
|
|
475
|
+
const allowedOpsBits = getAllowedOperations(e);
|
|
476
|
+
const allowedOps = allowedOperationsToArray(allowedOpsBits);
|
|
477
|
+
let dropOp = allowedOps[0] ?? "cancel";
|
|
478
|
+
if (typeof p.getDropOperation === "function" && e.dataTransfer) {
|
|
479
|
+
const types = new DragTypesImpl(e.dataTransfer);
|
|
480
|
+
dropOp = getDropOperationForAllowed(allowedOpsBits, p.getDropOperation(types, allowedOps));
|
|
481
|
+
}
|
|
482
|
+
if (typeof p.getDropOperationForPoint === "function" && e.dataTransfer) {
|
|
483
|
+
const types = new DragTypesImpl(e.dataTransfer);
|
|
484
|
+
const rect = e.currentTarget.getBoundingClientRect();
|
|
485
|
+
dropOp = getDropOperationForAllowed(allowedOpsBits, p.getDropOperationForPoint(types, allowedOps, e.clientX - rect.x, e.clientY - rect.y));
|
|
486
|
+
}
|
|
487
|
+
x = e.clientX;
|
|
488
|
+
y = e.clientY;
|
|
489
|
+
allowedOperations = allowedOpsBits;
|
|
490
|
+
dropEffect = DROP_OPERATION_TO_DROP_EFFECT[dropOp] || "none";
|
|
491
|
+
if (e.dataTransfer) e.dataTransfer.dropEffect = dropEffect;
|
|
492
|
+
if (dropOp !== "cancel") fireDropEnter(e);
|
|
493
|
+
};
|
|
494
|
+
const onDragOver = (e) => {
|
|
495
|
+
e.preventDefault();
|
|
496
|
+
e.stopPropagation();
|
|
497
|
+
const allowedOpsBits = getAllowedOperations(e);
|
|
498
|
+
if (e.clientX === x && e.clientY === y && allowedOpsBits === allowedOperations) {
|
|
499
|
+
if (e.dataTransfer) e.dataTransfer.dropEffect = dropEffect;
|
|
500
|
+
return;
|
|
501
|
+
}
|
|
502
|
+
x = e.clientX;
|
|
503
|
+
y = e.clientY;
|
|
504
|
+
const prevDropEffect = dropEffect;
|
|
505
|
+
const p = getProps();
|
|
506
|
+
if (allowedOpsBits !== allowedOperations) {
|
|
507
|
+
const allowedOps = allowedOperationsToArray(allowedOpsBits);
|
|
508
|
+
let dropOp = allowedOps[0] ?? "cancel";
|
|
509
|
+
if (typeof p.getDropOperation === "function" && e.dataTransfer) {
|
|
510
|
+
const types = new DragTypesImpl(e.dataTransfer);
|
|
511
|
+
dropOp = getDropOperationForAllowed(allowedOpsBits, p.getDropOperation(types, allowedOps));
|
|
512
|
+
}
|
|
513
|
+
dropEffect = DROP_OPERATION_TO_DROP_EFFECT[dropOp] || "none";
|
|
514
|
+
}
|
|
515
|
+
if (typeof p.getDropOperationForPoint === "function" && e.dataTransfer) {
|
|
516
|
+
const types = new DragTypesImpl(e.dataTransfer);
|
|
517
|
+
const rect = e.currentTarget.getBoundingClientRect();
|
|
518
|
+
dropEffect = DROP_OPERATION_TO_DROP_EFFECT[getDropOperationForAllowed(allowedOpsBits, p.getDropOperationForPoint(types, allowedOperationsToArray(allowedOpsBits), x - rect.x, y - rect.y))] || "none";
|
|
519
|
+
}
|
|
520
|
+
allowedOperations = allowedOpsBits;
|
|
521
|
+
if (e.dataTransfer) e.dataTransfer.dropEffect = dropEffect;
|
|
522
|
+
if (dropEffect === "none" && prevDropEffect !== "none") fireDropExit(e);
|
|
523
|
+
else if (dropEffect !== "none" && prevDropEffect === "none") fireDropEnter(e);
|
|
524
|
+
if (dropEffect !== "none") {
|
|
525
|
+
const rect = e.currentTarget.getBoundingClientRect();
|
|
526
|
+
state.moveInTarget(x - rect.x, y - rect.y);
|
|
527
|
+
}
|
|
528
|
+
clearTimeout(dropActivateTimer);
|
|
529
|
+
if (typeof p.onDropActivate === "function" && dropEffect !== "none") {
|
|
530
|
+
const rect = e.currentTarget.getBoundingClientRect();
|
|
531
|
+
const activateX = x - rect.x;
|
|
532
|
+
const activateY = y - rect.y;
|
|
533
|
+
dropActivateTimer = setTimeout(() => {
|
|
534
|
+
state.activateTarget(activateX, activateY);
|
|
535
|
+
}, DROP_ACTIVATE_TIMEOUT);
|
|
536
|
+
}
|
|
537
|
+
};
|
|
538
|
+
const onDragLeave = (e) => {
|
|
539
|
+
e.preventDefault();
|
|
540
|
+
e.stopPropagation();
|
|
541
|
+
dragOverElements.delete(e.target);
|
|
542
|
+
for (const element of dragOverElements) if (!e.currentTarget || !e.currentTarget.contains(element)) dragOverElements.delete(element);
|
|
543
|
+
if (dragOverElements.size > 0) return;
|
|
544
|
+
if (dropEffect !== "none") fireDropExit(e);
|
|
545
|
+
clearTimeout(dropActivateTimer);
|
|
546
|
+
};
|
|
547
|
+
const onDropHandler = (e) => {
|
|
548
|
+
e.preventDefault();
|
|
549
|
+
e.stopPropagation();
|
|
550
|
+
setGlobalDropEffect(dropEffect);
|
|
551
|
+
if (typeof getProps().onDrop === "function" && e.dataTransfer) {
|
|
552
|
+
const items = readFromDataTransfer(e.dataTransfer);
|
|
553
|
+
const dropOperation = DROP_EFFECT_TO_DROP_OPERATION[dropEffect];
|
|
554
|
+
const rect = e.currentTarget.getBoundingClientRect();
|
|
555
|
+
state.drop(e.clientX - rect.x, e.clientY - rect.y, items, dropOperation);
|
|
556
|
+
}
|
|
557
|
+
dragOverElements.clear();
|
|
558
|
+
fireDropExit(e);
|
|
559
|
+
clearTimeout(dropActivateTimer);
|
|
560
|
+
};
|
|
561
|
+
const dropProps = createMemo(() => {
|
|
562
|
+
if (getProps().isDisabled) return {};
|
|
563
|
+
return {
|
|
564
|
+
onDragEnter,
|
|
565
|
+
onDragOver,
|
|
566
|
+
onDragLeave,
|
|
567
|
+
onDrop: onDropHandler
|
|
568
|
+
};
|
|
569
|
+
});
|
|
570
|
+
const dropButtonProps = createMemo(() => {
|
|
571
|
+
if (getProps().isDisabled) return { disabled: true };
|
|
572
|
+
return {
|
|
573
|
+
type: "button",
|
|
574
|
+
"aria-label": "Drop"
|
|
575
|
+
};
|
|
576
|
+
});
|
|
577
|
+
return {
|
|
578
|
+
get dropProps() {
|
|
579
|
+
return dropProps();
|
|
580
|
+
},
|
|
581
|
+
get isDropTarget() {
|
|
582
|
+
return state.isDropTarget;
|
|
583
|
+
},
|
|
584
|
+
get dropButtonProps() {
|
|
585
|
+
return dropButtonProps();
|
|
586
|
+
}
|
|
587
|
+
};
|
|
588
|
+
}
|
|
589
|
+
//#endregion
|
|
590
|
+
//#region src/dnd/createDroppableCollection.ts
|
|
591
|
+
/**
|
|
592
|
+
* createDroppableCollection - ARIA hook for droppable collection targets.
|
|
593
|
+
*
|
|
594
|
+
* Provides accessibility support for dropping items into a collection
|
|
595
|
+
* component like ListBox, GridList, or Table.
|
|
596
|
+
*/
|
|
597
|
+
let globalDropCollectionRef = null;
|
|
598
|
+
function setGlobalDropCollectionRef(ref) {
|
|
599
|
+
globalDropCollectionRef = ref;
|
|
600
|
+
}
|
|
601
|
+
function getGlobalDropCollectionRef() {
|
|
602
|
+
return globalDropCollectionRef;
|
|
603
|
+
}
|
|
604
|
+
function getDropItemTypes(item) {
|
|
605
|
+
if (item.kind === "file") return new Set([item.type]);
|
|
606
|
+
if (item.kind === "text") return new Set(item.types);
|
|
607
|
+
return new Set([DIRECTORY_DRAG_TYPE]);
|
|
608
|
+
}
|
|
609
|
+
/**
|
|
610
|
+
* Creates ARIA support for a droppable collection.
|
|
611
|
+
*
|
|
612
|
+
* @param options - Collection options accessor
|
|
613
|
+
* @param state - Droppable collection state
|
|
614
|
+
* @returns Droppable collection ARIA result
|
|
615
|
+
*/
|
|
616
|
+
function createDroppableCollection(options, state) {
|
|
617
|
+
const getOptions = createMemo(() => options());
|
|
618
|
+
let nextTarget = null;
|
|
619
|
+
let currentDropOperation = null;
|
|
620
|
+
const isInternalDropOperation = () => {
|
|
621
|
+
const ref = getOptions().ref();
|
|
622
|
+
const draggingRef = getGlobalDraggingCollectionRef();
|
|
623
|
+
return ref !== null && draggingRef === ref;
|
|
624
|
+
};
|
|
625
|
+
const getDropOperationForTarget = (target, types, allowedOperations) => {
|
|
626
|
+
return state.getDropOperation(target, types, allowedOperations);
|
|
627
|
+
};
|
|
628
|
+
const drop = createDrop(() => ({
|
|
629
|
+
isDisabled: getOptions().isDisabled,
|
|
630
|
+
getDropOperationForPoint: (types, allowedOperations, x, y) => {
|
|
631
|
+
const opts = getOptions();
|
|
632
|
+
const isValidDropTarget = (target) => getDropOperationForTarget(target, types, allowedOperations) !== "cancel";
|
|
633
|
+
const target = opts.dropTargetDelegate.getDropTargetFromPoint(x, y, isValidDropTarget);
|
|
634
|
+
if (!target) {
|
|
635
|
+
currentDropOperation = "cancel";
|
|
636
|
+
nextTarget = null;
|
|
637
|
+
return "cancel";
|
|
638
|
+
}
|
|
639
|
+
currentDropOperation = getDropOperationForTarget(target, types, allowedOperations);
|
|
640
|
+
if (currentDropOperation === "cancel") {
|
|
641
|
+
const rootTarget = { type: "root" };
|
|
642
|
+
const rootOp = getDropOperationForTarget(rootTarget, types, allowedOperations);
|
|
643
|
+
if (rootOp !== "cancel") {
|
|
644
|
+
nextTarget = rootTarget;
|
|
645
|
+
currentDropOperation = rootOp;
|
|
646
|
+
return currentDropOperation;
|
|
647
|
+
}
|
|
648
|
+
}
|
|
649
|
+
const ref = opts.ref();
|
|
650
|
+
if (target && currentDropOperation !== "cancel" && ref !== globalDropCollectionRef) setGlobalDropCollectionRef(ref);
|
|
651
|
+
nextTarget = currentDropOperation === "cancel" ? null : target;
|
|
652
|
+
return currentDropOperation;
|
|
653
|
+
},
|
|
654
|
+
onDropEnter: () => {
|
|
655
|
+
if (nextTarget) state.setTarget(nextTarget);
|
|
656
|
+
},
|
|
657
|
+
onDropMove: () => {
|
|
658
|
+
if (nextTarget) state.setTarget(nextTarget);
|
|
659
|
+
},
|
|
660
|
+
onDropExit: () => {
|
|
661
|
+
setGlobalDropCollectionRef(null);
|
|
662
|
+
state.setTarget(null);
|
|
663
|
+
},
|
|
664
|
+
onDropActivate: (e) => {
|
|
665
|
+
const opts = getOptions();
|
|
666
|
+
if (state.target?.type === "item" && state.target.dropPosition === "on" && typeof opts.onDropActivate === "function") opts.onDropActivate({
|
|
667
|
+
target: state.target,
|
|
668
|
+
x: e.x,
|
|
669
|
+
y: e.y
|
|
670
|
+
});
|
|
671
|
+
},
|
|
672
|
+
onDrop: (e) => {
|
|
673
|
+
const opts = getOptions();
|
|
674
|
+
setGlobalDropCollectionRef(opts.ref());
|
|
675
|
+
if (state.target) {
|
|
676
|
+
const target = state.target;
|
|
677
|
+
const previousCollection = opts.collection;
|
|
678
|
+
const previousSelectedKeys = normalizeSelection(opts.selectedKeys);
|
|
679
|
+
opts.onDrop?.({
|
|
680
|
+
items: e.items,
|
|
681
|
+
target,
|
|
682
|
+
dropOperation: e.dropOperation,
|
|
683
|
+
x: e.x,
|
|
684
|
+
y: e.y
|
|
685
|
+
});
|
|
686
|
+
Promise.resolve(handleDrop(e.items, target, e.dropOperation)).then(() => {
|
|
687
|
+
queueMicrotask(() => {
|
|
688
|
+
updateFocusAfterDrop(getOptions(), previousCollection, previousSelectedKeys, target);
|
|
689
|
+
});
|
|
690
|
+
});
|
|
691
|
+
}
|
|
692
|
+
}
|
|
693
|
+
}));
|
|
694
|
+
const handleDrop = async (items, target, dropOperation) => {
|
|
695
|
+
const opts = getOptions();
|
|
696
|
+
const isInternal = isInternalDropOperation();
|
|
697
|
+
let filteredItems = items;
|
|
698
|
+
const acceptedTypes = opts.acceptedDragTypes;
|
|
699
|
+
if (acceptedTypes && acceptedTypes !== "all") filteredItems = items.filter((item) => {
|
|
700
|
+
const itemTypes = getDropItemTypes(item);
|
|
701
|
+
return acceptedTypes.some((type) => itemTypes.has(type));
|
|
702
|
+
});
|
|
703
|
+
if (filteredItems.length === 0) return;
|
|
704
|
+
if (target.type === "root" && opts.onRootDrop) await opts.onRootDrop({
|
|
705
|
+
items: filteredItems,
|
|
706
|
+
dropOperation
|
|
707
|
+
});
|
|
708
|
+
if (target.type === "item") {
|
|
709
|
+
if (target.dropPosition === "on" && opts.onItemDrop) await opts.onItemDrop({
|
|
710
|
+
items: filteredItems,
|
|
711
|
+
target,
|
|
712
|
+
dropOperation,
|
|
713
|
+
isInternal
|
|
714
|
+
});
|
|
715
|
+
if (opts.onMove && isInternal) {
|
|
716
|
+
const draggingKeys = getGlobalDraggingKeys();
|
|
717
|
+
await opts.onMove({
|
|
718
|
+
keys: draggingKeys,
|
|
719
|
+
target,
|
|
720
|
+
dropOperation
|
|
721
|
+
});
|
|
722
|
+
}
|
|
723
|
+
if (target.dropPosition !== "on") {
|
|
724
|
+
if (!isInternal && opts.onInsert) await opts.onInsert({
|
|
725
|
+
items: filteredItems,
|
|
726
|
+
target,
|
|
727
|
+
dropOperation
|
|
728
|
+
});
|
|
729
|
+
if (isInternal && opts.onReorder) {
|
|
730
|
+
const draggingKeys = getGlobalDraggingKeys();
|
|
731
|
+
await opts.onReorder({
|
|
732
|
+
keys: draggingKeys,
|
|
733
|
+
target,
|
|
734
|
+
dropOperation
|
|
735
|
+
});
|
|
736
|
+
}
|
|
737
|
+
}
|
|
738
|
+
}
|
|
739
|
+
};
|
|
740
|
+
onCleanup(() => {
|
|
741
|
+
const ref = getOptions().ref();
|
|
742
|
+
if (globalDropCollectionRef === ref) setGlobalDropCollectionRef(null);
|
|
743
|
+
});
|
|
744
|
+
const collectionProps = createMemo(() => {
|
|
745
|
+
const baseDropProps = drop.dropProps;
|
|
746
|
+
const onKeyDownBase = baseDropProps.onKeyDown;
|
|
747
|
+
const onKeyDown = (e) => {
|
|
748
|
+
onKeyDownBase?.(e);
|
|
749
|
+
const opts = getOptions();
|
|
750
|
+
if (opts.isDisabled) return;
|
|
751
|
+
const resolveDirection = () => {
|
|
752
|
+
const refEl = opts.ref();
|
|
753
|
+
if (refEl && typeof window !== "undefined" && typeof window.getComputedStyle === "function") {
|
|
754
|
+
if (window.getComputedStyle(refEl).direction === "rtl") return "rtl";
|
|
755
|
+
}
|
|
756
|
+
return typeof document !== "undefined" && document.dir === "rtl" ? "rtl" : "ltr";
|
|
757
|
+
};
|
|
758
|
+
const isRtl = resolveDirection() === "rtl";
|
|
759
|
+
const forwardHorizontalKey = isRtl ? "ArrowLeft" : "ArrowRight";
|
|
760
|
+
const backwardHorizontalKey = isRtl ? "ArrowRight" : "ArrowLeft";
|
|
761
|
+
const callUserOnKeyDown = () => opts.onKeyDown?.(e);
|
|
762
|
+
const getKeyboardAllowedOperations = () => {
|
|
763
|
+
const allowedBits = getGlobalAllowedDropOperations();
|
|
764
|
+
if (!allowedBits) return [
|
|
765
|
+
"copy",
|
|
766
|
+
"move",
|
|
767
|
+
"link"
|
|
768
|
+
];
|
|
769
|
+
const allowed = [];
|
|
770
|
+
if (allowedBits & 2) allowed.push("copy");
|
|
771
|
+
if (allowedBits & 1) allowed.push("move");
|
|
772
|
+
if (allowedBits & 4) allowed.push("link");
|
|
773
|
+
return allowed.length > 0 ? allowed : [
|
|
774
|
+
"copy",
|
|
775
|
+
"move",
|
|
776
|
+
"link"
|
|
777
|
+
];
|
|
778
|
+
};
|
|
779
|
+
const getKeyboardDragTypes = () => {
|
|
780
|
+
const draggingTypes = getGlobalDraggingTypes();
|
|
781
|
+
if (draggingTypes.size === 0) return { has: () => true };
|
|
782
|
+
return { has: (type) => typeof type === "string" && draggingTypes.has(type) };
|
|
783
|
+
};
|
|
784
|
+
const isValidDropTarget = (target) => state.getDropOperation(target, getKeyboardDragTypes(), getKeyboardAllowedOperations()) !== "cancel";
|
|
785
|
+
const targetsEqual = (a, b) => {
|
|
786
|
+
if (a.type !== b.type) return false;
|
|
787
|
+
if (a.type === "root" && b.type === "root") return true;
|
|
788
|
+
if (a.type !== "item" || b.type !== "item") return false;
|
|
789
|
+
return a.key === b.key && a.dropPosition === b.dropPosition;
|
|
790
|
+
};
|
|
791
|
+
const findNextValidTarget = (start, getNext) => {
|
|
792
|
+
let current = start;
|
|
793
|
+
let seenRoot = 0;
|
|
794
|
+
let safety = 0;
|
|
795
|
+
while (safety < 256) {
|
|
796
|
+
safety += 1;
|
|
797
|
+
const next = getNext(current);
|
|
798
|
+
if (!next) return null;
|
|
799
|
+
if (current && targetsEqual(current, next)) return isValidDropTarget(next) ? next : null;
|
|
800
|
+
current = next;
|
|
801
|
+
if (next.type === "root") {
|
|
802
|
+
seenRoot += 1;
|
|
803
|
+
if (seenRoot >= 2) return isValidDropTarget(next) ? next : null;
|
|
804
|
+
}
|
|
805
|
+
if (isValidDropTarget(next)) return next;
|
|
806
|
+
}
|
|
807
|
+
return null;
|
|
808
|
+
};
|
|
809
|
+
const resolveTargetForKey = (key, direction) => {
|
|
810
|
+
if (key == null) return null;
|
|
811
|
+
const onTarget = {
|
|
812
|
+
type: "item",
|
|
813
|
+
key,
|
|
814
|
+
dropPosition: "on"
|
|
815
|
+
};
|
|
816
|
+
if (isValidDropTarget(onTarget)) return onTarget;
|
|
817
|
+
const insertionOrder = direction === "next" ? ["before", "after"] : ["after", "before"];
|
|
818
|
+
for (const position of insertionOrder) {
|
|
819
|
+
const insertionTarget = {
|
|
820
|
+
type: "item",
|
|
821
|
+
key,
|
|
822
|
+
dropPosition: position
|
|
823
|
+
};
|
|
824
|
+
if (isValidDropTarget(insertionTarget)) return insertionTarget;
|
|
825
|
+
}
|
|
826
|
+
return null;
|
|
827
|
+
};
|
|
828
|
+
const resolveBoundaryTargetForDirection = (key, direction) => {
|
|
829
|
+
if (key == null) return null;
|
|
830
|
+
const boundaryOrder = direction === "next" ? [
|
|
831
|
+
"before",
|
|
832
|
+
"on",
|
|
833
|
+
"after"
|
|
834
|
+
] : [
|
|
835
|
+
"after",
|
|
836
|
+
"on",
|
|
837
|
+
"before"
|
|
838
|
+
];
|
|
839
|
+
for (const position of boundaryOrder) {
|
|
840
|
+
const candidate = {
|
|
841
|
+
type: "item",
|
|
842
|
+
key,
|
|
843
|
+
dropPosition: position
|
|
844
|
+
};
|
|
845
|
+
if (isValidDropTarget(candidate)) return candidate;
|
|
846
|
+
}
|
|
847
|
+
return null;
|
|
848
|
+
};
|
|
849
|
+
const resolveFallbackKeyboardTarget = (keyName, currentTarget = state.target) => {
|
|
850
|
+
const keyboardDelegate = opts.keyboardDelegate;
|
|
851
|
+
if (!keyboardDelegate) return null;
|
|
852
|
+
const currentKey = currentTarget?.type === "item" ? currentTarget.key : null;
|
|
853
|
+
const keyForDirection = (direction, getter) => {
|
|
854
|
+
if (currentKey == null) return resolveBoundaryTargetForDirection((direction === "next" ? keyboardDelegate.getFirstKey?.() : keyboardDelegate.getLastKey?.()) ?? null, direction);
|
|
855
|
+
if (!getter) return null;
|
|
856
|
+
let nextKey = getter(currentKey);
|
|
857
|
+
let safety = 0;
|
|
858
|
+
while (nextKey != null && safety < 256) {
|
|
859
|
+
const resolvedTarget = resolveTargetForKey(nextKey, direction);
|
|
860
|
+
if (resolvedTarget) return resolvedTarget;
|
|
861
|
+
const candidate = getter(nextKey);
|
|
862
|
+
if (candidate === nextKey) break;
|
|
863
|
+
nextKey = candidate;
|
|
864
|
+
safety += 1;
|
|
865
|
+
}
|
|
866
|
+
return null;
|
|
867
|
+
};
|
|
868
|
+
if (keyName === "ArrowDown") return keyForDirection("next", keyboardDelegate.getKeyBelow);
|
|
869
|
+
if (keyName === "ArrowUp") return keyForDirection("previous", keyboardDelegate.getKeyAbove);
|
|
870
|
+
if (keyName === forwardHorizontalKey) return keyForDirection("next", isRtl ? keyboardDelegate.getKeyLeftOf : keyboardDelegate.getKeyRightOf);
|
|
871
|
+
if (keyName === backwardHorizontalKey) return keyForDirection("previous", isRtl ? keyboardDelegate.getKeyRightOf : keyboardDelegate.getKeyLeftOf);
|
|
872
|
+
if (keyName === "Home") return resolveBoundaryTargetForDirection(keyboardDelegate.getFirstKey?.() ?? null, "next");
|
|
873
|
+
if (keyName === "End") return resolveBoundaryTargetForDirection(keyboardDelegate.getLastKey?.() ?? null, "previous");
|
|
874
|
+
if (keyName === "PageDown") {
|
|
875
|
+
if (currentKey != null && keyboardDelegate.getKeyPageBelow) return resolveTargetForKey(keyboardDelegate.getKeyPageBelow(currentKey), "next");
|
|
876
|
+
return keyForDirection("next", keyboardDelegate.getKeyBelow);
|
|
877
|
+
}
|
|
878
|
+
if (keyName === "PageUp") {
|
|
879
|
+
if (currentKey != null && keyboardDelegate.getKeyPageAbove) return resolveTargetForKey(keyboardDelegate.getKeyPageAbove(currentKey), "previous");
|
|
880
|
+
return keyForDirection("previous", keyboardDelegate.getKeyAbove);
|
|
881
|
+
}
|
|
882
|
+
return null;
|
|
883
|
+
};
|
|
884
|
+
const resolvePageTargetForState = (direction, currentTarget) => {
|
|
885
|
+
const keyboardDelegate = opts.keyboardDelegate;
|
|
886
|
+
if (!keyboardDelegate) return null;
|
|
887
|
+
if (direction === "next") {
|
|
888
|
+
let targetKey = keyboardDelegate.getFirstKey?.() ?? null;
|
|
889
|
+
let dropPosition = "after";
|
|
890
|
+
if (currentTarget.type === "item") {
|
|
891
|
+
targetKey = currentTarget.key;
|
|
892
|
+
dropPosition = currentTarget.dropPosition;
|
|
893
|
+
}
|
|
894
|
+
let nextKey = targetKey != null ? keyboardDelegate.getKeyPageBelow?.(targetKey) ?? null : null;
|
|
895
|
+
if (nextKey == null || currentTarget.type === "item" && currentTarget.key === keyboardDelegate.getLastKey?.()) {
|
|
896
|
+
nextKey = keyboardDelegate.getLastKey?.() ?? null;
|
|
897
|
+
dropPosition = "after";
|
|
898
|
+
}
|
|
899
|
+
if (nextKey == null) return null;
|
|
900
|
+
return {
|
|
901
|
+
type: "item",
|
|
902
|
+
key: nextKey,
|
|
903
|
+
dropPosition
|
|
904
|
+
};
|
|
905
|
+
}
|
|
906
|
+
if (currentTarget.type === "item") {
|
|
907
|
+
if (currentTarget.key === keyboardDelegate.getFirstKey?.()) return { type: "root" };
|
|
908
|
+
let nextKey = keyboardDelegate.getKeyPageAbove?.(currentTarget.key) ?? null;
|
|
909
|
+
let dropPosition = currentTarget.dropPosition;
|
|
910
|
+
if (nextKey == null) {
|
|
911
|
+
nextKey = keyboardDelegate.getFirstKey?.() ?? null;
|
|
912
|
+
dropPosition = "before";
|
|
913
|
+
}
|
|
914
|
+
if (nextKey == null) return null;
|
|
915
|
+
return {
|
|
916
|
+
type: "item",
|
|
917
|
+
key: nextKey,
|
|
918
|
+
dropPosition
|
|
919
|
+
};
|
|
920
|
+
}
|
|
921
|
+
return currentTarget.type === "root" ? currentTarget : null;
|
|
922
|
+
};
|
|
923
|
+
if (e.key === "PageDown" || e.key === "PageUp") {
|
|
924
|
+
if (e.key === "PageDown" && !opts.keyboardDelegate?.getKeyPageBelow || e.key === "PageUp" && !opts.keyboardDelegate?.getKeyPageAbove) {
|
|
925
|
+
callUserOnKeyDown();
|
|
926
|
+
return;
|
|
927
|
+
}
|
|
928
|
+
const direction = e.key === "PageDown" ? "next" : "previous";
|
|
929
|
+
const pageNavigation = opts.dropTargetDelegate.getKeyboardPageNavigationTarget;
|
|
930
|
+
const stepNavigation = opts.dropTargetDelegate.getKeyboardNavigationTarget;
|
|
931
|
+
const resolveStepTarget = (target, navDirection) => stepNavigation?.(target, navDirection, isValidDropTarget) ?? resolveFallbackKeyboardTarget(navDirection === "next" ? "ArrowDown" : "ArrowUp", target) ?? resolveFallbackKeyboardTarget(navDirection === "next" ? "Home" : "End", target) ?? null;
|
|
932
|
+
let nextTarget = null;
|
|
933
|
+
if (!state.target) nextTarget = findNextValidTarget(null, (target) => resolveStepTarget(target, direction));
|
|
934
|
+
else {
|
|
935
|
+
const pageTarget = pageNavigation?.(state.target, direction, isValidDropTarget) ?? resolvePageTargetForState(direction, state.target) ?? null;
|
|
936
|
+
if (pageTarget && isValidDropTarget(pageTarget)) nextTarget = pageTarget;
|
|
937
|
+
else {
|
|
938
|
+
const startTarget = pageTarget ?? state.target;
|
|
939
|
+
nextTarget = findNextValidTarget(startTarget, (target) => resolveStepTarget(target, direction)) ?? findNextValidTarget(startTarget, (target) => resolveStepTarget(target, direction === "next" ? "previous" : "next"));
|
|
940
|
+
}
|
|
941
|
+
}
|
|
942
|
+
if (nextTarget) {
|
|
943
|
+
e.preventDefault();
|
|
944
|
+
state.setTarget(nextTarget);
|
|
945
|
+
}
|
|
946
|
+
callUserOnKeyDown();
|
|
947
|
+
return;
|
|
948
|
+
}
|
|
949
|
+
if ((e.key === "ArrowDown" || e.key === "ArrowUp" || e.key === "ArrowRight" || e.key === "ArrowLeft" || e.key === "Home" || e.key === "End") && opts.dropTargetDelegate.getKeyboardNavigationTarget) {
|
|
950
|
+
if (e.key === "ArrowDown" && !opts.keyboardDelegate?.getKeyBelow || e.key === "ArrowUp" && !opts.keyboardDelegate?.getKeyAbove || e.key === "ArrowLeft" && !opts.keyboardDelegate?.getKeyLeftOf || e.key === "ArrowRight" && !opts.keyboardDelegate?.getKeyRightOf || e.key === "Home" && !opts.keyboardDelegate?.getFirstKey || e.key === "End" && !opts.keyboardDelegate?.getLastKey) {
|
|
951
|
+
callUserOnKeyDown();
|
|
952
|
+
return;
|
|
953
|
+
}
|
|
954
|
+
const direction = e.key === "ArrowDown" || e.key === forwardHorizontalKey || e.key === "Home" ? "next" : "previous";
|
|
955
|
+
const nextTarget = findNextValidTarget(e.key === "Home" || e.key === "End" ? null : state.target, (target) => opts.dropTargetDelegate.getKeyboardNavigationTarget?.(target, direction, isValidDropTarget) ?? resolveFallbackKeyboardTarget(e.key, target));
|
|
956
|
+
if (nextTarget) {
|
|
957
|
+
e.preventDefault();
|
|
958
|
+
state.setTarget(nextTarget);
|
|
959
|
+
}
|
|
960
|
+
callUserOnKeyDown();
|
|
961
|
+
return;
|
|
962
|
+
}
|
|
963
|
+
if (e.key === "ArrowDown" || e.key === "ArrowUp" || e.key === "ArrowRight" || e.key === "ArrowLeft" || e.key === "Home" || e.key === "End") {
|
|
964
|
+
if (e.key === "ArrowDown" && !opts.keyboardDelegate?.getKeyBelow || e.key === "ArrowUp" && !opts.keyboardDelegate?.getKeyAbove || e.key === "ArrowLeft" && !opts.keyboardDelegate?.getKeyLeftOf || e.key === "ArrowRight" && !opts.keyboardDelegate?.getKeyRightOf || e.key === "Home" && !opts.keyboardDelegate?.getFirstKey || e.key === "End" && !opts.keyboardDelegate?.getLastKey) {
|
|
965
|
+
callUserOnKeyDown();
|
|
966
|
+
return;
|
|
967
|
+
}
|
|
968
|
+
const nextTarget = findNextValidTarget(e.key === "Home" || e.key === "End" ? null : state.target, (target) => resolveFallbackKeyboardTarget(e.key, target));
|
|
969
|
+
if (nextTarget) {
|
|
970
|
+
e.preventDefault();
|
|
971
|
+
state.setTarget(nextTarget);
|
|
972
|
+
}
|
|
973
|
+
callUserOnKeyDown();
|
|
974
|
+
return;
|
|
975
|
+
}
|
|
976
|
+
if (e.key === "Enter" && state.target) {
|
|
977
|
+
e.preventDefault();
|
|
978
|
+
state.activateTarget(0, 0);
|
|
979
|
+
callUserOnKeyDown();
|
|
980
|
+
return;
|
|
981
|
+
}
|
|
982
|
+
if (e.key === "Escape" && state.target) {
|
|
983
|
+
e.preventDefault();
|
|
984
|
+
state.exitTarget(0, 0);
|
|
985
|
+
callUserOnKeyDown();
|
|
986
|
+
return;
|
|
987
|
+
}
|
|
988
|
+
callUserOnKeyDown();
|
|
989
|
+
};
|
|
990
|
+
return {
|
|
991
|
+
...baseDropProps,
|
|
992
|
+
onKeyDown
|
|
993
|
+
};
|
|
994
|
+
});
|
|
995
|
+
return { get collectionProps() {
|
|
996
|
+
return collectionProps();
|
|
997
|
+
} };
|
|
998
|
+
}
|
|
999
|
+
function normalizeSelection(selection) {
|
|
1000
|
+
if (selection == null) return null;
|
|
1001
|
+
if (selection === "all") return "all";
|
|
1002
|
+
return new Set(selection);
|
|
1003
|
+
}
|
|
1004
|
+
function selectionEquals(a, b) {
|
|
1005
|
+
if (a === b) return true;
|
|
1006
|
+
if (!a || !b || a === "all" || b === "all") return false;
|
|
1007
|
+
if (a.size !== b.size) return false;
|
|
1008
|
+
for (const key of a) if (!b.has(key)) return false;
|
|
1009
|
+
return true;
|
|
1010
|
+
}
|
|
1011
|
+
function getNewItemKeys(collection, previousCollection) {
|
|
1012
|
+
const keys = /* @__PURE__ */ new Set();
|
|
1013
|
+
const visit = (node) => {
|
|
1014
|
+
if (node.type === "item" && !previousCollection.getItem(node.key)) keys.add(node.key);
|
|
1015
|
+
for (const child of node.childNodes ?? []) visit(child);
|
|
1016
|
+
};
|
|
1017
|
+
for (const node of collection) visit(node);
|
|
1018
|
+
return keys;
|
|
1019
|
+
}
|
|
1020
|
+
function updateFocusAfterDrop(opts, previousCollection, previousSelectedKeys, target) {
|
|
1021
|
+
const collection = opts.collection;
|
|
1022
|
+
if (!collection || !previousCollection) return;
|
|
1023
|
+
const newKeys = getNewItemKeys(collection, previousCollection);
|
|
1024
|
+
if (newKeys.size === 0) return;
|
|
1025
|
+
const currentSelectedKeys = normalizeSelection(opts.selectedKeys);
|
|
1026
|
+
if (opts.setSelectedKeys && previousSelectedKeys && selectionEquals(previousSelectedKeys, currentSelectedKeys)) opts.setSelectedKeys(newKeys);
|
|
1027
|
+
const first = newKeys.values().next().value;
|
|
1028
|
+
if (first == null) return;
|
|
1029
|
+
let focusKey = first;
|
|
1030
|
+
const item = collection.getItem(first);
|
|
1031
|
+
const parent = item?.parentKey != null ? collection.getItem(item.parentKey) : null;
|
|
1032
|
+
const isDroppedOnCollapsedParent = target.type === "item" && target.dropPosition === "on" && item?.parentKey != null && parent?.isExpanded !== true;
|
|
1033
|
+
if (item && (item.type === "cell" || item.type === "rowheader" || isDroppedOnCollapsedParent)) focusKey = item.parentKey ?? first;
|
|
1034
|
+
opts.setFocusedKey?.(focusKey);
|
|
1035
|
+
queueMicrotask(() => {
|
|
1036
|
+
(opts.ref()?.querySelector("[role=\"row\"][tabindex=\"0\"]"))?.focus();
|
|
1037
|
+
});
|
|
1038
|
+
}
|
|
1039
|
+
//#endregion
|
|
1040
|
+
//#region src/dnd/createDraggableItem.ts
|
|
1041
|
+
/**
|
|
1042
|
+
* createDraggableItem - ARIA hook for draggable items within a collection.
|
|
1043
|
+
*
|
|
1044
|
+
* Provides accessibility props for items that can be dragged from a collection.
|
|
1045
|
+
*/
|
|
1046
|
+
/**
|
|
1047
|
+
* Creates ARIA props for a draggable item within a collection.
|
|
1048
|
+
*
|
|
1049
|
+
* @param options - Accessor returning item options
|
|
1050
|
+
* @param state - Draggable collection state
|
|
1051
|
+
* @returns Draggable item ARIA props
|
|
1052
|
+
*/
|
|
1053
|
+
function createDraggableItem(options, state) {
|
|
1054
|
+
const getOptions = createMemo(() => options());
|
|
1055
|
+
let lastX = 0;
|
|
1056
|
+
let lastY = 0;
|
|
1057
|
+
const isDragging = createMemo(() => {
|
|
1058
|
+
const key = getOptions().key;
|
|
1059
|
+
return state.draggingKeys.has(key);
|
|
1060
|
+
});
|
|
1061
|
+
const getKeysForDrag = () => {
|
|
1062
|
+
const { key } = getOptions();
|
|
1063
|
+
return new Set([key]);
|
|
1064
|
+
};
|
|
1065
|
+
const onDragStart = (e) => {
|
|
1066
|
+
if (e.defaultPrevented) return;
|
|
1067
|
+
e.stopPropagation();
|
|
1068
|
+
const opts = getOptions();
|
|
1069
|
+
if (opts.isDisabled || state.isDisabled) return;
|
|
1070
|
+
const keys = getKeysForDrag();
|
|
1071
|
+
state.startDrag(keys, e.clientX, e.clientY);
|
|
1072
|
+
const items = state.getItems(keys);
|
|
1073
|
+
setGlobalDraggingTypes(getTypes(items));
|
|
1074
|
+
e.dataTransfer?.clearData?.();
|
|
1075
|
+
if (e.dataTransfer) writeToDataTransfer(e.dataTransfer, items);
|
|
1076
|
+
let allowed = 7;
|
|
1077
|
+
const allowedOps = state.getAllowedDropOperations();
|
|
1078
|
+
if (allowedOps.length > 0) {
|
|
1079
|
+
allowed = 0;
|
|
1080
|
+
for (const op of allowedOps) allowed |= DROP_OPERATION[op] || 0;
|
|
1081
|
+
}
|
|
1082
|
+
setGlobalAllowedDropOperations(allowed);
|
|
1083
|
+
const effectAllowed = EFFECT_ALLOWED[allowed] || "none";
|
|
1084
|
+
if (e.dataTransfer) e.dataTransfer.effectAllowed = effectAllowed === "cancel" ? "none" : effectAllowed;
|
|
1085
|
+
const preview = opts.preview ?? state.preview;
|
|
1086
|
+
if (typeof preview?.current === "function" && e.dataTransfer) preview.current(items, (node, userX, userY) => {
|
|
1087
|
+
if (!node || !e.dataTransfer) return;
|
|
1088
|
+
const size = node.getBoundingClientRect();
|
|
1089
|
+
const rect = e.currentTarget.getBoundingClientRect();
|
|
1090
|
+
let defaultX = e.clientX - rect.x;
|
|
1091
|
+
let defaultY = e.clientY - rect.y;
|
|
1092
|
+
if (defaultX > size.width || defaultY > size.height) {
|
|
1093
|
+
defaultX = size.width / 2;
|
|
1094
|
+
defaultY = size.height / 2;
|
|
1095
|
+
}
|
|
1096
|
+
let offsetX = typeof userX === "number" ? userX : defaultX;
|
|
1097
|
+
let offsetY = typeof userY === "number" ? userY : defaultY;
|
|
1098
|
+
offsetX = Math.max(0, Math.min(offsetX, size.width));
|
|
1099
|
+
offsetY = Math.max(0, Math.min(offsetY, size.height));
|
|
1100
|
+
e.dataTransfer.setDragImage(node, offsetX, offsetY);
|
|
1101
|
+
});
|
|
1102
|
+
lastX = e.clientX;
|
|
1103
|
+
lastY = e.clientY;
|
|
1104
|
+
};
|
|
1105
|
+
const onDrag = (e) => {
|
|
1106
|
+
e.stopPropagation();
|
|
1107
|
+
if (e.clientX === lastX && e.clientY === lastY) return;
|
|
1108
|
+
state.moveDrag(e.clientX, e.clientY);
|
|
1109
|
+
lastX = e.clientX;
|
|
1110
|
+
lastY = e.clientY;
|
|
1111
|
+
};
|
|
1112
|
+
const onDragEnd = (e) => {
|
|
1113
|
+
e.stopPropagation();
|
|
1114
|
+
let dropEffect = e.dataTransfer?.dropEffect ?? "none";
|
|
1115
|
+
if (getGlobalDropEffect()) dropEffect = getGlobalDropEffect();
|
|
1116
|
+
const dropOperation = DROP_EFFECT_TO_DROP_OPERATION[dropEffect];
|
|
1117
|
+
state.endDrag(e.clientX, e.clientY, dropOperation, false);
|
|
1118
|
+
setGlobalAllowedDropOperations(0);
|
|
1119
|
+
setGlobalDraggingTypes(/* @__PURE__ */ new Set());
|
|
1120
|
+
setGlobalDropEffect(void 0);
|
|
1121
|
+
};
|
|
1122
|
+
const onKeyDown = (e) => {
|
|
1123
|
+
if (e.key === "Enter" && e.target === e.currentTarget) {
|
|
1124
|
+
e.preventDefault();
|
|
1125
|
+
e.stopPropagation();
|
|
1126
|
+
}
|
|
1127
|
+
};
|
|
1128
|
+
const onKeyUp = (e) => {
|
|
1129
|
+
if (e.key === "Enter" && e.target === e.currentTarget) {
|
|
1130
|
+
e.preventDefault();
|
|
1131
|
+
e.stopPropagation();
|
|
1132
|
+
if (getOptions().isDisabled || state.isDisabled) return;
|
|
1133
|
+
const keys = getKeysForDrag();
|
|
1134
|
+
const rect = e.target.getBoundingClientRect();
|
|
1135
|
+
state.startDrag(keys, rect.x + rect.width / 2, rect.y + rect.height / 2);
|
|
1136
|
+
setGlobalDraggingTypes(getTypes(state.getItems(keys)));
|
|
1137
|
+
let allowed = 7;
|
|
1138
|
+
const allowedOps = state.getAllowedDropOperations();
|
|
1139
|
+
if (allowedOps.length > 0) {
|
|
1140
|
+
allowed = 0;
|
|
1141
|
+
for (const op of allowedOps) allowed |= DROP_OPERATION[op] || 0;
|
|
1142
|
+
}
|
|
1143
|
+
setGlobalAllowedDropOperations(allowed);
|
|
1144
|
+
}
|
|
1145
|
+
};
|
|
1146
|
+
const dragProps = createMemo(() => {
|
|
1147
|
+
const opts = getOptions();
|
|
1148
|
+
if (opts.isDisabled || state.isDisabled) return { draggable: false };
|
|
1149
|
+
const baseProps = {
|
|
1150
|
+
draggable: true,
|
|
1151
|
+
onDragStart,
|
|
1152
|
+
onDrag,
|
|
1153
|
+
onDragEnd
|
|
1154
|
+
};
|
|
1155
|
+
if (!opts.hasDragButton) {
|
|
1156
|
+
baseProps.onKeyDown = onKeyDown;
|
|
1157
|
+
baseProps.onKeyUp = onKeyUp;
|
|
1158
|
+
}
|
|
1159
|
+
return baseProps;
|
|
1160
|
+
});
|
|
1161
|
+
const dragButtonProps = createMemo(() => {
|
|
1162
|
+
if (getOptions().isDisabled || state.isDisabled) return { disabled: true };
|
|
1163
|
+
return {
|
|
1164
|
+
type: "button",
|
|
1165
|
+
"aria-label": "Drag",
|
|
1166
|
+
onKeyDown,
|
|
1167
|
+
onKeyUp
|
|
1168
|
+
};
|
|
1169
|
+
});
|
|
1170
|
+
return {
|
|
1171
|
+
get dragProps() {
|
|
1172
|
+
return dragProps();
|
|
1173
|
+
},
|
|
1174
|
+
get dragButtonProps() {
|
|
1175
|
+
return dragButtonProps();
|
|
1176
|
+
},
|
|
1177
|
+
get isDragging() {
|
|
1178
|
+
return isDragging();
|
|
1179
|
+
}
|
|
1180
|
+
};
|
|
1181
|
+
}
|
|
1182
|
+
//#endregion
|
|
1183
|
+
//#region src/dnd/createDroppableItem.ts
|
|
1184
|
+
/**
|
|
1185
|
+
* createDroppableItem - ARIA hook for droppable items within a collection.
|
|
1186
|
+
*
|
|
1187
|
+
* Provides accessibility props for items that can receive drops.
|
|
1188
|
+
*/
|
|
1189
|
+
/**
|
|
1190
|
+
* Creates ARIA props for a droppable item within a collection.
|
|
1191
|
+
*
|
|
1192
|
+
* @param options - Accessor returning item options
|
|
1193
|
+
* @param state - Droppable collection state
|
|
1194
|
+
* @returns Droppable item ARIA props
|
|
1195
|
+
*/
|
|
1196
|
+
function createDroppableItem(options, state) {
|
|
1197
|
+
const getOptions = createMemo(() => options());
|
|
1198
|
+
const isDropTarget = createMemo(() => {
|
|
1199
|
+
const { key } = getOptions();
|
|
1200
|
+
const target = state.target;
|
|
1201
|
+
return target?.type === "item" && target.key === key;
|
|
1202
|
+
});
|
|
1203
|
+
const getTarget = (dropPosition) => {
|
|
1204
|
+
const { key } = getOptions();
|
|
1205
|
+
return {
|
|
1206
|
+
type: "item",
|
|
1207
|
+
key,
|
|
1208
|
+
dropPosition
|
|
1209
|
+
};
|
|
1210
|
+
};
|
|
1211
|
+
const getDropOperation = (e, target) => {
|
|
1212
|
+
if (!e.dataTransfer) return "cancel";
|
|
1213
|
+
const types = new DragTypesImpl(e.dataTransfer);
|
|
1214
|
+
let allowedBits = DROP_OPERATION_ALLOWED[e.dataTransfer.effectAllowed] || 7;
|
|
1215
|
+
const globalAllowed = getGlobalAllowedDropOperations();
|
|
1216
|
+
if (globalAllowed) allowedBits &= globalAllowed;
|
|
1217
|
+
const allowedOperations = [];
|
|
1218
|
+
if (allowedBits & 1) allowedOperations.push("move");
|
|
1219
|
+
if (allowedBits & 2) allowedOperations.push("copy");
|
|
1220
|
+
if (allowedBits & 4) allowedOperations.push("link");
|
|
1221
|
+
return state.getDropOperation(target, types, allowedOperations);
|
|
1222
|
+
};
|
|
1223
|
+
let dropActivateTimer;
|
|
1224
|
+
const DROP_ACTIVATE_TIMEOUT = 800;
|
|
1225
|
+
const onDragEnter = (e) => {
|
|
1226
|
+
e.preventDefault();
|
|
1227
|
+
e.stopPropagation();
|
|
1228
|
+
if (getOptions().isDisabled) return;
|
|
1229
|
+
const rect = e.currentTarget.getBoundingClientRect();
|
|
1230
|
+
e.clientX - rect.x;
|
|
1231
|
+
const y = e.clientY - rect.y;
|
|
1232
|
+
const height = rect.height;
|
|
1233
|
+
let dropPosition;
|
|
1234
|
+
if (y < height * .25) dropPosition = "before";
|
|
1235
|
+
else if (y > height * .75) dropPosition = "after";
|
|
1236
|
+
else dropPosition = "on";
|
|
1237
|
+
const target = getTarget(dropPosition);
|
|
1238
|
+
const operation = getDropOperation(e, target);
|
|
1239
|
+
if (operation !== "cancel") {
|
|
1240
|
+
state.setTarget(target);
|
|
1241
|
+
e.dataTransfer.dropEffect = DROP_OPERATION_TO_DROP_EFFECT[operation];
|
|
1242
|
+
}
|
|
1243
|
+
};
|
|
1244
|
+
const onDragOver = (e) => {
|
|
1245
|
+
e.preventDefault();
|
|
1246
|
+
e.stopPropagation();
|
|
1247
|
+
if (getOptions().isDisabled) return;
|
|
1248
|
+
const rect = e.currentTarget.getBoundingClientRect();
|
|
1249
|
+
const x = e.clientX - rect.x;
|
|
1250
|
+
const y = e.clientY - rect.y;
|
|
1251
|
+
const height = rect.height;
|
|
1252
|
+
let dropPosition;
|
|
1253
|
+
if (y < height * .25) dropPosition = "before";
|
|
1254
|
+
else if (y > height * .75) dropPosition = "after";
|
|
1255
|
+
else dropPosition = "on";
|
|
1256
|
+
const target = getTarget(dropPosition);
|
|
1257
|
+
const operation = getDropOperation(e, target);
|
|
1258
|
+
if (operation !== "cancel") {
|
|
1259
|
+
state.setTarget(target);
|
|
1260
|
+
e.dataTransfer.dropEffect = DROP_OPERATION_TO_DROP_EFFECT[operation];
|
|
1261
|
+
clearTimeout(dropActivateTimer);
|
|
1262
|
+
if (dropPosition === "on") dropActivateTimer = setTimeout(() => {
|
|
1263
|
+
state.activateTarget(x, y);
|
|
1264
|
+
}, DROP_ACTIVATE_TIMEOUT);
|
|
1265
|
+
} else e.dataTransfer.dropEffect = "none";
|
|
1266
|
+
};
|
|
1267
|
+
const onDragLeave = (e) => {
|
|
1268
|
+
e.preventDefault();
|
|
1269
|
+
e.stopPropagation();
|
|
1270
|
+
clearTimeout(dropActivateTimer);
|
|
1271
|
+
const relatedTarget = e.relatedTarget;
|
|
1272
|
+
const currentTarget = e.currentTarget;
|
|
1273
|
+
if (!relatedTarget || !currentTarget.contains(relatedTarget)) {
|
|
1274
|
+
const { key } = getOptions();
|
|
1275
|
+
if (state.target?.type === "item" && state.target.key === key) {}
|
|
1276
|
+
}
|
|
1277
|
+
};
|
|
1278
|
+
const onDrop = (e) => {
|
|
1279
|
+
e.preventDefault();
|
|
1280
|
+
e.stopPropagation();
|
|
1281
|
+
clearTimeout(dropActivateTimer);
|
|
1282
|
+
};
|
|
1283
|
+
const dropProps = createMemo(() => {
|
|
1284
|
+
if (getOptions().isDisabled) return {};
|
|
1285
|
+
return {
|
|
1286
|
+
onDragEnter,
|
|
1287
|
+
onDragOver,
|
|
1288
|
+
onDragLeave,
|
|
1289
|
+
onDrop
|
|
1290
|
+
};
|
|
1291
|
+
});
|
|
1292
|
+
return {
|
|
1293
|
+
get dropProps() {
|
|
1294
|
+
return dropProps();
|
|
1295
|
+
},
|
|
1296
|
+
get isDropTarget() {
|
|
1297
|
+
return isDropTarget();
|
|
1298
|
+
}
|
|
1299
|
+
};
|
|
1300
|
+
}
|
|
1301
|
+
//#endregion
|
|
1302
|
+
export { readFromDataTransfer as A, NATIVE_DRAG_TYPES as C, isDirectoryDropItem as D, getTypes as E, setGlobalDropEffect as M, writeToDataTransfer as N, isFileDropItem as O, GENERIC_TYPE as S, getGlobalDropEffect as T, DROP_OPERATION as _, setGlobalDropCollectionRef as a, DragTypesImpl as b, createDraggableCollection as c, getGlobalDraggingTypes as d, setGlobalDraggingCollectionRef as f, DROP_EFFECT_TO_DROP_OPERATION as g, CUSTOM_DRAG_TYPE as h, getGlobalDropCollectionRef as i, setGlobalAllowedDropOperations as j, isTextDropItem as k, getGlobalDraggingCollectionRef as l, setGlobalDraggingTypes as m, createDraggableItem as n, createDrop as o, setGlobalDraggingKeys as p, createDroppableCollection as r, createDrag as s, createDroppableItem as t, getGlobalDraggingKeys as u, DROP_OPERATION_ALLOWED as v, getGlobalAllowedDropOperations as w, EFFECT_ALLOWED as x, DROP_OPERATION_TO_DROP_EFFECT as y };
|
|
1303
|
+
|
|
1304
|
+
//# sourceMappingURL=dnd.js.map
|