kitzo 2.0.29 → 2.0.30
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/README.md +1 -1
- package/dist/react.esm.js +17 -2
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -25,7 +25,7 @@ npm i kitzo
|
|
|
25
25
|
or
|
|
26
26
|
|
|
27
27
|
```javascript
|
|
28
|
-
<script src="https://cdn.jsdelivr.net/npm/kitzo@2.0.
|
|
28
|
+
<script src="https://cdn.jsdelivr.net/npm/kitzo@2.0.30/dist/kitzo.umd.min.js"></script>
|
|
29
29
|
```
|
|
30
30
|
|
|
31
31
|
> Attach this script tag in the html head tag and you are good to go.
|
package/dist/react.esm.js
CHANGED
|
@@ -8,6 +8,9 @@ function toastStyles() {
|
|
|
8
8
|
.toast-content,
|
|
9
9
|
.toast-content-bottom {
|
|
10
10
|
pointer-events: all;
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
.pre-styled {
|
|
11
14
|
padding-inline: 0.825rem;
|
|
12
15
|
padding-block: 0.625rem;
|
|
13
16
|
display: flex;
|
|
@@ -370,6 +373,16 @@ function Toast({
|
|
|
370
373
|
} : t));
|
|
371
374
|
}, []);
|
|
372
375
|
const transformY = position.includes('bottom') ? `translateY(-${offset || 0}px)` : `translateY(${offset || 0}px)`;
|
|
376
|
+
function renderCustomContent() {
|
|
377
|
+
const render = toast.render;
|
|
378
|
+
if (typeof render === 'function') {
|
|
379
|
+
return render(() => dismiss(toast.id, toast.options.exitDelay));
|
|
380
|
+
}
|
|
381
|
+
if (typeof render === 'string') {
|
|
382
|
+
return /*#__PURE__*/React.createElement("span", null, render);
|
|
383
|
+
}
|
|
384
|
+
return render;
|
|
385
|
+
}
|
|
373
386
|
return /*#__PURE__*/React.createElement("div", {
|
|
374
387
|
ref: ref,
|
|
375
388
|
style: {
|
|
@@ -378,11 +391,13 @@ function Toast({
|
|
|
378
391
|
...getToastPosition(position)
|
|
379
392
|
}
|
|
380
393
|
}, /*#__PURE__*/React.createElement("div", {
|
|
394
|
+
className: `toast-content${position.includes('bottom') ? '-bottom' : ''} ${leaving ? 'exit' : ''}`
|
|
395
|
+
}, type === 'custom' ? renderCustomContent() : /*#__PURE__*/React.createElement("div", {
|
|
381
396
|
style: {
|
|
382
397
|
...style
|
|
383
398
|
},
|
|
384
|
-
className:
|
|
385
|
-
},
|
|
399
|
+
className: "pre-styled"
|
|
400
|
+
}, showIcon && /*#__PURE__*/React.createElement(React.Fragment, null, type === 'loading' && /*#__PURE__*/React.createElement(LoadingSvg, null), type === 'success' && /*#__PURE__*/React.createElement(SuccessSvg, null), type === 'error' && /*#__PURE__*/React.createElement(ErrorSvg, null)), /*#__PURE__*/React.createElement("span", null, text))));
|
|
386
401
|
}
|
|
387
402
|
function getToastPosition(position) {
|
|
388
403
|
const isLeft = position.includes('left');
|