@cfast/ui 0.0.1 → 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.
Files changed (51) hide show
  1. package/README.md +23 -23
  2. package/dist/chunk-PWBG6CGF.js +1400 -0
  3. package/dist/{permission-gate-DVmY42oz.d.ts → client-CIx8_tmv.d.ts} +617 -2
  4. package/dist/client.d.ts +4 -617
  5. package/dist/client.js +6 -8
  6. package/dist/index.d.ts +52 -5
  7. package/dist/index.js +17 -13
  8. package/llms.txt +159 -0
  9. package/package.json +25 -41
  10. package/LICENSE +0 -21
  11. package/dist/chunk-755IRYDN.js +0 -941
  12. package/dist/chunk-7SNK37GF.js +0 -418
  13. package/dist/chunk-ASMYTWTR.js +0 -356
  14. package/dist/chunk-B2XXH5V4.js +0 -66
  15. package/dist/chunk-BQMXYYEV.js +0 -348
  16. package/dist/chunk-DTKBXCTU.js +0 -211
  17. package/dist/chunk-EYIBATYR.js +0 -33
  18. package/dist/chunk-FPZAQ2YQ.js +0 -474
  19. package/dist/chunk-G2OU4BYC.js +0 -205
  20. package/dist/chunk-JEGEIQ3R.js +0 -925
  21. package/dist/chunk-JUNLQJ6H.js +0 -1013
  22. package/dist/chunk-NRGMW3JA.js +0 -906
  23. package/dist/chunk-Q6FPL2OJ.js +0 -1086
  24. package/dist/chunk-QHWAGKNW.js +0 -456
  25. package/dist/chunk-QZT62CGJ.js +0 -924
  26. package/dist/chunk-RDTUEOLK.js +0 -486
  27. package/dist/chunk-RESL4IJJ.js +0 -112
  28. package/dist/chunk-UDCWQUTR.js +0 -221
  29. package/dist/chunk-UE7PZOIJ.js +0 -11
  30. package/dist/chunk-UTZTHGNE.js +0 -84
  31. package/dist/chunk-UVRXMOX5.js +0 -439
  32. package/dist/chunk-XFD3N2D4.js +0 -161
  33. package/dist/client-CXIHCQtA.d.ts +0 -274
  34. package/dist/joy.d.ts +0 -199
  35. package/dist/joy.js +0 -1150
  36. package/dist/permission-gate-apt9T9Mu.d.ts +0 -1256
  37. package/dist/types-1bAiH2uK.d.ts +0 -392
  38. package/dist/types-BX6u5sAd.d.ts +0 -403
  39. package/dist/types-BpdY7w5l.d.ts +0 -403
  40. package/dist/types-BrepeVp8.d.ts +0 -403
  41. package/dist/types-BvAqMZhn.d.ts +0 -403
  42. package/dist/types-C74nSscq.d.ts +0 -403
  43. package/dist/types-DD1Cpx8F.d.ts +0 -403
  44. package/dist/types-DHUhQwJn.d.ts +0 -403
  45. package/dist/types-DZSJNt_M.d.ts +0 -392
  46. package/dist/types-DaaJiIjW.d.ts +0 -391
  47. package/dist/types-LUpWJwps.d.ts +0 -403
  48. package/dist/types-a7zVU6WE.d.ts +0 -394
  49. package/dist/types-biJTHMcH.d.ts +0 -403
  50. package/dist/types-ow_qSEYJ.d.ts +0 -392
  51. package/dist/types-wnLasZaB.d.ts +0 -1234
@@ -1,403 +0,0 @@
1
- import { ReactNode, ComponentType } from 'react';
2
- import { ClientDescriptor, Serializable, ActionPermissionStatus } from '@cfast/actions';
3
-
4
- type UIPluginComponents = {
5
- button: ComponentType<ButtonSlotProps>;
6
- tooltip: ComponentType<TooltipSlotProps>;
7
- confirmDialog: ComponentType<ConfirmDialogSlotProps>;
8
- table: ComponentType<TableSlotProps>;
9
- tableHead: ComponentType<TableSectionSlotProps>;
10
- tableBody: ComponentType<TableSectionSlotProps>;
11
- tableRow: ComponentType<TableRowSlotProps>;
12
- tableCell: ComponentType<TableCellSlotProps>;
13
- chip: ComponentType<ChipSlotProps>;
14
- appShell: ComponentType<AppShellSlotProps>;
15
- sidebar: ComponentType<SidebarSlotProps>;
16
- pageContainer: ComponentType<PageContainerSlotProps>;
17
- breadcrumb: ComponentType<BreadcrumbSlotProps>;
18
- toast: ComponentType<ToastSlotProps>;
19
- alert: ComponentType<AlertSlotProps>;
20
- dropZone: ComponentType<DropZoneSlotProps>;
21
- };
22
- type UIPlugin = {
23
- components: Partial<UIPluginComponents>;
24
- };
25
- type ButtonSlotProps = {
26
- children: ReactNode;
27
- onClick?: () => void;
28
- disabled?: boolean;
29
- loading?: boolean;
30
- variant?: "solid" | "soft" | "outlined" | "plain";
31
- color?: "primary" | "neutral" | "danger" | "success" | "warning";
32
- size?: "sm" | "md" | "lg";
33
- type?: "button" | "submit";
34
- startDecorator?: ReactNode;
35
- };
36
- type TooltipSlotProps = {
37
- title: string;
38
- children: ReactNode;
39
- };
40
- type ConfirmDialogSlotProps = {
41
- open: boolean;
42
- onClose: () => void;
43
- onConfirm: () => void;
44
- title: string;
45
- description?: string;
46
- confirmLabel?: string;
47
- cancelLabel?: string;
48
- variant?: "default" | "danger";
49
- };
50
- type TableSlotProps = {
51
- children: ReactNode;
52
- hoverRow?: boolean;
53
- };
54
- type TableSectionSlotProps = {
55
- children: ReactNode;
56
- };
57
- type TableRowSlotProps = {
58
- children: ReactNode;
59
- selected?: boolean;
60
- onClick?: () => void;
61
- };
62
- type TableCellSlotProps = {
63
- children: ReactNode;
64
- header?: boolean;
65
- sortable?: boolean;
66
- sortDirection?: "asc" | "desc" | null;
67
- onSort?: () => void;
68
- };
69
- type ChipSlotProps = {
70
- children: ReactNode;
71
- color?: "primary" | "neutral" | "danger" | "success" | "warning";
72
- variant?: "solid" | "soft" | "outlined";
73
- size?: "sm" | "md" | "lg";
74
- };
75
- type AppShellSlotProps = {
76
- children: ReactNode;
77
- sidebar?: ReactNode;
78
- header?: ReactNode;
79
- };
80
- type SidebarSlotProps = {
81
- children: ReactNode;
82
- items: NavigationItem[];
83
- };
84
- type PageContainerSlotProps = {
85
- children: ReactNode;
86
- title?: string;
87
- breadcrumb?: BreadcrumbItem[];
88
- actions?: ReactNode;
89
- tabs?: TabItem[];
90
- };
91
- type BreadcrumbSlotProps = {
92
- items: BreadcrumbItem[];
93
- };
94
- type ToastSlotProps = {
95
- children?: ReactNode;
96
- };
97
- type AlertSlotProps = {
98
- children: ReactNode;
99
- color?: "success" | "danger" | "warning" | "neutral";
100
- variant?: "soft" | "solid" | "outlined";
101
- };
102
- type DropZoneSlotProps = {
103
- children: ReactNode;
104
- isDragOver: boolean;
105
- isInvalid: boolean;
106
- onDrop: (files: FileList) => void;
107
- onDragOver: (e: React.DragEvent) => void;
108
- onDragLeave: () => void;
109
- onClick: () => void;
110
- accept?: string;
111
- };
112
- type WhenForbidden = "hide" | "disable" | "show";
113
- type ColumnDef<T = unknown> = {
114
- key: string;
115
- label?: string;
116
- sortable?: boolean;
117
- render?: (value: unknown, row: T) => ReactNode;
118
- width?: string | number;
119
- priority?: number;
120
- };
121
- type ColumnShorthand<T = unknown> = string | ColumnDef<T>;
122
- type FilterType = "text" | "select" | "multiSelect" | "relation" | "dateRange" | "boolean" | "number";
123
- type FilterOption = {
124
- label: string;
125
- value: string | number | boolean;
126
- };
127
- type FilterDef = {
128
- column: string;
129
- type: FilterType;
130
- label?: string;
131
- options?: FilterOption[];
132
- table?: unknown;
133
- display?: string;
134
- placeholder?: string;
135
- };
136
- type DataTableProps<T = unknown> = {
137
- data: {
138
- items: T[];
139
- isLoading?: boolean;
140
- };
141
- table?: unknown;
142
- columns?: ColumnShorthand<T>[];
143
- actions?: ClientDescriptor;
144
- selectable?: boolean;
145
- selectedRows?: T[];
146
- onSelectionChange?: (rows: T[]) => void;
147
- onRowClick?: (row: T) => void;
148
- getRowId?: (row: T) => string | number;
149
- emptyMessage?: string;
150
- };
151
- type FilterBarProps = {
152
- table?: unknown;
153
- filters: FilterDef[];
154
- searchable?: string[];
155
- values?: Record<string, unknown>;
156
- onChange?: (values: Record<string, unknown>) => void;
157
- };
158
- type ListViewProps<T = unknown> = {
159
- title: string;
160
- data: {
161
- items: T[];
162
- isLoading?: boolean;
163
- total?: number;
164
- totalPages?: number;
165
- currentPage?: number;
166
- goToPage?: (page: number) => void;
167
- hasMore?: boolean;
168
- loadMore?: () => void;
169
- };
170
- table?: unknown;
171
- columns?: ColumnShorthand<T>[];
172
- actions?: ClientDescriptor;
173
- filters?: FilterDef[];
174
- searchable?: string[];
175
- createAction?: ClientDescriptor;
176
- createLabel?: string;
177
- selectable?: boolean;
178
- bulkActions?: BulkAction[];
179
- breadcrumb?: BreadcrumbItem[];
180
- };
181
- type DetailViewProps<T = unknown> = {
182
- title: string;
183
- table?: unknown;
184
- record: T;
185
- fields?: ColumnShorthand<T>[];
186
- exclude?: string[];
187
- actions?: ClientDescriptor;
188
- breadcrumb?: BreadcrumbItem[];
189
- };
190
- type BaseFieldProps = {
191
- label?: string;
192
- className?: string;
193
- };
194
- type DateFieldProps = BaseFieldProps & {
195
- value: Date | string | number | null | undefined;
196
- format?: "short" | "long" | "relative" | "datetime";
197
- locale?: string;
198
- };
199
- type BooleanFieldProps = BaseFieldProps & {
200
- value: boolean | null | undefined;
201
- trueLabel?: string;
202
- falseLabel?: string;
203
- trueColor?: string;
204
- falseColor?: string;
205
- };
206
- type NumberFieldProps = BaseFieldProps & {
207
- value: number | null | undefined;
208
- locale?: string;
209
- currency?: string;
210
- decimals?: number;
211
- };
212
- type TextFieldProps = BaseFieldProps & {
213
- value: string | null | undefined;
214
- maxLength?: number;
215
- copyable?: boolean;
216
- };
217
- type EmailFieldProps = BaseFieldProps & {
218
- value: string | null | undefined;
219
- };
220
- type UrlFieldProps = BaseFieldProps & {
221
- value: string | null | undefined;
222
- truncate?: boolean;
223
- };
224
- type ImageFieldProps = BaseFieldProps & {
225
- value: string | null | undefined;
226
- storage?: unknown;
227
- width?: number;
228
- height?: number;
229
- alt?: string;
230
- };
231
- type FileFieldProps = BaseFieldProps & {
232
- value: string | null | undefined;
233
- storage?: unknown;
234
- fileName?: string;
235
- fileSize?: number;
236
- };
237
- type RelationFieldProps = BaseFieldProps & {
238
- value: unknown;
239
- display?: string;
240
- linkTo?: string;
241
- };
242
- type JsonFieldProps = BaseFieldProps & {
243
- value: unknown;
244
- collapsed?: boolean;
245
- };
246
- type ToastType = "success" | "error" | "info" | "warning";
247
- type ToastOptions = {
248
- message: string;
249
- type?: ToastType;
250
- duration?: number;
251
- description?: string;
252
- };
253
- type ToastApi = {
254
- show: (options: ToastOptions) => void;
255
- success: (message: string, description?: string) => void;
256
- error: (message: string, description?: string) => void;
257
- info: (message: string, description?: string) => void;
258
- warning: (message: string, description?: string) => void;
259
- };
260
- type ConfirmOptions = {
261
- title: string;
262
- description?: string;
263
- confirmLabel?: string;
264
- cancelLabel?: string;
265
- variant?: "default" | "danger";
266
- };
267
- type NavigationItem = {
268
- label: string;
269
- to: string;
270
- icon?: ComponentType<{
271
- className?: string;
272
- }>;
273
- action?: ClientDescriptor;
274
- children?: NavigationItem[];
275
- };
276
- type BreadcrumbItem = {
277
- label: string;
278
- to?: string;
279
- };
280
- type TabItem = {
281
- label: string;
282
- to?: string;
283
- value?: string;
284
- };
285
- type BulkAction = {
286
- label: string;
287
- action?: ClientDescriptor;
288
- handler?: (rows: unknown[]) => void;
289
- confirmation?: string;
290
- icon?: ComponentType<{
291
- className?: string;
292
- }>;
293
- };
294
- type ActionButtonProps = {
295
- action: ClientDescriptor;
296
- actionName?: string;
297
- input?: Record<string, Serializable>;
298
- children: ReactNode;
299
- whenForbidden?: WhenForbidden;
300
- confirmation?: string | ConfirmOptions;
301
- variant?: "solid" | "soft" | "outlined" | "plain";
302
- color?: "primary" | "neutral" | "danger" | "success" | "warning";
303
- size?: "sm" | "md" | "lg";
304
- startDecorator?: ReactNode;
305
- };
306
- type PermissionGateProps = {
307
- action: ClientDescriptor;
308
- actionName?: string;
309
- input?: Record<string, Serializable>;
310
- children: ReactNode;
311
- fallback?: ReactNode;
312
- };
313
- type ActionStatusResult = ActionPermissionStatus & {
314
- submit: () => void;
315
- pending: boolean;
316
- data: unknown;
317
- error: unknown;
318
- };
319
- type FormStatusData = {
320
- success?: string;
321
- error?: string;
322
- fieldErrors?: Record<string, string[]>;
323
- };
324
- type FormStatusProps = {
325
- data: FormStatusData | null | undefined;
326
- };
327
- type EmptyStateProps = {
328
- title: string;
329
- description?: string;
330
- createAction?: ClientDescriptor;
331
- createLabel?: string;
332
- icon?: ComponentType<{
333
- className?: string;
334
- }>;
335
- };
336
- type AppShellProps = {
337
- children: ReactNode;
338
- sidebar?: ReactNode;
339
- header?: ReactNode;
340
- };
341
- type UserMenuLink = {
342
- label: string;
343
- to: string;
344
- action?: ClientDescriptor;
345
- };
346
- type UserMenuProps = {
347
- links?: UserMenuLink[];
348
- onSignOut?: () => void;
349
- };
350
- type DropZoneProps = {
351
- upload: {
352
- accept: string;
353
- start: (file: File) => void;
354
- progress: number;
355
- isUploading: boolean;
356
- result: unknown | null;
357
- error: string | null;
358
- validationError: string | null;
359
- reset: () => void;
360
- };
361
- multiple?: boolean;
362
- children?: ReactNode;
363
- };
364
- type ImagePreviewProps = {
365
- fileKey?: string | null;
366
- src?: string | null;
367
- storage?: unknown;
368
- getUrl?: (key: string) => string;
369
- width?: number;
370
- height?: number;
371
- fallback?: ReactNode;
372
- alt?: string;
373
- };
374
- type FileListFile = {
375
- key: string;
376
- name: string;
377
- size?: number;
378
- type?: string;
379
- url?: string;
380
- };
381
- type FileListProps = {
382
- files: FileListFile[];
383
- storage?: unknown;
384
- deleteAction?: ClientDescriptor;
385
- onDownload?: (file: FileListFile) => void;
386
- };
387
- type AvatarWithInitialsProps = {
388
- src?: string | null;
389
- name: string;
390
- size?: "sm" | "md" | "lg";
391
- };
392
- type RoleBadgeProps = {
393
- role: string;
394
- colors?: Record<string, string>;
395
- };
396
- type ImpersonationBannerProps = {
397
- stopAction?: string;
398
- };
399
- type NavigationProgressProps = {
400
- color?: string;
401
- };
402
-
403
- export type { ToastApi as $, ActionButtonProps as A, BooleanFieldProps as B, ConfirmDialogSlotProps as C, DateFieldProps as D, EmptyStateProps as E, FormStatusProps as F, FilterDef as G, FilterOption as H, ImpersonationBannerProps as I, JsonFieldProps as J, FilterType as K, FormStatusData as L, ImagePreviewProps as M, NumberFieldProps as N, ListViewProps as O, NavigationItem as P, PageContainerSlotProps as Q, RoleBadgeProps as R, PermissionGateProps as S, TextFieldProps as T, UrlFieldProps as U, SidebarSlotProps as V, TabItem as W, TableCellSlotProps as X, TableRowSlotProps as Y, TableSectionSlotProps as Z, TableSlotProps as _, AvatarWithInitialsProps as a, ToastOptions as a0, ToastSlotProps as a1, ToastType as a2, TooltipSlotProps as a3, UIPlugin as a4, UIPluginComponents as a5, UserMenuLink as a6, UserMenuProps as a7, WhenForbidden as a8, ChipSlotProps as b, EmailFieldProps as c, ImageFieldProps as d, FileFieldProps as e, RelationFieldProps as f, BaseFieldProps as g, NavigationProgressProps as h, ActionStatusResult as i, AlertSlotProps as j, AppShellProps as k, AppShellSlotProps as l, BreadcrumbItem as m, BreadcrumbSlotProps as n, BulkAction as o, ButtonSlotProps as p, ColumnDef as q, ColumnShorthand as r, ConfirmOptions as s, DataTableProps as t, DetailViewProps as u, DropZoneProps as v, DropZoneSlotProps as w, FileListFile as x, FileListProps as y, FilterBarProps as z };