@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
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ToggleButtonGroup.jsx","names":["
|
|
1
|
+
{"version":3,"file":"ToggleButtonGroup.jsx","names":["attrString"],"sources":["../src/ToggleButtonGroup.tsx"],"sourcesContent":["/*\n * Copyright 2024 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/ToggleButtonGroup.tsx\n\n/**\n * ToggleButtonGroup component for solidaria-components.\n *\n * Groups toggle buttons with single/multiple selection state.\n * Based on packages/react-aria-components/src/ToggleButtonGroup.tsx.\n */\n\nimport { createContext, createMemo, useContext } from \"solid-js\";\nimport type { JSX } from \"@solidjs/web\";\nimport { createToggleButtonGroup, mergeProps } from \"@proyecto-viviana/solidaria\";\nimport {\n createToggleGroupState,\n type Key,\n type ToggleGroupState,\n} from \"@proyecto-viviana/solid-stately\";\nimport { splitProps } from \"@proyecto-viviana/solidaria/utils\";\nimport {\n type ClassNameOrFunction,\n type StyleOrFunction,\n type RenderChildren,\n type SlotProps,\n useRenderProps,\n filterDOMProps,\n dataAttr,\n attrString,\n} from \"./utils\";\n\nexport interface ToggleButtonGroupRenderProps {\n orientation: \"horizontal\" | \"vertical\";\n isDisabled: boolean;\n state: ToggleGroupState;\n}\n\nexport interface ToggleButtonGroupProps\n extends\n Omit<JSX.HTMLAttributes<HTMLDivElement>, \"children\" | \"class\" | \"style\" | \"onSelectionChange\">,\n SlotProps {\n selectionMode?: \"single\" | \"multiple\";\n disallowEmptySelection?: boolean;\n selectedKeys?: Iterable<Key>;\n defaultSelectedKeys?: Iterable<Key>;\n onSelectionChange?: (keys: Set<Key>) => void;\n orientation?: \"horizontal\" | \"vertical\";\n isDisabled?: boolean;\n children?: RenderChildren<ToggleButtonGroupRenderProps>;\n class?: ClassNameOrFunction<ToggleButtonGroupRenderProps>;\n style?: StyleOrFunction<ToggleButtonGroupRenderProps>;\n}\n\nexport const ToggleButtonGroupContext = createContext<ToggleButtonGroupProps | null>(null);\nexport const ToggleButtonGroupStateContext = createContext<ToggleGroupState | null>(null);\nexport const ToggleGroupStateContext = ToggleButtonGroupStateContext;\nexport type ToggleButtonGroupStateContextValue = ToggleGroupState;\n\nexport function ToggleButtonGroup(props: ToggleButtonGroupProps): JSX.Element {\n const [local, domProps] = splitProps(props, [\n \"selectionMode\",\n \"disallowEmptySelection\",\n \"selectedKeys\",\n \"defaultSelectedKeys\",\n \"onSelectionChange\",\n \"orientation\",\n \"isDisabled\",\n \"children\",\n \"class\",\n \"style\",\n \"ref\",\n \"slot\",\n \"aria-label\",\n \"aria-labelledby\",\n ]);\n\n const state = createToggleGroupState(() => ({\n selectionMode: local.selectionMode,\n disallowEmptySelection: local.disallowEmptySelection,\n selectedKeys: local.selectedKeys,\n defaultSelectedKeys: local.defaultSelectedKeys,\n onSelectionChange: local.onSelectionChange,\n isDisabled: !!local.isDisabled,\n }));\n\n const { groupProps } = createToggleButtonGroup(\n {\n get orientation() {\n return local.orientation;\n },\n get isDisabled() {\n return !!local.isDisabled;\n },\n get \"aria-label\"() {\n return attrString(local[\"aria-label\"]);\n },\n get \"aria-labelledby\"() {\n return attrString(local[\"aria-labelledby\"]);\n },\n },\n state,\n );\n\n const renderProps = useRenderProps(\n {\n get children() {\n return local.children;\n },\n class: local.class,\n style: local.style,\n defaultClassName: \"solidaria-ToggleButtonGroup\",\n },\n () => ({\n orientation: local.orientation ?? \"horizontal\",\n isDisabled: !!local.isDisabled,\n state,\n }),\n );\n\n const filteredDomProps = createMemo(() => filterDOMProps(domProps, { global: true }));\n const mergedGroupProps = createMemo(() =>\n mergeProps(filteredDomProps(), groupProps as Record<string, unknown>),\n );\n\n return (\n <div\n {...(mergedGroupProps() as JSX.HTMLAttributes<HTMLDivElement>)}\n class={renderProps.class()}\n style={renderProps.style()}\n slot={local.slot}\n data-orientation={local.orientation ?? \"horizontal\"}\n data-disabled={dataAttr(local.isDisabled)}\n ref={(el) => {\n if (!local.ref) return;\n if (typeof local.ref === \"function\") {\n local.ref(el);\n }\n }}\n >\n <ToggleButtonGroupContext value={props}>\n <ToggleButtonGroupStateContext value={state}>\n {renderProps.renderChildren()}\n </ToggleButtonGroupStateContext>\n </ToggleButtonGroupContext>\n </div>\n );\n}\n\nexport function useToggleButtonGroupStateContext(): ToggleGroupState | null {\n return useContext(Togg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MAAM,KAAK;EAChB,IAAI,OAAO,MAAM,QAAQ,YACvB,MAAM,IAAI,EAAE;CAEhB,GACD;MACC,CAAC,yBAAyB,OAAO,OAAO;QACtC,CAAC,8BAA8B,OAAO,OAAO;WAC1C,YAAY,eAAe,EAAE;QAChC,EAAE,8BAA8B;MAClC,EAAE,yBAAyB;IAC7B,EAAE;AAEN;AAEA,SAAgB,mCAA4D;CAC1E,OAAO,WAAW,6BAA6B;AACjD"}
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
import type { Context } from "solid-js";
|
|
2
|
+
import type { JSX } from "@solidjs/web";
|
|
3
|
+
import { type AriaTokenFieldProps } from "@proyecto-viviana/solidaria";
|
|
4
|
+
import { TokenFieldValue, type TokenSegment } from "@proyecto-viviana/solid-stately";
|
|
5
|
+
import { type ClassNameOrFunction, type ContextValue, type RenderChildren, type SlotProps, type StyleOrFunction, type RefLike } from "./utils";
|
|
6
|
+
export interface TokenFieldRenderProps {
|
|
7
|
+
isDisabled: boolean;
|
|
8
|
+
isReadOnly: boolean;
|
|
9
|
+
}
|
|
10
|
+
export interface TokenFieldProps<T extends TokenFieldValue = TokenFieldValue> extends Omit<AriaTokenFieldProps<T>, "class" | "style" | "children">, SlotProps {
|
|
11
|
+
children?: RenderChildren<TokenFieldRenderProps>;
|
|
12
|
+
class?: ClassNameOrFunction<TokenFieldRenderProps>;
|
|
13
|
+
style?: StyleOrFunction<TokenFieldRenderProps>;
|
|
14
|
+
ref?: RefLike<HTMLDivElement>;
|
|
15
|
+
}
|
|
16
|
+
export interface TokenInputRenderProps {
|
|
17
|
+
isHovered: boolean;
|
|
18
|
+
isFocused: boolean;
|
|
19
|
+
isFocusVisible: boolean;
|
|
20
|
+
isDisabled: boolean;
|
|
21
|
+
isReadOnly: boolean;
|
|
22
|
+
}
|
|
23
|
+
export interface TokenInputProps<T extends TokenFieldValue = TokenFieldValue> extends SlotProps {
|
|
24
|
+
children: (segment: TokenSegment<T extends TokenFieldValue<infer V> ? V : never>) => JSX.Element;
|
|
25
|
+
class?: ClassNameOrFunction<TokenInputRenderProps>;
|
|
26
|
+
style?: StyleOrFunction<TokenInputRenderProps>;
|
|
27
|
+
ref?: RefLike<HTMLDivElement>;
|
|
28
|
+
}
|
|
29
|
+
export declare const TokenFieldContext: Context<ContextValue<TokenFieldProps<TokenFieldValue<any>>, HTMLDivElement>>;
|
|
30
|
+
/**
|
|
31
|
+
* A token field allows users to enter text with inline tokens.
|
|
32
|
+
*/
|
|
33
|
+
export declare const TokenField: (props: TokenFieldProps) => JSX.Element;
|
|
34
|
+
/**
|
|
35
|
+
* A token input represents the editable area within a token field.
|
|
36
|
+
*/
|
|
37
|
+
export declare function TokenInput<T extends TokenFieldValue = TokenFieldValue>(props: TokenInputProps<T>): JSX.Element;
|
|
38
|
+
export interface TokenRenderProps {
|
|
39
|
+
isSelected: boolean;
|
|
40
|
+
isDisabled: boolean;
|
|
41
|
+
}
|
|
42
|
+
export interface TokenProps extends SlotProps {
|
|
43
|
+
children?: RenderChildren<TokenRenderProps>;
|
|
44
|
+
class?: ClassNameOrFunction<TokenRenderProps>;
|
|
45
|
+
style?: StyleOrFunction<TokenRenderProps>;
|
|
46
|
+
ref?: RefLike<HTMLSpanElement>;
|
|
47
|
+
}
|
|
48
|
+
/**
|
|
49
|
+
* A token represents an inline segment within a token field.
|
|
50
|
+
*/
|
|
51
|
+
export declare function Token(props: TokenProps): JSX.Element;
|
|
52
|
+
//# sourceMappingURL=TokenField.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"TokenField.d.ts","sourceRoot":"","sources":["../src/TokenField.tsx"],"names":[],"mappings":"AAqBA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,UAAU,CAAC;AACxC,OAAO,KAAK,EAAE,GAAG,EAAE,MAAM,cAAc,CAAC;AACxC,OAAO,EAOL,KAAK,mBAAmB,EACzB,MAAM,6BAA6B,CAAC;AACrC,OAAO,EAEL,eAAe,EAEf,KAAK,YAA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,CAAC,cAAc,CAAC,CAAC;CAC/B;AAWD,eAAO,MAAM,iBAAiB,8EAAqE,CAAC;AAGpG;;GAEG;AACH,eAAO,MAAM,UAAU,EAmIjB,CAAC,KAAK,EAAE,eAAe,KAAK,GAAG,CAAC,OAAO,CAAC;AAE9C;;GAEG;AACH,wBAAgB,UAAU,CAAC,CAAC,SAAS,eAAe,GAAG,eAAe,EACpE,KAAK,EAAE,eAAe,CAAC,CAAC,CAAC,GACxB,GAAG,CAAC,OAAO,CAwEb;AAED,MAAM,WAAW,gBAAgB;IAC/B,UAAU,EAAE,OAAO,CAAC;IACpB,UAAU,EAAE,OAAO,CAAC;CACrB;AAED,MAAM,WAAW,UAAW,SAAQ,SAAS;IAC3C,QAAQ,CAAC,EAAE,cAAc,CAAC,gBAAgB,CAAC,CAAC;IAC5C,KAAK,CAAC,EAAE,mBAAmB,CAAC,gBAAgB,CAAC,CAAC;IAC9C,KAAK,CAAC,EAAE,eAAe,CAAC,gBAAgB,CAAC,CAAC;IAC1C,GAAG,CAAC,EAAE,OAAO,CAAC,eAAe,CAAC,CAAC;CAChC;AAED;;GAEG;AACH,wBAAgB,KAAK,CAAC,KAAK,EAAE,UAAU,GAAG,GAAG,CAAC,OAAO,CAgDpD"}
|
|
@@ -0,0 +1,301 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Copyright 2026 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/TokenField.tsx
|
|
13
|
+
import { Provider, assignRef as assignRef$1, dataAttr, filterDOMProps, useContextProps, useRenderProps, useSlot, useSlottedContext } from "./utils.js";
|
|
14
|
+
import { TextContext } from "./Text.js";
|
|
15
|
+
import { n as LabelContext } from "./Label.js";
|
|
16
|
+
import { FieldInputContext } from "./TextField.js";
|
|
17
|
+
import { createComponent, getNextElement, getNextMarker, insert, memo, ref, runHydrationEvents, scope, spread, template } from "@solidjs/web";
|
|
18
|
+
import { createContext, createMemo, createSignal, useContext } from "solid-js";
|
|
19
|
+
import { createFocusRing, createHideableComponent, createHover, createToken, createTokenField, mergeProps as mergeProps$1 } from "@proyecto-viviana/solidaria";
|
|
20
|
+
import { splitProps } from "@proyecto-viviana/solidaria/utils";
|
|
21
|
+
import { createTokenFieldState } from "@proyecto-viviana/solid-stately";
|
|
22
|
+
//#region src/TokenField.tsx
|
|
23
|
+
/**
|
|
24
|
+
* Token field components for solidaria-components.
|
|
25
|
+
*
|
|
26
|
+
* A token field allows users to enter text with inline tokens.
|
|
27
|
+
*/
|
|
28
|
+
var _tmpl$ = /* @__PURE__ */ template(`<div>`);
|
|
29
|
+
var _tmpl$2 = /* @__PURE__ */ template(`<div><!$><!/><!$><!/>`);
|
|
30
|
+
var _tmpl$3 = /* @__PURE__ */ template(`<span><!$><!/>`);
|
|
31
|
+
var _tmpl$4 = /* @__PURE__ */ template(`<br>`);
|
|
32
|
+
var _tmpl$5 = /* @__PURE__ */ template(`<span>`);
|
|
33
|
+
const TokenFieldContext = createContext(null);
|
|
34
|
+
const TokenInputContext = createContext(null);
|
|
35
|
+
/**
|
|
36
|
+
* A token field allows users to enter text with inline tokens.
|
|
37
|
+
*/
|
|
38
|
+
const TokenField = createHideableComponent(function TokenField(props) {
|
|
39
|
+
const [merged, setOuterRef] = useContextProps(props, props.ref, TokenFieldContext);
|
|
40
|
+
const [local, rest] = splitProps(merged, [
|
|
41
|
+
"children",
|
|
42
|
+
"class",
|
|
43
|
+
"style",
|
|
44
|
+
"slot",
|
|
45
|
+
"ref",
|
|
46
|
+
"isDisabled",
|
|
47
|
+
"isReadOnly",
|
|
48
|
+
"onChange",
|
|
49
|
+
"role"
|
|
50
|
+
]);
|
|
51
|
+
const [labelRef] = useSlot(!merged["aria-label"] && !merged["aria-labelledby"]);
|
|
52
|
+
const fieldCtx = useSlottedContext(FieldInputContext, merged.slot);
|
|
53
|
+
const [inputRef, setInputRef] = createSignal(null);
|
|
54
|
+
const isDisabled = () => local.isDisabled || false;
|
|
55
|
+
const isReadOnly = () => local.isReadOnly || false;
|
|
56
|
+
const state = createTokenFieldState({
|
|
57
|
+
get value() {
|
|
58
|
+
return merged.value;
|
|
59
|
+
},
|
|
60
|
+
get defaultValue() {
|
|
61
|
+
return merged.defaultValue;
|
|
62
|
+
},
|
|
63
|
+
onChange: (value) => {
|
|
64
|
+
local.onChange?.(value);
|
|
65
|
+
const onAutocompleteChange = fieldCtx?.onChange;
|
|
66
|
+
onAutocompleteChange?.(value.toString());
|
|
67
|
+
}
|
|
68
|
+
});
|
|
69
|
+
const aria = createTokenField({
|
|
70
|
+
...merged,
|
|
71
|
+
get role() {
|
|
72
|
+
return local.role || fieldCtx?.inputProps?.role || "textbox";
|
|
73
|
+
}
|
|
74
|
+
}, state, () => inputRef());
|
|
75
|
+
const renderValues = createMemo(() => ({
|
|
76
|
+
isDisabled: isDisabled(),
|
|
77
|
+
isReadOnly: isReadOnly()
|
|
78
|
+
}));
|
|
79
|
+
const renderProps = useRenderProps({
|
|
80
|
+
get children() {
|
|
81
|
+
return local.children;
|
|
82
|
+
},
|
|
83
|
+
class: local.class,
|
|
84
|
+
style: local.style,
|
|
85
|
+
defaultClassName: "solidaria-TokenField"
|
|
86
|
+
}, renderValues);
|
|
87
|
+
const domProps = createMemo(() => filterDOMProps(rest, { global: true }));
|
|
88
|
+
var _el$ = getNextElement(_tmpl$);
|
|
89
|
+
ref(() => {
|
|
90
|
+
return (el) => {
|
|
91
|
+
setOuterRef(el);
|
|
92
|
+
assignRef$1(local.ref, el);
|
|
93
|
+
};
|
|
94
|
+
}, _el$);
|
|
95
|
+
spread(_el$, [domProps, {
|
|
96
|
+
get slot() {
|
|
97
|
+
return local.slot || void 0;
|
|
98
|
+
},
|
|
99
|
+
get "data-disabled"() {
|
|
100
|
+
return dataAttr(isDisabled());
|
|
101
|
+
},
|
|
102
|
+
get "data-readonly"() {
|
|
103
|
+
return dataAttr(isReadOnly());
|
|
104
|
+
},
|
|
105
|
+
get "class"() {
|
|
106
|
+
return renderProps.class();
|
|
107
|
+
},
|
|
108
|
+
get style() {
|
|
109
|
+
return renderProps.style();
|
|
110
|
+
}
|
|
111
|
+
}], true);
|
|
112
|
+
insert(_el$, createComponent(Provider, {
|
|
113
|
+
get values() {
|
|
114
|
+
return [
|
|
115
|
+
[LabelContext, {
|
|
116
|
+
...aria.labelProps,
|
|
117
|
+
elementType: "span",
|
|
118
|
+
ref: labelRef
|
|
119
|
+
}],
|
|
120
|
+
[TextContext, { slots: { description: aria.descriptionProps } }],
|
|
121
|
+
[TokenInputContext, {
|
|
122
|
+
tokenFieldProps: aria.tokenFieldProps,
|
|
123
|
+
state,
|
|
124
|
+
isDisabled: isDisabled(),
|
|
125
|
+
isReadOnly: isReadOnly(),
|
|
126
|
+
autocompleteProps: fieldCtx,
|
|
127
|
+
setInputRef
|
|
128
|
+
}]
|
|
129
|
+
];
|
|
130
|
+
},
|
|
131
|
+
get children() {
|
|
132
|
+
return renderProps.renderChildren();
|
|
133
|
+
}
|
|
134
|
+
}));
|
|
135
|
+
runHydrationEvents();
|
|
136
|
+
return _el$;
|
|
137
|
+
});
|
|
138
|
+
/**
|
|
139
|
+
* A token input represents the editable area within a token field.
|
|
140
|
+
*/
|
|
141
|
+
function TokenInput(props) {
|
|
142
|
+
const context = useContext(TokenInputContext);
|
|
143
|
+
if (!context) throw new Error("TokenInput must be used within a TokenField");
|
|
144
|
+
const [local, rest] = splitProps(props, [
|
|
145
|
+
"children",
|
|
146
|
+
"class",
|
|
147
|
+
"style",
|
|
148
|
+
"slot",
|
|
149
|
+
"ref"
|
|
150
|
+
]);
|
|
151
|
+
const { isHovered, hoverProps } = createHover({});
|
|
152
|
+
const { isFocused, isFocusVisible, focusProps } = createFocusRing();
|
|
153
|
+
const renderValues = createMemo(() => ({
|
|
154
|
+
isHovered: isHovered(),
|
|
155
|
+
isFocused: isFocused(),
|
|
156
|
+
isFocusVisible: isFocusVisible(),
|
|
157
|
+
isDisabled: context.isDisabled,
|
|
158
|
+
isReadOnly: context.isReadOnly
|
|
159
|
+
}));
|
|
160
|
+
const renderProps = useRenderProps({
|
|
161
|
+
class: local.class,
|
|
162
|
+
style: local.style,
|
|
163
|
+
defaultClassName: "solidaria-TokenInput"
|
|
164
|
+
}, renderValues);
|
|
165
|
+
const domProps = createMemo(() => filterDOMProps(rest, { global: true }));
|
|
166
|
+
const cleanFocusProps = () => {
|
|
167
|
+
const { ref: _ref, ...restFocus } = focusProps;
|
|
168
|
+
return restFocus;
|
|
169
|
+
};
|
|
170
|
+
var _el$2 = getNextElement(_tmpl$2);
|
|
171
|
+
var _el$3 = _el$2.firstChild;
|
|
172
|
+
var [_el$4, _el$5] = getNextMarker(_el$3.nextSibling);
|
|
173
|
+
var _el$6 = _el$4.nextSibling;
|
|
174
|
+
var [_el$7, _el$8] = getNextMarker(_el$6.nextSibling);
|
|
175
|
+
ref(() => {
|
|
176
|
+
return (el) => {
|
|
177
|
+
context.setInputRef(el);
|
|
178
|
+
assignRef$1(local.ref, el);
|
|
179
|
+
};
|
|
180
|
+
}, _el$2);
|
|
181
|
+
spread(_el$2, [() => {
|
|
182
|
+
return mergeProps$1(domProps(), cleanFocusProps(), hoverProps, context.tokenFieldProps, context.autocompleteProps ?? {});
|
|
183
|
+
}, {
|
|
184
|
+
get slot() {
|
|
185
|
+
return local.slot || void 0;
|
|
186
|
+
},
|
|
187
|
+
get "data-focused"() {
|
|
188
|
+
return dataAttr(isFocused());
|
|
189
|
+
},
|
|
190
|
+
get "data-focus-visible"() {
|
|
191
|
+
return dataAttr(isFocusVisible());
|
|
192
|
+
},
|
|
193
|
+
get "data-disabled"() {
|
|
194
|
+
return dataAttr(context.isDisabled);
|
|
195
|
+
},
|
|
196
|
+
get "data-readonly"() {
|
|
197
|
+
return dataAttr(context.isReadOnly);
|
|
198
|
+
},
|
|
199
|
+
get "class"() {
|
|
200
|
+
return renderProps.class();
|
|
201
|
+
},
|
|
202
|
+
get style() {
|
|
203
|
+
return {
|
|
204
|
+
...renderProps.style(),
|
|
205
|
+
...context.tokenFieldProps.style ?? {}
|
|
206
|
+
};
|
|
207
|
+
}
|
|
208
|
+
}], true);
|
|
209
|
+
insert(_el$2, scope(() => {
|
|
210
|
+
return context.state.value().segments.map((segment) => {
|
|
211
|
+
if (segment.type === "token") {
|
|
212
|
+
var _el$9 = getNextElement(_tmpl$3);
|
|
213
|
+
var _el$11 = _el$9.firstChild.nextSibling;
|
|
214
|
+
var [_el$12, _el$13] = getNextMarker(_el$11.nextSibling);
|
|
215
|
+
_el$12.nextSibling;
|
|
216
|
+
insert(_el$9, scope(() => {
|
|
217
|
+
return local.children(segment);
|
|
218
|
+
}), _el$12, _el$13);
|
|
219
|
+
return _el$9;
|
|
220
|
+
}
|
|
221
|
+
return segment.text;
|
|
222
|
+
});
|
|
223
|
+
}), _el$4, _el$5);
|
|
224
|
+
insert(_el$2, scope((() => {
|
|
225
|
+
var _c$ = memo(() => {
|
|
226
|
+
return !!context.state.value().segments.at(-1)?.text.endsWith("\n");
|
|
227
|
+
});
|
|
228
|
+
return () => {
|
|
229
|
+
return _c$() ? getNextElement(_tmpl$4) : null;
|
|
230
|
+
};
|
|
231
|
+
})()), _el$7, _el$8);
|
|
232
|
+
runHydrationEvents();
|
|
233
|
+
return _el$2;
|
|
234
|
+
}
|
|
235
|
+
/**
|
|
236
|
+
* A token represents an inline segment within a token field.
|
|
237
|
+
*/
|
|
238
|
+
function Token(props) {
|
|
239
|
+
const context = useContext(TokenInputContext);
|
|
240
|
+
if (!context) throw new Error("Token must be used within a TokenField");
|
|
241
|
+
const [local, rest] = splitProps(props, [
|
|
242
|
+
"children",
|
|
243
|
+
"class",
|
|
244
|
+
"style",
|
|
245
|
+
"slot",
|
|
246
|
+
"ref"
|
|
247
|
+
]);
|
|
248
|
+
const [tokenRef, setTokenRef] = createSignal(null);
|
|
249
|
+
const aria = createToken({}, context.state, () => tokenRef());
|
|
250
|
+
const renderValues = createMemo(() => ({
|
|
251
|
+
isSelected: aria.isSelected(),
|
|
252
|
+
isDisabled: context.isDisabled
|
|
253
|
+
}));
|
|
254
|
+
const renderProps = useRenderProps({
|
|
255
|
+
get children() {
|
|
256
|
+
return local.children;
|
|
257
|
+
},
|
|
258
|
+
class: local.class,
|
|
259
|
+
style: local.style,
|
|
260
|
+
defaultClassName: "solidaria-Token"
|
|
261
|
+
}, renderValues);
|
|
262
|
+
const domProps = createMemo(() => filterDOMProps(rest, { global: true }));
|
|
263
|
+
var _el$16 = getNextElement(_tmpl$5);
|
|
264
|
+
ref(() => {
|
|
265
|
+
return (el) => {
|
|
266
|
+
setTokenRef(el);
|
|
267
|
+
assignRef$1(local.ref, el);
|
|
268
|
+
};
|
|
269
|
+
}, _el$16);
|
|
270
|
+
spread(_el$16, [() => {
|
|
271
|
+
return mergeProps$1(domProps(), aria.tokenProps);
|
|
272
|
+
}, {
|
|
273
|
+
get slot() {
|
|
274
|
+
return local.slot || void 0;
|
|
275
|
+
},
|
|
276
|
+
get "data-selected"() {
|
|
277
|
+
return dataAttr(aria.isSelected());
|
|
278
|
+
},
|
|
279
|
+
get "data-disabled"() {
|
|
280
|
+
return dataAttr(context.isDisabled);
|
|
281
|
+
},
|
|
282
|
+
get "class"() {
|
|
283
|
+
return renderProps.class();
|
|
284
|
+
},
|
|
285
|
+
get style() {
|
|
286
|
+
return {
|
|
287
|
+
...renderProps.style(),
|
|
288
|
+
...aria.tokenProps.style ?? {}
|
|
289
|
+
};
|
|
290
|
+
}
|
|
291
|
+
}], true);
|
|
292
|
+
insert(_el$16, scope(() => {
|
|
293
|
+
return renderProps.renderChildren();
|
|
294
|
+
}));
|
|
295
|
+
runHydrationEvents();
|
|
296
|
+
return _el$16;
|
|
297
|
+
}
|
|
298
|
+
//#endregion
|
|
299
|
+
export { Token, TokenField, TokenFieldContext, TokenInput };
|
|
300
|
+
|
|
301
|
+
//# sourceMappingURL=TokenField.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"TokenField.js","names":["ref={(el) => {\n setOuterRef(el);\n assignRef(local.ref, el);\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>","<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>","ref={(el) => {\n context.setInputRef(el);\n assignRef(local.ref, el);\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 })}","{local.children(segment as TokenSegment)}","<span>\n {\"\\u200b\"}\n {local.children(segment as TokenSegment)}\n {\"\\u200b\"}\n </span>","<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>","{context.state.value().segments.at(-1)?.text.endsWith(\"\\n\") ? <br /> : null}","<br />","ref={(el) => {\n setTokenRef(el);\n assignRef(local.ref, el);\n }}","{renderProps.renderChildren()}","<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>"],"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,OAC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,WAAW,CAAC;EAAC;EAC1C,IAAA,kBAAA;GAAe,OAAA,SAAS,QAAQ,UAAU;EAAC;EAC3C,IAAA,UAAA;GAAO,OAAA,YAAY,MAAM;EAAC;EAC1B,IAAA,QAAA;GAAO,OAAA;IACL,GAAI,YAAY,MAAM;IACtB,GAAK,KAAK,WAAW,SAA2C,CAAC;GACnE;EAAC;;CAbH,OAAA,QAeEC,YAAAA;EAAC,OAAA,YAAY,eAAe;CAAC,CAAA,CACzB;CAhBN,mBAgBM;CAjBR,OACEC;AAkBJ"}
|
|
@@ -0,0 +1,197 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Copyright 2026 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/TokenField.tsx
|
|
13
|
+
import { Provider, assignRef as assignRef$1, dataAttr, filterDOMProps, useContextProps, useRenderProps, useSlot, useSlottedContext } from "./utils.jsx";
|
|
14
|
+
import { TextContext } from "./Text.jsx";
|
|
15
|
+
import { n as LabelContext } from "./Label.jsx";
|
|
16
|
+
import { FieldInputContext } from "./TextField.jsx";
|
|
17
|
+
import { createContext, createMemo, createSignal, useContext } from "solid-js";
|
|
18
|
+
import { createFocusRing, createHideableComponent, createHover, createToken, createTokenField, mergeProps } from "@proyecto-viviana/solidaria";
|
|
19
|
+
import { splitProps } from "@proyecto-viviana/solidaria/utils";
|
|
20
|
+
import { createTokenFieldState } from "@proyecto-viviana/solid-stately";
|
|
21
|
+
//#region src/TokenField.tsx
|
|
22
|
+
/**
|
|
23
|
+
* Token field components for solidaria-components.
|
|
24
|
+
*
|
|
25
|
+
* A token field allows users to enter text with inline tokens.
|
|
26
|
+
*/
|
|
27
|
+
const TokenFieldContext = createContext(null);
|
|
28
|
+
const TokenInputContext = createContext(null);
|
|
29
|
+
/**
|
|
30
|
+
* A token field allows users to enter text with inline tokens.
|
|
31
|
+
*/
|
|
32
|
+
const TokenField = createHideableComponent(function TokenField(props) {
|
|
33
|
+
const [merged, setOuterRef] = useContextProps(props, props.ref, TokenFieldContext);
|
|
34
|
+
const [local, rest] = splitProps(merged, [
|
|
35
|
+
"children",
|
|
36
|
+
"class",
|
|
37
|
+
"style",
|
|
38
|
+
"slot",
|
|
39
|
+
"ref",
|
|
40
|
+
"isDisabled",
|
|
41
|
+
"isReadOnly",
|
|
42
|
+
"onChange",
|
|
43
|
+
"role"
|
|
44
|
+
]);
|
|
45
|
+
const [labelRef] = useSlot(!merged["aria-label"] && !merged["aria-labelledby"]);
|
|
46
|
+
const fieldCtx = useSlottedContext(FieldInputContext, merged.slot);
|
|
47
|
+
const [inputRef, setInputRef] = createSignal(null);
|
|
48
|
+
const isDisabled = () => local.isDisabled || false;
|
|
49
|
+
const isReadOnly = () => local.isReadOnly || false;
|
|
50
|
+
const state = createTokenFieldState({
|
|
51
|
+
get value() {
|
|
52
|
+
return merged.value;
|
|
53
|
+
},
|
|
54
|
+
get defaultValue() {
|
|
55
|
+
return merged.defaultValue;
|
|
56
|
+
},
|
|
57
|
+
onChange: (value) => {
|
|
58
|
+
local.onChange?.(value);
|
|
59
|
+
const onAutocompleteChange = fieldCtx?.onChange;
|
|
60
|
+
onAutocompleteChange?.(value.toString());
|
|
61
|
+
}
|
|
62
|
+
});
|
|
63
|
+
const aria = createTokenField({
|
|
64
|
+
...merged,
|
|
65
|
+
get role() {
|
|
66
|
+
return local.role || fieldCtx?.inputProps?.role || "textbox";
|
|
67
|
+
}
|
|
68
|
+
}, state, () => inputRef());
|
|
69
|
+
const renderValues = createMemo(() => ({
|
|
70
|
+
isDisabled: isDisabled(),
|
|
71
|
+
isReadOnly: isReadOnly()
|
|
72
|
+
}));
|
|
73
|
+
const renderProps = useRenderProps({
|
|
74
|
+
get children() {
|
|
75
|
+
return local.children;
|
|
76
|
+
},
|
|
77
|
+
class: local.class,
|
|
78
|
+
style: local.style,
|
|
79
|
+
defaultClassName: "solidaria-TokenField"
|
|
80
|
+
}, renderValues);
|
|
81
|
+
const domProps = createMemo(() => filterDOMProps(rest, { global: true }));
|
|
82
|
+
return <div {...domProps()} ref={(el) => {
|
|
83
|
+
setOuterRef(el);
|
|
84
|
+
assignRef$1(local.ref, el);
|
|
85
|
+
}} slot={local.slot || void 0} data-disabled={dataAttr(isDisabled())} data-readonly={dataAttr(isReadOnly())} class={renderProps.class()} style={renderProps.style()}>
|
|
86
|
+
<Provider values={[
|
|
87
|
+
[LabelContext, {
|
|
88
|
+
...aria.labelProps,
|
|
89
|
+
elementType: "span",
|
|
90
|
+
ref: labelRef
|
|
91
|
+
}],
|
|
92
|
+
[TextContext, { slots: { description: aria.descriptionProps } }],
|
|
93
|
+
[TokenInputContext, {
|
|
94
|
+
tokenFieldProps: aria.tokenFieldProps,
|
|
95
|
+
state,
|
|
96
|
+
isDisabled: isDisabled(),
|
|
97
|
+
isReadOnly: isReadOnly(),
|
|
98
|
+
autocompleteProps: fieldCtx,
|
|
99
|
+
setInputRef
|
|
100
|
+
}]
|
|
101
|
+
]}>
|
|
102
|
+
{renderProps.renderChildren()}
|
|
103
|
+
</Provider>
|
|
104
|
+
</div>;
|
|
105
|
+
});
|
|
106
|
+
/**
|
|
107
|
+
* A token input represents the editable area within a token field.
|
|
108
|
+
*/
|
|
109
|
+
function TokenInput(props) {
|
|
110
|
+
const context = useContext(TokenInputContext);
|
|
111
|
+
if (!context) throw new Error("TokenInput must be used within a TokenField");
|
|
112
|
+
const [local, rest] = splitProps(props, [
|
|
113
|
+
"children",
|
|
114
|
+
"class",
|
|
115
|
+
"style",
|
|
116
|
+
"slot",
|
|
117
|
+
"ref"
|
|
118
|
+
]);
|
|
119
|
+
const { isHovered, hoverProps } = createHover({});
|
|
120
|
+
const { isFocused, isFocusVisible, focusProps } = createFocusRing();
|
|
121
|
+
const renderValues = createMemo(() => ({
|
|
122
|
+
isHovered: isHovered(),
|
|
123
|
+
isFocused: isFocused(),
|
|
124
|
+
isFocusVisible: isFocusVisible(),
|
|
125
|
+
isDisabled: context.isDisabled,
|
|
126
|
+
isReadOnly: context.isReadOnly
|
|
127
|
+
}));
|
|
128
|
+
const renderProps = useRenderProps({
|
|
129
|
+
class: local.class,
|
|
130
|
+
style: local.style,
|
|
131
|
+
defaultClassName: "solidaria-TokenInput"
|
|
132
|
+
}, renderValues);
|
|
133
|
+
const domProps = createMemo(() => filterDOMProps(rest, { global: true }));
|
|
134
|
+
const cleanFocusProps = () => {
|
|
135
|
+
const { ref: _ref, ...restFocus } = focusProps;
|
|
136
|
+
return restFocus;
|
|
137
|
+
};
|
|
138
|
+
return <div {...mergeProps(domProps(), cleanFocusProps(), hoverProps, context.tokenFieldProps, context.autocompleteProps ?? {})} ref={(el) => {
|
|
139
|
+
context.setInputRef(el);
|
|
140
|
+
assignRef$1(local.ref, el);
|
|
141
|
+
}} slot={local.slot || void 0} data-focused={dataAttr(isFocused())} data-focus-visible={dataAttr(isFocusVisible())} data-disabled={dataAttr(context.isDisabled)} data-readonly={dataAttr(context.isReadOnly)} class={renderProps.class()} style={{
|
|
142
|
+
...renderProps.style(),
|
|
143
|
+
...context.tokenFieldProps.style ?? {}
|
|
144
|
+
}}>
|
|
145
|
+
{context.state.value().segments.map((segment) => {
|
|
146
|
+
if (segment.type === "token") return <span>
|
|
147
|
+
{""}
|
|
148
|
+
{local.children(segment)}
|
|
149
|
+
{""}
|
|
150
|
+
</span>;
|
|
151
|
+
return segment.text;
|
|
152
|
+
})}
|
|
153
|
+
{context.state.value().segments.at(-1)?.text.endsWith("\n") ? <br /> : null}
|
|
154
|
+
</div>;
|
|
155
|
+
}
|
|
156
|
+
/**
|
|
157
|
+
* A token represents an inline segment within a token field.
|
|
158
|
+
*/
|
|
159
|
+
function Token(props) {
|
|
160
|
+
const context = useContext(TokenInputContext);
|
|
161
|
+
if (!context) throw new Error("Token must be used within a TokenField");
|
|
162
|
+
const [local, rest] = splitProps(props, [
|
|
163
|
+
"children",
|
|
164
|
+
"class",
|
|
165
|
+
"style",
|
|
166
|
+
"slot",
|
|
167
|
+
"ref"
|
|
168
|
+
]);
|
|
169
|
+
const [tokenRef, setTokenRef] = createSignal(null);
|
|
170
|
+
const aria = createToken({}, context.state, () => tokenRef());
|
|
171
|
+
const renderValues = createMemo(() => ({
|
|
172
|
+
isSelected: aria.isSelected(),
|
|
173
|
+
isDisabled: context.isDisabled
|
|
174
|
+
}));
|
|
175
|
+
const renderProps = useRenderProps({
|
|
176
|
+
get children() {
|
|
177
|
+
return local.children;
|
|
178
|
+
},
|
|
179
|
+
class: local.class,
|
|
180
|
+
style: local.style,
|
|
181
|
+
defaultClassName: "solidaria-Token"
|
|
182
|
+
}, renderValues);
|
|
183
|
+
const domProps = createMemo(() => filterDOMProps(rest, { global: true }));
|
|
184
|
+
return <span {...mergeProps(domProps(), aria.tokenProps)} ref={(el) => {
|
|
185
|
+
setTokenRef(el);
|
|
186
|
+
assignRef$1(local.ref, el);
|
|
187
|
+
}} slot={local.slot || void 0} data-selected={dataAttr(aria.isSelected())} data-disabled={dataAttr(context.isDisabled)} class={renderProps.class()} style={{
|
|
188
|
+
...renderProps.style(),
|
|
189
|
+
...aria.tokenProps.style ?? {}
|
|
190
|
+
}}>
|
|
191
|
+
{renderProps.renderChildren()}
|
|
192
|
+
</span>;
|
|
193
|
+
}
|
|
194
|
+
//#endregion
|
|
195
|
+
export { Token, TokenField, TokenFieldContext, TokenInput };
|
|
196
|
+
|
|
197
|
+
//# sourceMappingURL=TokenField.jsx.map
|