@zonsh/ui 0.4.1 → 0.5.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/dist/components/accordion.js +1 -1
- package/dist/components/ascii-field.js +2 -1
- package/dist/components/bottom-nav.js +4 -4
- package/dist/components/button.js +1 -1
- package/dist/components/chart.d.ts +11 -0
- package/dist/components/chart.js +12 -0
- package/dist/components/collapsible.js +1 -1
- package/dist/components/command.js +3 -3
- package/dist/components/conversation.js +10 -3
- package/dist/components/copy-button.js +7 -5
- package/dist/components/graph.js +24 -7
- package/dist/components/illustration.js +50 -3
- package/dist/components/input-group.d.ts +2 -2
- package/dist/components/input-group.js +6 -4
- package/dist/components/input.d.ts +1 -1
- package/dist/components/input.js +1 -1
- package/dist/components/layout.d.ts +2 -1
- package/dist/components/layout.js +55 -11
- package/dist/components/lightbox.js +22 -4
- package/dist/components/menubar.js +60 -13
- package/dist/components/message.js +3 -2
- package/dist/components/navigation-menu.js +4 -2
- package/dist/components/number-field.js +26 -12
- package/dist/components/pagination.js +1 -1
- package/dist/components/prompt-input.js +14 -6
- package/dist/components/radio-group.js +7 -2
- package/dist/components/reasoning.js +1 -1
- package/dist/components/response.d.ts +3 -2
- package/dist/components/response.js +22 -10
- package/dist/components/sidebar.js +37 -18
- package/dist/components/site-header.js +6 -1
- package/dist/components/skeleton.d.ts +1 -1
- package/dist/components/skeleton.js +1 -1
- package/dist/components/sortable.js +61 -37
- package/dist/components/table.d.ts +1 -1
- package/dist/components/table.js +55 -2
- package/dist/components/tabs.js +8 -4
- package/dist/components/tags-input.js +1 -1
- package/dist/components/theme.d.ts +1 -1
- package/dist/components/theme.js +21 -3
- package/dist/components/time-field.d.ts +2 -1
- package/dist/components/time-field.js +13 -3
- package/dist/components/toggle-group.js +1 -0
- package/dist/components/tool-call.js +6 -1
- package/dist/components/toolbar.d.ts +1 -1
- package/dist/components/toolbar.js +5 -2
- package/dist/components/tooltip.d.ts +4 -2
- package/dist/components/tooltip.js +10 -4
- package/dist/components/tour.js +35 -10
- package/dist/components/tree.js +29 -6
- package/dist/components/video-player.js +61 -5
- package/dist/lib/glide.d.ts +5 -4
- package/dist/lib/glide.js +5 -4
- package/dist/lib/table-fit.d.ts +3 -2
- package/dist/lib/table-fit.js +29 -19
- package/dist/styles/expressive.css +40 -21
- package/dist/styles/index.css +8 -0
- package/dist/styles/material.css +40 -20
- package/dist/styles/parts/ai.css +2 -1
- package/dist/styles/parts/controls.css +24 -20
- package/dist/styles/parts/data.css +33 -5
- package/dist/styles/parts/feedback.css +43 -13
- package/dist/styles/parts/navigation.css +42 -9
- package/dist/styles/parts/overlays.css +93 -6
- package/dist/styles/parts/pdf.css +13 -7
- package/dist/styles/tokens.css +16 -1
- package/package.json +1 -1
|
@@ -42,14 +42,20 @@ const TRIGGER = '[data-slot="menubar-trigger"]';
|
|
|
42
42
|
const findOpen = (root) => root.querySelector(`${TRIGGER}[data-popup-open]`);
|
|
43
43
|
/** How long the surface waits for the next menu before it fades (ms). */
|
|
44
44
|
const HOLD = 90;
|
|
45
|
+
/** Frames the popup must hold still (no animation, same box) before the surface stops measuring. */
|
|
46
|
+
const SETTLED = 2;
|
|
45
47
|
const MenubarSurfaceContext = React.createContext(null);
|
|
46
48
|
/**
|
|
47
49
|
* The bar's menus share one surface, like NavigationMenu's viewport. Each menubar popup drops its
|
|
48
50
|
* own material (`data-surface`) and this fixed element, carrying the menu material, follows the
|
|
49
|
-
* open popup every frame
|
|
50
|
-
*
|
|
51
|
-
*
|
|
52
|
-
*
|
|
51
|
+
* open popup. It measures every frame only while the popup moves — opening, closing, its fade on a
|
|
52
|
+
* switch, or until Base UI has placed it — and rests once the popup's box has held still with no
|
|
53
|
+
* animation running; observers on the popup's attributes, its positioner's style (Base UI moves
|
|
54
|
+
* it on scroll and resize) and its size start it again. Opening and closing it simply tracks the
|
|
55
|
+
* popup's own motion; moving to a neighbouring menu turns on `data-switching`, so position and
|
|
56
|
+
* size glide over 2 × --duration — CSS transitions start from wherever they are, which keeps quick
|
|
57
|
+
* back-and-forth smooth — while the new items fade in. Reduced motion sets --duration to 0, so it
|
|
58
|
+
* jumps.
|
|
53
59
|
*/
|
|
54
60
|
function useMenuSurface() {
|
|
55
61
|
const surfaceRef = React.useRef(null);
|
|
@@ -59,6 +65,32 @@ function useMenuSurface() {
|
|
|
59
65
|
let lostAt = 0;
|
|
60
66
|
let frame = 0;
|
|
61
67
|
let settle = 0;
|
|
68
|
+
let still = 0;
|
|
69
|
+
let last = "";
|
|
70
|
+
let observers = [];
|
|
71
|
+
const kick = () => {
|
|
72
|
+
still = 0;
|
|
73
|
+
if (!frame && typeof requestAnimationFrame === "function")
|
|
74
|
+
frame = requestAnimationFrame(follow);
|
|
75
|
+
};
|
|
76
|
+
const watch = (popup) => {
|
|
77
|
+
observers.forEach((observer) => observer.disconnect());
|
|
78
|
+
observers = [];
|
|
79
|
+
if (!popup)
|
|
80
|
+
return;
|
|
81
|
+
if (typeof MutationObserver === "function") {
|
|
82
|
+
const mutations = new MutationObserver(kick);
|
|
83
|
+
mutations.observe(popup, { attributes: true });
|
|
84
|
+
if (popup.parentElement)
|
|
85
|
+
mutations.observe(popup.parentElement, { attributes: true, attributeFilter: ["style"] });
|
|
86
|
+
observers.push(mutations);
|
|
87
|
+
}
|
|
88
|
+
if (typeof ResizeObserver === "function") {
|
|
89
|
+
const sizes = new ResizeObserver(kick);
|
|
90
|
+
sizes.observe(popup);
|
|
91
|
+
observers.push(sizes);
|
|
92
|
+
}
|
|
93
|
+
};
|
|
62
94
|
const follow = () => {
|
|
63
95
|
frame = 0;
|
|
64
96
|
const surface = surfaceRef.current;
|
|
@@ -78,8 +110,10 @@ function useMenuSurface() {
|
|
|
78
110
|
surface.removeAttribute("data-visible");
|
|
79
111
|
if (active?.isConnected)
|
|
80
112
|
frame = requestAnimationFrame(follow);
|
|
81
|
-
else
|
|
113
|
+
else {
|
|
82
114
|
active = null;
|
|
115
|
+
watch(null);
|
|
116
|
+
}
|
|
83
117
|
return;
|
|
84
118
|
}
|
|
85
119
|
lostAt = 0;
|
|
@@ -88,16 +122,24 @@ function useMenuSurface() {
|
|
|
88
122
|
surface.style.width = `${r.width}px`;
|
|
89
123
|
surface.style.height = `${r.height}px`;
|
|
90
124
|
surface.setAttribute("data-visible", "");
|
|
91
|
-
|
|
125
|
+
// Keep measuring while the popup animates or has not yet held its box for a few frames.
|
|
126
|
+
const box = `${r.left},${r.top},${r.width},${r.height}`;
|
|
127
|
+
const moving = active.hasAttribute("data-starting-style") ||
|
|
128
|
+
(active.getAnimations?.().length ?? 0) > 0 ||
|
|
129
|
+
box !== last;
|
|
130
|
+
last = box;
|
|
131
|
+
still = moving ? 0 : still + 1;
|
|
132
|
+
if (still < SETTLED)
|
|
133
|
+
frame = requestAnimationFrame(follow);
|
|
92
134
|
};
|
|
93
135
|
return {
|
|
136
|
+
kick,
|
|
94
137
|
open(popup) {
|
|
95
138
|
const surface = surfaceRef.current;
|
|
96
139
|
popup.setAttribute("data-surface", "");
|
|
97
140
|
// Refs re-attach on re-render: the same popup again changes nothing.
|
|
98
141
|
if (popup === active) {
|
|
99
|
-
|
|
100
|
-
frame = requestAnimationFrame(follow);
|
|
142
|
+
kick();
|
|
101
143
|
return;
|
|
102
144
|
}
|
|
103
145
|
const switching = !!surface?.hasAttribute("data-visible") && !!active && active !== popup;
|
|
@@ -112,6 +154,7 @@ function useMenuSurface() {
|
|
|
112
154
|
popups.add(popup);
|
|
113
155
|
popup.style.visibility = "";
|
|
114
156
|
active = popup;
|
|
157
|
+
watch(popup);
|
|
115
158
|
lostAt = 0;
|
|
116
159
|
if (surface && switching) {
|
|
117
160
|
const duration = cssDuration(surface) * 2;
|
|
@@ -122,14 +165,13 @@ function useMenuSurface() {
|
|
|
122
165
|
popup.animate([{ opacity: 0 }, { opacity: 1 }], {
|
|
123
166
|
duration: duration * 0.6,
|
|
124
167
|
delay: duration * 0.15,
|
|
125
|
-
easing: "ease-out",
|
|
168
|
+
easing: getComputedStyle(surface).getPropertyValue("--ease").trim() || "ease-out",
|
|
126
169
|
fill: "backwards",
|
|
127
170
|
});
|
|
128
171
|
}
|
|
129
172
|
}
|
|
130
173
|
// Base UI positions the popup in a layout effect after it mounts: measure from the next frame.
|
|
131
|
-
|
|
132
|
-
frame = requestAnimationFrame(follow);
|
|
174
|
+
kick();
|
|
133
175
|
},
|
|
134
176
|
};
|
|
135
177
|
}, []);
|
|
@@ -139,8 +181,13 @@ function useMenuSurface() {
|
|
|
139
181
|
function useSurfacePopup() {
|
|
140
182
|
const surface = React.useContext(MenubarSurfaceContext);
|
|
141
183
|
return React.useCallback((node) => {
|
|
142
|
-
if (surface
|
|
143
|
-
|
|
184
|
+
if (!surface)
|
|
185
|
+
return;
|
|
186
|
+
// Leaving: the surface looks once more, sees the popup gone and fades.
|
|
187
|
+
if (!node)
|
|
188
|
+
return surface.kick();
|
|
189
|
+
surface.open(node);
|
|
190
|
+
return () => surface.kick();
|
|
144
191
|
}, [surface]);
|
|
145
192
|
}
|
|
146
193
|
/**
|
|
@@ -49,9 +49,10 @@ export function MessageText({ className, ...props }) {
|
|
|
49
49
|
export function MessageActions({ className, ...props }) {
|
|
50
50
|
const from = React.useContext(MessageContext);
|
|
51
51
|
return (_jsx("div", { "data-slot": "message-actions", className: cn("-ms-1.5 flex items-center gap-0.5",
|
|
52
|
-
// User actions appear on hover or focus, so a long thread stays quiet.
|
|
52
|
+
// User actions appear on hover or focus, so a long thread stays quiet. A touch screen has
|
|
53
|
+
// no hover, and an invisible button would still take the tap: there they always show.
|
|
53
54
|
from === "user" &&
|
|
54
|
-
"ms-0 -me-1.5 opacity-0 transition-opacity duration-(--duration) ease-(--ease) group-focus-within/message:opacity-100 group-hover/message:opacity-100", className), ...props }));
|
|
55
|
+
"ms-0 -me-1.5 opacity-0 transition-opacity duration-(--duration-fade) ease-(--ease) group-focus-within/message:opacity-100 group-hover/message:opacity-100 pointer-coarse:opacity-100", className), ...props }));
|
|
55
56
|
}
|
|
56
57
|
/** One action under a message: a 30px ghost icon button with a tooltip. */
|
|
57
58
|
export function MessageAction({ label, className, children, ...props }) {
|
|
@@ -20,12 +20,14 @@ export function NavigationMenu({ variant = "text", positioner, className, childr
|
|
|
20
20
|
const popupDir = usePopupDir(dir);
|
|
21
21
|
return (_jsxs(BaseNavigationMenu.Root, { "data-slot": "navigation-menu", "data-variant": variant, dir: dir, className: sx("relative", className), ...props, children: [_jsx(VariantContext.Provider, { value: variant, children: children }), _jsx(BaseNavigationMenu.Portal, { children: _jsx(BaseNavigationMenu.Positioner, { sideOffset: 8, collisionPadding: { top: 8, bottom: 8, left: 16, right: 16 }, collisionAvoidance: { side: "none" }, dir: popupDir, ...positioner, className: sx([
|
|
22
22
|
"z-50 h-(--positioner-height) w-(--positioner-width) max-w-(--available-width) outline-none",
|
|
23
|
-
|
|
23
|
+
// Moving from one item's panel to the next is a move the interface makes on its own: ease in and out.
|
|
24
|
+
"transition-[top,left,right,bottom] duration-(--duration) ease-(--ease-move) data-instant:transition-none",
|
|
24
25
|
// Hover bridge across the side offset so the pointer can travel into the popup.
|
|
25
26
|
"before:absolute before:content-[''] data-[side=bottom]:before:inset-x-0 data-[side=bottom]:before:-top-2 data-[side=bottom]:before:h-2 data-[side=top]:before:inset-x-0 data-[side=top]:before:-bottom-2 data-[side=top]:before:h-2",
|
|
26
27
|
], positioner?.className), children: _jsx(BaseNavigationMenu.Popup, { "data-slot": "navigation-menu-popup", className: [
|
|
27
28
|
"relative h-(--popup-height) w-(--popup-width) origin-(--transform-origin) overflow-hidden rounded-button material-menu outline-none",
|
|
28
|
-
|
|
29
|
+
// Opening and closing (opacity, scale) eases out; the size morph between panels eases in and out.
|
|
30
|
+
"transition-[opacity,scale,width,height] duration-(--duration) ease-[var(--ease),var(--ease),var(--ease-move),var(--ease-move)]",
|
|
29
31
|
"data-ending-style:scale-[0.97] data-ending-style:opacity-0 data-starting-style:scale-[0.97] data-starting-style:opacity-0",
|
|
30
32
|
].join(" "), children: _jsx(BaseNavigationMenu.Viewport, { "data-slot": "navigation-menu-viewport", className: "relative h-full w-full overflow-hidden" }) }) }) })] }));
|
|
31
33
|
}
|
|
@@ -47,10 +47,12 @@ const STEP_KEYS = new Set([
|
|
|
47
47
|
"Escape",
|
|
48
48
|
]);
|
|
49
49
|
/**
|
|
50
|
-
*
|
|
51
|
-
*
|
|
50
|
+
* A step rolls the digits: a press on a stepper, an arrow key, the wheel. Steps closer together
|
|
51
|
+
* than a roll lasts (a held key or stepper, a fast wheel) change in place, so a held key counts up
|
|
52
|
+
* cleanly instead of restarting the roll on every repeat. Scrubbing follows the pointer, and
|
|
53
|
+
* typing, pasting and blur formatting don't roll.
|
|
52
54
|
*/
|
|
53
|
-
const
|
|
55
|
+
const ROLL_REASONS = new Set(["increment-press", "decrement-press", "keyboard", "wheel"]);
|
|
54
56
|
/**
|
|
55
57
|
* NumberField — a recessed field for exact numbers, with raised −/+ steppers and mono, tabular
|
|
56
58
|
* digits so values do not jitter as they change.
|
|
@@ -97,6 +99,9 @@ export function NumberField({ size = "default", steppers = "sides", label, place
|
|
|
97
99
|
// A step re-renders this wrapper so the effect below runs, even if a controlling parent doesn't.
|
|
98
100
|
const [, setStepped] = React.useState(0);
|
|
99
101
|
const endRoll = React.useCallback(() => setRoll(null), []);
|
|
102
|
+
// When the last step came: a held key or stepper repeats faster than a roll lasts, and a roll
|
|
103
|
+
// that restarts on every repeat never lands, so steps that close together just change.
|
|
104
|
+
const lastStep = React.useRef(-Infinity);
|
|
100
105
|
React.useLayoutEffect(() => {
|
|
101
106
|
const step = pending.current;
|
|
102
107
|
const el = input.current;
|
|
@@ -119,15 +124,24 @@ export function NumberField({ size = "default", steppers = "sides", label, place
|
|
|
119
124
|
const showCaret = () => setCaretHidden(false);
|
|
120
125
|
const handleValueChange = (next, details) => {
|
|
121
126
|
const before = value;
|
|
122
|
-
if (input.current
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
127
|
+
if (ROLL_REASONS.has(details.reason) && input.current) {
|
|
128
|
+
const now = performance.now();
|
|
129
|
+
const rollMs = parseFloat(getComputedStyle(input.current).getPropertyValue("--duration")) || 150;
|
|
130
|
+
const repeat = now - lastStep.current < rollMs;
|
|
131
|
+
lastStep.current = now;
|
|
132
|
+
if (repeat) {
|
|
133
|
+
// Too soon after the last step: no new roll, and the one running gives way to the value.
|
|
134
|
+
pending.current = null;
|
|
135
|
+
setRoll(null);
|
|
136
|
+
}
|
|
137
|
+
else if (next != null && before != null && next !== before && !reducedMotion()) {
|
|
138
|
+
pending.current = { from: input.current.value, dir: next > before ? 1 : -1 };
|
|
139
|
+
setStepped((n) => n + 1);
|
|
140
|
+
}
|
|
141
|
+
}
|
|
142
|
+
else if (roll) {
|
|
143
|
+
// Typing or a scrub during a roll: the value shows at once.
|
|
144
|
+
setRoll(null);
|
|
131
145
|
}
|
|
132
146
|
onValueChange?.(next, details);
|
|
133
147
|
if (!controlled && !details.isCanceled)
|
|
@@ -64,7 +64,7 @@ export function Pagination({ page, pageCount, onPageChange, getHref, siblingCoun
|
|
|
64
64
|
// page leaves keyboard focus on it instead of dropping it to the page.
|
|
65
65
|
focusableWhenDisabled: true, nativeButton: !asLink, render: asLink ? _jsx("a", { href: getHref(target) }) : undefined, onClick: () => !disabled && target !== page && onPageChange?.(target), className: cn(square, "font-mono text-[13px] leading-none font-normal tabular-nums"), ...extra, children: content }));
|
|
66
66
|
};
|
|
67
|
-
return (_jsxs("nav", { "aria-label": text.nav, "data-slot": "pagination", "data-size": size, "data-glide": glide.visible ? "" : undefined, ref: setNavRef, className: cn("group/pagination relative flex", className), ...props, children: [_jsx("span", { "aria-hidden": true, "data-slot": "pagination-indicator", "data-visible": glide.visible ? "" : undefined, "data-instant": glide.instant ? "" : undefined, className: cn(glideMotion, "z-10 rounded-button ring-1 ring-control-focus
|
|
67
|
+
return (_jsxs("nav", { "aria-label": text.nav, "data-slot": "pagination", "data-size": size, "data-glide": glide.visible ? "" : undefined, ref: setNavRef, className: cn("group/pagination relative flex", className), ...props, children: [_jsx("span", { "aria-hidden": true, "data-slot": "pagination-indicator", "data-visible": glide.visible ? "" : undefined, "data-instant": glide.instant ? "" : undefined, className: cn(glideMotion, "z-10 rounded-button ring-1 ring-control-focus"), style: glideStyle(glide) }), _jsxs("ul", { className: "m-0 flex list-none flex-wrap items-center gap-1.5 p-0 [&>li]:flex", children: [_jsx("li", { children: control(current - 1, _jsx(ChevronLeftIcon, { className: "rtl:-scale-x-100" }), {
|
|
68
68
|
"aria-label": text.previous,
|
|
69
69
|
className: arrow,
|
|
70
70
|
}) }), pages.map((p) => typeof p === "number" ? (_jsx("li", { children: control(p, p, {
|
|
@@ -29,18 +29,26 @@ function usePromptInput(part) {
|
|
|
29
29
|
/* ── Motion helpers ────────────────────────────────────────────────────────── */
|
|
30
30
|
const reducedMotion = () => typeof window !== "undefined" && window.matchMedia?.("(prefers-reduced-motion: reduce)").matches;
|
|
31
31
|
/**
|
|
32
|
-
* The morph's timing:
|
|
33
|
-
* front-load a glide this size into one frame, so the bar is seen to grow and
|
|
34
|
-
* reduced motion.
|
|
32
|
+
* The morph's timing: 4/3 of `--duration` (200ms) on `--ease-glide`, an ease-out milder than the
|
|
33
|
+
* brand's, which would front-load a glide this size into one frame, so the bar is seen to grow and
|
|
34
|
+
* settle; none under reduced motion. It answers typing, so it stays short.
|
|
35
35
|
*/
|
|
36
36
|
function morphTiming() {
|
|
37
37
|
if (typeof document === "undefined" || reducedMotion())
|
|
38
38
|
return null;
|
|
39
|
-
const duration = cssDuration() *
|
|
39
|
+
const duration = (cssDuration() * 4) / 3;
|
|
40
40
|
if (!duration)
|
|
41
41
|
return null;
|
|
42
|
-
|
|
42
|
+
const easing = getComputedStyle(document.documentElement).getPropertyValue("--ease-glide").trim() ||
|
|
43
|
+
"cubic-bezier(0.33, 1, 0.68, 1)";
|
|
44
|
+
return { duration, easing };
|
|
43
45
|
}
|
|
46
|
+
/* The send button's three faces — arrow, spinner, stop — stacked in one grid cell, as CopyButton's
|
|
47
|
+
are: they cross-fade and scale from 0.85 on --duration (0 under reduced motion), so the button
|
|
48
|
+
never changes size or jumps between them. A face out of sight stops its animation. */
|
|
49
|
+
const submitFace = "col-start-1 row-start-1 grid place-items-center transition-[opacity,scale] duration-(--duration) ease-(--ease)";
|
|
50
|
+
const submitShown = "scale-100 opacity-100";
|
|
51
|
+
const submitHidden = "scale-[0.85] opacity-0 [&,&_*]:animate-none";
|
|
44
52
|
let measureContext;
|
|
45
53
|
/** The width of `text` on one line in the textarea's own font. */
|
|
46
54
|
function lineWidth(text, el) {
|
|
@@ -411,5 +419,5 @@ export function PromptInputSubmit({ labels, className, onClick, ...props }) {
|
|
|
411
419
|
// cancel it, or the form would send whatever is in the prompt.
|
|
412
420
|
event.preventDefault();
|
|
413
421
|
onStop();
|
|
414
|
-
}, className: className, ...props, children:
|
|
422
|
+
}, className: className, ...props, children: _jsxs("span", { "aria-hidden": true, "data-slot": "prompt-input-submit-icon", className: "grid", children: [_jsx("span", { className: cn(submitFace, busy ? submitHidden : submitShown), children: _jsx(ArrowUpIcon, {}) }), _jsx("span", { className: cn(submitFace, busy && !(status === "streaming" && stop) ? submitShown : submitHidden), children: _jsx(Spinner, { size: "sm", "aria-hidden": true }) }), _jsx("span", { className: cn(submitFace, status === "streaming" && stop ? submitShown : submitHidden), children: _jsx(SquareIcon, { className: "size-3 fill-current" }) })] }) }) }));
|
|
415
423
|
}
|
|
@@ -3,7 +3,7 @@ import { jsx as _jsx } from "react/jsx-runtime";
|
|
|
3
3
|
import { Radio as BaseRadio } from "@base-ui/react/radio";
|
|
4
4
|
import { RadioGroup as BaseRadioGroup } from "@base-ui/react/radio-group";
|
|
5
5
|
import * as React from "react";
|
|
6
|
-
import { sx } from "../lib/cn.js";
|
|
6
|
+
import { cn, sx } from "../lib/cn.js";
|
|
7
7
|
import { useFormReset } from "../lib/form-reset.js";
|
|
8
8
|
import { mergeRefs } from "../lib/merge-refs.js";
|
|
9
9
|
/**
|
|
@@ -30,5 +30,10 @@ export function Radio({ className, ...props }) {
|
|
|
30
30
|
"relative inline-flex size-[18px] shrink-0 material-field cursor-pointer items-center justify-center rounded-full p-0",
|
|
31
31
|
"data-checked:border-transparent data-checked:bg-primary data-checked:bg-none data-checked:text-primary-foreground data-checked:shadow-checked",
|
|
32
32
|
"data-readonly:cursor-default",
|
|
33
|
-
], className), ...props, children: _jsx(BaseRadio.Indicator, { "data-slot": "radio-indicator", className:
|
|
33
|
+
], className), ...props, children: _jsx(BaseRadio.Indicator, { "data-slot": "radio-indicator", className: cn(
|
|
34
|
+
// Its own ink, so the dot stays drawn while it leaves after the fill has gone.
|
|
35
|
+
"pointer-events-none flex items-center justify-center text-primary-foreground before:size-1.5 before:rounded-full before:bg-current",
|
|
36
|
+
// The dot grows in from half its size as the check draws in a Checkbox, and shrinks away
|
|
37
|
+
// on the exit duration; reduced motion keeps the fade.
|
|
38
|
+
"transition-[opacity,scale] [transition-duration:var(--duration-fade),var(--duration)] ease-(--ease)", "data-starting-style:scale-50 data-starting-style:opacity-0", "data-ending-style:scale-50 data-ending-style:opacity-0 data-ending-style:[transition-duration:calc(var(--duration-fade)*0.7),var(--duration-exit)]") }) }));
|
|
34
39
|
}
|
|
@@ -69,5 +69,5 @@ export function ReasoningTrigger({ labels, className, children, ...props }) {
|
|
|
69
69
|
* a `Response` inside renders markdown.
|
|
70
70
|
*/
|
|
71
71
|
export function ReasoningContent({ className, children, ...props }) {
|
|
72
|
-
return (_jsx(CollapsiblePanel, { "data-slot": "reasoning-content", children: _jsx("div", { className: cn("ms-1.5 border-s border-border/60 py-1 ps-4 text-sm leading-relaxed text-muted-foreground", typeof children === "string" && "whitespace-pre-wrap", className), ...props, children: children }) }));
|
|
72
|
+
return (_jsx(CollapsiblePanel, { "data-slot": "reasoning-content", className: "duration-(--duration-glide) ease-(--ease-glide)", children: _jsx("div", { className: cn("ms-1.5 border-s border-border/60 py-1 ps-4 text-sm leading-relaxed text-muted-foreground", typeof children === "string" && "whitespace-pre-wrap", className), ...props, children: children }) }));
|
|
73
73
|
}
|
|
@@ -17,7 +17,8 @@ export interface ResponseProps extends Omit<React.ComponentProps<"div">, "childr
|
|
|
17
17
|
streaming?: boolean;
|
|
18
18
|
/**
|
|
19
19
|
* Reveal the text at an even pace, a word at a time with each word coming into focus, instead
|
|
20
|
-
* of in the bursts it arrives in. Default `true`;
|
|
20
|
+
* of in the bursts it arrives in. Default `true`; under reduced motion, on a phone or a touch
|
|
21
|
+
* screen the words fade in without the blur.
|
|
21
22
|
*/
|
|
22
23
|
smooth?: boolean;
|
|
23
24
|
/**
|
|
@@ -32,7 +33,7 @@ export interface ResponseProps extends Omit<React.ComponentProps<"div">, "childr
|
|
|
32
33
|
* `CodeBlock`, coloured by its language.
|
|
33
34
|
*
|
|
34
35
|
* While `streaming`, the reply writes itself out evenly at the pace it is arriving, a word at a
|
|
35
|
-
* time, each word coming into focus from a soft blur
|
|
36
|
+
* time, each word coming into focus from a soft blur; half-written
|
|
36
37
|
* markdown renders as it will end up. Raw HTML in the markdown is shown as text, unsafe link
|
|
37
38
|
* targets are dropped and images become links, because model output is untrusted; a paragraph that
|
|
38
39
|
* would take the parser too long shows as plain text.
|
|
@@ -286,9 +286,14 @@ const ResponseCode = React.memo(CodeBlock);
|
|
|
286
286
|
* Models stream in bursts: forty characters, a pause, eighty more. Shown as they arrive, the text
|
|
287
287
|
* jerks. Instead the reply is revealed at an even pace on every frame — the pace the text has been
|
|
288
288
|
* arriving at (an average of the last bursts) plus a share of whatever is waiting, so it never
|
|
289
|
-
* falls far behind — a whole word at a time. Each new word comes into focus: from transparent
|
|
290
|
-
* blurred
|
|
291
|
-
*
|
|
289
|
+
* falls far behind — a whole word at a time. Each new word comes into focus: from transparent and
|
|
290
|
+
* softly blurred to sharp, over BLUR_MS. When the stream ends, what is left is revealed quickly.
|
|
291
|
+
*
|
|
292
|
+
* Up to 360 characters are drawn every frame, so a frame writes as little as it can: opacity
|
|
293
|
+
* always, a blur of at most 2px only with a fine pointer on a wide screen. A phone, a touch
|
|
294
|
+
* screen or reduced motion get the fade alone — still paced, so the text does not jerk. The words
|
|
295
|
+
* do not rise: they are inline, where a transform does nothing, and moving them with `top` would
|
|
296
|
+
* lay the line out again every frame.
|
|
292
297
|
*
|
|
293
298
|
* The timing follows what is on screen, not the markdown source: after every frame that drew
|
|
294
299
|
* more, it notes how many visible characters there are and when. Syntax (`**`, `|`, a code
|
|
@@ -300,7 +305,12 @@ const BLUR_MS = 520;
|
|
|
300
305
|
const BLUR_CHARS = 360;
|
|
301
306
|
/** The slowest pace, in characters per second, so a slow stream still flows. */
|
|
302
307
|
const MIN_PACE = 32;
|
|
303
|
-
|
|
308
|
+
/** The most a new word is blurred, in px, where it is blurred at all. */
|
|
309
|
+
const BLUR_PX = 2;
|
|
310
|
+
/** Whether new words may blur: a fine pointer on a screen 768px or wider, and motion allowed. */
|
|
311
|
+
const canBlur = () => typeof window !== "undefined" &&
|
|
312
|
+
!!window.matchMedia?.("(pointer: fine) and (min-width: 48rem) and (prefers-reduced-motion: no-preference)")
|
|
313
|
+
.matches;
|
|
304
314
|
const commonPrefix = (a, b) => {
|
|
305
315
|
let i = 0;
|
|
306
316
|
while (i < a.length && i < b.length && a[i] === b[i])
|
|
@@ -378,7 +388,7 @@ function wrapWords(nodes, total, from) {
|
|
|
378
388
|
* `CodeBlock`, coloured by its language.
|
|
379
389
|
*
|
|
380
390
|
* While `streaming`, the reply writes itself out evenly at the pace it is arriving, a word at a
|
|
381
|
-
* time, each word coming into focus from a soft blur
|
|
391
|
+
* time, each word coming into focus from a soft blur; half-written
|
|
382
392
|
* markdown renders as it will end up. Raw HTML in the markdown is shown as text, unsafe link
|
|
383
393
|
* targets are dropped and images become links, because model output is untrusted; a paragraph that
|
|
384
394
|
* would take the parser too long shows as plain text.
|
|
@@ -401,7 +411,10 @@ export function Response({ children, streaming = false, smooth = true, highlight
|
|
|
401
411
|
const words = React.useRef([]);
|
|
402
412
|
/** What the last render parsed: kept, and grown from, while the reply grows. */
|
|
403
413
|
const parsed = React.useRef(null);
|
|
404
|
-
|
|
414
|
+
// Pacing is not movement: it stays under reduced motion, where the words only fade in.
|
|
415
|
+
const paced = smooth;
|
|
416
|
+
/** Read when a reveal starts (see `run`): blur the new words, or only fade them in. */
|
|
417
|
+
const blur = React.useRef(false);
|
|
405
418
|
/** Draws each new word for the time since it appeared. */
|
|
406
419
|
const paint = React.useCallback((now) => {
|
|
407
420
|
const { stamps, settled } = pace.current;
|
|
@@ -418,10 +431,8 @@ export function Response({ children, streaming = false, smooth = true, highlight
|
|
|
418
431
|
continue;
|
|
419
432
|
}
|
|
420
433
|
style.opacity = String(e);
|
|
421
|
-
|
|
422
|
-
|
|
423
|
-
style.position = "relative";
|
|
424
|
-
style.top = `${((1 - e) * 0.3).toFixed(3)}em`;
|
|
434
|
+
if (blur.current)
|
|
435
|
+
style.filter = `blur(${((1 - e) * BLUR_PX).toFixed(2)}px)`;
|
|
425
436
|
}
|
|
426
437
|
}, []);
|
|
427
438
|
const tick = React.useCallback((now) => {
|
|
@@ -458,6 +469,7 @@ export function Response({ children, streaming = false, smooth = true, highlight
|
|
|
458
469
|
const p = pace.current;
|
|
459
470
|
if (p.frame)
|
|
460
471
|
return;
|
|
472
|
+
blur.current = canBlur();
|
|
461
473
|
p.last = 0;
|
|
462
474
|
p.frame = requestAnimationFrame(tick);
|
|
463
475
|
}, [tick]);
|
|
@@ -17,6 +17,11 @@ const SidebarContext = React.createContext(null);
|
|
|
17
17
|
const SidebarSizeContext = React.createContext("default");
|
|
18
18
|
/** The edge the sidebar is on (`Sidebar side`): its icon rail's tooltips open towards the page. */
|
|
19
19
|
const SidebarSideContext = React.createContext("left");
|
|
20
|
+
/**
|
|
21
|
+
* The last desktop toggle came from the keyboard shortcut: the panel then opens and closes at
|
|
22
|
+
* once, as a shortcut someone presses many times a day should; a click on a trigger animates.
|
|
23
|
+
*/
|
|
24
|
+
const SidebarInstantContext = React.createContext(false);
|
|
20
25
|
/** Where a `Sidebar` is rendered: the desktop panel or the mobile sheet. */
|
|
21
26
|
const SidebarSurfaceContext = React.createContext("panel");
|
|
22
27
|
/**
|
|
@@ -95,12 +100,22 @@ export function SidebarProvider({ defaultOpen = true, open: openProp, onOpenChan
|
|
|
95
100
|
if (stored !== undefined)
|
|
96
101
|
setOpenState(stored);
|
|
97
102
|
}, [openProp, storageKey]);
|
|
98
|
-
const
|
|
103
|
+
const toggle = React.useCallback(() => {
|
|
99
104
|
if (isMobile)
|
|
100
105
|
setOpenMobile((value) => !value);
|
|
101
106
|
else
|
|
102
107
|
setOpen(!openRef.current);
|
|
103
108
|
}, [isMobile, setOpen]);
|
|
109
|
+
// Only the shortcut toggles instantly; the trigger and setOpen animate.
|
|
110
|
+
const [instant, setInstant] = React.useState(false);
|
|
111
|
+
const toggleSidebar = React.useCallback(() => {
|
|
112
|
+
setInstant(false);
|
|
113
|
+
toggle();
|
|
114
|
+
}, [toggle]);
|
|
115
|
+
const setOpenAnimated = React.useCallback((value) => {
|
|
116
|
+
setInstant(false);
|
|
117
|
+
setOpen(value);
|
|
118
|
+
}, [setOpen]);
|
|
104
119
|
// Leaving the mobile layout closes the sheet: narrowing the window again must not reopen it.
|
|
105
120
|
if (!isMobile && openMobile)
|
|
106
121
|
setOpenMobile(false);
|
|
@@ -121,26 +136,27 @@ export function SidebarProvider({ defaultOpen = true, open: openProp, onOpenChan
|
|
|
121
136
|
if (event.target instanceof HTMLElement && event.target.isContentEditable)
|
|
122
137
|
return;
|
|
123
138
|
event.preventDefault();
|
|
124
|
-
|
|
139
|
+
setInstant(true);
|
|
140
|
+
toggle();
|
|
125
141
|
};
|
|
126
142
|
window.addEventListener("keydown", onKeyDown);
|
|
127
143
|
return () => window.removeEventListener("keydown", onKeyDown);
|
|
128
|
-
}, [keyboardShortcut, collapsible,
|
|
144
|
+
}, [keyboardShortcut, collapsible, toggle]);
|
|
129
145
|
const value = React.useMemo(() => ({
|
|
130
146
|
state: open || collapsible === "none" ? "expanded" : "collapsed",
|
|
131
147
|
open,
|
|
132
|
-
setOpen,
|
|
148
|
+
setOpen: setOpenAnimated,
|
|
133
149
|
openMobile,
|
|
134
150
|
setOpenMobile,
|
|
135
151
|
isMobile,
|
|
136
152
|
toggleSidebar,
|
|
137
153
|
collapsible,
|
|
138
|
-
}), [open,
|
|
139
|
-
return (_jsx(SidebarContext.Provider, { value: value, children: _jsx(TooltipProvider, { children: _jsx("div", { "data-slot": "sidebar-wrapper", className: cn("flex min-h-svh w-full", className), style: {
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
154
|
+
}), [open, setOpenAnimated, openMobile, isMobile, toggleSidebar, collapsible]);
|
|
155
|
+
return (_jsx(SidebarContext.Provider, { value: value, children: _jsx(SidebarInstantContext.Provider, { value: instant, children: _jsx(TooltipProvider, { children: _jsx("div", { "data-slot": "sidebar-wrapper", className: cn("flex min-h-svh w-full", className), style: {
|
|
156
|
+
"--sidebar-width": "16rem",
|
|
157
|
+
"--sidebar-width-icon": "calc(var(--control-h) + 25px)",
|
|
158
|
+
...style,
|
|
159
|
+
}, ...props, children: children }) }) }) }));
|
|
144
160
|
}
|
|
145
161
|
/* ── The current row glides ──────────────────────────────────────────────── */
|
|
146
162
|
const ROW = '[data-slot="sidebar-item"]';
|
|
@@ -206,15 +222,17 @@ function CurrentGlide() {
|
|
|
206
222
|
}
|
|
207
223
|
}
|
|
208
224
|
ghost.style.visibility = "visible";
|
|
209
|
-
|
|
225
|
+
// --duration-glide, resolved: the copy's animation-duration (it runs no CSS animation) is
|
|
226
|
+
// set to it, as the token itself is a calc() that getPropertyValue returns unresolved.
|
|
227
|
+
const duration = parseFloat(getComputedStyle(ghost).animationDuration) * 1000 || 0;
|
|
210
228
|
const at = (b) => ({
|
|
211
229
|
translate: `${b.x}px ${b.y}px`,
|
|
212
230
|
width: `${b.w}px`,
|
|
213
231
|
height: `${b.h}px`,
|
|
214
232
|
});
|
|
215
233
|
running = ghost.animate([at(from), at(to)], {
|
|
216
|
-
duration
|
|
217
|
-
easing: getComputedStyle(nav).getPropertyValue("--ease").trim() || "ease-out",
|
|
234
|
+
duration,
|
|
235
|
+
easing: getComputedStyle(nav).getPropertyValue("--ease-glide").trim() || "ease-out",
|
|
218
236
|
fill: "forwards",
|
|
219
237
|
});
|
|
220
238
|
running.onfinish = land;
|
|
@@ -233,7 +251,7 @@ function CurrentGlide() {
|
|
|
233
251
|
delete row.dataset.glide;
|
|
234
252
|
};
|
|
235
253
|
}, []);
|
|
236
|
-
return (_jsx("span", { ref: ref, "aria-hidden": true, "data-slot": "sidebar-current-glide", "data-current": "", className: "pointer-events-none invisible absolute top-0 left-0 -z-1 rounded-button material-row" }));
|
|
254
|
+
return (_jsx("span", { ref: ref, "aria-hidden": true, "data-slot": "sidebar-current-glide", "data-current": "", className: "pointer-events-none invisible absolute top-0 left-0 -z-1 rounded-button material-row [animation-duration:var(--duration-glide)]" }));
|
|
237
255
|
}
|
|
238
256
|
/**
|
|
239
257
|
* Hover is one soft fill that follows the pointer up and down the list instead of each row lighting
|
|
@@ -311,7 +329,7 @@ function HoverGlide() {
|
|
|
311
329
|
nav.removeEventListener("scroll", follow, true);
|
|
312
330
|
};
|
|
313
331
|
}, []);
|
|
314
|
-
return (_jsx("span", { ref: ref, "aria-hidden": true, "data-slot": "sidebar-hover-glide", className: cn("pointer-events-none absolute top-0 left-0 -z-1 rounded-button bg-(--ink-ghost) opacity-0 data-visible:opacity-100", "transition-[translate,width,height,opacity] duration-
|
|
332
|
+
return (_jsx("span", { ref: ref, "aria-hidden": true, "data-slot": "sidebar-hover-glide", className: cn("pointer-events-none absolute top-0 left-0 -z-1 rounded-button bg-(--ink-ghost) opacity-0 data-visible:opacity-100", "transition-[translate,width,height,opacity] [transition-duration:var(--duration-glide),var(--duration-glide),var(--duration-glide),var(--duration-fade)] ease-(--ease-glide) data-instant:transition-none") }));
|
|
315
333
|
}
|
|
316
334
|
/**
|
|
317
335
|
* Sidebar — section navigation for docs, settings and dashboards.
|
|
@@ -328,6 +346,7 @@ function HoverGlide() {
|
|
|
328
346
|
*/
|
|
329
347
|
export function Sidebar({ side = "left", variant = "sidebar", size = "default", hover = "text", className, children, ...props }) {
|
|
330
348
|
const shell = React.useContext(SidebarContext);
|
|
349
|
+
const instant = React.useContext(SidebarInstantContext);
|
|
331
350
|
const text = useMessages("sidebar", defaultMessages);
|
|
332
351
|
const dense = size === "sm";
|
|
333
352
|
// Dense: every control inside (the rows, a search field, a header button) is 30px.
|
|
@@ -347,9 +366,9 @@ export function Sidebar({ side = "left", variant = "sidebar", size = "default",
|
|
|
347
366
|
return (_jsx(Drawer, { side: side, open: openMobile, onOpenChange: setOpenMobile, children: _jsx(DrawerContent, { "data-slot": "sidebar-sheet", className: cn("w-[min(18rem,calc(100vw-3rem))] **:data-[slot=drawer-body]:gap-0 **:data-[slot=drawer-body]:p-0"), children: _jsxs(SidebarSurfaceContext.Provider, { value: "sheet", children: [_jsx(DrawerTitle, { className: "sr-only", children: props["aria-label"] ?? text.navigation }), _jsx("nav", { "data-slot": "sidebar", "data-side": side, "data-size": size, className: cn(panelClass, "relative min-h-0 flex-1 bg-background", sizeClass, className), ...props, children: content })] }) }) }));
|
|
348
367
|
}
|
|
349
368
|
const offcanvas = state === "collapsed" && collapsible === "offcanvas";
|
|
350
|
-
return (_jsx("div", { "data-slot": "sidebar-shell", "data-variant": variant, "data-size": size, style: dense
|
|
369
|
+
return (_jsx("div", { "data-slot": "sidebar-shell", "data-instant": instant ? "" : undefined, "data-variant": variant, "data-size": size, style: dense
|
|
351
370
|
? { "--sidebar-width-icon": "calc(var(--control-h-sm) + 25px)" }
|
|
352
|
-
: undefined, "data-state": state, "data-collapsible": state === "collapsed" ? collapsible : undefined, "data-side": side, className: cn("group/sidebar sticky top-0 hidden h-svh max-h-full w-(--sidebar-width) shrink-0 overflow-clip md:block", "transition-[width] duration-(--duration) ease-brand", "data-[collapsible=icon]:w-(--sidebar-width-icon) data-[collapsible=offcanvas]:w-0"), children: _jsx("nav", { "data-slot": "sidebar", "data-side": side, "data-size": size, inert: offcanvas || undefined, className: cn(panelClass, sizeClass, "absolute inset-y-0 w-(--sidebar-width) border-border/60 transition-[width] duration-(--duration) ease-brand", "group-data-[collapsible=icon]/sidebar:w-(--sidebar-width-icon)", side === "left" ? "start-0" : "end-0", variant !== "sidebar" ? undefined : side === "left" ? "border-e" : "border-s", className), ...props, children: content }) }));
|
|
371
|
+
: undefined, "data-state": state, "data-collapsible": state === "collapsed" ? collapsible : undefined, "data-side": side, className: cn("group/sidebar sticky top-0 hidden h-svh max-h-full w-(--sidebar-width) shrink-0 overflow-clip md:block", "transition-[width] duration-(--duration) ease-brand data-instant:transition-none", "data-[collapsible=icon]:w-(--sidebar-width-icon) data-[collapsible=offcanvas]:w-0"), children: _jsx("nav", { "data-slot": "sidebar", "data-side": side, "data-size": size, inert: offcanvas || undefined, className: cn(panelClass, sizeClass, "absolute inset-y-0 w-(--sidebar-width) border-border/60 transition-[width] duration-(--duration) ease-brand group-data-instant/sidebar:transition-none", "group-data-[collapsible=icon]/sidebar:w-(--sidebar-width-icon)", side === "left" ? "start-0" : "end-0", variant !== "sidebar" ? undefined : side === "left" ? "border-e" : "border-s", className), ...props, children: content }) }));
|
|
353
372
|
}
|
|
354
373
|
/** The top of an app-shell sidebar: a logo, a workspace switcher, a search row. Never scrolls. */
|
|
355
374
|
export function SidebarHeader({ className, ...props }) {
|
|
@@ -385,7 +404,7 @@ export function SidebarGroup({ className, ...props }) {
|
|
|
385
404
|
*/
|
|
386
405
|
export function SidebarGroupLabel({ className, ...props }) {
|
|
387
406
|
const dense = React.useContext(SidebarSizeContext) === "sm";
|
|
388
|
-
return (_jsx("div", { "data-slot": "sidebar-group-label", className: cn("overflow-hidden eyebrow whitespace-nowrap transition-[margin,opacity] duration-(--duration) ease-brand", "group-data-[collapsible=icon]/sidebar:pointer-events-none group-data-[collapsible=icon]/sidebar:opacity-0",
|
|
407
|
+
return (_jsx("div", { "data-slot": "sidebar-group-label", className: cn("overflow-hidden eyebrow whitespace-nowrap transition-[margin,opacity] duration-(--duration) ease-brand group-data-instant/sidebar:transition-none", "group-data-[collapsible=icon]/sidebar:pointer-events-none group-data-[collapsible=icon]/sidebar:opacity-0",
|
|
389
408
|
// Fixed heights (line + padding) so the fold is exact: 16 + 8 = 24px, dense 14 + 6 = 20px.
|
|
390
409
|
dense
|
|
391
410
|
? "px-2.5 pb-1.5 text-[11px] leading-[14px] group-data-[collapsible=icon]/sidebar:-mt-5"
|
|
@@ -15,6 +15,9 @@ const defaultMessages = {
|
|
|
15
15
|
closeMenu: "Close menu",
|
|
16
16
|
menu: "Menu",
|
|
17
17
|
};
|
|
18
|
+
/** The phone panel's links come in this far apart, the first four of them (the rest with the fourth). */
|
|
19
|
+
const PANEL_STAGGER_MS = 30;
|
|
20
|
+
const PANEL_STAGGER_MAX = 4;
|
|
18
21
|
/** A link in the mobile panel: a plain `<a>`, or the entry's router link through `render`. */
|
|
19
22
|
function PanelLink({ render, href, ...props }) {
|
|
20
23
|
return useRender({
|
|
@@ -116,6 +119,8 @@ export function SiteHeader({ logo, links, actions, align = "end", scrolled: scro
|
|
|
116
119
|
...(scrolledProp !== undefined && { "--site-header-ground": scrolledProp ? 1 : 0 }),
|
|
117
120
|
}, ...props, children: [_jsx("span", { "aria-hidden": true, "data-slot": "site-header-ground" }), _jsxs("div", { className: cn("container-page flex min-h-16 items-center", align === "start" ? "gap-8" : "justify-between gap-6"), children: [_jsx("div", { "data-slot": "site-header-logo", className: "flex shrink-0 items-center", children: logo }), align === "start" ? (_jsxs(_Fragment, { children: [nav, actionsSlot && (_jsx("div", { className: cn("ms-auto items-center", menu ? "hidden @3xl/site-header:flex" : "flex"), children: actionsSlot }))] })) : (_jsxs("div", { className: cn("items-center gap-4", menu ? "hidden @3xl/site-header:flex" : "flex"), children: [nav, actionsSlot && (_jsxs(_Fragment, { children: [_jsx("span", { "aria-hidden": true, className: cn("h-5 w-px bg-border", !menu && "hidden @3xl/site-header:block") }), actionsSlot] }))] })), menu && (_jsxs(BaseDialog.Root, { open: open, onOpenChange: setOpen, children: [_jsx(BaseDialog.Trigger, { ref: menuButtonRef, render: _jsx(Button, { variant: "ghost", size: "icon", className: cn("@3xl/site-header:hidden", align === "start" && "ms-auto") }), "aria-label": menuLabels?.open ?? text.openMenu, children: _jsx(MenuIcon, {}) }), _jsx(BaseDialog.Portal, { children: _jsxs(BaseDialog.Popup, { "data-slot": "site-header-panel", dir: panelDir, className: cn("fixed inset-0 z-50 flex flex-col overflow-y-auto bg-background text-foreground outline-none", "pt-[env(safe-area-inset-top,0px)] pb-[env(safe-area-inset-bottom,0px)]", "transition-[opacity,translate] duration-(--duration) ease-(--ease)", "data-ending-style:-translate-y-2 data-ending-style:opacity-0 data-starting-style:-translate-y-2 data-starting-style:opacity-0"), children: [_jsx(BaseDialog.Title, { className: "sr-only", children: menuLabels?.title ?? text.menu }), _jsxs("div", { className: "container-page flex min-h-16 items-center justify-between gap-6 border-b border-border/60", children: [_jsx("div", { className: "flex shrink-0 items-center", children: logo }), _jsx(BaseDialog.Close, { render: _jsx(Button, { variant: "ghost", size: "icon" }), "aria-label": menuLabels?.close ?? text.closeMenu, children: _jsx(XIcon, {}) })] }), _jsx("nav", { "aria-label": navLabel, className: "container-page flex-1", children: _jsx("ul", { className: "m-0 list-none p-0", children: links.map((link, i) => {
|
|
118
121
|
const index = (_jsx("span", { className: "w-6 shrink-0 font-mono text-[12px] text-muted-foreground tabular-nums", children: String(i + 1).padStart(2, "0") }));
|
|
119
|
-
return (_jsxs("li", { className: "border-b border-border/60
|
|
122
|
+
return (_jsxs("li", { className: "border-b border-border/60 transition-[opacity,translate] duration-(--duration) ease-(--ease) starting:translate-y-2 starting:opacity-0", style: {
|
|
123
|
+
transitionDelay: `${Math.min(i, PANEL_STAGGER_MAX - 1) * PANEL_STAGGER_MS}ms`,
|
|
124
|
+
}, children: [link.href != null || link.render != null ? (_jsxs(PanelLink, { render: link.render, href: link.href, "aria-current": link.current ? "page" : undefined, onClick: () => setOpen(false), className: "flex items-baseline gap-5 py-5 text-foreground no-underline focus-ring", children: [index, _jsx("span", { className: "display text-[32px]", children: link.label })] })) : (_jsxs("div", { className: "flex items-baseline gap-5 pt-5 pb-2 text-foreground", children: [index, _jsx("span", { className: "display text-[32px]", children: link.label })] })), link.items?.length ? (_jsx("ul", { className: "m-0 -mt-1 list-none ps-11 pb-4", children: link.items.map((item, j) => (_jsx("li", { children: _jsx(PanelLink, { render: item.render, href: item.href, "aria-current": item.current ? "page" : undefined, onClick: () => setOpen(false), className: "flex min-h-(--control-h) items-center text-[17px] text-foreground-soft no-underline focus-ring aria-[current=page]:text-foreground", children: item.label }) }, j))) })) : null] }, i));
|
|
120
125
|
}) }) }), actions != null && (_jsx("div", { className: "container-page flex items-center gap-3 py-6", children: actions }))] }) })] }))] })] }));
|
|
121
126
|
}
|
|
@@ -20,7 +20,7 @@ export interface SkeletonProps extends React.ComponentProps<"div"> {
|
|
|
20
20
|
}
|
|
21
21
|
/**
|
|
22
22
|
* Skeleton — a placeholder in `--control-surface` that holds the place of content while it
|
|
23
|
-
* loads, with one soft highlight sweeping across it every 1.6s (
|
|
23
|
+
* loads, with one soft highlight sweeping across it every 1.6s (breathing in opacity under reduced motion).
|
|
24
24
|
*
|
|
25
25
|
* The radius follows what it stands in for: `text` lines are square, `field` is 10px, `button`
|
|
26
26
|
* is 12px, `circle` is round, `card` is 20px. Skeletons are `aria-hidden`; announce loading on
|
|
@@ -17,7 +17,7 @@ const skeletonShapes = {
|
|
|
17
17
|
};
|
|
18
18
|
/**
|
|
19
19
|
* Skeleton — a placeholder in `--control-surface` that holds the place of content while it
|
|
20
|
-
* loads, with one soft highlight sweeping across it every 1.6s (
|
|
20
|
+
* loads, with one soft highlight sweeping across it every 1.6s (breathing in opacity under reduced motion).
|
|
21
21
|
*
|
|
22
22
|
* The radius follows what it stands in for: `text` lines are square, `field` is 10px, `button`
|
|
23
23
|
* is 12px, `circle` is round, `card` is 20px. Skeletons are `aria-hidden`; announce loading on
|