UNPKG

@nish1896/rhf-mui-components

Version:

A suite of 20+ production-ready react-hook-form components built with material-ui. Fully typed, tree-shakable, and optimized for enterprise-grade forms.

62 lines (61 loc) 2.08 kB
import { FormHelperTextProps, FormLabelProps } from "../../types/mui.js"; import { DefaultEditorConfig } from "./config.js"; import { ReactNode } from "react"; import * as react_jsx_runtime0 from "react/jsx-runtime"; import { Control, FieldValues, Path, RegisterOptions } from "react-hook-form"; import { ClassicEditor } from "ckeditor5"; import { EventInfo } from "@ckeditor/ckeditor5-utils"; import { EditorConfig } from "@ckeditor/ckeditor5-core"; //#region src/misc/rich-text-editor/index.d.ts /** * CK Editor Props ref - * https://ckeditor.com/docs/ckeditor5/latest/getting-started/legacy/legacy-integrations/react.html#context-feature-properties */ type ErrorDetails = { phase: 'initialization' | 'runtime'; willContextRestart?: boolean; }; type RHFRichTextEditorProps<T extends FieldValues> = { fieldName: Path<T>; control: Control<T>; registerOptions?: RegisterOptions<T, Path<T>>; required?: boolean; id?: string; editorConfig?: EditorConfig; onReady?: (editor: ClassicEditor) => void; onFocus?: (event: EventInfo<string, unknown>, editor: ClassicEditor) => void; onBlur?: (event: EventInfo<string, unknown>, editor: ClassicEditor) => void; onValueChange?: (newValue: string, event: EventInfo, editor: ClassicEditor) => void; disabled?: boolean; label?: ReactNode; showLabelAboveFormField?: boolean; formLabelProps?: FormLabelProps; helperText?: ReactNode; onError?: (error: Error, details: ErrorDetails) => void; errorMessage?: ReactNode; hideErrorMessage?: boolean; formHelperTextProps?: FormHelperTextProps; }; declare const RHFRichTextEditor: <T extends FieldValues>({ fieldName, control, registerOptions, required, id, editorConfig, onReady, onFocus, onBlur, onValueChange, disabled: muiDisabled, label, showLabelAboveFormField, formLabelProps, helperText, onError, errorMessage, hideErrorMessage, formHelperTextProps }: RHFRichTextEditorProps<T>) => react_jsx_runtime0.JSX.Element; //#endregion export { DefaultEditorConfig, RHFRichTextEditorProps, RHFRichTextEditor as default };