finform-react-builder 1.13.1 → 1.15.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.
@@ -3,6 +3,7 @@ import { FormButton } from './types';
3
3
  interface CustomButtonsProps {
4
4
  buttons: FormButton[];
5
5
  disabled?: boolean;
6
+ testIdPrefix?: string;
6
7
  }
7
8
  export declare const CustomButtons: React.FC<CustomButtonsProps>;
8
9
  export {};
@@ -6,4 +6,5 @@ export { CustomButtons } from './CustomButtons';
6
6
  export { generateSchema } from './generateSchema';
7
7
  export { fetchApiData, hasApiConfig, getApiConfig, shouldShowField, useApiData } from './apiUtils';
8
8
  export * from './inputs';
9
- export type { FieldConfig, ValidationRule, FormButton, ButtonGroup, FormTitle, FormTheme, FinFormProps, ApiConfig, } from './types';
9
+ export type { FieldConfig, AutomationFieldConfig, ValidationRule, FormButton, ButtonGroup, FormTitle, FormTheme, FinFormProps, ApiConfig, } from './types';
10
+ export { buildFinformTestIds, resolveFieldTestIds } from './testIds';
@@ -21,5 +21,9 @@ export interface FinAutocompleteProps {
21
21
  onOpen?: () => void;
22
22
  noOptionsText?: string;
23
23
  sx?: any;
24
+ inputTestId?: string;
25
+ labelTestId?: string;
26
+ errorTestId?: string;
27
+ optionTestId?: (optionValue: string | number) => string;
24
28
  }
25
29
  export declare const FinAutocomplete: React.FC<FinAutocompleteProps>;
@@ -5,5 +5,7 @@ export interface FinCheckboxProps {
5
5
  disabled?: boolean;
6
6
  onChange: (checked: boolean) => void;
7
7
  sx?: any;
8
+ inputTestId?: string;
9
+ labelTestId?: string;
8
10
  }
9
11
  export declare const FinCheckbox: React.FC<FinCheckboxProps>;
@@ -1,9 +1,36 @@
1
1
  import { default as React } from 'react';
2
- import { TextFieldProps } from '@mui/material';
3
- export type FinDateFieldProps = TextFieldProps & {
2
+ export declare const DEFAULT_DATE_FORMAT = "DD-MM-YYYY";
3
+ /** Map dayjs format tokens to a human placeholder (DD/MM/YYYY, etc.). */
4
+ export declare function dateFormatToPlaceholder(format: string): string;
5
+ export type FinDateFieldProps = {
6
+ value?: string | null;
7
+ onChange?: (value: string) => void;
8
+ onBlur?: () => void;
9
+ name?: string;
10
+ /** Dayjs format for typed input + display (e.g. DD-MM-YYYY). */
11
+ dateFormat?: string;
12
+ minDate?: string;
13
+ maxDate?: string;
4
14
  label?: React.ReactNode;
5
15
  labelPosition?: 'inner' | 'top' | 'none';
6
16
  labelVariant?: 'caption' | 'body2' | 'subtitle2' | 'h6';
7
- [key: string]: any;
17
+ disabled?: boolean;
18
+ error?: boolean;
19
+ helperText?: React.ReactNode;
20
+ fullWidth?: boolean;
21
+ size?: 'small' | 'medium';
22
+ placeholder?: string;
23
+ sx?: any;
24
+ inputTestId?: string;
25
+ labelTestId?: string;
26
+ errorTestId?: string;
27
+ /** @deprecated Use minDate / maxDate props. Kept for FieldRenderer backward compat. */
28
+ inputProps?: {
29
+ min?: string;
30
+ max?: string;
31
+ [key: string]: unknown;
32
+ };
33
+ id?: string;
34
+ required?: boolean;
8
35
  };
9
36
  export declare const FinDateField: React.FC<FinDateFieldProps>;
@@ -45,6 +45,8 @@ export type GridColumn = {
45
45
  };
46
46
  sx?: any;
47
47
  cellSx?: any;
48
+ /** Per-column dayjs format override for date columns. */
49
+ dateFormat?: string;
48
50
  };
49
51
  export interface FinEditableGridProps {
50
52
  name: string;
@@ -68,6 +70,8 @@ export interface FinEditableGridProps {
68
70
  setValue?: (name: string, value: any, options?: any) => void;
69
71
  rowSelectionMode?: "single" | "multi";
70
72
  rowSelectionKey?: string;
73
+ /** Form-level dayjs date format for date columns. */
74
+ dateFormat?: string;
71
75
  }
72
76
  export declare const FinEditableGrid: React.FC<FinEditableGridProps>;
73
77
  export default FinEditableGrid;
@@ -12,5 +12,9 @@ export interface FinSelectProps extends Omit<SelectProps, 'onChange'> {
12
12
  onChange?: SelectProps['onChange'];
13
13
  labelVariant?: 'caption' | 'body2' | 'subtitle2' | 'h6';
14
14
  placeholder?: string;
15
+ inputTestId?: string;
16
+ labelTestId?: string;
17
+ errorTestId?: string;
18
+ optionTestId?: (optionValue: string | number) => string;
15
19
  }
16
20
  export declare const FinSelect: React.FC<FinSelectProps>;
@@ -11,5 +11,8 @@ export type FinTextFieldProps = TextFieldProps & {
11
11
  endorsementRadius?: number | string;
12
12
  endorsementHeight?: number;
13
13
  endorsementPaddingX?: number;
14
+ inputTestId?: string;
15
+ labelTestId?: string;
16
+ errorTestId?: string;
14
17
  };
15
18
  export declare const FinTextField: React.FC<FinTextFieldProps>;
@@ -4,5 +4,8 @@ export type FinTextareaProps = TextFieldProps & {
4
4
  labelText?: string;
5
5
  labelVariant?: 'caption' | 'body2' | 'subtitle2' | 'h6';
6
6
  hasError?: boolean;
7
+ inputTestId?: string;
8
+ labelTestId?: string;
9
+ errorTestId?: string;
7
10
  };
8
11
  export declare const FinTextarea: React.FC<FinTextareaProps>;
@@ -0,0 +1,24 @@
1
+ import { FieldConfig } from './types';
2
+ export interface FinformFieldTestIds {
3
+ field: string;
4
+ label: string;
5
+ input: string;
6
+ error: string;
7
+ section: string;
8
+ upload: string;
9
+ preview: string;
10
+ remove: string;
11
+ replace: string;
12
+ option: (optionValue: string | number) => string;
13
+ submit: string;
14
+ cancel: string;
15
+ }
16
+ export declare function buildFinformTestIds(prefix: string, fieldName: string): FinformFieldTestIds;
17
+ export type ResolvedFieldTestIds = Omit<FinformFieldTestIds, 'submit' | 'cancel' | 'option'> & {
18
+ option: (optionValue: string | number) => string;
19
+ };
20
+ export declare function resolveFieldTestIds(prefix: string | undefined, field: FieldConfig): ResolvedFieldTestIds | null;
21
+ export declare function resolveFormButtonTestIds(prefix: string | undefined): {
22
+ submit: string;
23
+ cancel: string;
24
+ } | null;
@@ -153,6 +153,8 @@ export interface DateField extends BaseField {
153
153
  type: 'date';
154
154
  minDate?: string;
155
155
  maxDate?: string;
156
+ /** Per-field dayjs format override (e.g. DD-MM-YYYY). Falls back to FinForm dateFormat. */
157
+ dateFormat?: string;
156
158
  }
157
159
  export interface ImageField extends BaseField {
158
160
  type: 'image';
@@ -341,6 +343,18 @@ export interface DragDropListField extends Omit<BaseField, 'helperText'> {
341
343
  sx?: any;
342
344
  }
343
345
  export type FieldConfig = TextField | NumberField | SelectField | CheckboxField | CheckboxGroupField | ToggleField | RadioField | SwitchField | AutocompleteField | DateField | ImageField | TitleField | SectionField | ComponentField | FinUiHeaderField | TabsField | GridField | ListCardsField | DragDropListField;
346
+ export type AutomationFieldConfig = FieldConfig & {
347
+ testId?: string;
348
+ automation?: {
349
+ skip?: boolean;
350
+ fieldTestId?: string;
351
+ inputTestId?: string;
352
+ labelTestId?: string;
353
+ errorTestId?: string;
354
+ sampleValue?: unknown;
355
+ invalidValue?: unknown;
356
+ };
357
+ };
344
358
  export interface FormButton {
345
359
  text: string;
346
360
  color?: string;
@@ -408,6 +422,13 @@ export interface FinFormProps {
408
422
  showStepTitles?: boolean;
409
423
  stepTitles?: string[];
410
424
  };
425
+ /** Prefix for stable data-testid attributes on generated form controls (e.g. "client-profile"). */
426
+ testIdPrefix?: string;
427
+ /**
428
+ * Dayjs format for all date fields (e.g. DD-MM-YYYY, MM-DD-YYYY, YYYY-MM-DD).
429
+ * Host app should map company regional settings to this value.
430
+ */
431
+ dateFormat?: string;
411
432
  }
412
433
  export interface FieldRendererProps {
413
434
  field: FieldConfig;
@@ -417,6 +438,15 @@ export interface FieldRendererProps {
417
438
  apiHeaders?: Record<string, string>;
418
439
  formData?: Record<string, any>;
419
440
  setValue?: (name: string, value: any, options?: any) => void;
441
+ testIdPrefix?: string;
442
+ /** Form-level dayjs date format inherited by date fields. */
443
+ dateFormat?: string;
444
+ }
445
+ export interface FinInputTestIdProps {
446
+ inputTestId?: string;
447
+ labelTestId?: string;
448
+ errorTestId?: string;
449
+ optionTestId?: (optionValue: string | number) => string;
420
450
  }
421
451
  export interface StepNavigationProps {
422
452
  currentStep: number;