@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.
- package/README.md +23 -23
- package/dist/chunk-PWBG6CGF.js +1400 -0
- package/dist/{permission-gate-DVmY42oz.d.ts → client-CIx8_tmv.d.ts} +617 -2
- package/dist/client.d.ts +4 -617
- package/dist/client.js +6 -8
- package/dist/index.d.ts +52 -5
- package/dist/index.js +17 -13
- package/llms.txt +159 -0
- package/package.json +25 -41
- 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-JEGEIQ3R.js +0 -925
- 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-RDTUEOLK.js +0 -486
- 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/joy.d.ts +0 -199
- package/dist/joy.js +0 -1150
- 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
package/dist/index.d.ts
CHANGED
|
@@ -1,9 +1,8 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
export { h as ActionButtonProps, i as AlertSlotProps, j as AppShellSlotProps, k as AvatarWithInitialsProps, l as BaseFieldProps, m as BreadcrumbSlotProps, n as BulkAction, o as ButtonSlotProps, C as ChipSlotProps, p as ColumnDef, q as ColumnShorthand, r as ConfirmDialogSlotProps, s as ConfirmOptions, t as DataTableProps, u as DetailViewProps, v as DropZoneProps, w as DropZoneSlotProps, x as FileListFile, y as FileListProps, z as FilterBarProps, G as FilterDef, H as FilterOption, K as FilterType, L as FormStatusData, M as FormStatusProps, O as ImagePreviewProps, P as ImpersonationBannerProps, Q as ListViewProps, S as PageContainerSlotProps, V as PermissionGate, W as PermissionGateProps, X as RoleBadgeProps, Y as SidebarSlotProps, Z as TableCellSlotProps, _ as TableRowSlotProps, $ as TableSectionSlotProps, a0 as TableSlotProps, a1 as ToastApi, a2 as ToastOptions, a3 as ToastSlotProps, a4 as ToastType, a5 as TooltipSlotProps, a6 as UIPlugin, a7 as UIPluginComponents, a8 as UserMenuLink, a9 as WhenForbidden } from './permission-gate-DVmY42oz.js';
|
|
1
|
+
import { D as DateFieldProps, B as BooleanFieldProps, N as NumberFieldProps, T as TextFieldProps, E as EmailFieldProps, U as UrlFieldProps, I as ImageFieldProps, F as FileFieldProps, R as RelationFieldProps, J as JsonFieldProps, a as FieldComponent, b as EmptyStateProps, c as NavigationProgressProps, d as BreadcrumbItem, e as TabItem, A as AppShellProps, f as NavigationItem, g as UserMenuProps } from './client-CIx8_tmv.js';
|
|
2
|
+
export { h as ActionButton, i as ActionButtonProps, j as AlertSlotProps, k as AppShellSlotProps, l as AvatarWithInitials, m as AvatarWithInitialsProps, n as BaseFieldProps, o as BreadcrumbSlotProps, p as BulkAction, q as BulkActionBar, r as ButtonSlotProps, C as ChipSlotProps, s as ColumnDef, t as ColumnShorthand, u as ConfirmDialogSlotProps, v as ConfirmOptions, w as ConfirmProvider, x as DataTable, y as DataTableProps, z as DetailView, G as DetailViewProps, H as DropZone, K as DropZoneProps, L as DropZoneSlotProps, M as FileList, O as FileListFile, P as FileListProps, Q as FilterBar, S as FilterBarProps, V as FilterDef, W as FilterOption, X as FilterType, Y as FormStatus, Z as FormStatusData, _ as FormStatusProps, $ as ImagePreview, a0 as ImagePreviewProps, a1 as ImpersonationBanner, a2 as ImpersonationBannerProps, a3 as ListView, a4 as ListViewProps, a5 as PageContainerSlotProps, a6 as PermissionGate, a7 as PermissionGateProps, a8 as RoleBadge, a9 as RoleBadgeProps, aa as SidebarSlotProps, ab as TableCellSlotProps, ac as TableRowSlotProps, ad as TableSectionSlotProps, ae as TableSlotProps, af as ToastApi, ag as ToastContext, ah as ToastOptions, ai as ToastSlotProps, aj as ToastType, ak as TooltipSlotProps, al as UIPlugin, am as UIPluginComponents, an as UIPluginProvider, ao as UserMenuLink, ap as WhenForbidden, aq as createUIPlugin, ar as getInitials, as as useActionToast, at as useColumnInference, au as useComponent, av as useConfirm, aw as useToast, ax as useUIPlugin } from './client-CIx8_tmv.js';
|
|
4
3
|
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
5
4
|
import { ReactNode } from 'react';
|
|
6
|
-
import '@cfast/actions/client';
|
|
5
|
+
import { ClientDescriptor, ActionHookResult } from '@cfast/actions/client';
|
|
7
6
|
|
|
8
7
|
/**
|
|
9
8
|
* Read-only display component that formats date values.
|
|
@@ -412,4 +411,52 @@ declare function AppShellHeader({ children, userMenu, }: {
|
|
|
412
411
|
*/
|
|
413
412
|
declare function UserMenu({ links, onSignOut, }: UserMenuProps): react_jsx_runtime.JSX.Element | null;
|
|
414
413
|
|
|
415
|
-
|
|
414
|
+
/**
|
|
415
|
+
* Safely retrieves a property from an unknown record-like value by string key.
|
|
416
|
+
*
|
|
417
|
+
* Isolates the single unavoidable `Record<string, unknown>` assertion needed
|
|
418
|
+
* when accessing dynamic keys on generic row/record objects (e.g., in DataTable
|
|
419
|
+
* and DetailView). Using this helper keeps the rest of the codebase cast-free.
|
|
420
|
+
*
|
|
421
|
+
* Returns `undefined` for non-object or null values.
|
|
422
|
+
*
|
|
423
|
+
* @param obj - A value expected to be a record-like object.
|
|
424
|
+
* @param key - The property name to look up.
|
|
425
|
+
* @returns The property value, or `undefined` if the key does not exist or obj is not an object.
|
|
426
|
+
*
|
|
427
|
+
* @internal
|
|
428
|
+
*/
|
|
429
|
+
declare function getField(obj: unknown, key: string): unknown;
|
|
430
|
+
/**
|
|
431
|
+
* Extracts a string or number `id` from an unknown value.
|
|
432
|
+
*
|
|
433
|
+
* Returns the `id` property when it is a `string` or `number`, otherwise
|
|
434
|
+
* falls back to `0`. Isolates the dynamic-key access so callers avoid casts.
|
|
435
|
+
*
|
|
436
|
+
* @param obj - A value expected to be a record-like object with an `id` property.
|
|
437
|
+
* @returns The `id` value as a `string | number`, or `0` if missing/wrong type.
|
|
438
|
+
*
|
|
439
|
+
* @internal
|
|
440
|
+
*/
|
|
441
|
+
declare function getRecordId(obj: unknown): string | number;
|
|
442
|
+
|
|
443
|
+
/**
|
|
444
|
+
* Returns the permission status and submit function for the first action in a descriptor.
|
|
445
|
+
*
|
|
446
|
+
* Convenience wrapper around `useActions()` for single-action descriptors
|
|
447
|
+
* (e.g. a create action passed to EmptyState or a navigation item guard).
|
|
448
|
+
*
|
|
449
|
+
* @param descriptor - Client-side action descriptor from `@cfast/actions`
|
|
450
|
+
* @returns The ActionHookResult with `permitted`, `invisible`, `pending`, and `submit`
|
|
451
|
+
*
|
|
452
|
+
* @example
|
|
453
|
+
* ```ts
|
|
454
|
+
* const status = useActionStatus(createPost.client);
|
|
455
|
+
* if (status.permitted) {
|
|
456
|
+
* status.submit({ title: "New Post" });
|
|
457
|
+
* }
|
|
458
|
+
* ```
|
|
459
|
+
*/
|
|
460
|
+
declare function useActionStatus(descriptor: ClientDescriptor): ActionHookResult;
|
|
461
|
+
|
|
462
|
+
export { AppShell, AppShellHeader, AppShellProps, AppShellSidebar, BooleanField, BooleanFieldProps, BreadcrumbItem, DateField, DateFieldProps, EmailField, EmailFieldProps, EmptyState, EmptyStateProps, FileField, FileFieldProps, ImageField, ImageFieldProps, JsonField, JsonFieldProps, NavigationItem, NavigationProgress, NavigationProgressProps, NumberField, NumberFieldProps, PageContainer, RelationField, RelationFieldProps, TabItem, TextField, TextFieldProps, UrlField, UrlFieldProps, UserMenu, UserMenuProps, fieldForColumn, fieldsForTable, getField, getRecordId, useActionStatus };
|
package/dist/index.js
CHANGED
|
@@ -1,43 +1,43 @@
|
|
|
1
1
|
import {
|
|
2
2
|
ActionButton,
|
|
3
|
+
AvatarWithInitials,
|
|
4
|
+
BooleanField,
|
|
3
5
|
BulkActionBar,
|
|
4
6
|
ConfirmProvider,
|
|
5
7
|
DataTable,
|
|
8
|
+
DateField,
|
|
6
9
|
DetailView,
|
|
7
10
|
DropZone,
|
|
11
|
+
EmailField,
|
|
8
12
|
EmptyState,
|
|
9
13
|
FileList,
|
|
10
14
|
FilterBar,
|
|
11
15
|
FormStatus,
|
|
12
16
|
ImagePreview,
|
|
13
17
|
ImpersonationBanner,
|
|
14
|
-
ListView,
|
|
15
|
-
PageContainer,
|
|
16
|
-
RoleBadge,
|
|
17
|
-
useActionToast,
|
|
18
|
-
useColumnInference,
|
|
19
|
-
useConfirm
|
|
20
|
-
} from "./chunk-JEGEIQ3R.js";
|
|
21
|
-
import {
|
|
22
|
-
AvatarWithInitials,
|
|
23
|
-
BooleanField,
|
|
24
|
-
DateField,
|
|
25
|
-
EmailField,
|
|
26
18
|
JsonField,
|
|
19
|
+
ListView,
|
|
27
20
|
NumberField,
|
|
21
|
+
PageContainer,
|
|
28
22
|
PermissionGate,
|
|
23
|
+
RoleBadge,
|
|
29
24
|
TextField,
|
|
25
|
+
ToastContext,
|
|
30
26
|
UIPluginProvider,
|
|
31
27
|
createUIPlugin,
|
|
32
28
|
fieldForColumn,
|
|
33
29
|
fieldsForTable,
|
|
34
30
|
getField,
|
|
35
31
|
getInitials,
|
|
32
|
+
getRecordId,
|
|
36
33
|
useActionStatus,
|
|
34
|
+
useActionToast,
|
|
35
|
+
useColumnInference,
|
|
37
36
|
useComponent,
|
|
37
|
+
useConfirm,
|
|
38
38
|
useToast,
|
|
39
39
|
useUIPlugin
|
|
40
|
-
} from "./chunk-
|
|
40
|
+
} from "./chunk-PWBG6CGF.js";
|
|
41
41
|
|
|
42
42
|
// src/fields/url-field.tsx
|
|
43
43
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
@@ -280,13 +280,17 @@ export {
|
|
|
280
280
|
RelationField,
|
|
281
281
|
RoleBadge,
|
|
282
282
|
TextField,
|
|
283
|
+
ToastContext,
|
|
283
284
|
UIPluginProvider,
|
|
284
285
|
UrlField,
|
|
285
286
|
UserMenu,
|
|
286
287
|
createUIPlugin,
|
|
287
288
|
fieldForColumn,
|
|
288
289
|
fieldsForTable,
|
|
290
|
+
getField,
|
|
289
291
|
getInitials,
|
|
292
|
+
getRecordId,
|
|
293
|
+
useActionStatus,
|
|
290
294
|
useActionToast,
|
|
291
295
|
useColumnInference,
|
|
292
296
|
useComponent,
|
package/llms.txt
ADDED
|
@@ -0,0 +1,159 @@
|
|
|
1
|
+
# @cfast/ui
|
|
2
|
+
|
|
3
|
+
> Permission-aware UI components for cfast apps: data tables, page shells, typed fields, file uploads, and action feedback -- all wired to the framework.
|
|
4
|
+
|
|
5
|
+
## When to use
|
|
6
|
+
|
|
7
|
+
Use `@cfast/ui` when building data-driven pages in a cfast app. It sits between your primitive component library (MUI Joy UI) and your application code, providing "smart" components that integrate with `@cfast/db`, `@cfast/actions`, `@cfast/permissions`, `@cfast/pagination`, `@cfast/auth`, and `@cfast/storage`.
|
|
8
|
+
|
|
9
|
+
Import styled components from `@cfast/joy`. Import headless components and hooks from `@cfast/ui`.
|
|
10
|
+
|
|
11
|
+
## Key concepts
|
|
12
|
+
|
|
13
|
+
- **Headless core + UI plugins**: `@cfast/ui` exports hooks and logic. `@cfast/joy` exports Joy UI styled implementations. Custom plugins can provide other UI libraries via `createUIPlugin()`.
|
|
14
|
+
- **Permission-aware**: Components like `ActionButton`, `PermissionGate`, `EmptyState`, sidebar nav items, and `BulkActionBar` automatically hide/disable based on `@cfast/actions` permission status.
|
|
15
|
+
- **Schema-driven**: Pass a Drizzle `table` to `DataTable`, `FilterBar`, `DetailView`, or `useColumnInference()` and columns/fields/filters are inferred from column types.
|
|
16
|
+
- **URL-synced**: `FilterBar` serializes filter state to URL search params. `DataTable` sorting syncs to URL params. Both work with `@cfast/pagination`'s `parseParams()` in loaders.
|
|
17
|
+
|
|
18
|
+
## API Reference
|
|
19
|
+
|
|
20
|
+
### Hooks (from `@cfast/ui`)
|
|
21
|
+
|
|
22
|
+
```typescript
|
|
23
|
+
useActionStatus(descriptor: ClientDescriptor): ActionHookResult
|
|
24
|
+
// Returns { permitted, invisible, pending, submit } for a single action.
|
|
25
|
+
|
|
26
|
+
useToast(): ToastApi
|
|
27
|
+
// Returns { show, success, error, info, warning } methods. Requires <ToastProvider>.
|
|
28
|
+
|
|
29
|
+
useActionToast(descriptor: ClientDescriptor, config: Record<string, { success?: string; error?: string }>): void
|
|
30
|
+
// Auto-shows toasts when action results arrive.
|
|
31
|
+
|
|
32
|
+
useConfirm(): ConfirmFn
|
|
33
|
+
// Returns async (options: ConfirmOptions) => Promise<boolean>. Requires <ConfirmProvider>.
|
|
34
|
+
|
|
35
|
+
useColumnInference(table: Record<string, unknown> | undefined, columns?: string[]): InferredColumn[]
|
|
36
|
+
// Maps Drizzle table columns to TypedField components. Memoized.
|
|
37
|
+
```
|
|
38
|
+
|
|
39
|
+
### Components (from `@cfast/joy`)
|
|
40
|
+
|
|
41
|
+
**Data display:**
|
|
42
|
+
- `DataTable` -- table with sorting, selection, row actions, skeleton loading. Accepts `data` (pagination result), `table` (Drizzle), `columns`, `actions`, `selectable`.
|
|
43
|
+
- `FilterBar` -- URL-synced filters. Accepts `table`, `filters` (array of FilterDef), `searchable`.
|
|
44
|
+
- `ListView` -- full page: title + filters + data table + pagination + empty state + bulk actions.
|
|
45
|
+
- `DetailView` -- read-only detail page for a single record. Auto-lays out TypedFields.
|
|
46
|
+
|
|
47
|
+
**Layout:**
|
|
48
|
+
- `AppShell` -- sidebar + header + content. Sub-components: `AppShellSidebar`, `AppShellHeader`.
|
|
49
|
+
- `PageContainer` -- title + breadcrumb + tabs + action toolbar.
|
|
50
|
+
- `UserMenu` -- header dropdown with avatar, role badge, auth actions.
|
|
51
|
+
- `NavigationProgress` -- thin progress bar during React Router navigation.
|
|
52
|
+
|
|
53
|
+
**Actions & feedback:**
|
|
54
|
+
- `ActionButton` -- permission-aware button wrapping a `@cfast/actions` action. Props: `action`, `input`, `whenForbidden: "hide" | "disable" | "show"`, `confirmation`.
|
|
55
|
+
- `PermissionGate` -- conditional render based on action permissions. Props: `action`, `input`, `fallback`.
|
|
56
|
+
- `ConfirmDialog` -- standalone confirmation dialog.
|
|
57
|
+
- `ToastProvider` -- mount once in root layout for toast notifications.
|
|
58
|
+
- `FormStatus` -- renders success/error/validation from action results.
|
|
59
|
+
- `BulkActionBar` -- toolbar for selected rows with bulk actions.
|
|
60
|
+
|
|
61
|
+
**Files:**
|
|
62
|
+
- `DropZone` -- drag-and-drop upload. Integrates with `@cfast/storage`'s `useUpload()`.
|
|
63
|
+
- `ImagePreview` -- displays image from storage with signed URL handling.
|
|
64
|
+
- `FileList` -- list of uploaded files with download/delete.
|
|
65
|
+
|
|
66
|
+
**Utilities:**
|
|
67
|
+
- `AvatarWithInitials` -- avatar with automatic initials fallback.
|
|
68
|
+
- `RoleBadge` -- colored chip for user role.
|
|
69
|
+
- `ImpersonationBanner` -- persistent banner when impersonating.
|
|
70
|
+
- `EmptyState` -- permission-aware empty state with optional create CTA.
|
|
71
|
+
|
|
72
|
+
### TypedField components (from `@cfast/ui`)
|
|
73
|
+
|
|
74
|
+
```typescript
|
|
75
|
+
DateField, BooleanField, NumberField, TextField,
|
|
76
|
+
EmailField, UrlField, ImageField, FileField,
|
|
77
|
+
RelationField, JsonField
|
|
78
|
+
fieldForColumn(columnMeta): ComponentType // maps Drizzle column type to field
|
|
79
|
+
fieldsForTable(table): Record<string, ComponentType> // field map for whole table
|
|
80
|
+
```
|
|
81
|
+
|
|
82
|
+
### Plugin API
|
|
83
|
+
|
|
84
|
+
```typescript
|
|
85
|
+
createUIPlugin({ components: { button, tooltip, table, ... } }): UIPlugin
|
|
86
|
+
UIPluginProvider // React provider for custom UI plugins
|
|
87
|
+
useUIPlugin(): UIPlugin
|
|
88
|
+
useComponent(slotName: string): ComponentType
|
|
89
|
+
```
|
|
90
|
+
|
|
91
|
+
## Usage Examples
|
|
92
|
+
|
|
93
|
+
### Full list page
|
|
94
|
+
|
|
95
|
+
```typescript
|
|
96
|
+
import { ListView } from "@cfast/joy";
|
|
97
|
+
import { usePagination } from "@cfast/pagination";
|
|
98
|
+
import { posts } from "~/db/schema";
|
|
99
|
+
|
|
100
|
+
function PostsPage() {
|
|
101
|
+
const pagination = usePagination<Post>();
|
|
102
|
+
return (
|
|
103
|
+
<ListView
|
|
104
|
+
title="Blog Posts"
|
|
105
|
+
data={pagination}
|
|
106
|
+
table={posts}
|
|
107
|
+
columns={["title", "author", "published", "createdAt"]}
|
|
108
|
+
actions={composed.client}
|
|
109
|
+
filters={[{ column: "published", type: "select", options: publishedOptions }]}
|
|
110
|
+
searchable={["title", "content"]}
|
|
111
|
+
createAction={createPost.client}
|
|
112
|
+
selectable
|
|
113
|
+
/>
|
|
114
|
+
);
|
|
115
|
+
}
|
|
116
|
+
```
|
|
117
|
+
|
|
118
|
+
### Permission-aware button with confirmation
|
|
119
|
+
|
|
120
|
+
```typescript
|
|
121
|
+
import { ActionButton } from "@cfast/joy";
|
|
122
|
+
|
|
123
|
+
<ActionButton
|
|
124
|
+
action={deletePost}
|
|
125
|
+
input={{ postId }}
|
|
126
|
+
whenForbidden="disable"
|
|
127
|
+
confirmation="Delete this post?"
|
|
128
|
+
>
|
|
129
|
+
Delete
|
|
130
|
+
</ActionButton>
|
|
131
|
+
```
|
|
132
|
+
|
|
133
|
+
### Auto-toast on action results
|
|
134
|
+
|
|
135
|
+
```typescript
|
|
136
|
+
import { useActionToast } from "@cfast/ui";
|
|
137
|
+
|
|
138
|
+
useActionToast(composed.client, {
|
|
139
|
+
deletePost: { success: "Post deleted", error: "Failed to delete" },
|
|
140
|
+
publishPost: { success: "Post published" },
|
|
141
|
+
});
|
|
142
|
+
```
|
|
143
|
+
|
|
144
|
+
## Integration
|
|
145
|
+
|
|
146
|
+
- **@cfast/actions** -- `ActionButton`, `PermissionGate`, `BulkActionBar`, `useActionToast` consume action descriptors.
|
|
147
|
+
- **@cfast/pagination** -- `DataTable` and `ListView` accept pagination hook results. `FilterBar` serializes to URL params that `parseParams()` reads.
|
|
148
|
+
- **@cfast/db** -- Drizzle schema drives column inference, filter type inference, and field type inference.
|
|
149
|
+
- **@cfast/auth** -- `UserMenu` reads `useCurrentUser()`. `ImpersonationBanner` reads impersonation state.
|
|
150
|
+
- **@cfast/storage** -- `DropZone` integrates with `useUpload()`. `ImagePreview`/`FileList` use storage URLs.
|
|
151
|
+
- **@cfast/admin** -- Admin uses `ListView`, `DetailView`, `DataTable`, `FilterBar`, `AppShell`, etc. Admin generates config; UI renders pixels.
|
|
152
|
+
|
|
153
|
+
## Common Mistakes
|
|
154
|
+
|
|
155
|
+
- Importing from `@cfast/joy` on the server -- Joy components are client-only. Use headless exports from `@cfast/ui` for server-safe code.
|
|
156
|
+
- Forgetting `<ToastProvider>` in root layout -- `useToast()` and `useActionToast()` throw without it.
|
|
157
|
+
- Forgetting `<ConfirmProvider>` -- `useConfirm()` and `ActionButton` with `confirmation` need it.
|
|
158
|
+
- Passing raw data arrays to `DataTable` instead of a pagination result from `usePagination()`.
|
|
159
|
+
- Using `whenForbidden="show"` on `ActionButton` when you mean `"disable"` -- `"show"` renders even when forbidden with no visual indicator.
|
package/package.json
CHANGED
|
@@ -1,7 +1,14 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@cfast/ui",
|
|
3
|
-
"version": "0.0
|
|
3
|
+
"version": "0.2.0",
|
|
4
4
|
"description": "Permission-aware React components with UI library plugins",
|
|
5
|
+
"keywords": [
|
|
6
|
+
"cfast",
|
|
7
|
+
"cloudflare-workers",
|
|
8
|
+
"react",
|
|
9
|
+
"ui",
|
|
10
|
+
"permissions"
|
|
11
|
+
],
|
|
5
12
|
"license": "MIT",
|
|
6
13
|
"repository": {
|
|
7
14
|
"type": "git",
|
|
@@ -16,52 +23,40 @@
|
|
|
16
23
|
"import": "./dist/index.js",
|
|
17
24
|
"types": "./dist/index.d.ts"
|
|
18
25
|
},
|
|
19
|
-
"./joy": {
|
|
20
|
-
"import": "./dist/joy.js",
|
|
21
|
-
"types": "./dist/joy.d.ts"
|
|
22
|
-
},
|
|
23
26
|
"./client": {
|
|
24
27
|
"import": "./dist/client.js",
|
|
25
28
|
"types": "./dist/client.d.ts"
|
|
26
29
|
}
|
|
27
30
|
},
|
|
28
31
|
"files": [
|
|
29
|
-
"dist"
|
|
32
|
+
"dist",
|
|
33
|
+
"llms.txt"
|
|
30
34
|
],
|
|
31
35
|
"sideEffects": false,
|
|
32
36
|
"publishConfig": {
|
|
33
37
|
"access": "public"
|
|
34
38
|
},
|
|
39
|
+
"scripts": {
|
|
40
|
+
"build": "tsup src/index.ts src/client.ts --format esm --dts",
|
|
41
|
+
"dev": "tsup src/index.ts src/client.ts --format esm --dts --watch",
|
|
42
|
+
"typecheck": "tsc --noEmit",
|
|
43
|
+
"lint": "eslint src/",
|
|
44
|
+
"test": "vitest run"
|
|
45
|
+
},
|
|
35
46
|
"peerDependencies": {
|
|
36
|
-
"@mui/joy": ">=5.0.0-beta.0",
|
|
37
47
|
"react": ">=19",
|
|
38
48
|
"react-dom": ">=19",
|
|
39
|
-
"react-router": ">=7"
|
|
40
|
-
"sonner": ">=2"
|
|
41
|
-
},
|
|
42
|
-
"peerDependenciesMeta": {
|
|
43
|
-
"@mui/joy": {
|
|
44
|
-
"optional": true
|
|
45
|
-
},
|
|
46
|
-
"sonner": {
|
|
47
|
-
"optional": true
|
|
48
|
-
}
|
|
49
|
+
"react-router": ">=7"
|
|
49
50
|
},
|
|
50
51
|
"dependencies": {
|
|
51
|
-
"@cfast/actions": "
|
|
52
|
-
"@cfast/
|
|
53
|
-
"@cfast/
|
|
54
|
-
"@cfast/
|
|
55
|
-
"@cfast/
|
|
56
|
-
"@cfast/
|
|
52
|
+
"@cfast/actions": "workspace:*",
|
|
53
|
+
"@cfast/auth": "workspace:*",
|
|
54
|
+
"@cfast/db": "workspace:*",
|
|
55
|
+
"@cfast/pagination": "workspace:*",
|
|
56
|
+
"@cfast/permissions": "workspace:*",
|
|
57
|
+
"@cfast/storage": "workspace:*"
|
|
57
58
|
},
|
|
58
59
|
"devDependencies": {
|
|
59
|
-
"@emotion/react": "^11.14.0",
|
|
60
|
-
"@emotion/styled": "^11.14.1",
|
|
61
|
-
"@mui/joy": "^5.0.0-beta.52",
|
|
62
|
-
"@mui/material": "^6.5.0",
|
|
63
|
-
"@storybook/react": "^8.6.14",
|
|
64
|
-
"@storybook/react-vite": "^8.6.14",
|
|
65
60
|
"@testing-library/react": "^16.3.0",
|
|
66
61
|
"@types/react": "^19.1.6",
|
|
67
62
|
"@types/react-dom": "^19.1.6",
|
|
@@ -70,19 +65,8 @@
|
|
|
70
65
|
"react": "^19.1.0",
|
|
71
66
|
"react-dom": "^19.1.0",
|
|
72
67
|
"react-router": "^7.12.0",
|
|
73
|
-
"sonner": "^2.0.3",
|
|
74
|
-
"storybook": "^8.6.14",
|
|
75
68
|
"tsup": "^8",
|
|
76
69
|
"typescript": "^5.7",
|
|
77
70
|
"vitest": "^4.1.0"
|
|
78
|
-
},
|
|
79
|
-
"scripts": {
|
|
80
|
-
"build": "tsup src/index.ts src/joy.ts src/client.ts --format esm --dts",
|
|
81
|
-
"dev": "tsup src/index.ts src/joy.ts src/client.ts --format esm --dts --watch",
|
|
82
|
-
"typecheck": "tsc --noEmit",
|
|
83
|
-
"lint": "eslint src/",
|
|
84
|
-
"test": "vitest run",
|
|
85
|
-
"storybook": "storybook dev -p 6006",
|
|
86
|
-
"build-storybook": "storybook build"
|
|
87
71
|
}
|
|
88
|
-
}
|
|
72
|
+
}
|
package/LICENSE
DELETED
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
MIT License
|
|
2
|
-
|
|
3
|
-
Copyright (c) 2026 Daniel Schmidt
|
|
4
|
-
|
|
5
|
-
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
-
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
-
in the Software without restriction, including without limitation the rights
|
|
8
|
-
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
-
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
-
furnished to do so, subject to the following conditions:
|
|
11
|
-
|
|
12
|
-
The above copyright notice and this permission notice shall be included in all
|
|
13
|
-
copies or substantial portions of the Software.
|
|
14
|
-
|
|
15
|
-
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
-
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
-
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
-
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
-
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
-
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
-
SOFTWARE.
|