@itcase/forms 1.0.63 → 1.0.65

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.
@@ -32,6 +32,7 @@ import { Select } from '@itcase/ui/components/Select';
32
32
  import { Switch } from '@itcase/ui/components/Switch';
33
33
  import { Textarea } from '@itcase/ui/components/Textarea';
34
34
  import { useIMask } from 'react-imask';
35
+ import { Chips } from '@itcase/ui/components/Chips';
35
36
  import { Button } from '@itcase/ui/components/Button';
36
37
  import { Group as Group$1 } from '@itcase/ui/components/Group';
37
38
  import { NotificationItem } from '@itcase/ui/components/Notification';
@@ -140,9 +141,11 @@ function FieldWrapperBase(props) {
140
141
  labelHidden,
141
142
  labelTextColor,
142
143
  labelTextSize,
144
+ labelTextSizeMobile,
143
145
  labelTextWeight,
144
146
  helpText,
145
147
  helpTextSize,
148
+ helpTextSizeMobile,
146
149
  helpTextWeight,
147
150
  helpTextColor,
148
151
  isErrorState,
@@ -209,6 +212,7 @@ function FieldWrapperBase(props) {
209
212
  htmlFor: id
210
213
  }, /*#__PURE__*/React.createElement(Text, {
211
214
  size: labelTextSize,
215
+ sizeMobile: labelTextSizeMobile,
212
216
  textColor: labelTextColor,
213
217
  textWeight: labelTextWeight
214
218
  }, label, labelHidden && '\u00A0')), desc && /*#__PURE__*/React.createElement("div", {
@@ -242,6 +246,7 @@ function FieldWrapperBase(props) {
242
246
  className: "form-field__message-item form-field__message-item_type_help-text",
243
247
  dataTestId: `${inputName}FieldMessageHelpText`,
244
248
  size: helpTextSize,
249
+ sizeMobile: helpTextSizeMobile,
245
250
  textColor: helpTextColor,
246
251
  textWeight: helpTextWeight
247
252
  }, helpText), (!isErrorState && !helpText || isErrorState && !helpText && !errorMessage) && /*#__PURE__*/React.createElement(Text, {
@@ -2357,120 +2362,112 @@ MaskedInputField.propTypes = {
2357
2362
  unmasked: PropTypes.string
2358
2363
  };
2359
2364
 
2360
- const focusOnError = (formElementsList, errors) => {
2361
- const selectsIds = Object.keys(errors).map(fieldName => {
2362
- if (fieldName === FORM_ERROR) {
2363
- // TODO: get from somewhere
2364
- return 'notification__item_status_error';
2365
- }
2366
- return `react-select-id_${fieldName}-input`;
2367
- });
2368
- const errorFieldElement = formElementsList.find(element => {
2369
- if (element.name) {
2370
- return getIn(errors, element.name);
2371
- } else {
2372
- return selectsIds.includes(element.id);
2373
- }
2374
- });
2375
- const errorsList = Object.keys(errors);
2376
- if (!errorFieldElement && errorsList.length) {
2377
- let errorElement;
2378
- try {
2379
- const fieldName = errorsList[0];
2380
- if (fieldName === FORM_ERROR) {
2381
- errorElement = document.querySelector('notification__item_status_error');
2382
- } else {
2383
- errorElement = document.querySelector(`#${fieldName}-error`);
2384
- if (!errorElement) {
2385
- errorElement = document.querySelector(`#id_${fieldName}`);
2386
- }
2387
- }
2388
- } catch (err) {
2389
- console.warn(err);
2390
- }
2391
- if (errorElement) {
2392
- errorElement.scrollIntoView({
2393
- block: 'center'
2394
- }); // , behavior: 'smooth'
2395
- }
2396
- }
2365
+ function ChipsField(props) {
2366
+ const {
2367
+ classNameGroupItem,
2368
+ fieldProps,
2369
+ initialValue,
2370
+ inputProps,
2371
+ isDisabled,
2372
+ isRequired,
2373
+ name,
2374
+ options,
2375
+ showMessage,
2376
+ onChange
2377
+ } = props;
2378
+ const {
2379
+ change
2380
+ } = useForm();
2397
2381
 
2398
- // The field is covered by the header because header is "sticky",
2399
- // that's we scroll manually so that the field falls into the center of the visible area
2400
- if (errorFieldElement) {
2401
- errorFieldElement.scrollIntoView({
2402
- block: 'center'
2382
+ // Callback for value changes
2383
+ const onChangeSomeInput = useCallback((inputValue, newOptionValue) => {
2384
+ const updatedValues = inputValue.includes(newOptionValue) ? inputValue.filter(selectedValue => selectedValue !== newOptionValue) : [...inputValue, newOptionValue];
2385
+ change(name, updatedValues);
2386
+ onChange && onChange(updatedValues);
2387
+ }, [change, name, onChange]);
2388
+ useEffect(() => {
2389
+ initialValue && change(name, initialValue);
2390
+ // update the form value only when the initialValue changes, so use disable eslint to ignore the warning
2391
+ // eslint-disable-next-line react-hooks/exhaustive-deps
2392
+ }, [initialValue]);
2393
+ return /*#__PURE__*/React.createElement(Field, {
2394
+ initialValue: initialValue,
2395
+ name: name
2396
+ }, function Render({
2397
+ input,
2398
+ meta
2399
+ }) {
2400
+ const {
2401
+ isErrorState,
2402
+ isValidState,
2403
+ errorKey,
2404
+ errorMessage
2405
+ } = useFieldValidationState({
2406
+ fieldProps: fieldProps,
2407
+ input: input,
2408
+ meta: meta
2403
2409
  });
2404
- }
2405
- return null;
2406
- };
2407
- const focusOnErrorDecorator = createDecorator(null, focusOnError);
2408
- const setErrorsMutator = (args, state) => {
2409
- const [fieldName, data] = args;
2410
- const submitError = data.submitError;
2411
- const fieldError = data.error;
2412
- if (fieldName === 'non_field_errors') {
2413
- // state.formState.invalid = true
2414
- // state.formState.valid = false
2415
- state.formState.error = fieldError;
2416
- state.formState.submitError = submitError;
2417
- } else if (fieldName in state.fields) {
2418
- if (fieldError) {
2419
- const errorsState = Object.assign({}, state.formState.errors, {
2420
- [fieldName]: fieldError
2421
- });
2422
- state.fields[fieldName].touched = true;
2423
- state.fields[fieldName].error = fieldError;
2424
- state.formState.errors = errorsState;
2425
- }
2426
- if (submitError) {
2427
- const submitErrorsState = Object.assign({}, state.formState.submitErrors, {
2428
- [fieldName]: submitError
2429
- });
2430
-
2431
- // state.fields[fieldName].submitFailed = true
2432
- // state.fields[fieldName].submitSucceeded = false
2433
- state.fields[fieldName].submitError = submitError;
2434
- state.formState.submitErrors = submitErrorsState;
2435
- state.formState.submitFailed = true;
2436
- state.formState.submitSucceeded = false;
2437
- state.formState.lastSubmittedValues = state.formState.values;
2438
- }
2439
- }
2440
- };
2441
- const sendFormDataToServer = async (url, data) => {
2442
- try {
2443
- const response = await axios({
2444
- url: url,
2445
- method: 'POST',
2446
- data: data
2410
+ const updatedInputProps = useValidationAppearanceInputProps({
2411
+ validationStateKey: isErrorState ? errorKey : 'success',
2412
+ inputProps: inputProps
2447
2413
  });
2448
- return {
2449
- success: true,
2450
- response
2451
- };
2452
- } catch (error) {
2453
- const formErrors = {};
2454
- if (typeof error.response?.data === 'string') {
2455
- formErrors[FORM_ERROR] = 'Something went wrong';
2456
- }
2457
- if (typeof error.response?.data === 'object') {
2458
- Object.entries(error.response.data).forEach(([fieldName, errorsList]) => {
2459
- formErrors[fieldName] = errorsList[0];
2460
- });
2461
- }
2462
- return {
2463
- success: false,
2464
- formErrors,
2465
- error
2466
- };
2467
- }
2414
+ const activeOptionsList = useMemo(() => {
2415
+ const emptyOptionsList = [{
2416
+ value: null,
2417
+ label: null
2418
+ }];
2419
+ if (input?.value) {
2420
+ const currentOptions = options.filter(option => input.value?.includes(option.value));
2421
+ return currentOptions || emptyOptionsList;
2422
+ }
2423
+ return emptyOptionsList;
2424
+ }, [input.value]);
2425
+ return /*#__PURE__*/React.createElement(FieldWrapper, Object.assign({
2426
+ className: clsx('form-field_type_chips', 'form__item_type_chips', classNameGroupItem),
2427
+ errorKey: errorKey,
2428
+ errorMessage: errorMessage,
2429
+ fieldClassName: 'form-chips',
2430
+ inputName: input.name,
2431
+ inputValue: input.value,
2432
+ isDisabled: isDisabled,
2433
+ isErrorState: isErrorState,
2434
+ isRequired: isRequired,
2435
+ isValidState: isValidState,
2436
+ metaActive: meta.active,
2437
+ metaError: meta.error,
2438
+ showMessage: showMessage
2439
+ }, fieldProps), options.map(option => /*#__PURE__*/React.createElement(Chips, Object.assign({
2440
+ isActive: activeOptionsList.includes(option),
2441
+ className: clsx(meta.active && 'form-chips_state_focus', meta.error && meta.touched && `form-chips_state_${errorKey}`),
2442
+ key: option.value,
2443
+ label: option.label,
2444
+ value: option.value,
2445
+ onClick: () => onChangeSomeInput(input.value, option.value)
2446
+ }, updatedInputProps))));
2447
+ });
2448
+ }
2449
+ ChipsField.propTypes = {
2450
+ classNameGroupItem: PropTypes.string,
2451
+ fieldProps: PropTypes.object,
2452
+ initialValue: PropTypes.array,
2453
+ input: PropTypes.object,
2454
+ inputProps: PropTypes.object,
2455
+ isDisabled: PropTypes.bool,
2456
+ isRequired: PropTypes.bool,
2457
+ name: PropTypes.string,
2458
+ options: PropTypes.arrayOf(PropTypes.shape({
2459
+ value: PropTypes.oneOfType([PropTypes.string, PropTypes.number, PropTypes.bool]),
2460
+ label: PropTypes.string
2461
+ })),
2462
+ showMessage: PropTypes.bool,
2463
+ onChange: PropTypes.func
2468
2464
  };
2469
2465
 
2470
2466
  const formTypes = {
2471
2467
  checkbox: 'checkbox',
2472
2468
  custom: 'custom',
2473
2469
  choice: 'choice',
2470
+ chips: 'chips',
2474
2471
  code: 'code',
2475
2472
  datePicker: 'datePicker',
2476
2473
  dateRangePicker: 'dateRangePicker',
@@ -2498,6 +2495,12 @@ function generateField(field, config, props) {
2498
2495
  key: config.key
2499
2496
  }, field, props));
2500
2497
  }
2498
+ case formTypes.chips:
2499
+ {
2500
+ return /*#__PURE__*/React.createElement(ChipsField, Object.assign({
2501
+ key: config.key
2502
+ }, field, props));
2503
+ }
2501
2504
  case formTypes.code:
2502
2505
  {
2503
2506
  return /*#__PURE__*/React.createElement(CodeField, Object.assign({
@@ -2582,8 +2585,119 @@ function generateField(field, config, props) {
2582
2585
  }
2583
2586
  }
2584
2587
 
2588
+ const focusOnError = (formElementsList, errors) => {
2589
+ const selectsIds = Object.keys(errors).map(fieldName => {
2590
+ if (fieldName === FORM_ERROR) {
2591
+ // TODO: get from somewhere
2592
+ return 'notification__item_status_error';
2593
+ }
2594
+ return `react-select-id_${fieldName}-input`;
2595
+ });
2596
+ const errorFieldElement = formElementsList.find(element => {
2597
+ if (element.name) {
2598
+ return getIn(errors, element.name);
2599
+ } else {
2600
+ return selectsIds.includes(element.id);
2601
+ }
2602
+ });
2603
+ const errorsList = Object.keys(errors);
2604
+ if (!errorFieldElement && errorsList.length) {
2605
+ let errorElement;
2606
+ try {
2607
+ const fieldName = errorsList[0];
2608
+ if (fieldName === FORM_ERROR) {
2609
+ errorElement = document.querySelector('notification__item_status_error');
2610
+ } else {
2611
+ errorElement = document.querySelector(`#${fieldName}-error`);
2612
+ if (!errorElement) {
2613
+ errorElement = document.querySelector(`#id_${fieldName}`);
2614
+ }
2615
+ }
2616
+ } catch (err) {
2617
+ console.warn(err);
2618
+ }
2619
+ if (errorElement) {
2620
+ errorElement.scrollIntoView({
2621
+ block: 'center'
2622
+ }); // , behavior: 'smooth'
2623
+ }
2624
+ }
2625
+
2626
+ // The field is covered by the header because header is "sticky",
2627
+ // that's we scroll manually so that the field falls into the center of the visible area
2628
+ if (errorFieldElement) {
2629
+ errorFieldElement.scrollIntoView({
2630
+ block: 'center'
2631
+ });
2632
+ }
2633
+ return null;
2634
+ };
2635
+ const focusOnErrorDecorator = createDecorator(null, focusOnError);
2636
+ const setErrorsMutator = (args, state) => {
2637
+ const [fieldName, data] = args;
2638
+ const submitError = data.submitError;
2639
+ const fieldError = data.error;
2640
+ if (fieldName === 'non_field_errors') {
2641
+ // state.formState.invalid = true
2642
+ // state.formState.valid = false
2643
+ state.formState.error = fieldError;
2644
+ state.formState.submitError = submitError;
2645
+ } else if (fieldName in state.fields) {
2646
+ if (fieldError) {
2647
+ const errorsState = Object.assign({}, state.formState.errors, {
2648
+ [fieldName]: fieldError
2649
+ });
2650
+ state.fields[fieldName].touched = true;
2651
+ state.fields[fieldName].error = fieldError;
2652
+ state.formState.errors = errorsState;
2653
+ }
2654
+ if (submitError) {
2655
+ const submitErrorsState = Object.assign({}, state.formState.submitErrors, {
2656
+ [fieldName]: submitError
2657
+ });
2658
+
2659
+ // state.fields[fieldName].submitFailed = true
2660
+ // state.fields[fieldName].submitSucceeded = false
2661
+ state.fields[fieldName].submitError = submitError;
2662
+ state.formState.submitErrors = submitErrorsState;
2663
+ state.formState.submitFailed = true;
2664
+ state.formState.submitSucceeded = false;
2665
+ state.formState.lastSubmittedValues = state.formState.values;
2666
+ }
2667
+ }
2668
+ };
2669
+ const sendFormDataToServer = async (url, data) => {
2670
+ try {
2671
+ const response = await axios({
2672
+ url: url,
2673
+ method: 'POST',
2674
+ data: data
2675
+ });
2676
+ return {
2677
+ success: true,
2678
+ response
2679
+ };
2680
+ } catch (error) {
2681
+ const formErrors = {};
2682
+ if (typeof error.response?.data === 'string') {
2683
+ formErrors[FORM_ERROR] = 'Something went wrong';
2684
+ }
2685
+ if (typeof error.response?.data === 'object') {
2686
+ Object.entries(error.response.data).forEach(([fieldName, errorsList]) => {
2687
+ formErrors[fieldName] = errorsList[0];
2688
+ });
2689
+ }
2690
+ return {
2691
+ success: false,
2692
+ formErrors,
2693
+ error
2694
+ };
2695
+ }
2696
+ };
2697
+
2585
2698
  const FinalForm = /*#__PURE__*/React.forwardRef(function FinalForm(props, ref) {
2586
2699
  const {
2700
+ isLoading,
2587
2701
  additionalProps,
2588
2702
  after,
2589
2703
  before,
@@ -2594,13 +2708,13 @@ const FinalForm = /*#__PURE__*/React.forwardRef(function FinalForm(props, ref) {
2594
2708
  buttonPadding,
2595
2709
  className,
2596
2710
  config,
2597
- dataTour,
2598
2711
  dataTestId,
2599
- dataTourButtons,
2600
2712
  dataTestIdButtons,
2601
2713
  dataTestIdPrimaryButton,
2602
2714
  dataTestIdSecondaryButton,
2603
2715
  dataTestIdTertiaryButton,
2716
+ dataTour,
2717
+ dataTourButtons,
2604
2718
  dataTourPrimaryButton,
2605
2719
  dataTourSecondaryButton,
2606
2720
  dataTourTertiaryButton,
@@ -2614,7 +2728,6 @@ const FinalForm = /*#__PURE__*/React.forwardRef(function FinalForm(props, ref) {
2614
2728
  groupGap,
2615
2729
  initialValues,
2616
2730
  initialValuesEqual,
2617
- isLoading,
2618
2731
  language,
2619
2732
  loader,
2620
2733
  loaderFill,
@@ -2624,10 +2737,6 @@ const FinalForm = /*#__PURE__*/React.forwardRef(function FinalForm(props, ref) {
2624
2737
  mutators,
2625
2738
  notificationCloseButton,
2626
2739
  notificationType,
2627
- onChangeFormValues,
2628
- onClickSecondaryButton,
2629
- onClickTertiaryButton,
2630
- onSubmit,
2631
2740
  primaryButton,
2632
2741
  primaryButtonFill,
2633
2742
  primaryButtonFillHover,
@@ -2636,6 +2745,7 @@ const FinalForm = /*#__PURE__*/React.forwardRef(function FinalForm(props, ref) {
2636
2745
  primaryButtonLabelTextColor,
2637
2746
  primaryButtonLabelTextWeight,
2638
2747
  primaryButtonSize,
2748
+ renderFieldsWrapper = wrapperChildren => wrapperChildren,
2639
2749
  secondaryButton,
2640
2750
  secondaryButtonFill,
2641
2751
  secondaryButtonFillHover,
@@ -2658,7 +2768,11 @@ const FinalForm = /*#__PURE__*/React.forwardRef(function FinalForm(props, ref) {
2658
2768
  titleTextSize,
2659
2769
  titleTextWeight,
2660
2770
  type,
2661
- validationSchema
2771
+ validationSchema,
2772
+ onChangeFormValues,
2773
+ onClickSecondaryButton,
2774
+ onClickTertiaryButton,
2775
+ onSubmit
2662
2776
  } = props;
2663
2777
  const validate = useYupValidationSchema(validationSchema, language);
2664
2778
  const onRefFormInstance = useCallback(formInstance => {
@@ -2690,26 +2804,27 @@ const FinalForm = /*#__PURE__*/React.forwardRef(function FinalForm(props, ref) {
2690
2804
  initialValues: initialValues,
2691
2805
  initialValuesEqual: initialValuesEqual,
2692
2806
  mutators: mutators,
2807
+ validate: validate,
2693
2808
  render: ({
2809
+ form,
2694
2810
  handleSubmit,
2695
- submitError,
2696
2811
  modifiedSinceLastSubmit,
2697
- form
2812
+ submitError
2698
2813
  }) => {
2699
2814
  return /*#__PURE__*/React.createElement("form", {
2700
- style: formStyles,
2701
- className: clsx(className, 'form', set && `form_set_${set}`, type && `form_type_${type}`, directionClass, fillClass, shapeClass, elevationClass),
2702
- name: formName,
2703
- "data-tour": dataTour,
2704
- "data-test-id": dataTestId
2815
+ className: clsx(className, 'form', set && `form_set_${set}`, type && `form_type_${type}`, directionClass, fillClass, shapeClass, elevationClass)
2705
2816
  // We no need set reference to html element, we need reference to "final-form" instance
2706
2817
  ,
2707
2818
  ref: () => onRefFormInstance(form),
2708
- onSubmit: handleSubmit,
2819
+ name: formName,
2820
+ autoCapitalize: disableFieldsAutoComplete ? 'off' : undefined,
2709
2821
  autoComplete: disableFieldsAutoComplete ? 'off' : undefined,
2710
2822
  autoCorrect: disableFieldsAutoComplete ? 'off' : undefined,
2711
- autoCapitalize: disableFieldsAutoComplete ? 'off' : undefined,
2712
- spellCheck: disableFieldsAutoComplete ? 'false' : undefined
2823
+ "data-test-id": dataTestId,
2824
+ "data-tour": dataTour,
2825
+ spellCheck: disableFieldsAutoComplete ? 'false' : undefined,
2826
+ style: formStyles,
2827
+ onSubmit: handleSubmit
2713
2828
  }, before, title && /*#__PURE__*/React.createElement(Title, {
2714
2829
  className: "form__title",
2715
2830
  size: titleTextSize,
@@ -2724,88 +2839,88 @@ const FinalForm = /*#__PURE__*/React.forwardRef(function FinalForm(props, ref) {
2724
2839
  className: clsx('notification', 'form-notification', notificationType ? `form-notification_type_${notificationType}` : 'form-notification_type_global')
2725
2840
  }, /*#__PURE__*/React.createElement(NotificationItem, {
2726
2841
  className: "form-notification__item",
2727
- titleTextSize: "h6",
2728
2842
  closeButton: notificationCloseButton,
2843
+ status: "error",
2729
2844
  title: form.getState().submitError,
2730
- set: "form",
2731
- status: "error"
2845
+ titleTextSize: "h6",
2846
+ set: "form"
2732
2847
  })), onChangeFormValues && /*#__PURE__*/React.createElement(FormSpy, {
2733
2848
  subscription: {
2734
2849
  values: true
2735
2850
  },
2736
2851
  onChange: onChangeFormValues
2737
- }), Boolean(Object.keys(config).length) && /*#__PURE__*/React.createElement(Group$1, {
2852
+ }), Boolean(Object.keys(config).length) && /*#__PURE__*/React.createElement(React.Fragment, null, renderFieldsWrapper( /*#__PURE__*/React.createElement(Group$1, {
2853
+ className: "form__wrapper",
2738
2854
  direction: "vertical",
2739
- gap: fieldsGap || groupGap,
2740
- className: "form__wrapper"
2855
+ gap: fieldsGap || groupGap
2741
2856
  }, Object.keys(config).map(key => generateField(config[key], {
2742
2857
  key
2743
2858
  }, additionalProps[config[key].name])), isLoading && (loader || /*#__PURE__*/React.createElement(Loader, {
2744
2859
  className: "form__loader",
2745
- set: loaderSet,
2746
2860
  fill: loaderFill,
2747
2861
  itemFill: loaderItemFill,
2748
- text: loaderText
2749
- }))), (primaryButtonLabel || primaryButton || secondaryButtonLabel || secondaryButton || tertiaryButton || tertiaryButtonLabel) && /*#__PURE__*/React.createElement(Group$1, {
2862
+ text: loaderText,
2863
+ set: loaderSet
2864
+ }))))), (primaryButtonLabel || primaryButton || secondaryButtonLabel || secondaryButton || tertiaryButton || tertiaryButtonLabel) && /*#__PURE__*/React.createElement(Group$1, {
2865
+ className: "form__button",
2750
2866
  fill: buttonFill,
2751
- justifyContent: buttonJustifyContent,
2752
- direction: buttonDirection,
2753
2867
  padding: buttonPadding,
2754
- gap: buttonGap,
2755
- className: "form__button",
2868
+ dataTestId: dataTestIdButtons,
2756
2869
  dataTour: dataTourButtons,
2757
- dataTestId: dataTestIdButtons
2870
+ direction: buttonDirection,
2871
+ gap: buttonGap,
2872
+ justifyContent: buttonJustifyContent
2758
2873
  }, primaryButtonLabel ? /*#__PURE__*/React.createElement(Button, {
2759
- width: "fill",
2760
2874
  className: "form__button-item",
2875
+ width: "fill",
2876
+ labelTextColor: primaryButtonLabelTextColor,
2877
+ labelTextSize: primaryButtonLabelSize,
2761
2878
  fill: primaryButtonFill,
2762
2879
  fillHover: primaryButtonFillHover,
2763
- size: primaryButtonSize,
2764
- labelTextColor: primaryButtonLabelTextColor,
2765
- labelSize: primaryButtonLabelSize,
2766
- labelTextWeight: primaryButtonLabelTextWeight,
2767
- label: primaryButtonLabel,
2880
+ dataTestId: dataTestIdPrimaryButton,
2768
2881
  dataTour: dataTourPrimaryButton,
2769
- dataTestId: dataTestIdPrimaryButton
2882
+ label: primaryButtonLabel,
2883
+ labelTextWeight: primaryButtonLabelTextWeight,
2884
+ size: primaryButtonSize
2770
2885
  }) : primaryButton, secondaryButtonLabel ? /*#__PURE__*/React.createElement(Button, {
2771
- width: "fill",
2772
2886
  className: "form__button-item",
2887
+ width: "fill",
2888
+ labelTextColor: secondaryButtonLabelTextColor,
2889
+ labelTextSize: secondaryButtonLabelSize,
2773
2890
  fill: secondaryButtonFill,
2774
2891
  fillHover: secondaryButtonFillHover,
2775
- size: secondaryButtonSize,
2776
- labelTextColor: secondaryButtonLabelTextColor,
2777
- labelSize: secondaryButtonLabelSize,
2778
- labelTextWeight: secondaryButtonLabelTextWeight,
2779
- label: secondaryButtonLabel,
2780
- onClick: onClickSecondaryButton,
2892
+ dataTestId: dataTestIdSecondaryButton,
2781
2893
  dataTour: dataTourSecondaryButton,
2782
- dataTestId: dataTestIdSecondaryButton
2894
+ label: secondaryButtonLabel,
2895
+ labelTextWeight: secondaryButtonLabelTextWeight,
2896
+ size: secondaryButtonSize,
2897
+ onClick: onClickSecondaryButton
2783
2898
  }) : secondaryButton, tertiaryButtonLabel ? /*#__PURE__*/React.createElement(Button, {
2784
- width: "fill",
2785
2899
  className: "form__button-item",
2900
+ width: "fill",
2901
+ labelTextColor: tertiaryButtonLabelTextColor,
2902
+ labelTextSize: tertiaryButtonLabelSize,
2786
2903
  fill: tertiaryButtonFill,
2787
2904
  fillHover: tertiaryButtonFillHover,
2788
- size: tertiaryButtonSize,
2789
- labelTextColor: tertiaryButtonLabelTextColor,
2790
- labelSize: tertiaryButtonLabelSize,
2791
- labelTextWeight: tertiaryButtonLabelTextWeight,
2792
- label: tertiaryButtonLabel,
2793
- onClick: onClickTertiaryButton,
2905
+ dataTestId: dataTestIdTertiaryButton,
2794
2906
  dataTour: dataTourTertiaryButton,
2795
- dataTestId: dataTestIdTertiaryButton
2907
+ label: tertiaryButtonLabel,
2908
+ labelTextWeight: tertiaryButtonLabelTextWeight,
2909
+ size: tertiaryButtonSize,
2910
+ onClick: onClickTertiaryButton
2796
2911
  }) : tertiaryButton), after);
2797
2912
  },
2798
2913
  subscription: {
2799
- submitting: true,
2800
- pristine: true,
2801
2914
  modifiedSinceLastSubmit: true,
2802
- submitError: true
2915
+ pristine: true,
2916
+ submitError: true,
2917
+ submitting: true
2803
2918
  },
2804
- validate: validate,
2805
2919
  onSubmit: onSubmit
2806
2920
  });
2807
2921
  });
2808
2922
  FinalForm.propTypes = {
2923
+ isLoading: PropTypes.bool,
2809
2924
  additionalProps: PropTypes.object,
2810
2925
  after: PropTypes.any,
2811
2926
  before: PropTypes.any,
@@ -2831,7 +2946,6 @@ FinalForm.propTypes = {
2831
2946
  groupGap: PropTypes.string,
2832
2947
  initialValues: PropTypes.any,
2833
2948
  initialValuesEqual: PropTypes.any,
2834
- isLoading: PropTypes.bool,
2835
2949
  language: PropTypes.string,
2836
2950
  loader: PropTypes.element,
2837
2951
  loaderFill: PropTypes.string,
@@ -2879,16 +2993,16 @@ FinalForm.propTypes = {
2879
2993
  onSubmit: PropTypes.func
2880
2994
  };
2881
2995
  FinalForm.defaultProps = {
2882
- additionalProps: {},
2996
+ direction: 'vertical',
2883
2997
  isLoading: false,
2884
- loaderSet: 'simple',
2998
+ additionalProps: {},
2999
+ buttonDirection: 'vertical',
3000
+ disableFieldsAutoComplete: false,
3001
+ language: 'en',
2885
3002
  loaderFill: 'surfacePrimary',
2886
3003
  loaderItemFill: 'surfaceItemAccent',
2887
- language: 'en',
2888
- titleSize: 'h1',
2889
- buttonDirection: 'vertical',
2890
- direction: 'vertical',
2891
- disableFieldsAutoComplete: false
3004
+ loaderSet: 'simple',
3005
+ titleSize: 'h1'
2892
3006
  };
2893
3007
 
2894
3008
  const DEFAULT_MESSAGES_FIELDS = {
@@ -3003,4 +3117,4 @@ const DEFAULT_MESSAGES_FIELDS = {
3003
3117
  }
3004
3118
  };
3005
3119
 
3006
- export { CheckboxField as Checkbox, ChoiceField, CodeField, CustomField, DEFAULT_MESSAGES_FIELDS, DatePickerField, FieldWrapper, FieldWrapperBase, FileInput, FinalForm, Group, InputField, MaskedInputField, RadioGroup, SegmentedField, SelectField, SwitchField as Switch, TextareaField as Textarea, addRequiredFieldsParamToSchema, emailValidation, focusOnError, focusOnErrorDecorator, formTypes, generateField, phoneValidation, sendFormDataToServer, setErrorsMutator, useYupValidationSchema };
3120
+ export { CheckboxField as Checkbox, ChipsField, ChoiceField, CodeField, CustomField, DEFAULT_MESSAGES_FIELDS, DatePickerField, FieldWrapper, FieldWrapperBase, FileInput, FinalForm, Group, InputField, MaskedInputField, RadioGroup, SegmentedField, SelectField, SwitchField as Switch, TextareaField as Textarea, addRequiredFieldsParamToSchema, emailValidation, focusOnError, focusOnErrorDecorator, formTypes, generateField, phoneValidation, sendFormDataToServer, setErrorsMutator, useYupValidationSchema };