rift-ds 1.19.1 → 1.21.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 +3 -3
- package/components/AgentStatus/AgentStatus.css +8 -0
- package/components/AppSidebar/AppSidebar.css +37 -0
- package/components/AppSidebar/AppSidebar.d.ts +2 -0
- package/components/AppSidebar/AppSidebar.js +248 -215
- package/components/Checkbox/Checkbox.css +4 -1
- package/components/Checkbox/Checkbox.d.ts +12 -5
- package/components/Checkbox/Checkbox.js +7 -2
- package/components/ColorPicker/ColorPicker.js +3 -1
- package/components/Combobox/Combobox.d.ts +1 -1
- package/components/Composer/Composer.css +42 -2
- package/components/Composer/Composer.d.ts +1 -1
- package/components/Composer/Composer.js +1 -0
- package/components/DataTable/DataTable.js +64 -29
- package/components/DataTable/tableContext.d.ts +2 -0
- package/components/Dropdown/Dropdown.d.ts +4 -4
- package/components/Dropdown/Dropdown.js +1 -0
- package/components/EventCalendar/EventCalendar.css +3 -1
- package/components/LegendTile/LegendTile.css +10 -3
- package/components/LegendTile/LegendTile.d.ts +1 -1
- package/components/LegendTile/LegendTile.js +1 -1
- package/components/PinInput/PinInput.d.ts +6 -0
- package/components/PinInput/PinInput.js +38 -34
- package/components/RadioButton/RadioButton.css +4 -1
- package/components/RadioButton/RadioButton.d.ts +10 -12
- package/components/RadioButton/RadioButton.js +8 -6
- package/components/Reasoning/Reasoning.css +14 -0
- package/components/RichDropdown/RichDropdown.d.ts +4 -5
- package/components/RichDropdown/RichDropdown.js +1 -0
- package/components/SegmentedControl/SegmentedControl.css +37 -0
- package/components/SegmentedControl/SegmentedControl.d.ts +16 -2
- package/components/SegmentedControl/SegmentedControl.js +41 -4
- package/components/SelectionCard/SelectionCard.d.ts +7 -1
- package/components/SelectionCard/SelectionCard.js +2 -1
- package/components/Stat/Stat.css +2 -2
- package/components/TableToolbar/TableToolbar.css +13 -3
- package/components/TableToolbar/TableToolbar.d.ts +1 -0
- package/components/TableToolbar/TableToolbar.js +18 -4
- package/components/Tabs/Tabs.d.ts +2 -0
- package/components/Tabs/Tabs.js +1 -0
- package/components/TagInput/TagInput.d.ts +7 -0
- package/components/TagInput/TagInput.js +5 -3
- package/components/ThemeToggle/ThemeToggle.css +3 -25
- package/components/ThemeToggle/ThemeToggle.js +8 -20
- package/components/TimePicker/TimePicker.d.ts +6 -0
- package/components/TimePicker/TimePicker.js +4 -0
- package/components/Timeline/Timeline.css +7 -2
- package/components/Timeline/Timeline.d.ts +4 -4
- package/components/ToggleSwitch/ToggleSwitch.d.ts +8 -0
- package/components/ToggleSwitch/ToggleSwitch.js +6 -1
- package/components/ToolCall/ToolCall.css +11 -3
- package/components/TypographySwatch/TypographySwatch.css +3 -1
- package/components/WorldMap/WorldMap.d.ts +1 -1
- package/components/WorldMap/WorldMap.js +1 -1
- package/components/registry.json +1 -1
- package/components/registry.json.d.ts +1 -1
- package/components/registry.json.js +1 -1
- package/package.json +5 -1
- package/tokens/motion.d.ts +2 -0
- package/tokens/motion.js +2 -0
- package/tokens/presets/contrast.css +8 -8
- package/tokens/presets/forest.css +10 -8
- package/tokens/presets/gold.css +12 -10
- package/tokens/presets/marquee.css +9 -9
- package/tokens/presets/pink.css +8 -8
- package/tokens/presets/terminal.css +8 -8
- package/tokens/presets/violet.css +8 -8
- package/tokens/presets/warm.css +8 -8
- package/tokens/presets/zest.css +8 -8
- package/tokens/registry.json +2 -0
- package/tokens/registry.json.d.ts +2 -0
- package/tokens/registry.json.js +1 -1
- package/tokens/tokens-dark.css +4 -0
- package/tokens/tokens-light.css +8 -4
- package/tokens/values.d.ts +34 -0
- package/tokens/values.js +11 -0
- package/tokens/values.json.js +8 -0
|
@@ -37,13 +37,13 @@ type CheckboxOwnProps = {
|
|
|
37
37
|
*/
|
|
38
38
|
ariaLabel?: string;
|
|
39
39
|
/**
|
|
40
|
-
*
|
|
41
|
-
*
|
|
42
|
-
*
|
|
43
|
-
* native `<input>`, so it cannot participate in native form submission.
|
|
44
|
-
* Declared only so the attribute is not forwarded to an element that rejects it.
|
|
40
|
+
* Form field name. When set, the checkbox submits with an enclosing form
|
|
41
|
+
* through a hidden input: `value` while checked, nothing while unchecked
|
|
42
|
+
* or disabled, as a native checkbox does.
|
|
45
43
|
*/
|
|
46
44
|
name?: string;
|
|
45
|
+
/** The value submitted under `name` while checked. Defaults to "on", the native checkbox's. */
|
|
46
|
+
value?: string;
|
|
47
47
|
};
|
|
48
48
|
export interface CheckboxProps extends CheckboxOwnProps, Omit<React.ComponentPropsWithoutRef<'div'>, keyof CheckboxOwnProps> {
|
|
49
49
|
}
|
|
@@ -57,6 +57,13 @@ type CheckboxGroupOwnProps = {
|
|
|
57
57
|
error?: boolean;
|
|
58
58
|
/** Marks the group required and renders the required marker on its label */
|
|
59
59
|
required?: boolean;
|
|
60
|
+
/**
|
|
61
|
+
* Form field name shared by every item. When set, each checked item submits
|
|
62
|
+
* its `value` under this name through a hidden input, so a form reads the
|
|
63
|
+
* selection as repeated entries, as a set of native checkboxes does; a disabled
|
|
64
|
+
* item submits nothing.
|
|
65
|
+
*/
|
|
66
|
+
name?: string;
|
|
60
67
|
/** Checkbox options */
|
|
61
68
|
items: {
|
|
62
69
|
label: string;
|
|
@@ -17,7 +17,8 @@ const Checkbox = React.forwardRef(
|
|
|
17
17
|
onChange,
|
|
18
18
|
className = "",
|
|
19
19
|
ariaLabel,
|
|
20
|
-
name
|
|
20
|
+
name,
|
|
21
|
+
value = "on",
|
|
21
22
|
onClick,
|
|
22
23
|
onKeyDown,
|
|
23
24
|
...rest
|
|
@@ -77,7 +78,8 @@ const Checkbox = React.forwardRef(
|
|
|
77
78
|
helperText ? /* @__PURE__ */ jsxs("span", { className: `${baseClass}__text`, children: [
|
|
78
79
|
label && /* @__PURE__ */ jsx("span", { className: `${baseClass}__label`, children: label }),
|
|
79
80
|
/* @__PURE__ */ jsx("span", { className: `${baseClass}__helper`, id: helperId, children: helperText })
|
|
80
|
-
] }) : label && /* @__PURE__ */ jsx("span", { className: `${baseClass}__label`, children: label })
|
|
81
|
+
] }) : label && /* @__PURE__ */ jsx("span", { className: `${baseClass}__label`, children: label }),
|
|
82
|
+
name && checked && /* @__PURE__ */ jsx("input", { type: "hidden", name, value, disabled })
|
|
81
83
|
]
|
|
82
84
|
}
|
|
83
85
|
);
|
|
@@ -90,6 +92,7 @@ const CheckboxGroup = React.forwardRef(
|
|
|
90
92
|
helperText,
|
|
91
93
|
error = false,
|
|
92
94
|
required = false,
|
|
95
|
+
name,
|
|
93
96
|
items,
|
|
94
97
|
values: valuesProp,
|
|
95
98
|
defaultValues = [],
|
|
@@ -135,6 +138,8 @@ const CheckboxGroup = React.forwardRef(
|
|
|
135
138
|
children: /* @__PURE__ */ jsx("div", { className: `${baseClass}__items`, children: items.map((item) => /* @__PURE__ */ jsx(
|
|
136
139
|
Checkbox,
|
|
137
140
|
{
|
|
141
|
+
name,
|
|
142
|
+
value: item.value,
|
|
138
143
|
label: item.label,
|
|
139
144
|
checked: values.includes(item.value),
|
|
140
145
|
disabled: item.disabled,
|
|
@@ -76,6 +76,7 @@ const ColorPicker = React.forwardRef(
|
|
|
76
76
|
error = false,
|
|
77
77
|
helperText,
|
|
78
78
|
name,
|
|
79
|
+
form,
|
|
79
80
|
panelLabel,
|
|
80
81
|
saturationLabel = "Saturation and brightness",
|
|
81
82
|
saturationValueText = (saturation, brightness) => `Saturation ${saturation}%, brightness ${brightness}%`,
|
|
@@ -237,6 +238,7 @@ const ColorPicker = React.forwardRef(
|
|
|
237
238
|
"button",
|
|
238
239
|
{
|
|
239
240
|
...rest,
|
|
241
|
+
form,
|
|
240
242
|
ref: setTriggerRef,
|
|
241
243
|
type: "button",
|
|
242
244
|
id: inputId,
|
|
@@ -263,7 +265,7 @@ const ColorPicker = React.forwardRef(
|
|
|
263
265
|
]
|
|
264
266
|
}
|
|
265
267
|
),
|
|
266
|
-
name && /* @__PURE__ */ jsx("input", { type: "hidden", name, value: displayHex, disabled }),
|
|
268
|
+
name && /* @__PURE__ */ jsx("input", { type: "hidden", name, value: displayHex, form, disabled }),
|
|
267
269
|
isOpen && /* @__PURE__ */ jsxs(
|
|
268
270
|
"div",
|
|
269
271
|
{
|
|
@@ -90,7 +90,7 @@ type ComboboxOwnProps = {
|
|
|
90
90
|
/**
|
|
91
91
|
* Form field name. When set, the selection submits with an enclosing form
|
|
92
92
|
* under this name through hidden inputs: the selected option's `value` in
|
|
93
|
-
* single mode (nothing
|
|
93
|
+
* single mode (nothing while no value is set), one entry per selected value in
|
|
94
94
|
* `multiple` mode, nothing while disabled. The search text the user types
|
|
95
95
|
* is never submitted. Also the fallback for the element id (`id || name || generated`).
|
|
96
96
|
*/
|
|
@@ -663,7 +663,8 @@
|
|
|
663
663
|
}
|
|
664
664
|
|
|
665
665
|
/* ============================================
|
|
666
|
-
INLINE: one row at the control height
|
|
666
|
+
INLINE: one row at the control height until `maxRows` lets it grow, the send
|
|
667
|
+
button on the text's line.
|
|
667
668
|
The shell is an input here, so it does not float, and the button sits
|
|
668
669
|
inside the height, concentric on a thinner ring.
|
|
669
670
|
============================================ */
|
|
@@ -675,10 +676,49 @@
|
|
|
675
676
|
min(var(--radius-pill), var(--ds-composer-send-size) / 2) + var(--padding-050) + var(--border-025)
|
|
676
677
|
);
|
|
677
678
|
flex-direction: row;
|
|
678
|
-
|
|
679
|
+
/* Level at one row; a maxRows above 1 grows the shell and the send button stays in the bottom corner. */
|
|
680
|
+
align-items: flex-end;
|
|
679
681
|
box-shadow: none;
|
|
680
682
|
}
|
|
681
683
|
|
|
684
|
+
/* Only typing grows the shell: a placeholder too long for the line ends in an
|
|
685
|
+
ellipsis. A browser will not ellipsize a textarea's own placeholder, so it
|
|
686
|
+
keeps the attribute, unpainted and on one line, and a copy draws the words. */
|
|
687
|
+
.ds-composer--inline .ds-composer__textarea:placeholder-shown {
|
|
688
|
+
max-height: var(--ds-composer-line);
|
|
689
|
+
overflow: hidden;
|
|
690
|
+
}
|
|
691
|
+
|
|
692
|
+
.ds-composer--inline .ds-composer__textarea::placeholder {
|
|
693
|
+
color: transparent;
|
|
694
|
+
white-space: nowrap;
|
|
695
|
+
}
|
|
696
|
+
|
|
697
|
+
.ds-composer--inline .ds-composer__content {
|
|
698
|
+
position: relative;
|
|
699
|
+
}
|
|
700
|
+
|
|
701
|
+
.ds-composer__placeholder {
|
|
702
|
+
position: absolute;
|
|
703
|
+
inset-block-start: var(--ds-composer-text-block);
|
|
704
|
+
inset-inline: var(--ds-composer-text-inset) var(--padding-100);
|
|
705
|
+
overflow: hidden;
|
|
706
|
+
text-overflow: ellipsis;
|
|
707
|
+
white-space: nowrap;
|
|
708
|
+
font-family: var(--font-paragraph-family);
|
|
709
|
+
font-size: var(--font-paragraph-size);
|
|
710
|
+
font-weight: var(--font-paragraph-weight);
|
|
711
|
+
line-height: var(--ds-composer-line);
|
|
712
|
+
letter-spacing: var(--font-paragraph-letter-spacing);
|
|
713
|
+
color: var(--color-input-text-placeholder);
|
|
714
|
+
pointer-events: none;
|
|
715
|
+
}
|
|
716
|
+
|
|
717
|
+
.ds-composer--compact .ds-composer__placeholder {
|
|
718
|
+
font-size: var(--font-paragraph-sm-size);
|
|
719
|
+
letter-spacing: var(--font-paragraph-sm-letter-spacing);
|
|
720
|
+
}
|
|
721
|
+
|
|
682
722
|
.ds-composer--inline.ds-composer--compact {
|
|
683
723
|
--ds-composer-control: var(--control-height-compact);
|
|
684
724
|
--ds-composer-line: var(--font-paragraph-sm-line-height);
|
|
@@ -34,7 +34,7 @@ type ComposerOwnProps = {
|
|
|
34
34
|
onStop?: () => void;
|
|
35
35
|
/** The density, matching a table's or a bar's: `compact` tightens the padding and takes the smaller text and buttons. */
|
|
36
36
|
size?: 'default' | 'compact';
|
|
37
|
-
/** One row with the send button on the text's line, the shell exactly `size`'s control height, so it lines up with an Input or a table's toolbar. For a popover, a sheet or a tight bar. `maxRows` defaults to 1. */
|
|
37
|
+
/** One row with the send button on the text's line, the shell exactly `size`'s control height, so it lines up with an Input or a table's toolbar. For a popover, a sheet or a tight bar. `maxRows` defaults to 1; above it, typing grows the shell with the send button held in the bottom corner. A placeholder stays on one line and ends in an ellipsis. */
|
|
38
38
|
inline?: boolean;
|
|
39
39
|
/** Growth cap in text rows before the textarea scrolls internally. Defaults to 8, or 1 when `inline`. */
|
|
40
40
|
maxRows?: number;
|
|
@@ -446,6 +446,7 @@ const Composer = React.forwardRef(
|
|
|
446
446
|
onScroll: handleScroll
|
|
447
447
|
}
|
|
448
448
|
),
|
|
449
|
+
inline && rest.placeholder && currentValue === "" && /* @__PURE__ */ jsx("span", { className: `${baseClass}__placeholder`, "aria-hidden": "true", children: rest.placeholder }),
|
|
449
450
|
mentionsArmed && /* The words a person sees. The textarea beneath keeps the caret,
|
|
450
451
|
the selection and every keystroke, with its own text
|
|
451
452
|
transparent; this copy of the same string is where a mention
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import { jsxs, jsx, Fragment } from "react/jsx-runtime";
|
|
3
|
-
import React, { useMemo, useState, useEffect, useRef, useId, useLayoutEffect, useCallback } from "react";
|
|
3
|
+
import React, { useMemo, useState, useEffect, useRef, useId, useLayoutEffect, useDeferredValue, useCallback } from "react";
|
|
4
4
|
import { useTable, tableFeatures, columnVisibilityFeature, columnPinningFeature, columnOrderingFeature, rowSelectionFeature, globalFilteringFeature, columnFilteringFeature, rowSortingFeature, createFilteredRowModel, createSortedRowModel } from "@tanstack/react-table";
|
|
5
5
|
import { DropdownMenu } from "../DropdownMenu/DropdownMenu.js";
|
|
6
6
|
import { Dropdown } from "../Dropdown/Dropdown.js";
|
|
@@ -125,6 +125,17 @@ const valueComparator = (collator) => (a, b) => {
|
|
|
125
125
|
if (typeof a === "boolean" && typeof b === "boolean") return Number(a) - Number(b);
|
|
126
126
|
return collator.compare(String(a), String(b));
|
|
127
127
|
};
|
|
128
|
+
const SEARCH_TEXT = /* @__PURE__ */ new WeakMap();
|
|
129
|
+
const searchTextOf = (rows, row) => {
|
|
130
|
+
let texts = SEARCH_TEXT.get(rows);
|
|
131
|
+
if (!texts) SEARCH_TEXT.set(rows, texts = /* @__PURE__ */ new WeakMap());
|
|
132
|
+
let text = texts.get(row);
|
|
133
|
+
if (text === void 0) {
|
|
134
|
+
text = Object.values(row.values).filter((cell) => cell != null).map(String).join("\0").toLowerCase();
|
|
135
|
+
texts.set(row, text);
|
|
136
|
+
}
|
|
137
|
+
return text;
|
|
138
|
+
};
|
|
128
139
|
const ENGINE_FEATURES = tableFeatures({
|
|
129
140
|
rowSortingFeature,
|
|
130
141
|
sortedRowModel: createSortedRowModel(),
|
|
@@ -503,7 +514,7 @@ function DataTable({
|
|
|
503
514
|
}),
|
|
504
515
|
[columnKeys, compareValues]
|
|
505
516
|
);
|
|
506
|
-
const needle = search.trim().toLowerCase();
|
|
517
|
+
const needle = useDeferredValue(search.trim().toLowerCase());
|
|
507
518
|
const sortingKey = JSON.stringify(
|
|
508
519
|
currentSorts.filter((entry) => byKey.has(entry.key)).map((entry) => ({ id: entry.key, desc: entry.direction === "desc" }))
|
|
509
520
|
);
|
|
@@ -540,18 +551,21 @@ function DataTable({
|
|
|
540
551
|
rowSelection: engineSelection
|
|
541
552
|
},
|
|
542
553
|
/* The search matches any raw value on the row, displayed or not, case
|
|
543
|
-
insensitively, as it always has:
|
|
544
|
-
|
|
545
|
-
|
|
554
|
+
insensitively, as it always has: the test reads the whole row, so it
|
|
555
|
+
runs once, from one column. The engine asks once per eligible column
|
|
556
|
+
until one passes, so with every column eligible a row that does not
|
|
557
|
+
match reads all its values once per column. */
|
|
558
|
+
getColumnCanGlobalFilter: (column) => column.id === columns[0]?.key,
|
|
546
559
|
globalFilterFn: (row, _columnId, value) => {
|
|
547
|
-
|
|
548
|
-
return
|
|
549
|
-
(cell) => cell != null && String(cell).toLowerCase().includes(term)
|
|
550
|
-
);
|
|
560
|
+
if (row.columnFilters && Object.values(row.columnFilters).includes(false)) return false;
|
|
561
|
+
return searchTextOf(rows, row.original).includes(String(value ?? ""));
|
|
551
562
|
}
|
|
552
563
|
});
|
|
553
564
|
const engineRows = table.getSortedRowModel().rows;
|
|
554
|
-
const sortedRows =
|
|
565
|
+
const sortedRows = useMemo(
|
|
566
|
+
() => manual ? orderedRows : engineRows.map((row) => row.original),
|
|
567
|
+
[manual, orderedRows, engineRows]
|
|
568
|
+
);
|
|
555
569
|
const matchCount = manual ? Math.max(rowCountProp ?? rows.length, rows.length) : sortedRows.length;
|
|
556
570
|
const groupKey = groupingState.find((key) => byKey.get(key)?.groupable);
|
|
557
571
|
const groupCol = groupKey ? byKey.get(groupKey) : void 0;
|
|
@@ -597,7 +611,7 @@ function DataTable({
|
|
|
597
611
|
return;
|
|
598
612
|
}
|
|
599
613
|
announce(resultsLabel(matchCount), true);
|
|
600
|
-
}, [
|
|
614
|
+
}, [needle]);
|
|
601
615
|
const filtered = useRef(false);
|
|
602
616
|
const filtersKey = JSON.stringify(filters);
|
|
603
617
|
useEffect(() => {
|
|
@@ -615,7 +629,8 @@ function DataTable({
|
|
|
615
629
|
announce(pageAnnouncement(next, pageCount, first, last, matchCount));
|
|
616
630
|
};
|
|
617
631
|
const visibleIds = visibleRows.map((row) => row.id);
|
|
618
|
-
const
|
|
632
|
+
const selectedSet = new Set(currentSelection);
|
|
633
|
+
const selectedVisible = visibleIds.filter((id) => selectedSet.has(id));
|
|
619
634
|
const allVisibleSelected = visibleIds.length > 0 && selectedVisible.length === visibleIds.length;
|
|
620
635
|
const someVisibleSelected = selectedVisible.length > 0 && !allVisibleSelected;
|
|
621
636
|
const toggleAllVisible = (checked) => {
|
|
@@ -979,14 +994,29 @@ function DataTable({
|
|
|
979
994
|
}
|
|
980
995
|
});
|
|
981
996
|
};
|
|
997
|
+
const columnScanKey = columns.map((col) => [col.key, col.type ?? "", col.options ? "1" : ""].join("")).join("\0");
|
|
998
|
+
const columnScans = useMemo(() => {
|
|
999
|
+
const scans = /* @__PURE__ */ new Map();
|
|
1000
|
+
for (const spec of columnScanKey.split("\0")) {
|
|
1001
|
+
const [key, type, hasOptions] = spec.split("");
|
|
1002
|
+
const typedKind = type ? TYPE_DEFAULTS[type].filter : void 0;
|
|
1003
|
+
if (typedKind && (hasOptions || typedKind !== "enum" && typedKind !== "tags")) {
|
|
1004
|
+
scans.set(key, { kind: typedKind, choices: [] });
|
|
1005
|
+
continue;
|
|
1006
|
+
}
|
|
1007
|
+
const values = rows.map((row) => row.values[key]);
|
|
1008
|
+
const kind = typedKind ?? kindOf(values, Boolean(hasOptions));
|
|
1009
|
+
const choices = !hasOptions && (kind === "enum" || kind === "tags") ? [
|
|
1010
|
+
...new Set(
|
|
1011
|
+
values.flat().filter((value) => value != null && value !== "").map(String)
|
|
1012
|
+
)
|
|
1013
|
+
].sort((a, b) => collator.compare(a, b)).map((value) => ({ value, label: value })) : [];
|
|
1014
|
+
scans.set(key, { kind, choices });
|
|
1015
|
+
}
|
|
1016
|
+
return scans;
|
|
1017
|
+
}, [columnScanKey, rows, collator]);
|
|
982
1018
|
const toolbarColumns = columns.map((col) => {
|
|
983
|
-
const
|
|
984
|
-
const kind = col.type ? TYPE_DEFAULTS[col.type].filter : kindOf(values, Boolean(col.options));
|
|
985
|
-
const choices = col.options ?? (kind === "enum" || kind === "tags" ? [
|
|
986
|
-
...new Set(
|
|
987
|
-
values.flat().filter((value) => value != null && value !== "").map(String)
|
|
988
|
-
)
|
|
989
|
-
].sort((a, b) => collator.compare(a, b)).map((value) => ({ value, label: value })) : []);
|
|
1019
|
+
const { kind, choices } = columnScans.get(col.key);
|
|
990
1020
|
return {
|
|
991
1021
|
key: col.key,
|
|
992
1022
|
label: headerText(col),
|
|
@@ -997,12 +1027,13 @@ function DataTable({
|
|
|
997
1027
|
sortable: Boolean(col.sortable),
|
|
998
1028
|
groupable: Boolean(col.groupable),
|
|
999
1029
|
kind,
|
|
1000
|
-
options: choices
|
|
1030
|
+
options: col.options ?? choices
|
|
1001
1031
|
};
|
|
1002
1032
|
});
|
|
1003
1033
|
const [headerFilter, setHeaderFilter] = useState(null);
|
|
1004
1034
|
const [countClaimed, setCountClaimed] = useState(false);
|
|
1005
1035
|
const [selectionClaimed, setSelectionClaimed] = useState(false);
|
|
1036
|
+
const [commandLanding, setCommandLanding] = useState(false);
|
|
1006
1037
|
const openHeaderFilter = (key) => {
|
|
1007
1038
|
const existing = filters.find((filter2) => filter2.column === key);
|
|
1008
1039
|
if (existing) {
|
|
@@ -1089,6 +1120,7 @@ function DataTable({
|
|
|
1089
1120
|
reportedKey.current = currentKey;
|
|
1090
1121
|
viewCallback.current?.(JSON.parse(JSON.stringify(currentView)));
|
|
1091
1122
|
}, [currentKey]);
|
|
1123
|
+
const matchingIds = useMemo(() => sortedRows.map((row) => row.id), [sortedRows]);
|
|
1092
1124
|
const tableContext = {
|
|
1093
1125
|
columns: toolbarColumns,
|
|
1094
1126
|
filters,
|
|
@@ -1102,7 +1134,7 @@ function DataTable({
|
|
|
1102
1134
|
selectable,
|
|
1103
1135
|
selectedIds: currentSelection,
|
|
1104
1136
|
setSelectedIds: setSelection,
|
|
1105
|
-
matchingIds
|
|
1137
|
+
matchingIds,
|
|
1106
1138
|
size,
|
|
1107
1139
|
setSize,
|
|
1108
1140
|
shown: matchCount,
|
|
@@ -1122,7 +1154,8 @@ function DataTable({
|
|
|
1122
1154
|
setAllGroupsOpen: (open) => setCollapsedGroups(open ? [] : (groups ?? []).map((group) => group.key)),
|
|
1123
1155
|
view: currentView,
|
|
1124
1156
|
applyView,
|
|
1125
|
-
viewMatches: (view) => viewKey(fullView(view)) === currentKey
|
|
1157
|
+
viewMatches: (view) => viewKey(fullView(view)) === currentKey,
|
|
1158
|
+
setCommandLanding
|
|
1126
1159
|
};
|
|
1127
1160
|
const [menuKey, setMenuKey] = useState(null);
|
|
1128
1161
|
const menuItems = (key) => {
|
|
@@ -1727,6 +1760,7 @@ function DataTable({
|
|
|
1727
1760
|
loadMore.current = onLoadMore;
|
|
1728
1761
|
});
|
|
1729
1762
|
const rowCount = visibleRows.length;
|
|
1763
|
+
const pageRowSet = new Set(pageRows);
|
|
1730
1764
|
const scrollsInFrame = virtual || maxHeight !== void 0;
|
|
1731
1765
|
useEffect(() => {
|
|
1732
1766
|
const node = loadingRef.current;
|
|
@@ -1748,7 +1782,7 @@ function DataTable({
|
|
|
1748
1782
|
const expanded = !collapsedGroups.includes(group.key);
|
|
1749
1783
|
const label = groupLabel(group.key);
|
|
1750
1784
|
const ids = group.rows.map((row) => row.id);
|
|
1751
|
-
const chosen = ids.filter((id) =>
|
|
1785
|
+
const chosen = ids.filter((id) => selectedSet.has(id)).length;
|
|
1752
1786
|
const raw = group.rows[0]?.values[groupKey] ?? null;
|
|
1753
1787
|
return /* @__PURE__ */ jsxs("tr", { className: `ds-table__row ${baseClass}__group-row`, "data-group-row": "", children: [
|
|
1754
1788
|
utilityKeys.map((key) => {
|
|
@@ -1839,7 +1873,7 @@ function DataTable({
|
|
|
1839
1873
|
visibleKeys.map((key) => {
|
|
1840
1874
|
const col = byKey.get(key);
|
|
1841
1875
|
const pick = totalPick(col);
|
|
1842
|
-
const values = sortedRows.map((row) => row.values[key]);
|
|
1876
|
+
const values = pick === "none" ? [] : sortedRows.map((row) => row.values[key]);
|
|
1843
1877
|
const text = pick === "none" ? "" : typeof col.aggregate === "function" && !totalsState[key] ? col.aggregate(values, sortedRows) : resultText(col, calculate(pick, values));
|
|
1844
1878
|
const offered = TOTALS.filter((total) => !NUMERIC_TOTALS.has(total) || numericColumn(col));
|
|
1845
1879
|
return /* @__PURE__ */ jsx(
|
|
@@ -1887,7 +1921,7 @@ function DataTable({
|
|
|
1887
1921
|
] }) });
|
|
1888
1922
|
const columnCount = utilityKeys.length + visibleKeys.length + (layoutReady ? 1 : 0) + (showActions ? 1 : 0);
|
|
1889
1923
|
const bodyRow = (row, slot, part = "both") => {
|
|
1890
|
-
const isSelected = selectable &&
|
|
1924
|
+
const isSelected = selectable && selectedSet.has(row.id);
|
|
1891
1925
|
const name = rowName(row);
|
|
1892
1926
|
const expandedHere = Boolean(renderDetail) && expandedState.includes(row.id);
|
|
1893
1927
|
const detailId = `${tableId}-detail-${row.id}`;
|
|
@@ -2244,8 +2278,9 @@ function DataTable({
|
|
|
2244
2278
|
/* @__PURE__ */ jsx(Spinner, { size: "sm", tone: "neutral" }),
|
|
2245
2279
|
/* @__PURE__ */ jsx("span", { children: loadWords.loadingMore })
|
|
2246
2280
|
] }) }) });
|
|
2247
|
-
const firstLoad = loading && rows.length === 0 && !error;
|
|
2281
|
+
const firstLoad = (loading && rows.length === 0 || commandLanding) && !error;
|
|
2248
2282
|
const refreshing = loading && rows.length > 0;
|
|
2283
|
+
const searching = !manual && rows.length > 0 && search.trim().toLowerCase() !== needle;
|
|
2249
2284
|
const retryButton = onRetry && /* @__PURE__ */ jsx(Button, { variant: "secondary", tone: "neutral", size: "compact", iconLeft: "refresh", label: loadWords.retry, onClick: onRetry });
|
|
2250
2285
|
const skeletonRows = Array.from({ length: pageSize ?? 5 }, (_, index) => /* @__PURE__ */ jsxs("tr", { className: `ds-table__row ${baseClass}__skeleton-row`, "aria-hidden": "true", children: [
|
|
2251
2286
|
utilityKeys.map((key) => /* @__PURE__ */ jsx("td", { className: "ds-table__cell" }, key)),
|
|
@@ -2292,12 +2327,12 @@ function DataTable({
|
|
|
2292
2327
|
error && rows.length > 0 && /* @__PURE__ */ jsx(Banner, { variant: "error", title: loadWords.errorTitle, action: retryButton || void 0, className: `${baseClass}__banner`, children: error }),
|
|
2293
2328
|
firstLoad && /* @__PURE__ */ jsx("span", { className: "ds-visually-hidden", role: "status", children: loadWords.loading }),
|
|
2294
2329
|
visibleRows.length > 0 || firstLoad ? /* @__PURE__ */ jsxs(ScrollRegion, { className: `ds-table__wrapper ${baseClass}__frame`, style: frameStyle, onNode: setFrameEl, children: [
|
|
2295
|
-
refreshing && /* @__PURE__ */ jsx("div", { className: `${baseClass}__progress`, role: "progressbar", "aria-label": loadWords.loading }),
|
|
2330
|
+
(refreshing || searching) && /* @__PURE__ */ jsx("div", { className: `${baseClass}__progress`, role: "progressbar", "aria-label": loadWords.loading }),
|
|
2296
2331
|
/* @__PURE__ */ jsxs(
|
|
2297
2332
|
"table",
|
|
2298
2333
|
{
|
|
2299
2334
|
ref: setTableEl,
|
|
2300
|
-
"aria-busy": loading || void 0,
|
|
2335
|
+
"aria-busy": loading || commandLanding || searching || void 0,
|
|
2301
2336
|
className: tableClasses,
|
|
2302
2337
|
role: gridMode ? "grid" : stacked ? "table" : void 0,
|
|
2303
2338
|
"aria-rowcount": virtual ? virtualItems.length + 1 : void 0,
|
|
@@ -2332,7 +2367,7 @@ function DataTable({
|
|
|
2332
2367
|
}
|
|
2333
2368
|
)
|
|
2334
2369
|
] }) }),
|
|
2335
|
-
firstLoad ? /* @__PURE__ */ jsx("tbody", { className: "ds-table__body", children: skeletonRows }) : groups ? groups.map((group) => ({ group, onPage: group.rows.filter((row) =>
|
|
2370
|
+
firstLoad ? /* @__PURE__ */ jsx("tbody", { className: "ds-table__body", children: skeletonRows }) : groups ? groups.map((group) => ({ group, onPage: group.rows.filter((row) => pageRowSet.has(row)) })).filter(({ onPage }) => onPage.length > 0).map(({ group, onPage }) => /* @__PURE__ */ jsxs(
|
|
2336
2371
|
"tbody",
|
|
2337
2372
|
{
|
|
2338
2373
|
className: `ds-table__body ${baseClass}__group`,
|
|
@@ -76,6 +76,8 @@ export interface TableContextValue {
|
|
|
76
76
|
view: TableView;
|
|
77
77
|
applyView: (view: TableView) => void;
|
|
78
78
|
viewMatches: (view: TableView) => boolean;
|
|
79
|
+
/** Draws skeleton rows in the body while a toolbar command's answer lands. */
|
|
80
|
+
setCommandLanding: (landing: boolean) => void;
|
|
79
81
|
}
|
|
80
82
|
export declare const TableContext: import('react').Context<TableContextValue | null>;
|
|
81
83
|
/** The surrounding DataTable's state, or null outside one. */
|
|
@@ -76,10 +76,10 @@ type DropdownOwnProps = {
|
|
|
76
76
|
*/
|
|
77
77
|
ariaLabel?: string;
|
|
78
78
|
/**
|
|
79
|
-
*
|
|
80
|
-
*
|
|
81
|
-
*
|
|
82
|
-
*
|
|
79
|
+
* Form field name. When set, the selected option's `value` submits with an
|
|
80
|
+
* enclosing form through a hidden input (nothing while no value is set,
|
|
81
|
+
* nothing while disabled), as Combobox does. Also the fallback for the
|
|
82
|
+
* element id (`id || name || label`).
|
|
83
83
|
*/
|
|
84
84
|
name?: string;
|
|
85
85
|
};
|
|
@@ -32,9 +32,11 @@
|
|
|
32
32
|
gap: var(--gap-200);
|
|
33
33
|
}
|
|
34
34
|
|
|
35
|
+
/* Never narrower than its longest word, so "September" stays whole on a
|
|
36
|
+
small phone and the year wraps under it instead. */
|
|
35
37
|
.ds-event-calendar__month {
|
|
36
38
|
flex: 1 1 auto;
|
|
37
|
-
min-width:
|
|
39
|
+
min-width: min-content;
|
|
38
40
|
color: var(--color-text-primary);
|
|
39
41
|
font-family: var(--font-title-body-family);
|
|
40
42
|
font-size: var(--font-title-body-size);
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/* ============================================
|
|
2
2
|
LEGEND TILE COMPONENT
|
|
3
|
-
The labelled value tile under a chart:
|
|
4
|
-
|
|
3
|
+
The labelled value tile under a chart: a
|
|
4
|
+
soft neutral fill inside its panel, a
|
|
5
5
|
caption label with an optional series dot,
|
|
6
6
|
and the value beneath. The dot's colour
|
|
7
7
|
arrives per instance via the
|
|
@@ -17,7 +17,7 @@
|
|
|
17
17
|
flex-direction: column;
|
|
18
18
|
gap: var(--gap-050);
|
|
19
19
|
min-width: 0;
|
|
20
|
-
background-color: var(--color-bg
|
|
20
|
+
background-color: var(--color-label-bg);
|
|
21
21
|
border-radius: var(--radius-300);
|
|
22
22
|
padding: var(--padding-200) var(--padding-300);
|
|
23
23
|
}
|
|
@@ -35,6 +35,13 @@
|
|
|
35
35
|
line-height: var(--font-caption-line-height);
|
|
36
36
|
letter-spacing: var(--font-caption-letter-spacing);
|
|
37
37
|
color: var(--color-text-secondary);
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
/* The text sits in its own span: an ellipsis never draws on bare text
|
|
41
|
+
inside a flex container, so on the label itself a long caption was cut
|
|
42
|
+
mid-letter. */
|
|
43
|
+
.ds-legend-tile__label-text {
|
|
44
|
+
min-width: 0;
|
|
38
45
|
white-space: nowrap;
|
|
39
46
|
overflow: hidden;
|
|
40
47
|
text-overflow: ellipsis;
|
|
@@ -26,7 +26,7 @@ export interface LegendTileProps extends LegendTileOwnProps, Omit<React.Componen
|
|
|
26
26
|
}
|
|
27
27
|
/**
|
|
28
28
|
* LegendTile — the labelled value tile that sits under a chart and ties a
|
|
29
|
-
* series to its number.
|
|
29
|
+
* series to its number. A tile on a soft neutral fill inside its panel, with
|
|
30
30
|
* an optional series dot matching the chart's palette. Pure JSX and CSS: no
|
|
31
31
|
* charting library, no hooks, so it renders from a Server Component and a row
|
|
32
32
|
* of them costs nothing under a dense dashboard.
|
|
@@ -10,7 +10,7 @@ const LegendTile = React.forwardRef(
|
|
|
10
10
|
return /* @__PURE__ */ jsxs("div", { ...rest, ref, className: classes, style: mergedStyle, children: [
|
|
11
11
|
/* @__PURE__ */ jsxs("span", { className: `${baseClass}__label`, children: [
|
|
12
12
|
swatch && /* @__PURE__ */ jsx("span", { className: `${baseClass}__dot`, "aria-hidden": "true" }),
|
|
13
|
-
label
|
|
13
|
+
/* @__PURE__ */ jsx("span", { className: `${baseClass}__label-text`, children: label })
|
|
14
14
|
] }),
|
|
15
15
|
/* @__PURE__ */ jsx("span", { className: `${baseClass}__value`, children: typeof value === "number" ? formatNumber(value, locale) : value })
|
|
16
16
|
] });
|
|
@@ -27,6 +27,12 @@ type PinInputOwnProps = {
|
|
|
27
27
|
error?: boolean;
|
|
28
28
|
/** Whether the whole control is disabled */
|
|
29
29
|
disabled?: boolean;
|
|
30
|
+
/**
|
|
31
|
+
* Form field name. When set, the joined code submits with an enclosing form
|
|
32
|
+
* through a hidden input, nothing while disabled. The cells themselves
|
|
33
|
+
* carry no name.
|
|
34
|
+
*/
|
|
35
|
+
name?: string;
|
|
30
36
|
/**
|
|
31
37
|
* Accessible name of each cell, given its 1-based position and the cell count.
|
|
32
38
|
* Defaults to "Digit <position> of <count>" for the numeric format and
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
import { jsx } from "react/jsx-runtime";
|
|
2
|
+
import { jsxs, jsx } from "react/jsx-runtime";
|
|
3
3
|
import React from "react";
|
|
4
4
|
import { Field } from "../Field/Field.js";
|
|
5
5
|
import "./PinInput.css";
|
|
@@ -18,6 +18,7 @@ const PinInput = React.forwardRef(
|
|
|
18
18
|
helperText,
|
|
19
19
|
error = false,
|
|
20
20
|
disabled = false,
|
|
21
|
+
name,
|
|
21
22
|
cellLabel,
|
|
22
23
|
className = "",
|
|
23
24
|
id,
|
|
@@ -113,7 +114,7 @@ const PinInput = React.forwardRef(
|
|
|
113
114
|
const describedBy = helperText ? `${controlId}-helper` : rest["aria-describedby"];
|
|
114
115
|
const characterNoun = format === "numeric" ? "Digit" : "Character";
|
|
115
116
|
const labelCell = cellLabel ?? ((position, count) => `${characterNoun} ${position} of ${count}`);
|
|
116
|
-
return /* @__PURE__ */
|
|
117
|
+
return /* @__PURE__ */ jsxs(
|
|
117
118
|
Field,
|
|
118
119
|
{
|
|
119
120
|
className: classes,
|
|
@@ -122,38 +123,41 @@ const PinInput = React.forwardRef(
|
|
|
122
123
|
error,
|
|
123
124
|
disabled,
|
|
124
125
|
id: controlId,
|
|
125
|
-
children:
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
126
|
+
children: [
|
|
127
|
+
/* @__PURE__ */ jsx(
|
|
128
|
+
"div",
|
|
129
|
+
{
|
|
130
|
+
...rest,
|
|
131
|
+
role: "group",
|
|
132
|
+
"aria-labelledby": label ? `${controlId}-label` : void 0,
|
|
133
|
+
"aria-label": !label ? rest["aria-label"] : void 0,
|
|
134
|
+
"aria-describedby": describedBy,
|
|
135
|
+
className: `${baseClass}__cells`,
|
|
136
|
+
children: chars.map((char, index) => /* @__PURE__ */ jsx(
|
|
137
|
+
"input",
|
|
138
|
+
{
|
|
139
|
+
ref: setCellRef(index),
|
|
140
|
+
className: `${baseClass}__cell`,
|
|
141
|
+
type: mask ? "password" : "text",
|
|
142
|
+
inputMode: format === "numeric" ? "numeric" : "text",
|
|
143
|
+
autoComplete: index === 0 ? "one-time-code" : "off",
|
|
144
|
+
maxLength: 1,
|
|
145
|
+
value: char,
|
|
146
|
+
disabled,
|
|
147
|
+
id: index === 0 ? controlId : void 0,
|
|
148
|
+
"aria-label": labelCell(index + 1, length),
|
|
149
|
+
"aria-invalid": error || void 0,
|
|
150
|
+
onChange: handleCellChange(index),
|
|
151
|
+
onKeyDown: handleCellKeyDown(index),
|
|
152
|
+
onPaste: handlePaste,
|
|
153
|
+
onFocus: (e) => e.target.select()
|
|
154
|
+
},
|
|
155
|
+
index
|
|
156
|
+
))
|
|
157
|
+
}
|
|
158
|
+
),
|
|
159
|
+
name && /* @__PURE__ */ jsx("input", { type: "hidden", name, value: chars.join(""), disabled })
|
|
160
|
+
]
|
|
157
161
|
}
|
|
158
162
|
);
|
|
159
163
|
}
|
|
@@ -163,7 +163,10 @@
|
|
|
163
163
|
gap: var(--gap-200); /* 8px */
|
|
164
164
|
}
|
|
165
165
|
|
|
166
|
+
/* A row that runs out of room wraps, at the vertical layout's own gap,
|
|
167
|
+
rather than running past its container on a phone. */
|
|
166
168
|
.ds-radio-group--horizontal .ds-radio-group__options {
|
|
167
169
|
flex-direction: row;
|
|
168
|
-
|
|
170
|
+
flex-wrap: wrap;
|
|
171
|
+
gap: var(--gap-200) var(--gap-500); /* 8px rows, 20px between options */
|
|
169
172
|
}
|