finform-react-builder 1.13.0 → 1.14.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>;
@@ -4,6 +4,9 @@ export type FinDateFieldProps = TextFieldProps & {
4
4
  label?: React.ReactNode;
5
5
  labelPosition?: 'inner' | 'top' | 'none';
6
6
  labelVariant?: 'caption' | 'body2' | 'subtitle2' | 'h6';
7
+ inputTestId?: string;
8
+ labelTestId?: string;
9
+ errorTestId?: string;
7
10
  [key: string]: any;
8
11
  };
9
12
  export declare const FinDateField: React.FC<FinDateFieldProps>;
@@ -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;
@@ -341,6 +341,18 @@ export interface DragDropListField extends Omit<BaseField, 'helperText'> {
341
341
  sx?: any;
342
342
  }
343
343
  export type FieldConfig = TextField | NumberField | SelectField | CheckboxField | CheckboxGroupField | ToggleField | RadioField | SwitchField | AutocompleteField | DateField | ImageField | TitleField | SectionField | ComponentField | FinUiHeaderField | TabsField | GridField | ListCardsField | DragDropListField;
344
+ export type AutomationFieldConfig = FieldConfig & {
345
+ testId?: string;
346
+ automation?: {
347
+ skip?: boolean;
348
+ fieldTestId?: string;
349
+ inputTestId?: string;
350
+ labelTestId?: string;
351
+ errorTestId?: string;
352
+ sampleValue?: unknown;
353
+ invalidValue?: unknown;
354
+ };
355
+ };
344
356
  export interface FormButton {
345
357
  text: string;
346
358
  color?: string;
@@ -408,6 +420,8 @@ export interface FinFormProps {
408
420
  showStepTitles?: boolean;
409
421
  stepTitles?: string[];
410
422
  };
423
+ /** Prefix for stable data-testid attributes on generated form controls (e.g. "client-profile"). */
424
+ testIdPrefix?: string;
411
425
  }
412
426
  export interface FieldRendererProps {
413
427
  field: FieldConfig;
@@ -417,6 +431,13 @@ export interface FieldRendererProps {
417
431
  apiHeaders?: Record<string, string>;
418
432
  formData?: Record<string, any>;
419
433
  setValue?: (name: string, value: any, options?: any) => void;
434
+ testIdPrefix?: string;
435
+ }
436
+ export interface FinInputTestIdProps {
437
+ inputTestId?: string;
438
+ labelTestId?: string;
439
+ errorTestId?: string;
440
+ optionTestId?: (optionValue: string | number) => string;
420
441
  }
421
442
  export interface StepNavigationProps {
422
443
  currentStep: number;