litecms 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/LICENSE +21 -0
- package/README.md +1387 -0
- package/dist/admin/CmsAdminLayout.d.ts +27 -0
- package/dist/admin/CmsAdminLayout.d.ts.map +1 -0
- package/dist/admin/CmsAdminPage.d.ts +31 -0
- package/dist/admin/CmsAdminPage.d.ts.map +1 -0
- package/dist/admin/config.d.ts +83 -0
- package/dist/admin/config.d.ts.map +1 -0
- package/dist/admin/config.js +53 -0
- package/dist/admin/exports.d.ts +7 -0
- package/dist/admin/exports.d.ts.map +1 -0
- package/dist/admin/exports.js +452 -0
- package/dist/admin/index.d.ts +147 -0
- package/dist/admin/index.d.ts.map +1 -0
- package/dist/components/CmsAutoForm.d.ts +73 -0
- package/dist/components/CmsAutoForm.d.ts.map +1 -0
- package/dist/components/CmsField.d.ts +50 -0
- package/dist/components/CmsField.d.ts.map +1 -0
- package/dist/components/CmsForm.d.ts +74 -0
- package/dist/components/CmsForm.d.ts.map +1 -0
- package/dist/components/CmsImageField.d.ts +33 -0
- package/dist/components/CmsImageField.d.ts.map +1 -0
- package/dist/components/CmsNavSection.d.ts +7 -0
- package/dist/components/CmsNavSection.d.ts.map +1 -0
- package/dist/components/CmsSimpleForm.d.ts +54 -0
- package/dist/components/CmsSimpleForm.d.ts.map +1 -0
- package/dist/components/index.d.ts +43 -0
- package/dist/components/index.d.ts.map +1 -0
- package/dist/components/index.js +619 -0
- package/dist/domain/index.d.ts +1 -0
- package/dist/domain/index.d.ts.map +1 -0
- package/dist/index-8zcd33mx.js +39 -0
- package/dist/index-pmb5m3ek.js +4135 -0
- package/dist/index.d.ts +4 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +32 -0
- package/dist/schema/index.d.ts +80 -0
- package/dist/schema/index.d.ts.map +1 -0
- package/dist/schema/index.js +46 -0
- package/dist/server/index.d.ts +79 -0
- package/dist/server/index.d.ts.map +1 -0
- package/dist/server/index.js +117 -0
- package/dist/shared/utils.d.ts +23 -0
- package/dist/shared/utils.d.ts.map +1 -0
- package/dist/storage/index.d.ts +86 -0
- package/dist/storage/index.d.ts.map +1 -0
- package/dist/storage/index.js +86 -0
- package/dist/stores/index.d.ts +1 -0
- package/dist/stores/index.d.ts.map +1 -0
- package/package.json +90 -0
|
@@ -0,0 +1,147 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import type { SchemaDefinition } from '../schema';
|
|
3
|
+
import type { ActionState } from '../server';
|
|
4
|
+
import type { ImageUploadConfig } from '../components/CmsSimpleForm';
|
|
5
|
+
/**
|
|
6
|
+
* Configuration for a CMS page
|
|
7
|
+
*/
|
|
8
|
+
export type CmsPageConfig = {
|
|
9
|
+
/** URL slug for the admin page (e.g., 'home', 'about') */
|
|
10
|
+
slug: string;
|
|
11
|
+
/** Display name in navigation */
|
|
12
|
+
title: string;
|
|
13
|
+
/** Description to help guide the user (shown below title) */
|
|
14
|
+
description?: string;
|
|
15
|
+
/** Public URL path for this page (e.g., '/', '/about', '/work'). Used for auto-generated navigation. */
|
|
16
|
+
path?: string;
|
|
17
|
+
/** Schema definition with field metadata */
|
|
18
|
+
definition: SchemaDefinition<any>;
|
|
19
|
+
/** Server action to save data */
|
|
20
|
+
action: (prevState: ActionState<any>, formData: FormData) => Promise<ActionState<any>>;
|
|
21
|
+
/** Function to fetch current data */
|
|
22
|
+
getData: () => Promise<any>;
|
|
23
|
+
/** Icon name (optional, for nav) */
|
|
24
|
+
icon?: string;
|
|
25
|
+
/** Order in navigation (lower = higher) */
|
|
26
|
+
order?: number;
|
|
27
|
+
/** Group in navigation */
|
|
28
|
+
group?: string;
|
|
29
|
+
};
|
|
30
|
+
/**
|
|
31
|
+
* Strongly typed page config
|
|
32
|
+
*/
|
|
33
|
+
export type TypedCmsPageConfig<T extends z.ZodRawShape> = {
|
|
34
|
+
slug: string;
|
|
35
|
+
title: string;
|
|
36
|
+
/** Description to help guide the user (shown below title) */
|
|
37
|
+
description?: string;
|
|
38
|
+
/** Public URL path for this page (e.g., '/', '/about', '/work'). Used for auto-generated navigation. */
|
|
39
|
+
path?: string;
|
|
40
|
+
definition: SchemaDefinition<T>;
|
|
41
|
+
action: (prevState: ActionState<z.infer<z.ZodObject<T>>>, formData: FormData) => Promise<ActionState<z.infer<z.ZodObject<T>>>>;
|
|
42
|
+
getData: () => Promise<z.infer<z.ZodObject<T>>>;
|
|
43
|
+
icon?: string;
|
|
44
|
+
order?: number;
|
|
45
|
+
group?: string;
|
|
46
|
+
};
|
|
47
|
+
/**
|
|
48
|
+
* Full CMS configuration
|
|
49
|
+
*/
|
|
50
|
+
export type CmsConfig = {
|
|
51
|
+
/** Site name shown in admin header */
|
|
52
|
+
siteName?: string;
|
|
53
|
+
/** Admin panel title */
|
|
54
|
+
adminTitle?: string;
|
|
55
|
+
/** Base path for admin (default: '/admin') */
|
|
56
|
+
basePath?: string;
|
|
57
|
+
/** Link to public site */
|
|
58
|
+
publicSiteUrl?: string;
|
|
59
|
+
/** Registered pages */
|
|
60
|
+
pages: CmsPageConfig[];
|
|
61
|
+
/** Configuration for image upload endpoints in form components */
|
|
62
|
+
storage?: ImageUploadConfig;
|
|
63
|
+
};
|
|
64
|
+
/**
|
|
65
|
+
* Create a CMS configuration with typed pages.
|
|
66
|
+
*
|
|
67
|
+
* @example
|
|
68
|
+
* ```ts
|
|
69
|
+
* export const cmsConfig = createCmsConfig({
|
|
70
|
+
* siteName: 'My Site',
|
|
71
|
+
* pages: [
|
|
72
|
+
* definePage({
|
|
73
|
+
* slug: 'home',
|
|
74
|
+
* title: 'Homepage',
|
|
75
|
+
* definition: HomePageDef,
|
|
76
|
+
* action: saveHome,
|
|
77
|
+
* getData: getHomePageData,
|
|
78
|
+
* }),
|
|
79
|
+
* ],
|
|
80
|
+
* });
|
|
81
|
+
* ```
|
|
82
|
+
*/
|
|
83
|
+
export declare function createCmsConfig(config: CmsConfig): CmsConfig;
|
|
84
|
+
/**
|
|
85
|
+
* Get the current CMS config
|
|
86
|
+
*/
|
|
87
|
+
export declare function getCmsConfig(): CmsConfig;
|
|
88
|
+
/**
|
|
89
|
+
* Get a page config by slug
|
|
90
|
+
*/
|
|
91
|
+
export declare function getPageBySlug(slug: string): CmsPageConfig | undefined;
|
|
92
|
+
/**
|
|
93
|
+
* Get all page configs for navigation
|
|
94
|
+
*/
|
|
95
|
+
export declare function getNavPages(): Array<{
|
|
96
|
+
slug: string;
|
|
97
|
+
title: string;
|
|
98
|
+
href: string;
|
|
99
|
+
group?: string;
|
|
100
|
+
}>;
|
|
101
|
+
/**
|
|
102
|
+
* Helper to create a page config with type inference.
|
|
103
|
+
* Use this to get type checking on individual page configs.
|
|
104
|
+
*/
|
|
105
|
+
export declare function definePage<T extends z.ZodRawShape>(config: TypedCmsPageConfig<T>): CmsPageConfig;
|
|
106
|
+
/**
|
|
107
|
+
* Navigation link extracted from page data
|
|
108
|
+
*/
|
|
109
|
+
export type NavLink = {
|
|
110
|
+
label: string;
|
|
111
|
+
href: string;
|
|
112
|
+
order: number;
|
|
113
|
+
};
|
|
114
|
+
/**
|
|
115
|
+
* Page info needed for building navigation
|
|
116
|
+
*/
|
|
117
|
+
export type PageNavInfo = {
|
|
118
|
+
slug: string;
|
|
119
|
+
path: string;
|
|
120
|
+
title: string;
|
|
121
|
+
getData: () => Promise<unknown>;
|
|
122
|
+
};
|
|
123
|
+
/**
|
|
124
|
+
* Get pages that have a public path defined (for navigation building)
|
|
125
|
+
*/
|
|
126
|
+
export declare function getNavigablePages(): PageNavInfo[];
|
|
127
|
+
/**
|
|
128
|
+
* Page group
|
|
129
|
+
*/
|
|
130
|
+
export type PageGroup = {
|
|
131
|
+
name: string | null;
|
|
132
|
+
pages: Array<{
|
|
133
|
+
slug: string;
|
|
134
|
+
title: string;
|
|
135
|
+
icon?: string;
|
|
136
|
+
}>;
|
|
137
|
+
};
|
|
138
|
+
/**
|
|
139
|
+
* Navigation page info
|
|
140
|
+
*/
|
|
141
|
+
export type NavPageInfo = {
|
|
142
|
+
slug: string;
|
|
143
|
+
title: string;
|
|
144
|
+
group?: string;
|
|
145
|
+
icon?: string;
|
|
146
|
+
};
|
|
147
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/admin/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,WAAW,CAAC;AAClD,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,WAAW,CAAC;AAC7C,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,6BAA6B,CAAC;AAErE;;GAEG;AACH,MAAM,MAAM,aAAa,GAAG;IACxB,0DAA0D;IAC1D,IAAI,EAAE,MAAM,CAAC;IACb,iCAAiC;IACjC,KAAK,EAAE,MAAM,CAAC;IACd,6DAA6D;IAC7D,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,wGAAwG;IACxG,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,4CAA4C;IAE5C,UAAU,EAAE,gBAAgB,CAAC,GAAG,CAAC,CAAC;IAClC,iCAAiC;IAEjC,MAAM,EAAE,CAAC,SAAS,EAAE,WAAW,CAAC,GAAG,CAAC,EAAE,QAAQ,EAAE,QAAQ,KAAK,OAAO,CAAC,WAAW,CAAC,GAAG,CAAC,CAAC,CAAC;IACvF,qCAAqC;IAErC,OAAO,EAAE,MAAM,OAAO,CAAC,GAAG,CAAC,CAAC;IAC5B,oCAAoC;IACpC,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,2CAA2C;IAC3C,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,0BAA0B;IAC1B,KAAK,CAAC,EAAE,MAAM,CAAC;CAClB,CAAC;AAEF;;GAEG;AACH,MAAM,MAAM,kBAAkB,CAAC,CAAC,SAAS,CAAC,CAAC,WAAW,IAAI;IACtD,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@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import type { SchemaDefinition } from '../schema';
|
|
3
|
+
import type { ServerAction } from './index';
|
|
4
|
+
/**
|
|
5
|
+
* Style configuration for auto-generated forms
|
|
6
|
+
* TODO: Is this still needed?
|
|
7
|
+
*/
|
|
8
|
+
export type CmsAutoFormStyles = {
|
|
9
|
+
/** Wrapper div className */
|
|
10
|
+
wrapper?: string;
|
|
11
|
+
/** Field wrapper className */
|
|
12
|
+
field?: string;
|
|
13
|
+
/** Label className */
|
|
14
|
+
label?: string;
|
|
15
|
+
/** Input className */
|
|
16
|
+
input?: string;
|
|
17
|
+
/** Error message className */
|
|
18
|
+
error?: string;
|
|
19
|
+
/** Help text className */
|
|
20
|
+
help?: string;
|
|
21
|
+
/** Group wrapper className */
|
|
22
|
+
group?: string;
|
|
23
|
+
/** Group title className */
|
|
24
|
+
groupTitle?: string;
|
|
25
|
+
/** Form error className */
|
|
26
|
+
formError?: string;
|
|
27
|
+
/** Form success className */
|
|
28
|
+
formSuccess?: string;
|
|
29
|
+
/** Submit button className */
|
|
30
|
+
submitButton?: string;
|
|
31
|
+
};
|
|
32
|
+
export type CmsAutoFormProps<T extends z.ZodRawShape> = {
|
|
33
|
+
/** Schema definition with field metadata */
|
|
34
|
+
definition: SchemaDefinition<T>;
|
|
35
|
+
/** Server action to call on submit */
|
|
36
|
+
action: ServerAction<z.infer<z.ZodObject<T>>>;
|
|
37
|
+
/** Current values from the database */
|
|
38
|
+
values?: Partial<z.infer<z.ZodObject<T>>>;
|
|
39
|
+
/** Style classes for form elements */
|
|
40
|
+
styles?: CmsAutoFormStyles;
|
|
41
|
+
/** Submit button text */
|
|
42
|
+
submitText?: string;
|
|
43
|
+
/** Submit button pending text */
|
|
44
|
+
submitPendingText?: string;
|
|
45
|
+
/** Success message */
|
|
46
|
+
successMessage?: string;
|
|
47
|
+
/** Called when form submission succeeds */
|
|
48
|
+
onSuccess?: (data: z.infer<z.ZodObject<T>>) => void;
|
|
49
|
+
};
|
|
50
|
+
/**
|
|
51
|
+
* Auto-generated CMS form based on a schema definition.
|
|
52
|
+
*
|
|
53
|
+
* Use this component when you have direct access to the `SchemaDefinition` object
|
|
54
|
+
* (e.g., in a client component that imports the schema directly).
|
|
55
|
+
*
|
|
56
|
+
* For server components or when fields need to be serialized, use `CmsSimpleForm` instead
|
|
57
|
+
* (which accepts pre-extracted `FieldInfo[]`).
|
|
58
|
+
*
|
|
59
|
+
* @example
|
|
60
|
+
* ```tsx
|
|
61
|
+
* import { HomePageDef } from '@/cms/schemas/home';
|
|
62
|
+
*
|
|
63
|
+
* <CmsAutoForm
|
|
64
|
+
* definition={HomePageDef}
|
|
65
|
+
* action={saveHome}
|
|
66
|
+
* values={currentData}
|
|
67
|
+
* />
|
|
68
|
+
* ```
|
|
69
|
+
*
|
|
70
|
+
* @see CmsSimpleForm - for use with pre-extracted fields (serializable)
|
|
71
|
+
*/
|
|
72
|
+
export declare function CmsAutoForm<T extends z.ZodRawShape>({ definition, action, values, styles, submitText, submitPendingText, successMessage, onSuccess, }: CmsAutoFormProps<T>): import("react/jsx-runtime").JSX.Element;
|
|
73
|
+
//# sourceMappingURL=CmsAutoForm.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"CmsAutoForm.d.ts","sourceRoot":"","sources":["../../src/components/CmsAutoForm.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,KAAK,EAAE,gBAAgB,EAAa,MAAM,WAAW,CAAC;AAE7D,OAAO,KAAK,EAAE,YAAY,EAAkB,MAAM,SAAS,CAAC;AAa5D;;;GAGG;AACH,MAAM,MAAM,iBAAiB,GAAG;IAC5B,4BAA4B;IAC5B,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,8BAA8B;IAC9B,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,sBAAsB;IACtB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,sBA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AAS,CAAC,CAAC,WAAW,EAAE,EACjD,UAAU,EACV,MAAM,EACN,MAAM,EACN,MAAW,EACX,UAA2B,EAC3B,iBAA+B,EAC/B,cAA6C,EAC7C,SAAS,GACZ,EAAE,gBAAgB,CAAC,CAAC,CAAC,2CA+DrB"}
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
import { type FieldPath, type FieldValues } from 'react-hook-form';
|
|
2
|
+
export type CmsFieldProps<TFieldValues extends FieldValues = FieldValues> = {
|
|
3
|
+
/** Field name (must match schema key, supports dot notation for nested fields) */
|
|
4
|
+
name: FieldPath<TFieldValues>;
|
|
5
|
+
/** Label text */
|
|
6
|
+
label: string;
|
|
7
|
+
/** Input type */
|
|
8
|
+
type?: 'text' | 'textarea' | 'number' | 'email' | 'url' | 'select';
|
|
9
|
+
/** Placeholder text */
|
|
10
|
+
placeholder?: string;
|
|
11
|
+
/** Help text shown below the input */
|
|
12
|
+
helpText?: string;
|
|
13
|
+
/** Options for select type */
|
|
14
|
+
options?: Array<{
|
|
15
|
+
value: string;
|
|
16
|
+
label: string;
|
|
17
|
+
}>;
|
|
18
|
+
/** Number of rows for textarea (default: 4) */
|
|
19
|
+
rows?: number;
|
|
20
|
+
/** Whether the field is required */
|
|
21
|
+
required?: boolean;
|
|
22
|
+
/** Whether the field is disabled */
|
|
23
|
+
disabled?: boolean;
|
|
24
|
+
/** Optional className for the wrapper */
|
|
25
|
+
className?: string;
|
|
26
|
+
/** Optional className for the input */
|
|
27
|
+
inputClassName?: string;
|
|
28
|
+
/** Optional className for the label */
|
|
29
|
+
labelClassName?: string;
|
|
30
|
+
/** Optional className for the error message */
|
|
31
|
+
errorClassName?: string;
|
|
32
|
+
/** Optional className for the help text */
|
|
33
|
+
helpClassName?: string;
|
|
34
|
+
};
|
|
35
|
+
/**
|
|
36
|
+
* CMS Field component.
|
|
37
|
+
*/
|
|
38
|
+
export declare function CmsField<TFieldValues extends FieldValues = FieldValues>({ name, label, type, placeholder, helpText, options, rows, required, disabled, className, inputClassName, labelClassName, errorClassName, helpClassName, }: CmsFieldProps<TFieldValues>): import("react/jsx-runtime").JSX.Element;
|
|
39
|
+
/**
|
|
40
|
+
* Hidden field for passing data that shouldn't be edited
|
|
41
|
+
*/
|
|
42
|
+
export declare function CmsHiddenField<TFieldValues extends FieldValues = FieldValues>({ name, value, }: {
|
|
43
|
+
name: FieldPath<TFieldValues>;
|
|
44
|
+
value: string;
|
|
45
|
+
}): import("react/jsx-runtime").JSX.Element;
|
|
46
|
+
/**
|
|
47
|
+
* Checkbox field
|
|
48
|
+
*/
|
|
49
|
+
export declare function CmsCheckbox<TFieldValues extends FieldValues = FieldValues>({ name, label, helpText, disabled, className, inputClassName, labelClassName, errorClassName, helpClassName, }: Omit<CmsFieldProps<TFieldValues>, 'type' | 'placeholder' | 'options' | 'rows' | 'required'>): import("react/jsx-runtime").JSX.Element;
|
|
50
|
+
//# sourceMappingURL=CmsField.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"CmsField.d.ts","sourceRoot":"","sources":["../../src/components/CmsField.tsx"],"names":[],"mappings":"AAAA,OAAO,EAEH,KAAK,SAAS,EACd,KAAK,WAAW,EACnB,MAAM,iBAAiB,CAAC;AAGzB,MAAM,MAAM,aAAa,CAAC,YAAY,SAAS,WAAW,GAAG,WAAW,IAAI;IACxE,kFAAkF;IAClF,IAAI,EAAE,SAAS,CAAC,YAAY,CAAC,CAAC;IAC9B,iBAAiB;IACjB,KAAK,EAAE,MAAM,CAAC;IACd,iBAAiB;IACjB,IAAI,CAAC,EAAE,MAAM,GAAG,UAAU,GAAG,QAAQ,GAAG,OAAO,GAAG,KAAK,GAAG,QAAQ,CAAC;IACnE,uBAAuB;IACvB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,sCAAsC;IACtC,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,8BAA8B;IAC9B,OAAO,CAAC,EAAE,KAAK,CAAC;QAAE,KAAK,EAAE,MAAM,CA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MAAM,GAAG,UAAU,CAC3D,2CA+DA"}
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import { type FieldValues, type DefaultValues } from 'react-hook-form';
|
|
3
|
+
import type { z } from 'zod';
|
|
4
|
+
import type { ActionState } from '../server';
|
|
5
|
+
import type { ServerAction, CmsFormContextValue } from './index';
|
|
6
|
+
export type CmsFormProps<TFormValues extends FieldValues> = {
|
|
7
|
+
/** Zod schema for validation */
|
|
8
|
+
schema: z.ZodType<TFormValues>;
|
|
9
|
+
/** Server action to call on submit */
|
|
10
|
+
action: ServerAction<TFormValues>;
|
|
11
|
+
/** Default values for the form */
|
|
12
|
+
defaultValues?: DefaultValues<TFormValues>;
|
|
13
|
+
/** Called when form submission succeeds */
|
|
14
|
+
onSuccess?: (data: TFormValues) => void;
|
|
15
|
+
/** Called when form submission fails */
|
|
16
|
+
onError?: (errors: ActionState['errors']) => void;
|
|
17
|
+
/** Form children */
|
|
18
|
+
children: React.ReactNode;
|
|
19
|
+
/** Optional className for the form */
|
|
20
|
+
className?: string;
|
|
21
|
+
/** Reset form to default values after successful submission */
|
|
22
|
+
resetOnSuccess?: boolean;
|
|
23
|
+
};
|
|
24
|
+
/**
|
|
25
|
+
* CMS Form wrapper that integrates react-hook-form with server actions.
|
|
26
|
+
*
|
|
27
|
+
* @example
|
|
28
|
+
* ```tsx
|
|
29
|
+
* <CmsForm schema={HomePageSchema} action={saveHome} defaultValues={data}>
|
|
30
|
+
* <CmsField name="heroTitle" label="Hero Title" />
|
|
31
|
+
* <CmsField name="heroSubtitle" label="Hero Subtitle" />
|
|
32
|
+
* <CmsSubmitButton>Save</CmsSubmitButton>
|
|
33
|
+
* </CmsForm>
|
|
34
|
+
* ```
|
|
35
|
+
*/
|
|
36
|
+
export declare function CmsForm<TFormValues extends FieldValues>({ schema, action, defaultValues, onSuccess, onError, children, className, resetOnSuccess, }: CmsFormProps<TFormValues>): import("react/jsx-runtime").JSX.Element;
|
|
37
|
+
/**
|
|
38
|
+
* Hook to access CMS form context
|
|
39
|
+
*/
|
|
40
|
+
export declare function useCmsForm(): CmsFormContextValue;
|
|
41
|
+
/**
|
|
42
|
+
* Submit button that shows pending state
|
|
43
|
+
*
|
|
44
|
+
* @example
|
|
45
|
+
* ```tsx
|
|
46
|
+
* <CmsSubmitButton>Save Changes</CmsSubmitButton>
|
|
47
|
+
* ```
|
|
48
|
+
*/
|
|
49
|
+
export declare function CmsSubmitButton({ children, className, pendingText, }: {
|
|
50
|
+
children?: React.ReactNode;
|
|
51
|
+
className?: string;
|
|
52
|
+
pendingText?: string;
|
|
53
|
+
}): import("react/jsx-runtime").JSX.Element;
|
|
54
|
+
/**
|
|
55
|
+
* Display form-level error message
|
|
56
|
+
*/
|
|
57
|
+
export declare function CmsFormError({ className }: {
|
|
58
|
+
className?: string;
|
|
59
|
+
}): import("react/jsx-runtime").JSX.Element | null;
|
|
60
|
+
/**
|
|
61
|
+
* Display success message after form submission
|
|
62
|
+
*
|
|
63
|
+
* @example
|
|
64
|
+
* ```tsx
|
|
65
|
+
* <CmsFormSuccess className="text-green-600">
|
|
66
|
+
* Changes saved successfully!
|
|
67
|
+
* </CmsFormSuccess>
|
|
68
|
+
* ```
|
|
69
|
+
*/
|
|
70
|
+
export declare function CmsFormSuccess({ children, className, }: {
|
|
71
|
+
children?: React.ReactNode;
|
|
72
|
+
className?: string;
|
|
73
|
+
}): import("react/jsx-runtime").JSX.Element | null;
|
|
74
|
+
//# sourceMappingURL=CmsForm.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"CmsForm.d.ts","sourceRoot":"","sources":["../../src/components/CmsForm.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,EAGH,KAAK,WAAW,EAChB,KAAK,aAAa,EAErB,MAAM,iBAAiB,CAAC;AAEzB,OAAO,KAAK,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAC7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ACH,wBAAgB,YAAY,CAAC,EAAE,SAAS,EAAE,EAAE;IAAE,SAAS,CAAC,EAAE,MAAM,CAAA;CAAE,kDAUjE;AAED;;;;;;;;;GASG;AACH,wBAAgB,cAAc,CAAC,EAC3B,QAAgC,EAChC,SAAS,GACZ,EAAE;IACC,QAAQ,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;IAC3B,SAAS,CAAC,EAAE,MAAM,CAAC;CACtB,kDAUA"}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import { type FieldPath, type FieldValues } from 'react-hook-form';
|
|
2
|
+
export type CmsImageFieldProps<TFieldValues extends FieldValues = FieldValues> = {
|
|
3
|
+
/** Field name (must match schema key) */
|
|
4
|
+
name: FieldPath<TFieldValues>;
|
|
5
|
+
/** Label text */
|
|
6
|
+
label: string;
|
|
7
|
+
/** Help text shown below the input */
|
|
8
|
+
helpText?: string;
|
|
9
|
+
/** Whether the field is required */
|
|
10
|
+
required?: boolean;
|
|
11
|
+
/** Whether the field is disabled */
|
|
12
|
+
disabled?: boolean;
|
|
13
|
+
/** Accepted file types (default: 'image/*') */
|
|
14
|
+
accept?: string;
|
|
15
|
+
/** Optional className for the wrapper */
|
|
16
|
+
className?: string;
|
|
17
|
+
/** Optional className for the label */
|
|
18
|
+
labelClassName?: string;
|
|
19
|
+
/** Optional className for the error message */
|
|
20
|
+
errorClassName?: string;
|
|
21
|
+
/** Optional className for the help text */
|
|
22
|
+
helpClassName?: string;
|
|
23
|
+
/** Storage configuration for image uploads */
|
|
24
|
+
storage?: {
|
|
25
|
+
uploadEndpoint: string;
|
|
26
|
+
listEndpoint?: string;
|
|
27
|
+
};
|
|
28
|
+
};
|
|
29
|
+
/**
|
|
30
|
+
* Image Field component.
|
|
31
|
+
*/
|
|
32
|
+
export declare function CmsImageField<TFieldValues extends FieldValues = FieldValues>({ name, label, helpText, required, disabled, accept, className, labelClassName, errorClassName, helpClassName, storage, }: CmsImageFieldProps<TFieldValues>): import("react/jsx-runtime").JSX.Element;
|
|
33
|
+
//# sourceMappingURL=CmsImageField.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"CmsImageField.d.ts","sourceRoot":"","sources":["../../src/components/CmsImageField.tsx"],"names":[],"mappings":"AACA,OAAO,EAEH,KAAK,SAAS,EACd,KAAK,WAAW,EACnB,MAAM,iBAAiB,CAAC;AAGzB,MAAM,MAAM,kBAAkB,CAAC,YAAY,SAAS,WAAW,GAAG,WAAW,IACzE;IACI,yCAAyC;IACzC,IAAI,EAAE,SAAS,CAAC,YAAY,CAAC,CAAC;IAC9B,iBAAiB;IACjB,KAAK,EAAE,MAAM,CAAC;IACd,sCAAsC;IACtC,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,oCAAoC;IACpC,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,oCAAoC;IACpC,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,+CAA+C;IAC/C,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,yCAAyC;IACzC,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,uCAAuC;IACvC,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,+CAA+C;IAC/C,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,2CAA2C;IAC3C,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,8CAA8C;IAC9C,OAAO,CAAC,EAAE;QACN,cAAc,EAAE,MAAM,CAAC;QACvB,YAAY,CAAC,EAAE,MAAM,CAAC;KACzB,CAAC;CACL,CAAC;AAUN;;GAEG;AACH,wBAAgB,aAAa,CAAC,YAAY,SAAS,WAAW,GAAG,WAAW,EAAE,EAC1E,IAAI,EACJ,KAAK,EACL,QAAQ,EACR,QAAgB,EAChB,QAAgB,EAChB,MAAkB,EAClB,SAAuB,EACvB,cAAc,EACd,cAAc,EACd,aAAa,EACb,OAAO,GACV,EAAE,kBAAkB,CAAC,YAAY,CAAC,2CAkIlC"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import type { PageGroup } from '../admin';
|
|
2
|
+
export declare function NavSection({ group, basePath, currentSlug, }: {
|
|
3
|
+
group: PageGroup;
|
|
4
|
+
basePath: string;
|
|
5
|
+
currentSlug?: string;
|
|
6
|
+
}): import("react/jsx-runtime").JSX.Element;
|
|
7
|
+
//# sourceMappingURL=CmsNavSection.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"CmsNavSection.d.ts","sourceRoot":"","sources":["../../src/components/CmsNavSection.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,UAAU,CAAC;AAE1C,wBAAgB,UAAU,CAAC,EACvB,KAAK,EACL,QAAQ,EACR,WAAW,GACd,EAAE;IACC,KAAK,EAAE,SAAS,CAAC;IACjB,QAAQ,EAAE,MAAM,CAAC;IACjB,WAAW,CAAC,EAAE,MAAM,CAAC;CACxB,2CA6BA"}
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
import type { FieldInfo } from '../schema';
|
|
2
|
+
import type { ServerAction, ImageUploadConfig } from './index';
|
|
3
|
+
export type CmsAutoFormStyles = {
|
|
4
|
+
wrapper?: string;
|
|
5
|
+
field?: string;
|
|
6
|
+
label?: string;
|
|
7
|
+
input?: string;
|
|
8
|
+
error?: string;
|
|
9
|
+
help?: string;
|
|
10
|
+
group?: string;
|
|
11
|
+
groupTitle?: string;
|
|
12
|
+
formError?: string;
|
|
13
|
+
formSuccess?: string;
|
|
14
|
+
submitButton?: string;
|
|
15
|
+
};
|
|
16
|
+
export type CmsSimpleFormProps = {
|
|
17
|
+
/** Pre-extracted field info */
|
|
18
|
+
fields: FieldInfo[];
|
|
19
|
+
/** Server action to call on submit */
|
|
20
|
+
action: ServerAction<Record<string, unknown>>;
|
|
21
|
+
/** Current values */
|
|
22
|
+
values?: Record<string, unknown>;
|
|
23
|
+
/** Style classes */
|
|
24
|
+
styles?: CmsAutoFormStyles;
|
|
25
|
+
/** Submit button text */
|
|
26
|
+
submitText?: string;
|
|
27
|
+
/** Submit button pending text */
|
|
28
|
+
submitPendingText?: string;
|
|
29
|
+
/** Success message */
|
|
30
|
+
successMessage?: string;
|
|
31
|
+
/** Configuration for image upload endpoints */
|
|
32
|
+
storage?: ImageUploadConfig;
|
|
33
|
+
};
|
|
34
|
+
export type { ImageUploadConfig, StorageConfig } from './index';
|
|
35
|
+
/**
|
|
36
|
+
* Simple Form component that renders a form from pre-extracted field information.
|
|
37
|
+
*
|
|
38
|
+
* Use this component when fields have already been extracted from a schema definition
|
|
39
|
+
* (e.g., in server components where the `SchemaDefinition` cannot be passed directly,
|
|
40
|
+
* or when using `extractPageProps` from `litecms/admin/config`).
|
|
41
|
+
*
|
|
42
|
+
* For client components with direct access to the schema, prefer `CmsAutoForm` instead.
|
|
43
|
+
*
|
|
44
|
+
* @example
|
|
45
|
+
* ```tsx
|
|
46
|
+
* // In a server component
|
|
47
|
+
* const props = await extractPageProps(cmsConfig, slug);
|
|
48
|
+
* return <CmsSimpleForm {...props} />;
|
|
49
|
+
* ```
|
|
50
|
+
*
|
|
51
|
+
* @see CmsAutoForm - for use with SchemaDefinition (not serializable)
|
|
52
|
+
*/
|
|
53
|
+
export declare function CmsSimpleForm({ fields, action, values, styles, submitText, submitPendingText, successMessage, storage, }: CmsSimpleFormProps): import("react/jsx-runtime").JSX.Element;
|
|
54
|
+
//# sourceMappingURL=CmsSimpleForm.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"CmsSimpleForm.d.ts","sourceRoot":"","sources":["../../src/components/CmsSimpleForm.tsx"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,WAAW,CAAC;AAC3C,OAAO,KAAK,EAAE,YAAY,EAAkB,iBAAiB,EAAE,MAAM,SAAS,CAAC;AAS/E,MAAM,MAAM,iBAAiB,GAAG;IAC5B,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,KAAK,CAAC,EAAE,MA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Form, useCmsForm, CmsSubmitButton, CmsFormError, CmsFormSuccess, type CmsFormProps, } from './CmsForm';
|
|
4
|
+
export { CmsField, CmsHiddenField, CmsCheckbox, type CmsFieldProps, } from './CmsField';
|
|
5
|
+
export { CmsImageField, type CmsImageFieldProps, } from './CmsImageField';
|
|
6
|
+
export { CmsAutoForm, type CmsAutoFormProps, type CmsAutoFormStyles } from './CmsAutoForm';
|
|
7
|
+
export type ServerAction<T> = (prevState: ActionState<T>, formData: FormData) => Promise<ActionState<T>>;
|
|
8
|
+
export type FieldGroupData = {
|
|
9
|
+
name: string | null;
|
|
10
|
+
fields: FieldInfo[];
|
|
11
|
+
};
|
|
12
|
+
/**
|
|
13
|
+
* Context for CMS form state
|
|
14
|
+
*/
|
|
15
|
+
export type CmsFormContextValue = {
|
|
16
|
+
isPending: boolean;
|
|
17
|
+
formError?: string;
|
|
18
|
+
showSuccess: boolean;
|
|
19
|
+
};
|
|
20
|
+
export type StoredImage = {
|
|
21
|
+
key: string;
|
|
22
|
+
url: string;
|
|
23
|
+
lastModified?: string;
|
|
24
|
+
size?: number;
|
|
25
|
+
};
|
|
26
|
+
/**
|
|
27
|
+
* Configuration for client-side image upload endpoints.
|
|
28
|
+
* This is used by form components to upload/list images.
|
|
29
|
+
*
|
|
30
|
+
* @note This is different from `StorageConfig` in `litecms/storage` which
|
|
31
|
+
* configures the S3 client on the server side.
|
|
32
|
+
*/
|
|
33
|
+
export type ImageUploadConfig = {
|
|
34
|
+
/** API endpoint for uploading images */
|
|
35
|
+
uploadEndpoint: string;
|
|
36
|
+
/** API endpoint for listing images (optional) */
|
|
37
|
+
listEndpoint?: string;
|
|
38
|
+
};
|
|
39
|
+
/**
|
|
40
|
+
* @deprecated Use `ImageUploadConfig` instead. This alias exists for backwards compatibility.
|
|
41
|
+
*/
|
|
42
|
+
export type StorageConfig = ImageUploadConfig;
|
|
43
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3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