@jirawatpyk/aura-tokens 4.4.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/GOVERNANCE.md +87 -0
- package/LICENSE +30 -0
- package/README.md +82 -0
- package/aura-fonts.css +2 -0
- package/aura.css +242 -0
- package/components/aura.bundle.js +4087 -0
- package/components/aura.components.css +967 -0
- package/components/index.d.ts +825 -0
- package/eslint-plugin-aura.js +34 -0
- package/figma-variables.csv +205 -0
- package/package.json +61 -0
- package/scripts/a11y-check.js +67 -0
- package/scripts/lint-tokens.js +32 -0
- package/tailwind.config.ts +29 -0
- package/tailwind.tokens.cjs +200 -0
- package/tokens.json +484 -0
|
@@ -0,0 +1,825 @@
|
|
|
1
|
+
import type * as React from 'react';
|
|
2
|
+
|
|
3
|
+
/** AURA pill button. Enterprise (`primary`, `secondary`) for product UI; `creative` for marketing moments only. */
|
|
4
|
+
export interface ButtonProps extends React.ButtonHTMLAttributes<HTMLButtonElement> {
|
|
5
|
+
/** Visual variant. Default `primary`. */
|
|
6
|
+
variant?: 'primary' | 'secondary' | 'creative';
|
|
7
|
+
/** Label text — short, Title Case English or Thai. */
|
|
8
|
+
children: React.ReactNode;
|
|
9
|
+
/** Leading icon name (see `IconName`). Hidden while loading. */
|
|
10
|
+
icon?: IconName;
|
|
11
|
+
/** Trailing icon name, e.g. `arrow-right` for forward actions. */
|
|
12
|
+
iconRight?: IconName;
|
|
13
|
+
/** Shows a spinner in place of the leading icon, sets aria-busy and swallows clicks. Keeps the label and width. */
|
|
14
|
+
loading?: boolean;
|
|
15
|
+
}
|
|
16
|
+
export declare const Button: React.ForwardRefExoticComponent<ButtonProps & React.RefAttributes<HTMLButtonElement>>;
|
|
17
|
+
|
|
18
|
+
export interface DataTableColumn {
|
|
19
|
+
/** Key into each row object. */
|
|
20
|
+
key: string;
|
|
21
|
+
/** Header label (source style: UPPERCASE). */
|
|
22
|
+
label: string;
|
|
23
|
+
/** Fixed width in px; the last column usually takes the rest. */
|
|
24
|
+
width?: number;
|
|
25
|
+
/** Render the cell in the mono face (IDs). */
|
|
26
|
+
mono?: boolean;
|
|
27
|
+
/** Render the value as a StatusPill (tone picked from the word). */
|
|
28
|
+
pill?: boolean;
|
|
29
|
+
/** Override the tone for specific values, e.g. `{ 'QA': 'progress' }`. */
|
|
30
|
+
tones?: Record<string, StatusTone>;
|
|
31
|
+
/** Header becomes a button cycling asc → desc → unsorted. */
|
|
32
|
+
sortable?: boolean;
|
|
33
|
+
/** Value to sort by, when not the cell value (dates, amounts). */
|
|
34
|
+
sortValue?: (row: Record<string, any>) => string | number | null;
|
|
35
|
+
/** Custom cell content. */
|
|
36
|
+
render?: (row: Record<string, any>) => React.ReactNode;
|
|
37
|
+
/** Set false to keep a sized column fixed when the table is `resizable`. */
|
|
38
|
+
resizable?: boolean;
|
|
39
|
+
/** Resize limits in px. Defaults 64 / 480. For the flexible column, minWidth defaults to 160. */
|
|
40
|
+
minWidth?: number;
|
|
41
|
+
maxWidth?: number;
|
|
42
|
+
/** Start pinned to the left (needs a width). */
|
|
43
|
+
pinned?: boolean;
|
|
44
|
+
/** Start hidden (show it from the columns button). */
|
|
45
|
+
hidden?: boolean;
|
|
46
|
+
/** Hide this column when the table is narrower than this (px, or a breakpoint name). For tablets: keep ID, name, date and status; drop the rest below `lg`. Not applied to stacked cards. */
|
|
47
|
+
hideBelow?: number | 'sm' | 'md' | 'lg' | 'xl';
|
|
48
|
+
/** Row actions (a DropdownMenu or IconButton). In stacked cards it sits top-right instead of in the field list. Give it an empty label. */
|
|
49
|
+
actions?: boolean;
|
|
50
|
+
}
|
|
51
|
+
export interface DataTableSort { key: string; dir: 'asc' | 'desc'; }
|
|
52
|
+
export interface DataTableEmpty {
|
|
53
|
+
/** Default `inbox`; use `search` for "no matches". */
|
|
54
|
+
icon?: IconName;
|
|
55
|
+
/** Default "Nothing here yet". */
|
|
56
|
+
title?: string;
|
|
57
|
+
description?: string;
|
|
58
|
+
/** One action, usually a secondary Button. */
|
|
59
|
+
action?: React.ReactNode;
|
|
60
|
+
}
|
|
61
|
+
/** Enterprise data table: 48px rows, hairline dividers, mono header band. */
|
|
62
|
+
export interface DataTableProps {
|
|
63
|
+
/** Defaults to ID · NAME · STATUS · OWNER (96 / 160 / 112 / auto px). */
|
|
64
|
+
columns?: DataTableColumn[];
|
|
65
|
+
rows: Array<Record<string, React.ReactNode>>;
|
|
66
|
+
/** Column key giving each row a unique React key. Default: the first column's key. */
|
|
67
|
+
rowKey?: string;
|
|
68
|
+
/** Accessible name for the table. */
|
|
69
|
+
label?: string;
|
|
70
|
+
/** Controlled sort; pair with onSortChange. */
|
|
71
|
+
sort?: DataTableSort | null;
|
|
72
|
+
/** Initial sort when uncontrolled. */
|
|
73
|
+
defaultSort?: DataTableSort | null;
|
|
74
|
+
onSortChange?: (sort: DataTableSort | null) => void;
|
|
75
|
+
/** Adds a checkbox column. */
|
|
76
|
+
selectable?: boolean;
|
|
77
|
+
/** Controlled selection (row keys); pair with onSelectionChange. */
|
|
78
|
+
selected?: Array<string | number>;
|
|
79
|
+
/** Initial selection when uncontrolled. */
|
|
80
|
+
defaultSelected?: Array<string | number>;
|
|
81
|
+
onSelectionChange?: (keys: Array<string | number>) => void;
|
|
82
|
+
/** Shown when rows is empty. */
|
|
83
|
+
empty?: DataTableEmpty;
|
|
84
|
+
/** Rows per page; omit for no pagination. */
|
|
85
|
+
pageSize?: number;
|
|
86
|
+
/** Controlled page (1-based); pair with onPageChange. */
|
|
87
|
+
page?: number;
|
|
88
|
+
/** Initial page when uncontrolled. Default 1. */
|
|
89
|
+
defaultPage?: number;
|
|
90
|
+
onPageChange?: (page: number) => void;
|
|
91
|
+
/** Adds drag/keyboard resize handles to every column that has a width. */
|
|
92
|
+
resizable?: boolean;
|
|
93
|
+
onColumnResize?: (key: string, width: number) => void;
|
|
94
|
+
/** Shows skeleton rows and disables sorting, select-all and paging. */
|
|
95
|
+
loading?: boolean;
|
|
96
|
+
/** Skeleton row count when there is no pageSize. Default 5. */
|
|
97
|
+
skeletonRows?: number;
|
|
98
|
+
/** Called on row click or Enter. */
|
|
99
|
+
onRowActivate?: (row: Record<string, any>) => void;
|
|
100
|
+
/** Fixed height in px: sticky header, and only the rows in view are rendered. */
|
|
101
|
+
height?: number;
|
|
102
|
+
/** Column menu on every header, drag-to-reorder, and the show/hide columns button. */
|
|
103
|
+
columnControls?: boolean;
|
|
104
|
+
/** Set false to keep column controls but turn off reordering. */
|
|
105
|
+
reorderable?: boolean;
|
|
106
|
+
/** Controlled column order (keys); pair with onColumnOrderChange. */
|
|
107
|
+
columnOrder?: string[];
|
|
108
|
+
onColumnOrderChange?: (keys: string[]) => void;
|
|
109
|
+
/** Controlled hidden columns (keys); pair with onHiddenColumnsChange. */
|
|
110
|
+
hiddenColumns?: string[];
|
|
111
|
+
onHiddenColumnsChange?: (keys: string[]) => void;
|
|
112
|
+
/** Controlled pinned columns (keys); pair with onPinnedColumnsChange. */
|
|
113
|
+
pinnedColumns?: string[];
|
|
114
|
+
onPinnedColumnsChange?: (keys: string[]) => void;
|
|
115
|
+
/** Container width in px below which rows render as stacked cards (phones). Try 640. Measured with ResizeObserver, so it follows the container, not the window. */
|
|
116
|
+
stackBelow?: number;
|
|
117
|
+
className?: string;
|
|
118
|
+
}
|
|
119
|
+
export declare const DataTable: React.ForwardRefExoticComponent<DataTableProps & React.RefAttributes<HTMLDivElement>>;
|
|
120
|
+
|
|
121
|
+
export type IconName =
|
|
122
|
+
| 'check' | 'x' | 'plus' | 'minus' | 'search'
|
|
123
|
+
| 'chevron-down' | 'chevron-up' | 'chevron-left' | 'chevron-right'
|
|
124
|
+
| 'arrow-right' | 'arrow-up-right' | 'arrow-up-down' | 'loader-circle'
|
|
125
|
+
| 'circle-alert' | 'circle-check' | 'info' | 'triangle-alert'
|
|
126
|
+
| 'settings' | 'user' | 'users' | 'filter' | 'ellipsis' | 'external-link'
|
|
127
|
+
| 'copy' | 'trash-2' | 'pencil' | 'download' | 'upload' | 'calendar'
|
|
128
|
+
| 'bell' | 'menu' | 'eye' | 'log-out'
|
|
129
|
+
| 'circle' | 'circle-dot-dashed' | 'ban' | 'arrow-up' | 'arrow-down' | 'inbox'
|
|
130
|
+
| 'pin' | 'pin-off' | 'eye-off' | 'columns-3' | 'arrow-left' | 'rotate-ccw'
|
|
131
|
+
| 'house' | 'layout-dashboard' | 'folder' | 'chart-column' | 'file-text' | 'mail' | 'lock'
|
|
132
|
+
| 'clock' | 'trending-up' | 'trending-down' | 'image' | 'paperclip' | 'cloud-upload' | 'file';
|
|
133
|
+
|
|
134
|
+
/** Lucide stroke icon drawn inline in currentColor. */
|
|
135
|
+
export interface IconProps {
|
|
136
|
+
name: IconName;
|
|
137
|
+
/** `sm` 16 (default) · `md` 20 · `lg` 24, or a px number. */
|
|
138
|
+
size?: 'sm' | 'md' | 'lg' | number;
|
|
139
|
+
/** Accessible name. Omit for decorative icons next to a text label (then aria-hidden). */
|
|
140
|
+
label?: string;
|
|
141
|
+
/** Default 2 (Lucide's). */
|
|
142
|
+
strokeWidth?: number;
|
|
143
|
+
className?: string;
|
|
144
|
+
}
|
|
145
|
+
export declare const Icon: React.ForwardRefExoticComponent<IconProps & React.RefAttributes<SVGSVGElement>>;
|
|
146
|
+
/** Every icon name the bundle carries. */
|
|
147
|
+
export declare const iconNames: IconName[];
|
|
148
|
+
|
|
149
|
+
/** Creative surface with the AURA mesh and/or grain texture. Light in every theme; content in aura-on-texture. */
|
|
150
|
+
export interface SurfaceProps extends React.HTMLAttributes<HTMLElement> {
|
|
151
|
+
/** Default `mesh`. */
|
|
152
|
+
texture?: 'mesh' | 'grain' | 'mesh-grain';
|
|
153
|
+
/** Element to render. Default `div`. */
|
|
154
|
+
as?: keyof JSX.IntrinsicElements;
|
|
155
|
+
children?: React.ReactNode;
|
|
156
|
+
}
|
|
157
|
+
/** Sets the language of built-in labels (pagination, close buttons, empty states…) and the default date display for everything inside. */
|
|
158
|
+
export interface AuraProviderProps {
|
|
159
|
+
/** Default `en` strings when there is no provider (dates still default to Thai / พ.ศ.). */
|
|
160
|
+
locale?: 'th' | 'en';
|
|
161
|
+
/** Default calendar for DatePicker / DateRangePicker / Calendar / formatDate callers that read it. */
|
|
162
|
+
calendar?: 'buddhist' | 'gregory';
|
|
163
|
+
/** Override individual strings. */
|
|
164
|
+
strings?: Partial<Record<string, string | ((...args: any[]) => string)>>;
|
|
165
|
+
children?: React.ReactNode;
|
|
166
|
+
}
|
|
167
|
+
export declare function AuraProvider(props: AuraProviderProps): React.ReactElement;
|
|
168
|
+
export declare function useAuraLocale(): { locale: 'th' | 'en' | null; calendar: 'buddhist' | 'gregory' | null; strings: Record<string, any> };
|
|
169
|
+
export declare const STRINGS: { en: Record<string, any>; th: Record<string, any> };
|
|
170
|
+
export declare const Surface: React.ForwardRefExoticComponent<SurfaceProps & React.RefAttributes<HTMLElement>>;
|
|
171
|
+
|
|
172
|
+
export type StatusTone = 'neutral' | 'progress' | 'ready' | 'blocked';
|
|
173
|
+
/** Status pill: tone fill + icon + the status word. Tone comes from the word unless given. */
|
|
174
|
+
export interface StatusPillProps {
|
|
175
|
+
/** The status word shown, e.g. "In Progress". */
|
|
176
|
+
children: React.ReactNode;
|
|
177
|
+
/** Force a tone. Default: matched from the word (Ready/Done → ready, In Progress/In Review → progress, Blocked/Failed → blocked, anything else → neutral). */
|
|
178
|
+
tone?: StatusTone;
|
|
179
|
+
className?: string;
|
|
180
|
+
}
|
|
181
|
+
export declare const StatusPill: React.ForwardRefExoticComponent<StatusPillProps & React.RefAttributes<HTMLSpanElement>>;
|
|
182
|
+
/** The tone the pill would pick for a status word. */
|
|
183
|
+
export declare function statusTone(status: string): StatusTone;
|
|
184
|
+
|
|
185
|
+
/** 16px checkbox with 4px corners; ink when checked, a dash when indeterminate. */
|
|
186
|
+
export interface CheckboxProps extends Omit<React.InputHTMLAttributes<HTMLInputElement>, 'onChange' | 'type' | 'checked' | 'defaultChecked'> {
|
|
187
|
+
/** Controlled state; pair with onChange. Or use defaultChecked. */
|
|
188
|
+
checked?: boolean;
|
|
189
|
+
defaultChecked?: boolean;
|
|
190
|
+
indeterminate?: boolean;
|
|
191
|
+
/** Accessible name for a bare box (tables). Not needed when children give a visible label. */
|
|
192
|
+
label?: string;
|
|
193
|
+
/** Visible label beside the box (form use). */
|
|
194
|
+
children?: React.ReactNode;
|
|
195
|
+
/** Second line under the visible label (needs an id to be linked). */
|
|
196
|
+
description?: React.ReactNode;
|
|
197
|
+
onChange?: (checked: boolean) => void;
|
|
198
|
+
disabled?: boolean;
|
|
199
|
+
tabIndex?: number;
|
|
200
|
+
className?: string;
|
|
201
|
+
}
|
|
202
|
+
export declare const Checkbox: React.ForwardRefExoticComponent<CheckboxProps & React.RefAttributes<HTMLInputElement>>;
|
|
203
|
+
|
|
204
|
+
/** 32px round button holding one icon. */
|
|
205
|
+
export interface IconButtonProps extends React.ButtonHTMLAttributes<HTMLButtonElement> {
|
|
206
|
+
icon: IconName;
|
|
207
|
+
/** Accessible name and tooltip (required). */
|
|
208
|
+
label: string;
|
|
209
|
+
/** Icon size. Default `sm` (16). */
|
|
210
|
+
size?: 'sm' | 'md';
|
|
211
|
+
}
|
|
212
|
+
export declare const IconButton: React.ForwardRefExoticComponent<IconButtonProps & React.RefAttributes<HTMLButtonElement>>;
|
|
213
|
+
|
|
214
|
+
export interface MenuItem {
|
|
215
|
+
label?: string;
|
|
216
|
+
icon?: IconName;
|
|
217
|
+
/** Present = a checkable item (menuitemcheckbox). */
|
|
218
|
+
checked?: boolean;
|
|
219
|
+
disabled?: boolean;
|
|
220
|
+
/** Keep the menu open after choosing (checkbox lists). */
|
|
221
|
+
keepOpen?: boolean;
|
|
222
|
+
/** Short right-aligned hint, e.g. a shortcut. */
|
|
223
|
+
hint?: string;
|
|
224
|
+
/** A divider instead of an item. */
|
|
225
|
+
separator?: boolean;
|
|
226
|
+
onSelect?: () => void;
|
|
227
|
+
}
|
|
228
|
+
/** Popover list anchored to an element, rendered in a portal. */
|
|
229
|
+
export interface MenuProps {
|
|
230
|
+
/** The element it opens from (usually the button that was clicked). */
|
|
231
|
+
anchor: HTMLElement;
|
|
232
|
+
items: MenuItem[];
|
|
233
|
+
/** Accessible name. */
|
|
234
|
+
label: string;
|
|
235
|
+
/** Called on choose, Escape, Tab or outside click. `restoreFocus` is true for keyboard closes. */
|
|
236
|
+
onClose: (restoreFocus: boolean) => void;
|
|
237
|
+
/** Focus the first item on open. Default true; turn off only for static demos. */
|
|
238
|
+
autoFocus?: boolean;
|
|
239
|
+
}
|
|
240
|
+
export declare const Menu: React.ForwardRefExoticComponent<MenuProps & React.RefAttributes<HTMLDivElement>>;
|
|
241
|
+
|
|
242
|
+
/* ---------- Forms ---------- */
|
|
243
|
+
interface FieldProps {
|
|
244
|
+
/** Visible label; also the accessible name. */
|
|
245
|
+
label: string;
|
|
246
|
+
/** Helper line under the field (caption, fg-secondary). */
|
|
247
|
+
hint?: React.ReactNode;
|
|
248
|
+
/** Replaces the hint, turns the edge fg-danger and sets aria-invalid. Write it as the fix. */
|
|
249
|
+
error?: React.ReactNode;
|
|
250
|
+
/** Adds a red asterisk and the native required attribute. */
|
|
251
|
+
required?: boolean;
|
|
252
|
+
/** Adds "(optional)" after the label. */
|
|
253
|
+
optional?: boolean;
|
|
254
|
+
}
|
|
255
|
+
export interface TextFieldProps extends FieldProps, Omit<React.InputHTMLAttributes<HTMLInputElement>, 'required'> {
|
|
256
|
+
/** Leading icon inside the field. */
|
|
257
|
+
icon?: IconName;
|
|
258
|
+
/** Trailing unit, e.g. "THB". */
|
|
259
|
+
suffix?: React.ReactNode;
|
|
260
|
+
}
|
|
261
|
+
export declare const TextField: React.ForwardRefExoticComponent<TextFieldProps & React.RefAttributes<HTMLInputElement>>;
|
|
262
|
+
export interface TextareaProps extends FieldProps, Omit<React.TextareaHTMLAttributes<HTMLTextAreaElement>, 'required'> {}
|
|
263
|
+
export declare const Textarea: React.ForwardRefExoticComponent<TextareaProps & React.RefAttributes<HTMLTextAreaElement>>;
|
|
264
|
+
export type SelectOption = string | { value: string; label: string; disabled?: boolean };
|
|
265
|
+
export interface SelectProps extends FieldProps, Omit<React.SelectHTMLAttributes<HTMLSelectElement>, 'required'> {
|
|
266
|
+
options: SelectOption[];
|
|
267
|
+
/** A disabled first option shown in fg-tertiary until something is chosen. */
|
|
268
|
+
placeholder?: string;
|
|
269
|
+
icon?: IconName;
|
|
270
|
+
}
|
|
271
|
+
export declare const Select: React.ForwardRefExoticComponent<SelectProps & React.RefAttributes<HTMLSelectElement>>;
|
|
272
|
+
export type ChoiceOption = string | { value: string; label: string; description?: string; disabled?: boolean };
|
|
273
|
+
export interface RadioGroupProps extends FieldProps {
|
|
274
|
+
options: ChoiceOption[];
|
|
275
|
+
value?: string;
|
|
276
|
+
defaultValue?: string;
|
|
277
|
+
onChange?: (value: string) => void;
|
|
278
|
+
name?: string;
|
|
279
|
+
/** Default `vertical`. */
|
|
280
|
+
orientation?: 'vertical' | 'horizontal';
|
|
281
|
+
disabled?: boolean;
|
|
282
|
+
}
|
|
283
|
+
export declare const RadioGroup: React.ForwardRefExoticComponent<RadioGroupProps & React.RefAttributes<HTMLFieldSetElement>>;
|
|
284
|
+
export interface SwitchProps {
|
|
285
|
+
label?: string;
|
|
286
|
+
description?: string;
|
|
287
|
+
checked?: boolean;
|
|
288
|
+
defaultChecked?: boolean;
|
|
289
|
+
onChange?: (checked: boolean) => void;
|
|
290
|
+
disabled?: boolean;
|
|
291
|
+
/** Required when there is no visible label. */
|
|
292
|
+
'aria-label'?: string;
|
|
293
|
+
}
|
|
294
|
+
export declare const Switch: React.ForwardRefExoticComponent<SwitchProps & React.RefAttributes<HTMLButtonElement>>;
|
|
295
|
+
|
|
296
|
+
/* ---------- Feedback & overlays ---------- */
|
|
297
|
+
export type FeedbackTone = 'info' | 'success' | 'warning' | 'danger';
|
|
298
|
+
export interface AlertProps {
|
|
299
|
+
tone?: FeedbackTone;
|
|
300
|
+
title?: React.ReactNode;
|
|
301
|
+
children?: React.ReactNode;
|
|
302
|
+
/** Usually a secondary Button. */
|
|
303
|
+
action?: React.ReactNode;
|
|
304
|
+
/** Adds a close button. */
|
|
305
|
+
onDismiss?: () => void;
|
|
306
|
+
}
|
|
307
|
+
export declare const Alert: React.ForwardRefExoticComponent<AlertProps & React.RefAttributes<HTMLDivElement>>;
|
|
308
|
+
export interface ToastOptions {
|
|
309
|
+
title: string;
|
|
310
|
+
description?: string;
|
|
311
|
+
tone?: FeedbackTone;
|
|
312
|
+
action?: { label: string; onClick?: () => void };
|
|
313
|
+
/** ms before it closes itself. Default 5000; Infinity keeps it until dismissed. */
|
|
314
|
+
duration?: number;
|
|
315
|
+
/** Reuse an id to replace a toast in place. */
|
|
316
|
+
id?: string;
|
|
317
|
+
}
|
|
318
|
+
/** Show a toast; returns its id. Needs <Toaster /> mounted once. */
|
|
319
|
+
export declare const toast: ((opts: ToastOptions | string) => string) & { dismiss(id: string): void };
|
|
320
|
+
export declare function Toaster(props: { position?: 'bottom' | 'top' }): React.ReactElement;
|
|
321
|
+
export interface TooltipProps {
|
|
322
|
+
content: React.ReactNode;
|
|
323
|
+
/** One focusable element. */
|
|
324
|
+
children: React.ReactElement;
|
|
325
|
+
side?: 'top' | 'bottom';
|
|
326
|
+
/** Hover delay in ms. Default 400. */
|
|
327
|
+
delay?: number;
|
|
328
|
+
/** Force open (demos, tests). */
|
|
329
|
+
open?: boolean;
|
|
330
|
+
}
|
|
331
|
+
export declare const Tooltip: React.ForwardRefExoticComponent<TooltipProps & React.RefAttributes<HTMLSpanElement>>;
|
|
332
|
+
export interface FieldPropsPublic { label: string; hint?: React.ReactNode; error?: React.ReactNode; required?: boolean; optional?: boolean; }
|
|
333
|
+
export declare const Field: React.ForwardRefExoticComponent<FieldPropsPublic & { id?: string; children: React.ReactNode } & React.RefAttributes<HTMLDivElement>>;
|
|
334
|
+
export interface DialogProps {
|
|
335
|
+
open: boolean;
|
|
336
|
+
onClose: () => void;
|
|
337
|
+
title: React.ReactNode;
|
|
338
|
+
description?: React.ReactNode;
|
|
339
|
+
children?: React.ReactNode;
|
|
340
|
+
/** Buttons, right-aligned: secondary Cancel, then the primary action. */
|
|
341
|
+
footer?: React.ReactNode;
|
|
342
|
+
/** `sm` 400 · `md` 560 (default) · `lg` 720. */
|
|
343
|
+
size?: 'sm' | 'md' | 'lg';
|
|
344
|
+
/** Default true. False hides the close button and ignores Escape and scrim clicks. */
|
|
345
|
+
dismissible?: boolean;
|
|
346
|
+
/** Use `alertdialog` for destructive confirmations. */
|
|
347
|
+
role?: 'dialog' | 'alertdialog';
|
|
348
|
+
/** Default true. Turn off only for static demos. */
|
|
349
|
+
autoFocus?: boolean;
|
|
350
|
+
className?: string;
|
|
351
|
+
}
|
|
352
|
+
export declare const Dialog: React.ForwardRefExoticComponent<DialogProps & React.RefAttributes<HTMLDivElement>>;
|
|
353
|
+
|
|
354
|
+
/* ---------- Layout & navigation ---------- */
|
|
355
|
+
export interface CardProps {
|
|
356
|
+
title?: React.ReactNode;
|
|
357
|
+
description?: React.ReactNode;
|
|
358
|
+
/** Top-right, usually an IconButton. */
|
|
359
|
+
actions?: React.ReactNode;
|
|
360
|
+
footer?: React.ReactNode;
|
|
361
|
+
children?: React.ReactNode;
|
|
362
|
+
/** Default `enterprise`. `creative` is for marketing and onboarding only. */
|
|
363
|
+
variant?: 'enterprise' | 'creative';
|
|
364
|
+
/** Heading level of the title. Default 3 — use 2 when cards sit directly under the page h1. */
|
|
365
|
+
headingLevel?: 2 | 3 | 4 | 5 | 6;
|
|
366
|
+
/** Hover edge for clickable cards. */
|
|
367
|
+
interactive?: boolean;
|
|
368
|
+
as?: keyof JSX.IntrinsicElements;
|
|
369
|
+
className?: string;
|
|
370
|
+
}
|
|
371
|
+
export declare const Card: React.ForwardRefExoticComponent<CardProps & React.RefAttributes<HTMLElement>>;
|
|
372
|
+
export interface TabItem { id: string; label: string; icon?: IconName; count?: number; disabled?: boolean; content?: React.ReactNode; }
|
|
373
|
+
export interface TabsProps {
|
|
374
|
+
tabs: TabItem[];
|
|
375
|
+
/** Accessible name for the tab list. */
|
|
376
|
+
label: string;
|
|
377
|
+
value?: string;
|
|
378
|
+
defaultValue?: string;
|
|
379
|
+
onChange?: (id: string) => void;
|
|
380
|
+
className?: string;
|
|
381
|
+
}
|
|
382
|
+
export declare const Tabs: React.ForwardRefExoticComponent<TabsProps & React.RefAttributes<HTMLDivElement>>;
|
|
383
|
+
export interface NavItem { id: string; label: string; icon?: IconName; count?: number; href?: string; }
|
|
384
|
+
export interface SideNavProps {
|
|
385
|
+
sections?: Array<{ title?: string; items: NavItem[] }>;
|
|
386
|
+
items?: NavItem[];
|
|
387
|
+
value?: string;
|
|
388
|
+
defaultValue?: string;
|
|
389
|
+
onChange?: (id: string) => void;
|
|
390
|
+
header?: React.ReactNode;
|
|
391
|
+
footer?: React.ReactNode;
|
|
392
|
+
/** Default "Main". */
|
|
393
|
+
label?: string;
|
|
394
|
+
className?: string;
|
|
395
|
+
}
|
|
396
|
+
export declare const SideNav: React.ForwardRefExoticComponent<SideNavProps & React.RefAttributes<HTMLElement>>;
|
|
397
|
+
export interface BreadcrumbProps {
|
|
398
|
+
/** Root first; the last item is the current page. */
|
|
399
|
+
items: Array<{ label: string; href?: string; onClick?: () => void }>;
|
|
400
|
+
label?: string;
|
|
401
|
+
className?: string;
|
|
402
|
+
}
|
|
403
|
+
export declare const Breadcrumb: React.ForwardRefExoticComponent<BreadcrumbProps & React.RefAttributes<HTMLElement>>;
|
|
404
|
+
export interface AvatarProps {
|
|
405
|
+
/** Accessible name; also gives the initials and a stable colour. */
|
|
406
|
+
name: string;
|
|
407
|
+
src?: string;
|
|
408
|
+
/** `sm` 24 · `md` 32 (default) · `lg` 40. */
|
|
409
|
+
size?: 'sm' | 'md' | 'lg';
|
|
410
|
+
status?: 'online';
|
|
411
|
+
className?: string;
|
|
412
|
+
}
|
|
413
|
+
export declare const Avatar: React.ForwardRefExoticComponent<AvatarProps & React.RefAttributes<HTMLSpanElement>>;
|
|
414
|
+
|
|
415
|
+
/* ---------- 4.2: menus, pickers, drawers, layout ---------- */
|
|
416
|
+
|
|
417
|
+
export interface DropdownMenuProps {
|
|
418
|
+
/** One element — usually a Button or IconButton. It gets aria-haspopup, aria-expanded and the click handler. */
|
|
419
|
+
trigger: React.ReactElement;
|
|
420
|
+
items: MenuItem[];
|
|
421
|
+
/** Accessible name for the menu. */
|
|
422
|
+
label?: string;
|
|
423
|
+
}
|
|
424
|
+
/** A trigger that opens a Menu. ArrowDown / ArrowUp on the trigger also opens it. */
|
|
425
|
+
export declare const DropdownMenu: React.ForwardRefExoticComponent<DropdownMenuProps & React.RefAttributes<HTMLSpanElement>>;
|
|
426
|
+
|
|
427
|
+
export interface ComboboxOption {
|
|
428
|
+
value: string;
|
|
429
|
+
label: string;
|
|
430
|
+
/** Second line in the list; also searched. */
|
|
431
|
+
description?: string;
|
|
432
|
+
/** Extra search terms (English name, phone, code…). */
|
|
433
|
+
keywords?: string[];
|
|
434
|
+
disabled?: boolean;
|
|
435
|
+
}
|
|
436
|
+
export interface ComboboxProps extends FieldProps {
|
|
437
|
+
options: Array<ComboboxOption | string>;
|
|
438
|
+
/** Selected option value (controlled). */
|
|
439
|
+
value?: string | null;
|
|
440
|
+
defaultValue?: string | null;
|
|
441
|
+
onChange?: (value: string | null) => void;
|
|
442
|
+
id?: string;
|
|
443
|
+
name?: string;
|
|
444
|
+
placeholder?: string;
|
|
445
|
+
disabled?: boolean;
|
|
446
|
+
readOnly?: boolean;
|
|
447
|
+
/** Leading icon. Default `search`. */
|
|
448
|
+
icon?: IconName;
|
|
449
|
+
/** Clear button while a value is selected (Escape clears too). Default true. */
|
|
450
|
+
clearable?: boolean;
|
|
451
|
+
/** Server-side search: called with the typed text; the component stops filtering and shows `options` as given. */
|
|
452
|
+
onSearch?: (query: string) => void;
|
|
453
|
+
loading?: boolean;
|
|
454
|
+
loadingText?: string;
|
|
455
|
+
emptyText?: string;
|
|
456
|
+
/** Max options rendered. Default 200 — narrow with typing beyond that. */
|
|
457
|
+
limit?: number;
|
|
458
|
+
/** Replace the Thai-aware default filter (label, description, keywords). */
|
|
459
|
+
filter?: (option: ComboboxOption, query: string) => boolean;
|
|
460
|
+
className?: string;
|
|
461
|
+
}
|
|
462
|
+
/** Text field that filters a list as you type (ARIA 1.2 combobox). One value. */
|
|
463
|
+
export declare const Combobox: React.ForwardRefExoticComponent<ComboboxProps & React.RefAttributes<HTMLInputElement>>;
|
|
464
|
+
export declare function comboboxFilter(option: ComboboxOption, query: string): boolean;
|
|
465
|
+
|
|
466
|
+
/** ISO date string, `YYYY-MM-DD` (Gregorian — the era is display only). */
|
|
467
|
+
export type ISODate = string;
|
|
468
|
+
export interface DateDisplayOptions {
|
|
469
|
+
/** `th` (default) or `en`. */
|
|
470
|
+
locale?: 'th' | 'en';
|
|
471
|
+
/** `buddhist` (default, พ.ศ.) or `gregory` (ค.ศ.). */
|
|
472
|
+
calendar?: 'buddhist' | 'gregory';
|
|
473
|
+
}
|
|
474
|
+
export interface CalendarProps extends DateDisplayOptions {
|
|
475
|
+
start?: ISODate | null;
|
|
476
|
+
end?: ISODate | null;
|
|
477
|
+
focus?: ISODate | null;
|
|
478
|
+
range?: boolean;
|
|
479
|
+
min?: ISODate;
|
|
480
|
+
max?: ISODate;
|
|
481
|
+
isDateDisabled?: (iso: ISODate) => boolean;
|
|
482
|
+
/** 0 = Sunday (Thai default), 1 = Monday. */
|
|
483
|
+
weekStartsOn?: 0 | 1;
|
|
484
|
+
onSelect?: (iso: ISODate | null) => void;
|
|
485
|
+
/** Adds a Clear link to the footer. */
|
|
486
|
+
onClear?: () => void;
|
|
487
|
+
/** false hides the Today / Clear footer. */
|
|
488
|
+
footer?: boolean;
|
|
489
|
+
/** Default true: focuses the selected (or today's) day on mount. */
|
|
490
|
+
autoFocus?: boolean;
|
|
491
|
+
}
|
|
492
|
+
export declare const Calendar: React.ForwardRefExoticComponent<CalendarProps & React.RefAttributes<HTMLDivElement>>;
|
|
493
|
+
interface DateFieldProps extends FieldProps, DateDisplayOptions {
|
|
494
|
+
id?: string;
|
|
495
|
+
name?: string;
|
|
496
|
+
placeholder?: string;
|
|
497
|
+
disabled?: boolean;
|
|
498
|
+
/** Clear button while there is a value. Default true. */
|
|
499
|
+
clearable?: boolean;
|
|
500
|
+
min?: ISODate;
|
|
501
|
+
max?: ISODate;
|
|
502
|
+
isDateDisabled?: (iso: ISODate) => boolean;
|
|
503
|
+
weekStartsOn?: 0 | 1;
|
|
504
|
+
className?: string;
|
|
505
|
+
}
|
|
506
|
+
export interface DatePickerProps extends DateFieldProps {
|
|
507
|
+
value?: ISODate | null;
|
|
508
|
+
defaultValue?: ISODate | null;
|
|
509
|
+
onChange?: (value: ISODate | null) => void;
|
|
510
|
+
}
|
|
511
|
+
/** Typed date field + calendar popover. Shows Buddhist-era dates (18 ก.ย. 2569); accepts dd/mm/yyyy in พ.ศ. or ค.ศ. and yyyy-mm-dd. */
|
|
512
|
+
export declare const DatePicker: React.ForwardRefExoticComponent<DatePickerProps & React.RefAttributes<HTMLInputElement>>;
|
|
513
|
+
export interface DateRange { start: ISODate | null; end: ISODate | null; }
|
|
514
|
+
export interface DateRangePickerProps extends DateFieldProps {
|
|
515
|
+
value?: DateRange;
|
|
516
|
+
defaultValue?: DateRange;
|
|
517
|
+
onChange?: (value: DateRange) => void;
|
|
518
|
+
}
|
|
519
|
+
export declare const DateRangePicker: React.ForwardRefExoticComponent<DateRangePickerProps & React.RefAttributes<HTMLInputElement>>;
|
|
520
|
+
/** `formatDate('2026-09-18')` → `18 ก.ย. 2569`. format `long` → `18 กันยายน 2569`, `numeric` → `18/09/2569`. */
|
|
521
|
+
export declare function formatDate(iso: ISODate | null | undefined, opts?: DateDisplayOptions & { format?: 'short' | 'long' | 'numeric' | Intl.DateTimeFormatOptions }): string;
|
|
522
|
+
/** Parses dd/mm/yyyy (years ≥ 2400 are read as พ.ศ.) or yyyy-mm-dd. Returns ISO or null. */
|
|
523
|
+
export declare function parseDate(text: string): ISODate | null;
|
|
524
|
+
|
|
525
|
+
export interface DrawerProps {
|
|
526
|
+
open: boolean;
|
|
527
|
+
onClose: () => void;
|
|
528
|
+
/** Default `right`. */
|
|
529
|
+
side?: 'right' | 'left';
|
|
530
|
+
/** sm 360 · md 480 (default) · lg 640 · nav = SideNav width. Full width below 640px. */
|
|
531
|
+
size?: 'sm' | 'md' | 'lg' | 'nav';
|
|
532
|
+
title?: string;
|
|
533
|
+
description?: React.ReactNode;
|
|
534
|
+
children?: React.ReactNode;
|
|
535
|
+
/** Buttons, right-aligned; stacked on phones. */
|
|
536
|
+
footer?: React.ReactNode;
|
|
537
|
+
/** Scrim click and Escape close it. Default true. */
|
|
538
|
+
dismissible?: boolean;
|
|
539
|
+
/** Default true: focus moves to the element with `data-autofocus`, else the first control in the body. False only for static demos. */
|
|
540
|
+
autoFocus?: boolean;
|
|
541
|
+
/** Needed when there is no title. */
|
|
542
|
+
'aria-label'?: string;
|
|
543
|
+
className?: string;
|
|
544
|
+
}
|
|
545
|
+
/** Side panel over the page: record detail, filters, mobile navigation. Modal (focus trap, scroll lock, focus restore). */
|
|
546
|
+
export declare const Drawer: React.ForwardRefExoticComponent<DrawerProps & React.RefAttributes<HTMLDivElement>>;
|
|
547
|
+
|
|
548
|
+
export type Breakpoint = 'base' | 'sm' | 'md' | 'lg' | 'xl';
|
|
549
|
+
export type Responsive<T> = T | Partial<Record<Breakpoint, T>>;
|
|
550
|
+
/** Min-width breakpoints in px, mirroring the aura-bp-* tokens. */
|
|
551
|
+
export declare const breakpoints: { sm: 640; md: 768; lg: 1024; xl: 1280 };
|
|
552
|
+
/** The widest breakpoint the window meets. `lg` during server render and hydration. */
|
|
553
|
+
export declare function useBreakpoint(): Breakpoint;
|
|
554
|
+
export declare function useResponsive<T>(value: Responsive<T>): T | undefined;
|
|
555
|
+
/** Spacing step (aura-space-N) or any CSS length. */
|
|
556
|
+
export type Space = 0 | 1 | 2 | 3 | 4 | 5 | 6 | 8 | 10 | 12 | 16 | string;
|
|
557
|
+
export interface StackProps {
|
|
558
|
+
direction?: Responsive<'row' | 'column'>;
|
|
559
|
+
gap?: Responsive<Space>;
|
|
560
|
+
/** Cross-axis alignment; responsive like direction ({ base: 'stretch', sm: 'flex-end' }). */
|
|
561
|
+
align?: Responsive<React.CSSProperties['alignItems']>;
|
|
562
|
+
justify?: React.CSSProperties['justifyContent'];
|
|
563
|
+
wrap?: boolean;
|
|
564
|
+
as?: keyof JSX.IntrinsicElements;
|
|
565
|
+
className?: string;
|
|
566
|
+
style?: React.CSSProperties;
|
|
567
|
+
children?: React.ReactNode;
|
|
568
|
+
}
|
|
569
|
+
export declare const Stack: React.ForwardRefExoticComponent<StackProps & React.RefAttributes<HTMLElement>>;
|
|
570
|
+
export interface GridProps {
|
|
571
|
+
columns?: Responsive<number>;
|
|
572
|
+
/** Fit as many columns as there is room for, each at least this wide (px). Overrides columns. */
|
|
573
|
+
minItemWidth?: number;
|
|
574
|
+
gap?: Responsive<Space>;
|
|
575
|
+
as?: keyof JSX.IntrinsicElements;
|
|
576
|
+
className?: string;
|
|
577
|
+
style?: React.CSSProperties;
|
|
578
|
+
children?: React.ReactNode;
|
|
579
|
+
}
|
|
580
|
+
export declare const Grid: React.ForwardRefExoticComponent<GridProps & React.RefAttributes<HTMLElement>>;
|
|
581
|
+
export declare const Container: React.ForwardRefExoticComponent<{ size?: 'default' | 'narrow'; as?: keyof JSX.IntrinsicElements; className?: string; style?: React.CSSProperties; children?: React.ReactNode } & React.RefAttributes<HTMLElement>>;
|
|
582
|
+
export interface AppShellProps {
|
|
583
|
+
/** Usually a SideNav. Fixed from 1024px up; in a Drawer behind a menu button below. */
|
|
584
|
+
nav?: React.ReactElement;
|
|
585
|
+
/** Top bar content (title, search, account menu). */
|
|
586
|
+
header?: React.ReactNode;
|
|
587
|
+
children?: React.ReactNode;
|
|
588
|
+
navLabel?: string;
|
|
589
|
+
menuLabel?: string;
|
|
590
|
+
/** id of <main>, for a skip link. Default `main`. */
|
|
591
|
+
mainId?: string;
|
|
592
|
+
className?: string;
|
|
593
|
+
}
|
|
594
|
+
export declare const AppShell: React.ForwardRefExoticComponent<AppShellProps & React.RefAttributes<HTMLDivElement>>;
|
|
595
|
+
|
|
596
|
+
/* ---------- 4.3: Stat, TimePicker, FileUpload ---------- */
|
|
597
|
+
|
|
598
|
+
export interface StatChange {
|
|
599
|
+
/** Shown as written, e.g. "+12%" or "−3". */
|
|
600
|
+
value: React.ReactNode;
|
|
601
|
+
direction?: 'up' | 'down' | 'flat';
|
|
602
|
+
/** Default: up = positive, down = negative. Set it when a rise is bad (cancellations, wait time). */
|
|
603
|
+
tone?: 'positive' | 'negative' | 'neutral';
|
|
604
|
+
/** e.g. "vs last month". */
|
|
605
|
+
label?: React.ReactNode;
|
|
606
|
+
}
|
|
607
|
+
export interface StatProps {
|
|
608
|
+
label: React.ReactNode;
|
|
609
|
+
value?: React.ReactNode;
|
|
610
|
+
/** Small unit after the value ("งาน", "คน", "%"). */
|
|
611
|
+
unit?: React.ReactNode;
|
|
612
|
+
change?: StatChange;
|
|
613
|
+
caption?: React.ReactNode;
|
|
614
|
+
icon?: IconName;
|
|
615
|
+
/** Skeleton in place of the value. */
|
|
616
|
+
loading?: boolean;
|
|
617
|
+
/** Makes the whole card a link or a button (drill-down). */
|
|
618
|
+
href?: string;
|
|
619
|
+
onClick?: () => void;
|
|
620
|
+
className?: string;
|
|
621
|
+
}
|
|
622
|
+
/** One number on a card: label, value, change and caption. Put several in a Grid. */
|
|
623
|
+
export declare const Stat: React.ForwardRefExoticComponent<StatProps & React.RefAttributes<HTMLElement>>;
|
|
624
|
+
|
|
625
|
+
export interface TimePickerProps extends FieldProps {
|
|
626
|
+
/** "HH:mm", 24-hour. */
|
|
627
|
+
value?: string | null;
|
|
628
|
+
defaultValue?: string | null;
|
|
629
|
+
onChange?: (value: string | null) => void;
|
|
630
|
+
/** Minutes between listed slots. Default 30. */
|
|
631
|
+
step?: number;
|
|
632
|
+
/** Earliest and latest allowed times, "HH:mm". Typed times outside them are refused with a message. */
|
|
633
|
+
min?: string;
|
|
634
|
+
max?: string;
|
|
635
|
+
isTimeDisabled?: (time: string) => boolean;
|
|
636
|
+
/** Slot to scroll to when empty (e.g. "09:00"). Default: min. */
|
|
637
|
+
suggest?: string;
|
|
638
|
+
/** Clear button while there is a value. Default true. */
|
|
639
|
+
clearable?: boolean;
|
|
640
|
+
id?: string;
|
|
641
|
+
name?: string;
|
|
642
|
+
placeholder?: string;
|
|
643
|
+
disabled?: boolean;
|
|
644
|
+
readOnly?: boolean;
|
|
645
|
+
className?: string;
|
|
646
|
+
}
|
|
647
|
+
/** Time field with a list of slots. Accepts typed 9 · 930 · 9:30 · 9.30 · 09.30 น. · 9:30 pm. */
|
|
648
|
+
export declare const TimePicker: React.ForwardRefExoticComponent<TimePickerProps & React.RefAttributes<HTMLInputElement>>;
|
|
649
|
+
export declare function parseTime(text: string): string | null;
|
|
650
|
+
|
|
651
|
+
export interface UploadItem {
|
|
652
|
+
id: string;
|
|
653
|
+
/** The browser File (absent for files already on the server). */
|
|
654
|
+
file?: File;
|
|
655
|
+
name: string;
|
|
656
|
+
size?: number;
|
|
657
|
+
type?: string;
|
|
658
|
+
/** ready = picked, not sent yet. Set uploading/done yourself while sending. */
|
|
659
|
+
status: 'ready' | 'uploading' | 'done' | 'error';
|
|
660
|
+
/** 0–100 while uploading. */
|
|
661
|
+
progress?: number;
|
|
662
|
+
error?: string;
|
|
663
|
+
/** For files already stored (edit forms). */
|
|
664
|
+
url?: string;
|
|
665
|
+
}
|
|
666
|
+
export interface FileUploadProps extends FieldProps {
|
|
667
|
+
value?: UploadItem[];
|
|
668
|
+
defaultValue?: UploadItem[];
|
|
669
|
+
onChange?: (items: UploadItem[]) => void;
|
|
670
|
+
onRemove?: (item: UploadItem) => void;
|
|
671
|
+
/** Same syntax as <input accept>: "image/*,.pdf". Checked on drop too. */
|
|
672
|
+
accept?: string;
|
|
673
|
+
multiple?: boolean;
|
|
674
|
+
/** Bytes per file. */
|
|
675
|
+
maxSize?: number;
|
|
676
|
+
/** With multiple. */
|
|
677
|
+
maxFiles?: number;
|
|
678
|
+
id?: string;
|
|
679
|
+
name?: string;
|
|
680
|
+
disabled?: boolean;
|
|
681
|
+
className?: string;
|
|
682
|
+
}
|
|
683
|
+
/** Drop zone + real file input. Checks type, size and count; lists files with image thumbnails, progress and errors. Uploading is the app's job. */
|
|
684
|
+
export declare const FileUpload: React.ForwardRefExoticComponent<FileUploadProps & React.RefAttributes<HTMLInputElement>>;
|
|
685
|
+
/** 1536 → "1.5 KB". */
|
|
686
|
+
export declare function formatBytes(bytes: number): string;
|
|
687
|
+
|
|
688
|
+
/* ---------- 4.4: general-purpose components, theming ---------- */
|
|
689
|
+
export type Tone = 'neutral' | 'accent' | 'success' | 'warning' | 'danger';
|
|
690
|
+
export interface BadgeProps extends React.HTMLAttributes<HTMLSpanElement> {
|
|
691
|
+
tone?: Tone;
|
|
692
|
+
/** soft (default) · solid · outline */
|
|
693
|
+
variant?: 'soft' | 'solid' | 'outline';
|
|
694
|
+
icon?: IconName;
|
|
695
|
+
}
|
|
696
|
+
/** A static label or count ("Paid", "3", "Beta"). Not interactive — use Tag for chips people click. */
|
|
697
|
+
export declare const Badge: React.ForwardRefExoticComponent<BadgeProps & React.RefAttributes<HTMLSpanElement>>;
|
|
698
|
+
export interface TagProps extends Omit<React.HTMLAttributes<HTMLElement>, 'onClick'> {
|
|
699
|
+
children: React.ReactNode;
|
|
700
|
+
icon?: IconName;
|
|
701
|
+
/** Adds a remove button (applied filters, chosen people). */
|
|
702
|
+
onRemove?: () => void;
|
|
703
|
+
removeLabel?: string;
|
|
704
|
+
/** Makes it a toggle chip (filter chips): renders a button with aria-pressed. */
|
|
705
|
+
selected?: boolean;
|
|
706
|
+
onClick?: (e: React.MouseEvent<HTMLButtonElement>) => void;
|
|
707
|
+
disabled?: boolean;
|
|
708
|
+
}
|
|
709
|
+
export declare const Tag: React.ForwardRefExoticComponent<TagProps & React.RefAttributes<HTMLElement>>;
|
|
710
|
+
export interface ProgressProps {
|
|
711
|
+
/** Omit for indeterminate. */
|
|
712
|
+
value?: number;
|
|
713
|
+
max?: number;
|
|
714
|
+
label?: React.ReactNode;
|
|
715
|
+
'aria-label'?: string;
|
|
716
|
+
showValue?: boolean;
|
|
717
|
+
/** Replaces the % text, e.g. "3 of 5 files". Also read out as aria-valuetext. */
|
|
718
|
+
valueLabel?: React.ReactNode;
|
|
719
|
+
hint?: React.ReactNode;
|
|
720
|
+
tone?: Tone;
|
|
721
|
+
size?: 'sm' | 'md';
|
|
722
|
+
id?: string;
|
|
723
|
+
className?: string;
|
|
724
|
+
}
|
|
725
|
+
export declare const Progress: React.ForwardRefExoticComponent<ProgressProps & React.RefAttributes<HTMLDivElement>>;
|
|
726
|
+
export interface SkeletonProps {
|
|
727
|
+
variant?: 'text' | 'rect' | 'circle';
|
|
728
|
+
/** text only: number of lines (the last is shorter). */
|
|
729
|
+
lines?: number;
|
|
730
|
+
width?: number | string;
|
|
731
|
+
height?: number | string;
|
|
732
|
+
/** circle diameter. */
|
|
733
|
+
size?: number;
|
|
734
|
+
className?: string;
|
|
735
|
+
}
|
|
736
|
+
export declare const Skeleton: React.ForwardRefExoticComponent<SkeletonProps & React.RefAttributes<HTMLSpanElement>>;
|
|
737
|
+
export interface EmptyStateProps {
|
|
738
|
+
title: React.ReactNode;
|
|
739
|
+
description?: React.ReactNode;
|
|
740
|
+
icon?: IconName;
|
|
741
|
+
/** One or two buttons. */
|
|
742
|
+
action?: React.ReactNode;
|
|
743
|
+
size?: 'sm' | 'md';
|
|
744
|
+
bordered?: boolean;
|
|
745
|
+
headingLevel?: 2 | 3 | 4 | 5 | 6;
|
|
746
|
+
className?: string;
|
|
747
|
+
}
|
|
748
|
+
export declare const EmptyState: React.ForwardRefExoticComponent<EmptyStateProps & React.RefAttributes<HTMLDivElement>>;
|
|
749
|
+
export interface PaginationProps {
|
|
750
|
+
pageCount: number;
|
|
751
|
+
/** 1-based, controlled; pair with onChange. Or defaultPage. */
|
|
752
|
+
page?: number;
|
|
753
|
+
defaultPage?: number;
|
|
754
|
+
onChange?: (page: number) => void;
|
|
755
|
+
/** Pages shown each side of the current one. Default 1. */
|
|
756
|
+
siblingCount?: number;
|
|
757
|
+
/** Render real links (SEO, open in new tab); onChange still runs for client routing. */
|
|
758
|
+
getHref?: (page: number) => string;
|
|
759
|
+
label?: string;
|
|
760
|
+
className?: string;
|
|
761
|
+
}
|
|
762
|
+
/** Page links for lists and search results. Below 640px it collapses to "Page 3 of 10" with prev/next. */
|
|
763
|
+
export declare const Pagination: React.ForwardRefExoticComponent<PaginationProps & React.RefAttributes<HTMLElement>>;
|
|
764
|
+
export interface AccordionItem { id: string; title: React.ReactNode; description?: React.ReactNode; content: React.ReactNode; icon?: IconName; disabled?: boolean; }
|
|
765
|
+
export interface AccordionProps {
|
|
766
|
+
items: AccordionItem[];
|
|
767
|
+
/** single (default): one open at a time. multiple: any number. */
|
|
768
|
+
type?: 'single' | 'multiple';
|
|
769
|
+
value?: string | null | string[];
|
|
770
|
+
defaultValue?: string | null | string[];
|
|
771
|
+
onChange?: (value: any) => void;
|
|
772
|
+
/** single only: false keeps one section always open. Default true. */
|
|
773
|
+
collapsible?: boolean;
|
|
774
|
+
headingLevel?: 2 | 3 | 4 | 5 | 6;
|
|
775
|
+
id?: string;
|
|
776
|
+
className?: string;
|
|
777
|
+
}
|
|
778
|
+
export declare const Accordion: React.ForwardRefExoticComponent<AccordionProps & React.RefAttributes<HTMLDivElement>>;
|
|
779
|
+
export interface PopoverProps {
|
|
780
|
+
/** One element; it gets aria-haspopup, aria-expanded and the click toggle. */
|
|
781
|
+
trigger: React.ReactElement;
|
|
782
|
+
children: React.ReactNode | ((api: { close: () => void }) => React.ReactNode);
|
|
783
|
+
title?: React.ReactNode;
|
|
784
|
+
/** Accessible name when there is no title. */
|
|
785
|
+
label?: string;
|
|
786
|
+
open?: boolean;
|
|
787
|
+
defaultOpen?: boolean;
|
|
788
|
+
onOpenChange?: (open: boolean) => void;
|
|
789
|
+
placement?: 'bottom-start' | 'bottom-end' | 'bottom-center' | 'top-start' | 'top-end' | 'top-center';
|
|
790
|
+
width?: number | string;
|
|
791
|
+
/** Default true: focus moves to [data-autofocus] or the first control inside. */
|
|
792
|
+
autoFocus?: boolean;
|
|
793
|
+
id?: string;
|
|
794
|
+
className?: string;
|
|
795
|
+
}
|
|
796
|
+
/** A small non-modal panel anchored to a trigger (filters, quick settings, help). Escape and outside click close it; focus returns to the trigger. */
|
|
797
|
+
export declare const Popover: React.ForwardRefExoticComponent<PopoverProps & React.RefAttributes<HTMLDivElement>>;
|
|
798
|
+
|
|
799
|
+
export interface ThemeOptions {
|
|
800
|
+
/** The project's brand colour, #rgb or #rrggbb. Replaces AURA violet (links, focus ring, selection, info, progress, creative shadow in dark, mesh). */
|
|
801
|
+
brand: string;
|
|
802
|
+
/** Optional signal colour; replaces AURA lime in the accent dot and mesh only (success/ready stay green). */
|
|
803
|
+
signal?: string;
|
|
804
|
+
/** ink (default): primary buttons stay zinc ink. brand: primary buttons use the brand colour. */
|
|
805
|
+
primary?: 'ink' | 'brand';
|
|
806
|
+
name?: string;
|
|
807
|
+
}
|
|
808
|
+
export interface ThemeCheck { theme: 'light' | 'dark'; pair: string; ratio: number; target: number; pass: boolean; }
|
|
809
|
+
export interface Theme {
|
|
810
|
+
name: string | null;
|
|
811
|
+
brand: Record<50 | 100 | 200 | 300 | 400 | 500 | 600 | 700 | 800 | 900, string>;
|
|
812
|
+
signal: Record<50 | 100 | 200 | 300 | 400 | 500 | 600 | 700 | 800 | 900, string> | null;
|
|
813
|
+
light: Record<string, string>;
|
|
814
|
+
dark: Record<string, string>;
|
|
815
|
+
checks: ThemeCheck[];
|
|
816
|
+
ok: boolean;
|
|
817
|
+
/** CSS overriding the tokens. No selector: the whole page. A selector (".tenant-acme") scopes it. Load after aura.css. */
|
|
818
|
+
css(selector?: string): string;
|
|
819
|
+
}
|
|
820
|
+
/** Builds a brand layer over AURA tokens and adjusts any colour that misses WCAG AA. Also: `npx aura-theme --brand "#0ea5e9"`. */
|
|
821
|
+
export declare function createTheme(options: ThemeOptions): Theme;
|
|
822
|
+
export declare function contrast(a: string, b: string): number;
|
|
823
|
+
export declare function brandScale(hex: string): Theme['brand'];
|
|
824
|
+
/** Renders a theme as a <style> element (server-safe). */
|
|
825
|
+
export declare function ThemeStyle(props: ThemeOptions & { selector?: string }): React.ReactElement;
|