@radix-ui/react-portal 1.1.13 → 1.1.14-rc.1784059564143
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/index.js +12 -9
- package/dist/index.js.map +3 -3
- package/dist/index.mjs +13 -9
- package/dist/index.mjs.map +3 -3
- package/package.json +3 -3
package/dist/index.js
CHANGED
|
@@ -6,6 +6,7 @@ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
|
6
6
|
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
7
7
|
var __getProtoOf = Object.getPrototypeOf;
|
|
8
8
|
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
9
|
+
var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
|
|
9
10
|
var __export = (target, all) => {
|
|
10
11
|
for (var name in all)
|
|
11
12
|
__defProp(target, name, { get: all[name], enumerable: true });
|
|
@@ -42,14 +43,16 @@ var ReactDOM = __toESM(require("react-dom"));
|
|
|
42
43
|
var import_react_primitive = require("@radix-ui/react-primitive");
|
|
43
44
|
var import_react_use_layout_effect = require("@radix-ui/react-use-layout-effect");
|
|
44
45
|
var import_jsx_runtime = require("react/jsx-runtime");
|
|
45
|
-
var
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
46
|
+
var Portal = /* @__PURE__ */ React.forwardRef(
|
|
47
|
+
// ignore prettier to reduce diff noise
|
|
48
|
+
// prettier-ignore
|
|
49
|
+
/* @__PURE__ */ __name(function Portal2(props, forwardedRef) {
|
|
50
|
+
const { container: containerProp, ...portalProps } = props;
|
|
51
|
+
const [mounted, setMounted] = React.useState(false);
|
|
52
|
+
(0, import_react_use_layout_effect.useLayoutEffect)(() => setMounted(true), []);
|
|
53
|
+
const container = containerProp || mounted && globalThis?.document?.body;
|
|
54
|
+
return container ? ReactDOM.createPortal(/* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_react_primitive.Primitive.div, { ...portalProps, ref: forwardedRef }), container) : null;
|
|
55
|
+
}, "Portal")
|
|
56
|
+
);
|
|
54
57
|
var Root = Portal;
|
|
55
58
|
//# sourceMappingURL=index.js.map
|
package/dist/index.js.map
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../src/index.ts", "../src/portal.tsx"],
|
|
4
|
-
"sourcesContent": ["'use client';\nexport {\n Portal,\n //\n Root,\n} from './portal';\nexport type { PortalProps } from './portal';\n", "import * as React from 'react';\nimport * as ReactDOM from 'react-dom';\nimport { Primitive } from '@radix-ui/react-primitive';\nimport { useLayoutEffect } from '@radix-ui/react-use-layout-effect';\n\n/* -------------------------------------------------------------------------------------------------\n * Portal\n * -----------------------------------------------------------------------------------------------*/\n\
|
|
5
|
-
"mappings": "
|
|
6
|
-
"names": []
|
|
4
|
+
"sourcesContent": ["'use client';\nexport {\n Portal,\n //\n Root,\n} from './portal';\nexport type { PortalProps } from './portal';\n", "import * as React from 'react';\nimport * as ReactDOM from 'react-dom';\nimport { Primitive } from '@radix-ui/react-primitive';\nimport { useLayoutEffect } from '@radix-ui/react-use-layout-effect';\n\n/* -------------------------------------------------------------------------------------------------\n * Portal\n * -----------------------------------------------------------------------------------------------*/\n\ntype PortalElement = React.ComponentRef<typeof Primitive.div>;\ntype PrimitiveDivProps = React.ComponentPropsWithoutRef<typeof Primitive.div>;\ninterface PortalProps extends PrimitiveDivProps {\n /**\n * An optional container where the portaled content should be appended.\n */\n container?: Element | DocumentFragment | null;\n}\n\nconst Portal = /* @__PURE__ */ React.forwardRef<PortalElement, PortalProps>(\n // ignore prettier to reduce diff noise\n // prettier-ignore\n function Portal(props, forwardedRef) {\n const { container: containerProp, ...portalProps } = props;\n const [mounted, setMounted] = React.useState(false);\n useLayoutEffect(() => setMounted(true), []);\n const container = containerProp || (mounted && globalThis?.document?.body);\n return container\n ? ReactDOM.createPortal(<Primitive.div {...portalProps} ref={forwardedRef} />, container)\n : null;\n},\n);\n\n/* -----------------------------------------------------------------------------------------------*/\n\nconst Root = Portal;\n\nexport {\n Portal,\n //\n Root,\n};\nexport type { PortalProps };\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;;ACAA,YAAuB;AACvB,eAA0B;AAC1B,6BAA0B;AAC1B,qCAAgC;AAwBJ;AAT5B,IAAM,SAAyB,gBAAM;AAAA;AAAA;AAAA,EAGnC,gCAASA,QAAO,OAAO,cAAc;AACrC,UAAM,EAAE,WAAW,eAAe,GAAG,YAAY,IAAI;AACrD,UAAM,CAAC,SAAS,UAAU,IAAU,eAAS,KAAK;AAClD,wDAAgB,MAAM,WAAW,IAAI,GAAG,CAAC,CAAC;AAC1C,UAAM,YAAY,iBAAkB,WAAW,YAAY,UAAU;AACrE,WAAO,YACM,sBAAa,4CAAC,iCAAU,KAAV,EAAe,GAAG,aAAa,KAAK,cAAc,GAAI,SAAS,IACtF;AAAA,EACN,GARE;AASF;AAIA,IAAM,OAAO;",
|
|
6
|
+
"names": ["Portal"]
|
|
7
7
|
}
|
package/dist/index.mjs
CHANGED
|
@@ -1,4 +1,6 @@
|
|
|
1
1
|
"use client";
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
|
|
2
4
|
|
|
3
5
|
// src/portal.tsx
|
|
4
6
|
import * as React from "react";
|
|
@@ -6,15 +8,17 @@ import * as ReactDOM from "react-dom";
|
|
|
6
8
|
import { Primitive } from "@radix-ui/react-primitive";
|
|
7
9
|
import { useLayoutEffect } from "@radix-ui/react-use-layout-effect";
|
|
8
10
|
import { jsx } from "react/jsx-runtime";
|
|
9
|
-
var
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
11
|
+
var Portal = /* @__PURE__ */ React.forwardRef(
|
|
12
|
+
// ignore prettier to reduce diff noise
|
|
13
|
+
// prettier-ignore
|
|
14
|
+
/* @__PURE__ */ __name(function Portal2(props, forwardedRef) {
|
|
15
|
+
const { container: containerProp, ...portalProps } = props;
|
|
16
|
+
const [mounted, setMounted] = React.useState(false);
|
|
17
|
+
useLayoutEffect(() => setMounted(true), []);
|
|
18
|
+
const container = containerProp || mounted && globalThis?.document?.body;
|
|
19
|
+
return container ? ReactDOM.createPortal(/* @__PURE__ */ jsx(Primitive.div, { ...portalProps, ref: forwardedRef }), container) : null;
|
|
20
|
+
}, "Portal")
|
|
21
|
+
);
|
|
18
22
|
var Root = Portal;
|
|
19
23
|
export {
|
|
20
24
|
Portal,
|
package/dist/index.mjs.map
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../src/portal.tsx"],
|
|
4
|
-
"sourcesContent": ["import * as React from 'react';\nimport * as ReactDOM from 'react-dom';\nimport { Primitive } from '@radix-ui/react-primitive';\nimport { useLayoutEffect } from '@radix-ui/react-use-layout-effect';\n\n/* -------------------------------------------------------------------------------------------------\n * Portal\n * -----------------------------------------------------------------------------------------------*/\n\
|
|
5
|
-
"mappings": "
|
|
6
|
-
"names": []
|
|
4
|
+
"sourcesContent": ["import * as React from 'react';\nimport * as ReactDOM from 'react-dom';\nimport { Primitive } from '@radix-ui/react-primitive';\nimport { useLayoutEffect } from '@radix-ui/react-use-layout-effect';\n\n/* -------------------------------------------------------------------------------------------------\n * Portal\n * -----------------------------------------------------------------------------------------------*/\n\ntype PortalElement = React.ComponentRef<typeof Primitive.div>;\ntype PrimitiveDivProps = React.ComponentPropsWithoutRef<typeof Primitive.div>;\ninterface PortalProps extends PrimitiveDivProps {\n /**\n * An optional container where the portaled content should be appended.\n */\n container?: Element | DocumentFragment | null;\n}\n\nconst Portal = /* @__PURE__ */ React.forwardRef<PortalElement, PortalProps>(\n // ignore prettier to reduce diff noise\n // prettier-ignore\n function Portal(props, forwardedRef) {\n const { container: containerProp, ...portalProps } = props;\n const [mounted, setMounted] = React.useState(false);\n useLayoutEffect(() => setMounted(true), []);\n const container = containerProp || (mounted && globalThis?.document?.body);\n return container\n ? ReactDOM.createPortal(<Primitive.div {...portalProps} ref={forwardedRef} />, container)\n : null;\n},\n);\n\n/* -----------------------------------------------------------------------------------------------*/\n\nconst Root = Portal;\n\nexport {\n Portal,\n //\n Root,\n};\nexport type { PortalProps };\n"],
|
|
5
|
+
"mappings": ";;;;;AAAA,YAAY,WAAW;AACvB,YAAY,cAAc;AAC1B,SAAS,iBAAiB;AAC1B,SAAS,uBAAuB;AAwBJ;AAT5B,IAAM,SAAyB,gBAAM;AAAA;AAAA;AAAA,EAGnC,gCAASA,QAAO,OAAO,cAAc;AACrC,UAAM,EAAE,WAAW,eAAe,GAAG,YAAY,IAAI;AACrD,UAAM,CAAC,SAAS,UAAU,IAAU,eAAS,KAAK;AAClD,oBAAgB,MAAM,WAAW,IAAI,GAAG,CAAC,CAAC;AAC1C,UAAM,YAAY,iBAAkB,WAAW,YAAY,UAAU;AACrE,WAAO,YACM,sBAAa,oBAAC,UAAU,KAAV,EAAe,GAAG,aAAa,KAAK,cAAc,GAAI,SAAS,IACtF;AAAA,EACN,GARE;AASF;AAIA,IAAM,OAAO;",
|
|
6
|
+
"names": ["Portal"]
|
|
7
7
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@radix-ui/react-portal",
|
|
3
|
-
"version": "1.1.
|
|
3
|
+
"version": "1.1.14-rc.1784059564143",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"source": "./src/index.ts",
|
|
6
6
|
"main": "./dist/index.js",
|
|
@@ -11,8 +11,8 @@
|
|
|
11
11
|
],
|
|
12
12
|
"sideEffects": false,
|
|
13
13
|
"dependencies": {
|
|
14
|
-
"@radix-ui/react-
|
|
15
|
-
"@radix-ui/react-
|
|
14
|
+
"@radix-ui/react-use-layout-effect": "1.1.2",
|
|
15
|
+
"@radix-ui/react-primitive": "2.1.7"
|
|
16
16
|
},
|
|
17
17
|
"devDependencies": {
|
|
18
18
|
"@types/react": "^19.2.2",
|