@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/ListBox.jsx
CHANGED
|
@@ -1,21 +1,35 @@
|
|
|
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/ListBox.tsx
|
|
13
|
+
import { DEFAULT_SLOT, OptionContent, Provider, dataAttr, filterDOMProps, useRenderProps } from "./utils.jsx";
|
|
14
|
+
import { TextContext } from "./Text.jsx";
|
|
2
15
|
import { SharedElementTransition } from "./SharedElementTransition.jsx";
|
|
3
16
|
import { SelectionIndicatorContext } from "./SelectionIndicator.jsx";
|
|
4
|
-
import { CollectionRendererContext, Group, Header, Section, flattenCollectionEntries, isCollectionSection, useCollectionRenderer } from "./Collection.jsx";
|
|
5
|
-
import {
|
|
17
|
+
import { CollectionRendererContext, Group, Header, Section, flattenCollectionEntries, isCollectionSection, useCollectionRenderer, useCollectionRoot } from "./Collection.jsx";
|
|
18
|
+
import { i as VirtualizerItem, o as useVirtualizerContext, t as PersistedVirtualItem } from "./Virtualizer2.jsx";
|
|
6
19
|
import { useAutocompleteCollection } from "./Autocomplete.jsx";
|
|
7
|
-
import { DropIndicatorContext, getNormalizedDropTargetKey, mergePersistedKeysIntoVirtualRange, useDndPersistedKeys, useRenderDropIndicator } from "./DragAndDrop.jsx";
|
|
8
|
-
import { For, Show, createContext, createEffect, createMemo,
|
|
9
|
-
import { CLEAR_FOCUS_EVENT, FOCUS_EVENT,
|
|
20
|
+
import { DropIndicatorContext, getNormalizedDropTargetKey, indexesOutsideRange, mergePersistedKeysIntoVirtualRange, useDndPersistedKeys, useRenderDropIndicator } from "./DragAndDrop.jsx";
|
|
21
|
+
import { For, Show, createContext, createEffect, createMemo, createRenderEffect, createSignal, createTrackedEffect, untrack, useContext } from "solid-js";
|
|
22
|
+
import { CLEAR_FOCUS_EVENT, FOCUS_EVENT, createFocusRing, createListBox, createOption, createScrollIntoViewOnFocus, createStringFormatter, dndIntlStrings, mergeProps, moveVirtualFocus, useLocale } from "@proyecto-viviana/solidaria";
|
|
23
|
+
import { splitProps } from "@proyecto-viviana/solidaria/utils";
|
|
10
24
|
import { createFilteredListState, createListState } from "@proyecto-viviana/solid-stately";
|
|
11
25
|
//#region src/ListBox.tsx
|
|
12
26
|
/**
|
|
13
27
|
* ListBox component for solidaria-components
|
|
14
28
|
*
|
|
15
29
|
* A pre-wired headless listbox that combines state + aria hooks.
|
|
16
|
-
*
|
|
30
|
+
* Solid adaptation of the pinned ListBox component.
|
|
17
31
|
*/
|
|
18
|
-
function assignRef(ref, el) {
|
|
32
|
+
function assignRef$1(ref, el) {
|
|
19
33
|
if (!ref) return;
|
|
20
34
|
if (typeof ref === "function") ref(el);
|
|
21
35
|
else ref.current = el;
|
|
@@ -23,12 +37,89 @@ function assignRef(ref, el) {
|
|
|
23
37
|
const ListBoxContext = createContext(null);
|
|
24
38
|
const ListBoxStateContext = createContext(null);
|
|
25
39
|
const ListStateContext = ListBoxStateContext;
|
|
40
|
+
function dropIndicatorLabel(target, collection, format) {
|
|
41
|
+
const getText = (key) => {
|
|
42
|
+
if (key == null) return "";
|
|
43
|
+
return collection.getTextValue(key) ?? collection.getItem(key)?.textValue ?? "";
|
|
44
|
+
};
|
|
45
|
+
if (target.dropPosition === "on") return format("dropOnItem", { itemText: getText(target.key) });
|
|
46
|
+
let before;
|
|
47
|
+
let after;
|
|
48
|
+
if (target.dropPosition === "before") {
|
|
49
|
+
const prevKey = collection.getKeyBefore(target.key);
|
|
50
|
+
const prevNode = prevKey != null ? collection.getItem(prevKey) : null;
|
|
51
|
+
before = prevNode?.type === "item" ? prevNode.key : null;
|
|
52
|
+
} else before = target.key;
|
|
53
|
+
if (target.dropPosition === "after") {
|
|
54
|
+
const nextKey = collection.getKeyAfter(target.key);
|
|
55
|
+
const nextNode = nextKey != null ? collection.getItem(nextKey) : null;
|
|
56
|
+
after = nextNode?.type === "item" ? nextNode.key : null;
|
|
57
|
+
} else after = target.key;
|
|
58
|
+
if (before != null && after != null) return format("insertBetween", {
|
|
59
|
+
beforeItemText: getText(before),
|
|
60
|
+
afterItemText: getText(after)
|
|
61
|
+
});
|
|
62
|
+
if (before != null) return format("insertAfter", { itemText: getText(before) });
|
|
63
|
+
if (after != null) return format("insertBefore", { itemText: getText(after) });
|
|
64
|
+
return "";
|
|
65
|
+
}
|
|
66
|
+
/**
|
|
67
|
+
* RAC `ListBox.tsx:662-717` `ListBoxDropIndicatorWrapper` — a stable module-level
|
|
68
|
+
* component so Solid does not remount (and unregister) the indicator on every
|
|
69
|
+
* parent ListBox re-render. `useDropIndicator` owns register + focus
|
|
70
|
+
* (`useDroppableItem.ts:49-88`).
|
|
71
|
+
*/
|
|
72
|
+
function ListBoxDropIndicatorWrapper(props) {
|
|
73
|
+
const listContext = useContext(ListBoxContext);
|
|
74
|
+
const listState = useContext(ListBoxStateContext);
|
|
75
|
+
const [el, setEl] = createSignal(null);
|
|
76
|
+
const dndFormatter = createStringFormatter(dndIntlStrings);
|
|
77
|
+
const dropState = listContext?.dropState;
|
|
78
|
+
const indicator = listContext?.dragAndDropHooks?.useDropIndicator?.({ target: props.target }, dropState, el);
|
|
79
|
+
return <Show when={indicator && !indicator.isHidden}>
|
|
80
|
+
<div {...indicator?.dropIndicatorProps} ref={setEl} role="option" class="solidaria-DropIndicator" aria-label={listState ? dropIndicatorLabel(props.target, listState.collection(), (key, args) => dndFormatter().format(key, args)) : void 0} data-drop-target={dataAttr(indicator?.isDropTarget)} />
|
|
81
|
+
</Show>;
|
|
82
|
+
}
|
|
83
|
+
/**
|
|
84
|
+
* Owns only the collection item. Drop-indicator siblings live in their own
|
|
85
|
+
* components so their tracking cannot remount this node.
|
|
86
|
+
*
|
|
87
|
+
* Comparison hyperscript children (`hc` thunks) are one-shot: if the fragment
|
|
88
|
+
* insert that owns the option also tracks indicator `Show`, the effect
|
|
89
|
+
* re-runs, disposes the option, and Chromium maps focus to
|
|
90
|
+
* `listbox:Permissions`. RAC `ListBoxItem` stays mounted while Collection
|
|
91
|
+
* inserts indicator siblings (`react-aria-components/src/ListBox.tsx`).
|
|
92
|
+
*/
|
|
93
|
+
function ListBoxRenderedItem(props) {
|
|
94
|
+
return untrack(() => {
|
|
95
|
+
const rendered = props.renderItem(props.item);
|
|
96
|
+
return typeof rendered === "function" ? rendered() : rendered;
|
|
97
|
+
});
|
|
98
|
+
}
|
|
99
|
+
function ListBoxDropIndicatorSlot(props) {
|
|
100
|
+
const itemIndex = () => typeof props.itemIndex === "function" ? props.itemIndex() : props.itemIndex;
|
|
101
|
+
return <>{props.renderDropIndicator?.(itemIndex(), props.position)}</>;
|
|
102
|
+
}
|
|
103
|
+
/**
|
|
104
|
+
* Stable per-item row so drop-indicator mount does not remount the option.
|
|
105
|
+
*/
|
|
106
|
+
function ListBoxItemWithDropIndicators(props) {
|
|
107
|
+
const isLast = () => typeof props.isLastInLevel === "function" ? props.isLastInLevel() : props.isLastInLevel;
|
|
108
|
+
return <>
|
|
109
|
+
<ListBoxDropIndicatorSlot itemIndex={props.itemIndex} position="before" renderDropIndicator={props.renderDropIndicator} />
|
|
110
|
+
<ListBoxRenderedItem item={props.item} renderItem={props.renderItem} />
|
|
111
|
+
<Show when={isLast()}>
|
|
112
|
+
<ListBoxDropIndicatorSlot itemIndex={props.itemIndex} position="after" renderDropIndicator={props.renderDropIndicator} />
|
|
113
|
+
</Show>
|
|
114
|
+
</>;
|
|
115
|
+
}
|
|
26
116
|
/**
|
|
27
117
|
* A listbox displays a list of options and allows a user to select one or more of them.
|
|
28
118
|
*/
|
|
29
119
|
function ListBox(props) {
|
|
30
|
-
const contextSlotProps = useContext(ListBoxContext)?.slots?.[props.slot
|
|
31
|
-
const
|
|
120
|
+
const contextSlotProps = useContext(ListBoxContext)?.slots?.[typeof props.slot === "string" ? props.slot : "default"];
|
|
121
|
+
const mergedListBoxProps = contextSlotProps ? mergeProps(contextSlotProps, props) : props;
|
|
122
|
+
const [local, stateProps, ariaProps] = splitProps(mergedListBoxProps, [
|
|
32
123
|
"children",
|
|
33
124
|
"class",
|
|
34
125
|
"style",
|
|
@@ -103,8 +194,7 @@ function ListBox(props) {
|
|
|
103
194
|
};
|
|
104
195
|
const locale = useLocale();
|
|
105
196
|
const parentCollectionRenderer = useCollectionRenderer();
|
|
106
|
-
const listBoxAria = createListBox({
|
|
107
|
-
...ariaProps,
|
|
197
|
+
const listBoxAria = createListBox(mergeProps(ariaProps, {
|
|
108
198
|
get isVirtualized() {
|
|
109
199
|
return parentCollectionRenderer?.isVirtualized ?? ariaProps.isVirtualized;
|
|
110
200
|
},
|
|
@@ -129,10 +219,10 @@ function ListBox(props) {
|
|
|
129
219
|
get direction() {
|
|
130
220
|
return locale().direction;
|
|
131
221
|
}
|
|
132
|
-
}, state, () => listRef());
|
|
222
|
+
}), state, () => listRef());
|
|
133
223
|
const { isFocused, isFocusVisible, focusProps } = createFocusRing();
|
|
134
224
|
const renderValues = createMemo(() => ({
|
|
135
|
-
isFocused:
|
|
225
|
+
isFocused: isFocused(),
|
|
136
226
|
isFocusVisible: isFocusVisible(),
|
|
137
227
|
isDisabled: resolveDisabled(),
|
|
138
228
|
isEmpty: state.collection().size === 0
|
|
@@ -165,7 +255,8 @@ function ListBox(props) {
|
|
|
165
255
|
});
|
|
166
256
|
if (autocompleteCtx) {
|
|
167
257
|
let shouldVirtualFocusFirst = false;
|
|
168
|
-
|
|
258
|
+
createTrackedEffect(() => {
|
|
259
|
+
const _s2Cleanups = [];
|
|
169
260
|
const list = listRef();
|
|
170
261
|
if (!list) return;
|
|
171
262
|
const onFocusEvent = (e) => {
|
|
@@ -181,12 +272,15 @@ function ListBox(props) {
|
|
|
181
272
|
};
|
|
182
273
|
list.addEventListener(FOCUS_EVENT, onFocusEvent);
|
|
183
274
|
list.addEventListener(CLEAR_FOCUS_EVENT, onClearFocusEvent);
|
|
184
|
-
|
|
275
|
+
_s2Cleanups.push(() => {
|
|
185
276
|
list.removeEventListener(FOCUS_EVENT, onFocusEvent);
|
|
186
277
|
list.removeEventListener(CLEAR_FOCUS_EVENT, onClearFocusEvent);
|
|
187
278
|
});
|
|
279
|
+
return () => {
|
|
280
|
+
for (const c of _s2Cleanups) c();
|
|
281
|
+
};
|
|
188
282
|
});
|
|
189
|
-
createEffect(
|
|
283
|
+
createEffect(() => [state.collection().getFirstKey?.() ?? null, state.collection().size], ([firstKey, size]) => {
|
|
190
284
|
if (!shouldVirtualFocusFirst) return;
|
|
191
285
|
if (firstKey == null) {
|
|
192
286
|
const list = listRef();
|
|
@@ -196,18 +290,27 @@ function ListBox(props) {
|
|
|
196
290
|
state.setFocusedKey(firstKey);
|
|
197
291
|
shouldVirtualFocusFirst = false;
|
|
198
292
|
}
|
|
199
|
-
}, { defer: true })
|
|
293
|
+
}, { defer: true });
|
|
200
294
|
createEffect(() => {
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
295
|
+
return {
|
|
296
|
+
key: state.focusedKey(),
|
|
297
|
+
list: listRef(),
|
|
298
|
+
focused: state.isFocused()
|
|
299
|
+
};
|
|
300
|
+
}, ({ key, list, focused }) => {
|
|
301
|
+
if (!list || !focused) return;
|
|
204
302
|
if (key == null) return;
|
|
205
303
|
const el = list.ownerDocument.getElementById(String(key));
|
|
206
304
|
if (el) moveVirtualFocus(el);
|
|
207
305
|
});
|
|
208
306
|
}
|
|
209
|
-
const isEmpty = () => stateProps.items.length === 0;
|
|
210
307
|
const getItemNodes = createMemo(() => Array.from(state.collection()).filter((node) => node.type === "item"));
|
|
308
|
+
const collectionItems = createMemo(() => getItemNodes().map((node) => node.value));
|
|
309
|
+
const isEmpty = () => state.collection().size === 0;
|
|
310
|
+
const isLastDropItem = (itemIndex) => {
|
|
311
|
+
const i = typeof itemIndex === "function" ? itemIndex() : itemIndex;
|
|
312
|
+
return getItemNodes().length > 0 && i === getItemNodes().length - 1;
|
|
313
|
+
};
|
|
211
314
|
const getDropTargetByIndex = (index, position) => {
|
|
212
315
|
const node = getItemNodes()[index];
|
|
213
316
|
if (!node) return null;
|
|
@@ -221,37 +324,27 @@ function ListBox(props) {
|
|
|
221
324
|
const hooks = local.dragAndDropHooks;
|
|
222
325
|
return Boolean(hooks?.useDroppableCollectionState && hooks.useDroppableCollection && (hooks.dropTargetDelegate || parentCollectionRenderer?.dropTargetDelegate || hooks.ListDropTargetDelegate));
|
|
223
326
|
});
|
|
224
|
-
const
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
const
|
|
327
|
+
const dropStateValue = hasDroppableDnd() ? local.dragAndDropHooks?.useDroppableCollectionState?.({ get collection() {
|
|
328
|
+
return state.collection();
|
|
329
|
+
} }) : void 0;
|
|
330
|
+
const dropState = () => dropStateValue;
|
|
331
|
+
const dragStateValue = createMemo(() => {
|
|
229
332
|
const hooks = local.dragAndDropHooks;
|
|
230
333
|
return Boolean(hooks?.useDraggableCollectionState && hooks.useDraggableCollection);
|
|
231
|
-
})
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
if (!hooks?.useDraggableCollection || !activeDragState) return;
|
|
241
|
-
hooks.useDraggableCollection({}, activeDragState, () => listRef());
|
|
242
|
-
});
|
|
243
|
-
const droppableCollection = createMemo(() => {
|
|
334
|
+
})() ? local.dragAndDropHooks?.useDraggableCollectionState?.({
|
|
335
|
+
items: flatItems(),
|
|
336
|
+
collection: state.collection(),
|
|
337
|
+
selectedKeys: state.selectionManager.selectedKeys,
|
|
338
|
+
isSelected: (key) => state.selectionManager.isSelected(key)
|
|
339
|
+
}) : void 0;
|
|
340
|
+
const dragState = () => dragStateValue;
|
|
341
|
+
if (local.dragAndDropHooks?.useDraggableCollection && dragStateValue) local.dragAndDropHooks.useDraggableCollection({}, dragStateValue, () => listRef());
|
|
342
|
+
const droppableCollectionValue = (() => {
|
|
244
343
|
if (!hasDroppableDnd()) return void 0;
|
|
245
344
|
const hooks = local.dragAndDropHooks;
|
|
246
|
-
const activeDropState =
|
|
345
|
+
const activeDropState = dropStateValue;
|
|
247
346
|
if (!hooks?.useDroppableCollection || !activeDropState) return void 0;
|
|
248
|
-
const resolveDirection = () =>
|
|
249
|
-
const el = listRef();
|
|
250
|
-
if (el && typeof window !== "undefined" && typeof window.getComputedStyle === "function") {
|
|
251
|
-
if (window.getComputedStyle(el).direction === "rtl") return "rtl";
|
|
252
|
-
}
|
|
253
|
-
return typeof document !== "undefined" && document.dir === "rtl" ? "rtl" : "ltr";
|
|
254
|
-
};
|
|
347
|
+
const resolveDirection = () => locale().direction;
|
|
255
348
|
const dropTargetDelegate = hooks.dropTargetDelegate ?? parentCollectionRenderer?.dropTargetDelegate ?? (hooks.ListDropTargetDelegate ? new hooks.ListDropTargetDelegate(() => state.collection(), () => listRef(), {
|
|
256
349
|
layout: "stack",
|
|
257
350
|
orientation: "vertical",
|
|
@@ -268,12 +361,18 @@ function ListBox(props) {
|
|
|
268
361
|
getKeyPageBelow: (key) => state.collection().getKeyAfter(key),
|
|
269
362
|
getKeyPageAbove: (key) => state.collection().getKeyBefore(key)
|
|
270
363
|
},
|
|
271
|
-
|
|
272
|
-
|
|
364
|
+
get collection() {
|
|
365
|
+
return state.collection();
|
|
366
|
+
},
|
|
367
|
+
get selectedKeys() {
|
|
368
|
+
return state.selectionManager.selectedKeys;
|
|
369
|
+
},
|
|
273
370
|
setSelectedKeys: (keys) => state.selectionManager.setSelectedKeys(keys),
|
|
274
|
-
setFocusedKey: (key) => state.setFocusedKey(key)
|
|
371
|
+
setFocusedKey: (key) => state.setFocusedKey(key),
|
|
372
|
+
setFocused: (isFocused) => state.setFocused(isFocused)
|
|
275
373
|
}, activeDropState, () => listRef());
|
|
276
|
-
});
|
|
374
|
+
})();
|
|
375
|
+
const droppableCollection = () => droppableCollectionValue;
|
|
277
376
|
const isRootDropTarget = createMemo(() => {
|
|
278
377
|
return Boolean(dropState()?.target?.type === "root");
|
|
279
378
|
});
|
|
@@ -283,93 +382,32 @@ function ListBox(props) {
|
|
|
283
382
|
if (!target || target.type !== "item") return void 0;
|
|
284
383
|
return dndRenderDropIndicator()?.(target);
|
|
285
384
|
};
|
|
286
|
-
const
|
|
287
|
-
const
|
|
288
|
-
const dropIndicatorTargetsEqual = (a, b) => !!a && a.type === "item" && a.key === b.key && a.dropPosition === b.dropPosition;
|
|
289
|
-
const dropIndicatorLabel = (target) => {
|
|
290
|
-
const collection = state.collection();
|
|
291
|
-
const getText = (key) => {
|
|
292
|
-
if (key == null) return "";
|
|
293
|
-
return collection.getTextValue(key) ?? collection.getItem(key)?.textValue ?? "";
|
|
294
|
-
};
|
|
295
|
-
if (target.dropPosition === "on") return dndFormatter().format("dropOnItem", { itemText: getText(target.key) });
|
|
296
|
-
let before;
|
|
297
|
-
let after;
|
|
298
|
-
if (target.dropPosition === "before") {
|
|
299
|
-
const prevKey = collection.getKeyBefore(target.key);
|
|
300
|
-
const prevNode = prevKey != null ? collection.getItem(prevKey) : null;
|
|
301
|
-
before = prevNode?.type === "item" ? prevNode.key : null;
|
|
302
|
-
} else before = target.key;
|
|
303
|
-
if (target.dropPosition === "after") {
|
|
304
|
-
const nextKey = collection.getKeyAfter(target.key);
|
|
305
|
-
const nextNode = nextKey != null ? collection.getItem(nextKey) : null;
|
|
306
|
-
after = nextNode?.type === "item" ? nextNode.key : null;
|
|
307
|
-
} else after = target.key;
|
|
308
|
-
if (before != null && after != null) return dndFormatter().format("insertBetween", {
|
|
309
|
-
beforeItemText: getText(before),
|
|
310
|
-
afterItemText: getText(after)
|
|
311
|
-
});
|
|
312
|
-
if (before != null) return dndFormatter().format("insertAfter", { itemText: getText(before) });
|
|
313
|
-
if (after != null) return dndFormatter().format("insertBefore", { itemText: getText(after) });
|
|
314
|
-
return "";
|
|
315
|
-
};
|
|
316
|
-
const wrapDropTypes = (types) => ({ has: (type) => {
|
|
317
|
-
if (typeof type === "string") return types.has(type);
|
|
318
|
-
if (Array.isArray(type)) return type.some((t) => typeof t === "string" && types.has(t));
|
|
319
|
-
return false;
|
|
320
|
-
} });
|
|
321
|
-
const ListBoxDropIndicator = (props) => {
|
|
322
|
-
const [indicatorRef, setIndicatorRef] = createSignal(null);
|
|
323
|
-
const isDropTarget = createMemo(() => dropIndicatorTargetsEqual(dropState()?.target, props.target));
|
|
324
|
-
const ariaHidden = createMemo(() => !dragSession() ? "true" : isDropTarget() ? void 0 : "true");
|
|
325
|
-
const isHidden = createMemo(() => !isDropTarget() && !!ariaHidden());
|
|
326
|
-
createEffect(() => {
|
|
327
|
-
const el = indicatorRef();
|
|
328
|
-
if (!el) return;
|
|
329
|
-
onCleanup(registerDropItem({
|
|
330
|
-
element: el,
|
|
331
|
-
target: props.target,
|
|
332
|
-
getDropOperation: (types, allowedOperations) => {
|
|
333
|
-
const st = dropState();
|
|
334
|
-
if (!st) return "cancel";
|
|
335
|
-
const isInternal = getGlobalDraggingCollectionRef() === listRef();
|
|
336
|
-
return st.getDropOperation(props.target, wrapDropTypes(types), allowedOperations, isInternal, getGlobalDraggingKeys());
|
|
337
|
-
}
|
|
338
|
-
}));
|
|
339
|
-
if (dragSession() && isDropTarget()) requestAnimationFrame(() => {
|
|
340
|
-
if (dragSession() && isDropTarget() && indicatorRef() === el) el.focus();
|
|
341
|
-
});
|
|
342
|
-
});
|
|
343
|
-
return <Show when={!isHidden()}>
|
|
344
|
-
<div ref={(el) => {
|
|
345
|
-
setIndicatorRef(el);
|
|
346
|
-
onCleanup(() => setIndicatorRef(null));
|
|
347
|
-
}} role="option" class="solidaria-DropIndicator" aria-roledescription={dndFormatter().format("dropIndicator")} aria-label={dropIndicatorLabel(props.target)} aria-hidden={ariaHidden()} tabindex={-1} data-drop-target={isDropTarget() || void 0} />
|
|
348
|
-
</Show>;
|
|
349
|
-
};
|
|
350
|
-
const dropIndicatorContextValue = { render: (p) => <ListBoxDropIndicator target={p.target} /> };
|
|
385
|
+
const renderItemDropIndicator = (index, position) => dndDropIndicator(index, position) ?? parentCollectionRenderer?.renderDropIndicator?.(index, position);
|
|
386
|
+
const dropIndicatorContextValue = { render: (p) => <ListBoxDropIndicatorWrapper {...p} /> };
|
|
351
387
|
const virtualizer = useVirtualizerContext();
|
|
352
388
|
const persistedKeys = useDndPersistedKeys({ focusedKey: state.focusedKey }, local.dragAndDropHooks, dropState(), state.collection());
|
|
353
389
|
const virtualRange = createMemo(() => {
|
|
354
390
|
if (!virtualizer || !parentCollectionRenderer?.isVirtualized || hasSections()) return null;
|
|
355
|
-
const
|
|
391
|
+
const itemCount = getItemNodes().length;
|
|
392
|
+
const baseRange = virtualizer.getVisibleRange(itemCount);
|
|
356
393
|
const itemNodes = getItemNodes();
|
|
357
|
-
const persistedIndexes = Array.from(persistedKeys()).map((key) => itemNodes.findIndex((node) => node.key === key)).filter((index) => index >= 0);
|
|
358
394
|
const dropTarget = dropState()?.target;
|
|
359
395
|
const normalizedDropKey = getNormalizedDropTargetKey(dropTarget, state.collection());
|
|
360
|
-
const
|
|
361
|
-
|
|
362
|
-
const forceIncludeIndexes = [
|
|
363
|
-
dropTarget?.type === "item" ? itemNodes.findIndex((node) => node.key === dropTarget.key) : -1,
|
|
364
|
-
normalizedDropKey != null ? itemNodes.findIndex((node) => node.key === normalizedDropKey) : -1,
|
|
365
|
-
dropTarget?.type === "item" ? -1 : focusedIndex
|
|
366
|
-
].filter((index) => index >= 0);
|
|
367
|
-
return mergePersistedKeysIntoVirtualRange(baseRange, persistedIndexes, stateProps.items.length, virtualizer, 80, {
|
|
396
|
+
const forceIncludeIndexes = [dropTarget?.type === "item" ? itemNodes.findIndex((node) => node.key === dropTarget.key) : -1, normalizedDropKey != null ? itemNodes.findIndex((node) => node.key === normalizedDropKey) : -1].filter((index) => index >= 0);
|
|
397
|
+
return mergePersistedKeysIntoVirtualRange(baseRange, [], itemCount, virtualizer, 80, {
|
|
368
398
|
forceIncludeIndexes,
|
|
369
399
|
forceIncludeMaxSpan: 320
|
|
370
400
|
});
|
|
371
401
|
});
|
|
372
|
-
|
|
402
|
+
const persistedOutsideIndexes = createMemo(() => {
|
|
403
|
+
const range = virtualRange();
|
|
404
|
+
if (!range) return [];
|
|
405
|
+
const itemNodes = getItemNodes();
|
|
406
|
+
const persistedIndexes = Array.from(persistedKeys()).map((key) => itemNodes.findIndex((node) => node.key === key)).filter((index) => index >= 0);
|
|
407
|
+
return indexesOutsideRange(range, persistedIndexes);
|
|
408
|
+
});
|
|
409
|
+
createTrackedEffect(() => {
|
|
410
|
+
const _s2Cleanups = [];
|
|
373
411
|
if (!virtualizer || !parentCollectionRenderer?.isVirtualized) return;
|
|
374
412
|
const getItemNodes = () => Array.from(state.collection()).filter((node) => node.type === "item");
|
|
375
413
|
virtualizer.setDropTargetItemCountResolver(() => getItemNodes().length);
|
|
@@ -385,44 +423,52 @@ function ListBox(props) {
|
|
|
385
423
|
key: typeof node.key === "string" || typeof node.key === "number" ? node.key : void 0
|
|
386
424
|
};
|
|
387
425
|
});
|
|
388
|
-
|
|
426
|
+
_s2Cleanups.push(() => {
|
|
389
427
|
virtualizer.setDropTargetIndexResolver(void 0);
|
|
390
428
|
virtualizer.setDropTargetItemCountResolver(void 0);
|
|
391
429
|
virtualizer.setDropTargetResolver(void 0);
|
|
392
430
|
});
|
|
431
|
+
return () => {
|
|
432
|
+
for (const c of _s2Cleanups) c();
|
|
433
|
+
};
|
|
393
434
|
});
|
|
394
435
|
const visibleItems = createMemo(() => {
|
|
395
436
|
const range = virtualRange();
|
|
396
|
-
|
|
397
|
-
|
|
437
|
+
const items = collectionItems();
|
|
438
|
+
if (!range) return items;
|
|
439
|
+
return items.slice(range.start, range.end);
|
|
398
440
|
});
|
|
399
|
-
const virtualSpacerStyle = (size) => virtualizer?.orientation === "horizontal" ? { width: `${size}px` } : { height: `${size}px` };
|
|
400
441
|
const sectionedRenderEntries = createMemo(() => {
|
|
442
|
+
const values = new Set(collectionItems());
|
|
401
443
|
let globalIndex = 0;
|
|
402
|
-
|
|
403
|
-
|
|
444
|
+
const entries = [];
|
|
445
|
+
for (const entry of stateProps.items) if (isCollectionSection(entry)) {
|
|
446
|
+
const sectionItems = entry.items.filter((item) => values.has(item)).map((item) => ({
|
|
447
|
+
item,
|
|
448
|
+
index: globalIndex++
|
|
449
|
+
}));
|
|
450
|
+
if (sectionItems.length === 0) continue;
|
|
451
|
+
entries.push({
|
|
404
452
|
type: "section",
|
|
405
453
|
section: entry,
|
|
406
|
-
items:
|
|
407
|
-
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
item: entry,
|
|
415
|
-
index: globalIndex++
|
|
416
|
-
}
|
|
417
|
-
};
|
|
454
|
+
items: sectionItems
|
|
455
|
+
});
|
|
456
|
+
} else if (values.has(entry)) entries.push({
|
|
457
|
+
type: "item",
|
|
458
|
+
item: {
|
|
459
|
+
item: entry,
|
|
460
|
+
index: globalIndex++
|
|
461
|
+
}
|
|
418
462
|
});
|
|
463
|
+
return entries;
|
|
419
464
|
});
|
|
420
465
|
const collectionRenderer = createMemo(() => ({
|
|
421
466
|
...parentCollectionRenderer,
|
|
422
467
|
renderItem: (item) => local.children(item),
|
|
423
468
|
renderDropIndicator: (index, position) => dndDropIndicator(index, position) ?? parentCollectionRenderer?.renderDropIndicator?.(index, position)
|
|
424
469
|
}));
|
|
425
|
-
|
|
470
|
+
const CollectionRoot = useCollectionRoot();
|
|
471
|
+
return <ListBoxContext value={{
|
|
426
472
|
state,
|
|
427
473
|
isDisabled: resolveDisabled,
|
|
428
474
|
dragAndDropHooks: local.dragAndDropHooks,
|
|
@@ -430,77 +476,91 @@ function ListBox(props) {
|
|
|
430
476
|
dropState: dropState(),
|
|
431
477
|
slots: local.slots
|
|
432
478
|
}}>
|
|
433
|
-
<ListBoxStateContext
|
|
434
|
-
<CollectionRendererContext
|
|
435
|
-
|
|
436
|
-
|
|
437
|
-
|
|
438
|
-
|
|
439
|
-
|
|
440
|
-
|
|
479
|
+
<ListBoxStateContext value={state}>
|
|
480
|
+
<CollectionRendererContext value={collectionRenderer()}>
|
|
481
|
+
<DropIndicatorContext value={dropIndicatorContextValue}>
|
|
482
|
+
<>
|
|
483
|
+
<Show when={ariaProps.label}>
|
|
484
|
+
<span {...cleanLabelProps()}>{ariaProps.label}</span>
|
|
485
|
+
</Show>
|
|
486
|
+
<div {...mergeProps(domProps(), cleanListBoxProps(), cleanFocusProps(), droppableCollection()?.collectionProps ?? {})} ref={(el) => {
|
|
441
487
|
setListRef(el);
|
|
442
|
-
assignRef(local.ref, el);
|
|
488
|
+
assignRef$1(local.ref, el);
|
|
443
489
|
autocompleteCtx?.collectionRef(el);
|
|
444
|
-
}} class={renderProps.class()} style={renderProps.style()} data-focused={
|
|
445
|
-
|
|
446
|
-
|
|
447
|
-
|
|
448
|
-
|
|
449
|
-
|
|
450
|
-
|
|
451
|
-
|
|
452
|
-
|
|
453
|
-
|
|
454
|
-
|
|
455
|
-
|
|
456
|
-
|
|
457
|
-
|
|
458
|
-
|
|
459
|
-
|
|
460
|
-
|
|
461
|
-
|
|
462
|
-
|
|
463
|
-
|
|
464
|
-
|
|
465
|
-
|
|
466
|
-
|
|
467
|
-
|
|
468
|
-
|
|
469
|
-
|
|
470
|
-
|
|
471
|
-
|
|
472
|
-
|
|
473
|
-
|
|
474
|
-
|
|
475
|
-
|
|
476
|
-
|
|
477
|
-
|
|
478
|
-
|
|
479
|
-
|
|
480
|
-
|
|
481
|
-
|
|
482
|
-
|
|
483
|
-
|
|
484
|
-
|
|
485
|
-
|
|
486
|
-
|
|
487
|
-
|
|
488
|
-
|
|
489
|
-
|
|
490
|
-
|
|
491
|
-
|
|
492
|
-
|
|
493
|
-
|
|
494
|
-
|
|
495
|
-
|
|
496
|
-
|
|
497
|
-
|
|
498
|
-
|
|
490
|
+
}} class={renderProps.class()} style={renderProps.style()} data-focused={dataAttr(isFocused())} data-focus-visible={dataAttr(isFocusVisible())} data-disabled={dataAttr(resolveDisabled())} data-empty={dataAttr(isEmpty())} data-layout={stateProps.layout || "stack"} data-orientation={stateProps.orientation || "vertical"} data-drop-target={dataAttr(isRootDropTarget())} slot={local.slot}>
|
|
491
|
+
<SharedElementTransition>
|
|
492
|
+
{parentCollectionRenderer?.isVirtualized ? <>
|
|
493
|
+
<CollectionRoot collection={virtualRange() ? collectionItems() : []} scrollRef={() => listRef()} persistedKeys={persistedKeys()}>
|
|
494
|
+
{isEmpty() && local.renderEmptyState ? null : hasSections() ? <For each={sectionedRenderEntries()}>
|
|
495
|
+
{(entry) => entry.type === "section" ? <div role="presentation" data-section-wrapper>
|
|
496
|
+
<Section class="solidaria-ListBox-section">
|
|
497
|
+
{entry.section.title != null && <Header class="solidaria-ListBox-sectionHeader">
|
|
498
|
+
{entry.section.title}
|
|
499
|
+
</Header>}
|
|
500
|
+
<Group class="solidaria-ListBox-sectionGroup">
|
|
501
|
+
<div role="group" aria-label={entry.section["aria-label"]}>
|
|
502
|
+
<For each={entry.items}>
|
|
503
|
+
{(indexedItem) => <VirtualizerItem index={indexedItem.index}>
|
|
504
|
+
<ListBoxItemWithDropIndicators item={indexedItem.item} itemIndex={indexedItem.index} isLastInLevel={() => isLastDropItem(indexedItem.index)} renderItem={local.children} renderDropIndicator={renderItemDropIndicator} />
|
|
505
|
+
</VirtualizerItem>}
|
|
506
|
+
</For>
|
|
507
|
+
</div>
|
|
508
|
+
</Group>
|
|
509
|
+
</Section>
|
|
510
|
+
</div> : <VirtualizerItem index={entry.item.index}>
|
|
511
|
+
<ListBoxItemWithDropIndicators item={entry.item.item} itemIndex={entry.item.index} isLastInLevel={() => isLastDropItem(entry.item.index)} renderItem={local.children} renderDropIndicator={renderItemDropIndicator} />
|
|
512
|
+
</VirtualizerItem>}
|
|
513
|
+
</For> : <>
|
|
514
|
+
<For each={visibleItems()}>
|
|
515
|
+
{(item, index) => <VirtualizerItem index={() => (virtualRange()?.start ?? 0) + index()}>
|
|
516
|
+
<ListBoxItemWithDropIndicators item={item} itemIndex={() => (virtualRange()?.start ?? 0) + index()} isLastInLevel={() => isLastDropItem((virtualRange()?.start ?? 0) + index())} renderItem={local.children} renderDropIndicator={renderItemDropIndicator} />
|
|
517
|
+
</VirtualizerItem>}
|
|
518
|
+
</For>
|
|
519
|
+
<For each={persistedOutsideIndexes()}>
|
|
520
|
+
{(index) => <PersistedVirtualItem index={index}>
|
|
521
|
+
<ListBoxItemWithDropIndicators item={collectionItems()[index]} itemIndex={() => index} isLastInLevel={() => isLastDropItem(index)} renderItem={local.children} renderDropIndicator={renderItemDropIndicator} />
|
|
522
|
+
</PersistedVirtualItem>}
|
|
523
|
+
</For>
|
|
524
|
+
</>}
|
|
525
|
+
</CollectionRoot>
|
|
526
|
+
{isEmpty() && local.renderEmptyState ? <div role="option" style={{ display: "contents" }} data-empty-state>
|
|
527
|
+
{local.renderEmptyState()}
|
|
528
|
+
</div> : null}
|
|
529
|
+
</> : isEmpty() && local.renderEmptyState ? <div role="option" style={{ display: "contents" }} data-empty-state>
|
|
530
|
+
{local.renderEmptyState()}
|
|
531
|
+
</div> : hasSections() ? <For each={sectionedRenderEntries()}>
|
|
532
|
+
{(entry) => entry.type === "section" ? <div role="presentation" data-section-wrapper>
|
|
533
|
+
<Section class="solidaria-ListBox-section">
|
|
534
|
+
{entry.section.title != null && <Header class="solidaria-ListBox-sectionHeader">
|
|
535
|
+
{entry.section.title}
|
|
536
|
+
</Header>}
|
|
537
|
+
<Group class="solidaria-ListBox-sectionGroup">
|
|
538
|
+
<div role="group" aria-label={entry.section["aria-label"]}>
|
|
539
|
+
<For each={entry.items}>
|
|
540
|
+
{(indexedItem) => <ListBoxItemWithDropIndicators item={indexedItem.item} itemIndex={indexedItem.index} isLastInLevel={() => isLastDropItem(indexedItem.index)} renderItem={local.children} renderDropIndicator={renderItemDropIndicator} />}
|
|
541
|
+
</For>
|
|
542
|
+
</div>
|
|
543
|
+
</Group>
|
|
544
|
+
</Section>
|
|
545
|
+
</div> : <ListBoxItemWithDropIndicators item={entry.item.item} itemIndex={entry.item.index} isLastInLevel={() => isLastDropItem(entry.item.index)} renderItem={local.children} renderDropIndicator={renderItemDropIndicator} />}
|
|
546
|
+
</For> : <>
|
|
547
|
+
<For each={visibleItems()}>
|
|
548
|
+
{(item, index) => <ListBoxItemWithDropIndicators item={item} itemIndex={() => (virtualRange()?.start ?? 0) + index()} isLastInLevel={() => isLastDropItem((virtualRange()?.start ?? 0) + index())} renderItem={local.children} renderDropIndicator={renderItemDropIndicator} />}
|
|
549
|
+
</For>
|
|
550
|
+
</>}
|
|
551
|
+
</SharedElementTransition>
|
|
552
|
+
{local.hasMore && local.onLoadMore && <ListBoxLoadMoreItem onLoadMore={local.onLoadMore} isLoading={local.isLoading} />}
|
|
553
|
+
</div>
|
|
554
|
+
</>
|
|
555
|
+
</DropIndicatorContext>
|
|
556
|
+
</CollectionRendererContext>
|
|
557
|
+
</ListBoxStateContext>
|
|
558
|
+
</ListBoxContext>;
|
|
499
559
|
}
|
|
500
560
|
/**
|
|
501
|
-
* An
|
|
561
|
+
* An item in a listbox.
|
|
502
562
|
*/
|
|
503
|
-
function
|
|
563
|
+
function ListBoxItem(props) {
|
|
504
564
|
const [local, ariaProps] = splitProps(props, [
|
|
505
565
|
"class",
|
|
506
566
|
"style",
|
|
@@ -511,7 +571,7 @@ function ListBoxOption(props) {
|
|
|
511
571
|
"ref"
|
|
512
572
|
]);
|
|
513
573
|
const context = useContext(ListBoxStateContext);
|
|
514
|
-
if (!context) throw new Error("
|
|
574
|
+
if (!context) throw new Error("ListBoxItem must be used within a ListBox");
|
|
515
575
|
const state = context;
|
|
516
576
|
const listContext = useContext(ListBoxContext);
|
|
517
577
|
const [ref, setRef] = createSignal(null);
|
|
@@ -521,7 +581,7 @@ function ListBoxOption(props) {
|
|
|
521
581
|
return Boolean(ariaProps.isDisabled || listContext?.isDisabled());
|
|
522
582
|
},
|
|
523
583
|
get "aria-label"() {
|
|
524
|
-
return ariaProps["aria-label"]
|
|
584
|
+
return ariaProps["aria-label"];
|
|
525
585
|
},
|
|
526
586
|
get shouldSelectOnPressUp() {
|
|
527
587
|
return ariaProps.shouldSelectOnPressUp;
|
|
@@ -555,9 +615,6 @@ function ListBoxOption(props) {
|
|
|
555
615
|
style: local.style,
|
|
556
616
|
defaultClassName: "solidaria-ListBox-option"
|
|
557
617
|
}, renderValues);
|
|
558
|
-
const hasPrimitiveLabel = () => {
|
|
559
|
-
return typeof props.children === "string" || typeof props.children === "number";
|
|
560
|
-
};
|
|
561
618
|
const selectionIndicatorContext = createMemo(() => ({ isSelected: optionAria.isSelected }));
|
|
562
619
|
const draggableItem = createMemo(() => {
|
|
563
620
|
if (!listContext?.dragAndDropHooks?.useDraggableItem || !listContext.dragState) return void 0;
|
|
@@ -571,26 +628,57 @@ function ListBoxOption(props) {
|
|
|
571
628
|
return listContext.dragAndDropHooks.useDroppableItem({ key: local.id }, listContext.dropState, () => ref());
|
|
572
629
|
});
|
|
573
630
|
const cleanOptionProps = () => {
|
|
574
|
-
const { ref: _ref1,
|
|
575
|
-
if (!hasPrimitiveLabel() && rest["aria-label"] == null) delete rest["aria-labelledby"];
|
|
631
|
+
const { ref: _ref1, ...rest } = optionAria.optionProps;
|
|
576
632
|
return rest;
|
|
577
633
|
};
|
|
634
|
+
const optionTextSlots = { slots: {
|
|
635
|
+
get [DEFAULT_SLOT]() {
|
|
636
|
+
return optionAria.labelProps;
|
|
637
|
+
},
|
|
638
|
+
get label() {
|
|
639
|
+
return optionAria.labelProps;
|
|
640
|
+
},
|
|
641
|
+
get description() {
|
|
642
|
+
return optionAria.descriptionProps;
|
|
643
|
+
}
|
|
644
|
+
} };
|
|
645
|
+
createRenderEffect(() => ({
|
|
646
|
+
el: ref(),
|
|
647
|
+
labelId: optionAria.labelProps.id,
|
|
648
|
+
descriptionId: optionAria.descriptionProps.id
|
|
649
|
+
}), ({ el, labelId, descriptionId }) => {
|
|
650
|
+
if (!el) return;
|
|
651
|
+
if (labelId) {
|
|
652
|
+
const label = el.querySelector("[slot='label']");
|
|
653
|
+
if (label && !label.id) label.id = labelId;
|
|
654
|
+
}
|
|
655
|
+
if (descriptionId) {
|
|
656
|
+
const description = el.querySelector("[slot='description']");
|
|
657
|
+
if (description && !description.id) description.id = descriptionId;
|
|
658
|
+
}
|
|
659
|
+
});
|
|
578
660
|
const domProps = () => filterDOMProps(ariaProps, { global: true });
|
|
579
|
-
|
|
661
|
+
const selectionMode = () => state.selectionMode();
|
|
662
|
+
return <SelectionIndicatorContext value={selectionIndicatorContext()}>
|
|
580
663
|
<div ref={(el) => {
|
|
581
664
|
setRef(el);
|
|
582
|
-
assignRef(local.ref, el);
|
|
583
|
-
|
|
584
|
-
|
|
665
|
+
assignRef$1(local.ref, el);
|
|
666
|
+
const dragRef = (draggableItem()?.dragProps)?.ref;
|
|
667
|
+
if (typeof dragRef === "function") dragRef(el);
|
|
668
|
+
}} {...mergeProps(domProps(), cleanOptionProps(), draggableItem()?.dragProps ?? {}, droppableItem()?.dropProps ?? {})} class={renderProps.class()} style={renderProps.style()} data-selected={dataAttr(optionAria.isSelected())} data-focused={dataAttr(optionAria.isFocused())} data-focus-visible={dataAttr(optionAria.isFocusVisible())} data-pressed={dataAttr(optionAria.isPressed())} data-hovered={dataAttr(optionAria.isHovered())} data-disabled={dataAttr(optionAria.isDisabled())} data-dragging={dataAttr(draggableItem()?.isDragging)} data-drop-target={dataAttr(droppableItem()?.isDropTarget)} data-selection-mode={selectionMode() === "none" ? void 0 : selectionMode()} slot={local.slot}>
|
|
669
|
+
<Provider values={[[TextContext, optionTextSlots]]}>
|
|
670
|
+
<OptionContent render={renderProps.renderChildrenStable} labelProps={optionAria.labelProps} />
|
|
671
|
+
</Provider>
|
|
585
672
|
</div>
|
|
586
|
-
</SelectionIndicatorContext
|
|
673
|
+
</SelectionIndicatorContext>;
|
|
587
674
|
}
|
|
588
675
|
/**
|
|
589
676
|
* Load more sentinel item for listbox collections.
|
|
590
677
|
*/
|
|
591
678
|
function ListBoxLoadMoreItem(props) {
|
|
592
|
-
|
|
679
|
+
const [sentinel, setSentinel] = createSignal();
|
|
593
680
|
const [isPending, setIsPending] = createSignal(false);
|
|
681
|
+
const scrollOffsetValue = createMemo(() => props.scrollOffset ?? 1);
|
|
594
682
|
const isLoading = () => !!props.isLoading || isPending();
|
|
595
683
|
const triggerLoadMore = async () => {
|
|
596
684
|
if (isLoading()) return;
|
|
@@ -601,10 +689,21 @@ function ListBoxLoadMoreItem(props) {
|
|
|
601
689
|
setIsPending(false);
|
|
602
690
|
}
|
|
603
691
|
};
|
|
604
|
-
createEffect(() => {
|
|
692
|
+
createEffect(() => ({
|
|
693
|
+
current: sentinel(),
|
|
694
|
+
scrollOffset: scrollOffsetValue()
|
|
695
|
+
}), ({ current, scrollOffset }) => {
|
|
696
|
+
if (!current || typeof IntersectionObserver !== "function") return;
|
|
697
|
+
const margin = `0px 0px ${100 * scrollOffset}% 0px`;
|
|
698
|
+
const observer = new IntersectionObserver((entries) => {
|
|
699
|
+
if (entries[0]?.isIntersecting) triggerLoadMore();
|
|
700
|
+
}, { rootMargin: margin });
|
|
701
|
+
observer.observe(current);
|
|
702
|
+
return () => observer.disconnect();
|
|
703
|
+
});
|
|
605
704
|
const renderProps = useRenderProps({
|
|
606
705
|
get children() {
|
|
607
|
-
return props.children
|
|
706
|
+
return props.children;
|
|
608
707
|
},
|
|
609
708
|
class: props.class,
|
|
610
709
|
style: props.style,
|
|
@@ -617,17 +716,17 @@ function ListBoxLoadMoreItem(props) {
|
|
|
617
716
|
height: 0,
|
|
618
717
|
overflow: "hidden"
|
|
619
718
|
}} inert>
|
|
620
|
-
<div ref={
|
|
719
|
+
<div data-testid="loadMoreSentinel" ref={setSentinel} style={{
|
|
621
720
|
position: "absolute",
|
|
622
721
|
height: "1px",
|
|
623
722
|
width: "1px"
|
|
624
723
|
}} />
|
|
625
724
|
</div>
|
|
626
|
-
<
|
|
627
|
-
|
|
628
|
-
|
|
629
|
-
|
|
630
|
-
</
|
|
725
|
+
<Show when={isLoading() && props.children}>
|
|
726
|
+
<div role="option" tabindex={-1} class={renderProps.class()} style={renderProps.style()} data-loading>
|
|
727
|
+
{renderProps.renderChildren()}
|
|
728
|
+
</div>
|
|
729
|
+
</Show>
|
|
631
730
|
</>;
|
|
632
731
|
}
|
|
633
732
|
/**
|
|
@@ -636,9 +735,13 @@ function ListBoxLoadMoreItem(props) {
|
|
|
636
735
|
function ListBoxSection(props) {
|
|
637
736
|
return <Section {...props} />;
|
|
638
737
|
}
|
|
639
|
-
|
|
738
|
+
/**
|
|
739
|
+
* @deprecated Use {@link ListBoxItem}. Removed in a future minor.
|
|
740
|
+
*/
|
|
741
|
+
const ListBoxOption = ListBoxItem;
|
|
742
|
+
ListBox.Option = ListBoxItem;
|
|
640
743
|
ListBox.LoadMoreItem = ListBoxLoadMoreItem;
|
|
641
744
|
//#endregion
|
|
642
|
-
export { ListBox, ListBoxContext, ListBoxLoadMoreItem, ListBoxOption, ListBoxSection, ListBoxStateContext, ListStateContext };
|
|
745
|
+
export { ListBox, ListBoxContext, ListBoxItem, ListBoxLoadMoreItem, ListBoxOption, ListBoxSection, ListBoxStateContext, ListStateContext };
|
|
643
746
|
|
|
644
747
|
//# sourceMappingURL=ListBox.jsx.map
|