kitzo 2.0.33 → 2.0.34
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 +3 -3
- package/dist/react.esm.js +4 -24
- 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.34/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.
|
|
@@ -187,7 +187,6 @@ toast.custom("string");
|
|
|
187
187
|
|
|
188
188
|
##### Toast API Usage
|
|
189
189
|
|
|
190
|
-
|
|
191
190
|
```jsx
|
|
192
191
|
import { ToastContainer, toast } from 'kitzo/react';
|
|
193
192
|
|
|
@@ -240,4 +239,5 @@ function App() {
|
|
|
240
239
|
);
|
|
241
240
|
}
|
|
242
241
|
```
|
|
243
|
-
|
|
242
|
+
|
|
243
|
+
> Each toast can have its own position. default position is `top-center`.
|
package/dist/react.esm.js
CHANGED
|
@@ -204,7 +204,6 @@ function subscribe(callback) {
|
|
|
204
204
|
function success(text = 'Toast success', options = {}) {
|
|
205
205
|
const id = Date.now();
|
|
206
206
|
options = Object.assign({
|
|
207
|
-
position: 'top-center',
|
|
208
207
|
duration: 2000,
|
|
209
208
|
id,
|
|
210
209
|
style: {},
|
|
@@ -219,7 +218,6 @@ function success(text = 'Toast success', options = {}) {
|
|
|
219
218
|
function error(text = 'Toast denied', options = {}) {
|
|
220
219
|
const id = Date.now();
|
|
221
220
|
options = Object.assign({
|
|
222
|
-
position: 'top-center',
|
|
223
221
|
duration: 2000,
|
|
224
222
|
id,
|
|
225
223
|
style: {},
|
|
@@ -234,7 +232,6 @@ function error(text = 'Toast denied', options = {}) {
|
|
|
234
232
|
function promise(callback, msgs = {}, options = {}) {
|
|
235
233
|
const id = Date.now();
|
|
236
234
|
options = Object.assign({
|
|
237
|
-
position: 'top-center',
|
|
238
235
|
duration: 2000,
|
|
239
236
|
id,
|
|
240
237
|
style: {},
|
|
@@ -276,7 +273,6 @@ function promise(callback, msgs = {}, options = {}) {
|
|
|
276
273
|
function custom(render, options = {}) {
|
|
277
274
|
const id = Date.now();
|
|
278
275
|
options = Object.assign({
|
|
279
|
-
position: 'top-center',
|
|
280
276
|
duration: 3000,
|
|
281
277
|
id,
|
|
282
278
|
exitDelay: 50
|
|
@@ -428,6 +424,7 @@ function getToastPosition(position) {
|
|
|
428
424
|
|
|
429
425
|
function ToastContainer(props) {
|
|
430
426
|
props = Object.assign({
|
|
427
|
+
position: 'top-center',
|
|
431
428
|
gap: 8
|
|
432
429
|
}, props);
|
|
433
430
|
const {
|
|
@@ -519,25 +516,8 @@ function ToastContainer(props) {
|
|
|
519
516
|
fontFamily: 'inherit',
|
|
520
517
|
boxSizing: 'border-box'
|
|
521
518
|
}
|
|
522
|
-
},
|
|
523
|
-
|
|
524
|
-
position: 'absolute',
|
|
525
|
-
inset: 0,
|
|
526
|
-
display: 'grid',
|
|
527
|
-
padding: '1rem'
|
|
528
|
-
}
|
|
529
|
-
}, /*#__PURE__*/React.createElement("div", {
|
|
530
|
-
style: {
|
|
531
|
-
position: 'relative'
|
|
532
|
-
}
|
|
533
|
-
}, toasts.map(toast => /*#__PURE__*/React.createElement(Toast, {
|
|
534
|
-
key: toast.options.id,
|
|
535
|
-
toast: toast,
|
|
536
|
-
setToasts: setToasts,
|
|
537
|
-
position: position,
|
|
538
|
-
gap: typeof gap === 'string' ? isNaN(+gap) ? 8 : +gap : gap
|
|
539
|
-
})))) : /*#__PURE__*/React.createElement(React.Fragment, null, positions.map(pos => {
|
|
540
|
-
const group = toasts.filter(t => t.options.position === pos);
|
|
519
|
+
}, positions.map(pos => {
|
|
520
|
+
const group = toasts.filter(t => (t.options.position || position || 'top-center') === pos);
|
|
541
521
|
if (!group.length) return null;
|
|
542
522
|
return /*#__PURE__*/React.createElement("div", {
|
|
543
523
|
key: pos,
|
|
@@ -558,7 +538,7 @@ function ToastContainer(props) {
|
|
|
558
538
|
position: pos,
|
|
559
539
|
gap: typeof gap === 'string' ? isNaN(+gap) ? 8 : +gap : gap
|
|
560
540
|
}))));
|
|
561
|
-
}))
|
|
541
|
+
}));
|
|
562
542
|
}
|
|
563
543
|
|
|
564
544
|
const toast = {
|