rift-ds 1.40.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/README.md +6 -2
- package/behaviors/LoadingImage.d.ts +2 -0
- package/behaviors/LoadingImage.js +34 -0
- package/behaviors/ScrollRegion.js +15 -2
- package/behaviors/VisuallyHidden.d.ts +30 -0
- package/behaviors/VisuallyHidden.js +17 -0
- package/behaviors/loading-image.css +30 -0
- package/behaviors/quietFocus.d.ts +4 -0
- package/behaviors/quietFocus.js +14 -0
- package/behaviors/shell.css +9 -11
- 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 +41 -116
- package/bin/templates/blocks/components/blocks/DocsShell.tsx +5 -1
- package/bin/templates/blocks/registry.json +44 -6
- package/chat/ChatLauncher.d.ts +2 -2
- package/chat/ChatWidget.css +7 -7
- package/chat/ChatWidget.d.ts +1 -1
- package/components/AgentPlan/AgentPlan.css +1 -1
- package/components/AlertDialog/AlertDialog.css +14 -0
- package/components/AlertDialog/AlertDialog.d.ts +35 -3
- package/components/AlertDialog/AlertDialog.js +16 -5
- package/components/AppLayout/AppLayout.css +1 -1
- package/components/AppLayout/AppLayout.d.ts +2 -2
- package/components/AppSidebar/AppSidebar.css +25 -17
- package/components/AppSidebar/AppSidebar.d.ts +4 -4
- package/components/AppSidebar/AppSidebar.js +14 -5
- package/components/Attachment/AttachmentGroup.js +2 -1
- package/components/Attachment/AttachmentTile.js +2 -1
- package/components/Avatar/Avatar.css +18 -5
- package/components/Avatar/Avatar.d.ts +2 -0
- package/components/Avatar/Avatar.js +2 -1
- package/components/AvatarGroup/AvatarGroup.css +8 -1
- package/components/AvatarGroup/AvatarGroup.d.ts +6 -0
- package/components/AvatarGroup/AvatarGroup.js +2 -2
- 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 +91 -4
- package/components/DataTable/DataTable.d.ts +42 -4
- package/components/DataTable/DataTable.js +121 -90
- 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/DrillMenu/DrillMenu.d.ts +2 -1
- package/components/DrillMenu/DrillMenu.js +14 -3
- package/components/Dropdown/Dropdown.css +3 -1
- package/components/EmptyState/EmptyState.css +8 -1
- package/components/EntitySwitcher/EntitySwitcher.css +2 -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/Icon/Icon.css +6 -1
- package/components/Icon/Icon.d.ts +3 -1
- package/components/Icon/Icon.js +2 -0
- 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/PixelAvatar/PixelAvatar.css +7 -1
- package/components/PixelAvatar/PixelAvatar.d.ts +2 -0
- package/components/PixelAvatar/PixelAvatar.js +2 -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/ShaderField/useShaderField.js +2 -2
- package/components/ShaderScene/ShaderScene.js +2 -2
- package/components/SiteHeader/SiteHeader.css +0 -9
- package/components/SourceChip/SourceChip.css +2 -1
- 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/SubNavPanel/SubNavPanel.css +10 -9
- package/components/Table/Table.css +409 -14
- package/components/Table/Table.d.ts +32 -2
- package/components/Table/Table.js +66 -34
- 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 +5 -2
- package/components/registry.json.d.ts +5 -2
- package/components/registry.json.js +1 -1
- package/package.json +9 -3
- package/tokens/motion.d.ts +2 -0
- package/tokens/motion.js +2 -0
- package/tokens/presets/contrast.css +36 -3
- package/tokens/presets/coral.css +39 -3
- package/tokens/presets/forest.css +55 -3
- package/tokens/presets/gold.css +39 -4
- package/tokens/presets/marquee.css +42 -4
- package/tokens/presets/mono.css +107 -29
- package/tokens/presets/pink.css +41 -3
- package/tokens/presets/plum.css +41 -1
- package/tokens/presets/terminal.css +40 -4
- package/tokens/presets/violet.css +42 -3
- package/tokens/presets/warm.css +49 -5
- package/tokens/presets/zest.css +47 -3
- 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 +5 -0
- package/tokens/tokens-light.css +9 -0
- package/tokens/values.d.ts +14 -1
- package/tokens/values.js +14 -1
- package/tokens/values.json.js +1 -1
|
@@ -6,6 +6,7 @@ import "../../fonts/material-symbols.css";
|
|
|
6
6
|
import { useLocale } from "../../behaviors/LocaleProvider.js";
|
|
7
7
|
import { weekStartOf, rotateWeek, isEnglish, weekdayHeadersIn, weekdayNamesIn } from "../../behaviors/locale.js";
|
|
8
8
|
import { MonthGrid } from "./MonthGrid.js";
|
|
9
|
+
import { useToday, PLACEHOLDER_MONTH } from "./today.js";
|
|
9
10
|
import { parseDate, monthLabelIn, dayLabelIn, weekdaysOr, EN_DAYS, formatDate, visuallyHidden, isSameDay, keyMove } from "./calendar.js";
|
|
10
11
|
const DatePicker = React.forwardRef(
|
|
11
12
|
({
|
|
@@ -24,6 +25,8 @@ const DatePicker = React.forwardRef(
|
|
|
24
25
|
weekdayNames,
|
|
25
26
|
locale: localeProp,
|
|
26
27
|
weekStartsOn,
|
|
28
|
+
today: todayProp,
|
|
29
|
+
bare = false,
|
|
27
30
|
className = "",
|
|
28
31
|
...rest
|
|
29
32
|
}, ref) => {
|
|
@@ -43,14 +46,14 @@ const DatePicker = React.forwardRef(
|
|
|
43
46
|
weekdaysOr(weekdayNames, weekdayNamesIn(locale, "long")),
|
|
44
47
|
weekStart
|
|
45
48
|
);
|
|
46
|
-
const today =
|
|
47
|
-
const todayStart = new Date(today.getFullYear(), today.getMonth(), today.getDate());
|
|
48
|
-
const [
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
const
|
|
52
|
-
|
|
53
|
-
);
|
|
49
|
+
const today = useToday(todayProp);
|
|
50
|
+
const todayStart = today ? new Date(today.getFullYear(), today.getMonth(), today.getDate()) : null;
|
|
51
|
+
const [turned, setTurned] = useState(null);
|
|
52
|
+
const anchor = selectedDate ?? today;
|
|
53
|
+
const pending = turned === null && anchor === null;
|
|
54
|
+
const viewMonth = turned?.month ?? anchor?.getMonth() ?? PLACEHOLDER_MONTH.getMonth();
|
|
55
|
+
const viewYear = turned?.year ?? anchor?.getFullYear() ?? PLACEHOLDER_MONTH.getFullYear();
|
|
56
|
+
const setView = (month, year) => setTurned({ month, year });
|
|
54
57
|
const [focusedDate, setFocusedDate] = useState(null);
|
|
55
58
|
const pendingFocus = useRef(false);
|
|
56
59
|
const gridRef = useRef(null);
|
|
@@ -65,24 +68,18 @@ const DatePicker = React.forwardRef(
|
|
|
65
68
|
baseClass,
|
|
66
69
|
`${baseClass}--${size}`,
|
|
67
70
|
disabled ? `${baseClass}--disabled` : "",
|
|
71
|
+
bare ? `${baseClass}--bare` : "",
|
|
72
|
+
pending ? `${baseClass}--pending` : "",
|
|
68
73
|
className
|
|
69
74
|
].filter(Boolean).join(" ");
|
|
70
75
|
const daysInMonth = new Date(viewYear, viewMonth + 1, 0).getDate();
|
|
71
76
|
const goToPrevMonth = () => {
|
|
72
|
-
if (viewMonth === 0)
|
|
73
|
-
|
|
74
|
-
setViewYear(viewYear - 1);
|
|
75
|
-
} else {
|
|
76
|
-
setViewMonth(viewMonth - 1);
|
|
77
|
-
}
|
|
77
|
+
if (viewMonth === 0) setView(11, viewYear - 1);
|
|
78
|
+
else setView(viewMonth - 1, viewYear);
|
|
78
79
|
};
|
|
79
80
|
const goToNextMonth = () => {
|
|
80
|
-
if (viewMonth === 11)
|
|
81
|
-
|
|
82
|
-
setViewYear(viewYear + 1);
|
|
83
|
-
} else {
|
|
84
|
-
setViewMonth(viewMonth + 1);
|
|
85
|
-
}
|
|
81
|
+
if (viewMonth === 11) setView(0, viewYear + 1);
|
|
82
|
+
else setView(viewMonth + 1, viewYear);
|
|
86
83
|
};
|
|
87
84
|
const isDateDisabled = (date) => {
|
|
88
85
|
if (disabled) return true;
|
|
@@ -93,10 +90,7 @@ const DatePicker = React.forwardRef(
|
|
|
93
90
|
};
|
|
94
91
|
const isInView = (date) => date.getMonth() === viewMonth && date.getFullYear() === viewYear;
|
|
95
92
|
const moveFocusTo = (date) => {
|
|
96
|
-
if (!isInView(date))
|
|
97
|
-
setViewMonth(date.getMonth());
|
|
98
|
-
setViewYear(date.getFullYear());
|
|
99
|
-
}
|
|
93
|
+
if (!isInView(date)) setView(date.getMonth(), date.getFullYear());
|
|
100
94
|
setFocusedDate(date);
|
|
101
95
|
pendingFocus.current = true;
|
|
102
96
|
};
|
|
@@ -123,7 +117,7 @@ const DatePicker = React.forwardRef(
|
|
|
123
117
|
let tabStop = [focusedDate, selectedDate, todayStart].find(
|
|
124
118
|
(date) => date !== null && isInView(date) && !isDateDisabled(date)
|
|
125
119
|
) ?? null;
|
|
126
|
-
for (let d = 1; !tabStop && d <= daysInMonth; d++) {
|
|
120
|
+
for (let d = 1; !pending && !tabStop && d <= daysInMonth; d++) {
|
|
127
121
|
const date = new Date(viewYear, viewMonth, d);
|
|
128
122
|
if (!isDateDisabled(date)) tabStop = date;
|
|
129
123
|
}
|
|
@@ -153,7 +147,7 @@ const DatePicker = React.forwardRef(
|
|
|
153
147
|
}
|
|
154
148
|
)
|
|
155
149
|
] }),
|
|
156
|
-
/* @__PURE__ */ jsx("span", { "aria-live": "polite", style: visuallyHidden, children: monthTitle }),
|
|
150
|
+
/* @__PURE__ */ jsx("span", { "aria-live": "polite", style: visuallyHidden, children: turned ? monthTitle : "" }),
|
|
157
151
|
/* @__PURE__ */ jsx(
|
|
158
152
|
MonthGrid,
|
|
159
153
|
{
|
|
@@ -169,7 +163,7 @@ const DatePicker = React.forwardRef(
|
|
|
169
163
|
today,
|
|
170
164
|
dayState: (cell) => {
|
|
171
165
|
const isSelected = Boolean(selectedDate && isSameDay(cell.date, selectedDate));
|
|
172
|
-
const isToday = isSameDay(cell.date, today);
|
|
166
|
+
const isToday = today !== null && isSameDay(cell.date, today);
|
|
173
167
|
return {
|
|
174
168
|
className: [
|
|
175
169
|
!cell.inMonth ? `${baseClass}__cell--outside` : "",
|
|
@@ -32,8 +32,8 @@ export type MonthGridProps = {
|
|
|
32
32
|
label: string;
|
|
33
33
|
/** The day numbers' format. */
|
|
34
34
|
dayNumber: Intl.NumberFormat;
|
|
35
|
-
/** Today, for `aria-current="date"` and its ring. */
|
|
36
|
-
today: Date;
|
|
35
|
+
/** Today, for `aria-current="date"` and its ring; null while it is not yet known, which marks no day. */
|
|
36
|
+
today: Date | null;
|
|
37
37
|
/** The state of each day. */
|
|
38
38
|
dayState: (cell: MonthCell) => DayState;
|
|
39
39
|
/** A day was pressed. */
|
|
@@ -30,7 +30,7 @@ function MonthGrid({
|
|
|
30
30
|
if (hideOutside && !cell.inMonth)
|
|
31
31
|
return /* @__PURE__ */ jsx("div", { className: `${baseClass}__gridcell`, role: "gridcell" }, formatDate(cell.date));
|
|
32
32
|
const state = dayState(cell);
|
|
33
|
-
const isToday = isSameDay(cell.date, today);
|
|
33
|
+
const isToday = today !== null && isSameDay(cell.date, today);
|
|
34
34
|
return /* @__PURE__ */ jsx(
|
|
35
35
|
"div",
|
|
36
36
|
{
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Today, for the date pickers. Internal, beside calendar.ts.
|
|
3
|
+
*
|
|
4
|
+
* A calendar never reads the clock while it prerenders: a host's `today`
|
|
5
|
+
* wins, and without one the device's date is read in the browser only,
|
|
6
|
+
* through `useSyncExternalStore` with a null server snapshot (EventCalendar's
|
|
7
|
+
* rule). So a server render and the hydration that follows it know no today,
|
|
8
|
+
* draw no today ring and agree with each other; the browser then resolves
|
|
9
|
+
* the date and the ring appears. A prerender has nothing unstable in it,
|
|
10
|
+
* which a framework that checks for one (Next's cache components) requires.
|
|
11
|
+
*/
|
|
12
|
+
/** The month a calendar holds its place with, hidden, until its own is known. */
|
|
13
|
+
export declare const PLACEHOLDER_MONTH: Date;
|
|
14
|
+
/** The host's `today` (`YYYY-MM-DD`), else the device's date once the browser has it, else null. */
|
|
15
|
+
export declare function useToday(pinned: string | undefined): Date | null;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { useSyncExternalStore, useMemo } from "react";
|
|
2
|
+
import { parseDate, formatDate } from "./calendar.js";
|
|
3
|
+
const PLACEHOLDER_MONTH = new Date(2e3, 0, 1);
|
|
4
|
+
const subscribeNothing = () => () => {
|
|
5
|
+
};
|
|
6
|
+
const deviceDay = () => formatDate(/* @__PURE__ */ new Date());
|
|
7
|
+
const noDay = () => null;
|
|
8
|
+
function useToday(pinned) {
|
|
9
|
+
const device = useSyncExternalStore(subscribeNothing, pinned ? noDay : deviceDay, noDay);
|
|
10
|
+
const deviceDate = useMemo(() => parseDate(device), [device]);
|
|
11
|
+
const pinnedDate = useMemo(() => parseDate(pinned), [pinned]);
|
|
12
|
+
return pinnedDate ?? deviceDate;
|
|
13
|
+
}
|
|
14
|
+
export {
|
|
15
|
+
PLACEHOLDER_MONTH,
|
|
16
|
+
useToday
|
|
17
|
+
};
|
|
@@ -69,6 +69,19 @@ type DateRangePickerOwnProps = {
|
|
|
69
69
|
locale?: string;
|
|
70
70
|
/** The first column of the grid, 0 (Sunday) to 6 (Saturday). Defaults to the first day of the week in `locale`. */
|
|
71
71
|
weekStartsOn?: Weekday;
|
|
72
|
+
/**
|
|
73
|
+
* The date the calendar treats as today, as `YYYY-MM-DD`: it carries the today ring and
|
|
74
|
+
* picks the month shown first when no range is set. Pass it to pin today
|
|
75
|
+
* for a demo, a test, a time zone the device is not in, or a server render.
|
|
76
|
+
* Unset, today is the device's date, read in the browser only: a server
|
|
77
|
+
* render reads no clock and draws no today ring, and the browser adds it.
|
|
78
|
+
*/
|
|
79
|
+
today?: string;
|
|
80
|
+
/**
|
|
81
|
+
* Drops the picker's own frame (border, fill, radius and padding), for a
|
|
82
|
+
* surface that already draws one: a Popover, a Panel, a Dialog.
|
|
83
|
+
*/
|
|
84
|
+
bare?: boolean;
|
|
72
85
|
/** Additional CSS classes */
|
|
73
86
|
className?: string;
|
|
74
87
|
};
|
|
@@ -82,5 +95,5 @@ export interface DateRangePickerProps extends DateRangePickerOwnProps, Omit<Reac
|
|
|
82
95
|
* DatePicker: arrows, Home and End, Page Up and Page Down move, Enter or
|
|
83
96
|
* Space chooses.
|
|
84
97
|
*/
|
|
85
|
-
export declare function DateRangePicker({ value: valueProp, defaultValue, onValueChange, months, min, max, isDateDisabled: isDateDisabledProp, minLength, maxLength, presets, presetsLabel, size, disabled, name, previousLabel, nextLabel, monthLabel: monthLabelProp, dayLabel: dayLabelProp, rangeStartLabel, rangeEndLabel, inRangeLabel, weekdayLabels, weekdayNames, locale: localeProp, weekStartsOn, className, onPointerLeave, ref, ...rest }: DateRangePickerProps): React.JSX.Element;
|
|
98
|
+
export declare function DateRangePicker({ value: valueProp, defaultValue, onValueChange, months, min, max, isDateDisabled: isDateDisabledProp, minLength, maxLength, presets, presetsLabel, size, disabled, name, previousLabel, nextLabel, monthLabel: monthLabelProp, dayLabel: dayLabelProp, rangeStartLabel, rangeEndLabel, inRangeLabel, weekdayLabels, weekdayNames, locale: localeProp, weekStartsOn, today: todayProp, bare, className, onPointerLeave, ref, ...rest }: DateRangePickerProps): React.JSX.Element;
|
|
86
99
|
export {};
|
|
@@ -4,6 +4,7 @@ import { useState, useMemo, useRef, useEffect } from "react";
|
|
|
4
4
|
import { useLocale } from "../../behaviors/LocaleProvider.js";
|
|
5
5
|
import { weekStartOf, rotateWeek, isEnglish, weekdayHeadersIn, weekdayNamesIn } from "../../behaviors/locale.js";
|
|
6
6
|
import { MonthGrid } from "../DatePicker/MonthGrid.js";
|
|
7
|
+
import { useToday, PLACEHOLDER_MONTH } from "../DatePicker/today.js";
|
|
7
8
|
import { parseDate, monthLabelIn, fullDateIn, weekdaysOr, EN_DAYS, formatDate, isSameDay, visuallyHidden, addMonths, keyMove, daysBetween } from "../DatePicker/calendar.js";
|
|
8
9
|
import { Chip } from "../Chip/Chip.js";
|
|
9
10
|
import "../DatePicker/DatePicker.css";
|
|
@@ -36,6 +37,8 @@ function DateRangePicker({
|
|
|
36
37
|
weekdayNames,
|
|
37
38
|
locale: localeProp,
|
|
38
39
|
weekStartsOn,
|
|
40
|
+
today: todayProp,
|
|
41
|
+
bare = false,
|
|
39
42
|
className = "",
|
|
40
43
|
onPointerLeave,
|
|
41
44
|
ref,
|
|
@@ -58,9 +61,14 @@ function DateRangePicker({
|
|
|
58
61
|
weekStart
|
|
59
62
|
);
|
|
60
63
|
const weekdayFullNames = rotateWeek(weekdaysOr(weekdayNames, weekdayNamesIn(locale, "long")), weekStart);
|
|
61
|
-
const today =
|
|
62
|
-
const
|
|
63
|
-
const
|
|
64
|
+
const today = useToday(todayProp);
|
|
65
|
+
const [turned, setView] = useState(null);
|
|
66
|
+
const anchor = start ?? today;
|
|
67
|
+
const pending = turned === null && anchor === null;
|
|
68
|
+
const view = turned ?? {
|
|
69
|
+
year: (anchor ?? PLACEHOLDER_MONTH).getFullYear(),
|
|
70
|
+
month: (anchor ?? PLACEHOLDER_MONTH).getMonth()
|
|
71
|
+
};
|
|
64
72
|
const [focusedDate, setFocusedDate] = useState(null);
|
|
65
73
|
const [hoverDate, setHoverDate] = useState(null);
|
|
66
74
|
const pendingFocus = useRef(false);
|
|
@@ -74,7 +82,7 @@ function DateRangePicker({
|
|
|
74
82
|
if (!pendingFocus.current || !focusedDate) return;
|
|
75
83
|
pendingFocus.current = false;
|
|
76
84
|
rootRef.current?.querySelector(`[data-date="${formatDate(focusedDate)}"]`)?.focus();
|
|
77
|
-
}, [focusedDate, view]);
|
|
85
|
+
}, [focusedDate, view.year, view.month]);
|
|
78
86
|
const shown = Array.from({ length: months }, (_, i) => {
|
|
79
87
|
const first = new Date(view.year, view.month + i, 1);
|
|
80
88
|
return { year: first.getFullYear(), month: first.getMonth() };
|
|
@@ -101,6 +109,7 @@ function DateRangePicker({
|
|
|
101
109
|
return false;
|
|
102
110
|
};
|
|
103
111
|
const commit = (next) => {
|
|
112
|
+
if (!turned) setView(view);
|
|
104
113
|
if (!controlled) setUncontrolled(next);
|
|
105
114
|
onValueChange?.(next);
|
|
106
115
|
};
|
|
@@ -159,7 +168,7 @@ function DateRangePicker({
|
|
|
159
168
|
let tabStop = [focusedDate, start, today].find(
|
|
160
169
|
(date) => date !== null && isInView(date) && !isDayDisabled(date)
|
|
161
170
|
) ?? null;
|
|
162
|
-
for (let d = new Date(firstShown); !tabStop && d <= lastShown; d = new Date(d.getFullYear(), d.getMonth(), d.getDate() + 1)) {
|
|
171
|
+
for (let d = new Date(firstShown); !pending && !tabStop && d <= lastShown; d = new Date(d.getFullYear(), d.getMonth(), d.getDate() + 1)) {
|
|
163
172
|
if (!isDayDisabled(d)) tabStop = d;
|
|
164
173
|
}
|
|
165
174
|
const activePreset = presets?.findIndex((p) => p.range.start === range.start && p.range.end === range.end) ?? -1;
|
|
@@ -177,6 +186,8 @@ function DateRangePicker({
|
|
|
177
186
|
baseClass,
|
|
178
187
|
`${baseClass}--${size}`,
|
|
179
188
|
disabled ? `${baseClass}--disabled` : "",
|
|
189
|
+
bare ? `${baseClass}--bare` : "",
|
|
190
|
+
pending ? `${baseClass}--pending` : "",
|
|
180
191
|
className
|
|
181
192
|
].filter(Boolean).join(" ");
|
|
182
193
|
const turn = (by) => {
|
|
@@ -248,7 +259,7 @@ function DateRangePicker({
|
|
|
248
259
|
const position = positionOf(cell.date);
|
|
249
260
|
const chosenEnd = position === "start" || position === "end" || position === "start-end";
|
|
250
261
|
const inSpan = Boolean(start && spanEnd && cell.date > start && cell.date < spanEnd);
|
|
251
|
-
const isToday = isSameDay(cell.date, today);
|
|
262
|
+
const isToday = today !== null && isSameDay(cell.date, today);
|
|
252
263
|
const dayDisabled = isDayDisabled(cell.date);
|
|
253
264
|
return {
|
|
254
265
|
className: [
|
|
@@ -280,7 +291,7 @@ function DateRangePicker({
|
|
|
280
291
|
}
|
|
281
292
|
)
|
|
282
293
|
] }, `${year}-${month}`)) }),
|
|
283
|
-
/* @__PURE__ */ jsx("span", { "aria-live": "polite", style: visuallyHidden, children: titles.join(", ") }),
|
|
294
|
+
/* @__PURE__ */ jsx("span", { "aria-live": "polite", style: visuallyHidden, children: turned ? titles.join(", ") : "" }),
|
|
284
295
|
name && /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
285
296
|
/* @__PURE__ */ jsx("input", { type: "hidden", name: `${name}[start]`, value: range.start ?? "", disabled }),
|
|
286
297
|
/* @__PURE__ */ jsx("input", { type: "hidden", name: `${name}[end]`, value: range.end ?? "", disabled })
|
|
@@ -215,4 +215,15 @@
|
|
|
215
215
|
}
|
|
216
216
|
}
|
|
217
217
|
|
|
218
|
+
/* Loading: a placeholder line where each value goes, in a box one text line
|
|
219
|
+
tall, so the list keeps its height when the values land. */
|
|
220
|
+
|
|
221
|
+
.ds-description-list__details--loading {
|
|
222
|
+
min-height: 1lh;
|
|
223
|
+
}
|
|
224
|
+
|
|
225
|
+
.ds-description-list__details--loading > .ds-skeleton {
|
|
226
|
+
width: 60%;
|
|
227
|
+
}
|
|
228
|
+
|
|
218
229
|
} /* @layer rift.components */
|
|
@@ -40,6 +40,10 @@ type DescriptionListOwnProps = {
|
|
|
40
40
|
copiedLabel?: string;
|
|
41
41
|
/** Called after a value is put on the clipboard, so a host can confirm it or count it. Only reaches a list rendered from a client component. */
|
|
42
42
|
onValueCopy?: (value: string) => void;
|
|
43
|
+
/** Holds a placeholder line in place of every value while they are being fetched. The terms stay, and copy buttons and actions wait. */
|
|
44
|
+
loading?: boolean;
|
|
45
|
+
/** Accessible name announced while `loading`. */
|
|
46
|
+
loadingLabel?: string;
|
|
43
47
|
/** Additional CSS classes. */
|
|
44
48
|
className?: string;
|
|
45
49
|
};
|
|
@@ -51,7 +55,7 @@ export interface DescriptionListProps extends DescriptionListOwnProps, Omit<Reac
|
|
|
51
55
|
* narrow, or in a grid; values can be copied or carry a trailing action, and
|
|
52
56
|
* an empty value says so in words. Server-renderable.
|
|
53
57
|
*/
|
|
54
|
-
export declare function DescriptionList({ items, children, layout, columns, dividers, size, termWidth, align, emptyValue, copyLabel, copiedLabel, onValueCopy, className, style, ref, ...rest }: DescriptionListProps): React.JSX.Element;
|
|
58
|
+
export declare function DescriptionList({ items, children, layout, columns, dividers, size, termWidth, align, emptyValue, copyLabel, copiedLabel, onValueCopy, loading, loadingLabel, className, style, ref, ...rest }: DescriptionListProps): React.JSX.Element;
|
|
55
59
|
/** Props owned by DescriptionListItem itself; everything else falls through to the entry's wrapper `<div>`. */
|
|
56
60
|
type DescriptionListItemOwnProps = Omit<DescriptionListEntry, 'id'> & {
|
|
57
61
|
/** The value, as children. `details` wins when both are set. */
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
2
2
|
import React from "react";
|
|
3
3
|
import { DescriptionListCopy } from "./DescriptionListCopy.js";
|
|
4
|
+
import { Skeleton } from "../Skeleton/Skeleton.js";
|
|
4
5
|
import "../../behaviors/visually-hidden.css";
|
|
5
6
|
import "./DescriptionList.css";
|
|
6
7
|
const isEmpty = (value) => value == null || value === false || value === "";
|
|
@@ -12,7 +13,13 @@ function renderEntry({ term, details, id, action, copyable, emphasis }, settings
|
|
|
12
13
|
const classes = ["ds-description-list__item", emphasis && "ds-description-list__item--emphasis", className].filter(Boolean).join(" ");
|
|
13
14
|
return /* @__PURE__ */ jsxs("div", { ...rest, ref, id: id ?? rest.id, className: classes, children: [
|
|
14
15
|
/* @__PURE__ */ jsx("dt", { className: "ds-description-list__term", children: term }),
|
|
15
|
-
/* @__PURE__ */
|
|
16
|
+
settings.loading ? /* @__PURE__ */ jsx("dd", { className: "ds-description-list__details ds-description-list__details--loading", children: /* @__PURE__ */ jsx(
|
|
17
|
+
Skeleton,
|
|
18
|
+
{
|
|
19
|
+
variant: "text",
|
|
20
|
+
...settings.announce ? { loadingLabel: settings.loadingLabel } : { "aria-hidden": true }
|
|
21
|
+
}
|
|
22
|
+
) }) : /* @__PURE__ */ jsxs("dd", { className: "ds-description-list__details", children: [
|
|
16
23
|
/* @__PURE__ */ jsx("span", { className: `ds-description-list__value${empty ? " ds-description-list__value--empty" : ""}`, children: empty ? settings.emptyValue : details }),
|
|
17
24
|
(copyText || action) && /* @__PURE__ */ jsxs("span", { className: "ds-description-list__actions", children: [
|
|
18
25
|
copyText && /* @__PURE__ */ jsx(
|
|
@@ -44,12 +51,15 @@ function DescriptionList({
|
|
|
44
51
|
copyLabel = DEFAULT_COPY_LABEL,
|
|
45
52
|
copiedLabel = "Copied",
|
|
46
53
|
onValueCopy,
|
|
54
|
+
loading = false,
|
|
55
|
+
loadingLabel = "Loading",
|
|
47
56
|
className = "",
|
|
48
57
|
style,
|
|
49
58
|
ref,
|
|
50
59
|
...rest
|
|
51
60
|
}) {
|
|
52
|
-
const settings = { emptyValue, copyLabel, copiedLabel, onValueCopy };
|
|
61
|
+
const settings = { emptyValue, copyLabel, copiedLabel, onValueCopy, loading, loadingLabel };
|
|
62
|
+
const itemCount = items?.length ?? 0;
|
|
53
63
|
const classes = [
|
|
54
64
|
"ds-description-list",
|
|
55
65
|
`ds-description-list--${layout}`,
|
|
@@ -62,10 +72,12 @@ function DescriptionList({
|
|
|
62
72
|
const resolvedStyle = layout === "grid" ? { ...style, "--ds-description-list-columns": columns } : style;
|
|
63
73
|
const composed = React.Children.map(
|
|
64
74
|
children,
|
|
65
|
-
(child) => React.isValidElement(child) && child.type === DescriptionListItem ? React.cloneElement(child, {
|
|
75
|
+
(child, index) => React.isValidElement(child) && child.type === DescriptionListItem ? React.cloneElement(child, {
|
|
76
|
+
[SETTINGS_PROP]: { ...settings, announce: itemCount === 0 && index === 0 }
|
|
77
|
+
}) : child
|
|
66
78
|
);
|
|
67
|
-
return /* @__PURE__ */ jsx("div", { className: "ds-description-list__frame", children: /* @__PURE__ */ jsxs("dl", { ...rest, ref, className: classes, style: resolvedStyle, children: [
|
|
68
|
-
items?.map((entry, index) => /* @__PURE__ */ jsx(React.Fragment, { children: renderEntry(entry, settings) }, entry.id ?? index)),
|
|
79
|
+
return /* @__PURE__ */ jsx("div", { className: "ds-description-list__frame", children: /* @__PURE__ */ jsxs("dl", { ...rest, ref, className: classes, style: resolvedStyle, "aria-busy": loading || void 0, children: [
|
|
80
|
+
items?.map((entry, index) => /* @__PURE__ */ jsx(React.Fragment, { children: renderEntry(entry, { ...settings, announce: index === 0 }) }, entry.id ?? index)),
|
|
69
81
|
composed
|
|
70
82
|
] }) });
|
|
71
83
|
}
|
|
@@ -85,7 +97,10 @@ function DescriptionListItem({
|
|
|
85
97
|
emptyValue: passed?.emptyValue ?? "Not set",
|
|
86
98
|
copyLabel: passed?.copyLabel ?? DEFAULT_COPY_LABEL,
|
|
87
99
|
copiedLabel: passed?.copiedLabel ?? "Copied",
|
|
88
|
-
onValueCopy: passed?.onValueCopy
|
|
100
|
+
onValueCopy: passed?.onValueCopy,
|
|
101
|
+
loading: passed?.loading,
|
|
102
|
+
loadingLabel: passed?.loadingLabel,
|
|
103
|
+
announce: passed?.announce
|
|
89
104
|
};
|
|
90
105
|
return renderEntry(
|
|
91
106
|
{ term, details: details ?? children, action, copyable, emphasis },
|
|
@@ -84,6 +84,15 @@
|
|
|
84
84
|
align-items: flex-start;
|
|
85
85
|
justify-content: space-between;
|
|
86
86
|
gap: var(--gap-400); /* 16px */
|
|
87
|
+
/* The close button's height, held with or without it, so the header
|
|
88
|
+
does not move when `dismissible` flips while the dialog is open. */
|
|
89
|
+
min-height: var(--control-height-compact);
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
/* Without the close button its box is still reserved, so the title keeps
|
|
93
|
+
the same measure and never rewraps when the button comes back. */
|
|
94
|
+
.ds-dialog__header--no-close {
|
|
95
|
+
padding-inline-end: calc(var(--control-height-compact) + var(--gap-400));
|
|
87
96
|
}
|
|
88
97
|
|
|
89
98
|
.ds-dialog__heading {
|
|
@@ -22,6 +22,15 @@ type DialogOwnProps = {
|
|
|
22
22
|
dismissible?: boolean;
|
|
23
23
|
/** Accessible name of the close button. */
|
|
24
24
|
closeLabel?: string;
|
|
25
|
+
/**
|
|
26
|
+
* The element that takes focus when the panel opens: a ref to a field or
|
|
27
|
+
* button inside it. Without one, a child that focused itself on mount
|
|
28
|
+
* (`autoFocus`, when the dialog is mounted already open) keeps focus, and
|
|
29
|
+
* otherwise focus lands on the first control, which is the close button.
|
|
30
|
+
* The dialog stays mounted while closed, so `autoFocus` alone cannot move
|
|
31
|
+
* focus on a later open; pass this ref for that.
|
|
32
|
+
*/
|
|
33
|
+
initialFocus?: React.RefObject<HTMLElement | null>;
|
|
25
34
|
/** Additional CSS classes — applied to the portal container, not the panel */
|
|
26
35
|
className?: string;
|
|
27
36
|
};
|
|
@@ -20,6 +20,7 @@ const Dialog = React.forwardRef(
|
|
|
20
20
|
size = "md",
|
|
21
21
|
dismissible = true,
|
|
22
22
|
closeLabel = "Close dialog",
|
|
23
|
+
initialFocus,
|
|
23
24
|
className = "",
|
|
24
25
|
...rest
|
|
25
26
|
}, ref) => {
|
|
@@ -34,7 +35,13 @@ const Dialog = React.forwardRef(
|
|
|
34
35
|
};
|
|
35
36
|
const mounted = useMounted();
|
|
36
37
|
const layer = useLayer({ open, dismissOnEscape: dismissible, onDismiss: () => onOpenChange(false) });
|
|
37
|
-
|
|
38
|
+
const resolveInitialFocus = () => {
|
|
39
|
+
if (initialFocus?.current) return initialFocus.current;
|
|
40
|
+
const active = document.activeElement;
|
|
41
|
+
const panel = panelRef.current;
|
|
42
|
+
return active instanceof HTMLElement && panel && panel !== active && panel.contains(active) ? active : null;
|
|
43
|
+
};
|
|
44
|
+
useFocusScope(panelRef, { active: open, initialFocus: resolveInitialFocus });
|
|
38
45
|
useScrollLock(open);
|
|
39
46
|
const handleBackdropClick = () => {
|
|
40
47
|
if (dismissible && layer.ownsPress()) onOpenChange(false);
|
|
@@ -59,24 +66,30 @@ const Dialog = React.forwardRef(
|
|
|
59
66
|
"aria-describedby": description ? descId : rest["aria-describedby"],
|
|
60
67
|
tabIndex: -1,
|
|
61
68
|
children: [
|
|
62
|
-
/* @__PURE__ */ jsxs(
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
69
|
+
/* @__PURE__ */ jsxs(
|
|
70
|
+
"div",
|
|
71
|
+
{
|
|
72
|
+
className: [`${baseClass}__header`, dismissible ? "" : `${baseClass}__header--no-close`].filter(Boolean).join(" "),
|
|
73
|
+
children: [
|
|
74
|
+
/* @__PURE__ */ jsxs("div", { className: `${baseClass}__heading`, children: [
|
|
75
|
+
/* @__PURE__ */ jsx("h2", { className: `${baseClass}__title`, id: titleId, children: title }),
|
|
76
|
+
description && /* @__PURE__ */ jsx("p", { className: `${baseClass}__description`, id: descId, children: description })
|
|
77
|
+
] }),
|
|
78
|
+
dismissible && /* @__PURE__ */ jsx(
|
|
79
|
+
IconButton,
|
|
80
|
+
{
|
|
81
|
+
className: `${baseClass}__close`,
|
|
82
|
+
icon: "close",
|
|
83
|
+
variant: "tertiary",
|
|
84
|
+
size: "compact",
|
|
85
|
+
tooltip: false,
|
|
86
|
+
label: closeLabel,
|
|
87
|
+
onClick: () => onOpenChange(false)
|
|
88
|
+
}
|
|
89
|
+
)
|
|
90
|
+
]
|
|
91
|
+
}
|
|
92
|
+
),
|
|
80
93
|
children && // Scrollable when content is long; without a tab stop a keyboard
|
|
81
94
|
// user cannot reach that scroll. The initial-focus query below
|
|
82
95
|
// still prefers a real control, so this does not steal focus.
|
|
@@ -49,6 +49,15 @@ type DrawerOwnProps = {
|
|
|
49
49
|
layout?: 'flush' | 'floating';
|
|
50
50
|
/** Accessible name of the close button. */
|
|
51
51
|
closeLabel?: string;
|
|
52
|
+
/**
|
|
53
|
+
* The element that takes focus when the panel opens: a ref to a field or
|
|
54
|
+
* button inside it. Without one, a child that focused itself on mount
|
|
55
|
+
* (`autoFocus`, when the drawer is mounted already open) keeps focus, and
|
|
56
|
+
* otherwise focus lands on the first control, which is the close button.
|
|
57
|
+
* The drawer stays mounted while closed, so `autoFocus` alone cannot move
|
|
58
|
+
* focus on a later open; pass this ref for that.
|
|
59
|
+
*/
|
|
60
|
+
initialFocus?: React.RefObject<HTMLElement | null>;
|
|
52
61
|
/** Additional CSS classes — applied to the portal container, not the panel */
|
|
53
62
|
className?: string;
|
|
54
63
|
};
|
|
@@ -26,6 +26,7 @@ const Drawer = React.forwardRef(
|
|
|
26
26
|
modal = true,
|
|
27
27
|
layout = "flush",
|
|
28
28
|
closeLabel = "Close drawer",
|
|
29
|
+
initialFocus,
|
|
29
30
|
className = "",
|
|
30
31
|
...rest
|
|
31
32
|
}, ref) => {
|
|
@@ -46,8 +47,15 @@ const Drawer = React.forwardRef(
|
|
|
46
47
|
passive: !modal,
|
|
47
48
|
getElements: modal ? void 0 : () => [panelRef.current]
|
|
48
49
|
});
|
|
50
|
+
const resolveInitialFocus = () => {
|
|
51
|
+
if (initialFocus?.current) return initialFocus.current;
|
|
52
|
+
const active = document.activeElement;
|
|
53
|
+
const panel = panelRef.current;
|
|
54
|
+
return active instanceof HTMLElement && panel && panel !== active && panel.contains(active) ? active : null;
|
|
55
|
+
};
|
|
49
56
|
useFocusScope(panelRef, {
|
|
50
57
|
active: open,
|
|
58
|
+
initialFocus: resolveInitialFocus,
|
|
51
59
|
trap: modal,
|
|
52
60
|
inertOutside: modal,
|
|
53
61
|
// The page stays live beside a non-modal drawer, so by the time it
|
|
@@ -5,7 +5,8 @@ export interface DrillMenuItem {
|
|
|
5
5
|
label: string;
|
|
6
6
|
/**
|
|
7
7
|
* Where the row links. On a row with `items` it is the level's landing
|
|
8
|
-
* page instead: the level opens with an overview row linking to it
|
|
8
|
+
* page instead: the level opens with an overview row linking to it, drawn
|
|
9
|
+
* as the first of the level's rows.
|
|
9
10
|
*/
|
|
10
11
|
href?: string;
|
|
11
12
|
/** Stable identity, used in `path`. Defaults to `href`, then `label`. */
|
|
@@ -144,6 +144,14 @@ function DrillMenu({
|
|
|
144
144
|
else groups.push({ key: `rows-${index}`, rows: [entry] });
|
|
145
145
|
}
|
|
146
146
|
});
|
|
147
|
+
const rowsHaveIcons = groups.some((group) => group.rows.some((row) => row.icon != null));
|
|
148
|
+
const overview = level?.href ? {
|
|
149
|
+
label: overviewLabel(level.label),
|
|
150
|
+
href: level.href,
|
|
151
|
+
icon: rowsHaveIcons ? level.icon ?? "grid_view" : void 0,
|
|
152
|
+
id: `${idOf(level)}#overview`
|
|
153
|
+
} : null;
|
|
154
|
+
const overviewJoins = groups.length > 0 && !groups[0].section?.label && groups[0].rows.length > 0;
|
|
147
155
|
return /* @__PURE__ */ jsx("nav", { ...rest, ref, "aria-label": navLabel, className: ["ds-drill-menu", className].filter(Boolean).join(" "), children: /* @__PURE__ */ jsxs(
|
|
148
156
|
"div",
|
|
149
157
|
{
|
|
@@ -160,10 +168,13 @@ function DrillMenu({
|
|
|
160
168
|
] }),
|
|
161
169
|
/* @__PURE__ */ jsx("h2", { ref: titleRef, tabIndex: -1, className: "ds-drill-menu__title", children: level.title ?? level.label })
|
|
162
170
|
] }) : header && /* @__PURE__ */ jsx("div", { className: "ds-drill-menu__header", children: header }),
|
|
163
|
-
|
|
164
|
-
groups.map(({ key, section, rows }) => /* @__PURE__ */ jsxs("section", { className: "ds-drill-menu__section", children: [
|
|
171
|
+
overview && !overviewJoins && /* @__PURE__ */ jsx("ul", { className: "ds-drill-menu__list", children: renderRow(overview) }),
|
|
172
|
+
groups.map(({ key, section, rows }, index) => /* @__PURE__ */ jsxs("section", { className: "ds-drill-menu__section", children: [
|
|
165
173
|
section?.label && /* @__PURE__ */ jsx("h3", { className: "ds-drill-menu__section-label", children: section.label }),
|
|
166
|
-
rows.length > 0 && /* @__PURE__ */
|
|
174
|
+
rows.length > 0 && /* @__PURE__ */ jsxs("ul", { className: "ds-drill-menu__list", children: [
|
|
175
|
+
overview && overviewJoins && index === 0 && renderRow(overview, section?.variant),
|
|
176
|
+
rows.map((item) => renderRow(item, section?.variant))
|
|
177
|
+
] }),
|
|
167
178
|
section?.content && /* @__PURE__ */ jsx("div", { className: "ds-drill-menu__section-content", children: section.content })
|
|
168
179
|
] }, key))
|
|
169
180
|
]
|
|
@@ -282,7 +282,9 @@
|
|
|
282
282
|
ERROR STATE
|
|
283
283
|
============================================ */
|
|
284
284
|
|
|
285
|
-
|
|
285
|
+
/* The hover rule above is more specific, so the error border names it too. */
|
|
286
|
+
.ds-dropdown--error .ds-dropdown__trigger,
|
|
287
|
+
.ds-dropdown--error .ds-dropdown__trigger:hover:not(:focus-visible) {
|
|
286
288
|
border-color: var(--color-status-error-border);
|
|
287
289
|
}
|
|
288
290
|
|
|
@@ -34,6 +34,10 @@
|
|
|
34
34
|
justify-content: center;
|
|
35
35
|
width: 48px;
|
|
36
36
|
height: 48px;
|
|
37
|
+
/* A hairline, so the tile keeps its edge on a surface that shares its
|
|
38
|
+
fill: an empty state inside a Panel sits on the container colour the
|
|
39
|
+
tile is filled with. */
|
|
40
|
+
border: var(--border-025) solid var(--color-bg-container-border);
|
|
37
41
|
border-radius: var(--radius-pill);
|
|
38
42
|
background-color: var(--color-bg-container-primary);
|
|
39
43
|
color: var(--color-icon-primary);
|
|
@@ -47,11 +51,13 @@
|
|
|
47
51
|
/* Tones: the icon tile takes a status role, for a result that worked or a
|
|
48
52
|
step that failed; the copy stays in the page's text colours. */
|
|
49
53
|
.ds-empty-state--positive .ds-empty-state__icon {
|
|
54
|
+
border-color: transparent;
|
|
50
55
|
background-color: var(--color-status-positive-bg);
|
|
51
56
|
color: var(--color-status-positive-icon);
|
|
52
57
|
}
|
|
53
58
|
|
|
54
59
|
.ds-empty-state--error .ds-empty-state__icon {
|
|
60
|
+
border-color: transparent;
|
|
55
61
|
background-color: var(--color-status-error-bg);
|
|
56
62
|
color: var(--color-status-error-icon);
|
|
57
63
|
}
|
|
@@ -106,7 +112,8 @@
|
|
|
106
112
|
|
|
107
113
|
.ds-empty-state--bordered {
|
|
108
114
|
border: var(--border-025) dashed var(--color-bg-container-border);
|
|
109
|
-
|
|
115
|
+
/* The content-card corner, Panel's and Widget's. */
|
|
116
|
+
border-radius: var(--radius-600); /* 24px */
|
|
110
117
|
}
|
|
111
118
|
|
|
112
119
|
/* ============================================
|
|
@@ -143,7 +143,8 @@
|
|
|
143
143
|
width: var(--icon-size-600);
|
|
144
144
|
height: var(--icon-size-600);
|
|
145
145
|
overflow: hidden;
|
|
146
|
-
|
|
146
|
+
/* The shared mark hook: a container's `roundMarks` rounds it. */
|
|
147
|
+
border-radius: var(--ds-mark-radius, var(--radius-200));
|
|
147
148
|
background-color: var(--color-bg-container-secondary);
|
|
148
149
|
color: var(--color-text-secondary);
|
|
149
150
|
transition: background-color var(--motion-duration-base) var(--motion-ease-standard);
|