@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/dist/ComboBox.jsx
CHANGED
|
@@ -1,8 +1,25 @@
|
|
|
1
|
-
|
|
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
|
+
// Ported to SolidJS for Proyecto Viviana; based on packages/react-aria-components/src/ComboBox.tsx
|
|
13
|
+
import { DEFAULT_SLOT, OptionContent, Provider, dataAttr, filterDOMProps, useRenderProps } from "./utils.jsx";
|
|
2
14
|
import { TextContext } from "./Text.jsx";
|
|
15
|
+
import { FieldErrorContext } from "./FieldError.jsx";
|
|
3
16
|
import { SelectionIndicatorContext } from "./SelectionIndicator.jsx";
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
17
|
+
import { useCollectionRenderer, useCollectionRoot } from "./Collection.jsx";
|
|
18
|
+
import { i as VirtualizerItem } from "./Virtualizer2.jsx";
|
|
19
|
+
import { ListBoxLoadMoreItem } from "./ListBox.jsx";
|
|
20
|
+
import { For, Show, createContext, createEffect, createMemo, createRenderEffect, createSignal, createTrackedEffect, onCleanup, useContext } from "solid-js";
|
|
21
|
+
import { createComboBox, createFilter, createFocusRing, createHover, createInteractOutside, createListBox, createOption, createPress, createScrollIntoViewOnFocus, getComboBoxData, isFocusVisible, mergeProps } from "@proyecto-viviana/solidaria";
|
|
22
|
+
import { splitProps } from "@proyecto-viviana/solidaria/utils";
|
|
6
23
|
import { createComboBoxState, defaultContainsFilter } from "@proyecto-viviana/solid-stately";
|
|
7
24
|
//#region src/ComboBox.tsx
|
|
8
25
|
/**
|
|
@@ -11,7 +28,7 @@ import { createComboBoxState, defaultContainsFilter } from "@proyecto-viviana/so
|
|
|
11
28
|
* A pre-wired headless combobox that combines state + aria hooks.
|
|
12
29
|
* Port of react-aria-components/src/ComboBox.tsx
|
|
13
30
|
*/
|
|
14
|
-
function assignRef(ref, el) {
|
|
31
|
+
function assignRef$1(ref, el) {
|
|
15
32
|
if (!ref) return;
|
|
16
33
|
if (typeof ref === "function") ref(el);
|
|
17
34
|
else ref.current = el;
|
|
@@ -27,8 +44,9 @@ function callInputKeyDown(handler, event) {
|
|
|
27
44
|
* A combobox combines a text input with a listbox, allowing users to filter a list of options.
|
|
28
45
|
*/
|
|
29
46
|
function ComboBox(props) {
|
|
30
|
-
const contextSlotProps = useContext(ComboBoxContext)?.slots?.[props.slot
|
|
31
|
-
const
|
|
47
|
+
const contextSlotProps = useContext(ComboBoxContext)?.slots?.[typeof props.slot === "string" ? props.slot : "default"];
|
|
48
|
+
const mergedComboBoxProps = contextSlotProps ? mergeProps(contextSlotProps, props) : props;
|
|
49
|
+
const [local, stateProps, ariaProps] = splitProps(mergedComboBoxProps, [
|
|
32
50
|
"class",
|
|
33
51
|
"style",
|
|
34
52
|
"slot",
|
|
@@ -63,14 +81,16 @@ function ComboBox(props) {
|
|
|
63
81
|
"name",
|
|
64
82
|
"formValue"
|
|
65
83
|
]);
|
|
66
|
-
|
|
84
|
+
const [inputEl, setInputEl] = createSignal(null, { ownedWrite: true });
|
|
67
85
|
let buttonRef = null;
|
|
68
86
|
let triggerRef = null;
|
|
69
87
|
let listBoxRef = null;
|
|
88
|
+
const [popoverRef, setPopoverRef] = createSignal(null);
|
|
70
89
|
const optionActions = /* @__PURE__ */ new Map();
|
|
71
90
|
const runOptionAction = (key) => {
|
|
72
91
|
optionActions.get(key)?.();
|
|
73
92
|
};
|
|
93
|
+
const intlFilter = createFilter({ sensitivity: "base" });
|
|
74
94
|
const state = createComboBoxState({
|
|
75
95
|
get items() {
|
|
76
96
|
return stateProps.items;
|
|
@@ -130,7 +150,7 @@ function ComboBox(props) {
|
|
|
130
150
|
return stateProps.onOpenChange;
|
|
131
151
|
},
|
|
132
152
|
get defaultFilter() {
|
|
133
|
-
return stateProps.defaultFilter;
|
|
153
|
+
return stateProps.defaultFilter ?? intlFilter().contains;
|
|
134
154
|
},
|
|
135
155
|
get allowsCustomValue() {
|
|
136
156
|
return stateProps.allowsCustomValue;
|
|
@@ -165,8 +185,11 @@ function ComboBox(props) {
|
|
|
165
185
|
...comboBoxAriaProps(),
|
|
166
186
|
get name() {
|
|
167
187
|
return effectiveFormValue() === "text" ? stateProps.name : void 0;
|
|
188
|
+
},
|
|
189
|
+
get allowsCustomValue() {
|
|
190
|
+
return stateProps.allowsCustomValue;
|
|
168
191
|
}
|
|
169
|
-
}), state, () =>
|
|
192
|
+
}), state, () => inputEl(), () => buttonRef, () => listBoxRef, () => popoverRef());
|
|
170
193
|
const getInputProps = () => {
|
|
171
194
|
const inputProps = comboBoxAria.inputProps;
|
|
172
195
|
const originalOnKeyDown = inputProps.onKeyDown;
|
|
@@ -180,16 +203,13 @@ function ComboBox(props) {
|
|
|
180
203
|
}
|
|
181
204
|
};
|
|
182
205
|
};
|
|
183
|
-
const { isHovered, hoverProps } = createHover({ get isDisabled() {
|
|
184
|
-
return ariaProps.isDisabled;
|
|
185
|
-
} });
|
|
186
206
|
const renderValues = createMemo(() => ({
|
|
187
207
|
isOpen: comboBoxAria.isOpen(),
|
|
188
208
|
isFocused: comboBoxAria.isFocused(),
|
|
189
209
|
isFocusVisible: comboBoxAria.isFocusVisible(),
|
|
190
210
|
isDisabled: !!ariaProps.isDisabled,
|
|
191
211
|
isRequired: !!ariaProps.isRequired,
|
|
192
|
-
isInvalid:
|
|
212
|
+
isInvalid: comboBoxAria.isInvalid,
|
|
193
213
|
isReadOnly: !!ariaProps.isReadOnly,
|
|
194
214
|
isSelected: state.selectedKey() != null,
|
|
195
215
|
inputValue: state.inputValue()
|
|
@@ -202,10 +222,6 @@ function ComboBox(props) {
|
|
|
202
222
|
const domProps = createMemo(() => {
|
|
203
223
|
return filterDOMProps(ariaProps, { global: true });
|
|
204
224
|
});
|
|
205
|
-
const cleanHoverProps = () => {
|
|
206
|
-
const { ref: _ref, ...rest } = hoverProps;
|
|
207
|
-
return rest;
|
|
208
|
-
};
|
|
209
225
|
const ComboBoxChildren = () => typeof local.children === "function" ? local.children(renderValues()) : local.children;
|
|
210
226
|
const textSlots = { slots: {
|
|
211
227
|
get description() {
|
|
@@ -215,7 +231,19 @@ function ComboBox(props) {
|
|
|
215
231
|
return comboBoxAria.errorMessageProps;
|
|
216
232
|
}
|
|
217
233
|
} };
|
|
218
|
-
|
|
234
|
+
const fieldErrorContext = {
|
|
235
|
+
get validation() {
|
|
236
|
+
return {
|
|
237
|
+
isInvalid: comboBoxAria.isInvalid,
|
|
238
|
+
validationErrors: comboBoxAria.validationErrors,
|
|
239
|
+
validationDetails: comboBoxAria.validationDetails
|
|
240
|
+
};
|
|
241
|
+
},
|
|
242
|
+
get errorMessageProps() {
|
|
243
|
+
return comboBoxAria.errorMessageProps;
|
|
244
|
+
}
|
|
245
|
+
};
|
|
246
|
+
return <ComboBoxContext value={{
|
|
219
247
|
state,
|
|
220
248
|
listState,
|
|
221
249
|
inputProps: getInputProps,
|
|
@@ -236,9 +264,9 @@ function ComboBox(props) {
|
|
|
236
264
|
isFocused: comboBoxAria.isFocused,
|
|
237
265
|
isFocusVisible: comboBoxAria.isFocusVisible,
|
|
238
266
|
items: stateProps.items ?? stateProps.defaultItems ?? [],
|
|
239
|
-
inputRef: () =>
|
|
267
|
+
inputRef: () => inputEl(),
|
|
240
268
|
setInputRef: (el) => {
|
|
241
|
-
|
|
269
|
+
setInputEl(el);
|
|
242
270
|
},
|
|
243
271
|
buttonRef: () => buttonRef,
|
|
244
272
|
setButtonRef: (el) => {
|
|
@@ -252,6 +280,8 @@ function ComboBox(props) {
|
|
|
252
280
|
setListBoxRef: (el) => {
|
|
253
281
|
listBoxRef = el;
|
|
254
282
|
},
|
|
283
|
+
popoverRef,
|
|
284
|
+
setPopoverRef,
|
|
255
285
|
registerOptionAction: (key, action) => {
|
|
256
286
|
if (action) optionActions.set(key, action);
|
|
257
287
|
else optionActions.delete(key);
|
|
@@ -259,21 +289,21 @@ function ComboBox(props) {
|
|
|
259
289
|
runOptionAction,
|
|
260
290
|
slots: local.slots
|
|
261
291
|
}}>
|
|
262
|
-
<ComboBoxStateContext
|
|
263
|
-
<div {...domProps()}
|
|
264
|
-
assignRef(local.ref, el);
|
|
265
|
-
assignRef(local.rootRef, el);
|
|
266
|
-
}} class={renderProps.class()} style={renderProps.style()} data-open={comboBoxAria.isOpen()
|
|
292
|
+
<ComboBoxStateContext value={state}>
|
|
293
|
+
<div {...domProps()} ref={(el) => {
|
|
294
|
+
assignRef$1(local.ref, el);
|
|
295
|
+
assignRef$1(local.rootRef, el);
|
|
296
|
+
}} class={renderProps.class()} style={renderProps.style()} data-open={dataAttr(comboBoxAria.isOpen())} data-focused={dataAttr(comboBoxAria.isFocused())} data-disabled={dataAttr(ariaProps.isDisabled)} data-required={dataAttr(ariaProps.isRequired)} data-invalid={dataAttr(comboBoxAria.isInvalid)} data-readonly={dataAttr(ariaProps.isReadOnly)} slot={local.slot}>
|
|
297
|
+
<Provider values={[[TextContext, textSlots], [FieldErrorContext, fieldErrorContext]]}>
|
|
298
|
+
<ComboBoxChildren />
|
|
299
|
+
</Provider>
|
|
267
300
|
{}
|
|
268
301
|
<Show when={stateProps.name && effectiveFormValue() === "key"}>
|
|
269
302
|
<input type="hidden" name={stateProps.name} form={ariaProps.form} value={state.selectedKey()?.toString() ?? ""} />
|
|
270
303
|
</Show>
|
|
271
|
-
<Provider values={[[TextContext, textSlots]]}>
|
|
272
|
-
<ComboBoxChildren />
|
|
273
|
-
</Provider>
|
|
274
304
|
</div>
|
|
275
|
-
</ComboBoxStateContext
|
|
276
|
-
</ComboBoxContext
|
|
305
|
+
</ComboBoxStateContext>
|
|
306
|
+
</ComboBoxContext>;
|
|
277
307
|
}
|
|
278
308
|
/**
|
|
279
309
|
* Label element for a combobox.
|
|
@@ -311,7 +341,7 @@ function ComboBoxDescription(props) {
|
|
|
311
341
|
const { ref: _ref, ...rest } = context.descriptionProps();
|
|
312
342
|
return rest;
|
|
313
343
|
};
|
|
314
|
-
return <span {...domProps} {...cleanDescriptionProps()} class={local.class} style={local.style}>
|
|
344
|
+
return <span {...domProps} {...cleanDescriptionProps()} slot={local.slot ?? "description"} class={local.class} style={local.style}>
|
|
315
345
|
{local.children}
|
|
316
346
|
</span>;
|
|
317
347
|
}
|
|
@@ -331,7 +361,7 @@ function ComboBoxErrorMessage(props) {
|
|
|
331
361
|
const { ref: _ref, ...rest } = context.errorMessageProps();
|
|
332
362
|
return rest;
|
|
333
363
|
};
|
|
334
|
-
return <span {...domProps} {...cleanErrorMessageProps()} class={local.class} style={local.style}>
|
|
364
|
+
return <span {...domProps} {...cleanErrorMessageProps()} slot={local.slot ?? "errorMessage"} class={local.class} style={local.style}>
|
|
335
365
|
{local.children}
|
|
336
366
|
</span>;
|
|
337
367
|
}
|
|
@@ -368,14 +398,14 @@ function ComboBoxInput(props) {
|
|
|
368
398
|
defaultClassName: "solidaria-ComboBox-input"
|
|
369
399
|
}, renderValues);
|
|
370
400
|
const cleanInputProps = () => {
|
|
371
|
-
const { ref: _ref1, value: _value, ...rest } = context.inputProps();
|
|
401
|
+
const { ref: _ref1, value: _value, "data-open": _dataOpen, ...rest } = context.inputProps();
|
|
372
402
|
return rest;
|
|
373
403
|
};
|
|
374
404
|
const cleanHoverProps = () => {
|
|
375
405
|
const { ref: _ref2, ...rest } = hoverProps;
|
|
376
406
|
return rest;
|
|
377
407
|
};
|
|
378
|
-
return <input {...domProps} ref={(el) => setInputRef(el)} {...cleanInputProps()} {...cleanHoverProps()} value={state.inputValue()} class={renderProps.class()} style={renderProps.style()} data-
|
|
408
|
+
return <input {...domProps} ref={(el) => setInputRef(el)} {...cleanInputProps()} {...cleanHoverProps()} value={state.inputValue()} class={renderProps.class()} style={renderProps.style()} data-focused={dataAttr(isFocused())} data-focus-visible={dataAttr(isFocusVisible())} data-hovered={dataAttr(isHovered())} data-disabled={dataAttr(state.isDisabled)} />;
|
|
379
409
|
}
|
|
380
410
|
function ComboBoxValue(props) {
|
|
381
411
|
const context = useContext(ComboBoxContext);
|
|
@@ -408,7 +438,7 @@ function ComboBoxValue(props) {
|
|
|
408
438
|
selectedText: selectedText(),
|
|
409
439
|
state
|
|
410
440
|
}));
|
|
411
|
-
return <span class={renderProps.class()} style={renderProps.style()} data-placeholder={isPlaceholder()
|
|
441
|
+
return <span class={renderProps.class()} style={renderProps.style()} data-placeholder={dataAttr(isPlaceholder())}>
|
|
412
442
|
{props.children ? renderProps.renderChildren() : isPlaceholder() ? props.placeholder : textValue()}
|
|
413
443
|
</span>;
|
|
414
444
|
}
|
|
@@ -425,15 +455,22 @@ function ComboBoxButton(props) {
|
|
|
425
455
|
]);
|
|
426
456
|
const context = useContext(ComboBoxContext);
|
|
427
457
|
if (!context) throw new Error("ComboBoxButton must be used within a ComboBox");
|
|
428
|
-
const { isOpen,
|
|
458
|
+
const { isOpen, state, setButtonRef } = context;
|
|
429
459
|
const { isHovered, hoverProps } = createHover({ get isDisabled() {
|
|
430
460
|
return state.isDisabled;
|
|
431
461
|
} });
|
|
462
|
+
const { isFocused, isFocusVisible, focusProps } = createFocusRing();
|
|
463
|
+
const { isPressed, pressProps } = createPress({
|
|
464
|
+
get isDisabled() {
|
|
465
|
+
return state.isDisabled || state.isReadOnly;
|
|
466
|
+
},
|
|
467
|
+
preventFocusOnPress: true
|
|
468
|
+
});
|
|
432
469
|
const renderValues = createMemo(() => ({
|
|
433
470
|
isOpen: isOpen(),
|
|
434
471
|
isFocused: isFocused(),
|
|
435
472
|
isHovered: isHovered(),
|
|
436
|
-
isPressed:
|
|
473
|
+
isPressed: isPressed(),
|
|
437
474
|
isDisabled: state.isDisabled
|
|
438
475
|
}));
|
|
439
476
|
const renderProps = useRenderProps({
|
|
@@ -445,17 +482,26 @@ function ComboBoxButton(props) {
|
|
|
445
482
|
defaultClassName: "solidaria-ComboBox-button"
|
|
446
483
|
}, renderValues);
|
|
447
484
|
const cleanButtonProps = () => {
|
|
448
|
-
const { ref: _ref1, ...rest } = context.buttonProps();
|
|
485
|
+
const { ref: _ref1, "data-open": _dataOpen, ...rest } = context.buttonProps();
|
|
449
486
|
return rest;
|
|
450
487
|
};
|
|
451
488
|
const cleanHoverProps = () => {
|
|
452
489
|
const { ref: _ref2, ...rest } = hoverProps;
|
|
453
490
|
return rest;
|
|
454
491
|
};
|
|
455
|
-
|
|
492
|
+
const cleanFocusProps = () => {
|
|
493
|
+
const { ref: _ref3, ...rest } = focusProps;
|
|
494
|
+
return rest;
|
|
495
|
+
};
|
|
496
|
+
const cleanPressProps = () => {
|
|
497
|
+
const { ref: _ref4, ...rest } = pressProps;
|
|
498
|
+
return rest;
|
|
499
|
+
};
|
|
500
|
+
const mergedButtonProps = () => mergeProps(domProps, cleanButtonProps(), cleanHoverProps(), cleanFocusProps(), cleanPressProps());
|
|
501
|
+
return <button {...mergedButtonProps()} ref={(el) => {
|
|
456
502
|
setButtonRef(el);
|
|
457
|
-
assignRef(local.ref, el);
|
|
458
|
-
}}
|
|
503
|
+
assignRef$1(local.ref, el);
|
|
504
|
+
}} class={renderProps.class()} style={renderProps.style()} data-pressed={dataAttr(isPressed())} data-focused={dataAttr(isFocused())} data-focus-visible={dataAttr(isFocusVisible())} data-hovered={dataAttr(isHovered())} data-disabled={dataAttr(state.isDisabled)}>
|
|
459
505
|
{renderProps.renderChildren()}
|
|
460
506
|
</button>;
|
|
461
507
|
}
|
|
@@ -467,12 +513,17 @@ function ComboBoxListBox(props) {
|
|
|
467
513
|
"class",
|
|
468
514
|
"style",
|
|
469
515
|
"slot",
|
|
470
|
-
"children"
|
|
516
|
+
"children",
|
|
517
|
+
"renderEmptyState",
|
|
518
|
+
"onLoadMore",
|
|
519
|
+
"isLoading",
|
|
520
|
+
"renderLoadMore",
|
|
521
|
+
"loadMoreClass"
|
|
471
522
|
]);
|
|
472
523
|
const rawContext = useContext(ComboBoxContext);
|
|
473
524
|
if (!rawContext) throw new Error("ComboBoxListBox must be used within a ComboBox");
|
|
474
525
|
const context = rawContext;
|
|
475
|
-
const { state: comboBoxState, listState, isOpen, inputRef, buttonRef, setListBoxRef } = context;
|
|
526
|
+
const { state: comboBoxState, listState, isOpen, inputRef, buttonRef, setListBoxRef, setPopoverRef } = context;
|
|
476
527
|
const state = comboBoxState;
|
|
477
528
|
let listBoxRef;
|
|
478
529
|
createScrollIntoViewOnFocus({
|
|
@@ -488,14 +539,22 @@ function ComboBoxListBox(props) {
|
|
|
488
539
|
const button = buttonRef();
|
|
489
540
|
if (input?.contains(target)) return;
|
|
490
541
|
if (button?.contains(target)) return;
|
|
542
|
+
if (target.closest("[role=\"listbox\"]") || target.closest("[role=\"option\"]")) return;
|
|
491
543
|
if (isOpen()) state.close();
|
|
492
544
|
},
|
|
493
545
|
get isDisabled() {
|
|
494
546
|
return !isOpen();
|
|
495
547
|
}
|
|
496
548
|
});
|
|
497
|
-
const
|
|
498
|
-
const
|
|
549
|
+
const parentCollectionRenderer = useCollectionRenderer();
|
|
550
|
+
const CollectionRoot = useCollectionRoot();
|
|
551
|
+
const isVirtualized = () => parentCollectionRenderer?.isVirtualized === true;
|
|
552
|
+
const { listBoxProps } = createListBox(() => ({
|
|
553
|
+
...context.listBoxProps(),
|
|
554
|
+
isVirtualized: parentCollectionRenderer?.isVirtualized
|
|
555
|
+
}), listState);
|
|
556
|
+
const { isFocused: isListBoxFocused, isFocusVisible: isListBoxFocusVisible, focusProps } = createFocusRing();
|
|
557
|
+
const renderValues = createMemo(() => ({ isFocused: isListBoxFocused() }));
|
|
499
558
|
const renderProps = useRenderProps({
|
|
500
559
|
class: local.class,
|
|
501
560
|
style: local.style,
|
|
@@ -509,6 +568,10 @@ function ComboBoxListBox(props) {
|
|
|
509
568
|
const { ref: _ref2, ...rest } = listBoxProps;
|
|
510
569
|
return rest;
|
|
511
570
|
};
|
|
571
|
+
const cleanFocusProps = () => {
|
|
572
|
+
const { ref: _ref3, ...rest } = focusProps;
|
|
573
|
+
return rest;
|
|
574
|
+
};
|
|
512
575
|
const items = () => Array.from(state.collection());
|
|
513
576
|
const getNodeValue = (node) => {
|
|
514
577
|
if (node.value != null) return node.value;
|
|
@@ -517,33 +580,63 @@ function ComboBoxListBox(props) {
|
|
|
517
580
|
return (candidate.key ?? candidate.id ?? index) === node.key;
|
|
518
581
|
}) ?? null;
|
|
519
582
|
};
|
|
583
|
+
const [listBoxEl, setListBoxEl] = createSignal(null, { ownedWrite: true });
|
|
584
|
+
createEffect(() => listBoxEl(), (el) => {
|
|
585
|
+
if (!el) {
|
|
586
|
+
setPopoverRef(null);
|
|
587
|
+
return;
|
|
588
|
+
}
|
|
589
|
+
const overlay = el.closest("[data-placement]");
|
|
590
|
+
setPopoverRef(overlay instanceof HTMLElement ? overlay : el);
|
|
591
|
+
});
|
|
520
592
|
const setListBoxElement = (el) => {
|
|
521
593
|
listBoxRef = el;
|
|
522
594
|
setListBoxRef(el);
|
|
595
|
+
setListBoxEl(el);
|
|
596
|
+
onCleanup(() => {
|
|
597
|
+
listBoxRef = void 0;
|
|
598
|
+
setListBoxRef(null);
|
|
599
|
+
setListBoxEl(null);
|
|
600
|
+
setPopoverRef(null);
|
|
601
|
+
});
|
|
523
602
|
};
|
|
524
|
-
onCleanup(() => {
|
|
525
|
-
setListBoxRef(null);
|
|
526
|
-
});
|
|
527
603
|
return <Show when={isOpen()}>
|
|
528
604
|
{}
|
|
529
|
-
<div {...domProps} ref={setListBoxElement} {...cleanContextProps()} {...cleanListBoxProps()} class={renderProps.class()} style={renderProps.style()} data-focused={state.
|
|
530
|
-
<
|
|
531
|
-
|
|
532
|
-
|
|
533
|
-
|
|
534
|
-
|
|
605
|
+
<div {...domProps} ref={setListBoxElement} {...cleanContextProps()} {...cleanListBoxProps()} {...cleanFocusProps()} class={renderProps.class()} style={renderProps.style()} data-focused={dataAttr(isListBoxFocused())} data-focus-visible={dataAttr(isListBoxFocusVisible())} data-empty={dataAttr(state.collection().size === 0)} data-layout="stack" data-orientation="vertical">
|
|
606
|
+
<CollectionRoot collection={items()} scrollRef={() => listBoxEl()}>
|
|
607
|
+
<Show when={local.children} fallback={<For each={items()}>
|
|
608
|
+
{(node, index) => {
|
|
609
|
+
const item = <ComboBoxItem id={node.key}>{node.textValue}</ComboBoxItem>;
|
|
610
|
+
return isVirtualized() ? <VirtualizerItem index={index()}>{item}</VirtualizerItem> : item;
|
|
611
|
+
}}
|
|
612
|
+
</For>}>
|
|
613
|
+
<For each={items()}>
|
|
614
|
+
{(node, index) => {
|
|
535
615
|
const value = getNodeValue(node);
|
|
536
|
-
|
|
616
|
+
const child = value != null ? local.children(value) : null;
|
|
617
|
+
return isVirtualized() ? <VirtualizerItem index={index()}>{child}</VirtualizerItem> : child;
|
|
537
618
|
}}
|
|
538
|
-
|
|
619
|
+
</For>
|
|
620
|
+
</Show>
|
|
621
|
+
</CollectionRoot>
|
|
622
|
+
{state.collection().size === 0 && local.renderEmptyState ? <div role="option" style={{ display: "contents" }} data-empty-state>
|
|
623
|
+
{local.renderEmptyState()}
|
|
624
|
+
</div> : null}
|
|
625
|
+
<Show when={local.onLoadMore}>
|
|
626
|
+
<ListBoxLoadMoreItem onLoadMore={local.onLoadMore} isLoading={local.isLoading} class={local.loadMoreClass}>
|
|
627
|
+
{local.renderLoadMore?.()}
|
|
628
|
+
</ListBoxLoadMoreItem>
|
|
539
629
|
</Show>
|
|
540
630
|
</div>
|
|
541
631
|
</Show>;
|
|
542
632
|
}
|
|
543
633
|
/**
|
|
544
|
-
* An
|
|
634
|
+
* An item in a combobox listbox.
|
|
635
|
+
*
|
|
636
|
+
* Local addition: RAC ComboBox uses {@link ListBoxItem}. Prefer that when
|
|
637
|
+
* composing the headless ComboBox. This wrapper stays for existing call sites.
|
|
545
638
|
*/
|
|
546
|
-
function
|
|
639
|
+
function ComboBoxItem(props) {
|
|
547
640
|
const [local, ariaProps] = splitProps(props, [
|
|
548
641
|
"class",
|
|
549
642
|
"style",
|
|
@@ -556,7 +649,7 @@ function ComboBoxOption(props) {
|
|
|
556
649
|
]);
|
|
557
650
|
const stateContext = useContext(ComboBoxStateContext);
|
|
558
651
|
const comboBoxContext = useContext(ComboBoxContext);
|
|
559
|
-
if (!stateContext || !comboBoxContext) throw new Error("
|
|
652
|
+
if (!stateContext || !comboBoxContext) throw new Error("ComboBoxItem must be used within a ComboBox");
|
|
560
653
|
const state = stateContext;
|
|
561
654
|
const listState = comboBoxContext.listState;
|
|
562
655
|
const [ref, setRef] = createSignal(null);
|
|
@@ -564,12 +657,16 @@ function ComboBoxOption(props) {
|
|
|
564
657
|
const listBoxId = getComboBoxData(state)?.listBoxId;
|
|
565
658
|
return listBoxId ? `${listBoxId}-option-${local.id}` : String(local.id);
|
|
566
659
|
};
|
|
567
|
-
|
|
660
|
+
createTrackedEffect(() => {
|
|
661
|
+
const _s2Cleanups = [];
|
|
568
662
|
const key = local.id;
|
|
569
663
|
comboBoxContext?.registerOptionAction(key, local.onAction);
|
|
570
|
-
|
|
664
|
+
_s2Cleanups.push(() => {
|
|
571
665
|
comboBoxContext?.registerOptionAction(key, void 0);
|
|
572
666
|
});
|
|
667
|
+
return () => {
|
|
668
|
+
for (const c of _s2Cleanups) c();
|
|
669
|
+
};
|
|
573
670
|
});
|
|
574
671
|
const optionAria = createOption({
|
|
575
672
|
key: local.id,
|
|
@@ -621,15 +718,53 @@ function ComboBoxOption(props) {
|
|
|
621
718
|
const { ref: _ref1, ...rest } = optionAria.optionProps;
|
|
622
719
|
return rest;
|
|
623
720
|
};
|
|
624
|
-
|
|
721
|
+
const optionTextSlots = { slots: {
|
|
722
|
+
get [DEFAULT_SLOT]() {
|
|
723
|
+
return optionAria.labelProps;
|
|
724
|
+
},
|
|
725
|
+
get label() {
|
|
726
|
+
return optionAria.labelProps;
|
|
727
|
+
},
|
|
728
|
+
get description() {
|
|
729
|
+
return optionAria.descriptionProps;
|
|
730
|
+
}
|
|
731
|
+
} };
|
|
732
|
+
createRenderEffect(() => ({
|
|
733
|
+
el: ref(),
|
|
734
|
+
labelId: optionAria.labelProps.id,
|
|
735
|
+
descriptionId: optionAria.descriptionProps.id
|
|
736
|
+
}), ({ el, labelId, descriptionId }) => {
|
|
737
|
+
if (!el) return;
|
|
738
|
+
const stamp = () => {
|
|
739
|
+
if (labelId) {
|
|
740
|
+
const label = el.querySelector("[slot='label']");
|
|
741
|
+
if (label && label.id !== labelId) label.id = labelId;
|
|
742
|
+
}
|
|
743
|
+
if (descriptionId) {
|
|
744
|
+
const description = el.querySelector("[slot='description']");
|
|
745
|
+
if (description && description.id !== descriptionId) description.id = descriptionId;
|
|
746
|
+
}
|
|
747
|
+
};
|
|
748
|
+
stamp();
|
|
749
|
+
const observer = new MutationObserver(stamp);
|
|
750
|
+
observer.observe(el, {
|
|
751
|
+
childList: true,
|
|
752
|
+
subtree: true
|
|
753
|
+
});
|
|
754
|
+
return () => observer.disconnect();
|
|
755
|
+
});
|
|
756
|
+
const selectionMode = () => listState.selectionMode();
|
|
757
|
+
return <SelectionIndicatorContext value={selectionIndicatorContext()}>
|
|
625
758
|
{}
|
|
626
759
|
<div ref={(el) => {
|
|
627
760
|
setRef(el);
|
|
628
|
-
assignRef(local.ref, el);
|
|
629
|
-
}} {...cleanOptionProps()} class={renderProps.class()} style={renderProps.style()} data-selected={optionAria.isSelected()
|
|
630
|
-
{
|
|
761
|
+
assignRef$1(local.ref, el);
|
|
762
|
+
}} {...cleanOptionProps()} class={renderProps.class()} style={renderProps.style()} data-selected={dataAttr(optionAria.isSelected())} data-focused={dataAttr(optionAria.isFocused())} data-focus-visible={dataAttr(isOptionFocusVisible())} data-pressed={dataAttr(optionAria.isPressed())} data-hovered={dataAttr(optionAria.isHovered())} data-disabled={dataAttr(optionAria.isDisabled())} data-selection-mode={selectionMode() === "none" ? void 0 : selectionMode()}>
|
|
763
|
+
<Provider values={[[TextContext, optionTextSlots]]}>
|
|
764
|
+
<OptionContent render={renderProps.renderChildrenStable} labelProps={optionAria.labelProps} />
|
|
765
|
+
</Provider>
|
|
631
766
|
</div>
|
|
632
|
-
</SelectionIndicatorContext
|
|
767
|
+
</SelectionIndicatorContext>;
|
|
633
768
|
}
|
|
634
769
|
/**
|
|
635
770
|
* Renders selected items as tags in multi-select mode.
|
|
@@ -661,7 +796,7 @@ function ComboBoxTag(props) {
|
|
|
661
796
|
};
|
|
662
797
|
return <span class={props.class ?? "solidaria-ComboBox-tag"} style={props.style} data-key={String(props.item.key)}>
|
|
663
798
|
{props.children ?? props.item.label}
|
|
664
|
-
<button type="button" aria-label={`Remove ${props.item.label}`} onClick={handleRemove} class="solidaria-ComboBox-tag-remove"
|
|
799
|
+
<button type="button" aria-label={`Remove ${props.item.label}`} onClick={handleRemove} class="solidaria-ComboBox-tag-remove" tabindex={-1}>
|
|
665
800
|
×
|
|
666
801
|
</button>
|
|
667
802
|
</span>;
|
|
@@ -669,7 +804,11 @@ function ComboBoxTag(props) {
|
|
|
669
804
|
ComboBox.Input = ComboBoxInput;
|
|
670
805
|
ComboBox.Button = ComboBoxButton;
|
|
671
806
|
ComboBox.ListBox = ComboBoxListBox;
|
|
672
|
-
|
|
807
|
+
/**
|
|
808
|
+
* @deprecated Use {@link ComboBoxItem}. Local addition — RAC ComboBox uses ListBoxItem. Removed in a future minor.
|
|
809
|
+
*/
|
|
810
|
+
const ComboBoxOption = ComboBoxItem;
|
|
811
|
+
ComboBox.Option = ComboBoxItem;
|
|
673
812
|
ComboBox.Label = ComboBoxLabel;
|
|
674
813
|
ComboBox.Description = ComboBoxDescription;
|
|
675
814
|
ComboBox.ErrorMessage = ComboBoxErrorMessage;
|
|
@@ -679,7 +818,7 @@ function createComboBoxListStateAdapter(state) {
|
|
|
679
818
|
const selectedKeys = createMemo(() => {
|
|
680
819
|
if (state.selectionMode() === "multiple") return state.selectedKeys();
|
|
681
820
|
const key = state.selectedKey();
|
|
682
|
-
return key != null ? new Set([key]) : /* @__PURE__ */ new Set();
|
|
821
|
+
return key != null ? /* @__PURE__ */ new Set([key]) : /* @__PURE__ */ new Set();
|
|
683
822
|
});
|
|
684
823
|
const disabledKeys = createMemo(() => {
|
|
685
824
|
const keys = /* @__PURE__ */ new Set();
|
|
@@ -708,6 +847,10 @@ function createComboBoxListStateAdapter(state) {
|
|
|
708
847
|
toggleSelection: (key) => state.select(key),
|
|
709
848
|
replaceSelection: (key) => state.select(key),
|
|
710
849
|
setSelectedKeys: (keys) => {
|
|
850
|
+
if (state.selectionMode() === "multiple") {
|
|
851
|
+
state.setSelectedKeys(new Set(keys));
|
|
852
|
+
return;
|
|
853
|
+
}
|
|
711
854
|
const first = keys[Symbol.iterator]().next().value;
|
|
712
855
|
state.setSelectedKey(first ?? null);
|
|
713
856
|
},
|
|
@@ -719,6 +862,6 @@ function createComboBoxListStateAdapter(state) {
|
|
|
719
862
|
};
|
|
720
863
|
}
|
|
721
864
|
//#endregion
|
|
722
|
-
export { ComboBox, ComboBoxButton, ComboBoxContext, ComboBoxDescription, ComboBoxErrorMessage, ComboBoxInput, ComboBoxLabel, ComboBoxListBox, ComboBoxOption, ComboBoxStateContext, ComboBoxTag, ComboBoxTagGroup, ComboBoxValue, ComboBoxValueContext, defaultContainsFilter };
|
|
865
|
+
export { ComboBox, ComboBoxButton, ComboBoxContext, ComboBoxDescription, ComboBoxErrorMessage, ComboBoxInput, ComboBoxItem, ComboBoxLabel, ComboBoxListBox, ComboBoxOption, ComboBoxStateContext, ComboBoxTag, ComboBoxTagGroup, ComboBoxValue, ComboBoxValueContext, defaultContainsFilter };
|
|
723
866
|
|
|
724
867
|
//# sourceMappingURL=ComboBox.jsx.map
|