reactaform 1.8.7 → 1.8.9

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.
@@ -10,6 +10,7 @@ import type { ReactaFormProps } from "../core/reactaFormTypes";
10
10
  * @param {string} [props.theme] - Theme name ('light' or 'dark')
11
11
  * @param {React.CSSProperties} [props.style] - Inline styles
12
12
  * @param {FieldValidationMode} [props.fieldValidationMode] - Validation timing mode ('realTime' or 'onSubmission')
13
+ * @param {boolean} [props.displayInstanceName] - Whether to display the instance name
13
14
  */
14
15
  declare const ReactaForm: React.FC<ReactaFormProps>;
15
16
  export default ReactaForm;
@@ -11,7 +11,8 @@ import '../core/reactaform.css';
11
11
  * @param {string} [props.defaultLocalizeName] - Name of custom localization file
12
12
  * @param {FieldValidationMode} [props.defaultFieldValidationMode='realTime'] - Validation timing mode
13
13
  * @param {string} [props.className='reactaform-container'] - CSS class name for the container
14
+ * @param {boolean} [props.displayInstanceName] - Whether to display the instance name
14
15
  */
15
- export declare const ReactaFormProvider: ({ children, definitionName, defaultStyle, defaultLanguage, defaultTheme, defaultLocalizeName, defaultFieldValidationMode, className, }: ReactaFormProviderProps & {
16
+ export declare const ReactaFormProvider: ({ children, definitionName, defaultStyle, defaultLanguage, defaultTheme, defaultLocalizeName, defaultFieldValidationMode, className, defaultDisplayInstanceName }: ReactaFormProviderProps & {
16
17
  defaultFieldValidationMode?: FieldValidationMode;
17
18
  }) => import("react/jsx-runtime").JSX.Element;
@@ -1,8 +1,10 @@
1
1
  import * as React from "react";
2
- import type { ReactaDefinition, ReactaInstance } from "../core/reactaFormTypes";
2
+ import type { ReactaDefinition, ReactaInstance, FormSubmissionHandler, FormValidationHandler } from "../core/reactaFormTypes";
3
3
  export interface ReactaFormRendererProps {
4
4
  definition: ReactaDefinition;
5
5
  instance: ReactaInstance;
6
+ onSubmit?: FormSubmissionHandler;
7
+ onValidation?: FormValidationHandler;
6
8
  chunkSize?: number;
7
9
  chunkDelay?: number;
8
10
  }
@@ -71,13 +71,16 @@ export interface ReactaFormProps {
71
71
  theme?: string;
72
72
  style?: React.CSSProperties;
73
73
  fieldValidationMode?: FieldValidationMode;
74
+ displayInstanceName?: boolean;
75
+ onSubmit?: FormSubmissionHandler;
76
+ onValidation?: FormValidationHandler;
74
77
  }
75
78
  export type TranslationFunction = (text: string, ...args: unknown[]) => string;
76
79
  /** Validation mode controls where validation is performed. */
77
80
  export type FieldValidationMode = 'realTime' | 'onSubmission';
78
81
  export type FieldCustomValidationHandler = (fieldName: string, value: FieldValueType | unknown, t: TranslationFunction) => string | undefined;
79
82
  export type FieldTypeValidationHandler = (field: DefinitionPropertyField, input: FieldValueType, t: TranslationFunction) => string | null;
80
- export type FormValidationHandler = (valuesMap: Record<string, FieldValueType | unknown>, t: TranslationFunction) => string[] | undefined | Promise<string[] | undefined>;
83
+ export type FormValidationHandler = (valuesMap: Record<string, FieldValueType | unknown>, t: TranslationFunction) => string[] | Promise<string[] | undefined> | undefined;
81
84
  export type FormSubmissionHandler = (definition: ReactaDefinition, instanceName: string | null, valuesMap: Record<string, FieldValueType | unknown>, t: TranslationFunction) => string[] | undefined | Promise<string[] | undefined>;
82
85
  export type InputOnChange<T> = (value: T | string) => void;
83
86
  export interface BaseInputProps<TValue = unknown, TField extends DefinitionPropertyField = DefinitionPropertyField> {
@@ -99,6 +102,7 @@ export type ReactaFormContextType = {
99
102
  fieldStyle: Record<string, unknown>;
100
103
  t: TranslationFunction;
101
104
  fieldValidationMode?: FieldValidationMode;
105
+ displayInstanceName?: boolean;
102
106
  };
103
107
  export type ReactaFormProviderProps = {
104
108
  children: ReactNode;
@@ -109,6 +113,7 @@ export type ReactaFormProviderProps = {
109
113
  defaultLocalizeName?: string;
110
114
  defaultFieldValidationMode?: FieldValidationMode;
111
115
  className?: string;
116
+ defaultDisplayInstanceName?: boolean;
112
117
  };
113
118
  export type TranslationMap = Record<string, string>;
114
119
  export type TranslationCache = Map<string, TranslationMap>;
@@ -1,9 +1,9 @@
1
- import type { ReactaDefinition, FieldValueType, ReactaInstance, TranslationFunction } from "./reactaFormTypes";
1
+ import type { ReactaDefinition, FieldValueType, ReactaInstance, TranslationFunction, FormSubmissionHandler, FormValidationHandler } from "./reactaFormTypes";
2
2
  export interface SubmitResult {
3
3
  success: boolean;
4
4
  message: string;
5
5
  data?: Record<string, unknown>;
6
6
  errors?: string[];
7
7
  }
8
- export declare function submitForm(definition: ReactaDefinition, instance: ReactaInstance | null, valuesMap: Record<string, FieldValueType | unknown>, t: TranslationFunction, errors: Record<string, string>): Promise<SubmitResult>;
8
+ export declare function submitForm(definition: ReactaDefinition, instance: ReactaInstance | null, valuesMap: Record<string, FieldValueType | unknown>, t: TranslationFunction, errors: Record<string, string>, onSubmit?: FormSubmissionHandler | undefined, onValidation?: FormValidationHandler | undefined): Promise<SubmitResult>;
9
9
  export default submitForm;