@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
|
@@ -1,167 +1,5 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
/**
|
|
4
|
-
* i18n utilities for solidaria
|
|
5
|
-
*
|
|
6
|
-
* RTL detection and locale utilities.
|
|
7
|
-
*
|
|
8
|
-
* Port of @react-aria/i18n utils.
|
|
9
|
-
*/
|
|
10
|
-
const RTL_SCRIPTS = new Set([
|
|
11
|
-
"Arab",
|
|
12
|
-
"Syrc",
|
|
13
|
-
"Samr",
|
|
14
|
-
"Mand",
|
|
15
|
-
"Thaa",
|
|
16
|
-
"Mend",
|
|
17
|
-
"Nkoo",
|
|
18
|
-
"Adlm",
|
|
19
|
-
"Rohg",
|
|
20
|
-
"Hebr"
|
|
21
|
-
]);
|
|
22
|
-
const RTL_LANGS = new Set([
|
|
23
|
-
"ae",
|
|
24
|
-
"ar",
|
|
25
|
-
"arc",
|
|
26
|
-
"bcc",
|
|
27
|
-
"bqi",
|
|
28
|
-
"ckb",
|
|
29
|
-
"dv",
|
|
30
|
-
"fa",
|
|
31
|
-
"glk",
|
|
32
|
-
"he",
|
|
33
|
-
"ku",
|
|
34
|
-
"mzn",
|
|
35
|
-
"nqo",
|
|
36
|
-
"pnb",
|
|
37
|
-
"ps",
|
|
38
|
-
"sd",
|
|
39
|
-
"ug",
|
|
40
|
-
"ur",
|
|
41
|
-
"yi"
|
|
42
|
-
]);
|
|
43
|
-
/**
|
|
44
|
-
* Determines if a locale is read right to left.
|
|
45
|
-
* Uses Intl.Locale API when available for accurate detection.
|
|
46
|
-
*/
|
|
47
|
-
function isRTL(localeString) {
|
|
48
|
-
if (typeof Intl !== "undefined" && Intl.Locale) try {
|
|
49
|
-
const locale = new Intl.Locale(localeString).maximize();
|
|
50
|
-
const localeAny = locale;
|
|
51
|
-
const textInfo = typeof localeAny.getTextInfo === "function" ? localeAny.getTextInfo() : localeAny.textInfo;
|
|
52
|
-
if (textInfo) return textInfo.direction === "rtl";
|
|
53
|
-
if (locale.script) return RTL_SCRIPTS.has(locale.script);
|
|
54
|
-
} catch {}
|
|
55
|
-
const lang = localeString.split("-")[0];
|
|
56
|
-
return RTL_LANGS.has(lang);
|
|
57
|
-
}
|
|
58
|
-
/**
|
|
59
|
-
* Creates a cache key for formatter options.
|
|
60
|
-
*/
|
|
61
|
-
function createCacheKey(locale, options) {
|
|
62
|
-
if (!options) return locale;
|
|
63
|
-
return locale + Object.entries(options).sort((a, b) => a[0] < b[0] ? -1 : 1).join();
|
|
64
|
-
}
|
|
65
|
-
//#endregion
|
|
66
|
-
//#region src/i18n/locale.tsx
|
|
67
|
-
/**
|
|
68
|
-
* Locale context and provider for solidaria
|
|
69
|
-
*
|
|
70
|
-
* Provides locale and text direction to the component tree.
|
|
71
|
-
*
|
|
72
|
-
* Port of @react-aria/i18n context and useDefaultLocale.
|
|
73
|
-
*/
|
|
74
|
-
const localeSymbol = Symbol.for("solidaria.i18n.locale");
|
|
75
|
-
let currentLocale = null;
|
|
76
|
-
const listeners = /* @__PURE__ */ new Set();
|
|
77
|
-
/**
|
|
78
|
-
* Gets the default locale from the browser/system.
|
|
79
|
-
*/
|
|
80
|
-
function getDefaultLocale() {
|
|
81
|
-
let locale = typeof window !== "undefined" && window[localeSymbol] || typeof navigator !== "undefined" && (navigator.language || navigator.userLanguage) || "en-US";
|
|
82
|
-
try {
|
|
83
|
-
Intl.DateTimeFormat.supportedLocalesOf([locale]);
|
|
84
|
-
} catch {
|
|
85
|
-
locale = "en-US";
|
|
86
|
-
}
|
|
87
|
-
return {
|
|
88
|
-
locale,
|
|
89
|
-
direction: isRTL(locale) ? "rtl" : "ltr"
|
|
90
|
-
};
|
|
91
|
-
}
|
|
92
|
-
function updateLocale() {
|
|
93
|
-
currentLocale = getDefaultLocale();
|
|
94
|
-
for (const listener of listeners) listener(currentLocale);
|
|
95
|
-
}
|
|
96
|
-
const I18nContext = createContext(null);
|
|
97
|
-
/**
|
|
98
|
-
* Returns the current browser/system locale, and updates when it changes.
|
|
99
|
-
*
|
|
100
|
-
* @example
|
|
101
|
-
* ```tsx
|
|
102
|
-
* const locale = createDefaultLocale();
|
|
103
|
-
* console.log(locale().locale); // 'en-US'
|
|
104
|
-
* console.log(locale().direction); // 'ltr'
|
|
105
|
-
* ```
|
|
106
|
-
*/
|
|
107
|
-
function createDefaultLocale() {
|
|
108
|
-
if (!currentLocale) currentLocale = getDefaultLocale();
|
|
109
|
-
const [locale, setLocale] = createSignal(currentLocale);
|
|
110
|
-
createEffect(() => {
|
|
111
|
-
if (typeof window === "undefined") return;
|
|
112
|
-
if (listeners.size === 0) window.addEventListener("languagechange", updateLocale);
|
|
113
|
-
listeners.add(setLocale);
|
|
114
|
-
onCleanup(() => {
|
|
115
|
-
listeners.delete(setLocale);
|
|
116
|
-
if (listeners.size === 0) window.removeEventListener("languagechange", updateLocale);
|
|
117
|
-
});
|
|
118
|
-
});
|
|
119
|
-
return locale;
|
|
120
|
-
}
|
|
121
|
-
/**
|
|
122
|
-
* Returns the current locale and layout direction from context or browser default.
|
|
123
|
-
*
|
|
124
|
-
* @example
|
|
125
|
-
* ```tsx
|
|
126
|
-
* function MyComponent() {
|
|
127
|
-
* const locale = useLocale();
|
|
128
|
-
* return <div dir={locale().direction}>{locale().locale}</div>;
|
|
129
|
-
* }
|
|
130
|
-
* ```
|
|
131
|
-
*/
|
|
132
|
-
function useLocale() {
|
|
133
|
-
const context = useContext(I18nContext);
|
|
134
|
-
const defaultLocale = createDefaultLocale();
|
|
135
|
-
return context || defaultLocale;
|
|
136
|
-
}
|
|
137
|
-
/**
|
|
138
|
-
* Provides the locale for the application to all child components.
|
|
139
|
-
*
|
|
140
|
-
* @example
|
|
141
|
-
* ```tsx
|
|
142
|
-
* // Use browser default locale
|
|
143
|
-
* <I18nProvider>
|
|
144
|
-
* <App />
|
|
145
|
-
* </I18nProvider>
|
|
146
|
-
*
|
|
147
|
-
* // Override with specific locale
|
|
148
|
-
* <I18nProvider locale="ar-SA">
|
|
149
|
-
* <App /> // Will have RTL direction
|
|
150
|
-
* </I18nProvider>
|
|
151
|
-
* ```
|
|
152
|
-
*/
|
|
153
|
-
function I18nProvider(props) {
|
|
154
|
-
const defaultLocale = createDefaultLocale();
|
|
155
|
-
const locale = createMemo(() => {
|
|
156
|
-
if (props.locale) return {
|
|
157
|
-
locale: props.locale,
|
|
158
|
-
direction: isRTL(props.locale) ? "rtl" : "ltr"
|
|
159
|
-
};
|
|
160
|
-
return defaultLocale();
|
|
161
|
-
});
|
|
162
|
-
return <I18nContext.Provider value={locale}>{props.children}</I18nContext.Provider>;
|
|
163
|
-
}
|
|
164
|
-
//#endregion
|
|
1
|
+
import { a as createCacheKey, i as useLocale } from "./locale.jsx";
|
|
2
|
+
import { createMemo } from "solid-js";
|
|
165
3
|
//#region src/i18n/createCollator.ts
|
|
166
4
|
/**
|
|
167
5
|
* createCollator hook for solidaria
|
|
@@ -218,6 +56,6 @@ function createCollator(options) {
|
|
|
218
56
|
return createMemo(() => getCachedCollator(locale().locale, options));
|
|
219
57
|
}
|
|
220
58
|
//#endregion
|
|
221
|
-
export {
|
|
59
|
+
export { createCollator as t };
|
|
222
60
|
|
|
223
61
|
//# sourceMappingURL=createCollator.jsx.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"createCollator.jsx","names":[],"sources":["../../src/i18n/utils.ts","../../src/i18n/locale.tsx","../../src/i18n/createCollator.ts"],"sourcesContent":["/**\n * i18n utilities for solidaria\n *\n * RTL detection and locale utilities.\n *\n * Port of @react-aria/i18n utils.\n */\n\n// https://en.wikipedia.org/wiki/Right-to-left\nconst RTL_SCRIPTS = new Set([\n \"Arab\",\n \"Syrc\",\n \"Samr\",\n \"Mand\",\n \"Thaa\",\n \"Mend\",\n \"Nkoo\",\n \"Adlm\",\n \"Rohg\",\n \"Hebr\",\n]);\n\nconst RTL_LANGS = new Set([\n \"ae\",\n \"ar\",\n \"arc\",\n \"bcc\",\n \"bqi\",\n \"ckb\",\n \"dv\",\n \"fa\",\n \"glk\",\n \"he\",\n \"ku\",\n \"mzn\",\n \"nqo\",\n \"pnb\",\n \"ps\",\n \"sd\",\n \"ug\",\n \"ur\",\n \"yi\",\n]);\n\n/**\n * Determines if a locale is read right to left.\n * Uses Intl.Locale API when available for accurate detection.\n */\nexport function isRTL(localeString: string): boolean {\n // If the Intl.Locale API is available, use it to get the locale's text direction.\n if (typeof Intl !== \"undefined\" && Intl.Locale) {\n try {\n const locale = new Intl.Locale(localeString).maximize();\n\n // Use the text info object to get the direction if possible.\n // getTextInfo() was implemented as a property by some browsers before it was standardized as a function.\n const localeAny = locale as unknown as {\n getTextInfo?: () => { direction: string };\n textInfo?: { direction: string };\n };\n const textInfo =\n typeof localeAny.getTextInfo === \"function\" ? localeAny.getTextInfo() : localeAny.textInfo;\n\n if (textInfo) {\n return textInfo.direction === \"rtl\";\n }\n\n // Fallback: guess using the script.\n if (locale.script) {\n return RTL_SCRIPTS.has(locale.script);\n }\n } catch {\n // Fall through to language-based detection\n }\n }\n\n // If not, just guess by the language (first part of the locale)\n const lang = localeString.split(\"-\")[0];\n return RTL_LANGS.has(lang);\n}\n\n/**\n * Creates a cache key for formatter options.\n */\nexport function createCacheKey(locale: string, options?: Record<string, unknown>): string {\n if (!options) {\n return locale;\n }\n return (\n locale +\n Object.entries(options)\n .sort((a, b) => (a[0] < b[0] ? -1 : 1))\n .join()\n );\n}\n","/**\n * Locale context and provider for solidaria\n *\n * Provides locale and text direction to the component tree.\n *\n * Port of @react-aria/i18n context and useDefaultLocale.\n */\n\nimport {\n type Accessor,\n type JSX,\n type ParentProps,\n createContext,\n createEffect,\n createMemo,\n createSignal,\n onCleanup,\n useContext,\n} from \"solid-js\";\nimport { isRTL } from \"./utils\";\n\n/** Text direction: left-to-right or right-to-left. */\nexport type Direction = \"ltr\" | \"rtl\";\n\n/** Locale information including language code and text direction. */\nexport interface Locale {\n /** The BCP47 language code for the locale (e.g., 'en-US', 'ar-SA'). */\n locale: string;\n /** The writing direction for the locale. */\n direction: Direction;\n}\n\nexport interface I18nProviderProps extends ParentProps {\n /** The locale to apply to the children. If not provided, uses browser default. */\n locale?: string;\n}\n\n// Symbol for server-provided locale\nconst localeSymbol = Symbol.for(\"solidaria.i18n.locale\");\n\nlet currentLocale: Locale | null = null;\nconst listeners = new Set<(locale: Locale) => void>();\n\n/**\n * Gets the default locale from the browser/system.\n */\nexport function getDefaultLocale(): Locale {\n let locale =\n (typeof window !== \"undefined\" &&\n (window as unknown as Record<symbol, string>)[localeSymbol]) ||\n (typeof navigator !== \"undefined\" &&\n (navigator.language || (navigator as unknown as { userLanguage?: string }).userLanguage)) ||\n \"en-US\";\n\n // Validate the locale is supported\n try {\n Intl.DateTimeFormat.supportedLocalesOf([locale]);\n } catch {\n locale = \"en-US\";\n }\n\n return {\n locale,\n direction: isRTL(locale) ? \"rtl\" : \"ltr\",\n };\n}\n\nfunction updateLocale(): void {\n currentLocale = getDefaultLocale();\n for (const listener of listeners) {\n listener(currentLocale);\n }\n}\n\nconst I18nContext = createContext<Accessor<Locale> | null>(null);\n\n/**\n * Returns the current browser/system locale, and updates when it changes.\n *\n * @example\n * ```tsx\n * const locale = createDefaultLocale();\n * console.log(locale().locale); // 'en-US'\n * console.log(locale().direction); // 'ltr'\n * ```\n */\nexport function createDefaultLocale(): Accessor<Locale> {\n if (!currentLocale) {\n currentLocale = getDefaultLocale();\n }\n\n const [locale, setLocale] = createSignal<Locale>(currentLocale);\n\n createEffect(() => {\n if (typeof window === \"undefined\") {\n return;\n }\n\n if (listeners.size === 0) {\n window.addEventListener(\"languagechange\", updateLocale);\n }\n\n listeners.add(setLocale);\n\n onCleanup(() => {\n listeners.delete(setLocale);\n if (listeners.size === 0) {\n window.removeEventListener(\"languagechange\", updateLocale);\n }\n });\n });\n\n return locale;\n}\n\n/**\n * Returns the current locale and layout direction from context or browser default.\n *\n * @example\n * ```tsx\n * function MyComponent() {\n * const locale = useLocale();\n * return <div dir={locale().direction}>{locale().locale}</div>;\n * }\n * ```\n */\nexport function useLocale(): Accessor<Locale> {\n const context = useContext(I18nContext);\n const defaultLocale = createDefaultLocale();\n return context || defaultLocale;\n}\n\n/**\n * Provides the locale for the application to all child components.\n *\n * @example\n * ```tsx\n * // Use browser default locale\n * <I18nProvider>\n * <App />\n * </I18nProvider>\n *\n * // Override with specific locale\n * <I18nProvider locale=\"ar-SA\">\n * <App /> // Will have RTL direction\n * </I18nProvider>\n * ```\n */\nexport function I18nProvider(props: I18nProviderProps): JSX.Element {\n const defaultLocale = createDefaultLocale();\n\n const locale = createMemo<Locale>(() => {\n if (props.locale) {\n return {\n locale: props.locale,\n direction: isRTL(props.locale) ? \"rtl\" : \"ltr\",\n };\n }\n return defaultLocale();\n });\n\n return <I18nContext.Provider value={locale}>{props.children}</I18nContext.Provider>;\n}\n","/**\n * createCollator hook for solidaria\n *\n * Provides localized string comparison/collation with caching.\n *\n * Port of @react-aria/i18n useCollator.\n */\n\nimport { createMemo } from \"solid-js\";\nimport { useLocale } from \"./locale\";\nimport { createCacheKey } from \"./utils\";\n\nconst collatorCache = new Map<string, Intl.Collator>();\n\n/**\n * Gets or creates a cached collator.\n */\nfunction getCachedCollator(locale: string, options?: Intl.CollatorOptions): Intl.Collator {\n const cacheKey = createCacheKey(locale, options as Record<string, unknown>);\n\n if (collatorCache.has(cacheKey)) {\n return collatorCache.get(cacheKey)!;\n }\n\n const collator = new Intl.Collator(locale, options);\n collatorCache.set(cacheKey, collator);\n return collator;\n}\n\n/**\n * Provides localized string collation for the current locale.\n * Useful for sorting strings according to locale-specific rules.\n *\n * @example\n * ```tsx\n * function SortedList(props: { items: string[] }) {\n * const collator = createCollator();\n *\n * const sortedItems = () =>\n * [...props.items].sort((a, b) => collator().compare(a, b));\n *\n * return (\n * <ul>\n * <For each={sortedItems()}>\n * {(item) => <li>{item}</li>}\n * </For>\n * </ul>\n * );\n * }\n * ```\n *\n * @example\n * ```tsx\n * // Case-insensitive sorting\n * const collator = createCollator({ sensitivity: 'base' });\n *\n * // Numeric sorting\n * const numericCollator = createCollator({ numeric: true });\n * // ['a1', 'a10', 'a2'].sort(numericCollator().compare) -> ['a1', 'a2', 'a10']\n * ```\n */\nexport function createCollator(options?: Intl.CollatorOptions): () => Intl.Collator {\n const locale = useLocale();\n\n return createMemo(() => getCachedCollator(locale().locale, options));\n}\n"],"mappings":";;;;;;;;;AASA,MAAM,cAAc,IAAI,IAAI;CAC1B;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;AACF,CAAC;AAED,MAAM,YAAY,IAAI,IAAI;CACxB;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;AACF,CAAC;;;;;AAMD,SAAgB,MAAM,cAA+B;CAEnD,IAAI,OAAO,SAAS,eAAe,KAAK,QACtC,IAAI;EACF,MAAM,SAAS,IAAI,KAAK,OAAO,YAAY,CAAC,CAAC,SAAS;EAItD,MAAM,YAAY;EAIlB,MAAM,WACJ,OAAO,UAAU,gBAAgB,aAAa,UAAU,YAAY,IAAI,UAAU;EAEpF,IAAI,UACF,OAAO,SAAS,cAAc;EAIhC,IAAI,OAAO,QACT,OAAO,YAAY,IAAI,OAAO,MAAM;CAExC,QAAQ,CAER;CAIF,MAAM,OAAO,aAAa,MAAM,GAAG,CAAC,CAAC;CACrC,OAAO,UAAU,IAAI,IAAI;AAC3B;;;;AAKA,SAAgB,eAAe,QAAgB,SAA2C;CACxF,IAAI,CAAC,SACH,OAAO;CAET,OACE,SACA,OAAO,QAAQ,OAAO,CAAC,CACpB,MAAM,GAAG,MAAO,EAAE,KAAK,EAAE,KAAK,KAAK,CAAE,CAAC,CACtC,KAAK;AAEZ;;;;;;;;;;ACxDA,MAAM,eAAe,OAAO,IAAI,uBAAuB;AAEvD,IAAI,gBAA+B;AACnC,MAAM,4BAAY,IAAI,IAA8B;;;;AAKpD,SAAgB,mBAA2B;CACzC,IAAI,SACD,OAAO,WAAW,eAChB,OAA6C,iBAC/C,OAAO,cAAc,gBACnB,UAAU,YAAa,UAAmD,iBAC7E;CAGF,IAAI;EACF,KAAK,eAAe,mBAAmB,CAAC,MAAM,CAAC;CACjD,QAAQ;EACN,SAAS;CACX;CAEA,OAAO;EACL;EACA,WAAW,MAAM,MAAM,IAAI,QAAQ;CACrC;AACF;AAEA,SAAS,eAAqB;CAC5B,gBAAgB,iBAAiB;CACjC,KAAK,MAAM,YAAY,WACrB,SAAS,aAAa;AAE1B;AAEA,MAAM,cAAc,cAAuC,IAAI;;;;;;;;;;;AAY/D,SAAgB,sBAAwC;CACtD,IAAI,CAAC,eACH,gBAAgB,iBAAiB;CAGnC,MAAM,CAAC,QAAQ,aAAa,aAAqB,aAAa;CAE9D,mBAAmB;EACjB,IAAI,OAAO,WAAW,aACpB;EAGF,IAAI,UAAU,SAAS,GACrB,OAAO,iBAAiB,kBAAkB,YAAY;EAGxD,UAAU,IAAI,SAAS;EAEvB,gBAAgB;GACd,UAAU,OAAO,SAAS;GAC1B,IAAI,UAAU,SAAS,GACrB,OAAO,oBAAoB,kBAAkB,YAAY;EAE7D,CAAC;CACH,CAAC;CAED,OAAO;AACT;;;;;;;;;;;;AAaA,SAAgB,YAA8B;CAC5C,MAAM,UAAU,WAAW,WAAW;CACtC,MAAM,gBAAgB,oBAAoB;CAC1C,OAAO,WAAW;AACpB;;;;;;;;;;;;;;;;;AAkBA,SAAgB,aAAa,OAAuC;CAClE,MAAM,gBAAgB,oBAAoB;CAE1C,MAAM,SAAS,iBAAyB;EACtC,IAAI,MAAM,QACR,OAAO;GACL,QAAQ,MAAM;GACd,WAAW,MAAM,MAAM,MAAM,IAAI,QAAQ;EAC3C;EAEF,OAAO,cAAc;CACvB,CAAC;CAED,OAAO,CAAC,YAAY,SAAS,OAAO,SAAS,MAAM,SAAS,EAAE,YAAY;AAC5E;;;;;;;;;;ACtJA,MAAM,gCAAgB,IAAI,IAA2B;;;;AAKrD,SAAS,kBAAkB,QAAgB,SAA+C;CACxF,MAAM,WAAW,eAAe,QAAQ,OAAkC;CAE1E,IAAI,cAAc,IAAI,QAAQ,GAC5B,OAAO,cAAc,IAAI,QAAQ;CAGnC,MAAM,WAAW,IAAI,KAAK,SAAS,QAAQ,OAAO;CAClD,cAAc,IAAI,UAAU,QAAQ;CACpC,OAAO;AACT;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAkCA,SAAgB,eAAe,SAAqD;CAClF,MAAM,SAAS,UAAU;CAEzB,OAAO,iBAAiB,kBAAkB,OAAO,CAAC,CAAC,QAAQ,OAAO,CAAC;AACrE"}
|
|
1
|
+
{"version":3,"file":"createCollator.jsx","names":[],"sources":["../../src/i18n/createCollator.ts"],"sourcesContent":["/**\n * createCollator hook for solidaria\n *\n * Provides localized string comparison/collation with caching.\n *\n * Port of @react-aria/i18n useCollator.\n */\n\nimport { createMemo } from \"solid-js\";\nimport { useLocale } from \"./locale\";\nimport { createCacheKey } from \"./utils\";\n\nconst collatorCache = new Map<string, Intl.Collator>();\n\n/**\n * Gets or creates a cached collator.\n */\nfunction getCachedCollator(locale: string, options?: Intl.CollatorOptions): Intl.Collator {\n const cacheKey = createCacheKey(locale, options as Record<string, unknown>);\n\n if (collatorCache.has(cacheKey)) {\n return collatorCache.get(cacheKey)!;\n }\n\n const collator = new Intl.Collator(locale, options);\n collatorCache.set(cacheKey, collator);\n return collator;\n}\n\n/**\n * Provides localized string collation for the current locale.\n * Useful for sorting strings according to locale-specific rules.\n *\n * @example\n * ```tsx\n * function SortedList(props: { items: string[] }) {\n * const collator = createCollator();\n *\n * const sortedItems = () =>\n * [...props.items].sort((a, b) => collator().compare(a, b));\n *\n * return (\n * <ul>\n * <For each={sortedItems()}>\n * {(item) => <li>{item}</li>}\n * </For>\n * </ul>\n * );\n * }\n * ```\n *\n * @example\n * ```tsx\n * // Case-insensitive sorting\n * const collator = createCollator({ sensitivity: 'base' });\n *\n * // Numeric sorting\n * const numericCollator = createCollator({ numeric: true });\n * // ['a1', 'a10', 'a2'].sort(numericCollator().compare) -> ['a1', 'a2', 'a10']\n * ```\n */\nexport function createCollator(options?: Intl.CollatorOptions): () => Intl.Collator {\n const locale = useLocale();\n\n return createMemo(() => getCachedCollator(locale().locale, options));\n}\n"],"mappings":";;;;;;;;;;AAYA,MAAM,gCAAgB,IAAI,IAA2B;;;;AAKrD,SAAS,kBAAkB,QAAgB,SAA+C;CACxF,MAAM,WAAW,eAAe,QAAQ,OAAkC;CAE1E,IAAI,cAAc,IAAI,QAAQ,GAC5B,OAAO,cAAc,IAAI,QAAQ;CAGnC,MAAM,WAAW,IAAI,KAAK,SAAS,QAAQ,OAAO;CAClD,cAAc,IAAI,UAAU,QAAQ;CACpC,OAAO;AACT;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAkCA,SAAgB,eAAe,SAAqD;CAClF,MAAM,SAAS,UAAU;CAEzB,OAAO,iBAAiB,kBAAkB,OAAO,CAAC,CAAC,QAAQ,OAAO,CAAC;AACrE"}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import { i as
|
|
1
|
+
import { i as mergeProps } from "./env.js";
|
|
2
|
+
import { t as access } from "./reactivity.js";
|
|
2
3
|
import { createId } from "../ssr/index.js";
|
|
3
4
|
import { t as createLabel } from "./createLabel.js";
|
|
4
5
|
//#region src/label/createField.ts
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"createField.js","names":[],"sources":["../../src/label/createField.ts"],"sourcesContent":["/**\n * Field hook for Solidaria\n *\n * Provides the accessibility implementation for input fields.\n * Fields accept user input, gain context from their label, and may display\n * a description or error message.\n *\n * This is a 1:1 port of @react-aria/label's useField hook.\n */\n\nimport { JSX } from \"solid-js\";\nimport { createId } from \"../ssr\";\nimport {\n createLabel,\n type LabelAriaProps,\n type LabelAria,\n type AriaLabelingProps,\n type DOMProps,\n} from \"./createLabel\";\nimport { mergeProps } from \"../utils/mergeProps\";\nimport { type MaybeAccessor, access } from \"../utils/reactivity\";\n\nexport interface HelpTextProps {\n /** A description for the field. Provides a hint such as specific requirements for what to choose. */\n description?: JSX.Element;\n /** An error message for the field. */\n errorMessage?: JSX.Element | ((validation: ValidationResult) => JSX.Element);\n}\n\nexport interface ValidationResult {\n /** Whether the input value is invalid. */\n isInvalid: boolean;\n /** The current error messages for the input if it is invalid, otherwise an empty array. */\n validationErrors: string[];\n /** The native validity state for the input. */\n validationDetails: ValidityState;\n}\n\nexport interface Validation<T> {\n /** Whether the input value is invalid. */\n isInvalid?: boolean;\n /** Whether the input is required before form submission. */\n isRequired?: boolean;\n /** A function that returns an error message if a given value is invalid. */\n validate?: (value: T) => string | string[] | true | null | undefined;\n}\n\nexport interface AriaFieldProps\n extends LabelAriaProps, HelpTextProps, Omit<Validation<any>, \"isRequired\"> {}\n\nexport interface FieldAria extends LabelAria {\n /** Props for the description element, if any. */\n descriptionProps: JSX.HTMLAttributes<HTMLElement>;\n /** Props for the error message element, if any. */\n errorMessageProps: JSX.HTMLAttributes<HTMLElement>;\n}\n\n/**\n * Provides the accessibility implementation for input fields.\n * Fields accept user input, gain context from their label, and may display\n * a description or error message.\n *\n * @param props - Props for the Field.\n */\nexport function createField(props: MaybeAccessor<AriaFieldProps>): FieldAria {\n const getProps = () => access(props);\n\n const { labelProps, fieldProps: baseLabelFieldProps } = createLabel(props);\n\n // Generate IDs for description and error message\n const descriptionId = createId();\n const errorMessageId = createId();\n\n const getDescriptionProps = (): FieldAria[\"descriptionProps\"] => {\n const { description, errorMessage, isInvalid } = getProps();\n\n // Only include ID if description exists or there's an error message that might be shown\n if (!description && !errorMessage && !isInvalid) {\n return {};\n }\n\n return {\n id: descriptionId,\n };\n };\n\n const getErrorMessageProps = (): FieldAria[\"errorMessageProps\"] => {\n const { errorMessage, isInvalid } = getProps();\n\n // Only include ID if there's an error message and the field is invalid\n if (!errorMessage && !isInvalid) {\n return {};\n }\n\n return {\n id: errorMessageId,\n };\n };\n\n const getFieldProps = (): AriaLabelingProps & DOMProps => {\n const { description, errorMessage, isInvalid } = getProps();\n\n const describedByIds: string[] = [];\n\n // Add description ID if description exists\n if (description) {\n describedByIds.push(descriptionId);\n }\n\n // Add error message ID if field is invalid and error message exists\n // Use aria-describedby for error message because aria-errormessage is unsupported\n // using VoiceOver or NVDA. See https://github.com/adobe/react-spectrum/issues/1346#issuecomment-740136268\n if (isInvalid && errorMessage) {\n describedByIds.push(errorMessageId);\n }\n\n // Add any existing aria-describedby from props\n const existingDescribedBy = getProps()[\"aria-describedby\"];\n if (existingDescribedBy) {\n describedByIds.push(existingDescribedBy);\n }\n\n const ariaDescribedBy = describedByIds.length > 0 ? describedByIds.join(\" \") : undefined;\n\n return mergeProps(baseLabelFieldProps, {\n \"aria-describedby\": ariaDescribedBy,\n }) as AriaLabelingProps & DOMProps;\n };\n\n return {\n get labelProps() {\n return labelProps;\n },\n get fieldProps() {\n return getFieldProps();\n },\n get descriptionProps() {\n return getDescriptionProps();\n },\n get errorMessageProps() {\n return getErrorMessageProps();\n },\n };\n}\n"],"mappings":"
|
|
1
|
+
{"version":3,"file":"createField.js","names":[],"sources":["../../src/label/createField.ts"],"sourcesContent":["/**\n * Field hook for Solidaria\n *\n * Provides the accessibility implementation for input fields.\n * Fields accept user input, gain context from their label, and may display\n * a description or error message.\n *\n * This is a 1:1 port of @react-aria/label's useField hook.\n */\n\nimport { JSX } from \"solid-js\";\nimport { createId } from \"../ssr\";\nimport {\n createLabel,\n type LabelAriaProps,\n type LabelAria,\n type AriaLabelingProps,\n type DOMProps,\n} from \"./createLabel\";\nimport { mergeProps } from \"../utils/mergeProps\";\nimport { type MaybeAccessor, access } from \"../utils/reactivity\";\n\nexport interface HelpTextProps {\n /** A description for the field. Provides a hint such as specific requirements for what to choose. */\n description?: JSX.Element;\n /** An error message for the field. */\n errorMessage?: JSX.Element | ((validation: ValidationResult) => JSX.Element);\n}\n\nexport interface ValidationResult {\n /** Whether the input value is invalid. */\n isInvalid: boolean;\n /** The current error messages for the input if it is invalid, otherwise an empty array. */\n validationErrors: string[];\n /** The native validity state for the input. */\n validationDetails: ValidityState;\n}\n\nexport interface Validation<T> {\n /** Whether the input value is invalid. */\n isInvalid?: boolean;\n /** Whether the input is required before form submission. */\n isRequired?: boolean;\n /** A function that returns an error message if a given value is invalid. */\n validate?: (value: T) => string | string[] | true | null | undefined;\n}\n\nexport interface AriaFieldProps\n extends LabelAriaProps, HelpTextProps, Omit<Validation<any>, \"isRequired\"> {}\n\nexport interface FieldAria extends LabelAria {\n /** Props for the description element, if any. */\n descriptionProps: JSX.HTMLAttributes<HTMLElement>;\n /** Props for the error message element, if any. */\n errorMessageProps: JSX.HTMLAttributes<HTMLElement>;\n}\n\n/**\n * Provides the accessibility implementation for input fields.\n * Fields accept user input, gain context from their label, and may display\n * a description or error message.\n *\n * @param props - Props for the Field.\n */\nexport function createField(props: MaybeAccessor<AriaFieldProps>): FieldAria {\n const getProps = () => access(props);\n\n const { labelProps, fieldProps: baseLabelFieldProps } = createLabel(props);\n\n // Generate IDs for description and error message\n const descriptionId = createId();\n const errorMessageId = createId();\n\n const getDescriptionProps = (): FieldAria[\"descriptionProps\"] => {\n const { description, errorMessage, isInvalid } = getProps();\n\n // Only include ID if description exists or there's an error message that might be shown\n if (!description && !errorMessage && !isInvalid) {\n return {};\n }\n\n return {\n id: descriptionId,\n };\n };\n\n const getErrorMessageProps = (): FieldAria[\"errorMessageProps\"] => {\n const { errorMessage, isInvalid } = getProps();\n\n // Only include ID if there's an error message and the field is invalid\n if (!errorMessage && !isInvalid) {\n return {};\n }\n\n return {\n id: errorMessageId,\n };\n };\n\n const getFieldProps = (): AriaLabelingProps & DOMProps => {\n const { description, errorMessage, isInvalid } = getProps();\n\n const describedByIds: string[] = [];\n\n // Add description ID if description exists\n if (description) {\n describedByIds.push(descriptionId);\n }\n\n // Add error message ID if field is invalid and error message exists\n // Use aria-describedby for error message because aria-errormessage is unsupported\n // using VoiceOver or NVDA. See https://github.com/adobe/react-spectrum/issues/1346#issuecomment-740136268\n if (isInvalid && errorMessage) {\n describedByIds.push(errorMessageId);\n }\n\n // Add any existing aria-describedby from props\n const existingDescribedBy = getProps()[\"aria-describedby\"];\n if (existingDescribedBy) {\n describedByIds.push(existingDescribedBy);\n }\n\n const ariaDescribedBy = describedByIds.length > 0 ? describedByIds.join(\" \") : undefined;\n\n return mergeProps(baseLabelFieldProps, {\n \"aria-describedby\": ariaDescribedBy,\n }) as AriaLabelingProps & DOMProps;\n };\n\n return {\n get labelProps() {\n return labelProps;\n },\n get fieldProps() {\n return getFieldProps();\n },\n get descriptionProps() {\n return getDescriptionProps();\n },\n get errorMessageProps() {\n return getErrorMessageProps();\n },\n };\n}\n"],"mappings":";;;;;;;;;;;;AAgEA,SAAgB,YAAY,OAAiD;CAC3E,MAAM,iBAAiB,OAAO,KAAK;CAEnC,MAAM,EAAE,YAAY,YAAY,wBAAwB,YAAY,KAAK;CAGzE,MAAM,gBAAgB,SAAS;CAC/B,MAAM,iBAAiB,SAAS;CAEhC,MAAM,4BAA2D;EAC/D,MAAM,EAAE,aAAa,cAAc,cAAc,SAAS;EAG1D,IAAI,CAAC,eAAe,CAAC,gBAAgB,CAAC,WACpC,OAAO,CAAC;EAGV,OAAO,EACL,IAAI,cACN;CACF;CAEA,MAAM,6BAA6D;EACjE,MAAM,EAAE,cAAc,cAAc,SAAS;EAG7C,IAAI,CAAC,gBAAgB,CAAC,WACpB,OAAO,CAAC;EAGV,OAAO,EACL,IAAI,eACN;CACF;CAEA,MAAM,sBAAoD;EACxD,MAAM,EAAE,aAAa,cAAc,cAAc,SAAS;EAE1D,MAAM,iBAA2B,CAAC;EAGlC,IAAI,aACF,eAAe,KAAK,aAAa;EAMnC,IAAI,aAAa,cACf,eAAe,KAAK,cAAc;EAIpC,MAAM,sBAAsB,SAAS,CAAC,CAAC;EACvC,IAAI,qBACF,eAAe,KAAK,mBAAmB;EAKzC,OAAO,WAAW,qBAAqB,EACrC,oBAHsB,eAAe,SAAS,IAAI,eAAe,KAAK,GAAG,IAAI,KAAA,EAI/E,CAAC;CACH;CAEA,OAAO;EACL,IAAI,aAAa;GACf,OAAO;EACT;EACA,IAAI,aAAa;GACf,OAAO,cAAc;EACvB;EACA,IAAI,mBAAmB;GACrB,OAAO,oBAAoB;EAC7B;EACA,IAAI,oBAAoB;GACtB,OAAO,qBAAqB;EAC9B;CACF;AACF"}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import { i as
|
|
1
|
+
import { i as mergeProps } from "./env.jsx";
|
|
2
|
+
import { t as access } from "./reactivity.jsx";
|
|
2
3
|
import { createId } from "../ssr/index.jsx";
|
|
3
4
|
import { t as createLabel } from "./createLabel.jsx";
|
|
4
5
|
//#region src/label/createField.ts
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"createField.jsx","names":[],"sources":["../../src/label/createField.ts"],"sourcesContent":["/**\n * Field hook for Solidaria\n *\n * Provides the accessibility implementation for input fields.\n * Fields accept user input, gain context from their label, and may display\n * a description or error message.\n *\n * This is a 1:1 port of @react-aria/label's useField hook.\n */\n\nimport { JSX } from \"solid-js\";\nimport { createId } from \"../ssr\";\nimport {\n createLabel,\n type LabelAriaProps,\n type LabelAria,\n type AriaLabelingProps,\n type DOMProps,\n} from \"./createLabel\";\nimport { mergeProps } from \"../utils/mergeProps\";\nimport { type MaybeAccessor, access } from \"../utils/reactivity\";\n\nexport interface HelpTextProps {\n /** A description for the field. Provides a hint such as specific requirements for what to choose. */\n description?: JSX.Element;\n /** An error message for the field. */\n errorMessage?: JSX.Element | ((validation: ValidationResult) => JSX.Element);\n}\n\nexport interface ValidationResult {\n /** Whether the input value is invalid. */\n isInvalid: boolean;\n /** The current error messages for the input if it is invalid, otherwise an empty array. */\n validationErrors: string[];\n /** The native validity state for the input. */\n validationDetails: ValidityState;\n}\n\nexport interface Validation<T> {\n /** Whether the input value is invalid. */\n isInvalid?: boolean;\n /** Whether the input is required before form submission. */\n isRequired?: boolean;\n /** A function that returns an error message if a given value is invalid. */\n validate?: (value: T) => string | string[] | true | null | undefined;\n}\n\nexport interface AriaFieldProps\n extends LabelAriaProps, HelpTextProps, Omit<Validation<any>, \"isRequired\"> {}\n\nexport interface FieldAria extends LabelAria {\n /** Props for the description element, if any. */\n descriptionProps: JSX.HTMLAttributes<HTMLElement>;\n /** Props for the error message element, if any. */\n errorMessageProps: JSX.HTMLAttributes<HTMLElement>;\n}\n\n/**\n * Provides the accessibility implementation for input fields.\n * Fields accept user input, gain context from their label, and may display\n * a description or error message.\n *\n * @param props - Props for the Field.\n */\nexport function createField(props: MaybeAccessor<AriaFieldProps>): FieldAria {\n const getProps = () => access(props);\n\n const { labelProps, fieldProps: baseLabelFieldProps } = createLabel(props);\n\n // Generate IDs for description and error message\n const descriptionId = createId();\n const errorMessageId = createId();\n\n const getDescriptionProps = (): FieldAria[\"descriptionProps\"] => {\n const { description, errorMessage, isInvalid } = getProps();\n\n // Only include ID if description exists or there's an error message that might be shown\n if (!description && !errorMessage && !isInvalid) {\n return {};\n }\n\n return {\n id: descriptionId,\n };\n };\n\n const getErrorMessageProps = (): FieldAria[\"errorMessageProps\"] => {\n const { errorMessage, isInvalid } = getProps();\n\n // Only include ID if there's an error message and the field is invalid\n if (!errorMessage && !isInvalid) {\n return {};\n }\n\n return {\n id: errorMessageId,\n };\n };\n\n const getFieldProps = (): AriaLabelingProps & DOMProps => {\n const { description, errorMessage, isInvalid } = getProps();\n\n const describedByIds: string[] = [];\n\n // Add description ID if description exists\n if (description) {\n describedByIds.push(descriptionId);\n }\n\n // Add error message ID if field is invalid and error message exists\n // Use aria-describedby for error message because aria-errormessage is unsupported\n // using VoiceOver or NVDA. See https://github.com/adobe/react-spectrum/issues/1346#issuecomment-740136268\n if (isInvalid && errorMessage) {\n describedByIds.push(errorMessageId);\n }\n\n // Add any existing aria-describedby from props\n const existingDescribedBy = getProps()[\"aria-describedby\"];\n if (existingDescribedBy) {\n describedByIds.push(existingDescribedBy);\n }\n\n const ariaDescribedBy = describedByIds.length > 0 ? describedByIds.join(\" \") : undefined;\n\n return mergeProps(baseLabelFieldProps, {\n \"aria-describedby\": ariaDescribedBy,\n }) as AriaLabelingProps & DOMProps;\n };\n\n return {\n get labelProps() {\n return labelProps;\n },\n get fieldProps() {\n return getFieldProps();\n },\n get descriptionProps() {\n return getDescriptionProps();\n },\n get errorMessageProps() {\n return getErrorMessageProps();\n },\n };\n}\n"],"mappings":"
|
|
1
|
+
{"version":3,"file":"createField.jsx","names":[],"sources":["../../src/label/createField.ts"],"sourcesContent":["/**\n * Field hook for Solidaria\n *\n * Provides the accessibility implementation for input fields.\n * Fields accept user input, gain context from their label, and may display\n * a description or error message.\n *\n * This is a 1:1 port of @react-aria/label's useField hook.\n */\n\nimport { JSX } from \"solid-js\";\nimport { createId } from \"../ssr\";\nimport {\n createLabel,\n type LabelAriaProps,\n type LabelAria,\n type AriaLabelingProps,\n type DOMProps,\n} from \"./createLabel\";\nimport { mergeProps } from \"../utils/mergeProps\";\nimport { type MaybeAccessor, access } from \"../utils/reactivity\";\n\nexport interface HelpTextProps {\n /** A description for the field. Provides a hint such as specific requirements for what to choose. */\n description?: JSX.Element;\n /** An error message for the field. */\n errorMessage?: JSX.Element | ((validation: ValidationResult) => JSX.Element);\n}\n\nexport interface ValidationResult {\n /** Whether the input value is invalid. */\n isInvalid: boolean;\n /** The current error messages for the input if it is invalid, otherwise an empty array. */\n validationErrors: string[];\n /** The native validity state for the input. */\n validationDetails: ValidityState;\n}\n\nexport interface Validation<T> {\n /** Whether the input value is invalid. */\n isInvalid?: boolean;\n /** Whether the input is required before form submission. */\n isRequired?: boolean;\n /** A function that returns an error message if a given value is invalid. */\n validate?: (value: T) => string | string[] | true | null | undefined;\n}\n\nexport interface AriaFieldProps\n extends LabelAriaProps, HelpTextProps, Omit<Validation<any>, \"isRequired\"> {}\n\nexport interface FieldAria extends LabelAria {\n /** Props for the description element, if any. */\n descriptionProps: JSX.HTMLAttributes<HTMLElement>;\n /** Props for the error message element, if any. */\n errorMessageProps: JSX.HTMLAttributes<HTMLElement>;\n}\n\n/**\n * Provides the accessibility implementation for input fields.\n * Fields accept user input, gain context from their label, and may display\n * a description or error message.\n *\n * @param props - Props for the Field.\n */\nexport function createField(props: MaybeAccessor<AriaFieldProps>): FieldAria {\n const getProps = () => access(props);\n\n const { labelProps, fieldProps: baseLabelFieldProps } = createLabel(props);\n\n // Generate IDs for description and error message\n const descriptionId = createId();\n const errorMessageId = createId();\n\n const getDescriptionProps = (): FieldAria[\"descriptionProps\"] => {\n const { description, errorMessage, isInvalid } = getProps();\n\n // Only include ID if description exists or there's an error message that might be shown\n if (!description && !errorMessage && !isInvalid) {\n return {};\n }\n\n return {\n id: descriptionId,\n };\n };\n\n const getErrorMessageProps = (): FieldAria[\"errorMessageProps\"] => {\n const { errorMessage, isInvalid } = getProps();\n\n // Only include ID if there's an error message and the field is invalid\n if (!errorMessage && !isInvalid) {\n return {};\n }\n\n return {\n id: errorMessageId,\n };\n };\n\n const getFieldProps = (): AriaLabelingProps & DOMProps => {\n const { description, errorMessage, isInvalid } = getProps();\n\n const describedByIds: string[] = [];\n\n // Add description ID if description exists\n if (description) {\n describedByIds.push(descriptionId);\n }\n\n // Add error message ID if field is invalid and error message exists\n // Use aria-describedby for error message because aria-errormessage is unsupported\n // using VoiceOver or NVDA. See https://github.com/adobe/react-spectrum/issues/1346#issuecomment-740136268\n if (isInvalid && errorMessage) {\n describedByIds.push(errorMessageId);\n }\n\n // Add any existing aria-describedby from props\n const existingDescribedBy = getProps()[\"aria-describedby\"];\n if (existingDescribedBy) {\n describedByIds.push(existingDescribedBy);\n }\n\n const ariaDescribedBy = describedByIds.length > 0 ? describedByIds.join(\" \") : undefined;\n\n return mergeProps(baseLabelFieldProps, {\n \"aria-describedby\": ariaDescribedBy,\n }) as AriaLabelingProps & DOMProps;\n };\n\n return {\n get labelProps() {\n return labelProps;\n },\n get fieldProps() {\n return getFieldProps();\n },\n get descriptionProps() {\n return getDescriptionProps();\n },\n get errorMessageProps() {\n return getErrorMessageProps();\n },\n };\n}\n"],"mappings":";;;;;;;;;;;;AAgEA,SAAgB,YAAY,OAAiD;CAC3E,MAAM,iBAAiB,OAAO,KAAK;CAEnC,MAAM,EAAE,YAAY,YAAY,wBAAwB,YAAY,KAAK;CAGzE,MAAM,gBAAgB,SAAS;CAC/B,MAAM,iBAAiB,SAAS;CAEhC,MAAM,4BAA2D;EAC/D,MAAM,EAAE,aAAa,cAAc,cAAc,SAAS;EAG1D,IAAI,CAAC,eAAe,CAAC,gBAAgB,CAAC,WACpC,OAAO,CAAC;EAGV,OAAO,EACL,IAAI,cACN;CACF;CAEA,MAAM,6BAA6D;EACjE,MAAM,EAAE,cAAc,cAAc,SAAS;EAG7C,IAAI,CAAC,gBAAgB,CAAC,WACpB,OAAO,CAAC;EAGV,OAAO,EACL,IAAI,eACN;CACF;CAEA,MAAM,sBAAoD;EACxD,MAAM,EAAE,aAAa,cAAc,cAAc,SAAS;EAE1D,MAAM,iBAA2B,CAAC;EAGlC,IAAI,aACF,eAAe,KAAK,aAAa;EAMnC,IAAI,aAAa,cACf,eAAe,KAAK,cAAc;EAIpC,MAAM,sBAAsB,SAAS,CAAC,CAAC;EACvC,IAAI,qBACF,eAAe,KAAK,mBAAmB;EAKzC,OAAO,WAAW,qBAAqB,EACrC,oBAHsB,eAAe,SAAS,IAAI,eAAe,KAAK,GAAG,IAAI,KAAA,EAI/E,CAAC;CACH;CAEA,OAAO;EACL,IAAI,aAAa;GACf,OAAO;EACT;EACA,IAAI,aAAa;GACf,OAAO,cAAc;EACvB;EACA,IAAI,mBAAmB;GACrB,OAAO,oBAAoB;EAC7B;EACA,IAAI,oBAAoB;GACtB,OAAO,qBAAqB;EAC9B;CACF;AACF"}
|
|
@@ -66,7 +66,6 @@ function createSyntheticBlurHandler() {
|
|
|
66
66
|
* Based on react-aria's useFocus but adapted for SolidJS.
|
|
67
67
|
*/
|
|
68
68
|
function createFocus(props = {}) {
|
|
69
|
-
const { isDisabled, onFocus: onFocusProp, onBlur: onBlurProp, onFocusChange } = props;
|
|
70
69
|
let cleanupRef;
|
|
71
70
|
const syntheticBlurHandler = createSyntheticBlurHandler();
|
|
72
71
|
onCleanup(() => {
|
|
@@ -74,8 +73,8 @@ function createFocus(props = {}) {
|
|
|
74
73
|
});
|
|
75
74
|
const onBlur = (e) => {
|
|
76
75
|
if (e.target === e.currentTarget) {
|
|
77
|
-
if (
|
|
78
|
-
if (onFocusChange) onFocusChange(false);
|
|
76
|
+
if (props.onBlur) props.onBlur(e);
|
|
77
|
+
if (props.onFocusChange) props.onFocusChange(false);
|
|
79
78
|
cleanupRef?.();
|
|
80
79
|
cleanupRef = void 0;
|
|
81
80
|
}
|
|
@@ -84,15 +83,20 @@ function createFocus(props = {}) {
|
|
|
84
83
|
const ownerDocument = getOwnerDocument(e.target);
|
|
85
84
|
const activeElement = ownerDocument ? getActiveElement(ownerDocument) : null;
|
|
86
85
|
if (e.target === e.currentTarget && activeElement === getEventTarget(e)) {
|
|
87
|
-
if (
|
|
88
|
-
if (onFocusChange) onFocusChange(true);
|
|
86
|
+
if (props.onFocus) props.onFocus(e);
|
|
87
|
+
if (props.onFocusChange) props.onFocusChange(true);
|
|
89
88
|
cleanupRef = syntheticBlurHandler(e, e.target);
|
|
90
89
|
}
|
|
91
90
|
};
|
|
92
|
-
if (isDisabled) return { focusProps: {} };
|
|
93
91
|
return { focusProps: {
|
|
94
|
-
|
|
95
|
-
|
|
92
|
+
get onFocus() {
|
|
93
|
+
if (props.isDisabled) return;
|
|
94
|
+
return props.onFocus || props.onFocusChange || props.onBlur ? onFocus : void 0;
|
|
95
|
+
},
|
|
96
|
+
get onBlur() {
|
|
97
|
+
if (props.isDisabled) return;
|
|
98
|
+
return props.onBlur || props.onFocusChange ? onBlur : void 0;
|
|
99
|
+
}
|
|
96
100
|
} };
|
|
97
101
|
}
|
|
98
102
|
//#endregion
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"createFocus.js","names":[],"sources":["../../src/interactions/createFocus.ts"],"sourcesContent":["/**\n * createFocus - Handles focus events for the immediate target.\n *\n * This is a 1-1 port of React-Aria's useFocus hook adapted for SolidJS.\n * Focus events on child elements will be ignored.\n */\n\nimport { JSX, onCleanup } from \"solid-js\";\nimport { getOwnerDocument, getEventTarget } from \"../utils\";\nfunction getActiveElement(doc: Document): Element | null {\n let activeElement = doc.activeElement;\n while (activeElement && (activeElement as Element).shadowRoot?.activeElement) {\n activeElement = (activeElement as Element).shadowRoot?.activeElement ?? null;\n }\n return activeElement;\n}\n\nexport interface FocusEvents {\n /** Handler that is called when the element receives focus. */\n onFocus?: (e: FocusEvent) => void;\n /** Handler that is called when the element loses focus. */\n onBlur?: (e: FocusEvent) => void;\n /** Handler that is called when the element's focus status changes. */\n onFocusChange?: (isFocused: boolean) => void;\n}\n\nexport interface CreateFocusProps extends FocusEvents {\n /** Whether the focus events should be disabled. */\n isDisabled?: boolean;\n}\n\nexport interface FocusResult {\n /** Props to spread onto the target element. */\n focusProps: JSX.HTMLAttributes<HTMLElement>;\n}\n\n/**\n * Synthetic blur event handler for Firefox bug workaround.\n * React (and we) don't fire onBlur when an element is disabled.\n * Most browsers fire a native focusout event in this case, except for Firefox.\n * We use a MutationObserver to watch for the disabled attribute.\n */\nfunction createSyntheticBlurHandler(): (\n _e: FocusEvent,\n target: Element,\n) => (() => void) | undefined {\n let isFocused = false;\n let observer: MutationObserver | null = null;\n\n return (_e: FocusEvent, target: Element) => {\n if (\n target instanceof HTMLButtonElement ||\n target instanceof HTMLInputElement ||\n target instanceof HTMLTextAreaElement ||\n target instanceof HTMLSelectElement\n ) {\n isFocused = true;\n\n const onBlurHandler = (_blurEvent: Event) => {\n isFocused = false;\n\n if (observer) {\n observer.disconnect();\n observer = null;\n }\n };\n\n target.addEventListener(\"focusout\", onBlurHandler, { once: true });\n\n observer = new MutationObserver(() => {\n if (isFocused && (target as HTMLButtonElement).disabled) {\n isFocused = false;\n observer?.disconnect();\n observer = null;\n const ownerDocument = target.ownerDocument;\n const relatedTarget =\n target === ownerDocument.activeElement ? null : ownerDocument.activeElement;\n target.dispatchEvent(new FocusEvent(\"blur\", { relatedTarget }));\n target.dispatchEvent(new FocusEvent(\"focusout\", { bubbles: true, relatedTarget }));\n }\n });\n\n observer.observe(target, { attributes: true, attributeFilter: [\"disabled\"] });\n\n // Return cleanup function\n return () => {\n if (observer) {\n observer.disconnect();\n observer = null;\n }\n };\n }\n\n return undefined;\n };\n}\n\n/**\n * Handles focus events for the immediate target.\n * Focus events on child elements will be ignored.\n *\n * Based on react-aria's useFocus but adapted for SolidJS.\n */\nexport function createFocus(props: CreateFocusProps = {}): FocusResult {\n
|
|
1
|
+
{"version":3,"file":"createFocus.js","names":[],"sources":["../../src/interactions/createFocus.ts"],"sourcesContent":["/**\n * createFocus - Handles focus events for the immediate target.\n *\n * This is a 1-1 port of React-Aria's useFocus hook adapted for SolidJS.\n * Focus events on child elements will be ignored.\n */\n\nimport { JSX, onCleanup } from \"solid-js\";\nimport { getOwnerDocument, getEventTarget } from \"../utils\";\nfunction getActiveElement(doc: Document): Element | null {\n let activeElement = doc.activeElement;\n while (activeElement && (activeElement as Element).shadowRoot?.activeElement) {\n activeElement = (activeElement as Element).shadowRoot?.activeElement ?? null;\n }\n return activeElement;\n}\n\nexport interface FocusEvents {\n /** Handler that is called when the element receives focus. */\n onFocus?: (e: FocusEvent) => void;\n /** Handler that is called when the element loses focus. */\n onBlur?: (e: FocusEvent) => void;\n /** Handler that is called when the element's focus status changes. */\n onFocusChange?: (isFocused: boolean) => void;\n}\n\nexport interface CreateFocusProps extends FocusEvents {\n /** Whether the focus events should be disabled. */\n isDisabled?: boolean;\n}\n\nexport interface FocusResult {\n /** Props to spread onto the target element. */\n focusProps: JSX.HTMLAttributes<HTMLElement>;\n}\n\n/**\n * Synthetic blur event handler for Firefox bug workaround.\n * React (and we) don't fire onBlur when an element is disabled.\n * Most browsers fire a native focusout event in this case, except for Firefox.\n * We use a MutationObserver to watch for the disabled attribute.\n */\nfunction createSyntheticBlurHandler(): (\n _e: FocusEvent,\n target: Element,\n) => (() => void) | undefined {\n let isFocused = false;\n let observer: MutationObserver | null = null;\n\n return (_e: FocusEvent, target: Element) => {\n if (\n target instanceof HTMLButtonElement ||\n target instanceof HTMLInputElement ||\n target instanceof HTMLTextAreaElement ||\n target instanceof HTMLSelectElement\n ) {\n isFocused = true;\n\n const onBlurHandler = (_blurEvent: Event) => {\n isFocused = false;\n\n if (observer) {\n observer.disconnect();\n observer = null;\n }\n };\n\n target.addEventListener(\"focusout\", onBlurHandler, { once: true });\n\n observer = new MutationObserver(() => {\n if (isFocused && (target as HTMLButtonElement).disabled) {\n isFocused = false;\n observer?.disconnect();\n observer = null;\n const ownerDocument = target.ownerDocument;\n const relatedTarget =\n target === ownerDocument.activeElement ? null : ownerDocument.activeElement;\n target.dispatchEvent(new FocusEvent(\"blur\", { relatedTarget }));\n target.dispatchEvent(new FocusEvent(\"focusout\", { bubbles: true, relatedTarget }));\n }\n });\n\n observer.observe(target, { attributes: true, attributeFilter: [\"disabled\"] });\n\n // Return cleanup function\n return () => {\n if (observer) {\n observer.disconnect();\n observer = null;\n }\n };\n }\n\n return undefined;\n };\n}\n\n/**\n * Handles focus events for the immediate target.\n * Focus events on child elements will be ignored.\n *\n * Based on react-aria's useFocus but adapted for SolidJS.\n */\nexport function createFocus(props: CreateFocusProps = {}): FocusResult {\n // Read isDisabled/handlers off `props` directly (not via destructure): a Solid\n // hook body runs once, so a destructure would freeze them at call time. The\n // handlers read props.x live and the returned props are getters, mirroring\n // upstream useFocus's per-render re-read. guard:idiomatic-solid.\n let cleanupRef: (() => void) | undefined;\n const syntheticBlurHandler = createSyntheticBlurHandler();\n\n // Cleanup on unmount\n onCleanup(() => {\n if (cleanupRef) {\n cleanupRef();\n }\n });\n\n const onBlur: JSX.EventHandler<HTMLElement, FocusEvent> = (e) => {\n // Only handle if target is the currentTarget (not bubbled from children)\n if (e.target === e.currentTarget) {\n if (props.onBlur) {\n props.onBlur(e);\n }\n\n if (props.onFocusChange) {\n props.onFocusChange(false);\n }\n\n cleanupRef?.();\n cleanupRef = undefined;\n }\n };\n\n const onFocus: JSX.EventHandler<HTMLElement, FocusEvent> = (e) => {\n // Double check that document.activeElement actually matches e.target\n // in case a previously chained focus handler already moved focus somewhere else.\n const ownerDocument = getOwnerDocument(e.target);\n const activeElement = ownerDocument ? getActiveElement(ownerDocument) : null;\n\n if (e.target === e.currentTarget && activeElement === getEventTarget(e)) {\n if (props.onFocus) {\n props.onFocus(e);\n }\n\n if (props.onFocusChange) {\n props.onFocusChange(true);\n }\n\n // Set up synthetic blur handler for Firefox bug\n cleanupRef = syntheticBlurHandler(e, e.target);\n }\n };\n\n // If disabled or no handlers, return empty props. Getters re-read props so a\n // later isDisabled/handler change is reflected (the body itself runs once).\n return {\n focusProps: {\n get onFocus() {\n if (props.isDisabled) {\n return undefined;\n }\n return props.onFocus || props.onFocusChange || props.onBlur ? onFocus : undefined;\n },\n get onBlur() {\n if (props.isDisabled) {\n return undefined;\n }\n return props.onBlur || props.onFocusChange ? onBlur : undefined;\n },\n },\n };\n}\n"],"mappings":";;;;;;;;;AASA,SAAS,iBAAiB,KAA+B;CACvD,IAAI,gBAAgB,IAAI;CACxB,OAAO,iBAAkB,cAA0B,YAAY,eAC7D,gBAAiB,cAA0B,YAAY,iBAAiB;CAE1E,OAAO;AACT;;;;;;;AA2BA,SAAS,6BAGqB;CAC5B,IAAI,YAAY;CAChB,IAAI,WAAoC;CAExC,QAAQ,IAAgB,WAAoB;EAC1C,IACE,kBAAkB,qBAClB,kBAAkB,oBAClB,kBAAkB,uBAClB,kBAAkB,mBAClB;GACA,YAAY;GAEZ,MAAM,iBAAiB,eAAsB;IAC3C,YAAY;IAEZ,IAAI,UAAU;KACZ,SAAS,WAAW;KACpB,WAAW;IACb;GACF;GAEA,OAAO,iBAAiB,YAAY,eAAe,EAAE,MAAM,KAAK,CAAC;GAEjE,WAAW,IAAI,uBAAuB;IACpC,IAAI,aAAc,OAA6B,UAAU;KACvD,YAAY;KACZ,UAAU,WAAW;KACrB,WAAW;KACX,MAAM,gBAAgB,OAAO;KAC7B,MAAM,gBACJ,WAAW,cAAc,gBAAgB,OAAO,cAAc;KAChE,OAAO,cAAc,IAAI,WAAW,QAAQ,EAAE,cAAc,CAAC,CAAC;KAC9D,OAAO,cAAc,IAAI,WAAW,YAAY;MAAE,SAAS;MAAM;KAAc,CAAC,CAAC;IACnF;GACF,CAAC;GAED,SAAS,QAAQ,QAAQ;IAAE,YAAY;IAAM,iBAAiB,CAAC,UAAU;GAAE,CAAC;GAG5E,aAAa;IACX,IAAI,UAAU;KACZ,SAAS,WAAW;KACpB,WAAW;IACb;GACF;EACF;CAGF;AACF;;;;;;;AAQA,SAAgB,YAAY,QAA0B,CAAC,GAAgB;CAKrE,IAAI;CACJ,MAAM,uBAAuB,2BAA2B;CAGxD,gBAAgB;EACd,IAAI,YACF,WAAW;CAEf,CAAC;CAED,MAAM,UAAqD,MAAM;EAE/D,IAAI,EAAE,WAAW,EAAE,eAAe;GAChC,IAAI,MAAM,QACR,MAAM,OAAO,CAAC;GAGhB,IAAI,MAAM,eACR,MAAM,cAAc,KAAK;GAG3B,aAAa;GACb,aAAa,KAAA;EACf;CACF;CAEA,MAAM,WAAsD,MAAM;EAGhE,MAAM,gBAAgB,iBAAiB,EAAE,MAAM;EAC/C,MAAM,gBAAgB,gBAAgB,iBAAiB,aAAa,IAAI;EAExE,IAAI,EAAE,WAAW,EAAE,iBAAiB,kBAAkB,eAAe,CAAC,GAAG;GACvE,IAAI,MAAM,SACR,MAAM,QAAQ,CAAC;GAGjB,IAAI,MAAM,eACR,MAAM,cAAc,IAAI;GAI1B,aAAa,qBAAqB,GAAG,EAAE,MAAM;EAC/C;CACF;CAIA,OAAO,EACL,YAAY;EACV,IAAI,UAAU;GACZ,IAAI,MAAM,YACR;GAEF,OAAO,MAAM,WAAW,MAAM,iBAAiB,MAAM,SAAS,UAAU,KAAA;EAC1E;EACA,IAAI,SAAS;GACX,IAAI,MAAM,YACR;GAEF,OAAO,MAAM,UAAU,MAAM,gBAAgB,SAAS,KAAA;EACxD;CACF,EACF;AACF"}
|
|
@@ -66,7 +66,6 @@ function createSyntheticBlurHandler() {
|
|
|
66
66
|
* Based on react-aria's useFocus but adapted for SolidJS.
|
|
67
67
|
*/
|
|
68
68
|
function createFocus(props = {}) {
|
|
69
|
-
const { isDisabled, onFocus: onFocusProp, onBlur: onBlurProp, onFocusChange } = props;
|
|
70
69
|
let cleanupRef;
|
|
71
70
|
const syntheticBlurHandler = createSyntheticBlurHandler();
|
|
72
71
|
onCleanup(() => {
|
|
@@ -74,8 +73,8 @@ function createFocus(props = {}) {
|
|
|
74
73
|
});
|
|
75
74
|
const onBlur = (e) => {
|
|
76
75
|
if (e.target === e.currentTarget) {
|
|
77
|
-
if (
|
|
78
|
-
if (onFocusChange) onFocusChange(false);
|
|
76
|
+
if (props.onBlur) props.onBlur(e);
|
|
77
|
+
if (props.onFocusChange) props.onFocusChange(false);
|
|
79
78
|
cleanupRef?.();
|
|
80
79
|
cleanupRef = void 0;
|
|
81
80
|
}
|
|
@@ -84,15 +83,20 @@ function createFocus(props = {}) {
|
|
|
84
83
|
const ownerDocument = getOwnerDocument(e.target);
|
|
85
84
|
const activeElement = ownerDocument ? getActiveElement(ownerDocument) : null;
|
|
86
85
|
if (e.target === e.currentTarget && activeElement === getEventTarget(e)) {
|
|
87
|
-
if (
|
|
88
|
-
if (onFocusChange) onFocusChange(true);
|
|
86
|
+
if (props.onFocus) props.onFocus(e);
|
|
87
|
+
if (props.onFocusChange) props.onFocusChange(true);
|
|
89
88
|
cleanupRef = syntheticBlurHandler(e, e.target);
|
|
90
89
|
}
|
|
91
90
|
};
|
|
92
|
-
if (isDisabled) return { focusProps: {} };
|
|
93
91
|
return { focusProps: {
|
|
94
|
-
|
|
95
|
-
|
|
92
|
+
get onFocus() {
|
|
93
|
+
if (props.isDisabled) return;
|
|
94
|
+
return props.onFocus || props.onFocusChange || props.onBlur ? onFocus : void 0;
|
|
95
|
+
},
|
|
96
|
+
get onBlur() {
|
|
97
|
+
if (props.isDisabled) return;
|
|
98
|
+
return props.onBlur || props.onFocusChange ? onBlur : void 0;
|
|
99
|
+
}
|
|
96
100
|
} };
|
|
97
101
|
}
|
|
98
102
|
//#endregion
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"createFocus.jsx","names":[],"sources":["../../src/interactions/createFocus.ts"],"sourcesContent":["/**\n * createFocus - Handles focus events for the immediate target.\n *\n * This is a 1-1 port of React-Aria's useFocus hook adapted for SolidJS.\n * Focus events on child elements will be ignored.\n */\n\nimport { JSX, onCleanup } from \"solid-js\";\nimport { getOwnerDocument, getEventTarget } from \"../utils\";\nfunction getActiveElement(doc: Document): Element | null {\n let activeElement = doc.activeElement;\n while (activeElement && (activeElement as Element).shadowRoot?.activeElement) {\n activeElement = (activeElement as Element).shadowRoot?.activeElement ?? null;\n }\n return activeElement;\n}\n\nexport interface FocusEvents {\n /** Handler that is called when the element receives focus. */\n onFocus?: (e: FocusEvent) => void;\n /** Handler that is called when the element loses focus. */\n onBlur?: (e: FocusEvent) => void;\n /** Handler that is called when the element's focus status changes. */\n onFocusChange?: (isFocused: boolean) => void;\n}\n\nexport interface CreateFocusProps extends FocusEvents {\n /** Whether the focus events should be disabled. */\n isDisabled?: boolean;\n}\n\nexport interface FocusResult {\n /** Props to spread onto the target element. */\n focusProps: JSX.HTMLAttributes<HTMLElement>;\n}\n\n/**\n * Synthetic blur event handler for Firefox bug workaround.\n * React (and we) don't fire onBlur when an element is disabled.\n * Most browsers fire a native focusout event in this case, except for Firefox.\n * We use a MutationObserver to watch for the disabled attribute.\n */\nfunction createSyntheticBlurHandler(): (\n _e: FocusEvent,\n target: Element,\n) => (() => void) | undefined {\n let isFocused = false;\n let observer: MutationObserver | null = null;\n\n return (_e: FocusEvent, target: Element) => {\n if (\n target instanceof HTMLButtonElement ||\n target instanceof HTMLInputElement ||\n target instanceof HTMLTextAreaElement ||\n target instanceof HTMLSelectElement\n ) {\n isFocused = true;\n\n const onBlurHandler = (_blurEvent: Event) => {\n isFocused = false;\n\n if (observer) {\n observer.disconnect();\n observer = null;\n }\n };\n\n target.addEventListener(\"focusout\", onBlurHandler, { once: true });\n\n observer = new MutationObserver(() => {\n if (isFocused && (target as HTMLButtonElement).disabled) {\n isFocused = false;\n observer?.disconnect();\n observer = null;\n const ownerDocument = target.ownerDocument;\n const relatedTarget =\n target === ownerDocument.activeElement ? null : ownerDocument.activeElement;\n target.dispatchEvent(new FocusEvent(\"blur\", { relatedTarget }));\n target.dispatchEvent(new FocusEvent(\"focusout\", { bubbles: true, relatedTarget }));\n }\n });\n\n observer.observe(target, { attributes: true, attributeFilter: [\"disabled\"] });\n\n // Return cleanup function\n return () => {\n if (observer) {\n observer.disconnect();\n observer = null;\n }\n };\n }\n\n return undefined;\n };\n}\n\n/**\n * Handles focus events for the immediate target.\n * Focus events on child elements will be ignored.\n *\n * Based on react-aria's useFocus but adapted for SolidJS.\n */\nexport function createFocus(props: CreateFocusProps = {}): FocusResult {\n
|
|
1
|
+
{"version":3,"file":"createFocus.jsx","names":[],"sources":["../../src/interactions/createFocus.ts"],"sourcesContent":["/**\n * createFocus - Handles focus events for the immediate target.\n *\n * This is a 1-1 port of React-Aria's useFocus hook adapted for SolidJS.\n * Focus events on child elements will be ignored.\n */\n\nimport { JSX, onCleanup } from \"solid-js\";\nimport { getOwnerDocument, getEventTarget } from \"../utils\";\nfunction getActiveElement(doc: Document): Element | null {\n let activeElement = doc.activeElement;\n while (activeElement && (activeElement as Element).shadowRoot?.activeElement) {\n activeElement = (activeElement as Element).shadowRoot?.activeElement ?? null;\n }\n return activeElement;\n}\n\nexport interface FocusEvents {\n /** Handler that is called when the element receives focus. */\n onFocus?: (e: FocusEvent) => void;\n /** Handler that is called when the element loses focus. */\n onBlur?: (e: FocusEvent) => void;\n /** Handler that is called when the element's focus status changes. */\n onFocusChange?: (isFocused: boolean) => void;\n}\n\nexport interface CreateFocusProps extends FocusEvents {\n /** Whether the focus events should be disabled. */\n isDisabled?: boolean;\n}\n\nexport interface FocusResult {\n /** Props to spread onto the target element. */\n focusProps: JSX.HTMLAttributes<HTMLElement>;\n}\n\n/**\n * Synthetic blur event handler for Firefox bug workaround.\n * React (and we) don't fire onBlur when an element is disabled.\n * Most browsers fire a native focusout event in this case, except for Firefox.\n * We use a MutationObserver to watch for the disabled attribute.\n */\nfunction createSyntheticBlurHandler(): (\n _e: FocusEvent,\n target: Element,\n) => (() => void) | undefined {\n let isFocused = false;\n let observer: MutationObserver | null = null;\n\n return (_e: FocusEvent, target: Element) => {\n if (\n target instanceof HTMLButtonElement ||\n target instanceof HTMLInputElement ||\n target instanceof HTMLTextAreaElement ||\n target instanceof HTMLSelectElement\n ) {\n isFocused = true;\n\n const onBlurHandler = (_blurEvent: Event) => {\n isFocused = false;\n\n if (observer) {\n observer.disconnect();\n observer = null;\n }\n };\n\n target.addEventListener(\"focusout\", onBlurHandler, { once: true });\n\n observer = new MutationObserver(() => {\n if (isFocused && (target as HTMLButtonElement).disabled) {\n isFocused = false;\n observer?.disconnect();\n observer = null;\n const ownerDocument = target.ownerDocument;\n const relatedTarget =\n target === ownerDocument.activeElement ? null : ownerDocument.activeElement;\n target.dispatchEvent(new FocusEvent(\"blur\", { relatedTarget }));\n target.dispatchEvent(new FocusEvent(\"focusout\", { bubbles: true, relatedTarget }));\n }\n });\n\n observer.observe(target, { attributes: true, attributeFilter: [\"disabled\"] });\n\n // Return cleanup function\n return () => {\n if (observer) {\n observer.disconnect();\n observer = null;\n }\n };\n }\n\n return undefined;\n };\n}\n\n/**\n * Handles focus events for the immediate target.\n * Focus events on child elements will be ignored.\n *\n * Based on react-aria's useFocus but adapted for SolidJS.\n */\nexport function createFocus(props: CreateFocusProps = {}): FocusResult {\n // Read isDisabled/handlers off `props` directly (not via destructure): a Solid\n // hook body runs once, so a destructure would freeze them at call time. The\n // handlers read props.x live and the returned props are getters, mirroring\n // upstream useFocus's per-render re-read. guard:idiomatic-solid.\n let cleanupRef: (() => void) | undefined;\n const syntheticBlurHandler = createSyntheticBlurHandler();\n\n // Cleanup on unmount\n onCleanup(() => {\n if (cleanupRef) {\n cleanupRef();\n }\n });\n\n const onBlur: JSX.EventHandler<HTMLElement, FocusEvent> = (e) => {\n // Only handle if target is the currentTarget (not bubbled from children)\n if (e.target === e.currentTarget) {\n if (props.onBlur) {\n props.onBlur(e);\n }\n\n if (props.onFocusChange) {\n props.onFocusChange(false);\n }\n\n cleanupRef?.();\n cleanupRef = undefined;\n }\n };\n\n const onFocus: JSX.EventHandler<HTMLElement, FocusEvent> = (e) => {\n // Double check that document.activeElement actually matches e.target\n // in case a previously chained focus handler already moved focus somewhere else.\n const ownerDocument = getOwnerDocument(e.target);\n const activeElement = ownerDocument ? getActiveElement(ownerDocument) : null;\n\n if (e.target === e.currentTarget && activeElement === getEventTarget(e)) {\n if (props.onFocus) {\n props.onFocus(e);\n }\n\n if (props.onFocusChange) {\n props.onFocusChange(true);\n }\n\n // Set up synthetic blur handler for Firefox bug\n cleanupRef = syntheticBlurHandler(e, e.target);\n }\n };\n\n // If disabled or no handlers, return empty props. Getters re-read props so a\n // later isDisabled/handler change is reflected (the body itself runs once).\n return {\n focusProps: {\n get onFocus() {\n if (props.isDisabled) {\n return undefined;\n }\n return props.onFocus || props.onFocusChange || props.onBlur ? onFocus : undefined;\n },\n get onBlur() {\n if (props.isDisabled) {\n return undefined;\n }\n return props.onBlur || props.onFocusChange ? onBlur : undefined;\n },\n },\n };\n}\n"],"mappings":";;;;;;;;;AASA,SAAS,iBAAiB,KAA+B;CACvD,IAAI,gBAAgB,IAAI;CACxB,OAAO,iBAAkB,cAA0B,YAAY,eAC7D,gBAAiB,cAA0B,YAAY,iBAAiB;CAE1E,OAAO;AACT;;;;;;;AA2BA,SAAS,6BAGqB;CAC5B,IAAI,YAAY;CAChB,IAAI,WAAoC;CAExC,QAAQ,IAAgB,WAAoB;EAC1C,IACE,kBAAkB,qBAClB,kBAAkB,oBAClB,kBAAkB,uBAClB,kBAAkB,mBAClB;GACA,YAAY;GAEZ,MAAM,iBAAiB,eAAsB;IAC3C,YAAY;IAEZ,IAAI,UAAU;KACZ,SAAS,WAAW;KACpB,WAAW;IACb;GACF;GAEA,OAAO,iBAAiB,YAAY,eAAe,EAAE,MAAM,KAAK,CAAC;GAEjE,WAAW,IAAI,uBAAuB;IACpC,IAAI,aAAc,OAA6B,UAAU;KACvD,YAAY;KACZ,UAAU,WAAW;KACrB,WAAW;KACX,MAAM,gBAAgB,OAAO;KAC7B,MAAM,gBACJ,WAAW,cAAc,gBAAgB,OAAO,cAAc;KAChE,OAAO,cAAc,IAAI,WAAW,QAAQ,EAAE,cAAc,CAAC,CAAC;KAC9D,OAAO,cAAc,IAAI,WAAW,YAAY;MAAE,SAAS;MAAM;KAAc,CAAC,CAAC;IACnF;GACF,CAAC;GAED,SAAS,QAAQ,QAAQ;IAAE,YAAY;IAAM,iBAAiB,CAAC,UAAU;GAAE,CAAC;GAG5E,aAAa;IACX,IAAI,UAAU;KACZ,SAAS,WAAW;KACpB,WAAW;IACb;GACF;EACF;CAGF;AACF;;;;;;;AAQA,SAAgB,YAAY,QAA0B,CAAC,GAAgB;CAKrE,IAAI;CACJ,MAAM,uBAAuB,2BAA2B;CAGxD,gBAAgB;EACd,IAAI,YACF,WAAW;CAEf,CAAC;CAED,MAAM,UAAqD,MAAM;EAE/D,IAAI,EAAE,WAAW,EAAE,eAAe;GAChC,IAAI,MAAM,QACR,MAAM,OAAO,CAAC;GAGhB,IAAI,MAAM,eACR,MAAM,cAAc,KAAK;GAG3B,aAAa;GACb,aAAa,KAAA;EACf;CACF;CAEA,MAAM,WAAsD,MAAM;EAGhE,MAAM,gBAAgB,iBAAiB,EAAE,MAAM;EAC/C,MAAM,gBAAgB,gBAAgB,iBAAiB,aAAa,IAAI;EAExE,IAAI,EAAE,WAAW,EAAE,iBAAiB,kBAAkB,eAAe,CAAC,GAAG;GACvE,IAAI,MAAM,SACR,MAAM,QAAQ,CAAC;GAGjB,IAAI,MAAM,eACR,MAAM,cAAc,IAAI;GAI1B,aAAa,qBAAqB,GAAG,EAAE,MAAM;EAC/C;CACF;CAIA,OAAO,EACL,YAAY;EACV,IAAI,UAAU;GACZ,IAAI,MAAM,YACR;GAEF,OAAO,MAAM,WAAW,MAAM,iBAAiB,MAAM,SAAS,UAAU,KAAA;EAC1E;EACA,IAAI,SAAS;GACX,IAAI,MAAM,YACR;GAEF,OAAO,MAAM,UAAU,MAAM,gBAAgB,SAAS,KAAA;EACxD;CACF,EACF;AACF"}
|
|
@@ -59,7 +59,6 @@ function createSyntheticBlurHandler() {
|
|
|
59
59
|
* Based on react-aria's useFocusWithin but adapted for SolidJS.
|
|
60
60
|
*/
|
|
61
61
|
function createFocusWithin(props = {}) {
|
|
62
|
-
const { isDisabled, onBlurWithin, onFocusWithin, onFocusWithinChange } = props;
|
|
63
62
|
let isFocusWithin = false;
|
|
64
63
|
const { addGlobalListener, removeAllGlobalListeners } = createGlobalListeners();
|
|
65
64
|
const syntheticBlurHandler = createSyntheticBlurHandler();
|
|
@@ -75,8 +74,8 @@ function createFocusWithin(props = {}) {
|
|
|
75
74
|
removeAllGlobalListeners();
|
|
76
75
|
cleanupRef?.();
|
|
77
76
|
cleanupRef = void 0;
|
|
78
|
-
if (onBlurWithin) onBlurWithin(e);
|
|
79
|
-
if (onFocusWithinChange) onFocusWithinChange(false);
|
|
77
|
+
if (props.onBlurWithin) props.onBlurWithin(e);
|
|
78
|
+
if (props.onFocusWithinChange) props.onFocusWithinChange(false);
|
|
80
79
|
}
|
|
81
80
|
};
|
|
82
81
|
const onFocus = (e) => {
|
|
@@ -84,8 +83,8 @@ function createFocusWithin(props = {}) {
|
|
|
84
83
|
const ownerDocument = getOwnerDocument(e.target);
|
|
85
84
|
const activeElement = ownerDocument ? getActiveElement(ownerDocument) : null;
|
|
86
85
|
if (!isFocusWithin && activeElement === getEventTarget(e)) {
|
|
87
|
-
if (onFocusWithin) onFocusWithin(e);
|
|
88
|
-
if (onFocusWithinChange) onFocusWithinChange(true);
|
|
86
|
+
if (props.onFocusWithin) props.onFocusWithin(e);
|
|
87
|
+
if (props.onFocusWithinChange) props.onFocusWithinChange(true);
|
|
89
88
|
isFocusWithin = true;
|
|
90
89
|
cleanupRef = syntheticBlurHandler(e, e.target);
|
|
91
90
|
const currentTarget = e.currentTarget;
|
|
@@ -97,8 +96,8 @@ function createFocusWithin(props = {}) {
|
|
|
97
96
|
setEventTarget(nativeEvent, currentTarget);
|
|
98
97
|
isFocusWithin = false;
|
|
99
98
|
removeAllGlobalListeners();
|
|
100
|
-
if (onBlurWithin) onBlurWithin(nativeEvent);
|
|
101
|
-
if (onFocusWithinChange) onFocusWithinChange(false);
|
|
99
|
+
if (props.onBlurWithin) props.onBlurWithin(nativeEvent);
|
|
100
|
+
if (props.onFocusWithinChange) props.onFocusWithinChange(false);
|
|
102
101
|
cleanupRef?.();
|
|
103
102
|
cleanupRef = void 0;
|
|
104
103
|
}
|
|
@@ -106,13 +105,13 @@ function createFocusWithin(props = {}) {
|
|
|
106
105
|
}, { capture: true });
|
|
107
106
|
}
|
|
108
107
|
};
|
|
109
|
-
if (isDisabled) return { focusWithinProps: {
|
|
110
|
-
onFocus: void 0,
|
|
111
|
-
onBlur: void 0
|
|
112
|
-
} };
|
|
113
108
|
return { focusWithinProps: {
|
|
114
|
-
onFocus
|
|
115
|
-
|
|
109
|
+
get onFocus() {
|
|
110
|
+
return props.isDisabled ? void 0 : onFocus;
|
|
111
|
+
},
|
|
112
|
+
get onBlur() {
|
|
113
|
+
return props.isDisabled ? void 0 : onBlur;
|
|
114
|
+
}
|
|
116
115
|
} };
|
|
117
116
|
}
|
|
118
117
|
//#endregion
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"createFocusWithin.js","names":[],"sources":["../../src/interactions/createFocusWithin.ts"],"sourcesContent":["/**\n * createFocusWithin - Handles focus events for the target and its descendants.\n *\n * This is a 1-1 port of React-Aria's useFocusWithin hook adapted for SolidJS.\n */\n\nimport { JSX, onCleanup } from \"solid-js\";\nimport { getOwnerDocument, getEventTarget, nodeContains, createGlobalListeners } from \"../utils\";\nimport { setEventTarget } from \"../utils/events\";\n\nexport interface FocusWithinProps {\n /** Whether the focus within events should be disabled. */\n isDisabled?: boolean;\n /** Handler that is called when the target element or a descendant receives focus. */\n onFocusWithin?: (e: FocusEvent) => void;\n /** Handler that is called when the target element and all descendants lose focus. */\n onBlurWithin?: (e: FocusEvent) => void;\n /** Handler that is called when the focus within state changes. */\n onFocusWithinChange?: (isFocusWithin: boolean) => void;\n}\n\nexport interface FocusWithinResult {\n /** Props to spread onto the target element. */\n focusWithinProps: JSX.HTMLAttributes<HTMLElement>;\n}\n\nfunction getActiveElement(doc: Document): Element | null {\n let activeElement = doc.activeElement;\n while (activeElement && (activeElement as Element).shadowRoot?.activeElement) {\n activeElement = (activeElement as Element).shadowRoot?.activeElement ?? null;\n }\n return activeElement;\n}\n\nfunction createSyntheticBlurHandler(): (\n _e: FocusEvent,\n target: Element,\n) => (() => void) | undefined {\n let isFocused = false;\n let observer: MutationObserver | null = null;\n\n return (_e: FocusEvent, target: Element) => {\n if (\n target instanceof HTMLButtonElement ||\n target instanceof HTMLInputElement ||\n target instanceof HTMLTextAreaElement ||\n target instanceof HTMLSelectElement\n ) {\n isFocused = true;\n\n const onBlurHandler = () => {\n isFocused = false;\n\n if (observer) {\n observer.disconnect();\n observer = null;\n }\n };\n\n target.addEventListener(\"focusout\", onBlurHandler, { once: true });\n\n observer = new MutationObserver(() => {\n if (isFocused && (target as HTMLButtonElement).disabled) {\n isFocused = false;\n observer?.disconnect();\n observer = null;\n const ownerDocument = target.ownerDocument;\n const relatedTarget =\n target === ownerDocument.activeElement ? null : ownerDocument.activeElement;\n target.dispatchEvent(new FocusEvent(\"blur\", { relatedTarget }));\n target.dispatchEvent(new FocusEvent(\"focusout\", { bubbles: true, relatedTarget }));\n }\n });\n\n observer.observe(target, { attributes: true, attributeFilter: [\"disabled\"] });\n\n return () => {\n if (observer) {\n observer.disconnect();\n observer = null;\n }\n };\n }\n\n return undefined;\n };\n}\n\n/**\n * Handles focus events for the target and its descendants.\n *\n * Based on react-aria's useFocusWithin but adapted for SolidJS.\n */\nexport function createFocusWithin(props: FocusWithinProps = {}): FocusWithinResult {\n
|
|
1
|
+
{"version":3,"file":"createFocusWithin.js","names":[],"sources":["../../src/interactions/createFocusWithin.ts"],"sourcesContent":["/**\n * createFocusWithin - Handles focus events for the target and its descendants.\n *\n * This is a 1-1 port of React-Aria's useFocusWithin hook adapted for SolidJS.\n */\n\nimport { JSX, onCleanup } from \"solid-js\";\nimport { getOwnerDocument, getEventTarget, nodeContains, createGlobalListeners } from \"../utils\";\nimport { setEventTarget } from \"../utils/events\";\n\nexport interface FocusWithinProps {\n /** Whether the focus within events should be disabled. */\n isDisabled?: boolean;\n /** Handler that is called when the target element or a descendant receives focus. */\n onFocusWithin?: (e: FocusEvent) => void;\n /** Handler that is called when the target element and all descendants lose focus. */\n onBlurWithin?: (e: FocusEvent) => void;\n /** Handler that is called when the focus within state changes. */\n onFocusWithinChange?: (isFocusWithin: boolean) => void;\n}\n\nexport interface FocusWithinResult {\n /** Props to spread onto the target element. */\n focusWithinProps: JSX.HTMLAttributes<HTMLElement>;\n}\n\nfunction getActiveElement(doc: Document): Element | null {\n let activeElement = doc.activeElement;\n while (activeElement && (activeElement as Element).shadowRoot?.activeElement) {\n activeElement = (activeElement as Element).shadowRoot?.activeElement ?? null;\n }\n return activeElement;\n}\n\nfunction createSyntheticBlurHandler(): (\n _e: FocusEvent,\n target: Element,\n) => (() => void) | undefined {\n let isFocused = false;\n let observer: MutationObserver | null = null;\n\n return (_e: FocusEvent, target: Element) => {\n if (\n target instanceof HTMLButtonElement ||\n target instanceof HTMLInputElement ||\n target instanceof HTMLTextAreaElement ||\n target instanceof HTMLSelectElement\n ) {\n isFocused = true;\n\n const onBlurHandler = () => {\n isFocused = false;\n\n if (observer) {\n observer.disconnect();\n observer = null;\n }\n };\n\n target.addEventListener(\"focusout\", onBlurHandler, { once: true });\n\n observer = new MutationObserver(() => {\n if (isFocused && (target as HTMLButtonElement).disabled) {\n isFocused = false;\n observer?.disconnect();\n observer = null;\n const ownerDocument = target.ownerDocument;\n const relatedTarget =\n target === ownerDocument.activeElement ? null : ownerDocument.activeElement;\n target.dispatchEvent(new FocusEvent(\"blur\", { relatedTarget }));\n target.dispatchEvent(new FocusEvent(\"focusout\", { bubbles: true, relatedTarget }));\n }\n });\n\n observer.observe(target, { attributes: true, attributeFilter: [\"disabled\"] });\n\n return () => {\n if (observer) {\n observer.disconnect();\n observer = null;\n }\n };\n }\n\n return undefined;\n };\n}\n\n/**\n * Handles focus events for the target and its descendants.\n *\n * Based on react-aria's useFocusWithin but adapted for SolidJS.\n */\nexport function createFocusWithin(props: FocusWithinProps = {}): FocusWithinResult {\n // Read isDisabled/handlers off `props` directly (not via destructure): a Solid\n // hook body runs once, so destructuring would freeze them at call time and drop\n // reactive updates — createOverlay/createVisuallyHidden pass a live isDisabled\n // getter. The handlers below read props.x live; the return is getter-based so a\n // later isDisabled flip re-computes. Mirrors upstream useFocusWithin's re-read.\n\n // State tracking\n let isFocusWithin = false;\n\n // Global listeners manager\n const { addGlobalListener, removeAllGlobalListeners } = createGlobalListeners();\n const syntheticBlurHandler = createSyntheticBlurHandler();\n let cleanupRef: (() => void) | undefined;\n\n // Cleanup on unmount\n onCleanup(() => {\n cleanupRef?.();\n removeAllGlobalListeners();\n });\n\n const onBlur: JSX.EventHandler<HTMLElement, FocusEvent> = (e) => {\n // Ignore events bubbling through portals\n if (!e.currentTarget.contains(e.target as Node)) {\n return;\n }\n\n // We don't want to trigger onBlurWithin and then immediately onFocusWithin again\n // when moving focus inside the element. Only trigger if the currentTarget doesn't\n // include the relatedTarget (where focus is moving).\n if (isFocusWithin && !e.currentTarget.contains(e.relatedTarget as Node)) {\n isFocusWithin = false;\n removeAllGlobalListeners();\n cleanupRef?.();\n cleanupRef = undefined;\n\n if (props.onBlurWithin) {\n props.onBlurWithin(e);\n }\n\n if (props.onFocusWithinChange) {\n props.onFocusWithinChange(false);\n }\n }\n };\n\n const onFocus: JSX.EventHandler<HTMLElement, FocusEvent> = (e) => {\n // Ignore events bubbling through portals\n if (!e.currentTarget.contains(e.target as Node)) {\n return;\n }\n\n // Double check that document.activeElement actually matches e.target\n // in case a previously chained focus handler already moved focus somewhere else.\n const ownerDocument = getOwnerDocument(e.target);\n const activeElement = ownerDocument ? getActiveElement(ownerDocument) : null;\n\n if (!isFocusWithin && activeElement === getEventTarget(e)) {\n if (props.onFocusWithin) {\n props.onFocusWithin(e);\n }\n\n if (props.onFocusWithinChange) {\n props.onFocusWithinChange(true);\n }\n\n isFocusWithin = true;\n cleanupRef = syntheticBlurHandler(e, e.target);\n\n // Browsers don't fire blur events when elements are removed from the DOM.\n // However, if a focus event occurs outside the element we're tracking, we\n // can manually fire onBlur.\n const currentTarget = e.currentTarget;\n\n addGlobalListener(\n \"focus\",\n (focusEvent: Event) => {\n if (\n isFocusWithin &&\n !nodeContains(currentTarget, (focusEvent as FocusEvent).target as Element)\n ) {\n // Create a synthetic blur event\n const window = ownerDocument?.defaultView;\n if (window) {\n const nativeEvent = new window.FocusEvent(\"blur\", {\n relatedTarget: (focusEvent as FocusEvent).target as Element,\n });\n setEventTarget(nativeEvent, currentTarget);\n\n isFocusWithin = false;\n removeAllGlobalListeners();\n\n if (props.onBlurWithin) {\n props.onBlurWithin(nativeEvent);\n }\n\n if (props.onFocusWithinChange) {\n props.onFocusWithinChange(false);\n }\n cleanupRef?.();\n cleanupRef = undefined;\n }\n }\n },\n { capture: true },\n );\n }\n };\n\n return {\n focusWithinProps: {\n get onFocus() {\n return props.isDisabled ? undefined : onFocus;\n },\n get onBlur() {\n return props.isDisabled ? undefined : onBlur;\n },\n },\n };\n}\n"],"mappings":"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"}
|
|
@@ -59,7 +59,6 @@ function createSyntheticBlurHandler() {
|
|
|
59
59
|
* Based on react-aria's useFocusWithin but adapted for SolidJS.
|
|
60
60
|
*/
|
|
61
61
|
function createFocusWithin(props = {}) {
|
|
62
|
-
const { isDisabled, onBlurWithin, onFocusWithin, onFocusWithinChange } = props;
|
|
63
62
|
let isFocusWithin = false;
|
|
64
63
|
const { addGlobalListener, removeAllGlobalListeners } = createGlobalListeners();
|
|
65
64
|
const syntheticBlurHandler = createSyntheticBlurHandler();
|
|
@@ -75,8 +74,8 @@ function createFocusWithin(props = {}) {
|
|
|
75
74
|
removeAllGlobalListeners();
|
|
76
75
|
cleanupRef?.();
|
|
77
76
|
cleanupRef = void 0;
|
|
78
|
-
if (onBlurWithin) onBlurWithin(e);
|
|
79
|
-
if (onFocusWithinChange) onFocusWithinChange(false);
|
|
77
|
+
if (props.onBlurWithin) props.onBlurWithin(e);
|
|
78
|
+
if (props.onFocusWithinChange) props.onFocusWithinChange(false);
|
|
80
79
|
}
|
|
81
80
|
};
|
|
82
81
|
const onFocus = (e) => {
|
|
@@ -84,8 +83,8 @@ function createFocusWithin(props = {}) {
|
|
|
84
83
|
const ownerDocument = getOwnerDocument(e.target);
|
|
85
84
|
const activeElement = ownerDocument ? getActiveElement(ownerDocument) : null;
|
|
86
85
|
if (!isFocusWithin && activeElement === getEventTarget(e)) {
|
|
87
|
-
if (onFocusWithin) onFocusWithin(e);
|
|
88
|
-
if (onFocusWithinChange) onFocusWithinChange(true);
|
|
86
|
+
if (props.onFocusWithin) props.onFocusWithin(e);
|
|
87
|
+
if (props.onFocusWithinChange) props.onFocusWithinChange(true);
|
|
89
88
|
isFocusWithin = true;
|
|
90
89
|
cleanupRef = syntheticBlurHandler(e, e.target);
|
|
91
90
|
const currentTarget = e.currentTarget;
|
|
@@ -97,8 +96,8 @@ function createFocusWithin(props = {}) {
|
|
|
97
96
|
setEventTarget(nativeEvent, currentTarget);
|
|
98
97
|
isFocusWithin = false;
|
|
99
98
|
removeAllGlobalListeners();
|
|
100
|
-
if (onBlurWithin) onBlurWithin(nativeEvent);
|
|
101
|
-
if (onFocusWithinChange) onFocusWithinChange(false);
|
|
99
|
+
if (props.onBlurWithin) props.onBlurWithin(nativeEvent);
|
|
100
|
+
if (props.onFocusWithinChange) props.onFocusWithinChange(false);
|
|
102
101
|
cleanupRef?.();
|
|
103
102
|
cleanupRef = void 0;
|
|
104
103
|
}
|
|
@@ -106,13 +105,13 @@ function createFocusWithin(props = {}) {
|
|
|
106
105
|
}, { capture: true });
|
|
107
106
|
}
|
|
108
107
|
};
|
|
109
|
-
if (isDisabled) return { focusWithinProps: {
|
|
110
|
-
onFocus: void 0,
|
|
111
|
-
onBlur: void 0
|
|
112
|
-
} };
|
|
113
108
|
return { focusWithinProps: {
|
|
114
|
-
onFocus
|
|
115
|
-
|
|
109
|
+
get onFocus() {
|
|
110
|
+
return props.isDisabled ? void 0 : onFocus;
|
|
111
|
+
},
|
|
112
|
+
get onBlur() {
|
|
113
|
+
return props.isDisabled ? void 0 : onBlur;
|
|
114
|
+
}
|
|
116
115
|
} };
|
|
117
116
|
}
|
|
118
117
|
//#endregion
|