twico-ui 0.1.0 → 1.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -21
- package/README.md +233 -182
- package/dist/colors.cjs +98 -0
- package/dist/colors.cjs.map +1 -0
- package/dist/colors.d.cts +181 -0
- package/dist/colors.d.ts +181 -0
- package/dist/colors.mjs +86 -0
- package/dist/colors.mjs.map +1 -0
- package/dist/index.cjs +4574 -1063
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +2083 -1395
- package/dist/index.d.ts +2083 -1395
- package/dist/index.mjs +4541 -1064
- package/dist/index.mjs.map +1 -1
- package/package.json +117 -71
- package/styles/fonts/OFL-PlusJakartaSans.txt +93 -93
- package/styles/twico-ui.css +607 -546
package/dist/index.d.cts
CHANGED
|
@@ -1,1501 +1,2189 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
2
|
|
|
3
|
-
/**
|
|
4
|
-
* Vertically stacked, expandable disclosure panels with smooth height animation.
|
|
5
|
-
*
|
|
6
|
-
* @startingPoint section="Navigation" subtitle="Expandable disclosure panels" viewport="700x300"
|
|
7
|
-
*/
|
|
8
|
-
interface AccordionProps extends React.HTMLAttributes<HTMLDivElement> {
|
|
9
|
-
items: AccordionItem[];
|
|
10
|
-
/** Allow multiple panels open at once. @default false */
|
|
11
|
-
multiple?: boolean;
|
|
12
|
-
/** Values open on first render. */
|
|
13
|
-
defaultOpen?: string[];
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
3
|
+
/**
|
|
4
|
+
* Vertically stacked, expandable disclosure panels with smooth height animation.
|
|
5
|
+
*
|
|
6
|
+
* @startingPoint section="Navigation" subtitle="Expandable disclosure panels" viewport="700x300"
|
|
7
|
+
*/
|
|
8
|
+
interface AccordionProps extends React.HTMLAttributes<HTMLDivElement> {
|
|
9
|
+
items: AccordionItem[];
|
|
10
|
+
/** Allow multiple panels open at once. @default false */
|
|
11
|
+
multiple?: boolean;
|
|
12
|
+
/** Values open on first render. */
|
|
13
|
+
defaultOpen?: string[];
|
|
14
|
+
/** Controlled open panel values; pair with `onOpenChange`. */
|
|
15
|
+
open?: string[];
|
|
16
|
+
/** Called with the next open values whenever a panel is toggled. */
|
|
17
|
+
onOpenChange?: (values: string[]) => void;
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
interface AccordionItem {
|
|
21
|
+
value: string;
|
|
22
|
+
label: React.ReactNode;
|
|
23
|
+
content: React.ReactNode;
|
|
24
|
+
icon?: React.ReactNode;
|
|
25
|
+
}
|
|
26
|
+
|
|
23
27
|
declare function Accordion(props: AccordionProps): React.JSX.Element;
|
|
24
28
|
|
|
25
|
-
/**
|
|
26
|
-
* Inline message banner with semantic tones, optional title, icon, and dismiss.
|
|
27
|
-
*/
|
|
28
|
-
interface AlertProps extends React.HTMLAttributes<HTMLDivElement> {
|
|
29
|
-
/** @default "info" */
|
|
30
|
-
tone?: "info" | "success" | "warning" | "danger";
|
|
31
|
-
/**
|
|
32
|
-
|
|
33
|
-
/**
|
|
34
|
-
|
|
35
|
-
/**
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
29
|
+
/**
|
|
30
|
+
* Inline message banner with semantic tones, optional title, icon, and dismiss.
|
|
31
|
+
*/
|
|
32
|
+
interface AlertProps extends Omit<React.HTMLAttributes<HTMLDivElement>, "title"> {
|
|
33
|
+
/** Color intent. @default "info" */
|
|
34
|
+
tone?: "info" | "success" | "warning" | "danger" | "primary" | "neutral";
|
|
35
|
+
/** Fill style. @default "soft" */
|
|
36
|
+
variant?: "soft" | "solid" | "outline";
|
|
37
|
+
/** Bold heading line. */
|
|
38
|
+
title?: React.ReactNode;
|
|
39
|
+
/** Override the default tone icon. */
|
|
40
|
+
icon?: React.ReactNode;
|
|
41
|
+
/** Show a close button and handle dismissal. */
|
|
42
|
+
onClose?: () => void;
|
|
43
|
+
children?: React.ReactNode;
|
|
44
|
+
}
|
|
45
|
+
|
|
40
46
|
declare function Alert(props: AlertProps): React.JSX.Element;
|
|
41
47
|
|
|
42
|
-
/**
|
|
43
|
-
* User avatar — image with graceful fallback to initials, optional status dot.
|
|
44
|
-
*/
|
|
45
|
-
interface AvatarProps extends React.HTMLAttributes<HTMLSpanElement> {
|
|
46
|
-
/** Image URL. Falls back to initials on error or when absent. */
|
|
47
|
-
src?: string;
|
|
48
|
-
/** Full name — used for initials and the accessible label. */
|
|
49
|
-
name?: string;
|
|
50
|
-
/** @default "md" */
|
|
51
|
-
size?: "xs" | "sm" | "md" | "lg" | "xl";
|
|
52
|
-
/** Rounded-square instead of circle. */
|
|
53
|
-
square?: boolean;
|
|
54
|
-
/** Presence indicator. */
|
|
55
|
-
status?: "online" | "busy" | "away" | "offline";
|
|
56
|
-
/** Adds a brand ring around the avatar. */
|
|
57
|
-
ring?: boolean;
|
|
58
|
-
}
|
|
59
|
-
|
|
48
|
+
/**
|
|
49
|
+
* User avatar — image with graceful fallback to initials, optional status dot.
|
|
50
|
+
*/
|
|
51
|
+
interface AvatarProps extends React.HTMLAttributes<HTMLSpanElement> {
|
|
52
|
+
/** Image URL. Falls back to initials on error or when absent. */
|
|
53
|
+
src?: string;
|
|
54
|
+
/** Full name — used for initials and the accessible label. */
|
|
55
|
+
name?: string;
|
|
56
|
+
/** @default "md" */
|
|
57
|
+
size?: "xs" | "sm" | "md" | "lg" | "xl";
|
|
58
|
+
/** Rounded-square instead of circle. */
|
|
59
|
+
square?: boolean;
|
|
60
|
+
/** Presence indicator. */
|
|
61
|
+
status?: "online" | "busy" | "away" | "offline";
|
|
62
|
+
/** Adds a brand ring around the avatar. */
|
|
63
|
+
ring?: boolean;
|
|
64
|
+
}
|
|
65
|
+
|
|
60
66
|
declare function Avatar(props: AvatarProps): React.JSX.Element;
|
|
61
67
|
|
|
62
|
-
interface MenuItemDef {
|
|
63
|
-
/** Item label (also used for a heading when `heading` is true). */
|
|
64
|
-
label?: React.ReactNode;
|
|
65
|
-
/** Leading icon. */
|
|
66
|
-
icon?: React.ReactNode;
|
|
67
|
-
/** Click handler — menu closes after it runs. */
|
|
68
|
-
onClick?: () => void;
|
|
69
|
-
/** Right-aligned shortcut hint (mono). */
|
|
70
|
-
shortcut?: string;
|
|
71
|
-
/** Render in danger color. */
|
|
72
|
-
danger?: boolean;
|
|
73
|
-
disabled?: boolean;
|
|
74
|
-
/** Render a divider line (ignores other fields). */
|
|
75
|
-
separator?: boolean;
|
|
76
|
-
/** Render as an uppercase section heading. */
|
|
77
|
-
heading?: boolean;
|
|
78
|
-
}
|
|
79
|
-
|
|
80
|
-
/**
|
|
81
|
-
* Dropdown menu. Provide a `trigger` element and an `items` array. Renders in a
|
|
82
|
-
* portal (never clipped), auto-flips near the viewport edge, supports an optional
|
|
83
|
-
* rich `header`, and is keyboard-navigable (↑/↓, Enter, Esc).
|
|
84
|
-
* click, Esc, or item selection.
|
|
85
|
-
*
|
|
86
|
-
* @startingPoint section="Overlay" subtitle="Dropdown menu with headings & shortcuts" viewport="700x360"
|
|
87
|
-
*/
|
|
88
|
-
interface MenuProps extends React.HTMLAttributes<HTMLSpanElement> {
|
|
89
|
-
/** Clickable trigger (e.g. a Button or IconButton). */
|
|
90
|
-
trigger: React.ReactNode;
|
|
91
|
-
items: MenuItemDef[];
|
|
92
|
-
/** Horizontal alignment to the trigger. @default "start" */
|
|
93
|
-
align?: "start" | "end";
|
|
94
|
-
/** Optional rich header node rendered above the items (e.g. user info). */
|
|
95
|
-
header?: React.ReactNode;
|
|
96
|
-
/** Fixed menu width in px (defaults to max(200, trigger width)). */
|
|
97
|
-
width?: number;
|
|
98
|
-
|
|
99
|
-
|
|
68
|
+
interface MenuItemDef {
|
|
69
|
+
/** Item label (also used for a heading when `heading` is true). */
|
|
70
|
+
label?: React.ReactNode;
|
|
71
|
+
/** Leading icon. */
|
|
72
|
+
icon?: React.ReactNode;
|
|
73
|
+
/** Click handler — menu closes after it runs. */
|
|
74
|
+
onClick?: () => void;
|
|
75
|
+
/** Right-aligned shortcut hint (mono). */
|
|
76
|
+
shortcut?: string;
|
|
77
|
+
/** Render in danger color. */
|
|
78
|
+
danger?: boolean;
|
|
79
|
+
disabled?: boolean;
|
|
80
|
+
/** Render a divider line (ignores other fields). */
|
|
81
|
+
separator?: boolean;
|
|
82
|
+
/** Render as an uppercase section heading. */
|
|
83
|
+
heading?: boolean;
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
/**
|
|
87
|
+
* Dropdown menu. Provide a `trigger` element and an `items` array. Renders in a
|
|
88
|
+
* portal (never clipped), auto-flips near the viewport edge, supports an optional
|
|
89
|
+
* rich `header`, and is keyboard-navigable (↑/↓, Home/End, Enter/Space, Esc).
|
|
90
|
+
* Closes on outside click, Esc, or item selection.
|
|
91
|
+
*
|
|
92
|
+
* @startingPoint section="Overlay" subtitle="Dropdown menu with headings & shortcuts" viewport="700x360"
|
|
93
|
+
*/
|
|
94
|
+
interface MenuProps extends React.HTMLAttributes<HTMLSpanElement> {
|
|
95
|
+
/** Clickable trigger (e.g. a Button or IconButton). */
|
|
96
|
+
trigger: React.ReactNode;
|
|
97
|
+
items: MenuItemDef[];
|
|
98
|
+
/** Horizontal alignment to the trigger. @default "start" */
|
|
99
|
+
align?: "start" | "end";
|
|
100
|
+
/** Optional rich header node rendered above the items (e.g. user info). */
|
|
101
|
+
header?: React.ReactNode;
|
|
102
|
+
/** Fixed menu width in px (defaults to max(200, trigger width)). */
|
|
103
|
+
width?: number;
|
|
104
|
+
/** Open on first render in uncontrolled mode. @default false */
|
|
105
|
+
defaultOpen?: boolean;
|
|
106
|
+
/** Controlled open state — pair with `onOpenChange`. Omit for internal (uncontrolled) state. */
|
|
107
|
+
open?: boolean;
|
|
108
|
+
/** Called with the requested open state on trigger click, item select, Esc, or outside click. */
|
|
109
|
+
onOpenChange?: (open: boolean) => void;
|
|
110
|
+
}
|
|
111
|
+
|
|
100
112
|
declare function Menu(props: MenuProps): React.JSX.Element;
|
|
101
113
|
|
|
102
|
-
/**
|
|
103
|
-
* Avatar that opens a dropdown menu of account options — the classic user menu.
|
|
104
|
-
* Shows the user's avatar (optionally with name/email), and a portaled menu with
|
|
105
|
-
* a rich header (avatar + name + email) above the items.
|
|
106
|
-
*
|
|
107
|
-
* @startingPoint section="Data display" subtitle="Avatar account menu" viewport="700x320"
|
|
108
|
-
*/
|
|
109
|
-
interface AvatarMenuProps extends Omit<React.HTMLAttributes<HTMLSpanElement>, "title"> {
|
|
110
|
-
/** User's full name (drives initials + header). */
|
|
111
|
-
name?: string;
|
|
112
|
-
/** Avatar image URL. */
|
|
113
|
-
src?: string;
|
|
114
|
-
/** Email shown in the header (and trigger when `showName`). */
|
|
115
|
-
email?: string;
|
|
116
|
-
/** Subtitle override for the header/trigger (defaults to `email`). */
|
|
117
|
-
subtitle?: React.ReactNode;
|
|
118
|
-
/** Presence dot. */
|
|
119
|
-
status?: "online" | "busy" | "away" | "offline";
|
|
120
|
-
/** Trigger avatar size. @default "sm" */
|
|
121
|
-
size?: "xs" | "sm" | "md" | "lg" | "xl";
|
|
122
|
-
/** Menu items (same shape as Menu's items). */
|
|
123
|
-
items: MenuItemDef[];
|
|
124
|
-
/** Show name/email next to the avatar in the trigger. @default false */
|
|
125
|
-
showName?: boolean;
|
|
126
|
-
/** Show a chevron in the trigger (defaults to `showName`). */
|
|
127
|
-
showChevron?: boolean;
|
|
128
|
-
/** Menu alignment to the trigger. @default "end" */
|
|
129
|
-
align?: "start" | "end";
|
|
130
|
-
}
|
|
131
|
-
|
|
114
|
+
/**
|
|
115
|
+
* Avatar that opens a dropdown menu of account options — the classic user menu.
|
|
116
|
+
* Shows the user's avatar (optionally with name/email), and a portaled menu with
|
|
117
|
+
* a rich header (avatar + name + email) above the items.
|
|
118
|
+
*
|
|
119
|
+
* @startingPoint section="Data display" subtitle="Avatar account menu" viewport="700x320"
|
|
120
|
+
*/
|
|
121
|
+
interface AvatarMenuProps extends Omit<React.HTMLAttributes<HTMLSpanElement>, "title"> {
|
|
122
|
+
/** User's full name (drives initials + header). */
|
|
123
|
+
name?: string;
|
|
124
|
+
/** Avatar image URL. */
|
|
125
|
+
src?: string;
|
|
126
|
+
/** Email shown in the header (and trigger when `showName`). */
|
|
127
|
+
email?: string;
|
|
128
|
+
/** Subtitle override for the header/trigger (defaults to `email`). */
|
|
129
|
+
subtitle?: React.ReactNode;
|
|
130
|
+
/** Presence dot. */
|
|
131
|
+
status?: "online" | "busy" | "away" | "offline";
|
|
132
|
+
/** Trigger avatar size. @default "sm" */
|
|
133
|
+
size?: "xs" | "sm" | "md" | "lg" | "xl";
|
|
134
|
+
/** Menu items (same shape as Menu's items). */
|
|
135
|
+
items: MenuItemDef[];
|
|
136
|
+
/** Show name/email next to the avatar in the trigger. @default false */
|
|
137
|
+
showName?: boolean;
|
|
138
|
+
/** Show a chevron in the trigger (defaults to `showName`). */
|
|
139
|
+
showChevron?: boolean;
|
|
140
|
+
/** Menu alignment to the trigger. @default "end" */
|
|
141
|
+
align?: "start" | "end";
|
|
142
|
+
}
|
|
143
|
+
|
|
132
144
|
declare function AvatarMenu(props: AvatarMenuProps): React.JSX.Element;
|
|
133
145
|
|
|
134
|
-
/**
|
|
135
|
-
* Small status label / count. Six tones × three variants.
|
|
136
|
-
*/
|
|
137
|
-
interface BadgeProps extends React.HTMLAttributes<HTMLSpanElement> {
|
|
138
|
-
/** Semantic color. @default "primary" */
|
|
139
|
-
tone?: "primary" | "success" | "warning" | "danger" | "info" | "neutral";
|
|
140
|
-
/** Fill style. @default "soft" */
|
|
141
|
-
variant?: "soft" | "solid" | "outline";
|
|
142
|
-
/** @default "md" */
|
|
143
|
-
size?: "md" | "lg";
|
|
144
|
-
/** Show a leading status dot. */
|
|
145
|
-
dot?: boolean;
|
|
146
|
-
children?: React.ReactNode;
|
|
147
|
-
}
|
|
148
|
-
|
|
146
|
+
/**
|
|
147
|
+
* Small status label / count. Six tones × three variants.
|
|
148
|
+
*/
|
|
149
|
+
interface BadgeProps extends React.HTMLAttributes<HTMLSpanElement> {
|
|
150
|
+
/** Semantic color. @default "primary" */
|
|
151
|
+
tone?: "primary" | "success" | "warning" | "danger" | "info" | "neutral";
|
|
152
|
+
/** Fill style. @default "soft" */
|
|
153
|
+
variant?: "soft" | "solid" | "outline";
|
|
154
|
+
/** Size scale. @default "md" */
|
|
155
|
+
size?: "sm" | "md" | "lg";
|
|
156
|
+
/** Show a leading status dot. */
|
|
157
|
+
dot?: boolean;
|
|
158
|
+
children?: React.ReactNode;
|
|
159
|
+
}
|
|
160
|
+
|
|
149
161
|
declare function Badge(props: BadgeProps): React.JSX.Element;
|
|
150
162
|
|
|
151
|
-
interface BreadcrumbItem {
|
|
152
|
-
/** Visible label. */
|
|
153
|
-
label: React.ReactNode;
|
|
154
|
-
/** Link target (omit on the last/current item). */
|
|
155
|
-
href?: string;
|
|
156
|
-
/** Optional leading icon. */
|
|
157
|
-
icon?: React.ReactNode;
|
|
158
|
-
/** Click handler (for SPA navigation). */
|
|
159
|
-
onClick?: (e: React.MouseEvent) => void;
|
|
160
|
-
}
|
|
161
|
-
|
|
162
|
-
/**
|
|
163
|
-
* Breadcrumb trail showing the path to the current page. Supports leading icons
|
|
164
|
-
* per item and collapsing the middle into a “…” that expands on click.
|
|
165
|
-
*
|
|
166
|
-
* @startingPoint section="Navigation" subtitle="Breadcrumb trail" viewport="700x80"
|
|
167
|
-
*/
|
|
168
|
-
interface BreadcrumbProps extends React.HTMLAttributes<HTMLElement> {
|
|
169
|
-
/** Ordered trail; the last item renders as the current page. */
|
|
170
|
-
items: BreadcrumbItem[];
|
|
171
|
-
/** Custom separator node (defaults to a chevron). */
|
|
172
|
-
separator?: React.ReactNode;
|
|
173
|
-
/** Collapse to first + last items past this count (0 = never). @default 0 */
|
|
174
|
-
maxItems?: number;
|
|
175
|
-
}
|
|
176
|
-
|
|
163
|
+
interface BreadcrumbItem {
|
|
164
|
+
/** Visible label. */
|
|
165
|
+
label: React.ReactNode;
|
|
166
|
+
/** Link target (omit on the last/current item). */
|
|
167
|
+
href?: string;
|
|
168
|
+
/** Optional leading icon. */
|
|
169
|
+
icon?: React.ReactNode;
|
|
170
|
+
/** Click handler (for SPA navigation). */
|
|
171
|
+
onClick?: (e: React.MouseEvent) => void;
|
|
172
|
+
}
|
|
173
|
+
|
|
174
|
+
/**
|
|
175
|
+
* Breadcrumb trail showing the path to the current page. Supports leading icons
|
|
176
|
+
* per item and collapsing the middle into a “…” that expands on click.
|
|
177
|
+
*
|
|
178
|
+
* @startingPoint section="Navigation" subtitle="Breadcrumb trail" viewport="700x80"
|
|
179
|
+
*/
|
|
180
|
+
interface BreadcrumbProps extends React.HTMLAttributes<HTMLElement> {
|
|
181
|
+
/** Ordered trail; the last item renders as the current page. */
|
|
182
|
+
items: BreadcrumbItem[];
|
|
183
|
+
/** Custom separator node (defaults to a chevron). */
|
|
184
|
+
separator?: React.ReactNode;
|
|
185
|
+
/** Collapse to first + last items past this count (0 = never). @default 0 */
|
|
186
|
+
maxItems?: number;
|
|
187
|
+
}
|
|
188
|
+
|
|
177
189
|
declare function Breadcrumb(props: BreadcrumbProps): React.JSX.Element;
|
|
178
190
|
|
|
179
|
-
/**
|
|
180
|
-
* Primary action button with solid / soft / outline / ghost
|
|
181
|
-
*
|
|
182
|
-
*
|
|
183
|
-
*
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
/**
|
|
189
|
-
|
|
190
|
-
/**
|
|
191
|
-
|
|
192
|
-
/**
|
|
193
|
-
|
|
194
|
-
/**
|
|
195
|
-
|
|
196
|
-
/**
|
|
197
|
-
|
|
198
|
-
/**
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
191
|
+
/**
|
|
192
|
+
* Primary action button with a solid / soft / outline / ghost **variant** (fill style) crossed with a
|
|
193
|
+
* **tone** (primary / danger color), four sizes, loading state, icons, and a click ripple. A danger
|
|
194
|
+
* button is `tone="danger"` with any variant (e.g. `<Button tone="danger">`, `<Button variant="soft"
|
|
195
|
+
* tone="danger">`) — danger is no longer a variant value.
|
|
196
|
+
*
|
|
197
|
+
* @startingPoint section="Buttons" subtitle="Action button with ripple + variants" viewport="700x200"
|
|
198
|
+
*/
|
|
199
|
+
interface ButtonProps extends React.ButtonHTMLAttributes<HTMLButtonElement> {
|
|
200
|
+
/** Fill style. @default "solid" */
|
|
201
|
+
variant?: "solid" | "soft" | "outline" | "ghost";
|
|
202
|
+
/** Color/intent, orthogonal to `variant`. @default "primary" */
|
|
203
|
+
tone?: "primary" | "danger";
|
|
204
|
+
/** Control size; "xs" (~26px) is smaller than "sm". @default "md" */
|
|
205
|
+
size?: "xs" | "sm" | "md" | "lg";
|
|
206
|
+
/** Icon node rendered before the label. */
|
|
207
|
+
leftIcon?: React.ReactNode;
|
|
208
|
+
/** Icon node rendered after the label. */
|
|
209
|
+
rightIcon?: React.ReactNode;
|
|
210
|
+
/** Show a spinner and block interaction. @default false */
|
|
211
|
+
loading?: boolean;
|
|
212
|
+
/** Stretch to fill the container width. @default false */
|
|
213
|
+
fullWidth?: boolean;
|
|
214
|
+
/** Render as a different element (e.g. "a"). @default "button" */
|
|
215
|
+
as?: "button" | "a";
|
|
216
|
+
/** Link destination — only used with as="a"; scheme-sanitized (javascript:/data:/vbscript: render without href). */
|
|
217
|
+
href?: string;
|
|
218
|
+
/** Anchor target — only used with as="a" (e.g. "_blank"). */
|
|
219
|
+
target?: React.HTMLAttributeAnchorTarget;
|
|
220
|
+
/** Anchor rel — only used with as="a"; pair "noopener noreferrer" with target="_blank". */
|
|
221
|
+
rel?: string;
|
|
222
|
+
children?: React.ReactNode;
|
|
223
|
+
}
|
|
224
|
+
|
|
203
225
|
declare function Button(props: ButtonProps): React.JSX.Element;
|
|
204
226
|
|
|
205
|
-
/**
|
|
206
|
-
* Surface container for grouped content. Supports header (title/subtitle),
|
|
207
|
-
* body, footer, three variants, and an interactive hover-lift.
|
|
208
|
-
*
|
|
209
|
-
* @startingPoint section="Data display" subtitle="Content card with header & footer" viewport="700x260"
|
|
210
|
-
*/
|
|
211
|
-
interface CardProps extends React.HTMLAttributes<HTMLDivElement> {
|
|
212
|
-
/** Bold title in the card header. */
|
|
213
|
-
title?: React.ReactNode;
|
|
214
|
-
/** Muted subtitle under the title. */
|
|
215
|
-
subtitle?: React.ReactNode;
|
|
216
|
-
/** Footer content (e.g. action buttons). */
|
|
217
|
-
footer?: React.ReactNode;
|
|
218
|
-
/** Visual style. @default "elevated" */
|
|
219
|
-
variant?: "elevated" | "outline" | "soft";
|
|
220
|
-
/** Inner padding. @default "md" */
|
|
221
|
-
padding?: "none" | "md" | "lg";
|
|
222
|
-
/** Adds a hover-lift + pointer cursor. */
|
|
223
|
-
interactive?: boolean;
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
+
/**
|
|
228
|
+
* Surface container for grouped content. Supports header (title/subtitle),
|
|
229
|
+
* body, footer, three variants, and an interactive hover-lift.
|
|
230
|
+
*
|
|
231
|
+
* @startingPoint section="Data display" subtitle="Content card with header & footer" viewport="700x260"
|
|
232
|
+
*/
|
|
233
|
+
interface CardProps extends Omit<React.HTMLAttributes<HTMLDivElement>, "title"> {
|
|
234
|
+
/** Bold title in the card header. */
|
|
235
|
+
title?: React.ReactNode;
|
|
236
|
+
/** Muted subtitle under the title. */
|
|
237
|
+
subtitle?: React.ReactNode;
|
|
238
|
+
/** Footer content (e.g. action buttons). */
|
|
239
|
+
footer?: React.ReactNode;
|
|
240
|
+
/** Visual style. @default "elevated" */
|
|
241
|
+
variant?: "elevated" | "outline" | "soft";
|
|
242
|
+
/** Inner padding. @default "md" */
|
|
243
|
+
padding?: "none" | "md" | "lg";
|
|
244
|
+
/** Adds a hover-lift + pointer cursor. */
|
|
245
|
+
interactive?: boolean;
|
|
246
|
+
/** Stretch to fill the parent cell (`height: 100%`) — equal-height cards in a grid/flex row. */
|
|
247
|
+
fullHeight?: boolean;
|
|
248
|
+
children?: React.ReactNode;
|
|
249
|
+
}
|
|
250
|
+
|
|
227
251
|
declare function Card(props: CardProps): React.JSX.Element;
|
|
228
252
|
|
|
229
|
-
/**
|
|
230
|
-
* Sliding carousel — one slide per view, prev/next arrows, dot indicators,
|
|
231
|
-
* optional looping and autoplay (pauses on hover). Each child is a slide.
|
|
232
|
-
*
|
|
233
|
-
*
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
253
|
+
/**
|
|
254
|
+
* Sliding carousel — one slide per view, prev/next arrows, dot indicators,
|
|
255
|
+
* optional looping and autoplay (pauses on hover). Each child is a slide.
|
|
256
|
+
* Controlled via `index` + `onIndexChange`, or uncontrolled via `defaultIndex`.
|
|
257
|
+
*
|
|
258
|
+
* @startingPoint section="Data display" subtitle="Sliding carousel" viewport="700x320"
|
|
259
|
+
*/
|
|
260
|
+
interface CarouselProps extends React.HTMLAttributes<HTMLDivElement> {
|
|
261
|
+
/** Controlled active slide index — pair with `onIndexChange`. */
|
|
262
|
+
index?: number;
|
|
263
|
+
/** Initial slide index when uncontrolled. @default 0 */
|
|
264
|
+
defaultIndex?: number;
|
|
265
|
+
/** Fired when the active slide changes (arrows, dots, or autoplay): (index). */
|
|
266
|
+
onIndexChange?: (index: number) => void;
|
|
267
|
+
/** Show prev/next arrows. @default true */
|
|
268
|
+
showArrows?: boolean;
|
|
269
|
+
/** Show dot indicators. @default true */
|
|
270
|
+
showDots?: boolean;
|
|
271
|
+
/** Wrap around at the ends. @default true */
|
|
272
|
+
loop?: boolean;
|
|
273
|
+
/** Auto-advance slides. @default false */
|
|
274
|
+
autoPlay?: boolean;
|
|
275
|
+
/** Autoplay interval in ms. @default 4000 */
|
|
276
|
+
interval?: number;
|
|
277
|
+
/** Slides (each child is one slide). */
|
|
278
|
+
children?: React.ReactNode;
|
|
279
|
+
}
|
|
280
|
+
|
|
250
281
|
declare function Carousel(props: CarouselProps): React.JSX.Element;
|
|
251
282
|
|
|
252
|
-
interface ChartDatum {
|
|
253
|
-
/** X-axis label. */
|
|
254
|
-
label: React.ReactNode;
|
|
255
|
-
/** One numeric field per series key (default key is "value"). */
|
|
256
|
-
[key: string]: any;
|
|
257
|
-
}
|
|
258
|
-
|
|
259
|
-
/**
|
|
260
|
-
* Lightweight, dependency-free SVG chart — bar or line, single or multi-series,
|
|
261
|
-
* with grid, axes, animated entrance, tooltips, and optional legend.
|
|
262
|
-
*
|
|
263
|
-
* @startingPoint section="Data display" subtitle="Bar / line chart (no deps)" viewport="700x280"
|
|
264
|
-
*/
|
|
265
|
-
interface ChartProps extends React.HTMLAttributes<HTMLDivElement> {
|
|
266
|
-
/** @default "bar" */
|
|
267
|
-
type?: "bar" | "line";
|
|
268
|
-
/** Data points. Each has a `label` + one numeric field per series. */
|
|
269
|
-
data: ChartDatum[];
|
|
270
|
-
/** Series field names (defaults to ["value"]). Multiple = grouped bars / multi-line. */
|
|
271
|
-
series?: string[];
|
|
272
|
-
/** Pixel height. @default 220 */
|
|
273
|
-
height?: number;
|
|
274
|
-
/** Horizontal grid lines. @default true */
|
|
275
|
-
showGrid?: boolean;
|
|
276
|
-
/** Axis labels. @default true */
|
|
277
|
-
showAxis?: boolean;
|
|
278
|
-
/** Series legend (multi-series). @default false */
|
|
279
|
-
showLegend?: boolean;
|
|
280
|
-
/**
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
283
|
+
interface ChartDatum {
|
|
284
|
+
/** X-axis label. */
|
|
285
|
+
label: React.ReactNode;
|
|
286
|
+
/** One numeric field per series key (default key is "value"). */
|
|
287
|
+
[key: string]: any;
|
|
288
|
+
}
|
|
289
|
+
|
|
290
|
+
/**
|
|
291
|
+
* Lightweight, dependency-free SVG chart — bar or line, single or multi-series,
|
|
292
|
+
* with grid, axes, animated entrance, tooltips, and optional legend.
|
|
293
|
+
*
|
|
294
|
+
* @startingPoint section="Data display" subtitle="Bar / line chart (no deps)" viewport="700x280"
|
|
295
|
+
*/
|
|
296
|
+
interface ChartProps extends React.HTMLAttributes<HTMLDivElement> {
|
|
297
|
+
/** @default "bar" */
|
|
298
|
+
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?: string[];
|
|
303
|
+
/** Pixel height. @default 220 */
|
|
304
|
+
height?: number;
|
|
305
|
+
/** Horizontal grid lines. @default true */
|
|
306
|
+
showGrid?: boolean;
|
|
307
|
+
/** Axis labels. @default true */
|
|
308
|
+
showAxis?: boolean;
|
|
309
|
+
/** Series legend (multi-series). @default false */
|
|
310
|
+
showLegend?: boolean;
|
|
311
|
+
/** Per-series colors (any CSS color), cycled when shorter than `series`. Defaults to the built-in token palette. */
|
|
312
|
+
colors?: string[];
|
|
313
|
+
/** Tooltip value formatter. */
|
|
314
|
+
valueFormat?: (value: number) => string;
|
|
315
|
+
/** Accessible name for the chart's `<svg role="img">`. Defaults to `"<type> chart"`. Also accepts `aria-label`. */
|
|
316
|
+
ariaLabel?: string;
|
|
317
|
+
}
|
|
318
|
+
|
|
284
319
|
declare function Chart(props: ChartProps): React.JSX.Element;
|
|
285
320
|
|
|
286
|
-
/**
|
|
287
|
-
* Checkbox with animated checkmark, label, description, and indeterminate state.
|
|
288
|
-
*/
|
|
289
|
-
interface CheckboxProps extends Omit<React.InputHTMLAttributes<HTMLInputElement>, "size" | "type"> {
|
|
290
|
-
label?: React.ReactNode;
|
|
291
|
-
description?: React.ReactNode;
|
|
292
|
-
/**
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
321
|
+
/**
|
|
322
|
+
* Checkbox with animated checkmark, label, description, and indeterminate state.
|
|
323
|
+
*/
|
|
324
|
+
interface CheckboxProps extends Omit<React.InputHTMLAttributes<HTMLInputElement>, "size" | "type"> {
|
|
325
|
+
label?: React.ReactNode;
|
|
326
|
+
description?: React.ReactNode;
|
|
327
|
+
/** Error message shown below the control; tints the box red and wires `aria-invalid`/`aria-describedby`. @default undefined */
|
|
328
|
+
error?: React.ReactNode;
|
|
329
|
+
/** Render the dash (mixed) state. */
|
|
330
|
+
indeterminate?: boolean;
|
|
331
|
+
size?: "sm" | "md" | "lg";
|
|
332
|
+
/** Color intent. @default "primary" */
|
|
333
|
+
tone?: "primary" | "success" | "warning" | "danger" | "info" | "neutral";
|
|
334
|
+
}
|
|
335
|
+
|
|
297
336
|
declare function Checkbox(props: CheckboxProps): React.JSX.Element;
|
|
298
337
|
|
|
299
|
-
/**
|
|
300
|
-
* Color picker with a saturation/value square, hue slider, hex input, and
|
|
301
|
-
* preset swatches. Opens in a popover; value is a hex string.
|
|
302
|
-
*
|
|
303
|
-
* @startingPoint section="Inputs" subtitle="Color picker with hue + presets" viewport="700x120"
|
|
304
|
-
*/
|
|
305
|
-
interface ColorPickerProps extends Omit<React.HTMLAttributes<HTMLDivElement>, "onChange" | "defaultValue"> {
|
|
306
|
-
label
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
338
|
+
/**
|
|
339
|
+
* Color picker with a saturation/value square, hue slider, hex input, and
|
|
340
|
+
* preset swatches. Opens in a popover; value is a hex string.
|
|
341
|
+
*
|
|
342
|
+
* @startingPoint section="Inputs" subtitle="Color picker with hue + presets" viewport="700x120"
|
|
343
|
+
*/
|
|
344
|
+
interface ColorPickerProps extends Omit<React.HTMLAttributes<HTMLDivElement>, "onChange" | "defaultValue"> {
|
|
345
|
+
/** Field label rendered above the control. */
|
|
346
|
+
label?: React.ReactNode;
|
|
347
|
+
/** Helper text shown below when there is no error. */
|
|
348
|
+
hint?: React.ReactNode;
|
|
349
|
+
/** Error message — turns the field red and replaces the hint. */
|
|
350
|
+
error?: React.ReactNode;
|
|
351
|
+
/** Marks the field required (adds an asterisk to the label). @default false */
|
|
352
|
+
required?: boolean;
|
|
353
|
+
/** Controlled hex value, e.g. "#6366F1". */
|
|
354
|
+
value?: string;
|
|
355
|
+
/** Uncontrolled initial hex. @default "#6366F1" */
|
|
356
|
+
defaultValue?: string;
|
|
357
|
+
/** Preset swatches (hex strings). */
|
|
358
|
+
presets?: string[];
|
|
359
|
+
/** Disable all interaction (the popover cannot be opened). @default false */
|
|
360
|
+
disabled?: boolean;
|
|
361
|
+
/** Color intent for the focus/open accent. @default "primary" */
|
|
362
|
+
tone?: "primary" | "success" | "warning" | "danger" | "info" | "neutral";
|
|
363
|
+
onChange?: (hex: string) => void;
|
|
364
|
+
}
|
|
365
|
+
|
|
316
366
|
declare function ColorPicker(props: ColorPickerProps): React.JSX.Element;
|
|
317
367
|
|
|
318
|
-
/**
|
|
319
|
-
* Searchable single-select (MUI-Autocomplete style) — type directly in the
|
|
320
|
-
* field to filter; the overlay shows only options. Supports grouped options
|
|
321
|
-
* and two-line (title + subtitle) options.
|
|
322
|
-
* Keyboard: ↑/↓ to move, Enter to select, Esc to close.
|
|
323
|
-
*
|
|
324
|
-
* @startingPoint section="Selects" subtitle="Searchable single-select dropdown" viewport="700x160"
|
|
325
|
-
*/
|
|
326
|
-
interface ComboboxProps extends Omit<React.
|
|
327
|
-
label?: React.ReactNode;
|
|
328
|
-
hint?: React.ReactNode;
|
|
329
|
-
error?: React.ReactNode;
|
|
330
|
-
required?: boolean;
|
|
331
|
-
size?: "sm" | "md" | "lg";
|
|
332
|
-
/**
|
|
333
|
-
|
|
334
|
-
/**
|
|
335
|
-
|
|
336
|
-
/**
|
|
337
|
-
|
|
338
|
-
/**
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
368
|
+
/**
|
|
369
|
+
* Searchable single-select (MUI-Autocomplete style) — type directly in the
|
|
370
|
+
* field to filter; the overlay shows only options. Supports grouped options
|
|
371
|
+
* and two-line (title + subtitle) options.
|
|
372
|
+
* Keyboard: ↑/↓ to move, Enter to select, Esc to close.
|
|
373
|
+
*
|
|
374
|
+
* @startingPoint section="Selects" subtitle="Searchable single-select dropdown" viewport="700x160"
|
|
375
|
+
*/
|
|
376
|
+
interface ComboboxProps extends Omit<React.InputHTMLAttributes<HTMLInputElement>, "size" | "value" | "defaultValue" | "onChange"> {
|
|
377
|
+
label?: React.ReactNode;
|
|
378
|
+
hint?: React.ReactNode;
|
|
379
|
+
error?: React.ReactNode;
|
|
380
|
+
required?: boolean;
|
|
381
|
+
size?: "sm" | "md" | "lg";
|
|
382
|
+
/** Color intent for the focus/open accent. @default "primary" */
|
|
383
|
+
tone?: "primary" | "success" | "warning" | "danger" | "info" | "neutral";
|
|
384
|
+
/** Field placeholder. */
|
|
385
|
+
placeholder?: string;
|
|
386
|
+
/** Options — strings, {value,label,description}, or {group,options} groups. */
|
|
387
|
+
options: Array<string | ComboboxOption | ComboboxGroup>;
|
|
388
|
+
/** Controlled selected value. */
|
|
389
|
+
value?: string | null;
|
|
390
|
+
/** Uncontrolled initial value. */
|
|
391
|
+
defaultValue?: string | null;
|
|
392
|
+
onChange?: (value: string | null) => void;
|
|
393
|
+
/** Show a clear (×) affix when a value is selected. */
|
|
394
|
+
clearable?: boolean;
|
|
395
|
+
disabled?: boolean;
|
|
396
|
+
/** Open the menu upward instead of down (e.g. near a viewport bottom). @default "bottom" */
|
|
397
|
+
placement?: "bottom" | "top";
|
|
398
|
+
/** Render the dropdown in a portal (position:fixed on document.body) so it is never clipped by a
|
|
399
|
+
* scrolling/overflow-hidden ancestor; auto-flips up near the viewport bottom. Set false to render
|
|
400
|
+
* inline. @default true */
|
|
401
|
+
portal?: boolean;
|
|
402
|
+
/** Minimum popover width in px when portaled (useful when the control is narrow). @default 0 */
|
|
403
|
+
minWidth?: number;
|
|
404
|
+
/** Composed with the field's open-on-focus behavior — your handler runs first. */
|
|
405
|
+
onFocus?: React.FocusEventHandler<HTMLInputElement>;
|
|
406
|
+
/** Composed with the field's keyboard navigation (Arrows/Enter/Escape) — your handler runs first; call `event.preventDefault()` to suppress it. */
|
|
407
|
+
onKeyDown?: React.KeyboardEventHandler<HTMLInputElement>;
|
|
408
|
+
}
|
|
409
|
+
|
|
410
|
+
interface ComboboxOption {
|
|
411
|
+
value: string;
|
|
412
|
+
label: string;
|
|
413
|
+
/** Optional second line shown under the label. */
|
|
414
|
+
description?: string;
|
|
415
|
+
}
|
|
416
|
+
|
|
417
|
+
/** A group heading with its own options. */
|
|
418
|
+
interface ComboboxGroup {
|
|
419
|
+
group: string;
|
|
420
|
+
options: Array<string | ComboboxOption>;
|
|
421
|
+
}
|
|
422
|
+
|
|
359
423
|
declare function Combobox(props: ComboboxProps): React.JSX.Element;
|
|
360
424
|
|
|
361
|
-
interface Command {
|
|
362
|
-
/** Stable id. */
|
|
363
|
-
id?: string;
|
|
364
|
-
/** Visible label. */
|
|
365
|
-
label: string;
|
|
366
|
-
/** Secondary description line. */
|
|
367
|
-
description?: string;
|
|
368
|
-
/** Leading icon. */
|
|
369
|
-
icon?: React.ReactNode;
|
|
370
|
-
/** Right-aligned shortcut hint, e.g. "⌘K". */
|
|
371
|
-
shortcut?: string;
|
|
372
|
-
/** Group heading this command appears under. */
|
|
373
|
-
group?: string;
|
|
374
|
-
/** Extra search terms (space-separated). */
|
|
375
|
-
keywords?: string;
|
|
376
|
-
/** Invoked on Enter / click (palette closes after). */
|
|
377
|
-
onSelect?: () => void;
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
|
|
425
|
+
interface Command {
|
|
426
|
+
/** Stable id. */
|
|
427
|
+
id?: string;
|
|
428
|
+
/** Visible label. */
|
|
429
|
+
label: string;
|
|
430
|
+
/** Secondary description line. */
|
|
431
|
+
description?: string;
|
|
432
|
+
/** Leading icon. */
|
|
433
|
+
icon?: React.ReactNode;
|
|
434
|
+
/** Right-aligned shortcut hint, e.g. "⌘K". */
|
|
435
|
+
shortcut?: string;
|
|
436
|
+
/** Group heading this command appears under. */
|
|
437
|
+
group?: string;
|
|
438
|
+
/** Extra search terms (space-separated). */
|
|
439
|
+
keywords?: string;
|
|
440
|
+
/** Invoked on Enter / click (palette closes after). */
|
|
441
|
+
onSelect?: () => void;
|
|
442
|
+
/** Alias for `onSelect`, matching the other item-array APIs (Menu, List, Sidebar, …) — used when `onSelect` is absent. */
|
|
443
|
+
onClick?: () => void;
|
|
444
|
+
}
|
|
445
|
+
|
|
446
|
+
/**
|
|
447
|
+
* ⌘K-style command palette — fuzzy-ish search over grouped commands with full
|
|
448
|
+
* keyboard nav (↑/↓, Enter, Esc). Drive `open` yourself (e.g. on Cmd/Ctrl+K).
|
|
449
|
+
* While open, focus is trapped inside the palette (Tab/Shift+Tab cycle) and is
|
|
450
|
+
* restored to the previously focused element on close.
|
|
451
|
+
*/
|
|
452
|
+
interface CommandPaletteProps extends React.HTMLAttributes<HTMLDivElement> {
|
|
453
|
+
open: boolean;
|
|
454
|
+
onClose?: () => void;
|
|
455
|
+
commands: Command[];
|
|
456
|
+
placeholder?: string;
|
|
457
|
+
emptyText?: string;
|
|
458
|
+
}
|
|
459
|
+
|
|
392
460
|
declare function CommandPalette(props: CommandPaletteProps): React.JSX.Element | null;
|
|
393
461
|
|
|
394
|
-
/**
|
|
395
|
-
* Currency input with a fixed currency defined in code. Shows the symbol as a
|
|
396
|
-
* prefix and the currency code as a suffix, and enforces decimal precision
|
|
397
|
-
* (e.g. precision 2 accepts 2.25 but not 2.259).
|
|
398
|
-
*
|
|
399
|
-
* @startingPoint section="Inputs" subtitle="Currency input with symbol + code" viewport="700x140"
|
|
400
|
-
*/
|
|
401
|
-
interface CurrencyProps extends Omit<React.InputHTMLAttributes<HTMLInputElement>, "size" | "value" | "defaultValue" | "onChange"> {
|
|
402
|
-
label?: React.ReactNode;
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
/**
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
|
|
422
|
-
|
|
423
|
-
|
|
424
|
-
|
|
462
|
+
/**
|
|
463
|
+
* Currency input with a fixed currency defined in code. Shows the symbol as a
|
|
464
|
+
* prefix and the currency code as a suffix, and enforces decimal precision
|
|
465
|
+
* (e.g. precision 2 accepts 2.25 but not 2.259).
|
|
466
|
+
*
|
|
467
|
+
* @startingPoint section="Inputs" subtitle="Currency input with symbol + code" viewport="700x140"
|
|
468
|
+
*/
|
|
469
|
+
interface CurrencyProps extends Omit<React.InputHTMLAttributes<HTMLInputElement>, "size" | "value" | "defaultValue" | "onChange"> {
|
|
470
|
+
label?: React.ReactNode;
|
|
471
|
+
/** Helper text below the field; linked to the input via aria-describedby. */
|
|
472
|
+
hint?: React.ReactNode;
|
|
473
|
+
/** Error text below the field; sets aria-invalid and is linked via aria-describedby (takes precedence over hint). */
|
|
474
|
+
error?: React.ReactNode;
|
|
475
|
+
/** Intercepted to render the label asterisk, and forwarded to the native input as `required`. @default false */
|
|
476
|
+
required?: boolean;
|
|
477
|
+
size?: "sm" | "md" | "lg";
|
|
478
|
+
/** Color intent for the focus/open accent. @default "primary" */
|
|
479
|
+
tone?: "primary" | "success" | "warning" | "danger" | "info" | "neutral";
|
|
480
|
+
/** Currency code (key in the built-in table), e.g. "USD", "EUR", "IDR", "JPY". @default "USD" */
|
|
481
|
+
currency?: string;
|
|
482
|
+
/** Override the currency's decimal precision (number of digits after the decimal). */
|
|
483
|
+
precision?: number;
|
|
484
|
+
/** Override the displayed prefix symbol. */
|
|
485
|
+
symbol?: string;
|
|
486
|
+
/** Override the displayed suffix code. */
|
|
487
|
+
code?: string;
|
|
488
|
+
/** Controlled string value. */
|
|
489
|
+
value?: string | number;
|
|
490
|
+
/** Uncontrolled initial value. */
|
|
491
|
+
defaultValue?: string | number;
|
|
492
|
+
/** Native change handler (receives the event); fires alongside onValueChange. */
|
|
493
|
+
onChange?: (e: React.ChangeEvent<HTMLInputElement>) => void;
|
|
494
|
+
/** Convenience callback with the parsed numeric value and the formatted string. */
|
|
495
|
+
onValueChange?: (value: number | null, formatted: string) => void;
|
|
496
|
+
}
|
|
497
|
+
|
|
425
498
|
declare function Currency(props: CurrencyProps): React.JSX.Element;
|
|
426
499
|
|
|
427
|
-
interface CurrencyOption { value: string; label: string; }
|
|
428
|
-
|
|
429
|
-
/**
|
|
430
|
-
* Currency input where the USER selects the currency from a dropdown. The chosen
|
|
431
|
-
* currency drives the prefix symbol, the suffix code, and the enforced decimal
|
|
432
|
-
* precision.
|
|
433
|
-
*
|
|
434
|
-
* @startingPoint section="Inputs" subtitle="Currency input with selectable currency" viewport="700x140"
|
|
435
|
-
*/
|
|
436
|
-
interface CurrencyFieldProps extends Omit<React.InputHTMLAttributes<HTMLInputElement>, "size" | "value" | "defaultValue" | "onChange"> {
|
|
437
|
-
label?: React.ReactNode;
|
|
438
|
-
|
|
439
|
-
|
|
440
|
-
|
|
441
|
-
|
|
442
|
-
/**
|
|
443
|
-
|
|
444
|
-
|
|
445
|
-
|
|
446
|
-
|
|
447
|
-
|
|
448
|
-
|
|
449
|
-
|
|
450
|
-
|
|
451
|
-
|
|
452
|
-
|
|
453
|
-
|
|
454
|
-
|
|
455
|
-
|
|
456
|
-
|
|
457
|
-
|
|
500
|
+
interface CurrencyOption { value: string; label: string; }
|
|
501
|
+
|
|
502
|
+
/**
|
|
503
|
+
* Currency input where the USER selects the currency from a dropdown. The chosen
|
|
504
|
+
* currency drives the prefix symbol, the suffix code, and the enforced decimal
|
|
505
|
+
* precision.
|
|
506
|
+
*
|
|
507
|
+
* @startingPoint section="Inputs" subtitle="Currency input with selectable currency" viewport="700x140"
|
|
508
|
+
*/
|
|
509
|
+
interface CurrencyFieldProps extends Omit<React.InputHTMLAttributes<HTMLInputElement>, "size" | "value" | "defaultValue" | "onChange"> {
|
|
510
|
+
label?: React.ReactNode;
|
|
511
|
+
/** Helper text below the field; linked to the input via aria-describedby. */
|
|
512
|
+
hint?: React.ReactNode;
|
|
513
|
+
/** Error text below the field; sets aria-invalid and is linked via aria-describedby (takes precedence over hint). */
|
|
514
|
+
error?: React.ReactNode;
|
|
515
|
+
/** Intercepted to render the label asterisk, and forwarded to the native input as `required`. @default false */
|
|
516
|
+
required?: boolean;
|
|
517
|
+
size?: "sm" | "md" | "lg";
|
|
518
|
+
/** Color intent for the focus/open accent. @default "primary" */
|
|
519
|
+
tone?: "primary" | "success" | "warning" | "danger" | "info" | "neutral";
|
|
520
|
+
/** Controlled selected currency code. */
|
|
521
|
+
currency?: string;
|
|
522
|
+
/** Uncontrolled initial currency code. @default "USD" */
|
|
523
|
+
defaultCurrency?: string;
|
|
524
|
+
/** Called when the user picks a different currency. */
|
|
525
|
+
onCurrencyChange?: (code: string) => void;
|
|
526
|
+
/** Limit the selectable currencies (codes or {value,label}); defaults to the full built-in list. */
|
|
527
|
+
currencies?: Array<string | CurrencyOption>;
|
|
528
|
+
/** Controlled amount string. */
|
|
529
|
+
value?: string | number;
|
|
530
|
+
/** Uncontrolled initial amount. */
|
|
531
|
+
defaultValue?: string | number;
|
|
532
|
+
/** Native change handler (receives the event); fires alongside onValueChange, matching Currency. */
|
|
533
|
+
onChange?: (e: React.ChangeEvent<HTMLInputElement>) => void;
|
|
534
|
+
/** Callback with the parsed number, formatted string, and active currency code. */
|
|
535
|
+
onValueChange?: (value: number | null, formatted: string, currency: string) => void;
|
|
536
|
+
}
|
|
537
|
+
|
|
458
538
|
declare function CurrencyField(props: CurrencyFieldProps): React.JSX.Element;
|
|
459
539
|
|
|
460
|
-
/**
|
|
461
|
-
* Advanced data table (Material UI Data Grid Premium style): sortable, filterable
|
|
462
|
-
* (per-column operators + quick search), hideable (with a searchable column list),
|
|
463
|
-
* and pinnable (left/right, sticky) columns, drag-to-reorder and drag-to-resize
|
|
464
|
-
* columns, a column-management + filter toolbar, density control, CSV export,
|
|
465
|
-
* an optional aggregation/summary footer, optional checkbox selection with a
|
|
466
|
-
* batch-action toolbar, an actions column (per-row icon buttons + overflow menu),
|
|
467
|
-
* page-number pagination with a configurable rows-per-page selector, a skeleton
|
|
468
|
-
* loading state, and an optional server-side mode (sort/filter/paginate on the
|
|
469
|
-
* backend — only the current page is loaded). Filter controls and the pager are
|
|
470
|
-
* built from the Twico Select, Input, and Pagination components.
|
|
471
|
-
*
|
|
472
|
-
* @startingPoint section="Data display" subtitle="MUI-style sortable/filterable/pinnable data table" viewport="900x460"
|
|
473
|
-
*/
|
|
474
|
-
interface DatatableProps extends Omit<React.HTMLAttributes<HTMLDivElement>, "rows"> {
|
|
475
|
-
/** Column definitions. */
|
|
476
|
-
columns: DatatableColumn[];
|
|
477
|
-
/** Row objects. In server mode, only the current page's rows. */
|
|
478
|
-
rows: any[];
|
|
479
|
-
/** Show shimmering skeleton rows instead of data. @default false */
|
|
480
|
-
loading?: boolean;
|
|
481
|
-
/** Returns a stable key per row. @default (r,i) => r.id ?? i */
|
|
482
|
-
rowKey?: (row: any, index: number) => string | number;
|
|
483
|
-
/** Render a leading checkbox-selection column. @default false */
|
|
484
|
-
checkboxSelection?: boolean;
|
|
485
|
-
/**
|
|
486
|
-
*
|
|
487
|
-
*
|
|
488
|
-
*
|
|
489
|
-
*/
|
|
490
|
-
|
|
491
|
-
/**
|
|
492
|
-
|
|
493
|
-
|
|
494
|
-
|
|
495
|
-
|
|
496
|
-
|
|
497
|
-
|
|
498
|
-
|
|
499
|
-
|
|
500
|
-
|
|
501
|
-
|
|
502
|
-
|
|
503
|
-
|
|
504
|
-
|
|
505
|
-
|
|
506
|
-
/**
|
|
507
|
-
|
|
508
|
-
/**
|
|
509
|
-
|
|
510
|
-
/**
|
|
511
|
-
|
|
512
|
-
|
|
513
|
-
|
|
514
|
-
|
|
515
|
-
|
|
516
|
-
|
|
517
|
-
/**
|
|
518
|
-
|
|
519
|
-
/**
|
|
520
|
-
|
|
521
|
-
/**
|
|
522
|
-
|
|
523
|
-
/**
|
|
524
|
-
|
|
525
|
-
/**
|
|
526
|
-
|
|
527
|
-
|
|
528
|
-
|
|
529
|
-
*
|
|
530
|
-
|
|
531
|
-
|
|
532
|
-
|
|
533
|
-
|
|
534
|
-
|
|
535
|
-
|
|
536
|
-
|
|
537
|
-
|
|
538
|
-
|
|
539
|
-
|
|
540
|
-
|
|
541
|
-
|
|
542
|
-
|
|
543
|
-
|
|
544
|
-
|
|
545
|
-
|
|
546
|
-
|
|
547
|
-
|
|
548
|
-
|
|
549
|
-
|
|
550
|
-
|
|
551
|
-
|
|
552
|
-
|
|
553
|
-
|
|
554
|
-
|
|
555
|
-
|
|
556
|
-
|
|
557
|
-
|
|
558
|
-
|
|
559
|
-
|
|
560
|
-
|
|
561
|
-
|
|
562
|
-
|
|
563
|
-
|
|
564
|
-
|
|
565
|
-
|
|
566
|
-
|
|
567
|
-
|
|
568
|
-
|
|
569
|
-
|
|
570
|
-
|
|
571
|
-
|
|
572
|
-
|
|
573
|
-
/**
|
|
574
|
-
|
|
575
|
-
/**
|
|
576
|
-
|
|
577
|
-
|
|
578
|
-
|
|
579
|
-
|
|
580
|
-
|
|
581
|
-
|
|
582
|
-
|
|
583
|
-
|
|
584
|
-
|
|
585
|
-
|
|
586
|
-
|
|
587
|
-
|
|
588
|
-
|
|
589
|
-
|
|
590
|
-
|
|
591
|
-
|
|
592
|
-
|
|
593
|
-
|
|
594
|
-
|
|
595
|
-
|
|
596
|
-
|
|
597
|
-
|
|
598
|
-
|
|
599
|
-
|
|
600
|
-
|
|
601
|
-
|
|
602
|
-
|
|
603
|
-
|
|
604
|
-
|
|
605
|
-
|
|
606
|
-
|
|
607
|
-
|
|
608
|
-
|
|
609
|
-
|
|
610
|
-
|
|
611
|
-
|
|
612
|
-
|
|
613
|
-
|
|
614
|
-
|
|
615
|
-
|
|
616
|
-
/**
|
|
617
|
-
|
|
618
|
-
/**
|
|
619
|
-
|
|
620
|
-
/**
|
|
621
|
-
|
|
622
|
-
|
|
623
|
-
|
|
624
|
-
/**
|
|
625
|
-
|
|
626
|
-
/**
|
|
627
|
-
|
|
628
|
-
/**
|
|
629
|
-
|
|
630
|
-
/**
|
|
631
|
-
|
|
632
|
-
/**
|
|
633
|
-
|
|
634
|
-
/**
|
|
635
|
-
|
|
636
|
-
|
|
637
|
-
|
|
638
|
-
|
|
639
|
-
|
|
640
|
-
|
|
641
|
-
|
|
642
|
-
|
|
643
|
-
|
|
644
|
-
|
|
645
|
-
|
|
646
|
-
|
|
647
|
-
|
|
648
|
-
|
|
649
|
-
|
|
650
|
-
|
|
651
|
-
|
|
540
|
+
/**
|
|
541
|
+
* Advanced data table (Material UI Data Grid Premium style): sortable, filterable
|
|
542
|
+
* (per-column operators + quick search), hideable (with a searchable column list),
|
|
543
|
+
* and pinnable (left/right, sticky) columns, drag-to-reorder and drag-to-resize
|
|
544
|
+
* columns, a column-management + filter toolbar, density control, CSV export,
|
|
545
|
+
* an optional aggregation/summary footer, optional checkbox selection with a
|
|
546
|
+
* batch-action toolbar, an actions column (per-row icon buttons + overflow menu),
|
|
547
|
+
* page-number pagination with a configurable rows-per-page selector, a skeleton
|
|
548
|
+
* loading state, and an optional server-side mode (sort/filter/paginate on the
|
|
549
|
+
* backend — only the current page is loaded). Filter controls and the pager are
|
|
550
|
+
* built from the Twico Select, Input, and Pagination components.
|
|
551
|
+
*
|
|
552
|
+
* @startingPoint section="Data display" subtitle="MUI-style sortable/filterable/pinnable data table" viewport="900x460"
|
|
553
|
+
*/
|
|
554
|
+
interface DatatableProps extends Omit<React.HTMLAttributes<HTMLDivElement>, "rows"> {
|
|
555
|
+
/** Column definitions. */
|
|
556
|
+
columns: DatatableColumn[];
|
|
557
|
+
/** Row objects. In server mode, only the current page's rows. */
|
|
558
|
+
rows: any[];
|
|
559
|
+
/** Show shimmering skeleton rows instead of data. @default false */
|
|
560
|
+
loading?: boolean;
|
|
561
|
+
/** Returns a stable key per row. @default (r,i) => r.id ?? i */
|
|
562
|
+
rowKey?: (row: any, index: number) => string | number;
|
|
563
|
+
/** Render a leading checkbox-selection column. @default false */
|
|
564
|
+
checkboxSelection?: boolean;
|
|
565
|
+
/** Render a leading auto-numbered row column (1, 2, 3…). The number reflects each row's position in
|
|
566
|
+
* the current sorted/filtered order and continues across pages (page 2 starts where page 1 ended;
|
|
567
|
+
* in server mode it uses the current page × pageSize). Sits after the checkbox column, sticky-left.
|
|
568
|
+
* This prop is the initial state — when enabled, users can hide/show the column from the toolbar's
|
|
569
|
+
* **Columns** panel ("Row number"). @default false */
|
|
570
|
+
rowNumbers?: boolean;
|
|
571
|
+
/**
|
|
572
|
+
* Actions shown in the toolbar when one or more rows are selected (requires
|
|
573
|
+
* `checkboxSelection`). Each handler receives the selected keys, the resolved
|
|
574
|
+
* selected row objects, and a `clearSelection()` callback.
|
|
575
|
+
*
|
|
576
|
+
* Server-mode caveat: the resolved `selectedRows` argument can only include rows
|
|
577
|
+
* on the currently loaded page (the table never holds off-page rows). For
|
|
578
|
+
* cross-page selections, use the complete `selectedKeys` array and re-fetch the
|
|
579
|
+
* full row objects server-side rather than relying on `selectedRows`.
|
|
580
|
+
*/
|
|
581
|
+
batchActions?: DatatableBatchAction[];
|
|
582
|
+
/** Row height preset. The toolbar density button cycles it locally; changing this prop re-applies it. @default "standard" */
|
|
583
|
+
density?: "compact" | "standard" | "comfortable";
|
|
584
|
+
/** Initial rows per page. 0 disables pagination. @default 10 */
|
|
585
|
+
pageSize?: number;
|
|
586
|
+
/** Options shown in the rows-per-page selector. @default [5, 10, 25, 50] */
|
|
587
|
+
pageSizeOptions?: number[];
|
|
588
|
+
/** Max height of the scroll area in px (header/footer stay fixed). @default 440 */
|
|
589
|
+
height?: number;
|
|
590
|
+
/**
|
|
591
|
+
* Enable server-side data. When true, the table does NOT sort/filter/paginate
|
|
592
|
+
* the `rows` you pass (they are treated as the already-fetched current page);
|
|
593
|
+
* instead it calls `onServerChange` whenever the query changes so you can fetch
|
|
594
|
+
* the right slice. Provide `rowCount` for correct page counts. @default false
|
|
595
|
+
*/
|
|
596
|
+
serverMode?: boolean;
|
|
597
|
+
/** Total row count on the server (required for pagination in server mode). */
|
|
598
|
+
rowCount?: number;
|
|
599
|
+
/** Server-mode callback fired (debounced) whenever the query changes. */
|
|
600
|
+
onServerChange?: (state: DatatableQuery) => void;
|
|
601
|
+
/** Show the Export toolbar button (split button: click = CSV, chevron = format menu). @default true */
|
|
602
|
+
showExport?: boolean;
|
|
603
|
+
/** Filename (without extension) for exports (CSV / Excel). @default "export" */
|
|
604
|
+
exportFilename?: string;
|
|
605
|
+
/** Server-mode precomputed aggregation. Per field, either a scalar/node (used as-is) or a per-function map
|
|
606
|
+
* `{ sum, avg, min, max, count }` so the footer honors whichever function the user picks in the panel. */
|
|
607
|
+
aggregationValues?: Record<string, React.ReactNode | Partial<Record<"sum" | "avg" | "min" | "max" | "count", React.ReactNode>>> | null;
|
|
608
|
+
/** Disable column reordering. When enabled (the default), columns can be reordered by dragging
|
|
609
|
+
* the header label, or via the header column menu's "Move left" / "Move right" items (a keyboard-
|
|
610
|
+
* accessible alternative; the move is announced through a visually-hidden live region). Both paths
|
|
611
|
+
* rearrange only the movable, unpinned columns and leave pinned/actions columns in place.
|
|
612
|
+
* @default false */
|
|
613
|
+
disableColumnReorder?: boolean;
|
|
614
|
+
/** Disable column resizing. When enabled (the default off), drag a header's right edge to resize a
|
|
615
|
+
* column, or **double-click** that edge to auto-fit the column to its widest visible content
|
|
616
|
+
* (header + rendered cells), Excel-style. @default false */
|
|
617
|
+
disableColumnResize?: boolean;
|
|
618
|
+
/** Make all columns editable by default (double-click a cell to edit; per-column `editable` overrides). @default false */
|
|
619
|
+
editMode?: boolean;
|
|
620
|
+
/** Called when a cell edit is committed: (updatedRow, originalRow, field). */
|
|
621
|
+
onRowUpdate?: (updatedRow: any, originalRow: any, field: string) => void;
|
|
622
|
+
/** Controlled-rows callback: receives the full next rows array after an edit (client mode). */
|
|
623
|
+
onRowsChange?: (rows: any[]) => void;
|
|
624
|
+
/** Fired when the built-in batch editor applies columns across selected rows:
|
|
625
|
+
* (changedRows, patch, selectedKeys). The selection-toolbar "Edit" button appears
|
|
626
|
+
* automatically when there are editable columns. Server-mode caveat: `changedRows`
|
|
627
|
+
* resolves only rows on the currently loaded page; for cross-page selections use the
|
|
628
|
+
* complete `selectedKeys` array and apply the `patch` server-side. */
|
|
629
|
+
onBatchUpdate?: (changedRows: any[], patch: Record<string, any>, selectedKeys: Array<string | number>) => void;
|
|
630
|
+
/** Show a "Go to" page jumper in the footer when there are more than 5 pages. @default true */
|
|
631
|
+
showPageJumper?: boolean;
|
|
632
|
+
/** Click-to-select mode: "row" highlights the clicked row, "cell" highlights a single cell. @default "none" */
|
|
633
|
+
selectionMode?: "none" | "row" | "cell";
|
|
634
|
+
/** Fired when a row is clicked in "row" selection mode: (row, key). */
|
|
635
|
+
onRowClick?: (row: any, key: string | number) => void;
|
|
636
|
+
/** Fired when a cell is clicked in "cell" selection mode: (value, row, field). */
|
|
637
|
+
onCellClick?: (value: any, row: any, field: string) => void;
|
|
638
|
+
/** Fired when the active cell changes: ({ key, field } | null). */
|
|
639
|
+
onActiveCellChange?: (cell: { key: string | number; field: string } | null) => void;
|
|
640
|
+
/** “Show totals row” state (changing the prop re-applies it; the user can also toggle it in the toolbar **Aggregation** panel). Aggregation is configured at runtime from that panel (pick columns + function); a column's `aggregation` prop just seeds the initial choice. @default false */
|
|
641
|
+
showAggregation?: boolean;
|
|
642
|
+
/** Accessible label for the grid (role="grid"). A standard `aria-label` prop takes precedence. @default "Data table" */
|
|
643
|
+
ariaLabel?: string;
|
|
644
|
+
/** Row-grouping fields (collapsible groups with subtotals). Changing the prop re-applies it; users can also group via a column's ⋮ menu. @default [] */
|
|
645
|
+
rowGrouping?: string[];
|
|
646
|
+
/** Enable row pinning — adds "Pin to top/bottom" to each row's actions menu; pinned rows stay sticky above/below the scroll body. @default false */
|
|
647
|
+
rowPinning?: boolean;
|
|
648
|
+
/** Enable reorder of rows: the whole row is mouse-draggable, and a focusable drag handle supports
|
|
649
|
+
* keyboard reorder (Enter/Space grabs, ArrowUp/ArrowDown move, Enter/Space drops, Escape cancels;
|
|
650
|
+
* changes are announced via a visually-hidden live region). Persists via `onRowOrderChange`.
|
|
651
|
+
* Disabled while sorting or grouping. @default false */
|
|
652
|
+
rowReorder?: boolean;
|
|
653
|
+
/** Enable drag-to-resize row height (handle on the row's bottom edge). @default false */
|
|
654
|
+
rowResize?: boolean;
|
|
655
|
+
/** Called with the new array of row keys after a drag-reorder. */
|
|
656
|
+
onRowOrderChange?: (keys: Array<string | number>) => void;
|
|
657
|
+
/** Initial pivot model (seeds the toolbar **Pivot** panel, which the user can edit live): aggregate `values` across `rows` (row groups) × `columns` (nested column groups). */
|
|
658
|
+
pivot?: {
|
|
659
|
+
rows: string[];
|
|
660
|
+
columns?: string[];
|
|
661
|
+
values: Array<{ field: string; agg?: "sum" | "avg" | "min" | "max" | "count"; label?: string; valueFormatter?: (v: any) => React.ReactNode }>;
|
|
662
|
+
} | null;
|
|
663
|
+
/** Start in pivot view. @default false */
|
|
664
|
+
pivotMode?: boolean;
|
|
665
|
+
/**
|
|
666
|
+
* Opt into row virtualization (windowing): render only the rows near the viewport for large
|
|
667
|
+
* datasets. Active only when pagination is effectively off (`pageSize={0}`) **and** row grouping
|
|
668
|
+
* is **not** active; otherwise it is ignored and the table renders normally. Pair with a fixed
|
|
669
|
+
* `height` so there is a scroll viewport to window against. **Rows may differ in height** — tall
|
|
670
|
+
* `renderCell` content, `wrapText` columns, or a drag-resized row all work: each rendered row is
|
|
671
|
+
* measured and cached by key, so the scrollbar and spacing stay accurate. Selection and inline
|
|
672
|
+
* edit keep working because they key off the row id, not its rendered index. @default false
|
|
673
|
+
*/
|
|
674
|
+
virtualized?: boolean;
|
|
675
|
+
/** Extra rows rendered above and below the visible window (smoother fast scrolling) when `virtualized`. @default 8 */
|
|
676
|
+
overscan?: number;
|
|
677
|
+
/** Estimated row height in px, used only for rows not yet measured (they refine to their real height once scrolled into view). Defaults to the density preset (compact 36 / standard 44 / comfortable 56). Set this to your typical row height for the best first-paint estimate. */
|
|
678
|
+
rowHeight?: number;
|
|
679
|
+
}
|
|
680
|
+
|
|
681
|
+
/** Query state reported by a server-mode Datatable. */
|
|
682
|
+
interface DatatableQuery {
|
|
683
|
+
/** Zero-based page index. */
|
|
684
|
+
page: number;
|
|
685
|
+
/** Current rows per page. */
|
|
686
|
+
pageSize: number;
|
|
687
|
+
/** Active sort, or null. */
|
|
688
|
+
sort: { field: string; dir: "asc" | "desc" } | null;
|
|
689
|
+
/** Active column filters. `value` is a `string[]` when `op === "isAnyOf"` (and empty for `isEmpty`/`isNotEmpty`). */
|
|
690
|
+
filters: Array<{ field: string; op: string; value: string | string[] }>;
|
|
691
|
+
/** Quick-search text. */
|
|
692
|
+
quickFilter: string;
|
|
693
|
+
}
|
|
694
|
+
|
|
695
|
+
interface DatatableColumn {
|
|
696
|
+
/** Row object key (also the sort/filter key). */
|
|
697
|
+
field: string;
|
|
698
|
+
/** Header label. @default field ("Actions" for actions columns) */
|
|
699
|
+
headerName?: string;
|
|
700
|
+
/** Data type. "actions" renders per-row action buttons via getActions. @default "string" */
|
|
701
|
+
type?: "string" | "number" | "actions";
|
|
702
|
+
/** Column width in px. @default 160 (120 for actions) */
|
|
703
|
+
width?: number;
|
|
704
|
+
/** Cell alignment; currently affects the actions column's button justification. @default "right" for number/actions columns, else "left" */
|
|
705
|
+
align?: "left" | "right";
|
|
706
|
+
/** Allow sorting this column. @default true */
|
|
707
|
+
sortable?: boolean;
|
|
708
|
+
/** Allow filtering this column. @default true */
|
|
709
|
+
filterable?: boolean;
|
|
710
|
+
/** Allow hiding this column. @default true */
|
|
711
|
+
hideable?: boolean;
|
|
712
|
+
/** Allow pinning this column. @default true */
|
|
713
|
+
pinnable?: boolean;
|
|
714
|
+
/** Allow grouping rows by this column (via the ⋮ menu). @default true for non-number, non-actions columns */
|
|
715
|
+
groupable?: boolean;
|
|
716
|
+
/** Pin this column on first render. */
|
|
717
|
+
pinned?: "left" | "right";
|
|
718
|
+
/** Allow drag-to-resize of this column. @default true */
|
|
719
|
+
resizable?: boolean;
|
|
720
|
+
/** Summary-footer aggregation: a preset, or a function over the column's values. */
|
|
721
|
+
aggregation?: "sum" | "avg" | "min" | "max" | "count" | ((values: any[], rows: any[]) => React.ReactNode);
|
|
722
|
+
/** Format an aggregation result for the footer (falls back to valueFormatter). */
|
|
723
|
+
aggregationFormatter?: (value: any) => React.ReactNode;
|
|
724
|
+
/** Map a row to its exported CSV value (defaults to the raw field value). */
|
|
725
|
+
exportValue?: (value: any, row: any) => string | number;
|
|
726
|
+
/** Make this column's cells editable (double-click to edit). Overrides the grid `editMode`. */
|
|
727
|
+
editable?: boolean;
|
|
728
|
+
/** Editor type. "select" (or any column with `valueOptions`) renders a dropdown; else a text/number input by column type. */
|
|
729
|
+
editType?: "text" | "number" | "select";
|
|
730
|
+
/** Hide the column header ⋮ menu. @default false */
|
|
731
|
+
disableColumnMenu?: boolean;
|
|
732
|
+
/** Start with this column's cell text wrapped onto multiple lines (the row grows down) instead of
|
|
733
|
+
* clipped to one line. Users can also toggle it live from the column ⋮ menu ("Wrap text"). @default false */
|
|
734
|
+
wrapText?: boolean;
|
|
735
|
+
/** Distinct values for the "is any of" multi-value filter (recommended in server mode). */
|
|
736
|
+
valueOptions?: Array<string | { value: string; label: string }>;
|
|
737
|
+
/** Format the raw value to a string/number for display. */
|
|
738
|
+
valueFormatter?: (value: any, row: any) => React.ReactNode;
|
|
739
|
+
/** Fully custom cell renderer (badges, avatars, etc.). */
|
|
740
|
+
renderCell?: (value: any, row: any) => React.ReactNode;
|
|
741
|
+
/** For type:"actions" — returns the row's action items. */
|
|
742
|
+
getActions?: (row: any) => DatatableRowAction[];
|
|
743
|
+
}
|
|
744
|
+
|
|
745
|
+
/** A per-row action in an actions column. */
|
|
746
|
+
interface DatatableRowAction {
|
|
747
|
+
/** Icon node (rendered as an icon button, or leading icon in the overflow menu). */
|
|
748
|
+
icon?: React.ReactNode;
|
|
749
|
+
/** Accessible label / tooltip / menu text. */
|
|
750
|
+
label: string;
|
|
751
|
+
/** Click handler, receives the row. */
|
|
752
|
+
onClick?: (row: any) => void;
|
|
753
|
+
/** Place in the ⋮ overflow menu instead of inline. @default false */
|
|
754
|
+
showInMenu?: boolean;
|
|
755
|
+
/** Render in danger color. */
|
|
756
|
+
danger?: boolean;
|
|
757
|
+
disabled?: boolean;
|
|
758
|
+
}
|
|
759
|
+
|
|
760
|
+
/** A batch action shown in the selection toolbar. */
|
|
761
|
+
interface DatatableBatchAction {
|
|
762
|
+
/** Button label. */
|
|
763
|
+
label: string;
|
|
764
|
+
/** Leading icon node. */
|
|
765
|
+
icon?: React.ReactNode;
|
|
766
|
+
/** Handler: (selectedKeys, selectedRows, clearSelection). */
|
|
767
|
+
onClick?: (keys: Array<string | number>, rows: any[], clearSelection: () => void) => void;
|
|
768
|
+
/** Render in danger color. */
|
|
769
|
+
danger?: boolean;
|
|
770
|
+
disabled?: boolean;
|
|
771
|
+
}
|
|
772
|
+
|
|
652
773
|
declare function Datatable(props: DatatableProps): React.JSX.Element;
|
|
653
774
|
|
|
654
|
-
/**
|
|
655
|
-
*
|
|
656
|
-
*
|
|
657
|
-
*
|
|
658
|
-
*
|
|
659
|
-
|
|
660
|
-
|
|
661
|
-
|
|
662
|
-
|
|
663
|
-
|
|
664
|
-
|
|
665
|
-
|
|
666
|
-
|
|
667
|
-
|
|
668
|
-
|
|
669
|
-
|
|
670
|
-
|
|
671
|
-
|
|
672
|
-
|
|
673
|
-
|
|
674
|
-
|
|
675
|
-
|
|
676
|
-
|
|
677
|
-
|
|
678
|
-
|
|
679
|
-
|
|
680
|
-
|
|
775
|
+
/**
|
|
776
|
+
* Apply a `DatatableQuery` (the object a `serverMode` grid passes to
|
|
777
|
+
* `onServerChange`) to a plain array of rows — quick search, per-column filters,
|
|
778
|
+
* sort, and paging — with the same operator semantics the grid uses in client
|
|
779
|
+
* mode. Use it to back a `serverMode` Datatable from any data source (or a fake
|
|
780
|
+
* backend in tests) and get identical results. Pass `columns` so number columns
|
|
781
|
+
* sort/compare numerically and quick-search scans the intended fields.
|
|
782
|
+
*
|
|
783
|
+
* @returns `rows` (the current page), `total` (filtered count, for `rowCount`),
|
|
784
|
+
* and `filtered` (the full filtered+sorted set before paging — handy for
|
|
785
|
+
* computing server-side aggregation totals).
|
|
786
|
+
*/
|
|
787
|
+
declare function runDatatableQuery<T = any>(
|
|
788
|
+
rows: T[],
|
|
789
|
+
query: DatatableQuery,
|
|
790
|
+
options?: { columns?: DatatableColumn[]; searchFields?: string[] }
|
|
791
|
+
): { rows: T[]; total: number; filtered: T[] };
|
|
792
|
+
|
|
793
|
+
/**
|
|
794
|
+
* Date picker with a calendar popover — month/year navigation, a month grid,
|
|
795
|
+
* today highlight, min/max bounds, clearable value, and custom formatting.
|
|
796
|
+
*
|
|
797
|
+
* @startingPoint section="Inputs" subtitle="Calendar date picker" viewport="700x120"
|
|
798
|
+
*/
|
|
799
|
+
interface DatePickerProps extends Omit<React.HTMLAttributes<HTMLDivElement>, "onChange" | "defaultValue"> {
|
|
800
|
+
/** Field label rendered above the control. */
|
|
801
|
+
label?: React.ReactNode;
|
|
802
|
+
/** Helper text shown below when there is no error. */
|
|
803
|
+
hint?: React.ReactNode;
|
|
804
|
+
/** Error message — turns the field red and replaces the hint. */
|
|
805
|
+
error?: React.ReactNode;
|
|
806
|
+
/** Marks the field required (adds an asterisk to the label). @default false */
|
|
807
|
+
required?: boolean;
|
|
808
|
+
/** Controlled selected date (or null). */
|
|
809
|
+
value?: Date | null;
|
|
810
|
+
/** Uncontrolled initial date. @default null */
|
|
811
|
+
defaultValue?: Date | null;
|
|
812
|
+
placeholder?: string;
|
|
813
|
+
/** Earliest selectable date. */
|
|
814
|
+
min?: Date;
|
|
815
|
+
/** Latest selectable date. */
|
|
816
|
+
max?: Date;
|
|
817
|
+
disabled?: boolean;
|
|
818
|
+
/** Color intent for the focus/open accent. @default "primary" */
|
|
819
|
+
tone?: "primary" | "success" | "warning" | "danger" | "info" | "neutral";
|
|
820
|
+
/** Show a clear (×) button when a date is set. @default true */
|
|
821
|
+
clearable?: boolean;
|
|
822
|
+
/** Custom display formatter (defaults to a localized medium date). */
|
|
823
|
+
format?: (date: Date) => string;
|
|
824
|
+
/** BCP-47 locale for month/weekday names + date formatting (Intl). Omit for the runtime default. @default undefined */
|
|
825
|
+
locale?: string;
|
|
826
|
+
/** First day of week: 0 = Sunday … 6 = Saturday. @default 0 */
|
|
827
|
+
weekStartsOn?: 0 | 1 | 2 | 3 | 4 | 5 | 6;
|
|
828
|
+
onChange?: (date: Date | null) => void;
|
|
829
|
+
}
|
|
830
|
+
|
|
681
831
|
declare function DatePicker(props: DatePickerProps): React.JSX.Element;
|
|
682
832
|
|
|
683
|
-
interface DateRange {
|
|
684
|
-
start: Date | null;
|
|
685
|
-
end: Date | null;
|
|
686
|
-
}
|
|
687
|
-
|
|
688
|
-
/**
|
|
689
|
-
* Date-range picker — calendar with click-start/click-end selection, in-range
|
|
690
|
-
* highlighting, hover preview, and quick presets (Last 7/14/30/90 days).
|
|
691
|
-
*
|
|
692
|
-
* @startingPoint section="Inputs" subtitle="Date range picker with presets" viewport="700x120"
|
|
693
|
-
*/
|
|
694
|
-
interface DateRangePickerProps extends Omit<React.HTMLAttributes<HTMLDivElement>, "onChange" | "defaultValue"> {
|
|
695
|
-
label
|
|
696
|
-
|
|
697
|
-
|
|
698
|
-
|
|
699
|
-
|
|
700
|
-
|
|
701
|
-
/**
|
|
702
|
-
|
|
703
|
-
/**
|
|
704
|
-
|
|
705
|
-
|
|
706
|
-
|
|
707
|
-
|
|
833
|
+
interface DateRange {
|
|
834
|
+
start: Date | null;
|
|
835
|
+
end: Date | null;
|
|
836
|
+
}
|
|
837
|
+
|
|
838
|
+
/**
|
|
839
|
+
* Date-range picker — calendar with click-start/click-end selection, in-range
|
|
840
|
+
* highlighting, hover preview, and quick presets (Last 7/14/30/90 days).
|
|
841
|
+
*
|
|
842
|
+
* @startingPoint section="Inputs" subtitle="Date range picker with presets" viewport="700x120"
|
|
843
|
+
*/
|
|
844
|
+
interface DateRangePickerProps extends Omit<React.HTMLAttributes<HTMLDivElement>, "onChange" | "defaultValue"> {
|
|
845
|
+
/** Field label rendered above the control. */
|
|
846
|
+
label?: React.ReactNode;
|
|
847
|
+
/** Helper text shown below when there is no error. */
|
|
848
|
+
hint?: React.ReactNode;
|
|
849
|
+
/** Error message — turns the field red and replaces the hint. */
|
|
850
|
+
error?: React.ReactNode;
|
|
851
|
+
/** Marks the field required (adds an asterisk to the label). @default false */
|
|
852
|
+
required?: boolean;
|
|
853
|
+
/** Controlled range. */
|
|
854
|
+
value?: DateRange;
|
|
855
|
+
/** Uncontrolled initial range. @default { start: null, end: null } */
|
|
856
|
+
defaultValue?: DateRange;
|
|
857
|
+
placeholder?: string;
|
|
858
|
+
/** Show the quick-preset column. @default true */
|
|
859
|
+
presets?: boolean;
|
|
860
|
+
/** BCP-47 locale for month/weekday names + date formatting (Intl). Omit for the runtime default. @default undefined */
|
|
861
|
+
locale?: string;
|
|
862
|
+
/** First day of week: 0 = Sunday … 6 = Saturday. @default 0 */
|
|
863
|
+
weekStartsOn?: 0 | 1 | 2 | 3 | 4 | 5 | 6;
|
|
864
|
+
/** Disable all interaction (the popover cannot be opened). @default false */
|
|
865
|
+
disabled?: boolean;
|
|
866
|
+
/** Color intent for the focus/open accent. @default "primary" */
|
|
867
|
+
tone?: "primary" | "success" | "warning" | "danger" | "info" | "neutral";
|
|
868
|
+
onChange?: (range: DateRange) => void;
|
|
869
|
+
}
|
|
870
|
+
|
|
708
871
|
declare function DateRangePicker(props: DateRangePickerProps): React.JSX.Element;
|
|
709
872
|
|
|
710
|
-
/**
|
|
711
|
-
* Modal dialog with scrim, pop-in animation, Esc-to-close, and backdrop close.
|
|
712
|
-
* Render conditionally and drive with `open` + `onClose`.
|
|
713
|
-
*/
|
|
714
|
-
interface DialogProps extends React.HTMLAttributes<HTMLDivElement> {
|
|
715
|
-
/** Whether the dialog is visible. */
|
|
716
|
-
open: boolean;
|
|
717
|
-
/** Called on close (Esc, backdrop, close button). */
|
|
718
|
-
onClose?: () => void;
|
|
719
|
-
title?: React.ReactNode;
|
|
720
|
-
description?: React.ReactNode;
|
|
721
|
-
/** Footer content, typically action buttons (right-aligned). */
|
|
722
|
-
footer?: React.ReactNode;
|
|
723
|
-
/** @default "md" */
|
|
724
|
-
size?: "sm" | "md" | "lg";
|
|
725
|
-
/**
|
|
726
|
-
|
|
727
|
-
|
|
728
|
-
|
|
729
|
-
|
|
873
|
+
/**
|
|
874
|
+
* Modal dialog with scrim, pop-in animation, Esc-to-close, and backdrop close.
|
|
875
|
+
* Render conditionally and drive with `open` + `onClose`.
|
|
876
|
+
*/
|
|
877
|
+
interface DialogProps extends Omit<React.HTMLAttributes<HTMLDivElement>, "title"> {
|
|
878
|
+
/** Whether the dialog is visible. */
|
|
879
|
+
open: boolean;
|
|
880
|
+
/** Called on close (Esc, backdrop, close button). */
|
|
881
|
+
onClose?: () => void;
|
|
882
|
+
title?: React.ReactNode;
|
|
883
|
+
description?: React.ReactNode;
|
|
884
|
+
/** Footer content, typically action buttons (right-aligned). */
|
|
885
|
+
footer?: React.ReactNode;
|
|
886
|
+
/** `"full"` is a near-fullscreen panel (fills the viewport minus a small margin). @default "md" */
|
|
887
|
+
size?: "sm" | "md" | "lg" | "full";
|
|
888
|
+
/** Keep the header + footer fixed and scroll only the body (for long content). @default false */
|
|
889
|
+
scrollBody?: boolean;
|
|
890
|
+
/** Close when the backdrop is clicked. @default true */
|
|
891
|
+
closeOnBackdrop?: boolean;
|
|
892
|
+
children?: React.ReactNode;
|
|
893
|
+
}
|
|
894
|
+
|
|
730
895
|
declare function Dialog(props: DialogProps): React.JSX.Element | null;
|
|
731
896
|
|
|
732
|
-
/**
|
|
733
|
-
* Thin rule that separates content. Horizontal or vertical; can carry a centered
|
|
734
|
-
* (or left/right-aligned) label.
|
|
735
|
-
*/
|
|
736
|
-
interface DividerProps extends React.HTMLAttributes<HTMLElement> {
|
|
737
|
-
/** @default "horizontal" */
|
|
738
|
-
orientation?: "horizontal" | "vertical";
|
|
739
|
-
/** Indent the start of a horizontal rule. */
|
|
740
|
-
inset?: boolean;
|
|
741
|
-
/** Label alignment when children are provided
|
|
742
|
-
|
|
743
|
-
|
|
744
|
-
|
|
745
|
-
|
|
746
|
-
|
|
897
|
+
/**
|
|
898
|
+
* Thin rule that separates content. Horizontal or vertical; can carry a centered
|
|
899
|
+
* (or left/right-aligned) label.
|
|
900
|
+
*/
|
|
901
|
+
interface DividerProps extends React.HTMLAttributes<HTMLElement> {
|
|
902
|
+
/** @default "horizontal" */
|
|
903
|
+
orientation?: "horizontal" | "vertical";
|
|
904
|
+
/** Indent the start of a horizontal rule. */
|
|
905
|
+
inset?: boolean;
|
|
906
|
+
/** Label alignment when children are provided — logical, so it mirrors under RTL.
|
|
907
|
+
* (`"left"`/`"right"` are still accepted as aliases for `"start"`/`"end"`.) @default "center" */
|
|
908
|
+
align?: "start" | "center" | "end" | "left" | "right";
|
|
909
|
+
/** Optional label text rendered in the middle of the rule. */
|
|
910
|
+
children?: React.ReactNode;
|
|
911
|
+
}
|
|
912
|
+
|
|
747
913
|
declare function Divider(props: DividerProps): React.JSX.Element;
|
|
748
914
|
|
|
749
|
-
/**
|
|
750
|
-
* Slide-in panel anchored to any screen edge, with scrim, Esc-to-close, and a
|
|
751
|
-
* header/body/footer layout. Drive with `open` + `onClose`.
|
|
752
|
-
*/
|
|
753
|
-
interface DrawerProps extends React.HTMLAttributes<HTMLDivElement> {
|
|
754
|
-
open: boolean;
|
|
755
|
-
onClose?: () => void;
|
|
756
|
-
/** Edge the panel slides from.
|
|
757
|
-
|
|
758
|
-
|
|
759
|
-
|
|
760
|
-
|
|
761
|
-
|
|
762
|
-
|
|
763
|
-
|
|
764
|
-
|
|
765
|
-
|
|
766
|
-
|
|
767
|
-
|
|
768
|
-
|
|
915
|
+
/**
|
|
916
|
+
* Slide-in panel anchored to any screen edge, with scrim, Esc-to-close, and a
|
|
917
|
+
* header/body/footer layout. Drive with `open` + `onClose`.
|
|
918
|
+
*/
|
|
919
|
+
interface DrawerProps extends Omit<React.HTMLAttributes<HTMLDivElement>, "title"> {
|
|
920
|
+
open: boolean;
|
|
921
|
+
onClose?: () => void;
|
|
922
|
+
/** Edge the panel slides from. `left`/`right`/`top`/`bottom` are physical; `start`/`end`
|
|
923
|
+
* are logical (inline-start/inline-end) and mirror under `dir="rtl"`. @default "right" */
|
|
924
|
+
side?: "left" | "right" | "top" | "bottom" | "start" | "end";
|
|
925
|
+
title?: React.ReactNode;
|
|
926
|
+
description?: React.ReactNode;
|
|
927
|
+
/** Footer content, typically action buttons (right-aligned). */
|
|
928
|
+
footer?: React.ReactNode;
|
|
929
|
+
/** Panel width for `side="left"`/`"right"` — preset "sm" (320px) / "md" (380px) / "lg" (480px), a number (px), or a CSS length. Ignored for top/bottom. @default "md" */
|
|
930
|
+
width?: "sm" | "md" | "lg" | number | string;
|
|
931
|
+
/** Panel height for `side="top"`/`"bottom"` — preset "sm" / "md" / "lg", a number (px), or a CSS length. Ignored for left/right. @default "md" */
|
|
932
|
+
height?: "sm" | "md" | "lg" | number | string;
|
|
933
|
+
/** Close when the backdrop is clicked. @default true */
|
|
934
|
+
closeOnBackdrop?: boolean;
|
|
935
|
+
children?: React.ReactNode;
|
|
936
|
+
}
|
|
937
|
+
|
|
769
938
|
declare function Drawer(props: DrawerProps): React.JSX.Element | null;
|
|
770
939
|
|
|
771
|
-
/**
|
|
772
|
-
* Empty / zero-data placeholder — icon, title, description, and call-to-action.
|
|
773
|
-
*
|
|
774
|
-
* @startingPoint section="Feedback" subtitle="Empty / zero-data state" viewport="700x300"
|
|
775
|
-
*/
|
|
776
|
-
interface EmptyStateProps extends React.HTMLAttributes<HTMLDivElement> {
|
|
777
|
-
/** Illustrative icon shown in a tinted tile. */
|
|
778
|
-
icon?: React.ReactNode;
|
|
779
|
-
title?: React.ReactNode;
|
|
780
|
-
description?: React.ReactNode;
|
|
781
|
-
/** Action buttons row. */
|
|
782
|
-
actions?: React.ReactNode;
|
|
783
|
-
/** Add a dashed border (good for drop targets / placeholders). @default false */
|
|
784
|
-
bordered?: boolean;
|
|
785
|
-
|
|
786
|
-
|
|
940
|
+
/**
|
|
941
|
+
* Empty / zero-data placeholder — icon, title, description, and call-to-action.
|
|
942
|
+
*
|
|
943
|
+
* @startingPoint section="Feedback" subtitle="Empty / zero-data state" viewport="700x300"
|
|
944
|
+
*/
|
|
945
|
+
interface EmptyStateProps extends Omit<React.HTMLAttributes<HTMLDivElement>, "title"> {
|
|
946
|
+
/** Illustrative icon shown in a tinted tile. */
|
|
947
|
+
icon?: React.ReactNode;
|
|
948
|
+
title?: React.ReactNode;
|
|
949
|
+
description?: React.ReactNode;
|
|
950
|
+
/** Action buttons row. */
|
|
951
|
+
actions?: React.ReactNode;
|
|
952
|
+
/** Add a dashed border (good for drop targets / placeholders). @deprecated Use `border`. @default false */
|
|
953
|
+
bordered?: boolean;
|
|
954
|
+
/** Add a dashed border (good for drop targets / placeholders); preferred alias for `bordered`. @default false */
|
|
955
|
+
border?: boolean;
|
|
956
|
+
}
|
|
957
|
+
|
|
787
958
|
declare function EmptyState(props: EmptyStateProps): React.JSX.Element;
|
|
788
959
|
|
|
789
|
-
/**
|
|
790
|
-
*
|
|
791
|
-
*
|
|
792
|
-
*
|
|
793
|
-
*
|
|
794
|
-
*
|
|
795
|
-
|
|
796
|
-
|
|
797
|
-
|
|
798
|
-
|
|
799
|
-
|
|
800
|
-
|
|
801
|
-
|
|
802
|
-
|
|
803
|
-
|
|
804
|
-
/**
|
|
805
|
-
|
|
806
|
-
|
|
807
|
-
|
|
808
|
-
|
|
960
|
+
/**
|
|
961
|
+
* Shared form-field chrome (label, hint, error, required asterisk) that wraps ANY control.
|
|
962
|
+
*
|
|
963
|
+
* `Field` is layout-only: it renders the label + your `children` + a single hint/error line,
|
|
964
|
+
* reusing the exact `.twc-field` markup Input/Select inline so every field looks identical.
|
|
965
|
+
* Wiring the control to the messages stays the consumer's job — point your control's
|
|
966
|
+
* `aria-describedby` at the exposed hint/error id (`` `${id}-desc` ``) and set `aria-invalid`
|
|
967
|
+
* when `error` is present. `error` replaces `hint` when both are given (error wins).
|
|
968
|
+
*
|
|
969
|
+
* @example
|
|
970
|
+
* <Field label="Email" hint="We never share it." htmlFor="email" id="email-field">
|
|
971
|
+
* <input id="email" aria-describedby="email-field-desc" />
|
|
972
|
+
* </Field>
|
|
973
|
+
*/
|
|
974
|
+
interface FieldProps extends Omit<React.HTMLAttributes<HTMLDivElement>, "id"> {
|
|
975
|
+
/** Field label rendered above the control. */
|
|
976
|
+
label?: React.ReactNode;
|
|
977
|
+
/** Helper text shown below when there is no error. */
|
|
978
|
+
hint?: React.ReactNode;
|
|
979
|
+
/** Error message — replaces the hint and renders in the danger color. */
|
|
980
|
+
error?: React.ReactNode;
|
|
981
|
+
/** Marks the field required (adds an asterisk after the label). @default false */
|
|
982
|
+
required?: boolean;
|
|
983
|
+
/** Id of the control the `<label>` should bind to (sets the label's `htmlFor`). */
|
|
984
|
+
htmlFor?: string;
|
|
985
|
+
/** Spacing scale, reserved for parity with Input/Select; exposed via `data-size`. @default "md" */
|
|
986
|
+
size?: "sm" | "md" | "lg";
|
|
987
|
+
/** Base id; the hint/error element gets `` `${id}-desc` `` for your `aria-describedby`. Auto-generated via `React.useId` when omitted. */
|
|
988
|
+
id?: string;
|
|
989
|
+
/** Extra class names appended to the `.twc-field` root. */
|
|
990
|
+
className?: string;
|
|
991
|
+
/** The control(s) the field wraps. */
|
|
992
|
+
children?: React.ReactNode;
|
|
993
|
+
}
|
|
994
|
+
|
|
995
|
+
declare function Field(props: FieldProps): React.JSX.Element;
|
|
996
|
+
|
|
997
|
+
/**
|
|
998
|
+
* Drag-and-drop file upload (dropzone) with a click-to-browse fallback and a
|
|
999
|
+
* removable selected-file list. Controlled via `value` (File[]) + `onChange`,
|
|
1000
|
+
* or uncontrolled.
|
|
1001
|
+
*
|
|
1002
|
+
* @startingPoint section="Inputs" subtitle="Drag & drop file upload" viewport="700x320"
|
|
1003
|
+
*/
|
|
1004
|
+
interface FileUploadProps extends Omit<React.HTMLAttributes<HTMLDivElement>, "onChange" | "defaultValue"> {
|
|
1005
|
+
/** Accepted file types (input accept string, e.g. "image/*,.pdf"). */
|
|
1006
|
+
accept?: string;
|
|
1007
|
+
/** Allow selecting multiple files. @default false */
|
|
1008
|
+
multiple?: boolean;
|
|
1009
|
+
disabled?: boolean;
|
|
1010
|
+
/** Color intent for the focus/open accent. @default "primary" */
|
|
1011
|
+
tone?: "primary" | "success" | "warning" | "danger" | "info" | "neutral";
|
|
1012
|
+
/** Field label rendered above the dropzone. */
|
|
1013
|
+
label?: React.ReactNode;
|
|
1014
|
+
/** Hint line under the prompt (defaults to the accept types). */
|
|
1015
|
+
hint?: React.ReactNode;
|
|
1016
|
+
/** Error message shown below the dropzone — turns the border red (sets `aria-invalid`). */
|
|
1017
|
+
error?: React.ReactNode;
|
|
1018
|
+
/** Marks the field required (adds an asterisk to the label). @default false */
|
|
1019
|
+
required?: boolean;
|
|
1020
|
+
/** Controlled list of selected files. */
|
|
1021
|
+
value?: File[];
|
|
1022
|
+
/** Uncontrolled initial file list. @default [] */
|
|
1023
|
+
defaultValue?: File[];
|
|
1024
|
+
onChange?: (files: File[]) => void;
|
|
1025
|
+
}
|
|
1026
|
+
|
|
809
1027
|
declare function FileUpload(props: FileUploadProps): React.JSX.Element;
|
|
810
1028
|
|
|
811
|
-
/**
|
|
812
|
-
* Square (or circular) button for a single icon. Always provide an aria-label.
|
|
813
|
-
*
|
|
814
|
-
* @startingPoint section="Buttons" subtitle="Icon-only button" viewport="700x120"
|
|
815
|
-
*/
|
|
816
|
-
interface IconButtonProps extends React.ButtonHTMLAttributes<HTMLButtonElement> {
|
|
817
|
-
/** The icon node to render (e.g. a Lucide SVG). */
|
|
818
|
-
icon?: React.ReactNode;
|
|
819
|
-
/**
|
|
820
|
-
variant?: "solid" | "soft" | "outline" | "ghost";
|
|
821
|
-
/**
|
|
822
|
-
|
|
823
|
-
|
|
824
|
-
|
|
825
|
-
|
|
826
|
-
|
|
827
|
-
|
|
828
|
-
|
|
1029
|
+
/**
|
|
1030
|
+
* Square (or circular) button for a single icon. Always provide an aria-label.
|
|
1031
|
+
*
|
|
1032
|
+
* @startingPoint section="Buttons" subtitle="Icon-only button" viewport="700x120"
|
|
1033
|
+
*/
|
|
1034
|
+
interface IconButtonProps extends React.ButtonHTMLAttributes<HTMLButtonElement> {
|
|
1035
|
+
/** The icon node to render (e.g. a Lucide SVG). */
|
|
1036
|
+
icon?: React.ReactNode;
|
|
1037
|
+
/** Fill style (same axes as Button). @default "ghost" */
|
|
1038
|
+
variant?: "solid" | "soft" | "outline" | "ghost";
|
|
1039
|
+
/** Color/intent, orthogonal to `variant` (mirrors Button). A destructive icon button is
|
|
1040
|
+
* `tone="danger"` with any variant. @default "primary" */
|
|
1041
|
+
tone?: "primary" | "danger";
|
|
1042
|
+
/** Control size; "xs" (~26px) is smaller than "sm". @default "md" */
|
|
1043
|
+
size?: "xs" | "sm" | "md" | "lg";
|
|
1044
|
+
/** Fully rounded (circular). @default false */
|
|
1045
|
+
round?: boolean;
|
|
1046
|
+
/** Accessible label — required for icon-only buttons. */
|
|
1047
|
+
"aria-label": string;
|
|
1048
|
+
}
|
|
1049
|
+
|
|
829
1050
|
declare function IconButton(props: IconButtonProps): React.JSX.Element;
|
|
830
1051
|
|
|
831
|
-
/**
|
|
832
|
-
* Text input with optional label, hint, error state, and inline icons.
|
|
833
|
-
*
|
|
834
|
-
* @startingPoint section="Inputs" subtitle="Labeled text input with validation" viewport="700x140"
|
|
835
|
-
*/
|
|
836
|
-
interface InputProps extends Omit<React.InputHTMLAttributes<HTMLInputElement>, "size"> {
|
|
837
|
-
/** Field label rendered above the control. */
|
|
838
|
-
label?: React.ReactNode;
|
|
839
|
-
/** Helper text shown below when there is no error. */
|
|
840
|
-
hint?: React.ReactNode;
|
|
841
|
-
/** Error message — turns the field red and replaces the hint. */
|
|
842
|
-
error?: React.ReactNode;
|
|
843
|
-
/** Marks the field required (adds an asterisk). */
|
|
844
|
-
required?: boolean;
|
|
845
|
-
/** Control size. @default "md" */
|
|
846
|
-
size?: "sm" | "md" | "lg";
|
|
847
|
-
/**
|
|
848
|
-
|
|
849
|
-
/**
|
|
850
|
-
|
|
851
|
-
|
|
852
|
-
|
|
853
|
-
|
|
1052
|
+
/**
|
|
1053
|
+
* Text input with optional label, hint, error state, and inline icons.
|
|
1054
|
+
*
|
|
1055
|
+
* @startingPoint section="Inputs" subtitle="Labeled text input with validation" viewport="700x140"
|
|
1056
|
+
*/
|
|
1057
|
+
interface InputProps extends Omit<React.InputHTMLAttributes<HTMLInputElement>, "size"> {
|
|
1058
|
+
/** Field label rendered above the control. */
|
|
1059
|
+
label?: React.ReactNode;
|
|
1060
|
+
/** Helper text shown below when there is no error. */
|
|
1061
|
+
hint?: React.ReactNode;
|
|
1062
|
+
/** Error message — turns the field red and replaces the hint. */
|
|
1063
|
+
error?: React.ReactNode;
|
|
1064
|
+
/** Marks the field required (adds an asterisk and forwards to the native input). */
|
|
1065
|
+
required?: boolean;
|
|
1066
|
+
/** Control size. @default "md" */
|
|
1067
|
+
size?: "sm" | "md" | "lg";
|
|
1068
|
+
/** Color intent for the focus/open accent. @default "primary" */
|
|
1069
|
+
tone?: "primary" | "success" | "warning" | "danger" | "info" | "neutral";
|
|
1070
|
+
/** Icon node inside the field, leading edge (prefix). */
|
|
1071
|
+
leftIcon?: React.ReactNode;
|
|
1072
|
+
/** Optional suffix icon/node inside the field, trailing edge. For `type="password"`, omitting this
|
|
1073
|
+
* shows a built-in reveal/hide eye toggle; providing `rightIcon` replaces it. */
|
|
1074
|
+
rightIcon?: React.ReactNode;
|
|
1075
|
+
}
|
|
1076
|
+
|
|
854
1077
|
declare function Input(props: InputProps): React.JSX.Element;
|
|
855
1078
|
|
|
856
|
-
interface KanbanColumn {
|
|
857
|
-
/** Unique column id (matches a card's `column`). */
|
|
858
|
-
id: string;
|
|
859
|
-
/** Column heading. */
|
|
860
|
-
title: React.ReactNode;
|
|
861
|
-
/** Dot color for the heading. */
|
|
862
|
-
color?: string;
|
|
863
|
-
}
|
|
864
|
-
|
|
865
|
-
interface KanbanCard {
|
|
866
|
-
id: string;
|
|
867
|
-
/** Which column the card is in. */
|
|
868
|
-
column: string;
|
|
869
|
-
title?: React.ReactNode;
|
|
870
|
-
description?: React.ReactNode;
|
|
871
|
-
/** Small uppercase tag chips. */
|
|
872
|
-
tags?: React.ReactNode[];
|
|
873
|
-
/** Footer node (e.g. an Avatar / due date). */
|
|
874
|
-
footer?: React.ReactNode;
|
|
875
|
-
[key: string]: any;
|
|
876
|
-
}
|
|
877
|
-
|
|
878
|
-
/**
|
|
879
|
-
* Drag-and-drop Kanban board — columns of cards you can drag between columns.
|
|
880
|
-
* Controlled via `cards` + `onCardMove`, or uncontrolled
|
|
881
|
-
*
|
|
882
|
-
*
|
|
883
|
-
*
|
|
884
|
-
|
|
885
|
-
|
|
886
|
-
|
|
887
|
-
|
|
888
|
-
|
|
889
|
-
|
|
890
|
-
|
|
891
|
-
|
|
892
|
-
|
|
893
|
-
|
|
1079
|
+
interface KanbanColumn {
|
|
1080
|
+
/** Unique column id (matches a card's `column`). */
|
|
1081
|
+
id: string;
|
|
1082
|
+
/** Column heading. */
|
|
1083
|
+
title: React.ReactNode;
|
|
1084
|
+
/** Dot color for the heading. */
|
|
1085
|
+
color?: string;
|
|
1086
|
+
}
|
|
1087
|
+
|
|
1088
|
+
interface KanbanCard {
|
|
1089
|
+
id: string;
|
|
1090
|
+
/** Which column the card is in. */
|
|
1091
|
+
column: string;
|
|
1092
|
+
title?: React.ReactNode;
|
|
1093
|
+
description?: React.ReactNode;
|
|
1094
|
+
/** Small uppercase tag chips. */
|
|
1095
|
+
tags?: React.ReactNode[];
|
|
1096
|
+
/** Footer node (e.g. an Avatar / due date). */
|
|
1097
|
+
footer?: React.ReactNode;
|
|
1098
|
+
[key: string]: any;
|
|
1099
|
+
}
|
|
1100
|
+
|
|
1101
|
+
/**
|
|
1102
|
+
* Drag-and-drop Kanban board — columns of cards you can drag between columns.
|
|
1103
|
+
* Controlled via `cards` + `onCardMove`, or uncontrolled via `defaultCards`.
|
|
1104
|
+
* Cards can also be moved with the keyboard: Enter/Space grabs a card, the
|
|
1105
|
+
* left/right arrow keys choose a column, Enter drops, Escape cancels. Supply
|
|
1106
|
+
* `renderCard` for custom card content.
|
|
1107
|
+
*
|
|
1108
|
+
* @startingPoint section="Data display" subtitle="Drag-and-drop Kanban board" viewport="900x420"
|
|
1109
|
+
*/
|
|
1110
|
+
interface KanbanProps extends React.HTMLAttributes<HTMLDivElement> {
|
|
1111
|
+
columns: KanbanColumn[];
|
|
1112
|
+
/** Controlled cards — pair with `onCardMove` to apply moves yourself. */
|
|
1113
|
+
cards?: KanbanCard[];
|
|
1114
|
+
/** Initial cards when uncontrolled (the board applies moves internally). */
|
|
1115
|
+
defaultCards?: KanbanCard[];
|
|
1116
|
+
/** Fired when a card is dropped in a new column: (cardId, toColumn, nextCards). */
|
|
1117
|
+
onCardMove?: (cardId: string, toColumn: string, nextCards: KanbanCard[]) => void;
|
|
1118
|
+
/** Custom card renderer. */
|
|
1119
|
+
renderCard?: (card: KanbanCard) => React.ReactNode;
|
|
1120
|
+
}
|
|
1121
|
+
|
|
894
1122
|
declare function Kanban(props: KanbanProps): React.JSX.Element;
|
|
895
1123
|
|
|
896
|
-
interface ListItemData {
|
|
897
|
-
/** Primary text. */
|
|
898
|
-
title: React.ReactNode;
|
|
899
|
-
/** Secondary text under the title. */
|
|
900
|
-
description?: React.ReactNode;
|
|
901
|
-
/** Leading node (icon / avatar). */
|
|
902
|
-
leading?: React.ReactNode;
|
|
903
|
-
/** Trailing node (badge, meta, chevron, switch). */
|
|
904
|
-
trailing?: React.ReactNode;
|
|
905
|
-
/** Makes the row a button. */
|
|
906
|
-
onClick?: (e: React.MouseEvent) => void;
|
|
907
|
-
/** Makes the row a link. */
|
|
908
|
-
href?: string;
|
|
909
|
-
/** Highlight as selected. */
|
|
910
|
-
active?: boolean;
|
|
911
|
-
}
|
|
912
|
-
|
|
913
|
-
/**
|
|
914
|
-
* Vertical list of rows with leading/trailing slots, title + description, and
|
|
915
|
-
* optional interactivity (button or link rows).
|
|
916
|
-
*
|
|
917
|
-
* @startingPoint section="Data display" subtitle="List rows with lead/trail slots" viewport="700x300"
|
|
918
|
-
*/
|
|
919
|
-
interface ListProps extends React.HTMLAttributes<HTMLUListElement> {
|
|
920
|
-
items: ListItemData[];
|
|
921
|
-
/** Drop the card chrome (borderless, transparent). @default false */
|
|
922
|
-
plain?: boolean;
|
|
923
|
-
}
|
|
924
|
-
|
|
1124
|
+
interface ListItemData {
|
|
1125
|
+
/** Primary text. */
|
|
1126
|
+
title: React.ReactNode;
|
|
1127
|
+
/** Secondary text under the title. */
|
|
1128
|
+
description?: React.ReactNode;
|
|
1129
|
+
/** Leading node (icon / avatar). */
|
|
1130
|
+
leading?: React.ReactNode;
|
|
1131
|
+
/** Trailing node (badge, meta, chevron, switch). */
|
|
1132
|
+
trailing?: React.ReactNode;
|
|
1133
|
+
/** Makes the row a button. */
|
|
1134
|
+
onClick?: (e: React.MouseEvent) => void;
|
|
1135
|
+
/** Makes the row a link. */
|
|
1136
|
+
href?: string;
|
|
1137
|
+
/** Highlight as selected. */
|
|
1138
|
+
active?: boolean;
|
|
1139
|
+
}
|
|
1140
|
+
|
|
1141
|
+
/**
|
|
1142
|
+
* Vertical list of rows with leading/trailing slots, title + description, and
|
|
1143
|
+
* optional interactivity (button or link rows).
|
|
1144
|
+
*
|
|
1145
|
+
* @startingPoint section="Data display" subtitle="List rows with lead/trail slots" viewport="700x300"
|
|
1146
|
+
*/
|
|
1147
|
+
interface ListProps extends React.HTMLAttributes<HTMLUListElement> {
|
|
1148
|
+
items: ListItemData[];
|
|
1149
|
+
/** Drop the card chrome (borderless, transparent). @default false */
|
|
1150
|
+
plain?: boolean;
|
|
1151
|
+
}
|
|
1152
|
+
|
|
925
1153
|
declare function List(props: ListProps): React.JSX.Element;
|
|
926
1154
|
|
|
927
|
-
/**
|
|
928
|
-
* Multi-select (MUI-Autocomplete style) — type directly among the chips to
|
|
929
|
-
* filter; the overlay shows checkable options only. Supports grouped options
|
|
930
|
-
* and two-line (title + subtitle) options. Backspace on empty input removes
|
|
931
|
-
* the last chip.
|
|
932
|
-
*
|
|
933
|
-
* @startingPoint section="Selects" subtitle="Multi-select with chips & inline search" viewport="700x180"
|
|
934
|
-
*/
|
|
935
|
-
interface MultiSelectProps extends Omit<React.
|
|
936
|
-
label?: React.ReactNode;
|
|
937
|
-
hint?: React.ReactNode;
|
|
938
|
-
error?: React.ReactNode;
|
|
939
|
-
required?: boolean;
|
|
940
|
-
|
|
941
|
-
|
|
942
|
-
|
|
943
|
-
|
|
944
|
-
|
|
945
|
-
/**
|
|
946
|
-
|
|
947
|
-
|
|
948
|
-
|
|
949
|
-
|
|
950
|
-
|
|
951
|
-
|
|
952
|
-
value
|
|
953
|
-
|
|
954
|
-
|
|
955
|
-
|
|
956
|
-
|
|
957
|
-
|
|
958
|
-
|
|
959
|
-
|
|
960
|
-
|
|
961
|
-
|
|
962
|
-
|
|
963
|
-
|
|
1155
|
+
/**
|
|
1156
|
+
* Multi-select (MUI-Autocomplete style) — type directly among the chips to
|
|
1157
|
+
* filter; the overlay shows checkable options only. Supports grouped options
|
|
1158
|
+
* and two-line (title + subtitle) options. Backspace on empty input removes
|
|
1159
|
+
* the last chip.
|
|
1160
|
+
*
|
|
1161
|
+
* @startingPoint section="Selects" subtitle="Multi-select with chips & inline search" viewport="700x180"
|
|
1162
|
+
*/
|
|
1163
|
+
interface MultiSelectProps extends Omit<React.InputHTMLAttributes<HTMLInputElement>, "size" | "value" | "defaultValue" | "onChange"> {
|
|
1164
|
+
label?: React.ReactNode;
|
|
1165
|
+
hint?: React.ReactNode;
|
|
1166
|
+
error?: React.ReactNode;
|
|
1167
|
+
required?: boolean;
|
|
1168
|
+
/** Control height preset, matching Select/Combobox. @default "md" */
|
|
1169
|
+
size?: "sm" | "md" | "lg";
|
|
1170
|
+
/** Color intent for the focus/open accent. @default "primary" */
|
|
1171
|
+
tone?: "primary" | "success" | "warning" | "danger" | "info" | "neutral";
|
|
1172
|
+
placeholder?: string;
|
|
1173
|
+
/** Options — strings, {value,label,description}, or {group,options} groups. */
|
|
1174
|
+
options: Array<string | MultiSelectOption | MultiSelectGroup>;
|
|
1175
|
+
/** Controlled selected values. */
|
|
1176
|
+
value?: string[];
|
|
1177
|
+
/** Uncontrolled initial values. */
|
|
1178
|
+
defaultValue?: string[];
|
|
1179
|
+
onChange?: (values: string[]) => void;
|
|
1180
|
+
/** Show a clear-all (×) affix when at least one value is selected. @default false */
|
|
1181
|
+
clearable?: boolean;
|
|
1182
|
+
disabled?: boolean;
|
|
1183
|
+
/** Open the menu upward instead of down (e.g. near a viewport bottom). @default "bottom" */
|
|
1184
|
+
placement?: "bottom" | "top";
|
|
1185
|
+
/** Render the dropdown in a portal (position:fixed on document.body) so it is never clipped by a
|
|
1186
|
+
* scrolling/overflow-hidden ancestor; auto-flips up near the viewport bottom. Set false to render
|
|
1187
|
+
* inline. @default true */
|
|
1188
|
+
portal?: boolean;
|
|
1189
|
+
/** Minimum popover width in px when portaled (useful when the control is narrow). @default 0 */
|
|
1190
|
+
minWidth?: number;
|
|
1191
|
+
/** Composed with the field's open-on-focus behavior — your handler runs first. */
|
|
1192
|
+
onFocus?: React.FocusEventHandler<HTMLInputElement>;
|
|
1193
|
+
/** Composed with the field's keyboard navigation (Arrows/Enter/Escape/Backspace) — your handler runs first; call `event.preventDefault()` to suppress it. */
|
|
1194
|
+
onKeyDown?: React.KeyboardEventHandler<HTMLInputElement>;
|
|
1195
|
+
}
|
|
1196
|
+
|
|
1197
|
+
interface MultiSelectOption {
|
|
1198
|
+
value: string;
|
|
1199
|
+
label: string;
|
|
1200
|
+
/** Optional second line shown under the label. */
|
|
1201
|
+
description?: string;
|
|
1202
|
+
}
|
|
1203
|
+
|
|
1204
|
+
/** A group heading with its own options. */
|
|
1205
|
+
interface MultiSelectGroup {
|
|
1206
|
+
group: string;
|
|
1207
|
+
options: Array<string | MultiSelectOption>;
|
|
1208
|
+
}
|
|
1209
|
+
|
|
964
1210
|
declare function MultiSelect(props: MultiSelectProps): React.JSX.Element;
|
|
965
1211
|
|
|
966
|
-
interface NavbarLink {
|
|
967
|
-
label: React.ReactNode;
|
|
968
|
-
href?: string;
|
|
969
|
-
icon?: React.ReactNode;
|
|
970
|
-
active?: boolean;
|
|
971
|
-
onClick?: (e: React.MouseEvent) => void;
|
|
972
|
-
}
|
|
973
|
-
|
|
974
|
-
/**
|
|
975
|
-
* Top application bar — brand, inline nav links (hidden on small screens), and
|
|
976
|
-
* a right-aligned actions slot. Sticky + translucent by default.
|
|
977
|
-
*
|
|
978
|
-
* @startingPoint section="Layout" subtitle="Top app bar / navbar" viewport="900x80"
|
|
979
|
-
*/
|
|
980
|
-
interface NavbarProps extends React.HTMLAttributes<HTMLElement> {
|
|
981
|
-
/** Brand/logo node at the left. */
|
|
982
|
-
brand?: React.ReactNode;
|
|
983
|
-
/**
|
|
984
|
-
|
|
985
|
-
|
|
986
|
-
|
|
987
|
-
|
|
988
|
-
|
|
989
|
-
|
|
990
|
-
|
|
991
|
-
|
|
992
|
-
|
|
1212
|
+
interface NavbarLink {
|
|
1213
|
+
label: React.ReactNode;
|
|
1214
|
+
href?: string;
|
|
1215
|
+
icon?: React.ReactNode;
|
|
1216
|
+
active?: boolean;
|
|
1217
|
+
onClick?: (e: React.MouseEvent) => void;
|
|
1218
|
+
}
|
|
1219
|
+
|
|
1220
|
+
/**
|
|
1221
|
+
* Top application bar — brand, inline nav links (hidden on small screens), and
|
|
1222
|
+
* a right-aligned actions slot. Sticky + translucent by default.
|
|
1223
|
+
*
|
|
1224
|
+
* @startingPoint section="Layout" subtitle="Top app bar / navbar" viewport="900x80"
|
|
1225
|
+
*/
|
|
1226
|
+
interface NavbarProps extends React.HTMLAttributes<HTMLElement> {
|
|
1227
|
+
/** Brand/logo node at the left. */
|
|
1228
|
+
brand?: React.ReactNode;
|
|
1229
|
+
/** If set, the brand becomes a link to this URL (sanitized). Otherwise the brand is a
|
|
1230
|
+
* plain, non-navigating element unless `onBrandClick` is given. */
|
|
1231
|
+
brandHref?: string;
|
|
1232
|
+
/** Click handler for the brand; renders it as a button when `brandHref` is not set. */
|
|
1233
|
+
onBrandClick?: (e: React.MouseEvent<HTMLButtonElement>) => void;
|
|
1234
|
+
/** Center nav links. */
|
|
1235
|
+
links?: NavbarLink[];
|
|
1236
|
+
/** Right-aligned actions (buttons, avatar, etc.). */
|
|
1237
|
+
actions?: React.ReactNode;
|
|
1238
|
+
/** Stick to the top with a translucent blur. @default true */
|
|
1239
|
+
sticky?: boolean;
|
|
1240
|
+
/** Hamburger handler shown on small screens. */
|
|
1241
|
+
onMenuClick?: () => void;
|
|
1242
|
+
}
|
|
1243
|
+
|
|
993
1244
|
declare function Navbar(props: NavbarProps): React.JSX.Element;
|
|
994
1245
|
|
|
995
|
-
/**
|
|
996
|
-
* Page navigation with first/last, prev/next, and smart ellipsis truncation.
|
|
997
|
-
*/
|
|
998
|
-
interface PaginationProps extends Omit<React.HTMLAttributes<HTMLElement>, "onChange"> {
|
|
999
|
-
/**
|
|
1000
|
-
page?: number;
|
|
1001
|
-
/**
|
|
1002
|
-
|
|
1003
|
-
/**
|
|
1004
|
-
|
|
1005
|
-
/**
|
|
1006
|
-
|
|
1007
|
-
/** Page numbers
|
|
1008
|
-
|
|
1009
|
-
/** @default
|
|
1010
|
-
|
|
1011
|
-
/**
|
|
1012
|
-
|
|
1013
|
-
/**
|
|
1014
|
-
|
|
1015
|
-
|
|
1016
|
-
|
|
1246
|
+
/**
|
|
1247
|
+
* Page navigation with first/last, prev/next, and smart ellipsis truncation.
|
|
1248
|
+
*/
|
|
1249
|
+
interface PaginationProps extends Omit<React.HTMLAttributes<HTMLElement>, "onChange"> {
|
|
1250
|
+
/** Controlled current 1-based page; when omitted the component manages its own page. */
|
|
1251
|
+
page?: number;
|
|
1252
|
+
/** Initial 1-based page when uncontrolled (no `page` prop). @default 1 */
|
|
1253
|
+
defaultPage?: number;
|
|
1254
|
+
/** Total number of pages. */
|
|
1255
|
+
total: number;
|
|
1256
|
+
/** Called with the new page when the user navigates. */
|
|
1257
|
+
onChange?: (page: number) => void;
|
|
1258
|
+
/** Page numbers shown on each side of the current page. @default 1 */
|
|
1259
|
+
siblings?: number;
|
|
1260
|
+
/** Page numbers always shown at each end (first/last). @default 1 */
|
|
1261
|
+
boundaries?: number;
|
|
1262
|
+
/** @default "md" */
|
|
1263
|
+
size?: "sm" | "md" | "lg";
|
|
1264
|
+
/** Show a "Go to" page input for jumping directly to a page. @deprecated Use `showPageJumper`. @default false */
|
|
1265
|
+
showJumper?: boolean;
|
|
1266
|
+
/** Show a "Go to" page input for jumping directly to a page; preferred alias for `showJumper`. @default false */
|
|
1267
|
+
showPageJumper?: boolean;
|
|
1268
|
+
/** Label before the jump input. @default "Go to" */
|
|
1269
|
+
jumperLabel?: React.ReactNode;
|
|
1270
|
+
}
|
|
1271
|
+
|
|
1017
1272
|
declare function Pagination(props: PaginationProps): React.JSX.Element;
|
|
1018
1273
|
|
|
1019
|
-
/**
|
|
1020
|
-
* Click-triggered floating panel anchored to a trigger element. Renders in a
|
|
1021
|
-
* portal (never clipped), auto-flips near the viewport edge, closes on
|
|
1022
|
-
* outside-click / Esc. Use for rich content; for plain text use Tooltip.
|
|
1023
|
-
*/
|
|
1024
|
-
interface PopoverProps extends React.HTMLAttributes<HTMLSpanElement> {
|
|
1025
|
-
/** The clickable trigger element. */
|
|
1026
|
-
trigger: React.ReactNode;
|
|
1027
|
-
/** Optional bold title inside the panel. */
|
|
1028
|
-
title?: React.ReactNode;
|
|
1029
|
-
/** Side to open toward. @default "bottom" */
|
|
1030
|
-
placement?: "top" | "bottom" | "left" | "right";
|
|
1031
|
-
/** Cross-axis alignment for top/bottom. @default "center" */
|
|
1032
|
-
align?: "start" | "center" | "end";
|
|
1033
|
-
/** Panel width in px. @default 240 */
|
|
1034
|
-
width?: number;
|
|
1035
|
-
/** Panel content. */
|
|
1036
|
-
children?: React.ReactNode;
|
|
1037
|
-
|
|
1038
|
-
|
|
1274
|
+
/**
|
|
1275
|
+
* Click-triggered floating panel anchored to a trigger element. Renders in a
|
|
1276
|
+
* portal (never clipped), auto-flips near the viewport edge, closes on
|
|
1277
|
+
* outside-click / Esc. Use for rich content; for plain text use Tooltip.
|
|
1278
|
+
*/
|
|
1279
|
+
interface PopoverProps extends React.HTMLAttributes<HTMLSpanElement> {
|
|
1280
|
+
/** The clickable trigger element. */
|
|
1281
|
+
trigger: React.ReactNode;
|
|
1282
|
+
/** Optional bold title inside the panel. */
|
|
1283
|
+
title?: React.ReactNode;
|
|
1284
|
+
/** Side to open toward. @default "bottom" */
|
|
1285
|
+
placement?: "top" | "bottom" | "left" | "right";
|
|
1286
|
+
/** Cross-axis alignment for top/bottom. @default "center" */
|
|
1287
|
+
align?: "start" | "center" | "end";
|
|
1288
|
+
/** Panel width in px. @default 240 */
|
|
1289
|
+
width?: number;
|
|
1290
|
+
/** Panel content. */
|
|
1291
|
+
children?: React.ReactNode;
|
|
1292
|
+
/** Open on first render in uncontrolled mode. @default false */
|
|
1293
|
+
defaultOpen?: boolean;
|
|
1294
|
+
/** Controlled open state — pair with `onOpenChange`. Omit for internal (uncontrolled) state. */
|
|
1295
|
+
open?: boolean;
|
|
1296
|
+
/** Called with the requested open state on trigger click, Esc, or outside click. */
|
|
1297
|
+
onOpenChange?: (open: boolean) => void;
|
|
1298
|
+
}
|
|
1299
|
+
|
|
1039
1300
|
declare function Popover(props: PopoverProps): React.JSX.Element;
|
|
1040
1301
|
|
|
1041
|
-
/**
|
|
1042
|
-
* Linear progress bar — determinate or indeterminate, with semantic tones.
|
|
1043
|
-
|
|
1044
|
-
|
|
1045
|
-
|
|
1046
|
-
|
|
1047
|
-
/**
|
|
1048
|
-
|
|
1049
|
-
/** @default
|
|
1050
|
-
|
|
1051
|
-
/** @default "
|
|
1052
|
-
|
|
1053
|
-
/**
|
|
1054
|
-
|
|
1055
|
-
/**
|
|
1056
|
-
|
|
1057
|
-
|
|
1058
|
-
|
|
1302
|
+
/**
|
|
1303
|
+
* Linear progress bar — determinate or indeterminate, with semantic tones.
|
|
1304
|
+
* `className` and all extra HTML attributes (`style`, `id`, handlers, …) land on the
|
|
1305
|
+
* root wrapper; `role="progressbar"` + `aria-value*` live on the inner track.
|
|
1306
|
+
*/
|
|
1307
|
+
interface ProgressProps extends React.HTMLAttributes<HTMLDivElement> {
|
|
1308
|
+
/** Current value. @default 0 */
|
|
1309
|
+
value?: number;
|
|
1310
|
+
/** Maximum value. @default 100 */
|
|
1311
|
+
max?: number;
|
|
1312
|
+
/** @default "primary" */
|
|
1313
|
+
tone?: "primary" | "info" | "success" | "warning" | "danger";
|
|
1314
|
+
/** @default "md" */
|
|
1315
|
+
size?: "sm" | "md" | "lg";
|
|
1316
|
+
/** Animate as an indeterminate bar (ignores value). */
|
|
1317
|
+
indeterminate?: boolean;
|
|
1318
|
+
/** Show a percentage label above the bar. */
|
|
1319
|
+
showLabel?: boolean;
|
|
1320
|
+
}
|
|
1321
|
+
|
|
1059
1322
|
declare function Progress(props: ProgressProps): React.JSX.Element;
|
|
1060
1323
|
|
|
1061
|
-
/**
|
|
1062
|
-
* Radio button with label and description. Group several with the same `name`.
|
|
1063
|
-
*/
|
|
1064
|
-
interface RadioProps extends Omit<React.InputHTMLAttributes<HTMLInputElement>, "size" | "type"> {
|
|
1065
|
-
label?: React.ReactNode;
|
|
1066
|
-
description?: React.ReactNode;
|
|
1067
|
-
|
|
1068
|
-
|
|
1069
|
-
|
|
1324
|
+
/**
|
|
1325
|
+
* Radio button with label and description. Group several with the same `name`.
|
|
1326
|
+
*/
|
|
1327
|
+
interface RadioProps extends Omit<React.InputHTMLAttributes<HTMLInputElement>, "size" | "type"> {
|
|
1328
|
+
label?: React.ReactNode;
|
|
1329
|
+
description?: React.ReactNode;
|
|
1330
|
+
/** Error message shown below the control; tints the dot red and wires `aria-invalid`/`aria-describedby`. @default undefined */
|
|
1331
|
+
error?: React.ReactNode;
|
|
1332
|
+
size?: "sm" | "md" | "lg";
|
|
1333
|
+
/** Color intent. @default "primary" */
|
|
1334
|
+
tone?: "primary" | "success" | "warning" | "danger" | "info" | "neutral";
|
|
1335
|
+
}
|
|
1336
|
+
|
|
1070
1337
|
declare function Radio(props: RadioProps): React.JSX.Element;
|
|
1071
1338
|
|
|
1072
|
-
/**
|
|
1073
|
-
* Star rating — interactive (click/hover) or read-only display.
|
|
1074
|
-
*
|
|
1075
|
-
* @startingPoint section="Inputs" subtitle="Star rating" viewport="700x90"
|
|
1076
|
-
*/
|
|
1077
|
-
interface RatingProps extends Omit<React.HTMLAttributes<HTMLDivElement>, "onChange" | "defaultValue" | "color"> {
|
|
1078
|
-
/** Controlled value (0…count). */
|
|
1079
|
-
value?: number;
|
|
1080
|
-
/** Uncontrolled initial value. @default 0 */
|
|
1081
|
-
defaultValue?: number;
|
|
1082
|
-
/** Number of stars. @default 5 */
|
|
1083
|
-
count?: number;
|
|
1084
|
-
/** @default "md" */
|
|
1085
|
-
size?: "sm" | "md" | "lg";
|
|
1086
|
-
/**
|
|
1087
|
-
|
|
1088
|
-
/**
|
|
1089
|
-
|
|
1090
|
-
/**
|
|
1091
|
-
|
|
1092
|
-
|
|
1093
|
-
|
|
1094
|
-
|
|
1339
|
+
/**
|
|
1340
|
+
* Star rating — interactive (click/hover) or read-only display.
|
|
1341
|
+
*
|
|
1342
|
+
* @startingPoint section="Inputs" subtitle="Star rating" viewport="700x90"
|
|
1343
|
+
*/
|
|
1344
|
+
interface RatingProps extends Omit<React.HTMLAttributes<HTMLDivElement>, "onChange" | "defaultValue" | "color"> {
|
|
1345
|
+
/** Controlled value (0…count). */
|
|
1346
|
+
value?: number;
|
|
1347
|
+
/** Uncontrolled initial value. @default 0 */
|
|
1348
|
+
defaultValue?: number;
|
|
1349
|
+
/** Number of stars. @default 5 */
|
|
1350
|
+
count?: number;
|
|
1351
|
+
/** @default "md" */
|
|
1352
|
+
size?: "sm" | "md" | "lg";
|
|
1353
|
+
/** Color intent for filled stars. @default "warning" */
|
|
1354
|
+
tone?: "primary" | "success" | "warning" | "danger" | "info" | "neutral";
|
|
1355
|
+
/** Explicit filled-star color; overrides `tone` when set. */
|
|
1356
|
+
color?: string;
|
|
1357
|
+
/** Display only, no interaction. @default false */
|
|
1358
|
+
readOnly?: boolean;
|
|
1359
|
+
/** Disable all interaction and dim the control. @default false */
|
|
1360
|
+
disabled?: boolean;
|
|
1361
|
+
/** Show the numeric value beside the stars. @default false */
|
|
1362
|
+
showValue?: boolean;
|
|
1363
|
+
onChange?: (value: number) => void;
|
|
1364
|
+
}
|
|
1365
|
+
|
|
1095
1366
|
declare function Rating(props: RatingProps): React.JSX.Element;
|
|
1096
1367
|
|
|
1097
|
-
/**
|
|
1098
|
-
* Custom select with a rounded popover (no native browser dropdown). Supports
|
|
1099
|
-
* grouped options and two-line (title + subtitle) options. Keyboard navigable.
|
|
1100
|
-
*
|
|
1101
|
-
* @startingPoint section="Selects" subtitle="Custom select with grouped options" viewport="700x160"
|
|
1102
|
-
*/
|
|
1103
|
-
interface SelectProps extends Omit<React.HTMLAttributes<HTMLButtonElement>, "onChange" | "defaultValue"> {
|
|
1104
|
-
label?: React.ReactNode;
|
|
1105
|
-
hint?: React.ReactNode;
|
|
1106
|
-
error?: React.ReactNode;
|
|
1107
|
-
required?: boolean;
|
|
1108
|
-
size?: "sm" | "md" | "lg";
|
|
1109
|
-
|
|
1110
|
-
|
|
1111
|
-
|
|
1112
|
-
/**
|
|
1113
|
-
|
|
1114
|
-
/**
|
|
1115
|
-
|
|
1116
|
-
/**
|
|
1117
|
-
|
|
1118
|
-
/**
|
|
1119
|
-
|
|
1120
|
-
|
|
1121
|
-
|
|
1122
|
-
/**
|
|
1123
|
-
|
|
1124
|
-
/**
|
|
1125
|
-
|
|
1126
|
-
|
|
1127
|
-
/**
|
|
1128
|
-
|
|
1129
|
-
|
|
1130
|
-
|
|
1131
|
-
|
|
1132
|
-
|
|
1133
|
-
|
|
1134
|
-
|
|
1135
|
-
|
|
1136
|
-
|
|
1137
|
-
|
|
1138
|
-
|
|
1139
|
-
|
|
1140
|
-
|
|
1141
|
-
|
|
1142
|
-
|
|
1143
|
-
|
|
1368
|
+
/**
|
|
1369
|
+
* Custom select with a rounded popover (no native browser dropdown). Supports
|
|
1370
|
+
* grouped options and two-line (title + subtitle) options. Keyboard navigable.
|
|
1371
|
+
*
|
|
1372
|
+
* @startingPoint section="Selects" subtitle="Custom select with grouped options" viewport="700x160"
|
|
1373
|
+
*/
|
|
1374
|
+
interface SelectProps extends Omit<React.HTMLAttributes<HTMLButtonElement>, "onChange" | "defaultValue"> {
|
|
1375
|
+
label?: React.ReactNode;
|
|
1376
|
+
hint?: React.ReactNode;
|
|
1377
|
+
error?: React.ReactNode;
|
|
1378
|
+
required?: boolean;
|
|
1379
|
+
size?: "sm" | "md" | "lg";
|
|
1380
|
+
/** Color intent for the focus/open accent. @default "primary" */
|
|
1381
|
+
tone?: "primary" | "success" | "warning" | "danger" | "info" | "neutral";
|
|
1382
|
+
placeholder?: string;
|
|
1383
|
+
/** Placeholder for the in-popover search box. @default "Search…" */
|
|
1384
|
+
searchPlaceholder?: string;
|
|
1385
|
+
/** Show a search box inside the dropdown to filter options. Omit to auto-enable when there are >5 options. */
|
|
1386
|
+
searchable?: boolean;
|
|
1387
|
+
/** Options — strings, {value,label,description}, or {group,options} groups. */
|
|
1388
|
+
options: Array<string | SelectOption | SelectGroup>;
|
|
1389
|
+
/** Controlled selected value. */
|
|
1390
|
+
value?: string | null;
|
|
1391
|
+
/** Uncontrolled initial value. */
|
|
1392
|
+
defaultValue?: string | null;
|
|
1393
|
+
/** Called with the chosen option's value, or `null` when cleared via `clearable`. */
|
|
1394
|
+
onChange?: (value: string | null) => void;
|
|
1395
|
+
/** Show a clear (×) affix when a value is selected; Delete/Backspace on the closed trigger also clears. @default false */
|
|
1396
|
+
clearable?: boolean;
|
|
1397
|
+
disabled?: boolean;
|
|
1398
|
+
/** Composed with the trigger's open/close toggle — your handler runs first; call `event.preventDefault()` to keep the menu from toggling. */
|
|
1399
|
+
onClick?: React.MouseEventHandler<HTMLButtonElement>;
|
|
1400
|
+
/** Composed with the trigger's keyboard navigation (Enter/Space/Arrows/Escape) — your handler runs first; call `event.preventDefault()` to suppress it. */
|
|
1401
|
+
onKeyDown?: React.KeyboardEventHandler<HTMLButtonElement>;
|
|
1402
|
+
/** Open the menu upward instead of down (e.g. near a viewport bottom). @default "bottom" */
|
|
1403
|
+
placement?: "bottom" | "top";
|
|
1404
|
+
/** Render the dropdown in a portal (position:fixed on document.body) so it is never clipped by a
|
|
1405
|
+
* scrolling/overflow-hidden ancestor; auto-flips up near the viewport bottom. Set false to render
|
|
1406
|
+
* inline. @default true */
|
|
1407
|
+
portal?: boolean;
|
|
1408
|
+
/** Minimum popover width in px when portaled (useful when the trigger is narrow). @default 0 */
|
|
1409
|
+
minWidth?: number;
|
|
1410
|
+
}
|
|
1411
|
+
|
|
1412
|
+
interface SelectOption {
|
|
1413
|
+
value: string;
|
|
1414
|
+
label: string;
|
|
1415
|
+
/** Optional second line shown under the label. */
|
|
1416
|
+
description?: string;
|
|
1417
|
+
}
|
|
1418
|
+
|
|
1419
|
+
/** A group heading with its own options. */
|
|
1420
|
+
interface SelectGroup {
|
|
1421
|
+
group: string;
|
|
1422
|
+
options: Array<string | SelectOption>;
|
|
1423
|
+
}
|
|
1424
|
+
|
|
1144
1425
|
declare function Select(props: SelectProps): React.JSX.Element;
|
|
1145
1426
|
|
|
1146
|
-
interface SidebarItem {
|
|
1147
|
-
/** Item label. */
|
|
1148
|
-
label?: React.ReactNode;
|
|
1149
|
-
/** Leading icon (shown in collapsed mode too). */
|
|
1150
|
-
icon?: React.ReactNode;
|
|
1151
|
-
href?: string;
|
|
1152
|
-
active?: boolean;
|
|
1153
|
-
onClick?: (e: React.MouseEvent) => void;
|
|
1154
|
-
/** Trailing count badge. */
|
|
1155
|
-
badge?: React.ReactNode;
|
|
1156
|
-
/** Render as an uppercase section heading instead of a link. */
|
|
1157
|
-
section?: React.ReactNode;
|
|
1158
|
-
}
|
|
1159
|
-
|
|
1160
|
-
/**
|
|
1161
|
-
* Collapsible side navigation — brand header, grouped nav items with icons and
|
|
1162
|
-
* badges, an optional footer, and a collapse toggle (icon-only when collapsed).
|
|
1163
|
-
*
|
|
1164
|
-
* @startingPoint section="Layout" subtitle="Collapsible side navigation" viewport="280x520"
|
|
1165
|
-
*/
|
|
1166
|
-
interface SidebarProps extends React.HTMLAttributes<HTMLElement> {
|
|
1167
|
-
brand?: React.ReactNode;
|
|
1168
|
-
items: SidebarItem[];
|
|
1169
|
-
/** Content pinned above the collapse toggle (e.g. a user row). */
|
|
1170
|
-
footer?: React.ReactNode;
|
|
1171
|
-
/** Controlled collapsed state. */
|
|
1172
|
-
collapsed?: boolean;
|
|
1173
|
-
/** Uncontrolled initial collapsed state. @default false */
|
|
1174
|
-
defaultCollapsed?: boolean;
|
|
1175
|
-
/** Show the collapse toggle. @default true */
|
|
1176
|
-
collapsible?: boolean;
|
|
1177
|
-
onCollapsedChange?: (collapsed: boolean) => void;
|
|
1178
|
-
}
|
|
1179
|
-
|
|
1427
|
+
interface SidebarItem {
|
|
1428
|
+
/** Item label. */
|
|
1429
|
+
label?: React.ReactNode;
|
|
1430
|
+
/** Leading icon (shown in collapsed mode too). */
|
|
1431
|
+
icon?: React.ReactNode;
|
|
1432
|
+
href?: string;
|
|
1433
|
+
active?: boolean;
|
|
1434
|
+
onClick?: (e: React.MouseEvent) => void;
|
|
1435
|
+
/** Trailing count badge. */
|
|
1436
|
+
badge?: React.ReactNode;
|
|
1437
|
+
/** Render as an uppercase section heading instead of a link. */
|
|
1438
|
+
section?: React.ReactNode;
|
|
1439
|
+
}
|
|
1440
|
+
|
|
1441
|
+
/**
|
|
1442
|
+
* Collapsible side navigation — brand header, grouped nav items with icons and
|
|
1443
|
+
* badges, an optional footer, and a collapse toggle (icon-only when collapsed).
|
|
1444
|
+
*
|
|
1445
|
+
* @startingPoint section="Layout" subtitle="Collapsible side navigation" viewport="280x520"
|
|
1446
|
+
*/
|
|
1447
|
+
interface SidebarProps extends React.HTMLAttributes<HTMLElement> {
|
|
1448
|
+
brand?: React.ReactNode;
|
|
1449
|
+
items: SidebarItem[];
|
|
1450
|
+
/** Content pinned above the collapse toggle (e.g. a user row). */
|
|
1451
|
+
footer?: React.ReactNode;
|
|
1452
|
+
/** Controlled collapsed state. */
|
|
1453
|
+
collapsed?: boolean;
|
|
1454
|
+
/** Uncontrolled initial collapsed state. @default false */
|
|
1455
|
+
defaultCollapsed?: boolean;
|
|
1456
|
+
/** Show the collapse toggle. @default true */
|
|
1457
|
+
collapsible?: boolean;
|
|
1458
|
+
onCollapsedChange?: (collapsed: boolean) => void;
|
|
1459
|
+
}
|
|
1460
|
+
|
|
1180
1461
|
declare function Sidebar(props: SidebarProps): React.JSX.Element;
|
|
1181
1462
|
|
|
1182
|
-
/**
|
|
1183
|
-
* Shimmering placeholder shown while content loads.
|
|
1184
|
-
*/
|
|
1185
|
-
interface SkeletonProps extends React.HTMLAttributes<HTMLSpanElement> {
|
|
1186
|
-
/** Shape. @default "text" */
|
|
1187
|
-
variant?: "text" | "circle" | "rect";
|
|
1188
|
-
/** CSS width (e.g. "120px", "60%"). */
|
|
1189
|
-
width?: string | number;
|
|
1190
|
-
/** CSS height. */
|
|
1191
|
-
height?: string | number;
|
|
1192
|
-
/** For text variant: number of lines (last is shortened). @default 1 */
|
|
1193
|
-
lines?: number;
|
|
1194
|
-
}
|
|
1195
|
-
|
|
1463
|
+
/**
|
|
1464
|
+
* Shimmering placeholder shown while content loads.
|
|
1465
|
+
*/
|
|
1466
|
+
interface SkeletonProps extends React.HTMLAttributes<HTMLSpanElement> {
|
|
1467
|
+
/** Shape preset: "text" line(s), "circle" (1:1 aspect, full radius), or "rect" block (--radius-md). @default "text" */
|
|
1468
|
+
variant?: "text" | "circle" | "rect";
|
|
1469
|
+
/** CSS width (e.g. "120px", "60%"). */
|
|
1470
|
+
width?: string | number;
|
|
1471
|
+
/** CSS height. */
|
|
1472
|
+
height?: string | number;
|
|
1473
|
+
/** For text variant: number of lines (last is shortened). @default 1 */
|
|
1474
|
+
lines?: number;
|
|
1475
|
+
}
|
|
1476
|
+
|
|
1196
1477
|
declare function Skeleton(props: SkeletonProps): React.JSX.Element;
|
|
1197
1478
|
|
|
1198
|
-
/**
|
|
1199
|
-
* Range slider with a filled track, draggable thumb, value bubble, optional
|
|
1200
|
-
* ticks, and full keyboard support (arrows / Home / End).
|
|
1201
|
-
*
|
|
1202
|
-
* @startingPoint section="Inputs" subtitle="Range slider with value bubble" viewport="700x110"
|
|
1203
|
-
*/
|
|
1204
|
-
interface SliderProps extends Omit<React.HTMLAttributes<HTMLDivElement>, "onChange" | "defaultValue"> {
|
|
1205
|
-
/** Label shown above the track. */
|
|
1206
|
-
label?: React.ReactNode;
|
|
1207
|
-
/**
|
|
1208
|
-
|
|
1209
|
-
/**
|
|
1210
|
-
|
|
1211
|
-
/**
|
|
1212
|
-
|
|
1213
|
-
/** @default
|
|
1214
|
-
|
|
1215
|
-
/** @default
|
|
1216
|
-
|
|
1217
|
-
|
|
1218
|
-
|
|
1219
|
-
|
|
1220
|
-
|
|
1221
|
-
|
|
1222
|
-
/**
|
|
1223
|
-
|
|
1224
|
-
|
|
1225
|
-
|
|
1226
|
-
|
|
1479
|
+
/**
|
|
1480
|
+
* Range slider with a filled track, draggable thumb, value bubble, optional
|
|
1481
|
+
* ticks, and full keyboard support (arrows / Home / End).
|
|
1482
|
+
*
|
|
1483
|
+
* @startingPoint section="Inputs" subtitle="Range slider with value bubble" viewport="700x110"
|
|
1484
|
+
*/
|
|
1485
|
+
interface SliderProps extends Omit<React.HTMLAttributes<HTMLDivElement>, "onChange" | "defaultValue"> {
|
|
1486
|
+
/** Label shown above the track. */
|
|
1487
|
+
label?: React.ReactNode;
|
|
1488
|
+
/** Helper text shown below the track when there is no error. */
|
|
1489
|
+
hint?: React.ReactNode;
|
|
1490
|
+
/** Error message shown below the track — turns it red (sets `aria-invalid`) and replaces the hint. */
|
|
1491
|
+
error?: React.ReactNode;
|
|
1492
|
+
/** Controlled value. */
|
|
1493
|
+
value?: number;
|
|
1494
|
+
/** Uncontrolled initial value. @default 0 */
|
|
1495
|
+
defaultValue?: number;
|
|
1496
|
+
/** @default 0 */
|
|
1497
|
+
min?: number;
|
|
1498
|
+
/** @default 100 */
|
|
1499
|
+
max?: number;
|
|
1500
|
+
/** @default 1 */
|
|
1501
|
+
step?: number;
|
|
1502
|
+
disabled?: boolean;
|
|
1503
|
+
/** Show the current value at the top-right. @default true */
|
|
1504
|
+
showValue?: boolean;
|
|
1505
|
+
/** Render step ticks along the rail. @default false */
|
|
1506
|
+
showTicks?: boolean;
|
|
1507
|
+
/** Color intent. @default "primary" */
|
|
1508
|
+
tone?: "primary" | "success" | "warning" | "danger" | "info" | "neutral";
|
|
1509
|
+
/** Format the displayed value (label + bubble). */
|
|
1510
|
+
formatValue?: (value: number) => React.ReactNode;
|
|
1511
|
+
onChange?: (value: number) => void;
|
|
1512
|
+
}
|
|
1513
|
+
|
|
1227
1514
|
declare function Slider(props: SliderProps): React.JSX.Element;
|
|
1228
1515
|
|
|
1229
|
-
/**
|
|
1230
|
-
* Indeterminate loading spinner.
|
|
1231
|
-
*/
|
|
1232
|
-
interface SpinnerProps extends React.HTMLAttributes<HTMLSpanElement> {
|
|
1233
|
-
/** @default "md" */
|
|
1234
|
-
size?: "sm" | "md" | "lg" | "xl";
|
|
1235
|
-
/** @default "
|
|
1236
|
-
|
|
1237
|
-
/**
|
|
1238
|
-
|
|
1239
|
-
|
|
1240
|
-
|
|
1516
|
+
/**
|
|
1517
|
+
* Indeterminate loading spinner.
|
|
1518
|
+
*/
|
|
1519
|
+
interface SpinnerProps extends React.HTMLAttributes<HTMLSpanElement> {
|
|
1520
|
+
/** @default "md" */
|
|
1521
|
+
size?: "sm" | "md" | "lg" | "xl";
|
|
1522
|
+
/** Color. Wins over `tone` when both are set. @default "current" — inherits currentColor (visible inside buttons, themed). */
|
|
1523
|
+
color?: "current" | "primary" | "success" | "warning" | "danger" | "info" | "neutral" | "white";
|
|
1524
|
+
/** Color. @deprecated Use `color` instead. @default "current" — inherits currentColor (visible inside buttons, themed). */
|
|
1525
|
+
tone?: "current" | "primary" | "success" | "warning" | "danger" | "info" | "neutral" | "white";
|
|
1526
|
+
/** Accessible label. @default "Loading" */
|
|
1527
|
+
label?: string;
|
|
1528
|
+
}
|
|
1529
|
+
|
|
1241
1530
|
declare function Spinner(props: SpinnerProps): React.JSX.Element;
|
|
1242
1531
|
|
|
1243
|
-
/**
|
|
1244
|
-
* KPI / metric card — label, big value, optional icon, trend delta, and help text.
|
|
1245
|
-
*
|
|
1246
|
-
* @startingPoint section="Data display" subtitle="KPI / metric card" viewport="700x160"
|
|
1247
|
-
*/
|
|
1248
|
-
interface StatProps extends React.HTMLAttributes<HTMLDivElement> {
|
|
1249
|
-
label: React.ReactNode;
|
|
1250
|
-
value: React.ReactNode;
|
|
1251
|
-
/** Icon shown top-right in a tinted tile. */
|
|
1252
|
-
icon?: React.ReactNode;
|
|
1253
|
-
/** Trend value, e.g. "+12.5%" or "-3%". */
|
|
1254
|
-
delta?: React.ReactNode;
|
|
1255
|
-
/** Force the trend direction/color; otherwise inferred from a leading "-". */
|
|
1256
|
-
deltaDirection?: "up" | "down" | "flat";
|
|
1257
|
-
/** Muted text after the delta, e.g. "vs last month". */
|
|
1258
|
-
helpText?: React.ReactNode;
|
|
1259
|
-
/** Drop the card chrome (no border/background/padding). @default false */
|
|
1260
|
-
plain?: boolean;
|
|
1261
|
-
}
|
|
1262
|
-
|
|
1532
|
+
/**
|
|
1533
|
+
* KPI / metric card — label, big value, optional icon, trend delta, and help text.
|
|
1534
|
+
*
|
|
1535
|
+
* @startingPoint section="Data display" subtitle="KPI / metric card" viewport="700x160"
|
|
1536
|
+
*/
|
|
1537
|
+
interface StatProps extends React.HTMLAttributes<HTMLDivElement> {
|
|
1538
|
+
label: React.ReactNode;
|
|
1539
|
+
value: React.ReactNode;
|
|
1540
|
+
/** Icon shown top-right in a tinted tile. */
|
|
1541
|
+
icon?: React.ReactNode;
|
|
1542
|
+
/** Trend value, e.g. "+12.5%" or "-3%". */
|
|
1543
|
+
delta?: React.ReactNode;
|
|
1544
|
+
/** Force the trend direction/color; otherwise inferred from a leading "-". */
|
|
1545
|
+
deltaDirection?: "up" | "down" | "flat";
|
|
1546
|
+
/** Muted text after the delta, e.g. "vs last month". */
|
|
1547
|
+
helpText?: React.ReactNode;
|
|
1548
|
+
/** Drop the card chrome (no border/background/padding). @default false */
|
|
1549
|
+
plain?: boolean;
|
|
1550
|
+
}
|
|
1551
|
+
|
|
1263
1552
|
declare function Stat(props: StatProps): React.JSX.Element;
|
|
1264
1553
|
|
|
1265
|
-
interface Step {
|
|
1266
|
-
/** Step title. */
|
|
1267
|
-
title: React.ReactNode;
|
|
1268
|
-
/** Optional sub-label under the title. */
|
|
1269
|
-
description?: React.ReactNode;
|
|
1270
|
-
/** Custom indicator content (defaults to the step number). */
|
|
1271
|
-
icon?: React.ReactNode;
|
|
1272
|
-
/** Mark this step as errored (red indicator). */
|
|
1273
|
-
error?: boolean;
|
|
1274
|
-
}
|
|
1275
|
-
|
|
1276
|
-
/**
|
|
1277
|
-
* Multi-step progress indicator. Steps before `active` show a check, the active
|
|
1278
|
-
* step is ringed, later steps are muted; horizontal or vertical.
|
|
1279
|
-
*
|
|
1280
|
-
* @startingPoint section="Navigation" subtitle="Multi-step progress" viewport="700x140"
|
|
1281
|
-
*/
|
|
1282
|
-
interface StepperProps extends React.HTMLAttributes<HTMLDivElement> {
|
|
1283
|
-
steps: Step[];
|
|
1284
|
-
/**
|
|
1285
|
-
active?: number;
|
|
1286
|
-
/** @default
|
|
1287
|
-
|
|
1288
|
-
/**
|
|
1289
|
-
|
|
1290
|
-
/**
|
|
1291
|
-
|
|
1292
|
-
|
|
1293
|
-
|
|
1554
|
+
interface Step {
|
|
1555
|
+
/** Step title. */
|
|
1556
|
+
title: React.ReactNode;
|
|
1557
|
+
/** Optional sub-label under the title. */
|
|
1558
|
+
description?: React.ReactNode;
|
|
1559
|
+
/** Custom indicator content (defaults to the step number). */
|
|
1560
|
+
icon?: React.ReactNode;
|
|
1561
|
+
/** Mark this step as errored (red indicator). */
|
|
1562
|
+
error?: boolean;
|
|
1563
|
+
}
|
|
1564
|
+
|
|
1565
|
+
/**
|
|
1566
|
+
* Multi-step progress indicator. Steps before `active` show a check, the active
|
|
1567
|
+
* step is ringed, later steps are muted; horizontal or vertical.
|
|
1568
|
+
*
|
|
1569
|
+
* @startingPoint section="Navigation" subtitle="Multi-step progress" viewport="700x140"
|
|
1570
|
+
*/
|
|
1571
|
+
interface StepperProps extends React.HTMLAttributes<HTMLDivElement> {
|
|
1572
|
+
steps: Step[];
|
|
1573
|
+
/** Controlled index of the current step (pair with `onStepClick`). */
|
|
1574
|
+
active?: number;
|
|
1575
|
+
/** Uncontrolled initial step index; the Stepper then tracks clicks itself. @default 0 */
|
|
1576
|
+
defaultActive?: number;
|
|
1577
|
+
/** @default "horizontal" */
|
|
1578
|
+
orientation?: "horizontal" | "vertical";
|
|
1579
|
+
/** Color intent. @default "primary" */
|
|
1580
|
+
tone?: "primary" | "success" | "warning" | "danger" | "info" | "neutral";
|
|
1581
|
+
/** Allow clicking completed/active steps. @default false */
|
|
1582
|
+
clickable?: boolean;
|
|
1583
|
+
/** Fired when a clickable step is clicked. */
|
|
1584
|
+
onStepClick?: (index: number) => void;
|
|
1585
|
+
}
|
|
1586
|
+
|
|
1294
1587
|
declare function Stepper(props: StepperProps): React.JSX.Element;
|
|
1295
1588
|
|
|
1296
|
-
/**
|
|
1297
|
-
* Toggle switch with a springy thumb. Use for instant on/off settings.
|
|
1298
|
-
*
|
|
1299
|
-
* @startingPoint section="Toggles" subtitle="On/off toggle switch" viewport="700x120"
|
|
1300
|
-
*/
|
|
1301
|
-
interface SwitchProps extends Omit<React.InputHTMLAttributes<HTMLInputElement>, "size" | "type"> {
|
|
1302
|
-
label?: React.ReactNode;
|
|
1303
|
-
description?: React.ReactNode;
|
|
1304
|
-
|
|
1305
|
-
|
|
1306
|
-
|
|
1589
|
+
/**
|
|
1590
|
+
* Toggle switch with a springy thumb. Use for instant on/off settings.
|
|
1591
|
+
*
|
|
1592
|
+
* @startingPoint section="Toggles" subtitle="On/off toggle switch" viewport="700x120"
|
|
1593
|
+
*/
|
|
1594
|
+
interface SwitchProps extends Omit<React.InputHTMLAttributes<HTMLInputElement>, "size" | "type"> {
|
|
1595
|
+
label?: React.ReactNode;
|
|
1596
|
+
description?: React.ReactNode;
|
|
1597
|
+
/** Error message shown below the control; tints the track red and wires `aria-invalid`/`aria-describedby`. @default undefined */
|
|
1598
|
+
error?: React.ReactNode;
|
|
1599
|
+
size?: "sm" | "md" | "lg";
|
|
1600
|
+
/** Color intent. @default "primary" */
|
|
1601
|
+
tone?: "primary" | "success" | "warning" | "danger" | "info" | "neutral";
|
|
1602
|
+
}
|
|
1603
|
+
|
|
1307
1604
|
declare function Switch(props: SwitchProps): React.JSX.Element;
|
|
1308
1605
|
|
|
1309
|
-
/**
|
|
1310
|
-
|
|
1311
|
-
|
|
1312
|
-
|
|
1313
|
-
|
|
1314
|
-
|
|
1315
|
-
|
|
1316
|
-
|
|
1317
|
-
|
|
1318
|
-
|
|
1319
|
-
|
|
1320
|
-
|
|
1321
|
-
|
|
1322
|
-
|
|
1323
|
-
|
|
1324
|
-
|
|
1325
|
-
|
|
1326
|
-
|
|
1327
|
-
|
|
1328
|
-
|
|
1329
|
-
|
|
1330
|
-
|
|
1331
|
-
|
|
1332
|
-
|
|
1333
|
-
|
|
1334
|
-
|
|
1335
|
-
|
|
1336
|
-
|
|
1337
|
-
|
|
1338
|
-
|
|
1339
|
-
|
|
1340
|
-
|
|
1341
|
-
|
|
1342
|
-
|
|
1343
|
-
|
|
1344
|
-
|
|
1345
|
-
|
|
1346
|
-
|
|
1606
|
+
/** Sort state: the sorted column field (null = unsorted) and direction. */
|
|
1607
|
+
interface TableSort {
|
|
1608
|
+
/** Column field being sorted, or null for no sort. */
|
|
1609
|
+
field: string | null;
|
|
1610
|
+
/** Sort direction. */
|
|
1611
|
+
dir: "asc" | "desc";
|
|
1612
|
+
}
|
|
1613
|
+
|
|
1614
|
+
/**
|
|
1615
|
+
* Data table with sticky-styled header, hover/striped rows, client-side
|
|
1616
|
+
* sorting, custom cell renderers, and row selection highlight. Sorting is
|
|
1617
|
+
* controlled via `sort` + `onSortChange`, or uncontrolled via `defaultSort`.
|
|
1618
|
+
* A truly pinned header (`stickyHeader`) keeps thead visible while the body
|
|
1619
|
+
* scrolls — pair it with `maxHeight` to give the table its own scroll area.
|
|
1620
|
+
* Uses the same vocabulary as `Datatable` (`rows`, `field`, `headerName`,
|
|
1621
|
+
* `renderCell`) so columns/data move between the two without renaming.
|
|
1622
|
+
*
|
|
1623
|
+
* @startingPoint section="Data display" subtitle="Sortable data table" viewport="700x320"
|
|
1624
|
+
*/
|
|
1625
|
+
interface TableProps<T = any> extends React.HTMLAttributes<HTMLDivElement> {
|
|
1626
|
+
columns: TableColumn<T>[];
|
|
1627
|
+
/** Row objects. */
|
|
1628
|
+
rows?: T[];
|
|
1629
|
+
/** Row hover highlight. @default true */
|
|
1630
|
+
hover?: boolean;
|
|
1631
|
+
/** Zebra striping. @default false */
|
|
1632
|
+
striped?: boolean;
|
|
1633
|
+
/** @default "md" */
|
|
1634
|
+
size?: "sm" | "md" | "lg";
|
|
1635
|
+
/** Enable click-to-sort headers. @default false */
|
|
1636
|
+
sortable?: boolean;
|
|
1637
|
+
/** Controlled sort state — pair with `onSortChange` (null = unsorted). */
|
|
1638
|
+
sort?: TableSort | null;
|
|
1639
|
+
/** Initial sort when uncontrolled. @default { field: null, dir: "asc" } */
|
|
1640
|
+
defaultSort?: TableSort;
|
|
1641
|
+
/** Fired when a sortable header is clicked with the next sort state: (sort). */
|
|
1642
|
+
onSortChange?: (sort: TableSort) => void;
|
|
1643
|
+
/** Returns a stable key per row. */
|
|
1644
|
+
rowKey?: (row: T, index: number) => string | number;
|
|
1645
|
+
/** Keys of rows to highlight as selected. */
|
|
1646
|
+
selectedKeys?: Array<string | number>;
|
|
1647
|
+
/** Pin the header to the top while the body scrolls (use with `maxHeight` or a scroll container). @default false */
|
|
1648
|
+
stickyHeader?: boolean;
|
|
1649
|
+
/** Cap the table height and give it its own vertical scroll area (CSS length or number of px). */
|
|
1650
|
+
maxHeight?: number | string;
|
|
1651
|
+
}
|
|
1652
|
+
|
|
1653
|
+
interface TableColumn<T = any> {
|
|
1654
|
+
/** Object key in each row + sort key. */
|
|
1655
|
+
field: string;
|
|
1656
|
+
/** Header label. */
|
|
1657
|
+
headerName?: React.ReactNode;
|
|
1658
|
+
/** Cell alignment. @default "left" */
|
|
1659
|
+
align?: "left" | "center" | "right";
|
|
1660
|
+
/** Fixed column width (CSS value). */
|
|
1661
|
+
width?: string;
|
|
1662
|
+
/** Disable sorting for this column when the table is sortable. */
|
|
1663
|
+
sortable?: boolean;
|
|
1664
|
+
/** Custom cell renderer: (value, row, index). */
|
|
1665
|
+
renderCell?: (value: any, row: T, index: number) => React.ReactNode;
|
|
1666
|
+
}
|
|
1667
|
+
|
|
1347
1668
|
declare function Table<T = any>(props: TableProps<T>): React.JSX.Element;
|
|
1348
1669
|
|
|
1349
|
-
/**
|
|
1350
|
-
* Tabbed navigation with a sliding active indicator. Line or pill variant.
|
|
1351
|
-
* Controlled (`value` + `onChange`) or uncontrolled (`defaultValue`).
|
|
1352
|
-
*
|
|
1353
|
-
* @startingPoint section="Navigation" subtitle="Tabs with sliding indicator" viewport="700x220"
|
|
1354
|
-
*/
|
|
1355
|
-
interface TabsProps extends Omit<React.HTMLAttributes<HTMLDivElement>, "onChange"> {
|
|
1356
|
-
items: TabItem[];
|
|
1357
|
-
value?: string;
|
|
1358
|
-
defaultValue?: string;
|
|
1359
|
-
onChange?: (value: string) => void;
|
|
1360
|
-
/** @default "line" */
|
|
1361
|
-
variant?: "line" | "pill";
|
|
1362
|
-
|
|
1363
|
-
|
|
1364
|
-
|
|
1365
|
-
|
|
1366
|
-
|
|
1367
|
-
|
|
1368
|
-
|
|
1369
|
-
/**
|
|
1370
|
-
|
|
1371
|
-
/**
|
|
1372
|
-
|
|
1373
|
-
/**
|
|
1374
|
-
|
|
1375
|
-
|
|
1376
|
-
|
|
1670
|
+
/**
|
|
1671
|
+
* Tabbed navigation with a sliding active indicator. Line or pill variant.
|
|
1672
|
+
* Controlled (`value` + `onChange`) or uncontrolled (`defaultValue`).
|
|
1673
|
+
*
|
|
1674
|
+
* @startingPoint section="Navigation" subtitle="Tabs with sliding indicator" viewport="700x220"
|
|
1675
|
+
*/
|
|
1676
|
+
interface TabsProps extends Omit<React.HTMLAttributes<HTMLDivElement>, "onChange"> {
|
|
1677
|
+
items: TabItem[];
|
|
1678
|
+
value?: string;
|
|
1679
|
+
defaultValue?: string;
|
|
1680
|
+
onChange?: (value: string) => void;
|
|
1681
|
+
/** @default "line" */
|
|
1682
|
+
variant?: "line" | "pill";
|
|
1683
|
+
/** Color intent. @default "primary" */
|
|
1684
|
+
tone?: "primary" | "success" | "warning" | "danger" | "info" | "neutral";
|
|
1685
|
+
/** Layout axis. Vertical stacks the tablist with the indicator on its trailing edge and the panel beside it; ArrowUp/ArrowDown navigate. @default "horizontal" */
|
|
1686
|
+
orientation?: "horizontal" | "vertical";
|
|
1687
|
+
}
|
|
1688
|
+
|
|
1689
|
+
interface TabItem {
|
|
1690
|
+
/** Unique value / id. */
|
|
1691
|
+
value: string;
|
|
1692
|
+
/** Tab label. */
|
|
1693
|
+
label: React.ReactNode;
|
|
1694
|
+
/** Optional leading icon. */
|
|
1695
|
+
icon?: React.ReactNode;
|
|
1696
|
+
/** Optional count pill. */
|
|
1697
|
+
count?: number;
|
|
1698
|
+
/** Panel content rendered when active (omit for nav-only tabs). */
|
|
1699
|
+
content?: React.ReactNode;
|
|
1700
|
+
}
|
|
1701
|
+
|
|
1377
1702
|
declare function Tabs(props: TabsProps): React.JSX.Element;
|
|
1378
1703
|
|
|
1379
|
-
/**
|
|
1380
|
-
* Removable chip for filters, selected items, and keywords.
|
|
1381
|
-
*/
|
|
1382
|
-
interface TagProps extends React.HTMLAttributes<HTMLSpanElement> {
|
|
1383
|
-
/** Show a remove (×) button and handle its click. */
|
|
1384
|
-
onRemove?: (e: React.MouseEvent<HTMLButtonElement>) => void;
|
|
1385
|
-
/** Optional leading icon. */
|
|
1386
|
-
leftIcon?: React.ReactNode;
|
|
1387
|
-
|
|
1388
|
-
|
|
1389
|
-
|
|
1704
|
+
/**
|
|
1705
|
+
* Removable chip for filters, selected items, and keywords.
|
|
1706
|
+
*/
|
|
1707
|
+
interface TagProps extends React.HTMLAttributes<HTMLSpanElement> {
|
|
1708
|
+
/** Show a remove (×) button and handle its click. */
|
|
1709
|
+
onRemove?: (e: React.MouseEvent<HTMLButtonElement>) => void;
|
|
1710
|
+
/** Optional leading icon. */
|
|
1711
|
+
leftIcon?: React.ReactNode;
|
|
1712
|
+
/** Fill style. @default "soft" */
|
|
1713
|
+
variant?: "soft" | "solid" | "outline";
|
|
1714
|
+
/** Color intent. @default "neutral" */
|
|
1715
|
+
tone?: "neutral" | "primary" | "success" | "warning" | "danger" | "info";
|
|
1716
|
+
children?: React.ReactNode;
|
|
1717
|
+
}
|
|
1718
|
+
|
|
1390
1719
|
declare function Tag(props: TagProps): React.JSX.Element;
|
|
1391
1720
|
|
|
1392
|
-
/**
|
|
1393
|
-
* Multi-line text input with label, hint, and error state.
|
|
1394
|
-
*/
|
|
1395
|
-
interface TextareaProps extends React.TextareaHTMLAttributes<HTMLTextAreaElement> {
|
|
1396
|
-
label
|
|
1397
|
-
|
|
1398
|
-
error
|
|
1399
|
-
|
|
1400
|
-
|
|
1401
|
-
|
|
1721
|
+
/**
|
|
1722
|
+
* Multi-line text input with label, hint, and error state.
|
|
1723
|
+
*/
|
|
1724
|
+
interface TextareaProps extends React.TextareaHTMLAttributes<HTMLTextAreaElement> {
|
|
1725
|
+
/** Field label rendered above the control. */
|
|
1726
|
+
label?: React.ReactNode;
|
|
1727
|
+
/** Helper text shown below when there is no error. */
|
|
1728
|
+
hint?: React.ReactNode;
|
|
1729
|
+
/** Error message — turns the field red and replaces the hint. */
|
|
1730
|
+
error?: React.ReactNode;
|
|
1731
|
+
/** Marks the field required (adds an asterisk and forwards to the native textarea). */
|
|
1732
|
+
required?: boolean;
|
|
1733
|
+
/** Control size — same padding steps as Input. @default "md" */
|
|
1734
|
+
size?: "sm" | "md" | "lg";
|
|
1735
|
+
/** Color intent for the focus/open accent. @default "primary" */
|
|
1736
|
+
tone?: "primary" | "success" | "warning" | "danger" | "info" | "neutral";
|
|
1737
|
+
}
|
|
1738
|
+
|
|
1402
1739
|
declare function Textarea(props: TextareaProps): React.JSX.Element;
|
|
1403
1740
|
|
|
1404
|
-
interface TimelineItem {
|
|
1405
|
-
/** Event title. */
|
|
1406
|
-
title: React.ReactNode;
|
|
1407
|
-
/** Muted timestamp shown to the right of the title. */
|
|
1408
|
-
time?: React.ReactNode;
|
|
1409
|
-
/** Supporting description. */
|
|
1410
|
-
description?: React.ReactNode;
|
|
1411
|
-
/** Icon inside the node dot. */
|
|
1412
|
-
icon?: React.ReactNode;
|
|
1413
|
-
/** Node color. */
|
|
1414
|
-
tone?: "primary" | "success" | "warning" | "danger";
|
|
1415
|
-
}
|
|
1416
|
-
|
|
1417
|
-
/**
|
|
1418
|
-
* Vertical timeline of events — node dots connected by a rail, each with title,
|
|
1419
|
-
* time, and description.
|
|
1420
|
-
*
|
|
1421
|
-
* @startingPoint section="Data display" subtitle="Vertical event timeline" viewport="700x340"
|
|
1422
|
-
*/
|
|
1423
|
-
interface TimelineProps extends React.HTMLAttributes<HTMLUListElement> {
|
|
1424
|
-
items: TimelineItem[];
|
|
1425
|
-
}
|
|
1426
|
-
|
|
1741
|
+
interface TimelineItem {
|
|
1742
|
+
/** Event title. */
|
|
1743
|
+
title: React.ReactNode;
|
|
1744
|
+
/** Muted timestamp shown to the right of the title. */
|
|
1745
|
+
time?: React.ReactNode;
|
|
1746
|
+
/** Supporting description. */
|
|
1747
|
+
description?: React.ReactNode;
|
|
1748
|
+
/** Icon inside the node dot. */
|
|
1749
|
+
icon?: React.ReactNode;
|
|
1750
|
+
/** Node color. */
|
|
1751
|
+
tone?: "primary" | "info" | "success" | "warning" | "danger";
|
|
1752
|
+
}
|
|
1753
|
+
|
|
1754
|
+
/**
|
|
1755
|
+
* Vertical timeline of events — node dots connected by a rail, each with title,
|
|
1756
|
+
* time, and description.
|
|
1757
|
+
*
|
|
1758
|
+
* @startingPoint section="Data display" subtitle="Vertical event timeline" viewport="700x340"
|
|
1759
|
+
*/
|
|
1760
|
+
interface TimelineProps extends React.HTMLAttributes<HTMLUListElement> {
|
|
1761
|
+
items: TimelineItem[];
|
|
1762
|
+
}
|
|
1763
|
+
|
|
1427
1764
|
declare function Timeline(props: TimelineProps): React.JSX.Element;
|
|
1428
1765
|
|
|
1429
|
-
/**
|
|
1430
|
-
* Transient notification card. Render inside a <ToastViewport> and manage a
|
|
1431
|
-
* list in state (push on action, remove on close / timeout).
|
|
1432
|
-
*/
|
|
1433
|
-
interface ToastProps extends React.HTMLAttributes<HTMLDivElement> {
|
|
1434
|
-
/** @default "default" */
|
|
1435
|
-
tone?: "default" | "success" | "warning" | "danger" | "info";
|
|
1436
|
-
/** Bold heading. */
|
|
1437
|
-
title?: React.ReactNode;
|
|
1438
|
-
/** Override the tone icon. */
|
|
1439
|
-
icon?: React.ReactNode;
|
|
1440
|
-
/** Show close button + handle dismissal. */
|
|
1441
|
-
onClose?: () => void;
|
|
1442
|
-
|
|
1443
|
-
|
|
1444
|
-
|
|
1445
|
-
|
|
1446
|
-
|
|
1447
|
-
|
|
1448
|
-
|
|
1449
|
-
|
|
1450
|
-
|
|
1451
|
-
|
|
1766
|
+
/**
|
|
1767
|
+
* Transient notification card. Render inside a <ToastViewport> and manage a
|
|
1768
|
+
* list in state (push on action, remove on close / timeout).
|
|
1769
|
+
*/
|
|
1770
|
+
interface ToastProps extends Omit<React.HTMLAttributes<HTMLDivElement>, "title"> {
|
|
1771
|
+
/** Semantic tone. `"neutral"` is an alias for `"default"` (matches Badge's vocabulary). @default "default" */
|
|
1772
|
+
tone?: "default" | "neutral" | "success" | "warning" | "danger" | "info";
|
|
1773
|
+
/** Bold heading. */
|
|
1774
|
+
title?: React.ReactNode;
|
|
1775
|
+
/** Override the tone icon. */
|
|
1776
|
+
icon?: React.ReactNode;
|
|
1777
|
+
/** Show close button + handle dismissal. */
|
|
1778
|
+
onClose?: () => void;
|
|
1779
|
+
/** Auto-dismiss after this many ms (paused on hover/focus). `0`/`Infinity` keeps it open. @default 4500 */
|
|
1780
|
+
duration?: number;
|
|
1781
|
+
children?: React.ReactNode;
|
|
1782
|
+
}
|
|
1783
|
+
|
|
1784
|
+
declare function Toast(props: ToastProps): React.JSX.Element;
|
|
1785
|
+
|
|
1786
|
+
interface ToastViewportProps extends React.HTMLAttributes<HTMLDivElement> {
|
|
1787
|
+
/** Cap how many toasts are shown at once (keeps the most recent). */
|
|
1788
|
+
limit?: number;
|
|
1789
|
+
children?: React.ReactNode;
|
|
1790
|
+
}
|
|
1791
|
+
|
|
1792
|
+
/** Fixed bottom-right stack container for toasts. */
|
|
1452
1793
|
declare function ToastViewport(props: ToastViewportProps): React.JSX.Element;
|
|
1453
1794
|
|
|
1454
|
-
/**
|
|
1455
|
-
|
|
1456
|
-
*/
|
|
1457
|
-
|
|
1458
|
-
/**
|
|
1459
|
-
|
|
1460
|
-
/**
|
|
1461
|
-
|
|
1462
|
-
/**
|
|
1463
|
-
|
|
1464
|
-
/**
|
|
1465
|
-
|
|
1466
|
-
}
|
|
1467
|
-
|
|
1795
|
+
/** A single toast's options when pushed imperatively. */
|
|
1796
|
+
interface ToastOptions {
|
|
1797
|
+
/** @default "default" */
|
|
1798
|
+
tone?: "default" | "neutral" | "success" | "warning" | "danger" | "info";
|
|
1799
|
+
/** Bold heading. */
|
|
1800
|
+
title?: React.ReactNode;
|
|
1801
|
+
/** Body/description content. */
|
|
1802
|
+
description?: React.ReactNode;
|
|
1803
|
+
/** Override the tone icon. */
|
|
1804
|
+
icon?: React.ReactNode;
|
|
1805
|
+
/** Auto-dismiss after this many ms (overrides the provider default); 0/Infinity keeps it open. */
|
|
1806
|
+
duration?: number;
|
|
1807
|
+
}
|
|
1808
|
+
|
|
1809
|
+
/** Tone helper signature: pass a title (or a full options object) + optional options. */
|
|
1810
|
+
type ToastFn = (titleOrOptions: React.ReactNode | ToastOptions, options?: ToastOptions) => number;
|
|
1811
|
+
|
|
1812
|
+
/** Imperative toast API returned by useToast(). */
|
|
1813
|
+
interface ToastApi {
|
|
1814
|
+
/** Push a toast; returns its id. */
|
|
1815
|
+
toast: ((options: ToastOptions) => number) & {
|
|
1816
|
+
success: ToastFn;
|
|
1817
|
+
warning: ToastFn;
|
|
1818
|
+
danger: ToastFn;
|
|
1819
|
+
/** Alias of `danger`. */
|
|
1820
|
+
error: ToastFn;
|
|
1821
|
+
info: ToastFn;
|
|
1822
|
+
/** Default (neutral) tone. */
|
|
1823
|
+
show: ToastFn;
|
|
1824
|
+
};
|
|
1825
|
+
/** Dismiss a toast by id. */
|
|
1826
|
+
dismiss: (id: number) => void;
|
|
1827
|
+
/** Remove every toast. */
|
|
1828
|
+
clear: () => void;
|
|
1829
|
+
/** The current toast list. */
|
|
1830
|
+
toasts: Array<{ id: number } & ToastOptions & { children?: React.ReactNode }>;
|
|
1831
|
+
}
|
|
1832
|
+
|
|
1833
|
+
/** Access the imperative toast API. Must be under a <ToastProvider>. */
|
|
1834
|
+
declare function useToast(): ToastApi;
|
|
1835
|
+
|
|
1836
|
+
interface ToastProviderProps {
|
|
1837
|
+
children?: React.ReactNode;
|
|
1838
|
+
/** Max toasts shown at once (most recent kept). @default 4 */
|
|
1839
|
+
limit?: number;
|
|
1840
|
+
/** Default auto-dismiss duration in ms for toasts that don't set their own. @default 4500 */
|
|
1841
|
+
duration?: number;
|
|
1842
|
+
}
|
|
1843
|
+
|
|
1844
|
+
/** Holds the toast list + renders a ToastViewport; exposes the API via useToast(). */
|
|
1845
|
+
declare function ToastProvider(props: ToastProviderProps): React.JSX.Element;
|
|
1846
|
+
|
|
1847
|
+
/**
|
|
1848
|
+
* Hover/focus tooltip. Wraps a single trigger element. The tooltip is linked to the
|
|
1849
|
+
* trigger via aria-describedby while shown, is aria-hidden when closed, and Escape
|
|
1850
|
+
* dismisses it (WCAG 1.4.13).
|
|
1851
|
+
*/
|
|
1852
|
+
interface TooltipProps extends React.HTMLAttributes<HTMLSpanElement> {
|
|
1853
|
+
/** Tooltip text/content. */
|
|
1854
|
+
label: React.ReactNode;
|
|
1855
|
+
/** @default "top" */
|
|
1856
|
+
placement?: "top" | "bottom" | "left" | "right";
|
|
1857
|
+
/** Open delay in ms. @default 120 */
|
|
1858
|
+
delay?: number;
|
|
1859
|
+
/** The trigger element; receives aria-describedby while shown (non-element children are wrapped in a span). */
|
|
1860
|
+
children: React.ReactNode;
|
|
1861
|
+
}
|
|
1862
|
+
|
|
1468
1863
|
declare function Tooltip(props: TooltipProps): React.JSX.Element;
|
|
1469
1864
|
|
|
1470
|
-
interface TreeNode {
|
|
1471
|
-
/** Unique id. */
|
|
1472
|
-
id: string;
|
|
1473
|
-
/** Row label. */
|
|
1474
|
-
label: React.ReactNode;
|
|
1475
|
-
/** Leading icon. */
|
|
1476
|
-
icon?: React.ReactNode;
|
|
1477
|
-
/** Trailing meta (count, etc.). */
|
|
1478
|
-
badge?: React.ReactNode;
|
|
1479
|
-
/** Child nodes (presence makes the row expandable). */
|
|
1480
|
-
children?: TreeNode[];
|
|
1481
|
-
}
|
|
1482
|
-
|
|
1483
|
-
/**
|
|
1484
|
-
* Hierarchical tree with expand/collapse carets, indentation, icons, and a
|
|
1485
|
-
* selected row. Good for file explorers and nested navigation.
|
|
1486
|
-
*
|
|
1487
|
-
* @startingPoint section="Navigation" subtitle="Hierarchical tree view" viewport="700x340"
|
|
1488
|
-
*/
|
|
1489
|
-
interface TreeViewProps extends React.HTMLAttributes<HTMLDivElement> {
|
|
1490
|
-
|
|
1491
|
-
|
|
1492
|
-
|
|
1493
|
-
|
|
1494
|
-
|
|
1495
|
-
|
|
1496
|
-
|
|
1497
|
-
|
|
1498
|
-
|
|
1865
|
+
interface TreeNode {
|
|
1866
|
+
/** Unique id. */
|
|
1867
|
+
id: string;
|
|
1868
|
+
/** Row label. */
|
|
1869
|
+
label: React.ReactNode;
|
|
1870
|
+
/** Leading icon. */
|
|
1871
|
+
icon?: React.ReactNode;
|
|
1872
|
+
/** Trailing meta (count, etc.). */
|
|
1873
|
+
badge?: React.ReactNode;
|
|
1874
|
+
/** Child nodes (presence makes the row expandable). */
|
|
1875
|
+
children?: TreeNode[];
|
|
1876
|
+
}
|
|
1877
|
+
|
|
1878
|
+
/**
|
|
1879
|
+
* Hierarchical tree with expand/collapse carets, indentation, icons, and a
|
|
1880
|
+
* selected row. Good for file explorers and nested navigation.
|
|
1881
|
+
*
|
|
1882
|
+
* @startingPoint section="Navigation" subtitle="Hierarchical tree view" viewport="700x340"
|
|
1883
|
+
*/
|
|
1884
|
+
interface TreeViewProps extends React.HTMLAttributes<HTMLDivElement> {
|
|
1885
|
+
/** Tree nodes. @default [] */
|
|
1886
|
+
items?: TreeNode[];
|
|
1887
|
+
/** Node ids expanded on first render (uncontrolled). */
|
|
1888
|
+
defaultExpanded?: string[];
|
|
1889
|
+
/** Controlled expanded node ids (pair with `onExpandedChange`). */
|
|
1890
|
+
expanded?: string[];
|
|
1891
|
+
/** Fired with the next expanded ids whenever a row expands or collapses. */
|
|
1892
|
+
onExpandedChange?: (ids: string[]) => void;
|
|
1893
|
+
/** Selected node id on first render (uncontrolled). */
|
|
1894
|
+
defaultSelectedId?: string | null;
|
|
1895
|
+
/** Controlled selected node id (pair with `onSelect`). */
|
|
1896
|
+
selectedId?: string | null;
|
|
1897
|
+
/** Fired when a row is clicked, id first (with the full node as the second argument). */
|
|
1898
|
+
onSelect?: (id: string, node: TreeNode) => void;
|
|
1899
|
+
}
|
|
1900
|
+
|
|
1499
1901
|
declare function TreeView(props: TreeViewProps): React.JSX.Element;
|
|
1500
1902
|
|
|
1501
|
-
|
|
1903
|
+
/** Generic, token-styled element — the building block for non-flex layout. */
|
|
1904
|
+
interface BoxProps extends React.HTMLAttributes<HTMLElement> {
|
|
1905
|
+
/** Element/tag to render. @default "div" */
|
|
1906
|
+
as?: keyof React.JSX.IntrinsicElements;
|
|
1907
|
+
/** Link destination — only used with as="a"; scheme-sanitized (javascript:/data:/vbscript: render without href). */
|
|
1908
|
+
href?: string;
|
|
1909
|
+
/** Anchor target — only used with as="a" (e.g. "_blank"). */
|
|
1910
|
+
target?: React.HTMLAttributeAnchorTarget;
|
|
1911
|
+
/** Anchor rel — only used with as="a"; pair "noopener noreferrer" with target="_blank". */
|
|
1912
|
+
rel?: string;
|
|
1913
|
+
/** Padding (all / x / y / individual) — spacing step (number) or CSS length. */
|
|
1914
|
+
p?: number | string;
|
|
1915
|
+
px?: number | string;
|
|
1916
|
+
py?: number | string;
|
|
1917
|
+
pt?: number | string;
|
|
1918
|
+
pr?: number | string;
|
|
1919
|
+
pb?: number | string;
|
|
1920
|
+
pl?: number | string;
|
|
1921
|
+
/** Margin (all / x / y / individual) — spacing step (number) or CSS length. */
|
|
1922
|
+
m?: number | string;
|
|
1923
|
+
mx?: number | string;
|
|
1924
|
+
my?: number | string;
|
|
1925
|
+
mt?: number | string;
|
|
1926
|
+
mr?: number | string;
|
|
1927
|
+
mb?: number | string;
|
|
1928
|
+
ml?: number | string;
|
|
1929
|
+
/** Background: a surface token name ("surface" | "surface-raised" | "surface-sunken" | "bg"), a bare custom property ("--my-token", wrapped in var()), or any plain CSS background value (e.g. "#fff", "linear-gradient(...)") used as-is. */
|
|
1930
|
+
bg?: "surface" | "surface-raised" | "surface-sunken" | "bg" | string;
|
|
1931
|
+
/** Add a 1px token border. @default false */
|
|
1932
|
+
border?: boolean;
|
|
1933
|
+
/** Border radius token suffix (e.g. "md", "lg", "2xl", "full"). */
|
|
1934
|
+
radius?: string;
|
|
1935
|
+
/** Box-shadow token suffix (e.g. "sm", "lg", "xl"). */
|
|
1936
|
+
shadow?: string;
|
|
1937
|
+
}
|
|
1938
|
+
|
|
1939
|
+
declare function Box(props: BoxProps): React.JSX.Element;
|
|
1940
|
+
|
|
1941
|
+
/** Centered, max-width content wrapper with responsive horizontal padding. */
|
|
1942
|
+
interface ContainerProps extends React.HTMLAttributes<HTMLElement> {
|
|
1943
|
+
/** Element/tag to render. @default "div" */
|
|
1944
|
+
as?: keyof React.JSX.IntrinsicElements;
|
|
1945
|
+
/** Link destination — only used with as="a"; scheme-sanitized (javascript:/data:/vbscript: render without href). */
|
|
1946
|
+
href?: string;
|
|
1947
|
+
/** Anchor target — only used with as="a" (e.g. "_blank"). */
|
|
1948
|
+
target?: React.HTMLAttributeAnchorTarget;
|
|
1949
|
+
/** Anchor rel — only used with as="a"; pair "noopener noreferrer" with target="_blank". */
|
|
1950
|
+
rel?: string;
|
|
1951
|
+
/** Max width: a named size (sm 640 / md 768 / lg 1024 / xl 1280 / full) or any CSS length. @default "lg" */
|
|
1952
|
+
size?: "sm" | "md" | "lg" | "xl" | "full" | string;
|
|
1953
|
+
/** Apply horizontal padding. @default true */
|
|
1954
|
+
padded?: boolean;
|
|
1955
|
+
}
|
|
1956
|
+
|
|
1957
|
+
declare function Container(props: ContainerProps): React.JSX.Element;
|
|
1958
|
+
|
|
1959
|
+
/** CSS grid primitive — fixed columns or a responsive auto-fill grid. */
|
|
1960
|
+
interface GridProps extends React.HTMLAttributes<HTMLElement> {
|
|
1961
|
+
/** Element/tag to render. @default "div" */
|
|
1962
|
+
as?: keyof React.JSX.IntrinsicElements;
|
|
1963
|
+
/** Link destination — only used with as="a"; scheme-sanitized (javascript:/data:/vbscript: render without href). */
|
|
1964
|
+
href?: string;
|
|
1965
|
+
/** Anchor target — only used with as="a" (e.g. "_blank"). */
|
|
1966
|
+
target?: React.HTMLAttributeAnchorTarget;
|
|
1967
|
+
/** Anchor rel — only used with as="a"; pair "noopener noreferrer" with target="_blank". */
|
|
1968
|
+
rel?: string;
|
|
1969
|
+
/** Fixed number of columns (ignored when `minChildWidth` is set). */
|
|
1970
|
+
columns?: number;
|
|
1971
|
+
/** Responsive auto-fill: minimum child width (number = px, or any CSS length). */
|
|
1972
|
+
minChildWidth?: number | string;
|
|
1973
|
+
/** Gap as a spacing-scale step (number) or any CSS length. @default 4 */
|
|
1974
|
+
gap?: number | string;
|
|
1975
|
+
align?: React.CSSProperties["alignItems"];
|
|
1976
|
+
justify?: React.CSSProperties["justifyItems"];
|
|
1977
|
+
}
|
|
1978
|
+
|
|
1979
|
+
declare function Grid(props: GridProps): React.JSX.Element;
|
|
1980
|
+
|
|
1981
|
+
/** Flex layout primitive — rows or columns with token-based gaps. */
|
|
1982
|
+
interface StackProps extends React.HTMLAttributes<HTMLElement> {
|
|
1983
|
+
/** Element/tag to render. @default "div" */
|
|
1984
|
+
as?: keyof React.JSX.IntrinsicElements;
|
|
1985
|
+
/** Link destination — only used with as="a"; scheme-sanitized (javascript:/data:/vbscript: render without href). */
|
|
1986
|
+
href?: string;
|
|
1987
|
+
/** Anchor target — only used with as="a" (e.g. "_blank"). */
|
|
1988
|
+
target?: React.HTMLAttributeAnchorTarget;
|
|
1989
|
+
/** Anchor rel — only used with as="a"; pair "noopener noreferrer" with target="_blank". */
|
|
1990
|
+
rel?: string;
|
|
1991
|
+
/** @default "column" */
|
|
1992
|
+
direction?: "row" | "column" | "row-reverse" | "column-reverse";
|
|
1993
|
+
/** Gap as a spacing-scale step (number) or any CSS length. @default 4 */
|
|
1994
|
+
gap?: number | string;
|
|
1995
|
+
align?: React.CSSProperties["alignItems"];
|
|
1996
|
+
justify?: React.CSSProperties["justifyContent"];
|
|
1997
|
+
/** Wrap children. @default false */
|
|
1998
|
+
wrap?: boolean;
|
|
1999
|
+
/** Use inline-flex instead of flex. @default false */
|
|
2000
|
+
inline?: boolean;
|
|
2001
|
+
}
|
|
2002
|
+
|
|
2003
|
+
declare function Stack(props: StackProps): React.JSX.Element;
|
|
2004
|
+
|
|
2005
|
+
/** Inline code with mono font and a subtle token-styled surface. */
|
|
2006
|
+
interface CodeProps extends React.HTMLAttributes<HTMLElement> {
|
|
2007
|
+
/** Element/tag to render. @default "code" */
|
|
2008
|
+
as?: keyof React.JSX.IntrinsicElements;
|
|
2009
|
+
/** Link destination — only used with as="a"; scheme-sanitized (javascript:/data:/vbscript: render without href). */
|
|
2010
|
+
href?: string;
|
|
2011
|
+
/** Anchor target — only used with as="a" (e.g. "_blank"). */
|
|
2012
|
+
target?: React.HTMLAttributeAnchorTarget;
|
|
2013
|
+
/** Anchor rel — only used with as="a"; pair "noopener noreferrer" with target="_blank". */
|
|
2014
|
+
rel?: string;
|
|
2015
|
+
}
|
|
2016
|
+
|
|
2017
|
+
declare function Code(props: CodeProps): React.JSX.Element;
|
|
2018
|
+
|
|
2019
|
+
/** Heading (h1–h6) with token typography. `level` sets the tag and default size. */
|
|
2020
|
+
interface HeadingProps extends React.HTMLAttributes<HTMLElement> {
|
|
2021
|
+
/** Override the rendered tag (e.g. render a visual h2 as an h1). */
|
|
2022
|
+
as?: keyof React.JSX.IntrinsicElements;
|
|
2023
|
+
/** Link destination — only used with as="a"; scheme-sanitized (javascript:/data:/vbscript: render without href). */
|
|
2024
|
+
href?: string;
|
|
2025
|
+
/** Anchor target — only used with as="a" (e.g. "_blank"). */
|
|
2026
|
+
target?: React.HTMLAttributeAnchorTarget;
|
|
2027
|
+
/** Anchor rel — only used with as="a"; pair "noopener noreferrer" with target="_blank". */
|
|
2028
|
+
rel?: string;
|
|
2029
|
+
/** Heading level 1–6 — sets the tag and the default size. @default 2 */
|
|
2030
|
+
level?: 1 | 2 | 3 | 4 | 5 | 6;
|
|
2031
|
+
/** Override the font-size token suffix (e.g. "3xl"). */
|
|
2032
|
+
size?: string;
|
|
2033
|
+
align?: React.CSSProperties["textAlign"];
|
|
2034
|
+
}
|
|
2035
|
+
|
|
2036
|
+
declare function Heading(props: HeadingProps): React.JSX.Element;
|
|
2037
|
+
|
|
2038
|
+
/** Body text with token sizes and semantic color tones. Renders <p> by default. */
|
|
2039
|
+
interface TextProps extends React.HTMLAttributes<HTMLElement> {
|
|
2040
|
+
/** Element/tag to render (e.g. "span", "p"). @default "p" */
|
|
2041
|
+
as?: keyof React.JSX.IntrinsicElements;
|
|
2042
|
+
/** Link destination — only used with as="a"; scheme-sanitized (javascript:/data:/vbscript: render without href). */
|
|
2043
|
+
href?: string;
|
|
2044
|
+
/** Anchor target — only used with as="a" (e.g. "_blank"). */
|
|
2045
|
+
target?: React.HTMLAttributeAnchorTarget;
|
|
2046
|
+
/** Anchor rel — only used with as="a"; pair "noopener noreferrer" with target="_blank". */
|
|
2047
|
+
rel?: string;
|
|
2048
|
+
/** Font-size token suffix. @default "base" */
|
|
2049
|
+
size?: "xs" | "sm" | "base" | "lg" | "xl" | string;
|
|
2050
|
+
/** Semantic color tone — text roles (default/muted/subtle) plus the color intents. @default "default" */
|
|
2051
|
+
tone?: "default" | "muted" | "subtle" | "primary" | "success" | "warning" | "danger" | "info" | "neutral";
|
|
2052
|
+
/** Font-weight token suffix (e.g. "medium", "semibold", "bold"). */
|
|
2053
|
+
weight?: "medium" | "semibold" | "bold" | string;
|
|
2054
|
+
align?: React.CSSProperties["textAlign"];
|
|
2055
|
+
}
|
|
2056
|
+
|
|
2057
|
+
declare function Text(props: TextProps): React.JSX.Element;
|
|
2058
|
+
|
|
2059
|
+
/** SSR-safe `useLayoutEffect` (falls back to `useEffect` on the server). */
|
|
2060
|
+
declare const useIsomorphicLayoutEffect: typeof React.useLayoutEffect;
|
|
2061
|
+
|
|
2062
|
+
/** `true` once the component has mounted on the client — for SSR-safe rendering. */
|
|
2063
|
+
declare function useMounted(): boolean;
|
|
2064
|
+
|
|
2065
|
+
/** The value from the previous render. */
|
|
2066
|
+
declare function usePrevious<T>(value: T): T | undefined;
|
|
2067
|
+
|
|
2068
|
+
/** Boolean state with a stable toggle. `toggle()` flips; `toggle(true)` sets. */
|
|
2069
|
+
declare function useToggle(
|
|
2070
|
+
initial?: boolean
|
|
2071
|
+
): [boolean, (next?: boolean) => void, React.Dispatch<React.SetStateAction<boolean>>];
|
|
2072
|
+
|
|
2073
|
+
/** Open/close state for dialogs, drawers, menus, popovers. */
|
|
2074
|
+
declare function useDisclosure(initial?: boolean): {
|
|
2075
|
+
open: boolean;
|
|
2076
|
+
onOpen: () => void;
|
|
2077
|
+
onClose: () => void;
|
|
2078
|
+
onToggle: () => void;
|
|
2079
|
+
setOpen: React.Dispatch<React.SetStateAction<boolean>>;
|
|
2080
|
+
};
|
|
2081
|
+
|
|
2082
|
+
/** Controlled/uncontrolled state — the pattern every form component needs. */
|
|
2083
|
+
declare function useControllableState<T>(options?: {
|
|
2084
|
+
value?: T;
|
|
2085
|
+
defaultValue?: T;
|
|
2086
|
+
onChange?: (value: T) => void;
|
|
2087
|
+
}): [T, (next: T | ((prev: T) => T)) => void];
|
|
2088
|
+
|
|
2089
|
+
/** Reactively match a media query (SSR-safe). */
|
|
2090
|
+
declare function useMediaQuery(query: string): boolean;
|
|
2091
|
+
|
|
2092
|
+
/** `true` when the user requests reduced motion. */
|
|
2093
|
+
declare function usePrefersReducedMotion(): boolean;
|
|
2094
|
+
|
|
2095
|
+
interface UseColorSchemeOptions {
|
|
2096
|
+
/** localStorage key. @default "twico-theme" */
|
|
2097
|
+
storageKey?: string;
|
|
2098
|
+
/** "class" toggles `.dark`; any other string is set as an attribute. @default "class" */
|
|
2099
|
+
attribute?: string;
|
|
2100
|
+
/** Element to theme. @default document.documentElement */
|
|
2101
|
+
element?: HTMLElement | null;
|
|
2102
|
+
/** Disable CSS transitions during the switch so the UI re-themes instantly. @default true */
|
|
2103
|
+
disableTransitionsOnChange?: boolean;
|
|
2104
|
+
}
|
|
2105
|
+
|
|
2106
|
+
/** Light/dark theme state synced to `<html>` and persisted to localStorage. */
|
|
2107
|
+
declare function useColorScheme(options?: UseColorSchemeOptions): {
|
|
2108
|
+
theme: "light" | "dark";
|
|
2109
|
+
setTheme: (theme: "light" | "dark") => void;
|
|
2110
|
+
toggle: () => void;
|
|
2111
|
+
isDark: boolean;
|
|
2112
|
+
};
|
|
2113
|
+
|
|
2114
|
+
/** Attach an event listener (window by default, or a ref/element) with cleanup. */
|
|
2115
|
+
declare function useEventListener(
|
|
2116
|
+
eventName: string,
|
|
2117
|
+
handler: (event: any) => void,
|
|
2118
|
+
element?: React.RefObject<any> | EventTarget | null,
|
|
2119
|
+
options?: boolean | AddEventListenerOptions
|
|
2120
|
+
): void;
|
|
2121
|
+
|
|
2122
|
+
/** Call `handler` when a pointer/touch event lands outside `ref`. */
|
|
2123
|
+
declare function useClickOutside<T extends HTMLElement = HTMLElement>(
|
|
2124
|
+
ref: React.RefObject<T>,
|
|
2125
|
+
handler: (event: Event) => void,
|
|
2126
|
+
events?: string[]
|
|
2127
|
+
): void;
|
|
2128
|
+
|
|
2129
|
+
interface UseKeyPressOptions {
|
|
2130
|
+
ctrl?: boolean;
|
|
2131
|
+
meta?: boolean;
|
|
2132
|
+
shift?: boolean;
|
|
2133
|
+
alt?: boolean;
|
|
2134
|
+
preventDefault?: boolean;
|
|
2135
|
+
}
|
|
2136
|
+
|
|
2137
|
+
/** Run `handler` on a keydown matching `key`, with optional modifier requirements. */
|
|
2138
|
+
declare function useKeyPress(
|
|
2139
|
+
key: string | string[],
|
|
2140
|
+
handler: (event: KeyboardEvent) => void,
|
|
2141
|
+
options?: UseKeyPressOptions
|
|
2142
|
+
): void;
|
|
2143
|
+
|
|
2144
|
+
/** State persisted to localStorage (JSON-serialized), SSR-safe. */
|
|
2145
|
+
declare function useLocalStorage<T>(
|
|
2146
|
+
key: string,
|
|
2147
|
+
initialValue: T
|
|
2148
|
+
): [T, (value: T | ((prev: T) => T)) => void];
|
|
2149
|
+
|
|
2150
|
+
/** Copy text to the clipboard with a `copied` flag that auto-resets. */
|
|
2151
|
+
declare function useCopyToClipboard(timeout?: number): {
|
|
2152
|
+
copied: boolean;
|
|
2153
|
+
copy: (text: string) => Promise<boolean>;
|
|
2154
|
+
};
|
|
2155
|
+
|
|
2156
|
+
/** Debounce a value — updates only after `delay` ms of no change. */
|
|
2157
|
+
declare function useDebouncedValue<T>(value: T, delay?: number): T;
|
|
2158
|
+
|
|
2159
|
+
/** A debounced version of a callback. */
|
|
2160
|
+
declare function useDebouncedCallback<A extends any[]>(
|
|
2161
|
+
callback: (...args: A) => void,
|
|
2162
|
+
delay?: number
|
|
2163
|
+
): (...args: A) => void;
|
|
2164
|
+
|
|
2165
|
+
/** Run `callback` every `delay` ms; pass `delay = null` to pause. */
|
|
2166
|
+
declare function useInterval(callback: () => void, delay: number | null): void;
|
|
2167
|
+
|
|
2168
|
+
/** Run `callback` once after `delay` ms; pass `delay = null` to cancel. */
|
|
2169
|
+
declare function useTimeout(callback: () => void, delay: number | null): void;
|
|
2170
|
+
|
|
2171
|
+
/** The current window dimensions (0×0 on the server). */
|
|
2172
|
+
declare function useWindowSize(): { width: number; height: number };
|
|
2173
|
+
|
|
2174
|
+
/** `true` while the pointer is over the element referenced by `ref`. */
|
|
2175
|
+
declare function useHover<T extends HTMLElement = HTMLElement>(ref: React.RefObject<T>): boolean;
|
|
2176
|
+
|
|
2177
|
+
/** The latest IntersectionObserver entry for the element referenced by `ref`. */
|
|
2178
|
+
declare function useIntersectionObserver<T extends HTMLElement = HTMLElement>(
|
|
2179
|
+
ref: React.RefObject<T>,
|
|
2180
|
+
options?: IntersectionObserverInit
|
|
2181
|
+
): IntersectionObserverEntry | null;
|
|
2182
|
+
|
|
2183
|
+
/** Lock body scroll while `locked` is true — for modals/drawers. */
|
|
2184
|
+
declare function useScrollLock(locked?: boolean): void;
|
|
2185
|
+
|
|
2186
|
+
/** A stable, SSR-safe unique id (optionally prefixed). */
|
|
2187
|
+
declare function useId(prefix?: string): string;
|
|
2188
|
+
|
|
2189
|
+
export { Accordion, type AccordionItem, type AccordionProps, Alert, type AlertProps, Avatar, AvatarMenu, type AvatarMenuProps, type AvatarProps, Badge, type BadgeProps, 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 DatatableProps, type DatatableQuery, type DatatableRowAction, 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, 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, Pagination, type PaginationProps, Popover, type PopoverProps, Progress, type ProgressProps, Radio, type RadioProps, Rating, type RatingProps, 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, Textarea, type TextareaProps, Timeline, type TimelineItem, type TimelineProps, Toast, type ToastApi, type ToastOptions, type ToastProps, ToastProvider, type ToastProviderProps, ToastViewport, type ToastViewportProps, Tooltip, type TooltipProps, type TreeNode, TreeView, type TreeViewProps, type UseColorSchemeOptions, type UseKeyPressOptions, runDatatableQuery, useClickOutside, useColorScheme, useControllableState, useCopyToClipboard, useDebouncedCallback, useDebouncedValue, useDisclosure, useEventListener, useHover, useId, useIntersectionObserver, useInterval, useIsomorphicLayoutEffect, useKeyPress, useLocalStorage, useMediaQuery, useMounted, usePrefersReducedMotion, usePrevious, useScrollLock, useTimeout, useToast, useToggle, useWindowSize };
|