rift-ds 1.41.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/behaviors/LoadingImage.d.ts +2 -0
- package/behaviors/LoadingImage.js +34 -0
- package/behaviors/ScrollRegion.js +15 -2
- package/behaviors/VisuallyHidden.d.ts +30 -0
- package/behaviors/VisuallyHidden.js +17 -0
- package/behaviors/loading-image.css +30 -0
- package/behaviors/quietFocus.d.ts +4 -0
- package/behaviors/quietFocus.js +14 -0
- package/behaviors/useFocusScope.d.ts +3 -1
- package/behaviors/useFocusScope.js +4 -6
- package/bin/rift-ds.mjs +2 -0
- package/bin/templates/app/components/rift/ColorModeScript.tsx +3 -1
- package/bin/templates/app/components/rift/RiftRoot.tsx +40 -1
- package/bin/templates/blocks/app/dashboard/page.module.css +2 -2
- package/bin/templates/blocks/app/dashboard/page.tsx +7 -5
- package/bin/templates/blocks/app/landing/page.tsx +1 -1
- 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/pricing/page.module.css +15 -1
- package/bin/templates/blocks/app/pricing/page.tsx +8 -1
- package/bin/templates/blocks/app/settings/Settings.tsx +4 -4
- package/bin/templates/blocks/app/sign-in/page.tsx +10 -2
- package/bin/templates/blocks/app/sign-up/page.module.css +83 -0
- package/bin/templates/blocks/app/sign-up/page.tsx +126 -0
- package/bin/templates/blocks/app/starter/page.tsx +1 -1
- package/bin/templates/blocks/components/blocks/AppShell.module.css +0 -10
- package/bin/templates/blocks/components/blocks/AppShell.tsx +51 -132
- package/bin/templates/blocks/components/blocks/DocsShell.tsx +5 -1
- package/bin/templates/blocks/components/blocks/notifications.ts +77 -0
- package/bin/templates/blocks/registry.json +49 -6
- package/chat/ChatWidget.js +2 -1
- package/components/AgentPlan/AgentPlan.css +1 -1
- package/components/AlertDialog/AlertDialog.css +14 -0
- package/components/AlertDialog/AlertDialog.d.ts +35 -3
- package/components/AlertDialog/AlertDialog.js +16 -5
- 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 +17 -2
- package/components/AppSidebar/AppSidebar.js +9 -2
- package/components/AppToolbar/AppToolbar.d.ts +5 -2
- package/components/AppToolbar/AppToolbar.js +3 -1
- package/components/Attachment/AttachmentGroup.js +2 -1
- package/components/Attachment/AttachmentTile.js +2 -1
- package/components/Badge/Badge.css +6 -0
- package/components/Breadcrumb/Breadcrumb.css +4 -1
- package/components/Button/Button.css +20 -1
- package/components/Button/Button.js +6 -1
- package/components/Card/Card.css +11 -0
- package/components/Card/Card.d.ts +9 -3
- package/components/Card/Card.js +21 -2
- package/components/Chart/AreaChart.d.ts +7 -0
- package/components/Chart/AreaChart.js +57 -45
- package/components/Chart/BarChart.d.ts +7 -0
- package/components/Chart/BarChart.js +52 -46
- package/components/Chart/Chart.css +134 -1
- package/components/Chart/ChartSkeleton.d.ts +32 -0
- package/components/Chart/ChartSkeleton.js +149 -0
- package/components/Chart/ComboChart.d.ts +7 -0
- package/components/Chart/ComboChart.js +80 -74
- package/components/Chart/LineChart.d.ts +17 -3
- package/components/Chart/LineChart.js +67 -39
- package/components/Chart/PieChart.d.ts +7 -0
- package/components/Chart/PieChart.js +41 -34
- package/components/Chart/RadarChart.d.ts +7 -0
- package/components/Chart/RadarChart.js +39 -32
- package/components/Chart/RadialChart.d.ts +7 -0
- package/components/Chart/RadialChart.js +5 -1
- package/components/Chart/ScatterChart.d.ts +7 -0
- package/components/Chart/ScatterChart.js +52 -40
- package/components/Chart/StackedBarChart.d.ts +10 -1
- package/components/Chart/StackedBarChart.js +57 -43
- package/components/Chart/Treemap.d.ts +7 -0
- package/components/Chart/Treemap.js +17 -11
- package/components/ChatMessage/ChatMessage.css +6 -0
- package/components/Checkbox/Checkbox.css +25 -1
- package/components/Checkbox/Checkbox.d.ts +8 -4
- package/components/Checkbox/Checkbox.js +17 -8
- package/components/Chip/Chip.css +5 -3
- package/components/ContactCard/ContactCard.css +4 -3
- package/components/ContributionGraph/ContributionGraph.css +20 -0
- package/components/ContributionGraph/ContributionGraph.d.ts +4 -0
- package/components/ContributionGraph/ContributionGraph.js +11 -6
- package/components/DataTable/DataTable.css +34 -4
- package/components/DataTable/DataTable.d.ts +16 -2
- package/components/DataTable/DataTable.js +8 -2
- package/components/DateInput/DateInput.css +3 -1
- package/components/DatePicker/DatePicker.css +16 -0
- package/components/DatePicker/DatePicker.d.ts +13 -0
- package/components/DatePicker/DatePicker.js +21 -27
- package/components/DatePicker/MonthGrid.d.ts +2 -2
- package/components/DatePicker/MonthGrid.js +1 -1
- package/components/DatePicker/today.d.ts +15 -0
- package/components/DatePicker/today.js +17 -0
- package/components/DateRangePicker/DateRangePicker.d.ts +14 -1
- package/components/DateRangePicker/DateRangePicker.js +18 -7
- package/components/DescriptionList/DescriptionList.css +11 -0
- package/components/DescriptionList/DescriptionList.d.ts +5 -1
- package/components/DescriptionList/DescriptionList.js +21 -6
- package/components/Dialog/Dialog.css +9 -0
- package/components/Dialog/Dialog.d.ts +9 -0
- package/components/Dialog/Dialog.js +32 -19
- package/components/DocumentChip/DocumentChip.css +1 -1
- package/components/Drawer/Drawer.d.ts +9 -0
- package/components/Drawer/Drawer.js +8 -0
- package/components/Dropdown/Dropdown.css +3 -1
- package/components/Dropdown/Dropdown.js +8 -0
- package/components/EmptyState/EmptyState.css +8 -1
- package/components/EventCalendar/EventCalendar.css +12 -0
- package/components/Field/Field.css +2 -2
- package/components/FileInput/FileInput.css +1 -1
- package/components/FilterBar/FilterBar.d.ts +6 -1
- package/components/FunnelChart/FunnelChart.d.ts +7 -0
- package/components/FunnelChart/FunnelChart.js +44 -30
- package/components/GanttChart/GanttChart.css +10 -0
- package/components/GanttChart/GanttChart.d.ts +4 -0
- package/components/GanttChart/GanttChart.js +66 -33
- package/components/Gauge/Gauge.css +23 -0
- package/components/Gauge/Gauge.d.ts +4 -0
- package/components/Gauge/Gauge.js +14 -8
- package/components/ImageCompare/ImageCompare.js +2 -1
- package/components/Input/Input.css +15 -1
- package/components/Inspector/Inspector.css +4 -1
- package/components/List/List.css +1 -1
- package/components/NotificationCenter/NotificationCenter.css +152 -27
- package/components/NotificationCenter/NotificationCenter.d.ts +71 -8
- package/components/NotificationCenter/NotificationCenter.js +120 -13
- package/components/NumberInput/NumberInput.css +2 -0
- package/components/PageHeader/PageHeader.css +12 -4
- package/components/Panel/Panel.d.ts +1 -1
- package/components/Popover/Popover.css +3 -0
- package/components/Popover/Popover.d.ts +1 -1
- package/components/Popover/Popover.js +9 -1
- package/components/Prose/Prose.css +1 -1
- package/components/QuestionCard/QuestionCard.css +7 -4
- package/components/RadioButton/RadioButton.css +1 -1
- package/components/RadioButton/RadioButton.d.ts +4 -2
- package/components/RadioButton/RadioButton.js +5 -2
- package/components/ResourceTimeline/ResourceTimeline.css +12 -0
- package/components/ResourceTimeline/ResourceTimeline.d.ts +5 -1
- package/components/ResourceTimeline/ResourceTimeline.js +94 -52
- package/components/RichDropdown/RichDropdown.css +3 -1
- package/components/SegmentedControl/SegmentedControl.css +5 -0
- package/components/SelectionCard/SelectionCard.css +29 -0
- package/components/SelectionCard/SelectionCard.d.ts +7 -0
- package/components/SelectionCard/SelectionCard.js +25 -2
- package/components/Sparkline/Sparkline.css +20 -0
- package/components/Sparkline/Sparkline.d.ts +4 -0
- package/components/Sparkline/Sparkline.js +14 -8
- package/components/Stat/Stat.css +39 -0
- package/components/Stat/Stat.d.ts +23 -2
- package/components/Stat/Stat.js +21 -6
- package/components/Table/Table.css +106 -16
- package/components/Table/Table.d.ts +4 -0
- package/components/Table/Table.js +43 -28
- package/components/Textarea/Textarea.css +4 -2
- package/components/ThemeToggle/colorMode.d.ts +13 -5
- package/components/ThemeToggle/colorMode.js +4 -2
- package/components/ThreadHistory/ThreadHistory.css +11 -0
- package/components/ThreadHistory/ThreadHistory.d.ts +5 -1
- package/components/ThreadHistory/ThreadHistory.js +6 -1
- package/components/ThreadPanel/ThreadPanel.d.ts +4 -0
- package/components/ThreadPanel/ThreadPanel.js +5 -1
- package/components/TimePicker/TimePicker.css +3 -1
- package/components/TimePicker/TimePicker.d.ts +4 -2
- package/components/TimePicker/TimePicker.js +11 -3
- package/components/Timeline/Timeline.css +15 -0
- package/components/Timeline/Timeline.d.ts +8 -0
- package/components/Timeline/Timeline.js +21 -0
- package/components/Toast/Toast.css +16 -0
- package/components/Toast/Toast.d.ts +7 -2
- package/components/ToggleGroup/ToggleGroup.css +28 -2
- package/components/ToggleSwitch/ToggleSwitch.css +1 -1
- package/components/Toolbar/Toolbar.d.ts +6 -1
- package/components/Tooltip/Tooltip.d.ts +9 -0
- package/components/Tooltip/Tooltip.js +34 -8
- package/components/TreeView/TreeView.css +12 -0
- package/components/TreeView/TreeView.d.ts +4 -0
- package/components/TreeView/TreeView.js +20 -0
- package/components/UsageCard/UsageCard.css +11 -0
- package/components/UsageCard/UsageCard.d.ts +4 -0
- package/components/UsageCard/UsageCard.js +25 -16
- package/components/Widget/Widget.css +7 -0
- package/components/Widget/Widget.d.ts +4 -0
- package/components/Widget/Widget.js +14 -2
- package/components/Wizard/Wizard.d.ts +8 -3
- package/components/Wizard/Wizard.js +4 -1
- package/components/registry.json +15 -6
- package/components/registry.json.d.ts +15 -6
- package/components/registry.json.js +1 -1
- package/package.json +7 -2
- package/tokens/presets/contrast.css +4 -4
- package/tokens/presets/coral.css +3 -4
- package/tokens/presets/forest.css +16 -4
- package/tokens/presets/gold.css +4 -3
- package/tokens/presets/marquee.css +2 -3
- package/tokens/presets/mono.css +28 -28
- package/tokens/presets/pink.css +5 -4
- package/tokens/presets/terminal.css +4 -3
- package/tokens/presets/violet.css +3 -4
- package/tokens/presets/warm.css +16 -4
- package/tokens/presets/zest.css +11 -13
- package/tokens/registry.json +1 -0
- package/tokens/registry.json.d.ts +1 -0
- package/tokens/registry.json.js +1 -1
- package/tokens/tokens-dark.css +4 -0
- package/tokens/tokens-light.css +4 -0
- package/tokens/values.d.ts +24 -4
- package/tokens/values.js +25 -6
- package/tokens/values.json.js +1 -1
|
@@ -4,8 +4,11 @@ import React, { useState, useRef, useId, useEffect, isValidElement, cloneElement
|
|
|
4
4
|
import { useLayer } from "../../behaviors/useLayer.js";
|
|
5
5
|
import { useAnchoredPosition } from "../../behaviors/useAnchoredPosition.js";
|
|
6
6
|
import { useTopLayer } from "../../behaviors/useTopLayer.js";
|
|
7
|
+
import { activeModalPanel } from "../../behaviors/useFocusScope.js";
|
|
8
|
+
import { isQuietFocus } from "../../behaviors/quietFocus.js";
|
|
7
9
|
import "./Tooltip.css";
|
|
8
10
|
import { MOTION_HOVER_SHOW_DELAY_MS, MOTION_HOVER_HIDE_DELAY_MS } from "../../tokens/motion.js";
|
|
11
|
+
const POPUP_OPEN = '[aria-expanded="true"][aria-haspopup]:not([aria-haspopup="false"])';
|
|
9
12
|
const clamp = (value, min, max) => max < min ? min : Math.min(Math.max(value, min), max);
|
|
10
13
|
const Tooltip = React.forwardRef(
|
|
11
14
|
({
|
|
@@ -33,9 +36,24 @@ const Tooltip = React.forwardRef(
|
|
|
33
36
|
if (typeof ref === "function") ref(node);
|
|
34
37
|
else if (ref) ref.current = node;
|
|
35
38
|
};
|
|
39
|
+
const standsDown = () => {
|
|
40
|
+
const anchor = anchorRef.current;
|
|
41
|
+
if (!anchor) return false;
|
|
42
|
+
if (anchor.querySelector(POPUP_OPEN) !== null) return true;
|
|
43
|
+
const modal = activeModalPanel();
|
|
44
|
+
return modal !== null && !modal.contains(anchor);
|
|
45
|
+
};
|
|
36
46
|
const show = () => {
|
|
37
47
|
clearTimeout(hideTimeoutRef.current);
|
|
38
|
-
showTimeoutRef.current
|
|
48
|
+
clearTimeout(showTimeoutRef.current);
|
|
49
|
+
showTimeoutRef.current = setTimeout(() => {
|
|
50
|
+
if (!standsDown()) setVisible(true);
|
|
51
|
+
}, showDelay);
|
|
52
|
+
};
|
|
53
|
+
const dismissNow = () => {
|
|
54
|
+
clearTimeout(showTimeoutRef.current);
|
|
55
|
+
clearTimeout(hideTimeoutRef.current);
|
|
56
|
+
setVisible(false);
|
|
39
57
|
};
|
|
40
58
|
const hide = () => {
|
|
41
59
|
clearTimeout(showTimeoutRef.current);
|
|
@@ -47,14 +65,21 @@ const Tooltip = React.forwardRef(
|
|
|
47
65
|
clearTimeout(hideTimeoutRef.current);
|
|
48
66
|
};
|
|
49
67
|
}, []);
|
|
68
|
+
useEffect(() => {
|
|
69
|
+
if (!visible) return;
|
|
70
|
+
const anchor = anchorRef.current;
|
|
71
|
+
if (!anchor) return;
|
|
72
|
+
const check = () => {
|
|
73
|
+
if (standsDown()) dismissNow();
|
|
74
|
+
};
|
|
75
|
+
const observer = new MutationObserver(check);
|
|
76
|
+
observer.observe(anchor, { attributes: true, subtree: true, attributeFilter: ["aria-expanded"] });
|
|
77
|
+
return () => observer.disconnect();
|
|
78
|
+
}, [visible]);
|
|
50
79
|
useLayer({
|
|
51
80
|
open: visible,
|
|
52
81
|
passive: true,
|
|
53
|
-
onDismiss:
|
|
54
|
-
clearTimeout(showTimeoutRef.current);
|
|
55
|
-
clearTimeout(hideTimeoutRef.current);
|
|
56
|
-
setVisible(false);
|
|
57
|
-
}
|
|
82
|
+
onDismiss: dismissNow
|
|
58
83
|
});
|
|
59
84
|
useTopLayer({ open: visible, panelRef });
|
|
60
85
|
useAnchoredPosition({
|
|
@@ -99,11 +124,12 @@ const Tooltip = React.forwardRef(
|
|
|
99
124
|
},
|
|
100
125
|
onFocus: (event) => {
|
|
101
126
|
onFocus?.(event);
|
|
102
|
-
show();
|
|
127
|
+
if (!isQuietFocus(event.target)) show();
|
|
103
128
|
},
|
|
104
129
|
onBlur: (event) => {
|
|
105
130
|
onBlur?.(event);
|
|
106
|
-
|
|
131
|
+
if (standsDown()) dismissNow();
|
|
132
|
+
else hide();
|
|
107
133
|
},
|
|
108
134
|
children: [
|
|
109
135
|
trigger,
|
|
@@ -122,4 +122,16 @@
|
|
|
122
122
|
list-style: none;
|
|
123
123
|
}
|
|
124
124
|
|
|
125
|
+
/* Loading: placeholder lines on the rows' own inset and indent, in a box one
|
|
126
|
+
text line tall, with no hover. */
|
|
127
|
+
|
|
128
|
+
.ds-treeview__row--loading {
|
|
129
|
+
min-height: 1lh;
|
|
130
|
+
cursor: default;
|
|
131
|
+
}
|
|
132
|
+
|
|
133
|
+
.ds-treeview__row--loading:hover {
|
|
134
|
+
background-color: transparent;
|
|
135
|
+
}
|
|
136
|
+
|
|
125
137
|
} /* @layer rift.components */
|
|
@@ -29,6 +29,10 @@ type TreeViewOwnProps = {
|
|
|
29
29
|
* has no meaning on a tree widget.
|
|
30
30
|
*/
|
|
31
31
|
onSelect?: (id: string) => void;
|
|
32
|
+
/** Holds placeholder rows, indented like a folder and its files, in place of the tree while its nodes are being fetched. */
|
|
33
|
+
loading?: boolean;
|
|
34
|
+
/** Accessible name announced while `loading`. */
|
|
35
|
+
loadingLabel?: string;
|
|
32
36
|
/** Additional CSS classes */
|
|
33
37
|
className?: string;
|
|
34
38
|
};
|
|
@@ -2,9 +2,17 @@
|
|
|
2
2
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
3
3
|
import React, { useState, useMemo, useRef, useCallback } from "react";
|
|
4
4
|
import "./TreeView.css";
|
|
5
|
+
import { Skeleton } from "../Skeleton/Skeleton.js";
|
|
5
6
|
import "../../fonts/material-symbols.css";
|
|
6
7
|
import { mirrorClass, logicalArrowKey } from "../../behaviors/direction.js";
|
|
7
8
|
import { useTypeahead } from "../../behaviors/typeahead.js";
|
|
9
|
+
const LOADING_ROWS = [
|
|
10
|
+
[0, "40%"],
|
|
11
|
+
[1, "56%"],
|
|
12
|
+
[1, "44%"],
|
|
13
|
+
[0, "36%"],
|
|
14
|
+
[1, "52%"]
|
|
15
|
+
];
|
|
8
16
|
const isBranchNode = (node) => Array.isArray(node.children) && node.children.length > 0;
|
|
9
17
|
const TreeView = React.forwardRef(
|
|
10
18
|
({
|
|
@@ -15,6 +23,8 @@ const TreeView = React.forwardRef(
|
|
|
15
23
|
selectedId,
|
|
16
24
|
defaultSelectedId,
|
|
17
25
|
onSelect,
|
|
26
|
+
loading = false,
|
|
27
|
+
loadingLabel = "Loading",
|
|
18
28
|
className = "",
|
|
19
29
|
...rest
|
|
20
30
|
}, ref) => {
|
|
@@ -234,6 +244,16 @@ const TreeView = React.forwardRef(
|
|
|
234
244
|
);
|
|
235
245
|
};
|
|
236
246
|
const classes = [baseClass, className].filter(Boolean).join(" ");
|
|
247
|
+
if (loading) {
|
|
248
|
+
return /* @__PURE__ */ jsx("ul", { ...rest, ref, className: classes, "aria-busy": "true", children: LOADING_ROWS.map(([depth, width], index) => /* @__PURE__ */ jsx("li", { className: `${baseClass}__item`, children: /* @__PURE__ */ jsx(
|
|
249
|
+
"div",
|
|
250
|
+
{
|
|
251
|
+
className: `${baseClass}__row ${baseClass}__row--loading`,
|
|
252
|
+
style: { "--ds-treeview-depth": depth },
|
|
253
|
+
children: /* @__PURE__ */ jsx(Skeleton, { variant: "text", width, ...index === 0 ? { loadingLabel } : { "aria-hidden": true } })
|
|
254
|
+
}
|
|
255
|
+
) }, index)) });
|
|
256
|
+
}
|
|
237
257
|
return /* @__PURE__ */ jsx("ul", { ...rest, ref, role: "tree", className: classes, children: nodes.map((node) => renderNode(node, 0)) });
|
|
238
258
|
}
|
|
239
259
|
);
|
|
@@ -61,4 +61,15 @@
|
|
|
61
61
|
color: var(--color-text-secondary);
|
|
62
62
|
}
|
|
63
63
|
|
|
64
|
+
/* Loading: a label line over a bar the height of the compact meter's track. */
|
|
65
|
+
|
|
66
|
+
.ds-usage-card__item--loading {
|
|
67
|
+
gap: var(--gap-200);
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
.ds-usage-card__bar-placeholder.ds-skeleton {
|
|
71
|
+
height: var(--padding-100);
|
|
72
|
+
border-radius: var(--radius-pill);
|
|
73
|
+
}
|
|
74
|
+
|
|
64
75
|
} /* @layer rift.components */
|
|
@@ -34,6 +34,10 @@ type UsageCardOwnProps = {
|
|
|
34
34
|
bare?: boolean;
|
|
35
35
|
/** The BCP 47 locale each meter's readout is written in, such as `ar-EG`. Defaults to `en-US`. This component can render from a Server Component, so it takes the prop alone and reads no LocaleProvider. */
|
|
36
36
|
locale?: string;
|
|
37
|
+
/** Holds a placeholder row per budget, a label line over a bar, while the usage is being fetched: as many as `items` holds, or two when it is empty. */
|
|
38
|
+
loading?: boolean;
|
|
39
|
+
/** Accessible name announced while `loading`. */
|
|
40
|
+
loadingLabel?: string;
|
|
37
41
|
/** Additional CSS classes */
|
|
38
42
|
className?: string;
|
|
39
43
|
};
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { jsxs, jsx } from "react/jsx-runtime";
|
|
2
2
|
import React from "react";
|
|
3
3
|
import { Meter } from "../Meter/Meter.js";
|
|
4
|
+
import { Skeleton } from "../Skeleton/Skeleton.js";
|
|
4
5
|
import "../Chart/Chart.css";
|
|
5
6
|
import "./UsageCard.css";
|
|
6
7
|
import "../../behaviors/chat-card.css";
|
|
@@ -14,6 +15,8 @@ const UsageCard = React.forwardRef(
|
|
|
14
15
|
thresholds,
|
|
15
16
|
bare = false,
|
|
16
17
|
locale = DEFAULT_LOCALE,
|
|
18
|
+
loading = false,
|
|
19
|
+
loadingLabel = "Loading",
|
|
17
20
|
className = "",
|
|
18
21
|
...rest
|
|
19
22
|
}, ref) => {
|
|
@@ -33,22 +36,28 @@ const UsageCard = React.forwardRef(
|
|
|
33
36
|
title && /* @__PURE__ */ jsx("span", { className: "ds-chart__title", children: title }),
|
|
34
37
|
subtitle && /* @__PURE__ */ jsx("span", { className: "ds-chart__subtitle", children: subtitle })
|
|
35
38
|
] }) }),
|
|
36
|
-
/* @__PURE__ */
|
|
37
|
-
/* @__PURE__ */
|
|
38
|
-
|
|
39
|
-
{
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
39
|
+
/* @__PURE__ */ jsxs("div", { className: `${baseClass}__items`, "aria-busy": loading || void 0, children: [
|
|
40
|
+
loading && Array.from({ length: items.length || 2 }, (_, index) => /* @__PURE__ */ jsxs("div", { className: `${baseClass}__item ${baseClass}__item--loading`, children: [
|
|
41
|
+
/* @__PURE__ */ jsx(Skeleton, { variant: "text", width: "40%", ...index === 0 ? { loadingLabel } : { "aria-hidden": true } }),
|
|
42
|
+
/* @__PURE__ */ jsx(Skeleton, { variant: "rectangular", className: `${baseClass}__bar-placeholder`, "aria-hidden": "true" })
|
|
43
|
+
] }, index)),
|
|
44
|
+
!loading && items.map((item, index) => /* @__PURE__ */ jsxs("div", { className: `${baseClass}__item`, children: [
|
|
45
|
+
/* @__PURE__ */ jsx(
|
|
46
|
+
Meter,
|
|
47
|
+
{
|
|
48
|
+
label: item.label,
|
|
49
|
+
value: item.value,
|
|
50
|
+
max: item.max ?? 100,
|
|
51
|
+
valueText: item.valueText,
|
|
52
|
+
locale,
|
|
53
|
+
showValue: true,
|
|
54
|
+
variant: variantFor(item),
|
|
55
|
+
size: "compact"
|
|
56
|
+
}
|
|
57
|
+
),
|
|
58
|
+
item.resetLabel && /* @__PURE__ */ jsx("span", { className: `${baseClass}__reset`, children: item.resetLabel })
|
|
59
|
+
] }, `${item.label}-${index}`))
|
|
60
|
+
] })
|
|
52
61
|
] });
|
|
53
62
|
}
|
|
54
63
|
);
|
|
@@ -344,4 +344,11 @@
|
|
|
344
344
|
margin-bottom: var(--gap-400);
|
|
345
345
|
}
|
|
346
346
|
|
|
347
|
+
/* Loading: each placeholder row holds a title line over a description line. */
|
|
348
|
+
|
|
349
|
+
.ds-widget-row--loading .ds-widget-row__main {
|
|
350
|
+
flex: 1;
|
|
351
|
+
gap: var(--gap-200);
|
|
352
|
+
}
|
|
353
|
+
|
|
347
354
|
} /* @layer rift.components */
|
|
@@ -28,6 +28,10 @@ type WidgetOwnProps = {
|
|
|
28
28
|
children?: React.ReactNode;
|
|
29
29
|
/** The BCP 47 locale the count is written in, such as `ar-EG`. Defaults to `en-US`. This component can render from a Server Component, so it takes the prop alone and reads no LocaleProvider. */
|
|
30
30
|
locale?: string;
|
|
31
|
+
/** Holds three placeholder rows in the body, in place of `children`, while the tile's content is being fetched. The header and footer stay. */
|
|
32
|
+
loading?: boolean;
|
|
33
|
+
/** Accessible name announced while `loading`. */
|
|
34
|
+
loadingLabel?: string;
|
|
31
35
|
/** Additional CSS classes */
|
|
32
36
|
className?: string;
|
|
33
37
|
};
|
|
@@ -4,7 +4,13 @@ import "./Widget.css";
|
|
|
4
4
|
import { formatNumber, DEFAULT_LOCALE } from "../../behaviors/locale.js";
|
|
5
5
|
import { WidgetDisclosure } from "./WidgetDisclosure.js";
|
|
6
6
|
import { warnOnce } from "../../behaviors/devWarning.js";
|
|
7
|
+
import { Skeleton } from "../Skeleton/Skeleton.js";
|
|
7
8
|
import "../../fonts/material-symbols.css";
|
|
9
|
+
const LOADING_ROW_WIDTHS = [
|
|
10
|
+
["56%", "36%"],
|
|
11
|
+
["44%", "52%"],
|
|
12
|
+
["62%", "30%"]
|
|
13
|
+
];
|
|
8
14
|
const Widget = React.forwardRef(
|
|
9
15
|
({
|
|
10
16
|
title,
|
|
@@ -20,10 +26,16 @@ const Widget = React.forwardRef(
|
|
|
20
26
|
onOpenChange,
|
|
21
27
|
children,
|
|
22
28
|
locale = DEFAULT_LOCALE,
|
|
29
|
+
loading = false,
|
|
30
|
+
loadingLabel = "Loading",
|
|
23
31
|
className = "",
|
|
24
32
|
...rest
|
|
25
33
|
}, ref) => {
|
|
26
34
|
const baseClass = "ds-widget";
|
|
35
|
+
const body = loading ? LOADING_ROW_WIDTHS.map(([title2, description2], index) => /* @__PURE__ */ jsx("div", { className: "ds-widget-row ds-widget-row--loading", children: /* @__PURE__ */ jsxs("span", { className: "ds-widget-row__main", children: [
|
|
36
|
+
/* @__PURE__ */ jsx(Skeleton, { variant: "text", width: title2, ...index === 0 ? { loadingLabel } : { "aria-hidden": true } }),
|
|
37
|
+
/* @__PURE__ */ jsx(Skeleton, { variant: "text", width: description2, "aria-hidden": "true" })
|
|
38
|
+
] }) }, index)) : children;
|
|
27
39
|
const hasDescription = description != null && description !== false && description !== "";
|
|
28
40
|
const hasFooter = footer != null && footer !== false;
|
|
29
41
|
const idBase = useId();
|
|
@@ -58,7 +70,7 @@ const Widget = React.forwardRef(
|
|
|
58
70
|
defaultOpen,
|
|
59
71
|
onOpenChange,
|
|
60
72
|
children: [
|
|
61
|
-
/* @__PURE__ */ jsx("div", { className: `${baseClass}__body`, children }),
|
|
73
|
+
/* @__PURE__ */ jsx("div", { className: `${baseClass}__body`, "aria-busy": loading || void 0, children: body }),
|
|
62
74
|
footerNode
|
|
63
75
|
]
|
|
64
76
|
}
|
|
@@ -73,7 +85,7 @@ const Widget = React.forwardRef(
|
|
|
73
85
|
] }),
|
|
74
86
|
action && /* @__PURE__ */ jsx("span", { className: `${baseClass}__action`, children: action })
|
|
75
87
|
] }),
|
|
76
|
-
/* @__PURE__ */ jsx("div", { className: `${baseClass}__body`, children }),
|
|
88
|
+
/* @__PURE__ */ jsx("div", { className: `${baseClass}__body`, "aria-busy": loading || void 0, children: body }),
|
|
77
89
|
footerNode
|
|
78
90
|
] })
|
|
79
91
|
}
|
|
@@ -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
|
},
|
|
@@ -1561,7 +1566,10 @@
|
|
|
1561
1566
|
"description": "Large option cards for high-visibility choices like settings and onboarding, with radio, checkbox or per-card toggle indicators.",
|
|
1562
1567
|
"category": "data-display",
|
|
1563
1568
|
"client": true,
|
|
1564
|
-
"partPatterns": [
|
|
1569
|
+
"partPatterns": [
|
|
1570
|
+
{ "pattern": "checkbox", "part": "cards" },
|
|
1571
|
+
{ "pattern": "radio-group", "part": "cards in radio mode" }
|
|
1572
|
+
]
|
|
1565
1573
|
},
|
|
1566
1574
|
{
|
|
1567
1575
|
"name": "ShaderField",
|
|
@@ -2040,11 +2048,12 @@
|
|
|
2040
2048
|
"name": "Widget",
|
|
2041
2049
|
"label": "Widget",
|
|
2042
2050
|
"slug": "widget",
|
|
2043
|
-
"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.",
|
|
2044
2052
|
"category": "data-display",
|
|
2045
2053
|
"client": false,
|
|
2046
2054
|
"keys": { "by": "none" },
|
|
2047
2055
|
"alternatives": [
|
|
2056
|
+
{ "name": "SectionTitle", "when": "the heading only opens a section of the page, with no tile or rows of its own" },
|
|
2048
2057
|
{ "name": "Grid", "when": "cells of any kind should sit in equal columns and share a row’s height" },
|
|
2049
2058
|
{ "name": "FormSection", "when": "the section holds a form’s fields and its own save" },
|
|
2050
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
|
},
|
|
@@ -1561,7 +1566,10 @@ declare const _default: {
|
|
|
1561
1566
|
"description": "Large option cards for high-visibility choices like settings and onboarding, with radio, checkbox or per-card toggle indicators.",
|
|
1562
1567
|
"category": "data-display",
|
|
1563
1568
|
"client": true,
|
|
1564
|
-
"partPatterns": [
|
|
1569
|
+
"partPatterns": [
|
|
1570
|
+
{ "pattern": "checkbox", "part": "cards" },
|
|
1571
|
+
{ "pattern": "radio-group", "part": "cards in radio mode" }
|
|
1572
|
+
]
|
|
1565
1573
|
},
|
|
1566
1574
|
{
|
|
1567
1575
|
"name": "ShaderField",
|
|
@@ -2040,11 +2048,12 @@ declare const _default: {
|
|
|
2040
2048
|
"name": "Widget",
|
|
2041
2049
|
"label": "Widget",
|
|
2042
2050
|
"slug": "widget",
|
|
2043
|
-
"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.",
|
|
2044
2052
|
"category": "data-display",
|
|
2045
2053
|
"client": false,
|
|
2046
2054
|
"keys": { "by": "none" },
|
|
2047
2055
|
"alternatives": [
|
|
2056
|
+
{ "name": "SectionTitle", "when": "the heading only opens a section of the page, with no tile or rows of its own" },
|
|
2048
2057
|
{ "name": "Grid", "when": "cells of any kind should sit in equal columns and share a row’s height" },
|
|
2049
2058
|
{ "name": "FormSection", "when": "the section holds a form’s fields and its own save" },
|
|
2050
2059
|
{ "name": "DecisionRow", "when": "each row waits on a yes or a no and settles to the answer" }
|