@peerproblem/sw3-ui 0.0.0-stage → 0.3.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/LICENSE +21 -0
- package/README.md +109 -2
- package/agent/components/accordion.md +95 -0
- package/agent/components/action-square.md +106 -0
- package/agent/components/agent-bridge.md +87 -0
- package/agent/components/agent-console.md +123 -0
- package/agent/components/alert-dialog.md +82 -0
- package/agent/components/app-shell.md +105 -0
- package/agent/components/area-chart.md +56 -0
- package/agent/components/async-options.md +47 -0
- package/agent/components/autocomplete.md +69 -0
- package/agent/components/avatar.md +88 -0
- package/agent/components/badge.md +51 -0
- package/agent/components/bar-chart.md +56 -0
- package/agent/components/bar-list.md +49 -0
- package/agent/components/breadcrumbs.md +43 -0
- package/agent/components/button.md +109 -0
- package/agent/components/calendar.md +114 -0
- package/agent/components/canvas.md +105 -0
- package/agent/components/card.md +78 -0
- package/agent/components/carousel.md +113 -0
- package/agent/components/chart-card.md +41 -0
- package/agent/components/chart-surface.md +56 -0
- package/agent/components/checkbox.md +88 -0
- package/agent/components/citation-chip.md +61 -0
- package/agent/components/collapsible.md +69 -0
- package/agent/components/color-picker.md +82 -0
- package/agent/components/combobox.md +104 -0
- package/agent/components/command.md +92 -0
- package/agent/components/dashboard-grid.md +73 -0
- package/agent/components/date-input.md +87 -0
- package/agent/components/date-picker.md +122 -0
- package/agent/components/dialog.md +97 -0
- package/agent/components/donut-chart.md +50 -0
- package/agent/components/drawer.md +101 -0
- package/agent/components/empty-state.md +52 -0
- package/agent/components/field.md +80 -0
- package/agent/components/file-input.md +84 -0
- package/agent/components/hover-card.md +64 -0
- package/agent/components/image-cropper.md +77 -0
- package/agent/components/input.md +49 -0
- package/agent/components/label.md +53 -0
- package/agent/components/line-chart.md +60 -0
- package/agent/components/listbox.md +84 -0
- package/agent/components/map-view.md +104 -0
- package/agent/components/menu.md +117 -0
- package/agent/components/menubar.md +67 -0
- package/agent/components/meter.md +59 -0
- package/agent/components/navigation-menu.md +98 -0
- package/agent/components/number-input.md +81 -0
- package/agent/components/otp-input.md +67 -0
- package/agent/components/pagination.md +80 -0
- package/agent/components/password-input.md +67 -0
- package/agent/components/pill-button.md +116 -0
- package/agent/components/popover.md +85 -0
- package/agent/components/poster-card.md +61 -0
- package/agent/components/preferences.md +92 -0
- package/agent/components/progress.md +63 -0
- package/agent/components/provider.md +47 -0
- package/agent/components/radio.md +91 -0
- package/agent/components/rating.md +66 -0
- package/agent/components/reorder.md +61 -0
- package/agent/components/resizable.md +87 -0
- package/agent/components/scatter-chart.md +49 -0
- package/agent/components/scroll-area.md +81 -0
- package/agent/components/segmented-control.md +56 -0
- package/agent/components/select.md +130 -0
- package/agent/components/separator.md +60 -0
- package/agent/components/shortcuts.md +50 -0
- package/agent/components/sidebar-nav.md +68 -0
- package/agent/components/skeleton.md +58 -0
- package/agent/components/slider.md +79 -0
- package/agent/components/sparkline.md +39 -0
- package/agent/components/squircle.md +58 -0
- package/agent/components/stat.md +58 -0
- package/agent/components/switch.md +48 -0
- package/agent/components/table.md +58 -0
- package/agent/components/tabs.md +108 -0
- package/agent/components/textarea.md +68 -0
- package/agent/components/time-input.md +84 -0
- package/agent/components/timeline.md +91 -0
- package/agent/components/toast.md +85 -0
- package/agent/components/toggle.md +76 -0
- package/agent/components/token-input.md +66 -0
- package/agent/components/toolbar.md +76 -0
- package/agent/components/tooltip.md +83 -0
- package/agent/components/tracker.md +47 -0
- package/agent/components/tree.md +87 -0
- package/agent/components/treemap.md +72 -0
- package/agent/components/trend-chart.md +80 -0
- package/agent/components/trigger-menu.md +67 -0
- package/agent/components/typography.md +51 -0
- package/agent/components/waterfall.md +78 -0
- package/agent/components/week-schedule.md +113 -0
- package/agent/llms/actions-and-layout.txt +1749 -0
- package/agent/llms/agents.txt +505 -0
- package/agent/llms/charts.txt +778 -0
- package/agent/llms/dashboards.txt +457 -0
- package/agent/llms/extend.txt +132 -0
- package/agent/llms/extras.txt +527 -0
- package/agent/llms/forms.txt +2152 -0
- package/agent/llms/foundations.txt +674 -0
- package/agent/llms/hooks.txt +178 -0
- package/agent/llms/maps.txt +229 -0
- package/agent/llms/overlays-and-navigation.txt +1167 -0
- package/agent/llms-full.txt +8717 -0
- package/agent/llms.txt +145 -0
- package/agent/registry.json +11289 -0
- package/agent/tokens.md +66 -0
- package/dist/agent/index.d.ts +235 -0
- package/dist/agent/index.js +21 -0
- package/dist/card-Ipm-Cj5f.d.ts +490 -0
- package/dist/charts/index.d.ts +289 -0
- package/dist/charts/index.js +815 -0
- package/dist/check/cli.d.ts +1 -0
- package/dist/check/cli.js +48 -0
- package/dist/check/rendered.d.ts +11 -0
- package/dist/check/rendered.js +77 -0
- package/dist/check/source.d.ts +13 -0
- package/dist/check/source.js +182 -0
- package/dist/chunk-3DXBM65D.js +65 -0
- package/dist/chunk-3H5X4ZP6.js +55 -0
- package/dist/chunk-6XC4BC5C.js +92 -0
- package/dist/chunk-7H6TEAWD.js +507 -0
- package/dist/chunk-I63ZTJOI.js +1089 -0
- package/dist/chunk-JCIRUM4W.js +33 -0
- package/dist/chunk-LTBEHZ3P.js +25 -0
- package/dist/chunk-QDPPLO4U.js +60 -0
- package/dist/chunk-U2XFBPU4.js +56 -0
- package/dist/chunk-UY2WH5AY.js +681 -0
- package/dist/extras.d.ts +203 -0
- package/dist/extras.js +904 -0
- package/dist/icons-BJiGEAnU.d.ts +68 -0
- package/dist/index.d.ts +3737 -0
- package/dist/index.js +14477 -0
- package/dist/map/index.d.ts +115 -0
- package/dist/map/index.js +394 -0
- package/dist/meta/index.d.ts +3314 -0
- package/dist/meta/index.js +5106 -0
- package/dist/rules-1RIZ_JZr.d.ts +38 -0
- package/dist/styles.css +4037 -0
- package/dist/themes/calm.css +42 -0
- package/dist/themes/frost.css +40 -0
- package/package.json +142 -4
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,3737 @@
|
|
|
1
|
+
import * as react from 'react';
|
|
2
|
+
import { ReactNode, HTMLAttributes, InputHTMLAttributes, AnchorHTMLAttributes, Ref, RefObject, CSSProperties, KeyboardEvent as KeyboardEvent$1, LabelHTMLAttributes, TextareaHTMLAttributes, ButtonHTMLAttributes, ReactElement, MouseEvent, ImgHTMLAttributes, TimeHTMLAttributes, PointerEvent } from 'react';
|
|
3
|
+
import { HTMLMotionProps, Transition, Variants } from 'motion/react';
|
|
4
|
+
import { R as RadiusValue, S as SmoothingValue, C as CardProps } from './card-Ipm-Cj5f.js';
|
|
5
|
+
export { a as Card, b as CardContent, c as CardDescription, d as CardFooter, e as CardHeader, f as CardPadding, g as CardTitle, h as CardVariant, i as ColorToken, F as FrameContext, j as RadiusToken, k as SmoothingToken, l as Squircle, m as SquircleLayers, n as SquircleOptions, o as SquirclePaths, p as SquircleProps, T as Tokens, q as cx, r as resolveRadius, s as resolveSmoothing, t as tokens, u as useSquircle } from './card-Ipm-Cj5f.js';
|
|
6
|
+
import { I as IconName } from './icons-BJiGEAnU.js';
|
|
7
|
+
export { a as Icon, b as IconProps, R as Recipe, V as VariantProps, d as defineVariants } from './icons-BJiGEAnU.js';
|
|
8
|
+
import * as _floating_ui_react_dom from '@floating-ui/react-dom';
|
|
9
|
+
import { Placement } from '@floating-ui/react-dom';
|
|
10
|
+
export { Placement } from '@floating-ui/react-dom';
|
|
11
|
+
import { Agent, AgentStep, ActResult } from './agent/index.js';
|
|
12
|
+
export { AgentBindingSpec, AgentItem, isAgentChange, useAgentBinding } from './agent/index.js';
|
|
13
|
+
|
|
14
|
+
type Theme = 'light' | 'dark' | 'system';
|
|
15
|
+
interface SwProviderProps {
|
|
16
|
+
children: ReactNode;
|
|
17
|
+
/** Sets `data-theme` on <html>. `system` follows the OS. */
|
|
18
|
+
theme?: Theme;
|
|
19
|
+
/** Respect the OS "reduce motion" setting (default) or force it. */
|
|
20
|
+
reducedMotion?: 'user' | 'always' | 'never';
|
|
21
|
+
}
|
|
22
|
+
/** Wrap your app once. Sets the theme and motion defaults for every component. */
|
|
23
|
+
declare function SwProvider({ children, theme, reducedMotion }: SwProviderProps): react.JSX.Element;
|
|
24
|
+
|
|
25
|
+
type ButtonVariant = 'primary' | 'accent' | 'secondary' | 'outline' | 'ghost' | 'danger';
|
|
26
|
+
/** `2xs` 20px is the row action (inside 28px rows, 4px inset). `xs` 28px is the header/toolbar control. */
|
|
27
|
+
type ButtonSize = '2xs' | 'xs' | 'sm' | 'md' | 'lg' | 'xl';
|
|
28
|
+
interface ButtonOwnProps {
|
|
29
|
+
variant?: ButtonVariant;
|
|
30
|
+
size?: ButtonSize;
|
|
31
|
+
/** Squircle radius token or px. Defaults per size. */
|
|
32
|
+
radius?: RadiusValue;
|
|
33
|
+
/** Corner smoothing from 0 to 1. Default `soft` (0.6). */
|
|
34
|
+
smoothing?: SmoothingValue;
|
|
35
|
+
/** Icon before the label. */
|
|
36
|
+
leading?: ReactNode;
|
|
37
|
+
/** Icon after the label. On `xl` it is pushed to the far edge. */
|
|
38
|
+
trailing?: ReactNode;
|
|
39
|
+
/** Square layout for a single leading or trailing icon. Supply an accessible name. */
|
|
40
|
+
iconOnly?: boolean;
|
|
41
|
+
loading?: boolean;
|
|
42
|
+
fullWidth?: boolean;
|
|
43
|
+
/** Render as a link. */
|
|
44
|
+
href?: string;
|
|
45
|
+
/** Link attributes used with `href`. */
|
|
46
|
+
target?: React.AnchorHTMLAttributes<HTMLAnchorElement>['target'];
|
|
47
|
+
rel?: string;
|
|
48
|
+
/** Require app confirmation before the agent bridge activates this control. Omit to leave it unmarked. */
|
|
49
|
+
'data-sw-confirm'?: '' | true;
|
|
50
|
+
children?: ReactNode;
|
|
51
|
+
}
|
|
52
|
+
type ButtonProps = ButtonOwnProps & Omit<HTMLMotionProps<'button'>, keyof ButtonOwnProps>;
|
|
53
|
+
declare const Button: react.ForwardRefExoticComponent<Omit<ButtonProps, "ref"> & react.RefAttributes<HTMLButtonElement>>;
|
|
54
|
+
/** A right-arrow glyph sized to the text, for `trailing`. */
|
|
55
|
+
declare function ArrowIcon(): react.JSX.Element;
|
|
56
|
+
|
|
57
|
+
type BadgeVariant = 'neutral' | 'accent' | 'success' | 'warning' | 'danger' | 'outline' | 'inverse';
|
|
58
|
+
interface BadgeProps extends HTMLAttributes<HTMLSpanElement> {
|
|
59
|
+
variant?: BadgeVariant;
|
|
60
|
+
/** Optional decorative icon before the label. */
|
|
61
|
+
leading?: ReactNode;
|
|
62
|
+
/** @deprecated Use `leading`. Legacy status badges use a matching icon when available. */
|
|
63
|
+
dot?: boolean;
|
|
64
|
+
/** Add a decorative pulsing status dot. The label still describes the status. */
|
|
65
|
+
pulse?: boolean;
|
|
66
|
+
/** Opt in to uppercase monospace lettering. */
|
|
67
|
+
mono?: boolean;
|
|
68
|
+
}
|
|
69
|
+
/** Small status label. Pill-shaped (a squircle at full radius is a pill). */
|
|
70
|
+
declare function Badge({ variant, leading, dot, pulse, mono, className, children, ...rest }: BadgeProps): react.JSX.Element;
|
|
71
|
+
|
|
72
|
+
interface SwitchProps {
|
|
73
|
+
checked: boolean;
|
|
74
|
+
onCheckedChange(checked: boolean): void;
|
|
75
|
+
label?: ReactNode;
|
|
76
|
+
description?: ReactNode;
|
|
77
|
+
disabled?: boolean;
|
|
78
|
+
size?: 'sm' | 'md';
|
|
79
|
+
className?: string;
|
|
80
|
+
id?: string;
|
|
81
|
+
/** Required when there is no visible `label`. */
|
|
82
|
+
'aria-label'?: string;
|
|
83
|
+
}
|
|
84
|
+
/** On/off toggle with a spring-animated thumb. Renders role="switch". */
|
|
85
|
+
declare function Switch({ checked, onCheckedChange, label, description, disabled, size, className, id, 'aria-label': ariaLabel }: SwitchProps): react.JSX.Element;
|
|
86
|
+
|
|
87
|
+
interface SegmentedOption<V extends string = string> {
|
|
88
|
+
value: V;
|
|
89
|
+
label: ReactNode;
|
|
90
|
+
disabled?: boolean;
|
|
91
|
+
}
|
|
92
|
+
interface SegmentedControlProps<V extends string = string> {
|
|
93
|
+
options: ReadonlyArray<SegmentedOption<V>>;
|
|
94
|
+
value: V;
|
|
95
|
+
onValueChange(value: V): void;
|
|
96
|
+
size?: 'sm' | 'md';
|
|
97
|
+
radius?: RadiusValue;
|
|
98
|
+
/** Use a smooth capsule and circular selection for icon-only options. */
|
|
99
|
+
appearance?: 'default' | 'icon-capsule';
|
|
100
|
+
fullWidth?: boolean;
|
|
101
|
+
'aria-label': string;
|
|
102
|
+
className?: string;
|
|
103
|
+
}
|
|
104
|
+
/** Pick one of 2–5 options. The active pill glides between segments. */
|
|
105
|
+
declare function SegmentedControl<V extends string>({ options, value, onValueChange, size, radius, appearance, fullWidth, className, ...aria }: SegmentedControlProps<V>): react.JSX.Element;
|
|
106
|
+
|
|
107
|
+
interface InputProps extends Omit<InputHTMLAttributes<HTMLInputElement>, 'size' | 'prefix'> {
|
|
108
|
+
label?: ReactNode;
|
|
109
|
+
hint?: ReactNode;
|
|
110
|
+
error?: ReactNode;
|
|
111
|
+
/** Content inside the field, before the text (icon, unit). */
|
|
112
|
+
prefix?: ReactNode;
|
|
113
|
+
suffix?: ReactNode;
|
|
114
|
+
/** `xs` 28px is for dense toolbars and panel headers. */
|
|
115
|
+
size?: 'xs' | 'sm' | 'md' | 'lg';
|
|
116
|
+
/** 'outline' (1px frame) or 'filled' (borderless muted well, frame on focus — for dense toolbars). Default 'outline'. */
|
|
117
|
+
variant?: 'outline' | 'filled';
|
|
118
|
+
/** Keyboard shortcut that focuses the field, e.g. '/' or 'mod+k'. Shown as a hint while the field is empty and unfocused. */
|
|
119
|
+
shortcut?: string;
|
|
120
|
+
radius?: RadiusValue;
|
|
121
|
+
/** Show a clear (×) button while the field has text. Escape also clears it. */
|
|
122
|
+
clearable?: boolean;
|
|
123
|
+
/** Called with the new text on every change (alongside the native `onChange`). */
|
|
124
|
+
onValueChange?: (value: string) => void;
|
|
125
|
+
/** Mark invalid without an error message (a surrounding `<Field>` sets this too). */
|
|
126
|
+
invalid?: boolean;
|
|
127
|
+
}
|
|
128
|
+
/** Text field with label, hint and error. The squircle frame lights up on focus. Works inside `<Field>`. */
|
|
129
|
+
declare const Input: react.ForwardRefExoticComponent<InputProps & react.RefAttributes<HTMLInputElement>>;
|
|
130
|
+
|
|
131
|
+
interface StatProps {
|
|
132
|
+
label: ReactNode;
|
|
133
|
+
value: ReactNode;
|
|
134
|
+
/** e.g. "+8%". Sign decides the color unless `trend` is set. */
|
|
135
|
+
delta?: string;
|
|
136
|
+
trend?: 'up' | 'down' | 'flat';
|
|
137
|
+
/** Status of the metric, independent of the delta trend. */
|
|
138
|
+
tone?: 'neutral' | 'warning' | 'success' | 'danger';
|
|
139
|
+
/** Visible warning text. Translate or replace it with a more specific status. */
|
|
140
|
+
warningLabel?: string;
|
|
141
|
+
/** 'md' poster KPI (mono caps label, 32px number). 'sm' dashboard metric: sentence-case label, 24px number, delta pill, caption. Default 'md'. */
|
|
142
|
+
size?: 'sm' | 'md';
|
|
143
|
+
/** Context under the number, e.g. "vs last week" or "of 2,000 quota". */
|
|
144
|
+
caption?: ReactNode;
|
|
145
|
+
/** Small visual under the number (e.g. a <Sparkline/>). */
|
|
146
|
+
children?: ReactNode;
|
|
147
|
+
className?: string;
|
|
148
|
+
}
|
|
149
|
+
/** A KPI: label, big number, delta. Put several in a row or inside a Card. */
|
|
150
|
+
declare function Stat({ label, value, delta, trend, tone, warningLabel, size, caption, children, className }: StatProps): react.JSX.Element;
|
|
151
|
+
|
|
152
|
+
interface DisplayProps extends HTMLAttributes<HTMLHeadingElement> {
|
|
153
|
+
as?: 'h1' | 'h2' | 'p' | 'div';
|
|
154
|
+
size?: 'md' | 'lg' | 'xl';
|
|
155
|
+
}
|
|
156
|
+
/** Hero / section headline. Weight 450, tight tracking. Wrap words in <Outline> for stroked type. */
|
|
157
|
+
declare function Display({ as: As, size, className, ...p }: DisplayProps): react.JSX.Element;
|
|
158
|
+
/** Stroked (outlined) words, the signature poster effect. Use inside <Display>. */
|
|
159
|
+
declare function Outline({ children }: {
|
|
160
|
+
children: ReactNode;
|
|
161
|
+
}): react.JSX.Element;
|
|
162
|
+
interface HeadingProps extends HTMLAttributes<HTMLHeadingElement> {
|
|
163
|
+
as?: 'h1' | 'h2' | 'h3' | 'h4' | 'h5' | 'h6';
|
|
164
|
+
size?: 'sm' | 'md' | 'lg';
|
|
165
|
+
}
|
|
166
|
+
declare function Heading({ as: As, size, className, ...p }: HeadingProps): react.JSX.Element;
|
|
167
|
+
interface TextProps extends HTMLAttributes<HTMLParagraphElement> {
|
|
168
|
+
as?: 'p' | 'span' | 'div';
|
|
169
|
+
size?: 'sm' | 'base' | 'lg';
|
|
170
|
+
tone?: 'default' | 'muted' | 'subtle';
|
|
171
|
+
}
|
|
172
|
+
declare function Text({ as: As, size, tone, className, ...p }: TextProps): react.JSX.Element;
|
|
173
|
+
interface LinkProps extends AnchorHTMLAttributes<HTMLAnchorElement> {
|
|
174
|
+
href: string;
|
|
175
|
+
}
|
|
176
|
+
/** An inline text link with native navigation and keyboard behavior. */
|
|
177
|
+
declare const Link: react.ForwardRefExoticComponent<LinkProps & react.RefAttributes<HTMLAnchorElement>>;
|
|
178
|
+
/** Mono, uppercase, tracked-out label — used for poster captions and eyebrows. */
|
|
179
|
+
declare function Caption({ className, ...p }: HTMLAttributes<HTMLSpanElement>): react.JSX.Element;
|
|
180
|
+
declare function Kbd({ className, ...p }: HTMLAttributes<HTMLElement>): react.JSX.Element;
|
|
181
|
+
|
|
182
|
+
/**
|
|
183
|
+
* Motion presets for `motion/react` (https://motion.dev/docs/react-animation).
|
|
184
|
+
* Components use these so the whole system moves the same way.
|
|
185
|
+
* Agents: prefer a preset over hand-written transitions.
|
|
186
|
+
*/
|
|
187
|
+
declare const transitions: {
|
|
188
|
+
readonly snappy: Transition;
|
|
189
|
+
readonly gentle: Transition;
|
|
190
|
+
readonly bouncy: Transition;
|
|
191
|
+
readonly fast: Transition;
|
|
192
|
+
readonly base: Transition;
|
|
193
|
+
readonly slow: Transition;
|
|
194
|
+
};
|
|
195
|
+
/** Press feedback for anything clickable. Spread onto a motion element. */
|
|
196
|
+
declare const press: {
|
|
197
|
+
readonly whileTap: {
|
|
198
|
+
readonly scale: 0.97;
|
|
199
|
+
};
|
|
200
|
+
readonly transition: Transition;
|
|
201
|
+
};
|
|
202
|
+
/** Subtle lift for interactive cards. */
|
|
203
|
+
declare const lift: {
|
|
204
|
+
readonly whileHover: {
|
|
205
|
+
readonly y: -2;
|
|
206
|
+
};
|
|
207
|
+
readonly whileTap: {
|
|
208
|
+
readonly y: 0;
|
|
209
|
+
readonly scale: 0.995;
|
|
210
|
+
};
|
|
211
|
+
readonly transition: Transition;
|
|
212
|
+
};
|
|
213
|
+
/** Enter animations: use with `initial="hidden" animate="show"` (or `whileInView`). */
|
|
214
|
+
declare const enter: {
|
|
215
|
+
fadeUp: {
|
|
216
|
+
hidden: {
|
|
217
|
+
opacity: number;
|
|
218
|
+
y: number;
|
|
219
|
+
};
|
|
220
|
+
show: {
|
|
221
|
+
opacity: number;
|
|
222
|
+
y: number;
|
|
223
|
+
transition: Transition;
|
|
224
|
+
};
|
|
225
|
+
};
|
|
226
|
+
fade: {
|
|
227
|
+
hidden: {
|
|
228
|
+
opacity: number;
|
|
229
|
+
};
|
|
230
|
+
show: {
|
|
231
|
+
opacity: number;
|
|
232
|
+
transition: Transition;
|
|
233
|
+
};
|
|
234
|
+
};
|
|
235
|
+
scaleIn: {
|
|
236
|
+
hidden: {
|
|
237
|
+
opacity: number;
|
|
238
|
+
scale: number;
|
|
239
|
+
};
|
|
240
|
+
show: {
|
|
241
|
+
opacity: number;
|
|
242
|
+
scale: number;
|
|
243
|
+
transition: Transition;
|
|
244
|
+
};
|
|
245
|
+
};
|
|
246
|
+
};
|
|
247
|
+
/** Parent variant that staggers its children's `enter.*` variants. */
|
|
248
|
+
declare const stagger: (step?: number, delay?: number) => Variants;
|
|
249
|
+
declare const motionPresets: {
|
|
250
|
+
transitions: {
|
|
251
|
+
readonly snappy: Transition;
|
|
252
|
+
readonly gentle: Transition;
|
|
253
|
+
readonly bouncy: Transition;
|
|
254
|
+
readonly fast: Transition;
|
|
255
|
+
readonly base: Transition;
|
|
256
|
+
readonly slow: Transition;
|
|
257
|
+
};
|
|
258
|
+
press: {
|
|
259
|
+
readonly whileTap: {
|
|
260
|
+
readonly scale: 0.97;
|
|
261
|
+
};
|
|
262
|
+
readonly transition: Transition;
|
|
263
|
+
};
|
|
264
|
+
lift: {
|
|
265
|
+
readonly whileHover: {
|
|
266
|
+
readonly y: -2;
|
|
267
|
+
};
|
|
268
|
+
readonly whileTap: {
|
|
269
|
+
readonly y: 0;
|
|
270
|
+
readonly scale: 0.995;
|
|
271
|
+
};
|
|
272
|
+
readonly transition: Transition;
|
|
273
|
+
};
|
|
274
|
+
enter: {
|
|
275
|
+
fadeUp: {
|
|
276
|
+
hidden: {
|
|
277
|
+
opacity: number;
|
|
278
|
+
y: number;
|
|
279
|
+
};
|
|
280
|
+
show: {
|
|
281
|
+
opacity: number;
|
|
282
|
+
y: number;
|
|
283
|
+
transition: Transition;
|
|
284
|
+
};
|
|
285
|
+
};
|
|
286
|
+
fade: {
|
|
287
|
+
hidden: {
|
|
288
|
+
opacity: number;
|
|
289
|
+
};
|
|
290
|
+
show: {
|
|
291
|
+
opacity: number;
|
|
292
|
+
transition: Transition;
|
|
293
|
+
};
|
|
294
|
+
};
|
|
295
|
+
scaleIn: {
|
|
296
|
+
hidden: {
|
|
297
|
+
opacity: number;
|
|
298
|
+
scale: number;
|
|
299
|
+
};
|
|
300
|
+
show: {
|
|
301
|
+
opacity: number;
|
|
302
|
+
scale: number;
|
|
303
|
+
transition: Transition;
|
|
304
|
+
};
|
|
305
|
+
};
|
|
306
|
+
};
|
|
307
|
+
stagger: (step?: number, delay?: number) => Variants;
|
|
308
|
+
};
|
|
309
|
+
|
|
310
|
+
/** Merge several refs (callback or object) into one callback ref. */
|
|
311
|
+
declare function mergeRefs<T>(...refs: Array<Ref<T> | undefined | null>): (value: T | null) => void;
|
|
312
|
+
|
|
313
|
+
/**
|
|
314
|
+
* State that can be controlled (`value` + `onChange`) or uncontrolled (`defaultValue`).
|
|
315
|
+
* Every stateful SW3 component uses this so agents can do either.
|
|
316
|
+
*/
|
|
317
|
+
declare function useControllableState<T>({ value, defaultValue, onChange, }: {
|
|
318
|
+
value?: T;
|
|
319
|
+
defaultValue: T;
|
|
320
|
+
onChange?: (value: T) => void;
|
|
321
|
+
}): [T, (next: T | ((prev: T) => T)) => void];
|
|
322
|
+
|
|
323
|
+
/** Render floating content into a different container (e.g. inside a shadow root or a dialog). */
|
|
324
|
+
declare const PortalContainerProvider: react.Provider<HTMLElement | null>;
|
|
325
|
+
declare function Portal({ children, container }: {
|
|
326
|
+
children: ReactNode;
|
|
327
|
+
container?: HTMLElement | null;
|
|
328
|
+
}): react.ReactPortal | null;
|
|
329
|
+
/**
|
|
330
|
+
* Register an open layer. Escape and presses outside `elements` call `onDismiss`,
|
|
331
|
+
* but only for the top-most layer, so a Select inside a Dialog closes first.
|
|
332
|
+
*/
|
|
333
|
+
declare function useLayer(open: boolean, onDismiss: (reason: 'escape' | 'outside') => void, elements: () => Array<Element | null | undefined>, { escape, outsidePress }?: {
|
|
334
|
+
escape?: boolean;
|
|
335
|
+
outsidePress?: boolean;
|
|
336
|
+
}): void;
|
|
337
|
+
interface PopupOptions {
|
|
338
|
+
open: boolean;
|
|
339
|
+
onOpenChange(open: boolean): void;
|
|
340
|
+
placement?: Placement;
|
|
341
|
+
/** Gap between anchor and popup in px. Default 6. */
|
|
342
|
+
offset?: number;
|
|
343
|
+
/** Make the popup at least as wide as its anchor (Select, Combobox). */
|
|
344
|
+
matchWidth?: boolean;
|
|
345
|
+
/** Close on Escape. Default true. */
|
|
346
|
+
closeOnEscape?: boolean;
|
|
347
|
+
/** Close when pressing outside anchor + popup. Default true. */
|
|
348
|
+
closeOnOutsidePress?: boolean;
|
|
349
|
+
}
|
|
350
|
+
declare function usePopup({ open, onOpenChange, placement, offset, matchWidth, closeOnEscape, closeOnOutsidePress, }: PopupOptions): {
|
|
351
|
+
open: boolean;
|
|
352
|
+
onOpenChange: (open: boolean) => void;
|
|
353
|
+
/** Put on the anchor (trigger or input). */
|
|
354
|
+
setAnchor: (node: _floating_ui_react_dom.ReferenceType | null) => void;
|
|
355
|
+
/** Put on the floating element (PopupPanel does this for you). */
|
|
356
|
+
setFloating: (node: HTMLElement | null) => void;
|
|
357
|
+
anchor: RefObject<Element | null>;
|
|
358
|
+
floating: RefObject<HTMLElement | null>;
|
|
359
|
+
style: CSSProperties;
|
|
360
|
+
placement: Placement;
|
|
361
|
+
};
|
|
362
|
+
type PopupState = ReturnType<typeof usePopup>;
|
|
363
|
+
interface PopupPanelProps extends Omit<HTMLAttributes<HTMLDivElement>, 'style' | 'children'> {
|
|
364
|
+
popup: PopupState;
|
|
365
|
+
children: ReactNode;
|
|
366
|
+
/** `data-sw` slug of the owning component, e.g. "popover-content". */
|
|
367
|
+
sw: string;
|
|
368
|
+
radius?: RadiusValue;
|
|
369
|
+
/** Inner padding preset. Default 'sm'. */
|
|
370
|
+
padding?: 'none' | 'xs' | 'sm' | 'md';
|
|
371
|
+
/** Squircle surface + frame. Set false for a bare floating element. Default true. */
|
|
372
|
+
surface?: boolean;
|
|
373
|
+
style?: CSSProperties;
|
|
374
|
+
/** Extra ref to the animated surface element, e.g. to focus it. Children render inside a scrolling `.sw-popup__body`. */
|
|
375
|
+
innerRef?: React.Ref<HTMLDivElement>;
|
|
376
|
+
}
|
|
377
|
+
/**
|
|
378
|
+
* Portaled, positioned, animated popup surface. Mount it unconditionally;
|
|
379
|
+
* it renders only while `popup.open` is true and animates in and out.
|
|
380
|
+
*/
|
|
381
|
+
declare function PopupPanel({ popup, children, sw, radius, padding, surface, className, style, innerRef, ...rest }: PopupPanelProps): react.JSX.Element;
|
|
382
|
+
declare function focusables(root: HTMLElement | null): HTMLElement[];
|
|
383
|
+
/**
|
|
384
|
+
* Keep Tab inside `ref` while active; focus `initialFocus` (or the first focusable) and restore focus on close.
|
|
385
|
+
* Nested traps stack: only the top-most one handles Tab. Focus inside a portaled popup layer is left alone.
|
|
386
|
+
*/
|
|
387
|
+
declare function useFocusTrap(ref: RefObject<HTMLElement | null>, active: boolean, initialFocus?: RefObject<HTMLElement | null>): void;
|
|
388
|
+
/** Prevent page scroll while a modal is open (nested modals share one lock). */
|
|
389
|
+
declare function useScrollLock(active: boolean): void;
|
|
390
|
+
/** Open after a delay on hover/focus, close after a delay on leave (Tooltip, Hover Card). */
|
|
391
|
+
declare function useHoverIntent(setOpen: (open: boolean) => void, { openDelay, closeDelay }?: {
|
|
392
|
+
openDelay?: number | undefined;
|
|
393
|
+
closeDelay?: number | undefined;
|
|
394
|
+
}): {
|
|
395
|
+
show: (immediate?: boolean) => void;
|
|
396
|
+
hide: (immediate?: boolean) => void;
|
|
397
|
+
cancel: () => void;
|
|
398
|
+
};
|
|
399
|
+
|
|
400
|
+
interface ListNavigationOptions {
|
|
401
|
+
count: number;
|
|
402
|
+
activeIndex: number;
|
|
403
|
+
setActiveIndex(index: number): void;
|
|
404
|
+
/** Wrap from last to first. Default true. */
|
|
405
|
+
loop?: boolean;
|
|
406
|
+
orientation?: 'vertical' | 'horizontal' | 'both';
|
|
407
|
+
isDisabled?(index: number): boolean;
|
|
408
|
+
/** Enter / Space on the active item. Space is skipped when `typeahead` text is being typed. */
|
|
409
|
+
onSelect?(index: number): void;
|
|
410
|
+
/** Text for each item, used for type-to-jump. Omit to disable typeahead. */
|
|
411
|
+
getLabel?(index: number): string;
|
|
412
|
+
/** Let Space type into an input instead of selecting (Combobox, Command). */
|
|
413
|
+
spaceSelects?: boolean;
|
|
414
|
+
}
|
|
415
|
+
/**
|
|
416
|
+
* Keyboard model for lists, menus, listboxes and grids-of-one-row:
|
|
417
|
+
* arrows move, Home/End jump, Enter selects, typing jumps to a matching label.
|
|
418
|
+
* Returns an onKeyDown handler; the caller renders `aria-activedescendant` or moves focus.
|
|
419
|
+
*/
|
|
420
|
+
declare function useListNavigation({ count, activeIndex, setActiveIndex, loop, orientation, isDisabled, onSelect, getLabel, spaceSelects, }: ListNavigationOptions): (e: KeyboardEvent$1) => void;
|
|
421
|
+
|
|
422
|
+
/**
|
|
423
|
+
* Shared contract between `<Field>` and any control inside it (Input, Textarea, Select,
|
|
424
|
+
* Checkbox, Slider, Date Input…). A control calls `useFieldControl()` and spreads the
|
|
425
|
+
* result onto its focusable element, so the label, description and error connect for free.
|
|
426
|
+
*/
|
|
427
|
+
interface FieldContextValue {
|
|
428
|
+
/** id for the control. */
|
|
429
|
+
controlId: string;
|
|
430
|
+
labelId: string;
|
|
431
|
+
descriptionId: string;
|
|
432
|
+
errorId: string;
|
|
433
|
+
/** False when the Field renders no label; controls then must not point aria-labelledby at it. */
|
|
434
|
+
hasLabel?: boolean;
|
|
435
|
+
hasDescription: boolean;
|
|
436
|
+
hasError: boolean;
|
|
437
|
+
invalid: boolean;
|
|
438
|
+
disabled: boolean;
|
|
439
|
+
required: boolean;
|
|
440
|
+
}
|
|
441
|
+
declare const FieldContext: react.Context<FieldContextValue | null>;
|
|
442
|
+
declare const useFieldContext: () => FieldContextValue | null;
|
|
443
|
+
interface FieldControlInput {
|
|
444
|
+
id?: string;
|
|
445
|
+
disabled?: boolean;
|
|
446
|
+
required?: boolean;
|
|
447
|
+
invalid?: boolean;
|
|
448
|
+
'aria-describedby'?: string;
|
|
449
|
+
'aria-labelledby'?: string;
|
|
450
|
+
}
|
|
451
|
+
/** ARIA + id props for a control, merged with its surrounding `<Field>` (if any). */
|
|
452
|
+
declare function useFieldControl(props?: FieldControlInput): {
|
|
453
|
+
id: string;
|
|
454
|
+
disabled: boolean | undefined;
|
|
455
|
+
required: boolean | undefined;
|
|
456
|
+
'aria-invalid': true | undefined;
|
|
457
|
+
'aria-describedby': string | undefined;
|
|
458
|
+
'aria-labelledby': string | undefined;
|
|
459
|
+
/** `true` when inside a Field (so the control should not render its own label). */
|
|
460
|
+
inField: boolean;
|
|
461
|
+
labelId: string | undefined;
|
|
462
|
+
};
|
|
463
|
+
|
|
464
|
+
type AsyncStatus = 'idle' | 'loading' | 'error';
|
|
465
|
+
type AsyncLoader<T> = (query: string, ctx: {
|
|
466
|
+
signal: AbortSignal;
|
|
467
|
+
page: number;
|
|
468
|
+
}) => Promise<T[] | {
|
|
469
|
+
items: T[];
|
|
470
|
+
hasMore: boolean;
|
|
471
|
+
}>;
|
|
472
|
+
interface AsyncOptionsConfig {
|
|
473
|
+
/** How long typing must pause before loading, in ms. Default 200. */
|
|
474
|
+
debounce?: number;
|
|
475
|
+
/** Starting search text. Default "". */
|
|
476
|
+
query?: string;
|
|
477
|
+
/** Load the starting query on mount. Default false. */
|
|
478
|
+
immediate?: boolean;
|
|
479
|
+
}
|
|
480
|
+
/**
|
|
481
|
+
* Load list items as someone types (Select, Combobox, Autocomplete, Command).
|
|
482
|
+
* Debounces, cancels replaced requests, keeps the previous items while loading, pages with `loadMore`.
|
|
483
|
+
*
|
|
484
|
+
* const movies = useAsyncOptions(async (q, { signal }) => (await fetch(`/api?q=${q}`, { signal })).json())
|
|
485
|
+
* <Combobox items={movies.items} loading={movies.status === 'loading'} onInputChange={movies.setQuery} />
|
|
486
|
+
*/
|
|
487
|
+
declare function useAsyncOptions<T>(loader: AsyncLoader<T>, { debounce, query: initial, immediate }?: AsyncOptionsConfig): {
|
|
488
|
+
query: string;
|
|
489
|
+
setQuery: (q: string) => void;
|
|
490
|
+
items: T[];
|
|
491
|
+
status: AsyncStatus;
|
|
492
|
+
error: unknown;
|
|
493
|
+
hasMore: boolean;
|
|
494
|
+
/** Load the next page and append it. */
|
|
495
|
+
loadMore: () => void;
|
|
496
|
+
/** Load the current query again from page 0. */
|
|
497
|
+
reload: () => Promise<void>;
|
|
498
|
+
};
|
|
499
|
+
|
|
500
|
+
/**
|
|
501
|
+
* Keyboard shortcuts. Keys join with "+"; `mod` is ⌘ on Apple platforms, Ctrl elsewhere.
|
|
502
|
+
* useShortcut('mod+s', save, { description: 'Save' })
|
|
503
|
+
* const hint = useShortcutHint('mod+s') // { text: '⌘S', ariaKeyshortcuts: 'Meta+S' }
|
|
504
|
+
* `shortcuts.list()` returns every registered shortcut, so agents (and a help dialog) can read them.
|
|
505
|
+
*/
|
|
506
|
+
interface ShortcutOptions {
|
|
507
|
+
description?: string;
|
|
508
|
+
/** Also fire while typing in a text field. Default: only when a modifier other than Shift is held. */
|
|
509
|
+
allowInInput?: boolean;
|
|
510
|
+
/** Checked on every press; return false to skip. */
|
|
511
|
+
when?: () => boolean;
|
|
512
|
+
/** Only active while `shortcuts.setScope(scope, true)`. */
|
|
513
|
+
scope?: string;
|
|
514
|
+
/** Default true: preventDefault on match. */
|
|
515
|
+
preventDefault?: boolean;
|
|
516
|
+
}
|
|
517
|
+
declare const shortcuts: {
|
|
518
|
+
/** Turn a named scope on or off. */
|
|
519
|
+
setScope(name: string, active: boolean): void;
|
|
520
|
+
/** Every registered shortcut (for help dialogs and agents). */
|
|
521
|
+
list(): {
|
|
522
|
+
keys: string;
|
|
523
|
+
text: string;
|
|
524
|
+
description: string | undefined;
|
|
525
|
+
scope: string | undefined;
|
|
526
|
+
active: boolean;
|
|
527
|
+
}[];
|
|
528
|
+
};
|
|
529
|
+
/** Register a shortcut while the component is mounted. Pass `null` keys to skip. */
|
|
530
|
+
declare function useShortcut(keys: string | null, handler: (e: KeyboardEvent) => void, opts?: ShortcutOptions): void;
|
|
531
|
+
/** Display text for the current platform: "⌘S" on Apple, "Ctrl+S" elsewhere. */
|
|
532
|
+
declare function formatShortcut(keys: string, apple?: boolean): string;
|
|
533
|
+
/** Value for `aria-keyshortcuts`, e.g. "Meta+S". */
|
|
534
|
+
declare function ariaKeyshortcuts(keys: string): string;
|
|
535
|
+
/** Platform-correct hint. Server and first client render use the non-Apple form, then update after mount. */
|
|
536
|
+
declare function useShortcutHint(keys: string): {
|
|
537
|
+
text: string;
|
|
538
|
+
ariaKeyshortcuts: string;
|
|
539
|
+
};
|
|
540
|
+
|
|
541
|
+
interface LabelProps extends LabelHTMLAttributes<HTMLLabelElement> {
|
|
542
|
+
/** Show a required marker after the text. Inside a `<Field required>` it shows on its own. */
|
|
543
|
+
required?: boolean;
|
|
544
|
+
}
|
|
545
|
+
/**
|
|
546
|
+
* Names a control. A press focuses or activates it like a native label — for any control,
|
|
547
|
+
* including groups (Radio Group, Slider, Rating) that a native `<label for>` can't reach.
|
|
548
|
+
* Inside `<Field>`, it names the field's control without `htmlFor`.
|
|
549
|
+
*/
|
|
550
|
+
declare const Label: react.ForwardRefExoticComponent<LabelProps & react.RefAttributes<HTMLLabelElement>>;
|
|
551
|
+
|
|
552
|
+
interface FieldProps extends Omit<HTMLAttributes<HTMLDivElement>, 'children'> {
|
|
553
|
+
/** Visible label. Or put a `<FieldLabel>` in children. */
|
|
554
|
+
label?: ReactNode;
|
|
555
|
+
/** Help text under the control. Or use `<FieldDescription>`. */
|
|
556
|
+
description?: ReactNode;
|
|
557
|
+
/** Error message. Shown (and the field marked invalid) whenever it's set, unless `invalid={false}`. */
|
|
558
|
+
error?: ReactNode;
|
|
559
|
+
required?: boolean;
|
|
560
|
+
disabled?: boolean;
|
|
561
|
+
/** Invalid without a message, or force the error to hide with `false`. Default: `!!error`. */
|
|
562
|
+
invalid?: boolean;
|
|
563
|
+
/** id for the control. Generated when omitted. */
|
|
564
|
+
controlId?: string;
|
|
565
|
+
children: ReactNode;
|
|
566
|
+
}
|
|
567
|
+
/**
|
|
568
|
+
* Connects one control to its label, description and error: ids, `for`,
|
|
569
|
+
* `aria-labelledby`, `aria-describedby`, `aria-invalid`, `required` and `disabled`.
|
|
570
|
+
*/
|
|
571
|
+
declare function Field({ label, description, error, required, disabled, invalid, controlId, className, children, ...rest }: FieldProps): react.JSX.Element;
|
|
572
|
+
type FieldLabelProps = Omit<LabelProps, 'htmlFor'>;
|
|
573
|
+
/** The field's label. Pressing it focuses (or checks) the control. */
|
|
574
|
+
declare function FieldLabel({ className, ...props }: FieldLabelProps): react.JSX.Element;
|
|
575
|
+
/** Help text, read out with the control. */
|
|
576
|
+
declare function FieldDescription({ className, ...props }: HTMLAttributes<HTMLParagraphElement>): react.JSX.Element;
|
|
577
|
+
interface FieldErrorProps extends HTMLAttributes<HTMLParagraphElement> {
|
|
578
|
+
/** Show even when the field isn't invalid. Default: only while invalid. */
|
|
579
|
+
forceShow?: boolean;
|
|
580
|
+
}
|
|
581
|
+
/** Error message. Renders only while the field is invalid; announced politely. */
|
|
582
|
+
declare function FieldError({ className, forceShow, ...props }: FieldErrorProps): react.JSX.Element | null;
|
|
583
|
+
|
|
584
|
+
interface TextareaProps extends Omit<TextareaHTMLAttributes<HTMLTextAreaElement>, 'value' | 'defaultValue'> {
|
|
585
|
+
value?: string;
|
|
586
|
+
defaultValue?: string;
|
|
587
|
+
onValueChange?: (value: string) => void;
|
|
588
|
+
label?: ReactNode;
|
|
589
|
+
hint?: ReactNode;
|
|
590
|
+
error?: ReactNode;
|
|
591
|
+
invalid?: boolean;
|
|
592
|
+
size?: 'sm' | 'md' | 'lg';
|
|
593
|
+
radius?: RadiusValue;
|
|
594
|
+
/** Grow and shrink with the text between `minRows` and `maxRows`. Default true. */
|
|
595
|
+
autoResize?: boolean;
|
|
596
|
+
/** Height in rows when empty. Default 3. */
|
|
597
|
+
minRows?: number;
|
|
598
|
+
/** Stop growing here and scroll. Default: no limit. */
|
|
599
|
+
maxRows?: number;
|
|
600
|
+
/** Show "count / maxLength" under the field. */
|
|
601
|
+
showCount?: boolean;
|
|
602
|
+
/** Keys that submit: `enter` (Shift+Enter = new line) or `mod+enter` (⌘/Ctrl+Enter). */
|
|
603
|
+
submitShortcut?: 'enter' | 'mod+enter';
|
|
604
|
+
/** Runs on the submit shortcut. Without it, the shortcut submits the surrounding form. */
|
|
605
|
+
onSubmitShortcut?: (value: string) => void;
|
|
606
|
+
}
|
|
607
|
+
/** Multi-line text field that grows with its content. Squircle frame like Input. */
|
|
608
|
+
declare const Textarea: react.ForwardRefExoticComponent<TextareaProps & react.RefAttributes<HTMLTextAreaElement>>;
|
|
609
|
+
|
|
610
|
+
type CheckedState = boolean | 'indeterminate';
|
|
611
|
+
interface CheckboxProps extends Omit<ButtonHTMLAttributes<HTMLButtonElement>, 'value' | 'onChange' | 'defaultChecked' | 'type' | 'children'> {
|
|
612
|
+
checked?: CheckedState;
|
|
613
|
+
defaultChecked?: CheckedState;
|
|
614
|
+
/** Called with the next state. From indeterminate, a press checks. */
|
|
615
|
+
onCheckedChange?: (checked: boolean) => void;
|
|
616
|
+
/** Text next to the box. Clicking it toggles. */
|
|
617
|
+
label?: ReactNode;
|
|
618
|
+
description?: ReactNode;
|
|
619
|
+
/** Alias for `label`. */
|
|
620
|
+
children?: ReactNode;
|
|
621
|
+
/** Submitted while checked (default "on"); identifies it inside a CheckboxGroup. */
|
|
622
|
+
value?: string;
|
|
623
|
+
name?: string;
|
|
624
|
+
readOnly?: boolean;
|
|
625
|
+
required?: boolean;
|
|
626
|
+
invalid?: boolean;
|
|
627
|
+
/** Inside a CheckboxGroup: check/uncheck all, and show indeterminate when some are checked. */
|
|
628
|
+
parent?: boolean;
|
|
629
|
+
size?: 'sm' | 'md' | 'lg';
|
|
630
|
+
}
|
|
631
|
+
/** Checked / unchecked / indeterminate box with an animated check. Renders role="checkbox". */
|
|
632
|
+
declare const Checkbox: react.ForwardRefExoticComponent<CheckboxProps & react.RefAttributes<HTMLButtonElement>>;
|
|
633
|
+
interface CheckboxGroupItem {
|
|
634
|
+
value: string;
|
|
635
|
+
label: ReactNode;
|
|
636
|
+
description?: ReactNode;
|
|
637
|
+
disabled?: boolean;
|
|
638
|
+
}
|
|
639
|
+
interface CheckboxGroupProps extends Omit<HTMLAttributes<HTMLDivElement>, 'defaultValue' | 'onChange'> {
|
|
640
|
+
/** Values of the checked checkboxes. */
|
|
641
|
+
value?: string[];
|
|
642
|
+
defaultValue?: string[];
|
|
643
|
+
onValueChange?: (value: string[]) => void;
|
|
644
|
+
/** Every value a `parent` checkbox controls. Default: the checkboxes rendered in the group. */
|
|
645
|
+
allValues?: string[];
|
|
646
|
+
/** Shorthand: one Checkbox per item. */
|
|
647
|
+
items?: CheckboxGroupItem[];
|
|
648
|
+
/** Name every checkbox submits under. */
|
|
649
|
+
name?: string;
|
|
650
|
+
disabled?: boolean;
|
|
651
|
+
readOnly?: boolean;
|
|
652
|
+
required?: boolean;
|
|
653
|
+
invalid?: boolean;
|
|
654
|
+
orientation?: 'vertical' | 'horizontal';
|
|
655
|
+
size?: 'sm' | 'md' | 'lg';
|
|
656
|
+
}
|
|
657
|
+
/** Several checkboxes sharing one array value. Add `<Checkbox parent>` for a select-all row. */
|
|
658
|
+
declare function CheckboxGroup({ value, defaultValue, onValueChange, allValues, items, name, disabled, readOnly, required, invalid, orientation, size: sizeProp, className, children, id, 'aria-labelledby': ariaLabelledBy, 'aria-describedby': ariaDescribedBy, ...rest }: CheckboxGroupProps): react.JSX.Element;
|
|
659
|
+
|
|
660
|
+
interface RadioGroupItem {
|
|
661
|
+
value: string;
|
|
662
|
+
label: ReactNode;
|
|
663
|
+
description?: ReactNode;
|
|
664
|
+
/** Leading icon for `variant="card"`: an SDK icon name or any 18px node. */
|
|
665
|
+
icon?: IconName | ReactNode;
|
|
666
|
+
disabled?: boolean;
|
|
667
|
+
}
|
|
668
|
+
interface RadioGroupProps extends Omit<HTMLAttributes<HTMLDivElement>, 'defaultValue' | 'onChange'> {
|
|
669
|
+
/** The checked radio's value; `null` checks none. */
|
|
670
|
+
value?: string | null;
|
|
671
|
+
defaultValue?: string | null;
|
|
672
|
+
onValueChange?: (value: string) => void;
|
|
673
|
+
/** Shorthand: one Radio per item. */
|
|
674
|
+
items?: RadioGroupItem[];
|
|
675
|
+
/** Submits the checked value under this name. */
|
|
676
|
+
name?: string;
|
|
677
|
+
disabled?: boolean;
|
|
678
|
+
readOnly?: boolean;
|
|
679
|
+
required?: boolean;
|
|
680
|
+
invalid?: boolean;
|
|
681
|
+
/** Arrow keys wrap from last to first. Default true, like native radios. */
|
|
682
|
+
loop?: boolean;
|
|
683
|
+
orientation?: 'vertical' | 'horizontal';
|
|
684
|
+
size?: 'sm' | 'md' | 'lg';
|
|
685
|
+
/**
|
|
686
|
+
* `card`: each option is a row with an optional icon and no radio dot. A squircle fill marks
|
|
687
|
+
* hover and the checked row, which suits option lists in side panels and settings.
|
|
688
|
+
*/
|
|
689
|
+
variant?: 'default' | 'card';
|
|
690
|
+
/** Columns for `variant="card"` once the container is wide enough. */
|
|
691
|
+
columns?: 1 | 2 | 3 | 4;
|
|
692
|
+
/** Corner radius of card rows. */
|
|
693
|
+
radius?: RadiusValue;
|
|
694
|
+
}
|
|
695
|
+
/** One choice out of a few, all visible. Arrow keys move and check. */
|
|
696
|
+
declare function RadioGroup({ value, defaultValue, onValueChange, items, name, disabled, readOnly, required, invalid, loop, orientation, size, variant, columns, radius, className, children, id, onKeyDown, 'aria-labelledby': ariaLabelledBy, 'aria-describedby': ariaDescribedBy, ...rest }: RadioGroupProps): react.JSX.Element;
|
|
697
|
+
interface RadioProps extends Omit<ButtonHTMLAttributes<HTMLButtonElement>, 'value' | 'type' | 'children'> {
|
|
698
|
+
value: string;
|
|
699
|
+
label?: ReactNode;
|
|
700
|
+
description?: ReactNode;
|
|
701
|
+
/** Leading icon, shown in `variant="card"`: an SDK icon name or any 18px node. */
|
|
702
|
+
icon?: IconName | ReactNode;
|
|
703
|
+
/** Alias for `label`. */
|
|
704
|
+
children?: ReactNode;
|
|
705
|
+
}
|
|
706
|
+
/** One option of a RadioGroup. Renders role="radio"; the label is clickable. */
|
|
707
|
+
declare const Radio: react.ForwardRefExoticComponent<RadioProps & react.RefAttributes<HTMLButtonElement>>;
|
|
708
|
+
|
|
709
|
+
type Size = 'sm' | 'md' | 'lg';
|
|
710
|
+
type Variant = 'ghost' | 'outline';
|
|
711
|
+
interface ToggleProps extends Omit<ButtonHTMLAttributes<HTMLButtonElement>, 'value' | 'type'> {
|
|
712
|
+
pressed?: boolean;
|
|
713
|
+
defaultPressed?: boolean;
|
|
714
|
+
onPressedChange?: (pressed: boolean) => void;
|
|
715
|
+
/** Identifies the toggle inside a ToggleGroup. */
|
|
716
|
+
value?: string;
|
|
717
|
+
size?: Size;
|
|
718
|
+
variant?: Variant;
|
|
719
|
+
radius?: RadiusValue;
|
|
720
|
+
/** Icon before the label. For icon-only toggles pass the icon as children and set `aria-label`. */
|
|
721
|
+
icon?: ReactNode;
|
|
722
|
+
}
|
|
723
|
+
/** A button that stays pressed (bold, mute, pin…). Renders aria-pressed. */
|
|
724
|
+
declare const Toggle: react.ForwardRefExoticComponent<ToggleProps & react.RefAttributes<HTMLButtonElement>>;
|
|
725
|
+
interface ToggleGroupItem {
|
|
726
|
+
value: string;
|
|
727
|
+
label?: ReactNode;
|
|
728
|
+
icon?: ReactNode;
|
|
729
|
+
disabled?: boolean;
|
|
730
|
+
/** Required for icon-only items. */
|
|
731
|
+
'aria-label'?: string;
|
|
732
|
+
}
|
|
733
|
+
interface ToggleGroupProps extends Omit<HTMLAttributes<HTMLDivElement>, 'defaultValue' | 'onChange'> {
|
|
734
|
+
/** Values of the pressed toggles (one at most unless `multiple`). */
|
|
735
|
+
value?: string[];
|
|
736
|
+
defaultValue?: string[];
|
|
737
|
+
onValueChange?: (value: string[]) => void;
|
|
738
|
+
/** Allow several toggles pressed at once. Default false (pressing one releases the others). */
|
|
739
|
+
multiple?: boolean;
|
|
740
|
+
/** Single mode only: pressing the pressed toggle releases it. Default true. */
|
|
741
|
+
deselectable?: boolean;
|
|
742
|
+
items?: ToggleGroupItem[];
|
|
743
|
+
disabled?: boolean;
|
|
744
|
+
orientation?: 'horizontal' | 'vertical';
|
|
745
|
+
/** Arrow keys wrap around. Default true. */
|
|
746
|
+
loop?: boolean;
|
|
747
|
+
size?: Size;
|
|
748
|
+
/** ghost = muted track; outline = muted track with a frame. Pressed items use a solid ink fill. */
|
|
749
|
+
variant?: Variant;
|
|
750
|
+
/** Track corner radius. Items get the concentric radius (track radius − 3px padding). Default 'sm'. */
|
|
751
|
+
radius?: RadiusValue;
|
|
752
|
+
/** Submits one entry per pressed value under this name. */
|
|
753
|
+
name?: string;
|
|
754
|
+
}
|
|
755
|
+
/** A row of toggles on a muted track (like SegmentedControl) with one tab stop; arrow keys move focus, Space/Enter presses. */
|
|
756
|
+
declare function ToggleGroup({ value, defaultValue, onValueChange, multiple, deselectable, items, disabled, orientation, loop, size, variant, radius, name, className, children, onKeyDown, ...rest }: ToggleGroupProps): react.JSX.Element;
|
|
757
|
+
|
|
758
|
+
type SliderValue = number | [number, number];
|
|
759
|
+
interface SliderMark {
|
|
760
|
+
value: number;
|
|
761
|
+
label?: ReactNode;
|
|
762
|
+
}
|
|
763
|
+
interface SliderProps<T extends SliderValue = SliderValue> {
|
|
764
|
+
/** A number for one thumb, `[start, end]` for a range. */
|
|
765
|
+
value?: T;
|
|
766
|
+
defaultValue?: T;
|
|
767
|
+
/** Runs on every step of a drag or key press. */
|
|
768
|
+
onValueChange?: (value: T) => void;
|
|
769
|
+
/** Runs once when a drag or key press ends — for saving. */
|
|
770
|
+
onValueCommit?: (value: T) => void;
|
|
771
|
+
min?: number;
|
|
772
|
+
max?: number;
|
|
773
|
+
step?: number;
|
|
774
|
+
/** PageUp/PageDown and Shift+Arrow. Default 10 × step. */
|
|
775
|
+
largeStep?: number;
|
|
776
|
+
/** Range only: how many steps apart the two thumbs stay. Default 0. */
|
|
777
|
+
minStepsBetweenThumbs?: number;
|
|
778
|
+
orientation?: 'horizontal' | 'vertical';
|
|
779
|
+
disabled?: boolean;
|
|
780
|
+
readOnly?: boolean;
|
|
781
|
+
/** Submits the number (range: "start/end") under this name. */
|
|
782
|
+
name?: string;
|
|
783
|
+
/** Visible label above the track. Inside `<Field>`, use the Field's label instead. */
|
|
784
|
+
label?: ReactNode;
|
|
785
|
+
/** Show the formatted value next to the label. Default: true when `label` is set. */
|
|
786
|
+
showValue?: boolean;
|
|
787
|
+
/** Ticks on the track; labelled ones show text under it. */
|
|
788
|
+
marks?: Array<number | SliderMark>;
|
|
789
|
+
/** `Intl.NumberFormat` options for the value text (percent style = position between min and max). */
|
|
790
|
+
formatOptions?: Intl.NumberFormatOptions;
|
|
791
|
+
locale?: string;
|
|
792
|
+
/** Names for the two range thumbs. Default ["Minimum", "Maximum"]. */
|
|
793
|
+
thumbLabels?: [string, string];
|
|
794
|
+
size?: 'sm' | 'md';
|
|
795
|
+
id?: string;
|
|
796
|
+
className?: string;
|
|
797
|
+
style?: CSSProperties;
|
|
798
|
+
'aria-label'?: string;
|
|
799
|
+
'aria-labelledby'?: string;
|
|
800
|
+
}
|
|
801
|
+
/** Pick a number (or a range) by dragging or with the keyboard. */
|
|
802
|
+
declare function Slider<T extends SliderValue = number>({ value, defaultValue, onValueChange, onValueCommit, min, max, step, largeStep, minStepsBetweenThumbs, orientation, disabled, readOnly, name, label, showValue, marks, formatOptions, locale, thumbLabels, size, id, className, style, 'aria-label': ariaLabel, 'aria-labelledby': ariaLabelledBy, }: SliderProps<T>): react.JSX.Element;
|
|
803
|
+
|
|
804
|
+
interface NumberInputProps extends Omit<InputHTMLAttributes<HTMLInputElement>, 'value' | 'defaultValue' | 'onChange' | 'size' | 'type' | 'min' | 'max' | 'step' | 'prefix'> {
|
|
805
|
+
/** The number, or `null` for an empty field. */
|
|
806
|
+
value?: number | null;
|
|
807
|
+
defaultValue?: number | null;
|
|
808
|
+
/** Runs while typing (once the text is a valid number) and on every step. */
|
|
809
|
+
onValueChange?: (value: number | null) => void;
|
|
810
|
+
/** Runs when an edit ends: blur/Enter, a key or button released. For saving. */
|
|
811
|
+
onValueCommit?: (value: number | null) => void;
|
|
812
|
+
min?: number;
|
|
813
|
+
max?: number;
|
|
814
|
+
/** Arrow keys and buttons. Committed values snap to it. Default 1. */
|
|
815
|
+
step?: number;
|
|
816
|
+
/** PageUp/PageDown and Shift. Default 10 × step. */
|
|
817
|
+
largeStep?: number;
|
|
818
|
+
/** Alt/Option + Arrow. Default step / 10. */
|
|
819
|
+
smallStep?: number;
|
|
820
|
+
/** `Intl.NumberFormat` options, e.g. `{ style: 'currency', currency: 'USD' }`. Percent values are fractions (0.5 = 50%). */
|
|
821
|
+
formatOptions?: Intl.NumberFormatOptions;
|
|
822
|
+
locale?: string;
|
|
823
|
+
/** Mouse wheel steps the value while focused. Default false. */
|
|
824
|
+
wheel?: boolean;
|
|
825
|
+
/** Show the − / + buttons. Default true. */
|
|
826
|
+
stepper?: boolean;
|
|
827
|
+
label?: ReactNode;
|
|
828
|
+
hint?: ReactNode;
|
|
829
|
+
error?: ReactNode;
|
|
830
|
+
invalid?: boolean;
|
|
831
|
+
size?: 'sm' | 'md' | 'lg';
|
|
832
|
+
radius?: RadiusValue;
|
|
833
|
+
incrementLabel?: string;
|
|
834
|
+
decrementLabel?: string;
|
|
835
|
+
}
|
|
836
|
+
/** A number field with − / + steppers, min/max/step, locale formatting and spinbutton keys. */
|
|
837
|
+
declare const NumberInput: react.ForwardRefExoticComponent<NumberInputProps & react.RefAttributes<HTMLInputElement>>;
|
|
838
|
+
|
|
839
|
+
interface PasswordInputProps extends Omit<InputHTMLAttributes<HTMLInputElement>, 'size' | 'type' | 'prefix'> {
|
|
840
|
+
onValueChange?: (value: string) => void;
|
|
841
|
+
/** Whether the password shows as text. */
|
|
842
|
+
visible?: boolean;
|
|
843
|
+
defaultVisible?: boolean;
|
|
844
|
+
onVisibleChange?: (visible: boolean) => void;
|
|
845
|
+
/** `current-password` to sign in (default), `new-password` to sign up or change it. */
|
|
846
|
+
autoComplete?: 'current-password' | 'new-password' | 'off' | (string & {});
|
|
847
|
+
label?: ReactNode;
|
|
848
|
+
hint?: ReactNode;
|
|
849
|
+
error?: ReactNode;
|
|
850
|
+
invalid?: boolean;
|
|
851
|
+
prefix?: ReactNode;
|
|
852
|
+
size?: 'sm' | 'md' | 'lg';
|
|
853
|
+
radius?: RadiusValue;
|
|
854
|
+
/** Accessible name of the reveal button. Default "Show password". */
|
|
855
|
+
toggleLabel?: string;
|
|
856
|
+
}
|
|
857
|
+
/** Password field with a show/hide (eye) toggle and a Caps Lock hint. Hides again when its form submits. */
|
|
858
|
+
declare const PasswordInput: react.ForwardRefExoticComponent<PasswordInputProps & react.RefAttributes<HTMLInputElement>>;
|
|
859
|
+
|
|
860
|
+
type OTPPattern = 'digits' | 'letters' | 'alphanumeric' | RegExp;
|
|
861
|
+
interface OTPInputProps {
|
|
862
|
+
/** Number of characters (one box each). Default 6. */
|
|
863
|
+
length?: number;
|
|
864
|
+
value?: string;
|
|
865
|
+
defaultValue?: string;
|
|
866
|
+
onValueChange?: (value: string) => void;
|
|
867
|
+
/** Runs when a change fills every box, with the whole code. */
|
|
868
|
+
onComplete?: (value: string) => void;
|
|
869
|
+
/** Which characters are accepted. Default `digits`. Anything else typed or pasted is dropped. */
|
|
870
|
+
pattern?: OTPPattern;
|
|
871
|
+
/** Draw a dash after every N boxes, e.g. 3 → `123–456`. */
|
|
872
|
+
groupSize?: number;
|
|
873
|
+
/** Show dots instead of characters. */
|
|
874
|
+
mask?: boolean;
|
|
875
|
+
name?: string;
|
|
876
|
+
disabled?: boolean;
|
|
877
|
+
readOnly?: boolean;
|
|
878
|
+
required?: boolean;
|
|
879
|
+
invalid?: boolean;
|
|
880
|
+
autoFocus?: boolean;
|
|
881
|
+
/** Default `one-time-code`, so phones offer the code from a message. */
|
|
882
|
+
autoComplete?: string;
|
|
883
|
+
size?: 'sm' | 'md' | 'lg';
|
|
884
|
+
id?: string;
|
|
885
|
+
className?: string;
|
|
886
|
+
style?: CSSProperties;
|
|
887
|
+
'aria-label'?: string;
|
|
888
|
+
'aria-labelledby'?: string;
|
|
889
|
+
'aria-describedby'?: string;
|
|
890
|
+
}
|
|
891
|
+
/**
|
|
892
|
+
* One-time-code entry: N boxes backed by a single real input, so typing, paste,
|
|
893
|
+
* autofill (`one-time-code`) and screen readers all see one field.
|
|
894
|
+
*/
|
|
895
|
+
declare const OTPInput: react.ForwardRefExoticComponent<OTPInputProps & react.RefAttributes<HTMLInputElement>>;
|
|
896
|
+
|
|
897
|
+
interface SeparatorProps extends HTMLAttributes<HTMLDivElement> {
|
|
898
|
+
orientation?: 'horizontal' | 'vertical';
|
|
899
|
+
/** Purely visual: hidden from assistive tech (role="none"). Default false. */
|
|
900
|
+
decorative?: boolean;
|
|
901
|
+
/** Text in the middle of a horizontal line, e.g. "or". */
|
|
902
|
+
label?: ReactNode;
|
|
903
|
+
/** Line strength. `hairline` (default) or `frame` (a little darker). */
|
|
904
|
+
tone?: 'hairline' | 'frame';
|
|
905
|
+
}
|
|
906
|
+
/** A 1px line between groups of content, horizontal or vertical. */
|
|
907
|
+
declare const Separator: react.ForwardRefExoticComponent<SeparatorProps & react.RefAttributes<HTMLDivElement>>;
|
|
908
|
+
|
|
909
|
+
type MeterState = 'neutral' | 'optimum' | 'suboptimum' | 'critical';
|
|
910
|
+
interface MeterProps extends Omit<HTMLAttributes<HTMLDivElement>, 'children'> {
|
|
911
|
+
/** The reading. Clamped to min…max for the bar and aria-valuenow. */
|
|
912
|
+
value: number;
|
|
913
|
+
min?: number;
|
|
914
|
+
max?: number;
|
|
915
|
+
/** Upper end of the "low" region. */
|
|
916
|
+
low?: number;
|
|
917
|
+
/** Lower end of the "high" region. */
|
|
918
|
+
high?: number;
|
|
919
|
+
/** The best value. With low/high it colours the bar like a native <meter>: good, so-so, bad. */
|
|
920
|
+
optimum?: number;
|
|
921
|
+
label?: ReactNode;
|
|
922
|
+
/** Show the formatted value on the right of the label. Default true. */
|
|
923
|
+
showValue?: boolean;
|
|
924
|
+
/** `Intl.NumberFormat` options. Default percent of the range; any other style formats the value itself. */
|
|
925
|
+
formatOptions?: Intl.NumberFormatOptions;
|
|
926
|
+
locale?: string;
|
|
927
|
+
/** Screen-reader text for the value, e.g. "42 of 50 GB used". */
|
|
928
|
+
getValueLabel?: (value: number, formatted: string) => string;
|
|
929
|
+
size?: 'sm' | 'md' | 'lg';
|
|
930
|
+
}
|
|
931
|
+
/** Native <meter> rules: which region the value is in relative to the optimum. */
|
|
932
|
+
declare function meterState(value: number, min: number, max: number, low?: number, high?: number, optimum?: number): MeterState;
|
|
933
|
+
/** A value in a known range — storage, quota, score. Not for task progress (use Progress). */
|
|
934
|
+
declare const Meter: react.ForwardRefExoticComponent<MeterProps & react.RefAttributes<HTMLDivElement>>;
|
|
935
|
+
|
|
936
|
+
interface ProgressProps extends Omit<HTMLAttributes<HTMLDivElement>, 'children'> {
|
|
937
|
+
/** How far along, between min and max. `null` = under way, amount unknown (indeterminate). */
|
|
938
|
+
value: number | null;
|
|
939
|
+
min?: number;
|
|
940
|
+
max?: number;
|
|
941
|
+
label?: ReactNode;
|
|
942
|
+
/** Show the formatted value next to the label. Default true (hidden while indeterminate). */
|
|
943
|
+
showValue?: boolean;
|
|
944
|
+
/** `Intl.NumberFormat` options. Default percent of the range. */
|
|
945
|
+
formatOptions?: Intl.NumberFormatOptions;
|
|
946
|
+
locale?: string;
|
|
947
|
+
/** Screen-reader text, e.g. "3 of 12 files". Receives null while indeterminate. */
|
|
948
|
+
getValueLabel?: (value: number | null, formatted: string) => string;
|
|
949
|
+
size?: 'sm' | 'md' | 'lg';
|
|
950
|
+
}
|
|
951
|
+
/** Task progress: a bar that fills as work completes, or slides while the amount is unknown. */
|
|
952
|
+
declare const Progress: react.ForwardRefExoticComponent<ProgressProps & react.RefAttributes<HTMLDivElement>>;
|
|
953
|
+
|
|
954
|
+
interface SkeletonProps {
|
|
955
|
+
/** Render a text placeholder inline so the surrounding typography owns the line height. */
|
|
956
|
+
inline?: boolean;
|
|
957
|
+
width?: CSSProperties['width'];
|
|
958
|
+
height?: CSSProperties['height'];
|
|
959
|
+
radius?: RadiusValue;
|
|
960
|
+
className?: string;
|
|
961
|
+
style?: CSSProperties;
|
|
962
|
+
}
|
|
963
|
+
/** A decorative placeholder that reserves the space of loading content. */
|
|
964
|
+
declare function Skeleton({ inline, width, height, radius, className, style }: SkeletonProps): react.JSX.Element;
|
|
965
|
+
|
|
966
|
+
interface EmptyStateProps extends Omit<HTMLAttributes<HTMLDivElement>, 'children'> {
|
|
967
|
+
title: string;
|
|
968
|
+
description?: string;
|
|
969
|
+
/** Decorative icon above the title. */
|
|
970
|
+
icon?: ReactNode;
|
|
971
|
+
/** Optional next step, usually a Button or link. */
|
|
972
|
+
action?: ReactNode;
|
|
973
|
+
headingLevel?: 2 | 3 | 4;
|
|
974
|
+
}
|
|
975
|
+
/** Explains why no content is available and offers a next step when one exists. */
|
|
976
|
+
declare function EmptyState({ title, description, icon, action, headingLevel, className, ...rest }: EmptyStateProps): react.JSX.Element;
|
|
977
|
+
|
|
978
|
+
interface RatingProps {
|
|
979
|
+
/** The score; `null` = not rated yet. Read-only ratings may be fractional (4.2). */
|
|
980
|
+
value?: number | null;
|
|
981
|
+
defaultValue?: number | null;
|
|
982
|
+
onValueChange?: (value: number | null) => void;
|
|
983
|
+
/** Number of stars. Default 5. */
|
|
984
|
+
max?: number;
|
|
985
|
+
/** `0.5` allows half stars. Default 1. */
|
|
986
|
+
step?: 1 | 0.5;
|
|
987
|
+
/** Pressing the checked star clears the score. */
|
|
988
|
+
deselectable?: boolean;
|
|
989
|
+
disabled?: boolean;
|
|
990
|
+
/** Shows the score as an image (role="img"); any fraction shows. */
|
|
991
|
+
readOnly?: boolean;
|
|
992
|
+
required?: boolean;
|
|
993
|
+
/** Submits the score under this name. */
|
|
994
|
+
name?: string;
|
|
995
|
+
/** Arrow keys wrap from the last star to the first. Default false. */
|
|
996
|
+
loop?: boolean;
|
|
997
|
+
/** Accessible name for a score. Default "3 stars" / "3 out of 5 stars" when read-only. */
|
|
998
|
+
getValueLabel?: (value: number, max: number) => string;
|
|
999
|
+
size?: 'sm' | 'md' | 'lg';
|
|
1000
|
+
id?: string;
|
|
1001
|
+
className?: string;
|
|
1002
|
+
style?: CSSProperties;
|
|
1003
|
+
'aria-label'?: string;
|
|
1004
|
+
'aria-labelledby'?: string;
|
|
1005
|
+
}
|
|
1006
|
+
/** Star rating. A radio group of scores with hover preview, half steps and keyboard. */
|
|
1007
|
+
declare function Rating({ value, defaultValue, onValueChange, max, step, deselectable, disabled, readOnly, required, name, loop, getValueLabel, size, id, className, style, 'aria-label': ariaLabel, 'aria-labelledby': ariaLabelledBy, }: RatingProps): react.JSX.Element;
|
|
1008
|
+
|
|
1009
|
+
type AnyProps = Record<string, unknown>;
|
|
1010
|
+
/** Replace a part's default element: an element to clone, or a function of (props, state). */
|
|
1011
|
+
type PartRender<S = {
|
|
1012
|
+
open: boolean;
|
|
1013
|
+
}> = ReactElement | ((props: AnyProps, state: S) => ReactElement);
|
|
1014
|
+
/** Merge two prop bags. `over` wins, except handlers (both run, `over` first), className, style and ref. */
|
|
1015
|
+
declare function mergeProps(base: AnyProps, over: AnyProps): AnyProps;
|
|
1016
|
+
/** Render a part: `render` element/function if given, else `fallback(props)`. */
|
|
1017
|
+
declare function renderPart<S>(render: PartRender<S> | undefined, props: AnyProps, state: S, fallback: (props: AnyProps) => ReactElement): ReactElement;
|
|
1018
|
+
/** Props of a trigger/close part: everything Button takes, plus `render`. */
|
|
1019
|
+
type PartButtonProps<S = {
|
|
1020
|
+
open: boolean;
|
|
1021
|
+
}> = ButtonProps & {
|
|
1022
|
+
/** Render a different element instead of the default `<Button>`. See the trigger pattern. */
|
|
1023
|
+
render?: PartRender<S>;
|
|
1024
|
+
};
|
|
1025
|
+
type Side$1 = 'top' | 'bottom' | 'left' | 'right';
|
|
1026
|
+
type Align = 'start' | 'center' | 'end';
|
|
1027
|
+
interface SurfaceTextProps extends React.HTMLAttributes<HTMLElement> {
|
|
1028
|
+
children?: ReactNode;
|
|
1029
|
+
}
|
|
1030
|
+
type SurfaceCloseProps = PartButtonProps<object>;
|
|
1031
|
+
|
|
1032
|
+
interface PopoverProps {
|
|
1033
|
+
open?: boolean;
|
|
1034
|
+
defaultOpen?: boolean;
|
|
1035
|
+
onOpenChange?: (open: boolean) => void;
|
|
1036
|
+
/** Trap focus and lock page scroll while open. Default false (Tab out or a press outside closes it). */
|
|
1037
|
+
modal?: boolean;
|
|
1038
|
+
children?: ReactNode;
|
|
1039
|
+
}
|
|
1040
|
+
/** A small dialog anchored to its trigger: fields, buttons or any interactive content. */
|
|
1041
|
+
declare function Popover({ open: openProp, defaultOpen, onOpenChange, modal, children }: PopoverProps): react.JSX.Element;
|
|
1042
|
+
type PopoverTriggerProps = PartButtonProps;
|
|
1043
|
+
/** Opens and closes the popover. Renders an SW3 Button (variant `outline`) unless you pass `render`. */
|
|
1044
|
+
declare const PopoverTrigger: react.ForwardRefExoticComponent<Omit<PopoverTriggerProps, "ref"> & react.RefAttributes<HTMLButtonElement>>;
|
|
1045
|
+
interface PopoverContentProps extends Omit<HTMLAttributes<HTMLDivElement>, 'style'> {
|
|
1046
|
+
/** Side of the trigger it opens on. Flips when there is no room. Default 'bottom'. */
|
|
1047
|
+
side?: Side$1;
|
|
1048
|
+
/** Alignment along that side. Default 'center'. */
|
|
1049
|
+
align?: Align;
|
|
1050
|
+
/** Gap to the trigger in px. Default 6. */
|
|
1051
|
+
sideOffset?: number;
|
|
1052
|
+
/** Inner padding: 'md' 16px, 'sm' 12px. Blocks sit 16px apart (12 for 'sm'); title → description 6px. Default 'md'. */
|
|
1053
|
+
padding?: 'none' | 'sm' | 'md';
|
|
1054
|
+
/** Element to focus on open. Default: the first focusable element, else the panel. */
|
|
1055
|
+
initialFocus?: React.RefObject<HTMLElement | null>;
|
|
1056
|
+
style?: CSSProperties;
|
|
1057
|
+
children?: ReactNode;
|
|
1058
|
+
}
|
|
1059
|
+
/** The floating panel (role="dialog"). Mount it unconditionally; it renders while open. */
|
|
1060
|
+
declare function PopoverContent({ side, align, sideOffset, padding, initialFocus, className, children, onBlur, ...rest }: PopoverContentProps): react.JSX.Element;
|
|
1061
|
+
/** Names the popover (h2). Wires aria-labelledby. */
|
|
1062
|
+
declare const PopoverTitle: (p: SurfaceTextProps) => react.JSX.Element;
|
|
1063
|
+
/** Adds context (p). Wires aria-describedby. */
|
|
1064
|
+
declare const PopoverDescription: (p: SurfaceTextProps) => react.JSX.Element;
|
|
1065
|
+
/** Closes the popover. Renders a Button (variant `secondary`) unless you pass `render`. */
|
|
1066
|
+
declare const PopoverClose: (p: SurfaceCloseProps) => react.JSX.Element;
|
|
1067
|
+
|
|
1068
|
+
interface CitationChipProps extends Omit<HTMLAttributes<HTMLSpanElement>, 'children'>, Pick<PopoverProps, 'open' | 'defaultOpen' | 'onOpenChange'> {
|
|
1069
|
+
reference: string;
|
|
1070
|
+
title: string;
|
|
1071
|
+
href: string;
|
|
1072
|
+
publisher?: string;
|
|
1073
|
+
excerpt?: string;
|
|
1074
|
+
}
|
|
1075
|
+
/** An inline source reference with a keyboard-accessible preview and a link to the original. */
|
|
1076
|
+
declare function CitationChip({ reference, title, href, publisher, excerpt, open: openProp, defaultOpen, onOpenChange, className, ...rest }: CitationChipProps): react.JSX.Element | null;
|
|
1077
|
+
|
|
1078
|
+
interface TooltipProps {
|
|
1079
|
+
/** Shorthand: the tip text. Wraps the single child element as the trigger: `<Tooltip content="Copy"><Button/></Tooltip>`. */
|
|
1080
|
+
content?: ReactNode;
|
|
1081
|
+
open?: boolean;
|
|
1082
|
+
defaultOpen?: boolean;
|
|
1083
|
+
onOpenChange?: (open: boolean) => void;
|
|
1084
|
+
/** ms the pointer rests before it opens. Default 600. Keyboard focus opens at once. */
|
|
1085
|
+
delay?: number;
|
|
1086
|
+
/** ms before it closes once the pointer leaves trigger and tip. Default 100. */
|
|
1087
|
+
closeDelay?: number;
|
|
1088
|
+
/** Stop it from opening; the trigger keeps working. */
|
|
1089
|
+
disabled?: boolean;
|
|
1090
|
+
/** Whether the tip names the trigger (`label`) or describes it. Default: label for triggers without a name (icon buttons), description otherwise. */
|
|
1091
|
+
type?: 'label' | 'description';
|
|
1092
|
+
/** Close when the trigger is pressed. Default true. */
|
|
1093
|
+
closeOnPress?: boolean;
|
|
1094
|
+
/** Shorthand placement (with `content`). */
|
|
1095
|
+
side?: Side$1;
|
|
1096
|
+
align?: Align;
|
|
1097
|
+
sideOffset?: number;
|
|
1098
|
+
children?: ReactNode;
|
|
1099
|
+
}
|
|
1100
|
+
/** A short plain-text hint on hover and keyboard focus. */
|
|
1101
|
+
declare function Tooltip({ content, open: openProp, defaultOpen, onOpenChange, delay, closeDelay, disabled, type, closeOnPress, side, align, sideOffset, children, }: TooltipProps): react.JSX.Element;
|
|
1102
|
+
type TooltipTriggerProps = PartButtonProps;
|
|
1103
|
+
/** The element the tip belongs to. Renders an SW3 Button (variant `outline`) unless you pass `render`. */
|
|
1104
|
+
declare const TooltipTrigger: react.ForwardRefExoticComponent<Omit<TooltipTriggerProps, "ref"> & react.RefAttributes<HTMLButtonElement>>;
|
|
1105
|
+
interface TooltipContentProps extends Omit<HTMLAttributes<HTMLDivElement>, 'style' | 'content'> {
|
|
1106
|
+
/** Default 'top'. */
|
|
1107
|
+
side?: Side$1;
|
|
1108
|
+
/** Default 'center'. */
|
|
1109
|
+
align?: Align;
|
|
1110
|
+
/** Gap in px. Default 6. */
|
|
1111
|
+
sideOffset?: number;
|
|
1112
|
+
/** Optional keyboard hint shown after the text, e.g. "⌘C". */
|
|
1113
|
+
shortcut?: ReactNode;
|
|
1114
|
+
style?: React.CSSProperties;
|
|
1115
|
+
children?: ReactNode;
|
|
1116
|
+
}
|
|
1117
|
+
/** The tip (role="tooltip"). Plain text only — nothing in it can be focused. */
|
|
1118
|
+
declare function TooltipContent({ side, align, sideOffset, shortcut, className, children, ...rest }: TooltipContentProps): react.JSX.Element;
|
|
1119
|
+
|
|
1120
|
+
interface HoverCardProps {
|
|
1121
|
+
open?: boolean;
|
|
1122
|
+
defaultOpen?: boolean;
|
|
1123
|
+
onOpenChange?: (open: boolean) => void;
|
|
1124
|
+
/** ms the pointer (or keyboard focus) rests on the link before it opens. Default 600. */
|
|
1125
|
+
delay?: number;
|
|
1126
|
+
/** ms before it closes once the pointer leaves link and card. Default 300. */
|
|
1127
|
+
closeDelay?: number;
|
|
1128
|
+
/** Never open; the trigger stays a plain link. */
|
|
1129
|
+
disabled?: boolean;
|
|
1130
|
+
children?: ReactNode;
|
|
1131
|
+
}
|
|
1132
|
+
/** A preview of where a link goes, shown on hover or keyboard focus. The link still navigates. */
|
|
1133
|
+
declare function HoverCard({ open: openProp, defaultOpen, onOpenChange, delay, closeDelay, disabled, children }: HoverCardProps): react.JSX.Element;
|
|
1134
|
+
interface HoverCardTriggerProps extends AnchorHTMLAttributes<HTMLAnchorElement> {
|
|
1135
|
+
/** Render a different element (e.g. a router Link) instead of `<a>`. */
|
|
1136
|
+
render?: PartRender;
|
|
1137
|
+
children?: ReactNode;
|
|
1138
|
+
}
|
|
1139
|
+
/** The link. Renders an `<a>` — give it an `href`. */
|
|
1140
|
+
declare const HoverCardTrigger: react.ForwardRefExoticComponent<HoverCardTriggerProps & react.RefAttributes<HTMLAnchorElement>>;
|
|
1141
|
+
interface HoverCardContentProps extends Omit<HTMLAttributes<HTMLDivElement>, 'style'> {
|
|
1142
|
+
/** Default 'bottom'. */
|
|
1143
|
+
side?: Side$1;
|
|
1144
|
+
/** Default 'center'. */
|
|
1145
|
+
align?: Align;
|
|
1146
|
+
/** Gap in px. Default 8. */
|
|
1147
|
+
sideOffset?: number;
|
|
1148
|
+
style?: React.CSSProperties;
|
|
1149
|
+
children?: ReactNode;
|
|
1150
|
+
}
|
|
1151
|
+
/** The preview card. Keep everything in it reachable from the linked page too. */
|
|
1152
|
+
declare function HoverCardContent({ side, align, sideOffset, className, children, ...rest }: HoverCardContentProps): react.JSX.Element;
|
|
1153
|
+
|
|
1154
|
+
/** @internal */
|
|
1155
|
+
interface ModalRootOptions {
|
|
1156
|
+
open?: boolean;
|
|
1157
|
+
defaultOpen?: boolean;
|
|
1158
|
+
onOpenChange?: (open: boolean) => void;
|
|
1159
|
+
modal?: boolean;
|
|
1160
|
+
dismissible?: boolean;
|
|
1161
|
+
closeOnOutsidePress?: boolean;
|
|
1162
|
+
}
|
|
1163
|
+
interface DialogProps extends ModalRootOptions {
|
|
1164
|
+
/** Trap focus, lock scroll and dim the page. Default true. */
|
|
1165
|
+
modal?: boolean;
|
|
1166
|
+
/** Whether Escape and outside presses can close it. Close parts always can. Default true. */
|
|
1167
|
+
dismissible?: boolean;
|
|
1168
|
+
/** Whether pressing the backdrop closes it. Default true. */
|
|
1169
|
+
closeOnOutsidePress?: boolean;
|
|
1170
|
+
children?: ReactNode;
|
|
1171
|
+
}
|
|
1172
|
+
/** A modal panel for a focused task. Compose with DialogTrigger + DialogContent. */
|
|
1173
|
+
declare function Dialog({ children, ...o }: DialogProps): react.JSX.Element;
|
|
1174
|
+
type DialogTriggerProps = PartButtonProps;
|
|
1175
|
+
/** Opens the dialog. Renders a Button (variant `outline`) unless you pass `render`. */
|
|
1176
|
+
declare const DialogTrigger: react.ForwardRefExoticComponent<Omit<DialogTriggerProps, "ref"> & react.RefAttributes<HTMLButtonElement>>;
|
|
1177
|
+
interface DialogContentProps extends Omit<HTMLAttributes<HTMLDivElement>, 'role'> {
|
|
1178
|
+
/** Max width: sm 400, md 520, lg 720px. Default 'md'. On phones it is full width, docked near the bottom. */
|
|
1179
|
+
size?: 'sm' | 'md' | 'lg';
|
|
1180
|
+
/** Show the × close button in the corner. Default true. */
|
|
1181
|
+
closeButton?: boolean;
|
|
1182
|
+
/** Element to focus on open. Default: `[data-autofocus]`, else the first focusable. */
|
|
1183
|
+
initialFocus?: React.RefObject<HTMLElement | null>;
|
|
1184
|
+
children?: ReactNode;
|
|
1185
|
+
}
|
|
1186
|
+
/** The centered modal panel (role="dialog"). Mount it unconditionally; it renders while open. */
|
|
1187
|
+
declare function DialogContent({ closeButton, ...p }: DialogContentProps): react.JSX.Element;
|
|
1188
|
+
/** Groups the title and description at the top. */
|
|
1189
|
+
declare function DialogHeader({ className, ...p }: HTMLAttributes<HTMLDivElement>): react.JSX.Element;
|
|
1190
|
+
/** The scrollable middle. The header and footer stay in view. */
|
|
1191
|
+
declare function DialogBody({ className, ...p }: HTMLAttributes<HTMLDivElement>): react.JSX.Element;
|
|
1192
|
+
/** Action row at the bottom, right-aligned (stacked on phones). */
|
|
1193
|
+
declare function DialogFooter({ className, ...p }: HTMLAttributes<HTMLDivElement>): react.JSX.Element;
|
|
1194
|
+
/** Names the dialog (h2, aria-labelledby). */
|
|
1195
|
+
declare const DialogTitle: (p: SurfaceTextProps) => react.JSX.Element;
|
|
1196
|
+
/** Describes the dialog (p, aria-describedby). */
|
|
1197
|
+
declare const DialogDescription: (p: SurfaceTextProps) => react.JSX.Element;
|
|
1198
|
+
/** Closes the dialog. Renders a Button (variant `secondary`) unless you pass `render`. */
|
|
1199
|
+
declare const DialogClose: (p: SurfaceCloseProps) => react.JSX.Element;
|
|
1200
|
+
|
|
1201
|
+
interface AlertDialogProps {
|
|
1202
|
+
open?: boolean;
|
|
1203
|
+
defaultOpen?: boolean;
|
|
1204
|
+
onOpenChange?: (open: boolean) => void;
|
|
1205
|
+
/** Whether Escape closes it (as Cancel). Pressing outside never does. Default true. */
|
|
1206
|
+
dismissible?: boolean;
|
|
1207
|
+
children?: ReactNode;
|
|
1208
|
+
}
|
|
1209
|
+
/** A modal question that needs an explicit answer (role="alertdialog"). */
|
|
1210
|
+
declare function AlertDialog({ children, ...o }: AlertDialogProps): react.JSX.Element;
|
|
1211
|
+
type AlertDialogTriggerProps = PartButtonProps;
|
|
1212
|
+
/** Opens the alert dialog. Renders a Button (variant `outline`) unless you pass `render`. */
|
|
1213
|
+
declare const AlertDialogTrigger: react.ForwardRefExoticComponent<Omit<AlertDialogTriggerProps, "ref"> & react.RefAttributes<HTMLButtonElement>>;
|
|
1214
|
+
type AlertDialogContentProps = Omit<DialogContentProps, 'closeButton'>;
|
|
1215
|
+
/** The panel. Focus starts on AlertDialogCancel. */
|
|
1216
|
+
declare function AlertDialogContent({ size, ...p }: AlertDialogContentProps): react.JSX.Element;
|
|
1217
|
+
declare const AlertDialogHeader: typeof DialogHeader;
|
|
1218
|
+
declare const AlertDialogFooter: typeof DialogFooter;
|
|
1219
|
+
/** The question, e.g. "Delete this project?" (aria-labelledby). */
|
|
1220
|
+
declare const AlertDialogTitle: (p: SurfaceTextProps) => react.JSX.Element;
|
|
1221
|
+
/** What agreeing does (aria-describedby). */
|
|
1222
|
+
declare const AlertDialogDescription: (p: SurfaceTextProps) => react.JSX.Element;
|
|
1223
|
+
/** The safe answer. Closes the dialog and gets initial focus. Put it first. */
|
|
1224
|
+
declare const AlertDialogCancel: ({ children, ...p }: SurfaceCloseProps) => react.JSX.Element;
|
|
1225
|
+
interface AlertDialogActionProps extends Omit<PartButtonProps<{
|
|
1226
|
+
pending: boolean;
|
|
1227
|
+
}>, 'onClick'> {
|
|
1228
|
+
/** Runs on press. Return a Promise to keep the dialog open (button shows loading) until it resolves; a rejection keeps it open. */
|
|
1229
|
+
onClick?: (event: React.MouseEvent<HTMLButtonElement>) => unknown;
|
|
1230
|
+
}
|
|
1231
|
+
/** The agreeing answer. `variant="danger"` for destructive actions. Closes after `onClick` (and its Promise) finishes. */
|
|
1232
|
+
declare function AlertDialogAction({ render, onClick, variant, children, ...rest }: AlertDialogActionProps): react.ReactElement<unknown, string | react.JSXElementConstructor<any>>;
|
|
1233
|
+
interface ConfirmOptions {
|
|
1234
|
+
/** The question, e.g. "Delete this project?". */
|
|
1235
|
+
title: ReactNode;
|
|
1236
|
+
/** What agreeing does. */
|
|
1237
|
+
description?: ReactNode;
|
|
1238
|
+
/** Agreeing button text. Default "Confirm". */
|
|
1239
|
+
confirmLabel?: string;
|
|
1240
|
+
/** Other button text. Default "Cancel". */
|
|
1241
|
+
cancelLabel?: string;
|
|
1242
|
+
/** `danger` paints the confirm button red. Default 'primary'. */
|
|
1243
|
+
variant?: 'primary' | 'danger';
|
|
1244
|
+
}
|
|
1245
|
+
/**
|
|
1246
|
+
* Ask a question from anywhere and await the answer: `if (await confirm({ title: 'Delete?' })) …`.
|
|
1247
|
+
* Resolves `true` for the confirm button, `false` for Cancel or Escape. Needs `<ConfirmHost/>` (or `<OverlayHost/>`) mounted once.
|
|
1248
|
+
* Calls queue: the next question shows after the previous one is answered.
|
|
1249
|
+
*/
|
|
1250
|
+
declare function confirm(options: ConfirmOptions): Promise<boolean>;
|
|
1251
|
+
/** Renders the questions asked with `confirm()`. Place once near the app root. */
|
|
1252
|
+
declare function ConfirmHost(): react.JSX.Element | null;
|
|
1253
|
+
|
|
1254
|
+
type DrawerSide = 'bottom' | 'top' | 'left' | 'right';
|
|
1255
|
+
interface DrawerProps extends ModalRootOptions {
|
|
1256
|
+
/** Edge it slides in from. Default 'bottom'. */
|
|
1257
|
+
side?: DrawerSide;
|
|
1258
|
+
/** Trap focus, lock scroll, dim the page. Default true. */
|
|
1259
|
+
modal?: boolean;
|
|
1260
|
+
/** Whether Escape, a backdrop press and swiping can close it. Close parts always can. Default true. */
|
|
1261
|
+
dismissible?: boolean;
|
|
1262
|
+
/** Whether pressing the backdrop closes it. Default true. */
|
|
1263
|
+
closeOnOutsidePress?: boolean;
|
|
1264
|
+
/** Resting sizes along the drawer's axis: fractions of the viewport (≤ 1) or px (> 1), e.g. `[0.4, 0.9]`. */
|
|
1265
|
+
snapPoints?: number[];
|
|
1266
|
+
/** Controlled snap point (one of `snapPoints`). */
|
|
1267
|
+
snapPoint?: number;
|
|
1268
|
+
/** Snap point it opens at. Default: the smallest. */
|
|
1269
|
+
defaultSnapPoint?: number;
|
|
1270
|
+
onSnapPointChange?: (snapPoint: number) => void;
|
|
1271
|
+
children?: ReactNode;
|
|
1272
|
+
}
|
|
1273
|
+
/** A sheet that slides in from an edge. Drag it toward its edge to dismiss; optional snap points. */
|
|
1274
|
+
declare function Drawer({ side, snapPoints, snapPoint, defaultSnapPoint, onSnapPointChange, children, ...o }: DrawerProps): react.JSX.Element;
|
|
1275
|
+
type DrawerTriggerProps = PartButtonProps;
|
|
1276
|
+
/** Opens the drawer. Renders a Button (variant `outline`) unless you pass `render`. */
|
|
1277
|
+
declare const DrawerTrigger: react.ForwardRefExoticComponent<Omit<DrawerTriggerProps, "ref"> & react.RefAttributes<HTMLButtonElement>>;
|
|
1278
|
+
interface DrawerContentProps extends Omit<HTMLAttributes<HTMLDivElement>, 'onDrag' | 'onDragStart' | 'onDragEnd' | 'onAnimationStart'> {
|
|
1279
|
+
/** Show the grab handle. Default true for top/bottom drawers. With several snap points it is a button that cycles them. */
|
|
1280
|
+
handle?: boolean;
|
|
1281
|
+
/** Element to focus on open. Default: `[data-autofocus]`, else the first focusable. */
|
|
1282
|
+
initialFocus?: React.RefObject<HTMLElement | null>;
|
|
1283
|
+
children?: ReactNode;
|
|
1284
|
+
}
|
|
1285
|
+
/** The sheet (role="dialog"). Mount it unconditionally; it renders while open. */
|
|
1286
|
+
declare function DrawerContent({ handle, initialFocus, className, style, children, ...rest }: DrawerContentProps): react.JSX.Element;
|
|
1287
|
+
/** Groups title and description. */
|
|
1288
|
+
declare function DrawerHeader({ className, ...p }: HTMLAttributes<HTMLDivElement>): react.JSX.Element;
|
|
1289
|
+
/** Scrollable middle. Dragging starts here only when it is scrolled to the top. */
|
|
1290
|
+
declare function DrawerBody({ className, ...p }: HTMLAttributes<HTMLDivElement>): react.JSX.Element;
|
|
1291
|
+
/** Action row at the bottom. */
|
|
1292
|
+
declare function DrawerFooter({ className, ...p }: HTMLAttributes<HTMLDivElement>): react.JSX.Element;
|
|
1293
|
+
/** Names the drawer (h2, aria-labelledby). */
|
|
1294
|
+
declare const DrawerTitle: (p: SurfaceTextProps) => react.JSX.Element;
|
|
1295
|
+
/** Describes the drawer (p, aria-describedby). */
|
|
1296
|
+
declare const DrawerDescription: (p: SurfaceTextProps) => react.JSX.Element;
|
|
1297
|
+
/** Closes the drawer. Renders a Button (variant `secondary`) unless you pass `render`. */
|
|
1298
|
+
declare const DrawerClose: (p: SurfaceCloseProps) => react.JSX.Element;
|
|
1299
|
+
|
|
1300
|
+
type ToastVariant = 'default' | 'success' | 'danger' | 'loading';
|
|
1301
|
+
interface ToastAction {
|
|
1302
|
+
label: ReactNode;
|
|
1303
|
+
/** Runs on press. Return a Promise to show the button as loading; the toast closes when it resolves. */
|
|
1304
|
+
onClick?: (event: React.MouseEvent<HTMLButtonElement>) => unknown;
|
|
1305
|
+
}
|
|
1306
|
+
interface ToastOptions {
|
|
1307
|
+
/** Reuse an id to update a toast that is still showing instead of adding another. */
|
|
1308
|
+
id?: string;
|
|
1309
|
+
description?: ReactNode;
|
|
1310
|
+
/** `danger` is announced assertively. `loading` shows a spinner and stays until updated. */
|
|
1311
|
+
variant?: ToastVariant;
|
|
1312
|
+
/** ms before it closes. Default 5000 (from the Toaster). `Infinity` keeps it until dismissed. */
|
|
1313
|
+
duration?: number;
|
|
1314
|
+
/** A button that does something, like Undo. */
|
|
1315
|
+
action?: ToastAction;
|
|
1316
|
+
/** A quiet button that just closes it, like "Got it". */
|
|
1317
|
+
cancel?: {
|
|
1318
|
+
label: ReactNode;
|
|
1319
|
+
onClick?: () => void;
|
|
1320
|
+
};
|
|
1321
|
+
/** Whether swipe, Escape and the × can close it. Timers and `toast.dismiss()` still can. Default true. */
|
|
1322
|
+
dismissible?: boolean;
|
|
1323
|
+
/** Called once it closes. */
|
|
1324
|
+
onDismiss?: (id: string) => void;
|
|
1325
|
+
}
|
|
1326
|
+
interface ToastItem extends ToastOptions {
|
|
1327
|
+
id: string;
|
|
1328
|
+
title: ReactNode;
|
|
1329
|
+
variant: ToastVariant;
|
|
1330
|
+
/** Bumped on update so the timer restarts. */
|
|
1331
|
+
version: number;
|
|
1332
|
+
}
|
|
1333
|
+
type Message<T> = ReactNode | ({
|
|
1334
|
+
title: ReactNode;
|
|
1335
|
+
} & ToastOptions) | ((value: T) => ReactNode | ({
|
|
1336
|
+
title: ReactNode;
|
|
1337
|
+
} & ToastOptions));
|
|
1338
|
+
/**
|
|
1339
|
+
* Show a toast from anywhere: `toast('Saved', { description, action, variant, duration })`. Returns its id.
|
|
1340
|
+
* Needs `<Toaster/>` (or `<OverlayHost/>`) mounted once.
|
|
1341
|
+
*/
|
|
1342
|
+
declare const toast: ((title: ReactNode, options?: ToastOptions) => string) & {
|
|
1343
|
+
success: (title: ReactNode, o?: ToastOptions) => string;
|
|
1344
|
+
danger: (title: ReactNode, o?: ToastOptions) => string;
|
|
1345
|
+
/** Alias of `danger`. */
|
|
1346
|
+
error: (title: ReactNode, o?: ToastOptions) => string;
|
|
1347
|
+
loading: (title: ReactNode, o?: ToastOptions) => string;
|
|
1348
|
+
/** Change a toast that is still showing. Returns false if it is gone. */
|
|
1349
|
+
update(id: string, patch: Partial<ToastOptions> & {
|
|
1350
|
+
title?: ReactNode;
|
|
1351
|
+
}): boolean;
|
|
1352
|
+
/** Close one toast, or every toast when called without an id. */
|
|
1353
|
+
dismiss(id?: string): void;
|
|
1354
|
+
/**
|
|
1355
|
+
* Loading toast that turns into success or danger when the promise settles. Returns the toast id.
|
|
1356
|
+
* `toast.promise(save(), { loading: 'Saving…', success: 'Saved', error: (e) => ({ title: 'Failed', description: String(e) }) })`
|
|
1357
|
+
*/
|
|
1358
|
+
promise<T>(promise: Promise<T> | (() => Promise<T>), m: {
|
|
1359
|
+
loading: ReactNode;
|
|
1360
|
+
success: Message<T>;
|
|
1361
|
+
error: Message<unknown>;
|
|
1362
|
+
}): string;
|
|
1363
|
+
};
|
|
1364
|
+
interface ToasterProps {
|
|
1365
|
+
/** Edge of the viewport. Default 'bottom'. */
|
|
1366
|
+
side?: 'top' | 'bottom';
|
|
1367
|
+
/** Position along that edge. Default 'end'. */
|
|
1368
|
+
align?: 'start' | 'center' | 'end';
|
|
1369
|
+
/** How many show at once; the rest wait (timers stopped). Default 3. */
|
|
1370
|
+
maxVisible?: number;
|
|
1371
|
+
/** Keep the stack expanded. Otherwise it expands on hover / focus. */
|
|
1372
|
+
expanded?: boolean;
|
|
1373
|
+
/** Default duration in ms. Default 5000. */
|
|
1374
|
+
duration?: number;
|
|
1375
|
+
/** Show the × on dismissible toasts. Default true. */
|
|
1376
|
+
closeButton?: boolean;
|
|
1377
|
+
/** Key that moves focus into the region and back. Default 'F6'. `null` turns it off. */
|
|
1378
|
+
shortcut?: string | null;
|
|
1379
|
+
/** Landmark name. Default "Notifications". */
|
|
1380
|
+
'aria-label'?: string;
|
|
1381
|
+
}
|
|
1382
|
+
/** The host for `toast()`. Place it once near the app root. Stacks, pauses on hover, swipes away, announces politely. */
|
|
1383
|
+
declare function Toaster({ side, align, maxVisible, expanded: alwaysExpanded, duration, closeButton, shortcut, 'aria-label': ariaLabel, }: ToasterProps): react.JSX.Element | null;
|
|
1384
|
+
type OverlayHostProps = ToasterProps;
|
|
1385
|
+
/** `<Toaster/>` + `<ConfirmHost/>` in one: the host for `toast()` and `confirm()`. Place once near the app root. */
|
|
1386
|
+
declare function OverlayHost(props: OverlayHostProps): react.JSX.Element;
|
|
1387
|
+
|
|
1388
|
+
interface MenuProps {
|
|
1389
|
+
children?: ReactNode;
|
|
1390
|
+
open?: boolean;
|
|
1391
|
+
defaultOpen?: boolean;
|
|
1392
|
+
onOpenChange?(open: boolean): void;
|
|
1393
|
+
/** Runs for every plain item (also in submenus) with the item's `value`. */
|
|
1394
|
+
onAction?(value: string): void;
|
|
1395
|
+
/** Arrow keys wrap from last to first. Default true. */
|
|
1396
|
+
loop?: boolean;
|
|
1397
|
+
}
|
|
1398
|
+
/** A menu of actions opened from a button (`MenuTrigger`) or a right-click area (`MenuContextTrigger`). */
|
|
1399
|
+
declare function Menu({ children, open: openProp, defaultOpen, onOpenChange, onAction, loop }: MenuProps): react.JSX.Element;
|
|
1400
|
+
/** Same as `Menu`; reads better next to `ContextMenuTrigger`. */
|
|
1401
|
+
declare const ContextMenu: typeof Menu;
|
|
1402
|
+
type ContextMenuProps = MenuProps;
|
|
1403
|
+
interface MenuTriggerProps extends Omit<HTMLAttributes<HTMLButtonElement>, 'children'> {
|
|
1404
|
+
children?: ReactNode;
|
|
1405
|
+
/** Clone the single child element (e.g. your own `<Button>`) instead of rendering a button. */
|
|
1406
|
+
asChild?: boolean;
|
|
1407
|
+
disabled?: boolean;
|
|
1408
|
+
size?: 'sm' | 'md' | 'lg';
|
|
1409
|
+
}
|
|
1410
|
+
declare function MenuTrigger({ children, asChild, disabled, size, className, ...rest }: MenuTriggerProps): react.ReactElement<unknown, string | react.JSXElementConstructor<any>>;
|
|
1411
|
+
interface MenuContextTriggerProps extends HTMLAttributes<HTMLDivElement> {
|
|
1412
|
+
children?: ReactNode;
|
|
1413
|
+
asChild?: boolean;
|
|
1414
|
+
/** Let the browser's own menu show instead. */
|
|
1415
|
+
disabled?: boolean;
|
|
1416
|
+
}
|
|
1417
|
+
/** An area that opens the menu at the pointer on right-click, long press, Shift+F10 or the Menu key. */
|
|
1418
|
+
declare function MenuContextTrigger({ children, asChild, disabled, className, ...rest }: MenuContextTriggerProps): react.ReactElement<unknown, string | react.JSXElementConstructor<any>>;
|
|
1419
|
+
declare const ContextMenuTrigger: typeof MenuContextTrigger;
|
|
1420
|
+
type ContextMenuTriggerProps = MenuContextTriggerProps;
|
|
1421
|
+
interface MenuContentProps extends Omit<HTMLAttributes<HTMLDivElement>, 'children'> {
|
|
1422
|
+
children?: ReactNode;
|
|
1423
|
+
/** Default 'bottom-start' (submenus: 'right-start'). */
|
|
1424
|
+
placement?: Placement;
|
|
1425
|
+
/** Gap to the trigger in px. Default 6 (submenus 2). */
|
|
1426
|
+
offset?: number;
|
|
1427
|
+
}
|
|
1428
|
+
/** The popup that holds the items. */
|
|
1429
|
+
declare function MenuContent(props: MenuContentProps): react.JSX.Element;
|
|
1430
|
+
interface ItemBase extends Omit<HTMLAttributes<HTMLDivElement>, 'onSelect'> {
|
|
1431
|
+
children?: ReactNode;
|
|
1432
|
+
/** Text typeahead matches when the content isn't plain text. */
|
|
1433
|
+
label?: string;
|
|
1434
|
+
disabled?: boolean;
|
|
1435
|
+
/** Leading icon. */
|
|
1436
|
+
icon?: ReactNode;
|
|
1437
|
+
/** Shortcut hint like "mod+n" (⌘N / Ctrl+N). Display + aria-keyshortcuts only. */
|
|
1438
|
+
shortcut?: string;
|
|
1439
|
+
}
|
|
1440
|
+
interface MenuItemProps extends ItemBase {
|
|
1441
|
+
/** Passed to the menu's `onAction`. */
|
|
1442
|
+
value?: string;
|
|
1443
|
+
/** Style as dangerous (Delete). */
|
|
1444
|
+
destructive?: boolean;
|
|
1445
|
+
/** Close the menu after it runs. Default true. */
|
|
1446
|
+
closeOnSelect?: boolean;
|
|
1447
|
+
/** Runs when chosen. `event.preventDefault()` keeps the menu open and skips `onAction`. */
|
|
1448
|
+
onSelect?(event: MouseEvent<HTMLDivElement>): void;
|
|
1449
|
+
}
|
|
1450
|
+
declare function MenuItem({ value, label, disabled, destructive, icon, shortcut, closeOnSelect, onSelect, className, children, onClick, ...rest }: MenuItemProps): react.JSX.Element;
|
|
1451
|
+
interface MenuCheckboxItemProps extends ItemBase {
|
|
1452
|
+
value?: string;
|
|
1453
|
+
checked?: boolean;
|
|
1454
|
+
defaultChecked?: boolean;
|
|
1455
|
+
onCheckedChange?(checked: boolean): void;
|
|
1456
|
+
/** Close after toggling. Default false. */
|
|
1457
|
+
closeOnSelect?: boolean;
|
|
1458
|
+
}
|
|
1459
|
+
declare function MenuCheckboxItem({ value, label, disabled, icon, shortcut, checked: c, defaultChecked, onCheckedChange, closeOnSelect, className, children, ...rest }: MenuCheckboxItemProps): react.JSX.Element;
|
|
1460
|
+
interface MenuRadioGroupProps extends Omit<HTMLAttributes<HTMLDivElement>, 'defaultValue' | 'onChange'> {
|
|
1461
|
+
children?: ReactNode;
|
|
1462
|
+
value?: string | null;
|
|
1463
|
+
defaultValue?: string | null;
|
|
1464
|
+
onValueChange?(value: string): void;
|
|
1465
|
+
}
|
|
1466
|
+
declare function MenuRadioGroup({ value, defaultValue, onValueChange, children, ...rest }: MenuRadioGroupProps): react.JSX.Element;
|
|
1467
|
+
interface MenuRadioItemProps extends ItemBase {
|
|
1468
|
+
value: string;
|
|
1469
|
+
/** Close after choosing. Default false. */
|
|
1470
|
+
closeOnSelect?: boolean;
|
|
1471
|
+
}
|
|
1472
|
+
declare function MenuRadioItem({ value, label, disabled, icon, shortcut, closeOnSelect, className, children, ...rest }: MenuRadioItemProps): react.JSX.Element;
|
|
1473
|
+
interface MenuGroupProps extends HTMLAttributes<HTMLDivElement> {
|
|
1474
|
+
/** Shorthand for a `MenuLabel` at the top of the group. */
|
|
1475
|
+
label?: ReactNode;
|
|
1476
|
+
}
|
|
1477
|
+
declare function MenuGroup({ label, children, ...rest }: MenuGroupProps): react.JSX.Element;
|
|
1478
|
+
declare function MenuLabel({ className, ...rest }: HTMLAttributes<HTMLDivElement>): react.JSX.Element;
|
|
1479
|
+
declare function MenuSeparator({ className, ...rest }: HTMLAttributes<HTMLDivElement>): react.JSX.Element;
|
|
1480
|
+
declare function MenuSub({ children }: {
|
|
1481
|
+
children?: ReactNode;
|
|
1482
|
+
}): react.JSX.Element;
|
|
1483
|
+
interface MenuSubTriggerProps extends ItemBase {
|
|
1484
|
+
}
|
|
1485
|
+
declare function MenuSubTrigger({ label, disabled, icon, className, children, ...rest }: MenuSubTriggerProps): react.JSX.Element;
|
|
1486
|
+
declare function MenuSubContent(props: MenuContentProps): react.JSX.Element;
|
|
1487
|
+
|
|
1488
|
+
interface MenubarProps extends HTMLAttributes<HTMLDivElement> {
|
|
1489
|
+
children?: ReactNode;
|
|
1490
|
+
/** Arrow keys wrap from the last menu to the first. Default true. */
|
|
1491
|
+
loop?: boolean;
|
|
1492
|
+
disabled?: boolean;
|
|
1493
|
+
/** Draw the squircle frame around the bar. Default true. */
|
|
1494
|
+
bordered?: boolean;
|
|
1495
|
+
}
|
|
1496
|
+
/**
|
|
1497
|
+
* A horizontal bar of menus, like an app's File / Edit / View. One tab stop; arrow keys move
|
|
1498
|
+
* between menus, and while one is open, hovering another trigger switches to it.
|
|
1499
|
+
* Children are `<Menu>`s, each with a `<MenuTrigger>` and `<MenuContent>`.
|
|
1500
|
+
*/
|
|
1501
|
+
declare function Menubar({ children, loop, disabled, bordered, className, ...rest }: MenubarProps): react.JSX.Element;
|
|
1502
|
+
|
|
1503
|
+
interface ListItem {
|
|
1504
|
+
/** Identifies the item; what selection reports. */
|
|
1505
|
+
value: string;
|
|
1506
|
+
/** Text shown, matched by typeahead and filtering, and shown in the trigger once chosen. */
|
|
1507
|
+
label: string;
|
|
1508
|
+
/** More words filtering matches. */
|
|
1509
|
+
keywords?: string[];
|
|
1510
|
+
disabled?: boolean;
|
|
1511
|
+
/** Leading icon (an `<Icon/>` or any node). */
|
|
1512
|
+
icon?: ReactNode;
|
|
1513
|
+
/** Secondary line under the label. */
|
|
1514
|
+
description?: ReactNode;
|
|
1515
|
+
/** Trailing quiet text (time, count, owner). Always-visible lists only. Gives its place to `actions` on hover. */
|
|
1516
|
+
meta?: ReactNode;
|
|
1517
|
+
/**
|
|
1518
|
+
* Row actions shown on hover/focus (always on touch). Always-visible lists only.
|
|
1519
|
+
* Prefer data (`{ label, icon, onSelect }[]`): Listbox renders aligned 24px ghost Buttons with tooltips.
|
|
1520
|
+
*/
|
|
1521
|
+
actions?: ReactNode | ListAction[];
|
|
1522
|
+
/** Overflow actions in a "More" (⋯) menu. Listbox adds Move up / down / to top here when the list is reorderable. */
|
|
1523
|
+
menu?: ListAction[];
|
|
1524
|
+
}
|
|
1525
|
+
/** A row action as data. */
|
|
1526
|
+
interface ListAction {
|
|
1527
|
+
label: string;
|
|
1528
|
+
/** An Icon name or any node. Inline actions need one; menu items may omit it. */
|
|
1529
|
+
icon?: ReactNode;
|
|
1530
|
+
onSelect(): void;
|
|
1531
|
+
/** Red in menus (delete, remove). */
|
|
1532
|
+
destructive?: boolean;
|
|
1533
|
+
disabled?: boolean;
|
|
1534
|
+
}
|
|
1535
|
+
interface ListGroupData<T extends ListItem = ListItem> {
|
|
1536
|
+
type: 'group';
|
|
1537
|
+
label: string;
|
|
1538
|
+
items: T[];
|
|
1539
|
+
}
|
|
1540
|
+
interface ListSeparatorData {
|
|
1541
|
+
type: 'separator';
|
|
1542
|
+
}
|
|
1543
|
+
type ListEntry<T extends ListItem = ListItem> = T | ListGroupData<T> | ListSeparatorData;
|
|
1544
|
+
type ListFilter = 'contains' | 'startsWith' | false | ((item: ListItem, query: string) => boolean);
|
|
1545
|
+
|
|
1546
|
+
interface SelectBaseProps {
|
|
1547
|
+
/** Options as data. Groups: `{ type: 'group', label, items }`; separators: `{ type: 'separator' }`. */
|
|
1548
|
+
items?: ListEntry[];
|
|
1549
|
+
/** `<SelectItem>` / `<SelectGroup>` children, or full composition with `<SelectTrigger>` + `<SelectContent>`. */
|
|
1550
|
+
children?: ReactNode;
|
|
1551
|
+
placeholder?: string;
|
|
1552
|
+
/** Show a search field at the top of the dropdown. */
|
|
1553
|
+
searchable?: boolean;
|
|
1554
|
+
searchPlaceholder?: string;
|
|
1555
|
+
searchLabel?: string;
|
|
1556
|
+
/** Visible label above the trigger (leave out inside `<Field>`). */
|
|
1557
|
+
label?: ReactNode;
|
|
1558
|
+
open?: boolean;
|
|
1559
|
+
defaultOpen?: boolean;
|
|
1560
|
+
onOpenChange?(open: boolean): void;
|
|
1561
|
+
/** Native form field name; the value submits through hidden inputs. */
|
|
1562
|
+
name?: string;
|
|
1563
|
+
form?: string;
|
|
1564
|
+
disabled?: boolean;
|
|
1565
|
+
readOnly?: boolean;
|
|
1566
|
+
required?: boolean;
|
|
1567
|
+
invalid?: boolean;
|
|
1568
|
+
size?: 'sm' | 'md' | 'lg';
|
|
1569
|
+
id?: string;
|
|
1570
|
+
className?: string;
|
|
1571
|
+
'aria-label'?: string;
|
|
1572
|
+
'aria-labelledby'?: string;
|
|
1573
|
+
'aria-describedby'?: string;
|
|
1574
|
+
}
|
|
1575
|
+
interface SelectSingleProps extends SelectBaseProps {
|
|
1576
|
+
multiple?: false;
|
|
1577
|
+
value?: string | null;
|
|
1578
|
+
defaultValue?: string | null;
|
|
1579
|
+
onValueChange?(value: string | null): void;
|
|
1580
|
+
}
|
|
1581
|
+
interface SelectMultipleProps extends SelectBaseProps {
|
|
1582
|
+
/** Pick several; the list stays open while toggling. */
|
|
1583
|
+
multiple: true;
|
|
1584
|
+
value?: string[];
|
|
1585
|
+
defaultValue?: string[];
|
|
1586
|
+
onValueChange?(value: string[]): void;
|
|
1587
|
+
}
|
|
1588
|
+
type SelectProps = SelectSingleProps | SelectMultipleProps;
|
|
1589
|
+
/** Pick one (or several) options from a popup list. The trigger looks like an Input. */
|
|
1590
|
+
declare function Select(props: SelectProps): react.JSX.Element;
|
|
1591
|
+
interface SelectTriggerProps extends Omit<HTMLAttributes<HTMLButtonElement>, 'children'> {
|
|
1592
|
+
/** Defaults to `<SelectValue/>`. */
|
|
1593
|
+
children?: ReactNode;
|
|
1594
|
+
/** Clone the single child element instead of rendering the squircle field button. */
|
|
1595
|
+
asChild?: boolean;
|
|
1596
|
+
/** Leading icon inside the field. */
|
|
1597
|
+
icon?: ReactNode;
|
|
1598
|
+
}
|
|
1599
|
+
declare function SelectTrigger({ children, asChild, icon, className, ...rest }: SelectTriggerProps): react.ReactElement<unknown, string | react.JSXElementConstructor<any>>;
|
|
1600
|
+
interface SelectValueProps extends HTMLAttributes<HTMLSpanElement> {
|
|
1601
|
+
/** Overrides the Select's placeholder. */
|
|
1602
|
+
placeholder?: string;
|
|
1603
|
+
/** With `multiple`: how many labels show before "+N more". Default 2. */
|
|
1604
|
+
maxLabels?: number;
|
|
1605
|
+
}
|
|
1606
|
+
/** The chosen label(s), or the placeholder. */
|
|
1607
|
+
declare function SelectValue({ placeholder, maxLabels, className, ...rest }: SelectValueProps): react.JSX.Element;
|
|
1608
|
+
interface SelectContentProps extends Omit<HTMLAttributes<HTMLDivElement>, 'children'> {
|
|
1609
|
+
/** Items can be placed here (`<SelectItem>`…); they are read by `<Select>`. */
|
|
1610
|
+
children?: ReactNode;
|
|
1611
|
+
placement?: Placement;
|
|
1612
|
+
/** Shown when there are no options. */
|
|
1613
|
+
emptyMessage?: ReactNode;
|
|
1614
|
+
}
|
|
1615
|
+
declare function SelectContent({ placement, emptyMessage, className, children: _children, onClick, ...rest }: SelectContentProps): react.JSX.Element;
|
|
1616
|
+
interface SelectItemProps {
|
|
1617
|
+
value: string;
|
|
1618
|
+
/** Text the trigger shows and typeahead matches, when children aren't plain text. */
|
|
1619
|
+
label?: string;
|
|
1620
|
+
disabled?: boolean;
|
|
1621
|
+
icon?: ReactNode;
|
|
1622
|
+
description?: ReactNode;
|
|
1623
|
+
keywords?: string[];
|
|
1624
|
+
children?: ReactNode;
|
|
1625
|
+
}
|
|
1626
|
+
declare function SelectItem(_props: SelectItemProps): null;
|
|
1627
|
+
interface SelectGroupProps {
|
|
1628
|
+
/** Group heading (or put a `<SelectGroupLabel>` first). */
|
|
1629
|
+
label?: ReactNode;
|
|
1630
|
+
children?: ReactNode;
|
|
1631
|
+
}
|
|
1632
|
+
declare function SelectGroup(_props: SelectGroupProps): null;
|
|
1633
|
+
declare function SelectGroupLabel(_props: {
|
|
1634
|
+
children?: ReactNode;
|
|
1635
|
+
}): null;
|
|
1636
|
+
declare function SelectSeparator(): null;
|
|
1637
|
+
|
|
1638
|
+
interface ListboxBaseProps extends Omit<HTMLAttributes<HTMLDivElement>, 'defaultValue' | 'onChange' | 'children'> {
|
|
1639
|
+
/** Options as data. Groups: `{ type: 'group', label, items }`; separators: `{ type: 'separator' }`. */
|
|
1640
|
+
items?: ListEntry[];
|
|
1641
|
+
/** `<ListboxItem>` / `<ListboxGroup>` / `<ListboxSeparator>` children (instead of `items`). */
|
|
1642
|
+
children?: ReactNode;
|
|
1643
|
+
/** 'automatic': arrow keys select as they move (single only). 'manual': Enter/Space/click selects. Default 'automatic' for single, 'manual' for multiple. */
|
|
1644
|
+
activation?: 'automatic' | 'manual';
|
|
1645
|
+
/** Pressing the selected item of a single listbox clears it. */
|
|
1646
|
+
deselectable?: boolean;
|
|
1647
|
+
orientation?: 'vertical' | 'horizontal';
|
|
1648
|
+
loop?: boolean;
|
|
1649
|
+
name?: string;
|
|
1650
|
+
form?: string;
|
|
1651
|
+
disabled?: boolean;
|
|
1652
|
+
readOnly?: boolean;
|
|
1653
|
+
required?: boolean;
|
|
1654
|
+
invalid?: boolean;
|
|
1655
|
+
/** Text when there are no options. Say why ("No incidents match “db”."). */
|
|
1656
|
+
emptyMessage?: ReactNode;
|
|
1657
|
+
/**
|
|
1658
|
+
* Draw its own frame. Default: true on its own, false inside a Card (the card is the frame).
|
|
1659
|
+
* Height: framed lists scroll past 320px, unframed ones grow. Change it with `--sw-listbox-max-height` on an ancestor (`none` = never scroll).
|
|
1660
|
+
*/
|
|
1661
|
+
framed?: boolean;
|
|
1662
|
+
/** 'below' (second line) or 'inline' (after the label, for dense data lists). Default 'below'. */
|
|
1663
|
+
descriptionLayout?: 'below' | 'inline';
|
|
1664
|
+
/** Enter or double-click on an option: open, drill in. */
|
|
1665
|
+
onItemAction?(value: string): void;
|
|
1666
|
+
/** New order after a drag or Alt+↑/↓. Providing it turns reordering on (flat lists only). */
|
|
1667
|
+
onReorder?(values: string[], detail: {
|
|
1668
|
+
id: string;
|
|
1669
|
+
from: number;
|
|
1670
|
+
to: number;
|
|
1671
|
+
}): void;
|
|
1672
|
+
/** Turn reordering off temporarily, e.g. while searching or sorted (`useListQuery().reorderable`). Default true. */
|
|
1673
|
+
reorderable?: boolean;
|
|
1674
|
+
/** Drag grip: 'hover' (swaps with the icon), 'always', or 'none' (drag the whole row with a mouse). Default 'hover'. */
|
|
1675
|
+
handle?: 'hover' | 'always' | 'none';
|
|
1676
|
+
}
|
|
1677
|
+
interface ListboxSingleProps extends ListboxBaseProps {
|
|
1678
|
+
multiple?: false;
|
|
1679
|
+
value?: string | null;
|
|
1680
|
+
defaultValue?: string | null;
|
|
1681
|
+
onValueChange?(value: string | null): void;
|
|
1682
|
+
}
|
|
1683
|
+
interface ListboxMultipleProps extends ListboxBaseProps {
|
|
1684
|
+
multiple: true;
|
|
1685
|
+
value?: string[];
|
|
1686
|
+
defaultValue?: string[];
|
|
1687
|
+
onValueChange?(value: string[]): void;
|
|
1688
|
+
}
|
|
1689
|
+
type ListboxProps = ListboxSingleProps | ListboxMultipleProps;
|
|
1690
|
+
/** An always-visible list of options to pick one or several from. One tab stop; arrows move. */
|
|
1691
|
+
declare function Listbox(props: ListboxProps): react.JSX.Element;
|
|
1692
|
+
interface ListboxItemProps {
|
|
1693
|
+
value: string;
|
|
1694
|
+
label?: string;
|
|
1695
|
+
disabled?: boolean;
|
|
1696
|
+
icon?: ReactNode;
|
|
1697
|
+
description?: ReactNode;
|
|
1698
|
+
children?: ReactNode;
|
|
1699
|
+
}
|
|
1700
|
+
/** An option (read by `<Listbox>`; renders nothing on its own). */
|
|
1701
|
+
declare function ListboxItem(_props: ListboxItemProps): null;
|
|
1702
|
+
declare function ListboxGroup(_props: {
|
|
1703
|
+
label?: ReactNode;
|
|
1704
|
+
children?: ReactNode;
|
|
1705
|
+
}): null;
|
|
1706
|
+
declare function ListboxGroupLabel(_props: {
|
|
1707
|
+
children?: ReactNode;
|
|
1708
|
+
}): null;
|
|
1709
|
+
declare function ListboxSeparator(): null;
|
|
1710
|
+
|
|
1711
|
+
interface ComboboxBaseProps {
|
|
1712
|
+
/** Options as data. Groups: `{ type: 'group', label, items }`; separators: `{ type: 'separator' }`. */
|
|
1713
|
+
items?: ListEntry[];
|
|
1714
|
+
/** `<ComboboxItem>` / `<ComboboxGroup>` / `<ComboboxSeparator>` children (instead of `items`). */
|
|
1715
|
+
children?: ReactNode;
|
|
1716
|
+
/** The text in the field. Pass it to control it (e.g. for server search). */
|
|
1717
|
+
inputValue?: string;
|
|
1718
|
+
defaultInputValue?: string;
|
|
1719
|
+
/** Runs as the user types. Pair with `filter={false}` + `loading` for async results. */
|
|
1720
|
+
onInputChange?(text: string): void;
|
|
1721
|
+
/** How typing narrows the list. `false` keeps every item (already filtered by a server). Default 'contains'. */
|
|
1722
|
+
filter?: ListFilter;
|
|
1723
|
+
/** Show a loading row and `aria-busy` while results load. */
|
|
1724
|
+
loading?: boolean;
|
|
1725
|
+
/** Shown when nothing matches. Default "No results". */
|
|
1726
|
+
emptyMessage?: ReactNode;
|
|
1727
|
+
open?: boolean;
|
|
1728
|
+
defaultOpen?: boolean;
|
|
1729
|
+
onOpenChange?(open: boolean): void;
|
|
1730
|
+
/** Open the list when the field gains focus. Default false (typing, ArrowDown or the chevron open it). */
|
|
1731
|
+
openOnFocus?: boolean;
|
|
1732
|
+
/** Show a clear button while there is a value. */
|
|
1733
|
+
clearable?: boolean;
|
|
1734
|
+
placeholder?: string;
|
|
1735
|
+
label?: ReactNode;
|
|
1736
|
+
/** Leading icon inside the field. */
|
|
1737
|
+
icon?: ReactNode;
|
|
1738
|
+
name?: string;
|
|
1739
|
+
form?: string;
|
|
1740
|
+
disabled?: boolean;
|
|
1741
|
+
readOnly?: boolean;
|
|
1742
|
+
required?: boolean;
|
|
1743
|
+
invalid?: boolean;
|
|
1744
|
+
size?: 'sm' | 'md' | 'lg';
|
|
1745
|
+
placement?: Placement;
|
|
1746
|
+
id?: string;
|
|
1747
|
+
className?: string;
|
|
1748
|
+
'aria-label'?: string;
|
|
1749
|
+
'aria-labelledby'?: string;
|
|
1750
|
+
'aria-describedby'?: string;
|
|
1751
|
+
}
|
|
1752
|
+
interface ComboboxSingleProps extends ComboboxBaseProps {
|
|
1753
|
+
multiple?: false;
|
|
1754
|
+
value?: string | null;
|
|
1755
|
+
defaultValue?: string | null;
|
|
1756
|
+
onValueChange?(value: string | null): void;
|
|
1757
|
+
}
|
|
1758
|
+
interface ComboboxMultipleProps extends ComboboxBaseProps {
|
|
1759
|
+
/** Pick several; chosen options show as chips in the field. */
|
|
1760
|
+
multiple: true;
|
|
1761
|
+
value?: string[];
|
|
1762
|
+
defaultValue?: string[];
|
|
1763
|
+
onValueChange?(value: string[]): void;
|
|
1764
|
+
}
|
|
1765
|
+
type ComboboxProps = ComboboxSingleProps | ComboboxMultipleProps;
|
|
1766
|
+
/** A searchable select: type to filter, pick one or several (chips). Works with async results. */
|
|
1767
|
+
declare function Combobox(props: ComboboxProps): react.JSX.Element;
|
|
1768
|
+
interface ComboboxItemProps {
|
|
1769
|
+
value: string;
|
|
1770
|
+
/** Text shown in the field and matched by filtering, when children aren't plain text. */
|
|
1771
|
+
label?: string;
|
|
1772
|
+
keywords?: string[];
|
|
1773
|
+
disabled?: boolean;
|
|
1774
|
+
icon?: ReactNode;
|
|
1775
|
+
description?: ReactNode;
|
|
1776
|
+
children?: ReactNode;
|
|
1777
|
+
}
|
|
1778
|
+
/** An option (read by `<Combobox>`; renders nothing on its own). */
|
|
1779
|
+
declare function ComboboxItem(_props: ComboboxItemProps): null;
|
|
1780
|
+
declare function ComboboxGroup(_props: {
|
|
1781
|
+
label?: ReactNode;
|
|
1782
|
+
children?: ReactNode;
|
|
1783
|
+
}): null;
|
|
1784
|
+
declare function ComboboxGroupLabel(_props: {
|
|
1785
|
+
children?: ReactNode;
|
|
1786
|
+
}): null;
|
|
1787
|
+
declare function ComboboxSeparator(): null;
|
|
1788
|
+
|
|
1789
|
+
interface AutocompleteProps extends Omit<InputHTMLAttributes<HTMLInputElement>, 'value' | 'defaultValue' | 'size' | 'children' | 'onSelect' | 'prefix'> {
|
|
1790
|
+
/** Suggestions as data. Groups: `{ type: 'group', label, items }`. */
|
|
1791
|
+
items?: ListEntry[];
|
|
1792
|
+
/** `<AutocompleteItem>` children (instead of `items`). */
|
|
1793
|
+
children?: ReactNode;
|
|
1794
|
+
/** The text. Free text is allowed; suggestions only help. */
|
|
1795
|
+
value?: string;
|
|
1796
|
+
defaultValue?: string;
|
|
1797
|
+
onValueChange?(text: string): void;
|
|
1798
|
+
/** Runs when a suggestion is chosen (after the text becomes its label). */
|
|
1799
|
+
onItemSelect?(item: ListItem): void;
|
|
1800
|
+
/** How typing narrows suggestions. `false` for server-filtered results. Default 'contains'. */
|
|
1801
|
+
filter?: ListFilter;
|
|
1802
|
+
loading?: boolean;
|
|
1803
|
+
/** Shown when nothing matches. Omit to just close the list. */
|
|
1804
|
+
emptyMessage?: ReactNode;
|
|
1805
|
+
open?: boolean;
|
|
1806
|
+
defaultOpen?: boolean;
|
|
1807
|
+
onOpenChange?(open: boolean): void;
|
|
1808
|
+
/** Show suggestions on focus, before typing. Default false. */
|
|
1809
|
+
openOnFocus?: boolean;
|
|
1810
|
+
/** Highlight the first suggestion so Enter takes it. Default false (Enter keeps the typed text). */
|
|
1811
|
+
autoHighlight?: boolean;
|
|
1812
|
+
clearable?: boolean;
|
|
1813
|
+
label?: ReactNode;
|
|
1814
|
+
icon?: ReactNode;
|
|
1815
|
+
invalid?: boolean;
|
|
1816
|
+
size?: 'sm' | 'md' | 'lg';
|
|
1817
|
+
placement?: Placement;
|
|
1818
|
+
}
|
|
1819
|
+
/** A text field with suggestions. The value is whatever is typed; picking a suggestion fills it in. */
|
|
1820
|
+
declare function Autocomplete(props: AutocompleteProps): react.JSX.Element;
|
|
1821
|
+
interface AutocompleteItemProps {
|
|
1822
|
+
value: string;
|
|
1823
|
+
label?: string;
|
|
1824
|
+
keywords?: string[];
|
|
1825
|
+
disabled?: boolean;
|
|
1826
|
+
icon?: ReactNode;
|
|
1827
|
+
description?: ReactNode;
|
|
1828
|
+
children?: ReactNode;
|
|
1829
|
+
}
|
|
1830
|
+
/** A suggestion (read by `<Autocomplete>`; renders nothing on its own). */
|
|
1831
|
+
declare function AutocompleteItem(_props: AutocompleteItemProps): null;
|
|
1832
|
+
declare function AutocompleteGroup(_props: {
|
|
1833
|
+
label?: ReactNode;
|
|
1834
|
+
children?: ReactNode;
|
|
1835
|
+
}): null;
|
|
1836
|
+
declare function AutocompleteGroupLabel(_props: {
|
|
1837
|
+
children?: ReactNode;
|
|
1838
|
+
}): null;
|
|
1839
|
+
|
|
1840
|
+
type CommandFilter = 'fuzzy' | 'contains' | 'startsWith' | false | ((text: string, query: string, keywords: string[]) => boolean);
|
|
1841
|
+
interface CommandDataItem extends ListItem {
|
|
1842
|
+
/** Shortcut like "mod+p" that runs it while the palette is mounted. */
|
|
1843
|
+
shortcut?: string;
|
|
1844
|
+
/** Commands on a page of their own; choosing this opens the page. */
|
|
1845
|
+
items?: CommandData;
|
|
1846
|
+
onSelect?(event: Event | MouseEvent): void;
|
|
1847
|
+
}
|
|
1848
|
+
type CommandData = Array<CommandDataItem | {
|
|
1849
|
+
type: 'group';
|
|
1850
|
+
label: string;
|
|
1851
|
+
items: CommandDataItem[];
|
|
1852
|
+
} | {
|
|
1853
|
+
type: 'separator';
|
|
1854
|
+
}>;
|
|
1855
|
+
interface CommandProps extends Omit<HTMLAttributes<HTMLDivElement>, 'defaultValue' | 'onChange'> {
|
|
1856
|
+
/** The highlighted command's value. */
|
|
1857
|
+
value?: string | null;
|
|
1858
|
+
defaultValue?: string | null;
|
|
1859
|
+
onValueChange?(value: string | null): void;
|
|
1860
|
+
/** The search text. */
|
|
1861
|
+
query?: string;
|
|
1862
|
+
defaultQuery?: string;
|
|
1863
|
+
onQueryChange?(query: string): void;
|
|
1864
|
+
/** The stack of open pages (values of `CommandPage`s). */
|
|
1865
|
+
pages?: string[];
|
|
1866
|
+
defaultPages?: string[];
|
|
1867
|
+
onPagesChange?(pages: string[]): void;
|
|
1868
|
+
/** Runs when a command runs (Enter, click or its shortcut), with its value. */
|
|
1869
|
+
onAction?(value: string): void;
|
|
1870
|
+
/** The commands as data (renders input + list for you). Items with `items` open a page. */
|
|
1871
|
+
items?: CommandData;
|
|
1872
|
+
/** Placeholder for the default input when using `items`. */
|
|
1873
|
+
placeholder?: string;
|
|
1874
|
+
/** How the search narrows the list. Default 'contains'. 'fuzzy' keeps letters in order. */
|
|
1875
|
+
filter?: CommandFilter;
|
|
1876
|
+
/** Arrow keys wrap. Default true. */
|
|
1877
|
+
loop?: boolean;
|
|
1878
|
+
/** Results are loading (async). */
|
|
1879
|
+
loading?: boolean;
|
|
1880
|
+
/** Draw the framed squircle surface. Default true (false inside `CommandDialog`). */
|
|
1881
|
+
bordered?: boolean;
|
|
1882
|
+
}
|
|
1883
|
+
/** A command palette: a search field over grouped, filterable commands with shortcuts and nested pages. */
|
|
1884
|
+
declare function Command(props: CommandProps): react.JSX.Element;
|
|
1885
|
+
interface CommandInputProps extends Omit<InputHTMLAttributes<HTMLInputElement>, 'value' | 'defaultValue' | 'size'> {
|
|
1886
|
+
}
|
|
1887
|
+
declare function CommandInput({ className, onKeyDown, placeholder, ...rest }: CommandInputProps): react.JSX.Element;
|
|
1888
|
+
declare function CommandList({ className, children, ...rest }: HTMLAttributes<HTMLDivElement>): react.JSX.Element;
|
|
1889
|
+
interface CommandPageProps {
|
|
1890
|
+
/** The page's name; an item's `page` opens it. Leave out for the first page. */
|
|
1891
|
+
value?: string;
|
|
1892
|
+
children?: ReactNode;
|
|
1893
|
+
}
|
|
1894
|
+
/** A set of commands shown only while its page is open. Hidden pages stay mounted so their shortcuts work. */
|
|
1895
|
+
declare function CommandPage({ value, children }: CommandPageProps): react.JSX.Element;
|
|
1896
|
+
interface CommandGroupProps extends HTMLAttributes<HTMLDivElement> {
|
|
1897
|
+
/** Group label (or put a `<CommandGroupLabel>` first). */
|
|
1898
|
+
heading?: ReactNode;
|
|
1899
|
+
}
|
|
1900
|
+
declare function CommandGroup({ heading, className, children, ...rest }: CommandGroupProps): react.JSX.Element;
|
|
1901
|
+
declare function CommandGroupLabel({ className, ...rest }: HTMLAttributes<HTMLDivElement>): react.JSX.Element;
|
|
1902
|
+
declare function CommandSeparator({ className, ...rest }: HTMLAttributes<HTMLDivElement>): react.JSX.Element | null;
|
|
1903
|
+
declare function CommandEmpty({ className, children, ...rest }: HTMLAttributes<HTMLDivElement>): react.JSX.Element | null;
|
|
1904
|
+
interface CommandItemProps extends Omit<HTMLAttributes<HTMLDivElement>, 'onSelect'> {
|
|
1905
|
+
/** Identifies the command; passed to `onAction`. Defaults to its label. */
|
|
1906
|
+
value?: string;
|
|
1907
|
+
/** Text the search matches when children aren't plain text. */
|
|
1908
|
+
label?: string;
|
|
1909
|
+
keywords?: string[];
|
|
1910
|
+
disabled?: boolean;
|
|
1911
|
+
icon?: ReactNode;
|
|
1912
|
+
/** Runs the command while the palette is mounted, like "mod+p". Shows the keys at the end. */
|
|
1913
|
+
shortcut?: string;
|
|
1914
|
+
/** Opens this `CommandPage` instead of running. */
|
|
1915
|
+
page?: string;
|
|
1916
|
+
/** Runs before `onAction`. `event.preventDefault()` skips `onAction`, the page and closing. */
|
|
1917
|
+
onSelect?(event: Event | MouseEvent): void;
|
|
1918
|
+
}
|
|
1919
|
+
declare function CommandItem({ value, label, keywords, disabled, icon, shortcut, page: opens, onSelect, className, children, ...rest }: CommandItemProps): react.JSX.Element | null;
|
|
1920
|
+
/** Shows shortcut keys for the current platform ("mod+k" → ⌘K / Ctrl+K). */
|
|
1921
|
+
declare function CommandShortcut({ shortcut, className }: {
|
|
1922
|
+
shortcut?: string;
|
|
1923
|
+
className?: string;
|
|
1924
|
+
}): react.JSX.Element | null;
|
|
1925
|
+
interface CommandDialogProps extends CommandProps {
|
|
1926
|
+
open?: boolean;
|
|
1927
|
+
defaultOpen?: boolean;
|
|
1928
|
+
onOpenChange?(open: boolean): void;
|
|
1929
|
+
/** Global shortcut that toggles the palette. Default "mod+k"; `false` turns it off. */
|
|
1930
|
+
shortcut?: string | false;
|
|
1931
|
+
/** Close after a command runs. Default true. */
|
|
1932
|
+
closeOnSelect?: boolean;
|
|
1933
|
+
/** Accessible name of the dialog. Default "Command palette". */
|
|
1934
|
+
'aria-label'?: string;
|
|
1935
|
+
}
|
|
1936
|
+
/** The command palette in a modal, opened with ⌘K / Ctrl+K. */
|
|
1937
|
+
declare function CommandDialog({ open: openProp, defaultOpen, onOpenChange, shortcut, closeOnSelect, 'aria-label': ariaLabel, ...commandProps }: CommandDialogProps): react.JSX.Element;
|
|
1938
|
+
|
|
1939
|
+
interface TriggerToken {
|
|
1940
|
+
type: string;
|
|
1941
|
+
value: string;
|
|
1942
|
+
label: string;
|
|
1943
|
+
id?: string;
|
|
1944
|
+
data?: Record<string, unknown>;
|
|
1945
|
+
}
|
|
1946
|
+
interface TriggerMenuItem extends ListItem {
|
|
1947
|
+
}
|
|
1948
|
+
type TriggerItemsLoader = (query: string, signal: AbortSignal) => ListEntry<TriggerMenuItem>[] | Promise<ListEntry<TriggerMenuItem>[]>;
|
|
1949
|
+
interface TriggerDefinition {
|
|
1950
|
+
/** Text that starts a match: "@", "/", "#", or several characters like "[[". */
|
|
1951
|
+
char: string;
|
|
1952
|
+
/** Suggestions as data, or a loader given the query (results are not filtered again). */
|
|
1953
|
+
items?: ListEntry<TriggerMenuItem>[] | TriggerItemsLoader;
|
|
1954
|
+
/** Token kind inserted inside a Token Input, e.g. "mention", "file", "tag". */
|
|
1955
|
+
type?: string;
|
|
1956
|
+
/** Allow spaces in the query. Default false. */
|
|
1957
|
+
spaces?: boolean;
|
|
1958
|
+
/** Longest query before the match ends. Default 32. */
|
|
1959
|
+
maxLength?: number;
|
|
1960
|
+
/** Where a match may start: after whitespace / at the start (default), or anywhere. */
|
|
1961
|
+
boundary?: 'whitespace' | 'any';
|
|
1962
|
+
filter?: ListFilter;
|
|
1963
|
+
/** What replaces the trigger + query. Default: a token in a Token Input, else `char + label + ' '`. */
|
|
1964
|
+
insert?(item: TriggerMenuItem): string | TriggerToken;
|
|
1965
|
+
}
|
|
1966
|
+
interface TriggerMenuProps {
|
|
1967
|
+
/** The texts that open the menu and what each lists. */
|
|
1968
|
+
triggers: TriggerDefinition[];
|
|
1969
|
+
/** `<TriggerMenuInput>` (or nothing, inside a `<TokenInput>`). */
|
|
1970
|
+
children?: ReactNode;
|
|
1971
|
+
/** Runs when an item is chosen, after it is inserted. */
|
|
1972
|
+
onSelect?(value: string, details: {
|
|
1973
|
+
trigger: string;
|
|
1974
|
+
item: TriggerMenuItem;
|
|
1975
|
+
}): void;
|
|
1976
|
+
/** Runs when the text after the trigger changes. */
|
|
1977
|
+
onQueryChange?(query: string, details: {
|
|
1978
|
+
trigger: string;
|
|
1979
|
+
}): void;
|
|
1980
|
+
onOpenChange?(open: boolean): void;
|
|
1981
|
+
/** Items from outside (via `triggers[].items` changes) are loading. */
|
|
1982
|
+
loading?: boolean;
|
|
1983
|
+
/** Highlight the first match so Enter / Tab chooses it. Default true. */
|
|
1984
|
+
autoHighlight?: boolean;
|
|
1985
|
+
/** Shown when nothing matches. Default "No matches". */
|
|
1986
|
+
emptyMessage?: ReactNode;
|
|
1987
|
+
className?: string;
|
|
1988
|
+
}
|
|
1989
|
+
/** Suggestions at the caret when a trigger like @, / or # is typed in a field; inserts the chosen item. */
|
|
1990
|
+
declare function TriggerMenu({ triggers, children, onSelect, onQueryChange, onOpenChange, loading: loadingProp, autoHighlight, emptyMessage, className }: TriggerMenuProps): react.JSX.Element;
|
|
1991
|
+
interface TriggerMenuInputProps extends Omit<TextareaHTMLAttributes<HTMLTextAreaElement>, 'value' | 'defaultValue' | 'onChange'> {
|
|
1992
|
+
value?: string;
|
|
1993
|
+
defaultValue?: string;
|
|
1994
|
+
onValueChange?(value: string): void;
|
|
1995
|
+
/** Textarea (default) or a single-line input. */
|
|
1996
|
+
multiline?: boolean;
|
|
1997
|
+
label?: ReactNode;
|
|
1998
|
+
invalid?: boolean;
|
|
1999
|
+
}
|
|
2000
|
+
/** The field a TriggerMenu suggests into: a squircle textarea (or single-line input). */
|
|
2001
|
+
declare function TriggerMenuInput({ value, defaultValue, onValueChange, multiline, label, invalid, className, rows, onKeyDown, onBlur, onSelect, onClick, ...rest }: TriggerMenuInputProps): react.JSX.Element;
|
|
2002
|
+
|
|
2003
|
+
interface Token extends TriggerToken {
|
|
2004
|
+
/** "pending" while it loads, "unresolved" when it needs the user. */
|
|
2005
|
+
status?: 'pending' | 'unresolved';
|
|
2006
|
+
}
|
|
2007
|
+
/** Text and tokens, in order: `['Explain ', { type: 'file', value: 'src/a.ts', label: 'a.ts' }]`. */
|
|
2008
|
+
type TokenInputValue = Array<string | Token>;
|
|
2009
|
+
/** The value as people read it: text with each token's label. */
|
|
2010
|
+
declare const tokenInputText: (v: TokenInputValue) => string;
|
|
2011
|
+
interface TokenInputProps extends Omit<HTMLAttributes<HTMLDivElement>, 'defaultValue' | 'onSubmit' | 'onChange'> {
|
|
2012
|
+
value?: TokenInputValue;
|
|
2013
|
+
defaultValue?: TokenInputValue;
|
|
2014
|
+
onValueChange?(value: TokenInputValue): void;
|
|
2015
|
+
/** Runs on the submit shortcut (unless a trigger menu is open). Without it, the shortcut submits the surrounding form. */
|
|
2016
|
+
onSubmit?(value: TokenInputValue): void;
|
|
2017
|
+
/** "enter" (Shift+Enter = new line, default) or "mod+enter". */
|
|
2018
|
+
submitShortcut?: 'enter' | 'mod+enter';
|
|
2019
|
+
/** Turn the word before the caret into a token on Enter or comma, e.g. `(text) => ({ type: 'tag', value: text, label: text })`. */
|
|
2020
|
+
createToken?(text: string): Token | null;
|
|
2021
|
+
/** Custom chip content. Default: `<TokenInputToken/>` (icon by type + label + remove). */
|
|
2022
|
+
renderToken?(token: Token): ReactNode;
|
|
2023
|
+
/** How a token is written in the submitted form text. Default `[label](type:value)`. */
|
|
2024
|
+
format?(token: Token): string;
|
|
2025
|
+
/** `<TokenInputEditor>` plus an optional `<TriggerMenu>`. Defaults to an editor. */
|
|
2026
|
+
children?: ReactNode;
|
|
2027
|
+
name?: string;
|
|
2028
|
+
form?: string;
|
|
2029
|
+
disabled?: boolean;
|
|
2030
|
+
readOnly?: boolean;
|
|
2031
|
+
required?: boolean;
|
|
2032
|
+
invalid?: boolean;
|
|
2033
|
+
/** Placeholder for the default editor. */
|
|
2034
|
+
placeholder?: string;
|
|
2035
|
+
}
|
|
2036
|
+
/** A text field that holds tokens (people, files, tags) alongside editable text. */
|
|
2037
|
+
declare function TokenInput({ value: valueProp, defaultValue, onValueChange, onSubmit, submitShortcut, createToken, renderToken, format, children, name, form, disabled: disabledProp, readOnly, required, invalid, placeholder, className, id, ...rest }: TokenInputProps): react.JSX.Element;
|
|
2038
|
+
interface TokenInputEditorProps extends Omit<HTMLAttributes<HTMLDivElement>, 'children'> {
|
|
2039
|
+
placeholder?: string;
|
|
2040
|
+
}
|
|
2041
|
+
/** The editable area. One per TokenInput. */
|
|
2042
|
+
declare function TokenInputEditor({ placeholder, className, ...rest }: TokenInputEditorProps): react.JSX.Element;
|
|
2043
|
+
interface TokenInputTokenProps extends HTMLAttributes<HTMLSpanElement> {
|
|
2044
|
+
/** Leading icon. Default: by token type (mention → user, file → file, tag → #). */
|
|
2045
|
+
icon?: ReactNode;
|
|
2046
|
+
/** Show the remove ✕. Default true. */
|
|
2047
|
+
removable?: boolean;
|
|
2048
|
+
}
|
|
2049
|
+
/** A token chip. Use inside `renderToken`; reads its token from context. */
|
|
2050
|
+
declare function TokenInputToken({ icon, removable, className, children, ...rest }: TokenInputTokenProps): react.JSX.Element | null;
|
|
2051
|
+
/** Removes its token on press; focus stays in the editor. Hidden from screen readers (Backspace removes tokens). */
|
|
2052
|
+
declare function TokenInputTokenRemove({ className, children, ...rest }: HTMLAttributes<HTMLSpanElement>): react.JSX.Element | null;
|
|
2053
|
+
|
|
2054
|
+
/** An ISO calendar date, `"YYYY-MM-DD"`. */
|
|
2055
|
+
type ISODate = string;
|
|
2056
|
+
/** A `[start, end]` pair of ISO dates (inclusive). */
|
|
2057
|
+
type DateRange = [ISODate, ISODate];
|
|
2058
|
+
/**
|
|
2059
|
+
* Dates that can't be picked, as data: an ISO date, `{ from, to }`, `{ before }`, `{ after }`,
|
|
2060
|
+
* `{ weekday: [0, 6] }` (0 = Sunday) or a function.
|
|
2061
|
+
*/
|
|
2062
|
+
type DateMatcher = ISODate | {
|
|
2063
|
+
from: ISODate;
|
|
2064
|
+
to: ISODate;
|
|
2065
|
+
} | {
|
|
2066
|
+
before: ISODate;
|
|
2067
|
+
} | {
|
|
2068
|
+
after: ISODate;
|
|
2069
|
+
} | {
|
|
2070
|
+
weekday: number[];
|
|
2071
|
+
} | ((date: ISODate) => boolean);
|
|
2072
|
+
interface DateParts {
|
|
2073
|
+
year: number;
|
|
2074
|
+
month: number;
|
|
2075
|
+
day: number;
|
|
2076
|
+
}
|
|
2077
|
+
/** Parse `"YYYY-MM-DD"` (also accepts a full ISO datetime and keeps the date). Returns null when invalid. */
|
|
2078
|
+
declare function parseDate(iso: string | null | undefined): DateParts | null;
|
|
2079
|
+
declare const isValidDate: (iso: unknown) => iso is ISODate;
|
|
2080
|
+
declare const toISODate: (year: number, month: number, day: number) => ISODate;
|
|
2081
|
+
declare function daysInMonth(year: number, month: number): number;
|
|
2082
|
+
/** Add (or subtract) days. */
|
|
2083
|
+
declare function addDays(iso: ISODate, n: number): ISODate;
|
|
2084
|
+
/** Add months, keeping the day where possible (Jan 31 + 1 month = Feb 28). */
|
|
2085
|
+
declare function addMonths(iso: ISODate, n: number): ISODate;
|
|
2086
|
+
declare const addYears: (iso: ISODate, n: number) => string;
|
|
2087
|
+
/** 0 = Sunday … 6 = Saturday. */
|
|
2088
|
+
declare const weekdayOf: (iso: ISODate) => number;
|
|
2089
|
+
/** Whole days from `a` to `b` (b − a). */
|
|
2090
|
+
declare const diffDays: (a: ISODate, b: ISODate) => number;
|
|
2091
|
+
/** Today as an ISO date, in `timeZone` (default: the runtime's). */
|
|
2092
|
+
declare function todayISO(timeZone?: string): ISODate;
|
|
2093
|
+
/** Does `date` match any of the matchers? */
|
|
2094
|
+
declare function matchesDate(date: ISODate, matchers: DateMatcher | DateMatcher[] | undefined): boolean;
|
|
2095
|
+
interface TimeParts {
|
|
2096
|
+
hour: number;
|
|
2097
|
+
minute: number;
|
|
2098
|
+
second: number;
|
|
2099
|
+
}
|
|
2100
|
+
/** Parse `"HH:mm"` or `"HH:mm:ss"` (24-hour). */
|
|
2101
|
+
declare function parseTime(t: string | null | undefined): TimeParts | null;
|
|
2102
|
+
declare const toISOTime: (h: number, m: number, s?: number) => string;
|
|
2103
|
+
/** Format an ISO date with Intl options, e.g. `formatDate('2026-11-14', 'en-US', { dateStyle: 'medium' })` → "Nov 14, 2026". */
|
|
2104
|
+
declare function formatDate(iso: ISODate, locale?: string, opts?: Intl.DateTimeFormatOptions): string;
|
|
2105
|
+
/** First day of the week for a locale (0 = Sunday). Uses `Intl.Locale#getWeekInfo` when available. */
|
|
2106
|
+
declare function weekStartFor(locale: string): number;
|
|
2107
|
+
|
|
2108
|
+
type CalendarMode = 'single' | 'multiple' | 'range';
|
|
2109
|
+
type CalendarValue = ISODate | ISODate[] | DateRange | null;
|
|
2110
|
+
/** What `renderDay` receives for each day cell. */
|
|
2111
|
+
interface CalendarDayState {
|
|
2112
|
+
date: ISODate;
|
|
2113
|
+
/** Day of the month, e.g. "14". */
|
|
2114
|
+
label: string;
|
|
2115
|
+
selected: boolean;
|
|
2116
|
+
today: boolean;
|
|
2117
|
+
outside: boolean;
|
|
2118
|
+
disabled: boolean;
|
|
2119
|
+
unavailable: boolean;
|
|
2120
|
+
rangeStart: boolean;
|
|
2121
|
+
rangeEnd: boolean;
|
|
2122
|
+
inRange: boolean;
|
|
2123
|
+
}
|
|
2124
|
+
interface CalendarBaseProps extends Omit<HTMLAttributes<HTMLDivElement>, 'defaultValue' | 'onChange' | 'children'> {
|
|
2125
|
+
/** First month shown, `"YYYY-MM"`. Pass to control it. */
|
|
2126
|
+
month?: string;
|
|
2127
|
+
/** Initial month when uncontrolled. Defaults to the selection's month, else today's. */
|
|
2128
|
+
defaultMonth?: string;
|
|
2129
|
+
onMonthChange?(month: string): void;
|
|
2130
|
+
/** Earliest date that can be picked (ISO). Keys stop here and Previous stops at its month. */
|
|
2131
|
+
min?: ISODate;
|
|
2132
|
+
/** Latest date that can be picked (ISO). */
|
|
2133
|
+
max?: ISODate;
|
|
2134
|
+
/** Return true for dates that can't be picked (booked days). They stay focusable. */
|
|
2135
|
+
isDateUnavailable?(date: ISODate): boolean;
|
|
2136
|
+
/** Unavailable dates as data: ISO dates, `{ from, to }`, `{ before }`, `{ after }`, `{ weekday: [0, 6] }`. */
|
|
2137
|
+
unavailable?: DateMatcher | DateMatcher[];
|
|
2138
|
+
disabled?: boolean;
|
|
2139
|
+
/** Days can be focused but not picked. */
|
|
2140
|
+
readOnly?: boolean;
|
|
2141
|
+
/** Single mode: pressing the selected day again clears it. */
|
|
2142
|
+
deselectable?: boolean;
|
|
2143
|
+
/** Months side by side. Default 1. */
|
|
2144
|
+
months?: number;
|
|
2145
|
+
/** BCP 47 locale for names and the week start. Defaults to the page's `lang`, then the browser's. */
|
|
2146
|
+
locale?: string;
|
|
2147
|
+
/** First day of the week, 0 = Sunday. Defaults to the locale's. */
|
|
2148
|
+
weekStartsOn?: number;
|
|
2149
|
+
weekdayFormat?: 'narrow' | 'short' | 'long';
|
|
2150
|
+
/** Always show six weeks so the height never changes. */
|
|
2151
|
+
fixedWeeks?: boolean;
|
|
2152
|
+
/** Show the days of neighbouring months. Default true with one month, false with several. */
|
|
2153
|
+
showOutsideDays?: boolean;
|
|
2154
|
+
/** Today's date (ISO), for the marker and the starting month. Defaults to today in `timeZone`. */
|
|
2155
|
+
today?: ISODate;
|
|
2156
|
+
timeZone?: string;
|
|
2157
|
+
/** Range mode: fewest days a range may span, both ends counted. */
|
|
2158
|
+
minDays?: number;
|
|
2159
|
+
/** Range mode: most days a range may span, both ends counted. */
|
|
2160
|
+
maxDays?: number;
|
|
2161
|
+
/** Range mode: allow a range across unavailable dates. Default false. */
|
|
2162
|
+
allowUnavailable?: boolean;
|
|
2163
|
+
size?: 'sm' | 'md' | 'lg';
|
|
2164
|
+
/** Draw its own squircle frame. Default true; pass `framed={false}` when it already sits in a popup or surface. */
|
|
2165
|
+
framed?: boolean;
|
|
2166
|
+
/** Focus the tab-stop day on mount (used by Date Picker). */
|
|
2167
|
+
autoFocus?: boolean;
|
|
2168
|
+
/** Custom content for a day button. */
|
|
2169
|
+
renderDay?(day: CalendarDayState): ReactNode;
|
|
2170
|
+
/** Replace the default layout with parts: CalendarHeader, CalendarPrevious, CalendarHeading, CalendarNext, CalendarGrid. */
|
|
2171
|
+
children?: ReactNode;
|
|
2172
|
+
}
|
|
2173
|
+
type CalendarProps = CalendarBaseProps & ({
|
|
2174
|
+
mode?: 'single';
|
|
2175
|
+
value?: ISODate | null;
|
|
2176
|
+
defaultValue?: ISODate | null;
|
|
2177
|
+
onValueChange?(value: ISODate | null): void;
|
|
2178
|
+
} | {
|
|
2179
|
+
mode: 'multiple';
|
|
2180
|
+
value?: ISODate[];
|
|
2181
|
+
defaultValue?: ISODate[];
|
|
2182
|
+
onValueChange?(value: ISODate[]): void;
|
|
2183
|
+
} | {
|
|
2184
|
+
mode: 'range';
|
|
2185
|
+
value?: DateRange | null;
|
|
2186
|
+
defaultValue?: DateRange | null;
|
|
2187
|
+
onValueChange?(value: DateRange | null): void;
|
|
2188
|
+
});
|
|
2189
|
+
/** Month grid for picking one date, several dates or a range. Value is ISO strings. */
|
|
2190
|
+
declare const Calendar: react.ForwardRefExoticComponent<CalendarProps & react.RefAttributes<HTMLDivElement>>;
|
|
2191
|
+
/** Row with Previous, Heading and Next. */
|
|
2192
|
+
declare function CalendarHeader({ className, children, ...rest }: HTMLAttributes<HTMLDivElement>): react.JSX.Element;
|
|
2193
|
+
/** Shows the previous month. Disabled at `min`'s month. */
|
|
2194
|
+
declare const CalendarPrevious: (props: HTMLAttributes<HTMLButtonElement> & {
|
|
2195
|
+
"aria-label"?: string;
|
|
2196
|
+
}) => react.JSX.Element;
|
|
2197
|
+
/** Shows the next month. Disabled at `max`'s month. */
|
|
2198
|
+
declare const CalendarNext: (props: HTMLAttributes<HTMLButtonElement> & {
|
|
2199
|
+
"aria-label"?: string;
|
|
2200
|
+
}) => react.JSX.Element;
|
|
2201
|
+
/** Names the months shown, like "November 2026". Announced when it changes. */
|
|
2202
|
+
declare function CalendarHeading({ className, ...rest }: HTMLAttributes<HTMLHeadingElement>): react.JSX.Element;
|
|
2203
|
+
interface CalendarGridProps extends HTMLAttributes<HTMLDivElement> {
|
|
2204
|
+
/** Which of the months shown, from 0. */
|
|
2205
|
+
offset?: number;
|
|
2206
|
+
}
|
|
2207
|
+
/** One month: weekday headers and day cells. The month slides when it changes. */
|
|
2208
|
+
declare function CalendarGrid({ offset, className, ...rest }: CalendarGridProps): react.JSX.Element;
|
|
2209
|
+
|
|
2210
|
+
type DateSegmentType = 'year' | 'month' | 'day' | 'hour' | 'minute' | 'second' | 'dayPeriod';
|
|
2211
|
+
interface DateInputProps {
|
|
2212
|
+
/** ISO date like `"2026-11-14"`, or null. Stays null until every segment is filled. */
|
|
2213
|
+
value?: ISODate | null;
|
|
2214
|
+
defaultValue?: ISODate | null;
|
|
2215
|
+
onValueChange?(value: ISODate | null): void;
|
|
2216
|
+
/** Earliest valid date (ISO). Earlier dates mark the input invalid. */
|
|
2217
|
+
min?: ISODate;
|
|
2218
|
+
/** Latest valid date (ISO). */
|
|
2219
|
+
max?: ISODate;
|
|
2220
|
+
/** Dates that can't be chosen, as a function. */
|
|
2221
|
+
isDateUnavailable?(date: ISODate): boolean;
|
|
2222
|
+
/** Dates that can't be chosen, as data (ISO dates, `{ from, to }`, `{ weekday: [0, 6] }`…). */
|
|
2223
|
+
unavailable?: DateMatcher | DateMatcher[];
|
|
2224
|
+
/** BCP 47 locale for segment order and separators. Defaults to the page's `lang`, then the browser's. */
|
|
2225
|
+
locale?: string;
|
|
2226
|
+
label?: ReactNode;
|
|
2227
|
+
hint?: ReactNode;
|
|
2228
|
+
error?: ReactNode;
|
|
2229
|
+
size?: 'sm' | 'md' | 'lg';
|
|
2230
|
+
/** Shrink the box to its content instead of filling the width (like Input). Default false. */
|
|
2231
|
+
inline?: boolean;
|
|
2232
|
+
disabled?: boolean;
|
|
2233
|
+
readOnly?: boolean;
|
|
2234
|
+
required?: boolean;
|
|
2235
|
+
invalid?: boolean;
|
|
2236
|
+
/** Submits the ISO date under this name (hidden input). */
|
|
2237
|
+
name?: string;
|
|
2238
|
+
form?: string;
|
|
2239
|
+
id?: string;
|
|
2240
|
+
className?: string;
|
|
2241
|
+
'aria-label'?: string;
|
|
2242
|
+
'aria-labelledby'?: string;
|
|
2243
|
+
'aria-describedby'?: string;
|
|
2244
|
+
/** Content after the segments, inside the box (an icon, a button). */
|
|
2245
|
+
suffix?: ReactNode;
|
|
2246
|
+
}
|
|
2247
|
+
/** Segmented date entry: month, day and year as spinbuttons in the locale's order. Submits ISO `YYYY-MM-DD`. */
|
|
2248
|
+
declare const DateInput: react.ForwardRefExoticComponent<DateInputProps & react.RefAttributes<HTMLDivElement>>;
|
|
2249
|
+
|
|
2250
|
+
interface DatePickerPreset<V = ISODate | DateRange> {
|
|
2251
|
+
label: ReactNode;
|
|
2252
|
+
/** ISO date, or `[start, end]` in range mode. */
|
|
2253
|
+
value: V;
|
|
2254
|
+
}
|
|
2255
|
+
interface DatePickerBaseProps {
|
|
2256
|
+
open?: boolean;
|
|
2257
|
+
defaultOpen?: boolean;
|
|
2258
|
+
onOpenChange?(open: boolean): void;
|
|
2259
|
+
/** Earliest date that can be picked or typed (ISO). */
|
|
2260
|
+
min?: ISODate;
|
|
2261
|
+
/** Latest date that can be picked or typed (ISO). */
|
|
2262
|
+
max?: ISODate;
|
|
2263
|
+
isDateUnavailable?(date: ISODate): boolean;
|
|
2264
|
+
unavailable?: DateMatcher | DateMatcher[];
|
|
2265
|
+
/** BCP 47 locale for the inputs and calendar. Defaults to the page's `lang`, then the browser's. */
|
|
2266
|
+
locale?: string;
|
|
2267
|
+
weekStartsOn?: number;
|
|
2268
|
+
/** Months shown side by side in the popup. Default 1 (2 is nice for ranges on desktop). */
|
|
2269
|
+
months?: number;
|
|
2270
|
+
fixedWeeks?: boolean;
|
|
2271
|
+
today?: ISODate;
|
|
2272
|
+
timeZone?: string;
|
|
2273
|
+
/** Range mode: fewest / most days, both ends counted. */
|
|
2274
|
+
minDays?: number;
|
|
2275
|
+
maxDays?: number;
|
|
2276
|
+
/** Close the popup after a pick (a range's end, or a preset). Default true. */
|
|
2277
|
+
closeOnSelect?: boolean;
|
|
2278
|
+
/** Shortcuts shown beside the calendar, e.g. "Today", "Next 7 days". */
|
|
2279
|
+
presets?: Array<DatePickerPreset<ISODate | DateRange>>;
|
|
2280
|
+
/** Show a clear button while there is a value. */
|
|
2281
|
+
clearable?: boolean;
|
|
2282
|
+
placement?: Placement;
|
|
2283
|
+
label?: ReactNode;
|
|
2284
|
+
hint?: ReactNode;
|
|
2285
|
+
error?: ReactNode;
|
|
2286
|
+
size?: 'sm' | 'md' | 'lg';
|
|
2287
|
+
/** Shrink the box to its content instead of filling the width (like Input). Default false. */
|
|
2288
|
+
inline?: boolean;
|
|
2289
|
+
disabled?: boolean;
|
|
2290
|
+
readOnly?: boolean;
|
|
2291
|
+
required?: boolean;
|
|
2292
|
+
invalid?: boolean;
|
|
2293
|
+
/** Submit name. In range mode both ends submit under it unless `startName` / `endName` are set. */
|
|
2294
|
+
name?: string;
|
|
2295
|
+
startName?: string;
|
|
2296
|
+
endName?: string;
|
|
2297
|
+
form?: string;
|
|
2298
|
+
id?: string;
|
|
2299
|
+
className?: string;
|
|
2300
|
+
'aria-label'?: string;
|
|
2301
|
+
'aria-labelledby'?: string;
|
|
2302
|
+
'aria-describedby'?: string;
|
|
2303
|
+
/** Accessible names of the two inputs in range mode. */
|
|
2304
|
+
startLabel?: string;
|
|
2305
|
+
endLabel?: string;
|
|
2306
|
+
}
|
|
2307
|
+
type DatePickerProps = DatePickerBaseProps & ({
|
|
2308
|
+
mode?: 'single';
|
|
2309
|
+
value?: ISODate | null;
|
|
2310
|
+
defaultValue?: ISODate | null;
|
|
2311
|
+
onValueChange?(value: ISODate | null): void;
|
|
2312
|
+
} | {
|
|
2313
|
+
mode: 'range';
|
|
2314
|
+
value?: DateRange | null;
|
|
2315
|
+
defaultValue?: DateRange | null;
|
|
2316
|
+
onValueChange?(value: DateRange | null): void;
|
|
2317
|
+
});
|
|
2318
|
+
/** Date field with a calendar popup. Type a date or pick one; single or range. Value is ISO. */
|
|
2319
|
+
declare const DatePicker: react.ForwardRefExoticComponent<DatePickerProps & react.RefAttributes<HTMLDivElement>>;
|
|
2320
|
+
|
|
2321
|
+
interface TimeInputProps {
|
|
2322
|
+
/** 24-hour ISO time like `"14:30"` (or `"14:30:15"` with `granularity="second"`), or null. */
|
|
2323
|
+
value?: string | null;
|
|
2324
|
+
defaultValue?: string | null;
|
|
2325
|
+
onValueChange?(value: string | null): void;
|
|
2326
|
+
/** Smallest unit shown. Default `'minute'`. */
|
|
2327
|
+
granularity?: 'minute' | 'second';
|
|
2328
|
+
/** 12 or 24 hour clock. Defaults to the locale's. */
|
|
2329
|
+
hourCycle?: 12 | 24;
|
|
2330
|
+
/** Earliest valid time, like `"09:00"`. */
|
|
2331
|
+
min?: string;
|
|
2332
|
+
/** Latest valid time, like `"17:30"`. */
|
|
2333
|
+
max?: string;
|
|
2334
|
+
/** BCP 47 locale for separators and clock. Defaults to the page's `lang`, then the browser's. */
|
|
2335
|
+
locale?: string;
|
|
2336
|
+
label?: ReactNode;
|
|
2337
|
+
hint?: ReactNode;
|
|
2338
|
+
error?: ReactNode;
|
|
2339
|
+
size?: 'sm' | 'md' | 'lg';
|
|
2340
|
+
/** Shrink the box to its content instead of filling the width (like Input). Default false. */
|
|
2341
|
+
inline?: boolean;
|
|
2342
|
+
disabled?: boolean;
|
|
2343
|
+
readOnly?: boolean;
|
|
2344
|
+
required?: boolean;
|
|
2345
|
+
invalid?: boolean;
|
|
2346
|
+
/** Submits the 24-hour time under this name (hidden input). */
|
|
2347
|
+
name?: string;
|
|
2348
|
+
form?: string;
|
|
2349
|
+
id?: string;
|
|
2350
|
+
className?: string;
|
|
2351
|
+
'aria-label'?: string;
|
|
2352
|
+
'aria-labelledby'?: string;
|
|
2353
|
+
'aria-describedby'?: string;
|
|
2354
|
+
/** Content after the segments, inside the box. */
|
|
2355
|
+
suffix?: ReactNode;
|
|
2356
|
+
}
|
|
2357
|
+
/** Segmented time entry: hour, minute (optional second) and AM/PM on a 12-hour clock. Value is 24-hour `HH:mm`. */
|
|
2358
|
+
declare const TimeInput: react.ForwardRefExoticComponent<TimeInputProps & react.RefAttributes<HTMLDivElement>>;
|
|
2359
|
+
|
|
2360
|
+
type HeadingLevel = 2 | 3 | 4 | 5 | 6;
|
|
2361
|
+
interface AccordionItemData {
|
|
2362
|
+
value: string;
|
|
2363
|
+
title: ReactNode;
|
|
2364
|
+
content: ReactNode;
|
|
2365
|
+
disabled?: boolean;
|
|
2366
|
+
}
|
|
2367
|
+
interface AccordionProps extends Omit<HTMLAttributes<HTMLDivElement>, 'defaultValue' | 'onChange'> {
|
|
2368
|
+
/** Open item values (always an array, even when only one can be open). Controlled. */
|
|
2369
|
+
value?: string[];
|
|
2370
|
+
defaultValue?: string[];
|
|
2371
|
+
onValueChange?(value: string[]): void;
|
|
2372
|
+
/** Allow several items open at once. Default false. */
|
|
2373
|
+
multiple?: boolean;
|
|
2374
|
+
/** With `multiple={false}`: whether the open item can be closed again. Default true. */
|
|
2375
|
+
collapsible?: boolean;
|
|
2376
|
+
/** Disable every item. Triggers stay focusable. */
|
|
2377
|
+
disabled?: boolean;
|
|
2378
|
+
/** Keep closed panels in the DOM (hidden). Default false. */
|
|
2379
|
+
keepMounted?: boolean;
|
|
2380
|
+
/** Heading level that wraps each trigger. Default 3. */
|
|
2381
|
+
headingLevel?: HeadingLevel;
|
|
2382
|
+
/** `framed` = squircle frame around the list, `plain` = hairlines only. Default 'framed'. */
|
|
2383
|
+
variant?: 'framed' | 'plain';
|
|
2384
|
+
/** 'md' for pages and settings; 'sm' for dashboards: 40px header rows (28px trigger, 6px inset), 13px titles. Default 'md'. */
|
|
2385
|
+
size?: 'sm' | 'md';
|
|
2386
|
+
/** Fill the parent's height: open items share it and scroll on their own; folded items shrink to their header. */
|
|
2387
|
+
fill?: boolean;
|
|
2388
|
+
radius?: RadiusValue;
|
|
2389
|
+
/** Shorthand: render items from data instead of parts. */
|
|
2390
|
+
items?: AccordionItemData[];
|
|
2391
|
+
children?: ReactNode;
|
|
2392
|
+
}
|
|
2393
|
+
/** Stacked disclosure sections. Each trigger sits in a heading and toggles its panel. */
|
|
2394
|
+
declare function Accordion({ value: valueProp, defaultValue, onValueChange, multiple, collapsible, disabled, keepMounted, headingLevel, variant, size, fill, radius: radiusProp, items, className, children, ...rest }: AccordionProps): react.JSX.Element;
|
|
2395
|
+
interface AccordionItemProps extends HTMLAttributes<HTMLDivElement> {
|
|
2396
|
+
/** Unique value; listed in the Accordion's `value` while open. */
|
|
2397
|
+
value: string;
|
|
2398
|
+
disabled?: boolean;
|
|
2399
|
+
}
|
|
2400
|
+
declare function AccordionItem({ value, disabled, className, children, ...rest }: AccordionItemProps): react.JSX.Element;
|
|
2401
|
+
interface AccordionTriggerProps extends HTMLAttributes<HTMLButtonElement> {
|
|
2402
|
+
/** Override the Accordion's heading level for this item. */
|
|
2403
|
+
headingLevel?: HeadingLevel;
|
|
2404
|
+
/** Extra content on the right, before the chevron (badge, count). */
|
|
2405
|
+
meta?: ReactNode;
|
|
2406
|
+
/** Controls beside the trigger (not inside it): `Button size="2xs" variant="ghost" iconOnly`. */
|
|
2407
|
+
actions?: ReactNode;
|
|
2408
|
+
}
|
|
2409
|
+
/** The heading + button that toggles its item. Renders `<hN data-sw="accordion-header"><button/></hN>`. */
|
|
2410
|
+
declare function AccordionTrigger({ headingLevel, meta, actions, className, children, onClick, ...rest }: AccordionTriggerProps): react.JSX.Element;
|
|
2411
|
+
interface AccordionPanelProps extends HTMLAttributes<HTMLDivElement> {
|
|
2412
|
+
/** Override the Accordion's `keepMounted`. */
|
|
2413
|
+
keepMounted?: boolean;
|
|
2414
|
+
}
|
|
2415
|
+
declare function AccordionPanel({ keepMounted, className, children, ...rest }: AccordionPanelProps): react.JSX.Element;
|
|
2416
|
+
|
|
2417
|
+
interface CollapsibleProps extends HTMLAttributes<HTMLDivElement> {
|
|
2418
|
+
open?: boolean;
|
|
2419
|
+
defaultOpen?: boolean;
|
|
2420
|
+
onOpenChange?(open: boolean): void;
|
|
2421
|
+
/** Stop the trigger from toggling. */
|
|
2422
|
+
disabled?: boolean;
|
|
2423
|
+
/** Keep the panel's contents mounted (hidden) while closed, so their state survives. Default false. */
|
|
2424
|
+
keepMounted?: boolean;
|
|
2425
|
+
children?: ReactNode;
|
|
2426
|
+
}
|
|
2427
|
+
/** One trigger that shows and hides one panel, with an animated height. */
|
|
2428
|
+
declare function Collapsible({ open: openProp, defaultOpen, onOpenChange, disabled, keepMounted, className, children, ...rest }: CollapsibleProps): react.JSX.Element;
|
|
2429
|
+
interface CollapsibleTriggerProps extends ButtonHTMLAttributes<HTMLButtonElement> {
|
|
2430
|
+
/** Show the rotating chevron. Default true. */
|
|
2431
|
+
indicator?: boolean;
|
|
2432
|
+
}
|
|
2433
|
+
declare function CollapsibleTrigger({ indicator, disabled, className, children, onClick, ...rest }: CollapsibleTriggerProps): react.JSX.Element;
|
|
2434
|
+
interface CollapsiblePanelProps extends HTMLAttributes<HTMLDivElement> {
|
|
2435
|
+
/** Override the Collapsible's `keepMounted`. */
|
|
2436
|
+
keepMounted?: boolean;
|
|
2437
|
+
}
|
|
2438
|
+
declare function CollapsiblePanel({ keepMounted, className, children, ...rest }: CollapsiblePanelProps): react.JSX.Element;
|
|
2439
|
+
|
|
2440
|
+
interface TabsItem {
|
|
2441
|
+
value: string;
|
|
2442
|
+
label: ReactNode;
|
|
2443
|
+
content: ReactNode;
|
|
2444
|
+
icon?: ReactNode;
|
|
2445
|
+
disabled?: boolean;
|
|
2446
|
+
}
|
|
2447
|
+
interface TabsProps extends Omit<HTMLAttributes<HTMLDivElement>, 'defaultValue' | 'onChange'> {
|
|
2448
|
+
value?: string | null;
|
|
2449
|
+
/** Tab selected at first. Defaults to the first enabled tab. */
|
|
2450
|
+
defaultValue?: string | null;
|
|
2451
|
+
onValueChange?(value: string): void;
|
|
2452
|
+
/** Which arrow keys move between tabs. Default 'horizontal'. */
|
|
2453
|
+
orientation?: 'horizontal' | 'vertical';
|
|
2454
|
+
/** `automatic` selects as arrow keys move focus; `manual` waits for Enter/Space. Default 'automatic'. */
|
|
2455
|
+
activation?: 'automatic' | 'manual';
|
|
2456
|
+
/** Arrow keys wrap from last to first. Default true. */
|
|
2457
|
+
loop?: boolean;
|
|
2458
|
+
/** `line` = underline indicator, `pill` = muted track with a sliding pill, `metric` = equal-width cells holding a `<Stat size="sm">` each, the panel plots the chosen metric. Default 'line'. */
|
|
2459
|
+
variant?: 'line' | 'pill' | 'metric';
|
|
2460
|
+
size?: 'sm' | 'md';
|
|
2461
|
+
/** Keep hidden panels mounted. Default false. */
|
|
2462
|
+
keepMounted?: boolean;
|
|
2463
|
+
/** Shorthand: render the list and panels from data. */
|
|
2464
|
+
items?: TabsItem[];
|
|
2465
|
+
/** With `items`: the accessible name of the tab list. */
|
|
2466
|
+
'aria-label'?: string;
|
|
2467
|
+
children?: ReactNode;
|
|
2468
|
+
}
|
|
2469
|
+
/** Tabbed views: a list of tabs with a sliding indicator, and one panel per tab. */
|
|
2470
|
+
declare function Tabs({ value: valueProp, defaultValue, onValueChange, orientation, activation, loop, variant, size, keepMounted, items, className, children, 'aria-label': ariaLabel, ...rest }: TabsProps): react.JSX.Element;
|
|
2471
|
+
interface TabsListProps extends HTMLAttributes<HTMLDivElement> {
|
|
2472
|
+
/** Name the list when the tabs have no visible heading. */
|
|
2473
|
+
'aria-label'?: string;
|
|
2474
|
+
}
|
|
2475
|
+
declare function TabsList({ className, children, onKeyDown, ...rest }: TabsListProps): react.JSX.Element;
|
|
2476
|
+
interface TabProps extends Omit<ButtonHTMLAttributes<HTMLButtonElement>, 'value'> {
|
|
2477
|
+
/** Pairs the tab with the TabsPanel of the same value. */
|
|
2478
|
+
value: string;
|
|
2479
|
+
/** Stays focusable but can't be selected. */
|
|
2480
|
+
disabled?: boolean;
|
|
2481
|
+
icon?: ReactNode;
|
|
2482
|
+
}
|
|
2483
|
+
declare function Tab({ value, disabled, icon, className, children, onClick, ...rest }: TabProps): react.JSX.Element;
|
|
2484
|
+
interface TabsPanelProps extends HTMLAttributes<HTMLDivElement> {
|
|
2485
|
+
value: string;
|
|
2486
|
+
/** Override the Tabs' `keepMounted`. */
|
|
2487
|
+
keepMounted?: boolean;
|
|
2488
|
+
}
|
|
2489
|
+
declare function TabsPanel({ value, keepMounted, className, children, ...rest }: TabsPanelProps): react.JSX.Element | null;
|
|
2490
|
+
|
|
2491
|
+
interface NavigationMenuLinkData {
|
|
2492
|
+
label: ReactNode;
|
|
2493
|
+
href: string;
|
|
2494
|
+
description?: ReactNode;
|
|
2495
|
+
icon?: ReactNode;
|
|
2496
|
+
current?: boolean;
|
|
2497
|
+
}
|
|
2498
|
+
interface NavigationMenuItemData {
|
|
2499
|
+
label: ReactNode;
|
|
2500
|
+
/** Identifies the item. Defaults to its index. */
|
|
2501
|
+
value?: string;
|
|
2502
|
+
/** A plain top-level link (no panel). */
|
|
2503
|
+
href?: string;
|
|
2504
|
+
current?: boolean;
|
|
2505
|
+
/** Links shown in this item's panel. */
|
|
2506
|
+
links?: NavigationMenuLinkData[];
|
|
2507
|
+
/** Panel layout: 1 or 2 columns of links. Default 2 when there are more than 3 links. */
|
|
2508
|
+
columns?: 1 | 2;
|
|
2509
|
+
}
|
|
2510
|
+
interface NavigationMenuProps extends Omit<HTMLAttributes<HTMLElement>, 'defaultValue' | 'onChange'> {
|
|
2511
|
+
/** The open item's value; `null` = all closed. */
|
|
2512
|
+
value?: string | null;
|
|
2513
|
+
defaultValue?: string | null;
|
|
2514
|
+
onValueChange?(value: string | null): void;
|
|
2515
|
+
/** Open panels when the pointer rests on a trigger. Default true; pressing always works. */
|
|
2516
|
+
openOnHover?: boolean;
|
|
2517
|
+
/** ms the pointer rests on a trigger before opening. Default 120. */
|
|
2518
|
+
delay?: number;
|
|
2519
|
+
/** ms before closing after the pointer leaves. Default 200. */
|
|
2520
|
+
closeDelay?: number;
|
|
2521
|
+
/** Close when a link is pressed. Default true. */
|
|
2522
|
+
closeOnSelect?: boolean;
|
|
2523
|
+
/** Shorthand: build the menu from data. */
|
|
2524
|
+
items?: NavigationMenuItemData[];
|
|
2525
|
+
/** Names the navigation landmark. */
|
|
2526
|
+
'aria-label': string;
|
|
2527
|
+
children?: ReactNode;
|
|
2528
|
+
}
|
|
2529
|
+
/** Site navigation: a row of triggers that open panels of links (APG disclosure navigation). */
|
|
2530
|
+
declare function NavigationMenu({ value: valueProp, defaultValue, onValueChange, openOnHover, delay, closeDelay, closeOnSelect, items, className, children, onKeyDown: onKeyDownProp, ...rest }: NavigationMenuProps): react.JSX.Element;
|
|
2531
|
+
declare function NavigationMenuList({ className, ...rest }: HTMLAttributes<HTMLUListElement>): react.JSX.Element;
|
|
2532
|
+
interface NavigationMenuItemProps extends HTMLAttributes<HTMLLIElement> {
|
|
2533
|
+
/** Identifies the item for `value` / `onValueChange`. Generated when left out. */
|
|
2534
|
+
value?: string;
|
|
2535
|
+
}
|
|
2536
|
+
declare function NavigationMenuItem({ value, className, children, onPointerEnter, onPointerLeave, ...rest }: NavigationMenuItemProps): react.JSX.Element;
|
|
2537
|
+
interface NavigationMenuTriggerProps extends ButtonHTMLAttributes<HTMLButtonElement> {
|
|
2538
|
+
}
|
|
2539
|
+
declare function NavigationMenuTrigger({ className, children, onClick, onKeyDown, onPointerEnter, ...rest }: NavigationMenuTriggerProps): react.JSX.Element;
|
|
2540
|
+
interface NavigationMenuContentProps extends HTMLAttributes<HTMLDivElement> {
|
|
2541
|
+
/** Lay the links out in 1 or 2 columns. Default 1. */
|
|
2542
|
+
columns?: 1 | 2;
|
|
2543
|
+
/** Keep the panel in the DOM (hidden) while closed, e.g. for crawlers. */
|
|
2544
|
+
keepMounted?: boolean;
|
|
2545
|
+
}
|
|
2546
|
+
declare function NavigationMenuContent({ columns, keepMounted, className, children, onKeyDown: onKeyDownProp, ...rest }: NavigationMenuContentProps): react.JSX.Element;
|
|
2547
|
+
interface NavigationMenuLinkProps extends AnchorHTMLAttributes<HTMLAnchorElement> {
|
|
2548
|
+
/** The current page: sets aria-current="page". */
|
|
2549
|
+
current?: boolean;
|
|
2550
|
+
/** A short line under the label (in panels). */
|
|
2551
|
+
description?: ReactNode;
|
|
2552
|
+
icon?: ReactNode;
|
|
2553
|
+
/** Override the menu's `closeOnSelect`. */
|
|
2554
|
+
closeOnSelect?: boolean;
|
|
2555
|
+
}
|
|
2556
|
+
declare function NavigationMenuLink({ current, description, icon, closeOnSelect, className, children, onClick, ...rest }: NavigationMenuLinkProps): react.JSX.Element;
|
|
2557
|
+
|
|
2558
|
+
type PaginationEntry = number | 'ellipsis-start' | 'ellipsis-end';
|
|
2559
|
+
/**
|
|
2560
|
+
* The visible range: page numbers plus 'ellipsis-start' / 'ellipsis-end' markers.
|
|
2561
|
+
* Always the same length for a given count, so the row doesn't jump as you page.
|
|
2562
|
+
*/
|
|
2563
|
+
declare function paginationRange(page: number, pageCount: number, siblings?: number, boundaries?: number): PaginationEntry[];
|
|
2564
|
+
interface PaginationProps extends Omit<HTMLAttributes<HTMLElement>, 'onChange'> {
|
|
2565
|
+
/** Current page, from 1. Controlled. */
|
|
2566
|
+
page?: number;
|
|
2567
|
+
defaultPage?: number;
|
|
2568
|
+
onPageChange?(page: number): void;
|
|
2569
|
+
/** Number of pages. Or pass `total` + `pageSize`. */
|
|
2570
|
+
pageCount?: number;
|
|
2571
|
+
total?: number;
|
|
2572
|
+
pageSize?: number;
|
|
2573
|
+
/** Pages shown on each side of the current one. Default 1. */
|
|
2574
|
+
siblings?: number;
|
|
2575
|
+
/** Pages always shown at each end. Default 1. */
|
|
2576
|
+
boundaries?: number;
|
|
2577
|
+
/** URL for a page. With it, pages render as links (work without JS, open in new tabs). */
|
|
2578
|
+
getHref?(page: number): string;
|
|
2579
|
+
/** Show First / Last buttons. Default false. */
|
|
2580
|
+
showFirstLast?: boolean;
|
|
2581
|
+
/** Hide the numbers: just Previous · "3 of 12" · Next. Default false. */
|
|
2582
|
+
simple?: boolean;
|
|
2583
|
+
/** 'compact': "‹ 2 / 5 ›" with 24px icon buttons, for a Card or tile header. Default 'default'. */
|
|
2584
|
+
variant?: 'default' | 'compact';
|
|
2585
|
+
/** What is paged, for the compact variant's button names ("Next region"). Default "page". */
|
|
2586
|
+
noun?: string;
|
|
2587
|
+
size?: 'sm' | 'md';
|
|
2588
|
+
/** Text for Previous / Next (shown at ≥ 480px; icon only below). */
|
|
2589
|
+
labels?: {
|
|
2590
|
+
previous?: string;
|
|
2591
|
+
next?: string;
|
|
2592
|
+
first?: string;
|
|
2593
|
+
last?: string;
|
|
2594
|
+
};
|
|
2595
|
+
/** Names the navigation landmark. Default "Pagination". */
|
|
2596
|
+
'aria-label'?: string;
|
|
2597
|
+
}
|
|
2598
|
+
/** Page through results: numbered pages with ellipses, Previous / Next, as buttons or links. */
|
|
2599
|
+
declare function Pagination({ page: pageProp, defaultPage, onPageChange, pageCount, total, pageSize, siblings, boundaries, getHref, showFirstLast, simple, variant, noun, size, labels, className, 'aria-label': ariaLabel, ...rest }: PaginationProps): react.JSX.Element;
|
|
2600
|
+
|
|
2601
|
+
interface ToolbarProps extends HTMLAttributes<HTMLDivElement> {
|
|
2602
|
+
/** Which arrow keys move focus. Default 'horizontal'. */
|
|
2603
|
+
orientation?: 'horizontal' | 'vertical';
|
|
2604
|
+
/** Arrow keys wrap from the last item to the first. Default true. */
|
|
2605
|
+
loop?: boolean;
|
|
2606
|
+
/** Disable every item (they stay focusable with aria-disabled). */
|
|
2607
|
+
disabled?: boolean;
|
|
2608
|
+
size?: 'sm' | 'md';
|
|
2609
|
+
/** `framed` = squircle frame, `plain` = no frame. Default 'framed'. */
|
|
2610
|
+
variant?: 'framed' | 'plain';
|
|
2611
|
+
radius?: RadiusValue;
|
|
2612
|
+
/** Names the toolbar, e.g. "Text formatting". */
|
|
2613
|
+
'aria-label': string;
|
|
2614
|
+
children?: ReactNode;
|
|
2615
|
+
}
|
|
2616
|
+
/** A row of controls with one tab stop; arrow keys move between them (APG toolbar). */
|
|
2617
|
+
declare function Toolbar({ orientation, loop, disabled, size, variant, radius, className, children, onKeyDown, onFocus, ...rest }: ToolbarProps): react.JSX.Element;
|
|
2618
|
+
interface ToolbarButtonProps extends ButtonHTMLAttributes<HTMLButtonElement> {
|
|
2619
|
+
/** Disabled but still reachable with arrow keys (aria-disabled). */
|
|
2620
|
+
disabled?: boolean;
|
|
2621
|
+
/** Skip the item entirely when disabled (native disabled). Default false. */
|
|
2622
|
+
focusableWhenDisabled?: boolean;
|
|
2623
|
+
/** Icon before the label. For icon-only buttons pass `aria-label`. */
|
|
2624
|
+
icon?: ReactNode;
|
|
2625
|
+
}
|
|
2626
|
+
declare const ToolbarButton: react.ForwardRefExoticComponent<ToolbarButtonProps & react.RefAttributes<HTMLButtonElement>>;
|
|
2627
|
+
interface ToolbarToggleProps extends Omit<ToolbarButtonProps, 'onChange'> {
|
|
2628
|
+
pressed?: boolean;
|
|
2629
|
+
defaultPressed?: boolean;
|
|
2630
|
+
onPressedChange?(pressed: boolean): void;
|
|
2631
|
+
}
|
|
2632
|
+
/** A two-state button inside a toolbar (aria-pressed). Moving focus never toggles it. */
|
|
2633
|
+
declare const ToolbarToggle: react.ForwardRefExoticComponent<ToolbarToggleProps & react.RefAttributes<HTMLButtonElement>>;
|
|
2634
|
+
interface ToolbarLinkProps extends AnchorHTMLAttributes<HTMLAnchorElement> {
|
|
2635
|
+
icon?: ReactNode;
|
|
2636
|
+
}
|
|
2637
|
+
declare function ToolbarLink({ icon, className, children, onClick, ...rest }: ToolbarLinkProps): react.JSX.Element;
|
|
2638
|
+
interface ToolbarInputProps extends Omit<InputHTMLAttributes<HTMLInputElement>, 'size' | 'prefix'> {
|
|
2639
|
+
disabled?: boolean;
|
|
2640
|
+
focusableWhenDisabled?: boolean;
|
|
2641
|
+
/** Icon inside the field, before the text. */
|
|
2642
|
+
prefix?: ReactNode;
|
|
2643
|
+
}
|
|
2644
|
+
declare const ToolbarInput: react.ForwardRefExoticComponent<ToolbarInputProps & react.RefAttributes<HTMLInputElement>>;
|
|
2645
|
+
interface ToolbarGroupProps extends HTMLAttributes<HTMLDivElement> {
|
|
2646
|
+
/** Disable every item in the group. */
|
|
2647
|
+
disabled?: boolean;
|
|
2648
|
+
/** Names the group, e.g. "Alignment". */
|
|
2649
|
+
'aria-label'?: string;
|
|
2650
|
+
}
|
|
2651
|
+
declare function ToolbarGroup({ disabled, className, ...rest }: ToolbarGroupProps): react.JSX.Element;
|
|
2652
|
+
declare function ToolbarSeparator({ className, ...rest }: HTMLAttributes<HTMLDivElement>): react.JSX.Element;
|
|
2653
|
+
|
|
2654
|
+
interface TreeItemData {
|
|
2655
|
+
/** Unique in the tree. Used by `value`, `expanded` and `onAction`. */
|
|
2656
|
+
id: string;
|
|
2657
|
+
/** Shown text; also what typeahead matches. */
|
|
2658
|
+
label: string;
|
|
2659
|
+
/** Children make it a branch. An empty array is an empty branch. */
|
|
2660
|
+
children?: TreeItemData[];
|
|
2661
|
+
/** Replace the folder / file icon. */
|
|
2662
|
+
icon?: ReactNode;
|
|
2663
|
+
/** Can't be selected or run (still focusable). */
|
|
2664
|
+
disabled?: boolean;
|
|
2665
|
+
/** Small trailing text (size, count, status). */
|
|
2666
|
+
meta?: ReactNode;
|
|
2667
|
+
}
|
|
2668
|
+
interface TreeBaseProps {
|
|
2669
|
+
items: TreeItemData[];
|
|
2670
|
+
/** Expanded branch ids. Controlled. */
|
|
2671
|
+
expanded?: string[];
|
|
2672
|
+
defaultExpanded?: string[];
|
|
2673
|
+
onExpandedChange?(expanded: string[]): void;
|
|
2674
|
+
/** Runs when an item is pressed or Enter is pressed on it (e.g. open the file). */
|
|
2675
|
+
onAction?(id: string, item: TreeItemData): void;
|
|
2676
|
+
/** Single selection follows keyboard focus. Default false (Enter / Space / click selects). */
|
|
2677
|
+
selectionFollowsFocus?: boolean;
|
|
2678
|
+
/** Pressing a branch row toggles it. Default true (the chevron always does). */
|
|
2679
|
+
expandOnPress?: boolean;
|
|
2680
|
+
/** Folder / file icons. Default true. */
|
|
2681
|
+
showIcons?: boolean;
|
|
2682
|
+
/** Custom row content. */
|
|
2683
|
+
renderLabel?(item: TreeItemData, state: {
|
|
2684
|
+
expanded: boolean;
|
|
2685
|
+
selected: boolean;
|
|
2686
|
+
level: number;
|
|
2687
|
+
}): ReactNode;
|
|
2688
|
+
size?: 'sm' | 'md';
|
|
2689
|
+
disabled?: boolean;
|
|
2690
|
+
/** Own 1px squircle frame with a 4px inset; rows are concentric with it. Default true. Set false inside a pane or card that already frames it. */
|
|
2691
|
+
framed?: boolean;
|
|
2692
|
+
/** Frame radius token or px. Default 'md'. */
|
|
2693
|
+
radius?: RadiusValue;
|
|
2694
|
+
className?: string;
|
|
2695
|
+
style?: CSSProperties;
|
|
2696
|
+
id?: string;
|
|
2697
|
+
/** Names the tree, e.g. "Project files". */
|
|
2698
|
+
'aria-label'?: string;
|
|
2699
|
+
'aria-labelledby'?: string;
|
|
2700
|
+
}
|
|
2701
|
+
interface TreeSingle {
|
|
2702
|
+
/** Several items can be selected. Default false. */
|
|
2703
|
+
multiple?: false;
|
|
2704
|
+
value?: string | null;
|
|
2705
|
+
defaultValue?: string | null;
|
|
2706
|
+
onValueChange?(value: string | null): void;
|
|
2707
|
+
}
|
|
2708
|
+
interface TreeMultiple {
|
|
2709
|
+
multiple: true;
|
|
2710
|
+
value?: string[];
|
|
2711
|
+
defaultValue?: string[];
|
|
2712
|
+
onValueChange?(value: string[]): void;
|
|
2713
|
+
}
|
|
2714
|
+
type TreeProps = TreeBaseProps & (TreeSingle | TreeMultiple);
|
|
2715
|
+
/** A hierarchy of expandable branches with single or multiple selection (APG tree view). */
|
|
2716
|
+
declare function Tree(props: TreeProps): react.JSX.Element;
|
|
2717
|
+
|
|
2718
|
+
interface ScrollAreaHandle {
|
|
2719
|
+
/** The native scrolling element. */
|
|
2720
|
+
viewport: HTMLDivElement | null;
|
|
2721
|
+
scrollToEnd(behavior?: ScrollBehavior): void;
|
|
2722
|
+
scrollToStart(behavior?: ScrollBehavior): void;
|
|
2723
|
+
}
|
|
2724
|
+
interface ScrollAreaProps extends HTMLAttributes<HTMLDivElement> {
|
|
2725
|
+
/** Which axes scroll. Default 'vertical'. */
|
|
2726
|
+
orientation?: 'vertical' | 'horizontal' | 'both';
|
|
2727
|
+
/** When the overlay scrollbars show: on hover/scroll, while scrolling, whenever it overflows, or always. Default 'hover'. */
|
|
2728
|
+
type?: 'hover' | 'scroll' | 'auto' | 'always';
|
|
2729
|
+
/** Fade the content at edges that have more to scroll. Default true. */
|
|
2730
|
+
fades?: boolean;
|
|
2731
|
+
/** Stick to the end as content grows (chat log, streamed output). Scrolling up lets go; scrolling back sticks again. */
|
|
2732
|
+
followEnd?: boolean;
|
|
2733
|
+
/** With `followEnd`: show a "jump to latest" button while away from the end. Default true. */
|
|
2734
|
+
scrollToEndButton?: boolean;
|
|
2735
|
+
/** Label for that button. Default "Jump to latest". */
|
|
2736
|
+
scrollToEndLabel?: string;
|
|
2737
|
+
/** ms the scrollbars linger after scrolling stops. Default 700. */
|
|
2738
|
+
scrollHideDelay?: number;
|
|
2739
|
+
/** Cap the height (CSS length or px). Same as `style.maxHeight`. */
|
|
2740
|
+
maxHeight?: CSSProperties['maxHeight'];
|
|
2741
|
+
/** Props for the native scrolling viewport (e.g. role="log"). */
|
|
2742
|
+
viewportProps?: HTMLAttributes<HTMLDivElement>;
|
|
2743
|
+
children?: ReactNode;
|
|
2744
|
+
}
|
|
2745
|
+
/** Native scrolling with slim overlay scrollbars, edge fades and an optional stick-to-bottom mode. */
|
|
2746
|
+
declare const ScrollArea: react.ForwardRefExoticComponent<ScrollAreaProps & react.RefAttributes<ScrollAreaHandle>>;
|
|
2747
|
+
|
|
2748
|
+
interface ResizablePanelProps extends HTMLAttributes<HTMLDivElement> {
|
|
2749
|
+
/** Stable id: used by `aria-controls` and saved layouts. Generated when left out. */
|
|
2750
|
+
id?: string;
|
|
2751
|
+
/** Starting size in percent of the group. Panels without one share what's left. */
|
|
2752
|
+
defaultSize?: number;
|
|
2753
|
+
/** Smallest size in percent while open. Default 0. */
|
|
2754
|
+
minSize?: number;
|
|
2755
|
+
/** Largest size in percent. Default 100. */
|
|
2756
|
+
maxSize?: number;
|
|
2757
|
+
/** Can collapse below `minSize` to `collapsedSize` (drag past halfway, Enter or double-click the handle). */
|
|
2758
|
+
collapsible?: boolean;
|
|
2759
|
+
/** Size when collapsed, in percent. Default 0. */
|
|
2760
|
+
collapsedSize?: number;
|
|
2761
|
+
children?: ReactNode;
|
|
2762
|
+
}
|
|
2763
|
+
interface ResizableHandleProps extends HTMLAttributes<HTMLDivElement> {
|
|
2764
|
+
/** Names the handle, e.g. "Resize file list". */
|
|
2765
|
+
'aria-label'?: string;
|
|
2766
|
+
disabled?: boolean;
|
|
2767
|
+
/** Show a small grip on the handle. Default true. */
|
|
2768
|
+
withGrip?: boolean;
|
|
2769
|
+
}
|
|
2770
|
+
interface ResizableProps extends HTMLAttributes<HTMLDivElement> {
|
|
2771
|
+
/** Panel sizes in percent, in order, e.g. [25, 75]. Controlled. */
|
|
2772
|
+
layout?: number[];
|
|
2773
|
+
defaultLayout?: number[];
|
|
2774
|
+
/** Every change: each drag frame and each key. */
|
|
2775
|
+
onLayoutChange?(layout: number[]): void;
|
|
2776
|
+
/** Once an interaction ends (pointer up, key handled, collapse). For saving. */
|
|
2777
|
+
onLayoutCommit?(layout: number[]): void;
|
|
2778
|
+
/** Horizontal = side by side, vertical = stacked. Default 'horizontal'. */
|
|
2779
|
+
orientation?: 'horizontal' | 'vertical';
|
|
2780
|
+
disabled?: boolean;
|
|
2781
|
+
/** Arrow-key step in percent. Default 5. */
|
|
2782
|
+
step?: number;
|
|
2783
|
+
/** Shift+Arrow step in percent. Default 20. */
|
|
2784
|
+
largeStep?: number;
|
|
2785
|
+
/** Save the layout to localStorage under this key and restore it on the next visit. */
|
|
2786
|
+
autoSaveId?: string;
|
|
2787
|
+
/** Draw the group's own 1px squircle frame and clip panels to it. Default true. Set false when nested or already inside a framed surface. */
|
|
2788
|
+
framed?: boolean;
|
|
2789
|
+
/** Frame radius token or px. Default 'md'. */
|
|
2790
|
+
radius?: RadiusValue;
|
|
2791
|
+
/** `ResizablePanel` and `ResizableHandle` elements as direct children. */
|
|
2792
|
+
children?: ReactNode;
|
|
2793
|
+
}
|
|
2794
|
+
/** Panels with draggable, keyboard-operable handles between them (APG window splitter). */
|
|
2795
|
+
declare function Resizable({ layout: layoutProp, defaultLayout, onLayoutChange, onLayoutCommit, orientation, disabled, step, largeStep, autoSaveId, framed, radius, className, style, children, ...rest }: ResizableProps): react.JSX.Element;
|
|
2796
|
+
declare function ResizablePanel({ id: _id, defaultSize: _d, minSize: _min, maxSize: _max, collapsible: _c, collapsedSize: _cs, className, style, children, ...rest }: ResizablePanelProps): react.JSX.Element;
|
|
2797
|
+
declare function ResizableHandle({ disabled, withGrip, className, onKeyDown, onDoubleClick, onPointerDown, ...rest }: ResizableHandleProps): react.JSX.Element;
|
|
2798
|
+
|
|
2799
|
+
interface CarouselProps extends Omit<HTMLAttributes<HTMLDivElement>, 'onChange'> {
|
|
2800
|
+
/** Current page, from 1. Controlled. */
|
|
2801
|
+
page?: number;
|
|
2802
|
+
defaultPage?: number;
|
|
2803
|
+
onPageChange?(page: number): void;
|
|
2804
|
+
/** Slides per page: Next moves this many, each dot stands for this many. Default 1. */
|
|
2805
|
+
slidesPerPage?: number;
|
|
2806
|
+
/** Next on the last page goes to the first (and Previous the other way). Default false. */
|
|
2807
|
+
loop?: boolean;
|
|
2808
|
+
/** Rotate automatically. Controlled. */
|
|
2809
|
+
playing?: boolean;
|
|
2810
|
+
/** Start rotating (ignored when the user prefers reduced motion). Default false. */
|
|
2811
|
+
defaultPlaying?: boolean;
|
|
2812
|
+
onPlayingChange?(playing: boolean): void;
|
|
2813
|
+
/** ms per page while rotating. Default 5000. */
|
|
2814
|
+
interval?: number;
|
|
2815
|
+
/** Default layout only: Previous / Next buttons. Default true. */
|
|
2816
|
+
controls?: boolean;
|
|
2817
|
+
/** Default layout only: page dots. Default true. */
|
|
2818
|
+
indicators?: boolean;
|
|
2819
|
+
/** Gap between slides in px. Default 12. */
|
|
2820
|
+
gap?: number;
|
|
2821
|
+
/** Names the carousel, e.g. "Featured templates". Required. */
|
|
2822
|
+
'aria-label': string;
|
|
2823
|
+
/** Labels for the built-in controls. */
|
|
2824
|
+
labels?: {
|
|
2825
|
+
previous?: string;
|
|
2826
|
+
next?: string;
|
|
2827
|
+
play?: string;
|
|
2828
|
+
pause?: string;
|
|
2829
|
+
page?(n: number): string;
|
|
2830
|
+
slide?(n: number, total: number): string;
|
|
2831
|
+
};
|
|
2832
|
+
/**
|
|
2833
|
+
* `CarouselItem` elements for the default layout (viewport, then play toggle, dots and Previous / Next).
|
|
2834
|
+
* For your own layout, pass parts instead: `CarouselViewport` (holding the items), `CarouselControls`,
|
|
2835
|
+
* `CarouselPlayToggle`, `CarouselIndicators`, `CarouselPrevious`, `CarouselNext`.
|
|
2836
|
+
*/
|
|
2837
|
+
children?: ReactNode;
|
|
2838
|
+
}
|
|
2839
|
+
interface CarouselItemProps extends HTMLAttributes<HTMLDivElement> {
|
|
2840
|
+
children?: ReactNode;
|
|
2841
|
+
}
|
|
2842
|
+
/** One slide. Labelled by its position ("2 of 5") unless it has its own aria-label. */
|
|
2843
|
+
declare function CarouselItem({ className, children, ...rest }: CarouselItemProps): react.JSX.Element;
|
|
2844
|
+
/** Slides on native scroll-snap with Previous / Next, dots, keyboard and optional autoplay (APG carousel). */
|
|
2845
|
+
declare function Carousel({ page: pageProp, defaultPage, onPageChange, slidesPerPage, loop, playing: playingProp, defaultPlaying, onPlayingChange, interval, controls, indicators, gap, labels, className, style, children, 'aria-label': ariaLabel, ...rest }: CarouselProps): react.JSX.Element;
|
|
2846
|
+
interface CarouselViewportProps extends HTMLAttributes<HTMLDivElement> {
|
|
2847
|
+
/** `CarouselItem` elements. */
|
|
2848
|
+
children?: ReactNode;
|
|
2849
|
+
}
|
|
2850
|
+
/** The scrolling area that holds the slides. Focusable; arrow keys, Home and End page through it. */
|
|
2851
|
+
declare function CarouselViewport({ className, children, ...rest }: CarouselViewportProps): react.JSX.Element;
|
|
2852
|
+
/** The row under the slides: play toggle, dots and Previous / Next in the default layout. */
|
|
2853
|
+
declare function CarouselControls({ className, ...rest }: HTMLAttributes<HTMLDivElement>): react.JSX.Element;
|
|
2854
|
+
/** Previous page. Disabled on the first page unless the carousel loops. */
|
|
2855
|
+
declare function CarouselPrevious(): react.JSX.Element;
|
|
2856
|
+
/** Next page. Disabled on the last page unless the carousel loops. */
|
|
2857
|
+
declare function CarouselNext(): react.JSX.Element;
|
|
2858
|
+
/** Starts and stops rotation. Render it whenever the carousel can autoplay. */
|
|
2859
|
+
declare function CarouselPlayToggle(): react.JSX.Element;
|
|
2860
|
+
/** Page dots: a tablist with one tab stop; arrow keys, Home and End move between pages. Hidden with one page. */
|
|
2861
|
+
declare function CarouselIndicators({ className, ...rest }: HTMLAttributes<HTMLDivElement>): react.JSX.Element | null;
|
|
2862
|
+
|
|
2863
|
+
interface TableColumn {
|
|
2864
|
+
id: string;
|
|
2865
|
+
label: ReactNode;
|
|
2866
|
+
align?: 'start' | 'end';
|
|
2867
|
+
/** Use the cells in this column as row headers. */
|
|
2868
|
+
rowHeader?: boolean;
|
|
2869
|
+
/** Compare two rows by their underlying values. Omit for an unsortable column. */
|
|
2870
|
+
compare?: (a: TableRow, b: TableRow) => number;
|
|
2871
|
+
}
|
|
2872
|
+
interface TableRow {
|
|
2873
|
+
id: string;
|
|
2874
|
+
cells: Record<string, ReactNode>;
|
|
2875
|
+
}
|
|
2876
|
+
interface TableSort {
|
|
2877
|
+
columnId: string;
|
|
2878
|
+
direction: 'ascending' | 'descending';
|
|
2879
|
+
}
|
|
2880
|
+
interface TableProps extends Omit<HTMLAttributes<HTMLTableElement>, 'children'> {
|
|
2881
|
+
caption: string;
|
|
2882
|
+
columns: readonly TableColumn[];
|
|
2883
|
+
rows: readonly TableRow[];
|
|
2884
|
+
emptyMessage?: ReactNode;
|
|
2885
|
+
sort?: TableSort | null;
|
|
2886
|
+
defaultSort?: TableSort | null;
|
|
2887
|
+
onSortChange?: (sort: TableSort) => void;
|
|
2888
|
+
}
|
|
2889
|
+
/** A native data table with a keyboard-accessible horizontal scroll region. */
|
|
2890
|
+
declare function Table({ caption, columns, rows, emptyMessage, sort, defaultSort, onSortChange, className, ...props }: TableProps): react.JSX.Element;
|
|
2891
|
+
|
|
2892
|
+
type AvatarLoadingStatus = 'idle' | 'loading' | 'loaded' | 'error';
|
|
2893
|
+
type AvatarSize = 'xs' | 'sm' | 'md' | 'lg' | 'xl';
|
|
2894
|
+
type AvatarShape = 'circle' | 'squircle';
|
|
2895
|
+
type AvatarPresence = 'online' | 'away' | 'busy' | 'offline';
|
|
2896
|
+
/** "Ada Lovelace" → "AL", "ada@x.dev" → "A". */
|
|
2897
|
+
declare function getInitials(name: string | undefined, max?: number): string;
|
|
2898
|
+
interface AvatarProps extends Omit<HTMLAttributes<HTMLSpanElement>, 'children'> {
|
|
2899
|
+
/** Image URL. Shorthand: renders `<AvatarImage>` + `<AvatarFallback>` for you. */
|
|
2900
|
+
src?: string;
|
|
2901
|
+
/** Image alt text. Defaults to `name`. Pass `""` when a visible name sits beside the avatar. */
|
|
2902
|
+
alt?: string;
|
|
2903
|
+
/** Person or team name. Used for the fallback initials and the accessible name. */
|
|
2904
|
+
name?: string;
|
|
2905
|
+
/** 20 / 28 / 36 / 48 / 64px, or a number of px. Default `md` (inside an AvatarGroup, the group's size). */
|
|
2906
|
+
size?: AvatarSize | number;
|
|
2907
|
+
/** `circle` (people) or `squircle` (teams, workspaces, bots). Default `circle`. */
|
|
2908
|
+
shape?: AvatarShape;
|
|
2909
|
+
/** Presence dot in the corner. */
|
|
2910
|
+
presence?: AvatarPresence;
|
|
2911
|
+
/** Wait this many ms before showing the fallback, so a fast image doesn't flash initials. */
|
|
2912
|
+
delay?: number;
|
|
2913
|
+
/** Called when the image's loading status changes. */
|
|
2914
|
+
onLoadingStatusChange?(status: AvatarLoadingStatus): void;
|
|
2915
|
+
/** Compound use: `<AvatarImage>` and `<AvatarFallback>`. Overrides the `src`/`name` shorthand. */
|
|
2916
|
+
children?: ReactNode;
|
|
2917
|
+
}
|
|
2918
|
+
/** A person or team picture with initials while it loads or if it fails. */
|
|
2919
|
+
declare function Avatar({ src, alt, name, size, shape, presence, delay, onLoadingStatusChange, className, style, children, ...rest }: AvatarProps): react.JSX.Element;
|
|
2920
|
+
interface AvatarImageProps extends ImgHTMLAttributes<HTMLImageElement> {
|
|
2921
|
+
src: string;
|
|
2922
|
+
/** Required. Use `""` when a visible name already identifies the person. */
|
|
2923
|
+
alt: string;
|
|
2924
|
+
}
|
|
2925
|
+
/** The picture. A real `<img>` (also in server markup), hidden until it has loaded. */
|
|
2926
|
+
declare function AvatarImage({ src, alt, className, onLoad, onError, ref, ...rest }: AvatarImageProps & {
|
|
2927
|
+
ref?: React.Ref<HTMLImageElement>;
|
|
2928
|
+
}): react.JSX.Element;
|
|
2929
|
+
interface AvatarFallbackProps extends HTMLAttributes<HTMLSpanElement> {
|
|
2930
|
+
/** ms to wait before showing. Without it, the fallback shows at once (also in server markup). */
|
|
2931
|
+
delay?: number;
|
|
2932
|
+
}
|
|
2933
|
+
/** Initials or an icon, shown until the image loads and kept if it fails. */
|
|
2934
|
+
declare function AvatarFallback({ delay, className, children, ...rest }: AvatarFallbackProps): react.JSX.Element | null;
|
|
2935
|
+
interface AvatarGroupProps extends HTMLAttributes<HTMLDivElement> {
|
|
2936
|
+
/** Show at most this many avatars, then a "+N" bubble. */
|
|
2937
|
+
max?: number;
|
|
2938
|
+
size?: AvatarSize | number;
|
|
2939
|
+
shape?: AvatarShape;
|
|
2940
|
+
/** How much each avatar overlaps the previous one, as a share of its size. Default 0.28. */
|
|
2941
|
+
overlap?: number;
|
|
2942
|
+
/** Accessible name of the group, e.g. "Reviewers". */
|
|
2943
|
+
'aria-label'?: string;
|
|
2944
|
+
children: ReactNode;
|
|
2945
|
+
}
|
|
2946
|
+
/** A row of overlapping avatars with a "+N" count for the rest. */
|
|
2947
|
+
declare function AvatarGroup({ max, size, shape, overlap, className, style, children, ...rest }: AvatarGroupProps): react.JSX.Element;
|
|
2948
|
+
|
|
2949
|
+
/** Small helpers shared by the media batch (Color Picker, Image Cropper, File Input, Waterfall…). */
|
|
2950
|
+
|
|
2951
|
+
/** sRGB color, channels 0–255, alpha 0–1. */
|
|
2952
|
+
interface Rgba {
|
|
2953
|
+
r: number;
|
|
2954
|
+
g: number;
|
|
2955
|
+
b: number;
|
|
2956
|
+
a: number;
|
|
2957
|
+
}
|
|
2958
|
+
/** HSV color: hue 0–360, saturation and value 0–100, alpha 0–1. */
|
|
2959
|
+
interface Hsva {
|
|
2960
|
+
h: number;
|
|
2961
|
+
s: number;
|
|
2962
|
+
v: number;
|
|
2963
|
+
a: number;
|
|
2964
|
+
}
|
|
2965
|
+
type ColorFormat = 'hex' | 'rgb' | 'hsl';
|
|
2966
|
+
/** Write a color as hex (`#rrggbb`, `#rrggbbaa` when translucent), `rgb()` or `hsl()`. */
|
|
2967
|
+
declare function formatColor(c: Hsva, format?: ColorFormat): string;
|
|
2968
|
+
/** Parse any CSS color string to sRGB. hex, rgb() and hsl() work everywhere; other syntaxes need a browser. */
|
|
2969
|
+
declare function parseColor(input: string): Rgba | null;
|
|
2970
|
+
/** "1.2 MB", "820 KB", "12 B". */
|
|
2971
|
+
declare function formatFileSize(bytes: number): string;
|
|
2972
|
+
|
|
2973
|
+
interface ColorPickerProps {
|
|
2974
|
+
/** The color as any CSS color string, e.g. "#0ea5e9" or "rgb(14 165 233)". */
|
|
2975
|
+
value?: string;
|
|
2976
|
+
/** Initial color when uncontrolled. Default "#000000". hex / rgb() / hsl() also parse during SSR. */
|
|
2977
|
+
defaultValue?: string;
|
|
2978
|
+
/** Runs on every step of a drag, key or swatch, with the value written in `format`. */
|
|
2979
|
+
onValueChange?(value: string): void;
|
|
2980
|
+
/** Runs once an interaction ends (pointer up, key press, swatch pick, text commit). For saving. */
|
|
2981
|
+
onValueCommit?(value: string): void;
|
|
2982
|
+
/** How the value is written. Default 'hex' (`#rrggbbaa` when translucent). */
|
|
2983
|
+
format?: ColorFormat;
|
|
2984
|
+
/** Show the alpha slider. Default true. */
|
|
2985
|
+
alpha?: boolean;
|
|
2986
|
+
/** Preset swatches, as CSS colors. */
|
|
2987
|
+
presets?: string[];
|
|
2988
|
+
/** Show the text field that accepts any CSS color. Default true. */
|
|
2989
|
+
showInput?: boolean;
|
|
2990
|
+
/** Submit the value under this name (hidden input). */
|
|
2991
|
+
name?: string;
|
|
2992
|
+
form?: string;
|
|
2993
|
+
disabled?: boolean;
|
|
2994
|
+
readOnly?: boolean;
|
|
2995
|
+
required?: boolean;
|
|
2996
|
+
id?: string;
|
|
2997
|
+
/** Names the picker when it isn't inside a `<Field>`. */
|
|
2998
|
+
'aria-label'?: string;
|
|
2999
|
+
'aria-describedby'?: string;
|
|
3000
|
+
className?: string;
|
|
3001
|
+
style?: CSSProperties;
|
|
3002
|
+
}
|
|
3003
|
+
/** Saturation/brightness area + hue and alpha sliders + text field + presets. Value is a CSS color string. */
|
|
3004
|
+
declare function ColorPicker(props: ColorPickerProps): react.JSX.Element;
|
|
3005
|
+
interface ColorPickerPopoverProps extends ColorPickerProps {
|
|
3006
|
+
open?: boolean;
|
|
3007
|
+
defaultOpen?: boolean;
|
|
3008
|
+
onOpenChange?(open: boolean): void;
|
|
3009
|
+
placement?: Placement;
|
|
3010
|
+
/** Trigger size. Default `md`. */
|
|
3011
|
+
size?: 'sm' | 'md' | 'lg';
|
|
3012
|
+
/** Trigger text. Default: the value. */
|
|
3013
|
+
children?: ReactNode;
|
|
3014
|
+
}
|
|
3015
|
+
/** A swatch trigger that opens a ColorPicker in a popover. */
|
|
3016
|
+
declare function ColorPickerPopover({ open, defaultOpen, onOpenChange, placement, size, children, value, defaultValue, onValueChange, name, form, className, style, ...pickerProps }: ColorPickerPopoverProps): react.JSX.Element;
|
|
3017
|
+
|
|
3018
|
+
type FileRejectionReason = 'file-type' | 'file-too-large' | 'file-too-small' | 'too-many-files' | (string & {});
|
|
3019
|
+
interface FileRejection {
|
|
3020
|
+
file: File;
|
|
3021
|
+
reasons: FileRejectionReason[];
|
|
3022
|
+
}
|
|
3023
|
+
interface FileInputProps {
|
|
3024
|
+
/** Accepted files, like the `accept` attribute: "image/*", ".pdf", "application/json", as a string or array. */
|
|
3025
|
+
accept?: string | readonly string[];
|
|
3026
|
+
/** Hold more than one file. Without it, a new file replaces the current one. */
|
|
3027
|
+
multiple?: boolean;
|
|
3028
|
+
/** The most files held at once (counts files already held). */
|
|
3029
|
+
maxFiles?: number;
|
|
3030
|
+
/** Largest file in bytes. */
|
|
3031
|
+
maxSize?: number;
|
|
3032
|
+
/** Smallest file in bytes. */
|
|
3033
|
+
minSize?: number;
|
|
3034
|
+
/** Your own check. Return a reason string to reject, or nothing to accept. Runs after the built-in checks. */
|
|
3035
|
+
validate?(file: File): string | null | undefined | void;
|
|
3036
|
+
value?: File[];
|
|
3037
|
+
defaultValue?: File[];
|
|
3038
|
+
onValueChange?(files: File[]): void;
|
|
3039
|
+
/** Files that failed the checks, with every reason. */
|
|
3040
|
+
onReject?(rejected: FileRejection[]): void;
|
|
3041
|
+
/** `dropzone` (default): a drop area with a browse button. `button`: only the button and the list. */
|
|
3042
|
+
variant?: 'dropzone' | 'button';
|
|
3043
|
+
/** Dropzone heading. Default "Drop files here". */
|
|
3044
|
+
title?: ReactNode;
|
|
3045
|
+
/** Dropzone hint. Default: built from accept / maxSize / maxFiles. */
|
|
3046
|
+
hint?: ReactNode;
|
|
3047
|
+
/** Browse button text. Default "Browse files". */
|
|
3048
|
+
buttonLabel?: ReactNode;
|
|
3049
|
+
/** Show the file list. Default true. */
|
|
3050
|
+
showList?: boolean;
|
|
3051
|
+
/** Custom content per file in the list (the remove button is added for you). */
|
|
3052
|
+
renderItem?(file: File, index: number): ReactNode;
|
|
3053
|
+
/** Submit the files under this name (a real `<input type="file">`, kept in sync). */
|
|
3054
|
+
name?: string;
|
|
3055
|
+
form?: string;
|
|
3056
|
+
required?: boolean;
|
|
3057
|
+
disabled?: boolean;
|
|
3058
|
+
id?: string;
|
|
3059
|
+
'aria-label'?: string;
|
|
3060
|
+
'aria-describedby'?: string;
|
|
3061
|
+
className?: string;
|
|
3062
|
+
style?: CSSProperties;
|
|
3063
|
+
}
|
|
3064
|
+
/** Choose, drop or paste files; validate them; list them with remove; submit them with a form. */
|
|
3065
|
+
declare function FileInput({ accept, multiple, maxFiles, maxSize, minSize, validate, value, defaultValue, onValueChange, onReject, variant, title, hint, buttonLabel, showList, renderItem, name, form, required, disabled, id, className, style, 'aria-label': ariaLabel, 'aria-describedby': describedBy, }: FileInputProps): react.JSX.Element;
|
|
3066
|
+
|
|
3067
|
+
/** A crop in the image's own pixels, from its top-left corner. */
|
|
3068
|
+
interface CropRect {
|
|
3069
|
+
x: number;
|
|
3070
|
+
y: number;
|
|
3071
|
+
width: number;
|
|
3072
|
+
height: number;
|
|
3073
|
+
}
|
|
3074
|
+
type ImageCropperHandle = 'n' | 's' | 'e' | 'w' | 'ne' | 'nw' | 'se' | 'sw';
|
|
3075
|
+
type ImageCropperMode = 'box' | 'frame';
|
|
3076
|
+
type ImageCropperShape = 'rect' | 'circle';
|
|
3077
|
+
interface ImageCropperProps {
|
|
3078
|
+
src: string;
|
|
3079
|
+
/** Describes the image. */
|
|
3080
|
+
alt?: string;
|
|
3081
|
+
/** The crop, in image pixels. Controlled. */
|
|
3082
|
+
crop?: CropRect;
|
|
3083
|
+
defaultCrop?: CropRect;
|
|
3084
|
+
/** Runs while the crop changes (every drag step, key, wheel tick) and once the image loads. */
|
|
3085
|
+
onCropChange?(crop: CropRect): void;
|
|
3086
|
+
/** Runs once an interaction ends (pointer up, key press, wheel pause). For saving. */
|
|
3087
|
+
onCropCommit?(crop: CropRect): void;
|
|
3088
|
+
/** `box`: move and resize a selection over the image. `frame`: the selection stays put; pan and zoom the image under it. */
|
|
3089
|
+
mode?: ImageCropperMode;
|
|
3090
|
+
/** Lock width / height, e.g. 1 or 16 / 9. Required-ish for `frame` (default 1 there). */
|
|
3091
|
+
aspectRatio?: number;
|
|
3092
|
+
/** `circle` rounds the selection (the crop is still its box). */
|
|
3093
|
+
shape?: ImageCropperShape;
|
|
3094
|
+
minWidth?: number;
|
|
3095
|
+
minHeight?: number;
|
|
3096
|
+
/** Largest zoom, where 1 is the largest crop the image allows. Default 4. */
|
|
3097
|
+
maxZoom?: number;
|
|
3098
|
+
/** Show the rule-of-thirds grid. Default true. */
|
|
3099
|
+
grid?: boolean;
|
|
3100
|
+
/** Show the zoom slider under the viewport. Default true. */
|
|
3101
|
+
zoomControl?: boolean;
|
|
3102
|
+
/** Viewport height in px. Default 320. */
|
|
3103
|
+
height?: number;
|
|
3104
|
+
disabled?: boolean;
|
|
3105
|
+
/** Names the cropper group. Default "Image cropper". */
|
|
3106
|
+
'aria-label'?: string;
|
|
3107
|
+
className?: string;
|
|
3108
|
+
style?: CSSProperties;
|
|
3109
|
+
/** Extra controls rendered in the toolbar next to the zoom slider. */
|
|
3110
|
+
children?: ReactNode;
|
|
3111
|
+
}
|
|
3112
|
+
/** Move and resize a crop over an image (or pan/zoom the image under a fixed frame). Crop is in image pixels. */
|
|
3113
|
+
declare function ImageCropper({ src, alt, crop, defaultCrop, onCropChange, onCropCommit, mode, aspectRatio, shape, minWidth, minHeight, maxZoom, grid, zoomControl, height, disabled, className, style, children, 'aria-label': ariaLabel, }: ImageCropperProps): react.JSX.Element;
|
|
3114
|
+
interface CropImageOptions {
|
|
3115
|
+
/** Output MIME type. Default "image/png". */
|
|
3116
|
+
type?: string;
|
|
3117
|
+
/** 0–1 for lossy types. */
|
|
3118
|
+
quality?: number;
|
|
3119
|
+
/** Round the output to a circle (transparent corners; use PNG or WebP). */
|
|
3120
|
+
shape?: ImageCropperShape;
|
|
3121
|
+
/** Output width in px (height follows the crop ratio). Default: the crop's width. */
|
|
3122
|
+
width?: number;
|
|
3123
|
+
}
|
|
3124
|
+
/** Crop an image to `rect` (image pixels) with a canvas. Browser only. The image must be same-origin or CORS-enabled. */
|
|
3125
|
+
declare function cropImage(src: string, rect: CropRect, opts?: CropImageOptions): Promise<Blob>;
|
|
3126
|
+
|
|
3127
|
+
type TimelineStatus = 'complete' | 'current' | 'upcoming';
|
|
3128
|
+
type TimelineImportance = 'normal' | 'high';
|
|
3129
|
+
type TimelineOrientation = 'vertical' | 'horizontal';
|
|
3130
|
+
/** One event for the `items` shorthand. */
|
|
3131
|
+
interface TimelineEvent {
|
|
3132
|
+
value?: string;
|
|
3133
|
+
title: ReactNode;
|
|
3134
|
+
/** Friendly time text, e.g. "2:32 PM" or "Yesterday". */
|
|
3135
|
+
time?: ReactNode;
|
|
3136
|
+
/** Machine-readable time for `<time dateTime>`, e.g. "2026-11-10T14:32". */
|
|
3137
|
+
dateTime?: string;
|
|
3138
|
+
description?: ReactNode;
|
|
3139
|
+
status?: TimelineStatus;
|
|
3140
|
+
importance?: TimelineImportance;
|
|
3141
|
+
/** Icon or avatar inside the marker. */
|
|
3142
|
+
icon?: ReactNode;
|
|
3143
|
+
/** Extra content under the description (links, buttons, tags). */
|
|
3144
|
+
content?: ReactNode;
|
|
3145
|
+
}
|
|
3146
|
+
interface TimelineProps extends Omit<HTMLAttributes<HTMLDivElement>, 'children'> {
|
|
3147
|
+
/** `vertical` (feed, changelog) or `horizontal` (roadmap, order progress). Default `vertical`. */
|
|
3148
|
+
orientation?: TimelineOrientation;
|
|
3149
|
+
/** Arrow keys wrap from the last event to the first. Default true. */
|
|
3150
|
+
loop?: boolean;
|
|
3151
|
+
/** Shorthand: one event per entry. Ignored when `children` is given. */
|
|
3152
|
+
items?: TimelineEvent[];
|
|
3153
|
+
/** Size of the markers. Default `md`. */
|
|
3154
|
+
size?: 'sm' | 'md';
|
|
3155
|
+
/** Required: names the list, e.g. "Deploy activity". */
|
|
3156
|
+
'aria-label'?: string;
|
|
3157
|
+
children?: ReactNode;
|
|
3158
|
+
}
|
|
3159
|
+
/** Dated events in order, with status markers and one tab stop (arrow keys move between events). */
|
|
3160
|
+
declare function Timeline({ orientation, loop, items, size, className, children, onKeyDown, onFocus, style, ...rest }: TimelineProps): react.JSX.Element;
|
|
3161
|
+
interface TimelineItemProps extends HTMLAttributes<HTMLDivElement> {
|
|
3162
|
+
/** Names the event (generated when omitted). */
|
|
3163
|
+
value?: string;
|
|
3164
|
+
/** Where the event stands in a process. `current` sets aria-current="step" and takes the tab stop first. */
|
|
3165
|
+
status?: TimelineStatus;
|
|
3166
|
+
importance?: TimelineImportance;
|
|
3167
|
+
ref?: React.Ref<HTMLDivElement>;
|
|
3168
|
+
}
|
|
3169
|
+
/** One event. Focusable; named by its title and described by its time and description. */
|
|
3170
|
+
declare function TimelineItem({ value, status, importance, className, children, ref, ...rest }: TimelineItemProps): react.JSX.Element;
|
|
3171
|
+
/** The dot (or icon) on the line. Hidden from screen readers. Shows a check when complete. */
|
|
3172
|
+
declare function TimelineMarker({ className, children, ...rest }: HTMLAttributes<HTMLSpanElement>): react.JSX.Element;
|
|
3173
|
+
/** The line to the next event. Hidden from screen readers; hidden after the last event. */
|
|
3174
|
+
declare function TimelineConnector({ className, ...rest }: HTMLAttributes<HTMLSpanElement>): react.JSX.Element;
|
|
3175
|
+
/** Optional wrapper for the text column (title, time, description, extra content). */
|
|
3176
|
+
declare function TimelineContent({ className, ...rest }: HTMLAttributes<HTMLDivElement>): react.JSX.Element;
|
|
3177
|
+
declare function TimelineTitle({ className, ...rest }: HTMLAttributes<HTMLDivElement>): react.JSX.Element;
|
|
3178
|
+
/** Pass `dateTime` so the time is machine readable while the text stays friendly. */
|
|
3179
|
+
declare function TimelineTime({ className, ...rest }: TimeHTMLAttributes<HTMLTimeElement>): react.JSX.Element;
|
|
3180
|
+
declare function TimelineDescription({ className, ...rest }: HTMLAttributes<HTMLDivElement>): react.JSX.Element;
|
|
3181
|
+
|
|
3182
|
+
/** One span. Times are in milliseconds on one shared clock. */
|
|
3183
|
+
interface WaterfallSpan {
|
|
3184
|
+
value: string;
|
|
3185
|
+
label: string;
|
|
3186
|
+
start: number;
|
|
3187
|
+
duration: number;
|
|
3188
|
+
/** Groups spans by color: "db", "http", "llm"… Colors come from `--sw-chart-N`. */
|
|
3189
|
+
kind?: string;
|
|
3190
|
+
/** Extra lines in the hover detail, e.g. { Status: '200', Size: '12 KB' }. */
|
|
3191
|
+
detail?: Record<string, ReactNode>;
|
|
3192
|
+
/** Spans this one started. */
|
|
3193
|
+
children?: WaterfallSpan[];
|
|
3194
|
+
}
|
|
3195
|
+
interface WaterfallColumn {
|
|
3196
|
+
key: string;
|
|
3197
|
+
header: ReactNode;
|
|
3198
|
+
render(span: WaterfallSpan): ReactNode;
|
|
3199
|
+
/** CSS width, e.g. "64px". Default "auto". */
|
|
3200
|
+
width?: string;
|
|
3201
|
+
}
|
|
3202
|
+
interface WaterfallMark {
|
|
3203
|
+
time: number;
|
|
3204
|
+
label: string;
|
|
3205
|
+
}
|
|
3206
|
+
interface WaterfallRowInfo {
|
|
3207
|
+
span: WaterfallSpan;
|
|
3208
|
+
parent: string | null;
|
|
3209
|
+
level: number;
|
|
3210
|
+
posinset: number;
|
|
3211
|
+
setsize: number;
|
|
3212
|
+
}
|
|
3213
|
+
/** The rows that show for a set of spans and expanded values, in order. */
|
|
3214
|
+
declare function visibleWaterfallRows(items: WaterfallSpan[], expanded: readonly string[]): WaterfallRowInfo[];
|
|
3215
|
+
interface WaterfallProps extends Omit<HTMLAttributes<HTMLDivElement>, 'children' | 'defaultValue' | 'onChange'> {
|
|
3216
|
+
/** The spans, with nested `children`. */
|
|
3217
|
+
items: WaterfallSpan[];
|
|
3218
|
+
/** The time the axis shows as [start, end] in ms. Default: from the earliest start to the latest end. */
|
|
3219
|
+
range?: [number, number];
|
|
3220
|
+
/** Selected span. `null` = nothing. */
|
|
3221
|
+
value?: string | null;
|
|
3222
|
+
defaultValue?: string | null;
|
|
3223
|
+
onValueChange?(value: string | null): void;
|
|
3224
|
+
/** Expanded spans' values. */
|
|
3225
|
+
expanded?: string[];
|
|
3226
|
+
/** Default: every span with children is collapsed. Pass `'all'` to start fully expanded. */
|
|
3227
|
+
defaultExpanded?: string[] | 'all';
|
|
3228
|
+
onExpandedChange?(expanded: string[]): void;
|
|
3229
|
+
/** Kind → chart color index (1–8) or any CSS color. Unlisted kinds get the next chart color. */
|
|
3230
|
+
kinds?: Record<string, number | string>;
|
|
3231
|
+
/** Extra columns between the name and the bars (status, size…). */
|
|
3232
|
+
columns?: WaterfallColumn[];
|
|
3233
|
+
/** Vertical lines across the bars, e.g. { time: 820, label: 'DOMContentLoaded' }. */
|
|
3234
|
+
marks?: WaterfallMark[];
|
|
3235
|
+
/** The most axis ticks. Default 5. */
|
|
3236
|
+
maxTicks?: number;
|
|
3237
|
+
/** How times read on the axis and in details. Default "820 ms" / "1.24 s". */
|
|
3238
|
+
format?(ms: number): string;
|
|
3239
|
+
/** Header of the name column. Default "Span". */
|
|
3240
|
+
nameHeader?: ReactNode;
|
|
3241
|
+
/** Show a legend of kinds. Default: when there is more than one kind. */
|
|
3242
|
+
legend?: boolean;
|
|
3243
|
+
/** Own 1px squircle frame with a 4px inset; rows are concentric with it. Default true. */
|
|
3244
|
+
framed?: boolean;
|
|
3245
|
+
/** Required: names the grid, e.g. "Trace for run 42". */
|
|
3246
|
+
'aria-label'?: string;
|
|
3247
|
+
}
|
|
3248
|
+
/** Trace or request spans as bars on one time axis. Nested spans expand and collapse (treegrid). */
|
|
3249
|
+
declare function Waterfall({ items, range, value, defaultValue, onValueChange, expanded, defaultExpanded, onExpandedChange, kinds, columns, marks, maxTicks, format, nameHeader, legend, framed, className, style, 'aria-label': ariaLabel, 'aria-labelledby': ariaLabelledby, ...rest }: WaterfallProps): react.JSX.Element;
|
|
3250
|
+
|
|
3251
|
+
type ThemePreference = 'light' | 'dark' | 'system';
|
|
3252
|
+
type MotionPreference = 'system' | 'reduce' | 'full';
|
|
3253
|
+
type ContrastPreference = 'system' | 'more' | 'normal';
|
|
3254
|
+
type DensityPreference = 'compact' | 'comfortable' | 'spacious';
|
|
3255
|
+
type FontSizePreference = 'sm' | 'md' | 'lg';
|
|
3256
|
+
interface PreferenceValues {
|
|
3257
|
+
theme: ThemePreference;
|
|
3258
|
+
motion: MotionPreference;
|
|
3259
|
+
contrast: ContrastPreference;
|
|
3260
|
+
density: DensityPreference;
|
|
3261
|
+
fontSize: FontSizePreference;
|
|
3262
|
+
}
|
|
3263
|
+
type PreferenceKey = keyof PreferenceValues;
|
|
3264
|
+
declare const defaultPreferences: PreferenceValues;
|
|
3265
|
+
/** Read saved preferences from a `Cookie` header (server) or `document.cookie` (client). */
|
|
3266
|
+
declare function readPreferencesCookie(cookie: string | undefined | null, key?: string): Partial<PreferenceValues>;
|
|
3267
|
+
/**
|
|
3268
|
+
* The `data-*` attributes for `<html>`, for server rendering:
|
|
3269
|
+
* `<html {...getPreferenceAttributes(readPreferencesCookie(req.headers.cookie))}>`.
|
|
3270
|
+
* `theme: 'system'` writes no `data-theme`, like SwProvider. `motion`/`contrast` `system` write no attribute
|
|
3271
|
+
* on the server; the client then writes what the OS says.
|
|
3272
|
+
*/
|
|
3273
|
+
declare function getPreferenceAttributes(prefs: Partial<PreferenceValues>): Record<string, string>;
|
|
3274
|
+
interface Resolved {
|
|
3275
|
+
theme: 'light' | 'dark';
|
|
3276
|
+
motion: 'reduce' | 'full';
|
|
3277
|
+
contrast: 'more' | 'normal';
|
|
3278
|
+
}
|
|
3279
|
+
interface PreferencesContextValue {
|
|
3280
|
+
/** What the user chose (`system` included). */
|
|
3281
|
+
preferences: PreferenceValues;
|
|
3282
|
+
/** What `system` resolves to right now. */
|
|
3283
|
+
resolved: Resolved;
|
|
3284
|
+
setPreference<K extends PreferenceKey>(key: K, value: PreferenceValues[K]): void;
|
|
3285
|
+
setPreferences(next: Partial<PreferenceValues>): void;
|
|
3286
|
+
/** Back to the defaults (and clears storage). */
|
|
3287
|
+
reset(): void;
|
|
3288
|
+
}
|
|
3289
|
+
interface PreferencesProviderProps {
|
|
3290
|
+
children?: ReactNode;
|
|
3291
|
+
/** Controlled preferences. */
|
|
3292
|
+
value?: PreferenceValues;
|
|
3293
|
+
/** Starting values (merged over the SDK defaults). Pass what the server read from the cookie to avoid a flash. */
|
|
3294
|
+
defaultValue?: Partial<PreferenceValues>;
|
|
3295
|
+
onValueChange?(value: PreferenceValues): void;
|
|
3296
|
+
/** Where to save: `local` (localStorage), `cookie` (readable on the server), `both` or `none`. Default `both`. */
|
|
3297
|
+
storage?: 'local' | 'cookie' | 'both' | 'none';
|
|
3298
|
+
/** Storage key and cookie name. Default "sw-preferences". */
|
|
3299
|
+
storageKey?: string;
|
|
3300
|
+
/** Write `html[data-theme]`. Default true. Turn off when another system owns the theme. */
|
|
3301
|
+
manageTheme?: boolean;
|
|
3302
|
+
}
|
|
3303
|
+
/**
|
|
3304
|
+
* Applies user preferences (theme, motion, contrast, density, font size) as `data-*` attributes on `<html>`,
|
|
3305
|
+
* saves them, and drives motion/react's reduced-motion setting. Put it inside `<SwProvider>` (leave SwProvider's
|
|
3306
|
+
* `theme` at its default) — the preference then owns `data-theme`.
|
|
3307
|
+
*/
|
|
3308
|
+
declare function PreferencesProvider({ children, value, defaultValue, onValueChange, storage, storageKey, manageTheme, }: PreferencesProviderProps): react.JSX.Element;
|
|
3309
|
+
/** Read and change preferences. Must be inside `<PreferencesProvider>`. */
|
|
3310
|
+
declare function usePreferences(): PreferencesContextValue;
|
|
3311
|
+
/**
|
|
3312
|
+
* Inline script for the document `<head>` that applies saved preferences before first paint
|
|
3313
|
+
* (no theme flash). Reads localStorage, then the cookie. Pass `nonce` for a strict CSP.
|
|
3314
|
+
*/
|
|
3315
|
+
declare function PreferencesScript({ storageKey, nonce }: {
|
|
3316
|
+
storageKey?: string;
|
|
3317
|
+
nonce?: string;
|
|
3318
|
+
}): react.JSX.Element;
|
|
3319
|
+
interface PreferencesPanelProps {
|
|
3320
|
+
/** Which rows to show, in order. Default: all five. */
|
|
3321
|
+
show?: PreferenceKey[];
|
|
3322
|
+
/** Show a "Reset" button. Default true. */
|
|
3323
|
+
resettable?: boolean;
|
|
3324
|
+
className?: string;
|
|
3325
|
+
style?: CSSProperties;
|
|
3326
|
+
'aria-label'?: string;
|
|
3327
|
+
}
|
|
3328
|
+
/** A settings panel for every preference, built from SegmentedControl and Switch. */
|
|
3329
|
+
declare function PreferencesPanel({ show, resettable, className, style, 'aria-label': ariaLabel }: PreferencesPanelProps): react.JSX.Element;
|
|
3330
|
+
|
|
3331
|
+
type SidebarCollapse = 'rail' | 'offcanvas' | 'none';
|
|
3332
|
+
type Side = 'sidebar' | 'inspector';
|
|
3333
|
+
interface RegionState {
|
|
3334
|
+
/** Open (expanded) on wide layouts. */
|
|
3335
|
+
open: boolean;
|
|
3336
|
+
setOpen(open: boolean | ((o: boolean) => boolean)): void;
|
|
3337
|
+
/** Open as a sheet on narrow layouts. */
|
|
3338
|
+
sheetOpen: boolean;
|
|
3339
|
+
setSheetOpen(open: boolean): void;
|
|
3340
|
+
width: number;
|
|
3341
|
+
setWidth(w: number): void;
|
|
3342
|
+
present: boolean;
|
|
3343
|
+
setPresent(p: boolean): void;
|
|
3344
|
+
}
|
|
3345
|
+
interface ShellCtx {
|
|
3346
|
+
narrow: boolean;
|
|
3347
|
+
sidebar: RegionState;
|
|
3348
|
+
inspector: RegionState;
|
|
3349
|
+
toggle(side: Side): void;
|
|
3350
|
+
shortcuts: Record<Side, string | null>;
|
|
3351
|
+
}
|
|
3352
|
+
/** Read and drive the shell: `const { narrow, sidebar, toggle } = useAppShell()`. */
|
|
3353
|
+
declare function useAppShell(): ShellCtx;
|
|
3354
|
+
interface RegionCtx {
|
|
3355
|
+
side: Side;
|
|
3356
|
+
collapsed: boolean;
|
|
3357
|
+
narrow: boolean;
|
|
3358
|
+
close(): void;
|
|
3359
|
+
}
|
|
3360
|
+
/** Inside a sidebar or inspector: whether it is folded to a rail, and how to close its sheet. */
|
|
3361
|
+
declare const useShellRegion: () => RegionCtx | null;
|
|
3362
|
+
interface AppShellProps extends HTMLAttributes<HTMLDivElement> {
|
|
3363
|
+
/** 'header-first': the header spans the full width (Vercel). 'sidebar-first': the sidebar runs full height beside the header (Linear). Default 'header-first'. */
|
|
3364
|
+
layout?: 'header-first' | 'sidebar-first';
|
|
3365
|
+
/** Sidebar expanded (wide layouts). Controlled. */
|
|
3366
|
+
sidebarOpen?: boolean;
|
|
3367
|
+
defaultSidebarOpen?: boolean;
|
|
3368
|
+
onSidebarOpenChange?(open: boolean): void;
|
|
3369
|
+
/** Inspector open (wide layouts). Controlled. */
|
|
3370
|
+
inspectorOpen?: boolean;
|
|
3371
|
+
defaultInspectorOpen?: boolean;
|
|
3372
|
+
onInspectorOpenChange?(open: boolean): void;
|
|
3373
|
+
/** Below this container width (px) the sidebar and inspector become sheets over the content. Default 768. */
|
|
3374
|
+
collapseBelow?: number;
|
|
3375
|
+
/** Toggle shortcut for the sidebar. Default 'mod+b'. null turns it off. */
|
|
3376
|
+
sidebarShortcut?: string | null;
|
|
3377
|
+
/** Toggle shortcut for the inspector. Default 'mod+alt+b'. null turns it off. */
|
|
3378
|
+
inspectorShortcut?: string | null;
|
|
3379
|
+
/** Save open state and widths in localStorage under this key. */
|
|
3380
|
+
autoSaveId?: string;
|
|
3381
|
+
/** Height of the shell. Default '100dvh'. Use '100%' inside a sized container. */
|
|
3382
|
+
height?: CSSProperties['height'];
|
|
3383
|
+
children?: ReactNode;
|
|
3384
|
+
}
|
|
3385
|
+
/** The frame of a dashboard: header, collapsible sidebar, main, inspector, split by hairlines. */
|
|
3386
|
+
declare function AppShell({ layout, sidebarOpen, defaultSidebarOpen, onSidebarOpenChange, inspectorOpen, defaultInspectorOpen, onInspectorOpenChange, collapseBelow, sidebarShortcut, inspectorShortcut, autoSaveId, height, className, style, children, ...rest }: AppShellProps): react.JSX.Element;
|
|
3387
|
+
interface AppShellHeaderProps extends HTMLAttributes<HTMLElement> {
|
|
3388
|
+
/** Leading content: linked logo, dashboard title, and optional sidebar toggle or breadcrumbs. */
|
|
3389
|
+
start?: ReactNode;
|
|
3390
|
+
/** Centered content: a search or command trigger. Keep it to one control. */
|
|
3391
|
+
center?: ReactNode;
|
|
3392
|
+
/** Trailing content: dashboard controls, site links, the account menu, and the inspector toggle. */
|
|
3393
|
+
end?: ReactNode;
|
|
3394
|
+
}
|
|
3395
|
+
/** Top bar of the shell, one header height (44px) shared by every region. Use start / center / end slots, or children. */
|
|
3396
|
+
declare function AppShellHeader({ start, center, end, className, children, ...rest }: AppShellHeaderProps): react.JSX.Element;
|
|
3397
|
+
interface SideRegionProps extends Omit<HTMLAttributes<HTMLElement>, 'title'> {
|
|
3398
|
+
/** Accessible name of the region, e.g. "Main navigation" or "Details". */
|
|
3399
|
+
label: string;
|
|
3400
|
+
/** Default width in px. Sidebar 248, inspector 320. */
|
|
3401
|
+
defaultWidth?: number;
|
|
3402
|
+
minWidth?: number;
|
|
3403
|
+
maxWidth?: number;
|
|
3404
|
+
/** Let people resize it from its inner edge. Default true. */
|
|
3405
|
+
resizable?: boolean;
|
|
3406
|
+
/** Pinned to the top, same height as the shell header. */
|
|
3407
|
+
header?: ReactNode;
|
|
3408
|
+
/** Pinned to the bottom with a hairline above (account, usage, settings). */
|
|
3409
|
+
footer?: ReactNode;
|
|
3410
|
+
children?: ReactNode;
|
|
3411
|
+
}
|
|
3412
|
+
interface AppShellSidebarProps extends SideRegionProps {
|
|
3413
|
+
/** How it folds: to a 48px icon rail, off-canvas, or never. Default 'rail'. */
|
|
3414
|
+
collapsible?: SidebarCollapse;
|
|
3415
|
+
}
|
|
3416
|
+
interface AppShellInspectorProps extends SideRegionProps {
|
|
3417
|
+
}
|
|
3418
|
+
/** Leading navigation region. Folds to a 48px icon rail (or off-canvas) with ⌘B; resizes from its edge. */
|
|
3419
|
+
declare function AppShellSidebar({ collapsible, ...props }: AppShellSidebarProps): react.JSX.Element;
|
|
3420
|
+
/** Trailing details region (selection details, filters, activity). Folds away with ⌘⌥B; resizes from its edge. */
|
|
3421
|
+
declare function AppShellInspector(props: AppShellInspectorProps): react.JSX.Element;
|
|
3422
|
+
interface AppShellMainProps extends HTMLAttributes<HTMLElement> {
|
|
3423
|
+
/** Optional pinned toolbar for a particular view. Same height as the shell header. */
|
|
3424
|
+
header?: ReactNode;
|
|
3425
|
+
/** Inner padding of the scrolling content. Default 'md' (16px). Use 'none' for a dashboard: a flush DashboardGrid then meets the shell's lines. */
|
|
3426
|
+
padding?: 'none' | 'sm' | 'md' | 'lg';
|
|
3427
|
+
}
|
|
3428
|
+
/** The main content region. It scrolls on its own; the header and side regions stay put. */
|
|
3429
|
+
declare function AppShellMain({ header, padding, className, children, ...rest }: AppShellMainProps): react.JSX.Element;
|
|
3430
|
+
interface ShellToggleProps extends Omit<HTMLAttributes<HTMLButtonElement>, 'children'> {
|
|
3431
|
+
/** Which region it toggles. Default 'sidebar'. */
|
|
3432
|
+
side?: Side;
|
|
3433
|
+
/** Accessible name. Default "Toggle sidebar" / "Toggle inspector". */
|
|
3434
|
+
label?: string;
|
|
3435
|
+
}
|
|
3436
|
+
/** 28px ghost icon Button that folds the sidebar or inspector, with its shortcut in a tooltip. */
|
|
3437
|
+
declare function ShellToggle({ side, label, className, onClick, ...rest }: ShellToggleProps): react.JSX.Element;
|
|
3438
|
+
|
|
3439
|
+
interface SidebarNavProps extends HTMLAttributes<HTMLElement> {
|
|
3440
|
+
/** Accessible name, e.g. "Workspace". Default "Sidebar". */
|
|
3441
|
+
'aria-label'?: string;
|
|
3442
|
+
}
|
|
3443
|
+
/** Navigation list for an AppShell sidebar. Holds SidebarItem and SidebarGroup. */
|
|
3444
|
+
declare function SidebarNav({ className, children, ...rest }: SidebarNavProps): react.JSX.Element;
|
|
3445
|
+
interface SidebarItemProps extends Omit<AnchorHTMLAttributes<HTMLAnchorElement>, 'children'> {
|
|
3446
|
+
/** Row text. Also the tooltip in the rail. */
|
|
3447
|
+
label: string;
|
|
3448
|
+
/** 15px icon. Required for rows that should stay visible in the rail. */
|
|
3449
|
+
icon?: ReactNode;
|
|
3450
|
+
/** Current page: neutral fill, aria-current="page". */
|
|
3451
|
+
active?: boolean;
|
|
3452
|
+
/** Trailing count or short status (tabular, muted). Hidden while hover actions show. */
|
|
3453
|
+
count?: ReactNode;
|
|
3454
|
+
/** Icon buttons revealed on hover/focus (always shown on touch): `Button size="2xs" variant="ghost" iconOnly` in a Tooltip. */
|
|
3455
|
+
actions?: ReactNode;
|
|
3456
|
+
/** Nesting depth (0–2). Indents to align with the parent label. */
|
|
3457
|
+
level?: 0 | 1 | 2;
|
|
3458
|
+
disabled?: boolean;
|
|
3459
|
+
/** Rendered as a link with `href`, otherwise a button. */
|
|
3460
|
+
href?: string;
|
|
3461
|
+
onClick?(e: MouseEvent<HTMLElement>): void;
|
|
3462
|
+
}
|
|
3463
|
+
/** One 28px navigation row: icon, label, count, hover actions. */
|
|
3464
|
+
declare function SidebarItem({ label, icon, active, count, actions, level, disabled, href, onClick, className, ...rest }: SidebarItemProps): react.JSX.Element | null;
|
|
3465
|
+
interface SidebarGroupProps extends Omit<HTMLAttributes<HTMLDivElement>, 'title'> {
|
|
3466
|
+
/** Group label (11px). */
|
|
3467
|
+
label: string;
|
|
3468
|
+
/** Shown while folded, e.g. the number of items. */
|
|
3469
|
+
count?: ReactNode;
|
|
3470
|
+
/** Hover actions on the group row (e.g. "New project"), as `Button size="2xs"` ghost icons. */
|
|
3471
|
+
actions?: ReactNode;
|
|
3472
|
+
/** Let the group fold. Default true. */
|
|
3473
|
+
collapsible?: boolean;
|
|
3474
|
+
open?: boolean;
|
|
3475
|
+
defaultOpen?: boolean;
|
|
3476
|
+
onOpenChange?(open: boolean): void;
|
|
3477
|
+
children?: ReactNode;
|
|
3478
|
+
}
|
|
3479
|
+
/** A labelled, foldable group of SidebarItems. Folded groups show their count. */
|
|
3480
|
+
declare function SidebarGroup({ label, count, actions, collapsible, open: openProp, defaultOpen, onOpenChange, className, children, ...rest }: SidebarGroupProps): react.JSX.Element;
|
|
3481
|
+
|
|
3482
|
+
/**
|
|
3483
|
+
* Pack spans into rows of `cols`. When the next tile doesn't fit, the previous tile stretches to the
|
|
3484
|
+
* end of its row; the last row stretches too. No row ever ends in an empty hole.
|
|
3485
|
+
*/
|
|
3486
|
+
declare function packRows(spans: readonly number[], cols: number): number[];
|
|
3487
|
+
type GridVariant = 'flush' | 'joined' | 'gapped';
|
|
3488
|
+
interface DashboardGridProps extends Omit<HTMLAttributes<HTMLDivElement>, 'onChange'> {
|
|
3489
|
+
/** Columns on wide containers. Default 12. */
|
|
3490
|
+
columns?: number;
|
|
3491
|
+
/**
|
|
3492
|
+
* 'flush': tiles share 1px lines out to the container's edges, no frame of their own. The default inside
|
|
3493
|
+
* AppShellMain, whose region the shell already frames.
|
|
3494
|
+
* 'joined': shared lines inside one rounded frame (the default elsewhere).
|
|
3495
|
+
* 'gapped': separate framed cards 12px apart, for independent items (projects, people), not metrics.
|
|
3496
|
+
*/
|
|
3497
|
+
variant?: GridVariant;
|
|
3498
|
+
/** Smallest tile width in px. Narrower tiles grow to half, then full width; rows never end in a hole. Default 280. */
|
|
3499
|
+
minTileWidth?: number;
|
|
3500
|
+
/** Fixed row height in px for tiles with `rowSpan`. Default: rows follow content. */
|
|
3501
|
+
rowHeight?: number;
|
|
3502
|
+
/** Tile ids in display order. Controlled; tiles missing from it go last. */
|
|
3503
|
+
order?: string[];
|
|
3504
|
+
defaultOrder?: string[];
|
|
3505
|
+
/** Called after a tile is moved. Providing it turns reordering on. */
|
|
3506
|
+
onOrderChange?(order: string[]): void;
|
|
3507
|
+
radius?: RadiusValue;
|
|
3508
|
+
/** DashboardTile children, each with an `id`. */
|
|
3509
|
+
children?: ReactNode;
|
|
3510
|
+
}
|
|
3511
|
+
/** A 12-column dashboard grid with shared-hairline (joined) or gapped tiles, reorderable by their grips. */
|
|
3512
|
+
declare function DashboardGrid({ columns, variant: variantProp, minTileWidth, rowHeight, order, defaultOrder, onOrderChange, radius, className, style, children, ...rest }: DashboardGridProps): react.JSX.Element;
|
|
3513
|
+
interface DashboardTileProps extends Omit<CardProps, 'collapsible' | 'open' | 'defaultOpen' | 'onOpenChange' | 'framed' | 'leading' | 'id'> {
|
|
3514
|
+
/** Stable id: used for order and reordering. */
|
|
3515
|
+
id?: string;
|
|
3516
|
+
/** Columns spanned on wide containers (of 12). Default 4. The last tile of a row stretches to fill it. */
|
|
3517
|
+
span?: number;
|
|
3518
|
+
/** Rows spanned when the grid has a `rowHeight`. Default 1. */
|
|
3519
|
+
rowSpan?: number;
|
|
3520
|
+
}
|
|
3521
|
+
/**
|
|
3522
|
+
* One cell of a DashboardGrid holding a Card (panel layout). When the grid is reorderable the tile drags
|
|
3523
|
+
* from its header bar (mouse and pen), and a grip Button in the header actions moves it by keyboard
|
|
3524
|
+
* (Space, arrows, Space) and by touch.
|
|
3525
|
+
*/
|
|
3526
|
+
declare function DashboardTile({ id, span, rowSpan, className, style, title, actions, onPointerDown, ...card }: DashboardTileProps): react.JSX.Element;
|
|
3527
|
+
interface DashboardSectionProps extends Omit<HTMLAttributes<HTMLElement>, 'title'> {
|
|
3528
|
+
title: ReactNode;
|
|
3529
|
+
/** Short summary after the title, e.g. "4 panels" or "2 alerts". */
|
|
3530
|
+
count?: ReactNode;
|
|
3531
|
+
/** Trailing actions on the heading row. */
|
|
3532
|
+
actions?: ReactNode;
|
|
3533
|
+
open?: boolean;
|
|
3534
|
+
defaultOpen?: boolean;
|
|
3535
|
+
onOpenChange?(open: boolean): void;
|
|
3536
|
+
/** Keep folded content mounted. Default false: folded sections unmount, so their charts stop loading. */
|
|
3537
|
+
keepMounted?: boolean;
|
|
3538
|
+
headingLevel?: 2 | 3 | 4;
|
|
3539
|
+
children?: ReactNode;
|
|
3540
|
+
}
|
|
3541
|
+
/**
|
|
3542
|
+
* A foldable dashboard row: chevron, title, count over a grid. Folded rows unmount their content.
|
|
3543
|
+
* Inside AppShellMain it is a 40px band in the shell's line system; elsewhere a heading with a rule.
|
|
3544
|
+
*/
|
|
3545
|
+
declare function DashboardSection({ title, count, actions, open: openProp, defaultOpen, onOpenChange, keepMounted, headingLevel, className, children, ...rest }: DashboardSectionProps): react.JSX.Element;
|
|
3546
|
+
|
|
3547
|
+
interface BreadcrumbItem {
|
|
3548
|
+
label: ReactNode;
|
|
3549
|
+
href?: string;
|
|
3550
|
+
onClick?(e: MouseEvent<HTMLAnchorElement>): void;
|
|
3551
|
+
/** Leading 15px icon (workspace avatar, project icon). */
|
|
3552
|
+
icon?: ReactNode;
|
|
3553
|
+
}
|
|
3554
|
+
interface BreadcrumbsProps extends HTMLAttributes<HTMLElement> {
|
|
3555
|
+
/** From the root to the current page. The last item is the current page. */
|
|
3556
|
+
items: BreadcrumbItem[];
|
|
3557
|
+
}
|
|
3558
|
+
/** Where you are in the hierarchy, for the AppShell header: "Acme / API / Incidents". Middle items shrink first. */
|
|
3559
|
+
declare function Breadcrumbs({ items, className, ...rest }: BreadcrumbsProps): react.JSX.Element;
|
|
3560
|
+
|
|
3561
|
+
type SortDirection = 'asc' | 'desc';
|
|
3562
|
+
interface SortState {
|
|
3563
|
+
key: string;
|
|
3564
|
+
direction: SortDirection;
|
|
3565
|
+
}
|
|
3566
|
+
interface ListQueryOptions<T> {
|
|
3567
|
+
items: readonly T[];
|
|
3568
|
+
/** Text fields searched by the query (case- and accent-insensitive, every word must match). */
|
|
3569
|
+
searchKeys?: Array<(item: T) => string | null | undefined>;
|
|
3570
|
+
/** Sort keys: `{ name: (a) => a.name, updated: (a) => a.updatedAt }`. Strings compare with `localeCompare`, numbers and dates numerically. */
|
|
3571
|
+
sorters?: Record<string, (item: T) => string | number | Date | null | undefined>;
|
|
3572
|
+
/** Starting sort. Use `{ key: 'manual' … }` (any key not in `sorters`) for the items' own order. */
|
|
3573
|
+
defaultSort?: SortState;
|
|
3574
|
+
defaultQuery?: string;
|
|
3575
|
+
/** Extra predicate (filters chosen in a menu). */
|
|
3576
|
+
filter?(item: T): boolean;
|
|
3577
|
+
}
|
|
3578
|
+
/**
|
|
3579
|
+
* Search + sort + filter state for a list. Returns the visible items and the state to wire
|
|
3580
|
+
* into a search Input / ToolbarInput and a sort Menu. `reorderable` is false while a search or a non-manual sort
|
|
3581
|
+
* is active — dropping into a partial or sorted list would be ambiguous.
|
|
3582
|
+
*/
|
|
3583
|
+
declare function useListQuery<T>({ items, searchKeys, sorters, defaultSort, defaultQuery, filter }: ListQueryOptions<T>): {
|
|
3584
|
+
query: string;
|
|
3585
|
+
setQuery: react.Dispatch<react.SetStateAction<string>>;
|
|
3586
|
+
sort: SortState;
|
|
3587
|
+
setSort: react.Dispatch<react.SetStateAction<SortState>>;
|
|
3588
|
+
results: T[];
|
|
3589
|
+
/** Number of items hidden by the query or filter. */
|
|
3590
|
+
hidden: number;
|
|
3591
|
+
/** True when the list shows every item in its own order, so it can be reordered. */
|
|
3592
|
+
reorderable: boolean;
|
|
3593
|
+
/** Props for a controlled search `<Input value onValueChange>`. */
|
|
3594
|
+
searchProps: {
|
|
3595
|
+
value: string;
|
|
3596
|
+
onValueChange: react.Dispatch<react.SetStateAction<string>>;
|
|
3597
|
+
};
|
|
3598
|
+
/** Value and setter for a sort Menu. */
|
|
3599
|
+
sortProps: {
|
|
3600
|
+
value: SortState;
|
|
3601
|
+
onValueChange: react.Dispatch<react.SetStateAction<SortState>>;
|
|
3602
|
+
};
|
|
3603
|
+
};
|
|
3604
|
+
|
|
3605
|
+
/** Return a copy of `list` with the item at `from` moved to `to`. */
|
|
3606
|
+
declare function moveItem<T>(list: readonly T[], from: number, to: number): T[];
|
|
3607
|
+
/**
|
|
3608
|
+
* Sort `items` by a saved id order. Ids no longer present are dropped; items missing from
|
|
3609
|
+
* the order keep their relative position at the end. Use it to restore a saved custom order.
|
|
3610
|
+
*/
|
|
3611
|
+
declare function applyOrder<T>(items: readonly T[], order: readonly string[], getId: (item: T) => string): T[];
|
|
3612
|
+
type ReorderOrientation = 'vertical' | 'horizontal' | 'grid';
|
|
3613
|
+
interface ReorderDetail {
|
|
3614
|
+
id: string;
|
|
3615
|
+
from: number;
|
|
3616
|
+
to: number;
|
|
3617
|
+
}
|
|
3618
|
+
interface ReorderOptions {
|
|
3619
|
+
/** Item ids in their current order. */
|
|
3620
|
+
ids: readonly string[];
|
|
3621
|
+
/** Called with the new order after a drop or keyboard move. */
|
|
3622
|
+
onReorder(ids: string[], detail: ReorderDetail): void;
|
|
3623
|
+
/** Layout of the items: stacked rows, a row, or wrapping tiles. Default 'vertical'. */
|
|
3624
|
+
orientation?: ReorderOrientation;
|
|
3625
|
+
/** Name of an item for announcements and the drag preview. Default: the id. */
|
|
3626
|
+
getLabel?(id: string): string;
|
|
3627
|
+
disabled?: boolean;
|
|
3628
|
+
}
|
|
3629
|
+
declare function useReorder({ ids, onReorder, orientation, getLabel, disabled }: ReorderOptions): {
|
|
3630
|
+
dragId: string | null;
|
|
3631
|
+
liftedId: string | null;
|
|
3632
|
+
flashId: string | null;
|
|
3633
|
+
isDragging: boolean;
|
|
3634
|
+
getContainerProps: () => {
|
|
3635
|
+
ref: (el: HTMLElement | null) => void;
|
|
3636
|
+
'data-reorder-root': string;
|
|
3637
|
+
};
|
|
3638
|
+
getItemProps: (id: string, { dragFromItem }?: {
|
|
3639
|
+
dragFromItem?: boolean;
|
|
3640
|
+
}) => {
|
|
3641
|
+
'data-reorder-id': string;
|
|
3642
|
+
'data-dragging': string | undefined;
|
|
3643
|
+
'data-lifted': string | undefined;
|
|
3644
|
+
'data-flash': string | undefined;
|
|
3645
|
+
onPointerDown: ((e: PointerEvent<HTMLElement>) => void) | undefined;
|
|
3646
|
+
};
|
|
3647
|
+
getHandleProps: (id: string) => {
|
|
3648
|
+
'aria-roledescription': string;
|
|
3649
|
+
'aria-describedby': string;
|
|
3650
|
+
'aria-pressed': boolean;
|
|
3651
|
+
'aria-label': string;
|
|
3652
|
+
'data-sw': string;
|
|
3653
|
+
disabled: boolean;
|
|
3654
|
+
onPointerDown: (e: PointerEvent<HTMLElement>) => void;
|
|
3655
|
+
onKeyDown: (e: KeyboardEvent$1<HTMLElement>) => void;
|
|
3656
|
+
onBlur: () => void;
|
|
3657
|
+
};
|
|
3658
|
+
startDrag: (id: string, e: PointerEvent<HTMLElement>, fromHandle?: boolean) => void;
|
|
3659
|
+
moveBy: (id: string, delta: number) => boolean;
|
|
3660
|
+
moveTo: (id: string, to: number) => boolean;
|
|
3661
|
+
handleKeyDown: (id: string, e: KeyboardEvent$1<HTMLElement>) => void;
|
|
3662
|
+
dropIndicator: react.ReactElement<unknown, string | react.JSXElementConstructor<any>> | null;
|
|
3663
|
+
overlay: react.ReactElement<unknown, string | react.JSXElementConstructor<any>>;
|
|
3664
|
+
};
|
|
3665
|
+
type ReorderApi = ReturnType<typeof useReorder>;
|
|
3666
|
+
|
|
3667
|
+
/** Width of an element, kept current with a ResizeObserver. 0 until measured. */
|
|
3668
|
+
declare function useElementWidth(ref: RefObject<HTMLElement | null>): number;
|
|
3669
|
+
|
|
3670
|
+
/** What `plan` may return: the steps, or the steps plus a reply that replaces the summary. */
|
|
3671
|
+
type AgentConsolePlan = AgentStep[] | {
|
|
3672
|
+
steps: AgentStep[];
|
|
3673
|
+
reply?: string;
|
|
3674
|
+
};
|
|
3675
|
+
/** One line in the console log. */
|
|
3676
|
+
type AgentConsoleEntry = {
|
|
3677
|
+
id: number;
|
|
3678
|
+
kind: 'user';
|
|
3679
|
+
text: string;
|
|
3680
|
+
} | {
|
|
3681
|
+
id: number;
|
|
3682
|
+
kind: 'planning';
|
|
3683
|
+
} | {
|
|
3684
|
+
id: number;
|
|
3685
|
+
kind: 'step';
|
|
3686
|
+
call: string;
|
|
3687
|
+
status: 'running' | 'done' | 'error';
|
|
3688
|
+
key?: 'value' | 'checked';
|
|
3689
|
+
after?: unknown;
|
|
3690
|
+
error?: string;
|
|
3691
|
+
} | {
|
|
3692
|
+
id: number;
|
|
3693
|
+
kind: 'reply';
|
|
3694
|
+
text: string;
|
|
3695
|
+
tone?: 'error';
|
|
3696
|
+
};
|
|
3697
|
+
type AgentConsoleStatus = 'idle' | 'running' | 'done';
|
|
3698
|
+
interface AgentConsoleProps extends Omit<HTMLAttributes<HTMLDivElement>, 'children' | 'onReset' | 'title'> {
|
|
3699
|
+
/** The bridge to drive, from `createAgent()`. Omit it and pass `root` to have one created for you. */
|
|
3700
|
+
agent?: Agent;
|
|
3701
|
+
/** The part of the page the agent works on. Creates the agent when `agent` is omitted, and scopes the field marks. */
|
|
3702
|
+
root?: (() => HTMLElement | null) | RefObject<HTMLElement | null>;
|
|
3703
|
+
/** Turn a request into bridge steps. A real app calls a model here; return `{ steps: [], reply }` to answer without acting. */
|
|
3704
|
+
plan(message: string): AgentConsolePlan | Promise<AgentConsolePlan>;
|
|
3705
|
+
/** The closing sentence after a run. Default: a short list of what changed. */
|
|
3706
|
+
summarize?(result: ActResult, message: string): string;
|
|
3707
|
+
/** Composer text. Controlled with `onMessageChange`. */
|
|
3708
|
+
message?: string;
|
|
3709
|
+
/** Initial composer text, restored by Reset. */
|
|
3710
|
+
defaultMessage?: string;
|
|
3711
|
+
onMessageChange?(message: string): void;
|
|
3712
|
+
placeholder?: string;
|
|
3713
|
+
/** Milliseconds between steps. Default 700; 0 when the person prefers reduced motion. */
|
|
3714
|
+
stepDelay?: number;
|
|
3715
|
+
/** Runs after every run with the combined result of its steps. */
|
|
3716
|
+
onRunComplete?(result: ActResult, message: string): void;
|
|
3717
|
+
/** Reset was pressed: put the app back to its defaults. The console clears its log and marks itself. */
|
|
3718
|
+
onReset?(): void;
|
|
3719
|
+
/** Header label. Default "Agent". */
|
|
3720
|
+
title?: ReactNode;
|
|
3721
|
+
/** `framed` draws its own squircle frame; `plain` fills a pane of a larger frame. Default `framed`. */
|
|
3722
|
+
variant?: 'framed' | 'plain';
|
|
3723
|
+
/** Frame radius for `framed`. Default `lg`. */
|
|
3724
|
+
radius?: RadiusValue;
|
|
3725
|
+
sendLabel?: string;
|
|
3726
|
+
resetLabel?: string;
|
|
3727
|
+
}
|
|
3728
|
+
/** `agent.act({ steps: [{ ref: "Region", action: "setValue", args: ["Asia Pacific"] }] })` */
|
|
3729
|
+
declare function formatAgentStep(step: AgentStep): string;
|
|
3730
|
+
/**
|
|
3731
|
+
* A chat-style panel that turns a request into agent-bridge steps and runs them one at a time,
|
|
3732
|
+
* marking each field it touches and logging the exact `agent.act()` call and its result.
|
|
3733
|
+
*/
|
|
3734
|
+
declare function AgentConsole({ agent: agentProp, root, plan, summarize, message: messageProp, defaultMessage, onMessageChange, placeholder, stepDelay, onRunComplete, onReset, title, variant, radius, sendLabel, resetLabel, className, ...rest }: AgentConsoleProps): react.JSX.Element;
|
|
3735
|
+
|
|
3736
|
+
export { Accordion, AccordionItem, AccordionPanel, AccordionTrigger, AgentConsole, AlertDialog, AlertDialogAction, AlertDialogCancel, AlertDialogContent, AlertDialogDescription, AlertDialogFooter, AlertDialogHeader, AlertDialogTitle, AlertDialogTrigger, AppShell, AppShellHeader, AppShellInspector, AppShellMain, AppShellSidebar, ArrowIcon, Autocomplete, AutocompleteGroup, AutocompleteGroupLabel, AutocompleteItem, Avatar, AvatarFallback, AvatarGroup, AvatarImage, Badge, Breadcrumbs, Button, Calendar, CalendarGrid, CalendarHeader, CalendarHeading, CalendarNext, CalendarPrevious, Caption, CardProps, Carousel, CarouselControls, CarouselIndicators, CarouselItem, CarouselNext, CarouselPlayToggle, CarouselPrevious, CarouselViewport, Checkbox, CheckboxGroup, CitationChip, Collapsible, CollapsiblePanel, CollapsibleTrigger, ColorPicker, ColorPickerPopover, Combobox, ComboboxGroup, ComboboxGroupLabel, ComboboxItem, ComboboxSeparator, Command, CommandDialog, CommandEmpty, CommandGroup, CommandGroupLabel, CommandInput, CommandItem, CommandList, CommandPage, CommandSeparator, CommandShortcut, ConfirmHost, ContextMenu, ContextMenuTrigger, DashboardGrid, DashboardSection, DashboardTile, DateInput, DatePicker, Dialog, DialogBody, DialogClose, DialogContent, DialogDescription, DialogFooter, DialogHeader, DialogTitle, DialogTrigger, Display, Drawer, DrawerBody, DrawerClose, DrawerContent, DrawerDescription, DrawerFooter, DrawerHeader, DrawerTitle, DrawerTrigger, EmptyState, Field, FieldContext, FieldDescription, FieldError, FieldLabel, FileInput, Heading, HoverCard, HoverCardContent, HoverCardTrigger, IconName, ImageCropper, Input, Kbd, Label, Link, Listbox, ListboxGroup, ListboxGroupLabel, ListboxItem, ListboxSeparator, Menu, MenuCheckboxItem, MenuContent, MenuContextTrigger, MenuGroup, MenuItem, MenuLabel, MenuRadioGroup, MenuRadioItem, MenuSeparator, MenuSub, MenuSubContent, MenuSubTrigger, MenuTrigger, Menubar, Meter, NavigationMenu, NavigationMenuContent, NavigationMenuItem, NavigationMenuLink, NavigationMenuList, NavigationMenuTrigger, NumberInput, OTPInput, Outline, OverlayHost, Pagination, PasswordInput, Popover, PopoverClose, PopoverContent, PopoverDescription, PopoverTitle, PopoverTrigger, PopupPanel, Portal, PortalContainerProvider, PreferencesPanel, PreferencesProvider, PreferencesScript, Progress, Radio, RadioGroup, RadiusValue, Rating, Resizable, ResizableHandle, ResizablePanel, ScrollArea, SegmentedControl, Select, SelectContent, SelectGroup, SelectGroupLabel, SelectItem, SelectSeparator, SelectTrigger, SelectValue, Separator, ShellToggle, SidebarGroup, SidebarItem, SidebarNav, Skeleton, Slider, SmoothingValue, Stat, SwProvider, Switch, Tab, Table, Tabs, TabsList, TabsPanel, Text, Textarea, TimeInput, Timeline, TimelineConnector, TimelineContent, TimelineDescription, TimelineItem, TimelineMarker, TimelineTime, TimelineTitle, Toaster, Toggle, ToggleGroup, TokenInput, TokenInputEditor, TokenInputToken, TokenInputTokenRemove, Toolbar, ToolbarButton, ToolbarGroup, ToolbarInput, ToolbarLink, ToolbarSeparator, ToolbarToggle, Tooltip, TooltipContent, TooltipTrigger, Tree, TriggerMenu, TriggerMenuInput, Waterfall, addDays, addMonths, addYears, applyOrder, ariaKeyshortcuts, confirm, cropImage, daysInMonth, defaultPreferences, diffDays, enter, focusables, formatAgentStep, formatColor, formatDate, formatFileSize, formatShortcut, getInitials, getPreferenceAttributes, isValidDate, lift, matchesDate, mergeProps, mergeRefs, meterState, motionPresets, moveItem, packRows, paginationRange, parseColor, parseDate, parseTime, press, readPreferencesCookie, renderPart, shortcuts, stagger, toISODate, toISOTime, toast, todayISO, tokenInputText, transitions, useAppShell, useAsyncOptions, useControllableState, useElementWidth, useFieldContext, useFieldControl, useFocusTrap, useHoverIntent, useLayer, useListNavigation, useListQuery, usePopup, usePreferences, useReorder, useScrollLock, useShellRegion, useShortcut, useShortcutHint, visibleWaterfallRows, weekStartFor, weekdayOf };
|
|
3737
|
+
export type { AccordionItemData, AccordionItemProps, AccordionPanelProps, AccordionProps, AccordionTriggerProps, AgentConsoleEntry, AgentConsolePlan, AgentConsoleProps, AgentConsoleStatus, AlertDialogActionProps, AlertDialogContentProps, AlertDialogProps, AlertDialogTriggerProps, AppShellHeaderProps, AppShellInspectorProps, AppShellMainProps, AppShellProps, AppShellSidebarProps, AsyncLoader, AsyncOptionsConfig, AsyncStatus, AutocompleteItemProps, AutocompleteProps, AvatarFallbackProps, AvatarGroupProps, AvatarImageProps, AvatarLoadingStatus, AvatarPresence, AvatarProps, AvatarShape, AvatarSize, BadgeProps, BadgeVariant, BreadcrumbItem, BreadcrumbsProps, ButtonProps, ButtonSize, ButtonVariant, CalendarDayState, CalendarGridProps, CalendarMode, CalendarProps, CalendarValue, CarouselItemProps, CarouselProps, CarouselViewportProps, CheckboxGroupItem, CheckboxGroupProps, CheckboxProps, CheckedState, CitationChipProps, CollapsiblePanelProps, CollapsibleProps, CollapsibleTriggerProps, ColorFormat, ColorPickerPopoverProps, ColorPickerProps, ComboboxItemProps, ComboboxMultipleProps, ComboboxProps, ComboboxSingleProps, CommandData, CommandDataItem, CommandDialogProps, CommandFilter, CommandGroupProps, CommandInputProps, CommandItemProps, CommandPageProps, CommandProps, ConfirmOptions, ContextMenuProps, ContextMenuTriggerProps, ContrastPreference, CropImageOptions, CropRect, DashboardGridProps, DashboardSectionProps, DashboardTileProps, DateInputProps, DateMatcher, DateParts, DatePickerPreset, DatePickerProps, DateRange, DateSegmentType, DensityPreference, SurfaceCloseProps as DialogCloseProps, DialogContentProps, DialogProps, SurfaceTextProps as DialogTitleProps, DialogTriggerProps, DrawerContentProps, DrawerProps, DrawerSide, DrawerTriggerProps, EmptyStateProps, FieldContextValue, FieldControlInput, FieldErrorProps, FieldLabelProps, FieldProps, FileInputProps, FileRejection, FileRejectionReason, FontSizePreference, HeadingLevel, HeadingProps, HoverCardContentProps, HoverCardProps, HoverCardTriggerProps, Hsva, ISODate, ImageCropperHandle, ImageCropperMode, ImageCropperProps, ImageCropperShape, InputProps, LabelProps, LinkProps, ListFilter, ListNavigationOptions, ListItem as ListOption, ListEntry as ListOptionEntry, ListQueryOptions, ListboxItemProps, ListboxMultipleProps, ListboxProps, ListboxSingleProps, MenuCheckboxItemProps, MenuContentProps, MenuContextTriggerProps, MenuGroupProps, MenuItemProps, MenuProps, MenuRadioGroupProps, MenuRadioItemProps, MenuSubTriggerProps, MenuTriggerProps, MenubarProps, MeterProps, MeterState, MotionPreference, NavigationMenuContentProps, NavigationMenuItemData, NavigationMenuItemProps, NavigationMenuLinkData, NavigationMenuLinkProps, NavigationMenuProps, NavigationMenuTriggerProps, NumberInputProps, OTPInputProps, OTPPattern, OverlayHostProps, PaginationEntry, PaginationProps, PartButtonProps, PartRender, PasswordInputProps, SurfaceCloseProps as PopoverCloseProps, PopoverContentProps, SurfaceTextProps as PopoverDescriptionProps, PopoverProps, SurfaceTextProps as PopoverTitleProps, PopoverTriggerProps, PopupOptions, PopupPanelProps, PopupState, PreferenceKey, PreferenceValues, PreferencesContextValue, PreferencesPanelProps, PreferencesProviderProps, ProgressProps, RadioGroupItem, RadioGroupProps, RadioProps, RatingProps, ReorderApi, ReorderDetail, ReorderOptions, ReorderOrientation, ResizableHandleProps, ResizablePanelProps, ResizableProps, Rgba, ScrollAreaHandle, ScrollAreaProps, SegmentedControlProps, SegmentedOption, SelectContentProps, SelectGroupProps, SelectItemProps, SelectMultipleProps, SelectProps, SelectSingleProps, SelectTriggerProps, SelectValueProps, SeparatorProps, ShellToggleProps, ShortcutOptions, SidebarCollapse, SidebarGroupProps, SidebarItemProps, SidebarNavProps, SkeletonProps, SliderMark, SliderProps, SliderValue, SortDirection, SortState, StatProps, SwProviderProps, SwitchProps, TabProps, TableColumn, TableProps, TableRow, TableSort, TabsItem, TabsListProps, TabsPanelProps, TabsProps, TextareaProps, Theme, ThemePreference, TimeInputProps, TimeParts, TimelineEvent, TimelineImportance, TimelineItemProps, TimelineOrientation, TimelineProps, TimelineStatus, ToastAction, ToastItem, ToastOptions, ToastVariant, ToasterProps, ToggleGroupItem, ToggleGroupProps, ToggleProps, Token, TokenInputEditorProps, TokenInputProps, TokenInputTokenProps, TokenInputValue, ToolbarButtonProps, ToolbarGroupProps, ToolbarInputProps, ToolbarLinkProps, ToolbarProps, ToolbarToggleProps, TooltipContentProps, TooltipProps, TooltipTriggerProps, TreeItemData, TreeProps, TriggerDefinition, TriggerItemsLoader, TriggerMenuInputProps, TriggerMenuItem, TriggerMenuProps, TriggerToken, WaterfallColumn, WaterfallMark, WaterfallProps, WaterfallRowInfo, WaterfallSpan };
|