reactaform 1.8.93 → 1.9.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/dist/components/fields/Button.d.ts +14 -0
- package/dist/components/fields/CheckboxInput.d.ts +2 -2
- package/dist/components/fields/ColorInput.d.ts +2 -10
- package/dist/components/fields/DateInput.d.ts +2 -7
- package/dist/components/fields/DropdownInput.d.ts +2 -10
- package/dist/components/fields/EmailInput.d.ts +2 -1
- package/dist/components/fields/FileInput.d.ts +2 -2
- package/dist/components/fields/FloatArrayInput.d.ts +2 -5
- package/dist/components/fields/FloatInput.d.ts +2 -2
- package/dist/components/fields/ImageDisplay.d.ts +2 -15
- package/dist/components/fields/IntegerArrayInput.d.ts +2 -5
- package/dist/components/fields/MultiSelection.d.ts +2 -2
- package/dist/components/fields/MultilineTextInput.d.ts +2 -2
- package/dist/components/fields/NumericStepperInput.d.ts +2 -2
- package/dist/components/fields/PasswordInput.d.ts +2 -2
- package/dist/components/fields/PhoneInput.d.ts +2 -1
- package/dist/components/fields/RadioInput.d.ts +2 -2
- package/dist/components/fields/RatingInput.d.ts +2 -2
- package/dist/components/fields/Separator.d.ts +2 -2
- package/dist/components/fields/SliderInput.d.ts +2 -2
- package/dist/components/fields/SpinInput.d.ts +2 -2
- package/dist/components/fields/SwitchInput.d.ts +2 -5
- package/dist/components/fields/TimeInput.d.ts +2 -2
- package/dist/components/fields/UrlInput.d.ts +2 -2
- package/dist/components/{ReactaForm.d.ts → form/ReactaForm.d.ts} +1 -1
- package/dist/components/{ReactaFormProvider.d.ts → form/ReactaFormProvider.d.ts} +2 -2
- package/dist/components/{ReactaFormRenderer.d.ts → form/ReactaFormRenderer.d.ts} +1 -1
- package/dist/components/layout/FieldGroup.d.ts +16 -0
- package/dist/components/layout/FieldRenderer.d.ts +14 -0
- package/dist/components/{LayoutComponents.d.ts → layout/LayoutComponents.d.ts} +1 -1
- package/dist/core/fieldVisibility.d.ts +0 -12
- package/dist/core/reactaFormTypes.d.ts +5 -37
- package/dist/core/registries/buttonHandlerRegistry.d.ts +44 -0
- package/dist/core/{pluginRegistry.d.ts → registries/pluginRegistry.d.ts} +1 -1
- package/dist/core/{submissionHandlerRegistry.d.ts → registries/submissionHandlerRegistry.d.ts} +1 -1
- package/dist/{validation → core/registries}/validationHandlerRegistry.d.ts +1 -1
- package/dist/core/submitForm.d.ts +1 -1
- package/dist/hooks/useDropdownPosition.d.ts +1 -1
- package/dist/index.d.ts +13 -12
- package/dist/reactaform.cjs.js +46 -10
- package/dist/reactaform.css +1 -1
- package/dist/reactaform.es.js +1712 -1576
- package/dist/utils/{translationCache.d.ts → translationUtils.d.ts} +2 -1
- package/dist/validation/{validateColorField.d.ts → validators/validateColorField.d.ts} +2 -2
- package/dist/validation/{validateDateField.d.ts → validators/validateDateField.d.ts} +2 -2
- package/dist/validation/{validateEmailField.d.ts → validators/validateEmailField.d.ts} +2 -2
- package/dist/validation/{validateFieldPattern.d.ts → validators/validateFieldPattern.d.ts} +2 -2
- package/dist/validation/{validateFileField.d.ts → validators/validateFileField.d.ts} +2 -2
- package/dist/validation/{validateFloatField.d.ts → validators/validateFloatField.d.ts} +3 -3
- package/dist/validation/{validateIntegerField.d.ts → validators/validateIntegerField.d.ts} +3 -3
- package/dist/validation/{validatePhoneField.d.ts → validators/validatePhoneField.d.ts} +2 -2
- package/dist/validation/{validateRatingField.d.ts → validators/validateRatingField.d.ts} +2 -2
- package/dist/validation/{validateSelectionFields.d.ts → validators/validateSelectionFields.d.ts} +3 -3
- package/dist/validation/validators/validateSliderField.d.ts +2 -0
- package/dist/validation/{validateTextField.d.ts → validators/validateTextField.d.ts} +2 -2
- package/dist/validation/{validateTimeField.d.ts → validators/validateTimeField.d.ts} +2 -2
- package/dist/validation/{validateUnitValueField.d.ts → validators/validateUnitValueField.d.ts} +2 -2
- package/dist/validation/{validateUrlField.d.ts → validators/validateUrlField.d.ts} +2 -2
- package/package.json +1 -4
- package/dist/common-B4FQDljX.mjs +0 -112
- package/dist/common-BeQ3x_ll.js +0 -1
- package/dist/common-C9xi6Anp.js +0 -1
- package/dist/common-CCGIMXY_.mjs +0 -111
- package/dist/common-CiL5z7rS.js +0 -1
- package/dist/common-Dd94fy-Y.mjs +0 -114
- package/dist/common-Ws7ob6hh.mjs +0 -112
- package/dist/common-pqSYL5rx.js +0 -1
- package/dist/components/renderFields.d.ts +0 -3
- package/dist/core/index.d.ts +0 -1
- /package/dist/components/{SubmissionButton.d.ts → form/SubmissionButton.d.ts} +0 -0
- /package/dist/components/{SubmissionMessage.d.ts → form/SubmissionMessage.d.ts} +0 -0
- /package/dist/components/{PopupOptionMenu.d.ts → ui/PopupOptionMenu.d.ts} +0 -0
- /package/dist/components/{Tooltip.d.ts → ui/Tooltip.d.ts} +0 -0
- /package/dist/core/{baseRegistry.d.ts → registries/baseRegistry.d.ts} +0 -0
- /package/dist/core/{componentRegistry.d.ts → registries/componentRegistry.d.ts} +0 -0
- /package/dist/{utils → styles}/cssClasses.d.ts +0 -0
- /package/dist/{utils → styles}/themeUtils.d.ts +0 -0
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
import type { BaseInputProps, DefinitionPropertyField, FieldValueType, ErrorType } from "../../core/reactaFormTypes";
|
|
3
|
+
/**
|
|
4
|
+
* Extended props for Button component
|
|
5
|
+
* Unlike other fields, Button needs access to all form values
|
|
6
|
+
* and the ability to change any field
|
|
7
|
+
*/
|
|
8
|
+
export interface ButtonInputProps extends BaseInputProps<null, DefinitionPropertyField> {
|
|
9
|
+
valuesMap: Record<string, FieldValueType>;
|
|
10
|
+
handleChange: (fieldName: string, value: FieldValueType) => void;
|
|
11
|
+
handleError: (fieldName: string, error: ErrorType) => void;
|
|
12
|
+
}
|
|
13
|
+
declare const _default: React.NamedExoticComponent<ButtonInputProps>;
|
|
14
|
+
export default _default;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import * as React from "react";
|
|
2
2
|
import type { BaseInputProps, DefinitionPropertyField } from "../../core/reactaFormTypes";
|
|
3
3
|
type CheckboxInputProps = BaseInputProps<boolean, DefinitionPropertyField>;
|
|
4
|
-
|
|
5
|
-
export default
|
|
4
|
+
declare const _default: React.NamedExoticComponent<CheckboxInputProps>;
|
|
5
|
+
export default _default;
|
|
@@ -1,13 +1,5 @@
|
|
|
1
1
|
import * as React from "react";
|
|
2
2
|
import type { BaseInputProps, DefinitionPropertyField } from "../../core/reactaFormTypes";
|
|
3
3
|
export type ColorInputProps = BaseInputProps<string, DefinitionPropertyField>;
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
* * ---------------------
|
|
7
|
-
* A reusable color input field that supports a predefined list of color options
|
|
8
|
-
* (e.g., Red, Blue, etc.) and also allows the user to choose a custom color via
|
|
9
|
-
* a native HTML `<input type="color">`.
|
|
10
|
-
*
|
|
11
|
-
*/
|
|
12
|
-
declare const ColorInput: React.FC<ColorInputProps>;
|
|
13
|
-
export default ColorInput;
|
|
4
|
+
declare const _default: React.NamedExoticComponent<ColorInputProps>;
|
|
5
|
+
export default _default;
|
|
@@ -2,10 +2,5 @@ import * as React from "react";
|
|
|
2
2
|
import type { DefinitionPropertyField } from "../../core/reactaFormTypes";
|
|
3
3
|
import type { BaseInputProps } from "../../core/reactaFormTypes";
|
|
4
4
|
type DateInputProps = BaseInputProps<string, DefinitionPropertyField>;
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
* -------------------
|
|
8
|
-
* Controlled date input for ReactaForm.
|
|
9
|
-
*/
|
|
10
|
-
declare const DateInput: React.FC<DateInputProps>;
|
|
11
|
-
export default DateInput;
|
|
5
|
+
declare const _default: React.NamedExoticComponent<DateInputProps>;
|
|
6
|
+
export default _default;
|
|
@@ -4,13 +4,5 @@ type DropdownField = DefinitionPropertyField & {
|
|
|
4
4
|
options: NonNullable<DefinitionPropertyField['options']>;
|
|
5
5
|
};
|
|
6
6
|
export type DropdownInputProps = BaseInputProps<string, DropdownField>;
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
*
|
|
10
|
-
* Renders a custom dropdown for selecting a single value from options.
|
|
11
|
-
* - Validates that the selected value is in the options list
|
|
12
|
-
* - Auto-corrects to first option if invalid value provided
|
|
13
|
-
* - Uses custom styling from fieldStyle.dropdown
|
|
14
|
-
*/
|
|
15
|
-
declare const DropdownInput: React.FC<DropdownInputProps>;
|
|
16
|
-
export default DropdownInput;
|
|
7
|
+
declare const _default: React.NamedExoticComponent<DropdownInputProps>;
|
|
8
|
+
export default _default;
|
|
@@ -2,4 +2,5 @@ import * as React from "react";
|
|
|
2
2
|
import type { DefinitionPropertyField, BaseInputProps } from "../../core/reactaFormTypes";
|
|
3
3
|
export type EmailInputProps = BaseInputProps<string, DefinitionPropertyField>;
|
|
4
4
|
export declare const EmailInput: React.FC<EmailInputProps>;
|
|
5
|
-
|
|
5
|
+
declare const _default: React.NamedExoticComponent<EmailInputProps>;
|
|
6
|
+
export default _default;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import * as React from "react";
|
|
2
2
|
import type { BaseInputProps, DefinitionPropertyField } from "../../core/reactaFormTypes";
|
|
3
3
|
export type FileInputProps = BaseInputProps<File | File[] | null, DefinitionPropertyField>;
|
|
4
|
-
declare const
|
|
5
|
-
export default
|
|
4
|
+
declare const _default: React.NamedExoticComponent<FileInputProps>;
|
|
5
|
+
export default _default;
|
|
@@ -1,8 +1,5 @@
|
|
|
1
1
|
import * as React from "react";
|
|
2
2
|
import type { DefinitionPropertyField, BaseInputProps } from "../../core/reactaFormTypes";
|
|
3
3
|
export type FloatArrayInputProps = BaseInputProps<string | number[], DefinitionPropertyField>;
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
*/
|
|
7
|
-
declare const FloatArrayInput: React.FC<FloatArrayInputProps>;
|
|
8
|
-
export default FloatArrayInput;
|
|
4
|
+
declare const _default: React.NamedExoticComponent<FloatArrayInputProps>;
|
|
5
|
+
export default _default;
|
|
@@ -5,5 +5,5 @@ import type { BaseInputProps } from "../../core/reactaFormTypes";
|
|
|
5
5
|
* FloatInput component
|
|
6
6
|
*/
|
|
7
7
|
export type FloatInputProps = BaseInputProps<number | string, DefinitionPropertyField>;
|
|
8
|
-
declare const
|
|
9
|
-
export default
|
|
8
|
+
declare const _default: React.NamedExoticComponent<FloatInputProps>;
|
|
9
|
+
export default _default;
|
|
@@ -1,18 +1,5 @@
|
|
|
1
1
|
import * as React from "react";
|
|
2
2
|
import type { BaseInputProps, DefinitionPropertyField } from "../../core/reactaFormTypes";
|
|
3
3
|
export type ImageProps = BaseInputProps<string, DefinitionPropertyField>;
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
* localization and flexible layout/styling options.
|
|
7
|
-
*
|
|
8
|
-
* Features:
|
|
9
|
-
* - Localized image fallback based on current language (e.g., _fr, _zhcn suffixes).
|
|
10
|
-
* - Supports left, center, or right alignment.
|
|
11
|
-
* - Supports both row and column layout via field.labelLayout property
|
|
12
|
-
* - Dynamically handles width and height:
|
|
13
|
-
* - If both are specified, uses them directly.
|
|
14
|
-
* - If only one is specified, uses that and sets the other to `auto`.
|
|
15
|
-
* - If neither is specified, renders the image without size constraints.
|
|
16
|
-
*/
|
|
17
|
-
declare const ImageDisplay: React.FC<ImageProps>;
|
|
18
|
-
export default ImageDisplay;
|
|
4
|
+
declare const _default: React.NamedExoticComponent<ImageProps>;
|
|
5
|
+
export default _default;
|
|
@@ -2,8 +2,5 @@ import * as React from "react";
|
|
|
2
2
|
import type { DefinitionPropertyField } from "../../core/reactaFormTypes";
|
|
3
3
|
import type { BaseInputProps } from "../../core/reactaFormTypes";
|
|
4
4
|
export type IntegerArrayInputProps = BaseInputProps<string | number[], DefinitionPropertyField>;
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
*/
|
|
8
|
-
declare const IntegerArrayInput: React.FC<IntegerArrayInputProps>;
|
|
9
|
-
export default IntegerArrayInput;
|
|
5
|
+
declare const _default: React.NamedExoticComponent<IntegerArrayInputProps>;
|
|
6
|
+
export default _default;
|
|
@@ -5,5 +5,5 @@ export type OptionsField = DefinitionPropertyField & {
|
|
|
5
5
|
options: NonNullable<DefinitionPropertyField["options"]>;
|
|
6
6
|
};
|
|
7
7
|
type MultiSelectionProps = BaseInputProps<string[] | null, OptionsField>;
|
|
8
|
-
declare const
|
|
9
|
-
export default
|
|
8
|
+
declare const _default: React.NamedExoticComponent<MultiSelectionProps>;
|
|
9
|
+
export default _default;
|
|
@@ -2,5 +2,5 @@ import * as React from "react";
|
|
|
2
2
|
import type { DefinitionPropertyField } from "../../core/reactaFormTypes";
|
|
3
3
|
import type { BaseInputProps } from "../../core/reactaFormTypes";
|
|
4
4
|
type TextInputProps = BaseInputProps<string, DefinitionPropertyField>;
|
|
5
|
-
declare const
|
|
6
|
-
export default
|
|
5
|
+
declare const _default: React.NamedExoticComponent<TextInputProps>;
|
|
6
|
+
export default _default;
|
|
@@ -2,5 +2,5 @@ import * as React from "react";
|
|
|
2
2
|
import type { DefinitionPropertyField } from "../../core/reactaFormTypes";
|
|
3
3
|
import type { BaseInputProps } from "../../core/reactaFormTypes";
|
|
4
4
|
export type NumericStepperInputProps = BaseInputProps<string | number, DefinitionPropertyField>;
|
|
5
|
-
declare const
|
|
6
|
-
export default
|
|
5
|
+
declare const _default: React.NamedExoticComponent<NumericStepperInputProps>;
|
|
6
|
+
export default _default;
|
|
@@ -2,5 +2,5 @@ import * as React from "react";
|
|
|
2
2
|
import type { DefinitionPropertyField } from "../../core/reactaFormTypes";
|
|
3
3
|
import type { BaseInputProps } from "../../core/reactaFormTypes";
|
|
4
4
|
type PasswordInputProps = BaseInputProps<string, DefinitionPropertyField>;
|
|
5
|
-
declare const
|
|
6
|
-
export default
|
|
5
|
+
declare const _default: React.NamedExoticComponent<PasswordInputProps>;
|
|
6
|
+
export default _default;
|
|
@@ -3,4 +3,5 @@ import type { DefinitionPropertyField } from "../../core/reactaFormTypes";
|
|
|
3
3
|
import type { BaseInputProps } from "../../core/reactaFormTypes";
|
|
4
4
|
export type PhoneInputProps = BaseInputProps<string, DefinitionPropertyField>;
|
|
5
5
|
export declare const PhoneInput: React.FC<PhoneInputProps>;
|
|
6
|
-
|
|
6
|
+
declare const _default: React.NamedExoticComponent<PhoneInputProps>;
|
|
7
|
+
export default _default;
|
|
@@ -4,5 +4,5 @@ type RadioField = DefinitionPropertyField & {
|
|
|
4
4
|
options: NonNullable<DefinitionPropertyField["options"]>;
|
|
5
5
|
};
|
|
6
6
|
export type RadioInputProps = BaseInputProps<string, RadioField>;
|
|
7
|
-
declare const
|
|
8
|
-
export default
|
|
7
|
+
declare const _default: React.NamedExoticComponent<RadioInputProps>;
|
|
8
|
+
export default _default;
|
|
@@ -5,5 +5,5 @@ type RatingField = DefinitionPropertyField & {
|
|
|
5
5
|
icon?: string;
|
|
6
6
|
};
|
|
7
7
|
export type RatingInputProps = BaseInputProps<number, RatingField>;
|
|
8
|
-
declare const
|
|
9
|
-
export default
|
|
8
|
+
declare const _default: React.NamedExoticComponent<RatingInputProps>;
|
|
9
|
+
export default _default;
|
|
@@ -17,5 +17,5 @@ interface FieldSeparatorProps {
|
|
|
17
17
|
};
|
|
18
18
|
t: (text: string) => string;
|
|
19
19
|
}
|
|
20
|
-
declare const
|
|
21
|
-
export default
|
|
20
|
+
declare const _default: React.NamedExoticComponent<FieldSeparatorProps>;
|
|
21
|
+
export default _default;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import * as React from "react";
|
|
2
2
|
import type { BaseInputProps, DefinitionPropertyField } from "../../core/reactaFormTypes";
|
|
3
3
|
type SliderInputProps = BaseInputProps<string | number, DefinitionPropertyField>;
|
|
4
|
-
declare const
|
|
5
|
-
export default
|
|
4
|
+
declare const _default: React.NamedExoticComponent<SliderInputProps>;
|
|
5
|
+
export default _default;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import * as React from "react";
|
|
2
2
|
import type { DefinitionPropertyField, BaseInputProps } from "../../core/reactaFormTypes";
|
|
3
3
|
export type SpinInputProps = BaseInputProps<number, DefinitionPropertyField>;
|
|
4
|
-
declare const
|
|
5
|
-
export default
|
|
4
|
+
declare const _default: React.NamedExoticComponent<SpinInputProps>;
|
|
5
|
+
export default _default;
|
|
@@ -1,8 +1,5 @@
|
|
|
1
1
|
import * as React from "react";
|
|
2
2
|
import type { BaseInputProps, DefinitionPropertyField } from "../../core/reactaFormTypes";
|
|
3
3
|
type SwitchInputProps = BaseInputProps<boolean, DefinitionPropertyField>;
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
*/
|
|
7
|
-
export declare const SwitchInput: React.FC<SwitchInputProps>;
|
|
8
|
-
export default SwitchInput;
|
|
4
|
+
declare const _default: React.NamedExoticComponent<SwitchInputProps>;
|
|
5
|
+
export default _default;
|
|
@@ -2,5 +2,5 @@ import * as React from "react";
|
|
|
2
2
|
import type { DefinitionPropertyField } from "../../core/reactaFormTypes";
|
|
3
3
|
import type { BaseInputProps } from "../../core/reactaFormTypes";
|
|
4
4
|
type TimeInputProps = BaseInputProps<string, DefinitionPropertyField>;
|
|
5
|
-
declare const
|
|
6
|
-
export default
|
|
5
|
+
declare const _default: React.NamedExoticComponent<TimeInputProps>;
|
|
6
|
+
export default _default;
|
|
@@ -5,5 +5,5 @@ import type { BaseInputProps } from "../../core/reactaFormTypes";
|
|
|
5
5
|
* UrlInput component
|
|
6
6
|
*/
|
|
7
7
|
export type UrlInputProps = BaseInputProps<string, DefinitionPropertyField>;
|
|
8
|
-
declare const
|
|
9
|
-
export default
|
|
8
|
+
declare const _default: React.NamedExoticComponent<UrlInputProps>;
|
|
9
|
+
export default _default;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import * as React from "react";
|
|
2
|
-
import type { ReactaFormProps } from "
|
|
2
|
+
import type { ReactaFormProps } from "../../core/reactaFormTypes";
|
|
3
3
|
/**
|
|
4
4
|
* ReactaForm component - The main form rendering component
|
|
5
5
|
* @param {ReactaFormProps} props - The component props
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import type { FieldValidationMode, ReactaFormProviderProps } from '
|
|
2
|
-
import '
|
|
1
|
+
import type { FieldValidationMode, ReactaFormProviderProps } from '../../core/reactaFormTypes';
|
|
2
|
+
import '../../styles/reactaform.css';
|
|
3
3
|
/**
|
|
4
4
|
* ReactaFormProvider component - Context provider for ReactaForm configuration
|
|
5
5
|
* @param {ReactaFormProviderProps} props - The component props
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import * as React from "react";
|
|
2
|
-
import type { ReactaDefinition, ReactaInstance, FormSubmissionHandler, FormValidationHandler } from "
|
|
2
|
+
import type { ReactaDefinition, ReactaInstance, FormSubmissionHandler, FormValidationHandler } from "../../core/reactaFormTypes";
|
|
3
3
|
export interface ReactaFormRendererProps {
|
|
4
4
|
definition: ReactaDefinition;
|
|
5
5
|
instance: ReactaInstance;
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
import type { DefinitionPropertyField, FieldValueType, ErrorType } from "../../core/reactaFormTypes";
|
|
3
|
+
export interface FieldGroupProps {
|
|
4
|
+
groupName: string;
|
|
5
|
+
defaultOpen?: boolean;
|
|
6
|
+
fields: DefinitionPropertyField[];
|
|
7
|
+
valuesMap: Record<string, FieldValueType>;
|
|
8
|
+
handleChange: (fieldName: string, value: FieldValueType) => void;
|
|
9
|
+
handleError?: (fieldName: string, error: ErrorType) => void;
|
|
10
|
+
errorsMap?: Record<string, string>;
|
|
11
|
+
t: (key: string) => string;
|
|
12
|
+
}
|
|
13
|
+
/**
|
|
14
|
+
* Self-managing collapsible field group component with internal toggle state
|
|
15
|
+
*/
|
|
16
|
+
export declare const FieldGroup: React.NamedExoticComponent<FieldGroupProps>;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
import type { DefinitionPropertyField, FieldValueType, ErrorType } from "../../core/reactaFormTypes";
|
|
3
|
+
export interface FieldRendererProps {
|
|
4
|
+
field: DefinitionPropertyField;
|
|
5
|
+
valuesMap: Record<string, FieldValueType>;
|
|
6
|
+
handleChange: (fieldName: string, value: FieldValueType) => void;
|
|
7
|
+
handleError?: (fieldName: string, error: ErrorType) => void;
|
|
8
|
+
errorsMap?: Record<string, string>;
|
|
9
|
+
}
|
|
10
|
+
/**
|
|
11
|
+
* Memoized component for rendering a single field with error handling
|
|
12
|
+
* and optimized re-render prevention
|
|
13
|
+
*/
|
|
14
|
+
export declare const FieldRenderer: React.NamedExoticComponent<FieldRendererProps>;
|
|
@@ -1,12 +1,4 @@
|
|
|
1
1
|
import type { DefinitionPropertyField, FieldValueType } from "./reactaFormTypes";
|
|
2
|
-
/**
|
|
3
|
-
* Initializes the visibility map for all fields by setting them to `false`.
|
|
4
|
-
*/
|
|
5
|
-
export declare const initializeVisibility: (fields: DefinitionPropertyField[]) => Record<string, boolean>;
|
|
6
|
-
/**
|
|
7
|
-
* Creates a lookup map for faster field access during visibility calculations
|
|
8
|
-
*/
|
|
9
|
-
export declare const createFieldMap: (fields: DefinitionPropertyField[]) => Record<string, DefinitionPropertyField>;
|
|
10
2
|
/**
|
|
11
3
|
* Updates visibility map based on current field values and parent-child relationships
|
|
12
4
|
*/
|
|
@@ -19,7 +11,3 @@ export declare const updateVisibilityBasedOnSelection: (visibility: Record<strin
|
|
|
19
11
|
* Checks if a field should be visible based on its parent relationships
|
|
20
12
|
*/
|
|
21
13
|
export declare const isFieldVisible: (fieldName: string, fieldMap: Record<string, DefinitionPropertyField>, values: Record<string, FieldValueType>) => boolean;
|
|
22
|
-
/**
|
|
23
|
-
* Gets all visible fields efficiently
|
|
24
|
-
*/
|
|
25
|
-
export declare const getVisibleFields: (fields: DefinitionPropertyField[], values: Record<string, FieldValueType>) => DefinitionPropertyField[];
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { ReactNode } from 'react';
|
|
1
|
+
import type { ReactNode, CSSProperties } from 'react';
|
|
2
2
|
type Integer = number;
|
|
3
3
|
type Float = number;
|
|
4
4
|
export type FieldValueType = boolean | Integer | Float | string | Integer[] | Float[] | string[] | [number, string] | File | File[];
|
|
@@ -47,6 +47,9 @@ export interface DefinitionPropertyField {
|
|
|
47
47
|
accept?: string;
|
|
48
48
|
multiple?: boolean;
|
|
49
49
|
allowRelative?: boolean;
|
|
50
|
+
action?: string;
|
|
51
|
+
buttonClassName?: string;
|
|
52
|
+
buttonStyle?: CSSProperties;
|
|
50
53
|
}
|
|
51
54
|
export interface ReactaDefinition {
|
|
52
55
|
name: string;
|
|
@@ -79,7 +82,7 @@ export type TranslationFunction = (text: string, ...args: unknown[]) => string;
|
|
|
79
82
|
/** Validation mode controls where validation is performed. */
|
|
80
83
|
export type FieldValidationMode = 'realTime' | 'onSubmission';
|
|
81
84
|
export type FieldCustomValidationHandler = (fieldName: string, value: FieldValueType | unknown, t: TranslationFunction) => string | undefined;
|
|
82
|
-
export type FieldTypeValidationHandler = (field: DefinitionPropertyField, input: FieldValueType, t: TranslationFunction) => string |
|
|
85
|
+
export type FieldTypeValidationHandler = (field: DefinitionPropertyField, input: FieldValueType, t: TranslationFunction) => string | undefined;
|
|
83
86
|
export type FormValidationHandler = (valuesMap: Record<string, FieldValueType | unknown>, t: TranslationFunction) => string[] | Promise<string[] | undefined> | undefined;
|
|
84
87
|
export type FormSubmissionHandler = (definition: ReactaDefinition, instanceName: string | null, valuesMap: Record<string, FieldValueType | unknown>, t: TranslationFunction) => string[] | undefined | Promise<string[] | undefined>;
|
|
85
88
|
export type InputOnChange<T> = (value: T | string) => void;
|
|
@@ -115,39 +118,4 @@ export type ReactaFormProviderProps = {
|
|
|
115
118
|
className?: string;
|
|
116
119
|
defaultDisplayInstanceName?: boolean;
|
|
117
120
|
};
|
|
118
|
-
export type TranslationMap = Record<string, string>;
|
|
119
|
-
export type TranslationCache = Map<string, TranslationMap>;
|
|
120
|
-
export interface RegistryResult<T = unknown> {
|
|
121
|
-
success: boolean;
|
|
122
|
-
data?: T;
|
|
123
|
-
error?: string;
|
|
124
|
-
}
|
|
125
|
-
export interface FieldGroup {
|
|
126
|
-
name: string;
|
|
127
|
-
displayName: string;
|
|
128
|
-
description?: string;
|
|
129
|
-
collapsed?: boolean;
|
|
130
|
-
order?: number;
|
|
131
|
-
}
|
|
132
|
-
export interface ValidationResult {
|
|
133
|
-
isValid: boolean;
|
|
134
|
-
errors: string[];
|
|
135
|
-
warnings?: string[];
|
|
136
|
-
}
|
|
137
|
-
export type FormEventType = 'init' | 'change' | 'validate' | 'submit' | 'reset';
|
|
138
|
-
export interface FormEvent {
|
|
139
|
-
type: FormEventType;
|
|
140
|
-
timestamp: Date;
|
|
141
|
-
data?: unknown;
|
|
142
|
-
}
|
|
143
|
-
export interface EnhancedDefinitionPropertyField extends DefinitionPropertyField {
|
|
144
|
-
category?: string;
|
|
145
|
-
tags?: string[];
|
|
146
|
-
dependencies?: string[];
|
|
147
|
-
conditional?: {
|
|
148
|
-
field: string;
|
|
149
|
-
value: unknown;
|
|
150
|
-
operator?: 'equals' | 'not_equals' | 'contains' | 'greater_than' | 'less_than';
|
|
151
|
-
};
|
|
152
|
-
}
|
|
153
121
|
export {};
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import type { FieldValueType, ErrorType, TranslationFunction } from "../reactaFormTypes";
|
|
2
|
+
import BaseRegistry from "./baseRegistry";
|
|
3
|
+
/**
|
|
4
|
+
* Button Handler function type
|
|
5
|
+
* Button handlers can access all form values, change any field value, and report errors
|
|
6
|
+
*
|
|
7
|
+
* @param valuesMap - All form values (read-only)
|
|
8
|
+
* @param handleChange - Function to update any field's value
|
|
9
|
+
* @param handleError - Function to report errors for any field
|
|
10
|
+
* @param t - Translation function
|
|
11
|
+
* @returns void or Promise<void>
|
|
12
|
+
*/
|
|
13
|
+
export type ButtonHandler = (valuesMap: Record<string, FieldValueType>, handleChange: (fieldName: string, value: FieldValueType) => void, handleError: (fieldName: string, error: ErrorType) => void, t: TranslationFunction) => void | Promise<void>;
|
|
14
|
+
declare const registry: BaseRegistry<ButtonHandler>;
|
|
15
|
+
/**
|
|
16
|
+
* Register a button handler function
|
|
17
|
+
* @param handlerName - The name to register the handler under (referenced in definition's action property)
|
|
18
|
+
* @param fn - The button handler function
|
|
19
|
+
*/
|
|
20
|
+
export declare function registerButtonHandler(handlerName: string, fn: ButtonHandler): void;
|
|
21
|
+
/**
|
|
22
|
+
* Get a registered button handler by name
|
|
23
|
+
* @param handlerName - The name of the handler to retrieve
|
|
24
|
+
* @returns The button handler function or undefined if not found
|
|
25
|
+
*/
|
|
26
|
+
export declare function getButtonHandler(handlerName: string): ButtonHandler | undefined;
|
|
27
|
+
/**
|
|
28
|
+
* Check if a button handler is registered
|
|
29
|
+
* @param handlerName - The name of the handler to check
|
|
30
|
+
* @returns true if the handler is registered, false otherwise
|
|
31
|
+
*/
|
|
32
|
+
export declare function hasButtonHandler(handlerName: string): boolean;
|
|
33
|
+
/**
|
|
34
|
+
* Unregister a button handler
|
|
35
|
+
* @param handlerName - The name of the handler to unregister
|
|
36
|
+
* @returns true if the handler was found and removed, false otherwise
|
|
37
|
+
*/
|
|
38
|
+
export declare function unregisterButtonHandler(handlerName: string): boolean;
|
|
39
|
+
/**
|
|
40
|
+
* List all registered button handler names
|
|
41
|
+
* @returns Array of registered handler names
|
|
42
|
+
*/
|
|
43
|
+
export declare function listButtonHandlers(): string[];
|
|
44
|
+
export default registry;
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
* Tracks installed plugins, components, validators, submission handlers
|
|
4
4
|
* Handles conflicts with customizable strategy
|
|
5
5
|
*/
|
|
6
|
-
import type { FieldCustomValidationHandler, FieldTypeValidationHandler, FormValidationHandler, FormSubmissionHandler } from '
|
|
6
|
+
import type { FieldCustomValidationHandler, FieldTypeValidationHandler, FormValidationHandler, FormSubmissionHandler } from '../reactaFormTypes';
|
|
7
7
|
/** Conflict resolution strategies */
|
|
8
8
|
export type ConflictResolution = 'error' | 'warn' | 'override' | 'skip';
|
|
9
9
|
/** Plugin registration options */
|
package/dist/core/{submissionHandlerRegistry.d.ts → registries/submissionHandlerRegistry.d.ts}
RENAMED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { FormSubmissionHandler } from "
|
|
1
|
+
import type { FormSubmissionHandler } from "../reactaFormTypes";
|
|
2
2
|
import BaseRegistry from "./baseRegistry";
|
|
3
3
|
declare const registry: BaseRegistry<FormSubmissionHandler>;
|
|
4
4
|
export declare function registerSubmissionHandler(submitterName: string, fn: FormSubmissionHandler): void;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { FieldCustomValidationHandler, FieldTypeValidationHandler, FormValidationHandler } from "../
|
|
1
|
+
import type { FieldCustomValidationHandler, FieldTypeValidationHandler, FormValidationHandler } from "../reactaFormTypes";
|
|
2
2
|
export declare function registerFormValidationHandler(name: string, fn: FormValidationHandler): void;
|
|
3
3
|
export declare function registerFieldCustomValidationHandler(category: string, name: string, fn: FieldCustomValidationHandler): void;
|
|
4
4
|
export declare function registerFieldTypeValidationHandler(name: string, fn: FieldTypeValidationHandler): void;
|
|
@@ -5,5 +5,5 @@ export interface SubmitResult {
|
|
|
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
|
|
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;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import React from "react";
|
|
2
|
-
export declare function useDropdownPosition(controlRef: React.RefObject<HTMLElement | null>, open: boolean,
|
|
2
|
+
export declare function useDropdownPosition(controlRef: React.RefObject<HTMLElement | null>, open: boolean, maxHeight?: number): {
|
|
3
3
|
left: number;
|
|
4
4
|
top: number;
|
|
5
5
|
width: number;
|
package/dist/index.d.ts
CHANGED
|
@@ -1,26 +1,27 @@
|
|
|
1
1
|
export declare function injectReactaFormStyles(): void;
|
|
2
|
-
export { default as ReactaForm } from './components/ReactaForm';
|
|
3
|
-
export { default as ReactaFormRenderer } from './components/ReactaFormRenderer';
|
|
4
|
-
export type { ReactaFormRendererProps } from './components/ReactaFormRenderer';
|
|
5
|
-
export { ReactaFormProvider } from './components/ReactaFormProvider';
|
|
2
|
+
export { default as ReactaForm } from './components/form/ReactaForm';
|
|
3
|
+
export { default as ReactaFormRenderer } from './components/form/ReactaFormRenderer';
|
|
4
|
+
export type { ReactaFormRendererProps } from './components/form/ReactaFormRenderer';
|
|
5
|
+
export { ReactaFormProvider } from './components/form/ReactaFormProvider';
|
|
6
6
|
export { default as useReactaFormContext } from './hooks/useReactaFormContext';
|
|
7
|
-
export { StandardFieldLayout } from './components/LayoutComponents';
|
|
8
|
-
export { CSS_CLASSES, combineClasses } from './
|
|
7
|
+
export { StandardFieldLayout } from './components/layout/LayoutComponents';
|
|
8
|
+
export { CSS_CLASSES, combineClasses } from './styles/cssClasses';
|
|
9
9
|
export type { ReactaFormContextType, ReactaFormProviderProps, DefinitionPropertyField, ReactaDefinition, ReactaInstance, ReactaFormProps, FieldValueType, ErrorType, FieldCustomValidationHandler, FieldTypeValidationHandler, FormValidationHandler, FormSubmissionHandler, InputOnChange, BaseInputProps, TranslationFunction, FieldValidationMode } from './core/reactaFormTypes';
|
|
10
|
-
export { registerComponent, getComponent, } from './core/componentRegistry';
|
|
10
|
+
export { registerComponent, getComponent, } from './core/registries/componentRegistry';
|
|
11
11
|
export { validateFieldValue, // Deprecated, use validateFieldWithHandler instead
|
|
12
12
|
validateFieldWithCustomHandler } from './validation/validation';
|
|
13
|
-
export { type ReactaFormPlugin, type ConflictResolution, type PluginRegistrationOptions, type PluginConflict, registerPlugin, unregisterPlugin, getPlugin, getAllPlugins, hasPlugin, registerComponents, } from './core/pluginRegistry';
|
|
13
|
+
export { type ReactaFormPlugin, type ConflictResolution, type PluginRegistrationOptions, type PluginConflict, registerPlugin, unregisterPlugin, getPlugin, getAllPlugins, hasPlugin, registerComponents, } from './core/registries/pluginRegistry';
|
|
14
14
|
export type { LoadDefinitionOptions, DefinitionLoadResult, InstanceLoadResult, } from './core/reactaFormModel';
|
|
15
15
|
export { loadJsonDefinition, createInstanceFromDefinition, // Create new instance with default values
|
|
16
16
|
loadInstance, // Load existing instance (valuesMap)
|
|
17
17
|
upgradeInstanceToLatestDefinition } from './core/reactaFormModel';
|
|
18
|
-
export { registerSubmissionHandler, } from './core/submissionHandlerRegistry';
|
|
19
|
-
export { registerFieldCustomValidationHandler, registerFieldTypeValidationHandler, registerFormValidationHandler, } from './
|
|
18
|
+
export { registerSubmissionHandler, } from './core/registries/submissionHandlerRegistry';
|
|
19
|
+
export { registerFieldCustomValidationHandler, registerFieldTypeValidationHandler, registerFormValidationHandler, } from './core/registries/validationHandlerRegistry';
|
|
20
|
+
export { registerButtonHandler, getButtonHandler, hasButtonHandler, unregisterButtonHandler, listButtonHandlers, type ButtonHandler, } from './core/registries/buttonHandlerRegistry';
|
|
20
21
|
export { type DebouncedCallback, useDebouncedCallback } from './hooks/useDebouncedCallback';
|
|
21
22
|
export { useFieldValidator } from './hooks/useFieldValidator';
|
|
22
23
|
export { useUncontrolledValidatedInput, type UseUncontrolledValidatedInputProps } from './hooks/useUncontrolledValidatedInput';
|
|
23
24
|
export * as Units from './utils/unitValueMapper';
|
|
24
|
-
export { isDarkTheme } from './
|
|
25
|
+
export { isDarkTheme } from './styles/themeUtils';
|
|
25
26
|
export { serializeInstance, deserializeInstance, serializeDefinition, deserializeDefinition } from './utils/definitionSerializers';
|
|
26
|
-
export { getSupportedLanguages } from './utils/
|
|
27
|
+
export { getSupportedLanguages } from './utils/translationUtils';
|