@xylabs/react-portal 3.0.4 → 3.0.5
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/browser/components/Portal/Portal.cjs +3 -1
- package/dist/browser/components/Portal/Portal.cjs.map +1 -1
- package/dist/browser/components/Portal/Portal.d.cts +3 -0
- package/dist/browser/components/Portal/Portal.d.cts.map +1 -0
- package/dist/browser/components/Portal/PortalProps.cjs +2 -0
- package/dist/browser/components/Portal/PortalProps.cjs.map +1 -1
- package/dist/browser/components/Portal/PortalProps.d.cts +7 -0
- package/dist/browser/components/Portal/PortalProps.d.cts.map +1 -0
- package/dist/browser/components/Portal/index.cjs +30 -3
- package/dist/browser/components/Portal/index.cjs.map +1 -1
- package/dist/browser/components/Portal/index.d.cts +3 -0
- package/dist/browser/components/Portal/index.d.cts.map +1 -0
- package/dist/browser/components/index.cjs +30 -2
- package/dist/browser/components/index.cjs.map +1 -1
- package/dist/browser/components/index.d.cts +2 -0
- package/dist/browser/components/index.d.cts.map +1 -0
- package/dist/browser/index.cjs +30 -2
- package/dist/browser/index.cjs.map +1 -1
- package/dist/browser/index.d.cts +2 -0
- package/dist/browser/index.d.cts.map +1 -0
- package/dist/node/components/Portal/Portal.cjs +49 -0
- package/dist/node/components/Portal/{index.mjs.map → Portal.cjs.map} +1 -1
- package/dist/node/components/Portal/Portal.d.cts +3 -0
- package/dist/node/components/Portal/Portal.d.cts.map +1 -0
- package/dist/node/components/Portal/Portal.js +7 -32
- package/dist/node/components/Portal/Portal.js.map +1 -1
- package/dist/node/components/Portal/PortalProps.cjs +19 -0
- package/dist/node/components/Portal/PortalProps.cjs.map +1 -0
- package/dist/node/components/Portal/PortalProps.d.cts +7 -0
- package/dist/node/components/Portal/PortalProps.d.cts.map +1 -0
- package/dist/node/components/Portal/PortalProps.js +0 -18
- package/dist/node/components/Portal/PortalProps.js.map +1 -1
- package/dist/node/components/Portal/index.cjs +51 -0
- package/dist/node/components/Portal/index.cjs.map +1 -0
- package/dist/node/components/Portal/index.d.cts +3 -0
- package/dist/node/components/Portal/index.d.cts.map +1 -0
- package/dist/node/components/Portal/index.js +7 -34
- package/dist/node/components/Portal/index.js.map +1 -1
- package/dist/node/components/index.cjs +51 -0
- package/dist/node/components/{index.mjs.map → index.cjs.map} +1 -1
- package/dist/node/components/index.d.cts +2 -0
- package/dist/node/components/index.d.cts.map +1 -0
- package/dist/node/components/index.js +7 -34
- package/dist/node/components/index.js.map +1 -1
- package/dist/node/index.cjs +51 -0
- package/dist/node/index.cjs.map +1 -0
- package/dist/node/index.d.cts +2 -0
- package/dist/node/index.d.cts.map +1 -0
- package/dist/node/index.js +7 -34
- package/dist/node/index.js.map +1 -1
- package/dist/node/types/images.d.cjs +2 -0
- package/dist/node/types/images.d.js +0 -1
- package/package.json +10 -9
- package/dist/node/components/Portal/Portal.mjs +0 -24
- package/dist/node/components/Portal/Portal.mjs.map +0 -1
- package/dist/node/components/Portal/PortalProps.mjs +0 -1
- package/dist/node/components/Portal/index.mjs +0 -24
- package/dist/node/components/index.mjs +0 -24
- package/dist/node/index.mjs +0 -24
- package/dist/node/index.mjs.map +0 -1
- package/dist/node/types/images.d.mjs +0 -1
- package/dist/node/types/images.d.mjs.map +0 -1
- /package/dist/node/{components/Portal/PortalProps.mjs.map → types/images.d.cjs.map} +0 -0
|
@@ -16,6 +16,8 @@ var __copyProps = (to, from, except, desc) => {
|
|
|
16
16
|
return to;
|
|
17
17
|
};
|
|
18
18
|
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
+
|
|
20
|
+
// src/components/Portal/Portal.tsx
|
|
19
21
|
var Portal_exports = {};
|
|
20
22
|
__export(Portal_exports, {
|
|
21
23
|
Portal: () => Portal
|
|
@@ -23,7 +25,7 @@ __export(Portal_exports, {
|
|
|
23
25
|
module.exports = __toCommonJS(Portal_exports);
|
|
24
26
|
var import_react = require("react");
|
|
25
27
|
var import_react_dom = require("react-dom");
|
|
26
|
-
|
|
28
|
+
var Portal = ({ children, className, el = "div", target = "body" }) => {
|
|
27
29
|
const [container] = (0, import_react.useState)(document.createElement(el));
|
|
28
30
|
if (className) {
|
|
29
31
|
container.classList.add(className);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../src/components/Portal/Portal.tsx"],"sourcesContent":["import { useEffect, useState } from 'react'\nimport { createPortal } from 'react-dom'\n\nimport { PortalProps } from './PortalProps'\n\nexport const Portal: React.FC<PortalProps> = ({ children, className, el = 'div', target = 'body' }: PortalProps) => {\n const [container] = useState(document.createElement(el))\n if (className) {\n container.classList.add(className)\n }\n useEffect(() => {\n const targetElement = document.querySelector(target)\n if (!targetElement) {\n console.warn(`Unable to find target element: ${target}`)\n }\n targetElement?.appendChild(container)\n return () => {\n targetElement?.removeChild(container)\n }\n }, [container, target])\n\n return createPortal(children, container)\n}\n"],"mappings":"
|
|
1
|
+
{"version":3,"sources":["../../../../src/components/Portal/Portal.tsx"],"sourcesContent":["import { useEffect, useState } from 'react'\nimport { createPortal } from 'react-dom'\n\nimport { PortalProps } from './PortalProps'\n\nexport const Portal: React.FC<PortalProps> = ({ children, className, el = 'div', target = 'body' }: PortalProps) => {\n const [container] = useState(document.createElement(el))\n if (className) {\n container.classList.add(className)\n }\n useEffect(() => {\n const targetElement = document.querySelector(target)\n if (!targetElement) {\n console.warn(`Unable to find target element: ${target}`)\n }\n targetElement?.appendChild(container)\n return () => {\n targetElement?.removeChild(container)\n }\n }, [container, target])\n\n return createPortal(children, container)\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,mBAAoC;AACpC,uBAA6B;AAItB,IAAM,SAAgC,CAAC,EAAE,UAAU,WAAW,KAAK,OAAO,SAAS,OAAO,MAAmB;AAClH,QAAM,CAAC,SAAS,QAAI,uBAAS,SAAS,cAAc,EAAE,CAAC;AACvD,MAAI,WAAW;AACb,cAAU,UAAU,IAAI,SAAS;AAAA,EACnC;AACA,8BAAU,MAAM;AACd,UAAM,gBAAgB,SAAS,cAAc,MAAM;AACnD,QAAI,CAAC,eAAe;AAClB,cAAQ,KAAK,kCAAkC,MAAM,EAAE;AAAA,IACzD;AACA,mBAAe,YAAY,SAAS;AACpC,WAAO,MAAM;AACX,qBAAe,YAAY,SAAS;AAAA,IACtC;AAAA,EACF,GAAG,CAAC,WAAW,MAAM,CAAC;AAEtB,aAAO,+BAAa,UAAU,SAAS;AACzC;","names":[]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Portal.d.ts","sourceRoot":"","sources":["../../../../src/components/Portal/Portal.tsx"],"names":[],"mappings":"AAGA,OAAO,EAAE,WAAW,EAAE,MAAM,eAAe,CAAA;AAE3C,eAAO,MAAM,MAAM,EAAE,KAAK,CAAC,EAAE,CAAC,WAAW,CAiBxC,CAAA"}
|
|
@@ -12,6 +12,8 @@ var __copyProps = (to, from, except, desc) => {
|
|
|
12
12
|
return to;
|
|
13
13
|
};
|
|
14
14
|
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
15
|
+
|
|
16
|
+
// src/components/Portal/PortalProps.ts
|
|
15
17
|
var PortalProps_exports = {};
|
|
16
18
|
module.exports = __toCommonJS(PortalProps_exports);
|
|
17
19
|
//# sourceMappingURL=PortalProps.cjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../src/components/Portal/PortalProps.ts"],"sourcesContent":["export interface PortalProps {\n children: React.ReactNode\n className?: string\n el?: string\n target?: string\n}\n"],"mappings":"
|
|
1
|
+
{"version":3,"sources":["../../../../src/components/Portal/PortalProps.ts"],"sourcesContent":["export interface PortalProps {\n children: React.ReactNode\n className?: string\n el?: string\n target?: string\n}\n"],"mappings":";;;;;;;;;;;;;;;;AAAA;AAAA;","names":[]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"PortalProps.d.ts","sourceRoot":"","sources":["../../../../src/components/Portal/PortalProps.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,WAAW;IAC1B,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAA;IACzB,SAAS,CAAC,EAAE,MAAM,CAAA;IAClB,EAAE,CAAC,EAAE,MAAM,CAAA;IACX,MAAM,CAAC,EAAE,MAAM,CAAA;CAChB"}
|
|
@@ -3,6 +3,10 @@ var __defProp = Object.defineProperty;
|
|
|
3
3
|
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
4
|
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
5
|
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
+
var __export = (target, all) => {
|
|
7
|
+
for (var name in all)
|
|
8
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
|
+
};
|
|
6
10
|
var __copyProps = (to, from, except, desc) => {
|
|
7
11
|
if (from && typeof from === "object" || typeof from === "function") {
|
|
8
12
|
for (let key of __getOwnPropNames(from))
|
|
@@ -11,10 +15,33 @@ var __copyProps = (to, from, except, desc) => {
|
|
|
11
15
|
}
|
|
12
16
|
return to;
|
|
13
17
|
};
|
|
14
|
-
var __reExport = (target, mod, secondTarget) => (__copyProps(target, mod, "default"), secondTarget && __copyProps(secondTarget, mod, "default"));
|
|
15
18
|
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
+
|
|
20
|
+
// src/components/Portal/index.ts
|
|
16
21
|
var Portal_exports = {};
|
|
22
|
+
__export(Portal_exports, {
|
|
23
|
+
Portal: () => Portal
|
|
24
|
+
});
|
|
17
25
|
module.exports = __toCommonJS(Portal_exports);
|
|
18
|
-
|
|
19
|
-
|
|
26
|
+
|
|
27
|
+
// src/components/Portal/Portal.tsx
|
|
28
|
+
var import_react = require("react");
|
|
29
|
+
var import_react_dom = require("react-dom");
|
|
30
|
+
var Portal = ({ children, className, el = "div", target = "body" }) => {
|
|
31
|
+
const [container] = (0, import_react.useState)(document.createElement(el));
|
|
32
|
+
if (className) {
|
|
33
|
+
container.classList.add(className);
|
|
34
|
+
}
|
|
35
|
+
(0, import_react.useEffect)(() => {
|
|
36
|
+
const targetElement = document.querySelector(target);
|
|
37
|
+
if (!targetElement) {
|
|
38
|
+
console.warn(`Unable to find target element: ${target}`);
|
|
39
|
+
}
|
|
40
|
+
targetElement?.appendChild(container);
|
|
41
|
+
return () => {
|
|
42
|
+
targetElement?.removeChild(container);
|
|
43
|
+
};
|
|
44
|
+
}, [container, target]);
|
|
45
|
+
return (0, import_react_dom.createPortal)(children, container);
|
|
46
|
+
};
|
|
20
47
|
//# sourceMappingURL=index.cjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../src/components/Portal/index.ts"],"sourcesContent":["export * from './Portal'\nexport * from './PortalProps'\n"],"mappings":"
|
|
1
|
+
{"version":3,"sources":["../../../../src/components/Portal/index.ts","../../../../src/components/Portal/Portal.tsx"],"sourcesContent":["export * from './Portal'\nexport * from './PortalProps'\n","import { useEffect, useState } from 'react'\nimport { createPortal } from 'react-dom'\n\nimport { PortalProps } from './PortalProps'\n\nexport const Portal: React.FC<PortalProps> = ({ children, className, el = 'div', target = 'body' }: PortalProps) => {\n const [container] = useState(document.createElement(el))\n if (className) {\n container.classList.add(className)\n }\n useEffect(() => {\n const targetElement = document.querySelector(target)\n if (!targetElement) {\n console.warn(`Unable to find target element: ${target}`)\n }\n targetElement?.appendChild(container)\n return () => {\n targetElement?.removeChild(container)\n }\n }, [container, target])\n\n return createPortal(children, container)\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;;;ACAA,mBAAoC;AACpC,uBAA6B;AAItB,IAAM,SAAgC,CAAC,EAAE,UAAU,WAAW,KAAK,OAAO,SAAS,OAAO,MAAmB;AAClH,QAAM,CAAC,SAAS,QAAI,uBAAS,SAAS,cAAc,EAAE,CAAC;AACvD,MAAI,WAAW;AACb,cAAU,UAAU,IAAI,SAAS;AAAA,EACnC;AACA,8BAAU,MAAM;AACd,UAAM,gBAAgB,SAAS,cAAc,MAAM;AACnD,QAAI,CAAC,eAAe;AAClB,cAAQ,KAAK,kCAAkC,MAAM,EAAE;AAAA,IACzD;AACA,mBAAe,YAAY,SAAS;AACpC,WAAO,MAAM;AACX,qBAAe,YAAY,SAAS;AAAA,IACtC;AAAA,EACF,GAAG,CAAC,WAAW,MAAM,CAAC;AAEtB,aAAO,+BAAa,UAAU,SAAS;AACzC;","names":[]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/components/Portal/index.ts"],"names":[],"mappings":"AAAA,cAAc,UAAU,CAAA;AACxB,cAAc,eAAe,CAAA"}
|
|
@@ -3,6 +3,10 @@ var __defProp = Object.defineProperty;
|
|
|
3
3
|
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
4
|
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
5
|
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
+
var __export = (target, all) => {
|
|
7
|
+
for (var name in all)
|
|
8
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
|
+
};
|
|
6
10
|
var __copyProps = (to, from, except, desc) => {
|
|
7
11
|
if (from && typeof from === "object" || typeof from === "function") {
|
|
8
12
|
for (let key of __getOwnPropNames(from))
|
|
@@ -11,9 +15,33 @@ var __copyProps = (to, from, except, desc) => {
|
|
|
11
15
|
}
|
|
12
16
|
return to;
|
|
13
17
|
};
|
|
14
|
-
var __reExport = (target, mod, secondTarget) => (__copyProps(target, mod, "default"), secondTarget && __copyProps(secondTarget, mod, "default"));
|
|
15
18
|
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
+
|
|
20
|
+
// src/components/index.ts
|
|
16
21
|
var components_exports = {};
|
|
22
|
+
__export(components_exports, {
|
|
23
|
+
Portal: () => Portal
|
|
24
|
+
});
|
|
17
25
|
module.exports = __toCommonJS(components_exports);
|
|
18
|
-
|
|
26
|
+
|
|
27
|
+
// src/components/Portal/Portal.tsx
|
|
28
|
+
var import_react = require("react");
|
|
29
|
+
var import_react_dom = require("react-dom");
|
|
30
|
+
var Portal = ({ children, className, el = "div", target = "body" }) => {
|
|
31
|
+
const [container] = (0, import_react.useState)(document.createElement(el));
|
|
32
|
+
if (className) {
|
|
33
|
+
container.classList.add(className);
|
|
34
|
+
}
|
|
35
|
+
(0, import_react.useEffect)(() => {
|
|
36
|
+
const targetElement = document.querySelector(target);
|
|
37
|
+
if (!targetElement) {
|
|
38
|
+
console.warn(`Unable to find target element: ${target}`);
|
|
39
|
+
}
|
|
40
|
+
targetElement?.appendChild(container);
|
|
41
|
+
return () => {
|
|
42
|
+
targetElement?.removeChild(container);
|
|
43
|
+
};
|
|
44
|
+
}, [container, target]);
|
|
45
|
+
return (0, import_react_dom.createPortal)(children, container);
|
|
46
|
+
};
|
|
19
47
|
//# sourceMappingURL=index.cjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/components/index.ts"],"sourcesContent":["export * from './Portal'\n"],"mappings":"
|
|
1
|
+
{"version":3,"sources":["../../../src/components/index.ts","../../../src/components/Portal/Portal.tsx"],"sourcesContent":["export * from './Portal'\n","import { useEffect, useState } from 'react'\nimport { createPortal } from 'react-dom'\n\nimport { PortalProps } from './PortalProps'\n\nexport const Portal: React.FC<PortalProps> = ({ children, className, el = 'div', target = 'body' }: PortalProps) => {\n const [container] = useState(document.createElement(el))\n if (className) {\n container.classList.add(className)\n }\n useEffect(() => {\n const targetElement = document.querySelector(target)\n if (!targetElement) {\n console.warn(`Unable to find target element: ${target}`)\n }\n targetElement?.appendChild(container)\n return () => {\n targetElement?.removeChild(container)\n }\n }, [container, target])\n\n return createPortal(children, container)\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;;;ACAA,mBAAoC;AACpC,uBAA6B;AAItB,IAAM,SAAgC,CAAC,EAAE,UAAU,WAAW,KAAK,OAAO,SAAS,OAAO,MAAmB;AAClH,QAAM,CAAC,SAAS,QAAI,uBAAS,SAAS,cAAc,EAAE,CAAC;AACvD,MAAI,WAAW;AACb,cAAU,UAAU,IAAI,SAAS;AAAA,EACnC;AACA,8BAAU,MAAM;AACd,UAAM,gBAAgB,SAAS,cAAc,MAAM;AACnD,QAAI,CAAC,eAAe;AAClB,cAAQ,KAAK,kCAAkC,MAAM,EAAE;AAAA,IACzD;AACA,mBAAe,YAAY,SAAS;AACpC,WAAO,MAAM;AACX,qBAAe,YAAY,SAAS;AAAA,IACtC;AAAA,EACF,GAAG,CAAC,WAAW,MAAM,CAAC;AAEtB,aAAO,+BAAa,UAAU,SAAS;AACzC;","names":[]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/index.ts"],"names":[],"mappings":"AAAA,cAAc,UAAU,CAAA"}
|
package/dist/browser/index.cjs
CHANGED
|
@@ -3,6 +3,10 @@ var __defProp = Object.defineProperty;
|
|
|
3
3
|
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
4
|
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
5
|
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
+
var __export = (target, all) => {
|
|
7
|
+
for (var name in all)
|
|
8
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
|
+
};
|
|
6
10
|
var __copyProps = (to, from, except, desc) => {
|
|
7
11
|
if (from && typeof from === "object" || typeof from === "function") {
|
|
8
12
|
for (let key of __getOwnPropNames(from))
|
|
@@ -11,9 +15,33 @@ var __copyProps = (to, from, except, desc) => {
|
|
|
11
15
|
}
|
|
12
16
|
return to;
|
|
13
17
|
};
|
|
14
|
-
var __reExport = (target, mod, secondTarget) => (__copyProps(target, mod, "default"), secondTarget && __copyProps(secondTarget, mod, "default"));
|
|
15
18
|
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
+
|
|
20
|
+
// src/index.ts
|
|
16
21
|
var src_exports = {};
|
|
22
|
+
__export(src_exports, {
|
|
23
|
+
Portal: () => Portal
|
|
24
|
+
});
|
|
17
25
|
module.exports = __toCommonJS(src_exports);
|
|
18
|
-
|
|
26
|
+
|
|
27
|
+
// src/components/Portal/Portal.tsx
|
|
28
|
+
var import_react = require("react");
|
|
29
|
+
var import_react_dom = require("react-dom");
|
|
30
|
+
var Portal = ({ children, className, el = "div", target = "body" }) => {
|
|
31
|
+
const [container] = (0, import_react.useState)(document.createElement(el));
|
|
32
|
+
if (className) {
|
|
33
|
+
container.classList.add(className);
|
|
34
|
+
}
|
|
35
|
+
(0, import_react.useEffect)(() => {
|
|
36
|
+
const targetElement = document.querySelector(target);
|
|
37
|
+
if (!targetElement) {
|
|
38
|
+
console.warn(`Unable to find target element: ${target}`);
|
|
39
|
+
}
|
|
40
|
+
targetElement?.appendChild(container);
|
|
41
|
+
return () => {
|
|
42
|
+
targetElement?.removeChild(container);
|
|
43
|
+
};
|
|
44
|
+
}, [container, target]);
|
|
45
|
+
return (0, import_react_dom.createPortal)(children, container);
|
|
46
|
+
};
|
|
19
47
|
//# sourceMappingURL=index.cjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/index.ts"],"sourcesContent":["export * from './components'\n"],"mappings":"
|
|
1
|
+
{"version":3,"sources":["../../src/index.ts","../../src/components/Portal/Portal.tsx"],"sourcesContent":["export * from './components'\n","import { useEffect, useState } from 'react'\nimport { createPortal } from 'react-dom'\n\nimport { PortalProps } from './PortalProps'\n\nexport const Portal: React.FC<PortalProps> = ({ children, className, el = 'div', target = 'body' }: PortalProps) => {\n const [container] = useState(document.createElement(el))\n if (className) {\n container.classList.add(className)\n }\n useEffect(() => {\n const targetElement = document.querySelector(target)\n if (!targetElement) {\n console.warn(`Unable to find target element: ${target}`)\n }\n targetElement?.appendChild(container)\n return () => {\n targetElement?.removeChild(container)\n }\n }, [container, target])\n\n return createPortal(children, container)\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;;;ACAA,mBAAoC;AACpC,uBAA6B;AAItB,IAAM,SAAgC,CAAC,EAAE,UAAU,WAAW,KAAK,OAAO,SAAS,OAAO,MAAmB;AAClH,QAAM,CAAC,SAAS,QAAI,uBAAS,SAAS,cAAc,EAAE,CAAC;AACvD,MAAI,WAAW;AACb,cAAU,UAAU,IAAI,SAAS;AAAA,EACnC;AACA,8BAAU,MAAM;AACd,UAAM,gBAAgB,SAAS,cAAc,MAAM;AACnD,QAAI,CAAC,eAAe;AAClB,cAAQ,KAAK,kCAAkC,MAAM,EAAE;AAAA,IACzD;AACA,mBAAe,YAAY,SAAS;AACpC,WAAO,MAAM;AACX,qBAAe,YAAY,SAAS;AAAA,IACtC;AAAA,EACF,GAAG,CAAC,WAAW,MAAM,CAAC;AAEtB,aAAO,+BAAa,UAAU,SAAS;AACzC;","names":[]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,cAAc,CAAA"}
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
+
var __export = (target, all) => {
|
|
7
|
+
for (var name in all)
|
|
8
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
|
+
};
|
|
10
|
+
var __copyProps = (to, from, except, desc) => {
|
|
11
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
+
for (let key of __getOwnPropNames(from))
|
|
13
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
+
}
|
|
16
|
+
return to;
|
|
17
|
+
};
|
|
18
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
+
|
|
20
|
+
// src/components/Portal/Portal.tsx
|
|
21
|
+
var Portal_exports = {};
|
|
22
|
+
__export(Portal_exports, {
|
|
23
|
+
Portal: () => Portal
|
|
24
|
+
});
|
|
25
|
+
module.exports = __toCommonJS(Portal_exports);
|
|
26
|
+
var import_react = require("react");
|
|
27
|
+
var import_react_dom = require("react-dom");
|
|
28
|
+
var Portal = ({ children, className, el = "div", target = "body" }) => {
|
|
29
|
+
const [container] = (0, import_react.useState)(document.createElement(el));
|
|
30
|
+
if (className) {
|
|
31
|
+
container.classList.add(className);
|
|
32
|
+
}
|
|
33
|
+
(0, import_react.useEffect)(() => {
|
|
34
|
+
const targetElement = document.querySelector(target);
|
|
35
|
+
if (!targetElement) {
|
|
36
|
+
console.warn(`Unable to find target element: ${target}`);
|
|
37
|
+
}
|
|
38
|
+
targetElement == null ? void 0 : targetElement.appendChild(container);
|
|
39
|
+
return () => {
|
|
40
|
+
targetElement == null ? void 0 : targetElement.removeChild(container);
|
|
41
|
+
};
|
|
42
|
+
}, [container, target]);
|
|
43
|
+
return (0, import_react_dom.createPortal)(children, container);
|
|
44
|
+
};
|
|
45
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
46
|
+
0 && (module.exports = {
|
|
47
|
+
Portal
|
|
48
|
+
});
|
|
49
|
+
//# sourceMappingURL=Portal.cjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../src/components/Portal/Portal.tsx"],"sourcesContent":["import { useEffect, useState } from 'react'\nimport { createPortal } from 'react-dom'\n\nimport { PortalProps } from './PortalProps'\n\nexport const Portal: React.FC<PortalProps> = ({ children, className, el = 'div', target = 'body' }: PortalProps) => {\n const [container] = useState(document.createElement(el))\n if (className) {\n container.classList.add(className)\n }\n useEffect(() => {\n const targetElement = document.querySelector(target)\n if (!targetElement) {\n console.warn(`Unable to find target element: ${target}`)\n }\n targetElement?.appendChild(container)\n return () => {\n targetElement?.removeChild(container)\n }\n }, [container, target])\n\n return createPortal(children, container)\n}\n"],"mappings":";AAAA,
|
|
1
|
+
{"version":3,"sources":["../../../../src/components/Portal/Portal.tsx"],"sourcesContent":["import { useEffect, useState } from 'react'\nimport { createPortal } from 'react-dom'\n\nimport { PortalProps } from './PortalProps'\n\nexport const Portal: React.FC<PortalProps> = ({ children, className, el = 'div', target = 'body' }: PortalProps) => {\n const [container] = useState(document.createElement(el))\n if (className) {\n container.classList.add(className)\n }\n useEffect(() => {\n const targetElement = document.querySelector(target)\n if (!targetElement) {\n console.warn(`Unable to find target element: ${target}`)\n }\n targetElement?.appendChild(container)\n return () => {\n targetElement?.removeChild(container)\n }\n }, [container, target])\n\n return createPortal(children, container)\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,mBAAoC;AACpC,uBAA6B;AAItB,IAAM,SAAgC,CAAC,EAAE,UAAU,WAAW,KAAK,OAAO,SAAS,OAAO,MAAmB;AAClH,QAAM,CAAC,SAAS,QAAI,uBAAS,SAAS,cAAc,EAAE,CAAC;AACvD,MAAI,WAAW;AACb,cAAU,UAAU,IAAI,SAAS;AAAA,EACnC;AACA,8BAAU,MAAM;AACd,UAAM,gBAAgB,SAAS,cAAc,MAAM;AACnD,QAAI,CAAC,eAAe;AAClB,cAAQ,KAAK,kCAAkC,MAAM,EAAE;AAAA,IACzD;AACA,mDAAe,YAAY;AAC3B,WAAO,MAAM;AACX,qDAAe,YAAY;AAAA,IAC7B;AAAA,EACF,GAAG,CAAC,WAAW,MAAM,CAAC;AAEtB,aAAO,+BAAa,UAAU,SAAS;AACzC;","names":[]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Portal.d.ts","sourceRoot":"","sources":["../../../../src/components/Portal/Portal.tsx"],"names":[],"mappings":"AAGA,OAAO,EAAE,WAAW,EAAE,MAAM,eAAe,CAAA;AAE3C,eAAO,MAAM,MAAM,EAAE,KAAK,CAAC,EAAE,CAAC,WAAW,CAiBxC,CAAA"}
|
|
@@ -1,36 +1,12 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __defProp = Object.defineProperty;
|
|
3
|
-
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
-
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
-
var __export = (target, all) => {
|
|
7
|
-
for (var name in all)
|
|
8
|
-
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
|
-
};
|
|
10
|
-
var __copyProps = (to, from, except, desc) => {
|
|
11
|
-
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
-
for (let key of __getOwnPropNames(from))
|
|
13
|
-
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
-
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
-
}
|
|
16
|
-
return to;
|
|
17
|
-
};
|
|
18
|
-
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
-
|
|
20
1
|
// src/components/Portal/Portal.tsx
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
Portal: () => Portal
|
|
24
|
-
});
|
|
25
|
-
module.exports = __toCommonJS(Portal_exports);
|
|
26
|
-
var import_react = require("react");
|
|
27
|
-
var import_react_dom = require("react-dom");
|
|
2
|
+
import { useEffect, useState } from "react";
|
|
3
|
+
import { createPortal } from "react-dom";
|
|
28
4
|
var Portal = ({ children, className, el = "div", target = "body" }) => {
|
|
29
|
-
const [container] =
|
|
5
|
+
const [container] = useState(document.createElement(el));
|
|
30
6
|
if (className) {
|
|
31
7
|
container.classList.add(className);
|
|
32
8
|
}
|
|
33
|
-
|
|
9
|
+
useEffect(() => {
|
|
34
10
|
const targetElement = document.querySelector(target);
|
|
35
11
|
if (!targetElement) {
|
|
36
12
|
console.warn(`Unable to find target element: ${target}`);
|
|
@@ -40,10 +16,9 @@ var Portal = ({ children, className, el = "div", target = "body" }) => {
|
|
|
40
16
|
targetElement == null ? void 0 : targetElement.removeChild(container);
|
|
41
17
|
};
|
|
42
18
|
}, [container, target]);
|
|
43
|
-
return
|
|
19
|
+
return createPortal(children, container);
|
|
44
20
|
};
|
|
45
|
-
|
|
46
|
-
0 && (module.exports = {
|
|
21
|
+
export {
|
|
47
22
|
Portal
|
|
48
|
-
}
|
|
23
|
+
};
|
|
49
24
|
//# sourceMappingURL=Portal.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../src/components/Portal/Portal.tsx"],"sourcesContent":["import { useEffect, useState } from 'react'\nimport { createPortal } from 'react-dom'\n\nimport { PortalProps } from './PortalProps'\n\nexport const Portal: React.FC<PortalProps> = ({ children, className, el = 'div', target = 'body' }: PortalProps) => {\n const [container] = useState(document.createElement(el))\n if (className) {\n container.classList.add(className)\n }\n useEffect(() => {\n const targetElement = document.querySelector(target)\n if (!targetElement) {\n console.warn(`Unable to find target element: ${target}`)\n }\n targetElement?.appendChild(container)\n return () => {\n targetElement?.removeChild(container)\n }\n }, [container, target])\n\n return createPortal(children, container)\n}\n"],"mappings":"
|
|
1
|
+
{"version":3,"sources":["../../../../src/components/Portal/Portal.tsx"],"sourcesContent":["import { useEffect, useState } from 'react'\nimport { createPortal } from 'react-dom'\n\nimport { PortalProps } from './PortalProps'\n\nexport const Portal: React.FC<PortalProps> = ({ children, className, el = 'div', target = 'body' }: PortalProps) => {\n const [container] = useState(document.createElement(el))\n if (className) {\n container.classList.add(className)\n }\n useEffect(() => {\n const targetElement = document.querySelector(target)\n if (!targetElement) {\n console.warn(`Unable to find target element: ${target}`)\n }\n targetElement?.appendChild(container)\n return () => {\n targetElement?.removeChild(container)\n }\n }, [container, target])\n\n return createPortal(children, container)\n}\n"],"mappings":";AAAA,SAAS,WAAW,gBAAgB;AACpC,SAAS,oBAAoB;AAItB,IAAM,SAAgC,CAAC,EAAE,UAAU,WAAW,KAAK,OAAO,SAAS,OAAO,MAAmB;AAClH,QAAM,CAAC,SAAS,IAAI,SAAS,SAAS,cAAc,EAAE,CAAC;AACvD,MAAI,WAAW;AACb,cAAU,UAAU,IAAI,SAAS;AAAA,EACnC;AACA,YAAU,MAAM;AACd,UAAM,gBAAgB,SAAS,cAAc,MAAM;AACnD,QAAI,CAAC,eAAe;AAClB,cAAQ,KAAK,kCAAkC,MAAM,EAAE;AAAA,IACzD;AACA,mDAAe,YAAY;AAC3B,WAAO,MAAM;AACX,qDAAe,YAAY;AAAA,IAC7B;AAAA,EACF,GAAG,CAAC,WAAW,MAAM,CAAC;AAEtB,SAAO,aAAa,UAAU,SAAS;AACzC;","names":[]}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
+
var __copyProps = (to, from, except, desc) => {
|
|
7
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
8
|
+
for (let key of __getOwnPropNames(from))
|
|
9
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
10
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
11
|
+
}
|
|
12
|
+
return to;
|
|
13
|
+
};
|
|
14
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
15
|
+
|
|
16
|
+
// src/components/Portal/PortalProps.ts
|
|
17
|
+
var PortalProps_exports = {};
|
|
18
|
+
module.exports = __toCommonJS(PortalProps_exports);
|
|
19
|
+
//# sourceMappingURL=PortalProps.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../../src/components/Portal/PortalProps.ts"],"sourcesContent":["export interface PortalProps {\n children: React.ReactNode\n className?: string\n el?: string\n target?: string\n}\n"],"mappings":";;;;;;;;;;;;;;;;AAAA;AAAA;","names":[]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"PortalProps.d.ts","sourceRoot":"","sources":["../../../../src/components/Portal/PortalProps.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,WAAW;IAC1B,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAA;IACzB,SAAS,CAAC,EAAE,MAAM,CAAA;IAClB,EAAE,CAAC,EAAE,MAAM,CAAA;IACX,MAAM,CAAC,EAAE,MAAM,CAAA;CAChB"}
|
|
@@ -1,19 +1 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __defProp = Object.defineProperty;
|
|
3
|
-
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
-
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
-
var __copyProps = (to, from, except, desc) => {
|
|
7
|
-
if (from && typeof from === "object" || typeof from === "function") {
|
|
8
|
-
for (let key of __getOwnPropNames(from))
|
|
9
|
-
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
10
|
-
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
11
|
-
}
|
|
12
|
-
return to;
|
|
13
|
-
};
|
|
14
|
-
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
15
|
-
|
|
16
|
-
// src/components/Portal/PortalProps.ts
|
|
17
|
-
var PortalProps_exports = {};
|
|
18
|
-
module.exports = __toCommonJS(PortalProps_exports);
|
|
19
1
|
//# sourceMappingURL=PortalProps.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":[
|
|
1
|
+
{"version":3,"sources":[],"sourcesContent":[],"mappings":"","names":[]}
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
+
var __export = (target, all) => {
|
|
7
|
+
for (var name in all)
|
|
8
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
|
+
};
|
|
10
|
+
var __copyProps = (to, from, except, desc) => {
|
|
11
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
+
for (let key of __getOwnPropNames(from))
|
|
13
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
+
}
|
|
16
|
+
return to;
|
|
17
|
+
};
|
|
18
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
+
|
|
20
|
+
// src/components/Portal/index.ts
|
|
21
|
+
var Portal_exports = {};
|
|
22
|
+
__export(Portal_exports, {
|
|
23
|
+
Portal: () => Portal
|
|
24
|
+
});
|
|
25
|
+
module.exports = __toCommonJS(Portal_exports);
|
|
26
|
+
|
|
27
|
+
// src/components/Portal/Portal.tsx
|
|
28
|
+
var import_react = require("react");
|
|
29
|
+
var import_react_dom = require("react-dom");
|
|
30
|
+
var Portal = ({ children, className, el = "div", target = "body" }) => {
|
|
31
|
+
const [container] = (0, import_react.useState)(document.createElement(el));
|
|
32
|
+
if (className) {
|
|
33
|
+
container.classList.add(className);
|
|
34
|
+
}
|
|
35
|
+
(0, import_react.useEffect)(() => {
|
|
36
|
+
const targetElement = document.querySelector(target);
|
|
37
|
+
if (!targetElement) {
|
|
38
|
+
console.warn(`Unable to find target element: ${target}`);
|
|
39
|
+
}
|
|
40
|
+
targetElement == null ? void 0 : targetElement.appendChild(container);
|
|
41
|
+
return () => {
|
|
42
|
+
targetElement == null ? void 0 : targetElement.removeChild(container);
|
|
43
|
+
};
|
|
44
|
+
}, [container, target]);
|
|
45
|
+
return (0, import_react_dom.createPortal)(children, container);
|
|
46
|
+
};
|
|
47
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
48
|
+
0 && (module.exports = {
|
|
49
|
+
Portal
|
|
50
|
+
});
|
|
51
|
+
//# sourceMappingURL=index.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../../src/components/Portal/index.ts","../../../../src/components/Portal/Portal.tsx"],"sourcesContent":["export * from './Portal'\nexport * from './PortalProps'\n","import { useEffect, useState } from 'react'\nimport { createPortal } from 'react-dom'\n\nimport { PortalProps } from './PortalProps'\n\nexport const Portal: React.FC<PortalProps> = ({ children, className, el = 'div', target = 'body' }: PortalProps) => {\n const [container] = useState(document.createElement(el))\n if (className) {\n container.classList.add(className)\n }\n useEffect(() => {\n const targetElement = document.querySelector(target)\n if (!targetElement) {\n console.warn(`Unable to find target element: ${target}`)\n }\n targetElement?.appendChild(container)\n return () => {\n targetElement?.removeChild(container)\n }\n }, [container, target])\n\n return createPortal(children, container)\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;;;ACAA,mBAAoC;AACpC,uBAA6B;AAItB,IAAM,SAAgC,CAAC,EAAE,UAAU,WAAW,KAAK,OAAO,SAAS,OAAO,MAAmB;AAClH,QAAM,CAAC,SAAS,QAAI,uBAAS,SAAS,cAAc,EAAE,CAAC;AACvD,MAAI,WAAW;AACb,cAAU,UAAU,IAAI,SAAS;AAAA,EACnC;AACA,8BAAU,MAAM;AACd,UAAM,gBAAgB,SAAS,cAAc,MAAM;AACnD,QAAI,CAAC,eAAe;AAClB,cAAQ,KAAK,kCAAkC,MAAM,EAAE;AAAA,IACzD;AACA,mDAAe,YAAY;AAC3B,WAAO,MAAM;AACX,qDAAe,YAAY;AAAA,IAC7B;AAAA,EACF,GAAG,CAAC,WAAW,MAAM,CAAC;AAEtB,aAAO,+BAAa,UAAU,SAAS;AACzC;","names":[]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/components/Portal/index.ts"],"names":[],"mappings":"AAAA,cAAc,UAAU,CAAA;AACxB,cAAc,eAAe,CAAA"}
|
|
@@ -1,38 +1,12 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __defProp = Object.defineProperty;
|
|
3
|
-
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
-
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
-
var __export = (target, all) => {
|
|
7
|
-
for (var name in all)
|
|
8
|
-
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
|
-
};
|
|
10
|
-
var __copyProps = (to, from, except, desc) => {
|
|
11
|
-
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
-
for (let key of __getOwnPropNames(from))
|
|
13
|
-
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
-
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
-
}
|
|
16
|
-
return to;
|
|
17
|
-
};
|
|
18
|
-
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
-
|
|
20
|
-
// src/components/Portal/index.ts
|
|
21
|
-
var Portal_exports = {};
|
|
22
|
-
__export(Portal_exports, {
|
|
23
|
-
Portal: () => Portal
|
|
24
|
-
});
|
|
25
|
-
module.exports = __toCommonJS(Portal_exports);
|
|
26
|
-
|
|
27
1
|
// src/components/Portal/Portal.tsx
|
|
28
|
-
|
|
29
|
-
|
|
2
|
+
import { useEffect, useState } from "react";
|
|
3
|
+
import { createPortal } from "react-dom";
|
|
30
4
|
var Portal = ({ children, className, el = "div", target = "body" }) => {
|
|
31
|
-
const [container] =
|
|
5
|
+
const [container] = useState(document.createElement(el));
|
|
32
6
|
if (className) {
|
|
33
7
|
container.classList.add(className);
|
|
34
8
|
}
|
|
35
|
-
|
|
9
|
+
useEffect(() => {
|
|
36
10
|
const targetElement = document.querySelector(target);
|
|
37
11
|
if (!targetElement) {
|
|
38
12
|
console.warn(`Unable to find target element: ${target}`);
|
|
@@ -42,10 +16,9 @@ var Portal = ({ children, className, el = "div", target = "body" }) => {
|
|
|
42
16
|
targetElement == null ? void 0 : targetElement.removeChild(container);
|
|
43
17
|
};
|
|
44
18
|
}, [container, target]);
|
|
45
|
-
return
|
|
19
|
+
return createPortal(children, container);
|
|
46
20
|
};
|
|
47
|
-
|
|
48
|
-
0 && (module.exports = {
|
|
21
|
+
export {
|
|
49
22
|
Portal
|
|
50
|
-
}
|
|
23
|
+
};
|
|
51
24
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../src/components/Portal/
|
|
1
|
+
{"version":3,"sources":["../../../../src/components/Portal/Portal.tsx"],"sourcesContent":["import { useEffect, useState } from 'react'\nimport { createPortal } from 'react-dom'\n\nimport { PortalProps } from './PortalProps'\n\nexport const Portal: React.FC<PortalProps> = ({ children, className, el = 'div', target = 'body' }: PortalProps) => {\n const [container] = useState(document.createElement(el))\n if (className) {\n container.classList.add(className)\n }\n useEffect(() => {\n const targetElement = document.querySelector(target)\n if (!targetElement) {\n console.warn(`Unable to find target element: ${target}`)\n }\n targetElement?.appendChild(container)\n return () => {\n targetElement?.removeChild(container)\n }\n }, [container, target])\n\n return createPortal(children, container)\n}\n"],"mappings":";AAAA,SAAS,WAAW,gBAAgB;AACpC,SAAS,oBAAoB;AAItB,IAAM,SAAgC,CAAC,EAAE,UAAU,WAAW,KAAK,OAAO,SAAS,OAAO,MAAmB;AAClH,QAAM,CAAC,SAAS,IAAI,SAAS,SAAS,cAAc,EAAE,CAAC;AACvD,MAAI,WAAW;AACb,cAAU,UAAU,IAAI,SAAS;AAAA,EACnC;AACA,YAAU,MAAM;AACd,UAAM,gBAAgB,SAAS,cAAc,MAAM;AACnD,QAAI,CAAC,eAAe;AAClB,cAAQ,KAAK,kCAAkC,MAAM,EAAE;AAAA,IACzD;AACA,mDAAe,YAAY;AAC3B,WAAO,MAAM;AACX,qDAAe,YAAY;AAAA,IAC7B;AAAA,EACF,GAAG,CAAC,WAAW,MAAM,CAAC;AAEtB,SAAO,aAAa,UAAU,SAAS;AACzC;","names":[]}
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
+
var __export = (target, all) => {
|
|
7
|
+
for (var name in all)
|
|
8
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
|
+
};
|
|
10
|
+
var __copyProps = (to, from, except, desc) => {
|
|
11
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
+
for (let key of __getOwnPropNames(from))
|
|
13
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
+
}
|
|
16
|
+
return to;
|
|
17
|
+
};
|
|
18
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
+
|
|
20
|
+
// src/components/index.ts
|
|
21
|
+
var components_exports = {};
|
|
22
|
+
__export(components_exports, {
|
|
23
|
+
Portal: () => Portal
|
|
24
|
+
});
|
|
25
|
+
module.exports = __toCommonJS(components_exports);
|
|
26
|
+
|
|
27
|
+
// src/components/Portal/Portal.tsx
|
|
28
|
+
var import_react = require("react");
|
|
29
|
+
var import_react_dom = require("react-dom");
|
|
30
|
+
var Portal = ({ children, className, el = "div", target = "body" }) => {
|
|
31
|
+
const [container] = (0, import_react.useState)(document.createElement(el));
|
|
32
|
+
if (className) {
|
|
33
|
+
container.classList.add(className);
|
|
34
|
+
}
|
|
35
|
+
(0, import_react.useEffect)(() => {
|
|
36
|
+
const targetElement = document.querySelector(target);
|
|
37
|
+
if (!targetElement) {
|
|
38
|
+
console.warn(`Unable to find target element: ${target}`);
|
|
39
|
+
}
|
|
40
|
+
targetElement == null ? void 0 : targetElement.appendChild(container);
|
|
41
|
+
return () => {
|
|
42
|
+
targetElement == null ? void 0 : targetElement.removeChild(container);
|
|
43
|
+
};
|
|
44
|
+
}, [container, target]);
|
|
45
|
+
return (0, import_react_dom.createPortal)(children, container);
|
|
46
|
+
};
|
|
47
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
48
|
+
0 && (module.exports = {
|
|
49
|
+
Portal
|
|
50
|
+
});
|
|
51
|
+
//# sourceMappingURL=index.cjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/components/Portal/Portal.tsx"],"sourcesContent":["import { useEffect, useState } from 'react'\nimport { createPortal } from 'react-dom'\n\nimport { PortalProps } from './PortalProps'\n\nexport const Portal: React.FC<PortalProps> = ({ children, className, el = 'div', target = 'body' }: PortalProps) => {\n const [container] = useState(document.createElement(el))\n if (className) {\n container.classList.add(className)\n }\n useEffect(() => {\n const targetElement = document.querySelector(target)\n if (!targetElement) {\n console.warn(`Unable to find target element: ${target}`)\n }\n targetElement?.appendChild(container)\n return () => {\n targetElement?.removeChild(container)\n }\n }, [container, target])\n\n return createPortal(children, container)\n}\n"],"mappings":";AAAA,
|
|
1
|
+
{"version":3,"sources":["../../../src/components/index.ts","../../../src/components/Portal/Portal.tsx"],"sourcesContent":["export * from './Portal'\n","import { useEffect, useState } from 'react'\nimport { createPortal } from 'react-dom'\n\nimport { PortalProps } from './PortalProps'\n\nexport const Portal: React.FC<PortalProps> = ({ children, className, el = 'div', target = 'body' }: PortalProps) => {\n const [container] = useState(document.createElement(el))\n if (className) {\n container.classList.add(className)\n }\n useEffect(() => {\n const targetElement = document.querySelector(target)\n if (!targetElement) {\n console.warn(`Unable to find target element: ${target}`)\n }\n targetElement?.appendChild(container)\n return () => {\n targetElement?.removeChild(container)\n }\n }, [container, target])\n\n return createPortal(children, container)\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;;;ACAA,mBAAoC;AACpC,uBAA6B;AAItB,IAAM,SAAgC,CAAC,EAAE,UAAU,WAAW,KAAK,OAAO,SAAS,OAAO,MAAmB;AAClH,QAAM,CAAC,SAAS,QAAI,uBAAS,SAAS,cAAc,EAAE,CAAC;AACvD,MAAI,WAAW;AACb,cAAU,UAAU,IAAI,SAAS;AAAA,EACnC;AACA,8BAAU,MAAM;AACd,UAAM,gBAAgB,SAAS,cAAc,MAAM;AACnD,QAAI,CAAC,eAAe;AAClB,cAAQ,KAAK,kCAAkC,MAAM,EAAE;AAAA,IACzD;AACA,mDAAe,YAAY;AAC3B,WAAO,MAAM;AACX,qDAAe,YAAY;AAAA,IAC7B;AAAA,EACF,GAAG,CAAC,WAAW,MAAM,CAAC;AAEtB,aAAO,+BAAa,UAAU,SAAS;AACzC;","names":[]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/index.ts"],"names":[],"mappings":"AAAA,cAAc,UAAU,CAAA"}
|
|
@@ -1,38 +1,12 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __defProp = Object.defineProperty;
|
|
3
|
-
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
-
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
-
var __export = (target, all) => {
|
|
7
|
-
for (var name in all)
|
|
8
|
-
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
|
-
};
|
|
10
|
-
var __copyProps = (to, from, except, desc) => {
|
|
11
|
-
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
-
for (let key of __getOwnPropNames(from))
|
|
13
|
-
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
-
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
-
}
|
|
16
|
-
return to;
|
|
17
|
-
};
|
|
18
|
-
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
-
|
|
20
|
-
// src/components/index.ts
|
|
21
|
-
var components_exports = {};
|
|
22
|
-
__export(components_exports, {
|
|
23
|
-
Portal: () => Portal
|
|
24
|
-
});
|
|
25
|
-
module.exports = __toCommonJS(components_exports);
|
|
26
|
-
|
|
27
1
|
// src/components/Portal/Portal.tsx
|
|
28
|
-
|
|
29
|
-
|
|
2
|
+
import { useEffect, useState } from "react";
|
|
3
|
+
import { createPortal } from "react-dom";
|
|
30
4
|
var Portal = ({ children, className, el = "div", target = "body" }) => {
|
|
31
|
-
const [container] =
|
|
5
|
+
const [container] = useState(document.createElement(el));
|
|
32
6
|
if (className) {
|
|
33
7
|
container.classList.add(className);
|
|
34
8
|
}
|
|
35
|
-
|
|
9
|
+
useEffect(() => {
|
|
36
10
|
const targetElement = document.querySelector(target);
|
|
37
11
|
if (!targetElement) {
|
|
38
12
|
console.warn(`Unable to find target element: ${target}`);
|
|
@@ -42,10 +16,9 @@ var Portal = ({ children, className, el = "div", target = "body" }) => {
|
|
|
42
16
|
targetElement == null ? void 0 : targetElement.removeChild(container);
|
|
43
17
|
};
|
|
44
18
|
}, [container, target]);
|
|
45
|
-
return
|
|
19
|
+
return createPortal(children, container);
|
|
46
20
|
};
|
|
47
|
-
|
|
48
|
-
0 && (module.exports = {
|
|
21
|
+
export {
|
|
49
22
|
Portal
|
|
50
|
-
}
|
|
23
|
+
};
|
|
51
24
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/components/
|
|
1
|
+
{"version":3,"sources":["../../../src/components/Portal/Portal.tsx"],"sourcesContent":["import { useEffect, useState } from 'react'\nimport { createPortal } from 'react-dom'\n\nimport { PortalProps } from './PortalProps'\n\nexport const Portal: React.FC<PortalProps> = ({ children, className, el = 'div', target = 'body' }: PortalProps) => {\n const [container] = useState(document.createElement(el))\n if (className) {\n container.classList.add(className)\n }\n useEffect(() => {\n const targetElement = document.querySelector(target)\n if (!targetElement) {\n console.warn(`Unable to find target element: ${target}`)\n }\n targetElement?.appendChild(container)\n return () => {\n targetElement?.removeChild(container)\n }\n }, [container, target])\n\n return createPortal(children, container)\n}\n"],"mappings":";AAAA,SAAS,WAAW,gBAAgB;AACpC,SAAS,oBAAoB;AAItB,IAAM,SAAgC,CAAC,EAAE,UAAU,WAAW,KAAK,OAAO,SAAS,OAAO,MAAmB;AAClH,QAAM,CAAC,SAAS,IAAI,SAAS,SAAS,cAAc,EAAE,CAAC;AACvD,MAAI,WAAW;AACb,cAAU,UAAU,IAAI,SAAS;AAAA,EACnC;AACA,YAAU,MAAM;AACd,UAAM,gBAAgB,SAAS,cAAc,MAAM;AACnD,QAAI,CAAC,eAAe;AAClB,cAAQ,KAAK,kCAAkC,MAAM,EAAE;AAAA,IACzD;AACA,mDAAe,YAAY;AAC3B,WAAO,MAAM;AACX,qDAAe,YAAY;AAAA,IAC7B;AAAA,EACF,GAAG,CAAC,WAAW,MAAM,CAAC;AAEtB,SAAO,aAAa,UAAU,SAAS;AACzC;","names":[]}
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
+
var __export = (target, all) => {
|
|
7
|
+
for (var name in all)
|
|
8
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
|
+
};
|
|
10
|
+
var __copyProps = (to, from, except, desc) => {
|
|
11
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
+
for (let key of __getOwnPropNames(from))
|
|
13
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
+
}
|
|
16
|
+
return to;
|
|
17
|
+
};
|
|
18
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
+
|
|
20
|
+
// src/index.ts
|
|
21
|
+
var src_exports = {};
|
|
22
|
+
__export(src_exports, {
|
|
23
|
+
Portal: () => Portal
|
|
24
|
+
});
|
|
25
|
+
module.exports = __toCommonJS(src_exports);
|
|
26
|
+
|
|
27
|
+
// src/components/Portal/Portal.tsx
|
|
28
|
+
var import_react = require("react");
|
|
29
|
+
var import_react_dom = require("react-dom");
|
|
30
|
+
var Portal = ({ children, className, el = "div", target = "body" }) => {
|
|
31
|
+
const [container] = (0, import_react.useState)(document.createElement(el));
|
|
32
|
+
if (className) {
|
|
33
|
+
container.classList.add(className);
|
|
34
|
+
}
|
|
35
|
+
(0, import_react.useEffect)(() => {
|
|
36
|
+
const targetElement = document.querySelector(target);
|
|
37
|
+
if (!targetElement) {
|
|
38
|
+
console.warn(`Unable to find target element: ${target}`);
|
|
39
|
+
}
|
|
40
|
+
targetElement == null ? void 0 : targetElement.appendChild(container);
|
|
41
|
+
return () => {
|
|
42
|
+
targetElement == null ? void 0 : targetElement.removeChild(container);
|
|
43
|
+
};
|
|
44
|
+
}, [container, target]);
|
|
45
|
+
return (0, import_react_dom.createPortal)(children, container);
|
|
46
|
+
};
|
|
47
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
48
|
+
0 && (module.exports = {
|
|
49
|
+
Portal
|
|
50
|
+
});
|
|
51
|
+
//# sourceMappingURL=index.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../src/index.ts","../../src/components/Portal/Portal.tsx"],"sourcesContent":["export * from './components'\n","import { useEffect, useState } from 'react'\nimport { createPortal } from 'react-dom'\n\nimport { PortalProps } from './PortalProps'\n\nexport const Portal: React.FC<PortalProps> = ({ children, className, el = 'div', target = 'body' }: PortalProps) => {\n const [container] = useState(document.createElement(el))\n if (className) {\n container.classList.add(className)\n }\n useEffect(() => {\n const targetElement = document.querySelector(target)\n if (!targetElement) {\n console.warn(`Unable to find target element: ${target}`)\n }\n targetElement?.appendChild(container)\n return () => {\n targetElement?.removeChild(container)\n }\n }, [container, target])\n\n return createPortal(children, container)\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;;;ACAA,mBAAoC;AACpC,uBAA6B;AAItB,IAAM,SAAgC,CAAC,EAAE,UAAU,WAAW,KAAK,OAAO,SAAS,OAAO,MAAmB;AAClH,QAAM,CAAC,SAAS,QAAI,uBAAS,SAAS,cAAc,EAAE,CAAC;AACvD,MAAI,WAAW;AACb,cAAU,UAAU,IAAI,SAAS;AAAA,EACnC;AACA,8BAAU,MAAM;AACd,UAAM,gBAAgB,SAAS,cAAc,MAAM;AACnD,QAAI,CAAC,eAAe;AAClB,cAAQ,KAAK,kCAAkC,MAAM,EAAE;AAAA,IACzD;AACA,mDAAe,YAAY;AAC3B,WAAO,MAAM;AACX,qDAAe,YAAY;AAAA,IAC7B;AAAA,EACF,GAAG,CAAC,WAAW,MAAM,CAAC;AAEtB,aAAO,+BAAa,UAAU,SAAS;AACzC;","names":[]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,cAAc,CAAA"}
|
package/dist/node/index.js
CHANGED
|
@@ -1,38 +1,12 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __defProp = Object.defineProperty;
|
|
3
|
-
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
-
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
-
var __export = (target, all) => {
|
|
7
|
-
for (var name in all)
|
|
8
|
-
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
|
-
};
|
|
10
|
-
var __copyProps = (to, from, except, desc) => {
|
|
11
|
-
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
-
for (let key of __getOwnPropNames(from))
|
|
13
|
-
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
-
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
-
}
|
|
16
|
-
return to;
|
|
17
|
-
};
|
|
18
|
-
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
-
|
|
20
|
-
// src/index.ts
|
|
21
|
-
var src_exports = {};
|
|
22
|
-
__export(src_exports, {
|
|
23
|
-
Portal: () => Portal
|
|
24
|
-
});
|
|
25
|
-
module.exports = __toCommonJS(src_exports);
|
|
26
|
-
|
|
27
1
|
// src/components/Portal/Portal.tsx
|
|
28
|
-
|
|
29
|
-
|
|
2
|
+
import { useEffect, useState } from "react";
|
|
3
|
+
import { createPortal } from "react-dom";
|
|
30
4
|
var Portal = ({ children, className, el = "div", target = "body" }) => {
|
|
31
|
-
const [container] =
|
|
5
|
+
const [container] = useState(document.createElement(el));
|
|
32
6
|
if (className) {
|
|
33
7
|
container.classList.add(className);
|
|
34
8
|
}
|
|
35
|
-
|
|
9
|
+
useEffect(() => {
|
|
36
10
|
const targetElement = document.querySelector(target);
|
|
37
11
|
if (!targetElement) {
|
|
38
12
|
console.warn(`Unable to find target element: ${target}`);
|
|
@@ -42,10 +16,9 @@ var Portal = ({ children, className, el = "div", target = "body" }) => {
|
|
|
42
16
|
targetElement == null ? void 0 : targetElement.removeChild(container);
|
|
43
17
|
};
|
|
44
18
|
}, [container, target]);
|
|
45
|
-
return
|
|
19
|
+
return createPortal(children, container);
|
|
46
20
|
};
|
|
47
|
-
|
|
48
|
-
0 && (module.exports = {
|
|
21
|
+
export {
|
|
49
22
|
Portal
|
|
50
|
-
}
|
|
23
|
+
};
|
|
51
24
|
//# sourceMappingURL=index.js.map
|
package/dist/node/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/
|
|
1
|
+
{"version":3,"sources":["../../src/components/Portal/Portal.tsx"],"sourcesContent":["import { useEffect, useState } from 'react'\nimport { createPortal } from 'react-dom'\n\nimport { PortalProps } from './PortalProps'\n\nexport const Portal: React.FC<PortalProps> = ({ children, className, el = 'div', target = 'body' }: PortalProps) => {\n const [container] = useState(document.createElement(el))\n if (className) {\n container.classList.add(className)\n }\n useEffect(() => {\n const targetElement = document.querySelector(target)\n if (!targetElement) {\n console.warn(`Unable to find target element: ${target}`)\n }\n targetElement?.appendChild(container)\n return () => {\n targetElement?.removeChild(container)\n }\n }, [container, target])\n\n return createPortal(children, container)\n}\n"],"mappings":";AAAA,SAAS,WAAW,gBAAgB;AACpC,SAAS,oBAAoB;AAItB,IAAM,SAAgC,CAAC,EAAE,UAAU,WAAW,KAAK,OAAO,SAAS,OAAO,MAAmB;AAClH,QAAM,CAAC,SAAS,IAAI,SAAS,SAAS,cAAc,EAAE,CAAC;AACvD,MAAI,WAAW;AACb,cAAU,UAAU,IAAI,SAAS;AAAA,EACnC;AACA,YAAU,MAAM;AACd,UAAM,gBAAgB,SAAS,cAAc,MAAM;AACnD,QAAI,CAAC,eAAe;AAClB,cAAQ,KAAK,kCAAkC,MAAM,EAAE;AAAA,IACzD;AACA,mDAAe,YAAY;AAC3B,WAAO,MAAM;AACX,qDAAe,YAAY;AAAA,IAC7B;AAAA,EACF,GAAG,CAAC,WAAW,MAAM,CAAC;AAEtB,SAAO,aAAa,UAAU,SAAS;AACzC;","names":[]}
|
package/package.json
CHANGED
|
@@ -15,8 +15,8 @@
|
|
|
15
15
|
"description": "Common React library for all XY Labs projects that use React",
|
|
16
16
|
"devDependencies": {
|
|
17
17
|
"@types/react-dom": "^18.2.8",
|
|
18
|
-
"@xylabs/ts-scripts-yarn3": "^3.0.
|
|
19
|
-
"@xylabs/tsconfig-react": "^3.0.
|
|
18
|
+
"@xylabs/ts-scripts-yarn3": "^3.0.78",
|
|
19
|
+
"@xylabs/tsconfig-react": "^3.0.78",
|
|
20
20
|
"react": "^18.2.0",
|
|
21
21
|
"react-dom": "^18.2.0",
|
|
22
22
|
"typescript": "^5.2.2"
|
|
@@ -30,20 +30,20 @@
|
|
|
30
30
|
"node": {
|
|
31
31
|
"import": {
|
|
32
32
|
"types": "./dist/node/index.d.mts",
|
|
33
|
-
"default": "./dist/node/index.
|
|
33
|
+
"default": "./dist/node/index.js"
|
|
34
34
|
},
|
|
35
35
|
"require": {
|
|
36
|
-
"types": "./dist/node/index.d.
|
|
37
|
-
"default": "./dist/node/index.
|
|
36
|
+
"types": "./dist/node/index.d.cts",
|
|
37
|
+
"default": "./dist/node/index.cjs"
|
|
38
38
|
}
|
|
39
39
|
},
|
|
40
40
|
"browser": {
|
|
41
41
|
"import": {
|
|
42
|
-
"types": "./dist/browser/index.d.
|
|
42
|
+
"types": "./dist/browser/index.d.mts",
|
|
43
43
|
"default": "./dist/browser/index.js"
|
|
44
44
|
},
|
|
45
45
|
"require": {
|
|
46
|
-
"types": "./dist/browser/index.d.
|
|
46
|
+
"types": "./dist/browser/index.d.cts",
|
|
47
47
|
"default": "./dist/browser/index.cjs"
|
|
48
48
|
}
|
|
49
49
|
},
|
|
@@ -55,7 +55,7 @@
|
|
|
55
55
|
"./package.json": "./package.json"
|
|
56
56
|
},
|
|
57
57
|
"types": "dist/browser/index.d.ts",
|
|
58
|
-
"main": "./dist/browser/index.
|
|
58
|
+
"main": "./dist/browser/index.cjs",
|
|
59
59
|
"module": "./dist/browser/index.js",
|
|
60
60
|
"homepage": "https://xylabs.com",
|
|
61
61
|
"keywords": [
|
|
@@ -72,5 +72,6 @@
|
|
|
72
72
|
"url": "https://github.com/xylabs/sdk-react.git"
|
|
73
73
|
},
|
|
74
74
|
"sideEffects": false,
|
|
75
|
-
"version": "3.0.
|
|
75
|
+
"version": "3.0.5",
|
|
76
|
+
"type": "module"
|
|
76
77
|
}
|
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
// src/components/Portal/Portal.tsx
|
|
2
|
-
import { useEffect, useState } from "react";
|
|
3
|
-
import { createPortal } from "react-dom";
|
|
4
|
-
var Portal = ({ children, className, el = "div", target = "body" }) => {
|
|
5
|
-
const [container] = useState(document.createElement(el));
|
|
6
|
-
if (className) {
|
|
7
|
-
container.classList.add(className);
|
|
8
|
-
}
|
|
9
|
-
useEffect(() => {
|
|
10
|
-
const targetElement = document.querySelector(target);
|
|
11
|
-
if (!targetElement) {
|
|
12
|
-
console.warn(`Unable to find target element: ${target}`);
|
|
13
|
-
}
|
|
14
|
-
targetElement == null ? void 0 : targetElement.appendChild(container);
|
|
15
|
-
return () => {
|
|
16
|
-
targetElement == null ? void 0 : targetElement.removeChild(container);
|
|
17
|
-
};
|
|
18
|
-
}, [container, target]);
|
|
19
|
-
return createPortal(children, container);
|
|
20
|
-
};
|
|
21
|
-
export {
|
|
22
|
-
Portal
|
|
23
|
-
};
|
|
24
|
-
//# sourceMappingURL=Portal.mjs.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../src/components/Portal/Portal.tsx"],"sourcesContent":["import { useEffect, useState } from 'react'\nimport { createPortal } from 'react-dom'\n\nimport { PortalProps } from './PortalProps'\n\nexport const Portal: React.FC<PortalProps> = ({ children, className, el = 'div', target = 'body' }: PortalProps) => {\n const [container] = useState(document.createElement(el))\n if (className) {\n container.classList.add(className)\n }\n useEffect(() => {\n const targetElement = document.querySelector(target)\n if (!targetElement) {\n console.warn(`Unable to find target element: ${target}`)\n }\n targetElement?.appendChild(container)\n return () => {\n targetElement?.removeChild(container)\n }\n }, [container, target])\n\n return createPortal(children, container)\n}\n"],"mappings":";AAAA,SAAS,WAAW,gBAAgB;AACpC,SAAS,oBAAoB;AAItB,IAAM,SAAgC,CAAC,EAAE,UAAU,WAAW,KAAK,OAAO,SAAS,OAAO,MAAmB;AAClH,QAAM,CAAC,SAAS,IAAI,SAAS,SAAS,cAAc,EAAE,CAAC;AACvD,MAAI,WAAW;AACb,cAAU,UAAU,IAAI,SAAS;AAAA,EACnC;AACA,YAAU,MAAM;AACd,UAAM,gBAAgB,SAAS,cAAc,MAAM;AACnD,QAAI,CAAC,eAAe;AAClB,cAAQ,KAAK,kCAAkC,MAAM,EAAE;AAAA,IACzD;AACA,mDAAe,YAAY;AAC3B,WAAO,MAAM;AACX,qDAAe,YAAY;AAAA,IAC7B;AAAA,EACF,GAAG,CAAC,WAAW,MAAM,CAAC;AAEtB,SAAO,aAAa,UAAU,SAAS;AACzC;","names":[]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
//# sourceMappingURL=PortalProps.mjs.map
|
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
// src/components/Portal/Portal.tsx
|
|
2
|
-
import { useEffect, useState } from "react";
|
|
3
|
-
import { createPortal } from "react-dom";
|
|
4
|
-
var Portal = ({ children, className, el = "div", target = "body" }) => {
|
|
5
|
-
const [container] = useState(document.createElement(el));
|
|
6
|
-
if (className) {
|
|
7
|
-
container.classList.add(className);
|
|
8
|
-
}
|
|
9
|
-
useEffect(() => {
|
|
10
|
-
const targetElement = document.querySelector(target);
|
|
11
|
-
if (!targetElement) {
|
|
12
|
-
console.warn(`Unable to find target element: ${target}`);
|
|
13
|
-
}
|
|
14
|
-
targetElement == null ? void 0 : targetElement.appendChild(container);
|
|
15
|
-
return () => {
|
|
16
|
-
targetElement == null ? void 0 : targetElement.removeChild(container);
|
|
17
|
-
};
|
|
18
|
-
}, [container, target]);
|
|
19
|
-
return createPortal(children, container);
|
|
20
|
-
};
|
|
21
|
-
export {
|
|
22
|
-
Portal
|
|
23
|
-
};
|
|
24
|
-
//# sourceMappingURL=index.mjs.map
|
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
// src/components/Portal/Portal.tsx
|
|
2
|
-
import { useEffect, useState } from "react";
|
|
3
|
-
import { createPortal } from "react-dom";
|
|
4
|
-
var Portal = ({ children, className, el = "div", target = "body" }) => {
|
|
5
|
-
const [container] = useState(document.createElement(el));
|
|
6
|
-
if (className) {
|
|
7
|
-
container.classList.add(className);
|
|
8
|
-
}
|
|
9
|
-
useEffect(() => {
|
|
10
|
-
const targetElement = document.querySelector(target);
|
|
11
|
-
if (!targetElement) {
|
|
12
|
-
console.warn(`Unable to find target element: ${target}`);
|
|
13
|
-
}
|
|
14
|
-
targetElement == null ? void 0 : targetElement.appendChild(container);
|
|
15
|
-
return () => {
|
|
16
|
-
targetElement == null ? void 0 : targetElement.removeChild(container);
|
|
17
|
-
};
|
|
18
|
-
}, [container, target]);
|
|
19
|
-
return createPortal(children, container);
|
|
20
|
-
};
|
|
21
|
-
export {
|
|
22
|
-
Portal
|
|
23
|
-
};
|
|
24
|
-
//# sourceMappingURL=index.mjs.map
|
package/dist/node/index.mjs
DELETED
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
// src/components/Portal/Portal.tsx
|
|
2
|
-
import { useEffect, useState } from "react";
|
|
3
|
-
import { createPortal } from "react-dom";
|
|
4
|
-
var Portal = ({ children, className, el = "div", target = "body" }) => {
|
|
5
|
-
const [container] = useState(document.createElement(el));
|
|
6
|
-
if (className) {
|
|
7
|
-
container.classList.add(className);
|
|
8
|
-
}
|
|
9
|
-
useEffect(() => {
|
|
10
|
-
const targetElement = document.querySelector(target);
|
|
11
|
-
if (!targetElement) {
|
|
12
|
-
console.warn(`Unable to find target element: ${target}`);
|
|
13
|
-
}
|
|
14
|
-
targetElement == null ? void 0 : targetElement.appendChild(container);
|
|
15
|
-
return () => {
|
|
16
|
-
targetElement == null ? void 0 : targetElement.removeChild(container);
|
|
17
|
-
};
|
|
18
|
-
}, [container, target]);
|
|
19
|
-
return createPortal(children, container);
|
|
20
|
-
};
|
|
21
|
-
export {
|
|
22
|
-
Portal
|
|
23
|
-
};
|
|
24
|
-
//# sourceMappingURL=index.mjs.map
|
package/dist/node/index.mjs.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/components/Portal/Portal.tsx"],"sourcesContent":["import { useEffect, useState } from 'react'\nimport { createPortal } from 'react-dom'\n\nimport { PortalProps } from './PortalProps'\n\nexport const Portal: React.FC<PortalProps> = ({ children, className, el = 'div', target = 'body' }: PortalProps) => {\n const [container] = useState(document.createElement(el))\n if (className) {\n container.classList.add(className)\n }\n useEffect(() => {\n const targetElement = document.querySelector(target)\n if (!targetElement) {\n console.warn(`Unable to find target element: ${target}`)\n }\n targetElement?.appendChild(container)\n return () => {\n targetElement?.removeChild(container)\n }\n }, [container, target])\n\n return createPortal(children, container)\n}\n"],"mappings":";AAAA,SAAS,WAAW,gBAAgB;AACpC,SAAS,oBAAoB;AAItB,IAAM,SAAgC,CAAC,EAAE,UAAU,WAAW,KAAK,OAAO,SAAS,OAAO,MAAmB;AAClH,QAAM,CAAC,SAAS,IAAI,SAAS,SAAS,cAAc,EAAE,CAAC;AACvD,MAAI,WAAW;AACb,cAAU,UAAU,IAAI,SAAS;AAAA,EACnC;AACA,YAAU,MAAM;AACd,UAAM,gBAAgB,SAAS,cAAc,MAAM;AACnD,QAAI,CAAC,eAAe;AAClB,cAAQ,KAAK,kCAAkC,MAAM,EAAE;AAAA,IACzD;AACA,mDAAe,YAAY;AAC3B,WAAO,MAAM;AACX,qDAAe,YAAY;AAAA,IAC7B;AAAA,EACF,GAAG,CAAC,WAAW,MAAM,CAAC;AAEtB,SAAO,aAAa,UAAU,SAAS;AACzC;","names":[]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
//# sourceMappingURL=images.d.mjs.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":[],"sourcesContent":[],"mappings":"","names":[]}
|
|
File without changes
|