@tamagui/portal 1.130.2 → 1.130.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.
- package/dist/cjs/Portal.cjs +12 -15
- package/dist/cjs/Portal.js +14 -18
- package/dist/cjs/Portal.js.map +1 -1
- package/dist/cjs/Portal.native.js +7 -5
- package/dist/cjs/Portal.native.js.map +2 -2
- package/dist/cjs/PortalProps.native.js.map +1 -1
- package/dist/esm/Portal.js +13 -18
- package/dist/esm/Portal.js.map +1 -1
- package/dist/esm/Portal.mjs +12 -15
- package/dist/esm/Portal.mjs.map +1 -1
- package/dist/esm/Portal.native.js +12 -10
- package/dist/esm/Portal.native.js.map +1 -1
- package/package.json +7 -8
- package/src/Portal.native.tsx +14 -8
- package/src/Portal.tsx +18 -23
- package/src/PortalProps.tsx +5 -5
- package/types/Portal.d.ts +1 -1
- package/types/Portal.d.ts.map +1 -1
- package/types/Portal.native.d.ts.map +1 -1
- package/types/PortalProps.d.ts +5 -5
- package/types/PortalProps.d.ts.map +1 -1
package/dist/cjs/Portal.cjs
CHANGED
|
@@ -36,7 +36,6 @@ __export(Portal_exports, {
|
|
|
36
36
|
module.exports = __toCommonJS(Portal_exports);
|
|
37
37
|
var import_polyfill_dev = require("@tamagui/polyfill-dev"),
|
|
38
38
|
import_constants = require("@tamagui/constants"),
|
|
39
|
-
import_stacks = require("@tamagui/stacks"),
|
|
40
39
|
import_z_index_stack = require("@tamagui/z-index-stack"),
|
|
41
40
|
React = __toESM(require("react")),
|
|
42
41
|
import_react_dom = require("react-dom"),
|
|
@@ -44,23 +43,21 @@ var import_polyfill_dev = require("@tamagui/polyfill-dev"),
|
|
|
44
43
|
import_jsx_runtime = require("react/jsx-runtime");
|
|
45
44
|
const Portal = React.memo(propsIn => {
|
|
46
45
|
if (import_constants.isServer) return null;
|
|
46
|
+
const body = globalThis.document?.body;
|
|
47
|
+
if (!body) return propsIn.children;
|
|
47
48
|
const {
|
|
48
|
-
host = globalThis.document?.body,
|
|
49
|
-
stackZIndex,
|
|
50
49
|
children,
|
|
51
|
-
passThrough
|
|
52
|
-
...props
|
|
50
|
+
passThrough
|
|
53
51
|
} = propsIn,
|
|
54
52
|
zIndex = (0, import_z_index_stack.useStackedZIndex)((0, import_helpers.getStackedZIndexProps)(propsIn));
|
|
55
|
-
return passThrough ? children : (0, import_react_dom.createPortal)(/* @__PURE__ */(0, import_jsx_runtime.jsx)(
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
zIndex,
|
|
53
|
+
return passThrough ? children : (0, import_react_dom.createPortal)(/* @__PURE__ */(0, import_jsx_runtime.jsx)("span", {
|
|
54
|
+
style: {
|
|
55
|
+
zIndex,
|
|
56
|
+
position: "absolute",
|
|
57
|
+
inset: 0,
|
|
58
|
+
contain: "strict",
|
|
59
|
+
pointerEvents: "none"
|
|
60
|
+
},
|
|
64
61
|
children
|
|
65
|
-
}),
|
|
62
|
+
}), body);
|
|
66
63
|
});
|
package/dist/cjs/Portal.js
CHANGED
|
@@ -25,33 +25,29 @@ __export(Portal_exports, {
|
|
|
25
25
|
Portal: () => Portal
|
|
26
26
|
});
|
|
27
27
|
module.exports = __toCommonJS(Portal_exports);
|
|
28
|
-
var import_polyfill_dev = require("@tamagui/polyfill-dev"), import_constants = require("@tamagui/constants"),
|
|
28
|
+
var import_polyfill_dev = require("@tamagui/polyfill-dev"), import_constants = require("@tamagui/constants"), import_z_index_stack = require("@tamagui/z-index-stack"), React = __toESM(require("react")), import_react_dom = require("react-dom"), import_helpers = require("./helpers"), import_jsx_runtime = require("react/jsx-runtime");
|
|
29
29
|
const Portal = React.memo((propsIn) => {
|
|
30
30
|
if (import_constants.isServer)
|
|
31
31
|
return null;
|
|
32
|
-
const
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
passThrough,
|
|
37
|
-
...props
|
|
38
|
-
} = propsIn, zIndex = (0, import_z_index_stack.useStackedZIndex)((0, import_helpers.getStackedZIndexProps)(propsIn));
|
|
32
|
+
const body = globalThis.document?.body;
|
|
33
|
+
if (!body)
|
|
34
|
+
return propsIn.children;
|
|
35
|
+
const { children, passThrough } = propsIn, zIndex = (0, import_z_index_stack.useStackedZIndex)((0, import_helpers.getStackedZIndexProps)(propsIn));
|
|
39
36
|
return passThrough ? children : (0, import_react_dom.createPortal)(
|
|
40
37
|
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
41
|
-
|
|
38
|
+
"span",
|
|
42
39
|
{
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
zIndex,
|
|
40
|
+
style: {
|
|
41
|
+
zIndex,
|
|
42
|
+
position: "absolute",
|
|
43
|
+
inset: 0,
|
|
44
|
+
contain: "strict",
|
|
45
|
+
pointerEvents: "none"
|
|
46
|
+
},
|
|
51
47
|
children
|
|
52
48
|
}
|
|
53
49
|
),
|
|
54
|
-
|
|
50
|
+
body
|
|
55
51
|
);
|
|
56
52
|
});
|
|
57
53
|
//# sourceMappingURL=Portal.js.map
|
package/dist/cjs/Portal.js.map
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../src/Portal.tsx"],
|
|
4
|
-
"mappings": ";;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,0BAAO,kCAEP,mBAAyB,+BACzB,
|
|
4
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,0BAAO,kCAEP,mBAAyB,+BACzB,uBAAiC,mCACjC,QAAuB,2BACvB,mBAA6B,sBAC7B,iBAAsC,sBAsBlC;AAnBG,MAAM,SAAS,MAAM,KAAK,CAAC,YAAyB;AACzD,MAAI;AACF,WAAO;AAGT,QAAM,OAAO,WAAW,UAAU;AAElC,MAAI,CAAC;AACH,WAAO,QAAQ;AAGjB,QAAM,EAAE,UAAU,YAAY,IAAI,SAC5B,aAAS,2CAAiB,sCAAsB,OAAO,CAAC;AAE9D,SAAI,cACK,eAGF;AAAA,IACL;AAAA,MAAC;AAAA;AAAA,QACC,OAAO;AAAA,UACL;AAAA,UACA,UAAU;AAAA,UACV,OAAO;AAAA,UACP,SAAS;AAAA,UACT,eAAe;AAAA,QACjB;AAAA,QAEC;AAAA;AAAA,IACH;AAAA,IACA;AAAA,EACF;AACF,CAAC;",
|
|
5
5
|
"names": []
|
|
6
6
|
}
|
|
@@ -26,7 +26,7 @@ __export(Portal_native_exports, {
|
|
|
26
26
|
Portal: () => Portal
|
|
27
27
|
});
|
|
28
28
|
module.exports = __toCommonJS(Portal_native_exports);
|
|
29
|
-
var import_jsx_runtime = require("react/jsx-runtime"),
|
|
29
|
+
var import_jsx_runtime = require("react/jsx-runtime"), import_core = require("@tamagui/core"), import_z_index_stack = require("@tamagui/z-index-stack"), React = __toESM(require("react")), import_react_native = require("react-native"), import_constants = require("./constants"), import_GorhomPortalItem = require("./GorhomPortalItem"), import_helpers = require("./helpers"), createPortal = function() {
|
|
30
30
|
if (import_constants.IS_FABRIC)
|
|
31
31
|
try {
|
|
32
32
|
var _ReactFabricShimModule_default, ReactFabricShimModule = require("react-native/Libraries/Renderer/shims/ReactFabric"), _ReactFabricShimModule_default_createPortal;
|
|
@@ -41,15 +41,17 @@ var import_jsx_runtime = require("react/jsx-runtime"), import_stacks = require("
|
|
|
41
41
|
return console.info("Note: error importing portal, defaulting to non-native portals", err), null;
|
|
42
42
|
}
|
|
43
43
|
}(), Portal = function(propsIn) {
|
|
44
|
-
var
|
|
44
|
+
var rootTag = React.useContext(import_react_native.RootTagContext), zIndex = (0, import_z_index_stack.useStackedZIndex)((0, import_helpers.getStackedZIndexProps)(propsIn)), { children, passThrough } = propsIn, contents = /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_core.View, {
|
|
45
45
|
pointerEvents: "box-none",
|
|
46
|
-
fullscreen: !0,
|
|
47
46
|
position: "absolute",
|
|
47
|
+
inset: 0,
|
|
48
48
|
maxWidth: "100%",
|
|
49
|
-
|
|
50
|
-
|
|
49
|
+
zIndex,
|
|
50
|
+
passThrough,
|
|
51
|
+
children
|
|
51
52
|
});
|
|
52
53
|
return !createPortal || !import_constants.USE_NATIVE_PORTAL || !rootTag ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_GorhomPortalItem.GorhomPortalItem, {
|
|
54
|
+
passThrough,
|
|
53
55
|
hostName: "root",
|
|
54
56
|
children: contents
|
|
55
57
|
}) : createPortal(contents, rootTag);
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../src/Portal.native.tsx"],
|
|
4
|
-
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;uDAAA,
|
|
5
|
-
"names": ["createPortal", "IS_FABRIC", "ReactFabricShimModule", "require", "default", "err", "console", "info", "ReactNativeShimModule", "Portal", "propsIn", "
|
|
4
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;uDAAA,cAAqB,0BACrB,uBAAiC,mCACjC,QAAuB,2BACvB,sBAA+B,yBAC/B,mBAA6C,wBAC7C,0BAAiC,+BACjC,iBAAsC,sBAGhCA,eAAgB,WAAA;AACpB,MAAIC;AACF,QAAI;UAIAC,gCAHIA,wBAAwBC,QAAQ,mDAAA,GAGpCD;AADF,cACEA,8CAAAA,yBAAAA,SAAAA,iCAAAA,sBAAuBE,aAAO,QAA9BF,mCAAAA,SAAAA,SAAAA,+BAAgCF,kBAAY,QAA5CE,gDAAAA,SAAAA,8CAAgDA,sBAAsBF;IAE1E,SAASK,KAAK;AACZC,qBAAQC,KAAK,kEAAkEF,GAAAA,GACxE;IACT;AAEF,MAAI;QAKAG,gCAJIA,wBACJL,QAAQ,mDAAA,GAGRK;AADF,YACEA,8CAAAA,yBAAAA,SAAAA,iCAAAA,sBAAuBJ,aAAO,QAA9BI,mCAAAA,SAAAA,SAAAA,+BAAgCR,kBAAY,QAA5CQ,gDAAAA,SAAAA,8CAAgDA,sBAAsBR;EAE1E,SAASK,KAAK;AACZC,mBAAQC,KAAK,kEAAkEF,GAAAA,GACxE;EACT;AACF,EAAA,GAEaI,SAAS,SAACC,SAAAA;AACrB,MAAMC,UAAUC,MAAMC,WAAWC,kCAAAA,GAC3BC,aAASC,2CAAiBC,sCAAsBP,OAAAA,CAAAA,GAEhD,EAAEQ,UAAUC,YAAW,IAAKT,SAE5BU,WACJ,uCAAAC,KAACC,kBAAAA;IACCC,eAAc;IACdC,UAAS;IACTC,OAAO;IACPC,UAAS;IACTX;IACAI;;;AAMJ,SAAI,CAACnB,gBAAgB,CAAC2B,sCAAqB,CAAChB,UAExC,uCAAAU,KAACO,0CAAAA;IAAiBT;IAA0BU,UAAS;cAClDT;OAKApB,aAAaoB,UAAUT,OAAAA;AAChC;",
|
|
5
|
+
"names": ["createPortal", "IS_FABRIC", "ReactFabricShimModule", "require", "default", "err", "console", "info", "ReactNativeShimModule", "Portal", "propsIn", "rootTag", "React", "useContext", "RootTagContext", "zIndex", "useStackedZIndex", "getStackedZIndexProps", "children", "passThrough", "contents", "_jsx", "View", "pointerEvents", "position", "inset", "maxWidth", "USE_NATIVE_PORTAL", "GorhomPortalItem", "hostName"]
|
|
6
6
|
}
|
package/dist/esm/Portal.js
CHANGED
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import "@tamagui/polyfill-dev";
|
|
2
2
|
import { isServer } from "@tamagui/constants";
|
|
3
|
-
import { YStack } from "@tamagui/stacks";
|
|
4
3
|
import { useStackedZIndex } from "@tamagui/z-index-stack";
|
|
5
4
|
import * as React from "react";
|
|
6
5
|
import { createPortal } from "react-dom";
|
|
@@ -9,29 +8,25 @@ import { jsx } from "react/jsx-runtime";
|
|
|
9
8
|
const Portal = React.memo((propsIn) => {
|
|
10
9
|
if (isServer)
|
|
11
10
|
return null;
|
|
12
|
-
const
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
passThrough,
|
|
17
|
-
...props
|
|
18
|
-
} = propsIn, zIndex = useStackedZIndex(getStackedZIndexProps(propsIn));
|
|
11
|
+
const body = globalThis.document?.body;
|
|
12
|
+
if (!body)
|
|
13
|
+
return propsIn.children;
|
|
14
|
+
const { children, passThrough } = propsIn, zIndex = useStackedZIndex(getStackedZIndexProps(propsIn));
|
|
19
15
|
return passThrough ? children : createPortal(
|
|
20
16
|
/* @__PURE__ */ jsx(
|
|
21
|
-
|
|
17
|
+
"span",
|
|
22
18
|
{
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
zIndex,
|
|
19
|
+
style: {
|
|
20
|
+
zIndex,
|
|
21
|
+
position: "absolute",
|
|
22
|
+
inset: 0,
|
|
23
|
+
contain: "strict",
|
|
24
|
+
pointerEvents: "none"
|
|
25
|
+
},
|
|
31
26
|
children
|
|
32
27
|
}
|
|
33
28
|
),
|
|
34
|
-
|
|
29
|
+
body
|
|
35
30
|
);
|
|
36
31
|
});
|
|
37
32
|
export {
|
package/dist/esm/Portal.js.map
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../src/Portal.tsx"],
|
|
4
|
-
"mappings": "AAAA,OAAO;AAEP,SAAS,gBAAgB;AACzB,SAAS,
|
|
4
|
+
"mappings": "AAAA,OAAO;AAEP,SAAS,gBAAgB;AACzB,SAAS,wBAAwB;AACjC,YAAY,WAAW;AACvB,SAAS,oBAAoB;AAC7B,SAAS,6BAA6B;AAsBlC;AAnBG,MAAM,SAAS,MAAM,KAAK,CAAC,YAAyB;AACzD,MAAI;AACF,WAAO;AAGT,QAAM,OAAO,WAAW,UAAU;AAElC,MAAI,CAAC;AACH,WAAO,QAAQ;AAGjB,QAAM,EAAE,UAAU,YAAY,IAAI,SAC5B,SAAS,iBAAiB,sBAAsB,OAAO,CAAC;AAE9D,SAAI,cACK,WAGF;AAAA,IACL;AAAA,MAAC;AAAA;AAAA,QACC,OAAO;AAAA,UACL;AAAA,UACA,UAAU;AAAA,UACV,OAAO;AAAA,UACP,SAAS;AAAA,UACT,eAAe;AAAA,QACjB;AAAA,QAEC;AAAA;AAAA,IACH;AAAA,IACA;AAAA,EACF;AACF,CAAC;",
|
|
5
5
|
"names": []
|
|
6
6
|
}
|
package/dist/esm/Portal.mjs
CHANGED
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import "@tamagui/polyfill-dev";
|
|
2
2
|
import { isServer } from "@tamagui/constants";
|
|
3
|
-
import { YStack } from "@tamagui/stacks";
|
|
4
3
|
import { useStackedZIndex } from "@tamagui/z-index-stack";
|
|
5
4
|
import * as React from "react";
|
|
6
5
|
import { createPortal } from "react-dom";
|
|
@@ -8,25 +7,23 @@ import { getStackedZIndexProps } from "./helpers.mjs";
|
|
|
8
7
|
import { jsx } from "react/jsx-runtime";
|
|
9
8
|
const Portal = React.memo(propsIn => {
|
|
10
9
|
if (isServer) return null;
|
|
10
|
+
const body = globalThis.document?.body;
|
|
11
|
+
if (!body) return propsIn.children;
|
|
11
12
|
const {
|
|
12
|
-
host = globalThis.document?.body,
|
|
13
|
-
stackZIndex,
|
|
14
13
|
children,
|
|
15
|
-
passThrough
|
|
16
|
-
...props
|
|
14
|
+
passThrough
|
|
17
15
|
} = propsIn,
|
|
18
16
|
zIndex = useStackedZIndex(getStackedZIndexProps(propsIn));
|
|
19
|
-
return passThrough ? children : createPortal(/* @__PURE__ */jsx(
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
zIndex,
|
|
17
|
+
return passThrough ? children : createPortal(/* @__PURE__ */jsx("span", {
|
|
18
|
+
style: {
|
|
19
|
+
zIndex,
|
|
20
|
+
position: "absolute",
|
|
21
|
+
inset: 0,
|
|
22
|
+
contain: "strict",
|
|
23
|
+
pointerEvents: "none"
|
|
24
|
+
},
|
|
28
25
|
children
|
|
29
|
-
}),
|
|
26
|
+
}), body);
|
|
30
27
|
});
|
|
31
28
|
export { Portal };
|
|
32
29
|
//# sourceMappingURL=Portal.mjs.map
|
package/dist/esm/Portal.mjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["isServer","
|
|
1
|
+
{"version":3,"names":["isServer","useStackedZIndex","React","createPortal","getStackedZIndexProps","jsx","Portal","memo","propsIn","body","globalThis","document","children","passThrough","zIndex","style","position","inset","contain","pointerEvents"],"sources":["../../src/Portal.tsx"],"sourcesContent":[null],"mappings":"AAAA,OAAO;AAEP,SAASA,QAAA,QAAgB;AACzB,SAASC,gBAAA,QAAwB;AACjC,YAAYC,KAAA,MAAW;AACvB,SAASC,YAAA,QAAoB;AAC7B,SAASC,qBAAA,QAA6B;AAsBlC,SAAAC,GAAA;AAnBG,MAAMC,MAAA,GAASJ,KAAA,CAAMK,IAAA,CAAMC,OAAA,IAAyB;EACzD,IAAIR,QAAA,EACF,OAAO;EAGT,MAAMS,IAAA,GAAOC,UAAA,CAAWC,QAAA,EAAUF,IAAA;EAElC,IAAI,CAACA,IAAA,EACH,OAAOD,OAAA,CAAQI,QAAA;EAGjB,MAAM;MAAEA,QAAA;MAAUC;IAAY,IAAIL,OAAA;IAC5BM,MAAA,GAASb,gBAAA,CAAiBG,qBAAA,CAAsBI,OAAO,CAAC;EAE9D,OAAIK,WAAA,GACKD,QAAA,GAGFT,YAAA,CACL,eAAAE,GAAA,CAAC;IACCU,KAAA,EAAO;MACLD,MAAA;MACAE,QAAA,EAAU;MACVC,KAAA,EAAO;MACPC,OAAA,EAAS;MACTC,aAAA,EAAe;IACjB;IAECP;EAAA,CACH,GACAH,IACF;AACF,CAAC","ignoreList":[]}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
-
import {
|
|
2
|
+
import { View } from "@tamagui/core";
|
|
3
3
|
import { useStackedZIndex } from "@tamagui/z-index-stack";
|
|
4
4
|
import * as React from "react";
|
|
5
5
|
import { RootTagContext } from "react-native";
|
|
@@ -25,21 +25,23 @@ var createPortal = function () {
|
|
|
25
25
|
}
|
|
26
26
|
}(),
|
|
27
27
|
Portal = function (propsIn) {
|
|
28
|
-
var
|
|
29
|
-
stackZIndex,
|
|
30
|
-
...props
|
|
31
|
-
} = propsIn,
|
|
32
|
-
rootTag = React.useContext(RootTagContext),
|
|
28
|
+
var rootTag = React.useContext(RootTagContext),
|
|
33
29
|
zIndex = useStackedZIndex(getStackedZIndexProps(propsIn)),
|
|
34
|
-
|
|
30
|
+
{
|
|
31
|
+
children,
|
|
32
|
+
passThrough
|
|
33
|
+
} = propsIn,
|
|
34
|
+
contents = /* @__PURE__ */_jsx(View, {
|
|
35
35
|
pointerEvents: "box-none",
|
|
36
|
-
fullscreen: !0,
|
|
37
36
|
position: "absolute",
|
|
37
|
+
inset: 0,
|
|
38
38
|
maxWidth: "100%",
|
|
39
|
-
|
|
40
|
-
|
|
39
|
+
zIndex,
|
|
40
|
+
passThrough,
|
|
41
|
+
children
|
|
41
42
|
});
|
|
42
43
|
return !createPortal || !USE_NATIVE_PORTAL || !rootTag ? /* @__PURE__ */_jsx(GorhomPortalItem, {
|
|
44
|
+
passThrough,
|
|
43
45
|
hostName: "root",
|
|
44
46
|
children: contents
|
|
45
47
|
}) : createPortal(contents, rootTag);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["
|
|
1
|
+
{"version":3,"names":["View","useStackedZIndex","React","RootTagContext","IS_FABRIC","USE_NATIVE_PORTAL","GorhomPortalItem","getStackedZIndexProps","createPortal","_ReactFabricShimModule_default","ReactFabricShimModule","require","_ReactFabricShimModule_default_createPortal","default","err","console","info","_ReactNativeShimModule_default","ReactNativeShimModule","_ReactNativeShimModule_default_createPortal","Portal","propsIn","rootTag","useContext","zIndex","children","passThrough","contents","_jsx","pointerEvents","position","inset","maxWidth","hostName"],"sources":["../../src/Portal.native.tsx"],"sourcesContent":[null],"mappings":";AAAA,SAASA,IAAA,QAAY;AACrB,SAASC,gBAAA,QAAwB;AACjC,YAAYC,KAAA,MAAW;AACvB,SAASC,cAAA,QAAsB;AAC/B,SAASC,SAAA,EAAWC,iBAAA,QAAyB;AAC7C,SAASC,gBAAA,QAAwB;AACjC,SAASC,qBAAA,QAA6B;AAGtC,IAAMC,YAAA,GAAgB;IACpB,IAAIJ,SAAA,EACF,IAAI;UAIAK,8BAAA;QAHIC,qBAAA,GAAwBC,OAAA,CAAQ;QAGpCC,2CAAA;MADF,QACEA,2CAAA,GAAAF,qBAAA,aAAAD,8BAAA,GAAAC,qBAAA,CAAuBG,OAAA,MAAO,QAA9BJ,8BAAA,uBAAAA,8BAAA,CAAgCD,YAAA,MAAY,QAA5CI,2CAAA,cAAAA,2CAAA,GAAgDF,qBAAA,CAAsBF,YAAA;IAE1E,SAASM,GAAA,EAAK;MACZ,OAAAC,OAAA,CAAQC,IAAA,CAAK,kEAAkEF,GAAA,GACxE;IACT;IAEF,IAAI;UAKAG,8BAAA;QAJIC,qBAAA,GACJP,OAAA,CAAQ;QAGRQ,2CAAA;MADF,QACEA,2CAAA,GAAAD,qBAAA,aAAAD,8BAAA,GAAAC,qBAAA,CAAuBL,OAAA,MAAO,QAA9BI,8BAAA,uBAAAA,8BAAA,CAAgCT,YAAA,MAAY,QAA5CW,2CAAA,cAAAA,2CAAA,GAAgDD,qBAAA,CAAsBV,YAAA;IAE1E,SAASM,GAAA,EAAK;MACZ,OAAAC,OAAA,CAAQC,IAAA,CAAK,kEAAkEF,GAAA,GACxE;IACT;EACF;EAEaM,MAAA,GAAS,SAAAA,CAACC,OAAA;IACrB,IAAMC,OAAA,GAAUpB,KAAA,CAAMqB,UAAA,CAAWpB,cAAA;MAC3BqB,MAAA,GAASvB,gBAAA,CAAiBM,qBAAA,CAAsBc,OAAA;MAEhD;QAAEI,QAAA;QAAUC;MAAW,IAAKL,OAAA;MAE5BM,QAAA,GACJ,eAAAC,IAAA,CAAC5B,IAAA;QACC6B,aAAA,EAAc;QACdC,QAAA,EAAS;QACTC,KAAA,EAAO;QACPC,QAAA,EAAS;QACTR,MAAA;QACAE,WAAA;;;IAMJ,OAAI,CAAClB,YAAA,IAAgB,CAACH,iBAAA,IAAqB,CAACiB,OAAA,GAExC,eAAAM,IAAA,CAACtB,gBAAA;MAAiBoB,WAAA;MAA0BO,QAAA,EAAS;gBAClDN;SAKAnB,YAAA,CAAamB,QAAA,EAAUL,OAAA;EAChC","ignoreList":[]}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tamagui/portal",
|
|
3
|
-
"version": "1.130.
|
|
3
|
+
"version": "1.130.4",
|
|
4
4
|
"source": "src/index.ts",
|
|
5
5
|
"types": "./types/index.d.ts",
|
|
6
6
|
"main": "dist/cjs",
|
|
@@ -32,15 +32,14 @@
|
|
|
32
32
|
}
|
|
33
33
|
},
|
|
34
34
|
"dependencies": {
|
|
35
|
-
"@tamagui/constants": "1.130.
|
|
36
|
-
"@tamagui/core": "1.130.
|
|
37
|
-
"@tamagui/
|
|
38
|
-
"@tamagui/
|
|
39
|
-
"@tamagui/
|
|
40
|
-
"@tamagui/z-index-stack": "1.130.2"
|
|
35
|
+
"@tamagui/constants": "1.130.4",
|
|
36
|
+
"@tamagui/core": "1.130.4",
|
|
37
|
+
"@tamagui/start-transition": "1.130.4",
|
|
38
|
+
"@tamagui/use-event": "1.130.4",
|
|
39
|
+
"@tamagui/z-index-stack": "1.130.4"
|
|
41
40
|
},
|
|
42
41
|
"devDependencies": {
|
|
43
|
-
"@tamagui/build": "1.130.
|
|
42
|
+
"@tamagui/build": "1.130.4",
|
|
44
43
|
"@types/react-dom": "^19.1.6",
|
|
45
44
|
"react-native": "^0.79.2"
|
|
46
45
|
},
|
package/src/Portal.native.tsx
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { View } from '@tamagui/core'
|
|
2
2
|
import { useStackedZIndex } from '@tamagui/z-index-stack'
|
|
3
3
|
import * as React from 'react'
|
|
4
4
|
import { RootTagContext } from 'react-native'
|
|
@@ -34,24 +34,30 @@ const createPortal = (() => {
|
|
|
34
34
|
})()
|
|
35
35
|
|
|
36
36
|
export const Portal = (propsIn: PortalProps) => {
|
|
37
|
-
const { stackZIndex, ...props } = propsIn
|
|
38
|
-
|
|
39
37
|
const rootTag = React.useContext(RootTagContext)
|
|
40
38
|
const zIndex = useStackedZIndex(getStackedZIndexProps(propsIn))
|
|
41
39
|
|
|
40
|
+
const { children, passThrough } = propsIn
|
|
41
|
+
|
|
42
42
|
const contents = (
|
|
43
|
-
<
|
|
43
|
+
<View
|
|
44
44
|
pointerEvents="box-none"
|
|
45
|
-
fullscreen
|
|
46
45
|
position="absolute"
|
|
46
|
+
inset={0}
|
|
47
47
|
maxWidth="100%"
|
|
48
|
-
{...props}
|
|
49
48
|
zIndex={zIndex}
|
|
50
|
-
|
|
49
|
+
passThrough={passThrough}
|
|
50
|
+
>
|
|
51
|
+
{children}
|
|
52
|
+
</View>
|
|
51
53
|
)
|
|
52
54
|
|
|
53
55
|
if (!createPortal || !USE_NATIVE_PORTAL || !rootTag) {
|
|
54
|
-
return
|
|
56
|
+
return (
|
|
57
|
+
<GorhomPortalItem passThrough={passThrough} hostName="root">
|
|
58
|
+
{contents}
|
|
59
|
+
</GorhomPortalItem>
|
|
60
|
+
)
|
|
55
61
|
}
|
|
56
62
|
|
|
57
63
|
return createPortal(contents, rootTag)
|
package/src/Portal.tsx
CHANGED
|
@@ -1,27 +1,24 @@
|
|
|
1
1
|
import '@tamagui/polyfill-dev'
|
|
2
2
|
|
|
3
3
|
import { isServer } from '@tamagui/constants'
|
|
4
|
-
import { YStack } from '@tamagui/stacks'
|
|
5
4
|
import { useStackedZIndex } from '@tamagui/z-index-stack'
|
|
6
5
|
import * as React from 'react'
|
|
7
6
|
import { createPortal } from 'react-dom'
|
|
8
7
|
import { getStackedZIndexProps } from './helpers'
|
|
9
8
|
import type { PortalProps } from './PortalProps'
|
|
10
9
|
|
|
11
|
-
// web only version
|
|
12
|
-
|
|
13
10
|
export const Portal = React.memo((propsIn: PortalProps) => {
|
|
14
11
|
if (isServer) {
|
|
15
12
|
return null
|
|
16
13
|
}
|
|
17
14
|
|
|
18
|
-
const
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
children
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
} = propsIn
|
|
15
|
+
const body = globalThis.document?.body
|
|
16
|
+
|
|
17
|
+
if (!body) {
|
|
18
|
+
return propsIn.children
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
const { children, passThrough } = propsIn
|
|
25
22
|
const zIndex = useStackedZIndex(getStackedZIndexProps(propsIn))
|
|
26
23
|
|
|
27
24
|
if (passThrough) {
|
|
@@ -29,19 +26,17 @@ export const Portal = React.memo((propsIn: PortalProps) => {
|
|
|
29
26
|
}
|
|
30
27
|
|
|
31
28
|
return createPortal(
|
|
32
|
-
<
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
{...props}
|
|
41
|
-
zIndex={zIndex}
|
|
29
|
+
<span
|
|
30
|
+
style={{
|
|
31
|
+
zIndex,
|
|
32
|
+
position: 'absolute',
|
|
33
|
+
inset: 0,
|
|
34
|
+
contain: 'strict',
|
|
35
|
+
pointerEvents: 'none',
|
|
36
|
+
}}
|
|
42
37
|
>
|
|
43
38
|
{children}
|
|
44
|
-
</
|
|
45
|
-
|
|
46
|
-
)
|
|
39
|
+
</span>,
|
|
40
|
+
body
|
|
41
|
+
)
|
|
47
42
|
})
|
package/src/PortalProps.tsx
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import type {
|
|
2
|
-
import type { StackZIndexProp } from '@tamagui/z-index-stack/types'
|
|
1
|
+
import type { StackZIndexProp } from '@tamagui/z-index-stack'
|
|
3
2
|
|
|
4
|
-
export type PortalProps =
|
|
5
|
-
|
|
6
|
-
|
|
3
|
+
export type PortalProps = {
|
|
4
|
+
zIndex?: number
|
|
5
|
+
passThrough?: boolean
|
|
7
6
|
stackZIndex?: StackZIndexProp
|
|
7
|
+
children?: React.ReactNode
|
|
8
8
|
}
|
package/types/Portal.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import '@tamagui/polyfill-dev';
|
|
2
2
|
import * as React from 'react';
|
|
3
3
|
import type { PortalProps } from './PortalProps';
|
|
4
|
-
export declare const Portal: React.MemoExoticComponent<(propsIn: PortalProps) =>
|
|
4
|
+
export declare const Portal: React.MemoExoticComponent<(propsIn: PortalProps) => React.ReactNode>;
|
|
5
5
|
//# sourceMappingURL=Portal.d.ts.map
|
package/types/Portal.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Portal.d.ts","sourceRoot":"","sources":["../src/Portal.tsx"],"names":[],"mappings":"AAAA,OAAO,uBAAuB,CAAA;
|
|
1
|
+
{"version":3,"file":"Portal.d.ts","sourceRoot":"","sources":["../src/Portal.tsx"],"names":[],"mappings":"AAAA,OAAO,uBAAuB,CAAA;AAI9B,OAAO,KAAK,KAAK,MAAM,OAAO,CAAA;AAG9B,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,eAAe,CAAA;AAEhD,eAAO,MAAM,MAAM,sCAAwB,WAAW,qBAgCpD,CAAA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Portal.native.d.ts","sourceRoot":"","sources":["../src/Portal.native.tsx"],"names":[],"mappings":"AAOA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,eAAe,CAAA;AA4BhD,eAAO,MAAM,MAAM,GAAI,SAAS,WAAW,
|
|
1
|
+
{"version":3,"file":"Portal.native.d.ts","sourceRoot":"","sources":["../src/Portal.native.tsx"],"names":[],"mappings":"AAOA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,eAAe,CAAA;AA4BhD,eAAO,MAAM,MAAM,GAAI,SAAS,WAAW,QA4B1C,CAAA"}
|
package/types/PortalProps.d.ts
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import type {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
inactive?: boolean;
|
|
1
|
+
import type { StackZIndexProp } from '@tamagui/z-index-stack';
|
|
2
|
+
export type PortalProps = {
|
|
3
|
+
zIndex?: number;
|
|
4
|
+
passThrough?: boolean;
|
|
6
5
|
stackZIndex?: StackZIndexProp;
|
|
6
|
+
children?: React.ReactNode;
|
|
7
7
|
};
|
|
8
8
|
//# sourceMappingURL=PortalProps.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"PortalProps.d.ts","sourceRoot":"","sources":["../src/PortalProps.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,
|
|
1
|
+
{"version":3,"file":"PortalProps.d.ts","sourceRoot":"","sources":["../src/PortalProps.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,wBAAwB,CAAA;AAE7D,MAAM,MAAM,WAAW,GAAG;IACxB,MAAM,CAAC,EAAE,MAAM,CAAA;IACf,WAAW,CAAC,EAAE,OAAO,CAAA;IACrB,WAAW,CAAC,EAAE,eAAe,CAAA;IAC7B,QAAQ,CAAC,EAAE,KAAK,CAAC,SAAS,CAAA;CAC3B,CAAA"}
|