@cfast/joy 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/README.md ADDED
@@ -0,0 +1,18 @@
1
+ # @cfast/joy
2
+
3
+ Joy UI (MUI) plugin for `@cfast/ui` — provides styled component implementations powered by [MUI Joy UI](https://mui.com/joy-ui/getting-started/).
4
+
5
+ ## Installation
6
+
7
+ ```bash
8
+ npm install @cfast/joy @cfast/ui
9
+ ```
10
+
11
+ ## Usage
12
+
13
+ ```tsx
14
+ import { DataTable, ListView, ActionButton } from "@cfast/joy";
15
+ import { createUIPlugin, UIPluginProvider } from "@cfast/ui";
16
+ ```
17
+
18
+ See the [full documentation](https://github.com/DanielMSchmidt/cfast) for details.
@@ -0,0 +1,199 @@
1
+ import { ReactNode, ReactElement } from 'react';
2
+ import { ButtonProps } from '@mui/joy/Button';
3
+ import { ActionHookResult } from '@cfast/actions/client';
4
+ import { WhenForbidden, ConfirmOptions, ConfirmDialogSlotProps, FormStatusProps, EmptyStateProps, BreadcrumbItem, TabItem, AppShellProps, NavigationItem, UserMenuProps, DataTableProps, FilterBarProps, BulkAction, DropZoneProps, ImagePreviewProps, FileListProps, ListViewProps, DetailViewProps, AvatarWithInitialsProps, RoleBadgeProps, ImpersonationBannerProps } from '@cfast/ui';
5
+ export { PermissionGate } from '@cfast/ui';
6
+ import * as react_jsx_runtime from 'react/jsx-runtime';
7
+
8
+ type JoyActionButtonProps = {
9
+ action: ActionHookResult;
10
+ children: ReactNode;
11
+ whenForbidden?: WhenForbidden;
12
+ confirmation?: string | ConfirmOptions;
13
+ } & Omit<ButtonProps, "children" | "onClick" | "disabled" | "loading" | "action">;
14
+ /**
15
+ * Joy UI styled ActionButton.
16
+ *
17
+ * Takes an `ActionHookResult` from `useActions()` — no hooks inside,
18
+ * pure presentation component. All Joy Button props (sx, fullWidth, etc.)
19
+ * are forwarded to the underlying Button.
20
+ */
21
+ declare function ActionButton({ action, children, whenForbidden, confirmation: _confirmation, variant, color, size, ...buttonProps }: JoyActionButtonProps): ReactElement | null;
22
+
23
+ /**
24
+ * Joy UI ConfirmDialog — Modal + ModalDialog based on the example app pattern.
25
+ */
26
+ declare function ConfirmDialog({ open, onClose, onConfirm, title, description, confirmLabel, cancelLabel, variant, }: ConfirmDialogSlotProps): ReactElement;
27
+
28
+ /**
29
+ * Joy UI ToastProvider backed by Sonner.
30
+ */
31
+ declare function ToastProvider({ children }: {
32
+ children: ReactNode;
33
+ }): ReactElement;
34
+
35
+ /**
36
+ * Joy UI FormStatus — displays action result feedback as Joy Alerts.
37
+ */
38
+ declare function FormStatus({ data }: FormStatusProps): ReactElement | null;
39
+
40
+ /**
41
+ * Joy UI EmptyState — centered layout with optional CTA.
42
+ */
43
+ declare function EmptyState({ title, description, createAction, createLabel, icon: Icon, }: EmptyStateProps): ReactElement;
44
+
45
+ /**
46
+ * Joy UI NavigationProgress — LinearProgress with absolute positioning.
47
+ */
48
+ declare function NavigationProgress(): ReactElement | null;
49
+
50
+ type PageContainerProps = {
51
+ title?: string;
52
+ breadcrumb?: BreadcrumbItem[];
53
+ actions?: ReactNode;
54
+ tabs?: TabItem[];
55
+ children: ReactNode;
56
+ };
57
+ /**
58
+ * Joy UI PageContainer — title + breadcrumb + action toolbar.
59
+ */
60
+ declare function PageContainer({ title, breadcrumb, actions, tabs: _tabs, children, }: PageContainerProps): ReactElement;
61
+
62
+ /**
63
+ * Joy UI AppShell — sidebar + header + content layout.
64
+ */
65
+ declare function AppShell({ children, sidebar, header, }: AppShellProps): ReactElement;
66
+ declare namespace AppShell {
67
+ var Sidebar: typeof AppShellSidebar;
68
+ var Header: typeof AppShellHeader;
69
+ }
70
+ /**
71
+ * Joy UI Sidebar — Sheet with List navigation items.
72
+ */
73
+ declare function AppShellSidebar({ items }: {
74
+ items: NavigationItem[];
75
+ }): ReactElement;
76
+ /**
77
+ * Joy UI AppShell Header — Sheet with flex layout.
78
+ */
79
+ declare function AppShellHeader({ children, userMenu, }: {
80
+ children?: ReactNode;
81
+ userMenu?: ReactNode;
82
+ }): ReactElement;
83
+
84
+ /**
85
+ * Joy UI UserMenu — Dropdown with Avatar trigger, user info, and links.
86
+ */
87
+ declare function UserMenu({ links, onSignOut, }: UserMenuProps): ReactElement | null;
88
+
89
+ /**
90
+ * Joy UI styled DataTable.
91
+ * Renders a MUI Joy Table with sorting, selection, and row actions.
92
+ */
93
+ declare function DataTable<T = unknown>({ data, columns: columnsProp, selectable, selectedRows: externalSelectedRows, onSelectionChange, onRowClick, getRowId, emptyMessage, }: DataTableProps<T>): ReactElement;
94
+
95
+ /**
96
+ * Joy UI styled FilterBar — URL-synced filter controls.
97
+ */
98
+ declare function FilterBar({ filters, searchable, }: FilterBarProps): ReactElement;
99
+
100
+ type BulkActionBarProps = {
101
+ selectedCount: number;
102
+ actions: BulkAction[];
103
+ onAction: (action: BulkAction) => void;
104
+ onClearSelection: () => void;
105
+ };
106
+ /**
107
+ * Joy UI styled BulkActionBar.
108
+ * Shown when rows are selected in a DataTable.
109
+ */
110
+ declare function BulkActionBar({ selectedCount, actions, onAction, onClearSelection, }: BulkActionBarProps): ReactElement | null;
111
+
112
+ /**
113
+ * Joy UI styled DropZone — drag-and-drop file upload area.
114
+ */
115
+ declare function DropZone({ upload, multiple, children, }: DropZoneProps): ReactElement;
116
+
117
+ /**
118
+ * Joy UI styled ImagePreview.
119
+ */
120
+ declare function ImagePreview({ fileKey, src, getUrl, width, height, fallback, alt, }: ImagePreviewProps): ReactElement;
121
+
122
+ /**
123
+ * Joy UI styled FileList.
124
+ */
125
+ declare function FileList({ files, onDownload, }: FileListProps): ReactElement;
126
+
127
+ /**
128
+ * Joy UI styled ListView — full page list with filters, table, and pagination.
129
+ */
130
+ declare function ListView<T = unknown>({ title, data, table: _table, columns, actions: _actions, filters, searchable, createAction, createLabel, selectable, bulkActions, breadcrumb, }: ListViewProps<T>): ReactElement;
131
+
132
+ /**
133
+ * Joy UI styled DetailView — two-column grid of record fields.
134
+ */
135
+ declare function DetailView<T = unknown>({ title, table, record, fields: fieldsProp, exclude, breadcrumb, }: DetailViewProps<T>): ReactElement;
136
+
137
+ /**
138
+ * Joy UI AvatarWithInitials — MUI Joy Avatar with initials fallback.
139
+ */
140
+ declare function AvatarWithInitials({ src, name, size, }: AvatarWithInitialsProps): ReactElement;
141
+
142
+ /**
143
+ * Joy UI RoleBadge — MUI Joy Chip with configurable color per role.
144
+ */
145
+ declare function RoleBadge({ role, colors }: RoleBadgeProps): ReactElement;
146
+
147
+ /**
148
+ * Joy UI ImpersonationBanner — sticky warning sheet when impersonating.
149
+ */
150
+ declare function ImpersonationBanner({ stopAction, }: ImpersonationBannerProps): ReactElement | null;
151
+
152
+ declare function Layout({ children }: {
153
+ children: ReactNode;
154
+ }): react_jsx_runtime.JSX.Element;
155
+ declare function EmailInput({ value, onChange, }: {
156
+ value: string;
157
+ onChange: (value: string) => void;
158
+ error?: string;
159
+ }): react_jsx_runtime.JSX.Element;
160
+ declare function MagicLinkButton({ onClick, loading, }: {
161
+ onClick: () => void;
162
+ loading: boolean;
163
+ }): react_jsx_runtime.JSX.Element;
164
+ declare function PasskeyButton({ onClick, loading, }: {
165
+ onClick: () => void;
166
+ loading: boolean;
167
+ }): react_jsx_runtime.JSX.Element;
168
+ declare function SuccessMessage({ email }: {
169
+ email: string;
170
+ }): react_jsx_runtime.JSX.Element;
171
+ declare function ErrorMessage({ error }: {
172
+ error: string;
173
+ }): react_jsx_runtime.JSX.Element;
174
+ /**
175
+ * Joy UI slot components for `<LoginPage>` from `@cfast/auth/client`.
176
+ *
177
+ * Usage:
178
+ * ```tsx
179
+ * import { LoginPage } from "@cfast/auth/client";
180
+ * import { joyLoginComponents } from "@cfast/joy";
181
+ *
182
+ * <LoginPage authClient={authClient} components={joyLoginComponents} />
183
+ * ```
184
+ *
185
+ * Override individual slots while keeping the rest:
186
+ * ```tsx
187
+ * <LoginPage components={{ ...joyLoginComponents, Layout: MyLayout }} />
188
+ * ```
189
+ */
190
+ declare const joyLoginComponents: {
191
+ Layout: typeof Layout;
192
+ EmailInput: typeof EmailInput;
193
+ MagicLinkButton: typeof MagicLinkButton;
194
+ PasskeyButton: typeof PasskeyButton;
195
+ SuccessMessage: typeof SuccessMessage;
196
+ ErrorMessage: typeof ErrorMessage;
197
+ };
198
+
199
+ export { ActionButton, AppShell, AppShellHeader, AppShellSidebar, AvatarWithInitials, BulkActionBar, ConfirmDialog, DataTable, DetailView, DropZone, EmptyState, FileList, FilterBar, FormStatus, ImagePreview, ImpersonationBanner, ListView, NavigationProgress, PageContainer, RoleBadge, ToastProvider, UserMenu, joyLoginComponents };