@cfast/ui 0.1.0 → 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 +6 -6
- package/package.json +5 -29
- package/dist/chunk-JEGEIQ3R.js +0 -925
- package/dist/chunk-RDTUEOLK.js +0 -486
- package/dist/joy.d.ts +0 -199
- package/dist/joy.js +0 -1150
package/README.md
CHANGED
|
@@ -35,7 +35,7 @@ Admin's job is **schema introspection → configuration**: it reads your Drizzle
|
|
|
35
35
|
|
|
36
36
|
### Headless core + plugins
|
|
37
37
|
|
|
38
|
-
Same architecture as before, expanded to cover all component categories. The headless core (`@cfast/ui`) provides hooks, logic, and unstyled components. The Joy UI plugin (`@cfast/
|
|
38
|
+
Same architecture as before, expanded to cover all component categories. The headless core (`@cfast/ui`) provides hooks, logic, and unstyled components. The Joy UI plugin (`@cfast/joy`) provides styled implementations. Third-party plugins can add shadcn, Mantine, or any other library.
|
|
39
39
|
|
|
40
40
|
The plugin contract maps component slots to implementations:
|
|
41
41
|
|
|
@@ -78,7 +78,7 @@ Plugins only need to implement the slots they care about. Missing slots fall bac
|
|
|
78
78
|
A table component that integrates with `@cfast/pagination`, `@cfast/db`, `@cfast/permissions`, and `@cfast/actions`.
|
|
79
79
|
|
|
80
80
|
```typescript
|
|
81
|
-
import { DataTable } from "@cfast/
|
|
81
|
+
import { DataTable } from "@cfast/joy";
|
|
82
82
|
import { usePagination } from "@cfast/pagination/client";
|
|
83
83
|
import { posts } from "~/db/schema";
|
|
84
84
|
|
|
@@ -129,7 +129,7 @@ function PostsTable() {
|
|
|
129
129
|
URL-synced filter controls. Column types from Drizzle schema determine the filter input type.
|
|
130
130
|
|
|
131
131
|
```typescript
|
|
132
|
-
import { FilterBar } from "@cfast/
|
|
132
|
+
import { FilterBar } from "@cfast/joy";
|
|
133
133
|
import { posts } from "~/db/schema";
|
|
134
134
|
|
|
135
135
|
function PostFilters() {
|
|
@@ -174,7 +174,7 @@ function PostFilters() {
|
|
|
174
174
|
Read-only display components that format values based on their type. Used by `<DataTable>` cell renderers and `<DetailView>` field layouts.
|
|
175
175
|
|
|
176
176
|
```typescript
|
|
177
|
-
import { DateField, BooleanField, EmailField, ImageField, RelationField } from "@cfast/
|
|
177
|
+
import { DateField, BooleanField, EmailField, ImageField, RelationField } from "@cfast/joy";
|
|
178
178
|
|
|
179
179
|
<DateField value={post.createdAt} format="relative" />
|
|
180
180
|
// → "3 days ago"
|
|
@@ -215,7 +215,7 @@ import { DateField, BooleanField, EmailField, ImageField, RelationField } from "
|
|
|
215
215
|
Permission-aware empty state. Shows different content based on whether the user can create records.
|
|
216
216
|
|
|
217
217
|
```typescript
|
|
218
|
-
import { EmptyState } from "@cfast/
|
|
218
|
+
import { EmptyState } from "@cfast/joy";
|
|
219
219
|
|
|
220
220
|
<EmptyState
|
|
221
221
|
title="No posts yet"
|
|
@@ -239,7 +239,7 @@ import { EmptyState } from "@cfast/ui/joy";
|
|
|
239
239
|
A full page layout combining title, filters, data table, pagination, and empty state. This is the component `@cfast/admin` uses for every table view.
|
|
240
240
|
|
|
241
241
|
```typescript
|
|
242
|
-
import { ListView } from "@cfast/
|
|
242
|
+
import { ListView } from "@cfast/joy";
|
|
243
243
|
|
|
244
244
|
function PostsPage() {
|
|
245
245
|
const pagination = useOffsetPagination<Post>();
|
|
@@ -273,7 +273,7 @@ function PostsPage() {
|
|
|
273
273
|
A read-only detail page for a single record. Auto-lays out fields based on Drizzle column types.
|
|
274
274
|
|
|
275
275
|
```typescript
|
|
276
|
-
import { DetailView } from "@cfast/
|
|
276
|
+
import { DetailView } from "@cfast/joy";
|
|
277
277
|
|
|
278
278
|
function PostDetail({ post }: { post: Post }) {
|
|
279
279
|
return (
|
|
@@ -300,7 +300,7 @@ function PostDetail({ post }: { post: Post }) {
|
|
|
300
300
|
Base layout with sidebar navigation, header, and content area.
|
|
301
301
|
|
|
302
302
|
```typescript
|
|
303
|
-
import { AppShell } from "@cfast/
|
|
303
|
+
import { AppShell } from "@cfast/joy";
|
|
304
304
|
|
|
305
305
|
function Layout({ children }) {
|
|
306
306
|
return (
|
|
@@ -330,7 +330,7 @@ const navigationItems = [
|
|
|
330
330
|
Page wrapper with title, breadcrumb, tabs, and action toolbar. Used by `<ListView>` and `<DetailView>` internally, but also useful standalone.
|
|
331
331
|
|
|
332
332
|
```typescript
|
|
333
|
-
import { PageContainer } from "@cfast/
|
|
333
|
+
import { PageContainer } from "@cfast/joy";
|
|
334
334
|
|
|
335
335
|
<PageContainer
|
|
336
336
|
title="Edit Post"
|
|
@@ -349,7 +349,7 @@ import { PageContainer } from "@cfast/ui/joy";
|
|
|
349
349
|
Header dropdown showing current user info, role badge, and auth actions.
|
|
350
350
|
|
|
351
351
|
```typescript
|
|
352
|
-
import { UserMenu } from "@cfast/
|
|
352
|
+
import { UserMenu } from "@cfast/joy";
|
|
353
353
|
|
|
354
354
|
<UserMenu
|
|
355
355
|
// Reads user from @cfast/auth's useCurrentUser()
|
|
@@ -372,7 +372,7 @@ import { UserMenu } from "@cfast/ui/joy";
|
|
|
372
372
|
Thin progress bar at the top of the page during React Router navigation.
|
|
373
373
|
|
|
374
374
|
```typescript
|
|
375
|
-
import { NavigationProgress } from "@cfast/
|
|
375
|
+
import { NavigationProgress } from "@cfast/joy";
|
|
376
376
|
|
|
377
377
|
// In your root layout:
|
|
378
378
|
<NavigationProgress />
|
|
@@ -389,7 +389,7 @@ Uses `useNavigation().state` from React Router. Shows on `loading`, hides on `id
|
|
|
389
389
|
Permission-aware button wrapping a `@cfast/actions` action. *Already implemented in PR #6.*
|
|
390
390
|
|
|
391
391
|
```typescript
|
|
392
|
-
import { ActionButton } from "@cfast/
|
|
392
|
+
import { ActionButton } from "@cfast/joy";
|
|
393
393
|
|
|
394
394
|
<ActionButton
|
|
395
395
|
action={publishPost}
|
|
@@ -416,7 +416,7 @@ Conditionally renders children based on action permissions. *Already implemented
|
|
|
416
416
|
Standalone confirmation dialog. Used internally by `<ActionButton>` when `confirmation` is set, but also available directly.
|
|
417
417
|
|
|
418
418
|
```typescript
|
|
419
|
-
import { ConfirmDialog, useConfirm } from "@cfast/
|
|
419
|
+
import { ConfirmDialog, useConfirm } from "@cfast/joy";
|
|
420
420
|
|
|
421
421
|
function DangerZone() {
|
|
422
422
|
const confirm = useConfirm();
|
|
@@ -440,7 +440,7 @@ function DangerZone() {
|
|
|
440
440
|
Action result notifications. Wraps a toast library (Sonner for Joy UI plugin) with cfast-aware defaults.
|
|
441
441
|
|
|
442
442
|
```typescript
|
|
443
|
-
import { ToastProvider, useToast } from "@cfast/
|
|
443
|
+
import { ToastProvider, useToast } from "@cfast/joy";
|
|
444
444
|
|
|
445
445
|
// In root layout:
|
|
446
446
|
<ToastProvider />
|
|
@@ -464,7 +464,7 @@ useActionToast(composed.client, {
|
|
|
464
464
|
Displays action result feedback (success/error messages) in a consistent format.
|
|
465
465
|
|
|
466
466
|
```typescript
|
|
467
|
-
import { FormStatus } from "@cfast/
|
|
467
|
+
import { FormStatus } from "@cfast/joy";
|
|
468
468
|
|
|
469
469
|
function EditForm() {
|
|
470
470
|
const actionData = useActionData();
|
|
@@ -507,7 +507,7 @@ Actions are permission-aware — hidden if the user can't perform them.
|
|
|
507
507
|
Drag-and-drop file upload area. Integrates with `@cfast/storage`'s schema for validation and `useUpload` for upload progress.
|
|
508
508
|
|
|
509
509
|
```typescript
|
|
510
|
-
import { DropZone } from "@cfast/
|
|
510
|
+
import { DropZone } from "@cfast/joy";
|
|
511
511
|
import { useUpload } from "@cfast/storage/client";
|
|
512
512
|
|
|
513
513
|
function CoverImageUpload() {
|
|
@@ -539,7 +539,7 @@ function CoverImageUpload() {
|
|
|
539
539
|
Displays an image from `@cfast/storage` with signed URL handling.
|
|
540
540
|
|
|
541
541
|
```typescript
|
|
542
|
-
import { ImagePreview } from "@cfast/
|
|
542
|
+
import { ImagePreview } from "@cfast/joy";
|
|
543
543
|
|
|
544
544
|
<ImagePreview
|
|
545
545
|
fileKey={post.coverImageKey}
|
|
@@ -555,7 +555,7 @@ import { ImagePreview } from "@cfast/ui/joy";
|
|
|
555
555
|
A list of uploaded files with metadata, download links, and delete actions.
|
|
556
556
|
|
|
557
557
|
```typescript
|
|
558
|
-
import { FileList } from "@cfast/
|
|
558
|
+
import { FileList } from "@cfast/joy";
|
|
559
559
|
|
|
560
560
|
<FileList
|
|
561
561
|
files={post.attachments}
|
|
@@ -574,7 +574,7 @@ import { FileList } from "@cfast/ui/joy";
|
|
|
574
574
|
Avatar component with automatic initials fallback when no image is available.
|
|
575
575
|
|
|
576
576
|
```typescript
|
|
577
|
-
import { AvatarWithInitials } from "@cfast/
|
|
577
|
+
import { AvatarWithInitials } from "@cfast/joy";
|
|
578
578
|
|
|
579
579
|
<AvatarWithInitials
|
|
580
580
|
src={user.avatarUrl}
|
|
@@ -589,7 +589,7 @@ import { AvatarWithInitials } from "@cfast/ui/joy";
|
|
|
589
589
|
Colored badge displaying a user's role. Colors configurable per role.
|
|
590
590
|
|
|
591
591
|
```typescript
|
|
592
|
-
import { RoleBadge } from "@cfast/
|
|
592
|
+
import { RoleBadge } from "@cfast/joy";
|
|
593
593
|
|
|
594
594
|
<RoleBadge role={user.role} />
|
|
595
595
|
// → Colored chip: "Admin" (red), "Editor" (blue), "Reader" (neutral)
|
|
@@ -606,7 +606,7 @@ import { RoleBadge } from "@cfast/ui/joy";
|
|
|
606
606
|
Persistent banner shown when an admin is impersonating another user.
|
|
607
607
|
|
|
608
608
|
```typescript
|
|
609
|
-
import { ImpersonationBanner } from "@cfast/
|
|
609
|
+
import { ImpersonationBanner } from "@cfast/joy";
|
|
610
610
|
|
|
611
611
|
// In root layout:
|
|
612
612
|
<ImpersonationBanner />
|
|
@@ -642,7 +642,7 @@ import { ImpersonationBanner } from "@cfast/ui/joy";
|
|
|
642
642
|
└── Plugin API
|
|
643
643
|
└── createUIPlugin() — maps component slots to implementations
|
|
644
644
|
|
|
645
|
-
@cfast/
|
|
645
|
+
@cfast/joy (MUI Joy UI plugin)
|
|
646
646
|
├── All of the above, styled with Joy UI
|
|
647
647
|
├── DataTable — Joy Table + sorting + selection
|
|
648
648
|
├── FilterBar — Joy Input/Select/DatePicker filters
|
|
@@ -697,7 +697,7 @@ export type {
|
|
|
697
697
|
} from "./types.js";
|
|
698
698
|
```
|
|
699
699
|
|
|
700
|
-
Joy UI plugin (`@cfast/
|
|
700
|
+
Joy UI plugin (`@cfast/joy`):
|
|
701
701
|
|
|
702
702
|
```typescript
|
|
703
703
|
export {
|