@cfast/ui 0.0.1

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 (49) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +727 -0
  3. package/dist/chunk-755IRYDN.js +941 -0
  4. package/dist/chunk-7SNK37GF.js +418 -0
  5. package/dist/chunk-ASMYTWTR.js +356 -0
  6. package/dist/chunk-B2XXH5V4.js +66 -0
  7. package/dist/chunk-BQMXYYEV.js +348 -0
  8. package/dist/chunk-DTKBXCTU.js +211 -0
  9. package/dist/chunk-EYIBATYR.js +33 -0
  10. package/dist/chunk-FPZAQ2YQ.js +474 -0
  11. package/dist/chunk-G2OU4BYC.js +205 -0
  12. package/dist/chunk-JEGEIQ3R.js +925 -0
  13. package/dist/chunk-JUNLQJ6H.js +1013 -0
  14. package/dist/chunk-NRGMW3JA.js +906 -0
  15. package/dist/chunk-Q6FPL2OJ.js +1086 -0
  16. package/dist/chunk-QHWAGKNW.js +456 -0
  17. package/dist/chunk-QZT62CGJ.js +924 -0
  18. package/dist/chunk-RDTUEOLK.js +486 -0
  19. package/dist/chunk-RESL4IJJ.js +112 -0
  20. package/dist/chunk-UDCWQUTR.js +221 -0
  21. package/dist/chunk-UE7PZOIJ.js +11 -0
  22. package/dist/chunk-UTZTHGNE.js +84 -0
  23. package/dist/chunk-UVRXMOX5.js +439 -0
  24. package/dist/chunk-XFD3N2D4.js +161 -0
  25. package/dist/client-CXIHCQtA.d.ts +274 -0
  26. package/dist/client.d.ts +617 -0
  27. package/dist/client.js +54 -0
  28. package/dist/index.d.ts +415 -0
  29. package/dist/index.js +296 -0
  30. package/dist/joy.d.ts +199 -0
  31. package/dist/joy.js +1150 -0
  32. package/dist/permission-gate-DVmY42oz.d.ts +1269 -0
  33. package/dist/permission-gate-apt9T9Mu.d.ts +1256 -0
  34. package/dist/types-1bAiH2uK.d.ts +392 -0
  35. package/dist/types-BX6u5sAd.d.ts +403 -0
  36. package/dist/types-BpdY7w5l.d.ts +403 -0
  37. package/dist/types-BrepeVp8.d.ts +403 -0
  38. package/dist/types-BvAqMZhn.d.ts +403 -0
  39. package/dist/types-C74nSscq.d.ts +403 -0
  40. package/dist/types-DD1Cpx8F.d.ts +403 -0
  41. package/dist/types-DHUhQwJn.d.ts +403 -0
  42. package/dist/types-DZSJNt_M.d.ts +392 -0
  43. package/dist/types-DaaJiIjW.d.ts +391 -0
  44. package/dist/types-LUpWJwps.d.ts +403 -0
  45. package/dist/types-a7zVU6WE.d.ts +394 -0
  46. package/dist/types-biJTHMcH.d.ts +403 -0
  47. package/dist/types-ow_qSEYJ.d.ts +392 -0
  48. package/dist/types-wnLasZaB.d.ts +1234 -0
  49. package/package.json +88 -0
@@ -0,0 +1,392 @@
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
+ /** Props that ActionButton controls internally — not forwarded from the caller. */
296
+ type ActionButtonControlledProps = "children" | "onClick" | "disabled" | "loading";
297
+ type ActionButtonProps = {
298
+ action: ActionHookResult;
299
+ children: ReactNode;
300
+ whenForbidden?: WhenForbidden;
301
+ confirmation?: string | ConfirmOptions;
302
+ } & Omit<ButtonSlotProps, ActionButtonControlledProps>;
303
+ type PermissionGateProps = {
304
+ action: ActionHookResult;
305
+ children: ReactNode;
306
+ fallback?: ReactNode;
307
+ };
308
+ type FormStatusData = {
309
+ success?: string;
310
+ error?: string;
311
+ fieldErrors?: Record<string, string[]>;
312
+ };
313
+ type FormStatusProps = {
314
+ data: FormStatusData | null | undefined;
315
+ };
316
+ type EmptyStateProps = {
317
+ title: string;
318
+ description?: string;
319
+ createAction?: ClientDescriptor;
320
+ createLabel?: string;
321
+ icon?: ComponentType<{
322
+ className?: string;
323
+ }>;
324
+ };
325
+ type AppShellProps = {
326
+ children: ReactNode;
327
+ sidebar?: ReactNode;
328
+ header?: ReactNode;
329
+ };
330
+ type UserMenuLink = {
331
+ label: string;
332
+ to: string;
333
+ action?: ClientDescriptor;
334
+ };
335
+ type UserMenuProps = {
336
+ links?: UserMenuLink[];
337
+ onSignOut?: () => void;
338
+ };
339
+ type DropZoneProps = {
340
+ upload: {
341
+ accept: string;
342
+ start: (file: File) => void;
343
+ progress: number;
344
+ isUploading: boolean;
345
+ result: unknown | null;
346
+ error: string | null;
347
+ validationError: string | null;
348
+ reset: () => void;
349
+ };
350
+ multiple?: boolean;
351
+ children?: ReactNode;
352
+ };
353
+ type ImagePreviewProps = {
354
+ fileKey?: string | null;
355
+ src?: string | null;
356
+ storage?: unknown;
357
+ getUrl?: (key: string) => string;
358
+ width?: number;
359
+ height?: number;
360
+ fallback?: ReactNode;
361
+ alt?: string;
362
+ };
363
+ type FileListFile = {
364
+ key: string;
365
+ name: string;
366
+ size?: number;
367
+ type?: string;
368
+ url?: string;
369
+ };
370
+ type FileListProps = {
371
+ files: FileListFile[];
372
+ storage?: unknown;
373
+ deleteAction?: ClientDescriptor;
374
+ onDownload?: (file: FileListFile) => void;
375
+ };
376
+ type AvatarWithInitialsProps = {
377
+ src?: string | null;
378
+ name: string;
379
+ size?: "sm" | "md" | "lg";
380
+ };
381
+ type RoleBadgeProps = {
382
+ role: string;
383
+ colors?: Record<string, string>;
384
+ };
385
+ type ImpersonationBannerProps = {
386
+ stopAction?: string;
387
+ };
388
+ type NavigationProgressProps = {
389
+ color?: string;
390
+ };
391
+
392
+ export type { TextFieldProps as $, ActionButtonProps as A, ButtonSlotProps as B, ConfirmOptions 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, WhenForbidden as W, TableCellSlotProps as X, TableRowSlotProps as Y, TableSectionSlotProps as Z, TableSlotProps as _, UIPluginComponents as a, ToastApi as a0, ToastOptions as a1, ToastSlotProps as a2, ToastType as a3, TooltipSlotProps as a4, UrlFieldProps as a5, UserMenuLink as a6, UserMenuProps 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, ChipSlotProps as k, ColumnDef as l, ColumnShorthand as m, ConfirmDialogSlotProps 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 };