@itcase/forms 1.1.28 → 1.1.30

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.
@@ -190,8 +190,8 @@ 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
@@ -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);
@@ -1677,12 +1677,6 @@ 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,
@@ -1719,10 +1713,10 @@ const FormFieldPassword = /*#__PURE__*/React__default.default.memo(function Form
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
  });
@@ -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,7 @@ const FinalForm = /*#__PURE__*/React__default.default.forwardRef(function FinalF
2709
2704
  notificationCloseButton,
2710
2705
  notificationType,
2711
2706
  renderFieldsWrapper = wrapperChildren => wrapperChildren,
2712
- validationSchema,
2707
+ shapeStrengthClass,
2713
2708
  before,
2714
2709
  after,
2715
2710
  isLoading,
@@ -2743,16 +2738,16 @@ const FinalForm = /*#__PURE__*/React__default.default.forwardRef(function FinalF
2743
2738
  modifiedSinceLastSubmit
2744
2739
  }) => {
2745
2740
  return /*#__PURE__*/React__default.default.createElement("form", {
2746
- className: clsx__default.default(className, 'form', type && `form_type_${type}`, buttonPosition && `form_button-position_${buttonPosition}`, directionClass, fillClass, shapeClass, elevationClass),
2747
- name: formName,
2741
+ className: clsx__default.default(className, 'form', type && `form_type_${type}`, buttonPosition && `form_button-position_${buttonPosition}`, directionClass && `direction_${directionClass}`, fillClass && `fill_${fillClass}`, shapeClass && `shape_${shapeClass}`, shapeStrengthClass && `shape-strength_${shapeStrengthClass}`, elevationClass && `elevation_${elevationClass}`),
2742
+ name: formName
2743
+ // We no need set reference to html element, we need reference to "final-form" instance
2744
+ ,
2745
+ ref: () => onRefFormInstance(form),
2748
2746
  autoCapitalize: disableFieldsAutoComplete ? 'off' : undefined,
2749
2747
  autoComplete: disableFieldsAutoComplete ? 'off' : undefined,
2750
2748
  autoCorrect: disableFieldsAutoComplete ? 'off' : undefined,
2751
2749
  "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),
2750
+ "data-tour": dataTour,
2756
2751
  spellCheck: disableFieldsAutoComplete ? 'false' : undefined,
2757
2752
  style: formStyles,
2758
2753
  onSubmit: handleSubmit
@@ -2781,7 +2776,7 @@ const FinalForm = /*#__PURE__*/React__default.default.forwardRef(function FinalF
2781
2776
  values: true
2782
2777
  },
2783
2778
  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, {
2779
+ }), 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
2780
  className: "form__wrapper",
2786
2781
  direction: "vertical",
2787
2782
  gap: fieldsGap || groupGap,
@@ -2798,15 +2793,17 @@ const FinalForm = /*#__PURE__*/React__default.default.forwardRef(function FinalF
2798
2793
  itemFill: loaderItemFill,
2799
2794
  shape: loaderShape
2800
2795
  }))))), (primaryButtonLabel || primaryButton || secondaryButtonLabel || secondaryButton || tertiaryButton || tertiaryButtonLabel) && /*#__PURE__*/React__default.default.createElement(Group.Group, {
2796
+ dataTestId: dataTestIdButtons,
2797
+ dataTour: dataTourButtons,
2801
2798
  className: "form__button",
2802
2799
  direction: buttonDirection,
2803
2800
  justifyContent: buttonJustifyContent,
2804
2801
  fill: buttonFill,
2805
2802
  padding: buttonPadding,
2806
- gap: buttonGap,
2807
- dataTestId: dataTestIdButtons,
2808
- dataTour: dataTourButtons
2803
+ gap: buttonGap
2809
2804
  }, primaryButtonLabel ? /*#__PURE__*/React__default.default.createElement(Button.Button, {
2805
+ dataTestId: dataTestIdPrimaryButton,
2806
+ dataTour: dataTourPrimaryButton,
2810
2807
  className: "form__button-item",
2811
2808
  appearance: primaryButtonAppearance,
2812
2809
  width: "fill",
@@ -2818,10 +2815,10 @@ const FinalForm = /*#__PURE__*/React__default.default.forwardRef(function FinalF
2818
2815
  labelTextSize: primaryButtonLabelSize,
2819
2816
  labelTextWeight: primaryButtonLabelTextWeight,
2820
2817
  isDisabled: primaryButtonIsDisabled,
2821
- dataTestId: dataTestIdPrimaryButton,
2822
- dataTour: dataTourPrimaryButton,
2823
2818
  loading: primaryButtonIsLoading
2824
2819
  }) : primaryButton, secondaryButtonLabel ? /*#__PURE__*/React__default.default.createElement(Button.Button, {
2820
+ dataTestId: dataTestIdSecondaryButton,
2821
+ dataTour: dataTourSecondaryButton,
2825
2822
  className: "form__button-item",
2826
2823
  appearance: secondaryButtonAppearance,
2827
2824
  width: "fill",
@@ -2833,11 +2830,11 @@ const FinalForm = /*#__PURE__*/React__default.default.forwardRef(function FinalF
2833
2830
  labelTextSize: secondaryButtonLabelSize,
2834
2831
  labelTextWeight: secondaryButtonLabelTextWeight,
2835
2832
  isDisabled: secondaryButtonIsDisabled,
2836
- dataTestId: dataTestIdSecondaryButton,
2837
- dataTour: dataTourSecondaryButton,
2838
2833
  loading: secondaryButtonIsLoading,
2839
2834
  onClick: onClickSecondaryButton
2840
2835
  }) : secondaryButton, tertiaryButtonLabel ? /*#__PURE__*/React__default.default.createElement(Button.Button, {
2836
+ dataTestId: dataTestIdTertiaryButton,
2837
+ dataTour: dataTourTertiaryButton,
2841
2838
  className: "form__button-item",
2842
2839
  width: "fill",
2843
2840
  size: tertiaryButtonSize,
@@ -2847,8 +2844,6 @@ const FinalForm = /*#__PURE__*/React__default.default.forwardRef(function FinalF
2847
2844
  labelTextColor: tertiaryButtonLabelTextColor,
2848
2845
  labelTextSize: tertiaryButtonLabelSize,
2849
2846
  labelTextWeight: tertiaryButtonLabelTextWeight,
2850
- dataTestId: dataTestIdTertiaryButton,
2851
- dataTour: dataTourTertiaryButton,
2852
2847
  onClick: onClickTertiaryButton
2853
2848
  }) : tertiaryButton), after);
2854
2849
  },
@@ -179,8 +179,8 @@ function useFieldValidationState(props) {
179
179
  // looks at what props were in initialProps, if they are there then changes
180
180
  function useValidationAppearanceInputProps(props) {
181
181
  const {
182
- validationStateKey,
183
- inputProps
182
+ inputProps,
183
+ validationStateKey
184
184
  } = props;
185
185
 
186
186
  // TODO: need to add props that can change during errors in this field
@@ -194,7 +194,7 @@ function useValidationAppearanceInputProps(props) {
194
194
  // }
195
195
  const updatedInputProps = {};
196
196
  if (validationStateKey) {
197
- Object.entries(inputProps).forEach(([propKey, propValue]) => {
197
+ Object.entries(inputProps || {}).forEach(([propKey, propValue]) => {
198
198
  // Convert the input property key to "snake_case" format.
199
199
  // e.g. "requiredBorderColor" -> "required_border_color".
200
200
  const propKeySnake = snakeCase(propKey);
@@ -1666,12 +1666,6 @@ const FormFieldPassword = /*#__PURE__*/React.memo(function FormFieldPassword(pro
1666
1666
  isDisabled,
1667
1667
  classNameGroupItem,
1668
1668
  fieldProps,
1669
- iconFill,
1670
- iconFillHover,
1671
- iconRevealableHide,
1672
- iconRevealableShow,
1673
- iconShape,
1674
- iconSize,
1675
1669
  inputProps,
1676
1670
  parse,
1677
1671
  showMessage,
@@ -1708,10 +1702,10 @@ const FormFieldPassword = /*#__PURE__*/React.memo(function FormFieldPassword(pro
1708
1702
  }
1709
1703
  }, [onChange, input.onChange]);
1710
1704
  const {
1711
- isErrorState,
1712
- isValidState,
1713
1705
  errorKey,
1714
- errorMessage
1706
+ errorMessage,
1707
+ isErrorState,
1708
+ isValidState
1715
1709
  } = useFieldValidationState({
1716
1710
  fieldProps: fieldProps,
1717
1711
  input: input,
@@ -1748,9 +1742,9 @@ const FormFieldPassword = /*#__PURE__*/React.memo(function FormFieldPassword(pro
1748
1742
  onFocus: input.onFocus
1749
1743
  }, updatedInputProps)), /*#__PURE__*/React.createElement(Icon, {
1750
1744
  className: "form-field__icon",
1751
- size: inputProps.iconSize,
1752
- iconFill: inputProps.iconFill,
1753
- SvgImage: isRevealed ? inputProps.iconRevealableHide : inputProps.iconRevealableShow,
1745
+ size: inputProps?.iconSize,
1746
+ iconFill: inputProps?.iconFill,
1747
+ SvgImage: isRevealed ? inputProps?.iconRevealableHide : inputProps?.iconRevealableShow,
1754
1748
  onClick: onClickIconReveal
1755
1749
  }));
1756
1750
  });
@@ -2618,11 +2612,14 @@ const sendFormDataToServer = async (url, data) => {
2618
2612
 
2619
2613
  const FinalForm = /*#__PURE__*/React.forwardRef(function FinalForm(props, ref) {
2620
2614
  const {
2615
+ dataTestId,
2616
+ dataTour,
2621
2617
  className,
2622
2618
  type,
2623
2619
  initialValues,
2624
2620
  initialValuesEqual,
2625
2621
  config,
2622
+ validationSchema,
2626
2623
  title,
2627
2624
  titleFill,
2628
2625
  titleTextColor,
@@ -2632,6 +2629,7 @@ const FinalForm = /*#__PURE__*/React.forwardRef(function FinalForm(props, ref) {
2632
2629
  descSize,
2633
2630
  descTextColor,
2634
2631
  descTextWeight,
2632
+ buttonGap,
2635
2633
  dataTestIdPrimaryButton,
2636
2634
  dataTourPrimaryButton,
2637
2635
  primaryButton,
@@ -2673,13 +2671,10 @@ const FinalForm = /*#__PURE__*/React.forwardRef(function FinalForm(props, ref) {
2673
2671
  additionalProps = {},
2674
2672
  buttonDirection = 'vertical',
2675
2673
  buttonFill,
2676
- buttonGap,
2677
2674
  buttonJustifyContent,
2678
2675
  buttonPadding,
2679
2676
  buttonPosition,
2680
- dataTestId,
2681
2677
  dataTestIdButtons,
2682
- dataTour,
2683
2678
  dataTourButtons,
2684
2679
  disableFieldsAutoComplete = false,
2685
2680
  fieldsGap,
@@ -2698,7 +2693,7 @@ const FinalForm = /*#__PURE__*/React.forwardRef(function FinalForm(props, ref) {
2698
2693
  notificationCloseButton,
2699
2694
  notificationType,
2700
2695
  renderFieldsWrapper = wrapperChildren => wrapperChildren,
2701
- validationSchema,
2696
+ shapeStrengthClass,
2702
2697
  before,
2703
2698
  after,
2704
2699
  isLoading,
@@ -2732,16 +2727,16 @@ const FinalForm = /*#__PURE__*/React.forwardRef(function FinalForm(props, ref) {
2732
2727
  modifiedSinceLastSubmit
2733
2728
  }) => {
2734
2729
  return /*#__PURE__*/React.createElement("form", {
2735
- className: clsx(className, 'form', type && `form_type_${type}`, buttonPosition && `form_button-position_${buttonPosition}`, directionClass, fillClass, shapeClass, elevationClass),
2736
- name: formName,
2730
+ className: clsx(className, 'form', type && `form_type_${type}`, buttonPosition && `form_button-position_${buttonPosition}`, directionClass && `direction_${directionClass}`, fillClass && `fill_${fillClass}`, shapeClass && `shape_${shapeClass}`, shapeStrengthClass && `shape-strength_${shapeStrengthClass}`, elevationClass && `elevation_${elevationClass}`),
2731
+ name: formName
2732
+ // We no need set reference to html element, we need reference to "final-form" instance
2733
+ ,
2734
+ ref: () => onRefFormInstance(form),
2737
2735
  autoCapitalize: disableFieldsAutoComplete ? 'off' : undefined,
2738
2736
  autoComplete: disableFieldsAutoComplete ? 'off' : undefined,
2739
2737
  autoCorrect: disableFieldsAutoComplete ? 'off' : undefined,
2740
2738
  "data-test-id": dataTestId,
2741
- "data-tour": dataTour
2742
- // We no need set reference to html element, we need reference to "final-form" instance
2743
- ,
2744
- ref: () => onRefFormInstance(form),
2739
+ "data-tour": dataTour,
2745
2740
  spellCheck: disableFieldsAutoComplete ? 'false' : undefined,
2746
2741
  style: formStyles,
2747
2742
  onSubmit: handleSubmit
@@ -2770,7 +2765,7 @@ const FinalForm = /*#__PURE__*/React.forwardRef(function FinalForm(props, ref) {
2770
2765
  values: true
2771
2766
  },
2772
2767
  onChange: onChangeFormValues
2773
- }), Boolean(Object.keys(config).length) && /*#__PURE__*/React.createElement(React.Fragment, null, renderFieldsWrapper(/*#__PURE__*/React.createElement(Group, {
2768
+ }), Boolean(config && Object.keys(config).length) && /*#__PURE__*/React.createElement(React.Fragment, null, renderFieldsWrapper(/*#__PURE__*/React.createElement(Group, {
2774
2769
  className: "form__wrapper",
2775
2770
  direction: "vertical",
2776
2771
  gap: fieldsGap || groupGap,
@@ -2787,15 +2782,17 @@ const FinalForm = /*#__PURE__*/React.forwardRef(function FinalForm(props, ref) {
2787
2782
  itemFill: loaderItemFill,
2788
2783
  shape: loaderShape
2789
2784
  }))))), (primaryButtonLabel || primaryButton || secondaryButtonLabel || secondaryButton || tertiaryButton || tertiaryButtonLabel) && /*#__PURE__*/React.createElement(Group, {
2785
+ dataTestId: dataTestIdButtons,
2786
+ dataTour: dataTourButtons,
2790
2787
  className: "form__button",
2791
2788
  direction: buttonDirection,
2792
2789
  justifyContent: buttonJustifyContent,
2793
2790
  fill: buttonFill,
2794
2791
  padding: buttonPadding,
2795
- gap: buttonGap,
2796
- dataTestId: dataTestIdButtons,
2797
- dataTour: dataTourButtons
2792
+ gap: buttonGap
2798
2793
  }, primaryButtonLabel ? /*#__PURE__*/React.createElement(Button, {
2794
+ dataTestId: dataTestIdPrimaryButton,
2795
+ dataTour: dataTourPrimaryButton,
2799
2796
  className: "form__button-item",
2800
2797
  appearance: primaryButtonAppearance,
2801
2798
  width: "fill",
@@ -2807,10 +2804,10 @@ const FinalForm = /*#__PURE__*/React.forwardRef(function FinalForm(props, ref) {
2807
2804
  labelTextSize: primaryButtonLabelSize,
2808
2805
  labelTextWeight: primaryButtonLabelTextWeight,
2809
2806
  isDisabled: primaryButtonIsDisabled,
2810
- dataTestId: dataTestIdPrimaryButton,
2811
- dataTour: dataTourPrimaryButton,
2812
2807
  loading: primaryButtonIsLoading
2813
2808
  }) : primaryButton, secondaryButtonLabel ? /*#__PURE__*/React.createElement(Button, {
2809
+ dataTestId: dataTestIdSecondaryButton,
2810
+ dataTour: dataTourSecondaryButton,
2814
2811
  className: "form__button-item",
2815
2812
  appearance: secondaryButtonAppearance,
2816
2813
  width: "fill",
@@ -2822,11 +2819,11 @@ const FinalForm = /*#__PURE__*/React.forwardRef(function FinalForm(props, ref) {
2822
2819
  labelTextSize: secondaryButtonLabelSize,
2823
2820
  labelTextWeight: secondaryButtonLabelTextWeight,
2824
2821
  isDisabled: secondaryButtonIsDisabled,
2825
- dataTestId: dataTestIdSecondaryButton,
2826
- dataTour: dataTourSecondaryButton,
2827
2822
  loading: secondaryButtonIsLoading,
2828
2823
  onClick: onClickSecondaryButton
2829
2824
  }) : secondaryButton, tertiaryButtonLabel ? /*#__PURE__*/React.createElement(Button, {
2825
+ dataTestId: dataTestIdTertiaryButton,
2826
+ dataTour: dataTourTertiaryButton,
2830
2827
  className: "form__button-item",
2831
2828
  width: "fill",
2832
2829
  size: tertiaryButtonSize,
@@ -2836,8 +2833,6 @@ const FinalForm = /*#__PURE__*/React.forwardRef(function FinalForm(props, ref) {
2836
2833
  labelTextColor: tertiaryButtonLabelTextColor,
2837
2834
  labelTextSize: tertiaryButtonLabelSize,
2838
2835
  labelTextWeight: tertiaryButtonLabelTextWeight,
2839
- dataTestId: dataTestIdTertiaryButton,
2840
- dataTour: dataTourTertiaryButton,
2841
2836
  onClick: onClickTertiaryButton
2842
2837
  }) : tertiaryButton), after);
2843
2838
  },
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@itcase/forms",
3
- "version": "1.1.28",
3
+ "version": "1.1.30",
4
4
  "description": "Forms fields, inputs, etc.",
5
5
  "keywords": [],
6
6
  "license": "MIT",