@radix-ui/react-portal 0.1.2-rc.7 → 0.1.3-rc.1
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.d.ts +2 -2
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1 -1
- package/dist/index.js.map +1 -1
- package/dist/index.module.js +1 -1
- package/dist/index.module.js.map +1 -1
- package/package.json +3 -3
package/dist/index.d.ts
CHANGED
|
@@ -6,10 +6,10 @@ export interface PortalProps extends PrimitiveDivProps {
|
|
|
6
6
|
containerRef?: React.RefObject<HTMLElement>;
|
|
7
7
|
}
|
|
8
8
|
export const Portal: React.ForwardRefExoticComponent<PortalProps & React.RefAttributes<HTMLDivElement>>;
|
|
9
|
-
export interface UnstablePortalProps {
|
|
9
|
+
export interface UnstablePortalProps extends PrimitiveDivProps {
|
|
10
10
|
container?: HTMLElement | null;
|
|
11
11
|
}
|
|
12
|
-
export const UnstablePortal: React.
|
|
12
|
+
export const UnstablePortal: React.ForwardRefExoticComponent<UnstablePortalProps & React.RefAttributes<HTMLDivElement>>;
|
|
13
13
|
export const Root: React.ForwardRefExoticComponent<PortalProps & React.RefAttributes<HTMLDivElement>>;
|
|
14
14
|
|
|
15
15
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"mappings":"A;A;A;AAgBA,yBAAyB,MAAM,wBAAwB,CAAC,OAAO,UAAU,GAAG,CAAC,CAAC;AAC9E,4BAAsB,SAAQ,iBAAiB;IAC7C,YAAY,CAAC,EAAE,MAAM,SAAS,CAAC,WAAW,CAAC,CAAC;CAC7C;AAED,OAAA,MAAM,0FA2CJ,CAAC;
|
|
1
|
+
{"mappings":"A;A;A;AAgBA,yBAAyB,MAAM,wBAAwB,CAAC,OAAO,UAAU,GAAG,CAAC,CAAC;AAC9E,4BAAsB,SAAQ,iBAAiB;IAC7C,YAAY,CAAC,EAAE,MAAM,SAAS,CAAC,WAAW,CAAC,CAAC;CAC7C;AAED,OAAA,MAAM,0FA2CJ,CAAC;AAWH,oCAA8B,SAAQ,iBAAiB;IACrD,SAAS,CAAC,EAAE,WAAW,GAAG,IAAI,CAAC;CAChC;AAED,OAAA,MAAM,0GAOL,CAAC;AAMF,OAAA,MAAM,wFAAa,CAAC","sources":["./packages/react/portal/src/packages/react/portal/src/Portal.tsx","./packages/react/portal/src/packages/react/portal/src/index.ts"],"sourcesContent":[null,null],"names":[],"version":3,"file":"index.d.ts.map"}
|
package/dist/index.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
var e,t,r=require("@radix-ui/react-primitive").Primitive,o=require("@radix-ui/react-use-layout-effect").useLayoutEffect,l=
|
|
1
|
+
var e,t,r=require("@radix-ui/react-primitive").Primitive,o=require("@radix-ui/react-use-layout-effect").useLayoutEffect,l=n(require("react-dom")),i=(e={},t=require("react"),Object.keys(t).forEach((function(r){"default"!==r&&"__esModule"!==r&&Object.defineProperty(e,r,{enumerable:!0,get:function(){return t[r]}})})),e),a=n(require("@babel/runtime/helpers/extends"));function n(e){return e&&e.__esModule?e.default:e}const u=/*#__PURE__*/i.forwardRef(((e,t)=>{var n,u;const{containerRef:d,style:c,...s}=e,f=null!==(n=null==d?void 0:d.current)&&void 0!==n?n:null===globalThis||void 0===globalThis||null===(u=globalThis.document)||void 0===u?void 0:u.body,[,b]=i.useState({});return o((()=>{b({})}),[]),f?/*#__PURE__*/l.createPortal(/*#__PURE__*/i.createElement(r.div,a({"data-radix-portal":""},s,{ref:t,style:f===document.body?{position:"absolute",top:0,left:0,zIndex:2147483647,...c}:void 0})),f):null}));exports.Portal=u;const d=/*#__PURE__*/i.forwardRef(((e,t)=>{var o;const{container:n=(null===globalThis||void 0===globalThis||null===(o=globalThis.document)||void 0===o?void 0:o.body),...u}=e;return n?/*#__PURE__*/l.createPortal(/*#__PURE__*/i.createElement(r.div,a({},u,{ref:t})),n):null}));exports.UnstablePortal=d;const c=u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,QAAUF,ECMzC,MAcMG,eAASC,EAAMC,YAAuC,CAACC,EAAOC,KAAiB,IAAAC,EAAAC,EACnF,MAAMC,aAAEA,EAAFC,MAAgBA,KAAUC,GAAgBN,EAC1CO,EAAW,QAAAL,EAAGE,MAAAA,OAAH,EAAGA,EAAcI,eAAjB,IAAAN,EAAAA,EAAA,OAA4BO,iBAA5B,IAA4BA,YAA5B,QAAAN,EAA4BM,WAAYC,gBAAxC,IAAAP,OAAA,EAA4BA,EAAsBQ,MAC7D,CAAGC,GAAed,EAAMe,SAAS,IAUvC,OAJAC,GAAgB,KACdF,EAAY,MACX,IAECL,eACKQ,EAASC,0BACdC,EAAAC,cAACC,EAAUC,IAAXC,EAAA,CACE,oBAAkB,IACdf,EAFN,CAGEgB,IAAKrB,EACLI,MAOEE,IAAgBG,SAASC,KACrB,CACEY,SAAU,WACVC,IAAK,EACLC,KAAM,EACNC,OA7CI,cA8CDrB,QAELsB,KAGRpB,GAKG,yBAST,MAOMqB,eAAiB9B,EAAMC,YAC3B,CAACC,EAAOC,KAAiB,IAAA4B,EACvB,MAAMC,UAAEA,GAAS,OAAGrB,iBAAH,IAAGA,YAAH,QAAAoB,EAAGpB,WAAYC,gBAAf,IAAAmB,OAAA,EAAGA,EAAsBlB,SAASL,GAAgBN,EACnE,OAAO8B,eACHf,EAASC,0BAAaC,EAAAC,cAACC,EAAUC,IAAXC,EAAA,GAAmBf,EAAnB,CAAgCgB,IAAKrB,KAAkB6B,GAC7E,iCAQR,MAAMC,EAAOlC","sources":["./node_modules/@parcel/scope-hoisting/lib/helpers.js","./packages/react/portal/src/Portal.tsx"],"sourcesContent":["function $parcel$interopDefault(a) {\n return a && a.__esModule ? a.default : a;\n}\n\nfunction $parcel$defineInteropFlag(a) {\n Object.defineProperty(a, '__esModule', {value: true});\n}\n\nfunction $parcel$reexport(e, n, v) {\n Object.defineProperty(e, n, {get: v, enumerable: true});\n}\n\nfunction $parcel$exportWildcard(dest, source) {\n Object.keys(source).forEach(function(key) {\n if (key === 'default' || key === '__esModule') {\n return;\n }\n\n Object.defineProperty(dest, key, {\n enumerable: true,\n get: function get() {\n return source[key];\n },\n });\n });\n\n return dest;\n}\n\nfunction $parcel$missingModule(name) {\n var err = new Error(\"Cannot find module '\" + name + \"'\");\n err.code = 'MODULE_NOT_FOUND';\n throw err;\n}\n\nvar $parcel$global =\n typeof globalThis !== 'undefined'\n ? globalThis\n : typeof self !== 'undefined'\n ? self\n : typeof window !== 'undefined'\n ? window\n : typeof global !== 'undefined'\n ? global\n : {};\n","import * as React from 'react';\nimport ReactDOM from 'react-dom';\nimport { useLayoutEffect } from '@radix-ui/react-use-layout-effect';\nimport { Primitive } from '@radix-ui/react-primitive';\n\nimport type * as Radix from '@radix-ui/react-primitive';\n\nconst MAX_Z_INDEX = 2147483647;\n\n/* -------------------------------------------------------------------------------------------------\n * Portal\n * -----------------------------------------------------------------------------------------------*/\n\nconst PORTAL_NAME = 'Portal';\n\ntype PortalElement = React.ElementRef<typeof Primitive.div>;\ntype PrimitiveDivProps = Radix.ComponentPropsWithoutRef<typeof Primitive.div>;\ninterface PortalProps extends PrimitiveDivProps {\n containerRef?: React.RefObject<HTMLElement>;\n}\n\nconst Portal = React.forwardRef<PortalElement, PortalProps>((props, forwardedRef) => {\n const { containerRef, style, ...portalProps } = props;\n const hostElement = containerRef?.current ?? globalThis?.document?.body;\n const [, forceUpdate] = React.useState({});\n\n /**\n * containerRef.current won't be set on first render, so we force a re-render.\n * Because we do this in `useLayoutEffect`, we still avoid a flash.\n */\n useLayoutEffect(() => {\n forceUpdate({});\n }, []);\n\n if (hostElement) {\n return ReactDOM.createPortal(\n <Primitive.div\n data-radix-portal=\"\"\n {...portalProps}\n ref={forwardedRef}\n style={\n /**\n * If the Portal is injected in `body`, we assume we want whatever is portalled\n * to appear on top of everything. Ideally this would be handled by making sure the\n * app root creates a new stacking context, however this is quite hard to automate.\n * For this reason, we have opted for setting the max z-index on the portal itself.\n */\n hostElement === document.body\n ? {\n position: 'absolute',\n top: 0,\n left: 0,\n zIndex: MAX_Z_INDEX,\n ...style,\n }\n : undefined\n }\n />,\n hostElement\n );\n }\n\n // bail out of ssr\n return null;\n});\n\nPortal.displayName = PORTAL_NAME;\n\n/* -------------------------------------------------------------------------------------------------\n * UnstablePortal\n * -----------------------------------------------------------------------------------------------*/\n\nconst UNSTABLE_PORTAL_NAME = 'Portal';\n\ntype UnstablePortalElement = React.ElementRef<typeof Primitive.div>;\ninterface UnstablePortalProps extends PrimitiveDivProps {\n container?: HTMLElement | null;\n}\n\nconst UnstablePortal = React.forwardRef<UnstablePortalElement, UnstablePortalProps>(\n (props, forwardedRef) => {\n const { container = globalThis?.document?.body, ...portalProps } = props;\n return container\n ? ReactDOM.createPortal(<Primitive.div {...portalProps} ref={forwardedRef} />, container)\n : null;\n }\n);\n\nUnstablePortal.displayName = UNSTABLE_PORTAL_NAME;\n\n/* -----------------------------------------------------------------------------------------------*/\n\nconst Root = Portal;\n\nexport {\n Portal,\n UnstablePortal,\n //\n Root,\n};\nexport type { PortalProps, UnstablePortalProps };\n"],"names":["dest","source","Object","keys","forEach","key","defineProperty","enumerable","get","$parcel$interopDefault","a","__esModule","default","Portal","React","forwardRef","props","forwardedRef","_containerRef$current","_globalThis$document","containerRef","style","portalProps","hostElement","current","globalThis","document","body","forceUpdate","useState","useLayoutEffect","ReactDOM","createPortal","_react","createElement","Primitive","div","_babelRuntimeHelpersExtends","ref","position","top","left","zIndex","undefined","UnstablePortal","_globalThis$document2","container","Root"],"version":3,"file":"index.js.map"}
|
package/dist/index.module.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{Primitive as o}from"@radix-ui/react-primitive";import{useLayoutEffect as t}from"@radix-ui/react-use-layout-effect";import e from"react-dom";import*as r from"react";import l from"@babel/runtime/helpers/esm/extends";export const Portal=/*#__PURE__*/r.forwardRef(((a,i)=>{var n,d;const{containerRef:s,style:u,...c}=a,m=null!==(n=null==s?void 0:s.current)&&void 0!==n?n:null===globalThis||void 0===globalThis||null===(d=globalThis.document)||void 0===d?void 0:d.body,[,
|
|
1
|
+
import{Primitive as o}from"@radix-ui/react-primitive";import{useLayoutEffect as t}from"@radix-ui/react-use-layout-effect";import e from"react-dom";import*as r from"react";import l from"@babel/runtime/helpers/esm/extends";export const Portal=/*#__PURE__*/r.forwardRef(((a,i)=>{var n,d;const{containerRef:s,style:u,...c}=a,m=null!==(n=null==s?void 0:s.current)&&void 0!==n?n:null===globalThis||void 0===globalThis||null===(d=globalThis.document)||void 0===d?void 0:d.body,[,f]=r.useState({});return t((()=>{f({})}),[]),m?/*#__PURE__*/e.createPortal(/*#__PURE__*/r.createElement(o.div,l({"data-radix-portal":""},c,{ref:i,style:m===document.body?{position:"absolute",top:0,left:0,zIndex:2147483647,...u}:void 0})),m):null}));/*#__PURE__*/export const UnstablePortal=/*#__PURE__*/r.forwardRef(((t,a)=>{var i;const{container:n=(null===globalThis||void 0===globalThis||null===(i=globalThis.document)||void 0===i?void 0:i.body),...d}=t;return n?/*#__PURE__*/e.createPortal(/*#__PURE__*/r.createElement(o.div,l({},d,{ref:a})),n):null}));/*#__PURE__*/export const Root=Portal;
|
|
2
2
|
//# sourceMappingURL=index.module.js.map
|
package/dist/index.module.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"mappings":"oOAqBA,MAAMA,oBAASC,EAAMC,YAAuC,CAACC,EAAOC,KAAiB,IAAAC,EAAAC,EACnF,MAAMC,aAAEA,EAAFC,MAAgBA,KAAUC,GAAgBN,EAC1CO,EAAW,QAAAL,EAAGE,MAAAA,OAAH,EAAGA,EAAcI,eAAjB,IAAAN,EAAAA,EAAA,OAA4BO,iBAA5B,IAA4BA,YAA5B,QAAAN,EAA4BM,WAAYC,gBAAxC,IAAAP,OAAA,EAA4BA,EAAsBQ,MAC7D,CAAGC,GAAed,EAAMe,SAAS,IAUvC,OAJAC,GAAgB,KACdF,EAAY,MACX,IAECL,eACKQ,EAASC,0BACdC,EAAAC,cAACC,EAAUC,IAAXC,EAAA,CACE,oBAAkB,IACdf,EAFN,CAGEgB,IAAKrB,EACLI,MAOEE,IAAgBG,SAASC,KACrB,CACEY,SAAU,WACVC,IAAK,EACLC,KAAM,EACNC,OA7CI,cA8CDrB,QAELsB,KAGRpB,GAKG,
|
|
1
|
+
{"mappings":"oOAqBA,MAAMA,oBAASC,EAAMC,YAAuC,CAACC,EAAOC,KAAiB,IAAAC,EAAAC,EACnF,MAAMC,aAAEA,EAAFC,MAAgBA,KAAUC,GAAgBN,EAC1CO,EAAW,QAAAL,EAAGE,MAAAA,OAAH,EAAGA,EAAcI,eAAjB,IAAAN,EAAAA,EAAA,OAA4BO,iBAA5B,IAA4BA,YAA5B,QAAAN,EAA4BM,WAAYC,gBAAxC,IAAAP,OAAA,EAA4BA,EAAsBQ,MAC7D,CAAGC,GAAed,EAAMe,SAAS,IAUvC,OAJAC,GAAgB,KACdF,EAAY,MACX,IAECL,eACKQ,EAASC,0BACdC,EAAAC,cAACC,EAAUC,IAAXC,EAAA,CACE,oBAAkB,IACdf,EAFN,CAGEgB,IAAKrB,EACLI,MAOEE,IAAgBG,SAASC,KACrB,CACEY,SAAU,WACVC,IAAK,EACLC,KAAM,EACNC,OA7CI,cA8CDrB,QAELsB,KAGRpB,GAKG,4BAgBT,MAAMqB,4BAAiB9B,EAAMC,YAC3B,CAACC,EAAOC,KAAiB,IAAA4B,EACvB,MAAMC,UAAEA,GAAS,OAAGrB,iBAAH,IAAGA,YAAH,QAAAoB,EAAGpB,WAAYC,gBAAf,IAAAmB,OAAA,EAAGA,EAAsBlB,SAASL,GAAgBN,EACnE,OAAO8B,eACHf,EAASC,0BAAaC,EAAAC,cAACC,EAAUC,IAAXC,EAAA,GAAmBf,EAAnB,CAAgCgB,IAAKrB,KAAkB6B,GAC7E,4BAQR,MAAMC,KAAOlC","sources":["./packages/react/portal/src/Portal.tsx"],"sourcesContent":["import * as React from 'react';\nimport ReactDOM from 'react-dom';\nimport { useLayoutEffect } from '@radix-ui/react-use-layout-effect';\nimport { Primitive } from '@radix-ui/react-primitive';\n\nimport type * as Radix from '@radix-ui/react-primitive';\n\nconst MAX_Z_INDEX = 2147483647;\n\n/* -------------------------------------------------------------------------------------------------\n * Portal\n * -----------------------------------------------------------------------------------------------*/\n\nconst PORTAL_NAME = 'Portal';\n\ntype PortalElement = React.ElementRef<typeof Primitive.div>;\ntype PrimitiveDivProps = Radix.ComponentPropsWithoutRef<typeof Primitive.div>;\ninterface PortalProps extends PrimitiveDivProps {\n containerRef?: React.RefObject<HTMLElement>;\n}\n\nconst Portal = React.forwardRef<PortalElement, PortalProps>((props, forwardedRef) => {\n const { containerRef, style, ...portalProps } = props;\n const hostElement = containerRef?.current ?? globalThis?.document?.body;\n const [, forceUpdate] = React.useState({});\n\n /**\n * containerRef.current won't be set on first render, so we force a re-render.\n * Because we do this in `useLayoutEffect`, we still avoid a flash.\n */\n useLayoutEffect(() => {\n forceUpdate({});\n }, []);\n\n if (hostElement) {\n return ReactDOM.createPortal(\n <Primitive.div\n data-radix-portal=\"\"\n {...portalProps}\n ref={forwardedRef}\n style={\n /**\n * If the Portal is injected in `body`, we assume we want whatever is portalled\n * to appear on top of everything. Ideally this would be handled by making sure the\n * app root creates a new stacking context, however this is quite hard to automate.\n * For this reason, we have opted for setting the max z-index on the portal itself.\n */\n hostElement === document.body\n ? {\n position: 'absolute',\n top: 0,\n left: 0,\n zIndex: MAX_Z_INDEX,\n ...style,\n }\n : undefined\n }\n />,\n hostElement\n );\n }\n\n // bail out of ssr\n return null;\n});\n\nPortal.displayName = PORTAL_NAME;\n\n/* -------------------------------------------------------------------------------------------------\n * UnstablePortal\n * -----------------------------------------------------------------------------------------------*/\n\nconst UNSTABLE_PORTAL_NAME = 'Portal';\n\ntype UnstablePortalElement = React.ElementRef<typeof Primitive.div>;\ninterface UnstablePortalProps extends PrimitiveDivProps {\n container?: HTMLElement | null;\n}\n\nconst UnstablePortal = React.forwardRef<UnstablePortalElement, UnstablePortalProps>(\n (props, forwardedRef) => {\n const { container = globalThis?.document?.body, ...portalProps } = props;\n return container\n ? ReactDOM.createPortal(<Primitive.div {...portalProps} ref={forwardedRef} />, container)\n : null;\n }\n);\n\nUnstablePortal.displayName = UNSTABLE_PORTAL_NAME;\n\n/* -----------------------------------------------------------------------------------------------*/\n\nconst Root = Portal;\n\nexport {\n Portal,\n UnstablePortal,\n //\n Root,\n};\nexport type { PortalProps, UnstablePortalProps };\n"],"names":["Portal","React","forwardRef","props","forwardedRef","_containerRef$current","_globalThis$document","containerRef","style","portalProps","hostElement","current","globalThis","document","body","forceUpdate","useState","useLayoutEffect","ReactDOM","createPortal","_react","createElement","Primitive","div","_babelRuntimeHelpersEsmExtends","ref","position","top","left","zIndex","undefined","UnstablePortal","_globalThis$document2","container","Root"],"version":3,"file":"index.module.js.map"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@radix-ui/react-portal",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.3-rc.1",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"source": "src/index.ts",
|
|
6
6
|
"main": "dist/index.js",
|
|
@@ -17,7 +17,7 @@
|
|
|
17
17
|
},
|
|
18
18
|
"dependencies": {
|
|
19
19
|
"@babel/runtime": "^7.13.10",
|
|
20
|
-
"@radix-ui/react-primitive": "0.1.1",
|
|
20
|
+
"@radix-ui/react-primitive": "0.1.3-rc.1",
|
|
21
21
|
"@radix-ui/react-use-layout-effect": "0.1.0"
|
|
22
22
|
},
|
|
23
23
|
"peerDependencies": {
|
|
@@ -32,5 +32,5 @@
|
|
|
32
32
|
"bugs": {
|
|
33
33
|
"url": "https://github.com/radix-ui/primitives/issues"
|
|
34
34
|
},
|
|
35
|
-
"stableVersion": "0.1.
|
|
35
|
+
"stableVersion": "0.1.2"
|
|
36
36
|
}
|