@itcase/forms 1.1.27 → 1.1.29

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.
@@ -1,7 +1,7 @@
1
1
  'use strict';
2
2
 
3
3
  var libphonenumberJs = require('libphonenumber-js');
4
- var React$1 = require('react');
4
+ var React = require('react');
5
5
  var finalForm = require('final-form');
6
6
  var reactFinalForm = require('react-final-form');
7
7
  var clsx = require('clsx');
@@ -40,7 +40,7 @@ var createDecorator = require('final-form-focus');
40
40
 
41
41
  function _interopDefault (e) { return e && e.__esModule ? e : { default: e }; }
42
42
 
43
- var React__default = /*#__PURE__*/_interopDefault(React$1);
43
+ var React__default = /*#__PURE__*/_interopDefault(React);
44
44
  var clsx__default = /*#__PURE__*/_interopDefault(clsx);
45
45
  var camelCase__default = /*#__PURE__*/_interopDefault(camelCase);
46
46
  var snakeCase__default = /*#__PURE__*/_interopDefault(snakeCase);
@@ -124,7 +124,7 @@ const makeValidate = schema => {
124
124
  };
125
125
  };
126
126
  function useYupValidationSchema(schema, language) {
127
- const validate = React$1.useMemo(() => schema && makeValidate(schema), [schema, language]);
127
+ const validate = React.useMemo(() => schema && makeValidate(schema), [schema, language]);
128
128
  return validate;
129
129
  }
130
130
 
@@ -143,7 +143,7 @@ function useFieldValidationState(props) {
143
143
  const successKey = 'success';
144
144
 
145
145
  // Determines if the field is in an error state based on various conditions.
146
- const isErrorState = React$1.useMemo(() => {
146
+ const isErrorState = React.useMemo(() => {
147
147
  if (fieldProps.showErrorsOnSubmit) {
148
148
  return Boolean(meta.submitFailed && meta.touched && (meta.error || submitError));
149
149
  } else {
@@ -152,12 +152,12 @@ function useFieldValidationState(props) {
152
152
  }, [fieldProps.showErrorsOnSubmit, meta.submitFailed, meta.touched, meta.error, submitError]);
153
153
 
154
154
  // Determines if the field's input state is valid
155
- const isValidState = React$1.useMemo(() => {
155
+ const isValidState = React.useMemo(() => {
156
156
  const hasValue = Array.isArray(input?.value) ? input?.value.length : input?.value;
157
157
  const isModifiedAfterSubmit = meta.modifiedSinceLastSubmit && !meta.error && submitError;
158
158
  return Boolean(hasValue && (meta.valid || isModifiedAfterSubmit));
159
159
  }, [input?.value, meta.valid, meta.error, submitError, meta.modifiedSinceLastSubmit]);
160
- const errorMessage = React$1.useMemo(() => {
160
+ const errorMessage = React.useMemo(() => {
161
161
  // If final-form field has error in "meta" render-property.
162
162
  // If field not modified after last form submit - use submit error
163
163
  const error = meta.error || submitError || false;
@@ -190,12 +190,12 @@ function useFieldValidationState(props) {
190
190
  // looks at what props were in initialProps, if they are there then changes
191
191
  function useValidationAppearanceInputProps(props) {
192
192
  const {
193
- validationStateKey,
194
- inputProps
193
+ inputProps,
194
+ validationStateKey
195
195
  } = props;
196
196
 
197
197
  // TODO: need to add props that can change during errors in this field
198
- const validationAppearanceInputProps = React$1.useMemo(() => {
198
+ const validationAppearanceInputProps = React.useMemo(() => {
199
199
  // const resultAppearanceProps = {
200
200
  // messageTextColor: props.errorMessageTextColor,
201
201
  // messageTextSize: props.errorMessageTextSize,
@@ -205,7 +205,7 @@ function useValidationAppearanceInputProps(props) {
205
205
  // }
206
206
  const updatedInputProps = {};
207
207
  if (validationStateKey) {
208
- Object.entries(inputProps).forEach(([propKey, propValue]) => {
208
+ Object.entries(inputProps || {}).forEach(([propKey, propValue]) => {
209
209
  // Convert the input property key to "snake_case" format.
210
210
  // e.g. "requiredBorderColor" -> "required_border_color".
211
211
  const propKeySnake = snakeCase__default.default(propKey);
@@ -314,8 +314,8 @@ function FieldWrapperBase(props) {
314
314
  isValidState,
315
315
  children
316
316
  } = props;
317
- const formFieldClass = React$1.useMemo(() => clsx__default.default(className, isValidState && 'form__item_state_success', isRequired && 'form__item_state_required', isDisabled && 'form__item_state_disabled', metaActive && 'form__item_state_focus', inputValue && 'form__item_state_filled', isErrorState && `form__item_state_${errorKey}`), [className, isErrorState, isValidState, isRequired, metaActive, inputValue, isDisabled, metaError]);
318
- const fieldClass = React$1.useMemo(() => clsx__default.default(fieldClassName, isValidState && `${fieldClassName}_state_success`, metaActive && `${fieldClassName}_state_focus`, inputValue && `${fieldClassName}_state_filled`, isDisabled && `${fieldClassName}_state_disabled`, isErrorState && `${fieldClassName}_state_${errorKey}`), [fieldClassName, isErrorState, isValidState, metaActive, inputValue, isDisabled, metaError]);
317
+ const formFieldClass = React.useMemo(() => clsx__default.default(className, isValidState && 'form__item_state_success', isRequired && 'form__item_state_required', isDisabled && 'form__item_state_disabled', metaActive && 'form__item_state_focus', inputValue && 'form__item_state_filled', isErrorState && `form__item_state_${errorKey}`), [className, isErrorState, isValidState, isRequired, metaActive, inputValue, isDisabled, metaError]);
318
+ const fieldClass = React.useMemo(() => clsx__default.default(fieldClassName, isValidState && `${fieldClassName}_state_success`, metaActive && `${fieldClassName}_state_focus`, inputValue && `${fieldClassName}_state_filled`, isDisabled && `${fieldClassName}_state_disabled`, isErrorState && `${fieldClassName}_state_${errorKey}`), [fieldClassName, isErrorState, isValidState, metaActive, inputValue, isDisabled, metaError]);
319
319
  const sizeClass = useDeviceTargetClass.useDeviceTargetClass(props, {
320
320
  prefix: 'form-field_size_',
321
321
  propsKey: 'size'
@@ -413,7 +413,7 @@ function FieldWrapper(props) {
413
413
  change
414
414
  } = reactFinalForm.useForm(); // , mutators
415
415
 
416
- React$1.useEffect(() => {
416
+ React.useEffect(() => {
417
417
  return () => {
418
418
  change(inputName, undefined);
419
419
  };
@@ -465,10 +465,10 @@ const FileInputDropzone = /*#__PURE__*/React__default.default.memo(function File
465
465
  const {
466
466
  change
467
467
  } = reactFinalForm.useForm();
468
- const [fileError, setFileError] = React$1.useState('');
469
- const [fileIsLoading, setFileIsLoading] = React$1.useState(false);
470
- const filesList = React$1.useMemo(() => inputValue ? castArray__default.default(inputValue) : [], [inputValue]);
471
- const changeFormState = React$1.useCallback(newFiles => {
468
+ const [fileError, setFileError] = React.useState('');
469
+ const [fileIsLoading, setFileIsLoading] = React.useState(false);
470
+ const filesList = React.useMemo(() => inputValue ? castArray__default.default(inputValue) : [], [inputValue]);
471
+ const changeFormState = React.useCallback(newFiles => {
472
472
  // If max files in dropzone is 1 - return file as it self, else as array of files
473
473
  // ps: for old projects compatibility
474
474
  const toSave = dropzoneProps.maxFiles == 1 ? newFiles[0] : newFiles;
@@ -480,7 +480,7 @@ const FileInputDropzone = /*#__PURE__*/React__default.default.memo(function File
480
480
  [dropzoneProps, change]);
481
481
 
482
482
  //
483
- const convertFiledValueAndSaveAsFiles = React$1.useCallback(async currentFilesList => {
483
+ const convertFiledValueAndSaveAsFiles = React.useCallback(async currentFilesList => {
484
484
  setFileIsLoading(true);
485
485
  const newFiles = [];
486
486
  for (const fileItem of currentFilesList) {
@@ -498,7 +498,7 @@ const FileInputDropzone = /*#__PURE__*/React__default.default.memo(function File
498
498
  }, [isPreviews, changeFormState]);
499
499
 
500
500
  // Delete file from dropzone
501
- const removeFile = React$1.useCallback((event, index) => {
501
+ const removeFile = React.useCallback((event, index) => {
502
502
  event.stopPropagation();
503
503
  event.preventDefault();
504
504
  const newFiles = [...filesList];
@@ -573,7 +573,7 @@ const FileInputDropzone = /*#__PURE__*/React__default.default.memo(function File
573
573
  }
574
574
  }
575
575
  });
576
- React$1.useEffect(() => {
576
+ React.useEffect(() => {
577
577
  const currentFilesList = castArray__default.default(inputValue);
578
578
  const isNeedToConvert = currentFilesList.some(fileItem => typeof fileItem === 'string');
579
579
  if (isNeedToConvert) {
@@ -1073,7 +1073,7 @@ const FormFieldCheckbox = /*#__PURE__*/React__default.default.memo(function Form
1073
1073
  * custom React Hook function.
1074
1074
  */
1075
1075
 
1076
- const onChangeField = React$1.useCallback(event => {
1076
+ const onChangeField = React.useCallback(event => {
1077
1077
  input.onChange(event);
1078
1078
  if (onChange) {
1079
1079
  onChange(event.target.checked, input.name);
@@ -1149,12 +1149,12 @@ function FormFieldChips(props) {
1149
1149
  } = reactFinalForm.useForm();
1150
1150
 
1151
1151
  // Callback for value changes
1152
- const onChangeSomeInput = React$1.useCallback((inputValue, newOptionValue) => {
1152
+ const onChangeSomeInput = React.useCallback((inputValue, newOptionValue) => {
1153
1153
  const updatedValues = inputValue.includes(newOptionValue) ? inputValue.filter(selectedValue => selectedValue !== newOptionValue) : [...inputValue, newOptionValue];
1154
1154
  change(name, updatedValues);
1155
1155
  onChange && onChange(updatedValues);
1156
1156
  }, [change, name, onChange]);
1157
- React$1.useEffect(() => {
1157
+ React.useEffect(() => {
1158
1158
  initialValue && change(name, initialValue);
1159
1159
  // update the form value only when the initialValue changes, so use disable eslint to ignore the warning
1160
1160
  // eslint-disable-next-line react-hooks/exhaustive-deps
@@ -1180,7 +1180,7 @@ function FormFieldChips(props) {
1180
1180
  inputProps: inputProps,
1181
1181
  validationStateKey: isErrorState ? errorKey : 'success'
1182
1182
  });
1183
- const activeOptionsList = React$1.useMemo(() => {
1183
+ const activeOptionsList = React.useMemo(() => {
1184
1184
  const emptyOptionsList = [{
1185
1185
  label: null,
1186
1186
  value: null
@@ -1251,7 +1251,7 @@ const FormFieldChoice = /*#__PURE__*/React__default.default.memo(function FormFi
1251
1251
  const {
1252
1252
  change
1253
1253
  } = reactFinalForm.useForm();
1254
- const setActiveSegment = React$1.useCallback((option, isChecked) => {
1254
+ const setActiveSegment = React.useCallback((option, isChecked) => {
1255
1255
  change(name, isChecked && option.value);
1256
1256
  if (onChange) {
1257
1257
  onChange(option.value, name, isChecked);
@@ -1270,7 +1270,7 @@ const FormFieldChoice = /*#__PURE__*/React__default.default.memo(function FormFi
1270
1270
  * React Hooks must be called in a React function component or a
1271
1271
  * custom React Hook function.
1272
1272
  */
1273
- const activeOption = React$1.useMemo(() => {
1273
+ const activeOption = React.useMemo(() => {
1274
1274
  const emptyOption = {
1275
1275
  value: null,
1276
1276
  label: null
@@ -1503,7 +1503,7 @@ function FormFieldDatePicker(props) {
1503
1503
  * custom React Hook function.
1504
1504
  */
1505
1505
 
1506
- const onChangeField = React$1.useCallback((startDate, endDate) => {
1506
+ const onChangeField = React.useCallback((startDate, endDate) => {
1507
1507
  if (!datePickerProps.selectsRange) {
1508
1508
  // When we need to save single date, value is date
1509
1509
  // TODO: make object with one date? need to check all forms with FormFieldDatePicker
@@ -1605,7 +1605,7 @@ const FormFieldInput = /*#__PURE__*/React__default.default.memo(function FormFie
1605
1605
  * custom React Hook function.
1606
1606
  */
1607
1607
 
1608
- const onChangeField = React$1.useCallback(event => {
1608
+ const onChangeField = React.useCallback(event => {
1609
1609
  input.onChange(event);
1610
1610
  if (onChange) {
1611
1611
  onChange(event.target.value, input.name);
@@ -1677,23 +1677,17 @@ const FormFieldPassword = /*#__PURE__*/React__default.default.memo(function Form
1677
1677
  isDisabled,
1678
1678
  classNameGroupItem,
1679
1679
  fieldProps,
1680
- iconFill,
1681
- iconFillHover,
1682
- iconRevealableHide,
1683
- iconRevealableShow,
1684
- iconShape,
1685
- iconSize,
1686
1680
  inputProps,
1687
1681
  parse,
1688
1682
  showMessage,
1689
1683
  isRequired,
1690
1684
  onChange
1691
1685
  } = props;
1692
- const [isRevealed, setIsRevealed] = React$1.useState(false);
1693
- const inputType = React$1.useMemo(() => {
1686
+ const [isRevealed, setIsRevealed] = React.useState(false);
1687
+ const inputType = React.useMemo(() => {
1694
1688
  return isRevealed ? 'text' : 'password';
1695
1689
  }, [isRevealed]);
1696
- const onClickIconReveal = React$1.useCallback(event => {
1690
+ const onClickIconReveal = React.useCallback(event => {
1697
1691
  event.preventDefault();
1698
1692
  setIsRevealed(prev => !prev);
1699
1693
  }, []);
@@ -1712,17 +1706,17 @@ const FormFieldPassword = /*#__PURE__*/React__default.default.memo(function Form
1712
1706
  * custom React Hook function.
1713
1707
  */
1714
1708
 
1715
- const onChangeField = React$1.useCallback(event => {
1709
+ const onChangeField = React.useCallback(event => {
1716
1710
  input.onChange(event);
1717
1711
  if (onChange) {
1718
1712
  onChange(event.target.value, input.name);
1719
1713
  }
1720
1714
  }, [onChange, input.onChange]);
1721
1715
  const {
1722
- isErrorState,
1723
- isValidState,
1724
1716
  errorKey,
1725
- errorMessage
1717
+ errorMessage,
1718
+ isErrorState,
1719
+ isValidState
1726
1720
  } = useFieldValidationState({
1727
1721
  fieldProps: fieldProps,
1728
1722
  input: input,
@@ -1759,9 +1753,9 @@ const FormFieldPassword = /*#__PURE__*/React__default.default.memo(function Form
1759
1753
  onFocus: input.onFocus
1760
1754
  }, updatedInputProps)), /*#__PURE__*/React__default.default.createElement(Icon.Icon, {
1761
1755
  className: "form-field__icon",
1762
- size: inputProps.iconSize,
1763
- iconFill: inputProps.iconFill,
1764
- SvgImage: isRevealed ? inputProps.iconRevealableHide : inputProps.iconRevealableShow,
1756
+ size: inputProps?.iconSize,
1757
+ iconFill: inputProps?.iconFill,
1758
+ SvgImage: isRevealed ? inputProps?.iconRevealableHide : inputProps?.iconRevealableShow,
1765
1759
  onClick: onClickIconReveal
1766
1760
  }));
1767
1761
  });
@@ -1787,7 +1781,7 @@ function FormFieldSegmented(props) {
1787
1781
  const {
1788
1782
  change
1789
1783
  } = reactFinalForm.useForm();
1790
- const setActiveSegment = React$1.useCallback(option => {
1784
+ const setActiveSegment = React.useCallback(option => {
1791
1785
  change(name, option.value);
1792
1786
  }, [change]);
1793
1787
  return /*#__PURE__*/React__default.default.createElement(reactFinalForm.Field, {
@@ -1803,7 +1797,7 @@ function FormFieldSegmented(props) {
1803
1797
  * custom React Hook function.
1804
1798
  */
1805
1799
 
1806
- const activeOption = React$1.useMemo(() => {
1800
+ const activeOption = React.useMemo(() => {
1807
1801
  const emptyOption = {
1808
1802
  label: null,
1809
1803
  value: null
@@ -1901,8 +1895,8 @@ const FormFieldSelect = /*#__PURE__*/React__default.default.memo(function FormFi
1901
1895
  * React Hooks must be called in a React function component or a
1902
1896
  * custom React Hook function.
1903
1897
  */
1904
- const [selectedOptions, setSelectedOptions] = React$1.useState(null);
1905
- const defaultValue = React$1.useMemo(() => {
1898
+ const [selectedOptions, setSelectedOptions] = React.useState(null);
1899
+ const defaultValue = React.useMemo(() => {
1906
1900
  const optionsValues = getDefaultValue(options, input.value);
1907
1901
  if (!optionsValues.length && input.value?.length) {
1908
1902
  optionsValues.push({
@@ -1912,18 +1906,18 @@ const FormFieldSelect = /*#__PURE__*/React__default.default.memo(function FormFi
1912
1906
  }
1913
1907
  return optionsValues;
1914
1908
  }, [input.value]);
1915
- const onChangeField = React$1.useCallback(value => {
1909
+ const onChangeField = React.useCallback(value => {
1916
1910
  input.onChange(value);
1917
1911
  if (onChange) {
1918
1912
  onChange(value, input.name);
1919
1913
  }
1920
1914
  }, [onChange, input.onChange]);
1921
- const onChangeValue = React$1.useCallback((option, actionMeta) => {
1915
+ const onChangeValue = React.useCallback((option, actionMeta) => {
1922
1916
  const value = Array.isArray(option) ? option.map(o => o.value) : option?.value || null;
1923
1917
  setSelectedOptions(option);
1924
1918
  onChangeField(value);
1925
1919
  }, [onChangeField]);
1926
- React$1.useEffect(() => {
1920
+ React.useEffect(() => {
1927
1921
  setSelectedOptions(defaultValue);
1928
1922
  }, [defaultValue]);
1929
1923
  const {
@@ -1996,7 +1990,7 @@ const FormFieldSwitch = /*#__PURE__*/React__default.default.memo(function FormFi
1996
1990
  * custom React Hook function.
1997
1991
  */
1998
1992
 
1999
- const onChangeField = React$1.useCallback(event => {
1993
+ const onChangeField = React.useCallback(event => {
2000
1994
  input.onChange(event);
2001
1995
  if (onChange) {
2002
1996
  onChange(event.target.checked, input.name);
@@ -2160,7 +2154,7 @@ const FormFieldMaskedInput = /*#__PURE__*/React__default.default.memo(function F
2160
2154
  }
2161
2155
  }
2162
2156
  });
2163
- React$1.useEffect(() => {
2157
+ React.useEffect(() => {
2164
2158
  if (input.value !== unmaskedValue) {
2165
2159
  setUnmaskedValue(input.value.replace(unmasked, ''));
2166
2160
  }
@@ -2222,8 +2216,8 @@ function RadioGroupInput(props) {
2222
2216
  value,
2223
2217
  onChange
2224
2218
  } = props;
2225
- const onChangeField = React$1.useCallback(event => onChange(event.target.value), [onChange]);
2226
- return /*#__PURE__*/React.createElement(Input.Input, Object.assign({
2219
+ const onChangeField = React.useCallback(event => onChange(event.target.value), [onChange]);
2220
+ return /*#__PURE__*/React__default.default.createElement(Input.Input, Object.assign({
2227
2221
  name: input.name,
2228
2222
  autoComplete: "nope",
2229
2223
  value: value,
@@ -2240,12 +2234,12 @@ function RadioGroupItem(props) {
2240
2234
  option,
2241
2235
  onChange
2242
2236
  } = props;
2243
- const onChangeField = React$1.useCallback(event => {
2237
+ const onChangeField = React.useCallback(event => {
2244
2238
  if (event.target.checked) {
2245
2239
  onChange(option.value);
2246
2240
  }
2247
2241
  }, [onChange]);
2248
- return /*#__PURE__*/React.createElement(Radio.Radio, Object.assign({
2242
+ return /*#__PURE__*/React__default.default.createElement(Radio.Radio, Object.assign({
2249
2243
  className: "form-radio__item",
2250
2244
  type: "radio",
2251
2245
  name: input.name,
@@ -2266,14 +2260,14 @@ function RadioGroupList(props) {
2266
2260
  options,
2267
2261
  onChange
2268
2262
  } = props;
2269
- const [editableValue, setEditableValue] = React$1.useState(() => {
2263
+ const [editableValue, setEditableValue] = React.useState(() => {
2270
2264
  const isRadioValue = options.find(option => option.value === input.value);
2271
2265
  if (!isRadioValue) {
2272
2266
  return input.value;
2273
2267
  }
2274
2268
  return '';
2275
2269
  });
2276
- React$1.useEffect(() => {
2270
+ React.useEffect(() => {
2277
2271
  // When a new value from outside enters the form
2278
2272
  if (input.value) {
2279
2273
  // Check value for radio type
@@ -2287,7 +2281,7 @@ function RadioGroupList(props) {
2287
2281
  }, [input.value]);
2288
2282
 
2289
2283
  // Callback for value changes
2290
- const onChangeSomeInput = React$1.useCallback(value => {
2284
+ const onChangeSomeInput = React.useCallback(value => {
2291
2285
  // Save to form values
2292
2286
  input.onChange(value);
2293
2287
  if (onChange) {
@@ -2297,13 +2291,13 @@ function RadioGroupList(props) {
2297
2291
  }, [input, onChange]);
2298
2292
 
2299
2293
  // Handle for radio inputs
2300
- const onChangeRadio = React$1.useCallback(value => {
2294
+ const onChangeRadio = React.useCallback(value => {
2301
2295
  setEditableValue('');
2302
2296
  onChangeSomeInput(value);
2303
2297
  }, [onChangeSomeInput]);
2304
2298
 
2305
2299
  // Handle for text input
2306
- const onChangeEditable = React$1.useCallback(value => {
2300
+ const onChangeEditable = React.useCallback(value => {
2307
2301
  setEditableValue(value);
2308
2302
  onChangeSomeInput(value);
2309
2303
  }, [onChangeSomeInput]);
@@ -2629,11 +2623,14 @@ const sendFormDataToServer = async (url, data) => {
2629
2623
 
2630
2624
  const FinalForm = /*#__PURE__*/React__default.default.forwardRef(function FinalForm(props, ref) {
2631
2625
  const {
2626
+ dataTestId,
2627
+ dataTour,
2632
2628
  className,
2633
2629
  type,
2634
2630
  initialValues,
2635
2631
  initialValuesEqual,
2636
2632
  config,
2633
+ validationSchema,
2637
2634
  title,
2638
2635
  titleFill,
2639
2636
  titleTextColor,
@@ -2643,6 +2640,7 @@ const FinalForm = /*#__PURE__*/React__default.default.forwardRef(function FinalF
2643
2640
  descSize,
2644
2641
  descTextColor,
2645
2642
  descTextWeight,
2643
+ buttonGap,
2646
2644
  dataTestIdPrimaryButton,
2647
2645
  dataTourPrimaryButton,
2648
2646
  primaryButton,
@@ -2684,13 +2682,10 @@ const FinalForm = /*#__PURE__*/React__default.default.forwardRef(function FinalF
2684
2682
  additionalProps = {},
2685
2683
  buttonDirection = 'vertical',
2686
2684
  buttonFill,
2687
- buttonGap,
2688
2685
  buttonJustifyContent,
2689
2686
  buttonPadding,
2690
2687
  buttonPosition,
2691
- dataTestId,
2692
2688
  dataTestIdButtons,
2693
- dataTour,
2694
2689
  dataTourButtons,
2695
2690
  disableFieldsAutoComplete = false,
2696
2691
  fieldsGap,
@@ -2709,7 +2704,6 @@ const FinalForm = /*#__PURE__*/React__default.default.forwardRef(function FinalF
2709
2704
  notificationCloseButton,
2710
2705
  notificationType,
2711
2706
  renderFieldsWrapper = wrapperChildren => wrapperChildren,
2712
- validationSchema,
2713
2707
  before,
2714
2708
  after,
2715
2709
  isLoading,
@@ -2717,7 +2711,7 @@ const FinalForm = /*#__PURE__*/React__default.default.forwardRef(function FinalF
2717
2711
  onSubmit
2718
2712
  } = props;
2719
2713
  const validate = useYupValidationSchema(validationSchema, language);
2720
- const onRefFormInstance = React$1.useCallback(formInstance => {
2714
+ const onRefFormInstance = React.useCallback(formInstance => {
2721
2715
  if (ref) {
2722
2716
  ref.current = formInstance;
2723
2717
  }
@@ -2744,15 +2738,15 @@ const FinalForm = /*#__PURE__*/React__default.default.forwardRef(function FinalF
2744
2738
  }) => {
2745
2739
  return /*#__PURE__*/React__default.default.createElement("form", {
2746
2740
  className: clsx__default.default(className, 'form', type && `form_type_${type}`, buttonPosition && `form_button-position_${buttonPosition}`, directionClass, fillClass, shapeClass, elevationClass),
2747
- name: formName,
2741
+ name: formName
2742
+ // We no need set reference to html element, we need reference to "final-form" instance
2743
+ ,
2744
+ ref: () => onRefFormInstance(form),
2748
2745
  autoCapitalize: disableFieldsAutoComplete ? 'off' : undefined,
2749
2746
  autoComplete: disableFieldsAutoComplete ? 'off' : undefined,
2750
2747
  autoCorrect: disableFieldsAutoComplete ? 'off' : undefined,
2751
2748
  "data-test-id": dataTestId,
2752
- "data-tour": dataTour
2753
- // We no need set reference to html element, we need reference to "final-form" instance
2754
- ,
2755
- ref: () => onRefFormInstance(form),
2749
+ "data-tour": dataTour,
2756
2750
  spellCheck: disableFieldsAutoComplete ? 'false' : undefined,
2757
2751
  style: formStyles,
2758
2752
  onSubmit: handleSubmit
@@ -2781,7 +2775,7 @@ const FinalForm = /*#__PURE__*/React__default.default.forwardRef(function FinalF
2781
2775
  values: true
2782
2776
  },
2783
2777
  onChange: onChangeFormValues
2784
- }), Boolean(Object.keys(config).length) && /*#__PURE__*/React__default.default.createElement(React__default.default.Fragment, null, renderFieldsWrapper(/*#__PURE__*/React__default.default.createElement(Group.Group, {
2778
+ }), Boolean(config && Object.keys(config).length) && /*#__PURE__*/React__default.default.createElement(React__default.default.Fragment, null, renderFieldsWrapper(/*#__PURE__*/React__default.default.createElement(Group.Group, {
2785
2779
  className: "form__wrapper",
2786
2780
  direction: "vertical",
2787
2781
  gap: fieldsGap || groupGap,
@@ -2798,15 +2792,17 @@ const FinalForm = /*#__PURE__*/React__default.default.forwardRef(function FinalF
2798
2792
  itemFill: loaderItemFill,
2799
2793
  shape: loaderShape
2800
2794
  }))))), (primaryButtonLabel || primaryButton || secondaryButtonLabel || secondaryButton || tertiaryButton || tertiaryButtonLabel) && /*#__PURE__*/React__default.default.createElement(Group.Group, {
2795
+ dataTestId: dataTestIdButtons,
2796
+ dataTour: dataTourButtons,
2801
2797
  className: "form__button",
2802
2798
  direction: buttonDirection,
2803
2799
  justifyContent: buttonJustifyContent,
2804
2800
  fill: buttonFill,
2805
2801
  padding: buttonPadding,
2806
- gap: buttonGap,
2807
- dataTestId: dataTestIdButtons,
2808
- dataTour: dataTourButtons
2802
+ gap: buttonGap
2809
2803
  }, primaryButtonLabel ? /*#__PURE__*/React__default.default.createElement(Button.Button, {
2804
+ dataTestId: dataTestIdPrimaryButton,
2805
+ dataTour: dataTourPrimaryButton,
2810
2806
  className: "form__button-item",
2811
2807
  appearance: primaryButtonAppearance,
2812
2808
  width: "fill",
@@ -2818,10 +2814,10 @@ const FinalForm = /*#__PURE__*/React__default.default.forwardRef(function FinalF
2818
2814
  labelTextSize: primaryButtonLabelSize,
2819
2815
  labelTextWeight: primaryButtonLabelTextWeight,
2820
2816
  isDisabled: primaryButtonIsDisabled,
2821
- dataTestId: dataTestIdPrimaryButton,
2822
- dataTour: dataTourPrimaryButton,
2823
2817
  loading: primaryButtonIsLoading
2824
2818
  }) : primaryButton, secondaryButtonLabel ? /*#__PURE__*/React__default.default.createElement(Button.Button, {
2819
+ dataTestId: dataTestIdSecondaryButton,
2820
+ dataTour: dataTourSecondaryButton,
2825
2821
  className: "form__button-item",
2826
2822
  appearance: secondaryButtonAppearance,
2827
2823
  width: "fill",
@@ -2833,11 +2829,11 @@ const FinalForm = /*#__PURE__*/React__default.default.forwardRef(function FinalF
2833
2829
  labelTextSize: secondaryButtonLabelSize,
2834
2830
  labelTextWeight: secondaryButtonLabelTextWeight,
2835
2831
  isDisabled: secondaryButtonIsDisabled,
2836
- dataTestId: dataTestIdSecondaryButton,
2837
- dataTour: dataTourSecondaryButton,
2838
2832
  loading: secondaryButtonIsLoading,
2839
2833
  onClick: onClickSecondaryButton
2840
2834
  }) : secondaryButton, tertiaryButtonLabel ? /*#__PURE__*/React__default.default.createElement(Button.Button, {
2835
+ dataTestId: dataTestIdTertiaryButton,
2836
+ dataTour: dataTourTertiaryButton,
2841
2837
  className: "form__button-item",
2842
2838
  width: "fill",
2843
2839
  size: tertiaryButtonSize,
@@ -2847,8 +2843,6 @@ const FinalForm = /*#__PURE__*/React__default.default.forwardRef(function FinalF
2847
2843
  labelTextColor: tertiaryButtonLabelTextColor,
2848
2844
  labelTextSize: tertiaryButtonLabelSize,
2849
2845
  labelTextWeight: tertiaryButtonLabelTextWeight,
2850
- dataTestId: dataTestIdTertiaryButton,
2851
- dataTour: dataTourTertiaryButton,
2852
2846
  onClick: onClickTertiaryButton
2853
2847
  }) : tertiaryButton), after);
2854
2848
  },