@xds/core 1.1.0 → 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/breadcrumb.d.ts +39 -0
- package/dist/breadcrumb.js +7 -0
- package/dist/checkbox.d.ts +16 -2
- package/dist/checkbox.js +3 -1
- package/dist/combobox.d.ts +59 -0
- package/dist/combobox.js +40 -0
- package/dist/index.d.ts +16 -7
- package/dist/index.js +15 -6
- package/dist/labels.d.ts +12 -5
- package/dist/labels.js +12 -5
- package/dist/link.d.ts +49 -0
- package/dist/link.js +12 -0
- package/dist/pagination.d.ts +51 -0
- package/dist/pagination.js +25 -0
- package/dist/popover.d.ts +33 -0
- package/dist/popover.js +8 -0
- package/dist/preview/components.d.ts +36 -0
- package/dist/preview/components.js +1 -0
- package/dist/preview/design.d.ts +22 -3
- package/dist/preview/design.js +65 -34
- package/dist/preview/fixtures.d.ts +0 -76
- package/dist/preview/fixtures.js +0 -126
- package/dist/preview/kit.d.ts +48 -32
- package/dist/preview/kit.js +3 -0
- package/dist/preview/page.d.ts +1 -1
- package/dist/preview/page.js +1 -0
- package/dist/preview/sections/accordion.d.ts +1 -0
- package/dist/preview/sections/accordion.js +40 -0
- package/dist/preview/sections/badges.d.ts +1 -0
- package/dist/preview/sections/badges.js +13 -0
- package/dist/preview/sections/banners.d.ts +1 -0
- package/dist/preview/sections/banners.js +13 -0
- package/dist/preview/sections/buttons.d.ts +2 -0
- package/dist/preview/sections/buttons.js +30 -0
- package/dist/preview/sections/card.d.ts +1 -0
- package/dist/preview/sections/card.js +33 -0
- package/dist/preview/sections/chips.d.ts +1 -0
- package/dist/preview/sections/chips.js +23 -0
- package/dist/preview/sections/controls.d.ts +1 -0
- package/dist/preview/sections/controls.js +143 -0
- package/dist/preview/sections/dialog.d.ts +1 -0
- package/dist/preview/sections/dialog.js +25 -0
- package/dist/preview/sections/empty-state.d.ts +1 -0
- package/dist/preview/sections/empty-state.js +13 -0
- package/dist/preview/sections/links.d.ts +1 -0
- package/dist/preview/sections/links.js +8 -0
- package/dist/preview/sections/list.d.ts +1 -0
- package/dist/preview/sections/list.js +119 -0
- package/dist/preview/sections/media.d.ts +1 -0
- package/dist/preview/sections/media.js +90 -0
- package/dist/preview/sections/menu.d.ts +1 -0
- package/dist/preview/sections/menu.js +46 -0
- package/dist/preview/sections/navigation.d.ts +1 -0
- package/dist/preview/sections/navigation.js +20 -0
- package/dist/preview/sections/selection.d.ts +1 -0
- package/dist/preview/sections/selection.js +33 -0
- package/dist/preview/sections/sidebar.d.ts +1 -0
- package/dist/preview/sections/sidebar.js +45 -0
- package/dist/preview/sections/skeleton.d.ts +1 -0
- package/dist/preview/sections/skeleton.js +5 -0
- package/dist/preview/sections/tabs.d.ts +1 -0
- package/dist/preview/sections/tabs.js +24 -0
- package/dist/preview/sections/text-fields.d.ts +1 -0
- package/dist/preview/sections/text-fields.js +75 -0
- package/dist/preview/sections/toast.d.ts +2 -0
- package/dist/preview/sections/toast.js +28 -0
- package/dist/preview/specimens.js +1 -1
- package/dist/progress-bar.d.ts +7 -4
- package/dist/progress-bar.js +2 -2
- package/dist/rows.d.ts +23 -0
- package/dist/rows.js +67 -0
- package/dist/segmented-control.d.ts +1 -1
- package/dist/segmented-control.js +1 -1
- package/dist/select.d.ts +22 -0
- package/dist/select.js +7 -0
- package/dist/switch.d.ts +1 -1
- package/dist/switch.js +2 -1
- package/dist/table.d.ts +62 -0
- package/dist/table.js +25 -0
- package/dist/theme-scope.d.ts +6 -4
- package/dist/theme-scope.js +21 -15
- package/dist/time-picker.d.ts +57 -0
- package/dist/time-picker.js +53 -0
- package/dist/toast-queue.d.ts +40 -0
- package/dist/toast-queue.js +17 -0
- package/dist/toast.d.ts +1 -1
- package/dist/toast.js +1 -1
- package/package.json +2 -2
- package/dist/preview/sections.d.ts +0 -20
- package/dist/preview/sections.js +0 -517
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import { el, keep, row, ui } from "../kit.js";
|
|
2
|
+
const chooses = (chosen) => () => ({ chosen });
|
|
3
|
+
export const menu = () => [
|
|
4
|
+
row("menu", el("span", { class: "flex" }, ui.Menu({
|
|
5
|
+
label: "Report actions",
|
|
6
|
+
trigger: ui.Button({ iconEnd: "chevron-down" }, "Actions"),
|
|
7
|
+
items: [
|
|
8
|
+
{ label: "Rename", icon: "pencil", onSelect: chooses("Rename") },
|
|
9
|
+
{ label: "Duplicate", icon: "copy", onSelect: chooses("Duplicate") },
|
|
10
|
+
{ label: "Share", icon: "share-2", onSelect: keep, disabled: true },
|
|
11
|
+
"separator",
|
|
12
|
+
{
|
|
13
|
+
label: "Comfortable",
|
|
14
|
+
icon: "list",
|
|
15
|
+
selected: (state) => state.density === "comfortable",
|
|
16
|
+
onSelect: () => ({ density: "comfortable" }),
|
|
17
|
+
},
|
|
18
|
+
{
|
|
19
|
+
label: "Compact",
|
|
20
|
+
icon: "layout-grid",
|
|
21
|
+
selected: (state) => state.density === "compact",
|
|
22
|
+
onSelect: () => ({ density: "compact" }),
|
|
23
|
+
},
|
|
24
|
+
"separator",
|
|
25
|
+
{ label: "Delete", icon: "trash", danger: true, onSelect: chooses("Delete") },
|
|
26
|
+
],
|
|
27
|
+
})), ui.Menu({
|
|
28
|
+
label: "More actions",
|
|
29
|
+
align: "end",
|
|
30
|
+
trigger: ui.IconButton({ icon: "ellipsis", label: "More actions", variant: "secondary" }),
|
|
31
|
+
items: [
|
|
32
|
+
{ label: "Copy the link", onSelect: chooses("Copy the link") },
|
|
33
|
+
{ label: "Open in a new window", onSelect: chooses("Open in a new window") },
|
|
34
|
+
],
|
|
35
|
+
}), ui.Text({ variant: "detail", tone: "secondary", as: "span" }, (state) => state.chosen, " Density: ", (state) => state.density, ".")),
|
|
36
|
+
row("popover", ui.Popover({
|
|
37
|
+
title: "Share the report",
|
|
38
|
+
trigger: ui.Button({ iconStart: "share-2" }, "Share"),
|
|
39
|
+
open: (state) => state.sharing,
|
|
40
|
+
onOpenChange: (_, open) => ({ sharing: open }),
|
|
41
|
+
}, ui.Text({ variant: "detail", tone: "secondary" }, "Everyone with the link can read the report. No one can change it."), ui.Button({ variant: "primary", onPress: () => ({ sharing: false, chosen: "The link is copied." }) }, "Copy the link")), ui.Popover({
|
|
42
|
+
title: "Due dates",
|
|
43
|
+
placement: "top",
|
|
44
|
+
trigger: ui.IconButton({ icon: "info", label: "About due dates", variant: "secondary" }),
|
|
45
|
+
}, ui.Text({ variant: "detail", tone: "secondary" }, "A report is due at the end of the Friday it is for."))),
|
|
46
|
+
];
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const navigation: () => import("../model.ts").PreviewNode<import("../kit.ts").DesignState>[];
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { bind, el, keep, row, ui } from "../kit.js";
|
|
2
|
+
const TRAIL = [
|
|
3
|
+
{ label: "Home", href: "#navigation" },
|
|
4
|
+
{ label: "Projects", href: "#navigation" },
|
|
5
|
+
{ label: "Website redesign" },
|
|
6
|
+
];
|
|
7
|
+
export const navigation = () => [
|
|
8
|
+
row("breadcrumb", ui.Breadcrumb({ items: TRAIL })),
|
|
9
|
+
row("wrapping", el("div", { class: "max-w-56" }, ui.Breadcrumb({
|
|
10
|
+
items: [
|
|
11
|
+
{ label: "Home", href: "#navigation" },
|
|
12
|
+
{ label: "Settings", href: "#navigation" },
|
|
13
|
+
{ label: "Notifications", href: "#navigation" },
|
|
14
|
+
{ label: "Email and messages" },
|
|
15
|
+
],
|
|
16
|
+
}))),
|
|
17
|
+
row("pagination", ui.Pagination({ count: 12, ...bind("results") })),
|
|
18
|
+
row("near the end", ui.Pagination({ count: 12, value: 11, onChange: keep })),
|
|
19
|
+
row("few pages", ui.Pagination({ count: 3, value: 1, onChange: keep })),
|
|
20
|
+
];
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const selection: () => import("../model.ts").PreviewNode<import("../kit.ts").DesignState>[];
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import { bind, el, keep, row, ui } from "../kit.js";
|
|
2
|
+
const VIEWS = [
|
|
3
|
+
{ value: "day", label: "Day" },
|
|
4
|
+
{ value: "week", label: "Week" },
|
|
5
|
+
{ value: "month", label: "Month" },
|
|
6
|
+
];
|
|
7
|
+
const DELIVERY = [
|
|
8
|
+
{ value: "standard", label: "Standard", description: "Three to five working days. Free." },
|
|
9
|
+
{ value: "express", label: "Express", description: "The next working day. 9 euros." },
|
|
10
|
+
{ value: "pickup", label: "Pick up in a store" },
|
|
11
|
+
];
|
|
12
|
+
const SIZES_OF_SHIRT = [
|
|
13
|
+
{ value: "s", label: "Small" },
|
|
14
|
+
{ value: "m", label: "Medium" },
|
|
15
|
+
{ value: "l", label: "Large" },
|
|
16
|
+
];
|
|
17
|
+
export const selection = () => [
|
|
18
|
+
row("switch", ui.Switch({ label: "Notifications", ...bind("notifications", "checked") }), ui.Switch({ checked: false, onChange: keep, label: "Off" }), ui.Switch({ checked: true, onChange: keep, label: "Locked", disabled: true })),
|
|
19
|
+
row("checkbox", ui.Checkbox({ label: "Remember me", ...bind("agreed", "checked") }), ui.Checkbox({ checked: false, onChange: keep, label: "Unchecked" }), ui.Checkbox({ checked: false, indeterminate: true, onChange: keep, label: "Some selected" }), ui.Checkbox({ checked: true, onChange: keep, label: "Locked", disabled: true })),
|
|
20
|
+
row("segmented", ui.SegmentedControl({ options: VIEWS, "aria-label": "Calendar view", ...bind("view") })),
|
|
21
|
+
el("div", { class: "grid gap-6 sm:grid-cols-3" }, ui.RadioGroup({ label: "Delivery", options: DELIVERY, ...bind("delivery") }), ui.RadioGroup({
|
|
22
|
+
label: "Size",
|
|
23
|
+
options: SIZES_OF_SHIRT,
|
|
24
|
+
...bind("shirt"),
|
|
25
|
+
error: (state) => (state.shirt === undefined ? "Choose a size to continue." : undefined),
|
|
26
|
+
}), ui.RadioGroup({
|
|
27
|
+
label: "Region, locked",
|
|
28
|
+
options: DELIVERY,
|
|
29
|
+
value: "express",
|
|
30
|
+
onChange: keep,
|
|
31
|
+
disabled: true,
|
|
32
|
+
})),
|
|
33
|
+
];
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const sidebar: () => import("../model.ts").PreviewNode<import("../kit.ts").DesignState>[];
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import { PORTRAIT } from "../fixtures.js";
|
|
2
|
+
import { bind, el, ui } from "../kit.js";
|
|
3
|
+
const PLACES = [
|
|
4
|
+
{
|
|
5
|
+
items: [
|
|
6
|
+
{ value: "home", label: "Home", icon: "house" },
|
|
7
|
+
{ value: "messages", label: "Messages", icon: "message-square", count: 12 },
|
|
8
|
+
{ value: "activity", label: "Activity", icon: "bell", count: 3 },
|
|
9
|
+
],
|
|
10
|
+
},
|
|
11
|
+
{
|
|
12
|
+
title: "Library",
|
|
13
|
+
items: [
|
|
14
|
+
{ value: "saved", label: "Saved", icon: "bookmark", count: 128 },
|
|
15
|
+
{ value: "starred", label: "Starred", icon: "star" },
|
|
16
|
+
{ value: "liked", label: "Liked", icon: "heart" },
|
|
17
|
+
],
|
|
18
|
+
},
|
|
19
|
+
{
|
|
20
|
+
title: "Workspace",
|
|
21
|
+
items: [
|
|
22
|
+
{ value: "members", label: "Members", icon: "users" },
|
|
23
|
+
{ value: "settings", label: "Settings", icon: "settings" },
|
|
24
|
+
],
|
|
25
|
+
},
|
|
26
|
+
];
|
|
27
|
+
const placeLabel = (place) => PLACES.flatMap((section) => section.items).find((item) => item.value === place)?.label ?? place;
|
|
28
|
+
export const sidebar = () => [
|
|
29
|
+
el("div", { class: "grid gap-4 sm:grid-cols-2" }, ...[false, true].map((collapsed) => el("div", {
|
|
30
|
+
class: "flex h-[28rem] overflow-hidden rounded-xds-md border border-xds-border-default",
|
|
31
|
+
}, ui.Sidebar({
|
|
32
|
+
label: collapsed ? "Workspace, collapsed" : "Workspace",
|
|
33
|
+
sections: PLACES,
|
|
34
|
+
...bind("place"),
|
|
35
|
+
collapsed,
|
|
36
|
+
header: el("div", {
|
|
37
|
+
class: `flex h-xds-control-md items-center gap-2 ${collapsed ? "justify-center" : "px-2"}`,
|
|
38
|
+
}, el("span", {
|
|
39
|
+
class: "flex size-xds-avatar-md items-center justify-center rounded-xds-md bg-xds-accent-default text-xds-text-on-accent",
|
|
40
|
+
}, ui.Icon({ name: "sparkles", size: "sm" })), ...(collapsed ? [] : [ui.Text({ variant: "label", as: "span" }, "Xds")])),
|
|
41
|
+
footer: el("div", { class: `flex items-center gap-2 py-1 ${collapsed ? "justify-center" : "px-2"}` }, ui.Avatar({ name: "Ada Lovelace", src: PORTRAIT, size: "sm" }), ...(collapsed ? [] : [ui.Text({ variant: "detail", as: "span" }, "Ada Lovelace")])),
|
|
42
|
+
}), el("div", { class: "flex min-w-0 flex-1 flex-col gap-1 p-4" }, ui.Text({ variant: "heading", as: "span" }, (state) => placeLabel(state.place)), ui.Text({ variant: "detail", tone: "secondary", as: "span" }, collapsed
|
|
43
|
+
? "Rest the pointer on an icon, or focus it, for its name."
|
|
44
|
+
: "The page of the current place."))))),
|
|
45
|
+
];
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const skeleton: () => import("../model.ts").PreviewNode<import("../kit.ts").DesignState>[];
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import { el, row, ui } from "../kit.js";
|
|
2
|
+
export const skeleton = () => [
|
|
3
|
+
row("shape", el("div", { class: "flex w-48 flex-col gap-2" }, ui.Skeleton({}), ui.Skeleton({ width: "60%" })), ui.Skeleton({ shape: "rect", width: 96, height: 64 }), ui.Skeleton({ shape: "circle", width: 40 })),
|
|
4
|
+
ui.Card({ class: "max-w-sm", flush: true }, el("div", { role: "status", "aria-label": "Loading the report", class: "flex flex-col" }, ui.Skeleton({ shape: "rect", height: 128 }), el("div", { class: "flex items-center gap-3 p-4" }, ui.Skeleton({ shape: "circle", width: 40 }), el("div", { class: "flex flex-1 flex-col gap-2" }, ui.Skeleton({ width: "70%" }), ui.Skeleton({ width: "40%" }))))),
|
|
5
|
+
];
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const tabs: () => import("../model.ts").PreviewNode<import("../kit.ts").DesignState>[];
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { bind, el, ui } from "../kit.js";
|
|
2
|
+
const PAGES = [
|
|
3
|
+
{ value: "overview", label: "Overview", icon: "house" },
|
|
4
|
+
{ value: "activity", label: "Activity", icon: "bell" },
|
|
5
|
+
{ value: "members", label: "Members", icon: "users" },
|
|
6
|
+
{ value: "billing", label: "Billing", icon: "credit-card" },
|
|
7
|
+
{ value: "settings", label: "Settings", icon: "settings" },
|
|
8
|
+
];
|
|
9
|
+
export const tabs = () => [
|
|
10
|
+
ui.Tabs({ items: PAGES, label: "Workspace pages", ...bind("page") }),
|
|
11
|
+
ui.Tabs({
|
|
12
|
+
items: PAGES.map(({ value, label }) => ({ value, label })),
|
|
13
|
+
label: "Workspace pages, without icons",
|
|
14
|
+
...bind("page"),
|
|
15
|
+
}),
|
|
16
|
+
ui.Tabs({
|
|
17
|
+
items: PAGES.slice(0, 3),
|
|
18
|
+
label: "Workspace pages, full width",
|
|
19
|
+
...bind("page"),
|
|
20
|
+
value: (state) => state.page === "billing" || state.page === "settings" ? "overview" : state.page,
|
|
21
|
+
fullWidth: true,
|
|
22
|
+
}),
|
|
23
|
+
el("div", { class: "max-w-xs" }, ui.Tabs({ items: PAGES, label: "Workspace pages, scrolling", ...bind("page") })),
|
|
24
|
+
];
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const textFields: () => import("../model.ts").PreviewNode<import("../kit.ts").DesignState>[];
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
import { bind, el, keep, toggle, ui } from "../kit.js";
|
|
2
|
+
export const textFields = () => [
|
|
3
|
+
el("div", { class: "grid gap-4 sm:grid-cols-2" }, ui.TextField({
|
|
4
|
+
label: "Email",
|
|
5
|
+
placeholder: "name@example.com",
|
|
6
|
+
description: "We send the sign-in code to this address.",
|
|
7
|
+
...bind("email"),
|
|
8
|
+
}), ui.TextField({ label: "Project name", value: "Weekly report", onChange: keep, required: true }), ui.TextField({
|
|
9
|
+
label: "Sign-in code",
|
|
10
|
+
value: "12345",
|
|
11
|
+
onChange: keep,
|
|
12
|
+
error: "That code is wrong or has expired.",
|
|
13
|
+
}), ui.TextField({ label: "Organization", value: "Xds Inc.", onChange: keep, disabled: true }), ui.TextField({
|
|
14
|
+
label: "Search",
|
|
15
|
+
placeholder: "Projects, people, files",
|
|
16
|
+
leading: ui.Icon({ name: "search", size: "sm" }),
|
|
17
|
+
...bind("query"),
|
|
18
|
+
}), ui.TextField({
|
|
19
|
+
label: "Weight",
|
|
20
|
+
inputMode: "decimal",
|
|
21
|
+
value: "72.5",
|
|
22
|
+
onChange: keep,
|
|
23
|
+
trailing: ui.Text({ variant: "detail", tone: "inherit", as: "span" }, "kg"),
|
|
24
|
+
}), ui.TextField({
|
|
25
|
+
label: "Password",
|
|
26
|
+
type: (state) => (state.revealed ? "text" : "password"),
|
|
27
|
+
leading: ui.Icon({ name: "lock", size: "sm" }),
|
|
28
|
+
trailing: ui.Button({
|
|
29
|
+
variant: "ghost",
|
|
30
|
+
size: "sm",
|
|
31
|
+
iconStart: (state) => (state.revealed ? "eye-off" : "eye"),
|
|
32
|
+
"aria-label": (state) => (state.revealed ? "Hide the password" : "Show the password"),
|
|
33
|
+
onPress: toggle("revealed"),
|
|
34
|
+
}),
|
|
35
|
+
...bind("secret"),
|
|
36
|
+
}), ui.TextField({
|
|
37
|
+
label: "Promo code",
|
|
38
|
+
leading: ui.Icon({ name: "tag", size: "sm" }),
|
|
39
|
+
value: "SPRING",
|
|
40
|
+
onChange: keep,
|
|
41
|
+
error: "That code has expired.",
|
|
42
|
+
}), ui.TextField({ label: "Notes", multiline: true, ...bind("notes") }), ui.TextField({
|
|
43
|
+
label: "Bio",
|
|
44
|
+
description: "Shown on your profile.",
|
|
45
|
+
multiline: true,
|
|
46
|
+
maxLength: 80,
|
|
47
|
+
...bind("bio"),
|
|
48
|
+
}), ui.TextField({
|
|
49
|
+
label: "Message",
|
|
50
|
+
placeholder: "Write a reply",
|
|
51
|
+
multiline: true,
|
|
52
|
+
rows: 2,
|
|
53
|
+
leading: ui.Icon({ name: "message-square", size: "sm" }),
|
|
54
|
+
value: "",
|
|
55
|
+
onChange: keep,
|
|
56
|
+
}), ui.TextField({
|
|
57
|
+
label: "Display name",
|
|
58
|
+
maxLength: 12,
|
|
59
|
+
value: "Ada Lovelace",
|
|
60
|
+
onChange: keep,
|
|
61
|
+
error: "Use 12 characters or fewer, without spaces.",
|
|
62
|
+
})),
|
|
63
|
+
el("div", { class: "grid gap-4 sm:grid-cols-2" }, ui.SearchField({
|
|
64
|
+
label: "Search projects",
|
|
65
|
+
placeholder: "Search projects",
|
|
66
|
+
...bind("search"),
|
|
67
|
+
onSubmit: (_, submitted) => ({ submitted }),
|
|
68
|
+
}), ui.SearchField({ label: "Search people", value: "Ada Lovelace", onChange: keep }), ui.SearchField({
|
|
69
|
+
label: "Search files",
|
|
70
|
+
placeholder: "Unavailable offline",
|
|
71
|
+
value: "",
|
|
72
|
+
onChange: keep,
|
|
73
|
+
disabled: true,
|
|
74
|
+
}), ui.Text({ variant: "detail", tone: "secondary", as: "span", class: "self-center" }, (state) => state.submitted ? `Searched for “${state.submitted}”.` : "Enter searches, Escape clears.")),
|
|
75
|
+
];
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { queueToast } from "../../toast-queue.js";
|
|
2
|
+
import { row, ui } from "../kit.js";
|
|
3
|
+
const REPORTS = ["weekly", "monthly", "yearly"];
|
|
4
|
+
export const toast = (open) => [
|
|
5
|
+
row("toast", ui.Button({ onPress: () => ({ deleted: true, toast: true }) }, "Delete a draft"), ui.Text({ variant: "detail", tone: "secondary", as: "span" }, (state) => state.deleted ? "The draft is deleted." : "The draft is there.")),
|
|
6
|
+
ui.Toast({
|
|
7
|
+
open: (state) => state.toast,
|
|
8
|
+
onClose: () => ({ toast: false }),
|
|
9
|
+
message: "The draft was deleted.",
|
|
10
|
+
action: { label: "Undo", onPress: () => ({ deleted: false }) },
|
|
11
|
+
...(open === "toast" ? { duration: 0 } : {}),
|
|
12
|
+
}),
|
|
13
|
+
row("queue", ui.Button({
|
|
14
|
+
onPress: (state) => ({
|
|
15
|
+
queued: REPORTS.reduce((queued, report, index) => queueToast(queued, {
|
|
16
|
+
id: state.archived + index,
|
|
17
|
+
message: `The ${report} report is archived.`,
|
|
18
|
+
}), state.queued),
|
|
19
|
+
archived: state.archived + REPORTS.length,
|
|
20
|
+
}),
|
|
21
|
+
}, "Archive three reports"), ui.Text({ variant: "detail", tone: "secondary", as: "span" }, (state) => state.queued.length === 0
|
|
22
|
+
? "Nothing to show."
|
|
23
|
+
: `${state.queued.length} to show, one at a time.`)),
|
|
24
|
+
ui.ToastQueue({
|
|
25
|
+
toasts: (state) => state.queued,
|
|
26
|
+
onClose: (state, id) => ({ queued: state.queued.filter((toast) => toast.id !== id) }),
|
|
27
|
+
}),
|
|
28
|
+
];
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { colors, icons, radius, size, space, typography } from "@xds/tokens";
|
|
2
2
|
import { el, kebab, row, ui } from "./kit.js";
|
|
3
|
-
const COMPONENT_COLORS = /^(button|field|badge|banner|card|switch|checkbox|radio|segmented|avatar|progress|slider|listRow|topBar|tabBar|sheet|chip|tabs|menu|datePicker|dialog|toast|tooltip|skeleton|thumbnail|sidebar|emptyState|accordion)/;
|
|
3
|
+
const COMPONENT_COLORS = /^(breadcrumb|button|field|badge|banner|card|switch|checkbox|radio|segmented|avatar|progress|slider|listRow|topBar|tabBar|sheet|chip|link|tabs|menu|datePicker|dialog|toast|tooltip|skeleton|thumbnail|sidebar|emptyState|accordion)/;
|
|
4
4
|
const COLOR_GROUPS = Object.entries(Object.groupBy(Object.keys(colors.light).filter((name) => !COMPONENT_COLORS.test(name)), (name) => kebab(name).split("-")[0] ?? name));
|
|
5
5
|
const ICON_SIZES = ["xs", "sm", "md", "lg", "xl"];
|
|
6
6
|
const FILLABLE_ICONS = ["heart", "star", "bookmark", "thumbs-up", "bell"];
|
package/dist/progress-bar.d.ts
CHANGED
|
@@ -7,7 +7,10 @@ export type ProgressBarBaseProps = {
|
|
|
7
7
|
};
|
|
8
8
|
/** The whole percentage a value from 0 to 1 stands for, clamped to 0 to 100. */
|
|
9
9
|
export declare function progressPercent(value: number): number;
|
|
10
|
-
/**
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
10
|
+
/**
|
|
11
|
+
* The track. It has the progress bar role and holds the fill. Forced colors fill it in the page's
|
|
12
|
+
* color, so it takes an edge in the text's.
|
|
13
|
+
*/
|
|
14
|
+
export declare const progressBarClass = "h-xds-progress w-full overflow-hidden rounded-full bg-xds-progress-track forced-colors:border forced-colors:border-[CanvasText]";
|
|
15
|
+
/** The fill, whose width is the percentage: the system's highlight in forced colors. */
|
|
16
|
+
export declare const progressBarFillClass = "h-full rounded-full bg-xds-progress-fill transition-[width] duration-(--xds-motion-duration-normal) motion-reduce:transition-none forced-colors:bg-[Highlight]";
|
package/dist/progress-bar.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
export function progressPercent(value) {
|
|
2
2
|
return Math.round(Math.min(1, Math.max(0, value)) * 100);
|
|
3
3
|
}
|
|
4
|
-
export const progressBarClass = "h-xds-progress w-full overflow-hidden rounded-full bg-xds-progress-track";
|
|
5
|
-
export const progressBarFillClass = "h-full rounded-full bg-xds-progress-fill transition-[width] duration-(--xds-motion-duration-normal) motion-reduce:transition-none";
|
|
4
|
+
export const progressBarClass = "h-xds-progress w-full overflow-hidden rounded-full bg-xds-progress-track forced-colors:border forced-colors:border-[CanvasText]";
|
|
5
|
+
export const progressBarFillClass = "h-full rounded-full bg-xds-progress-fill transition-[width] duration-(--xds-motion-duration-normal) motion-reduce:transition-none forced-colors:bg-[Highlight]";
|
package/dist/rows.d.ts
ADDED
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
type Props = object;
|
|
2
|
+
/**
|
|
3
|
+
* Whether two sets of the props that a Zag machine gives one item draw the same: the same
|
|
4
|
+
* attributes, and a handler wherever the other has one. Zag makes the handlers anew each time,
|
|
5
|
+
* but they close over nothing that the item's attributes do not show (its value, whether it is
|
|
6
|
+
* disabled, highlighted or chosen) and send to the machine, which stays the same, so the earlier
|
|
7
|
+
* ones do what the later ones would.
|
|
8
|
+
*/
|
|
9
|
+
export declare function sameItemProps(a: Props, b: Props): boolean;
|
|
10
|
+
/**
|
|
11
|
+
* Whether a row drawn with props `a` draws the same with `b`: each prop the same, where an
|
|
12
|
+
* object, such as the props Zag gives one of the row's parts or the option the row shows, is
|
|
13
|
+
* compared by `sameItemProps`. For a row whose props are what it draws, with no handler of its
|
|
14
|
+
* own: a function in them is taken to do the same as the one before it.
|
|
15
|
+
*/
|
|
16
|
+
export declare function sameRowProps(a: Props, b: Props): boolean;
|
|
17
|
+
/**
|
|
18
|
+
* For a framework that compares what a row is given by identity: hands back the props last given
|
|
19
|
+
* under `key` for as long as the next ones draw the same (`sameItemProps`), so the row's
|
|
20
|
+
* attributes and handlers stay as they are. One cache for one list, kept while the list is.
|
|
21
|
+
*/
|
|
22
|
+
export declare function createItemPropsCache(): <T extends Props>(key: string, props: T) => T;
|
|
23
|
+
export {};
|
package/dist/rows.js
ADDED
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
function values(props) {
|
|
2
|
+
return props;
|
|
3
|
+
}
|
|
4
|
+
export function sameItemProps(a, b) {
|
|
5
|
+
if (a === b)
|
|
6
|
+
return true;
|
|
7
|
+
const before = values(a);
|
|
8
|
+
const after = values(b);
|
|
9
|
+
let count = 0;
|
|
10
|
+
for (const key in before) {
|
|
11
|
+
count += 1;
|
|
12
|
+
const was = before[key];
|
|
13
|
+
const is = after[key];
|
|
14
|
+
if (was === is) {
|
|
15
|
+
if (was === undefined && !(key in after))
|
|
16
|
+
return false;
|
|
17
|
+
continue;
|
|
18
|
+
}
|
|
19
|
+
if (typeof was === "function" && typeof is === "function")
|
|
20
|
+
continue;
|
|
21
|
+
if (!Object.is(was, is))
|
|
22
|
+
return false;
|
|
23
|
+
}
|
|
24
|
+
for (const _ in after)
|
|
25
|
+
count -= 1;
|
|
26
|
+
return count === 0;
|
|
27
|
+
}
|
|
28
|
+
function isPlainObject(value) {
|
|
29
|
+
if (typeof value !== "object" || value === null)
|
|
30
|
+
return false;
|
|
31
|
+
const prototype = Object.getPrototypeOf(value);
|
|
32
|
+
return prototype === Object.prototype || prototype === null;
|
|
33
|
+
}
|
|
34
|
+
export function sameRowProps(a, b) {
|
|
35
|
+
if (a === b)
|
|
36
|
+
return true;
|
|
37
|
+
const before = values(a);
|
|
38
|
+
const after = values(b);
|
|
39
|
+
let count = 0;
|
|
40
|
+
for (const key in before) {
|
|
41
|
+
count += 1;
|
|
42
|
+
const was = before[key];
|
|
43
|
+
const is = after[key];
|
|
44
|
+
if (was === is) {
|
|
45
|
+
if (was === undefined && !(key in after))
|
|
46
|
+
return false;
|
|
47
|
+
continue;
|
|
48
|
+
}
|
|
49
|
+
if (isPlainObject(was) && isPlainObject(is) && sameItemProps(was, is))
|
|
50
|
+
continue;
|
|
51
|
+
if (!Object.is(was, is))
|
|
52
|
+
return false;
|
|
53
|
+
}
|
|
54
|
+
for (const _ in after)
|
|
55
|
+
count -= 1;
|
|
56
|
+
return count === 0;
|
|
57
|
+
}
|
|
58
|
+
export function createItemPropsCache() {
|
|
59
|
+
const last = new Map();
|
|
60
|
+
return (key, props) => {
|
|
61
|
+
const before = last.get(key);
|
|
62
|
+
if (before !== undefined && sameItemProps(before, props))
|
|
63
|
+
return before;
|
|
64
|
+
last.set(key, props);
|
|
65
|
+
return props;
|
|
66
|
+
};
|
|
67
|
+
}
|
|
@@ -21,4 +21,4 @@ export declare function segmentedControlOptionClass(fullWidth?: boolean): string
|
|
|
21
21
|
* The segment drawn beside the hidden radio button. The border is there on every segment,
|
|
22
22
|
* transparent until selected, so selecting does not move the text.
|
|
23
23
|
*/
|
|
24
|
-
export declare const segmentedControlSegmentClass = "flex w-full items-center justify-center whitespace-nowrap rounded-[calc(var(--xds-radius-md)-2px)] border border-transparent px-4 text-xds-label text-xds-segmented-text peer-checked:border-xds-segmented-selected-border peer-checked:bg-xds-segmented-selected-background peer-checked:text-xds-segmented-selected-text peer-checked:shadow-xds-subtle peer-focus-visible:outline-solid peer-focus-visible:outline-(length:--xds-focus-width) peer-focus-visible:outline-offset-(--xds-focus-offset) peer-focus-visible:outline-xds-border-focus";
|
|
24
|
+
export declare const segmentedControlSegmentClass = "flex w-full items-center justify-center whitespace-nowrap rounded-[calc(var(--xds-radius-md)-2px)] border border-transparent px-4 text-xds-label text-xds-segmented-text peer-checked:border-xds-segmented-selected-border peer-checked:bg-xds-segmented-selected-background peer-checked:text-xds-segmented-selected-text peer-checked:shadow-xds-subtle forced-colors:peer-checked:bg-[Highlight] forced-colors:peer-checked:text-[HighlightText] forced-colors:peer-checked:forced-color-adjust-none peer-focus-visible:outline-solid peer-focus-visible:outline-(length:--xds-focus-width) peer-focus-visible:outline-offset-(--xds-focus-offset) peer-focus-visible:outline-xds-border-focus";
|
|
@@ -5,4 +5,4 @@ export function segmentedControlClass(fullWidth = false) {
|
|
|
5
5
|
export function segmentedControlOptionClass(fullWidth = false) {
|
|
6
6
|
return `relative flex cursor-pointer ${fullWidth ? "flex-1" : ""}`;
|
|
7
7
|
}
|
|
8
|
-
export const segmentedControlSegmentClass = `flex w-full items-center justify-center whitespace-nowrap rounded-[calc(var(--xds-radius-md)-2px)] border border-transparent px-4 text-xds-label text-xds-segmented-text peer-checked:border-xds-segmented-selected-border peer-checked:bg-xds-segmented-selected-background peer-checked:text-xds-segmented-selected-text peer-checked:shadow-xds-subtle ${PEER_FOCUS}`;
|
|
8
|
+
export const segmentedControlSegmentClass = `flex w-full items-center justify-center whitespace-nowrap rounded-[calc(var(--xds-radius-md)-2px)] border border-transparent px-4 text-xds-label text-xds-segmented-text peer-checked:border-xds-segmented-selected-border peer-checked:bg-xds-segmented-selected-background peer-checked:text-xds-segmented-selected-text peer-checked:shadow-xds-subtle forced-colors:peer-checked:bg-[Highlight] forced-colors:peer-checked:text-[HighlightText] forced-colors:peer-checked:forced-color-adjust-none ${PEER_FOCUS}`;
|
package/dist/select.d.ts
CHANGED
|
@@ -26,7 +26,29 @@ export type SelectBaseProps<Value extends string = string> = {
|
|
|
26
26
|
/** The name the choice is submitted under with a form. */
|
|
27
27
|
name?: string;
|
|
28
28
|
disabled?: boolean;
|
|
29
|
+
/**
|
|
30
|
+
* Lets the person choose any number of options, with `values` in place of `value`. The list
|
|
31
|
+
* stays open as options are chosen and unchosen, each chosen one marked with a check, and the
|
|
32
|
+
* field shows their labels in the options' order.
|
|
33
|
+
*/
|
|
34
|
+
multiple?: boolean;
|
|
35
|
+
/**
|
|
36
|
+
* The chosen options of a select with `multiple`. Leave it out for one that keeps its own
|
|
37
|
+
* choice, from `defaultValues`.
|
|
38
|
+
*/
|
|
39
|
+
values?: readonly Value[] | undefined;
|
|
40
|
+
/** The first choice of a select with `multiple` that keeps its own, without `values`. */
|
|
41
|
+
defaultValues?: readonly Value[] | undefined;
|
|
29
42
|
};
|
|
43
|
+
/**
|
|
44
|
+
* What the field of a select with `multiple` shows: the chosen options' labels in the options'
|
|
45
|
+
* order, joined by commas, or `undefined` while none is chosen, for the placeholder. In the
|
|
46
|
+
* options' order, not the order they were chosen in, so the field reads the same however the
|
|
47
|
+
* person got there.
|
|
48
|
+
*/
|
|
49
|
+
export declare function selectedLabels<Value extends string>(options: readonly SelectOption<Value>[], values: readonly Value[]): string | undefined;
|
|
50
|
+
/** `values` in the options' order, which is the order a select with `multiple` reports. */
|
|
51
|
+
export declare function orderedValues<Value extends string>(options: readonly SelectOption<Value>[], values: readonly Value[]): Value[];
|
|
30
52
|
/**
|
|
31
53
|
* The ids of the label and the help line of the option at `index`, under the Select's own id.
|
|
32
54
|
* The option is named by its label alone, as the field shows it, and described by the help.
|
package/dist/select.js
CHANGED
|
@@ -1,3 +1,10 @@
|
|
|
1
|
+
export function selectedLabels(options, values) {
|
|
2
|
+
const chosen = options.filter((option) => values.includes(option.value));
|
|
3
|
+
return chosen.length === 0 ? undefined : chosen.map((option) => option.label).join(", ");
|
|
4
|
+
}
|
|
5
|
+
export function orderedValues(options, values) {
|
|
6
|
+
return options.map((option) => option.value).filter((value) => values.includes(value));
|
|
7
|
+
}
|
|
1
8
|
export function selectOptionIds(id, index) {
|
|
2
9
|
const label = `${id}-option-${index}`;
|
|
3
10
|
return { label, description: `${label}-description` };
|
package/dist/switch.d.ts
CHANGED
|
@@ -17,7 +17,7 @@ export declare const PEER_FOCUS = "peer-focus-visible:outline-solid peer-focus-v
|
|
|
17
17
|
*/
|
|
18
18
|
export declare const switchClass = "relative inline-flex min-h-xds-target-min w-fit cursor-pointer items-center gap-2 has-disabled:cursor-not-allowed";
|
|
19
19
|
/** The track, drawn beside the hidden input. */
|
|
20
|
-
export declare const switchTrackClass = "flex h-xds-switch-height w-xds-switch-width shrink-0 rounded-full bg-xds-switch-track p-0.5 transition-colors duration-(--xds-motion-duration-fast) peer-checked:bg-xds-switch-track-on peer-disabled:bg-xds-switch-disabled-track peer-checked:*:translate-x-[calc(var(--xds-size-switch-width)-var(--xds-size-switch-height))] peer-disabled:*:bg-xds-switch-disabled-thumb peer-focus-visible:outline-solid peer-focus-visible:outline-(length:--xds-focus-width) peer-focus-visible:outline-offset-(--xds-focus-offset) peer-focus-visible:outline-xds-border-focus";
|
|
20
|
+
export declare const switchTrackClass = "flex h-xds-switch-height w-xds-switch-width shrink-0 rounded-full bg-xds-switch-track p-0.5 transition-colors duration-(--xds-motion-duration-fast) peer-checked:bg-xds-switch-track-on peer-disabled:bg-xds-switch-disabled-track peer-checked:*:translate-x-[calc(var(--xds-size-switch-width)-var(--xds-size-switch-height))] peer-disabled:*:bg-xds-switch-disabled-thumb forced-colors:border forced-colors:border-[CanvasText] forced-colors:p-px forced-colors:*:bg-[CanvasText] forced-colors:peer-checked:border-[Highlight] forced-colors:peer-checked:bg-[Highlight] forced-colors:peer-checked:*:bg-[HighlightText] forced-colors:peer-disabled:border-[GrayText] forced-colors:peer-disabled:*:bg-[GrayText] peer-focus-visible:outline-solid peer-focus-visible:outline-(length:--xds-focus-width) peer-focus-visible:outline-offset-(--xds-focus-offset) peer-focus-visible:outline-xds-border-focus";
|
|
21
21
|
/** The thumb inside the track. */
|
|
22
22
|
export declare const switchThumbClass = "aspect-square h-full rounded-full bg-xds-switch-thumb transition-transform duration-(--xds-motion-duration-fast) ease-(--xds-motion-easing-standard) motion-reduce:transition-none";
|
|
23
23
|
/** The visible label after the track, which is also a Checkbox's. */
|
package/dist/switch.js
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
export const PEER_FOCUS = "peer-focus-visible:outline-solid peer-focus-visible:outline-(length:--xds-focus-width) peer-focus-visible:outline-offset-(--xds-focus-offset) peer-focus-visible:outline-xds-border-focus";
|
|
2
2
|
export const switchClass = "relative inline-flex min-h-xds-target-min w-fit cursor-pointer items-center gap-2 has-disabled:cursor-not-allowed";
|
|
3
|
-
|
|
3
|
+
const FORCED_COLORS = "forced-colors:border forced-colors:border-[CanvasText] forced-colors:p-px forced-colors:*:bg-[CanvasText] forced-colors:peer-checked:border-[Highlight] forced-colors:peer-checked:bg-[Highlight] forced-colors:peer-checked:*:bg-[HighlightText] forced-colors:peer-disabled:border-[GrayText] forced-colors:peer-disabled:*:bg-[GrayText]";
|
|
4
|
+
export const switchTrackClass = `flex h-xds-switch-height w-xds-switch-width shrink-0 rounded-full bg-xds-switch-track p-0.5 transition-colors duration-(--xds-motion-duration-fast) peer-checked:bg-xds-switch-track-on peer-disabled:bg-xds-switch-disabled-track peer-checked:*:translate-x-[calc(var(--xds-size-switch-width)-var(--xds-size-switch-height))] peer-disabled:*:bg-xds-switch-disabled-thumb ${FORCED_COLORS} ${PEER_FOCUS}`;
|
|
4
5
|
export const switchThumbClass = "aspect-square h-full rounded-full bg-xds-switch-thumb transition-transform duration-(--xds-motion-duration-fast) ease-(--xds-motion-easing-standard) motion-reduce:transition-none";
|
|
5
6
|
export const switchLabelClass = "text-xds-body text-xds-text-primary peer-disabled:text-xds-text-secondary";
|
package/dist/table.d.ts
ADDED
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
/** A column of a Table. */
|
|
2
|
+
export type TableColumn = {
|
|
3
|
+
/** Names the column, for `sort`. */
|
|
4
|
+
key: string;
|
|
5
|
+
/** The column's header. */
|
|
6
|
+
label: string;
|
|
7
|
+
/** `end` for numbers, so that their digits line up. `start` unless set. */
|
|
8
|
+
align?: "start" | "end";
|
|
9
|
+
/** Its header is a button that asks for the rows sorted by it, through `onSortChange`. */
|
|
10
|
+
sortable?: boolean;
|
|
11
|
+
};
|
|
12
|
+
/** A row of a Table: its values, one for each column, in the columns' order. */
|
|
13
|
+
export type TableRow = {
|
|
14
|
+
/** Tells the row from the others. */
|
|
15
|
+
id: string;
|
|
16
|
+
cells: readonly string[];
|
|
17
|
+
};
|
|
18
|
+
export type SortDirection = "ascending" | "descending";
|
|
19
|
+
/** The column the rows are sorted by, by its `key`, and in which order. */
|
|
20
|
+
export type TableSort = {
|
|
21
|
+
column: string;
|
|
22
|
+
direction: SortDirection;
|
|
23
|
+
};
|
|
24
|
+
/** Table's props in every framework, short of `onSortChange`. */
|
|
25
|
+
export type TableBaseProps = {
|
|
26
|
+
/** Names the table for assistive technology. */
|
|
27
|
+
label: string;
|
|
28
|
+
columns: readonly TableColumn[];
|
|
29
|
+
/** Shown in the order given: the table does not sort them. */
|
|
30
|
+
rows: readonly TableRow[];
|
|
31
|
+
/** The column the app sorted the rows by, which its header shows. */
|
|
32
|
+
sort?: TableSort | undefined;
|
|
33
|
+
/** Said in the table while it has no rows. */
|
|
34
|
+
empty?: string;
|
|
35
|
+
};
|
|
36
|
+
/**
|
|
37
|
+
* The sort a press on a sortable column's header asks for: ascending, or the other way for
|
|
38
|
+
* the column the rows are sorted by already.
|
|
39
|
+
*/
|
|
40
|
+
export declare function nextSort(sort: TableSort | undefined, column: string): TableSort;
|
|
41
|
+
/** The order of a column's rows, or none for a column they are not sorted by. */
|
|
42
|
+
export declare function columnSort(sort: TableSort | undefined, column: string): SortDirection | undefined;
|
|
43
|
+
/**
|
|
44
|
+
* The arrow at the end of a sortable column's header: up while the rows are sorted ascending
|
|
45
|
+
* by it, down while descending, and both ways while they are sorted by another column.
|
|
46
|
+
*/
|
|
47
|
+
export declare function sortIcon(direction: SortDirection | undefined): "arrow-down" | "arrow-up" | "arrow-up-down";
|
|
48
|
+
/**
|
|
49
|
+
* The classes of a Table's parts beside its root, `xds-table`, the frame that scrolls sideways
|
|
50
|
+
* when the columns do not fit: the `<table>`, a header cell, the button of a sortable one, a
|
|
51
|
+
* row, a cell, and the cell that says the table is empty. A cell of a column aligned to the end
|
|
52
|
+
* takes `end` too.
|
|
53
|
+
*/
|
|
54
|
+
export declare const TABLE_PARTS: {
|
|
55
|
+
readonly table: "xds-table__table";
|
|
56
|
+
readonly header: "xds-table__header";
|
|
57
|
+
readonly sort: "xds-table__sort";
|
|
58
|
+
readonly row: "xds-table__row";
|
|
59
|
+
readonly cell: "xds-table__cell";
|
|
60
|
+
readonly empty: "xds-table__empty";
|
|
61
|
+
readonly end: "xds-table__cell--end";
|
|
62
|
+
};
|
package/dist/table.js
ADDED
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
export function nextSort(sort, column) {
|
|
2
|
+
return {
|
|
3
|
+
column,
|
|
4
|
+
direction: sort?.column === column && sort.direction === "ascending" ? "descending" : "ascending",
|
|
5
|
+
};
|
|
6
|
+
}
|
|
7
|
+
export function columnSort(sort, column) {
|
|
8
|
+
return sort?.column === column ? sort.direction : undefined;
|
|
9
|
+
}
|
|
10
|
+
export function sortIcon(direction) {
|
|
11
|
+
return direction === "ascending"
|
|
12
|
+
? "arrow-up"
|
|
13
|
+
: direction === "descending"
|
|
14
|
+
? "arrow-down"
|
|
15
|
+
: "arrow-up-down";
|
|
16
|
+
}
|
|
17
|
+
export const TABLE_PARTS = {
|
|
18
|
+
table: "xds-table__table",
|
|
19
|
+
header: "xds-table__header",
|
|
20
|
+
sort: "xds-table__sort",
|
|
21
|
+
row: "xds-table__row",
|
|
22
|
+
cell: "xds-table__cell",
|
|
23
|
+
empty: "xds-table__empty",
|
|
24
|
+
end: "xds-table__cell--end",
|
|
25
|
+
};
|
package/dist/theme-scope.d.ts
CHANGED
|
@@ -1,15 +1,17 @@
|
|
|
1
1
|
export type ThemeScope = {
|
|
2
2
|
mode?: string;
|
|
3
3
|
theme?: string;
|
|
4
|
+
contrast?: string;
|
|
4
5
|
};
|
|
5
6
|
/**
|
|
6
|
-
* Finds the nearest subtree color mode and
|
|
7
|
-
* on `<html>` because those already inherit into `document.body`.
|
|
7
|
+
* Finds the nearest subtree color mode, theme and contrast attributes around `origin`, ignoring
|
|
8
|
+
* attributes on `<html>` because those already inherit into `document.body`.
|
|
8
9
|
*/
|
|
9
10
|
export declare function readThemeScope(origin: Element | null | undefined): ThemeScope;
|
|
10
11
|
/**
|
|
11
|
-
* Mirrors the nearest subtree `[data-theme]
|
|
12
|
-
* portaled overlay wrapper in `document.body`) and keeps them synchronized
|
|
12
|
+
* Mirrors the nearest subtree `[data-theme]`, `[data-xds-theme]` and `[data-contrast]` onto
|
|
13
|
+
* `target` (typically a portaled overlay wrapper in `document.body`) and keeps them synchronized
|
|
14
|
+
* when ancestors change.
|
|
13
15
|
*/
|
|
14
16
|
export declare function syncThemeScope(origin: Element | null | undefined, target: HTMLElement | null | undefined): () => void;
|
|
15
17
|
/**
|