@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
package/src/TimeField.tsx
CHANGED
|
@@ -1,25 +1,29 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* TimeField component for solidaria-components
|
|
3
3
|
*
|
|
4
|
-
* Pre-wired headless time field
|
|
5
|
-
*
|
|
4
|
+
* Pre-wired headless time field. Faithful port of react-aria-components'
|
|
5
|
+
* TimeField, which does NOT define its own segment primitives — it reuses
|
|
6
|
+
* `DateInput`/`DateSegment` (there is no `TimeInput`/`TimeSegment` upstream).
|
|
7
|
+
* `TimeFieldState` IS a `DateFieldState` (plus `timeValue`), so this component
|
|
8
|
+
* drives the certified DateField segment/group stack directly: it provides the
|
|
9
|
+
* shared `DateFieldContext`/`DateFieldStateContext` that `DateInput`/`DateSegment`
|
|
10
|
+
* read, plus a `TimeFieldContext` for the time-field label/description/error
|
|
11
|
+
* chrome. Unlike DateField, TimeField renders NO root hidden autofill input (RAC
|
|
12
|
+
* TimeField renders none); its native-validation `<input>` is still emitted by
|
|
13
|
+
* the inner DateInput sibling.
|
|
6
14
|
*/
|
|
7
15
|
|
|
8
16
|
import {
|
|
9
17
|
type JSX,
|
|
18
|
+
type Context,
|
|
10
19
|
createContext,
|
|
11
20
|
createMemo,
|
|
12
21
|
createSignal,
|
|
13
22
|
splitProps,
|
|
14
23
|
useContext,
|
|
15
|
-
For,
|
|
16
24
|
Show,
|
|
17
25
|
} from "solid-js";
|
|
18
|
-
import {
|
|
19
|
-
createTimeField,
|
|
20
|
-
createTimeSegment,
|
|
21
|
-
type AriaTimeFieldProps,
|
|
22
|
-
} from "@proyecto-viviana/solidaria";
|
|
26
|
+
import { createTimeField, mergeProps, type AriaTimeFieldProps } from "@proyecto-viviana/solidaria";
|
|
23
27
|
import {
|
|
24
28
|
createTimeFieldState,
|
|
25
29
|
access,
|
|
@@ -29,15 +33,20 @@ import {
|
|
|
29
33
|
type TimeValue,
|
|
30
34
|
} from "@proyecto-viviana/solid-stately";
|
|
31
35
|
import {
|
|
32
|
-
|
|
36
|
+
DateFieldContext,
|
|
37
|
+
DateFieldStateContext,
|
|
38
|
+
type DateFieldContextValue,
|
|
39
|
+
} from "./DateField";
|
|
40
|
+
import {
|
|
33
41
|
type ClassNameOrFunction,
|
|
34
42
|
type StyleOrFunction,
|
|
35
43
|
type SlotProps,
|
|
36
44
|
useRenderProps,
|
|
37
45
|
dataAttr,
|
|
38
46
|
useIsHydrated,
|
|
47
|
+
Provider,
|
|
39
48
|
} from "./utils";
|
|
40
|
-
import {
|
|
49
|
+
import { TextContext } from "./Text";
|
|
41
50
|
import { FormContext, type FormProps } from "./Form";
|
|
42
51
|
|
|
43
52
|
export interface TimeFieldRenderProps {
|
|
@@ -66,46 +75,6 @@ export interface TimeFieldProps<T extends TimeValue = TimeValue>
|
|
|
66
75
|
locale?: string;
|
|
67
76
|
}
|
|
68
77
|
|
|
69
|
-
export interface TimeInputRenderProps {
|
|
70
|
-
/** Whether the input is disabled. */
|
|
71
|
-
isDisabled: boolean;
|
|
72
|
-
/** Whether the input is focused. */
|
|
73
|
-
isFocused: boolean;
|
|
74
|
-
}
|
|
75
|
-
|
|
76
|
-
export interface TimeInputProps extends SlotProps {
|
|
77
|
-
/** The children of the component (render function receiving segments). */
|
|
78
|
-
children?: (segment: TimeSegmentType) => JSX.Element;
|
|
79
|
-
/** The CSS className for the element. */
|
|
80
|
-
class?: ClassNameOrFunction<TimeInputRenderProps>;
|
|
81
|
-
/** The inline style for the element. */
|
|
82
|
-
style?: StyleOrFunction<TimeInputRenderProps>;
|
|
83
|
-
}
|
|
84
|
-
|
|
85
|
-
export interface TimeSegmentRenderProps {
|
|
86
|
-
/** Whether the segment is focused. */
|
|
87
|
-
isFocused: boolean;
|
|
88
|
-
/** Whether the segment is editable. */
|
|
89
|
-
isEditable: boolean;
|
|
90
|
-
/** Whether the segment is a placeholder. */
|
|
91
|
-
isPlaceholder: boolean;
|
|
92
|
-
/** The segment type. */
|
|
93
|
-
type: TimeSegmentType["type"];
|
|
94
|
-
/** The text to display. */
|
|
95
|
-
text: string;
|
|
96
|
-
}
|
|
97
|
-
|
|
98
|
-
export interface TimeSegmentProps extends SlotProps {
|
|
99
|
-
/** The segment data. */
|
|
100
|
-
segment: TimeSegmentType;
|
|
101
|
-
/** The children of the component. A function may be provided to receive render props. */
|
|
102
|
-
children?: RenderChildren<TimeSegmentRenderProps>;
|
|
103
|
-
/** The CSS className for the element. */
|
|
104
|
-
class?: ClassNameOrFunction<TimeSegmentRenderProps>;
|
|
105
|
-
/** The inline style for the element. */
|
|
106
|
-
style?: StyleOrFunction<TimeSegmentRenderProps>;
|
|
107
|
-
}
|
|
108
|
-
|
|
109
78
|
export interface TimeFieldContextValue {
|
|
110
79
|
state: TimeFieldState<TimeValue>;
|
|
111
80
|
aria: {
|
|
@@ -185,9 +154,9 @@ export function useTimeFieldContext(): TimeFieldState<TimeValue> {
|
|
|
185
154
|
* ```tsx
|
|
186
155
|
* <TimeField label="Time">
|
|
187
156
|
* <Label>Time</Label>
|
|
188
|
-
* <
|
|
189
|
-
* {(segment) => <
|
|
190
|
-
* </
|
|
157
|
+
* <DateInput>
|
|
158
|
+
* {(segment) => <DateSegment segment={segment} />}
|
|
159
|
+
* </DateInput>
|
|
191
160
|
* </TimeField>
|
|
192
161
|
* ```
|
|
193
162
|
*/
|
|
@@ -236,6 +205,7 @@ function TimeFieldInner<T extends TimeValue = TimeValue>(
|
|
|
236
205
|
"locale",
|
|
237
206
|
"granularity",
|
|
238
207
|
"hourCycle",
|
|
208
|
+
"hideTimeZone",
|
|
239
209
|
"shouldForceLeadingZeros",
|
|
240
210
|
"validationState",
|
|
241
211
|
"validationBehavior",
|
|
@@ -247,14 +217,29 @@ function TimeFieldInner<T extends TimeValue = TimeValue>(
|
|
|
247
217
|
);
|
|
248
218
|
|
|
249
219
|
const [fieldRef, setFieldRef] = createSignal<HTMLDivElement | null>(null);
|
|
220
|
+
// Ref to the hidden validation <input> (the DateInput's `<Input>` sibling).
|
|
221
|
+
// Mirrors DateField: create it here, hand it to createTimeField below, and
|
|
222
|
+
// attach it to the same input through the DateFieldContext getter.
|
|
223
|
+
const [validationInputRef, setValidationInputRef] =
|
|
224
|
+
createSignal<HTMLInputElement | null>(null);
|
|
250
225
|
|
|
251
226
|
const state = createTimeFieldState(stateProps);
|
|
252
227
|
|
|
253
228
|
const fieldAria = createTimeField(
|
|
254
229
|
() => ({
|
|
255
230
|
...(rest as Record<string, unknown>),
|
|
231
|
+
// RAC threads these props into both useTimeFieldState and useTimeField;
|
|
232
|
+
// they live in `stateProps` here, so forward them for the field hook's
|
|
233
|
+
// aria-disabled and the native validation <input> (type/required).
|
|
234
|
+
isDisabled: access(stateProps.isDisabled),
|
|
235
|
+
isReadOnly: access(stateProps.isReadOnly),
|
|
236
|
+
isRequired: access(stateProps.isRequired),
|
|
237
|
+
// Standalone default flips the hidden input to type="text" so an empty
|
|
238
|
+
// required value blocks HTML form submission (mirrors DateField).
|
|
239
|
+
validationBehavior: stateProps.validationBehavior ?? "native",
|
|
256
240
|
description: stateProps.description,
|
|
257
241
|
errorMessage: stateProps.errorMessage,
|
|
242
|
+
inputRef: () => validationInputRef() ?? undefined,
|
|
258
243
|
}),
|
|
259
244
|
state as unknown as TimeFieldState<TimeValue>,
|
|
260
245
|
fieldRef,
|
|
@@ -276,147 +261,97 @@ function TimeFieldInner<T extends TimeValue = TimeValue>(
|
|
|
276
261
|
renderValues,
|
|
277
262
|
);
|
|
278
263
|
|
|
279
|
-
const
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
value={{
|
|
288
|
-
state: state as unknown as TimeFieldState<TimeValue>,
|
|
289
|
-
aria: {
|
|
290
|
-
labelProps: fieldAria.labelProps,
|
|
291
|
-
inputProps: fieldAria.inputProps,
|
|
292
|
-
descriptionProps: fieldAria.descriptionProps,
|
|
293
|
-
errorMessageProps: fieldAria.errorMessageProps,
|
|
294
|
-
},
|
|
295
|
-
}}
|
|
296
|
-
>
|
|
297
|
-
<div
|
|
298
|
-
ref={setFieldRef}
|
|
299
|
-
{...fieldAria.fieldProps}
|
|
300
|
-
class={renderProps.class()}
|
|
301
|
-
style={renderProps.style()}
|
|
302
|
-
data-disabled={dataAttr(state.isDisabled())}
|
|
303
|
-
data-readonly={dataAttr(state.isReadOnly())}
|
|
304
|
-
data-required={dataAttr(state.isRequired())}
|
|
305
|
-
data-invalid={dataAttr(state.isInvalid())}
|
|
306
|
-
>
|
|
307
|
-
{local.children as JSX.Element}
|
|
308
|
-
</div>
|
|
309
|
-
<Show when={(rest as Record<string, unknown>).name}>
|
|
310
|
-
<HiddenTimeInput
|
|
311
|
-
name={(rest as Record<string, unknown>).name as string | undefined}
|
|
312
|
-
form={(rest as Record<string, unknown>).form as string | undefined}
|
|
313
|
-
value={state.value()}
|
|
314
|
-
autoComplete={(rest as Record<string, unknown>).autoComplete as string | undefined}
|
|
315
|
-
isDisabled={state.isDisabled()}
|
|
316
|
-
isRequired={state.isRequired()}
|
|
317
|
-
validationBehavior={validationBehavior()}
|
|
318
|
-
validationState={state}
|
|
319
|
-
focus={() => {
|
|
320
|
-
fieldRef()?.querySelector<HTMLElement>('[role="spinbutton"]')?.focus();
|
|
321
|
-
}}
|
|
322
|
-
minValue={access(stateProps.minValue) as TimeValue | undefined}
|
|
323
|
-
maxValue={access(stateProps.maxValue) as TimeValue | undefined}
|
|
324
|
-
granularity={state.granularity}
|
|
325
|
-
/>
|
|
326
|
-
</Show>
|
|
327
|
-
</TimeFieldContext.Provider>
|
|
328
|
-
</TimeFieldStateContext.Provider>
|
|
329
|
-
);
|
|
330
|
-
}
|
|
331
|
-
|
|
332
|
-
/**
|
|
333
|
-
* The input area containing time segments.
|
|
334
|
-
*/
|
|
335
|
-
export function TimeInput(props: TimeInputProps): JSX.Element {
|
|
336
|
-
const { state, aria } = useTimeFieldContextValue();
|
|
337
|
-
const [isFocused, setIsFocused] = createSignal(false);
|
|
338
|
-
|
|
339
|
-
const renderValues = createMemo<TimeInputRenderProps>(() => ({
|
|
340
|
-
isDisabled: state.isDisabled(),
|
|
341
|
-
isFocused: isFocused(),
|
|
342
|
-
}));
|
|
343
|
-
|
|
344
|
-
const renderProps = useRenderProps(
|
|
345
|
-
{
|
|
346
|
-
class: props.class,
|
|
347
|
-
style: props.style,
|
|
348
|
-
defaultClassName: "solidaria-TimeInput",
|
|
264
|
+
const textSlots = {
|
|
265
|
+
slots: {
|
|
266
|
+
get description() {
|
|
267
|
+
return fieldAria.descriptionProps;
|
|
268
|
+
},
|
|
269
|
+
get errorMessage() {
|
|
270
|
+
return fieldAria.errorMessageProps;
|
|
271
|
+
},
|
|
349
272
|
},
|
|
350
|
-
|
|
351
|
-
);
|
|
352
|
-
|
|
353
|
-
return (
|
|
354
|
-
<div
|
|
355
|
-
{...aria.inputProps}
|
|
356
|
-
class={renderProps.class()}
|
|
357
|
-
style={renderProps.style()}
|
|
358
|
-
data-disabled={dataAttr(state.isDisabled())}
|
|
359
|
-
data-focused={dataAttr(isFocused())}
|
|
360
|
-
onFocusIn={() => setIsFocused(true)}
|
|
361
|
-
onFocusOut={() => setIsFocused(false)}
|
|
362
|
-
>
|
|
363
|
-
<For each={state.segments()}>{(segment) => props.children?.(segment)}</For>
|
|
364
|
-
</div>
|
|
365
|
-
);
|
|
366
|
-
}
|
|
367
|
-
|
|
368
|
-
/**
|
|
369
|
-
* A segment of a time field (hour, minute, second, AM/PM).
|
|
370
|
-
*/
|
|
371
|
-
export function TimeSegment(props: TimeSegmentProps): JSX.Element {
|
|
372
|
-
const state = useTimeFieldContext();
|
|
373
|
-
const [segmentRef, setSegmentRef] = createSignal<HTMLDivElement | null>(null);
|
|
374
|
-
|
|
375
|
-
const segmentAria = createTimeSegment(
|
|
376
|
-
{ segment: props.segment },
|
|
377
|
-
state as unknown as TimeFieldState,
|
|
378
|
-
segmentRef,
|
|
379
|
-
);
|
|
380
|
-
|
|
381
|
-
const renderValues = createMemo<TimeSegmentRenderProps>(() => ({
|
|
382
|
-
isFocused: segmentAria.isFocused,
|
|
383
|
-
isEditable: segmentAria.isEditable,
|
|
384
|
-
isPlaceholder: segmentAria.isPlaceholder,
|
|
385
|
-
type: props.segment.type,
|
|
386
|
-
text: segmentAria.text,
|
|
387
|
-
}));
|
|
273
|
+
};
|
|
388
274
|
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
|
|
275
|
+
// The shared context read by the reused DateInput/DateSegment. Read through
|
|
276
|
+
// getters so consumers see the LIVE memo values (createDescription appends the
|
|
277
|
+
// value-description id via a deferred effect; a frozen snapshot would miss it).
|
|
278
|
+
const dateFieldContextValue: DateFieldContextValue = {
|
|
279
|
+
get state() {
|
|
280
|
+
return state as unknown as DateFieldContextValue["state"];
|
|
281
|
+
},
|
|
282
|
+
aria: {
|
|
283
|
+
get labelProps() {
|
|
284
|
+
return fieldAria.labelProps;
|
|
285
|
+
},
|
|
286
|
+
// The segment group props (role="group", aria-labelledby, unicode-bidi
|
|
287
|
+
// isolate, arrow-key nav, focus-within handlers) are routed to the
|
|
288
|
+
// DateInput element; the outer wrapper stays roleless.
|
|
289
|
+
get inputProps() {
|
|
290
|
+
return fieldAria.fieldProps;
|
|
291
|
+
},
|
|
292
|
+
// The native validation <input> props (type/hidden/required/onChange under
|
|
293
|
+
// native validation), rendered as the DateInput's sibling. Thread the
|
|
294
|
+
// validation-input ref so createTimeField's form-reset/validation wiring
|
|
295
|
+
// resolves to the mounted element.
|
|
296
|
+
get hiddenInputProps() {
|
|
297
|
+
return mergeProps(fieldAria.inputProps, { ref: setValidationInputRef });
|
|
298
|
+
},
|
|
299
|
+
get descriptionProps() {
|
|
300
|
+
return fieldAria.descriptionProps;
|
|
301
|
+
},
|
|
302
|
+
get errorMessageProps() {
|
|
303
|
+
return fieldAria.errorMessageProps;
|
|
304
|
+
},
|
|
395
305
|
},
|
|
396
|
-
renderValues,
|
|
397
|
-
);
|
|
398
|
-
|
|
399
|
-
// Determine children content - avoid Show for SSR hydration compatibility
|
|
400
|
-
const getChildren = () => {
|
|
401
|
-
if (typeof props.children === "function") {
|
|
402
|
-
return renderProps.renderChildren();
|
|
403
|
-
}
|
|
404
|
-
return segmentAria.text;
|
|
405
306
|
};
|
|
406
307
|
|
|
407
308
|
return (
|
|
408
|
-
<
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
|
|
309
|
+
<TimeFieldStateContext.Provider value={state as unknown as TimeFieldState<TimeValue>}>
|
|
310
|
+
<DateFieldStateContext.Provider
|
|
311
|
+
value={state as unknown as DateFieldContextValue["state"]}
|
|
312
|
+
>
|
|
313
|
+
<DateFieldContext.Provider value={dateFieldContextValue}>
|
|
314
|
+
<TimeFieldContext.Provider
|
|
315
|
+
value={{
|
|
316
|
+
state: state as unknown as TimeFieldState<TimeValue>,
|
|
317
|
+
aria: {
|
|
318
|
+
get labelProps() {
|
|
319
|
+
return fieldAria.labelProps;
|
|
320
|
+
},
|
|
321
|
+
get inputProps() {
|
|
322
|
+
return fieldAria.fieldProps;
|
|
323
|
+
},
|
|
324
|
+
get descriptionProps() {
|
|
325
|
+
return fieldAria.descriptionProps;
|
|
326
|
+
},
|
|
327
|
+
get errorMessageProps() {
|
|
328
|
+
return fieldAria.errorMessageProps;
|
|
329
|
+
},
|
|
330
|
+
},
|
|
331
|
+
}}
|
|
332
|
+
>
|
|
333
|
+
<div
|
|
334
|
+
ref={setFieldRef}
|
|
335
|
+
class={renderProps.class()}
|
|
336
|
+
style={renderProps.style()}
|
|
337
|
+
data-disabled={dataAttr(state.isDisabled())}
|
|
338
|
+
data-readonly={dataAttr(state.isReadOnly())}
|
|
339
|
+
data-required={dataAttr(state.isRequired())}
|
|
340
|
+
data-invalid={dataAttr(state.isInvalid())}
|
|
341
|
+
>
|
|
342
|
+
<Provider values={[[TextContext, textSlots]] as Array<[Context<unknown>, unknown]>}>
|
|
343
|
+
{local.children as JSX.Element}
|
|
344
|
+
</Provider>
|
|
345
|
+
</div>
|
|
346
|
+
{/*
|
|
347
|
+
Unlike DateField, TimeField renders NO root hidden autofill input —
|
|
348
|
+
RAC TimeField renders none (react-aria-components TimeField.mjs). The
|
|
349
|
+
native-validation <input> is emitted by the inner DateInput sibling.
|
|
350
|
+
*/}
|
|
351
|
+
</TimeFieldContext.Provider>
|
|
352
|
+
</DateFieldContext.Provider>
|
|
353
|
+
</DateFieldStateContext.Provider>
|
|
354
|
+
</TimeFieldStateContext.Provider>
|
|
420
355
|
);
|
|
421
356
|
}
|
|
422
357
|
|
|
@@ -442,9 +377,9 @@ export interface TimeFieldDescriptionProps {
|
|
|
442
377
|
export function TimeFieldDescription(props: TimeFieldDescriptionProps): JSX.Element {
|
|
443
378
|
const { aria } = useTimeFieldContextValue();
|
|
444
379
|
return (
|
|
445
|
-
<
|
|
380
|
+
<span {...aria.descriptionProps} class={props.class}>
|
|
446
381
|
{props.children}
|
|
447
|
-
</
|
|
382
|
+
</span>
|
|
448
383
|
);
|
|
449
384
|
}
|
|
450
385
|
|
|
@@ -456,9 +391,9 @@ export interface TimeFieldErrorMessageProps {
|
|
|
456
391
|
export function TimeFieldErrorMessage(props: TimeFieldErrorMessageProps): JSX.Element {
|
|
457
392
|
const { aria } = useTimeFieldContextValue();
|
|
458
393
|
return (
|
|
459
|
-
<
|
|
394
|
+
<span {...aria.errorMessageProps} class={props.class}>
|
|
460
395
|
{props.children}
|
|
461
|
-
</
|
|
396
|
+
</span>
|
|
462
397
|
);
|
|
463
398
|
}
|
|
464
399
|
|
package/src/Toast.tsx
CHANGED
|
@@ -131,6 +131,7 @@ export const ToastContext = createContext<ToastState<ToastContent> | null>(null)
|
|
|
131
131
|
interface ToastAriaContextValue {
|
|
132
132
|
titleProps: JSX.HTMLAttributes<HTMLElement>;
|
|
133
133
|
descriptionProps: JSX.HTMLAttributes<HTMLElement>;
|
|
134
|
+
contentProps: JSX.HTMLAttributes<HTMLElement>;
|
|
134
135
|
}
|
|
135
136
|
|
|
136
137
|
const ToastAriaContext = createContext<ToastAriaContextValue | null>(null);
|
|
@@ -265,8 +266,6 @@ export function ToastRegion(props: ToastRegionProps): JSX.Element {
|
|
|
265
266
|
},
|
|
266
267
|
renderValues,
|
|
267
268
|
);
|
|
268
|
-
const renderedChildren = createMemo(() => renderProps.renderChildren());
|
|
269
|
-
|
|
270
269
|
const domProps = createMemo(() =>
|
|
271
270
|
filterDOMProps(rest as Record<string, unknown>, { global: true }),
|
|
272
271
|
);
|
|
@@ -317,14 +316,19 @@ export function ToastRegion(props: ToastRegionProps): JSX.Element {
|
|
|
317
316
|
|
|
318
317
|
const visibleToasts = () => state()?.visibleToasts() ?? [];
|
|
319
318
|
const hasToasts = () => visibleToasts().length > 0;
|
|
319
|
+
const hasAuthoredRegionStyle = () => local.class != null || local.style != null;
|
|
320
320
|
|
|
321
321
|
const regionContent = () => {
|
|
322
322
|
if (!state()) return null;
|
|
323
323
|
|
|
324
|
-
// Merge styles - placement styles are base, renderProps.style() overrides
|
|
325
324
|
const mergedStyle = () => {
|
|
326
|
-
const placement = placementStyles();
|
|
327
325
|
const custom = renderProps.style();
|
|
326
|
+
// React Aria Components leaves ToastRegion unstyled. Keep this package's
|
|
327
|
+
// fallback placement only for bare regions so styled layers such as S2 can
|
|
328
|
+
// own fixed viewport geometry with their generated classes.
|
|
329
|
+
if (hasAuthoredRegionStyle()) return custom;
|
|
330
|
+
|
|
331
|
+
const placement = placementStyles();
|
|
328
332
|
if (!custom) return placement;
|
|
329
333
|
return { ...placement, ...custom } as JSX.CSSProperties;
|
|
330
334
|
};
|
|
@@ -340,7 +344,7 @@ export function ToastRegion(props: ToastRegionProps): JSX.Element {
|
|
|
340
344
|
style={mergedStyle()}
|
|
341
345
|
data-placement={normalizedPlacement()}
|
|
342
346
|
>
|
|
343
|
-
{
|
|
347
|
+
{renderProps.renderChildren()}
|
|
344
348
|
</div>
|
|
345
349
|
);
|
|
346
350
|
};
|
|
@@ -403,7 +407,9 @@ export function Toast(props: ToastProps): JSX.Element {
|
|
|
403
407
|
|
|
404
408
|
const renderProps = useRenderProps(
|
|
405
409
|
{
|
|
406
|
-
children
|
|
410
|
+
get children() {
|
|
411
|
+
return props.children;
|
|
412
|
+
},
|
|
407
413
|
class: local.class,
|
|
408
414
|
style: local.style,
|
|
409
415
|
defaultClassName: "solidaria-Toast",
|
|
@@ -478,8 +484,10 @@ export function Toast(props: ToastProps): JSX.Element {
|
|
|
478
484
|
|
|
479
485
|
const { ref: _ref, ...cleanToastProps } = toastAria.toastProps as Record<string, unknown>;
|
|
480
486
|
|
|
481
|
-
// Ensure ARIA title/description IDs
|
|
482
|
-
// even when children are pre-composed outside
|
|
487
|
+
// Ensure ARIA title/description IDs and the content live-region attributes are
|
|
488
|
+
// present on rendered sub-components, even when children are pre-composed outside
|
|
489
|
+
// the Toast provider owner (as DefaultToast does), where useContext can't reach
|
|
490
|
+
// this owner's ToastAriaContext.
|
|
483
491
|
createEffect(() => {
|
|
484
492
|
if (!toastRef) return;
|
|
485
493
|
|
|
@@ -487,6 +495,7 @@ export function Toast(props: ToastProps): JSX.Element {
|
|
|
487
495
|
const descriptionId = (toastAria.descriptionProps as Record<string, unknown>).id as
|
|
488
496
|
| string
|
|
489
497
|
| undefined;
|
|
498
|
+
const contentProps = toastAria.contentProps as Record<string, unknown>;
|
|
490
499
|
|
|
491
500
|
if (titleId) {
|
|
492
501
|
const titleEl = toastRef.querySelector("[data-solidaria-toast-title]");
|
|
@@ -501,11 +510,27 @@ export function Toast(props: ToastProps): JSX.Element {
|
|
|
501
510
|
descriptionEl.id = descriptionId;
|
|
502
511
|
}
|
|
503
512
|
}
|
|
513
|
+
|
|
514
|
+
// Wire the content area as a live region (role="alert" / aria-live="assertive")
|
|
515
|
+
// so the toast message is announced to screen readers when it appears.
|
|
516
|
+
const contentEl = toastRef.querySelector("[data-solidaria-toast-content]");
|
|
517
|
+
if (contentEl instanceof HTMLElement) {
|
|
518
|
+
const role = contentProps.role as string | undefined;
|
|
519
|
+
const ariaLive = contentProps["aria-live"] as string | undefined;
|
|
520
|
+
const ariaAtomic = contentProps["aria-atomic"] as string | undefined;
|
|
521
|
+
if (role) contentEl.setAttribute("role", role);
|
|
522
|
+
if (ariaLive) contentEl.setAttribute("aria-live", ariaLive);
|
|
523
|
+
if (ariaAtomic) contentEl.setAttribute("aria-atomic", ariaAtomic);
|
|
524
|
+
}
|
|
504
525
|
});
|
|
505
526
|
|
|
506
527
|
return (
|
|
507
528
|
<ToastAriaContext.Provider
|
|
508
|
-
value={{
|
|
529
|
+
value={{
|
|
530
|
+
titleProps: toastAria.titleProps,
|
|
531
|
+
descriptionProps: toastAria.descriptionProps,
|
|
532
|
+
contentProps: toastAria.contentProps,
|
|
533
|
+
}}
|
|
509
534
|
>
|
|
510
535
|
<div
|
|
511
536
|
ref={toastRef}
|
|
@@ -537,10 +562,14 @@ export function ToastTitle(props: ToastTitleProps): JSX.Element {
|
|
|
537
562
|
const context = useContext(ToastAriaContext);
|
|
538
563
|
const { ref: _ref, ...ariaTitleProps } = (context?.titleProps ?? {}) as Record<string, unknown>;
|
|
539
564
|
|
|
565
|
+
// Upstream S2 Toast renders the title via `<Text slot="title">`, and RAC `Text`
|
|
566
|
+
// defaults to `elementType="span"` — so the title's text-node container is a
|
|
567
|
+
// `<span>`, not a `<div>`. Mirror that (the D7 contrast descriptor keys on the
|
|
568
|
+
// container tag name; a `<div>` here diverged on every variant × theme). (parity rule #1/#2)
|
|
540
569
|
return (
|
|
541
|
-
<
|
|
570
|
+
<span data-solidaria-toast-title="" {...ariaTitleProps} class={props.class} style={props.style}>
|
|
542
571
|
{props.children}
|
|
543
|
-
</
|
|
572
|
+
</span>
|
|
544
573
|
);
|
|
545
574
|
}
|
|
546
575
|
|
|
@@ -560,14 +589,50 @@ export function ToastDescription(props: ToastDescriptionProps): JSX.Element {
|
|
|
560
589
|
unknown
|
|
561
590
|
>;
|
|
562
591
|
|
|
592
|
+
// Match the title: upstream toast text is rendered in `<span>` elements (RAC
|
|
593
|
+
// `Text`). The port additionally supports a description (upstream S2 has only a
|
|
594
|
+
// title); keep it as a `<span>` sibling so its text-node container tag is faithful.
|
|
563
595
|
return (
|
|
564
|
-
<
|
|
596
|
+
<span
|
|
565
597
|
data-solidaria-toast-description=""
|
|
566
598
|
{...ariaDescriptionProps}
|
|
567
599
|
class={props.class}
|
|
568
600
|
style={props.style}
|
|
569
601
|
>
|
|
570
602
|
{props.children}
|
|
603
|
+
</span>
|
|
604
|
+
);
|
|
605
|
+
}
|
|
606
|
+
|
|
607
|
+
export interface ToastContentProps {
|
|
608
|
+
children: JSX.Element;
|
|
609
|
+
class?: string;
|
|
610
|
+
style?: JSX.CSSProperties;
|
|
611
|
+
}
|
|
612
|
+
|
|
613
|
+
/**
|
|
614
|
+
* ToastContent wraps the toast message (title + description) in the live region
|
|
615
|
+
* announced to screen readers. It carries `role="alert"` / `aria-live="assertive"`
|
|
616
|
+
* from createToast's contentProps so the toast text is announced when it appears.
|
|
617
|
+
*
|
|
618
|
+
* It is rendered as a sibling of the close button (never wrapping it) so screen
|
|
619
|
+
* readers announce the message without reading the close button first.
|
|
620
|
+
*/
|
|
621
|
+
export function ToastContent(props: ToastContentProps): JSX.Element {
|
|
622
|
+
const context = useContext(ToastAriaContext);
|
|
623
|
+
const { ref: _ref, ...ariaContentProps } = (context?.contentProps ?? {}) as Record<
|
|
624
|
+
string,
|
|
625
|
+
unknown
|
|
626
|
+
>;
|
|
627
|
+
|
|
628
|
+
return (
|
|
629
|
+
<div
|
|
630
|
+
data-solidaria-toast-content=""
|
|
631
|
+
{...ariaContentProps}
|
|
632
|
+
class={props.class}
|
|
633
|
+
style={props.style}
|
|
634
|
+
>
|
|
635
|
+
{props.children}
|
|
571
636
|
</div>
|
|
572
637
|
);
|
|
573
638
|
}
|
|
@@ -633,7 +698,7 @@ export function DefaultToast(props: DefaultToastProps): JSX.Element {
|
|
|
633
698
|
return (
|
|
634
699
|
<Toast toast={props.toast}>
|
|
635
700
|
<div style={{ display: "flex", "align-items": "flex-start", gap: "12px" }}>
|
|
636
|
-
<
|
|
701
|
+
<ToastContent style={{ flex: 1 }}>
|
|
637
702
|
<Show when={title()}>
|
|
638
703
|
<ToastTitle style={{ "font-weight": "bold", "margin-bottom": "4px" }}>
|
|
639
704
|
{title()}
|
|
@@ -647,7 +712,7 @@ export function DefaultToast(props: DefaultToastProps): JSX.Element {
|
|
|
647
712
|
{actionLabel()}
|
|
648
713
|
</button>
|
|
649
714
|
</Show>
|
|
650
|
-
</
|
|
715
|
+
</ToastContent>
|
|
651
716
|
<ToastCloseButton toast={props.toast} />
|
|
652
717
|
</div>
|
|
653
718
|
</Toast>
|
package/src/ToggleButton.tsx
CHANGED
|
@@ -118,7 +118,9 @@ export function ToggleButton(props: ToggleButtonProps): JSX.Element {
|
|
|
118
118
|
|
|
119
119
|
const renderProps = useRenderProps(
|
|
120
120
|
{
|
|
121
|
-
children
|
|
121
|
+
get children() {
|
|
122
|
+
return local.children;
|
|
123
|
+
},
|
|
122
124
|
class: local.class,
|
|
123
125
|
style: local.style,
|
|
124
126
|
defaultClassName: "solidaria-ToggleButton",
|
|
@@ -95,7 +95,9 @@ export function ToggleButtonGroup(props: ToggleButtonGroupProps): JSX.Element {
|
|
|
95
95
|
|
|
96
96
|
const renderProps = useRenderProps(
|
|
97
97
|
{
|
|
98
|
-
children
|
|
98
|
+
get children() {
|
|
99
|
+
return local.children;
|
|
100
|
+
},
|
|
99
101
|
class: local.class,
|
|
100
102
|
style: local.style,
|
|
101
103
|
defaultClassName: "solidaria-ToggleButtonGroup",
|
package/src/Tooltip.tsx
CHANGED