@llmnative/react 0.1.0 → 1.0.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 +387 -364
- package/bin/cli.js +117 -98
- package/dist/index.css +1 -1
- package/dist/index.js +21 -823
- package/dist/index.mjs +14246 -9296
- package/dist/style.css +1 -0
- package/dist/types/src/App.d.ts +72 -14
- package/dist/types/src/Config.d.ts +28 -5
- package/dist/types/src/Global.d.ts +2 -2
- package/dist/types/src/I18n.d.ts +185 -0
- package/dist/types/src/Theme.d.ts +153 -81
- package/dist/types/src/auth.d.ts +13 -1
- package/dist/types/src/components/Component.d.ts +13 -27
- package/dist/types/src/components/ErrorBoundary.d.ts +30 -0
- package/dist/types/src/components/blocks/Brand.d.ts +4 -4
- package/dist/types/src/components/blocks/Breadcrumbs.d.ts +50 -4
- package/dist/types/src/components/blocks/Carousel.d.ts +5 -5
- package/dist/types/src/components/blocks/Dropdown.d.ts +26 -20
- package/dist/types/src/components/blocks/ListCard.d.ts +31 -0
- package/dist/types/src/components/blocks/Menu.d.ts +13 -16
- package/dist/types/src/components/blocks/Notifications.d.ts +8 -3
- package/dist/types/src/components/blocks/ProviderSwitcher.d.ts +63 -0
- package/dist/types/src/components/blocks/Search.d.ts +2 -2
- package/dist/types/src/components/blocks/SideNav.d.ts +45 -0
- package/dist/types/src/components/blocks/ThemeSwitcher.d.ts +24 -0
- package/dist/types/src/components/blocks/Toolbar.d.ts +19 -0
- package/dist/types/src/components/index.d.ts +27 -6
- package/dist/types/src/components/types.d.ts +10 -3
- package/dist/types/src/components/ui/Alert.d.ts +16 -4
- package/dist/types/src/components/ui/Badge.d.ts +6 -5
- package/dist/types/src/components/ui/Buttons.d.ts +13 -12
- package/dist/types/src/components/ui/Card.d.ts +8 -7
- package/dist/types/src/components/ui/Code.d.ts +1 -1
- package/dist/types/src/components/ui/Gallery.d.ts +13 -14
- package/dist/types/src/components/ui/GridSystem.d.ts +1 -1
- package/dist/types/src/components/ui/Icon.d.ts +3 -1
- package/dist/types/src/components/ui/Image.d.ts +1 -1
- package/dist/types/src/components/ui/ImageAvatar.d.ts +1 -1
- package/dist/types/src/components/ui/Loader.d.ts +1 -1
- package/dist/types/src/components/ui/LocaleSwitcher.d.ts +14 -0
- package/dist/types/src/components/ui/Modal.d.ts +42 -15
- package/dist/types/src/components/ui/Pagination.d.ts +14 -3
- package/dist/types/src/components/ui/Percentage.d.ts +5 -5
- package/dist/types/src/components/ui/Repeat.d.ts +15 -6
- package/dist/types/src/components/ui/Tab.d.ts +29 -2
- package/dist/types/src/components/ui/TabDynamic.d.ts +4 -3
- package/dist/types/src/components/ui/Table.d.ts +15 -14
- package/dist/types/src/components/ui/fields/CodeEditor.d.ts +43 -0
- package/dist/types/src/components/ui/fields/ContextMenu.d.ts +38 -0
- package/dist/types/src/components/ui/fields/Crop.d.ts +4 -2
- package/dist/types/src/components/ui/fields/ImageField.d.ts +31 -0
- package/dist/types/src/components/ui/fields/Input.d.ts +43 -14
- package/dist/types/src/components/ui/fields/Prompt.d.ts +2 -31
- package/dist/types/src/components/ui/fields/RichText.d.ts +86 -0
- package/dist/types/src/components/ui/fields/Select.d.ts +13 -10
- package/dist/types/src/components/ui/fields/Upload.d.ts +37 -2
- package/dist/types/src/components/ui/fields/UploadCSV.d.ts +2 -0
- package/dist/types/src/components/ui/useRecordSelection.d.ts +1 -2
- package/dist/types/src/components/widgets/Form.d.ts +80 -43
- package/dist/types/src/components/widgets/ImageEditor.d.ts +4 -5
- package/dist/types/src/components/widgets/MarkdownReader.d.ts +4 -4
- package/dist/types/src/components/widgets/Prompt.d.ts +71 -23
- package/dist/types/src/components/widgets/TabDynamic.d.ts +4 -3
- package/dist/types/src/components/widgets/form-controller.d.ts +42 -0
- package/dist/types/src/components/widgets/grid-core/GridCore.d.ts +1 -1
- package/dist/types/src/components/widgets/grid-core/GridDB.d.ts +1 -1
- package/dist/types/src/components/widgets/grid-core/GridGalleryView.d.ts +1 -1
- package/dist/types/src/components/widgets/grid-core/GridTableView.d.ts +1 -1
- package/dist/types/src/components/widgets/grid-core/types.d.ts +77 -27
- package/dist/types/src/components/widgets/grid-core/useGridActions.d.ts +4 -8
- package/dist/types/src/components/widgets/grid-core/useGridColumns.d.ts +2 -2
- package/dist/types/src/components/widgets/grid-core/useGridDBRecords.d.ts +1 -2
- package/dist/types/src/components/widgets/grid-core/useGridPreparedRecords.d.ts +2 -2
- package/dist/types/src/components/widgets/grid-core/useGridSelection.d.ts +4 -5
- package/dist/types/src/components/widgets/grid-core/utils.d.ts +11 -3
- package/dist/types/src/conf/Prompt.d.ts +1 -1
- package/dist/types/src/conf/i18n/ar.d.ts +2 -0
- package/dist/types/src/conf/i18n/de.d.ts +2 -0
- package/dist/types/src/conf/i18n/en.d.ts +2 -0
- package/dist/types/src/conf/i18n/index.d.ts +6 -0
- package/dist/types/src/conf/i18n/it.d.ts +2 -0
- package/dist/types/src/conf/i18n/ru.d.ts +2 -0
- package/dist/types/src/conf/i18n/zh.d.ts +2 -0
- package/dist/types/src/constant.d.ts +1 -1
- package/dist/types/src/index.d.ts +38 -13
- package/dist/types/src/libs/converter.d.ts +4 -4
- package/dist/types/src/libs/editorHeight.d.ts +12 -0
- package/dist/types/src/libs/fetch.d.ts +4 -4
- package/dist/types/src/libs/imageBuilder.d.ts +63 -14
- package/dist/types/src/libs/imageVariants.d.ts +35 -0
- package/dist/types/src/libs/index.d.ts +1 -4
- package/dist/types/src/libs/promptUtils.d.ts +24 -0
- package/dist/types/src/libs/sanitizer.d.ts +2 -2
- package/dist/types/src/libs/utils.d.ts +9 -10
- package/dist/types/src/pages/index.d.ts +0 -2
- package/dist/types/src/providers/ProviderConfiguration.d.ts +6 -0
- package/dist/types/src/providers/ProviderRegistryContext.d.ts +51 -0
- package/dist/types/src/providers/ProviderSession.d.ts +68 -0
- package/dist/types/src/providers/ai/AIProvider.d.ts +57 -0
- package/dist/types/src/providers/ai/AIProviderContext.d.ts +13 -0
- package/dist/types/src/providers/ai/anthropic.d.ts +2 -0
- package/dist/types/src/providers/ai/deepseek.d.ts +1 -0
- package/dist/types/src/providers/ai/gemini.d.ts +2 -0
- package/dist/types/src/providers/ai/glm.d.ts +1 -0
- package/dist/types/src/providers/ai/index.d.ts +9 -134
- package/dist/types/src/providers/ai/mistral.d.ts +1 -0
- package/dist/types/src/providers/ai/openai.d.ts +1 -0
- package/dist/types/src/providers/ai/openaiCompatible.d.ts +17 -0
- package/dist/types/src/providers/ai/opencode.d.ts +2 -0
- package/dist/types/src/providers/ai/openrouter.d.ts +1 -0
- package/dist/types/src/providers/ai/shared.d.ts +46 -0
- package/dist/types/src/providers/api/ApiProvider.d.ts +43 -0
- package/dist/types/src/providers/api/direct.d.ts +14 -0
- package/dist/types/src/providers/api/firebase.d.ts +14 -0
- package/dist/types/src/providers/api/mock.d.ts +7 -0
- package/dist/types/src/providers/api/supabase.d.ts +14 -0
- package/dist/types/src/providers/auth/AuthProvider.d.ts +2 -2
- package/dist/types/src/providers/auth/firebase/FirebaseAuthProvider.d.ts +26 -0
- package/dist/types/src/providers/auth/google/GoogleAuth.d.ts +2 -2
- package/dist/types/src/providers/auth/supabase/SupabaseAuthProvider.d.ts +48 -0
- package/dist/types/src/providers/credentials/CredentialsProvider.d.ts +3 -0
- package/dist/types/src/providers/credentials/CredentialsProviderContext.d.ts +12 -0
- package/dist/types/src/providers/credentials/google/GoogleServiceAccountProvider.d.ts +8 -0
- package/dist/types/src/providers/data/DataProvider.d.ts +27 -1
- package/dist/types/src/providers/data/firebase.d.ts +5 -4
- package/dist/types/src/providers/data/firestore.d.ts +38 -0
- package/dist/types/src/providers/data/mock.d.ts +8 -1
- package/dist/types/src/providers/data/supabase.d.ts +36 -10
- package/dist/types/src/providers/firebase-init.d.ts +15 -4
- package/dist/types/src/providers/icon/PhosphorIconProvider.d.ts +1 -1
- package/dist/types/src/providers/manifest.d.ts +20 -14
- package/dist/types/src/providers/proxy/index.d.ts +7 -0
- package/dist/types/src/providers/proxy/vite.d.ts +3 -0
- package/dist/types/src/providers/scrape/index.d.ts +2 -1
- package/dist/types/src/providers/seo/google/keyword.d.ts +6 -1
- package/dist/types/src/providers/storage/StorageProvider.d.ts +155 -4
- package/dist/types/src/providers/storage/dropbox.d.ts +3 -3
- package/dist/types/src/providers/storage/firebase.d.ts +38 -7
- package/dist/types/src/providers/storage/supabase.d.ts +47 -7
- package/dist/types/src/providers/supabase-init.d.ts +35 -0
- package/dist/types/src/types/FormFields.d.ts +4 -2
- package/dist/types/src/types/FormSchema.d.ts +29 -0
- package/dist/types/themes/tokyo-night-light.d.ts +3 -0
- package/dist/types/themes/tokyo-night.d.ts +3 -0
- package/dist/types/themes/vscode-dark-plus.d.ts +3 -0
- package/dist/types/themes/vscode-light-plus.d.ts +3 -0
- package/dist/vite.js +1 -0
- package/dist/vite.mjs +54 -0
- package/package.json +45 -14
- package/scripts/cli/proxy-templates/cloudflare.ts +34 -0
- package/scripts/cli/proxy-templates/express.ts +77 -0
- package/scripts/cli/proxy-templates/nextjs-app.ts +42 -0
- package/scripts/cli/proxy-templates/nextjs-pages.ts +41 -0
- package/scripts/cli/proxy-templates/scaffold.json +33 -0
- package/scripts/cli/setup-devtools.js +155 -85
- package/scripts/cli/setup-project.js +618 -484
- package/themes/cyber.ts +469 -405
- package/themes/default.ts +469 -405
- package/themes/flat.ts +469 -405
- package/themes/tokyo-night-light.ts +38 -0
- package/themes/tokyo-night.ts +38 -0
- package/themes/vscode-dark-plus.ts +29 -0
- package/themes/vscode-light-plus.ts +29 -0
- package/dist/index.js.map +0 -1
- package/dist/index.mjs.map +0 -1
- package/dist/types/src/components/FormEnhancer.d.ts +0 -26
- package/dist/types/src/components/Template.d.ts +0 -18
- package/dist/types/src/components/ui/fields/AssistantAI.d.ts +0 -23
- package/dist/types/src/components/ui/fields/Command.d.ts +0 -15
- package/dist/types/src/components/ui/fields/ImageUrl.d.ts +0 -7
- package/dist/types/src/libs/cache.d.ts +0 -9
- package/dist/types/src/libs/database.d.ts +0 -3
- package/dist/types/src/libs/log.d.ts +0 -2
- package/dist/types/src/libs/seo.d.ts +0 -8
- package/dist/types/src/libs/storage.d.ts +0 -2
- package/dist/types/src/pages/Blog.d.ts +0 -3
- package/dist/types/src/pages/BlogPost.d.ts +0 -16
- package/dist/types/src/pages/Helper.d.ts +0 -8
- package/dist/types/src/providers/auth/google/apis/auth.d.ts +0 -4
- package/dist/types/src/types/Block.d.ts +0 -4
- package/dist/types/src/types/Section.d.ts +0 -4
|
@@ -1,15 +1,22 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import { UIProps } from '../../..';
|
|
3
3
|
import { FormFieldProps, InputType } from '../../widgets/Form';
|
|
4
|
+
import type { FieldValue } from '../../../providers/data/DataProvider';
|
|
4
5
|
interface BaseInputProps extends FormFieldProps {
|
|
5
6
|
placeholder?: string;
|
|
6
7
|
type?: InputType;
|
|
7
|
-
|
|
8
|
+
/** When `true`, the field becomes read-only (disabled) once a value has been set. */
|
|
9
|
+
readOnlyAfterSet?: boolean;
|
|
8
10
|
disabled?: boolean;
|
|
9
11
|
feedback?: string;
|
|
10
12
|
min?: number;
|
|
11
13
|
max?: number;
|
|
12
14
|
step?: number;
|
|
15
|
+
id?: string;
|
|
16
|
+
labelClassName?: string;
|
|
17
|
+
validator?: (value: FieldValue) => string | undefined | Promise<string | undefined>;
|
|
18
|
+
/** Content rendered as an absolute overlay inside the input (right side). No addon border/bg. */
|
|
19
|
+
afterInset?: React.ReactNode;
|
|
13
20
|
}
|
|
14
21
|
interface LabelProps {
|
|
15
22
|
label: string;
|
|
@@ -20,15 +27,27 @@ interface LabelProps {
|
|
|
20
27
|
export type InputProps = Omit<BaseInputProps, 'type'>;
|
|
21
28
|
export interface CheckboxProps extends FormFieldProps {
|
|
22
29
|
title?: string;
|
|
30
|
+
ariaLabel?: string;
|
|
23
31
|
valueChecked?: string | number;
|
|
24
32
|
}
|
|
33
|
+
export interface HiddenProps extends FormFieldProps {
|
|
34
|
+
id?: string;
|
|
35
|
+
}
|
|
25
36
|
export interface TextAreaProps extends FormFieldProps {
|
|
26
37
|
placeholder?: string;
|
|
27
|
-
|
|
38
|
+
/** When `true`, the textarea becomes read-only (disabled) once a value has been set. */
|
|
39
|
+
readOnlyAfterSet?: boolean;
|
|
28
40
|
disabled?: boolean;
|
|
29
|
-
|
|
41
|
+
minHeight?: number;
|
|
42
|
+
maxHeight?: number;
|
|
30
43
|
feedback?: string;
|
|
31
|
-
|
|
44
|
+
textareaRef?: React.RefObject<HTMLTextAreaElement | null> | ((el: HTMLTextAreaElement | null) => void) | undefined;
|
|
45
|
+
id?: string;
|
|
46
|
+
labelClassName?: string;
|
|
47
|
+
validator?: (value: FieldValue) => string | undefined | Promise<string | undefined>;
|
|
48
|
+
onKeyDown?: React.KeyboardEventHandler<HTMLTextAreaElement>;
|
|
49
|
+
onClick?: React.MouseEventHandler<HTMLTextAreaElement>;
|
|
50
|
+
onBlur?: React.FocusEventHandler<HTMLTextAreaElement>;
|
|
32
51
|
}
|
|
33
52
|
export interface ListGroupProps extends UIProps {
|
|
34
53
|
children: React.ReactNode[];
|
|
@@ -36,17 +55,26 @@ export interface ListGroupProps extends UIProps {
|
|
|
36
55
|
label?: string;
|
|
37
56
|
draggable?: boolean;
|
|
38
57
|
onDrop?: (text: string) => string;
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
58
|
+
activeIndices?: number[];
|
|
59
|
+
disabledIndices?: number[];
|
|
60
|
+
loadingIndices?: number[];
|
|
61
|
+
itemClassName?: string;
|
|
43
62
|
}
|
|
44
|
-
export declare const
|
|
63
|
+
export declare const fieldLabelClass = "mb-1 block text-sm font-medium leading-5 text-foreground";
|
|
64
|
+
export declare const fieldFeedbackClass = "mt-1 text-xs text-muted-foreground";
|
|
65
|
+
export declare const fieldControlBaseClass = "flex h-9 w-full rounded-md border border-input bg-background px-3 py-1 text-sm shadow-sm transition-colors placeholder:text-muted-foreground focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring disabled:cursor-not-allowed disabled:opacity-50";
|
|
66
|
+
export declare const fieldTextAreaBaseClass = "flex min-h-[5rem] w-full rounded-md border border-input bg-background px-3 py-2 text-sm shadow-sm transition-colors placeholder:text-muted-foreground focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring disabled:cursor-not-allowed disabled:opacity-50";
|
|
67
|
+
export declare const fieldGroupClass = "flex w-full items-stretch";
|
|
68
|
+
export declare const fieldAddonClass = "inline-flex shrink-0 items-center border border-input bg-muted px-3 py-1 text-sm text-muted-foreground";
|
|
69
|
+
export declare const FieldError: ({ message }: {
|
|
70
|
+
message: string;
|
|
71
|
+
}) => React.JSX.Element;
|
|
72
|
+
export declare const Input: ({ name, onChange, defaultValue, placeholder, label, type, required, readOnlyAfterSet, disabled, before, after, afterInset, feedback, min, max, step, id, labelClassName, inheritWrapperClassName, wrapperClassName, className, validator, labelMode, }: BaseInputProps) => React.JSX.Element;
|
|
45
73
|
export declare const String: (props: InputProps) => React.JSX.Element;
|
|
46
74
|
export declare const Number: (props: InputProps) => React.JSX.Element;
|
|
47
75
|
export declare const Email: (props: InputProps) => React.JSX.Element;
|
|
48
76
|
export declare const Password: (props: InputProps) => React.JSX.Element;
|
|
49
|
-
export declare const Color: (props: InputProps) => React.JSX.Element;
|
|
77
|
+
export declare const Color: ({ className, ...props }: InputProps) => React.JSX.Element;
|
|
50
78
|
export declare const Date: (props: InputProps) => React.JSX.Element;
|
|
51
79
|
export declare const Time: (props: InputProps) => React.JSX.Element;
|
|
52
80
|
export declare const DateTime: (props: InputProps) => React.JSX.Element;
|
|
@@ -54,9 +82,10 @@ export declare const Week: (props: InputProps) => React.JSX.Element;
|
|
|
54
82
|
export declare const Month: (props: InputProps) => React.JSX.Element;
|
|
55
83
|
export declare const Range: (props: InputProps) => React.JSX.Element;
|
|
56
84
|
export declare const Url: (props: InputProps) => React.JSX.Element;
|
|
57
|
-
export declare const
|
|
58
|
-
export declare const
|
|
85
|
+
export declare const Hidden: ({ name, onChange, defaultValue, value, id, inheritWrapperClassName, wrapperClassName, }: HiddenProps) => React.JSX.Element;
|
|
86
|
+
export declare const Checkbox: ({ name, onChange, defaultValue, label, title, ariaLabel, required, valueChecked, before, after, inheritWrapperClassName, wrapperClassName, className }: CheckboxProps) => React.JSX.Element;
|
|
87
|
+
export declare const Switch: ({ name, onChange, defaultValue, label, title, ariaLabel, required, valueChecked, before, after, inheritWrapperClassName, wrapperClassName, className }: CheckboxProps) => React.JSX.Element;
|
|
59
88
|
export declare const Label: ({ label, required, htmlFor, className }: LabelProps) => React.JSX.Element;
|
|
60
|
-
export declare const TextArea: ({ name, onChange, defaultValue, placeholder, label, required,
|
|
61
|
-
export declare const ListGroup: ({ children, onClick, label,
|
|
89
|
+
export declare const TextArea: ({ name, onChange, defaultValue, placeholder, label, required, readOnlyAfterSet, disabled, minHeight, maxHeight, textareaRef, before, after, feedback, id, labelClassName, inheritWrapperClassName, className, wrapperClassName, validator, onKeyDown, onClick, onBlur, labelMode, }: TextAreaProps) => React.JSX.Element;
|
|
90
|
+
export declare const ListGroup: ({ children, onClick, label, activeIndices, draggable, onDrop, disabledIndices, loadingIndices, before, after, wrapperClassName, className, itemClassName }: ListGroupProps) => React.JSX.Element;
|
|
62
91
|
export {};
|
|
@@ -1,31 +1,2 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
import { PromptVariables } from '../../../conf/Prompt';
|
|
4
|
-
import { FormFieldProps } from '../../widgets/Form';
|
|
5
|
-
export declare enum PromptMode {
|
|
6
|
-
EDITOR = "editor",
|
|
7
|
-
LIVE = "live"
|
|
8
|
-
}
|
|
9
|
-
type PromptOptions = AIFetchConfig & {
|
|
10
|
-
value: string;
|
|
11
|
-
};
|
|
12
|
-
type OnRunPrompt = (prompt: string, config: AIFetchConfig, data?: PromptVariables) => Promise<string>;
|
|
13
|
-
export interface PromptProps extends FormFieldProps {
|
|
14
|
-
mode?: PromptMode;
|
|
15
|
-
onRunPrompt?: OnRunPrompt;
|
|
16
|
-
renderPromptDisabled?: (props: Omit<FormFieldProps, "defaultValue">) => React.ReactNode;
|
|
17
|
-
rows?: number;
|
|
18
|
-
defaultValue?: {
|
|
19
|
-
value?: string;
|
|
20
|
-
enabled?: boolean;
|
|
21
|
-
role?: string;
|
|
22
|
-
language?: string;
|
|
23
|
-
voice?: string;
|
|
24
|
-
style?: string;
|
|
25
|
-
model?: string;
|
|
26
|
-
temperature?: number;
|
|
27
|
-
};
|
|
28
|
-
}
|
|
29
|
-
export declare const Prompt: ({ mode, onRunPrompt, renderPromptDisabled, ...props }: PromptProps) => React.JSX.Element;
|
|
30
|
-
export declare const runPrompt: (options: PromptOptions, data?: PromptVariables, onRunPrompt?: OnRunPrompt) => Promise<string>;
|
|
31
|
-
export {};
|
|
1
|
+
export { default, Prompt, PromptMode, runPrompt } from '../../widgets/Prompt';
|
|
2
|
+
export type { PromptProps } from '../../widgets/Prompt';
|
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { FormFieldProps } from '../../widgets/Form';
|
|
3
|
+
import type { FieldValue } from '../../../providers/data/DataProvider';
|
|
4
|
+
export type ToolbarCommand = 'bold' | 'italic' | 'underline' | 'strike' | 'headings' | 'heading1' | 'heading2' | 'heading3' | 'bulletList' | 'orderedList' | 'blockquote' | 'code' | 'codeBlock' | 'link' | 'table' | 'imageUpload' | 'documentUpload' | 'sourceCode' | 'undo' | 'redo' | 'clearFormat' | '|';
|
|
5
|
+
export interface StatusBarConfig {
|
|
6
|
+
/** Show the DOM ancestor tag breadcrumb at the cursor (e.g. p › strong). Default: true. */
|
|
7
|
+
tagBreadcrumb?: boolean;
|
|
8
|
+
/** Show the word count. Default: true. */
|
|
9
|
+
wordCount?: boolean;
|
|
10
|
+
/** Show the character count. Default: false. */
|
|
11
|
+
charCount?: boolean;
|
|
12
|
+
}
|
|
13
|
+
export interface RichTextImageUploadConfig {
|
|
14
|
+
/**
|
|
15
|
+
* Storage path prefix for uploaded images.
|
|
16
|
+
* Requires a StorageProvider ancestor.
|
|
17
|
+
* Example: "/content/posts/hero"
|
|
18
|
+
*/
|
|
19
|
+
path?: string;
|
|
20
|
+
/**
|
|
21
|
+
* Pixel widths to generate as responsive srcset variants.
|
|
22
|
+
* Each width produces a canvas-resized copy stored as <name>_<width>w.<ext>.
|
|
23
|
+
* Pass [] to disable srcset generation entirely.
|
|
24
|
+
* Default: [400, 800]
|
|
25
|
+
*/
|
|
26
|
+
srcsetWidths?: number[];
|
|
27
|
+
/**
|
|
28
|
+
* Accepted MIME types for the image file picker.
|
|
29
|
+
* Default: "image/*"
|
|
30
|
+
*/
|
|
31
|
+
accept?: string;
|
|
32
|
+
/**
|
|
33
|
+
* Maximum file size in bytes.
|
|
34
|
+
* Default: 10_485_760 (10 MB)
|
|
35
|
+
*/
|
|
36
|
+
maxBytes?: number;
|
|
37
|
+
}
|
|
38
|
+
export interface RichTextDocumentUploadConfig {
|
|
39
|
+
/**
|
|
40
|
+
* Storage path prefix for uploaded documents.
|
|
41
|
+
* Requires a StorageProvider ancestor.
|
|
42
|
+
* Example: "/content/posts/attachments"
|
|
43
|
+
*/
|
|
44
|
+
path?: string;
|
|
45
|
+
/**
|
|
46
|
+
* Accepted MIME types / file extensions for the document file picker.
|
|
47
|
+
* Default: ".pdf,.doc,.docx,.txt,.csv"
|
|
48
|
+
*/
|
|
49
|
+
accept?: string;
|
|
50
|
+
/**
|
|
51
|
+
* Maximum file size in bytes.
|
|
52
|
+
* Default: 20_971_520 (20 MB)
|
|
53
|
+
*/
|
|
54
|
+
maxBytes?: number;
|
|
55
|
+
}
|
|
56
|
+
export interface RichTextProps extends FormFieldProps {
|
|
57
|
+
placeholder?: string;
|
|
58
|
+
disabled?: boolean;
|
|
59
|
+
feedback?: string;
|
|
60
|
+
/** Position of the formatting toolbar. false hides it entirely. Default: 'fixed'. */
|
|
61
|
+
toolbar?: 'fixed' | 'floating' | false;
|
|
62
|
+
/** Ordered list of toolbar commands to show. Defaults to all commands. */
|
|
63
|
+
toolbarCommands?: ToolbarCommand[];
|
|
64
|
+
/** Format used to read/write the field value. Default: 'html'. */
|
|
65
|
+
outputFormat?: 'html' | 'json' | 'text';
|
|
66
|
+
/** Show the status bar below the editor. Pass true for defaults or a config object. Default: false. */
|
|
67
|
+
statusBar?: boolean | StatusBarConfig;
|
|
68
|
+
/** Minimum editor height in px. Default: 120. */
|
|
69
|
+
minHeight?: number;
|
|
70
|
+
/** Maximum editor height in px; content scrolls beyond this. */
|
|
71
|
+
maxHeight?: number;
|
|
72
|
+
/**
|
|
73
|
+
* Image upload behaviour for the imageUpload toolbar command.
|
|
74
|
+
* Pass an object to enable uploads; omit to keep images as base64 data URIs.
|
|
75
|
+
*/
|
|
76
|
+
imageUpload?: RichTextImageUploadConfig;
|
|
77
|
+
/**
|
|
78
|
+
* Document upload behaviour for the documentUpload toolbar command.
|
|
79
|
+
* Pass an object to enable cloud storage uploads; omit to use data URI fallback.
|
|
80
|
+
*/
|
|
81
|
+
documentUpload?: RichTextDocumentUploadConfig;
|
|
82
|
+
labelClassName?: string;
|
|
83
|
+
validator?: (value: FieldValue) => string | undefined;
|
|
84
|
+
}
|
|
85
|
+
export declare const RichText: ({ name, onChange, defaultValue, label, required, placeholder, disabled, feedback, toolbar, toolbarCommands, outputFormat, statusBar, minHeight, maxHeight, imageUpload, documentUpload, labelClassName, inheritWrapperClassName, wrapperClassName, className, before, after, validator, }: RichTextProps) => React.JSX.Element;
|
|
86
|
+
export default RichText;
|
|
@@ -1,38 +1,41 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import { type OrderConfig } from "../../../libs/order";
|
|
3
|
-
import { DBConfig, RecordProps } from "../../../providers/data/DataProvider";
|
|
3
|
+
import { DBConfig, FieldValue, RecordProps } from "../../../providers/data/DataProvider";
|
|
4
4
|
import { FormFieldProps } from '../../widgets/Form';
|
|
5
5
|
interface Option extends RecordProps {
|
|
6
6
|
label: string;
|
|
7
7
|
value: string;
|
|
8
|
+
group?: string;
|
|
8
9
|
}
|
|
9
10
|
type OptionOrderConfig = OrderConfig & {
|
|
10
11
|
field: 'label' | 'value';
|
|
11
12
|
};
|
|
12
13
|
interface BaseProps extends FormFieldProps {
|
|
13
|
-
|
|
14
|
+
/** When `true`, the select becomes read-only (disabled) once a value has been set. */
|
|
15
|
+
readOnlyAfterSet?: boolean;
|
|
14
16
|
disabled?: boolean;
|
|
15
17
|
title?: string;
|
|
16
18
|
feedback?: string;
|
|
17
19
|
options?: Option[] | string[] | number[];
|
|
18
|
-
|
|
20
|
+
optionsSource?: DBConfig;
|
|
19
21
|
order?: OptionOrderConfig;
|
|
22
|
+
validator?: (value: FieldValue) => string | undefined;
|
|
20
23
|
}
|
|
21
24
|
export interface SelectProps extends BaseProps {
|
|
22
|
-
|
|
25
|
+
placeholderOption?: Option;
|
|
23
26
|
value?: string | number;
|
|
24
27
|
}
|
|
25
28
|
export interface AutocompleteProps extends BaseProps {
|
|
26
|
-
|
|
27
|
-
|
|
29
|
+
minItems?: number;
|
|
30
|
+
maxItems?: number;
|
|
28
31
|
placeholder?: string;
|
|
29
32
|
creatable?: boolean;
|
|
30
33
|
onCreate?: (value: string) => Promise<void> | void;
|
|
31
34
|
}
|
|
32
35
|
export interface ChecklistProps extends BaseProps {
|
|
33
|
-
|
|
36
|
+
itemClassName?: string;
|
|
34
37
|
}
|
|
35
|
-
export declare const Select: ({ name, onChange, defaultValue, required,
|
|
36
|
-
export declare const Autocomplete: ({ name, defaultValue,
|
|
37
|
-
export declare const Checklist: ({ name, defaultValue, onChange, required,
|
|
38
|
+
export declare const Select: ({ name, onChange, defaultValue, required, readOnlyAfterSet, disabled, placeholderOption, label, title, before, after, feedback, options, optionsSource, order, inheritWrapperClassName, wrapperClassName, className, validator, }: SelectProps) => React.JSX.Element;
|
|
39
|
+
export declare const Autocomplete: ({ name, defaultValue, minItems, maxItems, onChange, required, readOnlyAfterSet, disabled, label, title, placeholder, before, after, feedback, options, optionsSource, order, inheritWrapperClassName, wrapperClassName, className, creatable, onCreate, }: AutocompleteProps) => React.JSX.Element;
|
|
40
|
+
export declare const Checklist: ({ name, defaultValue, onChange, required, readOnlyAfterSet, disabled, label, title, before, after, feedback, options, optionsSource, order, inheritWrapperClassName, wrapperClassName, className, itemClassName, }: ChecklistProps) => React.JSX.Element;
|
|
38
41
|
export {};
|
|
@@ -9,17 +9,52 @@ export interface FileProps {
|
|
|
9
9
|
url: string;
|
|
10
10
|
base64?: string;
|
|
11
11
|
variants: Record<string, any>;
|
|
12
|
+
srcset?: string;
|
|
13
|
+
sizes?: string;
|
|
12
14
|
}
|
|
15
|
+
export interface UseFileUploadCoreOptions {
|
|
16
|
+
/** Called on every files state update. Use for Form sync. */
|
|
17
|
+
onFilesChange?: (files: FileProps[]) => void;
|
|
18
|
+
/** Called once when a file reaches progress 100. Use to trigger insert dialogs. */
|
|
19
|
+
onFileReady?: (file: FileProps) => void;
|
|
20
|
+
/** StorageProvider path. When set with a storage provider, files are auto-uploaded. */
|
|
21
|
+
uploadPath?: string;
|
|
22
|
+
/**
|
|
23
|
+
* Pixel widths for responsive image variants. When set with uploadPath, generates
|
|
24
|
+
* canvas-resized variants at each width and populates file.srcset / file.sizes.
|
|
25
|
+
* Each variant is stored as <name>_<width>w.<ext>. Default: undefined (no variants).
|
|
26
|
+
* Example: [400, 800] produces _400w and _800w files.
|
|
27
|
+
*/
|
|
28
|
+
srcsetWidths?: number[];
|
|
29
|
+
/** Initial file list (e.g. from a form record on load). */
|
|
30
|
+
initialFiles?: FileProps[];
|
|
31
|
+
}
|
|
32
|
+
export declare const useFileUploadCore: ({ onFilesChange, onFileReady, uploadPath, srcsetWidths, initialFiles, }: UseFileUploadCoreOptions) => {
|
|
33
|
+
files: FileProps[];
|
|
34
|
+
setFiles: React.Dispatch<React.SetStateAction<FileProps[]>>;
|
|
35
|
+
fileInputRef: React.MutableRefObject<HTMLInputElement | null>;
|
|
36
|
+
updateFile: (key: string, updates: Partial<FileProps>) => void;
|
|
37
|
+
handleFiles: (selectedFiles: File[]) => void;
|
|
38
|
+
handleUpload: () => void | undefined;
|
|
39
|
+
handleUploadChange: (e: React.ChangeEvent<HTMLInputElement>) => void;
|
|
40
|
+
handleRemove: (key: string) => void;
|
|
41
|
+
};
|
|
13
42
|
export interface UploadDocumentProps extends FormFieldProps {
|
|
14
43
|
editable?: boolean;
|
|
15
44
|
multiple?: boolean;
|
|
16
45
|
accept?: string;
|
|
17
46
|
max?: number;
|
|
47
|
+
/** StorageProvider path — when set, files are auto-uploaded on selection. */
|
|
48
|
+
uploadPath?: string;
|
|
18
49
|
}
|
|
19
50
|
export interface UploadImageProps extends UploadDocumentProps {
|
|
20
51
|
previewHeight?: number;
|
|
21
52
|
previewWidth?: number;
|
|
53
|
+
/** Text shown inside the empty-state drop zone, below the upload icon. */
|
|
54
|
+
feedback?: string;
|
|
55
|
+
/** Pixel widths for responsive variants. Set with uploadPath to generate <name>_400w.jpg etc. and populate srcset/sizes in the Form record. */
|
|
56
|
+
srcsetWidths?: number[];
|
|
22
57
|
}
|
|
23
58
|
export declare const getFileUrl: (file: FileProps, suffix?: string) => string;
|
|
24
|
-
export declare const UploadDocument: ({ name, onChange, label, required, editable, multiple, max, accept,
|
|
25
|
-
export declare const UploadImage: ({ name, onChange, label, editable, multiple, accept, required, max, previewHeight, previewWidth,
|
|
59
|
+
export declare const UploadDocument: ({ name, onChange, label, required, editable, multiple, max, accept, uploadPath, before, after, wrapperClassName, className, }: UploadDocumentProps) => React.JSX.Element;
|
|
60
|
+
export declare const UploadImage: ({ name, onChange, label, feedback, editable, multiple, accept, required, max, previewHeight, previewWidth, uploadPath, srcsetWidths, before, after, wrapperClassName, className, }: UploadImageProps) => React.JSX.Element;
|
|
@@ -15,12 +15,14 @@ export type UploadCSVParseFieldHandler = (field: UploadCSVParseField) => UploadC
|
|
|
15
15
|
interface UploadCSVProps extends UIProps {
|
|
16
16
|
name: string;
|
|
17
17
|
onDataLoaded: UploadCSVDataLoadedHandler;
|
|
18
|
+
onClear?: () => void;
|
|
18
19
|
onParseField?: UploadCSVParseFieldHandler;
|
|
19
20
|
label?: string;
|
|
20
21
|
icon?: string;
|
|
21
22
|
delimiter?: string;
|
|
22
23
|
normalizeKeys?: boolean;
|
|
23
24
|
removeEmptyFields?: boolean;
|
|
25
|
+
required?: boolean;
|
|
24
26
|
}
|
|
25
27
|
export declare const UploadCSV: React.FC<UploadCSVProps>;
|
|
26
28
|
export {};
|
|
@@ -7,11 +7,10 @@ export type RecordSelectionState<TRecord> = {
|
|
|
7
7
|
type UseRecordSelectionArgs<TRecord> = {
|
|
8
8
|
records: TRecord[];
|
|
9
9
|
selectedKeys?: string[];
|
|
10
|
-
legacySelectedKeys?: string[];
|
|
11
10
|
onSelectionChange?: (selection: RecordSelectionState<TRecord>) => void;
|
|
12
11
|
getRecordKey: (record: TRecord, index: number) => string;
|
|
13
12
|
};
|
|
14
|
-
export declare function useRecordSelection<TRecord>({ records, selectedKeys,
|
|
13
|
+
export declare function useRecordSelection<TRecord>({ records, selectedKeys, onSelectionChange, getRecordKey, }: UseRecordSelectionArgs<TRecord>): {
|
|
15
14
|
activeSelectedKeys: string[];
|
|
16
15
|
selectionState: RecordSelectionState<TRecord>;
|
|
17
16
|
showSelection: boolean;
|
|
@@ -1,31 +1,34 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import { RecordProps } from "../../providers/data/DataProvider";
|
|
2
|
+
import { FieldValue, RecordProps } from "../../providers/data/DataProvider";
|
|
3
3
|
import { FormTree, ModelProps } from "../Component";
|
|
4
4
|
import { UIProps } from '../';
|
|
5
|
-
|
|
5
|
+
import { type FormController } from './form-controller';
|
|
6
|
+
export type ChangeHandler = React.ChangeEvent<HTMLInputElement | HTMLSelectElement | HTMLTextAreaElement> | {
|
|
6
7
|
target: {
|
|
7
8
|
name: string;
|
|
8
|
-
value?:
|
|
9
|
+
value?: FieldValue;
|
|
9
10
|
};
|
|
10
11
|
};
|
|
11
12
|
type FormHandleChange = (event: ChangeHandler) => void;
|
|
12
13
|
export type FieldOnChange = (params: {
|
|
13
14
|
event: ChangeHandler;
|
|
14
15
|
name: string;
|
|
15
|
-
value:
|
|
16
|
+
value: FieldValue;
|
|
16
17
|
record: RecordProps;
|
|
17
18
|
onChange: FormHandleChange;
|
|
18
19
|
}) => void;
|
|
19
20
|
export type InputType = "text" | "number" | "email" | "password" | "color" | "date" | "time" | "datetime-local" | "week" | "month" | "range" | "checkbox" | "radio" | "url";
|
|
21
|
+
export type LabelMode = "default" | "floating";
|
|
20
22
|
interface FormContextProps {
|
|
21
23
|
name: string;
|
|
22
24
|
onChange?: FieldOnChange;
|
|
23
|
-
|
|
25
|
+
wrapperClassName?: string;
|
|
24
26
|
inputType?: InputType;
|
|
25
|
-
defaultValue?:
|
|
27
|
+
defaultValue?: FieldValue;
|
|
28
|
+
inheritWrapperClassName?: boolean;
|
|
26
29
|
}
|
|
27
30
|
interface FormContextResult {
|
|
28
|
-
value:
|
|
31
|
+
value: FieldValue;
|
|
29
32
|
handleChange: FormHandleChange;
|
|
30
33
|
formWrapClass?: string;
|
|
31
34
|
record: RecordProps;
|
|
@@ -33,29 +36,44 @@ interface FormContextResult {
|
|
|
33
36
|
export interface FormFieldProps extends UIProps {
|
|
34
37
|
name: string;
|
|
35
38
|
label?: string;
|
|
36
|
-
|
|
39
|
+
labelMode?: LabelMode;
|
|
40
|
+
value?: FieldValue;
|
|
37
41
|
required?: boolean;
|
|
38
42
|
onChange?: FieldOnChange;
|
|
39
|
-
defaultValue?:
|
|
43
|
+
defaultValue?: FieldValue;
|
|
44
|
+
inheritWrapperClassName?: boolean;
|
|
40
45
|
}
|
|
41
46
|
interface SetFormFieldsNameProps {
|
|
42
47
|
children: React.ReactNode;
|
|
43
48
|
parentName: string;
|
|
44
49
|
parentKey?: string;
|
|
45
|
-
|
|
50
|
+
wrapperClassName?: string;
|
|
46
51
|
}
|
|
47
|
-
|
|
52
|
+
interface FieldValidationConstraints {
|
|
53
|
+
required?: boolean;
|
|
54
|
+
label?: string;
|
|
55
|
+
validator?: (value: FieldValue) => string | undefined | Promise<string | undefined>;
|
|
56
|
+
}
|
|
57
|
+
interface FormValidationContextValue {
|
|
58
|
+
registerField: (name: string, ref: React.MutableRefObject<FieldValidationConstraints>) => void;
|
|
59
|
+
unregisterField: (name: string) => void;
|
|
60
|
+
clearFieldError: (name: string) => void;
|
|
61
|
+
errors: Record<string, string>;
|
|
62
|
+
}
|
|
63
|
+
export declare const FormValidationContext: React.Context<FormValidationContextValue | null>;
|
|
64
|
+
/**
|
|
65
|
+
* Hook for field components to register themselves for validation and receive
|
|
66
|
+
* their error message. Call it in every field that supports `required`.
|
|
67
|
+
*/
|
|
68
|
+
export declare const useFieldValidation: (name: string, constraints: FieldValidationConstraints) => string | undefined;
|
|
69
|
+
export declare const useFormContext: ({ name, onChange, wrapperClassName, inputType, defaultValue, inheritWrapperClassName }: FormContextProps) => FormContextResult;
|
|
48
70
|
type UseHandleDropProps = {
|
|
49
71
|
name: string;
|
|
50
|
-
value:
|
|
72
|
+
value: FieldValue;
|
|
51
73
|
handleChange?: FormHandleChange;
|
|
52
74
|
};
|
|
53
75
|
export declare const useHandleDrop: ({ name, value, handleChange }: UseHandleDropProps) => (e: React.DragEvent<HTMLTextAreaElement | HTMLInputElement>) => void;
|
|
54
|
-
export declare const setFormFieldsName: ({ children, parentName, parentKey,
|
|
55
|
-
export type SavePathProps = {
|
|
56
|
-
record: RecordProps;
|
|
57
|
-
storagePath?: string;
|
|
58
|
-
};
|
|
76
|
+
export declare const setFormFieldsName: ({ children, parentName, parentKey, wrapperClassName }: SetFormFieldsNameProps) => React.ReactNode;
|
|
59
77
|
export type FormSaveArgs = {
|
|
60
78
|
record?: RecordProps;
|
|
61
79
|
prevRecord?: RecordProps;
|
|
@@ -72,26 +90,49 @@ export type FormFinallyArgs = {
|
|
|
72
90
|
export type FormSaveHandler = (args: FormSaveArgs) => Promise<string | undefined>;
|
|
73
91
|
export type FormDeleteHandler = (args: FormDeleteArgs) => Promise<string | undefined>;
|
|
74
92
|
export type FormFinallyHandler = (args: FormFinallyArgs) => Promise<boolean>;
|
|
93
|
+
/** Core props shared by all Form variants. */
|
|
75
94
|
interface BaseFormProps {
|
|
76
|
-
|
|
95
|
+
/** Visual wrapper: `"card"` adds a card shell; `"empty"` renders bare. */
|
|
96
|
+
appearance?: "card" | "empty";
|
|
97
|
+
/** Shared controller for external actions, custom save buttons and draft state. */
|
|
98
|
+
controller?: FormController;
|
|
99
|
+
/** Custom content rendered in the form header area. */
|
|
77
100
|
header?: React.ReactNode;
|
|
101
|
+
/** Custom content rendered in the form footer area. */
|
|
78
102
|
footer?: React.ReactNode;
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
103
|
+
/** Provider path for data load and save. Omit for a pure local form. */
|
|
104
|
+
path?: string;
|
|
105
|
+
/** Generate a custom primary key for new records instead of auto-push. */
|
|
106
|
+
keyGenerator?: (record: RecordProps) => string;
|
|
107
|
+
/** Transform the record after loading from the provider. */
|
|
83
108
|
onLoad?: (record: RecordProps) => void;
|
|
84
|
-
|
|
109
|
+
/** Called on every field change with the current record state. */
|
|
110
|
+
onRecordChange?: (record: RecordProps) => void;
|
|
111
|
+
/** Transform the record before saving. Return the final record or a custom path. */
|
|
85
112
|
onSave?: FormSaveHandler;
|
|
113
|
+
/** Called before deletion. Return a path override or `undefined`. */
|
|
86
114
|
onDelete?: FormDeleteHandler;
|
|
87
|
-
|
|
115
|
+
/** Called after save or delete. Return `false` to suppress default navigation. */
|
|
116
|
+
onComplete?: FormFinallyHandler;
|
|
117
|
+
/** Log field-change events to the console (dev helper). */
|
|
88
118
|
log?: boolean;
|
|
119
|
+
/** Show the inline save/delete notice banner. Defaults to `true`. */
|
|
89
120
|
showNotice?: boolean;
|
|
121
|
+
/** Persist unsaved changes locally and offer restore/discard on re-entry. Defaults to `false`. */
|
|
122
|
+
persistDraft?: boolean;
|
|
123
|
+
/** When provided, the save/delete notice is rendered sticky at the top of this container
|
|
124
|
+
* instead of inline in the form footer. Ideal for full-page forms outside a modal. */
|
|
125
|
+
noticeAnchorRef?: React.RefObject<HTMLElement>;
|
|
126
|
+
/** Render a Back navigation button in the footer. */
|
|
90
127
|
showBack?: boolean;
|
|
91
|
-
|
|
92
|
-
|
|
128
|
+
/** CSS classes on the outermost wrapper element. */
|
|
129
|
+
wrapperClassName?: string;
|
|
130
|
+
/** CSS classes on the header container. */
|
|
131
|
+
headerClassName?: string;
|
|
132
|
+
/** CSS classes on the form body element. */
|
|
93
133
|
className?: string;
|
|
94
|
-
|
|
134
|
+
/** CSS classes on the footer container. */
|
|
135
|
+
footerClassName?: string;
|
|
95
136
|
}
|
|
96
137
|
interface FormDefaultProps extends BaseFormProps {
|
|
97
138
|
children: React.ReactNode | ((fields: FormTree) => React.ReactNode) | ((args: {
|
|
@@ -100,30 +141,26 @@ interface FormDefaultProps extends BaseFormProps {
|
|
|
100
141
|
defaultValues?: RecordProps;
|
|
101
142
|
}
|
|
102
143
|
interface FormDatabaseProps extends FormDefaultProps {
|
|
103
|
-
|
|
144
|
+
path: string;
|
|
104
145
|
}
|
|
105
146
|
interface FormModelProps extends BaseFormProps {
|
|
106
147
|
model: ModelProps;
|
|
107
148
|
children?: ((fields: FormTree) => React.ReactNode);
|
|
108
149
|
}
|
|
109
|
-
|
|
150
|
+
/**
|
|
151
|
+
* Public props for `<Form>`.
|
|
152
|
+
* When `path` points to an existing record the form loads its data automatically.
|
|
153
|
+
* When `keyGenerator` or `defaultValues` is set the form operates in create-only mode.
|
|
154
|
+
*/
|
|
155
|
+
export interface FormProps extends BaseFormProps {
|
|
156
|
+
/** Field elements, a render-prop receiving the field tree, or a record-aware function. */
|
|
110
157
|
children?: React.ReactNode | ((fields: FormTree) => React.ReactNode) | ((args: {
|
|
111
158
|
record?: RecordProps;
|
|
112
159
|
}) => React.ReactNode);
|
|
160
|
+
/** Initial field values for a new record. */
|
|
113
161
|
defaultValues?: RecordProps;
|
|
114
162
|
}
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
handleDelete: (e: React.MouseEvent<HTMLButtonElement>) => Promise<boolean>;
|
|
118
|
-
getHeader: () => React.ReactNode;
|
|
119
|
-
getRecord: () => {
|
|
120
|
-
record: RecordProps;
|
|
121
|
-
isNewRecord: boolean;
|
|
122
|
-
};
|
|
123
|
-
getFooter: () => React.ReactNode;
|
|
124
|
-
}
|
|
125
|
-
type FormHandlers = Partial<FormRef>;
|
|
126
|
-
export declare const FormDatabase: React.ForwardRefExoticComponent<FormDatabaseProps & React.RefAttributes<FormRef>>;
|
|
163
|
+
declare function Form(props: FormProps): React.JSX.Element;
|
|
164
|
+
export declare const FormDatabase: (props: FormDatabaseProps) => React.JSX.Element;
|
|
127
165
|
export declare function FormModel({ model, children, ...formProps }: FormModelProps): React.JSX.Element | null;
|
|
128
|
-
|
|
129
|
-
export default _default;
|
|
166
|
+
export default Form;
|
|
@@ -1,14 +1,13 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
imageUrl: string;
|
|
2
|
+
export type ImageEditorProps = {
|
|
3
|
+
src: string;
|
|
5
4
|
title?: string;
|
|
6
5
|
width?: number;
|
|
7
6
|
height?: number;
|
|
8
|
-
|
|
7
|
+
mode?: "modal" | "inline";
|
|
9
8
|
onImageLoad?: () => void;
|
|
10
9
|
onClose?: () => void;
|
|
11
10
|
onSave?: (dataUrl: string) => void;
|
|
12
11
|
};
|
|
13
|
-
declare const ImageEditor: ({
|
|
12
|
+
declare const ImageEditor: ({ src, title, width, height, mode, onImageLoad, onClose, onSave }: ImageEditorProps) => React.JSX.Element;
|
|
14
13
|
export default ImageEditor;
|
|
@@ -6,9 +6,9 @@ export interface MarkdownReaderProps {
|
|
|
6
6
|
content: string;
|
|
7
7
|
components?: MarkdownComponents;
|
|
8
8
|
className?: string;
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
9
|
+
wrapperClassName?: string;
|
|
10
|
+
metadata?: PageMetadataState;
|
|
11
|
+
onInternalLinkClick?: (href: string, event: React.MouseEvent<HTMLAnchorElement>) => void;
|
|
12
12
|
}
|
|
13
|
-
export default function MarkdownReader({ content, components, className,
|
|
13
|
+
export default function MarkdownReader({ content, components, className, wrapperClassName, metadata, onInternalLinkClick, }: MarkdownReaderProps): React.JSX.Element;
|
|
14
14
|
export {};
|