@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/TagGroup.jsx
CHANGED
|
@@ -1,8 +1,21 @@
|
|
|
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/TagGroup.tsx
|
|
1
13
|
import { dataAttr, filterDOMProps, mergeRefs, useRenderProps } from "./utils.jsx";
|
|
2
14
|
import { SharedElementTransition } from "./SharedElementTransition.jsx";
|
|
3
15
|
import { SelectionIndicatorContext } from "./SelectionIndicator.jsx";
|
|
4
|
-
import { For, Show, createContext, createMemo, createSignal,
|
|
16
|
+
import { For, Show, createContext, createMemo, createSignal, useContext } from "solid-js";
|
|
5
17
|
import { createTag, createTagGroup, useLocale } from "@proyecto-viviana/solidaria";
|
|
18
|
+
import { splitProps } from "@proyecto-viviana/solidaria/utils";
|
|
6
19
|
import { createListState } from "@proyecto-viviana/solid-stately";
|
|
7
20
|
//#region src/TagGroup.tsx
|
|
8
21
|
/**
|
|
@@ -101,6 +114,7 @@ function TagList(props) {
|
|
|
101
114
|
}
|
|
102
115
|
});
|
|
103
116
|
const locale = useLocale();
|
|
117
|
+
const onRemove = () => local.onRemove;
|
|
104
118
|
const tagGroupAria = createTagGroup({
|
|
105
119
|
get "aria-label"() {
|
|
106
120
|
return local["aria-label"] ?? (!local["aria-labelledby"] ? local.label : void 0);
|
|
@@ -115,7 +129,7 @@ function TagList(props) {
|
|
|
115
129
|
return local.isDisabled;
|
|
116
130
|
},
|
|
117
131
|
get onRemove() {
|
|
118
|
-
return
|
|
132
|
+
return onRemove();
|
|
119
133
|
},
|
|
120
134
|
get direction() {
|
|
121
135
|
return locale().direction;
|
|
@@ -134,14 +148,14 @@ function TagList(props) {
|
|
|
134
148
|
const contextValue = {
|
|
135
149
|
state,
|
|
136
150
|
get onRemove() {
|
|
137
|
-
return
|
|
151
|
+
return onRemove();
|
|
138
152
|
},
|
|
139
153
|
get isDisabled() {
|
|
140
154
|
return local.isDisabled;
|
|
141
155
|
}
|
|
142
156
|
};
|
|
143
|
-
return <TagGroupContext
|
|
144
|
-
<TagListStateContext
|
|
157
|
+
return <TagGroupContext value={contextValue}>
|
|
158
|
+
<TagListStateContext value={state}>
|
|
145
159
|
<div ref={setGridRef} {...domProps} {...tagGroupAria.gridProps} class={renderProps.class()} style={renderProps.style()} onFocusIn={() => {
|
|
146
160
|
setIsFocused(true);
|
|
147
161
|
}} onFocusOut={(e) => {
|
|
@@ -155,8 +169,8 @@ function TagList(props) {
|
|
|
155
169
|
</Show>
|
|
156
170
|
</SharedElementTransition>
|
|
157
171
|
</div>
|
|
158
|
-
</TagListStateContext
|
|
159
|
-
</TagGroupContext
|
|
172
|
+
</TagListStateContext>
|
|
173
|
+
</TagGroupContext>;
|
|
160
174
|
}
|
|
161
175
|
/**
|
|
162
176
|
* A Tag is an individual item within a TagList.
|
|
@@ -185,6 +199,9 @@ function Tag(props) {
|
|
|
185
199
|
},
|
|
186
200
|
get textValue() {
|
|
187
201
|
return local.textValue;
|
|
202
|
+
},
|
|
203
|
+
get onAction() {
|
|
204
|
+
return local.onAction ? () => local.onAction?.(local.id) : void 0;
|
|
188
205
|
}
|
|
189
206
|
}, state, tagRef);
|
|
190
207
|
const normalizedRemoveButtonProps = createMemo(() => {
|
|
@@ -193,20 +210,18 @@ function Tag(props) {
|
|
|
193
210
|
return {
|
|
194
211
|
...raw,
|
|
195
212
|
onPress: () => {
|
|
196
|
-
if (!tagAria.isDisabled && groupContext?.onRemove) {
|
|
197
|
-
groupContext.onRemove(new Set([local.id]));
|
|
198
|
-
return;
|
|
199
|
-
}
|
|
200
213
|
rawHandler?.();
|
|
201
214
|
}
|
|
202
215
|
};
|
|
203
216
|
});
|
|
217
|
+
const allowsRemoving = createMemo(() => Boolean(tagAria.allowsRemoving) || Boolean(groupContext?.onRemove));
|
|
204
218
|
const renderValues = createMemo(() => ({
|
|
205
219
|
isSelected: tagAria.isSelected,
|
|
206
220
|
isDisabled: tagAria.isDisabled,
|
|
207
221
|
isFocused: tagAria.isFocused,
|
|
222
|
+
isFocusVisible: tagAria.isFocusVisible,
|
|
208
223
|
isPressed: tagAria.isPressed,
|
|
209
|
-
allowsRemoving:
|
|
224
|
+
allowsRemoving: allowsRemoving(),
|
|
210
225
|
selectionMode: state?.selectionMode() ?? "none",
|
|
211
226
|
removeButtonProps: normalizedRemoveButtonProps()
|
|
212
227
|
}));
|
|
@@ -220,26 +235,22 @@ function Tag(props) {
|
|
|
220
235
|
}, renderValues);
|
|
221
236
|
const selectionIndicatorContext = createMemo(() => ({ isSelected: () => tagAria.isSelected }));
|
|
222
237
|
const domProps = createMemo(() => filterDOMProps(rest, { global: true }));
|
|
223
|
-
return <SelectionIndicatorContext
|
|
224
|
-
<TagContext
|
|
238
|
+
return <SelectionIndicatorContext value={selectionIndicatorContext()}>
|
|
239
|
+
<TagContext value={{
|
|
225
240
|
get removeButtonProps() {
|
|
226
241
|
return normalizedRemoveButtonProps();
|
|
227
242
|
},
|
|
228
243
|
get allowsRemoving() {
|
|
229
|
-
return
|
|
244
|
+
return allowsRemoving();
|
|
230
245
|
}
|
|
231
246
|
}}>
|
|
232
|
-
<div ref={mergeRefs(setTagRef, local.ref)} {...domProps()} {...tagAria.rowProps} class={renderProps.class()} style={renderProps.style()}
|
|
233
|
-
const rowClick = tagAria.rowProps.onClick;
|
|
234
|
-
if (typeof rowClick === "function") rowClick(event);
|
|
235
|
-
if (!tagAria.isDisabled && !event.target?.closest("button")) local.onAction?.(local.id);
|
|
236
|
-
}} data-selected={dataAttr(tagAria.isSelected)} data-disabled={dataAttr(tagAria.isDisabled)} data-focused={dataAttr(tagAria.isFocused)} data-pressed={dataAttr(tagAria.isPressed)} data-allows-removing={dataAttr(tagAria.allowsRemoving)}>
|
|
247
|
+
<div ref={mergeRefs(setTagRef, local.ref)} {...domProps()} {...tagAria.rowProps} class={renderProps.class()} style={renderProps.style()} data-selected={dataAttr(tagAria.isSelected)} data-disabled={dataAttr(tagAria.isDisabled)} data-focused={dataAttr(tagAria.isFocused)} data-focus-visible={dataAttr(tagAria.isFocusVisible)} data-pressed={dataAttr(tagAria.isPressed)} data-allows-removing={dataAttr(allowsRemoving())}>
|
|
237
248
|
<div {...tagAria.gridCellProps} style={{ display: "contents" }}>
|
|
238
|
-
{renderProps.
|
|
249
|
+
{renderProps.renderChildrenStable()}
|
|
239
250
|
</div>
|
|
240
251
|
</div>
|
|
241
|
-
</TagContext
|
|
242
|
-
</SelectionIndicatorContext
|
|
252
|
+
</TagContext>
|
|
253
|
+
</SelectionIndicatorContext>;
|
|
243
254
|
}
|
|
244
255
|
/**
|
|
245
256
|
* TagRemoveButton is the button used to remove a tag.
|
|
@@ -252,9 +263,11 @@ function TagRemoveButton(props) {
|
|
|
252
263
|
const rawId = getRemoveButtonProps().id;
|
|
253
264
|
const rawAriaLabel = getRemoveButtonProps()["aria-label"];
|
|
254
265
|
const rawAriaLabelledBy = getRemoveButtonProps()["aria-labelledby"];
|
|
266
|
+
const rawTabIndex = getRemoveButtonProps().tabIndex;
|
|
255
267
|
const buttonId = typeof rawId === "string" ? rawId : void 0;
|
|
256
268
|
const ariaLabel = typeof rawAriaLabel === "string" ? rawAriaLabel : "Remove";
|
|
257
269
|
const ariaLabelledBy = typeof rawAriaLabelledBy === "string" ? rawAriaLabelledBy : void 0;
|
|
270
|
+
const tabindex = typeof rawTabIndex === "number" ? rawTabIndex : void 0;
|
|
258
271
|
const handleClick = (event) => {
|
|
259
272
|
event.stopPropagation();
|
|
260
273
|
const handler = getRemoveButtonProps().onPress;
|
|
@@ -263,7 +276,7 @@ function TagRemoveButton(props) {
|
|
|
263
276
|
const stopRowPress = (event) => {
|
|
264
277
|
event.stopPropagation();
|
|
265
278
|
};
|
|
266
|
-
return <button type="button" class={props.class ?? "solidaria-TagRemoveButton"} style={props.style} id={buttonId} aria-label={ariaLabel} aria-labelledby={ariaLabelledBy} disabled={getIsDisabled()} data-allows-removing={dataAttr(tagContext?.allowsRemoving ?? false)} onPointerDown={stopRowPress} onClick={handleClick}>
|
|
279
|
+
return <button type="button" class={props.class ?? "solidaria-TagRemoveButton"} style={props.style} id={buttonId} aria-label={ariaLabel} aria-labelledby={ariaLabelledBy} tabindex={tabindex} disabled={getIsDisabled()} data-allows-removing={dataAttr(tagContext?.allowsRemoving ?? false)} onPointerDown={stopRowPress} onClick={handleClick}>
|
|
267
280
|
{props.children ?? "×"}
|
|
268
281
|
</button>;
|
|
269
282
|
}
|
package/dist/TagGroup.jsx.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"TagGroup.jsx","names":[],"sources":["../src/TagGroup.tsx"],"sourcesContent":["/**\n * TagGroup component for solidaria-components\n *\n * Pre-wired headless tag group component that combines aria hooks.\n * Port of react-aria-components/src/TagGroup.tsx\n *\n * A tag group is a focusable list of labels, categories, keywords, filters, or other items,\n * with support for keyboard navigation, selection, and removal.\n */\n\nimport {\n type JSX,\n createContext,\n createMemo,\n createSignal,\n splitProps,\n useContext,\n For,\n Show,\n} from \"solid-js\";\nimport {\n createTagGroup,\n createTag,\n useLocale,\n type AriaTagGroupProps,\n} from \"@proyecto-viviana/solidaria\";\nimport {\n createListState,\n type ListState,\n type Key,\n type SelectionMode,\n type SelectionBehavior,\n} from \"@proyecto-viviana/solid-stately\";\nimport {\n type RenderChildren,\n type ClassNameOrFunction,\n type StyleOrFunction,\n type SlotProps,\n type RefLike,\n useRenderProps,\n filterDOMProps,\n dataAttr,\n mergeRefs,\n} from \"./utils\";\nimport { SharedElementTransition } from \"./SharedElementTransition\";\nimport {\n SelectionIndicatorContext,\n type SelectionIndicatorContextValue,\n} from \"./SelectionIndicator\";\n\nexport interface TagGroupRenderProps {\n /** Whether the tag group is disabled. */\n isDisabled: boolean;\n /** Whether the tag list is empty. */\n isEmpty: boolean;\n}\n\nexport interface TagGroupProps\n extends\n Omit<AriaTagGroupProps, \"id\">,\n SlotProps,\n Omit<JSX.HTMLAttributes<HTMLDivElement>, \"class\" | \"style\" | \"children\"> {\n /** The children of the component. */\n children?: JSX.Element;\n /** The CSS className for the element. */\n class?: ClassNameOrFunction<TagGroupRenderProps>;\n /** The inline style for the element. */\n style?: StyleOrFunction<TagGroupRenderProps>;\n}\n\nexport interface TagListRenderProps {\n /** Whether the tag list is empty. */\n isEmpty: boolean;\n /** Whether the tag list is focused. */\n isFocused: boolean;\n}\n\nexport interface TagListProps<T>\n extends\n SlotProps,\n Omit<JSX.HTMLAttributes<HTMLDivElement>, \"class\" | \"style\" | \"children\" | \"onSelectionChange\"> {\n /** The items to display in the tag list. */\n items: T[];\n /** Function to render each item. */\n children: (item: T) => JSX.Element;\n /** The CSS className for the element. */\n class?: ClassNameOrFunction<TagListRenderProps>;\n /** The inline style for the element. */\n style?: StyleOrFunction<TagListRenderProps>;\n /** Content to render when the list is empty. */\n renderEmptyState?: () => JSX.Element;\n /** The selection mode for the tag list. */\n selectionMode?: SelectionMode;\n /** How selection behaves in the collection. */\n selectionBehavior?: SelectionBehavior;\n /** The currently selected keys (controlled). */\n selectedKeys?: Iterable<Key>;\n /** The default selected keys (uncontrolled). */\n defaultSelectedKeys?: Iterable<Key>;\n /** Handler called when selection changes. */\n onSelectionChange?: (keys: \"all\" | Set<Key>) => void;\n /** Keys that are disabled. */\n disabledKeys?: Iterable<Key>;\n /** Function to get a unique key from an item. */\n getKey?: (item: T) => Key;\n /** Accessibility label. */\n label?: string;\n /** Custom aria-label. */\n \"aria-label\"?: string;\n /** Reference to external label element. */\n \"aria-labelledby\"?: string;\n /** Reference to description element. */\n \"aria-describedby\"?: string;\n /** Whether the tag list is disabled. */\n isDisabled?: boolean;\n /** Handler called when tags are removed. */\n onRemove?: (keys: Set<Key>) => void;\n}\n\nexport interface TagRenderProps {\n /** Whether the tag is selected. */\n isSelected: boolean;\n /** Whether the tag is disabled. */\n isDisabled: boolean;\n /** Whether the tag is focused. */\n isFocused: boolean;\n /** Whether the tag is pressed. */\n isPressed: boolean;\n /** Whether the tag allows removal. */\n allowsRemoving: boolean;\n /** The selection mode. */\n selectionMode: SelectionMode;\n /** Props for the remove button when removal is allowed. */\n removeButtonProps: Record<string, unknown>;\n}\n\nexport interface TagProps extends SlotProps {\n /** A unique key for this tag. */\n id: Key;\n /** Whether the tag is disabled. */\n isDisabled?: boolean;\n /** A text value for accessibility. */\n textValue?: string;\n /** The children of the component. A function may be provided to receive render props. */\n children?: RenderChildren<TagRenderProps>;\n /** The CSS className for the element. */\n class?: ClassNameOrFunction<TagRenderProps>;\n /** The inline style for the element. */\n style?: StyleOrFunction<TagRenderProps>;\n /** A ref to the tag's DOM element (merged with the internal collection ref). */\n ref?: RefLike<HTMLDivElement>;\n /** Handler called when the tag is activated. */\n onAction?: (key: Key) => void;\n}\n\ninterface TagGroupContextValue {\n state: ListState;\n onRemove?: (keys: Set<Key>) => void;\n isDisabled?: boolean;\n}\n\ninterface TagContextValue {\n removeButtonProps: Record<string, unknown>;\n allowsRemoving: boolean;\n}\n\nexport const TagGroupContext = createContext<TagGroupContextValue | null>(null);\nexport const TagListStateContext = createContext<ListState | null>(null);\nexport const TagContext = createContext<TagContextValue | null>(null);\n\nexport function useTagGroupContext(): TagGroupContextValue | null {\n return useContext(TagGroupContext);\n}\n\n/**\n * A tag group is a focusable list of labels, categories, keywords, filters, or other items,\n * with support for keyboard navigation, selection, and removal.\n *\n * @example\n * ```tsx\n * <TagGroup label=\"Categories\" onRemove={(keys) => removeItems(keys)}>\n * <TagList items={items}>\n * {(item) => <Tag id={item.id}>{item.name}</Tag>}\n * </TagList>\n * </TagGroup>\n * ```\n */\nexport function TagGroup(props: TagGroupProps): JSX.Element {\n const [local, domProps] = splitProps(props, [\"class\", \"style\", \"slot\", \"children\"]);\n\n // We need TagList to provide the state, so TagGroup just provides context\n return (\n <div\n {...domProps}\n class={typeof local.class === \"string\" ? local.class : \"solidaria-TagGroup\"}\n style={typeof local.style === \"object\" ? local.style : undefined}\n slot={local.slot}\n >\n {props.children}\n </div>\n );\n}\n\n/**\n * TagList contains the list of tags within a TagGroup.\n */\nexport function TagList<T extends { id?: Key; key?: Key }>(props: TagListProps<T>): JSX.Element {\n const [local, domProps] = splitProps(props, [\n \"items\",\n \"class\",\n \"style\",\n \"slot\",\n \"renderEmptyState\",\n \"children\",\n \"selectionMode\",\n \"selectionBehavior\",\n \"selectedKeys\",\n \"defaultSelectedKeys\",\n \"onSelectionChange\",\n \"disabledKeys\",\n \"getKey\",\n \"label\",\n \"aria-label\",\n \"aria-labelledby\",\n \"aria-describedby\",\n \"isDisabled\",\n \"onRemove\",\n ]);\n\n // Create a ref for the grid\n const [gridRef, setGridRef] = createSignal<HTMLDivElement | null>(null);\n\n // Default getKey function\n const getKey = (item: T): Key => {\n if (local.getKey) return local.getKey(item);\n if (item.id !== undefined) return item.id;\n if (item.key !== undefined) return item.key;\n return String(item);\n };\n\n const state = createListState({\n get items() {\n return local.items;\n },\n getKey,\n get selectionMode() {\n return local.selectionMode ?? \"none\";\n },\n get selectionBehavior() {\n return local.selectionBehavior ?? \"toggle\";\n },\n get selectedKeys() {\n return local.selectedKeys;\n },\n get defaultSelectedKeys() {\n return local.defaultSelectedKeys;\n },\n get onSelectionChange() {\n return local.onSelectionChange;\n },\n get disabledKeys() {\n return local.disabledKeys;\n },\n });\n\n // The tag group navigates on the inline axis, so ArrowLeft/ArrowRight flip\n // under RTL. Thread the resolved layout direction into the hook (mirrors\n // ListBox, and useTagGroup passing `direction` to the ListKeyboardDelegate).\n const locale = useLocale();\n\n // Create tag group accessibility props\n const tagGroupAria = createTagGroup(\n {\n get \"aria-label\"() {\n return local[\"aria-label\"] ?? (!local[\"aria-labelledby\"] ? local.label : undefined);\n },\n get \"aria-labelledby\"() {\n return local[\"aria-labelledby\"];\n },\n get \"aria-describedby\"() {\n return local[\"aria-describedby\"];\n },\n get isDisabled() {\n return local.isDisabled;\n },\n get onRemove() {\n return local.onRemove;\n },\n get direction() {\n return locale().direction;\n },\n },\n state,\n gridRef,\n );\n\n const [isFocused, setIsFocused] = createSignal(false);\n\n const renderValues = createMemo<TagListRenderProps>(() => ({\n isEmpty: local.items.length === 0,\n isFocused: isFocused(),\n }));\n\n const renderProps = useRenderProps(\n {\n class: local.class,\n style: local.style,\n defaultClassName: \"solidaria-TagList\",\n },\n renderValues,\n );\n\n const contextValue: TagGroupContextValue = {\n state,\n get onRemove() {\n return local.onRemove;\n },\n get isDisabled() {\n return local.isDisabled;\n },\n };\n\n return (\n <TagGroupContext.Provider value={contextValue}>\n <TagListStateContext.Provider value={state}>\n <div\n ref={setGridRef}\n {...domProps}\n {...tagGroupAria.gridProps}\n class={renderProps.class()}\n style={renderProps.style()}\n // Track focus-within via the BUBBLING focusin/focusout pair (not the\n // non-bubbling focus/blur the hook's trampoline uses) so this render-prop\n // signal never clobbers `gridProps.onFocus` — the container focus\n // trampoline that marshals entry onto the first/last row.\n onFocusIn={() => {\n setIsFocused(true);\n }}\n onFocusOut={(e) => {\n const nextTarget = e.relatedTarget as Node | null;\n if (nextTarget && e.currentTarget.contains(nextTarget)) {\n return;\n }\n\n setIsFocused(false);\n }}\n data-empty={dataAttr(local.items.length === 0)}\n data-focused={dataAttr(isFocused())}\n >\n <SharedElementTransition>\n <Show when={local.items.length > 0} fallback={local.renderEmptyState?.()}>\n <For each={local.items}>{(item) => props.children(item)}</For>\n </Show>\n </SharedElementTransition>\n </div>\n </TagListStateContext.Provider>\n </TagGroupContext.Provider>\n );\n}\n\n/**\n * A Tag is an individual item within a TagList.\n */\nexport function Tag(props: TagProps): JSX.Element {\n const [local, rest] = splitProps(props, [\n \"id\",\n \"class\",\n \"style\",\n \"slot\",\n \"isDisabled\",\n \"textValue\",\n \"onAction\",\n \"ref\",\n ]);\n\n const state = useContext(TagListStateContext);\n const groupContext = useContext(TagGroupContext);\n\n // Create a ref for the tag\n const [tagRef, setTagRef] = createSignal<HTMLDivElement | null>(null);\n\n // Create tag accessibility props\n const tagAria = createTag(\n {\n get key() {\n return local.id;\n },\n role: \"row\",\n get isDisabled() {\n return local.isDisabled || groupContext?.isDisabled;\n },\n get textValue() {\n return local.textValue;\n },\n },\n state!,\n tagRef,\n );\n\n const normalizedRemoveButtonProps = createMemo<Record<string, unknown>>(() => {\n const raw = tagAria.removeButtonProps;\n const rawHandler = typeof raw.onPress === \"function\" ? (raw.onPress as () => void) : undefined;\n return {\n ...raw,\n onPress: () => {\n if (!tagAria.isDisabled && groupContext?.onRemove) {\n groupContext.onRemove(new Set([local.id]));\n return;\n }\n rawHandler?.();\n },\n };\n });\n\n const renderValues = createMemo<TagRenderProps>(() => ({\n isSelected: tagAria.isSelected,\n isDisabled: tagAria.isDisabled,\n isFocused: tagAria.isFocused,\n isPressed: tagAria.isPressed,\n allowsRemoving: tagAria.allowsRemoving,\n selectionMode: state?.selectionMode() ?? \"none\",\n removeButtonProps: normalizedRemoveButtonProps(),\n }));\n\n const renderProps = useRenderProps(\n {\n get children() {\n return props.children;\n },\n class: local.class,\n style: local.style,\n defaultClassName: \"solidaria-Tag\",\n },\n renderValues,\n );\n\n const selectionIndicatorContext = createMemo<SelectionIndicatorContextValue>(() => ({\n isSelected: () => tagAria.isSelected,\n }));\n\n const domProps = createMemo(() => filterDOMProps(rest, { global: true }));\n\n return (\n <SelectionIndicatorContext.Provider value={selectionIndicatorContext()}>\n <TagContext.Provider\n value={{\n get removeButtonProps() {\n return normalizedRemoveButtonProps();\n },\n get allowsRemoving() {\n return tagAria.allowsRemoving;\n },\n }}\n >\n <div\n ref={mergeRefs(setTagRef, local.ref)}\n {...domProps()}\n {...tagAria.rowProps}\n class={renderProps.class()}\n style={renderProps.style()}\n onClick={(event) => {\n const rowClick = tagAria.rowProps.onClick;\n if (typeof rowClick === \"function\") {\n (rowClick as JSX.EventHandler<HTMLDivElement, MouseEvent>)(event);\n }\n\n if (!tagAria.isDisabled && !(event.target as Element | null)?.closest(\"button\")) {\n local.onAction?.(local.id);\n }\n }}\n data-selected={dataAttr(tagAria.isSelected)}\n data-disabled={dataAttr(tagAria.isDisabled)}\n data-focused={dataAttr(tagAria.isFocused)}\n data-pressed={dataAttr(tagAria.isPressed)}\n data-allows-removing={dataAttr(tagAria.allowsRemoving)}\n >\n <div {...tagAria.gridCellProps} style={{ display: \"contents\" }}>\n {renderProps.renderChildren()}\n </div>\n </div>\n </TagContext.Provider>\n </SelectionIndicatorContext.Provider>\n );\n}\n\nexport interface TagRemoveButtonProps {\n /** The children of the button (usually an X icon). */\n children?: JSX.Element;\n /** The CSS className for the element. */\n class?: string;\n /** The inline style for the element. */\n style?: JSX.CSSProperties;\n /** Explicit button props from Tag render props. */\n buttonProps?: Record<string, unknown>;\n}\n\n/**\n * TagRemoveButton is the button used to remove a tag.\n * It should be placed inside a Tag component.\n */\nexport function TagRemoveButton(props: TagRemoveButtonProps): JSX.Element {\n const tagContext = useContext(TagContext);\n const getRemoveButtonProps = () => props.buttonProps ?? tagContext?.removeButtonProps ?? {};\n const getIsDisabled = () => Boolean(getRemoveButtonProps().isDisabled);\n const rawId = getRemoveButtonProps().id;\n const rawAriaLabel = getRemoveButtonProps()[\"aria-label\"];\n const rawAriaLabelledBy = getRemoveButtonProps()[\"aria-labelledby\"];\n const buttonId: string | undefined = typeof rawId === \"string\" ? rawId : undefined;\n const ariaLabel: string = typeof rawAriaLabel === \"string\" ? rawAriaLabel : \"Remove\";\n const ariaLabelledBy: string | undefined =\n typeof rawAriaLabelledBy === \"string\" ? rawAriaLabelledBy : undefined;\n\n const handleClick: JSX.EventHandler<HTMLButtonElement, MouseEvent> = (event) => {\n event.stopPropagation();\n const handler = getRemoveButtonProps().onPress;\n if (typeof handler === \"function\" && !getIsDisabled()) {\n (handler as () => void)();\n }\n };\n const stopRowPress: JSX.EventHandler<HTMLButtonElement, PointerEvent> = (event) => {\n event.stopPropagation();\n };\n\n return (\n <button\n type=\"button\"\n class={props.class ?? \"solidaria-TagRemoveButton\"}\n style={props.style}\n id={buttonId}\n aria-label={ariaLabel}\n aria-labelledby={ariaLabelledBy}\n disabled={getIsDisabled()}\n data-allows-removing={dataAttr(tagContext?.allowsRemoving ?? false)}\n onPointerDown={stopRowPress}\n onClick={handleClick}\n >\n {props.children ?? \"×\"}\n </button>\n );\n}\n\nexport type { Key, SelectionMode, SelectionBehavior };\n"],"mappings":";;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C;CACjD,MAAM,WAA+B,OAAO,UAAU,WAAW,QAAQ,KAAA;CACzE,MAAM,YAAoB,OAAO,iBAAiB,WAAW,eAAe;CAC5E,MAAM,iBACJ,OAAO,sBAAsB,WAAW,oBAAoB,KAAA;CAE9D,MAAM,eAAgE,UAAU;EAC9E,MAAM,gBAAgB;EACtB,MAAM,UAAU,qBAAqB,CAAC,CAAC;EACvC,IAAI,OAAO,YAAY,cAAc,CAAC,cAAc,GAClD,QAAwB;CAE5B;CACA,MAAM,gBAAmE,UAAU;EACjF,MAAM,gBAAgB;CACxB;CAEA,OACE,CAAC,OACC,cACA,OAAO,MAAM,SAAS,6BACtB,OAAO,MAAM,OACb,IAAI,UACJ,YAAY,WACZ,iBAAiB,gBACjB,UAAU,cAAc,GACxB,sBAAsB,SAAS,YAAY,kBAAkB,KAAK,GAClE,eAAe,cACf,SAAS,aACV;OACE,MAAM,YAAY,IAAI;IACzB,EAAE;AAEN"}
|
|
1
|
+
{"version":3,"file":"TagGroup.jsx","names":[],"sources":["../src/TagGroup.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/TagGroup.tsx\n\n/**\n * TagGroup component for solidaria-components\n *\n * Pre-wired headless tag group component that combines aria hooks.\n * Port of react-aria-components/src/TagGroup.tsx\n *\n * A tag group is a focusable list of labels, categories, keywords, filters, or other items,\n * with support for keyboard navigation, selection, and removal.\n */\n\nimport { createContext, createMemo, createSignal, useContext, For, Show } from \"solid-js\";\nimport type { JSX } from \"@solidjs/web\";\nimport {\n createTagGroup,\n createTag,\n useLocale,\n type AriaTagGroupProps,\n} from \"@proyecto-viviana/solidaria\";\nimport {\n createListState,\n type ListState,\n type Key,\n type SelectionMode,\n type SelectionBehavior,\n} from \"@proyecto-viviana/solid-stately\";\nimport {\n type RenderChildren,\n type ClassNameOrFunction,\n type StyleOrFunction,\n type SlotProps,\n type RefLike,\n useRenderProps,\n filterDOMProps,\n dataAttr,\n mergeRefs,\n} from \"./utils\";\nimport { SharedElementTransition } from \"./SharedElementTransition\";\nimport { splitProps } from \"@proyecto-viviana/solidaria/utils\";\nimport {\n SelectionIndicatorContext,\n type SelectionIndicatorContextValue,\n} from \"./SelectionIndicator\";\n\nexport interface TagGroupRenderProps {\n /** Whether the tag group is disabled. */\n isDisabled: boolean;\n /** Whether the tag list is empty. */\n isEmpty: boolean;\n}\n\nexport interface TagGroupProps\n extends\n Omit<AriaTagGroupProps, \"id\">,\n SlotProps,\n Omit<\n JSX.HTMLAttributes<HTMLDivElement>,\n \"class\" | \"style\" | \"children\" | \"aria-label\" | \"aria-labelledby\" | \"aria-describedby\"\n > {\n /** The children of the component. */\n children?: JSX.Element;\n /** The CSS className for the element. */\n class?: ClassNameOrFunction<TagGroupRenderProps>;\n /** The inline style for the element. */\n style?: StyleOrFunction<TagGroupRenderProps>;\n}\n\nexport interface TagListRenderProps {\n /** Whether the tag list is empty. */\n isEmpty: boolean;\n /** Whether the tag list is focused. */\n isFocused: boolean;\n}\n\nexport interface TagListProps<T>\n extends\n SlotProps,\n Omit<JSX.HTMLAttributes<HTMLDivElement>, \"class\" | \"style\" | \"children\" | \"onSelectionChange\"> {\n /** The items to display in the tag list. */\n items: T[];\n /** Function to render each item. */\n children: (item: T) => JSX.Element;\n /** The CSS className for the element. */\n class?: ClassNameOrFunction<TagListRenderProps>;\n /** The inline style for the element. */\n style?: StyleOrFunction<TagListRenderProps>;\n /** Content to render when the list is empty. */\n renderEmptyState?: () => JSX.Element;\n /** The selection mode for the tag list. */\n selectionMode?: SelectionMode;\n /** How selection behaves in the collection. */\n selectionBehavior?: SelectionBehavior;\n /** The currently selected keys (controlled). */\n selectedKeys?: Iterable<Key>;\n /** The default selected keys (uncontrolled). */\n defaultSelectedKeys?: Iterable<Key>;\n /** Handler called when selection changes. */\n onSelectionChange?: (keys: \"all\" | Set<Key>) => void;\n /** Keys that are disabled. */\n disabledKeys?: Iterable<Key>;\n /** Function to get a unique key from an item. */\n getKey?: (item: T) => Key;\n /** Accessibility label. */\n label?: string;\n /** Custom aria-label. */\n \"aria-label\"?: string;\n /** Reference to external label element. */\n \"aria-labelledby\"?: string;\n /** Reference to description element. */\n \"aria-describedby\"?: string;\n /** Whether the tag list is disabled. */\n isDisabled?: boolean;\n /** Handler called when tags are removed. */\n onRemove?: (keys: Set<Key>) => void;\n}\n\nexport interface TagRenderProps {\n /** Whether the tag is selected. */\n isSelected: boolean;\n /** Whether the tag is disabled. */\n isDisabled: boolean;\n /** Whether the tag is focused. */\n isFocused: boolean;\n /** Whether the tag is keyboard focused. */\n isFocusVisible: boolean;\n /** Whether the tag is pressed. */\n isPressed: boolean;\n /** Whether the tag allows removal. */\n allowsRemoving: boolean;\n /** The selection mode. */\n selectionMode: SelectionMode;\n /** Props for the remove button when removal is allowed. */\n removeButtonProps: Record<string, unknown>;\n}\n\nexport interface TagProps extends SlotProps {\n /** A unique key for this tag. */\n id: Key;\n /** Whether the tag is disabled. */\n isDisabled?: boolean;\n /** A text value for accessibility. */\n textValue?: string;\n /** The children of the component. A function may be provided to receive render props. */\n children?: RenderChildren<TagRenderProps>;\n /** The CSS className for the element. */\n class?: ClassNameOrFunction<TagRenderProps>;\n /** The inline style for the element. */\n style?: StyleOrFunction<TagRenderProps>;\n /** A ref to the tag's DOM element (merged with the internal collection ref). */\n ref?: RefLike<HTMLDivElement>;\n /** Handler called when the tag is activated. */\n onAction?: (key: Key) => void;\n}\n\ninterface TagGroupContextValue {\n state: ListState;\n onRemove?: (keys: Set<Key>) => void;\n isDisabled?: boolean;\n}\n\ninterface TagContextValue {\n removeButtonProps: Record<string, unknown>;\n allowsRemoving: boolean;\n}\n\nexport const TagGroupContext = createContext<TagGroupContextValue | null>(null);\nexport const TagListStateContext = createContext<ListState | null>(null);\nexport const TagContext = createContext<TagContextValue | null>(null);\n\nexport function useTagGroupContext(): TagGroupContextValue | null {\n return useContext(TagGroupContext);\n}\n\n/**\n * A tag group is a focusable list of labels, categories, keywords, filters, or other items,\n * with support for keyboard navigation, selection, and removal.\n *\n * @example\n * ```tsx\n * <TagGroup label=\"Categories\" onRemove={(keys) => removeItems(keys)}>\n * <TagList items={items}>\n * {(item) => <Tag id={item.id}>{item.name}</Tag>}\n * </TagList>\n * </TagGroup>\n * ```\n */\nexport function TagGroup(props: TagGroupProps): JSX.Element {\n const [local, domProps] = splitProps(props, [\"class\", \"style\", \"slot\", \"children\"]);\n\n // We need TagList to provide the state, so TagGroup just provides context\n return (\n <div\n {...domProps}\n class={typeof local.class === \"string\" ? local.class : \"solidaria-TagGroup\"}\n style={typeof local.style === \"object\" ? local.style : undefined}\n slot={local.slot}\n >\n {props.children}\n </div>\n );\n}\n\n/**\n * TagList contains the list of tags within a TagGroup.\n */\nexport function TagList<T extends { id?: Key; key?: Key }>(props: TagListProps<T>): JSX.Element {\n const [local, domProps] = splitProps(props, [\n \"items\",\n \"class\",\n \"style\",\n \"slot\",\n \"renderEmptyState\",\n \"children\",\n \"selectionMode\",\n \"selectionBehavior\",\n \"selectedKeys\",\n \"defaultSelectedKeys\",\n \"onSelectionChange\",\n \"disabledKeys\",\n \"getKey\",\n \"label\",\n \"aria-label\",\n \"aria-labelledby\",\n \"aria-describedby\",\n \"isDisabled\",\n \"onRemove\",\n ]);\n\n // Create a ref for the grid\n const [gridRef, setGridRef] = createSignal<HTMLDivElement | null>(null);\n\n // Default getKey function\n const getKey = (item: T): Key => {\n if (local.getKey) return local.getKey(item);\n if (item.id !== undefined) return item.id;\n if (item.key !== undefined) return item.key;\n return String(item);\n };\n\n const state = createListState({\n get items() {\n return local.items;\n },\n getKey,\n get selectionMode() {\n return local.selectionMode ?? \"none\";\n },\n get selectionBehavior() {\n return local.selectionBehavior ?? \"toggle\";\n },\n get selectedKeys() {\n return local.selectedKeys;\n },\n get defaultSelectedKeys() {\n return local.defaultSelectedKeys;\n },\n get onSelectionChange() {\n return local.onSelectionChange;\n },\n get disabledKeys() {\n return local.disabledKeys;\n },\n });\n\n // The tag group navigates on the inline axis, so ArrowLeft/ArrowRight flip\n // under RTL. Thread the resolved layout direction into the hook (mirrors\n // ListBox, and useTagGroup passing `direction` to the ListKeyboardDelegate).\n const locale = useLocale();\n\n // Callback-valued props must not go through createMemo — a memo that\n // stores a function is easy to unwrap/call, and the live getter\n // `onRemove={handler()}` must re-read on each access.\n const onRemove = () => local.onRemove;\n\n const tagGroupAria = createTagGroup(\n {\n get \"aria-label\"() {\n return local[\"aria-label\"] ?? (!local[\"aria-labelledby\"] ? local.label : undefined);\n },\n get \"aria-labelledby\"() {\n return local[\"aria-labelledby\"];\n },\n get \"aria-describedby\"() {\n return local[\"aria-describedby\"];\n },\n get isDisabled() {\n return local.isDisabled;\n },\n get onRemove() {\n return onRemove();\n },\n get direction() {\n return locale().direction;\n },\n },\n state,\n gridRef,\n );\n\n const [isFocused, setIsFocused] = createSignal(false);\n\n const renderValues = createMemo<TagListRenderProps>(() => ({\n isEmpty: local.items.length === 0,\n isFocused: isFocused(),\n }));\n\n const renderProps = useRenderProps(\n {\n class: local.class,\n style: local.style,\n defaultClassName: \"solidaria-TagList\",\n },\n renderValues,\n );\n\n const contextValue: TagGroupContextValue = {\n state,\n get onRemove() {\n return onRemove();\n },\n get isDisabled() {\n return local.isDisabled;\n },\n };\n\n return (\n <TagGroupContext value={contextValue}>\n <TagListStateContext value={state}>\n <div\n ref={setGridRef}\n {...domProps}\n {...tagGroupAria.gridProps}\n class={renderProps.class()}\n style={renderProps.style()}\n // Track focus-within via the BUBBLING focusin/focusout pair (not the\n // non-bubbling focus/blur the hook's trampoline uses) so this render-prop\n // signal never clobbers `gridProps.onFocus` — the container focus\n // trampoline that marshals entry onto the first/last row.\n onFocusIn={() => {\n setIsFocused(true);\n }}\n onFocusOut={(e) => {\n const nextTarget = e.relatedTarget as Node | null;\n if (nextTarget && e.currentTarget.contains(nextTarget)) {\n return;\n }\n\n setIsFocused(false);\n }}\n data-empty={dataAttr(local.items.length === 0)}\n data-focused={dataAttr(isFocused())}\n >\n <SharedElementTransition>\n <Show when={local.items.length > 0} fallback={local.renderEmptyState?.()}>\n <For each={local.items}>{(item) => props.children(item)}</For>\n </Show>\n </SharedElementTransition>\n </div>\n </TagListStateContext>\n </TagGroupContext>\n );\n}\n\n/**\n * A Tag is an individual item within a TagList.\n */\nexport function Tag(props: TagProps): JSX.Element {\n const [local, rest] = splitProps(props, [\n \"id\",\n \"class\",\n \"style\",\n \"slot\",\n \"isDisabled\",\n \"textValue\",\n \"onAction\",\n \"ref\",\n ]);\n\n const state = useContext(TagListStateContext);\n const groupContext = useContext(TagGroupContext);\n\n // Create a ref for the tag\n const [tagRef, setTagRef] = createSignal<HTMLDivElement | null>(null);\n\n // Create tag accessibility props\n const tagAria = createTag(\n {\n get key() {\n return local.id;\n },\n role: \"row\",\n get isDisabled() {\n return local.isDisabled || groupContext?.isDisabled;\n },\n get textValue() {\n return local.textValue;\n },\n get onAction() {\n return local.onAction ? () => local.onAction?.(local.id) : undefined;\n },\n },\n state!,\n tagRef,\n );\n\n const normalizedRemoveButtonProps = createMemo<Record<string, unknown>>(() => {\n const raw = tagAria.removeButtonProps;\n const rawHandler = typeof raw.onPress === \"function\" ? (raw.onPress as () => void) : undefined;\n return {\n ...raw,\n onPress: () => {\n rawHandler?.();\n },\n };\n });\n\n const allowsRemoving = createMemo(\n () => Boolean(tagAria.allowsRemoving) || Boolean(groupContext?.onRemove),\n );\n const renderValues = createMemo<TagRenderProps>(() => ({\n isSelected: tagAria.isSelected,\n isDisabled: tagAria.isDisabled,\n isFocused: tagAria.isFocused,\n isFocusVisible: tagAria.isFocusVisible,\n isPressed: tagAria.isPressed,\n allowsRemoving: allowsRemoving(),\n selectionMode: state?.selectionMode() ?? \"none\",\n removeButtonProps: normalizedRemoveButtonProps(),\n }));\n\n const renderProps = useRenderProps(\n {\n get children() {\n return props.children;\n },\n class: local.class,\n style: local.style,\n defaultClassName: \"solidaria-Tag\",\n },\n renderValues,\n );\n\n const selectionIndicatorContext = createMemo<SelectionIndicatorContextValue>(() => ({\n isSelected: () => tagAria.isSelected,\n }));\n\n const domProps = createMemo(() => filterDOMProps(rest, { global: true }));\n\n return (\n <SelectionIndicatorContext value={selectionIndicatorContext()}>\n <TagContext\n value={{\n get removeButtonProps() {\n return normalizedRemoveButtonProps();\n },\n get allowsRemoving() {\n return allowsRemoving();\n },\n }}\n >\n <div\n ref={mergeRefs(setTagRef, local.ref)}\n {...domProps()}\n {...tagAria.rowProps}\n class={renderProps.class()}\n style={renderProps.style()}\n data-selected={dataAttr(tagAria.isSelected)}\n data-disabled={dataAttr(tagAria.isDisabled)}\n data-focused={dataAttr(tagAria.isFocused)}\n data-focus-visible={dataAttr(tagAria.isFocusVisible)}\n data-pressed={dataAttr(tagAria.isPressed)}\n data-allows-removing={dataAttr(allowsRemoving())}\n >\n <div {...tagAria.gridCellProps} style={{ display: \"contents\" }}>\n {renderProps.renderChildrenStable()}\n </div>\n </div>\n </TagContext>\n </SelectionIndicatorContext>\n );\n}\n\nexport interface TagRemoveButtonProps {\n /** The children of the button (usually an X icon). */\n children?: JSX.Element;\n /** The CSS className for the element. */\n class?: string;\n /** The inline style for the element. */\n style?: JSX.CSSProperties;\n /** Explicit button props from Tag render props. */\n buttonProps?: Record<string, unknown>;\n}\n\n/**\n * TagRemoveButton is the button used to remove a tag.\n * It should be placed inside a Tag component.\n */\nexport function TagRemoveButton(props: TagRemoveButtonProps): JSX.Element {\n const tagContext = useContext(TagContext);\n const getRemoveButtonProps = () => props.buttonProps ?? tagContext?.removeButtonProps ?? {};\n const getIsDisabled = () => Boolean(getRemoveButtonProps().isDisabled);\n const rawId = getRemoveButtonProps().id;\n const rawAriaLabel = getRemoveButtonProps()[\"aria-label\"];\n const rawAriaLabelledBy = getRemoveButtonProps()[\"aria-labelledby\"];\n const rawTabIndex = getRemoveButtonProps().tabIndex;\n const buttonId: string | undefined = typeof rawId === \"string\" ? rawId : undefined;\n const ariaLabel: string = typeof rawAriaLabel === \"string\" ? rawAriaLabel : \"Remove\";\n const ariaLabelledBy: string | undefined =\n typeof rawAriaLabelledBy === \"string\" ? rawAriaLabelledBy : undefined;\n const tabindex: number | undefined = typeof rawTabIndex === \"number\" ? rawTabIndex : undefined;\n\n const handleClick: JSX.EventHandler<HTMLButtonElement, MouseEvent> = (event) => {\n event.stopPropagation();\n const handler = getRemoveButtonProps().onPress;\n if (typeof handler === \"function\" && !getIsDisabled()) {\n (handler as () => void)();\n }\n };\n const stopRowPress: JSX.EventHandler<HTMLButtonElement, PointerEvent> = (event) => {\n event.stopPropagation();\n };\n\n return (\n <button\n type=\"button\"\n class={props.class ?? \"solidaria-TagRemoveButton\"}\n style={props.style}\n id={buttonId}\n aria-label={ariaLabel}\n aria-labelledby={ariaLabelledBy}\n tabindex={tabindex}\n disabled={getIsDisabled()}\n data-allows-removing={dataAttr(tagContext?.allowsRemoving ?? false)}\n onPointerDown={stopRowPress}\n onClick={handleClick}\n >\n {props.children ?? \"×\"}\n </button>\n );\n}\n\nexport type { Key, SelectionMode, SelectionBehavior };\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAkLA,MAAa,kBAAkB,cAA2C,IAAI;AAC9E,MAAa,sBAAsB,cAAgC,IAAI;AACvE,MAAa,aAAa,cAAsC,IAAI;AAEpE,SAAgB,qBAAkD;CAChE,OAAO,WAAW,eAAe;AACnC;;;;;;;;;;;;;;AAeA,SAAgB,SAAS,OAAmC;CAC1D,MAAM,CAAC,OAAO,YAAY,WAAW,OAAO;EAAC;EAAS;EAAS;EAAQ;CAAU,CAAC;CAGlF,OACE,CAAC,QACK,UACJ,O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ACxB;CAEA,OACE,CAAC,OACC,cACA,OAAO,MAAM,SAAS,6BACtB,OAAO,MAAM,OACb,IAAI,UACJ,YAAY,WACZ,iBAAiB,gBACjB,UAAU,UACV,UAAU,cAAc,GACxB,sBAAsB,SAAS,YAAY,kBAAkB,KAAK,GAClE,eAAe,cACf,SAAS,aACV;OACE,MAAM,YAAY,IAAI;IACzB,EAAE;AAEN"}
|
package/dist/Text.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import type { JSX } from "@solidjs/web";
|
|
2
2
|
import { type ContextValue, type SlotProps } from "./utils";
|
|
3
3
|
export interface TextProps extends JSX.HTMLAttributes<HTMLElement>, SlotProps {
|
|
4
4
|
/** The element type to render as. @default 'span' */
|
|
@@ -8,13 +8,13 @@ export interface TextProps extends JSX.HTMLAttributes<HTMLElement>, SlotProps {
|
|
|
8
8
|
* Slotted context for `Text`. A field provides description / errorMessage props
|
|
9
9
|
* (each carrying the `id` its `aria-describedby` references) under named slots,
|
|
10
10
|
* so a `<Text slot="description">` child picks up the right `id` without the field
|
|
11
|
-
* threading it manually.
|
|
11
|
+
* threading it manually. It matches the upstream `TextContext` (default
|
|
12
12
|
* `{}` so an unprovided `Text` merges against an empty context and renders as-is).
|
|
13
13
|
*/
|
|
14
14
|
export declare const TextContext: import("solid-js").Context<ContextValue<TextProps, HTMLElement>>;
|
|
15
15
|
/**
|
|
16
16
|
* A piece of text, typically a label, description, or error message inside a
|
|
17
|
-
* field.
|
|
17
|
+
* field. It adapts the pinned `Text` component and consumes its slot from
|
|
18
18
|
* `TextContext` (via `useContextProps`) so a field can supply the `id` and other
|
|
19
19
|
* props for the matching slot, then renders them onto the element.
|
|
20
20
|
*/
|
package/dist/Text.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Text.d.ts","sourceRoot":"","sources":["../src/Text.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"Text.d.ts","sourceRoot":"","sources":["../src/Text.tsx"],"names":[],"mappings":"AAeA,OAAO,KAAK,EAAE,GAAG,EAAE,MAAM,cAAc,CAAC;AAExC,OAAO,EAAE,KAAK,YAAY,EAAE,KAAK,SAAS,EAAmC,MAAM,SAAS,CAAC;AAG7F,MAAM,WAAW,SAAU,SAAQ,GAAG,CAAC,cAAc,CAAC,WAAW,CAAC,EAAE,SAAS;IAC3E,qDAAqD;IACrD,WAAW,CAAC,EAAE,MAAM,CAAC;CACtB;AAED;;;;;;GAMG;AACH,eAAO,MAAM,WAAW,kEAA0D,CAAC;AAEnF;;;;;GAKG;AACH,wBAAgB,IAAI,CAAC,KAAK,EAAE,SAAS,GAAG,GAAG,CAAC,OAAO,CAgBlD"}
|
package/dist/Text.js
CHANGED
|
@@ -1,19 +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/Text.tsx
|
|
1
13
|
import { filterDOMProps, useContextProps } from "./utils.js";
|
|
2
14
|
import { ElementTag } from "./ElementTag.js";
|
|
3
|
-
import { createComponent, mergeProps } from "
|
|
4
|
-
import { createContext
|
|
15
|
+
import { createComponent, mergeProps } from "@solidjs/web";
|
|
16
|
+
import { createContext } from "solid-js";
|
|
17
|
+
import { splitProps } from "@proyecto-viviana/solidaria/utils";
|
|
5
18
|
//#region src/Text.tsx
|
|
6
19
|
/**
|
|
7
20
|
* Slotted context for `Text`. A field provides description / errorMessage props
|
|
8
21
|
* (each carrying the `id` its `aria-describedby` references) under named slots,
|
|
9
22
|
* so a `<Text slot="description">` child picks up the right `id` without the field
|
|
10
|
-
* threading it manually.
|
|
23
|
+
* threading it manually. It matches the upstream `TextContext` (default
|
|
11
24
|
* `{}` so an unprovided `Text` merges against an empty context and renders as-is).
|
|
12
25
|
*/
|
|
13
26
|
const TextContext = createContext({});
|
|
14
27
|
/**
|
|
15
28
|
* A piece of text, typically a label, description, or error message inside a
|
|
16
|
-
* field.
|
|
29
|
+
* field. It adapts the pinned `Text` component and consumes its slot from
|
|
17
30
|
* `TextContext` (via `useContextProps`) so a field can supply the `id` and other
|
|
18
31
|
* props for the matching slot, then renders them onto the element.
|
|
19
32
|
*/
|
|
@@ -23,12 +36,16 @@ function Text(props) {
|
|
|
23
36
|
"elementType",
|
|
24
37
|
"class",
|
|
25
38
|
"children",
|
|
26
|
-
"slot",
|
|
27
39
|
"ref"
|
|
28
40
|
]);
|
|
29
|
-
return createComponent(ElementTag, mergeProps({ get
|
|
41
|
+
return createComponent(ElementTag, mergeProps({ get "class"() {
|
|
30
42
|
return local.class ?? "solidaria-Text";
|
|
31
|
-
} }, () =>
|
|
43
|
+
} }, () => {
|
|
44
|
+
return filterDOMProps(domProps, { global: true });
|
|
45
|
+
}, {
|
|
46
|
+
get slot() {
|
|
47
|
+
return merged.slot;
|
|
48
|
+
},
|
|
32
49
|
get tag() {
|
|
33
50
|
return local.elementType ?? "span";
|
|
34
51
|
},
|
package/dist/Text.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Text.js","names":["
|
|
1
|
+
{"version":3,"file":"Text.js","names":["<ElementTag\n class={local.class ?? \"solidaria-Text\"}\n {...filterDOMProps(domProps, { global: true })}\n slot={merged.slot}\n // last, so a stray `tag` in the spread can never redirect the element\n tag={local.elementType ?? \"span\"}\n >\n {local.children}\n </ElementTag>"],"sources":["../src/Text.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/Text.tsx\n\nimport { createContext } from \"solid-js\";\nimport type { JSX } from \"@solidjs/web\";\nimport { ElementTag } from \"./ElementTag\";\nimport { type ContextValue, type SlotProps, useContextProps, filterDOMProps } from \"./utils\";\nimport { splitProps } from \"@proyecto-viviana/solidaria/utils\";\n\nexport interface TextProps extends JSX.HTMLAttributes<HTMLElement>, SlotProps {\n /** The element type to render as. @default 'span' */\n elementType?: string;\n}\n\n/**\n * Slotted context for `Text`. A field provides description / errorMessage props\n * (each carrying the `id` its `aria-describedby` references) under named slots,\n * so a `<Text slot=\"description\">` child picks up the right `id` without the field\n * threading it manually. It matches the upstream `TextContext` (default\n * `{}` so an unprovided `Text` merges against an empty context and renders as-is).\n */\nexport const TextContext = createContext<ContextValue<TextProps, HTMLElement>>({});\n\n/**\n * A piece of text, typically a label, description, or error message inside a\n * field. It adapts the pinned `Text` component and consumes its slot from\n * `TextContext` (via `useContextProps`) so a field can supply the `id` and other\n * props for the matching slot, then renders them onto the element.\n */\nexport function Text(props: TextProps): JSX.Element {\n const [merged] = useContextProps(props, undefined, TextContext);\n // RAC `Text.tsx:28-31` spreads remaining props — including `slot` — onto the\n // element. `ref`/`class`/`children`/`elementType` are rendered explicitly.\n const [local, domProps] = splitProps(merged, [\"elementType\", \"class\", \"children\", \"ref\"]);\n return (\n <ElementTag\n class={local.class ?? \"solidaria-Text\"}\n {...filterDOMProps(domProps, { global: true })}\n slot={merged.slot}\n // last, so a stray `tag` in the spread can never redirect the element\n tag={local.elementType ?? \"span\"}\n >\n {local.children}\n </ElementTag>\n );\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;AAgCA,MAAa,cAAc,cAAoD,CAAC,CAAC;;;;;;;AAQjF,SAAgB,KAAK,OAA+B;CAClD,MAAM,CAAC,UAAU,gBAAgB,OAAO,KAAA,GAAW,WAAW;CAG9D,MAAM,CAAC,OAAO,YAAY,WAAW,QAAQ;EAAC;EAAe;EAAS;EAAY;CAAK,CAAC;CACxF,OACEA,gBAAAA,YAAAA,WAAAA,EACE,IAAA,UAAA;EAAO,OAAA,MAAM,SAAS;CAAgB,EAO5B,SANV;EAAI,OAAA,eAAe,UAAU,EAAE,QAAQ,KAAK,CAAC;CAAC,GAFhD;EAGE,IAAA,OAAA;GAAM,OAAA,OAAO;EAAI;EAEjB,IAAA,MAAA;GAAK,OAAA,MAAM,eAAe;EAAM;EALlC,IAAA,WAAA;GAOG,OAAA,MAAM;EACG;;AAEhB"}
|
package/dist/Text.jsx
CHANGED
|
@@ -1,18 +1,31 @@
|
|
|
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/Text.tsx
|
|
1
13
|
import { filterDOMProps, useContextProps } from "./utils.jsx";
|
|
2
14
|
import { ElementTag } from "./ElementTag.jsx";
|
|
3
|
-
import { createContext
|
|
15
|
+
import { createContext } from "solid-js";
|
|
16
|
+
import { splitProps } from "@proyecto-viviana/solidaria/utils";
|
|
4
17
|
//#region src/Text.tsx
|
|
5
18
|
/**
|
|
6
19
|
* Slotted context for `Text`. A field provides description / errorMessage props
|
|
7
20
|
* (each carrying the `id` its `aria-describedby` references) under named slots,
|
|
8
21
|
* so a `<Text slot="description">` child picks up the right `id` without the field
|
|
9
|
-
* threading it manually.
|
|
22
|
+
* threading it manually. It matches the upstream `TextContext` (default
|
|
10
23
|
* `{}` so an unprovided `Text` merges against an empty context and renders as-is).
|
|
11
24
|
*/
|
|
12
25
|
const TextContext = createContext({});
|
|
13
26
|
/**
|
|
14
27
|
* A piece of text, typically a label, description, or error message inside a
|
|
15
|
-
* field.
|
|
28
|
+
* field. It adapts the pinned `Text` component and consumes its slot from
|
|
16
29
|
* `TextContext` (via `useContextProps`) so a field can supply the `id` and other
|
|
17
30
|
* props for the matching slot, then renders them onto the element.
|
|
18
31
|
*/
|
|
@@ -22,10 +35,9 @@ function Text(props) {
|
|
|
22
35
|
"elementType",
|
|
23
36
|
"class",
|
|
24
37
|
"children",
|
|
25
|
-
"slot",
|
|
26
38
|
"ref"
|
|
27
39
|
]);
|
|
28
|
-
return <ElementTag class={local.class ?? "solidaria-Text"} {...filterDOMProps(domProps, { global: true })} tag={local.elementType ?? "span"}>
|
|
40
|
+
return <ElementTag class={local.class ?? "solidaria-Text"} {...filterDOMProps(domProps, { global: true })} slot={merged.slot} tag={local.elementType ?? "span"}>
|
|
29
41
|
{local.children}
|
|
30
42
|
</ElementTag>;
|
|
31
43
|
}
|
package/dist/Text.jsx.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Text.jsx","names":[],"sources":["../src/Text.tsx"],"sourcesContent":["
|
|
1
|
+
{"version":3,"file":"Text.jsx","names":[],"sources":["../src/Text.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/Text.tsx\n\nimport { createContext } from \"solid-js\";\nimport type { JSX } from \"@solidjs/web\";\nimport { ElementTag } from \"./ElementTag\";\nimport { type ContextValue, type SlotProps, useContextProps, filterDOMProps } from \"./utils\";\nimport { splitProps } from \"@proyecto-viviana/solidaria/utils\";\n\nexport interface TextProps extends JSX.HTMLAttributes<HTMLElement>, SlotProps {\n /** The element type to render as. @default 'span' */\n elementType?: string;\n}\n\n/**\n * Slotted context for `Text`. A field provides description / errorMessage props\n * (each carrying the `id` its `aria-describedby` references) under named slots,\n * so a `<Text slot=\"description\">` child picks up the right `id` without the field\n * threading it manually. It matches the upstream `TextContext` (default\n * `{}` so an unprovided `Text` merges against an empty context and renders as-is).\n */\nexport const TextContext = createContext<ContextValue<TextProps, HTMLElement>>({});\n\n/**\n * A piece of text, typically a label, description, or error message inside a\n * field. It adapts the pinned `Text` component and consumes its slot from\n * `TextContext` (via `useContextProps`) so a field can supply the `id` and other\n * props for the matching slot, then renders them onto the element.\n */\nexport function Text(props: TextProps): JSX.Element {\n const [merged] = useContextProps(props, undefined, TextContext);\n // RAC `Text.tsx:28-31` spreads remaining props — including `slot` — onto the\n // element. `ref`/`class`/`children`/`elementType` are rendered explicitly.\n const [local, domProps] = splitProps(merged, [\"elementType\", \"class\", \"children\", \"ref\"]);\n return (\n <ElementTag\n class={local.class ?? \"solidaria-Text\"}\n {...filterDOMProps(domProps, { global: true })}\n slot={merged.slot}\n // last, so a stray `tag` in the spread can never redirect the element\n tag={local.elementType ?? \"span\"}\n >\n {local.children}\n </ElementTag>\n );\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;AAgCA,MAAa,cAAc,cAAoD,CAAC,CAAC;;;;;;;AAQjF,SAAgB,KAAK,OAA+B;CAClD,MAAM,CAAC,UAAU,gBAAgB,OAAO,KAAA,GAAW,WAAW;CAG9D,MAAM,CAAC,OAAO,YAAY,WAAW,QAAQ;EAAC;EAAe;EAAS;EAAY;CAAK,CAAC;CACxF,OACE,CAAC,WACC,OAAO,MAAM,SAAS,sBAClB,eAAe,UAAU,EAAE,QAAQ,KAAK,CAAC,GAC7C,MAAM,OAAO,MAEb,KAAK,MAAM,eAAe,QAC3B;OACE,MAAM,SAAS;IAClB,EAAE;AAEN"}
|
package/dist/TextField.d.ts
CHANGED
|
@@ -1,10 +1,5 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
*
|
|
4
|
-
* A pre-wired headless text field that combines state + aria hooks.
|
|
5
|
-
* Port of react-aria-components/src/TextField.tsx
|
|
6
|
-
*/
|
|
7
|
-
import { type JSX, type Context } from "solid-js";
|
|
1
|
+
import type { Context } from "solid-js";
|
|
2
|
+
import type { JSX } from "@solidjs/web";
|
|
8
3
|
import { type AriaTextFieldProps } from "@proyecto-viviana/solidaria";
|
|
9
4
|
import { type RenderChildren, type ClassNameOrFunction, type StyleOrFunction, type SlotProps } from "./utils";
|
|
10
5
|
export interface TextFieldRenderProps {
|
|
@@ -44,18 +39,9 @@ export interface TextFieldContextValue {
|
|
|
44
39
|
setInputId?: (id: string | undefined) => void;
|
|
45
40
|
}
|
|
46
41
|
export declare const TextFieldContext: Context<TextFieldContextValue | null>;
|
|
47
|
-
export declare const LabelContext: Context<TextFieldContextValue | null>;
|
|
48
42
|
export declare const InputContext: Context<TextFieldContextValue | null>;
|
|
49
43
|
export declare const TextAreaContext: Context<TextFieldContextValue | null>;
|
|
50
44
|
export declare const FieldInputContext: Context<TextFieldContextValue | null>;
|
|
51
|
-
export interface LabelProps extends JSX.LabelHTMLAttributes<HTMLLabelElement> {
|
|
52
|
-
children?: JSX.Element;
|
|
53
|
-
}
|
|
54
|
-
/**
|
|
55
|
-
* A label element that automatically wires up to the parent TextField context.
|
|
56
|
-
* This enables the proper htmlFor/id relationship between label and input.
|
|
57
|
-
*/
|
|
58
|
-
export declare function Label(props: LabelProps): JSX.Element;
|
|
59
45
|
export interface InputProps extends Omit<JSX.InputHTMLAttributes<HTMLInputElement>, "children"> {
|
|
60
46
|
}
|
|
61
47
|
/**
|
|
@@ -91,4 +77,5 @@ export declare function TextArea(props: TextAreaProps): JSX.Element;
|
|
|
91
77
|
* ```
|
|
92
78
|
*/
|
|
93
79
|
export declare function TextField(props: TextFieldProps): JSX.Element;
|
|
80
|
+
export { Label, LabelContext, type LabelProps } from "./Label";
|
|
94
81
|
//# sourceMappingURL=TextField.d.ts.map
|
package/dist/TextField.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"TextField.d.ts","sourceRoot":"","sources":["../src/TextField.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"TextField.d.ts","sourceRoot":"","sources":["../src/TextField.tsx"],"names":[],"mappings":"AA+BA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,UAAU,CAAC;AACxC,OAAO,KAAK,EAAE,GAAG,EAAE,MAAM,cAAc,CAAC;AACxC,OAAO,EAKL,KAAK,kBAAkB,EACxB,MAAM,6BAA6B,CAAC;AAIrC,OAAO,EACL,KAAK,cAAc,EACnB,KAAK,mBAAmB,EACxB,KAAK,eAAe,EACpB,KAAK,SAAS,EAMf,MAAM,SAAS,CAAC;AAKjB,MAAM,WAAW,oBAAoB;IACnC,0CAA0C;IAC1C,UAAU,EAAE,OAAO,CAAC;IACpB,oCAAoC;IACpC,SAAS,EAAE,OAAO,CAAC;IACnB,2CAA2C;IAC3C,UAAU,EAAE,OAAO,CAAC;IACpB,0CAA0C;IAC1C,UAAU,EAAE,OAAO,CAAC;IACpB,gEAAgE;IA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