rift-ds 1.28.0 → 1.30.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 +5 -4
- package/bin/rift-ds.mjs +5 -4
- package/bin/templates/app/components/rift/ColorModeScript.tsx +7 -3
- package/bin/templates/blocks/app/settings/ProfileForm.tsx +98 -0
- package/bin/templates/blocks/app/settings/page.module.css +11 -0
- package/bin/templates/blocks/app/settings/page.tsx +84 -0
- package/bin/templates/blocks/app/shader/page.module.css +75 -0
- package/bin/templates/blocks/app/shader/page.tsx +81 -0
- package/bin/templates/blocks/components/blocks/AppShell.module.css +8 -41
- package/bin/templates/blocks/components/blocks/AppShell.tsx +9 -11
- package/bin/templates/blocks/components/blocks/emberScene.ts +53 -0
- package/bin/templates/blocks/registry.json +24 -0
- package/bin/templates/chat/app/api/chat/feedback/route.ts +0 -3
- package/bin/templates/chat/app/api/chat/followups/route.ts +0 -3
- package/bin/templates/chat/app/api/chat/route.ts +0 -2
- package/chat/ChatLauncher.d.ts +9 -1
- package/chat/ChatLauncher.js +3 -1
- package/chat/threads.js +7 -4
- package/components/Alert/Alert.css +12 -0
- package/components/Alert/Alert.d.ts +2 -0
- package/components/Alert/Alert.js +3 -1
- package/components/Attachment/Attachment.css +92 -0
- package/components/Attachment/FileRow.d.ts +47 -0
- package/components/Attachment/FileRow.js +38 -0
- package/components/Avatar/Avatar.css +14 -0
- package/components/Avatar/Avatar.d.ts +3 -1
- package/components/Avatar/Avatar.js +3 -2
- package/components/Button/Button.css +38 -0
- package/components/Button/Button.d.ts +8 -0
- package/components/Button/Button.js +2 -0
- package/components/Chart/AreaChart.d.ts +2 -0
- package/components/Chart/AreaChart.js +2 -1
- package/components/Chart/BarChart.d.ts +2 -0
- package/components/Chart/BarChart.js +2 -1
- package/components/Chart/ComboChart.d.ts +4 -0
- package/components/Chart/ComboChart.js +4 -2
- package/components/Chart/LineChart.d.ts +2 -0
- package/components/Chart/LineChart.js +2 -1
- package/components/Chart/PieChart.d.ts +4 -4
- package/components/Chart/PieChart.js +1 -1
- package/components/Chart/ScatterChart.d.ts +2 -0
- package/components/Chart/ScatterChart.js +2 -1
- package/components/Checklist/Checklist.css +123 -0
- package/components/Checklist/Checklist.d.ts +66 -0
- package/components/Checklist/Checklist.js +115 -0
- package/components/CircularButton/CircularButton.css +39 -0
- package/components/CircularButton/CircularButton.d.ts +13 -0
- package/components/CircularButton/CircularButton.js +18 -4
- package/components/ColourSwatch/ColourSwatch.css +3 -1
- package/components/ColourSwatch/ColourSwatch.d.ts +5 -3
- package/components/ColourSwatch/ColourSwatch.js +5 -0
- package/components/Combobox/Combobox.d.ts +4 -2
- package/components/Combobox/Combobox.js +7 -3
- package/components/DataTable/DataTable.css +35 -0
- package/components/DataTable/DataTable.d.ts +34 -2
- package/components/DataTable/DataTable.js +58 -5
- package/components/DataTable/columnTypes.d.ts +1 -1
- package/components/DataTable/columnTypes.js +1 -1
- package/components/DateInput/DateInput.d.ts +4 -2
- package/components/DateInput/DateInput.js +7 -3
- package/components/DescriptionList/DescriptionList.css +28 -0
- package/components/DescriptionList/DescriptionList.d.ts +3 -1
- package/components/DescriptionList/DescriptionList.js +4 -3
- package/components/DescriptionList/DescriptionListCopy.js +2 -0
- package/components/Dropdown/Dropdown.d.ts +4 -2
- package/components/Dropdown/Dropdown.js +7 -3
- package/components/EmptyState/EmptyState.css +12 -0
- package/components/EmptyState/EmptyState.d.ts +7 -0
- package/components/EmptyState/EmptyState.js +2 -0
- package/components/EventCalendar/EventCalendar.css +59 -0
- package/components/EventCalendar/EventCalendar.d.ts +24 -2
- package/components/EventCalendar/EventCalendar.js +104 -19
- package/components/FormSection/FormSection.css +70 -0
- package/components/FormSection/FormSection.d.ts +35 -0
- package/components/FormSection/FormSection.js +35 -0
- package/components/Grid/Grid.css +52 -0
- package/components/Grid/Grid.d.ts +30 -0
- package/components/Grid/Grid.js +36 -0
- package/components/Icon/Icon.css +55 -0
- package/components/Icon/Icon.d.ts +27 -0
- package/components/Icon/Icon.js +42 -0
- package/components/NumberInput/NumberInput.d.ts +4 -2
- package/components/NumberInput/NumberInput.js +7 -3
- package/components/OrgChart/OrgChart.css +143 -0
- package/components/OrgChart/OrgChart.d.ts +44 -0
- package/components/OrgChart/OrgChart.js +26 -0
- package/components/PageHeader/PageHeader.css +74 -0
- package/components/PageHeader/PageHeader.d.ts +39 -0
- package/components/PageHeader/PageHeader.js +33 -0
- package/components/Panel/Panel.css +7 -0
- package/components/Panel/Panel.d.ts +5 -2
- package/components/Panel/Panel.js +2 -1
- package/components/ResourceTimeline/ResourceTimeline.css +194 -0
- package/components/ResourceTimeline/ResourceTimeline.d.ts +57 -0
- package/components/ResourceTimeline/ResourceTimeline.js +129 -0
- package/components/ShaderField/useShaderField.js +13 -1
- package/components/ShaderScene/ShaderScene.d.ts +39 -15
- package/components/ShaderScene/ShaderScene.js +87 -6
- package/components/ShaderScene/assemble.d.ts +10 -3
- package/components/ShaderScene/assemble.js +29 -0
- package/components/ShaderScene/renderer.d.ts +12 -4
- package/components/ShaderScene/renderer.js +32 -20
- package/components/ShaderScene/scenes.d.ts +78 -0
- package/components/ShaderScene/scenes.js +933 -1
- package/components/ShaderScene/types.d.ts +52 -23
- package/components/Stack/Stack.css +68 -0
- package/components/Stack/Stack.d.ts +37 -0
- package/components/Stack/Stack.js +39 -0
- package/components/Stat/Stat.css +65 -0
- package/components/Stat/Stat.d.ts +7 -1
- package/components/Stat/Stat.js +16 -1
- package/components/Table/Table.css +11 -0
- package/components/Table/Table.d.ts +2 -0
- package/components/Table/Table.js +5 -1
- package/components/Tabs/Tabs.css +23 -0
- package/components/Tabs/Tabs.d.ts +9 -8
- package/components/Tabs/Tabs.js +38 -5
- package/components/Textarea/Textarea.d.ts +4 -2
- package/components/Textarea/Textarea.js +7 -3
- package/components/ThemeToggle/colorMode.d.ts +17 -1
- package/components/ThemeToggle/colorMode.js +11 -2
- package/components/Widget/Widget.css +21 -0
- package/components/Widget/Widget.d.ts +4 -0
- package/components/Widget/Widget.js +13 -5
- package/components/Wizard/Wizard.css +67 -0
- package/components/Wizard/Wizard.d.ts +54 -0
- package/components/Wizard/Wizard.js +71 -0
- package/components/registry.d.ts +25 -0
- package/components/registry.js +8 -0
- package/components/registry.json +234 -33
- package/components/registry.json.d.ts +234 -33
- package/components/registry.json.js +1 -1
- package/index.d.ts +10 -0
- package/index.js +20 -0
- package/package.json +1 -1
- package/tokens/motion.d.ts +2 -0
- package/tokens/motion.js +2 -0
- package/tokens/values.d.ts +31 -0
- package/tokens/values.js +16 -0
- package/tokens/values.json.js +1 -1
|
@@ -169,7 +169,7 @@ function withType(col, locale) {
|
|
|
169
169
|
}
|
|
170
170
|
function DataTable({
|
|
171
171
|
columns: columnsProp,
|
|
172
|
-
rows,
|
|
172
|
+
rows: rowsProp,
|
|
173
173
|
pageSize: pageSizeProp,
|
|
174
174
|
defaultPageSize,
|
|
175
175
|
onPageSizeChange,
|
|
@@ -207,6 +207,8 @@ function DataTable({
|
|
|
207
207
|
defaultTotals,
|
|
208
208
|
onTotalsChange,
|
|
209
209
|
linkComponent,
|
|
210
|
+
rowHref,
|
|
211
|
+
onRowClick,
|
|
210
212
|
searchable = false,
|
|
211
213
|
searchPlaceholder = "Search",
|
|
212
214
|
toolbar,
|
|
@@ -278,6 +280,15 @@ function DataTable({
|
|
|
278
280
|
ref,
|
|
279
281
|
...rest
|
|
280
282
|
}) {
|
|
283
|
+
const rows = useMemo(() => {
|
|
284
|
+
const computed = columnsProp.filter((col) => col.compute);
|
|
285
|
+
if (computed.length === 0) return rowsProp;
|
|
286
|
+
return rowsProp.map((row) => {
|
|
287
|
+
const values = { ...row.values };
|
|
288
|
+
for (const col of computed) values[col.key] = col.compute(values);
|
|
289
|
+
return { ...row, values };
|
|
290
|
+
});
|
|
291
|
+
}, [rowsProp, columnsProp]);
|
|
281
292
|
const baseClass = "ds-data-table";
|
|
282
293
|
const locale = useLocale(localeProp);
|
|
283
294
|
const collator = useMemo(() => textCollator(locale), [locale]);
|
|
@@ -578,7 +589,11 @@ function DataTable({
|
|
|
578
589
|
const compare = typedComparator(groupCol.type, groupCol.options, compareValues);
|
|
579
590
|
const desc = sortOf(groupKey)?.direction === "desc";
|
|
580
591
|
const first = (key) => byValue.get(key)[0].values[groupKey];
|
|
592
|
+
const listed = groupCol.groupOrder ?? [];
|
|
581
593
|
const keys = [...byValue.keys()].sort((a, b) => {
|
|
594
|
+
const ia = listed.indexOf(a);
|
|
595
|
+
const ib = listed.indexOf(b);
|
|
596
|
+
if (ia !== -1 || ib !== -1) return ia === -1 ? 1 : ib === -1 ? -1 : ia - ib;
|
|
582
597
|
if (a === "" || b === "") return a === "" ? b === "" ? 0 : 1 : -1;
|
|
583
598
|
const order = compare(first(a), first(b));
|
|
584
599
|
return desc ? -order : order;
|
|
@@ -1287,8 +1302,12 @@ function DataTable({
|
|
|
1287
1302
|
const kind = kindOf$1(col);
|
|
1288
1303
|
return kind !== void 0 && LIVE_KINDS.has(kind);
|
|
1289
1304
|
};
|
|
1290
|
-
const canEdit = (col, row) => Boolean(col?.editor) && (typeof col?.editable === "function" ? col.editable(row) : col?.editable ?? true);
|
|
1291
|
-
const valueOf = (row, key) =>
|
|
1305
|
+
const canEdit = (col, row) => !col?.compute && Boolean(col?.editor) && (typeof col?.editable === "function" ? col.editable(row) : col?.editable ?? true);
|
|
1306
|
+
const valueOf = (row, key) => {
|
|
1307
|
+
const compute = byKey.get(key)?.compute;
|
|
1308
|
+
if (compute && pending[row.id]) return compute({ ...row.values, ...pending[row.id] });
|
|
1309
|
+
return pending[row.id] && key in pending[row.id] ? pending[row.id][key] : row.values[key];
|
|
1310
|
+
};
|
|
1292
1311
|
const rowView = (row) => pending[row.id] ? { ...row, values: { ...row.values, ...pending[row.id] } } : row;
|
|
1293
1312
|
const sameValue = (a, b) => JSON.stringify(a ?? null) === JSON.stringify(b ?? null);
|
|
1294
1313
|
const isThenable = (value) => typeof value?.then === "function";
|
|
@@ -1423,6 +1442,26 @@ function DataTable({
|
|
|
1423
1442
|
commitEdit("none");
|
|
1424
1443
|
};
|
|
1425
1444
|
const linkEl = useLinkComponent(linkComponent);
|
|
1445
|
+
const RowLink = linkEl;
|
|
1446
|
+
const actionKey = rowHeaderKey ?? visibleKeys[0];
|
|
1447
|
+
const followRowAction = (event) => {
|
|
1448
|
+
if (event.defaultPrevented || editing) return;
|
|
1449
|
+
const target = event.target;
|
|
1450
|
+
if (target.closest('a, button, input, select, textarea, label, [role="checkbox"], [role="switch"], [data-cell-control], [contenteditable="true"]'))
|
|
1451
|
+
return;
|
|
1452
|
+
if (window.getSelection()?.toString()) return;
|
|
1453
|
+
const control = event.currentTarget.querySelector(`.${baseClass}__row-link`);
|
|
1454
|
+
control?.dispatchEvent(
|
|
1455
|
+
new MouseEvent("click", {
|
|
1456
|
+
bubbles: true,
|
|
1457
|
+
cancelable: true,
|
|
1458
|
+
ctrlKey: event.ctrlKey,
|
|
1459
|
+
metaKey: event.metaKey,
|
|
1460
|
+
shiftKey: event.shiftKey,
|
|
1461
|
+
altKey: event.altKey
|
|
1462
|
+
})
|
|
1463
|
+
);
|
|
1464
|
+
};
|
|
1426
1465
|
const typedWords = { checked: labels.checkedValue, unchecked: labels.uncheckedValue, more: labels.moreValues };
|
|
1427
1466
|
const optionLabel = (col) => (v) => col.options?.find((option) => option.value === v)?.label ?? v;
|
|
1428
1467
|
const numericColumn = (col) => col.type === "number" || col.type === "currency" || col.type === "progress" || !col.type && rows.some((row) => typeof row.values[col.key] === "number") && rows.every((row) => row.values[col.key] == null || typeof row.values[col.key] === "number");
|
|
@@ -1933,6 +1972,8 @@ function DataTable({
|
|
|
1933
1972
|
const name = rowName(row);
|
|
1934
1973
|
const expandedHere = Boolean(renderDetail) && expandedState.includes(row.id);
|
|
1935
1974
|
const detailId = `${tableId}-detail-${row.id}`;
|
|
1975
|
+
const href = rowHref?.(rowView(row));
|
|
1976
|
+
const rowAction = href !== void 0 || Boolean(onRowClick);
|
|
1936
1977
|
const record = /* @__PURE__ */ jsxs(
|
|
1937
1978
|
"tr",
|
|
1938
1979
|
{
|
|
@@ -1941,8 +1982,10 @@ function DataTable({
|
|
|
1941
1982
|
"data-index": slot && part === "record" ? slot.index : void 0,
|
|
1942
1983
|
"aria-rowindex": slot && part === "record" ? slot.index + 2 : void 0,
|
|
1943
1984
|
role: stacked ? "row" : void 0,
|
|
1985
|
+
onClick: rowAction ? followRowAction : void 0,
|
|
1944
1986
|
className: [
|
|
1945
1987
|
"ds-table__row",
|
|
1988
|
+
rowAction ? `${baseClass}__row--action` : "",
|
|
1946
1989
|
isSelected ? "ds-table__row--selected" : "",
|
|
1947
1990
|
editMode === "row" && editing?.row === row.id ? `${baseClass}__row--editing` : ""
|
|
1948
1991
|
].filter(Boolean).join(" "),
|
|
@@ -2085,13 +2128,23 @@ function DataTable({
|
|
|
2085
2128
|
link: linkEl
|
|
2086
2129
|
}
|
|
2087
2130
|
) : displayOf(col, raw);
|
|
2088
|
-
|
|
2131
|
+
const linked = rowAction && key === actionKey && !editingHere ? href !== void 0 ? /* @__PURE__ */ jsx(RowLink, { href, className: `${baseClass}__row-link`, tabIndex: innerTab, children: content }) : /* @__PURE__ */ jsx(
|
|
2132
|
+
"button",
|
|
2133
|
+
{
|
|
2134
|
+
type: "button",
|
|
2135
|
+
className: `${baseClass}__row-link`,
|
|
2136
|
+
tabIndex: innerTab,
|
|
2137
|
+
onClick: () => onRowClick?.(rowView(row)),
|
|
2138
|
+
children: content
|
|
2139
|
+
}
|
|
2140
|
+
) : content;
|
|
2141
|
+
if (fit === "wrap") return linked;
|
|
2089
2142
|
return /* @__PURE__ */ jsx(
|
|
2090
2143
|
"span",
|
|
2091
2144
|
{
|
|
2092
2145
|
className: `${baseClass}__text ${baseClass}__text--${fit}`,
|
|
2093
2146
|
title: fit === "truncate" || fit === "lines-2" ? raw == null ? void 0 : col.type ? typedText(col.type, raw, col.format, optionLabel(col), typedWords) || void 0 : String(displayOf(col, raw)) : void 0,
|
|
2094
|
-
children:
|
|
2147
|
+
children: linked
|
|
2095
2148
|
}
|
|
2096
2149
|
);
|
|
2097
2150
|
})()
|
|
@@ -8,7 +8,7 @@ export interface ColumnFormat {
|
|
|
8
8
|
locale?: string;
|
|
9
9
|
/** ISO 4217 code for a `currency` column. Defaults to `USD`. */
|
|
10
10
|
currency?: string;
|
|
11
|
-
/** Digits after the point for `number`, `currency` and `progress`. Defaults to
|
|
11
|
+
/** Digits after the point for `number`, `currency` and `progress`. Defaults to the currency's own minor units for money (two for USD, none for JPY), none for progress, and up to two for a number. */
|
|
12
12
|
fractionDigits?: number;
|
|
13
13
|
/** How a `date` column reads: `short` (11/04/26), `medium` (Nov 4, 2026), `long` (November 4, 2026) or `relative` (in 3 days). Defaults to `medium`; the full date shows on hover either way. */
|
|
14
14
|
date?: 'short' | 'medium' | 'long' | 'relative';
|
|
@@ -28,7 +28,7 @@ const formatNumber = (type, value, format) => {
|
|
|
28
28
|
const locale = format?.locale ?? DEFAULT_LOCALE;
|
|
29
29
|
const digits = format?.fractionDigits;
|
|
30
30
|
if (type === "currency")
|
|
31
|
-
return formatMoney(value, { currency: format?.currency ?? "USD", locale, fractionDigits: digits
|
|
31
|
+
return formatMoney(value, { currency: format?.currency ?? "USD", locale, fractionDigits: digits });
|
|
32
32
|
if (type === "progress")
|
|
33
33
|
return new Intl.NumberFormat(locale, {
|
|
34
34
|
style: "percent",
|
|
@@ -7,10 +7,12 @@ type DateInputOwnProps = {
|
|
|
7
7
|
value?: string;
|
|
8
8
|
/** Component size (not the native character-width `size` attribute) */
|
|
9
9
|
size?: 'default' | 'compact';
|
|
10
|
-
/** Error state */
|
|
10
|
+
/** Error state: marks the control invalid and, in the older form without `errorText`, recolours the helper text as the error message. */
|
|
11
11
|
error?: boolean;
|
|
12
|
-
/** Helper
|
|
12
|
+
/** Helper text displayed below the control. With the older `error` flag and no `errorText`, it doubles as the error message. */
|
|
13
13
|
helperText?: string;
|
|
14
|
+
/** The error message, shown under the control while the helper text keeps its place. Setting it marks the control invalid, so `error` is not needed alongside it; Field's spec owns the wiring. */
|
|
15
|
+
errorText?: React.ReactNode;
|
|
14
16
|
/** Minimum selectable date (YYYY-MM-DD) */
|
|
15
17
|
min?: string;
|
|
16
18
|
/** Maximum selectable date (YYYY-MM-DD) */
|
|
@@ -14,6 +14,7 @@ const DateInput = React.forwardRef(
|
|
|
14
14
|
required = false,
|
|
15
15
|
error = false,
|
|
16
16
|
helperText,
|
|
17
|
+
errorText,
|
|
17
18
|
min,
|
|
18
19
|
max,
|
|
19
20
|
onChange,
|
|
@@ -25,10 +26,12 @@ const DateInput = React.forwardRef(
|
|
|
25
26
|
...rest
|
|
26
27
|
}, ref) => {
|
|
27
28
|
const baseClass = "ds-date-input";
|
|
29
|
+
const hasErrorText = errorText != null && errorText !== false && errorText !== "";
|
|
30
|
+
const invalid = error || hasErrorText;
|
|
28
31
|
const classes = [
|
|
29
32
|
baseClass,
|
|
30
33
|
`${baseClass}--${size}`,
|
|
31
|
-
|
|
34
|
+
invalid ? `${baseClass}--error` : "",
|
|
32
35
|
disabled ? `${baseClass}--disabled` : "",
|
|
33
36
|
className
|
|
34
37
|
].filter(Boolean).join(" ");
|
|
@@ -43,6 +46,7 @@ const DateInput = React.forwardRef(
|
|
|
43
46
|
className: classes,
|
|
44
47
|
label,
|
|
45
48
|
helperText,
|
|
49
|
+
errorText,
|
|
46
50
|
error,
|
|
47
51
|
required,
|
|
48
52
|
disabled,
|
|
@@ -66,8 +70,8 @@ const DateInput = React.forwardRef(
|
|
|
66
70
|
min,
|
|
67
71
|
max,
|
|
68
72
|
"aria-label": rest["aria-label"] ?? ariaLabel ?? label,
|
|
69
|
-
"aria-invalid":
|
|
70
|
-
"aria-describedby": [rest["aria-describedby"], helperText ? `${inputId}-helper` : void 0].filter(Boolean).join(" ") || void 0,
|
|
73
|
+
"aria-invalid": invalid,
|
|
74
|
+
"aria-describedby": [rest["aria-describedby"], hasErrorText ? `${inputId}-error` : void 0, helperText ? `${inputId}-helper` : void 0].filter(Boolean).join(" ") || void 0,
|
|
71
75
|
onChange: handleChange
|
|
72
76
|
}
|
|
73
77
|
)
|
|
@@ -97,6 +97,34 @@
|
|
|
97
97
|
letter-spacing: var(--font-paragraph-sm-letter-spacing);
|
|
98
98
|
}
|
|
99
99
|
|
|
100
|
+
/* Emphasis: the entry the others add up to, under a rule, its term and
|
|
101
|
+
value in the emphasis weight and the primary text colour. With dividers
|
|
102
|
+
the entry above already draws the rule. */
|
|
103
|
+
.ds-description-list__item--emphasis {
|
|
104
|
+
padding-block-start: var(--padding-300);
|
|
105
|
+
border-block-start: var(--border-025) solid var(--color-divider);
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
.ds-description-list--dividers .ds-description-list__item--emphasis {
|
|
109
|
+
border-block-start: none;
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
.ds-description-list__item--emphasis .ds-description-list__term {
|
|
113
|
+
color: var(--color-text-primary);
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
.ds-description-list--default .ds-description-list__item--emphasis .ds-description-list__term,
|
|
117
|
+
.ds-description-list--default .ds-description-list__item--emphasis .ds-description-list__details {
|
|
118
|
+
font-family: var(--font-paragraph-emphasis-family);
|
|
119
|
+
font-weight: var(--font-paragraph-emphasis-weight);
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
.ds-description-list--compact .ds-description-list__item--emphasis .ds-description-list__term,
|
|
123
|
+
.ds-description-list--compact .ds-description-list__item--emphasis .ds-description-list__details {
|
|
124
|
+
font-family: var(--font-paragraph-sm-emphasis-family);
|
|
125
|
+
font-weight: var(--font-paragraph-sm-emphasis-weight);
|
|
126
|
+
}
|
|
127
|
+
|
|
100
128
|
/* Inline: term and value in two columns, the term a quarter, a third or a half */
|
|
101
129
|
.ds-description-list--inline .ds-description-list__item {
|
|
102
130
|
display: grid;
|
|
@@ -11,6 +11,8 @@ export type DescriptionListEntry = {
|
|
|
11
11
|
action?: React.ReactNode;
|
|
12
12
|
/** Offer a copy button: `true` copies the value when it is text, a string copies that string (the unformatted account number behind a formatted one). */
|
|
13
13
|
copyable?: boolean | string;
|
|
14
|
+
/** Sets the entry apart as the one the others add up to (a total, a balance due): its term and value in the emphasis weight and the primary text colour, under a rule. */
|
|
15
|
+
emphasis?: boolean;
|
|
14
16
|
};
|
|
15
17
|
/** Props owned by DescriptionList itself; everything else falls through to the `<dl>`. */
|
|
16
18
|
type DescriptionListOwnProps = {
|
|
@@ -60,5 +62,5 @@ type DescriptionListItemOwnProps = Omit<DescriptionListEntry, 'id'> & {
|
|
|
60
62
|
export interface DescriptionListItemProps extends DescriptionListItemOwnProps, Omit<React.ComponentPropsWithRef<'div'>, keyof DescriptionListItemOwnProps> {
|
|
61
63
|
}
|
|
62
64
|
/** One term and its value inside a DescriptionList, for a list written out by hand. Server-renderable. */
|
|
63
|
-
export declare function DescriptionListItem({ term, details, children, action, copyable, className, ref, ...rest }: DescriptionListItemProps): React.JSX.Element;
|
|
65
|
+
export declare function DescriptionListItem({ term, details, children, action, copyable, emphasis, className, ref, ...rest }: DescriptionListItemProps): React.JSX.Element;
|
|
64
66
|
export {};
|
|
@@ -5,11 +5,11 @@ import "../../behaviors/visually-hidden.css";
|
|
|
5
5
|
import "./DescriptionList.css";
|
|
6
6
|
const isEmpty = (value) => value == null || value === false || value === "";
|
|
7
7
|
const textOf = (value) => typeof value === "string" || typeof value === "number" ? String(value) : null;
|
|
8
|
-
function renderEntry({ term, details, id, action, copyable }, settings, className = "", rest = {}, ref) {
|
|
8
|
+
function renderEntry({ term, details, id, action, copyable, emphasis }, settings, className = "", rest = {}, ref) {
|
|
9
9
|
const empty = isEmpty(details);
|
|
10
10
|
const copyText = empty ? null : typeof copyable === "string" ? copyable : copyable ? textOf(details) : null;
|
|
11
11
|
const termText = textOf(term);
|
|
12
|
-
const classes = ["ds-description-list__item", className].filter(Boolean).join(" ");
|
|
12
|
+
const classes = ["ds-description-list__item", emphasis && "ds-description-list__item--emphasis", className].filter(Boolean).join(" ");
|
|
13
13
|
return /* @__PURE__ */ jsxs("div", { ...rest, ref, id: id ?? rest.id, className: classes, children: [
|
|
14
14
|
/* @__PURE__ */ jsx("dt", { className: "ds-description-list__term", children: term }),
|
|
15
15
|
/* @__PURE__ */ jsxs("dd", { className: "ds-description-list__details", children: [
|
|
@@ -75,6 +75,7 @@ function DescriptionListItem({
|
|
|
75
75
|
children,
|
|
76
76
|
action,
|
|
77
77
|
copyable,
|
|
78
|
+
emphasis,
|
|
78
79
|
className = "",
|
|
79
80
|
ref,
|
|
80
81
|
...rest
|
|
@@ -87,7 +88,7 @@ function DescriptionListItem({
|
|
|
87
88
|
onValueCopy: passed?.onValueCopy
|
|
88
89
|
};
|
|
89
90
|
return renderEntry(
|
|
90
|
-
{ term, details: details ?? children, action, copyable },
|
|
91
|
+
{ term, details: details ?? children, action, copyable, emphasis },
|
|
91
92
|
settings,
|
|
92
93
|
className,
|
|
93
94
|
divRest,
|
|
@@ -5,6 +5,7 @@ import { CircularButton } from "../CircularButton/CircularButton.js";
|
|
|
5
5
|
import { MOTION_FEEDBACK_RESET_MS } from "../../tokens/motion.js";
|
|
6
6
|
function writeClipboard(text) {
|
|
7
7
|
const fallback = () => {
|
|
8
|
+
const focused = document.activeElement instanceof HTMLElement ? document.activeElement : null;
|
|
8
9
|
const textarea = document.createElement("textarea");
|
|
9
10
|
textarea.value = text;
|
|
10
11
|
textarea.setAttribute("readonly", "");
|
|
@@ -13,6 +14,7 @@ function writeClipboard(text) {
|
|
|
13
14
|
textarea.select();
|
|
14
15
|
document.execCommand("copy");
|
|
15
16
|
document.body.removeChild(textarea);
|
|
17
|
+
focused?.focus({ preventScroll: true });
|
|
16
18
|
};
|
|
17
19
|
if (navigator.clipboard?.writeText) navigator.clipboard.writeText(text).catch(fallback);
|
|
18
20
|
else fallback();
|
|
@@ -49,10 +49,12 @@ type DropdownOwnProps = {
|
|
|
49
49
|
disabled?: boolean;
|
|
50
50
|
/** Whether the dropdown is required */
|
|
51
51
|
required?: boolean;
|
|
52
|
-
/** Error state */
|
|
52
|
+
/** Error state: marks the control invalid and, in the older form without `errorText`, recolours the helper text as the error message. */
|
|
53
53
|
error?: boolean;
|
|
54
|
-
/** Helper
|
|
54
|
+
/** Helper text displayed below the control. With the older `error` flag and no `errorText`, it doubles as the error message. */
|
|
55
55
|
helperText?: string;
|
|
56
|
+
/** The error message, shown under the control while the helper text keeps its place. Setting it marks the control invalid, so `error` is not needed alongside it; Field's spec owns the wiring. */
|
|
57
|
+
errorText?: React.ReactNode;
|
|
56
58
|
/** Called with the newly selected value */
|
|
57
59
|
onValueChange?: (value: string) => void;
|
|
58
60
|
/** Whether the list is open, controlled. Leave undefined to let the dropdown open and close itself. */
|
|
@@ -23,6 +23,7 @@ const Dropdown = React.forwardRef(
|
|
|
23
23
|
required = false,
|
|
24
24
|
error = false,
|
|
25
25
|
helperText,
|
|
26
|
+
errorText,
|
|
26
27
|
onValueChange,
|
|
27
28
|
open: openProp,
|
|
28
29
|
defaultOpen = false,
|
|
@@ -75,11 +76,13 @@ const Dropdown = React.forwardRef(
|
|
|
75
76
|
};
|
|
76
77
|
const baseClass = "ds-dropdown";
|
|
77
78
|
const isGrouped = groups && groups.length > 0;
|
|
79
|
+
const hasErrorText = errorText != null && errorText !== false && errorText !== "";
|
|
80
|
+
const invalid = error || hasErrorText;
|
|
78
81
|
const classes = [
|
|
79
82
|
baseClass,
|
|
80
83
|
size === "compact" ? `${baseClass}--compact` : "",
|
|
81
84
|
isOpen ? `${baseClass}--open` : "",
|
|
82
|
-
|
|
85
|
+
invalid ? `${baseClass}--error` : "",
|
|
83
86
|
disabled ? `${baseClass}--disabled` : "",
|
|
84
87
|
className
|
|
85
88
|
].filter(Boolean).join(" ");
|
|
@@ -194,6 +197,7 @@ const Dropdown = React.forwardRef(
|
|
|
194
197
|
ref: setRootRef,
|
|
195
198
|
label,
|
|
196
199
|
helperText,
|
|
200
|
+
errorText,
|
|
197
201
|
error,
|
|
198
202
|
required,
|
|
199
203
|
disabled,
|
|
@@ -212,8 +216,8 @@ const Dropdown = React.forwardRef(
|
|
|
212
216
|
"aria-label": ariaLabelAttr ?? ariaLabel ?? (!label ? placeholder : void 0),
|
|
213
217
|
"aria-controls": isOpen ? `${inputId}-listbox` : void 0,
|
|
214
218
|
"aria-activedescendant": activeOptionId,
|
|
215
|
-
"aria-describedby": [ariaDescribedBy, helperText ? `${inputId}-helper` : void 0].filter(Boolean).join(" ") || void 0,
|
|
216
|
-
"aria-invalid":
|
|
219
|
+
"aria-describedby": [ariaDescribedBy, hasErrorText ? `${inputId}-error` : void 0, helperText ? `${inputId}-helper` : void 0].filter(Boolean).join(" ") || void 0,
|
|
220
|
+
"aria-invalid": invalid || void 0,
|
|
217
221
|
tabIndex: disabled ? -1 : 0,
|
|
218
222
|
onClick: handleToggle,
|
|
219
223
|
onKeyDown: handleKeyDown,
|
|
@@ -40,6 +40,18 @@
|
|
|
40
40
|
--icon-size: var(--icon-size-600);
|
|
41
41
|
}
|
|
42
42
|
|
|
43
|
+
/* Tones: the icon tile takes a status role, for a result that worked or a
|
|
44
|
+
step that failed; the copy stays in the page's text colours. */
|
|
45
|
+
.ds-empty-state--positive .ds-empty-state__icon {
|
|
46
|
+
background-color: var(--color-status-positive-bg);
|
|
47
|
+
color: var(--color-status-positive-icon);
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
.ds-empty-state--error .ds-empty-state__icon {
|
|
51
|
+
background-color: var(--color-status-error-bg);
|
|
52
|
+
color: var(--color-status-error-icon);
|
|
53
|
+
}
|
|
54
|
+
|
|
43
55
|
/* ============================================
|
|
44
56
|
CONTENT
|
|
45
57
|
============================================ */
|
|
@@ -19,6 +19,13 @@ type EmptyStateOwnProps = {
|
|
|
19
19
|
* dashed container, which reads better inside a card, table, or panel.
|
|
20
20
|
*/
|
|
21
21
|
variant?: 'plain' | 'bordered';
|
|
22
|
+
/**
|
|
23
|
+
* The icon tile's status colour. `default` is the quiet tile for nothing
|
|
24
|
+
* to show; `positive` is a result that worked (the end of a flow, with
|
|
25
|
+
* what happens next in the description and the action); `error` is a
|
|
26
|
+
* load or a step that failed.
|
|
27
|
+
*/
|
|
28
|
+
tone?: 'default' | 'positive' | 'error';
|
|
22
29
|
/** Additional CSS classes */
|
|
23
30
|
className?: string;
|
|
24
31
|
};
|
|
@@ -11,6 +11,7 @@ const EmptyState = React.forwardRef(
|
|
|
11
11
|
action,
|
|
12
12
|
size = "default",
|
|
13
13
|
variant = "plain",
|
|
14
|
+
tone = "default",
|
|
14
15
|
className = "",
|
|
15
16
|
...rest
|
|
16
17
|
}, ref) => {
|
|
@@ -19,6 +20,7 @@ const EmptyState = React.forwardRef(
|
|
|
19
20
|
baseClass,
|
|
20
21
|
`${baseClass}--${variant}`,
|
|
21
22
|
size === "compact" ? `${baseClass}--compact` : "",
|
|
23
|
+
tone !== "default" ? `${baseClass}--${tone}` : "",
|
|
22
24
|
className
|
|
23
25
|
].filter(Boolean).join(" ");
|
|
24
26
|
return /* @__PURE__ */ jsxs("div", { ...rest, ref, className: classes, children: [
|
|
@@ -284,6 +284,54 @@ button.ds-event-calendar__event:focus-visible {
|
|
|
284
284
|
font-variant-numeric: tabular-nums;
|
|
285
285
|
}
|
|
286
286
|
|
|
287
|
+
/* ============================================
|
|
288
|
+
SPANS — an event over several days
|
|
289
|
+
Its pill on each day squares off the side the
|
|
290
|
+
event runs on through, so the days read as one
|
|
291
|
+
bar; the dot marks the first day only.
|
|
292
|
+
============================================ */
|
|
293
|
+
|
|
294
|
+
.ds-event-calendar__event--continued {
|
|
295
|
+
border-start-start-radius: 0;
|
|
296
|
+
border-end-start-radius: 0;
|
|
297
|
+
}
|
|
298
|
+
|
|
299
|
+
.ds-event-calendar__event--continues {
|
|
300
|
+
border-start-end-radius: 0;
|
|
301
|
+
border-end-end-radius: 0;
|
|
302
|
+
}
|
|
303
|
+
|
|
304
|
+
.ds-event-calendar__event--continued .ds-event-calendar__event-dot {
|
|
305
|
+
visibility: hidden;
|
|
306
|
+
}
|
|
307
|
+
|
|
308
|
+
/* ============================================
|
|
309
|
+
LEGEND — what each event colour means
|
|
310
|
+
============================================ */
|
|
311
|
+
|
|
312
|
+
.ds-event-calendar__legend {
|
|
313
|
+
display: flex;
|
|
314
|
+
flex-wrap: wrap;
|
|
315
|
+
gap: var(--gap-200) var(--gap-400);
|
|
316
|
+
margin: var(--gap-300) 0 0;
|
|
317
|
+
padding: 0;
|
|
318
|
+
list-style: none;
|
|
319
|
+
}
|
|
320
|
+
|
|
321
|
+
.ds-event-calendar__legend-item {
|
|
322
|
+
--ds-event-accent: var(--color-status-neutral-border);
|
|
323
|
+
|
|
324
|
+
display: inline-flex;
|
|
325
|
+
align-items: center;
|
|
326
|
+
gap: var(--gap-100);
|
|
327
|
+
color: var(--color-text-secondary);
|
|
328
|
+
font-family: var(--font-paragraph-sm-family);
|
|
329
|
+
font-size: var(--font-paragraph-sm-size);
|
|
330
|
+
font-weight: var(--font-paragraph-sm-weight);
|
|
331
|
+
line-height: var(--font-paragraph-sm-line-height);
|
|
332
|
+
letter-spacing: var(--font-paragraph-sm-letter-spacing);
|
|
333
|
+
}
|
|
334
|
+
|
|
287
335
|
/* ============================================
|
|
288
336
|
EVENT ACCENTS — core accent roles only
|
|
289
337
|
============================================ */
|
|
@@ -363,3 +411,14 @@ button.ds-event-calendar__more:focus-visible {
|
|
|
363
411
|
text-align: center;
|
|
364
412
|
}
|
|
365
413
|
}
|
|
414
|
+
|
|
415
|
+
/* ============================================
|
|
416
|
+
WEEK VIEW — one week, every event shown
|
|
417
|
+
The cells take the room a week has to give,
|
|
418
|
+
so a busy day lists everything without an
|
|
419
|
+
overflow row.
|
|
420
|
+
============================================ */
|
|
421
|
+
|
|
422
|
+
.ds-event-calendar--week .ds-event-calendar__cell {
|
|
423
|
+
min-height: calc(var(--control-height-default) * 5);
|
|
424
|
+
}
|
|
@@ -4,8 +4,10 @@ export type EventCalendarColor = 'neutral' | 'coral' | 'violet' | 'cobalt' | 'am
|
|
|
4
4
|
export interface EventCalendarEvent {
|
|
5
5
|
/** Unique event identifier. */
|
|
6
6
|
id: string;
|
|
7
|
-
/** The day the event falls on (YYYY-MM-DD). */
|
|
7
|
+
/** The day the event falls on (YYYY-MM-DD), or its first day when it runs over several. */
|
|
8
8
|
date: string;
|
|
9
|
+
/** The last day of an event that runs over several days (YYYY-MM-DD, inclusive): it shows on every day from `date` to this one, its pills joined across the days and its dot on the first. */
|
|
10
|
+
endDate?: string;
|
|
9
11
|
/** Short label shown in the event pill. */
|
|
10
12
|
title: string;
|
|
11
13
|
/** Start time as already-formatted text like "09:30". Untimed events sort first. */
|
|
@@ -13,6 +15,13 @@ export interface EventCalendarEvent {
|
|
|
13
15
|
/** Accent for the pill's dot, from the core accent roles. Defaults to `neutral`. */
|
|
14
16
|
color?: EventCalendarColor;
|
|
15
17
|
}
|
|
18
|
+
/** A colour the calendar's events use, and what it means, for the legend. */
|
|
19
|
+
export interface EventCalendarLegendItem {
|
|
20
|
+
/** The accent, as an event's `color` names it. */
|
|
21
|
+
color: EventCalendarColor;
|
|
22
|
+
/** What events in this colour are ("Offsites", "Deadlines"). */
|
|
23
|
+
label: string;
|
|
24
|
+
}
|
|
16
25
|
/** Props owned by EventCalendar itself — everything else falls through to the root element. */
|
|
17
26
|
type EventCalendarOwnProps = {
|
|
18
27
|
/** The events to place on the grid, including any that fall on the visible leading and trailing days of the neighbouring months. */
|
|
@@ -40,16 +49,29 @@ type EventCalendarOwnProps = {
|
|
|
40
49
|
* consumer; pair with `onDateClick` to move it.
|
|
41
50
|
*/
|
|
42
51
|
selectedDate?: string;
|
|
52
|
+
/** The date the calendar treats as today (`YYYY-MM-DD`): it carries the today chip and picks the month shown first. Defaults to the device's date; pin it for a demo, a test or a time zone the device is not in. */
|
|
53
|
+
today?: string;
|
|
54
|
+
/** What each event colour means, shown as a row of dots and labels under the grid. Filtering by kind stays with the host, which passes the events it wants shown. */
|
|
55
|
+
legend?: EventCalendarLegendItem[];
|
|
43
56
|
/** Trailing header slot, e.g. a "New event" Button. */
|
|
44
57
|
actions?: React.ReactNode;
|
|
58
|
+
/** `month` shows the whole month, a day's overflow folded behind "+N more"; `week` shows one week in tall cells with every event, stepping a week at a time from the selected day's week (else today's), which it keeps as its own state after mount. */
|
|
59
|
+
view?: 'month' | 'week';
|
|
45
60
|
/** Accessible name of the previous-month button. */
|
|
46
61
|
previousLabel?: string;
|
|
47
62
|
/** Accessible name of the next-month button. */
|
|
48
63
|
nextLabel?: string;
|
|
64
|
+
/** Accessible name of the previous-week button, in the week view. */
|
|
65
|
+
previousWeekLabel?: string;
|
|
66
|
+
/** Accessible name of the next-week button, in the week view. */
|
|
67
|
+
nextWeekLabel?: string;
|
|
68
|
+
/** The visible text of the control that folds an expanded day back, when a day's "+N more" opens it in place (with no `onDateClick`). */
|
|
69
|
+
showLessLabel?: string;
|
|
49
70
|
/**
|
|
50
71
|
* The month heading, given the first day of the month in view: the visible
|
|
51
72
|
* title and the name of the day grid. Defaults to the month name and the
|
|
52
|
-
* year in `locale` ("January 2026" in `en-US`).
|
|
73
|
+
* year in `locale` ("January 2026" in `en-US`). Month view only; the week
|
|
74
|
+
* view's heading is the week's range in `locale`.
|
|
53
75
|
*/
|
|
54
76
|
monthLabel?: (month: Date) => string;
|
|
55
77
|
/**
|