@formality-ui/core 0.0.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.
@@ -0,0 +1,1182 @@
1
+ /**
2
+ * ConditionDescriptor - Defines a single condition rule
3
+ *
4
+ * Conditions control disabled, visible, and setValue behaviors based on
5
+ * form state. Each condition has a trigger (when/selectWhen), optional
6
+ * matchers (is/truthy), and actions (disabled/visible/set/selectSet).
7
+ */
8
+ interface ConditionDescriptor {
9
+ /**
10
+ * Simple field reference trigger
11
+ * Example: "client" - triggers when client field has a value
12
+ */
13
+ when?: string;
14
+ /**
15
+ * Expression or function trigger
16
+ * Example: "client.id > 5" or ({ fields }) => fields.client?.value?.id > 5
17
+ */
18
+ selectWhen?: SelectValue<boolean>;
19
+ /**
20
+ * Exact value match
21
+ * When true, condition matches if trigger value === is value
22
+ */
23
+ is?: unknown;
24
+ /**
25
+ * Truthy/falsy check
26
+ * true: matches if trigger is truthy
27
+ * false: matches if trigger is falsy
28
+ */
29
+ truthy?: boolean;
30
+ /**
31
+ * Set disabled state
32
+ * Multiple conditions use OR logic (any true = disabled)
33
+ */
34
+ disabled?: boolean;
35
+ /**
36
+ * Set visible state
37
+ * Multiple conditions use AND logic (any false = hidden)
38
+ */
39
+ visible?: boolean;
40
+ /**
41
+ * Set static value when condition matches
42
+ * Last matching condition wins
43
+ */
44
+ set?: unknown;
45
+ /**
46
+ * Set dynamic value from expression or function
47
+ * Last matching condition wins
48
+ */
49
+ selectSet?: SelectValue;
50
+ /**
51
+ * Explicit field subscriptions for function-based conditions
52
+ * REQUIRED when using functions in selectWhen or selectSet
53
+ */
54
+ subscribesTo?: string[];
55
+ }
56
+ /**
57
+ * ConditionResult - Result of evaluating all conditions for a field/group
58
+ *
59
+ * Contains the resolved disabled/visible states and any setValue operation.
60
+ */
61
+ interface ConditionResult {
62
+ /**
63
+ * Resolved disabled state
64
+ * undefined = no condition set disabled
65
+ * true = at least one condition set disabled: true
66
+ */
67
+ disabled: boolean | undefined;
68
+ /**
69
+ * Resolved visible state
70
+ * undefined = no condition set visible
71
+ * true = all conditions with visible set it to true
72
+ * false = at least one condition set visible: false
73
+ */
74
+ visible: boolean | undefined;
75
+ /**
76
+ * Value to set (from last matching set/selectSet condition)
77
+ * undefined = no condition set a value
78
+ */
79
+ setValue: unknown | undefined;
80
+ /** Was any condition's disabled action evaluated */
81
+ hasDisabledCondition: boolean;
82
+ /** Was any condition's visible action evaluated */
83
+ hasVisibleCondition: boolean;
84
+ /** Was any condition's set/selectSet action evaluated */
85
+ hasSetCondition: boolean;
86
+ }
87
+
88
+ /**
89
+ * ValidationResult - Result from a validator function
90
+ *
91
+ * true | undefined = valid
92
+ * false = invalid (use generic/default message)
93
+ * string = invalid with custom message
94
+ * { type, message? } = invalid with type key for error message lookup
95
+ */
96
+ type ValidationResult = true | false | string | undefined | {
97
+ type: string;
98
+ message?: string;
99
+ };
100
+ /**
101
+ * ValidatorFunction - Inline validator signature
102
+ *
103
+ * @param value - The field value to validate
104
+ * @param formValues - All form values for cross-field validation
105
+ * @returns Validation result (sync or async)
106
+ */
107
+ type ValidatorFunction = (value: unknown, formValues: Record<string, unknown>) => ValidationResult | Promise<ValidationResult>;
108
+ /**
109
+ * ValidatorSpec - Validator specification
110
+ *
111
+ * Can be:
112
+ * - string: Named validator lookup from provider
113
+ * - function: Inline validator
114
+ * - array: Multiple validators run in sequence
115
+ */
116
+ type ValidatorSpec = string | ValidatorFunction | Array<string | ValidatorFunction>;
117
+ /**
118
+ * ValidatorFactory - Factory function for parameterized validators
119
+ *
120
+ * Example: minLength(5) returns a ValidatorFunction
121
+ */
122
+ type ValidatorFactory<TArgs = unknown> = (args: TArgs) => ValidatorFunction;
123
+ /**
124
+ * ValidatorsConfig - Named validators configuration
125
+ *
126
+ * Values can be direct validators or validator factories
127
+ */
128
+ interface ValidatorsConfig {
129
+ [name: string]: ValidatorFunction | ValidatorFactory;
130
+ }
131
+ /**
132
+ * ErrorMessagesConfig - Error message templates by type key
133
+ *
134
+ * Used to resolve error messages from validation result types
135
+ */
136
+ interface ErrorMessagesConfig {
137
+ [type: string]: string;
138
+ }
139
+
140
+ /**
141
+ * FieldError - Error object for a field
142
+ */
143
+ interface FieldError {
144
+ /** Error type identifier (e.g., 'required', 'pattern', 'validate') */
145
+ type: string;
146
+ /** Human-readable error message */
147
+ message?: string;
148
+ }
149
+ /**
150
+ * FieldState - Current state of a single field
151
+ *
152
+ * Used in expressions and condition evaluation.
153
+ */
154
+ interface FieldState {
155
+ /** Current field value */
156
+ value: unknown;
157
+ /** Has the field been touched (focused then blurred) */
158
+ isTouched: boolean;
159
+ /** Has the value changed from default */
160
+ isDirty: boolean;
161
+ /** Is async validation currently running */
162
+ isValidating: boolean;
163
+ /** Current validation error (if any) */
164
+ error?: FieldError;
165
+ /** Inverse of valid state for convenience */
166
+ invalid: boolean;
167
+ /** Map of subscriber field names watching this field */
168
+ watchers?: Record<string, boolean>;
169
+ }
170
+ /**
171
+ * FormState - Complete form state
172
+ *
173
+ * Available in all expression evaluations and conditions.
174
+ */
175
+ interface FormState {
176
+ /** Map of field names to their current states */
177
+ fields: Record<string, FieldState>;
178
+ /** Original record passed to Form (for expression access) */
179
+ record?: Record<string, unknown>;
180
+ /** Map of field names to their errors */
181
+ errors: Record<string, FieldError | undefined>;
182
+ /** Initial/default values for all fields */
183
+ defaultValues: Record<string, unknown>;
184
+ /** Map of touched field names */
185
+ touchedFields: Record<string, boolean>;
186
+ /** Map of dirty field names */
187
+ dirtyFields: Record<string, boolean>;
188
+ /** Has any field been modified */
189
+ isDirty: boolean;
190
+ /** Has any field been touched */
191
+ isTouched: boolean;
192
+ /** Are all fields valid */
193
+ isValid: boolean;
194
+ /** Is form submission in progress */
195
+ isSubmitting: boolean;
196
+ /**
197
+ * Field-level props context for expression evaluation
198
+ * Only available in field-level expressions (e.g., selectProps)
199
+ */
200
+ props?: {
201
+ /** Current field name - allows expressions like "props.name" */
202
+ name: string;
203
+ /** Additional field-specific props */
204
+ [key: string]: unknown;
205
+ };
206
+ }
207
+
208
+ /**
209
+ * SelectValue - The core polymorphic type for all select* properties
210
+ *
211
+ * CRITICAL: When using functions, automatic field inference is NOT possible.
212
+ * You MUST provide explicit `subscribesTo` to declare dependencies.
213
+ */
214
+ type SelectValue<TReturn = unknown> = string | SelectFunction<TReturn> | {
215
+ [key: string]: SelectValue;
216
+ } | SelectValue[];
217
+ /**
218
+ * SelectFunction - Callback signature for function-based select values
219
+ *
220
+ * @param formState - Current form state with fields, record, errors, etc.
221
+ * @param methods - Form methods (framework-specific, typed as unknown for core)
222
+ * @returns The computed value
223
+ *
224
+ * IMPORTANT: When using SelectFunction, you MUST specify subscribesTo
225
+ * because automatic dependency inference cannot analyze function bodies.
226
+ */
227
+ type SelectFunction<TReturn = unknown> = (formState: FormState, methods: unknown) => TReturn;
228
+ /**
229
+ * InputConfig - Configuration for an input component type
230
+ *
231
+ * This defines how a particular input type (e.g., textField, switch, autocomplete)
232
+ * behaves across all forms.
233
+ */
234
+ interface InputConfig<TValue = unknown> {
235
+ /** The React component to render */
236
+ component: unknown;
237
+ /** Default value for this input type (e.g., '' for text, false for switch) */
238
+ defaultValue: TValue;
239
+ /** Debounce milliseconds for validation/auto-save. false = immediate, number = delay */
240
+ debounce?: number | false;
241
+ /** Prop name for passing value to component (default: 'value') */
242
+ inputFieldProp?: string;
243
+ /** For complex values (objects), which property contains the actual value */
244
+ valueField?: string;
245
+ /** Transform field name for submission (e.g., 'client' → 'clientId') */
246
+ getSubmitField?: (fieldName: string) => string;
247
+ /** Transform user input to form value. String = named parser, function = inline */
248
+ parser?: string | ((value: unknown) => TValue);
249
+ /** Transform form value to display value. String = named formatter, function = inline */
250
+ formatter?: string | ((value: TValue) => unknown);
251
+ /** Type-level validation (runs after field-level validator) */
252
+ validator?: ValidatorSpec;
253
+ /** Template component wrapper for consistent styling */
254
+ template?: unknown;
255
+ /** Default props for this input type */
256
+ props?: Record<string, unknown>;
257
+ }
258
+ /**
259
+ * FieldConfig - Configuration for a specific field instance
260
+ *
261
+ * This defines field-level behavior including conditions, validation,
262
+ * and dynamic props.
263
+ */
264
+ interface FieldConfig {
265
+ /** Input type key (resolves to InputConfig) */
266
+ type?: string;
267
+ /** Human-readable label (static) */
268
+ label?: string;
269
+ /** Alias for label (legacy support) */
270
+ title?: string;
271
+ /** Static disabled state (can be overridden by conditions) */
272
+ disabled?: boolean;
273
+ /** Static hidden state (can be overridden by conditions) */
274
+ hidden?: boolean;
275
+ /** Display order for config-driven rendering (lower = earlier) */
276
+ order?: number;
277
+ /** Key to use when reading initial value from record (defaults to field name) */
278
+ recordKey?: string;
279
+ /** React Hook Form RegisterOptions (required, min, max, pattern, etc.) */
280
+ rules?: Record<string, unknown>;
281
+ /** Field-level validation (runs before type-level validator) */
282
+ validator?: ValidatorSpec;
283
+ /** Static props merged before selectProps */
284
+ props?: Record<string, unknown>;
285
+ /** Dynamic props evaluated against form state */
286
+ selectProps?: SelectValue<Record<string, unknown>>;
287
+ /** Condition descriptors for disabled/visible/setValue behaviors */
288
+ conditions?: ConditionDescriptor[];
289
+ /** Explicit field subscriptions (REQUIRED when using functions in selectProps) */
290
+ subscribesTo?: string[];
291
+ /** Pass field state to component (value, error, touched, etc.) */
292
+ provideState?: boolean;
293
+ /** Pass subscribed field states to component */
294
+ passSubscriptions?: boolean;
295
+ /** Prop name for subscribed states (default: 'state') */
296
+ passSubscriptionsAs?: string;
297
+ }
298
+ /**
299
+ * FormFieldsConfig - Map of field names to their configurations
300
+ */
301
+ type FormFieldsConfig = Record<string, FieldConfig>;
302
+ /**
303
+ * GroupConfig - Configuration for a FieldGroup
304
+ */
305
+ interface GroupConfig {
306
+ /** Conditions for group-level disabled/visible state */
307
+ conditions?: ConditionDescriptor[];
308
+ /** Explicit subscriptions for function-based conditions */
309
+ subscribesTo?: string[];
310
+ }
311
+ /**
312
+ * FormConfig - Form-level configuration
313
+ *
314
+ * Overrides provider settings and applies to all fields in the form.
315
+ */
316
+ interface FormConfig {
317
+ /**
318
+ * Input type overrides - can be object OR function
319
+ * Function form allows dynamic modification based on all available inputs
320
+ */
321
+ inputs?: Record<string, Partial<InputConfig>> | ((allInputs: Record<string, InputConfig>) => Record<string, Partial<InputConfig>>);
322
+ /** Named field groups with their conditions */
323
+ groups?: Record<string, GroupConfig>;
324
+ /** Static default props for all fields in this form */
325
+ defaultFieldProps?: Record<string, unknown>;
326
+ /** Dynamic default props evaluated per-field */
327
+ selectDefaultFieldProps?: SelectValue;
328
+ /** Static form title */
329
+ title?: string;
330
+ /** Dynamic form title evaluated against form state */
331
+ selectTitle?: SelectValue<string>;
332
+ }
333
+ /**
334
+ * FormalityProviderConfig - Global provider configuration
335
+ *
336
+ * Sets up input types, transformers, validators, and global defaults.
337
+ */
338
+ interface FormalityProviderConfig {
339
+ /** Input type definitions */
340
+ inputs: Record<string, InputConfig>;
341
+ /** Named formatters for value → display transformation */
342
+ formatters?: Record<string, (value: unknown) => unknown>;
343
+ /** Named parsers for input → value transformation */
344
+ parsers?: Record<string, (value: unknown) => unknown>;
345
+ /** Named validators and validator factories */
346
+ validators?: ValidatorsConfig;
347
+ /** Error message templates by type key */
348
+ errorMessages?: ErrorMessagesConfig;
349
+ /** Default template for all inputs */
350
+ defaultInputTemplate?: unknown;
351
+ /** Named templates for specific input types */
352
+ inputTemplates?: Record<string, unknown>;
353
+ /** Default prop name for passSubscriptions (default: 'state') */
354
+ defaultSubscriptionPropName?: string;
355
+ /** Static default props for all fields */
356
+ defaultFieldProps?: Record<string, unknown>;
357
+ /** Dynamic default props evaluated per-field */
358
+ selectDefaultFieldProps?: SelectValue;
359
+ }
360
+ /**
361
+ * InputTemplateProps - Props passed to input template components
362
+ */
363
+ interface InputTemplateProps {
364
+ /** The input component to render */
365
+ Field: unknown;
366
+ /** Merged props to pass to the component */
367
+ fieldProps: Record<string, unknown>;
368
+ /** Current field state */
369
+ fieldState: Record<string, unknown>;
370
+ /** Current form state */
371
+ formState: FormState;
372
+ }
373
+
374
+ /**
375
+ * Evaluation context type
376
+ */
377
+ type EvaluationContext = Record<string, unknown>;
378
+ /**
379
+ * Evaluate a string expression against a context object
380
+ *
381
+ * @param expr - Expression string (e.g., "client.id", "client && signed")
382
+ * @param context - Evaluation context with field values
383
+ * @returns The evaluated result
384
+ *
385
+ * @example
386
+ * evaluate("client.id", { client: { id: 5 } }) // → 5
387
+ * evaluate("client && signed", { client: { id: 5 }, signed: true }) // → true
388
+ * evaluate("signed ? 'Yes' : 'No'", { signed: true }) // → 'Yes'
389
+ */
390
+ declare function evaluate(expr: string, context: EvaluationContext): unknown;
391
+ /**
392
+ * Evaluate a SelectValue descriptor
393
+ *
394
+ * Handles string expressions, objects with nested expressions, and arrays.
395
+ * Does NOT handle functions - those must be handled by the framework adapter.
396
+ *
397
+ * @param descriptor - The SelectValue to evaluate
398
+ * @param context - Evaluation context
399
+ * @returns The evaluated result
400
+ */
401
+ declare function evaluateDescriptor(descriptor: unknown, context: EvaluationContext): unknown;
402
+ /**
403
+ * Clear the expression AST cache
404
+ * Useful for testing or memory management
405
+ */
406
+ declare function clearExpressionCache(): void;
407
+
408
+ /**
409
+ * Qualified prefixes that should NOT be auto-transformed
410
+ */
411
+ declare const QUALIFIED_PREFIXES: readonly ["fields", "record", "errors", "defaultValues", "touchedFields", "dirtyFields", "props"];
412
+ /**
413
+ * JavaScript keywords to skip during field inference
414
+ */
415
+ declare const KEYWORDS: readonly ["true", "false", "null", "undefined", "typeof", "instanceof", "new", "this", "if", "else", "return"];
416
+ /**
417
+ * Symbol to identify field state proxies for unwrapping in expressions
418
+ */
419
+ declare const FIELD_PROXY_MARKER: unique symbol;
420
+ /**
421
+ * Symbol to get the raw value from a field proxy
422
+ */
423
+ declare const FIELD_PROXY_VALUE: unique symbol;
424
+ /**
425
+ * Create a proxy for a field state that:
426
+ * - Returns field state properties (isTouched, isDirty, etc.) when accessed
427
+ * - Delegates unknown properties to value[prop] for object values
428
+ * - Coerces to the value for primitive operations
429
+ *
430
+ * This allows both:
431
+ * - `client` and `client.value` to return the same thing
432
+ * - `client.isTouched` to return the touched state
433
+ * - `client.id` to return value.id (for object values)
434
+ */
435
+ declare function createFieldStateProxy(fieldState: FieldState | {
436
+ value: unknown;
437
+ }): unknown;
438
+ /**
439
+ * Check if a value is a field state proxy
440
+ */
441
+ declare function isFieldProxy(value: unknown): boolean;
442
+ /**
443
+ * Unwrap a field proxy to get its primitive value for boolean/comparison contexts
444
+ */
445
+ declare function unwrapFieldProxy(value: unknown): unknown;
446
+ /**
447
+ * Build evaluation context for form-level expressions
448
+ *
449
+ * Implements Dual Context Mapping:
450
+ * - Provides field values at BOTH qualified (fields.client.value) AND unqualified (client) levels
451
+ * - Qualified paths take precedence on name collision
452
+ *
453
+ * @param fields - Map of field names to field states
454
+ * @param record - Original record passed to form
455
+ * @param errors - Map of field names to errors
456
+ * @param defaultValues - Initial/default values for fields
457
+ * @param touchedFields - Map of touched field names
458
+ * @param dirtyFields - Map of dirty field names
459
+ * @returns Evaluation context object
460
+ */
461
+ declare function buildFormContext(fields: Record<string, FieldState>, record?: Record<string, unknown>, errors?: Record<string, FieldError | undefined>, defaultValues?: Record<string, unknown>, touchedFields?: Record<string, boolean>, dirtyFields?: Record<string, boolean>): Record<string, unknown>;
462
+ /**
463
+ * Build evaluation context for field-level expressions
464
+ *
465
+ * Extends form context with field-specific props (including field name).
466
+ * This enables expressions like "props.name" to resolve to the current field name.
467
+ *
468
+ * @param formState - Complete form state
469
+ * @param fieldName - Current field name (added to props.name)
470
+ * @param additionalProps - Additional props to merge
471
+ * @returns Evaluation context object
472
+ */
473
+ declare function buildFieldContext(formState: FormState, fieldName: string, additionalProps?: Record<string, unknown>): Record<string, unknown>;
474
+ /**
475
+ * Field state input for building evaluation context
476
+ */
477
+ interface FieldStateForContext {
478
+ value: unknown;
479
+ isTouched?: boolean;
480
+ isDirty?: boolean;
481
+ isValidating?: boolean;
482
+ error?: unknown;
483
+ invalid?: boolean;
484
+ }
485
+ /**
486
+ * Build a minimal evaluation context from field values
487
+ *
488
+ * Used when you only have raw values (not full FieldState objects).
489
+ * Useful for condition evaluation with watched values.
490
+ *
491
+ * @param fieldValues - Map of field names to their current values
492
+ * @param record - Optional record for record.* access
493
+ * @param props - Optional props for props.* access
494
+ * @param fieldStates - Optional full field states with metadata (isTouched, isDirty, etc.)
495
+ * @returns Evaluation context object
496
+ */
497
+ declare function buildEvaluationContext(fieldValues: Record<string, unknown>, record?: Record<string, unknown>, props?: Record<string, unknown>, fieldStates?: Record<string, FieldStateForContext>): Record<string, unknown>;
498
+
499
+ /**
500
+ * Extract field names from an expression string
501
+ *
502
+ * Scans the expression for unqualified identifiers that represent field names.
503
+ * Skips JavaScript keywords. Qualified prefixes (fields, record, props, etc.)
504
+ * are only skipped when followed by a dot.
505
+ *
506
+ * @param expr - Expression string to analyze
507
+ * @returns Array of unique field names referenced
508
+ *
509
+ * @example
510
+ * inferFieldsFromExpression("client.id") // → ["client"]
511
+ * inferFieldsFromExpression("client && signed") // → ["client", "signed"]
512
+ * inferFieldsFromExpression("record.name") // → [] (qualified path)
513
+ * inferFieldsFromExpression("true && false") // → [] (keywords)
514
+ * inferFieldsFromExpression("fields === null") // → ["fields"] (not followed by dot)
515
+ */
516
+ declare function inferFieldsFromExpression(expr: string): string[];
517
+ /**
518
+ * Extract field dependencies from a SelectValue descriptor
519
+ *
520
+ * Recursively processes string expressions, objects, and arrays.
521
+ * Does NOT analyze function bodies - those require explicit subscribesTo.
522
+ *
523
+ * @param descriptor - SelectValue to analyze (string, object, array, or function)
524
+ * @returns Array of unique field names referenced
525
+ *
526
+ * @example
527
+ * inferFieldsFromDescriptor("client.id") // → ["client"]
528
+ * inferFieldsFromDescriptor({ queryParams: "client.id", filter: "signed" }) // → ["client", "signed"]
529
+ * inferFieldsFromDescriptor(["client", "contact.name"]) // → ["client", "contact"]
530
+ * inferFieldsFromDescriptor(() => {}) // → [] (functions need explicit subscribesTo)
531
+ */
532
+ declare function inferFieldsFromDescriptor(descriptor: unknown): string[];
533
+
534
+ /**
535
+ * Field state with metadata for expression evaluation
536
+ */
537
+ interface FieldStateInput {
538
+ value: unknown;
539
+ isTouched?: boolean;
540
+ isDirty?: boolean;
541
+ isValidating?: boolean;
542
+ error?: unknown;
543
+ invalid?: boolean;
544
+ }
545
+ /**
546
+ * Input for condition evaluation
547
+ */
548
+ interface EvaluateConditionsInput {
549
+ /** Array of conditions to evaluate */
550
+ conditions: ConditionDescriptor[];
551
+ /** Map of field names to their current values */
552
+ fieldValues: Record<string, unknown>;
553
+ /** Optional: Full field states with metadata (isTouched, isDirty, etc.) */
554
+ fieldStates?: Record<string, FieldStateInput>;
555
+ /** Original record passed to form */
556
+ record?: Record<string, unknown>;
557
+ /** Additional props for expression context */
558
+ props?: Record<string, unknown>;
559
+ }
560
+ /**
561
+ * Evaluate all conditions for a field/group
562
+ *
563
+ * Implements the condition evaluation rules:
564
+ * - disabled: OR logic (any true = true)
565
+ * - visible: AND logic (any false = false)
566
+ * - setValue: last matching condition wins
567
+ *
568
+ * @param input - Evaluation input with conditions and state
569
+ * @returns Result with resolved disabled, visible, and setValue states
570
+ *
571
+ * @example
572
+ * const result = evaluateConditions({
573
+ * conditions: [
574
+ * { when: 'signed', is: false, disabled: true },
575
+ * { when: 'archived', truthy: true, visible: false },
576
+ * ],
577
+ * fieldValues: { signed: false, archived: true },
578
+ * });
579
+ * // result.disabled === true (signed is false, matches first condition)
580
+ * // result.visible === false (archived is truthy, matches second condition)
581
+ */
582
+ declare function evaluateConditions(input: EvaluateConditionsInput): ConditionResult;
583
+ /**
584
+ * Evaluate a single condition's match (without applying actions)
585
+ *
586
+ * Useful for checking if a condition would match without computing results.
587
+ *
588
+ * @param condition - The condition to check
589
+ * @param fieldValues - Map of field names to their current values
590
+ * @param record - Optional record for expression context
591
+ * @param props - Optional props for expression context
592
+ * @returns true if the condition matches
593
+ */
594
+ declare function conditionMatches(condition: ConditionDescriptor, fieldValues: Record<string, unknown>, record?: Record<string, unknown>, props?: Record<string, unknown>): boolean;
595
+ /**
596
+ * Merge condition results from multiple sources (e.g., group + field)
597
+ *
598
+ * Follows the same cumulative logic:
599
+ * - disabled: OR logic
600
+ * - visible: AND logic
601
+ * - setValue: later source wins
602
+ *
603
+ * @param results - Array of condition results to merge
604
+ * @returns Merged result
605
+ */
606
+ declare function mergeConditionResults(results: ConditionResult[]): ConditionResult;
607
+ /**
608
+ * Extract field dependencies from an array of conditions
609
+ *
610
+ * Collects 'when' field references and infers dependencies from
611
+ * 'selectWhen' and 'selectSet' expressions. Used for automatic subscription.
612
+ *
613
+ * @param conditions - Array of condition descriptors
614
+ * @returns Array of unique field names referenced
615
+ *
616
+ * @example
617
+ * inferFieldsFromConditions([
618
+ * { when: 'client', disabled: true },
619
+ * { selectWhen: 'signed && approved', visible: true },
620
+ * ])
621
+ * // → ['client', 'signed', 'approved']
622
+ */
623
+ declare function inferFieldsFromConditions(conditions: ConditionDescriptor[]): string[];
624
+
625
+ /**
626
+ * Run a validator specification against a value
627
+ *
628
+ * Supports:
629
+ * - string: Named validator lookup
630
+ * - function: Inline validator
631
+ * - array: Multiple validators in sequence (short-circuits on first failure)
632
+ *
633
+ * @param spec - Validator specification
634
+ * @param value - Value to validate
635
+ * @param formValues - All form values for cross-field validation
636
+ * @param namedValidators - Named validators config from provider
637
+ * @returns Validation result (may be a Promise)
638
+ *
639
+ * @example
640
+ * // Named validator
641
+ * runValidator('required', '', {}, validators)
642
+ *
643
+ * // Inline validator
644
+ * runValidator((val) => val ? true : 'Required', '', {})
645
+ *
646
+ * // Multiple validators
647
+ * runValidator(['required', 'email'], '', {}, validators)
648
+ */
649
+ declare function runValidator(spec: ValidatorSpec, value: unknown, formValues: Record<string, unknown>, namedValidators?: ValidatorsConfig): Promise<ValidationResult>;
650
+ /**
651
+ * Run validator synchronously (for validators known to be sync)
652
+ *
653
+ * @param spec - Validator specification
654
+ * @param value - Value to validate
655
+ * @param formValues - All form values
656
+ * @param namedValidators - Named validators config
657
+ * @returns Validation result
658
+ */
659
+ declare function runValidatorSync(spec: ValidatorSpec, value: unknown, formValues: Record<string, unknown>, namedValidators?: ValidatorsConfig): ValidationResult;
660
+ /**
661
+ * Check if a validation result indicates success
662
+ *
663
+ * @param result - Validation result to check
664
+ * @returns true if valid, false if invalid
665
+ */
666
+ declare function isValid(result: ValidationResult): boolean;
667
+ /**
668
+ * Combine multiple validators into a single validator function
669
+ *
670
+ * @param validators - Array of validator specs to combine
671
+ * @param namedValidators - Named validators config
672
+ * @returns Combined validator function
673
+ */
674
+ declare function composeValidators(validators: ValidatorSpec[], namedValidators?: ValidatorsConfig): ValidatorFunction;
675
+ /**
676
+ * Create a required validator
677
+ *
678
+ * @returns Validator function that checks for non-empty values
679
+ */
680
+ declare function required(): ValidatorFunction;
681
+ /**
682
+ * Create a minLength validator factory
683
+ *
684
+ * @param length - Minimum length
685
+ * @returns Validator function
686
+ */
687
+ declare function minLength(length: number): ValidatorFunction;
688
+ /**
689
+ * Create a maxLength validator factory
690
+ *
691
+ * @param length - Maximum length
692
+ * @returns Validator function
693
+ */
694
+ declare function maxLength(length: number): ValidatorFunction;
695
+ /**
696
+ * Create a pattern validator factory
697
+ *
698
+ * @param pattern - RegExp pattern to match
699
+ * @param message - Custom error message
700
+ * @returns Validator function
701
+ */
702
+ declare function pattern(pattern: RegExp, message?: string): ValidatorFunction;
703
+
704
+ /**
705
+ * Resolve an error message from a validation result
706
+ *
707
+ * Handles all ValidationResult types:
708
+ * - true/undefined → undefined (valid, no message)
709
+ * - false → lookup 'invalid' in errorMessages or use default
710
+ * - string → use string directly as message
711
+ * - { type, message? } → use message or lookup type in errorMessages
712
+ *
713
+ * @param result - Validation result to resolve
714
+ * @param errorMessages - Error message templates by type key
715
+ * @returns Error message string or undefined if valid
716
+ *
717
+ * @example
718
+ * resolveErrorMessage(false, {}) // → 'Invalid value'
719
+ * resolveErrorMessage('Custom error', {}) // → 'Custom error'
720
+ * resolveErrorMessage({ type: 'required' }, { required: 'This is required' }) // → 'This is required'
721
+ */
722
+ declare function resolveErrorMessage(result: ValidationResult, errorMessages?: ErrorMessagesConfig): string | undefined;
723
+ /**
724
+ * Format a validation type key into a human-readable message
725
+ *
726
+ * @param type - Type key (e.g., 'required', 'minLength')
727
+ * @returns Formatted message
728
+ *
729
+ * @example
730
+ * formatTypeAsMessage('required') // → 'Required'
731
+ * formatTypeAsMessage('minLength') // → 'Min length'
732
+ * formatTypeAsMessage('maxLength') // → 'Max length'
733
+ */
734
+ declare function formatTypeAsMessage(type: string): string;
735
+ /**
736
+ * Create an error messages config with default messages
737
+ *
738
+ * @param overrides - Custom error messages to merge with defaults
739
+ * @returns Complete error messages config
740
+ */
741
+ declare function createErrorMessages(overrides?: ErrorMessagesConfig): ErrorMessagesConfig;
742
+ /**
743
+ * Extract error type from a validation result
744
+ *
745
+ * @param result - Validation result
746
+ * @returns Error type string or undefined if valid
747
+ */
748
+ declare function getErrorType(result: ValidationResult): string | undefined;
749
+ /**
750
+ * Create a validation error object
751
+ *
752
+ * @param type - Error type
753
+ * @param message - Error message (optional, will be resolved from errorMessages)
754
+ * @param errorMessages - Error messages config
755
+ * @returns Error object with type and message
756
+ */
757
+ declare function createValidationError(type: string, message?: string, errorMessages?: ErrorMessagesConfig): {
758
+ type: string;
759
+ message: string;
760
+ };
761
+
762
+ /**
763
+ * Parser function type
764
+ * Transforms user input into form value
765
+ */
766
+ type ParserFunction = (value: unknown) => unknown;
767
+ /**
768
+ * Formatter function type
769
+ * Transforms form value into display value
770
+ */
771
+ type FormatterFunction = (value: unknown) => unknown;
772
+ /**
773
+ * Parser specification - can be a named parser or inline function
774
+ */
775
+ type ParserSpec = string | ParserFunction;
776
+ /**
777
+ * Formatter specification - can be a named formatter or inline function
778
+ */
779
+ type FormatterSpec = string | FormatterFunction;
780
+ /**
781
+ * Named parsers configuration
782
+ */
783
+ type ParsersConfig = Record<string, ParserFunction>;
784
+ /**
785
+ * Named formatters configuration
786
+ */
787
+ type FormattersConfig = Record<string, FormatterFunction>;
788
+ /**
789
+ * Parse an input value using a parser specification
790
+ *
791
+ * Used on onChange to transform user input into form value.
792
+ *
793
+ * @param value - Raw input value from component
794
+ * @param parserSpec - Parser specification (name or function)
795
+ * @param namedParsers - Named parsers config from provider
796
+ * @returns Parsed value for form state
797
+ *
798
+ * @example
799
+ * // Named parser
800
+ * parse("42.69", "float", { float: v => parseFloat(String(v)) || 0 })
801
+ * // → 42.69
802
+ *
803
+ * // Inline parser
804
+ * parse("42.69", v => parseFloat(String(v)) || 0)
805
+ * // → 42.69
806
+ */
807
+ declare function parse(value: unknown, parserSpec?: ParserSpec, namedParsers?: ParsersConfig): unknown;
808
+ /**
809
+ * Format a form value using a formatter specification
810
+ *
811
+ * Used on render to transform form value into display value.
812
+ *
813
+ * @param value - Form state value
814
+ * @param formatterSpec - Formatter specification (name or function)
815
+ * @param namedFormatters - Named formatters config from provider
816
+ * @returns Formatted value for display
817
+ *
818
+ * @example
819
+ * // Named formatter
820
+ * format(42.69, "float", { float: v => typeof v === 'number' ? v.toFixed(2) : '' })
821
+ * // → "42.69"
822
+ *
823
+ * // Inline formatter
824
+ * format(42.69, v => typeof v === 'number' ? v.toFixed(2) : '')
825
+ * // → "42.69"
826
+ */
827
+ declare function format(value: unknown, formatterSpec?: FormatterSpec, namedFormatters?: FormattersConfig): unknown;
828
+ /**
829
+ * Extract the actual value from a complex object using valueField
830
+ *
831
+ * Used for autocomplete/select components that store objects but need to
832
+ * extract a specific property for submission.
833
+ *
834
+ * @param value - Complex value (object or primitive)
835
+ * @param valueField - Property name to extract
836
+ * @returns Extracted value or original value if not applicable
837
+ *
838
+ * @example
839
+ * extractValueField({ id: 5, name: "Acme" }, "id")
840
+ * // → 5
841
+ *
842
+ * extractValueField("simple", "id")
843
+ * // → "simple" (no extraction needed)
844
+ */
845
+ declare function extractValueField(value: unknown, valueField?: string): unknown;
846
+ /**
847
+ * Transform a field name for submission
848
+ *
849
+ * Used for fields that need a different name in the submitted data.
850
+ * Example: "client" field with getSubmitField → "clientId"
851
+ *
852
+ * @param fieldName - Original field name
853
+ * @param getSubmitField - Transform function
854
+ * @returns Transformed field name
855
+ *
856
+ * @example
857
+ * transformFieldName("client", name => `${name}Id`)
858
+ * // → "clientId"
859
+ */
860
+ declare function transformFieldName(fieldName: string, getSubmitField?: (name: string) => string): string;
861
+ /**
862
+ * Create a float parser with configurable behavior
863
+ *
864
+ * @param fallback - Value to return on parse failure (default: 0)
865
+ * @returns Parser function
866
+ */
867
+ declare function createFloatParser(fallback?: number): ParserFunction;
868
+ /**
869
+ * Create a float formatter with configurable precision
870
+ *
871
+ * @param precision - Number of decimal places (default: 2)
872
+ * @returns Formatter function
873
+ */
874
+ declare function createFloatFormatter(precision?: number): FormatterFunction;
875
+ /**
876
+ * Create an integer parser
877
+ *
878
+ * @param fallback - Value to return on parse failure (default: 0)
879
+ * @returns Parser function
880
+ */
881
+ declare function createIntParser(fallback?: number): ParserFunction;
882
+ /**
883
+ * Create a trim parser that removes whitespace
884
+ *
885
+ * @returns Parser function
886
+ */
887
+ declare function createTrimParser(): ParserFunction;
888
+ /**
889
+ * Create default parsers config
890
+ *
891
+ * @returns Standard parsers config
892
+ */
893
+ declare function createDefaultParsers(): ParsersConfig;
894
+ /**
895
+ * Create default formatters config
896
+ *
897
+ * @returns Standard formatters config
898
+ */
899
+ declare function createDefaultFormatters(): FormattersConfig;
900
+
901
+ /**
902
+ * Deep merge two objects, with the second object taking precedence
903
+ *
904
+ * @param base - Base object
905
+ * @param override - Override object (takes precedence)
906
+ * @returns Merged object
907
+ */
908
+ declare function deepMerge<T extends object>(base: T, override: Partial<T> | undefined): T;
909
+ /**
910
+ * Merge input configurations from multiple sources
911
+ *
912
+ * Priority order (highest to lowest):
913
+ * 1. Form-level inputs
914
+ * 2. Provider-level inputs
915
+ *
916
+ * @param providerInputs - Provider input configs
917
+ * @param formInputs - Form input configs (or function to transform)
918
+ * @returns Merged input configs
919
+ */
920
+ declare function mergeInputConfigs(providerInputs: Record<string, InputConfig>, formInputs?: FormConfig['inputs']): Record<string, InputConfig>;
921
+ /**
922
+ * Resolve input config for a specific type
923
+ *
924
+ * @param type - Input type key
925
+ * @param inputs - Merged input configs
926
+ * @param defaultType - Default type if specified type not found
927
+ * @returns Input config or undefined
928
+ */
929
+ declare function resolveInputConfig(type: string, inputs: Record<string, InputConfig>, defaultType?: string): InputConfig | undefined;
930
+ /**
931
+ * Resolve field type from multiple sources
932
+ *
933
+ * Priority order (highest to lowest):
934
+ * 1. Component prop type
935
+ * 2. Field config type
936
+ * 3. Default type ('textField')
937
+ *
938
+ * @param componentType - Type from component props
939
+ * @param fieldConfig - Field configuration
940
+ * @param defaultType - Default type
941
+ * @returns Resolved type
942
+ */
943
+ declare function resolveFieldType(componentType?: string, fieldConfig?: FieldConfig, defaultType?: string): string;
944
+ /**
945
+ * Merge static props from multiple configuration layers
946
+ *
947
+ * Priority order (highest to lowest):
948
+ * 1. Component props (from JSX)
949
+ * 2. Field config selectProps (evaluated separately)
950
+ * 3. Field config props
951
+ * 4. Input config props
952
+ * 5. Form-level selectDefaultFieldProps (evaluated separately)
953
+ * 6. Form-level defaultFieldProps
954
+ * 7. Provider-level selectDefaultFieldProps (evaluated separately)
955
+ * 8. Provider-level defaultFieldProps
956
+ *
957
+ * NOTE: This function only merges STATIC props. Dynamic props (selectProps,
958
+ * selectDefaultFieldProps) must be evaluated and merged separately.
959
+ *
960
+ * @param layers - Configuration layers from lowest to highest priority
961
+ * @returns Merged static props
962
+ */
963
+ declare function mergeStaticProps(...layers: Array<Record<string, unknown> | undefined>): Record<string, unknown>;
964
+ /**
965
+ * Merge all field props following the priority order
966
+ *
967
+ * This is the main props merging function that combines:
968
+ * - Static props from config layers
969
+ * - Evaluated dynamic props
970
+ * - Core field props
971
+ *
972
+ * @param options - All props sources
973
+ * @returns Final merged props
974
+ */
975
+ declare function mergeFieldProps(options: {
976
+ providerDefaultFieldProps?: Record<string, unknown>;
977
+ providerSelectDefaultFieldProps?: Record<string, unknown>;
978
+ formDefaultFieldProps?: Record<string, unknown>;
979
+ formSelectDefaultFieldProps?: Record<string, unknown>;
980
+ inputProps?: Record<string, unknown>;
981
+ fieldConfigProps?: Record<string, unknown>;
982
+ selectProps?: Record<string, unknown>;
983
+ componentProps?: Record<string, unknown>;
984
+ coreProps?: Record<string, unknown>;
985
+ }): Record<string, unknown>;
986
+ /**
987
+ * Create a merged configuration context
988
+ *
989
+ * Combines provider and form configs into a single context object
990
+ * for use during field rendering.
991
+ *
992
+ * @param providerConfig - Provider configuration
993
+ * @param formConfig - Form configuration
994
+ * @returns Merged configuration context
995
+ */
996
+ declare function createConfigContext(providerConfig: FormalityProviderConfig, formConfig?: FormConfig): {
997
+ inputs: Record<string, InputConfig>;
998
+ formatters: Record<string, (value: unknown) => unknown>;
999
+ parsers: Record<string, (value: unknown) => unknown>;
1000
+ validators: Record<string, unknown>;
1001
+ errorMessages: Record<string, string>;
1002
+ defaultFieldProps: Record<string, unknown>;
1003
+ selectDefaultFieldProps: unknown;
1004
+ };
1005
+
1006
+ /**
1007
+ * Resolve the initial value for a field
1008
+ *
1009
+ * Priority order (highest to lowest):
1010
+ * 1. defaultValues[fieldName] (from Form props)
1011
+ * 2. record[recordKey] (using recordKey if specified, else fieldName)
1012
+ * 3. inputConfig.defaultValue (from input type definition)
1013
+ *
1014
+ * @param fieldName - Field name
1015
+ * @param fieldConfig - Field configuration
1016
+ * @param inputConfig - Input type configuration
1017
+ * @param record - Record data passed to form
1018
+ * @param defaultValues - Default values passed to form
1019
+ * @returns Resolved initial value
1020
+ *
1021
+ * @example
1022
+ * // Field with recordKey mapping
1023
+ * resolveInitialValue(
1024
+ * 'client',
1025
+ * { recordKey: 'selectedClient' },
1026
+ * { defaultValue: null },
1027
+ * { selectedClient: { id: 5 } },
1028
+ * {}
1029
+ * )
1030
+ * // → { id: 5 }
1031
+ *
1032
+ * // Field with explicit defaultValue
1033
+ * resolveInitialValue(
1034
+ * 'status',
1035
+ * {},
1036
+ * { defaultValue: 'pending' },
1037
+ * {},
1038
+ * { status: 'active' }
1039
+ * )
1040
+ * // → 'active' (defaultValues takes precedence)
1041
+ */
1042
+ declare function resolveInitialValue(fieldName: string, fieldConfig?: FieldConfig, inputConfig?: InputConfig, record?: Record<string, unknown>, defaultValues?: Record<string, unknown>): unknown;
1043
+ /**
1044
+ * Resolve initial values for all fields in a configuration
1045
+ *
1046
+ * @param fieldConfigs - Map of field names to configurations
1047
+ * @param inputs - Map of input types to configurations
1048
+ * @param record - Record data passed to form
1049
+ * @param defaultValues - Default values passed to form
1050
+ * @returns Map of field names to initial values
1051
+ */
1052
+ declare function resolveAllInitialValues(fieldConfigs: Record<string, FieldConfig>, inputs: Record<string, InputConfig>, record?: Record<string, unknown>, defaultValues?: Record<string, unknown>): Record<string, unknown>;
1053
+ /**
1054
+ * Check if a value is considered "empty" for default value purposes
1055
+ *
1056
+ * @param value - Value to check
1057
+ * @returns true if value is empty
1058
+ */
1059
+ declare function isEmptyValue(value: unknown): boolean;
1060
+ /**
1061
+ * Get the default value for an input type
1062
+ *
1063
+ * Falls back to common defaults based on type name if not specified.
1064
+ *
1065
+ * @param inputConfig - Input configuration
1066
+ * @param typeName - Input type name (for fallback logic)
1067
+ * @returns Default value
1068
+ */
1069
+ declare function getInputDefaultValue(inputConfig?: InputConfig, typeName?: string): unknown;
1070
+ /**
1071
+ * Merge record data with form default values
1072
+ *
1073
+ * Record values take precedence over defaults for non-empty values.
1074
+ *
1075
+ * @param record - Record data (may have partial data)
1076
+ * @param defaults - Default values
1077
+ * @returns Merged values
1078
+ */
1079
+ declare function mergeRecordWithDefaults(record?: Record<string, unknown>, defaults?: Record<string, unknown>): Record<string, unknown>;
1080
+
1081
+ /**
1082
+ * Convert a camelCase or PascalCase field name to a human-readable label
1083
+ *
1084
+ * @param fieldName - The field name to humanize
1085
+ * @returns Human-readable label
1086
+ *
1087
+ * @example
1088
+ * humanizeLabel("clientContact") // → "Client Contact"
1089
+ * humanizeLabel("minGrossMarginPercent") // → "Min Gross Margin Percent"
1090
+ * humanizeLabel("CCIP/CCOP") // → "CCIP/CCOP" (preserved)
1091
+ * humanizeLabel("firstName") // → "First Name"
1092
+ * humanizeLabel("HTMLParser") // → "Html Parser"
1093
+ * humanizeLabel("userID") // → "User Id"
1094
+ */
1095
+ declare function humanizeLabel(fieldName: string): string;
1096
+ /**
1097
+ * Resolve the label for a field
1098
+ *
1099
+ * Priority order (highest to lowest):
1100
+ * 1. Component prop (label from JSX props)
1101
+ * 2. Field config props.label
1102
+ * 3. Evaluated selectProps.label
1103
+ * 4. Field config label
1104
+ * 5. Field config title (legacy alias)
1105
+ * 6. Auto-generated from field name
1106
+ *
1107
+ * @param fieldName - Field name
1108
+ * @param fieldConfig - Field configuration
1109
+ * @param evaluatedSelectProps - Pre-evaluated selectProps
1110
+ * @param componentProps - Props from JSX
1111
+ * @returns Resolved label string
1112
+ */
1113
+ declare function resolveLabel(fieldName: string, fieldConfig?: FieldConfig, evaluatedSelectProps?: Record<string, unknown>, componentProps?: Record<string, unknown>): string;
1114
+ /**
1115
+ * Resolve the title for a form
1116
+ *
1117
+ * @param formTitle - Static form title
1118
+ * @param evaluatedSelectTitle - Pre-evaluated selectTitle
1119
+ * @returns Resolved title string or undefined
1120
+ */
1121
+ declare function resolveFormTitle(formTitle?: string, evaluatedSelectTitle?: unknown): string | undefined;
1122
+ /**
1123
+ * Check if a label is auto-generated (matches the humanized field name)
1124
+ *
1125
+ * @param fieldName - Field name
1126
+ * @param label - Current label
1127
+ * @returns true if label appears to be auto-generated
1128
+ */
1129
+ declare function isAutoGeneratedLabel(fieldName: string, label: string): boolean;
1130
+ /**
1131
+ * Create a label with a unit suffix
1132
+ *
1133
+ * @param baseLabel - Base label text
1134
+ * @param unit - Unit to append (e.g., '%', '$', 'kg')
1135
+ * @returns Label with unit in parentheses
1136
+ *
1137
+ * @example
1138
+ * createLabelWithUnit("Min Gross Margin", "%") // → "Min Gross Margin (%)"
1139
+ * createLabelWithUnit("Weight", "kg") // → "Weight (kg)"
1140
+ */
1141
+ declare function createLabelWithUnit(baseLabel: string, unit: string): string;
1142
+ /**
1143
+ * Extract the base label and unit from a label with unit suffix
1144
+ *
1145
+ * @param label - Label potentially containing unit
1146
+ * @returns Object with base label and optional unit
1147
+ *
1148
+ * @example
1149
+ * parseLabelWithUnit("Min Gross Margin (%)") // → { base: "Min Gross Margin", unit: "%" }
1150
+ * parseLabelWithUnit("Client Contact") // → { base: "Client Contact", unit: undefined }
1151
+ */
1152
+ declare function parseLabelWithUnit(label: string): {
1153
+ base: string;
1154
+ unit?: string;
1155
+ };
1156
+ /**
1157
+ * Sort fields by their order property
1158
+ *
1159
+ * @param fieldNames - Array of field names
1160
+ * @param fieldConfigs - Map of field configs
1161
+ * @returns Sorted array of field names
1162
+ */
1163
+ declare function sortFieldsByOrder(fieldNames: string[], fieldConfigs: Record<string, FieldConfig>): string[];
1164
+ /**
1165
+ * Get fields that are not in the declared set
1166
+ *
1167
+ * @param allFields - All field names from config
1168
+ * @param declaredFields - Set of explicitly declared field names
1169
+ * @returns Array of unused field names
1170
+ */
1171
+ declare function getUnusedFields(allFields: string[], declaredFields: Set<string>): string[];
1172
+ /**
1173
+ * Get ordered unused fields
1174
+ *
1175
+ * @param allFields - All field names from config
1176
+ * @param declaredFields - Set of explicitly declared field names
1177
+ * @param fieldConfigs - Map of field configs
1178
+ * @returns Sorted array of unused field names
1179
+ */
1180
+ declare function getOrderedUnusedFields(allFields: string[], declaredFields: Set<string>, fieldConfigs: Record<string, FieldConfig>): string[];
1181
+
1182
+ export { type ConditionDescriptor, type ConditionResult, type ErrorMessagesConfig, type EvaluateConditionsInput, type EvaluationContext, FIELD_PROXY_MARKER, FIELD_PROXY_VALUE, type FieldConfig, type FieldError, type FieldState, type FieldStateInput, type FormConfig, type FormFieldsConfig, type FormState, type FormalityProviderConfig, type FormatterFunction, type FormatterSpec, type FormattersConfig, type GroupConfig, type InputConfig, type InputTemplateProps, KEYWORDS, type ParserFunction, type ParserSpec, type ParsersConfig, QUALIFIED_PREFIXES, type SelectFunction, type SelectValue, type ValidationResult, type ValidatorFactory, type ValidatorFunction, type ValidatorSpec, type ValidatorsConfig, buildEvaluationContext, buildFieldContext, buildFormContext, clearExpressionCache, composeValidators, conditionMatches, createConfigContext, createDefaultFormatters, createDefaultParsers, createErrorMessages, createFieldStateProxy, createFloatFormatter, createFloatParser, createIntParser, createLabelWithUnit, createTrimParser, createValidationError, deepMerge, evaluate, evaluateConditions, evaluateDescriptor, extractValueField, format, formatTypeAsMessage, getErrorType, getInputDefaultValue, getOrderedUnusedFields, getUnusedFields, humanizeLabel, inferFieldsFromConditions, inferFieldsFromDescriptor, inferFieldsFromExpression, isAutoGeneratedLabel, isEmptyValue, isFieldProxy, isValid, maxLength, mergeConditionResults, mergeFieldProps, mergeInputConfigs, mergeRecordWithDefaults, mergeStaticProps, minLength, parse, parseLabelWithUnit, pattern, required, resolveAllInitialValues, resolveErrorMessage, resolveFieldType, resolveFormTitle, resolveInitialValue, resolveInputConfig, resolveLabel, runValidator, runValidatorSync, sortFieldsByOrder, transformFieldName, unwrapFieldProxy };