funda-ui 1.0.300 → 1.0.312
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/Toast/index.css +22 -10
- package/Toast/index.d.ts +3 -1
- package/Toast/index.js +60 -40
- package/lib/cjs/Toast/index.d.ts +3 -1
- package/lib/cjs/Toast/index.js +60 -40
- package/lib/css/Toast/index.css +22 -10
- package/lib/esm/Toast/Item.tsx +8 -5
- package/lib/esm/Toast/index.scss +35 -13
- package/lib/esm/Toast/index.tsx +54 -39
- package/package.json +1 -1
package/Toast/index.css
CHANGED
|
@@ -3,39 +3,45 @@
|
|
|
3
3
|
/* ====================================================== */
|
|
4
4
|
.toasts__wrapper {
|
|
5
5
|
--bs-toast-zindex: 1090;
|
|
6
|
-
|
|
6
|
+
--toasts-offset-top: 35px;
|
|
7
|
+
--toasts-offset-bottom: 15px;
|
|
8
|
+
--toasts-offset-bothsides: 15px;
|
|
9
|
+
--toasts-container-gap: 0.5rem;
|
|
10
|
+
--toasts-container-width: 350px;
|
|
11
|
+
width: var(--toasts-container-width);
|
|
7
12
|
position: fixed;
|
|
8
13
|
left: 50%;
|
|
9
14
|
bottom: 0;
|
|
10
15
|
z-index: var(--bs-toast-zindex);
|
|
11
16
|
pointer-events: none;
|
|
12
17
|
transition: 0.1s ease-in-out;
|
|
18
|
+
/* cascading divs */
|
|
13
19
|
}
|
|
14
20
|
.toasts__wrapper--bottom-left {
|
|
15
|
-
left:
|
|
21
|
+
left: var(--toasts-offset-bothsides);
|
|
16
22
|
}
|
|
17
23
|
.toasts__wrapper--bottom-right {
|
|
18
24
|
left: auto;
|
|
19
|
-
right:
|
|
25
|
+
right: var(--toasts-offset-bothsides);
|
|
20
26
|
}
|
|
21
27
|
.toasts__wrapper--bottom-center {
|
|
22
28
|
left: 50%;
|
|
23
29
|
transform: translateX(-50%);
|
|
24
30
|
}
|
|
25
31
|
.toasts__wrapper--top-left {
|
|
26
|
-
left:
|
|
32
|
+
left: var(--toasts-offset-bothsides);
|
|
27
33
|
bottom: auto;
|
|
28
|
-
top:
|
|
34
|
+
top: var(--toasts-offset-top);
|
|
29
35
|
}
|
|
30
36
|
.toasts__wrapper--top-right {
|
|
31
37
|
left: auto;
|
|
32
|
-
right:
|
|
33
|
-
top:
|
|
38
|
+
right: var(--toasts-offset-bothsides);
|
|
39
|
+
top: var(--toasts-offset-top);
|
|
34
40
|
}
|
|
35
41
|
.toasts__wrapper--top-center {
|
|
36
42
|
left: 50%;
|
|
37
43
|
transform: translateX(-50%);
|
|
38
|
-
top:
|
|
44
|
+
top: var(--toasts-offset-top);
|
|
39
45
|
}
|
|
40
46
|
.toasts__wrapper--vertical-center {
|
|
41
47
|
left: 50%;
|
|
@@ -46,7 +52,7 @@
|
|
|
46
52
|
.toasts__wrapper .toasts {
|
|
47
53
|
position: relative;
|
|
48
54
|
width: 100%;
|
|
49
|
-
bottom:
|
|
55
|
+
bottom: var(--toasts-offset-bottom);
|
|
50
56
|
display: flex;
|
|
51
57
|
flex-flow: column-reverse nowrap;
|
|
52
58
|
}
|
|
@@ -60,7 +66,13 @@
|
|
|
60
66
|
background-color: transparent;
|
|
61
67
|
pointer-events: none;
|
|
62
68
|
}
|
|
63
|
-
.toasts__wrapper .
|
|
69
|
+
.toasts__wrapper .toast-container {
|
|
70
|
+
margin-bottom: var(--toasts-container-gap);
|
|
71
|
+
}
|
|
72
|
+
.toasts__wrapper.toasts__wrapper--cascading .toast-container {
|
|
73
|
+
margin-bottom: 0;
|
|
74
|
+
}
|
|
75
|
+
.toasts__wrapper.toasts__wrapper--cascading .toasts:hover .toast-container {
|
|
64
76
|
transform: perspective(100px) translateZ(0) !important;
|
|
65
77
|
}
|
|
66
78
|
|
package/Toast/index.d.ts
CHANGED
|
@@ -19,6 +19,8 @@ declare type ToastProps = {
|
|
|
19
19
|
autoCloseReverse?: boolean;
|
|
20
20
|
/** You can not close pop-win when it is enabled */
|
|
21
21
|
lock?: boolean;
|
|
22
|
+
/** Whether to use cascading styles */
|
|
23
|
+
cascading?: boolean;
|
|
22
24
|
/** Self-defined class name for body*/
|
|
23
25
|
schemeBody?: string;
|
|
24
26
|
/** Self-defined class name for header */
|
|
@@ -29,7 +31,7 @@ declare type ToastProps = {
|
|
|
29
31
|
closeDisabled?: boolean;
|
|
30
32
|
/** -- */
|
|
31
33
|
id?: string;
|
|
32
|
-
onClose?: (e:
|
|
34
|
+
onClose?: (e: HTMLDivElement, currentIndex: number, data: HTMLDivElement[]) => void;
|
|
33
35
|
};
|
|
34
36
|
declare const Toast: (props: ToastProps) => JSX.Element;
|
|
35
37
|
export default Toast;
|
package/Toast/index.js
CHANGED
|
@@ -111,17 +111,19 @@ var Item = function Item(props) {
|
|
|
111
111
|
message = props.message,
|
|
112
112
|
depth = props.depth,
|
|
113
113
|
lock = props.lock,
|
|
114
|
+
cascading = props.cascading,
|
|
114
115
|
schemeBody = props.schemeBody,
|
|
115
116
|
schemeHeader = props.schemeHeader,
|
|
116
117
|
closeBtnColor = props.closeBtnColor,
|
|
117
|
-
closeDisabled = props.closeDisabled
|
|
118
|
-
closeEv = props.closeEv;
|
|
118
|
+
closeDisabled = props.closeDisabled;
|
|
119
119
|
return /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default().createElement((external_root_React_commonjs2_react_commonjs_react_amd_react_default()).Fragment, null, /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default().createElement("div", {
|
|
120
120
|
className: "toast-container",
|
|
121
121
|
"data-index": index,
|
|
122
|
-
style: {
|
|
122
|
+
style: cascading ? {
|
|
123
123
|
transform: "perspective(100px) translateZ(-".concat(2 * index, "px) translateY(").concat(35 * index, "px)"),
|
|
124
124
|
zIndex: depth
|
|
125
|
+
} : {
|
|
126
|
+
zIndex: depth
|
|
125
127
|
}
|
|
126
128
|
}, /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default().createElement("div", {
|
|
127
129
|
className: "toast fade show ".concat(schemeBody ? schemeBody : ''),
|
|
@@ -174,6 +176,7 @@ var Toast = function Toast(props) {
|
|
|
174
176
|
autoCloseTime = props.autoCloseTime,
|
|
175
177
|
autoCloseReverse = props.autoCloseReverse,
|
|
176
178
|
lock = props.lock,
|
|
179
|
+
cascading = props.cascading,
|
|
177
180
|
data = props.data,
|
|
178
181
|
schemeBody = props.schemeBody,
|
|
179
182
|
schemeHeader = props.schemeHeader,
|
|
@@ -185,6 +188,7 @@ var Toast = function Toast(props) {
|
|
|
185
188
|
var idRes = id || uniqueID;
|
|
186
189
|
var rootRef = (0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useRef)(null);
|
|
187
190
|
var depth = data.length + 1;
|
|
191
|
+
var cascadingEnabled = typeof cascading === 'undefined' ? true : cascading;
|
|
188
192
|
function init() {
|
|
189
193
|
// Move HTML templates to tag end body </body>
|
|
190
194
|
// render() don't use "Fragment", in order to avoid error "Failed to execute 'insertBefore' on 'Node'"
|
|
@@ -195,7 +199,8 @@ var Toast = function Toast(props) {
|
|
|
195
199
|
[].slice.call(rootRef.current.querySelectorAll('[data-close]')).forEach(function (node) {
|
|
196
200
|
node.addEventListener('pointerdown', function (e) {
|
|
197
201
|
var index = node.dataset.index;
|
|
198
|
-
|
|
202
|
+
var currentItem = node.closest('.toast-container');
|
|
203
|
+
handleClose(index, currentItem);
|
|
199
204
|
});
|
|
200
205
|
});
|
|
201
206
|
}
|
|
@@ -205,11 +210,11 @@ var Toast = function Toast(props) {
|
|
|
205
210
|
var $toast = document.querySelector("#".concat(rootRef.current.id));
|
|
206
211
|
if ($toast !== null) {
|
|
207
212
|
if ($toast.dataset.async == 'true') {
|
|
208
|
-
var _list = rootRef.current.querySelectorAll('.toast-container');
|
|
209
|
-
|
|
213
|
+
var _list = [].slice.call(rootRef.current.querySelectorAll('.toast-container'));
|
|
214
|
+
_list.forEach(function (node, i) {
|
|
210
215
|
node.classList.remove('hide-end');
|
|
211
216
|
// rearrange
|
|
212
|
-
node.style.transform = "perspective(100px) translateZ(-".concat(2 * i, "px) translateY(").concat(35 * i, "px)");
|
|
217
|
+
if (cascadingEnabled) node.style.transform = "perspective(100px) translateZ(-".concat(2 * i, "px) translateY(").concat(35 * i, "px)");
|
|
213
218
|
});
|
|
214
219
|
}
|
|
215
220
|
}
|
|
@@ -222,45 +227,42 @@ var Toast = function Toast(props) {
|
|
|
222
227
|
autoClose(0, items, _autoCloseTime);
|
|
223
228
|
}
|
|
224
229
|
}
|
|
225
|
-
function handleClose(index) {
|
|
226
|
-
var
|
|
227
|
-
|
|
228
|
-
var _list = rootRef.current.querySelectorAll('.toast-container');
|
|
229
|
-
_list[index].classList.add('hide-start');
|
|
230
|
+
function handleClose(index, currentItem) {
|
|
231
|
+
var _list = [].slice.call(rootRef.current.querySelectorAll('.toast-container'));
|
|
232
|
+
currentItem.classList.add('hide-start');
|
|
230
233
|
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
234
|
+
//Let the removed animation show
|
|
235
|
+
setTimeout(function () {
|
|
236
|
+
_list.forEach(function (node, i) {
|
|
237
|
+
node.classList.remove('hide-start');
|
|
238
|
+
});
|
|
236
239
|
|
|
237
|
-
|
|
238
|
-
|
|
240
|
+
// remove current
|
|
241
|
+
currentItem.classList.add('hide-end');
|
|
239
242
|
|
|
240
|
-
|
|
241
|
-
|
|
243
|
+
// rearrange
|
|
244
|
+
if (cascadingEnabled) {
|
|
245
|
+
_list.filter(function (node) {
|
|
242
246
|
return !node.classList.contains('hide-end');
|
|
243
247
|
}).forEach(function (node, index) {
|
|
244
248
|
node.style.transform = "perspective(100px) translateZ(-".concat(2 * index, "px) translateY(").concat(35 * index, "px)");
|
|
245
249
|
});
|
|
250
|
+
}
|
|
246
251
|
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
252
|
+
//
|
|
253
|
+
onClose === null || onClose === void 0 ? void 0 : onClose(rootRef.current, Number(index), _list.filter(function (node) {
|
|
254
|
+
return !node.classList.contains('hide-end');
|
|
255
|
+
}));
|
|
256
|
+
}, 300);
|
|
251
257
|
}
|
|
252
258
|
function autoClose(index, items) {
|
|
253
259
|
var delay = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 3000;
|
|
254
260
|
if (items.length === index) {
|
|
255
|
-
//
|
|
256
|
-
onClose === null || onClose === void 0 ? void 0 : onClose(rootRef.current, items);
|
|
257
|
-
|
|
258
|
-
//
|
|
259
261
|
clearTimeout(window.setCloseToast);
|
|
260
262
|
return;
|
|
261
263
|
}
|
|
262
264
|
window.setCloseToast = setTimeout(function () {
|
|
263
|
-
var _list = rootRef.current.querySelectorAll('.toast-container');
|
|
265
|
+
var _list = [].slice.call(rootRef.current.querySelectorAll('.toast-container'));
|
|
264
266
|
if (autoCloseReverse) {
|
|
265
267
|
_list[items.length - index].classList.add('hide-start');
|
|
266
268
|
} else {
|
|
@@ -269,26 +271,39 @@ var Toast = function Toast(props) {
|
|
|
269
271
|
|
|
270
272
|
//Let the removed animation show
|
|
271
273
|
setTimeout(function () {
|
|
272
|
-
|
|
274
|
+
_list.forEach(function (node) {
|
|
273
275
|
node.classList.remove('hide-start');
|
|
274
276
|
});
|
|
275
277
|
|
|
276
278
|
// remove current
|
|
277
279
|
if (autoCloseReverse) {
|
|
278
280
|
_list[items.length - index].classList.add('hide-end');
|
|
281
|
+
|
|
282
|
+
//
|
|
283
|
+
onClose === null || onClose === void 0 ? void 0 : onClose(rootRef.current, Number(items.length - index), _list.filter(function (node) {
|
|
284
|
+
return !node.classList.contains('hide-end');
|
|
285
|
+
}));
|
|
279
286
|
} else {
|
|
280
287
|
_list[index - 1].classList.add('hide-end');
|
|
288
|
+
//
|
|
289
|
+
onClose === null || onClose === void 0 ? void 0 : onClose(rootRef.current, Number(index - 1), _list.filter(function (node) {
|
|
290
|
+
return !node.classList.contains('hide-end');
|
|
291
|
+
}));
|
|
281
292
|
}
|
|
282
293
|
|
|
283
294
|
// rearrange
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
295
|
+
if (cascadingEnabled) {
|
|
296
|
+
_list.filter(function (node) {
|
|
297
|
+
return !node.classList.contains('hide-end');
|
|
298
|
+
}).forEach(function (node, i) {
|
|
299
|
+
node.style.transform = "perspective(100px) translateZ(-".concat(2 * i, "px) translateY(").concat(35 * i, "px)");
|
|
300
|
+
});
|
|
301
|
+
}
|
|
302
|
+
|
|
303
|
+
//
|
|
289
304
|
autoClose(index, items, delay);
|
|
290
305
|
}, 300);
|
|
291
|
-
}, delay
|
|
306
|
+
}, delay);
|
|
292
307
|
index++;
|
|
293
308
|
}
|
|
294
309
|
(0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useEffect)(function () {
|
|
@@ -305,12 +320,17 @@ var Toast = function Toast(props) {
|
|
|
305
320
|
// Remove all toasts
|
|
306
321
|
var _el = document.querySelector("#toasts__wrapper-".concat(idRes));
|
|
307
322
|
if (_el !== null) _el.remove();
|
|
323
|
+
|
|
324
|
+
// remove all events
|
|
325
|
+
[].slice.call(rootRef.current.querySelectorAll('[data-close]')).forEach(function (node) {
|
|
326
|
+
node.replaceWith(node.cloneNode(true));
|
|
327
|
+
});
|
|
308
328
|
};
|
|
309
329
|
}, [data]);
|
|
310
330
|
return /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default().createElement("div", null, /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default().createElement("div", {
|
|
311
331
|
id: "toasts__wrapper-".concat(idRes),
|
|
312
332
|
"data-async": async ? async : false,
|
|
313
|
-
className: "toasts__wrapper toasts__wrapper--".concat(direction ? direction : 'bottom-center'),
|
|
333
|
+
className: "toasts__wrapper toasts__wrapper--".concat(direction ? direction : 'bottom-center', " ").concat(cascadingEnabled ? 'toasts__wrapper--cascading' : ''),
|
|
314
334
|
ref: rootRef
|
|
315
335
|
}, /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default().createElement("div", {
|
|
316
336
|
className: "toasts"
|
|
@@ -322,12 +342,12 @@ var Toast = function Toast(props) {
|
|
|
322
342
|
title: item.title,
|
|
323
343
|
note: item.note,
|
|
324
344
|
lock: lock,
|
|
345
|
+
cascading: cascadingEnabled,
|
|
325
346
|
schemeBody: schemeBody,
|
|
326
347
|
schemeHeader: schemeHeader,
|
|
327
348
|
closeBtnColor: closeBtnColor,
|
|
328
349
|
closeDisabled: closeDisabled,
|
|
329
|
-
message: item.message
|
|
330
|
-
closeEv: handleClose
|
|
350
|
+
message: item.message
|
|
331
351
|
});
|
|
332
352
|
}))));
|
|
333
353
|
};
|
package/lib/cjs/Toast/index.d.ts
CHANGED
|
@@ -19,6 +19,8 @@ declare type ToastProps = {
|
|
|
19
19
|
autoCloseReverse?: boolean;
|
|
20
20
|
/** You can not close pop-win when it is enabled */
|
|
21
21
|
lock?: boolean;
|
|
22
|
+
/** Whether to use cascading styles */
|
|
23
|
+
cascading?: boolean;
|
|
22
24
|
/** Self-defined class name for body*/
|
|
23
25
|
schemeBody?: string;
|
|
24
26
|
/** Self-defined class name for header */
|
|
@@ -29,7 +31,7 @@ declare type ToastProps = {
|
|
|
29
31
|
closeDisabled?: boolean;
|
|
30
32
|
/** -- */
|
|
31
33
|
id?: string;
|
|
32
|
-
onClose?: (e:
|
|
34
|
+
onClose?: (e: HTMLDivElement, currentIndex: number, data: HTMLDivElement[]) => void;
|
|
33
35
|
};
|
|
34
36
|
declare const Toast: (props: ToastProps) => JSX.Element;
|
|
35
37
|
export default Toast;
|
package/lib/cjs/Toast/index.js
CHANGED
|
@@ -111,17 +111,19 @@ var Item = function Item(props) {
|
|
|
111
111
|
message = props.message,
|
|
112
112
|
depth = props.depth,
|
|
113
113
|
lock = props.lock,
|
|
114
|
+
cascading = props.cascading,
|
|
114
115
|
schemeBody = props.schemeBody,
|
|
115
116
|
schemeHeader = props.schemeHeader,
|
|
116
117
|
closeBtnColor = props.closeBtnColor,
|
|
117
|
-
closeDisabled = props.closeDisabled
|
|
118
|
-
closeEv = props.closeEv;
|
|
118
|
+
closeDisabled = props.closeDisabled;
|
|
119
119
|
return /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default().createElement((external_root_React_commonjs2_react_commonjs_react_amd_react_default()).Fragment, null, /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default().createElement("div", {
|
|
120
120
|
className: "toast-container",
|
|
121
121
|
"data-index": index,
|
|
122
|
-
style: {
|
|
122
|
+
style: cascading ? {
|
|
123
123
|
transform: "perspective(100px) translateZ(-".concat(2 * index, "px) translateY(").concat(35 * index, "px)"),
|
|
124
124
|
zIndex: depth
|
|
125
|
+
} : {
|
|
126
|
+
zIndex: depth
|
|
125
127
|
}
|
|
126
128
|
}, /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default().createElement("div", {
|
|
127
129
|
className: "toast fade show ".concat(schemeBody ? schemeBody : ''),
|
|
@@ -174,6 +176,7 @@ var Toast = function Toast(props) {
|
|
|
174
176
|
autoCloseTime = props.autoCloseTime,
|
|
175
177
|
autoCloseReverse = props.autoCloseReverse,
|
|
176
178
|
lock = props.lock,
|
|
179
|
+
cascading = props.cascading,
|
|
177
180
|
data = props.data,
|
|
178
181
|
schemeBody = props.schemeBody,
|
|
179
182
|
schemeHeader = props.schemeHeader,
|
|
@@ -185,6 +188,7 @@ var Toast = function Toast(props) {
|
|
|
185
188
|
var idRes = id || uniqueID;
|
|
186
189
|
var rootRef = (0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useRef)(null);
|
|
187
190
|
var depth = data.length + 1;
|
|
191
|
+
var cascadingEnabled = typeof cascading === 'undefined' ? true : cascading;
|
|
188
192
|
function init() {
|
|
189
193
|
// Move HTML templates to tag end body </body>
|
|
190
194
|
// render() don't use "Fragment", in order to avoid error "Failed to execute 'insertBefore' on 'Node'"
|
|
@@ -195,7 +199,8 @@ var Toast = function Toast(props) {
|
|
|
195
199
|
[].slice.call(rootRef.current.querySelectorAll('[data-close]')).forEach(function (node) {
|
|
196
200
|
node.addEventListener('pointerdown', function (e) {
|
|
197
201
|
var index = node.dataset.index;
|
|
198
|
-
|
|
202
|
+
var currentItem = node.closest('.toast-container');
|
|
203
|
+
handleClose(index, currentItem);
|
|
199
204
|
});
|
|
200
205
|
});
|
|
201
206
|
}
|
|
@@ -205,11 +210,11 @@ var Toast = function Toast(props) {
|
|
|
205
210
|
var $toast = document.querySelector("#".concat(rootRef.current.id));
|
|
206
211
|
if ($toast !== null) {
|
|
207
212
|
if ($toast.dataset.async == 'true') {
|
|
208
|
-
var _list = rootRef.current.querySelectorAll('.toast-container');
|
|
209
|
-
|
|
213
|
+
var _list = [].slice.call(rootRef.current.querySelectorAll('.toast-container'));
|
|
214
|
+
_list.forEach(function (node, i) {
|
|
210
215
|
node.classList.remove('hide-end');
|
|
211
216
|
// rearrange
|
|
212
|
-
node.style.transform = "perspective(100px) translateZ(-".concat(2 * i, "px) translateY(").concat(35 * i, "px)");
|
|
217
|
+
if (cascadingEnabled) node.style.transform = "perspective(100px) translateZ(-".concat(2 * i, "px) translateY(").concat(35 * i, "px)");
|
|
213
218
|
});
|
|
214
219
|
}
|
|
215
220
|
}
|
|
@@ -222,45 +227,42 @@ var Toast = function Toast(props) {
|
|
|
222
227
|
autoClose(0, items, _autoCloseTime);
|
|
223
228
|
}
|
|
224
229
|
}
|
|
225
|
-
function handleClose(index) {
|
|
226
|
-
var
|
|
227
|
-
|
|
228
|
-
var _list = rootRef.current.querySelectorAll('.toast-container');
|
|
229
|
-
_list[index].classList.add('hide-start');
|
|
230
|
+
function handleClose(index, currentItem) {
|
|
231
|
+
var _list = [].slice.call(rootRef.current.querySelectorAll('.toast-container'));
|
|
232
|
+
currentItem.classList.add('hide-start');
|
|
230
233
|
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
234
|
+
//Let the removed animation show
|
|
235
|
+
setTimeout(function () {
|
|
236
|
+
_list.forEach(function (node, i) {
|
|
237
|
+
node.classList.remove('hide-start');
|
|
238
|
+
});
|
|
236
239
|
|
|
237
|
-
|
|
238
|
-
|
|
240
|
+
// remove current
|
|
241
|
+
currentItem.classList.add('hide-end');
|
|
239
242
|
|
|
240
|
-
|
|
241
|
-
|
|
243
|
+
// rearrange
|
|
244
|
+
if (cascadingEnabled) {
|
|
245
|
+
_list.filter(function (node) {
|
|
242
246
|
return !node.classList.contains('hide-end');
|
|
243
247
|
}).forEach(function (node, index) {
|
|
244
248
|
node.style.transform = "perspective(100px) translateZ(-".concat(2 * index, "px) translateY(").concat(35 * index, "px)");
|
|
245
249
|
});
|
|
250
|
+
}
|
|
246
251
|
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
252
|
+
//
|
|
253
|
+
onClose === null || onClose === void 0 ? void 0 : onClose(rootRef.current, Number(index), _list.filter(function (node) {
|
|
254
|
+
return !node.classList.contains('hide-end');
|
|
255
|
+
}));
|
|
256
|
+
}, 300);
|
|
251
257
|
}
|
|
252
258
|
function autoClose(index, items) {
|
|
253
259
|
var delay = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 3000;
|
|
254
260
|
if (items.length === index) {
|
|
255
|
-
//
|
|
256
|
-
onClose === null || onClose === void 0 ? void 0 : onClose(rootRef.current, items);
|
|
257
|
-
|
|
258
|
-
//
|
|
259
261
|
clearTimeout(window.setCloseToast);
|
|
260
262
|
return;
|
|
261
263
|
}
|
|
262
264
|
window.setCloseToast = setTimeout(function () {
|
|
263
|
-
var _list = rootRef.current.querySelectorAll('.toast-container');
|
|
265
|
+
var _list = [].slice.call(rootRef.current.querySelectorAll('.toast-container'));
|
|
264
266
|
if (autoCloseReverse) {
|
|
265
267
|
_list[items.length - index].classList.add('hide-start');
|
|
266
268
|
} else {
|
|
@@ -269,26 +271,39 @@ var Toast = function Toast(props) {
|
|
|
269
271
|
|
|
270
272
|
//Let the removed animation show
|
|
271
273
|
setTimeout(function () {
|
|
272
|
-
|
|
274
|
+
_list.forEach(function (node) {
|
|
273
275
|
node.classList.remove('hide-start');
|
|
274
276
|
});
|
|
275
277
|
|
|
276
278
|
// remove current
|
|
277
279
|
if (autoCloseReverse) {
|
|
278
280
|
_list[items.length - index].classList.add('hide-end');
|
|
281
|
+
|
|
282
|
+
//
|
|
283
|
+
onClose === null || onClose === void 0 ? void 0 : onClose(rootRef.current, Number(items.length - index), _list.filter(function (node) {
|
|
284
|
+
return !node.classList.contains('hide-end');
|
|
285
|
+
}));
|
|
279
286
|
} else {
|
|
280
287
|
_list[index - 1].classList.add('hide-end');
|
|
288
|
+
//
|
|
289
|
+
onClose === null || onClose === void 0 ? void 0 : onClose(rootRef.current, Number(index - 1), _list.filter(function (node) {
|
|
290
|
+
return !node.classList.contains('hide-end');
|
|
291
|
+
}));
|
|
281
292
|
}
|
|
282
293
|
|
|
283
294
|
// rearrange
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
295
|
+
if (cascadingEnabled) {
|
|
296
|
+
_list.filter(function (node) {
|
|
297
|
+
return !node.classList.contains('hide-end');
|
|
298
|
+
}).forEach(function (node, i) {
|
|
299
|
+
node.style.transform = "perspective(100px) translateZ(-".concat(2 * i, "px) translateY(").concat(35 * i, "px)");
|
|
300
|
+
});
|
|
301
|
+
}
|
|
302
|
+
|
|
303
|
+
//
|
|
289
304
|
autoClose(index, items, delay);
|
|
290
305
|
}, 300);
|
|
291
|
-
}, delay
|
|
306
|
+
}, delay);
|
|
292
307
|
index++;
|
|
293
308
|
}
|
|
294
309
|
(0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useEffect)(function () {
|
|
@@ -305,12 +320,17 @@ var Toast = function Toast(props) {
|
|
|
305
320
|
// Remove all toasts
|
|
306
321
|
var _el = document.querySelector("#toasts__wrapper-".concat(idRes));
|
|
307
322
|
if (_el !== null) _el.remove();
|
|
323
|
+
|
|
324
|
+
// remove all events
|
|
325
|
+
[].slice.call(rootRef.current.querySelectorAll('[data-close]')).forEach(function (node) {
|
|
326
|
+
node.replaceWith(node.cloneNode(true));
|
|
327
|
+
});
|
|
308
328
|
};
|
|
309
329
|
}, [data]);
|
|
310
330
|
return /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default().createElement("div", null, /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default().createElement("div", {
|
|
311
331
|
id: "toasts__wrapper-".concat(idRes),
|
|
312
332
|
"data-async": async ? async : false,
|
|
313
|
-
className: "toasts__wrapper toasts__wrapper--".concat(direction ? direction : 'bottom-center'),
|
|
333
|
+
className: "toasts__wrapper toasts__wrapper--".concat(direction ? direction : 'bottom-center', " ").concat(cascadingEnabled ? 'toasts__wrapper--cascading' : ''),
|
|
314
334
|
ref: rootRef
|
|
315
335
|
}, /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default().createElement("div", {
|
|
316
336
|
className: "toasts"
|
|
@@ -322,12 +342,12 @@ var Toast = function Toast(props) {
|
|
|
322
342
|
title: item.title,
|
|
323
343
|
note: item.note,
|
|
324
344
|
lock: lock,
|
|
345
|
+
cascading: cascadingEnabled,
|
|
325
346
|
schemeBody: schemeBody,
|
|
326
347
|
schemeHeader: schemeHeader,
|
|
327
348
|
closeBtnColor: closeBtnColor,
|
|
328
349
|
closeDisabled: closeDisabled,
|
|
329
|
-
message: item.message
|
|
330
|
-
closeEv: handleClose
|
|
350
|
+
message: item.message
|
|
331
351
|
});
|
|
332
352
|
}))));
|
|
333
353
|
};
|
package/lib/css/Toast/index.css
CHANGED
|
@@ -3,39 +3,45 @@
|
|
|
3
3
|
/* ====================================================== */
|
|
4
4
|
.toasts__wrapper {
|
|
5
5
|
--bs-toast-zindex: 1090;
|
|
6
|
-
|
|
6
|
+
--toasts-offset-top: 35px;
|
|
7
|
+
--toasts-offset-bottom: 15px;
|
|
8
|
+
--toasts-offset-bothsides: 15px;
|
|
9
|
+
--toasts-container-gap: 0.5rem;
|
|
10
|
+
--toasts-container-width: 350px;
|
|
11
|
+
width: var(--toasts-container-width);
|
|
7
12
|
position: fixed;
|
|
8
13
|
left: 50%;
|
|
9
14
|
bottom: 0;
|
|
10
15
|
z-index: var(--bs-toast-zindex);
|
|
11
16
|
pointer-events: none;
|
|
12
17
|
transition: 0.1s ease-in-out;
|
|
18
|
+
/* cascading divs */
|
|
13
19
|
}
|
|
14
20
|
.toasts__wrapper--bottom-left {
|
|
15
|
-
left:
|
|
21
|
+
left: var(--toasts-offset-bothsides);
|
|
16
22
|
}
|
|
17
23
|
.toasts__wrapper--bottom-right {
|
|
18
24
|
left: auto;
|
|
19
|
-
right:
|
|
25
|
+
right: var(--toasts-offset-bothsides);
|
|
20
26
|
}
|
|
21
27
|
.toasts__wrapper--bottom-center {
|
|
22
28
|
left: 50%;
|
|
23
29
|
transform: translateX(-50%);
|
|
24
30
|
}
|
|
25
31
|
.toasts__wrapper--top-left {
|
|
26
|
-
left:
|
|
32
|
+
left: var(--toasts-offset-bothsides);
|
|
27
33
|
bottom: auto;
|
|
28
|
-
top:
|
|
34
|
+
top: var(--toasts-offset-top);
|
|
29
35
|
}
|
|
30
36
|
.toasts__wrapper--top-right {
|
|
31
37
|
left: auto;
|
|
32
|
-
right:
|
|
33
|
-
top:
|
|
38
|
+
right: var(--toasts-offset-bothsides);
|
|
39
|
+
top: var(--toasts-offset-top);
|
|
34
40
|
}
|
|
35
41
|
.toasts__wrapper--top-center {
|
|
36
42
|
left: 50%;
|
|
37
43
|
transform: translateX(-50%);
|
|
38
|
-
top:
|
|
44
|
+
top: var(--toasts-offset-top);
|
|
39
45
|
}
|
|
40
46
|
.toasts__wrapper--vertical-center {
|
|
41
47
|
left: 50%;
|
|
@@ -46,7 +52,7 @@
|
|
|
46
52
|
.toasts__wrapper .toasts {
|
|
47
53
|
position: relative;
|
|
48
54
|
width: 100%;
|
|
49
|
-
bottom:
|
|
55
|
+
bottom: var(--toasts-offset-bottom);
|
|
50
56
|
display: flex;
|
|
51
57
|
flex-flow: column-reverse nowrap;
|
|
52
58
|
}
|
|
@@ -60,7 +66,13 @@
|
|
|
60
66
|
background-color: transparent;
|
|
61
67
|
pointer-events: none;
|
|
62
68
|
}
|
|
63
|
-
.toasts__wrapper .
|
|
69
|
+
.toasts__wrapper .toast-container {
|
|
70
|
+
margin-bottom: var(--toasts-container-gap);
|
|
71
|
+
}
|
|
72
|
+
.toasts__wrapper.toasts__wrapper--cascading .toast-container {
|
|
73
|
+
margin-bottom: 0;
|
|
74
|
+
}
|
|
75
|
+
.toasts__wrapper.toasts__wrapper--cascading .toasts:hover .toast-container {
|
|
64
76
|
transform: perspective(100px) translateZ(0) !important;
|
|
65
77
|
}
|
|
66
78
|
|
package/lib/esm/Toast/Item.tsx
CHANGED
|
@@ -11,8 +11,7 @@ interface ItemProps extends React.ComponentPropsWithoutRef<any> {
|
|
|
11
11
|
closeBtnColor?: string;
|
|
12
12
|
closeDisabled?: boolean;
|
|
13
13
|
lock?: boolean;
|
|
14
|
-
|
|
15
|
-
closeEv?: (index: number) => void | undefined;
|
|
14
|
+
cascading?: boolean;
|
|
16
15
|
};
|
|
17
16
|
|
|
18
17
|
const Item = (props: ItemProps) => {
|
|
@@ -24,22 +23,26 @@ const Item = (props: ItemProps) => {
|
|
|
24
23
|
message,
|
|
25
24
|
depth,
|
|
26
25
|
lock,
|
|
26
|
+
cascading,
|
|
27
27
|
schemeBody,
|
|
28
28
|
schemeHeader,
|
|
29
29
|
closeBtnColor,
|
|
30
|
-
closeDisabled
|
|
31
|
-
closeEv
|
|
30
|
+
closeDisabled
|
|
32
31
|
} = props;
|
|
33
32
|
|
|
33
|
+
|
|
34
|
+
|
|
34
35
|
return (
|
|
35
36
|
<>
|
|
36
37
|
|
|
37
38
|
<div
|
|
38
39
|
className={`toast-container`}
|
|
39
40
|
data-index={index}
|
|
40
|
-
style={{
|
|
41
|
+
style={cascading ? {
|
|
41
42
|
transform: `perspective(100px) translateZ(-${2 * index}px) translateY(${35 * index}px)`,
|
|
42
43
|
zIndex: depth
|
|
44
|
+
} : {
|
|
45
|
+
zIndex: depth
|
|
43
46
|
}}>
|
|
44
47
|
|
|
45
48
|
{/* Bootstrap toast */}
|
package/lib/esm/Toast/index.scss
CHANGED
|
@@ -5,7 +5,15 @@
|
|
|
5
5
|
|
|
6
6
|
.toasts__wrapper {
|
|
7
7
|
--bs-toast-zindex: 1090;
|
|
8
|
-
|
|
8
|
+
--toasts-offset-top: 35px;
|
|
9
|
+
--toasts-offset-bottom: 15px;
|
|
10
|
+
--toasts-offset-bothsides: 15px;
|
|
11
|
+
--toasts-container-gap: 0.5rem;
|
|
12
|
+
--toasts-container-width: 350px;
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
width: var(--toasts-container-width);
|
|
9
17
|
position: fixed;
|
|
10
18
|
left: 50%;
|
|
11
19
|
bottom: 0;
|
|
@@ -14,12 +22,12 @@
|
|
|
14
22
|
transition: .1s ease-in-out;
|
|
15
23
|
|
|
16
24
|
&--bottom-left {
|
|
17
|
-
left:
|
|
25
|
+
left: var(--toasts-offset-bothsides);
|
|
18
26
|
}
|
|
19
27
|
|
|
20
28
|
&--bottom-right {
|
|
21
29
|
left: auto;
|
|
22
|
-
right:
|
|
30
|
+
right: var(--toasts-offset-bothsides);
|
|
23
31
|
}
|
|
24
32
|
|
|
25
33
|
&--bottom-center {
|
|
@@ -28,21 +36,21 @@
|
|
|
28
36
|
}
|
|
29
37
|
|
|
30
38
|
&--top-left {
|
|
31
|
-
left:
|
|
39
|
+
left: var(--toasts-offset-bothsides);
|
|
32
40
|
bottom: auto;
|
|
33
|
-
top:
|
|
41
|
+
top: var(--toasts-offset-top);
|
|
34
42
|
}
|
|
35
43
|
|
|
36
44
|
&--top-right {
|
|
37
45
|
left: auto;
|
|
38
|
-
right:
|
|
39
|
-
top:
|
|
46
|
+
right: var(--toasts-offset-bothsides);
|
|
47
|
+
top: var(--toasts-offset-top);
|
|
40
48
|
}
|
|
41
49
|
|
|
42
50
|
&--top-center {
|
|
43
51
|
left: 50%;
|
|
44
52
|
transform: translateX(-50%);
|
|
45
|
-
top:
|
|
53
|
+
top: var(--toasts-offset-top);
|
|
46
54
|
}
|
|
47
55
|
|
|
48
56
|
&--vertical-center {
|
|
@@ -55,7 +63,7 @@
|
|
|
55
63
|
.toasts {
|
|
56
64
|
position: relative;
|
|
57
65
|
width: 100%;
|
|
58
|
-
bottom:
|
|
66
|
+
bottom: var(--toasts-offset-bottom);
|
|
59
67
|
display: flex;
|
|
60
68
|
flex-flow: column-reverse nowrap;
|
|
61
69
|
|
|
@@ -71,9 +79,24 @@
|
|
|
71
79
|
pointer-events: none;
|
|
72
80
|
}
|
|
73
81
|
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
.toast-container {
|
|
85
|
+
margin-bottom: var(--toasts-container-gap);
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
/* cascading divs */
|
|
89
|
+
&.toasts__wrapper--cascading {
|
|
90
|
+
|
|
91
|
+
.toast-container {
|
|
92
|
+
margin-bottom: 0;
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
.toasts {
|
|
96
|
+
&:hover {
|
|
97
|
+
.toast-container {
|
|
98
|
+
transform: perspective(100px) translateZ(0) !important;
|
|
99
|
+
}
|
|
77
100
|
}
|
|
78
101
|
}
|
|
79
102
|
}
|
|
@@ -117,4 +140,3 @@
|
|
|
117
140
|
}
|
|
118
141
|
|
|
119
142
|
}
|
|
120
|
-
|
package/lib/esm/Toast/index.tsx
CHANGED
|
@@ -24,6 +24,8 @@ type ToastProps = {
|
|
|
24
24
|
autoCloseReverse?: boolean;
|
|
25
25
|
/** You can not close pop-win when it is enabled */
|
|
26
26
|
lock?: boolean;
|
|
27
|
+
/** Whether to use cascading styles */
|
|
28
|
+
cascading?: boolean;
|
|
27
29
|
/** Self-defined class name for body*/
|
|
28
30
|
schemeBody?: string;
|
|
29
31
|
/** Self-defined class name for header */
|
|
@@ -34,7 +36,7 @@ type ToastProps = {
|
|
|
34
36
|
closeDisabled?: boolean;
|
|
35
37
|
/** -- */
|
|
36
38
|
id?: string;
|
|
37
|
-
onClose?: (e:
|
|
39
|
+
onClose?: (e: HTMLDivElement, currentIndex: number, data: HTMLDivElement[]) => void;
|
|
38
40
|
};
|
|
39
41
|
|
|
40
42
|
|
|
@@ -45,6 +47,7 @@ const Toast = (props: ToastProps) => {
|
|
|
45
47
|
autoCloseTime,
|
|
46
48
|
autoCloseReverse,
|
|
47
49
|
lock,
|
|
50
|
+
cascading,
|
|
48
51
|
data,
|
|
49
52
|
schemeBody,
|
|
50
53
|
schemeHeader,
|
|
@@ -59,6 +62,7 @@ const Toast = (props: ToastProps) => {
|
|
|
59
62
|
const idRes = id || uniqueID;
|
|
60
63
|
const rootRef = useRef<any>(null);
|
|
61
64
|
let depth: number = data.length + 1;
|
|
65
|
+
const cascadingEnabled = typeof cascading === 'undefined' ? true : cascading;
|
|
62
66
|
|
|
63
67
|
function init() {
|
|
64
68
|
|
|
@@ -72,10 +76,10 @@ const Toast = (props: ToastProps) => {
|
|
|
72
76
|
[].slice.call(rootRef.current.querySelectorAll('[data-close]')).forEach( (node: HTMLElement) => {
|
|
73
77
|
node.addEventListener('pointerdown', (e: any) => {
|
|
74
78
|
const index = node.dataset.index;
|
|
75
|
-
|
|
79
|
+
const currentItem = node.closest('.toast-container');
|
|
80
|
+
handleClose(index as never, currentItem as never);
|
|
76
81
|
});
|
|
77
|
-
});
|
|
78
|
-
|
|
82
|
+
});
|
|
79
83
|
}
|
|
80
84
|
|
|
81
85
|
|
|
@@ -87,11 +91,11 @@ const Toast = (props: ToastProps) => {
|
|
|
87
91
|
if ( $toast !== null ) {
|
|
88
92
|
if ( $toast.dataset.async == 'true' ) {
|
|
89
93
|
|
|
90
|
-
const _list = rootRef.current.querySelectorAll('.toast-container');
|
|
91
|
-
|
|
94
|
+
const _list: HTMLDivElement[] = [].slice.call(rootRef.current.querySelectorAll('.toast-container'));
|
|
95
|
+
_list.forEach((node: any, i: number) => {
|
|
92
96
|
node.classList.remove('hide-end');
|
|
93
97
|
// rearrange
|
|
94
|
-
node.style.transform = `perspective(100px) translateZ(-${2 * i}px) translateY(${35 * i}px)`;
|
|
98
|
+
if (cascadingEnabled) node.style.transform = `perspective(100px) translateZ(-${2 * i}px) translateY(${35 * i}px)`;
|
|
95
99
|
|
|
96
100
|
});
|
|
97
101
|
|
|
@@ -113,48 +117,45 @@ const Toast = (props: ToastProps) => {
|
|
|
113
117
|
|
|
114
118
|
}
|
|
115
119
|
|
|
116
|
-
function handleClose(index: number) {
|
|
120
|
+
function handleClose(index: number, currentItem: HTMLDivElement) {
|
|
117
121
|
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
_list[index].classList.add('hide-start');
|
|
122
|
+
|
|
123
|
+
const _list: HTMLDivElement[] = [].slice.call(rootRef.current.querySelectorAll('.toast-container'));
|
|
124
|
+
currentItem.classList.add('hide-start');
|
|
122
125
|
|
|
123
|
-
|
|
124
|
-
|
|
126
|
+
//Let the removed animation show
|
|
127
|
+
setTimeout(() => {
|
|
125
128
|
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
+
_list.forEach((node: any, i: number) => {
|
|
130
|
+
node.classList.remove('hide-start');
|
|
131
|
+
});
|
|
129
132
|
|
|
130
|
-
|
|
131
|
-
|
|
133
|
+
// remove current
|
|
134
|
+
currentItem.classList.add('hide-end');
|
|
132
135
|
|
|
133
|
-
|
|
134
|
-
|
|
136
|
+
// rearrange
|
|
137
|
+
if (cascadingEnabled) {
|
|
138
|
+
_list.filter((node: any) => !node.classList.contains('hide-end')).forEach((node: any, index: number) => {
|
|
135
139
|
node.style.transform = `perspective(100px) translateZ(-${2 * index}px) translateY(${35 * index}px)`;
|
|
136
140
|
});
|
|
141
|
+
}
|
|
137
142
|
|
|
138
|
-
//
|
|
139
|
-
onClose?.(rootRef.current, items);
|
|
140
143
|
|
|
141
|
-
|
|
142
|
-
|
|
144
|
+
//
|
|
145
|
+
onClose?.(rootRef.current, Number(index), _list.filter((node: HTMLDivElement) => !node.classList.contains('hide-end') ));
|
|
146
|
+
|
|
147
|
+
}, 300);
|
|
143
148
|
}
|
|
144
149
|
|
|
145
150
|
function autoClose(index: number, items: any[], delay: number = 3000) {
|
|
146
151
|
if ( items.length === index ) {
|
|
147
|
-
|
|
148
|
-
//
|
|
149
|
-
onClose?.(rootRef.current, items);
|
|
150
|
-
|
|
151
|
-
//
|
|
152
152
|
clearTimeout(window.setCloseToast);
|
|
153
153
|
return;
|
|
154
154
|
}
|
|
155
|
+
|
|
155
156
|
|
|
156
157
|
window.setCloseToast = setTimeout(() => {
|
|
157
|
-
const _list = rootRef.current.querySelectorAll('.toast-container');
|
|
158
|
+
const _list: HTMLDivElement[] = [].slice.call(rootRef.current.querySelectorAll('.toast-container'));
|
|
158
159
|
|
|
159
160
|
if ( autoCloseReverse ) {
|
|
160
161
|
_list[items.length-index].classList.add('hide-start');
|
|
@@ -166,26 +167,36 @@ const Toast = (props: ToastProps) => {
|
|
|
166
167
|
//Let the removed animation show
|
|
167
168
|
setTimeout(() => {
|
|
168
169
|
|
|
169
|
-
|
|
170
|
+
_list.forEach((node: any) => {
|
|
170
171
|
node.classList.remove('hide-start');
|
|
171
172
|
});
|
|
172
173
|
|
|
173
174
|
// remove current
|
|
174
175
|
if ( autoCloseReverse ) {
|
|
175
176
|
_list[items.length-index].classList.add('hide-end');
|
|
177
|
+
|
|
178
|
+
//
|
|
179
|
+
onClose?.(rootRef.current, Number(items.length-index), _list.filter((node: HTMLDivElement) => !node.classList.contains('hide-end') ));
|
|
180
|
+
|
|
176
181
|
} else {
|
|
177
182
|
_list[index-1].classList.add('hide-end');
|
|
183
|
+
//
|
|
184
|
+
onClose?.(rootRef.current, Number(index-1), _list.filter((node: HTMLDivElement) => !node.classList.contains('hide-end') ));
|
|
178
185
|
}
|
|
179
186
|
|
|
180
187
|
// rearrange
|
|
181
|
-
|
|
182
|
-
node.
|
|
183
|
-
|
|
184
|
-
|
|
188
|
+
if (cascadingEnabled) {
|
|
189
|
+
_list.filter((node: any) => !node.classList.contains('hide-end')).forEach((node: any, i: number) => {
|
|
190
|
+
node.style.transform = `perspective(100px) translateZ(-${2 * i}px) translateY(${35 * i}px)`;
|
|
191
|
+
});
|
|
192
|
+
}
|
|
193
|
+
|
|
194
|
+
|
|
195
|
+
//
|
|
185
196
|
autoClose(index, items, delay);
|
|
186
197
|
|
|
187
198
|
}, 300);
|
|
188
|
-
}, delay
|
|
199
|
+
}, delay);
|
|
189
200
|
|
|
190
201
|
index++;
|
|
191
202
|
}
|
|
@@ -210,6 +221,10 @@ const Toast = (props: ToastProps) => {
|
|
|
210
221
|
const _el = document.querySelector(`#toasts__wrapper-${idRes}`);
|
|
211
222
|
if ( _el !== null ) _el.remove();
|
|
212
223
|
|
|
224
|
+
// remove all events
|
|
225
|
+
[].slice.call(rootRef.current.querySelectorAll('[data-close]')).forEach( (node: HTMLElement) => {
|
|
226
|
+
node.replaceWith(node.cloneNode(true));
|
|
227
|
+
});
|
|
213
228
|
|
|
214
229
|
}
|
|
215
230
|
|
|
@@ -218,7 +233,7 @@ const Toast = (props: ToastProps) => {
|
|
|
218
233
|
return (
|
|
219
234
|
<div>
|
|
220
235
|
|
|
221
|
-
<div id={`toasts__wrapper-${idRes}`} data-async={async ? async : false} className={`toasts__wrapper toasts__wrapper--${direction ? direction : 'bottom-center'}`} ref={rootRef}>
|
|
236
|
+
<div id={`toasts__wrapper-${idRes}`} data-async={async ? async : false} className={`toasts__wrapper toasts__wrapper--${direction ? direction : 'bottom-center'} ${cascadingEnabled ? 'toasts__wrapper--cascading' : ''}`} ref={rootRef}>
|
|
222
237
|
<div className="toasts">
|
|
223
238
|
{data.map((item: any, i: number) => {
|
|
224
239
|
return <Item
|
|
@@ -228,12 +243,12 @@ const Toast = (props: ToastProps) => {
|
|
|
228
243
|
title={item.title}
|
|
229
244
|
note={item.note}
|
|
230
245
|
lock={lock}
|
|
246
|
+
cascading={cascadingEnabled}
|
|
231
247
|
schemeBody={schemeBody}
|
|
232
248
|
schemeHeader={schemeHeader}
|
|
233
249
|
closeBtnColor={closeBtnColor}
|
|
234
250
|
closeDisabled={closeDisabled}
|
|
235
251
|
message={item.message}
|
|
236
|
-
closeEv={handleClose}
|
|
237
252
|
/>
|
|
238
253
|
|
|
239
254
|
})}
|
package/package.json
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
"author": "UIUX Lab",
|
|
3
3
|
"email": "uiuxlab@gmail.com",
|
|
4
4
|
"name": "funda-ui",
|
|
5
|
-
"version": "1.0.
|
|
5
|
+
"version": "1.0.312",
|
|
6
6
|
"description": "React components using pure Bootstrap 5+ which does not contain any external style and script libraries.",
|
|
7
7
|
"repository": {
|
|
8
8
|
"type": "git",
|