@occmundial/occ-atomic 3.0.0-beta.20 → 3.0.0-beta.22
Sign up to get free protection for your applications and to get access to all the features.
- package/CHANGELOG.md +24 -0
- package/build/Tag/Tag.js +2 -2
- package/build/Tag/__snapshots__/Tag.test.js.snap +40 -42
- package/build/Tag/styles.js +76 -79
- package/build/Tip/Tip.js +1 -0
- package/build/Tip/__snapshots__/Tip.test.js.snap +0 -5
- package/build/Tip/styles.js +5 -10
- package/build/Toaster/Toast/Toast.js +69 -64
- package/build/Toaster/Toast/styles.js +72 -46
- package/build/Toaster/Toaster.js +3 -2
- package/build/Toaster/Toaster.test.js +5 -2
- package/build/Toaster/__snapshots__/Toaster.test.js.snap +1 -1
- package/build/Toaster/styles.js +3 -3
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
@@ -1,3 +1,27 @@
|
|
1
|
+
# [3.0.0-beta.22](https://github.com/occmundial/occ-atomic/compare/v3.0.0-beta.21...v3.0.0-beta.22) (2024-06-26)
|
2
|
+
|
3
|
+
|
4
|
+
### Features
|
5
|
+
|
6
|
+
* Tag compnent and documentation updated ([718378f](https://github.com/occmundial/occ-atomic/commit/718378ffd916c98673a3b10f7b9ba827d806aa1c))
|
7
|
+
|
8
|
+
# [3.0.0-beta.21](https://github.com/occmundial/occ-atomic/compare/v3.0.0-beta.20...v3.0.0-beta.21) (2024-06-25)
|
9
|
+
|
10
|
+
|
11
|
+
### Bug Fixes
|
12
|
+
|
13
|
+
* Add outline border and merge with beta ([a212aa3](https://github.com/occmundial/occ-atomic/commit/a212aa3f87471092a246925e79a9d787535b13ba))
|
14
|
+
* Resolve conflicts ([99b08cb](https://github.com/occmundial/occ-atomic/commit/99b08cb290979fa7f1aad3dd2c04f65b1b494559))
|
15
|
+
* Resolve conflicts ([81776b7](https://github.com/occmundial/occ-atomic/commit/81776b701b168e66a1f1dfa7b785227b40a76dc9))
|
16
|
+
* Set md size for tip close icon ([759e6d1](https://github.com/occmundial/occ-atomic/commit/759e6d10842e2c55cf81d2aff57f60479e3a3395))
|
17
|
+
* Set min width for desktop and conditionated on mouse events ([98857fd](https://github.com/occmundial/occ-atomic/commit/98857fd313d247e618c64dbbaacea93c6ab084ae))
|
18
|
+
|
19
|
+
|
20
|
+
### Features
|
21
|
+
|
22
|
+
* Add close icon prop and conditionated onclose func ([e456d38](https://github.com/occmundial/occ-atomic/commit/e456d384a82d4b6105e27bb36d693b43d5608c1c))
|
23
|
+
* Update toaster with new design tokens ([88edaa8](https://github.com/occmundial/occ-atomic/commit/88edaa8fe5c3c04bc9f634f6a287c1614c893d15))
|
24
|
+
|
1
25
|
# [3.0.0-beta.20](https://github.com/occmundial/occ-atomic/compare/v3.0.0-beta.19...v3.0.0-beta.20) (2024-06-25)
|
2
26
|
|
3
27
|
|
package/build/Tag/Tag.js
CHANGED
@@ -36,9 +36,9 @@ var Tag = function Tag(_ref) {
|
|
36
36
|
alignItems: "center",
|
37
37
|
wrap: "noWrap"
|
38
38
|
}, iconName && /*#__PURE__*/_react["default"].createElement("span", {
|
39
|
-
className: "".concat(classes.icon, " ").concat(size ? classes
|
39
|
+
className: "".concat(classes.icon, " ").concat(size === 'big' ? classes.bigIcon : classes.standardIcon, " ").concat(theme ? classes["".concat(theme, "Icon")] : classes.defaultIcon)
|
40
40
|
}), /*#__PURE__*/_react["default"].createElement("span", {
|
41
|
-
className:
|
41
|
+
className: classes.tagText
|
42
42
|
}, children)));
|
43
43
|
};
|
44
44
|
|
@@ -12,19 +12,15 @@ Object {
|
|
12
12
|
"background": [Function],
|
13
13
|
},
|
14
14
|
"big": Object {
|
15
|
-
"
|
16
|
-
"height": 40,
|
15
|
+
"minHeight": "32px",
|
17
16
|
"padding": Array [
|
18
|
-
|
19
|
-
|
17
|
+
"8px",
|
18
|
+
"16px",
|
20
19
|
],
|
21
20
|
},
|
22
21
|
"bigIcon": Object {
|
23
|
-
"height":
|
24
|
-
"width":
|
25
|
-
},
|
26
|
-
"bigTagText": Object {
|
27
|
-
"fontSize": 16,
|
22
|
+
"height": "16px",
|
23
|
+
"width": "16px",
|
28
24
|
},
|
29
25
|
"default": Object {
|
30
26
|
"background": "#f5f5f5",
|
@@ -34,23 +30,33 @@ Object {
|
|
34
30
|
"background": [Function],
|
35
31
|
},
|
36
32
|
"error": Object {
|
37
|
-
"background": "#
|
38
|
-
"
|
33
|
+
"background": "#fce8e8",
|
34
|
+
"border": "1px solid #FBDFDF",
|
35
|
+
"color": "#8b1313",
|
39
36
|
},
|
40
37
|
"errorIcon": Object {
|
41
38
|
"background": [Function],
|
42
39
|
},
|
40
|
+
"featured": Object {
|
41
|
+
"background": "#0059CD",
|
42
|
+
"border": "1px solid rgba(255,255,255,0.2)",
|
43
|
+
"color": "#fff",
|
44
|
+
},
|
45
|
+
"featuredIcon": Object {
|
46
|
+
"background": [Function],
|
47
|
+
},
|
43
48
|
"icon": Object {
|
44
49
|
"backgroundRepeat": "no-repeat",
|
45
50
|
"content": "\\"\\"",
|
46
51
|
"display": "inline-block",
|
47
52
|
"left": 0,
|
48
|
-
"marginRight":
|
53
|
+
"marginRight": "4px",
|
49
54
|
"paddingBottom": 0,
|
50
55
|
},
|
51
56
|
"info": Object {
|
52
|
-
"
|
53
|
-
"
|
57
|
+
"background": "#e3efff",
|
58
|
+
"border": "1px solid #b9d7ff",
|
59
|
+
"color": "#083CAE",
|
54
60
|
},
|
55
61
|
"infoIcon": Object {
|
56
62
|
"background": [Function],
|
@@ -63,46 +69,39 @@ Object {
|
|
63
69
|
"background": [Function],
|
64
70
|
},
|
65
71
|
"medium": Object {
|
66
|
-
"height": 32,
|
67
72
|
"padding": Array [
|
68
|
-
|
69
|
-
|
70
|
-
7,
|
71
|
-
12,
|
73
|
+
"8px",
|
74
|
+
"12px",
|
72
75
|
],
|
73
76
|
},
|
74
|
-
"
|
75
|
-
"
|
76
|
-
"
|
77
|
+
"promo": Object {
|
78
|
+
"background": "#080D39",
|
79
|
+
"border": "1px solid rgba(255,255,255,0.2)",
|
80
|
+
"color": "#fff",
|
77
81
|
},
|
78
|
-
"
|
79
|
-
"
|
82
|
+
"promoIcon": Object {
|
83
|
+
"background": [Function],
|
80
84
|
},
|
81
85
|
"standard": Object {
|
82
|
-
"height": 16,
|
83
86
|
"padding": Array [
|
84
|
-
|
85
|
-
|
86
|
-
3,
|
87
|
-
8,
|
87
|
+
"2px",
|
88
|
+
"8px",
|
88
89
|
],
|
89
90
|
},
|
90
91
|
"standardIcon": Object {
|
91
|
-
"height":
|
92
|
-
"width":
|
93
|
-
},
|
94
|
-
"standardTagText": Object {
|
95
|
-
"fontSize": 10,
|
92
|
+
"height": "12px",
|
93
|
+
"width": "12px",
|
96
94
|
},
|
97
95
|
"success": Object {
|
98
|
-
"background": "#
|
99
|
-
"
|
96
|
+
"background": "#ebfbf1",
|
97
|
+
"border": "1px solid #d7f6e3",
|
98
|
+
"color": "#16542e",
|
100
99
|
},
|
101
100
|
"successIcon": Object {
|
102
101
|
"background": [Function],
|
103
102
|
},
|
104
103
|
"tag": Object {
|
105
|
-
"borderRadius":
|
104
|
+
"borderRadius": "9999px",
|
106
105
|
"boxSizing": "border-box",
|
107
106
|
"display": "inline-block",
|
108
107
|
"lineHeight": "12px",
|
@@ -113,20 +112,19 @@ Object {
|
|
113
112
|
"tagText": Object {
|
114
113
|
"boxSizing": "border-box",
|
115
114
|
"display": "inline-block",
|
116
|
-
"
|
115
|
+
"font": "400 10px/1.5 'OccText', sans-serif",
|
117
116
|
"fontStretch": "normal",
|
118
117
|
"fontStyle": "normal",
|
119
|
-
"fontWeight": "400",
|
120
118
|
"letterSpacing": "normal",
|
121
|
-
"lineHeight": 1.5,
|
122
119
|
"overflow": "hidden",
|
123
120
|
"paddingRight": [Function],
|
124
121
|
"position": "relative",
|
125
122
|
"textAlign": "center",
|
126
123
|
},
|
127
124
|
"warning": Object {
|
128
|
-
"background": "#
|
129
|
-
"
|
125
|
+
"background": "#fff8e9",
|
126
|
+
"border": "1px solid #fff1d3",
|
127
|
+
"color": "#664a0e",
|
130
128
|
},
|
131
129
|
"warningIcon": Object {
|
132
130
|
"background": [Function],
|
package/build/Tag/styles.js
CHANGED
@@ -3,7 +3,7 @@
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
4
4
|
value: true
|
5
5
|
});
|
6
|
-
exports["default"] = void 0;
|
6
|
+
exports["default"] = exports.objectToFontValue = void 0;
|
7
7
|
|
8
8
|
var _colors = _interopRequireDefault(require("../subatomic/colors"));
|
9
9
|
|
@@ -11,67 +11,54 @@ var _fonts = _interopRequireDefault(require("../subatomic/fonts"));
|
|
11
11
|
|
12
12
|
var _icons = _interopRequireDefault(require("../subatomic/icons"));
|
13
13
|
|
14
|
-
var
|
14
|
+
var _hexRgba = _interopRequireDefault(require("hex-rgba"));
|
15
15
|
|
16
|
-
var
|
16
|
+
var _borderRadius = _interopRequireDefault(require("../tokens/borderRadius.json"));
|
17
17
|
|
18
|
-
var
|
18
|
+
var _spacing = _interopRequireDefault(require("../tokens/spacing.json"));
|
19
|
+
|
20
|
+
var _fonts2 = _interopRequireDefault(require("../tokens/fonts.json"));
|
21
|
+
|
22
|
+
var _colors2 = _interopRequireDefault(require("../tokens/colors.json"));
|
19
23
|
|
20
24
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
21
25
|
|
22
|
-
var
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
26
|
+
var tag = _colors2["default"].tag,
|
27
|
+
text = _colors2["default"].text,
|
28
|
+
icon = _colors2["default"].icon;
|
29
|
+
|
30
|
+
var objectToFontValue = function objectToFontValue(font) {
|
31
|
+
return "".concat(font.fontWeight, " ").concat(font.fontSize, "/").concat(font.lineHeight, " ").concat(_fonts["default"].body);
|
32
|
+
};
|
33
|
+
|
34
|
+
exports.objectToFontValue = objectToFontValue;
|
35
|
+
var grey900 = _colors["default"].grey900,
|
31
36
|
grey100 = _colors["default"].grey100,
|
32
37
|
textLink = _colors["default"].textLink,
|
33
38
|
bgWhite = _colors["default"].bgWhite;
|
34
|
-
var xTiny = _spacing["default"].xTiny,
|
35
|
-
tiny = _spacing["default"].tiny,
|
36
|
-
small = _spacing["default"].small,
|
37
|
-
gutter = _spacing["default"].gutter,
|
38
|
-
medium = _spacing["default"].medium;
|
39
|
-
var smallIcon = _iconSizes["default"].small;
|
40
|
-
var paddingStandardTag = [1, tiny, 3, tiny],
|
41
|
-
paddingMediumTag = [5, gutter, 7, gutter],
|
42
|
-
paddingBigTag = [tiny, small],
|
43
|
-
tagTextLineHeight = 1.5,
|
44
|
-
tagTextStandardSize = 10,
|
45
|
-
tagTextMediumSize = 16,
|
46
|
-
tagTextBigSize = 16,
|
47
|
-
bigTagHeight = 40;
|
48
39
|
var _default = {
|
49
40
|
tag: {
|
50
41
|
boxSizing: 'border-box',
|
51
42
|
lineHeight: '12px',
|
52
43
|
textAlign: 'center',
|
53
|
-
borderRadius:
|
44
|
+
borderRadius: _borderRadius["default"]['br-full'],
|
54
45
|
position: 'relative',
|
55
46
|
overflow: 'hidden',
|
56
47
|
display: 'inline-block'
|
57
48
|
},
|
58
49
|
standard: {
|
59
|
-
padding:
|
60
|
-
height: small
|
50
|
+
padding: [_spacing["default"]['size-0'], _spacing["default"]['size-2']]
|
61
51
|
},
|
62
52
|
medium: {
|
63
|
-
padding:
|
64
|
-
height: medium
|
53
|
+
padding: [_spacing["default"]['size-2'], _spacing["default"]['size-3']]
|
65
54
|
},
|
66
55
|
big: {
|
67
|
-
|
68
|
-
|
69
|
-
borderRadius: medium
|
56
|
+
minHeight: _spacing["default"]['size-6'],
|
57
|
+
padding: [_spacing["default"]['size-2'], _spacing["default"]['size-4']]
|
70
58
|
},
|
71
59
|
tagText: {
|
72
60
|
boxSizing: 'border-box',
|
73
|
-
|
74
|
-
fontWeight: '400',
|
61
|
+
font: objectToFontValue(_fonts2["default"]['heading-tag']),
|
75
62
|
fontStyle: 'normal',
|
76
63
|
fontStretch: 'normal',
|
77
64
|
letterSpacing: 'normal',
|
@@ -79,20 +66,10 @@ var _default = {
|
|
79
66
|
position: 'relative',
|
80
67
|
overflow: 'hidden',
|
81
68
|
display: 'inline-block',
|
82
|
-
lineHeight: tagTextLineHeight,
|
83
69
|
paddingRight: function paddingRight(props) {
|
84
|
-
return props.iconName ?
|
70
|
+
return props.iconName ? _spacing["default"]['size-1'] : 0;
|
85
71
|
}
|
86
72
|
},
|
87
|
-
standardTagText: {
|
88
|
-
fontSize: tagTextStandardSize
|
89
|
-
},
|
90
|
-
mediumTagText: {
|
91
|
-
fontSize: tagTextMediumSize
|
92
|
-
},
|
93
|
-
bigTagText: {
|
94
|
-
fontSize: tagTextBigSize
|
95
|
-
},
|
96
73
|
"default": {
|
97
74
|
color: grey900,
|
98
75
|
background: grey100
|
@@ -101,47 +78,57 @@ var _default = {
|
|
101
78
|
color: grey900,
|
102
79
|
background: bgWhite
|
103
80
|
},
|
104
|
-
|
105
|
-
color:
|
106
|
-
|
81
|
+
link: {
|
82
|
+
color: textLink,
|
83
|
+
background: (0, _hexRgba["default"])(textLink, 10)
|
84
|
+
},
|
85
|
+
featured: {
|
86
|
+
color: text.white.primary,
|
87
|
+
background: tag.featured.bg,
|
88
|
+
border: "1px solid ".concat(tag.featured.border)
|
89
|
+
},
|
90
|
+
promo: {
|
91
|
+
color: text.white.primary,
|
92
|
+
background: tag.promo.bg,
|
93
|
+
border: "1px solid ".concat(tag.promo.border)
|
107
94
|
},
|
108
95
|
success: {
|
109
|
-
color:
|
110
|
-
background:
|
96
|
+
color: text.success,
|
97
|
+
background: tag.success.bg,
|
98
|
+
border: "1px solid ".concat(tag.success.border)
|
99
|
+
},
|
100
|
+
info: {
|
101
|
+
color: text.indigo.primary,
|
102
|
+
background: tag.info.bg,
|
103
|
+
border: "1px solid ".concat(tag.info.border)
|
111
104
|
},
|
112
105
|
warning: {
|
113
|
-
color:
|
114
|
-
background:
|
106
|
+
color: text.warning,
|
107
|
+
background: tag.warning.bg,
|
108
|
+
border: "1px solid ".concat(tag.warning.border)
|
115
109
|
},
|
116
110
|
error: {
|
117
|
-
color:
|
118
|
-
background:
|
119
|
-
|
120
|
-
link: {
|
121
|
-
color: textLink,
|
122
|
-
background: (0, _hexRgba["default"])(textLink, 10)
|
111
|
+
color: text.error,
|
112
|
+
background: tag.error.bg,
|
113
|
+
border: "1px solid ".concat(tag.error.border)
|
123
114
|
},
|
124
115
|
|
125
116
|
/* Icon with themes */
|
126
117
|
icon: {
|
127
118
|
display: 'inline-block',
|
128
|
-
marginRight:
|
119
|
+
marginRight: _spacing["default"]['size-1'],
|
129
120
|
content: '""',
|
130
121
|
paddingBottom: 0,
|
131
122
|
left: 0,
|
132
123
|
backgroundRepeat: 'no-repeat'
|
133
124
|
},
|
134
125
|
standardIcon: {
|
135
|
-
width:
|
136
|
-
height:
|
137
|
-
},
|
138
|
-
mediumIcon: {
|
139
|
-
width: smallIcon,
|
140
|
-
height: smallIcon
|
126
|
+
width: _spacing["default"]['size-3'],
|
127
|
+
height: _spacing["default"]['size-3']
|
141
128
|
},
|
142
129
|
bigIcon: {
|
143
|
-
width:
|
144
|
-
height:
|
130
|
+
width: _spacing["default"]['size-4'],
|
131
|
+
height: _spacing["default"]['size-4']
|
145
132
|
},
|
146
133
|
defaultIcon: {
|
147
134
|
background: function background(props) {
|
@@ -153,29 +140,39 @@ var _default = {
|
|
153
140
|
return props.iconName ? _icons["default"].base(_icons["default"][props.iconName].icon([grey900])) : '';
|
154
141
|
}
|
155
142
|
},
|
156
|
-
|
143
|
+
linkIcon: {
|
157
144
|
background: function background(props) {
|
158
|
-
return props.iconName ? _icons["default"].base(_icons["default"][props.iconName].icon([
|
145
|
+
return props.iconName ? _icons["default"].base(_icons["default"][props.iconName].icon([textLink])) : '';
|
146
|
+
}
|
147
|
+
},
|
148
|
+
featuredIcon: {
|
149
|
+
background: function background(props) {
|
150
|
+
return props.iconName ? _icons["default"].base(_icons["default"][props.iconName].icon([icon.inverse["default"]])) : '';
|
151
|
+
}
|
152
|
+
},
|
153
|
+
promoIcon: {
|
154
|
+
background: function background(props) {
|
155
|
+
return props.iconName ? _icons["default"].base(_icons["default"][props.iconName].icon([icon.inverse["default"]])) : '';
|
159
156
|
}
|
160
157
|
},
|
161
158
|
successIcon: {
|
162
159
|
background: function background(props) {
|
163
|
-
return props.iconName ? _icons["default"].base(_icons["default"][props.iconName].icon([
|
160
|
+
return props.iconName ? _icons["default"].base(_icons["default"][props.iconName].icon([icon.success])) : '';
|
164
161
|
}
|
165
162
|
},
|
166
|
-
|
163
|
+
infoIcon: {
|
167
164
|
background: function background(props) {
|
168
|
-
return props.iconName ? _icons["default"].base(_icons["default"][props.iconName].icon([
|
165
|
+
return props.iconName ? _icons["default"].base(_icons["default"][props.iconName].icon([icon.brand.bold])) : '';
|
169
166
|
}
|
170
167
|
},
|
171
|
-
|
168
|
+
warningIcon: {
|
172
169
|
background: function background(props) {
|
173
|
-
return props.iconName ? _icons["default"].base(_icons["default"][props.iconName].icon([
|
170
|
+
return props.iconName ? _icons["default"].base(_icons["default"][props.iconName].icon([icon.warning])) : '';
|
174
171
|
}
|
175
172
|
},
|
176
|
-
|
173
|
+
errorIcon: {
|
177
174
|
background: function background(props) {
|
178
|
-
return props.iconName ? _icons["default"].base(_icons["default"][props.iconName].icon([
|
175
|
+
return props.iconName ? _icons["default"].base(_icons["default"][props.iconName].icon([icon.error])) : '';
|
179
176
|
}
|
180
177
|
}
|
181
178
|
};
|
package/build/Tip/Tip.js
CHANGED
@@ -87,6 +87,7 @@ var Tip = function Tip(_ref) {
|
|
87
87
|
'data-testid': "".concat(testId, "__link")
|
88
88
|
}), cta.text))), onClose && /*#__PURE__*/_react["default"].createElement(_Button["default"], _extends({
|
89
89
|
onClick: onClose,
|
90
|
+
size: "md",
|
90
91
|
className: size === 'small' ? classes.closeIconSmallMargin : classes.closeIconMargin,
|
91
92
|
icon: "x",
|
92
93
|
theme: theme === PROMOTE ? 'ghostWhite' : 'ghostGrey'
|
@@ -96,23 +96,18 @@ Object {
|
|
96
96
|
},
|
97
97
|
"textError": Object {
|
98
98
|
"color": "#8b1313",
|
99
|
-
"textDecorationColor": "#8b1313",
|
100
99
|
},
|
101
100
|
"textInfo": Object {
|
102
101
|
"color": "#083CAE",
|
103
|
-
"textDecorationColor": "#083CAE",
|
104
102
|
},
|
105
103
|
"textPromote": Object {
|
106
104
|
"color": "#fff",
|
107
|
-
"textDecorationColor": "#fff",
|
108
105
|
},
|
109
106
|
"textSuccess": Object {
|
110
107
|
"color": "#16542e",
|
111
|
-
"textDecorationColor": "#16542e",
|
112
108
|
},
|
113
109
|
"textWarning": Object {
|
114
110
|
"color": "#664a0e",
|
115
|
-
"textDecorationColor": "#664a0e",
|
116
111
|
},
|
117
112
|
"warning": Object {
|
118
113
|
"backgroundColor": "#fff8e9",
|
package/build/Tip/styles.js
CHANGED
@@ -55,24 +55,19 @@ var _default = {
|
|
55
55
|
outline: "1px solid ".concat(_colors["default"].alert.neutral.border)
|
56
56
|
},
|
57
57
|
textInfo: {
|
58
|
-
color: _colors["default"].text.indigo.primary
|
59
|
-
textDecorationColor: _colors["default"].text.indigo.primary
|
58
|
+
color: _colors["default"].text.indigo.primary
|
60
59
|
},
|
61
60
|
textWarning: {
|
62
|
-
color: _colors["default"].text.warning
|
63
|
-
textDecorationColor: _colors["default"].text.warning
|
61
|
+
color: _colors["default"].text.warning
|
64
62
|
},
|
65
63
|
textSuccess: {
|
66
|
-
color: _colors["default"].text.success
|
67
|
-
textDecorationColor: _colors["default"].text.success
|
64
|
+
color: _colors["default"].text.success
|
68
65
|
},
|
69
66
|
textError: {
|
70
|
-
color: _colors["default"].text.error
|
71
|
-
textDecorationColor: _colors["default"].text.error
|
67
|
+
color: _colors["default"].text.error
|
72
68
|
},
|
73
69
|
textPromote: {
|
74
|
-
color: _colors["default"].text.white.primary
|
75
|
-
textDecorationColor: _colors["default"].text.white.primary
|
70
|
+
color: _colors["default"].text.white.primary
|
76
71
|
},
|
77
72
|
icon: {
|
78
73
|
marginRight: _spacing["default"]['size-2'],
|
@@ -9,109 +9,114 @@ var _react = _interopRequireDefault(require("react"));
|
|
9
9
|
|
10
10
|
var _propTypes = _interopRequireDefault(require("prop-types"));
|
11
11
|
|
12
|
-
var _Text = _interopRequireDefault(require("../../Text"));
|
13
|
-
|
14
12
|
var _Icon = _interopRequireDefault(require("../../Icon"));
|
15
13
|
|
16
14
|
var _Flexbox = _interopRequireDefault(require("../../Flexbox"));
|
17
15
|
|
18
|
-
var _colors = _interopRequireDefault(require("../../
|
16
|
+
var _colors = _interopRequireDefault(require("../../tokens/colors.json"));
|
17
|
+
|
18
|
+
var _Button = _interopRequireDefault(require("../../Button"));
|
19
19
|
|
20
20
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
21
21
|
|
22
22
|
function _extends() { _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
|
23
23
|
|
24
|
+
var icons = {
|
25
|
+
info: 'info-circle',
|
26
|
+
warning: 'alert',
|
27
|
+
success: 'check-circle',
|
28
|
+
error: 'x-circle',
|
29
|
+
promote: null
|
30
|
+
};
|
31
|
+
var colorTextClasses = {
|
32
|
+
info: 'textInfo',
|
33
|
+
promote: 'textPromote',
|
34
|
+
warning: 'textWarning',
|
35
|
+
success: 'textSuccess',
|
36
|
+
error: 'textError'
|
37
|
+
};
|
38
|
+
|
24
39
|
var Toast = function Toast(_ref) {
|
25
40
|
var classes = _ref.classes,
|
26
41
|
theme = _ref.theme,
|
27
42
|
title = _ref.title,
|
28
43
|
description = _ref.description,
|
29
44
|
action = _ref.action,
|
30
|
-
hasIcon = _ref.hasIcon,
|
31
45
|
closing = _ref.closing,
|
32
46
|
onClose = _ref.onClose,
|
33
47
|
pauseTimer = _ref.pauseTimer,
|
34
|
-
resumeTimer = _ref.resumeTimer
|
35
|
-
|
36
|
-
|
37
|
-
switch (theme) {
|
38
|
-
case 'success':
|
39
|
-
return {
|
40
|
-
icon: 'check-circle',
|
41
|
-
color: _colors["default"].bgWhite
|
42
|
-
};
|
43
|
-
|
44
|
-
case 'error':
|
45
|
-
return {
|
46
|
-
icon: 'x-circle',
|
47
|
-
color: _colors["default"].bgWhite
|
48
|
-
};
|
49
|
-
|
50
|
-
case 'info':
|
51
|
-
return {
|
52
|
-
icon: 'info-circle',
|
53
|
-
color: _colors["default"].bgWhite
|
54
|
-
};
|
55
|
-
|
56
|
-
case 'warning':
|
57
|
-
return {
|
58
|
-
icon: 'alert',
|
59
|
-
color: _colors["default"].grey900
|
60
|
-
};
|
61
|
-
}
|
62
|
-
};
|
63
|
-
|
64
|
-
var textColor = theme === 'warning' ? {} : {
|
65
|
-
white: true
|
66
|
-
};
|
67
|
-
var iconData = hasIcon ? getIconData() : null;
|
48
|
+
resumeTimer = _ref.resumeTimer,
|
49
|
+
closeIcon = _ref.closeIcon,
|
50
|
+
testId = _ref.testId;
|
68
51
|
|
69
52
|
var onActionClick = function onActionClick(action) {
|
70
53
|
action.onClick();
|
71
54
|
onClose();
|
72
55
|
};
|
73
56
|
|
74
|
-
return /*#__PURE__*/_react["default"].createElement("div", {
|
75
|
-
className: "".concat(classes.toast, " ").concat(classes[theme]).concat(closing ? " ".concat(classes.closing) : '')
|
76
|
-
|
57
|
+
return /*#__PURE__*/_react["default"].createElement("div", _extends({
|
58
|
+
className: "".concat(classes.toast, " ").concat(classes[theme]).concat(closing ? " ".concat(classes.closing) : '')
|
59
|
+
}, !closeIcon && {
|
60
|
+
onMouseEnter: pauseTimer
|
61
|
+
}, !closeIcon && {
|
77
62
|
onMouseLeave: resumeTimer
|
78
|
-
}, /*#__PURE__*/_react["default"].createElement(_Flexbox["default"], {
|
63
|
+
}), /*#__PURE__*/_react["default"].createElement(_Flexbox["default"], {
|
79
64
|
display: "flex",
|
80
|
-
|
65
|
+
justifyContent: "between"
|
81
66
|
}, /*#__PURE__*/_react["default"].createElement(_Flexbox["default"], {
|
82
67
|
display: "flex",
|
83
|
-
alignItems: "center"
|
84
|
-
|
85
|
-
iconName: iconData.icon,
|
86
|
-
colors: [iconData.color],
|
87
|
-
className: classes.icon
|
88
|
-
}), /*#__PURE__*/_react["default"].createElement(_Flexbox["default"], {
|
68
|
+
alignItems: "center",
|
69
|
+
alignSelf: "center",
|
89
70
|
flex: "1"
|
90
|
-
},
|
91
|
-
|
92
|
-
|
93
|
-
|
71
|
+
}, theme !== 'promote' && /*#__PURE__*/_react["default"].createElement(_Icon["default"], {
|
72
|
+
iconName: icons[theme],
|
73
|
+
className: classes.icon,
|
74
|
+
colors: [theme === 'info' ? _colors["default"].icon.brand["default"] : _colors["default"].icon[theme]]
|
75
|
+
}), /*#__PURE__*/_react["default"].createElement(_Flexbox["default"], {
|
76
|
+
display: "flex",
|
77
|
+
flex: "1",
|
78
|
+
className: classes.content,
|
79
|
+
alignSelf: "start",
|
80
|
+
justifyContent: "between"
|
81
|
+
}, /*#__PURE__*/_react["default"].createElement(_Flexbox["default"], {
|
82
|
+
display: "flex",
|
83
|
+
direction: "col"
|
84
|
+
}, /*#__PURE__*/_react["default"].createElement("p", {
|
85
|
+
className: "".concat(classes.title, " ").concat(classes[colorTextClasses[theme]])
|
86
|
+
}, title), description && /*#__PURE__*/_react["default"].createElement("p", {
|
87
|
+
className: "".concat(classes.description, " ").concat(classes[colorTextClasses[theme]])
|
88
|
+
}, description)), action ? /*#__PURE__*/_react["default"].createElement("a", _extends({
|
89
|
+
className: "".concat(classes.actionText, " ").concat(classes[colorTextClasses[theme]]),
|
94
90
|
onClick: function onClick() {
|
95
91
|
return onActionClick(action);
|
96
92
|
}
|
97
|
-
},
|
98
|
-
|
99
|
-
|
100
|
-
|
101
|
-
|
102
|
-
|
103
|
-
|
104
|
-
|
93
|
+
}, testId && {
|
94
|
+
'data-testid': "".concat(testId, "__link")
|
95
|
+
}), action.label) : null)), !action && closeIcon ? /*#__PURE__*/_react["default"].createElement(_Button["default"], _extends({
|
96
|
+
onClick: onClose,
|
97
|
+
className: classes.closeIcon,
|
98
|
+
icon: "x",
|
99
|
+
size: "md",
|
100
|
+
theme: theme === 'promote' ? 'ghostWhite' : 'ghostGrey'
|
101
|
+
}, testId && {
|
102
|
+
testId: "".concat(testId, "__close-icon")
|
103
|
+
})) : null));
|
105
104
|
};
|
106
105
|
|
107
106
|
Toast.propTypes = {
|
108
107
|
classes: _propTypes["default"].object.isRequired,
|
109
108
|
theme: _propTypes["default"].oneOf(['success', 'error', 'info', 'warning']),
|
110
|
-
title: _propTypes["default"].string,
|
109
|
+
title: _propTypes["default"].string.isRequired,
|
111
110
|
description: _propTypes["default"].string,
|
112
111
|
action: _propTypes["default"].object,
|
113
|
-
|
114
|
-
|
112
|
+
closing: _propTypes["default"].bool,
|
113
|
+
pauseTimer: _propTypes["default"].func,
|
114
|
+
resumeTimer: _propTypes["default"].func,
|
115
|
+
onClose: _propTypes["default"].func.isRequired,
|
116
|
+
closeIcon: _propTypes["default"].bool,
|
117
|
+
|
118
|
+
/** The testId property adds the data attribute data-testid to the main element and should be used for testing only. */
|
119
|
+
testId: _propTypes["default"].string
|
115
120
|
};
|
116
121
|
var _default = Toast;
|
117
122
|
exports["default"] = _default;
|
@@ -5,17 +5,21 @@ Object.defineProperty(exports, "__esModule", {
|
|
5
5
|
});
|
6
6
|
exports["default"] = void 0;
|
7
7
|
|
8
|
-
var _colors = _interopRequireDefault(require("../../
|
8
|
+
var _colors = _interopRequireDefault(require("../../tokens/colors.json"));
|
9
9
|
|
10
|
-
var
|
10
|
+
var _fonts = _interopRequireDefault(require("../../tokens/fonts.json"));
|
11
11
|
|
12
|
-
var
|
12
|
+
var _spacing = _interopRequireDefault(require("../../tokens/spacing.json"));
|
13
|
+
|
14
|
+
var _borderRadius = _interopRequireDefault(require("../../tokens/borderRadius.json"));
|
15
|
+
|
16
|
+
var _shadows = _interopRequireDefault(require("../../tokens/shadows.json"));
|
13
17
|
|
14
18
|
var _grid = _interopRequireDefault(require("../../subatomic/grid"));
|
15
19
|
|
16
|
-
var
|
20
|
+
var _styles = require("../../Text/styles");
|
17
21
|
|
18
|
-
var _toast
|
22
|
+
var _toast;
|
19
23
|
|
20
24
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
21
25
|
|
@@ -33,16 +37,18 @@ var _default = {
|
|
33
37
|
}
|
34
38
|
},
|
35
39
|
toast: (_toast = {
|
36
|
-
borderRadius:
|
37
|
-
boxShadow: _shadows["default"]
|
38
|
-
padding:
|
40
|
+
borderRadius: _borderRadius["default"]['br-xs'],
|
41
|
+
boxShadow: _shadows["default"]['elevation-elevation-5'],
|
42
|
+
padding: _spacing["default"]['size-3'],
|
39
43
|
pointerEvents: 'auto',
|
40
44
|
zIndex: 1001,
|
41
45
|
animation: 'slideToasterIn 0.3s ease-out',
|
42
|
-
transition: '0.3s all ease-out'
|
46
|
+
transition: '0.3s all ease-out',
|
47
|
+
outlineOffset: '-1px'
|
43
48
|
}, _defineProperty(_toast, "@media screen and (min-width:".concat(_grid["default"].xs, "px)"), {
|
44
49
|
maxWidth: 480,
|
45
|
-
|
50
|
+
minWidth: 400,
|
51
|
+
padding: _spacing["default"]['size-4']
|
46
52
|
}), _defineProperty(_toast, "@media screen and (max-width:".concat(_grid["default"].xs - 1, "px)"), {
|
47
53
|
width: '100%'
|
48
54
|
}), _toast),
|
@@ -51,54 +57,74 @@ var _default = {
|
|
51
57
|
opacity: 0
|
52
58
|
},
|
53
59
|
success: {
|
54
|
-
|
60
|
+
backgroundColor: _colors["default"].alert.success.bg,
|
61
|
+
outline: "1px solid ".concat(_colors["default"].alert.success.border)
|
55
62
|
},
|
56
63
|
error: {
|
57
|
-
|
64
|
+
backgroundColor: _colors["default"].alert.error.bg,
|
65
|
+
outline: "1px solid ".concat(_colors["default"].alert.error.border)
|
58
66
|
},
|
59
67
|
warning: {
|
60
|
-
|
68
|
+
backgroundColor: _colors["default"].alert.warning.bg,
|
69
|
+
outline: "1px solid ".concat(_colors["default"].alert.warning.border)
|
61
70
|
},
|
62
71
|
info: {
|
63
|
-
|
72
|
+
backgroundColor: _colors["default"].alert.info.bg,
|
73
|
+
outline: "1px solid ".concat(_colors["default"].alert.info.border)
|
74
|
+
},
|
75
|
+
promote: {
|
76
|
+
backgroundColor: _colors["default"].alert.neutral.bg,
|
77
|
+
outline: "1px solid ".concat(_colors["default"].alert.neutral.border)
|
78
|
+
},
|
79
|
+
textInfo: {
|
80
|
+
color: _colors["default"].text.indigo.primary
|
81
|
+
},
|
82
|
+
textWarning: {
|
83
|
+
color: _colors["default"].text.warning
|
84
|
+
},
|
85
|
+
textSuccess: {
|
86
|
+
color: _colors["default"].text.success
|
87
|
+
},
|
88
|
+
textError: {
|
89
|
+
color: _colors["default"].text.error
|
90
|
+
},
|
91
|
+
textPromote: {
|
92
|
+
color: _colors["default"].text.white.primary
|
64
93
|
},
|
65
|
-
|
94
|
+
title: {
|
95
|
+
font: (0, _styles.parseFontValue)(_fonts["default"]['alert-default']),
|
96
|
+
margin: 0
|
97
|
+
},
|
98
|
+
description: {
|
99
|
+
font: (0, _styles.parseFontValue)(_fonts["default"]['alert-description']),
|
100
|
+
margin: [_spacing["default"]['size-1'], 0, 0]
|
101
|
+
},
|
102
|
+
content: _defineProperty({
|
66
103
|
flexDirection: 'column'
|
104
|
+
}, "@media screen and (min-width:".concat(_grid["default"].xs, "px)"), {
|
105
|
+
flexDirection: 'row'
|
67
106
|
}),
|
68
|
-
icon:
|
69
|
-
marginRight: _spacing["default"]
|
70
|
-
|
71
|
-
|
72
|
-
}, _defineProperty(_icon, "@media screen and (min-width:".concat(_grid["default"].xs, "px)"), {
|
73
|
-
width: _iconSizes["default"].base,
|
74
|
-
height: _iconSizes["default"].base
|
75
|
-
}), _defineProperty(_icon, "@media screen and (max-width:".concat(_grid["default"].xs - 1, "px)"), {
|
76
|
-
display: 'none'
|
77
|
-
}), _icon),
|
78
|
-
action: (_action = {
|
79
|
-
marginTop: _spacing["default"].xTiny,
|
80
|
-
cursor: 'pointer',
|
81
|
-
background: 'none',
|
82
|
-
border: 'none'
|
83
|
-
}, _defineProperty(_action, "@media screen and (min-width:".concat(_grid["default"].xs, "px)"), {
|
84
|
-
margin: -_spacing["default"].small,
|
85
|
-
marginLeft: _spacing["default"].small,
|
86
|
-
padding: [0, _spacing["default"].small],
|
87
|
-
borderRadius: [0, _spacing["default"].radius, _spacing["default"].radius, 0],
|
88
|
-
borderLeft: '1px solid rgba(255, 255, 255, 0.1)',
|
89
|
-
transition: '0.3s all',
|
90
|
-
'&:hover': {
|
91
|
-
background: 'rgba(255, 255, 255, 0.15)'
|
92
|
-
}
|
93
|
-
}), _defineProperty(_action, "@media screen and (max-width:".concat(_grid["default"].xs - 1, "px)"), {
|
94
|
-
alignSelf: 'flex-end'
|
95
|
-
}), _action),
|
107
|
+
icon: {
|
108
|
+
marginRight: _spacing["default"]['size-2'],
|
109
|
+
alignSelf: 'start'
|
110
|
+
},
|
96
111
|
actionWrap: {
|
97
112
|
height: '100%'
|
98
113
|
},
|
99
|
-
actionText: {
|
100
|
-
|
101
|
-
whiteSpace: 'nowrap'
|
114
|
+
actionText: _defineProperty({
|
115
|
+
font: (0, _styles.parseFontValue)(_fonts["default"]['link-small-strong']),
|
116
|
+
whiteSpace: 'nowrap',
|
117
|
+
textDecoration: 'underline',
|
118
|
+
cursor: 'pointer',
|
119
|
+
alignSelf: 'start',
|
120
|
+
margin: [_spacing["default"]['size-2'], 0, 0]
|
121
|
+
}, "@media screen and (min-width:".concat(_grid["default"].xs, "px)"), {
|
122
|
+
margin: [0, 0, 0, _spacing["default"]['size-4']],
|
123
|
+
alignSelf: 'center'
|
124
|
+
}),
|
125
|
+
closeIcon: {
|
126
|
+
marginLeft: _spacing["default"]['size-4'],
|
127
|
+
alignSelf: 'center'
|
102
128
|
}
|
103
129
|
};
|
104
130
|
exports["default"] = _default;
|
package/build/Toaster/Toaster.js
CHANGED
@@ -78,7 +78,7 @@ var Toaster = /*#__PURE__*/function (_React$Component) {
|
|
78
78
|
toast: toast,
|
79
79
|
toastId: toastId
|
80
80
|
}, function () {
|
81
|
-
_this.addTimer();
|
81
|
+
if (!toast.closeIcon) _this.addTimer();
|
82
82
|
});
|
83
83
|
});
|
84
84
|
|
@@ -164,8 +164,9 @@ var Toaster = /*#__PURE__*/function (_React$Component) {
|
|
164
164
|
title: toast.title,
|
165
165
|
theme: toast.type,
|
166
166
|
action: toast.action,
|
167
|
-
|
167
|
+
closeIcon: toast.closeIcon,
|
168
168
|
closing: toast.closing,
|
169
|
+
testId: toast.testId,
|
169
170
|
onClose: function onClose() {
|
170
171
|
return _this2.onClose(toast);
|
171
172
|
},
|
@@ -104,11 +104,14 @@ describe("Toaster", function () {
|
|
104
104
|
|
105
105
|
_functions.toaster.success({
|
106
106
|
title: 'Title',
|
107
|
-
action: action
|
107
|
+
action: action,
|
108
|
+
testId: "toaster-test"
|
108
109
|
});
|
109
110
|
|
110
111
|
wrapper.update();
|
111
|
-
wrapper.find(
|
112
|
+
wrapper.find({
|
113
|
+
"data-testid": 'toaster-test__link'
|
114
|
+
}).simulate('click');
|
112
115
|
expect(action.onClick).toHaveBeenCalled();
|
113
116
|
setTimeout(function () {
|
114
117
|
wrapper.update();
|
@@ -1,5 +1,5 @@
|
|
1
1
|
// Jest Snapshot v1, https://goo.gl/fbAQLP
|
2
2
|
|
3
|
-
exports[`Toaster launches a toast 1`] = `"<div class=\\"container\\"><div class=\\"Toast-toast-0-1-1 Toast-success-0-1-3\\"><div class=\\"Flexbox-flex-0-1-
|
3
|
+
exports[`Toaster launches a toast 1`] = `"<div class=\\"container\\"><div class=\\"Toast-toast-0-1-1 Toast-success-0-1-3\\"><div class=\\"Flexbox-flex-0-1-20 Flexbox-jbetween-0-1-32\\"><div class=\\"Flexbox-flex-0-1-20 Flexbox-acenter-0-1-37 Flexbox-scenter-0-1-49\\" style=\\"flex: 1;\\"><svg class=\\"Icon-icon-0-1-55 Icon-icon-0-1-52 undefined__check-circle Toast-icon-0-1-16\\" width=\\"24\\" height=\\"24\\" fill=\\"#38d373\\" style=\\"transition: 0.3s all;\\"><use xlink:href=\\"undefined#undefined__check-circle\\"></use></svg><div class=\\"Flexbox-flex-0-1-20 Flexbox-jbetween-0-1-32 Flexbox-sstart-0-1-47 Toast-content-0-1-15\\" style=\\"flex: 1;\\"><div class=\\"Flexbox-flex-0-1-20 Flexbox-col-0-1-24\\"><p class=\\"Toast-title-0-1-13 Toast-textSuccess-0-1-10\\">Title</p></div></div></div></div></div></div>"`;
|
4
4
|
|
5
5
|
exports[`Toaster matches the snapshot 1`] = `"<div class=\\"container\\"></div>"`;
|
package/build/Toaster/styles.js
CHANGED
@@ -7,7 +7,7 @@ exports["default"] = void 0;
|
|
7
7
|
|
8
8
|
var _grid = _interopRequireDefault(require("../subatomic/grid"));
|
9
9
|
|
10
|
-
var _spacing = _interopRequireDefault(require("../
|
10
|
+
var _spacing = _interopRequireDefault(require("../tokens/spacing.json"));
|
11
11
|
|
12
12
|
var _container;
|
13
13
|
|
@@ -21,9 +21,9 @@ var _default = {
|
|
21
21
|
zIndex: 1001,
|
22
22
|
bottom: 0,
|
23
23
|
left: 0,
|
24
|
-
padding: _spacing["default"]
|
24
|
+
padding: _spacing["default"]['size-4']
|
25
25
|
}, _defineProperty(_container, "@media screen and (min-width:".concat(_grid["default"].xs, "px)"), {
|
26
|
-
padding: _spacing["default"]
|
26
|
+
padding: _spacing["default"]['size-6']
|
27
27
|
}), _defineProperty(_container, "@media screen and (max-width:".concat(_grid["default"].xs - 1, "px)"), {
|
28
28
|
width: '100vw'
|
29
29
|
}), _defineProperty(_container, "pointerEvents", 'none'), _container)
|
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "@occmundial/occ-atomic",
|
3
|
-
"version": "3.0.0-beta.
|
3
|
+
"version": "3.0.0-beta.22",
|
4
4
|
"description": "Collection of shareable styled React components for OCC applications.",
|
5
5
|
"homepage": "http://occmundial.github.io/occ-atomic",
|
6
6
|
"main": "build/index.js",
|