@xylabs/react-portal 3.0.17 → 3.0.19
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 +20 -49
- package/package.json +4 -4
- package/dist/browser/components/Portal/Portal.cjs +0 -45
- package/dist/browser/components/Portal/Portal.cjs.map +0 -1
- package/dist/browser/components/Portal/Portal.js +0 -24
- package/dist/browser/components/Portal/Portal.js.map +0 -1
- package/dist/browser/components/Portal/PortalProps.cjs +0 -19
- package/dist/browser/components/Portal/PortalProps.cjs.map +0 -1
- package/dist/browser/components/Portal/PortalProps.js +0 -1
- package/dist/browser/components/Portal/PortalProps.js.map +0 -1
- package/dist/browser/components/Portal/index.cjs +0 -47
- package/dist/browser/components/Portal/index.cjs.map +0 -1
- package/dist/browser/components/Portal/index.js +0 -24
- package/dist/browser/components/Portal/index.js.map +0 -1
- package/dist/browser/components/index.cjs +0 -47
- package/dist/browser/components/index.cjs.map +0 -1
- package/dist/browser/components/index.js +0 -24
- package/dist/browser/components/index.js.map +0 -1
- package/dist/browser/types/images.d.cjs +0 -2
- package/dist/browser/types/images.d.cjs.map +0 -1
- package/dist/browser/types/images.d.js +0 -1
- package/dist/browser/types/images.d.js.map +0 -1
- package/dist/node/components/Portal/Portal.cjs +0 -49
- package/dist/node/components/Portal/Portal.cjs.map +0 -1
- package/dist/node/components/Portal/Portal.js +0 -24
- package/dist/node/components/Portal/Portal.js.map +0 -1
- package/dist/node/components/Portal/PortalProps.cjs +0 -19
- package/dist/node/components/Portal/PortalProps.cjs.map +0 -1
- package/dist/node/components/Portal/PortalProps.js +0 -1
- package/dist/node/components/Portal/PortalProps.js.map +0 -1
- package/dist/node/components/Portal/index.cjs +0 -51
- package/dist/node/components/Portal/index.cjs.map +0 -1
- package/dist/node/components/Portal/index.js +0 -24
- package/dist/node/components/Portal/index.js.map +0 -1
- package/dist/node/components/index.cjs +0 -51
- package/dist/node/components/index.cjs.map +0 -1
- package/dist/node/components/index.js +0 -24
- package/dist/node/components/index.js.map +0 -1
- package/dist/node/types/images.d.cjs +0 -2
- package/dist/node/types/images.d.cjs.map +0 -1
- package/dist/node/types/images.d.js +0 -1
- package/dist/node/types/images.d.js.map +0 -1
package/README.md
CHANGED
|
@@ -1,14 +1,11 @@
|
|
|
1
1
|
[![logo][]](https://xylabs.com)
|
|
2
2
|
|
|
3
|
-
# @xylabs/
|
|
3
|
+
# @xylabs/react-portal
|
|
4
4
|
|
|
5
|
-
[![main-build][]][main-build-link]
|
|
6
|
-
[![beta-build][]][beta-build-link]
|
|
7
5
|
[![npm-badge][]][npm-link]
|
|
8
|
-
[![
|
|
9
|
-
[![
|
|
10
|
-
[![
|
|
11
|
-
[![snyk-badge][]][snyk-link]
|
|
6
|
+
[![npm-downloads-badge][]][npm-link]
|
|
7
|
+
[![jsdelivr-badge][]][jsdelivr-link]
|
|
8
|
+
[![npm-license-badge][]](LICENSE)
|
|
12
9
|
|
|
13
10
|
> XY Labs generalized React library
|
|
14
11
|
|
|
@@ -16,53 +13,39 @@
|
|
|
16
13
|
|
|
17
14
|
- [Description](#description)
|
|
18
15
|
- [Install](#install)
|
|
19
|
-
- [Scripts](#scripts)
|
|
20
16
|
- [Maintainers](#maintainers)
|
|
21
17
|
- [License](#license)
|
|
22
18
|
- [Credits](#credits)
|
|
23
19
|
|
|
24
20
|
## Description
|
|
25
21
|
|
|
26
|
-
Common React code that is used
|
|
22
|
+
Common React code that is used throughout XYO projects that use React.
|
|
27
23
|
|
|
28
24
|
## Install
|
|
29
25
|
|
|
30
26
|
Using npm:
|
|
31
27
|
|
|
32
28
|
```sh
|
|
33
|
-
npm i --save @xylabs/
|
|
29
|
+
npm i --save @xylabs/react-portal
|
|
34
30
|
```
|
|
35
31
|
|
|
36
32
|
Using yarn:
|
|
37
33
|
|
|
38
34
|
```sh
|
|
39
|
-
yarn add @xylabs/
|
|
35
|
+
yarn add @xylabs/react-portal
|
|
40
36
|
```
|
|
41
37
|
|
|
42
|
-
##
|
|
38
|
+
## Documentation
|
|
39
|
+
[Developer Reference](https://xylabs.github.io/sdk-react)
|
|
43
40
|
|
|
44
|
-
|
|
45
|
-
list of shared scripts. The below scripts are custom scripts for this repo.
|
|
46
|
-
|
|
47
|
-
### Build (Storybook)
|
|
48
|
-
|
|
49
|
-
Build the static Storybook site
|
|
50
|
-
|
|
51
|
-
```sh
|
|
52
|
-
yarn build-storybook
|
|
53
|
-
```
|
|
54
|
-
|
|
55
|
-
### Start
|
|
56
|
-
|
|
57
|
-
Starts the project in the browser for testing, with auto reload using Storybook
|
|
58
|
-
|
|
59
|
-
```sh
|
|
60
|
-
yarn start
|
|
61
|
-
```
|
|
41
|
+
[Storybook](https://xylabs.github.io/sdk-react/storybook)
|
|
62
42
|
|
|
63
43
|
## Maintainers
|
|
64
44
|
|
|
65
|
-
- [Arie Trouw](https://github.com/arietrouw) [arietrouw.com](https://arietrouw.com)
|
|
45
|
+
- [Arie Trouw](https://github.com/arietrouw) ([arietrouw.com](https://arietrouw.com))
|
|
46
|
+
- [Matt Jones](https://github.com/jonesmac)
|
|
47
|
+
- [Joel Carter](https://github.com/JoelBCarter)
|
|
48
|
+
- [Jordan Trouw](https://github.com/jordantrouw)
|
|
66
49
|
|
|
67
50
|
## License
|
|
68
51
|
|
|
@@ -74,23 +57,11 @@ See the [LICENSE](LICENSE) file for license details
|
|
|
74
57
|
|
|
75
58
|
[logo]: https://cdn.xy.company/img/brand/XYPersistentCompany_Logo_Icon_Colored.svg
|
|
76
59
|
|
|
77
|
-
[
|
|
78
|
-
[
|
|
79
|
-
|
|
80
|
-
[beta-build]: https://github.com/xylabs/sdk-react/actions/workflows/build-beta.yml/badge.svg
|
|
81
|
-
[beta-build-link]: https://github.com/xylabs/sdk-react/actions/workflows/build-beta.yml
|
|
82
|
-
|
|
83
|
-
[npm-badge]: https://img.shields.io/npm/v/@xylabs/sdk-react.svg
|
|
84
|
-
[npm-link]: https://www.npmjs.com/package/@xylabs/sdk-react
|
|
85
|
-
|
|
86
|
-
[bch-badge]: https://bettercodehub.com/edge/badge/xylabs/sdk-react?branch=main
|
|
87
|
-
[bch-link]: https://bettercodehub.com/results/xylabs/sdk-react
|
|
88
|
-
|
|
89
|
-
[codacy-badge]: https://app.codacy.com/project/badge/Grade/c2a69d4530ed4b7da6ddb070169dd339
|
|
90
|
-
[codacy-link]: https://www.codacy.com/gh/xylabs/sdk-react/dashboard?utm_source=github.com&utm_medium=referral&utm_content=xylabs/sdk-react&utm_campaign=Badge_Grade
|
|
60
|
+
[npm-badge]: https://img.shields.io/npm/v/@xylabs/react-portal.svg
|
|
61
|
+
[npm-link]: https://www.npmjs.com/package/@xylabs/react-portal
|
|
91
62
|
|
|
92
|
-
[
|
|
93
|
-
[
|
|
63
|
+
[npm-downloads-badge]: https://img.shields.io/npm/dw/@xylabs/react-portal
|
|
64
|
+
[npm-license-badge]: https://img.shields.io/npm/l/@xylabs/react-portal
|
|
94
65
|
|
|
95
|
-
[
|
|
96
|
-
[
|
|
66
|
+
[jsdelivr-badge]: https://data.jsdelivr.com/v1/package/npm/@xylabs/react-portal/badge
|
|
67
|
+
[jsdelivr-link]: https://www.jsdelivr.com/package/npm/@xylabs/react-portal
|
package/package.json
CHANGED
|
@@ -14,9 +14,9 @@
|
|
|
14
14
|
],
|
|
15
15
|
"description": "Common React library for all XY Labs projects that use React",
|
|
16
16
|
"devDependencies": {
|
|
17
|
-
"@types/react-dom": "^18.2.
|
|
18
|
-
"@xylabs/ts-scripts-yarn3": "^3.
|
|
19
|
-
"@xylabs/tsconfig-react": "^3.
|
|
17
|
+
"@types/react-dom": "^18.2.13",
|
|
18
|
+
"@xylabs/ts-scripts-yarn3": "^3.1.9",
|
|
19
|
+
"@xylabs/tsconfig-react": "^3.1.9",
|
|
20
20
|
"react": "^18.2.0",
|
|
21
21
|
"react-dom": "^18.2.0",
|
|
22
22
|
"typescript": "^5.2.2"
|
|
@@ -72,6 +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.19",
|
|
76
76
|
"type": "module"
|
|
77
77
|
}
|
|
@@ -1,45 +0,0 @@
|
|
|
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?.appendChild(container);
|
|
39
|
-
return () => {
|
|
40
|
-
targetElement?.removeChild(container);
|
|
41
|
-
};
|
|
42
|
-
}, [container, target]);
|
|
43
|
-
return (0, import_react_dom.createPortal)(children, container);
|
|
44
|
-
};
|
|
45
|
-
//# sourceMappingURL=Portal.cjs.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;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":[]}
|
|
@@ -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?.appendChild(container);
|
|
15
|
-
return () => {
|
|
16
|
-
targetElement?.removeChild(container);
|
|
17
|
-
};
|
|
18
|
-
}, [container, target]);
|
|
19
|
-
return createPortal(children, container);
|
|
20
|
-
};
|
|
21
|
-
export {
|
|
22
|
-
Portal
|
|
23
|
-
};
|
|
24
|
-
//# sourceMappingURL=Portal.js.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,mBAAe,YAAY,SAAS;AACpC,WAAO,MAAM;AACX,qBAAe,YAAY,SAAS;AAAA,IACtC;AAAA,EACF,GAAG,CAAC,WAAW,MAAM,CAAC;AAEtB,SAAO,aAAa,UAAU,SAAS;AACzC;","names":[]}
|
|
@@ -1,19 +0,0 @@
|
|
|
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
|
|
@@ -1 +0,0 @@
|
|
|
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":[]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
//# sourceMappingURL=PortalProps.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":[],"sourcesContent":[],"mappings":"","names":[]}
|
|
@@ -1,47 +0,0 @@
|
|
|
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?.appendChild(container);
|
|
41
|
-
return () => {
|
|
42
|
-
targetElement?.removeChild(container);
|
|
43
|
-
};
|
|
44
|
-
}, [container, target]);
|
|
45
|
-
return (0, import_react_dom.createPortal)(children, container);
|
|
46
|
-
};
|
|
47
|
-
//# sourceMappingURL=index.cjs.map
|
|
@@ -1 +0,0 @@
|
|
|
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":[]}
|
|
@@ -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?.appendChild(container);
|
|
15
|
-
return () => {
|
|
16
|
-
targetElement?.removeChild(container);
|
|
17
|
-
};
|
|
18
|
-
}, [container, target]);
|
|
19
|
-
return createPortal(children, container);
|
|
20
|
-
};
|
|
21
|
-
export {
|
|
22
|
-
Portal
|
|
23
|
-
};
|
|
24
|
-
//# sourceMappingURL=index.js.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,mBAAe,YAAY,SAAS;AACpC,WAAO,MAAM;AACX,qBAAe,YAAY,SAAS;AAAA,IACtC;AAAA,EACF,GAAG,CAAC,WAAW,MAAM,CAAC;AAEtB,SAAO,aAAa,UAAU,SAAS;AACzC;","names":[]}
|
|
@@ -1,47 +0,0 @@
|
|
|
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?.appendChild(container);
|
|
41
|
-
return () => {
|
|
42
|
-
targetElement?.removeChild(container);
|
|
43
|
-
};
|
|
44
|
-
}, [container, target]);
|
|
45
|
-
return (0, import_react_dom.createPortal)(children, container);
|
|
46
|
-
};
|
|
47
|
-
//# sourceMappingURL=index.cjs.map
|
|
@@ -1 +0,0 @@
|
|
|
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":[]}
|
|
@@ -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?.appendChild(container);
|
|
15
|
-
return () => {
|
|
16
|
-
targetElement?.removeChild(container);
|
|
17
|
-
};
|
|
18
|
-
}, [container, target]);
|
|
19
|
-
return createPortal(children, container);
|
|
20
|
-
};
|
|
21
|
-
export {
|
|
22
|
-
Portal
|
|
23
|
-
};
|
|
24
|
-
//# sourceMappingURL=index.js.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,mBAAe,YAAY,SAAS;AACpC,WAAO,MAAM;AACX,qBAAe,YAAY,SAAS;AAAA,IACtC;AAAA,EACF,GAAG,CAAC,WAAW,MAAM,CAAC;AAEtB,SAAO,aAAa,UAAU,SAAS;AACzC;","names":[]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":[],"sourcesContent":[],"mappings":"","names":[]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
//# sourceMappingURL=images.d.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":[],"sourcesContent":[],"mappings":"","names":[]}
|
|
@@ -1,49 +0,0 @@
|
|
|
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 +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;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":[]}
|
|
@@ -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.js.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,19 +0,0 @@
|
|
|
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
|
|
@@ -1 +0,0 @@
|
|
|
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":[]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
//# sourceMappingURL=PortalProps.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":[],"sourcesContent":[],"mappings":"","names":[]}
|
|
@@ -1,51 +0,0 @@
|
|
|
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
|
|
@@ -1 +0,0 @@
|
|
|
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":[]}
|
|
@@ -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.js.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,51 +0,0 @@
|
|
|
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 +0,0 @@
|
|
|
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":[]}
|
|
@@ -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.js.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
|
-
{"version":3,"sources":[],"sourcesContent":[],"mappings":"","names":[]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
//# sourceMappingURL=images.d.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":[],"sourcesContent":[],"mappings":"","names":[]}
|