@elliemae/ds-notification-badge 2.4.2-rc.9 → 2.4.2
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/cjs/NotificationBadge.js +7 -8
- package/cjs/style.js +3 -3
- package/esm/NotificationBadge.js +4 -5
- package/esm/style.js +3 -3
- package/package.json +2 -2
package/cjs/NotificationBadge.js
CHANGED
|
@@ -2,15 +2,14 @@
|
|
|
2
2
|
|
|
3
3
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
4
|
|
|
5
|
-
var _defineProperty = require('@babel/runtime/helpers/defineProperty');
|
|
6
|
-
var _jsx = require('@babel/runtime/helpers/jsx');
|
|
7
|
-
var _objectWithoutProperties = require('@babel/runtime/helpers/objectWithoutProperties');
|
|
8
|
-
require('core-js/modules/web.dom-collections.iterator.js');
|
|
9
5
|
require('core-js/modules/esnext.async-iterator.filter.js');
|
|
10
6
|
require('core-js/modules/esnext.iterator.constructor.js');
|
|
11
7
|
require('core-js/modules/esnext.iterator.filter.js');
|
|
12
8
|
require('core-js/modules/esnext.async-iterator.for-each.js');
|
|
13
9
|
require('core-js/modules/esnext.iterator.for-each.js');
|
|
10
|
+
var _defineProperty = require('@babel/runtime/helpers/defineProperty');
|
|
11
|
+
var _jsx = require('@babel/runtime/helpers/jsx');
|
|
12
|
+
var _objectWithoutProperties = require('@babel/runtime/helpers/objectWithoutProperties');
|
|
14
13
|
var react = require('react');
|
|
15
14
|
var dsPropsHelpers = require('@elliemae/ds-props-helpers');
|
|
16
15
|
var reactDescPropTypes = require('./react-desc-prop-types.js');
|
|
@@ -44,13 +43,13 @@ const NotificationBadge = props => {
|
|
|
44
43
|
} = propsWithDefaults;
|
|
45
44
|
const Badge = type === 'number' ? style.NumericBadge : style.DotBadge;
|
|
46
45
|
const relatedComponentRef = react.useRef(null);
|
|
47
|
-
const renderBadge =
|
|
46
|
+
const renderBadge = relatedComponentRef?.current || !Component;
|
|
48
47
|
const [relatedComponentHeight, setRelatedComponentHeight] = react.useState(0);
|
|
49
48
|
const [relatedComponentWidth, setRelatedComponentWidth] = react.useState(0);
|
|
50
49
|
react.useEffect(() => {
|
|
51
|
-
const relatedComponent = relatedComponentRef
|
|
52
|
-
setRelatedComponentHeight(
|
|
53
|
-
setRelatedComponentWidth(
|
|
50
|
+
const relatedComponent = relatedComponentRef?.current;
|
|
51
|
+
setRelatedComponentHeight(relatedComponent?.offsetHeight || 0);
|
|
52
|
+
setRelatedComponentWidth(relatedComponent?.offsetWidth || 0);
|
|
54
53
|
}, [relatedComponentRef]);
|
|
55
54
|
let top = 0;
|
|
56
55
|
let right = 0;
|
package/cjs/style.js
CHANGED
|
@@ -17,17 +17,17 @@ const GenericBadge = /*#__PURE__*/styled__default["default"].span.withConfig({
|
|
|
17
17
|
let {
|
|
18
18
|
top
|
|
19
19
|
} = _ref;
|
|
20
|
-
return top ?
|
|
20
|
+
return top ? `${top}px` : 'unset';
|
|
21
21
|
}, _ref2 => {
|
|
22
22
|
let {
|
|
23
23
|
left
|
|
24
24
|
} = _ref2;
|
|
25
|
-
return left ?
|
|
25
|
+
return left ? `${left}px` : 'unset';
|
|
26
26
|
}, _ref3 => {
|
|
27
27
|
let {
|
|
28
28
|
right
|
|
29
29
|
} = _ref3;
|
|
30
|
-
return right ?
|
|
30
|
+
return right ? `${right}px` : 'unset';
|
|
31
31
|
});
|
|
32
32
|
const NumericBadge = /*#__PURE__*/styled__default["default"](GenericBadge).withConfig({
|
|
33
33
|
componentId: "sc-lsxuo6-2"
|
package/esm/NotificationBadge.js
CHANGED
|
@@ -6,7 +6,6 @@ import 'core-js/modules/esnext.iterator.for-each.js';
|
|
|
6
6
|
import _defineProperty from '@babel/runtime/helpers/esm/defineProperty';
|
|
7
7
|
import _jsx from '@babel/runtime/helpers/esm/jsx';
|
|
8
8
|
import _objectWithoutProperties from '@babel/runtime/helpers/esm/objectWithoutProperties';
|
|
9
|
-
import 'core-js/modules/web.dom-collections.iterator.js';
|
|
10
9
|
import { useRef, useState, useEffect } from 'react';
|
|
11
10
|
import { describe, useMemoMergePropsWithDefault, useValidateTypescriptPropTypes, useGetGlobalAttributes } from '@elliemae/ds-props-helpers';
|
|
12
11
|
import { NotificationBadgePropTypes, defaultProps } from './react-desc-prop-types.js';
|
|
@@ -34,13 +33,13 @@ const NotificationBadge = props => {
|
|
|
34
33
|
} = propsWithDefaults;
|
|
35
34
|
const Badge = type === 'number' ? NumericBadge : DotBadge;
|
|
36
35
|
const relatedComponentRef = useRef(null);
|
|
37
|
-
const renderBadge =
|
|
36
|
+
const renderBadge = relatedComponentRef?.current || !Component;
|
|
38
37
|
const [relatedComponentHeight, setRelatedComponentHeight] = useState(0);
|
|
39
38
|
const [relatedComponentWidth, setRelatedComponentWidth] = useState(0);
|
|
40
39
|
useEffect(() => {
|
|
41
|
-
const relatedComponent = relatedComponentRef
|
|
42
|
-
setRelatedComponentHeight(
|
|
43
|
-
setRelatedComponentWidth(
|
|
40
|
+
const relatedComponent = relatedComponentRef?.current;
|
|
41
|
+
setRelatedComponentHeight(relatedComponent?.offsetHeight || 0);
|
|
42
|
+
setRelatedComponentWidth(relatedComponent?.offsetWidth || 0);
|
|
44
43
|
}, [relatedComponentRef]);
|
|
45
44
|
let top = 0;
|
|
46
45
|
let right = 0;
|
package/esm/style.js
CHANGED
|
@@ -9,17 +9,17 @@ const GenericBadge = /*#__PURE__*/styled.span.withConfig({
|
|
|
9
9
|
let {
|
|
10
10
|
top
|
|
11
11
|
} = _ref;
|
|
12
|
-
return top ?
|
|
12
|
+
return top ? `${top}px` : 'unset';
|
|
13
13
|
}, _ref2 => {
|
|
14
14
|
let {
|
|
15
15
|
left
|
|
16
16
|
} = _ref2;
|
|
17
|
-
return left ?
|
|
17
|
+
return left ? `${left}px` : 'unset';
|
|
18
18
|
}, _ref3 => {
|
|
19
19
|
let {
|
|
20
20
|
right
|
|
21
21
|
} = _ref3;
|
|
22
|
-
return right ?
|
|
22
|
+
return right ? `${right}px` : 'unset';
|
|
23
23
|
});
|
|
24
24
|
const NumericBadge = /*#__PURE__*/styled(GenericBadge).withConfig({
|
|
25
25
|
componentId: "sc-lsxuo6-2"
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@elliemae/ds-notification-badge",
|
|
3
|
-
"version": "2.4.2
|
|
3
|
+
"version": "2.4.2",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"description": "ICE MT - Dimsum - Notification Badge",
|
|
6
6
|
"module": "./esm/index.js",
|
|
@@ -44,7 +44,7 @@
|
|
|
44
44
|
"build": "node ../../scripts/build/build.js"
|
|
45
45
|
},
|
|
46
46
|
"dependencies": {
|
|
47
|
-
"@elliemae/ds-props-helpers": "2.4.2
|
|
47
|
+
"@elliemae/ds-props-helpers": "2.4.2"
|
|
48
48
|
},
|
|
49
49
|
"peerDependencies": {
|
|
50
50
|
"react": "^17.0.2",
|