@elliemae/ds-notification-badge 2.0.0-alpha.9 → 2.0.0-next.12
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 +10 -8
- package/cjs/style.js +69 -32
- package/esm/NotificationBadge.js +10 -8
- package/esm/style.js +69 -32
- package/package.json +3 -3
- package/cjs/package.json +0 -7
- package/esm/package.json +0 -7
package/cjs/NotificationBadge.js
CHANGED
|
@@ -3,6 +3,7 @@
|
|
|
3
3
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
4
|
|
|
5
5
|
var _jsx = require('@babel/runtime/helpers/jsx');
|
|
6
|
+
require('core-js/modules/web.dom-collections.iterator.js');
|
|
6
7
|
var react = require('react');
|
|
7
8
|
var reactDesc = require('react-desc');
|
|
8
9
|
var propTypes = require('./prop-types.js');
|
|
@@ -12,14 +13,15 @@ function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'defau
|
|
|
12
13
|
|
|
13
14
|
var _jsx__default = /*#__PURE__*/_interopDefaultLegacy(_jsx);
|
|
14
15
|
|
|
15
|
-
const NotificationBadge =
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
16
|
+
const NotificationBadge = _ref => {
|
|
17
|
+
let {
|
|
18
|
+
type,
|
|
19
|
+
value,
|
|
20
|
+
size,
|
|
21
|
+
disabled,
|
|
22
|
+
position,
|
|
23
|
+
Component
|
|
24
|
+
} = _ref;
|
|
23
25
|
const Badge = type === 'number' ? style.NumericBadge : style.DotBadge;
|
|
24
26
|
const relatedComponentRef = react.useRef(null);
|
|
25
27
|
const renderBadge = (relatedComponentRef === null || relatedComponentRef === void 0 ? void 0 : relatedComponentRef.current) || !Component;
|
package/cjs/style.js
CHANGED
|
@@ -13,32 +13,60 @@ const Wrapper = /*#__PURE__*/styled__default["default"].div.withConfig({
|
|
|
13
13
|
})(["display:flex;flex-direction:column;justify-content:center;align-items:center;width:fit-content;"]);
|
|
14
14
|
const GenericBadge = /*#__PURE__*/styled__default["default"].span.withConfig({
|
|
15
15
|
componentId: "sc-lsxuo6-1"
|
|
16
|
-
})(["position:relative;top:", ";left:", ";right:", ";"],
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
16
|
+
})(["position:relative;top:", ";left:", ";right:", ";"], _ref => {
|
|
17
|
+
let {
|
|
18
|
+
top
|
|
19
|
+
} = _ref;
|
|
20
|
+
return top ? "".concat(top, "px") : 'unset';
|
|
21
|
+
}, _ref2 => {
|
|
22
|
+
let {
|
|
23
|
+
left
|
|
24
|
+
} = _ref2;
|
|
25
|
+
return left ? "".concat(left, "px") : 'unset';
|
|
26
|
+
}, _ref3 => {
|
|
27
|
+
let {
|
|
28
|
+
right
|
|
29
|
+
} = _ref3;
|
|
30
|
+
return right ? "".concat(right, "px") : 'unset';
|
|
31
|
+
});
|
|
23
32
|
const NumericBadge = /*#__PURE__*/styled__default["default"](GenericBadge).withConfig({
|
|
24
33
|
componentId: "sc-lsxuo6-2"
|
|
25
|
-
})(["display:flex;justify-content:center;align-items:center;width:fit-content;color:#fff;padding:", ";padding-top:2px;background-color:", ";border-radius:", ";font-size:", ";font-weight:", ";height:", ";min-width:", ";"],
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
}
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
}
|
|
35
|
-
|
|
36
|
-
}
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
value
|
|
41
|
-
}
|
|
34
|
+
})(["display:flex;justify-content:center;align-items:center;width:fit-content;color:#fff;padding:", ";padding-top:2px;background-color:", ";border-radius:", ";font-size:", ";font-weight:", ";height:", ";min-width:", ";"], _ref4 => {
|
|
35
|
+
let {
|
|
36
|
+
value
|
|
37
|
+
} = _ref4;
|
|
38
|
+
return value > 9 ? '0 5px' : '0';
|
|
39
|
+
}, _ref5 => {
|
|
40
|
+
let {
|
|
41
|
+
disabled,
|
|
42
|
+
theme
|
|
43
|
+
} = _ref5;
|
|
44
|
+
return disabled ? theme.colors.neutral[500] : theme.colors.danger[900];
|
|
45
|
+
}, _ref6 => {
|
|
46
|
+
let {
|
|
47
|
+
value
|
|
48
|
+
} = _ref6;
|
|
49
|
+
return value > 9 ? '10px' : '50%';
|
|
50
|
+
}, _ref7 => {
|
|
51
|
+
let {
|
|
52
|
+
size
|
|
53
|
+
} = _ref7;
|
|
54
|
+
return size === 'l' ? '16px' : '12px';
|
|
55
|
+
}, _ref8 => {
|
|
56
|
+
let {
|
|
57
|
+
size
|
|
58
|
+
} = _ref8;
|
|
59
|
+
return size === 'l' ? '400' : '600';
|
|
60
|
+
}, _ref9 => {
|
|
61
|
+
let {
|
|
62
|
+
size
|
|
63
|
+
} = _ref9;
|
|
64
|
+
return size === 'l' ? '21px' : '15px';
|
|
65
|
+
}, _ref10 => {
|
|
66
|
+
let {
|
|
67
|
+
size,
|
|
68
|
+
value
|
|
69
|
+
} = _ref10;
|
|
42
70
|
if (size === 'l' && value > 9) return '30px';
|
|
43
71
|
if (size === 'l' && value <= 9) return '21px';
|
|
44
72
|
if (size === 's' && value > 9) return '21px';
|
|
@@ -46,14 +74,23 @@ const NumericBadge = /*#__PURE__*/styled__default["default"](GenericBadge).withC
|
|
|
46
74
|
});
|
|
47
75
|
const DotBadge = /*#__PURE__*/styled__default["default"](GenericBadge).withConfig({
|
|
48
76
|
componentId: "sc-lsxuo6-3"
|
|
49
|
-
})(["background-color:", ";width:", ";height:", ";border-radius:100%;"],
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
77
|
+
})(["background-color:", ";width:", ";height:", ";border-radius:100%;"], _ref11 => {
|
|
78
|
+
let {
|
|
79
|
+
disabled,
|
|
80
|
+
theme
|
|
81
|
+
} = _ref11;
|
|
82
|
+
return disabled ? theme.colors.neutral[500] : theme.colors.brand[500];
|
|
83
|
+
}, _ref12 => {
|
|
84
|
+
let {
|
|
85
|
+
size
|
|
86
|
+
} = _ref12;
|
|
87
|
+
return size === 'l' ? '15px' : '10px';
|
|
88
|
+
}, _ref13 => {
|
|
89
|
+
let {
|
|
90
|
+
size
|
|
91
|
+
} = _ref13;
|
|
92
|
+
return size === 'l' ? '15px' : '10px';
|
|
93
|
+
});
|
|
57
94
|
|
|
58
95
|
exports.DotBadge = DotBadge;
|
|
59
96
|
exports.GenericBadge = GenericBadge;
|
package/esm/NotificationBadge.js
CHANGED
|
@@ -1,17 +1,19 @@
|
|
|
1
1
|
import _jsx from '@babel/runtime/helpers/esm/jsx';
|
|
2
|
+
import 'core-js/modules/web.dom-collections.iterator.js';
|
|
2
3
|
import { useRef, useState, useEffect } from 'react';
|
|
3
4
|
import { describe } from 'react-desc';
|
|
4
5
|
import { notificationBadgeProps, defaultProps } from './prop-types.js';
|
|
5
6
|
import { Wrapper, NumericBadge, DotBadge } from './style.js';
|
|
6
7
|
|
|
7
|
-
const NotificationBadge =
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
8
|
+
const NotificationBadge = _ref => {
|
|
9
|
+
let {
|
|
10
|
+
type,
|
|
11
|
+
value,
|
|
12
|
+
size,
|
|
13
|
+
disabled,
|
|
14
|
+
position,
|
|
15
|
+
Component
|
|
16
|
+
} = _ref;
|
|
15
17
|
const Badge = type === 'number' ? NumericBadge : DotBadge;
|
|
16
18
|
const relatedComponentRef = useRef(null);
|
|
17
19
|
const renderBadge = (relatedComponentRef === null || relatedComponentRef === void 0 ? void 0 : relatedComponentRef.current) || !Component;
|
package/esm/style.js
CHANGED
|
@@ -5,32 +5,60 @@ const Wrapper = /*#__PURE__*/styled.div.withConfig({
|
|
|
5
5
|
})(["display:flex;flex-direction:column;justify-content:center;align-items:center;width:fit-content;"]);
|
|
6
6
|
const GenericBadge = /*#__PURE__*/styled.span.withConfig({
|
|
7
7
|
componentId: "sc-lsxuo6-1"
|
|
8
|
-
})(["position:relative;top:", ";left:", ";right:", ";"],
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
8
|
+
})(["position:relative;top:", ";left:", ";right:", ";"], _ref => {
|
|
9
|
+
let {
|
|
10
|
+
top
|
|
11
|
+
} = _ref;
|
|
12
|
+
return top ? "".concat(top, "px") : 'unset';
|
|
13
|
+
}, _ref2 => {
|
|
14
|
+
let {
|
|
15
|
+
left
|
|
16
|
+
} = _ref2;
|
|
17
|
+
return left ? "".concat(left, "px") : 'unset';
|
|
18
|
+
}, _ref3 => {
|
|
19
|
+
let {
|
|
20
|
+
right
|
|
21
|
+
} = _ref3;
|
|
22
|
+
return right ? "".concat(right, "px") : 'unset';
|
|
23
|
+
});
|
|
15
24
|
const NumericBadge = /*#__PURE__*/styled(GenericBadge).withConfig({
|
|
16
25
|
componentId: "sc-lsxuo6-2"
|
|
17
|
-
})(["display:flex;justify-content:center;align-items:center;width:fit-content;color:#fff;padding:", ";padding-top:2px;background-color:", ";border-radius:", ";font-size:", ";font-weight:", ";height:", ";min-width:", ";"],
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
}
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
}
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
value
|
|
33
|
-
}
|
|
26
|
+
})(["display:flex;justify-content:center;align-items:center;width:fit-content;color:#fff;padding:", ";padding-top:2px;background-color:", ";border-radius:", ";font-size:", ";font-weight:", ";height:", ";min-width:", ";"], _ref4 => {
|
|
27
|
+
let {
|
|
28
|
+
value
|
|
29
|
+
} = _ref4;
|
|
30
|
+
return value > 9 ? '0 5px' : '0';
|
|
31
|
+
}, _ref5 => {
|
|
32
|
+
let {
|
|
33
|
+
disabled,
|
|
34
|
+
theme
|
|
35
|
+
} = _ref5;
|
|
36
|
+
return disabled ? theme.colors.neutral[500] : theme.colors.danger[900];
|
|
37
|
+
}, _ref6 => {
|
|
38
|
+
let {
|
|
39
|
+
value
|
|
40
|
+
} = _ref6;
|
|
41
|
+
return value > 9 ? '10px' : '50%';
|
|
42
|
+
}, _ref7 => {
|
|
43
|
+
let {
|
|
44
|
+
size
|
|
45
|
+
} = _ref7;
|
|
46
|
+
return size === 'l' ? '16px' : '12px';
|
|
47
|
+
}, _ref8 => {
|
|
48
|
+
let {
|
|
49
|
+
size
|
|
50
|
+
} = _ref8;
|
|
51
|
+
return size === 'l' ? '400' : '600';
|
|
52
|
+
}, _ref9 => {
|
|
53
|
+
let {
|
|
54
|
+
size
|
|
55
|
+
} = _ref9;
|
|
56
|
+
return size === 'l' ? '21px' : '15px';
|
|
57
|
+
}, _ref10 => {
|
|
58
|
+
let {
|
|
59
|
+
size,
|
|
60
|
+
value
|
|
61
|
+
} = _ref10;
|
|
34
62
|
if (size === 'l' && value > 9) return '30px';
|
|
35
63
|
if (size === 'l' && value <= 9) return '21px';
|
|
36
64
|
if (size === 's' && value > 9) return '21px';
|
|
@@ -38,13 +66,22 @@ const NumericBadge = /*#__PURE__*/styled(GenericBadge).withConfig({
|
|
|
38
66
|
});
|
|
39
67
|
const DotBadge = /*#__PURE__*/styled(GenericBadge).withConfig({
|
|
40
68
|
componentId: "sc-lsxuo6-3"
|
|
41
|
-
})(["background-color:", ";width:", ";height:", ";border-radius:100%;"],
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
69
|
+
})(["background-color:", ";width:", ";height:", ";border-radius:100%;"], _ref11 => {
|
|
70
|
+
let {
|
|
71
|
+
disabled,
|
|
72
|
+
theme
|
|
73
|
+
} = _ref11;
|
|
74
|
+
return disabled ? theme.colors.neutral[500] : theme.colors.brand[500];
|
|
75
|
+
}, _ref12 => {
|
|
76
|
+
let {
|
|
77
|
+
size
|
|
78
|
+
} = _ref12;
|
|
79
|
+
return size === 'l' ? '15px' : '10px';
|
|
80
|
+
}, _ref13 => {
|
|
81
|
+
let {
|
|
82
|
+
size
|
|
83
|
+
} = _ref13;
|
|
84
|
+
return size === 'l' ? '15px' : '10px';
|
|
85
|
+
});
|
|
49
86
|
|
|
50
87
|
export { DotBadge, GenericBadge, NumericBadge, Wrapper };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@elliemae/ds-notification-badge",
|
|
3
|
-
"version": "2.0.0-
|
|
3
|
+
"version": "2.0.0-next.12",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"description": "ICE MT - Dimsum - Notification Badge",
|
|
6
6
|
"module": "./esm/index.js",
|
|
@@ -48,12 +48,12 @@
|
|
|
48
48
|
"uid": "~2.0.0"
|
|
49
49
|
},
|
|
50
50
|
"devDependencies": {
|
|
51
|
-
"styled-components": "~5.3.
|
|
51
|
+
"styled-components": "~5.3.3"
|
|
52
52
|
},
|
|
53
53
|
"peerDependencies": {
|
|
54
54
|
"react": "^17.0.2",
|
|
55
55
|
"react-dom": "^17.0.2",
|
|
56
|
-
"styled-components": "^5.3.
|
|
56
|
+
"styled-components": "^5.3.3"
|
|
57
57
|
},
|
|
58
58
|
"publishConfig": {
|
|
59
59
|
"access": "public",
|
package/cjs/package.json
DELETED