@xds/solid 1.0.1 → 1.2.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/Breadcrumb.js +87 -0
- package/dist/dom/Button.js +10 -3
- package/dist/dom/Card.js +31 -26
- package/dist/dom/Checkbox.js +57 -26
- package/dist/dom/Chip.js +21 -17
- package/dist/dom/ChipBar.js +17 -13
- package/dist/dom/Combobox.js +295 -0
- 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/Link.js +62 -0
- package/dist/dom/ListRow.js +34 -28
- package/dist/dom/MediaCard.js +32 -23
- package/dist/dom/Menu.js +18 -15
- package/dist/dom/Pagination.js +132 -0
- package/dist/dom/Popover.js +126 -0
- 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 +91 -51
- 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/Table.js +150 -0
- 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/TimePicker.js +245 -0
- package/dist/dom/Toast.js +19 -20
- package/dist/dom/ToastQueue.js +59 -0
- package/dist/dom/Tooltip.js +10 -6
- package/dist/dom/base.js +16 -0
- package/dist/dom/controllable.js +44 -0
- package/dist/dom/index.js +10 -1
- package/dist/dom/modal-popover.js +2 -2
- package/dist/dom/presence.js +3 -2
- package/dist/dom/preview.js +20 -1
- package/dist/dom/root.js +16 -4
- package/dist/dom/rows.js +13 -0
- 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/Breadcrumb.d.ts +9 -0
- package/dist/source/Breadcrumb.jsx +26 -0
- 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 +26 -8
- 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/Combobox.d.ts +16 -0
- package/dist/source/Combobox.jsx +137 -0
- 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/Link.d.ts +20 -0
- package/dist/source/Link.jsx +21 -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 +11 -3
- package/dist/source/Pagination.d.ts +12 -0
- package/dist/source/Pagination.jsx +51 -0
- package/dist/source/Popover.d.ts +19 -0
- package/dist/source/Popover.jsx +65 -0
- 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 +10 -1
- package/dist/source/Select.jsx +46 -11
- 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/Table.d.ts +17 -0
- package/dist/source/Table.jsx +46 -0
- 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/TimePicker.d.ts +19 -0
- package/dist/source/TimePicker.jsx +137 -0
- package/dist/source/Toast.d.ts +1 -1
- package/dist/source/Toast.jsx +2 -1
- package/dist/source/ToastQueue.d.ts +19 -0
- package/dist/source/ToastQueue.jsx +27 -0
- package/dist/source/Tooltip.jsx +4 -3
- package/dist/source/base.d.ts +15 -0
- package/dist/source/base.js +15 -0
- package/dist/source/controllable.d.ts +30 -0
- package/dist/source/controllable.js +30 -0
- package/dist/source/index.d.ts +10 -1
- package/dist/source/index.js +9 -0
- package/dist/source/modal-popover.js +2 -2
- package/dist/source/presence.js +3 -2
- package/dist/source/preview.d.ts +10 -2
- package/dist/source/preview.jsx +12 -2
- package/dist/source/root.d.ts +14 -4
- package/dist/source/root.js +7 -2
- package/dist/source/rows.d.ts +8 -0
- package/dist/source/rows.js +5 -0
- package/dist/source/trigger.d.ts +4 -2
- package/dist/source/trigger.js +2 -2
- package/eject/files/Accordion.tsx +138 -0
- package/eject/files/Avatar.tsx +48 -0
- package/eject/files/AvatarStack.tsx +51 -0
- package/eject/files/Badge.tsx +39 -0
- package/eject/files/Banner.tsx +80 -0
- package/eject/files/Breadcrumb.tsx +57 -0
- package/eject/files/Button.tsx +90 -0
- package/eject/files/Card.tsx +100 -0
- package/eject/files/Checkbox.tsx +100 -0
- package/eject/files/Chip.tsx +40 -0
- package/eject/files/ChipBar.tsx +34 -0
- package/eject/files/Combobox.tsx +200 -0
- package/eject/files/CountBadge.tsx +55 -0
- package/eject/files/DatePicker.tsx +225 -0
- package/eject/files/DateRangePicker.tsx +319 -0
- package/eject/files/Dialog.tsx +117 -0
- package/eject/files/Divider.tsx +21 -0
- package/eject/files/EmptyState.tsx +39 -0
- package/eject/files/Icon.tsx +37 -0
- package/eject/files/IconButton.tsx +76 -0
- package/eject/files/Link.tsx +61 -0
- package/eject/files/ListRow.tsx +94 -0
- package/eject/files/MediaCard.tsx +116 -0
- package/eject/files/Menu.tsx +190 -0
- package/eject/files/Pagination.tsx +109 -0
- package/eject/files/Popover.tsx +124 -0
- package/eject/files/ProgressBar.tsx +37 -0
- package/eject/files/RadioGroup.tsx +138 -0
- package/eject/files/SearchField.tsx +124 -0
- package/eject/files/SectionHeader.tsx +59 -0
- package/eject/files/SegmentedControl.tsx +79 -0
- package/eject/files/Select.tsx +290 -0
- package/eject/files/Sidebar.tsx +156 -0
- package/eject/files/Skeleton.tsx +33 -0
- package/eject/files/Slider.tsx +131 -0
- package/eject/files/Spinner.tsx +44 -0
- package/eject/files/Switch.tsx +88 -0
- package/eject/files/Table.tsx +98 -0
- package/eject/files/Tabs.tsx +87 -0
- package/eject/files/Text.tsx +38 -0
- package/eject/files/TextField.tsx +171 -0
- package/eject/files/Thumbnail.tsx +84 -0
- package/eject/files/TimePicker.tsx +237 -0
- package/eject/files/Toast.tsx +100 -0
- package/eject/files/ToastQueue.tsx +62 -0
- package/eject/files/Tooltip.tsx +135 -0
- package/eject/files/accordion.css +89 -0
- package/eject/files/accordion.ts +67 -0
- package/eject/files/avatar-stack.ts +57 -0
- package/eject/files/avatar.ts +42 -0
- package/eject/files/badge.ts +30 -0
- package/eject/files/banner.ts +71 -0
- package/eject/files/base.css +38 -0
- package/eject/files/breadcrumb.css +51 -0
- package/eject/files/breadcrumb.ts +42 -0
- package/eject/files/button.css +241 -0
- package/eject/files/button.ts +106 -0
- package/eject/files/card.ts +58 -0
- package/eject/files/checkbox.ts +52 -0
- package/eject/files/chip-bar.ts +16 -0
- package/eject/files/chip.ts +35 -0
- package/eject/files/combobox.css +269 -0
- package/eject/files/combobox.ts +85 -0
- package/eject/files/count-badge.ts +32 -0
- package/eject/files/date-picker.css +375 -0
- package/eject/files/date-picker.ts +280 -0
- package/eject/files/date-range-picker.ts +338 -0
- package/eject/files/dialog.css +139 -0
- package/eject/files/dialog.ts +15 -0
- package/eject/files/divider.ts +5 -0
- package/eject/files/empty-state.ts +22 -0
- package/eject/files/icon.ts +36 -0
- package/eject/files/link.css +64 -0
- package/eject/files/link.ts +63 -0
- package/eject/files/list-row.ts +66 -0
- package/eject/files/media-card.ts +66 -0
- package/eject/files/menu.css +192 -0
- package/eject/files/menu.ts +84 -0
- package/eject/files/overlay.css +40 -0
- package/eject/files/pagination.css +106 -0
- package/eject/files/pagination.ts +68 -0
- package/eject/files/parts.ts +17 -0
- package/eject/files/popover.css +101 -0
- package/eject/files/popover.ts +37 -0
- package/eject/files/progress-bar.ts +26 -0
- package/eject/files/radio-group.css +184 -0
- package/eject/files/radio-group.ts +30 -0
- package/eject/files/section-header.ts +32 -0
- package/eject/files/segmented-control.ts +33 -0
- package/eject/files/select.css +347 -0
- package/eject/files/select.ts +77 -0
- package/eject/files/sidebar.ts +75 -0
- package/eject/files/skeleton.ts +51 -0
- package/eject/files/slider.css +160 -0
- package/eject/files/slider.ts +80 -0
- package/eject/files/spinner.ts +22 -0
- package/eject/files/switch.ts +45 -0
- package/eject/files/table.css +107 -0
- package/eject/files/table.ts +84 -0
- package/eject/files/tabs.css +120 -0
- package/eject/files/tabs.ts +37 -0
- package/eject/files/text-field.css +225 -0
- package/eject/files/text-field.ts +64 -0
- package/eject/files/text.ts +38 -0
- package/eject/files/thumbnail.ts +51 -0
- package/eject/files/time-picker.ts +113 -0
- package/eject/files/toast-queue.ts +64 -0
- package/eject/files/toast.ts +31 -0
- package/eject/files/tooltip.css +111 -0
- package/eject/files/tooltip.ts +21 -0
- package/eject/manifest.json +1027 -0
- package/package.json +12 -4
- package/styles.css +1066 -167
- package/tailwind.css +1295 -218
package/dist/dom/Toast.js
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { rootAttributes } from "./root.js";
|
|
2
|
+
import { className, createComponent, delegateEvents, effect, insert, readShallow, ref, spread, template } from "@solidjs/web";
|
|
2
3
|
import { TOAST_PARTS, classes, readCssMs, rootPart } from "@xds/core";
|
|
3
4
|
import { Show, createEffect, createSignal, onSettled } from "solid-js";
|
|
4
5
|
import { motion } from "@xds/tokens";
|
|
@@ -50,10 +51,20 @@ function Toast(props) {
|
|
|
50
51
|
get children() {
|
|
51
52
|
var _el$2 = _tmpl$();
|
|
52
53
|
var _el$3 = _el$2.firstChild;
|
|
53
|
-
_el$2
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
54
|
+
spread(_el$2, [() => {
|
|
55
|
+
return rootAttributes(props);
|
|
56
|
+
}, {
|
|
57
|
+
onPointerEnter: (event) => setHovered(event.currentTarget),
|
|
58
|
+
onPointerLeave: () => setHovered(void 0),
|
|
59
|
+
onFocusIn: (event) => setFocused(event.currentTarget),
|
|
60
|
+
onFocusOut: () => setFocused(void 0),
|
|
61
|
+
get "class"() {
|
|
62
|
+
return classes(ROOT, TOAST_PARTS.toast, props.class);
|
|
63
|
+
},
|
|
64
|
+
get style() {
|
|
65
|
+
return props.style;
|
|
66
|
+
}
|
|
67
|
+
}], true);
|
|
57
68
|
insert(_el$3, () => {
|
|
58
69
|
return props.message;
|
|
59
70
|
});
|
|
@@ -76,16 +87,8 @@ function Toast(props) {
|
|
|
76
87
|
return _el$4;
|
|
77
88
|
})()
|
|
78
89
|
}), null);
|
|
79
|
-
effect(() => {
|
|
80
|
-
|
|
81
|
-
e: readShallow(classes(ROOT, TOAST_PARTS.toast, props.class)),
|
|
82
|
-
t: readShallow(props.style),
|
|
83
|
-
a: readShallow(TOAST_PARTS.message)
|
|
84
|
-
};
|
|
85
|
-
}, ({ e, t, a }, _p$) => {
|
|
86
|
-
className(_el$2, e, _p$?.e);
|
|
87
|
-
style(_el$2, t, _p$?.t);
|
|
88
|
-
className(_el$3, a, _p$?.a);
|
|
90
|
+
effect(() => readShallow(TOAST_PARTS.message), (_v$, _$p) => {
|
|
91
|
+
className(_el$3, _v$, _$p);
|
|
89
92
|
});
|
|
90
93
|
return _el$2;
|
|
91
94
|
}
|
|
@@ -95,9 +98,5 @@ function Toast(props) {
|
|
|
95
98
|
});
|
|
96
99
|
return _el$;
|
|
97
100
|
}
|
|
98
|
-
delegateEvents([
|
|
99
|
-
"focusin",
|
|
100
|
-
"focusout",
|
|
101
|
-
"click"
|
|
102
|
-
]);
|
|
101
|
+
delegateEvents(["click"]);
|
|
103
102
|
export { Toast };
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
import { rootAttributes } from "./root.js";
|
|
2
|
+
import { Toast } from "./Toast.js";
|
|
3
|
+
import { createComponent, mergeProps } from "@solidjs/web";
|
|
4
|
+
import { queueToast, readCssMs, toastQueueStep } from "@xds/core";
|
|
5
|
+
import { createEffect, createMemo, createSignal } from "solid-js";
|
|
6
|
+
import { motion } from "@xds/tokens";
|
|
7
|
+
// packages/ui-solid/src/ToastQueue.tsx
|
|
8
|
+
/**
|
|
9
|
+
* Shows the app's toasts one at a time, in their order: the first of `toasts`, which stays for
|
|
10
|
+
* its own `duration` or until its action is taken, and then the next, `motion.duration.normal`
|
|
11
|
+
* after the one before has gone, so that each is read and announced as a message of its own.
|
|
12
|
+
* Add a toast with `queueToast`, which keeps at most three waiting, and take one out in
|
|
13
|
+
* `onClose`. Put one where a single Toast would go.
|
|
14
|
+
*/
|
|
15
|
+
function ToastQueue(props) {
|
|
16
|
+
const [visible, setVisible] = createSignal(void 0);
|
|
17
|
+
const step = createMemo(() => toastQueueStep(props.toasts, visible()));
|
|
18
|
+
const shown = () => step() === "keep" ? props.toasts[0] : void 0;
|
|
19
|
+
createEffect(() => ({
|
|
20
|
+
step: step(),
|
|
21
|
+
first: props.toasts[0]
|
|
22
|
+
}), ({ step, first }) => {
|
|
23
|
+
if (step === "close") {
|
|
24
|
+
setVisible(void 0);
|
|
25
|
+
return;
|
|
26
|
+
}
|
|
27
|
+
if (step !== "wait" || first === void 0) return void 0;
|
|
28
|
+
const gap = readCssMs(null, "--xds-motion-duration-normal", motion.duration.normal);
|
|
29
|
+
const timer = setTimeout(() => setVisible(() => first.id), gap);
|
|
30
|
+
return () => clearTimeout(timer);
|
|
31
|
+
});
|
|
32
|
+
return createComponent(Toast, mergeProps(() => {
|
|
33
|
+
return rootAttributes(props);
|
|
34
|
+
}, {
|
|
35
|
+
get "class"() {
|
|
36
|
+
return props.class;
|
|
37
|
+
},
|
|
38
|
+
get style() {
|
|
39
|
+
return props.style;
|
|
40
|
+
},
|
|
41
|
+
get open() {
|
|
42
|
+
return shown() !== void 0;
|
|
43
|
+
},
|
|
44
|
+
get message() {
|
|
45
|
+
return shown()?.message ?? "";
|
|
46
|
+
},
|
|
47
|
+
get action() {
|
|
48
|
+
return shown()?.action;
|
|
49
|
+
},
|
|
50
|
+
get duration() {
|
|
51
|
+
return shown()?.duration;
|
|
52
|
+
},
|
|
53
|
+
onClose: () => {
|
|
54
|
+
const toast = shown();
|
|
55
|
+
if (toast !== void 0) props.onClose(toast.id);
|
|
56
|
+
}
|
|
57
|
+
}));
|
|
58
|
+
}
|
|
59
|
+
export { ToastQueue, queueToast };
|
package/dist/dom/Tooltip.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { Portal as Portal$1 } from "./portal.js";
|
|
2
2
|
import { createPresence } from "./presence.js";
|
|
3
|
-
import { withStyle } from "./root.js";
|
|
3
|
+
import { rootAttributes, withStyle } from "./root.js";
|
|
4
4
|
import { TriggerContext, provideTrigger } from "./trigger.js";
|
|
5
|
-
import { createComponent, insert, ref, spread, template } from "@solidjs/web";
|
|
5
|
+
import { createComponent, insert, mergeProps, ref, spread, template } from "@solidjs/web";
|
|
6
6
|
import { classes, readCssMs, readCssPx, tooltipEndSide } from "@xds/core";
|
|
7
7
|
import { normalizeProps, useMachine } from "@zag-js/solid";
|
|
8
8
|
import { Show, createMemo, createUniqueId } from "solid-js";
|
|
@@ -23,14 +23,17 @@ var _tmpl$2 = /* @__PURE__ */ template(`<kbd class=xds-tooltip__shortcut>`);
|
|
|
23
23
|
* while it shows.
|
|
24
24
|
*/
|
|
25
25
|
function Tooltip(props) {
|
|
26
|
-
return createComponent(Overlay, {
|
|
26
|
+
return createComponent(Overlay, mergeProps({
|
|
27
27
|
get label() {
|
|
28
28
|
return props.label;
|
|
29
29
|
},
|
|
30
30
|
get shortcut() {
|
|
31
31
|
return props.shortcut;
|
|
32
32
|
},
|
|
33
|
-
placement: () => props.placement ?? "top"
|
|
33
|
+
placement: () => props.placement ?? "top"
|
|
34
|
+
}, () => {
|
|
35
|
+
return rootAttributes(props);
|
|
36
|
+
}, {
|
|
34
37
|
get "class"() {
|
|
35
38
|
return props.class;
|
|
36
39
|
},
|
|
@@ -40,7 +43,7 @@ function Tooltip(props) {
|
|
|
40
43
|
get children() {
|
|
41
44
|
return props.children;
|
|
42
45
|
}
|
|
43
|
-
});
|
|
46
|
+
}));
|
|
44
47
|
}
|
|
45
48
|
/**
|
|
46
49
|
* A Tooltip at the end edge of its control instead of above or below it: a collapsed Sidebar
|
|
@@ -63,6 +66,7 @@ function Overlay(props) {
|
|
|
63
66
|
const id = createUniqueId();
|
|
64
67
|
const service = useMachine(tooltip.machine, () => ({
|
|
65
68
|
id,
|
|
69
|
+
ids: { content: props.id },
|
|
66
70
|
openDelay: readCssMs(null, "--xds-motion-duration-tooltip-delay", motion.duration.tooltipDelay),
|
|
67
71
|
closeDelay: 0,
|
|
68
72
|
closeOnScroll: false,
|
|
@@ -73,7 +77,7 @@ function Overlay(props) {
|
|
|
73
77
|
}));
|
|
74
78
|
const api = createMemo(() => tooltip.connect(service, normalizeProps));
|
|
75
79
|
const trigger = provideTrigger(() => api().getTriggerProps());
|
|
76
|
-
const contentProps = withStyle(() => api().getContentProps(), () => props.style);
|
|
80
|
+
const contentProps = withStyle(() => api().getContentProps(), () => props.style, rootAttributes(props));
|
|
77
81
|
let content;
|
|
78
82
|
const present = createPresence(() => api().open, () => [content]);
|
|
79
83
|
return [createComponent(TriggerContext, {
|
package/dist/dom/base.js
ADDED
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { useDefaults } from "./Defaults.js";
|
|
2
|
+
import { useLabels } from "./Labels.js";
|
|
3
|
+
import { PlaceRow } from "./ListRow.js";
|
|
4
|
+
import { TooltipBeside } from "./Tooltip.js";
|
|
5
|
+
import { composeRefs, createControllable, resetWithForm } from "./controllable.js";
|
|
6
|
+
import { keepChecked, keepValue } from "./controlled.js";
|
|
7
|
+
import { modalPopover } from "./modal-popover.js";
|
|
8
|
+
import { createPicture } from "./picture.js";
|
|
9
|
+
import { Portal } from "./portal.js";
|
|
10
|
+
import { createPresence } from "./presence.js";
|
|
11
|
+
import { layStyle, rootAttributes, withStyle } from "./root.js";
|
|
12
|
+
import { createItemProps } from "./rows.js";
|
|
13
|
+
import { TriggerContext, provideTrigger, withTrigger } from "./trigger.js";
|
|
14
|
+
import { AVATAR_SIZE, DEFAULT_LABELS, PEER_FOCUS, PRESSABLE_ROW, afterAnimations, buttonClass, focusWithoutRing, initials, isControlled, keepListKeys, leaveEscapeToFields, pictureClass, readCssMs, readCssPx, selectOptionIds, switchClass, switchLabelClass, underlayLayerStyle } from "@xds/core";
|
|
15
|
+
import { icons, motion, space } from "@xds/tokens";
|
|
16
|
+
export { AVATAR_SIZE, DEFAULT_LABELS, PEER_FOCUS, PRESSABLE_ROW, PlaceRow, Portal, TooltipBeside, TriggerContext, afterAnimations, buttonClass, composeRefs, createControllable, createItemProps, createPicture, createPresence, focusWithoutRing, icons, initials, isControlled, keepChecked, keepListKeys, keepValue, layStyle, leaveEscapeToFields, modalPopover, motion, pictureClass, provideTrigger, readCssMs, readCssPx, resetWithForm, rootAttributes, selectOptionIds, space, switchClass, switchLabelClass, underlayLayerStyle, useDefaults, useLabels, withStyle, withTrigger };
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import { onFormReset } from "@xds/core";
|
|
2
|
+
import { createEffect, createSignal, untrack } from "solid-js";
|
|
3
|
+
// packages/ui-solid/src/controllable.ts
|
|
4
|
+
/**
|
|
5
|
+
* The state of a control that the app may keep or leave to it. It is the app's while the app
|
|
6
|
+
* gives the prop (`controlled`, from `isControlled`), and the control's own otherwise, from
|
|
7
|
+
* `defaultValue`. Either way a change goes to `onChange`, read when the change comes. The state
|
|
8
|
+
* is a plain value, never a function, which a signal would take for an update.
|
|
9
|
+
*/
|
|
10
|
+
function createControllable(options) {
|
|
11
|
+
const [own, setOwn] = createSignal(untrack(options.defaultValue));
|
|
12
|
+
return {
|
|
13
|
+
value: () => options.controlled() ? options.value() : own(),
|
|
14
|
+
set: (next) => {
|
|
15
|
+
if (!untrack(options.controlled)) setOwn(() => next);
|
|
16
|
+
options.onChange(next);
|
|
17
|
+
},
|
|
18
|
+
reset: () => setOwn(() => untrack(options.defaultValue))
|
|
19
|
+
};
|
|
20
|
+
}
|
|
21
|
+
/**
|
|
22
|
+
* Sets a control that keeps its own state back to its default when its form is reset, as the
|
|
23
|
+
* form sets the native field back. A controlled one shows what its owner gives it, whatever the
|
|
24
|
+
* form does.
|
|
25
|
+
*/
|
|
26
|
+
function resetWithForm(element, controlled, reset) {
|
|
27
|
+
createEffect(controlled, (isControlled) => isControlled ? void 0 : onFormReset(element(), reset));
|
|
28
|
+
}
|
|
29
|
+
/**
|
|
30
|
+
* One ref from the component's own and the one the app gives (`ref`, read when the element is
|
|
31
|
+
* made), which reaches the native input or button. Solid hands a component a ref the app
|
|
32
|
+
* writes as a variable as a function that sets it.
|
|
33
|
+
*/
|
|
34
|
+
function composeRefs(own, ref) {
|
|
35
|
+
return (element) => {
|
|
36
|
+
own(element);
|
|
37
|
+
apply(ref(), element);
|
|
38
|
+
};
|
|
39
|
+
}
|
|
40
|
+
function apply(ref, element) {
|
|
41
|
+
if (typeof ref === "function") ref(element);
|
|
42
|
+
else if (Array.isArray(ref)) for (const each of ref) apply(each, element);
|
|
43
|
+
}
|
|
44
|
+
export { composeRefs, createControllable, resetWithForm };
|
package/dist/dom/index.js
CHANGED
|
@@ -3,11 +3,13 @@ import { Avatar } from "./Avatar.js";
|
|
|
3
3
|
import { AvatarStack } from "./AvatarStack.js";
|
|
4
4
|
import { Badge } from "./Badge.js";
|
|
5
5
|
import { Banner } from "./Banner.js";
|
|
6
|
+
import { Breadcrumb } from "./Breadcrumb.js";
|
|
6
7
|
import { Button } from "./Button.js";
|
|
7
8
|
import { Card } from "./Card.js";
|
|
8
9
|
import { Checkbox } from "./Checkbox.js";
|
|
9
10
|
import { Chip } from "./Chip.js";
|
|
10
11
|
import { ChipBar } from "./ChipBar.js";
|
|
12
|
+
import { Combobox } from "./Combobox.js";
|
|
11
13
|
import { CountBadge } from "./CountBadge.js";
|
|
12
14
|
import { DatePicker } from "./DatePicker.js";
|
|
13
15
|
import { DateRangePicker } from "./DateRangePicker.js";
|
|
@@ -17,9 +19,13 @@ import { Divider } from "./Divider.js";
|
|
|
17
19
|
import { EmptyState } from "./EmptyState.js";
|
|
18
20
|
import { Icon } from "./Icon.js";
|
|
19
21
|
import { IconButton } from "./IconButton.js";
|
|
22
|
+
import { Labels } from "./Labels.js";
|
|
23
|
+
import { Link } from "./Link.js";
|
|
20
24
|
import { ListRow } from "./ListRow.js";
|
|
21
25
|
import { MediaCard } from "./MediaCard.js";
|
|
22
26
|
import { Menu } from "./Menu.js";
|
|
27
|
+
import { Pagination } from "./Pagination.js";
|
|
28
|
+
import { Popover } from "./Popover.js";
|
|
23
29
|
import { ProgressBar } from "./ProgressBar.js";
|
|
24
30
|
import { RadioGroup } from "./RadioGroup.js";
|
|
25
31
|
import { SearchField } from "./SearchField.js";
|
|
@@ -31,10 +37,13 @@ import { Skeleton } from "./Skeleton.js";
|
|
|
31
37
|
import { Slider } from "./Slider.js";
|
|
32
38
|
import { Spinner } from "./Spinner.js";
|
|
33
39
|
import { Switch } from "./Switch.js";
|
|
40
|
+
import { Table } from "./Table.js";
|
|
34
41
|
import { Tabs } from "./Tabs.js";
|
|
35
42
|
import { Text } from "./Text.js";
|
|
36
43
|
import { TextField } from "./TextField.js";
|
|
37
44
|
import { Thumbnail } from "./Thumbnail.js";
|
|
45
|
+
import { TimePicker } from "./TimePicker.js";
|
|
38
46
|
import { Toast } from "./Toast.js";
|
|
47
|
+
import { ToastQueue, queueToast } from "./ToastQueue.js";
|
|
39
48
|
import { Tooltip } from "./Tooltip.js";
|
|
40
|
-
export { 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 };
|
|
49
|
+
export { Accordion, Avatar, AvatarStack, Badge, Banner, Breadcrumb, Button, Card, Checkbox, Chip, ChipBar, Combobox, CountBadge, DatePicker, DateRangePicker, Defaults, Dialog, Divider, EmptyState, Icon, IconButton, Labels, Link, ListRow, MediaCard, Menu, Pagination, Popover, ProgressBar, RadioGroup, SearchField, SectionHeader, SegmentedControl, Select, Sidebar, Skeleton, Slider, Spinner, Switch, Table, Tabs, Text, TextField, Thumbnail, TimePicker, Toast, ToastQueue, Tooltip, queueToast };
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { createEffect } from "solid-js";
|
|
1
|
+
import { createEffect, createMemo } from "solid-js";
|
|
2
2
|
import { ariaHidden } from "@zag-js/aria-hidden";
|
|
3
3
|
import { preventBodyScroll } from "@zag-js/remove-scroll";
|
|
4
4
|
// packages/ui-solid/src/modal-popover.ts
|
|
@@ -9,7 +9,7 @@ import { preventBodyScroll } from "@zag-js/remove-scroll";
|
|
|
9
9
|
* the page. Zag does all of this around a dialog, but not around a menu or a select.
|
|
10
10
|
*/
|
|
11
11
|
function modalPopover(open, popup) {
|
|
12
|
-
createEffect(open, (isOpen) => {
|
|
12
|
+
createEffect(createMemo(open), (isOpen) => {
|
|
13
13
|
if (!isOpen) return;
|
|
14
14
|
const unlock = preventBodyScroll(document);
|
|
15
15
|
const reveal = ariaHidden(() => [popup() ?? null], { defer: true });
|
package/dist/dom/presence.js
CHANGED
|
@@ -8,13 +8,14 @@ import { createEffect, createMemo, createSignal } from "solid-js";
|
|
|
8
8
|
*/
|
|
9
9
|
function createPresence(open, parts) {
|
|
10
10
|
const [exited, setExited] = createSignal(true);
|
|
11
|
-
|
|
11
|
+
const isOpen = createMemo(open);
|
|
12
|
+
createEffect(isOpen, (isOpen) => {
|
|
12
13
|
if (isOpen) {
|
|
13
14
|
setExited(false);
|
|
14
15
|
return;
|
|
15
16
|
}
|
|
16
17
|
return afterAnimations(parts(), () => setExited(true));
|
|
17
18
|
});
|
|
18
|
-
return createMemo(() =>
|
|
19
|
+
return createMemo(() => isOpen() || !exited());
|
|
19
20
|
}
|
|
20
21
|
export { createPresence };
|
package/dist/dom/preview.js
CHANGED
|
@@ -7,11 +7,15 @@ import { Badge } from "./Badge.js";
|
|
|
7
7
|
import { Spinner } from "./Spinner.js";
|
|
8
8
|
import { Button } from "./Button.js";
|
|
9
9
|
import { IconButton } from "./IconButton.js";
|
|
10
|
+
import { Labels } from "./Labels.js";
|
|
10
11
|
import { Banner } from "./Banner.js";
|
|
12
|
+
import { Link } from "./Link.js";
|
|
13
|
+
import { Breadcrumb } from "./Breadcrumb.js";
|
|
11
14
|
import { Card } from "./Card.js";
|
|
12
15
|
import { Checkbox } from "./Checkbox.js";
|
|
13
16
|
import { Chip } from "./Chip.js";
|
|
14
17
|
import { ChipBar } from "./ChipBar.js";
|
|
18
|
+
import { Combobox } from "./Combobox.js";
|
|
15
19
|
import { CountBadge } from "./CountBadge.js";
|
|
16
20
|
import { DatePicker } from "./DatePicker.js";
|
|
17
21
|
import { DateRangePicker } from "./DateRangePicker.js";
|
|
@@ -22,6 +26,8 @@ import { ListRow } from "./ListRow.js";
|
|
|
22
26
|
import { Thumbnail } from "./Thumbnail.js";
|
|
23
27
|
import { MediaCard } from "./MediaCard.js";
|
|
24
28
|
import { Menu } from "./Menu.js";
|
|
29
|
+
import { Pagination } from "./Pagination.js";
|
|
30
|
+
import { Popover } from "./Popover.js";
|
|
25
31
|
import { ProgressBar } from "./ProgressBar.js";
|
|
26
32
|
import { RadioGroup } from "./RadioGroup.js";
|
|
27
33
|
import { SearchField } from "./SearchField.js";
|
|
@@ -33,10 +39,13 @@ import { Sidebar } from "./Sidebar.js";
|
|
|
33
39
|
import { Skeleton } from "./Skeleton.js";
|
|
34
40
|
import { Slider } from "./Slider.js";
|
|
35
41
|
import { Switch } from "./Switch.js";
|
|
42
|
+
import { Table } from "./Table.js";
|
|
36
43
|
import { Tabs } from "./Tabs.js";
|
|
37
44
|
import { Text } from "./Text.js";
|
|
38
45
|
import { TextField } from "./TextField.js";
|
|
46
|
+
import { TimePicker } from "./TimePicker.js";
|
|
39
47
|
import { Toast } from "./Toast.js";
|
|
48
|
+
import { ToastQueue } from "./ToastQueue.js";
|
|
40
49
|
import "./index.js";
|
|
41
50
|
import { dynamic, memo } from "@solidjs/web";
|
|
42
51
|
import { Show, createComponent as createComponent$1, createSignal, onSettled, untrack } from "solid-js";
|
|
@@ -48,11 +57,13 @@ var COMPONENTS = {
|
|
|
48
57
|
AvatarStack,
|
|
49
58
|
Badge,
|
|
50
59
|
Banner,
|
|
60
|
+
Breadcrumb,
|
|
51
61
|
Button,
|
|
52
62
|
Card,
|
|
53
63
|
Checkbox,
|
|
54
64
|
Chip,
|
|
55
65
|
ChipBar,
|
|
66
|
+
Combobox,
|
|
56
67
|
CountBadge,
|
|
57
68
|
DatePicker,
|
|
58
69
|
DateRangePicker,
|
|
@@ -62,9 +73,13 @@ var COMPONENTS = {
|
|
|
62
73
|
EmptyState,
|
|
63
74
|
Icon,
|
|
64
75
|
IconButton,
|
|
76
|
+
Labels,
|
|
77
|
+
Link,
|
|
65
78
|
ListRow,
|
|
66
79
|
MediaCard,
|
|
67
80
|
Menu,
|
|
81
|
+
Pagination,
|
|
82
|
+
Popover,
|
|
68
83
|
ProgressBar,
|
|
69
84
|
RadioGroup,
|
|
70
85
|
SearchField,
|
|
@@ -76,15 +91,19 @@ var COMPONENTS = {
|
|
|
76
91
|
Slider,
|
|
77
92
|
Spinner,
|
|
78
93
|
Switch,
|
|
94
|
+
Table,
|
|
79
95
|
Tabs,
|
|
80
96
|
Text,
|
|
81
97
|
TextField,
|
|
82
98
|
Thumbnail,
|
|
99
|
+
TimePicker,
|
|
83
100
|
Toast,
|
|
101
|
+
ToastQueue,
|
|
84
102
|
Tooltip
|
|
85
103
|
};
|
|
86
104
|
function Preview(props) {
|
|
87
105
|
const screen = untrack(() => props.screen);
|
|
106
|
+
const components = untrack(() => props.components);
|
|
88
107
|
const state = {};
|
|
89
108
|
const writes = /* @__PURE__ */ new Map();
|
|
90
109
|
for (const [key, first] of Object.entries(screen.state)) {
|
|
@@ -115,7 +134,7 @@ function Preview(props) {
|
|
|
115
134
|
return host.draw(slot.fallback);
|
|
116
135
|
}
|
|
117
136
|
});
|
|
118
|
-
const type = slot.kind === "element" ? dynamic(() => slot.tag, { static: true }) : COMPONENTS[slot.name];
|
|
137
|
+
const type = slot.kind === "element" ? dynamic(() => slot.tag, { static: true }) : components?.[slot.name] ?? COMPONENTS[slot.name];
|
|
119
138
|
return createComponent$1(type, propsOf(slot));
|
|
120
139
|
}
|
|
121
140
|
};
|
package/dist/dom/root.js
CHANGED
|
@@ -1,5 +1,16 @@
|
|
|
1
1
|
import { mergeProps } from "@zag-js/solid";
|
|
2
|
+
import { omit } from "solid-js";
|
|
2
3
|
// packages/ui-solid/src/root.ts
|
|
4
|
+
var isRootAttribute = (key) => key === "id" || typeof key === "string" && key.startsWith("data-");
|
|
5
|
+
/**
|
|
6
|
+
* The `id` and `data-*` attributes among a component's props, to spread on its root element.
|
|
7
|
+
* A live view rather than ui-core's `rootAttributes`, which copies the values: an attribute
|
|
8
|
+
* whose prop changes follows it, and one the app leaves out is not in it, so it overrides
|
|
9
|
+
* nothing it is spread before.
|
|
10
|
+
*/
|
|
11
|
+
function rootAttributes(props) {
|
|
12
|
+
return omit(props, (key) => !isRootAttribute(key));
|
|
13
|
+
}
|
|
3
14
|
var css = (style) => typeof style === "string" ? style : Object.entries(style).filter(([, value]) => value !== void 0).map(([property, value]) => `${property}:${String(value)}`).join(";");
|
|
4
15
|
/**
|
|
5
16
|
* The style of a root element that sets one of its own: the app's comes after it, so that it
|
|
@@ -18,9 +29,10 @@ function layStyle(own, app) {
|
|
|
18
29
|
/**
|
|
19
30
|
* The props Zag gives a component's root element, with the app's style laid over the one Zag
|
|
20
31
|
* sets: Zag's mergeProps merges the two, where a `style` after the spread would replace Zag's.
|
|
21
|
-
*
|
|
32
|
+
* The app's root attributes win over Zag's, so give the machine the app's `id` for the part
|
|
33
|
+
* too (`ids`), which is how Zag finds it. Spread the result on the element.
|
|
22
34
|
*/
|
|
23
|
-
function withStyle(zag, style) {
|
|
24
|
-
return mergeProps(zag, () => ({ style: style() }));
|
|
35
|
+
function withStyle(zag, style, attributes = {}) {
|
|
36
|
+
return mergeProps(zag, attributes, () => ({ style: style() }));
|
|
25
37
|
}
|
|
26
|
-
export { layStyle, withStyle };
|
|
38
|
+
export { layStyle, rootAttributes, withStyle };
|
package/dist/dom/rows.js
ADDED
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { sameItemProps } from "@xds/core";
|
|
2
|
+
import { createMemo } from "solid-js";
|
|
3
|
+
// packages/ui-solid/src/rows.ts
|
|
4
|
+
/**
|
|
5
|
+
* The props a machine gives one row's part, followed only while they draw something else
|
|
6
|
+
* (`sameItemProps`). Read through `api()`, a row's props are made anew on every change to the
|
|
7
|
+
* machine, and each row's spread would set its attributes and its handlers again; this way a
|
|
8
|
+
* step of the highlight sets them on the two rows it moves between.
|
|
9
|
+
*/
|
|
10
|
+
function createItemProps(props) {
|
|
11
|
+
return createMemo(props, { equals: sameItemProps });
|
|
12
|
+
}
|
|
13
|
+
export { createItemProps };
|
package/dist/dom/trigger.js
CHANGED
|
@@ -17,15 +17,17 @@ function provideTrigger(own) {
|
|
|
17
17
|
* For a control that can open an overlay: its own props, after those of the overlays it opens.
|
|
18
18
|
* Its own attributes win, its own handlers run first, and its class is added to theirs, so the
|
|
19
19
|
* own class must be a string. While `inert` is true, as for a loading button, the overlays get
|
|
20
|
-
* none of its events and so do not open.
|
|
20
|
+
* none of its events and so do not open. The app's root attributes (`root`) come before the
|
|
21
|
+
* overlays': an overlay finds its trigger by the id it gives it. Spread the result on the
|
|
22
|
+
* element.
|
|
21
23
|
*/
|
|
22
|
-
function withTrigger(own, inert) {
|
|
24
|
+
function withTrigger(own, inert, root = {}) {
|
|
23
25
|
const trigger = useContext(TriggerContext);
|
|
24
26
|
const overlays = () => {
|
|
25
27
|
const props = trigger?.() ?? {};
|
|
26
28
|
if (!inert?.()) return props;
|
|
27
29
|
return Object.fromEntries(Object.entries(props).filter(([key]) => !key.startsWith("on")));
|
|
28
30
|
};
|
|
29
|
-
return mergeProps(overlays, own);
|
|
31
|
+
return mergeProps(root, overlays, own);
|
|
30
32
|
}
|
|
31
33
|
export { TriggerContext, provideTrigger, withTrigger };
|
|
@@ -3,11 +3,12 @@ import * as accordion from "@zag-js/accordion";
|
|
|
3
3
|
import { mergeProps, normalizeProps, useMachine } from "@zag-js/solid";
|
|
4
4
|
import { createEffect, createMemo, createUniqueId, For, Show } from "solid-js";
|
|
5
5
|
import { Icon } from "./Icon.jsx";
|
|
6
|
-
import { withStyle } from "./root.js";
|
|
6
|
+
import { rootAttributes, withStyle } from "./root.js";
|
|
7
7
|
export function Accordion(props) {
|
|
8
8
|
const id = createUniqueId();
|
|
9
9
|
const service = useMachine(accordion.machine, () => ({
|
|
10
10
|
id,
|
|
11
|
+
ids: { root: props.id },
|
|
11
12
|
value: [...props.expanded],
|
|
12
13
|
onValueChange: (details) => props.onChange(details.value),
|
|
13
14
|
multiple: props.multiple ?? false,
|
|
@@ -15,7 +16,7 @@ export function Accordion(props) {
|
|
|
15
16
|
hiddenUntilFound: true,
|
|
16
17
|
}));
|
|
17
18
|
const api = createMemo(() => accordion.connect(service, normalizeProps));
|
|
18
|
-
const root = withStyle(() => api().getRootProps(), () => props.style);
|
|
19
|
+
const root = withStyle(() => api().getRootProps(), () => props.style, rootAttributes(props));
|
|
19
20
|
const body = (value) => {
|
|
20
21
|
const { hidden: _hidden, ...attributes } = api().getItemContentProps({ value });
|
|
21
22
|
return attributes;
|
package/dist/source/Avatar.d.ts
CHANGED
package/dist/source/Avatar.jsx
CHANGED
|
@@ -2,12 +2,13 @@ import { avatarClass, avatarInitials, classes, pictureClass, rootPart, } from "@
|
|
|
2
2
|
import { Show } from "solid-js";
|
|
3
3
|
import { useDefaults } from "./Defaults.jsx";
|
|
4
4
|
import { createPicture } from "./picture.js";
|
|
5
|
+
import { rootAttributes } from "./root.js";
|
|
5
6
|
const ROOT = rootPart("Avatar");
|
|
6
7
|
export function Avatar(props) {
|
|
7
8
|
const defaults = useDefaults("Avatar");
|
|
8
9
|
const size = () => props.size ?? defaults().size;
|
|
9
10
|
const picture = createPicture(() => props.src);
|
|
10
|
-
return (<span role="img" aria-label={props.name} class={classes(ROOT, avatarClass(size()), props.class)} style={props.style}>
|
|
11
|
+
return (<span {...rootAttributes(props)} role="img" aria-label={props.name} class={classes(ROOT, avatarClass(size()), props.class)} style={props.style}>
|
|
11
12
|
{avatarInitials(props.name, size())}
|
|
12
13
|
<Show when={picture.loaded() !== false && props.src}>
|
|
13
14
|
{(src) => (<img ref={(element) => picture.sync(element, src())} src={src()} alt="" aria-hidden="true" class={pictureClass(picture.loaded() === true)} onLoad={() => picture.onLoad(src())} onError={() => picture.onError(src())}/>)}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { type AvatarStackBaseProps } from "@xds/core";
|
|
2
|
-
import type
|
|
2
|
+
import { type RootProps } from "./root.ts";
|
|
3
3
|
export type AvatarStackProps = AvatarStackBaseProps & RootProps;
|
|
4
4
|
/**
|
|
5
5
|
* Several people in the room of one. Assistive technology gets one image named after
|
|
@@ -2,12 +2,13 @@ import { avatarStack, avatarStackClass, avatarStackItemClass, avatarStackRestCla
|
|
|
2
2
|
import { createMemo, For, Show } from "solid-js";
|
|
3
3
|
import { Avatar } from "./Avatar.jsx";
|
|
4
4
|
import { useDefaults } from "./Defaults.jsx";
|
|
5
|
+
import { rootAttributes } from "./root.js";
|
|
5
6
|
const ROOT = rootPart("AvatarStack");
|
|
6
7
|
export function AvatarStack(props) {
|
|
7
8
|
const defaults = useDefaults("AvatarStack");
|
|
8
9
|
const size = () => props.size ?? defaults().size ?? "md";
|
|
9
10
|
const stack = createMemo(() => avatarStack(props.people, props.max, props.label));
|
|
10
|
-
return (<span role="img" aria-label={stack().name} class={classes(ROOT, avatarStackClass, props.class)} style={props.style}>
|
|
11
|
+
return (<span {...rootAttributes(props)} role="img" aria-label={stack().name} class={classes(ROOT, avatarStackClass, props.class)} style={props.style}>
|
|
11
12
|
<For each={stack().shown}>
|
|
12
13
|
{(person) => (<span aria-hidden="true" class={avatarStackItemClass(size())}>
|
|
13
14
|
<Avatar name={person.name} src={person.src} size={size()}/>
|
package/dist/source/Badge.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { type BadgeBaseProps } from "@xds/core";
|
|
2
2
|
import { type Element } from "solid-js";
|
|
3
|
-
import type
|
|
3
|
+
import { type RootProps } from "./root.ts";
|
|
4
4
|
export type { BadgeTone } from "@xds/core";
|
|
5
5
|
export type BadgeProps = BadgeBaseProps & RootProps & {
|
|
6
6
|
children: Element;
|
package/dist/source/Badge.jsx
CHANGED
|
@@ -2,10 +2,11 @@ import { badgeClass, badgeDotClass, classes, rootPart } from "@xds/core";
|
|
|
2
2
|
import { Show } from "solid-js";
|
|
3
3
|
import { useDefaults } from "./Defaults.jsx";
|
|
4
4
|
import { Icon } from "./Icon.jsx";
|
|
5
|
+
import { rootAttributes } from "./root.js";
|
|
5
6
|
const ROOT = rootPart("Badge");
|
|
6
7
|
export function Badge(props) {
|
|
7
8
|
const defaults = useDefaults("Badge");
|
|
8
|
-
return (<span class={classes(ROOT, badgeClass(props.tone ?? defaults().tone), props.class)} style={props.style}>
|
|
9
|
+
return (<span {...rootAttributes(props)} class={classes(ROOT, badgeClass(props.tone ?? defaults().tone), props.class)} style={props.style}>
|
|
9
10
|
<Show when={props.dot}>
|
|
10
11
|
<span aria-hidden="true" class={badgeDotClass}/>
|
|
11
12
|
</Show>
|
package/dist/source/Banner.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { type BannerBaseProps } from "@xds/core";
|
|
2
2
|
import { type Element } from "solid-js";
|
|
3
|
-
import type
|
|
3
|
+
import { type RootProps } from "./root.ts";
|
|
4
4
|
export type { BannerTone } from "@xds/core";
|
|
5
5
|
export type BannerProps = BannerBaseProps & RootProps & {
|
|
6
6
|
/** What the person can do about the message. Drawn under it as a small secondary button. */
|
package/dist/source/Banner.jsx
CHANGED
|
@@ -3,11 +3,14 @@ import { Show } from "solid-js";
|
|
|
3
3
|
import { Button } from "./Button.jsx";
|
|
4
4
|
import { useDefaults } from "./Defaults.jsx";
|
|
5
5
|
import { IconButton } from "./IconButton.jsx";
|
|
6
|
+
import { useLabels } from "./Labels.jsx";
|
|
7
|
+
import { rootAttributes } from "./root.js";
|
|
6
8
|
const ROOT = rootPart("Banner");
|
|
7
9
|
export function Banner(props) {
|
|
8
10
|
const defaults = useDefaults("Banner");
|
|
11
|
+
const labels = useLabels();
|
|
9
12
|
const tone = () => props.tone ?? defaults().tone;
|
|
10
|
-
return (<div role={bannerRole(tone())} class={classes(ROOT, bannerClass(tone()), props.class)} style={props.style}>
|
|
13
|
+
return (<div {...rootAttributes(props)} role={bannerRole(tone())} class={classes(ROOT, bannerClass(tone()), props.class)} style={props.style}>
|
|
11
14
|
<svg viewBox="0 0 24 24" aria-hidden="true" class={bannerIconClass(tone())}>
|
|
12
15
|
<path fill="currentColor" d={bannerIconPath(tone())}/>
|
|
13
16
|
</svg>
|
|
@@ -25,7 +28,7 @@ export function Banner(props) {
|
|
|
25
28
|
</div>
|
|
26
29
|
<Show when={props.onDismiss}>
|
|
27
30
|
<div class={BANNER_PARTS.dismiss}>
|
|
28
|
-
<IconButton icon="x" label={props.dismissLabel ??
|
|
31
|
+
<IconButton icon="x" label={props.dismissLabel ?? labels().dismiss} variant="ghost" size="sm" onPress={() => props.onDismiss?.()}/>
|
|
29
32
|
</div>
|
|
30
33
|
</Show>
|
|
31
34
|
</div>);
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { type BreadcrumbBaseProps } from "@xds/core";
|
|
2
|
+
import { type RootProps } from "./root.ts";
|
|
3
|
+
export type { BreadcrumbItem } from "@xds/core";
|
|
4
|
+
export type BreadcrumbProps = BreadcrumbBaseProps & RootProps;
|
|
5
|
+
/**
|
|
6
|
+
* Where the current view sits in the app: the places above it, each a link, then the view
|
|
7
|
+
* itself. A navigation landmark; the current place is marked as the page.
|
|
8
|
+
*/
|
|
9
|
+
export declare function Breadcrumb(props: BreadcrumbProps): import("@solidjs/web").JSX.Element;
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { BREADCRUMB_PARTS, BREADCRUMB_SEPARATOR, classes, rootPart, } from "@xds/core";
|
|
2
|
+
import { For, Show } from "solid-js";
|
|
3
|
+
import { Icon } from "./Icon.jsx";
|
|
4
|
+
import { useLabels } from "./Labels.jsx";
|
|
5
|
+
import { Link } from "./Link.jsx";
|
|
6
|
+
import { rootAttributes } from "./root.js";
|
|
7
|
+
const ROOT = rootPart("Breadcrumb");
|
|
8
|
+
export function Breadcrumb(props) {
|
|
9
|
+
const labels = useLabels();
|
|
10
|
+
return (<nav {...rootAttributes(props)} aria-label={props.label ?? labels().breadcrumb} class={classes(ROOT, props.class)} style={props.style}>
|
|
11
|
+
<ol class={BREADCRUMB_PARTS.list}>
|
|
12
|
+
<For each={props.items}>
|
|
13
|
+
{(item, index) => (<li class={BREADCRUMB_PARTS.item}>
|
|
14
|
+
<Show when={index() < props.items.length - 1} fallback={<span aria-current="page" class={BREADCRUMB_PARTS.current}>
|
|
15
|
+
{item.label}
|
|
16
|
+
</span>}>
|
|
17
|
+
<Link href={item.href} onPress={() => item.onPress?.()}>
|
|
18
|
+
{item.label}
|
|
19
|
+
</Link>
|
|
20
|
+
<Icon name={BREADCRUMB_SEPARATOR.name} size={BREADCRUMB_SEPARATOR.size} class={BREADCRUMB_PARTS.separator}/>
|
|
21
|
+
</Show>
|
|
22
|
+
</li>)}
|
|
23
|
+
</For>
|
|
24
|
+
</ol>
|
|
25
|
+
</nav>);
|
|
26
|
+
}
|