@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.
- package/LICENSE +21 -0
- package/README.md +727 -0
- package/dist/chunk-755IRYDN.js +941 -0
- package/dist/chunk-7SNK37GF.js +418 -0
- package/dist/chunk-ASMYTWTR.js +356 -0
- package/dist/chunk-B2XXH5V4.js +66 -0
- package/dist/chunk-BQMXYYEV.js +348 -0
- package/dist/chunk-DTKBXCTU.js +211 -0
- package/dist/chunk-EYIBATYR.js +33 -0
- package/dist/chunk-FPZAQ2YQ.js +474 -0
- package/dist/chunk-G2OU4BYC.js +205 -0
- package/dist/chunk-JEGEIQ3R.js +925 -0
- package/dist/chunk-JUNLQJ6H.js +1013 -0
- package/dist/chunk-NRGMW3JA.js +906 -0
- package/dist/chunk-Q6FPL2OJ.js +1086 -0
- package/dist/chunk-QHWAGKNW.js +456 -0
- package/dist/chunk-QZT62CGJ.js +924 -0
- package/dist/chunk-RDTUEOLK.js +486 -0
- package/dist/chunk-RESL4IJJ.js +112 -0
- package/dist/chunk-UDCWQUTR.js +221 -0
- package/dist/chunk-UE7PZOIJ.js +11 -0
- package/dist/chunk-UTZTHGNE.js +84 -0
- package/dist/chunk-UVRXMOX5.js +439 -0
- package/dist/chunk-XFD3N2D4.js +161 -0
- package/dist/client-CXIHCQtA.d.ts +274 -0
- package/dist/client.d.ts +617 -0
- package/dist/client.js +54 -0
- package/dist/index.d.ts +415 -0
- package/dist/index.js +296 -0
- package/dist/joy.d.ts +199 -0
- package/dist/joy.js +1150 -0
- package/dist/permission-gate-DVmY42oz.d.ts +1269 -0
- package/dist/permission-gate-apt9T9Mu.d.ts +1256 -0
- package/dist/types-1bAiH2uK.d.ts +392 -0
- package/dist/types-BX6u5sAd.d.ts +403 -0
- package/dist/types-BpdY7w5l.d.ts +403 -0
- package/dist/types-BrepeVp8.d.ts +403 -0
- package/dist/types-BvAqMZhn.d.ts +403 -0
- package/dist/types-C74nSscq.d.ts +403 -0
- package/dist/types-DD1Cpx8F.d.ts +403 -0
- package/dist/types-DHUhQwJn.d.ts +403 -0
- package/dist/types-DZSJNt_M.d.ts +392 -0
- package/dist/types-DaaJiIjW.d.ts +391 -0
- package/dist/types-LUpWJwps.d.ts +403 -0
- package/dist/types-a7zVU6WE.d.ts +394 -0
- package/dist/types-biJTHMcH.d.ts +403 -0
- package/dist/types-ow_qSEYJ.d.ts +392 -0
- package/dist/types-wnLasZaB.d.ts +1234 -0
- package/package.json +88 -0
|
@@ -0,0 +1,403 @@
|
|
|
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 { TableSlotProps as $, AppShellProps as A, BooleanFieldProps as B, ChipSlotProps as C, DateFieldProps as D, EmailFieldProps as E, FileFieldProps as F, FilterDef as G, FilterOption as H, ImageFieldProps as I, JsonFieldProps as J, FilterType as K, FormStatusData as L, FormStatusProps as M, NumberFieldProps as N, ImagePreviewProps as O, ImpersonationBannerProps as P, ListViewProps as Q, RelationFieldProps as R, PageContainerSlotProps as S, TextFieldProps as T, UrlFieldProps as U, PermissionGateProps as V, RoleBadgeProps as W, SidebarSlotProps as X, TableCellSlotProps as Y, TableRowSlotProps as Z, TableSectionSlotProps as _, BaseFieldProps as a, ToastApi as a0, ToastOptions as a1, ToastSlotProps as a2, ToastType as a3, TooltipSlotProps as a4, UIPlugin as a5, UIPluginComponents as a6, UserMenuLink as a7, WhenForbidden as a8, EmptyStateProps as b, NavigationProgressProps as c, BreadcrumbItem as d, TabItem as e, AppShellSlotProps as f, NavigationItem as g, UserMenuProps as h, ActionButtonProps as i, ActionStatusResult as j, AlertSlotProps as k, AvatarWithInitialsProps as l, BreadcrumbSlotProps as m, BulkAction as n, ButtonSlotProps as o, ColumnDef as p, ColumnShorthand as q, ConfirmDialogSlotProps 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 };
|