@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,392 +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
- /** 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 };