glints-aries 4.0.228 → 4.0.230

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.
@@ -4,6 +4,7 @@ var _excluded = ["locale", "value", "onChange", "currencyCode", "currencySymbol"
4
4
  import React from 'react';
5
5
  import { Input } from '../Input/Input';
6
6
  export var CurrencyInput = /*#__PURE__*/React.forwardRef(function CurrencyInput(_ref, ref) {
7
+ var _formatter$format;
7
8
  var _ref$locale = _ref.locale,
8
9
  locale = _ref$locale === void 0 ? 'en' : _ref$locale,
9
10
  _ref$value = _ref.value,
@@ -50,7 +51,7 @@ export var CurrencyInput = /*#__PURE__*/React.forwardRef(function CurrencyInput(
50
51
  }
51
52
  return '$';
52
53
  };
53
- var formattedValue = formatter.format(getRawNumber(value.toString()));
54
+ var formattedValue = (_formatter$format = formatter.format(getRawNumber(value.toString()))) != null ? _formatter$format : '';
54
55
  var handleChange = function handleChange(e) {
55
56
  var rawValue = getRawNumber(e.currentTarget.value);
56
57
  onChange(rawValue);
@@ -60,7 +61,7 @@ export var CurrencyInput = /*#__PURE__*/React.forwardRef(function CurrencyInput(
60
61
  type: "text",
61
62
  prefix: /*#__PURE__*/React.createElement("div", null, getCurrencySymbol(localeValue, currencyCode, currencySymbol))
62
63
  }, props, {
63
- value: formattedValue === '0' ? '' : formattedValue,
64
+ value: formattedValue,
64
65
  onChange: handleChange
65
66
  }));
66
67
  });
@@ -26,13 +26,18 @@ export var Modal = /*#__PURE__*/React.forwardRef(function Modal(_ref, ref) {
26
26
  onBack = _ref.onBack,
27
27
  props = _objectWithoutPropertiesLoose(_ref, _excluded);
28
28
  useEffect(function () {
29
+ if (typeof window === 'undefined' || !window.document) return;
30
+ var enableScroll = function enableScroll() {
31
+ document.body.style.overflow = 'unset';
32
+ };
29
33
  if (isOpen) {
30
- if (typeof window != 'undefined' && window.document) {
31
- document.body.style.overflow = 'hidden';
32
- }
34
+ document.body.style.overflow = 'hidden';
33
35
  } else {
34
- document.body.style.overflow = 'unset';
36
+ enableScroll();
35
37
  }
38
+ return function () {
39
+ enableScroll();
40
+ };
36
41
  }, [isOpen]);
37
42
  if (!isOpen) {
38
43
  return null;
@@ -9,6 +9,7 @@ var _react = _interopRequireDefault(require("react"));
9
9
  var _Input = require("../Input/Input");
10
10
  var _excluded = ["locale", "value", "onChange", "currencyCode", "currencySymbol"];
11
11
  var CurrencyInput = /*#__PURE__*/_react["default"].forwardRef(function CurrencyInput(_ref, ref) {
12
+ var _formatter$format;
12
13
  var _ref$locale = _ref.locale,
13
14
  locale = _ref$locale === void 0 ? 'en' : _ref$locale,
14
15
  _ref$value = _ref.value,
@@ -55,7 +56,7 @@ var CurrencyInput = /*#__PURE__*/_react["default"].forwardRef(function CurrencyI
55
56
  }
56
57
  return '$';
57
58
  };
58
- var formattedValue = formatter.format(getRawNumber(value.toString()));
59
+ var formattedValue = (_formatter$format = formatter.format(getRawNumber(value.toString()))) != null ? _formatter$format : '';
59
60
  var handleChange = function handleChange(e) {
60
61
  var rawValue = getRawNumber(e.currentTarget.value);
61
62
  onChange(rawValue);
@@ -65,7 +66,7 @@ var CurrencyInput = /*#__PURE__*/_react["default"].forwardRef(function CurrencyI
65
66
  type: "text",
66
67
  prefix: /*#__PURE__*/_react["default"].createElement("div", null, getCurrencySymbol(localeValue, currencyCode, currencySymbol))
67
68
  }, props, {
68
- value: formattedValue === '0' ? '' : formattedValue,
69
+ value: formattedValue,
69
70
  onChange: handleChange
70
71
  }));
71
72
  });
@@ -33,13 +33,18 @@ var Modal = /*#__PURE__*/_react["default"].forwardRef(function Modal(_ref, ref)
33
33
  onBack = _ref.onBack,
34
34
  props = (0, _objectWithoutPropertiesLoose2["default"])(_ref, _excluded);
35
35
  (0, _react.useEffect)(function () {
36
+ if (typeof window === 'undefined' || !window.document) return;
37
+ var enableScroll = function enableScroll() {
38
+ document.body.style.overflow = 'unset';
39
+ };
36
40
  if (isOpen) {
37
- if (typeof window != 'undefined' && window.document) {
38
- document.body.style.overflow = 'hidden';
39
- }
41
+ document.body.style.overflow = 'hidden';
40
42
  } else {
41
- document.body.style.overflow = 'unset';
43
+ enableScroll();
42
44
  }
45
+ return function () {
46
+ enableScroll();
47
+ };
43
48
  }, [isOpen]);
44
49
  if (!isOpen) {
45
50
  return null;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "glints-aries",
3
- "version": "4.0.228",
3
+ "version": "4.0.230",
4
4
  "description": "Glints ui-kit for frontend",
5
5
  "main": "./lib/index.js",
6
6
  "module": "./es/index.js",