twico-ui 1.4.0 → 1.5.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -0
- package/dist/index.cjs +1084 -683
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +384 -146
- package/dist/index.d.ts +384 -146
- package/dist/index.mjs +1083 -684
- package/dist/index.mjs.map +1 -1
- package/llms.txt +32 -9
- package/package.json +3 -1
- package/styles/twico-ui.css +15 -5
package/dist/index.d.cts
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. */
|
|
@@ -252,8 +305,14 @@ declare function Card(props: CardProps): React.JSX.Element;
|
|
|
252
305
|
|
|
253
306
|
/**
|
|
254
307
|
* Sliding carousel — one slide per view, prev/next arrows, dot indicators,
|
|
255
|
-
* optional looping and autoplay
|
|
256
|
-
*
|
|
308
|
+
* optional looping and autoplay. Each child is a slide. Controlled via `index` +
|
|
309
|
+
* `onIndexChange`, or uncontrolled via `defaultIndex`.
|
|
310
|
+
*
|
|
311
|
+
* Accessibility: the region is focusable and keyboard-navigable — ArrowLeft/ArrowRight
|
|
312
|
+
* step slides and Home/End jump to first/last. Autoplay pauses on hover/focus, via the
|
|
313
|
+
* pause button, and when `prefers-reduced-motion` is set (WCAG 2.2.2); a polite live
|
|
314
|
+
* region announces the active slide (silenced while auto-rotating). Give the region an
|
|
315
|
+
* accessible name with `label` (or `aria-label`/`aria-labelledby`).
|
|
257
316
|
*
|
|
258
317
|
* @startingPoint section="Data display" subtitle="Sliding carousel" viewport="700x320"
|
|
259
318
|
*/
|
|
@@ -262,44 +321,53 @@ interface CarouselProps extends React.HTMLAttributes<HTMLDivElement> {
|
|
|
262
321
|
index?: number;
|
|
263
322
|
/** Initial slide index when uncontrolled. @default 0 */
|
|
264
323
|
defaultIndex?: number;
|
|
265
|
-
/** Fired when the active slide changes (arrows, dots, or autoplay): (index). */
|
|
324
|
+
/** Fired when the active slide changes (arrows, dots, keyboard, or autoplay): (index). */
|
|
266
325
|
onIndexChange?: (index: number) => void;
|
|
267
326
|
/** Show prev/next arrows. @default true */
|
|
268
327
|
showArrows?: boolean;
|
|
269
328
|
/** Show dot indicators. @default true */
|
|
270
329
|
showDots?: boolean;
|
|
330
|
+
/** Show the pause/play toggle when `autoPlay` is on. @default true */
|
|
331
|
+
showPauseButton?: boolean;
|
|
271
332
|
/** Wrap around at the ends. @default true */
|
|
272
333
|
loop?: boolean;
|
|
273
|
-
/** Auto-advance slides. @default false */
|
|
334
|
+
/** Auto-advance slides. Suppressed under `prefers-reduced-motion`. @default false */
|
|
274
335
|
autoPlay?: boolean;
|
|
275
336
|
/** Autoplay interval in ms. @default 4000 */
|
|
276
337
|
interval?: number;
|
|
338
|
+
/** Accessible name for the carousel region. Falls back to `aria-label`, then `"Carousel"`. */
|
|
339
|
+
label?: string;
|
|
340
|
+
/** Accessible label for the pause button (paused → shows the play label). @default "Pause" */
|
|
341
|
+
pauseLabel?: string;
|
|
342
|
+
/** Accessible label for the play button. @default "Play" */
|
|
343
|
+
playLabel?: string;
|
|
277
344
|
/** Slides (each child is one slide). */
|
|
278
345
|
children?: React.ReactNode;
|
|
279
346
|
}
|
|
280
347
|
|
|
281
348
|
declare function Carousel(props: CarouselProps): React.JSX.Element;
|
|
282
349
|
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
}
|
|
350
|
+
/**
|
|
351
|
+
* A chart data point: a `label` plus one numeric field per series key `K`
|
|
352
|
+
* (default key `"value"`). `K` is normally inferred from the `series` prop.
|
|
353
|
+
*/
|
|
354
|
+
type ChartDatum<K extends string = "value"> = { label: React.ReactNode } & { [P in K]: number };
|
|
289
355
|
|
|
290
356
|
/**
|
|
291
357
|
* Lightweight, dependency-free SVG chart — bar or line, single or multi-series,
|
|
292
|
-
* with grid, axes, animated entrance, tooltips, and optional legend.
|
|
358
|
+
* with grid, axes, animated entrance, tooltips, and optional legend. Generic over
|
|
359
|
+
* the series keys `K` so the data rows are type-checked (e.g.
|
|
360
|
+
* `<Chart series={["sales"]} data={[{ label, sales: 12 }]} />`).
|
|
293
361
|
*
|
|
294
362
|
* @startingPoint section="Data display" subtitle="Bar / line chart (no deps)" viewport="700x280"
|
|
295
363
|
*/
|
|
296
|
-
interface ChartProps extends React.HTMLAttributes<HTMLDivElement> {
|
|
364
|
+
interface ChartProps<K extends string = "value"> extends React.HTMLAttributes<HTMLDivElement> {
|
|
297
365
|
/** @default "bar" */
|
|
298
366
|
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?:
|
|
367
|
+
/** Data points. Each has a `label` + one numeric field per series key. (`K` is inferred from `series`, not from `data`.) */
|
|
368
|
+
data: ChartDatum<NoInfer<K>>[];
|
|
369
|
+
/** Series field names (defaults to `["value"]`). Multiple = grouped bars / multi-line. */
|
|
370
|
+
series?: K[];
|
|
303
371
|
/** Pixel height. @default 220 */
|
|
304
372
|
height?: number;
|
|
305
373
|
/** Horizontal grid lines. @default true */
|
|
@@ -310,13 +378,17 @@ interface ChartProps extends React.HTMLAttributes<HTMLDivElement> {
|
|
|
310
378
|
showLegend?: boolean;
|
|
311
379
|
/** Per-series colors (any CSS color), cycled when shorter than `series`. Defaults to the built-in token palette. */
|
|
312
380
|
colors?: string[];
|
|
313
|
-
/** Tooltip value formatter. */
|
|
381
|
+
/** Tooltip value formatter (also formats the hidden data-table cells). */
|
|
314
382
|
valueFormat?: (value: number) => string;
|
|
315
|
-
/** Accessible name for the chart's `<svg role="img">`. Defaults to `"<type> chart"
|
|
383
|
+
/** 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
384
|
ariaLabel?: string;
|
|
385
|
+
/** Render a visually-hidden data table as an accessible text alternative (WCAG 1.1.1). @default true */
|
|
386
|
+
tableFallback?: boolean;
|
|
387
|
+
/** Caption for the hidden data table; defaults to the chart's accessible label. */
|
|
388
|
+
caption?: React.ReactNode;
|
|
317
389
|
}
|
|
318
390
|
|
|
319
|
-
declare function Chart(props: ChartProps): React.JSX.Element;
|
|
391
|
+
declare function Chart<K extends string = "value">(props: ChartProps<K>): React.JSX.Element;
|
|
320
392
|
|
|
321
393
|
/**
|
|
322
394
|
* Checkbox with animated checkmark, label, description, and indeterminate state.
|
|
@@ -330,7 +402,7 @@ interface CheckboxProps extends Omit<React.InputHTMLAttributes<HTMLInputElement>
|
|
|
330
402
|
indeterminate?: boolean;
|
|
331
403
|
size?: "sm" | "md" | "lg";
|
|
332
404
|
/** Color intent. @default "primary" */
|
|
333
|
-
tone?:
|
|
405
|
+
tone?: Tone;
|
|
334
406
|
}
|
|
335
407
|
|
|
336
408
|
declare function Checkbox(props: CheckboxProps): React.JSX.Element;
|
|
@@ -359,12 +431,32 @@ interface ColorPickerProps extends Omit<React.HTMLAttributes<HTMLDivElement>, "o
|
|
|
359
431
|
/** Disable all interaction (the popover cannot be opened). @default false */
|
|
360
432
|
disabled?: boolean;
|
|
361
433
|
/** Color intent for the focus/open accent. @default "primary" */
|
|
362
|
-
tone?:
|
|
434
|
+
tone?: Tone;
|
|
363
435
|
onChange?: (hex: string) => void;
|
|
364
436
|
}
|
|
365
437
|
|
|
366
438
|
declare function ColorPicker(props: ColorPickerProps): React.JSX.Element;
|
|
367
439
|
|
|
440
|
+
// Shared option shape for the Select family (Select, Combobox, MultiSelect). One
|
|
441
|
+
// canonical pair instead of three byte-identical duplicates; the per-component names
|
|
442
|
+
// (SelectOption, ComboboxOption, …) stay as structural aliases so existing imports
|
|
443
|
+
// keep resolving. Types only — no runtime. CurrencyField's CurrencyOption is a
|
|
444
|
+
// deliberately separate, narrower shape and is NOT unified here.
|
|
445
|
+
|
|
446
|
+
/** A single selectable option. */
|
|
447
|
+
interface Option {
|
|
448
|
+
value: string;
|
|
449
|
+
label: string;
|
|
450
|
+
/** Optional second line shown under the label. */
|
|
451
|
+
description?: string;
|
|
452
|
+
}
|
|
453
|
+
|
|
454
|
+
/** A labeled group of options (or bare string values). */
|
|
455
|
+
interface OptionGroup {
|
|
456
|
+
group: string;
|
|
457
|
+
options: Array<string | Option>;
|
|
458
|
+
}
|
|
459
|
+
|
|
368
460
|
/**
|
|
369
461
|
* Searchable single-select (MUI-Autocomplete style) — type directly in the
|
|
370
462
|
* field to filter; the overlay shows only options. Supports grouped options
|
|
@@ -380,7 +472,7 @@ interface ComboboxProps extends Omit<React.InputHTMLAttributes<HTMLInputElement>
|
|
|
380
472
|
required?: boolean;
|
|
381
473
|
size?: "sm" | "md" | "lg";
|
|
382
474
|
/** Color intent for the focus/open accent. @default "primary" */
|
|
383
|
-
tone?:
|
|
475
|
+
tone?: Tone;
|
|
384
476
|
/** Field placeholder. */
|
|
385
477
|
placeholder?: string;
|
|
386
478
|
/** Options — strings, {value,label,description}, or {group,options} groups. */
|
|
@@ -389,6 +481,7 @@ interface ComboboxProps extends Omit<React.InputHTMLAttributes<HTMLInputElement>
|
|
|
389
481
|
value?: string | null;
|
|
390
482
|
/** Uncontrolled initial value. */
|
|
391
483
|
defaultValue?: string | null;
|
|
484
|
+
/** Called with the chosen option's value, or `null` when cleared via `clearable`. */
|
|
392
485
|
onChange?: (value: string | null) => void;
|
|
393
486
|
/** Show a clear (×) affix when a value is selected. */
|
|
394
487
|
clearable?: boolean;
|
|
@@ -407,18 +500,11 @@ interface ComboboxProps extends Omit<React.InputHTMLAttributes<HTMLInputElement>
|
|
|
407
500
|
onKeyDown?: React.KeyboardEventHandler<HTMLInputElement>;
|
|
408
501
|
}
|
|
409
502
|
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
label: string;
|
|
413
|
-
/** Optional second line shown under the label. */
|
|
414
|
-
description?: string;
|
|
415
|
-
}
|
|
503
|
+
/** Alias of the shared {@link Option} type (kept for backward-compatible imports). */
|
|
504
|
+
type ComboboxOption = Option;
|
|
416
505
|
|
|
417
|
-
/**
|
|
418
|
-
|
|
419
|
-
group: string;
|
|
420
|
-
options: Array<string | ComboboxOption>;
|
|
421
|
-
}
|
|
506
|
+
/** Alias of the shared {@link OptionGroup} type (kept for backward-compatible imports). */
|
|
507
|
+
type ComboboxGroup = OptionGroup;
|
|
422
508
|
|
|
423
509
|
declare function Combobox(props: ComboboxProps): React.JSX.Element;
|
|
424
510
|
|
|
@@ -476,7 +562,7 @@ interface CurrencyProps extends Omit<React.InputHTMLAttributes<HTMLInputElement>
|
|
|
476
562
|
required?: boolean;
|
|
477
563
|
size?: "sm" | "md" | "lg";
|
|
478
564
|
/** Color intent for the focus/open accent. @default "primary" */
|
|
479
|
-
tone?:
|
|
565
|
+
tone?: Tone;
|
|
480
566
|
/** Currency code (key in the built-in table), e.g. "USD", "EUR", "IDR", "JPY". @default "USD" */
|
|
481
567
|
currency?: string;
|
|
482
568
|
/** Override the currency's decimal precision (number of digits after the decimal). */
|
|
@@ -485,13 +571,13 @@ interface CurrencyProps extends Omit<React.InputHTMLAttributes<HTMLInputElement>
|
|
|
485
571
|
symbol?: string;
|
|
486
572
|
/** Override the displayed suffix code. */
|
|
487
573
|
code?: string;
|
|
488
|
-
/** Controlled string value. */
|
|
574
|
+
/** 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
575
|
value?: string | number;
|
|
490
576
|
/** Uncontrolled initial value. */
|
|
491
577
|
defaultValue?: string | number;
|
|
492
|
-
/**
|
|
578
|
+
/** 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
579
|
onChange?: (e: React.ChangeEvent<HTMLInputElement>) => void;
|
|
494
|
-
/**
|
|
580
|
+
/** Primary value callback: the parsed numeric value (`number | null`) plus the clamped, formatted display string. Use this — not `onChange` — for controlled numeric state. */
|
|
495
581
|
onValueChange?: (value: number | null, formatted: string) => void;
|
|
496
582
|
}
|
|
497
583
|
|
|
@@ -516,7 +602,7 @@ interface CurrencyFieldProps extends Omit<React.InputHTMLAttributes<HTMLInputEle
|
|
|
516
602
|
required?: boolean;
|
|
517
603
|
size?: "sm" | "md" | "lg";
|
|
518
604
|
/** Color intent for the focus/open accent. @default "primary" */
|
|
519
|
-
tone?:
|
|
605
|
+
tone?: Tone;
|
|
520
606
|
/** Controlled selected currency code. */
|
|
521
607
|
currency?: string;
|
|
522
608
|
/** Uncontrolled initial currency code. @default "USD" */
|
|
@@ -525,13 +611,13 @@ interface CurrencyFieldProps extends Omit<React.InputHTMLAttributes<HTMLInputEle
|
|
|
525
611
|
onCurrencyChange?: (code: string) => void;
|
|
526
612
|
/** Limit the selectable currencies (codes or {value,label}); defaults to the full built-in list. */
|
|
527
613
|
currencies?: Array<string | CurrencyOption>;
|
|
528
|
-
/** Controlled amount string. */
|
|
614
|
+
/** 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
615
|
value?: string | number;
|
|
530
616
|
/** Uncontrolled initial amount. */
|
|
531
617
|
defaultValue?: string | number;
|
|
532
|
-
/**
|
|
618
|
+
/** 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
619
|
onChange?: (e: React.ChangeEvent<HTMLInputElement>) => void;
|
|
534
|
-
/**
|
|
620
|
+
/** 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
621
|
onValueChange?: (value: number | null, formatted: string, currency: string) => void;
|
|
536
622
|
}
|
|
537
623
|
|
|
@@ -551,15 +637,15 @@ declare function CurrencyField(props: CurrencyFieldProps): React.JSX.Element;
|
|
|
551
637
|
*
|
|
552
638
|
* @startingPoint section="Data display" subtitle="MUI-style sortable/filterable/pinnable data table" viewport="900x460"
|
|
553
639
|
*/
|
|
554
|
-
interface DatatableProps extends Omit<React.HTMLAttributes<HTMLDivElement>, "rows"> {
|
|
640
|
+
interface DatatableProps<T = any> extends Omit<React.HTMLAttributes<HTMLDivElement>, "rows"> {
|
|
555
641
|
/** Column definitions. */
|
|
556
|
-
columns: DatatableColumn[];
|
|
642
|
+
columns: DatatableColumn<T>[];
|
|
557
643
|
/** Row objects. In server mode, only the current page's rows. */
|
|
558
|
-
rows:
|
|
644
|
+
rows: T[];
|
|
559
645
|
/** Show shimmering skeleton rows instead of data. @default false */
|
|
560
646
|
loading?: boolean;
|
|
561
647
|
/** Returns a stable key per row. @default (r,i) => r.id ?? i */
|
|
562
|
-
rowKey?: (row:
|
|
648
|
+
rowKey?: (row: T, index: number) => string | number;
|
|
563
649
|
/** Render a leading checkbox-selection column. @default false */
|
|
564
650
|
checkboxSelection?: boolean;
|
|
565
651
|
/** Render a leading auto-numbered row column (1, 2, 3…). The number reflects each row's position in
|
|
@@ -578,7 +664,7 @@ interface DatatableProps extends Omit<React.HTMLAttributes<HTMLDivElement>, "row
|
|
|
578
664
|
* cross-page selections, use the complete `selectedKeys` array and re-fetch the
|
|
579
665
|
* full row objects server-side rather than relying on `selectedRows`.
|
|
580
666
|
*/
|
|
581
|
-
batchActions?: DatatableBatchAction[];
|
|
667
|
+
batchActions?: DatatableBatchAction<T>[];
|
|
582
668
|
/** Row height preset. With `showDensity`, the toolbar density button cycles it locally; changing this prop re-applies it. @default "comfortable" */
|
|
583
669
|
density?: "compact" | "standard" | "comfortable";
|
|
584
670
|
/** Initial rows per page. 0 disables pagination. @default 10 */
|
|
@@ -623,23 +709,23 @@ interface DatatableProps extends Omit<React.HTMLAttributes<HTMLDivElement>, "row
|
|
|
623
709
|
/** Make all columns editable by default (double-click a cell to edit; per-column `editable` overrides). @default false */
|
|
624
710
|
editMode?: boolean;
|
|
625
711
|
/** Called when a cell edit is committed: (updatedRow, originalRow, field). */
|
|
626
|
-
onRowUpdate?: (updatedRow:
|
|
712
|
+
onRowUpdate?: (updatedRow: T, originalRow: T, field: string) => void;
|
|
627
713
|
/** Controlled-rows callback: receives the full next rows array after an edit (client mode). */
|
|
628
|
-
onRowsChange?: (rows:
|
|
714
|
+
onRowsChange?: (rows: T[]) => void;
|
|
629
715
|
/** Fired when the built-in batch editor applies columns across selected rows:
|
|
630
716
|
* (changedRows, patch, selectedKeys). The selection-toolbar "Edit" button appears
|
|
631
717
|
* automatically when there are editable columns. Server-mode caveat: `changedRows`
|
|
632
718
|
* resolves only rows on the currently loaded page; for cross-page selections use the
|
|
633
719
|
* complete `selectedKeys` array and apply the `patch` server-side. */
|
|
634
|
-
onBatchUpdate?: (changedRows:
|
|
720
|
+
onBatchUpdate?: (changedRows: T[], patch: Record<string, any>, selectedKeys: Array<string | number>) => void;
|
|
635
721
|
/** Show a "Go to" page jumper in the footer when there are more than 5 pages. @default true */
|
|
636
722
|
showPageJumper?: boolean;
|
|
637
723
|
/** Click-to-select mode: "row" highlights the clicked row, "cell" highlights a single cell. @default "none" */
|
|
638
724
|
selectionMode?: "none" | "row" | "cell";
|
|
639
725
|
/** Fired when a row is clicked in "row" selection mode: (row, key). */
|
|
640
|
-
onRowClick?: (row:
|
|
726
|
+
onRowClick?: (row: T, key: string | number) => void;
|
|
641
727
|
/** Fired when a cell is clicked in "cell" selection mode: (value, row, field). */
|
|
642
|
-
onCellClick?: (value: any, row:
|
|
728
|
+
onCellClick?: (value: any, row: T, field: string) => void;
|
|
643
729
|
/** Fired when the active cell changes: ({ key, field } | null). */
|
|
644
730
|
onActiveCellChange?: (cell: { key: string | number; field: string } | null) => void;
|
|
645
731
|
/** Show the **Aggregation** toolbar button and start with the totals row on. From that panel the user
|
|
@@ -685,6 +771,18 @@ interface DatatableProps extends Omit<React.HTMLAttributes<HTMLDivElement>, "row
|
|
|
685
771
|
rowHeight?: number;
|
|
686
772
|
}
|
|
687
773
|
|
|
774
|
+
/** String-column filter operators (Datatable server mode). */
|
|
775
|
+
type DatatableStringOp = "contains" | "equals" | "startsWith" | "endsWith" | "isEmpty" | "isNotEmpty" | "isAnyOf";
|
|
776
|
+
/** Number-column filter operators. */
|
|
777
|
+
type DatatableNumberOp = "=" | "!=" | ">" | ">=" | "<" | "<=" | "isAnyOf";
|
|
778
|
+
/** Any Datatable filter operator. */
|
|
779
|
+
type DatatableFilterOp = DatatableStringOp | DatatableNumberOp;
|
|
780
|
+
/** A single active filter — the value shape is discriminated by `op`. */
|
|
781
|
+
type DatatableFilter =
|
|
782
|
+
| { field: string; op: "isAnyOf"; value: string[] }
|
|
783
|
+
| { field: string; op: "isEmpty" | "isNotEmpty"; value?: undefined }
|
|
784
|
+
| { field: string; op: Exclude<DatatableFilterOp, "isAnyOf" | "isEmpty" | "isNotEmpty">; value: string };
|
|
785
|
+
|
|
688
786
|
/** Query state reported by a server-mode Datatable. */
|
|
689
787
|
interface DatatableQuery {
|
|
690
788
|
/** Zero-based page index. */
|
|
@@ -693,13 +791,16 @@ interface DatatableQuery {
|
|
|
693
791
|
pageSize: number;
|
|
694
792
|
/** Active sort, or null. */
|
|
695
793
|
sort: { field: string; dir: "asc" | "desc" } | null;
|
|
696
|
-
/**
|
|
697
|
-
|
|
794
|
+
/**
|
|
795
|
+
* Active column filters. String columns emit contains/equals/startsWith/endsWith/isAnyOf/isEmpty/isNotEmpty;
|
|
796
|
+
* number columns emit =, !=, >, >=, <, <=. `value` is a `string[]` for `isAnyOf` and omitted for `isEmpty`/`isNotEmpty`.
|
|
797
|
+
*/
|
|
798
|
+
filters: DatatableFilter[];
|
|
698
799
|
/** Quick-search text. */
|
|
699
800
|
quickFilter: string;
|
|
700
801
|
}
|
|
701
802
|
|
|
702
|
-
interface DatatableColumn {
|
|
803
|
+
interface DatatableColumn<T = any> {
|
|
703
804
|
/** Row object key (also the sort/filter key). */
|
|
704
805
|
field: string;
|
|
705
806
|
/** Header label. @default field ("Actions" for actions columns) */
|
|
@@ -725,11 +826,11 @@ interface DatatableColumn {
|
|
|
725
826
|
/** Allow drag-to-resize of this column. @default true */
|
|
726
827
|
resizable?: boolean;
|
|
727
828
|
/** Summary-footer aggregation: a preset, or a function over the column's values. */
|
|
728
|
-
aggregation?: "sum" | "avg" | "min" | "max" | "count" | ((values: any[], rows:
|
|
829
|
+
aggregation?: "sum" | "avg" | "min" | "max" | "count" | ((values: any[], rows: T[]) => React.ReactNode);
|
|
729
830
|
/** Format an aggregation result for the footer (falls back to valueFormatter). */
|
|
730
831
|
aggregationFormatter?: (value: any) => React.ReactNode;
|
|
731
832
|
/** Map a row to its exported CSV value (defaults to the raw field value). */
|
|
732
|
-
exportValue?: (value: any, row:
|
|
833
|
+
exportValue?: (value: any, row: T) => string | number;
|
|
733
834
|
/** Make this column's cells editable (double-click to edit). Overrides the grid `editMode`. */
|
|
734
835
|
editable?: boolean;
|
|
735
836
|
/** Editor type. "select" (or any column with `valueOptions`) renders a dropdown; else a text/number input by column type. */
|
|
@@ -742,21 +843,21 @@ interface DatatableColumn {
|
|
|
742
843
|
/** Distinct values for the "is any of" multi-value filter (recommended in server mode). */
|
|
743
844
|
valueOptions?: Array<string | { value: string; label: string }>;
|
|
744
845
|
/** Format the raw value to a string/number for display. */
|
|
745
|
-
valueFormatter?: (value: any, row:
|
|
846
|
+
valueFormatter?: (value: any, row: T) => React.ReactNode;
|
|
746
847
|
/** Fully custom cell renderer (badges, avatars, etc.). */
|
|
747
|
-
renderCell?: (value: any, row:
|
|
848
|
+
renderCell?: (value: any, row: T) => React.ReactNode;
|
|
748
849
|
/** For type:"actions" — returns the row's action items. */
|
|
749
|
-
getActions?: (row:
|
|
850
|
+
getActions?: (row: T) => DatatableRowAction<T>[];
|
|
750
851
|
}
|
|
751
852
|
|
|
752
853
|
/** A per-row action in an actions column. */
|
|
753
|
-
interface DatatableRowAction {
|
|
854
|
+
interface DatatableRowAction<T = any> {
|
|
754
855
|
/** Icon node (rendered as an icon button, or leading icon in the overflow menu). */
|
|
755
856
|
icon?: React.ReactNode;
|
|
756
857
|
/** Accessible label / tooltip / menu text. */
|
|
757
858
|
label: string;
|
|
758
859
|
/** Click handler, receives the row. */
|
|
759
|
-
onClick?: (row:
|
|
860
|
+
onClick?: (row: T) => void;
|
|
760
861
|
/** Place in the ⋮ overflow menu instead of inline. @default false */
|
|
761
862
|
showInMenu?: boolean;
|
|
762
863
|
/** Render in danger color. */
|
|
@@ -765,19 +866,19 @@ interface DatatableRowAction {
|
|
|
765
866
|
}
|
|
766
867
|
|
|
767
868
|
/** A batch action shown in the selection toolbar. */
|
|
768
|
-
interface DatatableBatchAction {
|
|
869
|
+
interface DatatableBatchAction<T = any> {
|
|
769
870
|
/** Button label. */
|
|
770
871
|
label: string;
|
|
771
872
|
/** Leading icon node. */
|
|
772
873
|
icon?: React.ReactNode;
|
|
773
874
|
/** Handler: (selectedKeys, selectedRows, clearSelection). */
|
|
774
|
-
onClick?: (keys: Array<string | number>, rows:
|
|
875
|
+
onClick?: (keys: Array<string | number>, rows: T[], clearSelection: () => void) => void;
|
|
775
876
|
/** Render in danger color. */
|
|
776
877
|
danger?: boolean;
|
|
777
878
|
disabled?: boolean;
|
|
778
879
|
}
|
|
779
880
|
|
|
780
|
-
declare function Datatable(props: DatatableProps): React.JSX.Element;
|
|
881
|
+
declare function Datatable<T = any>(props: DatatableProps<T>): React.JSX.Element;
|
|
781
882
|
|
|
782
883
|
/**
|
|
783
884
|
* Apply a `DatatableQuery` (the object a `serverMode` grid passes to
|
|
@@ -794,7 +895,7 @@ declare function Datatable(props: DatatableProps): React.JSX.Element;
|
|
|
794
895
|
declare function runDatatableQuery<T = any>(
|
|
795
896
|
rows: T[],
|
|
796
897
|
query: DatatableQuery,
|
|
797
|
-
options?: { columns?: DatatableColumn[]; searchFields?: string[] }
|
|
898
|
+
options?: { columns?: DatatableColumn<T>[]; searchFields?: string[] }
|
|
798
899
|
): { rows: T[]; total: number; filtered: T[] };
|
|
799
900
|
|
|
800
901
|
/**
|
|
@@ -823,7 +924,7 @@ interface DatePickerProps extends Omit<React.HTMLAttributes<HTMLDivElement>, "on
|
|
|
823
924
|
max?: Date;
|
|
824
925
|
disabled?: boolean;
|
|
825
926
|
/** Color intent for the focus/open accent. @default "primary" */
|
|
826
|
-
tone?:
|
|
927
|
+
tone?: Tone;
|
|
827
928
|
/** Show a clear (×) button when a date is set. @default true */
|
|
828
929
|
clearable?: boolean;
|
|
829
930
|
/** Custom display formatter (defaults to a localized medium date). */
|
|
@@ -871,7 +972,7 @@ interface DateRangePickerProps extends Omit<React.HTMLAttributes<HTMLDivElement>
|
|
|
871
972
|
/** Disable all interaction (the popover cannot be opened). @default false */
|
|
872
973
|
disabled?: boolean;
|
|
873
974
|
/** Color intent for the focus/open accent. @default "primary" */
|
|
874
|
-
tone?:
|
|
975
|
+
tone?: Tone;
|
|
875
976
|
onChange?: (range: DateRange) => void;
|
|
876
977
|
}
|
|
877
978
|
|
|
@@ -906,7 +1007,7 @@ declare function Dialog(props: DialogProps): React.JSX.Element | null;
|
|
|
906
1007
|
* (or left/right-aligned) label.
|
|
907
1008
|
*/
|
|
908
1009
|
interface DividerProps extends React.HTMLAttributes<HTMLElement> {
|
|
909
|
-
/** @default "horizontal" */
|
|
1010
|
+
/** Rule axis — applies to both the plain and the labeled variant (exposed as `aria-orientation`). @default "horizontal" */
|
|
910
1011
|
orientation?: "horizontal" | "vertical";
|
|
911
1012
|
/** Indent the start of a horizontal rule. */
|
|
912
1013
|
inset?: boolean;
|
|
@@ -956,7 +1057,7 @@ interface EmptyStateProps extends Omit<React.HTMLAttributes<HTMLDivElement>, "ti
|
|
|
956
1057
|
description?: React.ReactNode;
|
|
957
1058
|
/** Action buttons row. */
|
|
958
1059
|
actions?: React.ReactNode;
|
|
959
|
-
/** Add a dashed border (good for drop targets / placeholders). @deprecated
|
|
1060
|
+
/** Add a dashed border (good for drop targets / placeholders). @deprecated since 1.4, removed in 2.0 — use `border`. @default false */
|
|
960
1061
|
bordered?: boolean;
|
|
961
1062
|
/** Add a dashed border (good for drop targets / placeholders); preferred alias for `bordered`. @default false */
|
|
962
1063
|
border?: boolean;
|
|
@@ -1015,7 +1116,7 @@ interface FileUploadProps extends Omit<React.HTMLAttributes<HTMLDivElement>, "on
|
|
|
1015
1116
|
multiple?: boolean;
|
|
1016
1117
|
disabled?: boolean;
|
|
1017
1118
|
/** Color intent for the focus/open accent. @default "primary" */
|
|
1018
|
-
tone?:
|
|
1119
|
+
tone?: Tone;
|
|
1019
1120
|
/** Field label rendered above the dropzone. */
|
|
1020
1121
|
label?: React.ReactNode;
|
|
1021
1122
|
/** Hint line under the prompt (defaults to the accept types). */
|
|
@@ -1045,7 +1146,7 @@ interface IconButtonProps extends React.ButtonHTMLAttributes<HTMLButtonElement>
|
|
|
1045
1146
|
variant?: "solid" | "soft" | "outline" | "ghost";
|
|
1046
1147
|
/** Color/intent, orthogonal to `variant` (mirrors Button). A destructive icon button is
|
|
1047
1148
|
* `tone="danger"` with any variant. @default "primary" */
|
|
1048
|
-
tone?:
|
|
1149
|
+
tone?: ActionTone;
|
|
1049
1150
|
/** Control size; "xs" (~26px) is smaller than "sm". @default "md" */
|
|
1050
1151
|
size?: "xs" | "sm" | "md" | "lg";
|
|
1051
1152
|
/** Fully rounded (circular). @default false */
|
|
@@ -1073,7 +1174,7 @@ interface InputProps extends Omit<React.InputHTMLAttributes<HTMLInputElement>, "
|
|
|
1073
1174
|
/** Control size. @default "md" */
|
|
1074
1175
|
size?: "sm" | "md" | "lg";
|
|
1075
1176
|
/** Color intent for the focus/open accent. @default "primary" */
|
|
1076
|
-
tone?:
|
|
1177
|
+
tone?: Tone;
|
|
1077
1178
|
/** Icon node inside the field, leading edge (prefix). */
|
|
1078
1179
|
leftIcon?: React.ReactNode;
|
|
1079
1180
|
/** Optional suffix icon/node inside the field, trailing edge. For `type="password"`, omitting this
|
|
@@ -1088,6 +1189,8 @@ interface KanbanColumn {
|
|
|
1088
1189
|
id: string;
|
|
1089
1190
|
/** Column heading. */
|
|
1090
1191
|
title: React.ReactNode;
|
|
1192
|
+
/** Accessible name for the column group — use when `title` is a non-string node. Falls back to a string title, then the id. */
|
|
1193
|
+
ariaLabel?: string;
|
|
1091
1194
|
/** Dot color for the heading. */
|
|
1092
1195
|
color?: string;
|
|
1093
1196
|
}
|
|
@@ -1098,6 +1201,8 @@ interface KanbanCard {
|
|
|
1098
1201
|
column: string;
|
|
1099
1202
|
title?: React.ReactNode;
|
|
1100
1203
|
description?: React.ReactNode;
|
|
1204
|
+
/** Accessible name for the card — use when the card content is graphical/icon-only. Falls back to a string title, then "Card". */
|
|
1205
|
+
ariaLabel?: string;
|
|
1101
1206
|
/** Small uppercase tag chips. */
|
|
1102
1207
|
tags?: React.ReactNode[];
|
|
1103
1208
|
/** Footer node (e.g. an Avatar / due date). */
|
|
@@ -1124,6 +1229,8 @@ interface KanbanProps extends React.HTMLAttributes<HTMLDivElement> {
|
|
|
1124
1229
|
onCardMove?: (cardId: string, toColumn: string, nextCards: KanbanCard[]) => void;
|
|
1125
1230
|
/** Custom card renderer. */
|
|
1126
1231
|
renderCard?: (card: KanbanCard) => React.ReactNode;
|
|
1232
|
+
/** Accessible name for each card — supply this when `renderCard` produces graphical/icon-only content; falls back to a string title or "Card". */
|
|
1233
|
+
getCardLabel?: (card: KanbanCard) => string;
|
|
1127
1234
|
}
|
|
1128
1235
|
|
|
1129
1236
|
declare function Kanban(props: KanbanProps): React.JSX.Element;
|
|
@@ -1175,7 +1282,7 @@ interface MultiSelectProps extends Omit<React.InputHTMLAttributes<HTMLInputEleme
|
|
|
1175
1282
|
/** Control height preset, matching Select/Combobox. @default "md" */
|
|
1176
1283
|
size?: "sm" | "md" | "lg";
|
|
1177
1284
|
/** Color intent for the focus/open accent. @default "primary" */
|
|
1178
|
-
tone?:
|
|
1285
|
+
tone?: Tone;
|
|
1179
1286
|
placeholder?: string;
|
|
1180
1287
|
/** Options — strings, {value,label,description}, or {group,options} groups. */
|
|
1181
1288
|
options: Array<string | MultiSelectOption | MultiSelectGroup>;
|
|
@@ -1183,6 +1290,7 @@ interface MultiSelectProps extends Omit<React.InputHTMLAttributes<HTMLInputEleme
|
|
|
1183
1290
|
value?: string[];
|
|
1184
1291
|
/** Uncontrolled initial values. */
|
|
1185
1292
|
defaultValue?: string[];
|
|
1293
|
+
/** Called with the full array of selected values (empty array when none/cleared). */
|
|
1186
1294
|
onChange?: (values: string[]) => void;
|
|
1187
1295
|
/** Show a clear-all (×) affix when at least one value is selected. @default false */
|
|
1188
1296
|
clearable?: boolean;
|
|
@@ -1201,18 +1309,11 @@ interface MultiSelectProps extends Omit<React.InputHTMLAttributes<HTMLInputEleme
|
|
|
1201
1309
|
onKeyDown?: React.KeyboardEventHandler<HTMLInputElement>;
|
|
1202
1310
|
}
|
|
1203
1311
|
|
|
1204
|
-
|
|
1205
|
-
|
|
1206
|
-
label: string;
|
|
1207
|
-
/** Optional second line shown under the label. */
|
|
1208
|
-
description?: string;
|
|
1209
|
-
}
|
|
1312
|
+
/** Alias of the shared {@link Option} type (kept for backward-compatible imports). */
|
|
1313
|
+
type MultiSelectOption = Option;
|
|
1210
1314
|
|
|
1211
|
-
/**
|
|
1212
|
-
|
|
1213
|
-
group: string;
|
|
1214
|
-
options: Array<string | MultiSelectOption>;
|
|
1215
|
-
}
|
|
1315
|
+
/** Alias of the shared {@link OptionGroup} type (kept for backward-compatible imports). */
|
|
1316
|
+
type MultiSelectGroup = OptionGroup;
|
|
1216
1317
|
|
|
1217
1318
|
declare function MultiSelect(props: MultiSelectProps): React.JSX.Element;
|
|
1218
1319
|
|
|
@@ -1246,6 +1347,12 @@ interface NavbarProps extends React.HTMLAttributes<HTMLElement> {
|
|
|
1246
1347
|
sticky?: boolean;
|
|
1247
1348
|
/** Hamburger handler shown on small screens. */
|
|
1248
1349
|
onMenuClick?: () => void;
|
|
1350
|
+
/** Drives the hamburger's `aria-expanded` and its "Open menu"/"Close menu" accessible name. */
|
|
1351
|
+
menuOpen?: boolean;
|
|
1352
|
+
/** Id of the menu/drawer the hamburger controls (`aria-controls`). */
|
|
1353
|
+
menuControls?: string;
|
|
1354
|
+
/** Accessible name for the links `<nav>` landmark. @default "Primary" */
|
|
1355
|
+
navLabel?: string;
|
|
1249
1356
|
}
|
|
1250
1357
|
|
|
1251
1358
|
declare function Navbar(props: NavbarProps): React.JSX.Element;
|
|
@@ -1268,7 +1375,7 @@ interface PaginationProps extends Omit<React.HTMLAttributes<HTMLElement>, "onCha
|
|
|
1268
1375
|
boundaries?: number;
|
|
1269
1376
|
/** @default "md" */
|
|
1270
1377
|
size?: "sm" | "md" | "lg";
|
|
1271
|
-
/** Show a "Go to" page input for jumping directly to a page. @deprecated
|
|
1378
|
+
/** 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
1379
|
showJumper?: boolean;
|
|
1273
1380
|
/** Show a "Go to" page input for jumping directly to a page; preferred alias for `showJumper`. @default false */
|
|
1274
1381
|
showPageJumper?: boolean;
|
|
@@ -1308,8 +1415,9 @@ declare function Popover(props: PopoverProps): React.JSX.Element;
|
|
|
1308
1415
|
|
|
1309
1416
|
/**
|
|
1310
1417
|
* Linear progress bar — determinate or indeterminate, with semantic tones.
|
|
1311
|
-
* `className` and
|
|
1312
|
-
*
|
|
1418
|
+
* `className` and extra HTML attributes (`style`, `id`, handlers, …) land on the root
|
|
1419
|
+
* wrapper; `role="progressbar"` + `aria-value*` live on the inner track. `aria-label` /
|
|
1420
|
+
* `aria-labelledby` are forwarded onto that track so they actually name the bar.
|
|
1313
1421
|
*/
|
|
1314
1422
|
interface ProgressProps extends React.HTMLAttributes<HTMLDivElement> {
|
|
1315
1423
|
/** Current value. @default 0 */
|
|
@@ -1317,13 +1425,18 @@ interface ProgressProps extends React.HTMLAttributes<HTMLDivElement> {
|
|
|
1317
1425
|
/** Maximum value. @default 100 */
|
|
1318
1426
|
max?: number;
|
|
1319
1427
|
/** @default "primary" */
|
|
1320
|
-
tone?:
|
|
1428
|
+
tone?: BarTone;
|
|
1321
1429
|
/** @default "md" */
|
|
1322
1430
|
size?: "sm" | "md" | "lg";
|
|
1323
1431
|
/** Animate as an indeterminate bar (ignores value). */
|
|
1324
1432
|
indeterminate?: boolean;
|
|
1325
1433
|
/** Show a percentage label above the bar. */
|
|
1326
1434
|
showLabel?: boolean;
|
|
1435
|
+
/**
|
|
1436
|
+
* Visible label in the meta row that also names the progressbar (via `aria-labelledby`).
|
|
1437
|
+
* @default "Progress" (only rendered when `showLabel` or `label` is set)
|
|
1438
|
+
*/
|
|
1439
|
+
label?: React.ReactNode;
|
|
1327
1440
|
}
|
|
1328
1441
|
|
|
1329
1442
|
declare function Progress(props: ProgressProps): React.JSX.Element;
|
|
@@ -1338,7 +1451,7 @@ interface RadioProps extends Omit<React.InputHTMLAttributes<HTMLInputElement>, "
|
|
|
1338
1451
|
error?: React.ReactNode;
|
|
1339
1452
|
size?: "sm" | "md" | "lg";
|
|
1340
1453
|
/** Color intent. @default "primary" */
|
|
1341
|
-
tone?:
|
|
1454
|
+
tone?: Tone;
|
|
1342
1455
|
}
|
|
1343
1456
|
|
|
1344
1457
|
declare function Radio(props: RadioProps): React.JSX.Element;
|
|
@@ -1358,7 +1471,7 @@ interface RatingProps extends Omit<React.HTMLAttributes<HTMLDivElement>, "onChan
|
|
|
1358
1471
|
/** @default "md" */
|
|
1359
1472
|
size?: "sm" | "md" | "lg";
|
|
1360
1473
|
/** Color intent for filled stars. @default "warning" */
|
|
1361
|
-
tone?:
|
|
1474
|
+
tone?: Tone;
|
|
1362
1475
|
/** Explicit filled-star color; overrides `tone` when set. */
|
|
1363
1476
|
color?: string;
|
|
1364
1477
|
/** Display only, no interaction. @default false */
|
|
@@ -1385,7 +1498,7 @@ interface SelectProps extends Omit<React.HTMLAttributes<HTMLButtonElement>, "onC
|
|
|
1385
1498
|
required?: boolean;
|
|
1386
1499
|
size?: "sm" | "md" | "lg";
|
|
1387
1500
|
/** Color intent for the focus/open accent. @default "primary" */
|
|
1388
|
-
tone?:
|
|
1501
|
+
tone?: Tone;
|
|
1389
1502
|
placeholder?: string;
|
|
1390
1503
|
/** Placeholder for the in-popover search box. @default "Search…" */
|
|
1391
1504
|
searchPlaceholder?: string;
|
|
@@ -1416,18 +1529,11 @@ interface SelectProps extends Omit<React.HTMLAttributes<HTMLButtonElement>, "onC
|
|
|
1416
1529
|
minWidth?: number;
|
|
1417
1530
|
}
|
|
1418
1531
|
|
|
1419
|
-
|
|
1420
|
-
|
|
1421
|
-
label: string;
|
|
1422
|
-
/** Optional second line shown under the label. */
|
|
1423
|
-
description?: string;
|
|
1424
|
-
}
|
|
1532
|
+
/** Alias of the shared {@link Option} type (kept for backward-compatible imports). */
|
|
1533
|
+
type SelectOption = Option;
|
|
1425
1534
|
|
|
1426
|
-
/**
|
|
1427
|
-
|
|
1428
|
-
group: string;
|
|
1429
|
-
options: Array<string | SelectOption>;
|
|
1430
|
-
}
|
|
1535
|
+
/** Alias of the shared {@link OptionGroup} type (kept for backward-compatible imports). */
|
|
1536
|
+
type SelectGroup = OptionGroup;
|
|
1431
1537
|
|
|
1432
1538
|
declare function Select(props: SelectProps): React.JSX.Element;
|
|
1433
1539
|
|
|
@@ -1448,6 +1554,7 @@ interface SidebarItem {
|
|
|
1448
1554
|
/**
|
|
1449
1555
|
* Collapsible side navigation — brand header, grouped nav items with icons and
|
|
1450
1556
|
* badges, an optional footer, and a collapse toggle (icon-only when collapsed).
|
|
1557
|
+
* Set `overlay` for a mobile off-canvas drawer (backdrop, focus trap, Escape-to-close).
|
|
1451
1558
|
*
|
|
1452
1559
|
* @startingPoint section="Layout" subtitle="Collapsible side navigation" viewport="280x520"
|
|
1453
1560
|
*/
|
|
@@ -1463,12 +1570,30 @@ interface SidebarProps extends React.HTMLAttributes<HTMLElement> {
|
|
|
1463
1570
|
/** Show the collapse toggle. @default true */
|
|
1464
1571
|
collapsible?: boolean;
|
|
1465
1572
|
onCollapsedChange?: (collapsed: boolean) => void;
|
|
1573
|
+
/**
|
|
1574
|
+
* Render as an off-canvas drawer instead of an in-flow rail: a fixed slide-over
|
|
1575
|
+
* panel behind a dismissable backdrop, portaled to `document.body`, with a focus
|
|
1576
|
+
* trap, Escape-to-close, and body-scroll lock. Drive visibility with
|
|
1577
|
+
* `open`/`defaultOpen`/`onOpenChange`. For a responsive layout, render the rail on
|
|
1578
|
+
* desktop and the overlay on mobile. @default false
|
|
1579
|
+
*/
|
|
1580
|
+
overlay?: boolean;
|
|
1581
|
+
/** Controlled open state of the overlay drawer (only when `overlay`). */
|
|
1582
|
+
open?: boolean;
|
|
1583
|
+
/** Uncontrolled initial open state of the overlay drawer. @default false */
|
|
1584
|
+
defaultOpen?: boolean;
|
|
1585
|
+
/** Called when the overlay drawer requests open/close (backdrop, Escape). */
|
|
1586
|
+
onOpenChange?: (open: boolean) => void;
|
|
1587
|
+
/** Accessible name for the inner `<nav>` landmark (and the overlay dialog). @default "Main" */
|
|
1588
|
+
navLabel?: string;
|
|
1466
1589
|
}
|
|
1467
1590
|
|
|
1468
1591
|
declare function Sidebar(props: SidebarProps): React.JSX.Element;
|
|
1469
1592
|
|
|
1470
1593
|
/**
|
|
1471
|
-
* Shimmering placeholder shown while content loads.
|
|
1594
|
+
* Shimmering placeholder shown while content loads. Decorative by default — the
|
|
1595
|
+
* placeholder gets `aria-hidden="true"` so screen readers skip it. Pass `label` to
|
|
1596
|
+
* instead announce loading via a `role="status"` live region.
|
|
1472
1597
|
*/
|
|
1473
1598
|
interface SkeletonProps extends React.HTMLAttributes<HTMLSpanElement> {
|
|
1474
1599
|
/** Shape preset: "text" line(s), "circle" (1:1 aspect, full radius), or "rect" block (--radius-md). @default "text" */
|
|
@@ -1479,6 +1604,11 @@ interface SkeletonProps extends React.HTMLAttributes<HTMLSpanElement> {
|
|
|
1479
1604
|
height?: string | number;
|
|
1480
1605
|
/** For text variant: number of lines (last is shortened). @default 1 */
|
|
1481
1606
|
lines?: number;
|
|
1607
|
+
/**
|
|
1608
|
+
* When set, announces loading via `role="status"` + `aria-live="polite"` + `aria-busy="true"`
|
|
1609
|
+
* plus visually-hidden text (e.g. "Loading…"); otherwise the placeholder is `aria-hidden="true"`.
|
|
1610
|
+
*/
|
|
1611
|
+
label?: string;
|
|
1482
1612
|
}
|
|
1483
1613
|
|
|
1484
1614
|
declare function Skeleton(props: SkeletonProps): React.JSX.Element;
|
|
@@ -1512,7 +1642,7 @@ interface SliderProps extends Omit<React.HTMLAttributes<HTMLDivElement>, "onChan
|
|
|
1512
1642
|
/** Render step ticks along the rail. @default false */
|
|
1513
1643
|
showTicks?: boolean;
|
|
1514
1644
|
/** Color intent. @default "primary" */
|
|
1515
|
-
tone?:
|
|
1645
|
+
tone?: Tone;
|
|
1516
1646
|
/** Format the displayed value (label + bubble). */
|
|
1517
1647
|
formatValue?: (value: number) => React.ReactNode;
|
|
1518
1648
|
onChange?: (value: number) => void;
|
|
@@ -1527,9 +1657,9 @@ interface SpinnerProps extends React.HTMLAttributes<HTMLSpanElement> {
|
|
|
1527
1657
|
/** @default "md" */
|
|
1528
1658
|
size?: "sm" | "md" | "lg" | "xl";
|
|
1529
1659
|
/** 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" |
|
|
1660
|
+
color?: "current" | Tone | "white";
|
|
1661
|
+
/** Color. @deprecated since 1.4, removed in 2.0 — use `color`. @default "current" — inherits currentColor (visible inside buttons, themed). */
|
|
1662
|
+
tone?: "current" | Tone | "white";
|
|
1533
1663
|
/** Accessible label. @default "Loading" */
|
|
1534
1664
|
label?: string;
|
|
1535
1665
|
}
|
|
@@ -1584,7 +1714,7 @@ interface StepperProps extends React.HTMLAttributes<HTMLDivElement> {
|
|
|
1584
1714
|
/** @default "horizontal" */
|
|
1585
1715
|
orientation?: "horizontal" | "vertical";
|
|
1586
1716
|
/** Color intent. @default "primary" */
|
|
1587
|
-
tone?:
|
|
1717
|
+
tone?: Tone;
|
|
1588
1718
|
/** Allow clicking completed/active steps. @default false */
|
|
1589
1719
|
clickable?: boolean;
|
|
1590
1720
|
/** Fired when a clickable step is clicked. */
|
|
@@ -1605,7 +1735,7 @@ interface SwitchProps extends Omit<React.InputHTMLAttributes<HTMLInputElement>,
|
|
|
1605
1735
|
error?: React.ReactNode;
|
|
1606
1736
|
size?: "sm" | "md" | "lg";
|
|
1607
1737
|
/** Color intent. @default "primary" */
|
|
1608
|
-
tone?:
|
|
1738
|
+
tone?: Tone;
|
|
1609
1739
|
}
|
|
1610
1740
|
|
|
1611
1741
|
declare function Switch(props: SwitchProps): React.JSX.Element;
|
|
@@ -1688,7 +1818,7 @@ interface TabsProps extends Omit<React.HTMLAttributes<HTMLDivElement>, "onChange
|
|
|
1688
1818
|
/** @default "line" */
|
|
1689
1819
|
variant?: "line" | "pill";
|
|
1690
1820
|
/** Color intent. @default "primary" */
|
|
1691
|
-
tone?:
|
|
1821
|
+
tone?: Tone;
|
|
1692
1822
|
/** Layout axis. Vertical stacks the tablist with the indicator on its trailing edge and the panel beside it; ArrowUp/ArrowDown navigate. @default "horizontal" */
|
|
1693
1823
|
orientation?: "horizontal" | "vertical";
|
|
1694
1824
|
}
|
|
@@ -1700,8 +1830,10 @@ interface TabItem {
|
|
|
1700
1830
|
label: React.ReactNode;
|
|
1701
1831
|
/** Optional leading icon. */
|
|
1702
1832
|
icon?: React.ReactNode;
|
|
1703
|
-
/** Optional count pill. */
|
|
1704
|
-
count?:
|
|
1833
|
+
/** Optional count pill (e.g. `12`, `"99+"`, `"1.2k"`, or an element). Renders whenever `count != null` — pass `undefined` to hide a `0`. */
|
|
1834
|
+
count?: React.ReactNode;
|
|
1835
|
+
/** Disable the tab: not selectable via click or keyboard; dimmed and `aria-disabled`. */
|
|
1836
|
+
disabled?: boolean;
|
|
1705
1837
|
/** Panel content rendered when active (omit for nav-only tabs). */
|
|
1706
1838
|
content?: React.ReactNode;
|
|
1707
1839
|
}
|
|
@@ -1714,12 +1846,14 @@ declare function Tabs(props: TabsProps): React.JSX.Element;
|
|
|
1714
1846
|
interface TagProps extends React.HTMLAttributes<HTMLSpanElement> {
|
|
1715
1847
|
/** Show a remove (×) button and handle its click. */
|
|
1716
1848
|
onRemove?: (e: React.MouseEvent<HTMLButtonElement>) => void;
|
|
1849
|
+
/** Accessible label for the remove (×) button. Defaults to `Remove {children}` when children is a string, else "Remove". */
|
|
1850
|
+
removeLabel?: string;
|
|
1717
1851
|
/** Optional leading icon. */
|
|
1718
1852
|
leftIcon?: React.ReactNode;
|
|
1719
1853
|
/** Fill style. @default "soft" */
|
|
1720
1854
|
variant?: "soft" | "solid" | "outline";
|
|
1721
1855
|
/** Color intent. @default "neutral" */
|
|
1722
|
-
tone?:
|
|
1856
|
+
tone?: Tone;
|
|
1723
1857
|
children?: React.ReactNode;
|
|
1724
1858
|
}
|
|
1725
1859
|
|
|
@@ -1740,7 +1874,7 @@ interface TextareaProps extends React.TextareaHTMLAttributes<HTMLTextAreaElement
|
|
|
1740
1874
|
/** Control size — same padding steps as Input. @default "md" */
|
|
1741
1875
|
size?: "sm" | "md" | "lg";
|
|
1742
1876
|
/** Color intent for the focus/open accent. @default "primary" */
|
|
1743
|
-
tone?:
|
|
1877
|
+
tone?: Tone;
|
|
1744
1878
|
}
|
|
1745
1879
|
|
|
1746
1880
|
declare function Textarea(props: TextareaProps): React.JSX.Element;
|
|
@@ -1755,7 +1889,7 @@ interface TimelineItem {
|
|
|
1755
1889
|
/** Icon inside the node dot. */
|
|
1756
1890
|
icon?: React.ReactNode;
|
|
1757
1891
|
/** Node color. */
|
|
1758
|
-
tone?:
|
|
1892
|
+
tone?: BarTone;
|
|
1759
1893
|
}
|
|
1760
1894
|
|
|
1761
1895
|
/**
|
|
@@ -1776,7 +1910,7 @@ declare function Timeline(props: TimelineProps): React.JSX.Element;
|
|
|
1776
1910
|
*/
|
|
1777
1911
|
interface ToastProps extends Omit<React.HTMLAttributes<HTMLDivElement>, "title"> {
|
|
1778
1912
|
/** Semantic tone. `"neutral"` is an alias for `"default"` (matches Badge's vocabulary). @default "default" */
|
|
1779
|
-
tone?:
|
|
1913
|
+
tone?: ToastTone;
|
|
1780
1914
|
/** Bold heading. */
|
|
1781
1915
|
title?: React.ReactNode;
|
|
1782
1916
|
/** Override the tone icon. */
|
|
@@ -1802,7 +1936,7 @@ declare function ToastViewport(props: ToastViewportProps): React.JSX.Element;
|
|
|
1802
1936
|
/** A single toast's options when pushed imperatively. */
|
|
1803
1937
|
interface ToastOptions {
|
|
1804
1938
|
/** @default "default" */
|
|
1805
|
-
tone?:
|
|
1939
|
+
tone?: ToastTone;
|
|
1806
1940
|
/** Bold heading. */
|
|
1807
1941
|
title?: React.ReactNode;
|
|
1808
1942
|
/** Body/description content. */
|
|
@@ -1921,6 +2055,19 @@ interface AppShellProps extends Omit<React.HTMLAttributes<HTMLDivElement>, "chil
|
|
|
1921
2055
|
height?: string | number;
|
|
1922
2056
|
/** Pad the scrollable content region. @default true */
|
|
1923
2057
|
padded?: boolean;
|
|
2058
|
+
/** Id for the `<main>` content region and the skip-link target. @default "twc-main" */
|
|
2059
|
+
mainId?: string;
|
|
2060
|
+
/** 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" */
|
|
2061
|
+
skipLinkLabel?: React.ReactNode | false;
|
|
2062
|
+
/**
|
|
2063
|
+
* Open state of the sidebar's off-canvas drawer on mobile. Providing this (or
|
|
2064
|
+
* `onSidebarOpenChange`) makes the shell forward `overlay`/`open`/`onOpenChange`
|
|
2065
|
+
* to the `sidebar` element, so it renders as a drawer. Respects any of those
|
|
2066
|
+
* props the sidebar already sets.
|
|
2067
|
+
*/
|
|
2068
|
+
sidebarOpen?: boolean;
|
|
2069
|
+
/** Called when the sidebar drawer requests open/close (backdrop, Escape) — wire a `Navbar`'s `onMenuClick` to `() => onSidebarOpenChange(true)`. */
|
|
2070
|
+
onSidebarOpenChange?: (open: boolean) => void;
|
|
1924
2071
|
}
|
|
1925
2072
|
|
|
1926
2073
|
declare function AppShell(props: AppShellProps): React.JSX.Element;
|
|
@@ -1928,7 +2075,7 @@ declare function AppShell(props: AppShellProps): React.JSX.Element;
|
|
|
1928
2075
|
/** Generic, token-styled element — the building block for non-flex layout. */
|
|
1929
2076
|
interface BoxProps extends React.HTMLAttributes<HTMLElement> {
|
|
1930
2077
|
/** Element/tag to render. @default "div" */
|
|
1931
|
-
as?:
|
|
2078
|
+
as?: PolymorphicAs;
|
|
1932
2079
|
/** Link destination — only used with as="a"; scheme-sanitized (javascript:/data:/vbscript: render without href). */
|
|
1933
2080
|
href?: string;
|
|
1934
2081
|
/** Anchor target — only used with as="a" (e.g. "_blank"). */
|
|
@@ -1966,7 +2113,7 @@ declare function Box(props: BoxProps): React.JSX.Element;
|
|
|
1966
2113
|
/** Centered, max-width content wrapper with responsive horizontal padding. */
|
|
1967
2114
|
interface ContainerProps extends React.HTMLAttributes<HTMLElement> {
|
|
1968
2115
|
/** Element/tag to render. @default "div" */
|
|
1969
|
-
as?:
|
|
2116
|
+
as?: PolymorphicAs;
|
|
1970
2117
|
/** Link destination — only used with as="a"; scheme-sanitized (javascript:/data:/vbscript: render without href). */
|
|
1971
2118
|
href?: string;
|
|
1972
2119
|
/** Anchor target — only used with as="a" (e.g. "_blank"). */
|
|
@@ -1981,24 +2128,35 @@ interface ContainerProps extends React.HTMLAttributes<HTMLElement> {
|
|
|
1981
2128
|
|
|
1982
2129
|
declare function Container(props: ContainerProps): React.JSX.Element;
|
|
1983
2130
|
|
|
2131
|
+
/** Responsive column counts per breakpoint (base + sm/md/lg/xl at 640/768/1024/1280px). */
|
|
2132
|
+
type ResponsiveColumns = { base?: number; sm?: number; md?: number; lg?: number; xl?: number };
|
|
2133
|
+
|
|
1984
2134
|
/** CSS grid primitive — fixed columns or a responsive auto-fill grid. */
|
|
1985
2135
|
interface GridProps extends React.HTMLAttributes<HTMLElement> {
|
|
1986
2136
|
/** Element/tag to render. @default "div" */
|
|
1987
|
-
as?:
|
|
2137
|
+
as?: PolymorphicAs;
|
|
1988
2138
|
/** Link destination — only used with as="a"; scheme-sanitized (javascript:/data:/vbscript: render without href). */
|
|
1989
2139
|
href?: string;
|
|
1990
2140
|
/** Anchor target — only used with as="a" (e.g. "_blank"). */
|
|
1991
2141
|
target?: React.HTMLAttributeAnchorTarget;
|
|
1992
2142
|
/** Anchor rel — only used with as="a"; pair "noopener noreferrer" with target="_blank". */
|
|
1993
2143
|
rel?: string;
|
|
1994
|
-
/** Fixed
|
|
1995
|
-
columns?: number;
|
|
2144
|
+
/** Fixed column count, or a responsive object `{ base, sm, md, lg, xl }` (ignored when `minChildWidth` is set). */
|
|
2145
|
+
columns?: number | ResponsiveColumns;
|
|
1996
2146
|
/** Responsive auto-fill: minimum child width (number = px, or any CSS length). */
|
|
1997
2147
|
minChildWidth?: number | string;
|
|
1998
|
-
/** Gap as a spacing-scale step (number) or any CSS length. @default 4 */
|
|
2148
|
+
/** Gap (both axes) as a spacing-scale step (number) or any CSS length. @default 4 */
|
|
1999
2149
|
gap?: number | string;
|
|
2150
|
+
/** Row gap — falls back to `gap`. */
|
|
2151
|
+
rowGap?: number | string;
|
|
2152
|
+
/** Column gap — falls back to `gap`. */
|
|
2153
|
+
columnGap?: number | string;
|
|
2000
2154
|
align?: React.CSSProperties["alignItems"];
|
|
2001
2155
|
justify?: React.CSSProperties["justifyItems"];
|
|
2156
|
+
/** Distribute the grid's rows within extra block space. */
|
|
2157
|
+
alignContent?: React.CSSProperties["alignContent"];
|
|
2158
|
+
/** Distribute the grid's columns within extra inline space. */
|
|
2159
|
+
justifyContent?: React.CSSProperties["justifyContent"];
|
|
2002
2160
|
}
|
|
2003
2161
|
|
|
2004
2162
|
declare function Grid(props: GridProps): React.JSX.Element;
|
|
@@ -2006,7 +2164,7 @@ declare function Grid(props: GridProps): React.JSX.Element;
|
|
|
2006
2164
|
/** Flex layout primitive — rows or columns with token-based gaps. */
|
|
2007
2165
|
interface StackProps extends React.HTMLAttributes<HTMLElement> {
|
|
2008
2166
|
/** Element/tag to render. @default "div" */
|
|
2009
|
-
as?:
|
|
2167
|
+
as?: PolymorphicAs;
|
|
2010
2168
|
/** Link destination — only used with as="a"; scheme-sanitized (javascript:/data:/vbscript: render without href). */
|
|
2011
2169
|
href?: string;
|
|
2012
2170
|
/** Anchor target — only used with as="a" (e.g. "_blank"). */
|
|
@@ -2023,14 +2181,38 @@ interface StackProps extends React.HTMLAttributes<HTMLElement> {
|
|
|
2023
2181
|
wrap?: boolean;
|
|
2024
2182
|
/** Use inline-flex instead of flex. @default false */
|
|
2025
2183
|
inline?: boolean;
|
|
2184
|
+
/** Padding — all sides. Spacing step (number) or any CSS length. */
|
|
2185
|
+
p?: number | string;
|
|
2186
|
+
/** Horizontal (inline) padding. */
|
|
2187
|
+
px?: number | string;
|
|
2188
|
+
/** Vertical (block) padding. */
|
|
2189
|
+
py?: number | string;
|
|
2190
|
+
/** Top padding (overrides `py`/`p`). */
|
|
2191
|
+
pt?: number | string;
|
|
2192
|
+
/** Right padding (overrides `px`/`p`). */
|
|
2193
|
+
pr?: number | string;
|
|
2194
|
+
/** Bottom padding (overrides `py`/`p`). */
|
|
2195
|
+
pb?: number | string;
|
|
2196
|
+
/** Left padding (overrides `px`/`p`). */
|
|
2197
|
+
pl?: number | string;
|
|
2198
|
+
/** Node rendered between each child (not before the first or after the last). Pass an orientation-appropriate `Divider`. */
|
|
2199
|
+
divider?: React.ReactNode;
|
|
2026
2200
|
}
|
|
2027
2201
|
|
|
2028
2202
|
declare function Stack(props: StackProps): React.JSX.Element;
|
|
2029
2203
|
|
|
2030
|
-
/** Inline code
|
|
2204
|
+
/** Inline code, or a scrollable multi-line block with an optional copy button. */
|
|
2031
2205
|
interface CodeProps extends React.HTMLAttributes<HTMLElement> {
|
|
2032
|
-
/** Element/tag to render. @default "code" */
|
|
2033
|
-
as?:
|
|
2206
|
+
/** Element/tag or component to render. @default "code" (or "pre" when `block`) */
|
|
2207
|
+
as?: PolymorphicAs;
|
|
2208
|
+
/** Render a scrollable multi-line `<pre>` block instead of the inline pill; defaults `as` to "pre". @default false */
|
|
2209
|
+
block?: boolean;
|
|
2210
|
+
/** Show a copy-to-clipboard button (typically with `block`). @default false */
|
|
2211
|
+
copyable?: boolean;
|
|
2212
|
+
/** Accessible label for the copy button. @default "Copy code" */
|
|
2213
|
+
copyLabel?: string;
|
|
2214
|
+
/** Accessible label announced after a successful copy. @default "Copied" */
|
|
2215
|
+
copiedLabel?: string;
|
|
2034
2216
|
/** Link destination — only used with as="a"; scheme-sanitized (javascript:/data:/vbscript: render without href). */
|
|
2035
2217
|
href?: string;
|
|
2036
2218
|
/** Anchor target — only used with as="a" (e.g. "_blank"). */
|
|
@@ -2041,10 +2223,17 @@ interface CodeProps extends React.HTMLAttributes<HTMLElement> {
|
|
|
2041
2223
|
|
|
2042
2224
|
declare function Code(props: CodeProps): React.JSX.Element;
|
|
2043
2225
|
|
|
2044
|
-
/**
|
|
2226
|
+
/** Font-size token suffixes available to `Heading` (see tokens/typography.css). */
|
|
2227
|
+
type HeadingSize =
|
|
2228
|
+
| "xs" | "sm" | "base" | "lg" | "xl" | "2xl" | "3xl" | "4xl" | "5xl" | "6xl" | "7xl" | "display";
|
|
2229
|
+
|
|
2230
|
+
/**
|
|
2231
|
+
* Heading (h1–h6) with token typography. `level` sets the tag/semantics; `size` sets the visual
|
|
2232
|
+
* scale — the two are intentionally independent (e.g. a semantic `<h1>` at a small size).
|
|
2233
|
+
*/
|
|
2045
2234
|
interface HeadingProps extends React.HTMLAttributes<HTMLElement> {
|
|
2046
2235
|
/** Override the rendered tag (e.g. render a visual h2 as an h1). */
|
|
2047
|
-
as?:
|
|
2236
|
+
as?: PolymorphicAs;
|
|
2048
2237
|
/** Link destination — only used with as="a"; scheme-sanitized (javascript:/data:/vbscript: render without href). */
|
|
2049
2238
|
href?: string;
|
|
2050
2239
|
/** Anchor target — only used with as="a" (e.g. "_blank"). */
|
|
@@ -2053,9 +2242,15 @@ interface HeadingProps extends React.HTMLAttributes<HTMLElement> {
|
|
|
2053
2242
|
rel?: string;
|
|
2054
2243
|
/** Heading level 1–6 — sets the tag and the default size. @default 2 */
|
|
2055
2244
|
level?: 1 | 2 | 3 | 4 | 5 | 6;
|
|
2056
|
-
/**
|
|
2057
|
-
size?:
|
|
2245
|
+
/** Font-size token (xs…7xl or display), independent of `level`. */
|
|
2246
|
+
size?: HeadingSize;
|
|
2247
|
+
/** Convenience: render at the display size (`var(--text-display)`) regardless of level. @default false */
|
|
2248
|
+
display?: boolean;
|
|
2058
2249
|
align?: React.CSSProperties["textAlign"];
|
|
2250
|
+
/** Single-line ellipsis truncation (adds min-width:0 so it shrinks in a flex parent). @default false */
|
|
2251
|
+
truncate?: boolean;
|
|
2252
|
+
/** Clamp to N lines with an ellipsis (multi-line, -webkit-line-clamp). Overrides `truncate`. */
|
|
2253
|
+
lineClamp?: number;
|
|
2059
2254
|
}
|
|
2060
2255
|
|
|
2061
2256
|
declare function Heading(props: HeadingProps): React.JSX.Element;
|
|
@@ -2063,7 +2258,7 @@ declare function Heading(props: HeadingProps): React.JSX.Element;
|
|
|
2063
2258
|
/** Body text with token sizes and semantic color tones. Renders <p> by default. */
|
|
2064
2259
|
interface TextProps extends React.HTMLAttributes<HTMLElement> {
|
|
2065
2260
|
/** Element/tag to render (e.g. "span", "p"). @default "p" */
|
|
2066
|
-
as?:
|
|
2261
|
+
as?: PolymorphicAs;
|
|
2067
2262
|
/** Link destination — only used with as="a"; scheme-sanitized (javascript:/data:/vbscript: render without href). */
|
|
2068
2263
|
href?: string;
|
|
2069
2264
|
/** Anchor target — only used with as="a" (e.g. "_blank"). */
|
|
@@ -2072,11 +2267,15 @@ interface TextProps extends React.HTMLAttributes<HTMLElement> {
|
|
|
2072
2267
|
rel?: string;
|
|
2073
2268
|
/** Font-size token suffix. @default "base" */
|
|
2074
2269
|
size?: "xs" | "sm" | "base" | "lg" | "xl" | string;
|
|
2075
|
-
/** Semantic color tone — text roles (default/muted/subtle)
|
|
2076
|
-
tone?:
|
|
2270
|
+
/** Semantic color tone — text roles (default/muted/subtle), the color intents, or `"inherit"` to adopt the parent color. @default "default" */
|
|
2271
|
+
tone?: TextTone;
|
|
2077
2272
|
/** Font-weight token suffix (e.g. "medium", "semibold", "bold"). */
|
|
2078
2273
|
weight?: "medium" | "semibold" | "bold" | string;
|
|
2079
2274
|
align?: React.CSSProperties["textAlign"];
|
|
2275
|
+
/** Single-line ellipsis truncation (adds min-width:0 so it shrinks in a flex parent). @default false */
|
|
2276
|
+
truncate?: boolean;
|
|
2277
|
+
/** Clamp to N lines with an ellipsis (multi-line, -webkit-line-clamp). Overrides `truncate`. */
|
|
2278
|
+
lineClamp?: number;
|
|
2080
2279
|
}
|
|
2081
2280
|
|
|
2082
2281
|
declare function Text(props: TextProps): React.JSX.Element;
|
|
@@ -2104,15 +2303,30 @@ declare function useDisclosure(initial?: boolean): {
|
|
|
2104
2303
|
setOpen: React.Dispatch<React.SetStateAction<boolean>>;
|
|
2105
2304
|
};
|
|
2106
2305
|
|
|
2107
|
-
/**
|
|
2306
|
+
/**
|
|
2307
|
+
* Controlled/uncontrolled state — the pattern every form component needs.
|
|
2308
|
+
* Returns `[value, setValue, isControlled]`; the third element reports whether a
|
|
2309
|
+
* `value` prop is currently driving the state. In development it warns once if a
|
|
2310
|
+
* component switches between controlled and uncontrolled.
|
|
2311
|
+
*/
|
|
2108
2312
|
declare function useControllableState<T>(options?: {
|
|
2109
2313
|
value?: T;
|
|
2110
2314
|
defaultValue?: T;
|
|
2111
2315
|
onChange?: (value: T) => void;
|
|
2112
|
-
}): [T, (next: T | ((prev: T) => T)) => void];
|
|
2316
|
+
}): [T, (next: T | ((prev: T) => T)) => void, boolean];
|
|
2113
2317
|
|
|
2114
|
-
|
|
2115
|
-
|
|
2318
|
+
interface UseMediaQueryOptions {
|
|
2319
|
+
/** Value on the server and first client render (before the after-mount sync). @default false */
|
|
2320
|
+
defaultValue?: boolean;
|
|
2321
|
+
/** Read `matchMedia` eagerly in the initializer — client-only apps with no SSR. @default false */
|
|
2322
|
+
initializeWithValue?: boolean;
|
|
2323
|
+
}
|
|
2324
|
+
|
|
2325
|
+
/**
|
|
2326
|
+
* Reactively match a media query. Returns `defaultValue` on the server and the
|
|
2327
|
+
* first client render, then syncs after mount — so hydration never mismatches.
|
|
2328
|
+
*/
|
|
2329
|
+
declare function useMediaQuery(query: string, options?: UseMediaQueryOptions): boolean;
|
|
2116
2330
|
|
|
2117
2331
|
/** `true` when the user requests reduced motion. */
|
|
2118
2332
|
declare function usePrefersReducedMotion(): boolean;
|
|
@@ -2140,13 +2354,13 @@ declare function useColorScheme(options?: UseColorSchemeOptions): {
|
|
|
2140
2354
|
declare function useEventListener(
|
|
2141
2355
|
eventName: string,
|
|
2142
2356
|
handler: (event: any) => void,
|
|
2143
|
-
element?: React.RefObject<any> | EventTarget | null,
|
|
2357
|
+
element?: React.RefObject<any | null> | EventTarget | null,
|
|
2144
2358
|
options?: boolean | AddEventListenerOptions
|
|
2145
2359
|
): void;
|
|
2146
2360
|
|
|
2147
2361
|
/** Call `handler` when a pointer/touch event lands outside `ref`. */
|
|
2148
2362
|
declare function useClickOutside<T extends HTMLElement = HTMLElement>(
|
|
2149
|
-
ref: React.RefObject<T>,
|
|
2363
|
+
ref: React.RefObject<T | null>,
|
|
2150
2364
|
handler: (event: Event) => void,
|
|
2151
2365
|
events?: string[]
|
|
2152
2366
|
): void;
|
|
@@ -2197,11 +2411,11 @@ declare function useTimeout(callback: () => void, delay: number | null): void;
|
|
|
2197
2411
|
declare function useWindowSize(): { width: number; height: number };
|
|
2198
2412
|
|
|
2199
2413
|
/** `true` while the pointer is over the element referenced by `ref`. */
|
|
2200
|
-
declare function useHover<T extends HTMLElement = HTMLElement>(ref: React.RefObject<T>): boolean;
|
|
2414
|
+
declare function useHover<T extends HTMLElement = HTMLElement>(ref: React.RefObject<T | null>): boolean;
|
|
2201
2415
|
|
|
2202
2416
|
/** The latest IntersectionObserver entry for the element referenced by `ref`. */
|
|
2203
2417
|
declare function useIntersectionObserver<T extends HTMLElement = HTMLElement>(
|
|
2204
|
-
ref: React.RefObject<T>,
|
|
2418
|
+
ref: React.RefObject<T | null>,
|
|
2205
2419
|
options?: IntersectionObserverInit
|
|
2206
2420
|
): IntersectionObserverEntry | null;
|
|
2207
2421
|
|
|
@@ -2211,4 +2425,28 @@ declare function useScrollLock(locked?: boolean): void;
|
|
|
2211
2425
|
/** A stable, SSR-safe unique id (optionally prefixed). */
|
|
2212
2426
|
declare function useId(prefix?: string): string;
|
|
2213
2427
|
|
|
2214
|
-
|
|
2428
|
+
/** Options for {@link useFocusTrap}. */
|
|
2429
|
+
interface UseFocusTrapOptions {
|
|
2430
|
+
/** Restore focus to the previously-focused element when the trap deactivates. @default true */
|
|
2431
|
+
restoreFocus?: boolean;
|
|
2432
|
+
}
|
|
2433
|
+
|
|
2434
|
+
/**
|
|
2435
|
+
* Trap focus inside the modal region referenced by `ref`. While `active`, focus
|
|
2436
|
+
* moves inside on activate, Tab/Shift+Tab cycle within it, and (by default) focus
|
|
2437
|
+
* is restored to the previously-focused element on deactivate. Escape is NOT
|
|
2438
|
+
* handled — that stays with the component. SSR-safe.
|
|
2439
|
+
*/
|
|
2440
|
+
declare function useFocusTrap<T extends HTMLElement = HTMLElement>(
|
|
2441
|
+
ref: React.RefObject<T | null>,
|
|
2442
|
+
active?: boolean,
|
|
2443
|
+
options?: UseFocusTrapOptions
|
|
2444
|
+
): void;
|
|
2445
|
+
|
|
2446
|
+
/**
|
|
2447
|
+
* Returns a stable `render(node)` that portals `node` to `document.body`, or `null`
|
|
2448
|
+
* on the server (no document). Centralizes the overlay portal pattern.
|
|
2449
|
+
*/
|
|
2450
|
+
declare function usePortal(): (node: React.ReactNode) => React.ReactPortal | React.ReactNode | null;
|
|
2451
|
+
|
|
2452
|
+
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, 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 };
|