import { I as IFormConfig, a as IWizardConfig, b as IFormSettings, c as IWizardStep, d as IAnalyticsCallbacks, e as IFormTemplate } from './IFormConfig-DTk5E-4l.mjs'; export { f as ITemplateFieldRef, g as ITemplateParamSchema, i as isTemplateFieldRef } from './IFormConfig-DTk5E-4l.mjs'; import { I as IOption, a as IFieldConfig, b as ICondition, c as IFieldEffect, d as IValidationRule } from './IFieldConfig-BTAQmStl.mjs'; export { e as IFieldCondition, f as ILogicalCondition, g as IRule, i as isFieldCondition, h as isLogicalCondition } from './IFieldConfig-BTAQmStl.mjs'; import * as react_hook_form from 'react-hook-form'; import { FieldError, UseFormSetValue, UseFormGetValues } from 'react-hook-form'; import { I as IRuntimeFormState, c as IRulesEngineState, b as IRuntimeFieldState, d as IResolvedFormConfig } from './IResolvedFormConfig-CP4-skHw.mjs'; export { e as IResolvedFieldMeta, a as ITemplateMeta } from './IResolvedFormConfig-CP4-skHw.mjs'; import { I as IEntityData, S as SubEntityType, D as Dictionary } from './index-0OEeDC7T.mjs'; export { c as convertBooleanToYesOrNoText, a as createOption, d as deepCopy, b as isEmpty, i as isNull, e as isStringEmpty, s as sortDropdownOptions } from './index-0OEeDC7T.mjs'; export { D as DocumentLinksStrings, F as FieldClassName, G as GetFieldDataTestId, I as IDateRangeConfig, a as IDateRangeValue, b as IDateTimeConfig, c as IFileUploadConfig, d as IPhoneInputConfig, e as IRatingConfig, M as MAX_FILE_SIZE_MB_DEFAULT, f as ellipsifyText, g as extractDigits, h as formatDateRange, i as formatDateTime, j as formatDateTimeValue, k as formatPhone, l as getFieldState, m as getFileNames } from './IFieldConfigs-BWrQwbb6.mjs'; import React from 'react'; import * as react_jsx_runtime from 'react/jsx-runtime'; /** * Props passed to injected field components via React.cloneElement. * The generic parameter T types the `config` metadata object. */ interface IFieldProps> { /** Field name (unique identifier within the form) */ fieldName?: string; /** Optional test ID prefix for data-testid attributes */ testId?: string; /** Whether the field is read-only */ readOnly?: boolean; /** Whether the field is required */ required?: boolean; /** Current field error */ error?: FieldError; /** Total error count across all fields */ errorCount?: number; /** Whether the field is currently saving */ saving?: boolean; /** Whether save is pending due to errors */ savePending?: boolean; /** Current field value */ value?: unknown; /** Field-specific config metadata (was `meta` in v1) */ config?: T; /** Dropdown/select options (was `dropdownOptions` in v1) */ options?: IOption[]; /** True while async loadOptions is in-flight for this field */ optionsLoading?: boolean; /** Field label */ label?: string; /** Component type string */ type?: string; /** Description text */ description?: string; /** Placeholder text */ placeholder?: string; /** Help text */ helpText?: string; /** Callback to set a field's value */ setFieldValue?: (fieldName: string, fieldValue: unknown, skipSave?: boolean, timeout?: number) => void; } /** Action type keys for the rules engine reducer */ declare enum RulesEngineActionType { SET = "RULES_ENGINE_SET", UPDATE = "RULES_ENGINE_UPDATE", CLEAR = "RULES_ENGINE_CLEAR", CLEAR_PENDING_SETVALUE = "RULES_ENGINE_CLEAR_PENDING_SETVALUE" } interface ISetRulesAction { readonly type: RulesEngineActionType.SET; readonly payload: { readonly configName: string; readonly formState: IRuntimeFormState; }; } interface IUpdateRulesAction { readonly type: RulesEngineActionType.UPDATE; readonly payload: { readonly configName: string; readonly formState: IRuntimeFormState; }; } interface IClearRulesAction { readonly type: RulesEngineActionType.CLEAR; readonly payload: { readonly configName?: string; }; } interface IClearPendingSetValueAction { readonly type: RulesEngineActionType.CLEAR_PENDING_SETVALUE; readonly payload: { readonly configName: string; /** Specific field names to clear. If omitted, clears pendingSetValue on every field. */ readonly fieldNames?: readonly string[]; }; } type RulesEngineAction = ISetRulesAction | IUpdateRulesAction | IClearRulesAction | IClearPendingSetValueAction; /** All localizable string keys used by the core package */ interface ICoreLocaleStrings { autoSavePending: string; savePending: string; saving: string; saveError: string; save: string; cancel: string; create: string; update: string; confirm: string; add: string; edit: string; deleteLabel: string; remove: string; close: string; clear: string; required: string; remaining: string; na: string; unknown: string; loading: string; noResultsFound: string; clickToClear: string; linkTitleLabel: string; linkUrlLabel: string; urlRequired: string; seeLess: string; expand: string; openExpandedTextEditor: string; closeExpandedTextEditor: string; unsavedChanges: string; returnToEditing: string; dontSave: string; overview: string; by: string; filterFields: string; saved: string; saveFailed: string; validating: string; stepOf: (current: number, total: number) => string; formWizard: string; itemOfTotal: (index: number, total: number, label: string) => string; saveChangesTo: (title: string) => string; invalidUrl: string; invalidEmail: string; invalidPhoneNumber: string; invalidYear: string; contentExceedsMaxSize: (maxKb: number) => string; noSpecialCharacters: string; invalidCurrencyFormat: string; duplicateValue: (value: string) => string; mustBeAtLeastChars: (min: number) => string; mustBeAtMostChars: (max: number) => string; mustBeANumber: string; mustBeBetween: (min: number, max: number) => string; thisFieldIsRequired: string; saveRetrying: string; saveTimeout: string; draftRecovered: string; discardDraft: string; unsavedChangesWarning: string; } /** * A field config where rule targets are constrained to known field names. * Provides compile-time checking that cross-field rule effects reference valid fields. */ type TypedFieldConfig = Omit & { /** * Business rules with type-safe cross-field effect targets. * Field names in `then.fields` and `else.fields` are checked against TFields. */ rules?: Array<{ id?: string; when: ICondition; then: Omit & { fields?: Partial>; }; else?: Omit & { fields?: Partial>; }; priority?: number; }>; }; /** * Define field configs with type-safe rule references. * TypeScript will error if a rule's cross-field effect targets a field name that doesn't exist. * * At runtime this is a no-op -- it just returns the input. The value is purely at compile time. * * @example * const config = defineFormConfig({ * name: { type: "Textbox", label: "Name" }, * status: { * type: "Dropdown", * label: "Status", * options: [{ value: "Active", label: "Active" }, { value: "Inactive", label: "Inactive" }], * rules: [{ * when: { field: "status", operator: "equals", value: "Active" }, * then: { fields: { name: { required: true } } }, // "name" checked at compile time * }], * }, * }); */ declare function defineFormConfig>>>(fields: T): Record; /** * Interface to track the confirm input modal props */ interface IConfirmInputModalProps { /** * The field that triggered the modal */ confirmInputsTriggeredBy?: string; /** * The fields that need need to be updated within the Confirm Input Modal */ dependentFieldNames?: string[]; /** * Dirty fields that can be saved w/o confirmation */ otherDirtyFields?: string[]; } interface IFieldToRender { /** * Field Name */ fieldName: string; /** * Soft Hidden means render the controller for hook forms but not the field input */ softHidden?: boolean; } interface IFormosaicProps { configName: string; /** Optional test ID prefix for data-testid attributes */ testId?: string; areAllFieldsReadonly?: boolean; expandCutoffCount?: number; collapsedMaxHeight?: number; isCreate?: boolean; enableFilter?: boolean; /** Current user's identifier for value functions like setLoggedInUser */ currentUserId?: string; /** Callback when save error occurs */ onSaveError?: (error: string) => void; /** Parent entity data for $parent expressions */ parentEntity?: IEntityData; } interface IFragmentDef { template?: string; config?: IFormConfig; params?: Record; overrides?: Record>; defaultValues?: Record; } interface IFormConnection { name: string; when: ICondition; source: { fragment: string; port: string; }; target: { fragment: string; port: string; }; effect: "copyValues" | "hide" | "readOnly" | "computeFrom"; } interface IComposeFormOptions { fragments: Record; fields?: Record; connections?: IFormConnection[]; fieldOrder?: string[]; wizard?: IWizardConfig; settings?: IFormSettings; lookups?: Record; } /** Component type constants */ declare const ComponentTypes: { readonly Textbox: "Textbox"; readonly Dropdown: "Dropdown"; readonly Toggle: "Toggle"; readonly Number: "Number"; readonly MultiSelect: "Multiselect"; readonly DateControl: "DateControl"; readonly Slider: "Slider"; readonly Fragment: "DynamicFragment"; readonly MultiSelectSearch: "MultiSelectSearch"; readonly Textarea: "Textarea"; readonly DocumentLinks: "DocumentLinks"; readonly StatusDropdown: "StatusDropdown"; readonly ReadOnly: "ReadOnly"; readonly ReadOnlyArray: "ReadOnlyArray"; readonly ReadOnlyDateTime: "ReadOnlyDateTime"; readonly ReadOnlyCumulativeNumber: "ReadOnlyCumulativeNumber"; readonly ReadOnlyRichText: "ReadOnlyRichText"; readonly ReadOnlyWithButton: "ReadOnlyWithButton"; readonly FieldArray: "FieldArray"; readonly RadioGroup: "RadioGroup"; readonly CheckboxGroup: "CheckboxGroup"; readonly Rating: "Rating"; readonly ColorPicker: "ColorPicker"; readonly Autocomplete: "Autocomplete"; readonly FileUpload: "FileUpload"; readonly DateRange: "DateRange"; readonly DateTime: "DateTime"; readonly PhoneInput: "PhoneInput"; }; /** Form-level constants */ declare const FormConstants: { readonly defaultExpandCutoffCount: 12; readonly loadingShimmerCount: 12; readonly loadingFieldShimmerHeight: 32; readonly na: "n/a"; readonly urlRegex: RegExp; }; /** * User-facing string literals (v2). * All properties resolve through the locale registry. */ declare const FormStrings: { readonly autoSavePending: string; readonly savePending: string; readonly remaining: string; readonly saving: string; readonly seeLess: string; readonly expand: string; readonly required: string; readonly save: string; readonly cancel: string; readonly create: string; readonly update: string; readonly na: string; readonly saveError: string; readonly confirm: string; readonly linkTitleLabel: string; readonly linkUrlLabel: string; readonly add: string; readonly edit: string; readonly deleteLabel: string; readonly remove: string; readonly unknown: string; readonly close: string; readonly loading: string; readonly noResultsFound: string; readonly clickToClear: string; readonly clear: string; readonly urlRequired: string; readonly openExpandedTextEditor: string; readonly closeExpandedTextEditor: string; readonly unsavedChanges: string; readonly returnToEditing: string; readonly dontSave: string; readonly overview: string; readonly by: string; readonly filterFields: string; readonly saved: string; readonly saveFailed: string; readonly validating: string; readonly stepOf: (current: number, total: number) => string; readonly formWizard: string; readonly itemOfTotal: (index: number, total: number, label: string) => string; readonly saveChangesTo: (title: string) => string; readonly draftRecovered: string; readonly discardDraft: string; readonly unsavedChangesWarning: string; readonly saveRetrying: string; readonly saveTimeout: string; }; interface IRulesEngineProvider { rulesState: IRulesEngineState; initFormState: (configName: string, defaultValues: IEntityData, fields: Record, areAllFieldsReadonly?: boolean) => IRuntimeFormState; processFieldChange: (entityData: IEntityData, configName: string, fieldName: string, fields: Record) => void; clearFormState: (configName?: string) => void; /** * Clear the pending setValue state on one or more fields. If fieldNames is * omitted, clears pendingSetValue on every field in the config. * Returns immutably; safe to call from an effect. */ clearPendingSetValue: (configName: string, fieldNames?: readonly string[]) => void; } declare function UseRulesEngineContext(): IRulesEngineProvider; declare const RulesEngineProvider: React.FC>; interface IInjectedFieldProvider { injectedFields: Record; setInjectedFields: (injectedFields: Record) => void; } declare function UseInjectedFieldContext(): IInjectedFieldProvider; interface InjectedFieldProviderProps { /** Optional initial field registry. If provided, fields are set immediately. */ injectedFields?: Record; children?: React.ReactNode; } declare const InjectedFieldProvider: React.FC; /** * Builds the dependency graph from field configs. * Returns adjacency lists: for each field, which other fields depend on it. */ declare function buildDependencyGraph(fields: Record): Record>; /** * Topological sort of field names using Kahn's algorithm. * Returns fields in dependency order. Detects cycles. */ declare function topologicalSort(graph: Record>): { sorted: string[]; hasCycle: boolean; cycleFields: string[]; }; /** * Builds the default runtime field state from static field configs. */ declare function buildDefaultFieldStates(fields: Record, areAllFieldsReadonly?: boolean): Record; /** * Evaluates all rules for all fields against current values. * Returns the full runtime form state. */ declare function evaluateAllRules(fields: Record, values: IEntityData, areAllFieldsReadonly?: boolean): IRuntimeFormState; /** * Evaluates rules for fields that are transitively affected by a changed field. * Returns only the changed field states (incremental update). */ declare function evaluateAffectedFields(changedField: string, fields: Record, values: IEntityData, currentState: IRuntimeFormState): IRuntimeFormState; /** * Evaluates a condition tree against the current form values. * * Supports all 15 field operators and AND/OR/NOT logical operators. */ declare function evaluateCondition(condition: ICondition, values: IEntityData): boolean; /** * Extracts all field names referenced in a condition tree. */ declare function extractConditionDependencies(condition: ICondition): string[]; declare const IsExpandVisible: (fieldStates: Record, expandCutoffCount?: number) => boolean; declare const GetConfirmInputModalProps: (dirtyFieldNames: string[], fieldStates: Record) => IConfirmInputModalProps; interface IExecuteComputedValue { fieldName: string; expression: string; } declare const GetComputedValuesOnDirtyFields: (dirtyFieldNames: string[], fieldStates: Record) => IExecuteComputedValue[]; declare const GetComputedValuesOnCreate: (fieldStates: Record) => IExecuteComputedValue[]; declare const ExecuteComputedValue: (expression: string, values: IEntityData, fieldName?: string, parentEntity?: IEntityData, currentUserId?: string) => SubEntityType; declare const CheckFieldValidationRules: (value: unknown, fieldName: string, entityData: IEntityData, state: IRuntimeFieldState) => string | undefined; declare const CheckAsyncFieldValidationRules: (value: unknown, fieldName: string, entityData: IEntityData, state: IRuntimeFieldState, signal?: AbortSignal) => Promise; declare const CheckValidDropdownOptions: (fieldStates: Record, formValues: IEntityData, setValue: UseFormSetValue) => void; declare const CheckDefaultValues: (fieldStates: Record, formValues: IEntityData, setValue: UseFormSetValue) => void; declare const InitOnCreateFormState: (configName: string, fields: Record, defaultValues: IEntityData, parentEntity: IEntityData, userId: string, setValue: UseFormSetValue, initFormState: (configName: string, defaultValues: IEntityData, fields: Record, areAllFieldsReadonly?: boolean) => IRuntimeFormState, getValues?: UseFormGetValues) => { formState: IRuntimeFormState; initEntityData: IEntityData; }; declare const InitOnEditFormState: (configName: string, fields: Record, defaultValues: IEntityData, areAllFieldsReadonly: boolean, initFormState: (configName: string, defaultValues: IEntityData, fields: Record, areAllFieldsReadonly?: boolean) => IRuntimeFormState) => { formState: IRuntimeFormState; initEntityData: IEntityData; }; declare const ShowField: (filterText?: string, value?: SubEntityType, label?: string) => boolean; declare const GetFieldsToRender: (fieldRenderLimit: number, fieldOrder: string[], fieldStates?: Record) => IFieldToRender[]; /** Sort options alphabetically by label */ declare function SortOptions(options: IOption[]): IOption[]; interface ICycleError { type: "dependency" | "self"; fields: string[]; message: string; } /** * Detects circular dependencies in field rules using Kahn's algorithm. * Operates on the dependency graph built from IFieldConfig.rules. */ declare function detectDependencyCycles(fields: Record): ICycleError[]; /** * Detects self-dependencies (a field's rule references itself in a way that causes loops). */ declare function detectSelfDependencies(fields: Record): ICycleError[]; /** * Validates the full dependency graph of field configs. * Logs warnings in development, returns errors for programmatic use. */ declare function validateDependencyGraph(fields: Record): ICycleError[]; /** * Unified validator function signature. * Handles sync, async, and cross-field validation. * * @param value - The field's current value * @param params - Parameters from IValidationRule.params * @param context - Full form context (values, field name, abort signal) * @returns Error message string, undefined if valid, or a Promise for async */ type ValidatorFn = (value: unknown, params: Record | undefined, context: IValidationContext) => string | undefined | Promise; interface IValidationContext { fieldName: string; values: IEntityData; signal?: AbortSignal; } /** Metadata describing a validator for use in designer UIs and documentation. */ interface IValidatorMetadata { /** Human-readable display name */ label: string; /** Optional description of what the validator checks */ description?: string; /** Named parameters the validator accepts */ params?: Record; } /** Register metadata for a custom (or built-in) validator */ declare function registerValidatorMetadata(name: string, metadata: IValidatorMetadata): void; /** Get metadata for a specific validator by name */ declare function getValidatorMetadata(name: string): IValidatorMetadata | undefined; /** Get all registered validator metadata */ declare function getAllValidatorMetadata(): Record; /** Reset validator metadata registry (for testing) */ declare function resetValidatorMetadataRegistry(): void; /** Register custom validators (merge into registry) */ declare function registerValidators(custom: Record): void; /** Get a validator by name */ declare function getValidator(name: string): ValidatorFn | undefined; /** Get a copy of the full registry */ declare function getValidatorRegistry(): Record; /** Reset registry to defaults (for testing) */ declare function resetValidatorRegistry(): void; /** * Run all validation rules for a field value. * Handles sync, async, and conditional validation. */ declare function runValidations(value: unknown, rules: IValidationRule[], context: IValidationContext): Promise; /** * Run only sync validation rules (no await, fast fail). */ declare function runSyncValidations(value: unknown, rules: IValidationRule[], context: IValidationContext): string | undefined; declare function createMinLengthRule(min: number, message?: string): IValidationRule; declare function createMaxLengthRule(max: number, message?: string): IValidationRule; declare function createNumericRangeRule(min: number, max: number, message?: string): IValidationRule; declare function createPatternRule(pattern: string, message: string): IValidationRule; declare function createRequiredIfRule(field: string, values: string[], message?: string): IValidationRule; /** * Value function signature (v2). * Used in computed value expressions via $fn.name() syntax. */ type ValueFunction = (context: IValueFunctionContext) => SubEntityType; interface IValueFunctionContext { fieldName: string; fieldValue?: SubEntityType; values: IEntityData; parentEntity?: IEntityData; currentUserId?: string; } /** Register custom value functions (merge into registry) */ declare function registerValueFunctions(custom: Record): void; /** Get a value function by name */ declare function getValueFunction(name: string): ValueFunction | undefined; /** Execute a named value function */ declare function executeValueFunction(fieldName: string, functionName: string, values: IEntityData, fieldValue?: SubEntityType, parentEntity?: IEntityData, currentUserId?: string): SubEntityType; /** Reset registry to defaults (for testing) */ declare function resetValueFunctionRegistry(): void; interface IConfigValidationError { type: "missing_rule_target" | "unregistered_component" | "unregistered_validator" | "circular_dependency" | "self_dependency" | "missing_options" | "invalid_condition"; fieldName: string; message: string; details?: string; } /** * Validates field configs for common issues at dev time. * * Checks: * - Rule conditions reference existing fields * - Cross-field effects target existing fields * - Component types are registered (if registry provided) * - Validators are registered * - Dropdown fields have options or rules providing them * - No circular/self dependencies */ declare function validateFieldConfigs(fields: Record, registeredComponents?: Set): IConfigValidationError[]; /** * Register a partial or full locale override. Unspecified keys fall back to English defaults. * Can be called multiple times; each call merges into the current locale. */ declare function registerLocale(partial: Partial): void; /** * Get a locale string by key. Returns the registered locale value or the English default. */ declare function getLocaleString(key: K): ICoreLocaleStrings[K]; /** * Reset the locale to English defaults. Useful for testing. */ declare function resetLocale(): void; /** * Get the full current locale object. Useful for debugging or bulk operations. */ declare function getCurrentLocale(): ICoreLocaleStrings; interface IWizardNavigationProps { steps: IWizardStep[]; currentStepIndex: number; goToStep: (index: number) => void; canGoNext: boolean; canGoPrev: boolean; goNext: () => void; goPrev: () => void; } interface IWizardStepHeaderProps { step: IWizardStep; stepIndex: number; totalSteps: number; } interface IWizardFormProps { wizardConfig: IWizardConfig; entityData: IEntityData; fieldStates?: Record; errors?: Record; renderStepContent: (fields: string[]) => React.ReactNode; renderStepNavigation?: (props: IWizardNavigationProps) => React.ReactNode; renderStepHeader?: (props: IWizardStepHeaderProps) => React.ReactNode; onStepChange?: (fromIndex: number, toIndex: number) => void; /** Analytics callback for wizard step changes. */ onAnalyticsStepChange?: (fromStep: number, toStep: number) => void; } declare const WizardForm: React.FC; declare function getVisibleSteps(steps: IWizardStep[], entityData: IEntityData): IWizardStep[]; declare function getStepFields(step: IWizardStep, fieldStates?: Record): string[]; declare function getStepFieldOrder(steps: IWizardStep[], entityData: IEntityData): string[]; declare function validateStepFields(step: IWizardStep, errors: Record): string[]; declare function isStepValid(step: IWizardStep, errors: Record): boolean; declare function getStepIndex(steps: IWizardStep[], stepId: string): number; interface IFieldArrayProps { fieldName: string; config: IFieldConfig; renderItem: (itemFieldNames: string[], index: number, remove: () => void) => React.ReactNode; renderAddButton?: (append: () => void, canAdd: boolean) => React.ReactNode; } declare const FieldArray: React.FC; interface IFormosaicComponentProps extends IFormosaicProps { /** v2 form config (preferred). If provided, fieldConfigs is ignored. */ formConfig?: IFormConfig; /** v1-style field configs (for migration). Use formConfig instead. */ fieldConfigs?: Record; defaultValues: IEntityData; saveData?: (entityData: IEntityData, dirtyFieldNames?: string[]) => Promise; saveTimeoutMs?: number; maxSaveRetries?: number; renderExpandButton?: (props: { isExpanded: boolean; onToggle: () => void; }) => React.JSX.Element; renderFilterInput?: (props: { onChange: (value: string) => void; }) => React.JSX.Element; renderDialog?: (props: { isOpen: boolean; onSave: () => void; onCancel: () => void; children: React.ReactNode; }) => React.JSX.Element; isManualSave?: boolean; renderSaveButton?: (props: { onSave: () => void; isDirty: boolean; isValid: boolean; isSubmitting: boolean; }) => React.ReactNode; formErrors?: string[]; /** Per-field server-side errors to inject (e.g. from a failed API save). Keys are field names, values are error messages. */ fieldErrors?: Record; renderLabel?: (props: { id: string; labelId: string; label?: string; required?: boolean; }) => React.ReactNode; renderError?: (props: { id: string; error?: react_hook_form.FieldError; errorCount?: number; }) => React.ReactNode; renderStatus?: (props: { id: string; saving?: boolean; savePending?: boolean; errorCount?: number; isManualSave?: boolean; }) => React.ReactNode; /** Called with validated form values when the user submits. Works alongside auto-save. */ onSubmit?: (values: IEntityData) => void | Promise; /** Called with RHF FieldErrors when submit validation fails. */ onSubmitError?: (errors: react_hook_form.FieldErrors) => void; /** Render prop for a custom submit button. If onSubmit is provided and this is omitted, a default submit button is rendered. */ renderSubmitButton?: (props: { onSubmit: () => void; isDirty: boolean; isValid: boolean; isSubmitting: boolean; }) => React.ReactNode; } declare const Formosaic: React.FC; /** * Stable wrapper functions for analytics callbacks. * Each function is a no-op when the corresponding callback is not provided. */ interface IFormAnalytics { trackFieldFocus: (fieldName: string) => void; trackFieldBlur: (fieldName: string) => void; trackFieldChange: (fieldName: string, oldValue: unknown, newValue: unknown) => void; trackValidationError: (fieldName: string, errors: string[]) => void; trackFormSubmit: (values: Record) => void; trackFormAbandonment: (filledFields: string[], emptyRequiredFields: string[]) => void; trackWizardStepChange: (fromStep: number, toStep: number) => void; trackRuleTriggered: (event: { fieldName: string; ruleIndex: number; conditionMet: boolean; }) => void; /** Timestamp (ms) when the hook was first created -- used for form duration. */ formStartTime: number; } /** * Hook that wraps IAnalyticsCallbacks into safe, memoized wrapper functions. * Tracks form start time for duration calculations and per-field focus times. */ declare function useFormAnalytics(callbacks?: IAnalyticsCallbacks): IFormAnalytics; interface IFormFieldsProps { testId?: string; isExpanded?: boolean; expandEnabled?: boolean; fieldOrder?: string[]; inPanel?: boolean; collapsedMaxHeight?: number; formState?: IRuntimeFormState; fields?: Record; setFieldValue: (fieldName: string, fieldValue: unknown, skipSave?: boolean) => void; isManualSave?: boolean; isCreate?: boolean; filterText?: string; fieldRenderLimit?: number; renderLabel?: (props: { id: string; labelId: string; label?: string; required?: boolean; }) => React.ReactNode; renderError?: (props: { id: string; error?: react_hook_form.FieldError; errorCount?: number; }) => React.ReactNode; renderStatus?: (props: { id: string; saving?: boolean; savePending?: boolean; errorCount?: number; isManualSave?: boolean; }) => React.ReactNode; analytics?: IFormAnalytics; } declare const FormFields: (props: IFormFieldsProps) => react_jsx_runtime.JSX.Element; interface IFieldWrapperProps { id?: string; readonly label?: string; readonly required?: boolean; readonly error?: FieldError; readonly errorCount?: number; readonly savePending?: boolean; readonly saving?: boolean; readonly labelClassName?: string; readonly fieldClassName?: string; readonly showControlonSide?: boolean; readonly ariaLabel?: string; readonly ariaDescription?: string; readonly containerClassName?: string; readonly additionalInfo?: string; readonly additionalInfoIcon?: string; readonly additionalInfoComponent?: React.ReactNode; isManualSave?: boolean; renderLabel?: (props: { id: string; labelId: string; label?: string; required?: boolean; }) => React.ReactNode; renderError?: (props: { id: string; error?: FieldError; errorCount?: number; }) => React.ReactNode; renderStatus?: (props: { id: string; saving?: boolean; savePending?: boolean; errorCount?: number; isManualSave?: boolean; }) => React.ReactNode; } declare const FieldWrapper: React.FunctionComponent>; interface IRenderFieldProps { fieldName: string; testId?: string; type: string; hidden?: boolean; required?: boolean; readOnly?: boolean; disabled?: boolean; options?: IOption[]; optionsLoading?: boolean; validate?: IValidationRule[]; isManualSave?: boolean; setFieldValue: (fieldName: string, fieldValue: unknown, skipSave?: boolean) => void; isCreate?: boolean; filterText?: string; softHidden?: boolean; label?: string; skipLayoutReadOnly?: boolean; hideOnCreate?: boolean; config?: Record; description?: string; placeholder?: string; helpText?: string; renderLabel?: (props: { id: string; labelId: string; label?: string; required?: boolean; }) => React.ReactNode; renderError?: (props: { id: string; error?: react_hook_form.FieldError; errorCount?: number; }) => React.ReactNode; renderStatus?: (props: { id: string; saving?: boolean; savePending?: boolean; errorCount?: number; isManualSave?: boolean; }) => React.ReactNode; analytics?: IFormAnalytics; } declare const _default: React.MemoExoticComponent<(props: IRenderFieldProps) => react_jsx_runtime.JSX.Element>; interface IConfirmInputsModalProps { isOpen?: boolean; configName: string; testId?: string; fields: Record; confirmInputFields: string[]; saveConfirmInputFields: () => void; cancelConfirmInputFields: () => void; renderDialog?: (props: { isOpen: boolean; onSave: () => void; onCancel: () => void; children: React.ReactNode; }) => React.JSX.Element; } declare const ConfirmInputsModal: (props: IConfirmInputsModalProps) => react_jsx_runtime.JSX.Element; interface IFormErrorBoundaryProps { children: React.ReactNode; fallback?: (error: Error, resetError: () => void) => React.ReactNode; onError?: (error: Error, errorInfo: React.ErrorInfo) => void; } interface IFormErrorBoundaryState { hasError: boolean; error: Error | null; } declare class FormErrorBoundary extends React.Component { constructor(props: IFormErrorBoundaryProps); static getDerivedStateFromError(error: Error): IFormErrorBoundaryState; componentDidCatch(error: Error, errorInfo: React.ErrorInfo): void; resetError: () => void; render(): React.ReactNode; } type LazyFieldImport = () => Promise<{ default: React.ComponentType; }>; /** * Creates a field registry where components are loaded on-demand via React.lazy(). * Fields are only loaded when first rendered, reducing initial bundle size. * * @example * const registry = createLazyFieldRegistry({ * Textbox: () => import("./fields/Textbox"), * Dropdown: () => import("./fields/Dropdown"), * }); */ declare function createLazyFieldRegistry(imports: Record): Dictionary; interface IDraftPersistenceOptions { /** Unique form identifier for storage key */ formId: string; /** Current form data to persist */ data: IEntityData; /** Auto-save interval in ms (default 30000) */ saveIntervalMs?: number; /** Whether persistence is enabled (default true) */ enabled?: boolean; /** Custom storage key prefix (default "draft_") */ storageKeyPrefix?: string; } interface IDraftState { data: IEntityData; timestamp: number; } interface IUseDraftPersistenceResult { /** Recover a saved draft if one exists */ recoverDraft: () => IDraftState | null; /** Clear the saved draft */ clearDraft: () => void; /** Whether a draft exists */ hasDraft: boolean; /** Manually save current state as draft */ saveDraft: () => void; } /** * Hook that persists form draft state to localStorage on a configurable interval. * * Handles localStorage errors gracefully (e.g. private browsing, quota exceeded). */ declare function useDraftPersistence(options: IDraftPersistenceOptions): IUseDraftPersistenceResult; /** * Hook that warns the user before navigating away when there are unsaved changes. * * @param shouldWarn - Whether the beforeunload warning should be active * @param message - Custom message (modern browsers ignore custom text but still show a prompt) * @param onAbandonment - Optional analytics callback fired when the user leaves with unsaved changes */ declare function useBeforeUnload(shouldWarn: boolean, message?: string, onAbandonment?: () => void): void; /** * Serialize form state to a JSON string, preserving Date objects * with a special `__type` marker so they can be round-tripped. */ declare function serializeFormState(data: IEntityData): string; /** * Deserialize a JSON string back to form state, restoring Date objects * that were serialized with `serializeFormState`. */ declare function deserializeFormState(json: string): IEntityData; declare function evaluateExpression(expression: string, values: IEntityData, fieldName?: string, parentEntity?: IEntityData, currentUserId?: string): unknown; /** * Extracts field names referenced in an expression via $values.fieldName or $root.fieldName. */ declare function extractExpressionDependencies(expression: string): string[]; /** * Extracts value function names referenced via $fn.name() syntax. */ declare function extractFunctionDependencies(expression: string): string[]; declare function registerFormTemplate = Record>(name: string, template: IFormTemplate): void; declare function registerFormTemplates(templates: Record): void; declare function getFormTemplate(name: string): IFormTemplate | undefined; declare function resetFormTemplates(): void; declare function registerLookupTables(tables: Record): void; declare function getLookupTable(name: string): unknown | undefined; declare function resetLookupTables(): void; /** * TemplateResolver — 11-step resolution pipeline. * * Transforms an IFormConfig containing templateRef fields into a flat * IResolvedFormConfig with no template references remaining. The output * is a standard IFormConfig that the existing rules engine can consume. * * Pipeline steps: * 1. Collect — Walk config tree, find all templateRef nodes * 2. Params — Evaluate {{expression}} strings against params + $lookup tables * 3. Expand — Replace templateRef node with template's fields, prefixed by field name * 4. Override — Apply templateOverrides (shallow merge) and defaultValues * 5. Recurse — If expanded fields contain templateRef, repeat (with cycle detection) * 6. Rewrite — Prefix internal rule field references to match resolved paths * 7. Scope — Rewrite $values references in expressions to use prefixed paths * 8. Merge ports — Collect port declarations, rewrite to prefixed paths * 9. Wizard — Expand wizard step `fragments` arrays to resolved field name lists * 10. Attach meta — Build _templateMeta mapping for DevTools (dev mode only) * 11. Output — Standard IFormConfig with no template references remaining */ interface IResolveOptions { /** Additional templates merged with global registry and config.templates. */ templates?: Record; /** Additional lookups merged with global registry and config.lookups. */ lookups?: Record; /** Maximum template nesting depth. Default: 10. */ maxDepth?: number; } /** * Resolve all template references in a form config, producing a flat * IResolvedFormConfig with no templateRef fields remaining. */ declare function resolveTemplates(config: IFormConfig, options?: IResolveOptions): IResolvedFormConfig; type TemplateErrorType = "template_not_found" | "template_cycle" | "template_max_depth"; /** * Structured error for template resolution failures. * Mirrors the IConfigValidationError pattern from ConfigValidator. */ declare class TemplateResolutionError extends Error { readonly type: TemplateErrorType; readonly fieldName: string; readonly details?: string; constructor(type: TemplateErrorType, fieldName: string, message: string, details?: string); } declare function composeForm(options: IComposeFormOptions): IResolvedFormConfig; /** * Type-safe builder for composed forms. At runtime this is identical to `composeForm()`. * The value is purely at the type level — IComposeFormOptions provides type checking * for fragment definitions, connections, and wizard steps. * * @example * const config = defineComposedForm({ * fragments: { * shipping: { template: "address", params: { required: true } }, * billing: { template: "address" }, * }, * fields: { sameAddr: { type: "Toggle", label: "Same as shipping?" } }, * connections: [{ name: "copy", when: ..., source: ..., target: ..., effect: "copyValues" }], * }); */ declare function defineComposedForm(options: IComposeFormOptions): IResolvedFormConfig; interface IComposedFormProps { /** Base config to merge JSX declarations into. */ config?: IFormConfig; /** Form-level settings. */ settings?: IFormSettings; /** Wizard config. */ wizard?: IWizardConfig; /** Field display order. */ fieldOrder?: string[]; /** Lookup tables. */ lookups?: Record; /** Save callback. */ onSave?: (data: IEntityData) => void | Promise; /** Entity data (initial values). */ entityData?: IEntityData; /** Whether form is in read-only mode. */ readOnly?: boolean; /** Config name for the form instance. Defaults to "composed". */ configName?: string; /** Test ID prefix. */ testId?: string; /** Children: FormFragment, FormField, FormConnection components. */ children?: React.ReactNode; } declare function ComposedForm(props: IComposedFormProps): React.ReactElement | null; declare namespace ComposedForm { var displayName: string; } interface IFormFragmentProps { template?: string; config?: IFormConfig; params?: Record; prefix: string; overrides?: Record>; defaultValues?: Record; } /** Declaration-only component. Returns null. Props read by ComposedForm. */ declare function FormFragment(_props: IFormFragmentProps): null; declare namespace FormFragment { var displayName: string; } interface IFormConnectionProps { name: string; when: ICondition; source: { fragment: string; port: string; }; target: { fragment: string; port: string; }; effect: "copyValues" | "hide" | "readOnly" | "computeFrom"; } /** Declaration-only component. Returns null. Props read by ComposedForm. */ declare function FormConnection(_props: IFormConnectionProps): null; declare namespace FormConnection { var displayName: string; } interface IFormFieldProps { name: string; config: IFieldConfig; } /** Declaration-only component. Returns null. Props read by ComposedForm. */ declare function FormField(_props: IFormFieldProps): null; declare namespace FormField { var displayName: string; } export { CheckAsyncFieldValidationRules, CheckDefaultValues, CheckFieldValidationRules, CheckValidDropdownOptions, ComponentTypes, ComposedForm, ConfirmInputsModal, Dictionary, ExecuteComputedValue, FieldArray, FieldWrapper, FormConnection, FormConstants, FormErrorBoundary, FormField, FormFields, FormFragment, FormStrings, Formosaic, GetComputedValuesOnCreate, GetComputedValuesOnDirtyFields, GetConfirmInputModalProps, GetFieldsToRender, IAnalyticsCallbacks, type IClearPendingSetValueAction, type IClearRulesAction, type IComposeFormOptions, type IComposedFormProps, ICondition, type IConfigValidationError, type IConfirmInputModalProps, type ICoreLocaleStrings, type ICycleError, type IDraftPersistenceOptions, type IDraftState, IEntityData, type IFieldArrayProps, IFieldConfig, IFieldEffect, type IFieldProps, type IFieldToRender, type IFormAnalytics, IFormConfig, type IFormConnection, type IFormConnectionProps, type IFormFieldProps, type IFormFragmentProps, IFormSettings, IFormTemplate, type IFormosaicProps, type IFragmentDef, type IInjectedFieldProvider, IOption, type IResolveOptions, IResolvedFormConfig, type IRulesEngineProvider, IRulesEngineState, IRuntimeFieldState, IRuntimeFormState, type ISetRulesAction, type IUpdateRulesAction, type IUseDraftPersistenceResult, type IValidationContext, IValidationRule, type IValidatorMetadata, type IValueFunctionContext, IWizardConfig, type IWizardFormProps, type IWizardNavigationProps, IWizardStep, type IWizardStepHeaderProps, InitOnCreateFormState, InitOnEditFormState, InjectedFieldProvider, IsExpandVisible, _default as RenderField, type RulesEngineAction, RulesEngineActionType, RulesEngineProvider, ShowField, SortOptions as SortDropdownOptions, SortOptions, SubEntityType, type TemplateErrorType, TemplateResolutionError, type TypedFieldConfig, UseInjectedFieldContext, UseRulesEngineContext, type ValidatorFn, type ValueFunction, WizardForm, buildDefaultFieldStates, buildDependencyGraph, composeForm, createLazyFieldRegistry, createMaxLengthRule, createMinLengthRule, createNumericRangeRule, createPatternRule, createRequiredIfRule, defineComposedForm, defineFormConfig, deserializeFormState, detectDependencyCycles, detectSelfDependencies, evaluateAffectedFields, evaluateAllRules, evaluateCondition, evaluateExpression, executeValueFunction, extractConditionDependencies, extractExpressionDependencies, extractFunctionDependencies, getAllValidatorMetadata, getCurrentLocale, getFormTemplate, getLocaleString, getLookupTable, getStepFieldOrder, getStepFields, getStepIndex, getValidator, getValidatorMetadata, getValidatorRegistry, getValueFunction, getVisibleSteps, isStepValid, registerFormTemplate, registerFormTemplates, registerLocale, registerLookupTables, registerValidatorMetadata, registerValidators, registerValueFunctions, resetFormTemplates, resetLocale, resetLookupTables, resetValidatorMetadataRegistry, resetValidatorRegistry, resetValueFunctionRegistry, resolveTemplates, runSyncValidations, runValidations, serializeFormState, topologicalSort, useBeforeUnload, useDraftPersistence, useFormAnalytics, validateDependencyGraph, validateFieldConfigs, validateStepFields };