@jirawatpyk/aura-react 4.9.0 → 4.11.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +17 -2
- package/dist/aura.bundle.js +910 -463
- package/dist/cjs/index.cjs +910 -463
- package/dist/esm/Breadcrumb.js +3 -2
- package/dist/esm/Button.js +26 -7
- package/dist/esm/DataTable.js +176 -94
- package/dist/esm/DatePicker.js +88 -24
- package/dist/esm/Icon.js +12 -1
- package/dist/esm/IconButton.js +2 -2
- package/dist/esm/Pagination.js +3 -2
- package/dist/esm/SideNav.js +116 -10
- package/dist/esm/Stat.js +7 -3
- package/dist/esm/Switch.js +27 -15
- package/dist/esm/colorScheme.js +8 -1
- package/dist/esm/locale.js +109 -2
- package/dist/esm/theme.js +38 -2
- package/dist/index.d.ts +76 -34
- package/dist/styles.css +71 -5
- package/package.json +1 -1
package/dist/esm/locale.js
CHANGED
|
@@ -3,6 +3,9 @@ import * as React from "react";
|
|
|
3
3
|
const n = function(x) {
|
|
4
4
|
return Number(x).toLocaleString("en");
|
|
5
5
|
};
|
|
6
|
+
const nsv = function(x) {
|
|
7
|
+
return Number(x).toLocaleString("sv-SE");
|
|
8
|
+
};
|
|
6
9
|
const STRINGS = {
|
|
7
10
|
en: {
|
|
8
11
|
close: "Close",
|
|
@@ -199,6 +202,104 @@ const STRINGS = {
|
|
|
199
202
|
accepts: function(list, max) {
|
|
200
203
|
return [list, max && "\u0E44\u0E21\u0E48\u0E40\u0E01\u0E34\u0E19 " + max + " \u0E15\u0E48\u0E2D\u0E44\u0E1F\u0E25\u0E4C"].filter(Boolean).join(" \xB7 ");
|
|
201
204
|
}
|
|
205
|
+
},
|
|
206
|
+
sv: {
|
|
207
|
+
close: "St\xE4ng",
|
|
208
|
+
dismiss: "St\xE4ng",
|
|
209
|
+
dismissToast: "St\xE4ng aviseringen",
|
|
210
|
+
notifications: "Aviseringar",
|
|
211
|
+
mainNav: "Huvudmeny",
|
|
212
|
+
breadcrumb: "Br\xF6dsmulor",
|
|
213
|
+
navigation: "Navigering",
|
|
214
|
+
openNav: "\xD6ppna menyn",
|
|
215
|
+
searching: "S\xF6ker\u2026",
|
|
216
|
+
noMatches: "Inga tr\xE4ffar",
|
|
217
|
+
clear: function(what) {
|
|
218
|
+
return "Rensa " + (what || "urvalet");
|
|
219
|
+
},
|
|
220
|
+
keepTyping: function(total) {
|
|
221
|
+
return "Skriv mer f\xF6r att begr\xE4nsa " + nsv(total) + " alternativ";
|
|
222
|
+
},
|
|
223
|
+
sortAsc: "Sortera stigande",
|
|
224
|
+
sortDesc: "Sortera fallande",
|
|
225
|
+
pin: "F\xE4st till v\xE4nster",
|
|
226
|
+
unpin: "Lossa kolumnen",
|
|
227
|
+
moveLeft: "Flytta v\xE4nster",
|
|
228
|
+
moveRight: "Flytta h\xF6ger",
|
|
229
|
+
hideColumn: "D\xF6lj kolumnen",
|
|
230
|
+
resetColumns: "\xC5terst\xE4ll kolumner",
|
|
231
|
+
selectRows: "V\xE4lj rader",
|
|
232
|
+
selectAllRows: "V\xE4lj alla rader",
|
|
233
|
+
deselectAllRows: "Avmarkera alla rader",
|
|
234
|
+
selectAll: "V\xE4lj alla",
|
|
235
|
+
selectRow: function(k) {
|
|
236
|
+
return "V\xE4lj " + k;
|
|
237
|
+
},
|
|
238
|
+
selectedCount: function(c) {
|
|
239
|
+
return nsv(c) + " valda";
|
|
240
|
+
},
|
|
241
|
+
pinned: "F\xE4st",
|
|
242
|
+
columnOptions: function(label) {
|
|
243
|
+
return "Alternativ f\xF6r kolumnen " + label;
|
|
244
|
+
},
|
|
245
|
+
column: function(label) {
|
|
246
|
+
return label ? "Kolumnen " + label : "Kolumn";
|
|
247
|
+
},
|
|
248
|
+
columns: "Kolumner",
|
|
249
|
+
showHideColumns: "Visa eller d\xF6lj kolumner",
|
|
250
|
+
empty: "Inget h\xE4r \xE4nnu",
|
|
251
|
+
loading: "Laddar\u2026",
|
|
252
|
+
loadingRows: "Laddar rader",
|
|
253
|
+
range: function(a, b, total) {
|
|
254
|
+
return a + "\u2013" + b + " av " + nsv(total);
|
|
255
|
+
},
|
|
256
|
+
page: function(p, total) {
|
|
257
|
+
return "Sida " + p + " av " + total;
|
|
258
|
+
},
|
|
259
|
+
prevPage: "F\xF6reg\xE5ende sida",
|
|
260
|
+
nextPage: "N\xE4sta sida",
|
|
261
|
+
rowCount: function(c) {
|
|
262
|
+
return nsv(c) + " rader";
|
|
263
|
+
},
|
|
264
|
+
actions: "\xC5tg\xE4rder",
|
|
265
|
+
optional: "valfritt",
|
|
266
|
+
timePlaceholder: "tt:mm",
|
|
267
|
+
timeInvalid: "Skriv en tid som 09:30",
|
|
268
|
+
timeOutOfRange: function(a, b) {
|
|
269
|
+
return "V\xE4lj en tid mellan " + a + " och " + b;
|
|
270
|
+
},
|
|
271
|
+
dropFiles: "Dra filer hit eller",
|
|
272
|
+
browse: "V\xE4lj filer",
|
|
273
|
+
browseOne: "V\xE4lj en fil",
|
|
274
|
+
remove: function(n2) {
|
|
275
|
+
return "Ta bort " + n2;
|
|
276
|
+
},
|
|
277
|
+
fileTooBig: function(max) {
|
|
278
|
+
return "St\xF6rre \xE4n " + max;
|
|
279
|
+
},
|
|
280
|
+
fileWrongType: "Den h\xE4r filtypen godtas inte",
|
|
281
|
+
tooManyFiles: function(n2) {
|
|
282
|
+
return "H\xF6gst " + n2 + " filer";
|
|
283
|
+
},
|
|
284
|
+
colorScheme: "F\xE4rgl\xE4ge",
|
|
285
|
+
increase: "\xD6ka",
|
|
286
|
+
decrease: "Minska",
|
|
287
|
+
stepDone: "klart",
|
|
288
|
+
stepOf: function(i, total) {
|
|
289
|
+
return "Steg " + i + " av " + total;
|
|
290
|
+
},
|
|
291
|
+
schemeLight: "Ljust",
|
|
292
|
+
schemeDark: "M\xF6rkt",
|
|
293
|
+
schemeSystem: "System",
|
|
294
|
+
uploading: "Laddar upp\u2026",
|
|
295
|
+
images: "Bilder",
|
|
296
|
+
pagination: "Sidnumrering",
|
|
297
|
+
pageN: function(p) {
|
|
298
|
+
return "Sida " + p;
|
|
299
|
+
},
|
|
300
|
+
accepts: function(list, max) {
|
|
301
|
+
return [list, max && "h\xF6gst " + max + " per fil"].filter(Boolean).join(", ");
|
|
302
|
+
}
|
|
202
303
|
}
|
|
203
304
|
};
|
|
204
305
|
const LocaleContext = React.createContext(null);
|
|
@@ -209,16 +310,21 @@ function AuraProvider(props) {
|
|
|
209
310
|
return {
|
|
210
311
|
locale: props.locale || "en",
|
|
211
312
|
calendar: props.calendar || null,
|
|
212
|
-
strings: props.strings ? Object.assign({}, base, props.strings) : base
|
|
313
|
+
strings: props.strings ? Object.assign({}, base, props.strings) : base,
|
|
314
|
+
linkComponent: props.linkComponent || null
|
|
213
315
|
};
|
|
214
316
|
},
|
|
215
|
-
[props.locale, props.calendar, props.strings]
|
|
317
|
+
[props.locale, props.calendar, props.strings, props.linkComponent]
|
|
216
318
|
);
|
|
217
319
|
return /* @__PURE__ */ React.createElement(LocaleContext.Provider, { value }, props.children);
|
|
218
320
|
}
|
|
219
321
|
function useAuraLocale() {
|
|
220
322
|
return React.useContext(LocaleContext) || { locale: null, calendar: null, strings: STRINGS.en };
|
|
221
323
|
}
|
|
324
|
+
function useLinkComponent(own) {
|
|
325
|
+
const ctx = React.useContext(LocaleContext);
|
|
326
|
+
return own || ctx && ctx.linkComponent || "a";
|
|
327
|
+
}
|
|
222
328
|
function useStrings() {
|
|
223
329
|
return useAuraLocale().strings;
|
|
224
330
|
}
|
|
@@ -226,5 +332,6 @@ export {
|
|
|
226
332
|
AuraProvider,
|
|
227
333
|
STRINGS,
|
|
228
334
|
useAuraLocale,
|
|
335
|
+
useLinkComponent,
|
|
229
336
|
useStrings
|
|
230
337
|
};
|
package/dist/esm/theme.js
CHANGED
|
@@ -105,6 +105,20 @@ function fit(hex, grounds, target, dir) {
|
|
|
105
105
|
}
|
|
106
106
|
return c;
|
|
107
107
|
}
|
|
108
|
+
function atLuminance(hex, Y) {
|
|
109
|
+
const o = rgbToOklch(hexToRgb(hex)), C = Math.max(o[1], 0.02);
|
|
110
|
+
let lo = 0, hi = 1, c = hex;
|
|
111
|
+
for (let i = 0; i < 30; i++) {
|
|
112
|
+
const mid = (lo + hi) / 2;
|
|
113
|
+
c = oklchToHex(mid, C, o[2]);
|
|
114
|
+
if (luminance(c) < Y) lo = mid;
|
|
115
|
+
else hi = mid;
|
|
116
|
+
}
|
|
117
|
+
return c;
|
|
118
|
+
}
|
|
119
|
+
const CHART_Y = { light: 0.075, dark: 0.46 };
|
|
120
|
+
const SEQ_Y = { light: [0.26, 0.165, 0.1, 0.055, 0.028], dark: [0.14, 0.22, 0.34, 0.5, 0.7] };
|
|
121
|
+
const CHART_2 = "#0a8b7a";
|
|
108
122
|
const ZINC = { 0: "#ffffff", 50: "#fafafa", 100: "#f4f4f5", 800: "#27272a", 900: "#18181b", 950: "#09090b" };
|
|
109
123
|
const INK = "#18181b";
|
|
110
124
|
function createTheme(opts) {
|
|
@@ -123,6 +137,14 @@ function createTheme(opts) {
|
|
|
123
137
|
L["alert-info-fg"] = fit(b[800], [b[50]], 4.5, -1);
|
|
124
138
|
L["alert-info-border"] = b[200];
|
|
125
139
|
L["mesh-from"] = b[400];
|
|
140
|
+
L["chart-1"] = atLuminance(o.brand, CHART_Y.light);
|
|
141
|
+
D["chart-1"] = atLuminance(o.brand, CHART_Y.dark);
|
|
142
|
+
SEQ_Y.light.forEach(function(y, i) {
|
|
143
|
+
L["chart-seq-" + (i + 1)] = atLuminance(o.brand, y);
|
|
144
|
+
});
|
|
145
|
+
SEQ_Y.dark.forEach(function(y, i) {
|
|
146
|
+
D["chart-seq-" + (i + 1)] = atLuminance(o.brand, y);
|
|
147
|
+
});
|
|
126
148
|
D["fg-accent"] = fit(b[300], darkGrounds, 4.5, 1);
|
|
127
149
|
D["accent-violet"] = fit(b[400], darkGrounds, 3, 1);
|
|
128
150
|
D["focus-ring"] = fit(b[400], darkGrounds, 3, 1);
|
|
@@ -130,8 +152,8 @@ function createTheme(opts) {
|
|
|
130
152
|
D["alert-info-bg"] = D["bg-selected"];
|
|
131
153
|
D["alert-info-fg"] = fit(b[300], [D["alert-info-bg"]], 4.5, 1);
|
|
132
154
|
D["alert-info-border"] = mix(ZINC[900], b[400], 0.4);
|
|
133
|
-
D["status-progress-bg"] = b[
|
|
134
|
-
D["status-progress-fg"] =
|
|
155
|
+
D["status-progress-bg"] = mix(ZINC[900], b[500], 0.2);
|
|
156
|
+
D["status-progress-fg"] = fit(b[300], [D["status-progress-bg"]], 4.5, 1);
|
|
135
157
|
if (s) {
|
|
136
158
|
L["accent-dot"] = s[200];
|
|
137
159
|
L["accent-lime"] = s[200];
|
|
@@ -182,9 +204,23 @@ function createTheme(opts) {
|
|
|
182
204
|
check("dark", "fg-accent", g[0], 4.5, D["fg-accent"], g[1]);
|
|
183
205
|
check("dark", "focus-ring", g[0], 3, D["focus-ring"], g[1]);
|
|
184
206
|
});
|
|
207
|
+
[
|
|
208
|
+
["light", ZINC[0], L],
|
|
209
|
+
["light", ZINC[50], L],
|
|
210
|
+
["dark", ZINC[900], D],
|
|
211
|
+
["dark", ZINC[950], D]
|
|
212
|
+
].forEach(function(g) {
|
|
213
|
+
const t = g[0], ground = g[1], m = g[2], name = ground === ZINC[0] || ground === ZINC[900] ? "bg-surface" : "bg-canvas";
|
|
214
|
+
["chart-1", "chart-seq-1", "chart-seq-5"].forEach(function(k) {
|
|
215
|
+
check(t, k, name, 3, m[k], ground);
|
|
216
|
+
});
|
|
217
|
+
});
|
|
218
|
+
check("light", "chart-1", "chart-2 (lightness step)", 1.8, L["chart-1"], CHART_2);
|
|
219
|
+
check("dark", "chart-1", "chart-2 (lightness step)", 1.8, D["chart-1"], CHART_2);
|
|
185
220
|
check("light", "fg-primary", "bg-selected", 4.5, INK, L["bg-selected"]);
|
|
186
221
|
check("dark", "fg-primary", "bg-selected", 4.5, "#ffffff", D["bg-selected"]);
|
|
187
222
|
check("light", "status-progress-fg", "status-progress-bg", 4.5, L["status-progress-fg"], L["status-progress-bg"]);
|
|
223
|
+
check("dark", "status-progress-fg", "status-progress-bg", 4.5, D["status-progress-fg"], D["status-progress-bg"]);
|
|
188
224
|
check("light", "alert-info-fg", "alert-info-bg", 4.5, L["alert-info-fg"], L["alert-info-bg"]);
|
|
189
225
|
check("dark", "alert-info-fg", "alert-info-bg", 4.5, D["alert-info-fg"], D["alert-info-bg"]);
|
|
190
226
|
if (o.primary === "brand") {
|
package/dist/index.d.ts
CHANGED
|
@@ -1,31 +1,37 @@
|
|
|
1
1
|
import * as React$1 from 'react';
|
|
2
2
|
|
|
3
|
+
/** Button look. */
|
|
4
|
+
export type ButtonVariant = "primary" | "secondary" | "creative" | "danger" | "danger-secondary";
|
|
3
5
|
/** AURA pill button. Enterprise (`primary`, `secondary`) for product UI; `creative` for marketing moments only. */
|
|
4
6
|
export interface ButtonProps extends React$1.ButtonHTMLAttributes<HTMLButtonElement> {
|
|
5
|
-
/** Visual variant. Default `primary`. */
|
|
6
|
-
variant?:
|
|
7
|
+
/** Visual variant. Default `primary`. `danger` (filled) and `danger-secondary` (outline) are for irreversible or destructive actions only — typically the confirm button of a `Dialog role="alertdialog"`. */
|
|
8
|
+
variant?: ButtonVariant;
|
|
7
9
|
/** Label text — short, Title Case English or Thai. */
|
|
8
10
|
children: React$1.ReactNode;
|
|
9
11
|
/** Leading icon name (see `IconName`). Hidden while loading. */
|
|
10
|
-
icon?:
|
|
12
|
+
icon?: IconInput;
|
|
11
13
|
/** Trailing icon name, e.g. `arrow-right` for forward actions. */
|
|
12
|
-
iconRight?:
|
|
14
|
+
iconRight?: IconInput;
|
|
13
15
|
/** Shows a spinner in place of the leading icon, sets aria-busy and swallows clicks. Keeps the label and width. */
|
|
14
16
|
loading?: boolean;
|
|
17
|
+
/** Fills its container and lets a long label wrap onto more lines (at least 44px tall) — phones, Thai and Swedish labels. */
|
|
18
|
+
fullWidth?: boolean;
|
|
15
19
|
}
|
|
16
20
|
/** A link that looks like a Button: give `Button` an `href` and it renders an `<a>` (navigation, not actions). */
|
|
17
21
|
export interface ButtonLinkProps extends Omit<React$1.AnchorHTMLAttributes<HTMLAnchorElement>, "children"> {
|
|
18
22
|
/** Where the link goes. With `href`, Button renders an `<a>` and its ref is the `<a>`. */
|
|
19
23
|
href: string;
|
|
20
|
-
/** Visual variant. Default `primary`. */
|
|
21
|
-
variant?:
|
|
24
|
+
/** Visual variant. Default `primary`. `danger` (filled) and `danger-secondary` (outline) are for irreversible or destructive actions only — typically the confirm button of a `Dialog role="alertdialog"`. */
|
|
25
|
+
variant?: ButtonVariant;
|
|
22
26
|
/** Label text — say where it goes ("View Orders"), not "Click here". */
|
|
23
27
|
children: React$1.ReactNode;
|
|
24
|
-
icon?:
|
|
28
|
+
icon?: IconInput;
|
|
25
29
|
/** Trailing icon, e.g. `arrow-right`, or `external-link` with `target="_blank"`. */
|
|
26
|
-
iconRight?:
|
|
30
|
+
iconRight?: IconInput;
|
|
27
31
|
/** Looks unavailable and can't be followed: no href, `aria-disabled`, out of the Tab order. */
|
|
28
32
|
disabled?: boolean;
|
|
33
|
+
/** Fills its container and lets a long label wrap (at least 44px tall). */
|
|
34
|
+
fullWidth?: boolean;
|
|
29
35
|
/** A router's link to render instead of `<a>`, e.g. `Link` from `next/link` (client-side navigation). It gets `href`, `className`, the children and the ref. */
|
|
30
36
|
linkComponent?: React$1.ElementType;
|
|
31
37
|
}
|
|
@@ -61,6 +67,8 @@ export interface DataTableColumn {
|
|
|
61
67
|
hideBelow?: number | "sm" | "md" | "lg" | "xl";
|
|
62
68
|
/** Row actions (a DropdownMenu or IconButton). In stacked cards it sits top-right instead of in the field list. Give it an empty label. */
|
|
63
69
|
actions?: boolean;
|
|
70
|
+
/** `end` right-aligns header and cells (amounts, counts) and uses tabular figures. Default `start`. */
|
|
71
|
+
align?: "start" | "end";
|
|
64
72
|
}
|
|
65
73
|
export interface DataTableSort {
|
|
66
74
|
key: string;
|
|
@@ -68,7 +76,7 @@ export interface DataTableSort {
|
|
|
68
76
|
}
|
|
69
77
|
export interface DataTableEmpty {
|
|
70
78
|
/** Default `inbox`; use `search` for "no matches". */
|
|
71
|
-
icon?:
|
|
79
|
+
icon?: IconInput;
|
|
72
80
|
/** Default "Nothing here yet". */
|
|
73
81
|
title?: string;
|
|
74
82
|
description?: string;
|
|
@@ -108,8 +116,20 @@ export interface DataTableProps {
|
|
|
108
116
|
/** Adds drag/keyboard resize handles to every column that has a width. */
|
|
109
117
|
resizable?: boolean;
|
|
110
118
|
onColumnResize?: (key: string, width: number) => void;
|
|
111
|
-
/** Shows skeleton rows and disables sorting, select-all and paging. */
|
|
119
|
+
/** Shows skeleton rows and disables sorting, select-all and paging. With `manual` and rows already shown, the rows stay (dimmed, with a progress bar) while the next page loads. */
|
|
112
120
|
loading?: boolean;
|
|
121
|
+
/** Server mode: `rows` is already the current page, sorted by the server. The table doesn't sort or slice; it reports
|
|
122
|
+
* sort and page through onSortChange / onPageChange (or getPageHref links). Pair with `totalRows` and `pageSize`. */
|
|
123
|
+
manual?: boolean;
|
|
124
|
+
/** manual: rows across all pages (drives the page count, "1–25 of 312" and aria-rowcount). */
|
|
125
|
+
totalRows?: number;
|
|
126
|
+
/** Makes each row a link: the first column's content renders as the provider's linkComponent (or `<a>`), and a click
|
|
127
|
+
* or Enter anywhere on the row follows it. Ctrl/⌘-click opens a new tab as usual. */
|
|
128
|
+
getRowHref?: (row: Record<string, any>) => string;
|
|
129
|
+
/** Pager arrows become links to these URLs (search-param paging). Without onPageChange the link navigates. */
|
|
130
|
+
getPageHref?: (page: number) => string;
|
|
131
|
+
/** Router link for getRowHref / getPageHref. Default: AuraProvider's linkComponent, else `<a>`. */
|
|
132
|
+
linkComponent?: React$1.ElementType;
|
|
113
133
|
/** Skeleton row count when there is no pageSize. Default 5. */
|
|
114
134
|
skeletonRows?: number;
|
|
115
135
|
/** Called on row click or Enter. */
|
|
@@ -133,10 +153,13 @@ export interface DataTableProps {
|
|
|
133
153
|
stackBelow?: number;
|
|
134
154
|
className?: string;
|
|
135
155
|
}
|
|
156
|
+
/** An AURA icon name, or any icon element (e.g. `<Building />` from lucide-react). AURA sizes it and hides it from screen readers. */
|
|
157
|
+
export type IconInput = IconName | React$1.ReactElement;
|
|
136
158
|
export type IconName = "check" | "x" | "plus" | "minus" | "search" | "chevron-down" | "chevron-up" | "chevron-left" | "chevron-right" | "arrow-right" | "arrow-up-right" | "arrow-up-down" | "loader-circle" | "circle-alert" | "circle-check" | "info" | "triangle-alert" | "settings" | "user" | "users" | "filter" | "ellipsis" | "external-link" | "copy" | "trash-2" | "pencil" | "download" | "upload" | "calendar" | "bell" | "menu" | "eye" | "log-out" | "circle" | "circle-dot-dashed" | "ban" | "arrow-up" | "arrow-down" | "inbox" | "pin" | "pin-off" | "eye-off" | "columns-3" | "arrow-left" | "rotate-ccw" | "house" | "layout-dashboard" | "folder" | "chart-column" | "file-text" | "mail" | "lock" | "clock" | "trending-up" | "trending-down" | "image" | "paperclip" | "cloud-upload" | "file" | "sun" | "moon" | "monitor";
|
|
137
159
|
/** Lucide stroke icon drawn inline in currentColor. */
|
|
138
160
|
export interface IconProps {
|
|
139
|
-
name
|
|
161
|
+
/** A name from the set, or an icon element of your own (sized and styled the same way). */
|
|
162
|
+
name: IconInput;
|
|
140
163
|
/** `sm` 16 (default) · `md` 20 · `lg` 24, or a px number. */
|
|
141
164
|
size?: "sm" | "md" | "lg" | number;
|
|
142
165
|
/** Accessible name. Omit for decorative icons next to a text label (then aria-hidden). */
|
|
@@ -155,12 +178,14 @@ export interface SurfaceProps extends React$1.HTMLAttributes<HTMLElement> {
|
|
|
155
178
|
}
|
|
156
179
|
/** Sets the language of built-in labels (pagination, close buttons, empty states…) and the default date display for everything inside. */
|
|
157
180
|
export interface AuraProviderProps {
|
|
158
|
-
/**
|
|
159
|
-
locale?: "th" | "en";
|
|
160
|
-
/** Default calendar for DatePicker / DateRangePicker / Calendar / formatDate callers that read it. */
|
|
181
|
+
/** Built-in labels and date display. `sv` = Swedish labels, `sv-SE` dates, Monday weeks and the Gregorian calendar. Without a provider everything is English: labels, `en-GB` dates, Gregorian years. */
|
|
182
|
+
locale?: "th" | "en" | "sv";
|
|
183
|
+
/** Default calendar for DatePicker / DateRangePicker / Calendar / formatDate callers that read it. Unset: `buddhist` (พ.ศ.) for `th`, `gregory` for `en` and `sv`. */
|
|
161
184
|
calendar?: "buddhist" | "gregory";
|
|
162
185
|
/** Override individual strings. */
|
|
163
186
|
strings?: Partial<Record<string, string | ((...args: any[]) => string)>>;
|
|
187
|
+
/** Your router's link (e.g. `Link` from `next/link`), used by every AURA component that renders a link: Button with `href`, SideNav, Breadcrumb, Stat, Pagination, DataTable row links. It gets `href`, `className`, `aria-current`, the children and the ref. A component's own `linkComponent` wins. */
|
|
188
|
+
linkComponent?: React$1.ElementType;
|
|
164
189
|
children?: React$1.ReactNode;
|
|
165
190
|
}
|
|
166
191
|
export type StatusTone = "neutral" | "progress" | "ready" | "blocked";
|
|
@@ -191,7 +216,9 @@ export interface CheckboxProps extends Omit<React$1.InputHTMLAttributes<HTMLInpu
|
|
|
191
216
|
}
|
|
192
217
|
/** 32px round button holding one icon. */
|
|
193
218
|
export interface IconButtonProps extends React$1.ButtonHTMLAttributes<HTMLButtonElement> {
|
|
194
|
-
icon:
|
|
219
|
+
icon: IconInput;
|
|
220
|
+
/** `danger` colours the icon and hover for a destructive action (Delete, Revoke). */
|
|
221
|
+
tone?: "neutral" | "danger";
|
|
195
222
|
/** Accessible name and tooltip (required). */
|
|
196
223
|
label: string;
|
|
197
224
|
/** Icon size. Default `sm` (16). */
|
|
@@ -199,7 +226,7 @@ export interface IconButtonProps extends React$1.ButtonHTMLAttributes<HTMLButton
|
|
|
199
226
|
}
|
|
200
227
|
export interface MenuItem {
|
|
201
228
|
label?: string;
|
|
202
|
-
icon?:
|
|
229
|
+
icon?: IconInput;
|
|
203
230
|
/** Present = a checkable item (menuitemcheckbox). */
|
|
204
231
|
checked?: boolean;
|
|
205
232
|
disabled?: boolean;
|
|
@@ -237,7 +264,7 @@ export interface FieldProps {
|
|
|
237
264
|
}
|
|
238
265
|
export interface TextFieldProps extends FieldProps, Omit<React$1.InputHTMLAttributes<HTMLInputElement>, "required"> {
|
|
239
266
|
/** Leading icon inside the field. */
|
|
240
|
-
icon?:
|
|
267
|
+
icon?: IconInput;
|
|
241
268
|
/** Trailing unit, e.g. "THB". */
|
|
242
269
|
suffix?: React$1.ReactNode;
|
|
243
270
|
}
|
|
@@ -252,7 +279,7 @@ export interface SelectProps extends FieldProps, Omit<React$1.SelectHTMLAttribut
|
|
|
252
279
|
options: SelectOption[];
|
|
253
280
|
/** A disabled first option shown in fg-tertiary until something is chosen. */
|
|
254
281
|
placeholder?: string;
|
|
255
|
-
icon?:
|
|
282
|
+
icon?: IconInput;
|
|
256
283
|
}
|
|
257
284
|
export type ChoiceOption = string | {
|
|
258
285
|
value: string;
|
|
@@ -364,7 +391,7 @@ export interface CardProps {
|
|
|
364
391
|
export interface TabItem {
|
|
365
392
|
id: string;
|
|
366
393
|
label: string;
|
|
367
|
-
icon?:
|
|
394
|
+
icon?: IconInput;
|
|
368
395
|
count?: number;
|
|
369
396
|
disabled?: boolean;
|
|
370
397
|
content?: React$1.ReactNode;
|
|
@@ -381,9 +408,15 @@ export interface TabsProps {
|
|
|
381
408
|
export interface NavItem {
|
|
382
409
|
id: string;
|
|
383
410
|
label: string;
|
|
384
|
-
icon?:
|
|
411
|
+
icon?: IconInput;
|
|
385
412
|
count?: number;
|
|
413
|
+
/** Anything beside the label, e.g. a status dot or a `Badge`. */
|
|
414
|
+
badge?: React$1.ReactNode;
|
|
386
415
|
href?: string;
|
|
416
|
+
/** Makes this item a collapsible group of links. The group header is a button, never a link. */
|
|
417
|
+
children?: NavItem[];
|
|
418
|
+
/** Start open. A group also opens by itself when one of its items is the current one. */
|
|
419
|
+
defaultOpen?: boolean;
|
|
387
420
|
}
|
|
388
421
|
export interface SideNavProps {
|
|
389
422
|
sections?: Array<{
|
|
@@ -398,6 +431,8 @@ export interface SideNavProps {
|
|
|
398
431
|
footer?: React$1.ReactNode;
|
|
399
432
|
/** Default "Main". */
|
|
400
433
|
label?: string;
|
|
434
|
+
/** Router link for items with `href`; defaults to the AuraProvider's `linkComponent`, then `<a>`. */
|
|
435
|
+
linkComponent?: React$1.ElementType;
|
|
401
436
|
className?: string;
|
|
402
437
|
}
|
|
403
438
|
export interface BreadcrumbProps {
|
|
@@ -435,7 +470,7 @@ export interface ComboboxOption {
|
|
|
435
470
|
keywords?: string[];
|
|
436
471
|
disabled?: boolean;
|
|
437
472
|
/** Leading icon in the list. */
|
|
438
|
-
icon?:
|
|
473
|
+
icon?: IconInput;
|
|
439
474
|
}
|
|
440
475
|
/** Combobox with `multiple`: pick any number; the picks show as removable chips in the field. */
|
|
441
476
|
export interface ComboboxMultipleProps extends Omit<ComboboxProps, "value" | "defaultValue" | "onChange" | "clearable"> {
|
|
@@ -461,7 +496,7 @@ export interface ComboboxProps extends FieldProps {
|
|
|
461
496
|
disabled?: boolean;
|
|
462
497
|
readOnly?: boolean;
|
|
463
498
|
/** Leading icon. Default `search`. */
|
|
464
|
-
icon?:
|
|
499
|
+
icon?: IconInput;
|
|
465
500
|
/** Clear button while a value is selected (Escape clears too). Default true. */
|
|
466
501
|
clearable?: boolean;
|
|
467
502
|
/** Server-side search: called with the typed text; the component stops filtering and shows `options` as given. */
|
|
@@ -525,7 +560,7 @@ export interface StepperProps {
|
|
|
525
560
|
export interface SegmentedOption {
|
|
526
561
|
value: string;
|
|
527
562
|
label: string;
|
|
528
|
-
icon?:
|
|
563
|
+
icon?: IconInput;
|
|
529
564
|
/** Show only the icon; `label` becomes its accessible name and tooltip. */
|
|
530
565
|
iconOnly?: boolean;
|
|
531
566
|
disabled?: boolean;
|
|
@@ -549,9 +584,9 @@ export interface SegmentedControlProps {
|
|
|
549
584
|
/** ISO date string, `YYYY-MM-DD` (Gregorian — the era is display only). */
|
|
550
585
|
export type ISODate = string;
|
|
551
586
|
export interface DateDisplayOptions {
|
|
552
|
-
/** `
|
|
553
|
-
locale?: "th" | "en";
|
|
554
|
-
/** `buddhist` (default
|
|
587
|
+
/** Components: the AuraProvider's locale, else `en`. `formatDate()` (no provider to read): `th` unless given. */
|
|
588
|
+
locale?: "th" | "en" | "sv";
|
|
589
|
+
/** `buddhist` (พ.ศ.; default for th) or `gregory` (ค.ศ.; default for en and sv). */
|
|
555
590
|
calendar?: "buddhist" | "gregory";
|
|
556
591
|
}
|
|
557
592
|
export interface CalendarProps extends DateDisplayOptions {
|
|
@@ -673,7 +708,7 @@ export interface StatProps {
|
|
|
673
708
|
unit?: React$1.ReactNode;
|
|
674
709
|
change?: StatChange;
|
|
675
710
|
caption?: React$1.ReactNode;
|
|
676
|
-
icon?:
|
|
711
|
+
icon?: IconInput;
|
|
677
712
|
/** Skeleton in place of the value. */
|
|
678
713
|
loading?: boolean;
|
|
679
714
|
/** Makes the whole card a link or a button (drill-down). */
|
|
@@ -740,11 +775,11 @@ export interface BadgeProps extends React$1.HTMLAttributes<HTMLSpanElement> {
|
|
|
740
775
|
tone?: Tone;
|
|
741
776
|
/** soft (default) · solid · outline */
|
|
742
777
|
variant?: "soft" | "solid" | "outline";
|
|
743
|
-
icon?:
|
|
778
|
+
icon?: IconInput;
|
|
744
779
|
}
|
|
745
780
|
export interface TagProps extends Omit<React$1.HTMLAttributes<HTMLElement>, "onClick"> {
|
|
746
781
|
children: React$1.ReactNode;
|
|
747
|
-
icon?:
|
|
782
|
+
icon?: IconInput;
|
|
748
783
|
/** Adds a remove button (applied filters, chosen people). */
|
|
749
784
|
onRemove?: () => void;
|
|
750
785
|
removeLabel?: string;
|
|
@@ -781,7 +816,7 @@ export interface SkeletonProps {
|
|
|
781
816
|
export interface EmptyStateProps {
|
|
782
817
|
title: React$1.ReactNode;
|
|
783
818
|
description?: React$1.ReactNode;
|
|
784
|
-
icon?:
|
|
819
|
+
icon?: IconInput;
|
|
785
820
|
/** One or two buttons. */
|
|
786
821
|
action?: React$1.ReactNode;
|
|
787
822
|
size?: "sm" | "md";
|
|
@@ -807,7 +842,7 @@ export interface AccordionItem {
|
|
|
807
842
|
title: React$1.ReactNode;
|
|
808
843
|
description?: React$1.ReactNode;
|
|
809
844
|
content: React$1.ReactNode;
|
|
810
|
-
icon?:
|
|
845
|
+
icon?: IconInput;
|
|
811
846
|
disabled?: boolean;
|
|
812
847
|
}
|
|
813
848
|
export interface AccordionProps {
|
|
@@ -934,7 +969,7 @@ export declare function formatDate(iso: ISODate | null | undefined, opts?: Forma
|
|
|
934
969
|
/** Parse typed text: dd/mm/yyyy (Buddhist years ≥ 2400 are converted), d-m-yyyy, d.m.yyyy, yyyy-mm-dd or '18 ก.ย. 2569' / '18 Sep 2026'. */
|
|
935
970
|
export declare function parseDate(text: string | null | undefined): ISODate | null;
|
|
936
971
|
export declare const Calendar: React$1.ForwardRefExoticComponent<CalendarProps & React$1.RefAttributes<HTMLDivElement>>;
|
|
937
|
-
/** Typed date field + calendar popover.
|
|
972
|
+
/** Typed date field + calendar popover. English / Gregorian unless a locale is set; `th` shows Buddhist-era dates (18 ก.ย. 2569) and accepts พ.ศ. or ค.ศ. years. The value is always a Gregorian ISO date. */
|
|
938
973
|
export declare const DatePicker: React$1.ForwardRefExoticComponent<DatePickerProps & React$1.RefAttributes<HTMLInputElement>>;
|
|
939
974
|
export declare const DateRangePicker: React$1.ForwardRefExoticComponent<DateRangePickerProps & React$1.RefAttributes<HTMLInputElement>>;
|
|
940
975
|
export declare const Alert: React$1.ForwardRefExoticComponent<AlertProps & React$1.RefAttributes<HTMLDivElement>>;
|
|
@@ -956,6 +991,7 @@ export declare const Drawer: React$1.ForwardRefExoticComponent<DrawerProps & Rea
|
|
|
956
991
|
export declare const DataTable: React$1.ForwardRefExoticComponent<DataTableProps & React$1.RefAttributes<HTMLDivElement>>;
|
|
957
992
|
export declare const Card: React$1.ForwardRefExoticComponent<CardProps & React$1.RefAttributes<HTMLElement>>;
|
|
958
993
|
export declare const Tabs: React$1.ForwardRefExoticComponent<TabsProps & React$1.RefAttributes<HTMLDivElement>>;
|
|
994
|
+
/** Side navigation: sections of links or buttons, collapsible groups, counts and badges. Arrow keys move between items. */
|
|
959
995
|
export declare const SideNav: React$1.ForwardRefExoticComponent<SideNavProps & React$1.RefAttributes<HTMLElement>>;
|
|
960
996
|
export declare const Breadcrumb: React$1.ForwardRefExoticComponent<BreadcrumbProps & React$1.RefAttributes<HTMLElement>>;
|
|
961
997
|
export declare const Avatar: React$1.ForwardRefExoticComponent<AvatarProps & React$1.RefAttributes<HTMLSpanElement>>;
|
|
@@ -1058,12 +1094,15 @@ export interface AuraStrings {
|
|
|
1058
1094
|
export declare const STRINGS: {
|
|
1059
1095
|
en: AuraStrings;
|
|
1060
1096
|
th: AuraStrings;
|
|
1097
|
+
sv: AuraStrings;
|
|
1061
1098
|
};
|
|
1062
1099
|
/** What useAuraLocale returns. `locale` and `calendar` are null outside an AuraProvider. */
|
|
1063
1100
|
export interface AuraLocaleValue {
|
|
1064
|
-
locale: "th" | "en" | null;
|
|
1101
|
+
locale: "th" | "en" | "sv" | null;
|
|
1065
1102
|
calendar: "buddhist" | "gregory" | null;
|
|
1066
1103
|
strings: AuraStrings;
|
|
1104
|
+
/** The router link set on AuraProvider, if any. */
|
|
1105
|
+
linkComponent?: React$1.ElementType | null;
|
|
1067
1106
|
}
|
|
1068
1107
|
/** Sets the language of built-in labels (and the default date locale) for everything inside. */
|
|
1069
1108
|
export declare function AuraProvider(props: AuraProviderProps): React$1.ReactElement;
|
|
@@ -1101,7 +1140,10 @@ export interface ColorSchemeOptions {
|
|
|
1101
1140
|
/** The script ColorSchemeScript renders, as a string — for frameworks that want it in a raw <head> template. */
|
|
1102
1141
|
export declare function colorSchemeScript(options?: ColorSchemeOptions): string;
|
|
1103
1142
|
/** Put in <head>: applies the saved colour scheme before the page paints. Server-rendering safe. */
|
|
1104
|
-
export declare function ColorSchemeScript(props: ColorSchemeOptions
|
|
1143
|
+
export declare function ColorSchemeScript(props: ColorSchemeOptions & {
|
|
1144
|
+
/** Nonce for a nonce-based Content-Security-Policy (script-src 'nonce-…'). */
|
|
1145
|
+
nonce?: string;
|
|
1146
|
+
}): React$1.ReactElement;
|
|
1105
1147
|
/** Current colour scheme and a setter. `resolved` is what is on screen (system resolved to light or dark). */
|
|
1106
1148
|
export interface ColorSchemeState {
|
|
1107
1149
|
scheme: ColorScheme;
|