@team-frieeren/components 1.0.5 → 1.0.8
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/dist/client.js +15 -3
- package/package.json +1 -1
package/dist/client.js
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
"use client";
|
|
1
2
|
import { jsx, Fragment, jsxs } from 'react/jsx-runtime';
|
|
2
3
|
import * as React from 'react';
|
|
3
4
|
import { Children, isValidElement, useEffect, createContext, useContext, useMemo, useCallback, useState, Fragment as Fragment$1 } from 'react';
|
|
@@ -566,9 +567,20 @@ var ToastContext = /*#__PURE__*/createContext({
|
|
|
566
567
|
var ToastPortal = function ToastPortal(_a) {
|
|
567
568
|
var children = _a.children;
|
|
568
569
|
var isMounted = useIsMounted();
|
|
569
|
-
var
|
|
570
|
-
|
|
571
|
-
|
|
570
|
+
var _b = useState(null),
|
|
571
|
+
portalNode = _b[0],
|
|
572
|
+
setPortalNode = _b[1];
|
|
573
|
+
useEffect(function () {
|
|
574
|
+
var node = document.getElementById("toast-portal");
|
|
575
|
+
if (!node) {
|
|
576
|
+
node = document.createElement("div");
|
|
577
|
+
node.id = "toast-portal";
|
|
578
|
+
document.body.appendChild(node);
|
|
579
|
+
}
|
|
580
|
+
setPortalNode(node);
|
|
581
|
+
}, []);
|
|
582
|
+
if (!isMounted || !portalNode) return null;
|
|
583
|
+
return /*#__PURE__*/createPortal(children, portalNode);
|
|
572
584
|
};
|
|
573
585
|
var ToastProvider = function ToastProvider(_a) {
|
|
574
586
|
var options = _a.options,
|