@proyecto-viviana/solidaria-components 0.7.0-rc.0 → 0.7.0-rc.1
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/README.md +58 -32
- package/dist/ActionGroup.d.ts.map +1 -1
- package/dist/ActionGroup.js.map +1 -1
- package/dist/ActionGroup.jsx.map +1 -1
- package/dist/Alert.d.ts.map +1 -1
- package/dist/Alert.js +5 -10
- package/dist/Alert.js.map +1 -1
- package/dist/Alert.jsx +2 -2
- package/dist/Alert.jsx.map +1 -1
- package/dist/Autocomplete.js +1 -1
- package/dist/Autocomplete.js.map +1 -1
- package/dist/Autocomplete.jsx +1 -1
- package/dist/Autocomplete.jsx.map +1 -1
- package/dist/Breadcrumbs.d.ts +8 -2
- package/dist/Breadcrumbs.d.ts.map +1 -1
- package/dist/Breadcrumbs.js +84 -11
- package/dist/Breadcrumbs.js.map +1 -1
- package/dist/Breadcrumbs.jsx +78 -11
- package/dist/Breadcrumbs.jsx.map +1 -1
- package/dist/Button.d.ts.map +1 -1
- package/dist/Button.js +25 -13
- package/dist/Button.js.map +1 -1
- package/dist/Button.jsx +25 -13
- package/dist/Button.jsx.map +1 -1
- package/dist/Calendar.d.ts +8 -0
- package/dist/Calendar.d.ts.map +1 -1
- package/dist/Calendar.js +40 -23
- package/dist/Calendar.js.map +1 -1
- package/dist/Calendar.jsx +27 -14
- package/dist/Calendar.jsx.map +1 -1
- package/dist/Checkbox.d.ts +1 -12
- package/dist/Checkbox.d.ts.map +1 -1
- package/dist/Checkbox.js +218 -175
- package/dist/Checkbox.js.map +1 -1
- package/dist/Checkbox.jsx +85 -59
- package/dist/Checkbox.jsx.map +1 -1
- package/dist/Collection.d.ts +124 -4
- package/dist/Collection.d.ts.map +1 -1
- package/dist/Collection.js +121 -8
- package/dist/Collection.js.map +1 -1
- package/dist/Collection.jsx +107 -8
- package/dist/Collection.jsx.map +1 -1
- package/dist/Color.d.ts +8 -567
- package/dist/Color.d.ts.map +1 -1
- package/dist/Color.js +8 -1955
- package/dist/Color.jsx +8 -1460
- package/dist/ColorArea.d.ts +104 -0
- package/dist/ColorArea.d.ts.map +1 -0
- package/dist/ColorArea.js +382 -0
- package/dist/ColorArea.js.map +1 -0
- package/dist/ColorArea.jsx +286 -0
- package/dist/ColorArea.jsx.map +1 -0
- package/dist/ColorEditor.d.ts.map +1 -1
- package/dist/ColorEditor.js +4 -5
- package/dist/ColorEditor.js.map +1 -1
- package/dist/ColorEditor.jsx +8 -5
- package/dist/ColorEditor.jsx.map +1 -1
- package/dist/ColorField.d.ts +89 -0
- package/dist/ColorField.d.ts.map +1 -0
- package/dist/ColorField.js +395 -0
- package/dist/ColorField.js.map +1 -0
- package/dist/ColorField.jsx +280 -0
- package/dist/ColorField.jsx.map +1 -0
- package/dist/ColorPicker.d.ts +33 -0
- package/dist/ColorPicker.d.ts.map +1 -0
- package/dist/ColorPicker.js +86 -0
- package/dist/ColorPicker.js.map +1 -0
- package/dist/ColorPicker.jsx +67 -0
- package/dist/ColorPicker.jsx.map +1 -0
- package/dist/ColorSlider.d.ts +145 -0
- package/dist/ColorSlider.d.ts.map +1 -0
- package/dist/ColorSlider.js +444 -0
- package/dist/ColorSlider.js.map +1 -0
- package/dist/ColorSlider.jsx +319 -0
- package/dist/ColorSlider.jsx.map +1 -0
- package/dist/ColorSwatch.d.ts +37 -0
- package/dist/ColorSwatch.d.ts.map +1 -0
- package/dist/ColorSwatch.js +101 -0
- package/dist/ColorSwatch.js.map +1 -0
- package/dist/ColorSwatch.jsx +84 -0
- package/dist/ColorSwatch.jsx.map +1 -0
- package/dist/ColorSwatchPicker.d.ts +82 -0
- package/dist/ColorSwatchPicker.d.ts.map +1 -0
- package/dist/ColorSwatchPicker.js +364 -0
- package/dist/ColorSwatchPicker.js.map +1 -0
- package/dist/ColorSwatchPicker.jsx +314 -0
- package/dist/ColorSwatchPicker.jsx.map +1 -0
- package/dist/ColorThumb.d.ts +16 -0
- package/dist/ColorThumb.d.ts.map +1 -0
- package/dist/ColorThumb.js +14 -0
- package/dist/ColorThumb.jsx +14 -0
- package/dist/ColorWheel.d.ts +103 -0
- package/dist/ColorWheel.d.ts.map +1 -0
- package/dist/ColorWheel.js +312 -0
- package/dist/ColorWheel.js.map +1 -0
- package/dist/ColorWheel.jsx +224 -0
- package/dist/ColorWheel.jsx.map +1 -0
- package/dist/ComboBox.d.ts +37 -22
- package/dist/ComboBox.d.ts.map +1 -1
- package/dist/ComboBox.js +44 -37
- package/dist/ComboBox.js.map +1 -1
- package/dist/ComboBox.jsx +23 -20
- package/dist/ComboBox.jsx.map +1 -1
- package/dist/ContextualHelpTrigger.d.ts.map +1 -1
- package/dist/ContextualHelpTrigger.js +3 -15
- package/dist/ContextualHelpTrigger.js.map +1 -1
- package/dist/ContextualHelpTrigger.jsx +3 -15
- package/dist/ContextualHelpTrigger.jsx.map +1 -1
- package/dist/DateField.d.ts +13 -2
- package/dist/DateField.d.ts.map +1 -1
- package/dist/DateField2.js +71 -20
- package/dist/DateField2.js.map +1 -1
- package/dist/DateField2.jsx +58 -21
- package/dist/DateField2.jsx.map +1 -1
- package/dist/DatePicker.d.ts +6 -27
- package/dist/DatePicker.d.ts.map +1 -1
- package/dist/DatePicker.js +1 -0
- package/dist/DatePicker.jsx +1 -0
- package/dist/DatePicker2.js +400 -163
- package/dist/DatePicker2.js.map +1 -1
- package/dist/DatePicker2.jsx +236 -47
- package/dist/DatePicker2.jsx.map +1 -1
- package/dist/Dialog.d.ts +3 -17
- package/dist/Dialog.d.ts.map +1 -1
- package/dist/Dialog.js +148 -266
- package/dist/Dialog.js.map +1 -1
- package/dist/Dialog.jsx +105 -113
- package/dist/Dialog.jsx.map +1 -1
- package/dist/Disclosure.d.ts.map +1 -1
- package/dist/Disclosure.js +63 -30
- package/dist/Disclosure.js.map +1 -1
- package/dist/Disclosure.jsx +32 -5
- package/dist/Disclosure.jsx.map +1 -1
- package/dist/DragAndDrop.d.ts.map +1 -1
- package/dist/DragAndDrop.js +3 -1
- package/dist/DragAndDrop.js.map +1 -1
- package/dist/DragAndDrop.jsx +3 -1
- package/dist/DragAndDrop.jsx.map +1 -1
- package/dist/DropZone.d.ts +8 -1
- package/dist/DropZone.d.ts.map +1 -1
- package/dist/DropZone.js +84 -68
- package/dist/DropZone.js.map +1 -1
- package/dist/DropZone.jsx +29 -9
- package/dist/DropZone.jsx.map +1 -1
- package/dist/FileTrigger.d.ts.map +1 -1
- package/dist/FileTrigger.js +45 -11
- package/dist/FileTrigger.js.map +1 -1
- package/dist/FileTrigger.jsx +35 -2
- package/dist/FileTrigger.jsx.map +1 -1
- package/dist/Focusable.d.ts.map +1 -1
- package/dist/Focusable.js.map +1 -1
- package/dist/Focusable.jsx.map +1 -1
- package/dist/Form.d.ts.map +1 -1
- package/dist/Form.js +16 -3
- package/dist/Form.js.map +1 -1
- package/dist/Form.jsx +16 -3
- package/dist/Form.jsx.map +1 -1
- package/dist/GridList.d.ts +60 -27
- package/dist/GridList.d.ts.map +1 -1
- package/dist/GridList.js +157 -51
- package/dist/GridList.js.map +1 -1
- package/dist/GridList.jsx +143 -48
- package/dist/GridList.jsx.map +1 -1
- package/dist/Heading.d.ts +15 -0
- package/dist/Heading.d.ts.map +1 -0
- package/dist/Heading.js +55 -0
- package/dist/Heading.js.map +1 -0
- package/dist/Heading.jsx +40 -0
- package/dist/Heading.jsx.map +1 -0
- package/dist/Icon.d.ts.map +1 -1
- package/dist/Icon.js +15 -2
- package/dist/Icon.js.map +1 -1
- package/dist/Icon.jsx +6 -2
- package/dist/Icon.jsx.map +1 -1
- package/dist/Link.d.ts +2 -0
- package/dist/Link.d.ts.map +1 -1
- package/dist/Link.js +29 -16
- package/dist/Link.js.map +1 -1
- package/dist/Link.jsx +29 -16
- package/dist/Link.jsx.map +1 -1
- package/dist/ListBox.d.ts +46 -21
- package/dist/ListBox.d.ts.map +1 -1
- package/dist/ListBox.js +372 -224
- package/dist/ListBox.js.map +1 -1
- package/dist/ListBox.jsx +219 -112
- package/dist/ListBox.jsx.map +1 -1
- package/dist/Menu.d.ts +13 -5
- package/dist/Menu.d.ts.map +1 -1
- package/dist/Menu.js +484 -282
- package/dist/Menu.js.map +1 -1
- package/dist/Menu.jsx +311 -135
- package/dist/Menu.jsx.map +1 -1
- package/dist/Modal.d.ts.map +1 -1
- package/dist/Modal.js +12 -28
- package/dist/Modal.js.map +1 -1
- package/dist/Modal.jsx +8 -27
- package/dist/Modal.jsx.map +1 -1
- package/dist/NumberField.d.ts +2 -2
- package/dist/NumberField.d.ts.map +1 -1
- package/dist/NumberField.js +165 -76
- package/dist/NumberField.js.map +1 -1
- package/dist/NumberField.jsx +88 -21
- package/dist/NumberField.jsx.map +1 -1
- package/dist/Popover.d.ts +6 -0
- package/dist/Popover.d.ts.map +1 -1
- package/dist/Popover.js +43 -32
- package/dist/Popover.js.map +1 -1
- package/dist/Popover.jsx +43 -32
- package/dist/Popover.jsx.map +1 -1
- package/dist/Pressable.d.ts.map +1 -1
- package/dist/Pressable.js.map +1 -1
- package/dist/Pressable.jsx.map +1 -1
- package/dist/ProgressBar.d.ts.map +1 -1
- package/dist/ProgressBar.js +19 -6
- package/dist/ProgressBar.js.map +1 -1
- package/dist/ProgressBar.jsx +14 -4
- package/dist/ProgressBar.jsx.map +1 -1
- package/dist/RadioGroup.d.ts +2 -13
- package/dist/RadioGroup.d.ts.map +1 -1
- package/dist/RadioGroup.js +163 -161
- package/dist/RadioGroup.js.map +1 -1
- package/dist/RadioGroup.jsx +87 -65
- package/dist/RadioGroup.jsx.map +1 -1
- package/dist/RangeCalendar.d.ts +8 -0
- package/dist/RangeCalendar.d.ts.map +1 -1
- package/dist/RangeCalendar.js +36 -14
- package/dist/RangeCalendar.js.map +1 -1
- package/dist/RangeCalendar.jsx +25 -12
- package/dist/RangeCalendar.jsx.map +1 -1
- package/dist/RouterProvider.d.ts +18 -64
- package/dist/RouterProvider.d.ts.map +1 -1
- package/dist/RouterProvider.js +2 -107
- package/dist/RouterProvider.jsx +2 -101
- package/dist/SearchField.d.ts +1 -1
- package/dist/SearchField.d.ts.map +1 -1
- package/dist/SearchField.js +30 -26
- package/dist/SearchField.js.map +1 -1
- package/dist/SearchField.jsx +31 -22
- package/dist/SearchField.jsx.map +1 -1
- package/dist/Select.d.ts +69 -27
- package/dist/Select.d.ts.map +1 -1
- package/dist/Select.js +206 -165
- package/dist/Select.js.map +1 -1
- package/dist/Select.jsx +117 -118
- package/dist/Select.jsx.map +1 -1
- package/dist/Separator.d.ts +2 -2
- package/dist/Separator.d.ts.map +1 -1
- package/dist/Separator.js +4 -8
- package/dist/Separator.js.map +1 -1
- package/dist/Separator.jsx +4 -8
- package/dist/Separator.jsx.map +1 -1
- package/dist/Slider.d.ts +23 -18
- package/dist/Slider.d.ts.map +1 -1
- package/dist/Slider.js +230 -131
- package/dist/Slider.js.map +1 -1
- package/dist/Slider.jsx +175 -86
- package/dist/Slider.jsx.map +1 -1
- package/dist/StepList.d.ts +1 -1
- package/dist/StepList.d.ts.map +1 -1
- package/dist/StepList.js +26 -24
- package/dist/StepList.js.map +1 -1
- package/dist/StepList.jsx +12 -10
- package/dist/StepList.jsx.map +1 -1
- package/dist/Switch.d.ts +15 -2
- package/dist/Switch.d.ts.map +1 -1
- package/dist/Switch.js +58 -23
- package/dist/Switch.js.map +1 -1
- package/dist/Switch.jsx +47 -23
- package/dist/Switch.jsx.map +1 -1
- package/dist/Table.d.ts +19 -1
- package/dist/Table.d.ts.map +1 -1
- package/dist/Table.js +328 -125
- package/dist/Table.js.map +1 -1
- package/dist/Table.jsx +232 -34
- package/dist/Table.jsx.map +1 -1
- package/dist/Tabs.d.ts.map +1 -1
- package/dist/Tabs.js +96 -59
- package/dist/Tabs.js.map +1 -1
- package/dist/Tabs.jsx +42 -5
- package/dist/Tabs.jsx.map +1 -1
- package/dist/TagGroup.d.ts +28 -11
- package/dist/TagGroup.d.ts.map +1 -1
- package/dist/TagGroup.js +259 -56
- package/dist/TagGroup.js.map +1 -1
- package/dist/TagGroup.jsx +187 -33
- package/dist/TagGroup.jsx.map +1 -1
- package/dist/Text.d.ts.map +1 -1
- package/dist/Text.js +14 -1
- package/dist/Text.js.map +1 -1
- package/dist/Text.jsx +11 -1
- package/dist/Text.jsx.map +1 -1
- package/dist/TextField.d.ts +1 -1
- package/dist/TextField.d.ts.map +1 -1
- package/dist/TextField.js +18 -19
- package/dist/TextField.js.map +1 -1
- package/dist/TextField.jsx +18 -19
- package/dist/TextField.jsx.map +1 -1
- package/dist/TimeField.d.ts +1 -1
- package/dist/TimeField.d.ts.map +1 -1
- package/dist/TimeField.js +36 -6
- package/dist/TimeField.js.map +1 -1
- package/dist/TimeField.jsx +36 -6
- package/dist/TimeField.jsx.map +1 -1
- package/dist/Toast.d.ts +17 -1
- package/dist/Toast.d.ts.map +1 -1
- package/dist/Toast.js +109 -50
- package/dist/Toast.js.map +1 -1
- package/dist/Toast.jsx +59 -14
- package/dist/Toast.jsx.map +1 -1
- package/dist/ToggleButton.d.ts.map +1 -1
- package/dist/ToggleButton.js +23 -5
- package/dist/ToggleButton.js.map +1 -1
- package/dist/ToggleButton.jsx +15 -3
- package/dist/ToggleButton.jsx.map +1 -1
- package/dist/TokenField.d.ts +4 -2
- package/dist/TokenField.d.ts.map +1 -1
- package/dist/TokenField.js +106 -33
- package/dist/TokenField.js.map +1 -1
- package/dist/TokenField.jsx +104 -29
- package/dist/TokenField.jsx.map +1 -1
- package/dist/Toolbar.d.ts.map +1 -1
- package/dist/Toolbar.js +2 -6
- package/dist/Toolbar.js.map +1 -1
- package/dist/Toolbar.jsx +2 -6
- package/dist/Toolbar.jsx.map +1 -1
- package/dist/Tooltip.d.ts.map +1 -1
- package/dist/Tooltip.js +24 -11
- package/dist/Tooltip.js.map +1 -1
- package/dist/Tooltip.jsx +24 -11
- package/dist/Tooltip.jsx.map +1 -1
- package/dist/Tree.d.ts +77 -28
- package/dist/Tree.d.ts.map +1 -1
- package/dist/Tree.js +647 -282
- package/dist/Tree.js.map +1 -1
- package/dist/Tree.jsx +333 -126
- package/dist/Tree.jsx.map +1 -1
- package/dist/Virtualizer.d.ts +2 -1
- package/dist/Virtualizer.d.ts.map +1 -1
- package/dist/Virtualizer2.js +63 -8
- package/dist/Virtualizer2.js.map +1 -1
- package/dist/Virtualizer2.jsx +63 -4
- package/dist/Virtualizer2.jsx.map +1 -1
- package/dist/calendarHeadingTitle.d.ts +14 -0
- package/dist/calendarHeadingTitle.d.ts.map +1 -0
- package/dist/calendarHeadingTitle.js +23 -0
- package/dist/calendarHeadingTitle.js.map +1 -0
- package/dist/calendarHeadingTitle.jsx +23 -0
- package/dist/calendarHeadingTitle.jsx.map +1 -0
- package/dist/contexts.d.ts +6 -1
- package/dist/contexts.d.ts.map +1 -1
- package/dist/contexts.js +6 -1
- package/dist/contexts.js.map +1 -1
- package/dist/contexts.jsx +6 -1
- package/dist/contexts.jsx.map +1 -1
- package/dist/fileTriggerContext.d.ts +5 -0
- package/dist/fileTriggerContext.d.ts.map +1 -0
- package/dist/fileTriggerContext.js +7 -0
- package/dist/fileTriggerContext.js.map +1 -0
- package/dist/fileTriggerContext.jsx +7 -0
- package/dist/fileTriggerContext.jsx.map +1 -0
- package/dist/index.d.ts +17 -7
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +20 -11
- package/dist/index.jsx +20 -11
- package/dist/loadMoreSentinel.d.ts +7 -0
- package/dist/loadMoreSentinel.d.ts.map +1 -0
- package/dist/loadMoreSentinel.js +30 -0
- package/dist/loadMoreSentinel.js.map +1 -0
- package/dist/loadMoreSentinel.jsx +30 -0
- package/dist/loadMoreSentinel.jsx.map +1 -0
- package/dist/slots.d.ts +35 -0
- package/dist/slots.d.ts.map +1 -0
- package/dist/slots.js +66 -0
- package/dist/slots.js.map +1 -0
- package/dist/slots.jsx +66 -0
- package/dist/slots.jsx.map +1 -0
- package/dist/staticSelectCollection.d.ts +2 -0
- package/dist/staticSelectCollection.d.ts.map +1 -0
- package/dist/staticSelectCollection.js +2 -0
- package/dist/staticSelectCollection.jsx +2 -0
- package/dist/useDragAndDrop.d.ts +2 -0
- package/dist/useDragAndDrop.d.ts.map +1 -1
- package/dist/useDragAndDrop2.js.map +1 -1
- package/dist/useDragAndDrop2.jsx.map +1 -1
- package/dist/utils.d.ts +21 -0
- package/dist/utils.d.ts.map +1 -1
- package/dist/utils.js +44 -21
- package/dist/utils.js.map +1 -1
- package/dist/utils.jsx +35 -6
- package/dist/utils.jsx.map +1 -1
- package/dist/virtualizer/Layout.d.ts +3 -2
- package/dist/virtualizer/Layout.d.ts.map +1 -1
- package/dist/virtualizer/Layout.js.map +1 -1
- package/dist/virtualizer/Layout.jsx.map +1 -1
- package/package.json +63 -3
- package/src/ActionGroup.tsx +0 -1
- package/src/Alert.tsx +2 -3
- package/src/Autocomplete.tsx +1 -1
- package/src/Breadcrumbs.tsx +110 -11
- package/src/Button.tsx +39 -16
- package/src/Calendar.tsx +58 -17
- package/src/Checkbox.tsx +126 -116
- package/src/Collection.tsx +252 -11
- package/src/Color.tsx +8 -2632
- package/src/ColorArea.tsx +479 -0
- package/src/ColorEditor.tsx +4 -8
- package/src/ColorField.tsx +471 -0
- package/src/ColorPicker.tsx +126 -0
- package/src/ColorSlider.tsx +562 -0
- package/src/ColorSwatch.tsx +129 -0
- package/src/ColorSwatchPicker.tsx +623 -0
- package/src/ColorThumb.tsx +19 -0
- package/src/ColorWheel.tsx +398 -0
- package/src/ComboBox.tsx +88 -65
- package/src/ContextualHelpTrigger.tsx +4 -26
- package/src/DateField.tsx +105 -32
- package/src/DatePicker.tsx +355 -34
- package/src/Dialog.tsx +163 -168
- package/src/Disclosure.tsx +56 -15
- package/src/DragAndDrop.tsx +8 -1
- package/src/DropZone.tsx +54 -33
- package/src/FileTrigger.tsx +54 -2
- package/src/Focusable.tsx +1 -6
- package/src/Form.tsx +23 -3
- package/src/GridList.tsx +248 -76
- package/src/Heading.tsx +59 -0
- package/src/HiddenDateInput.tsx +1 -1
- package/src/Icon.tsx +11 -2
- package/src/Link.tsx +43 -16
- package/src/ListBox.tsx +406 -190
- package/src/Menu.tsx +515 -260
- package/src/Modal.tsx +12 -46
- package/src/NumberField.tsx +113 -25
- package/src/Popover.tsx +64 -42
- package/src/Pressable.tsx +1 -6
- package/src/ProgressBar.tsx +17 -3
- package/src/RadioGroup.tsx +167 -156
- package/src/RangeCalendar.tsx +56 -15
- package/src/RouterProvider.tsx +22 -214
- package/src/SearchField.tsx +45 -23
- package/src/Select.tsx +319 -263
- package/src/Separator.tsx +5 -13
- package/src/Slider.tsx +268 -110
- package/src/StepList.tsx +19 -8
- package/src/Switch.tsx +83 -23
- package/src/Table.tsx +428 -131
- package/src/Tabs.tsx +63 -10
- package/src/TagGroup.tsx +328 -54
- package/src/Text.tsx +16 -1
- package/src/TextField.tsx +24 -20
- package/src/TimeField.tsx +58 -7
- package/src/Toast.tsx +98 -16
- package/src/ToggleButton.tsx +28 -3
- package/src/TokenField.tsx +171 -48
- package/src/Toolbar.tsx +2 -8
- package/src/Tooltip.tsx +31 -15
- package/src/Tree.tsx +728 -260
- package/src/Virtualizer.tsx +106 -15
- package/src/calendarHeadingTitle.ts +37 -0
- package/src/contexts.ts +10 -1
- package/src/fileTriggerContext.ts +8 -0
- package/src/index.ts +66 -11
- package/src/loadMoreSentinel.ts +31 -0
- package/src/slots.tsx +103 -0
- package/src/staticSelectCollection.tsx +25 -0
- package/src/useDragAndDrop.ts +5 -1
- package/src/utils.tsx +60 -5
- package/src/virtualizer/Layout.ts +3 -2
- package/dist/Color.js.map +0 -1
- package/dist/Color.jsx.map +0 -1
- package/dist/RouterProvider.js.map +0 -1
- package/dist/RouterProvider.jsx.map +0 -1
package/README.md
CHANGED
|
@@ -1,40 +1,39 @@
|
|
|
1
1
|
# @proyecto-viviana/solidaria-components
|
|
2
2
|
|
|
3
|
-
|
|
4
|
-
|
|
3
|
+
A Solid port of Adobe's React Aria Components: accessible components with no
|
|
4
|
+
styling. Each one ships the markup, the ARIA, and the interaction; you supply
|
|
5
|
+
every class.
|
|
5
6
|
|
|
6
|
-
|
|
7
|
-
|
|
7
|
+
Use this when you want to own the look completely. If you want components that
|
|
8
|
+
already look like something, use a styled sibling instead.
|
|
8
9
|
|
|
9
10
|
## Install
|
|
10
11
|
|
|
12
|
+
Requires **Solid 2**. `solid-js` and `@solidjs/web` are peer dependencies, at
|
|
13
|
+
`>=2.0.0-rc.9 <3`.
|
|
14
|
+
|
|
11
15
|
```bash
|
|
12
|
-
npm install @proyecto-viviana/solidaria-components solid-js
|
|
16
|
+
npm install @proyecto-viviana/solidaria-components@rc solid-js@next @solidjs/web@next
|
|
13
17
|
```
|
|
14
18
|
|
|
15
|
-
|
|
19
|
+
The release candidate is on the `rc` tag. The `latest` tag is the Solid 1
|
|
20
|
+
line.
|
|
16
21
|
|
|
17
|
-
|
|
18
|
-
import { Button } from "@proyecto-viviana/solidaria-components";
|
|
22
|
+
## Example
|
|
19
23
|
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
}
|
|
23
|
-
```
|
|
24
|
-
|
|
25
|
-
Components are headless. Style them with classes, data attributes, and render
|
|
26
|
-
props.
|
|
24
|
+
Style with classes, data attributes, or a render-prop child. Render-prop
|
|
25
|
+
fields are plain booleans, not accessors — read `isPressed`, do not call it.
|
|
27
26
|
|
|
28
27
|
```tsx
|
|
29
28
|
import { Button } from "@proyecto-viviana/solidaria-components";
|
|
30
29
|
|
|
31
|
-
export function
|
|
30
|
+
export function SaveButton(props: { onSave: () => void }) {
|
|
32
31
|
return (
|
|
33
|
-
<Button class="button">
|
|
34
|
-
{(
|
|
32
|
+
<Button class="button" onPress={props.onSave}>
|
|
33
|
+
{(render) => (
|
|
35
34
|
<span
|
|
36
|
-
data-pressed={isPressed
|
|
37
|
-
data-focus-visible={isFocusVisible
|
|
35
|
+
data-pressed={render.isPressed || undefined}
|
|
36
|
+
data-focus-visible={render.isFocusVisible || undefined}
|
|
38
37
|
>
|
|
39
38
|
Save
|
|
40
39
|
</span>
|
|
@@ -44,25 +43,52 @@ export function ToolbarButton() {
|
|
|
44
43
|
}
|
|
45
44
|
```
|
|
46
45
|
|
|
47
|
-
##
|
|
46
|
+
## In the chain
|
|
47
|
+
|
|
48
|
+
```text
|
|
49
|
+
solid-stately
|
|
50
|
+
↓
|
|
51
|
+
solidaria
|
|
52
|
+
↓
|
|
53
|
+
solidaria-components ← you are here
|
|
54
|
+
↓
|
|
55
|
+
solid-spectrum · @proyecto-viviana/ui · kumo · geist
|
|
56
|
+
```
|
|
57
|
+
|
|
58
|
+
It depends on `@proyecto-viviana/solidaria` and
|
|
59
|
+
`@proyecto-viviana/solid-stately`. Every styled package in the family is built
|
|
60
|
+
on this one.
|
|
48
61
|
|
|
49
|
-
|
|
50
|
-
ticketed pending RAC names (`scripts/rac-export-gap-pending.json`). Unlisted
|
|
51
|
-
missing names fail. Extra Solid exports are local API; document intentional
|
|
52
|
-
additions in changesets.
|
|
62
|
+
## Status
|
|
53
63
|
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
64
|
+
Published, and part of a port that is not finished. An export is a floor, not
|
|
65
|
+
proof that a component matches upstream.
|
|
66
|
+
[`src/index.ts`](src/index.ts) is the only source of truth for the public
|
|
67
|
+
surface — this file does not list exports, and no README carries a count.
|
|
57
68
|
|
|
58
|
-
|
|
69
|
+
What this release candidate is known to get wrong is listed under
|
|
70
|
+
[known gaps](https://github.com/proyecto-viviana/ui#known-gaps-in-this-release-candidate).
|
|
71
|
+
|
|
72
|
+
## Evidence
|
|
59
73
|
|
|
60
74
|
```bash
|
|
61
75
|
vp run guard:rac-parity
|
|
62
76
|
vp run guard:rac-export-gap
|
|
63
77
|
vp run --filter @proyecto-viviana/solidaria-components build
|
|
64
|
-
vp test
|
|
78
|
+
vp run test:run
|
|
65
79
|
```
|
|
66
80
|
|
|
67
|
-
|
|
68
|
-
|
|
81
|
+
`guard:rac-export-gap` allows only the ticketed pending upstream names in
|
|
82
|
+
`scripts/rac-export-gap-pending.json`; an unlisted missing name fails. Extra
|
|
83
|
+
Solid exports are our own API and are declared in a changeset. What "ported"
|
|
84
|
+
means here is [the evidence bar](https://github.com/proyecto-viviana/ui/blob/main/.claude/current/certification.md).
|
|
85
|
+
|
|
86
|
+
## Links
|
|
87
|
+
|
|
88
|
+
- Documentation: <https://ui.proyectoviviana.org>
|
|
89
|
+
- Repository: <https://github.com/proyecto-viviana/ui>
|
|
90
|
+
|
|
91
|
+
## License
|
|
92
|
+
|
|
93
|
+
MIT AND Apache-2.0. Our work is MIT; the port of Adobe's React Aria Components
|
|
94
|
+
keeps Apache-2.0. Both licenses and the project `NOTICE` ship in this package.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ActionGroup.d.ts","sourceRoot":"","sources":["../src/ActionGroup.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"ActionGroup.d.ts","sourceRoot":"","sources":["../src/ActionGroup.tsx"],"names":[],"mappings":"AA6BA,OAAO,KAAK,EAAE,GAAG,EAAE,MAAM,cAAc,CAAC;AAMxC,OAAO,EAEL,KAAK,SAAS,EACd,KAAK,GAAG,EACR,KAAK,aAAa,EACnB,MAAM,iCAAiC,CAAC;AAEzC,OAAO,EACL,KAAK,mBAAmB,EACxB,KAAK,eAAe,EACpB,KAAK,SAAS,EAIf,MAAM,SAAS,CAAC;AAEjB,MAAM,WAAW,sBAAsB;IACrC,2CAA2C;IAC3C,WAAW,EAAE,YAAY,GAAG,UAAU,CAAC;IACvC,4CAA4C;IAC5C,UAAU,EAAE,OAAO,CAAC;IACpB,0BAA0B;IAC1B,aAAa,EAAE,aAAa,CAAC;CAC9B;AAED,MAAM,WAAW,0BAA0B;IACzC,oCAAoC;IACpC,UAAU,EAAE,OAAO,CAAC;IACpB,oCAAoC;IACpC,UAAU,EAAE,OAAO,CAAC;IACpB,mCAAmC;IACnC,SAAS,EAAE,OAAO,CAAC;CACpB;AAED,MAAM,WAAW,eAAe;IAC9B,EAAE,EAAE,MAAM,CAAC;IACX,KAAK,EAAE,MAAM,CAAC;IACd,UAAU,CAAC,EAA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SAAS,CAAC,CAAC,CAAC,CAAC;CACrB;AAED,eAAO,MAAM,kBAAkB,6EAAsD,CAAC;AACtF,eAAO,MAAM,uBAAuB,+DAAyD,CAAC;AAE9F,wBAAgB,WAAW,CAAC,CAAC,SAAS,eAAe,GAAG,eAAe,EACrE,KAAK,EAAE,gBAAgB,CAAC,CAAC,CAAC,GACzB,GAAG,CAAC,OAAO,CA0Hb;AAiDD,wBAAgB,qBAAqB,IAAI,uBAAuB,GAAG,IAAI,CAEtE"}
|
package/dist/ActionGroup.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ActionGroup.js","names":["<ActionGroupContext value={{ state: state as ListState<ActionGroupItem> }}>\n <ActionGroupStateContext value={state as ListState<ActionGroupItem>}>\n <div\n {...filteredDOMProps()}\n {...actionGroupProps}\n ref={(el: HTMLDivElement) => {\n const refFn = (actionGroupProps as { ref?: (el: HTMLElement) => void }).ref;\n refFn?.(el);\n }}\n class={renderProps.class()}\n style={renderProps.style()}\n slot={local.slot}\n data-orientation={orientation()}\n data-disabled={dataAttr(local.isDisabled)}\n >\n <For each={local.items}>\n {(item) => (\n <ActionGroupItemWrapper\n item={item}\n state={state as ListState<ActionGroupItem>}\n renderChild={\n local.children as (\n item: ActionGroupItem,\n rp: ActionGroupItemRenderProps,\n ) => JSX.Element\n }\n />\n )}\n </For>\n </div>\n </ActionGroupStateContext>\n </ActionGroupContext>","value={{ state: state as ListState<ActionGroupItem> }}","<ActionGroupStateContext value={state as ListState<ActionGroupItem>}>\n <div\n {...filteredDOMProps()}\n {...actionGroupProps}\n ref={(el: HTMLDivElement) => {\n const refFn = (actionGroupProps as { ref?: (el: HTMLElement) => void }).ref;\n refFn?.(el);\n }}\n class={renderProps.class()}\n style={renderProps.style()}\n slot={local.slot}\n data-orientation={orientation()}\n data-disabled={dataAttr(local.isDisabled)}\n >\n <For each={local.items}>\n {(item) => (\n <ActionGroupItemWrapper\n item={item}\n state={state as ListState<ActionGroupItem>}\n renderChild={\n local.children as (\n item: ActionGroupItem,\n rp: ActionGroupItemRenderProps,\n ) => JSX.Element\n }\n />\n )}\n </For>\n </div>\n </ActionGroupStateContext>","value={state as ListState<ActionGroupItem>}","ref={(el: HTMLDivElement) => {\n const refFn = (actionGroupProps as { ref?: (el: HTMLElement) => void }).ref;\n refFn?.(el);\n }}","<For each={local.items}>\n {(item) => (\n <ActionGroupItemWrapper\n item={item}\n state={state as ListState<ActionGroupItem>}\n renderChild={\n local.children as (\n item: ActionGroupItem,\n rp: ActionGroupItemRenderProps,\n ) => JSX.Element\n }\n />\n )}\n </For>","<ActionGroupItemWrapper\n item={item}\n state={state as ListState<ActionGroupItem>}\n renderChild={\n local.children as (\n item: ActionGroupItem,\n rp: ActionGroupItemRenderProps,\n ) => JSX.Element\n }\n />","state={state as ListState<ActionGroupItem>}","<div\n {...filteredDOMProps()}\n {...actionGroupProps}\n ref={(el: HTMLDivElement) => {\n const refFn = (actionGroupProps as { ref?: (el: HTMLElement) => void }).ref;\n refFn?.(el);\n }}\n class={renderProps.class()}\n style={renderProps.style()}\n slot={local.slot}\n data-orientation={orientation()}\n data-disabled={dataAttr(local.isDisabled)}\n >\n <For each={local.items}>\n {(item) => (\n <ActionGroupItemWrapper\n item={item}\n state={state as ListState<ActionGroupItem>}\n renderChild={\n local.children as (\n item: ActionGroupItem,\n rp: ActionGroupItemRenderProps,\n ) => JSX.Element\n }\n />\n )}\n </For>\n </div>","{props.renderChild(props.item, renderProps())}","<button\n {...restButtonProps}\n data-selected={dataAttr(isSelected())}\n data-disabled={dataAttr(isDisabled())}\n data-focused={dataAttr(isFocused())}\n >\n {props.renderChild(props.item, renderProps())}\n </button>"],"sources":["../src/ActionGroup.tsx"],"sourcesContent":["/*\n * Copyright 2020 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/src/actiongroup/useActionGroup.ts\n// Ported to SolidJS for Proyecto Viviana; based on packages/react-aria/src/actiongroup/useActionGroupItem.ts\n\n/**\n * ActionGroup component for solidaria-components\n *\n * Pre-wired headless action group component that combines\n * createListState + createActionGroup/createActionGroupItem.\n * Provides proper dynamic roles (toolbar/radiogroup), keyboard\n * navigation, and ARIA attributes.\n *\n * Based on packages/react-aria/src/actiongroup/useActionGroup.ts and\n * packages/react-aria/src/actiongroup/useActionGroupItem.ts. React Aria\n * Components has no ActionGroup component, so this file wires the two hooks.\n */\n\nimport { createContext, createMemo, useContext, For } from \"solid-js\";\nimport type { ParentProps } from \"solid-js\";\nimport type { JSX } from \"@solidjs/web\";\nimport {\n createActionGroup,\n createActionGroupItem,\n type AriaActionGroupProps,\n} from \"@proyecto-viviana/solidaria\";\nimport {\n createListState,\n type ListState,\n type Key,\n type SelectionMode,\n} from \"@proyecto-viviana/solid-stately\";\nimport { splitProps } from \"@proyecto-viviana/solidaria/utils\";\nimport {\n type ClassNameOrFunction,\n type StyleOrFunction,\n type SlotProps,\n useRenderProps,\n filterDOMProps,\n dataAttr,\n} from \"./utils\";\n\nexport interface ActionGroupRenderProps {\n /** The orientation of the action group. */\n orientation: \"horizontal\" | \"vertical\";\n /** Whether the entire group is disabled. */\n isDisabled: boolean;\n /** The selection mode. */\n selectionMode: SelectionMode;\n}\n\nexport interface ActionGroupItemRenderProps {\n /** Whether the item is selected. */\n isSelected: boolean;\n /** Whether the item is disabled. */\n isDisabled: boolean;\n /** Whether the item is focused. */\n isFocused: boolean;\n}\n\nexport interface ActionGroupItem {\n id: string;\n label: string;\n isDisabled?: boolean;\n [key: string]: unknown;\n}\n\nexport interface ActionGroupProps<T extends ActionGroupItem = ActionGroupItem> extends SlotProps {\n /** The items in the action group. */\n items: T[];\n /** The selection mode. @default 'none' */\n selectionMode?: SelectionMode;\n /** Orientation of the group. @default 'horizontal' */\n orientation?: \"horizontal\" | \"vertical\";\n /** Whether the entire group is disabled. */\n isDisabled?: boolean;\n /** Accessible label. */\n \"aria-label\"?: string;\n /** Labelled-by id. */\n \"aria-labelledby\"?: string;\n /** Currently selected keys (controlled). */\n selectedKeys?: Iterable<Key>;\n /** Default selected keys (uncontrolled). */\n defaultSelectedKeys?: Iterable<Key>;\n /** Handler called when selection changes. */\n onSelectionChange?: (keys: \"all\" | Set<Key>) => void;\n /** Handler called when an item action is triggered. */\n onAction?: (key: Key) => void;\n /** Keys of disabled items. */\n disabledKeys?: Iterable<Key>;\n /** Render function for each item. */\n children: (item: T, renderProps: ActionGroupItemRenderProps) => JSX.Element;\n /** CSS class for the container. */\n class?: ClassNameOrFunction<ActionGroupRenderProps>;\n /** Inline style for the container. */\n style?: StyleOrFunction<ActionGroupRenderProps>;\n}\n\nexport interface ActionGroupContextValue<T extends ActionGroupItem = ActionGroupItem> {\n state: ListState<T>;\n}\n\nexport const ActionGroupContext = createContext<ActionGroupContextValue | null>(null);\nexport const ActionGroupStateContext = createContext<ListState<ActionGroupItem> | null>(null);\n\nexport function ActionGroup<T extends ActionGroupItem = ActionGroupItem>(\n props: ActionGroupProps<T>,\n): JSX.Element {\n const [local, ariaGroupProps, domProps] = splitProps(\n props,\n [\n \"items\",\n \"selectionMode\",\n \"orientation\",\n \"isDisabled\",\n \"selectedKeys\",\n \"defaultSelectedKeys\",\n \"onSelectionChange\",\n \"onAction\",\n \"disabledKeys\",\n \"children\",\n \"class\",\n \"style\",\n \"slot\",\n ],\n [\"aria-label\", \"aria-labelledby\"],\n );\n\n const state = createListState<T>({\n get items() {\n return local.items;\n },\n get selectionMode() {\n return local.selectionMode ?? \"none\";\n },\n get selectedKeys() {\n return local.selectedKeys;\n },\n get defaultSelectedKeys() {\n return local.defaultSelectedKeys;\n },\n get onSelectionChange() {\n return local.onSelectionChange;\n },\n get disabledKeys() {\n return local.disabledKeys;\n },\n getKey: (item) => item.id,\n getTextValue: (item) => item.label,\n getDisabled: (item) => !!item.isDisabled,\n });\n\n const groupAriaProps: AriaActionGroupProps<T> = {\n get items() {\n return local.items;\n },\n get isDisabled() {\n return local.isDisabled;\n },\n get orientation() {\n return local.orientation;\n },\n get \"aria-label\"() {\n return ariaGroupProps[\"aria-label\"];\n },\n get \"aria-labelledby\"() {\n return ariaGroupProps[\"aria-labelledby\"];\n },\n get onAction() {\n return local.onAction;\n },\n };\n\n const { actionGroupProps } = createActionGroup(groupAriaProps, state as ListState<T>);\n\n const orientation = () => local.orientation ?? \"horizontal\";\n\n const renderProps = useRenderProps(\n {\n children: undefined,\n class: local.class,\n style: local.style,\n defaultClassName: \"solidaria-ActionGroup\",\n },\n () => ({\n orientation: orientation(),\n isDisabled: !!local.isDisabled,\n selectionMode: (local.selectionMode ?? \"none\") as SelectionMode,\n }),\n );\n\n const filteredDOMProps = createMemo(() =>\n filterDOMProps(domProps as Record<string, unknown>, { global: true }),\n );\n\n return (\n <ActionGroupContext value={{ state: state as ListState<ActionGroupItem> }}>\n <ActionGroupStateContext value={state as ListState<ActionGroupItem>}>\n <div\n {...filteredDOMProps()}\n {...actionGroupProps}\n ref={(el: HTMLDivElement) => {\n const refFn = (actionGroupProps as { ref?: (el: HTMLElement) => void }).ref;\n refFn?.(el);\n }}\n class={renderProps.class()}\n style={renderProps.style()}\n slot={local.slot}\n data-orientation={orientation()}\n data-disabled={dataAttr(local.isDisabled)}\n >\n <For each={local.items}>\n {(item) => (\n <ActionGroupItemWrapper\n item={item}\n state={state as ListState<ActionGroupItem>}\n renderChild={\n local.children as (\n item: ActionGroupItem,\n rp: ActionGroupItemRenderProps,\n ) => JSX.Element\n }\n />\n )}\n </For>\n </div>\n </ActionGroupStateContext>\n </ActionGroupContext>\n );\n}\n\ninterface ActionGroupItemWrapperProps {\n item: ActionGroupItem;\n state: ListState<ActionGroupItem>;\n renderChild: (item: ActionGroupItem, renderProps: ActionGroupItemRenderProps) => JSX.Element;\n}\n\nfunction ActionGroupItemWrapper(props: ActionGroupItemWrapperProps): JSX.Element {\n const { buttonProps } = createActionGroupItem(\n {\n get key() {\n return props.item.id;\n },\n },\n props.state,\n );\n\n const isFocused = () => props.state.focusedKey() === props.item.id;\n const isSelected = () => {\n const keys = props.state.selectedKeys();\n return keys === \"all\" || (keys instanceof Set && keys.has(props.item.id));\n };\n const isDisabled = () => props.state.isDisabled(props.item.id);\n\n const renderProps = createMemo<ActionGroupItemRenderProps>(() => ({\n isSelected: isSelected(),\n isDisabled: isDisabled(),\n isFocused: isFocused(),\n }));\n\n // splitProps (not object destructuring) so the reactive getters on buttonProps\n // — tabIndex (roving stop), onFocus (sets the focused key), role, aria-checked\n // — stay live. A rest-spread `{ ref, ...rest }` would FREEZE them at their\n // first-render values, pinning the roving tabIndex and killing focus tracking.\n const [, restButtonProps] = splitProps(buttonProps, [\"ref\"]);\n\n return (\n <button\n {...restButtonProps}\n data-selected={dataAttr(isSelected())}\n data-disabled={dataAttr(isDisabled())}\n data-focused={dataAttr(isFocused())}\n >\n {props.renderChild(props.item, renderProps())}\n </button>\n );\n}\n\nexport function useActionGroupContext(): ActionGroupContextValue | null {\n return useContext(ActionGroupContext);\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAgHA,MAAa,qBAAqB,cAA8C,IAAI;AACpF,MAAa,0BAA0B,cAAiD,IAAI;AAE5F,SAAgB,YACd,OACa;CACb,MAAM,CAAC,OAAO,gBAAgB,YAAY,WACxC,OACA;EACE;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;CACF,GACA,CAAC,cAAc,iBAAiB,CAClC;CAEA,MAAM,QAAQ,gBAAmB;EAC/B,IAAI,QAAQ;GACV,OAAO,MAAM;EACf;EACA,IAAI,gBAAgB;GAClB,OAAO,MAAM,iBAAiB;EAChC;E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,CACvC;CAPR,mBAOQ;CARV,OACEC;AASJ;AAEA,SAAgB,wBAAwD;CACtE,OAAO,WAAW,kBAAkB;AACtC"}
|
|
1
|
+
{"version":3,"file":"ActionGroup.js","names":["<ActionGroupContext value={{ state: state as ListState<ActionGroupItem> }}>\n <ActionGroupStateContext value={state as ListState<ActionGroupItem>}>\n <div\n {...filteredDOMProps()}\n {...actionGroupProps}\n ref={(el: HTMLDivElement) => {\n const refFn = (actionGroupProps as { ref?: (el: HTMLElement) => void }).ref;\n refFn?.(el);\n }}\n class={renderProps.class()}\n style={renderProps.style()}\n slot={local.slot}\n data-orientation={orientation()}\n data-disabled={dataAttr(local.isDisabled)}\n >\n <For each={local.items}>\n {(item) => (\n <ActionGroupItemWrapper\n item={item}\n state={state as ListState<ActionGroupItem>}\n renderChild={\n local.children as (\n item: ActionGroupItem,\n rp: ActionGroupItemRenderProps,\n ) => JSX.Element\n }\n />\n )}\n </For>\n </div>\n </ActionGroupStateContext>\n </ActionGroupContext>","value={{ state: state as ListState<ActionGroupItem> }}","<ActionGroupStateContext value={state as ListState<ActionGroupItem>}>\n <div\n {...filteredDOMProps()}\n {...actionGroupProps}\n ref={(el: HTMLDivElement) => {\n const refFn = (actionGroupProps as { ref?: (el: HTMLElement) => void }).ref;\n refFn?.(el);\n }}\n class={renderProps.class()}\n style={renderProps.style()}\n slot={local.slot}\n data-orientation={orientation()}\n data-disabled={dataAttr(local.isDisabled)}\n >\n <For each={local.items}>\n {(item) => (\n <ActionGroupItemWrapper\n item={item}\n state={state as ListState<ActionGroupItem>}\n renderChild={\n local.children as (\n item: ActionGroupItem,\n rp: ActionGroupItemRenderProps,\n ) => JSX.Element\n }\n />\n )}\n </For>\n </div>\n </ActionGroupStateContext>","value={state as ListState<ActionGroupItem>}","ref={(el: HTMLDivElement) => {\n const refFn = (actionGroupProps as { ref?: (el: HTMLElement) => void }).ref;\n refFn?.(el);\n }}","<For each={local.items}>\n {(item) => (\n <ActionGroupItemWrapper\n item={item}\n state={state as ListState<ActionGroupItem>}\n renderChild={\n local.children as (\n item: ActionGroupItem,\n rp: ActionGroupItemRenderProps,\n ) => JSX.Element\n }\n />\n )}\n </For>","<ActionGroupItemWrapper\n item={item}\n state={state as ListState<ActionGroupItem>}\n renderChild={\n local.children as (\n item: ActionGroupItem,\n rp: ActionGroupItemRenderProps,\n ) => JSX.Element\n }\n />","state={state as ListState<ActionGroupItem>}","<div\n {...filteredDOMProps()}\n {...actionGroupProps}\n ref={(el: HTMLDivElement) => {\n const refFn = (actionGroupProps as { ref?: (el: HTMLElement) => void }).ref;\n refFn?.(el);\n }}\n class={renderProps.class()}\n style={renderProps.style()}\n slot={local.slot}\n data-orientation={orientation()}\n data-disabled={dataAttr(local.isDisabled)}\n >\n <For each={local.items}>\n {(item) => (\n <ActionGroupItemWrapper\n item={item}\n state={state as ListState<ActionGroupItem>}\n renderChild={\n local.children as (\n item: ActionGroupItem,\n rp: ActionGroupItemRenderProps,\n ) => JSX.Element\n }\n />\n )}\n </For>\n </div>","{props.renderChild(props.item, renderProps())}","<button\n {...restButtonProps}\n data-selected={dataAttr(isSelected())}\n data-disabled={dataAttr(isDisabled())}\n data-focused={dataAttr(isFocused())}\n >\n {props.renderChild(props.item, renderProps())}\n </button>"],"sources":["../src/ActionGroup.tsx"],"sourcesContent":["/*\n * Copyright 2020 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/src/actiongroup/useActionGroup.ts\n// Ported to SolidJS for Proyecto Viviana; based on packages/react-aria/src/actiongroup/useActionGroupItem.ts\n\n/**\n * ActionGroup component for solidaria-components\n *\n * Pre-wired headless action group component that combines\n * createListState + createActionGroup/createActionGroupItem.\n * Provides proper dynamic roles (toolbar/radiogroup), keyboard\n * navigation, and ARIA attributes.\n *\n * Based on packages/react-aria/src/actiongroup/useActionGroup.ts and\n * packages/react-aria/src/actiongroup/useActionGroupItem.ts. React Aria\n * Components has no ActionGroup component, so this file wires the two hooks.\n */\n\nimport { createContext, createMemo, useContext, For } from \"solid-js\";\nimport type { JSX } from \"@solidjs/web\";\nimport {\n createActionGroup,\n createActionGroupItem,\n type AriaActionGroupProps,\n} from \"@proyecto-viviana/solidaria\";\nimport {\n createListState,\n type ListState,\n type Key,\n type SelectionMode,\n} from \"@proyecto-viviana/solid-stately\";\nimport { splitProps } from \"@proyecto-viviana/solidaria/utils\";\nimport {\n type ClassNameOrFunction,\n type StyleOrFunction,\n type SlotProps,\n useRenderProps,\n filterDOMProps,\n dataAttr,\n} from \"./utils\";\n\nexport interface ActionGroupRenderProps {\n /** The orientation of the action group. */\n orientation: \"horizontal\" | \"vertical\";\n /** Whether the entire group is disabled. */\n isDisabled: boolean;\n /** The selection mode. */\n selectionMode: SelectionMode;\n}\n\nexport interface ActionGroupItemRenderProps {\n /** Whether the item is selected. */\n isSelected: boolean;\n /** Whether the item is disabled. */\n isDisabled: boolean;\n /** Whether the item is focused. */\n isFocused: boolean;\n}\n\nexport interface ActionGroupItem {\n id: string;\n label: string;\n isDisabled?: boolean;\n [key: string]: unknown;\n}\n\nexport interface ActionGroupProps<T extends ActionGroupItem = ActionGroupItem> extends SlotProps {\n /** The items in the action group. */\n items: T[];\n /** The selection mode. @default 'none' */\n selectionMode?: SelectionMode;\n /** Orientation of the group. @default 'horizontal' */\n orientation?: \"horizontal\" | \"vertical\";\n /** Whether the entire group is disabled. */\n isDisabled?: boolean;\n /** Accessible label. */\n \"aria-label\"?: string;\n /** Labelled-by id. */\n \"aria-labelledby\"?: string;\n /** Currently selected keys (controlled). */\n selectedKeys?: Iterable<Key>;\n /** Default selected keys (uncontrolled). */\n defaultSelectedKeys?: Iterable<Key>;\n /** Handler called when selection changes. */\n onSelectionChange?: (keys: \"all\" | Set<Key>) => void;\n /** Handler called when an item action is triggered. */\n onAction?: (key: Key) => void;\n /** Keys of disabled items. */\n disabledKeys?: Iterable<Key>;\n /** Render function for each item. */\n children: (item: T, renderProps: ActionGroupItemRenderProps) => JSX.Element;\n /** CSS class for the container. */\n class?: ClassNameOrFunction<ActionGroupRenderProps>;\n /** Inline style for the container. */\n style?: StyleOrFunction<ActionGroupRenderProps>;\n}\n\nexport interface ActionGroupContextValue<T extends ActionGroupItem = ActionGroupItem> {\n state: ListState<T>;\n}\n\nexport const ActionGroupContext = createContext<ActionGroupContextValue | null>(null);\nexport const ActionGroupStateContext = createContext<ListState<ActionGroupItem> | null>(null);\n\nexport function ActionGroup<T extends ActionGroupItem = ActionGroupItem>(\n props: ActionGroupProps<T>,\n): JSX.Element {\n const [local, ariaGroupProps, domProps] = splitProps(\n props,\n [\n \"items\",\n \"selectionMode\",\n \"orientation\",\n \"isDisabled\",\n \"selectedKeys\",\n \"defaultSelectedKeys\",\n \"onSelectionChange\",\n \"onAction\",\n \"disabledKeys\",\n \"children\",\n \"class\",\n \"style\",\n \"slot\",\n ],\n [\"aria-label\", \"aria-labelledby\"],\n );\n\n const state = createListState<T>({\n get items() {\n return local.items;\n },\n get selectionMode() {\n return local.selectionMode ?? \"none\";\n },\n get selectedKeys() {\n return local.selectedKeys;\n },\n get defaultSelectedKeys() {\n return local.defaultSelectedKeys;\n },\n get onSelectionChange() {\n return local.onSelectionChange;\n },\n get disabledKeys() {\n return local.disabledKeys;\n },\n getKey: (item) => item.id,\n getTextValue: (item) => item.label,\n getDisabled: (item) => !!item.isDisabled,\n });\n\n const groupAriaProps: AriaActionGroupProps<T> = {\n get items() {\n return local.items;\n },\n get isDisabled() {\n return local.isDisabled;\n },\n get orientation() {\n return local.orientation;\n },\n get \"aria-label\"() {\n return ariaGroupProps[\"aria-label\"];\n },\n get \"aria-labelledby\"() {\n return ariaGroupProps[\"aria-labelledby\"];\n },\n get onAction() {\n return local.onAction;\n },\n };\n\n const { actionGroupProps } = createActionGroup(groupAriaProps, state as ListState<T>);\n\n const orientation = () => local.orientation ?? \"horizontal\";\n\n const renderProps = useRenderProps(\n {\n children: undefined,\n class: local.class,\n style: local.style,\n defaultClassName: \"solidaria-ActionGroup\",\n },\n () => ({\n orientation: orientation(),\n isDisabled: !!local.isDisabled,\n selectionMode: (local.selectionMode ?? \"none\") as SelectionMode,\n }),\n );\n\n const filteredDOMProps = createMemo(() =>\n filterDOMProps(domProps as Record<string, unknown>, { global: true }),\n );\n\n return (\n <ActionGroupContext value={{ state: state as ListState<ActionGroupItem> }}>\n <ActionGroupStateContext value={state as ListState<ActionGroupItem>}>\n <div\n {...filteredDOMProps()}\n {...actionGroupProps}\n ref={(el: HTMLDivElement) => {\n const refFn = (actionGroupProps as { ref?: (el: HTMLElement) => void }).ref;\n refFn?.(el);\n }}\n class={renderProps.class()}\n style={renderProps.style()}\n slot={local.slot}\n data-orientation={orientation()}\n data-disabled={dataAttr(local.isDisabled)}\n >\n <For each={local.items}>\n {(item) => (\n <ActionGroupItemWrapper\n item={item}\n state={state as ListState<ActionGroupItem>}\n renderChild={\n local.children as (\n item: ActionGroupItem,\n rp: ActionGroupItemRenderProps,\n ) => JSX.Element\n }\n />\n )}\n </For>\n </div>\n </ActionGroupStateContext>\n </ActionGroupContext>\n );\n}\n\ninterface ActionGroupItemWrapperProps {\n item: ActionGroupItem;\n state: ListState<ActionGroupItem>;\n renderChild: (item: ActionGroupItem, renderProps: ActionGroupItemRenderProps) => JSX.Element;\n}\n\nfunction ActionGroupItemWrapper(props: ActionGroupItemWrapperProps): JSX.Element {\n const { buttonProps } = createActionGroupItem(\n {\n get key() {\n return props.item.id;\n },\n },\n props.state,\n );\n\n const isFocused = () => props.state.focusedKey() === props.item.id;\n const isSelected = () => {\n const keys = props.state.selectedKeys();\n return keys === \"all\" || (keys instanceof Set && keys.has(props.item.id));\n };\n const isDisabled = () => props.state.isDisabled(props.item.id);\n\n const renderProps = createMemo<ActionGroupItemRenderProps>(() => ({\n isSelected: isSelected(),\n isDisabled: isDisabled(),\n isFocused: isFocused(),\n }));\n\n // splitProps (not object destructuring) so the reactive getters on buttonProps\n // — tabIndex (roving stop), onFocus (sets the focused key), role, aria-checked\n // — stay live. A rest-spread `{ ref, ...rest }` would FREEZE them at their\n // first-render values, pinning the roving tabIndex and killing focus tracking.\n const [, restButtonProps] = splitProps(buttonProps, [\"ref\"]);\n\n return (\n <button\n {...restButtonProps}\n data-selected={dataAttr(isSelected())}\n data-disabled={dataAttr(isDisabled())}\n data-focused={dataAttr(isFocused())}\n >\n {props.renderChild(props.item, renderProps())}\n </button>\n );\n}\n\nexport function useActionGroupContext(): ActionGroupContextValue | null {\n return useContext(ActionGroupContext);\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA+GA,MAAa,qBAAqB,cAA8C,IAAI;AACpF,MAAa,0BAA0B,cAAiD,IAAI;AAE5F,SAAgB,YACd,OACa;CACb,MAAM,CAAC,OAAO,gBAAgB,YAAY,WACxC,OACA;EACE;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;CACF,GACA,CAAC,cAAc,iBAAiB,CAClC;CAEA,MAAM,QAAQ,gBAAmB;EAC/B,IAAI,QAAQ;GACV,OAAO,MAAM;EACf;EACA,IAAI,gBAAgB;GAClB,OAAO,MAAM,iBAAiB;EAChC;EACA,IAAI,eAAe;GACjB,OAAO,MAAM;EACf;EACA,IAAI,sBAAsB;GACxB,OAAO,MAAM;EACf;EACA,IAAI,oBAAoB;GACtB,OAAO,MAAM;EACf;EACA,IAAI,eAAe;GACjB,OAAO,MAAM;EACf;EACA,SAAS,SAAS,KAAK;EACvB,eAAe,SAAS,KAAK;EAC7B,cAAc,SAAS,CAAC,CAAC,KAAK;CAChC,CAAC;CAuBD,MAAM,EAAE,qBAAqB,kBA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A;QACE,OAAA,MAAM;OAIR;MACD,CAAA;KAEA,CAAA,CACF;KA3BL,mBA2BK;KA5BP,OACEE;IA4BuB;;EACP;;AAExB;AAQA,SAAS,uBAAuB,OAAiD;CAC/E,MAAM,EAAE,gBAAgB,sBACtB,EACE,IAAI,MAAM;EACR,OAAO,MAAM,KAAK;CACpB,EACF,GACA,MAAM,KACR;CAEA,MAAM,kBAAkB,MAAM,MAAM,WAAW,MAAM,MAAM,KAAK;CAChE,MAAM,mBAAmB;EACvB,MAAM,OAAO,MAAM,MAAM,aAAa;EACtC,OAAO,SAAS,SAAU,gBAAgB,OAAO,KAAK,IAAI,MAAM,KAAK,EAAE;CACzE;CACA,MAAM,mBAAmB,MAAM,MAAM,WAAW,MAAM,KAAK,EAAE;CAE7D,MAAM,cAAc,kBAA8C;EAChE,YAAY,WAAW;EACvB,YAAY,WAAW;EACvB,WAAW,UAAU;CACvB,EAAE;CAMF,MAAM,GAAG,mBAAmB,WAAW,aAAa,CAAC,KAAK,CAAC;CAGzD,IAAA,QAAA,eAAA,OAOQ;CANF,OAAA,OAAA,CAAA,iBAAA;EACJ,IAAA,kBAAA;GAAe,OAAA,SAAS,WAAW,CAAC;EAAC;EACrC,IAAA,kBAAA;GAAe,OAAA,SAAS,WAAW,CAAC;EAAC;EACrC,IAAA,iBAAA;GAAc,OAAA,SAAS,UAAU,CAAC;EAAC;;CAJrC,OAAA,OAMEC,YAAAA;EAAC,OAAA,MAAM,YAAY,MAAM,MAAM,YAAY,CAAC;CAAC,CAAA,CACvC;CAPR,mBAOQ;CARV,OACEC;AASJ;AAEA,SAAgB,wBAAwD;CACtE,OAAO,WAAW,kBAAkB;AACtC"}
|
package/dist/ActionGroup.jsx.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ActionGroup.jsx","names":[],"sources":["../src/ActionGroup.tsx"],"sourcesContent":["/*\n * Copyright 2020 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/src/actiongroup/useActionGroup.ts\n// Ported to SolidJS for Proyecto Viviana; based on packages/react-aria/src/actiongroup/useActionGroupItem.ts\n\n/**\n * ActionGroup component for solidaria-components\n *\n * Pre-wired headless action group component that combines\n * createListState + createActionGroup/createActionGroupItem.\n * Provides proper dynamic roles (toolbar/radiogroup), keyboard\n * navigation, and ARIA attributes.\n *\n * Based on packages/react-aria/src/actiongroup/useActionGroup.ts and\n * packages/react-aria/src/actiongroup/useActionGroupItem.ts. React Aria\n * Components has no ActionGroup component, so this file wires the two hooks.\n */\n\nimport { createContext, createMemo, useContext, For } from \"solid-js\";\nimport type { ParentProps } from \"solid-js\";\nimport type { JSX } from \"@solidjs/web\";\nimport {\n createActionGroup,\n createActionGroupItem,\n type AriaActionGroupProps,\n} from \"@proyecto-viviana/solidaria\";\nimport {\n createListState,\n type ListState,\n type Key,\n type SelectionMode,\n} from \"@proyecto-viviana/solid-stately\";\nimport { splitProps } from \"@proyecto-viviana/solidaria/utils\";\nimport {\n type ClassNameOrFunction,\n type StyleOrFunction,\n type SlotProps,\n useRenderProps,\n filterDOMProps,\n dataAttr,\n} from \"./utils\";\n\nexport interface ActionGroupRenderProps {\n /** The orientation of the action group. */\n orientation: \"horizontal\" | \"vertical\";\n /** Whether the entire group is disabled. */\n isDisabled: boolean;\n /** The selection mode. */\n selectionMode: SelectionMode;\n}\n\nexport interface ActionGroupItemRenderProps {\n /** Whether the item is selected. */\n isSelected: boolean;\n /** Whether the item is disabled. */\n isDisabled: boolean;\n /** Whether the item is focused. */\n isFocused: boolean;\n}\n\nexport interface ActionGroupItem {\n id: string;\n label: string;\n isDisabled?: boolean;\n [key: string]: unknown;\n}\n\nexport interface ActionGroupProps<T extends ActionGroupItem = ActionGroupItem> extends SlotProps {\n /** The items in the action group. */\n items: T[];\n /** The selection mode. @default 'none' */\n selectionMode?: SelectionMode;\n /** Orientation of the group. @default 'horizontal' */\n orientation?: \"horizontal\" | \"vertical\";\n /** Whether the entire group is disabled. */\n isDisabled?: boolean;\n /** Accessible label. */\n \"aria-label\"?: string;\n /** Labelled-by id. */\n \"aria-labelledby\"?: string;\n /** Currently selected keys (controlled). */\n selectedKeys?: Iterable<Key>;\n /** Default selected keys (uncontrolled). */\n defaultSelectedKeys?: Iterable<Key>;\n /** Handler called when selection changes. */\n onSelectionChange?: (keys: \"all\" | Set<Key>) => void;\n /** Handler called when an item action is triggered. */\n onAction?: (key: Key) => void;\n /** Keys of disabled items. */\n disabledKeys?: Iterable<Key>;\n /** Render function for each item. */\n children: (item: T, renderProps: ActionGroupItemRenderProps) => JSX.Element;\n /** CSS class for the container. */\n class?: ClassNameOrFunction<ActionGroupRenderProps>;\n /** Inline style for the container. */\n style?: StyleOrFunction<ActionGroupRenderProps>;\n}\n\nexport interface ActionGroupContextValue<T extends ActionGroupItem = ActionGroupItem> {\n state: ListState<T>;\n}\n\nexport const ActionGroupContext = createContext<ActionGroupContextValue | null>(null);\nexport const ActionGroupStateContext = createContext<ListState<ActionGroupItem> | null>(null);\n\nexport function ActionGroup<T extends ActionGroupItem = ActionGroupItem>(\n props: ActionGroupProps<T>,\n): JSX.Element {\n const [local, ariaGroupProps, domProps] = splitProps(\n props,\n [\n \"items\",\n \"selectionMode\",\n \"orientation\",\n \"isDisabled\",\n \"selectedKeys\",\n \"defaultSelectedKeys\",\n \"onSelectionChange\",\n \"onAction\",\n \"disabledKeys\",\n \"children\",\n \"class\",\n \"style\",\n \"slot\",\n ],\n [\"aria-label\", \"aria-labelledby\"],\n );\n\n const state = createListState<T>({\n get items() {\n return local.items;\n },\n get selectionMode() {\n return local.selectionMode ?? \"none\";\n },\n get selectedKeys() {\n return local.selectedKeys;\n },\n get defaultSelectedKeys() {\n return local.defaultSelectedKeys;\n },\n get onSelectionChange() {\n return local.onSelectionChange;\n },\n get disabledKeys() {\n return local.disabledKeys;\n },\n getKey: (item) => item.id,\n getTextValue: (item) => item.label,\n getDisabled: (item) => !!item.isDisabled,\n });\n\n const groupAriaProps: AriaActionGroupProps<T> = {\n get items() {\n return local.items;\n },\n get isDisabled() {\n return local.isDisabled;\n },\n get orientation() {\n return local.orientation;\n },\n get \"aria-label\"() {\n return ariaGroupProps[\"aria-label\"];\n },\n get \"aria-labelledby\"() {\n return ariaGroupProps[\"aria-labelledby\"];\n },\n get onAction() {\n return local.onAction;\n },\n };\n\n const { actionGroupProps } = createActionGroup(groupAriaProps, state as ListState<T>);\n\n const orientation = () => local.orientation ?? \"horizontal\";\n\n const renderProps = useRenderProps(\n {\n children: undefined,\n class: local.class,\n style: local.style,\n defaultClassName: \"solidaria-ActionGroup\",\n },\n () => ({\n orientation: orientation(),\n isDisabled: !!local.isDisabled,\n selectionMode: (local.selectionMode ?? \"none\") as SelectionMode,\n }),\n );\n\n const filteredDOMProps = createMemo(() =>\n filterDOMProps(domProps as Record<string, unknown>, { global: true }),\n );\n\n return (\n <ActionGroupContext value={{ state: state as ListState<ActionGroupItem> }}>\n <ActionGroupStateContext value={state as ListState<ActionGroupItem>}>\n <div\n {...filteredDOMProps()}\n {...actionGroupProps}\n ref={(el: HTMLDivElement) => {\n const refFn = (actionGroupProps as { ref?: (el: HTMLElement) => void }).ref;\n refFn?.(el);\n }}\n class={renderProps.class()}\n style={renderProps.style()}\n slot={local.slot}\n data-orientation={orientation()}\n data-disabled={dataAttr(local.isDisabled)}\n >\n <For each={local.items}>\n {(item) => (\n <ActionGroupItemWrapper\n item={item}\n state={state as ListState<ActionGroupItem>}\n renderChild={\n local.children as (\n item: ActionGroupItem,\n rp: ActionGroupItemRenderProps,\n ) => JSX.Element\n }\n />\n )}\n </For>\n </div>\n </ActionGroupStateContext>\n </ActionGroupContext>\n );\n}\n\ninterface ActionGroupItemWrapperProps {\n item: ActionGroupItem;\n state: ListState<ActionGroupItem>;\n renderChild: (item: ActionGroupItem, renderProps: ActionGroupItemRenderProps) => JSX.Element;\n}\n\nfunction ActionGroupItemWrapper(props: ActionGroupItemWrapperProps): JSX.Element {\n const { buttonProps } = createActionGroupItem(\n {\n get key() {\n return props.item.id;\n },\n },\n props.state,\n );\n\n const isFocused = () => props.state.focusedKey() === props.item.id;\n const isSelected = () => {\n const keys = props.state.selectedKeys();\n return keys === \"all\" || (keys instanceof Set && keys.has(props.item.id));\n };\n const isDisabled = () => props.state.isDisabled(props.item.id);\n\n const renderProps = createMemo<ActionGroupItemRenderProps>(() => ({\n isSelected: isSelected(),\n isDisabled: isDisabled(),\n isFocused: isFocused(),\n }));\n\n // splitProps (not object destructuring) so the reactive getters on buttonProps\n // — tabIndex (roving stop), onFocus (sets the focused key), role, aria-checked\n // — stay live. A rest-spread `{ ref, ...rest }` would FREEZE them at their\n // first-render values, pinning the roving tabIndex and killing focus tracking.\n const [, restButtonProps] = splitProps(buttonProps, [\"ref\"]);\n\n return (\n <button\n {...restButtonProps}\n data-selected={dataAttr(isSelected())}\n data-disabled={dataAttr(isDisabled())}\n data-focused={dataAttr(isFocused())}\n >\n {props.renderChild(props.item, renderProps())}\n </button>\n );\n}\n\nexport function useActionGroupContext(): ActionGroupContextValue | null {\n return useContext(ActionGroupContext);\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAgHA,MAAa,qBAAqB,cAA8C,IAAI;AACpF,MAAa,0BAA0B,cAAiD,IAAI;AAE5F,SAAgB,YACd,OACa;CACb,MAAM,CAAC,OAAO,gBAAgB,YAAY,WACxC,OACA;EACE;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;CACF,GACA,CAAC,cAAc,iBAAiB,CAClC;CAEA,MAAM,QAAQ,gBAAmB;EAC/B,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AAM,UAAU,GACzC;UACC,CAAC,IAAI,MAAM,MAAM,OAAO;cACpB,SACA,CAAC,uBACC,MAAM,MACN,OAAO,OACP,aACE,MAAM,aAMV;UACJ,EAAE,IAAI;QACR,EAAE,IAAI;MACR,EAAE,wBAAwB;IAC5B,EAAE;AAEN;AAQA,SAAS,uBAAuB,OAAiD;CAC/E,MAAM,EAAE,gBAAgB,sBACtB,EACE,IAAI,MAAM;EACR,OAAO,MAAM,KAAK;CACpB,EACF,GACA,MAAM,KACR;CAEA,MAAM,kBAAkB,MAAM,MAAM,WAAW,MAAM,MAAM,KAAK;CAChE,MAAM,mBAAmB;EACvB,MAAM,OAAO,MAAM,MAAM,aAAa;EACtC,OAAO,SAAS,SAAU,gBAAgB,OAAO,KAAK,IAAI,MAAM,KAAK,EAAE;CACzE;CACA,MAAM,mBAAmB,MAAM,MAAM,WAAW,MAAM,KAAK,EAAE;CAE7D,MAAM,cAAc,kBAA8C;EAChE,YAAY,WAAW;EACvB,YAAY,WAAW;EACvB,WAAW,UAAU;CACvB,EAAE;CAMF,MAAM,GAAG,mBAAmB,WAAW,aAAa,CAAC,KAAK,CAAC;CAE3D,OACE,CAAC,WACK,iBACJ,eAAe,SAAS,WAAW,CAAC,GACpC,eAAe,SAAS,WAAW,CAAC,GACpC,cAAc,SAAS,UAAU,CAAC,GACnC;OACE,MAAM,YAAY,MAAM,MAAM,YAAY,CAAC,EAAE;IAChD,EAAE;AAEN;AAEA,SAAgB,wBAAwD;CACtE,OAAO,WAAW,kBAAkB;AACtC"}
|
|
1
|
+
{"version":3,"file":"ActionGroup.jsx","names":[],"sources":["../src/ActionGroup.tsx"],"sourcesContent":["/*\n * Copyright 2020 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/src/actiongroup/useActionGroup.ts\n// Ported to SolidJS for Proyecto Viviana; based on packages/react-aria/src/actiongroup/useActionGroupItem.ts\n\n/**\n * ActionGroup component for solidaria-components\n *\n * Pre-wired headless action group component that combines\n * createListState + createActionGroup/createActionGroupItem.\n * Provides proper dynamic roles (toolbar/radiogroup), keyboard\n * navigation, and ARIA attributes.\n *\n * Based on packages/react-aria/src/actiongroup/useActionGroup.ts and\n * packages/react-aria/src/actiongroup/useActionGroupItem.ts. React Aria\n * Components has no ActionGroup component, so this file wires the two hooks.\n */\n\nimport { createContext, createMemo, useContext, For } from \"solid-js\";\nimport type { JSX } from \"@solidjs/web\";\nimport {\n createActionGroup,\n createActionGroupItem,\n type AriaActionGroupProps,\n} from \"@proyecto-viviana/solidaria\";\nimport {\n createListState,\n type ListState,\n type Key,\n type SelectionMode,\n} from \"@proyecto-viviana/solid-stately\";\nimport { splitProps } from \"@proyecto-viviana/solidaria/utils\";\nimport {\n type ClassNameOrFunction,\n type StyleOrFunction,\n type SlotProps,\n useRenderProps,\n filterDOMProps,\n dataAttr,\n} from \"./utils\";\n\nexport interface ActionGroupRenderProps {\n /** The orientation of the action group. */\n orientation: \"horizontal\" | \"vertical\";\n /** Whether the entire group is disabled. */\n isDisabled: boolean;\n /** The selection mode. */\n selectionMode: SelectionMode;\n}\n\nexport interface ActionGroupItemRenderProps {\n /** Whether the item is selected. */\n isSelected: boolean;\n /** Whether the item is disabled. */\n isDisabled: boolean;\n /** Whether the item is focused. */\n isFocused: boolean;\n}\n\nexport interface ActionGroupItem {\n id: string;\n label: string;\n isDisabled?: boolean;\n [key: string]: unknown;\n}\n\nexport interface ActionGroupProps<T extends ActionGroupItem = ActionGroupItem> extends SlotProps {\n /** The items in the action group. */\n items: T[];\n /** The selection mode. @default 'none' */\n selectionMode?: SelectionMode;\n /** Orientation of the group. @default 'horizontal' */\n orientation?: \"horizontal\" | \"vertical\";\n /** Whether the entire group is disabled. */\n isDisabled?: boolean;\n /** Accessible label. */\n \"aria-label\"?: string;\n /** Labelled-by id. */\n \"aria-labelledby\"?: string;\n /** Currently selected keys (controlled). */\n selectedKeys?: Iterable<Key>;\n /** Default selected keys (uncontrolled). */\n defaultSelectedKeys?: Iterable<Key>;\n /** Handler called when selection changes. */\n onSelectionChange?: (keys: \"all\" | Set<Key>) => void;\n /** Handler called when an item action is triggered. */\n onAction?: (key: Key) => void;\n /** Keys of disabled items. */\n disabledKeys?: Iterable<Key>;\n /** Render function for each item. */\n children: (item: T, renderProps: ActionGroupItemRenderProps) => JSX.Element;\n /** CSS class for the container. */\n class?: ClassNameOrFunction<ActionGroupRenderProps>;\n /** Inline style for the container. */\n style?: StyleOrFunction<ActionGroupRenderProps>;\n}\n\nexport interface ActionGroupContextValue<T extends ActionGroupItem = ActionGroupItem> {\n state: ListState<T>;\n}\n\nexport const ActionGroupContext = createContext<ActionGroupContextValue | null>(null);\nexport const ActionGroupStateContext = createContext<ListState<ActionGroupItem> | null>(null);\n\nexport function ActionGroup<T extends ActionGroupItem = ActionGroupItem>(\n props: ActionGroupProps<T>,\n): JSX.Element {\n const [local, ariaGroupProps, domProps] = splitProps(\n props,\n [\n \"items\",\n \"selectionMode\",\n \"orientation\",\n \"isDisabled\",\n \"selectedKeys\",\n \"defaultSelectedKeys\",\n \"onSelectionChange\",\n \"onAction\",\n \"disabledKeys\",\n \"children\",\n \"class\",\n \"style\",\n \"slot\",\n ],\n [\"aria-label\", \"aria-labelledby\"],\n );\n\n const state = createListState<T>({\n get items() {\n return local.items;\n },\n get selectionMode() {\n return local.selectionMode ?? \"none\";\n },\n get selectedKeys() {\n return local.selectedKeys;\n },\n get defaultSelectedKeys() {\n return local.defaultSelectedKeys;\n },\n get onSelectionChange() {\n return local.onSelectionChange;\n },\n get disabledKeys() {\n return local.disabledKeys;\n },\n getKey: (item) => item.id,\n getTextValue: (item) => item.label,\n getDisabled: (item) => !!item.isDisabled,\n });\n\n const groupAriaProps: AriaActionGroupProps<T> = {\n get items() {\n return local.items;\n },\n get isDisabled() {\n return local.isDisabled;\n },\n get orientation() {\n return local.orientation;\n },\n get \"aria-label\"() {\n return ariaGroupProps[\"aria-label\"];\n },\n get \"aria-labelledby\"() {\n return ariaGroupProps[\"aria-labelledby\"];\n },\n get onAction() {\n return local.onAction;\n },\n };\n\n const { actionGroupProps } = createActionGroup(groupAriaProps, state as ListState<T>);\n\n const orientation = () => local.orientation ?? \"horizontal\";\n\n const renderProps = useRenderProps(\n {\n children: undefined,\n class: local.class,\n style: local.style,\n defaultClassName: \"solidaria-ActionGroup\",\n },\n () => ({\n orientation: orientation(),\n isDisabled: !!local.isDisabled,\n selectionMode: (local.selectionMode ?? \"none\") as SelectionMode,\n }),\n );\n\n const filteredDOMProps = createMemo(() =>\n filterDOMProps(domProps as Record<string, unknown>, { global: true }),\n );\n\n return (\n <ActionGroupContext value={{ state: state as ListState<ActionGroupItem> }}>\n <ActionGroupStateContext value={state as ListState<ActionGroupItem>}>\n <div\n {...filteredDOMProps()}\n {...actionGroupProps}\n ref={(el: HTMLDivElement) => {\n const refFn = (actionGroupProps as { ref?: (el: HTMLElement) => void }).ref;\n refFn?.(el);\n }}\n class={renderProps.class()}\n style={renderProps.style()}\n slot={local.slot}\n data-orientation={orientation()}\n data-disabled={dataAttr(local.isDisabled)}\n >\n <For each={local.items}>\n {(item) => (\n <ActionGroupItemWrapper\n item={item}\n state={state as ListState<ActionGroupItem>}\n renderChild={\n local.children as (\n item: ActionGroupItem,\n rp: ActionGroupItemRenderProps,\n ) => JSX.Element\n }\n />\n )}\n </For>\n </div>\n </ActionGroupStateContext>\n </ActionGroupContext>\n );\n}\n\ninterface ActionGroupItemWrapperProps {\n item: ActionGroupItem;\n state: ListState<ActionGroupItem>;\n renderChild: (item: ActionGroupItem, renderProps: ActionGroupItemRenderProps) => JSX.Element;\n}\n\nfunction ActionGroupItemWrapper(props: ActionGroupItemWrapperProps): JSX.Element {\n const { buttonProps } = createActionGroupItem(\n {\n get key() {\n return props.item.id;\n },\n },\n props.state,\n );\n\n const isFocused = () => props.state.focusedKey() === props.item.id;\n const isSelected = () => {\n const keys = props.state.selectedKeys();\n return keys === \"all\" || (keys instanceof Set && keys.has(props.item.id));\n };\n const isDisabled = () => props.state.isDisabled(props.item.id);\n\n const renderProps = createMemo<ActionGroupItemRenderProps>(() => ({\n isSelected: isSelected(),\n isDisabled: isDisabled(),\n isFocused: isFocused(),\n }));\n\n // splitProps (not object destructuring) so the reactive getters on buttonProps\n // — tabIndex (roving stop), onFocus (sets the focused key), role, aria-checked\n // — stay live. A rest-spread `{ ref, ...rest }` would FREEZE them at their\n // first-render values, pinning the roving tabIndex and killing focus tracking.\n const [, restButtonProps] = splitProps(buttonProps, [\"ref\"]);\n\n return (\n <button\n {...restButtonProps}\n data-selected={dataAttr(isSelected())}\n data-disabled={dataAttr(isDisabled())}\n data-focused={dataAttr(isFocused())}\n >\n {props.renderChild(props.item, renderProps())}\n </button>\n );\n}\n\nexport function useActionGroupContext(): ActionGroupContextValue | null {\n return useContext(ActionGroupContext);\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA+GA,MAAa,qBAAqB,cAA8C,IAAI;AACpF,MAAa,0BAA0B,cAAiD,IAAI;AAE5F,SAAgB,YACd,OACa;CACb,MAAM,CAAC,OAAO,gBAAgB,YAAY,WACxC,OACA;EACE;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;CACF,GACA,CAAC,cAAc,iBAAiB,CAClC;CAEA,MAAM,QAAQ,gBAAmB;EAC/B,IAAI,QAAQ;GACV,OAAO,MAAM;EACf;EACA,IAAI,gBAAgB;GAClB,OAAO,MAAM,iBAAiB;EAChC;EACA,IAAI,eAAe;GACjB,OAAO,MAAM;EACf;EACA,IAAI,sBAAsB;GACxB,OAAO,MAAM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AwB;IAC5B,EAAE;AAEN;AAQA,SAAS,uBAAuB,OAAiD;CAC/E,MAAM,EAAE,gBAAgB,sBACtB,EACE,IAAI,MAAM;EACR,OAAO,MAAM,KAAK;CACpB,EACF,GACA,MAAM,KACR;CAEA,MAAM,kBAAkB,MAAM,MAAM,WAAW,MAAM,MAAM,KAAK;CAChE,MAAM,mBAAmB;EACvB,MAAM,OAAO,MAAM,MAAM,aAAa;EACtC,OAAO,SAAS,SAAU,gBAAgB,OAAO,KAAK,IAAI,MAAM,KAAK,EAAE;CACzE;CACA,MAAM,mBAAmB,MAAM,MAAM,WAAW,MAAM,KAAK,EAAE;CAE7D,MAAM,cAAc,kBAA8C;EAChE,YAAY,WAAW;EACvB,YAAY,WAAW;EACvB,WAAW,UAAU;CACvB,EAAE;CAMF,MAAM,GAAG,mBAAmB,WAAW,aAAa,CAAC,KAAK,CAAC;CAE3D,OACE,CAAC,WACK,iBACJ,eAAe,SAAS,WAAW,CAAC,GACpC,eAAe,SAAS,WAAW,CAAC,GACpC,cAAc,SAAS,UAAU,CAAC,GACnC;OACE,MAAM,YAAY,MAAM,MAAM,YAAY,CAAC,EAAE;IAChD,EAAE;AAEN;AAEA,SAAgB,wBAAwD;CACtE,OAAO,WAAW,kBAAkB;AACtC"}
|
package/dist/Alert.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Alert.d.ts","sourceRoot":"","sources":["../src/Alert.tsx"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAGH,OAAO,KAAK,EAAE,GAAG,EAAE,MAAM,cAAc,CAAC;AACxC,OAAO,EACL,KAAK,cAAc,EACnB,KAAK,mBAAmB,EACxB,KAAK,eAAe,EACpB,KAAK,SAAS,
|
|
1
|
+
{"version":3,"file":"Alert.d.ts","sourceRoot":"","sources":["../src/Alert.tsx"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAGH,OAAO,KAAK,EAAE,GAAG,EAAE,MAAM,cAAc,CAAC;AACx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BAAgB,kBAAkB,CAAC,KAAK,EAAE,uBAAuB,GAAG,GAAG,CAAC,OAAO,CAU9E"}
|
package/dist/Alert.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { dataAttr, filterDOMProps } from "./utils.js";
|
|
1
|
+
import { dataAttr, evaluateRenderChildren, filterDOMProps } from "./utils.js";
|
|
2
2
|
import { Button } from "./Button.js";
|
|
3
|
-
import { createComponent, getNextElement, insert,
|
|
3
|
+
import { createComponent, getNextElement, insert, mergeProps, runHydrationEvents, scope, spread, template } from "@solidjs/web";
|
|
4
4
|
import { createContext, createMemo, useContext } from "solid-js";
|
|
5
5
|
import { splitProps } from "@proyecto-viviana/solidaria/utils";
|
|
6
6
|
//#region src/Alert.tsx
|
|
@@ -79,14 +79,9 @@ function Alert(props) {
|
|
|
79
79
|
return dataAttr(isDismissible());
|
|
80
80
|
}
|
|
81
81
|
}], true);
|
|
82
|
-
insert(_el$, scope((
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
});
|
|
86
|
-
return () => {
|
|
87
|
-
return _c$() ? local.children(renderValues()) : local.children;
|
|
88
|
-
};
|
|
89
|
-
})()));
|
|
82
|
+
insert(_el$, scope(() => {
|
|
83
|
+
return evaluateRenderChildren(local.children, renderValues());
|
|
84
|
+
}));
|
|
90
85
|
runHydrationEvents();
|
|
91
86
|
return _el$;
|
|
92
87
|
}
|
package/dist/Alert.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Alert.js","names":["<AlertContext value={contextValue}>\n <div\n {...domProps()}\n role=\"alert\"\n class={computedClass()}\n style={computedStyle()}\n data-variant={variant()}\n data-dismissible={dataAttr(isDismissible())}\n >\n {
|
|
1
|
+
{"version":3,"file":"Alert.js","names":["<AlertContext value={contextValue}>\n <div\n {...domProps()}\n role=\"alert\"\n class={computedClass()}\n style={computedStyle()}\n data-variant={variant()}\n data-dismissible={dataAttr(isDismissible())}\n >\n {evaluateRenderChildren(local.children, renderValues())}\n </div>\n </AlertContext>","value={contextValue}","role=\"alert\"","{evaluateRenderChildren(local.children, renderValues())}","<div\n {...domProps()}\n role=\"alert\"\n class={computedClass()}\n style={computedStyle()}\n data-variant={variant()}\n data-dismissible={dataAttr(isDismissible())}\n >\n {evaluateRenderChildren(local.children, renderValues())}\n </div>","<Button\n {...props}\n aria-label={props[\"aria-label\"] ?? \"Dismiss\"}\n onPress={() => context?.onDismiss?.()}\n />","onPress={() => context?.onDismiss?.()}"],"sources":["../src/Alert.tsx"],"sourcesContent":["/**\n * Alert component for solidaria-components\n *\n * Minimal headless Alert that owns ARIA semantics (role=\"alert\")\n * and provides render props for styling. The UI layer consumes this\n * for styling/composition only.\n *\n * This is a local Solid component. The pinned React Aria Components source\n * has no Alert counterpart.\n */\n\nimport { createContext, createMemo, useContext } from \"solid-js\";\nimport type { JSX } from \"@solidjs/web\";\nimport {\n type RenderChildren,\n type ClassNameOrFunction,\n type StyleOrFunction,\n type SlotProps,\n filterDOMProps,\n dataAttr,\n evaluateRenderChildren,\n} from \"./utils\";\nimport { Button, type ButtonProps } from \"./Button\";\nimport { splitProps } from \"@proyecto-viviana/solidaria/utils\";\n\nexport type AlertVariant = \"info\" | \"success\" | \"warning\" | \"error\";\n\nexport interface AlertRenderProps {\n /** The variant of the alert. */\n variant: AlertVariant;\n /** Whether the alert can be dismissed. */\n isDismissible: boolean;\n}\n\nexport interface AlertProps extends SlotProps {\n /** The variant of the alert. */\n variant?: AlertVariant;\n /** Whether the alert can be dismissed. */\n isDismissible?: boolean;\n /** Handler called when the alert is dismissed. */\n onDismiss?: () => void;\n /** The children of the component. A function may be provided to receive render props. */\n children?: RenderChildren<AlertRenderProps>;\n /** The CSS className for the element. */\n class?: ClassNameOrFunction<AlertRenderProps>;\n /** The inline style for the element. */\n style?: StyleOrFunction<AlertRenderProps>;\n /** The id of the element. */\n id?: string;\n}\n\nexport interface AlertContextValue {\n variant: () => AlertVariant;\n isDismissible: () => boolean;\n onDismiss?: () => void;\n}\n\nexport const AlertContext = createContext<AlertContextValue | null>(null);\n\n/**\n * An alert displays a brief, important message in a way that\n * attracts the user's attention without interrupting their task.\n *\n * This is a headless component that provides the ARIA `role=\"alert\"`\n * semantics and render props for styling.\n *\n * @example\n * ```tsx\n * <Alert variant=\"error\" isDismissible onDismiss={() => setVisible(false)}>\n * {({ variant }) => <span>Something went wrong ({variant})</span>}\n * </Alert>\n * ```\n */\nexport function Alert(props: AlertProps): JSX.Element {\n const [local, rest] = splitProps(props, [\n \"children\",\n \"class\",\n \"style\",\n \"slot\",\n \"variant\",\n \"isDismissible\",\n \"onDismiss\",\n ]);\n\n const variant = () => local.variant ?? \"info\";\n const isDismissible = () => !!local.isDismissible;\n\n const renderValues = createMemo<AlertRenderProps>(() => ({\n variant: variant(),\n isDismissible: isDismissible(),\n }));\n\n // Resolve class and style manually. We intentionally avoid useRenderProps()\n // because it destructures children eagerly, which would create child\n // components (e.g. AlertDismissButton) BEFORE the AlertContext.Provider\n // is in scope, breaking context for sub-components.\n const computedClass = createMemo(() => {\n const cls = local.class;\n return typeof cls === \"function\" ? cls(renderValues()) : (cls ?? \"solidaria-Alert\");\n });\n\n const computedStyle = createMemo(() => {\n const s = local.style;\n return typeof s === \"function\" ? s(renderValues()) : s;\n });\n\n const domProps = createMemo(() => filterDOMProps(rest, { global: true }));\n\n const contextValue: AlertContextValue = {\n variant,\n isDismissible,\n onDismiss: local.onDismiss,\n };\n\n // Children are accessed lazily inside the Provider scope (via local.children\n // in JSX) so sub-components like AlertDismissButton can read AlertContext.\n return (\n <AlertContext value={contextValue}>\n <div\n {...domProps()}\n role=\"alert\"\n class={computedClass()}\n style={computedStyle()}\n data-variant={variant()}\n data-dismissible={dataAttr(isDismissible())}\n >\n {evaluateRenderChildren(local.children, renderValues())}\n </div>\n </AlertContext>\n );\n}\n\nexport interface AlertDismissButtonProps extends Omit<ButtonProps, \"onPress\"> {}\n\n/**\n * A dismiss button for use inside an Alert.\n * Uses the headless Button for full keyboard/a11y support.\n *\n * @example\n * ```tsx\n * <Alert isDismissible onDismiss={handleDismiss}>\n * <span>Alert content</span>\n * <AlertDismissButton aria-label=\"Dismiss\">X</AlertDismissButton>\n * </Alert>\n * ```\n */\nexport function AlertDismissButton(props: AlertDismissButtonProps): JSX.Element {\n const context = useContext(AlertContext);\n\n return (\n <Button\n {...props}\n aria-label={props[\"aria-label\"] ?? \"Dismiss\"}\n onPress={() => context?.onDismiss?.()}\n />\n );\n}\n"],"mappings":";;;;;;;;;;;;;;;;;AAyDA,MAAa,eAAe,cAAwC,IAAI;;;;;;;;;;;;;;;AAgBxE,SAAgB,MAAM,OAAgC;CACpD,MAAM,CAAC,OAAO,QAAQ,WAAW,OAAO;EACtC;EACA;EACA;EACA;EACA;EACA;EACA;CACF,CAAC;CAED,MAAM,gBAAgB,MAAM,WAAW;CACvC,MAAM,sBAAsB,CAAC,CAAC,MAAM;CAEpC,MAAM,eAAe,kBAAoC;EACvD,SAAS,QAAQ;EACjB,eAAe,cAAc;CAC/B,EAAE;CAMF,MAAM,gBAAgB,iBAAiB;EACrC,MAAM,MAAM,MAAM;EAClB,OAAO,OAAO,QAAQ,aAAa,IAAI,aAAa,CAAC,IAAK,OAAO;CACnE,CAAC;CAED,MAAM,gBAAgB,iBAAiB;EACrC,MAAM,IAAI,MAAM;EAChB,OAAO,OAAO,MAAM,aAAa,EAAE,aAAa,CAAC,IAAI;CACvD,CAAC;CAED,MAAM,WAAW,iBAAiB,eAAe,MAAM,EAAE,QAAQ,KAAK,CAAC,CAAC;CAExE,MAAM,eAAkC;EACtC;EACA;EACA,WAAW,MAAM;CACnB;CAIA,OACEA,gBAAAA,cAAAA;EAAcC,OAAO;EAArB,IAAA,WAAA;GACE,IAAA,OAAA,eAAA,MASK;GARC,OAAA,MAAA,CAAA,UAAA;IACJC,MAAAA;IACA,IAAA,UAAA;KAAO,OAAA,cAAc;IAAC;IACtB,IAAA,QAAA;KAAO,OAAA,cAAc;IAAC;IACtB,IAAA,iBAAA;KAAc,OAAA,QAAQ;IAAC;IACvB,IAAA,qBAAA;KAAkB,OAAA,SAAS,cAAc,CAAC;IAAC;;GAN7C,OAAA,MAQEC,YAAAA;IAAC,OAAA,uBAAuB,MAAM,UAAU,aAAa,CAAC;GAAC,CAAA,CACpD;GATL,mBASK;GAVP,OACEC;EAUY;;AAElB;;;;;;;;;;;;;AAgBA,SAAgB,mBAAmB,OAA6C;CAC9E,MAAM,UAAU,WAAW,YAAY;CAEvC,OACEC,gBAAAA,QAAAA,WACM,OADN;EAEE,IAAA,eAAA;GAAY,OAAA,MAAM,iBAAiB;EAAS;EAC5CC,eAAe,SAAS,YAAY;CACrC,CAAA,CAAA;AAEL"}
|
package/dist/Alert.jsx
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { dataAttr, filterDOMProps } from "./utils.jsx";
|
|
1
|
+
import { dataAttr, evaluateRenderChildren, filterDOMProps } from "./utils.jsx";
|
|
2
2
|
import { Button } from "./Button.jsx";
|
|
3
3
|
import { createContext, createMemo, useContext } from "solid-js";
|
|
4
4
|
import { splitProps } from "@proyecto-viviana/solidaria/utils";
|
|
@@ -60,7 +60,7 @@ function Alert(props) {
|
|
|
60
60
|
};
|
|
61
61
|
return <AlertContext value={contextValue}>
|
|
62
62
|
<div {...domProps()} role="alert" class={computedClass()} style={computedStyle()} data-variant={variant()} data-dismissible={dataAttr(isDismissible())}>
|
|
63
|
-
{
|
|
63
|
+
{evaluateRenderChildren(local.children, renderValues())}
|
|
64
64
|
</div>
|
|
65
65
|
</AlertContext>;
|
|
66
66
|
}
|
package/dist/Alert.jsx.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Alert.jsx","names":[],"sources":["../src/Alert.tsx"],"sourcesContent":["/**\n * Alert component for solidaria-components\n *\n * Minimal headless Alert that owns ARIA semantics (role=\"alert\")\n * and provides render props for styling. The UI layer consumes this\n * for styling/composition only.\n *\n * This is a local Solid component. The pinned React Aria Components source\n * has no Alert counterpart.\n */\n\nimport { createContext, createMemo, useContext } from \"solid-js\";\nimport type { JSX } from \"@solidjs/web\";\nimport {\n type RenderChildren,\n type ClassNameOrFunction,\n type StyleOrFunction,\n type SlotProps,\n filterDOMProps,\n dataAttr,\n} from \"./utils\";\nimport { Button, type ButtonProps } from \"./Button\";\nimport { splitProps } from \"@proyecto-viviana/solidaria/utils\";\n\nexport type AlertVariant = \"info\" | \"success\" | \"warning\" | \"error\";\n\nexport interface AlertRenderProps {\n /** The variant of the alert. */\n variant: AlertVariant;\n /** Whether the alert can be dismissed. */\n isDismissible: boolean;\n}\n\nexport interface AlertProps extends SlotProps {\n /** The variant of the alert. */\n variant?: AlertVariant;\n /** Whether the alert can be dismissed. */\n isDismissible?: boolean;\n /** Handler called when the alert is dismissed. */\n onDismiss?: () => void;\n /** The children of the component. A function may be provided to receive render props. */\n children?: RenderChildren<AlertRenderProps>;\n /** The CSS className for the element. */\n class?: ClassNameOrFunction<AlertRenderProps>;\n /** The inline style for the element. */\n style?: StyleOrFunction<AlertRenderProps>;\n /** The id of the element. */\n id?: string;\n}\n\nexport interface AlertContextValue {\n variant: () => AlertVariant;\n isDismissible: () => boolean;\n onDismiss?: () => void;\n}\n\nexport const AlertContext = createContext<AlertContextValue | null>(null);\n\n/**\n * An alert displays a brief, important message in a way that\n * attracts the user's attention without interrupting their task.\n *\n * This is a headless component that provides the ARIA `role=\"alert\"`\n * semantics and render props for styling.\n *\n * @example\n * ```tsx\n * <Alert variant=\"error\" isDismissible onDismiss={() => setVisible(false)}>\n * {({ variant }) => <span>Something went wrong ({variant})</span>}\n * </Alert>\n * ```\n */\nexport function Alert(props: AlertProps): JSX.Element {\n const [local, rest] = splitProps(props, [\n \"children\",\n \"class\",\n \"style\",\n \"slot\",\n \"variant\",\n \"isDismissible\",\n \"onDismiss\",\n ]);\n\n const variant = () => local.variant ?? \"info\";\n const isDismissible = () => !!local.isDismissible;\n\n const renderValues = createMemo<AlertRenderProps>(() => ({\n variant: variant(),\n isDismissible: isDismissible(),\n }));\n\n // Resolve class and style manually. We intentionally avoid useRenderProps()\n // because it destructures children eagerly, which would create child\n // components (e.g. AlertDismissButton) BEFORE the AlertContext.Provider\n // is in scope, breaking context for sub-components.\n const computedClass = createMemo(() => {\n const cls = local.class;\n return typeof cls === \"function\" ? cls(renderValues()) : (cls ?? \"solidaria-Alert\");\n });\n\n const computedStyle = createMemo(() => {\n const s = local.style;\n return typeof s === \"function\" ? s(renderValues()) : s;\n });\n\n const domProps = createMemo(() => filterDOMProps(rest, { global: true }));\n\n const contextValue: AlertContextValue = {\n variant,\n isDismissible,\n onDismiss: local.onDismiss,\n };\n\n // Children are accessed lazily inside the Provider scope (via local.children\n // in JSX) so sub-components like AlertDismissButton can read AlertContext.\n return (\n <AlertContext value={contextValue}>\n <div\n {...domProps()}\n role=\"alert\"\n class={computedClass()}\n style={computedStyle()}\n data-variant={variant()}\n data-dismissible={dataAttr(isDismissible())}\n >\n {
|
|
1
|
+
{"version":3,"file":"Alert.jsx","names":[],"sources":["../src/Alert.tsx"],"sourcesContent":["/**\n * Alert component for solidaria-components\n *\n * Minimal headless Alert that owns ARIA semantics (role=\"alert\")\n * and provides render props for styling. The UI layer consumes this\n * for styling/composition only.\n *\n * This is a local Solid component. The pinned React Aria Components source\n * has no Alert counterpart.\n */\n\nimport { createContext, createMemo, useContext } from \"solid-js\";\nimport type { JSX } from \"@solidjs/web\";\nimport {\n type RenderChildren,\n type ClassNameOrFunction,\n type StyleOrFunction,\n type SlotProps,\n filterDOMProps,\n dataAttr,\n evaluateRenderChildren,\n} from \"./utils\";\nimport { Button, type ButtonProps } from \"./Button\";\nimport { splitProps } from \"@proyecto-viviana/solidaria/utils\";\n\nexport type AlertVariant = \"info\" | \"success\" | \"warning\" | \"error\";\n\nexport interface AlertRenderProps {\n /** The variant of the alert. */\n variant: AlertVariant;\n /** Whether the alert can be dismissed. */\n isDismissible: boolean;\n}\n\nexport interface AlertProps extends SlotProps {\n /** The variant of the alert. */\n variant?: AlertVariant;\n /** Whether the alert can be dismissed. */\n isDismissible?: boolean;\n /** Handler called when the alert is dismissed. */\n onDismiss?: () => void;\n /** The children of the component. A function may be provided to receive render props. */\n children?: RenderChildren<AlertRenderProps>;\n /** The CSS className for the element. */\n class?: ClassNameOrFunction<AlertRenderProps>;\n /** The inline style for the element. */\n style?: StyleOrFunction<AlertRenderProps>;\n /** The id of the element. */\n id?: string;\n}\n\nexport interface AlertContextValue {\n variant: () => AlertVariant;\n isDismissible: () => boolean;\n onDismiss?: () => void;\n}\n\nexport const AlertContext = createContext<AlertContextValue | null>(null);\n\n/**\n * An alert displays a brief, important message in a way that\n * attracts the user's attention without interrupting their task.\n *\n * This is a headless component that provides the ARIA `role=\"alert\"`\n * semantics and render props for styling.\n *\n * @example\n * ```tsx\n * <Alert variant=\"error\" isDismissible onDismiss={() => setVisible(false)}>\n * {({ variant }) => <span>Something went wrong ({variant})</span>}\n * </Alert>\n * ```\n */\nexport function Alert(props: AlertProps): JSX.Element {\n const [local, rest] = splitProps(props, [\n \"children\",\n \"class\",\n \"style\",\n \"slot\",\n \"variant\",\n \"isDismissible\",\n \"onDismiss\",\n ]);\n\n const variant = () => local.variant ?? \"info\";\n const isDismissible = () => !!local.isDismissible;\n\n const renderValues = createMemo<AlertRenderProps>(() => ({\n variant: variant(),\n isDismissible: isDismissible(),\n }));\n\n // Resolve class and style manually. We intentionally avoid useRenderProps()\n // because it destructures children eagerly, which would create child\n // components (e.g. AlertDismissButton) BEFORE the AlertContext.Provider\n // is in scope, breaking context for sub-components.\n const computedClass = createMemo(() => {\n const cls = local.class;\n return typeof cls === \"function\" ? cls(renderValues()) : (cls ?? \"solidaria-Alert\");\n });\n\n const computedStyle = createMemo(() => {\n const s = local.style;\n return typeof s === \"function\" ? s(renderValues()) : s;\n });\n\n const domProps = createMemo(() => filterDOMProps(rest, { global: true }));\n\n const contextValue: AlertContextValue = {\n variant,\n isDismissible,\n onDismiss: local.onDismiss,\n };\n\n // Children are accessed lazily inside the Provider scope (via local.children\n // in JSX) so sub-components like AlertDismissButton can read AlertContext.\n return (\n <AlertContext value={contextValue}>\n <div\n {...domProps()}\n role=\"alert\"\n class={computedClass()}\n style={computedStyle()}\n data-variant={variant()}\n data-dismissible={dataAttr(isDismissible())}\n >\n {evaluateRenderChildren(local.children, renderValues())}\n </div>\n </AlertContext>\n );\n}\n\nexport interface AlertDismissButtonProps extends Omit<ButtonProps, \"onPress\"> {}\n\n/**\n * A dismiss button for use inside an Alert.\n * Uses the headless Button for full keyboard/a11y support.\n *\n * @example\n * ```tsx\n * <Alert isDismissible onDismiss={handleDismiss}>\n * <span>Alert content</span>\n * <AlertDismissButton aria-label=\"Dismiss\">X</AlertDismissButton>\n * </Alert>\n * ```\n */\nexport function AlertDismissButton(props: AlertDismissButtonProps): JSX.Element {\n const context = useContext(AlertContext);\n\n return (\n <Button\n {...props}\n aria-label={props[\"aria-label\"] ?? \"Dismiss\"}\n onPress={() => context?.onDismiss?.()}\n />\n );\n}\n"],"mappings":";;;;;;;;;;;;;;;AAyDA,MAAa,eAAe,cAAwC,IAAI;;;;;;;;;;;;;;;AAgBxE,SAAgB,MAAM,OAAgC;CACpD,MAAM,CAAC,OAAO,QAAQ,WAAW,OAAO;EACtC;EACA;EACA;EACA;EACA;EACA;EACA;CACF,CAAC;CAED,MAAM,gBAAgB,MAAM,WAAW;CACvC,MAAM,sBAAsB,CAAC,CAAC,MAAM;CAEpC,MAAM,eAAe,kBAAoC;EACvD,SAAS,QAAQ;EACjB,eAAe,cAAc;CAC/B,EAAE;CAMF,MAAM,gBAAgB,iBAAiB;EACrC,MAAM,MAAM,MAAM;EAClB,OAAO,OAAO,QAAQ,aAAa,IAAI,aAAa,CAAC,IAAK,OAAO;CACnE,CAAC;CAED,MAAM,gBAAgB,iBAAiB;EACrC,MAAM,IAAI,MAAM;EAChB,OAAO,OAAO,MAAM,aAAa,EAAE,aAAa,CAAC,IAAI;CACvD,CAAC;CAED,MAAM,WAAW,iBAAiB,eAAe,MAAM,EAAE,QAAQ,KAAK,CAAC,CAAC;CAExE,MAAM,eAAkC;EACtC;EACA;EACA,WAAW,MAAM;CACnB;CAIA,OACE,CAAC,aAAa,OAAO,cAAc;MACjC,CAAC,QACK,SAAS,GACb,aACA,OAAO,cAAc,GACrB,OAAO,cAAc,GACrB,cAAc,QAAQ,GACtB,kBAAkB,SAAS,cAAc,CAAC,GAC3C;SACE,uBAAuB,MAAM,UAAU,aAAa,CAAC,EAAE;MAC1D,EAAE,IAAI;IACR,EAAE;AAEN;;;;;;;;;;;;;AAgBA,SAAgB,mBAAmB,OAA6C;CAC9E,MAAM,UAAU,WAAW,YAAY;CAEvC,OACE,CAAC,WACK,OACJ,YAAY,MAAM,iBAAiB,WACnC,eAAe,SAAS,YAAY;AAG1C"}
|
package/dist/Autocomplete.js
CHANGED
|
@@ -84,7 +84,7 @@ function useAutocompleteCollection() {
|
|
|
84
84
|
* ```
|
|
85
85
|
*/
|
|
86
86
|
function Autocomplete(props) {
|
|
87
|
-
const [stateProps, ariaProps
|
|
87
|
+
const [stateProps, ariaProps] = splitProps(props, [
|
|
88
88
|
"inputValue",
|
|
89
89
|
"defaultInputValue",
|
|
90
90
|
"onInputChange"
|
package/dist/Autocomplete.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Autocomplete.js","names":["<AutocompleteStateContext value={state}>\n <AutocompleteContext value={inputContextValue()}>\n <AutocompleteCollectionContext value={collectionContextValue()}>\n {props.children}\n </AutocompleteCollectionContext>\n </AutocompleteContext>\n </AutocompleteStateContext>","value={state}","<AutocompleteContext value={inputContextValue()}>\n <AutocompleteCollectionContext value={collectionContextValue()}>\n {props.children}\n </AutocompleteCollectionContext>\n </AutocompleteContext>","<AutocompleteCollectionContext value={collectionContextValue()}>\n {props.children}\n </AutocompleteCollectionContext>"],"sources":["../src/Autocomplete.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/Autocomplete.tsx\n\n/**\n * Autocomplete component for solidaria-components\n *\n * Provides autocomplete functionality by wrapping a text input\n * with a filterable collection (ListBox/Menu).\n *\n * Port of react-aria-components/src/Autocomplete.tsx\n */\n\nimport { createContext, useContext, createMemo, createSignal } from \"solid-js\";\nimport type { ParentProps } from \"solid-js\";\nimport type { JSX } from \"@solidjs/web\";\nimport {\n createAutocomplete,\n type AriaAutocompleteOptions,\n type AutocompleteInputProps,\n type CollectionOptions,\n} from \"@proyecto-viviana/solidaria\";\nimport {\n createAutocompleteState,\n type AutocompleteState,\n type AutocompleteStateOptions,\n type CollectionNode,\n} from \"@proyecto-viviana/solid-stately\";\nimport { type SlotProps } from \"./utils\";\nimport { splitProps } from \"@proyecto-viviana/solidaria/utils\";\n\nexport interface AutocompleteProps<T = unknown>\n extends\n Omit<AutocompleteStateOptions, \"children\">,\n Omit<AriaAutocompleteOptions<T>, \"inputRef\" | \"collectionRef\">,\n ParentProps,\n SlotProps {}\n\nexport interface AutocompleteContextValue {\n inputProps: AutocompleteInputProps;\n inputRef: (el: HTMLInputElement) => void;\n}\n\nexport interface AutocompleteCollectionContextValue {\n collectionProps: CollectionOptions;\n collectionRef: (el: HTMLElement) => void;\n filter?: (nodeTextValue: string, node: CollectionNode<unknown>) => boolean;\n}\n\nexport const AutocompleteContext = createContext<AutocompleteContextValue | null>(null);\nexport const AutocompleteStateContext = createContext<AutocompleteState | null>(null);\nexport const AutocompleteCollectionContext =\n createContext<AutocompleteCollectionContextValue | null>(null);\n\n/**\n * Hook to consume autocomplete input context.\n * Use this in your input component (TextField/SearchField) to get the autocomplete props.\n */\nexport function useAutocompleteInput() {\n return useContext(AutocompleteContext);\n}\n\n/**\n * Hook to consume autocomplete state context.\n */\nexport function useAutocompleteState() {\n return useContext(AutocompleteStateContext);\n}\n\n/**\n * Hook to consume autocomplete collection context.\n * Use this in your collection component (ListBox/Menu) to get the autocomplete props.\n */\nexport function useAutocompleteCollection() {\n return useContext(AutocompleteCollectionContext);\n}\n\n/**\n * An autocomplete allows users to search or filter a list of suggestions.\n * It wraps a text input and a collection component (ListBox or Menu),\n * providing keyboard navigation and filtering capabilities.\n *\n * @example\n * ```tsx\n * // Basic usage with SearchField and ListBox\n * <Autocomplete\n * filter={(textValue, inputValue) =>\n * textValue.toLowerCase().includes(inputValue.toLowerCase())\n * }\n * >\n * <SearchField aria-label=\"Search\">\n * <Input />\n * </SearchField>\n * <ListBox aria-label=\"Suggestions\">\n * <ListBoxItem>Option 1</ListBoxItem>\n * <ListBoxItem>Option 2</ListBoxItem>\n * <ListBoxItem>Option 3</ListBoxItem>\n * </ListBox>\n * </Autocomplete>\n *\n * // Controlled input value\n * const [value, setValue] = createSignal('');\n * <Autocomplete\n * inputValue={value()}\n * onInputChange={setValue}\n * filter={(textValue, inputValue) =>\n * textValue.toLowerCase().includes(inputValue.toLowerCase())\n * }\n * >\n * {/* ... *\\/}\n * </Autocomplete>\n * ```\n */\nexport function Autocomplete<T = unknown>(props: AutocompleteProps<T>): JSX.Element {\n const [stateProps, ariaProps
|
|
1
|
+
{"version":3,"file":"Autocomplete.js","names":["<AutocompleteStateContext value={state}>\n <AutocompleteContext value={inputContextValue()}>\n <AutocompleteCollectionContext value={collectionContextValue()}>\n {props.children}\n </AutocompleteCollectionContext>\n </AutocompleteContext>\n </AutocompleteStateContext>","value={state}","<AutocompleteContext value={inputContextValue()}>\n <AutocompleteCollectionContext value={collectionContextValue()}>\n {props.children}\n </AutocompleteCollectionContext>\n </AutocompleteContext>","<AutocompleteCollectionContext value={collectionContextValue()}>\n {props.children}\n </AutocompleteCollectionContext>"],"sources":["../src/Autocomplete.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/Autocomplete.tsx\n\n/**\n * Autocomplete component for solidaria-components\n *\n * Provides autocomplete functionality by wrapping a text input\n * with a filterable collection (ListBox/Menu).\n *\n * Port of react-aria-components/src/Autocomplete.tsx\n */\n\nimport { createContext, useContext, createMemo, createSignal } from \"solid-js\";\nimport type { ParentProps } from \"solid-js\";\nimport type { JSX } from \"@solidjs/web\";\nimport {\n createAutocomplete,\n type AriaAutocompleteOptions,\n type AutocompleteInputProps,\n type CollectionOptions,\n} from \"@proyecto-viviana/solidaria\";\nimport {\n createAutocompleteState,\n type AutocompleteState,\n type AutocompleteStateOptions,\n type CollectionNode,\n} from \"@proyecto-viviana/solid-stately\";\nimport { type SlotProps } from \"./utils\";\nimport { splitProps } from \"@proyecto-viviana/solidaria/utils\";\n\nexport interface AutocompleteProps<T = unknown>\n extends\n Omit<AutocompleteStateOptions, \"children\">,\n Omit<AriaAutocompleteOptions<T>, \"inputRef\" | \"collectionRef\">,\n ParentProps,\n SlotProps {}\n\nexport interface AutocompleteContextValue {\n inputProps: AutocompleteInputProps;\n inputRef: (el: HTMLInputElement) => void;\n}\n\nexport interface AutocompleteCollectionContextValue {\n collectionProps: CollectionOptions;\n collectionRef: (el: HTMLElement) => void;\n filter?: (nodeTextValue: string, node: CollectionNode<unknown>) => boolean;\n}\n\nexport const AutocompleteContext = createContext<AutocompleteContextValue | null>(null);\nexport const AutocompleteStateContext = createContext<AutocompleteState | null>(null);\nexport const AutocompleteCollectionContext =\n createContext<AutocompleteCollectionContextValue | null>(null);\n\n/**\n * Hook to consume autocomplete input context.\n * Use this in your input component (TextField/SearchField) to get the autocomplete props.\n */\nexport function useAutocompleteInput() {\n return useContext(AutocompleteContext);\n}\n\n/**\n * Hook to consume autocomplete state context.\n */\nexport function useAutocompleteState() {\n return useContext(AutocompleteStateContext);\n}\n\n/**\n * Hook to consume autocomplete collection context.\n * Use this in your collection component (ListBox/Menu) to get the autocomplete props.\n */\nexport function useAutocompleteCollection() {\n return useContext(AutocompleteCollectionContext);\n}\n\n/**\n * An autocomplete allows users to search or filter a list of suggestions.\n * It wraps a text input and a collection component (ListBox or Menu),\n * providing keyboard navigation and filtering capabilities.\n *\n * @example\n * ```tsx\n * // Basic usage with SearchField and ListBox\n * <Autocomplete\n * filter={(textValue, inputValue) =>\n * textValue.toLowerCase().includes(inputValue.toLowerCase())\n * }\n * >\n * <SearchField aria-label=\"Search\">\n * <Input />\n * </SearchField>\n * <ListBox aria-label=\"Suggestions\">\n * <ListBoxItem>Option 1</ListBoxItem>\n * <ListBoxItem>Option 2</ListBoxItem>\n * <ListBoxItem>Option 3</ListBoxItem>\n * </ListBox>\n * </Autocomplete>\n *\n * // Controlled input value\n * const [value, setValue] = createSignal('');\n * <Autocomplete\n * inputValue={value()}\n * onInputChange={setValue}\n * filter={(textValue, inputValue) =>\n * textValue.toLowerCase().includes(inputValue.toLowerCase())\n * }\n * >\n * {/* ... *\\/}\n * </Autocomplete>\n * ```\n */\nexport function Autocomplete<T = unknown>(props: AutocompleteProps<T>): JSX.Element {\n const [stateProps, ariaProps] = splitProps(\n props,\n [\"inputValue\", \"defaultInputValue\", \"onInputChange\"],\n [\n \"filter\",\n \"disableAutoFocusFirst\",\n \"disableVirtualFocus\",\n \"collectionId\",\n \"collectionAriaLabel\",\n ],\n );\n\n const state = createAutocompleteState(stateProps);\n\n // Refs are signals so createAutocomplete's effects (the beforeinput listener\n // and the reverse-path focusin listener that mirrors aria-activedescendant)\n // bind reactively once the input/collection elements actually mount.\n const [inputRef, setInputRef] = createSignal<HTMLInputElement>();\n const [collectionRef, setCollectionRef] = createSignal<HTMLElement>();\n\n // Create autocomplete aria\n const autocomplete = createAutocomplete<T>(\n {\n ...ariaProps,\n inputRef,\n collectionRef,\n },\n state,\n );\n\n // Input context value\n const inputContextValue = createMemo<AutocompleteContextValue>(() => ({\n inputProps: autocomplete.inputProps,\n inputRef: (el: HTMLInputElement) => {\n setInputRef(el);\n },\n }));\n\n // Collection context value\n const collectionContextValue = createMemo<AutocompleteCollectionContextValue>(() => ({\n collectionProps: autocomplete.collectionProps,\n collectionRef: (el: HTMLElement) => {\n setCollectionRef(el);\n },\n filter: autocomplete.filter as\n | ((nodeTextValue: string, node: CollectionNode<unknown>) => boolean)\n | undefined,\n }));\n\n return (\n <AutocompleteStateContext value={state}>\n <AutocompleteContext value={inputContextValue()}>\n <AutocompleteCollectionContext value={collectionContextValue()}>\n {props.children}\n </AutocompleteCollectionContext>\n </AutocompleteContext>\n </AutocompleteStateContext>\n );\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AA2DA,MAAa,sBAAsB,cAA+C,IAAI;AACtF,MAAa,2BAA2B,cAAwC,IAAI;AACpF,MAAa,gCACX,cAAyD,IAAI;;;;;AAM/D,SAAgB,uBAAuB;CACrC,OAAO,WAAW,mBAAmB;AACvC;;;;AAKA,SAAgB,uBAAuB;CACrC,OAAO,WAAW,wBAAwB;AAC5C;;;;;AAMA,SAAgB,4BAA4B;CAC1C,OAAO,WAAW,6BAA6B;AACjD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAsCA,SAAgB,aAA0B,OAA0C;CAClF,MAAM,CAAC,YAAY,aAAa,WAC9B,OACA;EAAC;EAAc;EAAqB;CAAe,GACnD;EACE;EACA;EACA;EACA;EACA;CACF,CACF;CAEA,MAAM,QAAQ,wBAAwB,UAAU;CAKhD,MAAM,CAAC,UAAU,eAAe,aAA+B;CAC/D,MAAM,CAAC,eAAe,oBAAoB,aAA0B;CAGpE,MAAM,eAAe,mBACnB;EACE,GAAG;EACH;EACA;CACF,GACA,KACF;CAGA,MAAM,oBAAoB,kBAA4C;EACpE,YAAY,aAAa;EACzB,WAAW,OAAyB;GAClC,YAAY,EAAE;EAChB;CACF,EAAE;CAGF,MAAM,yBAAyB,kBAAsD;EACnF,iBAAiB,aAAa;EAC9B,gBAAgB,OAAoB;GAClC,iBAAiB,EAAE;EACrB;EACA,QAAQ,aAAa;CAGvB,EAAE;CAEF,OACEA,gBAAAA,0BAAAA;EAA0BC,OAAO;EAAjC,IAAA,WAAA;GACEC,OAAAA,gBAAAA,qBAAAA;IAAqB,IAAA,QAAA;KAAO,OAAA,kBAAkB;IAAC;IAA/C,IAAA,WAAA;KACEC,OAAAA,gBAAAA,+BAAAA;MAA+B,IAAA,QAAA;OAAO,OAAA,uBAAuB;MAAC;MAA9D,IAAA,WAAA;OACG,OAAA,MAAM;MACsB;;IACZ;;EACG;;AAE9B"}
|
package/dist/Autocomplete.jsx
CHANGED
|
@@ -83,7 +83,7 @@ function useAutocompleteCollection() {
|
|
|
83
83
|
* ```
|
|
84
84
|
*/
|
|
85
85
|
function Autocomplete(props) {
|
|
86
|
-
const [stateProps, ariaProps
|
|
86
|
+
const [stateProps, ariaProps] = splitProps(props, [
|
|
87
87
|
"inputValue",
|
|
88
88
|
"defaultInputValue",
|
|
89
89
|
"onInputChange"
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Autocomplete.jsx","names":[],"sources":["../src/Autocomplete.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/Autocomplete.tsx\n\n/**\n * Autocomplete component for solidaria-components\n *\n * Provides autocomplete functionality by wrapping a text input\n * with a filterable collection (ListBox/Menu).\n *\n * Port of react-aria-components/src/Autocomplete.tsx\n */\n\nimport { createContext, useContext, createMemo, createSignal } from \"solid-js\";\nimport type { ParentProps } from \"solid-js\";\nimport type { JSX } from \"@solidjs/web\";\nimport {\n createAutocomplete,\n type AriaAutocompleteOptions,\n type AutocompleteInputProps,\n type CollectionOptions,\n} from \"@proyecto-viviana/solidaria\";\nimport {\n createAutocompleteState,\n type AutocompleteState,\n type AutocompleteStateOptions,\n type CollectionNode,\n} from \"@proyecto-viviana/solid-stately\";\nimport { type SlotProps } from \"./utils\";\nimport { splitProps } from \"@proyecto-viviana/solidaria/utils\";\n\nexport interface AutocompleteProps<T = unknown>\n extends\n Omit<AutocompleteStateOptions, \"children\">,\n Omit<AriaAutocompleteOptions<T>, \"inputRef\" | \"collectionRef\">,\n ParentProps,\n SlotProps {}\n\nexport interface AutocompleteContextValue {\n inputProps: AutocompleteInputProps;\n inputRef: (el: HTMLInputElement) => void;\n}\n\nexport interface AutocompleteCollectionContextValue {\n collectionProps: CollectionOptions;\n collectionRef: (el: HTMLElement) => void;\n filter?: (nodeTextValue: string, node: CollectionNode<unknown>) => boolean;\n}\n\nexport const AutocompleteContext = createContext<AutocompleteContextValue | null>(null);\nexport const AutocompleteStateContext = createContext<AutocompleteState | null>(null);\nexport const AutocompleteCollectionContext =\n createContext<AutocompleteCollectionContextValue | null>(null);\n\n/**\n * Hook to consume autocomplete input context.\n * Use this in your input component (TextField/SearchField) to get the autocomplete props.\n */\nexport function useAutocompleteInput() {\n return useContext(AutocompleteContext);\n}\n\n/**\n * Hook to consume autocomplete state context.\n */\nexport function useAutocompleteState() {\n return useContext(AutocompleteStateContext);\n}\n\n/**\n * Hook to consume autocomplete collection context.\n * Use this in your collection component (ListBox/Menu) to get the autocomplete props.\n */\nexport function useAutocompleteCollection() {\n return useContext(AutocompleteCollectionContext);\n}\n\n/**\n * An autocomplete allows users to search or filter a list of suggestions.\n * It wraps a text input and a collection component (ListBox or Menu),\n * providing keyboard navigation and filtering capabilities.\n *\n * @example\n * ```tsx\n * // Basic usage with SearchField and ListBox\n * <Autocomplete\n * filter={(textValue, inputValue) =>\n * textValue.toLowerCase().includes(inputValue.toLowerCase())\n * }\n * >\n * <SearchField aria-label=\"Search\">\n * <Input />\n * </SearchField>\n * <ListBox aria-label=\"Suggestions\">\n * <ListBoxItem>Option 1</ListBoxItem>\n * <ListBoxItem>Option 2</ListBoxItem>\n * <ListBoxItem>Option 3</ListBoxItem>\n * </ListBox>\n * </Autocomplete>\n *\n * // Controlled input value\n * const [value, setValue] = createSignal('');\n * <Autocomplete\n * inputValue={value()}\n * onInputChange={setValue}\n * filter={(textValue, inputValue) =>\n * textValue.toLowerCase().includes(inputValue.toLowerCase())\n * }\n * >\n * {/* ... *\\/}\n * </Autocomplete>\n * ```\n */\nexport function Autocomplete<T = unknown>(props: AutocompleteProps<T>): JSX.Element {\n const [stateProps, ariaProps
|
|
1
|
+
{"version":3,"file":"Autocomplete.jsx","names":[],"sources":["../src/Autocomplete.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/Autocomplete.tsx\n\n/**\n * Autocomplete component for solidaria-components\n *\n * Provides autocomplete functionality by wrapping a text input\n * with a filterable collection (ListBox/Menu).\n *\n * Port of react-aria-components/src/Autocomplete.tsx\n */\n\nimport { createContext, useContext, createMemo, createSignal } from \"solid-js\";\nimport type { ParentProps } from \"solid-js\";\nimport type { JSX } from \"@solidjs/web\";\nimport {\n createAutocomplete,\n type AriaAutocompleteOptions,\n type AutocompleteInputProps,\n type CollectionOptions,\n} from \"@proyecto-viviana/solidaria\";\nimport {\n createAutocompleteState,\n type AutocompleteState,\n type AutocompleteStateOptions,\n type CollectionNode,\n} from \"@proyecto-viviana/solid-stately\";\nimport { type SlotProps } from \"./utils\";\nimport { splitProps } from \"@proyecto-viviana/solidaria/utils\";\n\nexport interface AutocompleteProps<T = unknown>\n extends\n Omit<AutocompleteStateOptions, \"children\">,\n Omit<AriaAutocompleteOptions<T>, \"inputRef\" | \"collectionRef\">,\n ParentProps,\n SlotProps {}\n\nexport interface AutocompleteContextValue {\n inputProps: AutocompleteInputProps;\n inputRef: (el: HTMLInputElement) => void;\n}\n\nexport interface AutocompleteCollectionContextValue {\n collectionProps: CollectionOptions;\n collectionRef: (el: HTMLElement) => void;\n filter?: (nodeTextValue: string, node: CollectionNode<unknown>) => boolean;\n}\n\nexport const AutocompleteContext = createContext<AutocompleteContextValue | null>(null);\nexport const AutocompleteStateContext = createContext<AutocompleteState | null>(null);\nexport const AutocompleteCollectionContext =\n createContext<AutocompleteCollectionContextValue | null>(null);\n\n/**\n * Hook to consume autocomplete input context.\n * Use this in your input component (TextField/SearchField) to get the autocomplete props.\n */\nexport function useAutocompleteInput() {\n return useContext(AutocompleteContext);\n}\n\n/**\n * Hook to consume autocomplete state context.\n */\nexport function useAutocompleteState() {\n return useContext(AutocompleteStateContext);\n}\n\n/**\n * Hook to consume autocomplete collection context.\n * Use this in your collection component (ListBox/Menu) to get the autocomplete props.\n */\nexport function useAutocompleteCollection() {\n return useContext(AutocompleteCollectionContext);\n}\n\n/**\n * An autocomplete allows users to search or filter a list of suggestions.\n * It wraps a text input and a collection component (ListBox or Menu),\n * providing keyboard navigation and filtering capabilities.\n *\n * @example\n * ```tsx\n * // Basic usage with SearchField and ListBox\n * <Autocomplete\n * filter={(textValue, inputValue) =>\n * textValue.toLowerCase().includes(inputValue.toLowerCase())\n * }\n * >\n * <SearchField aria-label=\"Search\">\n * <Input />\n * </SearchField>\n * <ListBox aria-label=\"Suggestions\">\n * <ListBoxItem>Option 1</ListBoxItem>\n * <ListBoxItem>Option 2</ListBoxItem>\n * <ListBoxItem>Option 3</ListBoxItem>\n * </ListBox>\n * </Autocomplete>\n *\n * // Controlled input value\n * const [value, setValue] = createSignal('');\n * <Autocomplete\n * inputValue={value()}\n * onInputChange={setValue}\n * filter={(textValue, inputValue) =>\n * textValue.toLowerCase().includes(inputValue.toLowerCase())\n * }\n * >\n * {/* ... *\\/}\n * </Autocomplete>\n * ```\n */\nexport function Autocomplete<T = unknown>(props: AutocompleteProps<T>): JSX.Element {\n const [stateProps, ariaProps] = splitProps(\n props,\n [\"inputValue\", \"defaultInputValue\", \"onInputChange\"],\n [\n \"filter\",\n \"disableAutoFocusFirst\",\n \"disableVirtualFocus\",\n \"collectionId\",\n \"collectionAriaLabel\",\n ],\n );\n\n const state = createAutocompleteState(stateProps);\n\n // Refs are signals so createAutocomplete's effects (the beforeinput listener\n // and the reverse-path focusin listener that mirrors aria-activedescendant)\n // bind reactively once the input/collection elements actually mount.\n const [inputRef, setInputRef] = createSignal<HTMLInputElement>();\n const [collectionRef, setCollectionRef] = createSignal<HTMLElement>();\n\n // Create autocomplete aria\n const autocomplete = createAutocomplete<T>(\n {\n ...ariaProps,\n inputRef,\n collectionRef,\n },\n state,\n );\n\n // Input context value\n const inputContextValue = createMemo<AutocompleteContextValue>(() => ({\n inputProps: autocomplete.inputProps,\n inputRef: (el: HTMLInputElement) => {\n setInputRef(el);\n },\n }));\n\n // Collection context value\n const collectionContextValue = createMemo<AutocompleteCollectionContextValue>(() => ({\n collectionProps: autocomplete.collectionProps,\n collectionRef: (el: HTMLElement) => {\n setCollectionRef(el);\n },\n filter: autocomplete.filter as\n | ((nodeTextValue: string, node: CollectionNode<unknown>) => boolean)\n | undefined,\n }));\n\n return (\n <AutocompleteStateContext value={state}>\n <AutocompleteContext value={inputContextValue()}>\n <AutocompleteCollectionContext value={collectionContextValue()}>\n {props.children}\n </AutocompleteCollectionContext>\n </AutocompleteContext>\n </AutocompleteStateContext>\n );\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;AA2DA,MAAa,sBAAsB,cAA+C,IAAI;AACtF,MAAa,2BAA2B,cAAwC,IAAI;AACpF,MAAa,gCACX,cAAyD,IAAI;;;;;AAM/D,SAAgB,uBAAuB;CACrC,OAAO,WAAW,mBAAmB;AACvC;;;;AAKA,SAAgB,uBAAuB;CACrC,OAAO,WAAW,wBAAwB;AAC5C;;;;;AAMA,SAAgB,4BAA4B;CAC1C,OAAO,WAAW,6BAA6B;AACjD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAsCA,SAAgB,aAA0B,OAA0C;CAClF,MAAM,CAAC,YAAY,aAAa,WAC9B,OACA;EAAC;EAAc;EAAqB;CAAe,GACnD;EACE;EACA;EACA;EACA;EACA;CACF,CACF;CAEA,MAAM,QAAQ,wBAAwB,UAAU;CAKhD,MAAM,CAAC,UAAU,eAAe,aAA+B;CAC/D,MAAM,CAAC,eAAe,oBAAoB,aAA0B;CAGpE,MAAM,eAAe,mBACnB;EACE,GAAG;EACH;EACA;CACF,GACA,KACF;CAGA,MAAM,oBAAoB,kBAA4C;EACpE,YAAY,aAAa;EACzB,WAAW,OAAyB;GAClC,YAAY,EAAE;EAChB;CACF,EAAE;CAGF,MAAM,yBAAyB,kBAAsD;EACnF,iBAAiB,aAAa;EAC9B,gBAAgB,OAAoB;GAClC,iBAAiB,EAAE;EACrB;EACA,QAAQ,aAAa;CAGvB,EAAE;CAEF,OACE,CAAC,yBAAyB,OAAO,OAAO;MACtC,CAAC,oBAAoB,OAAO,kBAAkB,GAAG;QAC/C,CAAC,8BAA8B,OAAO,uBAAuB,GAAG;WAC7D,MAAM,SAAS;QAClB,EAAE,8BAA8B;MAClC,EAAE,oBAAoB;IACxB,EAAE;AAEN"}
|
package/dist/Breadcrumbs.d.ts
CHANGED
|
@@ -1,5 +1,11 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
/**
|
|
2
|
+
* Breadcrumbs component for solidaria-components
|
|
3
|
+
*
|
|
4
|
+
* A pre-wired headless breadcrumbs component that combines aria hooks.
|
|
5
|
+
* Port of react-aria-components Breadcrumbs.
|
|
6
|
+
*/
|
|
7
|
+
import { type Accessor } from "solid-js";
|
|
8
|
+
import { type JSX } from "@solidjs/web";
|
|
3
9
|
import { type AriaBreadcrumbsProps, type AriaBreadcrumbItemProps } from "@proyecto-viviana/solidaria";
|
|
4
10
|
import { type RenderChildren, type ClassNameOrFunction, type StyleOrFunction, type SlotProps } from "./utils";
|
|
5
11
|
type RefLike<T> = ((el: T) => void) | {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Breadcrumbs.d.ts","sourceRoot":"","sources":["../src/Breadcrumbs.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"Breadcrumbs.d.ts","sourceRoot":"","sources":["../src/Breadcrumbs.tsx"],"names":[],"mappings":"AAcA;;;;;GAKG;AAEH,OAAO,EAQL,KAAK,QAAQ,EACd,MAAM,UAAU,CAAC;AAClB,OAAO,EAA4B,KAAK,GAAG,EAAE,MAAM,cAAc,CAAC;AAGlE,OAAO,EAML,KAAK,oBAAoB,EACzB,KAAK,uBAAuB,EAE7B,MAAM,6BAA6B,CAAC;AAErC,OAAO,EACL,KAAK,cAAc,EACnB,KAAK,mBAAmB,EACxB,KAAK,eAAe,EACpB,KAAK,SAAS,EAKf,MAAM,SAAS,CAAC;AAEjB,KAAK,OAAO,CAAC,CAAC,IAAI,CAAC,CAAC,EAAE,EAAE,CAAC,KAAK,IAAI,CAAC,GAAG;IAAE,OAAO,CAAC,EAAE,CAAC,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