@proyecto-viviana/solidaria-components 0.3.2 → 0.4.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/dist/ActionBar.js +184 -0
- package/dist/ActionBar.js.map +1 -0
- package/dist/ActionBar.jsx +128 -0
- package/dist/ActionBar.jsx.map +1 -0
- 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.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 +334 -0
- package/dist/Breadcrumbs.js.map +1 -0
- package/dist/Breadcrumbs.jsx +266 -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 +538 -0
- package/dist/Calendar.js.map +1 -0
- package/dist/Calendar.jsx +333 -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 +1720 -0
- package/dist/Color.js.map +1 -0
- package/dist/Color.jsx +1344 -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 +4 -4
- package/dist/ComboBox.d.ts.map +1 -1
- package/dist/ComboBox.js +992 -0
- package/dist/ComboBox.js.map +1 -0
- package/dist/ComboBox.jsx +714 -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 +3 -3
- package/dist/DateField.d.ts.map +1 -1
- package/dist/DateField.js +4 -0
- package/dist/DateField.jsx +4 -0
- package/dist/DateField2.js +499 -0
- package/dist/DateField2.js.map +1 -0
- package/dist/DateField2.jsx +317 -0
- package/dist/DateField2.jsx.map +1 -0
- package/dist/DatePicker.d.ts +4 -4
- package/dist/DatePicker.d.ts.map +1 -1
- package/dist/DatePicker.js +991 -0
- package/dist/DatePicker.js.map +1 -0
- package/dist/DatePicker.jsx +682 -0
- package/dist/DatePicker.jsx.map +1 -0
- 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 +328 -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/HiddenTimeInput.js +104 -0
- package/dist/HiddenTimeInput.js.map +1 -0
- package/dist/HiddenTimeInput.jsx +69 -0
- package/dist/HiddenTimeInput.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.map +1 -1
- package/dist/ListBox.js +670 -0
- package/dist/ListBox.js.map +1 -0
- package/dist/ListBox.jsx +508 -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 +380 -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 +464 -0
- package/dist/Popover.js.map +1 -0
- package/dist/Popover.jsx +333 -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 +410 -0
- package/dist/RangeCalendar.js.map +1 -0
- package/dist/RangeCalendar.jsx +253 -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 +643 -0
- package/dist/SearchField.js.map +1 -0
- package/dist/SearchField.jsx +526 -0
- package/dist/SearchField.jsx.map +1 -0
- package/dist/Select.d.ts.map +1 -1
- package/dist/Select.js +1031 -0
- package/dist/Select.js.map +1 -0
- package/dist/Select.jsx +744 -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 +165 -0
- package/dist/SharedElementTransition.js.map +1 -0
- package/dist/SharedElementTransition.jsx +138 -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.js +198 -0
- package/dist/StepList.js.map +1 -0
- package/dist/StepList.jsx +141 -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 +48 -0
- package/dist/Table.d.ts.map +1 -1
- package/dist/Table.js +1759 -0
- package/dist/Table.js.map +1 -0
- package/dist/Table.jsx +1348 -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 +595 -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.map +1 -1
- package/dist/TagGroup.js +378 -0
- package/dist/TagGroup.js.map +1 -0
- package/dist/TagGroup.jsx +270 -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 +436 -0
- package/dist/TextField.js.map +1 -0
- package/dist/TextField.jsx +403 -0
- package/dist/TextField.jsx.map +1 -0
- package/dist/TimeField.d.ts +3 -3
- package/dist/TimeField.d.ts.map +1 -1
- package/dist/TimeField.js +372 -0
- package/dist/TimeField.js.map +1 -0
- package/dist/TimeField.jsx +224 -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 +7 -6
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +70 -23932
- package/dist/index.jsx +70 -18337
- package/dist/useDragAndDrop.js +2 -0
- package/dist/useDragAndDrop.jsx +2 -0
- package/dist/useDragAndDrop2.js +395 -0
- package/dist/useDragAndDrop2.js.map +1 -0
- package/dist/useDragAndDrop2.jsx +395 -0
- package/dist/useDragAndDrop2.jsx.map +1 -0
- package/dist/utils.d.ts +83 -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 +401 -4
- package/src/Breadcrumbs.tsx +3 -1
- package/src/Button.tsx +22 -2
- package/src/Calendar.tsx +27 -10
- package/src/CalendarPicker.tsx +73 -0
- package/src/Checkbox.tsx +539 -3
- package/src/Collection.tsx +9 -3
- package/src/Color.tsx +42 -14
- package/src/ComboBox.tsx +50 -6
- package/src/DateField.tsx +20 -2
- package/src/DatePicker.tsx +57 -5
- package/src/Dialog.tsx +13 -5
- package/src/Disclosure.tsx +3 -1
- package/src/DragAndDrop.tsx +3 -1
- package/src/DropZone.tsx +3 -1
- package/src/GridList.tsx +125 -24
- package/src/Icon.tsx +3 -1
- package/src/Link.tsx +3 -1
- package/src/ListBox.tsx +31 -4
- package/src/Menu.tsx +252 -128
- package/src/Meter.tsx +3 -1
- package/src/Modal.tsx +100 -52
- package/src/NumberField.tsx +51 -8
- package/src/Popover.tsx +40 -10
- package/src/ProgressBar.tsx +3 -1
- package/src/RadioGroup.tsx +468 -4
- package/src/RangeCalendar.tsx +3 -1
- package/src/SearchField.tsx +27 -3
- package/src/Select.tsx +22 -7
- package/src/SelectionIndicator.tsx +3 -1
- package/src/SharedElementTransition.tsx +3 -1
- package/src/Slider.tsx +159 -13
- package/src/Switch.tsx +395 -2
- package/src/Table.tsx +409 -95
- package/src/Tabs.tsx +16 -45
- package/src/TagGroup.tsx +3 -1
- package/src/Text.tsx +31 -10
- package/src/TextField.tsx +43 -5
- package/src/TimeField.tsx +20 -2
- 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 +77 -9
- package/src/Virtualizer.tsx +180 -31
- package/src/VirtualizerLayouts.ts +45 -10
- package/src/index.ts +50 -0
- package/src/utils.tsx +243 -27
- package/dist/index.js.map +0 -1
- package/dist/index.jsx.map +0 -1
package/src/Tabs.tsx
CHANGED
|
@@ -102,10 +102,6 @@ export interface TabListRenderProps {
|
|
|
102
102
|
orientation: TabOrientation;
|
|
103
103
|
/** Whether the tab list is disabled. */
|
|
104
104
|
isDisabled: boolean;
|
|
105
|
-
/** Whether the tab list has focus. */
|
|
106
|
-
isFocused: boolean;
|
|
107
|
-
/** Whether the tab list has visible focus. */
|
|
108
|
-
isFocusVisible: boolean;
|
|
109
105
|
}
|
|
110
106
|
|
|
111
107
|
export interface TabListProps<T> extends Omit<AriaTabListProps, "children">, SlotProps {
|
|
@@ -319,7 +315,9 @@ export function Tabs<T>(props: TabsProps<T>): JSX.Element {
|
|
|
319
315
|
{
|
|
320
316
|
class: local.class,
|
|
321
317
|
style: local.style,
|
|
322
|
-
children
|
|
318
|
+
get children() {
|
|
319
|
+
return props.children;
|
|
320
|
+
},
|
|
323
321
|
defaultClassName: "solidaria-Tabs",
|
|
324
322
|
},
|
|
325
323
|
renderValues,
|
|
@@ -437,13 +435,9 @@ function TabListInner<T>(props: {
|
|
|
437
435
|
// Create tab list aria props
|
|
438
436
|
const { tabListProps } = createTabList<T>(props.ariaProps as AriaTabListProps, state);
|
|
439
437
|
|
|
440
|
-
const { isFocused, isFocusVisible, focusProps } = createFocusRing();
|
|
441
|
-
|
|
442
438
|
const renderValues = createMemo<TabListRenderProps>(() => ({
|
|
443
439
|
orientation: state.orientation(),
|
|
444
440
|
isDisabled: state.isDisabled(),
|
|
445
|
-
isFocused: state.isFocused() || isFocused(),
|
|
446
|
-
isFocusVisible: isFocusVisible(),
|
|
447
441
|
}));
|
|
448
442
|
|
|
449
443
|
const renderProps = useRenderProps(
|
|
@@ -455,42 +449,16 @@ function TabListInner<T>(props: {
|
|
|
455
449
|
renderValues,
|
|
456
450
|
);
|
|
457
451
|
|
|
458
|
-
// Helper to safely call event handlers that may be bound tuples
|
|
459
|
-
const callHandler = <E extends Event>(
|
|
460
|
-
handler: JSX.EventHandlerUnion<HTMLElement, E> | undefined,
|
|
461
|
-
event: E,
|
|
462
|
-
) => {
|
|
463
|
-
if (!handler) return;
|
|
464
|
-
if (Array.isArray(handler)) {
|
|
465
|
-
handler[1].call(handler[0], event);
|
|
466
|
-
return;
|
|
467
|
-
}
|
|
468
|
-
if (typeof handler === "function") {
|
|
469
|
-
(handler as (evt: E) => void)(event);
|
|
470
|
-
return;
|
|
471
|
-
}
|
|
472
|
-
if (
|
|
473
|
-
typeof handler === "object" &&
|
|
474
|
-
"handleEvent" in handler &&
|
|
475
|
-
typeof handler.handleEvent === "function"
|
|
476
|
-
) {
|
|
477
|
-
(handler.handleEvent as (evt: E) => void)(event);
|
|
478
|
-
}
|
|
479
|
-
};
|
|
480
|
-
|
|
481
|
-
// Combine event handlers
|
|
482
452
|
const handleKeyDown = (e: KeyboardEvent) => {
|
|
483
453
|
tabListProps.onKeyDown(e);
|
|
484
454
|
};
|
|
485
455
|
|
|
486
456
|
const handleFocus = (e: FocusEvent) => {
|
|
487
|
-
tabListProps.
|
|
488
|
-
callHandler(focusProps.onFocus, e);
|
|
457
|
+
tabListProps.onFocusIn(e);
|
|
489
458
|
};
|
|
490
459
|
|
|
491
460
|
const handleBlur = (e: FocusEvent) => {
|
|
492
|
-
tabListProps.
|
|
493
|
-
callHandler(focusProps.onBlur, e);
|
|
461
|
+
tabListProps.onFocusOut(e);
|
|
494
462
|
};
|
|
495
463
|
|
|
496
464
|
return (
|
|
@@ -503,10 +471,8 @@ function TabListInner<T>(props: {
|
|
|
503
471
|
class={renderProps.class()}
|
|
504
472
|
style={renderProps.style()}
|
|
505
473
|
onKeyDown={handleKeyDown}
|
|
506
|
-
|
|
507
|
-
|
|
508
|
-
data-focused={state.isFocused() || undefined}
|
|
509
|
-
data-focus-visible={isFocusVisible() || undefined}
|
|
474
|
+
onFocusIn={handleFocus}
|
|
475
|
+
onFocusOut={handleBlur}
|
|
510
476
|
data-orientation={state.orientation()}
|
|
511
477
|
data-disabled={state.isDisabled() || undefined}
|
|
512
478
|
>
|
|
@@ -611,7 +577,9 @@ function TabInner(props: {
|
|
|
611
577
|
|
|
612
578
|
const renderProps = useRenderProps(
|
|
613
579
|
{
|
|
614
|
-
children
|
|
580
|
+
get children() {
|
|
581
|
+
return props.children;
|
|
582
|
+
},
|
|
615
583
|
class: props.local.class,
|
|
616
584
|
style: props.local.style,
|
|
617
585
|
defaultClassName: "solidaria-Tab",
|
|
@@ -634,7 +602,7 @@ function TabInner(props: {
|
|
|
634
602
|
aria-controls={tabAria.isSelected() ? tabAria.tabProps["aria-controls"] : undefined}
|
|
635
603
|
aria-label={tabAria.tabProps["aria-label"]}
|
|
636
604
|
aria-labelledby={tabAria.tabProps["aria-labelledby"]}
|
|
637
|
-
tabIndex={tabAria.
|
|
605
|
+
tabIndex={tabAria.tabProps.tabIndex}
|
|
638
606
|
class={renderProps.class()}
|
|
639
607
|
style={renderProps.style()}
|
|
640
608
|
onKeyDown={tabAria.tabProps.onKeyDown}
|
|
@@ -642,6 +610,7 @@ function TabInner(props: {
|
|
|
642
610
|
onPointerDown={tabAria.tabProps.onPointerDown}
|
|
643
611
|
onClick={tabAria.tabProps.onClick}
|
|
644
612
|
onFocus={tabAria.tabProps.onFocus}
|
|
613
|
+
onBlur={tabAria.tabProps.onBlur}
|
|
645
614
|
{...hoverProps}
|
|
646
615
|
data-selected={tabAria.isSelected() || undefined}
|
|
647
616
|
data-focused={tabAria.isFocused() || undefined}
|
|
@@ -650,7 +619,7 @@ function TabInner(props: {
|
|
|
650
619
|
data-hovered={isHovered() || undefined}
|
|
651
620
|
data-disabled={tabAria.isDisabled() || undefined}
|
|
652
621
|
>
|
|
653
|
-
{renderProps.
|
|
622
|
+
{renderProps.renderChildrenStable()}
|
|
654
623
|
</div>
|
|
655
624
|
</SelectionIndicatorContext.Provider>
|
|
656
625
|
);
|
|
@@ -750,7 +719,9 @@ export function TabPanel(props: TabPanelProps): JSX.Element {
|
|
|
750
719
|
|
|
751
720
|
const renderProps = useRenderProps(
|
|
752
721
|
{
|
|
753
|
-
children
|
|
722
|
+
get children() {
|
|
723
|
+
return props.children;
|
|
724
|
+
},
|
|
754
725
|
class: local.class,
|
|
755
726
|
style: local.style,
|
|
756
727
|
defaultClassName: "solidaria-TabPanel",
|
package/src/TagGroup.tsx
CHANGED
|
@@ -404,7 +404,9 @@ export function Tag(props: TagProps): JSX.Element {
|
|
|
404
404
|
|
|
405
405
|
const renderProps = useRenderProps(
|
|
406
406
|
{
|
|
407
|
-
children
|
|
407
|
+
get children() {
|
|
408
|
+
return props.children;
|
|
409
|
+
},
|
|
408
410
|
class: local.class,
|
|
409
411
|
style: local.style,
|
|
410
412
|
defaultClassName: "solidaria-Tag",
|
package/src/Text.tsx
CHANGED
|
@@ -1,18 +1,39 @@
|
|
|
1
|
-
import { type JSX, createContext } from "solid-js";
|
|
2
|
-
import
|
|
1
|
+
import { type JSX, createContext, splitProps } from "solid-js";
|
|
2
|
+
import { Dynamic } from "solid-js/web";
|
|
3
|
+
import { type ContextValue, type SlotProps, useContextProps, filterDOMProps } from "./utils";
|
|
3
4
|
|
|
4
|
-
export interface TextProps extends SlotProps {
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
style?: JSX.CSSProperties;
|
|
5
|
+
export interface TextProps extends JSX.HTMLAttributes<HTMLElement>, SlotProps {
|
|
6
|
+
/** The element type to render as. @default 'span' */
|
|
7
|
+
elementType?: string;
|
|
8
8
|
}
|
|
9
9
|
|
|
10
|
-
|
|
10
|
+
/**
|
|
11
|
+
* Slotted context for `Text`. A field provides description / errorMessage props
|
|
12
|
+
* (each carrying the `id` its `aria-describedby` references) under named slots,
|
|
13
|
+
* so a `<Text slot="description">` child picks up the right `id` without the field
|
|
14
|
+
* threading it manually. Mirrors react-aria-components' `TextContext` (default
|
|
15
|
+
* `{}` so an unprovided `Text` merges against an empty context and renders as-is).
|
|
16
|
+
*/
|
|
17
|
+
export const TextContext = createContext<ContextValue<TextProps, HTMLElement>>({});
|
|
11
18
|
|
|
19
|
+
/**
|
|
20
|
+
* A piece of text, typically a label, description, or error message inside a
|
|
21
|
+
* field. Port of react-aria-components' `Text`: it consumes its slot from
|
|
22
|
+
* `TextContext` (via `useContextProps`) so a field can supply the `id` and other
|
|
23
|
+
* props for the matching slot, then renders them onto the element.
|
|
24
|
+
*/
|
|
12
25
|
export function Text(props: TextProps): JSX.Element {
|
|
26
|
+
const [merged] = useContextProps(props, undefined, TextContext);
|
|
27
|
+
// `slot` stays a logical prop (not a DOM attribute) and `ref`/`class`/`children`
|
|
28
|
+
// are rendered explicitly; everything else (notably the slotted `id`) is spread.
|
|
29
|
+
const [local, domProps] = splitProps(merged, ["elementType", "class", "children", "slot", "ref"]);
|
|
13
30
|
return (
|
|
14
|
-
<
|
|
15
|
-
{
|
|
16
|
-
|
|
31
|
+
<Dynamic
|
|
32
|
+
component={local.elementType ?? "span"}
|
|
33
|
+
class={local.class ?? "solidaria-Text"}
|
|
34
|
+
{...filterDOMProps(domProps, { global: true })}
|
|
35
|
+
>
|
|
36
|
+
{local.children}
|
|
37
|
+
</Dynamic>
|
|
17
38
|
);
|
|
18
39
|
}
|
package/src/TextField.tsx
CHANGED
|
@@ -7,6 +7,7 @@
|
|
|
7
7
|
|
|
8
8
|
import {
|
|
9
9
|
type JSX,
|
|
10
|
+
type Context,
|
|
10
11
|
createContext,
|
|
11
12
|
useContext,
|
|
12
13
|
createMemo,
|
|
@@ -38,7 +39,9 @@ import {
|
|
|
38
39
|
type SlotProps,
|
|
39
40
|
useRenderProps,
|
|
40
41
|
filterDOMProps,
|
|
42
|
+
Provider,
|
|
41
43
|
} from "./utils";
|
|
44
|
+
import { TextContext } from "./Text";
|
|
42
45
|
|
|
43
46
|
export interface TextFieldRenderProps {
|
|
44
47
|
/** Whether the text field is disabled. */
|
|
@@ -149,8 +152,21 @@ export interface LabelProps extends JSX.LabelHTMLAttributes<HTMLLabelElement> {
|
|
|
149
152
|
export function Label(props: LabelProps): JSX.Element {
|
|
150
153
|
const context = useContext(TextFieldContext);
|
|
151
154
|
|
|
155
|
+
const localDOMProps = () => {
|
|
156
|
+
const result: Record<string, unknown> = {};
|
|
157
|
+
const propsRecord = props as Record<string, unknown>;
|
|
158
|
+
|
|
159
|
+
for (const key in propsRecord) {
|
|
160
|
+
if (key !== "children") {
|
|
161
|
+
result[key] = propsRecord[key];
|
|
162
|
+
}
|
|
163
|
+
}
|
|
164
|
+
return result;
|
|
165
|
+
};
|
|
166
|
+
|
|
152
167
|
// Merge context labelProps with local props (local props take precedence)
|
|
153
168
|
const mergedProps = () => {
|
|
169
|
+
const localProps = localDOMProps();
|
|
154
170
|
if (context) {
|
|
155
171
|
const { ref: _ref, ...contextLabelProps } = (context.labelProps ?? {}) as Record<
|
|
156
172
|
string,
|
|
@@ -159,14 +175,14 @@ export function Label(props: LabelProps): JSX.Element {
|
|
|
159
175
|
const merged = {
|
|
160
176
|
...contextLabelProps,
|
|
161
177
|
...(context.inputId ? { for: context.inputId } : {}),
|
|
162
|
-
...
|
|
178
|
+
...localProps,
|
|
163
179
|
} as Record<string, unknown>;
|
|
164
180
|
if (merged.class == null) {
|
|
165
181
|
merged.class = "solidaria-Label";
|
|
166
182
|
}
|
|
167
183
|
return merged;
|
|
168
184
|
}
|
|
169
|
-
return
|
|
185
|
+
return localProps.class == null ? { ...localProps, class: "solidaria-Label" } : localProps;
|
|
170
186
|
};
|
|
171
187
|
|
|
172
188
|
return <label {...mergedProps()}>{props.children}</label>;
|
|
@@ -481,7 +497,9 @@ export function TextField(props: TextFieldProps): JSX.Element {
|
|
|
481
497
|
|
|
482
498
|
const renderProps = useRenderProps(
|
|
483
499
|
{
|
|
484
|
-
children
|
|
500
|
+
get children() {
|
|
501
|
+
return local.children;
|
|
502
|
+
},
|
|
485
503
|
class: local.class,
|
|
486
504
|
style: local.style,
|
|
487
505
|
defaultClassName: "solidaria-TextField",
|
|
@@ -586,6 +604,26 @@ export function TextField(props: TextFieldProps): JSX.Element {
|
|
|
586
604
|
const children = local.children;
|
|
587
605
|
return typeof children === "function" ? children(childRenderValues) : children;
|
|
588
606
|
});
|
|
607
|
+
// Provide the description / errorMessage props as `TextContext` slots (mirrors
|
|
608
|
+
// react-aria-components' TextField), so a `<Text slot="description">` /
|
|
609
|
+
// `<Text slot="errorMessage">` child picks up the `id` its `aria-describedby`
|
|
610
|
+
// references. Additive: existing consumers reading these off `TextFieldContext`
|
|
611
|
+
// are unaffected.
|
|
612
|
+
const textSlots = {
|
|
613
|
+
slots: {
|
|
614
|
+
get description() {
|
|
615
|
+
return textFieldAria.descriptionProps as JSX.HTMLAttributes<HTMLElement>;
|
|
616
|
+
},
|
|
617
|
+
get errorMessage() {
|
|
618
|
+
return textFieldAria.errorMessageProps as JSX.HTMLAttributes<HTMLElement>;
|
|
619
|
+
},
|
|
620
|
+
},
|
|
621
|
+
};
|
|
622
|
+
const FieldChildrenSlotted = () => (
|
|
623
|
+
<Provider values={[[TextContext, textSlots]] as Array<[Context<unknown>, unknown]>}>
|
|
624
|
+
<FieldChildren />
|
|
625
|
+
</Provider>
|
|
626
|
+
);
|
|
589
627
|
const rootProps = () =>
|
|
590
628
|
({
|
|
591
629
|
...domProps(),
|
|
@@ -604,7 +642,7 @@ export function TextField(props: TextFieldProps): JSX.Element {
|
|
|
604
642
|
const customRootProps = () =>
|
|
605
643
|
({
|
|
606
644
|
...rootProps(),
|
|
607
|
-
children: <
|
|
645
|
+
children: <FieldChildrenSlotted />,
|
|
608
646
|
}) as JSX.HTMLAttributes<HTMLDivElement>;
|
|
609
647
|
|
|
610
648
|
return (
|
|
@@ -614,7 +652,7 @@ export function TextField(props: TextFieldProps): JSX.Element {
|
|
|
614
652
|
local.render(customRootProps(), renderValues())
|
|
615
653
|
) : (
|
|
616
654
|
<div {...rootProps()}>
|
|
617
|
-
<
|
|
655
|
+
<FieldChildrenSlotted />
|
|
618
656
|
</div>
|
|
619
657
|
)}
|
|
620
658
|
</TextFieldContext.Provider>
|
package/src/TimeField.tsx
CHANGED
|
@@ -7,6 +7,7 @@
|
|
|
7
7
|
|
|
8
8
|
import {
|
|
9
9
|
type JSX,
|
|
10
|
+
type Context,
|
|
10
11
|
createContext,
|
|
11
12
|
createMemo,
|
|
12
13
|
createSignal,
|
|
@@ -36,7 +37,9 @@ import {
|
|
|
36
37
|
useRenderProps,
|
|
37
38
|
dataAttr,
|
|
38
39
|
useIsHydrated,
|
|
40
|
+
Provider,
|
|
39
41
|
} from "./utils";
|
|
42
|
+
import { TextContext } from "./Text";
|
|
40
43
|
import { HiddenTimeInput } from "./HiddenTimeInput";
|
|
41
44
|
import { FormContext, type FormProps } from "./Form";
|
|
42
45
|
|
|
@@ -281,6 +284,17 @@ function TimeFieldInner<T extends TimeValue = TimeValue>(
|
|
|
281
284
|
formContext?.validationBehavior ??
|
|
282
285
|
"native";
|
|
283
286
|
|
|
287
|
+
const textSlots = {
|
|
288
|
+
slots: {
|
|
289
|
+
get description() {
|
|
290
|
+
return fieldAria.descriptionProps;
|
|
291
|
+
},
|
|
292
|
+
get errorMessage() {
|
|
293
|
+
return fieldAria.errorMessageProps;
|
|
294
|
+
},
|
|
295
|
+
},
|
|
296
|
+
};
|
|
297
|
+
|
|
284
298
|
return (
|
|
285
299
|
<TimeFieldStateContext.Provider value={state as unknown as TimeFieldState<TimeValue>}>
|
|
286
300
|
<TimeFieldContext.Provider
|
|
@@ -304,7 +318,9 @@ function TimeFieldInner<T extends TimeValue = TimeValue>(
|
|
|
304
318
|
data-required={dataAttr(state.isRequired())}
|
|
305
319
|
data-invalid={dataAttr(state.isInvalid())}
|
|
306
320
|
>
|
|
307
|
-
{
|
|
321
|
+
<Provider values={[[TextContext, textSlots]] as Array<[Context<unknown>, unknown]>}>
|
|
322
|
+
{local.children as JSX.Element}
|
|
323
|
+
</Provider>
|
|
308
324
|
</div>
|
|
309
325
|
<Show when={(rest as Record<string, unknown>).name}>
|
|
310
326
|
<HiddenTimeInput
|
|
@@ -388,7 +404,9 @@ export function TimeSegment(props: TimeSegmentProps): JSX.Element {
|
|
|
388
404
|
|
|
389
405
|
const renderProps = useRenderProps(
|
|
390
406
|
{
|
|
391
|
-
children
|
|
407
|
+
get children() {
|
|
408
|
+
return props.children;
|
|
409
|
+
},
|
|
392
410
|
class: props.class,
|
|
393
411
|
style: props.style,
|
|
394
412
|
defaultClassName: "solidaria-TimeSegment",
|
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