@proyecto-viviana/solidaria-components 0.5.0 → 0.7.0-rc.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE-APACHE-2.0 +201 -0
- package/NOTICE +91 -0
- package/README.md +4 -7
- package/dist/ActionBar.d.ts +2 -10
- package/dist/ActionBar.d.ts.map +1 -1
- package/dist/ActionBar.js +95 -59
- package/dist/ActionBar.js.map +1 -1
- package/dist/ActionBar.jsx +42 -15
- package/dist/ActionBar.jsx.map +1 -1
- package/dist/ActionGroup.d.ts +1 -12
- package/dist/ActionGroup.d.ts.map +1 -1
- package/dist/ActionGroup.js +66 -44
- package/dist/ActionGroup.js.map +1 -1
- package/dist/ActionGroup.jsx +25 -10
- package/dist/ActionGroup.jsx.map +1 -1
- package/dist/Alert.d.ts +4 -1
- package/dist/Alert.d.ts.map +1 -1
- package/dist/Alert.js +25 -17
- package/dist/Alert.js.map +1 -1
- package/dist/Alert.jsx +9 -5
- package/dist/Alert.jsx.map +1 -1
- package/dist/Autocomplete.d.ts +2 -9
- package/dist/Autocomplete.d.ts.map +1 -1
- package/dist/Autocomplete.js +18 -5
- package/dist/Autocomplete.js.map +1 -1
- package/dist/Autocomplete.jsx +20 -7
- package/dist/Autocomplete.jsx.map +1 -1
- package/dist/Breadcrumbs.d.ts +2 -7
- package/dist/Breadcrumbs.d.ts.map +1 -1
- package/dist/Breadcrumbs.js +71 -51
- package/dist/Breadcrumbs.js.map +1 -1
- package/dist/Breadcrumbs.jsx +25 -12
- package/dist/Breadcrumbs.jsx.map +1 -1
- package/dist/Button.d.ts +1 -7
- package/dist/Button.d.ts.map +1 -1
- package/dist/Button.js +125 -72
- package/dist/Button.js.map +1 -1
- package/dist/Button.jsx +105 -43
- package/dist/Button.jsx.map +1 -1
- package/dist/Calendar.d.ts +1 -7
- package/dist/Calendar.d.ts.map +1 -1
- package/dist/Calendar.js +297 -221
- package/dist/Calendar.js.map +1 -1
- package/dist/Calendar.jsx +52 -32
- package/dist/Calendar.jsx.map +1 -1
- package/dist/CalendarPicker.d.ts +1 -10
- package/dist/CalendarPicker.d.ts.map +1 -1
- package/dist/CalendarPicker.js +12 -0
- package/dist/CalendarPicker.js.map +1 -1
- package/dist/CalendarPicker.jsx +12 -0
- package/dist/CalendarPicker.jsx.map +1 -1
- package/dist/Checkbox.d.ts +2 -7
- package/dist/Checkbox.d.ts.map +1 -1
- package/dist/Checkbox.js +332 -270
- package/dist/Checkbox.js.map +1 -1
- package/dist/Checkbox.jsx +70 -77
- package/dist/Checkbox.jsx.map +1 -1
- package/dist/Collection.d.ts +33 -7
- package/dist/Collection.d.ts.map +1 -1
- package/dist/Collection.js +128 -74
- package/dist/Collection.js.map +1 -1
- package/dist/Collection.jsx +46 -7
- package/dist/Collection.jsx.map +1 -1
- package/dist/Color.d.ts +15 -20
- package/dist/Color.d.ts.map +1 -1
- package/dist/Color.js +572 -334
- package/dist/Color.js.map +1 -1
- package/dist/Color.jsx +205 -85
- package/dist/Color.jsx.map +1 -1
- package/dist/ColorEditor.d.ts +3 -1
- package/dist/ColorEditor.d.ts.map +1 -1
- package/dist/ColorEditor.js +147 -124
- package/dist/ColorEditor.js.map +1 -1
- package/dist/ColorEditor.jsx +4 -1
- package/dist/ColorEditor.jsx.map +1 -1
- package/dist/ComboBox.d.ts +31 -10
- package/dist/ComboBox.d.ts.map +1 -1
- package/dist/ComboBox.js +539 -274
- package/dist/ComboBox.js.map +1 -1
- package/dist/ComboBox.jsx +213 -70
- package/dist/ComboBox.jsx.map +1 -1
- package/dist/ContextualHelpTrigger.d.ts +1 -7
- package/dist/ContextualHelpTrigger.d.ts.map +1 -1
- package/dist/ContextualHelpTrigger.js +102 -72
- package/dist/ContextualHelpTrigger.js.map +1 -1
- package/dist/ContextualHelpTrigger.jsx +36 -16
- package/dist/ContextualHelpTrigger.jsx.map +1 -1
- package/dist/DateField.d.ts +2 -7
- package/dist/DateField.d.ts.map +1 -1
- package/dist/DateField.js +0 -2
- package/dist/DateField.jsx +0 -2
- package/dist/DateField2.js +194 -179
- package/dist/DateField2.js.map +1 -1
- package/dist/DateField2.jsx +58 -55
- package/dist/DateField2.jsx.map +1 -1
- package/dist/DatePicker.d.ts +7 -7
- package/dist/DatePicker.d.ts.map +1 -1
- package/dist/DatePicker.js +2 -2
- package/dist/DatePicker.jsx +2 -2
- package/dist/DatePicker2.js +357 -435
- package/dist/DatePicker2.js.map +1 -1
- package/dist/DatePicker2.jsx +109 -178
- package/dist/DatePicker2.jsx.map +1 -1
- package/dist/DateRangePickerContext.d.ts +7 -0
- package/dist/DateRangePickerContext.d.ts.map +1 -1
- package/dist/Dialog.d.ts +4 -9
- package/dist/Dialog.d.ts.map +1 -1
- package/dist/Dialog.js +168 -101
- package/dist/Dialog.js.map +1 -1
- package/dist/Dialog.jsx +75 -27
- package/dist/Dialog.jsx.map +1 -1
- package/dist/Disclosure.d.ts +1 -9
- package/dist/Disclosure.d.ts.map +1 -1
- package/dist/Disclosure.js +121 -79
- package/dist/Disclosure.js.map +1 -1
- package/dist/Disclosure.jsx +32 -19
- package/dist/Disclosure.jsx.map +1 -1
- package/dist/DragAndDrop.d.ts +9 -6
- package/dist/DragAndDrop.d.ts.map +1 -1
- package/dist/DragAndDrop.js +37 -22
- package/dist/DragAndDrop.js.map +1 -1
- package/dist/DragAndDrop.jsx +20 -4
- package/dist/DragAndDrop.jsx.map +1 -1
- package/dist/DragPreview.d.ts +1 -1
- package/dist/DragPreview.d.ts.map +1 -1
- package/dist/DropZone.d.ts +1 -7
- package/dist/DropZone.d.ts.map +1 -1
- package/dist/DropZone.js +74 -40
- package/dist/DropZone.js.map +1 -1
- package/dist/DropZone.jsx +24 -8
- package/dist/DropZone.jsx.map +1 -1
- package/dist/ElementTag.d.ts +9 -20
- package/dist/ElementTag.d.ts.map +1 -1
- package/dist/ElementTag.js +8 -210
- package/dist/ElementTag.js.map +1 -1
- package/dist/ElementTag.jsx +8 -57
- package/dist/ElementTag.jsx.map +1 -1
- package/dist/FieldError.d.ts +8 -7
- package/dist/FieldError.d.ts.map +1 -1
- package/dist/FieldError.js +33 -13
- package/dist/FieldError.js.map +1 -1
- package/dist/FieldError.jsx +20 -5
- package/dist/FieldError.jsx.map +1 -1
- package/dist/FileTrigger.d.ts +1 -7
- package/dist/FileTrigger.d.ts.map +1 -1
- package/dist/FileTrigger.js +30 -12
- package/dist/FileTrigger.js.map +1 -1
- package/dist/FileTrigger.jsx +15 -2
- package/dist/FileTrigger.jsx.map +1 -1
- package/dist/Focusable.d.ts +2 -8
- package/dist/Focusable.d.ts.map +1 -1
- package/dist/Focusable.js +23 -6
- package/dist/Focusable.js.map +1 -1
- package/dist/Focusable.jsx +22 -5
- package/dist/Focusable.jsx.map +1 -1
- package/dist/Form.d.ts +9 -8
- package/dist/Form.d.ts.map +1 -1
- package/dist/Form.js +66 -43
- package/dist/Form.js.map +1 -1
- package/dist/Form.jsx +36 -16
- package/dist/Form.jsx.map +1 -1
- package/dist/GridList.d.ts +5 -10
- package/dist/GridList.d.ts.map +1 -1
- package/dist/GridList.js +372 -243
- package/dist/GridList.js.map +1 -1
- package/dist/GridList.jsx +177 -99
- package/dist/GridList.jsx.map +1 -1
- package/dist/HiddenDateInput.d.ts +1 -7
- package/dist/HiddenDateInput.d.ts.map +1 -1
- package/dist/Icon.d.ts +4 -1
- package/dist/Icon.d.ts.map +1 -1
- package/dist/Icon.js +41 -37
- package/dist/Icon.js.map +1 -1
- package/dist/Icon.jsx +7 -3
- package/dist/Icon.jsx.map +1 -1
- package/dist/Keyboard.d.ts +1 -7
- package/dist/Keyboard.d.ts.map +1 -1
- package/dist/Keyboard.js +24 -11
- package/dist/Keyboard.js.map +1 -1
- package/dist/Keyboard.jsx +15 -2
- package/dist/Keyboard.jsx.map +1 -1
- package/dist/Label.d.ts +20 -0
- package/dist/Label.d.ts.map +1 -0
- package/dist/Label.js +60 -0
- package/dist/Label.js.map +1 -0
- package/dist/Label.jsx +47 -0
- package/dist/Label.jsx.map +1 -0
- package/dist/Landmark.d.ts +4 -1
- package/dist/Landmark.d.ts.map +1 -1
- package/dist/Landmark.js +10 -4
- package/dist/Landmark.js.map +1 -1
- package/dist/Landmark.jsx +5 -1
- package/dist/Landmark.jsx.map +1 -1
- package/dist/Link.d.ts +2 -7
- package/dist/Link.d.ts.map +1 -1
- package/dist/Link.js +56 -36
- package/dist/Link.js.map +1 -1
- package/dist/Link.jsx +52 -10
- package/dist/Link.jsx.map +1 -1
- package/dist/ListBox.d.ts +17 -13
- package/dist/ListBox.d.ts.map +1 -1
- package/dist/ListBox.js +647 -348
- package/dist/ListBox.js.map +1 -1
- package/dist/ListBox.jsx +339 -236
- package/dist/ListBox.jsx.map +1 -1
- package/dist/ListDropTargetDelegate.d.ts +3 -0
- package/dist/ListDropTargetDelegate.d.ts.map +1 -1
- package/dist/Menu.d.ts +39 -30
- package/dist/Menu.d.ts.map +1 -1
- package/dist/Menu.js +547 -368
- package/dist/Menu.js.map +1 -1
- package/dist/Menu.jsx +328 -230
- package/dist/Menu.jsx.map +1 -1
- package/dist/Meter.d.ts +6 -13
- package/dist/Meter.d.ts.map +1 -1
- package/dist/Meter.js +55 -18
- package/dist/Meter.js.map +1 -1
- package/dist/Meter.jsx +33 -8
- package/dist/Meter.jsx.map +1 -1
- package/dist/Modal.d.ts +1 -7
- package/dist/Modal.d.ts.map +1 -1
- package/dist/Modal.js +104 -56
- package/dist/Modal.js.map +1 -1
- package/dist/Modal.jsx +68 -38
- package/dist/Modal.jsx.map +1 -1
- package/dist/NumberField.d.ts +4 -7
- package/dist/NumberField.d.ts.map +1 -1
- package/dist/NumberField.js +243 -124
- package/dist/NumberField.js.map +1 -1
- package/dist/NumberField.jsx +115 -26
- package/dist/NumberField.jsx.map +1 -1
- package/dist/Popover.d.ts +15 -7
- package/dist/Popover.d.ts.map +1 -1
- package/dist/Popover.js +370 -181
- package/dist/Popover.js.map +1 -1
- package/dist/Popover.jsx +215 -82
- package/dist/Popover.jsx.map +1 -1
- package/dist/Pressable.d.ts +2 -8
- package/dist/Pressable.d.ts.map +1 -1
- package/dist/Pressable.js +23 -6
- package/dist/Pressable.js.map +1 -1
- package/dist/Pressable.jsx +22 -5
- package/dist/Pressable.jsx.map +1 -1
- package/dist/PreviewTrigger.d.ts +24 -0
- package/dist/PreviewTrigger.d.ts.map +1 -0
- package/dist/PreviewTrigger.js +128 -0
- package/dist/PreviewTrigger.js.map +1 -0
- package/dist/PreviewTrigger.jsx +117 -0
- package/dist/PreviewTrigger.jsx.map +1 -0
- package/dist/ProgressBar.d.ts +1 -7
- package/dist/ProgressBar.d.ts.map +1 -1
- package/dist/ProgressBar.js +34 -14
- package/dist/ProgressBar.js.map +1 -1
- package/dist/ProgressBar.jsx +17 -3
- package/dist/ProgressBar.jsx.map +1 -1
- package/dist/RadioGroup.d.ts +2 -7
- package/dist/RadioGroup.d.ts.map +1 -1
- package/dist/RadioGroup.js +388 -269
- package/dist/RadioGroup.js.map +1 -1
- package/dist/RadioGroup.jsx +110 -99
- package/dist/RadioGroup.jsx.map +1 -1
- package/dist/RangeCalendar.d.ts +3 -7
- package/dist/RangeCalendar.d.ts.map +1 -1
- package/dist/RangeCalendar.js +271 -202
- package/dist/RangeCalendar.js.map +1 -1
- package/dist/RangeCalendar.jsx +56 -37
- package/dist/RangeCalendar.jsx.map +1 -1
- package/dist/RouterProvider.d.ts +3 -9
- package/dist/RouterProvider.d.ts.map +1 -1
- package/dist/RouterProvider.js +15 -14
- package/dist/RouterProvider.js.map +1 -1
- package/dist/RouterProvider.jsx +14 -13
- package/dist/RouterProvider.jsx.map +1 -1
- package/dist/SearchField.d.ts +4 -7
- package/dist/SearchField.d.ts.map +1 -1
- package/dist/SearchField.js +191 -164
- package/dist/SearchField.js.map +1 -1
- package/dist/SearchField.jsx +69 -62
- package/dist/SearchField.jsx.map +1 -1
- package/dist/Select.d.ts +5 -10
- package/dist/Select.d.ts.map +1 -1
- package/dist/Select.js +565 -359
- package/dist/Select.js.map +1 -1
- package/dist/Select.jsx +281 -161
- package/dist/Select.jsx.map +1 -1
- package/dist/SelectionIndicator.d.ts +1 -4
- package/dist/SelectionIndicator.d.ts.map +1 -1
- package/dist/SelectionIndicator.js +29 -13
- package/dist/SelectionIndicator.js.map +1 -1
- package/dist/SelectionIndicator.jsx +18 -4
- package/dist/SelectionIndicator.jsx.map +1 -1
- package/dist/Separator.d.ts +1 -7
- package/dist/Separator.d.ts.map +1 -1
- package/dist/Separator.js +22 -6
- package/dist/Separator.js.map +1 -1
- package/dist/Separator.jsx +16 -3
- package/dist/Separator.jsx.map +1 -1
- package/dist/SharedElementTransition.d.ts +1 -10
- package/dist/SharedElementTransition.d.ts.map +1 -1
- package/dist/SharedElementTransition.js +68 -40
- package/dist/SharedElementTransition.js.map +1 -1
- package/dist/SharedElementTransition.jsx +49 -25
- package/dist/SharedElementTransition.jsx.map +1 -1
- package/dist/Slider.d.ts +2 -8
- package/dist/Slider.d.ts.map +1 -1
- package/dist/Slider.js +155 -97
- package/dist/Slider.js.map +1 -1
- package/dist/Slider.jsx +25 -12
- package/dist/Slider.jsx.map +1 -1
- package/dist/StepList.d.ts +1 -7
- package/dist/StepList.d.ts.map +1 -1
- package/dist/StepList.js +112 -68
- package/dist/StepList.js.map +1 -1
- package/dist/StepList.jsx +58 -20
- package/dist/StepList.jsx.map +1 -1
- package/dist/Switch.d.ts +2 -9
- package/dist/Switch.d.ts.map +1 -1
- package/dist/Switch.js +164 -114
- package/dist/Switch.js.map +1 -1
- package/dist/Switch.jsx +26 -13
- package/dist/Switch.jsx.map +1 -1
- package/dist/Table.d.ts +2 -1
- package/dist/Table.d.ts.map +1 -1
- package/dist/Table.js +689 -592
- package/dist/Table.js.map +1 -1
- package/dist/Table.jsx +317 -237
- package/dist/Table.jsx.map +1 -1
- package/dist/Tabs.d.ts +2 -7
- package/dist/Tabs.d.ts.map +1 -1
- package/dist/Tabs.js +278 -293
- package/dist/Tabs.js.map +1 -1
- package/dist/Tabs.jsx +68 -66
- package/dist/Tabs.jsx.map +1 -1
- package/dist/TagGroup.d.ts +4 -11
- package/dist/TagGroup.d.ts.map +1 -1
- package/dist/TagGroup.js +153 -115
- package/dist/TagGroup.js.map +1 -1
- package/dist/TagGroup.jsx +37 -24
- package/dist/TagGroup.jsx.map +1 -1
- package/dist/Text.d.ts +3 -3
- package/dist/Text.d.ts.map +1 -1
- package/dist/Text.js +24 -7
- package/dist/Text.js.map +1 -1
- package/dist/Text.jsx +17 -5
- package/dist/Text.jsx.map +1 -1
- package/dist/TextField.d.ts +3 -16
- package/dist/TextField.d.ts.map +1 -1
- package/dist/TextField.js +104 -129
- package/dist/TextField.js.map +1 -1
- package/dist/TextField.jsx +76 -102
- package/dist/TextField.jsx.map +1 -1
- package/dist/TimeField.d.ts +2 -15
- package/dist/TimeField.d.ts.map +1 -1
- package/dist/TimeField.js +86 -102
- package/dist/TimeField.js.map +1 -1
- package/dist/TimeField.jsx +32 -49
- package/dist/TimeField.jsx.map +1 -1
- package/dist/Toast.d.ts +10 -13
- package/dist/Toast.d.ts.map +1 -1
- package/dist/Toast.js +209 -108
- package/dist/Toast.js.map +1 -1
- package/dist/Toast.jsx +127 -22
- package/dist/Toast.jsx.map +1 -1
- package/dist/ToggleButton.d.ts +1 -7
- package/dist/ToggleButton.d.ts.map +1 -1
- package/dist/ToggleButton.js +57 -35
- package/dist/ToggleButton.js.map +1 -1
- package/dist/ToggleButton.jsx +26 -12
- package/dist/ToggleButton.jsx.map +1 -1
- package/dist/ToggleButtonGroup.d.ts +1 -7
- package/dist/ToggleButtonGroup.d.ts.map +1 -1
- package/dist/ToggleButtonGroup.js +59 -44
- package/dist/ToggleButtonGroup.js.map +1 -1
- package/dist/ToggleButtonGroup.jsx +25 -12
- package/dist/ToggleButtonGroup.jsx.map +1 -1
- package/dist/TokenField.d.ts +52 -0
- package/dist/TokenField.d.ts.map +1 -0
- package/dist/TokenField.js +301 -0
- package/dist/TokenField.js.map +1 -0
- package/dist/TokenField.jsx +197 -0
- package/dist/TokenField.jsx.map +1 -0
- package/dist/Toolbar.d.ts +2 -7
- package/dist/Toolbar.d.ts.map +1 -1
- package/dist/Toolbar.js +35 -16
- package/dist/Toolbar.js.map +1 -1
- package/dist/Toolbar.jsx +15 -2
- package/dist/Toolbar.jsx.map +1 -1
- package/dist/Tooltip.d.ts +2 -7
- package/dist/Tooltip.d.ts.map +1 -1
- package/dist/Tooltip.js +105 -68
- package/dist/Tooltip.js.map +1 -1
- package/dist/Tooltip.jsx +60 -36
- package/dist/Tooltip.jsx.map +1 -1
- package/dist/Tree.d.ts +8 -11
- package/dist/Tree.d.ts.map +1 -1
- package/dist/Tree.js +486 -339
- package/dist/Tree.js.map +1 -1
- package/dist/Tree.jsx +155 -107
- package/dist/Tree.jsx.map +1 -1
- package/dist/Virtualizer.d.ts +39 -9
- package/dist/Virtualizer.d.ts.map +1 -1
- package/dist/Virtualizer.js +2 -2
- package/dist/Virtualizer.jsx +2 -2
- package/dist/Virtualizer2.js +491 -136
- package/dist/Virtualizer2.js.map +1 -1
- package/dist/Virtualizer2.jsx +455 -122
- package/dist/Virtualizer2.jsx.map +1 -1
- package/dist/VirtualizerLayouts.d.ts +55 -2
- package/dist/VirtualizerLayouts.d.ts.map +1 -1
- package/dist/VisuallyHidden.d.ts +4 -3
- package/dist/VisuallyHidden.d.ts.map +1 -1
- package/dist/VisuallyHidden.js +18 -11
- package/dist/VisuallyHidden.js.map +1 -1
- package/dist/VisuallyHidden.jsx +15 -9
- package/dist/VisuallyHidden.jsx.map +1 -1
- package/dist/contexts.d.ts +25 -0
- package/dist/contexts.d.ts.map +1 -1
- package/dist/contexts.js +3 -0
- package/dist/contexts.js.map +1 -1
- package/dist/contexts.jsx +3 -0
- package/dist/contexts.jsx.map +1 -1
- package/dist/index.d.ts +11 -9
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +14 -11
- package/dist/index.jsx +14 -11
- package/dist/intl/index.d.ts +16 -0
- package/dist/intl/index.d.ts.map +1 -0
- package/dist/intl.js +212 -0
- package/dist/intl.js.map +1 -0
- package/dist/intl.jsx +212 -0
- package/dist/intl.jsx.map +1 -0
- package/dist/useDragAndDrop.d.ts +4 -2
- package/dist/useDragAndDrop.d.ts.map +1 -1
- package/dist/useDragAndDrop2.js +39 -21
- package/dist/useDragAndDrop2.js.map +1 -1
- package/dist/useDragAndDrop2.jsx +39 -21
- package/dist/useDragAndDrop2.jsx.map +1 -1
- package/dist/utils.d.ts +28 -9
- package/dist/utils.d.ts.map +1 -1
- package/dist/utils.js +96 -24
- package/dist/utils.js.map +1 -1
- package/dist/utils.jsx +81 -24
- package/dist/utils.jsx.map +1 -1
- package/dist/virtualizer/Layout.d.ts +9 -0
- package/dist/virtualizer/Layout.d.ts.map +1 -1
- package/dist/virtualizer/Layout.js +23 -2
- package/dist/virtualizer/Layout.js.map +1 -1
- package/dist/virtualizer/Layout.jsx +23 -2
- package/dist/virtualizer/Layout.jsx.map +1 -1
- package/package.json +29 -10
- package/src/ActionBar.tsx +50 -24
- package/src/ActionGroup.tsx +31 -19
- package/src/Alert.tsx +10 -4
- package/src/Autocomplete.tsx +24 -15
- package/src/Breadcrumbs.tsx +32 -16
- package/src/Button.tsx +182 -67
- package/src/Calendar.tsx +65 -47
- package/src/CalendarPicker.tsx +16 -1
- package/src/Checkbox.tsx +84 -116
- package/src/Collection.tsx +84 -3
- package/src/Color.tsx +282 -104
- package/src/ColorEditor.tsx +5 -1
- package/src/ComboBox.tsx +384 -109
- package/src/ContextualHelpTrigger.tsx +47 -41
- package/src/DateField.tsx +74 -106
- package/src/DatePicker.tsx +156 -352
- package/src/DateRangePickerContext.tsx +8 -0
- package/src/Dialog.tsx +105 -38
- package/src/Disclosure.tsx +29 -19
- package/src/DragAndDrop.tsx +43 -8
- package/src/DragPreview.tsx +20 -1
- package/src/DropZone.tsx +32 -18
- package/src/ElementTag.tsx +14 -104
- package/src/FieldError.tsx +39 -7
- package/src/FileTrigger.tsx +18 -3
- package/src/Focusable.tsx +27 -6
- package/src/Form.tsx +57 -11
- package/src/GridList.tsx +233 -141
- package/src/HiddenDateInput.tsx +19 -3
- package/src/Icon.tsx +8 -2
- package/src/Keyboard.tsx +18 -2
- package/src/Label.tsx +77 -0
- package/src/Landmark.tsx +6 -1
- package/src/Link.tsx +65 -19
- package/src/ListBox.tsx +645 -468
- package/src/ListDropTargetDelegate.ts +4 -0
- package/src/Menu.tsx +512 -349
- package/src/Meter.tsx +42 -8
- package/src/Modal.tsx +85 -42
- package/src/NumberField.tsx +161 -48
- package/src/Popover.tsx +424 -148
- package/src/Pressable.tsx +27 -6
- package/src/PreviewTrigger.tsx +171 -0
- package/src/ProgressBar.tsx +25 -3
- package/src/RadioGroup.tsx +230 -161
- package/src/RangeCalendar.tsx +75 -63
- package/src/RouterProvider.tsx +24 -14
- package/src/SearchField.tsx +118 -121
- package/src/Select.tsx +454 -274
- package/src/SelectionIndicator.tsx +21 -3
- package/src/Separator.tsx +17 -1
- package/src/SharedElementTransition.tsx +115 -97
- package/src/Slider.tsx +35 -17
- package/src/StepList.tsx +71 -32
- package/src/Switch.tsx +45 -29
- package/src/Table.tsx +446 -380
- package/src/Tabs.tsx +132 -155
- package/src/TagGroup.tsx +53 -40
- package/src/Text.tsx +23 -6
- package/src/TextField.tsx +118 -159
- package/src/TimeField.tsx +34 -95
- package/src/Toast.tsx +141 -67
- package/src/ToggleButton.tsx +33 -15
- package/src/ToggleButtonGroup.tsx +27 -9
- package/src/TokenField.tsx +379 -0
- package/src/Toolbar.tsx +19 -9
- package/src/Tooltip.tsx +126 -84
- package/src/Tree.tsx +233 -173
- package/src/Virtualizer.tsx +400 -138
- package/src/VirtualizerLayouts.ts +211 -26
- package/src/VisuallyHidden.tsx +22 -8
- package/src/contexts.ts +13 -0
- package/src/index.ts +32 -11
- package/src/intl/ar-AE.json +6 -0
- package/src/intl/bg-BG.json +6 -0
- package/src/intl/cs-CZ.json +6 -0
- package/src/intl/da-DK.json +6 -0
- package/src/intl/de-DE.json +6 -0
- package/src/intl/el-GR.json +6 -0
- package/src/intl/en-US.json +6 -0
- package/src/intl/es-ES.json +6 -0
- package/src/intl/et-EE.json +6 -0
- package/src/intl/fi-FI.json +6 -0
- package/src/intl/fr-FR.json +6 -0
- package/src/intl/he-IL.json +6 -0
- package/src/intl/hr-HR.json +6 -0
- package/src/intl/hu-HU.json +6 -0
- package/src/intl/index.ts +125 -0
- package/src/intl/it-IT.json +6 -0
- package/src/intl/ja-JP.json +6 -0
- package/src/intl/ko-KR.json +6 -0
- package/src/intl/lt-LT.json +6 -0
- package/src/intl/lv-LV.json +6 -0
- package/src/intl/nb-NO.json +6 -0
- package/src/intl/nl-NL.json +6 -0
- package/src/intl/pl-PL.json +6 -0
- package/src/intl/pt-BR.json +6 -0
- package/src/intl/pt-PT.json +6 -0
- package/src/intl/ro-RO.json +6 -0
- package/src/intl/ru-RU.json +6 -0
- package/src/intl/sk-SK.json +6 -0
- package/src/intl/sl-SI.json +6 -0
- package/src/intl/sr-SP.json +6 -0
- package/src/intl/sv-SE.json +6 -0
- package/src/intl/tr-TR.json +6 -0
- package/src/intl/uk-UA.json +6 -0
- package/src/intl/zh-CN.json +6 -0
- package/src/intl/zh-TW.json +6 -0
- package/src/useDragAndDrop.ts +30 -32
- package/src/utils.tsx +124 -68
- package/src/virtualizer/Layout.ts +29 -0
package/dist/Breadcrumbs.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Breadcrumbs.js","names":["Accessor","JSX","createContext","createMemo","createSignal","children","resolveChildren","splitProps","useContext","For","Show","ElementTag","createBreadcrumbs","createBreadcrumbItem","createFocusRing","createHover","mergeProps","AriaBreadcrumbsProps","AriaBreadcrumbItemProps","PressEvent","RenderChildren","ClassNameOrFunction","StyleOrFunction","SlotProps","useRenderProps","filterDOMProps","RefLike","el","T","current","assignRef","ref","BreadcrumbsRenderProps","isDisabled","BreadcrumbsProps","Omit","items","getKey","item","onAction","key","Element","class","style","HTMLElement","BreadcrumbItemRenderProps","isCurrent","isPressed","isFocused","isFocusVisible","isHovered","BreadcrumbItemProps","BreadcrumbsContextValue","registerStaticItem","staticItemCount","resetStaticItems","setStaticItemCount","count","BreadcrumbsContext","BreadcrumbItemContextValue","itemKey","isLast","BreadcrumbItemContext","defaultItemKey","index","maybeItem","id","Breadcrumbs","props","local","ariaProps","rest","hasCollectionItems","undefined","getItemKey","nextStaticIndex","navProps","aria-label","aria-labelledby","aria-describedby","renderValues","renderProps","defaultClassName","domProps","Record","global","_$createComponent","Provider","value","_el$","_$getNextElement","_tmpl$","_$use","element","_$spread","_$mergeProps","data-disabled","_$insert","when","fallback","StaticBreadcrumbItems","each","length","renderItem","_el$2","_tmpl$2","_$runHydrationEvents","context","staticChildren","childArray","array","toArray","child","_el$3","BreadcrumbItem","itemContext","staticIndex","elementType","href","linkElementType","handlePress","e","onPress","itemAria","target","rel","onPressStart","onPressEnd","onClick","onFocus","onBlur","onFocusChange","onKeyDown","onKeyUp","autoFocus","aria-details","aria-current","focusProps","hoverProps","mergedItemProps","itemProps","mergedStyle","userStyle","baseStyle","display","tag","_$memo","aria-disabled","data-current","data-pressed","data-focused","data-focus-visible","data-hovered","renderChildren","Item"],"sources":["../src/Breadcrumbs.tsx"],"sourcesContent":["/**\n * Breadcrumbs component for solidaria-components\n *\n * A pre-wired headless breadcrumbs component that combines aria hooks.\n * Port of react-aria-components Breadcrumbs.\n */\n\nimport {\n type Accessor,\n type JSX,\n createContext,\n createMemo,\n createSignal,\n children as resolveChildren,\n splitProps,\n useContext,\n For,\n Show,\n} from \"solid-js\";\nimport { ElementTag } from \"./ElementTag\";\nimport {\n createBreadcrumbs,\n createBreadcrumbItem,\n createFocusRing,\n createHover,\n mergeProps,\n type AriaBreadcrumbsProps,\n type AriaBreadcrumbItemProps,\n type PressEvent,\n} from \"@proyecto-viviana/solidaria\";\nimport {\n type RenderChildren,\n type ClassNameOrFunction,\n type StyleOrFunction,\n type SlotProps,\n useRenderProps,\n filterDOMProps,\n} from \"./utils\";\n\ntype RefLike<T> = ((el: T) => void) | { current?: T | null } | undefined;\n\nfunction assignRef<T>(ref: RefLike<T>, el: T): void {\n if (!ref) {\n return;\n }\n\n if (typeof ref === \"function\") {\n ref(el);\n } else {\n ref.current = el;\n }\n}\n\nexport interface BreadcrumbsRenderProps {\n /** Whether the breadcrumbs are disabled. */\n isDisabled: boolean;\n}\n\nexport interface BreadcrumbsProps<T> extends Omit<AriaBreadcrumbsProps, \"isDisabled\">, SlotProps {\n /** The items to render in the breadcrumbs. */\n items?: T[];\n /** Function to get the key from an item. */\n getKey?: (item: T) => string | number;\n /** Whether the breadcrumbs are disabled. */\n isDisabled?: boolean;\n /** Handler called when a breadcrumb item is activated. */\n onAction?: (key: string | number) => void;\n /** The children of the component, or a render function for collection items. */\n children?: JSX.Element | ((item: T) => JSX.Element);\n /** The CSS className for the element. */\n class?: ClassNameOrFunction<BreadcrumbsRenderProps>;\n /** The inline style for the element. */\n style?: StyleOrFunction<BreadcrumbsRenderProps>;\n /** Ref for the navigation element. */\n ref?: RefLike<HTMLElement>;\n}\n\nexport interface BreadcrumbItemRenderProps {\n /** Whether this is the current/last item. */\n isCurrent: boolean;\n /** Whether the item is disabled. */\n isDisabled: boolean;\n /** Whether the item is pressed. */\n isPressed: boolean;\n /** Whether the item is focused. */\n isFocused: boolean;\n /** Whether the item has visible focus ring. */\n isFocusVisible: boolean;\n /** Whether the item is hovered. */\n isHovered: boolean;\n}\n\nexport interface BreadcrumbItemProps\n extends Omit<AriaBreadcrumbItemProps, \"isDisabled\">, SlotProps {\n /** The children of the breadcrumb item. */\n children?: RenderChildren<BreadcrumbItemRenderProps>;\n /** The CSS className for the element. */\n class?: ClassNameOrFunction<BreadcrumbItemRenderProps>;\n /** The inline style for the element. */\n style?: StyleOrFunction<BreadcrumbItemRenderProps>;\n /** Whether this item is disabled. */\n isDisabled?: boolean;\n /** Ref for the breadcrumb item element. */\n ref?: RefLike<HTMLElement>;\n}\n\ninterface BreadcrumbsContextValue {\n isDisabled: Accessor<boolean>;\n onAction?: (key: string | number) => void;\n registerStaticItem?: () => number;\n staticItemCount?: Accessor<number>;\n resetStaticItems?: () => void;\n setStaticItemCount?: (count: number) => void;\n}\n\nexport const BreadcrumbsContext = createContext<BreadcrumbsContextValue | null>(null);\n\ninterface BreadcrumbItemContextValue {\n itemKey: string | number | null;\n isLast: Accessor<boolean>;\n}\n\nexport const BreadcrumbItemContext = createContext<BreadcrumbItemContextValue | null>(null);\n\nfunction defaultItemKey(item: unknown, index: number): string | number {\n const maybeItem = item as { key?: string | number; id?: string | number };\n return maybeItem.key ?? maybeItem.id ?? index;\n}\n\n/**\n * Breadcrumbs show hierarchy and navigational context for a user's location within an application.\n */\nexport function Breadcrumbs<T>(props: BreadcrumbsProps<T>): JSX.Element {\n const [local, ariaProps, rest] = splitProps(\n props,\n [\"children\", \"class\", \"style\", \"slot\", \"items\", \"getKey\", \"isDisabled\", \"onAction\", \"ref\"],\n [\"aria-label\", \"aria-labelledby\", \"aria-describedby\", \"aria-details\"],\n );\n\n const isDisabled = () => local.isDisabled ?? false;\n const items = () => local.items ?? [];\n const hasCollectionItems = () => local.items !== undefined;\n const getItemKey = (item: T, index: number): string | number =>\n local.getKey?.(item) ?? defaultItemKey(item, index);\n const [staticItemCount, setStaticItemCount] = createSignal(0);\n let nextStaticIndex = 0;\n const resetStaticItems = () => {\n nextStaticIndex = 0;\n setStaticItemCount(0);\n };\n const registerStaticItem = () => {\n const index = nextStaticIndex;\n nextStaticIndex += 1;\n return index;\n };\n\n const { navProps } = createBreadcrumbs({\n get \"aria-label\"() {\n return ariaProps[\"aria-label\"];\n },\n get \"aria-labelledby\"() {\n return ariaProps[\"aria-labelledby\"];\n },\n get \"aria-describedby\"() {\n return ariaProps[\"aria-describedby\"];\n },\n get isDisabled() {\n return isDisabled();\n },\n });\n\n const renderValues = createMemo<BreadcrumbsRenderProps>(() => ({\n isDisabled: isDisabled(),\n }));\n\n const renderProps = useRenderProps(\n {\n class: local.class,\n style: local.style,\n defaultClassName: \"solidaria-Breadcrumbs\",\n },\n renderValues,\n );\n\n const domProps = createMemo(() =>\n filterDOMProps(rest as Record<string, unknown>, { global: true }),\n );\n return (\n <BreadcrumbsContext.Provider\n value={{\n isDisabled,\n onAction: local.onAction,\n registerStaticItem,\n staticItemCount,\n resetStaticItems,\n setStaticItemCount,\n }}\n >\n {/*\n Faithful to react-aria-components Breadcrumbs: the accessible name (navProps'\n aria-label) sits directly on the <ol> (role=\"list\"), with NO wrapping <nav>\n landmark (react-spectrum/packages/react-aria-components/src/Breadcrumbs.tsx\n renders `<dom.ol {...mergeProps(DOMProps, navProps)} style={props.style}>`).\n The <ol> carries ONLY the consumer's class/style — no hard-coded inline\n layout reset. An inline reset would beat the styled layer's class (inline\n wins over class), which is exactly what broke S2 parity: the solid-spectrum\n `wrapperStyles` class supplies display:flex / list-style:none / padding:0 /\n marginStart and deliberately leaves align-items at its `normal` default, so\n a hard-coded inline `align-items:center` + `margin:0` clobbered the\n wrapper's margin and diverged from S2 (whose <ol> has neither).\n */}\n <ol\n {...navProps}\n {...domProps()}\n ref={(element) => assignRef(local.ref, element)}\n class={renderProps.class()}\n style={renderProps.style()}\n data-disabled={isDisabled() || undefined}\n >\n <Show\n when={hasCollectionItems()}\n fallback={<StaticBreadcrumbItems>{local.children as JSX.Element}</StaticBreadcrumbItems>}\n >\n <For each={items()}>\n {(item, index) => {\n const itemKey = getItemKey(item, index());\n const isLast = () => index() === items().length - 1;\n const renderItem = local.children as ((item: T) => JSX.Element) | undefined;\n\n return (\n <li style={{ display: \"flex\", \"align-items\": \"center\" }}>\n <BreadcrumbItemContext.Provider value={{ itemKey, isLast }}>\n {renderItem?.(item)}\n </BreadcrumbItemContext.Provider>\n </li>\n );\n }}\n </For>\n </Show>\n </ol>\n </BreadcrumbsContext.Provider>\n );\n}\n\nfunction StaticBreadcrumbItems(props: { children?: JSX.Element }): JSX.Element {\n const context = useContext(BreadcrumbsContext);\n const staticChildren = resolveChildren(() => props.children);\n const childArray = createMemo(() => {\n context?.resetStaticItems?.();\n const array = staticChildren.toArray();\n context?.setStaticItemCount?.(array.length);\n return array;\n });\n\n return (\n <For each={childArray()}>\n {(child) => <li style={{ display: \"flex\", \"align-items\": \"center\" }}>{child}</li>}\n </For>\n );\n}\n\n/**\n * A BreadcrumbItem represents an individual breadcrumb in the navigation trail.\n */\nexport function BreadcrumbItem(props: BreadcrumbItemProps): JSX.Element {\n const [local, ariaProps] = splitProps(props, [\"class\", \"style\", \"slot\", \"isDisabled\", \"ref\"]);\n\n const context = useContext(BreadcrumbsContext);\n const itemContext = useContext(BreadcrumbItemContext);\n const staticIndex = itemContext ? null : context?.registerStaticItem?.();\n const isDisabled = () => local.isDisabled ?? context?.isDisabled() ?? false;\n const isCurrent = () =>\n ariaProps.isCurrent ??\n itemContext?.isLast() ??\n (staticIndex !== null &&\n staticIndex !== undefined &&\n context?.staticItemCount !== undefined &&\n staticIndex === context.staticItemCount() - 1);\n const itemKey = () => itemContext?.itemKey ?? ariaProps.id ?? null;\n\n // Mirror react-aria-components' Link: render an <a> only when there is an\n // href on an enabled, non-current item; otherwise fall back to a <span\n // role=\"link\"> (via createLink). A styled layer may force the element type\n // (S2 renders the current item as a plain <div>), which takes precedence.\n const elementType = () =>\n ariaProps.elementType ?? (ariaProps.href && !isDisabled() && !isCurrent() ? \"a\" : \"span\");\n // The current breadcrumb is the current page and is non-interactive: S2\n // renders it as a plain element with no link role. createLink only omits\n // role=\"link\" for an <a>, so treat the current item as an \"a\" purely for the\n // role decision while still rendering the resolved element type above.\n const linkElementType = () => (isCurrent() ? \"a\" : elementType());\n\n const handlePress = (e: PressEvent) => {\n ariaProps.onPress?.(e);\n const key = itemKey();\n if (key !== null && !isCurrent() && !isDisabled()) {\n context?.onAction?.(key);\n }\n };\n\n const itemAria = createBreadcrumbItem({\n get id() {\n return ariaProps.id;\n },\n get isCurrent() {\n return isCurrent();\n },\n get isDisabled() {\n return isDisabled();\n },\n get href() {\n return ariaProps.href;\n },\n get target() {\n return ariaProps.target;\n },\n get rel() {\n return ariaProps.rel;\n },\n get elementType() {\n return linkElementType();\n },\n get onPress() {\n return handlePress;\n },\n get onPressStart() {\n return ariaProps.onPressStart;\n },\n get onPressEnd() {\n return ariaProps.onPressEnd;\n },\n get onClick() {\n return ariaProps.onClick;\n },\n get onFocus() {\n return ariaProps.onFocus;\n },\n get onBlur() {\n return ariaProps.onBlur;\n },\n get onFocusChange() {\n return ariaProps.onFocusChange;\n },\n get onKeyDown() {\n return ariaProps.onKeyDown;\n },\n get onKeyUp() {\n return ariaProps.onKeyUp;\n },\n get autoFocus() {\n return ariaProps.autoFocus;\n },\n get \"aria-label\"() {\n return ariaProps[\"aria-label\"];\n },\n get \"aria-labelledby\"() {\n return ariaProps[\"aria-labelledby\"];\n },\n get \"aria-describedby\"() {\n return ariaProps[\"aria-describedby\"];\n },\n get \"aria-details\"() {\n return ariaProps[\"aria-details\"];\n },\n get \"aria-current\"() {\n return ariaProps[\"aria-current\"];\n },\n });\n\n const isPressed = itemAria.isPressed;\n const { isFocused, isFocusVisible, focusProps } = createFocusRing();\n const { isHovered, hoverProps } = createHover({\n get isDisabled() {\n return isDisabled();\n },\n });\n // Read itemAria.itemProps fresh inside the memo (do NOT destructure it above):\n // the reactive getter re-runs createBreadcrumbItem → createLink each time this\n // memo re-evaluates, so role/tabIndex track elementType once isCurrent settles.\n const mergedItemProps = createMemo(() =>\n mergeProps(\n itemAria.itemProps as Record<string, unknown>,\n focusProps as Record<string, unknown>,\n hoverProps as Record<string, unknown>,\n ),\n );\n\n const renderValues = createMemo<BreadcrumbItemRenderProps>(() => ({\n isCurrent: isCurrent(),\n isDisabled: isDisabled(),\n isPressed: isPressed(),\n isFocused: isFocused(),\n isFocusVisible: isFocusVisible(),\n isHovered: isHovered(),\n }));\n\n const renderProps = useRenderProps(\n {\n get children() {\n return props.children;\n },\n class: local.class,\n style: local.style,\n defaultClassName: \"solidaria-BreadcrumbItem\",\n },\n renderValues,\n );\n\n const mergedStyle = () => {\n const userStyle = renderProps.style();\n const baseStyle = { display: \"inline-flex\", \"align-items\": \"center\" };\n return userStyle ? { ...baseStyle, ...userStyle } : baseStyle;\n };\n\n return (\n <ElementTag\n tag={elementType()}\n {...mergedItemProps()}\n ref={(element: HTMLElement) => assignRef(local.ref, element)}\n aria-current={isCurrent() ? (ariaProps[\"aria-current\"] ?? \"page\") : undefined}\n aria-disabled={isDisabled() || isCurrent() || undefined}\n class={renderProps.class()}\n style={mergedStyle()}\n data-current={isCurrent() || undefined}\n data-disabled={isDisabled() || undefined}\n data-pressed={isPressed() || undefined}\n data-focused={isFocused() || undefined}\n data-focus-visible={isFocusVisible() || undefined}\n data-hovered={isHovered() || undefined}\n >\n {renderProps.renderChildren()}\n </ElementTag>\n );\n}\n\nBreadcrumbs.Item = BreadcrumbItem;\n"],"mappings":";;;;;;;;;;;;;AAyCA,SAAS8B,UAAaC,KAAiBJ,IAAa;CAClD,IAAI,CAACI,KACH;CAGF,IAAI,OAAOA,QAAQ,YACjBA,IAAIJ,EAAE;MAENI,IAAIF,UAAUF;AAElB;AAgEA,MAAa+B,qBAAqBxD,cAA8C,IAAI;AAOpF,MAAa4D,wBAAwB5D,cAAiD,IAAI;AAE1F,SAAS6D,eAAezB,MAAe0B,OAAgC;CACrE,MAAMC,YAAY3B;CAClB,OAAO2B,UAAUzB,OAAOyB,UAAUC,MAAMF;AAC1C;;;;AAKA,SAAgBG,YAAeC,OAAyC;CACtE,MAAM,CAACC,OAAOC,WAAWC,QAAQhE,WAC/B6D,OACA;EAAC;EAAY;EAAS;EAAS;EAAQ;EAAS;EAAU;EAAc;EAAY;CAAK,GACzF;EAAC;EAAc;EAAmB;EAAoB;CAAc,CACtE;CAEA,MAAMnC,mBAAmBoC,MAAMpC,cAAc;CAC7C,MAAMG,cAAciC,MAAMjC,SAAS,CAAA;CACnC,MAAMoC,2BAA2BH,MAAMjC,UAAUqC,KAAAA;CACjD,MAAMC,cAAcpC,MAAS0B,UAC3BK,MAAMhC,SAASC,IAAI,KAAKyB,eAAezB,MA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bsContext\n value={{\n isDisabled,\n onAction: local.onAction,\n registerStaticItem,\n staticItemCount,\n resetStaticItems,\n setStaticItemCount,\n }}\n >\n {/*\n Faithful to react-aria-components Breadcrumbs: the accessible name (navProps'\n aria-label) sits directly on the <ol> (role=\"list\"), with NO wrapping <nav>\n landmark (react-spectrum/packages/react-aria-components/src/Breadcrumbs.tsx\n renders `<dom.ol {...mergeProps(DOMProps, navProps)} style={props.style}>`).\n The <ol> carries ONLY the consumer's class/style — no hard-coded inline\n layout reset. An inline reset would beat the styled layer's class (inline\n wins over class), which is exactly what broke S2 parity: the solid-spectrum\n `wrapperStyles` class supplies display:flex / list-style:none / padding:0 /\n marginStart and deliberately leaves align-items at its `normal` default, so\n a hard-coded inline `align-items:center` + `margin:0` clobbered the\n wrapper's margin and diverged from S2 (whose <ol> has neither).\n */}\n <ol\n {...navProps}\n {...domProps()}\n ref={(element) => assignRef(local.ref, element)}\n class={renderProps.class()}\n style={renderProps.style()}\n data-disabled={dataAttr(isDisabled())}\n >\n <Show\n when={hasCollectionItems()}\n fallback={<StaticBreadcrumbItems>{local.children as JSX.Element}</StaticBreadcrumbItems>}\n >\n <For each={items()}>\n {(item, index) => {\n const itemKey = getItemKey(item, index());\n const isLast = () => index() === items().length - 1;\n const renderItem = local.children as ((item: T) => JSX.Element) | undefined;\n\n return (\n <li style={{ display: \"flex\", \"align-items\": \"center\" }}>\n <BreadcrumbItemContext value={{ itemKey, isLast }}>\n {renderItem?.(item)}\n </BreadcrumbItemContext>\n </li>\n );\n }}\n </For>\n </Show>\n </ol>\n </BreadcrumbsContext>","ref={(element) => assignRef(local.ref, element)}","<Show\n when={hasCollectionItems()}\n fallback={<StaticBreadcrumbItems>{local.children as JSX.Element}</StaticBreadcrumbItems>}\n >\n <For each={items()}>\n {(item, index) => {\n const itemKey = getItemKey(item, index());\n const isLast = () => index() === items().length - 1;\n const renderItem = local.children as ((item: T) => JSX.Element) | undefined;\n\n return (\n <li style={{ display: \"flex\", \"align-items\": \"center\" }}>\n <BreadcrumbItemContext value={{ itemKey, isLast }}>\n {renderItem?.(item)}\n </BreadcrumbItemContext>\n </li>\n );\n }}\n </For>\n </Show>","<StaticBreadcrumbItems>{local.children as JSX.Element}</StaticBreadcrumbItems>","<For each={items()}>\n {(item, index) => {\n const itemKey = getItemKey(item, index());\n const isLast = () => index() === items().length - 1;\n const renderItem = local.children as ((item: T) => JSX.Element) | undefined;\n\n return (\n <li style={{ display: \"flex\", \"align-items\": \"center\" }}>\n <BreadcrumbItemContext value={{ itemKey, isLast }}>\n {renderItem?.(item)}\n </BreadcrumbItemContext>\n </li>\n );\n }}\n </For>","<BreadcrumbItemContext value={{ itemKey, isLast }}>\n {renderItem?.(item)}\n </BreadcrumbItemContext>","value={{ itemKey, isLast }}","<li style={{ display: \"flex\", \"align-items\": \"center\" }}>\n <BreadcrumbItemContext value={{ itemKey, isLast }}>\n {renderItem?.(item)}\n </BreadcrumbItemContext>\n </li>","<ol\n {...navProps}\n {...domProps()}\n ref={(element) => assignRef(local.ref, element)}\n class={renderProps.class()}\n style={renderProps.style()}\n data-disabled={dataAttr(isDisabled())}\n >\n <Show\n when={hasCollectionItems()}\n fallback={<StaticBreadcrumbItems>{local.children as JSX.Element}</StaticBreadcrumbItems>}\n >\n <For each={items()}>\n {(item, index) => {\n const itemKey = getItemKey(item, index());\n const isLast = () => index() === items().length - 1;\n const renderItem = local.children as ((item: T) => JSX.Element) | undefined;\n\n return (\n <li style={{ display: \"flex\", \"align-items\": \"center\" }}>\n <BreadcrumbItemContext value={{ itemKey, isLast }}>\n {renderItem?.(item)}\n </BreadcrumbItemContext>\n </li>\n );\n }}\n </For>\n </Show>\n </ol>","<For each={childArray()}>\n {(child) => <li style={{ display: \"flex\", \"align-items\": \"center\" }}>{child}</li>}\n </For>","<ElementTag\n tag={elementType()}\n {...mergedItemProps()}\n ref={(element: HTMLElement) => assignRef(local.ref, element)}\n aria-current={isCurrent() ? (ariaProps[\"aria-current\"] ?? \"page\") : undefined}\n aria-disabled={attrTrue(isDisabled() || isCurrent())}\n class={renderProps.class()}\n style={mergedStyle()}\n data-current={dataAttr(isCurrent())}\n data-disabled={dataAttr(isDisabled())}\n data-pressed={dataAttr(isPressed())}\n data-focused={dataAttr(isFocused())}\n data-focus-visible={dataAttr(isFocusVisible())}\n data-hovered={dataAttr(isHovered())}\n >\n {renderProps.renderChildren()}\n </ElementTag>","ref={(element: HTMLElement) => assignRef(local.ref, element)}","isCurrent() ? (ariaProps[\"aria-current\"] ?? \"page\") : undefined"],"sources":["../src/Breadcrumbs.tsx"],"sourcesContent":["/*\n * Copyright 2022 Adobe. All rights reserved.\n * This file is licensed to you under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License. You may obtain a copy\n * of the License at http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software distributed under\n * the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\n * OF ANY KIND, either express or implied. See the License for the specific language\n * governing permissions and limitations under the License.\n */\n\n// Ported to SolidJS for Proyecto Viviana; based on packages/react-aria-components/src/Breadcrumbs.tsx\n\n/**\n * Breadcrumbs component for solidaria-components\n *\n * A pre-wired headless breadcrumbs component that combines aria hooks.\n * Port of react-aria-components Breadcrumbs.\n */\n\nimport {\n createContext,\n createMemo,\n createSignal,\n children as resolveChildren,\n useContext,\n For,\n Show,\n} from \"solid-js\";\nimport type { Accessor } from \"solid-js\";\nimport type { JSX } from \"@solidjs/web\";\nimport { ElementTag } from \"./ElementTag\";\nimport {\n createBreadcrumbs,\n createBreadcrumbItem,\n createFocusRing,\n createHover,\n mergeProps,\n type AriaBreadcrumbsProps,\n type AriaBreadcrumbItemProps,\n type PressEvent,\n} from \"@proyecto-viviana/solidaria\";\nimport { splitProps } from \"@proyecto-viviana/solidaria/utils\";\nimport {\n type RenderChildren,\n type ClassNameOrFunction,\n type StyleOrFunction,\n type SlotProps,\n useRenderProps,\n filterDOMProps,\n dataAttr,\n attrTrue,\n} from \"./utils\";\n\ntype RefLike<T> = ((el: T) => void) | { current?: T | null } | undefined;\n\nfunction assignRef<T>(ref: RefLike<T>, el: T): void {\n if (!ref) {\n return;\n }\n\n if (typeof ref === \"function\") {\n ref(el);\n } else {\n ref.current = el;\n }\n}\n\nexport interface BreadcrumbsRenderProps {\n /** Whether the breadcrumbs are disabled. */\n isDisabled: boolean;\n}\n\nexport interface BreadcrumbsProps<T> extends Omit<AriaBreadcrumbsProps, \"isDisabled\">, SlotProps {\n /** The items to render in the breadcrumbs. */\n items?: T[];\n /** Function to get the key from an item. */\n getKey?: (item: T) => string | number;\n /** Whether the breadcrumbs are disabled. */\n isDisabled?: boolean;\n /** Handler called when a breadcrumb item is activated. */\n onAction?: (key: string | number) => void;\n /** The children of the component, or a render function for collection items. */\n children?: JSX.Element | ((item: T) => JSX.Element);\n /** The CSS className for the element. */\n class?: ClassNameOrFunction<BreadcrumbsRenderProps>;\n /** The inline style for the element. */\n style?: StyleOrFunction<BreadcrumbsRenderProps>;\n /** Ref for the navigation element. */\n ref?: RefLike<HTMLElement>;\n}\n\nexport interface BreadcrumbItemRenderProps {\n /** Whether this is the current/last item. */\n isCurrent: boolean;\n /** Whether the item is disabled. */\n isDisabled: boolean;\n /** Whether the item is pressed. */\n isPressed: boolean;\n /** Whether the item is focused. */\n isFocused: boolean;\n /** Whether the item has visible focus ring. */\n isFocusVisible: boolean;\n /** Whether the item is hovered. */\n isHovered: boolean;\n}\n\nexport interface BreadcrumbItemProps\n extends Omit<AriaBreadcrumbItemProps, \"isDisabled\">, SlotProps {\n /** The children of the breadcrumb item. */\n children?: RenderChildren<BreadcrumbItemRenderProps>;\n /** The CSS className for the element. */\n class?: ClassNameOrFunction<BreadcrumbItemRenderProps>;\n /** The inline style for the element. */\n style?: StyleOrFunction<BreadcrumbItemRenderProps>;\n /** Whether this item is disabled. */\n isDisabled?: boolean;\n /** Ref for the breadcrumb item element. */\n ref?: RefLike<HTMLElement>;\n}\n\ninterface BreadcrumbsContextValue {\n isDisabled: Accessor<boolean>;\n onAction?: (key: string | number) => void;\n registerStaticItem?: () => number;\n staticItemCount?: Accessor<number>;\n resetStaticItems?: () => void;\n setStaticItemCount?: (count: number) => void;\n}\n\nexport const BreadcrumbsContext = createContext<BreadcrumbsContextValue | null>(null);\n\ninterface BreadcrumbItemContextValue {\n itemKey: string | number | null;\n isLast: Accessor<boolean>;\n}\n\nexport const BreadcrumbItemContext = createContext<BreadcrumbItemContextValue | null>(null);\n\nfunction defaultItemKey(item: unknown, index: number): string | number {\n const maybeItem = item as { key?: string | number; id?: string | number };\n return maybeItem.key ?? maybeItem.id ?? index;\n}\n\n/**\n * Breadcrumbs show hierarchy and navigational context for a user's location within an application.\n */\nexport function Breadcrumbs<T>(props: BreadcrumbsProps<T>): JSX.Element {\n const [local, ariaProps, rest] = splitProps(\n props,\n [\"children\", \"class\", \"style\", \"slot\", \"items\", \"getKey\", \"isDisabled\", \"onAction\", \"ref\"],\n [\"aria-label\", \"aria-labelledby\", \"aria-describedby\", \"aria-details\"],\n );\n\n const isDisabled = () => local.isDisabled ?? false;\n const items = () => local.items ?? [];\n const hasCollectionItems = () => local.items !== undefined;\n const getItemKey = (item: T, index: number): string | number =>\n local.getKey?.(item) ?? defaultItemKey(item, index);\n const [staticItemCount, setStaticItemCount] = createSignal(0, { ownedWrite: true });\n let nextStaticIndex = 0;\n const resetStaticItems = () => {\n nextStaticIndex = 0;\n setStaticItemCount(0);\n };\n const registerStaticItem = () => {\n const index = nextStaticIndex;\n nextStaticIndex += 1;\n return index;\n };\n\n const { navProps } = createBreadcrumbs({\n get \"aria-label\"() {\n return ariaProps[\"aria-label\"];\n },\n get \"aria-labelledby\"() {\n return ariaProps[\"aria-labelledby\"];\n },\n get \"aria-describedby\"() {\n return ariaProps[\"aria-describedby\"];\n },\n get isDisabled() {\n return isDisabled();\n },\n });\n\n const renderValues = createMemo<BreadcrumbsRenderProps>(() => ({\n isDisabled: isDisabled(),\n }));\n\n const renderProps = useRenderProps(\n {\n class: local.class,\n style: local.style,\n defaultClassName: \"solidaria-Breadcrumbs\",\n },\n renderValues,\n );\n\n const domProps = createMemo(() =>\n filterDOMProps(rest as Record<string, unknown>, { global: true }),\n );\n return (\n <BreadcrumbsContext\n value={{\n isDisabled,\n onAction: local.onAction,\n registerStaticItem,\n staticItemCount,\n resetStaticItems,\n setStaticItemCount,\n }}\n >\n {/*\n Faithful to react-aria-components Breadcrumbs: the accessible name (navProps'\n aria-label) sits directly on the <ol> (role=\"list\"), with NO wrapping <nav>\n landmark (react-spectrum/packages/react-aria-components/src/Breadcrumbs.tsx\n renders `<dom.ol {...mergeProps(DOMProps, navProps)} style={props.style}>`).\n The <ol> carries ONLY the consumer's class/style — no hard-coded inline\n layout reset. An inline reset would beat the styled layer's class (inline\n wins over class), which is exactly what broke S2 parity: the solid-spectrum\n `wrapperStyles` class supplies display:flex / list-style:none / padding:0 /\n marginStart and deliberately leaves align-items at its `normal` default, so\n a hard-coded inline `align-items:center` + `margin:0` clobbered the\n wrapper's margin and diverged from S2 (whose <ol> has neither).\n */}\n <ol\n {...navProps}\n {...domProps()}\n ref={(element) => assignRef(local.ref, element)}\n class={renderProps.class()}\n style={renderProps.style()}\n data-disabled={dataAttr(isDisabled())}\n >\n <Show\n when={hasCollectionItems()}\n fallback={<StaticBreadcrumbItems>{local.children as JSX.Element}</StaticBreadcrumbItems>}\n >\n <For each={items()}>\n {(item, index) => {\n const itemKey = getItemKey(item, index());\n const isLast = () => index() === items().length - 1;\n const renderItem = local.children as ((item: T) => JSX.Element) | undefined;\n\n return (\n <li style={{ display: \"flex\", \"align-items\": \"center\" }}>\n <BreadcrumbItemContext value={{ itemKey, isLast }}>\n {renderItem?.(item)}\n </BreadcrumbItemContext>\n </li>\n );\n }}\n </For>\n </Show>\n </ol>\n </BreadcrumbsContext>\n );\n}\n\nfunction StaticBreadcrumbItems(props: { children?: JSX.Element }): JSX.Element {\n const context = useContext(BreadcrumbsContext);\n const staticChildren = resolveChildren(() => props.children);\n const childArray = createMemo(() => {\n context?.resetStaticItems?.();\n const array = staticChildren.toArray();\n context?.setStaticItemCount?.(array.length);\n return array;\n });\n\n return (\n <For each={childArray()}>\n {(child) => <li style={{ display: \"flex\", \"align-items\": \"center\" }}>{child}</li>}\n </For>\n );\n}\n\n/**\n * A BreadcrumbItem represents an individual breadcrumb in the navigation trail.\n */\nexport function BreadcrumbItem(props: BreadcrumbItemProps): JSX.Element {\n const [local, ariaProps] = splitProps(props, [\"class\", \"style\", \"slot\", \"isDisabled\", \"ref\"]);\n\n const context = useContext(BreadcrumbsContext);\n const itemContext = useContext(BreadcrumbItemContext);\n const staticIndex = itemContext ? null : context?.registerStaticItem?.();\n const isDisabled = () => local.isDisabled ?? context?.isDisabled() ?? false;\n const isCurrent = () =>\n ariaProps.isCurrent ??\n itemContext?.isLast() ??\n (staticIndex !== null &&\n staticIndex !== undefined &&\n context?.staticItemCount !== undefined &&\n staticIndex === context.staticItemCount() - 1);\n const itemKey = () => itemContext?.itemKey ?? ariaProps.id ?? null;\n\n // Mirror react-aria-components' Link: render an <a> only when there is an\n // href on an enabled, non-current item; otherwise fall back to a <span\n // role=\"link\"> (via createLink). A styled layer may force the element type\n // (S2 renders the current item as a plain <div>), which takes precedence.\n const elementType = () =>\n ariaProps.elementType ?? (ariaProps.href && !isDisabled() && !isCurrent() ? \"a\" : \"span\");\n // The current breadcrumb is the current page and is non-interactive: S2\n // renders it as a plain element with no link role. createLink only omits\n // role=\"link\" for an <a>, so treat the current item as an \"a\" purely for the\n // role decision while still rendering the resolved element type above.\n const linkElementType = () => (isCurrent() ? \"a\" : elementType());\n\n const handlePress = (e: PressEvent) => {\n ariaProps.onPress?.(e);\n const key = itemKey();\n if (key !== null && !isCurrent() && !isDisabled()) {\n context?.onAction?.(key);\n }\n };\n\n const itemAria = createBreadcrumbItem({\n get id() {\n return ariaProps.id;\n },\n get isCurrent() {\n return isCurrent();\n },\n get isDisabled() {\n return isDisabled();\n },\n get href() {\n return ariaProps.href;\n },\n get target() {\n return ariaProps.target;\n },\n get rel() {\n return ariaProps.rel;\n },\n get elementType() {\n return linkElementType();\n },\n get onPress() {\n return handlePress;\n },\n get onPressStart() {\n return ariaProps.onPressStart;\n },\n get onPressEnd() {\n return ariaProps.onPressEnd;\n },\n get onClick() {\n return ariaProps.onClick;\n },\n get onFocus() {\n return ariaProps.onFocus;\n },\n get onBlur() {\n return ariaProps.onBlur;\n },\n get onFocusChange() {\n return ariaProps.onFocusChange;\n },\n get onKeyDown() {\n return ariaProps.onKeyDown;\n },\n get onKeyUp() {\n return ariaProps.onKeyUp;\n },\n get autoFocus() {\n return ariaProps.autoFocus;\n },\n get \"aria-label\"() {\n return ariaProps[\"aria-label\"];\n },\n get \"aria-labelledby\"() {\n return ariaProps[\"aria-labelledby\"];\n },\n get \"aria-describedby\"() {\n return ariaProps[\"aria-describedby\"];\n },\n get \"aria-details\"() {\n return ariaProps[\"aria-details\"];\n },\n get \"aria-current\"() {\n return ariaProps[\"aria-current\"];\n },\n });\n\n const isPressed = itemAria.isPressed;\n const { isFocused, isFocusVisible, focusProps } = createFocusRing();\n const { isHovered, hoverProps } = createHover({\n get isDisabled() {\n return isDisabled();\n },\n });\n // Read itemAria.itemProps fresh inside the memo (do NOT destructure it above):\n // the reactive getter re-runs createBreadcrumbItem → createLink each time this\n // memo re-evaluates, so role/tabIndex track elementType once isCurrent settles.\n const mergedItemProps = createMemo(() =>\n mergeProps(\n itemAria.itemProps as Record<string, unknown>,\n focusProps as Record<string, unknown>,\n hoverProps as Record<string, unknown>,\n ),\n );\n\n const renderValues = createMemo<BreadcrumbItemRenderProps>(() => ({\n isCurrent: isCurrent(),\n isDisabled: isDisabled(),\n isPressed: isPressed(),\n isFocused: isFocused(),\n isFocusVisible: isFocusVisible(),\n isHovered: isHovered(),\n }));\n\n const renderProps = useRenderProps(\n {\n get children() {\n return props.children;\n },\n class: local.class,\n style: local.style,\n defaultClassName: \"solidaria-BreadcrumbItem\",\n },\n renderValues,\n );\n\n const mergedStyle = () => {\n const userStyle = renderProps.style();\n const baseStyle = { display: \"inline-flex\", \"align-items\": \"center\" };\n return userStyle ? { ...baseStyle, ...userStyle } : baseStyle;\n };\n\n return (\n <ElementTag\n tag={elementType()}\n {...mergedItemProps()}\n ref={(element: HTMLElement) => assignRef(local.ref, element)}\n aria-current={isCurrent() ? (ariaProps[\"aria-current\"] ?? \"page\") : undefined}\n aria-disabled={attrTrue(isDisabled() || isCurrent())}\n class={renderProps.class()}\n style={mergedStyle()}\n data-current={dataAttr(isCurrent())}\n data-disabled={dataAttr(isDisabled())}\n data-pressed={dataAttr(isPressed())}\n data-focused={dataAttr(isFocused())}\n data-focus-visible={dataAttr(isFocusVisible())}\n data-hovered={dataAttr(isHovered())}\n >\n {renderProps.renderChildren()}\n </ElementTag>\n );\n}\n\nBreadcrumbs.Item = BreadcrumbItem;\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;AAyDA,SAAS,YAAa,KAAiB,IAAa;CAClD,IAAI,CAAC,KACH;CAGF,IAAI,OAAO,QAAQ,YACjB,IAAI,EAAE;MAEN,IAAI,UAAU;AAElB;AAgEA,MAAa,qBAAqB,cAA8C,IAAI;AAOpF,MAAa,wBAAwB,cAAiD,IAAI;AAE1F,SAAS,eAAe,MAAe,OAAgC;CACrE,MAAM,YAAY;CAClB,OAAO,UAAU,OAAO,UAAU,MAAM;AAC1C;;;;AAKA,SAAgB,YAAe,OAAyC;CACtE,MAAM,CAAC,OAAO,WAAW,QAAQ,WAC/B,OACA;EAAC;EAAY;EAAS;EAAS;EAAQ;EAAS;EAAU;EAAc;EAAY;CAAK,GACzF;EAAC;EAAc;EAAmB;EAAoB;CAAc,CACtE;CAEA,MAAM,mBAAmB,MAAM,cAAc;CAC7C,MAAM,cAAc,MAAM,SAAS,CAAC;CACpC,MAAM,2BAA2B,MAAM,UAAU,KAAA;CACjD,MAAM,cAAc,MAAS,UAC3B,MAAM,SAAS,IAAI,KAAK,eAAe,MAAM,KAAK;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EAC1B,IAAA,QAAA;GAAO,OAAA,YAAY;EAAC;EACpB,IAAA,iBAAA;GAAc,OAAA,SAAS,UAAU,CAAC;EAAC;EACnC,IAAA,kBAAA;GAAe,OAAA,SAAS,WAAW,CAAC;EAAC;EACrC,IAAA,iBAAA;GAAc,OAAA,SAAS,UAAU,CAAC;EAAC;EACnC,IAAA,iBAAA;GAAc,OAAA,SAAS,UAAU,CAAC;EAAC;EACnC,IAAA,uBAAA;GAAoB,OAAA,SAAS,eAAe,CAAC;EAAC;EAC9C,IAAA,iBAAA;GAAc,OAAA,SAAS,UAAU,CAAC;EAAC;EAbrC,IAAA,WAAA;GAeG,OAAA,YAAY,eAAe;EAClB;;AAEhB;AAEA,YAAY,OAAO"}
|
package/dist/Breadcrumbs.jsx
CHANGED
|
@@ -1,7 +1,20 @@
|
|
|
1
|
-
|
|
1
|
+
/*
|
|
2
|
+
* Copyright 2022 Adobe. All rights reserved.
|
|
3
|
+
* This file is licensed to you under the Apache License, Version 2.0 (the "License");
|
|
4
|
+
* you may not use this file except in compliance with the License. You may obtain a copy
|
|
5
|
+
* of the License at http://www.apache.org/licenses/LICENSE-2.0
|
|
6
|
+
*
|
|
7
|
+
* Unless required by applicable law or agreed to in writing, software distributed under
|
|
8
|
+
* the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
|
|
9
|
+
* OF ANY KIND, either express or implied. See the License for the specific language
|
|
10
|
+
* governing permissions and limitations under the License.
|
|
11
|
+
*/
|
|
12
|
+
// Ported to SolidJS for Proyecto Viviana; based on packages/react-aria-components/src/Breadcrumbs.tsx
|
|
13
|
+
import { attrTrue, dataAttr, filterDOMProps, useRenderProps } from "./utils.jsx";
|
|
2
14
|
import { ElementTag } from "./ElementTag.jsx";
|
|
3
|
-
import { For, Show, children, createContext, createMemo, createSignal,
|
|
4
|
-
import { createBreadcrumbItem, createBreadcrumbs, createFocusRing, createHover, mergeProps
|
|
15
|
+
import { For, Show, children, createContext, createMemo, createSignal, useContext } from "solid-js";
|
|
16
|
+
import { createBreadcrumbItem, createBreadcrumbs, createFocusRing, createHover, mergeProps } from "@proyecto-viviana/solidaria";
|
|
17
|
+
import { splitProps } from "@proyecto-viviana/solidaria/utils";
|
|
5
18
|
//#region src/Breadcrumbs.tsx
|
|
6
19
|
/**
|
|
7
20
|
* Breadcrumbs component for solidaria-components
|
|
@@ -9,7 +22,7 @@ import { createBreadcrumbItem, createBreadcrumbs, createFocusRing, createHover,
|
|
|
9
22
|
* A pre-wired headless breadcrumbs component that combines aria hooks.
|
|
10
23
|
* Port of react-aria-components Breadcrumbs.
|
|
11
24
|
*/
|
|
12
|
-
function assignRef(ref, el) {
|
|
25
|
+
function assignRef$1(ref, el) {
|
|
13
26
|
if (!ref) return;
|
|
14
27
|
if (typeof ref === "function") ref(el);
|
|
15
28
|
else ref.current = el;
|
|
@@ -44,7 +57,7 @@ function Breadcrumbs(props) {
|
|
|
44
57
|
const items = () => local.items ?? [];
|
|
45
58
|
const hasCollectionItems = () => local.items !== void 0;
|
|
46
59
|
const getItemKey = (item, index) => local.getKey?.(item) ?? defaultItemKey(item, index);
|
|
47
|
-
const [staticItemCount, setStaticItemCount] = createSignal(0);
|
|
60
|
+
const [staticItemCount, setStaticItemCount] = createSignal(0, { ownedWrite: true });
|
|
48
61
|
let nextStaticIndex = 0;
|
|
49
62
|
const resetStaticItems = () => {
|
|
50
63
|
nextStaticIndex = 0;
|
|
@@ -76,7 +89,7 @@ function Breadcrumbs(props) {
|
|
|
76
89
|
defaultClassName: "solidaria-Breadcrumbs"
|
|
77
90
|
}, renderValues);
|
|
78
91
|
const domProps = createMemo(() => filterDOMProps(rest, { global: true }));
|
|
79
|
-
return <BreadcrumbsContext
|
|
92
|
+
return <BreadcrumbsContext value={{
|
|
80
93
|
isDisabled,
|
|
81
94
|
onAction: local.onAction,
|
|
82
95
|
registerStaticItem,
|
|
@@ -85,7 +98,7 @@ function Breadcrumbs(props) {
|
|
|
85
98
|
setStaticItemCount
|
|
86
99
|
}}>
|
|
87
100
|
{}
|
|
88
|
-
<ol {...navProps} {...domProps()} ref={(element) => assignRef(local.ref, element)} class={renderProps.class()} style={renderProps.style()} data-disabled={isDisabled()
|
|
101
|
+
<ol {...navProps} {...domProps()} ref={(element) => assignRef$1(local.ref, element)} class={renderProps.class()} style={renderProps.style()} data-disabled={dataAttr(isDisabled())}>
|
|
89
102
|
<Show when={hasCollectionItems()} fallback={<StaticBreadcrumbItems>{local.children}</StaticBreadcrumbItems>}>
|
|
90
103
|
<For each={items()}>
|
|
91
104
|
{(item, index) => {
|
|
@@ -96,18 +109,18 @@ function Breadcrumbs(props) {
|
|
|
96
109
|
display: "flex",
|
|
97
110
|
"align-items": "center"
|
|
98
111
|
}}>
|
|
99
|
-
<BreadcrumbItemContext
|
|
112
|
+
<BreadcrumbItemContext value={{
|
|
100
113
|
itemKey,
|
|
101
114
|
isLast
|
|
102
115
|
}}>
|
|
103
116
|
{renderItem?.(item)}
|
|
104
|
-
</BreadcrumbItemContext
|
|
117
|
+
</BreadcrumbItemContext>
|
|
105
118
|
</li>;
|
|
106
119
|
}}
|
|
107
120
|
</For>
|
|
108
121
|
</Show>
|
|
109
122
|
</ol>
|
|
110
|
-
</BreadcrumbsContext
|
|
123
|
+
</BreadcrumbsContext>;
|
|
111
124
|
}
|
|
112
125
|
function StaticBreadcrumbItems(props) {
|
|
113
126
|
const context = useContext(BreadcrumbsContext);
|
|
@@ -222,7 +235,7 @@ function BreadcrumbItem(props) {
|
|
|
222
235
|
const { isHovered, hoverProps } = createHover({ get isDisabled() {
|
|
223
236
|
return isDisabled();
|
|
224
237
|
} });
|
|
225
|
-
const mergedItemProps = createMemo(() => mergeProps
|
|
238
|
+
const mergedItemProps = createMemo(() => mergeProps(itemAria.itemProps, focusProps, hoverProps));
|
|
226
239
|
const renderValues = createMemo(() => ({
|
|
227
240
|
isCurrent: isCurrent(),
|
|
228
241
|
isDisabled: isDisabled(),
|
|
@@ -250,7 +263,7 @@ function BreadcrumbItem(props) {
|
|
|
250
263
|
...userStyle
|
|
251
264
|
} : baseStyle;
|
|
252
265
|
};
|
|
253
|
-
return <ElementTag tag={elementType()} {...mergedItemProps()} ref={(element) => assignRef(local.ref, element)} aria-current={isCurrent() ? ariaProps["aria-current"] ?? "page" : void 0} aria-disabled={isDisabled() || isCurrent()
|
|
266
|
+
return <ElementTag tag={elementType()} {...mergedItemProps()} ref={(element) => assignRef$1(local.ref, element)} aria-current={isCurrent() ? ariaProps["aria-current"] ?? "page" : void 0} aria-disabled={attrTrue(isDisabled() || isCurrent())} class={renderProps.class()} style={mergedStyle()} data-current={dataAttr(isCurrent())} data-disabled={dataAttr(isDisabled())} data-pressed={dataAttr(isPressed())} data-focused={dataAttr(isFocused())} data-focus-visible={dataAttr(isFocusVisible())} data-hovered={dataAttr(isHovered())}>
|
|
254
267
|
{renderProps.renderChildren()}
|
|
255
268
|
</ElementTag>;
|
|
256
269
|
}
|
package/dist/Breadcrumbs.jsx.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Breadcrumbs.jsx","names":["resolveChildren","mergeProps"],"sources":["../src/Breadcrumbs.tsx"],"sourcesContent":["/**\n * Breadcrumbs component for solidaria-components\n *\n * A pre-wired headless breadcrumbs component that combines aria hooks.\n * Port of react-aria-components Breadcrumbs.\n */\n\nimport {\n type Accessor,\n type JSX,\n createContext,\n createMemo,\n createSignal,\n children as resolveChildren,\n splitProps,\n useContext,\n For,\n Show,\n} from \"solid-js\";\nimport { ElementTag } from \"./ElementTag\";\nimport {\n createBreadcrumbs,\n createBreadcrumbItem,\n createFocusRing,\n createHover,\n mergeProps,\n type AriaBreadcrumbsProps,\n type AriaBreadcrumbItemProps,\n type PressEvent,\n} from \"@proyecto-viviana/solidaria\";\nimport {\n type RenderChildren,\n type ClassNameOrFunction,\n type StyleOrFunction,\n type SlotProps,\n useRenderProps,\n filterDOMProps,\n} from \"./utils\";\n\ntype RefLike<T> = ((el: T) => void) | { current?: T | null } | undefined;\n\nfunction assignRef<T>(ref: RefLike<T>, el: T): void {\n if (!ref) {\n return;\n }\n\n if (typeof ref === \"function\") {\n ref(el);\n } else {\n ref.current = el;\n }\n}\n\nexport interface BreadcrumbsRenderProps {\n /** Whether the breadcrumbs are disabled. */\n isDisabled: boolean;\n}\n\nexport interface BreadcrumbsProps<T> extends Omit<AriaBreadcrumbsProps, \"isDisabled\">, SlotProps {\n /** The items to render in the breadcrumbs. */\n items?: T[];\n /** Function to get the key from an item. */\n getKey?: (item: T) => string | number;\n /** Whether the breadcrumbs are disabled. */\n isDisabled?: boolean;\n /** Handler called when a breadcrumb item is activated. */\n onAction?: (key: string | number) => void;\n /** The children of the component, or a render function for collection items. */\n children?: JSX.Element | ((item: T) => JSX.Element);\n /** The CSS className for the element. */\n class?: ClassNameOrFunction<BreadcrumbsRenderProps>;\n /** The inline style for the element. */\n style?: StyleOrFunction<BreadcrumbsRenderProps>;\n /** Ref for the navigation element. */\n ref?: RefLike<HTMLElement>;\n}\n\nexport interface BreadcrumbItemRenderProps {\n /** Whether this is the current/last item. */\n isCurrent: boolean;\n /** Whether the item is disabled. */\n isDisabled: boolean;\n /** Whether the item is pressed. */\n isPressed: boolean;\n /** Whether the item is focused. */\n isFocused: boolean;\n /** Whether the item has visible focus ring. */\n isFocusVisible: boolean;\n /** Whether the item is hovered. */\n isHovered: boolean;\n}\n\nexport interface BreadcrumbItemProps\n extends Omit<AriaBreadcrumbItemProps, \"isDisabled\">, SlotProps {\n /** The children of the breadcrumb item. */\n children?: RenderChildren<BreadcrumbItemRenderProps>;\n /** The CSS className for the element. */\n class?: ClassNameOrFunction<BreadcrumbItemRenderProps>;\n /** The inline style for the element. */\n style?: StyleOrFunction<BreadcrumbItemRenderProps>;\n /** Whether this item is disabled. */\n isDisabled?: boolean;\n /** Ref for the breadcrumb item element. */\n ref?: RefLike<HTMLElement>;\n}\n\ninterface BreadcrumbsContextValue {\n isDisabled: Accessor<boolean>;\n onAction?: (key: string | number) => void;\n registerStaticItem?: () => number;\n staticItemCount?: Accessor<number>;\n resetStaticItems?: () => void;\n setStaticItemCount?: (count: number) => void;\n}\n\nexport const BreadcrumbsContext = createContext<BreadcrumbsContextValue | null>(null);\n\ninterface BreadcrumbItemContextValue {\n itemKey: string | number | null;\n isLast: Accessor<boolean>;\n}\n\nexport const BreadcrumbItemContext = createContext<BreadcrumbItemContextValue | null>(null);\n\nfunction defaultItemKey(item: unknown, index: number): string | number {\n const maybeItem = item as { key?: string | number; id?: string | number };\n return maybeItem.key ?? maybeItem.id ?? index;\n}\n\n/**\n * Breadcrumbs show hierarchy and navigational context for a user's location within an application.\n */\nexport function Breadcrumbs<T>(props: BreadcrumbsProps<T>): JSX.Element {\n const [local, ariaProps, rest] = splitProps(\n props,\n [\"children\", \"class\", \"style\", \"slot\", \"items\", \"getKey\", \"isDisabled\", \"onAction\", \"ref\"],\n [\"aria-label\", \"aria-labelledby\", \"aria-describedby\", \"aria-details\"],\n );\n\n const isDisabled = () => local.isDisabled ?? false;\n const items = () => local.items ?? [];\n const hasCollectionItems = () => local.items !== undefined;\n const getItemKey = (item: T, index: number): string | number =>\n local.getKey?.(item) ?? defaultItemKey(item, index);\n const [staticItemCount, setStaticItemCount] = createSignal(0);\n let nextStaticIndex = 0;\n const resetStaticItems = () => {\n nextStaticIndex = 0;\n setStaticItemCount(0);\n };\n const registerStaticItem = () => {\n const index = nextStaticIndex;\n nextStaticIndex += 1;\n return index;\n };\n\n const { navProps } = createBreadcrumbs({\n get \"aria-label\"() {\n return ariaProps[\"aria-label\"];\n },\n get \"aria-labelledby\"() {\n return ariaProps[\"aria-labelledby\"];\n },\n get \"aria-describedby\"() {\n return ariaProps[\"aria-describedby\"];\n },\n get isDisabled() {\n return isDisabled();\n },\n });\n\n const renderValues = createMemo<BreadcrumbsRenderProps>(() => ({\n isDisabled: isDisabled(),\n }));\n\n const renderProps = useRenderProps(\n {\n class: local.class,\n style: local.style,\n defaultClassName: \"solidaria-Breadcrumbs\",\n },\n renderValues,\n );\n\n const domProps = createMemo(() =>\n filterDOMProps(rest as Record<string, unknown>, { global: true }),\n );\n return (\n <BreadcrumbsContext.Provider\n value={{\n isDisabled,\n onAction: local.onAction,\n registerStaticItem,\n staticItemCount,\n resetStaticItems,\n setStaticItemCount,\n }}\n >\n {/*\n Faithful to react-aria-components Breadcrumbs: the accessible name (navProps'\n aria-label) sits directly on the <ol> (role=\"list\"), with NO wrapping <nav>\n landmark (react-spectrum/packages/react-aria-components/src/Breadcrumbs.tsx\n renders `<dom.ol {...mergeProps(DOMProps, navProps)} style={props.style}>`).\n The <ol> carries ONLY the consumer's class/style — no hard-coded inline\n layout reset. An inline reset would beat the styled layer's class (inline\n wins over class), which is exactly what broke S2 parity: the solid-spectrum\n `wrapperStyles` class supplies display:flex / list-style:none / padding:0 /\n marginStart and deliberately leaves align-items at its `normal` default, so\n a hard-coded inline `align-items:center` + `margin:0` clobbered the\n wrapper's margin and diverged from S2 (whose <ol> has neither).\n */}\n <ol\n {...navProps}\n {...domProps()}\n ref={(element) => assignRef(local.ref, element)}\n class={renderProps.class()}\n style={renderProps.style()}\n data-disabled={isDisabled() || undefined}\n >\n <Show\n when={hasCollectionItems()}\n fallback={<StaticBreadcrumbItems>{local.children as JSX.Element}</StaticBreadcrumbItems>}\n >\n <For each={items()}>\n {(item, index) => {\n const itemKey = getItemKey(item, index());\n const isLast = () => index() === items().length - 1;\n const renderItem = local.children as ((item: T) => JSX.Element) | undefined;\n\n return (\n <li style={{ display: \"flex\", \"align-items\": \"center\" }}>\n <BreadcrumbItemContext.Provider value={{ itemKey, isLast }}>\n {renderItem?.(item)}\n </BreadcrumbItemContext.Provider>\n </li>\n );\n }}\n </For>\n </Show>\n </ol>\n </BreadcrumbsContext.Provider>\n );\n}\n\nfunction StaticBreadcrumbItems(props: { children?: JSX.Element }): JSX.Element {\n const context = useContext(BreadcrumbsContext);\n const staticChildren = resolveChildren(() => props.children);\n const childArray = createMemo(() => {\n context?.resetStaticItems?.();\n const array = staticChildren.toArray();\n context?.setStaticItemCount?.(array.length);\n return array;\n });\n\n return (\n <For each={childArray()}>\n {(child) => <li style={{ display: \"flex\", \"align-items\": \"center\" }}>{child}</li>}\n </For>\n );\n}\n\n/**\n * A BreadcrumbItem represents an individual breadcrumb in the navigation trail.\n */\nexport function BreadcrumbItem(props: BreadcrumbItemProps): JSX.Element {\n const [local, ariaProps] = splitProps(props, [\"class\", \"style\", \"slot\", \"isDisabled\", \"ref\"]);\n\n const context = useContext(BreadcrumbsContext);\n const itemContext = useContext(BreadcrumbItemContext);\n const staticIndex = itemContext ? null : context?.registerStaticItem?.();\n const isDisabled = () => local.isDisabled ?? context?.isDisabled() ?? false;\n const isCurrent = () =>\n ariaProps.isCurrent ??\n itemContext?.isLast() ??\n (staticIndex !== null &&\n staticIndex !== undefined &&\n context?.staticItemCount !== undefined &&\n staticIndex === context.staticItemCount() - 1);\n const itemKey = () => itemContext?.itemKey ?? ariaProps.id ?? null;\n\n // Mirror react-aria-components' Link: render an <a> only when there is an\n // href on an enabled, non-current item; otherwise fall back to a <span\n // role=\"link\"> (via createLink). A styled layer may force the element type\n // (S2 renders the current item as a plain <div>), which takes precedence.\n const elementType = () =>\n ariaProps.elementType ?? (ariaProps.href && !isDisabled() && !isCurrent() ? \"a\" : \"span\");\n // The current breadcrumb is the current page and is non-interactive: S2\n // renders it as a plain element with no link role. createLink only omits\n // role=\"link\" for an <a>, so treat the current item as an \"a\" purely for the\n // role decision while still rendering the resolved element type above.\n const linkElementType = () => (isCurrent() ? \"a\" : elementType());\n\n const handlePress = (e: PressEvent) => {\n ariaProps.onPress?.(e);\n const key = itemKey();\n if (key !== null && !isCurrent() && !isDisabled()) {\n context?.onAction?.(key);\n }\n };\n\n const itemAria = createBreadcrumbItem({\n get id() {\n return ariaProps.id;\n },\n get isCurrent() {\n return isCurrent();\n },\n get isDisabled() {\n return isDisabled();\n },\n get href() {\n return ariaProps.href;\n },\n get target() {\n return ariaProps.target;\n },\n get rel() {\n return ariaProps.rel;\n },\n get elementType() {\n return linkElementType();\n },\n get onPress() {\n return handlePress;\n },\n get onPressStart() {\n return ariaProps.onPressStart;\n },\n get onPressEnd() {\n return ariaProps.onPressEnd;\n },\n get onClick() {\n return ariaProps.onClick;\n },\n get onFocus() {\n return ariaProps.onFocus;\n },\n get onBlur() {\n return ariaProps.onBlur;\n },\n get onFocusChange() {\n return ariaProps.onFocusChange;\n },\n get onKeyDown() {\n return ariaProps.onKeyDown;\n },\n get onKeyUp() {\n return ariaProps.onKeyUp;\n },\n get autoFocus() {\n return ariaProps.autoFocus;\n },\n get \"aria-label\"() {\n return ariaProps[\"aria-label\"];\n },\n get \"aria-labelledby\"() {\n return ariaProps[\"aria-labelledby\"];\n },\n get \"aria-describedby\"() {\n return ariaProps[\"aria-describedby\"];\n },\n get \"aria-details\"() {\n return ariaProps[\"aria-details\"];\n },\n get \"aria-current\"() {\n return ariaProps[\"aria-current\"];\n },\n });\n\n const isPressed = itemAria.isPressed;\n const { isFocused, isFocusVisible, focusProps } = createFocusRing();\n const { isHovered, hoverProps } = createHover({\n get isDisabled() {\n return isDisabled();\n },\n });\n // Read itemAria.itemProps fresh inside the memo (do NOT destructure it above):\n // the reactive getter re-runs createBreadcrumbItem → createLink each time this\n // memo re-evaluates, so role/tabIndex track elementType once isCurrent settles.\n const mergedItemProps = createMemo(() =>\n mergeProps(\n itemAria.itemProps as Record<string, unknown>,\n focusProps as Record<string, unknown>,\n hoverProps as Record<string, unknown>,\n ),\n );\n\n const renderValues = createMemo<BreadcrumbItemRenderProps>(() => ({\n isCurrent: isCurrent(),\n isDisabled: isDisabled(),\n isPressed: isPressed(),\n isFocused: isFocused(),\n isFocusVisible: isFocusVisible(),\n isHovered: isHovered(),\n }));\n\n const renderProps = useRenderProps(\n {\n get children() {\n return props.children;\n },\n class: local.class,\n style: local.style,\n defaultClassName: \"solidaria-BreadcrumbItem\",\n },\n renderValues,\n );\n\n const mergedStyle = () => {\n const userStyle = renderProps.style();\n const baseStyle = { display: \"inline-flex\", \"align-items\": \"center\" };\n return userStyle ? { ...baseStyle, ...userStyle } : baseStyle;\n };\n\n return (\n <ElementTag\n tag={elementType()}\n {...mergedItemProps()}\n ref={(element: HTMLElement) => assignRef(local.ref, element)}\n aria-current={isCurrent() ? (ariaProps[\"aria-current\"] ?? \"page\") : undefined}\n aria-disabled={isDisabled() || isCurrent() || undefined}\n class={renderProps.class()}\n style={mergedStyle()}\n data-current={isCurrent() || undefined}\n data-disabled={isDisabled() || undefined}\n data-pressed={isPressed() || undefined}\n data-focused={isFocused() || undefined}\n data-focus-visible={isFocusVisible() || undefined}\n data-hovered={isHovered() || undefined}\n >\n {renderProps.renderChildren()}\n </ElementTag>\n );\n}\n\nBreadcrumbs.Item = BreadcrumbItem;\n"],"mappings":";;;;;;;;;;;AAyCA,SAAS,UAAa,KAAiB,IAAa;CAClD,IAAI,CAAC,KACH;CAGF,IAAI,OAAO,QAAQ,YACjB,IAAI,EAAE;MAEN,IAAI,UAAU;AAElB;AAgEA,MAAa,qBAAqB,cAA8C,IAAI;AAOpF,MAAa,wBAAwB,cAAiD,IAAI;AAE1F,SAAS,eAAe,MAAe,OAAgC;CACrE,MAAM,YAAY;CAClB,OAAO,UAAU,OAAO,UAAU,MAAM;AAC1C;;;;AAKA,SAAgB,YAAe,OAAyC;CACtE,MAAM,CAAC,OAAO,WAAW,QAAQ,WAC/B,OACA;EAAC;EAAY;EAAS;EAAS;EAAQ;EAAS;EAAU;EAAc;EAAY;CAAK,GACzF;EAAC;EAAc;EAAmB;EAAoB;CAAc,CACtE;CAEA,MAAM,mBAAmB,MAAM,cAAc;CAC7C,MAAM,cAAc,MAAM,SAAS,CAAC;CACpC,MAAM,2BAA2B,MAAM,UAAU,KAAA;CACjD,MAAM,cAAc,MAAS,UAC3B,MAAM,SAAS,IAAI,KAAK,eAAe,MAAM,KAAK;CACpD,MAAM,CAAC,iBAAiB,sBAAsB,aAAa,CAAC;CAC5D,IAAI,kBAAkB;CACtB,MAAM,yBAAyB;EAC7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EACrB,WAAW,UAAU;EACrB,gBAAgB,eAAe;EAC/B,WAAW,UAAU;CACvB,EAAE;CAEF,MAAM,cAAc,eAClB;EACE,IAAI,WAAW;GACb,OAAO,MAAM;EACf;EACA,OAAO,MAAM;EACb,OAAO,MAAM;EACb,kBAAkB;CACpB,GACA,YACF;CAEA,MAAM,oBAAoB;EACxB,MAAM,YAAY,YAAY,MAAM;EACpC,MAAM,YAAY;GAAE,SAAS;GAAe,eAAe;EAAS;EACpE,OAAO,YAAY;GAAE,GAAG;GAAW,GAAG;EAAU,IAAI;CACtD;CAEA,OACE,CAAC,WACC,KAAK,YAAY,OACb,gBAAgB,GACpB,MAAM,YAAyB,UAAU,MAAM,KAAK,OAAO,GAC3D,cAAc,UAAU,IAAK,UAAU,mBAAmB,SAAU,KAAA,GACpE,eAAe,WAAW,KAAK,UAAU,KAAK,KAAA,GAC9C,OAAO,YAAY,MAAM,GACzB,OAAO,YAAY,GACnB,cAAc,UAAU,KAAK,KAAA,GAC7B,eAAe,WAAW,KAAK,KAAA,GAC/B,cAAc,UAAU,KAAK,KAAA,GAC7B,cAAc,UAAU,KAAK,KAAA,GAC7B,oBAAoB,eAAe,KAAK,KAAA,GACxC,cAAc,UAAU,KAAK,KAAA,GAC9B;OACE,YAAY,eAAe,EAAE;IAChC,EAAE;AAEN;AAEA,YAAY,OAAO"}
|
|
1
|
+
{"version":3,"file":"Breadcrumbs.jsx","names":["assignRef","resolveChildren"],"sources":["../src/Breadcrumbs.tsx"],"sourcesContent":["/*\n * Copyright 2022 Adobe. All rights reserved.\n * This file is licensed to you under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License. You may obtain a copy\n * of the License at http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software distributed under\n * the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\n * OF ANY KIND, either express or implied. See the License for the specific language\n * governing permissions and limitations under the License.\n */\n\n// Ported to SolidJS for Proyecto Viviana; based on packages/react-aria-components/src/Breadcrumbs.tsx\n\n/**\n * Breadcrumbs component for solidaria-components\n *\n * A pre-wired headless breadcrumbs component that combines aria hooks.\n * Port of react-aria-components Breadcrumbs.\n */\n\nimport {\n createContext,\n createMemo,\n createSignal,\n children as resolveChildren,\n useContext,\n For,\n Show,\n} from \"solid-js\";\nimport type { Accessor } from \"solid-js\";\nimport type { JSX } from \"@solidjs/web\";\nimport { ElementTag } from \"./ElementTag\";\nimport {\n createBreadcrumbs,\n createBreadcrumbItem,\n createFocusRing,\n createHover,\n mergeProps,\n type AriaBreadcrumbsProps,\n type AriaBreadcrumbItemProps,\n type PressEvent,\n} from \"@proyecto-viviana/solidaria\";\nimport { splitProps } from \"@proyecto-viviana/solidaria/utils\";\nimport {\n type RenderChildren,\n type ClassNameOrFunction,\n type StyleOrFunction,\n type SlotProps,\n useRenderProps,\n filterDOMProps,\n dataAttr,\n attrTrue,\n} from \"./utils\";\n\ntype RefLike<T> = ((el: T) => void) | { current?: T | null } | undefined;\n\nfunction assignRef<T>(ref: RefLike<T>, el: T): void {\n if (!ref) {\n return;\n }\n\n if (typeof ref === \"function\") {\n ref(el);\n } else {\n ref.current = el;\n }\n}\n\nexport interface BreadcrumbsRenderProps {\n /** Whether the breadcrumbs are disabled. */\n isDisabled: boolean;\n}\n\nexport interface BreadcrumbsProps<T> extends Omit<AriaBreadcrumbsProps, \"isDisabled\">, SlotProps {\n /** The items to render in the breadcrumbs. */\n items?: T[];\n /** Function to get the key from an item. */\n getKey?: (item: T) => string | number;\n /** Whether the breadcrumbs are disabled. */\n isDisabled?: boolean;\n /** Handler called when a breadcrumb item is activated. */\n onAction?: (key: string | number) => void;\n /** The children of the component, or a render function for collection items. */\n children?: JSX.Element | ((item: T) => JSX.Element);\n /** The CSS className for the element. */\n class?: ClassNameOrFunction<BreadcrumbsRenderProps>;\n /** The inline style for the element. */\n style?: StyleOrFunction<BreadcrumbsRenderProps>;\n /** Ref for the navigation element. */\n ref?: RefLike<HTMLElement>;\n}\n\nexport interface BreadcrumbItemRenderProps {\n /** Whether this is the current/last item. */\n isCurrent: boolean;\n /** Whether the item is disabled. */\n isDisabled: boolean;\n /** Whether the item is pressed. */\n isPressed: boolean;\n /** Whether the item is focused. */\n isFocused: boolean;\n /** Whether the item has visible focus ring. */\n isFocusVisible: boolean;\n /** Whether the item is hovered. */\n isHovered: boolean;\n}\n\nexport interface BreadcrumbItemProps\n extends Omit<AriaBreadcrumbItemProps, \"isDisabled\">, SlotProps {\n /** The children of the breadcrumb item. */\n children?: RenderChildren<BreadcrumbItemRenderProps>;\n /** The CSS className for the element. */\n class?: ClassNameOrFunction<BreadcrumbItemRenderProps>;\n /** The inline style for the element. */\n style?: StyleOrFunction<BreadcrumbItemRenderProps>;\n /** Whether this item is disabled. */\n isDisabled?: boolean;\n /** Ref for the breadcrumb item element. */\n ref?: RefLike<HTMLElement>;\n}\n\ninterface BreadcrumbsContextValue {\n isDisabled: Accessor<boolean>;\n onAction?: (key: string | number) => void;\n registerStaticItem?: () => number;\n staticItemCount?: Accessor<number>;\n resetStaticItems?: () => void;\n setStaticItemCount?: (count: number) => void;\n}\n\nexport const BreadcrumbsContext = createContext<BreadcrumbsContextValue | null>(null);\n\ninterface BreadcrumbItemContextValue {\n itemKey: string | number | null;\n isLast: Accessor<boolean>;\n}\n\nexport const BreadcrumbItemContext = createContext<BreadcrumbItemContextValue | null>(null);\n\nfunction defaultItemKey(item: unknown, index: number): string | number {\n const maybeItem = item as { key?: string | number; id?: string | number };\n return maybeItem.key ?? maybeItem.id ?? index;\n}\n\n/**\n * Breadcrumbs show hierarchy and navigational context for a user's location within an application.\n */\nexport function Breadcrumbs<T>(props: BreadcrumbsProps<T>): JSX.Element {\n const [local, ariaProps, rest] = splitProps(\n props,\n [\"children\", \"class\", \"style\", \"slot\", \"items\", \"getKey\", \"isDisabled\", \"onAction\", \"ref\"],\n [\"aria-label\", \"aria-labelledby\", \"aria-describedby\", \"aria-details\"],\n );\n\n const isDisabled = () => local.isDisabled ?? false;\n const items = () => local.items ?? [];\n const hasCollectionItems = () => local.items !== undefined;\n const getItemKey = (item: T, index: number): string | number =>\n local.getKey?.(item) ?? defaultItemKey(item, index);\n const [staticItemCount, setStaticItemCount] = createSignal(0, { ownedWrite: true });\n let nextStaticIndex = 0;\n const resetStaticItems = () => {\n nextStaticIndex = 0;\n setStaticItemCount(0);\n };\n const registerStaticItem = () => {\n const index = nextStaticIndex;\n nextStaticIndex += 1;\n return index;\n };\n\n const { navProps } = createBreadcrumbs({\n get \"aria-label\"() {\n return ariaProps[\"aria-label\"];\n },\n get \"aria-labelledby\"() {\n return ariaProps[\"aria-labelledby\"];\n },\n get \"aria-describedby\"() {\n return ariaProps[\"aria-describedby\"];\n },\n get isDisabled() {\n return isDisabled();\n },\n });\n\n const renderValues = createMemo<BreadcrumbsRenderProps>(() => ({\n isDisabled: isDisabled(),\n }));\n\n const renderProps = useRenderProps(\n {\n class: local.class,\n style: local.style,\n defaultClassName: \"solidaria-Breadcrumbs\",\n },\n renderValues,\n );\n\n const domProps = createMemo(() =>\n filterDOMProps(rest as Record<string, unknown>, { global: true }),\n );\n return (\n <BreadcrumbsContext\n value={{\n isDisabled,\n onAction: local.onAction,\n registerStaticItem,\n staticItemCount,\n resetStaticItems,\n setStaticItemCount,\n }}\n >\n {/*\n Faithful to react-aria-components Breadcrumbs: the accessible name (navProps'\n aria-label) sits directly on the <ol> (role=\"list\"), with NO wrapping <nav>\n landmark (react-spectrum/packages/react-aria-components/src/Breadcrumbs.tsx\n renders `<dom.ol {...mergeProps(DOMProps, navProps)} style={props.style}>`).\n The <ol> carries ONLY the consumer's class/style — no hard-coded inline\n layout reset. An inline reset would beat the styled layer's class (inline\n wins over class), which is exactly what broke S2 parity: the solid-spectrum\n `wrapperStyles` class supplies display:flex / list-style:none / padding:0 /\n marginStart and deliberately leaves align-items at its `normal` default, so\n a hard-coded inline `align-items:center` + `margin:0` clobbered the\n wrapper's margin and diverged from S2 (whose <ol> has neither).\n */}\n <ol\n {...navProps}\n {...domProps()}\n ref={(element) => assignRef(local.ref, element)}\n class={renderProps.class()}\n style={renderProps.style()}\n data-disabled={dataAttr(isDisabled())}\n >\n <Show\n when={hasCollectionItems()}\n fallback={<StaticBreadcrumbItems>{local.children as JSX.Element}</StaticBreadcrumbItems>}\n >\n <For each={items()}>\n {(item, index) => {\n const itemKey = getItemKey(item, index());\n const isLast = () => index() === items().length - 1;\n const renderItem = local.children as ((item: T) => JSX.Element) | undefined;\n\n return (\n <li style={{ display: \"flex\", \"align-items\": \"center\" }}>\n <BreadcrumbItemContext value={{ itemKey, isLast }}>\n {renderItem?.(item)}\n </BreadcrumbItemContext>\n </li>\n );\n }}\n </For>\n </Show>\n </ol>\n </BreadcrumbsContext>\n );\n}\n\nfunction StaticBreadcrumbItems(props: { children?: JSX.Element }): JSX.Element {\n const context = useContext(BreadcrumbsContext);\n const staticChildren = resolveChildren(() => props.children);\n const childArray = createMemo(() => {\n context?.resetStaticItems?.();\n const array = staticChildren.toArray();\n context?.setStaticItemCount?.(array.length);\n return array;\n });\n\n return (\n <For each={childArray()}>\n {(child) => <li style={{ display: \"flex\", \"align-items\": \"center\" }}>{child}</li>}\n </For>\n );\n}\n\n/**\n * A BreadcrumbItem represents an individual breadcrumb in the navigation trail.\n */\nexport function BreadcrumbItem(props: BreadcrumbItemProps): JSX.Element {\n const [local, ariaProps] = splitProps(props, [\"class\", \"style\", \"slot\", \"isDisabled\", \"ref\"]);\n\n const context = useContext(BreadcrumbsContext);\n const itemContext = useContext(BreadcrumbItemContext);\n const staticIndex = itemContext ? null : context?.registerStaticItem?.();\n const isDisabled = () => local.isDisabled ?? context?.isDisabled() ?? false;\n const isCurrent = () =>\n ariaProps.isCurrent ??\n itemContext?.isLast() ??\n (staticIndex !== null &&\n staticIndex !== undefined &&\n context?.staticItemCount !== undefined &&\n staticIndex === context.staticItemCount() - 1);\n const itemKey = () => itemContext?.itemKey ?? ariaProps.id ?? null;\n\n // Mirror react-aria-components' Link: render an <a> only when there is an\n // href on an enabled, non-current item; otherwise fall back to a <span\n // role=\"link\"> (via createLink). A styled layer may force the element type\n // (S2 renders the current item as a plain <div>), which takes precedence.\n const elementType = () =>\n ariaProps.elementType ?? (ariaProps.href && !isDisabled() && !isCurrent() ? \"a\" : \"span\");\n // The current breadcrumb is the current page and is non-interactive: S2\n // renders it as a plain element with no link role. createLink only omits\n // role=\"link\" for an <a>, so treat the current item as an \"a\" purely for the\n // role decision while still rendering the resolved element type above.\n const linkElementType = () => (isCurrent() ? \"a\" : elementType());\n\n const handlePress = (e: PressEvent) => {\n ariaProps.onPress?.(e);\n const key = itemKey();\n if (key !== null && !isCurrent() && !isDisabled()) {\n context?.onAction?.(key);\n }\n };\n\n const itemAria = createBreadcrumbItem({\n get id() {\n return ariaProps.id;\n },\n get isCurrent() {\n return isCurrent();\n },\n get isDisabled() {\n return isDisabled();\n },\n get href() {\n return ariaProps.href;\n },\n get target() {\n return ariaProps.target;\n },\n get rel() {\n return ariaProps.rel;\n },\n get elementType() {\n return linkElementType();\n },\n get onPress() {\n return handlePress;\n },\n get onPressStart() {\n return ariaProps.onPressStart;\n },\n get onPressEnd() {\n return ariaProps.onPressEnd;\n },\n get onClick() {\n return ariaProps.onClick;\n },\n get onFocus() {\n return ariaProps.onFocus;\n },\n get onBlur() {\n return ariaProps.onBlur;\n },\n get onFocusChange() {\n return ariaProps.onFocusChange;\n },\n get onKeyDown() {\n return ariaProps.onKeyDown;\n },\n get onKeyUp() {\n return ariaProps.onKeyUp;\n },\n get autoFocus() {\n return ariaProps.autoFocus;\n },\n get \"aria-label\"() {\n return ariaProps[\"aria-label\"];\n },\n get \"aria-labelledby\"() {\n return ariaProps[\"aria-labelledby\"];\n },\n get \"aria-describedby\"() {\n return ariaProps[\"aria-describedby\"];\n },\n get \"aria-details\"() {\n return ariaProps[\"aria-details\"];\n },\n get \"aria-current\"() {\n return ariaProps[\"aria-current\"];\n },\n });\n\n const isPressed = itemAria.isPressed;\n const { isFocused, isFocusVisible, focusProps } = createFocusRing();\n const { isHovered, hoverProps } = createHover({\n get isDisabled() {\n return isDisabled();\n },\n });\n // Read itemAria.itemProps fresh inside the memo (do NOT destructure it above):\n // the reactive getter re-runs createBreadcrumbItem → createLink each time this\n // memo re-evaluates, so role/tabIndex track elementType once isCurrent settles.\n const mergedItemProps = createMemo(() =>\n mergeProps(\n itemAria.itemProps as Record<string, unknown>,\n focusProps as Record<string, unknown>,\n hoverProps as Record<string, unknown>,\n ),\n );\n\n const renderValues = createMemo<BreadcrumbItemRenderProps>(() => ({\n isCurrent: isCurrent(),\n isDisabled: isDisabled(),\n isPressed: isPressed(),\n isFocused: isFocused(),\n isFocusVisible: isFocusVisible(),\n isHovered: isHovered(),\n }));\n\n const renderProps = useRenderProps(\n {\n get children() {\n return props.children;\n },\n class: local.class,\n style: local.style,\n defaultClassName: \"solidaria-BreadcrumbItem\",\n },\n renderValues,\n );\n\n const mergedStyle = () => {\n const userStyle = renderProps.style();\n const baseStyle = { display: \"inline-flex\", \"align-items\": \"center\" };\n return userStyle ? { ...baseStyle, ...userStyle } : baseStyle;\n };\n\n return (\n <ElementTag\n tag={elementType()}\n {...mergedItemProps()}\n ref={(element: HTMLElement) => assignRef(local.ref, element)}\n aria-current={isCurrent() ? (ariaProps[\"aria-current\"] ?? \"page\") : undefined}\n aria-disabled={attrTrue(isDisabled() || isCurrent())}\n class={renderProps.class()}\n style={mergedStyle()}\n data-current={dataAttr(isCurrent())}\n data-disabled={dataAttr(isDisabled())}\n data-pressed={dataAttr(isPressed())}\n data-focused={dataAttr(isFocused())}\n data-focus-visible={dataAttr(isFocusVisible())}\n data-hovered={dataAttr(isHovered())}\n >\n {renderProps.renderChildren()}\n </ElementTag>\n );\n}\n\nBreadcrumbs.Item = BreadcrumbItem;\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;AAyDA,SAASA,YAAa,KAAiB,IAAa;CAClD,IAAI,CAAC,KACH;CAGF,IAAI,OAAO,QAAQ,Y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O,YAAY,GACnB,cAAc,SAAS,UAAU,CAAC,GAClC,eAAe,SAAS,WAAW,CAAC,GACpC,cAAc,SAAS,UAAU,CAAC,GAClC,cAAc,SAAS,UAAU,CAAC,GAClC,oBAAoB,SAAS,eAAe,CAAC,GAC7C,cAAc,SAAS,UAAU,CAAC,GACnC;OACE,YAAY,eAAe,EAAE;IAChC,EAAE;AAEN;AAEA,YAAY,OAAO"}
|
package/dist/Button.d.ts
CHANGED
|
@@ -1,10 +1,4 @@
|
|
|
1
|
-
|
|
2
|
-
* Button component for solidaria-components
|
|
3
|
-
*
|
|
4
|
-
* A pre-wired headless button that combines state + aria hooks.
|
|
5
|
-
* Port of react-aria-components/src/Button.tsx
|
|
6
|
-
*/
|
|
7
|
-
import { type JSX } from "solid-js";
|
|
1
|
+
import type { JSX } from "@solidjs/web";
|
|
8
2
|
import { type AriaButtonProps, type HoverEvent } from "@proyecto-viviana/solidaria";
|
|
9
3
|
import { type RenderChildren, type ClassNameOrFunction, type StyleOrFunction, type SlotProps } from "./utils";
|
|
10
4
|
type RefLike<T> = ((el: T) => void) | {
|
package/dist/Button.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Button.d.ts","sourceRoot":"","sources":["../src/Button.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"Button.d.ts","sourceRoot":"","sources":["../src/Button.tsx"],"names":[],"mappings":"AA6BA,OAAO,KAAK,EAAE,GAAG,EAAE,MAAM,cAAc,CAAC;AACxC,OAAO,EAOL,KAAK,eAAe,EACpB,KAAK,UAAU,EAEhB,MAAM,6BAA6B,CAAC;AACrC,OAAO,EACL,KAAK,cAAc,EACnB,KAAK,mBAAmB,EACxB,KAAK,eAAe,EACpB,KAAK,SAAS,EAIf,MAAM,SAAS,CAAC;AAWjB,KAAK,OAAO,CAAC,CAAC,IAAI,CAAC,CAAC,EAAE,EAAE,CAAC,KAAK,IAAI,CAAC,GAAG;IAAE,OAAO,CAAC,EAA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