rift-ds 1.41.0 → 1.42.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/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 +1 -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.tsx +7 -5
- package/bin/templates/blocks/app/landing/page.tsx +1 -1
- 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/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 +39 -115
- package/bin/templates/blocks/components/blocks/DocsShell.tsx +5 -1
- package/bin/templates/blocks/registry.json +44 -6
- 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/AppSidebar/AppSidebar.css +13 -2
- package/components/AppSidebar/AppSidebar.js +7 -2
- 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 +51 -45
- package/components/Chart/BarChart.d.ts +7 -0
- package/components/Chart/BarChart.js +52 -46
- package/components/Chart/Chart.css +122 -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 +61 -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 +38 -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 +46 -40
- package/components/Chart/StackedBarChart.d.ts +10 -1
- package/components/Chart/StackedBarChart.js +51 -43
- package/components/Chart/Treemap.d.ts +7 -0
- package/components/Chart/Treemap.js +17 -11
- 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 +28 -4
- package/components/DataTable/DataTable.d.ts +16 -2
- package/components/DataTable/DataTable.js +5 -0
- 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/EmptyState/EmptyState.css +8 -1
- 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 +3 -1
- package/components/List/List.css +1 -1
- package/components/NotificationCenter/NotificationCenter.css +16 -0
- package/components/NotificationCenter/NotificationCenter.d.ts +4 -0
- package/components/NotificationCenter/NotificationCenter.js +23 -1
- package/components/NumberInput/NumberInput.css +2 -0
- package/components/PageHeader/PageHeader.css +12 -4
- package/components/Panel/Panel.d.ts +1 -1
- package/components/Prose/Prose.css +1 -1
- 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/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 +31 -0
- package/components/Stat/Stat.d.ts +23 -2
- package/components/Stat/Stat.js +21 -6
- package/components/Table/Table.css +101 -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 +10 -2
- 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/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/registry.json +4 -1
- package/components/registry.json.d.ts +4 -1
- 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 +2 -2
- 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 +14 -1
- package/tokens/values.js +14 -1
- package/tokens/values.json.js +1 -1
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { jsxs, jsx } from "react/jsx-runtime";
|
|
2
2
|
import React from "react";
|
|
3
3
|
import "../Chart/Chart.css";
|
|
4
|
+
import { Skeleton } from "../Skeleton/Skeleton.js";
|
|
4
5
|
import "./Gauge.css";
|
|
5
6
|
import { formatNumber, DEFAULT_LOCALE } from "../../behaviors/locale.js";
|
|
6
7
|
const SWEEP_UNITS = 75;
|
|
@@ -20,6 +21,8 @@ const Gauge = React.forwardRef(
|
|
|
20
21
|
size = 120,
|
|
21
22
|
strokeWidth = 12,
|
|
22
23
|
locale = DEFAULT_LOCALE,
|
|
24
|
+
loading = false,
|
|
25
|
+
loadingLabel = "Loading",
|
|
23
26
|
className = "",
|
|
24
27
|
...rest
|
|
25
28
|
}, ref) => {
|
|
@@ -34,6 +37,7 @@ const Gauge = React.forwardRef(
|
|
|
34
37
|
bare && `${chartClass}--bare`,
|
|
35
38
|
baseClass,
|
|
36
39
|
`${baseClass}--${resolvedTone}`,
|
|
40
|
+
loading && `${baseClass}--loading`,
|
|
37
41
|
className
|
|
38
42
|
].filter(Boolean).join(" ");
|
|
39
43
|
const radius = (size - strokeWidth) / 2;
|
|
@@ -51,12 +55,14 @@ const Gauge = React.forwardRef(
|
|
|
51
55
|
{
|
|
52
56
|
className: `${baseClass}__dial`,
|
|
53
57
|
style: { width: size, height: size },
|
|
54
|
-
role: "
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
58
|
+
...loading ? { role: "status", "aria-busy": true, "aria-label": loadingLabel } : {
|
|
59
|
+
role: "meter",
|
|
60
|
+
"aria-valuenow": value,
|
|
61
|
+
"aria-valuemin": min,
|
|
62
|
+
"aria-valuemax": max,
|
|
63
|
+
"aria-valuetext": displayValue,
|
|
64
|
+
"aria-label": label ?? restAriaLabel
|
|
65
|
+
},
|
|
60
66
|
children: [
|
|
61
67
|
/* @__PURE__ */ jsxs(
|
|
62
68
|
"svg",
|
|
@@ -81,7 +87,7 @@ const Gauge = React.forwardRef(
|
|
|
81
87
|
transform: `rotate(135 ${center} ${center})`
|
|
82
88
|
}
|
|
83
89
|
),
|
|
84
|
-
valueUnits > 0 && /* @__PURE__ */ jsx(
|
|
90
|
+
valueUnits > 0 && !loading && /* @__PURE__ */ jsx(
|
|
85
91
|
"circle",
|
|
86
92
|
{
|
|
87
93
|
className: `${baseClass}__arc`,
|
|
@@ -98,7 +104,7 @@ const Gauge = React.forwardRef(
|
|
|
98
104
|
}
|
|
99
105
|
),
|
|
100
106
|
(showValue || label) && /* @__PURE__ */ jsxs("div", { className: `${baseClass}__center`, children: [
|
|
101
|
-
showValue && /* @__PURE__ */ jsx("span", { className: `${baseClass}__value`, children: displayValue }),
|
|
107
|
+
showValue && /* @__PURE__ */ jsx("span", { className: `${baseClass}__value`, children: loading ? /* @__PURE__ */ jsx(Skeleton, { variant: "rectangular", "aria-hidden": "true" }) : displayValue }),
|
|
102
108
|
label && /* @__PURE__ */ jsx("span", { className: `${baseClass}__label`, children: label })
|
|
103
109
|
] })
|
|
104
110
|
]
|
|
@@ -3,6 +3,7 @@ import { jsxs, jsx, Fragment } from "react/jsx-runtime";
|
|
|
3
3
|
import React, { useState, useRef } from "react";
|
|
4
4
|
import "./ImageCompare.css";
|
|
5
5
|
import "../../fonts/material-symbols.css";
|
|
6
|
+
import { LoadingImage } from "../../behaviors/LoadingImage.js";
|
|
6
7
|
const clamp = (n) => Math.max(0, Math.min(100, n));
|
|
7
8
|
const ImageCompare = React.forwardRef(
|
|
8
9
|
({
|
|
@@ -102,7 +103,7 @@ const ImageCompare = React.forwardRef(
|
|
|
102
103
|
onPointerUp: endDrag,
|
|
103
104
|
onPointerCancel: endDrag,
|
|
104
105
|
children: [
|
|
105
|
-
/* @__PURE__ */ jsx(
|
|
106
|
+
/* @__PURE__ */ jsx(LoadingImage, { className: `${baseClass}__after`, src: afterSrc, alt: afterAlt, draggable: false }),
|
|
106
107
|
/* @__PURE__ */ jsx("div", { className: `${baseClass}__before-clip`, children: /* @__PURE__ */ jsx("img", { className: `${baseClass}__before`, src: beforeSrc, alt: beforeAlt, draggable: false }) }),
|
|
107
108
|
showLabels && /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
108
109
|
/* @__PURE__ */ jsx("span", { className: `${baseClass}__label ${baseClass}__label--before`, "aria-hidden": "true", children: beforeLabel }),
|
|
@@ -98,7 +98,9 @@
|
|
|
98
98
|
ERROR STATE
|
|
99
99
|
============================================ */
|
|
100
100
|
|
|
101
|
-
|
|
101
|
+
/* The hover rule above is more specific, so the error border names it too. */
|
|
102
|
+
.ds-input--error .ds-input__field,
|
|
103
|
+
.ds-input--error .ds-input__field:hover:not(:focus):not(:disabled) {
|
|
102
104
|
border-color: var(--color-status-error-border);
|
|
103
105
|
}
|
|
104
106
|
|
package/components/List/List.css
CHANGED
|
@@ -316,4 +316,20 @@
|
|
|
316
316
|
color: inherit;
|
|
317
317
|
}
|
|
318
318
|
|
|
319
|
+
/* Loading: each placeholder row holds a round mark in the media slot beside
|
|
320
|
+
a title line and a body line. */
|
|
321
|
+
|
|
322
|
+
.ds-notification-center__placeholder {
|
|
323
|
+
display: flex;
|
|
324
|
+
flex: 1;
|
|
325
|
+
flex-direction: column;
|
|
326
|
+
gap: var(--gap-200);
|
|
327
|
+
min-width: 0;
|
|
328
|
+
}
|
|
329
|
+
|
|
330
|
+
.ds-notification-item--loading .ds-skeleton--circular {
|
|
331
|
+
width: var(--icon-size-800);
|
|
332
|
+
height: var(--icon-size-800);
|
|
333
|
+
}
|
|
334
|
+
|
|
319
335
|
} /* @layer rift.components */
|
|
@@ -151,6 +151,10 @@ type NotificationCenterOwnProps = {
|
|
|
151
151
|
emptyStateLabels?: Partial<Pick<EmptyStateProps, 'title' | 'description'>>;
|
|
152
152
|
/** The BCP 47 locale the tab counts are written in, such as `ar-EG`. Defaults to the nearest LocaleProvider's, else `en-US`. */
|
|
153
153
|
locale?: string;
|
|
154
|
+
/** Holds three placeholder rows, a mark beside two lines, in the list while the notifications are being fetched. The header, tabs and footer stay. */
|
|
155
|
+
loading?: boolean;
|
|
156
|
+
/** Accessible name announced while `loading`. */
|
|
157
|
+
loadingLabel?: string;
|
|
154
158
|
/** Additional CSS classes */
|
|
155
159
|
className?: string;
|
|
156
160
|
/** The notifications, newest first — typically NotificationItems. */
|
|
@@ -10,6 +10,7 @@ import { DropdownMenu } from "../DropdownMenu/DropdownMenu.js";
|
|
|
10
10
|
import "./NotificationCenter.css";
|
|
11
11
|
import "../../behaviors/visually-hidden.css";
|
|
12
12
|
import "../../fonts/material-symbols.css";
|
|
13
|
+
import { Skeleton } from "../Skeleton/Skeleton.js";
|
|
13
14
|
import { useLocale } from "../../behaviors/LocaleProvider.js";
|
|
14
15
|
import { useLinkComponent } from "../../behaviors/LinkProvider.js";
|
|
15
16
|
const NotificationItem = React.forwardRef(
|
|
@@ -49,6 +50,11 @@ const NotificationItem = React.forwardRef(
|
|
|
49
50
|
}
|
|
50
51
|
);
|
|
51
52
|
NotificationItem.displayName = "NotificationItem";
|
|
53
|
+
const LOADING_ROW_WIDTHS = [
|
|
54
|
+
["58%", "82%"],
|
|
55
|
+
["46%", "70%"],
|
|
56
|
+
["64%", "76%"]
|
|
57
|
+
];
|
|
52
58
|
const NotificationCenter = React.forwardRef(
|
|
53
59
|
({
|
|
54
60
|
title = "Notifications",
|
|
@@ -75,6 +81,8 @@ const NotificationCenter = React.forwardRef(
|
|
|
75
81
|
seeAllLabel = "See all",
|
|
76
82
|
linkComponent,
|
|
77
83
|
locale: localeProp,
|
|
84
|
+
loading = false,
|
|
85
|
+
loadingLabel = "Loading",
|
|
78
86
|
className = "",
|
|
79
87
|
children,
|
|
80
88
|
...rest
|
|
@@ -143,7 +151,21 @@ const NotificationCenter = React.forwardRef(
|
|
|
143
151
|
role: hasTabs ? "tabpanel" : void 0,
|
|
144
152
|
id: hasTabs ? panelId : void 0,
|
|
145
153
|
"aria-label": hasTabs && activeTabIndex >= 0 ? tabs[activeTabIndex].label : void 0,
|
|
146
|
-
|
|
154
|
+
"aria-busy": loading || void 0,
|
|
155
|
+
children: loading ? LOADING_ROW_WIDTHS.map(([titleWidth, bodyWidth], index) => /* @__PURE__ */ jsxs("div", { className: "ds-notification-item ds-notification-item--loading", children: [
|
|
156
|
+
/* @__PURE__ */ jsx("span", { className: "ds-notification-item__media", children: /* @__PURE__ */ jsx(Skeleton, { variant: "circular", "aria-hidden": "true" }) }),
|
|
157
|
+
/* @__PURE__ */ jsxs("div", { className: `${baseClass}__placeholder`, children: [
|
|
158
|
+
/* @__PURE__ */ jsx(
|
|
159
|
+
Skeleton,
|
|
160
|
+
{
|
|
161
|
+
variant: "text",
|
|
162
|
+
width: titleWidth,
|
|
163
|
+
...index === 0 ? { loadingLabel } : { "aria-hidden": true }
|
|
164
|
+
}
|
|
165
|
+
),
|
|
166
|
+
/* @__PURE__ */ jsx(Skeleton, { variant: "text", width: bodyWidth, "aria-hidden": "true" })
|
|
167
|
+
] })
|
|
168
|
+
] }, index)) : hasItems ? children : emptyState ?? /* @__PURE__ */ jsx(
|
|
147
169
|
EmptyState,
|
|
148
170
|
{
|
|
149
171
|
icon: "notifications",
|
|
@@ -119,7 +119,9 @@
|
|
|
119
119
|
ERROR STATE
|
|
120
120
|
============================================ */
|
|
121
121
|
|
|
122
|
+
/* The hover rule above is more specific, so the error border names it too. */
|
|
122
123
|
.ds-numberinput--error .ds-numberinput__shell,
|
|
124
|
+
.ds-numberinput--error .ds-numberinput__shell:hover:not(:focus-within),
|
|
123
125
|
.ds-numberinput--error .ds-numberinput__shell:focus-within {
|
|
124
126
|
border-color: var(--color-status-error-border);
|
|
125
127
|
}
|
|
@@ -66,15 +66,23 @@
|
|
|
66
66
|
align-items: stretch;
|
|
67
67
|
}
|
|
68
68
|
|
|
69
|
-
.ds-page-header__actions {
|
|
70
|
-
justify-content: stretch;
|
|
71
|
-
}
|
|
72
|
-
|
|
73
69
|
/* Each action starts at its own width and grows to share the row, so a
|
|
74
70
|
label never squeezes: actions that cannot fit side by side wrap. */
|
|
75
71
|
.ds-page-header__actions > * {
|
|
76
72
|
flex: 1 1 auto;
|
|
77
73
|
}
|
|
74
|
+
|
|
75
|
+
/* An action inside a Tooltip grows with its wrapper, or the wrapper
|
|
76
|
+
takes the room and the button sits at one end of it. */
|
|
77
|
+
.ds-page-header__actions > .ds-tooltip > .ds-button {
|
|
78
|
+
flex: 1 1 auto;
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
/* An icon-only action keeps its own box: the labelled ones share the row. */
|
|
82
|
+
.ds-page-header__actions > .ds-icon-button,
|
|
83
|
+
.ds-page-header__actions > .ds-tooltip:has(> .ds-icon-button) {
|
|
84
|
+
flex: 0 0 auto;
|
|
85
|
+
}
|
|
78
86
|
}
|
|
79
87
|
|
|
80
88
|
} /* @layer rift.components */
|
|
@@ -3,7 +3,7 @@ import { default as React } from 'react';
|
|
|
3
3
|
type PanelOwnProps = {
|
|
4
4
|
/** Interior padding: 'default' uses --padding-500, 'compact' uses --padding-400, 'none' removes it */
|
|
5
5
|
padding?: 'default' | 'compact' | 'none';
|
|
6
|
-
/** Draws the container border the Widget tile wears
|
|
6
|
+
/** Draws the container border the Widget tile wears. Pass it whenever the panel sits on a surface of its own fill, such as an app's content surface or a theme whose page matches the panel, so a KPI tile or a chart card keeps a visible edge. */
|
|
7
7
|
bordered?: boolean;
|
|
8
8
|
/** Additional CSS classes */
|
|
9
9
|
className?: string;
|
|
@@ -247,7 +247,7 @@
|
|
|
247
247
|
border-collapse: separate;
|
|
248
248
|
border-spacing: 0;
|
|
249
249
|
border: var(--border-025) solid var(--color-table-border);
|
|
250
|
-
border-radius: var(--radius-
|
|
250
|
+
border-radius: var(--radius-600);
|
|
251
251
|
background-color: var(--color-table-body-bg);
|
|
252
252
|
}
|
|
253
253
|
|
|
@@ -48,10 +48,12 @@ export declare const RadioButton: React.ForwardRefExoticComponent<RadioButtonPro
|
|
|
48
48
|
type RadioGroupOwnProps = {
|
|
49
49
|
/** Group label */
|
|
50
50
|
label?: string;
|
|
51
|
-
/** Helper
|
|
51
|
+
/** Helper text rendered below the group. With the older `error` flag and no `errorText`, it doubles as the error message. */
|
|
52
52
|
helperText?: string;
|
|
53
|
-
/** Error state
|
|
53
|
+
/** Error state: marks the group invalid and, in the older form without `errorText`, recolours the helper text as the error message. */
|
|
54
54
|
error?: boolean;
|
|
55
|
+
/** The error message, shown under the group while the helper text keeps its place. Setting it marks the group invalid; Field's spec owns the wiring. */
|
|
56
|
+
errorText?: React.ReactNode;
|
|
55
57
|
/** Marks the group required and renders the required marker on its label */
|
|
56
58
|
required?: boolean;
|
|
57
59
|
/**
|
|
@@ -82,6 +82,7 @@ const RadioGroup = React.forwardRef(
|
|
|
82
82
|
label,
|
|
83
83
|
helperText,
|
|
84
84
|
error = false,
|
|
85
|
+
errorText,
|
|
85
86
|
required = false,
|
|
86
87
|
value: valueProp,
|
|
87
88
|
defaultValue,
|
|
@@ -102,7 +103,8 @@ const RadioGroup = React.forwardRef(
|
|
|
102
103
|
const generatedId = useId();
|
|
103
104
|
const groupId = id || generatedId;
|
|
104
105
|
const labelId = label ? `${groupId}-label` : void 0;
|
|
105
|
-
const
|
|
106
|
+
const hasErrorText = errorText != null && errorText !== false && errorText !== "";
|
|
107
|
+
const describedBy = [hasErrorText ? `${groupId}-error` : void 0, helperText ? `${groupId}-helper` : void 0].filter(Boolean).join(" ") || rest["aria-describedby"];
|
|
106
108
|
const handleSelect = (next) => {
|
|
107
109
|
if (!isControlled) setInternalValue(next);
|
|
108
110
|
onValueChange?.(next);
|
|
@@ -132,13 +134,14 @@ const RadioGroup = React.forwardRef(
|
|
|
132
134
|
group: true,
|
|
133
135
|
label,
|
|
134
136
|
helperText,
|
|
137
|
+
errorText,
|
|
135
138
|
error,
|
|
136
139
|
required,
|
|
137
140
|
id: groupId,
|
|
138
141
|
role: "radiogroup",
|
|
139
142
|
"aria-labelledby": labelId,
|
|
140
143
|
"aria-describedby": describedBy,
|
|
141
|
-
"aria-invalid": error || void 0,
|
|
144
|
+
"aria-invalid": error || hasErrorText || void 0,
|
|
142
145
|
children: /* @__PURE__ */ jsx("div", { className: `${baseClass}__options`, onKeyDown: handleOptionsKeyDown, children: options.map((option) => /* @__PURE__ */ jsx(
|
|
143
146
|
RadioButton,
|
|
144
147
|
{
|
|
@@ -197,4 +197,16 @@ button.ds-resource-timeline__bar:focus-visible {
|
|
|
197
197
|
--ds-resource-timeline-accent: var(--color-core-accent-mint);
|
|
198
198
|
}
|
|
199
199
|
|
|
200
|
+
/* Loading: the hour grid stays, and each row holds placeholder bars where
|
|
201
|
+
bookings will sit, in the Skeleton fill with no accent edge. */
|
|
202
|
+
|
|
203
|
+
.ds-resource-timeline__bar.ds-resource-timeline__bar--loading {
|
|
204
|
+
position: absolute;
|
|
205
|
+
display: block;
|
|
206
|
+
height: auto;
|
|
207
|
+
padding: 0;
|
|
208
|
+
border: 0;
|
|
209
|
+
background-color: var(--color-bg-container-secondary);
|
|
210
|
+
}
|
|
211
|
+
|
|
200
212
|
} /* @layer rift.components */
|
|
@@ -41,6 +41,10 @@ type ResourceTimelineOwnProps = {
|
|
|
41
41
|
onBarClick?: (bar: ResourceTimelineBar, row: ResourceTimelineRow) => void;
|
|
42
42
|
/** The BCP 47 locale the times are written in, such as `de-DE`. Defaults to `en-US`. This component can render from a Server Component, so it takes the prop alone and reads no LocaleProvider. */
|
|
43
43
|
locale?: string;
|
|
44
|
+
/** Holds placeholder rows, a label line beside placeholder bars on the hour grid, while the rows are being fetched: as many as `rows` holds, or four when it is empty. The axis stays. */
|
|
45
|
+
loading?: boolean;
|
|
46
|
+
/** Accessible name announced while `loading`. */
|
|
47
|
+
loadingLabel?: string;
|
|
44
48
|
/** Additional CSS classes */
|
|
45
49
|
className?: string;
|
|
46
50
|
};
|
|
@@ -53,5 +57,5 @@ export interface ResourceTimelineProps extends ResourceTimelineOwnProps, Omit<Re
|
|
|
53
57
|
* and its label sits on the calendar's event fill, so it reads in every
|
|
54
58
|
* theme whatever the accent. Server-renderable.
|
|
55
59
|
*/
|
|
56
|
-
export declare function ResourceTimeline({ rows, startHour, endHour, now, label, rowHeaderLabel, onBarClick, locale, className, style, ref, ...rest }: ResourceTimelineProps): React.JSX.Element;
|
|
60
|
+
export declare function ResourceTimeline({ rows, startHour, endHour, now, label, rowHeaderLabel, onBarClick, locale, loading, loadingLabel, className, style, ref, ...rest }: ResourceTimelineProps): React.JSX.Element;
|
|
57
61
|
export {};
|
|
@@ -4,7 +4,14 @@ import { DEFAULT_LOCALE, plainSpaces } from "../../behaviors/locale.js";
|
|
|
4
4
|
import { ScrollRegion } from "../../behaviors/ScrollRegion.js";
|
|
5
5
|
import "../../behaviors/visually-hidden.css";
|
|
6
6
|
import "../../behaviors/direction.css";
|
|
7
|
+
import { Skeleton } from "../Skeleton/Skeleton.js";
|
|
7
8
|
import "./ResourceTimeline.css";
|
|
9
|
+
const LOADING_BARS = [
|
|
10
|
+
[[6, 26], [48, 18]],
|
|
11
|
+
[[22, 34]],
|
|
12
|
+
[[10, 16], [38, 30]],
|
|
13
|
+
[[30, 22], [64, 20]]
|
|
14
|
+
];
|
|
8
15
|
const minutesOf = (time) => {
|
|
9
16
|
const match = /^(\d{1,2}):(\d{2})$/.exec(time);
|
|
10
17
|
if (!match) return null;
|
|
@@ -19,6 +26,8 @@ function ResourceTimeline({
|
|
|
19
26
|
rowHeaderLabel = "Name",
|
|
20
27
|
onBarClick,
|
|
21
28
|
locale = DEFAULT_LOCALE,
|
|
29
|
+
loading = false,
|
|
30
|
+
loadingLabel = "Loading",
|
|
22
31
|
className = "",
|
|
23
32
|
style,
|
|
24
33
|
ref,
|
|
@@ -64,62 +73,95 @@ function ResourceTimeline({
|
|
|
64
73
|
h
|
|
65
74
|
)) })
|
|
66
75
|
] }),
|
|
67
|
-
/* @__PURE__ */
|
|
68
|
-
/* @__PURE__ */
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
"span",
|
|
76
|
+
/* @__PURE__ */ jsxs("ul", { className: "ds-resource-timeline__rows", "aria-busy": loading || void 0, children: [
|
|
77
|
+
loading && Array.from({ length: rows.length || 4 }, (_, index) => /* @__PURE__ */ jsxs("li", { className: "ds-resource-timeline__row ds-resource-timeline__row--loading", children: [
|
|
78
|
+
/* @__PURE__ */ jsx("span", { className: "ds-resource-timeline__label", children: /* @__PURE__ */ jsx(
|
|
79
|
+
Skeleton,
|
|
72
80
|
{
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
"aria-hidden":
|
|
76
|
-
},
|
|
77
|
-
h
|
|
78
|
-
)),
|
|
79
|
-
nowMinutes !== null && nowMinutes >= from && nowMinutes <= to && /* @__PURE__ */ jsx(
|
|
80
|
-
"span",
|
|
81
|
-
{
|
|
82
|
-
className: "ds-resource-timeline__now",
|
|
83
|
-
style: { insetInlineStart: `${at(nowMinutes)}%` },
|
|
84
|
-
"aria-hidden": "true"
|
|
81
|
+
variant: "text",
|
|
82
|
+
width: "70%",
|
|
83
|
+
...index === 0 ? { loadingLabel } : { "aria-hidden": true }
|
|
85
84
|
}
|
|
86
|
-
),
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
/* @__PURE__ */ jsx(
|
|
100
|
-
"span",
|
|
101
|
-
{
|
|
102
|
-
className: "ds-resource-timeline__bar-label",
|
|
103
|
-
"aria-hidden": "true",
|
|
104
|
-
children: bar.label ?? range(start, end)
|
|
105
|
-
}
|
|
106
|
-
),
|
|
107
|
-
/* @__PURE__ */ jsx("span", { className: "ds-visually-hidden", children: name })
|
|
108
|
-
] });
|
|
109
|
-
return onBarClick ? /* @__PURE__ */ jsx(
|
|
110
|
-
"button",
|
|
85
|
+
) }),
|
|
86
|
+
/* @__PURE__ */ jsxs("div", { className: "ds-resource-timeline__track", children: [
|
|
87
|
+
hours.map((h) => /* @__PURE__ */ jsx(
|
|
88
|
+
"span",
|
|
89
|
+
{
|
|
90
|
+
className: "ds-resource-timeline__gridline",
|
|
91
|
+
style: { insetInlineStart: `${at(h * 60)}%` },
|
|
92
|
+
"aria-hidden": "true"
|
|
93
|
+
},
|
|
94
|
+
h
|
|
95
|
+
)),
|
|
96
|
+
LOADING_BARS[index % LOADING_BARS.length].map(([start, size]) => /* @__PURE__ */ jsx(
|
|
97
|
+
Skeleton,
|
|
111
98
|
{
|
|
112
|
-
|
|
113
|
-
className:
|
|
114
|
-
style:
|
|
115
|
-
|
|
116
|
-
children: content
|
|
99
|
+
variant: "rectangular",
|
|
100
|
+
className: "ds-resource-timeline__bar ds-resource-timeline__bar--loading",
|
|
101
|
+
style: { insetInlineStart: `${start}%`, inlineSize: `${size}%` },
|
|
102
|
+
"aria-hidden": "true"
|
|
117
103
|
},
|
|
118
|
-
|
|
119
|
-
)
|
|
120
|
-
})
|
|
121
|
-
] })
|
|
122
|
-
|
|
104
|
+
start
|
|
105
|
+
))
|
|
106
|
+
] })
|
|
107
|
+
] }, index)),
|
|
108
|
+
!loading && rows.map((row) => /* @__PURE__ */ jsxs("li", { className: "ds-resource-timeline__row", children: [
|
|
109
|
+
/* @__PURE__ */ jsx("span", { className: "ds-resource-timeline__label", children: row.label }),
|
|
110
|
+
/* @__PURE__ */ jsxs("div", { className: "ds-resource-timeline__track", children: [
|
|
111
|
+
hours.map((h) => /* @__PURE__ */ jsx(
|
|
112
|
+
"span",
|
|
113
|
+
{
|
|
114
|
+
className: "ds-resource-timeline__gridline",
|
|
115
|
+
style: { insetInlineStart: `${at(h * 60)}%` },
|
|
116
|
+
"aria-hidden": "true"
|
|
117
|
+
},
|
|
118
|
+
h
|
|
119
|
+
)),
|
|
120
|
+
nowMinutes !== null && nowMinutes >= from && nowMinutes <= to && /* @__PURE__ */ jsx(
|
|
121
|
+
"span",
|
|
122
|
+
{
|
|
123
|
+
className: "ds-resource-timeline__now",
|
|
124
|
+
style: { insetInlineStart: `${at(nowMinutes)}%` },
|
|
125
|
+
"aria-hidden": "true"
|
|
126
|
+
}
|
|
127
|
+
),
|
|
128
|
+
row.bars.map((bar) => {
|
|
129
|
+
const start = minutesOf(bar.start);
|
|
130
|
+
const end = minutesOf(bar.end);
|
|
131
|
+
if (start === null || end === null || end <= start)
|
|
132
|
+
return null;
|
|
133
|
+
const name = `${row.label}, ${bar.label ? `${bar.label}, ` : ""}${range(start, end)}`;
|
|
134
|
+
const barClass = `ds-resource-timeline__bar ds-resource-timeline__bar--${bar.color ?? "neutral"}`;
|
|
135
|
+
const barStyle = {
|
|
136
|
+
insetInlineStart: `${at(start)}%`,
|
|
137
|
+
inlineSize: `${at(end) - at(start)}%`
|
|
138
|
+
};
|
|
139
|
+
const content = /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
140
|
+
/* @__PURE__ */ jsx(
|
|
141
|
+
"span",
|
|
142
|
+
{
|
|
143
|
+
className: "ds-resource-timeline__bar-label",
|
|
144
|
+
"aria-hidden": "true",
|
|
145
|
+
children: bar.label ?? range(start, end)
|
|
146
|
+
}
|
|
147
|
+
),
|
|
148
|
+
/* @__PURE__ */ jsx("span", { className: "ds-visually-hidden", children: name })
|
|
149
|
+
] });
|
|
150
|
+
return onBarClick ? /* @__PURE__ */ jsx(
|
|
151
|
+
"button",
|
|
152
|
+
{
|
|
153
|
+
type: "button",
|
|
154
|
+
className: barClass,
|
|
155
|
+
style: barStyle,
|
|
156
|
+
onClick: () => onBarClick(bar, row),
|
|
157
|
+
children: content
|
|
158
|
+
},
|
|
159
|
+
bar.id
|
|
160
|
+
) : /* @__PURE__ */ jsx("span", { className: barClass, style: barStyle, children: content }, bar.id);
|
|
161
|
+
})
|
|
162
|
+
] })
|
|
163
|
+
] }, row.id))
|
|
164
|
+
] })
|
|
123
165
|
] })
|
|
124
166
|
}
|
|
125
167
|
);
|
|
@@ -222,7 +222,9 @@
|
|
|
222
222
|
ERROR STATE
|
|
223
223
|
============================================ */
|
|
224
224
|
|
|
225
|
-
|
|
225
|
+
/* The hover rule above is more specific, so the error border names it too. */
|
|
226
|
+
.ds-rich-dropdown--error .ds-rich-dropdown__trigger,
|
|
227
|
+
.ds-rich-dropdown--error .ds-rich-dropdown__trigger:hover:not(:focus-visible) {
|
|
226
228
|
border-color: var(--color-status-error-border);
|
|
227
229
|
}
|
|
228
230
|
|
|
@@ -98,6 +98,8 @@
|
|
|
98
98
|
flex-direction: column;
|
|
99
99
|
gap: var(--gap-050); /* 4px */
|
|
100
100
|
min-width: 0;
|
|
101
|
+
/* Takes the row, so a heading's meta reaches the end of the line. */
|
|
102
|
+
flex: 1 1 auto;
|
|
101
103
|
}
|
|
102
104
|
|
|
103
105
|
.ds-selection-card__label {
|
|
@@ -118,6 +120,33 @@
|
|
|
118
120
|
color: var(--color-text-secondary);
|
|
119
121
|
}
|
|
120
122
|
|
|
123
|
+
/* ============================================
|
|
124
|
+
HEADING — the label's line when a card carries
|
|
125
|
+
a badge or meta: the badge sits beside the
|
|
126
|
+
label, the meta at the line's end.
|
|
127
|
+
============================================ */
|
|
128
|
+
|
|
129
|
+
.ds-selection-card__heading {
|
|
130
|
+
display: flex;
|
|
131
|
+
flex-wrap: wrap;
|
|
132
|
+
align-items: center;
|
|
133
|
+
gap: var(--gap-050) var(--gap-200);
|
|
134
|
+
}
|
|
135
|
+
|
|
136
|
+
.ds-selection-card__badge {
|
|
137
|
+
display: inline-flex;
|
|
138
|
+
}
|
|
139
|
+
|
|
140
|
+
.ds-selection-card__meta {
|
|
141
|
+
margin-inline-start: auto;
|
|
142
|
+
font-family: var(--font-paragraph-emphasis-family);
|
|
143
|
+
font-size: var(--font-paragraph-emphasis-size);
|
|
144
|
+
font-weight: var(--font-paragraph-emphasis-weight);
|
|
145
|
+
line-height: var(--font-paragraph-emphasis-line-height);
|
|
146
|
+
letter-spacing: var(--font-paragraph-emphasis-letter-spacing);
|
|
147
|
+
color: var(--color-text-primary);
|
|
148
|
+
}
|
|
149
|
+
|
|
121
150
|
/* ============================================
|
|
122
151
|
INDICATOR — the control's own, seated at the end
|
|
123
152
|
============================================ */
|
|
@@ -6,6 +6,13 @@ export interface SelectionCardOption {
|
|
|
6
6
|
label: string;
|
|
7
7
|
/** Optional description text below the label */
|
|
8
8
|
description?: string;
|
|
9
|
+
/**
|
|
10
|
+
* Content at the end of the label's line, set apart from it: a price, a
|
|
11
|
+
* plan's seat count, a figure. Read as part of the card's name.
|
|
12
|
+
*/
|
|
13
|
+
meta?: React.ReactNode;
|
|
14
|
+
/** A mark beside the label, such as a `Badge` saying "Current". Read as part of the card's name. */
|
|
15
|
+
badge?: React.ReactNode;
|
|
9
16
|
/** Whether this option is disabled */
|
|
10
17
|
disabled?: boolean;
|
|
11
18
|
}
|
|
@@ -4,6 +4,7 @@ import React from "react";
|
|
|
4
4
|
import { CheckboxIndicator } from "../Checkbox/Checkbox.js";
|
|
5
5
|
import { RadioIndicator } from "../RadioButton/RadioButton.js";
|
|
6
6
|
import { SwitchIndicator } from "../ToggleSwitch/ToggleSwitch.js";
|
|
7
|
+
import { logicalArrowKey } from "../../behaviors/direction.js";
|
|
7
8
|
import "./SelectionCard.css";
|
|
8
9
|
const SelectionCard = React.forwardRef(
|
|
9
10
|
({
|
|
@@ -34,8 +35,26 @@ const SelectionCard = React.forwardRef(
|
|
|
34
35
|
if (e.key === " " || e.key === "Enter") {
|
|
35
36
|
e.preventDefault();
|
|
36
37
|
handleSelect(option);
|
|
38
|
+
return;
|
|
37
39
|
}
|
|
40
|
+
if (mode !== "radio") return;
|
|
41
|
+
const group = e.currentTarget.parentElement;
|
|
42
|
+
if (!group) return;
|
|
43
|
+
const cards = Array.from(
|
|
44
|
+
group.querySelectorAll(':scope > [role="radio"]:not([aria-disabled="true"])')
|
|
45
|
+
);
|
|
46
|
+
const enabledOptions = options.filter((item) => !item.disabled);
|
|
47
|
+
const at = cards.indexOf(e.currentTarget);
|
|
48
|
+
if (at === -1 || cards.length !== enabledOptions.length) return;
|
|
49
|
+
const key = logicalArrowKey(e.key, group);
|
|
50
|
+
const to = key === "ArrowRight" || key === "ArrowDown" ? (at + 1) % cards.length : key === "ArrowLeft" || key === "ArrowUp" ? (at - 1 + cards.length) % cards.length : key === "Home" ? 0 : key === "End" ? cards.length - 1 : -1;
|
|
51
|
+
if (to === -1) return;
|
|
52
|
+
e.preventDefault();
|
|
53
|
+
cards[to].focus();
|
|
54
|
+
handleSelect(enabledOptions[to]);
|
|
38
55
|
};
|
|
56
|
+
const firstEnabled = options.find((item) => !item.disabled);
|
|
57
|
+
const radioTabStop = options.find((item) => !item.disabled && isSelected(item.value))?.value ?? firstEnabled?.value;
|
|
39
58
|
const groupRole = mode === "radio" ? "radiogroup" : "group";
|
|
40
59
|
const itemRole = mode === "radio" ? "radio" : mode === "toggle" ? "switch" : "checkbox";
|
|
41
60
|
const groupClasses = [`${baseClass}-group`, className].filter(Boolean).join(" ");
|
|
@@ -62,12 +81,16 @@ const SelectionCard = React.forwardRef(
|
|
|
62
81
|
role: itemRole,
|
|
63
82
|
"aria-checked": selected,
|
|
64
83
|
"aria-disabled": option.disabled,
|
|
65
|
-
tabIndex: option.disabled ? -1 : 0,
|
|
84
|
+
tabIndex: option.disabled || mode === "radio" && option.value !== radioTabStop ? -1 : 0,
|
|
66
85
|
onClick: () => handleSelect(option),
|
|
67
86
|
onKeyDown: (e) => handleKeyDown(e, option),
|
|
68
87
|
children: [
|
|
69
88
|
/* @__PURE__ */ jsxs("div", { className: `${baseClass}__content`, children: [
|
|
70
|
-
/* @__PURE__ */
|
|
89
|
+
option.meta || option.badge ? /* @__PURE__ */ jsxs("span", { className: `${baseClass}__heading`, children: [
|
|
90
|
+
/* @__PURE__ */ jsx("span", { className: `${baseClass}__label`, children: option.label }),
|
|
91
|
+
option.badge && /* @__PURE__ */ jsx("span", { className: `${baseClass}__badge`, children: option.badge }),
|
|
92
|
+
option.meta && /* @__PURE__ */ jsx("span", { className: `${baseClass}__meta`, children: option.meta })
|
|
93
|
+
] }) : /* @__PURE__ */ jsx("span", { className: `${baseClass}__label`, children: option.label }),
|
|
71
94
|
option.description && /* @__PURE__ */ jsx("span", { className: `${baseClass}__description`, children: option.description })
|
|
72
95
|
] }),
|
|
73
96
|
/* @__PURE__ */ jsx("div", { className: `${baseClass}__indicator`, children: mode === "radio" ? /* @__PURE__ */ jsx(RadioIndicator, { checked: selected }) : mode === "toggle" ? /* @__PURE__ */ jsx(SwitchIndicator, { checked: selected }) : /* @__PURE__ */ jsx(CheckboxIndicator, { checked: selected }) }),
|