@itcase/forms 1.1.37 → 1.1.39

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,13 +1,17 @@
1
1
  .form-field {
2
2
  &-switch {
3
3
  width: 100%;
4
- flex-direction: row;
5
4
  padding: 8px 0;
5
+ display: grid !important;
6
+ grid-template-columns: 1fr auto;
6
7
  ^&__label {
7
- flex: 1;
8
8
  display: flex;
9
+ flex: 1;
9
10
  align-items: center;
10
11
  }
12
+ ^&__message {
13
+ grid-column: 1 / span 2;
14
+ }
11
15
  }
12
16
  }
13
17
 
@@ -59,7 +59,7 @@
59
59
  padding: 0 4px;
60
60
  position: absolute;
61
61
  display: flex;
62
- top: 0;
62
+ top: 4px;
63
63
  z-index: 2;
64
64
  transform: scale(1) translate(8px, 20px);
65
65
  transition: all 150ms cubic-bezier(0.4, 0, 0.2, 1);
@@ -1687,8 +1687,6 @@ const FormFieldInput = /*#__PURE__*/React__default.default.memo(function FormFie
1687
1687
  inputProps: inputProps,
1688
1688
  validationStateKey: isErrorState ? errorKey : isValidState ? successKey : null
1689
1689
  });
1690
- console.log('updatedInputProps');
1691
- console.log(updatedInputProps);
1692
1690
  return /*#__PURE__*/React__default.default.createElement(FieldWrapper, Object.assign({
1693
1691
  className: clsx__default.default('form-field_input', 'form__item_input', classNameGroupItem),
1694
1692
  errorKey: errorKey,
@@ -1923,6 +1921,8 @@ const defaultSelectProps = {
1923
1921
  // useValidationAppearanceInputProps
1924
1922
  // Error
1925
1923
  errorAppearance: 'errorPrimary sizeM solid rounded',
1924
+ // Success
1925
+ successAppearance: 'successPrimary sizeM solid rounded',
1926
1926
  // Required
1927
1927
  requiredAppearance: 'requirePrimary sizeM solid rounded'
1928
1928
  };
@@ -2045,6 +2045,8 @@ const defaultSwitchProps = {
2045
2045
  // useValidationAppearanceInputProps
2046
2046
  // Error
2047
2047
  errorAppearance: 'errorPrimary sizeL solid rounded',
2048
+ // Success
2049
+ successAppearance: 'successPrimary sizeL solid rounded',
2048
2050
  // Required
2049
2051
  requiredAppearance: 'requirePrimary sizeL solid rounded'
2050
2052
  };
@@ -2128,6 +2130,8 @@ const defaultTextareaProps = {
2128
2130
  // useValidationAppearanceInputProps
2129
2131
  // Error
2130
2132
  errorAppearance: 'errorPrimary sizeM solid rounded',
2133
+ // Success
2134
+ successAppearance: 'successPrimary sizeM solid rounded',
2131
2135
  // Required
2132
2136
  requiredAppearance: 'requirePrimary sizeM solid rounded'
2133
2137
  };
@@ -2589,6 +2593,9 @@ const setErrorsMutator = (args, state) => {
2589
2593
  // state.formState.valid = false
2590
2594
  state.formState.error = fieldError;
2591
2595
  state.formState.submitError = submitError;
2596
+ console.log('non_field_errors');
2597
+ console.log(data);
2598
+ console.log('non_field_errors');
2592
2599
  } else if (fieldName in state.fields) {
2593
2600
  if (fieldError) {
2594
2601
  const errorsState = Object.assign({}, state.formState.errors, {
@@ -2635,9 +2642,9 @@ const sendFormDataToServer = async (url, data) => {
2635
2642
  });
2636
2643
  }
2637
2644
  return {
2645
+ error,
2638
2646
  success: false,
2639
- formErrors,
2640
- error
2647
+ formErrors
2641
2648
  };
2642
2649
  }
2643
2650
  };
@@ -2732,7 +2739,6 @@ const FinalForm = /*#__PURE__*/React__default.default.forwardRef(function FinalF
2732
2739
  onChangeFormValues,
2733
2740
  onSubmit
2734
2741
  } = props;
2735
- console.log(buttonJustifyContent);
2736
2742
  const validate = useYupValidationSchema(validationSchema, language);
2737
2743
  const onRefFormInstance = React.useCallback(formInstance => {
2738
2744
  if (ref) {
@@ -3105,7 +3111,7 @@ const getErrorsForFinalForm = error => {
3105
3111
  */
3106
3112
 
3107
3113
  const formErrors = {};
3108
- const serverErrors = error.response?.data;
3114
+ const serverErrors = error.response?.data || error;
3109
3115
  if (serverErrors) {
3110
3116
  // Collect errors for some fields, which in the response from server
3111
3117
  if (typeof serverErrors === 'string') {
@@ -1676,8 +1676,6 @@ const FormFieldInput = /*#__PURE__*/React.memo(function FormFieldInput(props) {
1676
1676
  inputProps: inputProps,
1677
1677
  validationStateKey: isErrorState ? errorKey : isValidState ? successKey : null
1678
1678
  });
1679
- console.log('updatedInputProps');
1680
- console.log(updatedInputProps);
1681
1679
  return /*#__PURE__*/React.createElement(FieldWrapper, Object.assign({
1682
1680
  className: clsx('form-field_input', 'form__item_input', classNameGroupItem),
1683
1681
  errorKey: errorKey,
@@ -1912,6 +1910,8 @@ const defaultSelectProps = {
1912
1910
  // useValidationAppearanceInputProps
1913
1911
  // Error
1914
1912
  errorAppearance: 'errorPrimary sizeM solid rounded',
1913
+ // Success
1914
+ successAppearance: 'successPrimary sizeM solid rounded',
1915
1915
  // Required
1916
1916
  requiredAppearance: 'requirePrimary sizeM solid rounded'
1917
1917
  };
@@ -2034,6 +2034,8 @@ const defaultSwitchProps = {
2034
2034
  // useValidationAppearanceInputProps
2035
2035
  // Error
2036
2036
  errorAppearance: 'errorPrimary sizeL solid rounded',
2037
+ // Success
2038
+ successAppearance: 'successPrimary sizeL solid rounded',
2037
2039
  // Required
2038
2040
  requiredAppearance: 'requirePrimary sizeL solid rounded'
2039
2041
  };
@@ -2117,6 +2119,8 @@ const defaultTextareaProps = {
2117
2119
  // useValidationAppearanceInputProps
2118
2120
  // Error
2119
2121
  errorAppearance: 'errorPrimary sizeM solid rounded',
2122
+ // Success
2123
+ successAppearance: 'successPrimary sizeM solid rounded',
2120
2124
  // Required
2121
2125
  requiredAppearance: 'requirePrimary sizeM solid rounded'
2122
2126
  };
@@ -2578,6 +2582,9 @@ const setErrorsMutator = (args, state) => {
2578
2582
  // state.formState.valid = false
2579
2583
  state.formState.error = fieldError;
2580
2584
  state.formState.submitError = submitError;
2585
+ console.log('non_field_errors');
2586
+ console.log(data);
2587
+ console.log('non_field_errors');
2581
2588
  } else if (fieldName in state.fields) {
2582
2589
  if (fieldError) {
2583
2590
  const errorsState = Object.assign({}, state.formState.errors, {
@@ -2624,9 +2631,9 @@ const sendFormDataToServer = async (url, data) => {
2624
2631
  });
2625
2632
  }
2626
2633
  return {
2634
+ error,
2627
2635
  success: false,
2628
- formErrors,
2629
- error
2636
+ formErrors
2630
2637
  };
2631
2638
  }
2632
2639
  };
@@ -2721,7 +2728,6 @@ const FinalForm = /*#__PURE__*/React.forwardRef(function FinalForm(props, ref) {
2721
2728
  onChangeFormValues,
2722
2729
  onSubmit
2723
2730
  } = props;
2724
- console.log(buttonJustifyContent);
2725
2731
  const validate = useYupValidationSchema(validationSchema, language);
2726
2732
  const onRefFormInstance = useCallback(formInstance => {
2727
2733
  if (ref) {
@@ -3094,7 +3100,7 @@ const getErrorsForFinalForm = error => {
3094
3100
  */
3095
3101
 
3096
3102
  const formErrors = {};
3097
- const serverErrors = error.response?.data;
3103
+ const serverErrors = error.response?.data || error;
3098
3104
  if (serverErrors) {
3099
3105
  // Collect errors for some fields, which in the response from server
3100
3106
  if (typeof serverErrors === 'string') {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@itcase/forms",
3
- "version": "1.1.37",
3
+ "version": "1.1.39",
4
4
  "description": "Forms fields, inputs, etc.",
5
5
  "keywords": [],
6
6
  "license": "MIT",