@cfast/ui 0.0.1 → 0.1.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.
- package/llms.txt +159 -0
- package/package.json +26 -18
- package/LICENSE +0 -21
- package/dist/chunk-755IRYDN.js +0 -941
- package/dist/chunk-7SNK37GF.js +0 -418
- package/dist/chunk-ASMYTWTR.js +0 -356
- package/dist/chunk-B2XXH5V4.js +0 -66
- package/dist/chunk-BQMXYYEV.js +0 -348
- package/dist/chunk-DTKBXCTU.js +0 -211
- package/dist/chunk-EYIBATYR.js +0 -33
- package/dist/chunk-FPZAQ2YQ.js +0 -474
- package/dist/chunk-G2OU4BYC.js +0 -205
- package/dist/chunk-JUNLQJ6H.js +0 -1013
- package/dist/chunk-NRGMW3JA.js +0 -906
- package/dist/chunk-Q6FPL2OJ.js +0 -1086
- package/dist/chunk-QHWAGKNW.js +0 -456
- package/dist/chunk-QZT62CGJ.js +0 -924
- package/dist/chunk-RESL4IJJ.js +0 -112
- package/dist/chunk-UDCWQUTR.js +0 -221
- package/dist/chunk-UE7PZOIJ.js +0 -11
- package/dist/chunk-UTZTHGNE.js +0 -84
- package/dist/chunk-UVRXMOX5.js +0 -439
- package/dist/chunk-XFD3N2D4.js +0 -161
- package/dist/client-CXIHCQtA.d.ts +0 -274
- package/dist/permission-gate-apt9T9Mu.d.ts +0 -1256
- package/dist/types-1bAiH2uK.d.ts +0 -392
- package/dist/types-BX6u5sAd.d.ts +0 -403
- package/dist/types-BpdY7w5l.d.ts +0 -403
- package/dist/types-BrepeVp8.d.ts +0 -403
- package/dist/types-BvAqMZhn.d.ts +0 -403
- package/dist/types-C74nSscq.d.ts +0 -403
- package/dist/types-DD1Cpx8F.d.ts +0 -403
- package/dist/types-DHUhQwJn.d.ts +0 -403
- package/dist/types-DZSJNt_M.d.ts +0 -392
- package/dist/types-DaaJiIjW.d.ts +0 -391
- package/dist/types-LUpWJwps.d.ts +0 -403
- package/dist/types-a7zVU6WE.d.ts +0 -394
- package/dist/types-biJTHMcH.d.ts +0 -403
- package/dist/types-ow_qSEYJ.d.ts +0 -392
- package/dist/types-wnLasZaB.d.ts +0 -1234
|
@@ -1,274 +0,0 @@
|
|
|
1
|
-
import * as react from 'react';
|
|
2
|
-
import { ReactNode, ComponentType } from 'react';
|
|
3
|
-
import { a5 as UIPlugin, a6 as UIPluginComponents, h as ActionStatusResult, r as ConfirmOptions, a0 as ToastApi, S as PermissionGateProps, g as ActionButtonProps, n as ButtonSlotProps, L as FormStatusProps, j as AvatarWithInitialsProps, V as RoleBadgeProps, C as ChipSlotProps, O as ImpersonationBannerProps, i as AlertSlotProps, s as DataTableProps, $ as TableSlotProps, y as FilterBarProps, m as BulkAction, o as ColumnDef, u as DropZoneProps, M as ImagePreviewProps, x as FileListProps, k as BreadcrumbItem, X as TabItem, P as ListViewProps, t as DetailViewProps } from './types-LUpWJwps.js';
|
|
4
|
-
import { ClientDescriptor, Serializable } from '@cfast/actions';
|
|
5
|
-
|
|
6
|
-
declare function createUIPlugin(config: {
|
|
7
|
-
components: Partial<UIPluginComponents>;
|
|
8
|
-
}): UIPlugin;
|
|
9
|
-
declare function UIPluginProvider({ plugin, children, }: {
|
|
10
|
-
plugin: UIPlugin;
|
|
11
|
-
children: React.ReactNode;
|
|
12
|
-
}): react.FunctionComponentElement<react.ProviderProps<UIPlugin | null>>;
|
|
13
|
-
declare function useUIPlugin(): UIPlugin | null;
|
|
14
|
-
declare function useComponent<K extends keyof UIPluginComponents>(slot: K): UIPluginComponents[K];
|
|
15
|
-
|
|
16
|
-
/**
|
|
17
|
-
* Returns the permission status and submit function for a single action
|
|
18
|
-
* from a composed action descriptor.
|
|
19
|
-
*
|
|
20
|
-
* If `actionName` is omitted, uses the first (or only) action in the descriptor.
|
|
21
|
-
*/
|
|
22
|
-
declare function useActionStatus(descriptor: ClientDescriptor, actionName?: string, input?: Record<string, Serializable>): ActionStatusResult;
|
|
23
|
-
|
|
24
|
-
type ConfirmFn = (options: ConfirmOptions) => Promise<boolean>;
|
|
25
|
-
/**
|
|
26
|
-
* Returns an imperative `confirm(options)` function that resolves to
|
|
27
|
-
* `true` (confirmed) or `false` (cancelled).
|
|
28
|
-
*
|
|
29
|
-
* Must be used within a `ConfirmProvider`.
|
|
30
|
-
*/
|
|
31
|
-
declare function useConfirm(): ConfirmFn;
|
|
32
|
-
|
|
33
|
-
/**
|
|
34
|
-
* Returns an imperative toast API.
|
|
35
|
-
*
|
|
36
|
-
* Must be used within a `ToastProvider`.
|
|
37
|
-
*/
|
|
38
|
-
declare function useToast(): ToastApi;
|
|
39
|
-
|
|
40
|
-
type ActionToastConfig = Record<string, {
|
|
41
|
-
success?: string;
|
|
42
|
-
error?: string;
|
|
43
|
-
}>;
|
|
44
|
-
/**
|
|
45
|
-
* Auto-shows toasts when action results come back.
|
|
46
|
-
*
|
|
47
|
-
* ```ts
|
|
48
|
-
* useActionToast(composed.client, {
|
|
49
|
-
* deletePost: { success: "Post deleted", error: "Failed to delete" },
|
|
50
|
-
* publishPost: { success: "Post published" },
|
|
51
|
-
* });
|
|
52
|
-
* ```
|
|
53
|
-
*/
|
|
54
|
-
declare function useActionToast(descriptor: ClientDescriptor, config: ActionToastConfig): void;
|
|
55
|
-
|
|
56
|
-
/**
|
|
57
|
-
* Conditionally renders children based on action permission status.
|
|
58
|
-
*
|
|
59
|
-
* - When permitted: renders children
|
|
60
|
-
* - When forbidden (not permitted, not invisible): renders fallback
|
|
61
|
-
* - When invisible: renders nothing
|
|
62
|
-
*/
|
|
63
|
-
declare function PermissionGate({ action, actionName, input, children, fallback, }: PermissionGateProps): react.FunctionComponentElement<react.FragmentProps> | null;
|
|
64
|
-
|
|
65
|
-
/**
|
|
66
|
-
* Permission-aware button that submits an action.
|
|
67
|
-
*
|
|
68
|
-
* - whenForbidden="hide": hidden when not permitted
|
|
69
|
-
* - whenForbidden="disable": shown but disabled when not permitted
|
|
70
|
-
* - whenForbidden="show": shown and clickable regardless of permission
|
|
71
|
-
*
|
|
72
|
-
* Supports a `confirmation` prop that, when set, will be used by
|
|
73
|
-
* the confirm system (wired in the Feedback PR).
|
|
74
|
-
*/
|
|
75
|
-
declare function ActionButton({ action, actionName, input, children, whenForbidden, confirmation: _confirmation, variant, color, size, startDecorator, }: ActionButtonProps): react.ReactElement<ButtonSlotProps, string | react.JSXElementConstructor<any>> | null;
|
|
76
|
-
|
|
77
|
-
/**
|
|
78
|
-
* Provides the `useConfirm()` context and renders the confirm dialog.
|
|
79
|
-
* Uses the plugin's `confirmDialog` slot for rendering.
|
|
80
|
-
*/
|
|
81
|
-
declare function ConfirmProvider({ children }: {
|
|
82
|
-
children: ReactNode;
|
|
83
|
-
}): react.FunctionComponentElement<react.ProviderProps<{
|
|
84
|
-
confirm: ConfirmFn;
|
|
85
|
-
} | null>>;
|
|
86
|
-
|
|
87
|
-
/**
|
|
88
|
-
* Displays action result feedback (success/error messages) using the
|
|
89
|
-
* plugin's `alert` slot.
|
|
90
|
-
*/
|
|
91
|
-
declare function FormStatus({ data }: FormStatusProps): react.DetailedReactHTMLElement<{
|
|
92
|
-
style: {
|
|
93
|
-
display: "flex";
|
|
94
|
-
flexDirection: "column";
|
|
95
|
-
gap: string;
|
|
96
|
-
};
|
|
97
|
-
}, HTMLElement> | null;
|
|
98
|
-
|
|
99
|
-
/**
|
|
100
|
-
* Extracts up to 2 initials from a name.
|
|
101
|
-
*/
|
|
102
|
-
declare function getInitials(name: string): string;
|
|
103
|
-
/**
|
|
104
|
-
* Headless AvatarWithInitials — renders an img or initials span.
|
|
105
|
-
*/
|
|
106
|
-
declare function AvatarWithInitials({ src, name, size, }: AvatarWithInitialsProps): react.DetailedReactHTMLElement<{
|
|
107
|
-
src: string;
|
|
108
|
-
alt: string;
|
|
109
|
-
style: {
|
|
110
|
-
width: 32 | 40 | 56;
|
|
111
|
-
height: 32 | 40 | 56;
|
|
112
|
-
borderRadius: string;
|
|
113
|
-
objectFit: "cover";
|
|
114
|
-
};
|
|
115
|
-
}, HTMLElement> | react.DetailedReactHTMLElement<{
|
|
116
|
-
"aria-label": string;
|
|
117
|
-
style: {
|
|
118
|
-
display: "inline-flex";
|
|
119
|
-
alignItems: "center";
|
|
120
|
-
justifyContent: "center";
|
|
121
|
-
width: 32 | 40 | 56;
|
|
122
|
-
height: 32 | 40 | 56;
|
|
123
|
-
borderRadius: string;
|
|
124
|
-
backgroundColor: "#ddd";
|
|
125
|
-
fontSize: number;
|
|
126
|
-
fontWeight: "bold";
|
|
127
|
-
};
|
|
128
|
-
}, HTMLElement>;
|
|
129
|
-
|
|
130
|
-
/**
|
|
131
|
-
* Colored badge displaying a user's role.
|
|
132
|
-
* Uses the plugin's `chip` slot for rendering.
|
|
133
|
-
*/
|
|
134
|
-
declare function RoleBadge({ role, colors }: RoleBadgeProps): react.ReactElement<ChipSlotProps, string | react.JSXElementConstructor<any>>;
|
|
135
|
-
|
|
136
|
-
/**
|
|
137
|
-
* Persistent banner shown when an admin is impersonating another user.
|
|
138
|
-
* Hidden when not impersonating.
|
|
139
|
-
*/
|
|
140
|
-
declare function ImpersonationBanner({ stopAction, }: ImpersonationBannerProps): react.ReactElement<AlertSlotProps, string | react.JSXElementConstructor<any>> | null;
|
|
141
|
-
|
|
142
|
-
/**
|
|
143
|
-
* Headless DataTable — renders a table with sorting, selection, and row actions.
|
|
144
|
-
*/
|
|
145
|
-
declare function DataTable<T = unknown>({ data, columns: columnsProp, selectable, selectedRows: externalSelectedRows, onSelectionChange, onRowClick, getRowId, emptyMessage, }: DataTableProps<T>): react.DetailedReactHTMLElement<{
|
|
146
|
-
style: {
|
|
147
|
-
textAlign: "center";
|
|
148
|
-
padding: string;
|
|
149
|
-
color: "#666";
|
|
150
|
-
};
|
|
151
|
-
}, HTMLElement> | react.ReactElement<TableSlotProps, string | react.JSXElementConstructor<any>>;
|
|
152
|
-
|
|
153
|
-
/**
|
|
154
|
-
* Headless FilterBar — URL-synced filter controls.
|
|
155
|
-
* Each filter serializes to URL search params.
|
|
156
|
-
*/
|
|
157
|
-
declare function FilterBar({ filters, searchable, }: FilterBarProps): react.DetailedReactHTMLElement<{
|
|
158
|
-
style: {
|
|
159
|
-
display: "flex";
|
|
160
|
-
gap: string;
|
|
161
|
-
flexWrap: "wrap";
|
|
162
|
-
alignItems: "center";
|
|
163
|
-
marginBottom: string;
|
|
164
|
-
};
|
|
165
|
-
}, HTMLElement>;
|
|
166
|
-
|
|
167
|
-
type BulkActionBarProps = {
|
|
168
|
-
selectedCount: number;
|
|
169
|
-
actions: BulkAction[];
|
|
170
|
-
onAction: (action: BulkAction) => void;
|
|
171
|
-
onClearSelection: () => void;
|
|
172
|
-
};
|
|
173
|
-
/**
|
|
174
|
-
* Headless BulkActionBar — shown when rows are selected.
|
|
175
|
-
* Displays count + action buttons + clear selection.
|
|
176
|
-
*/
|
|
177
|
-
declare function BulkActionBar({ selectedCount, actions, onAction, onClearSelection, }: BulkActionBarProps): react.DetailedReactHTMLElement<{
|
|
178
|
-
style: {
|
|
179
|
-
display: "flex";
|
|
180
|
-
alignItems: "center";
|
|
181
|
-
gap: string;
|
|
182
|
-
padding: string;
|
|
183
|
-
backgroundColor: "#f0f4ff";
|
|
184
|
-
borderRadius: string;
|
|
185
|
-
marginBottom: string;
|
|
186
|
-
};
|
|
187
|
-
}, HTMLElement> | null;
|
|
188
|
-
|
|
189
|
-
type InferredColumn = ColumnDef & {
|
|
190
|
-
field: ComponentType<{
|
|
191
|
-
value: unknown;
|
|
192
|
-
}>;
|
|
193
|
-
};
|
|
194
|
-
/**
|
|
195
|
-
* Inspects a Drizzle table's columns and returns inferred column definitions
|
|
196
|
-
* with appropriate TypedField components.
|
|
197
|
-
*
|
|
198
|
-
* @param table - A Drizzle table object (columns accessible via iteration)
|
|
199
|
-
* @param columns - Optional subset of column names to include
|
|
200
|
-
*/
|
|
201
|
-
declare function useColumnInference(table: Record<string, unknown> | undefined, columns?: string[]): InferredColumn[];
|
|
202
|
-
|
|
203
|
-
/**
|
|
204
|
-
* Headless DropZone — drag-and-drop file upload area.
|
|
205
|
-
* Integrates with `useUpload()` from `@cfast/storage/client`.
|
|
206
|
-
*/
|
|
207
|
-
declare function DropZone({ upload, multiple, children, }: DropZoneProps): react.DetailedReactHTMLElement<react.HTMLAttributes<HTMLElement>, HTMLElement>;
|
|
208
|
-
|
|
209
|
-
/**
|
|
210
|
-
* Headless ImagePreview — displays an image from storage or direct src.
|
|
211
|
-
*/
|
|
212
|
-
declare function ImagePreview({ fileKey, src, getUrl, width, height, fallback, alt, }: ImagePreviewProps): react.DetailedReactHTMLElement<react.HTMLAttributes<HTMLElement>, HTMLElement> | react.DetailedReactHTMLElement<{
|
|
213
|
-
style: {
|
|
214
|
-
width: number;
|
|
215
|
-
height: number;
|
|
216
|
-
backgroundColor: "#f5f5f5";
|
|
217
|
-
display: "flex";
|
|
218
|
-
alignItems: "center";
|
|
219
|
-
justifyContent: "center";
|
|
220
|
-
borderRadius: string;
|
|
221
|
-
color: "#999";
|
|
222
|
-
};
|
|
223
|
-
}, HTMLElement> | react.DetailedReactHTMLElement<{
|
|
224
|
-
src: string;
|
|
225
|
-
alt: string;
|
|
226
|
-
style: {
|
|
227
|
-
width: number;
|
|
228
|
-
height: number;
|
|
229
|
-
objectFit: "cover";
|
|
230
|
-
borderRadius: string;
|
|
231
|
-
};
|
|
232
|
-
}, HTMLElement>;
|
|
233
|
-
|
|
234
|
-
/**
|
|
235
|
-
* Headless FileList — displays a list of files with download links.
|
|
236
|
-
*/
|
|
237
|
-
declare function FileList({ files, onDownload, }: FileListProps): react.DetailedReactHTMLElement<{
|
|
238
|
-
style: {
|
|
239
|
-
color: "#999";
|
|
240
|
-
};
|
|
241
|
-
}, HTMLElement> | react.DetailedReactHTMLElement<{
|
|
242
|
-
style: {
|
|
243
|
-
listStyle: "none";
|
|
244
|
-
padding: number;
|
|
245
|
-
margin: number;
|
|
246
|
-
};
|
|
247
|
-
"data-testid": string;
|
|
248
|
-
}, HTMLElement>;
|
|
249
|
-
|
|
250
|
-
type PageContainerProps = {
|
|
251
|
-
title?: string;
|
|
252
|
-
breadcrumb?: BreadcrumbItem[];
|
|
253
|
-
actions?: ReactNode;
|
|
254
|
-
tabs?: TabItem[];
|
|
255
|
-
children: ReactNode;
|
|
256
|
-
};
|
|
257
|
-
/**
|
|
258
|
-
* Page wrapper with title, breadcrumb, tabs, and action toolbar.
|
|
259
|
-
*/
|
|
260
|
-
declare function PageContainer({ title, breadcrumb, actions, tabs: _tabs, children, }: PageContainerProps): react.FunctionComponentElement<react.FragmentProps>;
|
|
261
|
-
|
|
262
|
-
/**
|
|
263
|
-
* Composite ListView — composes PageContainer, FilterBar, DataTable,
|
|
264
|
-
* EmptyState, BulkActionBar, and pagination controls.
|
|
265
|
-
*/
|
|
266
|
-
declare function ListView<T = unknown>({ title, data, table: _table, columns, actions: _actions, filters, searchable, createAction, createLabel, selectable, bulkActions, breadcrumb, }: ListViewProps<T>): react.FunctionComponentElement<PageContainerProps>;
|
|
267
|
-
|
|
268
|
-
/**
|
|
269
|
-
* Composite DetailView — displays a single record's fields in a two-column grid.
|
|
270
|
-
* Composes PageContainer + TypedField rendering.
|
|
271
|
-
*/
|
|
272
|
-
declare function DetailView<T = unknown>({ title, table, record, fields: fieldsProp, exclude, breadcrumb, }: DetailViewProps<T>): react.FunctionComponentElement<PageContainerProps>;
|
|
273
|
-
|
|
274
|
-
export { ActionButton as A, BulkActionBar as B, ConfirmProvider as C, DataTable as D, FileList as F, ImagePreview as I, ListView as L, PageContainer as P, RoleBadge as R, UIPluginProvider as U, AvatarWithInitials as a, DetailView as b, DropZone as c, FilterBar as d, FormStatus as e, ImpersonationBanner as f, PermissionGate as g, createUIPlugin as h, getInitials as i, useActionStatus as j, useActionToast as k, useColumnInference as l, useConfirm as m, useToast as n, useUIPlugin as o, useComponent as u };
|