@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
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"TokenField.jsx","names":[],"sources":["../src/TokenField.tsx"],"sourcesContent":["/*\n * Copyright 2026 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/TokenField.tsx\n\n/**\n * Token field components for solidaria-components.\n *\n * A token field allows users to enter text with inline tokens.\n */\n\nimport { createContext, createMemo, createSignal, useContext } from \"solid-js\";\nimport type { Context } from \"solid-js\";\nimport type { JSX } from \"@solidjs/web\";\nimport {\n createHideableComponent,\n createHover,\n createFocusRing,\n createToken,\n createTokenField,\n mergeProps,\n type AriaTokenFieldProps,\n} from \"@proyecto-viviana/solidaria\";\nimport {\n createTokenFieldState,\n TokenFieldValue,\n type TokenFieldState,\n type TokenSegment,\n} from \"@proyecto-viviana/solid-stately\";\nimport { LabelContext } from \"./Label\";\nimport { TextContext } from \"./Text\";\nimport { FieldInputContext, type TextFieldContextValue } from \"./TextField\";\nimport { splitProps } from \"@proyecto-viviana/solidaria/utils\";\nimport {\n Provider,\n type ClassNameOrFunction,\n type ContextValue,\n type RenderChildren,\n type SlotProps,\n type StyleOrFunction,\n assignRef,\n filterDOMProps,\n type RefLike,\n type SlottedContextValue,\n useContextProps,\n useRenderProps,\n useSlot,\n useSlottedContext,\n dataAttr,\n} from \"./utils\";\n\nexport interface TokenFieldRenderProps {\n isDisabled: boolean;\n isReadOnly: boolean;\n}\n\nexport interface TokenFieldProps<T extends TokenFieldValue = TokenFieldValue>\n extends Omit<AriaTokenFieldProps<T>, \"class\" | \"style\" | \"children\">, SlotProps {\n children?: RenderChildren<TokenFieldRenderProps>;\n class?: ClassNameOrFunction<TokenFieldRenderProps>;\n style?: StyleOrFunction<TokenFieldRenderProps>;\n ref?: RefLike<HTMLDivElement>;\n}\n\nexport interface TokenInputRenderProps {\n isHovered: boolean;\n isFocused: boolean;\n isFocusVisible: boolean;\n isDisabled: boolean;\n isReadOnly: boolean;\n}\n\nexport interface TokenInputProps<T extends TokenFieldValue = TokenFieldValue> extends SlotProps {\n children: (segment: TokenSegment<T extends TokenFieldValue<infer V> ? V : never>) => JSX.Element;\n class?: ClassNameOrFunction<TokenInputRenderProps>;\n style?: StyleOrFunction<TokenInputRenderProps>;\n ref?: RefLike<HTMLDivElement>;\n}\n\ninterface TokenInputContextValue<T extends TokenFieldValue = TokenFieldValue> {\n tokenFieldProps: JSX.HTMLAttributes<HTMLDivElement>;\n state: TokenFieldState<T>;\n isDisabled: boolean;\n isReadOnly: boolean;\n autocompleteProps?: JSX.HTMLAttributes<HTMLDivElement>;\n setInputRef: (el: HTMLDivElement | null) => void;\n}\n\nexport const TokenFieldContext = createContext<ContextValue<TokenFieldProps, HTMLDivElement>>(null);\nconst TokenInputContext = createContext<TokenInputContextValue | null>(null);\n\n/**\n * A token field allows users to enter text with inline tokens.\n */\nexport const TokenField = createHideableComponent(function TokenField<\n T extends TokenFieldValue = TokenFieldValue,\n>(props: TokenFieldProps<T>): JSX.Element {\n const [merged, setOuterRef] = useContextProps(\n props,\n props.ref,\n TokenFieldContext as Context<ContextValue<TokenFieldProps<T>, HTMLDivElement>>,\n );\n const [local, rest] = splitProps(merged, [\n \"children\",\n \"class\",\n \"style\",\n \"slot\",\n \"ref\",\n \"isDisabled\",\n \"isReadOnly\",\n \"onChange\",\n \"role\",\n ]);\n const [labelRef] = useSlot(!merged[\"aria-label\"] && !merged[\"aria-labelledby\"]);\n\n const fieldCtx = useSlottedContext(\n FieldInputContext as unknown as Context<SlottedContextValue<TextFieldContextValue>>,\n merged.slot,\n );\n const [inputRef, setInputRef] = createSignal<HTMLDivElement | null>(null);\n\n const isDisabled = () => local.isDisabled || false;\n const isReadOnly = () => local.isReadOnly || false;\n\n const state = createTokenFieldState<T>({\n get value() {\n return merged.value;\n },\n get defaultValue() {\n return merged.defaultValue;\n },\n onChange: (value) => {\n local.onChange?.(value);\n const onAutocompleteChange = (fieldCtx as { onChange?: (value: string) => void } | null)\n ?.onChange;\n onAutocompleteChange?.(value.toString());\n },\n });\n\n const aria = createTokenField(\n {\n ...merged,\n get role() {\n return (\n local.role ||\n ((fieldCtx as { inputProps?: { role?: string } } | null)?.inputProps?.role as\n | AriaTokenFieldProps[\"role\"]\n | undefined) ||\n \"textbox\"\n );\n },\n },\n state,\n () => inputRef(),\n );\n\n const renderValues = createMemo<TokenFieldRenderProps>(() => ({\n isDisabled: isDisabled(),\n isReadOnly: isReadOnly(),\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-TokenField\",\n },\n renderValues,\n );\n const domProps = createMemo(() =>\n filterDOMProps(rest as Record<string, unknown>, { global: true }),\n );\n\n return (\n <div\n {...domProps()}\n ref={(el) => {\n setOuterRef(el);\n assignRef(local.ref, el);\n }}\n slot={local.slot || undefined}\n data-disabled={dataAttr(isDisabled())}\n data-readonly={dataAttr(isReadOnly())}\n class={renderProps.class()}\n style={renderProps.style()}\n >\n <Provider\n values={\n [\n [\n LabelContext,\n {\n ...aria.labelProps,\n elementType: \"span\",\n ref: labelRef,\n },\n ],\n [\n TextContext,\n {\n slots: {\n description: aria.descriptionProps,\n },\n },\n ],\n [\n TokenInputContext,\n {\n tokenFieldProps: aria.tokenFieldProps,\n state,\n isDisabled: isDisabled(),\n isReadOnly: isReadOnly(),\n autocompleteProps: fieldCtx as JSX.HTMLAttributes<HTMLDivElement> | undefined,\n setInputRef,\n },\n ],\n ] as Array<[Context<unknown>, unknown]>\n }\n >\n {renderProps.renderChildren()}\n </Provider>\n </div>\n );\n}) as (props: TokenFieldProps) => JSX.Element;\n\n/**\n * A token input represents the editable area within a token field.\n */\nexport function TokenInput<T extends TokenFieldValue = TokenFieldValue>(\n props: TokenInputProps<T>,\n): JSX.Element {\n const context = useContext(TokenInputContext);\n if (!context) {\n throw new Error(\"TokenInput must be used within a TokenField\");\n }\n\n const [local, rest] = splitProps(props, [\"children\", \"class\", \"style\", \"slot\", \"ref\"]);\n const { isHovered, hoverProps } = createHover({});\n const { isFocused, isFocusVisible, focusProps } = createFocusRing();\n\n const renderValues = createMemo<TokenInputRenderProps>(() => ({\n isHovered: isHovered(),\n isFocused: isFocused(),\n isFocusVisible: isFocusVisible(),\n isDisabled: context.isDisabled,\n isReadOnly: context.isReadOnly,\n }));\n const renderProps = useRenderProps(\n {\n class: local.class,\n style: local.style,\n defaultClassName: \"solidaria-TokenInput\",\n },\n renderValues,\n );\n const domProps = createMemo(() =>\n filterDOMProps(rest as Record<string, unknown>, { global: true }),\n );\n const cleanFocusProps = () => {\n const { ref: _ref, ...restFocus } = focusProps as Record<string, unknown>;\n return restFocus;\n };\n\n return (\n <div\n {...mergeProps(\n domProps(),\n cleanFocusProps(),\n hoverProps as Record<string, unknown>,\n context.tokenFieldProps as Record<string, unknown>,\n (context.autocompleteProps as Record<string, unknown> | undefined) ?? {},\n )}\n ref={(el) => {\n context.setInputRef(el);\n assignRef(local.ref, el);\n }}\n slot={local.slot || undefined}\n data-focused={dataAttr(isFocused())}\n data-focus-visible={dataAttr(isFocusVisible())}\n data-disabled={dataAttr(context.isDisabled)}\n data-readonly={dataAttr(context.isReadOnly)}\n class={renderProps.class()}\n style={{\n ...(renderProps.style() as JSX.CSSProperties | undefined),\n ...((context.tokenFieldProps.style as JSX.CSSProperties | undefined) ?? {}),\n }}\n >\n {context.state.value().segments.map((segment) => {\n if (segment.type === \"token\") {\n return (\n <span>\n {\"\\u200b\"}\n {local.children(segment as TokenSegment)}\n {\"\\u200b\"}\n </span>\n );\n }\n return segment.text;\n })}\n {context.state.value().segments.at(-1)?.text.endsWith(\"\\n\") ? <br /> : null}\n </div>\n );\n}\n\nexport interface TokenRenderProps {\n isSelected: boolean;\n isDisabled: boolean;\n}\n\nexport interface TokenProps extends SlotProps {\n children?: RenderChildren<TokenRenderProps>;\n class?: ClassNameOrFunction<TokenRenderProps>;\n style?: StyleOrFunction<TokenRenderProps>;\n ref?: RefLike<HTMLSpanElement>;\n}\n\n/**\n * A token represents an inline segment within a token field.\n */\nexport function Token(props: TokenProps): JSX.Element {\n const context = useContext(TokenInputContext);\n if (!context) {\n throw new Error(\"Token must be used within a TokenField\");\n }\n\n const [local, rest] = splitProps(props, [\"children\", \"class\", \"style\", \"slot\", \"ref\"]);\n const [tokenRef, setTokenRef] = createSignal<HTMLSpanElement | null>(null);\n const aria = createToken({}, context.state, () => tokenRef());\n\n const renderValues = createMemo<TokenRenderProps>(() => ({\n isSelected: aria.isSelected(),\n isDisabled: context.isDisabled,\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-Token\",\n },\n renderValues,\n );\n const domProps = createMemo(() =>\n filterDOMProps(rest as Record<string, unknown>, { global: true }),\n );\n\n return (\n <span\n {...mergeProps(domProps(), aria.tokenProps as Record<string, unknown>)}\n ref={(el) => {\n setTokenRef(el);\n assignRef(local.ref, el);\n }}\n slot={local.slot || undefined}\n data-selected={dataAttr(aria.isSelected())}\n data-disabled={dataAttr(context.isDisabled)}\n class={renderProps.class()}\n style={{\n ...(renderProps.style() as JSX.CSSProperties | undefined),\n ...((aria.tokenProps.style as JSX.CSSProperties | undefined) ?? {}),\n }}\n >\n {renderProps.renderChildren()}\n </span>\n );\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AAiGA,MAAa,oBAAoB,cAA6D,IAAI;AAClG,MAAM,oBAAoB,cAA6C,IAAI;;;;AAK3E,MAAa,aAAa,wBAAwB,SAAS,WAEzD,OAAwC;CACxC,MAAM,CAAC,QAAQ,eAAe,gBAC5B,OACA,MAAM,KACN,iBACF;CACA,MAAM,CAAC,OAAO,QAAQ,WAAW,QAAQ;EACvC;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;CACF,CAAC;CACD,MAAM,CAAC,YAAY,QAAQ,CAAC,OAAO,iBAAiB,CAAC,OAAO,kBAAkB;CAE9E,MAAM,WAAW,kBACf,mBACA,OAAO,IACT;CACA,MAAM,CAAC,UAAU,eAAe,aAAoC,IAAI;CAExE,MAAM,mBAAmB,MAAM,cAAc;CAC7C,MAAM,mBAAmB,MAAM,cAAc;CAE7C,MAAM,QAAQ,sBAAyB;EACrC,IAAI,QAAQ;GACV,OAAO,OAAO;EAChB;EACA,IAAI,eAAe;GACjB,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EAAE,KAAK,SAAS,IAAI,IAAI,CAAC,QAAQ,KAAK;IAC9E,EAAE;AAEN;;;;AAiBA,SAAgB,MAAM,OAAgC;CACpD,MAAM,UAAU,WAAW,iBAAiB;CAC5C,IAAI,CAAC,SACH,MAAM,IAAI,MAAM,wCAAwC;CAG1D,MAAM,CAAC,OAAO,QAAQ,WAAW,OAAO;EAAC;EAAY;EAAS;EAAS;EAAQ;CAAK,CAAC;CACrF,MAAM,CAAC,UAAU,eAAe,aAAqC,IAAI;CACzE,MAAM,OAAO,YAAY,CAAC,GAAG,QAAQ,aAAa,SAAS,CAAC;CAE5D,MAAM,eAAe,kBAAoC;EACvD,YAAY,KAAK,WAAW;EAC5B,YAAY,QAAQ;CACtB,EAAE;CACF,MAAM,cAAc,eAClB;EACE,IAAI,WAAW;GACb,OAAO,MAAM;EACf;EACA,OAAO,MAAM;EACb,OAAO,MAAM;EACb,kBAAkB;CACpB,GACA,YACF;CACA,MAAM,WAAW,iBACf,eAAe,MAAiC,EAAE,QAAQ,KAAK,CAAC,CAClE;CAEA,OACE,CAAC,SACK,WAAW,SAAS,GAAG,KAAK,UAAqC,GACrE,MAAM,OAAO;EACX,YAAY,EAAE;EACd,YAAU,MAAM,KAAK,EAAE;CACzB,GACA,MAAM,MAAM,QAAQ,KAAA,GACpB,eAAe,SAAS,KAAK,WAAW,CAAC,GACzC,eAAe,SAAS,QAAQ,UAAU,GAC1C,OAAO,YAAY,MAAM,GACzB,OAAO;EACL,GAAI,YAAY,MAAM;EACtB,GAAK,KAAK,WAAW,SAA2C,CAAC;CACnE,GACD;OACE,YAAY,eAAe,EAAE;IAChC,EAAE;AAEN"}
|
package/dist/Toolbar.d.ts
CHANGED
|
@@ -1,10 +1,5 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
*
|
|
4
|
-
* Pre-wired headless toolbar component that combines aria hooks.
|
|
5
|
-
* Port of react-aria-components/src/Toolbar.tsx
|
|
6
|
-
*/
|
|
7
|
-
import { type JSX, type ParentProps } from "solid-js";
|
|
1
|
+
import type { ParentProps } from "solid-js";
|
|
2
|
+
import type { JSX } from "@solidjs/web";
|
|
8
3
|
import { type AriaToolbarProps, type Orientation } from "@proyecto-viviana/solidaria";
|
|
9
4
|
import { type SlotProps } from "./utils";
|
|
10
5
|
export interface ToolbarRenderProps {
|
package/dist/Toolbar.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Toolbar.d.ts","sourceRoot":"","sources":["../src/Toolbar.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"Toolbar.d.ts","sourceRoot":"","sources":["../src/Toolbar.tsx"],"names":[],"mappings":"AAsBA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,UAAU,CAAC;AAC5C,OAAO,KAAK,EAAE,GAAG,EAAE,MAAM,cAAc,CAAC;AACxC,OAAO,EAEL,KAAK,gBAAgB,EACrB,KAAK,WAAW,EACjB,MAAM,6BAA6B,CAAC;AACrC,OAAO,EAAE,KAAK,SAAS,EAAkB,MAAM,SAAS,CAAC;AAGzD,MAAM,WAAW,kBAAkB;IACjC,sCAAsC;IACtC,WAAW,EAAE,WAAW,CAAC;CAC1B;AAED,MAAM,WAAW,YAAa,SAAQ,gBAAgB,EAAE,WAAW,EAAE,SAAS;IAC5E,6FAA6F;IAC7F,KAAK,CAAC,EAAE,MAAM,GAAG,CAAC,CAAC,WAAW,EAAE,kBAAkB,KAAK,MAAM,CAAC,CAAC;IAC/D,4FAA4F;IAC5F,KAAK,CAAC,EAAE,GAAG,CAAC,aAAa,GAAG,CAAC,CAAC,WAAW,EAAE,kBAAkB,KAAK,GAAG,CAAC,aAAa,CAAC,CAAC;IACrF,oCAAoC;IACpC,CAAC,GAAG,EAAE,QAAQ,MAAM,EAAE,GAAG,MAAM,GAAG,SAAS,CAAC;IAC5C,mCAAmC;IACnC,GAAG,CAAC,EAAE,CAAC,CAAC,EAAE,EAAE,cAAc,KAAK,IAAI,CAAC,GAAG;QAAE,OAAO,CAAC,EAAE,cAAc,GAAG,IAAI,CAAA;KAAE,CAAC;CAC5E;AAED,MAAM,WAAW,mBAAmB;IAClC,KAAK,CAAC,EAAE;QACN,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;KACzC,CAAC;CACH;AAED,eAAO,MAAM,cAAc,wDAAkD,CAAC;AAE9E;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AACH,wBAAgB,OAAO,CAAC,KAAK,EAAE,YAAY,GAAG,GAAG,CAAC,OAAO,CAgFxD"}
|
package/dist/Toolbar.js
CHANGED
|
@@ -1,7 +1,20 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Copyright 2023 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/Toolbar.tsx
|
|
1
13
|
import { filterDOMProps } from "./utils.js";
|
|
2
|
-
import { getNextElement, insert,
|
|
3
|
-
import { createContext, createMemo,
|
|
14
|
+
import { getNextElement, insert, ref, runHydrationEvents, scope, spread, template } from "@solidjs/web";
|
|
15
|
+
import { createContext, createMemo, useContext } from "solid-js";
|
|
4
16
|
import { createToolbar } from "@proyecto-viviana/solidaria";
|
|
17
|
+
import { splitProps } from "@proyecto-viviana/solidaria/utils";
|
|
5
18
|
//#region src/Toolbar.tsx
|
|
6
19
|
/**
|
|
7
20
|
* Toolbar component for solidaria-components
|
|
@@ -9,7 +22,7 @@ import { createToolbar } from "@proyecto-viviana/solidaria";
|
|
|
9
22
|
* Pre-wired headless toolbar component that combines aria hooks.
|
|
10
23
|
* Port of react-aria-components/src/Toolbar.tsx
|
|
11
24
|
*/
|
|
12
|
-
var _tmpl$ =
|
|
25
|
+
var _tmpl$ = /* @__PURE__ */ template(`<div>`);
|
|
13
26
|
const ToolbarContext = createContext(null);
|
|
14
27
|
/**
|
|
15
28
|
* A toolbar is a container for a set of interactive controls,
|
|
@@ -49,7 +62,7 @@ function Toolbar(props) {
|
|
|
49
62
|
]);
|
|
50
63
|
const ctx = useContext(ToolbarContext);
|
|
51
64
|
const slotProps = () => {
|
|
52
|
-
if (ctx?.slots && local.slot) return ctx.slots[local.slot] || {};
|
|
65
|
+
if (ctx?.slots && local.slot) return ctx.slots[typeof local.slot === "string" ? local.slot : "default"] || {};
|
|
53
66
|
return {};
|
|
54
67
|
};
|
|
55
68
|
const { toolbarProps, orientation } = createToolbar({
|
|
@@ -80,15 +93,19 @@ function Toolbar(props) {
|
|
|
80
93
|
return children;
|
|
81
94
|
});
|
|
82
95
|
const filteredDOMProps = createMemo(() => filterDOMProps(domProps, { global: true }));
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
96
|
+
var _el$ = getNextElement(_tmpl$);
|
|
97
|
+
ref(() => {
|
|
98
|
+
return (el) => {
|
|
86
99
|
if (!local.ref) return;
|
|
87
100
|
if (typeof local.ref === "function") local.ref(el);
|
|
88
101
|
else local.ref.current = el;
|
|
89
|
-
}
|
|
90
|
-
|
|
91
|
-
|
|
102
|
+
};
|
|
103
|
+
}, _el$);
|
|
104
|
+
spread(_el$, [
|
|
105
|
+
filteredDOMProps,
|
|
106
|
+
toolbarProps,
|
|
107
|
+
{
|
|
108
|
+
get "class"() {
|
|
92
109
|
return resolvedClass();
|
|
93
110
|
},
|
|
94
111
|
get style() {
|
|
@@ -97,14 +114,16 @@ function Toolbar(props) {
|
|
|
97
114
|
get slot() {
|
|
98
115
|
return local.slot;
|
|
99
116
|
},
|
|
100
|
-
get
|
|
117
|
+
get "data-orientation"() {
|
|
101
118
|
return orientation();
|
|
102
119
|
}
|
|
103
|
-
}
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
return
|
|
107
|
-
})
|
|
120
|
+
}
|
|
121
|
+
], true);
|
|
122
|
+
insert(_el$, scope(() => {
|
|
123
|
+
return resolvedChildren();
|
|
124
|
+
}));
|
|
125
|
+
runHydrationEvents();
|
|
126
|
+
return _el$;
|
|
108
127
|
}
|
|
109
128
|
//#endregion
|
|
110
129
|
export { Toolbar, ToolbarContext };
|
package/dist/Toolbar.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Toolbar.js","names":["
|
|
1
|
+
{"version":3,"file":"Toolbar.js","names":["ref={(el) => {\n if (!local.ref) return;\n if (typeof local.ref === \"function\") {\n local.ref(el);\n } else {\n local.ref.current = el;\n }\n }}","{resolvedChildren()}","<div\n {...filteredDOMProps()}\n {...toolbarProps}\n class={resolvedClass()}\n style={resolvedStyle()}\n slot={local.slot}\n data-orientation={orientation()}\n ref={(el) => {\n if (!local.ref) return;\n if (typeof local.ref === \"function\") {\n local.ref(el);\n } else {\n local.ref.current = el;\n }\n }}\n >\n {resolvedChildren()}\n </div>"],"sources":["../src/Toolbar.tsx"],"sourcesContent":["/*\n * Copyright 2023 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/Toolbar.tsx\n\n/**\n * Toolbar component for solidaria-components\n *\n * Pre-wired headless toolbar component that combines aria hooks.\n * Port of react-aria-components/src/Toolbar.tsx\n */\n\nimport { createContext, createMemo, useContext } from \"solid-js\";\nimport type { ParentProps } from \"solid-js\";\nimport type { JSX } from \"@solidjs/web\";\nimport {\n createToolbar,\n type AriaToolbarProps,\n type Orientation,\n} from \"@proyecto-viviana/solidaria\";\nimport { type SlotProps, filterDOMProps } from \"./utils\";\nimport { splitProps } from \"@proyecto-viviana/solidaria/utils\";\n\nexport interface ToolbarRenderProps {\n /** The orientation of the toolbar. */\n orientation: Orientation;\n}\n\nexport interface ToolbarProps extends AriaToolbarProps, ParentProps, SlotProps {\n /** The CSS className for the element. A function may be provided to receive render props. */\n class?: string | ((renderProps: ToolbarRenderProps) => string);\n /** The inline style for the element. A function may be provided to receive render props. */\n style?: JSX.CSSProperties | ((renderProps: ToolbarRenderProps) => JSX.CSSProperties);\n /** Additional data-* attributes. */\n [key: `data-${string}`]: string | undefined;\n /** Ref for the toolbar element. */\n ref?: ((el: HTMLDivElement) => void) | { current?: HTMLDivElement | null };\n}\n\nexport interface ToolbarContextValue {\n slots?: {\n [name: string]: Record<string, unknown>;\n };\n}\n\nexport const ToolbarContext = createContext<ToolbarContextValue | null>(null);\n\n/**\n * A toolbar is a container for a set of interactive controls,\n * such as buttons, checkboxes, or links, with arrow key navigation.\n *\n * @example\n * ```tsx\n * <Toolbar aria-label=\"Text formatting\">\n * <Button>Bold</Button>\n * <Button>Italic</Button>\n * <Button>Underline</Button>\n * </Toolbar>\n *\n * // With render props\n * <Toolbar orientation=\"vertical\">\n * {({ orientation }) => (\n * <div data-orientation={orientation}>\n * <Button>Cut</Button>\n * <Button>Copy</Button>\n * <Button>Paste</Button>\n * </div>\n * )}\n * </Toolbar>\n * ```\n */\nexport function Toolbar(props: ToolbarProps): JSX.Element {\n const [local, ariaProps, domProps] = splitProps(\n props,\n [\"class\", \"style\", \"slot\", \"children\", \"ref\"],\n [\"orientation\", \"aria-label\", \"aria-labelledby\"],\n );\n\n const ctx = useContext(ToolbarContext);\n const slotProps = () => {\n if (ctx?.slots && local.slot) {\n return ctx.slots[typeof local.slot === \"string\" ? local.slot : \"default\"] || {};\n }\n return {};\n };\n\n const { toolbarProps, orientation } = createToolbar({\n get orientation() {\n return ariaProps.orientation;\n },\n get \"aria-label\"() {\n return (\n (ariaProps[\"aria-label\"] as string | undefined) ??\n (slotProps()[\"aria-label\"] as string | undefined)\n );\n },\n get \"aria-labelledby\"() {\n return ariaProps[\"aria-labelledby\"] as string | undefined;\n },\n });\n\n const renderValues = createMemo<ToolbarRenderProps>(() => ({\n orientation: orientation(),\n }));\n\n const resolvedClass = createMemo(() => {\n const cls = local.class;\n if (typeof cls === \"function\") {\n return cls(renderValues());\n }\n return cls ?? \"solidaria-Toolbar\";\n });\n\n const resolvedStyle = createMemo(() => {\n const style = local.style;\n if (typeof style === \"function\") {\n return style(renderValues());\n }\n return style;\n });\n\n const resolvedChildren = createMemo(() => {\n const children = props.children;\n if (typeof children === \"function\") {\n return (children as (props: ToolbarRenderProps) => JSX.Element)(renderValues());\n }\n return children;\n });\n\n const filteredDOMProps = createMemo(() => filterDOMProps(domProps, { global: true }));\n\n return (\n <div\n {...filteredDOMProps()}\n {...toolbarProps}\n class={resolvedClass()}\n style={resolvedStyle()}\n slot={local.slot}\n data-orientation={orientation()}\n ref={(el) => {\n if (!local.ref) return;\n if (typeof local.ref === \"function\") {\n local.ref(el);\n } else {\n local.ref.current = el;\n }\n }}\n >\n {resolvedChildren()}\n </div>\n );\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;AAsDA,MAAa,iBAAiB,cAA0C,IAAI;;;;;;;;;;;;;;;;;;;;;;;;;AA0B5E,SAAgB,QAAQ,OAAkC;CACxD,MAAM,CAAC,OAAO,WAAW,YAAY,WACnC,OACA;EAAC;EAAS;EAAS;EAAQ;EAAY;CAAK,GAC5C;EAAC;EAAe;EAAc;CAAiB,CACjD;CAEA,MAAM,MAAM,WAAW,cAAc;CACrC,MAAM,kBAAkB;EACtB,I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;CANjC,OAAA,MAgBEC,YAAAA;EAAC,OAAA,iBAAkB;CAChB,CAAA,CAAA;CAjBL,mBAiBK;CAlBP,OACEC;AAmBJ"}
|
package/dist/Toolbar.jsx
CHANGED
|
@@ -1,6 +1,19 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Copyright 2023 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/Toolbar.tsx
|
|
1
13
|
import { filterDOMProps } from "./utils.jsx";
|
|
2
|
-
import { createContext, createMemo,
|
|
14
|
+
import { createContext, createMemo, useContext } from "solid-js";
|
|
3
15
|
import { createToolbar } from "@proyecto-viviana/solidaria";
|
|
16
|
+
import { splitProps } from "@proyecto-viviana/solidaria/utils";
|
|
4
17
|
//#region src/Toolbar.tsx
|
|
5
18
|
/**
|
|
6
19
|
* Toolbar component for solidaria-components
|
|
@@ -47,7 +60,7 @@ function Toolbar(props) {
|
|
|
47
60
|
]);
|
|
48
61
|
const ctx = useContext(ToolbarContext);
|
|
49
62
|
const slotProps = () => {
|
|
50
|
-
if (ctx?.slots && local.slot) return ctx.slots[local.slot] || {};
|
|
63
|
+
if (ctx?.slots && local.slot) return ctx.slots[typeof local.slot === "string" ? local.slot : "default"] || {};
|
|
51
64
|
return {};
|
|
52
65
|
};
|
|
53
66
|
const { toolbarProps, orientation } = createToolbar({
|
package/dist/Toolbar.jsx.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Toolbar.jsx","names":[],"sources":["../src/Toolbar.tsx"],"sourcesContent":["/**\n * Toolbar component for solidaria-components\n *\n * Pre-wired headless toolbar component that combines aria hooks.\n * Port of react-aria-components/src/Toolbar.tsx\n */\n\nimport {\
|
|
1
|
+
{"version":3,"file":"Toolbar.jsx","names":[],"sources":["../src/Toolbar.tsx"],"sourcesContent":["/*\n * Copyright 2023 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/Toolbar.tsx\n\n/**\n * Toolbar component for solidaria-components\n *\n * Pre-wired headless toolbar component that combines aria hooks.\n * Port of react-aria-components/src/Toolbar.tsx\n */\n\nimport { createContext, createMemo, useContext } from \"solid-js\";\nimport type { ParentProps } from \"solid-js\";\nimport type { JSX } from \"@solidjs/web\";\nimport {\n createToolbar,\n type AriaToolbarProps,\n type Orientation,\n} from \"@proyecto-viviana/solidaria\";\nimport { type SlotProps, filterDOMProps } from \"./utils\";\nimport { splitProps } from \"@proyecto-viviana/solidaria/utils\";\n\nexport interface ToolbarRenderProps {\n /** The orientation of the toolbar. */\n orientation: Orientation;\n}\n\nexport interface ToolbarProps extends AriaToolbarProps, ParentProps, SlotProps {\n /** The CSS className for the element. A function may be provided to receive render props. */\n class?: string | ((renderProps: ToolbarRenderProps) => string);\n /** The inline style for the element. A function may be provided to receive render props. */\n style?: JSX.CSSProperties | ((renderProps: ToolbarRenderProps) => JSX.CSSProperties);\n /** Additional data-* attributes. */\n [key: `data-${string}`]: string | undefined;\n /** Ref for the toolbar element. */\n ref?: ((el: HTMLDivElement) => void) | { current?: HTMLDivElement | null };\n}\n\nexport interface ToolbarContextValue {\n slots?: {\n [name: string]: Record<string, unknown>;\n };\n}\n\nexport const ToolbarContext = createContext<ToolbarContextValue | null>(null);\n\n/**\n * A toolbar is a container for a set of interactive controls,\n * such as buttons, checkboxes, or links, with arrow key navigation.\n *\n * @example\n * ```tsx\n * <Toolbar aria-label=\"Text formatting\">\n * <Button>Bold</Button>\n * <Button>Italic</Button>\n * <Button>Underline</Button>\n * </Toolbar>\n *\n * // With render props\n * <Toolbar orientation=\"vertical\">\n * {({ orientation }) => (\n * <div data-orientation={orientation}>\n * <Button>Cut</Button>\n * <Button>Copy</Button>\n * <Button>Paste</Button>\n * </div>\n * )}\n * </Toolbar>\n * ```\n */\nexport function Toolbar(props: ToolbarProps): JSX.Element {\n const [local, ariaProps, domProps] = splitProps(\n props,\n [\"class\", \"style\", \"slot\", \"children\", \"ref\"],\n [\"orientation\", \"aria-label\", \"aria-labelledby\"],\n );\n\n const ctx = useContext(ToolbarContext);\n const slotProps = () => {\n if (ctx?.slots && local.slot) {\n return ctx.slots[typeof local.slot === \"string\" ? local.slot : \"default\"] || {};\n }\n return {};\n };\n\n const { toolbarProps, orientation } = createToolbar({\n get orientation() {\n return ariaProps.orientation;\n },\n get \"aria-label\"() {\n return (\n (ariaProps[\"aria-label\"] as string | undefined) ??\n (slotProps()[\"aria-label\"] as string | undefined)\n );\n },\n get \"aria-labelledby\"() {\n return ariaProps[\"aria-labelledby\"] as string | undefined;\n },\n });\n\n const renderValues = createMemo<ToolbarRenderProps>(() => ({\n orientation: orientation(),\n }));\n\n const resolvedClass = createMemo(() => {\n const cls = local.class;\n if (typeof cls === \"function\") {\n return cls(renderValues());\n }\n return cls ?? \"solidaria-Toolbar\";\n });\n\n const resolvedStyle = createMemo(() => {\n const style = local.style;\n if (typeof style === \"function\") {\n return style(renderValues());\n }\n return style;\n });\n\n const resolvedChildren = createMemo(() => {\n const children = props.children;\n if (typeof children === \"function\") {\n return (children as (props: ToolbarRenderProps) => JSX.Element)(renderValues());\n }\n return children;\n });\n\n const filteredDOMProps = createMemo(() => filterDOMProps(domProps, { global: true }));\n\n return (\n <div\n {...filteredDOMProps()}\n {...toolbarProps}\n class={resolvedClass()}\n style={resolvedStyle()}\n slot={local.slot}\n data-orientation={orientation()}\n ref={(el) => {\n if (!local.ref) return;\n if (typeof local.ref === \"function\") {\n local.ref(el);\n } else {\n local.ref.current = el;\n }\n }}\n >\n {resolvedChildren()}\n </div>\n );\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;AAsDA,MAAa,iBAAiB,cAA0C,IAAI;;;;;;;;;;;;;;;;;;;;;;;;;AA0B5E,SAAgB,QAAQ,OAAkC;CACxD,MAAM,CAAC,OAAO,WAAW,YAAY,WACnC,OACA;EAAC;EAAS;EAAS;EAAQ;EAAY;CAAK,GAC5C;EAAC;EAAe;EAAc;CAAiB,CACjD;CAEA,MAAM,MAAM,WAAW,cAAc;CACrC,MAAM,kBAAkB;EACtB,IAAI,KAAK,SAAS,MAAM,MACtB,OAAO,IAAI,MAAM,OAAO,MAAM,SAAS,WAAW,MAAM,OAAO,cAAc,CAAC;EAEhF,OAAO,CAAC;CACV;CAEA,MAAM,EAAE,cAAc,gBAAgB,cAAc;EAClD,IAAI,cAAc;GAChB,OAAO,UAAU;EACnB;EACA,IAAI,eAAe;GACjB,OACG,UAAU,iBACV,UAAU,CAAC,CAAC;EAEjB;EACA,IAAI,oBAAoB;GACtB,OAAO,UAAU;EACnB;CACF,CAAC;CAED,MAAM,eAAe,kBAAsC,EACzD,aAAa,YAAY,EAC3B,EAAE;CAEF,MAAM,gBAAgB,iBAAiB;EACrC,MAAM,MAAM,MAAM;EAClB,IAAI,OAAO,QAAQ,YACjB,OAAO,IAAI,aAAa,CAAC;EAE3B,OAAO,OAAO;CAChB,CAAC;CAED,MAAM,gBAAgB,iBAAiB;EACrC,MAAM,QAAQ,MAAM;EACpB,IAAI,OAAO,UAAU,YACnB,OAAO,MAAM,aAAa,CAAC;EAE7B,OAAO;CACT,CAAC;CAED,MAAM,mBAAmB,iBAAiB;EACxC,MAAM,WAAW,MAAM;EACvB,IAAI,OAAO,aAAa,YACtB,OAAQ,SAAwD,aAAa,CAAC;EAEhF,OAAO;CACT,CAAC;CAED,MAAM,mBAAmB,iBAAiB,eAAe,UAAU,EAAE,QAAQ,KAAK,CAAC,CAAC;CAEpF,OACE,CAAC,QACK,iBAAiB,OACjB,cACJ,OAAO,cAAc,GACrB,OAAO,cAAc,GACrB,MAAM,MAAM,MACZ,kBAAkB,YAAY,GAC9B,MAAM,OAAO;EACX,IAAI,CAAC,MAAM,KAAK;EAChB,IAAI,OAAO,MAAM,QAAQ,YACvB,MAAM,IAAI,EAAE;OAEZ,MAAM,IAAI,UAAU;CAExB,GACD;OACE,iBAAiB,EAAE;IACtB,EAAE;AAEN"}
|
package/dist/Tooltip.d.ts
CHANGED
|
@@ -1,10 +1,5 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
*
|
|
4
|
-
* A tooltip displays a description of an element on hover or focus.
|
|
5
|
-
* Port of react-aria-components/src/Tooltip.tsx
|
|
6
|
-
*/
|
|
7
|
-
import { type JSX, type ParentComponent } from "solid-js";
|
|
1
|
+
import type { ParentComponent } from "solid-js";
|
|
2
|
+
import type { JSX } from "@solidjs/web";
|
|
8
3
|
import { type TooltipTriggerState, type TooltipTriggerProps as StateProps } from "@proyecto-viviana/solid-stately";
|
|
9
4
|
import { type TooltipTriggerProps as AriaProps } from "@proyecto-viviana/solidaria";
|
|
10
5
|
import { type RenderChildren, type ClassNameOrFunction, type StyleOrFunction, type SlotProps } from "./utils";
|
package/dist/Tooltip.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Tooltip.d.ts","sourceRoot":"","sources":["../src/Tooltip.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"Tooltip.d.ts","sourceRoot":"","sources":["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C;IAC/C,UAAU,EAAE,MAAM,WAAW,GAAG,IAAI,GAAG,SAAS,CAAC;IACjD,SAAS,EAAE,MAAM,gBAAgB,GAAG,SAAS,CAAC;IAC9C,gBAAgB,EAAE,MAAM,MAAM,GAAG,SAAS,CAAC;IAC3C,WAAW,EAAE,MAAM,MAAM,GAAG,SAAS,CAAC;IACtC,UAAU,EAAE,MAAM,OAAO,GAAG,SAAS,CAAC;IACtC,UAAU,EAAE,MAAM,OAAO,GAAG,SAAS,CAAC;CACvC;AAGD,eAAO,MAAM,cAAc,+DAAwB,CAAC;AACpD,eAAO,MAAM,0BAA0B,wDAAkD,CAAC;AAE1F;;;;;;;;;;;;GAYG;AACH,eAAO,MAAM,cAAc,EAAE,eAAe,CAAC,4BAA4B,CA+ExE,CAAC;AA2KF;;;;;;;;;;GAUG;AACH,wBAAgB,OAAO,CAAC,KAAK,EAAE,YAAY,GAAG,GAAG,CAAC,OAAO,CA8GxD;AAwVD,YAAY,EAAE,mBAAmB,EAAE,CAAC"}
|
package/dist/Tooltip.js
CHANGED
|
@@ -1,7 +1,19 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
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/Tooltip.tsx
|
|
13
|
+
import { dataAttr, filterDOMProps, useRenderProps } from "./utils.js";
|
|
14
|
+
import { createComponent, getNextElement, insert, isServer, mergeProps, ref, runHydrationEvents, scope, spread, template } from "@solidjs/web";
|
|
15
|
+
import { Show, createContext, createEffect, createMemo, createSignal, createTrackedEffect, onCleanup, useContext } from "solid-js";
|
|
16
|
+
import { OverlayContainer, createTooltip, createTooltipTrigger, useLocale } from "@proyecto-viviana/solidaria";
|
|
5
17
|
import { createTooltipTriggerState } from "@proyecto-viviana/solid-stately";
|
|
6
18
|
//#region src/Tooltip.tsx
|
|
7
19
|
/**
|
|
@@ -10,7 +22,8 @@ import { createTooltipTriggerState } from "@proyecto-viviana/solid-stately";
|
|
|
10
22
|
* A tooltip displays a description of an element on hover or focus.
|
|
11
23
|
* Port of react-aria-components/src/Tooltip.tsx
|
|
12
24
|
*/
|
|
13
|
-
var _tmpl$ =
|
|
25
|
+
var _tmpl$ = /* @__PURE__ */ template(`<span>`);
|
|
26
|
+
var _tmpl$2 = /* @__PURE__ */ template(`<div>`);
|
|
14
27
|
const TooltipTriggerContext = createContext(null);
|
|
15
28
|
const TooltipContext = TooltipTriggerContext;
|
|
16
29
|
const TooltipTriggerStateContext = createContext(null);
|
|
@@ -86,10 +99,10 @@ const TooltipTrigger = (props) => {
|
|
|
86
99
|
}
|
|
87
100
|
return children;
|
|
88
101
|
};
|
|
89
|
-
return createComponent(TooltipTriggerStateContext
|
|
102
|
+
return createComponent(TooltipTriggerStateContext, {
|
|
90
103
|
value: state,
|
|
91
104
|
get children() {
|
|
92
|
-
return createComponent(TooltipTriggerContext
|
|
105
|
+
return createComponent(TooltipTriggerContext, {
|
|
93
106
|
value: context,
|
|
94
107
|
get children() {
|
|
95
108
|
return processChildren();
|
|
@@ -128,14 +141,15 @@ const TriggerWrapper = (props) => {
|
|
|
128
141
|
if (!wrapperProps.onPointerLeave && typeof triggerProps.onMouseLeave === "function") wrapperProps.onPointerLeave = triggerProps.onMouseLeave;
|
|
129
142
|
return wrapperProps;
|
|
130
143
|
};
|
|
131
|
-
createEffect(() => {
|
|
132
|
-
|
|
144
|
+
createEffect(() => ({
|
|
145
|
+
element: triggerElement(),
|
|
146
|
+
wrapper: wrapperElement(),
|
|
147
|
+
triggerProps: { ...props.triggerProps }
|
|
148
|
+
}), ({ element, wrapper, triggerProps }) => {
|
|
133
149
|
if (!element) return;
|
|
134
|
-
const triggerProps = props.triggerProps;
|
|
135
150
|
const describedBy = triggerProps["aria-describedby"];
|
|
136
151
|
if (describedBy) element.setAttribute("aria-describedby", describedBy);
|
|
137
152
|
else element.removeAttribute("aria-describedby");
|
|
138
|
-
const wrapper = wrapperElement();
|
|
139
153
|
const targets = Array.from(new Set([element, wrapper].filter(Boolean)));
|
|
140
154
|
const listeners = [];
|
|
141
155
|
for (const [propName, eventName] of [
|
|
@@ -166,10 +180,10 @@ const TriggerWrapper = (props) => {
|
|
|
166
180
|
}
|
|
167
181
|
}
|
|
168
182
|
}
|
|
169
|
-
|
|
183
|
+
return () => {
|
|
170
184
|
for (const [target, eventName, listener] of listeners) target.removeEventListener(eventName, listener);
|
|
171
185
|
if (describedBy && element.getAttribute("aria-describedby") === describedBy) element.removeAttribute("aria-describedby");
|
|
172
|
-
}
|
|
186
|
+
};
|
|
173
187
|
});
|
|
174
188
|
const handleRef = (span) => {
|
|
175
189
|
setWrapperElement(span);
|
|
@@ -206,14 +220,16 @@ const TriggerWrapper = (props) => {
|
|
|
206
220
|
props.ref(immediateChild);
|
|
207
221
|
} else requestAnimationFrame(resolveRef);
|
|
208
222
|
};
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
return
|
|
216
|
-
})
|
|
223
|
+
var _el$ = getNextElement(_tmpl$);
|
|
224
|
+
ref(() => {
|
|
225
|
+
return handleRef;
|
|
226
|
+
}, _el$);
|
|
227
|
+
spread(_el$, [getWrapperEventProps, { style: { display: "contents" } }], true);
|
|
228
|
+
insert(_el$, scope(() => {
|
|
229
|
+
return child();
|
|
230
|
+
}));
|
|
231
|
+
runHydrationEvents();
|
|
232
|
+
return _el$;
|
|
217
233
|
};
|
|
218
234
|
/**
|
|
219
235
|
* A tooltip displays a description of an element on hover or focus.
|
|
@@ -228,11 +244,15 @@ const TriggerWrapper = (props) => {
|
|
|
228
244
|
*/
|
|
229
245
|
function Tooltip(props) {
|
|
230
246
|
const context = useContext(TooltipTriggerContext);
|
|
231
|
-
|
|
247
|
+
createTrackedEffect(() => {
|
|
248
|
+
const _s2Cleanups = [];
|
|
232
249
|
context?.setTooltipId(props.id);
|
|
233
|
-
|
|
250
|
+
_s2Cleanups.push(() => {
|
|
234
251
|
context?.setTooltipId(void 0);
|
|
235
252
|
});
|
|
253
|
+
return () => {
|
|
254
|
+
for (const c of _s2Cleanups) c();
|
|
255
|
+
};
|
|
236
256
|
});
|
|
237
257
|
const localState = createTooltipTriggerState({
|
|
238
258
|
get isOpen() {
|
|
@@ -253,14 +273,15 @@ function Tooltip(props) {
|
|
|
253
273
|
const isDisabled = () => props.isDisabled ?? context?.isDisabled() ?? false;
|
|
254
274
|
const isOpen = () => !isDisabled() && state().isOpen();
|
|
255
275
|
const [exitState, setExitState] = createSignal(isOpen() ? "open" : "closed");
|
|
256
|
-
|
|
276
|
+
createTrackedEffect(() => {
|
|
257
277
|
const open = isOpen();
|
|
258
278
|
const current = exitState();
|
|
259
279
|
if (current === "open" && !open) setExitState("exiting");
|
|
260
280
|
else if ((current === "closed" || current === "exiting") && open) setExitState("open");
|
|
261
281
|
});
|
|
262
282
|
const [tooltipEl, setTooltipEl] = createSignal(null);
|
|
263
|
-
|
|
283
|
+
createTrackedEffect(() => {
|
|
284
|
+
const _s2Cleanups = [];
|
|
264
285
|
if (exitState() !== "exiting") return;
|
|
265
286
|
const el = tooltipEl();
|
|
266
287
|
if (!el || !("getAnimations" in el)) {
|
|
@@ -278,9 +299,12 @@ function Tooltip(props) {
|
|
|
278
299
|
}).catch(() => {
|
|
279
300
|
if (!canceled) setExitState((s) => s === "exiting" ? "closed" : s);
|
|
280
301
|
});
|
|
281
|
-
|
|
302
|
+
_s2Cleanups.push(() => {
|
|
282
303
|
canceled = true;
|
|
283
304
|
});
|
|
305
|
+
return () => {
|
|
306
|
+
for (const c of _s2Cleanups) c();
|
|
307
|
+
};
|
|
284
308
|
});
|
|
285
309
|
const shouldRender = () => isOpen() || exitState() === "exiting";
|
|
286
310
|
const isExiting = () => exitState() === "exiting";
|
|
@@ -334,15 +358,18 @@ function Tooltip(props) {
|
|
|
334
358
|
function TooltipContent(props) {
|
|
335
359
|
if (isServer) return null;
|
|
336
360
|
let tooltipRef;
|
|
361
|
+
const locale = useLocale();
|
|
362
|
+
const direction = () => locale().direction;
|
|
337
363
|
const { tooltipProps: ariaTooltipProps } = createTooltip({}, props.state);
|
|
338
364
|
const [positionStyles, setPositionStyles] = createSignal({
|
|
339
365
|
top: "0px",
|
|
340
366
|
left: "0px",
|
|
341
367
|
visibility: "visible"
|
|
342
368
|
});
|
|
343
|
-
const [renderedPlacement, setRenderedPlacement] = createSignal(resolvePlacement(props.placement));
|
|
369
|
+
const [renderedPlacement, setRenderedPlacement] = createSignal(resolvePlacement(props.placement, direction()));
|
|
344
370
|
const [isEntering, setIsEntering] = createSignal(true);
|
|
345
|
-
|
|
371
|
+
createTrackedEffect(() => {
|
|
372
|
+
const _s2Cleanups = [];
|
|
346
373
|
if (!isEntering()) return;
|
|
347
374
|
if (!tooltipRef || !("getAnimations" in tooltipRef)) {
|
|
348
375
|
setIsEntering(false);
|
|
@@ -360,9 +387,12 @@ function TooltipContent(props) {
|
|
|
360
387
|
}).catch(() => {
|
|
361
388
|
if (!canceled) setIsEntering(false);
|
|
362
389
|
});
|
|
363
|
-
|
|
390
|
+
_s2Cleanups.push(() => {
|
|
364
391
|
canceled = true;
|
|
365
392
|
});
|
|
393
|
+
return () => {
|
|
394
|
+
for (const c of _s2Cleanups) c();
|
|
395
|
+
};
|
|
366
396
|
});
|
|
367
397
|
const values = createMemo(() => ({
|
|
368
398
|
isEntering: isEntering(),
|
|
@@ -388,7 +418,7 @@ function TooltipContent(props) {
|
|
|
388
418
|
const viewportHeight = window.innerHeight;
|
|
389
419
|
const containerPadding = props.containerPadding;
|
|
390
420
|
const crossOffset = props.crossOffset;
|
|
391
|
-
const placement = maybeFlipPlacement(resolvePlacement(props.placement), triggerRect, tooltipWidth, tooltipHeight, viewportWidth, viewportHeight, containerPadding, props.offset, props.shouldFlip);
|
|
421
|
+
const placement = maybeFlipPlacement(resolvePlacement(props.placement, direction()), triggerRect, tooltipWidth, tooltipHeight, viewportWidth, viewportHeight, containerPadding, props.offset, props.shouldFlip);
|
|
392
422
|
let top = 0;
|
|
393
423
|
let left = 0;
|
|
394
424
|
switch (placement) {
|
|
@@ -407,7 +437,6 @@ function TooltipContent(props) {
|
|
|
407
437
|
case "right":
|
|
408
438
|
top = triggerRect.top + (triggerRect.height - tooltipHeight) / 2 + crossOffset;
|
|
409
439
|
left = triggerRect.right + props.offset;
|
|
410
|
-
break;
|
|
411
440
|
}
|
|
412
441
|
if (placement === "top" || placement === "bottom") {
|
|
413
442
|
left = clamp(left, triggerRect.left - tooltipWidth + props.arrowSize + props.arrowBoundaryOffset, triggerRect.left + triggerRect.width - props.arrowSize - props.arrowBoundaryOffset);
|
|
@@ -424,7 +453,8 @@ function TooltipContent(props) {
|
|
|
424
453
|
});
|
|
425
454
|
return true;
|
|
426
455
|
};
|
|
427
|
-
|
|
456
|
+
createTrackedEffect(() => {
|
|
457
|
+
const _s2Cleanups = [];
|
|
428
458
|
props.placement;
|
|
429
459
|
props.containerPadding;
|
|
430
460
|
props.crossOffset;
|
|
@@ -454,19 +484,22 @@ function TooltipContent(props) {
|
|
|
454
484
|
};
|
|
455
485
|
window.addEventListener("scroll", closeOnScroll, true);
|
|
456
486
|
window.addEventListener("resize", updatePosition);
|
|
457
|
-
|
|
487
|
+
_s2Cleanups.push(() => {
|
|
458
488
|
if (pendingRaf) cancelAnimationFrame(pendingRaf);
|
|
459
489
|
if (pendingTimeout) clearTimeout(pendingTimeout);
|
|
460
490
|
window.removeEventListener("scroll", closeOnScroll, true);
|
|
461
491
|
window.removeEventListener("resize", updatePosition);
|
|
462
492
|
});
|
|
493
|
+
return () => {
|
|
494
|
+
for (const c of _s2Cleanups) c();
|
|
495
|
+
};
|
|
463
496
|
});
|
|
464
497
|
const domProps = filterDOMProps(props, { global: true });
|
|
465
498
|
const tooltipId = () => props.contextTooltipProps.id ?? domProps.id;
|
|
466
499
|
const { ref: _ariaRef, ...cleanAriaProps } = ariaTooltipProps;
|
|
467
500
|
const setRef = (el) => {
|
|
468
501
|
tooltipRef = el;
|
|
469
|
-
if (!props.dir) el.dir =
|
|
502
|
+
if (!props.dir) el.dir = direction();
|
|
470
503
|
if (!props.lang) {
|
|
471
504
|
const documentLang = document.documentElement.lang;
|
|
472
505
|
const navigatorLang = typeof navigator !== "undefined" ? navigator.language : "";
|
|
@@ -479,47 +512,51 @@ function TooltipContent(props) {
|
|
|
479
512
|
});
|
|
480
513
|
return createComponent(OverlayContainer, { get children() {
|
|
481
514
|
var _el$2 = getNextElement(_tmpl$2);
|
|
482
|
-
|
|
483
|
-
|
|
484
|
-
|
|
485
|
-
|
|
486
|
-
|
|
487
|
-
|
|
488
|
-
|
|
489
|
-
|
|
490
|
-
|
|
491
|
-
|
|
492
|
-
|
|
493
|
-
|
|
494
|
-
|
|
495
|
-
|
|
496
|
-
|
|
497
|
-
|
|
498
|
-
|
|
499
|
-
|
|
500
|
-
|
|
501
|
-
|
|
502
|
-
|
|
503
|
-
|
|
504
|
-
|
|
505
|
-
|
|
506
|
-
|
|
515
|
+
ref(() => {
|
|
516
|
+
return setRef;
|
|
517
|
+
}, _el$2);
|
|
518
|
+
spread(_el$2, [
|
|
519
|
+
domProps,
|
|
520
|
+
cleanAriaProps,
|
|
521
|
+
{
|
|
522
|
+
get id() {
|
|
523
|
+
return tooltipId();
|
|
524
|
+
},
|
|
525
|
+
role: "tooltip",
|
|
526
|
+
get "class"() {
|
|
527
|
+
return renderProps.class();
|
|
528
|
+
},
|
|
529
|
+
get style() {
|
|
530
|
+
return {
|
|
531
|
+
position: "absolute",
|
|
532
|
+
"z-index": 1e5,
|
|
533
|
+
...positionStyles(),
|
|
534
|
+
...renderProps.style()
|
|
535
|
+
};
|
|
536
|
+
},
|
|
537
|
+
get "data-placement"() {
|
|
538
|
+
return renderedPlacement();
|
|
539
|
+
},
|
|
540
|
+
get "data-entering"() {
|
|
541
|
+
return dataAttr(isEntering());
|
|
542
|
+
},
|
|
543
|
+
get "data-exiting"() {
|
|
544
|
+
return dataAttr(props.isExiting);
|
|
545
|
+
}
|
|
507
546
|
}
|
|
508
|
-
|
|
509
|
-
insert(_el$2, () =>
|
|
547
|
+
], true);
|
|
548
|
+
insert(_el$2, scope(() => {
|
|
549
|
+
return renderProps.renderChildren();
|
|
550
|
+
}));
|
|
510
551
|
runHydrationEvents();
|
|
511
552
|
return _el$2;
|
|
512
553
|
} });
|
|
513
554
|
}
|
|
514
|
-
function resolvePlacement(placement) {
|
|
515
|
-
if (placement === "start") return
|
|
516
|
-
if (placement === "end") return
|
|
555
|
+
function resolvePlacement(placement, direction) {
|
|
556
|
+
if (placement === "start") return direction === "rtl" ? "right" : "left";
|
|
557
|
+
if (placement === "end") return direction === "rtl" ? "left" : "right";
|
|
517
558
|
return placement;
|
|
518
559
|
}
|
|
519
|
-
function getDocumentDirection() {
|
|
520
|
-
if (typeof document === "undefined") return "ltr";
|
|
521
|
-
return document.documentElement.dir === "rtl" ? "rtl" : "ltr";
|
|
522
|
-
}
|
|
523
560
|
function maybeFlipPlacement(placement, triggerRect, tooltipWidth, tooltipHeight, viewportWidth, viewportHeight, containerPadding, offset, shouldFlip) {
|
|
524
561
|
if (!shouldFlip) return placement;
|
|
525
562
|
switch (placement) {
|