reactaform 1.1.1 → 1.1.3

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.
Files changed (64) hide show
  1. package/README.md +10 -15
  2. package/dist/reactaform.cjs.js +6 -7
  3. package/dist/reactaform.es.js +1909 -2504
  4. package/package.json +83 -54
  5. package/dist/common-BD9zx3GT.js +0 -1
  6. package/dist/common-BxyjIoe1.js +0 -1
  7. package/dist/common-COyDhNL-.js +0 -1
  8. package/dist/common-hRFTL4KF.js +0 -1
  9. package/dist/components/LayoutComponents.d.ts +0 -76
  10. package/dist/components/PopupOptionMenu.d.ts +0 -15
  11. package/dist/components/ReactaForm.d.ts +0 -4
  12. package/dist/components/ReactaFormProvider.d.ts +0 -3
  13. package/dist/components/ReactaFormRenderer.d.ts +0 -13
  14. package/dist/components/Tooltip.d.ts +0 -8
  15. package/dist/components/VirtualizedFieldList.d.ts +0 -36
  16. package/dist/components/fields/CheckboxInput.d.ts +0 -9
  17. package/dist/components/fields/ColorInput.d.ts +0 -17
  18. package/dist/components/fields/DateInput.d.ts +0 -11
  19. package/dist/components/fields/DropdownInput.d.ts +0 -13
  20. package/dist/components/fields/EmailInput.d.ts +0 -5
  21. package/dist/components/fields/FileInput.d.ts +0 -5
  22. package/dist/components/fields/FloatArrayInput.d.ts +0 -5
  23. package/dist/components/fields/FloatInput.d.ts +0 -24
  24. package/dist/components/fields/ImageDisplay.d.ts +0 -17
  25. package/dist/components/fields/IntegerArrayInput.d.ts +0 -23
  26. package/dist/components/fields/IntegerInput.d.ts +0 -28
  27. package/dist/components/fields/MultiSelection.d.ts +0 -9
  28. package/dist/components/fields/MultilineTextInput.d.ts +0 -6
  29. package/dist/components/fields/NumericStepperInput.d.ts +0 -6
  30. package/dist/components/fields/PhoneInput.d.ts +0 -6
  31. package/dist/components/fields/RadioInput.d.ts +0 -13
  32. package/dist/components/fields/RatingInput.d.ts +0 -6
  33. package/dist/components/fields/Separator.d.ts +0 -20
  34. package/dist/components/fields/SliderInput.d.ts +0 -22
  35. package/dist/components/fields/SpinInput.d.ts +0 -6
  36. package/dist/components/fields/SwitchInput.d.ts +0 -13
  37. package/dist/components/fields/TextInput.d.ts +0 -6
  38. package/dist/components/fields/TimeInput.d.ts +0 -6
  39. package/dist/components/fields/UnitValueInput.d.ts +0 -5
  40. package/dist/components/fields/UrlInput.d.ts +0 -21
  41. package/dist/components/renderFields.d.ts +0 -4
  42. package/dist/core/fieldVisibility.d.ts +0 -25
  43. package/dist/core/index.d.ts +0 -19
  44. package/dist/core/reactaFormModel.d.ts +0 -38
  45. package/dist/core/reactaFormTypes.d.ts +0 -137
  46. package/dist/core/registries/baseRegistry.d.ts +0 -15
  47. package/dist/core/registries/componentRegistry.d.ts +0 -10
  48. package/dist/core/registries/index.d.ts +0 -7
  49. package/dist/core/registries/submissionHandlerRegistry.d.ts +0 -6
  50. package/dist/core/registries/validationHandlerRegistry.d.ts +0 -16
  51. package/dist/core/submitForm.d.ts +0 -12
  52. package/dist/core/validation.d.ts +0 -10
  53. package/dist/hooks/useDebouncedCallback.d.ts +0 -25
  54. package/dist/hooks/useReactaFormContext.d.ts +0 -4
  55. package/dist/utils/cssClasses.d.ts +0 -14
  56. package/dist/utils/definitionSerializers.d.ts +0 -62
  57. package/dist/utils/groupingHelpers.d.ts +0 -24
  58. package/dist/utils/index.d.ts +0 -11
  59. package/dist/utils/translationCache.d.ts +0 -43
  60. package/dist/utils/unitValueMapper.d.ts +0 -8
  61. /package/dist/{common-BQcVe8MY.mjs → common-BQcVe8MY.js} +0 -0
  62. /package/dist/{common-BnnwzTl2.mjs → common-BnnwzTl2.js} +0 -0
  63. /package/dist/{common-Bzz0clAC.mjs → common-Bzz0clAC.js} +0 -0
  64. /package/dist/{common-DLqVHgfX.mjs → common-DLqVHgfX.js} +0 -0
@@ -1,6 +0,0 @@
1
- import React from "react";
2
- import type { DefinitionPropertyField } from "../../core/reactaFormTypes";
3
- import type { BaseInputProps } from "../../core/reactaFormTypes";
4
- export type SpinInputProps = BaseInputProps<number, DefinitionPropertyField>;
5
- declare const SpinInput: React.FC<SpinInputProps>;
6
- export default SpinInput;
@@ -1,13 +0,0 @@
1
- import React from "react";
2
- import type { BaseInputProps, DefinitionPropertyField } from "../../core/reactaFormTypes";
3
- type SwitchInputProps = BaseInputProps<boolean, DefinitionPropertyField>;
4
- /**
5
- * SwitchInput
6
- *
7
- * Renders a toggle switch UI for boolean values.
8
- * - Clicking anywhere on the container toggles the switch.
9
- * - Visual toggle with sliding knob and background color changes.
10
- * - Displays label and optional tooltip.
11
- */
12
- export declare const SwitchInput: React.FC<SwitchInputProps>;
13
- export default SwitchInput;
@@ -1,6 +0,0 @@
1
- import React from "react";
2
- import type { DefinitionPropertyField } from "../../core/reactaFormTypes";
3
- import type { BaseInputProps } from "../../core/reactaFormTypes";
4
- type TextInputProps = BaseInputProps<string, DefinitionPropertyField>;
5
- declare const TextInput: React.FC<TextInputProps>;
6
- export default TextInput;
@@ -1,6 +0,0 @@
1
- import React from "react";
2
- import type { DefinitionPropertyField } from "../../core/reactaFormTypes";
3
- import type { BaseInputProps } from "../../core/reactaFormTypes";
4
- type TimeInputProps = BaseInputProps<string, DefinitionPropertyField>;
5
- declare const TimeInput: React.FC<TimeInputProps>;
6
- export default TimeInput;
@@ -1,5 +0,0 @@
1
- import type { BaseInputProps } from "../../core/reactaFormTypes";
2
- import type { DefinitionPropertyField } from "../../core/reactaFormTypes";
3
- type UnitValueInputProps = BaseInputProps<[string | number, string], DefinitionPropertyField>;
4
- declare function UnitValueInput({ field, value, onChange }: UnitValueInputProps): import("react/jsx-runtime").JSX.Element | null;
5
- export default UnitValueInput;
@@ -1,21 +0,0 @@
1
- import React from "react";
2
- import type { DefinitionPropertyField } from "../../core/reactaFormTypes";
3
- import type { BaseInputProps } from "../../core/reactaFormTypes";
4
- /**
5
- * UrlInput component
6
- *
7
- * This component provides a controlled input field for URL values.
8
- * It validates required fields, URL format, and integrates with Reacta form context.
9
- *
10
- * Props:
11
- * - field: Field metadata (name, displayName, tooltip, validation rules).
12
- * - value: Current URL string.
13
- * - onChange: Callback called with (value, error).
14
- *
15
- * Features:
16
- * - Validates using a robust URL regex and `URL` constructor fallback.
17
- * - Supports tooltip, localization, and inline validation errors.
18
- */
19
- export type UrlInputProps = BaseInputProps<string, DefinitionPropertyField>;
20
- declare const UrlInput: React.FC<UrlInputProps>;
21
- export default UrlInput;
@@ -1,4 +0,0 @@
1
- import type { DefinitionPropertyField, FieldValueType, ErrorType } from "../core/reactaFormTypes";
2
- import type { JSX } from "react/jsx-runtime";
3
- export declare const renderFields: (fields: DefinitionPropertyField[], valuesMap: Record<string, FieldValueType>, handleChange: (fieldName: string, value: FieldValueType, error: ErrorType) => void, visibility: Record<string, boolean>, loadedCount: number, handleError?: (fieldName: string, error: ErrorType) => void) => (JSX.Element | null)[];
4
- export declare const renderFieldsWithGroups: (groupState: Record<string, boolean>, fields: DefinitionPropertyField[], valuesMap: Record<string, FieldValueType>, t: (key: string) => string, handleChange: (fieldName: string, value: FieldValueType, error: ErrorType) => void, handleError: (fieldName: string, error: ErrorType) => void, visibility: Record<string, boolean>, loadedCount: number, toggleGroup: (groupName: string) => void) => JSX.Element[];
@@ -1,25 +0,0 @@
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
- /**
11
- * Updates visibility map based on current field values and parent-child relationships
12
- */
13
- export declare const updateVisibilityMap: (fields: DefinitionPropertyField[], values: Record<string, FieldValueType>, oldVisibility: Record<string, boolean>, fieldMapRef: Record<string, DefinitionPropertyField>) => Record<string, boolean>;
14
- /**
15
- * Updates visibility when a specific field value changes
16
- */
17
- export declare const updateVisibilityBasedOnSelection: (visibility: Record<string, boolean>, fieldMap: Record<string, DefinitionPropertyField>, valuesMap: Record<string, FieldValueType>, fieldName: string, value: FieldValueType) => Record<string, boolean>;
18
- /**
19
- * Checks if a field should be visible based on its parent relationships
20
- */
21
- 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,19 +0,0 @@
1
- export * from "./reactaFormTypes";
2
- export * from "./validation";
3
- export * from "./submitForm";
4
- export * from "./fieldVisibility";
5
- export * from "./reactaFormModel";
6
- export * from "./registries";
7
- import * as registries from "./registries";
8
- import * as validation from "./validation";
9
- import * as submitForm from "./submitForm";
10
- import * as fieldVisibility from "./fieldVisibility";
11
- import * as reactaFormModel from "./reactaFormModel";
12
- declare const _default: {
13
- registries: typeof registries;
14
- validation: typeof validation;
15
- submitForm: typeof submitForm;
16
- fieldVisibility: typeof fieldVisibility;
17
- reactaFormModel: typeof reactaFormModel;
18
- };
19
- export default _default;
@@ -1,38 +0,0 @@
1
- import type { ReactaDefinition, ReactaInstance } from "./reactaFormTypes";
2
- export interface LoadDefinitionOptions {
3
- validateSchema?: boolean;
4
- }
5
- export interface DefinitionLoadResult {
6
- success: boolean;
7
- definition?: ReactaDefinition;
8
- error?: string;
9
- }
10
- /**
11
- * Validates that a definition object has the required structure
12
- */
13
- export declare function validateDefinitionSchema(definition: ReactaDefinition): string | null;
14
- /**
15
- * Load definition from a JSON string. This intentionally does not perform any file I/O.
16
- */
17
- export declare function loadJsonDefinition(jsonData: string, options?: LoadDefinitionOptions): Promise<DefinitionLoadResult>;
18
- /**
19
- * Create instance from definition with validation and error handling
20
- */
21
- export declare function createInstanceFromDefinition(definition: ReactaDefinition, name: string): {
22
- success: boolean;
23
- instance?: ReactaInstance;
24
- error?: string;
25
- };
26
- /**
27
- * Load instance data with validation
28
- */
29
- export declare function loadInstance(instanceData: string | Record<string, unknown>): {
30
- success: boolean;
31
- instance?: ReactaInstance;
32
- error?: string;
33
- };
34
- export declare function upgradeInstanceToLatestDefinition(instance: ReactaInstance, latestDefinition: ReactaDefinition, callback?: (oldInstance: ReactaInstance, newInstance: Record<string, unknown>, latestDefinition: ReactaDefinition) => void): {
35
- success: boolean;
36
- upgradedInstance?: Record<string, unknown>;
37
- error?: string;
38
- };
@@ -1,137 +0,0 @@
1
- import type { ReactNode } from 'react';
2
- type Integer = number;
3
- type Float = number;
4
- export type FieldValueType = boolean | Integer | Float | string | Integer[] | Float[] | string[] | [number, string] | File | File[];
5
- export type ErrorType = string | null;
6
- export type ParentField = Record<string, string[] | Integer[] | boolean[]>;
7
- export interface DefinitionPropertyField {
8
- name: string;
9
- displayName: string;
10
- type: string;
11
- defaultValue: FieldValueType;
12
- required?: boolean;
13
- parents?: ParentField;
14
- children?: Record<string, string[]>;
15
- group?: string;
16
- tooltip?: string;
17
- labelLayout?: 'row' | 'column-left' | 'column-center';
18
- validationHandlerName?: string;
19
- dimension?: string;
20
- defaultUnit?: string;
21
- options?: Array<{
22
- label: string;
23
- value: string;
24
- }>;
25
- minLength?: number;
26
- maxLength?: number;
27
- pattern?: string;
28
- placeholder?: string;
29
- min?: number;
30
- max?: number;
31
- minInclusive?: boolean;
32
- maxInclusive?: boolean;
33
- step?: number;
34
- minCount?: number;
35
- maxCount?: number;
36
- minDate?: string;
37
- maxDate?: string;
38
- includeSeconds?: boolean;
39
- layout?: 'horizontal' | 'vertical' | 'row' | 'column';
40
- alignment?: 'left' | 'center' | 'right';
41
- width?: number;
42
- height?: number;
43
- localized?: string;
44
- minHeight?: string;
45
- accept?: string;
46
- multiple?: boolean;
47
- }
48
- export interface ReactaDefinition {
49
- name: string;
50
- version: string;
51
- displayName: string;
52
- localization?: string;
53
- properties: DefinitionPropertyField[];
54
- validationHandlerName?: string;
55
- submitHandlerName?: string;
56
- }
57
- export interface ReactaInstance {
58
- name: string;
59
- definition: string;
60
- version: string;
61
- values: Record<string, FieldValueType>;
62
- }
63
- export interface ReactaFormProps {
64
- definitionData: string | Record<string, unknown>;
65
- language?: string;
66
- instance?: ReactaInstance;
67
- className?: string;
68
- darkMode?: boolean;
69
- style?: React.CSSProperties;
70
- }
71
- export type FieldValidationHandler = (value: FieldValueType | unknown, t: (defaultText: string, ...args: unknown[]) => string) => string | undefined;
72
- export type FormValidationHandler = (valuesMap: Record<string, FieldValueType | unknown>, t: (key: string, ...args: unknown[]) => string) => string[] | undefined;
73
- export type FormSubmissionHandler = (definition: ReactaDefinition | Record<string, unknown>, instanceName: string | null, valuesMap: Record<string, FieldValueType | unknown>, t: (defaultText: string, ...args: unknown[]) => string) => string[] | undefined;
74
- export type InputOnChange<T> = (value: T | string, error: string | null) => void;
75
- export interface BaseInputProps<TValue = unknown, TField extends DefinitionPropertyField = DefinitionPropertyField> {
76
- field: TField;
77
- value: TValue;
78
- placeholder?: string;
79
- onChange?: InputOnChange<TValue>;
80
- onError?: (error: string | null) => void;
81
- }
82
- export type ReactaFormContextType = {
83
- definitionName: string;
84
- language: string;
85
- darkMode: boolean;
86
- formStyle: {
87
- container?: React.CSSProperties;
88
- titleStyle?: React.CSSProperties;
89
- };
90
- fieldStyle: Record<string, unknown>;
91
- t: (defaultText: string, ...args: unknown[]) => string;
92
- };
93
- export type ReactaFormProviderProps = {
94
- children: ReactNode;
95
- defaultDefinitionName?: string;
96
- defaultStyle?: Record<string, unknown>;
97
- defaultLanguage?: string;
98
- defaultDarkMode?: boolean;
99
- defaultLocalizeName?: string;
100
- className?: string;
101
- };
102
- export type TranslationMap = Record<string, string>;
103
- export type TranslationCache = Map<string, TranslationMap>;
104
- export interface RegistryResult<T = unknown> {
105
- success: boolean;
106
- data?: T;
107
- error?: string;
108
- }
109
- export interface FieldGroup {
110
- name: string;
111
- displayName: string;
112
- description?: string;
113
- collapsed?: boolean;
114
- order?: number;
115
- }
116
- export interface ValidationResult {
117
- isValid: boolean;
118
- errors: string[];
119
- warnings?: string[];
120
- }
121
- export type FormEventType = 'init' | 'change' | 'validate' | 'submit' | 'reset';
122
- export interface FormEvent {
123
- type: FormEventType;
124
- timestamp: Date;
125
- data?: unknown;
126
- }
127
- export interface EnhancedDefinitionPropertyField extends DefinitionPropertyField {
128
- category?: string;
129
- tags?: string[];
130
- dependencies?: string[];
131
- conditional?: {
132
- field: string;
133
- value: unknown;
134
- operator?: 'equals' | 'not_equals' | 'contains' | 'greater_than' | 'less_than';
135
- };
136
- }
137
- export {};
@@ -1,15 +0,0 @@
1
- export declare class BaseRegistry<T> {
2
- private map;
3
- register(name: string, value: T): void;
4
- get(name: string): T | undefined;
5
- has(name: string): boolean;
6
- list(): string[];
7
- entries(): [string, T][];
8
- values(): T[];
9
- size(): number;
10
- unregister(name: string): boolean;
11
- clear(): void;
12
- registerAll(entries: Record<string, T> | [string, T][]): void;
13
- getOrDefault(name: string, defaultValue: T): T;
14
- }
15
- export default BaseRegistry;
@@ -1,10 +0,0 @@
1
- import BaseRegistry from "./baseRegistry";
2
- import React from "react";
3
- type ComponentType = React.ComponentType<any>;
4
- declare const registry: BaseRegistry<ComponentType>;
5
- export declare function registerComponentInternal(type: string, component: ComponentType, isBaseComponent: boolean): void;
6
- export declare function registerComponent(type: string, component: ComponentType): void;
7
- export declare function getComponent(type: string): ComponentType | undefined;
8
- export declare function listComponents(): string[];
9
- export declare function registerBaseComponents(): void;
10
- export default registry;
@@ -1,7 +0,0 @@
1
- export * from "./componentRegistry";
2
- export * from "./submissionHandlerRegistry";
3
- export * from "./validationHandlerRegistry";
4
- export * from "./baseRegistry";
5
- export { default as componentRegistry } from "./componentRegistry";
6
- export { default as submissionRegistry } from "./submissionHandlerRegistry";
7
- export { default as validatorRegistry } from "./validationHandlerRegistry";
@@ -1,6 +0,0 @@
1
- import type { FormSubmissionHandler } from "../reactaFormTypes";
2
- import BaseRegistry from "./baseRegistry";
3
- declare const registry: BaseRegistry<FormSubmissionHandler>;
4
- export declare function registerSubmissionHandler(submitterName: string, fn: FormSubmissionHandler): void;
5
- export declare function getFormSubmissionHandler(submitterName: string): FormSubmissionHandler | undefined;
6
- export default registry;
@@ -1,16 +0,0 @@
1
- import type { FieldValidationHandler, FormValidationHandler } from "../reactaFormTypes";
2
- export declare function registerFormValidationHandler(name: string, fn: FormValidationHandler): void;
3
- export declare function registerFieldValidationHandler(category: string, name: string, fn: FieldValidationHandler): void;
4
- export declare function getFieldValidationHandler(category: string, name: string): FieldValidationHandler | null;
5
- export declare function getFormValidationHandler(name: string): FormValidationHandler | null;
6
- export declare function listFieldValidationHandlers(category?: string): string[];
7
- export declare function listFormValidationHandlers(): string[];
8
- declare const _default: {
9
- registerFormValidationHandler: typeof registerFormValidationHandler;
10
- registerFieldValidationHandler: typeof registerFieldValidationHandler;
11
- getFieldValidationHandler: typeof getFieldValidationHandler;
12
- getFormValidationHandler: typeof getFormValidationHandler;
13
- listFieldValidationHandlers: typeof listFieldValidationHandlers;
14
- listFormValidationHandlers: typeof listFormValidationHandlers;
15
- };
16
- export default _default;
@@ -1,12 +0,0 @@
1
- import type { ReactaDefinition, FieldValueType, ReactaInstance } from "./reactaFormTypes";
2
- export interface SubmitResult {
3
- success: boolean;
4
- message: string;
5
- data?: Record<string, unknown>;
6
- errors?: string[];
7
- }
8
- export declare function submitForm(definition: ReactaDefinition, instance: ReactaInstance | null, valuesMap: Record<string, FieldValueType | unknown>, t: (key: string) => string, errors: Record<string, string>): SubmitResult;
9
- declare const _default: {
10
- submitForm: typeof submitForm;
11
- };
12
- export default _default;
@@ -1,10 +0,0 @@
1
- import type { ReactaDefinition, FieldValueType, DefinitionPropertyField } from "./reactaFormTypes";
2
- export declare function validateFieldValue(definitionName: string, field: Partial<DefinitionPropertyField>, value: FieldValueType | unknown, t: (key: string) => string): string | null;
3
- export declare function validateFormValues(definition: ReactaDefinition | null, valuesMap: Record<string, FieldValueType | unknown>, t: (key: string) => string): string[] | null;
4
- export declare function clearValidationCache(): void;
5
- declare const _default: {
6
- validateFieldValue: typeof validateFieldValue;
7
- validateFormValues: typeof validateFormValues;
8
- clearValidationCache: typeof clearValidationCache;
9
- };
10
- export default _default;
@@ -1,25 +0,0 @@
1
- export type DebouncedCallback = {
2
- callback: (...args: unknown[]) => void;
3
- cancel: () => void;
4
- flush: () => void;
5
- };
6
- /**
7
- * useDebouncedCallback
8
- * - callback: function to call
9
- * - wait: debounce delay in ms
10
- * - options.leading: if true, call on leading edge (optional)
11
- *
12
- * Returns { callback, cancel, flush } where callback is debounced.
13
- */
14
- export declare function useDebouncedCallback(callback: (...args: unknown[]) => unknown, wait?: number, options?: {
15
- leading?: boolean;
16
- }): DebouncedCallback;
17
- /**
18
- * createDebouncedCallback - non-hook variant that returns the same API but
19
- * doesn't use React hooks. Useful for creating many debounced callbacks
20
- * programmatically (e.g., driven from a static schema) while handling
21
- * lifecycle cleanup manually.
22
- */
23
- export declare function createDebouncedCallback(callback: (...args: unknown[]) => unknown, wait?: number, options?: {
24
- leading?: boolean;
25
- }): DebouncedCallback;
@@ -1,4 +0,0 @@
1
- import type { ReactaFormContextType } from '../core/reactaFormTypes';
2
- export declare const ReactaFormContext: import("react").Context<ReactaFormContextType | undefined>;
3
- declare const useReactaFormContext: () => ReactaFormContextType;
4
- export default useReactaFormContext;
@@ -1,14 +0,0 @@
1
- /**
2
- * CSS class constants and helpers
3
- */
4
- export declare const CSS_CLASSES: {
5
- readonly field: "reactaform-field";
6
- readonly label: "reactaform-label";
7
- readonly input: "reactaform-input";
8
- readonly textInput: "reactaform-input--text";
9
- readonly inputNumber: "reactaform-input--number";
10
- readonly inputSelect: "reactaform-select";
11
- readonly rangeInput: "reactaform-input--range";
12
- readonly button: "reactaform-button";
13
- };
14
- export declare const combineClasses: (...classes: (string | undefined | null | false | Record<string, boolean>)[]) => string;
@@ -1,62 +0,0 @@
1
- import type { ReactaDefinition, DefinitionPropertyField } from "../core/reactaFormTypes";
2
- export declare function isDefinitionPropertyField(obj: unknown): obj is DefinitionPropertyField;
3
- export declare function isReactaDefinition(obj: unknown): obj is ReactaDefinition;
4
- /**
5
- * Enhanced serialization options for better control over the process
6
- */
7
- export interface SerializationOptions {
8
- includeMetadata?: boolean;
9
- dateFormat?: 'iso' | 'timestamp' | 'locale';
10
- fileHandling?: 'metadata' | 'skip' | 'base64';
11
- prettify?: boolean;
12
- excludeFields?: string[];
13
- includeOnlyFields?: string[];
14
- }
15
- /**
16
- * Enhanced deserialization options
17
- */
18
- export interface DeserializationOptions {
19
- strict?: boolean;
20
- validateTypes?: boolean;
21
- preserveUnknownFields?: boolean;
22
- dateFormat?: 'auto' | 'iso' | 'timestamp';
23
- }
24
- /**
25
- * Serialization result with metadata
26
- */
27
- export interface SerializationResult {
28
- success: boolean;
29
- data?: string;
30
- error?: string;
31
- metadata?: {
32
- fieldCount: number;
33
- excludedFields: string[];
34
- warnings: string[];
35
- };
36
- }
37
- /**
38
- * Deserialization result with validation info
39
- */
40
- export interface DeserializationResult<T = unknown> {
41
- success: boolean;
42
- data?: T;
43
- error?: string;
44
- warnings?: string[];
45
- validationErrors?: string[];
46
- }
47
- /**
48
- * Enhanced instance serialization with comprehensive options and error handling
49
- */
50
- export declare function serializeInstance(instance: Record<string, unknown>, definition?: ReactaDefinition | Record<string, unknown>, options?: SerializationOptions): SerializationResult;
51
- /**
52
- * Enhanced instance deserialization with comprehensive validation and error handling
53
- */
54
- export declare function deserializeInstance(serialized: string, definition?: ReactaDefinition | Record<string, unknown>, options?: DeserializationOptions): DeserializationResult<Record<string, unknown>>;
55
- /**
56
- * Enhanced definition serialization with validation and metadata
57
- */
58
- export declare function serializeDefinition(definition: ReactaDefinition | Record<string, unknown>, options?: SerializationOptions): SerializationResult;
59
- /**
60
- * Enhanced definition deserialization with comprehensive validation
61
- */
62
- export declare function deserializeDefinition(input: string | Record<string, unknown>, options?: DeserializationOptions): DeserializationResult<ReactaDefinition>;
@@ -1,24 +0,0 @@
1
- import type { DefinitionPropertyField } from "../core/reactaFormTypes";
2
- /**
3
- * Enhanced rename duplicated groups with better conflict resolution
4
- * For example: g1, g1, g2, g1 becomes g1, g1, g2, g1(1)
5
- * This mutates the provided nameToField map so downstream code sees the
6
- * renamed group values.
7
- */
8
- export declare const renameDuplicatedGroups: (properties: DefinitionPropertyField[], nameToField: Record<string, DefinitionPropertyField>) => number;
9
- /**
10
- * Enhanced consecutive field grouping with metadata
11
- */
12
- export declare const groupConsecutiveFields: (items: DefinitionPropertyField[], options?: {
13
- includeEmpty?: boolean;
14
- }) => {
15
- groups: Array<{
16
- name: string | null;
17
- fields: DefinitionPropertyField[];
18
- }>;
19
- metadata: {
20
- totalGroups: number;
21
- emptyGroups: number;
22
- largestGroup: number;
23
- };
24
- };
@@ -1,11 +0,0 @@
1
- /**
2
- * ReactaForm Utils - Comprehensive utility functions
3
- *
4
- * This module provides enhanced utility functions for form building,
5
- * styling, serialization, translation, and component management.
6
- */
7
- export { combineClasses, CSS_CLASSES, } from './cssClasses';
8
- export { serializeInstance, deserializeInstance, serializeDefinition, deserializeDefinition, type SerializationOptions, type DeserializationOptions, type SerializationResult, type DeserializationResult } from './definitionSerializers';
9
- export { renameDuplicatedGroups, groupConsecutiveFields } from './groupingHelpers';
10
- export { loadCommonTranslation, loadUserTranslation, createTranslationFunction, } from './translationCache';
11
- export * from './unitValueMapper';
@@ -1,43 +0,0 @@
1
- import type { TranslationMap, TranslationCache } from "../core/reactaFormTypes";
2
- /**
3
- * Translation loading result
4
- */
5
- export interface TranslationLoadResult {
6
- success: boolean;
7
- translations: TranslationMap;
8
- error?: string;
9
- fromCache?: boolean;
10
- }
11
- export declare const userTranslationCache: TranslationCache;
12
- export declare const userFailedSet: Set<string>;
13
- /**
14
- * Enhanced common translation loader with better error handling
15
- */
16
- export declare const loadCommon: (language: string) => Promise<TranslationLoadResult>;
17
- /**
18
- * Enhanced common translation loading with caching and metadata
19
- */
20
- export declare const loadCommonTranslation: (language: string) => Promise<TranslationLoadResult>;
21
- /**
22
- * Enhanced user translation loading with better error handling and caching
23
- */
24
- export declare const loadUserTranslation: (language: string, localizeName: string) => Promise<TranslationLoadResult>;
25
- /**
26
- * Return whether translation subsystem should run in debug mode.
27
- * Checks multiple env sources (Vite, webpack, Next.js, etc.) for dev/debug mode.
28
- */
29
- export declare function isDebugMode(): boolean;
30
- /**
31
- * Create a translation function using provided maps
32
- * @returns A translation function
33
- * This function processes text using only dictionary lookups and basic string interpolation.
34
- * Note: handling pluralization is not supported now
35
- * @example
36
- * const t = createTranslationFunction('fr', commonMap, userMap);
37
- * const translated = t("Hello, {{1}}!", "world");
38
- */
39
- export declare const createTranslationFunction: (language: string, commonMap: TranslationMap, userMap: TranslationMap) => (defaultText: string, ...args: unknown[]) => string;
40
- /**
41
- * Clear all caches
42
- */
43
- export declare function clearTranslationCaches(): void;
@@ -1,8 +0,0 @@
1
- export declare const dimensionUnitsMap: Record<string, string[]>;
2
- export declare const dimensionUnitDisplayMap: Record<string, Record<string, string>>;
3
- export declare const dimensonUnitFactorsMap: Record<string, Record<string, number>>;
4
- export declare const unitsByDimension: Record<string, Record<string, {
5
- name: string;
6
- shortName: string;
7
- factor?: number;
8
- }>>;