rift-ds 1.42.0 → 1.43.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/README.md +2 -2
- package/bin/rift-ds.mjs +1 -0
- package/bin/templates/blocks/app/dashboard/page.module.css +2 -2
- package/bin/templates/blocks/app/notifications/Inbox.tsx +13 -45
- package/bin/templates/blocks/app/notifications/page.module.css +5 -0
- package/bin/templates/blocks/app/planner/page.tsx +2 -2
- package/bin/templates/blocks/app/settings/Settings.tsx +4 -4
- package/bin/templates/blocks/components/blocks/AppShell.tsx +13 -18
- package/bin/templates/blocks/components/blocks/notifications.ts +77 -0
- package/bin/templates/blocks/registry.json +5 -0
- package/chat/ChatWidget.js +2 -1
- package/components/AppLayout/AppLayout.css +6 -0
- package/components/AppLayout/AppLayout.d.ts +4 -0
- package/components/AppLayout/AppLayout.js +5 -1
- package/components/AppSidebar/AppSidebar.css +4 -0
- package/components/AppSidebar/AppSidebar.js +2 -0
- package/components/AppToolbar/AppToolbar.d.ts +5 -2
- package/components/AppToolbar/AppToolbar.js +3 -1
- package/components/Chart/AreaChart.js +7 -1
- package/components/Chart/Chart.css +12 -0
- package/components/Chart/LineChart.js +7 -1
- package/components/Chart/RadarChart.js +2 -1
- package/components/Chart/ScatterChart.js +7 -1
- package/components/Chart/StackedBarChart.js +7 -1
- package/components/ChatMessage/ChatMessage.css +6 -0
- package/components/DataTable/DataTable.css +6 -0
- package/components/DataTable/DataTable.js +3 -2
- package/components/Dropdown/Dropdown.js +8 -0
- package/components/EventCalendar/EventCalendar.css +12 -0
- package/components/Input/Input.css +12 -0
- package/components/Inspector/Inspector.css +4 -1
- package/components/NotificationCenter/NotificationCenter.css +136 -27
- package/components/NotificationCenter/NotificationCenter.d.ts +67 -8
- package/components/NotificationCenter/NotificationCenter.js +97 -12
- package/components/Popover/Popover.css +3 -0
- package/components/Popover/Popover.d.ts +1 -1
- package/components/Popover/Popover.js +9 -1
- package/components/QuestionCard/QuestionCard.css +7 -4
- package/components/SegmentedControl/SegmentedControl.css +5 -0
- package/components/Stat/Stat.css +8 -0
- package/components/Table/Table.css +5 -0
- package/components/ThemeToggle/colorMode.d.ts +3 -3
- package/components/Toolbar/Toolbar.d.ts +6 -1
- package/components/Wizard/Wizard.d.ts +8 -3
- package/components/Wizard/Wizard.js +4 -1
- package/components/registry.json +11 -5
- package/components/registry.json.d.ts +11 -5
- package/components/registry.json.js +1 -1
- package/package.json +1 -1
- package/tokens/presets/zest.css +9 -11
- package/tokens/values.d.ts +10 -3
- package/tokens/values.js +11 -5
- package/tokens/values.json.js +1 -1
|
@@ -1,9 +1,11 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import { jsxs, jsx } from "react/jsx-runtime";
|
|
3
|
-
import React, { useState, useId } from "react";
|
|
3
|
+
import React, { useRef, useState, useEffect, useId, useLayoutEffect } from "react";
|
|
4
|
+
import { MOTION_EXIT_SYNC_MS } from "../../tokens/motion.js";
|
|
4
5
|
import { EmptyState } from "../EmptyState/EmptyState.js";
|
|
5
6
|
import { Badge } from "../Badge/Badge.js";
|
|
6
7
|
import { Button } from "../Button/Button.js";
|
|
8
|
+
import { Icon } from "../Icon/Icon.js";
|
|
7
9
|
import { IconButton } from "../IconButton/IconButton.js";
|
|
8
10
|
import { Tabs } from "../Tabs/Tabs.js";
|
|
9
11
|
import { DropdownMenu } from "../DropdownMenu/DropdownMenu.js";
|
|
@@ -24,7 +26,14 @@ const NotificationItem = React.forwardRef(
|
|
|
24
26
|
onSelect,
|
|
25
27
|
href,
|
|
26
28
|
onDismiss,
|
|
27
|
-
|
|
29
|
+
dismissItemLabel = "Dismiss",
|
|
30
|
+
dismissLabel: _dismissLabel,
|
|
31
|
+
onMarkRead,
|
|
32
|
+
markReadLabel = "Mark as read",
|
|
33
|
+
onMarkUnread,
|
|
34
|
+
markUnreadLabel = "Mark as unread",
|
|
35
|
+
menuItems = [],
|
|
36
|
+
optionsLabel = (itemTitle) => `Options for ${itemTitle}`,
|
|
28
37
|
linkComponent,
|
|
29
38
|
className = "",
|
|
30
39
|
children,
|
|
@@ -33,15 +42,59 @@ const NotificationItem = React.forwardRef(
|
|
|
33
42
|
const baseClass = "ds-notification-item";
|
|
34
43
|
const Link = useLinkComponent(linkComponent);
|
|
35
44
|
const interactive = Boolean(href || onSelect);
|
|
36
|
-
const
|
|
37
|
-
|
|
38
|
-
|
|
45
|
+
const rowRef = useRef(null);
|
|
46
|
+
const setRowRef = (node) => {
|
|
47
|
+
rowRef.current = node;
|
|
48
|
+
if (typeof ref === "function") ref(node);
|
|
49
|
+
else if (ref) ref.current = node;
|
|
50
|
+
};
|
|
51
|
+
const [leaving, setLeaving] = useState(false);
|
|
52
|
+
const leaveTimer = useRef(void 0);
|
|
53
|
+
useEffect(() => () => clearTimeout(leaveTimer.current), []);
|
|
54
|
+
const dismiss = () => {
|
|
55
|
+
if (!onDismiss || leaving) return;
|
|
56
|
+
const row = rowRef.current;
|
|
57
|
+
if (row) row.style.setProperty("--ds-notification-item-height", `${row.offsetHeight}px`);
|
|
58
|
+
setLeaving(true);
|
|
59
|
+
leaveTimer.current = setTimeout(onDismiss, MOTION_EXIT_SYNC_MS);
|
|
60
|
+
};
|
|
61
|
+
const lead = [
|
|
62
|
+
...unread && onMarkRead ? [{ label: markReadLabel, icon: "mark_email_read", onClick: onMarkRead }] : [],
|
|
63
|
+
...!unread && onMarkUnread ? [{ label: markUnreadLabel, icon: "mark_email_unread", onClick: onMarkUnread }] : [],
|
|
64
|
+
...menuItems
|
|
65
|
+
];
|
|
66
|
+
const options = [
|
|
67
|
+
...lead,
|
|
68
|
+
...onDismiss ? [
|
|
69
|
+
...lead.length > 0 ? [{ type: "separator" }] : [],
|
|
70
|
+
{ label: dismissItemLabel, icon: "close", onClick: dismiss }
|
|
71
|
+
] : []
|
|
72
|
+
];
|
|
73
|
+
const hasOptions = options.length > 0;
|
|
74
|
+
const classes = [baseClass, unread ? `${baseClass}--unread` : "", interactive ? `${baseClass}--interactive` : "", leaving ? `${baseClass}--leaving` : "", className].filter(Boolean).join(" ");
|
|
75
|
+
return /* @__PURE__ */ jsxs("article", { ...rest, ref: setRowRef, className: classes, children: [
|
|
76
|
+
media && /* @__PURE__ */ jsx("span", { className: `${baseClass}__media`, "aria-hidden": "true", children: typeof media === "string" ? /* @__PURE__ */ jsx(Icon, { name: media, size: "500", tile: true }) : media }),
|
|
39
77
|
/* @__PURE__ */ jsxs("div", { className: `${baseClass}__body`, children: [
|
|
40
78
|
/* @__PURE__ */ jsxs("div", { className: `${baseClass}__top`, children: [
|
|
41
|
-
href ? /* @__PURE__ */ jsx(Link, { href, className: `${baseClass}__title ${baseClass}__open`, onClick: onSelect, children: title }) : onSelect ? /* @__PURE__ */ jsx("button", { type: "button", className: `${baseClass}__title ${baseClass}__open`, onClick: onSelect, children: title }) : /* @__PURE__ */ jsx("span", { className: `${baseClass}__title`, children: title }),
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
79
|
+
href ? /* @__PURE__ */ jsx(Link, { href, className: `${baseClass}__title ${baseClass}__open`, title, onClick: onSelect, children: title }) : onSelect ? /* @__PURE__ */ jsx("button", { type: "button", className: `${baseClass}__title ${baseClass}__open`, title, onClick: onSelect, children: title }) : /* @__PURE__ */ jsx("span", { className: `${baseClass}__title`, title, children: title }),
|
|
80
|
+
(hasOptions || time || unread) && /* @__PURE__ */ jsxs("span", { className: `${baseClass}__end`, children: [
|
|
81
|
+
hasOptions && /* @__PURE__ */ jsx(
|
|
82
|
+
"span",
|
|
83
|
+
{
|
|
84
|
+
className: `${baseClass}__dismiss${time || unread ? ` ${baseClass}__dismiss--over` : ""}`,
|
|
85
|
+
children: /* @__PURE__ */ jsx(
|
|
86
|
+
DropdownMenu,
|
|
87
|
+
{
|
|
88
|
+
align: "end",
|
|
89
|
+
items: options,
|
|
90
|
+
trigger: /* @__PURE__ */ jsx(IconButton, { icon: "more_horiz", label: optionsLabel(title), variant: "tertiary", size: "compact" })
|
|
91
|
+
}
|
|
92
|
+
)
|
|
93
|
+
}
|
|
94
|
+
),
|
|
95
|
+
time && /* @__PURE__ */ jsx("span", { className: `${baseClass}__time`, children: time }),
|
|
96
|
+
unread && /* @__PURE__ */ jsx("span", { className: `${baseClass}__dot`, children: /* @__PURE__ */ jsx("span", { className: "ds-visually-hidden", children: unreadLabel }) })
|
|
97
|
+
] })
|
|
45
98
|
] }),
|
|
46
99
|
children && /* @__PURE__ */ jsx("div", { className: `${baseClass}__text`, children }),
|
|
47
100
|
actions && /* @__PURE__ */ jsx("div", { className: `${baseClass}__actions`, children: actions })
|
|
@@ -63,6 +116,8 @@ const NotificationCenter = React.forwardRef(
|
|
|
63
116
|
tabsLabel,
|
|
64
117
|
onMarkAllRead,
|
|
65
118
|
markAllLabel = "Mark all as read",
|
|
119
|
+
onMarkAllUnread,
|
|
120
|
+
markAllUnreadLabel = "Mark all as unread",
|
|
66
121
|
onClearAll,
|
|
67
122
|
clearAllLabel = "Clear all",
|
|
68
123
|
menuItems = [],
|
|
@@ -81,6 +136,8 @@ const NotificationCenter = React.forwardRef(
|
|
|
81
136
|
seeAllLabel = "See all",
|
|
82
137
|
linkComponent,
|
|
83
138
|
locale: localeProp,
|
|
139
|
+
maxVisibleItems = 6,
|
|
140
|
+
roundMarks = true,
|
|
84
141
|
loading = false,
|
|
85
142
|
loadingLabel = "Loading",
|
|
86
143
|
className = "",
|
|
@@ -105,19 +162,46 @@ const NotificationCenter = React.forwardRef(
|
|
|
105
162
|
onTabChange?.(next);
|
|
106
163
|
};
|
|
107
164
|
const hasItems = React.Children.count(children) > 0;
|
|
165
|
+
const listRef = useRef(null);
|
|
166
|
+
useLayoutEffect(() => {
|
|
167
|
+
const list = listRef.current;
|
|
168
|
+
if (!list) return;
|
|
169
|
+
const measure = () => {
|
|
170
|
+
const rows = list.querySelectorAll(":scope > .ds-notification-item");
|
|
171
|
+
if (loading || !(maxVisibleItems >= 1) || rows.length <= maxVisibleItems) {
|
|
172
|
+
list.style.maxHeight = "";
|
|
173
|
+
return;
|
|
174
|
+
}
|
|
175
|
+
const last = rows[Math.floor(maxVisibleItems) - 1];
|
|
176
|
+
const inset = parseFloat(getComputedStyle(list).paddingBottom) || 0;
|
|
177
|
+
const height = last.getBoundingClientRect().bottom - list.getBoundingClientRect().top + list.scrollTop + inset;
|
|
178
|
+
list.style.maxHeight = `${Math.ceil(height)}px`;
|
|
179
|
+
};
|
|
180
|
+
measure();
|
|
181
|
+
if (typeof ResizeObserver === "undefined") return;
|
|
182
|
+
let width = list.clientWidth;
|
|
183
|
+
const observer = new ResizeObserver(() => {
|
|
184
|
+
if (list.clientWidth === width) return;
|
|
185
|
+
width = list.clientWidth;
|
|
186
|
+
measure();
|
|
187
|
+
});
|
|
188
|
+
observer.observe(list);
|
|
189
|
+
return () => observer.disconnect();
|
|
190
|
+
});
|
|
108
191
|
const options = [
|
|
109
192
|
...onMarkAllRead ? [{ label: markAllLabel, icon: "done_all", onClick: onMarkAllRead, disabled: unreadCount === 0 }] : [],
|
|
193
|
+
...onMarkAllUnread ? [{ label: markAllUnreadLabel, icon: "mark_email_unread", onClick: onMarkAllUnread, disabled: !hasItems }] : [],
|
|
110
194
|
...menuItems,
|
|
111
195
|
...onClearAll ? [
|
|
112
|
-
...onMarkAllRead || menuItems.length > 0 ? [{ type: "separator" }] : [],
|
|
196
|
+
...onMarkAllRead || onMarkAllUnread || menuItems.length > 0 ? [{ type: "separator" }] : [],
|
|
113
197
|
{ label: clearAllLabel, icon: "delete_sweep", onClick: onClearAll, destructive: true, disabled: !hasItems }
|
|
114
198
|
] : []
|
|
115
199
|
];
|
|
116
|
-
const classes = [baseClass, className].filter(Boolean).join(" ");
|
|
200
|
+
const classes = [baseClass, roundMarks ? `${baseClass}--round-marks` : "", className].filter(Boolean).join(" ");
|
|
117
201
|
return /* @__PURE__ */ jsxs("section", { ...rest, ref, className: classes, children: [
|
|
118
202
|
/* @__PURE__ */ jsxs("header", { className: `${baseClass}__header`, children: [
|
|
119
203
|
/* @__PURE__ */ jsxs("div", { className: `${baseClass}__heading`, children: [
|
|
120
|
-
/* @__PURE__ */ jsx("span", { className: `${baseClass}__title`, children: title }),
|
|
204
|
+
/* @__PURE__ */ jsx("span", { className: `${baseClass}__title`, title, children: title }),
|
|
121
205
|
/* @__PURE__ */ jsx("span", { className: hasTabs ? "ds-visually-hidden" : `${baseClass}__unread`, "aria-live": "polite", children: unreadCount !== void 0 && unreadCount > 0 ? hasTabs ? unreadCountLabel(unreadCount) : /* @__PURE__ */ jsx(Badge, { variant: "info", label: unreadCountLabel(unreadCount) }) : null })
|
|
122
206
|
] }),
|
|
123
207
|
options.length > 0 ? /* @__PURE__ */ jsx(
|
|
@@ -147,6 +231,7 @@ const NotificationCenter = React.forwardRef(
|
|
|
147
231
|
/* @__PURE__ */ jsx(
|
|
148
232
|
"div",
|
|
149
233
|
{
|
|
234
|
+
ref: listRef,
|
|
150
235
|
className: `${baseClass}__list`,
|
|
151
236
|
role: hasTabs ? "tabpanel" : void 0,
|
|
152
237
|
id: hasTabs ? panelId : void 0,
|
|
@@ -28,6 +28,9 @@
|
|
|
28
28
|
.ds-popover__panel {
|
|
29
29
|
z-index: var(--layer-dropdown);
|
|
30
30
|
min-width: 200px;
|
|
31
|
+
/* Never wider than the screen less the margin it keeps on both sides: a
|
|
32
|
+
wider panel cannot be shifted back into view, and ran off the far edge. */
|
|
33
|
+
max-width: calc(100vw - 2 * var(--gap-200));
|
|
31
34
|
padding: var(--padding-400); /* 16px */
|
|
32
35
|
border: var(--border-025) solid var(--color-bg-container-border);
|
|
33
36
|
border-radius: var(--radius-200); /* 8px */
|
|
@@ -30,7 +30,7 @@ type PopoverOwnProps = {
|
|
|
30
30
|
/** Callback when open state changes */
|
|
31
31
|
onOpenChange?: (open: boolean) => void;
|
|
32
32
|
/**
|
|
33
|
-
* Legacy accessible-name prop for the trigger and the panel. A native `aria-label` wins when both are passed, and names those two rather than the wrapper;
|
|
33
|
+
* Legacy accessible-name prop for the trigger and the panel. A native `aria-label` wins when both are passed, and names those two rather than the wrapper; a trigger whose own label, `aria-label` or text is not part of it keeps its own name, and the label names the panel alone. With neither, the panel is named "Popover".
|
|
34
34
|
*
|
|
35
35
|
* @deprecated Pass the native `aria-label` attribute instead.
|
|
36
36
|
*/
|
|
@@ -7,6 +7,14 @@ import { MOTION_HOVER_HIDE_DELAY_MS } from "../../tokens/motion.js";
|
|
|
7
7
|
import "./Popover.css";
|
|
8
8
|
const INTERACTIVE_TAGS = /* @__PURE__ */ new Set(["button", "a", "input", "select", "textarea", "summary"]);
|
|
9
9
|
const canCarryPopoverSemantics = (el) => typeof el.type === "string" ? INTERACTIVE_TAGS.has(el.type) : true;
|
|
10
|
+
const keepsOwnName = (el, popoverLabel) => {
|
|
11
|
+
const props = el.props;
|
|
12
|
+
const own = [props.label, props["aria-label"], props.children].find(
|
|
13
|
+
(value) => typeof value === "string" && value.trim() !== "" || typeof value === "number"
|
|
14
|
+
);
|
|
15
|
+
if (own === void 0) return false;
|
|
16
|
+
return !popoverLabel.toLowerCase().includes(String(own).trim().toLowerCase());
|
|
17
|
+
};
|
|
10
18
|
const Popover = React.forwardRef(
|
|
11
19
|
({
|
|
12
20
|
children,
|
|
@@ -102,7 +110,7 @@ const Popover = React.forwardRef(
|
|
|
102
110
|
/* @__PURE__ */ jsx("div", { ref: triggerRef, className: `${baseClass}__trigger`, onClick: handleClick, children: React.isValidElement(children) && canCarryPopoverSemantics(children) ? React.cloneElement(children, {
|
|
103
111
|
"aria-expanded": isOpen,
|
|
104
112
|
"aria-haspopup": "dialog",
|
|
105
|
-
...ariaLabel ? { "aria-label": ariaLabel } : {}
|
|
113
|
+
...ariaLabel && !keepsOwnName(children, ariaLabel) ? { "aria-label": ariaLabel } : {}
|
|
106
114
|
}) : trigger === "click" ? /* @__PURE__ */ jsx(
|
|
107
115
|
"button",
|
|
108
116
|
{
|
|
@@ -335,10 +335,13 @@ button.ds-question-card__option--chosen:hover {
|
|
|
335
335
|
color: var(--color-text-tertiary);
|
|
336
336
|
}
|
|
337
337
|
|
|
338
|
-
/*
|
|
339
|
-
|
|
340
|
-
.
|
|
341
|
-
|
|
338
|
+
/* Plain sits on a surface that brings its own fill and ink, and a theme
|
|
339
|
+
may make that fill a colour the page's text ramp was never measured
|
|
340
|
+
against. So the quiet lines are the surface's own ink, stepped back,
|
|
341
|
+
and stay legible on any bubble. */
|
|
342
|
+
.ds-question-summary--plain .ds-question-summary__prompt,
|
|
343
|
+
.ds-question-summary--plain .ds-question-summary__answer--missing {
|
|
344
|
+
color: color-mix(in srgb, currentColor 84%, transparent);
|
|
342
345
|
}
|
|
343
346
|
|
|
344
347
|
.ds-question-summary__answer {
|
|
@@ -23,6 +23,10 @@
|
|
|
23
23
|
border-radius: calc(var(--radius-pill) + var(--padding-100) + var(--border-025));
|
|
24
24
|
background-color: var(--color-bg-container-primary);
|
|
25
25
|
border: var(--border-025) solid var(--color-bg-container-border);
|
|
26
|
+
/* A grid cell would stretch the track across its column and leave the
|
|
27
|
+
segments at one end: the control hugs its segments unless it is asked
|
|
28
|
+
to fill. */
|
|
29
|
+
justify-self: start;
|
|
26
30
|
}
|
|
27
31
|
|
|
28
32
|
/* ============================================
|
|
@@ -88,6 +92,7 @@
|
|
|
88
92
|
|
|
89
93
|
.ds-segmented-control--full-width {
|
|
90
94
|
width: 100%;
|
|
95
|
+
justify-self: stretch;
|
|
91
96
|
}
|
|
92
97
|
|
|
93
98
|
.ds-segmented-control--full-width .ds-segmented-control__segment {
|
package/components/Stat/Stat.css
CHANGED
|
@@ -27,6 +27,9 @@
|
|
|
27
27
|
font-weight: var(--font-sub-display-weight);
|
|
28
28
|
line-height: var(--font-sub-display-line-height);
|
|
29
29
|
letter-spacing: var(--font-sub-display-letter-spacing);
|
|
30
|
+
/* A reading sits on the baseline and keeps its width as it changes,
|
|
31
|
+
whatever figures the theme's display face draws by default. */
|
|
32
|
+
font-variant-numeric: lining-nums tabular-nums;
|
|
30
33
|
color: var(--color-text-display);
|
|
31
34
|
}
|
|
32
35
|
|
|
@@ -52,6 +55,9 @@
|
|
|
52
55
|
display: flex;
|
|
53
56
|
align-items: center;
|
|
54
57
|
justify-content: space-between;
|
|
58
|
+
/* In a narrow tile the caption drops under the icon rather than running
|
|
59
|
+
past the tile's edge. */
|
|
60
|
+
flex-wrap: wrap;
|
|
55
61
|
gap: var(--gap-200);
|
|
56
62
|
align-self: stretch;
|
|
57
63
|
/* The head sits --gap-300 above the value: the stat's own row gap
|
|
@@ -65,7 +71,9 @@
|
|
|
65
71
|
}
|
|
66
72
|
|
|
67
73
|
.ds-stat__caption {
|
|
74
|
+
min-width: 0;
|
|
68
75
|
margin-inline-start: auto;
|
|
76
|
+
overflow-wrap: anywhere;
|
|
69
77
|
font-family: var(--font-caption-family);
|
|
70
78
|
font-size: var(--font-caption-size);
|
|
71
79
|
font-weight: var(--font-caption-weight);
|
|
@@ -220,6 +220,11 @@
|
|
|
220
220
|
without this the table crushes to the viewport and cells clip. */
|
|
221
221
|
/* The plain table's scroll container: no surface of its own. */
|
|
222
222
|
.ds-table__scroll {
|
|
223
|
+
/* The containing block for anything absolutely placed inside the table (a
|
|
224
|
+
visually hidden column header): without it such a node is placed against
|
|
225
|
+
the page, outside this scroller, and widens the page by the columns that
|
|
226
|
+
are scrolled out of view. */
|
|
227
|
+
position: relative;
|
|
223
228
|
overflow-x: auto;
|
|
224
229
|
max-width: 100%;
|
|
225
230
|
}
|
|
@@ -38,9 +38,9 @@ export type ColorModeScriptOptions = ColorModeOptions & {
|
|
|
38
38
|
* The localStorage key a host keeps its chosen theme under, as a preset id
|
|
39
39
|
* (`plum`, from `SHIPPED_THEMES` in `rift-ds/tokens/values`). When set, the
|
|
40
40
|
* script also applies it as `data-brand` on `<html>` before first paint, so a
|
|
41
|
-
* returning visitor never sees the default theme flash first;
|
|
42
|
-
*
|
|
43
|
-
*
|
|
41
|
+
* returning visitor never sees the default theme flash first; the base
|
|
42
|
+
* theme's id removes the attribute, and an empty value or a value that is
|
|
43
|
+
* not an id leaves it as the layout rendered it. The host writes the key when the
|
|
44
44
|
* visitor picks a theme. Unset by default: the script then never touches
|
|
45
45
|
* `data-brand`.
|
|
46
46
|
*/
|
|
@@ -11,7 +11,12 @@ type ToolbarOwnProps = {
|
|
|
11
11
|
* layout (the component never fixes itself to the viewport).
|
|
12
12
|
*/
|
|
13
13
|
variant?: 'default' | 'floating';
|
|
14
|
-
/**
|
|
14
|
+
/**
|
|
15
|
+
* The toolbar's controls: group unrelated clusters with `ToolbarSeparator`.
|
|
16
|
+
* Usually tertiary `IconButton`s and compact tertiary `Button`s, as in
|
|
17
|
+
* `<Toolbar aria-label="Formatting"><IconButton icon="format_bold" label="Bold" variant="tertiary" /><ToolbarSeparator /><Button label="Share" variant="tertiary" size="compact" /></Toolbar>`;
|
|
18
|
+
* a short run of plain text (a count, a zoom reading) can sit among them.
|
|
19
|
+
*/
|
|
15
20
|
children?: React.ReactNode;
|
|
16
21
|
/** Additional CSS classes */
|
|
17
22
|
className?: string;
|
|
@@ -22,8 +22,12 @@ type WizardOwnProps = {
|
|
|
22
22
|
onStepChange?: (step: number) => void;
|
|
23
23
|
/** Called when the reader presses the last step's finish button. */
|
|
24
24
|
onFinish?: () => void;
|
|
25
|
-
/** Whether the reader can move on from the step shown: false holds Continue and Finish, while the step's own fields say what is missing. Defaults to true. */
|
|
25
|
+
/** Whether the reader can move on from the step shown: false holds Continue and Finish, while the step's own fields say what is missing: the two are disabled, or with `onBlockedAdvance` stay pressable and report the press. Defaults to true. */
|
|
26
26
|
canAdvance?: boolean;
|
|
27
|
+
/**
|
|
28
|
+
* Called with the step's index when the reader presses Continue or Finish while `canAdvance` is false. With it set, the two buttons stay pressable on a held step, so the press can show what is missing (validate the step, focus its first error) where a disabled button could say nothing.
|
|
29
|
+
*/
|
|
30
|
+
onBlockedAdvance?: (step: number) => void;
|
|
27
31
|
/** A running figure at the start of the footer, kept in view as the steps change: a total, a count of what is chosen. */
|
|
28
32
|
summary?: React.ReactNode;
|
|
29
33
|
/** Lets the reader go back to a completed step from the stepper. Defaults to true. */
|
|
@@ -48,7 +52,8 @@ export interface WizardProps extends WizardOwnProps, Omit<React.ComponentPropsWi
|
|
|
48
52
|
* and a footer with Back and Continue (Finish on the last step) and a running
|
|
49
53
|
* summary. Moving to a step moves focus to its heading, so a screen reader
|
|
50
54
|
* hears where it landed. The step's own fields own their validation; the
|
|
51
|
-
* host holds Continue with `canAdvance` until they pass
|
|
55
|
+
* host holds Continue with `canAdvance` until they pass, and with
|
|
56
|
+
* `onBlockedAdvance` hears a press on a held step, to show what is missing.
|
|
52
57
|
*/
|
|
53
|
-
export declare function Wizard({ steps, step: stepProp, defaultStep, onStepChange, onFinish, canAdvance, summary, allowStepClick, backLabel, nextLabel, finishLabel, locale, headingLevel, className, ref, ...rest }: WizardProps): React.JSX.Element;
|
|
58
|
+
export declare function Wizard({ steps, step: stepProp, defaultStep, onStepChange, onFinish, canAdvance, onBlockedAdvance, summary, allowStepClick, backLabel, nextLabel, finishLabel, locale, headingLevel, className, ref, ...rest }: WizardProps): React.JSX.Element;
|
|
54
59
|
export {};
|
|
@@ -12,6 +12,7 @@ function Wizard({
|
|
|
12
12
|
onStepChange,
|
|
13
13
|
onFinish,
|
|
14
14
|
canAdvance = true,
|
|
15
|
+
onBlockedAdvance,
|
|
15
16
|
summary,
|
|
16
17
|
allowStepClick = true,
|
|
17
18
|
backLabel = "Back",
|
|
@@ -40,6 +41,8 @@ function Wizard({
|
|
|
40
41
|
}, [current]);
|
|
41
42
|
const isLast = current === steps.length - 1;
|
|
42
43
|
const shown = steps[current];
|
|
44
|
+
const held = !canAdvance;
|
|
45
|
+
const advance = (move) => held ? onBlockedAdvance?.(current) : move();
|
|
43
46
|
const hasSummary = summary != null && summary !== false && summary !== "";
|
|
44
47
|
const classes = ["ds-wizard", className].filter(Boolean).join(" ");
|
|
45
48
|
return /* @__PURE__ */ jsxs("section", { "aria-label": shown?.label, ...rest, ref, className: classes, children: [
|
|
@@ -61,7 +64,7 @@ function Wizard({
|
|
|
61
64
|
hasSummary && /* @__PURE__ */ jsx("div", { className: "ds-wizard__summary", children: summary }),
|
|
62
65
|
/* @__PURE__ */ jsxs("div", { className: "ds-wizard__actions", children: [
|
|
63
66
|
current > 0 && /* @__PURE__ */ jsx(Button, { label: backLabel, variant: "secondary", onClick: () => go(current - 1) }),
|
|
64
|
-
isLast ? /* @__PURE__ */ jsx(Button, { label: finishLabel, disabled: !
|
|
67
|
+
isLast ? /* @__PURE__ */ jsx(Button, { label: finishLabel, disabled: held && !onBlockedAdvance, onClick: () => advance(() => onFinish?.()) }) : /* @__PURE__ */ jsx(Button, { label: nextLabel, disabled: held && !onBlockedAdvance, onClick: () => advance(() => go(current + 1)) })
|
|
65
68
|
] })
|
|
66
69
|
] })
|
|
67
70
|
] });
|
package/components/registry.json
CHANGED
|
@@ -196,7 +196,7 @@
|
|
|
196
196
|
"description": "Full-page template pairing the collapsible App sidebar with a content area, in flush, floating or inset mode, contained or full width.",
|
|
197
197
|
"category": "layout",
|
|
198
198
|
"client": true,
|
|
199
|
-
"keys": { "by": "component", "note": "The rail is AppSidebar, which carries the layout’s keys. The layout adds
|
|
199
|
+
"keys": { "by": "component", "note": "The rail is AppSidebar, which carries the layout’s keys. The layout adds only its skip link, a native link.", "see": "AppSidebar" },
|
|
200
200
|
"alternatives": [
|
|
201
201
|
{ "name": "SiteLayout", "when": "the page is a site of pages under a top header, such as documentation" }
|
|
202
202
|
]
|
|
@@ -861,7 +861,7 @@
|
|
|
861
861
|
"name": "Figure",
|
|
862
862
|
"label": "Figure",
|
|
863
863
|
"slug": "figure",
|
|
864
|
-
"description": "Images with captions, in the case-study frame, with a Do or Don't verdict for guidelines.",
|
|
864
|
+
"description": "Images with captions, in the case-study frame, with a Do or Don't verdict for guidelines; with a press handler, the tile of a gallery that opens a Lightbox.",
|
|
865
865
|
"category": "data-display",
|
|
866
866
|
"client": false,
|
|
867
867
|
"keys": { "by": "none" }
|
|
@@ -1070,11 +1070,14 @@
|
|
|
1070
1070
|
"name": "InspectorSegmentedControl",
|
|
1071
1071
|
"label": "Inspector segments",
|
|
1072
1072
|
"slug": "inspector-segmented-control",
|
|
1073
|
-
"description": "One-row choice
|
|
1073
|
+
"description": "One-row choice for inspector panels, as native radios under a sliding pill. It fills its row: the label at one end, the choices at the other.",
|
|
1074
1074
|
"category": "inspector",
|
|
1075
1075
|
"client": true,
|
|
1076
1076
|
"folder": "Inspector",
|
|
1077
|
-
"keys": { "by": "platform", "note": "Native radio inputs: the browser moves between them with the arrow keys." }
|
|
1077
|
+
"keys": { "by": "platform", "note": "Native radio inputs: the browser moves between them with the arrow keys." },
|
|
1078
|
+
"alternatives": [
|
|
1079
|
+
{ "name": "SegmentedControl", "when": "the choice sits on a page or in a form rather than in an inspector panel’s row" }
|
|
1080
|
+
]
|
|
1078
1081
|
},
|
|
1079
1082
|
{
|
|
1080
1083
|
"name": "InspectorSlider",
|
|
@@ -1538,6 +1541,7 @@
|
|
|
1538
1541
|
"client": false,
|
|
1539
1542
|
"keys": { "by": "none" },
|
|
1540
1543
|
"alternatives": [
|
|
1544
|
+
{ "name": "Widget", "when": "the heading titles a panel of rows on a dashboard or a settings page, which Widget draws with its WidgetRow list" },
|
|
1541
1545
|
{ "name": "PageHeader", "when": "the heading is the page’s own title, with its breadcrumb and actions" },
|
|
1542
1546
|
{ "name": "Heading", "when": "the heading needs a level or type tier of its own rather than a section’s divided title" }
|
|
1543
1547
|
]
|
|
@@ -1551,6 +1555,7 @@
|
|
|
1551
1555
|
"client": true,
|
|
1552
1556
|
"pattern": "tabs",
|
|
1553
1557
|
"alternatives": [
|
|
1558
|
+
{ "name": "InspectorSegmentedControl", "when": "the choice is one labelled row of an inspector panel, where it fills the row" },
|
|
1554
1559
|
{ "name": "Tabs", "when": "the options are distinct content sections with their own panels" }
|
|
1555
1560
|
]
|
|
1556
1561
|
},
|
|
@@ -2043,11 +2048,12 @@
|
|
|
2043
2048
|
"name": "Widget",
|
|
2044
2049
|
"label": "Widget",
|
|
2045
2050
|
"slug": "widget",
|
|
2046
|
-
"description": "A titled section for a dashboard or settings, with rows, groups, a footer, an optional fold, and a board of columns.",
|
|
2051
|
+
"description": "A titled section for a dashboard or settings, with rows, groups, a footer, an optional fold, and a board that packs tiles of different heights into columns.",
|
|
2047
2052
|
"category": "data-display",
|
|
2048
2053
|
"client": false,
|
|
2049
2054
|
"keys": { "by": "none" },
|
|
2050
2055
|
"alternatives": [
|
|
2056
|
+
{ "name": "SectionTitle", "when": "the heading only opens a section of the page, with no tile or rows of its own" },
|
|
2051
2057
|
{ "name": "Grid", "when": "cells of any kind should sit in equal columns and share a row’s height" },
|
|
2052
2058
|
{ "name": "FormSection", "when": "the section holds a form’s fields and its own save" },
|
|
2053
2059
|
{ "name": "DecisionRow", "when": "each row waits on a yes or a no and settles to the answer" }
|
|
@@ -196,7 +196,7 @@ declare const _default: {
|
|
|
196
196
|
"description": "Full-page template pairing the collapsible App sidebar with a content area, in flush, floating or inset mode, contained or full width.",
|
|
197
197
|
"category": "layout",
|
|
198
198
|
"client": true,
|
|
199
|
-
"keys": { "by": "component", "note": "The rail is AppSidebar, which carries the layout’s keys. The layout adds
|
|
199
|
+
"keys": { "by": "component", "note": "The rail is AppSidebar, which carries the layout’s keys. The layout adds only its skip link, a native link.", "see": "AppSidebar" },
|
|
200
200
|
"alternatives": [
|
|
201
201
|
{ "name": "SiteLayout", "when": "the page is a site of pages under a top header, such as documentation" }
|
|
202
202
|
]
|
|
@@ -861,7 +861,7 @@ declare const _default: {
|
|
|
861
861
|
"name": "Figure",
|
|
862
862
|
"label": "Figure",
|
|
863
863
|
"slug": "figure",
|
|
864
|
-
"description": "Images with captions, in the case-study frame, with a Do or Don't verdict for guidelines.",
|
|
864
|
+
"description": "Images with captions, in the case-study frame, with a Do or Don't verdict for guidelines; with a press handler, the tile of a gallery that opens a Lightbox.",
|
|
865
865
|
"category": "data-display",
|
|
866
866
|
"client": false,
|
|
867
867
|
"keys": { "by": "none" }
|
|
@@ -1070,11 +1070,14 @@ declare const _default: {
|
|
|
1070
1070
|
"name": "InspectorSegmentedControl",
|
|
1071
1071
|
"label": "Inspector segments",
|
|
1072
1072
|
"slug": "inspector-segmented-control",
|
|
1073
|
-
"description": "One-row choice
|
|
1073
|
+
"description": "One-row choice for inspector panels, as native radios under a sliding pill. It fills its row: the label at one end, the choices at the other.",
|
|
1074
1074
|
"category": "inspector",
|
|
1075
1075
|
"client": true,
|
|
1076
1076
|
"folder": "Inspector",
|
|
1077
|
-
"keys": { "by": "platform", "note": "Native radio inputs: the browser moves between them with the arrow keys." }
|
|
1077
|
+
"keys": { "by": "platform", "note": "Native radio inputs: the browser moves between them with the arrow keys." },
|
|
1078
|
+
"alternatives": [
|
|
1079
|
+
{ "name": "SegmentedControl", "when": "the choice sits on a page or in a form rather than in an inspector panel’s row" }
|
|
1080
|
+
]
|
|
1078
1081
|
},
|
|
1079
1082
|
{
|
|
1080
1083
|
"name": "InspectorSlider",
|
|
@@ -1538,6 +1541,7 @@ declare const _default: {
|
|
|
1538
1541
|
"client": false,
|
|
1539
1542
|
"keys": { "by": "none" },
|
|
1540
1543
|
"alternatives": [
|
|
1544
|
+
{ "name": "Widget", "when": "the heading titles a panel of rows on a dashboard or a settings page, which Widget draws with its WidgetRow list" },
|
|
1541
1545
|
{ "name": "PageHeader", "when": "the heading is the page’s own title, with its breadcrumb and actions" },
|
|
1542
1546
|
{ "name": "Heading", "when": "the heading needs a level or type tier of its own rather than a section’s divided title" }
|
|
1543
1547
|
]
|
|
@@ -1551,6 +1555,7 @@ declare const _default: {
|
|
|
1551
1555
|
"client": true,
|
|
1552
1556
|
"pattern": "tabs",
|
|
1553
1557
|
"alternatives": [
|
|
1558
|
+
{ "name": "InspectorSegmentedControl", "when": "the choice is one labelled row of an inspector panel, where it fills the row" },
|
|
1554
1559
|
{ "name": "Tabs", "when": "the options are distinct content sections with their own panels" }
|
|
1555
1560
|
]
|
|
1556
1561
|
},
|
|
@@ -2043,11 +2048,12 @@ declare const _default: {
|
|
|
2043
2048
|
"name": "Widget",
|
|
2044
2049
|
"label": "Widget",
|
|
2045
2050
|
"slug": "widget",
|
|
2046
|
-
"description": "A titled section for a dashboard or settings, with rows, groups, a footer, an optional fold, and a board of columns.",
|
|
2051
|
+
"description": "A titled section for a dashboard or settings, with rows, groups, a footer, an optional fold, and a board that packs tiles of different heights into columns.",
|
|
2047
2052
|
"category": "data-display",
|
|
2048
2053
|
"client": false,
|
|
2049
2054
|
"keys": { "by": "none" },
|
|
2050
2055
|
"alternatives": [
|
|
2056
|
+
{ "name": "SectionTitle", "when": "the heading only opens a section of the page, with no tile or rows of its own" },
|
|
2051
2057
|
{ "name": "Grid", "when": "cells of any kind should sit in equal columns and share a row’s height" },
|
|
2052
2058
|
{ "name": "FormSection", "when": "the section holds a form’s fields and its own save" },
|
|
2053
2059
|
{ "name": "DecisionRow", "when": "each row waits on a yes or a no and settles to the answer" }
|