@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/Collection.d.ts
CHANGED
|
@@ -1,10 +1,4 @@
|
|
|
1
|
-
|
|
2
|
-
* Collection composition primitives for solidaria-components.
|
|
3
|
-
*
|
|
4
|
-
* Foundational parity layer for React Spectrum-style composition:
|
|
5
|
-
* Section / Header / Group.
|
|
6
|
-
*/
|
|
7
|
-
import { type JSX } from "solid-js";
|
|
1
|
+
import type { JSX } from "@solidjs/web";
|
|
8
2
|
import type { Key } from "@proyecto-viviana/solid-stately";
|
|
9
3
|
import type { DragTypes, DropOperation, DropTarget } from "@proyecto-viviana/solid-stately";
|
|
10
4
|
import { createLeafComponent, createBranchComponent, type CollectionProps as AriaCollectionProps, type CollectionBuilderProps as AriaCollectionBuilderProps } from "@proyecto-viviana/solidaria";
|
|
@@ -33,6 +27,14 @@ export interface CollectionRendererContextValue<T> {
|
|
|
33
27
|
dropTargetDelegate?: CollectionDropTargetDelegate;
|
|
34
28
|
/** Optional drop indicator renderer for DnD-aware collection paths. */
|
|
35
29
|
renderDropIndicator?: (index: number, position: "before" | "after" | "on") => JSX.Element | undefined;
|
|
30
|
+
/**
|
|
31
|
+
* Root renderer for collection items. RAC `CollectionRenderer.CollectionRoot`
|
|
32
|
+
* (`Collection.tsx:196`). Virtualizer replaces this with a scroll-attached
|
|
33
|
+
* content wrapper (`react-aria-components/src/Virtualizer.tsx:99-151`).
|
|
34
|
+
*/
|
|
35
|
+
CollectionRoot?: (props: CollectionRootProps<T>) => JSX.Element;
|
|
36
|
+
/** Branch renderer for nested collection items. RAC `CollectionBranch`. */
|
|
37
|
+
CollectionBranch?: (props: CollectionBranchProps<T>) => JSX.Element;
|
|
36
38
|
}
|
|
37
39
|
export type CollectionEntry<T> = T | CollectionSection<T>;
|
|
38
40
|
export interface CollectionSection<T> {
|
|
@@ -89,11 +91,21 @@ export interface CollectionBranchProps<T> {
|
|
|
89
91
|
export interface CollectionRootProps<T> {
|
|
90
92
|
collection: Iterable<T>;
|
|
91
93
|
persistedKeys?: Set<Key> | null;
|
|
94
|
+
/**
|
|
95
|
+
* The collection element that scrolls. RAC `CollectionRootProps.scrollRef`
|
|
96
|
+
* (`Collection.tsx:183`).
|
|
97
|
+
*/
|
|
98
|
+
scrollRef?: () => HTMLElement | null | undefined;
|
|
92
99
|
renderDropIndicator?: (target: {
|
|
93
100
|
type: "item";
|
|
94
101
|
key: Key;
|
|
95
102
|
dropPosition: "before" | "after" | "on";
|
|
96
103
|
}) => JSX.Element | undefined;
|
|
104
|
+
/**
|
|
105
|
+
* Rendered collection items. RAC CollectionRoot renders `node.render()` from
|
|
106
|
+
* the collection; Solid collections pass the already-composed item tree.
|
|
107
|
+
*/
|
|
108
|
+
children?: JSX.Element;
|
|
97
109
|
}
|
|
98
110
|
export interface CollectionRenderer<T = unknown> {
|
|
99
111
|
isVirtualized?: boolean;
|
|
@@ -109,12 +121,26 @@ export declare const GroupContext: import("solid-js").Context<Partial<GroupProps
|
|
|
109
121
|
export declare const HeaderContext: import("solid-js").Context<Partial<HeaderProps> | null>;
|
|
110
122
|
export declare const HeadingContext: import("solid-js").Context<Partial<HeaderProps> | null>;
|
|
111
123
|
export declare function useCollectionRenderer<T>(): CollectionRendererContextValue<T> | null;
|
|
124
|
+
/** RAC collections always render `CollectionRoot` from the renderer context. */
|
|
125
|
+
export declare function useCollectionRoot<T>(): (props: CollectionRootProps<T>) => JSX.Element;
|
|
112
126
|
export declare function isCollectionSection<T>(entry: CollectionEntry<T>): entry is CollectionSection<T>;
|
|
113
127
|
export declare function flattenCollectionEntries<T>(entries: CollectionEntry<T>[]): T[];
|
|
114
128
|
export declare const DefaultCollectionRenderer: CollectionRenderer<unknown>;
|
|
115
129
|
export declare function CollectionBuilder<T>(props: AriaCollectionBuilderProps<T>): unknown;
|
|
116
130
|
export declare function Collection<T>(props: AriaCollectionProps<T>): unknown;
|
|
117
131
|
export { createLeafComponent, createBranchComponent };
|
|
132
|
+
/**
|
|
133
|
+
* RAC Collection renders `before` + item for every item, and `after` only when
|
|
134
|
+
* the next item in the same level is null (`renderAfterDropIndicators`). The
|
|
135
|
+
* `"on"` position is not a collection-level slot. Index-based hosts (ListBox,
|
|
136
|
+
* GridList, Menu, Table) use this helper so they do not fork the geometry.
|
|
137
|
+
*/
|
|
138
|
+
export declare function renderCollectionDropSlots(options: {
|
|
139
|
+
index: number;
|
|
140
|
+
lastIndex: number;
|
|
141
|
+
renderDropIndicator?: (index: number, position: "before" | "after" | "on") => JSX.Element | undefined;
|
|
142
|
+
children: JSX.Element;
|
|
143
|
+
}): JSX.Element;
|
|
118
144
|
/**
|
|
119
145
|
* A semantic section wrapper for grouped collection content.
|
|
120
146
|
*/
|
package/dist/Collection.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Collection.d.ts","sourceRoot":"","sources":["../src/Collection.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"Collection.d.ts","sourceRoot":"","sources":["../src/Collection.tsx"],"names":[],"mappings":"AA2BA,OAAO,KAAK,EAAE,GAAG,EAAE,MAAM,cAAc,CAAC;AACxC,OAAO,KAAK,EAAE,GAAG,EAAE,MAAM,iCAAiC,CAAC;AAC3D,OAAO,KAAK,EAAE,SAAS,EAAE,aAAa,EAAE,UAAU,EAAE,MAAM,iCAAiC,CAAC;AAC5F,OAAO,EAGL,mBAAmB,EACnB,qBAAqB,EACrB,KAAK,eAAe,IAAI,mBAAmB,EAC3C,KAAK,sBAAsB,IAAI,0BAA0B,EAC1D,MAAM,6BAA6B,CAAC;AAErC,OAAO,EACL,KAAK,mBAAmB,EACxB,KAAK,eAAe,EACpB,KAAK,SAAS,EAGf,MAAM,SAAS,CAAC;AAEjB,MAAM,WAAW,8BAA8B;IAC7C,0DAA0D;IAC1D,WAAW,EAAE,OAAO,CAAC;CACtB;AAED,KAAK,OAAO,CAAC,CAAC,IAAI,CAAC,CAAC,EAAE,EAAE,CAAC,KAAK,IAAI,CAAC,GAAG;IAAE,OAAO,CAAC,EAAE,CAAC,GAAG,IAAI,CAAA;CAAE,GAAG,SAAS,CAAC;AAQzE,MAAM,WAAW,4BAA4B;IAC3C,sBAAsB,CACpB,CAAC,EAAE,MAAM,EACT,CAAC,EAAE,MAAM,EACT,iBAAiB,EAAE,CAAC,MAAM,EAAE,UAAU,KAAK,OAAO,GACjD,UAAU,GAAG,IAAI,CAAC;IACrB,gBAAgB,CACd,MAAM,EAAE,UAAU,EAClB,KAAK,EAAE,SAAS,EAChB,iBAAiB,EAAE,aAAa,EAAE,GACjC,aAAa,CAAC;IACjB,2BAA2B,CAAC,CAC1B,MAAM,EAAE,UAAU,GAAG,IAAI,EACzB,SAAS,EAAE,MAAM,GAAG,UAAU,EAC9B,iBAAiB,EAAE,CAAC,MAAM,E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A2CxD;AAED;;GAEG;AACH,wBAAgB,MAAM,CAAC,KAAK,EAAE,WAAW,GAAG,GAAG,CAAC,OAAO,CAiCtD;AAED;;GAEG;AACH,wBAAgB,KAAK,CAAC,KAAK,EAAE,UAAU,GAAG,GAAG,CAAC,OAAO,CAiCpD"}
|
package/dist/Collection.js
CHANGED
|
@@ -1,16 +1,34 @@
|
|
|
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/Collection.tsx
|
|
13
|
+
// Ported to SolidJS for Proyecto Viviana; based on packages/react-aria-components/src/Group.tsx
|
|
14
|
+
// Ported to SolidJS for Proyecto Viviana; based on packages/react-aria-components/src/Header.tsx
|
|
1
15
|
import { filterDOMProps, useRenderProps } from "./utils.js";
|
|
2
|
-
import { createComponent, getNextElement, insert, memo,
|
|
3
|
-
import { For, createContext, createMemo,
|
|
16
|
+
import { createComponent, getNextElement, insert, memo, ref, runHydrationEvents, scope, spread, template } from "@solidjs/web";
|
|
17
|
+
import { For, createContext, createMemo, useContext } from "solid-js";
|
|
4
18
|
import { Collection as Collection$1, CollectionBuilder as CollectionBuilder$1, createBranchComponent, createLeafComponent } from "@proyecto-viviana/solidaria";
|
|
19
|
+
import { splitProps } from "@proyecto-viviana/solidaria/utils";
|
|
5
20
|
//#region src/Collection.tsx
|
|
6
21
|
/**
|
|
7
22
|
* Collection composition primitives for solidaria-components.
|
|
8
23
|
*
|
|
9
24
|
* Foundational parity layer for React Spectrum-style composition:
|
|
10
|
-
* Section / Header / Group.
|
|
25
|
+
* Section / Header / Group. Based on:
|
|
26
|
+
* - packages/react-aria-components/src/Collection.tsx
|
|
27
|
+
* - packages/react-aria-components/src/Group.tsx
|
|
28
|
+
* - packages/react-aria-components/src/Header.tsx
|
|
11
29
|
*/
|
|
12
|
-
var _tmpl$ =
|
|
13
|
-
function assignRef(ref, el) {
|
|
30
|
+
var _tmpl$ = /* @__PURE__ */ template(`<div>`);
|
|
31
|
+
function assignRef$1(ref, el) {
|
|
14
32
|
if (!ref) return;
|
|
15
33
|
if (typeof ref === "function") ref(el);
|
|
16
34
|
else ref.current = el;
|
|
@@ -24,6 +42,10 @@ const HeadingContext = createContext(null);
|
|
|
24
42
|
function useCollectionRenderer() {
|
|
25
43
|
return useContext(CollectionRendererContext);
|
|
26
44
|
}
|
|
45
|
+
/** RAC collections always render `CollectionRoot` from the renderer context. */
|
|
46
|
+
function useCollectionRoot() {
|
|
47
|
+
return useCollectionRenderer()?.CollectionRoot ?? DefaultCollectionRenderer.CollectionRoot;
|
|
48
|
+
}
|
|
27
49
|
function isCollectionSection(entry) {
|
|
28
50
|
return typeof entry === "object" && entry !== null && Array.isArray(entry.items);
|
|
29
51
|
}
|
|
@@ -34,30 +56,39 @@ function flattenCollectionEntries(entries) {
|
|
|
34
56
|
return flattened;
|
|
35
57
|
}
|
|
36
58
|
function renderCollectionItems(collection, renderDropIndicator) {
|
|
59
|
+
const items = Array.from(collection);
|
|
60
|
+
let lastRenderableIndex = -1;
|
|
61
|
+
for (let i = 0; i < items.length; i++) if (items[i].type !== "content") lastRenderableIndex = i;
|
|
37
62
|
return createComponent(For, {
|
|
38
|
-
each:
|
|
63
|
+
each: items,
|
|
39
64
|
children: (item, index) => {
|
|
40
65
|
const node = item;
|
|
41
66
|
if (node.type === "content") return [];
|
|
42
67
|
const key = node.key ?? index();
|
|
68
|
+
const isLastInLevel = index() === lastRenderableIndex;
|
|
43
69
|
return [
|
|
44
|
-
memo(() =>
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
70
|
+
memo(() => {
|
|
71
|
+
return renderDropIndicator?.({
|
|
72
|
+
type: "item",
|
|
73
|
+
key,
|
|
74
|
+
dropPosition: "before"
|
|
75
|
+
});
|
|
76
|
+
}),
|
|
49
77
|
item,
|
|
50
|
-
memo(() =>
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
78
|
+
memo(() => {
|
|
79
|
+
return isLastInLevel ? renderDropIndicator?.({
|
|
80
|
+
type: "item",
|
|
81
|
+
key,
|
|
82
|
+
dropPosition: "after"
|
|
83
|
+
}) : null;
|
|
84
|
+
})
|
|
55
85
|
];
|
|
56
86
|
}
|
|
57
87
|
});
|
|
58
88
|
}
|
|
59
89
|
const DefaultCollectionRenderer = {
|
|
60
90
|
CollectionRoot(props) {
|
|
91
|
+
if (props.children != null) return props.children;
|
|
61
92
|
return renderCollectionItems(props.collection, props.renderDropIndicator);
|
|
62
93
|
},
|
|
63
94
|
CollectionBranch(props) {
|
|
@@ -71,6 +102,27 @@ function Collection(props) {
|
|
|
71
102
|
return Collection$1(props);
|
|
72
103
|
}
|
|
73
104
|
/**
|
|
105
|
+
* RAC Collection renders `before` + item for every item, and `after` only when
|
|
106
|
+
* the next item in the same level is null (`renderAfterDropIndicators`). The
|
|
107
|
+
* `"on"` position is not a collection-level slot. Index-based hosts (ListBox,
|
|
108
|
+
* GridList, Menu, Table) use this helper so they do not fork the geometry.
|
|
109
|
+
*/
|
|
110
|
+
function renderCollectionDropSlots(options) {
|
|
111
|
+
return [
|
|
112
|
+
memo(() => {
|
|
113
|
+
return options.renderDropIndicator?.(options.index, "before");
|
|
114
|
+
}),
|
|
115
|
+
memo(() => {
|
|
116
|
+
return options.children;
|
|
117
|
+
}),
|
|
118
|
+
memo(() => {
|
|
119
|
+
return memo(() => {
|
|
120
|
+
return options.index === options.lastIndex;
|
|
121
|
+
})() ? options.renderDropIndicator?.(options.index, "after") : null;
|
|
122
|
+
})
|
|
123
|
+
];
|
|
124
|
+
}
|
|
125
|
+
/**
|
|
74
126
|
* A semantic section wrapper for grouped collection content.
|
|
75
127
|
*/
|
|
76
128
|
function Section(props) {
|
|
@@ -96,25 +148,27 @@ function Section(props) {
|
|
|
96
148
|
defaultClassName: "solidaria-Section"
|
|
97
149
|
}, renderValues);
|
|
98
150
|
const filteredDomProps = createMemo(() => filterDOMProps(domProps, { global: true }));
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
return
|
|
117
|
-
})
|
|
151
|
+
var _el$ = getNextElement(_tmpl$);
|
|
152
|
+
ref(() => {
|
|
153
|
+
return (el) => assignRef$1(local.ref, el);
|
|
154
|
+
}, _el$);
|
|
155
|
+
spread(_el$, [filteredDomProps, {
|
|
156
|
+
get "class"() {
|
|
157
|
+
return renderProps.class();
|
|
158
|
+
},
|
|
159
|
+
get style() {
|
|
160
|
+
return renderProps.style();
|
|
161
|
+
},
|
|
162
|
+
get slot() {
|
|
163
|
+
return local.slot;
|
|
164
|
+
},
|
|
165
|
+
"data-section": true
|
|
166
|
+
}], true);
|
|
167
|
+
insert(_el$, scope(() => {
|
|
168
|
+
return renderProps.renderChildren();
|
|
169
|
+
}));
|
|
170
|
+
runHydrationEvents();
|
|
171
|
+
return _el$;
|
|
118
172
|
}
|
|
119
173
|
/**
|
|
120
174
|
* A header/title primitive for collection sections.
|
|
@@ -136,25 +190,25 @@ function Header(props) {
|
|
|
136
190
|
defaultClassName: "solidaria-Header"
|
|
137
191
|
}, renderValues);
|
|
138
192
|
const filteredDomProps = createMemo(() => filterDOMProps(domProps, { global: true }));
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
193
|
+
var _el$2 = getNextElement(_tmpl$);
|
|
194
|
+
spread(_el$2, [filteredDomProps, {
|
|
195
|
+
role: "heading",
|
|
196
|
+
get "class"() {
|
|
197
|
+
return renderProps.class();
|
|
198
|
+
},
|
|
199
|
+
get style() {
|
|
200
|
+
return renderProps.style();
|
|
201
|
+
},
|
|
202
|
+
get slot() {
|
|
203
|
+
return local.slot;
|
|
204
|
+
},
|
|
205
|
+
"data-header": true
|
|
206
|
+
}], true);
|
|
207
|
+
insert(_el$2, scope(() => {
|
|
208
|
+
return renderProps.renderChildren();
|
|
209
|
+
}));
|
|
210
|
+
runHydrationEvents();
|
|
211
|
+
return _el$2;
|
|
158
212
|
}
|
|
159
213
|
/**
|
|
160
214
|
* A grouping primitive for section item containers.
|
|
@@ -176,27 +230,27 @@ function Group(props) {
|
|
|
176
230
|
defaultClassName: "solidaria-Group"
|
|
177
231
|
}, renderValues);
|
|
178
232
|
const filteredDomProps = createMemo(() => filterDOMProps(domProps, { global: true }));
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
233
|
+
var _el$3 = getNextElement(_tmpl$);
|
|
234
|
+
spread(_el$3, [filteredDomProps, {
|
|
235
|
+
role: "group",
|
|
236
|
+
get "class"() {
|
|
237
|
+
return renderProps.class();
|
|
238
|
+
},
|
|
239
|
+
get style() {
|
|
240
|
+
return renderProps.style();
|
|
241
|
+
},
|
|
242
|
+
get slot() {
|
|
243
|
+
return local.slot;
|
|
244
|
+
},
|
|
245
|
+
"data-group": true
|
|
246
|
+
}], true);
|
|
247
|
+
insert(_el$3, scope(() => {
|
|
248
|
+
return renderProps.renderChildren();
|
|
249
|
+
}));
|
|
250
|
+
runHydrationEvents();
|
|
251
|
+
return _el$3;
|
|
198
252
|
}
|
|
199
253
|
//#endregion
|
|
200
|
-
export { Collection, CollectionBuilder, CollectionRendererContext, DefaultCollectionRenderer, Group, GroupContext, Header, HeaderContext, HeadingContext, Section, SectionContext, SelectableCollectionContext, createBranchComponent, createLeafComponent, flattenCollectionEntries, isCollectionSection, useCollectionRenderer };
|
|
254
|
+
export { Collection, CollectionBuilder, CollectionRendererContext, DefaultCollectionRenderer, Group, GroupContext, Header, HeaderContext, HeadingContext, Section, SectionContext, SelectableCollectionContext, createBranchComponent, createLeafComponent, flattenCollectionEntries, isCollectionSection, renderCollectionDropSlots, useCollectionRenderer, useCollectionRoot };
|
|
201
255
|
|
|
202
256
|
//# sourceMappingURL=Collection.js.map
|
package/dist/Collection.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Collection.js","names":["JSX","createContext","createMemo","splitProps","useContext","For","Key","DragTypes","DropOperation","DropTarget","Collection","AriaCollection","CollectionBuilder","AriaCollectionBuilder","createLeafComponent","createBranchComponent","CollectionProps","AriaCollectionProps","CollectionBuilderProps","AriaCollectionBuilderProps","ClassNameOrFunction","StyleOrFunction","SlotProps","useRenderProps","filterDOMProps","CollectionPrimitiveRenderProps","hasChildren","RefLike","el","T","current","assignRef","ref","CollectionDropTargetDelegate","getDropTargetFromPoint","x","y","isValidDropTarget","target","getDropOperation","types","allowedOperations","getKeyboardNavigationTarget","direction","getKeyboardPageNavigationTarget","CollectionRendererContextValue","renderItem","item","Element","isVirtualized","layoutDelegate","dropTargetDelegate","renderDropIndicator","index","position","CollectionEntry","CollectionSection","key","title","items","SectionProps","children","HTMLDivElement","class","style","HeaderProps","GroupProps","SectionContextValue","name","render","props","className","CollectionBranchProps","collection","Iterable","parent","type","dropPosition","CollectionRootProps","persistedKeys","Set","CollectionRenderer","CollectionRoot","CollectionBranch","CollectionRendererContext","SelectableCollectionContext","SectionContext","GroupContext","Partial","HeaderContext","HeadingContext","useCollectionRenderer","isCollectionSection","entry","Array","isArray","flattenCollectionEntries","entries","flattened","push","renderCollectionItems","from","_$createComponent","each","node","_$memo","DefaultCollectionRenderer","Section","sectionContext","nodeEnv","globalThis","process","env","NODE_ENV","console","warn","local","domProps","renderValues","renderProps","defaultClassName","filteredDomProps","global","_el$","_$getNextElement","_tmpl$","_$use","_$spread","_$mergeProps","slot","_$insert","renderChildren","_$runHydrationEvents","Header","_el$2","Group","_el$3"],"sources":["../src/Collection.tsx"],"sourcesContent":["/**\n * Collection composition primitives for solidaria-components.\n *\n * Foundational parity layer for React Spectrum-style composition:\n * Section / Header / Group.\n */\n\nimport { type JSX, createContext, createMemo, splitProps, useContext, For } from \"solid-js\";\nimport type { Key } from \"@proyecto-viviana/solid-stately\";\nimport type { DragTypes, DropOperation, DropTarget } from \"@proyecto-viviana/solid-stately\";\nimport {\n Collection as AriaCollection,\n CollectionBuilder as AriaCollectionBuilder,\n createLeafComponent,\n createBranchComponent,\n type CollectionProps as AriaCollectionProps,\n type CollectionBuilderProps as AriaCollectionBuilderProps,\n} from \"@proyecto-viviana/solidaria\";\nimport {\n type ClassNameOrFunction,\n type StyleOrFunction,\n type SlotProps,\n useRenderProps,\n filterDOMProps,\n} from \"./utils\";\n\nexport interface CollectionPrimitiveRenderProps {\n /** Whether the primitive has visible children content. */\n hasChildren: boolean;\n}\n\ntype RefLike<T> = ((el: T) => void) | { current?: T | null } | undefined;\n\nfunction assignRef<T>(ref: RefLike<T>, el: T): void {\n if (!ref) return;\n if (typeof ref === \"function\") ref(el);\n else ref.current = el;\n}\n\nexport interface CollectionDropTargetDelegate {\n getDropTargetFromPoint(\n x: number,\n y: number,\n isValidDropTarget: (target: DropTarget) => boolean,\n ): DropTarget | null;\n getDropOperation(\n target: DropTarget,\n types: DragTypes,\n allowedOperations: DropOperation[],\n ): DropOperation;\n getKeyboardNavigationTarget?(\n target: DropTarget | null,\n direction: \"next\" | \"previous\",\n isValidDropTarget: (target: DropTarget) => boolean,\n ): DropTarget | null;\n getKeyboardPageNavigationTarget?(\n target: DropTarget | null,\n direction: \"next\" | \"previous\",\n isValidDropTarget: (target: DropTarget) => boolean,\n ): DropTarget | null;\n}\n\nexport interface CollectionRendererContextValue<T> {\n /** Render function used by collection parents to render each item node. */\n renderItem: (item: T) => JSX.Element;\n /** Whether collection rendering is currently virtualized. */\n isVirtualized?: boolean;\n /** Optional layout delegate used by virtualized renderers. */\n layoutDelegate?: unknown;\n /** Optional drop target delegate used by DnD-aware collection paths. */\n dropTargetDelegate?: CollectionDropTargetDelegate;\n /** Optional drop indicator renderer for DnD-aware collection paths. */\n renderDropIndicator?: (\n index: number,\n position: \"before\" | \"after\" | \"on\",\n ) => JSX.Element | undefined;\n}\n\nexport type CollectionEntry<T> = T | CollectionSection<T>;\n\nexport interface CollectionSection<T> {\n /** Optional unique key for the section wrapper. */\n key?: Key;\n /** Optional section header title. */\n title?: JSX.Element;\n /** Optional aria-label for section grouping. */\n \"aria-label\"?: string;\n /** Items contained in the section. */\n items: T[];\n}\n\nexport interface SectionProps extends SlotProps {\n /** Section contents, usually Header + Group/items. */\n children?: JSX.Element;\n /** Ref for the section element. */\n ref?: RefLike<HTMLDivElement>;\n /** The CSS className for the element. */\n class?: ClassNameOrFunction<CollectionPrimitiveRenderProps>;\n /** The inline style for the element. */\n style?: StyleOrFunction<CollectionPrimitiveRenderProps>;\n}\n\nexport interface HeaderProps extends SlotProps {\n /** Header contents, usually section title text. */\n children?: JSX.Element;\n /** Optional heading level when rendered as a heading role. */\n \"aria-level\"?: number;\n /** The CSS className for the element. */\n class?: ClassNameOrFunction<CollectionPrimitiveRenderProps>;\n /** The inline style for the element. */\n style?: StyleOrFunction<CollectionPrimitiveRenderProps>;\n}\n\nexport interface GroupProps extends SlotProps {\n /** Group contents, usually section items. */\n children?: JSX.Element;\n /** The CSS className for the element. */\n class?: ClassNameOrFunction<CollectionPrimitiveRenderProps>;\n /** The inline style for the element. */\n style?: StyleOrFunction<CollectionPrimitiveRenderProps>;\n}\n\ninterface SectionContextValue {\n name: string;\n render: (props: SectionProps, className?: string) => JSX.Element;\n}\n\nexport interface CollectionBranchProps<T> {\n collection: Iterable<T>;\n parent?: unknown;\n renderDropIndicator?: (target: {\n type: \"item\";\n key: Key;\n dropPosition: \"before\" | \"after\" | \"on\";\n }) => JSX.Element | undefined;\n}\n\nexport interface CollectionRootProps<T> {\n collection: Iterable<T>;\n persistedKeys?: Set<Key> | null;\n renderDropIndicator?: (target: {\n type: \"item\";\n key: Key;\n dropPosition: \"before\" | \"after\" | \"on\";\n }) => JSX.Element | undefined;\n}\n\nexport interface CollectionRenderer<T = unknown> {\n isVirtualized?: boolean;\n layoutDelegate?: unknown;\n dropTargetDelegate?: CollectionDropTargetDelegate;\n CollectionRoot: (props: CollectionRootProps<T>) => JSX.Element;\n CollectionBranch: (props: CollectionBranchProps<T>) => JSX.Element;\n}\n\nexport const CollectionRendererContext =\n createContext<CollectionRendererContextValue<unknown> | null>(null);\nexport const SelectableCollectionContext = CollectionRendererContext;\nexport const SectionContext = createContext<SectionContextValue | null>(null);\nexport const GroupContext = createContext<Partial<GroupProps> | null>(null);\nexport const HeaderContext = createContext<Partial<HeaderProps> | null>(null);\nexport const HeadingContext = createContext<Partial<HeaderProps> | null>(null);\n\nexport function useCollectionRenderer<T>(): CollectionRendererContextValue<T> | null {\n return useContext(CollectionRendererContext) as CollectionRendererContextValue<T> | null;\n}\n\nexport function isCollectionSection<T>(entry: CollectionEntry<T>): entry is CollectionSection<T> {\n return (\n typeof entry === \"object\" &&\n entry !== null &&\n Array.isArray((entry as CollectionSection<T>).items)\n );\n}\n\nexport function flattenCollectionEntries<T>(entries: CollectionEntry<T>[]): T[] {\n const flattened: T[] = [];\n for (const entry of entries) {\n if (isCollectionSection(entry)) flattened.push(...entry.items);\n else flattened.push(entry);\n }\n return flattened;\n}\n\nfunction renderCollectionItems<T>(\n collection: Iterable<T>,\n renderDropIndicator?: (target: {\n type: \"item\";\n key: Key;\n dropPosition: \"before\" | \"after\" | \"on\";\n }) => JSX.Element | undefined,\n): JSX.Element {\n const items = Array.from(collection);\n return (\n <For each={items}>\n {(item, index) => {\n const node = item as { type?: unknown; key?: Key };\n if (node.type === \"content\") {\n // Content rows are rendered by their owning item/section branch.\n return <></>;\n }\n const key = node.key ?? index();\n return (\n <>\n {renderDropIndicator?.({ type: \"item\", key, dropPosition: \"before\" })}\n {item as unknown as JSX.Element}\n {renderDropIndicator?.({ type: \"item\", key, dropPosition: \"after\" })}\n </>\n );\n }}\n </For>\n );\n}\n\nexport const DefaultCollectionRenderer: CollectionRenderer<unknown> = {\n CollectionRoot(props) {\n return renderCollectionItems(props.collection, props.renderDropIndicator);\n },\n CollectionBranch(props) {\n return renderCollectionItems(props.collection, props.renderDropIndicator);\n },\n};\n\nexport function CollectionBuilder<T>(props: AriaCollectionBuilderProps<T>): unknown {\n return AriaCollectionBuilder(props);\n}\n\nexport function Collection<T>(props: AriaCollectionProps<T>): unknown {\n return AriaCollection(props);\n}\n\nexport { createLeafComponent, createBranchComponent };\n\n/**\n * A semantic section wrapper for grouped collection content.\n */\nexport function Section(props: SectionProps): JSX.Element {\n const sectionContext = useContext(SectionContext);\n if (sectionContext) {\n const nodeEnv = (globalThis as { process?: { env?: { NODE_ENV?: string } } }).process?.env\n ?.NODE_ENV;\n if (nodeEnv !== \"production\") {\n console.warn(`<Section> is deprecated. Please use <${sectionContext.name}> instead.`);\n }\n return sectionContext.render(props, \"solidaria-Section\");\n }\n\n const [local, domProps] = splitProps(props, [\"children\", \"class\", \"style\", \"slot\", \"ref\"]);\n\n const renderValues = createMemo<CollectionPrimitiveRenderProps>(() => ({\n hasChildren: local.children != null,\n }));\n\n const renderProps = useRenderProps(\n {\n get children() {\n return local.children;\n },\n class: local.class,\n style: local.style,\n defaultClassName: \"solidaria-Section\",\n },\n renderValues,\n );\n\n const filteredDomProps = createMemo(() => filterDOMProps(domProps, { global: true }));\n\n return (\n <div\n ref={(el) => assignRef(local.ref, el)}\n {...filteredDomProps()}\n class={renderProps.class()}\n style={renderProps.style()}\n slot={local.slot}\n data-section\n >\n {renderProps.renderChildren()}\n </div>\n );\n}\n\n/**\n * A header/title primitive for collection sections.\n */\nexport function Header(props: HeaderProps): JSX.Element {\n const [local, domProps] = splitProps(props, [\"children\", \"class\", \"style\", \"slot\"]);\n\n const renderValues = createMemo<CollectionPrimitiveRenderProps>(() => ({\n hasChildren: local.children != null,\n }));\n\n const renderProps = useRenderProps(\n {\n get children() {\n return local.children;\n },\n class: local.class,\n style: local.style,\n defaultClassName: \"solidaria-Header\",\n },\n renderValues,\n );\n\n const filteredDomProps = createMemo(() => filterDOMProps(domProps, { global: true }));\n\n return (\n <div\n {...filteredDomProps()}\n role=\"heading\"\n class={renderProps.class()}\n style={renderProps.style()}\n slot={local.slot}\n data-header\n >\n {renderProps.renderChildren()}\n </div>\n );\n}\n\n/**\n * A grouping primitive for section item containers.\n */\nexport function Group(props: GroupProps): JSX.Element {\n const [local, domProps] = splitProps(props, [\"children\", \"class\", \"style\", \"slot\"]);\n\n const renderValues = createMemo<CollectionPrimitiveRenderProps>(() => ({\n hasChildren: local.children != null,\n }));\n\n const renderProps = useRenderProps(\n {\n get children() {\n return local.children;\n },\n class: local.class,\n style: local.style,\n defaultClassName: \"solidaria-Group\",\n },\n renderValues,\n );\n\n const filteredDomProps = createMemo(() => filterDOMProps(domProps, { global: true }));\n\n return (\n <div\n {...filteredDomProps()}\n role=\"group\"\n class={renderProps.class()}\n style={renderProps.style()}\n slot={local.slot}\n data-group\n >\n {renderProps.renderChildren()}\n </div>\n );\n}\n"],"mappings":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D;EACf;EACAE,OAAOqD,MAAMrD;EACbC,OAAOoD,MAAMpD;EACbwD,kBAAkB;CACpB,GACAF,YACF;CAEA,MAAMG,mBAAmBvH,iBAAiBsB,eAAe6F,UAAU,EAAEK,QAAQ,KAAK,CAAC,CAAC;CAEpF,cAAA;EAAA,IAAAc,QAAAZ,eAAAC,MAAA;EAAAE,OAAAS,OAAAR,WAEQP,kBAAgB;GAAA,QACf;GAAO,KAAA,WAAA;IAAA,OACLF,YAAYxD,MAAM;GAAC;GAAA,IAC1BC,QAAK;IAAA,OAAEuD,YAAYvD,MAAM;GAAC;GAAA,IAC1BiE,OAAI;IAAA,OAAEb,MAAMa;GAAI;GAAA,cAAA;EAAA,CAAA,GAAA,OAAA,IAAA;EAAAC,OAAAM,aAGfjB,YAAYY,eAAe,CAAC;EAAAC,mBAAA;EAAA,OAAAI;CAAA,EAAA,CAAA;AAGnC"}
|
|
1
|
+
{"version":3,"file":"Collection.js","names":["<For each={items}>\n {(item, index) => {\n const node = item as { type?: unknown; key?: Key };\n if (node.type === \"content\") {\n // Content rows are rendered by their owning item/section branch.\n return <></>;\n }\n const key = node.key ?? index();\n const isLastInLevel = index() === lastRenderableIndex;\n return (\n <>\n {renderDropIndicator?.({ type: \"item\", key, dropPosition: \"before\" })}\n {item as unknown as JSX.Element}\n {isLastInLevel\n ? renderDropIndicator?.({ type: \"item\", key, dropPosition: \"after\" })\n : null}\n </>\n );\n }}\n </For>","each={items}","{renderDropIndicator?.({ type: \"item\", key, dropPosition: \"before\" })}","{isLastInLevel\n ? renderDropIndicator?.({ type: \"item\", key, dropPosition: \"after\" })\n : null}","{options.renderDropIndicator?.(options.index, \"before\")}","{options.children}","{options.index === options.lastIndex\n ? options.renderDropIndicator?.(options.index, \"after\")\n : null}","ref={(el) => assignRef(local.ref, el)}","{renderProps.renderChildren()}","<div\n ref={(el) => assignRef(local.ref, el)}\n {...filteredDomProps()}\n class={renderProps.class()}\n style={renderProps.style()}\n slot={local.slot}\n data-section\n >\n {renderProps.renderChildren()}\n </div>","role=\"heading\"","<div\n {...filteredDomProps()}\n role=\"heading\"\n class={renderProps.class()}\n style={renderProps.style()}\n slot={local.slot}\n data-header\n >\n {renderProps.renderChildren()}\n </div>","role=\"group\"","<div\n {...filteredDomProps()}\n role=\"group\"\n class={renderProps.class()}\n style={renderProps.style()}\n slot={local.slot}\n data-group\n >\n {renderProps.renderChildren()}\n </div>"],"sources":["../src/Collection.tsx"],"sourcesContent":["/*\n * Copyright 2022 Adobe. All rights reserved.\n * This file is licensed to you under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License. You may obtain a copy\n * of the License at http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software distributed under\n * the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\n * OF ANY KIND, either express or implied. See the License for the specific language\n * governing permissions and limitations under the License.\n */\n\n// Ported to SolidJS for Proyecto Viviana; based on packages/react-aria-components/src/Collection.tsx\n// Ported to SolidJS for Proyecto Viviana; based on packages/react-aria-components/src/Group.tsx\n// Ported to SolidJS for Proyecto Viviana; based on packages/react-aria-components/src/Header.tsx\n\n/**\n * Collection composition primitives for solidaria-components.\n *\n * Foundational parity layer for React Spectrum-style composition:\n * Section / Header / Group. Based on:\n * - packages/react-aria-components/src/Collection.tsx\n * - packages/react-aria-components/src/Group.tsx\n * - packages/react-aria-components/src/Header.tsx\n */\n\nimport { createContext, createMemo, useContext, For } from \"solid-js\";\nimport type { JSX } from \"@solidjs/web\";\nimport type { Key } from \"@proyecto-viviana/solid-stately\";\nimport type { DragTypes, DropOperation, DropTarget } from \"@proyecto-viviana/solid-stately\";\nimport {\n Collection as AriaCollection,\n CollectionBuilder as AriaCollectionBuilder,\n createLeafComponent,\n createBranchComponent,\n type CollectionProps as AriaCollectionProps,\n type CollectionBuilderProps as AriaCollectionBuilderProps,\n} from \"@proyecto-viviana/solidaria\";\nimport { splitProps } from \"@proyecto-viviana/solidaria/utils\";\nimport {\n type ClassNameOrFunction,\n type StyleOrFunction,\n type SlotProps,\n useRenderProps,\n filterDOMProps,\n} from \"./utils\";\n\nexport interface CollectionPrimitiveRenderProps {\n /** Whether the primitive has visible children content. */\n hasChildren: boolean;\n}\n\ntype RefLike<T> = ((el: T) => void) | { current?: T | null } | undefined;\n\nfunction assignRef<T>(ref: RefLike<T>, el: T): void {\n if (!ref) return;\n if (typeof ref === \"function\") ref(el);\n else ref.current = el;\n}\n\nexport interface CollectionDropTargetDelegate {\n getDropTargetFromPoint(\n x: number,\n y: number,\n isValidDropTarget: (target: DropTarget) => boolean,\n ): DropTarget | null;\n getDropOperation(\n target: DropTarget,\n types: DragTypes,\n allowedOperations: DropOperation[],\n ): DropOperation;\n getKeyboardNavigationTarget?(\n target: DropTarget | null,\n direction: \"next\" | \"previous\",\n isValidDropTarget: (target: DropTarget) => boolean,\n ): DropTarget | null;\n getKeyboardPageNavigationTarget?(\n target: DropTarget | null,\n direction: \"next\" | \"previous\",\n isValidDropTarget: (target: DropTarget) => boolean,\n ): DropTarget | null;\n}\n\nexport interface CollectionRendererContextValue<T> {\n /** Render function used by collection parents to render each item node. */\n renderItem: (item: T) => JSX.Element;\n /** Whether collection rendering is currently virtualized. */\n isVirtualized?: boolean;\n /** Optional layout delegate used by virtualized renderers. */\n layoutDelegate?: unknown;\n /** Optional drop target delegate used by DnD-aware collection paths. */\n dropTargetDelegate?: CollectionDropTargetDelegate;\n /** Optional drop indicator renderer for DnD-aware collection paths. */\n renderDropIndicator?: (\n index: number,\n position: \"before\" | \"after\" | \"on\",\n ) => JSX.Element | undefined;\n /**\n * Root renderer for collection items. RAC `CollectionRenderer.CollectionRoot`\n * (`Collection.tsx:196`). Virtualizer replaces this with a scroll-attached\n * content wrapper (`react-aria-components/src/Virtualizer.tsx:99-151`).\n */\n CollectionRoot?: (props: CollectionRootProps<T>) => JSX.Element;\n /** Branch renderer for nested collection items. RAC `CollectionBranch`. */\n CollectionBranch?: (props: CollectionBranchProps<T>) => JSX.Element;\n}\n\nexport type CollectionEntry<T> = T | CollectionSection<T>;\n\nexport interface CollectionSection<T> {\n /** Optional unique key for the section wrapper. */\n key?: Key;\n /** Optional section header title. */\n title?: JSX.Element;\n /** Optional aria-label for section grouping. */\n \"aria-label\"?: string;\n /** Items contained in the section. */\n items: T[];\n}\n\nexport interface SectionProps extends SlotProps {\n /** Section contents, usually Header + Group/items. */\n children?: JSX.Element;\n /** Ref for the section element. */\n ref?: RefLike<HTMLDivElement>;\n /** The CSS className for the element. */\n class?: ClassNameOrFunction<CollectionPrimitiveRenderProps>;\n /** The inline style for the element. */\n style?: StyleOrFunction<CollectionPrimitiveRenderProps>;\n}\n\nexport interface HeaderProps extends SlotProps {\n /** Header contents, usually section title text. */\n children?: JSX.Element;\n /** Optional heading level when rendered as a heading role. */\n \"aria-level\"?: number;\n /** The CSS className for the element. */\n class?: ClassNameOrFunction<CollectionPrimitiveRenderProps>;\n /** The inline style for the element. */\n style?: StyleOrFunction<CollectionPrimitiveRenderProps>;\n}\n\nexport interface GroupProps extends SlotProps {\n /** Group contents, usually section items. */\n children?: JSX.Element;\n /** The CSS className for the element. */\n class?: ClassNameOrFunction<CollectionPrimitiveRenderProps>;\n /** The inline style for the element. */\n style?: StyleOrFunction<CollectionPrimitiveRenderProps>;\n}\n\ninterface SectionContextValue {\n name: string;\n render: (props: SectionProps, className?: string) => JSX.Element;\n}\n\nexport interface CollectionBranchProps<T> {\n collection: Iterable<T>;\n parent?: unknown;\n renderDropIndicator?: (target: {\n type: \"item\";\n key: Key;\n dropPosition: \"before\" | \"after\" | \"on\";\n }) => JSX.Element | undefined;\n}\n\nexport interface CollectionRootProps<T> {\n collection: Iterable<T>;\n persistedKeys?: Set<Key> | null;\n /**\n * The collection element that scrolls. RAC `CollectionRootProps.scrollRef`\n * (`Collection.tsx:183`).\n */\n scrollRef?: () => HTMLElement | null | undefined;\n renderDropIndicator?: (target: {\n type: \"item\";\n key: Key;\n dropPosition: \"before\" | \"after\" | \"on\";\n }) => JSX.Element | undefined;\n /**\n * Rendered collection items. RAC CollectionRoot renders `node.render()` from\n * the collection; Solid collections pass the already-composed item tree.\n */\n children?: JSX.Element;\n}\n\nexport interface CollectionRenderer<T = unknown> {\n isVirtualized?: boolean;\n layoutDelegate?: unknown;\n dropTargetDelegate?: CollectionDropTargetDelegate;\n CollectionRoot: (props: CollectionRootProps<T>) => JSX.Element;\n CollectionBranch: (props: CollectionBranchProps<T>) => JSX.Element;\n}\n\nexport const CollectionRendererContext =\n createContext<CollectionRendererContextValue<unknown> | null>(null);\nexport const SelectableCollectionContext = CollectionRendererContext;\nexport const SectionContext = createContext<SectionContextValue | null>(null);\nexport const GroupContext = createContext<Partial<GroupProps> | null>(null);\nexport const HeaderContext = createContext<Partial<HeaderProps> | null>(null);\nexport const HeadingContext = createContext<Partial<HeaderProps> | null>(null);\n\nexport function useCollectionRenderer<T>(): CollectionRendererContextValue<T> | null {\n return useContext(CollectionRendererContext) as CollectionRendererContextValue<T> | null;\n}\n\n/** RAC collections always render `CollectionRoot` from the renderer context. */\nexport function useCollectionRoot<T>(): (props: CollectionRootProps<T>) => JSX.Element {\n const renderer = useCollectionRenderer<T>();\n return renderer?.CollectionRoot ?? DefaultCollectionRenderer.CollectionRoot;\n}\n\nexport function isCollectionSection<T>(entry: CollectionEntry<T>): entry is CollectionSection<T> {\n return (\n typeof entry === \"object\" &&\n entry !== null &&\n Array.isArray((entry as CollectionSection<T>).items)\n );\n}\n\nexport function flattenCollectionEntries<T>(entries: CollectionEntry<T>[]): T[] {\n const flattened: T[] = [];\n for (const entry of entries) {\n if (isCollectionSection(entry)) flattened.push(...entry.items);\n else flattened.push(entry);\n }\n return flattened;\n}\n\nfunction renderCollectionItems<T>(\n collection: Iterable<T>,\n renderDropIndicator?: (target: {\n type: \"item\";\n key: Key;\n dropPosition: \"before\" | \"after\" | \"on\";\n }) => JSX.Element | undefined,\n): JSX.Element {\n const items = Array.from(collection);\n let lastRenderableIndex = -1;\n for (let i = 0; i < items.length; i++) {\n if ((items[i] as { type?: unknown }).type !== \"content\") {\n lastRenderableIndex = i;\n }\n }\n return (\n <For each={items}>\n {(item, index) => {\n const node = item as { type?: unknown; key?: Key };\n if (node.type === \"content\") {\n // Content rows are rendered by their owning item/section branch.\n return <></>;\n }\n const key = node.key ?? index();\n const isLastInLevel = index() === lastRenderableIndex;\n return (\n <>\n {renderDropIndicator?.({ type: \"item\", key, dropPosition: \"before\" })}\n {item as unknown as JSX.Element}\n {isLastInLevel\n ? renderDropIndicator?.({ type: \"item\", key, dropPosition: \"after\" })\n : null}\n </>\n );\n }}\n </For>\n );\n}\n\nexport const DefaultCollectionRenderer: CollectionRenderer<unknown> = {\n CollectionRoot(props) {\n if (props.children != null) return props.children;\n return renderCollectionItems(props.collection, props.renderDropIndicator);\n },\n CollectionBranch(props) {\n return renderCollectionItems(props.collection, props.renderDropIndicator);\n },\n};\n\nexport function CollectionBuilder<T>(props: AriaCollectionBuilderProps<T>): unknown {\n return AriaCollectionBuilder(props);\n}\n\nexport function Collection<T>(props: AriaCollectionProps<T>): unknown {\n return AriaCollection(props);\n}\n\nexport { createLeafComponent, createBranchComponent };\n\n/**\n * RAC Collection renders `before` + item for every item, and `after` only when\n * the next item in the same level is null (`renderAfterDropIndicators`). The\n * `\"on\"` position is not a collection-level slot. Index-based hosts (ListBox,\n * GridList, Menu, Table) use this helper so they do not fork the geometry.\n */\nexport function renderCollectionDropSlots(options: {\n index: number;\n lastIndex: number;\n renderDropIndicator?: (\n index: number,\n position: \"before\" | \"after\" | \"on\",\n ) => JSX.Element | undefined;\n children: JSX.Element;\n}): JSX.Element {\n return (\n <>\n {options.renderDropIndicator?.(options.index, \"before\")}\n {options.children}\n {options.index === options.lastIndex\n ? options.renderDropIndicator?.(options.index, \"after\")\n : null}\n </>\n );\n}\n\n/**\n * A semantic section wrapper for grouped collection content.\n */\nexport function Section(props: SectionProps): JSX.Element {\n const sectionContext = useContext(SectionContext);\n if (sectionContext) {\n const nodeEnv = (globalThis as { process?: { env?: { NODE_ENV?: string } } }).process?.env\n ?.NODE_ENV;\n if (nodeEnv !== \"production\") {\n console.warn(`<Section> is deprecated. Please use <${sectionContext.name}> instead.`);\n }\n return sectionContext.render(props, \"solidaria-Section\");\n }\n\n const [local, domProps] = splitProps(props, [\"children\", \"class\", \"style\", \"slot\", \"ref\"]);\n\n const renderValues = createMemo<CollectionPrimitiveRenderProps>(() => ({\n hasChildren: local.children != null,\n }));\n\n const renderProps = useRenderProps(\n {\n get children() {\n return local.children;\n },\n class: local.class,\n style: local.style,\n defaultClassName: \"solidaria-Section\",\n },\n renderValues,\n );\n\n const filteredDomProps = createMemo(() => filterDOMProps(domProps, { global: true }));\n\n return (\n <div\n ref={(el) => assignRef(local.ref, el)}\n {...filteredDomProps()}\n class={renderProps.class()}\n style={renderProps.style()}\n slot={local.slot}\n data-section\n >\n {renderProps.renderChildren()}\n </div>\n );\n}\n\n/**\n * A header/title primitive for collection sections.\n */\nexport function Header(props: HeaderProps): JSX.Element {\n const [local, domProps] = splitProps(props, [\"children\", \"class\", \"style\", \"slot\"]);\n\n const renderValues = createMemo<CollectionPrimitiveRenderProps>(() => ({\n hasChildren: local.children != null,\n }));\n\n const renderProps = useRenderProps(\n {\n get children() {\n return local.children;\n },\n class: local.class,\n style: local.style,\n defaultClassName: \"solidaria-Header\",\n },\n renderValues,\n );\n\n const filteredDomProps = createMemo(() => filterDOMProps(domProps, { global: true }));\n\n return (\n <div\n {...filteredDomProps()}\n role=\"heading\"\n class={renderProps.class()}\n style={renderProps.style()}\n slot={local.slot}\n data-header\n >\n {renderProps.renderChildren()}\n </div>\n );\n}\n\n/**\n * A grouping primitive for section item containers.\n */\nexport function Group(props: GroupProps): JSX.Element {\n const [local, domProps] = splitProps(props, [\"children\", \"class\", \"style\", \"slot\"]);\n\n const renderValues = createMemo<CollectionPrimitiveRenderProps>(() => ({\n hasChildren: local.children != null,\n }));\n\n const renderProps = useRenderProps(\n {\n get children() {\n return local.children;\n },\n class: local.class,\n style: local.style,\n defaultClassName: \"solidaria-Group\",\n },\n renderValues,\n );\n\n const filteredDomProps = createMemo(() => filterDOMProps(domProps, { global: true }));\n\n return (\n <div\n {...filteredDomProps()}\n role=\"group\"\n class={renderProps.class()}\n style={renderProps.style()}\n slot={local.slot}\n data-group\n >\n {renderProps.renderChildren()}\n </div>\n );\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAsDA,SAAS,YAAa,KAAiB,IAAa;CAClD,IAAI,CAAC,KAAK;CACV,IAAI,OAAO,QAAQ,YAAY,IAAI,EAAE;MAChC,IAAI,UAAU;AACrB;AAwIA,MAAa,4BACX,cAA8D,IAAI;AACpE,MAAa,8BAA8B;AAC3C,MAAa,iBAAiB,cAA0C,IAAI;AAC5E,MAAa,eAAe,cAA0C,IAAI;AAC1E,MAAa,gBAAgB,cAA2C,IAAI;AAC5E,MAAa,iBAAiB,cAA2C,IAAI;AAE7E,SAAgB,wBAAqE;CACnF,OAAO,WAAW,yBAAyB;AAC7C;;AAGA,SAAgB,oBAAuE;CAErF,OADiB,sBACV,CAAA,EAAU,kBAAkB,0BAA0B;AAC/D;AAEA,SAAgB,oBAAuB,OAA0D;CAC/F,OACE,OAAO,UAAU,YACjB,UAAU,QACV,MAAM,QAAS,MAA+B,KAAK;AAEvD;AAEA,SAAgB,yBAA4B,SAAoC;CAC9E,MAAM,YAAiB,CAAC;CACxB,KAAK,MAAM,SAAS,SAClB,IAAI,oBAAoB,KAAK,GAAG,UAAU,KAAK,GAAG,MAAM,KAAK;MACxD,UAAU,KAAK,KAAK;CAE3B,OAAO;AACT;AAEA,SAAS,sBACP,YACA,qBAKa;CACb,MAAM,QAAQ,MAAM,KAAK,UAAU;CACnC,IAAI,sBAAsB;CAC1B,KAAK,IAAI,IAAI,GAAG,IAAI,MAAM,QAAQ,KAChC,IAAK,MAAM,EAAA,CAA0B,SAAS,WAC5C,sBAAsB;CAG1B,OACEA,gBAAAA,KAAAA;EAAKC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,MAAM;EAAC;EAC1B,IAAA,QAAA;GAAO,OAAA,YAAY,MAAM;EAAC;EAC1B,IAAA,OAAA;GAAM,OAAA,MAAM;EAAI;EAChB,eAAA;;CANF,OAAA,OAQEF,YAAAA;EAAC,OAAA,YAAY,eAAe;CAAC,CAAA,CAC1B;CATL,mBASK;CAVP,OACEG;AAWJ;;;;AAKA,SAAgB,MAAM,OAAgC;CACpD,MAAM,CAAC,OAAO,YAAY,WAAW,OAAO;EAAC;EAAY;EAAS;EAAS;CAAM,CAAC;CAElF,MAAM,eAAe,kBAAkD,EACrE,aAAa,MAAM,YAAY,KACjC,EAAE;CAEF,MAAM,cAAc,eAClB;EACE,IAAI,WAAW;GACb,OAAO,MAAM;EACf;EACA,OAAO,MAAM;EACb,OAAO,MAAM;EACb,kBAAkB;CACpB,GACA,YACF;CAEA,MAAM,mBAAmB,iBAAiB,eAAe,UAAU,EAAE,QAAQ,KAAK,CAAC,CAAC;CAGlF,IAAA,QAAA,eAAA,MASK;CARC,OAAA,OAAA,CAAA,kBAAA;EACJC,MAAAA;EACA,IAAA,UAAA;GAAO,OAAA,YAAY,MAAM;EAAC;EAC1B,IAAA,QAAA;GAAO,OAAA,YAAY,MAAM;EAAC;EAC1B,IAAA,OAAA;GAAM,OAAA,MAAM;EAAI;EAChB,cAAA;;CANF,OAAA,OAQEJ,YAAAA;EAAC,OAAA,YAAY,eAAe;CAAC,CAAA,CAC1B;CATL,mBASK;CAVP,OACEK;AAWJ"}
|
package/dist/Collection.jsx
CHANGED
|
@@ -1,14 +1,32 @@
|
|
|
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/Collection.tsx
|
|
13
|
+
// Ported to SolidJS for Proyecto Viviana; based on packages/react-aria-components/src/Group.tsx
|
|
14
|
+
// Ported to SolidJS for Proyecto Viviana; based on packages/react-aria-components/src/Header.tsx
|
|
1
15
|
import { filterDOMProps, useRenderProps } from "./utils.jsx";
|
|
2
|
-
import { For, createContext, createMemo,
|
|
16
|
+
import { For, createContext, createMemo, useContext } from "solid-js";
|
|
3
17
|
import { Collection as Collection$1, CollectionBuilder as CollectionBuilder$1, createBranchComponent, createLeafComponent } from "@proyecto-viviana/solidaria";
|
|
18
|
+
import { splitProps } from "@proyecto-viviana/solidaria/utils";
|
|
4
19
|
//#region src/Collection.tsx
|
|
5
20
|
/**
|
|
6
21
|
* Collection composition primitives for solidaria-components.
|
|
7
22
|
*
|
|
8
23
|
* Foundational parity layer for React Spectrum-style composition:
|
|
9
|
-
* Section / Header / Group.
|
|
24
|
+
* Section / Header / Group. Based on:
|
|
25
|
+
* - packages/react-aria-components/src/Collection.tsx
|
|
26
|
+
* - packages/react-aria-components/src/Group.tsx
|
|
27
|
+
* - packages/react-aria-components/src/Header.tsx
|
|
10
28
|
*/
|
|
11
|
-
function assignRef(ref, el) {
|
|
29
|
+
function assignRef$1(ref, el) {
|
|
12
30
|
if (!ref) return;
|
|
13
31
|
if (typeof ref === "function") ref(el);
|
|
14
32
|
else ref.current = el;
|
|
@@ -22,6 +40,10 @@ const HeadingContext = createContext(null);
|
|
|
22
40
|
function useCollectionRenderer() {
|
|
23
41
|
return useContext(CollectionRendererContext);
|
|
24
42
|
}
|
|
43
|
+
/** RAC collections always render `CollectionRoot` from the renderer context. */
|
|
44
|
+
function useCollectionRoot() {
|
|
45
|
+
return useCollectionRenderer()?.CollectionRoot ?? DefaultCollectionRenderer.CollectionRoot;
|
|
46
|
+
}
|
|
25
47
|
function isCollectionSection(entry) {
|
|
26
48
|
return typeof entry === "object" && entry !== null && Array.isArray(entry.items);
|
|
27
49
|
}
|
|
@@ -33,11 +55,14 @@ function flattenCollectionEntries(entries) {
|
|
|
33
55
|
}
|
|
34
56
|
function renderCollectionItems(collection, renderDropIndicator) {
|
|
35
57
|
const items = Array.from(collection);
|
|
58
|
+
let lastRenderableIndex = -1;
|
|
59
|
+
for (let i = 0; i < items.length; i++) if (items[i].type !== "content") lastRenderableIndex = i;
|
|
36
60
|
return <For each={items}>
|
|
37
61
|
{(item, index) => {
|
|
38
62
|
const node = item;
|
|
39
63
|
if (node.type === "content") return <></>;
|
|
40
64
|
const key = node.key ?? index();
|
|
65
|
+
const isLastInLevel = index() === lastRenderableIndex;
|
|
41
66
|
return <>
|
|
42
67
|
{renderDropIndicator?.({
|
|
43
68
|
type: "item",
|
|
@@ -45,17 +70,18 @@ function renderCollectionItems(collection, renderDropIndicator) {
|
|
|
45
70
|
dropPosition: "before"
|
|
46
71
|
})}
|
|
47
72
|
{item}
|
|
48
|
-
{renderDropIndicator?.({
|
|
73
|
+
{isLastInLevel ? renderDropIndicator?.({
|
|
49
74
|
type: "item",
|
|
50
75
|
key,
|
|
51
76
|
dropPosition: "after"
|
|
52
|
-
})}
|
|
77
|
+
}) : null}
|
|
53
78
|
</>;
|
|
54
79
|
}}
|
|
55
80
|
</For>;
|
|
56
81
|
}
|
|
57
82
|
const DefaultCollectionRenderer = {
|
|
58
83
|
CollectionRoot(props) {
|
|
84
|
+
if (props.children != null) return props.children;
|
|
59
85
|
return renderCollectionItems(props.collection, props.renderDropIndicator);
|
|
60
86
|
},
|
|
61
87
|
CollectionBranch(props) {
|
|
@@ -69,6 +95,19 @@ function Collection(props) {
|
|
|
69
95
|
return Collection$1(props);
|
|
70
96
|
}
|
|
71
97
|
/**
|
|
98
|
+
* RAC Collection renders `before` + item for every item, and `after` only when
|
|
99
|
+
* the next item in the same level is null (`renderAfterDropIndicators`). The
|
|
100
|
+
* `"on"` position is not a collection-level slot. Index-based hosts (ListBox,
|
|
101
|
+
* GridList, Menu, Table) use this helper so they do not fork the geometry.
|
|
102
|
+
*/
|
|
103
|
+
function renderCollectionDropSlots(options) {
|
|
104
|
+
return <>
|
|
105
|
+
{options.renderDropIndicator?.(options.index, "before")}
|
|
106
|
+
{options.children}
|
|
107
|
+
{options.index === options.lastIndex ? options.renderDropIndicator?.(options.index, "after") : null}
|
|
108
|
+
</>;
|
|
109
|
+
}
|
|
110
|
+
/**
|
|
72
111
|
* A semantic section wrapper for grouped collection content.
|
|
73
112
|
*/
|
|
74
113
|
function Section(props) {
|
|
@@ -94,7 +133,7 @@ function Section(props) {
|
|
|
94
133
|
defaultClassName: "solidaria-Section"
|
|
95
134
|
}, renderValues);
|
|
96
135
|
const filteredDomProps = createMemo(() => filterDOMProps(domProps, { global: true }));
|
|
97
|
-
return <div ref={(el) => assignRef(local.ref, el)} {...filteredDomProps()} class={renderProps.class()} style={renderProps.style()} slot={local.slot} data-section>
|
|
136
|
+
return <div ref={(el) => assignRef$1(local.ref, el)} {...filteredDomProps()} class={renderProps.class()} style={renderProps.style()} slot={local.slot} data-section>
|
|
98
137
|
{renderProps.renderChildren()}
|
|
99
138
|
</div>;
|
|
100
139
|
}
|
|
@@ -147,6 +186,6 @@ function Group(props) {
|
|
|
147
186
|
</div>;
|
|
148
187
|
}
|
|
149
188
|
//#endregion
|
|
150
|
-
export { Collection, CollectionBuilder, CollectionRendererContext, DefaultCollectionRenderer, Group, GroupContext, Header, HeaderContext, HeadingContext, Section, SectionContext, SelectableCollectionContext, createBranchComponent, createLeafComponent, flattenCollectionEntries, isCollectionSection, useCollectionRenderer };
|
|
189
|
+
export { Collection, CollectionBuilder, CollectionRendererContext, DefaultCollectionRenderer, Group, GroupContext, Header, HeaderContext, HeadingContext, Section, SectionContext, SelectableCollectionContext, createBranchComponent, createLeafComponent, flattenCollectionEntries, isCollectionSection, renderCollectionDropSlots, useCollectionRenderer, useCollectionRoot };
|
|
151
190
|
|
|
152
191
|
//# sourceMappingURL=Collection.jsx.map
|