@mirai/ui 1.0.43 → 1.0.44
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/build/components/Notification/Notification.js +8 -2
- package/build/components/Notification/Notification.js.map +1 -1
- package/build/components/Notification/Notification.module.css +12 -3
- package/build/components/Notification/__tests__/__snapshots__/Notification.test.js.snap +86 -8
- package/package.json +1 -1
|
@@ -15,7 +15,7 @@ var _primitives = require("../../primitives");
|
|
|
15
15
|
|
|
16
16
|
var _NotificationModule = _interopRequireDefault(require("./Notification.module.css"));
|
|
17
17
|
|
|
18
|
-
var _excluded = ["children", "error", "success", "title", "warning", "onClose"];
|
|
18
|
+
var _excluded = ["children", "error", "outlined", "small", "success", "title", "warning", "onClose"];
|
|
19
19
|
|
|
20
20
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
21
21
|
|
|
@@ -28,6 +28,10 @@ function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) r
|
|
|
28
28
|
var Notification = function Notification(_ref) {
|
|
29
29
|
var children = _ref.children,
|
|
30
30
|
error = _ref.error,
|
|
31
|
+
_ref$outlined = _ref.outlined,
|
|
32
|
+
outlined = _ref$outlined === void 0 ? true : _ref$outlined,
|
|
33
|
+
_ref$small = _ref.small,
|
|
34
|
+
small = _ref$small === void 0 ? false : _ref$small,
|
|
31
35
|
success = _ref.success,
|
|
32
36
|
title = _ref.title,
|
|
33
37
|
warning = _ref.warning,
|
|
@@ -36,7 +40,7 @@ var Notification = function Notification(_ref) {
|
|
|
36
40
|
|
|
37
41
|
return /*#__PURE__*/_react.default.createElement(_primitives.View, _extends({}, others, {
|
|
38
42
|
row: true,
|
|
39
|
-
className: (0, _helpers.styles)(_NotificationModule.default.notification, error ? _NotificationModule.default.error : warning ? _NotificationModule.default.warning : success ? _NotificationModule.default.success : undefined, others.className)
|
|
43
|
+
className: (0, _helpers.styles)(_NotificationModule.default.notification, error ? _NotificationModule.default.error : warning ? _NotificationModule.default.warning : success ? _NotificationModule.default.success : undefined, outlined && _NotificationModule.default.outlined, small && _NotificationModule.default.small, others.className)
|
|
40
44
|
}), /*#__PURE__*/_react.default.createElement(_primitives.Icon, {
|
|
41
45
|
name: error ? 'Error' : warning ? 'Warning' : success ? 'Success' : 'Info',
|
|
42
46
|
className: _NotificationModule.default.icon
|
|
@@ -61,6 +65,8 @@ Notification.displayName = 'Component:Notification';
|
|
|
61
65
|
Notification.propTypes = {
|
|
62
66
|
children: _propTypes.default.string.isRequired,
|
|
63
67
|
error: _propTypes.default.bool,
|
|
68
|
+
outlined: _propTypes.default.bool,
|
|
69
|
+
small: _propTypes.default.bool,
|
|
64
70
|
success: _propTypes.default.bool,
|
|
65
71
|
title: _propTypes.default.string,
|
|
66
72
|
warning: _propTypes.default.bool,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Notification.js","names":["Notification","children","error","success","title","warning","onClose","others","style","notification","undefined","className","icon","text","pressable","displayName","propTypes","PropTypes","string","isRequired","bool","func"],"sources":["../../../src/components/Notification/Notification.jsx"],"sourcesContent":["import PropTypes from 'prop-types';\nimport React from 'react';\n\nimport { styles } from '../../helpers';\nimport { Icon, Pressable, Text, View } from '../../primitives';\nimport style from './Notification.module.css';\n\nconst Notification = ({
|
|
1
|
+
{"version":3,"file":"Notification.js","names":["Notification","children","error","outlined","small","success","title","warning","onClose","others","style","notification","undefined","className","icon","text","pressable","displayName","propTypes","PropTypes","string","isRequired","bool","func"],"sources":["../../../src/components/Notification/Notification.jsx"],"sourcesContent":["import PropTypes from 'prop-types';\nimport React from 'react';\n\nimport { styles } from '../../helpers';\nimport { Icon, Pressable, Text, View } from '../../primitives';\nimport style from './Notification.module.css';\n\nconst Notification = ({\n children,\n error,\n outlined = true,\n small = false,\n success,\n title,\n warning,\n onClose,\n ...others\n}) => (\n <View\n {...others}\n row\n className={styles(\n style.notification,\n error ? style.error : warning ? style.warning : success ? style.success : undefined,\n outlined && style.outlined,\n small && style.small,\n others.className,\n )}\n >\n <Icon name={error ? 'Error' : warning ? 'Warning' : success ? 'Success' : 'Info'} className={style.icon} />\n <View\n className={styles(\n style.text,\n error ? style.error : warning ? style.warning : success ? style.success : undefined,\n )}\n >\n {title && (\n <Text bold action>\n Title\n </Text>\n )}\n <Text action>{children}</Text>\n </View>\n {onClose && (\n <Pressable className={style.pressable} onPress={onClose}>\n <Icon name=\"Close\" className={style.icon} />\n </Pressable>\n )}\n </View>\n);\n\nNotification.displayName = 'Component:Notification';\n\nNotification.propTypes = {\n children: PropTypes.string.isRequired,\n error: PropTypes.bool,\n outlined: PropTypes.bool,\n small: PropTypes.bool,\n success: PropTypes.bool,\n title: PropTypes.string,\n warning: PropTypes.bool,\n onClose: PropTypes.func,\n};\n\nexport { Notification };\n"],"mappings":";;;;;;;AAAA;;AACA;;AAEA;;AACA;;AACA;;;;;;;;;;;;AAEA,IAAMA,YAAY,GAAG,SAAfA,YAAe;EAAA,IACnBC,QADmB,QACnBA,QADmB;EAAA,IAEnBC,KAFmB,QAEnBA,KAFmB;EAAA,yBAGnBC,QAHmB;EAAA,IAGnBA,QAHmB,8BAGR,IAHQ;EAAA,sBAInBC,KAJmB;EAAA,IAInBA,KAJmB,2BAIX,KAJW;EAAA,IAKnBC,OALmB,QAKnBA,OALmB;EAAA,IAMnBC,KANmB,QAMnBA,KANmB;EAAA,IAOnBC,OAPmB,QAOnBA,OAPmB;EAAA,IAQnBC,OARmB,QAQnBA,OARmB;EAAA,IAShBC,MATgB;;EAAA,oBAWnB,6BAAC,gBAAD,eACMA,MADN;IAEE,GAAG,MAFL;IAGE,SAAS,EAAE,qBACTC,4BAAMC,YADG,EAETT,KAAK,GAAGQ,4BAAMR,KAAT,GAAiBK,OAAO,GAAGG,4BAAMH,OAAT,GAAmBF,OAAO,GAAGK,4BAAML,OAAT,GAAmBO,SAFjE,EAGTT,QAAQ,IAAIO,4BAAMP,QAHT,EAITC,KAAK,IAAIM,4BAAMN,KAJN,EAKTK,MA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
11
11
|
padding: var(--mirai-ui-notification-padding);
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
.notification.outlined {
|
|
12
15
|
border: solid 1px var(--mirai-ui-accent-border);
|
|
13
16
|
}
|
|
14
17
|
|
|
18
|
+
.notification.small {
|
|
19
|
+
padding: 0;
|
|
20
|
+
border: none;
|
|
21
|
+
background-color: transparent;
|
|
22
|
+
}
|
|
23
|
+
|
|
15
24
|
.notification * {
|
|
16
25
|
color: var(--mirai-ui-accent);
|
|
17
26
|
}
|
|
18
27
|
|
|
19
|
-
.notification.success {
|
|
28
|
+
.notification.success:not(.small) {
|
|
20
29
|
background-color: var(--mirai-ui-success-background);
|
|
21
30
|
border-color: var(--mirai-ui-success-border);
|
|
22
31
|
}
|
|
@@ -25,7 +34,7 @@
|
|
|
25
34
|
color: var(--mirai-ui-success);
|
|
26
35
|
}
|
|
27
36
|
|
|
28
|
-
.notification.error {
|
|
37
|
+
.notification.error:not(.small) {
|
|
29
38
|
background-color: var(--mirai-ui-error-background);
|
|
30
39
|
border-color: var(--mirai-ui-error-border);
|
|
31
40
|
}
|
|
@@ -34,7 +43,7 @@
|
|
|
34
43
|
color: var(--mirai-ui-error);
|
|
35
44
|
}
|
|
36
45
|
|
|
37
|
-
.notification.warning {
|
|
46
|
+
.notification.warning:not(.small) {
|
|
38
47
|
background-color: var(--mirai-ui-warning-background);
|
|
39
48
|
border-color: var(--mirai-ui-warning-border);
|
|
40
49
|
}
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
exports[`component:<Notification> inherit:className 1`] = `
|
|
4
4
|
<DocumentFragment>
|
|
5
5
|
<div
|
|
6
|
-
class="view row notification mirai"
|
|
6
|
+
class="view row notification outlined mirai"
|
|
7
7
|
>
|
|
8
8
|
<span
|
|
9
9
|
class="icon icon"
|
|
@@ -42,7 +42,7 @@ exports[`component:<Notification> inherit:className 1`] = `
|
|
|
42
42
|
exports[`component:<Notification> prop:error 1`] = `
|
|
43
43
|
<DocumentFragment>
|
|
44
44
|
<div
|
|
45
|
-
class="view row notification error"
|
|
45
|
+
class="view row notification error outlined"
|
|
46
46
|
>
|
|
47
47
|
<span
|
|
48
48
|
class="icon icon"
|
|
@@ -81,7 +81,7 @@ exports[`component:<Notification> prop:error 1`] = `
|
|
|
81
81
|
exports[`component:<Notification> prop:onClose 1`] = `
|
|
82
82
|
<DocumentFragment>
|
|
83
83
|
<div
|
|
84
|
-
class="view row notification"
|
|
84
|
+
class="view row notification outlined"
|
|
85
85
|
>
|
|
86
86
|
<span
|
|
87
87
|
class="icon icon"
|
|
@@ -149,10 +149,88 @@ exports[`component:<Notification> prop:onClose 1`] = `
|
|
|
149
149
|
</DocumentFragment>
|
|
150
150
|
`;
|
|
151
151
|
|
|
152
|
+
exports[`component:<Notification> prop:outlined 1`] = `
|
|
153
|
+
<DocumentFragment>
|
|
154
|
+
<div
|
|
155
|
+
class="view row notification"
|
|
156
|
+
>
|
|
157
|
+
<span
|
|
158
|
+
class="icon icon"
|
|
159
|
+
>
|
|
160
|
+
<svg
|
|
161
|
+
fill="currentColor"
|
|
162
|
+
height="1em"
|
|
163
|
+
stroke="currentColor"
|
|
164
|
+
stroke-width="0"
|
|
165
|
+
viewBox="0 0 24 24"
|
|
166
|
+
width="1em"
|
|
167
|
+
xmlns="http://www.w3.org/2000/svg"
|
|
168
|
+
>
|
|
169
|
+
<path
|
|
170
|
+
d="M0 0h24v24H0z"
|
|
171
|
+
fill="none"
|
|
172
|
+
/>
|
|
173
|
+
<path
|
|
174
|
+
d="M12 2C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2zm1 15h-2v-6h2v6zm0-8h-2V7h2v2z"
|
|
175
|
+
/>
|
|
176
|
+
</svg>
|
|
177
|
+
</span>
|
|
178
|
+
<div
|
|
179
|
+
class="view text"
|
|
180
|
+
>
|
|
181
|
+
<span
|
|
182
|
+
class="text action"
|
|
183
|
+
>
|
|
184
|
+
Lorem Ipsum...
|
|
185
|
+
</span>
|
|
186
|
+
</div>
|
|
187
|
+
</div>
|
|
188
|
+
</DocumentFragment>
|
|
189
|
+
`;
|
|
190
|
+
|
|
191
|
+
exports[`component:<Notification> prop:small 1`] = `
|
|
192
|
+
<DocumentFragment>
|
|
193
|
+
<div
|
|
194
|
+
class="view row notification outlined small"
|
|
195
|
+
>
|
|
196
|
+
<span
|
|
197
|
+
class="icon icon"
|
|
198
|
+
>
|
|
199
|
+
<svg
|
|
200
|
+
fill="currentColor"
|
|
201
|
+
height="1em"
|
|
202
|
+
stroke="currentColor"
|
|
203
|
+
stroke-width="0"
|
|
204
|
+
viewBox="0 0 24 24"
|
|
205
|
+
width="1em"
|
|
206
|
+
xmlns="http://www.w3.org/2000/svg"
|
|
207
|
+
>
|
|
208
|
+
<path
|
|
209
|
+
d="M0 0h24v24H0z"
|
|
210
|
+
fill="none"
|
|
211
|
+
/>
|
|
212
|
+
<path
|
|
213
|
+
d="M12 2C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2zm1 15h-2v-6h2v6zm0-8h-2V7h2v2z"
|
|
214
|
+
/>
|
|
215
|
+
</svg>
|
|
216
|
+
</span>
|
|
217
|
+
<div
|
|
218
|
+
class="view text"
|
|
219
|
+
>
|
|
220
|
+
<span
|
|
221
|
+
class="text action"
|
|
222
|
+
>
|
|
223
|
+
Lorem Ipsum...
|
|
224
|
+
</span>
|
|
225
|
+
</div>
|
|
226
|
+
</div>
|
|
227
|
+
</DocumentFragment>
|
|
228
|
+
`;
|
|
229
|
+
|
|
152
230
|
exports[`component:<Notification> prop:success 1`] = `
|
|
153
231
|
<DocumentFragment>
|
|
154
232
|
<div
|
|
155
|
-
class="view row notification success"
|
|
233
|
+
class="view row notification success outlined"
|
|
156
234
|
>
|
|
157
235
|
<span
|
|
158
236
|
class="icon icon"
|
|
@@ -191,7 +269,7 @@ exports[`component:<Notification> prop:success 1`] = `
|
|
|
191
269
|
exports[`component:<Notification> prop:title 1`] = `
|
|
192
270
|
<DocumentFragment>
|
|
193
271
|
<div
|
|
194
|
-
class="view row notification"
|
|
272
|
+
class="view row notification outlined"
|
|
195
273
|
>
|
|
196
274
|
<span
|
|
197
275
|
class="icon icon"
|
|
@@ -235,7 +313,7 @@ exports[`component:<Notification> prop:title 1`] = `
|
|
|
235
313
|
exports[`component:<Notification> prop:warning 1`] = `
|
|
236
314
|
<DocumentFragment>
|
|
237
315
|
<div
|
|
238
|
-
class="view row notification warning"
|
|
316
|
+
class="view row notification warning outlined"
|
|
239
317
|
>
|
|
240
318
|
<span
|
|
241
319
|
class="icon icon"
|
|
@@ -274,7 +352,7 @@ exports[`component:<Notification> prop:warning 1`] = `
|
|
|
274
352
|
exports[`component:<Notification> renders 1`] = `
|
|
275
353
|
<DocumentFragment>
|
|
276
354
|
<div
|
|
277
|
-
class="view row notification"
|
|
355
|
+
class="view row notification outlined"
|
|
278
356
|
>
|
|
279
357
|
<span
|
|
280
358
|
class="icon icon"
|
|
@@ -313,7 +391,7 @@ exports[`component:<Notification> renders 1`] = `
|
|
|
313
391
|
exports[`component:<Notification> testID 1`] = `
|
|
314
392
|
<DocumentFragment>
|
|
315
393
|
<div
|
|
316
|
-
class="view row notification"
|
|
394
|
+
class="view row notification outlined"
|
|
317
395
|
data-testid="mirai"
|
|
318
396
|
>
|
|
319
397
|
<span
|