rift-ds 1.43.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 +1 -1
- 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 +24 -5
- 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 +1 -0
- package/components/AppSidebar/AppSidebar.js +5 -2
- package/components/Attachment/Attachment.css +1 -0
- package/components/Attachment/AttachmentDropZone.js +1 -1
- 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.d.ts +2 -2
- package/components/DataTable/DataTable.js +8 -6
- 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 +1 -0
- package/components/EntitySwitcher/EntitySwitcher.js +1 -0
- package/components/ErrorSummary/ErrorSummary.js +5 -0
- package/components/EventCalendar/EventCalendar.js +29 -23
- package/components/Globe/Globe.js +32 -3
- package/components/Inspector/Inspector.css +2 -0
- package/components/Lightbox/Lightbox.css +1 -0
- package/components/Menubar/Menubar.css +1 -0
- package/components/NumberInput/NumberInput.css +8 -0
- package/components/Popover/Popover.js +5 -1
- package/components/QuestionCard/QuestionCard.css +1 -0
- package/components/RadioButton/RadioButton.js +1 -0
- package/components/RichDropdown/RichDropdown.css +7 -0
- package/components/RichDropdown/RichDropdown.js +1 -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/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/ThreadHistory/ThreadHistory.css +1 -0
- package/components/TimePicker/TimePicker.css +7 -0
- package/components/TimePicker/TimePicker.js +1 -0
- package/components/registry.d.ts +8 -0
- package/components/registry.json +19 -0
- package/components/registry.json.d.ts +19 -0
- package/components/registry.json.js +1 -1
- package/package.json +1 -1
- package/tokens/motion.d.ts +1 -1
|
@@ -216,81 +216,85 @@ function DateRangePicker({
|
|
|
216
216
|
},
|
|
217
217
|
preset.label
|
|
218
218
|
)) }),
|
|
219
|
-
/* @__PURE__ */ jsx("div", { className: "ds-date-range-picker__months", children: shown.map(({ year, month }, index) =>
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
219
|
+
/* @__PURE__ */ jsx("div", { className: "ds-date-range-picker__months", children: shown.map(({ year, month }, index) => (
|
|
220
|
+
// Keyed by position, not by month: turning the month keeps the header,
|
|
221
|
+
// and the Previous or Next button that was pressed, mounted with its focus.
|
|
222
|
+
/* @__PURE__ */ jsxs("div", { className: "ds-date-range-picker__month", children: [
|
|
223
|
+
/* @__PURE__ */ jsxs("div", { className: `${baseClass}__header`, children: [
|
|
224
|
+
index === 0 ? /* @__PURE__ */ jsx(
|
|
225
|
+
"button",
|
|
226
|
+
{
|
|
227
|
+
type: "button",
|
|
228
|
+
className: `${baseClass}__nav-btn material-symbols-rounded ds-mirror-rtl`,
|
|
229
|
+
onClick: () => turn(-1),
|
|
230
|
+
disabled,
|
|
231
|
+
"aria-label": previousLabel,
|
|
232
|
+
children: "chevron_left"
|
|
233
|
+
}
|
|
234
|
+
) : /* @__PURE__ */ jsx("span", { className: "ds-date-range-picker__nav-space", "aria-hidden": "true" }),
|
|
235
|
+
/* @__PURE__ */ jsx("span", { className: `${baseClass}__month-year`, children: titles[index] }),
|
|
236
|
+
index === months - 1 ? /* @__PURE__ */ jsx(
|
|
237
|
+
"button",
|
|
238
|
+
{
|
|
239
|
+
type: "button",
|
|
240
|
+
className: `${baseClass}__nav-btn material-symbols-rounded ds-mirror-rtl`,
|
|
241
|
+
onClick: () => turn(1),
|
|
242
|
+
disabled,
|
|
243
|
+
"aria-label": nextLabel,
|
|
244
|
+
children: "chevron_right"
|
|
245
|
+
}
|
|
246
|
+
) : /* @__PURE__ */ jsx("span", { className: "ds-date-range-picker__nav-space", "aria-hidden": "true" })
|
|
247
|
+
] }),
|
|
248
|
+
/* @__PURE__ */ jsx(
|
|
249
|
+
MonthGrid,
|
|
223
250
|
{
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
251
|
+
baseClass,
|
|
252
|
+
year,
|
|
253
|
+
month,
|
|
254
|
+
weekStart,
|
|
255
|
+
weekdays,
|
|
256
|
+
weekdayFullNames,
|
|
257
|
+
label: titles[index],
|
|
258
|
+
dayNumber,
|
|
259
|
+
today,
|
|
260
|
+
hideOutside: months > 1,
|
|
261
|
+
dayState: (cell) => {
|
|
262
|
+
const position = positionOf(cell.date);
|
|
263
|
+
const chosenEnd = position === "start" || position === "end" || position === "start-end";
|
|
264
|
+
const inSpan = Boolean(start && spanEnd && cell.date > start && cell.date < spanEnd);
|
|
265
|
+
const isToday = today !== null && isSameDay(cell.date, today);
|
|
266
|
+
const dayDisabled = isDayDisabled(cell.date);
|
|
267
|
+
return {
|
|
268
|
+
className: [
|
|
269
|
+
!cell.inMonth ? `${baseClass}__cell--outside` : "",
|
|
270
|
+
chosenEnd ? `${baseClass}__cell--selected` : "",
|
|
271
|
+
inSpan ? "ds-date-range-picker__cell--in-range" : "",
|
|
272
|
+
inSpan && !end ? "ds-date-range-picker__cell--preview" : "",
|
|
273
|
+
position === "start" && spanEnd ? "ds-date-range-picker__cell--start" : "",
|
|
274
|
+
position === "end" ? "ds-date-range-picker__cell--end" : "",
|
|
275
|
+
previewEnd && isSameDay(cell.date, previewEnd) && !chosenEnd ? "ds-date-range-picker__cell--preview-end" : "",
|
|
276
|
+
isToday && !chosenEnd ? `${baseClass}__cell--today` : "",
|
|
277
|
+
dayDisabled ? `${baseClass}__cell--disabled` : ""
|
|
278
|
+
].filter(Boolean).join(" "),
|
|
279
|
+
disabled: dayDisabled,
|
|
280
|
+
label: dayLabel(cell.date, position),
|
|
281
|
+
tabStop: tabStop !== null && isSameDay(cell.date, tabStop),
|
|
282
|
+
selected: position !== "outside"
|
|
283
|
+
};
|
|
284
|
+
},
|
|
285
|
+
onSelect: handleSelect,
|
|
286
|
+
onDayKeyDown: handleDayKeyDown,
|
|
287
|
+
onDayFocus: (date) => {
|
|
288
|
+
if (!focusedDate || !isSameDay(focusedDate, date)) setFocusedDate(date);
|
|
289
|
+
if (choosingEnd) setHoverDate(date);
|
|
290
|
+
},
|
|
291
|
+
onDayPointerEnter: (date) => {
|
|
292
|
+
if (choosingEnd) setHoverDate(date);
|
|
293
|
+
}
|
|
230
294
|
}
|
|
231
|
-
)
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
"button",
|
|
235
|
-
{
|
|
236
|
-
type: "button",
|
|
237
|
-
className: `${baseClass}__nav-btn material-symbols-rounded ds-mirror-rtl`,
|
|
238
|
-
onClick: () => turn(1),
|
|
239
|
-
disabled,
|
|
240
|
-
"aria-label": nextLabel,
|
|
241
|
-
children: "chevron_right"
|
|
242
|
-
}
|
|
243
|
-
) : /* @__PURE__ */ jsx("span", { className: "ds-date-range-picker__nav-space", "aria-hidden": "true" })
|
|
244
|
-
] }),
|
|
245
|
-
/* @__PURE__ */ jsx(
|
|
246
|
-
MonthGrid,
|
|
247
|
-
{
|
|
248
|
-
baseClass,
|
|
249
|
-
year,
|
|
250
|
-
month,
|
|
251
|
-
weekStart,
|
|
252
|
-
weekdays,
|
|
253
|
-
weekdayFullNames,
|
|
254
|
-
label: titles[index],
|
|
255
|
-
dayNumber,
|
|
256
|
-
today,
|
|
257
|
-
hideOutside: months > 1,
|
|
258
|
-
dayState: (cell) => {
|
|
259
|
-
const position = positionOf(cell.date);
|
|
260
|
-
const chosenEnd = position === "start" || position === "end" || position === "start-end";
|
|
261
|
-
const inSpan = Boolean(start && spanEnd && cell.date > start && cell.date < spanEnd);
|
|
262
|
-
const isToday = today !== null && isSameDay(cell.date, today);
|
|
263
|
-
const dayDisabled = isDayDisabled(cell.date);
|
|
264
|
-
return {
|
|
265
|
-
className: [
|
|
266
|
-
!cell.inMonth ? `${baseClass}__cell--outside` : "",
|
|
267
|
-
chosenEnd ? `${baseClass}__cell--selected` : "",
|
|
268
|
-
inSpan ? "ds-date-range-picker__cell--in-range" : "",
|
|
269
|
-
inSpan && !end ? "ds-date-range-picker__cell--preview" : "",
|
|
270
|
-
position === "start" && spanEnd ? "ds-date-range-picker__cell--start" : "",
|
|
271
|
-
position === "end" ? "ds-date-range-picker__cell--end" : "",
|
|
272
|
-
previewEnd && isSameDay(cell.date, previewEnd) && !chosenEnd ? "ds-date-range-picker__cell--preview-end" : "",
|
|
273
|
-
isToday && !chosenEnd ? `${baseClass}__cell--today` : "",
|
|
274
|
-
dayDisabled ? `${baseClass}__cell--disabled` : ""
|
|
275
|
-
].filter(Boolean).join(" "),
|
|
276
|
-
disabled: dayDisabled,
|
|
277
|
-
label: dayLabel(cell.date, position),
|
|
278
|
-
tabStop: tabStop !== null && isSameDay(cell.date, tabStop),
|
|
279
|
-
selected: position !== "outside"
|
|
280
|
-
};
|
|
281
|
-
},
|
|
282
|
-
onSelect: handleSelect,
|
|
283
|
-
onDayKeyDown: handleDayKeyDown,
|
|
284
|
-
onDayFocus: (date) => {
|
|
285
|
-
if (!focusedDate || !isSameDay(focusedDate, date)) setFocusedDate(date);
|
|
286
|
-
if (choosingEnd) setHoverDate(date);
|
|
287
|
-
},
|
|
288
|
-
onDayPointerEnter: (date) => {
|
|
289
|
-
if (choosingEnd) setHoverDate(date);
|
|
290
|
-
}
|
|
291
|
-
}
|
|
292
|
-
)
|
|
293
|
-
] }, `${year}-${month}`)) }),
|
|
295
|
+
)
|
|
296
|
+
] }, index)
|
|
297
|
+
)) }),
|
|
294
298
|
/* @__PURE__ */ jsx("span", { "aria-live": "polite", style: visuallyHidden, children: turned ? titles.join(", ") : "" }),
|
|
295
299
|
name && /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
296
300
|
/* @__PURE__ */ jsx("input", { type: "hidden", name: `${name}[start]`, value: range.start ?? "", disabled }),
|
|
@@ -55,6 +55,7 @@
|
|
|
55
55
|
box-shadow: var(--shadow-modal);
|
|
56
56
|
transform: scale(0.96);
|
|
57
57
|
transition: transform var(--motion-duration-base) var(--motion-ease-standard);
|
|
58
|
+
/* ds-allow(focus): never a tab stop: script moves focus here (tabindex -1) and the controls inside show their own */
|
|
58
59
|
outline: none;
|
|
59
60
|
}
|
|
60
61
|
|
|
@@ -89,6 +89,7 @@
|
|
|
89
89
|
background-color: var(--color-bg-page-primary);
|
|
90
90
|
box-shadow: var(--shadow-modal);
|
|
91
91
|
transition: transform var(--motion-duration-slow) var(--motion-ease-standard);
|
|
92
|
+
/* ds-allow(focus): never a tab stop: script moves focus here (tabindex -1) and the controls inside show their own */
|
|
92
93
|
outline: none;
|
|
93
94
|
overflow: hidden;
|
|
94
95
|
}
|
|
@@ -367,4 +367,11 @@
|
|
|
367
367
|
padding-inline-end: var(--padding-200);
|
|
368
368
|
}
|
|
369
369
|
|
|
370
|
+
/* The border is the error's already, so it cannot also say "you are here":
|
|
371
|
+
a field in error takes the system ring while it holds the focus. */
|
|
372
|
+
.ds-dropdown--error .ds-dropdown__trigger:focus-visible {
|
|
373
|
+
outline: 2px solid var(--color-action-primary-bg);
|
|
374
|
+
outline-offset: 2px;
|
|
375
|
+
}
|
|
376
|
+
|
|
370
377
|
} /* @layer rift.components */
|
|
@@ -236,6 +236,7 @@ const Dropdown = React.forwardRef(
|
|
|
236
236
|
id: inputId,
|
|
237
237
|
className: `${baseClass}__trigger`,
|
|
238
238
|
role: "combobox",
|
|
239
|
+
"aria-required": required || void 0,
|
|
239
240
|
"aria-expanded": isOpen,
|
|
240
241
|
"aria-haspopup": "listbox",
|
|
241
242
|
"aria-labelledby": ariaLabelledBy ?? (label ? `${inputId}-label` : void 0),
|
|
@@ -43,6 +43,11 @@ function ErrorSummary({
|
|
|
43
43
|
const frame = target.closest(".ds-field") ?? target;
|
|
44
44
|
frame.scrollIntoView({ block: "center" });
|
|
45
45
|
target.focus({ preventScroll: true });
|
|
46
|
+
if (document.activeElement !== target) {
|
|
47
|
+
const options = 'input:not(:disabled), [role="radio"]:not([aria-disabled="true"]), [role="checkbox"]:not([aria-disabled="true"])';
|
|
48
|
+
const option = target.querySelector(`input:checked:not(:disabled)`) ?? target.querySelector(options);
|
|
49
|
+
option?.focus({ preventScroll: true });
|
|
50
|
+
}
|
|
46
51
|
onErrorClick?.(id);
|
|
47
52
|
};
|
|
48
53
|
const Heading = `h${headingLevel}`;
|
|
@@ -16,8 +16,8 @@ function parseDay(str) {
|
|
|
16
16
|
const MAX_SPAN_DAYS = 366;
|
|
17
17
|
const weekdaysOr = (labels, locale) => labels && labels.length === 7 ? labels : weekdayHeadersIn(locale);
|
|
18
18
|
function parseMonth(str) {
|
|
19
|
-
const
|
|
20
|
-
return [
|
|
19
|
+
const parts = /^(\d{4})-(\d{2})$/.exec(str);
|
|
20
|
+
return parts ? [Number(parts[1]), Number(parts[2]) - 1] : null;
|
|
21
21
|
}
|
|
22
22
|
function formatMonth(year, monthIndex) {
|
|
23
23
|
return `${year}-${String(monthIndex + 1).padStart(2, "0")}`;
|
|
@@ -168,7 +168,7 @@ const EventCalendar = React.forwardRef(
|
|
|
168
168
|
defaultMonth ?? formatMonth(startingDay.getFullYear(), startingDay.getMonth())
|
|
169
169
|
);
|
|
170
170
|
const currentMonth = isControlled ? month : uncontrolledMonth;
|
|
171
|
-
const [viewYear, viewMonth] = parseMonth(currentMonth);
|
|
171
|
+
const [viewYear, viewMonth] = parseMonth(currentMonth) ?? [startingDay.getFullYear(), startingDay.getMonth()];
|
|
172
172
|
const navigate = (offset) => {
|
|
173
173
|
const next = new Date(viewYear, viewMonth + offset, 1);
|
|
174
174
|
const value = formatMonth(next.getFullYear(), next.getMonth());
|
|
@@ -430,27 +430,33 @@ const EventCalendar = React.forwardRef(
|
|
|
430
430
|
event.id
|
|
431
431
|
) : /* @__PURE__ */ jsx("span", { className: pillClasses, children: pillContent }, event.id);
|
|
432
432
|
}),
|
|
433
|
-
|
|
434
|
-
|
|
435
|
-
|
|
436
|
-
|
|
437
|
-
|
|
438
|
-
|
|
439
|
-
|
|
440
|
-
|
|
441
|
-
|
|
433
|
+
(() => {
|
|
434
|
+
const expanded2 = !isWeek && expandedDays.includes(dateStr) && dayEvents.length > maxEventsPerDay;
|
|
435
|
+
if (overflow > 0 && onDateClick) {
|
|
436
|
+
return /* @__PURE__ */ jsx(
|
|
437
|
+
"button",
|
|
438
|
+
{
|
|
439
|
+
type: "button",
|
|
440
|
+
className: `${baseClass}__more`,
|
|
441
|
+
onClick: () => onDateClick(dateStr),
|
|
442
|
+
"aria-label": overflowLabel(overflow, date),
|
|
443
|
+
children: moreLabel(overflow)
|
|
444
|
+
}
|
|
445
|
+
);
|
|
442
446
|
}
|
|
443
|
-
|
|
444
|
-
|
|
445
|
-
|
|
446
|
-
|
|
447
|
-
|
|
448
|
-
|
|
449
|
-
|
|
450
|
-
|
|
451
|
-
|
|
452
|
-
|
|
453
|
-
|
|
447
|
+
if (!expanded2 && overflow <= 0) return null;
|
|
448
|
+
return /* @__PURE__ */ jsx(
|
|
449
|
+
"button",
|
|
450
|
+
{
|
|
451
|
+
type: "button",
|
|
452
|
+
className: `${baseClass}__more`,
|
|
453
|
+
onClick: () => toggleDay(dateStr),
|
|
454
|
+
"aria-expanded": expanded2,
|
|
455
|
+
"aria-label": expanded2 ? void 0 : overflowLabel(overflow, date),
|
|
456
|
+
children: expanded2 ? showLessLabel : moreLabel(overflow)
|
|
457
|
+
}
|
|
458
|
+
);
|
|
459
|
+
})()
|
|
454
460
|
] })
|
|
455
461
|
]
|
|
456
462
|
},
|
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
import { jsxs, jsx } from "react/jsx-runtime";
|
|
3
3
|
import React, { useId, useState, useRef, useCallback, useSyncExternalStore, useEffect } from "react";
|
|
4
4
|
import { MOTION_ORBIT_REFERENCE_MS, MOTION_TOKEN_REREAD_MS } from "../../tokens/motion.js";
|
|
5
|
+
import { createFramePacer } from "../../behaviors/framePacer.js";
|
|
5
6
|
import "./Globe.css";
|
|
6
7
|
const VIEW = 480;
|
|
7
8
|
const CENTER = VIEW / 2;
|
|
@@ -16,6 +17,8 @@ const KEY_STEP = 10;
|
|
|
16
17
|
const MAX_LAT = 80;
|
|
17
18
|
const MARKER = 5;
|
|
18
19
|
const ORBIT_READ_INTERVAL_MS = MOTION_TOKEN_REREAD_MS;
|
|
20
|
+
const SPIN_FRAME_MS = 1e3 / 30;
|
|
21
|
+
const SPIN_MAX_STEP_S = 0.1;
|
|
19
22
|
const readOrbitTempo = (node) => {
|
|
20
23
|
if (!node) return 1;
|
|
21
24
|
const raw = getComputedStyle(node).getPropertyValue("--motion-duration-orbit").trim();
|
|
@@ -173,8 +176,11 @@ const Globe = React.forwardRef(
|
|
|
173
176
|
let last = performance.now();
|
|
174
177
|
let tempo = readOrbitTempo(rootRef.current);
|
|
175
178
|
let lastRead = last;
|
|
179
|
+
const pacer = createFramePacer();
|
|
176
180
|
const tick = (now) => {
|
|
177
|
-
|
|
181
|
+
frame = requestAnimationFrame(tick);
|
|
182
|
+
if (!pacer.due(now, last, SPIN_FRAME_MS)) return;
|
|
183
|
+
const dt = Math.min(SPIN_MAX_STEP_S, (now - last) / 1e3);
|
|
178
184
|
last = now;
|
|
179
185
|
if (now - lastRead >= ORBIT_READ_INTERVAL_MS) {
|
|
180
186
|
tempo = readOrbitTempo(rootRef.current);
|
|
@@ -182,10 +188,33 @@ const Globe = React.forwardRef(
|
|
|
182
188
|
}
|
|
183
189
|
const [lng, lat] = rotationRef.current;
|
|
184
190
|
commit([lng - autoRotate * tempo * dt, lat]);
|
|
191
|
+
};
|
|
192
|
+
const start = () => {
|
|
193
|
+
if (frame) return;
|
|
194
|
+
last = performance.now();
|
|
185
195
|
frame = requestAnimationFrame(tick);
|
|
186
196
|
};
|
|
187
|
-
|
|
188
|
-
|
|
197
|
+
const stop = () => {
|
|
198
|
+
cancelAnimationFrame(frame);
|
|
199
|
+
frame = 0;
|
|
200
|
+
};
|
|
201
|
+
const root = rootRef.current;
|
|
202
|
+
if (!root || typeof IntersectionObserver === "undefined") {
|
|
203
|
+
start();
|
|
204
|
+
return stop;
|
|
205
|
+
}
|
|
206
|
+
const observer = new IntersectionObserver(
|
|
207
|
+
(entries) => {
|
|
208
|
+
if (entries[entries.length - 1].isIntersecting) start();
|
|
209
|
+
else stop();
|
|
210
|
+
},
|
|
211
|
+
{ rootMargin: "200px 0px" }
|
|
212
|
+
);
|
|
213
|
+
observer.observe(root);
|
|
214
|
+
return () => {
|
|
215
|
+
observer.disconnect();
|
|
216
|
+
stop();
|
|
217
|
+
};
|
|
189
218
|
}, [spinning, autoRotate, commit]);
|
|
190
219
|
const drag = useRef(null);
|
|
191
220
|
const dragMoved = useRef(false);
|
|
@@ -241,6 +241,7 @@
|
|
|
241
241
|
min-width: 0;
|
|
242
242
|
padding: 0;
|
|
243
243
|
border: none;
|
|
244
|
+
/* ds-allow(focus): a bare text run: .ds-inspector-input draws the ring through :focus-within */
|
|
244
245
|
outline: none;
|
|
245
246
|
background: transparent;
|
|
246
247
|
font: inherit;
|
|
@@ -284,6 +285,7 @@
|
|
|
284
285
|
|
|
285
286
|
/* Focus rings the segment, not the whole bar. */
|
|
286
287
|
.ds-inspector-segmented-control:has(:focus-visible) {
|
|
288
|
+
/* ds-allow(focus): the focused segment draws the ring, so the bar around it does not draw a second */
|
|
287
289
|
outline: none;
|
|
288
290
|
}
|
|
289
291
|
|
|
@@ -69,6 +69,7 @@
|
|
|
69
69
|
|
|
70
70
|
/* The trigger draws its own ring; the menu's wrapper ring would double it. */
|
|
71
71
|
.ds-menubar__menu .ds-dropdown-menu__trigger:focus-visible {
|
|
72
|
+
/* ds-allow(focus): the menubar trigger inside draws the ring, so the menu wrapper does not draw a second */
|
|
72
73
|
outline: none;
|
|
73
74
|
}
|
|
74
75
|
|
|
@@ -48,6 +48,7 @@
|
|
|
48
48
|
min-width: 0;
|
|
49
49
|
padding: var(--padding-200) var(--padding-150); /* 8px 6px */
|
|
50
50
|
border: none;
|
|
51
|
+
/* ds-allow(focus): a bare text run: .ds-numberinput__shell draws the active border through :focus-within */
|
|
51
52
|
outline: none;
|
|
52
53
|
background-color: transparent;
|
|
53
54
|
text-align: center;
|
|
@@ -168,4 +169,11 @@
|
|
|
168
169
|
color: inherit;
|
|
169
170
|
}
|
|
170
171
|
|
|
172
|
+
/* The border is the error's already, so it cannot also say "you are here":
|
|
173
|
+
a field in error takes the system ring while it holds the focus. */
|
|
174
|
+
.ds-numberinput--error .ds-numberinput__shell:has(input:focus-visible) {
|
|
175
|
+
outline: 2px solid var(--color-action-primary-bg);
|
|
176
|
+
outline-offset: 2px;
|
|
177
|
+
}
|
|
178
|
+
|
|
171
179
|
} /* @layer rift.components */
|
|
@@ -63,7 +63,11 @@ const Popover = React.forwardRef(
|
|
|
63
63
|
open: isOpen,
|
|
64
64
|
onDismiss: () => setOpen(false),
|
|
65
65
|
dismissOnOutsidePress: trigger === "click",
|
|
66
|
-
getElements: () => [containerRef.current]
|
|
66
|
+
getElements: () => [containerRef.current],
|
|
67
|
+
/* Focus inside the panel would fall to the page when it closes: the stack hands it back to the control that opened it. */
|
|
68
|
+
returnFocus: () => triggerRef.current?.contains(document.activeElement) ? null : triggerRef.current?.querySelector(
|
|
69
|
+
'button, [href], input, select, textarea, [tabindex]:not([tabindex="-1"])'
|
|
70
|
+
)
|
|
67
71
|
});
|
|
68
72
|
const handleClick = () => {
|
|
69
73
|
if (trigger === "click") {
|
|
@@ -244,6 +244,7 @@ button.ds-question-card__option--chosen:hover {
|
|
|
244
244
|
font-family: var(--font-paragraph-family);
|
|
245
245
|
font-size: var(--font-paragraph-size);
|
|
246
246
|
line-height: var(--font-paragraph-line-height);
|
|
247
|
+
/* ds-allow(focus): a bare text run: .ds-question-card__other draws the active border through :focus-within */
|
|
247
248
|
outline: none;
|
|
248
249
|
}
|
|
249
250
|
|
|
@@ -139,6 +139,7 @@ const RadioGroup = React.forwardRef(
|
|
|
139
139
|
required,
|
|
140
140
|
id: groupId,
|
|
141
141
|
role: "radiogroup",
|
|
142
|
+
"aria-required": required || void 0,
|
|
142
143
|
"aria-labelledby": labelId,
|
|
143
144
|
"aria-describedby": describedBy,
|
|
144
145
|
"aria-invalid": error || hasErrorText || void 0,
|
|
@@ -228,6 +228,13 @@
|
|
|
228
228
|
border-color: var(--color-status-error-border);
|
|
229
229
|
}
|
|
230
230
|
|
|
231
|
+
/* The border is the error's already, so it cannot also say "you are here":
|
|
232
|
+
a field in error takes the system ring while it holds the focus. */
|
|
233
|
+
.ds-rich-dropdown--error .ds-rich-dropdown__trigger:focus-visible {
|
|
234
|
+
outline: 2px solid var(--color-action-primary-bg);
|
|
235
|
+
outline-offset: 2px;
|
|
236
|
+
}
|
|
237
|
+
|
|
231
238
|
/* ============================================
|
|
232
239
|
DISABLED STATE
|
|
233
240
|
============================================ */
|
|
@@ -188,6 +188,7 @@ const RichDropdown = React.forwardRef(
|
|
|
188
188
|
ref: triggerRef,
|
|
189
189
|
className: `${baseClass}__trigger`,
|
|
190
190
|
role: "combobox",
|
|
191
|
+
"aria-required": required || void 0,
|
|
191
192
|
"aria-expanded": isOpen,
|
|
192
193
|
"aria-haspopup": "listbox",
|
|
193
194
|
"aria-labelledby": ariaLabelledBy ?? (label ? `${inputId}-label` : void 0),
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import { useState, useRef, useEffect } from "react";
|
|
3
3
|
import { BLOB_COUNT, vertexSource, fragmentSource } from "./field.glsl.js";
|
|
4
|
-
import { MOTION_CONTEXT_RESTORE_WAIT_MS,
|
|
4
|
+
import { MOTION_CONTEXT_RESTORE_WAIT_MS, MOTION_SHADER_COLOR_CHECK_MS, MOTION_SHADER_COLOR_FADE_MS } from "../../tokens/motion.js";
|
|
5
|
+
import { createFramePacer } from "../../behaviors/framePacer.js";
|
|
5
6
|
import { whenProgramLinked } from "../../behaviors/whenProgramLinked.js";
|
|
6
7
|
const DEFAULT_SHADER_PARAMS = {
|
|
7
8
|
intensity: 0.5,
|
|
@@ -312,10 +313,11 @@ function useShaderField(canvasRef, params, enabled = true) {
|
|
|
312
313
|
let onScreen = true;
|
|
313
314
|
let frameBudget = FRAME_MS;
|
|
314
315
|
const reduceQuery = window.matchMedia("(prefers-reduced-motion: reduce)");
|
|
316
|
+
const pacer = createFramePacer();
|
|
315
317
|
function frame(now) {
|
|
316
318
|
raf = requestAnimationFrame(frame);
|
|
317
319
|
const elapsed = now - lastDraw;
|
|
318
|
-
if (
|
|
320
|
+
if (!pacer.due(now, lastDraw, frameBudget)) return;
|
|
319
321
|
const dt = Math.min(elapsed, 100);
|
|
320
322
|
lastDraw = now;
|
|
321
323
|
if (now - colorsChecked >= COLOR_CHECK_MS) {
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import { jsx } from "react/jsx-runtime";
|
|
3
3
|
import React from "react";
|
|
4
|
-
import { MOTION_RENDERER_WATCHDOG_MS, MOTION_SHADER_COLOR_CHECK_MS
|
|
4
|
+
import { MOTION_RENDERER_WATCHDOG_MS, MOTION_SHADER_COLOR_CHECK_MS } from "../../tokens/motion.js";
|
|
5
|
+
import { createFramePacer } from "../../behaviors/framePacer.js";
|
|
5
6
|
import { PASSES } from "./passes.js";
|
|
6
7
|
import { warnOnce } from "../../behaviors/devWarning.js";
|
|
7
8
|
import { sceneProblems } from "./assemble.js";
|
|
@@ -204,10 +205,12 @@ function ShaderScene({
|
|
|
204
205
|
let last = performance.now();
|
|
205
206
|
let frame = 0;
|
|
206
207
|
let painted = false;
|
|
208
|
+
const pacer = createFramePacer();
|
|
207
209
|
const draw = (now) => {
|
|
208
210
|
frame = requestAnimationFrame(draw);
|
|
209
211
|
if (lost) return;
|
|
210
|
-
|
|
212
|
+
const due = pacer.due(now, last, FRAME_MS);
|
|
213
|
+
if (painted && !due) return;
|
|
211
214
|
if (now - coloursChecked >= COLOUR_CHECK_MS) {
|
|
212
215
|
coloursChecked = now;
|
|
213
216
|
if (colourSignature() !== appliedColours) applyColours();
|
|
@@ -242,6 +242,7 @@
|
|
|
242
242
|
gap: var(--gap-500);
|
|
243
243
|
min-width: 0;
|
|
244
244
|
padding-block: var(--ds-site-layout-top-gap) var(--padding-1500);
|
|
245
|
+
/* ds-allow(focus): never a tab stop: the skip link lands here, and a ring round the whole page would mark nothing */
|
|
245
246
|
outline: none;
|
|
246
247
|
}
|
|
247
248
|
|
|
@@ -122,4 +122,16 @@
|
|
|
122
122
|
pointer-events: none;
|
|
123
123
|
}
|
|
124
124
|
|
|
125
|
+
/* Keyboard focus: the track drops its outline above, so the thumb, the
|
|
126
|
+
part that moves, takes the system ring. */
|
|
127
|
+
.ds-slider__input:focus-visible::-webkit-slider-thumb {
|
|
128
|
+
outline: 2px solid var(--color-action-primary-bg);
|
|
129
|
+
outline-offset: 2px;
|
|
130
|
+
}
|
|
131
|
+
|
|
132
|
+
.ds-slider__input:focus-visible::-moz-range-thumb {
|
|
133
|
+
outline: 2px solid var(--color-action-primary-bg);
|
|
134
|
+
outline-offset: 2px;
|
|
135
|
+
}
|
|
136
|
+
|
|
125
137
|
} /* @layer rift.components */
|
|
@@ -40,7 +40,7 @@ const Slider = React.forwardRef(
|
|
|
40
40
|
const isControlled = value !== void 0;
|
|
41
41
|
const [internalValue, setInternalValue] = React.useState(defaultValue);
|
|
42
42
|
const currentValue = isControlled ? value : internalValue;
|
|
43
|
-
const percentage = (currentValue - min) / (max - min) * 100;
|
|
43
|
+
const percentage = max > min ? Math.min(100, Math.max(0, (currentValue - min) / (max - min) * 100)) : 0;
|
|
44
44
|
const handleChange = (e) => {
|
|
45
45
|
if (!isControlled) setInternalValue(Number(e.target.value));
|
|
46
46
|
onChange?.(e);
|
|
@@ -27,6 +27,13 @@ import { MOTION_TABLE_COMMAND_SKELETON_MS, MOTION_ACTION_DISMISS_MS } from "../.
|
|
|
27
27
|
import { BREAKPOINT_PHONE_PX, BREAKPOINT_SHEET_PX, mediaBelow } from "../../tokens/breakpoints.js";
|
|
28
28
|
import "./TableToolbar.css";
|
|
29
29
|
import { mirrorClass } from "../../behaviors/direction.js";
|
|
30
|
+
const SHEET_SEARCH_FIRST = {
|
|
31
|
+
get current() {
|
|
32
|
+
return document.querySelector(".ds-table-toolbar__sheet .ds-table-toolbar__search input");
|
|
33
|
+
},
|
|
34
|
+
set current(_node) {
|
|
35
|
+
}
|
|
36
|
+
};
|
|
30
37
|
const DEFAULT_LABELS = {
|
|
31
38
|
toolbar: "Table controls",
|
|
32
39
|
search: "Search",
|
|
@@ -134,6 +141,7 @@ function ToolbarPanel({
|
|
|
134
141
|
size: "lg",
|
|
135
142
|
footer,
|
|
136
143
|
className: "ds-table-toolbar__sheet",
|
|
144
|
+
initialFocus: SHEET_SEARCH_FIRST,
|
|
137
145
|
children: content
|
|
138
146
|
}
|
|
139
147
|
)
|
|
@@ -814,6 +822,15 @@ const TableToolbar = React.forwardRef(
|
|
|
814
822
|
);
|
|
815
823
|
const updateFilter = (next) => setFilters(filters.map((f) => f.id === next.id ? next : f));
|
|
816
824
|
const removeFilter = (id) => setFilters(filters.filter((f) => f.id !== id));
|
|
825
|
+
const removeChip = (id, index) => {
|
|
826
|
+
removeFilter(id);
|
|
827
|
+
requestAnimationFrame(() => {
|
|
828
|
+
const root = rootRef.current;
|
|
829
|
+
const removes = [...root?.querySelectorAll("[data-chip]:not(.ds-table-toolbar__chip--overflow) > button") ?? []];
|
|
830
|
+
const field = root?.querySelector(".ds-table-toolbar__search input");
|
|
831
|
+
(removes[index] ?? removes[index - 1] ?? field ?? root)?.focus();
|
|
832
|
+
});
|
|
833
|
+
};
|
|
817
834
|
const menuItem = (label, icon, onClick, disabled) => /* @__PURE__ */ jsxs("button", { type: "button", className: "ds-table-toolbar__menu-item", onClick, disabled, children: [
|
|
818
835
|
typeof icon === "string" ? /* @__PURE__ */ jsx("span", { className: `ds-table-toolbar__menu-icon material-symbols-rounded ${mirrorClass(icon)}`, "aria-hidden": "true", children: icon }) : icon,
|
|
819
836
|
/* @__PURE__ */ jsx("span", { children: label })
|
|
@@ -917,7 +934,7 @@ const TableToolbar = React.forwardRef(
|
|
|
917
934
|
size,
|
|
918
935
|
tooltip: false,
|
|
919
936
|
label: filterLabels.remove(text),
|
|
920
|
-
onClick: () =>
|
|
937
|
+
onClick: () => removeChip(filter.id, index)
|
|
921
938
|
}
|
|
922
939
|
)
|
|
923
940
|
]
|
|
@@ -109,6 +109,7 @@
|
|
|
109
109
|
flex: 1;
|
|
110
110
|
min-width: 0;
|
|
111
111
|
border: none;
|
|
112
|
+
/* ds-allow(focus): a bare text run: .ds-taginput__shell draws the active border through :focus-within */
|
|
112
113
|
outline: none;
|
|
113
114
|
background-color: transparent;
|
|
114
115
|
padding: 0;
|
|
@@ -134,6 +135,13 @@
|
|
|
134
135
|
border-color: var(--color-status-error-border);
|
|
135
136
|
}
|
|
136
137
|
|
|
138
|
+
/* The border is the error's already, so it cannot also say "you are here":
|
|
139
|
+
a field in error takes the system ring while it holds the focus. */
|
|
140
|
+
.ds-taginput--error .ds-taginput__shell:has(input:focus-visible) {
|
|
141
|
+
outline: 2px solid var(--color-action-primary-bg);
|
|
142
|
+
outline-offset: 2px;
|
|
143
|
+
}
|
|
144
|
+
|
|
137
145
|
/* ============================================
|
|
138
146
|
DISABLED STATE
|
|
139
147
|
============================================ */
|