@xds/a2ui-react 0.0.0-stage → 0.2.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,365 @@
1
+ /** A catalog document, as A2UI's `Catalog.fromJson` reads it. */
2
+ export type CatalogDocument = Record<string, unknown> & {
3
+ catalogId: string;
4
+ components: Record<string, unknown>;
5
+ };
6
+ /**
7
+ * What a `children` prop resolves to: the IDs of its components, each with the path in the data
8
+ * model it reads from when the list is a template over a list there.
9
+ */
10
+ export type ChildList = readonly (string | {
11
+ id: string;
12
+ basePath: string;
13
+ })[];
14
+ /** The icons the catalogs name. */
15
+ export type CatalogIcon = "arrow-down" | "arrow-left" | "arrow-right" | "arrow-up" | "arrow-up-down" | "ban" | "bell" | "bell-off" | "bell-ring" | "bookmark" | "bug" | "calendar" | "camera" | "captions" | "cast" | "chart-column" | "check" | "check-check" | "chevron-down" | "chevron-first" | "chevron-last" | "chevron-left" | "chevron-right" | "chevron-up" | "chevrons-up-down" | "circle-alert" | "circle-check" | "circle-help" | "circle-minus" | "circle-plus" | "circle-user" | "circle-x" | "clapperboard" | "clock" | "cloud-upload" | "compass" | "copy" | "credit-card" | "download" | "ellipsis" | "ellipsis-vertical" | "external-link" | "eye" | "eye-off" | "fast-forward" | "file-text" | "flag" | "folder" | "gamepad-2" | "globe" | "graduation-cap" | "grip-vertical" | "heart" | "heart-off" | "history" | "house" | "image" | "info" | "keyboard" | "laptop" | "layout-grid" | "lightbulb" | "link" | "list" | "list-filter" | "list-plus" | "list-video" | "list-x" | "lock" | "lock-open" | "log-out" | "mail" | "map-pin" | "maximize" | "megaphone" | "menu" | "message-square" | "mic" | "minus" | "music" | "newspaper" | "palette" | "paperclip" | "pause" | "pencil" | "phone" | "picture-in-picture-2" | "pin" | "play" | "plus" | "podcast" | "printer" | "qr-code" | "radio" | "repeat" | "repeat-1" | "rewind" | "rotate-ccw" | "rotate-cw" | "scissors" | "search" | "send" | "settings" | "share-2" | "shield" | "shirt" | "shopping-bag" | "shopping-cart" | "shuffle" | "skip-back" | "skip-forward" | "sliders-horizontal" | "smartphone" | "smile" | "sparkles" | "square" | "square-check" | "star" | "star-half" | "star-off" | "sun-moon" | "tag" | "thumbs-down" | "thumbs-up" | "timer" | "trash" | "trending-up" | "triangle-alert" | "trophy" | "tv" | "undo-2" | "upload" | "user" | "user-check" | "user-plus" | "user-x" | "users" | "video" | "volume" | "volume-1" | "volume-2" | "volume-x" | "x";
16
+ export declare const CORE_CATALOG: CatalogDocument;
17
+ export declare const POINTER_CATALOG: CatalogDocument;
18
+ export declare const TOUCH_CATALOG: CatalogDocument;
19
+ /** The props of each component of the catalogs, as an implementation receives them. */
20
+ export type ResolvedProps = {
21
+ Button: {
22
+ label?: string;
23
+ iconStart?: CatalogIcon;
24
+ iconEnd?: CatalogIcon;
25
+ onPress?: () => Promise<void>;
26
+ variant?: "primary" | "secondary" | "ghost" | "danger";
27
+ size?: "sm" | "md" | "lg";
28
+ disabled?: boolean;
29
+ loading?: boolean;
30
+ fullWidth?: boolean;
31
+ selected?: boolean;
32
+ setSelected: (value: boolean) => void;
33
+ isValid?: boolean;
34
+ validationErrors?: readonly string[];
35
+ };
36
+ TextField: {
37
+ label?: string;
38
+ value?: string;
39
+ description?: string;
40
+ error?: string;
41
+ placeholder?: string;
42
+ leading?: string;
43
+ trailing?: string;
44
+ rows?: number;
45
+ maxLength?: number;
46
+ disabled?: boolean;
47
+ multiline?: boolean;
48
+ setValue: (value: string) => void;
49
+ isValid?: boolean;
50
+ validationErrors?: readonly string[];
51
+ };
52
+ Text: {
53
+ text?: string;
54
+ variant?: "display" | "title" | "heading" | "body" | "body-strong" | "label" | "detail" | "footnote";
55
+ tone?: "primary" | "secondary" | "accent" | "danger" | "success" | "warning" | "inherit";
56
+ };
57
+ Badge: {
58
+ label?: string;
59
+ icon?: CatalogIcon;
60
+ tone?: "neutral" | "accent" | "success" | "warning" | "danger" | "overlay";
61
+ dot?: boolean;
62
+ };
63
+ CountBadge: {
64
+ count?: number;
65
+ max?: number;
66
+ label?: string;
67
+ children?: string;
68
+ };
69
+ Banner: {
70
+ message?: string;
71
+ title?: string;
72
+ action?: {
73
+ label?: string;
74
+ onPress?: () => Promise<void>;
75
+ };
76
+ onDismiss?: () => Promise<void>;
77
+ dismissLabel?: string;
78
+ tone?: "info" | "success" | "warning" | "danger";
79
+ };
80
+ Card: {
81
+ title?: string;
82
+ description?: string;
83
+ actions?: ChildList;
84
+ media?: string;
85
+ onPress?: () => Promise<void>;
86
+ children?: ChildList;
87
+ flush?: boolean;
88
+ selected?: boolean;
89
+ };
90
+ Divider: {};
91
+ Spinner: {
92
+ label?: string;
93
+ size?: "sm" | "md" | "lg";
94
+ };
95
+ Switch: {
96
+ label?: string;
97
+ checked?: boolean;
98
+ disabled?: boolean;
99
+ setChecked: (value: boolean) => void;
100
+ };
101
+ Checkbox: {
102
+ label?: string;
103
+ checked?: boolean;
104
+ disabled?: boolean;
105
+ setChecked: (value: boolean) => void;
106
+ };
107
+ SegmentedControl: {
108
+ options?: readonly {
109
+ value?: string;
110
+ label?: string;
111
+ }[];
112
+ value?: string;
113
+ label?: string;
114
+ fullWidth?: boolean;
115
+ setValue: (value: string) => void;
116
+ };
117
+ Avatar: {
118
+ name?: string;
119
+ src?: string;
120
+ size?: "sm" | "md" | "lg" | "xl";
121
+ };
122
+ AvatarStack: {
123
+ people?: readonly {
124
+ name?: string;
125
+ src?: string;
126
+ }[];
127
+ max?: number;
128
+ label?: string;
129
+ size?: "sm" | "md" | "lg" | "xl";
130
+ };
131
+ ProgressBar: {
132
+ value?: number;
133
+ label?: string;
134
+ };
135
+ Icon: {
136
+ name?: CatalogIcon;
137
+ label?: string;
138
+ size?: "xs" | "sm" | "md" | "lg" | "xl";
139
+ filled?: boolean;
140
+ };
141
+ ListRow: {
142
+ title?: string;
143
+ description?: string;
144
+ leading?: string;
145
+ trailing?: string;
146
+ onPress?: () => Promise<void>;
147
+ chevron?: boolean;
148
+ disabled?: boolean;
149
+ selected?: boolean;
150
+ compact?: boolean;
151
+ };
152
+ IconButton: {
153
+ icon?: CatalogIcon;
154
+ label?: string;
155
+ onPress?: () => Promise<void>;
156
+ variant?: "primary" | "secondary" | "ghost" | "danger";
157
+ size?: "sm" | "md" | "lg";
158
+ selected?: boolean;
159
+ disabled?: boolean;
160
+ loading?: boolean;
161
+ setSelected: (value: boolean) => void;
162
+ isValid?: boolean;
163
+ validationErrors?: readonly string[];
164
+ };
165
+ Chip: {
166
+ label?: string;
167
+ iconStart?: CatalogIcon;
168
+ onPress?: () => Promise<void>;
169
+ selected?: boolean;
170
+ disabled?: boolean;
171
+ setSelected: (value: boolean) => void;
172
+ };
173
+ ChipBar: {
174
+ label?: string;
175
+ children?: ChildList;
176
+ };
177
+ Tabs: {
178
+ items?: readonly {
179
+ value?: string;
180
+ label?: string;
181
+ icon?: CatalogIcon;
182
+ }[];
183
+ value?: string;
184
+ label?: string;
185
+ fullWidth?: boolean;
186
+ setValue: (value: string) => void;
187
+ };
188
+ Menu: {
189
+ trigger?: string;
190
+ items?: readonly {
191
+ separator?: true;
192
+ label?: string;
193
+ icon?: CatalogIcon;
194
+ onSelect?: () => Promise<void>;
195
+ danger?: boolean;
196
+ disabled?: boolean;
197
+ selected?: boolean;
198
+ }[];
199
+ label?: string;
200
+ align?: "start" | "end";
201
+ };
202
+ Dialog: {
203
+ title?: string;
204
+ description?: string;
205
+ children?: ChildList;
206
+ actions?: ChildList;
207
+ onClose?: () => Promise<void>;
208
+ open?: boolean;
209
+ dismissible?: boolean;
210
+ setOpen: (value: boolean) => void;
211
+ };
212
+ SearchField: {
213
+ label?: string;
214
+ value?: string;
215
+ placeholder?: string;
216
+ onSubmit?: () => Promise<void>;
217
+ clearLabel?: string;
218
+ disabled?: boolean;
219
+ setValue: (value: string) => void;
220
+ };
221
+ RadioGroup: {
222
+ label?: string;
223
+ options?: readonly {
224
+ value?: string;
225
+ label?: string;
226
+ description?: string;
227
+ }[];
228
+ value?: string;
229
+ error?: string;
230
+ disabled?: boolean;
231
+ setValue: (value: string) => void;
232
+ isValid?: boolean;
233
+ validationErrors?: readonly string[];
234
+ };
235
+ Select: {
236
+ label?: string;
237
+ options?: readonly {
238
+ value?: string;
239
+ label?: string;
240
+ description?: string;
241
+ }[];
242
+ value?: string;
243
+ placeholder?: string;
244
+ description?: string;
245
+ error?: string;
246
+ disabled?: boolean;
247
+ setValue: (value: string) => void;
248
+ isValid?: boolean;
249
+ validationErrors?: readonly string[];
250
+ };
251
+ DatePicker: {
252
+ label?: string;
253
+ value?: string;
254
+ min?: string;
255
+ max?: string;
256
+ placeholder?: string;
257
+ description?: string;
258
+ error?: string;
259
+ previousLabel?: string;
260
+ nextLabel?: string;
261
+ disabled?: boolean;
262
+ setValue: (value: string) => void;
263
+ isValid?: boolean;
264
+ validationErrors?: readonly string[];
265
+ };
266
+ DateRangePicker: {
267
+ label?: string;
268
+ value?: {
269
+ start: string;
270
+ end: string;
271
+ };
272
+ min?: string;
273
+ max?: string;
274
+ minLength?: number;
275
+ maxLength?: number;
276
+ placeholder?: string;
277
+ description?: string;
278
+ error?: string;
279
+ startLabel?: string;
280
+ endLabel?: string;
281
+ previousLabel?: string;
282
+ nextLabel?: string;
283
+ doneLabel?: string;
284
+ disabled?: boolean;
285
+ setValue: (value: {
286
+ start: string;
287
+ end: string;
288
+ }) => void;
289
+ isValid?: boolean;
290
+ validationErrors?: readonly string[];
291
+ };
292
+ Slider: {
293
+ label?: string;
294
+ value?: number;
295
+ min?: number;
296
+ max?: number;
297
+ step?: number;
298
+ disabled?: boolean;
299
+ showValue?: boolean;
300
+ setValue: (value: number) => void;
301
+ };
302
+ Thumbnail: {
303
+ src?: string;
304
+ alt?: string;
305
+ badge?: string;
306
+ progress?: number;
307
+ ratio?: "16:9" | "1:1" | "4:3" | "9:16";
308
+ };
309
+ MediaCard: {
310
+ src?: string;
311
+ alt?: string;
312
+ ratio?: "16:9" | "1:1" | "4:3" | "9:16";
313
+ badge?: string;
314
+ progress?: number;
315
+ title?: string;
316
+ meta?: string[];
317
+ leading?: string;
318
+ action?: string;
319
+ onPress?: () => Promise<void>;
320
+ layout?: "vertical" | "horizontal";
321
+ };
322
+ SectionHeader: {
323
+ title?: string;
324
+ description?: string;
325
+ icon?: CatalogIcon;
326
+ action?: {
327
+ label?: string;
328
+ onPress?: () => Promise<void>;
329
+ };
330
+ level?: 1 | 2 | 3 | 4 | 5 | 6;
331
+ };
332
+ EmptyState: {
333
+ icon?: CatalogIcon;
334
+ title?: string;
335
+ description?: string;
336
+ action?: string;
337
+ };
338
+ Accordion: {
339
+ items?: readonly {
340
+ value?: string;
341
+ title?: string;
342
+ description?: string;
343
+ content?: string;
344
+ }[];
345
+ expanded?: string[];
346
+ multiple?: boolean;
347
+ setExpanded: (value: string[]) => void;
348
+ };
349
+ Tooltip: {
350
+ label?: string;
351
+ shortcut?: string;
352
+ placement?: "top" | "bottom";
353
+ children?: string;
354
+ };
355
+ BottomSheet: {
356
+ title?: string;
357
+ content?: ChildList;
358
+ surface?: "solid" | "glass";
359
+ open?: boolean;
360
+ setOpen: (value: boolean) => void;
361
+ };
362
+ };
363
+ export type CoreComponent = "Button" | "TextField" | "Text" | "Badge" | "CountBadge" | "Banner" | "Card" | "Divider" | "Spinner" | "Switch" | "Checkbox" | "SegmentedControl" | "Avatar" | "AvatarStack" | "ProgressBar" | "Icon" | "ListRow" | "IconButton" | "Chip" | "ChipBar" | "Tabs" | "Menu" | "Dialog" | "SearchField" | "RadioGroup" | "Select" | "DatePicker" | "DateRangePicker" | "Slider" | "Thumbnail" | "MediaCard" | "SectionHeader" | "EmptyState" | "Accordion";
364
+ export type PointerComponent = "Tooltip";
365
+ export type TouchComponent = "BottomSheet";