@xds/solid 1.0.1 → 1.1.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/dom/Accordion.js +3 -2
- package/dist/dom/Avatar.js +17 -13
- package/dist/dom/AvatarStack.js +17 -13
- package/dist/dom/Badge.js +12 -10
- package/dist/dom/Banner.js +25 -15
- package/dist/dom/Button.js +10 -3
- package/dist/dom/Card.js +31 -26
- package/dist/dom/Checkbox.js +49 -24
- package/dist/dom/Chip.js +21 -17
- package/dist/dom/ChipBar.js +17 -13
- package/dist/dom/CountBadge.js +28 -23
- package/dist/dom/DatePicker.js +13 -7
- package/dist/dom/DateRangePicker.js +16 -10
- package/dist/dom/Dialog.js +3 -2
- package/dist/dom/Divider.js +12 -10
- package/dist/dom/EmptyState.js +14 -11
- package/dist/dom/Icon.js +30 -19
- package/dist/dom/IconButton.js +10 -3
- package/dist/dom/Labels.js +26 -0
- package/dist/dom/ListRow.js +34 -28
- package/dist/dom/MediaCard.js +32 -23
- package/dist/dom/Menu.js +3 -1
- package/dist/dom/ProgressBar.js +27 -15
- package/dist/dom/RadioGroup.js +44 -23
- package/dist/dom/SearchField.js +58 -32
- package/dist/dom/SectionHeader.js +17 -10
- package/dist/dom/SegmentedControl.js +33 -19
- package/dist/dom/Select.js +18 -5
- package/dist/dom/Sidebar.js +17 -13
- package/dist/dom/Skeleton.js +15 -13
- package/dist/dom/Slider.js +15 -7
- package/dist/dom/Spinner.js +23 -17
- package/dist/dom/Switch.js +49 -24
- package/dist/dom/Tabs.js +16 -6
- package/dist/dom/Text.js +6 -3
- package/dist/dom/TextField.js +37 -19
- package/dist/dom/Thumbnail.js +21 -14
- package/dist/dom/Toast.js +19 -20
- package/dist/dom/Tooltip.js +10 -6
- package/dist/dom/controllable.js +44 -0
- package/dist/dom/index.js +2 -1
- package/dist/dom/preview.js +2 -0
- package/dist/dom/root.js +16 -4
- package/dist/dom/trigger.js +5 -3
- package/dist/source/Accordion.jsx +3 -2
- package/dist/source/Avatar.d.ts +1 -1
- package/dist/source/Avatar.jsx +2 -1
- package/dist/source/AvatarStack.d.ts +1 -1
- package/dist/source/AvatarStack.jsx +2 -1
- package/dist/source/Badge.d.ts +1 -1
- package/dist/source/Badge.jsx +2 -1
- package/dist/source/Banner.d.ts +1 -1
- package/dist/source/Banner.jsx +5 -2
- package/dist/source/Button.d.ts +5 -1
- package/dist/source/Button.jsx +5 -2
- package/dist/source/Card.d.ts +1 -1
- package/dist/source/Card.jsx +3 -2
- package/dist/source/Checkbox.d.ts +10 -4
- package/dist/source/Checkbox.jsx +18 -6
- package/dist/source/Chip.d.ts +1 -1
- package/dist/source/Chip.jsx +2 -1
- package/dist/source/ChipBar.d.ts +1 -1
- package/dist/source/ChipBar.jsx +2 -1
- package/dist/source/CountBadge.d.ts +1 -1
- package/dist/source/CountBadge.jsx +3 -2
- package/dist/source/DatePicker.jsx +13 -7
- package/dist/source/DateRangePicker.jsx +16 -10
- package/dist/source/Dialog.jsx +3 -2
- package/dist/source/Divider.d.ts +1 -1
- package/dist/source/Divider.jsx +2 -1
- package/dist/source/EmptyState.d.ts +1 -1
- package/dist/source/EmptyState.jsx +2 -1
- package/dist/source/Icon.d.ts +1 -1
- package/dist/source/Icon.jsx +2 -1
- package/dist/source/IconButton.d.ts +5 -1
- package/dist/source/IconButton.jsx +5 -2
- package/dist/source/Labels.d.ts +17 -0
- package/dist/source/Labels.jsx +11 -0
- package/dist/source/ListRow.d.ts +1 -1
- package/dist/source/ListRow.jsx +3 -2
- package/dist/source/MediaCard.d.ts +1 -1
- package/dist/source/MediaCard.jsx +3 -2
- package/dist/source/Menu.d.ts +1 -1
- package/dist/source/Menu.jsx +3 -1
- package/dist/source/ProgressBar.d.ts +1 -1
- package/dist/source/ProgressBar.jsx +2 -1
- package/dist/source/RadioGroup.d.ts +5 -2
- package/dist/source/RadioGroup.jsx +18 -5
- package/dist/source/SearchField.d.ts +11 -3
- package/dist/source/SearchField.jsx +26 -12
- package/dist/source/SectionHeader.d.ts +1 -1
- package/dist/source/SectionHeader.jsx +2 -1
- package/dist/source/SegmentedControl.d.ts +4 -3
- package/dist/source/SegmentedControl.jsx +16 -5
- package/dist/source/Select.d.ts +4 -1
- package/dist/source/Select.jsx +16 -5
- package/dist/source/Sidebar.d.ts +1 -1
- package/dist/source/Sidebar.jsx +2 -1
- package/dist/source/Skeleton.jsx +2 -2
- package/dist/source/Slider.d.ts +2 -2
- package/dist/source/Slider.jsx +14 -6
- package/dist/source/Spinner.d.ts +1 -1
- package/dist/source/Spinner.jsx +2 -1
- package/dist/source/Switch.d.ts +10 -4
- package/dist/source/Switch.jsx +18 -6
- package/dist/source/Tabs.d.ts +2 -2
- package/dist/source/Tabs.jsx +16 -5
- package/dist/source/Text.d.ts +1 -1
- package/dist/source/Text.jsx +2 -1
- package/dist/source/TextField.d.ts +12 -3
- package/dist/source/TextField.jsx +24 -9
- package/dist/source/Thumbnail.d.ts +1 -1
- package/dist/source/Thumbnail.jsx +2 -1
- package/dist/source/Toast.d.ts +1 -1
- package/dist/source/Toast.jsx +2 -1
- package/dist/source/Tooltip.jsx +4 -3
- package/dist/source/controllable.d.ts +30 -0
- package/dist/source/controllable.js +30 -0
- package/dist/source/index.d.ts +1 -0
- package/dist/source/index.js +1 -0
- package/dist/source/preview.jsx +2 -1
- package/dist/source/root.d.ts +14 -4
- package/dist/source/root.js +7 -2
- package/dist/source/trigger.d.ts +4 -2
- package/dist/source/trigger.js +2 -2
- package/package.json +3 -3
- package/styles.css +4 -0
- package/tailwind.css +1 -1
|
@@ -4,12 +4,13 @@ import { Badge } from "./Badge.jsx";
|
|
|
4
4
|
import { useDefaults } from "./Defaults.jsx";
|
|
5
5
|
import { Icon } from "./Icon.jsx";
|
|
6
6
|
import { createPicture } from "./picture.js";
|
|
7
|
+
import { rootAttributes } from "./root.js";
|
|
7
8
|
const ROOT = rootPart("Thumbnail");
|
|
8
9
|
export function Thumbnail(props) {
|
|
9
10
|
const defaults = useDefaults("Thumbnail");
|
|
10
11
|
const picture = createPicture(() => props.src);
|
|
11
12
|
const watched = () => thumbnailWatched(props.progress);
|
|
12
|
-
return (<span class={classes(ROOT, thumbnailClass(props.ratio ?? defaults().ratio), props.class)} style={props.style}>
|
|
13
|
+
return (<span {...rootAttributes(props)} class={classes(ROOT, thumbnailClass(props.ratio ?? defaults().ratio), props.class)} style={props.style}>
|
|
13
14
|
|
|
14
15
|
<span class={THUMBNAIL_PARTS.placeholder} role={props.alt ? "img" : undefined} aria-label={props.alt || undefined} aria-hidden={props.alt ? undefined : "true"}>
|
|
15
16
|
<Show when={picture.loaded() !== true}>
|
package/dist/source/Toast.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { type ToastBaseProps } from "@xds/core";
|
|
2
|
-
import type
|
|
2
|
+
import { type RootProps } from "./root.ts";
|
|
3
3
|
export type ToastProps = ToastBaseProps & RootProps & {
|
|
4
4
|
/** Called when the time is up and after the action. Set `open` to false in it. */
|
|
5
5
|
onClose: () => void;
|
package/dist/source/Toast.jsx
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { motion } from "@xds/tokens";
|
|
2
2
|
import { classes, readCssMs, rootPart, TOAST_PARTS } from "@xds/core";
|
|
3
3
|
import { createEffect, createSignal, onSettled, Show } from "solid-js";
|
|
4
|
+
import { rootAttributes } from "./root.js";
|
|
4
5
|
const ROOT = rootPart("Toast");
|
|
5
6
|
export function Toast(props) {
|
|
6
7
|
let region;
|
|
@@ -31,7 +32,7 @@ export function Toast(props) {
|
|
|
31
32
|
return (<div ref={(element) => (region = element)} role="status" popover="manual" class={TOAST_PARTS.region}>
|
|
32
33
|
<Show when={props.open}>
|
|
33
34
|
|
|
34
|
-
<div onPointerEnter={(event) => setHovered(event.currentTarget)} onPointerLeave={() => setHovered(undefined)} onFocusIn={(event) => setFocused(event.currentTarget)} onFocusOut={() => setFocused(undefined)} class={classes(ROOT, TOAST_PARTS.toast, props.class)} style={props.style}>
|
|
35
|
+
<div {...rootAttributes(props)} onPointerEnter={(event) => setHovered(event.currentTarget)} onPointerLeave={() => setHovered(undefined)} onFocusIn={(event) => setFocused(event.currentTarget)} onFocusOut={() => setFocused(undefined)} class={classes(ROOT, TOAST_PARTS.toast, props.class)} style={props.style}>
|
|
35
36
|
<span class={TOAST_PARTS.message}>{props.message}</span>
|
|
36
37
|
<Show when={props.action}>
|
|
37
38
|
{(action) => (<button type="button" onClick={() => {
|
package/dist/source/Tooltip.jsx
CHANGED
|
@@ -5,10 +5,10 @@ import * as tooltip from "@zag-js/tooltip";
|
|
|
5
5
|
import { createMemo, createUniqueId, Show } from "solid-js";
|
|
6
6
|
import { Portal } from "./portal.jsx";
|
|
7
7
|
import { createPresence } from "./presence.js";
|
|
8
|
-
import { withStyle } from "./root.js";
|
|
8
|
+
import { rootAttributes, withStyle } from "./root.js";
|
|
9
9
|
import { provideTrigger, TriggerContext } from "./trigger.js";
|
|
10
10
|
export function Tooltip(props) {
|
|
11
|
-
return (<Overlay label={props.label} shortcut={props.shortcut} placement={() => props.placement ?? "top"} class={props.class} style={props.style}>
|
|
11
|
+
return (<Overlay label={props.label} shortcut={props.shortcut} placement={() => props.placement ?? "top"} {...rootAttributes(props)} class={props.class} style={props.style}>
|
|
12
12
|
{props.children}
|
|
13
13
|
</Overlay>);
|
|
14
14
|
}
|
|
@@ -21,6 +21,7 @@ function Overlay(props) {
|
|
|
21
21
|
const id = createUniqueId();
|
|
22
22
|
const service = useMachine(tooltip.machine, () => ({
|
|
23
23
|
id,
|
|
24
|
+
ids: { content: props.id },
|
|
24
25
|
openDelay: readCssMs(null, "--xds-motion-duration-tooltip-delay", motion.duration.tooltipDelay),
|
|
25
26
|
closeDelay: 0,
|
|
26
27
|
closeOnScroll: false,
|
|
@@ -31,7 +32,7 @@ function Overlay(props) {
|
|
|
31
32
|
}));
|
|
32
33
|
const api = createMemo(() => tooltip.connect(service, normalizeProps));
|
|
33
34
|
const trigger = provideTrigger(() => api().getTriggerProps());
|
|
34
|
-
const contentProps = withStyle(() => api().getContentProps(), () => props.style);
|
|
35
|
+
const contentProps = withStyle(() => api().getContentProps(), () => props.style, rootAttributes(props));
|
|
35
36
|
let content;
|
|
36
37
|
const present = createPresence(() => api().open, () => [content]);
|
|
37
38
|
return (<>
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import type { JSX } from "@solidjs/web";
|
|
2
|
+
import { type Accessor } from "solid-js";
|
|
3
|
+
/**
|
|
4
|
+
* The state of a control that the app may keep or leave to it. It is the app's while the app
|
|
5
|
+
* gives the prop (`controlled`, from `isControlled`), and the control's own otherwise, from
|
|
6
|
+
* `defaultValue`. Either way a change goes to `onChange`, read when the change comes. The state
|
|
7
|
+
* is a plain value, never a function, which a signal would take for an update.
|
|
8
|
+
*/
|
|
9
|
+
export declare function createControllable<T extends string | number | boolean | undefined>(options: {
|
|
10
|
+
controlled: Accessor<boolean>;
|
|
11
|
+
value: Accessor<T>;
|
|
12
|
+
defaultValue: Accessor<T>;
|
|
13
|
+
onChange: (value: T) => void;
|
|
14
|
+
}): {
|
|
15
|
+
value: Accessor<T>;
|
|
16
|
+
set: (next: T) => void;
|
|
17
|
+
reset: () => void;
|
|
18
|
+
};
|
|
19
|
+
/**
|
|
20
|
+
* Sets a control that keeps its own state back to its default when its form is reset, as the
|
|
21
|
+
* form sets the native field back. A controlled one shows what its owner gives it, whatever the
|
|
22
|
+
* form does.
|
|
23
|
+
*/
|
|
24
|
+
export declare function resetWithForm(element: () => Element | undefined, controlled: Accessor<boolean>, reset: () => void): void;
|
|
25
|
+
/**
|
|
26
|
+
* One ref from the component's own and the one the app gives (`ref`, read when the element is
|
|
27
|
+
* made), which reaches the native input or button. Solid hands a component a ref the app
|
|
28
|
+
* writes as a variable as a function that sets it.
|
|
29
|
+
*/
|
|
30
|
+
export declare function composeRefs<T>(own: (element: T) => void, ref: () => JSX.Ref<T> | undefined): (element: T) => void;
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { onFormReset } from "@xds/core";
|
|
2
|
+
import { createEffect, createSignal, untrack } from "solid-js";
|
|
3
|
+
export function createControllable(options) {
|
|
4
|
+
const [own, setOwn] = createSignal(untrack(options.defaultValue));
|
|
5
|
+
return {
|
|
6
|
+
value: () => (options.controlled() ? options.value() : own()),
|
|
7
|
+
set: (next) => {
|
|
8
|
+
if (!untrack(options.controlled))
|
|
9
|
+
setOwn(() => next);
|
|
10
|
+
options.onChange(next);
|
|
11
|
+
},
|
|
12
|
+
reset: () => setOwn(() => untrack(options.defaultValue)),
|
|
13
|
+
};
|
|
14
|
+
}
|
|
15
|
+
export function resetWithForm(element, controlled, reset) {
|
|
16
|
+
createEffect(controlled, (isControlled) => isControlled ? undefined : onFormReset(element(), reset));
|
|
17
|
+
}
|
|
18
|
+
export function composeRefs(own, ref) {
|
|
19
|
+
return (element) => {
|
|
20
|
+
own(element);
|
|
21
|
+
apply(ref(), element);
|
|
22
|
+
};
|
|
23
|
+
}
|
|
24
|
+
function apply(ref, element) {
|
|
25
|
+
if (typeof ref === "function")
|
|
26
|
+
ref(element);
|
|
27
|
+
else if (Array.isArray(ref))
|
|
28
|
+
for (const each of ref)
|
|
29
|
+
apply(each, element);
|
|
30
|
+
}
|
package/dist/source/index.d.ts
CHANGED
|
@@ -18,6 +18,7 @@ export { Divider, type DividerProps } from "./Divider.tsx";
|
|
|
18
18
|
export { EmptyState, type EmptyStateProps } from "./EmptyState.tsx";
|
|
19
19
|
export { Icon, type IconProps } from "./Icon.tsx";
|
|
20
20
|
export { IconButton, type IconButtonProps } from "./IconButton.tsx";
|
|
21
|
+
export { type ComponentLabels, Labels, type LabelsProps } from "./Labels.tsx";
|
|
21
22
|
export { ListRow, type ListRowProps } from "./ListRow.tsx";
|
|
22
23
|
export { MediaCard, type MediaCardProps } from "./MediaCard.tsx";
|
|
23
24
|
export { Menu, type MenuItem, type MenuProps } from "./Menu.tsx";
|
package/dist/source/index.js
CHANGED
|
@@ -17,6 +17,7 @@ export { Divider } from "./Divider.jsx";
|
|
|
17
17
|
export { EmptyState } from "./EmptyState.jsx";
|
|
18
18
|
export { Icon } from "./Icon.jsx";
|
|
19
19
|
export { IconButton } from "./IconButton.jsx";
|
|
20
|
+
export { Labels } from "./Labels.jsx";
|
|
20
21
|
export { ListRow } from "./ListRow.jsx";
|
|
21
22
|
export { MediaCard } from "./MediaCard.jsx";
|
|
22
23
|
export { Menu } from "./Menu.jsx";
|
package/dist/source/preview.jsx
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { isNode, isStatic, resolve, } from "@xds/core/preview";
|
|
2
2
|
import { dynamic, memo } from "@solidjs/web";
|
|
3
3
|
import { createComponent, createSignal, onSettled, Show, untrack, } from "solid-js";
|
|
4
|
-
import { Accordion, Avatar, AvatarStack, Badge, Banner, Button, Card, Checkbox, Chip, ChipBar, CountBadge, DatePicker, DateRangePicker, Defaults, Dialog, Divider, EmptyState, Icon, IconButton, ListRow, MediaCard, Menu, ProgressBar, RadioGroup, SearchField, SectionHeader, SegmentedControl, Select, Sidebar, Skeleton, Slider, Spinner, Switch, Tabs, Text, TextField, Thumbnail, Toast, Tooltip, } from "./index.js";
|
|
4
|
+
import { Accordion, Avatar, AvatarStack, Badge, Banner, Button, Card, Checkbox, Chip, ChipBar, CountBadge, DatePicker, DateRangePicker, Defaults, Labels, Dialog, Divider, EmptyState, Icon, IconButton, ListRow, MediaCard, Menu, ProgressBar, RadioGroup, SearchField, SectionHeader, SegmentedControl, Select, Sidebar, Skeleton, Slider, Spinner, Switch, Tabs, Text, TextField, Thumbnail, Toast, Tooltip, } from "./index.js";
|
|
5
5
|
export { designPreview } from "@xds/core/preview";
|
|
6
6
|
const COMPONENTS = {
|
|
7
7
|
Accordion,
|
|
@@ -18,6 +18,7 @@ const COMPONENTS = {
|
|
|
18
18
|
DatePicker,
|
|
19
19
|
DateRangePicker,
|
|
20
20
|
Defaults,
|
|
21
|
+
Labels,
|
|
21
22
|
Dialog,
|
|
22
23
|
Divider,
|
|
23
24
|
EmptyState,
|
package/dist/source/root.d.ts
CHANGED
|
@@ -1,14 +1,23 @@
|
|
|
1
|
+
import type { RootAttributes } from "@xds/core";
|
|
1
2
|
import type { JSX } from "@solidjs/web";
|
|
2
3
|
/**
|
|
3
4
|
* What every component takes for its root element, beside its root part (`xds-<name>`): the
|
|
4
|
-
* app's own handle on it.
|
|
5
|
+
* app's own handle on it. Its root is its outermost element, or the surface of an overlay. An
|
|
6
|
+
* `id` and `data-*` attributes, such as a test's `data-testid`, go on it too.
|
|
5
7
|
*/
|
|
6
|
-
export type RootProps = {
|
|
8
|
+
export type RootProps = RootAttributes & {
|
|
7
9
|
/** Added to the classes of the component's root element. */
|
|
8
10
|
class?: string;
|
|
9
11
|
/** Inline style on the component's root element, laid over any it sets itself. */
|
|
10
12
|
style?: JSX.CSSProperties | string;
|
|
11
13
|
};
|
|
14
|
+
/**
|
|
15
|
+
* The `id` and `data-*` attributes among a component's props, to spread on its root element.
|
|
16
|
+
* A live view rather than ui-core's `rootAttributes`, which copies the values: an attribute
|
|
17
|
+
* whose prop changes follows it, and one the app leaves out is not in it, so it overrides
|
|
18
|
+
* nothing it is spread before.
|
|
19
|
+
*/
|
|
20
|
+
export declare function rootAttributes(props: RootAttributes): RootAttributes;
|
|
12
21
|
type Style = JSX.CSSProperties | string | undefined;
|
|
13
22
|
/**
|
|
14
23
|
* The style of a root element that sets one of its own: the app's comes after it, so that it
|
|
@@ -19,7 +28,8 @@ export declare function layStyle(own: Style, app: Style): Style;
|
|
|
19
28
|
/**
|
|
20
29
|
* The props Zag gives a component's root element, with the app's style laid over the one Zag
|
|
21
30
|
* sets: Zag's mergeProps merges the two, where a `style` after the spread would replace Zag's.
|
|
22
|
-
*
|
|
31
|
+
* The app's root attributes win over Zag's, so give the machine the app's `id` for the part
|
|
32
|
+
* too (`ids`), which is how Zag finds it. Spread the result on the element.
|
|
23
33
|
*/
|
|
24
|
-
export declare function withStyle<T extends object>(zag: () => T, style: () => Style): T;
|
|
34
|
+
export declare function withStyle<T extends object>(zag: () => T, style: () => Style, attributes?: RootAttributes): T;
|
|
25
35
|
export {};
|
package/dist/source/root.js
CHANGED
|
@@ -1,4 +1,9 @@
|
|
|
1
1
|
import { mergeProps } from "@zag-js/solid";
|
|
2
|
+
import { omit } from "solid-js";
|
|
3
|
+
const isRootAttribute = (key) => key === "id" || (typeof key === "string" && key.startsWith("data-"));
|
|
4
|
+
export function rootAttributes(props) {
|
|
5
|
+
return omit(props, (key) => !isRootAttribute(key));
|
|
6
|
+
}
|
|
2
7
|
const css = (style) => typeof style === "string"
|
|
3
8
|
? style
|
|
4
9
|
: Object.entries(style)
|
|
@@ -14,6 +19,6 @@ export function layStyle(own, app) {
|
|
|
14
19
|
return `${css(own)};${css(app)}`;
|
|
15
20
|
return { ...own, ...app };
|
|
16
21
|
}
|
|
17
|
-
export function withStyle(zag, style) {
|
|
18
|
-
return mergeProps(zag, () => ({ style: style() }));
|
|
22
|
+
export function withStyle(zag, style, attributes = {}) {
|
|
23
|
+
return mergeProps(zag, attributes, () => ({ style: style() }));
|
|
19
24
|
}
|
package/dist/source/trigger.d.ts
CHANGED
|
@@ -13,6 +13,8 @@ export declare function provideTrigger(own: Accessor<TriggerProps>): Accessor<Tr
|
|
|
13
13
|
* For a control that can open an overlay: its own props, after those of the overlays it opens.
|
|
14
14
|
* Its own attributes win, its own handlers run first, and its class is added to theirs, so the
|
|
15
15
|
* own class must be a string. While `inert` is true, as for a loading button, the overlays get
|
|
16
|
-
* none of its events and so do not open.
|
|
16
|
+
* none of its events and so do not open. The app's root attributes (`root`) come before the
|
|
17
|
+
* overlays': an overlay finds its trigger by the id it gives it. Spread the result on the
|
|
18
|
+
* element.
|
|
17
19
|
*/
|
|
18
|
-
export declare function withTrigger<T extends object>(own: Accessor<T>, inert?: Accessor<boolean
|
|
20
|
+
export declare function withTrigger<T extends object>(own: Accessor<T>, inert?: Accessor<boolean>, root?: object): T;
|
package/dist/source/trigger.js
CHANGED
|
@@ -6,7 +6,7 @@ export function provideTrigger(own) {
|
|
|
6
6
|
const merged = mergeProps(() => outer?.() ?? {}, own);
|
|
7
7
|
return () => merged;
|
|
8
8
|
}
|
|
9
|
-
export function withTrigger(own, inert) {
|
|
9
|
+
export function withTrigger(own, inert, root = {}) {
|
|
10
10
|
const trigger = useContext(TriggerContext);
|
|
11
11
|
const overlays = () => {
|
|
12
12
|
const props = trigger?.() ?? {};
|
|
@@ -14,5 +14,5 @@ export function withTrigger(own, inert) {
|
|
|
14
14
|
return props;
|
|
15
15
|
return Object.fromEntries(Object.entries(props).filter(([key]) => !key.startsWith("on")));
|
|
16
16
|
};
|
|
17
|
-
return mergeProps(overlays, own);
|
|
17
|
+
return mergeProps(root, overlays, own);
|
|
18
18
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@xds/solid",
|
|
3
|
-
"version": "1.0
|
|
3
|
+
"version": "1.1.0",
|
|
4
4
|
"description": "The xds design system's components for Solid.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"design-system",
|
|
@@ -43,8 +43,8 @@
|
|
|
43
43
|
"page.css"
|
|
44
44
|
],
|
|
45
45
|
"dependencies": {
|
|
46
|
-
"@xds/tokens": "1.0
|
|
47
|
-
"@xds/core": "1.0
|
|
46
|
+
"@xds/tokens": "1.1.0",
|
|
47
|
+
"@xds/core": "1.1.0",
|
|
48
48
|
"@internationalized/date": "3.12.4",
|
|
49
49
|
"@zag-js/accordion": "2.0.0-next.4",
|
|
50
50
|
"@zag-js/aria-hidden": "2.0.0-next.4",
|
package/styles.css
CHANGED
|
@@ -906,6 +906,10 @@
|
|
|
906
906
|
.outline-xds-avatar-ring {
|
|
907
907
|
outline-color: var(--xds-color-avatar-ring);
|
|
908
908
|
}
|
|
909
|
+
.blur {
|
|
910
|
+
--tw-blur: blur(8px);
|
|
911
|
+
filter: var(--tw-blur, ) var(--tw-brightness, ) var(--tw-contrast, ) var(--tw-grayscale, ) var(--tw-hue-rotate, ) var(--tw-invert, ) var(--tw-saturate, ) var(--tw-sepia, ) var(--tw-drop-shadow, );
|
|
912
|
+
}
|
|
909
913
|
.filter {
|
|
910
914
|
filter: var(--tw-blur, ) var(--tw-brightness, ) var(--tw-contrast, ) var(--tw-grayscale, ) var(--tw-hue-rotate, ) var(--tw-invert, ) var(--tw-saturate, ) var(--tw-sepia, ) var(--tw-drop-shadow, );
|
|
911
915
|
}
|
package/tailwind.css
CHANGED
|
@@ -2669,4 +2669,4 @@
|
|
|
2669
2669
|
|
|
2670
2670
|
}
|
|
2671
2671
|
|
|
2672
|
-
@source inline("*:opacity-0 -m-1 -me-1 -mt-4 -mx-4 -mx-6 -my-2 [&::-webkit-scrollbar]:hidden [&:popover-open]:flex [scrollbar-width:none] absolute active:bg-xds-card-background-pressed active:bg-xds-list-row-background-pressed active:bg-xds-list-row-background-selected-hover after:-inset-(--xds-border-width-thin) after:absolute after:border-(length:--xds-border-width-thick) after:border-xds-card-border-selected after:pointer-events-none after:rounded-xds-lg animate-[xds-skeleton-pulse_var(--xds-motion-duration-pulse)_var(--xds-motion-easing-standard)_infinite] animate-[xds-toast-enter_var(--xds-motion-duration-normal)_var(--xds-motion-easing-enter)] animate-spin aspect-[4/3] aspect-[9/16] aspect-square aspect-video before:-translate-y-1/2 before:absolute before:h-[max(100%,var(--xds-size-target-min))] before:inset-x-0 before:top-1/2 bg-xds-accent-default bg-xds-avatar-background bg-xds-avatar-overflow-background bg-xds-background-base bg-xds-background-surface bg-xds-badge-accent-background bg-xds-badge-count-background bg-xds-badge-danger-background bg-xds-badge-neutral-background bg-xds-badge-overlay-background bg-xds-badge-success-background bg-xds-badge-warning-background bg-xds-banner-danger-background bg-xds-banner-info-background bg-xds-banner-success-background bg-xds-banner-warning-background bg-xds-border-default bg-xds-chip-background bg-xds-chip-selected-background bg-xds-list-row-background-selected bg-xds-overlay-accent bg-xds-overlay-background bg-xds-progress-fill bg-xds-progress-track bg-xds-segmented-track bg-xds-sidebar-background bg-xds-sidebar-border bg-xds-skeleton-background bg-xds-switch-thumb bg-xds-switch-track bg-xds-thumbnail-background bg-xds-toast-background bg-current bg-transparent block border border-0 border-2 border-xds-border-default border-xds-border-strong border-xds-card-border-selected border-xds-checkbox-border border-xds-chip-selected-border border-xds-sidebar-border border-b border-e border-transparent bottom-0 bottom-2 bottom-[calc(var(--xds-space-1)+var(--xds-space-2))] break-all container contents cursor-pointer disabled:bg-xds-chip-disabled-background disabled:border-transparent disabled:cursor-not-allowed disabled:hover:bg-xds-list-row-background-selected disabled:hover:bg-transparent disabled:text-xds-chip-disabled-text duration-(--xds-motion-duration-fast) duration-(--xds-motion-duration-normal) ease-(--xds-motion-easing-standard) enabled:active:bg-xds-chip-background-pressed enabled:active:bg-xds-chip-selected-background-pressed enabled:hover:bg-xds-chip-background-hover enabled:hover:bg-xds-chip-selected-background-hover end-2 end-[calc(var(--xds-size-count-badge)/-4)] filter fixed flex flex-1 flex-col flex-wrap focus-visible:-outline-offset-(--xds-focus-offset) focus-visible:outline-(length:--xds-focus-width) focus-visible:outline-xds-border-focus focus-visible:outline-current focus-visible:outline-offset-(--xds-focus-offset) focus-visible:outline-solid gap-0.5 gap-1 gap-1.5 gap-12 gap-2 gap-3 gap-4 gap-6 gap-8 gap-x-8 gap-y-6 grid grid-cols-2 grid-cols-[repeat(auto-fill,minmax(8rem,1fr))] group-aria-expanded:rotate-180 h-(--xds-border-width-thin) h-(--xds-space-1) h-(--xds-typography-body-size) h-24 h-28 h-[28rem] h-xds-badge h-xds-chip h-xds-control-md h-xds-count-badge h-xds-progress h-xds-switch-height h-full h-lh h-px has-disabled:cursor-not-allowed hidden hover:bg-xds-card-background-hover hover:bg-xds-control-default hover:bg-xds-list-row-background-hover hover:bg-xds-list-row-background-selected-hover hover:text-xds-field-text hover:text-xds-text-primary hover:underline inline-flex inset-0 inset-x-0 invisible items-center items-end items-start justify-between justify-center line-clamp-2 m-0 m-auto max-w-4xl max-w-xds-dialog max-w-xds-toast max-w-md max-w-none max-w-sm max-w-xs mb-2 mb-4 min-h-0 min-h-[calc(var(--xds-size-target-min)+var(--xds-space-2))] min-h-xds-list-row min-h-xds-list-row-compact min-h-xds-target-min min-w-0 min-w-xds-count-badge min-w-xds-target-min motion-reduce:animate-none motion-reduce:animate-pulse motion-reduce:transition-none ms-auto mt-0.5 mt-2 mt-4 mt-6 mx-2 mx-auto not-first:ms-[calc(var(--xds-size-avatar-lg)/-4)] not-first:ms-[calc(var(--xds-size-avatar-md)/-4)] not-first:ms-[calc(var(--xds-size-avatar-sm)/-4)] not-first:ms-[calc(var(--xds-size-avatar-xl)/-4)] object-cover outline outline-(length:--xds-border-width-thick) outline-xds-avatar-ring outline-solid overflow-hidden overflow-visible overflow-x-auto overflow-y-auto p-0.5 p-1 p-2 p-3 p-4 p-6 pb-1 pb-[calc(var(--xds-space-4)+env(safe-area-inset-bottom))] peer-checked:*:opacity-100 peer-checked:*:translate-x-[calc(var(--xds-size-switch-width)-var(--xds-size-switch-height))] peer-checked:bg-xds-checkbox-background-checked peer-checked:bg-xds-segmented-selected-background peer-checked:bg-xds-switch-track-on peer-checked:border-0 peer-checked:border-xds-segmented-selected-border peer-checked:shadow-xds-subtle peer-checked:text-xds-segmented-selected-text peer-disabled:*:bg-xds-switch-disabled-thumb peer-disabled:bg-xds-checkbox-disabled-background peer-disabled:bg-xds-switch-disabled-track peer-disabled:border-0 peer-disabled:text-xds-checkbox-disabled-mark peer-disabled:text-xds-text-secondary peer-focus-visible:outline-(length:--xds-focus-width) peer-focus-visible:outline-xds-border-focus peer-focus-visible:outline-offset-(--xds-focus-offset) peer-focus-visible:outline-solid pointer-events-auto pointer-events-none ps-3 px-1 px-2 px-2.5 px-3 px-4 px-6 py-1 py-2 py-3 py-8 relative rounded-[calc(var(--xds-radius-lg)-var(--xds-border-width-thin))] rounded-[calc(var(--xds-radius-md)-2px)] rounded-xds-full rounded-xds-lg rounded-xds-md rounded-xds-sm rounded-full rounded-t-[calc(var(--xds-radius-lg)-var(--xds-border-width-thin))] rtl:-scale-x-100 scroll-mt-20 select-none self-center shadow shadow-xds-raised shadow-xds-subtle shrink-0 size-1.5 size-12 size-3/4 size-8 size-xds-avatar-lg size-xds-avatar-md size-xds-avatar-sm size-xds-avatar-xl size-xds-checkbox size-xds-icon-lg size-xds-icon-md size-xds-icon-sm size-xds-icon-xl size-xds-icon-xs size-xds-spinner-lg size-xds-spinner-md size-xds-spinner-sm size-xds-target-min size-full sm:grid-cols-2 sm:grid-cols-3 sm:grid-cols-4 sm:grid-cols-5 sr-only start-2 static sticky table tabular-nums text-xds-accordion-icon text-xds-avatar-overflow-text text-xds-avatar-text text-xds-badge-accent-text text-xds-badge-count-text text-xds-badge-danger-text text-xds-badge-neutral-text text-xds-badge-overlay-text text-xds-badge-success-text text-xds-badge-warning-text text-xds-banner-danger-accent text-xds-banner-info-accent text-xds-banner-success-accent text-xds-banner-text text-xds-banner-warning-accent text-xds-body text-xds-body-strong text-xds-checkbox-mark text-xds-chip-selected-text text-xds-chip-text text-xds-detail text-xds-display text-xds-empty-state-icon text-xds-field-placeholder text-xds-footnote text-xds-heading text-xds-label text-xds-segmented-text text-xds-sidebar-section-title text-xds-status-danger text-xds-status-success text-xds-status-warning text-xds-text-accent text-xds-text-on-accent text-xds-text-primary text-xds-text-secondary text-xds-text-tertiary text-xds-thumbnail-icon text-xds-title text-xds-toast-action text-xds-toast-text text-center text-start top-0 top-2 top-[calc(var(--xds-size-count-badge)/-4)] top-auto transition-[width] transition-colors transition-transform truncate underline visible w-16 w-2/5 w-24 w-28 w-36 w-48 w-xds-sidebar w-xds-sidebar-rail w-xds-switch-width w-fit w-full whitespace-nowrap z-10");
|
|
2672
|
+
@source inline("*:opacity-0 -m-1 -me-1 -mt-4 -mx-4 -mx-6 -my-2 [&::-webkit-scrollbar]:hidden [&:popover-open]:flex [scrollbar-width:none] absolute active:bg-xds-card-background-pressed active:bg-xds-list-row-background-pressed active:bg-xds-list-row-background-selected-hover after:-inset-(--xds-border-width-thin) after:absolute after:border-(length:--xds-border-width-thick) after:border-xds-card-border-selected after:pointer-events-none after:rounded-xds-lg animate-[xds-skeleton-pulse_var(--xds-motion-duration-pulse)_var(--xds-motion-easing-standard)_infinite] animate-[xds-toast-enter_var(--xds-motion-duration-normal)_var(--xds-motion-easing-enter)] animate-spin aspect-[4/3] aspect-[9/16] aspect-square aspect-video before:-translate-y-1/2 before:absolute before:h-[max(100%,var(--xds-size-target-min))] before:inset-x-0 before:top-1/2 bg-xds-accent-default bg-xds-avatar-background bg-xds-avatar-overflow-background bg-xds-background-base bg-xds-background-surface bg-xds-badge-accent-background bg-xds-badge-count-background bg-xds-badge-danger-background bg-xds-badge-neutral-background bg-xds-badge-overlay-background bg-xds-badge-success-background bg-xds-badge-warning-background bg-xds-banner-danger-background bg-xds-banner-info-background bg-xds-banner-success-background bg-xds-banner-warning-background bg-xds-border-default bg-xds-chip-background bg-xds-chip-selected-background bg-xds-list-row-background-selected bg-xds-overlay-accent bg-xds-overlay-background bg-xds-progress-fill bg-xds-progress-track bg-xds-segmented-track bg-xds-sidebar-background bg-xds-sidebar-border bg-xds-skeleton-background bg-xds-switch-thumb bg-xds-switch-track bg-xds-thumbnail-background bg-xds-toast-background bg-current bg-transparent block blur border border-0 border-2 border-xds-border-default border-xds-border-strong border-xds-card-border-selected border-xds-checkbox-border border-xds-chip-selected-border border-xds-sidebar-border border-b border-e border-transparent bottom-0 bottom-2 bottom-[calc(var(--xds-space-1)+var(--xds-space-2))] break-all container contents cursor-pointer disabled:bg-xds-chip-disabled-background disabled:border-transparent disabled:cursor-not-allowed disabled:hover:bg-xds-list-row-background-selected disabled:hover:bg-transparent disabled:text-xds-chip-disabled-text duration-(--xds-motion-duration-fast) duration-(--xds-motion-duration-normal) ease-(--xds-motion-easing-standard) enabled:active:bg-xds-chip-background-pressed enabled:active:bg-xds-chip-selected-background-pressed enabled:hover:bg-xds-chip-background-hover enabled:hover:bg-xds-chip-selected-background-hover end-2 end-[calc(var(--xds-size-count-badge)/-4)] filter fixed flex flex-1 flex-col flex-wrap focus-visible:-outline-offset-(--xds-focus-offset) focus-visible:outline-(length:--xds-focus-width) focus-visible:outline-xds-border-focus focus-visible:outline-current focus-visible:outline-offset-(--xds-focus-offset) focus-visible:outline-solid gap-0.5 gap-1 gap-1.5 gap-12 gap-2 gap-3 gap-4 gap-6 gap-8 gap-x-8 gap-y-6 grid grid-cols-2 grid-cols-[repeat(auto-fill,minmax(8rem,1fr))] group-aria-expanded:rotate-180 h-(--xds-border-width-thin) h-(--xds-space-1) h-(--xds-typography-body-size) h-24 h-28 h-[28rem] h-xds-badge h-xds-chip h-xds-control-md h-xds-count-badge h-xds-progress h-xds-switch-height h-full h-lh h-px has-disabled:cursor-not-allowed hidden hover:bg-xds-card-background-hover hover:bg-xds-control-default hover:bg-xds-list-row-background-hover hover:bg-xds-list-row-background-selected-hover hover:text-xds-field-text hover:text-xds-text-primary hover:underline inline-flex inset-0 inset-x-0 invisible items-center items-end items-start justify-between justify-center line-clamp-2 m-0 m-auto max-w-4xl max-w-xds-dialog max-w-xds-toast max-w-md max-w-none max-w-sm max-w-xs mb-2 mb-4 min-h-0 min-h-[calc(var(--xds-size-target-min)+var(--xds-space-2))] min-h-xds-list-row min-h-xds-list-row-compact min-h-xds-target-min min-w-0 min-w-xds-count-badge min-w-xds-target-min motion-reduce:animate-none motion-reduce:animate-pulse motion-reduce:transition-none ms-auto mt-0.5 mt-2 mt-4 mt-6 mx-2 mx-auto not-first:ms-[calc(var(--xds-size-avatar-lg)/-4)] not-first:ms-[calc(var(--xds-size-avatar-md)/-4)] not-first:ms-[calc(var(--xds-size-avatar-sm)/-4)] not-first:ms-[calc(var(--xds-size-avatar-xl)/-4)] object-cover outline outline-(length:--xds-border-width-thick) outline-xds-avatar-ring outline-solid overflow-hidden overflow-visible overflow-x-auto overflow-y-auto p-0.5 p-1 p-2 p-3 p-4 p-6 pb-1 pb-[calc(var(--xds-space-4)+env(safe-area-inset-bottom))] peer-checked:*:opacity-100 peer-checked:*:translate-x-[calc(var(--xds-size-switch-width)-var(--xds-size-switch-height))] peer-checked:bg-xds-checkbox-background-checked peer-checked:bg-xds-segmented-selected-background peer-checked:bg-xds-switch-track-on peer-checked:border-0 peer-checked:border-xds-segmented-selected-border peer-checked:shadow-xds-subtle peer-checked:text-xds-segmented-selected-text peer-disabled:*:bg-xds-switch-disabled-thumb peer-disabled:bg-xds-checkbox-disabled-background peer-disabled:bg-xds-switch-disabled-track peer-disabled:border-0 peer-disabled:text-xds-checkbox-disabled-mark peer-disabled:text-xds-text-secondary peer-focus-visible:outline-(length:--xds-focus-width) peer-focus-visible:outline-xds-border-focus peer-focus-visible:outline-offset-(--xds-focus-offset) peer-focus-visible:outline-solid pointer-events-auto pointer-events-none ps-3 px-1 px-2 px-2.5 px-3 px-4 px-6 py-1 py-2 py-3 py-8 relative rounded-[calc(var(--xds-radius-lg)-var(--xds-border-width-thin))] rounded-[calc(var(--xds-radius-md)-2px)] rounded-xds-full rounded-xds-lg rounded-xds-md rounded-xds-sm rounded-full rounded-t-[calc(var(--xds-radius-lg)-var(--xds-border-width-thin))] rtl:-scale-x-100 scroll-mt-20 select-none self-center shadow shadow-xds-raised shadow-xds-subtle shrink-0 size-1.5 size-12 size-3/4 size-8 size-xds-avatar-lg size-xds-avatar-md size-xds-avatar-sm size-xds-avatar-xl size-xds-checkbox size-xds-icon-lg size-xds-icon-md size-xds-icon-sm size-xds-icon-xl size-xds-icon-xs size-xds-spinner-lg size-xds-spinner-md size-xds-spinner-sm size-xds-target-min size-full sm:grid-cols-2 sm:grid-cols-3 sm:grid-cols-4 sm:grid-cols-5 sr-only start-2 static sticky table tabular-nums text-xds-accordion-icon text-xds-avatar-overflow-text text-xds-avatar-text text-xds-badge-accent-text text-xds-badge-count-text text-xds-badge-danger-text text-xds-badge-neutral-text text-xds-badge-overlay-text text-xds-badge-success-text text-xds-badge-warning-text text-xds-banner-danger-accent text-xds-banner-info-accent text-xds-banner-success-accent text-xds-banner-text text-xds-banner-warning-accent text-xds-body text-xds-body-strong text-xds-checkbox-mark text-xds-chip-selected-text text-xds-chip-text text-xds-detail text-xds-display text-xds-empty-state-icon text-xds-field-placeholder text-xds-footnote text-xds-heading text-xds-label text-xds-segmented-text text-xds-sidebar-section-title text-xds-status-danger text-xds-status-success text-xds-status-warning text-xds-text-accent text-xds-text-on-accent text-xds-text-primary text-xds-text-secondary text-xds-text-tertiary text-xds-thumbnail-icon text-xds-title text-xds-toast-action text-xds-toast-text text-center text-start top-0 top-2 top-[calc(var(--xds-size-count-badge)/-4)] top-auto transition-[width] transition-colors transition-transform truncate underline visible w-16 w-2/5 w-24 w-28 w-36 w-48 w-xds-sidebar w-xds-sidebar-rail w-xds-switch-width w-fit w-full whitespace-nowrap z-10");
|