@jirawatpyk/aura-react 4.16.0 → 4.17.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.
@@ -0,0 +1,171 @@
1
+ import * as React$1 from 'react';
2
+
3
+ export type StatusTone = "neutral" | "progress" | "ready" | "blocked";
4
+ /** ISO date string, `YYYY-MM-DD` (Gregorian — the era is display only). */
5
+ export type ISODate = string;
6
+ export interface DateDisplayOptions {
7
+ /** Components: the AuraProvider's locale, else `en`. `formatDate()` (no provider to read): `th` unless given. */
8
+ locale?: "th" | "en" | "sv" | undefined;
9
+ /** `buddhist` (พ.ศ.; default for th) or `gregory` (ค.ศ.; default for en and sv). */
10
+ calendar?: "buddhist" | "gregory" | undefined;
11
+ }
12
+ export interface ThemeOptions {
13
+ /** The project's brand colour, #rgb or #rrggbb. Replaces AURA violet (links, focus ring, selection, info, progress, creative shadow in dark, mesh). */
14
+ brand: string;
15
+ /** Optional signal colour; replaces AURA lime in the accent dot and mesh only (success/ready stay green). */
16
+ signal?: string | undefined;
17
+ /** ink (default): primary buttons stay zinc ink. brand: primary buttons use the brand colour. */
18
+ primary?: "ink" | "brand" | undefined;
19
+ name?: string | undefined;
20
+ }
21
+ export interface ThemeCheck {
22
+ theme: "light" | "dark";
23
+ pair: string;
24
+ ratio: number;
25
+ target: number;
26
+ pass: boolean;
27
+ }
28
+ export interface Theme {
29
+ name: string | null;
30
+ brand: Record<50 | 100 | 200 | 300 | 400 | 500 | 600 | 700 | 800 | 900, string>;
31
+ signal: Record<50 | 100 | 200 | 300 | 400 | 500 | 600 | 700 | 800 | 900, string> | null;
32
+ light: Record<string, string>;
33
+ dark: Record<string, string>;
34
+ checks: ThemeCheck[];
35
+ ok: boolean;
36
+ /** CSS overriding the tokens. No selector: the whole page. A selector (".tenant-acme") scopes it. Load after aura.css. */
37
+ css(selector?: string): string;
38
+ }
39
+ /** Options for formatDate: locale/calendar plus a preset or any Intl.DateTimeFormat options. */
40
+ export type FormatDateOptions = DateDisplayOptions & {
41
+ format?: "short" | "long" | "numeric" | Intl.DateTimeFormatOptions | undefined;
42
+ };
43
+ export declare function toISO(d: Date | null | undefined): ISODate | null;
44
+ export declare function fromISO(s: ISODate | null | undefined): Date | null;
45
+ /** 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'. */
46
+ export declare function parseDate(text: string | null | undefined): ISODate | null;
47
+ /** 1536 → "1.5 KB". */
48
+ export declare function formatBytes(n: number | null | undefined): string;
49
+ /** Parse typed time: 9 · 09 · 930 · 0930 · 9:30 · 9.30 · 09.30 น. · 9:30 pm → "HH:mm" (24-hour) or null. */
50
+ export declare function parseTime(text: string | null | undefined): string | null;
51
+ /** The tone the pill would pick for a status word. */
52
+ declare function toneFor(status: unknown): StatusTone;
53
+ /** Every built-in label. Function entries build the text from their arguments. */
54
+ export interface AuraStrings {
55
+ close: string;
56
+ dismiss: string;
57
+ dismissToast: string;
58
+ showPassword: string;
59
+ filters: string;
60
+ search: string;
61
+ clearFilters: string;
62
+ results: (n: number) => string;
63
+ commandMenu: string;
64
+ commandPlaceholder: string;
65
+ commandHint: string;
66
+ errorSummary: (n: number) => string;
67
+ notifications: string;
68
+ mainNav: string;
69
+ breadcrumb: string;
70
+ navigation: string;
71
+ openNav: string;
72
+ collapseNav: string;
73
+ expandNav: string;
74
+ searching: string;
75
+ noMatches: string;
76
+ clear: (what?: string) => string;
77
+ keepTyping: (total: number) => string;
78
+ sortAsc: string;
79
+ sortDesc: string;
80
+ pin: string;
81
+ unpin: string;
82
+ moveLeft: string;
83
+ moveRight: string;
84
+ hideColumn: string;
85
+ resetColumns: string;
86
+ selectRows: string;
87
+ selectAllRows: string;
88
+ deselectAllRows: string;
89
+ selectAll: string;
90
+ selectRow: (k: React$1.ReactNode) => string;
91
+ selectedCount: (c: number) => string;
92
+ pinned: string;
93
+ columnOptions: (label?: string) => string;
94
+ column: (label?: string) => string;
95
+ columns: string;
96
+ showHideColumns: string;
97
+ empty: string;
98
+ loading: string;
99
+ loadingRows: string;
100
+ range: (a: number | string, b: number | string, total: number) => string;
101
+ page: (p: number, total: number) => string;
102
+ prevPage: string;
103
+ nextPage: string;
104
+ rowCount: (c: number) => string;
105
+ actions: string;
106
+ optional: string;
107
+ timePlaceholder: string;
108
+ timeInvalid: string;
109
+ timeOutOfRange: (a: number | string, b: number | string) => string;
110
+ dropFiles: string;
111
+ browse: string;
112
+ browseOne: string;
113
+ remove: (n: number | string) => string;
114
+ fileTooBig: (max?: number | string) => string;
115
+ fileWrongType: string;
116
+ tooManyFiles: (n: number | string) => string;
117
+ colorScheme: string;
118
+ increase: string;
119
+ decrease: string;
120
+ stepDone: string;
121
+ stepOf: (i: number, total: number) => string;
122
+ schemeLight: string;
123
+ schemeDark: string;
124
+ schemeSystem: string;
125
+ uploading: string;
126
+ images: string;
127
+ pagination: string;
128
+ pageN: (p: number) => string;
129
+ accepts: (list?: string, max?: number | string) => string;
130
+ }
131
+ export declare const STRINGS: {
132
+ en: AuraStrings;
133
+ th: AuraStrings;
134
+ sv: AuraStrings;
135
+ };
136
+ /** WCAG contrast ratio of two #hex colours. */
137
+ export declare function contrast(a: string, b: string): number;
138
+ /** A 50–900 scale around one colour: same hue, AURA's lightness steps, chroma kept in gamut. */
139
+ declare function scale(hex: string): Theme["brand"];
140
+ /**
141
+ * createTheme({ brand, signal?, primary?: 'ink' | 'brand', name? })
142
+ * → { name, brand: {50…900}, signal: {50…900}|null, light: {token: #hex}, dark: {…}, checks: [{pair, ratio, target, pass}], ok, css(selector?) }
143
+ */
144
+ export declare function createTheme(opts: ThemeOptions): Theme;
145
+ /** `system` follows the operating system and changes with it. */
146
+ export type ColorScheme = "light" | "dark" | "system";
147
+ export interface ColorSchemeOptions {
148
+ /** localStorage key for the choice. Default `aura-color-scheme`. */
149
+ storageKey?: string | undefined;
150
+ /** Used when nothing is saved. Default `system`. */
151
+ defaultScheme?: ColorScheme | undefined;
152
+ }
153
+ /** The script ColorSchemeScript renders, as a string — for frameworks that want it in a raw <head> template. */
154
+ export declare function colorSchemeScript(options?: ColorSchemeOptions): string;
155
+ /** Min-width breakpoints in px, mirroring the aura-bp-* tokens. */
156
+ export declare const breakpoints: {
157
+ sm: 640;
158
+ md: 768;
159
+ lg: 1024;
160
+ xl: 1280;
161
+ };
162
+ /** Format an ISO date for display: "24 Sept 2026" by default (English, Gregorian); `{ locale: 'th' }` gives
163
+ * "24 ก.ย. 2569", `{ locale: 'sv' }` "24 sep. 2026". Options as in the package root's formatDate. */
164
+ export declare function formatDate(iso: ISODate | null | undefined, opts?: FormatDateOptions): string;
165
+
166
+ export {
167
+ scale as brandScale,
168
+ toneFor as statusTone,
169
+ };
170
+
171
+ export {};