goey-toast 0.2.2 → 0.3.0
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 +71 -71
- package/dist/index.cjs +105 -105
- package/dist/index.cjs.map +1 -1
- package/dist/index.css +81 -81
- package/dist/index.css.map +1 -1
- package/dist/index.d.cts +30 -30
- package/dist/index.d.ts +30 -30
- package/dist/index.js +104 -104
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -5,7 +5,7 @@ var sonner = require('sonner');
|
|
|
5
5
|
var framerMotion = require('framer-motion');
|
|
6
6
|
var jsxRuntime = require('react/jsx-runtime');
|
|
7
7
|
|
|
8
|
-
// src/components/
|
|
8
|
+
// src/components/GooeyToaster.tsx
|
|
9
9
|
|
|
10
10
|
// src/presets.ts
|
|
11
11
|
var animationPresets = {
|
|
@@ -21,69 +21,69 @@ var _dir = "ltr";
|
|
|
21
21
|
var _spring = true;
|
|
22
22
|
var _bounce = void 0;
|
|
23
23
|
var _theme = "light";
|
|
24
|
-
function
|
|
24
|
+
function setGooeyTheme(theme) {
|
|
25
25
|
_theme = theme;
|
|
26
26
|
}
|
|
27
|
-
function
|
|
27
|
+
function getGooeyTheme() {
|
|
28
28
|
return _theme;
|
|
29
29
|
}
|
|
30
|
-
function
|
|
30
|
+
function setGooeyPosition(position) {
|
|
31
31
|
_position = position;
|
|
32
32
|
}
|
|
33
|
-
function
|
|
33
|
+
function getGooeyPosition() {
|
|
34
34
|
return _position;
|
|
35
35
|
}
|
|
36
|
-
function
|
|
36
|
+
function setGooeyDir(dir) {
|
|
37
37
|
_dir = dir;
|
|
38
38
|
}
|
|
39
|
-
function
|
|
39
|
+
function getGooeyDir() {
|
|
40
40
|
return _dir;
|
|
41
41
|
}
|
|
42
|
-
function
|
|
42
|
+
function setGooeySpring(spring) {
|
|
43
43
|
_spring = spring;
|
|
44
44
|
}
|
|
45
|
-
function
|
|
45
|
+
function getGooeySpring() {
|
|
46
46
|
return _spring;
|
|
47
47
|
}
|
|
48
|
-
function
|
|
48
|
+
function setGooeyBounce(bounce) {
|
|
49
49
|
_bounce = bounce;
|
|
50
50
|
}
|
|
51
|
-
function
|
|
51
|
+
function getGooeyBounce() {
|
|
52
52
|
return _bounce;
|
|
53
53
|
}
|
|
54
54
|
var _visibleToasts = 3;
|
|
55
|
-
function
|
|
55
|
+
function setGooeyVisibleToasts(n) {
|
|
56
56
|
_visibleToasts = n;
|
|
57
57
|
}
|
|
58
|
-
function
|
|
58
|
+
function getGooeyVisibleToasts() {
|
|
59
59
|
return _visibleToasts;
|
|
60
60
|
}
|
|
61
61
|
var _swipeToDismiss = true;
|
|
62
|
-
function
|
|
62
|
+
function setGooeySwipeToDismiss(enabled) {
|
|
63
63
|
_swipeToDismiss = enabled;
|
|
64
64
|
}
|
|
65
|
-
function
|
|
65
|
+
function getGooeySwipeToDismiss() {
|
|
66
66
|
return _swipeToDismiss;
|
|
67
67
|
}
|
|
68
68
|
var _maxQueue = Infinity;
|
|
69
|
-
function
|
|
69
|
+
function setGooeyMaxQueue(n) {
|
|
70
70
|
_maxQueue = n;
|
|
71
71
|
}
|
|
72
|
-
function
|
|
72
|
+
function getGooeyMaxQueue() {
|
|
73
73
|
return _maxQueue;
|
|
74
74
|
}
|
|
75
75
|
var _queueOverflow = "drop-oldest";
|
|
76
|
-
function
|
|
76
|
+
function setGooeyQueueOverflow(strategy) {
|
|
77
77
|
_queueOverflow = strategy;
|
|
78
78
|
}
|
|
79
|
-
function
|
|
79
|
+
function getGooeyQueueOverflow() {
|
|
80
80
|
return _queueOverflow;
|
|
81
81
|
}
|
|
82
82
|
var _showProgress = false;
|
|
83
|
-
function
|
|
83
|
+
function setGooeyShowProgress(show) {
|
|
84
84
|
_showProgress = show;
|
|
85
85
|
}
|
|
86
|
-
function
|
|
86
|
+
function getGooeyShowProgress() {
|
|
87
87
|
return _showProgress;
|
|
88
88
|
}
|
|
89
89
|
var _containerHovered = false;
|
|
@@ -249,40 +249,40 @@ function usePrefersReducedMotion() {
|
|
|
249
249
|
return prefersReducedMotion;
|
|
250
250
|
}
|
|
251
251
|
|
|
252
|
-
// src/components/
|
|
252
|
+
// src/components/gooey-styles.ts
|
|
253
253
|
var styles = {
|
|
254
|
-
spinnerSpin: "
|
|
255
|
-
wrapper: "
|
|
256
|
-
blobSvg: "
|
|
257
|
-
content: "
|
|
258
|
-
contentCompact: "
|
|
259
|
-
contentExpanded: "
|
|
260
|
-
header: "
|
|
261
|
-
iconWrapper: "
|
|
262
|
-
title: "
|
|
263
|
-
titleDefault: "
|
|
264
|
-
titleSuccess: "
|
|
265
|
-
titleError: "
|
|
266
|
-
titleWarning: "
|
|
267
|
-
titleInfo: "
|
|
268
|
-
titleLoading: "
|
|
269
|
-
description: "
|
|
270
|
-
actionWrapper: "
|
|
271
|
-
actionButton: "
|
|
272
|
-
actionDefault: "
|
|
273
|
-
actionSuccess: "
|
|
274
|
-
actionError: "
|
|
275
|
-
actionWarning: "
|
|
276
|
-
actionInfo: "
|
|
277
|
-
progressWrapper: "
|
|
278
|
-
progressBar: "
|
|
279
|
-
progressDefault: "
|
|
280
|
-
progressSuccess: "
|
|
281
|
-
progressError: "
|
|
282
|
-
progressWarning: "
|
|
283
|
-
progressInfo: "
|
|
284
|
-
progressPaused: "
|
|
285
|
-
timestamp: "
|
|
254
|
+
spinnerSpin: "gooey-spinnerSpin",
|
|
255
|
+
wrapper: "gooey-wrapper",
|
|
256
|
+
blobSvg: "gooey-blobSvg",
|
|
257
|
+
content: "gooey-content",
|
|
258
|
+
contentCompact: "gooey-contentCompact",
|
|
259
|
+
contentExpanded: "gooey-contentExpanded",
|
|
260
|
+
header: "gooey-header",
|
|
261
|
+
iconWrapper: "gooey-iconWrapper",
|
|
262
|
+
title: "gooey-title",
|
|
263
|
+
titleDefault: "gooey-titleDefault",
|
|
264
|
+
titleSuccess: "gooey-titleSuccess",
|
|
265
|
+
titleError: "gooey-titleError",
|
|
266
|
+
titleWarning: "gooey-titleWarning",
|
|
267
|
+
titleInfo: "gooey-titleInfo",
|
|
268
|
+
titleLoading: "gooey-titleLoading",
|
|
269
|
+
description: "gooey-description",
|
|
270
|
+
actionWrapper: "gooey-actionWrapper",
|
|
271
|
+
actionButton: "gooey-actionButton",
|
|
272
|
+
actionDefault: "gooey-actionDefault",
|
|
273
|
+
actionSuccess: "gooey-actionSuccess",
|
|
274
|
+
actionError: "gooey-actionError",
|
|
275
|
+
actionWarning: "gooey-actionWarning",
|
|
276
|
+
actionInfo: "gooey-actionInfo",
|
|
277
|
+
progressWrapper: "gooey-progressWrapper",
|
|
278
|
+
progressBar: "gooey-progressBar",
|
|
279
|
+
progressDefault: "gooey-progressDefault",
|
|
280
|
+
progressSuccess: "gooey-progressSuccess",
|
|
281
|
+
progressError: "gooey-progressError",
|
|
282
|
+
progressWarning: "gooey-progressWarning",
|
|
283
|
+
progressInfo: "gooey-progressInfo",
|
|
284
|
+
progressPaused: "gooey-progressPaused",
|
|
285
|
+
timestamp: "gooey-timestamp"
|
|
286
286
|
};
|
|
287
287
|
var useIsomorphicLayoutEffect = typeof window !== "undefined" ? react.useLayoutEffect : react.useEffect;
|
|
288
288
|
var phaseIconMap = {
|
|
@@ -522,7 +522,7 @@ function morphPathCenterRaw(pw, bw, th, t) {
|
|
|
522
522
|
var morphPath = memoizePath(morphPathRaw);
|
|
523
523
|
var morphPathCenter = memoizePath(morphPathCenterRaw);
|
|
524
524
|
var SMOOTH_EASE = [0.4, 0, 0.2, 1];
|
|
525
|
-
var
|
|
525
|
+
var GooeyToast = ({
|
|
526
526
|
title,
|
|
527
527
|
description,
|
|
528
528
|
action,
|
|
@@ -539,18 +539,18 @@ var GoeyToast = ({
|
|
|
539
539
|
showProgress: showProgressProp,
|
|
540
540
|
toastId
|
|
541
541
|
}) => {
|
|
542
|
-
const theme =
|
|
542
|
+
const theme = getGooeyTheme();
|
|
543
543
|
const fillColor = fillColorProp ?? (theme === "dark" ? "#1a1a1a" : "#ffffff");
|
|
544
|
-
const position =
|
|
545
|
-
const dir =
|
|
544
|
+
const position = getGooeyPosition();
|
|
545
|
+
const dir = getGooeyDir();
|
|
546
546
|
const posIsRight = position?.includes("right") ?? false;
|
|
547
547
|
const isCenter = position?.includes("center") ?? false;
|
|
548
548
|
const isRight = dir === "rtl" ? isCenter ? false : !posIsRight : posIsRight;
|
|
549
549
|
const prefersReducedMotion = usePrefersReducedMotion();
|
|
550
550
|
const presetConfig = preset ? animationPresets[preset] : void 0;
|
|
551
|
-
const useSpring = springProp ?? presetConfig?.spring ??
|
|
552
|
-
const bounceVal = bounceProp ?? presetConfig?.bounce ??
|
|
553
|
-
const showProgress = showProgressProp ??
|
|
551
|
+
const useSpring = springProp ?? presetConfig?.spring ?? getGooeySpring();
|
|
552
|
+
const bounceVal = bounceProp ?? presetConfig?.bounce ?? getGooeyBounce() ?? 0.4;
|
|
553
|
+
const showProgress = showProgressProp ?? getGooeyShowProgress();
|
|
554
554
|
const [actionSuccess, setActionSuccess] = react.useState(null);
|
|
555
555
|
const [dismissing, setDismissing] = react.useState(false);
|
|
556
556
|
const [progressKey, setProgressKey] = react.useState(0);
|
|
@@ -596,8 +596,8 @@ var GoeyToast = ({
|
|
|
596
596
|
const { pw: p, bw: b, th: h } = aDims.current;
|
|
597
597
|
if (p <= 0 || b <= 0 || h <= 0) return;
|
|
598
598
|
const t = Math.max(0, Math.min(1, morphTRef.current));
|
|
599
|
-
const pos =
|
|
600
|
-
const d =
|
|
599
|
+
const pos = getGooeyPosition();
|
|
600
|
+
const d = getGooeyDir();
|
|
601
601
|
const centerPos = pos?.includes("center") ?? false;
|
|
602
602
|
const posRight = pos?.includes("right") ?? false;
|
|
603
603
|
const rightSide = d === "rtl" ? centerPos ? false : !posRight : posRight;
|
|
@@ -1094,13 +1094,13 @@ var GoeyToast = ({
|
|
|
1094
1094
|
const [swipeOffsetX, setSwipeOffsetX] = react.useState(0);
|
|
1095
1095
|
const isSwipingRef = react.useRef(false);
|
|
1096
1096
|
const handleTouchStart = react.useCallback((e) => {
|
|
1097
|
-
if (!
|
|
1097
|
+
if (!getGooeySwipeToDismiss()) return;
|
|
1098
1098
|
const touch = e.touches[0];
|
|
1099
1099
|
swipeStartRef.current = { x: touch.clientX, y: touch.clientY };
|
|
1100
1100
|
isSwipingRef.current = false;
|
|
1101
1101
|
}, []);
|
|
1102
1102
|
const handleTouchMove = react.useCallback((e) => {
|
|
1103
|
-
if (!swipeStartRef.current || !
|
|
1103
|
+
if (!swipeStartRef.current || !getGooeySwipeToDismiss()) return;
|
|
1104
1104
|
const touch = e.touches[0];
|
|
1105
1105
|
const dx = touch.clientX - swipeStartRef.current.x;
|
|
1106
1106
|
const dy = touch.clientY - swipeStartRef.current.y;
|
|
@@ -1116,7 +1116,7 @@ var GoeyToast = ({
|
|
|
1116
1116
|
}
|
|
1117
1117
|
}, []);
|
|
1118
1118
|
const handleTouchEnd = react.useCallback(() => {
|
|
1119
|
-
if (!
|
|
1119
|
+
if (!getGooeySwipeToDismiss()) {
|
|
1120
1120
|
swipeStartRef.current = null;
|
|
1121
1121
|
return;
|
|
1122
1122
|
}
|
|
@@ -1274,7 +1274,7 @@ var GoeyToast = ({
|
|
|
1274
1274
|
"div",
|
|
1275
1275
|
{
|
|
1276
1276
|
className: `${styles.progressBar} ${progressColorMap[effectivePhase]}`,
|
|
1277
|
-
style: { "--
|
|
1277
|
+
style: { "--gooey-progress-duration": `${progressDelayRef.current || (timing?.displayDuration ?? DEFAULT_DISPLAY_DURATION)}ms` }
|
|
1278
1278
|
}
|
|
1279
1279
|
)
|
|
1280
1280
|
},
|
|
@@ -1295,7 +1295,7 @@ var ToastErrorBoundary = class extends react.Component {
|
|
|
1295
1295
|
}
|
|
1296
1296
|
componentDidCatch(error, errorInfo) {
|
|
1297
1297
|
if (process.env.NODE_ENV !== "production") {
|
|
1298
|
-
console.error("[
|
|
1298
|
+
console.error("[GooeyToast] Rendering error:", error, errorInfo);
|
|
1299
1299
|
}
|
|
1300
1300
|
}
|
|
1301
1301
|
render() {
|
|
@@ -1324,7 +1324,7 @@ function _getMostRecentActiveId() {
|
|
|
1324
1324
|
return last;
|
|
1325
1325
|
}
|
|
1326
1326
|
function _processQueue() {
|
|
1327
|
-
const max =
|
|
1327
|
+
const max = getGooeyVisibleToasts();
|
|
1328
1328
|
while (_queue.length > 0 && _activeIds.size < max) {
|
|
1329
1329
|
const next = _queue.shift();
|
|
1330
1330
|
_activeIds.set(next.id, next.type);
|
|
@@ -1332,8 +1332,8 @@ function _processQueue() {
|
|
|
1332
1332
|
}
|
|
1333
1333
|
}
|
|
1334
1334
|
function _enqueue(entry) {
|
|
1335
|
-
const maxQueue =
|
|
1336
|
-
const overflow =
|
|
1335
|
+
const maxQueue = getGooeyMaxQueue();
|
|
1336
|
+
const overflow = getGooeyQueueOverflow();
|
|
1337
1337
|
if (_queue.length >= maxQueue) {
|
|
1338
1338
|
if (overflow === "drop-newest") return false;
|
|
1339
1339
|
_queue.shift();
|
|
@@ -1366,7 +1366,7 @@ function _onToastDismissed(id) {
|
|
|
1366
1366
|
_processQueue();
|
|
1367
1367
|
}
|
|
1368
1368
|
var _toastUpdateListeners = /* @__PURE__ */ new Map();
|
|
1369
|
-
function
|
|
1369
|
+
function updateGooeyToast(id, options) {
|
|
1370
1370
|
const listener = _toastUpdateListeners.get(id);
|
|
1371
1371
|
if (listener) {
|
|
1372
1372
|
listener(options);
|
|
@@ -1381,7 +1381,7 @@ function updateGoeyToast(id, options) {
|
|
|
1381
1381
|
}
|
|
1382
1382
|
}
|
|
1383
1383
|
}
|
|
1384
|
-
function
|
|
1384
|
+
function GooeyToastWrapper({
|
|
1385
1385
|
initialPhase,
|
|
1386
1386
|
title: initialTitle,
|
|
1387
1387
|
type: initialType,
|
|
@@ -1440,7 +1440,7 @@ function GoeyToastWrapper({
|
|
|
1440
1440
|
};
|
|
1441
1441
|
}, [activeId]);
|
|
1442
1442
|
return /* @__PURE__ */ jsxRuntime.jsx(ToastErrorBoundary, { children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
1443
|
-
|
|
1443
|
+
GooeyToast,
|
|
1444
1444
|
{
|
|
1445
1445
|
title,
|
|
1446
1446
|
description,
|
|
@@ -1515,7 +1515,7 @@ function PromiseToastWrapper({
|
|
|
1515
1515
|
});
|
|
1516
1516
|
}, []);
|
|
1517
1517
|
return /* @__PURE__ */ jsxRuntime.jsx(ToastErrorBoundary, { children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
1518
|
-
|
|
1518
|
+
GooeyToast,
|
|
1519
1519
|
{
|
|
1520
1520
|
title,
|
|
1521
1521
|
description,
|
|
@@ -1533,7 +1533,7 @@ function PromiseToastWrapper({
|
|
|
1533
1533
|
}
|
|
1534
1534
|
) });
|
|
1535
1535
|
}
|
|
1536
|
-
function
|
|
1536
|
+
function createGooeyToast(title, type, options) {
|
|
1537
1537
|
const hasExpandedContent = Boolean(options?.description || options?.action);
|
|
1538
1538
|
const baseDuration = options?.timing?.displayDuration ?? options?.duration ?? (options?.description ? DEFAULT_EXPANDED_DURATION : void 0);
|
|
1539
1539
|
const duration = hasExpandedContent ? Infinity : baseDuration;
|
|
@@ -1541,7 +1541,7 @@ function createGoeyToast(title, type, options) {
|
|
|
1541
1541
|
const create = () => {
|
|
1542
1542
|
sonner.toast.custom(
|
|
1543
1543
|
() => /* @__PURE__ */ jsxRuntime.jsx(
|
|
1544
|
-
|
|
1544
|
+
GooeyToastWrapper,
|
|
1545
1545
|
{
|
|
1546
1546
|
initialPhase: type,
|
|
1547
1547
|
title,
|
|
@@ -1577,7 +1577,7 @@ function createGoeyToast(title, type, options) {
|
|
|
1577
1577
|
buildAnnouncementMessage(title, options?.description),
|
|
1578
1578
|
getAnnouncePoliteness(type)
|
|
1579
1579
|
);
|
|
1580
|
-
if (_activeIds.size <
|
|
1580
|
+
if (_activeIds.size < getGooeyVisibleToasts()) {
|
|
1581
1581
|
_activeIds.set(toastId, type);
|
|
1582
1582
|
create();
|
|
1583
1583
|
} else {
|
|
@@ -1585,7 +1585,7 @@ function createGoeyToast(title, type, options) {
|
|
|
1585
1585
|
}
|
|
1586
1586
|
return toastId;
|
|
1587
1587
|
}
|
|
1588
|
-
function
|
|
1588
|
+
function dismissGooeyToast(idOrFilter) {
|
|
1589
1589
|
if (idOrFilter != null && typeof idOrFilter === "object") {
|
|
1590
1590
|
const filterTypes = Array.isArray(idOrFilter.type) ? idOrFilter.type : [idOrFilter.type];
|
|
1591
1591
|
const typesSet = new Set(filterTypes);
|
|
@@ -1617,13 +1617,13 @@ function dismissGoeyToast(idOrFilter) {
|
|
|
1617
1617
|
sonner.toast.dismiss();
|
|
1618
1618
|
}
|
|
1619
1619
|
}
|
|
1620
|
-
var
|
|
1621
|
-
(title, options) =>
|
|
1620
|
+
var gooeyToast = Object.assign(
|
|
1621
|
+
(title, options) => createGooeyToast(title, "default", options),
|
|
1622
1622
|
{
|
|
1623
|
-
success: (title, options) =>
|
|
1624
|
-
error: (title, options) =>
|
|
1625
|
-
warning: (title, options) =>
|
|
1626
|
-
info: (title, options) =>
|
|
1623
|
+
success: (title, options) => createGooeyToast(title, "success", options),
|
|
1624
|
+
error: (title, options) => createGooeyToast(title, "error", options),
|
|
1625
|
+
warning: (title, options) => createGooeyToast(title, "warning", options),
|
|
1626
|
+
info: (title, options) => createGooeyToast(title, "info", options),
|
|
1627
1627
|
promise: (promise, data) => {
|
|
1628
1628
|
const id = Math.random().toString(36).slice(2);
|
|
1629
1629
|
announce(buildAnnouncementMessage(data.loading, data.description?.loading), "polite");
|
|
@@ -1636,7 +1636,7 @@ var goeyToast = Object.assign(
|
|
|
1636
1636
|
duration: data.timing?.displayDuration != null || data.description ? Infinity : void 0
|
|
1637
1637
|
});
|
|
1638
1638
|
};
|
|
1639
|
-
if (_activeIds.size <
|
|
1639
|
+
if (_activeIds.size < getGooeyVisibleToasts()) {
|
|
1640
1640
|
_activeIds.set(id, "info");
|
|
1641
1641
|
create();
|
|
1642
1642
|
} else {
|
|
@@ -1644,8 +1644,8 @@ var goeyToast = Object.assign(
|
|
|
1644
1644
|
}
|
|
1645
1645
|
return id;
|
|
1646
1646
|
},
|
|
1647
|
-
dismiss:
|
|
1648
|
-
update:
|
|
1647
|
+
dismiss: dismissGooeyToast,
|
|
1648
|
+
update: updateGooeyToast
|
|
1649
1649
|
}
|
|
1650
1650
|
);
|
|
1651
1651
|
function AriaLiveAnnouncer() {
|
|
@@ -1707,7 +1707,7 @@ function AriaLiveAnnouncer() {
|
|
|
1707
1707
|
)
|
|
1708
1708
|
] });
|
|
1709
1709
|
}
|
|
1710
|
-
function
|
|
1710
|
+
function GooeyToaster({
|
|
1711
1711
|
position = "bottom-right",
|
|
1712
1712
|
duration,
|
|
1713
1713
|
gap = 14,
|
|
@@ -1732,22 +1732,22 @@ function GoeyToaster({
|
|
|
1732
1732
|
const resolvedSpring = spring ?? presetConfig?.spring ?? true;
|
|
1733
1733
|
const resolvedBounce = bounce ?? presetConfig?.bounce;
|
|
1734
1734
|
react.useEffect(() => {
|
|
1735
|
-
|
|
1735
|
+
setGooeyPosition(position);
|
|
1736
1736
|
}, [position]);
|
|
1737
1737
|
react.useEffect(() => {
|
|
1738
|
-
|
|
1738
|
+
setGooeyDir(dir ?? "ltr");
|
|
1739
1739
|
}, [dir]);
|
|
1740
1740
|
react.useEffect(() => {
|
|
1741
|
-
|
|
1741
|
+
setGooeyTheme(theme);
|
|
1742
1742
|
}, [theme]);
|
|
1743
1743
|
react.useEffect(() => {
|
|
1744
|
-
|
|
1744
|
+
setGooeySpring(resolvedSpring);
|
|
1745
1745
|
}, [resolvedSpring]);
|
|
1746
1746
|
react.useEffect(() => {
|
|
1747
|
-
|
|
1747
|
+
setGooeyBounce(resolvedBounce);
|
|
1748
1748
|
}, [resolvedBounce]);
|
|
1749
1749
|
react.useEffect(() => {
|
|
1750
|
-
|
|
1750
|
+
setGooeySwipeToDismiss(swipeToDismiss);
|
|
1751
1751
|
}, [swipeToDismiss]);
|
|
1752
1752
|
react.useEffect(() => {
|
|
1753
1753
|
}, [closeOnEscape]);
|
|
@@ -1757,7 +1757,7 @@ function GoeyToaster({
|
|
|
1757
1757
|
if (e.key === "Escape") {
|
|
1758
1758
|
const recentId = _getMostRecentActiveId();
|
|
1759
1759
|
if (recentId != null) {
|
|
1760
|
-
|
|
1760
|
+
gooeyToast.dismiss(recentId);
|
|
1761
1761
|
}
|
|
1762
1762
|
}
|
|
1763
1763
|
};
|
|
@@ -1765,16 +1765,16 @@ function GoeyToaster({
|
|
|
1765
1765
|
return () => document.removeEventListener("keydown", handleKeyDown);
|
|
1766
1766
|
}, [closeOnEscape]);
|
|
1767
1767
|
react.useEffect(() => {
|
|
1768
|
-
|
|
1768
|
+
setGooeyVisibleToasts(visibleToasts ?? 3);
|
|
1769
1769
|
}, [visibleToasts]);
|
|
1770
1770
|
react.useEffect(() => {
|
|
1771
|
-
|
|
1771
|
+
setGooeyMaxQueue(maxQueue);
|
|
1772
1772
|
}, [maxQueue]);
|
|
1773
1773
|
react.useEffect(() => {
|
|
1774
|
-
|
|
1774
|
+
setGooeyQueueOverflow(queueOverflow);
|
|
1775
1775
|
}, [queueOverflow]);
|
|
1776
1776
|
react.useEffect(() => {
|
|
1777
|
-
|
|
1777
|
+
setGooeyShowProgress(showProgress);
|
|
1778
1778
|
}, [showProgress]);
|
|
1779
1779
|
react.useEffect(() => {
|
|
1780
1780
|
let expandObs = null;
|
|
@@ -1819,18 +1819,18 @@ function GoeyToaster({
|
|
|
1819
1819
|
react.useEffect(() => {
|
|
1820
1820
|
if (process.env.NODE_ENV !== "development") return;
|
|
1821
1821
|
const el = document.createElement("div");
|
|
1822
|
-
el.setAttribute("data-
|
|
1822
|
+
el.setAttribute("data-gooey-toast-css", "");
|
|
1823
1823
|
el.style.position = "absolute";
|
|
1824
1824
|
el.style.width = "0";
|
|
1825
1825
|
el.style.height = "0";
|
|
1826
1826
|
el.style.overflow = "hidden";
|
|
1827
1827
|
el.style.pointerEvents = "none";
|
|
1828
1828
|
document.body.appendChild(el);
|
|
1829
|
-
const value = getComputedStyle(el).getPropertyValue("--
|
|
1829
|
+
const value = getComputedStyle(el).getPropertyValue("--gooey-toast");
|
|
1830
1830
|
document.body.removeChild(el);
|
|
1831
1831
|
if (!value) {
|
|
1832
1832
|
console.warn(
|
|
1833
|
-
'[
|
|
1833
|
+
'[gooey-toast] Styles not found. Make sure to import the CSS:\n\n import "goey-toast/styles.css";\n'
|
|
1834
1834
|
);
|
|
1835
1835
|
}
|
|
1836
1836
|
}, []);
|
|
@@ -1855,8 +1855,8 @@ function GoeyToaster({
|
|
|
1855
1855
|
] });
|
|
1856
1856
|
}
|
|
1857
1857
|
|
|
1858
|
-
exports.
|
|
1858
|
+
exports.GooeyToaster = GooeyToaster;
|
|
1859
1859
|
exports.animationPresets = animationPresets;
|
|
1860
|
-
exports.
|
|
1860
|
+
exports.gooeyToast = gooeyToast;
|
|
1861
1861
|
//# sourceMappingURL=index.cjs.map
|
|
1862
1862
|
//# sourceMappingURL=index.cjs.map
|