@proyecto-viviana/solidaria-components 0.5.0 → 0.7.0-rc.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE-APACHE-2.0 +201 -0
- package/NOTICE +91 -0
- package/README.md +4 -7
- package/dist/ActionBar.d.ts +2 -10
- package/dist/ActionBar.d.ts.map +1 -1
- package/dist/ActionBar.js +95 -59
- package/dist/ActionBar.js.map +1 -1
- package/dist/ActionBar.jsx +42 -15
- package/dist/ActionBar.jsx.map +1 -1
- package/dist/ActionGroup.d.ts +1 -12
- package/dist/ActionGroup.d.ts.map +1 -1
- package/dist/ActionGroup.js +66 -44
- package/dist/ActionGroup.js.map +1 -1
- package/dist/ActionGroup.jsx +25 -10
- package/dist/ActionGroup.jsx.map +1 -1
- package/dist/Alert.d.ts +4 -1
- package/dist/Alert.d.ts.map +1 -1
- package/dist/Alert.js +25 -17
- package/dist/Alert.js.map +1 -1
- package/dist/Alert.jsx +9 -5
- package/dist/Alert.jsx.map +1 -1
- package/dist/Autocomplete.d.ts +2 -9
- package/dist/Autocomplete.d.ts.map +1 -1
- package/dist/Autocomplete.js +18 -5
- package/dist/Autocomplete.js.map +1 -1
- package/dist/Autocomplete.jsx +20 -7
- package/dist/Autocomplete.jsx.map +1 -1
- package/dist/Breadcrumbs.d.ts +2 -7
- package/dist/Breadcrumbs.d.ts.map +1 -1
- package/dist/Breadcrumbs.js +71 -51
- package/dist/Breadcrumbs.js.map +1 -1
- package/dist/Breadcrumbs.jsx +25 -12
- package/dist/Breadcrumbs.jsx.map +1 -1
- package/dist/Button.d.ts +1 -7
- package/dist/Button.d.ts.map +1 -1
- package/dist/Button.js +125 -72
- package/dist/Button.js.map +1 -1
- package/dist/Button.jsx +105 -43
- package/dist/Button.jsx.map +1 -1
- package/dist/Calendar.d.ts +1 -7
- package/dist/Calendar.d.ts.map +1 -1
- package/dist/Calendar.js +297 -221
- package/dist/Calendar.js.map +1 -1
- package/dist/Calendar.jsx +52 -32
- package/dist/Calendar.jsx.map +1 -1
- package/dist/CalendarPicker.d.ts +1 -10
- package/dist/CalendarPicker.d.ts.map +1 -1
- package/dist/CalendarPicker.js +12 -0
- package/dist/CalendarPicker.js.map +1 -1
- package/dist/CalendarPicker.jsx +12 -0
- package/dist/CalendarPicker.jsx.map +1 -1
- package/dist/Checkbox.d.ts +2 -7
- package/dist/Checkbox.d.ts.map +1 -1
- package/dist/Checkbox.js +332 -270
- package/dist/Checkbox.js.map +1 -1
- package/dist/Checkbox.jsx +70 -77
- package/dist/Checkbox.jsx.map +1 -1
- package/dist/Collection.d.ts +33 -7
- package/dist/Collection.d.ts.map +1 -1
- package/dist/Collection.js +128 -74
- package/dist/Collection.js.map +1 -1
- package/dist/Collection.jsx +46 -7
- package/dist/Collection.jsx.map +1 -1
- package/dist/Color.d.ts +15 -20
- package/dist/Color.d.ts.map +1 -1
- package/dist/Color.js +572 -334
- package/dist/Color.js.map +1 -1
- package/dist/Color.jsx +205 -85
- package/dist/Color.jsx.map +1 -1
- package/dist/ColorEditor.d.ts +3 -1
- package/dist/ColorEditor.d.ts.map +1 -1
- package/dist/ColorEditor.js +147 -124
- package/dist/ColorEditor.js.map +1 -1
- package/dist/ColorEditor.jsx +4 -1
- package/dist/ColorEditor.jsx.map +1 -1
- package/dist/ComboBox.d.ts +31 -10
- package/dist/ComboBox.d.ts.map +1 -1
- package/dist/ComboBox.js +539 -274
- package/dist/ComboBox.js.map +1 -1
- package/dist/ComboBox.jsx +213 -70
- package/dist/ComboBox.jsx.map +1 -1
- package/dist/ContextualHelpTrigger.d.ts +1 -7
- package/dist/ContextualHelpTrigger.d.ts.map +1 -1
- package/dist/ContextualHelpTrigger.js +102 -72
- package/dist/ContextualHelpTrigger.js.map +1 -1
- package/dist/ContextualHelpTrigger.jsx +36 -16
- package/dist/ContextualHelpTrigger.jsx.map +1 -1
- package/dist/DateField.d.ts +2 -7
- package/dist/DateField.d.ts.map +1 -1
- package/dist/DateField.js +0 -2
- package/dist/DateField.jsx +0 -2
- package/dist/DateField2.js +194 -179
- package/dist/DateField2.js.map +1 -1
- package/dist/DateField2.jsx +58 -55
- package/dist/DateField2.jsx.map +1 -1
- package/dist/DatePicker.d.ts +7 -7
- package/dist/DatePicker.d.ts.map +1 -1
- package/dist/DatePicker.js +2 -2
- package/dist/DatePicker.jsx +2 -2
- package/dist/DatePicker2.js +357 -435
- package/dist/DatePicker2.js.map +1 -1
- package/dist/DatePicker2.jsx +109 -178
- package/dist/DatePicker2.jsx.map +1 -1
- package/dist/DateRangePickerContext.d.ts +7 -0
- package/dist/DateRangePickerContext.d.ts.map +1 -1
- package/dist/Dialog.d.ts +4 -9
- package/dist/Dialog.d.ts.map +1 -1
- package/dist/Dialog.js +168 -101
- package/dist/Dialog.js.map +1 -1
- package/dist/Dialog.jsx +75 -27
- package/dist/Dialog.jsx.map +1 -1
- package/dist/Disclosure.d.ts +1 -9
- package/dist/Disclosure.d.ts.map +1 -1
- package/dist/Disclosure.js +121 -79
- package/dist/Disclosure.js.map +1 -1
- package/dist/Disclosure.jsx +32 -19
- package/dist/Disclosure.jsx.map +1 -1
- package/dist/DragAndDrop.d.ts +9 -6
- package/dist/DragAndDrop.d.ts.map +1 -1
- package/dist/DragAndDrop.js +37 -22
- package/dist/DragAndDrop.js.map +1 -1
- package/dist/DragAndDrop.jsx +20 -4
- package/dist/DragAndDrop.jsx.map +1 -1
- package/dist/DragPreview.d.ts +1 -1
- package/dist/DragPreview.d.ts.map +1 -1
- package/dist/DropZone.d.ts +1 -7
- package/dist/DropZone.d.ts.map +1 -1
- package/dist/DropZone.js +74 -40
- package/dist/DropZone.js.map +1 -1
- package/dist/DropZone.jsx +24 -8
- package/dist/DropZone.jsx.map +1 -1
- package/dist/ElementTag.d.ts +9 -20
- package/dist/ElementTag.d.ts.map +1 -1
- package/dist/ElementTag.js +8 -210
- package/dist/ElementTag.js.map +1 -1
- package/dist/ElementTag.jsx +8 -57
- package/dist/ElementTag.jsx.map +1 -1
- package/dist/FieldError.d.ts +8 -7
- package/dist/FieldError.d.ts.map +1 -1
- package/dist/FieldError.js +33 -13
- package/dist/FieldError.js.map +1 -1
- package/dist/FieldError.jsx +20 -5
- package/dist/FieldError.jsx.map +1 -1
- package/dist/FileTrigger.d.ts +1 -7
- package/dist/FileTrigger.d.ts.map +1 -1
- package/dist/FileTrigger.js +30 -12
- package/dist/FileTrigger.js.map +1 -1
- package/dist/FileTrigger.jsx +15 -2
- package/dist/FileTrigger.jsx.map +1 -1
- package/dist/Focusable.d.ts +2 -8
- package/dist/Focusable.d.ts.map +1 -1
- package/dist/Focusable.js +23 -6
- package/dist/Focusable.js.map +1 -1
- package/dist/Focusable.jsx +22 -5
- package/dist/Focusable.jsx.map +1 -1
- package/dist/Form.d.ts +9 -8
- package/dist/Form.d.ts.map +1 -1
- package/dist/Form.js +66 -43
- package/dist/Form.js.map +1 -1
- package/dist/Form.jsx +36 -16
- package/dist/Form.jsx.map +1 -1
- package/dist/GridList.d.ts +5 -10
- package/dist/GridList.d.ts.map +1 -1
- package/dist/GridList.js +372 -243
- package/dist/GridList.js.map +1 -1
- package/dist/GridList.jsx +177 -99
- package/dist/GridList.jsx.map +1 -1
- package/dist/HiddenDateInput.d.ts +1 -7
- package/dist/HiddenDateInput.d.ts.map +1 -1
- package/dist/Icon.d.ts +4 -1
- package/dist/Icon.d.ts.map +1 -1
- package/dist/Icon.js +41 -37
- package/dist/Icon.js.map +1 -1
- package/dist/Icon.jsx +7 -3
- package/dist/Icon.jsx.map +1 -1
- package/dist/Keyboard.d.ts +1 -7
- package/dist/Keyboard.d.ts.map +1 -1
- package/dist/Keyboard.js +24 -11
- package/dist/Keyboard.js.map +1 -1
- package/dist/Keyboard.jsx +15 -2
- package/dist/Keyboard.jsx.map +1 -1
- package/dist/Label.d.ts +20 -0
- package/dist/Label.d.ts.map +1 -0
- package/dist/Label.js +60 -0
- package/dist/Label.js.map +1 -0
- package/dist/Label.jsx +47 -0
- package/dist/Label.jsx.map +1 -0
- package/dist/Landmark.d.ts +4 -1
- package/dist/Landmark.d.ts.map +1 -1
- package/dist/Landmark.js +10 -4
- package/dist/Landmark.js.map +1 -1
- package/dist/Landmark.jsx +5 -1
- package/dist/Landmark.jsx.map +1 -1
- package/dist/Link.d.ts +2 -7
- package/dist/Link.d.ts.map +1 -1
- package/dist/Link.js +56 -36
- package/dist/Link.js.map +1 -1
- package/dist/Link.jsx +52 -10
- package/dist/Link.jsx.map +1 -1
- package/dist/ListBox.d.ts +17 -13
- package/dist/ListBox.d.ts.map +1 -1
- package/dist/ListBox.js +647 -348
- package/dist/ListBox.js.map +1 -1
- package/dist/ListBox.jsx +339 -236
- package/dist/ListBox.jsx.map +1 -1
- package/dist/ListDropTargetDelegate.d.ts +3 -0
- package/dist/ListDropTargetDelegate.d.ts.map +1 -1
- package/dist/Menu.d.ts +39 -30
- package/dist/Menu.d.ts.map +1 -1
- package/dist/Menu.js +547 -368
- package/dist/Menu.js.map +1 -1
- package/dist/Menu.jsx +328 -230
- package/dist/Menu.jsx.map +1 -1
- package/dist/Meter.d.ts +6 -13
- package/dist/Meter.d.ts.map +1 -1
- package/dist/Meter.js +55 -18
- package/dist/Meter.js.map +1 -1
- package/dist/Meter.jsx +33 -8
- package/dist/Meter.jsx.map +1 -1
- package/dist/Modal.d.ts +1 -7
- package/dist/Modal.d.ts.map +1 -1
- package/dist/Modal.js +104 -56
- package/dist/Modal.js.map +1 -1
- package/dist/Modal.jsx +68 -38
- package/dist/Modal.jsx.map +1 -1
- package/dist/NumberField.d.ts +4 -7
- package/dist/NumberField.d.ts.map +1 -1
- package/dist/NumberField.js +243 -124
- package/dist/NumberField.js.map +1 -1
- package/dist/NumberField.jsx +115 -26
- package/dist/NumberField.jsx.map +1 -1
- package/dist/Popover.d.ts +15 -7
- package/dist/Popover.d.ts.map +1 -1
- package/dist/Popover.js +370 -181
- package/dist/Popover.js.map +1 -1
- package/dist/Popover.jsx +215 -82
- package/dist/Popover.jsx.map +1 -1
- package/dist/Pressable.d.ts +2 -8
- package/dist/Pressable.d.ts.map +1 -1
- package/dist/Pressable.js +23 -6
- package/dist/Pressable.js.map +1 -1
- package/dist/Pressable.jsx +22 -5
- package/dist/Pressable.jsx.map +1 -1
- package/dist/PreviewTrigger.d.ts +24 -0
- package/dist/PreviewTrigger.d.ts.map +1 -0
- package/dist/PreviewTrigger.js +128 -0
- package/dist/PreviewTrigger.js.map +1 -0
- package/dist/PreviewTrigger.jsx +117 -0
- package/dist/PreviewTrigger.jsx.map +1 -0
- package/dist/ProgressBar.d.ts +1 -7
- package/dist/ProgressBar.d.ts.map +1 -1
- package/dist/ProgressBar.js +34 -14
- package/dist/ProgressBar.js.map +1 -1
- package/dist/ProgressBar.jsx +17 -3
- package/dist/ProgressBar.jsx.map +1 -1
- package/dist/RadioGroup.d.ts +2 -7
- package/dist/RadioGroup.d.ts.map +1 -1
- package/dist/RadioGroup.js +388 -269
- package/dist/RadioGroup.js.map +1 -1
- package/dist/RadioGroup.jsx +110 -99
- package/dist/RadioGroup.jsx.map +1 -1
- package/dist/RangeCalendar.d.ts +3 -7
- package/dist/RangeCalendar.d.ts.map +1 -1
- package/dist/RangeCalendar.js +271 -202
- package/dist/RangeCalendar.js.map +1 -1
- package/dist/RangeCalendar.jsx +56 -37
- package/dist/RangeCalendar.jsx.map +1 -1
- package/dist/RouterProvider.d.ts +3 -9
- package/dist/RouterProvider.d.ts.map +1 -1
- package/dist/RouterProvider.js +15 -14
- package/dist/RouterProvider.js.map +1 -1
- package/dist/RouterProvider.jsx +14 -13
- package/dist/RouterProvider.jsx.map +1 -1
- package/dist/SearchField.d.ts +4 -7
- package/dist/SearchField.d.ts.map +1 -1
- package/dist/SearchField.js +191 -164
- package/dist/SearchField.js.map +1 -1
- package/dist/SearchField.jsx +69 -62
- package/dist/SearchField.jsx.map +1 -1
- package/dist/Select.d.ts +5 -10
- package/dist/Select.d.ts.map +1 -1
- package/dist/Select.js +565 -359
- package/dist/Select.js.map +1 -1
- package/dist/Select.jsx +281 -161
- package/dist/Select.jsx.map +1 -1
- package/dist/SelectionIndicator.d.ts +1 -4
- package/dist/SelectionIndicator.d.ts.map +1 -1
- package/dist/SelectionIndicator.js +29 -13
- package/dist/SelectionIndicator.js.map +1 -1
- package/dist/SelectionIndicator.jsx +18 -4
- package/dist/SelectionIndicator.jsx.map +1 -1
- package/dist/Separator.d.ts +1 -7
- package/dist/Separator.d.ts.map +1 -1
- package/dist/Separator.js +22 -6
- package/dist/Separator.js.map +1 -1
- package/dist/Separator.jsx +16 -3
- package/dist/Separator.jsx.map +1 -1
- package/dist/SharedElementTransition.d.ts +1 -10
- package/dist/SharedElementTransition.d.ts.map +1 -1
- package/dist/SharedElementTransition.js +68 -40
- package/dist/SharedElementTransition.js.map +1 -1
- package/dist/SharedElementTransition.jsx +49 -25
- package/dist/SharedElementTransition.jsx.map +1 -1
- package/dist/Slider.d.ts +2 -8
- package/dist/Slider.d.ts.map +1 -1
- package/dist/Slider.js +155 -97
- package/dist/Slider.js.map +1 -1
- package/dist/Slider.jsx +25 -12
- package/dist/Slider.jsx.map +1 -1
- package/dist/StepList.d.ts +1 -7
- package/dist/StepList.d.ts.map +1 -1
- package/dist/StepList.js +112 -68
- package/dist/StepList.js.map +1 -1
- package/dist/StepList.jsx +58 -20
- package/dist/StepList.jsx.map +1 -1
- package/dist/Switch.d.ts +2 -9
- package/dist/Switch.d.ts.map +1 -1
- package/dist/Switch.js +164 -114
- package/dist/Switch.js.map +1 -1
- package/dist/Switch.jsx +26 -13
- package/dist/Switch.jsx.map +1 -1
- package/dist/Table.d.ts +2 -1
- package/dist/Table.d.ts.map +1 -1
- package/dist/Table.js +689 -592
- package/dist/Table.js.map +1 -1
- package/dist/Table.jsx +317 -237
- package/dist/Table.jsx.map +1 -1
- package/dist/Tabs.d.ts +2 -7
- package/dist/Tabs.d.ts.map +1 -1
- package/dist/Tabs.js +278 -293
- package/dist/Tabs.js.map +1 -1
- package/dist/Tabs.jsx +68 -66
- package/dist/Tabs.jsx.map +1 -1
- package/dist/TagGroup.d.ts +4 -11
- package/dist/TagGroup.d.ts.map +1 -1
- package/dist/TagGroup.js +153 -115
- package/dist/TagGroup.js.map +1 -1
- package/dist/TagGroup.jsx +37 -24
- package/dist/TagGroup.jsx.map +1 -1
- package/dist/Text.d.ts +3 -3
- package/dist/Text.d.ts.map +1 -1
- package/dist/Text.js +24 -7
- package/dist/Text.js.map +1 -1
- package/dist/Text.jsx +17 -5
- package/dist/Text.jsx.map +1 -1
- package/dist/TextField.d.ts +3 -16
- package/dist/TextField.d.ts.map +1 -1
- package/dist/TextField.js +104 -129
- package/dist/TextField.js.map +1 -1
- package/dist/TextField.jsx +76 -102
- package/dist/TextField.jsx.map +1 -1
- package/dist/TimeField.d.ts +2 -15
- package/dist/TimeField.d.ts.map +1 -1
- package/dist/TimeField.js +86 -102
- package/dist/TimeField.js.map +1 -1
- package/dist/TimeField.jsx +32 -49
- package/dist/TimeField.jsx.map +1 -1
- package/dist/Toast.d.ts +10 -13
- package/dist/Toast.d.ts.map +1 -1
- package/dist/Toast.js +209 -108
- package/dist/Toast.js.map +1 -1
- package/dist/Toast.jsx +127 -22
- package/dist/Toast.jsx.map +1 -1
- package/dist/ToggleButton.d.ts +1 -7
- package/dist/ToggleButton.d.ts.map +1 -1
- package/dist/ToggleButton.js +57 -35
- package/dist/ToggleButton.js.map +1 -1
- package/dist/ToggleButton.jsx +26 -12
- package/dist/ToggleButton.jsx.map +1 -1
- package/dist/ToggleButtonGroup.d.ts +1 -7
- package/dist/ToggleButtonGroup.d.ts.map +1 -1
- package/dist/ToggleButtonGroup.js +59 -44
- package/dist/ToggleButtonGroup.js.map +1 -1
- package/dist/ToggleButtonGroup.jsx +25 -12
- package/dist/ToggleButtonGroup.jsx.map +1 -1
- package/dist/TokenField.d.ts +52 -0
- package/dist/TokenField.d.ts.map +1 -0
- package/dist/TokenField.js +301 -0
- package/dist/TokenField.js.map +1 -0
- package/dist/TokenField.jsx +197 -0
- package/dist/TokenField.jsx.map +1 -0
- package/dist/Toolbar.d.ts +2 -7
- package/dist/Toolbar.d.ts.map +1 -1
- package/dist/Toolbar.js +35 -16
- package/dist/Toolbar.js.map +1 -1
- package/dist/Toolbar.jsx +15 -2
- package/dist/Toolbar.jsx.map +1 -1
- package/dist/Tooltip.d.ts +2 -7
- package/dist/Tooltip.d.ts.map +1 -1
- package/dist/Tooltip.js +105 -68
- package/dist/Tooltip.js.map +1 -1
- package/dist/Tooltip.jsx +60 -36
- package/dist/Tooltip.jsx.map +1 -1
- package/dist/Tree.d.ts +8 -11
- package/dist/Tree.d.ts.map +1 -1
- package/dist/Tree.js +486 -339
- package/dist/Tree.js.map +1 -1
- package/dist/Tree.jsx +155 -107
- package/dist/Tree.jsx.map +1 -1
- package/dist/Virtualizer.d.ts +39 -9
- package/dist/Virtualizer.d.ts.map +1 -1
- package/dist/Virtualizer.js +2 -2
- package/dist/Virtualizer.jsx +2 -2
- package/dist/Virtualizer2.js +491 -136
- package/dist/Virtualizer2.js.map +1 -1
- package/dist/Virtualizer2.jsx +455 -122
- package/dist/Virtualizer2.jsx.map +1 -1
- package/dist/VirtualizerLayouts.d.ts +55 -2
- package/dist/VirtualizerLayouts.d.ts.map +1 -1
- package/dist/VisuallyHidden.d.ts +4 -3
- package/dist/VisuallyHidden.d.ts.map +1 -1
- package/dist/VisuallyHidden.js +18 -11
- package/dist/VisuallyHidden.js.map +1 -1
- package/dist/VisuallyHidden.jsx +15 -9
- package/dist/VisuallyHidden.jsx.map +1 -1
- package/dist/contexts.d.ts +25 -0
- package/dist/contexts.d.ts.map +1 -1
- package/dist/contexts.js +3 -0
- package/dist/contexts.js.map +1 -1
- package/dist/contexts.jsx +3 -0
- package/dist/contexts.jsx.map +1 -1
- package/dist/index.d.ts +11 -9
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +14 -11
- package/dist/index.jsx +14 -11
- package/dist/intl/index.d.ts +16 -0
- package/dist/intl/index.d.ts.map +1 -0
- package/dist/intl.js +212 -0
- package/dist/intl.js.map +1 -0
- package/dist/intl.jsx +212 -0
- package/dist/intl.jsx.map +1 -0
- package/dist/useDragAndDrop.d.ts +4 -2
- package/dist/useDragAndDrop.d.ts.map +1 -1
- package/dist/useDragAndDrop2.js +39 -21
- package/dist/useDragAndDrop2.js.map +1 -1
- package/dist/useDragAndDrop2.jsx +39 -21
- package/dist/useDragAndDrop2.jsx.map +1 -1
- package/dist/utils.d.ts +28 -9
- package/dist/utils.d.ts.map +1 -1
- package/dist/utils.js +96 -24
- package/dist/utils.js.map +1 -1
- package/dist/utils.jsx +81 -24
- package/dist/utils.jsx.map +1 -1
- package/dist/virtualizer/Layout.d.ts +9 -0
- package/dist/virtualizer/Layout.d.ts.map +1 -1
- package/dist/virtualizer/Layout.js +23 -2
- package/dist/virtualizer/Layout.js.map +1 -1
- package/dist/virtualizer/Layout.jsx +23 -2
- package/dist/virtualizer/Layout.jsx.map +1 -1
- package/package.json +29 -10
- package/src/ActionBar.tsx +50 -24
- package/src/ActionGroup.tsx +31 -19
- package/src/Alert.tsx +10 -4
- package/src/Autocomplete.tsx +24 -15
- package/src/Breadcrumbs.tsx +32 -16
- package/src/Button.tsx +182 -67
- package/src/Calendar.tsx +65 -47
- package/src/CalendarPicker.tsx +16 -1
- package/src/Checkbox.tsx +84 -116
- package/src/Collection.tsx +84 -3
- package/src/Color.tsx +282 -104
- package/src/ColorEditor.tsx +5 -1
- package/src/ComboBox.tsx +384 -109
- package/src/ContextualHelpTrigger.tsx +47 -41
- package/src/DateField.tsx +74 -106
- package/src/DatePicker.tsx +156 -352
- package/src/DateRangePickerContext.tsx +8 -0
- package/src/Dialog.tsx +105 -38
- package/src/Disclosure.tsx +29 -19
- package/src/DragAndDrop.tsx +43 -8
- package/src/DragPreview.tsx +20 -1
- package/src/DropZone.tsx +32 -18
- package/src/ElementTag.tsx +14 -104
- package/src/FieldError.tsx +39 -7
- package/src/FileTrigger.tsx +18 -3
- package/src/Focusable.tsx +27 -6
- package/src/Form.tsx +57 -11
- package/src/GridList.tsx +233 -141
- package/src/HiddenDateInput.tsx +19 -3
- package/src/Icon.tsx +8 -2
- package/src/Keyboard.tsx +18 -2
- package/src/Label.tsx +77 -0
- package/src/Landmark.tsx +6 -1
- package/src/Link.tsx +65 -19
- package/src/ListBox.tsx +645 -468
- package/src/ListDropTargetDelegate.ts +4 -0
- package/src/Menu.tsx +512 -349
- package/src/Meter.tsx +42 -8
- package/src/Modal.tsx +85 -42
- package/src/NumberField.tsx +161 -48
- package/src/Popover.tsx +424 -148
- package/src/Pressable.tsx +27 -6
- package/src/PreviewTrigger.tsx +171 -0
- package/src/ProgressBar.tsx +25 -3
- package/src/RadioGroup.tsx +230 -161
- package/src/RangeCalendar.tsx +75 -63
- package/src/RouterProvider.tsx +24 -14
- package/src/SearchField.tsx +118 -121
- package/src/Select.tsx +454 -274
- package/src/SelectionIndicator.tsx +21 -3
- package/src/Separator.tsx +17 -1
- package/src/SharedElementTransition.tsx +115 -97
- package/src/Slider.tsx +35 -17
- package/src/StepList.tsx +71 -32
- package/src/Switch.tsx +45 -29
- package/src/Table.tsx +446 -380
- package/src/Tabs.tsx +132 -155
- package/src/TagGroup.tsx +53 -40
- package/src/Text.tsx +23 -6
- package/src/TextField.tsx +118 -159
- package/src/TimeField.tsx +34 -95
- package/src/Toast.tsx +141 -67
- package/src/ToggleButton.tsx +33 -15
- package/src/ToggleButtonGroup.tsx +27 -9
- package/src/TokenField.tsx +379 -0
- package/src/Toolbar.tsx +19 -9
- package/src/Tooltip.tsx +126 -84
- package/src/Tree.tsx +233 -173
- package/src/Virtualizer.tsx +400 -138
- package/src/VirtualizerLayouts.ts +211 -26
- package/src/VisuallyHidden.tsx +22 -8
- package/src/contexts.ts +13 -0
- package/src/index.ts +32 -11
- package/src/intl/ar-AE.json +6 -0
- package/src/intl/bg-BG.json +6 -0
- package/src/intl/cs-CZ.json +6 -0
- package/src/intl/da-DK.json +6 -0
- package/src/intl/de-DE.json +6 -0
- package/src/intl/el-GR.json +6 -0
- package/src/intl/en-US.json +6 -0
- package/src/intl/es-ES.json +6 -0
- package/src/intl/et-EE.json +6 -0
- package/src/intl/fi-FI.json +6 -0
- package/src/intl/fr-FR.json +6 -0
- package/src/intl/he-IL.json +6 -0
- package/src/intl/hr-HR.json +6 -0
- package/src/intl/hu-HU.json +6 -0
- package/src/intl/index.ts +125 -0
- package/src/intl/it-IT.json +6 -0
- package/src/intl/ja-JP.json +6 -0
- package/src/intl/ko-KR.json +6 -0
- package/src/intl/lt-LT.json +6 -0
- package/src/intl/lv-LV.json +6 -0
- package/src/intl/nb-NO.json +6 -0
- package/src/intl/nl-NL.json +6 -0
- package/src/intl/pl-PL.json +6 -0
- package/src/intl/pt-BR.json +6 -0
- package/src/intl/pt-PT.json +6 -0
- package/src/intl/ro-RO.json +6 -0
- package/src/intl/ru-RU.json +6 -0
- package/src/intl/sk-SK.json +6 -0
- package/src/intl/sl-SI.json +6 -0
- package/src/intl/sr-SP.json +6 -0
- package/src/intl/sv-SE.json +6 -0
- package/src/intl/tr-TR.json +6 -0
- package/src/intl/uk-UA.json +6 -0
- package/src/intl/zh-CN.json +6 -0
- package/src/intl/zh-TW.json +6 -0
- package/src/useDragAndDrop.ts +30 -32
- package/src/utils.tsx +124 -68
- package/src/virtualizer/Layout.ts +29 -0
package/src/Select.tsx
CHANGED
|
@@ -1,3 +1,17 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Copyright 2022 Adobe. All rights reserved.
|
|
3
|
+
* This file is licensed to you under the Apache License, Version 2.0 (the "License");
|
|
4
|
+
* you may not use this file except in compliance with the License. You may obtain a copy
|
|
5
|
+
* of the License at http://www.apache.org/licenses/LICENSE-2.0
|
|
6
|
+
*
|
|
7
|
+
* Unless required by applicable law or agreed to in writing, software distributed under
|
|
8
|
+
* the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
|
|
9
|
+
* OF ANY KIND, either express or implied. See the License for the specific language
|
|
10
|
+
* governing permissions and limitations under the License.
|
|
11
|
+
*/
|
|
12
|
+
|
|
13
|
+
// Ported to SolidJS for Proyecto Viviana; based on packages/react-aria-components/src/Select.tsx
|
|
14
|
+
|
|
1
15
|
/**
|
|
2
16
|
* Select component for solidaria-components
|
|
3
17
|
*
|
|
@@ -6,19 +20,19 @@
|
|
|
6
20
|
*/
|
|
7
21
|
|
|
8
22
|
import {
|
|
9
|
-
type JSX,
|
|
10
|
-
type Accessor,
|
|
11
23
|
createContext,
|
|
12
24
|
createEffect,
|
|
13
25
|
createMemo,
|
|
26
|
+
createRenderEffect,
|
|
14
27
|
createSignal,
|
|
15
|
-
createUniqueId,
|
|
16
|
-
splitProps,
|
|
17
28
|
useContext,
|
|
18
29
|
For,
|
|
19
30
|
Show,
|
|
20
31
|
untrack,
|
|
32
|
+
createTrackedEffect,
|
|
21
33
|
} from "solid-js";
|
|
34
|
+
import type { Accessor, Context } from "solid-js";
|
|
35
|
+
import type { JSX } from "@solidjs/web";
|
|
22
36
|
import {
|
|
23
37
|
createSelect,
|
|
24
38
|
createHiddenSelect,
|
|
@@ -26,12 +40,16 @@ import {
|
|
|
26
40
|
createOption,
|
|
27
41
|
createHover,
|
|
28
42
|
createInteractOutside,
|
|
43
|
+
createFocusRing,
|
|
29
44
|
FocusScope,
|
|
30
45
|
focusSafely,
|
|
46
|
+
getInteractionModality,
|
|
31
47
|
mergeProps,
|
|
32
48
|
type AriaSelectProps,
|
|
33
49
|
type AriaListBoxProps,
|
|
34
50
|
type AriaOptionProps,
|
|
51
|
+
createStringFormatter,
|
|
52
|
+
createListFormatter,
|
|
35
53
|
} from "@proyecto-viviana/solidaria";
|
|
36
54
|
import {
|
|
37
55
|
createSelectState,
|
|
@@ -48,14 +66,26 @@ import {
|
|
|
48
66
|
type ClassNameOrFunction,
|
|
49
67
|
type StyleOrFunction,
|
|
50
68
|
type SlotProps,
|
|
69
|
+
DEFAULT_SLOT,
|
|
70
|
+
OptionContent,
|
|
71
|
+
Provider,
|
|
51
72
|
useRenderProps,
|
|
52
73
|
filterDOMProps,
|
|
74
|
+
dataAttr,
|
|
75
|
+
ariaTrueFalse,
|
|
76
|
+
attrTrue,
|
|
77
|
+
coerceDomRecord,
|
|
53
78
|
} from "./utils";
|
|
54
79
|
import {
|
|
55
80
|
SelectionIndicatorContext,
|
|
56
81
|
type SelectionIndicatorContextValue,
|
|
57
82
|
} from "./SelectionIndicator";
|
|
58
83
|
import { ListBoxLoadMoreItem } from "./ListBox";
|
|
84
|
+
import { VirtualizerItem } from "./Virtualizer";
|
|
85
|
+
import { TextContext } from "./Text";
|
|
86
|
+
import { useCollectionRenderer, useCollectionRoot } from "./Collection";
|
|
87
|
+
import { racIntlStrings } from "./intl";
|
|
88
|
+
import { splitProps } from "@proyecto-viviana/solidaria/utils";
|
|
59
89
|
|
|
60
90
|
type RefLike<T> = ((el: T) => void) | { current?: T | null } | undefined;
|
|
61
91
|
|
|
@@ -68,7 +98,7 @@ function assignRef<T>(ref: RefLike<T>, el: T): void {
|
|
|
68
98
|
}
|
|
69
99
|
}
|
|
70
100
|
|
|
71
|
-
function getNativeSelectValidation(select: HTMLSelectElement): ValidationResult {
|
|
101
|
+
function getNativeSelectValidation(select: HTMLSelectElement | HTMLInputElement): ValidationResult {
|
|
72
102
|
return {
|
|
73
103
|
isInvalid: !select.validity.valid,
|
|
74
104
|
validationDetails: {
|
|
@@ -288,6 +318,11 @@ export const SelectContext = createContext<SelectContextValue<unknown> | null>(n
|
|
|
288
318
|
export const SelectStateContext = createContext<SelectState<unknown> | null>(null);
|
|
289
319
|
export const SelectValueContext = SelectContext;
|
|
290
320
|
|
|
321
|
+
/** True when this SelectListBox is the overlay list (Picker / Popover). */
|
|
322
|
+
const SelectListBoxInPopoverContext = createContext(false);
|
|
323
|
+
|
|
324
|
+
function noopOptionFocus() {}
|
|
325
|
+
|
|
291
326
|
const selectRootLabelProps = new Set([
|
|
292
327
|
"aria-label",
|
|
293
328
|
"aria-labelledby",
|
|
@@ -300,9 +335,9 @@ const selectRootLabelProps = new Set([
|
|
|
300
335
|
*/
|
|
301
336
|
export function Select<T>(props: SelectProps<T>): JSX.Element {
|
|
302
337
|
const parentContext = useContext(SelectContext) as SelectContextValue<T> | null;
|
|
303
|
-
const contextSlotProps = parentContext?.slots?.[
|
|
304
|
-
|
|
305
|
-
|
|
338
|
+
const contextSlotProps = parentContext?.slots?.[
|
|
339
|
+
typeof props.slot === "string" ? props.slot : "default"
|
|
340
|
+
] as Partial<SelectProps<T>> | undefined;
|
|
306
341
|
const mergedSelectProps = (
|
|
307
342
|
contextSlotProps ? mergeProps(contextSlotProps, props) : props
|
|
308
343
|
) as SelectProps<T>;
|
|
@@ -331,7 +366,6 @@ export function Select<T>(props: SelectProps<T>): JSX.Element {
|
|
|
331
366
|
let rootRef: HTMLDivElement | undefined;
|
|
332
367
|
const [selectValidation, setSelectValidation] =
|
|
333
368
|
createSignal<ValidationResult>(DEFAULT_VALIDATION_RESULT);
|
|
334
|
-
const errorMessageId = createUniqueId();
|
|
335
369
|
|
|
336
370
|
const resolveDisabled = (): boolean => {
|
|
337
371
|
const disabled = ariaProps.isDisabled;
|
|
@@ -393,6 +427,21 @@ export function Select<T>(props: SelectProps<T>): JSX.Element {
|
|
|
393
427
|
get isRequired() {
|
|
394
428
|
return ariaProps.isRequired;
|
|
395
429
|
},
|
|
430
|
+
get isInvalid() {
|
|
431
|
+
return ariaProps.isInvalid;
|
|
432
|
+
},
|
|
433
|
+
get validationState() {
|
|
434
|
+
return ariaProps.validationState;
|
|
435
|
+
},
|
|
436
|
+
get validate() {
|
|
437
|
+
return ariaProps.validate;
|
|
438
|
+
},
|
|
439
|
+
get name() {
|
|
440
|
+
return stateProps.name;
|
|
441
|
+
},
|
|
442
|
+
get validationBehavior() {
|
|
443
|
+
return ariaProps.validationBehavior;
|
|
444
|
+
},
|
|
396
445
|
});
|
|
397
446
|
|
|
398
447
|
const selectAriaProps = createMemo(() => {
|
|
@@ -405,16 +454,28 @@ export function Select<T>(props: SelectProps<T>): JSX.Element {
|
|
|
405
454
|
return clean as typeof ariaProps;
|
|
406
455
|
});
|
|
407
456
|
|
|
408
|
-
const
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
|
|
457
|
+
const isInvalid = createMemo(
|
|
458
|
+
() => state.displayValidation().isInvalid || selectValidation().isInvalid,
|
|
459
|
+
);
|
|
460
|
+
const composedValidation = createMemo<ValidationResult>(() => {
|
|
461
|
+
const fromState = state.displayValidation();
|
|
462
|
+
if (fromState.isInvalid) return fromState;
|
|
463
|
+
return selectValidation();
|
|
464
|
+
});
|
|
465
|
+
|
|
466
|
+
// Keep the hook result intact. Its DOM prop surfaces are getters; destructuring
|
|
467
|
+
// them freezes the initial closed-state attributes and event composition.
|
|
468
|
+
// RAC `useSelect` feeds `state.displayValidation.isInvalid` into `useField`;
|
|
469
|
+
// pass the composed invalid flag so `createSlotId` re-probes when native
|
|
470
|
+
// validation mounts the error slot.
|
|
471
|
+
const selectHook = createSelect<T>(
|
|
472
|
+
() => ({
|
|
473
|
+
...selectAriaProps(),
|
|
474
|
+
isInvalid: isInvalid(),
|
|
475
|
+
}),
|
|
476
|
+
state,
|
|
477
|
+
);
|
|
478
|
+
const { isFocused, isFocusVisible, isOpen, isPressed } = selectHook;
|
|
418
479
|
|
|
419
480
|
const { isHovered, hoverProps } = createHover({
|
|
420
481
|
get isDisabled() {
|
|
@@ -422,10 +483,17 @@ export function Select<T>(props: SelectProps<T>): JSX.Element {
|
|
|
422
483
|
},
|
|
423
484
|
});
|
|
424
485
|
|
|
486
|
+
// RAC SelectInner: useFocusRing({within: true}) on the host (Select.tsx:187).
|
|
487
|
+
// data-focused stamps state.isFocused; data-focus-visible comes from this ring.
|
|
488
|
+
// SelectContext / SelectTrigger keep createSelect's trigger-ring accessors.
|
|
489
|
+
const { isFocusVisible: isFocusVisibleWithin, focusProps } = createFocusRing({
|
|
490
|
+
within: true,
|
|
491
|
+
});
|
|
492
|
+
|
|
425
493
|
const renderValues = createMemo<SelectRenderProps>(() => ({
|
|
426
494
|
isOpen: isOpen(),
|
|
427
495
|
isFocused: isFocused(),
|
|
428
|
-
isFocusVisible:
|
|
496
|
+
isFocusVisible: isFocusVisibleWithin(),
|
|
429
497
|
isDisabled: resolveDisabled(),
|
|
430
498
|
isRequired: !!ariaProps.isRequired,
|
|
431
499
|
isSelected:
|
|
@@ -441,7 +509,7 @@ export function Select<T>(props: SelectProps<T>): JSX.Element {
|
|
|
441
509
|
return isFocused();
|
|
442
510
|
},
|
|
443
511
|
get isFocusVisible() {
|
|
444
|
-
return
|
|
512
|
+
return isFocusVisibleWithin();
|
|
445
513
|
},
|
|
446
514
|
get isDisabled() {
|
|
447
515
|
return resolveDisabled();
|
|
@@ -475,48 +543,32 @@ export function Select<T>(props: SelectProps<T>): JSX.Element {
|
|
|
475
543
|
const { ref: _ref, ...rest } = hoverProps as Record<string, unknown>;
|
|
476
544
|
return rest;
|
|
477
545
|
};
|
|
546
|
+
const cleanFocusProps = () => {
|
|
547
|
+
const { ref: _ref, onFocus, onBlur, ...rest } = focusProps as Record<string, unknown>;
|
|
548
|
+
// Solid's onFocus/onBlur do not bubble. RAC's container ring listens for
|
|
549
|
+
// descendant focus via React's bubbling onFocus (Select.tsx:278-287).
|
|
550
|
+
return {
|
|
551
|
+
...rest,
|
|
552
|
+
onFocusIn: onFocus,
|
|
553
|
+
onFocusOut: onBlur,
|
|
554
|
+
};
|
|
555
|
+
};
|
|
478
556
|
const cleanLabelProps = () => {
|
|
479
|
-
const { ref: _ref, ...rest } = labelProps as Record<string, unknown>;
|
|
557
|
+
const { ref: _ref, ...rest } = selectHook.labelProps as Record<string, unknown>;
|
|
480
558
|
return rest;
|
|
481
559
|
};
|
|
482
560
|
const setRootRef = (el: HTMLDivElement) => {
|
|
483
561
|
rootRef = el;
|
|
484
562
|
assignRef(local.ref, el);
|
|
485
563
|
};
|
|
486
|
-
const validation = createMemo<ValidationResult>(() => {
|
|
487
|
-
const current = selectValidation();
|
|
488
|
-
if (current.isInvalid || !ariaProps.isInvalid) {
|
|
489
|
-
return current;
|
|
490
|
-
}
|
|
491
|
-
|
|
492
|
-
return {
|
|
493
|
-
...DEFAULT_VALIDATION_RESULT,
|
|
494
|
-
isInvalid: true,
|
|
495
|
-
};
|
|
496
|
-
});
|
|
497
|
-
const isInvalid = createMemo(() => validation().isInvalid);
|
|
498
|
-
const triggerDescribedBy = () => {
|
|
499
|
-
const ids = [
|
|
500
|
-
(triggerProps as { "aria-describedby"?: string })["aria-describedby"],
|
|
501
|
-
isInvalid() ? errorMessageId : undefined,
|
|
502
|
-
]
|
|
503
|
-
.filter(Boolean)
|
|
504
|
-
.join(" ")
|
|
505
|
-
.split(" ")
|
|
506
|
-
.filter(Boolean);
|
|
507
|
-
return ids.length ? Array.from(new Set(ids)).join(" ") : undefined;
|
|
508
|
-
};
|
|
509
564
|
const triggerPropsWithValidation = () =>
|
|
510
|
-
|
|
511
|
-
...triggerProps,
|
|
512
|
-
"aria-describedby": triggerDescribedBy(),
|
|
513
|
-
}) as JSX.HTMLAttributes<HTMLElement>;
|
|
565
|
+
selectHook.triggerProps as JSX.HTMLAttributes<HTMLElement>;
|
|
514
566
|
const fieldErrorContext: FieldErrorContextValue = {
|
|
515
567
|
get validation() {
|
|
516
|
-
return
|
|
568
|
+
return composedValidation();
|
|
517
569
|
},
|
|
518
570
|
get errorMessageProps() {
|
|
519
|
-
return
|
|
571
|
+
return selectHook.errorMessageProps;
|
|
520
572
|
},
|
|
521
573
|
};
|
|
522
574
|
const focusTrigger = () => {
|
|
@@ -527,7 +579,7 @@ export function Select<T>(props: SelectProps<T>): JSX.Element {
|
|
|
527
579
|
? state.selectedKeys() === "all" || (state.selectedKeys() as Set<Key>).size > 0
|
|
528
580
|
: state.selectedKey() != null;
|
|
529
581
|
const hasNativeValidation = () => (ariaProps.validationBehavior ?? "native") === "native";
|
|
530
|
-
const getSelectValidation = (select: HTMLSelectElement): ValidationResult => {
|
|
582
|
+
const getSelectValidation = (select: HTMLSelectElement | HTMLInputElement): ValidationResult => {
|
|
531
583
|
if (ariaProps.isRequired && !hasSelection()) {
|
|
532
584
|
return {
|
|
533
585
|
isInvalid: true,
|
|
@@ -550,17 +602,29 @@ export function Select<T>(props: SelectProps<T>): JSX.Element {
|
|
|
550
602
|
return getNativeSelectValidation(select);
|
|
551
603
|
};
|
|
552
604
|
|
|
553
|
-
|
|
605
|
+
let triggerRef: HTMLElement | null = null;
|
|
606
|
+
const setTriggerRef = (el: HTMLElement | null) => {
|
|
607
|
+
triggerRef = el;
|
|
608
|
+
};
|
|
609
|
+
|
|
610
|
+
const {
|
|
611
|
+
containerProps,
|
|
612
|
+
selectProps: hiddenSelectProps,
|
|
613
|
+
inputProps: hiddenInputProps,
|
|
614
|
+
} = createHiddenSelect({
|
|
554
615
|
state,
|
|
555
616
|
name: stateProps.name,
|
|
556
617
|
form: ariaProps.form,
|
|
557
618
|
isRequired: ariaProps.isRequired,
|
|
558
619
|
validationBehavior: ariaProps.validationBehavior ?? "native",
|
|
620
|
+
triggerRef: () => triggerRef,
|
|
559
621
|
get isDisabled() {
|
|
560
622
|
return resolveDisabled();
|
|
561
623
|
},
|
|
562
624
|
});
|
|
563
|
-
const handleHiddenSelectInvalid: JSX.EventHandler<HTMLSelectElement, Event> = (
|
|
625
|
+
const handleHiddenSelectInvalid: JSX.EventHandler<HTMLSelectElement | HTMLInputElement, Event> = (
|
|
626
|
+
event,
|
|
627
|
+
) => {
|
|
564
628
|
setSelectValidation(getSelectValidation(event.currentTarget));
|
|
565
629
|
focusTrigger();
|
|
566
630
|
event.preventDefault();
|
|
@@ -575,15 +639,40 @@ export function Select<T>(props: SelectProps<T>): JSX.Element {
|
|
|
575
639
|
: getSelectValidation(event.currentTarget),
|
|
576
640
|
);
|
|
577
641
|
};
|
|
578
|
-
|
|
642
|
+
// RAC HiddenSelect binds `value` on the <select> (HiddenSelect.tsx:144), not
|
|
643
|
+
// `selected` on each <option>. Spreading selectProps once snapshots the key.
|
|
644
|
+
const hiddenSelectItemNodes = () =>
|
|
645
|
+
Array.from(state.collection()).filter((item) => item.type === "item");
|
|
646
|
+
const nativeSelectValue = (): string | string[] => {
|
|
647
|
+
if (state.selectionMode() === "multiple") {
|
|
648
|
+
const selectedKeys = state.selectedKeys();
|
|
649
|
+
if (selectedKeys === "all") {
|
|
650
|
+
return hiddenSelectItemNodes().map((item) => String(item.key));
|
|
651
|
+
}
|
|
652
|
+
return Array.from(selectedKeys as Set<Key>).map(String);
|
|
653
|
+
}
|
|
654
|
+
const key = state.selectedKey();
|
|
655
|
+
return key != null ? String(key) : "";
|
|
656
|
+
};
|
|
657
|
+
const hiddenSelectFallbackValues = (): Array<Key | null> => {
|
|
658
|
+
if (state.selectionMode() === "multiple") {
|
|
659
|
+
const keys = state.selectedKeys();
|
|
660
|
+
if (keys === "all") {
|
|
661
|
+
return hiddenSelectItemNodes().map((item) => item.key);
|
|
662
|
+
}
|
|
663
|
+
const listed = Array.from(keys as Set<Key>);
|
|
664
|
+
return listed.length === 0 ? [null] : listed;
|
|
665
|
+
}
|
|
666
|
+
return [state.selectedKey()];
|
|
667
|
+
};
|
|
668
|
+
createTrackedEffect(() => {
|
|
579
669
|
if (hasSelection() && selectValidation().isInvalid) {
|
|
580
670
|
setSelectValidation(DEFAULT_VALIDATION_RESULT);
|
|
581
671
|
}
|
|
672
|
+
if (hasSelection() && !ariaProps.isInvalid && state.displayValidation().isInvalid) {
|
|
673
|
+
state.resetValidation();
|
|
674
|
+
}
|
|
582
675
|
});
|
|
583
|
-
let triggerRef: HTMLElement | null = null;
|
|
584
|
-
const setTriggerRef = (el: HTMLElement | null) => {
|
|
585
|
-
triggerRef = el;
|
|
586
|
-
};
|
|
587
676
|
|
|
588
677
|
const RootChildren = () => {
|
|
589
678
|
const selectChildren = untrack(() =>
|
|
@@ -604,91 +693,75 @@ export function Select<T>(props: SelectProps<T>): JSX.Element {
|
|
|
604
693
|
`{renderProps.children}` then `<HiddenSelect>` (Select.tsx:288-289). Order
|
|
605
694
|
matters for the DOM tab/focus trail: the visible button must precede the
|
|
606
695
|
form-only hidden control.
|
|
696
|
+
|
|
697
|
+
RAC HiddenSelect.tsx:172-244: ≤300 items render a <select> inside a
|
|
698
|
+
<label> inside the visually hidden container — never an extra <input>.
|
|
699
|
+
Hidden <input>s exist only when the collection is larger than 300.
|
|
607
700
|
*/}
|
|
608
|
-
<
|
|
609
|
-
|
|
610
|
-
|
|
611
|
-
|
|
612
|
-
|
|
613
|
-
|
|
614
|
-
|
|
615
|
-
|
|
616
|
-
|
|
617
|
-
|
|
618
|
-
|
|
619
|
-
|
|
701
|
+
<Show
|
|
702
|
+
when={state.collection().size <= 300}
|
|
703
|
+
fallback={
|
|
704
|
+
<Show when={stateProps.name}>
|
|
705
|
+
<For
|
|
706
|
+
each={(() => {
|
|
707
|
+
// RAC HiddenSelect.tsx:205-208: always render at least one
|
|
708
|
+
// hidden input so a required empty field still participates
|
|
709
|
+
// in native form validation / FormData.
|
|
710
|
+
const keys =
|
|
711
|
+
state.selectionMode() === "multiple"
|
|
712
|
+
? state.selectedKeys() === "all"
|
|
713
|
+
? Array.from(state.collection()).map((item) => item.key)
|
|
714
|
+
: Array.from(state.selectedKeys() as Set<Key>)
|
|
715
|
+
: [state.selectedKey()];
|
|
716
|
+
return keys.length === 0 ? [null] : keys;
|
|
717
|
+
})()}
|
|
718
|
+
>
|
|
719
|
+
{(key) => (
|
|
720
|
+
<input
|
|
721
|
+
{...hiddenInputProps}
|
|
722
|
+
name={stateProps.name}
|
|
723
|
+
form={ariaProps.form}
|
|
724
|
+
value={key != null ? String(key) : ""}
|
|
725
|
+
disabled={resolveDisabled()}
|
|
726
|
+
onInvalid={handleHiddenSelectInvalid}
|
|
727
|
+
/>
|
|
728
|
+
)}
|
|
729
|
+
</For>
|
|
620
730
|
</Show>
|
|
621
|
-
|
|
622
|
-
|
|
623
|
-
|
|
624
|
-
|
|
625
|
-
|
|
626
|
-
const key = stateProps.getKey?.(item) ?? fallbackKey ?? String(item);
|
|
627
|
-
// This hidden <select> re-derives each option's label straight
|
|
628
|
-
// from the raw items array, bypassing the collection's textValue.
|
|
629
|
-
// Mirror createListState's derivation: read the conventional
|
|
630
|
-
// display fields (textValue/label/name/title) and, for an object
|
|
631
|
-
// item with none of them, fall back to the key rather than
|
|
632
|
-
// String(item) — which would render the useless "[object Object]".
|
|
633
|
-
const fallbackTextValue =
|
|
634
|
-
itemRecord != null
|
|
635
|
-
? (toTextValue(itemRecord.textValue) ??
|
|
636
|
-
toTextValue(itemRecord.label) ??
|
|
637
|
-
toTextValue(itemRecord.name) ??
|
|
638
|
-
toTextValue(itemRecord.title))
|
|
639
|
-
: undefined;
|
|
640
|
-
const textValue =
|
|
641
|
-
stateProps.getTextValue?.(item) ??
|
|
642
|
-
fallbackTextValue ??
|
|
643
|
-
(itemRecord != null ? String(key) : String(item));
|
|
644
|
-
const selectedKeys = state.selectedKeys();
|
|
645
|
-
const isSelected =
|
|
646
|
-
state.selectionMode() === "multiple"
|
|
647
|
-
? selectedKeys === "all"
|
|
648
|
-
? true
|
|
649
|
-
: (selectedKeys as Set<Key>).has(key)
|
|
650
|
-
: key === state.selectedKey();
|
|
651
|
-
return (
|
|
652
|
-
<option value={String(key)} selected={isSelected}>
|
|
653
|
-
{textValue}
|
|
654
|
-
</option>
|
|
655
|
-
);
|
|
656
|
-
}}
|
|
657
|
-
</For>
|
|
658
|
-
</select>
|
|
659
|
-
<Show when={state.selectionMode() === "multiple" && stateProps.name}>
|
|
660
|
-
<For
|
|
661
|
-
each={
|
|
662
|
-
state.selectedKeys() === "all"
|
|
663
|
-
? Array.from(state.collection()).map((item) => item.key)
|
|
664
|
-
: Array.from(state.selectedKeys() as Set<Key>)
|
|
665
|
-
}
|
|
666
|
-
>
|
|
667
|
-
{(key) => (
|
|
668
|
-
<input
|
|
669
|
-
type="hidden"
|
|
670
|
-
name={stateProps.name}
|
|
671
|
-
form={ariaProps.form}
|
|
672
|
-
value={String(key)}
|
|
673
|
-
disabled={resolveDisabled()}
|
|
674
|
-
/>
|
|
675
|
-
)}
|
|
676
|
-
</For>
|
|
677
|
-
</Show>
|
|
678
|
-
<Show
|
|
679
|
-
when={
|
|
680
|
-
state.selectionMode() !== "multiple" && stateProps.name && state.selectedKey() != null
|
|
681
|
-
}
|
|
731
|
+
}
|
|
732
|
+
>
|
|
733
|
+
<div
|
|
734
|
+
{...coerceDomRecord(containerProps as Record<string, unknown>)}
|
|
735
|
+
data-testid="hidden-select-container"
|
|
682
736
|
>
|
|
683
|
-
<
|
|
684
|
-
|
|
685
|
-
|
|
686
|
-
|
|
687
|
-
|
|
688
|
-
|
|
689
|
-
|
|
690
|
-
|
|
691
|
-
|
|
737
|
+
<label>
|
|
738
|
+
{ariaProps.label}
|
|
739
|
+
<select
|
|
740
|
+
{...hiddenSelectProps}
|
|
741
|
+
name={stateProps.name}
|
|
742
|
+
required={
|
|
743
|
+
(hasNativeValidation() && ariaProps.isRequired && !hasSelection()) || undefined
|
|
744
|
+
}
|
|
745
|
+
value={nativeSelectValue()}
|
|
746
|
+
onInvalid={handleHiddenSelectInvalid}
|
|
747
|
+
onChange={handleHiddenSelectChange}
|
|
748
|
+
onInput={handleHiddenSelectChange}
|
|
749
|
+
>
|
|
750
|
+
<option value="" label={"\u00A0"}>
|
|
751
|
+
{"\u00A0"}
|
|
752
|
+
</option>
|
|
753
|
+
<For each={hiddenSelectItemNodes()}>
|
|
754
|
+
{(item) => <option value={String(item.key)}>{item.textValue}</option>}
|
|
755
|
+
</For>
|
|
756
|
+
<Show when={state.collection().size === 0 && stateProps.name}>
|
|
757
|
+
<For each={hiddenSelectFallbackValues()}>
|
|
758
|
+
{(value) => <option value={value != null ? String(value) : ""} />}
|
|
759
|
+
</For>
|
|
760
|
+
</Show>
|
|
761
|
+
</select>
|
|
762
|
+
</label>
|
|
763
|
+
</div>
|
|
764
|
+
</Show>
|
|
692
765
|
</>
|
|
693
766
|
);
|
|
694
767
|
};
|
|
@@ -696,18 +769,35 @@ export function Select<T>(props: SelectProps<T>): JSX.Element {
|
|
|
696
769
|
({
|
|
697
770
|
...domProps(),
|
|
698
771
|
...cleanHoverProps(),
|
|
772
|
+
...cleanFocusProps(),
|
|
699
773
|
ref: setRootRef,
|
|
700
774
|
class: renderProps.class(),
|
|
701
775
|
style: renderProps.style(),
|
|
702
776
|
slot: local.slot,
|
|
703
|
-
"data-
|
|
704
|
-
"data-
|
|
705
|
-
"data-
|
|
706
|
-
"data-
|
|
707
|
-
"data-
|
|
777
|
+
"data-focused": dataAttr(isFocused()),
|
|
778
|
+
"data-focus-visible": dataAttr(isFocusVisibleWithin()),
|
|
779
|
+
"data-open": dataAttr(isOpen()),
|
|
780
|
+
"data-disabled": dataAttr(resolveDisabled()),
|
|
781
|
+
"data-required": dataAttr(ariaProps.isRequired),
|
|
782
|
+
"data-invalid": dataAttr(isInvalid()),
|
|
783
|
+
"data-hovered": dataAttr(isHovered()),
|
|
708
784
|
}) as JSX.HTMLAttributes<HTMLDivElement>;
|
|
709
785
|
const RootContent = () => {
|
|
710
|
-
const
|
|
786
|
+
const textSlots = {
|
|
787
|
+
slots: {
|
|
788
|
+
get description() {
|
|
789
|
+
return selectHook.descriptionProps;
|
|
790
|
+
},
|
|
791
|
+
get errorMessage() {
|
|
792
|
+
return selectHook.errorMessageProps;
|
|
793
|
+
},
|
|
794
|
+
},
|
|
795
|
+
};
|
|
796
|
+
const renderedRootChildren = (
|
|
797
|
+
<Provider values={[[TextContext, textSlots]] as Array<[Context<unknown>, unknown]>}>
|
|
798
|
+
<RootChildren />
|
|
799
|
+
</Provider>
|
|
800
|
+
);
|
|
711
801
|
const rootProps = () =>
|
|
712
802
|
({
|
|
713
803
|
...baseRootProps(),
|
|
@@ -722,7 +812,7 @@ export function Select<T>(props: SelectProps<T>): JSX.Element {
|
|
|
722
812
|
};
|
|
723
813
|
|
|
724
814
|
return (
|
|
725
|
-
<SelectContext
|
|
815
|
+
<SelectContext
|
|
726
816
|
value={
|
|
727
817
|
{
|
|
728
818
|
state,
|
|
@@ -732,14 +822,20 @@ export function Select<T>(props: SelectProps<T>): JSX.Element {
|
|
|
732
822
|
get triggerProps() {
|
|
733
823
|
return triggerPropsWithValidation();
|
|
734
824
|
},
|
|
735
|
-
valueProps
|
|
736
|
-
|
|
737
|
-
|
|
825
|
+
get valueProps() {
|
|
826
|
+
return selectHook.valueProps;
|
|
827
|
+
},
|
|
828
|
+
get labelProps() {
|
|
829
|
+
return selectHook.labelProps;
|
|
830
|
+
},
|
|
831
|
+
get menuProps() {
|
|
832
|
+
return selectHook.menuProps;
|
|
833
|
+
},
|
|
738
834
|
get errorMessageProps() {
|
|
739
|
-
return
|
|
835
|
+
return selectHook.errorMessageProps;
|
|
740
836
|
},
|
|
741
837
|
get validation() {
|
|
742
|
-
return
|
|
838
|
+
return composedValidation();
|
|
743
839
|
},
|
|
744
840
|
isOpen,
|
|
745
841
|
isFocused,
|
|
@@ -752,12 +848,12 @@ export function Select<T>(props: SelectProps<T>): JSX.Element {
|
|
|
752
848
|
} as SelectContextValue<unknown>
|
|
753
849
|
}
|
|
754
850
|
>
|
|
755
|
-
<SelectStateContext
|
|
756
|
-
<FieldErrorContext
|
|
851
|
+
<SelectStateContext value={state}>
|
|
852
|
+
<FieldErrorContext value={fieldErrorContext}>
|
|
757
853
|
<RootContent />
|
|
758
|
-
</FieldErrorContext
|
|
759
|
-
</SelectStateContext
|
|
760
|
-
</SelectContext
|
|
854
|
+
</FieldErrorContext>
|
|
855
|
+
</SelectStateContext>
|
|
856
|
+
</SelectContext>
|
|
761
857
|
);
|
|
762
858
|
}
|
|
763
859
|
|
|
@@ -771,7 +867,11 @@ export function SelectTrigger(props: SelectTriggerProps): JSX.Element {
|
|
|
771
867
|
if (!context) {
|
|
772
868
|
throw new Error("SelectTrigger must be used within a Select");
|
|
773
869
|
}
|
|
774
|
-
const { isOpen,
|
|
870
|
+
const { isOpen, isFocusVisible, isPressed, state } = context;
|
|
871
|
+
// RAC renders the trigger as a Button with its own focus ring, so its
|
|
872
|
+
// data-focused follows the button and clears once the listbox takes focus.
|
|
873
|
+
// The Select's own isFocused (state-level) stays on the root.
|
|
874
|
+
const { isFocused, focusProps: triggerFocusProps } = createFocusRing();
|
|
775
875
|
let triggerRef: HTMLButtonElement | undefined;
|
|
776
876
|
const setTriggerRef = (el: HTMLButtonElement) => {
|
|
777
877
|
triggerRef = el;
|
|
@@ -779,7 +879,7 @@ export function SelectTrigger(props: SelectTriggerProps): JSX.Element {
|
|
|
779
879
|
assignRef(local.ref, el);
|
|
780
880
|
};
|
|
781
881
|
|
|
782
|
-
|
|
882
|
+
createTrackedEffect(() => {
|
|
783
883
|
if (context.autoFocus) {
|
|
784
884
|
triggerRef?.focus();
|
|
785
885
|
}
|
|
@@ -813,8 +913,15 @@ export function SelectTrigger(props: SelectTriggerProps): JSX.Element {
|
|
|
813
913
|
);
|
|
814
914
|
|
|
815
915
|
const cleanTriggerProps = () => {
|
|
816
|
-
|
|
817
|
-
|
|
916
|
+
// createSelect also stamps data-open on the trigger; react-aria's useSelect
|
|
917
|
+
// does not, and RAC renders data-open on the Select root only.
|
|
918
|
+
const {
|
|
919
|
+
ref: _ref1,
|
|
920
|
+
"aria-disabled": _ariaDisabled,
|
|
921
|
+
"data-open": _dataOpen,
|
|
922
|
+
...rest
|
|
923
|
+
} = context.triggerProps as Record<string, unknown>;
|
|
924
|
+
return mergeProps(rest, triggerFocusProps as Record<string, unknown>);
|
|
818
925
|
};
|
|
819
926
|
const cleanHoverProps = () => {
|
|
820
927
|
const { ref: _ref2, ...rest } = hoverProps as Record<string, unknown>;
|
|
@@ -830,22 +937,21 @@ export function SelectTrigger(props: SelectTriggerProps): JSX.Element {
|
|
|
830
937
|
{...cleanHoverProps()}
|
|
831
938
|
type="button"
|
|
832
939
|
id={triggerAriaProps().id as string | undefined}
|
|
833
|
-
|
|
940
|
+
tabindex={state.isDisabled ? undefined : 0}
|
|
941
|
+
disabled={state.isDisabled || undefined}
|
|
834
942
|
aria-label={triggerAriaProps()["aria-label"] as string | undefined}
|
|
835
943
|
aria-labelledby={triggerAriaProps()["aria-labelledby"] as string | undefined}
|
|
836
944
|
aria-haspopup="listbox"
|
|
837
|
-
aria-expanded={isOpen()}
|
|
945
|
+
aria-expanded={ariaTrueFalse(isOpen())}
|
|
838
946
|
aria-controls={isOpen() ? (menuAriaProps().id as string | undefined) : undefined}
|
|
839
|
-
aria-
|
|
840
|
-
aria-required={triggerAriaProps()["aria-required"] as boolean | undefined}
|
|
947
|
+
aria-required={attrTrue(Boolean(triggerAriaProps()["aria-required"]))}
|
|
841
948
|
aria-describedby={triggerAriaProps()["aria-describedby"] as string | undefined}
|
|
842
949
|
class={renderProps.class()}
|
|
843
950
|
style={renderProps.style()}
|
|
844
|
-
data-
|
|
845
|
-
data-
|
|
846
|
-
data-
|
|
847
|
-
data-
|
|
848
|
-
data-disabled={state.isDisabled || undefined}
|
|
951
|
+
data-focused={dataAttr(isFocused())}
|
|
952
|
+
data-focus-visible={dataAttr(isFocusVisible())}
|
|
953
|
+
data-hovered={dataAttr(isHovered())}
|
|
954
|
+
data-disabled={dataAttr(state.isDisabled)}
|
|
849
955
|
>
|
|
850
956
|
{renderProps.renderChildren()}
|
|
851
957
|
</button>
|
|
@@ -875,8 +981,11 @@ export function SelectValue<T>(props: SelectValueProps<T>): JSX.Element {
|
|
|
875
981
|
}
|
|
876
982
|
const { valueProps, placeholder: contextPlaceholder } = context;
|
|
877
983
|
const state = context.state as SelectState<T>;
|
|
984
|
+
const stringFormatter = createStringFormatter(racIntlStrings, "react-aria-components");
|
|
985
|
+
const listFormatter = createListFormatter({ style: "long", type: "conjunction" });
|
|
878
986
|
|
|
879
|
-
const placeholder = () =>
|
|
987
|
+
const placeholder = () =>
|
|
988
|
+
local.placeholder ?? contextPlaceholder ?? stringFormatter().format("selectPlaceholder");
|
|
880
989
|
|
|
881
990
|
const renderValues = createMemo<SelectValueRenderProps<T>>(() => {
|
|
882
991
|
const collection = state.collection();
|
|
@@ -892,9 +1001,7 @@ export function SelectValue<T>(props: SelectValueProps<T>): JSX.Element {
|
|
|
892
1001
|
const selectedText =
|
|
893
1002
|
state.selectionMode() === "multiple"
|
|
894
1003
|
? selectedItems.length > 0
|
|
895
|
-
?
|
|
896
|
-
selectedItems.map((item) => item.textValue),
|
|
897
|
-
)
|
|
1004
|
+
? listFormatter().format(selectedItems.map((item) => item.textValue))
|
|
898
1005
|
: null
|
|
899
1006
|
: (selectedItem?.textValue ?? null);
|
|
900
1007
|
return {
|
|
@@ -925,7 +1032,7 @@ export function SelectValue<T>(props: SelectValueProps<T>): JSX.Element {
|
|
|
925
1032
|
{...valueProps}
|
|
926
1033
|
class={renderProps.class()}
|
|
927
1034
|
style={renderProps.style()}
|
|
928
|
-
data-placeholder={!renderValues().isSelected
|
|
1035
|
+
data-placeholder={dataAttr(!renderValues().isSelected)}
|
|
929
1036
|
>
|
|
930
1037
|
{props.children == null
|
|
931
1038
|
? (renderValues().selectedText ?? renderValues().placeholder ?? "")
|
|
@@ -958,7 +1065,7 @@ export function SelectListBox<T>(props: SelectListBoxProps<T>): JSX.Element {
|
|
|
958
1065
|
const { menuProps, rootRef, state: selectState, isOpen } = context;
|
|
959
1066
|
const state = selectState as SelectState<T>;
|
|
960
1067
|
|
|
961
|
-
|
|
1068
|
+
createTrackedEffect(() => {
|
|
962
1069
|
if (!isOpen()) {
|
|
963
1070
|
return;
|
|
964
1071
|
}
|
|
@@ -980,6 +1087,14 @@ export function SelectListBox<T>(props: SelectListBoxProps<T>): JSX.Element {
|
|
|
980
1087
|
});
|
|
981
1088
|
|
|
982
1089
|
let listBoxRef: HTMLDivElement | undefined;
|
|
1090
|
+
const [listBoxEl, setListBoxEl] = createSignal<HTMLDivElement | null>(null, {
|
|
1091
|
+
ownedWrite: true,
|
|
1092
|
+
});
|
|
1093
|
+
// RAC Picker's list is a ListBox under Virtualizer, so CollectionRoot wraps
|
|
1094
|
+
// every row in VirtualizerItem and ListLayout insets it (`padding: 8`). Same
|
|
1095
|
+
// wiring as ComboBoxListBox; without it the rows stack in flow, edge to edge.
|
|
1096
|
+
const CollectionRoot = useCollectionRoot<unknown>();
|
|
1097
|
+
const isVirtualized = () => parentCollectionRenderer?.isVirtualized === true;
|
|
983
1098
|
|
|
984
1099
|
createInteractOutside({
|
|
985
1100
|
ref: () => rootRef() ?? listBoxRef ?? null,
|
|
@@ -1000,23 +1115,36 @@ export function SelectListBox<T>(props: SelectListBoxProps<T>): JSX.Element {
|
|
|
1000
1115
|
// focused key, so a frozen snapshot would leave the listbox tabbable (`0`) when
|
|
1001
1116
|
// upstream flips it to `-1`. Reading `listBoxHook.listBoxProps` per access keeps
|
|
1002
1117
|
// it reactive.
|
|
1118
|
+
const parentCollectionRenderer = useCollectionRenderer<unknown>();
|
|
1003
1119
|
const listBoxHook = createListBox(
|
|
1004
1120
|
{
|
|
1005
1121
|
...(menuProps as unknown as AriaListBoxProps),
|
|
1006
1122
|
shouldSelectOnPressUp: true,
|
|
1007
1123
|
shouldFocusOnHover: true,
|
|
1124
|
+
// Upstream useSelect keeps Escape for closing the popup even though a
|
|
1125
|
+
// multiple Select may toggle its final selected option off.
|
|
1126
|
+
disallowEmptySelection: true,
|
|
1008
1127
|
shouldSelectOnFocus: local.isInPopover === true ? false : undefined,
|
|
1009
1128
|
get isDisabled() {
|
|
1010
1129
|
return state.isDisabled;
|
|
1011
1130
|
},
|
|
1131
|
+
get isVirtualized() {
|
|
1132
|
+
return parentCollectionRenderer?.isVirtualized;
|
|
1133
|
+
},
|
|
1012
1134
|
},
|
|
1013
1135
|
createSelectListStateAdapter(state),
|
|
1014
1136
|
);
|
|
1015
1137
|
|
|
1138
|
+
const {
|
|
1139
|
+
isFocused: isListBoxFocused,
|
|
1140
|
+
isFocusVisible: isListBoxFocusVisible,
|
|
1141
|
+
focusProps: listBoxFocusProps,
|
|
1142
|
+
} = createFocusRing();
|
|
1143
|
+
|
|
1016
1144
|
const renderValues = createMemo<SelectListBoxRenderProps>(() => ({
|
|
1017
|
-
//
|
|
1018
|
-
// not the
|
|
1019
|
-
isFocused:
|
|
1145
|
+
// RAC ListBox.tsx:366 — data-focused comes from useFocusRing on the listbox
|
|
1146
|
+
// element, not the selection manager.
|
|
1147
|
+
isFocused: isListBoxFocused(),
|
|
1020
1148
|
}));
|
|
1021
1149
|
|
|
1022
1150
|
const renderProps = useRenderProps(
|
|
@@ -1062,15 +1190,23 @@ export function SelectListBox<T>(props: SelectListBoxProps<T>): JSX.Element {
|
|
|
1062
1190
|
// the first item selected on open — the bug this override prevents.)
|
|
1063
1191
|
return {
|
|
1064
1192
|
...rest,
|
|
1065
|
-
|
|
1193
|
+
tabindex: state.isDisabled ? undefined : state.focusedKey() != null ? -1 : 0,
|
|
1066
1194
|
};
|
|
1067
1195
|
};
|
|
1196
|
+
const cleanListBoxFocusProps = () => {
|
|
1197
|
+
const { ref: _ref3, ...rest } = listBoxFocusProps as Record<string, unknown>;
|
|
1198
|
+
return rest;
|
|
1199
|
+
};
|
|
1068
1200
|
|
|
1069
1201
|
const items = () => Array.from(state.collection());
|
|
1070
|
-
|
|
1202
|
+
createTrackedEffect(() => {
|
|
1071
1203
|
if (!isOpen()) return;
|
|
1072
1204
|
const focusedKey = state.focusedKey();
|
|
1073
1205
|
if (focusedKey == null) return;
|
|
1206
|
+
// Overlay non-keyboard-open: keep manager `isFocused` + selected `focusedKey`
|
|
1207
|
+
// (roving tabindex / `data-focused`) but do not `focusSafely` the option.
|
|
1208
|
+
// Keyboard-open must hand real focus to that option for subsequent navigation.
|
|
1209
|
+
if (local.isInPopover === true && getInteractionModality() !== "keyboard") return;
|
|
1074
1210
|
|
|
1075
1211
|
queueMicrotask(() => {
|
|
1076
1212
|
const option = Array.from(
|
|
@@ -1088,44 +1224,68 @@ export function SelectListBox<T>(props: SelectListBoxProps<T>): JSX.Element {
|
|
|
1088
1224
|
// div-based for virtualization parity. `<ul>`/`<li>` here was a self-inflicted
|
|
1089
1225
|
// structural divergence surfaced by the Picker recertification (D5/D6/D8 saw
|
|
1090
1226
|
// `li[option]`/`ul[listbox]` where the React oracle sees `div`).
|
|
1091
|
-
<
|
|
1092
|
-
|
|
1093
|
-
|
|
1094
|
-
|
|
1095
|
-
|
|
1096
|
-
|
|
1097
|
-
|
|
1098
|
-
|
|
1099
|
-
|
|
1100
|
-
|
|
1101
|
-
|
|
1102
|
-
|
|
1103
|
-
|
|
1104
|
-
|
|
1105
|
-
|
|
1106
|
-
|
|
1107
|
-
|
|
1108
|
-
|
|
1227
|
+
<SelectListBoxInPopoverContext value={local.isInPopover === true}>
|
|
1228
|
+
<div
|
|
1229
|
+
ref={(el) => {
|
|
1230
|
+
listBoxRef = el;
|
|
1231
|
+
setListBoxEl(el);
|
|
1232
|
+
}}
|
|
1233
|
+
{...domProps}
|
|
1234
|
+
{...cleanMenuProps()}
|
|
1235
|
+
{...cleanListBoxProps()}
|
|
1236
|
+
{...cleanListBoxFocusProps()}
|
|
1237
|
+
class={renderProps.class()}
|
|
1238
|
+
style={renderProps.style()}
|
|
1239
|
+
data-focused={dataAttr(isListBoxFocused())}
|
|
1240
|
+
data-focus-visible={dataAttr(isListBoxFocusVisible())}
|
|
1241
|
+
data-empty={dataAttr(state.collection().size === 0)}
|
|
1242
|
+
data-layout="stack"
|
|
1243
|
+
data-orientation="vertical"
|
|
1244
|
+
>
|
|
1245
|
+
<CollectionRoot collection={items()} scrollRef={() => listBoxEl()}>
|
|
1246
|
+
<Show
|
|
1247
|
+
when={local.children}
|
|
1248
|
+
fallback={
|
|
1249
|
+
<For each={items()}>
|
|
1250
|
+
{(node, index) => {
|
|
1251
|
+
const item = <SelectOption id={node.key}>{node.textValue}</SelectOption>;
|
|
1252
|
+
return isVirtualized() ? (
|
|
1253
|
+
<VirtualizerItem index={index()}>{item}</VirtualizerItem>
|
|
1254
|
+
) : (
|
|
1255
|
+
item
|
|
1256
|
+
);
|
|
1257
|
+
}}
|
|
1258
|
+
</For>
|
|
1259
|
+
}
|
|
1260
|
+
>
|
|
1109
1261
|
<For each={items()}>
|
|
1110
|
-
{(node) =>
|
|
1262
|
+
{(node, index) => {
|
|
1263
|
+
const child = node.value != null ? local.children!(node.value) : null;
|
|
1264
|
+
return isVirtualized() ? (
|
|
1265
|
+
<VirtualizerItem index={index()}>{child}</VirtualizerItem>
|
|
1266
|
+
) : (
|
|
1267
|
+
child
|
|
1268
|
+
);
|
|
1269
|
+
}}
|
|
1111
1270
|
</For>
|
|
1112
|
-
|
|
1113
|
-
>
|
|
1114
|
-
|
|
1115
|
-
|
|
1116
|
-
|
|
1271
|
+
</Show>
|
|
1272
|
+
</CollectionRoot>
|
|
1273
|
+
{state.collection().size === 0 && local.renderEmptyState ? (
|
|
1274
|
+
<div role="option" style={{ display: "contents" }} data-empty-state>
|
|
1275
|
+
{local.renderEmptyState()}
|
|
1276
|
+
</div>
|
|
1277
|
+
) : null}
|
|
1278
|
+
<Show when={local.onLoadMore}>
|
|
1279
|
+
<ListBoxLoadMoreItem
|
|
1280
|
+
onLoadMore={local.onLoadMore!}
|
|
1281
|
+
isLoading={local.isLoading}
|
|
1282
|
+
class={local.loadMoreClass}
|
|
1283
|
+
>
|
|
1284
|
+
{local.renderLoadMore?.()}
|
|
1285
|
+
</ListBoxLoadMoreItem>
|
|
1117
1286
|
</Show>
|
|
1118
|
-
|
|
1119
|
-
|
|
1120
|
-
<ListBoxLoadMoreItem
|
|
1121
|
-
onLoadMore={local.onLoadMore!}
|
|
1122
|
-
isLoading={local.isLoading}
|
|
1123
|
-
class={local.loadMoreClass}
|
|
1124
|
-
>
|
|
1125
|
-
{local.renderLoadMore?.()}
|
|
1126
|
-
</ListBoxLoadMoreItem>
|
|
1127
|
-
</Show>
|
|
1128
|
-
</div>
|
|
1287
|
+
</div>
|
|
1288
|
+
</SelectListBoxInPopoverContext>
|
|
1129
1289
|
);
|
|
1130
1290
|
|
|
1131
1291
|
return (
|
|
@@ -1170,14 +1330,26 @@ export function SelectOption<T>(props: SelectOptionProps<T>): JSX.Element {
|
|
|
1170
1330
|
assignRef(local.ref, el as HTMLDivElement);
|
|
1171
1331
|
};
|
|
1172
1332
|
|
|
1333
|
+
// SelectOption allocates its own list-state adapter, so `createOption` cannot
|
|
1334
|
+
// find `isVirtualized` in the listbox data keyed by SelectListBox's adapter
|
|
1335
|
+
// (RAC reads it from `listData`, useOption.ts:130-131). Pass it explicitly
|
|
1336
|
+
// from the same CollectionRenderer a parent Virtualizer publishes.
|
|
1337
|
+
const parentCollectionRenderer = useCollectionRenderer<unknown>();
|
|
1338
|
+
const isInPopover = useContext(SelectListBoxInPopoverContext);
|
|
1173
1339
|
const optionAria = createOption<T>(
|
|
1174
1340
|
{
|
|
1175
1341
|
key: local.id,
|
|
1342
|
+
get focus() {
|
|
1343
|
+
return ariaProps.focus ?? (isInPopover ? noopOptionFocus : undefined);
|
|
1344
|
+
},
|
|
1345
|
+
get isVirtualized() {
|
|
1346
|
+
return parentCollectionRenderer?.isVirtualized;
|
|
1347
|
+
},
|
|
1176
1348
|
get isDisabled() {
|
|
1177
1349
|
return Boolean(ariaProps.isDisabled || selectContext?.isDisabled());
|
|
1178
1350
|
},
|
|
1179
1351
|
get "aria-label"() {
|
|
1180
|
-
return ariaProps["aria-label"]
|
|
1352
|
+
return ariaProps["aria-label"];
|
|
1181
1353
|
},
|
|
1182
1354
|
shouldSelectOnPressUp: true,
|
|
1183
1355
|
shouldFocusOnHover: true,
|
|
@@ -1226,7 +1398,9 @@ export function SelectOption<T>(props: SelectOptionProps<T>): JSX.Element {
|
|
|
1226
1398
|
() => ref(),
|
|
1227
1399
|
);
|
|
1228
1400
|
const isOptionFocusVisible = () =>
|
|
1229
|
-
|
|
1401
|
+
// RAC useOption: the option's own ring, not the trigger's, which blurs
|
|
1402
|
+
// once the option takes focus.
|
|
1403
|
+
optionAria.isFocusVisible();
|
|
1230
1404
|
|
|
1231
1405
|
const renderValues = createMemo<SelectOptionRenderProps>(() => ({
|
|
1232
1406
|
isSelected: optionAria.isSelected(),
|
|
@@ -1248,23 +1422,12 @@ export function SelectOption<T>(props: SelectOptionProps<T>): JSX.Element {
|
|
|
1248
1422
|
},
|
|
1249
1423
|
renderValues,
|
|
1250
1424
|
);
|
|
1251
|
-
const hasPrimitiveLabel = () => {
|
|
1252
|
-
return typeof props.children === "string" || typeof props.children === "number";
|
|
1253
|
-
};
|
|
1254
|
-
|
|
1255
1425
|
const selectionIndicatorContext = createMemo<SelectionIndicatorContextValue>(() => ({
|
|
1256
1426
|
isSelected: optionAria.isSelected,
|
|
1257
1427
|
}));
|
|
1258
1428
|
|
|
1259
1429
|
const cleanOptionProps = () => {
|
|
1260
|
-
const {
|
|
1261
|
-
ref: _ref1,
|
|
1262
|
-
"aria-describedby": _ariaDescribedby,
|
|
1263
|
-
...rest
|
|
1264
|
-
} = optionAria.optionProps as Record<string, unknown>;
|
|
1265
|
-
if (!hasPrimitiveLabel() && rest["aria-label"] == null) {
|
|
1266
|
-
delete rest["aria-labelledby"];
|
|
1267
|
-
}
|
|
1430
|
+
const { ref: _ref1, ...rest } = optionAria.optionProps as Record<string, unknown>;
|
|
1268
1431
|
const onClick = rest.onClick as ((event: MouseEvent) => void) | undefined;
|
|
1269
1432
|
rest.onClick = ((event: MouseEvent) => {
|
|
1270
1433
|
const wasSelected = optionAria.isSelected();
|
|
@@ -1280,6 +1443,39 @@ export function SelectOption<T>(props: SelectOptionProps<T>): JSX.Element {
|
|
|
1280
1443
|
}) as JSX.EventHandler<HTMLDivElement, MouseEvent>;
|
|
1281
1444
|
return rest;
|
|
1282
1445
|
};
|
|
1446
|
+
|
|
1447
|
+
const optionTextSlots = {
|
|
1448
|
+
slots: {
|
|
1449
|
+
get [DEFAULT_SLOT]() {
|
|
1450
|
+
return optionAria.labelProps;
|
|
1451
|
+
},
|
|
1452
|
+
get label() {
|
|
1453
|
+
return optionAria.labelProps;
|
|
1454
|
+
},
|
|
1455
|
+
get description() {
|
|
1456
|
+
return optionAria.descriptionProps;
|
|
1457
|
+
},
|
|
1458
|
+
},
|
|
1459
|
+
};
|
|
1460
|
+
|
|
1461
|
+
createRenderEffect(
|
|
1462
|
+
() => ({
|
|
1463
|
+
el: ref(),
|
|
1464
|
+
labelId: optionAria.labelProps.id,
|
|
1465
|
+
descriptionId: optionAria.descriptionProps.id,
|
|
1466
|
+
}),
|
|
1467
|
+
({ el, labelId, descriptionId }) => {
|
|
1468
|
+
if (!el) return;
|
|
1469
|
+
if (labelId) {
|
|
1470
|
+
const label = el.querySelector("[slot='label']");
|
|
1471
|
+
if (label && !label.id) label.id = labelId;
|
|
1472
|
+
}
|
|
1473
|
+
if (descriptionId) {
|
|
1474
|
+
const description = el.querySelector("[slot='description']");
|
|
1475
|
+
if (description && !description.id) description.id = descriptionId;
|
|
1476
|
+
}
|
|
1477
|
+
},
|
|
1478
|
+
);
|
|
1283
1479
|
const selectOption = () => {
|
|
1284
1480
|
if (optionAria.isDisabled()) {
|
|
1285
1481
|
return;
|
|
@@ -1298,7 +1494,7 @@ export function SelectOption<T>(props: SelectOptionProps<T>): JSX.Element {
|
|
|
1298
1494
|
};
|
|
1299
1495
|
|
|
1300
1496
|
return (
|
|
1301
|
-
<SelectionIndicatorContext
|
|
1497
|
+
<SelectionIndicatorContext value={selectionIndicatorContext()}>
|
|
1302
1498
|
{/* `<div role="option">`, not `<li>` — see the SelectListBox note; upstream
|
|
1303
1499
|
RAC options are div-based. */}
|
|
1304
1500
|
<div
|
|
@@ -1306,20 +1502,22 @@ export function SelectOption<T>(props: SelectOptionProps<T>): JSX.Element {
|
|
|
1306
1502
|
{...cleanOptionProps()}
|
|
1307
1503
|
class={renderProps.class()}
|
|
1308
1504
|
style={renderProps.style()}
|
|
1309
|
-
data-selected={optionAria.isSelected()
|
|
1310
|
-
data-focused={optionAria.isFocused()
|
|
1311
|
-
data-focus-visible={isOptionFocusVisible()
|
|
1312
|
-
data-pressed={optionAria.isPressed()
|
|
1313
|
-
data-hovered={optionAria.isHovered()
|
|
1314
|
-
data-disabled={optionAria.isDisabled()
|
|
1505
|
+
data-selected={dataAttr(optionAria.isSelected())}
|
|
1506
|
+
data-focused={dataAttr(optionAria.isFocused())}
|
|
1507
|
+
data-focus-visible={dataAttr(isOptionFocusVisible())}
|
|
1508
|
+
data-pressed={dataAttr(optionAria.isPressed())}
|
|
1509
|
+
data-hovered={dataAttr(optionAria.isHovered())}
|
|
1510
|
+
data-disabled={dataAttr(optionAria.isDisabled())}
|
|
1511
|
+
data-selection-mode={state.selectionMode()}
|
|
1315
1512
|
>
|
|
1316
|
-
{
|
|
1317
|
-
<
|
|
1318
|
-
|
|
1319
|
-
|
|
1320
|
-
|
|
1513
|
+
<Provider values={[[TextContext, optionTextSlots] as [Context<unknown>, unknown]]}>
|
|
1514
|
+
<OptionContent
|
|
1515
|
+
render={renderProps.renderChildrenStable}
|
|
1516
|
+
labelProps={optionAria.labelProps}
|
|
1517
|
+
/>
|
|
1518
|
+
</Provider>
|
|
1321
1519
|
</div>
|
|
1322
|
-
</SelectionIndicatorContext
|
|
1520
|
+
</SelectionIndicatorContext>
|
|
1323
1521
|
);
|
|
1324
1522
|
}
|
|
1325
1523
|
|
|
@@ -1366,9 +1564,9 @@ function createSelectListStateAdapter<T>(state: SelectState<T>): ListState<T> {
|
|
|
1366
1564
|
focusedKey: state.focusedKey,
|
|
1367
1565
|
setFocusedKey: (key) => state.setFocusedKey(key ?? null),
|
|
1368
1566
|
childFocusStrategy: () => null,
|
|
1369
|
-
selectionMode: () => state.selectionMode
|
|
1370
|
-
selectionBehavior: () =>
|
|
1371
|
-
disallowEmptySelection: () =>
|
|
1567
|
+
selectionMode: () => state.selectionManager.selectionMode,
|
|
1568
|
+
selectionBehavior: () => state.selectionManager.selectionBehavior,
|
|
1569
|
+
disallowEmptySelection: () => state.selectionManager.disallowEmptySelection,
|
|
1372
1570
|
selectedKeys,
|
|
1373
1571
|
disabledKeys,
|
|
1374
1572
|
disabledBehavior: () => "all",
|
|
@@ -1376,33 +1574,15 @@ function createSelectListStateAdapter<T>(state: SelectState<T>): ListState<T> {
|
|
|
1376
1574
|
isSelectAll: () => state.selectedKeys() === "all",
|
|
1377
1575
|
isSelected: (key) => selectedKeys().has(key),
|
|
1378
1576
|
isDisabled: state.isKeyDisabled,
|
|
1379
|
-
setSelectionBehavior: () =>
|
|
1380
|
-
toggleSelection: (key) =>
|
|
1381
|
-
|
|
1382
|
-
|
|
1383
|
-
|
|
1384
|
-
|
|
1385
|
-
|
|
1386
|
-
|
|
1387
|
-
|
|
1388
|
-
if (next.has(key)) next.delete(key);
|
|
1389
|
-
else next.add(key);
|
|
1390
|
-
state.setSelectedKeys(next);
|
|
1391
|
-
},
|
|
1392
|
-
replaceSelection: (key) => state.setSelectedKey(key),
|
|
1393
|
-
setSelectedKeys: (keys) => state.setSelectedKeys(keys),
|
|
1394
|
-
selectAll: () => {},
|
|
1395
|
-
clearSelection: () =>
|
|
1396
|
-
state.selectionMode() === "multiple" ? state.setSelectedKeys([]) : state.setSelectedKey(null),
|
|
1397
|
-
toggleSelectAll: () => {},
|
|
1398
|
-
extendSelection: (toKey) => state.setSelectedKey(toKey),
|
|
1399
|
-
select: (key) =>
|
|
1400
|
-
state.selectionMode() === "multiple"
|
|
1401
|
-
? state.setSelectedKeys([
|
|
1402
|
-
...(state.selectedKeys() === "all" ? [] : (state.selectedKeys() as Set<Key>)),
|
|
1403
|
-
key,
|
|
1404
|
-
])
|
|
1405
|
-
: state.setSelectedKey(key),
|
|
1577
|
+
setSelectionBehavior: (behavior) => state.selectionManager.setSelectionBehavior(behavior),
|
|
1578
|
+
toggleSelection: (key) => state.selectionManager.toggleSelection(key),
|
|
1579
|
+
replaceSelection: (key) => state.selectionManager.replaceSelection(key),
|
|
1580
|
+
setSelectedKeys: (keys) => state.selectionManager.setSelectedKeys(keys),
|
|
1581
|
+
selectAll: () => state.selectionManager.selectAll(),
|
|
1582
|
+
clearSelection: () => state.selectionManager.clearSelection(),
|
|
1583
|
+
toggleSelectAll: () => state.selectionManager.toggleSelectAll(),
|
|
1584
|
+
extendSelection: (toKey) => state.selectionManager.extendSelection(toKey),
|
|
1585
|
+
select: (key, event) => state.selectionManager.select(key, event),
|
|
1406
1586
|
};
|
|
1407
1587
|
}
|
|
1408
1588
|
|