@xylabs/react-portal 4.0.2 → 4.0.4

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.
@@ -0,0 +1,3 @@
1
+ import type { PortalProps } from './PortalProps.ts';
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,KAAK,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAA;AAEnD,eAAO,MAAM,MAAM,EAAE,KAAK,CAAC,EAAE,CAAC,WAAW,CAmBxC,CAAA"}
@@ -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,3 @@
1
+ export * from './Portal.tsx';
2
+ export * from './PortalProps.ts';
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,cAAc,CAAA;AAC5B,cAAc,kBAAkB,CAAA"}
@@ -0,0 +1,2 @@
1
+ export * from './Portal/index.ts';
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,mBAAmB,CAAA"}
@@ -1,10 +1,2 @@
1
- interface PortalProps {
2
- children: React.ReactNode;
3
- className?: string;
4
- el?: string;
5
- target?: string;
6
- }
7
-
8
- declare const Portal: React.FC<PortalProps>;
9
-
10
- export { Portal, type PortalProps };
1
+ export * from './components/index.ts';
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,uBAAuB,CAAA"}
@@ -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.ts'\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?.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,EAAEC,UAAUC,WAAWC,KAAK,OAAOC,SAAS,OAAM,MAAe;AAC7G,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,GAjB6C;","names":["useEffect","useState","createPortal","Portal","children","className","el","target","container","useState","document","createElement","classList","add","useEffect","targetElement","querySelector","console","warn","append","remove","createPortal"]}
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,23 +1,46 @@
1
1
  {
2
2
  "name": "@xylabs/react-portal",
3
+ "version": "4.0.4",
4
+ "description": "Common React library for all XY Labs projects that use React",
5
+ "keywords": [
6
+ "utility",
7
+ "typescript",
8
+ "react"
9
+ ],
10
+ "homepage": "https://xylabs.com",
11
+ "bugs": {
12
+ "url": "git+https://github.com/xylabs/sdk-react/issues",
13
+ "email": "support@xylabs.com"
14
+ },
15
+ "repository": {
16
+ "type": "git",
17
+ "url": "git+https://github.com/xylabs/sdk-react.git"
18
+ },
19
+ "license": "LGPL-3.0-only",
3
20
  "author": {
4
- "email": "support@xylabs.com",
5
21
  "name": "XY Labs Development Team",
22
+ "email": "support@xylabs.com",
6
23
  "url": "https://xylabs.com"
7
24
  },
8
- "bugs": {
9
- "email": "support@xylabs.com",
10
- "url": "https://github.com/xylabs/sdk-react/issues"
25
+ "sideEffects": false,
26
+ "type": "module",
27
+ "exports": {
28
+ ".": {
29
+ "types": "./dist/browser/index.d.ts",
30
+ "default": "./dist/browser/index.mjs"
31
+ },
32
+ "./package.json": "./package.json"
11
33
  },
34
+ "module": "./dist/browser/index.mjs",
35
+ "types": "dist/browser/index.d.ts",
12
36
  "workspaces": [
13
37
  "packages/*"
14
38
  ],
15
- "description": "Common React library for all XY Labs projects that use React",
16
39
  "devDependencies": {
17
- "@types/react": "^18.3.3",
40
+ "@types/react": "^18.3.4",
18
41
  "@types/react-dom": "^18.3.0",
19
- "@xylabs/ts-scripts-yarn3": "^4.0.0-rc.15",
20
- "@xylabs/tsconfig-react": "^4.0.0-rc.15",
42
+ "@xylabs/ts-scripts-yarn3": "^4.0.7",
43
+ "@xylabs/tsconfig-react": "^4.0.7",
21
44
  "react": "^18.3.1",
22
45
  "react-dom": "^18.3.1",
23
46
  "typescript": "^5.5.4"
@@ -26,30 +49,7 @@
26
49
  "react": "^18",
27
50
  "react-dom": "^18"
28
51
  },
29
- "exports": {
30
- ".": {
31
- "types": "./dist/browser/index.d.ts",
32
- "default": "./dist/browser/index.mjs"
33
- },
34
- "./package.json": "./package.json"
35
- },
36
- "types": "dist/browser/index.d.ts",
37
- "module": "./dist/browser/index.mjs",
38
- "homepage": "https://xylabs.com",
39
- "keywords": [
40
- "utility",
41
- "typescript",
42
- "react"
43
- ],
44
- "license": "LGPL-3.0-only",
45
52
  "publishConfig": {
46
53
  "access": "public"
47
- },
48
- "repository": {
49
- "type": "git",
50
- "url": "https://github.com/xylabs/sdk-react.git"
51
- },
52
- "sideEffects": false,
53
- "version": "4.0.2",
54
- "type": "module"
54
+ }
55
55
  }
@@ -1,9 +1,11 @@
1
1
  import { useEffect, useState } from 'react'
2
2
  import { createPortal } from 'react-dom'
3
3
 
4
- import { PortalProps } from './PortalProps.ts'
4
+ import type { PortalProps } from './PortalProps.ts'
5
5
 
6
- export const Portal: React.FC<PortalProps> = ({ children, className, el = 'div', target = 'body' }: PortalProps) => {
6
+ export const Portal: React.FC<PortalProps> = ({
7
+ children, className, el = 'div', target = 'body',
8
+ }: PortalProps) => {
7
9
  const [container] = useState(document.createElement(el))
8
10
  if (className) {
9
11
  container.classList.add(className)
package/xy.config.ts CHANGED
@@ -1,9 +1,7 @@
1
- import { XyTsupConfig } from '@xylabs/ts-scripts-yarn3'
1
+ import type { XyTsupConfig } from '@xylabs/ts-scripts-yarn3'
2
2
  const config: XyTsupConfig = {
3
3
  compile: {
4
- browser: {
5
- src: {},
6
- },
4
+ browser: { src: {} },
7
5
  node: {},
8
6
  neutral: {},
9
7
  },