@panneau/display-unit 3.0.133 → 3.0.137

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.
package/es/index.js CHANGED
@@ -5,18 +5,21 @@ import { formatDuration } from '@panneau/core/utils';
5
5
 
6
6
  /* eslint-disable react/jsx-no-useless-fragment */
7
7
  var propTypes = {
8
+ value: PropTypes.oneOfType([PropTypes.string, PropTypes.number]),
9
+ placeholder: PropTypes.oneOfType([PropTypes.node, PropTypes.string]),
8
10
  format: PropTypes.string,
9
- suffix: PropTypes.string,
10
- value: PropTypes.oneOfType([PropTypes.string, PropTypes.number])
11
+ suffix: PropTypes.string
11
12
  };
12
13
  var defaultProps = {
14
+ value: null,
15
+ placeholder: null,
13
16
  format: null,
14
- suffix: null,
15
- value: null
17
+ suffix: null
16
18
  };
17
19
  var Unit = function Unit(_ref) {
18
- var format = _ref.format,
19
- value = _ref.value,
20
+ var value = _ref.value,
21
+ placeholder = _ref.placeholder,
22
+ format = _ref.format,
20
23
  suffix = _ref.suffix;
21
24
  var finalValue = useMemo(function () {
22
25
  if (value === null) {
@@ -46,7 +49,7 @@ var Unit = function Unit(_ref) {
46
49
  }, [value]);
47
50
  return /*#__PURE__*/React.createElement("span", {
48
51
  className: "text-nowrap"
49
- }, finalValue);
52
+ }, finalValue || placeholder);
50
53
  };
51
54
  Unit.propTypes = propTypes;
52
55
  Unit.defaultProps = defaultProps;
package/lib/index.js CHANGED
@@ -9,18 +9,21 @@ var utils = require('@panneau/core/utils');
9
9
 
10
10
  /* eslint-disable react/jsx-no-useless-fragment */
11
11
  var propTypes = {
12
+ value: PropTypes.oneOfType([PropTypes.string, PropTypes.number]),
13
+ placeholder: PropTypes.oneOfType([PropTypes.node, PropTypes.string]),
12
14
  format: PropTypes.string,
13
- suffix: PropTypes.string,
14
- value: PropTypes.oneOfType([PropTypes.string, PropTypes.number])
15
+ suffix: PropTypes.string
15
16
  };
16
17
  var defaultProps = {
18
+ value: null,
19
+ placeholder: null,
17
20
  format: null,
18
- suffix: null,
19
- value: null
21
+ suffix: null
20
22
  };
21
23
  var Unit = function Unit(_ref) {
22
- var format = _ref.format,
23
- value = _ref.value,
24
+ var value = _ref.value,
25
+ placeholder = _ref.placeholder,
26
+ format = _ref.format,
24
27
  suffix = _ref.suffix;
25
28
  var finalValue = React.useMemo(function () {
26
29
  if (value === null) {
@@ -50,7 +53,7 @@ var Unit = function Unit(_ref) {
50
53
  }, [value]);
51
54
  return /*#__PURE__*/React.createElement("span", {
52
55
  className: "text-nowrap"
53
- }, finalValue);
56
+ }, finalValue || placeholder);
54
57
  };
55
58
  Unit.propTypes = propTypes;
56
59
  Unit.defaultProps = defaultProps;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@panneau/display-unit",
3
- "version": "3.0.133",
3
+ "version": "3.0.137",
4
4
  "description": "Unit display",
5
5
  "keywords": [
6
6
  "javascript"
@@ -46,8 +46,8 @@
46
46
  },
47
47
  "dependencies": {
48
48
  "@babel/runtime": "^7.12.5",
49
- "@panneau/core": "^3.0.133",
50
- "@panneau/themes": "^3.0.133",
49
+ "@panneau/core": "^3.0.136",
50
+ "@panneau/themes": "^3.0.136",
51
51
  "lodash": "^4.17.21",
52
52
  "pretty-bytes": "^6.1.1",
53
53
  "prop-types": "^15.7.2",
@@ -56,5 +56,5 @@
56
56
  "publishConfig": {
57
57
  "access": "public"
58
58
  },
59
- "gitHead": "75cf7713976a4b1c04991285984ab634f767b4e6"
59
+ "gitHead": "15122b8a8fa0e7b58a45d235171bbedd2e935d30"
60
60
  }