@proyecto-viviana/solidaria 0.4.0 → 0.4.2
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/dist/_chunk/DragManager.js +627 -0
- package/dist/_chunk/DragManager.js.map +1 -0
- package/dist/_chunk/DragManager.jsx +627 -0
- package/dist/_chunk/DragManager.jsx.map +1 -0
- package/dist/_chunk/FocusScope.js +400 -0
- package/dist/_chunk/FocusScope.js.map +1 -0
- package/dist/_chunk/FocusScope.jsx +375 -0
- package/dist/_chunk/FocusScope.jsx.map +1 -0
- package/dist/_chunk/actiongroup.js +13 -79
- package/dist/_chunk/actiongroup.js.map +1 -1
- package/dist/_chunk/actiongroup.jsx +13 -79
- package/dist/_chunk/actiongroup.jsx.map +1 -1
- package/dist/_chunk/{live-announcer.js → announce.js} +1 -1
- package/dist/_chunk/announce.js.map +1 -0
- package/dist/_chunk/{live-announcer.jsx → announce.jsx} +1 -1
- package/dist/_chunk/announce.jsx.map +1 -0
- package/dist/_chunk/autocomplete.js +56 -8
- package/dist/_chunk/autocomplete.js.map +1 -1
- package/dist/_chunk/autocomplete.jsx +56 -8
- package/dist/_chunk/autocomplete.jsx.map +1 -1
- package/dist/_chunk/breadcrumbs.js +6 -4
- package/dist/_chunk/breadcrumbs.js.map +1 -1
- package/dist/_chunk/breadcrumbs.jsx +6 -4
- package/dist/_chunk/breadcrumbs.jsx.map +1 -1
- package/dist/_chunk/button.js +8 -9
- package/dist/_chunk/button.js.map +1 -1
- package/dist/_chunk/button.jsx +8 -9
- package/dist/_chunk/button.jsx.map +1 -1
- package/dist/_chunk/calendar.js +27 -26
- package/dist/_chunk/calendar.js.map +1 -1
- package/dist/_chunk/calendar.jsx +27 -26
- package/dist/_chunk/calendar.jsx.map +1 -1
- package/dist/_chunk/checkbox.js +5 -4
- package/dist/_chunk/checkbox.js.map +1 -1
- package/dist/_chunk/checkbox.jsx +5 -4
- package/dist/_chunk/checkbox.jsx.map +1 -1
- package/dist/_chunk/color.js +302 -18
- package/dist/_chunk/color.js.map +1 -1
- package/dist/_chunk/color.jsx +302 -18
- package/dist/_chunk/color.jsx.map +1 -1
- package/dist/_chunk/combobox.js +638 -12
- package/dist/_chunk/combobox.js.map +1 -1
- package/dist/_chunk/combobox.jsx +638 -12
- package/dist/_chunk/combobox.jsx.map +1 -1
- package/dist/_chunk/constants.js +19 -0
- package/dist/_chunk/constants.js.map +1 -0
- package/dist/_chunk/constants.jsx +19 -0
- package/dist/_chunk/constants.jsx.map +1 -0
- package/dist/_chunk/createCollator.js +3 -171
- package/dist/_chunk/createCollator.js.map +1 -1
- package/dist/_chunk/createCollator.jsx +3 -165
- package/dist/_chunk/createCollator.jsx.map +1 -1
- package/dist/_chunk/createField.js +2 -1
- package/dist/_chunk/createField.js.map +1 -1
- package/dist/_chunk/createField.jsx +2 -1
- package/dist/_chunk/createField.jsx.map +1 -1
- package/dist/_chunk/createFocus.js +12 -8
- package/dist/_chunk/createFocus.js.map +1 -1
- package/dist/_chunk/createFocus.jsx +12 -8
- package/dist/_chunk/createFocus.jsx.map +1 -1
- package/dist/_chunk/createFocusWithin.js +12 -13
- package/dist/_chunk/createFocusWithin.js.map +1 -1
- package/dist/_chunk/createFocusWithin.jsx +12 -13
- package/dist/_chunk/createFocusWithin.jsx.map +1 -1
- package/dist/_chunk/createFocusable.js +3 -3
- package/dist/_chunk/createFocusable.js.map +1 -1
- package/dist/_chunk/createFocusable.jsx +3 -3
- package/dist/_chunk/createFocusable.jsx.map +1 -1
- package/dist/_chunk/{form.js → createFormReset.js} +1 -1
- package/dist/_chunk/createFormReset.js.map +1 -0
- package/dist/_chunk/{form.jsx → createFormReset.jsx} +1 -1
- package/dist/_chunk/createFormReset.jsx.map +1 -0
- package/dist/_chunk/createHover.js +2 -1
- package/dist/_chunk/createHover.js.map +1 -1
- package/dist/_chunk/createHover.jsx +2 -1
- package/dist/_chunk/createHover.jsx.map +1 -1
- package/dist/_chunk/createInteractionModality.js +2 -3
- package/dist/_chunk/createInteractionModality.js.map +1 -1
- package/dist/_chunk/createInteractionModality.jsx +2 -3
- package/dist/_chunk/createInteractionModality.jsx.map +1 -1
- package/dist/_chunk/createLabel.js +2 -1
- package/dist/_chunk/createLabel.js.map +1 -1
- package/dist/_chunk/createLabel.jsx +2 -1
- package/dist/_chunk/createLabel.jsx.map +1 -1
- package/dist/_chunk/createLabels.js +3 -2
- package/dist/_chunk/createLabels.js.map +1 -1
- package/dist/_chunk/createLabels.jsx +3 -2
- package/dist/_chunk/createLabels.jsx.map +1 -1
- package/dist/_chunk/createLandmark.js +1 -1
- package/dist/_chunk/createLandmark.jsx +1 -1
- package/dist/_chunk/createProgressBar.js +2 -1
- package/dist/_chunk/createProgressBar.js.map +1 -1
- package/dist/_chunk/createProgressBar.jsx +2 -1
- package/dist/_chunk/createProgressBar.jsx.map +1 -1
- package/dist/_chunk/createSelectableItem.js +7 -3
- package/dist/_chunk/createSelectableItem.js.map +1 -1
- package/dist/_chunk/createSelectableItem.jsx +7 -3
- package/dist/_chunk/createSelectableItem.jsx.map +1 -1
- package/dist/_chunk/createStringFormatter.js +61 -0
- package/dist/_chunk/createStringFormatter.js.map +1 -0
- package/dist/_chunk/createStringFormatter.jsx +61 -0
- package/dist/_chunk/createStringFormatter.jsx.map +1 -0
- package/dist/_chunk/createToggle.js +5 -4
- package/dist/_chunk/createToggle.js.map +1 -1
- package/dist/_chunk/createToggle.jsx +5 -4
- package/dist/_chunk/createToggle.jsx.map +1 -1
- package/dist/_chunk/datepicker.js +1413 -1100
- package/dist/_chunk/datepicker.js.map +1 -1
- package/dist/_chunk/datepicker.jsx +1413 -1100
- package/dist/_chunk/datepicker.jsx.map +1 -1
- package/dist/_chunk/disclosure.js +2 -2
- package/dist/_chunk/disclosure.js.map +1 -1
- package/dist/_chunk/disclosure.jsx +2 -2
- package/dist/_chunk/disclosure.jsx.map +1 -1
- package/dist/_chunk/dnd.js +1586 -495
- package/dist/_chunk/dnd.js.map +1 -1
- package/dist/_chunk/dnd.jsx +1586 -495
- package/dist/_chunk/dnd.jsx.map +1 -1
- package/dist/_chunk/env.js +1 -19
- package/dist/_chunk/env.js.map +1 -1
- package/dist/_chunk/env.jsx +1 -19
- package/dist/_chunk/env.jsx.map +1 -1
- package/dist/_chunk/focus.js +1 -1
- package/dist/_chunk/focus.js.map +1 -1
- package/dist/_chunk/focus.jsx +1 -1
- package/dist/_chunk/focus.jsx.map +1 -1
- package/dist/_chunk/focus2.js +54 -318
- package/dist/_chunk/focus2.js.map +1 -1
- package/dist/_chunk/focus2.jsx +53 -292
- package/dist/_chunk/focus2.jsx.map +1 -1
- package/dist/_chunk/grid.js +1 -1
- package/dist/_chunk/grid.jsx +1 -1
- package/dist/_chunk/gridlist.js +14 -9
- package/dist/_chunk/gridlist.js.map +1 -1
- package/dist/_chunk/gridlist.jsx +14 -9
- package/dist/_chunk/gridlist.jsx.map +1 -1
- package/dist/_chunk/i18n.js +3 -58
- package/dist/_chunk/i18n.js.map +1 -1
- package/dist/_chunk/i18n.jsx +3 -58
- package/dist/_chunk/i18n.jsx.map +1 -1
- package/dist/_chunk/interactions.js +99 -9
- package/dist/_chunk/interactions.js.map +1 -1
- package/dist/_chunk/interactions.jsx +97 -9
- package/dist/_chunk/interactions.jsx.map +1 -1
- package/dist/_chunk/link.js +2 -1
- package/dist/_chunk/link.js.map +1 -1
- package/dist/_chunk/link.jsx +2 -1
- package/dist/_chunk/link.jsx.map +1 -1
- package/dist/_chunk/listbox.js +42 -10
- package/dist/_chunk/listbox.js.map +1 -1
- package/dist/_chunk/listbox.jsx +42 -10
- package/dist/_chunk/listbox.jsx.map +1 -1
- package/dist/_chunk/locale.js +173 -0
- package/dist/_chunk/locale.js.map +1 -0
- package/dist/_chunk/locale.jsx +167 -0
- package/dist/_chunk/locale.jsx.map +1 -0
- package/dist/_chunk/menu.js +5 -4
- package/dist/_chunk/menu.js.map +1 -1
- package/dist/_chunk/menu.jsx +5 -4
- package/dist/_chunk/menu.jsx.map +1 -1
- package/dist/_chunk/numberfield.js +3 -2
- package/dist/_chunk/numberfield.js.map +1 -1
- package/dist/_chunk/numberfield.jsx +3 -2
- package/dist/_chunk/numberfield.jsx.map +1 -1
- package/dist/_chunk/overlays.js +1 -1
- package/dist/_chunk/overlays.jsx +1 -1
- package/dist/_chunk/popover.js +3 -3
- package/dist/_chunk/popover.js.map +1 -1
- package/dist/_chunk/popover.jsx +3 -3
- package/dist/_chunk/popover.jsx.map +1 -1
- package/dist/_chunk/radio.js +7 -6
- package/dist/_chunk/radio.js.map +1 -1
- package/dist/_chunk/radio.jsx +7 -6
- package/dist/_chunk/radio.jsx.map +1 -1
- package/dist/_chunk/reactivity.js +21 -0
- package/dist/_chunk/reactivity.js.map +1 -0
- package/dist/_chunk/reactivity.jsx +21 -0
- package/dist/_chunk/reactivity.jsx.map +1 -0
- package/dist/_chunk/searchfield.js +2 -1
- package/dist/_chunk/searchfield.js.map +1 -1
- package/dist/_chunk/searchfield.jsx +2 -1
- package/dist/_chunk/searchfield.jsx.map +1 -1
- package/dist/_chunk/select.js +8 -5
- package/dist/_chunk/select.js.map +1 -1
- package/dist/_chunk/select.jsx +8 -5
- package/dist/_chunk/select.jsx.map +1 -1
- package/dist/_chunk/selection.js +8 -21
- package/dist/_chunk/selection.js.map +1 -1
- package/dist/_chunk/selection.jsx +8 -21
- package/dist/_chunk/selection.jsx.map +1 -1
- package/dist/_chunk/separator.js +1 -1
- package/dist/_chunk/separator.jsx +1 -1
- package/dist/_chunk/slider.js +5 -4
- package/dist/_chunk/slider.js.map +1 -1
- package/dist/_chunk/slider.jsx +5 -4
- package/dist/_chunk/slider.jsx.map +1 -1
- package/dist/_chunk/spinbutton.js +153 -0
- package/dist/_chunk/spinbutton.js.map +1 -0
- package/dist/_chunk/spinbutton.jsx +153 -0
- package/dist/_chunk/spinbutton.jsx.map +1 -0
- package/dist/_chunk/table.js +45 -8
- package/dist/_chunk/table.js.map +1 -1
- package/dist/_chunk/table.jsx +45 -8
- package/dist/_chunk/table.jsx.map +1 -1
- package/dist/_chunk/tabs.js +11 -8
- package/dist/_chunk/tabs.js.map +1 -1
- package/dist/_chunk/tabs.jsx +11 -8
- package/dist/_chunk/tabs.jsx.map +1 -1
- package/dist/_chunk/tag.js +54 -18
- package/dist/_chunk/tag.js.map +1 -1
- package/dist/_chunk/tag.jsx +54 -18
- package/dist/_chunk/tag.jsx.map +1 -1
- package/dist/_chunk/textfield.js +2 -1
- package/dist/_chunk/textfield.js.map +1 -1
- package/dist/_chunk/textfield.jsx +2 -1
- package/dist/_chunk/textfield.jsx.map +1 -1
- package/dist/_chunk/toolbar.js +4 -36
- package/dist/_chunk/toolbar.js.map +1 -1
- package/dist/_chunk/toolbar.jsx +4 -36
- package/dist/_chunk/toolbar.jsx.map +1 -1
- package/dist/_chunk/tooltip.js +2 -2
- package/dist/_chunk/tooltip.js.map +1 -1
- package/dist/_chunk/tooltip.jsx +2 -2
- package/dist/_chunk/tooltip.jsx.map +1 -1
- package/dist/_chunk/tree.js +42 -14
- package/dist/_chunk/tree.js.map +1 -1
- package/dist/_chunk/tree.jsx +42 -14
- package/dist/_chunk/tree.jsx.map +1 -1
- package/dist/_chunk/utils.js +59 -19
- package/dist/_chunk/utils.js.map +1 -1
- package/dist/_chunk/utils.jsx +59 -19
- package/dist/_chunk/utils.jsx.map +1 -1
- package/dist/_chunk/visually-hidden.js +3 -2
- package/dist/_chunk/visually-hidden.js.map +1 -1
- package/dist/_chunk/visually-hidden.jsx +3 -2
- package/dist/_chunk/visually-hidden.jsx.map +1 -1
- package/dist/actiongroup/createActionGroup.d.ts.map +1 -1
- package/dist/autocomplete/createAutocomplete.d.ts +10 -7
- package/dist/autocomplete/createAutocomplete.d.ts.map +1 -1
- package/dist/breadcrumbs/createBreadcrumbs.d.ts.map +1 -1
- package/dist/button/createToggleButtonGroup.d.ts.map +1 -1
- package/dist/calendar/createCalendar.d.ts.map +1 -1
- package/dist/calendar/createCalendarCell.d.ts.map +1 -1
- package/dist/calendar/createCalendarGrid.d.ts.map +1 -1
- package/dist/calendar/createRangeCalendar.d.ts.map +1 -1
- package/dist/calendar/createRangeCalendarCell.d.ts.map +1 -1
- package/dist/calendar/intl/index.d.ts +1 -1
- package/dist/calendar/intl/index.d.ts.map +1 -1
- package/dist/collections/index.js +1 -1
- package/dist/collections/index.jsx +1 -1
- package/dist/color/createColorArea.d.ts.map +1 -1
- package/dist/color/createColorField.d.ts.map +1 -1
- package/dist/color/createColorSlider.d.ts.map +1 -1
- package/dist/color/createColorSwatch.d.ts.map +1 -1
- package/dist/color/createColorWheel.d.ts.map +1 -1
- package/dist/color/intl/index.d.ts +30 -0
- package/dist/color/intl/index.d.ts.map +1 -0
- package/dist/combobox/createComboBox.d.ts.map +1 -1
- package/dist/combobox/intl/generated-locales.d.ts +16 -0
- package/dist/combobox/intl/generated-locales.d.ts.map +1 -0
- package/dist/combobox/intl/index.d.ts +2 -2
- package/dist/combobox/intl/index.d.ts.map +1 -1
- package/dist/datepicker/createDateField.d.ts +45 -23
- package/dist/datepicker/createDateField.d.ts.map +1 -1
- package/dist/datepicker/createDatePicker.d.ts +34 -6
- package/dist/datepicker/createDatePicker.d.ts.map +1 -1
- package/dist/datepicker/createDatePickerGroup.d.ts +13 -13
- package/dist/datepicker/createDatePickerGroup.d.ts.map +1 -1
- package/dist/datepicker/createDateRangePicker.d.ts +55 -7
- package/dist/datepicker/createDateRangePicker.d.ts.map +1 -1
- package/dist/datepicker/createDateSegment.d.ts +6 -15
- package/dist/datepicker/createDateSegment.d.ts.map +1 -1
- package/dist/datepicker/createDisplayNames.d.ts +17 -0
- package/dist/datepicker/createDisplayNames.d.ts.map +1 -0
- package/dist/datepicker/createTimeField.d.ts +12 -49
- package/dist/datepicker/createTimeField.d.ts.map +1 -1
- package/dist/datepicker/index.d.ts +3 -3
- package/dist/datepicker/index.d.ts.map +1 -1
- package/dist/datepicker/index.js +2 -2
- package/dist/datepicker/index.jsx +2 -2
- package/dist/datepicker/intl.d.ts +12 -0
- package/dist/datepicker/intl.d.ts.map +1 -0
- package/dist/dnd/DragManager.d.ts +86 -0
- package/dist/dnd/DragManager.d.ts.map +1 -0
- package/dist/dnd/DropTargetKeyboardNavigation.d.ts +42 -0
- package/dist/dnd/DropTargetKeyboardNavigation.d.ts.map +1 -0
- package/dist/dnd/createDrag.d.ts.map +1 -1
- package/dist/dnd/createDraggableCollection.d.ts.map +1 -1
- package/dist/dnd/createDraggableItem.d.ts +12 -7
- package/dist/dnd/createDraggableItem.d.ts.map +1 -1
- package/dist/dnd/createDroppableCollection.d.ts +7 -15
- package/dist/dnd/createDroppableCollection.d.ts.map +1 -1
- package/dist/dnd/index.d.ts +5 -1
- package/dist/dnd/index.d.ts.map +1 -1
- package/dist/dnd/index.js +3 -2
- package/dist/dnd/index.jsx +3 -2
- package/dist/dnd/intl/index.d.ts +39 -0
- package/dist/dnd/intl/index.d.ts.map +1 -0
- package/dist/dnd/utils.d.ts +5 -0
- package/dist/dnd/utils.d.ts.map +1 -1
- package/dist/focus/FocusScope.d.ts +7 -0
- package/dist/focus/FocusScope.d.ts.map +1 -1
- package/dist/focus/index.d.ts +2 -1
- package/dist/focus/index.d.ts.map +1 -1
- package/dist/focus/index.js +3 -2
- package/dist/focus/index.jsx +3 -2
- package/dist/focus/virtualFocus.d.ts +26 -0
- package/dist/focus/virtualFocus.d.ts.map +1 -0
- package/dist/form/index.js +1 -1
- package/dist/form/index.jsx +1 -1
- package/dist/gridlist/createGridList.d.ts.map +1 -1
- package/dist/i18n/index.js +4 -2
- package/dist/i18n/index.jsx +4 -2
- package/dist/index.d.ts +3 -3
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +18 -12
- package/dist/index.jsx +18 -12
- package/dist/interactions/FocusableProvider.d.ts.map +1 -1
- package/dist/interactions/createFocus.d.ts.map +1 -1
- package/dist/interactions/createFocusWithin.d.ts.map +1 -1
- package/dist/interactions/createInteractionModality.d.ts.map +1 -1
- package/dist/interactions/index.js +1 -2
- package/dist/interactions/index.jsx +1 -2
- package/dist/label/createLabels.d.ts.map +1 -1
- package/dist/listbox/createListBox.d.ts.map +1 -1
- package/dist/listbox/createOption.d.ts +1 -1
- package/dist/listbox/createOption.d.ts.map +1 -1
- package/dist/live-announcer/index.js +1 -1
- package/dist/live-announcer/index.jsx +1 -1
- package/dist/select/createSelect.d.ts +2 -0
- package/dist/select/createSelect.d.ts.map +1 -1
- package/dist/selection/createSelectableItem.d.ts.map +1 -1
- package/dist/selection/index.js +2 -1
- package/dist/selection/index.jsx +2 -1
- package/dist/spinbutton/createSpinButton.d.ts +41 -0
- package/dist/spinbutton/createSpinButton.d.ts.map +1 -0
- package/dist/spinbutton/index.d.ts +3 -0
- package/dist/spinbutton/index.d.ts.map +1 -0
- package/dist/spinbutton/index.js +2 -0
- package/dist/spinbutton/index.jsx +2 -0
- package/dist/spinbutton/intl.d.ts +5 -0
- package/dist/spinbutton/intl.d.ts.map +1 -0
- package/dist/table/createTable.d.ts.map +1 -1
- package/dist/table/createTableColumnHeader.d.ts.map +1 -1
- package/dist/table/createTableRow.d.ts.map +1 -1
- package/dist/table/createTableSelectionCheckbox.d.ts.map +1 -1
- package/dist/table/types.d.ts +8 -0
- package/dist/table/types.d.ts.map +1 -1
- package/dist/table/utils.d.ts +15 -0
- package/dist/table/utils.d.ts.map +1 -0
- package/dist/tabs/createTabs.d.ts +1 -0
- package/dist/tabs/createTabs.d.ts.map +1 -1
- package/dist/tag/createTag.d.ts.map +1 -1
- package/dist/tag/createTagGroup.d.ts +7 -0
- package/dist/tag/createTagGroup.d.ts.map +1 -1
- package/dist/toolbar/createToolbar.d.ts.map +1 -1
- package/dist/tree/createTree.d.ts.map +1 -1
- package/dist/tree/createTreeSelectionCheckbox.d.ts.map +1 -1
- package/dist/utils/animation.d.ts.map +1 -1
- package/dist/utils/dom.d.ts +1 -0
- package/dist/utils/dom.d.ts.map +1 -1
- package/dist/utils/index.d.ts +1 -1
- package/dist/utils/index.d.ts.map +1 -1
- package/dist/utils/index.js +4 -3
- package/dist/utils/index.jsx +4 -3
- package/package.json +2 -2
- package/src/actiongroup/createActionGroup.ts +26 -109
- package/src/autocomplete/createAutocomplete.ts +136 -15
- package/src/breadcrumbs/createBreadcrumbs.ts +12 -4
- package/src/button/createToggleButtonGroup.ts +19 -14
- package/src/calendar/createCalendar.ts +3 -4
- package/src/calendar/createCalendarCell.ts +17 -3
- package/src/calendar/createCalendarGrid.ts +5 -4
- package/src/calendar/createRangeCalendar.ts +27 -17
- package/src/calendar/createRangeCalendarCell.ts +17 -3
- package/src/calendar/intl/index.ts +8 -0
- package/src/color/createColorArea.ts +17 -10
- package/src/color/createColorField.ts +8 -1
- package/src/color/createColorSlider.ts +1 -2
- package/src/color/createColorSwatch.ts +4 -2
- package/src/color/createColorWheel.ts +0 -6
- package/src/color/intl/index.ts +316 -0
- package/src/combobox/createComboBox.ts +35 -4
- package/src/combobox/intl/generated-locales.ts +635 -0
- package/src/combobox/intl/index.ts +8 -2
- package/src/datepicker/createDateField.ts +228 -213
- package/src/datepicker/createDatePicker.ts +157 -146
- package/src/datepicker/createDatePickerGroup.ts +88 -82
- package/src/datepicker/createDateRangePicker.ts +230 -179
- package/src/datepicker/createDateSegment.ts +386 -389
- package/src/datepicker/createDisplayNames.ts +45 -0
- package/src/datepicker/createTimeField.ts +36 -129
- package/src/datepicker/index.ts +13 -14
- package/src/datepicker/intl.ts +633 -0
- package/src/dnd/DragManager.ts +693 -0
- package/src/dnd/DropTargetKeyboardNavigation.ts +337 -0
- package/src/dnd/createDrag.ts +31 -5
- package/src/dnd/createDraggableCollection.ts +33 -15
- package/src/dnd/createDraggableItem.ts +92 -5
- package/src/dnd/createDroppableCollection.ts +487 -373
- package/src/dnd/index.ts +11 -0
- package/src/dnd/intl/ar-AE.json +29 -0
- package/src/dnd/intl/bg-BG.json +29 -0
- package/src/dnd/intl/cs-CZ.json +29 -0
- package/src/dnd/intl/da-DK.json +29 -0
- package/src/dnd/intl/de-DE.json +29 -0
- package/src/dnd/intl/el-GR.json +29 -0
- package/src/dnd/intl/en-US.json +29 -0
- package/src/dnd/intl/es-ES.json +29 -0
- package/src/dnd/intl/et-EE.json +29 -0
- package/src/dnd/intl/fi-FI.json +29 -0
- package/src/dnd/intl/fr-FR.json +29 -0
- package/src/dnd/intl/he-IL.json +29 -0
- package/src/dnd/intl/hr-HR.json +29 -0
- package/src/dnd/intl/hu-HU.json +29 -0
- package/src/dnd/intl/index.ts +139 -0
- package/src/dnd/intl/it-IT.json +29 -0
- package/src/dnd/intl/ja-JP.json +29 -0
- package/src/dnd/intl/ko-KR.json +29 -0
- package/src/dnd/intl/lt-LT.json +29 -0
- package/src/dnd/intl/lv-LV.json +29 -0
- package/src/dnd/intl/nb-NO.json +29 -0
- package/src/dnd/intl/nl-NL.json +29 -0
- package/src/dnd/intl/pl-PL.json +29 -0
- package/src/dnd/intl/pt-BR.json +29 -0
- package/src/dnd/intl/pt-PT.json +29 -0
- package/src/dnd/intl/ro-RO.json +29 -0
- package/src/dnd/intl/ru-RU.json +29 -0
- package/src/dnd/intl/sk-SK.json +29 -0
- package/src/dnd/intl/sl-SI.json +29 -0
- package/src/dnd/intl/sr-SP.json +29 -0
- package/src/dnd/intl/sv-SE.json +29 -0
- package/src/dnd/intl/tr-TR.json +29 -0
- package/src/dnd/intl/uk-UA.json +29 -0
- package/src/dnd/intl/zh-CN.json +29 -0
- package/src/dnd/intl/zh-TW.json +29 -0
- package/src/dnd/utils.ts +36 -0
- package/src/focus/FocusScope.tsx +120 -12
- package/src/focus/index.ts +8 -0
- package/src/focus/virtualFocus.ts +55 -0
- package/src/gridlist/createGridList.ts +52 -16
- package/src/index.ts +11 -3
- package/src/interactions/FocusableProvider.tsx +11 -6
- package/src/interactions/createFocus.ts +26 -21
- package/src/interactions/createFocusWithin.ts +23 -24
- package/src/interactions/createInteractionModality.ts +5 -3
- package/src/label/createLabels.ts +7 -4
- package/src/listbox/createListBox.ts +74 -2
- package/src/listbox/createOption.ts +16 -1
- package/src/select/createSelect.ts +23 -2
- package/src/selection/createSelectableItem.ts +14 -0
- package/src/spinbutton/createSpinButton.ts +163 -0
- package/src/spinbutton/index.ts +10 -0
- package/src/spinbutton/intl.ts +115 -0
- package/src/table/createTable.ts +26 -1
- package/src/table/createTableColumnHeader.ts +10 -0
- package/src/table/createTableRow.ts +10 -0
- package/src/table/createTableSelectionCheckbox.ts +24 -1
- package/src/table/types.ts +8 -0
- package/src/table/utils.ts +41 -0
- package/src/tabs/createTabs.ts +53 -12
- package/src/tag/createTag.ts +21 -32
- package/src/tag/createTagGroup.ts +92 -0
- package/src/toolbar/createToolbar.ts +6 -58
- package/src/tree/createTree.ts +69 -14
- package/src/tree/createTreeSelectionCheckbox.ts +14 -1
- package/src/utils/animation.ts +119 -27
- package/src/utils/dom.ts +3 -2
- package/src/utils/index.ts +2 -0
- package/dist/_chunk/createLongPress.js +0 -91
- package/dist/_chunk/createLongPress.js.map +0 -1
- package/dist/_chunk/createLongPress.jsx +0 -91
- package/dist/_chunk/createLongPress.jsx.map +0 -1
- package/dist/_chunk/form.js.map +0 -1
- package/dist/_chunk/form.jsx.map +0 -1
- package/dist/_chunk/live-announcer.js.map +0 -1
- package/dist/_chunk/live-announcer.jsx.map +0 -1
- package/dist/datepicker/createTimeSegment.d.ts +0 -29
- package/dist/datepicker/createTimeSegment.d.ts.map +0 -1
- package/src/datepicker/createTimeSegment.ts +0 -352
|
@@ -0,0 +1,337 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Keyboard navigation between drop targets within a droppable collection.
|
|
3
|
+
*
|
|
4
|
+
* Faithful port of @react-aria/dnd `DropTargetKeyboardNavigation` (react-aria
|
|
5
|
+
* 3.50). Given a keyboard delegate, the collection, and the current drop target,
|
|
6
|
+
* returns the next/previous drop target in a given direction — cycling through
|
|
7
|
+
* the `before`/`on`/`after` drop positions on each item and descending into
|
|
8
|
+
* nested items.
|
|
9
|
+
*
|
|
10
|
+
* Upstream reads `node.nextKey` / `node.prevKey` (the flattened collection
|
|
11
|
+
* linked-list pointers). In our collection model those are exactly what
|
|
12
|
+
* `collection.getKeyAfter(key)` / `collection.getKeyBefore(key)` return, so they
|
|
13
|
+
* are substituted 1:1 with no behavioral difference. Upstream's `lastChildKey`
|
|
14
|
+
* fast-path is absent from our `CollectionNode`, so we always take upstream's
|
|
15
|
+
* own `childNodes.findLast` fallback branch.
|
|
16
|
+
*/
|
|
17
|
+
|
|
18
|
+
import type { Collection, CollectionNode, Key } from "@proyecto-viviana/solid-stately";
|
|
19
|
+
import type { DropTarget } from "@proyecto-viviana/solid-stately";
|
|
20
|
+
|
|
21
|
+
/**
|
|
22
|
+
* Keyboard delegate shape consumed by drop-target navigation. Mirrors the
|
|
23
|
+
* subset of `@react-types/shared` `KeyboardDelegate` that navigation uses,
|
|
24
|
+
* including the `{includeDisabled}` option so drop positions around disabled
|
|
25
|
+
* items remain reachable.
|
|
26
|
+
*/
|
|
27
|
+
export interface DropNavigationKeyboardDelegate {
|
|
28
|
+
getKeyBelow?(key: Key, options?: { includeDisabled?: boolean }): Key | null;
|
|
29
|
+
getKeyAbove?(key: Key, options?: { includeDisabled?: boolean }): Key | null;
|
|
30
|
+
getKeyLeftOf?(key: Key, options?: { includeDisabled?: boolean }): Key | null;
|
|
31
|
+
getKeyRightOf?(key: Key, options?: { includeDisabled?: boolean }): Key | null;
|
|
32
|
+
getFirstKey?(key?: Key, global?: boolean): Key | null;
|
|
33
|
+
getLastKey?(key?: Key, global?: boolean): Key | null;
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
export function navigate(
|
|
37
|
+
keyboardDelegate: DropNavigationKeyboardDelegate,
|
|
38
|
+
collection: Collection,
|
|
39
|
+
target: DropTarget | null | undefined,
|
|
40
|
+
direction: "left" | "right" | "up" | "down",
|
|
41
|
+
rtl = false,
|
|
42
|
+
wrap = false,
|
|
43
|
+
): DropTarget | null {
|
|
44
|
+
switch (direction) {
|
|
45
|
+
case "left":
|
|
46
|
+
return rtl
|
|
47
|
+
? nextDropTarget(keyboardDelegate, collection, target, wrap, "left")
|
|
48
|
+
: previousDropTarget(keyboardDelegate, collection, target, wrap, "left");
|
|
49
|
+
case "right":
|
|
50
|
+
return rtl
|
|
51
|
+
? previousDropTarget(keyboardDelegate, collection, target, wrap, "right")
|
|
52
|
+
: nextDropTarget(keyboardDelegate, collection, target, wrap, "right");
|
|
53
|
+
case "up":
|
|
54
|
+
return previousDropTarget(keyboardDelegate, collection, target, wrap);
|
|
55
|
+
case "down":
|
|
56
|
+
return nextDropTarget(keyboardDelegate, collection, target, wrap);
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
function nextDropTarget(
|
|
61
|
+
keyboardDelegate: DropNavigationKeyboardDelegate,
|
|
62
|
+
collection: Collection,
|
|
63
|
+
target: DropTarget | null | undefined,
|
|
64
|
+
wrap = false,
|
|
65
|
+
horizontal: "left" | "right" | null = null,
|
|
66
|
+
): DropTarget | null {
|
|
67
|
+
if (!target) {
|
|
68
|
+
return {
|
|
69
|
+
type: "root",
|
|
70
|
+
};
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
if (target.type === "root") {
|
|
74
|
+
let nextKey = keyboardDelegate.getFirstKey?.() ?? null;
|
|
75
|
+
if (nextKey != null) {
|
|
76
|
+
return {
|
|
77
|
+
type: "item",
|
|
78
|
+
key: nextKey,
|
|
79
|
+
dropPosition: "before",
|
|
80
|
+
};
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
return null;
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
if (target.type === "item") {
|
|
87
|
+
let nextKey: Key | null | undefined = null;
|
|
88
|
+
if (horizontal) {
|
|
89
|
+
nextKey =
|
|
90
|
+
horizontal === "right"
|
|
91
|
+
? keyboardDelegate.getKeyRightOf?.(target.key, { includeDisabled: true })
|
|
92
|
+
: keyboardDelegate.getKeyLeftOf?.(target.key, { includeDisabled: true });
|
|
93
|
+
} else {
|
|
94
|
+
nextKey = keyboardDelegate.getKeyBelow?.(target.key, { includeDisabled: true });
|
|
95
|
+
}
|
|
96
|
+
let nextCollectionKey = getNextItem(collection, target.key, (key) => collection.getKeyAfter(key));
|
|
97
|
+
|
|
98
|
+
// If the keyboard delegate did not move to the next key in the collection,
|
|
99
|
+
// jump to that key with the same drop position. Otherwise, try the other
|
|
100
|
+
// drop positions on the current key first.
|
|
101
|
+
if (nextKey != null && nextKey !== nextCollectionKey) {
|
|
102
|
+
return {
|
|
103
|
+
type: "item",
|
|
104
|
+
key: nextKey,
|
|
105
|
+
dropPosition: target.dropPosition,
|
|
106
|
+
};
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
switch (target.dropPosition) {
|
|
110
|
+
case "before": {
|
|
111
|
+
return {
|
|
112
|
+
type: "item",
|
|
113
|
+
key: target.key,
|
|
114
|
+
dropPosition: "on",
|
|
115
|
+
};
|
|
116
|
+
}
|
|
117
|
+
case "on": {
|
|
118
|
+
// If there are nested items, traverse to them prior to the "after" position of this target.
|
|
119
|
+
// If the next key is on the same level, then its "before" position is equivalent to this item's "after" position.
|
|
120
|
+
let targetNode = collection.getItem(target.key);
|
|
121
|
+
let nextNode = nextKey != null ? collection.getItem(nextKey) : null;
|
|
122
|
+
if (targetNode && nextNode && nextNode.level >= targetNode.level) {
|
|
123
|
+
return {
|
|
124
|
+
type: "item",
|
|
125
|
+
key: nextNode.key,
|
|
126
|
+
dropPosition: "before",
|
|
127
|
+
};
|
|
128
|
+
}
|
|
129
|
+
|
|
130
|
+
return {
|
|
131
|
+
type: "item",
|
|
132
|
+
key: target.key,
|
|
133
|
+
dropPosition: "after",
|
|
134
|
+
};
|
|
135
|
+
}
|
|
136
|
+
case "after": {
|
|
137
|
+
// If this is the last sibling in a level, traverse to the parent.
|
|
138
|
+
let targetNode = collection.getItem(target.key);
|
|
139
|
+
let nextSiblingKey = targetNode != null ? collection.getKeyAfter(targetNode.key) : null;
|
|
140
|
+
let nextItemInSameLevel = nextSiblingKey != null ? collection.getItem(nextSiblingKey) : null;
|
|
141
|
+
while (nextItemInSameLevel != null && nextItemInSameLevel.type !== "item") {
|
|
142
|
+
let afterKey = collection.getKeyAfter(nextItemInSameLevel.key);
|
|
143
|
+
nextItemInSameLevel = afterKey != null ? collection.getItem(afterKey) : null;
|
|
144
|
+
}
|
|
145
|
+
|
|
146
|
+
if (targetNode && nextItemInSameLevel == null && targetNode.parentKey != null) {
|
|
147
|
+
// If the parent item has an item after it, use the "before" position.
|
|
148
|
+
let parentNode = collection.getItem(targetNode.parentKey);
|
|
149
|
+
let parentNextKey = parentNode != null ? collection.getKeyAfter(parentNode.key) : null;
|
|
150
|
+
const nextNode = parentNextKey != null ? collection.getItem(parentNextKey) : null;
|
|
151
|
+
if (nextNode?.type === "item") {
|
|
152
|
+
return {
|
|
153
|
+
type: "item",
|
|
154
|
+
key: nextNode.key,
|
|
155
|
+
dropPosition: "before",
|
|
156
|
+
};
|
|
157
|
+
}
|
|
158
|
+
|
|
159
|
+
if (parentNode?.type === "item") {
|
|
160
|
+
return {
|
|
161
|
+
type: "item",
|
|
162
|
+
key: parentNode.key,
|
|
163
|
+
dropPosition: "after",
|
|
164
|
+
};
|
|
165
|
+
}
|
|
166
|
+
}
|
|
167
|
+
|
|
168
|
+
if (nextItemInSameLevel) {
|
|
169
|
+
return {
|
|
170
|
+
type: "item",
|
|
171
|
+
key: nextItemInSameLevel.key,
|
|
172
|
+
dropPosition: "on",
|
|
173
|
+
};
|
|
174
|
+
}
|
|
175
|
+
}
|
|
176
|
+
}
|
|
177
|
+
}
|
|
178
|
+
|
|
179
|
+
if (wrap) {
|
|
180
|
+
return {
|
|
181
|
+
type: "root",
|
|
182
|
+
};
|
|
183
|
+
}
|
|
184
|
+
|
|
185
|
+
return null;
|
|
186
|
+
}
|
|
187
|
+
|
|
188
|
+
function previousDropTarget(
|
|
189
|
+
keyboardDelegate: DropNavigationKeyboardDelegate,
|
|
190
|
+
collection: Collection,
|
|
191
|
+
target: DropTarget | null | undefined,
|
|
192
|
+
wrap = false,
|
|
193
|
+
horizontal: "left" | "right" | null = null,
|
|
194
|
+
): DropTarget | null {
|
|
195
|
+
// Start after the last root-level item.
|
|
196
|
+
if (!target || (wrap && target.type === "root")) {
|
|
197
|
+
// Keyboard delegate gets the deepest item but we want the shallowest.
|
|
198
|
+
let prevKey: Key | null = null;
|
|
199
|
+
let lastKey = keyboardDelegate.getLastKey?.();
|
|
200
|
+
while (lastKey != null) {
|
|
201
|
+
let node = collection.getItem(lastKey);
|
|
202
|
+
if (node?.type !== "item") {
|
|
203
|
+
break;
|
|
204
|
+
}
|
|
205
|
+
prevKey = lastKey;
|
|
206
|
+
lastKey = node?.parentKey;
|
|
207
|
+
}
|
|
208
|
+
|
|
209
|
+
if (prevKey != null) {
|
|
210
|
+
return {
|
|
211
|
+
type: "item",
|
|
212
|
+
key: prevKey,
|
|
213
|
+
dropPosition: "after",
|
|
214
|
+
};
|
|
215
|
+
}
|
|
216
|
+
|
|
217
|
+
return null;
|
|
218
|
+
}
|
|
219
|
+
|
|
220
|
+
if (target.type === "item") {
|
|
221
|
+
let prevKey: Key | null | undefined = null;
|
|
222
|
+
if (horizontal) {
|
|
223
|
+
prevKey =
|
|
224
|
+
horizontal === "left"
|
|
225
|
+
? keyboardDelegate.getKeyLeftOf?.(target.key, { includeDisabled: true })
|
|
226
|
+
: keyboardDelegate.getKeyRightOf?.(target.key, { includeDisabled: true });
|
|
227
|
+
} else {
|
|
228
|
+
prevKey = keyboardDelegate.getKeyAbove?.(target.key, { includeDisabled: true });
|
|
229
|
+
}
|
|
230
|
+
let prevCollectionKey = getNextItem(collection, target.key, (key) =>
|
|
231
|
+
collection.getKeyBefore(key),
|
|
232
|
+
);
|
|
233
|
+
|
|
234
|
+
// If the keyboard delegate did not move to the next key in the collection,
|
|
235
|
+
// jump to that key with the same drop position. Otherwise, try the other
|
|
236
|
+
// drop positions on the current key first.
|
|
237
|
+
if (prevKey != null && prevKey !== prevCollectionKey) {
|
|
238
|
+
return {
|
|
239
|
+
type: "item",
|
|
240
|
+
key: prevKey,
|
|
241
|
+
dropPosition: target.dropPosition,
|
|
242
|
+
};
|
|
243
|
+
}
|
|
244
|
+
|
|
245
|
+
switch (target.dropPosition) {
|
|
246
|
+
case "before": {
|
|
247
|
+
// Move after the last child of the previous item.
|
|
248
|
+
let targetNode = collection.getItem(target.key);
|
|
249
|
+
let targetPrevKey = targetNode != null ? collection.getKeyBefore(targetNode.key) : null;
|
|
250
|
+
if (targetNode && targetPrevKey != null) {
|
|
251
|
+
let lastChild = getLastChild(collection, targetPrevKey);
|
|
252
|
+
if (lastChild) {
|
|
253
|
+
return lastChild;
|
|
254
|
+
}
|
|
255
|
+
}
|
|
256
|
+
|
|
257
|
+
if (prevKey != null) {
|
|
258
|
+
return {
|
|
259
|
+
type: "item",
|
|
260
|
+
key: prevKey,
|
|
261
|
+
dropPosition: "on",
|
|
262
|
+
};
|
|
263
|
+
}
|
|
264
|
+
|
|
265
|
+
return {
|
|
266
|
+
type: "root",
|
|
267
|
+
};
|
|
268
|
+
}
|
|
269
|
+
case "on": {
|
|
270
|
+
return {
|
|
271
|
+
type: "item",
|
|
272
|
+
key: target.key,
|
|
273
|
+
dropPosition: "before",
|
|
274
|
+
};
|
|
275
|
+
}
|
|
276
|
+
case "after": {
|
|
277
|
+
// Move after the last child of this item.
|
|
278
|
+
let lastChild = getLastChild(collection, target.key);
|
|
279
|
+
if (lastChild) {
|
|
280
|
+
return lastChild;
|
|
281
|
+
}
|
|
282
|
+
|
|
283
|
+
return {
|
|
284
|
+
type: "item",
|
|
285
|
+
key: target.key,
|
|
286
|
+
dropPosition: "on",
|
|
287
|
+
};
|
|
288
|
+
}
|
|
289
|
+
}
|
|
290
|
+
}
|
|
291
|
+
|
|
292
|
+
if (target.type !== "root") {
|
|
293
|
+
return {
|
|
294
|
+
type: "root",
|
|
295
|
+
};
|
|
296
|
+
}
|
|
297
|
+
|
|
298
|
+
return null;
|
|
299
|
+
}
|
|
300
|
+
|
|
301
|
+
function getLastChild(collection: Collection, key: Key): DropTarget | null {
|
|
302
|
+
// getChildNodes still returns child tree items even when the item is collapsed.
|
|
303
|
+
// Checking if the next item has a greater level is a silly way to determine if the item is expanded.
|
|
304
|
+
let targetNode = collection.getItem(key);
|
|
305
|
+
let nextKey = getNextItem(collection, key, (key) => collection.getKeyAfter(key));
|
|
306
|
+
let nextNode = nextKey != null ? collection.getItem(nextKey) : null;
|
|
307
|
+
if (targetNode && nextNode && nextNode.level > targetNode.level) {
|
|
308
|
+
let lastChild: CollectionNode | null = null;
|
|
309
|
+
lastChild =
|
|
310
|
+
Array.from(targetNode.childNodes).findLast((item) => item.type === "item") || null;
|
|
311
|
+
|
|
312
|
+
if (lastChild) {
|
|
313
|
+
return {
|
|
314
|
+
type: "item",
|
|
315
|
+
key: lastChild.key,
|
|
316
|
+
dropPosition: "after",
|
|
317
|
+
};
|
|
318
|
+
}
|
|
319
|
+
}
|
|
320
|
+
|
|
321
|
+
return null;
|
|
322
|
+
}
|
|
323
|
+
|
|
324
|
+
// Find the next or previous item in a collection, skipping over other types of nodes (e.g. content).
|
|
325
|
+
function getNextItem(
|
|
326
|
+
collection: Collection,
|
|
327
|
+
key: Key,
|
|
328
|
+
getNextKey: (key: Key) => Key | null,
|
|
329
|
+
): Key | null {
|
|
330
|
+
let nextCollectionKey = getNextKey(key);
|
|
331
|
+
let nextCollectionNode = nextCollectionKey != null ? collection.getItem(nextCollectionKey) : null;
|
|
332
|
+
while (nextCollectionNode && nextCollectionNode.type !== "item") {
|
|
333
|
+
nextCollectionKey = getNextKey(nextCollectionNode.key);
|
|
334
|
+
nextCollectionNode = nextCollectionKey != null ? collection.getItem(nextCollectionKey) : null;
|
|
335
|
+
}
|
|
336
|
+
return nextCollectionKey;
|
|
337
|
+
}
|
package/src/dnd/createDrag.ts
CHANGED
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
*/
|
|
7
7
|
|
|
8
8
|
import { createMemo, type Accessor } from "solid-js";
|
|
9
|
-
import { createDragState } from "@proyecto-viviana/solid-stately";
|
|
9
|
+
import { createDragState, type DropOperation } from "@proyecto-viviana/solid-stately";
|
|
10
10
|
import type { AriaDragOptions, DragAria } from "./types";
|
|
11
11
|
import {
|
|
12
12
|
getTypes,
|
|
@@ -19,6 +19,9 @@ import {
|
|
|
19
19
|
getGlobalDropEffect,
|
|
20
20
|
} from "./utils";
|
|
21
21
|
import { setGlobalDraggingTypes } from "./createDraggableCollection";
|
|
22
|
+
import { beginDragging } from "./DragManager";
|
|
23
|
+
import { createStringFormatter } from "../i18n/createStringFormatter";
|
|
24
|
+
import { dndIntlStrings } from "./intl";
|
|
22
25
|
|
|
23
26
|
/**
|
|
24
27
|
* Creates ARIA props for a draggable element.
|
|
@@ -40,6 +43,8 @@ export function createDrag(props: Accessor<AriaDragOptions>): DragAria {
|
|
|
40
43
|
preview: getProps().preview,
|
|
41
44
|
}));
|
|
42
45
|
|
|
46
|
+
const stringFormatter = createStringFormatter(dndIntlStrings);
|
|
47
|
+
|
|
43
48
|
let lastX = 0;
|
|
44
49
|
let lastY = 0;
|
|
45
50
|
|
|
@@ -145,14 +150,16 @@ export function createDrag(props: Accessor<AriaDragOptions>): DragAria {
|
|
|
145
150
|
if (e.key === "Enter" && e.target === e.currentTarget) {
|
|
146
151
|
e.preventDefault();
|
|
147
152
|
e.stopPropagation();
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
const rect =
|
|
153
|
+
|
|
154
|
+
const el = e.currentTarget as HTMLElement;
|
|
155
|
+
const rect = el.getBoundingClientRect();
|
|
151
156
|
state.startDrag(rect.x + rect.width / 2, rect.y + rect.height / 2);
|
|
157
|
+
|
|
152
158
|
const items = state.getItems();
|
|
153
159
|
setGlobalDraggingTypes(getTypes(items));
|
|
154
|
-
|
|
160
|
+
|
|
155
161
|
const allowedOps = state.getAllowedDropOperations();
|
|
162
|
+
let allowed = DROP_OPERATION.all;
|
|
156
163
|
if (allowedOps.length > 0) {
|
|
157
164
|
allowed = DROP_OPERATION.none;
|
|
158
165
|
for (const op of allowedOps) {
|
|
@@ -160,6 +167,25 @@ export function createDrag(props: Accessor<AriaDragOptions>): DragAria {
|
|
|
160
167
|
}
|
|
161
168
|
}
|
|
162
169
|
setGlobalAllowedDropOperations(allowed);
|
|
170
|
+
|
|
171
|
+
// Hand control to the keyboard DragManager session: it installs the
|
|
172
|
+
// document-capture listeners that drive Tab-cycling across drop targets,
|
|
173
|
+
// Arrow navigation within a target, and Enter/Escape drop/cancel.
|
|
174
|
+
beginDragging(
|
|
175
|
+
{
|
|
176
|
+
element: el,
|
|
177
|
+
items,
|
|
178
|
+
allowedDropOperations:
|
|
179
|
+
allowedOps.length > 0 ? allowedOps : (["move", "copy", "link"] as DropOperation[]),
|
|
180
|
+
onDragEnd: (ev) => {
|
|
181
|
+
state.endDrag(ev.x, ev.y, ev.dropOperation);
|
|
182
|
+
setGlobalAllowedDropOperations(DROP_OPERATION.none);
|
|
183
|
+
setGlobalDraggingTypes(new Set());
|
|
184
|
+
setGlobalDropEffect(undefined);
|
|
185
|
+
},
|
|
186
|
+
},
|
|
187
|
+
stringFormatter(),
|
|
188
|
+
);
|
|
163
189
|
}
|
|
164
190
|
};
|
|
165
191
|
|
|
@@ -5,37 +5,52 @@
|
|
|
5
5
|
* component like ListBox, GridList, or Table.
|
|
6
6
|
*/
|
|
7
7
|
|
|
8
|
-
import {
|
|
8
|
+
import {
|
|
9
|
+
createMemo,
|
|
10
|
+
createEffect,
|
|
11
|
+
createSignal,
|
|
12
|
+
onCleanup,
|
|
13
|
+
untrack,
|
|
14
|
+
type Accessor,
|
|
15
|
+
} from "solid-js";
|
|
9
16
|
import type { DraggableCollectionState } from "@proyecto-viviana/solid-stately";
|
|
10
17
|
import { getTypes } from "./utils";
|
|
11
18
|
|
|
12
|
-
// Global state for tracking the dragging collection
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
19
|
+
// Global state for tracking the dragging collection. These back the reactive
|
|
20
|
+
// `isVirtualDragging` gate that decides whether drop indicators render across
|
|
21
|
+
// every mounted collection, so they must be Solid signals — React re-renders the
|
|
22
|
+
// whole collection tree on a drag-state change, but Solid's fine-grained
|
|
23
|
+
// reactivity only re-runs the indicator JSX if it subscribed to a signal. Plain
|
|
24
|
+
// module `let`s would make the gate read a stale snapshot and never re-render.
|
|
25
|
+
const [globalDraggingCollectionRef, setGlobalDraggingCollectionRefSignal] =
|
|
26
|
+
createSignal<HTMLElement | null>(null);
|
|
27
|
+
const [globalDraggingKeys, setGlobalDraggingKeysSignal] = createSignal<Set<string | number>>(
|
|
28
|
+
new Set(),
|
|
29
|
+
);
|
|
30
|
+
const [globalDraggingTypes, setGlobalDraggingTypesSignal] = createSignal<Set<string>>(new Set());
|
|
16
31
|
|
|
17
32
|
export function setGlobalDraggingCollectionRef(ref: HTMLElement | null): void {
|
|
18
|
-
|
|
33
|
+
setGlobalDraggingCollectionRefSignal(ref);
|
|
19
34
|
}
|
|
20
35
|
|
|
21
36
|
export function getGlobalDraggingCollectionRef(): HTMLElement | null {
|
|
22
|
-
return globalDraggingCollectionRef;
|
|
37
|
+
return globalDraggingCollectionRef();
|
|
23
38
|
}
|
|
24
39
|
|
|
25
40
|
export function setGlobalDraggingKeys(keys: Set<string | number>): void {
|
|
26
|
-
|
|
41
|
+
setGlobalDraggingKeysSignal(new Set(keys));
|
|
27
42
|
}
|
|
28
43
|
|
|
29
44
|
export function getGlobalDraggingKeys(): Set<string | number> {
|
|
30
|
-
return new Set(globalDraggingKeys);
|
|
45
|
+
return new Set(globalDraggingKeys());
|
|
31
46
|
}
|
|
32
47
|
|
|
33
48
|
export function setGlobalDraggingTypes(types: Set<string>): void {
|
|
34
|
-
|
|
49
|
+
setGlobalDraggingTypesSignal(new Set(types));
|
|
35
50
|
}
|
|
36
51
|
|
|
37
52
|
export function getGlobalDraggingTypes(): Set<string> {
|
|
38
|
-
return new Set(globalDraggingTypes);
|
|
53
|
+
return new Set(globalDraggingTypes());
|
|
39
54
|
}
|
|
40
55
|
|
|
41
56
|
export interface DraggableCollectionOptions {
|
|
@@ -61,11 +76,14 @@ export function createDraggableCollection(
|
|
|
61
76
|
): DraggableCollectionAria {
|
|
62
77
|
const ref = createMemo(() => options.ref());
|
|
63
78
|
|
|
64
|
-
// Track dragging state globally
|
|
79
|
+
// Track dragging state globally. This effect subscribes to THIS collection's
|
|
80
|
+
// `state.draggingKeys`; the global-ref reads are untracked so writing the
|
|
81
|
+
// globals (which are now signals) can't re-trigger this same effect into a
|
|
82
|
+
// loop — only a real change in this collection's dragging keys should re-run it.
|
|
65
83
|
createEffect(() => {
|
|
66
84
|
const currentRef = ref();
|
|
67
85
|
if (state.draggingKeys.size > 0) {
|
|
68
|
-
if (
|
|
86
|
+
if (untrack(getGlobalDraggingCollectionRef) !== currentRef) {
|
|
69
87
|
setGlobalDraggingCollectionRef(currentRef);
|
|
70
88
|
}
|
|
71
89
|
setGlobalDraggingKeys(state.draggingKeys);
|
|
@@ -74,7 +92,7 @@ export function createDraggableCollection(
|
|
|
74
92
|
}
|
|
75
93
|
|
|
76
94
|
// Clear global drag tracking when this collection is no longer dragging.
|
|
77
|
-
if (
|
|
95
|
+
if (untrack(getGlobalDraggingCollectionRef) === currentRef) {
|
|
78
96
|
setGlobalDraggingCollectionRef(null);
|
|
79
97
|
setGlobalDraggingKeys(new Set());
|
|
80
98
|
setGlobalDraggingTypes(new Set());
|
|
@@ -83,7 +101,7 @@ export function createDraggableCollection(
|
|
|
83
101
|
|
|
84
102
|
// Clean up on unmount
|
|
85
103
|
onCleanup(() => {
|
|
86
|
-
if (
|
|
104
|
+
if (untrack(getGlobalDraggingCollectionRef) === ref()) {
|
|
87
105
|
setGlobalDraggingCollectionRef(null);
|
|
88
106
|
setGlobalDraggingKeys(new Set());
|
|
89
107
|
setGlobalDraggingTypes(new Set());
|
|
@@ -9,10 +9,12 @@ import type { JSX } from "solid-js";
|
|
|
9
9
|
import type {
|
|
10
10
|
DraggableCollectionState,
|
|
11
11
|
DragPreviewRenderer,
|
|
12
|
+
DropOperation,
|
|
12
13
|
} from "@proyecto-viviana/solid-stately";
|
|
13
14
|
import {
|
|
14
15
|
getTypes,
|
|
15
16
|
writeToDataTransfer,
|
|
17
|
+
getDragModality,
|
|
16
18
|
DROP_OPERATION,
|
|
17
19
|
EFFECT_ALLOWED,
|
|
18
20
|
DROP_EFFECT_TO_DROP_OPERATION,
|
|
@@ -20,13 +22,30 @@ import {
|
|
|
20
22
|
setGlobalDropEffect,
|
|
21
23
|
getGlobalDropEffect,
|
|
22
24
|
} from "./utils";
|
|
25
|
+
import { createInteractionModality } from "../interactions";
|
|
23
26
|
import { setGlobalDraggingTypes } from "./createDraggableCollection";
|
|
27
|
+
import { beginDragging } from "./DragManager";
|
|
28
|
+
import { createStringFormatter } from "../i18n/createStringFormatter";
|
|
29
|
+
import { dndIntlStrings } from "./intl";
|
|
30
|
+
import { createDescription } from "../utils/createDescription";
|
|
24
31
|
|
|
25
32
|
export interface DraggableItemOptions {
|
|
26
33
|
/** The unique key of the item. */
|
|
27
34
|
key: string | number;
|
|
28
35
|
/** Whether the item has a separate drag button affordance. */
|
|
29
36
|
hasDragButton?: boolean;
|
|
37
|
+
/**
|
|
38
|
+
* Whether the host item has a primary action (e.g. Enter on a GridList/Table
|
|
39
|
+
* row) that conflicts with the Enter keyboard drag pickup. When true the drag
|
|
40
|
+
* description switches to the Alt variant (mirrors upstream `hasAction`).
|
|
41
|
+
*/
|
|
42
|
+
hasAction?: boolean;
|
|
43
|
+
/**
|
|
44
|
+
* The host collection's selection mode. Upstream only surfaces the drag
|
|
45
|
+
* affordance description (aria-describedby → "Press Enter to start dragging.")
|
|
46
|
+
* when the mode is not `'none'`.
|
|
47
|
+
*/
|
|
48
|
+
selectionMode?: "none" | "single" | "multiple";
|
|
30
49
|
/** Whether this item is disabled for dragging. */
|
|
31
50
|
isDisabled?: boolean;
|
|
32
51
|
/** Preview renderer function ref. */
|
|
@@ -49,12 +68,24 @@ export interface DraggableItemAria {
|
|
|
49
68
|
* @param state - Draggable collection state
|
|
50
69
|
* @returns Draggable item ARIA props
|
|
51
70
|
*/
|
|
71
|
+
// Drag description keys per interaction modality, mirroring upstream
|
|
72
|
+
// useDraggableItem's MESSAGES table. The port always drags the single focused
|
|
73
|
+
// key, so isSelected is always false → the `notSelected` row is used.
|
|
74
|
+
const DRAG_DESCRIPTION_MESSAGES: Record<string, string> = {
|
|
75
|
+
keyboard: "dragDescriptionKeyboard",
|
|
76
|
+
touch: "dragDescriptionLongPress",
|
|
77
|
+
virtual: "dragDescriptionVirtual",
|
|
78
|
+
};
|
|
79
|
+
|
|
52
80
|
export function createDraggableItem(
|
|
53
81
|
options: Accessor<DraggableItemOptions>,
|
|
54
82
|
state: DraggableCollectionState,
|
|
55
83
|
): DraggableItemAria {
|
|
56
84
|
const getOptions = createMemo(() => options());
|
|
57
85
|
|
|
86
|
+
const stringFormatter = createStringFormatter(dndIntlStrings);
|
|
87
|
+
const { modality } = createInteractionModality();
|
|
88
|
+
|
|
58
89
|
// Track position for drag move
|
|
59
90
|
let lastX = 0;
|
|
60
91
|
let lastY = 0;
|
|
@@ -64,6 +95,29 @@ export function createDraggableItem(
|
|
|
64
95
|
return state.draggingKeys.has(key);
|
|
65
96
|
});
|
|
66
97
|
|
|
98
|
+
// Drag affordance description (aria-describedby → "Press Enter to start
|
|
99
|
+
// dragging."). Mirrors upstream useDraggableItem: surfaced only when the item
|
|
100
|
+
// has no explicit drag button and the host selection mode is not 'none'. The
|
|
101
|
+
// port only ever drags the single focused key (getKeysForDrag), so
|
|
102
|
+
// numKeysForDrag === 1 → isSelected is always false → the base (notSelected)
|
|
103
|
+
// keyboard message; a host primary action swaps in the Alt variant.
|
|
104
|
+
const dragDescription = createMemo(() => {
|
|
105
|
+
const opts = getOptions();
|
|
106
|
+
if (opts.hasDragButton) return undefined;
|
|
107
|
+
if (opts.selectionMode == null || opts.selectionMode === "none") return undefined;
|
|
108
|
+
// Subscribe to modality changes, then resolve the drag modality the same way
|
|
109
|
+
// upstream does (pointer → virtual, coarse-pointer virtual → touch). At rest
|
|
110
|
+
// with no keyboard interaction this is 'virtual' → "Click to start dragging.".
|
|
111
|
+
modality();
|
|
112
|
+
const dragModality = getDragModality();
|
|
113
|
+
let msg = DRAG_DESCRIPTION_MESSAGES[dragModality] ?? "dragDescriptionVirtual";
|
|
114
|
+
if (opts.hasAction && dragModality === "keyboard") {
|
|
115
|
+
msg += "Alt";
|
|
116
|
+
}
|
|
117
|
+
return stringFormatter().format(msg as Parameters<ReturnType<typeof stringFormatter>["format"]>[0]);
|
|
118
|
+
});
|
|
119
|
+
const descriptionProps = createDescription(dragDescription);
|
|
120
|
+
|
|
67
121
|
const getKeysForDrag = (): Set<string | number> => {
|
|
68
122
|
const { key } = getOptions();
|
|
69
123
|
// If the key is not selected, only drag that item
|
|
@@ -187,13 +241,16 @@ export function createDraggableItem(
|
|
|
187
241
|
const opts = getOptions();
|
|
188
242
|
if (opts.isDisabled || state.isDisabled) return;
|
|
189
243
|
|
|
244
|
+
const el = e.currentTarget as HTMLElement;
|
|
190
245
|
const keys = getKeysForDrag();
|
|
191
|
-
const rect =
|
|
246
|
+
const rect = el.getBoundingClientRect();
|
|
192
247
|
state.startDrag(keys, rect.x + rect.width / 2, rect.y + rect.height / 2);
|
|
248
|
+
|
|
193
249
|
const items = state.getItems(keys);
|
|
194
250
|
setGlobalDraggingTypes(getTypes(items));
|
|
195
|
-
|
|
251
|
+
|
|
196
252
|
const allowedOps = state.getAllowedDropOperations();
|
|
253
|
+
let allowed = DROP_OPERATION.all;
|
|
197
254
|
if (allowedOps.length > 0) {
|
|
198
255
|
allowed = DROP_OPERATION.none;
|
|
199
256
|
for (const op of allowedOps) {
|
|
@@ -201,6 +258,24 @@ export function createDraggableItem(
|
|
|
201
258
|
}
|
|
202
259
|
}
|
|
203
260
|
setGlobalAllowedDropOperations(allowed);
|
|
261
|
+
|
|
262
|
+
// Hand control to the keyboard DragManager session, which drives
|
|
263
|
+
// Tab-cycling across drop targets and Enter/Escape drop/cancel.
|
|
264
|
+
beginDragging(
|
|
265
|
+
{
|
|
266
|
+
element: el,
|
|
267
|
+
items,
|
|
268
|
+
allowedDropOperations:
|
|
269
|
+
allowedOps.length > 0 ? allowedOps : (["move", "copy", "link"] as DropOperation[]),
|
|
270
|
+
onDragEnd: (ev) => {
|
|
271
|
+
state.endDrag(ev.x, ev.y, ev.dropOperation, false);
|
|
272
|
+
setGlobalAllowedDropOperations(DROP_OPERATION.none);
|
|
273
|
+
setGlobalDraggingTypes(new Set());
|
|
274
|
+
setGlobalDropEffect(undefined);
|
|
275
|
+
},
|
|
276
|
+
},
|
|
277
|
+
stringFormatter(),
|
|
278
|
+
);
|
|
204
279
|
}
|
|
205
280
|
};
|
|
206
281
|
|
|
@@ -220,10 +295,22 @@ export function createDraggableItem(
|
|
|
220
295
|
onDragEnd,
|
|
221
296
|
};
|
|
222
297
|
|
|
223
|
-
// Add keyboard handlers if no separate drag button
|
|
298
|
+
// Add keyboard handlers if no separate drag button. Mirrors upstream
|
|
299
|
+
// useDrag: the Enter pickup is wired in the CAPTURE phase so it runs before
|
|
300
|
+
// the collection item's own press/selection handlers (which also claim
|
|
301
|
+
// Enter) and can stopPropagation to suppress them — a bubble-phase handler
|
|
302
|
+
// would never see the Enter keyup, since press consumes it first. In Solid,
|
|
303
|
+
// capture-phase spread props use the `oncapture:` prefix.
|
|
224
304
|
if (!opts.hasDragButton) {
|
|
225
|
-
baseProps
|
|
226
|
-
baseProps
|
|
305
|
+
baseProps["oncapture:keydown"] = onKeyDown;
|
|
306
|
+
baseProps["oncapture:keyup"] = onKeyUp;
|
|
307
|
+
}
|
|
308
|
+
|
|
309
|
+
// Reading the reactive getter here keeps this memo subscribed, so the id
|
|
310
|
+
// appears once createDescription's effect has mounted the hidden element.
|
|
311
|
+
const describedBy = descriptionProps["aria-describedby"];
|
|
312
|
+
if (describedBy) {
|
|
313
|
+
baseProps["aria-describedby"] = describedBy;
|
|
227
314
|
}
|
|
228
315
|
|
|
229
316
|
return baseProps;
|