@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/ComboBox.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/ComboBox.tsx
|
|
14
|
+
|
|
1
15
|
/**
|
|
2
16
|
* ComboBox component for solidaria-components
|
|
3
17
|
*
|
|
@@ -6,19 +20,19 @@
|
|
|
6
20
|
*/
|
|
7
21
|
|
|
8
22
|
import {
|
|
9
|
-
type JSX,
|
|
10
|
-
type Accessor,
|
|
11
|
-
type Context,
|
|
12
23
|
createContext,
|
|
13
24
|
createEffect,
|
|
14
25
|
createMemo,
|
|
26
|
+
createRenderEffect,
|
|
15
27
|
createSignal,
|
|
16
28
|
onCleanup,
|
|
17
|
-
splitProps,
|
|
18
29
|
useContext,
|
|
19
30
|
For,
|
|
20
31
|
Show,
|
|
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
|
createComboBox,
|
|
24
38
|
createListBox,
|
|
@@ -27,8 +41,11 @@ import {
|
|
|
27
41
|
createHover,
|
|
28
42
|
createInteractOutside,
|
|
29
43
|
createScrollIntoViewOnFocus,
|
|
44
|
+
createFocusRing,
|
|
45
|
+
createPress,
|
|
30
46
|
mergeProps,
|
|
31
47
|
isFocusVisible as isGlobalFocusVisible,
|
|
48
|
+
createFilter,
|
|
32
49
|
type AriaComboBoxProps,
|
|
33
50
|
type AriaListBoxProps,
|
|
34
51
|
type AriaOptionProps,
|
|
@@ -47,11 +64,19 @@ import {
|
|
|
47
64
|
type ClassNameOrFunction,
|
|
48
65
|
type StyleOrFunction,
|
|
49
66
|
type SlotProps,
|
|
67
|
+
DEFAULT_SLOT,
|
|
68
|
+
OptionContent,
|
|
50
69
|
useRenderProps,
|
|
51
70
|
filterDOMProps,
|
|
52
71
|
Provider,
|
|
72
|
+
dataAttr,
|
|
53
73
|
} from "./utils";
|
|
54
74
|
import { TextContext } from "./Text";
|
|
75
|
+
import { FieldErrorContext, type FieldErrorContextValue } from "./FieldError";
|
|
76
|
+
import { useCollectionRenderer, useCollectionRoot } from "./Collection";
|
|
77
|
+
import { ListBoxLoadMoreItem } from "./ListBox";
|
|
78
|
+
import { VirtualizerItem } from "./Virtualizer";
|
|
79
|
+
import { splitProps } from "@proyecto-viviana/solidaria/utils";
|
|
55
80
|
import {
|
|
56
81
|
SelectionIndicatorContext,
|
|
57
82
|
type SelectionIndicatorContextValue,
|
|
@@ -262,8 +287,24 @@ export interface ComboBoxListBoxProps<T> extends SlotProps {
|
|
|
262
287
|
class?: ClassNameOrFunction<ComboBoxListBoxRenderProps>;
|
|
263
288
|
/** The inline style for the element. */
|
|
264
289
|
style?: StyleOrFunction<ComboBoxListBoxRenderProps>;
|
|
290
|
+
/** A function to render when the listbox is empty. RAC ListBox `renderEmptyState`. */
|
|
291
|
+
renderEmptyState?: () => JSX.Element;
|
|
292
|
+
/** Called when the load more sentinel becomes visible. */
|
|
293
|
+
onLoadMore?: () => void | Promise<void>;
|
|
294
|
+
/** Whether additional items are currently loading. */
|
|
295
|
+
isLoading?: boolean;
|
|
296
|
+
/** Content to display in the load more sentinel row. */
|
|
297
|
+
renderLoadMore?: () => JSX.Element | undefined;
|
|
298
|
+
/** CSS class for the load more sentinel row. */
|
|
299
|
+
loadMoreClass?: ClassNameOrFunction<{ isLoading: boolean }>;
|
|
265
300
|
}
|
|
266
301
|
|
|
302
|
+
export type ComboBoxItemRenderProps = ComboBoxOptionRenderProps;
|
|
303
|
+
export type ComboBoxItemProps<T> = ComboBoxOptionProps<T>;
|
|
304
|
+
|
|
305
|
+
/**
|
|
306
|
+
* @deprecated Use {@link ComboBoxItemProps}. Removed in a future minor.
|
|
307
|
+
*/
|
|
267
308
|
export interface ComboBoxOptionRenderProps {
|
|
268
309
|
/** Whether the option is selected. */
|
|
269
310
|
isSelected: boolean;
|
|
@@ -320,6 +361,8 @@ interface ComboBoxContextValue<T> {
|
|
|
320
361
|
setTriggerRef: (el: HTMLElement | null) => void;
|
|
321
362
|
listBoxRef: () => HTMLElement | null;
|
|
322
363
|
setListBoxRef: (el: HTMLElement | null) => void;
|
|
364
|
+
popoverRef: () => HTMLElement | null;
|
|
365
|
+
setPopoverRef: (el: HTMLElement | null) => void;
|
|
323
366
|
registerOptionAction: (key: Key, action: (() => void) | undefined) => void;
|
|
324
367
|
runOptionAction: (key: Key) => void;
|
|
325
368
|
slots?: Record<string, Partial<ComboBoxProps<T>>>;
|
|
@@ -350,7 +393,8 @@ function callInputKeyDown(
|
|
|
350
393
|
*/
|
|
351
394
|
export function ComboBox<T>(props: ComboBoxProps<T>): JSX.Element {
|
|
352
395
|
const parentContext = useContext(ComboBoxContext) as ComboBoxContextValue<T> | null;
|
|
353
|
-
const contextSlotProps =
|
|
396
|
+
const contextSlotProps =
|
|
397
|
+
parentContext?.slots?.[typeof props.slot === "string" ? props.slot : "default"];
|
|
354
398
|
const mergedComboBoxProps = contextSlotProps
|
|
355
399
|
? (mergeProps(contextSlotProps, props) as ComboBoxProps<T>)
|
|
356
400
|
: props;
|
|
@@ -386,15 +430,22 @@ export function ComboBox<T>(props: ComboBoxProps<T>): JSX.Element {
|
|
|
386
430
|
],
|
|
387
431
|
);
|
|
388
432
|
|
|
389
|
-
|
|
433
|
+
const [inputEl, setInputEl] = createSignal<HTMLInputElement | null>(null, {
|
|
434
|
+
ownedWrite: true,
|
|
435
|
+
});
|
|
390
436
|
let buttonRef: HTMLElement | null = null;
|
|
391
437
|
let triggerRef: HTMLElement | null = null;
|
|
392
438
|
let listBoxRef: HTMLElement | null = null;
|
|
439
|
+
const [popoverRef, setPopoverRef] = createSignal<HTMLElement | null>(null);
|
|
393
440
|
const optionActions = new Map<Key, () => void>();
|
|
394
441
|
const runOptionAction = (key: Key) => {
|
|
395
442
|
optionActions.get(key)?.();
|
|
396
443
|
};
|
|
397
444
|
|
|
445
|
+
// RAC ComboBox.tsx:204-207 — `useFilter({sensitivity: 'base'}).contains`
|
|
446
|
+
// is the default when the caller omits `defaultFilter`.
|
|
447
|
+
const intlFilter = createFilter({ sensitivity: "base" });
|
|
448
|
+
|
|
398
449
|
const state = createComboBoxState<T>({
|
|
399
450
|
get items() {
|
|
400
451
|
return stateProps.items;
|
|
@@ -454,7 +505,7 @@ export function ComboBox<T>(props: ComboBoxProps<T>): JSX.Element {
|
|
|
454
505
|
return stateProps.onOpenChange;
|
|
455
506
|
},
|
|
456
507
|
get defaultFilter() {
|
|
457
|
-
return stateProps.defaultFilter;
|
|
508
|
+
return stateProps.defaultFilter ?? intlFilter().contains;
|
|
458
509
|
},
|
|
459
510
|
get allowsCustomValue() {
|
|
460
511
|
return stateProps.allowsCustomValue;
|
|
@@ -500,11 +551,15 @@ export function ComboBox<T>(props: ComboBoxProps<T>): JSX.Element {
|
|
|
500
551
|
get name() {
|
|
501
552
|
return effectiveFormValue() === "text" ? stateProps.name : undefined;
|
|
502
553
|
},
|
|
554
|
+
get allowsCustomValue() {
|
|
555
|
+
return stateProps.allowsCustomValue;
|
|
556
|
+
},
|
|
503
557
|
}),
|
|
504
558
|
state,
|
|
505
|
-
() =>
|
|
559
|
+
() => inputEl(),
|
|
506
560
|
() => buttonRef,
|
|
507
561
|
() => listBoxRef,
|
|
562
|
+
() => popoverRef(),
|
|
508
563
|
);
|
|
509
564
|
|
|
510
565
|
const getInputProps = () => {
|
|
@@ -529,19 +584,13 @@ export function ComboBox<T>(props: ComboBoxProps<T>): JSX.Element {
|
|
|
529
584
|
} as JSX.InputHTMLAttributes<HTMLInputElement>;
|
|
530
585
|
};
|
|
531
586
|
|
|
532
|
-
const { isHovered, hoverProps } = createHover({
|
|
533
|
-
get isDisabled() {
|
|
534
|
-
return ariaProps.isDisabled;
|
|
535
|
-
},
|
|
536
|
-
});
|
|
537
|
-
|
|
538
587
|
const renderValues = createMemo<ComboBoxRenderProps>(() => ({
|
|
539
588
|
isOpen: comboBoxAria.isOpen(),
|
|
540
589
|
isFocused: comboBoxAria.isFocused(),
|
|
541
590
|
isFocusVisible: comboBoxAria.isFocusVisible(),
|
|
542
591
|
isDisabled: !!ariaProps.isDisabled,
|
|
543
592
|
isRequired: !!ariaProps.isRequired,
|
|
544
|
-
isInvalid:
|
|
593
|
+
isInvalid: comboBoxAria.isInvalid,
|
|
545
594
|
isReadOnly: !!ariaProps.isReadOnly,
|
|
546
595
|
isSelected: state.selectedKey() != null,
|
|
547
596
|
inputValue: state.inputValue(),
|
|
@@ -561,11 +610,6 @@ export function ComboBox<T>(props: ComboBoxProps<T>): JSX.Element {
|
|
|
561
610
|
return filtered;
|
|
562
611
|
});
|
|
563
612
|
|
|
564
|
-
const cleanHoverProps = () => {
|
|
565
|
-
const { ref: _ref, ...rest } = hoverProps as Record<string, unknown>;
|
|
566
|
-
return rest;
|
|
567
|
-
};
|
|
568
|
-
|
|
569
613
|
const ComboBoxChildren = () =>
|
|
570
614
|
typeof local.children === "function"
|
|
571
615
|
? (local.children as (values: ComboBoxRenderProps) => JSX.Element)(renderValues())
|
|
@@ -582,8 +626,23 @@ export function ComboBox<T>(props: ComboBoxProps<T>): JSX.Element {
|
|
|
582
626
|
},
|
|
583
627
|
};
|
|
584
628
|
|
|
629
|
+
// RAC ComboBox.tsx:359: `[FieldErrorContext, validation]`. HelpText's
|
|
630
|
+
// `<FieldError>` only paints when this context reports `isInvalid`.
|
|
631
|
+
const fieldErrorContext: FieldErrorContextValue = {
|
|
632
|
+
get validation() {
|
|
633
|
+
return {
|
|
634
|
+
isInvalid: comboBoxAria.isInvalid,
|
|
635
|
+
validationErrors: comboBoxAria.validationErrors,
|
|
636
|
+
validationDetails: comboBoxAria.validationDetails,
|
|
637
|
+
};
|
|
638
|
+
},
|
|
639
|
+
get errorMessageProps() {
|
|
640
|
+
return comboBoxAria.errorMessageProps;
|
|
641
|
+
},
|
|
642
|
+
};
|
|
643
|
+
|
|
585
644
|
return (
|
|
586
|
-
<ComboBoxContext
|
|
645
|
+
<ComboBoxContext
|
|
587
646
|
value={
|
|
588
647
|
{
|
|
589
648
|
state,
|
|
@@ -606,9 +665,9 @@ export function ComboBox<T>(props: ComboBoxProps<T>): JSX.Element {
|
|
|
606
665
|
isFocused: comboBoxAria.isFocused,
|
|
607
666
|
isFocusVisible: comboBoxAria.isFocusVisible,
|
|
608
667
|
items: stateProps.items ?? stateProps.defaultItems ?? [],
|
|
609
|
-
inputRef: () =>
|
|
668
|
+
inputRef: () => inputEl(),
|
|
610
669
|
setInputRef: (el) => {
|
|
611
|
-
|
|
670
|
+
setInputEl(el);
|
|
612
671
|
},
|
|
613
672
|
buttonRef: () => buttonRef,
|
|
614
673
|
setButtonRef: (el) => {
|
|
@@ -622,6 +681,8 @@ export function ComboBox<T>(props: ComboBoxProps<T>): JSX.Element {
|
|
|
622
681
|
setListBoxRef: (el) => {
|
|
623
682
|
listBoxRef = el;
|
|
624
683
|
},
|
|
684
|
+
popoverRef,
|
|
685
|
+
setPopoverRef,
|
|
625
686
|
registerOptionAction: (key, action) => {
|
|
626
687
|
if (action) {
|
|
627
688
|
optionActions.set(key, action);
|
|
@@ -634,27 +695,34 @@ export function ComboBox<T>(props: ComboBoxProps<T>): JSX.Element {
|
|
|
634
695
|
} as ComboBoxContextValue<unknown>
|
|
635
696
|
}
|
|
636
697
|
>
|
|
637
|
-
<ComboBoxStateContext
|
|
698
|
+
<ComboBoxStateContext value={state}>
|
|
638
699
|
<div
|
|
639
700
|
{...domProps()}
|
|
640
|
-
{...cleanHoverProps()}
|
|
641
701
|
ref={(el) => {
|
|
642
702
|
assignRef(local.ref, el);
|
|
643
703
|
assignRef(local.rootRef, el);
|
|
644
704
|
}}
|
|
645
705
|
class={renderProps.class()}
|
|
646
706
|
style={renderProps.style()}
|
|
647
|
-
data-open={comboBoxAria.isOpen()
|
|
648
|
-
data-focused={comboBoxAria.isFocused()
|
|
649
|
-
data-
|
|
650
|
-
data-
|
|
651
|
-
data-
|
|
652
|
-
data-
|
|
653
|
-
data-readonly={ariaProps.isReadOnly || undefined}
|
|
654
|
-
data-hovered={isHovered() || undefined}
|
|
707
|
+
data-open={dataAttr(comboBoxAria.isOpen())}
|
|
708
|
+
data-focused={dataAttr(comboBoxAria.isFocused())}
|
|
709
|
+
data-disabled={dataAttr(ariaProps.isDisabled)}
|
|
710
|
+
data-required={dataAttr(ariaProps.isRequired)}
|
|
711
|
+
data-invalid={dataAttr(comboBoxAria.isInvalid)}
|
|
712
|
+
data-readonly={dataAttr(ariaProps.isReadOnly)}
|
|
655
713
|
slot={local.slot}
|
|
656
714
|
>
|
|
657
|
-
|
|
715
|
+
<Provider
|
|
716
|
+
values={
|
|
717
|
+
[
|
|
718
|
+
[TextContext, textSlots],
|
|
719
|
+
[FieldErrorContext, fieldErrorContext],
|
|
720
|
+
] as Array<[Context<unknown>, unknown]>
|
|
721
|
+
}
|
|
722
|
+
>
|
|
723
|
+
<ComboBoxChildren />
|
|
724
|
+
</Provider>
|
|
725
|
+
{/* Hidden input last among root children — RAC ComboBox.tsx:373-374 */}
|
|
658
726
|
<Show when={stateProps.name && effectiveFormValue() === "key"}>
|
|
659
727
|
<input
|
|
660
728
|
type="hidden"
|
|
@@ -663,12 +731,9 @@ export function ComboBox<T>(props: ComboBoxProps<T>): JSX.Element {
|
|
|
663
731
|
value={state.selectedKey()?.toString() ?? ""}
|
|
664
732
|
/>
|
|
665
733
|
</Show>
|
|
666
|
-
<Provider values={[[TextContext, textSlots]] as Array<[Context<unknown>, unknown]>}>
|
|
667
|
-
<ComboBoxChildren />
|
|
668
|
-
</Provider>
|
|
669
734
|
</div>
|
|
670
|
-
</ComboBoxStateContext
|
|
671
|
-
</ComboBoxContext
|
|
735
|
+
</ComboBoxStateContext>
|
|
736
|
+
</ComboBoxContext>
|
|
672
737
|
);
|
|
673
738
|
}
|
|
674
739
|
|
|
@@ -715,7 +780,13 @@ export function ComboBoxDescription(props: ComboBoxDescriptionProps): JSX.Elemen
|
|
|
715
780
|
// `Text` defaults to `elementType="span"` (Text.tsx:24) — so the help text is a
|
|
716
781
|
// `<span>`, not a `<div>`. Match it (mirrors the TextField port's same revert).
|
|
717
782
|
return (
|
|
718
|
-
<span
|
|
783
|
+
<span
|
|
784
|
+
{...domProps}
|
|
785
|
+
{...cleanDescriptionProps()}
|
|
786
|
+
slot={local.slot ?? "description"}
|
|
787
|
+
class={local.class}
|
|
788
|
+
style={local.style}
|
|
789
|
+
>
|
|
719
790
|
{local.children}
|
|
720
791
|
</span>
|
|
721
792
|
);
|
|
@@ -740,7 +811,13 @@ export function ComboBoxErrorMessage(props: ComboBoxErrorMessageProps): JSX.Elem
|
|
|
740
811
|
// Same as the description: upstream's error is `<Text slot="errorMessage">`,
|
|
741
812
|
// a `<span>` (RAC Text default elementType). Match it.
|
|
742
813
|
return (
|
|
743
|
-
<span
|
|
814
|
+
<span
|
|
815
|
+
{...domProps}
|
|
816
|
+
{...cleanErrorMessageProps()}
|
|
817
|
+
slot={local.slot ?? "errorMessage"}
|
|
818
|
+
class={local.class}
|
|
819
|
+
style={local.style}
|
|
820
|
+
>
|
|
744
821
|
{local.children}
|
|
745
822
|
</span>
|
|
746
823
|
);
|
|
@@ -786,7 +863,12 @@ export function ComboBoxInput(props: ComboBoxInputProps): JSX.Element {
|
|
|
786
863
|
);
|
|
787
864
|
|
|
788
865
|
const cleanInputProps = () => {
|
|
789
|
-
const {
|
|
866
|
+
const {
|
|
867
|
+
ref: _ref1,
|
|
868
|
+
value: _value,
|
|
869
|
+
"data-open": _dataOpen,
|
|
870
|
+
...rest
|
|
871
|
+
} = context.inputProps() as Record<string, unknown>;
|
|
790
872
|
return rest;
|
|
791
873
|
};
|
|
792
874
|
const cleanHoverProps = () => {
|
|
@@ -803,11 +885,10 @@ export function ComboBoxInput(props: ComboBoxInputProps): JSX.Element {
|
|
|
803
885
|
value={state.inputValue()}
|
|
804
886
|
class={renderProps.class()}
|
|
805
887
|
style={renderProps.style()}
|
|
806
|
-
data-
|
|
807
|
-
data-
|
|
808
|
-
data-
|
|
809
|
-
data-
|
|
810
|
-
data-disabled={state.isDisabled || undefined}
|
|
888
|
+
data-focused={dataAttr(isFocused())}
|
|
889
|
+
data-focus-visible={dataAttr(isFocusVisible())}
|
|
890
|
+
data-hovered={dataAttr(isHovered())}
|
|
891
|
+
data-disabled={dataAttr(state.isDisabled)}
|
|
811
892
|
/>
|
|
812
893
|
);
|
|
813
894
|
}
|
|
@@ -860,7 +941,7 @@ export function ComboBoxValue(props: ComboBoxValueProps): JSX.Element {
|
|
|
860
941
|
<span
|
|
861
942
|
class={renderProps.class()}
|
|
862
943
|
style={renderProps.style()}
|
|
863
|
-
data-placeholder={isPlaceholder()
|
|
944
|
+
data-placeholder={dataAttr(isPlaceholder())}
|
|
864
945
|
>
|
|
865
946
|
{props.children
|
|
866
947
|
? renderProps.renderChildren()
|
|
@@ -881,7 +962,7 @@ export function ComboBoxButton(props: ComboBoxButtonProps): JSX.Element {
|
|
|
881
962
|
if (!context) {
|
|
882
963
|
throw new Error("ComboBoxButton must be used within a ComboBox");
|
|
883
964
|
}
|
|
884
|
-
const { isOpen,
|
|
965
|
+
const { isOpen, state, setButtonRef } = context;
|
|
885
966
|
|
|
886
967
|
const { isHovered, hoverProps } = createHover({
|
|
887
968
|
get isDisabled() {
|
|
@@ -889,11 +970,21 @@ export function ComboBoxButton(props: ComboBoxButtonProps): JSX.Element {
|
|
|
889
970
|
},
|
|
890
971
|
});
|
|
891
972
|
|
|
973
|
+
// RAC Button (ComboBox chevron) uses its own hover/focus/press, not ComboBox
|
|
974
|
+
// isOpen / input isFocused. S2 `isPressed={false}` waits on #254.
|
|
975
|
+
const { isFocused, isFocusVisible, focusProps } = createFocusRing();
|
|
976
|
+
const { isPressed, pressProps } = createPress({
|
|
977
|
+
get isDisabled() {
|
|
978
|
+
return state.isDisabled || state.isReadOnly;
|
|
979
|
+
},
|
|
980
|
+
preventFocusOnPress: true,
|
|
981
|
+
});
|
|
982
|
+
|
|
892
983
|
const renderValues = createMemo<ComboBoxButtonRenderProps>(() => ({
|
|
893
984
|
isOpen: isOpen(),
|
|
894
985
|
isFocused: isFocused(),
|
|
895
986
|
isHovered: isHovered(),
|
|
896
|
-
isPressed:
|
|
987
|
+
isPressed: isPressed(),
|
|
897
988
|
isDisabled: state.isDisabled,
|
|
898
989
|
}));
|
|
899
990
|
|
|
@@ -910,30 +1001,49 @@ export function ComboBoxButton(props: ComboBoxButtonProps): JSX.Element {
|
|
|
910
1001
|
);
|
|
911
1002
|
|
|
912
1003
|
const cleanButtonProps = () => {
|
|
913
|
-
const {
|
|
1004
|
+
const {
|
|
1005
|
+
ref: _ref1,
|
|
1006
|
+
"data-open": _dataOpen,
|
|
1007
|
+
...rest
|
|
1008
|
+
} = context.buttonProps() as Record<string, unknown>;
|
|
914
1009
|
return rest;
|
|
915
1010
|
};
|
|
916
1011
|
const cleanHoverProps = () => {
|
|
917
1012
|
const { ref: _ref2, ...rest } = hoverProps as Record<string, unknown>;
|
|
918
1013
|
return rest;
|
|
919
1014
|
};
|
|
1015
|
+
const cleanFocusProps = () => {
|
|
1016
|
+
const { ref: _ref3, ...rest } = focusProps as Record<string, unknown>;
|
|
1017
|
+
return rest;
|
|
1018
|
+
};
|
|
1019
|
+
const cleanPressProps = () => {
|
|
1020
|
+
const { ref: _ref4, ...rest } = pressProps as Record<string, unknown>;
|
|
1021
|
+
return rest;
|
|
1022
|
+
};
|
|
1023
|
+
|
|
1024
|
+
const mergedButtonProps = () =>
|
|
1025
|
+
mergeProps(
|
|
1026
|
+
domProps as Record<string, unknown>,
|
|
1027
|
+
cleanButtonProps(),
|
|
1028
|
+
cleanHoverProps(),
|
|
1029
|
+
cleanFocusProps(),
|
|
1030
|
+
cleanPressProps(),
|
|
1031
|
+
) as JSX.ButtonHTMLAttributes<HTMLButtonElement>;
|
|
920
1032
|
|
|
921
1033
|
return (
|
|
922
1034
|
<button
|
|
923
|
-
{...
|
|
1035
|
+
{...mergedButtonProps()}
|
|
924
1036
|
ref={(el) => {
|
|
925
1037
|
setButtonRef(el);
|
|
926
1038
|
assignRef(local.ref, el);
|
|
927
1039
|
}}
|
|
928
|
-
{...cleanButtonProps()}
|
|
929
|
-
{...cleanHoverProps()}
|
|
930
1040
|
class={renderProps.class()}
|
|
931
1041
|
style={renderProps.style()}
|
|
932
|
-
data-
|
|
933
|
-
data-
|
|
934
|
-
data-
|
|
935
|
-
data-hovered={isHovered()
|
|
936
|
-
data-disabled={state.isDisabled
|
|
1042
|
+
data-pressed={dataAttr(isPressed())}
|
|
1043
|
+
data-focused={dataAttr(isFocused())}
|
|
1044
|
+
data-focus-visible={dataAttr(isFocusVisible())}
|
|
1045
|
+
data-hovered={dataAttr(isHovered())}
|
|
1046
|
+
data-disabled={dataAttr(state.isDisabled)}
|
|
937
1047
|
>
|
|
938
1048
|
{renderProps.renderChildren()}
|
|
939
1049
|
</button>
|
|
@@ -944,14 +1054,32 @@ export function ComboBoxButton(props: ComboBoxButtonProps): JSX.Element {
|
|
|
944
1054
|
* The listbox popup for a combobox.
|
|
945
1055
|
*/
|
|
946
1056
|
export function ComboBoxListBox<T>(props: ComboBoxListBoxProps<T>): JSX.Element {
|
|
947
|
-
const [local, domProps] = splitProps(props, [
|
|
1057
|
+
const [local, domProps] = splitProps(props, [
|
|
1058
|
+
"class",
|
|
1059
|
+
"style",
|
|
1060
|
+
"slot",
|
|
1061
|
+
"children",
|
|
1062
|
+
"renderEmptyState",
|
|
1063
|
+
"onLoadMore",
|
|
1064
|
+
"isLoading",
|
|
1065
|
+
"renderLoadMore",
|
|
1066
|
+
"loadMoreClass",
|
|
1067
|
+
]);
|
|
948
1068
|
|
|
949
1069
|
const rawContext = useContext(ComboBoxContext);
|
|
950
1070
|
if (!rawContext) {
|
|
951
1071
|
throw new Error("ComboBoxListBox must be used within a ComboBox");
|
|
952
1072
|
}
|
|
953
1073
|
const context = rawContext as ComboBoxContextValue<T>;
|
|
954
|
-
const {
|
|
1074
|
+
const {
|
|
1075
|
+
state: comboBoxState,
|
|
1076
|
+
listState,
|
|
1077
|
+
isOpen,
|
|
1078
|
+
inputRef,
|
|
1079
|
+
buttonRef,
|
|
1080
|
+
setListBoxRef,
|
|
1081
|
+
setPopoverRef,
|
|
1082
|
+
} = context;
|
|
955
1083
|
const state = comboBoxState;
|
|
956
1084
|
|
|
957
1085
|
let listBoxRef: HTMLElement | undefined;
|
|
@@ -978,6 +1106,9 @@ export function ComboBoxListBox<T>(props: ComboBoxListBoxProps<T>): JSX.Element
|
|
|
978
1106
|
if (button?.contains(target)) {
|
|
979
1107
|
return;
|
|
980
1108
|
}
|
|
1109
|
+
if (target.closest('[role="listbox"]') || target.closest('[role="option"]')) {
|
|
1110
|
+
return;
|
|
1111
|
+
}
|
|
981
1112
|
if (isOpen()) {
|
|
982
1113
|
state.close();
|
|
983
1114
|
}
|
|
@@ -987,14 +1118,34 @@ export function ComboBoxListBox<T>(props: ComboBoxListBoxProps<T>): JSX.Element
|
|
|
987
1118
|
},
|
|
988
1119
|
});
|
|
989
1120
|
|
|
990
|
-
// Create listbox aria props using ComboBoxState's ListState-compatible interface
|
|
1121
|
+
// Create listbox aria props using ComboBoxState's ListState-compatible interface.
|
|
1122
|
+
// A parent Virtualizer publishes `isVirtualized` through the collection renderer
|
|
1123
|
+
// (RAC ListBox.tsx + Virtualizer); forward it so options emit posinset/setsize.
|
|
1124
|
+
// RAC ComboBox list is a ListBox under Virtualizer, so CollectionRoot wraps
|
|
1125
|
+
// items in VirtualizerItem. This listbox is ComboBox-owned; still consume
|
|
1126
|
+
// that renderer so the popover list is not a bare in-flow option stack.
|
|
1127
|
+
const parentCollectionRenderer = useCollectionRenderer<unknown>();
|
|
1128
|
+
const CollectionRoot = useCollectionRoot<unknown>();
|
|
1129
|
+
const isVirtualized = () => parentCollectionRenderer?.isVirtualized === true;
|
|
991
1130
|
const { listBoxProps } = createListBox(
|
|
992
|
-
|
|
1131
|
+
() => ({
|
|
1132
|
+
...(context.listBoxProps() as AriaListBoxProps),
|
|
1133
|
+
isVirtualized: parentCollectionRenderer?.isVirtualized,
|
|
1134
|
+
}),
|
|
993
1135
|
listState,
|
|
994
1136
|
);
|
|
995
1137
|
|
|
1138
|
+
// RAC ListBox.tsx:366 — data-focused / data-focus-visible come from useFocusRing
|
|
1139
|
+
// on the listbox. ComboBox uses virtual focus, so the listbox itself is not
|
|
1140
|
+
// focused and must not emit data-focused.
|
|
1141
|
+
const {
|
|
1142
|
+
isFocused: isListBoxFocused,
|
|
1143
|
+
isFocusVisible: isListBoxFocusVisible,
|
|
1144
|
+
focusProps,
|
|
1145
|
+
} = createFocusRing();
|
|
1146
|
+
|
|
996
1147
|
const renderValues = createMemo<ComboBoxListBoxRenderProps>(() => ({
|
|
997
|
-
isFocused:
|
|
1148
|
+
isFocused: isListBoxFocused(),
|
|
998
1149
|
}));
|
|
999
1150
|
|
|
1000
1151
|
const renderProps = useRenderProps(
|
|
@@ -1014,6 +1165,10 @@ export function ComboBoxListBox<T>(props: ComboBoxListBoxProps<T>): JSX.Element
|
|
|
1014
1165
|
const { ref: _ref2, ...rest } = listBoxProps as Record<string, unknown>;
|
|
1015
1166
|
return rest;
|
|
1016
1167
|
};
|
|
1168
|
+
const cleanFocusProps = () => {
|
|
1169
|
+
const { ref: _ref3, ...rest } = focusProps as Record<string, unknown>;
|
|
1170
|
+
return rest;
|
|
1171
|
+
};
|
|
1017
1172
|
|
|
1018
1173
|
const items = () => Array.from(state.collection());
|
|
1019
1174
|
const getNodeValue = (node: { key: Key; value?: T | null; index?: number }): T | null => {
|
|
@@ -1030,15 +1185,38 @@ export function ComboBoxListBox<T>(props: ComboBoxListBoxProps<T>): JSX.Element
|
|
|
1030
1185
|
);
|
|
1031
1186
|
};
|
|
1032
1187
|
|
|
1188
|
+
const [listBoxEl, setListBoxEl] = createSignal<HTMLElement | null>(null, {
|
|
1189
|
+
ownedWrite: true,
|
|
1190
|
+
});
|
|
1191
|
+
|
|
1192
|
+
// Resolve the overlay root after the listbox is inserted. A ref callback can
|
|
1193
|
+
// fire before parentNode exists, so closest("[data-placement]") would miss
|
|
1194
|
+
// the Popover (RAC ComboBox PopoverContext.ref) and hide-outside would keep
|
|
1195
|
+
// only the listbox — aria-hiding the dismiss sibling.
|
|
1196
|
+
createEffect(
|
|
1197
|
+
() => listBoxEl(),
|
|
1198
|
+
(el) => {
|
|
1199
|
+
if (!el) {
|
|
1200
|
+
setPopoverRef(null);
|
|
1201
|
+
return;
|
|
1202
|
+
}
|
|
1203
|
+
const overlay = el.closest("[data-placement]");
|
|
1204
|
+
setPopoverRef(overlay instanceof HTMLElement ? overlay : el);
|
|
1205
|
+
},
|
|
1206
|
+
);
|
|
1207
|
+
|
|
1033
1208
|
const setListBoxElement = (el: HTMLElement) => {
|
|
1034
1209
|
listBoxRef = el;
|
|
1035
1210
|
setListBoxRef(el);
|
|
1211
|
+
setListBoxEl(el);
|
|
1212
|
+
onCleanup(() => {
|
|
1213
|
+
listBoxRef = undefined;
|
|
1214
|
+
setListBoxRef(null);
|
|
1215
|
+
setListBoxEl(null);
|
|
1216
|
+
setPopoverRef(null);
|
|
1217
|
+
});
|
|
1036
1218
|
};
|
|
1037
1219
|
|
|
1038
|
-
onCleanup(() => {
|
|
1039
|
-
setListBoxRef(null);
|
|
1040
|
-
});
|
|
1041
|
-
|
|
1042
1220
|
return (
|
|
1043
1221
|
<Show when={isOpen()}>
|
|
1044
1222
|
{/* `<div role="listbox">`, not `<ul>` — upstream RAC ListBox (and our own
|
|
@@ -1049,24 +1227,57 @@ export function ComboBoxListBox<T>(props: ComboBoxListBoxProps<T>): JSX.Element
|
|
|
1049
1227
|
ref={setListBoxElement}
|
|
1050
1228
|
{...cleanContextProps()}
|
|
1051
1229
|
{...cleanListBoxProps()}
|
|
1230
|
+
{...cleanFocusProps()}
|
|
1052
1231
|
class={renderProps.class()}
|
|
1053
1232
|
style={renderProps.style()}
|
|
1054
|
-
data-focused={
|
|
1233
|
+
data-focused={dataAttr(isListBoxFocused())}
|
|
1234
|
+
data-focus-visible={dataAttr(isListBoxFocusVisible())}
|
|
1235
|
+
data-empty={dataAttr(state.collection().size === 0)}
|
|
1236
|
+
data-layout="stack"
|
|
1237
|
+
data-orientation="vertical"
|
|
1055
1238
|
>
|
|
1056
|
-
<
|
|
1057
|
-
|
|
1058
|
-
|
|
1239
|
+
<CollectionRoot collection={items()} scrollRef={() => listBoxEl()}>
|
|
1240
|
+
<Show
|
|
1241
|
+
when={local.children}
|
|
1242
|
+
fallback={
|
|
1243
|
+
<For each={items()}>
|
|
1244
|
+
{(node, index) => {
|
|
1245
|
+
const item = <ComboBoxItem id={node.key}>{node.textValue}</ComboBoxItem>;
|
|
1246
|
+
return isVirtualized() ? (
|
|
1247
|
+
<VirtualizerItem index={index()}>{item}</VirtualizerItem>
|
|
1248
|
+
) : (
|
|
1249
|
+
item
|
|
1250
|
+
);
|
|
1251
|
+
}}
|
|
1252
|
+
</For>
|
|
1253
|
+
}
|
|
1254
|
+
>
|
|
1059
1255
|
<For each={items()}>
|
|
1060
|
-
{(node) =>
|
|
1256
|
+
{(node, index) => {
|
|
1257
|
+
const value = getNodeValue(node);
|
|
1258
|
+
const child = value != null ? (local.children as Function)!(value) : null;
|
|
1259
|
+
return isVirtualized() ? (
|
|
1260
|
+
<VirtualizerItem index={index()}>{child}</VirtualizerItem>
|
|
1261
|
+
) : (
|
|
1262
|
+
child
|
|
1263
|
+
);
|
|
1264
|
+
}}
|
|
1061
1265
|
</For>
|
|
1062
|
-
|
|
1063
|
-
>
|
|
1064
|
-
|
|
1065
|
-
|
|
1066
|
-
|
|
1067
|
-
|
|
1068
|
-
|
|
1069
|
-
|
|
1266
|
+
</Show>
|
|
1267
|
+
</CollectionRoot>
|
|
1268
|
+
{state.collection().size === 0 && local.renderEmptyState ? (
|
|
1269
|
+
<div role="option" style={{ display: "contents" }} data-empty-state>
|
|
1270
|
+
{local.renderEmptyState()}
|
|
1271
|
+
</div>
|
|
1272
|
+
) : null}
|
|
1273
|
+
<Show when={local.onLoadMore}>
|
|
1274
|
+
<ListBoxLoadMoreItem
|
|
1275
|
+
onLoadMore={local.onLoadMore!}
|
|
1276
|
+
isLoading={local.isLoading}
|
|
1277
|
+
class={local.loadMoreClass}
|
|
1278
|
+
>
|
|
1279
|
+
{local.renderLoadMore?.()}
|
|
1280
|
+
</ListBoxLoadMoreItem>
|
|
1070
1281
|
</Show>
|
|
1071
1282
|
</div>
|
|
1072
1283
|
</Show>
|
|
@@ -1074,9 +1285,12 @@ export function ComboBoxListBox<T>(props: ComboBoxListBoxProps<T>): JSX.Element
|
|
|
1074
1285
|
}
|
|
1075
1286
|
|
|
1076
1287
|
/**
|
|
1077
|
-
* An
|
|
1288
|
+
* An item in a combobox listbox.
|
|
1289
|
+
*
|
|
1290
|
+
* Local addition: RAC ComboBox uses {@link ListBoxItem}. Prefer that when
|
|
1291
|
+
* composing the headless ComboBox. This wrapper stays for existing call sites.
|
|
1078
1292
|
*/
|
|
1079
|
-
export function
|
|
1293
|
+
export function ComboBoxItem<T>(props: ComboBoxItemProps<T>): JSX.Element {
|
|
1080
1294
|
const [local, ariaProps] = splitProps(props, [
|
|
1081
1295
|
"class",
|
|
1082
1296
|
"style",
|
|
@@ -1091,7 +1305,7 @@ export function ComboBoxOption<T>(props: ComboBoxOptionProps<T>): JSX.Element {
|
|
|
1091
1305
|
const stateContext = useContext(ComboBoxStateContext);
|
|
1092
1306
|
const comboBoxContext = useContext(ComboBoxContext);
|
|
1093
1307
|
if (!stateContext || !comboBoxContext) {
|
|
1094
|
-
throw new Error("
|
|
1308
|
+
throw new Error("ComboBoxItem must be used within a ComboBox");
|
|
1095
1309
|
}
|
|
1096
1310
|
const state = stateContext as ComboBoxState<T>;
|
|
1097
1311
|
const listState = (comboBoxContext as ComboBoxContextValue<T>).listState;
|
|
@@ -1101,12 +1315,18 @@ export function ComboBoxOption<T>(props: ComboBoxOptionProps<T>): JSX.Element {
|
|
|
1101
1315
|
return listBoxId ? `${listBoxId}-option-${local.id}` : String(local.id);
|
|
1102
1316
|
};
|
|
1103
1317
|
|
|
1104
|
-
|
|
1318
|
+
createTrackedEffect(() => {
|
|
1319
|
+
const _s2Cleanups: Array<() => void> = [];
|
|
1320
|
+
|
|
1105
1321
|
const key = local.id;
|
|
1106
1322
|
comboBoxContext?.registerOptionAction(key, local.onAction);
|
|
1107
|
-
|
|
1323
|
+
_s2Cleanups.push(() => {
|
|
1108
1324
|
comboBoxContext?.registerOptionAction(key, undefined);
|
|
1109
1325
|
});
|
|
1326
|
+
|
|
1327
|
+
return () => {
|
|
1328
|
+
for (const c of _s2Cleanups) c();
|
|
1329
|
+
};
|
|
1110
1330
|
});
|
|
1111
1331
|
|
|
1112
1332
|
// Create option aria props using ComboBoxState's ListState-compatible interface
|
|
@@ -1143,18 +1363,13 @@ export function ComboBoxOption<T>(props: ComboBoxOptionProps<T>): JSX.Element {
|
|
|
1143
1363
|
() => ref(),
|
|
1144
1364
|
);
|
|
1145
1365
|
|
|
1146
|
-
//
|
|
1147
|
-
//
|
|
1148
|
-
//
|
|
1149
|
-
//
|
|
1150
|
-
//
|
|
1151
|
-
//
|
|
1152
|
-
//
|
|
1153
|
-
// three-term product collapses to these two. Reading the global singleton off
|
|
1154
|
-
// the `isFocused` dependency gives the same non-reactive snapshot semantics as
|
|
1155
|
-
// React (mouse/hover focus → pointer modality → no ring; keyboard nav → keyboard
|
|
1156
|
-
// modality → ring), which the earlier input-ring OR-branch got wrong (it lit the
|
|
1157
|
-
// option ring whenever the input ring was on).
|
|
1366
|
+
// useOption.ts:182, read live: the option is focused and the global modality
|
|
1367
|
+
// is not pointer. This is the global modality, not the input's focus ring
|
|
1368
|
+
// and not an option-local ring (the option div never receives real DOM focus
|
|
1369
|
+
// under virtual focus). `optionAria.isFocused()` already includes
|
|
1370
|
+
// `selectionManager.isFocused` (createSelectableItem.ts:239).
|
|
1371
|
+
// `isGlobalFocusVisible()` tracks the modality counter, so this memo re-runs
|
|
1372
|
+
// when that counter publishes.
|
|
1158
1373
|
const isOptionFocusVisible = () => optionAria.isFocused() && isGlobalFocusVisible();
|
|
1159
1374
|
|
|
1160
1375
|
const renderValues = createMemo<ComboBoxOptionRenderProps>(() => ({
|
|
@@ -1187,8 +1402,53 @@ export function ComboBoxOption<T>(props: ComboBoxOptionProps<T>): JSX.Element {
|
|
|
1187
1402
|
return rest;
|
|
1188
1403
|
};
|
|
1189
1404
|
|
|
1405
|
+
const optionTextSlots = {
|
|
1406
|
+
slots: {
|
|
1407
|
+
get [DEFAULT_SLOT]() {
|
|
1408
|
+
return optionAria.labelProps;
|
|
1409
|
+
},
|
|
1410
|
+
get label() {
|
|
1411
|
+
return optionAria.labelProps;
|
|
1412
|
+
},
|
|
1413
|
+
get description() {
|
|
1414
|
+
return optionAria.descriptionProps;
|
|
1415
|
+
},
|
|
1416
|
+
},
|
|
1417
|
+
};
|
|
1418
|
+
|
|
1419
|
+
// Styled hosts emit `<span slot="label">` rather than `<Text>`. Stamp the
|
|
1420
|
+
// slot id onto that node so `createSlotId` can resolve `aria-labelledby`.
|
|
1421
|
+
// Render-prop children recreate the span when `isFocused` flips (End/Home);
|
|
1422
|
+
// observe childList so the replacement node keeps the same id.
|
|
1423
|
+
createRenderEffect(
|
|
1424
|
+
() => ({
|
|
1425
|
+
el: ref(),
|
|
1426
|
+
labelId: optionAria.labelProps.id,
|
|
1427
|
+
descriptionId: optionAria.descriptionProps.id,
|
|
1428
|
+
}),
|
|
1429
|
+
({ el, labelId, descriptionId }) => {
|
|
1430
|
+
if (!el) return;
|
|
1431
|
+
const stamp = () => {
|
|
1432
|
+
if (labelId) {
|
|
1433
|
+
const label = el.querySelector("[slot='label']");
|
|
1434
|
+
if (label && label.id !== labelId) label.id = labelId;
|
|
1435
|
+
}
|
|
1436
|
+
if (descriptionId) {
|
|
1437
|
+
const description = el.querySelector("[slot='description']");
|
|
1438
|
+
if (description && description.id !== descriptionId) description.id = descriptionId;
|
|
1439
|
+
}
|
|
1440
|
+
};
|
|
1441
|
+
stamp();
|
|
1442
|
+
const observer = new MutationObserver(stamp);
|
|
1443
|
+
observer.observe(el, { childList: true, subtree: true });
|
|
1444
|
+
return () => observer.disconnect();
|
|
1445
|
+
},
|
|
1446
|
+
);
|
|
1447
|
+
|
|
1448
|
+
const selectionMode = () => listState.selectionMode();
|
|
1449
|
+
|
|
1190
1450
|
return (
|
|
1191
|
-
<SelectionIndicatorContext
|
|
1451
|
+
<SelectionIndicatorContext value={selectionIndicatorContext()}>
|
|
1192
1452
|
{/* `<div role="option">`, not `<li>` — see the ComboBoxListBox note; the
|
|
1193
1453
|
`role` comes from the spread option aria props (createOption). */}
|
|
1194
1454
|
<div
|
|
@@ -1199,16 +1459,22 @@ export function ComboBoxOption<T>(props: ComboBoxOptionProps<T>): JSX.Element {
|
|
|
1199
1459
|
{...cleanOptionProps()}
|
|
1200
1460
|
class={renderProps.class()}
|
|
1201
1461
|
style={renderProps.style()}
|
|
1202
|
-
data-selected={optionAria.isSelected()
|
|
1203
|
-
data-focused={optionAria.isFocused()
|
|
1204
|
-
data-focus-visible={isOptionFocusVisible()
|
|
1205
|
-
data-pressed={optionAria.isPressed()
|
|
1206
|
-
data-hovered={optionAria.isHovered()
|
|
1207
|
-
data-disabled={optionAria.isDisabled()
|
|
1462
|
+
data-selected={dataAttr(optionAria.isSelected())}
|
|
1463
|
+
data-focused={dataAttr(optionAria.isFocused())}
|
|
1464
|
+
data-focus-visible={dataAttr(isOptionFocusVisible())}
|
|
1465
|
+
data-pressed={dataAttr(optionAria.isPressed())}
|
|
1466
|
+
data-hovered={dataAttr(optionAria.isHovered())}
|
|
1467
|
+
data-disabled={dataAttr(optionAria.isDisabled())}
|
|
1468
|
+
data-selection-mode={selectionMode() === "none" ? undefined : selectionMode()}
|
|
1208
1469
|
>
|
|
1209
|
-
{
|
|
1470
|
+
<Provider values={[[TextContext, optionTextSlots] as [Context<unknown>, unknown]]}>
|
|
1471
|
+
<OptionContent
|
|
1472
|
+
render={renderProps.renderChildrenStable}
|
|
1473
|
+
labelProps={optionAria.labelProps}
|
|
1474
|
+
/>
|
|
1475
|
+
</Provider>
|
|
1210
1476
|
</div>
|
|
1211
|
-
</SelectionIndicatorContext
|
|
1477
|
+
</SelectionIndicatorContext>
|
|
1212
1478
|
);
|
|
1213
1479
|
}
|
|
1214
1480
|
|
|
@@ -1296,7 +1562,7 @@ export function ComboBoxTag(props: ComboBoxTagProps): JSX.Element {
|
|
|
1296
1562
|
aria-label={`Remove ${props.item.label}`}
|
|
1297
1563
|
onClick={handleRemove}
|
|
1298
1564
|
class="solidaria-ComboBox-tag-remove"
|
|
1299
|
-
|
|
1565
|
+
tabindex={-1}
|
|
1300
1566
|
>
|
|
1301
1567
|
×
|
|
1302
1568
|
</button>
|
|
@@ -1307,7 +1573,12 @@ export function ComboBoxTag(props: ComboBoxTagProps): JSX.Element {
|
|
|
1307
1573
|
ComboBox.Input = ComboBoxInput;
|
|
1308
1574
|
ComboBox.Button = ComboBoxButton;
|
|
1309
1575
|
ComboBox.ListBox = ComboBoxListBox;
|
|
1310
|
-
|
|
1576
|
+
/**
|
|
1577
|
+
* @deprecated Use {@link ComboBoxItem}. Local addition — RAC ComboBox uses ListBoxItem. Removed in a future minor.
|
|
1578
|
+
*/
|
|
1579
|
+
export const ComboBoxOption = ComboBoxItem;
|
|
1580
|
+
|
|
1581
|
+
ComboBox.Option = ComboBoxItem;
|
|
1311
1582
|
ComboBox.Label = ComboBoxLabel;
|
|
1312
1583
|
ComboBox.Description = ComboBoxDescription;
|
|
1313
1584
|
ComboBox.ErrorMessage = ComboBoxErrorMessage;
|
|
@@ -1355,6 +1626,10 @@ function createComboBoxListStateAdapter<T>(state: ComboBoxState<T>): ListState<T
|
|
|
1355
1626
|
toggleSelection: (key) => state.select(key),
|
|
1356
1627
|
replaceSelection: (key) => state.select(key),
|
|
1357
1628
|
setSelectedKeys: (keys) => {
|
|
1629
|
+
if (state.selectionMode() === "multiple") {
|
|
1630
|
+
state.setSelectedKeys(new Set(keys));
|
|
1631
|
+
return;
|
|
1632
|
+
}
|
|
1358
1633
|
const first = keys[Symbol.iterator]().next().value as Key | undefined;
|
|
1359
1634
|
state.setSelectedKey(first ?? null);
|
|
1360
1635
|
},
|