twico-ui 1.4.0 → 1.6.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/README.md +1 -0
- package/dist/index.cjs +2130 -1114
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +565 -170
- package/dist/index.d.ts +565 -170
- package/dist/index.mjs +2127 -1114
- package/dist/index.mjs.map +1 -1
- package/llms.txt +58 -10
- package/package.json +3 -1
- package/styles/twico-ui.css +15 -5
package/dist/index.d.ts
CHANGED
|
@@ -15,6 +15,8 @@ interface AccordionProps extends React.HTMLAttributes<HTMLDivElement> {
|
|
|
15
15
|
open?: string[];
|
|
16
16
|
/** Called with the next open values whenever a panel is toggled. */
|
|
17
17
|
onOpenChange?: (values: string[]) => void;
|
|
18
|
+
/** Heading level wrapping each trigger button (document-outline semantics). @default 3 */
|
|
19
|
+
headingLevel?: 1 | 2 | 3 | 4 | 5 | 6;
|
|
18
20
|
}
|
|
19
21
|
|
|
20
22
|
interface AccordionItem {
|
|
@@ -22,16 +24,45 @@ interface AccordionItem {
|
|
|
22
24
|
label: React.ReactNode;
|
|
23
25
|
content: React.ReactNode;
|
|
24
26
|
icon?: React.ReactNode;
|
|
27
|
+
/** Disable this section — its trigger can't be opened, activated, or focused. @default false */
|
|
28
|
+
disabled?: boolean;
|
|
29
|
+
/** Override the accordion's `headingLevel` for this item. */
|
|
30
|
+
headingLevel?: 1 | 2 | 3 | 4 | 5 | 6;
|
|
25
31
|
}
|
|
26
32
|
|
|
27
33
|
declare function Accordion(props: AccordionProps): React.JSX.Element;
|
|
28
34
|
|
|
35
|
+
// Shared, library-wide type vocabulary. Types only — no runtime. Re-exported from
|
|
36
|
+
// the package root so consumers can name the same unions the components use, instead
|
|
37
|
+
// of re-deriving them. See docs/tone-variant-system.md and docs/prop-conventions.md.
|
|
38
|
+
|
|
39
|
+
/** The canonical six-value color/intent scale used by status & control components. */
|
|
40
|
+
type Tone = "primary" | "success" | "warning" | "danger" | "info" | "neutral";
|
|
41
|
+
|
|
42
|
+
/** Action controls (Button, IconButton) — brand or destructive only. */
|
|
43
|
+
type ActionTone = "primary" | "danger";
|
|
44
|
+
|
|
45
|
+
/** Text roles, the full color scale, and `"inherit"` (adopt the parent color) — Text. */
|
|
46
|
+
type TextTone = "default" | "muted" | "subtle" | "inherit" | Tone;
|
|
47
|
+
|
|
48
|
+
/** Toast tone vocabulary — `"neutral"` is an alias of `"default"`. */
|
|
49
|
+
type ToastTone = "default" | "neutral" | "success" | "warning" | "danger" | "info";
|
|
50
|
+
|
|
51
|
+
/** Progress / Timeline bar tones — the scale minus `"neutral"` (no neutral bar state). */
|
|
52
|
+
type BarTone = Exclude<Tone, "neutral">;
|
|
53
|
+
|
|
54
|
+
/**
|
|
55
|
+
* The `as` prop of the polymorphic primitives — any intrinsic tag name (`"div"`)
|
|
56
|
+
* OR a React component (`as={Link}`), whose props then flow through `{...rest}`.
|
|
57
|
+
*/
|
|
58
|
+
type PolymorphicAs = React.ElementType;
|
|
59
|
+
|
|
29
60
|
/**
|
|
30
61
|
* Inline message banner with semantic tones, optional title, icon, and dismiss.
|
|
31
62
|
*/
|
|
32
63
|
interface AlertProps extends Omit<React.HTMLAttributes<HTMLDivElement>, "title"> {
|
|
33
64
|
/** Color intent. @default "info" */
|
|
34
|
-
tone?:
|
|
65
|
+
tone?: Tone;
|
|
35
66
|
/** Fill style. @default "soft" */
|
|
36
67
|
variant?: "soft" | "solid" | "outline";
|
|
37
68
|
/** Bold heading line. */
|
|
@@ -40,6 +71,14 @@ interface AlertProps extends Omit<React.HTMLAttributes<HTMLDivElement>, "title">
|
|
|
40
71
|
icon?: React.ReactNode;
|
|
41
72
|
/** Show a close button and handle dismissal. */
|
|
42
73
|
onClose?: () => void;
|
|
74
|
+
/**
|
|
75
|
+
* Live-region politeness. Tone-aware default: danger/warning → `"assertive"` (role="alert"),
|
|
76
|
+
* success/info → `"polite"` (role="status"), primary/neutral → `"off"` (no live region, for
|
|
77
|
+
* static banners). Set explicitly to override. @default tone-aware
|
|
78
|
+
*/
|
|
79
|
+
live?: "assertive" | "polite" | "off";
|
|
80
|
+
/** Accessible label for the dismiss button (shown only when `onClose` is set). @default "Dismiss" */
|
|
81
|
+
closeLabel?: string;
|
|
43
82
|
children?: React.ReactNode;
|
|
44
83
|
}
|
|
45
84
|
|
|
@@ -59,6 +98,10 @@ interface AvatarProps extends React.HTMLAttributes<HTMLSpanElement> {
|
|
|
59
98
|
square?: boolean;
|
|
60
99
|
/** Presence indicator. */
|
|
61
100
|
status?: "online" | "busy" | "away" | "offline";
|
|
101
|
+
/** Accessible text for the presence dot, folded into the avatar's spoken name (e.g. "Jane Doe, Online"). Defaults to a capitalized `status`. */
|
|
102
|
+
statusLabel?: string;
|
|
103
|
+
/** Localized presence labels keyed by status value. */
|
|
104
|
+
statusLabels?: Partial<Record<"online" | "busy" | "away" | "offline", string>>;
|
|
62
105
|
/** Adds a brand ring around the avatar. */
|
|
63
106
|
ring?: boolean;
|
|
64
107
|
}
|
|
@@ -77,6 +120,12 @@ interface MenuItemDef {
|
|
|
77
120
|
/** Render in danger color. */
|
|
78
121
|
danger?: boolean;
|
|
79
122
|
disabled?: boolean;
|
|
123
|
+
/** Turns the item into a link: renders `<a role="menuitem" href>`. Sanitized against javascript:/data:/vbscript:. `onClick` (if also set) still fires, then the menu closes. */
|
|
124
|
+
href?: string;
|
|
125
|
+
/** Anchor target when `href` is set (e.g. "_blank"). */
|
|
126
|
+
target?: string;
|
|
127
|
+
/** Anchor rel when `href` is set — pair "_blank" with "noopener noreferrer". */
|
|
128
|
+
rel?: string;
|
|
80
129
|
/** Render a divider line (ignores other fields). */
|
|
81
130
|
separator?: boolean;
|
|
82
131
|
/** Render as an uppercase section heading. */
|
|
@@ -107,6 +156,10 @@ interface MenuProps extends React.HTMLAttributes<HTMLSpanElement> {
|
|
|
107
156
|
open?: boolean;
|
|
108
157
|
/** Called with the requested open state on trigger click, item select, Esc, or outside click. */
|
|
109
158
|
onOpenChange?: (open: boolean) => void;
|
|
159
|
+
/** Accessible name for the `role="menu"` popup. When omitted and a `header` is set, the header labels the popup. */
|
|
160
|
+
"aria-label"?: string;
|
|
161
|
+
/** Id(s) of element(s) that label the popup; overrides the header fallback. */
|
|
162
|
+
"aria-labelledby"?: string;
|
|
110
163
|
}
|
|
111
164
|
|
|
112
165
|
declare function Menu(props: MenuProps): React.JSX.Element;
|
|
@@ -148,7 +201,7 @@ declare function AvatarMenu(props: AvatarMenuProps): React.JSX.Element;
|
|
|
148
201
|
*/
|
|
149
202
|
interface BadgeProps extends React.HTMLAttributes<HTMLSpanElement> {
|
|
150
203
|
/** Semantic color. @default "primary" */
|
|
151
|
-
tone?:
|
|
204
|
+
tone?: Tone;
|
|
152
205
|
/** Fill style. @default "soft" */
|
|
153
206
|
variant?: "soft" | "solid" | "outline";
|
|
154
207
|
/** Size scale. @default "md" */
|
|
@@ -200,7 +253,7 @@ interface ButtonProps extends React.ButtonHTMLAttributes<HTMLButtonElement> {
|
|
|
200
253
|
/** Fill style. @default "solid" */
|
|
201
254
|
variant?: "solid" | "soft" | "outline" | "ghost";
|
|
202
255
|
/** Color/intent, orthogonal to `variant`. @default "primary" */
|
|
203
|
-
tone?:
|
|
256
|
+
tone?: ActionTone;
|
|
204
257
|
/** Control size; "xs" (~26px) is smaller than "sm". @default "md" */
|
|
205
258
|
size?: "xs" | "sm" | "md" | "lg";
|
|
206
259
|
/** Icon node rendered before the label. */
|
|
@@ -235,6 +288,8 @@ interface CardProps extends Omit<React.HTMLAttributes<HTMLDivElement>, "title">
|
|
|
235
288
|
title?: React.ReactNode;
|
|
236
289
|
/** Muted subtitle under the title. */
|
|
237
290
|
subtitle?: React.ReactNode;
|
|
291
|
+
/** Header actions rendered top-right, opposite the title/subtitle (e.g. a button or menu). */
|
|
292
|
+
actions?: React.ReactNode;
|
|
238
293
|
/** Footer content (e.g. action buttons). */
|
|
239
294
|
footer?: React.ReactNode;
|
|
240
295
|
/** Visual style. @default "elevated" */
|
|
@@ -252,8 +307,14 @@ declare function Card(props: CardProps): React.JSX.Element;
|
|
|
252
307
|
|
|
253
308
|
/**
|
|
254
309
|
* Sliding carousel — one slide per view, prev/next arrows, dot indicators,
|
|
255
|
-
* optional looping and autoplay
|
|
256
|
-
*
|
|
310
|
+
* optional looping and autoplay. Each child is a slide. Controlled via `index` +
|
|
311
|
+
* `onIndexChange`, or uncontrolled via `defaultIndex`.
|
|
312
|
+
*
|
|
313
|
+
* Accessibility: the region is focusable and keyboard-navigable — ArrowLeft/ArrowRight
|
|
314
|
+
* step slides and Home/End jump to first/last. Autoplay pauses on hover/focus, via the
|
|
315
|
+
* pause button, and when `prefers-reduced-motion` is set (WCAG 2.2.2); a polite live
|
|
316
|
+
* region announces the active slide (silenced while auto-rotating). Give the region an
|
|
317
|
+
* accessible name with `label` (or `aria-label`/`aria-labelledby`).
|
|
257
318
|
*
|
|
258
319
|
* @startingPoint section="Data display" subtitle="Sliding carousel" viewport="700x320"
|
|
259
320
|
*/
|
|
@@ -262,44 +323,53 @@ interface CarouselProps extends React.HTMLAttributes<HTMLDivElement> {
|
|
|
262
323
|
index?: number;
|
|
263
324
|
/** Initial slide index when uncontrolled. @default 0 */
|
|
264
325
|
defaultIndex?: number;
|
|
265
|
-
/** Fired when the active slide changes (arrows, dots, or autoplay): (index). */
|
|
326
|
+
/** Fired when the active slide changes (arrows, dots, keyboard, or autoplay): (index). */
|
|
266
327
|
onIndexChange?: (index: number) => void;
|
|
267
328
|
/** Show prev/next arrows. @default true */
|
|
268
329
|
showArrows?: boolean;
|
|
269
330
|
/** Show dot indicators. @default true */
|
|
270
331
|
showDots?: boolean;
|
|
332
|
+
/** Show the pause/play toggle when `autoPlay` is on. @default true */
|
|
333
|
+
showPauseButton?: boolean;
|
|
271
334
|
/** Wrap around at the ends. @default true */
|
|
272
335
|
loop?: boolean;
|
|
273
|
-
/** Auto-advance slides. @default false */
|
|
336
|
+
/** Auto-advance slides. Suppressed under `prefers-reduced-motion`. @default false */
|
|
274
337
|
autoPlay?: boolean;
|
|
275
338
|
/** Autoplay interval in ms. @default 4000 */
|
|
276
339
|
interval?: number;
|
|
340
|
+
/** Accessible name for the carousel region. Falls back to `aria-label`, then `"Carousel"`. */
|
|
341
|
+
label?: string;
|
|
342
|
+
/** Accessible label for the pause button (paused → shows the play label). @default "Pause" */
|
|
343
|
+
pauseLabel?: string;
|
|
344
|
+
/** Accessible label for the play button. @default "Play" */
|
|
345
|
+
playLabel?: string;
|
|
277
346
|
/** Slides (each child is one slide). */
|
|
278
347
|
children?: React.ReactNode;
|
|
279
348
|
}
|
|
280
349
|
|
|
281
350
|
declare function Carousel(props: CarouselProps): React.JSX.Element;
|
|
282
351
|
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
}
|
|
352
|
+
/**
|
|
353
|
+
* A chart data point: a `label` plus one numeric field per series key `K`
|
|
354
|
+
* (default key `"value"`). `K` is normally inferred from the `series` prop.
|
|
355
|
+
*/
|
|
356
|
+
type ChartDatum<K extends string = "value"> = { label: React.ReactNode } & { [P in K]: number };
|
|
289
357
|
|
|
290
358
|
/**
|
|
291
359
|
* Lightweight, dependency-free SVG chart — bar or line, single or multi-series,
|
|
292
|
-
* with grid, axes, animated entrance, tooltips, and optional legend.
|
|
360
|
+
* with grid, axes, animated entrance, tooltips, and optional legend. Generic over
|
|
361
|
+
* the series keys `K` so the data rows are type-checked (e.g.
|
|
362
|
+
* `<Chart series={["sales"]} data={[{ label, sales: 12 }]} />`).
|
|
293
363
|
*
|
|
294
364
|
* @startingPoint section="Data display" subtitle="Bar / line chart (no deps)" viewport="700x280"
|
|
295
365
|
*/
|
|
296
|
-
interface ChartProps extends React.HTMLAttributes<HTMLDivElement> {
|
|
366
|
+
interface ChartProps<K extends string = "value"> extends React.HTMLAttributes<HTMLDivElement> {
|
|
297
367
|
/** @default "bar" */
|
|
298
368
|
type?: "bar" | "line";
|
|
299
|
-
/** Data points. Each has a `label` + one numeric field per series. */
|
|
300
|
-
data: ChartDatum[];
|
|
301
|
-
/** Series field names (defaults to ["value"]). Multiple = grouped bars / multi-line. */
|
|
302
|
-
series?:
|
|
369
|
+
/** Data points. Each has a `label` + one numeric field per series key. (`K` is inferred from `series`, not from `data`.) */
|
|
370
|
+
data: ChartDatum<NoInfer<K>>[];
|
|
371
|
+
/** Series field names (defaults to `["value"]`). Multiple = grouped bars / multi-line. */
|
|
372
|
+
series?: K[];
|
|
303
373
|
/** Pixel height. @default 220 */
|
|
304
374
|
height?: number;
|
|
305
375
|
/** Horizontal grid lines. @default true */
|
|
@@ -310,13 +380,17 @@ interface ChartProps extends React.HTMLAttributes<HTMLDivElement> {
|
|
|
310
380
|
showLegend?: boolean;
|
|
311
381
|
/** Per-series colors (any CSS color), cycled when shorter than `series`. Defaults to the built-in token palette. */
|
|
312
382
|
colors?: string[];
|
|
313
|
-
/** Tooltip value formatter. */
|
|
383
|
+
/** Tooltip value formatter (also formats the hidden data-table cells). */
|
|
314
384
|
valueFormat?: (value: number) => string;
|
|
315
|
-
/** Accessible name for the chart's `<svg role="img">`. Defaults to `"<type> chart"
|
|
385
|
+
/** Accessible name for the chart's `<svg role="img">`. Per-point values are exposed via the hidden data table, not this label. Defaults to `"<type> chart"`; also accepts `aria-label`. */
|
|
316
386
|
ariaLabel?: string;
|
|
387
|
+
/** Render a visually-hidden data table as an accessible text alternative (WCAG 1.1.1). @default true */
|
|
388
|
+
tableFallback?: boolean;
|
|
389
|
+
/** Caption for the hidden data table; defaults to the chart's accessible label. */
|
|
390
|
+
caption?: React.ReactNode;
|
|
317
391
|
}
|
|
318
392
|
|
|
319
|
-
declare function Chart(props: ChartProps): React.JSX.Element;
|
|
393
|
+
declare function Chart<K extends string = "value">(props: ChartProps<K>): React.JSX.Element;
|
|
320
394
|
|
|
321
395
|
/**
|
|
322
396
|
* Checkbox with animated checkmark, label, description, and indeterminate state.
|
|
@@ -330,7 +404,7 @@ interface CheckboxProps extends Omit<React.InputHTMLAttributes<HTMLInputElement>
|
|
|
330
404
|
indeterminate?: boolean;
|
|
331
405
|
size?: "sm" | "md" | "lg";
|
|
332
406
|
/** Color intent. @default "primary" */
|
|
333
|
-
tone?:
|
|
407
|
+
tone?: Tone;
|
|
334
408
|
}
|
|
335
409
|
|
|
336
410
|
declare function Checkbox(props: CheckboxProps): React.JSX.Element;
|
|
@@ -359,12 +433,34 @@ interface ColorPickerProps extends Omit<React.HTMLAttributes<HTMLDivElement>, "o
|
|
|
359
433
|
/** Disable all interaction (the popover cannot be opened). @default false */
|
|
360
434
|
disabled?: boolean;
|
|
361
435
|
/** Color intent for the focus/open accent. @default "primary" */
|
|
362
|
-
tone?:
|
|
436
|
+
tone?: Tone;
|
|
363
437
|
onChange?: (hex: string) => void;
|
|
364
438
|
}
|
|
365
439
|
|
|
366
440
|
declare function ColorPicker(props: ColorPickerProps): React.JSX.Element;
|
|
367
441
|
|
|
442
|
+
// Shared option shape for the Select family (Select, Combobox, MultiSelect). One
|
|
443
|
+
// canonical pair instead of three byte-identical duplicates; the per-component names
|
|
444
|
+
// (SelectOption, ComboboxOption, …) stay as structural aliases so existing imports
|
|
445
|
+
// keep resolving. Types only — no runtime. CurrencyField's CurrencyOption is a
|
|
446
|
+
// deliberately separate, narrower shape and is NOT unified here.
|
|
447
|
+
|
|
448
|
+
/** A single selectable option. */
|
|
449
|
+
interface Option {
|
|
450
|
+
value: string;
|
|
451
|
+
label: string;
|
|
452
|
+
/** Optional second line shown under the label. */
|
|
453
|
+
description?: string;
|
|
454
|
+
/** Disable this option — not selectable, skipped by keyboard navigation. */
|
|
455
|
+
disabled?: boolean;
|
|
456
|
+
}
|
|
457
|
+
|
|
458
|
+
/** A labeled group of options (or bare string values). */
|
|
459
|
+
interface OptionGroup {
|
|
460
|
+
group: string;
|
|
461
|
+
options: Array<string | Option>;
|
|
462
|
+
}
|
|
463
|
+
|
|
368
464
|
/**
|
|
369
465
|
* Searchable single-select (MUI-Autocomplete style) — type directly in the
|
|
370
466
|
* field to filter; the overlay shows only options. Supports grouped options
|
|
@@ -380,7 +476,7 @@ interface ComboboxProps extends Omit<React.InputHTMLAttributes<HTMLInputElement>
|
|
|
380
476
|
required?: boolean;
|
|
381
477
|
size?: "sm" | "md" | "lg";
|
|
382
478
|
/** Color intent for the focus/open accent. @default "primary" */
|
|
383
|
-
tone?:
|
|
479
|
+
tone?: Tone;
|
|
384
480
|
/** Field placeholder. */
|
|
385
481
|
placeholder?: string;
|
|
386
482
|
/** Options — strings, {value,label,description}, or {group,options} groups. */
|
|
@@ -389,6 +485,7 @@ interface ComboboxProps extends Omit<React.InputHTMLAttributes<HTMLInputElement>
|
|
|
389
485
|
value?: string | null;
|
|
390
486
|
/** Uncontrolled initial value. */
|
|
391
487
|
defaultValue?: string | null;
|
|
488
|
+
/** Called with the chosen option's value, or `null` when cleared via `clearable`. */
|
|
392
489
|
onChange?: (value: string | null) => void;
|
|
393
490
|
/** Show a clear (×) affix when a value is selected. */
|
|
394
491
|
clearable?: boolean;
|
|
@@ -401,24 +498,27 @@ interface ComboboxProps extends Omit<React.InputHTMLAttributes<HTMLInputElement>
|
|
|
401
498
|
portal?: boolean;
|
|
402
499
|
/** Minimum popover width in px when portaled (useful when the control is narrow). @default 0 */
|
|
403
500
|
minWidth?: number;
|
|
501
|
+
/** Called with the raw query on every keystroke — drive a debounced remote fetch (with `loading` + `filter={false}`). */
|
|
502
|
+
onInputChange?: (query: string) => void;
|
|
503
|
+
/** Client-side filtering: `false` shows options as-is (server-ranked); a function replaces the default label/description match. */
|
|
504
|
+
filter?: boolean | ((option: ComboboxOption, query: string) => boolean);
|
|
505
|
+
/** Show a loading row instead of the option list / empty state. @default false */
|
|
506
|
+
loading?: boolean;
|
|
507
|
+
/** Text shown when no options match. @default "No results found" */
|
|
508
|
+
emptyText?: string;
|
|
509
|
+
/** Name for a hidden form field so the selected value participates in native form submission. */
|
|
510
|
+
name?: string;
|
|
404
511
|
/** Composed with the field's open-on-focus behavior — your handler runs first. */
|
|
405
512
|
onFocus?: React.FocusEventHandler<HTMLInputElement>;
|
|
406
513
|
/** Composed with the field's keyboard navigation (Arrows/Enter/Escape) — your handler runs first; call `event.preventDefault()` to suppress it. */
|
|
407
514
|
onKeyDown?: React.KeyboardEventHandler<HTMLInputElement>;
|
|
408
515
|
}
|
|
409
516
|
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
label: string;
|
|
413
|
-
/** Optional second line shown under the label. */
|
|
414
|
-
description?: string;
|
|
415
|
-
}
|
|
517
|
+
/** Alias of the shared {@link Option} type (kept for backward-compatible imports). */
|
|
518
|
+
type ComboboxOption = Option;
|
|
416
519
|
|
|
417
|
-
/**
|
|
418
|
-
|
|
419
|
-
group: string;
|
|
420
|
-
options: Array<string | ComboboxOption>;
|
|
421
|
-
}
|
|
520
|
+
/** Alias of the shared {@link OptionGroup} type (kept for backward-compatible imports). */
|
|
521
|
+
type ComboboxGroup = OptionGroup;
|
|
422
522
|
|
|
423
523
|
declare function Combobox(props: ComboboxProps): React.JSX.Element;
|
|
424
524
|
|
|
@@ -455,6 +555,8 @@ interface CommandPaletteProps extends React.HTMLAttributes<HTMLDivElement> {
|
|
|
455
555
|
commands: Command[];
|
|
456
556
|
placeholder?: string;
|
|
457
557
|
emptyText?: string;
|
|
558
|
+
/** Accessible name for the search input. @default "Command palette search" */
|
|
559
|
+
searchLabel?: string;
|
|
458
560
|
}
|
|
459
561
|
|
|
460
562
|
declare function CommandPalette(props: CommandPaletteProps): React.JSX.Element | null;
|
|
@@ -476,7 +578,7 @@ interface CurrencyProps extends Omit<React.InputHTMLAttributes<HTMLInputElement>
|
|
|
476
578
|
required?: boolean;
|
|
477
579
|
size?: "sm" | "md" | "lg";
|
|
478
580
|
/** Color intent for the focus/open accent. @default "primary" */
|
|
479
|
-
tone?:
|
|
581
|
+
tone?: Tone;
|
|
480
582
|
/** Currency code (key in the built-in table), e.g. "USD", "EUR", "IDR", "JPY". @default "USD" */
|
|
481
583
|
currency?: string;
|
|
482
584
|
/** Override the currency's decimal precision (number of digits after the decimal). */
|
|
@@ -485,13 +587,13 @@ interface CurrencyProps extends Omit<React.InputHTMLAttributes<HTMLInputElement>
|
|
|
485
587
|
symbol?: string;
|
|
486
588
|
/** Override the displayed suffix code. */
|
|
487
589
|
code?: string;
|
|
488
|
-
/** Controlled string value. */
|
|
590
|
+
/** Controlled value (string or number). For numeric state, read the parsed value back from `onValueChange` — NOT from the `onChange` event, whose `e.target.value` is a string. */
|
|
489
591
|
value?: string | number;
|
|
490
592
|
/** Uncontrolled initial value. */
|
|
491
593
|
defaultValue?: string | number;
|
|
492
|
-
/**
|
|
594
|
+
/** Escape hatch for the native DOM event. `e.target.value` is a **string** (the raw input the user typed), not a number — the field then clamps the displayed value to the currency precision. For controlled numeric state use `onValueChange` instead. */
|
|
493
595
|
onChange?: (e: React.ChangeEvent<HTMLInputElement>) => void;
|
|
494
|
-
/**
|
|
596
|
+
/** Primary value callback: the parsed numeric value (`number | null`) plus the clamped, formatted display string. Use this — not `onChange` — for controlled numeric state. */
|
|
495
597
|
onValueChange?: (value: number | null, formatted: string) => void;
|
|
496
598
|
}
|
|
497
599
|
|
|
@@ -516,7 +618,7 @@ interface CurrencyFieldProps extends Omit<React.InputHTMLAttributes<HTMLInputEle
|
|
|
516
618
|
required?: boolean;
|
|
517
619
|
size?: "sm" | "md" | "lg";
|
|
518
620
|
/** Color intent for the focus/open accent. @default "primary" */
|
|
519
|
-
tone?:
|
|
621
|
+
tone?: Tone;
|
|
520
622
|
/** Controlled selected currency code. */
|
|
521
623
|
currency?: string;
|
|
522
624
|
/** Uncontrolled initial currency code. @default "USD" */
|
|
@@ -525,13 +627,13 @@ interface CurrencyFieldProps extends Omit<React.InputHTMLAttributes<HTMLInputEle
|
|
|
525
627
|
onCurrencyChange?: (code: string) => void;
|
|
526
628
|
/** Limit the selectable currencies (codes or {value,label}); defaults to the full built-in list. */
|
|
527
629
|
currencies?: Array<string | CurrencyOption>;
|
|
528
|
-
/** Controlled amount string. */
|
|
630
|
+
/** Controlled amount (string or number). For numeric state, read the parsed value back from `onValueChange` — NOT from the `onChange` event, whose `e.target.value` is a string. */
|
|
529
631
|
value?: string | number;
|
|
530
632
|
/** Uncontrolled initial amount. */
|
|
531
633
|
defaultValue?: string | number;
|
|
532
|
-
/**
|
|
634
|
+
/** Escape hatch for the native DOM event. `e.target.value` is a **string** (the raw input), not a number — the field then clamps the displayed value to the currency precision. For controlled numeric state use `onValueChange`. */
|
|
533
635
|
onChange?: (e: React.ChangeEvent<HTMLInputElement>) => void;
|
|
534
|
-
/**
|
|
636
|
+
/** Primary value callback: the parsed number (`number | null`), the clamped formatted string, and the active currency code. Use this — not `onChange` — for controlled numeric state. */
|
|
535
637
|
onValueChange?: (value: number | null, formatted: string, currency: string) => void;
|
|
536
638
|
}
|
|
537
639
|
|
|
@@ -551,15 +653,15 @@ declare function CurrencyField(props: CurrencyFieldProps): React.JSX.Element;
|
|
|
551
653
|
*
|
|
552
654
|
* @startingPoint section="Data display" subtitle="MUI-style sortable/filterable/pinnable data table" viewport="900x460"
|
|
553
655
|
*/
|
|
554
|
-
interface DatatableProps extends Omit<React.HTMLAttributes<HTMLDivElement>, "rows"> {
|
|
656
|
+
interface DatatableProps<T = any> extends Omit<React.HTMLAttributes<HTMLDivElement>, "rows"> {
|
|
555
657
|
/** Column definitions. */
|
|
556
|
-
columns: DatatableColumn[];
|
|
658
|
+
columns: DatatableColumn<T>[];
|
|
557
659
|
/** Row objects. In server mode, only the current page's rows. */
|
|
558
|
-
rows:
|
|
660
|
+
rows: T[];
|
|
559
661
|
/** Show shimmering skeleton rows instead of data. @default false */
|
|
560
662
|
loading?: boolean;
|
|
561
663
|
/** Returns a stable key per row. @default (r,i) => r.id ?? i */
|
|
562
|
-
rowKey?: (row:
|
|
664
|
+
rowKey?: (row: T, index: number) => string | number;
|
|
563
665
|
/** Render a leading checkbox-selection column. @default false */
|
|
564
666
|
checkboxSelection?: boolean;
|
|
565
667
|
/** Render a leading auto-numbered row column (1, 2, 3…). The number reflects each row's position in
|
|
@@ -578,7 +680,7 @@ interface DatatableProps extends Omit<React.HTMLAttributes<HTMLDivElement>, "row
|
|
|
578
680
|
* cross-page selections, use the complete `selectedKeys` array and re-fetch the
|
|
579
681
|
* full row objects server-side rather than relying on `selectedRows`.
|
|
580
682
|
*/
|
|
581
|
-
batchActions?: DatatableBatchAction[];
|
|
683
|
+
batchActions?: DatatableBatchAction<T>[];
|
|
582
684
|
/** Row height preset. With `showDensity`, the toolbar density button cycles it locally; changing this prop re-applies it. @default "comfortable" */
|
|
583
685
|
density?: "compact" | "standard" | "comfortable";
|
|
584
686
|
/** Initial rows per page. 0 disables pagination. @default 10 */
|
|
@@ -616,6 +718,10 @@ interface DatatableProps extends Omit<React.HTMLAttributes<HTMLDivElement>, "row
|
|
|
616
718
|
* rearrange only the movable, unpinned columns and leave pinned/actions columns in place.
|
|
617
719
|
* @default false */
|
|
618
720
|
disableColumnReorder?: boolean;
|
|
721
|
+
/** Message rendered when there are no rows (filter-aware default: "No rows match your filters" when a filter/quick-search is active, else "No rows"). */
|
|
722
|
+
emptyMessage?: React.ReactNode;
|
|
723
|
+
/** Render a custom empty state inside the table body (e.g. the shipped `<EmptyState/>`). Overrides `emptyMessage`. */
|
|
724
|
+
renderEmpty?: () => React.ReactNode;
|
|
619
725
|
/** Disable column resizing. When enabled (the default off), drag a header's right edge to resize a
|
|
620
726
|
* column, or **double-click** that edge to auto-fit the column to its widest visible content
|
|
621
727
|
* (header + rendered cells), Excel-style. @default false */
|
|
@@ -623,23 +729,23 @@ interface DatatableProps extends Omit<React.HTMLAttributes<HTMLDivElement>, "row
|
|
|
623
729
|
/** Make all columns editable by default (double-click a cell to edit; per-column `editable` overrides). @default false */
|
|
624
730
|
editMode?: boolean;
|
|
625
731
|
/** Called when a cell edit is committed: (updatedRow, originalRow, field). */
|
|
626
|
-
onRowUpdate?: (updatedRow:
|
|
732
|
+
onRowUpdate?: (updatedRow: T, originalRow: T, field: string) => void;
|
|
627
733
|
/** Controlled-rows callback: receives the full next rows array after an edit (client mode). */
|
|
628
|
-
onRowsChange?: (rows:
|
|
734
|
+
onRowsChange?: (rows: T[]) => void;
|
|
629
735
|
/** Fired when the built-in batch editor applies columns across selected rows:
|
|
630
736
|
* (changedRows, patch, selectedKeys). The selection-toolbar "Edit" button appears
|
|
631
737
|
* automatically when there are editable columns. Server-mode caveat: `changedRows`
|
|
632
738
|
* resolves only rows on the currently loaded page; for cross-page selections use the
|
|
633
739
|
* complete `selectedKeys` array and apply the `patch` server-side. */
|
|
634
|
-
onBatchUpdate?: (changedRows:
|
|
740
|
+
onBatchUpdate?: (changedRows: T[], patch: Record<string, any>, selectedKeys: Array<string | number>) => void;
|
|
635
741
|
/** Show a "Go to" page jumper in the footer when there are more than 5 pages. @default true */
|
|
636
742
|
showPageJumper?: boolean;
|
|
637
743
|
/** Click-to-select mode: "row" highlights the clicked row, "cell" highlights a single cell. @default "none" */
|
|
638
744
|
selectionMode?: "none" | "row" | "cell";
|
|
639
745
|
/** Fired when a row is clicked in "row" selection mode: (row, key). */
|
|
640
|
-
onRowClick?: (row:
|
|
746
|
+
onRowClick?: (row: T, key: string | number) => void;
|
|
641
747
|
/** Fired when a cell is clicked in "cell" selection mode: (value, row, field). */
|
|
642
|
-
onCellClick?: (value: any, row:
|
|
748
|
+
onCellClick?: (value: any, row: T, field: string) => void;
|
|
643
749
|
/** Fired when the active cell changes: ({ key, field } | null). */
|
|
644
750
|
onActiveCellChange?: (cell: { key: string | number; field: string } | null) => void;
|
|
645
751
|
/** Show the **Aggregation** toolbar button and start with the totals row on. From that panel the user
|
|
@@ -685,6 +791,18 @@ interface DatatableProps extends Omit<React.HTMLAttributes<HTMLDivElement>, "row
|
|
|
685
791
|
rowHeight?: number;
|
|
686
792
|
}
|
|
687
793
|
|
|
794
|
+
/** String-column filter operators (Datatable server mode). */
|
|
795
|
+
type DatatableStringOp = "contains" | "equals" | "startsWith" | "endsWith" | "isEmpty" | "isNotEmpty" | "isAnyOf";
|
|
796
|
+
/** Number-column filter operators. */
|
|
797
|
+
type DatatableNumberOp = "=" | "!=" | ">" | ">=" | "<" | "<=" | "isAnyOf";
|
|
798
|
+
/** Any Datatable filter operator. */
|
|
799
|
+
type DatatableFilterOp = DatatableStringOp | DatatableNumberOp;
|
|
800
|
+
/** A single active filter — the value shape is discriminated by `op`. */
|
|
801
|
+
type DatatableFilter =
|
|
802
|
+
| { field: string; op: "isAnyOf"; value: string[] }
|
|
803
|
+
| { field: string; op: "isEmpty" | "isNotEmpty"; value?: undefined }
|
|
804
|
+
| { field: string; op: Exclude<DatatableFilterOp, "isAnyOf" | "isEmpty" | "isNotEmpty">; value: string };
|
|
805
|
+
|
|
688
806
|
/** Query state reported by a server-mode Datatable. */
|
|
689
807
|
interface DatatableQuery {
|
|
690
808
|
/** Zero-based page index. */
|
|
@@ -693,13 +811,16 @@ interface DatatableQuery {
|
|
|
693
811
|
pageSize: number;
|
|
694
812
|
/** Active sort, or null. */
|
|
695
813
|
sort: { field: string; dir: "asc" | "desc" } | null;
|
|
696
|
-
/**
|
|
697
|
-
|
|
814
|
+
/**
|
|
815
|
+
* Active column filters. String columns emit contains/equals/startsWith/endsWith/isAnyOf/isEmpty/isNotEmpty;
|
|
816
|
+
* number columns emit =, !=, >, >=, <, <=. `value` is a `string[]` for `isAnyOf` and omitted for `isEmpty`/`isNotEmpty`.
|
|
817
|
+
*/
|
|
818
|
+
filters: DatatableFilter[];
|
|
698
819
|
/** Quick-search text. */
|
|
699
820
|
quickFilter: string;
|
|
700
821
|
}
|
|
701
822
|
|
|
702
|
-
interface DatatableColumn {
|
|
823
|
+
interface DatatableColumn<T = any> {
|
|
703
824
|
/** Row object key (also the sort/filter key). */
|
|
704
825
|
field: string;
|
|
705
826
|
/** Header label. @default field ("Actions" for actions columns) */
|
|
@@ -724,12 +845,14 @@ interface DatatableColumn {
|
|
|
724
845
|
pinned?: "left" | "right";
|
|
725
846
|
/** Allow drag-to-resize of this column. @default true */
|
|
726
847
|
resizable?: boolean;
|
|
848
|
+
/** Allow drag / menu / keyboard reorder of this column (independent of the table-wide `disableColumnReorder`). @default true */
|
|
849
|
+
reorderable?: boolean;
|
|
727
850
|
/** Summary-footer aggregation: a preset, or a function over the column's values. */
|
|
728
|
-
aggregation?: "sum" | "avg" | "min" | "max" | "count" | ((values: any[], rows:
|
|
851
|
+
aggregation?: "sum" | "avg" | "min" | "max" | "count" | ((values: any[], rows: T[]) => React.ReactNode);
|
|
729
852
|
/** Format an aggregation result for the footer (falls back to valueFormatter). */
|
|
730
853
|
aggregationFormatter?: (value: any) => React.ReactNode;
|
|
731
854
|
/** Map a row to its exported CSV value (defaults to the raw field value). */
|
|
732
|
-
exportValue?: (value: any, row:
|
|
855
|
+
exportValue?: (value: any, row: T) => string | number;
|
|
733
856
|
/** Make this column's cells editable (double-click to edit). Overrides the grid `editMode`. */
|
|
734
857
|
editable?: boolean;
|
|
735
858
|
/** Editor type. "select" (or any column with `valueOptions`) renders a dropdown; else a text/number input by column type. */
|
|
@@ -742,21 +865,21 @@ interface DatatableColumn {
|
|
|
742
865
|
/** Distinct values for the "is any of" multi-value filter (recommended in server mode). */
|
|
743
866
|
valueOptions?: Array<string | { value: string; label: string }>;
|
|
744
867
|
/** Format the raw value to a string/number for display. */
|
|
745
|
-
valueFormatter?: (value: any, row:
|
|
868
|
+
valueFormatter?: (value: any, row: T) => React.ReactNode;
|
|
746
869
|
/** Fully custom cell renderer (badges, avatars, etc.). */
|
|
747
|
-
renderCell?: (value: any, row:
|
|
870
|
+
renderCell?: (value: any, row: T) => React.ReactNode;
|
|
748
871
|
/** For type:"actions" — returns the row's action items. */
|
|
749
|
-
getActions?: (row:
|
|
872
|
+
getActions?: (row: T) => DatatableRowAction<T>[];
|
|
750
873
|
}
|
|
751
874
|
|
|
752
875
|
/** A per-row action in an actions column. */
|
|
753
|
-
interface DatatableRowAction {
|
|
876
|
+
interface DatatableRowAction<T = any> {
|
|
754
877
|
/** Icon node (rendered as an icon button, or leading icon in the overflow menu). */
|
|
755
878
|
icon?: React.ReactNode;
|
|
756
879
|
/** Accessible label / tooltip / menu text. */
|
|
757
880
|
label: string;
|
|
758
881
|
/** Click handler, receives the row. */
|
|
759
|
-
onClick?: (row:
|
|
882
|
+
onClick?: (row: T) => void;
|
|
760
883
|
/** Place in the ⋮ overflow menu instead of inline. @default false */
|
|
761
884
|
showInMenu?: boolean;
|
|
762
885
|
/** Render in danger color. */
|
|
@@ -765,19 +888,19 @@ interface DatatableRowAction {
|
|
|
765
888
|
}
|
|
766
889
|
|
|
767
890
|
/** A batch action shown in the selection toolbar. */
|
|
768
|
-
interface DatatableBatchAction {
|
|
891
|
+
interface DatatableBatchAction<T = any> {
|
|
769
892
|
/** Button label. */
|
|
770
893
|
label: string;
|
|
771
894
|
/** Leading icon node. */
|
|
772
895
|
icon?: React.ReactNode;
|
|
773
896
|
/** Handler: (selectedKeys, selectedRows, clearSelection). */
|
|
774
|
-
onClick?: (keys: Array<string | number>, rows:
|
|
897
|
+
onClick?: (keys: Array<string | number>, rows: T[], clearSelection: () => void) => void;
|
|
775
898
|
/** Render in danger color. */
|
|
776
899
|
danger?: boolean;
|
|
777
900
|
disabled?: boolean;
|
|
778
901
|
}
|
|
779
902
|
|
|
780
|
-
declare function Datatable(props: DatatableProps): React.JSX.Element;
|
|
903
|
+
declare function Datatable<T = any>(props: DatatableProps<T>): React.JSX.Element;
|
|
781
904
|
|
|
782
905
|
/**
|
|
783
906
|
* Apply a `DatatableQuery` (the object a `serverMode` grid passes to
|
|
@@ -794,7 +917,7 @@ declare function Datatable(props: DatatableProps): React.JSX.Element;
|
|
|
794
917
|
declare function runDatatableQuery<T = any>(
|
|
795
918
|
rows: T[],
|
|
796
919
|
query: DatatableQuery,
|
|
797
|
-
options?: { columns?: DatatableColumn[]; searchFields?: string[] }
|
|
920
|
+
options?: { columns?: DatatableColumn<T>[]; searchFields?: string[] }
|
|
798
921
|
): { rows: T[]; total: number; filtered: T[] };
|
|
799
922
|
|
|
800
923
|
/**
|
|
@@ -823,7 +946,7 @@ interface DatePickerProps extends Omit<React.HTMLAttributes<HTMLDivElement>, "on
|
|
|
823
946
|
max?: Date;
|
|
824
947
|
disabled?: boolean;
|
|
825
948
|
/** Color intent for the focus/open accent. @default "primary" */
|
|
826
|
-
tone?:
|
|
949
|
+
tone?: Tone;
|
|
827
950
|
/** Show a clear (×) button when a date is set. @default true */
|
|
828
951
|
clearable?: boolean;
|
|
829
952
|
/** Custom display formatter (defaults to a localized medium date). */
|
|
@@ -868,10 +991,16 @@ interface DateRangePickerProps extends Omit<React.HTMLAttributes<HTMLDivElement>
|
|
|
868
991
|
locale?: string;
|
|
869
992
|
/** First day of week: 0 = Sunday … 6 = Saturday. @default 0 */
|
|
870
993
|
weekStartsOn?: 0 | 1 | 2 | 3 | 4 | 5 | 6;
|
|
994
|
+
/** Earliest selectable date (inclusive); earlier days are disabled. */
|
|
995
|
+
min?: Date;
|
|
996
|
+
/** Latest selectable date (inclusive); later days are disabled. */
|
|
997
|
+
max?: Date;
|
|
998
|
+
/** Predicate to disable arbitrary dates (return true to disable). */
|
|
999
|
+
disabledDate?: (date: Date) => boolean;
|
|
871
1000
|
/** Disable all interaction (the popover cannot be opened). @default false */
|
|
872
1001
|
disabled?: boolean;
|
|
873
1002
|
/** Color intent for the focus/open accent. @default "primary" */
|
|
874
|
-
tone?:
|
|
1003
|
+
tone?: Tone;
|
|
875
1004
|
onChange?: (range: DateRange) => void;
|
|
876
1005
|
}
|
|
877
1006
|
|
|
@@ -906,7 +1035,7 @@ declare function Dialog(props: DialogProps): React.JSX.Element | null;
|
|
|
906
1035
|
* (or left/right-aligned) label.
|
|
907
1036
|
*/
|
|
908
1037
|
interface DividerProps extends React.HTMLAttributes<HTMLElement> {
|
|
909
|
-
/** @default "horizontal" */
|
|
1038
|
+
/** Rule axis — applies to both the plain and the labeled variant (exposed as `aria-orientation`). @default "horizontal" */
|
|
910
1039
|
orientation?: "horizontal" | "vertical";
|
|
911
1040
|
/** Indent the start of a horizontal rule. */
|
|
912
1041
|
inset?: boolean;
|
|
@@ -956,7 +1085,7 @@ interface EmptyStateProps extends Omit<React.HTMLAttributes<HTMLDivElement>, "ti
|
|
|
956
1085
|
description?: React.ReactNode;
|
|
957
1086
|
/** Action buttons row. */
|
|
958
1087
|
actions?: React.ReactNode;
|
|
959
|
-
/** Add a dashed border (good for drop targets / placeholders). @deprecated
|
|
1088
|
+
/** Add a dashed border (good for drop targets / placeholders). @deprecated since 1.4, removed in 2.0 — use `border`. @default false */
|
|
960
1089
|
bordered?: boolean;
|
|
961
1090
|
/** Add a dashed border (good for drop targets / placeholders); preferred alias for `bordered`. @default false */
|
|
962
1091
|
border?: boolean;
|
|
@@ -967,15 +1096,16 @@ declare function EmptyState(props: EmptyStateProps): React.JSX.Element;
|
|
|
967
1096
|
/**
|
|
968
1097
|
* Shared form-field chrome (label, hint, error, required asterisk) that wraps ANY control.
|
|
969
1098
|
*
|
|
970
|
-
* `Field`
|
|
971
|
-
*
|
|
972
|
-
*
|
|
973
|
-
*
|
|
974
|
-
*
|
|
1099
|
+
* `Field` renders the label + your `children` + a single hint/error line, reusing the exact
|
|
1100
|
+
* `.twc-field` markup Input/Select inline so every field looks identical. When `children` is a
|
|
1101
|
+
* SINGLE element, Field auto-wires it: it sets `aria-describedby` (merged with any the child
|
|
1102
|
+
* already has) to the hint/error id (`` `${id}-desc` ``) and `aria-invalid` when `error` is
|
|
1103
|
+
* present (never clobbering a child's explicit `aria-invalid`). Multiple/fragment/string children
|
|
1104
|
+
* keep manual wiring. `error` replaces `hint` when both are given (error wins).
|
|
975
1105
|
*
|
|
976
1106
|
* @example
|
|
977
1107
|
* <Field label="Email" hint="We never share it." htmlFor="email" id="email-field">
|
|
978
|
-
* <input id="email"
|
|
1108
|
+
* <input id="email" />
|
|
979
1109
|
* </Field>
|
|
980
1110
|
*/
|
|
981
1111
|
interface FieldProps extends Omit<React.HTMLAttributes<HTMLDivElement>, "id"> {
|
|
@@ -1015,7 +1145,7 @@ interface FileUploadProps extends Omit<React.HTMLAttributes<HTMLDivElement>, "on
|
|
|
1015
1145
|
multiple?: boolean;
|
|
1016
1146
|
disabled?: boolean;
|
|
1017
1147
|
/** Color intent for the focus/open accent. @default "primary" */
|
|
1018
|
-
tone?:
|
|
1148
|
+
tone?: Tone;
|
|
1019
1149
|
/** Field label rendered above the dropzone. */
|
|
1020
1150
|
label?: React.ReactNode;
|
|
1021
1151
|
/** Hint line under the prompt (defaults to the accept types). */
|
|
@@ -1028,6 +1158,12 @@ interface FileUploadProps extends Omit<React.HTMLAttributes<HTMLDivElement>, "on
|
|
|
1028
1158
|
value?: File[];
|
|
1029
1159
|
/** Uncontrolled initial file list. @default [] */
|
|
1030
1160
|
defaultValue?: File[];
|
|
1161
|
+
/** Max size per file in bytes; larger files are rejected (drag + browse). */
|
|
1162
|
+
maxSize?: number;
|
|
1163
|
+
/** Max number of files retained (multiple mode); extra files are rejected. */
|
|
1164
|
+
maxFiles?: number;
|
|
1165
|
+
/** Called with the files that failed validation: `{ file, reason }` where reason is "type" | "size" | "count". */
|
|
1166
|
+
onReject?: (rejections: Array<{ file: File; reason: "type" | "size" | "count" }>) => void;
|
|
1031
1167
|
onChange?: (files: File[]) => void;
|
|
1032
1168
|
}
|
|
1033
1169
|
|
|
@@ -1045,7 +1181,7 @@ interface IconButtonProps extends React.ButtonHTMLAttributes<HTMLButtonElement>
|
|
|
1045
1181
|
variant?: "solid" | "soft" | "outline" | "ghost";
|
|
1046
1182
|
/** Color/intent, orthogonal to `variant` (mirrors Button). A destructive icon button is
|
|
1047
1183
|
* `tone="danger"` with any variant. @default "primary" */
|
|
1048
|
-
tone?:
|
|
1184
|
+
tone?: ActionTone;
|
|
1049
1185
|
/** Control size; "xs" (~26px) is smaller than "sm". @default "md" */
|
|
1050
1186
|
size?: "xs" | "sm" | "md" | "lg";
|
|
1051
1187
|
/** Fully rounded (circular). @default false */
|
|
@@ -1073,12 +1209,19 @@ interface InputProps extends Omit<React.InputHTMLAttributes<HTMLInputElement>, "
|
|
|
1073
1209
|
/** Control size. @default "md" */
|
|
1074
1210
|
size?: "sm" | "md" | "lg";
|
|
1075
1211
|
/** Color intent for the focus/open accent. @default "primary" */
|
|
1076
|
-
tone?:
|
|
1077
|
-
/** Icon node inside the field, leading edge
|
|
1212
|
+
tone?: Tone;
|
|
1213
|
+
/** Icon-only node inside the field, leading edge — for a bordered text addon use `leftAddon`. */
|
|
1078
1214
|
leftIcon?: React.ReactNode;
|
|
1079
1215
|
/** Optional suffix icon/node inside the field, trailing edge. For `type="password"`, omitting this
|
|
1080
|
-
* shows a built-in reveal/hide eye toggle; providing `rightIcon` replaces it.
|
|
1216
|
+
* shows a built-in reveal/hide eye toggle; providing `rightIcon` replaces it. Icon-only — for a
|
|
1217
|
+
* bordered text addon use `rightAddon`. */
|
|
1081
1218
|
rightIcon?: React.ReactNode;
|
|
1219
|
+
/** Bordered text addon flush against the leading edge (e.g. `https://`, `@`) — distinct from the inline `leftIcon`. */
|
|
1220
|
+
leftAddon?: React.ReactNode;
|
|
1221
|
+
/** Bordered text addon flush against the trailing edge (e.g. `.00`, `kg`, `%`). */
|
|
1222
|
+
rightAddon?: React.ReactNode;
|
|
1223
|
+
/** With `maxLength`, render a live `current / max` character counter on the hint/error line; danger-toned near the limit. @default false */
|
|
1224
|
+
showCount?: boolean;
|
|
1082
1225
|
}
|
|
1083
1226
|
|
|
1084
1227
|
declare function Input(props: InputProps): React.JSX.Element;
|
|
@@ -1088,6 +1231,8 @@ interface KanbanColumn {
|
|
|
1088
1231
|
id: string;
|
|
1089
1232
|
/** Column heading. */
|
|
1090
1233
|
title: React.ReactNode;
|
|
1234
|
+
/** Accessible name for the column group — use when `title` is a non-string node. Falls back to a string title, then the id. */
|
|
1235
|
+
ariaLabel?: string;
|
|
1091
1236
|
/** Dot color for the heading. */
|
|
1092
1237
|
color?: string;
|
|
1093
1238
|
}
|
|
@@ -1098,6 +1243,8 @@ interface KanbanCard {
|
|
|
1098
1243
|
column: string;
|
|
1099
1244
|
title?: React.ReactNode;
|
|
1100
1245
|
description?: React.ReactNode;
|
|
1246
|
+
/** Accessible name for the card — use when the card content is graphical/icon-only. Falls back to a string title, then "Card". */
|
|
1247
|
+
ariaLabel?: string;
|
|
1101
1248
|
/** Small uppercase tag chips. */
|
|
1102
1249
|
tags?: React.ReactNode[];
|
|
1103
1250
|
/** Footer node (e.g. an Avatar / due date). */
|
|
@@ -1124,6 +1271,8 @@ interface KanbanProps extends React.HTMLAttributes<HTMLDivElement> {
|
|
|
1124
1271
|
onCardMove?: (cardId: string, toColumn: string, nextCards: KanbanCard[]) => void;
|
|
1125
1272
|
/** Custom card renderer. */
|
|
1126
1273
|
renderCard?: (card: KanbanCard) => React.ReactNode;
|
|
1274
|
+
/** Accessible name for each card — supply this when `renderCard` produces graphical/icon-only content; falls back to a string title or "Card". */
|
|
1275
|
+
getCardLabel?: (card: KanbanCard) => string;
|
|
1127
1276
|
}
|
|
1128
1277
|
|
|
1129
1278
|
declare function Kanban(props: KanbanProps): React.JSX.Element;
|
|
@@ -1141,7 +1290,7 @@ interface ListItemData {
|
|
|
1141
1290
|
onClick?: (e: React.MouseEvent) => void;
|
|
1142
1291
|
/** Makes the row a link. */
|
|
1143
1292
|
href?: string;
|
|
1144
|
-
/** Highlight as selected. */
|
|
1293
|
+
/** Highlight as selected — also sets `aria-current="page"` on link/button rows. */
|
|
1145
1294
|
active?: boolean;
|
|
1146
1295
|
}
|
|
1147
1296
|
|
|
@@ -1155,6 +1304,8 @@ interface ListProps extends React.HTMLAttributes<HTMLUListElement> {
|
|
|
1155
1304
|
items: ListItemData[];
|
|
1156
1305
|
/** Drop the card chrome (borderless, transparent). @default false */
|
|
1157
1306
|
plain?: boolean;
|
|
1307
|
+
/** Shown as a centered zero-state row when `items` is empty. @default "Nothing here yet" */
|
|
1308
|
+
emptyMessage?: React.ReactNode;
|
|
1158
1309
|
}
|
|
1159
1310
|
|
|
1160
1311
|
declare function List(props: ListProps): React.JSX.Element;
|
|
@@ -1175,7 +1326,7 @@ interface MultiSelectProps extends Omit<React.InputHTMLAttributes<HTMLInputEleme
|
|
|
1175
1326
|
/** Control height preset, matching Select/Combobox. @default "md" */
|
|
1176
1327
|
size?: "sm" | "md" | "lg";
|
|
1177
1328
|
/** Color intent for the focus/open accent. @default "primary" */
|
|
1178
|
-
tone?:
|
|
1329
|
+
tone?: Tone;
|
|
1179
1330
|
placeholder?: string;
|
|
1180
1331
|
/** Options — strings, {value,label,description}, or {group,options} groups. */
|
|
1181
1332
|
options: Array<string | MultiSelectOption | MultiSelectGroup>;
|
|
@@ -1183,6 +1334,7 @@ interface MultiSelectProps extends Omit<React.InputHTMLAttributes<HTMLInputEleme
|
|
|
1183
1334
|
value?: string[];
|
|
1184
1335
|
/** Uncontrolled initial values. */
|
|
1185
1336
|
defaultValue?: string[];
|
|
1337
|
+
/** Called with the full array of selected values (empty array when none/cleared). */
|
|
1186
1338
|
onChange?: (values: string[]) => void;
|
|
1187
1339
|
/** Show a clear-all (×) affix when at least one value is selected. @default false */
|
|
1188
1340
|
clearable?: boolean;
|
|
@@ -1195,24 +1347,27 @@ interface MultiSelectProps extends Omit<React.InputHTMLAttributes<HTMLInputEleme
|
|
|
1195
1347
|
portal?: boolean;
|
|
1196
1348
|
/** Minimum popover width in px when portaled (useful when the control is narrow). @default 0 */
|
|
1197
1349
|
minWidth?: number;
|
|
1350
|
+
/** Show a loading row instead of the option list / empty state. @default false */
|
|
1351
|
+
loading?: boolean;
|
|
1352
|
+
/** Text shown when no options match. @default "No results found" */
|
|
1353
|
+
emptyText?: string;
|
|
1354
|
+
/** Name for hidden form fields (one per selected value) for native form submission. */
|
|
1355
|
+
name?: string;
|
|
1356
|
+
/** Cap the number of selectable values; once reached, unselected options become disabled. */
|
|
1357
|
+
max?: number;
|
|
1358
|
+
/** Collapse chips after N into a "+K more" pill. */
|
|
1359
|
+
maxTagCount?: number;
|
|
1198
1360
|
/** Composed with the field's open-on-focus behavior — your handler runs first. */
|
|
1199
1361
|
onFocus?: React.FocusEventHandler<HTMLInputElement>;
|
|
1200
1362
|
/** Composed with the field's keyboard navigation (Arrows/Enter/Escape/Backspace) — your handler runs first; call `event.preventDefault()` to suppress it. */
|
|
1201
1363
|
onKeyDown?: React.KeyboardEventHandler<HTMLInputElement>;
|
|
1202
1364
|
}
|
|
1203
1365
|
|
|
1204
|
-
|
|
1205
|
-
|
|
1206
|
-
label: string;
|
|
1207
|
-
/** Optional second line shown under the label. */
|
|
1208
|
-
description?: string;
|
|
1209
|
-
}
|
|
1366
|
+
/** Alias of the shared {@link Option} type (kept for backward-compatible imports). */
|
|
1367
|
+
type MultiSelectOption = Option;
|
|
1210
1368
|
|
|
1211
|
-
/**
|
|
1212
|
-
|
|
1213
|
-
group: string;
|
|
1214
|
-
options: Array<string | MultiSelectOption>;
|
|
1215
|
-
}
|
|
1369
|
+
/** Alias of the shared {@link OptionGroup} type (kept for backward-compatible imports). */
|
|
1370
|
+
type MultiSelectGroup = OptionGroup;
|
|
1216
1371
|
|
|
1217
1372
|
declare function MultiSelect(props: MultiSelectProps): React.JSX.Element;
|
|
1218
1373
|
|
|
@@ -1246,6 +1401,12 @@ interface NavbarProps extends React.HTMLAttributes<HTMLElement> {
|
|
|
1246
1401
|
sticky?: boolean;
|
|
1247
1402
|
/** Hamburger handler shown on small screens. */
|
|
1248
1403
|
onMenuClick?: () => void;
|
|
1404
|
+
/** Drives the hamburger's `aria-expanded` and its "Open menu"/"Close menu" accessible name. */
|
|
1405
|
+
menuOpen?: boolean;
|
|
1406
|
+
/** Id of the menu/drawer the hamburger controls (`aria-controls`). */
|
|
1407
|
+
menuControls?: string;
|
|
1408
|
+
/** Accessible name for the links `<nav>` landmark. @default "Primary" */
|
|
1409
|
+
navLabel?: string;
|
|
1249
1410
|
}
|
|
1250
1411
|
|
|
1251
1412
|
declare function Navbar(props: NavbarProps): React.JSX.Element;
|
|
@@ -1268,12 +1429,14 @@ interface PaginationProps extends Omit<React.HTMLAttributes<HTMLElement>, "onCha
|
|
|
1268
1429
|
boundaries?: number;
|
|
1269
1430
|
/** @default "md" */
|
|
1270
1431
|
size?: "sm" | "md" | "lg";
|
|
1271
|
-
/** Show a "Go to" page input for jumping directly to a page. @deprecated
|
|
1432
|
+
/** Show a "Go to" page input for jumping directly to a page. @deprecated since 1.4, removed in 2.0 — use `showPageJumper`. @default false */
|
|
1272
1433
|
showJumper?: boolean;
|
|
1273
1434
|
/** Show a "Go to" page input for jumping directly to a page; preferred alias for `showJumper`. @default false */
|
|
1274
1435
|
showPageJumper?: boolean;
|
|
1275
1436
|
/** Label before the jump input. @default "Go to" */
|
|
1276
1437
|
jumperLabel?: React.ReactNode;
|
|
1438
|
+
/** Accessible label for each numbered page button (for i18n). @default (n) => `Page ${n}` */
|
|
1439
|
+
getPageLabel?: (page: number) => string;
|
|
1277
1440
|
}
|
|
1278
1441
|
|
|
1279
1442
|
declare function Pagination(props: PaginationProps): React.JSX.Element;
|
|
@@ -1308,8 +1471,9 @@ declare function Popover(props: PopoverProps): React.JSX.Element;
|
|
|
1308
1471
|
|
|
1309
1472
|
/**
|
|
1310
1473
|
* Linear progress bar — determinate or indeterminate, with semantic tones.
|
|
1311
|
-
* `className` and
|
|
1312
|
-
*
|
|
1474
|
+
* `className` and extra HTML attributes (`style`, `id`, handlers, …) land on the root
|
|
1475
|
+
* wrapper; `role="progressbar"` + `aria-value*` live on the inner track. `aria-label` /
|
|
1476
|
+
* `aria-labelledby` are forwarded onto that track so they actually name the bar.
|
|
1313
1477
|
*/
|
|
1314
1478
|
interface ProgressProps extends React.HTMLAttributes<HTMLDivElement> {
|
|
1315
1479
|
/** Current value. @default 0 */
|
|
@@ -1317,13 +1481,18 @@ interface ProgressProps extends React.HTMLAttributes<HTMLDivElement> {
|
|
|
1317
1481
|
/** Maximum value. @default 100 */
|
|
1318
1482
|
max?: number;
|
|
1319
1483
|
/** @default "primary" */
|
|
1320
|
-
tone?:
|
|
1484
|
+
tone?: BarTone;
|
|
1321
1485
|
/** @default "md" */
|
|
1322
1486
|
size?: "sm" | "md" | "lg";
|
|
1323
1487
|
/** Animate as an indeterminate bar (ignores value). */
|
|
1324
1488
|
indeterminate?: boolean;
|
|
1325
1489
|
/** Show a percentage label above the bar. */
|
|
1326
1490
|
showLabel?: boolean;
|
|
1491
|
+
/**
|
|
1492
|
+
* Visible label in the meta row that also names the progressbar (via `aria-labelledby`).
|
|
1493
|
+
* @default "Progress" (only rendered when `showLabel` or `label` is set)
|
|
1494
|
+
*/
|
|
1495
|
+
label?: React.ReactNode;
|
|
1327
1496
|
}
|
|
1328
1497
|
|
|
1329
1498
|
declare function Progress(props: ProgressProps): React.JSX.Element;
|
|
@@ -1338,35 +1507,95 @@ interface RadioProps extends Omit<React.InputHTMLAttributes<HTMLInputElement>, "
|
|
|
1338
1507
|
error?: React.ReactNode;
|
|
1339
1508
|
size?: "sm" | "md" | "lg";
|
|
1340
1509
|
/** Color intent. @default "primary" */
|
|
1341
|
-
tone?:
|
|
1510
|
+
tone?: Tone;
|
|
1342
1511
|
}
|
|
1343
1512
|
|
|
1344
1513
|
declare function Radio(props: RadioProps): React.JSX.Element;
|
|
1345
1514
|
|
|
1515
|
+
interface RadioGroupOption {
|
|
1516
|
+
/** Submitted value for this choice. */
|
|
1517
|
+
value: string;
|
|
1518
|
+
/** Visible label. */
|
|
1519
|
+
label?: React.ReactNode;
|
|
1520
|
+
/** Secondary text under the label. */
|
|
1521
|
+
description?: React.ReactNode;
|
|
1522
|
+
/** Disable just this option. */
|
|
1523
|
+
disabled?: boolean;
|
|
1524
|
+
}
|
|
1525
|
+
|
|
1526
|
+
/**
|
|
1527
|
+
* Grouped radios with one controlled value, a `role="radiogroup"` container, a hoisted
|
|
1528
|
+
* group label/hint/error, and a shared `name`. Provide choices via `options` or by passing
|
|
1529
|
+
* `<Radio>` children (their `name`/`checked`/`onChange` are injected). Native inputs give
|
|
1530
|
+
* roving tabindex + Arrow-key selection for free.
|
|
1531
|
+
*
|
|
1532
|
+
* @startingPoint section="Inputs" subtitle="Grouped radios with one value" viewport="700x220"
|
|
1533
|
+
*/
|
|
1534
|
+
interface RadioGroupProps extends Omit<React.HTMLAttributes<HTMLDivElement>, "onChange"> {
|
|
1535
|
+
/** Shared `name` for the radios (auto-generated when omitted). */
|
|
1536
|
+
name?: string;
|
|
1537
|
+
/** Controlled selected value. */
|
|
1538
|
+
value?: string;
|
|
1539
|
+
/** Uncontrolled initial value. */
|
|
1540
|
+
defaultValue?: string;
|
|
1541
|
+
/** Called with the newly-selected value. */
|
|
1542
|
+
onChange?: (value: string) => void;
|
|
1543
|
+
/** Choices (alternative to passing `<Radio>` children). */
|
|
1544
|
+
options?: RadioGroupOption[];
|
|
1545
|
+
/** `<Radio>` children (alternative to `options`); their group props are injected. */
|
|
1546
|
+
children?: React.ReactNode;
|
|
1547
|
+
/** Group label (rendered as the radiogroup's accessible name). */
|
|
1548
|
+
label?: React.ReactNode;
|
|
1549
|
+
/** Helper text below the group. */
|
|
1550
|
+
hint?: React.ReactNode;
|
|
1551
|
+
/** Error text below the group; sets `aria-invalid` and is announced once for the whole group. */
|
|
1552
|
+
error?: React.ReactNode;
|
|
1553
|
+
/** Lay the radios in a column or a wrapping row. @default "vertical" */
|
|
1554
|
+
orientation?: "vertical" | "horizontal";
|
|
1555
|
+
/** Disable every radio in the group. @default false */
|
|
1556
|
+
disabled?: boolean;
|
|
1557
|
+
/** Mark the group required (native `required` on the radios + `aria-required`). @default false */
|
|
1558
|
+
required?: boolean;
|
|
1559
|
+
/** Control size applied to each radio. @default "md" */
|
|
1560
|
+
size?: "sm" | "md" | "lg";
|
|
1561
|
+
/** Color intent applied to each radio. @default "primary" */
|
|
1562
|
+
tone?: Tone;
|
|
1563
|
+
}
|
|
1564
|
+
|
|
1565
|
+
declare function RadioGroup(props: RadioGroupProps): React.JSX.Element;
|
|
1566
|
+
|
|
1346
1567
|
/**
|
|
1347
1568
|
* Star rating — interactive (click/hover) or read-only display.
|
|
1348
1569
|
*
|
|
1349
1570
|
* @startingPoint section="Inputs" subtitle="Star rating" viewport="700x90"
|
|
1350
1571
|
*/
|
|
1351
1572
|
interface RatingProps extends Omit<React.HTMLAttributes<HTMLDivElement>, "onChange" | "defaultValue" | "color"> {
|
|
1352
|
-
/** Controlled value (0…count).
|
|
1573
|
+
/** Controlled value (0…count; 0 means "no rating"). A fractional value renders a partial
|
|
1574
|
+
* star fill (display) — interactive click/keyboard selection is integer-only. */
|
|
1353
1575
|
value?: number;
|
|
1354
|
-
/** Uncontrolled initial value. @default 0 */
|
|
1576
|
+
/** Uncontrolled initial value (0 means "no rating"). @default 0 */
|
|
1355
1577
|
defaultValue?: number;
|
|
1356
1578
|
/** Number of stars. @default 5 */
|
|
1357
1579
|
count?: number;
|
|
1358
1580
|
/** @default "md" */
|
|
1359
1581
|
size?: "sm" | "md" | "lg";
|
|
1360
1582
|
/** Color intent for filled stars. @default "warning" */
|
|
1361
|
-
tone?:
|
|
1583
|
+
tone?: Tone;
|
|
1362
1584
|
/** Explicit filled-star color; overrides `tone` when set. */
|
|
1363
1585
|
color?: string;
|
|
1364
|
-
/** Display only
|
|
1586
|
+
/** Display only — renders a single static value as `role="img"` named "<value> out of <count> stars"
|
|
1587
|
+
* (overridable via `aria-label`), not a radiogroup of radios. @default false */
|
|
1365
1588
|
readOnly?: boolean;
|
|
1366
1589
|
/** Disable all interaction and dim the control. @default false */
|
|
1367
1590
|
disabled?: boolean;
|
|
1368
|
-
/** Show the numeric value beside the stars. @default false */
|
|
1591
|
+
/** Show the numeric value beside the stars (clean integer, or one decimal for fractional). @default false */
|
|
1369
1592
|
showValue?: boolean;
|
|
1593
|
+
/** Allow clearing back to 0 — clicking the selected star, or pressing Delete/Backspace, resets to "no rating". @default true */
|
|
1594
|
+
clearable?: boolean;
|
|
1595
|
+
/** Custom formatter for the `showValue` badge and the read-only accessible label. Defaults to a clean integer, or one decimal for fractional values. */
|
|
1596
|
+
format?: (value: number) => React.ReactNode;
|
|
1597
|
+
/** Name for a hidden form field so the value participates in native form submission. */
|
|
1598
|
+
name?: string;
|
|
1370
1599
|
onChange?: (value: number) => void;
|
|
1371
1600
|
}
|
|
1372
1601
|
|
|
@@ -1385,7 +1614,7 @@ interface SelectProps extends Omit<React.HTMLAttributes<HTMLButtonElement>, "onC
|
|
|
1385
1614
|
required?: boolean;
|
|
1386
1615
|
size?: "sm" | "md" | "lg";
|
|
1387
1616
|
/** Color intent for the focus/open accent. @default "primary" */
|
|
1388
|
-
tone?:
|
|
1617
|
+
tone?: Tone;
|
|
1389
1618
|
placeholder?: string;
|
|
1390
1619
|
/** Placeholder for the in-popover search box. @default "Search…" */
|
|
1391
1620
|
searchPlaceholder?: string;
|
|
@@ -1414,20 +1643,21 @@ interface SelectProps extends Omit<React.HTMLAttributes<HTMLButtonElement>, "onC
|
|
|
1414
1643
|
portal?: boolean;
|
|
1415
1644
|
/** Minimum popover width in px when portaled (useful when the trigger is narrow). @default 0 */
|
|
1416
1645
|
minWidth?: number;
|
|
1646
|
+
/** Pin the popover to the trigger's width. Set false to size it to the widest option (clamped to the viewport). @default true */
|
|
1647
|
+
matchTriggerWidth?: boolean;
|
|
1648
|
+
/** Show a loading row instead of the option list / empty state (e.g. while fetching options). @default false */
|
|
1649
|
+
loading?: boolean;
|
|
1650
|
+
/** Text shown when no options match. @default "No results found" */
|
|
1651
|
+
emptyText?: string;
|
|
1652
|
+
/** Name for a hidden form field so the selected value participates in native form submission. */
|
|
1653
|
+
name?: string;
|
|
1417
1654
|
}
|
|
1418
1655
|
|
|
1419
|
-
|
|
1420
|
-
|
|
1421
|
-
label: string;
|
|
1422
|
-
/** Optional second line shown under the label. */
|
|
1423
|
-
description?: string;
|
|
1424
|
-
}
|
|
1656
|
+
/** Alias of the shared {@link Option} type (kept for backward-compatible imports). */
|
|
1657
|
+
type SelectOption = Option;
|
|
1425
1658
|
|
|
1426
|
-
/**
|
|
1427
|
-
|
|
1428
|
-
group: string;
|
|
1429
|
-
options: Array<string | SelectOption>;
|
|
1430
|
-
}
|
|
1659
|
+
/** Alias of the shared {@link OptionGroup} type (kept for backward-compatible imports). */
|
|
1660
|
+
type SelectGroup = OptionGroup;
|
|
1431
1661
|
|
|
1432
1662
|
declare function Select(props: SelectProps): React.JSX.Element;
|
|
1433
1663
|
|
|
@@ -1448,6 +1678,7 @@ interface SidebarItem {
|
|
|
1448
1678
|
/**
|
|
1449
1679
|
* Collapsible side navigation — brand header, grouped nav items with icons and
|
|
1450
1680
|
* badges, an optional footer, and a collapse toggle (icon-only when collapsed).
|
|
1681
|
+
* Set `overlay` for a mobile off-canvas drawer (backdrop, focus trap, Escape-to-close).
|
|
1451
1682
|
*
|
|
1452
1683
|
* @startingPoint section="Layout" subtitle="Collapsible side navigation" viewport="280x520"
|
|
1453
1684
|
*/
|
|
@@ -1463,12 +1694,30 @@ interface SidebarProps extends React.HTMLAttributes<HTMLElement> {
|
|
|
1463
1694
|
/** Show the collapse toggle. @default true */
|
|
1464
1695
|
collapsible?: boolean;
|
|
1465
1696
|
onCollapsedChange?: (collapsed: boolean) => void;
|
|
1697
|
+
/**
|
|
1698
|
+
* Render as an off-canvas drawer instead of an in-flow rail: a fixed slide-over
|
|
1699
|
+
* panel behind a dismissable backdrop, portaled to `document.body`, with a focus
|
|
1700
|
+
* trap, Escape-to-close, and body-scroll lock. Drive visibility with
|
|
1701
|
+
* `open`/`defaultOpen`/`onOpenChange`. For a responsive layout, render the rail on
|
|
1702
|
+
* desktop and the overlay on mobile. @default false
|
|
1703
|
+
*/
|
|
1704
|
+
overlay?: boolean;
|
|
1705
|
+
/** Controlled open state of the overlay drawer (only when `overlay`). */
|
|
1706
|
+
open?: boolean;
|
|
1707
|
+
/** Uncontrolled initial open state of the overlay drawer. @default false */
|
|
1708
|
+
defaultOpen?: boolean;
|
|
1709
|
+
/** Called when the overlay drawer requests open/close (backdrop, Escape). */
|
|
1710
|
+
onOpenChange?: (open: boolean) => void;
|
|
1711
|
+
/** Accessible name for the inner `<nav>` landmark (and the overlay dialog). @default "Main" */
|
|
1712
|
+
navLabel?: string;
|
|
1466
1713
|
}
|
|
1467
1714
|
|
|
1468
1715
|
declare function Sidebar(props: SidebarProps): React.JSX.Element;
|
|
1469
1716
|
|
|
1470
1717
|
/**
|
|
1471
|
-
* Shimmering placeholder shown while content loads.
|
|
1718
|
+
* Shimmering placeholder shown while content loads. Decorative by default — the
|
|
1719
|
+
* placeholder gets `aria-hidden="true"` so screen readers skip it. Pass `label` to
|
|
1720
|
+
* instead announce loading via a `role="status"` live region.
|
|
1472
1721
|
*/
|
|
1473
1722
|
interface SkeletonProps extends React.HTMLAttributes<HTMLSpanElement> {
|
|
1474
1723
|
/** Shape preset: "text" line(s), "circle" (1:1 aspect, full radius), or "rect" block (--radius-md). @default "text" */
|
|
@@ -1479,6 +1728,11 @@ interface SkeletonProps extends React.HTMLAttributes<HTMLSpanElement> {
|
|
|
1479
1728
|
height?: string | number;
|
|
1480
1729
|
/** For text variant: number of lines (last is shortened). @default 1 */
|
|
1481
1730
|
lines?: number;
|
|
1731
|
+
/**
|
|
1732
|
+
* When set, announces loading via `role="status"` + `aria-live="polite"` + `aria-busy="true"`
|
|
1733
|
+
* plus visually-hidden text (e.g. "Loading…"); otherwise the placeholder is `aria-hidden="true"`.
|
|
1734
|
+
*/
|
|
1735
|
+
label?: string;
|
|
1482
1736
|
}
|
|
1483
1737
|
|
|
1484
1738
|
declare function Skeleton(props: SkeletonProps): React.JSX.Element;
|
|
@@ -1496,26 +1750,36 @@ interface SliderProps extends Omit<React.HTMLAttributes<HTMLDivElement>, "onChan
|
|
|
1496
1750
|
hint?: React.ReactNode;
|
|
1497
1751
|
/** Error message shown below the track — turns it red (sets `aria-invalid`) and replaces the hint. */
|
|
1498
1752
|
error?: React.ReactNode;
|
|
1499
|
-
/** Controlled value. */
|
|
1500
|
-
value?: number;
|
|
1501
|
-
/** Uncontrolled initial value. @default 0 */
|
|
1502
|
-
defaultValue?: number;
|
|
1753
|
+
/** Controlled value. A `[number, number]` tuple enables dual-thumb range mode. Clamped into [min, max]. */
|
|
1754
|
+
value?: number | [number, number];
|
|
1755
|
+
/** Uncontrolled initial value (a tuple enables range mode). Clamped into [min, max]. @default 0 */
|
|
1756
|
+
defaultValue?: number | [number, number];
|
|
1757
|
+
/** Force dual-thumb range mode even without a tuple value (defaults the range to [min, max]). @default false */
|
|
1758
|
+
range?: boolean;
|
|
1503
1759
|
/** @default 0 */
|
|
1504
1760
|
min?: number;
|
|
1505
1761
|
/** @default 100 */
|
|
1506
1762
|
max?: number;
|
|
1507
1763
|
/** @default 1 */
|
|
1508
1764
|
step?: number;
|
|
1765
|
+
/** Large-step increment for PageUp/PageDown. @default Math.max(step, (max - min) / 10) */
|
|
1766
|
+
pageStep?: number;
|
|
1767
|
+
/** Decimal places for the default display + aria value; derived from `step` when unset. */
|
|
1768
|
+
precision?: number;
|
|
1509
1769
|
disabled?: boolean;
|
|
1510
1770
|
/** Show the current value at the top-right. @default true */
|
|
1511
1771
|
showValue?: boolean;
|
|
1512
1772
|
/** Render step ticks along the rail. @default false */
|
|
1513
1773
|
showTicks?: boolean;
|
|
1514
1774
|
/** Color intent. @default "primary" */
|
|
1515
|
-
tone?:
|
|
1516
|
-
/** Format the displayed value (label + bubble). */
|
|
1775
|
+
tone?: Tone;
|
|
1776
|
+
/** Format the displayed value (label + bubble). If it returns a node, pair it with `getAriaValueText`. */
|
|
1517
1777
|
formatValue?: (value: number) => React.ReactNode;
|
|
1518
|
-
|
|
1778
|
+
/** Human-readable value for assistive tech (`aria-valuetext`) — use when `formatValue` returns a node. */
|
|
1779
|
+
getAriaValueText?: (value: number) => string;
|
|
1780
|
+
/** Name for hidden form field(s) so the value participates in native form submission. */
|
|
1781
|
+
name?: string;
|
|
1782
|
+
onChange?: (value: number | [number, number]) => void;
|
|
1519
1783
|
}
|
|
1520
1784
|
|
|
1521
1785
|
declare function Slider(props: SliderProps): React.JSX.Element;
|
|
@@ -1527,9 +1791,9 @@ interface SpinnerProps extends React.HTMLAttributes<HTMLSpanElement> {
|
|
|
1527
1791
|
/** @default "md" */
|
|
1528
1792
|
size?: "sm" | "md" | "lg" | "xl";
|
|
1529
1793
|
/** Color. Wins over `tone` when both are set. @default "current" — inherits currentColor (visible inside buttons, themed). */
|
|
1530
|
-
color?: "current" |
|
|
1531
|
-
/** Color. @deprecated
|
|
1532
|
-
tone?: "current" |
|
|
1794
|
+
color?: "current" | Tone | "white";
|
|
1795
|
+
/** Color. @deprecated since 1.4, removed in 2.0 — use `color`. @default "current" — inherits currentColor (visible inside buttons, themed). */
|
|
1796
|
+
tone?: "current" | Tone | "white";
|
|
1533
1797
|
/** Accessible label. @default "Loading" */
|
|
1534
1798
|
label?: string;
|
|
1535
1799
|
}
|
|
@@ -1584,7 +1848,7 @@ interface StepperProps extends React.HTMLAttributes<HTMLDivElement> {
|
|
|
1584
1848
|
/** @default "horizontal" */
|
|
1585
1849
|
orientation?: "horizontal" | "vertical";
|
|
1586
1850
|
/** Color intent. @default "primary" */
|
|
1587
|
-
tone?:
|
|
1851
|
+
tone?: Tone;
|
|
1588
1852
|
/** Allow clicking completed/active steps. @default false */
|
|
1589
1853
|
clickable?: boolean;
|
|
1590
1854
|
/** Fired when a clickable step is clicked. */
|
|
@@ -1605,7 +1869,7 @@ interface SwitchProps extends Omit<React.InputHTMLAttributes<HTMLInputElement>,
|
|
|
1605
1869
|
error?: React.ReactNode;
|
|
1606
1870
|
size?: "sm" | "md" | "lg";
|
|
1607
1871
|
/** Color intent. @default "primary" */
|
|
1608
|
-
tone?:
|
|
1872
|
+
tone?: Tone;
|
|
1609
1873
|
}
|
|
1610
1874
|
|
|
1611
1875
|
declare function Switch(props: SwitchProps): React.JSX.Element;
|
|
@@ -1655,6 +1919,16 @@ interface TableProps<T = any> extends React.HTMLAttributes<HTMLDivElement> {
|
|
|
1655
1919
|
stickyHeader?: boolean;
|
|
1656
1920
|
/** Cap the table height and give it its own vertical scroll area (CSS length or number of px). */
|
|
1657
1921
|
maxHeight?: number | string;
|
|
1922
|
+
/** Show shimmering skeleton rows instead of data (e.g. while fetching); sets `aria-busy`. @default false */
|
|
1923
|
+
loading?: boolean;
|
|
1924
|
+
/** Number of skeleton rows to render while `loading`. @default 8 */
|
|
1925
|
+
loadingRows?: number;
|
|
1926
|
+
/** Rendered as a single full-width row when `rows` is empty. @default "No data" */
|
|
1927
|
+
emptyMessage?: React.ReactNode;
|
|
1928
|
+
/** Accessible name applied to the `<table>` (not the wrapper). A raw `aria-label` prop takes precedence. */
|
|
1929
|
+
ariaLabel?: string;
|
|
1930
|
+
/** Renders a visually-hidden `<caption>` naming the table. */
|
|
1931
|
+
caption?: React.ReactNode;
|
|
1658
1932
|
}
|
|
1659
1933
|
|
|
1660
1934
|
interface TableColumn<T = any> {
|
|
@@ -1688,7 +1962,7 @@ interface TabsProps extends Omit<React.HTMLAttributes<HTMLDivElement>, "onChange
|
|
|
1688
1962
|
/** @default "line" */
|
|
1689
1963
|
variant?: "line" | "pill";
|
|
1690
1964
|
/** Color intent. @default "primary" */
|
|
1691
|
-
tone?:
|
|
1965
|
+
tone?: Tone;
|
|
1692
1966
|
/** Layout axis. Vertical stacks the tablist with the indicator on its trailing edge and the panel beside it; ArrowUp/ArrowDown navigate. @default "horizontal" */
|
|
1693
1967
|
orientation?: "horizontal" | "vertical";
|
|
1694
1968
|
}
|
|
@@ -1700,8 +1974,10 @@ interface TabItem {
|
|
|
1700
1974
|
label: React.ReactNode;
|
|
1701
1975
|
/** Optional leading icon. */
|
|
1702
1976
|
icon?: React.ReactNode;
|
|
1703
|
-
/** Optional count pill. */
|
|
1704
|
-
count?:
|
|
1977
|
+
/** Optional count pill (e.g. `12`, `"99+"`, `"1.2k"`, or an element). Renders whenever `count != null` — pass `undefined` to hide a `0`. */
|
|
1978
|
+
count?: React.ReactNode;
|
|
1979
|
+
/** Disable the tab: not selectable via click or keyboard; dimmed and `aria-disabled`. */
|
|
1980
|
+
disabled?: boolean;
|
|
1705
1981
|
/** Panel content rendered when active (omit for nav-only tabs). */
|
|
1706
1982
|
content?: React.ReactNode;
|
|
1707
1983
|
}
|
|
@@ -1714,12 +1990,14 @@ declare function Tabs(props: TabsProps): React.JSX.Element;
|
|
|
1714
1990
|
interface TagProps extends React.HTMLAttributes<HTMLSpanElement> {
|
|
1715
1991
|
/** Show a remove (×) button and handle its click. */
|
|
1716
1992
|
onRemove?: (e: React.MouseEvent<HTMLButtonElement>) => void;
|
|
1993
|
+
/** Accessible label for the remove (×) button. Defaults to `Remove {children}` when children is a string, else "Remove". */
|
|
1994
|
+
removeLabel?: string;
|
|
1717
1995
|
/** Optional leading icon. */
|
|
1718
1996
|
leftIcon?: React.ReactNode;
|
|
1719
1997
|
/** Fill style. @default "soft" */
|
|
1720
1998
|
variant?: "soft" | "solid" | "outline";
|
|
1721
1999
|
/** Color intent. @default "neutral" */
|
|
1722
|
-
tone?:
|
|
2000
|
+
tone?: Tone;
|
|
1723
2001
|
children?: React.ReactNode;
|
|
1724
2002
|
}
|
|
1725
2003
|
|
|
@@ -1740,10 +2018,21 @@ interface TextareaProps extends React.TextareaHTMLAttributes<HTMLTextAreaElement
|
|
|
1740
2018
|
/** Control size — same padding steps as Input. @default "md" */
|
|
1741
2019
|
size?: "sm" | "md" | "lg";
|
|
1742
2020
|
/** Color intent for the focus/open accent. @default "primary" */
|
|
1743
|
-
tone?:
|
|
1744
|
-
|
|
1745
|
-
|
|
1746
|
-
|
|
2021
|
+
tone?: Tone;
|
|
2022
|
+
/** Grow to fit content between `minRows` and `maxRows` (resize handle hidden). @default false */
|
|
2023
|
+
autosize?: boolean;
|
|
2024
|
+
/** Minimum rows when `autosize` (falls back to `rows`). */
|
|
2025
|
+
minRows?: number;
|
|
2026
|
+
/** Maximum rows when `autosize`; taller content scrolls. */
|
|
2027
|
+
maxRows?: number;
|
|
2028
|
+
/** With `maxLength`, render a live `current / max` character counter; danger-toned near the limit. @default false */
|
|
2029
|
+
showCount?: boolean;
|
|
2030
|
+
}
|
|
2031
|
+
|
|
2032
|
+
/** Forwards `ref` to the inner `<textarea>`. */
|
|
2033
|
+
declare const Textarea: React.ForwardRefExoticComponent<
|
|
2034
|
+
TextareaProps & React.RefAttributes<HTMLTextAreaElement>
|
|
2035
|
+
>;
|
|
1747
2036
|
|
|
1748
2037
|
interface TimelineItem {
|
|
1749
2038
|
/** Event title. */
|
|
@@ -1755,7 +2044,7 @@ interface TimelineItem {
|
|
|
1755
2044
|
/** Icon inside the node dot. */
|
|
1756
2045
|
icon?: React.ReactNode;
|
|
1757
2046
|
/** Node color. */
|
|
1758
|
-
tone?:
|
|
2047
|
+
tone?: BarTone;
|
|
1759
2048
|
}
|
|
1760
2049
|
|
|
1761
2050
|
/**
|
|
@@ -1776,14 +2065,16 @@ declare function Timeline(props: TimelineProps): React.JSX.Element;
|
|
|
1776
2065
|
*/
|
|
1777
2066
|
interface ToastProps extends Omit<React.HTMLAttributes<HTMLDivElement>, "title"> {
|
|
1778
2067
|
/** Semantic tone. `"neutral"` is an alias for `"default"` (matches Badge's vocabulary). @default "default" */
|
|
1779
|
-
tone?:
|
|
2068
|
+
tone?: ToastTone;
|
|
1780
2069
|
/** Bold heading. */
|
|
1781
2070
|
title?: React.ReactNode;
|
|
1782
2071
|
/** Override the tone icon. */
|
|
1783
2072
|
icon?: React.ReactNode;
|
|
1784
|
-
/**
|
|
2073
|
+
/** Renders the close button AND is the dismissal handler. The Toast is controlled — it never
|
|
2074
|
+
* removes itself, so BOTH the close button and `duration` auto-dismiss require this. */
|
|
1785
2075
|
onClose?: () => void;
|
|
1786
|
-
/** Auto-dismiss after this many ms (paused on hover/focus). `
|
|
2076
|
+
/** Auto-dismiss after this many ms (paused on hover/focus). **No-op unless `onClose` is provided** —
|
|
2077
|
+
* the timer's only action is to call `onClose`. `0`/`Infinity` keeps it open. @default 4500 */
|
|
1787
2078
|
duration?: number;
|
|
1788
2079
|
children?: React.ReactNode;
|
|
1789
2080
|
}
|
|
@@ -1802,7 +2093,7 @@ declare function ToastViewport(props: ToastViewportProps): React.JSX.Element;
|
|
|
1802
2093
|
/** A single toast's options when pushed imperatively. */
|
|
1803
2094
|
interface ToastOptions {
|
|
1804
2095
|
/** @default "default" */
|
|
1805
|
-
tone?:
|
|
2096
|
+
tone?: ToastTone;
|
|
1806
2097
|
/** Bold heading. */
|
|
1807
2098
|
title?: React.ReactNode;
|
|
1808
2099
|
/** Body/description content. */
|
|
@@ -1921,6 +2212,19 @@ interface AppShellProps extends Omit<React.HTMLAttributes<HTMLDivElement>, "chil
|
|
|
1921
2212
|
height?: string | number;
|
|
1922
2213
|
/** Pad the scrollable content region. @default true */
|
|
1923
2214
|
padded?: boolean;
|
|
2215
|
+
/** Id for the `<main>` content region and the skip-link target. @default "twc-main" */
|
|
2216
|
+
mainId?: string;
|
|
2217
|
+
/** Label for the visually-hidden-until-focused skip-to-content link (the shell's first child). Pass `false`/`null` to opt out. @default "Skip to content" */
|
|
2218
|
+
skipLinkLabel?: React.ReactNode | false;
|
|
2219
|
+
/**
|
|
2220
|
+
* Open state of the sidebar's off-canvas drawer on mobile. Providing this (or
|
|
2221
|
+
* `onSidebarOpenChange`) makes the shell forward `overlay`/`open`/`onOpenChange`
|
|
2222
|
+
* to the `sidebar` element, so it renders as a drawer. Respects any of those
|
|
2223
|
+
* props the sidebar already sets.
|
|
2224
|
+
*/
|
|
2225
|
+
sidebarOpen?: boolean;
|
|
2226
|
+
/** Called when the sidebar drawer requests open/close (backdrop, Escape) — wire a `Navbar`'s `onMenuClick` to `() => onSidebarOpenChange(true)`. */
|
|
2227
|
+
onSidebarOpenChange?: (open: boolean) => void;
|
|
1924
2228
|
}
|
|
1925
2229
|
|
|
1926
2230
|
declare function AppShell(props: AppShellProps): React.JSX.Element;
|
|
@@ -1928,7 +2232,7 @@ declare function AppShell(props: AppShellProps): React.JSX.Element;
|
|
|
1928
2232
|
/** Generic, token-styled element — the building block for non-flex layout. */
|
|
1929
2233
|
interface BoxProps extends React.HTMLAttributes<HTMLElement> {
|
|
1930
2234
|
/** Element/tag to render. @default "div" */
|
|
1931
|
-
as?:
|
|
2235
|
+
as?: PolymorphicAs;
|
|
1932
2236
|
/** Link destination — only used with as="a"; scheme-sanitized (javascript:/data:/vbscript: render without href). */
|
|
1933
2237
|
href?: string;
|
|
1934
2238
|
/** Anchor target — only used with as="a" (e.g. "_blank"). */
|
|
@@ -1966,7 +2270,7 @@ declare function Box(props: BoxProps): React.JSX.Element;
|
|
|
1966
2270
|
/** Centered, max-width content wrapper with responsive horizontal padding. */
|
|
1967
2271
|
interface ContainerProps extends React.HTMLAttributes<HTMLElement> {
|
|
1968
2272
|
/** Element/tag to render. @default "div" */
|
|
1969
|
-
as?:
|
|
2273
|
+
as?: PolymorphicAs;
|
|
1970
2274
|
/** Link destination — only used with as="a"; scheme-sanitized (javascript:/data:/vbscript: render without href). */
|
|
1971
2275
|
href?: string;
|
|
1972
2276
|
/** Anchor target — only used with as="a" (e.g. "_blank"). */
|
|
@@ -1981,24 +2285,35 @@ interface ContainerProps extends React.HTMLAttributes<HTMLElement> {
|
|
|
1981
2285
|
|
|
1982
2286
|
declare function Container(props: ContainerProps): React.JSX.Element;
|
|
1983
2287
|
|
|
2288
|
+
/** Responsive column counts per breakpoint (base + sm/md/lg/xl at 640/768/1024/1280px). */
|
|
2289
|
+
type ResponsiveColumns = { base?: number; sm?: number; md?: number; lg?: number; xl?: number };
|
|
2290
|
+
|
|
1984
2291
|
/** CSS grid primitive — fixed columns or a responsive auto-fill grid. */
|
|
1985
2292
|
interface GridProps extends React.HTMLAttributes<HTMLElement> {
|
|
1986
2293
|
/** Element/tag to render. @default "div" */
|
|
1987
|
-
as?:
|
|
2294
|
+
as?: PolymorphicAs;
|
|
1988
2295
|
/** Link destination — only used with as="a"; scheme-sanitized (javascript:/data:/vbscript: render without href). */
|
|
1989
2296
|
href?: string;
|
|
1990
2297
|
/** Anchor target — only used with as="a" (e.g. "_blank"). */
|
|
1991
2298
|
target?: React.HTMLAttributeAnchorTarget;
|
|
1992
2299
|
/** Anchor rel — only used with as="a"; pair "noopener noreferrer" with target="_blank". */
|
|
1993
2300
|
rel?: string;
|
|
1994
|
-
/** Fixed
|
|
1995
|
-
columns?: number;
|
|
2301
|
+
/** Fixed column count, or a responsive object `{ base, sm, md, lg, xl }` (ignored when `minChildWidth` is set). */
|
|
2302
|
+
columns?: number | ResponsiveColumns;
|
|
1996
2303
|
/** Responsive auto-fill: minimum child width (number = px, or any CSS length). */
|
|
1997
2304
|
minChildWidth?: number | string;
|
|
1998
|
-
/** Gap as a spacing-scale step (number) or any CSS length. @default 4 */
|
|
2305
|
+
/** Gap (both axes) as a spacing-scale step (number) or any CSS length. @default 4 */
|
|
1999
2306
|
gap?: number | string;
|
|
2307
|
+
/** Row gap — falls back to `gap`. */
|
|
2308
|
+
rowGap?: number | string;
|
|
2309
|
+
/** Column gap — falls back to `gap`. */
|
|
2310
|
+
columnGap?: number | string;
|
|
2000
2311
|
align?: React.CSSProperties["alignItems"];
|
|
2001
2312
|
justify?: React.CSSProperties["justifyItems"];
|
|
2313
|
+
/** Distribute the grid's rows within extra block space. */
|
|
2314
|
+
alignContent?: React.CSSProperties["alignContent"];
|
|
2315
|
+
/** Distribute the grid's columns within extra inline space. */
|
|
2316
|
+
justifyContent?: React.CSSProperties["justifyContent"];
|
|
2002
2317
|
}
|
|
2003
2318
|
|
|
2004
2319
|
declare function Grid(props: GridProps): React.JSX.Element;
|
|
@@ -2006,7 +2321,7 @@ declare function Grid(props: GridProps): React.JSX.Element;
|
|
|
2006
2321
|
/** Flex layout primitive — rows or columns with token-based gaps. */
|
|
2007
2322
|
interface StackProps extends React.HTMLAttributes<HTMLElement> {
|
|
2008
2323
|
/** Element/tag to render. @default "div" */
|
|
2009
|
-
as?:
|
|
2324
|
+
as?: PolymorphicAs;
|
|
2010
2325
|
/** Link destination — only used with as="a"; scheme-sanitized (javascript:/data:/vbscript: render without href). */
|
|
2011
2326
|
href?: string;
|
|
2012
2327
|
/** Anchor target — only used with as="a" (e.g. "_blank"). */
|
|
@@ -2023,14 +2338,38 @@ interface StackProps extends React.HTMLAttributes<HTMLElement> {
|
|
|
2023
2338
|
wrap?: boolean;
|
|
2024
2339
|
/** Use inline-flex instead of flex. @default false */
|
|
2025
2340
|
inline?: boolean;
|
|
2341
|
+
/** Padding — all sides. Spacing step (number) or any CSS length. */
|
|
2342
|
+
p?: number | string;
|
|
2343
|
+
/** Horizontal (inline) padding. */
|
|
2344
|
+
px?: number | string;
|
|
2345
|
+
/** Vertical (block) padding. */
|
|
2346
|
+
py?: number | string;
|
|
2347
|
+
/** Top padding (overrides `py`/`p`). */
|
|
2348
|
+
pt?: number | string;
|
|
2349
|
+
/** Right padding (overrides `px`/`p`). */
|
|
2350
|
+
pr?: number | string;
|
|
2351
|
+
/** Bottom padding (overrides `py`/`p`). */
|
|
2352
|
+
pb?: number | string;
|
|
2353
|
+
/** Left padding (overrides `px`/`p`). */
|
|
2354
|
+
pl?: number | string;
|
|
2355
|
+
/** Node rendered between each child (not before the first or after the last). Pass an orientation-appropriate `Divider`. */
|
|
2356
|
+
divider?: React.ReactNode;
|
|
2026
2357
|
}
|
|
2027
2358
|
|
|
2028
2359
|
declare function Stack(props: StackProps): React.JSX.Element;
|
|
2029
2360
|
|
|
2030
|
-
/** Inline code
|
|
2361
|
+
/** Inline code, or a scrollable multi-line block with an optional copy button. */
|
|
2031
2362
|
interface CodeProps extends React.HTMLAttributes<HTMLElement> {
|
|
2032
|
-
/** Element/tag to render. @default "code" */
|
|
2033
|
-
as?:
|
|
2363
|
+
/** Element/tag or component to render. @default "code" (or "pre" when `block`) */
|
|
2364
|
+
as?: PolymorphicAs;
|
|
2365
|
+
/** Render a scrollable multi-line `<pre>` block instead of the inline pill; defaults `as` to "pre". @default false */
|
|
2366
|
+
block?: boolean;
|
|
2367
|
+
/** Show a copy-to-clipboard button (typically with `block`). @default false */
|
|
2368
|
+
copyable?: boolean;
|
|
2369
|
+
/** Accessible label for the copy button. @default "Copy code" */
|
|
2370
|
+
copyLabel?: string;
|
|
2371
|
+
/** Accessible label announced after a successful copy. @default "Copied" */
|
|
2372
|
+
copiedLabel?: string;
|
|
2034
2373
|
/** Link destination — only used with as="a"; scheme-sanitized (javascript:/data:/vbscript: render without href). */
|
|
2035
2374
|
href?: string;
|
|
2036
2375
|
/** Anchor target — only used with as="a" (e.g. "_blank"). */
|
|
@@ -2041,10 +2380,17 @@ interface CodeProps extends React.HTMLAttributes<HTMLElement> {
|
|
|
2041
2380
|
|
|
2042
2381
|
declare function Code(props: CodeProps): React.JSX.Element;
|
|
2043
2382
|
|
|
2044
|
-
/**
|
|
2383
|
+
/** Font-size token suffixes available to `Heading` (see tokens/typography.css). */
|
|
2384
|
+
type HeadingSize =
|
|
2385
|
+
| "xs" | "sm" | "base" | "lg" | "xl" | "2xl" | "3xl" | "4xl" | "5xl" | "6xl" | "7xl" | "display";
|
|
2386
|
+
|
|
2387
|
+
/**
|
|
2388
|
+
* Heading (h1–h6) with token typography. `level` sets the tag/semantics; `size` sets the visual
|
|
2389
|
+
* scale — the two are intentionally independent (e.g. a semantic `<h1>` at a small size).
|
|
2390
|
+
*/
|
|
2045
2391
|
interface HeadingProps extends React.HTMLAttributes<HTMLElement> {
|
|
2046
2392
|
/** Override the rendered tag (e.g. render a visual h2 as an h1). */
|
|
2047
|
-
as?:
|
|
2393
|
+
as?: PolymorphicAs;
|
|
2048
2394
|
/** Link destination — only used with as="a"; scheme-sanitized (javascript:/data:/vbscript: render without href). */
|
|
2049
2395
|
href?: string;
|
|
2050
2396
|
/** Anchor target — only used with as="a" (e.g. "_blank"). */
|
|
@@ -2053,9 +2399,15 @@ interface HeadingProps extends React.HTMLAttributes<HTMLElement> {
|
|
|
2053
2399
|
rel?: string;
|
|
2054
2400
|
/** Heading level 1–6 — sets the tag and the default size. @default 2 */
|
|
2055
2401
|
level?: 1 | 2 | 3 | 4 | 5 | 6;
|
|
2056
|
-
/**
|
|
2057
|
-
size?:
|
|
2402
|
+
/** Font-size token (xs…7xl or display), independent of `level`. */
|
|
2403
|
+
size?: HeadingSize;
|
|
2404
|
+
/** Convenience: render at the display size (`var(--text-display)`) regardless of level. @default false */
|
|
2405
|
+
display?: boolean;
|
|
2058
2406
|
align?: React.CSSProperties["textAlign"];
|
|
2407
|
+
/** Single-line ellipsis truncation (adds min-width:0 so it shrinks in a flex parent). @default false */
|
|
2408
|
+
truncate?: boolean;
|
|
2409
|
+
/** Clamp to N lines with an ellipsis (multi-line, -webkit-line-clamp). Overrides `truncate`. */
|
|
2410
|
+
lineClamp?: number;
|
|
2059
2411
|
}
|
|
2060
2412
|
|
|
2061
2413
|
declare function Heading(props: HeadingProps): React.JSX.Element;
|
|
@@ -2063,7 +2415,7 @@ declare function Heading(props: HeadingProps): React.JSX.Element;
|
|
|
2063
2415
|
/** Body text with token sizes and semantic color tones. Renders <p> by default. */
|
|
2064
2416
|
interface TextProps extends React.HTMLAttributes<HTMLElement> {
|
|
2065
2417
|
/** Element/tag to render (e.g. "span", "p"). @default "p" */
|
|
2066
|
-
as?:
|
|
2418
|
+
as?: PolymorphicAs;
|
|
2067
2419
|
/** Link destination — only used with as="a"; scheme-sanitized (javascript:/data:/vbscript: render without href). */
|
|
2068
2420
|
href?: string;
|
|
2069
2421
|
/** Anchor target — only used with as="a" (e.g. "_blank"). */
|
|
@@ -2072,11 +2424,15 @@ interface TextProps extends React.HTMLAttributes<HTMLElement> {
|
|
|
2072
2424
|
rel?: string;
|
|
2073
2425
|
/** Font-size token suffix. @default "base" */
|
|
2074
2426
|
size?: "xs" | "sm" | "base" | "lg" | "xl" | string;
|
|
2075
|
-
/** Semantic color tone — text roles (default/muted/subtle)
|
|
2076
|
-
tone?:
|
|
2427
|
+
/** Semantic color tone — text roles (default/muted/subtle), the color intents, or `"inherit"` to adopt the parent color. @default "default" */
|
|
2428
|
+
tone?: TextTone;
|
|
2077
2429
|
/** Font-weight token suffix (e.g. "medium", "semibold", "bold"). */
|
|
2078
2430
|
weight?: "medium" | "semibold" | "bold" | string;
|
|
2079
2431
|
align?: React.CSSProperties["textAlign"];
|
|
2432
|
+
/** Single-line ellipsis truncation (adds min-width:0 so it shrinks in a flex parent). @default false */
|
|
2433
|
+
truncate?: boolean;
|
|
2434
|
+
/** Clamp to N lines with an ellipsis (multi-line, -webkit-line-clamp). Overrides `truncate`. */
|
|
2435
|
+
lineClamp?: number;
|
|
2080
2436
|
}
|
|
2081
2437
|
|
|
2082
2438
|
declare function Text(props: TextProps): React.JSX.Element;
|
|
@@ -2104,15 +2460,30 @@ declare function useDisclosure(initial?: boolean): {
|
|
|
2104
2460
|
setOpen: React.Dispatch<React.SetStateAction<boolean>>;
|
|
2105
2461
|
};
|
|
2106
2462
|
|
|
2107
|
-
/**
|
|
2463
|
+
/**
|
|
2464
|
+
* Controlled/uncontrolled state — the pattern every form component needs.
|
|
2465
|
+
* Returns `[value, setValue, isControlled]`; the third element reports whether a
|
|
2466
|
+
* `value` prop is currently driving the state. In development it warns once if a
|
|
2467
|
+
* component switches between controlled and uncontrolled.
|
|
2468
|
+
*/
|
|
2108
2469
|
declare function useControllableState<T>(options?: {
|
|
2109
2470
|
value?: T;
|
|
2110
2471
|
defaultValue?: T;
|
|
2111
2472
|
onChange?: (value: T) => void;
|
|
2112
|
-
}): [T, (next: T | ((prev: T) => T)) => void];
|
|
2473
|
+
}): [T, (next: T | ((prev: T) => T)) => void, boolean];
|
|
2474
|
+
|
|
2475
|
+
interface UseMediaQueryOptions {
|
|
2476
|
+
/** Value on the server and first client render (before the after-mount sync). @default false */
|
|
2477
|
+
defaultValue?: boolean;
|
|
2478
|
+
/** Read `matchMedia` eagerly in the initializer — client-only apps with no SSR. @default false */
|
|
2479
|
+
initializeWithValue?: boolean;
|
|
2480
|
+
}
|
|
2113
2481
|
|
|
2114
|
-
/**
|
|
2115
|
-
|
|
2482
|
+
/**
|
|
2483
|
+
* Reactively match a media query. Returns `defaultValue` on the server and the
|
|
2484
|
+
* first client render, then syncs after mount — so hydration never mismatches.
|
|
2485
|
+
*/
|
|
2486
|
+
declare function useMediaQuery(query: string, options?: UseMediaQueryOptions): boolean;
|
|
2116
2487
|
|
|
2117
2488
|
/** `true` when the user requests reduced motion. */
|
|
2118
2489
|
declare function usePrefersReducedMotion(): boolean;
|
|
@@ -2140,13 +2511,13 @@ declare function useColorScheme(options?: UseColorSchemeOptions): {
|
|
|
2140
2511
|
declare function useEventListener(
|
|
2141
2512
|
eventName: string,
|
|
2142
2513
|
handler: (event: any) => void,
|
|
2143
|
-
element?: React.RefObject<any> | EventTarget | null,
|
|
2514
|
+
element?: React.RefObject<any | null> | EventTarget | null,
|
|
2144
2515
|
options?: boolean | AddEventListenerOptions
|
|
2145
2516
|
): void;
|
|
2146
2517
|
|
|
2147
2518
|
/** Call `handler` when a pointer/touch event lands outside `ref`. */
|
|
2148
2519
|
declare function useClickOutside<T extends HTMLElement = HTMLElement>(
|
|
2149
|
-
ref: React.RefObject<T>,
|
|
2520
|
+
ref: React.RefObject<T | null>,
|
|
2150
2521
|
handler: (event: Event) => void,
|
|
2151
2522
|
events?: string[]
|
|
2152
2523
|
): void;
|
|
@@ -2197,11 +2568,11 @@ declare function useTimeout(callback: () => void, delay: number | null): void;
|
|
|
2197
2568
|
declare function useWindowSize(): { width: number; height: number };
|
|
2198
2569
|
|
|
2199
2570
|
/** `true` while the pointer is over the element referenced by `ref`. */
|
|
2200
|
-
declare function useHover<T extends HTMLElement = HTMLElement>(ref: React.RefObject<T>): boolean;
|
|
2571
|
+
declare function useHover<T extends HTMLElement = HTMLElement>(ref: React.RefObject<T | null>): boolean;
|
|
2201
2572
|
|
|
2202
2573
|
/** The latest IntersectionObserver entry for the element referenced by `ref`. */
|
|
2203
2574
|
declare function useIntersectionObserver<T extends HTMLElement = HTMLElement>(
|
|
2204
|
-
ref: React.RefObject<T>,
|
|
2575
|
+
ref: React.RefObject<T | null>,
|
|
2205
2576
|
options?: IntersectionObserverInit
|
|
2206
2577
|
): IntersectionObserverEntry | null;
|
|
2207
2578
|
|
|
@@ -2211,4 +2582,28 @@ declare function useScrollLock(locked?: boolean): void;
|
|
|
2211
2582
|
/** A stable, SSR-safe unique id (optionally prefixed). */
|
|
2212
2583
|
declare function useId(prefix?: string): string;
|
|
2213
2584
|
|
|
2214
|
-
|
|
2585
|
+
/** Options for {@link useFocusTrap}. */
|
|
2586
|
+
interface UseFocusTrapOptions {
|
|
2587
|
+
/** Restore focus to the previously-focused element when the trap deactivates. @default true */
|
|
2588
|
+
restoreFocus?: boolean;
|
|
2589
|
+
}
|
|
2590
|
+
|
|
2591
|
+
/**
|
|
2592
|
+
* Trap focus inside the modal region referenced by `ref`. While `active`, focus
|
|
2593
|
+
* moves inside on activate, Tab/Shift+Tab cycle within it, and (by default) focus
|
|
2594
|
+
* is restored to the previously-focused element on deactivate. Escape is NOT
|
|
2595
|
+
* handled — that stays with the component. SSR-safe.
|
|
2596
|
+
*/
|
|
2597
|
+
declare function useFocusTrap<T extends HTMLElement = HTMLElement>(
|
|
2598
|
+
ref: React.RefObject<T | null>,
|
|
2599
|
+
active?: boolean,
|
|
2600
|
+
options?: UseFocusTrapOptions
|
|
2601
|
+
): void;
|
|
2602
|
+
|
|
2603
|
+
/**
|
|
2604
|
+
* Returns a stable `render(node)` that portals `node` to `document.body`, or `null`
|
|
2605
|
+
* on the server (no document). Centralizes the overlay portal pattern.
|
|
2606
|
+
*/
|
|
2607
|
+
declare function usePortal(): (node: React.ReactNode) => React.ReactPortal | React.ReactNode | null;
|
|
2608
|
+
|
|
2609
|
+
export { Accordion, type AccordionItem, type AccordionProps, type ActionTone, Alert, type AlertProps, AppShell, type AppShellProps, Avatar, AvatarMenu, type AvatarMenuProps, type AvatarProps, Badge, type BadgeProps, type BarTone, Box, type BoxProps, Breadcrumb, type BreadcrumbItem, type BreadcrumbProps, Button, type ButtonProps, Card, type CardProps, Carousel, type CarouselProps, Chart, type ChartDatum, type ChartProps, Checkbox, type CheckboxProps, Code, type CodeProps, ColorPicker, type ColorPickerProps, Combobox, type ComboboxGroup, type ComboboxOption, type ComboboxProps, type Command, CommandPalette, type CommandPaletteProps, Container, type ContainerProps, Currency, CurrencyField, type CurrencyFieldProps, type CurrencyOption, type CurrencyProps, Datatable, type DatatableBatchAction, type DatatableColumn, type DatatableFilter, type DatatableFilterOp, type DatatableNumberOp, type DatatableProps, type DatatableQuery, type DatatableRowAction, type DatatableStringOp, DatePicker, type DatePickerProps, type DateRange, DateRangePicker, type DateRangePickerProps, Dialog, type DialogProps, Divider, type DividerProps, Drawer, type DrawerProps, EmptyState, type EmptyStateProps, Field, type FieldProps, FileUpload, type FileUploadProps, Grid, type GridProps, Heading, type HeadingProps, type HeadingSize, IconButton, type IconButtonProps, Input, type InputProps, Kanban, type KanbanCard, type KanbanColumn, type KanbanProps, List, type ListItemData, type ListProps, Menu, type MenuItemDef, type MenuProps, MultiSelect, type MultiSelectGroup, type MultiSelectOption, type MultiSelectProps, Navbar, type NavbarLink, type NavbarProps, type Option, type OptionGroup, Pagination, type PaginationProps, type PolymorphicAs, Popover, type PopoverProps, Progress, type ProgressProps, Radio, RadioGroup, type RadioGroupOption, type RadioGroupProps, type RadioProps, Rating, type RatingProps, type ResponsiveColumns, Select, type SelectGroup, type SelectOption, type SelectProps, Sidebar, type SidebarItem, type SidebarProps, Skeleton, type SkeletonProps, Slider, type SliderProps, Spinner, type SpinnerProps, Stack, type StackProps, Stat, type StatProps, type Step, Stepper, type StepperProps, Switch, type SwitchProps, type TabItem, Table, type TableColumn, type TableProps, Tabs, type TabsProps, Tag, type TagProps, Text, type TextProps, type TextTone, Textarea, type TextareaProps, Timeline, type TimelineItem, type TimelineProps, Toast, type ToastApi, type ToastOptions, type ToastProps, ToastProvider, type ToastProviderProps, type ToastTone, ToastViewport, type ToastViewportProps, type Tone, Tooltip, type TooltipProps, type TreeNode, TreeView, type TreeViewProps, type UseColorSchemeOptions, type UseFocusTrapOptions, type UseKeyPressOptions, type UseMediaQueryOptions, runDatatableQuery, useClickOutside, useColorScheme, useControllableState, useCopyToClipboard, useDebouncedCallback, useDebouncedValue, useDisclosure, useEventListener, useFocusTrap, useHover, useId, useIntersectionObserver, useInterval, useIsomorphicLayoutEffect, useKeyPress, useLocalStorage, useMediaQuery, useMounted, usePortal, usePrefersReducedMotion, usePrevious, useScrollLock, useTimeout, useToast, useToggle, useWindowSize };
|