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