@zonsh/ui 0.2.0 → 0.4.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/LICENSE +22 -0
- package/README.md +19 -13
- package/dist/components/alert-dialog.js +1 -1
- package/dist/components/ascii-field.d.ts +1 -1
- package/dist/components/bottom-nav.d.ts +86 -0
- package/dist/components/bottom-nav.js +175 -0
- package/dist/components/breadcrumb.d.ts +9 -0
- package/dist/components/breadcrumb.js +6 -1
- package/dist/components/button-group.d.ts +1 -1
- package/dist/components/button-group.js +2 -2
- package/dist/components/calendar.d.ts +1 -1
- package/dist/components/calendar.js +18 -3
- package/dist/components/carousel.d.ts +22 -3
- package/dist/components/carousel.js +25 -7
- package/dist/components/chart.d.ts +9 -0
- package/dist/components/chart.js +40 -3
- package/dist/components/code-block.d.ts +20 -10
- package/dist/components/code-block.js +54 -12
- package/dist/components/collapsible.js +2 -2
- package/dist/components/color-picker.d.ts +30 -8
- package/dist/components/color-picker.js +48 -27
- package/dist/components/combobox.d.ts +21 -3
- package/dist/components/combobox.js +79 -7
- package/dist/components/command.d.ts +23 -3
- package/dist/components/command.js +61 -16
- package/dist/components/conversation.d.ts +10 -1
- package/dist/components/conversation.js +14 -4
- package/dist/components/copy-button.d.ts +15 -6
- package/dist/components/copy-button.js +20 -5
- package/dist/components/data-table.d.ts +66 -6
- package/dist/components/data-table.js +376 -23
- package/dist/components/date-picker.d.ts +73 -4
- package/dist/components/date-picker.js +138 -7
- package/dist/components/dialog.d.ts +10 -1
- package/dist/components/dialog.js +6 -3
- package/dist/components/drawer.d.ts +10 -1
- package/dist/components/drawer.js +6 -3
- package/dist/components/feature-list.js +2 -2
- package/dist/components/field.d.ts +27 -8
- package/dist/components/field.js +49 -4
- package/dist/components/file-drop.d.ts +26 -4
- package/dist/components/file-drop.js +125 -64
- package/dist/components/filter-bar.d.ts +50 -3
- package/dist/components/filter-bar.js +71 -33
- package/dist/components/form.d.ts +4 -2
- package/dist/components/form.js +24 -2
- package/dist/components/graph.d.ts +41 -0
- package/dist/components/graph.js +84 -45
- package/dist/components/illustration.js +1 -1
- package/dist/components/input-group.d.ts +16 -5
- package/dist/components/input-group.js +35 -15
- package/dist/components/input.d.ts +2 -2
- package/dist/components/input.js +3 -3
- package/dist/components/kbd.d.ts +17 -0
- package/dist/components/kbd.js +8 -1
- package/dist/components/lightbox.d.ts +100 -0
- package/dist/components/lightbox.js +439 -0
- package/dist/components/locale.d.ts +44 -0
- package/dist/components/locale.js +37 -0
- package/dist/components/logo.js +1 -1
- package/dist/components/menu.js +3 -1
- package/dist/components/message.d.ts +3 -3
- package/dist/components/message.js +10 -7
- package/dist/components/meter.js +3 -1
- package/dist/components/money-input.d.ts +80 -0
- package/dist/components/money-input.js +253 -0
- package/dist/components/number-field.d.ts +21 -2
- package/dist/components/number-field.js +27 -16
- package/dist/components/otp-field.d.ts +14 -1
- package/dist/components/otp-field.js +10 -2
- package/dist/components/pagination.d.ts +13 -7
- package/dist/components/pagination.js +18 -7
- package/dist/components/pdf-viewer.d.ts +67 -2
- package/dist/components/pdf-viewer.js +88 -21
- package/dist/components/phone-input.d.ts +79 -0
- package/dist/components/phone-input.js +282 -0
- package/dist/components/popover.js +1 -1
- package/dist/components/progress.js +3 -1
- package/dist/components/prompt-input.d.ts +34 -9
- package/dist/components/prompt-input.js +28 -16
- package/dist/components/rating.d.ts +73 -0
- package/dist/components/rating.js +124 -0
- package/dist/components/reasoning.d.ts +16 -1
- package/dist/components/reasoning.js +10 -7
- package/dist/components/resizable.d.ts +10 -1
- package/dist/components/resizable.js +4 -1
- package/dist/components/response.d.ts +14 -3
- package/dist/components/response.js +36 -8
- package/dist/components/scroll-area.d.ts +1 -1
- package/dist/components/select.js +14 -3
- package/dist/components/separator.js +1 -1
- package/dist/components/sidebar.d.ts +20 -4
- package/dist/components/sidebar.js +34 -18
- package/dist/components/site-header.d.ts +46 -12
- package/dist/components/site-header.js +73 -19
- package/dist/components/slider.js +3 -1
- package/dist/components/sortable.d.ts +178 -0
- package/dist/components/sortable.js +1258 -0
- package/dist/components/sources.d.ts +17 -2
- package/dist/components/sources.js +11 -4
- package/dist/components/spinner.d.ts +13 -1
- package/dist/components/spinner.js +5 -2
- package/dist/components/stat.d.ts +91 -0
- package/dist/components/stat.js +141 -0
- package/dist/components/stepper.d.ts +71 -0
- package/dist/components/stepper.js +101 -0
- package/dist/components/switch.d.ts +2 -2
- package/dist/components/switch.js +2 -2
- package/dist/components/table.d.ts +12 -2
- package/dist/components/table.js +176 -39
- package/dist/components/tags-input.d.ts +18 -2
- package/dist/components/tags-input.js +65 -33
- package/dist/components/theme.d.ts +16 -2
- package/dist/components/theme.js +15 -7
- package/dist/components/time-field.d.ts +22 -3
- package/dist/components/time-field.js +19 -6
- package/dist/components/timeline.d.ts +18 -2
- package/dist/components/timeline.js +13 -4
- package/dist/components/tippy.d.ts +48 -0
- package/dist/components/tippy.js +648 -0
- package/dist/components/toast.d.ts +18 -2
- package/dist/components/toast.js +12 -3
- package/dist/components/tool-call.d.ts +19 -8
- package/dist/components/tool-call.js +18 -7
- package/dist/components/toolbar.js +6 -1
- package/dist/components/tour.d.ts +127 -0
- package/dist/components/tour.js +648 -0
- package/dist/components/tree.js +17 -4
- package/dist/components/video-player.d.ts +10 -2
- package/dist/components/video-player.js +73 -33
- package/dist/illustration.d.ts +2 -0
- package/dist/illustration.js +7 -0
- package/dist/index.d.ts +11 -3
- package/dist/index.js +11 -3
- package/dist/lib/code-highlight.d.ts +3 -16
- package/dist/lib/code-highlight.js +160 -10
- package/dist/lib/code-theme.js +3 -3
- package/dist/lib/digit-roll.js +8 -8
- package/dist/lib/field-errors.d.ts +28 -0
- package/dist/lib/field-errors.js +24 -0
- package/dist/lib/field-value.d.ts +13 -0
- package/dist/lib/field-value.js +44 -0
- package/dist/lib/graph-layout.js +11 -2
- package/dist/lib/money.d.ts +73 -0
- package/dist/lib/money.js +343 -0
- package/dist/lib/phone-countries.d.ts +1 -0
- package/dist/lib/phone-countries.js +281 -0
- package/dist/lib/phone.d.ts +90 -0
- package/dist/lib/phone.js +286 -0
- package/dist/lib/platform.d.ts +8 -3
- package/dist/lib/platform.js +13 -6
- package/dist/lib/row-index.d.ts +15 -0
- package/dist/lib/row-index.js +136 -0
- package/dist/lib/table-fit.js +23 -4
- package/dist/lib/theme-script.d.ts +15 -2
- package/dist/lib/theme-script.js +23 -3
- package/dist/lib/tippy/pixels.d.ts +47 -0
- package/dist/lib/tippy/pixels.js +187 -0
- package/dist/lib/tippy/sprite.d.ts +86 -0
- package/dist/lib/tippy/sprite.js +753 -0
- package/dist/messages/de.d.ts +12 -0
- package/dist/messages/de.js +326 -0
- package/dist/styles/expressive.css +20 -5
- package/dist/styles/index.css +3 -2
- package/dist/styles/material.css +7 -3
- package/dist/styles/parts/ai.css +2 -1
- package/dist/styles/parts/controls.css +62 -13
- package/dist/styles/parts/feedback.css +68 -1
- package/dist/styles/parts/foundations.css +1 -1
- package/dist/styles/parts/navigation.css +194 -2
- package/dist/styles/parts/overlays.css +7 -7
- package/dist/styles/tokens.css +12 -3
- package/dist/vite.d.ts +0 -50
- package/dist/vite.js +0 -100
- package/package.json +28 -33
- package/dist/components/code-highlight.d.ts +0 -13
- package/dist/components/code-highlight.js +0 -107
- package/dist/components/whiteboard.d.ts +0 -80
- package/dist/components/whiteboard.js +0 -389
- package/dist/styles/parts/whiteboard.css +0 -855
|
@@ -0,0 +1,124 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
|
+
import { Radio as BaseRadio } from "@base-ui/react/radio";
|
|
4
|
+
import { RadioGroup as BaseRadioGroup } from "@base-ui/react/radio-group";
|
|
5
|
+
import { StarIcon } from "lucide-react";
|
|
6
|
+
import * as React from "react";
|
|
7
|
+
import { cn } from "../lib/cn.js";
|
|
8
|
+
import { useLocale, useMessages } from "./locale.js";
|
|
9
|
+
const defaultMessages = {
|
|
10
|
+
item: (value, count) => (count === 1 ? `${value} star` : `${value} stars`),
|
|
11
|
+
value: (value, max) => `${value} out of ${max}`,
|
|
12
|
+
empty: "Not rated",
|
|
13
|
+
};
|
|
14
|
+
const sizes = {
|
|
15
|
+
sm: { row: "h-(--control-h-sm)", item: "px-px", icon: "size-4" },
|
|
16
|
+
default: { row: "h-(--control-h)", item: "px-0.5", icon: "size-5" },
|
|
17
|
+
lg: { row: "h-(--control-h-lg)", item: "px-0.5", icon: "size-6" },
|
|
18
|
+
};
|
|
19
|
+
function useControllable(value, defaultValue) {
|
|
20
|
+
const [inner, setInner] = React.useState(defaultValue);
|
|
21
|
+
const controlled = value !== undefined;
|
|
22
|
+
return [controlled ? value : inner, setInner];
|
|
23
|
+
}
|
|
24
|
+
/** One star: the outline, with the filled star over it clipped to `fill` (0…1) from the start. */
|
|
25
|
+
function Star({ icon, fill, size, preview, }) {
|
|
26
|
+
const iconClass = cn(sizes[size].icon, "shrink-0");
|
|
27
|
+
return (_jsxs("span", { "aria-hidden": true, className: "relative flex", children: [React.cloneElement(icon, {
|
|
28
|
+
className: cn(iconClass, "text-control-muted transition-colors duration-(--duration) ease-(--ease)", "group-data-invalid/rating:text-destructive"),
|
|
29
|
+
strokeWidth: 1.5,
|
|
30
|
+
}), fill > 0 && (_jsx("span", { "data-slot": "rating-fill", className: cn("absolute inset-y-0 start-0 flex overflow-hidden transition-colors duration-(--duration) ease-(--ease)", preview ? "text-foreground-soft" : "text-foreground"), style: { width: `${Math.round(fill * 100)}%` }, children: React.cloneElement(icon, { className: iconClass, fill: "currentColor", strokeWidth: 1.5 }) }))] }));
|
|
31
|
+
}
|
|
32
|
+
/**
|
|
33
|
+
* Rating — a score of 1 to 5 (or `max`) as a row of stars, in the foreground ink.
|
|
34
|
+
*
|
|
35
|
+
* A radio group under the hood: arrow keys move the rating and pick it, a pointer previews the
|
|
36
|
+
* stars it would set, and with `allowHalf` each star takes two picks. In a `Field` it submits
|
|
37
|
+
* its number under the field's name and takes `required` and the Field's invalid state. With
|
|
38
|
+
* `readOnly` it is a picture of a score, read out as "4.5 out of 5".
|
|
39
|
+
*
|
|
40
|
+
* The rule people break: yellow stars. The stars are ink like every other mark; a rating is a
|
|
41
|
+
* value, not a status. And put the count next to an average ("4.5 · 128 reviews"): five stars
|
|
42
|
+
* from one review is not the same thing.
|
|
43
|
+
*/
|
|
44
|
+
export function Rating({ value: valueProp, defaultValue = null, onValueChange, max: maxProp = 5, allowHalf = false, clearable = false, readOnly = false, disabled, size = "default", icon = _jsx(StarIcon, {}), labels, className, ref, onKeyDown, ...props }) {
|
|
45
|
+
const text = useMessages("rating", defaultMessages, labels);
|
|
46
|
+
const locale = useLocale();
|
|
47
|
+
const number = React.useMemo(() => {
|
|
48
|
+
try {
|
|
49
|
+
return new Intl.NumberFormat(locale, { maximumFractionDigits: 2 });
|
|
50
|
+
}
|
|
51
|
+
catch {
|
|
52
|
+
return new Intl.NumberFormat("en", { maximumFractionDigits: 2 });
|
|
53
|
+
}
|
|
54
|
+
}, [locale]);
|
|
55
|
+
const max = Math.max(1, Math.floor(maxProp));
|
|
56
|
+
const [value, setValue] = useControllable(valueProp, defaultValue);
|
|
57
|
+
const [hover, setHover] = React.useState(null);
|
|
58
|
+
const pressedChecked = React.useRef(false);
|
|
59
|
+
const id = React.useId();
|
|
60
|
+
const commit = (next) => {
|
|
61
|
+
if (next === value)
|
|
62
|
+
return;
|
|
63
|
+
setValue(next);
|
|
64
|
+
onValueChange?.(next);
|
|
65
|
+
};
|
|
66
|
+
// A form's reset puts an uncontrolled rating back where it started.
|
|
67
|
+
const latestReset = React.useRef(() => { });
|
|
68
|
+
latestReset.current = () => {
|
|
69
|
+
if (valueProp === undefined)
|
|
70
|
+
setValue(defaultValue);
|
|
71
|
+
};
|
|
72
|
+
const formRef = React.useCallback((node) => {
|
|
73
|
+
const form = node?.closest("form");
|
|
74
|
+
if (!form)
|
|
75
|
+
return;
|
|
76
|
+
const reset = () => latestReset.current();
|
|
77
|
+
form.addEventListener("reset", reset);
|
|
78
|
+
return () => form.removeEventListener("reset", reset);
|
|
79
|
+
}, []);
|
|
80
|
+
const refs = React.useCallback((node) => {
|
|
81
|
+
const cleanup = formRef(node);
|
|
82
|
+
if (typeof ref === "function")
|
|
83
|
+
ref(node);
|
|
84
|
+
else if (ref)
|
|
85
|
+
ref.current = node;
|
|
86
|
+
return () => {
|
|
87
|
+
cleanup?.();
|
|
88
|
+
if (typeof ref === "function")
|
|
89
|
+
ref(null);
|
|
90
|
+
else if (ref)
|
|
91
|
+
ref.current = null;
|
|
92
|
+
};
|
|
93
|
+
}, [formRef, ref]);
|
|
94
|
+
const shown = hover ?? value ?? 0;
|
|
95
|
+
const stars = Array.from({ length: max }, (_, i) => i + 1);
|
|
96
|
+
if (readOnly) {
|
|
97
|
+
const v = value == null ? null : Math.min(Math.max(value, 0), max);
|
|
98
|
+
// What only a radio group takes (a name, a form) has no place on a picture of a score.
|
|
99
|
+
const { name: _name, required: _required, form: _form, inputRef: _inputRef, render: _render, style, ...rest } = props;
|
|
100
|
+
return (_jsx("span", { ref: refs, role: "img", "aria-label": v == null ? text.empty : text.value(number.format(v), number.format(max)), "data-slot": "rating", "data-size": size, "data-readonly": "", className: cn("inline-flex shrink-0 items-center", sizes[size].row, className), style: typeof style === "function" ? undefined : style, ...rest, children: stars.map((star) => (_jsx("span", { "data-slot": "rating-item", className: cn("flex shrink-0", sizes[size].item), children: _jsx(Star, { icon: icon, fill: Math.min(Math.max((v ?? 0) - (star - 1), 0), 1), size: size, preview: false }) }, star))) }));
|
|
101
|
+
}
|
|
102
|
+
const choicesOf = (star) => (allowHalf ? [star - 0.5, star] : [star]);
|
|
103
|
+
return (_jsx(BaseRadioGroup, { ref: refs, "data-slot": "rating", "data-size": size, value: value, onValueChange: (next) => commit(next), disabled: disabled, onKeyDown: (event) => {
|
|
104
|
+
onKeyDown?.(event);
|
|
105
|
+
if (clearable && (event.key === "Backspace" || event.key === "Delete") && value != null) {
|
|
106
|
+
event.preventDefault();
|
|
107
|
+
commit(null);
|
|
108
|
+
}
|
|
109
|
+
}, onPointerLeave: () => setHover(null), className: (state) => cn("group/rating inline-flex shrink-0 items-center", "data-disabled:cursor-not-allowed data-disabled:opacity-55", sizes[size].row, typeof className === "function" ? className(state) : className), ...props, children: stars.map((star) => {
|
|
110
|
+
const fill = Math.min(Math.max(shown - (star - 1), 0), 1);
|
|
111
|
+
return (_jsxs("span", { "data-slot": "rating-item", className: cn("relative flex h-full shrink-0 items-center rounded-item", "has-[[data-slot=rating-radio]:focus-visible]:outline-2 has-[[data-slot=rating-radio]:focus-visible]:outline-control-focus has-[[data-slot=rating-radio]:focus-visible]:outline-solid", sizes[size].item), children: [_jsx(Star, { icon: icon, fill: fill, size: size, preview: hover != null && hover !== value }), choicesOf(star).map((choice, i, all) => {
|
|
112
|
+
const labelId = `${id}-${choice}`;
|
|
113
|
+
return (_jsxs(React.Fragment, { children: [_jsx("span", { id: labelId, className: "sr-only", children: text.item(number.format(choice), choice) }), _jsx(BaseRadio.Root, { value: choice, "data-slot": "rating-radio", "aria-labelledby": labelId, onPointerDown: () => (pressedChecked.current = choice === value), onPointerMove: (event) => {
|
|
114
|
+
if (event.pointerType === "mouse" && !disabled)
|
|
115
|
+
setHover(choice);
|
|
116
|
+
}, onClick: () => {
|
|
117
|
+
if (clearable && pressedChecked.current && choice === value) {
|
|
118
|
+
pressedChecked.current = false;
|
|
119
|
+
commit(null);
|
|
120
|
+
}
|
|
121
|
+
}, className: cn("absolute inset-y-0 cursor-pointer outline-none data-disabled:cursor-not-allowed", all.length === 1 ? "inset-x-0" : i === 0 ? "start-0 w-1/2" : "end-0 w-1/2") })] }, choice));
|
|
122
|
+
})] }, star));
|
|
123
|
+
}) }));
|
|
124
|
+
}
|
|
@@ -1,6 +1,19 @@
|
|
|
1
1
|
import type { Collapsible as BaseCollapsible } from "@base-ui/react/collapsible";
|
|
2
2
|
import * as React from "react";
|
|
3
3
|
import { type CollapsibleTriggerProps } from "./collapsible.js";
|
|
4
|
+
export interface ReasoningMessages {
|
|
5
|
+
/** While the model thinks. */
|
|
6
|
+
thinking: string;
|
|
7
|
+
/** Done, when the time is not known. */
|
|
8
|
+
thoughtBriefly: string;
|
|
9
|
+
/** Done, after `seconds` seconds. */
|
|
10
|
+
thoughtFor: (seconds: number) => string;
|
|
11
|
+
}
|
|
12
|
+
declare module "./locale" {
|
|
13
|
+
interface Messages {
|
|
14
|
+
reasoning: ReasoningMessages;
|
|
15
|
+
}
|
|
16
|
+
}
|
|
4
17
|
export interface ReasoningProps extends BaseCollapsible.Root.Props {
|
|
5
18
|
/** The model is thinking right now: the label shimmers and the panel opens. */
|
|
6
19
|
streaming?: boolean;
|
|
@@ -18,12 +31,14 @@ export interface ReasoningProps extends BaseCollapsible.Root.Props {
|
|
|
18
31
|
*/
|
|
19
32
|
export declare function Reasoning({ streaming, duration: durationProp, open: openProp, defaultOpen, onOpenChange, className, ...props }: ReasoningProps): React.JSX.Element;
|
|
20
33
|
export interface ReasoningTriggerProps extends Omit<CollapsibleTriggerProps, "showIcon"> {
|
|
34
|
+
/** The default label's words; a LocaleProvider sets them for every ReasoningTrigger. */
|
|
35
|
+
labels?: Partial<ReasoningMessages>;
|
|
21
36
|
}
|
|
22
37
|
/**
|
|
23
38
|
* The trigger: a brain, the label and a chevron, in mono. Children replace the label;
|
|
24
39
|
* the default reads "Thinking…", then "Thought for n seconds".
|
|
25
40
|
*/
|
|
26
|
-
export declare function ReasoningTrigger({ className, children, ...props }: ReasoningTriggerProps): React.JSX.Element;
|
|
41
|
+
export declare function ReasoningTrigger({ labels, className, children, ...props }: ReasoningTriggerProps): React.JSX.Element;
|
|
27
42
|
/**
|
|
28
43
|
* The reasoning itself, muted and set in from a hairline. Plain text keeps its line breaks;
|
|
29
44
|
* a `Response` inside renders markdown.
|
|
@@ -4,6 +4,12 @@ import { BrainIcon, ChevronDownIcon } from "lucide-react";
|
|
|
4
4
|
import * as React from "react";
|
|
5
5
|
import { cn, sx } from "../lib/cn.js";
|
|
6
6
|
import { Collapsible, CollapsiblePanel, CollapsibleTrigger, } from "./collapsible.js";
|
|
7
|
+
import { useMessages } from "./locale.js";
|
|
8
|
+
const defaultMessages = {
|
|
9
|
+
thinking: "Thinking…",
|
|
10
|
+
thoughtBriefly: "Thought for a few seconds",
|
|
11
|
+
thoughtFor: (seconds) => `Thought for ${seconds} ${seconds === 1 ? "second" : "seconds"}`,
|
|
12
|
+
};
|
|
7
13
|
const ReasoningContext = React.createContext({
|
|
8
14
|
streaming: false,
|
|
9
15
|
duration: undefined,
|
|
@@ -51,14 +57,11 @@ export function Reasoning({ streaming = false, duration: durationProp, open: ope
|
|
|
51
57
|
* The trigger: a brain, the label and a chevron, in mono. Children replace the label;
|
|
52
58
|
* the default reads "Thinking…", then "Thought for n seconds".
|
|
53
59
|
*/
|
|
54
|
-
export function ReasoningTrigger({ className, children, ...props }) {
|
|
60
|
+
export function ReasoningTrigger({ labels, className, children, ...props }) {
|
|
55
61
|
const { streaming, duration } = React.useContext(ReasoningContext);
|
|
62
|
+
const text = useMessages("reasoning", defaultMessages, labels);
|
|
56
63
|
const label = children ??
|
|
57
|
-
(streaming
|
|
58
|
-
? "Thinking…"
|
|
59
|
-
: duration == null
|
|
60
|
-
? "Thought for a few seconds"
|
|
61
|
-
: `Thought for ${duration} ${duration === 1 ? "second" : "seconds"}`);
|
|
64
|
+
(streaming ? text.thinking : duration == null ? text.thoughtBriefly : text.thoughtFor(duration));
|
|
62
65
|
return (_jsxs(CollapsibleTrigger, { "data-slot": "reasoning-trigger", showIcon: false, className: sx("gap-1.5 text-muted-foreground", className), ...props, children: [_jsx(BrainIcon, { "aria-hidden": true, className: "size-3.5 shrink-0" }), _jsx("span", { "data-slot": "reasoning-label", "data-streaming": streaming ? "" : undefined, children: label }), _jsx(ChevronDownIcon, { "aria-hidden": true, className: "size-3.5 shrink-0 transition-[rotate] duration-(--duration) ease-(--ease) group-data-panel-open/collapsible-trigger:rotate-180" })] }));
|
|
63
66
|
}
|
|
64
67
|
/**
|
|
@@ -66,5 +69,5 @@ export function ReasoningTrigger({ className, children, ...props }) {
|
|
|
66
69
|
* a `Response` inside renders markdown.
|
|
67
70
|
*/
|
|
68
71
|
export function ReasoningContent({ className, children, ...props }) {
|
|
69
|
-
return (_jsx(CollapsiblePanel, { "data-slot": "reasoning-content", children: _jsx("div", { className: cn("
|
|
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 }) }));
|
|
70
73
|
}
|
|
@@ -1,5 +1,14 @@
|
|
|
1
1
|
import * as React from "react";
|
|
2
2
|
import { type GroupProps, type PanelProps, type SeparatorProps } from "react-resizable-panels";
|
|
3
|
+
export interface ResizableMessages {
|
|
4
|
+
/** The handle's name, when it has no `aria-label` of its own. */
|
|
5
|
+
handle: string;
|
|
6
|
+
}
|
|
7
|
+
declare module "./locale" {
|
|
8
|
+
interface Messages {
|
|
9
|
+
resizable: ResizableMessages;
|
|
10
|
+
}
|
|
11
|
+
}
|
|
3
12
|
export interface ResizablePanelGroupProps extends GroupProps {
|
|
4
13
|
/** `horizontal` lays panels side by side (a vertical handle); `vertical` stacks them. */
|
|
5
14
|
orientation?: "horizontal" | "vertical";
|
|
@@ -27,7 +36,7 @@ export declare function ResizablePanel({ className, ...props }: ResizablePanelPr
|
|
|
27
36
|
export interface ResizableHandleProps extends SeparatorProps {
|
|
28
37
|
/** Show a small raised grip with mono dots in the middle of the hairline. */
|
|
29
38
|
withHandle?: boolean;
|
|
30
|
-
/** Accessible name of the separator. Defaults to "Resize". */
|
|
39
|
+
/** Accessible name of the separator. Defaults to "Resize", or `messages.resizable.handle`. */
|
|
31
40
|
"aria-label"?: string;
|
|
32
41
|
}
|
|
33
42
|
/**
|
|
@@ -3,6 +3,8 @@ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
|
3
3
|
import * as React from "react";
|
|
4
4
|
import { Group, Panel, Separator, } from "react-resizable-panels";
|
|
5
5
|
import { cn } from "../lib/cn.js";
|
|
6
|
+
import { useMessages } from "./locale.js";
|
|
7
|
+
const defaultMessages = { handle: "Resize" };
|
|
6
8
|
const OrientationContext = React.createContext("horizontal");
|
|
7
9
|
/**
|
|
8
10
|
* ResizablePanelGroup — split panes the user can resize: an editor beside its preview, a list
|
|
@@ -33,7 +35,8 @@ export function ResizablePanel({ className, ...props }) {
|
|
|
33
35
|
*/
|
|
34
36
|
export function ResizableHandle({ withHandle = false, className, children, ...props }) {
|
|
35
37
|
const orientation = React.useContext(OrientationContext);
|
|
36
|
-
|
|
38
|
+
const text = useMessages("resizable", defaultMessages);
|
|
39
|
+
return (_jsxs(Separator, { "data-slot": "resizable-handle", "data-orientation": orientation, "aria-label": text.handle, className: cn("group/handle relative z-10 flex shrink-0 items-center justify-center bg-border outline-none", "transition-[background-color] duration-(--duration) ease-brand", orientation === "horizontal" ? "w-px self-stretch" : "h-px w-full", "data-[separator=active]:bg-control-focus data-[separator=focus]:bg-control-focus data-[separator=hover]:bg-control-focus",
|
|
37
40
|
// The visible line is 1px; the focus outline is drawn on a 3px band so it stays legible.
|
|
38
41
|
"focus-visible:outline-none focus-visible:after:absolute focus-visible:after:bg-control-focus focus-visible:after:content-['']", orientation === "horizontal"
|
|
39
42
|
? "focus-visible:after:inset-y-0 focus-visible:after:left-1/2 focus-visible:after:w-[2px] focus-visible:after:-translate-x-1/2"
|
|
@@ -1,4 +1,15 @@
|
|
|
1
1
|
import * as React from "react";
|
|
2
|
+
export interface ResponseMessages {
|
|
3
|
+
/** A task list item's ticked box. */
|
|
4
|
+
done: string;
|
|
5
|
+
/** A task list item's empty box. */
|
|
6
|
+
todo: string;
|
|
7
|
+
}
|
|
8
|
+
declare module "./locale" {
|
|
9
|
+
interface Messages {
|
|
10
|
+
response: ResponseMessages;
|
|
11
|
+
}
|
|
12
|
+
}
|
|
2
13
|
export interface ResponseProps extends Omit<React.ComponentProps<"div">, "children"> {
|
|
3
14
|
/** The reply, as markdown. */
|
|
4
15
|
children: string;
|
|
@@ -10,15 +21,15 @@ export interface ResponseProps extends Omit<React.ComponentProps<"div">, "childr
|
|
|
10
21
|
*/
|
|
11
22
|
smooth?: boolean;
|
|
12
23
|
/**
|
|
13
|
-
* Colour fenced code by the language its fence names, in the zon theme.
|
|
14
|
-
*
|
|
24
|
+
* Colour fenced code by the language its fence names, in the zon theme. Default `true`; a fence
|
|
25
|
+
* without a language, or one Shiki does not know, stays mono either way.
|
|
15
26
|
*/
|
|
16
27
|
highlight?: boolean;
|
|
17
28
|
}
|
|
18
29
|
/**
|
|
19
30
|
* Response — an assistant's reply, rendered from markdown in the brand's reading type: Licht Sans at
|
|
20
31
|
* 15px, Licht Light headings, mono inline code, hairline tables and rules, and fenced code as a
|
|
21
|
-
* `CodeBlock
|
|
32
|
+
* `CodeBlock`, coloured by its language.
|
|
22
33
|
*
|
|
23
34
|
* While `streaming`, the reply writes itself out evenly at the pace it is arriving, a word at a
|
|
24
35
|
* time, each word coming into focus from a soft blur as it rises into place; half-written
|
|
@@ -5,6 +5,16 @@ import * as React from "react";
|
|
|
5
5
|
import { cn } from "../lib/cn.js";
|
|
6
6
|
import { capNesting, overBudget } from "../lib/markdown-guard.js";
|
|
7
7
|
import { CodeBlock } from "./code-block.js";
|
|
8
|
+
import { useMessages } from "./locale.js";
|
|
9
|
+
const defaultMessages = { done: "Done", todo: "To do" };
|
|
10
|
+
/** The task boxes the renderer writes, named in English (see `checkbox` below). */
|
|
11
|
+
const TASK_BOX = /<input type="checkbox" disabled( checked)? aria-label="(?:Done|To do)">/g;
|
|
12
|
+
/** A block's HTML with its task boxes named in `text`'s words. */
|
|
13
|
+
function nameTaskBoxes(html, text) {
|
|
14
|
+
if (text === defaultMessages || !html.includes('type="checkbox"'))
|
|
15
|
+
return html;
|
|
16
|
+
return html.replace(TASK_BOX, (_, checked) => `<input type="checkbox" disabled${checked ?? ""} aria-label="${escapeHtml(checked ? text.done : text.todo)}">`);
|
|
17
|
+
}
|
|
8
18
|
/* ── Rendering ─────────────────────────────────────────────────────────────── */
|
|
9
19
|
const ESCAPES = {
|
|
10
20
|
"&": "&",
|
|
@@ -299,6 +309,8 @@ const commonPrefix = (a, b) => {
|
|
|
299
309
|
};
|
|
300
310
|
/** How many characters of a text the reveal counts: spaces are left out. */
|
|
301
311
|
const visibleLength = (text) => text.replace(/\s/g, "").length;
|
|
312
|
+
/** Each markdown block's visible length, with the text it was counted from. */
|
|
313
|
+
const blockLengths = new WeakMap();
|
|
302
314
|
const smoothstep = (t) => t * t * (3 - 2 * t);
|
|
303
315
|
const graphemeSegmenter = typeof Intl !== "undefined" && "Segmenter" in Intl
|
|
304
316
|
? new Intl.Segmenter(undefined, { granularity: "grapheme" })
|
|
@@ -363,7 +375,7 @@ function wrapWords(nodes, total, from) {
|
|
|
363
375
|
/**
|
|
364
376
|
* Response — an assistant's reply, rendered from markdown in the brand's reading type: Licht Sans at
|
|
365
377
|
* 15px, Licht Light headings, mono inline code, hairline tables and rules, and fenced code as a
|
|
366
|
-
* `CodeBlock
|
|
378
|
+
* `CodeBlock`, coloured by its language.
|
|
367
379
|
*
|
|
368
380
|
* While `streaming`, the reply writes itself out evenly at the pace it is arriving, a word at a
|
|
369
381
|
* time, each word coming into focus from a soft blur as it rises into place; half-written
|
|
@@ -372,7 +384,7 @@ function wrapWords(nodes, total, from) {
|
|
|
372
384
|
* would take the parser too long shows as plain text.
|
|
373
385
|
* The rule people break: rendering the reply with their own `dangerouslySetInnerHTML` and none of these rules.
|
|
374
386
|
*/
|
|
375
|
-
export function Response({ children, streaming = false, smooth = true, highlight =
|
|
387
|
+
export function Response({ children, streaming = false, smooth = true, highlight = true, className, ...props }) {
|
|
376
388
|
const root = React.useRef(null);
|
|
377
389
|
const [shown, setShown] = React.useState(children.length);
|
|
378
390
|
const pace = React.useRef({
|
|
@@ -495,6 +507,7 @@ export function Response({ children, streaming = false, smooth = true, highlight
|
|
|
495
507
|
const visible = paced ? children.slice(0, limit) : children;
|
|
496
508
|
const live = streaming || visible.length < children.length;
|
|
497
509
|
const blocks = React.useMemo(() => render(visible, live, parsed), [visible, live]);
|
|
510
|
+
const text = useMessages("response", defaultMessages);
|
|
498
511
|
// After each render: count what is on screen, stamp what is new, wrap the new words and paint them.
|
|
499
512
|
React.useLayoutEffect(() => {
|
|
500
513
|
const el = root.current;
|
|
@@ -509,10 +522,19 @@ export function Response({ children, streaming = false, smooth = true, highlight
|
|
|
509
522
|
p.settled = -1;
|
|
510
523
|
return;
|
|
511
524
|
}
|
|
512
|
-
|
|
513
|
-
|
|
514
|
-
|
|
515
|
-
|
|
525
|
+
// Counted block by block, each counted once while its text stays the same: a long reply's
|
|
526
|
+
// settled blocks cost nothing per frame.
|
|
527
|
+
const markdownBlocks = [...el.querySelectorAll(':scope > [data-slot="response-markdown"]')];
|
|
528
|
+
const lengths = markdownBlocks.map((block) => {
|
|
529
|
+
const text = block.textContent ?? "";
|
|
530
|
+
const known = blockLengths.get(block);
|
|
531
|
+
if (known && known.text === text)
|
|
532
|
+
return known.length;
|
|
533
|
+
const length = visibleLength(text);
|
|
534
|
+
blockLengths.set(block, { text, length });
|
|
535
|
+
return length;
|
|
536
|
+
});
|
|
537
|
+
const total = lengths.reduce((sum, length) => sum + length, 0);
|
|
516
538
|
const drawn = p.stamps.at(-1)?.count ?? p.settled;
|
|
517
539
|
// The first frame counted: what is there is already written.
|
|
518
540
|
if (p.settled < 0)
|
|
@@ -527,12 +549,18 @@ export function Response({ children, streaming = false, smooth = true, highlight
|
|
|
527
549
|
}
|
|
528
550
|
if (!p.stamps.length)
|
|
529
551
|
return;
|
|
530
|
-
|
|
552
|
+
// Only the blocks the new words are in.
|
|
553
|
+
const from = Math.max(p.settled, total - BLUR_CHARS);
|
|
554
|
+
let first = markdownBlocks.length;
|
|
555
|
+
for (let tail = 0; first > 0 && tail < total - from;)
|
|
556
|
+
tail += lengths[--first];
|
|
557
|
+
const nodes = markdownBlocks.slice(first).flatMap(textNodes);
|
|
558
|
+
words.current = wrapWords(nodes, total, from);
|
|
531
559
|
paint(performance.now());
|
|
532
560
|
run();
|
|
533
561
|
});
|
|
534
562
|
return (_jsx("div", { ref: root, "data-slot": "response", "data-streaming": live ? "" : undefined, "aria-busy": live || undefined, className: cn("min-w-0 text-[15px] leading-relaxed text-foreground-soft", className), ...props, children: blocks.map((block, index) => block.kind === "code" ? (_jsx(ResponseCode, { code: block.text, language: block.lang, highlight: highlight, className: "my-4 first:mt-0 last:mb-0" }, index)) : (_jsx("div", { "data-slot": "response-markdown", "data-table": block.table ? "" : undefined,
|
|
535
563
|
// A table is a block of its own that scrolls sideways when it is wider than the reply,
|
|
536
564
|
// so its cells never break inside a word. Focusable, so the keyboard can scroll it.
|
|
537
|
-
tabIndex: block.table ? 0 : undefined, className: block.table ? "focus-ring" : "contents", dangerouslySetInnerHTML: { __html: block.html } }, index))) }));
|
|
565
|
+
tabIndex: block.table ? 0 : undefined, className: block.table ? "focus-ring" : "contents", dangerouslySetInnerHTML: { __html: nameTaskBoxes(block.html, text) } }, index))) }));
|
|
538
566
|
}
|
|
@@ -16,7 +16,7 @@ export interface ScrollAreaProps extends BaseScrollArea.Root.Props {
|
|
|
16
16
|
/**
|
|
17
17
|
* Render the viewport as another part, so that part is the element that scrolls: a Select,
|
|
18
18
|
* Combobox or Autocomplete list, which scrolls its highlighted item into view itself. Give it
|
|
19
|
-
* `data-has-overflow-y:
|
|
19
|
+
* `data-has-overflow-y:pe-3` so its rows stop beside the bar instead of running under it.
|
|
20
20
|
*/
|
|
21
21
|
viewportRender?: BaseScrollArea.Viewport.Props["render"];
|
|
22
22
|
}
|
|
@@ -18,8 +18,19 @@ export function Select({ inputRef, ...props }) {
|
|
|
18
18
|
// A form's reset remounts it from its defaults (lib/form-reset); its hidden input finds the form.
|
|
19
19
|
const [resetKey, formRef] = useFormReset();
|
|
20
20
|
const refs = React.useMemo(() => mergeRefs(formRef, inputRef), [formRef, inputRef]);
|
|
21
|
+
const items = props.items;
|
|
22
|
+
const count = Array.isArray(items) ? items.length : items ? Object.keys(items).length : 0;
|
|
23
|
+
if (process.env.NODE_ENV !== "production" && count > MANY_OPTIONS && !warned) {
|
|
24
|
+
warned = true;
|
|
25
|
+
console.warn(`Select: ${count} options. A Select draws every option each time it opens, which takes most of ` +
|
|
26
|
+
"a second from about a thousand. Use a Combobox: people can type to narrow the list, and it " +
|
|
27
|
+
"draws only the options in view.");
|
|
28
|
+
}
|
|
21
29
|
return _jsx(BaseSelect.Root, { inputRef: refs, ...props }, resetKey);
|
|
22
30
|
}
|
|
31
|
+
/** Past this many options, development warns once (see Select). */
|
|
32
|
+
const MANY_OPTIONS = 500;
|
|
33
|
+
let warned = false;
|
|
23
34
|
const triggerSizes = {
|
|
24
35
|
sm: "min-h-(--control-h-sm) px-2.5 text-[13px]",
|
|
25
36
|
default: "min-h-(--control-h) ps-3.5 pe-2.5 text-[15px]",
|
|
@@ -28,7 +39,7 @@ export function SelectTrigger({ size = "default", className, children, ...props
|
|
|
28
39
|
return (_jsxs(BaseSelect.Trigger, { "data-slot": "select-trigger", "data-size": size, className: sx([
|
|
29
40
|
"group/trigger inline-flex w-full min-w-40 material-field cursor-pointer items-center justify-between gap-3 rounded-control font-body leading-none whitespace-nowrap outline-none select-none",
|
|
30
41
|
triggerSizes[size],
|
|
31
|
-
], className), ...props, children: [children, _jsx(BaseSelect.Icon, { className: "flex text-muted-foreground transition-colors group-hover/trigger:not-group-data-disabled/trigger:text-foreground", children: _jsx(ChevronsUpDownIcon, { className: "size-4" }) })] }));
|
|
42
|
+
], className), ...props, children: [children, _jsx(BaseSelect.Icon, { className: "flex text-muted-foreground transition-colors duration-(--duration) ease-(--ease) group-hover/trigger:not-group-data-disabled/trigger:text-foreground", children: _jsx(ChevronsUpDownIcon, { className: "size-4" }) })] }));
|
|
32
43
|
}
|
|
33
44
|
export function SelectValue({ className, ...props }) {
|
|
34
45
|
return (_jsx(BaseSelect.Value, { "data-slot": "select-value", className: sx(["truncate data-placeholder:text-control-muted"], className), ...props }));
|
|
@@ -39,11 +50,11 @@ export function SelectContent({ className, children, alignItemWithTrigger = fals
|
|
|
39
50
|
// As wide as the trigger, or wider for long options — up to 24rem (or the trigger, if
|
|
40
51
|
// wider) and never past the window, so the popup never spans the screen.
|
|
41
52
|
"relative max-w-[min(var(--available-width),max(var(--anchor-width),24rem))] min-w-(--anchor-width) popup-motion overflow-hidden rounded-button material-menu p-1 font-body outline-none",
|
|
42
|
-
], className), ...props, children: [_jsx(BaseSelect.ScrollUpArrow, { className: "
|
|
53
|
+
], className), ...props, children: [_jsx(BaseSelect.ScrollUpArrow, { className: "start-0 top-0 z-1 hidden h-6 w-full cursor-default items-center justify-center bg-control-menu text-muted-foreground data-[side=none]:flex", children: _jsx(ChevronUpIcon, { className: "size-3.5" }) }), _jsx(ScrollArea, { className: "h-full max-h-[calc(var(--available-height)-0.625rem)] in-data-[side=none]:max-h-none", viewportRender: _jsx(BaseSelect.List, { "data-slot": "select-list", role: "listbox", className: "scroll-py-1 data-has-overflow-y:pe-3" }), children: children }), _jsx(BaseSelect.ScrollDownArrow, { className: "start-0 bottom-0 z-1 hidden h-6 w-full cursor-default items-center justify-center bg-control-menu text-muted-foreground data-[side=none]:flex", children: _jsx(ChevronDownIcon, { className: "size-3.5" }) })] }) }) }));
|
|
43
54
|
}
|
|
44
55
|
export function SelectItem({ className, children, ...props }) {
|
|
45
56
|
return (_jsxs(BaseSelect.Item, { "data-slot": "select-item", className: sx([
|
|
46
|
-
"grid min-h-(--control-h) cursor-pointer grid-cols-[1fr_1rem] items-center gap-3 rounded-item border border-transparent
|
|
57
|
+
"grid min-h-(--control-h) cursor-pointer grid-cols-[1fr_1rem] items-center gap-3 rounded-item border border-transparent px-2.5 py-[clamp(0px,calc((var(--control-h)-22px)/2),6px)] text-sm text-foreground-soft outline-none select-none",
|
|
47
58
|
"data-highlighted:border-control-inner-edge data-highlighted:bg-control-hover data-highlighted:text-foreground data-highlighted:shadow-highlight",
|
|
48
59
|
"data-disabled:pointer-events-none data-disabled:opacity-50 data-selected:text-foreground",
|
|
49
60
|
], className), ...props, children: [_jsx(BaseSelect.ItemText, { className: "col-start-1 line-clamp-2 [overflow-wrap:anywhere]", children: children }), _jsx(BaseSelect.ItemIndicator, { className: "col-start-2 flex", children: _jsx(CheckIcon, { className: "size-4" }) })] }));
|
|
@@ -11,7 +11,7 @@ import { sx } from "../lib/cn.js";
|
|
|
11
11
|
*/
|
|
12
12
|
export function Separator({ orientation = "horizontal", label, className, ...props }) {
|
|
13
13
|
if (label != null && orientation === "horizontal") {
|
|
14
|
-
return (_jsx(BaseSeparator, { "data-slot": "separator", "data-labelled": "", orientation: orientation, className: sx("flex w-full items-center gap-4 eyebrow text-[11px] before:h-px before:flex-1 before:bg-border/60 before:content-[''] after:h-px after:flex-1 after:bg-border/60 after:content-['']", className), ...props, children: _jsx("span", { className: "shrink-0", children: label }) }));
|
|
14
|
+
return (_jsx(BaseSeparator, { "data-slot": "separator", "data-labelled": "", "aria-label": typeof label === "string" ? label : undefined, orientation: orientation, className: sx("flex w-full items-center gap-4 eyebrow text-[11px] before:h-px before:flex-1 before:bg-border/60 before:content-[''] after:h-px after:flex-1 after:bg-border/60 after:content-['']", className), ...props, children: _jsx("span", { className: "shrink-0", children: label }) }));
|
|
15
15
|
}
|
|
16
16
|
return (_jsx(BaseSeparator, { "data-slot": "separator", orientation: orientation, className: sx("shrink-0 bg-border/60 data-[orientation=horizontal]:h-px data-[orientation=horizontal]:w-full data-[orientation=vertical]:min-h-4 data-[orientation=vertical]:w-px data-[orientation=vertical]:self-stretch", className), ...props }));
|
|
17
17
|
}
|
|
@@ -3,6 +3,17 @@ import * as React from "react";
|
|
|
3
3
|
import { type ButtonProps } from "./button.js";
|
|
4
4
|
import { type ScrollAreaProps } from "./scroll-area.js";
|
|
5
5
|
import { type SeparatorProps } from "./separator.js";
|
|
6
|
+
export interface SidebarMessages {
|
|
7
|
+
/** The mobile sheet's title, when the sidebar has no `aria-label`. */
|
|
8
|
+
navigation: string;
|
|
9
|
+
/** SidebarTrigger's and SidebarRail's name. */
|
|
10
|
+
toggle: string;
|
|
11
|
+
}
|
|
12
|
+
declare module "./locale" {
|
|
13
|
+
interface Messages {
|
|
14
|
+
sidebar: SidebarMessages;
|
|
15
|
+
}
|
|
16
|
+
}
|
|
6
17
|
/**
|
|
7
18
|
* How the sidebar collapses on desktop. `offcanvas` slides it away entirely, `icon` shrinks it to
|
|
8
19
|
* a rail of 38px icon squares with tooltips, `none` keeps it open. On mobile, `offcanvas` and
|
|
@@ -75,13 +86,18 @@ export interface SidebarProps extends React.ComponentProps<"nav"> {
|
|
|
75
86
|
* button in the header) take the 30px height too.
|
|
76
87
|
*/
|
|
77
88
|
size?: "default" | "sm";
|
|
89
|
+
/**
|
|
90
|
+
* What hovering a row does: `text` (default) only brightens its label; `glide` also lays one
|
|
91
|
+
* soft fill under it that follows the pointer from row to row.
|
|
92
|
+
*/
|
|
93
|
+
hover?: "text" | "glide";
|
|
78
94
|
}
|
|
79
95
|
/**
|
|
80
96
|
* Sidebar — section navigation for docs, settings and dashboards.
|
|
81
97
|
*
|
|
82
98
|
* A `<nav>` of `SidebarGroup`s, each with an eyebrow `SidebarGroupLabel` and 38px
|
|
83
|
-
* `SidebarItem` rows at 12px radius. Rows are flat at rest,
|
|
84
|
-
*
|
|
99
|
+
* `SidebarItem` rows at 12px radius. Rows are flat at rest, only their label brightens on hover
|
|
100
|
+
* (`hover="glide"` adds one soft fill that follows the pointer), and take the raised material when current. The rule people break: marking the current page with a flat fill or
|
|
85
101
|
* a bold weight. Set `current` (it writes `aria-current="page"`) and let the material show it.
|
|
86
102
|
* A sidebar never shows a scrollbar: a long one goes in `<ScrollArea scrollbar={false}>`.
|
|
87
103
|
*
|
|
@@ -89,7 +105,7 @@ export interface SidebarProps extends React.ComponentProps<"nav"> {
|
|
|
89
105
|
* the page by a hairline, holding `SidebarHeader`, `SidebarContent` and `SidebarFooter`. It
|
|
90
106
|
* collapses on desktop and turns into a sheet on mobile.
|
|
91
107
|
*/
|
|
92
|
-
export declare function Sidebar({ side, variant, size, className, children, ...props }: SidebarProps): React.JSX.Element;
|
|
108
|
+
export declare function Sidebar({ side, variant, size, hover, className, children, ...props }: SidebarProps): React.JSX.Element;
|
|
93
109
|
/** The top of an app-shell sidebar: a logo, a workspace switcher, a search row. Never scrolls. */
|
|
94
110
|
export declare function SidebarHeader({ className, ...props }: React.ComponentProps<"div">): React.JSX.Element;
|
|
95
111
|
/** The bottom of an app-shell sidebar: the account, settings, help. Never scrolls. */
|
|
@@ -123,7 +139,7 @@ export interface SidebarItemProps extends useRender.ComponentProps<"a"> {
|
|
|
123
139
|
/**
|
|
124
140
|
* One navigation row. Renders an `<a>`; pass `render={<Link to="…" />}` for router links.
|
|
125
141
|
* Leading icons are 16px; a trailing `Kbd`, `Tag` or `SidebarMenuBadge` is pushed to the end
|
|
126
|
-
* with `
|
|
142
|
+
* with `ms-auto`. In an icon-collapsed app shell it shrinks to a 38px square with a tooltip.
|
|
127
143
|
*/
|
|
128
144
|
export declare function SidebarItem({ current, tooltip, render, ref, className, children, onClick, ...props }: SidebarItemProps): React.JSX.Element;
|
|
129
145
|
/** A count at the end of a row ("12"): mono, tabular, muted. Hidden in the icon rail. */
|