@proyecto-viviana/solidaria-components 0.5.1 → 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/LICENSE-APACHE-2.0 +201 -0
- package/NOTICE +91 -0
- package/README.md +57 -34
- package/dist/ActionBar.d.ts +2 -10
- package/dist/ActionBar.d.ts.map +1 -1
- package/dist/ActionBar.js +95 -59
- package/dist/ActionBar.js.map +1 -1
- package/dist/ActionBar.jsx +42 -15
- package/dist/ActionBar.jsx.map +1 -1
- package/dist/ActionGroup.d.ts +1 -12
- package/dist/ActionGroup.d.ts.map +1 -1
- package/dist/ActionGroup.js +66 -44
- package/dist/ActionGroup.js.map +1 -1
- package/dist/ActionGroup.jsx +25 -10
- package/dist/ActionGroup.jsx.map +1 -1
- package/dist/Alert.d.ts +4 -1
- package/dist/Alert.d.ts.map +1 -1
- package/dist/Alert.js +20 -17
- package/dist/Alert.js.map +1 -1
- package/dist/Alert.jsx +10 -6
- package/dist/Alert.jsx.map +1 -1
- package/dist/Autocomplete.d.ts +2 -9
- package/dist/Autocomplete.d.ts.map +1 -1
- package/dist/Autocomplete.js +19 -6
- package/dist/Autocomplete.js.map +1 -1
- package/dist/Autocomplete.jsx +21 -8
- package/dist/Autocomplete.jsx.map +1 -1
- package/dist/Breadcrumbs.d.ts +2 -1
- package/dist/Breadcrumbs.d.ts.map +1 -1
- package/dist/Breadcrumbs.js +152 -59
- package/dist/Breadcrumbs.js.map +1 -1
- package/dist/Breadcrumbs.jsx +99 -19
- package/dist/Breadcrumbs.jsx.map +1 -1
- package/dist/Button.d.ts +1 -7
- package/dist/Button.d.ts.map +1 -1
- package/dist/Button.js +144 -79
- package/dist/Button.js.map +1 -1
- package/dist/Button.jsx +124 -50
- package/dist/Button.jsx.map +1 -1
- package/dist/Calendar.d.ts +9 -7
- package/dist/Calendar.d.ts.map +1 -1
- package/dist/Calendar.js +321 -228
- package/dist/Calendar.js.map +1 -1
- package/dist/Calendar.jsx +74 -41
- package/dist/Calendar.jsx.map +1 -1
- package/dist/CalendarPicker.d.ts +1 -10
- package/dist/CalendarPicker.d.ts.map +1 -1
- package/dist/CalendarPicker.js +12 -0
- package/dist/CalendarPicker.js.map +1 -1
- package/dist/CalendarPicker.jsx +12 -0
- package/dist/CalendarPicker.jsx.map +1 -1
- package/dist/Checkbox.d.ts +3 -19
- package/dist/Checkbox.d.ts.map +1 -1
- package/dist/Checkbox.js +422 -317
- package/dist/Checkbox.js.map +1 -1
- package/dist/Checkbox.jsx +150 -131
- package/dist/Checkbox.jsx.map +1 -1
- package/dist/Collection.d.ts +152 -6
- package/dist/Collection.d.ts.map +1 -1
- package/dist/Collection.js +245 -78
- package/dist/Collection.js.map +1 -1
- package/dist/Collection.jsx +150 -12
- package/dist/Collection.jsx.map +1 -1
- package/dist/Color.d.ts +8 -572
- package/dist/Color.d.ts.map +1 -1
- package/dist/Color.js +8 -1717
- package/dist/Color.jsx +8 -1340
- 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 +3 -1
- package/dist/ColorEditor.d.ts.map +1 -1
- package/dist/ColorEditor.js +147 -125
- package/dist/ColorEditor.js.map +1 -1
- package/dist/ColorEditor.jsx +12 -6
- 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 +68 -32
- package/dist/ComboBox.d.ts.map +1 -1
- package/dist/ComboBox.js +564 -292
- package/dist/ComboBox.js.map +1 -1
- package/dist/ComboBox.jsx +235 -89
- package/dist/ComboBox.jsx.map +1 -1
- package/dist/ContextualHelpTrigger.d.ts +1 -7
- package/dist/ContextualHelpTrigger.d.ts.map +1 -1
- package/dist/ContextualHelpTrigger.js +104 -86
- package/dist/ContextualHelpTrigger.js.map +1 -1
- package/dist/ContextualHelpTrigger.jsx +38 -30
- package/dist/ContextualHelpTrigger.jsx.map +1 -1
- package/dist/DateField.d.ts +15 -9
- package/dist/DateField.d.ts.map +1 -1
- package/dist/DateField.js +0 -2
- package/dist/DateField.jsx +0 -2
- package/dist/DateField2.js +262 -196
- package/dist/DateField2.js.map +1 -1
- package/dist/DateField2.jsx +114 -74
- package/dist/DateField2.jsx.map +1 -1
- package/dist/DatePicker.d.ts +13 -34
- package/dist/DatePicker.d.ts.map +1 -1
- package/dist/DatePicker.js +3 -2
- package/dist/DatePicker.jsx +3 -2
- package/dist/DatePicker2.js +671 -512
- package/dist/DatePicker2.js.map +1 -1
- package/dist/DatePicker2.jsx +342 -222
- package/dist/DatePicker2.jsx.map +1 -1
- package/dist/DateRangePickerContext.d.ts +7 -0
- package/dist/DateRangePickerContext.d.ts.map +1 -1
- package/dist/Dialog.d.ts +6 -25
- package/dist/Dialog.d.ts.map +1 -1
- package/dist/Dialog.js +181 -232
- package/dist/Dialog.js.map +1 -1
- package/dist/Dialog.jsx +138 -98
- package/dist/Dialog.jsx.map +1 -1
- package/dist/Disclosure.d.ts +1 -9
- package/dist/Disclosure.d.ts.map +1 -1
- package/dist/Disclosure.js +167 -92
- package/dist/Disclosure.js.map +1 -1
- package/dist/Disclosure.jsx +62 -22
- package/dist/Disclosure.jsx.map +1 -1
- package/dist/DragAndDrop.d.ts +9 -6
- package/dist/DragAndDrop.d.ts.map +1 -1
- package/dist/DragAndDrop.js +40 -23
- package/dist/DragAndDrop.js.map +1 -1
- package/dist/DragAndDrop.jsx +23 -5
- package/dist/DragAndDrop.jsx.map +1 -1
- package/dist/DragPreview.d.ts +1 -1
- package/dist/DragPreview.d.ts.map +1 -1
- package/dist/DropZone.d.ts +4 -3
- package/dist/DropZone.d.ts.map +1 -1
- package/dist/DropZone.js +107 -57
- package/dist/DropZone.js.map +1 -1
- package/dist/DropZone.jsx +49 -13
- package/dist/DropZone.jsx.map +1 -1
- package/dist/ElementTag.d.ts +9 -20
- package/dist/ElementTag.d.ts.map +1 -1
- package/dist/ElementTag.js +8 -210
- package/dist/ElementTag.js.map +1 -1
- package/dist/ElementTag.jsx +8 -57
- package/dist/ElementTag.jsx.map +1 -1
- package/dist/FieldError.d.ts +8 -7
- package/dist/FieldError.d.ts.map +1 -1
- package/dist/FieldError.js +33 -13
- package/dist/FieldError.js.map +1 -1
- package/dist/FieldError.jsx +20 -5
- package/dist/FieldError.jsx.map +1 -1
- package/dist/FileTrigger.d.ts +1 -7
- package/dist/FileTrigger.d.ts.map +1 -1
- package/dist/FileTrigger.js +69 -17
- package/dist/FileTrigger.js.map +1 -1
- package/dist/FileTrigger.jsx +49 -3
- package/dist/FileTrigger.jsx.map +1 -1
- package/dist/Focusable.d.ts +2 -8
- package/dist/Focusable.d.ts.map +1 -1
- package/dist/Focusable.js +23 -6
- package/dist/Focusable.js.map +1 -1
- package/dist/Focusable.jsx +22 -5
- package/dist/Focusable.jsx.map +1 -1
- package/dist/Form.d.ts +9 -8
- package/dist/Form.d.ts.map +1 -1
- package/dist/Form.js +82 -42
- package/dist/Form.js.map +1 -1
- package/dist/Form.jsx +52 -17
- package/dist/Form.jsx.map +1 -1
- package/dist/GridList.d.ts +65 -37
- package/dist/GridList.d.ts.map +1 -1
- package/dist/GridList.js +512 -277
- package/dist/GridList.js.map +1 -1
- package/dist/GridList.jsx +307 -134
- 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/HiddenDateInput.d.ts +1 -7
- package/dist/HiddenDateInput.d.ts.map +1 -1
- package/dist/Icon.d.ts +4 -1
- package/dist/Icon.d.ts.map +1 -1
- package/dist/Icon.js +55 -38
- package/dist/Icon.js.map +1 -1
- package/dist/Icon.jsx +12 -4
- package/dist/Icon.jsx.map +1 -1
- package/dist/Keyboard.d.ts +1 -7
- package/dist/Keyboard.d.ts.map +1 -1
- package/dist/Keyboard.js +24 -11
- package/dist/Keyboard.js.map +1 -1
- package/dist/Keyboard.jsx +15 -2
- package/dist/Keyboard.jsx.map +1 -1
- package/dist/Label.d.ts +20 -0
- package/dist/Label.d.ts.map +1 -0
- package/dist/Label.js +60 -0
- package/dist/Label.js.map +1 -0
- package/dist/Label.jsx +47 -0
- package/dist/Label.jsx.map +1 -0
- package/dist/Landmark.d.ts +4 -1
- package/dist/Landmark.d.ts.map +1 -1
- package/dist/Landmark.js +10 -4
- package/dist/Landmark.js.map +1 -1
- package/dist/Landmark.jsx +5 -1
- package/dist/Landmark.jsx.map +1 -1
- package/dist/Link.d.ts +4 -7
- package/dist/Link.d.ts.map +1 -1
- package/dist/Link.js +80 -47
- package/dist/Link.js.map +1 -1
- package/dist/Link.jsx +76 -21
- package/dist/Link.jsx.map +1 -1
- package/dist/ListBox.d.ts +62 -33
- package/dist/ListBox.d.ts.map +1 -1
- package/dist/ListBox.js +858 -411
- package/dist/ListBox.js.map +1 -1
- package/dist/ListBox.jsx +478 -268
- package/dist/ListBox.jsx.map +1 -1
- package/dist/ListDropTargetDelegate.d.ts +3 -0
- package/dist/ListDropTargetDelegate.d.ts.map +1 -1
- package/dist/Menu.d.ts +51 -34
- package/dist/Menu.d.ts.map +1 -1
- package/dist/Menu.js +808 -427
- package/dist/Menu.js.map +1 -1
- package/dist/Menu.jsx +570 -296
- package/dist/Menu.jsx.map +1 -1
- package/dist/Meter.d.ts +6 -13
- package/dist/Meter.d.ts.map +1 -1
- package/dist/Meter.js +55 -18
- package/dist/Meter.js.map +1 -1
- package/dist/Meter.jsx +33 -8
- package/dist/Meter.jsx.map +1 -1
- package/dist/Modal.d.ts +1 -7
- package/dist/Modal.d.ts.map +1 -1
- package/dist/Modal.js +106 -74
- package/dist/Modal.js.map +1 -1
- package/dist/Modal.jsx +68 -57
- package/dist/Modal.jsx.map +1 -1
- package/dist/NumberField.d.ts +6 -9
- package/dist/NumberField.d.ts.map +1 -1
- package/dist/NumberField.js +344 -136
- package/dist/NumberField.js.map +1 -1
- package/dist/NumberField.jsx +194 -38
- package/dist/NumberField.jsx.map +1 -1
- package/dist/Popover.d.ts +21 -7
- package/dist/Popover.d.ts.map +1 -1
- package/dist/Popover.js +392 -192
- package/dist/Popover.js.map +1 -1
- package/dist/Popover.jsx +237 -93
- package/dist/Popover.jsx.map +1 -1
- package/dist/Pressable.d.ts +2 -8
- package/dist/Pressable.d.ts.map +1 -1
- package/dist/Pressable.js +23 -6
- package/dist/Pressable.js.map +1 -1
- package/dist/Pressable.jsx +22 -5
- package/dist/Pressable.jsx.map +1 -1
- package/dist/PreviewTrigger.d.ts +24 -0
- package/dist/PreviewTrigger.d.ts.map +1 -0
- package/dist/PreviewTrigger.js +128 -0
- package/dist/PreviewTrigger.js.map +1 -0
- package/dist/PreviewTrigger.jsx +117 -0
- package/dist/PreviewTrigger.jsx.map +1 -0
- package/dist/ProgressBar.d.ts +1 -7
- package/dist/ProgressBar.d.ts.map +1 -1
- package/dist/ProgressBar.js +49 -16
- package/dist/ProgressBar.js.map +1 -1
- package/dist/ProgressBar.jsx +30 -6
- package/dist/ProgressBar.jsx.map +1 -1
- package/dist/RadioGroup.d.ts +4 -20
- package/dist/RadioGroup.d.ts.map +1 -1
- package/dist/RadioGroup.js +459 -338
- package/dist/RadioGroup.js.map +1 -1
- package/dist/RadioGroup.jsx +186 -153
- package/dist/RadioGroup.jsx.map +1 -1
- package/dist/RangeCalendar.d.ts +11 -7
- package/dist/RangeCalendar.d.ts.map +1 -1
- package/dist/RangeCalendar.js +299 -208
- package/dist/RangeCalendar.js.map +1 -1
- package/dist/RangeCalendar.jsx +79 -47
- package/dist/RangeCalendar.jsx.map +1 -1
- package/dist/RouterProvider.d.ts +17 -69
- package/dist/RouterProvider.d.ts.map +1 -1
- package/dist/RouterProvider.js +12 -116
- package/dist/RouterProvider.jsx +12 -110
- package/dist/SearchField.d.ts +5 -8
- package/dist/SearchField.d.ts.map +1 -1
- package/dist/SearchField.js +212 -181
- package/dist/SearchField.js.map +1 -1
- package/dist/SearchField.jsx +94 -78
- package/dist/SearchField.jsx.map +1 -1
- package/dist/Select.d.ts +73 -36
- package/dist/Select.d.ts.map +1 -1
- package/dist/Select.js +700 -453
- package/dist/Select.js.map +1 -1
- package/dist/Select.jsx +356 -237
- package/dist/Select.jsx.map +1 -1
- package/dist/SelectionIndicator.d.ts +1 -4
- package/dist/SelectionIndicator.d.ts.map +1 -1
- package/dist/SelectionIndicator.js +29 -13
- package/dist/SelectionIndicator.js.map +1 -1
- package/dist/SelectionIndicator.jsx +18 -4
- package/dist/SelectionIndicator.jsx.map +1 -1
- package/dist/Separator.d.ts +3 -9
- package/dist/Separator.d.ts.map +1 -1
- package/dist/Separator.js +24 -12
- package/dist/Separator.js.map +1 -1
- package/dist/Separator.jsx +18 -9
- package/dist/Separator.jsx.map +1 -1
- package/dist/SharedElementTransition.d.ts +1 -10
- package/dist/SharedElementTransition.d.ts.map +1 -1
- package/dist/SharedElementTransition.js +68 -40
- package/dist/SharedElementTransition.js.map +1 -1
- package/dist/SharedElementTransition.jsx +49 -25
- package/dist/SharedElementTransition.jsx.map +1 -1
- package/dist/Slider.d.ts +25 -26
- package/dist/Slider.d.ts.map +1 -1
- package/dist/Slider.js +324 -167
- package/dist/Slider.js.map +1 -1
- package/dist/Slider.jsx +195 -93
- package/dist/Slider.jsx.map +1 -1
- package/dist/StepList.d.ts +2 -8
- package/dist/StepList.d.ts.map +1 -1
- package/dist/StepList.js +121 -75
- package/dist/StepList.js.map +1 -1
- package/dist/StepList.jsx +67 -27
- package/dist/StepList.jsx.map +1 -1
- package/dist/Switch.d.ts +17 -11
- package/dist/Switch.d.ts.map +1 -1
- package/dist/Switch.js +213 -128
- package/dist/Switch.js.map +1 -1
- package/dist/Switch.jsx +68 -31
- package/dist/Switch.jsx.map +1 -1
- package/dist/Table.d.ts +21 -2
- package/dist/Table.d.ts.map +1 -1
- package/dist/Table.js +938 -638
- package/dist/Table.js.map +1 -1
- package/dist/Table.jsx +537 -259
- package/dist/Table.jsx.map +1 -1
- package/dist/Tabs.d.ts +2 -7
- package/dist/Tabs.d.ts.map +1 -1
- package/dist/Tabs.js +322 -300
- package/dist/Tabs.js.map +1 -1
- package/dist/Tabs.jsx +106 -67
- package/dist/Tabs.jsx.map +1 -1
- package/dist/TagGroup.d.ts +32 -22
- package/dist/TagGroup.d.ts.map +1 -1
- package/dist/TagGroup.js +377 -136
- package/dist/TagGroup.js.map +1 -1
- package/dist/TagGroup.jsx +220 -53
- package/dist/TagGroup.jsx.map +1 -1
- package/dist/Text.d.ts +3 -3
- package/dist/Text.d.ts.map +1 -1
- package/dist/Text.js +38 -8
- package/dist/Text.js.map +1 -1
- package/dist/Text.jsx +27 -5
- package/dist/Text.jsx.map +1 -1
- package/dist/TextField.d.ts +4 -17
- package/dist/TextField.d.ts.map +1 -1
- package/dist/TextField.js +116 -142
- package/dist/TextField.js.map +1 -1
- package/dist/TextField.jsx +88 -115
- package/dist/TextField.jsx.map +1 -1
- package/dist/TimeField.d.ts +3 -16
- package/dist/TimeField.d.ts.map +1 -1
- package/dist/TimeField.js +121 -107
- package/dist/TimeField.js.map +1 -1
- package/dist/TimeField.jsx +67 -54
- package/dist/TimeField.jsx.map +1 -1
- package/dist/Toast.d.ts +27 -14
- package/dist/Toast.d.ts.map +1 -1
- package/dist/Toast.js +273 -113
- package/dist/Toast.js.map +1 -1
- package/dist/Toast.jsx +182 -32
- package/dist/Toast.jsx.map +1 -1
- package/dist/ToggleButton.d.ts +1 -7
- package/dist/ToggleButton.d.ts.map +1 -1
- package/dist/ToggleButton.js +75 -35
- package/dist/ToggleButton.js.map +1 -1
- package/dist/ToggleButton.jsx +39 -13
- package/dist/ToggleButton.jsx.map +1 -1
- package/dist/ToggleButtonGroup.d.ts +1 -7
- package/dist/ToggleButtonGroup.d.ts.map +1 -1
- package/dist/ToggleButtonGroup.js +59 -44
- package/dist/ToggleButtonGroup.js.map +1 -1
- package/dist/ToggleButtonGroup.jsx +25 -12
- package/dist/ToggleButtonGroup.jsx.map +1 -1
- package/dist/TokenField.d.ts +54 -0
- package/dist/TokenField.d.ts.map +1 -0
- package/dist/TokenField.js +374 -0
- package/dist/TokenField.js.map +1 -0
- package/dist/TokenField.jsx +272 -0
- package/dist/TokenField.jsx.map +1 -0
- package/dist/Toolbar.d.ts +2 -7
- package/dist/Toolbar.d.ts.map +1 -1
- package/dist/Toolbar.js +37 -22
- package/dist/Toolbar.js.map +1 -1
- package/dist/Toolbar.jsx +17 -8
- package/dist/Toolbar.jsx.map +1 -1
- package/dist/Tooltip.d.ts +2 -7
- package/dist/Tooltip.d.ts.map +1 -1
- package/dist/Tooltip.js +128 -78
- package/dist/Tooltip.js.map +1 -1
- package/dist/Tooltip.jsx +83 -46
- package/dist/Tooltip.jsx.map +1 -1
- package/dist/Tree.d.ts +85 -39
- package/dist/Tree.d.ts.map +1 -1
- package/dist/Tree.js +926 -414
- package/dist/Tree.js.map +1 -1
- package/dist/Tree.jsx +450 -195
- package/dist/Tree.jsx.map +1 -1
- package/dist/Virtualizer.d.ts +41 -10
- package/dist/Virtualizer.d.ts.map +1 -1
- package/dist/Virtualizer.js +2 -2
- package/dist/Virtualizer.jsx +2 -2
- package/dist/Virtualizer2.js +554 -144
- package/dist/Virtualizer2.js.map +1 -1
- package/dist/Virtualizer2.jsx +516 -124
- package/dist/Virtualizer2.jsx.map +1 -1
- package/dist/VirtualizerLayouts.d.ts +55 -2
- package/dist/VirtualizerLayouts.d.ts.map +1 -1
- package/dist/VisuallyHidden.d.ts +4 -3
- package/dist/VisuallyHidden.d.ts.map +1 -1
- package/dist/VisuallyHidden.js +18 -11
- package/dist/VisuallyHidden.js.map +1 -1
- package/dist/VisuallyHidden.jsx +15 -9
- package/dist/VisuallyHidden.jsx.map +1 -1
- package/dist/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 +31 -1
- package/dist/contexts.d.ts.map +1 -1
- package/dist/contexts.js +9 -1
- package/dist/contexts.js.map +1 -1
- package/dist/contexts.jsx +9 -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 +27 -15
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +30 -18
- package/dist/index.jsx +30 -18
- package/dist/intl/index.d.ts +16 -0
- package/dist/intl/index.d.ts.map +1 -0
- package/dist/intl.js +212 -0
- package/dist/intl.js.map +1 -0
- package/dist/intl.jsx +212 -0
- package/dist/intl.jsx.map +1 -0
- package/dist/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 +6 -2
- package/dist/useDragAndDrop.d.ts.map +1 -1
- package/dist/useDragAndDrop2.js +39 -21
- package/dist/useDragAndDrop2.js.map +1 -1
- package/dist/useDragAndDrop2.jsx +39 -21
- package/dist/useDragAndDrop2.jsx.map +1 -1
- package/dist/utils.d.ts +49 -9
- package/dist/utils.d.ts.map +1 -1
- package/dist/utils.js +119 -24
- package/dist/utils.js.map +1 -1
- package/dist/utils.jsx +110 -24
- package/dist/utils.jsx.map +1 -1
- package/dist/virtualizer/Layout.d.ts +12 -2
- package/dist/virtualizer/Layout.d.ts.map +1 -1
- package/dist/virtualizer/Layout.js +23 -2
- package/dist/virtualizer/Layout.js.map +1 -1
- package/dist/virtualizer/Layout.jsx +23 -2
- package/dist/virtualizer/Layout.jsx.map +1 -1
- package/package.json +87 -10
- package/src/ActionBar.tsx +50 -24
- package/src/ActionGroup.tsx +30 -19
- package/src/Alert.tsx +12 -7
- package/src/Autocomplete.tsx +25 -16
- package/src/Breadcrumbs.tsx +139 -24
- package/src/Button.tsx +214 -76
- package/src/Calendar.tsx +120 -61
- package/src/CalendarPicker.tsx +16 -1
- package/src/Checkbox.tsx +205 -227
- package/src/Collection.tsx +334 -12
- package/src/Color.tsx +8 -2454
- package/src/ColorArea.tsx +479 -0
- package/src/ColorEditor.tsx +9 -9
- 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 +471 -173
- package/src/ContextualHelpTrigger.tsx +49 -65
- package/src/DateField.tsx +174 -131
- package/src/DatePicker.tsx +501 -376
- package/src/DateRangePickerContext.tsx +8 -0
- package/src/Dialog.tsx +224 -162
- package/src/Disclosure.tsx +85 -34
- package/src/DragAndDrop.tsx +51 -9
- package/src/DragPreview.tsx +20 -1
- package/src/DropZone.tsx +77 -42
- package/src/ElementTag.tsx +14 -104
- package/src/FieldError.tsx +39 -7
- package/src/FileTrigger.tsx +71 -4
- package/src/Focusable.tsx +27 -11
- package/src/Form.tsx +64 -15
- package/src/GridList.tsx +478 -214
- package/src/Heading.tsx +59 -0
- package/src/HiddenDateInput.tsx +19 -3
- package/src/Icon.tsx +19 -4
- package/src/Keyboard.tsx +18 -2
- package/src/Label.tsx +77 -0
- package/src/Landmark.tsx +6 -1
- package/src/Link.tsx +103 -30
- package/src/ListBox.tsx +924 -530
- package/src/ListDropTargetDelegate.ts +4 -0
- package/src/Menu.tsx +883 -465
- package/src/Meter.tsx +42 -8
- package/src/Modal.tsx +89 -80
- package/src/NumberField.tsx +267 -66
- package/src/Popover.tsx +454 -156
- package/src/Pressable.tsx +27 -11
- package/src/PreviewTrigger.tsx +171 -0
- package/src/ProgressBar.tsx +41 -5
- package/src/RadioGroup.tsx +358 -278
- package/src/RangeCalendar.tsx +130 -77
- package/src/RouterProvider.tsx +33 -215
- package/src/SearchField.tsx +157 -136
- package/src/Select.tsx +689 -453
- package/src/SelectionIndicator.tsx +21 -3
- package/src/Separator.tsx +22 -14
- package/src/SharedElementTransition.tsx +67 -46
- package/src/Slider.tsx +296 -120
- package/src/StepList.tsx +88 -38
- package/src/Switch.tsx +127 -51
- package/src/Table.tsx +842 -479
- package/src/Tabs.tsx +186 -156
- package/src/TagGroup.tsx +377 -90
- package/src/Text.tsx +39 -7
- package/src/TextField.tsx +136 -173
- package/src/TimeField.tsx +90 -93
- package/src/Toast.tsx +238 -82
- package/src/ToggleButton.tsx +60 -17
- package/src/ToggleButtonGroup.tsx +27 -9
- package/src/TokenField.tsx +502 -0
- package/src/Toolbar.tsx +21 -17
- package/src/Tooltip.tsx +157 -99
- package/src/Tree.tsx +888 -360
- package/src/Virtualizer.tsx +501 -148
- package/src/VirtualizerLayouts.ts +211 -26
- package/src/VisuallyHidden.tsx +22 -8
- package/src/calendarHeadingTitle.ts +37 -0
- package/src/contexts.ts +23 -1
- package/src/fileTriggerContext.ts +8 -0
- package/src/index.ts +98 -22
- package/src/intl/ar-AE.json +6 -0
- package/src/intl/bg-BG.json +6 -0
- package/src/intl/cs-CZ.json +6 -0
- package/src/intl/da-DK.json +6 -0
- package/src/intl/de-DE.json +6 -0
- package/src/intl/el-GR.json +6 -0
- package/src/intl/en-US.json +6 -0
- package/src/intl/es-ES.json +6 -0
- package/src/intl/et-EE.json +6 -0
- package/src/intl/fi-FI.json +6 -0
- package/src/intl/fr-FR.json +6 -0
- package/src/intl/he-IL.json +6 -0
- package/src/intl/hr-HR.json +6 -0
- package/src/intl/hu-HU.json +6 -0
- package/src/intl/index.ts +125 -0
- package/src/intl/it-IT.json +6 -0
- package/src/intl/ja-JP.json +6 -0
- package/src/intl/ko-KR.json +6 -0
- package/src/intl/lt-LT.json +6 -0
- package/src/intl/lv-LV.json +6 -0
- package/src/intl/nb-NO.json +6 -0
- package/src/intl/nl-NL.json +6 -0
- package/src/intl/pl-PL.json +6 -0
- package/src/intl/pt-BR.json +6 -0
- package/src/intl/pt-PT.json +6 -0
- package/src/intl/ro-RO.json +6 -0
- package/src/intl/ru-RU.json +6 -0
- package/src/intl/sk-SK.json +6 -0
- package/src/intl/sl-SI.json +6 -0
- package/src/intl/sr-SP.json +6 -0
- package/src/intl/sv-SE.json +6 -0
- package/src/intl/tr-TR.json +6 -0
- package/src/intl/uk-UA.json +6 -0
- package/src/intl/zh-CN.json +6 -0
- package/src/intl/zh-TW.json +6 -0
- package/src/loadMoreSentinel.ts +31 -0
- package/src/slots.tsx +103 -0
- package/src/staticSelectCollection.tsx +25 -0
- package/src/useDragAndDrop.ts +35 -33
- package/src/utils.tsx +178 -67
- package/src/virtualizer/Layout.ts +32 -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/dist/ActionGroup.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ActionGroup.js","names":["JSX","ParentProps","createContext","createMemo","splitProps","useContext","For","createActionGroup","createActionGroupItem","AriaActionGroupProps","createListState","ListState","Key","SelectionMode","ClassNameOrFunction","StyleOrFunction","SlotProps","useRenderProps","filterDOMProps","ActionGroupRenderProps","orientation","isDisabled","selectionMode","ActionGroupItemRenderProps","isSelected","isFocused","ActionGroupItem","id","label","key","ActionGroupProps","items","T","selectedKeys","Iterable","defaultSelectedKeys","onSelectionChange","keys","Set","onAction","disabledKeys","children","item","renderProps","Element","class","style","ActionGroupContextValue","state","ActionGroupContext","ActionGroupStateContext","ActionGroup","props","local","ariaGroupProps","domProps","getKey","getTextValue","getDisabled","groupAriaProps","aria-label","aria-labelledby","actionGroupProps","undefined","defaultClassName","filteredDOMProps","Record","global","_$createComponent","Provider","value","_el$","_$getNextElement","_tmpl$","_$use","el","HTMLDivElement","refFn","ref","HTMLElement","_$spread","_$mergeProps","slot","data-orientation","data-disabled","_$insert","each","ActionGroupItemWrapper","renderChild","rp","_$runHydrationEvents","ActionGroupItemWrapperProps","buttonProps","focusedKey","has","restButtonProps","_el$2","_tmpl$2","data-selected","data-focused","useActionGroupContext"],"sources":["../src/ActionGroup.tsx"],"sourcesContent":["/**\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 * No RAC equivalent exists — this bridges solidaria ARIA hooks\n * directly to a headless component.\n */\n\nimport {\n type JSX,\n type ParentProps,\n createContext,\n createMemo,\n splitProps,\n useContext,\n For,\n} from \"solid-js\";\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 {\n type ClassNameOrFunction,\n type StyleOrFunction,\n type SlotProps,\n useRenderProps,\n filterDOMProps,\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.Provider value={{ state: state as ListState<ActionGroupItem> }}>\n <ActionGroupStateContext.Provider 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={local.isDisabled || undefined}\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.Provider>\n </ActionGroupContext.Provider>\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={isSelected() || undefined}\n data-disabled={isDisabled() || undefined}\n data-focused={isFocused() || undefined}\n >\n {props.renderChild(props.item, renderProps())}\n </button>\n );\n}\n\nexport function useActionGroupContext(): ActionGroupContextValue | null {\n return useContext(ActionGroupContext);\n}\n"],"mappings":"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"}
|
|
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":"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"}
|
package/dist/ActionGroup.jsx
CHANGED
|
@@ -1,6 +1,20 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
/*
|
|
2
|
+
* Copyright 2020 Adobe. All rights reserved.
|
|
3
|
+
* This file is licensed to you under the Apache License, Version 2.0 (the "License");
|
|
4
|
+
* you may not use this file except in compliance with the License. You may obtain a copy
|
|
5
|
+
* of the License at http://www.apache.org/licenses/LICENSE-2.0
|
|
6
|
+
*
|
|
7
|
+
* Unless required by applicable law or agreed to in writing, software distributed under
|
|
8
|
+
* the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
|
|
9
|
+
* OF ANY KIND, either express or implied. See the License for the specific language
|
|
10
|
+
* governing permissions and limitations under the License.
|
|
11
|
+
*/
|
|
12
|
+
// Ported to SolidJS for Proyecto Viviana; based on packages/react-aria/src/actiongroup/useActionGroup.ts
|
|
13
|
+
// Ported to SolidJS for Proyecto Viviana; based on packages/react-aria/src/actiongroup/useActionGroupItem.ts
|
|
14
|
+
import { dataAttr, filterDOMProps, useRenderProps } from "./utils.jsx";
|
|
15
|
+
import { For, createContext, createMemo, useContext } from "solid-js";
|
|
3
16
|
import { createActionGroup, createActionGroupItem } from "@proyecto-viviana/solidaria";
|
|
17
|
+
import { splitProps } from "@proyecto-viviana/solidaria/utils";
|
|
4
18
|
import { createListState } from "@proyecto-viviana/solid-stately";
|
|
5
19
|
//#region src/ActionGroup.tsx
|
|
6
20
|
/**
|
|
@@ -11,8 +25,9 @@ import { createListState } from "@proyecto-viviana/solid-stately";
|
|
|
11
25
|
* Provides proper dynamic roles (toolbar/radiogroup), keyboard
|
|
12
26
|
* navigation, and ARIA attributes.
|
|
13
27
|
*
|
|
14
|
-
*
|
|
15
|
-
*
|
|
28
|
+
* Based on packages/react-aria/src/actiongroup/useActionGroup.ts and
|
|
29
|
+
* packages/react-aria/src/actiongroup/useActionGroupItem.ts. React Aria
|
|
30
|
+
* Components has no ActionGroup component, so this file wires the two hooks.
|
|
16
31
|
*/
|
|
17
32
|
const ActionGroupContext = createContext(null);
|
|
18
33
|
const ActionGroupStateContext = createContext(null);
|
|
@@ -87,18 +102,18 @@ function ActionGroup(props) {
|
|
|
87
102
|
selectionMode: local.selectionMode ?? "none"
|
|
88
103
|
}));
|
|
89
104
|
const filteredDOMProps = createMemo(() => filterDOMProps(domProps, { global: true }));
|
|
90
|
-
return <ActionGroupContext
|
|
91
|
-
<ActionGroupStateContext
|
|
105
|
+
return <ActionGroupContext value={{ state }}>
|
|
106
|
+
<ActionGroupStateContext value={state}>
|
|
92
107
|
<div {...filteredDOMProps()} {...actionGroupProps} ref={(el) => {
|
|
93
108
|
const refFn = actionGroupProps.ref;
|
|
94
109
|
refFn?.(el);
|
|
95
|
-
}} class={renderProps.class()} style={renderProps.style()} slot={local.slot} data-orientation={orientation()} data-disabled={local.isDisabled
|
|
110
|
+
}} class={renderProps.class()} style={renderProps.style()} slot={local.slot} data-orientation={orientation()} data-disabled={dataAttr(local.isDisabled)}>
|
|
96
111
|
<For each={local.items}>
|
|
97
112
|
{(item) => <ActionGroupItemWrapper item={item} state={state} renderChild={local.children} />}
|
|
98
113
|
</For>
|
|
99
114
|
</div>
|
|
100
|
-
</ActionGroupStateContext
|
|
101
|
-
</ActionGroupContext
|
|
115
|
+
</ActionGroupStateContext>
|
|
116
|
+
</ActionGroupContext>;
|
|
102
117
|
}
|
|
103
118
|
function ActionGroupItemWrapper(props) {
|
|
104
119
|
const { buttonProps } = createActionGroupItem({ get key() {
|
|
@@ -116,7 +131,7 @@ function ActionGroupItemWrapper(props) {
|
|
|
116
131
|
isFocused: isFocused()
|
|
117
132
|
}));
|
|
118
133
|
const [, restButtonProps] = splitProps(buttonProps, ["ref"]);
|
|
119
|
-
return <button {...restButtonProps} data-selected={isSelected()
|
|
134
|
+
return <button {...restButtonProps} data-selected={dataAttr(isSelected())} data-disabled={dataAttr(isDisabled())} data-focused={dataAttr(isFocused())}>
|
|
120
135
|
{props.renderChild(props.item, renderProps())}
|
|
121
136
|
</button>;
|
|
122
137
|
}
|
package/dist/ActionGroup.jsx.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ActionGroup.jsx","names":[],"sources":["../src/ActionGroup.tsx"],"sourcesContent":["/**\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 * No RAC equivalent exists — this bridges solidaria ARIA hooks\n * directly to a headless component.\n */\n\nimport {\n type JSX,\n type ParentProps,\n createContext,\n createMemo,\n splitProps,\n useContext,\n For,\n} from \"solid-js\";\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 {\n type ClassNameOrFunction,\n type StyleOrFunction,\n type SlotProps,\n useRenderProps,\n filterDOMProps,\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.Provider value={{ state: state as ListState<ActionGroupItem> }}>\n <ActionGroupStateContext.Provider 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={local.isDisabled || undefined}\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.Provider>\n </ActionGroupContext.Provider>\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={isSelected() || undefined}\n data-disabled={isDisabled() || undefined}\n data-focused={isFocused() || undefined}\n >\n {props.renderChild(props.item, renderProps())}\n </button>\n );\n}\n\nexport function useActionGroupContext(): ActionGroupContextValue | null {\n return useContext(ActionGroupContext);\n}\n"],"mappings":"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"}
|
|
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;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,kBAAkB;EApB7C,IAAI,QAAQ;GACV,OAAO,MAAM;EACf;EACA,IAAI,aAAa;GACf,OAAO,MAAM;EACf;EACA,IAAI,cAAc;GAChB,OAAO,MAAM;EACf;EACA,IAAI,eAAe;GACjB,OAAO,eAAe;EACxB;EACA,IAAI,oBAAoB;GACtB,OAAO,eAAe;EACxB;EACA,IAAI,WAAW;GACb,OAAO,MAAM;EACf;CAG0D,GAAG,KAAqB;CAEpF,MAAM,oBAAoB,MAAM,eAAe;CAE/C,MAAM,cAAc,eAClB;EACE,UAAU,KAAA;EACV,OAAO,MAAM;EACb,OAAO,MAAM;EACb,kBAAkB;CACpB,UACO;EACL,aAAa,YAAY;EACzB,YAAY,CAAC,CAAC,MAAM;EACpB,eAAgB,MAAM,iBAAiB;CACzC,EACF;CAEA,MAAM,mBAAmB,iBACvB,eAAe,UAAqC,EAAE,QAAQ,KAAK,CAAC,CACtE;CAEA,OACE,CAAC,mBAAmB,OAAO,EAAS,MAAoC,GAAG;MACzE,CAAC,wBAAwB,OAAO,OAAqC;QACnE,CAAC,QACK,iBAAiB,OACjB,kBACJ,MAAM,OAAuB;EAC3B,MAAM,QAAS,iBAAyD;EACxE,QAAQ,EAAE;CACZ,GACA,OAAO,YAAY,MAAM,GACzB,OAAO,YAAY,MAAM,GACzB,MAAM,MAAM,MACZ,kBAAkB,YAAY,GAC9B,eAAe,SAAS,MAAM,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"}
|
package/dist/Alert.d.ts
CHANGED
|
@@ -4,8 +4,11 @@
|
|
|
4
4
|
* Minimal headless Alert that owns ARIA semantics (role="alert")
|
|
5
5
|
* and provides render props for styling. The UI layer consumes this
|
|
6
6
|
* for styling/composition only.
|
|
7
|
+
*
|
|
8
|
+
* This is a local Solid component. The pinned React Aria Components source
|
|
9
|
+
* has no Alert counterpart.
|
|
7
10
|
*/
|
|
8
|
-
import {
|
|
11
|
+
import type { JSX } from "@solidjs/web";
|
|
9
12
|
import { type RenderChildren, type ClassNameOrFunction, type StyleOrFunction, type SlotProps } from "./utils";
|
|
10
13
|
import { type ButtonProps } from "./Button";
|
|
11
14
|
export type AlertVariant = "info" | "success" | "warning" | "error";
|
package/dist/Alert.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Alert.d.ts","sourceRoot":"","sources":["../src/Alert.tsx"],"names":[],"mappings":"AAAA
|
|
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,EAIf,MAAM,SAAS,CAAC;AACjB,OAAO,EAAU,KAAK,WAAW,EAAE,MAAM,UAAU,CAAC;AAGpD,MAAM,MAAM,YAAY,GAAG,MAAM,GAAG,SAAS,GAAG,SAAS,GAAG,OAAO,CAAC;AAEpE,MAAM,WAAW,gBAAgB;IAC/B,gCAAgC;IAChC,OAAO,EAAE,YAAY,CAAC;IACtB,0CAA0C;IAC1C,aAAa,EAAE,OAAO,CAAC;CACxB;AAED,MAAM,WAAW,UAAW,SAAQ,SAAS;IAC3C,gCAAgC;IAChC,OAAO,CAAC,EAAE,YAAY,CAAC;IACvB,0CAA0C;IAC1C,aAAa,CAAC,EAAE,OAAO,CAAC;IACxB,kDAAkD;IAClD,SAAS,CAAC,EAAE,MAAM,IAAI,CAAC;IACvB,yFAAyF;IACzF,QAAQ,CAAC,EAAE,cAAc,CAAC,gBAAgB,CAAC,CAAC;IAC5C,yCAAyC;IACzC,KAAK,CAAC,EAAE,mBAAmB,CAAC,gBAAgB,CAAC,CAAC;IAC9C,wCAAwC;IACxC,KAAK,CAAC,EAAE,eAAe,CAAC,gBAAgB,CAAC,CAAC;IAC1C,6BAA6B;IAC7B,EAAE,CAAC,EAAE,MAAM,CAAC;CACb;AAED,MAAM,WAAW,iBAAiB;IAChC,OAAO,EAAE,MAAM,YAAY,CAAC;IAC5B,aAAa,EAAE,MAAM,OAAO,CAAC;IAC7B,SAAS,CAAC,EAAE,MAAM,IAAI,CAAC;CACxB;AAED,eAAO,MAAM,YAAY,sDAAgD,CAAC;AAE1E;;;;;;;;;;;;;GAaG;AACH,wBAAgB,KAAK,CAAC,KAAK,EAAE,UAAU,GAAG,GAAG,CAAC,OAAO,CAyDpD;AAED,MAAM,WAAW,uBAAwB,SAAQ,IAAI,CAAC,WAAW,EAAE,SAAS,CAAC;CAAG;AAEhF;;;;;;;;;;;GAWG;AACH,wBAAgB,kBAAkB,CAAC,KAAK,EAAE,uBAAuB,GAAG,GAAG,CAAC,OAAO,CAU9E"}
|
package/dist/Alert.js
CHANGED
|
@@ -1,7 +1,8 @@
|
|
|
1
|
-
import { filterDOMProps } from "./utils.js";
|
|
1
|
+
import { dataAttr, evaluateRenderChildren, filterDOMProps } from "./utils.js";
|
|
2
2
|
import { Button } from "./Button.js";
|
|
3
|
-
import { createComponent, getNextElement, insert,
|
|
4
|
-
import { createContext, createMemo,
|
|
3
|
+
import { createComponent, getNextElement, insert, mergeProps, runHydrationEvents, scope, spread, template } from "@solidjs/web";
|
|
4
|
+
import { createContext, createMemo, useContext } from "solid-js";
|
|
5
|
+
import { splitProps } from "@proyecto-viviana/solidaria/utils";
|
|
5
6
|
//#region src/Alert.tsx
|
|
6
7
|
/**
|
|
7
8
|
* Alert component for solidaria-components
|
|
@@ -9,8 +10,11 @@ import { createContext, createMemo, splitProps, useContext } from "solid-js";
|
|
|
9
10
|
* Minimal headless Alert that owns ARIA semantics (role="alert")
|
|
10
11
|
* and provides render props for styling. The UI layer consumes this
|
|
11
12
|
* for styling/composition only.
|
|
13
|
+
*
|
|
14
|
+
* This is a local Solid component. The pinned React Aria Components source
|
|
15
|
+
* has no Alert counterpart.
|
|
12
16
|
*/
|
|
13
|
-
var _tmpl$ =
|
|
17
|
+
var _tmpl$ = /* @__PURE__ */ template(`<div>`);
|
|
14
18
|
const AlertContext = createContext(null);
|
|
15
19
|
/**
|
|
16
20
|
* An alert displays a brief, important message in a way that
|
|
@@ -56,29 +60,28 @@ function Alert(props) {
|
|
|
56
60
|
isDismissible,
|
|
57
61
|
onDismiss: local.onDismiss
|
|
58
62
|
};
|
|
59
|
-
return createComponent(AlertContext
|
|
63
|
+
return createComponent(AlertContext, {
|
|
60
64
|
value: contextValue,
|
|
61
65
|
get children() {
|
|
62
66
|
var _el$ = getNextElement(_tmpl$);
|
|
63
|
-
spread(_el$,
|
|
64
|
-
|
|
65
|
-
get
|
|
67
|
+
spread(_el$, [domProps, {
|
|
68
|
+
role: "alert",
|
|
69
|
+
get "class"() {
|
|
66
70
|
return computedClass();
|
|
67
71
|
},
|
|
68
72
|
get style() {
|
|
69
73
|
return computedStyle();
|
|
70
74
|
},
|
|
71
|
-
get
|
|
75
|
+
get "data-variant"() {
|
|
72
76
|
return variant();
|
|
73
77
|
},
|
|
74
|
-
get
|
|
75
|
-
return isDismissible()
|
|
78
|
+
get "data-dismissible"() {
|
|
79
|
+
return dataAttr(isDismissible());
|
|
76
80
|
}
|
|
77
|
-
}
|
|
78
|
-
insert(_el$, (() => {
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
})());
|
|
81
|
+
}], true);
|
|
82
|
+
insert(_el$, scope(() => {
|
|
83
|
+
return evaluateRenderChildren(local.children, renderValues());
|
|
84
|
+
}));
|
|
82
85
|
runHydrationEvents();
|
|
83
86
|
return _el$;
|
|
84
87
|
}
|
|
@@ -99,7 +102,7 @@ function Alert(props) {
|
|
|
99
102
|
function AlertDismissButton(props) {
|
|
100
103
|
const context = useContext(AlertContext);
|
|
101
104
|
return createComponent(Button, mergeProps(props, {
|
|
102
|
-
get
|
|
105
|
+
get "aria-label"() {
|
|
103
106
|
return props["aria-label"] ?? "Dismiss";
|
|
104
107
|
},
|
|
105
108
|
onPress: () => context?.onDismiss?.()
|
package/dist/Alert.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Alert.js","names":["
|
|
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,6 +1,7 @@
|
|
|
1
|
-
import { filterDOMProps } from "./utils.jsx";
|
|
1
|
+
import { dataAttr, evaluateRenderChildren, filterDOMProps } from "./utils.jsx";
|
|
2
2
|
import { Button } from "./Button.jsx";
|
|
3
|
-
import { createContext, createMemo,
|
|
3
|
+
import { createContext, createMemo, useContext } from "solid-js";
|
|
4
|
+
import { splitProps } from "@proyecto-viviana/solidaria/utils";
|
|
4
5
|
//#region src/Alert.tsx
|
|
5
6
|
/**
|
|
6
7
|
* Alert component for solidaria-components
|
|
@@ -8,6 +9,9 @@ import { createContext, createMemo, splitProps, useContext } from "solid-js";
|
|
|
8
9
|
* Minimal headless Alert that owns ARIA semantics (role="alert")
|
|
9
10
|
* and provides render props for styling. The UI layer consumes this
|
|
10
11
|
* for styling/composition only.
|
|
12
|
+
*
|
|
13
|
+
* This is a local Solid component. The pinned React Aria Components source
|
|
14
|
+
* has no Alert counterpart.
|
|
11
15
|
*/
|
|
12
16
|
const AlertContext = createContext(null);
|
|
13
17
|
/**
|
|
@@ -54,11 +58,11 @@ function Alert(props) {
|
|
|
54
58
|
isDismissible,
|
|
55
59
|
onDismiss: local.onDismiss
|
|
56
60
|
};
|
|
57
|
-
return <AlertContext
|
|
58
|
-
<div {...domProps()} role="alert" class={computedClass()} style={computedStyle()} data-variant={variant()} data-dismissible={isDismissible()
|
|
59
|
-
{
|
|
61
|
+
return <AlertContext value={contextValue}>
|
|
62
|
+
<div {...domProps()} role="alert" class={computedClass()} style={computedStyle()} data-variant={variant()} data-dismissible={dataAttr(isDismissible())}>
|
|
63
|
+
{evaluateRenderChildren(local.children, renderValues())}
|
|
60
64
|
</div>
|
|
61
|
-
</AlertContext
|
|
65
|
+
</AlertContext>;
|
|
62
66
|
}
|
|
63
67
|
/**
|
|
64
68
|
* A dismiss button for use inside an Alert.
|
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\nimport {
|
|
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.d.ts
CHANGED
|
@@ -1,12 +1,5 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
*
|
|
4
|
-
* Provides autocomplete functionality by wrapping a text input
|
|
5
|
-
* with a filterable collection (ListBox/Menu).
|
|
6
|
-
*
|
|
7
|
-
* Port of react-aria-components/src/Autocomplete.tsx
|
|
8
|
-
*/
|
|
9
|
-
import { type JSX, type ParentProps } from "solid-js";
|
|
1
|
+
import type { ParentProps } from "solid-js";
|
|
2
|
+
import type { JSX } from "@solidjs/web";
|
|
10
3
|
import { type AriaAutocompleteOptions, type AutocompleteInputProps, type CollectionOptions } from "@proyecto-viviana/solidaria";
|
|
11
4
|
import { type AutocompleteState, type AutocompleteStateOptions, type CollectionNode } from "@proyecto-viviana/solid-stately";
|
|
12
5
|
import { type SlotProps } from "./utils";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Autocomplete.d.ts","sourceRoot":"","sources":["../src/Autocomplete.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"Autocomplete.d.ts","sourceRoot":"","sources":["../src/Autocomplete.tsx"],"names":[],"mappings":"AAwBA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,UAAU,CAAC;AAC5C,OAAO,KAAK,EAAE,GAAG,EAAE,MAAM,cAAc,CAAC;AACxC,OAAO,EAEL,KAAK,uBAAuB,EAC5B,KAAK,sBAAsB,EAC3B,KAAK,iBAAiB,EACvB,MAAM,6BAA6B,CAAC;AACrC,OAAO,EAEL,KAAK,iBAAiB,EACtB,KAAK,wBAAwB,EAC7B,KAAK,cAAc,EACpB,MAAM,iCAAiC,CAAC;AACzC,OAAO,EAAE,KAAK,SAAS,EAAE,MAAM,SAAS,CAAC;AAGzC,MAAM,WAAW,iBAAiB,CAAC,CAAC,GAAG,OAAO,CAC5C,SACE,IAAI,CAAC,wBAAwB,EAAE,UAAU,CAAC,EAC1C,IAAI,CAAC,uBAAuB,CAAC,CAAC,CAAC,EAAE,UAAU,GAAG,eAAe,CAAC,EAC9D,WAAW,EACX,SAAS;CAAG;AAEhB,MAAM,WAAW,wBAAwB;IACvC,UAAU,EAAE,sBAAsB,CAAC;IACnC,QAAQ,EAAE,CAAC,EAAE,EAAE,gBAAgB,KAAK,IAAI,CAAC;CAC1C;AAED,MAAM,WAAW,kCAAkC;IACjD,eAAe,EAAE,iBAAiB,CAAC;IACnC,aAAa,EAAE,CAAC,EAAE,EAAE,WAAW,KAAK,IAAI,CAAC;IACzC,MAAM,CAAC,EAAE,CAAC,aAAa,EAAE,MAAM,EAAE,IAAI,EAAE,cAAc,CAAC,OAAO,CAAC,KAAK,OAAO,CAAC;CAC5E;AAED,eAAO,MAAM,mBAAmB,6DAAuD,CAAC;AACxF,eAAO,MAAM,wBAAwB,sDAAgD,CAAC;AACtF,eAAO,MAAM,6BAA6B,uEACsB,CAAC;AAEjE;;;GAGG;AACH,wBAAgB,oBAAoB,oCAEnC;AAED;;GAEG;AACH,wBAAgB,oBAAoB,6BAEnC;AAED;;;GAGG;AACH,wBAAgB,yBAAyB,8CAExC;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAmCG;AACH,wBAAgB,YAAY,CAAC,CAAC,GAAG,OAAO,EAAE,KAAK,EAAE,iBAAiB,CAAC,CAAC,CAAC,GAAG,GAAG,CAAC,OAAO,CA2DlF"}
|
package/dist/Autocomplete.js
CHANGED
|
@@ -1,6 +1,19 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
/*
|
|
2
|
+
* Copyright 2024 Adobe. All rights reserved.
|
|
3
|
+
* This file is licensed to you under the Apache License, Version 2.0 (the "License");
|
|
4
|
+
* you may not use this file except in compliance with the License. You may obtain a copy
|
|
5
|
+
* of the License at http://www.apache.org/licenses/LICENSE-2.0
|
|
6
|
+
*
|
|
7
|
+
* Unless required by applicable law or agreed to in writing, software distributed under
|
|
8
|
+
* the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
|
|
9
|
+
* OF ANY KIND, either express or implied. See the License for the specific language
|
|
10
|
+
* governing permissions and limitations under the License.
|
|
11
|
+
*/
|
|
12
|
+
// Ported to SolidJS for Proyecto Viviana; based on packages/react-aria-components/src/Autocomplete.tsx
|
|
13
|
+
import { createComponent } from "@solidjs/web";
|
|
14
|
+
import { createContext, createMemo, createSignal, useContext } from "solid-js";
|
|
3
15
|
import { createAutocomplete } from "@proyecto-viviana/solidaria";
|
|
16
|
+
import { splitProps } from "@proyecto-viviana/solidaria/utils";
|
|
4
17
|
import { createAutocompleteState } from "@proyecto-viviana/solid-stately";
|
|
5
18
|
//#region src/Autocomplete.tsx
|
|
6
19
|
/**
|
|
@@ -71,7 +84,7 @@ function useAutocompleteCollection() {
|
|
|
71
84
|
* ```
|
|
72
85
|
*/
|
|
73
86
|
function Autocomplete(props) {
|
|
74
|
-
const [stateProps, ariaProps
|
|
87
|
+
const [stateProps, ariaProps] = splitProps(props, [
|
|
75
88
|
"inputValue",
|
|
76
89
|
"defaultInputValue",
|
|
77
90
|
"onInputChange"
|
|
@@ -103,15 +116,15 @@ function Autocomplete(props) {
|
|
|
103
116
|
},
|
|
104
117
|
filter: autocomplete.filter
|
|
105
118
|
}));
|
|
106
|
-
return createComponent(AutocompleteStateContext
|
|
119
|
+
return createComponent(AutocompleteStateContext, {
|
|
107
120
|
value: state,
|
|
108
121
|
get children() {
|
|
109
|
-
return createComponent(AutocompleteContext
|
|
122
|
+
return createComponent(AutocompleteContext, {
|
|
110
123
|
get value() {
|
|
111
124
|
return inputContextValue();
|
|
112
125
|
},
|
|
113
126
|
get children() {
|
|
114
|
-
return createComponent(AutocompleteCollectionContext
|
|
127
|
+
return createComponent(AutocompleteCollectionContext, {
|
|
115
128
|
get value() {
|
|
116
129
|
return collectionContextValue();
|
|
117
130
|
},
|
package/dist/Autocomplete.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Autocomplete.js","names":["
|
|
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
|
@@ -1,5 +1,18 @@
|
|
|
1
|
-
|
|
1
|
+
/*
|
|
2
|
+
* Copyright 2024 Adobe. All rights reserved.
|
|
3
|
+
* This file is licensed to you under the Apache License, Version 2.0 (the "License");
|
|
4
|
+
* you may not use this file except in compliance with the License. You may obtain a copy
|
|
5
|
+
* of the License at http://www.apache.org/licenses/LICENSE-2.0
|
|
6
|
+
*
|
|
7
|
+
* Unless required by applicable law or agreed to in writing, software distributed under
|
|
8
|
+
* the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
|
|
9
|
+
* OF ANY KIND, either express or implied. See the License for the specific language
|
|
10
|
+
* governing permissions and limitations under the License.
|
|
11
|
+
*/
|
|
12
|
+
// Ported to SolidJS for Proyecto Viviana; based on packages/react-aria-components/src/Autocomplete.tsx
|
|
13
|
+
import { createContext, createMemo, createSignal, useContext } from "solid-js";
|
|
2
14
|
import { createAutocomplete } from "@proyecto-viviana/solidaria";
|
|
15
|
+
import { splitProps } from "@proyecto-viviana/solidaria/utils";
|
|
3
16
|
import { createAutocompleteState } from "@proyecto-viviana/solid-stately";
|
|
4
17
|
//#region src/Autocomplete.tsx
|
|
5
18
|
/**
|
|
@@ -70,7 +83,7 @@ function useAutocompleteCollection() {
|
|
|
70
83
|
* ```
|
|
71
84
|
*/
|
|
72
85
|
function Autocomplete(props) {
|
|
73
|
-
const [stateProps, ariaProps
|
|
86
|
+
const [stateProps, ariaProps] = splitProps(props, [
|
|
74
87
|
"inputValue",
|
|
75
88
|
"defaultInputValue",
|
|
76
89
|
"onInputChange"
|
|
@@ -102,13 +115,13 @@ function Autocomplete(props) {
|
|
|
102
115
|
},
|
|
103
116
|
filter: autocomplete.filter
|
|
104
117
|
}));
|
|
105
|
-
return <AutocompleteStateContext
|
|
106
|
-
<AutocompleteContext
|
|
107
|
-
<AutocompleteCollectionContext
|
|
118
|
+
return <AutocompleteStateContext value={state}>
|
|
119
|
+
<AutocompleteContext value={inputContextValue()}>
|
|
120
|
+
<AutocompleteCollectionContext value={collectionContextValue()}>
|
|
108
121
|
{props.children}
|
|
109
|
-
</AutocompleteCollectionContext
|
|
110
|
-
</AutocompleteContext
|
|
111
|
-
</AutocompleteStateContext
|
|
122
|
+
</AutocompleteCollectionContext>
|
|
123
|
+
</AutocompleteContext>
|
|
124
|
+
</AutocompleteStateContext>;
|
|
112
125
|
}
|
|
113
126
|
//#endregion
|
|
114
127
|
export { Autocomplete, AutocompleteCollectionContext, AutocompleteContext, AutocompleteStateContext, useAutocompleteCollection, useAutocompleteInput, useAutocompleteState };
|