@helpdice/ui 2.6.1-beta.0 → 2.6.1-beta.1

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.
@@ -3715,7 +3715,9 @@ function CurrencyRangeInput(_ref) {
3715
3715
  allowDecimals = _ref.allowDecimals,
3716
3716
  onChange = _ref.onChange,
3717
3717
  intlConfig = _ref.intlConfig,
3718
- children = _ref.children;
3718
+ children = _ref.children,
3719
+ error = _ref.error,
3720
+ helperText = _ref.helperText;
3719
3721
  var _React$useState = React.useState({
3720
3722
  min: '0',
3721
3723
  max: '0',
@@ -3729,13 +3731,9 @@ function CurrencyRangeInput(_ref) {
3729
3731
  var max = parseCurrency(value.max);
3730
3732
  if (max.amount > min.amount) {
3731
3733
  if (onChange) onChange({
3732
- target: {
3733
- value: {
3734
- min: min.amount,
3735
- max: max.amount,
3736
- currency: min.currency
3737
- }
3738
- }
3734
+ min: min.amount,
3735
+ max: max.amount,
3736
+ currency: min.currency
3739
3737
  });
3740
3738
  }
3741
3739
  }, [value]);
@@ -3774,6 +3772,9 @@ function CurrencyRangeInput(_ref) {
3774
3772
  allowDecimals: allowDecimals
3775
3773
  })
3776
3774
  })]
3775
+ }), helperText && /*#__PURE__*/jsxRuntime.jsx(InputError, {
3776
+ error: error,
3777
+ text: helperText
3777
3778
  })]
3778
3779
  });
3779
3780
  }
package/dist/index.js CHANGED
@@ -4052,7 +4052,9 @@ function CurrencyRangeInput(_ref) {
4052
4052
  allowDecimals = _ref.allowDecimals,
4053
4053
  onChange = _ref.onChange,
4054
4054
  intlConfig = _ref.intlConfig,
4055
- children = _ref.children;
4055
+ children = _ref.children,
4056
+ error = _ref.error,
4057
+ helperText = _ref.helperText;
4056
4058
  var _React$useState = React.useState({
4057
4059
  min: '0',
4058
4060
  max: '0',
@@ -4066,13 +4068,9 @@ function CurrencyRangeInput(_ref) {
4066
4068
  var max = parseCurrency(value.max);
4067
4069
  if (max.amount > min.amount) {
4068
4070
  if (onChange) onChange({
4069
- target: {
4070
- value: {
4071
- min: min.amount,
4072
- max: max.amount,
4073
- currency: min.currency
4074
- }
4075
- }
4071
+ min: min.amount,
4072
+ max: max.amount,
4073
+ currency: min.currency
4076
4074
  });
4077
4075
  }
4078
4076
  }, [value]);
@@ -4111,6 +4109,9 @@ function CurrencyRangeInput(_ref) {
4111
4109
  allowDecimals: allowDecimals
4112
4110
  })
4113
4111
  })]
4112
+ }), helperText && /*#__PURE__*/jsxRuntime.jsx(InputError, {
4113
+ error: error,
4114
+ text: helperText
4114
4115
  })]
4115
4116
  });
4116
4117
  }
@@ -3701,7 +3701,9 @@ function CurrencyRangeInput(_ref) {
3701
3701
  allowDecimals = _ref.allowDecimals,
3702
3702
  onChange = _ref.onChange,
3703
3703
  intlConfig = _ref.intlConfig,
3704
- children = _ref.children;
3704
+ children = _ref.children,
3705
+ error = _ref.error,
3706
+ helperText = _ref.helperText;
3705
3707
  var _React$useState = React.useState({
3706
3708
  min: '0',
3707
3709
  max: '0',
@@ -3715,13 +3717,9 @@ function CurrencyRangeInput(_ref) {
3715
3717
  var max = parseCurrency(value.max);
3716
3718
  if (max.amount > min.amount) {
3717
3719
  if (onChange) onChange({
3718
- target: {
3719
- value: {
3720
- min: min.amount,
3721
- max: max.amount,
3722
- currency: min.currency
3723
- }
3724
- }
3720
+ min: min.amount,
3721
+ max: max.amount,
3722
+ currency: min.currency
3725
3723
  });
3726
3724
  }
3727
3725
  }, [value]);
@@ -3760,6 +3758,9 @@ function CurrencyRangeInput(_ref) {
3760
3758
  allowDecimals: allowDecimals
3761
3759
  })
3762
3760
  })]
3761
+ }), helperText && /*#__PURE__*/jsxRuntime.jsx(InputError, {
3762
+ error: error,
3763
+ text: helperText
3763
3764
  })]
3764
3765
  });
3765
3766
  }
@@ -2,7 +2,9 @@ import { CurrencyInputProps } from "./input-currency-props";
2
2
  import React from "react";
3
3
  type Override<T, U> = Omit<T, keyof U> & U;
4
4
  type CurrencyRangeProps = Override<CurrencyInputProps, {
5
- onChange: (e: any) => void;
5
+ onChange: (val: any) => void;
6
+ error?: boolean;
7
+ helperText?: string;
6
8
  }>;
7
- declare function CurrencyRangeInput({ prefix, allowDecimals, onChange, intlConfig, children }: CurrencyRangeProps): React.JSX.Element;
9
+ declare function CurrencyRangeInput({ prefix, allowDecimals, onChange, intlConfig, children, error, helperText }: CurrencyRangeProps): React.JSX.Element;
8
10
  export default CurrencyRangeInput;
@@ -3751,7 +3751,9 @@ function CurrencyRangeInput(_ref) {
3751
3751
  allowDecimals = _ref.allowDecimals,
3752
3752
  onChange = _ref.onChange,
3753
3753
  intlConfig = _ref.intlConfig,
3754
- children = _ref.children;
3754
+ children = _ref.children,
3755
+ error = _ref.error,
3756
+ helperText = _ref.helperText;
3755
3757
  var _React$useState = React.useState({
3756
3758
  min: '0',
3757
3759
  max: '0',
@@ -3765,13 +3767,9 @@ function CurrencyRangeInput(_ref) {
3765
3767
  var max = parseCurrency(value.max);
3766
3768
  if (max.amount > min.amount) {
3767
3769
  if (onChange) onChange({
3768
- target: {
3769
- value: {
3770
- min: min.amount,
3771
- max: max.amount,
3772
- currency: min.currency
3773
- }
3774
- }
3770
+ min: min.amount,
3771
+ max: max.amount,
3772
+ currency: min.currency
3775
3773
  });
3776
3774
  }
3777
3775
  }, [value]);
@@ -3810,6 +3808,9 @@ function CurrencyRangeInput(_ref) {
3810
3808
  allowDecimals: allowDecimals
3811
3809
  })
3812
3810
  })]
3811
+ }), helperText && /*#__PURE__*/jsxRuntime.jsx(InputError, {
3812
+ error: error,
3813
+ text: helperText
3813
3814
  })]
3814
3815
  });
3815
3816
  }
@@ -2,7 +2,9 @@ import { CurrencyInputProps } from "./input-currency-props";
2
2
  import React from "react";
3
3
  type Override<T, U> = Omit<T, keyof U> & U;
4
4
  type CurrencyRangeProps = Override<CurrencyInputProps, {
5
- onChange: (e: any) => void;
5
+ onChange: (val: any) => void;
6
+ error?: boolean;
7
+ helperText?: string;
6
8
  }>;
7
- declare function CurrencyRangeInput({ prefix, allowDecimals, onChange, intlConfig, children }: CurrencyRangeProps): React.JSX.Element;
9
+ declare function CurrencyRangeInput({ prefix, allowDecimals, onChange, intlConfig, children, error, helperText }: CurrencyRangeProps): React.JSX.Element;
8
10
  export default CurrencyRangeInput;
@@ -3,7 +3,7 @@ import _slicedToArray from "@babel/runtime/helpers/esm/slicedToArray";
3
3
  import Grid from "../grid";
4
4
  import Input from ".";
5
5
  import React, { useEffect } from "react";
6
- import InputBlockLabel from "./input-block-label";
6
+ import InputBlockLabel, { InputError } from "./input-block-label";
7
7
  function parseCurrency(value) {
8
8
  var _trimmed$match;
9
9
  var trimmed = value.trim();
@@ -26,7 +26,9 @@ function CurrencyRangeInput(_ref) {
26
26
  allowDecimals = _ref.allowDecimals,
27
27
  onChange = _ref.onChange,
28
28
  intlConfig = _ref.intlConfig,
29
- children = _ref.children;
29
+ children = _ref.children,
30
+ error = _ref.error,
31
+ helperText = _ref.helperText;
30
32
  var _React$useState = React.useState({
31
33
  min: '0',
32
34
  max: '0',
@@ -40,13 +42,9 @@ function CurrencyRangeInput(_ref) {
40
42
  var max = parseCurrency(value.max);
41
43
  if (max.amount > min.amount) {
42
44
  if (onChange) onChange({
43
- target: {
44
- value: {
45
- min: min.amount,
46
- max: max.amount,
47
- currency: min.currency
48
- }
49
- }
45
+ min: min.amount,
46
+ max: max.amount,
47
+ currency: min.currency
50
48
  });
51
49
  }
52
50
  }, [value]);
@@ -78,6 +76,9 @@ function CurrencyRangeInput(_ref) {
78
76
  prefix: prefix,
79
77
  placeholder: "Max",
80
78
  allowDecimals: allowDecimals
81
- }))));
79
+ }))), helperText && /*#__PURE__*/React.createElement(InputError, {
80
+ error: error,
81
+ text: helperText
82
+ }));
82
83
  }
83
84
  export default CurrencyRangeInput;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@helpdice/ui",
3
- "version": "2.6.1-beta.0",
3
+ "version": "2.6.1-beta.1",
4
4
  "main": "dist/index.js",
5
5
  "types": "esm/index.d.ts",
6
6
  "unpkg": "dist/index.min.js",