@xylabs/react-portal 6.3.13 → 6.4.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/browser/index.d.ts +2 -11
- package/dist/browser/index.mjs +10 -9
- package/dist/browser/index.mjs.map +1 -1
- package/package.json +6 -6
package/dist/browser/index.d.ts
CHANGED
|
@@ -1,11 +1,2 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
className?: string;
|
|
4
|
-
el?: string;
|
|
5
|
-
target?: string;
|
|
6
|
-
}
|
|
7
|
-
|
|
8
|
-
declare const Portal: React.FC<PortalProps>;
|
|
9
|
-
|
|
10
|
-
export { Portal };
|
|
11
|
-
export type { PortalProps };
|
|
1
|
+
export * from './components/index.ts';
|
|
2
|
+
//# sourceMappingURL=index.d.ts.map
|
package/dist/browser/index.mjs
CHANGED
|
@@ -1,12 +1,10 @@
|
|
|
1
|
+
var __defProp = Object.defineProperty;
|
|
2
|
+
var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
|
|
3
|
+
|
|
1
4
|
// src/components/Portal/Portal.tsx
|
|
2
5
|
import { useEffect, useState } from "react";
|
|
3
6
|
import { createPortal } from "react-dom";
|
|
4
|
-
var Portal = ({
|
|
5
|
-
children,
|
|
6
|
-
className,
|
|
7
|
-
el = "div",
|
|
8
|
-
target = "body"
|
|
9
|
-
}) => {
|
|
7
|
+
var Portal = /* @__PURE__ */ __name(({ children, className, el = "div", target = "body" }) => {
|
|
10
8
|
const [container] = useState(document.createElement(el));
|
|
11
9
|
if (className) {
|
|
12
10
|
container.classList.add(className);
|
|
@@ -20,9 +18,12 @@ var Portal = ({
|
|
|
20
18
|
return () => {
|
|
21
19
|
container.remove();
|
|
22
20
|
};
|
|
23
|
-
}, [
|
|
24
|
-
|
|
25
|
-
|
|
21
|
+
}, [
|
|
22
|
+
container,
|
|
23
|
+
target
|
|
24
|
+
]);
|
|
25
|
+
return /* @__PURE__ */ createPortal(children, container);
|
|
26
|
+
}, "Portal");
|
|
26
27
|
export {
|
|
27
28
|
Portal
|
|
28
29
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/components/Portal/Portal.tsx"],"sourcesContent":["import { useEffect, useState } from 'react'\nimport { createPortal } from 'react-dom'\n\nimport type { PortalProps } from './PortalProps.ts'\n\nexport const Portal: React.FC<PortalProps> = ({\n children, className, el = 'div', target = 'body',\n}: 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?.append(container)\n return () => {\n container.remove()\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 type { PortalProps } from './PortalProps.ts'\n\nexport const Portal: React.FC<PortalProps> = ({\n children, className, el = 'div', target = 'body',\n}: 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?.append(container)\n return () => {\n container.remove()\n }\n }, [container, target])\n\n return createPortal(children, container)\n}\n"],"mappings":";;;;AAAA,SAASA,WAAWC,gBAAgB;AACpC,SAASC,oBAAoB;AAItB,IAAMC,SAAgC,wBAAC,EAC5CC,UAAUC,WAAWC,KAAK,OAAOC,SAAS,OAAM,MACpC;AACZ,QAAM,CAACC,SAAAA,IAAaC,SAASC,SAASC,cAAcL,EAAAA,CAAAA;AACpD,MAAID,WAAW;AACbG,cAAUI,UAAUC,IAAIR,SAAAA;EAC1B;AACAS,YAAU,MAAA;AACR,UAAMC,gBAAgBL,SAASM,cAAcT,MAAAA;AAC7C,QAAI,CAACQ,eAAe;AAClBE,cAAQC,KAAK,kCAAkCX,MAAAA,EAAQ;IACzD;AACAQ,mBAAeI,OAAOX,SAAAA;AACtB,WAAO,MAAA;AACLA,gBAAUY,OAAM;IAClB;EACF,GAAG;IAACZ;IAAWD;GAAO;AAEtB,SAAOc,6BAAajB,UAAUI,SAAAA;AAChC,GAnB6C;","names":["useEffect","useState","createPortal","Portal","children","className","el","target","container","useState","document","createElement","classList","add","useEffect","targetElement","querySelector","console","warn","append","remove","createPortal"]}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@xylabs/react-portal",
|
|
3
|
-
"version": "6.
|
|
3
|
+
"version": "6.4.0",
|
|
4
4
|
"description": "Common React library for all XY Labs projects that use React",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"utility",
|
|
@@ -39,11 +39,11 @@
|
|
|
39
39
|
"devDependencies": {
|
|
40
40
|
"@types/react": "^19.1.8",
|
|
41
41
|
"@types/react-dom": "^19.1.6",
|
|
42
|
-
"@xylabs/ts-scripts-yarn3": "^7.0.
|
|
43
|
-
"@xylabs/tsconfig-react": "^7.0.
|
|
44
|
-
"knip": "^5.
|
|
45
|
-
"react": "^19.1.
|
|
46
|
-
"react-dom": "^19.1.
|
|
42
|
+
"@xylabs/ts-scripts-yarn3": "^7.0.1",
|
|
43
|
+
"@xylabs/tsconfig-react": "^7.0.1",
|
|
44
|
+
"knip": "^5.62.0",
|
|
45
|
+
"react": "^19.1.1",
|
|
46
|
+
"react-dom": "^19.1.1",
|
|
47
47
|
"typescript": "^5.8.3"
|
|
48
48
|
},
|
|
49
49
|
"peerDependencies": {
|