rift-ds 1.42.0 → 1.43.1
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/behaviors/framePacer.d.ts +5 -0
- package/behaviors/framePacer.js +44 -0
- package/behaviors/useFocusScope.js +4 -2
- package/behaviors/useLayer.d.ts +16 -0
- package/behaviors/useLayer.js +12 -2
- package/bin/rift-ds.mjs +25 -5
- package/bin/templates/blocks/app/dashboard/page.module.css +2 -2
- package/bin/templates/blocks/app/notifications/Inbox.tsx +13 -45
- package/bin/templates/blocks/app/notifications/page.module.css +5 -0
- package/bin/templates/blocks/app/planner/page.tsx +2 -2
- package/bin/templates/blocks/app/settings/Settings.tsx +4 -4
- package/bin/templates/blocks/components/blocks/AppShell.tsx +13 -18
- package/bin/templates/blocks/components/blocks/notifications.ts +77 -0
- package/bin/templates/blocks/registry.json +5 -0
- package/chat/ChatWidget.js +2 -1
- package/chat/ResponseActions.js +3 -1
- package/chat/server.d.ts +1 -1
- package/chat/server.js +6 -1
- package/chat/upstash.js +13 -1
- package/components/AiButton/AiButton.js +1 -1
- package/components/AppLayout/AppLayout.css +7 -0
- package/components/AppLayout/AppLayout.d.ts +4 -0
- package/components/AppLayout/AppLayout.js +5 -1
- package/components/AppSidebar/AppSidebar.css +4 -0
- package/components/AppSidebar/AppSidebar.js +7 -2
- package/components/AppToolbar/AppToolbar.d.ts +5 -2
- package/components/AppToolbar/AppToolbar.js +3 -1
- package/components/Attachment/Attachment.css +1 -0
- package/components/Attachment/AttachmentDropZone.js +1 -1
- package/components/Chart/AreaChart.js +7 -1
- package/components/Chart/Chart.css +12 -0
- package/components/Chart/LineChart.js +7 -1
- package/components/Chart/RadarChart.js +2 -1
- package/components/Chart/ScatterChart.js +7 -1
- package/components/Chart/StackedBarChart.js +7 -1
- package/components/ChatMessage/ChatMessage.css +6 -0
- package/components/ColorPicker/ColorPicker.css +1 -0
- package/components/Combobox/Combobox.css +8 -0
- package/components/CommandPalette/CommandPalette.css +1 -0
- package/components/Composer/Composer.css +1 -0
- package/components/ContextMenu/ContextMenu.css +1 -0
- package/components/CurrencyInput/CurrencyInput.d.ts +1 -1
- package/components/CurrencyInput/CurrencyInput.js +2 -1
- package/components/DataTable/DataTable.css +6 -0
- package/components/DataTable/DataTable.d.ts +2 -2
- package/components/DataTable/DataTable.js +11 -8
- package/components/DataTable/columnTypes.js +1 -0
- package/components/DateInput/DateInput.css +7 -0
- package/components/DatePicker/calendar.d.ts +5 -1
- package/components/DatePicker/calendar.js +3 -3
- package/components/DateRangePicker/DateRangePicker.js +77 -73
- package/components/Dialog/Dialog.css +1 -0
- package/components/Drawer/Drawer.css +1 -0
- package/components/Dropdown/Dropdown.css +7 -0
- package/components/Dropdown/Dropdown.js +9 -0
- package/components/EntitySwitcher/EntitySwitcher.js +1 -0
- package/components/ErrorSummary/ErrorSummary.js +5 -0
- package/components/EventCalendar/EventCalendar.css +12 -0
- package/components/EventCalendar/EventCalendar.js +29 -23
- package/components/Globe/Globe.js +32 -3
- package/components/Input/Input.css +12 -0
- package/components/Inspector/Inspector.css +6 -1
- package/components/Lightbox/Lightbox.css +1 -0
- package/components/Menubar/Menubar.css +1 -0
- package/components/NotificationCenter/NotificationCenter.css +136 -27
- package/components/NotificationCenter/NotificationCenter.d.ts +67 -8
- package/components/NotificationCenter/NotificationCenter.js +97 -12
- package/components/NumberInput/NumberInput.css +8 -0
- package/components/Popover/Popover.css +3 -0
- package/components/Popover/Popover.d.ts +1 -1
- package/components/Popover/Popover.js +14 -2
- package/components/QuestionCard/QuestionCard.css +8 -4
- package/components/RadioButton/RadioButton.js +1 -0
- package/components/RichDropdown/RichDropdown.css +7 -0
- package/components/RichDropdown/RichDropdown.js +1 -0
- package/components/SegmentedControl/SegmentedControl.css +5 -0
- package/components/ShaderField/useShaderField.js +4 -2
- package/components/ShaderScene/ShaderScene.js +5 -2
- package/components/SiteLayout/SiteLayout.css +1 -0
- package/components/Slider/Slider.css +12 -0
- package/components/Slider/Slider.js +1 -1
- package/components/Stat/Stat.css +8 -0
- package/components/Table/Table.css +5 -0
- package/components/TableToolbar/TableToolbar.css +1 -0
- package/components/TableToolbar/TableToolbar.js +18 -1
- package/components/TagInput/TagInput.css +8 -0
- package/components/Textarea/Textarea.css +7 -0
- package/components/ThemeToggle/colorMode.d.ts +3 -3
- package/components/ThreadHistory/ThreadHistory.css +1 -0
- package/components/TimePicker/TimePicker.css +7 -0
- package/components/TimePicker/TimePicker.js +1 -0
- package/components/Toolbar/Toolbar.d.ts +6 -1
- package/components/Wizard/Wizard.d.ts +8 -3
- package/components/Wizard/Wizard.js +4 -1
- package/components/registry.d.ts +8 -0
- package/components/registry.json +30 -5
- package/components/registry.json.d.ts +30 -5
- package/components/registry.json.js +1 -1
- package/package.json +1 -1
- package/tokens/motion.d.ts +1 -1
- package/tokens/presets/zest.css +9 -11
- package/tokens/values.d.ts +10 -3
- package/tokens/values.js +11 -5
- package/tokens/values.json.js +1 -1
package/chat/ResponseActions.js
CHANGED
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
import { jsxs, Fragment, jsx } from "react/jsx-runtime";
|
|
3
3
|
import { createContext, useContext, useState, useRef, useEffect } from "react";
|
|
4
4
|
import { MOTION_FEEDBACK_RESET_MS } from "../tokens/motion.js";
|
|
5
|
+
import { writeClipboard } from "../behaviors/clipboard.js";
|
|
5
6
|
import { useChatWidget } from "./context.js";
|
|
6
7
|
import "../behaviors/visually-hidden.css";
|
|
7
8
|
const ResponseActionsLabelsContext = createContext({
|
|
@@ -24,7 +25,8 @@ function ResponseActions({ turn }) {
|
|
|
24
25
|
);
|
|
25
26
|
const copy = async () => {
|
|
26
27
|
try {
|
|
27
|
-
await navigator.clipboard.writeText(turn.text);
|
|
28
|
+
if (navigator.clipboard?.writeText) await navigator.clipboard.writeText(turn.text);
|
|
29
|
+
else writeClipboard(turn.text);
|
|
28
30
|
} catch {
|
|
29
31
|
return;
|
|
30
32
|
}
|
package/chat/server.d.ts
CHANGED
|
@@ -94,7 +94,7 @@ export interface ChatGuardrails {
|
|
|
94
94
|
onUsage?: (usage: TokenUsage, modelId: string) => Promise<void>;
|
|
95
95
|
/** Called once per exchange. Its presence is what makes the handler stream an `exchange` id, and so what shows the thumbs. */
|
|
96
96
|
onExchange?: (entry: ExchangeLog) => Promise<void>;
|
|
97
|
-
/**
|
|
97
|
+
/** The follow-ups and starters handlers' gate: a per-visitor limit, and in the Upstash guardrails the day's spend cap too. */
|
|
98
98
|
checkFollowups?: (request: Request) => Promise<boolean>;
|
|
99
99
|
/** Per-visitor limit for the feedback handler. */
|
|
100
100
|
checkFeedback?: (request: Request) => Promise<boolean>;
|
package/chat/server.js
CHANGED
|
@@ -13,6 +13,7 @@ const DEFAULT_ASK_USER_DESCRIPTION = [
|
|
|
13
13
|
"Prefer one question. Use several (at most 4) only when you need all the answers before you can continue. mode is single when one answer fits and multi when several can be true together.",
|
|
14
14
|
"Set other to true when the options may not cover every answer."
|
|
15
15
|
].join(" ");
|
|
16
|
+
const NOTICE_QUESTION_CHARS = 300;
|
|
16
17
|
const DEFAULT_CHAT_LIMITS = {
|
|
17
18
|
maxTurns: 10,
|
|
18
19
|
maxMessageChars: 4e3,
|
|
@@ -74,6 +75,9 @@ function parseBody(payload, limits, models, sanitise) {
|
|
|
74
75
|
if (typeof content !== "string") {
|
|
75
76
|
return { ok: false, status: 400, reason: "content must be a string" };
|
|
76
77
|
}
|
|
78
|
+
if (role === "user" && content.length > limits.maxMessageChars && entry !== messages[messages.length - 1]) {
|
|
79
|
+
return { ok: false, status: 413, reason: "conversation is too large" };
|
|
80
|
+
}
|
|
77
81
|
if (content.trim()) parsed.push({ role, content });
|
|
78
82
|
}
|
|
79
83
|
if (parsed.length === 0) return { ok: false, status: 400, reason: "no messages with content" };
|
|
@@ -204,7 +208,8 @@ function createChatHandler(options) {
|
|
|
204
208
|
if (!verdict.allowed) {
|
|
205
209
|
const logged = log({
|
|
206
210
|
id: exchangeId,
|
|
207
|
-
|
|
211
|
+
// Cut short: a refused request is the one a loop repeats, and its log must stay small.
|
|
212
|
+
question: question.slice(0, NOTICE_QUESTION_CHARS),
|
|
208
213
|
answer: verdict.notice,
|
|
209
214
|
path: parsed.path,
|
|
210
215
|
latencyMs: Date.now() - startedAt,
|
package/chat/upstash.js
CHANGED
|
@@ -119,6 +119,18 @@ function createUpstashGuardrails(options = {}) {
|
|
|
119
119
|
return true;
|
|
120
120
|
}
|
|
121
121
|
};
|
|
122
|
+
const followupsLimit = perVisitorLimit("followups", followupsPerMinute);
|
|
123
|
+
const checkFollowups = async (request) => {
|
|
124
|
+
if (!await followupsLimit(request)) return false;
|
|
125
|
+
const instance = getRedis();
|
|
126
|
+
if (!instance) return true;
|
|
127
|
+
try {
|
|
128
|
+
return (await instance.get(spendKey()) ?? 0) < dailySpendCapTenths;
|
|
129
|
+
} catch (error) {
|
|
130
|
+
console.error("[chat] followups budget check failed, allowing:", error);
|
|
131
|
+
return true;
|
|
132
|
+
}
|
|
133
|
+
};
|
|
122
134
|
const onFeedback = async (id, verdict, visitor) => {
|
|
123
135
|
const instance = getRedis();
|
|
124
136
|
if (!instance) return;
|
|
@@ -135,7 +147,7 @@ function createUpstashGuardrails(options = {}) {
|
|
|
135
147
|
visitorKey,
|
|
136
148
|
onUsage,
|
|
137
149
|
onExchange,
|
|
138
|
-
checkFollowups
|
|
150
|
+
checkFollowups,
|
|
139
151
|
checkFeedback: perVisitorLimit("feedback", feedbackPerMinute),
|
|
140
152
|
onFeedback
|
|
141
153
|
};
|
|
@@ -177,7 +177,7 @@ const AiButton = React.forwardRef(
|
|
|
177
177
|
className
|
|
178
178
|
].filter(Boolean).join(" ");
|
|
179
179
|
const iconClass = `${baseClass}__icon`;
|
|
180
|
-
const restingIcon = typeof icon === "string" ? /* @__PURE__ */ jsx("span", { className: `${iconClass}-glyph material-symbols-rounded ${mirrorClass(icon)}`, children: icon }) : icon;
|
|
180
|
+
const restingIcon = typeof icon === "string" ? /* @__PURE__ */ jsx("span", { className: `${iconClass}-glyph material-symbols-rounded ${mirrorClass(icon)}`, "aria-hidden": "true", children: icon }) : icon;
|
|
181
181
|
const shownIcon = shownStatus === "idle" ? restingIcon : /* @__PURE__ */ jsx(AgentStatusMark, { state: shownStatus });
|
|
182
182
|
const content = /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
183
183
|
(icon || status !== void 0) && /* @__PURE__ */ jsx("span", { className: iconClass, "aria-hidden": "true", children: /* @__PURE__ */ jsx(
|
|
@@ -20,6 +20,13 @@
|
|
|
20
20
|
/* ============================================
|
|
21
21
|
MAIN CONTENT AREA
|
|
22
22
|
============================================ */
|
|
23
|
+
/* The skip link lands here: the region takes the focus without a ring of
|
|
24
|
+
its own around the whole page. */
|
|
25
|
+
.ds-app-layout__main:focus {
|
|
26
|
+
/* ds-allow(focus): never a tab stop: the skip link lands here, and a ring round the whole page would mark nothing */
|
|
27
|
+
outline: none;
|
|
28
|
+
}
|
|
29
|
+
|
|
23
30
|
.ds-app-layout__main {
|
|
24
31
|
flex: 1;
|
|
25
32
|
display: flex;
|
|
@@ -79,6 +79,10 @@ type AppLayoutOwnProps = {
|
|
|
79
79
|
* component and the rail's seat) are its own.
|
|
80
80
|
*/
|
|
81
81
|
sidebarProps?: AppLayoutSidebarProps;
|
|
82
|
+
/** The id of the main region, the skip link's target. */
|
|
83
|
+
mainId?: string;
|
|
84
|
+
/** The skip link's text, the page's first stop, which jumps past the sidebar and toolbar to the content. Pass an empty string for none. */
|
|
85
|
+
skipLinkLabel?: string;
|
|
82
86
|
/** Additional CSS classes on outer wrapper */
|
|
83
87
|
className?: string;
|
|
84
88
|
};
|
|
@@ -3,6 +3,7 @@ import { jsxs, jsx } from "react/jsx-runtime";
|
|
|
3
3
|
import React, { useState, useCallback, useRef, useEffect } from "react";
|
|
4
4
|
import { AppSidebar } from "../AppSidebar/AppSidebar.js";
|
|
5
5
|
import { MOTION_SCROLL_SETTLE_MS } from "../../tokens/motion.js";
|
|
6
|
+
import { Link } from "../Link/Link.js";
|
|
6
7
|
import "../../behaviors/shell.css";
|
|
7
8
|
import "./AppLayout.css";
|
|
8
9
|
const AppLayout = React.forwardRef(
|
|
@@ -23,6 +24,8 @@ const AppLayout = React.forwardRef(
|
|
|
23
24
|
theme = "dark",
|
|
24
25
|
linkComponent,
|
|
25
26
|
sidebarProps,
|
|
27
|
+
mainId = "main",
|
|
28
|
+
skipLinkLabel = "Skip to content",
|
|
26
29
|
className = "",
|
|
27
30
|
...rest
|
|
28
31
|
}, ref) => {
|
|
@@ -61,6 +64,7 @@ const AppLayout = React.forwardRef(
|
|
|
61
64
|
"data-ds-shell": layout,
|
|
62
65
|
"data-ds-width": width,
|
|
63
66
|
children: [
|
|
67
|
+
skipLinkLabel && /* @__PURE__ */ jsx(Link, { variant: "skip", href: `#${mainId}`, children: skipLinkLabel }),
|
|
64
68
|
/* @__PURE__ */ jsx(
|
|
65
69
|
AppSidebar,
|
|
66
70
|
{
|
|
@@ -79,7 +83,7 @@ const AppLayout = React.forwardRef(
|
|
|
79
83
|
linkComponent
|
|
80
84
|
}
|
|
81
85
|
),
|
|
82
|
-
/* @__PURE__ */ jsx("main", { className: `${baseClass}__main`, children: layout === "inset" ? (
|
|
86
|
+
/* @__PURE__ */ jsx("main", { id: mainId, className: `${baseClass}__main`, tabIndex: -1, children: layout === "inset" ? (
|
|
83
87
|
// The surface clips to its rounded corners and the scroller
|
|
84
88
|
// inside it scrolls, so the scrollbar never squares a corner.
|
|
85
89
|
/* @__PURE__ */ jsx("div", { className: `${baseClass}__surface`, children: /* @__PURE__ */ jsx("div", { className: `${baseClass}__scroller`, onScroll: handleSurfaceScroll, children: content }) })
|
|
@@ -180,6 +180,9 @@
|
|
|
180
180
|
align-items: center;
|
|
181
181
|
gap: var(--gap-500);
|
|
182
182
|
min-width: 0;
|
|
183
|
+
/* In the rail the logo is the button that opens the sidebar, and its
|
|
184
|
+
focus ring follows the round controls beside it. */
|
|
185
|
+
border-radius: var(--radius-pill);
|
|
183
186
|
}
|
|
184
187
|
|
|
185
188
|
.ds-app-sidebar__logo-icon {
|
|
@@ -1422,6 +1425,7 @@
|
|
|
1422
1425
|
/* The rail's standalone controls (the collapse toggle, the profile menu
|
|
1423
1426
|
button, the mobile trigger) take the same ring, outside their round box as
|
|
1424
1427
|
Button's sits, rather than the browser's default. */
|
|
1428
|
+
.ds-app-sidebar__logo-inner:focus-visible,
|
|
1425
1429
|
.ds-app-sidebar__toggle:focus-visible,
|
|
1426
1430
|
.ds-app-sidebar__profile-more:focus-visible,
|
|
1427
1431
|
.ds-app-sidebar__mobile-trigger:focus-visible {
|
|
@@ -509,7 +509,9 @@ const AppSidebar = React.forwardRef(function AppSidebar2({
|
|
|
509
509
|
className: `${baseClass}__toggle`,
|
|
510
510
|
onClick: mobileOpen ? closeMobile : toggleExpanded,
|
|
511
511
|
"aria-label": toggleLabel,
|
|
512
|
-
|
|
512
|
+
tabIndex: isExpanded || mobileOpen ? void 0 : -1,
|
|
513
|
+
"aria-hidden": isExpanded || mobileOpen ? void 0 : true,
|
|
514
|
+
children: /* @__PURE__ */ jsx("span", { className: "material-symbols-rounded ds-mirror-rtl", "aria-hidden": "true", children: mobileOpen ? "close" : isExpanded ? "left_panel_close" : "left_panel_open" })
|
|
513
515
|
}
|
|
514
516
|
) })
|
|
515
517
|
] }),
|
|
@@ -603,6 +605,7 @@ const AppSidebar = React.forwardRef(function AppSidebar2({
|
|
|
603
605
|
"span",
|
|
604
606
|
{
|
|
605
607
|
className: `${baseClass}__btn-icon${typeof item.icon === "string" ? ` material-symbols-rounded ${mirrorClass(item.icon)}` : ` ${baseClass}__btn-icon--node`}`,
|
|
608
|
+
"aria-hidden": typeof item.icon === "string" ? true : void 0,
|
|
606
609
|
children: item.icon
|
|
607
610
|
}
|
|
608
611
|
),
|
|
@@ -621,6 +624,7 @@ const AppSidebar = React.forwardRef(function AppSidebar2({
|
|
|
621
624
|
`${baseClass}__btn-chevron material-symbols-rounded ds-mirror-rtl`,
|
|
622
625
|
isOpen && !isPanelMode ? `${baseClass}__btn-chevron--open` : ""
|
|
623
626
|
].filter(Boolean).join(" "),
|
|
627
|
+
"aria-hidden": "true",
|
|
624
628
|
children: "chevron_right"
|
|
625
629
|
}
|
|
626
630
|
)
|
|
@@ -669,6 +673,7 @@ const AppSidebar = React.forwardRef(function AppSidebar2({
|
|
|
669
673
|
`${baseClass}__sub-items`,
|
|
670
674
|
isOpen && isExpanded ? `${baseClass}__sub-items--open` : ""
|
|
671
675
|
].filter(Boolean).join(" "),
|
|
676
|
+
inert: !(isOpen && isExpanded) || void 0,
|
|
672
677
|
children: item.children.map((sub) => {
|
|
673
678
|
const subHasChildren = Boolean(sub.children?.length);
|
|
674
679
|
const subIsSource = subHasChildren && sub.key === panelSourceKey;
|
|
@@ -783,7 +788,7 @@ const AppSidebar = React.forwardRef(function AppSidebar2({
|
|
|
783
788
|
className: `${baseClass}__profile-more`,
|
|
784
789
|
onClick: onProfileMore,
|
|
785
790
|
"aria-label": profileMoreLabel,
|
|
786
|
-
children: /* @__PURE__ */ jsx("span", { className: "material-symbols-rounded", children: "more_horiz" })
|
|
791
|
+
children: /* @__PURE__ */ jsx("span", { className: "material-symbols-rounded", "aria-hidden": "true", children: "more_horiz" })
|
|
787
792
|
}
|
|
788
793
|
)
|
|
789
794
|
] }),
|
|
@@ -42,7 +42,9 @@ type AppToolbarOwnProps = {
|
|
|
42
42
|
/**
|
|
43
43
|
* Opens the app's search, usually a CommandPalette. When given, the bar
|
|
44
44
|
* starts with a search field, never narrower than a usable field, folded
|
|
45
|
-
* to its icon when the bar is narrow.
|
|
45
|
+
* to its icon when the bar is narrow. The field is a CommandPaletteTrigger
|
|
46
|
+
* the bar draws itself: pass this handler rather than seating a trigger
|
|
47
|
+
* of your own beside the bar, which the bar cannot fold.
|
|
46
48
|
*/
|
|
47
49
|
onSearch?: React.MouseEventHandler<HTMLButtonElement>;
|
|
48
50
|
/** The search field's prompt and accessible name. Default "Search or ask anything". */
|
|
@@ -62,7 +64,8 @@ type AppToolbarOwnProps = {
|
|
|
62
64
|
/**
|
|
63
65
|
* The icon controls at the end, borderless: notifications, a calendar,
|
|
64
66
|
* help, settings. On a narrow bar every one after the first moves into a
|
|
65
|
-
* More menu, except those that open a panel or are links
|
|
67
|
+
* More menu, except those that open a panel or are links, and except
|
|
68
|
+
* when only one could move, which stays in the bar.
|
|
66
69
|
*/
|
|
67
70
|
actions?: AppToolbarAction[];
|
|
68
71
|
/**
|
|
@@ -27,7 +27,9 @@ function AppToolbar({
|
|
|
27
27
|
...rest
|
|
28
28
|
}) {
|
|
29
29
|
const baseClass = "ds-app-toolbar";
|
|
30
|
-
const
|
|
30
|
+
const canFold = (action, index) => index > 0 && !action.panel && !action.href;
|
|
31
|
+
const foldsAny = actions.filter(canFold).length > 1;
|
|
32
|
+
const folds = (action, index) => foldsAny && canFold(action, index);
|
|
31
33
|
const foldable = actions.filter(folds);
|
|
32
34
|
const moreItems = foldable.map((action) => ({
|
|
33
35
|
id: action.id,
|
|
@@ -730,6 +730,7 @@ button.ds-attachment-group__single:focus-visible {
|
|
|
730
730
|
background-color: var(--color-bg-page-primary);
|
|
731
731
|
box-shadow: var(--shadow-modal);
|
|
732
732
|
overflow: hidden;
|
|
733
|
+
/* ds-allow(focus): never a tab stop: script moves focus here (tabindex -1) and the controls inside show their own */
|
|
733
734
|
outline: none;
|
|
734
735
|
transform: scale(0.96);
|
|
735
736
|
transition: transform var(--motion-duration-base) var(--motion-ease-standard);
|
|
@@ -62,7 +62,7 @@ const AttachmentDropZone = React.forwardRef(
|
|
|
62
62
|
children: [
|
|
63
63
|
children,
|
|
64
64
|
/* @__PURE__ */ jsx("div", { className: `${baseClass}__overlay`, "aria-hidden": "true", children: /* @__PURE__ */ jsxs("div", { className: `${baseClass}__message`, children: [
|
|
65
|
-
icon !== null && icon !== void 0 && /* @__PURE__ */ jsx("span", { className: `${baseClass}__icon`, children: typeof icon === "string" ? /* @__PURE__ */ jsx("span", { className: `material-symbols-rounded ${mirrorClass(icon)}`, children: icon }) : icon }),
|
|
65
|
+
icon !== null && icon !== void 0 && /* @__PURE__ */ jsx("span", { className: `${baseClass}__icon`, children: typeof icon === "string" ? /* @__PURE__ */ jsx("span", { className: `material-symbols-rounded ${mirrorClass(icon)}`, "aria-hidden": "true", children: icon }) : icon }),
|
|
66
66
|
/* @__PURE__ */ jsx("span", { className: `${baseClass}__label`, children: label }),
|
|
67
67
|
hint && /* @__PURE__ */ jsx("span", { className: `${baseClass}__hint`, children: hint })
|
|
68
68
|
] }) })
|
|
@@ -129,7 +129,13 @@ const AreaChart = React.forwardRef(({
|
|
|
129
129
|
},
|
|
130
130
|
s.dataKey
|
|
131
131
|
)),
|
|
132
|
-
showLegend && series.length > 1 && /* @__PURE__ */ jsx(
|
|
132
|
+
showLegend && series.length > 1 && /* @__PURE__ */ jsx(
|
|
133
|
+
Legend,
|
|
134
|
+
{
|
|
135
|
+
wrapperStyle: { color: textSecondary, fontSize: textSize },
|
|
136
|
+
formatter: (value) => /* @__PURE__ */ jsx("span", { style: { color: textSecondary }, children: value })
|
|
137
|
+
}
|
|
138
|
+
)
|
|
133
139
|
] }) })
|
|
134
140
|
] })
|
|
135
141
|
]
|
|
@@ -357,4 +357,16 @@
|
|
|
357
357
|
}
|
|
358
358
|
}
|
|
359
359
|
|
|
360
|
+
/* ============================================
|
|
361
|
+
FOCUS — the drawing is a tab stop (the arrow
|
|
362
|
+
keys move the tooltip), so it takes the
|
|
363
|
+
system ring, not the browser's.
|
|
364
|
+
============================================ */
|
|
365
|
+
|
|
366
|
+
.ds-chart .recharts-surface:focus-visible {
|
|
367
|
+
outline: 2px solid var(--color-action-primary-bg);
|
|
368
|
+
outline-offset: 2px;
|
|
369
|
+
border-radius: var(--radius-100);
|
|
370
|
+
}
|
|
371
|
+
|
|
360
372
|
} /* @layer rift.components */
|
|
@@ -135,7 +135,13 @@ const LineChart = React.forwardRef(({
|
|
|
135
135
|
},
|
|
136
136
|
s.dataKey
|
|
137
137
|
)),
|
|
138
|
-
showLegend && series.length > 1 && /* @__PURE__ */ jsx(
|
|
138
|
+
showLegend && series.length > 1 && /* @__PURE__ */ jsx(
|
|
139
|
+
Legend,
|
|
140
|
+
{
|
|
141
|
+
wrapperStyle: { color: textSecondary, fontSize: textSize },
|
|
142
|
+
formatter: (value) => /* @__PURE__ */ jsx("span", { style: { color: textSecondary }, children: value })
|
|
143
|
+
}
|
|
144
|
+
)
|
|
139
145
|
] }) })
|
|
140
146
|
] })
|
|
141
147
|
]
|
|
@@ -126,7 +126,8 @@ const RadarChart = React.forwardRef(({
|
|
|
126
126
|
series.length > 1 && /* @__PURE__ */ jsx(
|
|
127
127
|
Legend,
|
|
128
128
|
{
|
|
129
|
-
wrapperStyle: { color: textSecondary, fontSize: textSize }
|
|
129
|
+
wrapperStyle: { color: textSecondary, fontSize: textSize },
|
|
130
|
+
formatter: (value) => /* @__PURE__ */ jsx("span", { style: { color: textSecondary }, children: value })
|
|
130
131
|
}
|
|
131
132
|
)
|
|
132
133
|
] }) })
|
|
@@ -126,7 +126,13 @@ const ScatterChart = React.forwardRef(({
|
|
|
126
126
|
},
|
|
127
127
|
ds.name
|
|
128
128
|
)),
|
|
129
|
-
datasets.length > 1 && /* @__PURE__ */ jsx(
|
|
129
|
+
datasets.length > 1 && /* @__PURE__ */ jsx(
|
|
130
|
+
Legend,
|
|
131
|
+
{
|
|
132
|
+
wrapperStyle: { color: textSecondary, fontSize: textSize },
|
|
133
|
+
formatter: (value) => /* @__PURE__ */ jsx("span", { style: { color: textSecondary }, children: value })
|
|
134
|
+
}
|
|
135
|
+
)
|
|
130
136
|
] }) })
|
|
131
137
|
] })
|
|
132
138
|
]
|
|
@@ -127,7 +127,13 @@ const StackedBarChart = React.forwardRef(({
|
|
|
127
127
|
},
|
|
128
128
|
s.dataKey
|
|
129
129
|
)),
|
|
130
|
-
showLegend && series.length > 1 && /* @__PURE__ */ jsx(
|
|
130
|
+
showLegend && series.length > 1 && /* @__PURE__ */ jsx(
|
|
131
|
+
Legend,
|
|
132
|
+
{
|
|
133
|
+
wrapperStyle: { color: textSecondary, fontSize: textSize },
|
|
134
|
+
formatter: (value) => /* @__PURE__ */ jsx("span", { style: { color: textSecondary }, children: value })
|
|
135
|
+
}
|
|
136
|
+
)
|
|
131
137
|
] }) })
|
|
132
138
|
] })
|
|
133
139
|
]
|
|
@@ -166,6 +166,12 @@
|
|
|
166
166
|
.ds-chat-message--bubble.ds-chat-message--user .ds-chat-message__content {
|
|
167
167
|
background-color: var(--color-chat-bubble-sent-bg);
|
|
168
168
|
color: var(--color-chat-bubble-sent-text);
|
|
169
|
+
/* A theme may fill this bubble with its action colour, and a mention
|
|
170
|
+
written in the action colour then disappears into it. Inside the
|
|
171
|
+
bubble the tag takes the bubble's own ink, and a wash of it gives the
|
|
172
|
+
tag its edge, so it reads on any fill a theme picks. */
|
|
173
|
+
--ds-mention-color: currentColor;
|
|
174
|
+
--ds-mention-bg: color-mix(in srgb, currentColor 16%, transparent);
|
|
169
175
|
}
|
|
170
176
|
|
|
171
177
|
/* Received — an assistant turn opted into a bubble */
|
|
@@ -253,6 +253,7 @@
|
|
|
253
253
|
min-width: 0;
|
|
254
254
|
border: none;
|
|
255
255
|
background: transparent;
|
|
256
|
+
/* ds-allow(focus): a bare text run: .ds-colorpicker__inputs draws the active border through :focus-within */
|
|
256
257
|
outline: none;
|
|
257
258
|
padding: 0;
|
|
258
259
|
font-family: var(--font-paragraph-sm-family);
|
|
@@ -74,6 +74,7 @@
|
|
|
74
74
|
flex: 1;
|
|
75
75
|
min-width: 0;
|
|
76
76
|
border: none;
|
|
77
|
+
/* ds-allow(focus): a bare text run: .ds-combobox__control draws the active border through :focus-within */
|
|
77
78
|
outline: none;
|
|
78
79
|
background-color: transparent;
|
|
79
80
|
padding: 0;
|
|
@@ -356,6 +357,13 @@
|
|
|
356
357
|
border-color: var(--color-status-error-border);
|
|
357
358
|
}
|
|
358
359
|
|
|
360
|
+
/* The border is the error's already, so it cannot also say "you are here":
|
|
361
|
+
a field in error takes the system ring while it holds the focus. */
|
|
362
|
+
.ds-combobox--error .ds-combobox__control:has(input:focus-visible) {
|
|
363
|
+
outline: 2px solid var(--color-action-primary-bg);
|
|
364
|
+
outline-offset: 2px;
|
|
365
|
+
}
|
|
366
|
+
|
|
359
367
|
/* ============================================
|
|
360
368
|
DISABLED STATE
|
|
361
369
|
============================================ */
|
|
@@ -4,7 +4,7 @@ import { DecimalString } from '../../format/money';
|
|
|
4
4
|
type CurrencyInputOwnProps = {
|
|
5
5
|
/** Label text above the field. */
|
|
6
6
|
label?: string;
|
|
7
|
-
/** The amount as a decimal string (`"1234.50"`), or `null` for none (controlled). Pair with `onValueChange`. */
|
|
7
|
+
/** The amount as a decimal string (`"1234.50"`), or `null` for none (controlled). An empty string, as a form library holds it, reads as none too. Pair with `onValueChange`. */
|
|
8
8
|
value?: DecimalString | null;
|
|
9
9
|
/** The amount the field starts with (uncontrolled). */
|
|
10
10
|
defaultValue?: DecimalString | null;
|
|
@@ -53,7 +53,8 @@ function CurrencyInput({
|
|
|
53
53
|
const digits = fractionDigits ?? currencyFractionDigits(currency);
|
|
54
54
|
const controlled = valueProp !== void 0;
|
|
55
55
|
const [uncontrolled, setUncontrolled] = useState(defaultValue);
|
|
56
|
-
const
|
|
56
|
+
const held = controlled ? valueProp : uncontrolled;
|
|
57
|
+
const value = typeof held === "string" && held.trim() === "" ? null : held;
|
|
57
58
|
const [focused, setFocused] = useState(false);
|
|
58
59
|
const [text, setText] = useState(() => restingText(value, locale, digits));
|
|
59
60
|
const affix = useMemo(() => affixFor(currency, locale, currencyDisplay), [currency, locale, currencyDisplay]);
|
|
@@ -832,6 +832,12 @@
|
|
|
832
832
|
min-width: 0;
|
|
833
833
|
}
|
|
834
834
|
|
|
835
|
+
/* A cell that does not wrap shrinks to its content, and a bar has no content
|
|
836
|
+
width of its own, so there it would get none: it keeps a floor instead. */
|
|
837
|
+
.ds-data-table__text > .ds-data-table__typed-progress {
|
|
838
|
+
min-width: calc(var(--control-height-default) * 3);
|
|
839
|
+
}
|
|
840
|
+
|
|
835
841
|
.ds-data-table__typed-person {
|
|
836
842
|
display: inline-flex;
|
|
837
843
|
align-items: center;
|
|
@@ -333,7 +333,7 @@ type DataTableOwnProps<R extends DataTableRow = DataTableRow> = {
|
|
|
333
333
|
onPageSizeChange?: (pageSize: number) => void;
|
|
334
334
|
/** The page sizes the footer offers in a Rows per page picker. Leave unset for no picker. */
|
|
335
335
|
pageSizeOptions?: number[];
|
|
336
|
-
/** The current page, counting from 1, for controlled use. Pair with `onPageChange`. A page past the last shows the last. */
|
|
336
|
+
/** The current page, counting from 1, for controlled use. Pair with `onPageChange`. A page past the last shows the last, and one below 1 shows the first. */
|
|
337
337
|
page?: number;
|
|
338
338
|
/** The page to start on, counting from 1, for uncontrolled use. */
|
|
339
339
|
defaultPage?: number;
|
|
@@ -414,7 +414,7 @@ type DataTableOwnProps<R extends DataTableRow = DataTableRow> = {
|
|
|
414
414
|
rowCount?: number;
|
|
415
415
|
/** Whether rows are being fetched. With no rows yet the body shows skeleton rows; with rows on screen they stay, dimmed and inert, under a thin progress line, so the table never blanks. */
|
|
416
416
|
loading?: boolean;
|
|
417
|
-
/** A failed load's message. With no rows it replaces the body with an error state; over rows already on screen it shows as a Banner above them. Pair with `onRetry`. */
|
|
417
|
+
/** A failed load's message. With no rows it replaces the body with an error state and the footer's count and paging are left out; over rows already on screen it shows as a Banner above them. Pair with `onRetry`. */
|
|
418
418
|
error?: string;
|
|
419
419
|
/** Called by the error state's Try again button. Without it the error shows with no button. */
|
|
420
420
|
onRetry?: () => void;
|
|
@@ -615,7 +615,7 @@ function DataTable({
|
|
|
615
615
|
const [collapsedGroups, setCollapsedGroups] = useState([]);
|
|
616
616
|
const toggleGroup = (key) => setCollapsedGroups((current) => current.includes(key) ? current.filter((k) => k !== key) : [...current, key]);
|
|
617
617
|
const pageCount = pageSize ? Math.max(1, Math.ceil((manual ? matchCount : rowsInOrder.length) / pageSize)) : 1;
|
|
618
|
-
const clampedPage = Math.min(page, pageCount);
|
|
618
|
+
const clampedPage = Math.min(Math.max(page, 1), pageCount);
|
|
619
619
|
const pageRows = pageSize && !manual ? rowsInOrder.slice((clampedPage - 1) * pageSize, clampedPage * pageSize) : rowsInOrder;
|
|
620
620
|
const visibleRows = groups ? pageRows.filter((row) => !collapsedGroups.includes(groupByRow.get(row.id)?.key ?? "")) : pageRows;
|
|
621
621
|
const searched = useRef(false);
|
|
@@ -1632,6 +1632,7 @@ function DataTable({
|
|
|
1632
1632
|
onFocus: () => setActive({ row, col })
|
|
1633
1633
|
} : {};
|
|
1634
1634
|
const innerTab = gridMode ? -1 : void 0;
|
|
1635
|
+
const headerTab = stacked ? -1 : innerTab;
|
|
1635
1636
|
const justify = (align) => align === "center" ? "center" : align === "end" ? "flex-end" : align === "right" ? "right" : align === "left" ? "left" : "flex-start";
|
|
1636
1637
|
const alignsEnd = (align) => align === "end" || align === "right";
|
|
1637
1638
|
const utilityHeader = (key) => {
|
|
@@ -1668,7 +1669,7 @@ function DataTable({
|
|
|
1668
1669
|
indeterminate: someVisibleSelected,
|
|
1669
1670
|
onCheckedChange: toggleAllVisible,
|
|
1670
1671
|
"aria-label": selectAllLabel,
|
|
1671
|
-
tabIndex:
|
|
1672
|
+
tabIndex: headerTab,
|
|
1672
1673
|
"data-cell-control": ""
|
|
1673
1674
|
}
|
|
1674
1675
|
) })
|
|
@@ -1719,7 +1720,7 @@ function DataTable({
|
|
|
1719
1720
|
"aria-label": ranked && sortRank > 0 ? sortRankLabel(sortLabel(text, sortDirection(key)), sortRank + 1, sortDirection(key)) : sortLabel(text, sortDirection(key)),
|
|
1720
1721
|
onClick: (event) => cycleSort(key, event.shiftKey),
|
|
1721
1722
|
onMouseDown: multiSort ? (event) => event.shiftKey && event.preventDefault() : void 0,
|
|
1722
|
-
tabIndex:
|
|
1723
|
+
tabIndex: headerTab,
|
|
1723
1724
|
"data-cell-control": "",
|
|
1724
1725
|
children: [
|
|
1725
1726
|
/* @__PURE__ */ jsx("span", { className: `${baseClass}__label`, children: col.header }),
|
|
@@ -1782,7 +1783,7 @@ function DataTable({
|
|
|
1782
1783
|
size: "compact",
|
|
1783
1784
|
tooltip: false,
|
|
1784
1785
|
label: labels.menu(text),
|
|
1785
|
-
tabIndex:
|
|
1786
|
+
tabIndex: headerTab
|
|
1786
1787
|
}
|
|
1787
1788
|
)
|
|
1788
1789
|
}
|
|
@@ -2358,6 +2359,7 @@ function DataTable({
|
|
|
2358
2359
|
const firstLoad = (loading && rows.length === 0 || commandLanding) && !error;
|
|
2359
2360
|
const refreshing = loading && rows.length > 0;
|
|
2360
2361
|
const searching = !manual && rows.length > 0 && search.trim().toLowerCase() !== needle;
|
|
2362
|
+
const failedEmpty = Boolean(error) && rows.length === 0;
|
|
2361
2363
|
const retryButton = onRetry && /* @__PURE__ */ jsx(Button, { variant: "secondary", tone: "neutral", size: "compact", iconLeft: "refresh", label: loadWords.retry, onClick: onRetry });
|
|
2362
2364
|
const skeletonRows = Array.from({ length: pageSize ?? 5 }, (_, index) => /* @__PURE__ */ jsxs("tr", { className: `ds-table__row ${baseClass}__skeleton-row`, "aria-hidden": "true", children: [
|
|
2363
2365
|
utilityKeys.map((key) => /* @__PURE__ */ jsx("td", { className: "ds-table__cell" }, key)),
|
|
@@ -2378,13 +2380,14 @@ function DataTable({
|
|
|
2378
2380
|
striped ? "ds-table--striped" : "",
|
|
2379
2381
|
frameless ? "ds-table--frameless" : "ds-table--bordered",
|
|
2380
2382
|
outer ? "ds-table--outer-control" : "",
|
|
2381
|
-
|
|
2383
|
+
// A stacked card has no columns for a rule to part.
|
|
2384
|
+
columnDividers && !frameless && !stacked ? "ds-table--column-dividers" : "",
|
|
2382
2385
|
layoutReady ? `${baseClass}__grid--fixed` : "",
|
|
2383
2386
|
stickyHeader || virtual ? `${baseClass}__grid--sticky` : "",
|
|
2384
2387
|
stacked ? `${baseClass}__grid--stacked` : "",
|
|
2385
2388
|
showActions && rowActionsVisibility === "hover" ? `${baseClass}__grid--actions-hover` : ""
|
|
2386
2389
|
].filter(Boolean).join(" ");
|
|
2387
|
-
const frameMax = maxHeight ?? (virtual ? VIRTUAL_HEIGHT : void 0);
|
|
2390
|
+
const frameMax = stacked && !virtual ? void 0 : maxHeight ?? (virtual ? VIRTUAL_HEIGHT : void 0);
|
|
2388
2391
|
const frameStyle = frameMax !== void 0 ? { maxHeight: typeof frameMax === "number" ? `${frameMax}px` : frameMax } : void 0;
|
|
2389
2392
|
return /* @__PURE__ */ jsx(TableContext.Provider, { value: tableContext, children: /* @__PURE__ */ jsxs("div", { ...rest, ref: setRootRef, className: classes, children: [
|
|
2390
2393
|
/* @__PURE__ */ jsx("span", { className: "ds-visually-hidden", "aria-live": "polite", "aria-atomic": "true", children: announcement }),
|
|
@@ -2526,8 +2529,8 @@ function DataTable({
|
|
|
2526
2529
|
}
|
|
2527
2530
|
),
|
|
2528
2531
|
(pageSize !== void 0 || selectable) && /* @__PURE__ */ jsxs("div", { className: `${baseClass}__footer`, children: [
|
|
2529
|
-
/* @__PURE__ */ jsx("span", { className: `${baseClass}__count`, children: firstLoad ? null : selectable && currentSelection.length > 0 && !selectionClaimed ? selectedLabel(allMatching ? matchCount - exceptIds.length : currentSelection.length) : countClaimed ? null : resultsLabel(matchCount) }),
|
|
2530
|
-
pageSize !== void 0 && (pageCount > 1 || (pageSizeOptions?.length ?? 0) > 0) && /* @__PURE__ */ jsxs("div", { className: `${baseClass}__paging`, children: [
|
|
2532
|
+
/* @__PURE__ */ jsx("span", { className: `${baseClass}__count`, children: firstLoad ? null : selectable && currentSelection.length > 0 && !selectionClaimed ? selectedLabel(allMatching ? matchCount - exceptIds.length : currentSelection.length) : countClaimed || failedEmpty ? null : resultsLabel(matchCount) }),
|
|
2533
|
+
pageSize !== void 0 && !failedEmpty && (pageCount > 1 || (pageSizeOptions?.length ?? 0) > 0) && /* @__PURE__ */ jsxs("div", { className: `${baseClass}__paging`, children: [
|
|
2531
2534
|
pageSizeOptions && pageSizeOptions.length > 0 && /* @__PURE__ */ jsxs("span", { className: `${baseClass}__page-size`, children: [
|
|
2532
2535
|
/* @__PURE__ */ jsx("span", { className: `${baseClass}__page-size-label`, "aria-hidden": "true", children: pageSizeLabel }),
|
|
2533
2536
|
/* @__PURE__ */ jsx(
|
|
@@ -27,6 +27,7 @@ const relativeDate = (date, format, now) => formatRelative(date, { now, locale:
|
|
|
27
27
|
const formatNumber = (type, value, format) => {
|
|
28
28
|
const locale = format?.locale ?? DEFAULT_LOCALE;
|
|
29
29
|
const digits = format?.fractionDigits;
|
|
30
|
+
if (!Number.isFinite(value)) return String(value);
|
|
30
31
|
if (type === "currency")
|
|
31
32
|
return formatMoney(value, { currency: format?.currency ?? "USD", locale, fractionDigits: digits });
|
|
32
33
|
if (type === "progress")
|
|
@@ -158,4 +158,11 @@
|
|
|
158
158
|
padding-inline-start: calc(var(--padding-200) + 20px + var(--gap-200)); /* 8px + 20px icon + 8px gap */
|
|
159
159
|
}
|
|
160
160
|
|
|
161
|
+
/* The border is the error's already, so it cannot also say "you are here":
|
|
162
|
+
a field in error takes the system ring while it holds the focus. */
|
|
163
|
+
.ds-date-input--error .ds-date-input__field:focus-visible {
|
|
164
|
+
outline: 2px solid var(--color-action-primary-bg);
|
|
165
|
+
outline-offset: 2px;
|
|
166
|
+
}
|
|
167
|
+
|
|
161
168
|
} /* @layer rift.components */
|
|
@@ -4,7 +4,11 @@ import { Weekday } from '../../behaviors/locale';
|
|
|
4
4
|
export declare const EN_DAYS: string[];
|
|
5
5
|
/** A consumer's weekday list when it has the seven entries the grid needs, else the default. */
|
|
6
6
|
export declare const weekdaysOr: (labels: string[] | undefined, fallback: string[]) => string[];
|
|
7
|
-
/**
|
|
7
|
+
/**
|
|
8
|
+
* A `YYYY-MM-DD` string as a local date, or null. Anything else (a full ISO
|
|
9
|
+
* timestamp, a locale's own date) is null too: an invalid date would throw
|
|
10
|
+
* in the first label that formats it and take the picker down.
|
|
11
|
+
*/
|
|
8
12
|
export declare function parseDate(str?: string | null): Date | null;
|
|
9
13
|
/** A local date as `YYYY-MM-DD`. */
|
|
10
14
|
export declare function formatDate(date: Date): string;
|
|
@@ -3,9 +3,9 @@ import { logicalArrowKey } from "../../behaviors/direction.js";
|
|
|
3
3
|
const EN_DAYS = ["Su", "Mo", "Tu", "We", "Th", "Fr", "Sa"];
|
|
4
4
|
const weekdaysOr = (labels, fallback) => labels && labels.length === 7 ? labels : fallback;
|
|
5
5
|
function parseDate(str) {
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
return new Date(
|
|
6
|
+
const parts = str ? /^(\d{4})-(\d{2})-(\d{2})$/.exec(str) : null;
|
|
7
|
+
if (!parts) return null;
|
|
8
|
+
return new Date(Number(parts[1]), Number(parts[2]) - 1, Number(parts[3]));
|
|
9
9
|
}
|
|
10
10
|
function formatDate(date) {
|
|
11
11
|
const y = date.getFullYear();
|