@xylabs/react-portal 2.19.1 → 3.0.2

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.
Files changed (96) hide show
  1. package/dist/browser/components/Portal/Portal.d.ts +3 -0
  2. package/dist/browser/components/Portal/Portal.d.ts.map +1 -0
  3. package/dist/browser/components/Portal/Portal.js +23 -0
  4. package/dist/browser/components/Portal/Portal.js.map +1 -0
  5. package/dist/browser/components/Portal/PortalProps.d.ts +7 -0
  6. package/dist/browser/components/Portal/PortalProps.d.ts.map +1 -0
  7. package/dist/browser/components/Portal/PortalProps.js +1 -0
  8. package/dist/browser/components/Portal/PortalProps.js.map +1 -0
  9. package/dist/{esm/components/Portal/index.js → browser/components/Portal/index.d.ts} +1 -1
  10. package/dist/browser/components/Portal/index.d.ts.map +1 -0
  11. package/dist/browser/components/Portal/index.js +3 -0
  12. package/dist/browser/components/Portal/index.js.map +1 -0
  13. package/dist/browser/components/index.d.ts +2 -0
  14. package/dist/browser/components/index.d.ts.map +1 -0
  15. package/dist/browser/components/index.js +2 -0
  16. package/dist/browser/components/index.js.map +1 -0
  17. package/dist/browser/index.d.ts +2 -0
  18. package/dist/browser/index.d.ts.map +1 -0
  19. package/dist/browser/index.js +2 -0
  20. package/dist/browser/index.js.map +1 -0
  21. package/dist/browser/types/images.d.js +1 -0
  22. package/dist/browser/types/images.d.js.map +1 -0
  23. package/dist/node/components/Portal/Portal.d.mts +3 -0
  24. package/dist/node/components/Portal/Portal.d.mts.map +1 -0
  25. package/dist/node/components/Portal/Portal.d.ts +3 -0
  26. package/dist/node/components/Portal/Portal.d.ts.map +1 -0
  27. package/dist/node/components/Portal/Portal.js +47 -0
  28. package/dist/node/components/Portal/Portal.js.map +1 -0
  29. package/dist/node/components/Portal/Portal.mjs +23 -0
  30. package/dist/node/components/Portal/Portal.mjs.map +1 -0
  31. package/dist/node/components/Portal/PortalProps.d.mts +7 -0
  32. package/dist/node/components/Portal/PortalProps.d.mts.map +1 -0
  33. package/dist/node/components/Portal/PortalProps.d.ts +7 -0
  34. package/dist/node/components/Portal/PortalProps.d.ts.map +1 -0
  35. package/dist/node/components/Portal/PortalProps.js +17 -0
  36. package/dist/node/components/Portal/PortalProps.js.map +1 -0
  37. package/dist/node/components/Portal/PortalProps.mjs +1 -0
  38. package/dist/node/components/Portal/PortalProps.mjs.map +1 -0
  39. package/dist/node/components/Portal/index.d.mts +3 -0
  40. package/dist/node/components/Portal/index.d.mts.map +1 -0
  41. package/dist/node/components/Portal/index.d.ts +3 -0
  42. package/dist/node/components/Portal/index.d.ts.map +1 -0
  43. package/dist/node/components/Portal/index.js +25 -0
  44. package/dist/node/components/Portal/index.js.map +1 -0
  45. package/dist/node/components/Portal/index.mjs +3 -0
  46. package/dist/node/components/Portal/index.mjs.map +1 -0
  47. package/dist/node/components/index.d.mts +2 -0
  48. package/dist/node/components/index.d.mts.map +1 -0
  49. package/dist/node/components/index.d.ts +2 -0
  50. package/dist/node/components/index.d.ts.map +1 -0
  51. package/dist/node/components/index.js +23 -0
  52. package/dist/node/components/index.js.map +1 -0
  53. package/dist/node/components/index.mjs +2 -0
  54. package/dist/node/components/index.mjs.map +1 -0
  55. package/dist/node/index.d.mts +2 -0
  56. package/dist/node/index.d.mts.map +1 -0
  57. package/dist/node/index.d.ts +2 -0
  58. package/dist/node/index.d.ts.map +1 -0
  59. package/dist/node/index.js +23 -0
  60. package/dist/node/index.js.map +1 -0
  61. package/dist/node/index.mjs +2 -0
  62. package/dist/node/index.mjs.map +1 -0
  63. package/dist/node/types/images.d.js +2 -0
  64. package/dist/node/types/images.d.js.map +1 -0
  65. package/dist/node/types/images.d.mjs +1 -0
  66. package/dist/node/types/images.d.mjs.map +1 -0
  67. package/package.json +17 -13
  68. package/dist/cjs/components/Portal/Portal.js +0 -24
  69. package/dist/cjs/components/Portal/Portal.js.map +0 -1
  70. package/dist/cjs/components/Portal/PortalProps.js +0 -3
  71. package/dist/cjs/components/Portal/PortalProps.js.map +0 -1
  72. package/dist/cjs/components/Portal/index.js +0 -6
  73. package/dist/cjs/components/Portal/index.js.map +0 -1
  74. package/dist/cjs/components/index.js +0 -5
  75. package/dist/cjs/components/index.js.map +0 -1
  76. package/dist/cjs/index.js +0 -5
  77. package/dist/cjs/index.js.map +0 -1
  78. package/dist/esm/components/Portal/Portal.js +0 -20
  79. package/dist/esm/components/Portal/Portal.js.map +0 -1
  80. package/dist/esm/components/Portal/PortalProps.js +0 -2
  81. package/dist/esm/components/Portal/PortalProps.js.map +0 -1
  82. package/dist/esm/components/Portal/index.js.map +0 -1
  83. package/dist/esm/components/index.js +0 -2
  84. package/dist/esm/components/index.js.map +0 -1
  85. package/dist/esm/index.js +0 -2
  86. package/dist/esm/index.js.map +0 -1
  87. /package/dist/{types/components/Portal/Portal.d.ts → browser/components/Portal/Portal.d.mts} +0 -0
  88. /package/dist/{types/components/Portal/Portal.d.ts.map → browser/components/Portal/Portal.d.mts.map} +0 -0
  89. /package/dist/{types/components/Portal/PortalProps.d.ts → browser/components/Portal/PortalProps.d.mts} +0 -0
  90. /package/dist/{types/components/Portal/PortalProps.d.ts.map → browser/components/Portal/PortalProps.d.mts.map} +0 -0
  91. /package/dist/{types/components/Portal/index.d.ts → browser/components/Portal/index.d.mts} +0 -0
  92. /package/dist/{types/components/Portal/index.d.ts.map → browser/components/Portal/index.d.mts.map} +0 -0
  93. /package/dist/{types/components/index.d.ts → browser/components/index.d.mts} +0 -0
  94. /package/dist/{types/components/index.d.ts.map → browser/components/index.d.mts.map} +0 -0
  95. /package/dist/{types/index.d.ts → browser/index.d.mts} +0 -0
  96. /package/dist/{types/index.d.ts.map → browser/index.d.mts.map} +0 -0
@@ -0,0 +1,3 @@
1
+ import { PortalProps } from './PortalProps';
2
+ export declare const Portal: React.FC<PortalProps>;
3
+ //# sourceMappingURL=Portal.d.ts.map
@@ -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"}
@@ -0,0 +1,23 @@
1
+ import { useEffect, useState } from "react";
2
+ import { createPortal } from "react-dom";
3
+ const Portal = ({ children, className, el = "div", target = "body" }) => {
4
+ const [container] = useState(document.createElement(el));
5
+ if (className) {
6
+ container.classList.add(className);
7
+ }
8
+ useEffect(() => {
9
+ const targetElement = document.querySelector(target);
10
+ if (!targetElement) {
11
+ console.warn(`Unable to find target element: ${target}`);
12
+ }
13
+ targetElement?.appendChild(container);
14
+ return () => {
15
+ targetElement?.removeChild(container);
16
+ };
17
+ }, [container, target]);
18
+ return createPortal(children, container);
19
+ };
20
+ export {
21
+ Portal
22
+ };
23
+ //# sourceMappingURL=Portal.js.map
@@ -0,0 +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,SAAS,WAAW,gBAAgB;AACpC,SAAS,oBAAoB;AAItB,MAAM,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":[]}
@@ -0,0 +1,7 @@
1
+ export interface PortalProps {
2
+ children: React.ReactNode;
3
+ className?: string;
4
+ el?: string;
5
+ target?: string;
6
+ }
7
+ //# sourceMappingURL=PortalProps.d.ts.map
@@ -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"}
@@ -0,0 +1 @@
1
+ //# sourceMappingURL=PortalProps.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":[],"sourcesContent":[],"mappings":"","names":[]}
@@ -1,3 +1,3 @@
1
1
  export * from './Portal';
2
2
  export * from './PortalProps';
3
- //# sourceMappingURL=index.js.map
3
+ //# sourceMappingURL=index.d.ts.map
@@ -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"}
@@ -0,0 +1,3 @@
1
+ export * from "./Portal";
2
+ export * from "./PortalProps";
3
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../../../src/components/Portal/index.ts"],"sourcesContent":["export * from './Portal'\nexport * from './PortalProps'\n"],"mappings":"AAAA,cAAc;AACd,cAAc;","names":[]}
@@ -0,0 +1,2 @@
1
+ export * from './Portal';
2
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/index.ts"],"names":[],"mappings":"AAAA,cAAc,UAAU,CAAA"}
@@ -0,0 +1,2 @@
1
+ export * from "./Portal";
2
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../../src/components/index.ts"],"sourcesContent":["export * from './Portal'\n"],"mappings":"AAAA,cAAc;","names":[]}
@@ -0,0 +1,2 @@
1
+ export * from './components';
2
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,cAAc,CAAA"}
@@ -0,0 +1,2 @@
1
+ export * from "./components";
2
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../src/index.ts"],"sourcesContent":["export * from './components'\n"],"mappings":"AAAA,cAAc;","names":[]}
@@ -0,0 +1 @@
1
+ //# sourceMappingURL=images.d.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":[],"sourcesContent":[],"mappings":"","names":[]}
@@ -0,0 +1,3 @@
1
+ import { PortalProps } from './PortalProps';
2
+ export declare const Portal: React.FC<PortalProps>;
3
+ //# sourceMappingURL=Portal.d.ts.map
@@ -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"}
@@ -0,0 +1,3 @@
1
+ import { PortalProps } from './PortalProps';
2
+ export declare const Portal: React.FC<PortalProps>;
3
+ //# sourceMappingURL=Portal.d.ts.map
@@ -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"}
@@ -0,0 +1,47 @@
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
+ var Portal_exports = {};
20
+ __export(Portal_exports, {
21
+ Portal: () => Portal
22
+ });
23
+ module.exports = __toCommonJS(Portal_exports);
24
+ var import_react = require("react");
25
+ var import_react_dom = require("react-dom");
26
+ const Portal = ({ children, className, el = "div", target = "body" }) => {
27
+ const [container] = (0, import_react.useState)(document.createElement(el));
28
+ if (className) {
29
+ container.classList.add(className);
30
+ }
31
+ (0, import_react.useEffect)(() => {
32
+ const targetElement = document.querySelector(target);
33
+ if (!targetElement) {
34
+ console.warn(`Unable to find target element: ${target}`);
35
+ }
36
+ targetElement?.appendChild(container);
37
+ return () => {
38
+ targetElement?.removeChild(container);
39
+ };
40
+ }, [container, target]);
41
+ return (0, import_react_dom.createPortal)(children, container);
42
+ };
43
+ // Annotate the CommonJS export names for ESM import in node:
44
+ 0 && (module.exports = {
45
+ Portal
46
+ });
47
+ //# sourceMappingURL=Portal.js.map
@@ -0,0 +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;AAAA;AAAA;AAAA;AAAA;AAAA,mBAAoC;AACpC,uBAA6B;AAItB,MAAM,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,23 @@
1
+ import { useEffect, useState } from "react";
2
+ import { createPortal } from "react-dom";
3
+ const Portal = ({ children, className, el = "div", target = "body" }) => {
4
+ const [container] = useState(document.createElement(el));
5
+ if (className) {
6
+ container.classList.add(className);
7
+ }
8
+ useEffect(() => {
9
+ const targetElement = document.querySelector(target);
10
+ if (!targetElement) {
11
+ console.warn(`Unable to find target element: ${target}`);
12
+ }
13
+ targetElement?.appendChild(container);
14
+ return () => {
15
+ targetElement?.removeChild(container);
16
+ };
17
+ }, [container, target]);
18
+ return createPortal(children, container);
19
+ };
20
+ export {
21
+ Portal
22
+ };
23
+ //# sourceMappingURL=Portal.mjs.map
@@ -0,0 +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,SAAS,WAAW,gBAAgB;AACpC,SAAS,oBAAoB;AAItB,MAAM,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":[]}
@@ -0,0 +1,7 @@
1
+ export interface PortalProps {
2
+ children: React.ReactNode;
3
+ className?: string;
4
+ el?: string;
5
+ target?: string;
6
+ }
7
+ //# sourceMappingURL=PortalProps.d.ts.map
@@ -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"}
@@ -0,0 +1,7 @@
1
+ export interface PortalProps {
2
+ children: React.ReactNode;
3
+ className?: string;
4
+ el?: string;
5
+ target?: string;
6
+ }
7
+ //# sourceMappingURL=PortalProps.d.ts.map
@@ -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"}
@@ -0,0 +1,17 @@
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
+ var PortalProps_exports = {};
16
+ module.exports = __toCommonJS(PortalProps_exports);
17
+ //# sourceMappingURL=PortalProps.js.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
+ //# sourceMappingURL=PortalProps.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":[],"sourcesContent":[],"mappings":"","names":[]}
@@ -0,0 +1,3 @@
1
+ export * from './Portal';
2
+ export * from './PortalProps';
3
+ //# sourceMappingURL=index.d.ts.map
@@ -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"}
@@ -0,0 +1,3 @@
1
+ export * from './Portal';
2
+ export * from './PortalProps';
3
+ //# sourceMappingURL=index.d.ts.map
@@ -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"}
@@ -0,0 +1,25 @@
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 __reExport = (target, mod, secondTarget) => (__copyProps(target, mod, "default"), secondTarget && __copyProps(secondTarget, mod, "default"));
15
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
16
+ var Portal_exports = {};
17
+ module.exports = __toCommonJS(Portal_exports);
18
+ __reExport(Portal_exports, require("./Portal"), module.exports);
19
+ __reExport(Portal_exports, require("./PortalProps"), module.exports);
20
+ // Annotate the CommonJS export names for ESM import in node:
21
+ 0 && (module.exports = {
22
+ ...require("./Portal"),
23
+ ...require("./PortalProps")
24
+ });
25
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../../../src/components/Portal/index.ts"],"sourcesContent":["export * from './Portal'\nexport * from './PortalProps'\n"],"mappings":";;;;;;;;;;;;;;;AAAA;AAAA;AAAA,2BAAc,qBAAd;AACA,2BAAc,0BADd;","names":[]}
@@ -0,0 +1,3 @@
1
+ export * from "./Portal";
2
+ export * from "./PortalProps";
3
+ //# sourceMappingURL=index.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../../../src/components/Portal/index.ts"],"sourcesContent":["export * from './Portal'\nexport * from './PortalProps'\n"],"mappings":"AAAA,cAAc;AACd,cAAc;","names":[]}
@@ -0,0 +1,2 @@
1
+ export * from './Portal';
2
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/index.ts"],"names":[],"mappings":"AAAA,cAAc,UAAU,CAAA"}
@@ -0,0 +1,2 @@
1
+ export * from './Portal';
2
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/index.ts"],"names":[],"mappings":"AAAA,cAAc,UAAU,CAAA"}
@@ -0,0 +1,23 @@
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 __reExport = (target, mod, secondTarget) => (__copyProps(target, mod, "default"), secondTarget && __copyProps(secondTarget, mod, "default"));
15
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
16
+ var components_exports = {};
17
+ module.exports = __toCommonJS(components_exports);
18
+ __reExport(components_exports, require("./Portal"), module.exports);
19
+ // Annotate the CommonJS export names for ESM import in node:
20
+ 0 && (module.exports = {
21
+ ...require("./Portal")
22
+ });
23
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../../src/components/index.ts"],"sourcesContent":["export * from './Portal'\n"],"mappings":";;;;;;;;;;;;;;;AAAA;AAAA;AAAA,+BAAc,qBAAd;","names":[]}
@@ -0,0 +1,2 @@
1
+ export * from "./Portal";
2
+ //# sourceMappingURL=index.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../../src/components/index.ts"],"sourcesContent":["export * from './Portal'\n"],"mappings":"AAAA,cAAc;","names":[]}
@@ -0,0 +1,2 @@
1
+ export * from './components';
2
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,cAAc,CAAA"}
@@ -0,0 +1,2 @@
1
+ export * from './components';
2
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,cAAc,CAAA"}
@@ -0,0 +1,23 @@
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 __reExport = (target, mod, secondTarget) => (__copyProps(target, mod, "default"), secondTarget && __copyProps(secondTarget, mod, "default"));
15
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
16
+ var src_exports = {};
17
+ module.exports = __toCommonJS(src_exports);
18
+ __reExport(src_exports, require("./components"), module.exports);
19
+ // Annotate the CommonJS export names for ESM import in node:
20
+ 0 && (module.exports = {
21
+ ...require("./components")
22
+ });
23
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../src/index.ts"],"sourcesContent":["export * from './components'\n"],"mappings":";;;;;;;;;;;;;;;AAAA;AAAA;AAAA,wBAAc,yBAAd;","names":[]}
@@ -0,0 +1,2 @@
1
+ export * from "./components";
2
+ //# sourceMappingURL=index.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../src/index.ts"],"sourcesContent":["export * from './components'\n"],"mappings":"AAAA,cAAc;","names":[]}
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ //# sourceMappingURL=images.d.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":[],"sourcesContent":[],"mappings":"","names":[]}
@@ -0,0 +1 @@
1
+ //# sourceMappingURL=images.d.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":[],"sourcesContent":[],"mappings":"","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.7",
18
- "@xylabs/ts-scripts-yarn3": "^2.19.12",
19
- "@xylabs/tsconfig-react": "^2.19.12",
18
+ "@xylabs/ts-scripts-yarn3": "^3.0.67",
19
+ "@xylabs/tsconfig-react": "^3.0.67",
20
20
  "react": "^18.2.0",
21
21
  "react-dom": "^18.2.0",
22
22
  "typescript": "^5.2.2"
@@ -25,27 +25,32 @@
25
25
  "react": "^18",
26
26
  "react-dom": "^18"
27
27
  },
28
- "browser": "dist/esm/index.js",
29
- "docs": "dist/docs.json",
30
28
  "exports": {
31
29
  ".": {
32
30
  "node": {
33
- "import": "./dist/esm/index.js",
34
- "require": "./dist/cjs/index.js"
31
+ "import": {
32
+ "types": "./dist/node/index.d.mts",
33
+ "default": "./dist/node/index.mjs"
34
+ },
35
+ "require": {
36
+ "types": "./dist/node/index.d.ts",
37
+ "default": "./dist/node/index.js"
38
+ }
35
39
  },
36
40
  "browser": {
37
- "import": "./dist/esm/index.js",
38
- "require": "./dist/cjs/index.js"
41
+ "types": "./dist/browser/index.d.ts",
42
+ "default": "./dist/browser/index.js"
39
43
  },
40
- "default": "./dist/esm/index.js"
44
+ "default": "./dist/browser/index.js"
41
45
  },
42
46
  "./dist/docs.json": {
43
47
  "default": "./dist/docs.json"
44
48
  },
45
49
  "./package.json": "./package.json"
46
50
  },
47
- "main": "dist/cjs/index.js",
48
- "module": "dist/esm/index.js",
51
+ "types": "dist/browser/index.d.ts",
52
+ "main": "./dist/node/index.js",
53
+ "module": "./dist/browser/index.js",
49
54
  "homepage": "https://xylabs.com",
50
55
  "keywords": [
51
56
  "utility",
@@ -61,6 +66,5 @@
61
66
  "url": "https://github.com/xylabs/sdk-react.git"
62
67
  },
63
68
  "sideEffects": false,
64
- "types": "dist/types/index.d.ts",
65
- "version": "2.19.1"
69
+ "version": "3.0.2"
66
70
  }
@@ -1,24 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.Portal = void 0;
4
- const react_1 = require("react");
5
- const react_dom_1 = require("react-dom");
6
- const Portal = ({ children, className, el = 'div', target = 'body' }) => {
7
- const [container] = (0, react_1.useState)(document.createElement(el));
8
- if (className) {
9
- container.classList.add(className);
10
- }
11
- (0, react_1.useEffect)(() => {
12
- const targetElement = document.querySelector(target);
13
- if (!targetElement) {
14
- console.warn(`Unable to find target element: ${target}`);
15
- }
16
- targetElement === null || targetElement === void 0 ? void 0 : targetElement.appendChild(container);
17
- return () => {
18
- targetElement === null || targetElement === void 0 ? void 0 : targetElement.removeChild(container);
19
- };
20
- }, [container, target]);
21
- return (0, react_dom_1.createPortal)(children, container);
22
- };
23
- exports.Portal = Portal;
24
- //# sourceMappingURL=Portal.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"Portal.js","sourceRoot":"","sources":["../../../../src/components/Portal/Portal.tsx"],"names":[],"mappings":";;;AAAA,iCAA2C;AAC3C,yCAAwC;AAIjC,MAAM,MAAM,GAA0B,CAAC,EAAE,QAAQ,EAAE,SAAS,EAAE,EAAE,GAAG,KAAK,EAAE,MAAM,GAAG,MAAM,EAAe,EAAE,EAAE;IACjH,MAAM,CAAC,SAAS,CAAC,GAAG,IAAA,gBAAQ,EAAC,QAAQ,CAAC,aAAa,CAAC,EAAE,CAAC,CAAC,CAAA;IACxD,IAAI,SAAS,EAAE;QACb,SAAS,CAAC,SAAS,CAAC,GAAG,CAAC,SAAS,CAAC,CAAA;KACnC;IACD,IAAA,iBAAS,EAAC,GAAG,EAAE;QACb,MAAM,aAAa,GAAG,QAAQ,CAAC,aAAa,CAAC,MAAM,CAAC,CAAA;QACpD,IAAI,CAAC,aAAa,EAAE;YAClB,OAAO,CAAC,IAAI,CAAC,kCAAkC,MAAM,EAAE,CAAC,CAAA;SACzD;QACD,aAAa,aAAb,aAAa,uBAAb,aAAa,CAAE,WAAW,CAAC,SAAS,CAAC,CAAA;QACrC,OAAO,GAAG,EAAE;YACV,aAAa,aAAb,aAAa,uBAAb,aAAa,CAAE,WAAW,CAAC,SAAS,CAAC,CAAA;QACvC,CAAC,CAAA;IACH,CAAC,EAAE,CAAC,SAAS,EAAE,MAAM,CAAC,CAAC,CAAA;IAEvB,OAAO,IAAA,wBAAY,EAAC,QAAQ,EAAE,SAAS,CAAC,CAAA;AAC1C,CAAC,CAAA;AAjBY,QAAA,MAAM,UAiBlB"}
@@ -1,3 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- //# sourceMappingURL=PortalProps.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"PortalProps.js","sourceRoot":"","sources":["../../../../src/components/Portal/PortalProps.ts"],"names":[],"mappings":""}
@@ -1,6 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- const tslib_1 = require("tslib");
4
- tslib_1.__exportStar(require("./Portal"), exports);
5
- tslib_1.__exportStar(require("./PortalProps"), exports);
6
- //# sourceMappingURL=index.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/components/Portal/index.ts"],"names":[],"mappings":";;;AAAA,mDAAwB;AACxB,wDAA6B"}
@@ -1,5 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- const tslib_1 = require("tslib");
4
- tslib_1.__exportStar(require("./Portal"), exports);
5
- //# sourceMappingURL=index.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/components/index.ts"],"names":[],"mappings":";;;AAAA,mDAAwB"}
package/dist/cjs/index.js DELETED
@@ -1,5 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- const tslib_1 = require("tslib");
4
- tslib_1.__exportStar(require("./components"), exports);
5
- //# sourceMappingURL=index.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":";;;AAAA,uDAA4B"}
@@ -1,20 +0,0 @@
1
- import { useEffect, useState } from 'react';
2
- import { createPortal } from 'react-dom';
3
- export const Portal = ({ children, className, el = 'div', target = 'body' }) => {
4
- const [container] = useState(document.createElement(el));
5
- if (className) {
6
- container.classList.add(className);
7
- }
8
- useEffect(() => {
9
- const targetElement = document.querySelector(target);
10
- if (!targetElement) {
11
- console.warn(`Unable to find target element: ${target}`);
12
- }
13
- targetElement?.appendChild(container);
14
- return () => {
15
- targetElement?.removeChild(container);
16
- };
17
- }, [container, target]);
18
- return createPortal(children, container);
19
- };
20
- //# sourceMappingURL=Portal.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"Portal.js","sourceRoot":"","sources":["../../../../src/components/Portal/Portal.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAA;AAC3C,OAAO,EAAE,YAAY,EAAE,MAAM,WAAW,CAAA;AAIxC,MAAM,CAAC,MAAM,MAAM,GAA0B,CAAC,EAAE,QAAQ,EAAE,SAAS,EAAE,EAAE,GAAG,KAAK,EAAE,MAAM,GAAG,MAAM,EAAe,EAAE,EAAE;IACjH,MAAM,CAAC,SAAS,CAAC,GAAG,QAAQ,CAAC,QAAQ,CAAC,aAAa,CAAC,EAAE,CAAC,CAAC,CAAA;IACxD,IAAI,SAAS,EAAE;QACb,SAAS,CAAC,SAAS,CAAC,GAAG,CAAC,SAAS,CAAC,CAAA;KACnC;IACD,SAAS,CAAC,GAAG,EAAE;QACb,MAAM,aAAa,GAAG,QAAQ,CAAC,aAAa,CAAC,MAAM,CAAC,CAAA;QACpD,IAAI,CAAC,aAAa,EAAE;YAClB,OAAO,CAAC,IAAI,CAAC,kCAAkC,MAAM,EAAE,CAAC,CAAA;SACzD;QACD,aAAa,EAAE,WAAW,CAAC,SAAS,CAAC,CAAA;QACrC,OAAO,GAAG,EAAE;YACV,aAAa,EAAE,WAAW,CAAC,SAAS,CAAC,CAAA;QACvC,CAAC,CAAA;IACH,CAAC,EAAE,CAAC,SAAS,EAAE,MAAM,CAAC,CAAC,CAAA;IAEvB,OAAO,YAAY,CAAC,QAAQ,EAAE,SAAS,CAAC,CAAA;AAC1C,CAAC,CAAA"}
@@ -1,2 +0,0 @@
1
- export {};
2
- //# sourceMappingURL=PortalProps.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"PortalProps.js","sourceRoot":"","sources":["../../../../src/components/Portal/PortalProps.ts"],"names":[],"mappings":""}
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/components/Portal/index.ts"],"names":[],"mappings":"AAAA,cAAc,UAAU,CAAA;AACxB,cAAc,eAAe,CAAA"}
@@ -1,2 +0,0 @@
1
- export * from './Portal';
2
- //# sourceMappingURL=index.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/components/index.ts"],"names":[],"mappings":"AAAA,cAAc,UAAU,CAAA"}
package/dist/esm/index.js DELETED
@@ -1,2 +0,0 @@
1
- export * from './components';
2
- //# sourceMappingURL=index.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,cAAc,CAAA"}
File without changes