@proyecto-viviana/solidaria-components 0.3.2 → 0.4.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/ActionBar.d.ts.map +1 -1
- package/dist/ActionBar.js +175 -0
- package/dist/ActionBar.js.map +1 -0
- package/dist/ActionBar.jsx +119 -0
- package/dist/ActionBar.jsx.map +1 -0
- package/dist/ActionGroup.d.ts.map +1 -1
- package/dist/ActionGroup.js +179 -0
- package/dist/ActionGroup.js.map +1 -0
- package/dist/ActionGroup.jsx +129 -0
- package/dist/ActionGroup.jsx.map +1 -0
- package/dist/Alert.js +111 -0
- package/dist/Alert.js.map +1 -0
- package/dist/Alert.jsx +82 -0
- package/dist/Alert.jsx.map +1 -0
- package/dist/Autocomplete.d.ts +2 -2
- package/dist/Autocomplete.d.ts.map +1 -1
- package/dist/Autocomplete.js +130 -0
- package/dist/Autocomplete.js.map +1 -0
- package/dist/Autocomplete.jsx +116 -0
- package/dist/Autocomplete.jsx.map +1 -0
- package/dist/Breadcrumbs.d.ts.map +1 -1
- package/dist/Breadcrumbs.js +333 -0
- package/dist/Breadcrumbs.js.map +1 -0
- package/dist/Breadcrumbs.jsx +261 -0
- package/dist/Breadcrumbs.jsx.map +1 -0
- package/dist/Button.d.ts.map +1 -1
- package/dist/Button.js +348 -0
- package/dist/Button.js.map +1 -0
- package/dist/Button.jsx +314 -0
- package/dist/Button.jsx.map +1 -0
- package/dist/Calendar.d.ts +4 -4
- package/dist/Calendar.d.ts.map +1 -1
- package/dist/Calendar.js +573 -0
- package/dist/Calendar.js.map +1 -0
- package/dist/Calendar.jsx +342 -0
- package/dist/Calendar.jsx.map +1 -0
- package/dist/CalendarPicker.d.ts +33 -0
- package/dist/CalendarPicker.d.ts.map +1 -0
- package/dist/CalendarPicker.js +44 -0
- package/dist/CalendarPicker.js.map +1 -0
- package/dist/CalendarPicker.jsx +44 -0
- package/dist/CalendarPicker.jsx.map +1 -0
- package/dist/Checkbox.d.ts +83 -4
- package/dist/Checkbox.d.ts.map +1 -1
- package/dist/Checkbox.js +923 -0
- package/dist/Checkbox.js.map +1 -0
- package/dist/Checkbox.jsx +707 -0
- package/dist/Checkbox.jsx.map +1 -0
- package/dist/Collection.d.ts.map +1 -1
- package/dist/Collection.js +202 -0
- package/dist/Collection.js.map +1 -0
- package/dist/Collection.jsx +152 -0
- package/dist/Collection.jsx.map +1 -0
- package/dist/Color.d.ts.map +1 -1
- package/dist/Color.js +1717 -0
- package/dist/Color.js.map +1 -0
- package/dist/Color.jsx +1340 -0
- package/dist/Color.jsx.map +1 -0
- package/dist/ColorEditor.js +208 -0
- package/dist/ColorEditor.js.map +1 -0
- package/dist/ColorEditor.jsx +120 -0
- package/dist/ColorEditor.jsx.map +1 -0
- package/dist/ComboBox.d.ts +8 -4
- package/dist/ComboBox.d.ts.map +1 -1
- package/dist/ComboBox.js +1000 -0
- package/dist/ComboBox.js.map +1 -0
- package/dist/ComboBox.jsx +724 -0
- package/dist/ComboBox.jsx.map +1 -0
- package/dist/ContextualHelpTrigger.js +146 -0
- package/dist/ContextualHelpTrigger.js.map +1 -0
- package/dist/ContextualHelpTrigger.jsx +109 -0
- package/dist/ContextualHelpTrigger.jsx.map +1 -0
- package/dist/DateField.d.ts +14 -5
- package/dist/DateField.d.ts.map +1 -1
- package/dist/DateField.js +4 -0
- package/dist/DateField.jsx +4 -0
- package/dist/DateField2.js +502 -0
- package/dist/DateField2.js.map +1 -0
- package/dist/DateField2.jsx +354 -0
- package/dist/DateField2.jsx.map +1 -0
- package/dist/DatePicker.d.ts +46 -7
- package/dist/DatePicker.d.ts.map +1 -1
- package/dist/DatePicker.js +7 -0
- package/dist/DatePicker.jsx +7 -0
- package/dist/DatePicker2.js +1171 -0
- package/dist/DatePicker2.js.map +1 -0
- package/dist/DatePicker2.jsx +820 -0
- package/dist/DatePicker2.jsx.map +1 -0
- package/dist/DateRangePickerContext.d.ts +2 -0
- package/dist/DateRangePickerContext.d.ts.map +1 -1
- package/dist/Dialog.d.ts.map +1 -1
- package/dist/Dialog.js +337 -0
- package/dist/Dialog.js.map +1 -0
- package/dist/Dialog.jsx +192 -0
- package/dist/Dialog.jsx.map +1 -0
- package/dist/Disclosure.d.ts.map +1 -1
- package/dist/Disclosure.js +331 -0
- package/dist/Disclosure.js.map +1 -0
- package/dist/Disclosure.jsx +230 -0
- package/dist/Disclosure.jsx.map +1 -0
- package/dist/DragAndDrop.d.ts.map +1 -1
- package/dist/DragAndDrop.js +176 -0
- package/dist/DragAndDrop.js.map +1 -0
- package/dist/DragAndDrop.jsx +160 -0
- package/dist/DragAndDrop.jsx.map +1 -0
- package/dist/DropZone.d.ts.map +1 -1
- package/dist/DropZone.js +189 -0
- package/dist/DropZone.js.map +1 -0
- package/dist/DropZone.jsx +144 -0
- package/dist/DropZone.jsx.map +1 -0
- package/dist/FieldError.js +66 -0
- package/dist/FieldError.js.map +1 -0
- package/dist/FieldError.jsx +47 -0
- package/dist/FieldError.jsx.map +1 -0
- package/dist/FileTrigger.js +79 -0
- package/dist/FileTrigger.js.map +1 -0
- package/dist/FileTrigger.jsx +49 -0
- package/dist/FileTrigger.jsx.map +1 -0
- package/dist/Focusable.js +70 -0
- package/dist/Focusable.js.map +1 -0
- package/dist/Focusable.jsx +69 -0
- package/dist/Focusable.jsx.map +1 -0
- package/dist/Form.js +99 -0
- package/dist/Form.js.map +1 -0
- package/dist/Form.jsx +73 -0
- package/dist/Form.jsx.map +1 -0
- package/dist/GridList.d.ts +34 -2
- package/dist/GridList.d.ts.map +1 -1
- package/dist/GridList.js +723 -0
- package/dist/GridList.js.map +1 -0
- package/dist/GridList.jsx +552 -0
- package/dist/GridList.jsx.map +1 -0
- package/dist/Icon.d.ts.map +1 -1
- package/dist/Icon.js +127 -0
- package/dist/Icon.js.map +1 -0
- package/dist/Icon.jsx +72 -0
- package/dist/Icon.jsx.map +1 -0
- package/dist/Keyboard.js +30 -0
- package/dist/Keyboard.js.map +1 -0
- package/dist/Keyboard.jsx +24 -0
- package/dist/Keyboard.jsx.map +1 -0
- package/dist/Landmark.js +134 -0
- package/dist/Landmark.js.map +1 -0
- package/dist/Landmark.jsx +118 -0
- package/dist/Landmark.jsx.map +1 -0
- package/dist/Link.d.ts.map +1 -1
- package/dist/Link.js +219 -0
- package/dist/Link.js.map +1 -0
- package/dist/Link.jsx +189 -0
- package/dist/Link.jsx.map +1 -0
- package/dist/ListBox.d.ts +2 -2
- package/dist/ListBox.d.ts.map +1 -1
- package/dist/ListBox.js +831 -0
- package/dist/ListBox.js.map +1 -0
- package/dist/ListBox.jsx +644 -0
- package/dist/ListBox.jsx.map +1 -0
- package/dist/Menu.d.ts +27 -9
- package/dist/Menu.d.ts.map +1 -1
- package/dist/Menu.js +1254 -0
- package/dist/Menu.js.map +1 -0
- package/dist/Menu.jsx +1042 -0
- package/dist/Menu.jsx.map +1 -0
- package/dist/Meter.d.ts.map +1 -1
- package/dist/Meter.js +123 -0
- package/dist/Meter.js.map +1 -0
- package/dist/Meter.jsx +107 -0
- package/dist/Meter.jsx.map +1 -0
- package/dist/Modal.d.ts.map +1 -1
- package/dist/Modal.js +382 -0
- package/dist/Modal.js.map +1 -0
- package/dist/Modal.jsx +314 -0
- package/dist/Modal.jsx.map +1 -0
- package/dist/NumberField.d.ts +3 -3
- package/dist/NumberField.d.ts.map +1 -1
- package/dist/NumberField.js +573 -0
- package/dist/NumberField.js.map +1 -0
- package/dist/NumberField.jsx +443 -0
- package/dist/NumberField.jsx.map +1 -0
- package/dist/Popover.d.ts +10 -2
- package/dist/Popover.d.ts.map +1 -1
- package/dist/Popover.js +471 -0
- package/dist/Popover.js.map +1 -0
- package/dist/Popover.jsx +354 -0
- package/dist/Popover.jsx.map +1 -0
- package/dist/Pressable.js +69 -0
- package/dist/Pressable.js.map +1 -0
- package/dist/Pressable.jsx +68 -0
- package/dist/Pressable.jsx.map +1 -0
- package/dist/ProgressBar.d.ts.map +1 -1
- package/dist/ProgressBar.js +130 -0
- package/dist/ProgressBar.js.map +1 -0
- package/dist/ProgressBar.jsx +114 -0
- package/dist/ProgressBar.jsx.map +1 -0
- package/dist/RadioGroup.d.ts +82 -4
- package/dist/RadioGroup.d.ts.map +1 -1
- package/dist/RadioGroup.js +931 -0
- package/dist/RadioGroup.js.map +1 -0
- package/dist/RadioGroup.jsx +681 -0
- package/dist/RadioGroup.jsx.map +1 -0
- package/dist/RangeCalendar.d.ts.map +1 -1
- package/dist/RangeCalendar.js +546 -0
- package/dist/RangeCalendar.js.map +1 -0
- package/dist/RangeCalendar.jsx +323 -0
- package/dist/RangeCalendar.jsx.map +1 -0
- package/dist/RouterProvider.js +118 -0
- package/dist/RouterProvider.js.map +1 -0
- package/dist/RouterProvider.jsx +112 -0
- package/dist/RouterProvider.jsx.map +1 -0
- package/dist/SearchField.d.ts +2 -2
- package/dist/SearchField.d.ts.map +1 -1
- package/dist/SearchField.js +667 -0
- package/dist/SearchField.js.map +1 -0
- package/dist/SearchField.jsx +550 -0
- package/dist/SearchField.jsx.map +1 -0
- package/dist/Select.d.ts +7 -0
- package/dist/Select.d.ts.map +1 -1
- package/dist/Select.js +1044 -0
- package/dist/Select.js.map +1 -0
- package/dist/Select.jsx +759 -0
- package/dist/Select.jsx.map +1 -0
- package/dist/SelectionIndicator.d.ts.map +1 -1
- package/dist/SelectionIndicator.js +86 -0
- package/dist/SelectionIndicator.js.map +1 -0
- package/dist/SelectionIndicator.jsx +50 -0
- package/dist/SelectionIndicator.jsx.map +1 -0
- package/dist/Separator.js +97 -0
- package/dist/Separator.js.map +1 -0
- package/dist/Separator.jsx +85 -0
- package/dist/Separator.jsx.map +1 -0
- package/dist/SharedElementTransition.d.ts.map +1 -1
- package/dist/SharedElementTransition.js +167 -0
- package/dist/SharedElementTransition.js.map +1 -0
- package/dist/SharedElementTransition.jsx +140 -0
- package/dist/SharedElementTransition.jsx.map +1 -0
- package/dist/Slider.d.ts +33 -1
- package/dist/Slider.d.ts.map +1 -1
- package/dist/Slider.js +515 -0
- package/dist/Slider.js.map +1 -0
- package/dist/Slider.jsx +403 -0
- package/dist/Slider.jsx.map +1 -0
- package/dist/StepList.d.ts.map +1 -1
- package/dist/StepList.js +191 -0
- package/dist/StepList.js.map +1 -0
- package/dist/StepList.jsx +136 -0
- package/dist/StepList.jsx.map +1 -0
- package/dist/Switch.d.ts +65 -2
- package/dist/Switch.d.ts.map +1 -1
- package/dist/Switch.js +534 -0
- package/dist/Switch.js.map +1 -0
- package/dist/Switch.jsx +393 -0
- package/dist/Switch.jsx.map +1 -0
- package/dist/Table.d.ts +50 -0
- package/dist/Table.d.ts.map +1 -1
- package/dist/Table.js +1766 -0
- package/dist/Table.js.map +1 -0
- package/dist/Table.jsx +1355 -0
- package/dist/Table.jsx.map +1 -0
- package/dist/Tabs.d.ts +0 -4
- package/dist/Tabs.d.ts.map +1 -1
- package/dist/Tabs.js +598 -0
- package/dist/Tabs.js.map +1 -0
- package/dist/Tabs.jsx +367 -0
- package/dist/Tabs.jsx.map +1 -0
- package/dist/TagGroup.d.ts +3 -1
- package/dist/TagGroup.d.ts.map +1 -1
- package/dist/TagGroup.js +382 -0
- package/dist/TagGroup.js.map +1 -0
- package/dist/TagGroup.jsx +273 -0
- package/dist/TagGroup.jsx.map +1 -0
- package/dist/Text.d.ts +18 -6
- package/dist/Text.d.ts.map +1 -1
- package/dist/Text.js +42 -0
- package/dist/Text.js.map +1 -0
- package/dist/Text.jsx +35 -0
- package/dist/Text.jsx.map +1 -0
- package/dist/TextField.d.ts +6 -6
- package/dist/TextField.d.ts.map +1 -1
- package/dist/TextField.js +439 -0
- package/dist/TextField.js.map +1 -0
- package/dist/TextField.jsx +406 -0
- package/dist/TextField.jsx.map +1 -0
- package/dist/TimeField.d.ts +17 -53
- package/dist/TimeField.d.ts.map +1 -1
- package/dist/TimeField.js +278 -0
- package/dist/TimeField.js.map +1 -0
- package/dist/TimeField.jsx +218 -0
- package/dist/TimeField.jsx.map +1 -0
- package/dist/Toast.d.ts +14 -0
- package/dist/Toast.d.ts.map +1 -1
- package/dist/Toast.js +551 -0
- package/dist/Toast.js.map +1 -0
- package/dist/Toast.jsx +361 -0
- package/dist/Toast.jsx.map +1 -0
- package/dist/ToggleButton.d.ts.map +1 -1
- package/dist/ToggleButton.js +123 -0
- package/dist/ToggleButton.js.map +1 -0
- package/dist/ToggleButton.jsx +88 -0
- package/dist/ToggleButton.jsx.map +1 -0
- package/dist/ToggleButtonGroup.d.ts.map +1 -1
- package/dist/ToggleButtonGroup.js +114 -0
- package/dist/ToggleButtonGroup.js.map +1 -0
- package/dist/ToggleButtonGroup.jsx +85 -0
- package/dist/ToggleButtonGroup.jsx.map +1 -0
- package/dist/Toolbar.js +112 -0
- package/dist/Toolbar.js.map +1 -0
- package/dist/Toolbar.jsx +92 -0
- package/dist/Toolbar.jsx.map +1 -0
- package/dist/Tooltip.d.ts.map +1 -1
- package/dist/Tooltip.js +539 -0
- package/dist/Tooltip.js.map +1 -0
- package/dist/Tooltip.jsx +465 -0
- package/dist/Tooltip.jsx.map +1 -0
- package/dist/Tree.d.ts +14 -2
- package/dist/Tree.d.ts.map +1 -1
- package/dist/Tree.js +1424 -0
- package/dist/Tree.js.map +1 -0
- package/dist/Tree.jsx +1172 -0
- package/dist/Tree.jsx.map +1 -0
- package/dist/Virtualizer.d.ts +16 -2
- package/dist/Virtualizer.d.ts.map +1 -1
- package/dist/Virtualizer.js +2 -0
- package/dist/Virtualizer.jsx +2 -0
- package/dist/Virtualizer2.js +751 -0
- package/dist/Virtualizer2.js.map +1 -0
- package/dist/Virtualizer2.jsx +730 -0
- package/dist/Virtualizer2.jsx.map +1 -0
- package/dist/VirtualizerLayouts.d.ts +18 -0
- package/dist/VirtualizerLayouts.d.ts.map +1 -1
- package/dist/VisuallyHidden.js +42 -0
- package/dist/VisuallyHidden.js.map +1 -0
- package/dist/VisuallyHidden.jsx +35 -0
- package/dist/VisuallyHidden.jsx.map +1 -0
- package/dist/contexts.js +33 -0
- package/dist/contexts.js.map +1 -0
- package/dist/contexts.jsx +33 -0
- package/dist/contexts.jsx.map +1 -0
- package/dist/index.d.ts +9 -9
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +69 -23932
- package/dist/index.jsx +69 -18337
- package/dist/useDragAndDrop.d.ts +0 -8
- package/dist/useDragAndDrop.d.ts.map +1 -1
- package/dist/useDragAndDrop.js +2 -0
- package/dist/useDragAndDrop.jsx +2 -0
- package/dist/useDragAndDrop2.js +399 -0
- package/dist/useDragAndDrop2.js.map +1 -0
- package/dist/useDragAndDrop2.jsx +399 -0
- package/dist/useDragAndDrop2.jsx.map +1 -0
- package/dist/utils.d.ts +84 -11
- package/dist/utils.d.ts.map +1 -1
- package/dist/utils.js +285 -0
- package/dist/utils.js.map +1 -0
- package/dist/utils.jsx +277 -0
- package/dist/utils.jsx.map +1 -0
- package/dist/virtualizer/Layout.js +144 -0
- package/dist/virtualizer/Layout.js.map +1 -0
- package/dist/virtualizer/Layout.jsx +144 -0
- package/dist/virtualizer/Layout.jsx.map +1 -0
- package/package.json +395 -4
- package/src/ActionBar.tsx +10 -12
- package/src/ActionGroup.tsx +5 -3
- package/src/Autocomplete.tsx +14 -9
- package/src/Breadcrumbs.tsx +58 -39
- package/src/Button.tsx +22 -2
- package/src/Calendar.tsx +57 -11
- package/src/CalendarPicker.tsx +73 -0
- package/src/Checkbox.tsx +539 -3
- package/src/Collection.tsx +9 -3
- package/src/Color.tsx +84 -41
- package/src/ComboBox.tsx +97 -21
- package/src/DateField.tsx +304 -53
- package/src/DatePicker.tsx +402 -62
- package/src/DateRangePickerContext.tsx +2 -0
- package/src/Dialog.tsx +13 -5
- package/src/Disclosure.tsx +7 -1
- package/src/DragAndDrop.tsx +3 -1
- package/src/DropZone.tsx +3 -1
- package/src/GridList.tsx +133 -26
- package/src/Icon.tsx +3 -1
- package/src/Link.tsx +3 -1
- package/src/ListBox.tsx +354 -25
- package/src/Menu.tsx +252 -128
- package/src/Meter.tsx +3 -1
- package/src/Modal.tsx +120 -56
- package/src/NumberField.tsx +51 -8
- package/src/Popover.tsx +68 -17
- package/src/ProgressBar.tsx +3 -1
- package/src/RadioGroup.tsx +468 -4
- package/src/RangeCalendar.tsx +123 -2
- package/src/SearchField.tsx +80 -4
- package/src/Select.tsx +122 -26
- package/src/SelectionIndicator.tsx +3 -1
- package/src/SharedElementTransition.tsx +95 -37
- package/src/Slider.tsx +159 -13
- package/src/StepList.tsx +0 -7
- package/src/Switch.tsx +395 -2
- package/src/Table.tsx +428 -99
- package/src/Tabs.tsx +17 -45
- package/src/TagGroup.tsx +29 -7
- package/src/Text.tsx +31 -10
- package/src/TextField.tsx +44 -6
- package/src/TimeField.tsx +127 -192
- package/src/Toast.tsx +79 -14
- package/src/ToggleButton.tsx +3 -1
- package/src/ToggleButtonGroup.tsx +3 -1
- package/src/Tooltip.tsx +3 -1
- package/src/Tree.tsx +91 -13
- package/src/Virtualizer.tsx +180 -31
- package/src/VirtualizerLayouts.ts +45 -10
- package/src/index.ts +51 -8
- package/src/useDragAndDrop.ts +8 -10
- package/src/utils.tsx +246 -30
- package/dist/HiddenTimeInput.d.ts +0 -25
- package/dist/HiddenTimeInput.d.ts.map +0 -1
- package/dist/index.js.map +0 -1
- package/dist/index.jsx.map +0 -1
- package/src/HiddenTimeInput.tsx +0 -133
|
@@ -13,9 +13,11 @@ import {
|
|
|
13
13
|
createContext,
|
|
14
14
|
createEffect,
|
|
15
15
|
createMemo,
|
|
16
|
+
createRenderEffect,
|
|
16
17
|
createSignal,
|
|
17
18
|
onCleanup,
|
|
18
19
|
splitProps,
|
|
20
|
+
untrack,
|
|
19
21
|
useContext,
|
|
20
22
|
Show,
|
|
21
23
|
on,
|
|
@@ -110,11 +112,16 @@ export function SharedElement(props: SharedElementProps): JSX.Element | null {
|
|
|
110
112
|
local.isVisible === false ? "hidden" : "visible",
|
|
111
113
|
);
|
|
112
114
|
|
|
113
|
-
|
|
115
|
+
// The mounted div, tracked as a signal so the FLIP-read effect below REACTS to
|
|
116
|
+
// it appearing. React guarantees `ref.current` is committed before the layout
|
|
117
|
+
// effect body runs; Solid gives no such ordering between the `<Show>`'s
|
|
118
|
+
// insertion render-effect and a plain createEffect, so we make the read depend
|
|
119
|
+
// on the element instead of racing its mount (see READ PHASE).
|
|
120
|
+
const [element, setElement] = createSignal<HTMLDivElement | undefined>();
|
|
114
121
|
let frame: number | undefined;
|
|
115
122
|
|
|
116
123
|
const setRef = (el: HTMLDivElement) => {
|
|
117
|
-
|
|
124
|
+
setElement(el);
|
|
118
125
|
// Forward ref to consumer
|
|
119
126
|
const userRef = local.ref;
|
|
120
127
|
if (typeof userRef === "function") {
|
|
@@ -124,44 +131,112 @@ export function SharedElement(props: SharedElementProps): JSX.Element | null {
|
|
|
124
131
|
}
|
|
125
132
|
};
|
|
126
133
|
|
|
127
|
-
//
|
|
128
|
-
|
|
134
|
+
// Store a geometry + transition-style snapshot of the currently-mounted
|
|
135
|
+
// element, so a sibling SharedElement with the same `name` can FLIP from it.
|
|
136
|
+
// Mirrors upstream's layout-effect *cleanup*
|
|
137
|
+
// (react-aria-components/src/SharedElementTransition.tsx), which runs for
|
|
138
|
+
// every `isVisible` flip — not only on unmount.
|
|
139
|
+
const storeSnapshot = () => {
|
|
140
|
+
const el = untrack(element);
|
|
141
|
+
if (el && el.isConnected && !el.hasAttribute("data-exiting")) {
|
|
142
|
+
// Store a snapshot of the rectangle and computed style for transitioning properties.
|
|
143
|
+
const style = window.getComputedStyle(el);
|
|
144
|
+
if (style.transitionProperty !== "none") {
|
|
145
|
+
const transitionProperty = style.transitionProperty.split(/\s*,\s*/);
|
|
146
|
+
scope.snapshots[local.name] = {
|
|
147
|
+
rect: el.getBoundingClientRect(),
|
|
148
|
+
style: transitionProperty.map((property) => [property, style.getPropertyValue(property)]),
|
|
149
|
+
};
|
|
150
|
+
}
|
|
151
|
+
}
|
|
152
|
+
};
|
|
153
|
+
|
|
154
|
+
// MOUNT-IN-RENDER — mirrors upstream's render-phase
|
|
155
|
+
// `if (isVisible && state === 'hidden') setState('visible')`. Promoting a
|
|
156
|
+
// hidden element to visible in the render phase mounts its div (via the
|
|
157
|
+
// `<Show>` below) BEFORE the FLIP-read createEffect runs, so the incoming
|
|
158
|
+
// element is in the DOM to be measured and translated. Without this the
|
|
159
|
+
// incoming element's ref is still null when the read effect fires and it can
|
|
160
|
+
// only enter fresh — never FLIP. Keyed on `isVisible` (untracked lifecycle
|
|
161
|
+
// read) so it cannot loop.
|
|
162
|
+
createRenderEffect(
|
|
163
|
+
on(
|
|
164
|
+
() => local.isVisible !== false,
|
|
165
|
+
(isVisible) => {
|
|
166
|
+
if (isVisible && untrack(lifecycle) === "hidden") {
|
|
167
|
+
setLifecycle("visible");
|
|
168
|
+
}
|
|
169
|
+
},
|
|
170
|
+
),
|
|
171
|
+
);
|
|
172
|
+
|
|
173
|
+
// STORE PHASE — a render effect runs before user effects within a Solid
|
|
174
|
+
// batch, exactly as React runs all layout-effect destroys before any create.
|
|
175
|
+
// The cleanup registered here fires on the *next* `isVisible` change (and on
|
|
176
|
+
// disposal), capturing the outgoing snapshot BEFORE any sibling's FLIP-read
|
|
177
|
+
// createEffect below runs — React's two-phase commit. Only the cleanup
|
|
178
|
+
// registered while VISIBLE stores (an outgoing element); an incoming
|
|
179
|
+
// element's prior cleanup was registered while hidden and must not clobber
|
|
180
|
+
// the outgoing snapshot. This mirrors React closing over `element =
|
|
181
|
+
// ref.current`, which is null while hidden.
|
|
182
|
+
createRenderEffect(
|
|
129
183
|
on(
|
|
130
184
|
() => local.isVisible !== false,
|
|
131
185
|
(isVisible) => {
|
|
186
|
+
onCleanup(() => {
|
|
187
|
+
if (isVisible) {
|
|
188
|
+
storeSnapshot();
|
|
189
|
+
}
|
|
190
|
+
});
|
|
191
|
+
},
|
|
192
|
+
),
|
|
193
|
+
);
|
|
194
|
+
|
|
195
|
+
// READ PHASE — mirrors upstream's layout-effect body, which reads the freshly
|
|
196
|
+
// committed `ref.current`. Keying on the `element` signal (not just isVisible)
|
|
197
|
+
// makes this run only once the incoming div is actually mounted: when isVisible
|
|
198
|
+
// flips true the mount-in-render effect above mounts the div, `setRef` sets the
|
|
199
|
+
// signal, and this effect runs with `el` present — never against a null ref.
|
|
200
|
+
// (Solid batches, so an isVisible flip + the resulting mount coalesce into one
|
|
201
|
+
// run with the mounted element.) There is therefore no "element not yet in DOM"
|
|
202
|
+
// fresh-enter branch: with no committed div there is nothing to measure, so we
|
|
203
|
+
// wait — exactly as React never runs the body before commit.
|
|
204
|
+
createEffect(
|
|
205
|
+
on(
|
|
206
|
+
[() => local.isVisible !== false, element] as const,
|
|
207
|
+
([isVisible, el]) => {
|
|
132
208
|
const name = local.name;
|
|
133
|
-
const element = elementRef;
|
|
134
209
|
|
|
135
210
|
if (frame != null) {
|
|
136
211
|
cancelAnimationFrame(frame);
|
|
137
212
|
frame = undefined;
|
|
138
213
|
}
|
|
139
214
|
|
|
140
|
-
if (isVisible &&
|
|
215
|
+
if (isVisible && el) {
|
|
141
216
|
const prevSnapshot = scope.snapshots[name];
|
|
142
217
|
|
|
143
218
|
if (prevSnapshot) {
|
|
144
219
|
// FLIP: Element is transitioning from a previous instance.
|
|
145
220
|
setLifecycle("visible");
|
|
146
|
-
const animations = getAnimations(
|
|
221
|
+
const animations = getAnimations(el);
|
|
147
222
|
|
|
148
223
|
// Set properties to animate from.
|
|
149
224
|
const values = prevSnapshot.style.map(([property, prevValue]) => {
|
|
150
|
-
const value =
|
|
225
|
+
const value = el.style.getPropertyValue(property);
|
|
151
226
|
if (property === "translate") {
|
|
152
227
|
const prevRect = prevSnapshot.rect;
|
|
153
|
-
const currentRect =
|
|
228
|
+
const currentRect = el.getBoundingClientRect();
|
|
154
229
|
const deltaX = prevRect.left - currentRect.left;
|
|
155
230
|
const deltaY = prevRect.top - currentRect.top;
|
|
156
|
-
|
|
231
|
+
el.style.setProperty("translate", `${deltaX}px ${deltaY}px`);
|
|
157
232
|
} else {
|
|
158
|
-
|
|
233
|
+
el.style.setProperty(property, prevValue);
|
|
159
234
|
}
|
|
160
235
|
return [property, value] as [string, string];
|
|
161
236
|
});
|
|
162
237
|
|
|
163
238
|
// Cancel any new animations triggered by these properties.
|
|
164
|
-
for (const a of getAnimations(
|
|
239
|
+
for (const a of getAnimations(el)) {
|
|
165
240
|
if (!animations.includes(a)) {
|
|
166
241
|
a.cancel();
|
|
167
242
|
}
|
|
@@ -171,7 +246,7 @@ export function SharedElement(props: SharedElementProps): JSX.Element | null {
|
|
|
171
246
|
frame = requestAnimationFrame(() => {
|
|
172
247
|
frame = undefined;
|
|
173
248
|
for (const [property, value] of values) {
|
|
174
|
-
|
|
249
|
+
el.style.setProperty(property, value);
|
|
175
250
|
}
|
|
176
251
|
});
|
|
177
252
|
|
|
@@ -184,7 +259,7 @@ export function SharedElement(props: SharedElementProps): JSX.Element | null {
|
|
|
184
259
|
setLifecycle("visible");
|
|
185
260
|
});
|
|
186
261
|
}
|
|
187
|
-
} else if (!isVisible &&
|
|
262
|
+
} else if (!isVisible && el) {
|
|
188
263
|
// Wait a microtask to check if a snapshot still exists (meaning no new
|
|
189
264
|
// SharedElement consumed it), then enter exiting state.
|
|
190
265
|
queueMicrotask(() => {
|
|
@@ -192,7 +267,7 @@ export function SharedElement(props: SharedElementProps): JSX.Element | null {
|
|
|
192
267
|
delete scope.snapshots[name];
|
|
193
268
|
setLifecycle("exiting");
|
|
194
269
|
// Wait for animations to finish before hiding.
|
|
195
|
-
Promise.all(getAnimations(
|
|
270
|
+
Promise.all(getAnimations(el).map((a) => a.finished))
|
|
196
271
|
.then(() => setLifecycle("hidden"))
|
|
197
272
|
.catch(() => {});
|
|
198
273
|
} else {
|
|
@@ -200,41 +275,24 @@ export function SharedElement(props: SharedElementProps): JSX.Element | null {
|
|
|
200
275
|
setLifecycle("hidden");
|
|
201
276
|
}
|
|
202
277
|
});
|
|
203
|
-
} else if (isVisible) {
|
|
204
|
-
// Element not yet in DOM, entering fresh
|
|
205
|
-
setLifecycle("entering");
|
|
206
|
-
frame = requestAnimationFrame(() => {
|
|
207
|
-
frame = undefined;
|
|
208
|
-
setLifecycle("visible");
|
|
209
|
-
});
|
|
210
278
|
}
|
|
211
279
|
},
|
|
212
280
|
),
|
|
213
281
|
);
|
|
214
282
|
|
|
215
|
-
//
|
|
283
|
+
// Cancel any pending FLIP frame on disposal. The snapshot store lives in the
|
|
284
|
+
// render-effect cleanup above, which also fires on disposal.
|
|
216
285
|
onCleanup(() => {
|
|
217
286
|
if (frame != null) {
|
|
218
287
|
cancelAnimationFrame(frame);
|
|
219
288
|
}
|
|
220
|
-
|
|
221
|
-
const element = elementRef;
|
|
222
|
-
if (element && element.isConnected && !element.hasAttribute("data-exiting")) {
|
|
223
|
-
// Store a snapshot of the rectangle and computed style for transitioning properties.
|
|
224
|
-
const style = window.getComputedStyle(element);
|
|
225
|
-
if (style.transitionProperty !== "none") {
|
|
226
|
-
const transitionProperty = style.transitionProperty.split(/\s*,\s*/);
|
|
227
|
-
scope.snapshots[local.name] = {
|
|
228
|
-
rect: element.getBoundingClientRect(),
|
|
229
|
-
style: transitionProperty.map((property) => [property, style.getPropertyValue(property)]),
|
|
230
|
-
};
|
|
231
|
-
}
|
|
232
|
-
}
|
|
233
289
|
});
|
|
234
290
|
|
|
235
291
|
const renderProps = useRenderProps(
|
|
236
292
|
{
|
|
237
|
-
children
|
|
293
|
+
get children() {
|
|
294
|
+
return local.children;
|
|
295
|
+
},
|
|
238
296
|
class: local.class,
|
|
239
297
|
style: local.style,
|
|
240
298
|
defaultClassName: "solidaria-SharedElement",
|
package/src/Slider.tsx
CHANGED
|
@@ -12,6 +12,7 @@ import {
|
|
|
12
12
|
createHover,
|
|
13
13
|
mergeProps,
|
|
14
14
|
type AriaSliderProps,
|
|
15
|
+
type HoverEvents,
|
|
15
16
|
} from "@proyecto-viviana/solidaria";
|
|
16
17
|
import {
|
|
17
18
|
createSliderState,
|
|
@@ -124,6 +125,32 @@ export interface SliderThumbProps
|
|
|
124
125
|
style?: StyleOrFunction<SliderThumbRenderProps>;
|
|
125
126
|
}
|
|
126
127
|
|
|
128
|
+
export interface SliderFillRenderProps {
|
|
129
|
+
/** Whether the slider is disabled. */
|
|
130
|
+
isDisabled: boolean;
|
|
131
|
+
/** Whether the slider fill is currently hovered with a mouse. */
|
|
132
|
+
isHovered: boolean;
|
|
133
|
+
/** The value as a percent (0-1). */
|
|
134
|
+
valuePercent: number;
|
|
135
|
+
/** The orientation. */
|
|
136
|
+
orientation: SliderOrientation;
|
|
137
|
+
}
|
|
138
|
+
|
|
139
|
+
export interface SliderFillProps
|
|
140
|
+
extends
|
|
141
|
+
SlotProps,
|
|
142
|
+
HoverEvents,
|
|
143
|
+
Omit<JSX.HTMLAttributes<HTMLDivElement>, "class" | "style" | "children"> {
|
|
144
|
+
/** The offset from which to start the fill. Defaults to the slider's minValue. */
|
|
145
|
+
offset?: number;
|
|
146
|
+
/** The children of the fill. */
|
|
147
|
+
children?: RenderChildren<SliderFillRenderProps>;
|
|
148
|
+
/** The CSS className for the element. */
|
|
149
|
+
class?: ClassNameOrFunction<SliderFillRenderProps>;
|
|
150
|
+
/** The inline style for the element. */
|
|
151
|
+
style?: StyleOrFunction<SliderFillRenderProps>;
|
|
152
|
+
}
|
|
153
|
+
|
|
127
154
|
export interface SliderOutputRenderProps {
|
|
128
155
|
/** The current value. */
|
|
129
156
|
value: number;
|
|
@@ -156,6 +183,7 @@ interface SliderContextValue {
|
|
|
156
183
|
export const SliderContext = createContext<SliderContextValue | null>(null);
|
|
157
184
|
export const SliderStateContext = SliderContext;
|
|
158
185
|
export const SliderTrackContext = SliderContext;
|
|
186
|
+
export const SliderFillContext = SliderContext;
|
|
159
187
|
export const SliderOutputContext = SliderContext;
|
|
160
188
|
|
|
161
189
|
/**
|
|
@@ -252,7 +280,9 @@ export function Slider(props: SliderProps): JSX.Element {
|
|
|
252
280
|
|
|
253
281
|
const renderProps = useRenderProps(
|
|
254
282
|
{
|
|
255
|
-
children
|
|
283
|
+
get children() {
|
|
284
|
+
return props.children;
|
|
285
|
+
},
|
|
256
286
|
class: local.class,
|
|
257
287
|
style: local.style,
|
|
258
288
|
defaultClassName: "solidaria-Slider",
|
|
@@ -363,7 +393,9 @@ export function SliderTrack(props: SliderTrackProps): JSX.Element {
|
|
|
363
393
|
|
|
364
394
|
const renderProps = useRenderProps(
|
|
365
395
|
{
|
|
366
|
-
children
|
|
396
|
+
get children() {
|
|
397
|
+
return props.children;
|
|
398
|
+
},
|
|
367
399
|
class: local.class,
|
|
368
400
|
style: local.style,
|
|
369
401
|
defaultClassName: "solidaria-Slider-track",
|
|
@@ -431,7 +463,9 @@ export function SliderThumb(props: SliderThumbProps): JSX.Element {
|
|
|
431
463
|
|
|
432
464
|
const renderProps = useRenderProps(
|
|
433
465
|
{
|
|
434
|
-
children
|
|
466
|
+
get children() {
|
|
467
|
+
return props.children;
|
|
468
|
+
},
|
|
435
469
|
class: local.class,
|
|
436
470
|
style: local.style,
|
|
437
471
|
defaultClassName: "solidaria-Slider-thumb",
|
|
@@ -467,22 +501,131 @@ export function SliderThumb(props: SliderThumbProps): JSX.Element {
|
|
|
467
501
|
cleanFocusProps() as Record<string, unknown>,
|
|
468
502
|
) as JSX.InputHTMLAttributes<HTMLInputElement>;
|
|
469
503
|
|
|
504
|
+
return (
|
|
505
|
+
<>
|
|
506
|
+
<VisuallyHidden>
|
|
507
|
+
<input ref={setInputRef} {...mergedInputProps()} />
|
|
508
|
+
</VisuallyHidden>
|
|
509
|
+
<div
|
|
510
|
+
{...domProps}
|
|
511
|
+
{...cleanThumbProps()}
|
|
512
|
+
{...cleanHoverProps()}
|
|
513
|
+
class={renderProps.class()}
|
|
514
|
+
style={mergedStyle()}
|
|
515
|
+
data-disabled={state.isDisabled || undefined}
|
|
516
|
+
data-dragging={state.isDragging() || undefined}
|
|
517
|
+
data-focused={isFocused() || state.isFocused() || undefined}
|
|
518
|
+
data-focus-visible={isFocusVisible() || undefined}
|
|
519
|
+
data-hovered={isHovered() || undefined}
|
|
520
|
+
>
|
|
521
|
+
{renderProps.renderChildren()}
|
|
522
|
+
</div>
|
|
523
|
+
</>
|
|
524
|
+
);
|
|
525
|
+
}
|
|
526
|
+
|
|
527
|
+
/** Clamp a value between min and max (mirror of upstream's number/clamp). */
|
|
528
|
+
function clampFill(value: number, min: number, max: number): number {
|
|
529
|
+
return Math.min(Math.max(value, min), max);
|
|
530
|
+
}
|
|
531
|
+
|
|
532
|
+
/**
|
|
533
|
+
* The fill element of a slider, displaying the selected range.
|
|
534
|
+
*
|
|
535
|
+
* Port of react-aria-components `SliderFill` (RAC 1.18). Upstream reads the
|
|
536
|
+
* array-based `SliderState` (`values`/`getThumbPercent`); our `SliderState` is
|
|
537
|
+
* single-value, so this fills from `offset` (default the slider's minValue, i.e.
|
|
538
|
+
* 0%) to the current value — the single-thumb branch of upstream's math, using
|
|
539
|
+
* the same `(v - min) / (max - min)` percent formula the state itself uses.
|
|
540
|
+
*/
|
|
541
|
+
export function SliderFill(props: SliderFillProps): JSX.Element {
|
|
542
|
+
const [local, domProps] = splitProps(props, [
|
|
543
|
+
"class",
|
|
544
|
+
"style",
|
|
545
|
+
"slot",
|
|
546
|
+
"offset",
|
|
547
|
+
"children",
|
|
548
|
+
"onHoverStart",
|
|
549
|
+
"onHoverEnd",
|
|
550
|
+
"onHoverChange",
|
|
551
|
+
]);
|
|
552
|
+
|
|
553
|
+
const context = useContext(SliderContext);
|
|
554
|
+
if (!context) {
|
|
555
|
+
throw new Error("SliderFill must be used within a Slider");
|
|
556
|
+
}
|
|
557
|
+
|
|
558
|
+
const { state } = context;
|
|
559
|
+
|
|
560
|
+
const { isHovered, hoverProps } = createHover(() => ({
|
|
561
|
+
onHoverStart: local.onHoverStart,
|
|
562
|
+
onHoverEnd: local.onHoverEnd,
|
|
563
|
+
onHoverChange: local.onHoverChange,
|
|
564
|
+
}));
|
|
565
|
+
|
|
566
|
+
// Percent (0-100) of an arbitrary value within the track — mirrors
|
|
567
|
+
// SliderState.getValuePercent's formula for a value other than the current one.
|
|
568
|
+
const percentOf = (value: number) => {
|
|
569
|
+
const range = state.maxValue - state.minValue;
|
|
570
|
+
return range === 0 ? 0 : ((value - state.minValue) / range) * 100;
|
|
571
|
+
};
|
|
572
|
+
|
|
573
|
+
const offset = () =>
|
|
574
|
+
local.offset != null ? clampFill(local.offset, state.minValue, state.maxValue) : state.minValue;
|
|
575
|
+
const start = () => percentOf(offset());
|
|
576
|
+
const end = () => state.getValuePercent() * 100;
|
|
577
|
+
const startPercent = () => Math.min(start(), end());
|
|
578
|
+
const sizePercent = () => Math.max(0, Math.max(start(), end()) - startPercent());
|
|
579
|
+
|
|
580
|
+
const renderValues = createMemo<SliderFillRenderProps>(() => ({
|
|
581
|
+
isDisabled: state.isDisabled,
|
|
582
|
+
isHovered: isHovered(),
|
|
583
|
+
valuePercent: state.getValuePercent(),
|
|
584
|
+
orientation: state.orientation,
|
|
585
|
+
}));
|
|
586
|
+
|
|
587
|
+
const renderProps = useRenderProps(
|
|
588
|
+
{
|
|
589
|
+
get children() {
|
|
590
|
+
return props.children;
|
|
591
|
+
},
|
|
592
|
+
class: local.class,
|
|
593
|
+
style: local.style,
|
|
594
|
+
defaultClassName: "solidaria-Slider-fill",
|
|
595
|
+
},
|
|
596
|
+
renderValues,
|
|
597
|
+
);
|
|
598
|
+
|
|
599
|
+
// useRenderProps has no defaultStyle; merge the positioning style with the
|
|
600
|
+
// user's, mirroring upstream SliderFill's defaultStyle (and SliderTrack here).
|
|
601
|
+
const mergedStyle = (): JSX.CSSProperties => {
|
|
602
|
+
const fillStyle: JSX.CSSProperties =
|
|
603
|
+
state.orientation === "vertical"
|
|
604
|
+
? {
|
|
605
|
+
position: "absolute",
|
|
606
|
+
bottom: `${startPercent()}%`,
|
|
607
|
+
height: `${sizePercent()}%`,
|
|
608
|
+
width: "100%",
|
|
609
|
+
}
|
|
610
|
+
: {
|
|
611
|
+
position: "absolute",
|
|
612
|
+
"inset-inline-start": `${startPercent()}%`,
|
|
613
|
+
width: `${sizePercent()}%`,
|
|
614
|
+
height: "100%",
|
|
615
|
+
};
|
|
616
|
+
return { ...fillStyle, ...(renderProps.style() || {}) };
|
|
617
|
+
};
|
|
618
|
+
|
|
470
619
|
return (
|
|
471
620
|
<div
|
|
472
621
|
{...domProps}
|
|
473
|
-
{...
|
|
474
|
-
{...cleanHoverProps()}
|
|
622
|
+
{...hoverProps}
|
|
475
623
|
class={renderProps.class()}
|
|
476
624
|
style={mergedStyle()}
|
|
477
|
-
data-disabled={state.isDisabled || undefined}
|
|
478
|
-
data-dragging={state.isDragging() || undefined}
|
|
479
|
-
data-focused={isFocused() || state.isFocused() || undefined}
|
|
480
|
-
data-focus-visible={isFocusVisible() || undefined}
|
|
481
625
|
data-hovered={isHovered() || undefined}
|
|
626
|
+
data-disabled={state.isDisabled || undefined}
|
|
627
|
+
data-orientation={state.orientation}
|
|
482
628
|
>
|
|
483
|
-
<VisuallyHidden>
|
|
484
|
-
<input ref={setInputRef} {...mergedInputProps()} />
|
|
485
|
-
</VisuallyHidden>
|
|
486
629
|
{renderProps.renderChildren()}
|
|
487
630
|
</div>
|
|
488
631
|
);
|
|
@@ -508,7 +651,9 @@ export function SliderOutput(props: SliderOutputProps): JSX.Element {
|
|
|
508
651
|
|
|
509
652
|
const renderProps = useRenderProps(
|
|
510
653
|
{
|
|
511
|
-
children
|
|
654
|
+
get children() {
|
|
655
|
+
return props.children;
|
|
656
|
+
},
|
|
512
657
|
class: local.class,
|
|
513
658
|
style: local.style,
|
|
514
659
|
defaultClassName: "solidaria-Slider-output",
|
|
@@ -547,4 +692,5 @@ export function SliderOutput(props: SliderOutputProps): JSX.Element {
|
|
|
547
692
|
|
|
548
693
|
Slider.Track = SliderTrack;
|
|
549
694
|
Slider.Thumb = SliderThumb;
|
|
695
|
+
Slider.Fill = SliderFill;
|
|
550
696
|
Slider.Output = SliderOutput;
|
package/src/StepList.tsx
CHANGED
|
@@ -240,12 +240,6 @@ export function Step(props: StepProps): JSX.Element {
|
|
|
240
240
|
}
|
|
241
241
|
};
|
|
242
242
|
|
|
243
|
-
const stepStateText = () => {
|
|
244
|
-
if (isSelected()) return "Current";
|
|
245
|
-
if (isCompleted()) return "Completed";
|
|
246
|
-
return "Not completed";
|
|
247
|
-
};
|
|
248
|
-
|
|
249
243
|
return (
|
|
250
244
|
<li
|
|
251
245
|
{...domProps}
|
|
@@ -263,7 +257,6 @@ export function Step(props: StepProps): JSX.Element {
|
|
|
263
257
|
tabIndex={selectable() ? 0 : undefined}
|
|
264
258
|
onClick={handleClick}
|
|
265
259
|
on:keydown={handleKeyDown}
|
|
266
|
-
aria-label={`Step ${local.stepNumber}: ${local.item.label}, ${stepStateText()}`}
|
|
267
260
|
>
|
|
268
261
|
{local.children}
|
|
269
262
|
</a>
|