@tamagui/portal 1.0.0-beta.8 → 1.0.1-beta.101

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.
@@ -18,7 +18,6 @@ var __spreadValues = (a, b) => {
18
18
  }
19
19
  return a;
20
20
  };
21
- var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
22
21
  var __export = (target, all) => {
23
22
  for (var name in all)
24
23
  __defProp(target, name, { get: all[name], enumerable: true });
@@ -44,14 +43,17 @@ var import_stacks = require("@tamagui/stacks");
44
43
  var React = __toESM(require("react"));
45
44
  var import_react_dom = require("react-dom");
46
45
  var import_react_native = require("react-native");
47
- const Portal = /* @__PURE__ */ __name((props) => {
46
+ const Portal = (props) => {
48
47
  const contents = /* @__PURE__ */ React.createElement(import_stacks.YStack, __spreadValues({
49
48
  pointerEvents: "none",
50
- fullscreen: true
49
+ fullscreen: true,
50
+ position: import_core.isWeb ? "fixed" : "absolute"
51
51
  }, props));
52
52
  if (!import_core.isWeb) {
53
53
  return /* @__PURE__ */ React.createElement(import_react_native.Modal, {
54
- visible: true
54
+ visible: true,
55
+ transparent: true,
56
+ pointerEvents: "none"
55
57
  }, contents);
56
58
  }
57
59
  const [hostElement, setHostElement] = React.useState(null);
@@ -63,7 +65,7 @@ const Portal = /* @__PURE__ */ __name((props) => {
63
65
  return (0, import_react_dom.createPortal)(contents, hostElement);
64
66
  }
65
67
  return null;
66
- }, "Portal");
68
+ };
67
69
  // Annotate the CommonJS export names for ESM import in node:
68
70
  0 && (module.exports = {
69
71
  Portal
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../src/Portal.tsx"],
4
- "sourcesContent": ["import '@tamagui/polyfill-dev'\n\nimport { isWeb, useIsomorphicLayoutEffect } from '@tamagui/core'\nimport { YStack, YStackProps } from '@tamagui/stacks'\nimport * as React from 'react'\nimport { createPortal } from 'react-dom'\nimport { Modal } from 'react-native'\n\n// todo extract to package\nexport const Portal = (props: YStackProps) => {\n const contents = <YStack pointerEvents=\"none\" fullscreen {...props} />\n if (!isWeb) {\n return <Modal visible>{contents}</Modal>\n }\n const [hostElement, setHostElement] = React.useState<any>(null)\n\n useIsomorphicLayoutEffect(() => {\n setHostElement(globalThis.document?.body)\n }, [])\n\n if (hostElement) {\n return createPortal(contents, hostElement)\n }\n // ssr return null\n return null\n}\n"],
5
- "mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,0BAAO;AAEP,kBAAiD;AACjD,oBAAoC;AACpC,YAAuB;AACvB,uBAA6B;AAC7B,0BAAsB;AAGf,MAAM,SAAS,wBAAC,UAAuB;AAC5C,QAAM,WAAW,oCAAC;AAAA,IAAO,eAAc;AAAA,IAAO,YAAU;AAAA,KAAK,MAAO;AACpE,MAAI,CAAC,mBAAO;AACV,WAAO,oCAAC;AAAA,MAAM,SAAO;AAAA,OAAE,QAAS;AAAA,EAClC;AACA,QAAM,CAAC,aAAa,kBAAkB,MAAM,SAAc,IAAI;AAE9D,6CAA0B,MAAM;AAhBlC;AAiBI,mBAAe,iBAAW,aAAX,mBAAqB,IAAI;AAAA,EAC1C,GAAG,CAAC,CAAC;AAEL,MAAI,aAAa;AACf,WAAO,mCAAa,UAAU,WAAW;AAAA,EAC3C;AAEA,SAAO;AACT,GAhBsB;",
4
+ "sourcesContent": ["/* eslint-disable react-hooks/rules-of-hooks */\nimport '@tamagui/polyfill-dev'\n\nimport { isWeb, useIsomorphicLayoutEffect } from '@tamagui/core'\nimport { YStack, YStackProps } from '@tamagui/stacks'\nimport * as React from 'react'\nimport { createPortal } from 'react-dom'\nimport { Modal } from 'react-native'\n\nexport type PortalProps = YStackProps\n\nexport const Portal = (props: PortalProps) => {\n const contents = (\n <YStack\n pointerEvents=\"none\"\n fullscreen\n // @ts-expect-error ok on web\n position={isWeb ? 'fixed' : 'absolute'}\n {...props}\n />\n )\n\n if (!isWeb) {\n // check if theme stays in context here\n return (\n <Modal visible transparent pointerEvents=\"none\">\n {contents}\n </Modal>\n )\n }\n\n const [hostElement, setHostElement] = React.useState<any>(null)\n\n useIsomorphicLayoutEffect(() => {\n setHostElement(globalThis.document?.body)\n }, [])\n\n if (hostElement) {\n return createPortal(contents, hostElement)\n }\n\n // ssr return null\n return null\n}\n"],
5
+ "mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AACA,0BAAO;AAEP,kBAAiD;AACjD,oBAAoC;AACpC,YAAuB;AACvB,uBAA6B;AAC7B,0BAAsB;AAIf,MAAM,SAAS,CAAC,UAAuB;AAC5C,QAAM,WACJ,oCAAC;AAAA,IACC,eAAc;AAAA,IACd,YAAU;AAAA,IAEV,UAAU,oBAAQ,UAAU;AAAA,KACxB,MACN;AAGF,MAAI,CAAC,mBAAO;AAEV,WACE,oCAAC;AAAA,MAAM,SAAO;AAAA,MAAC,aAAW;AAAA,MAAC,eAAc;AAAA,OACtC,QACH;AAAA,EAEJ;AAEA,QAAM,CAAC,aAAa,kBAAkB,MAAM,SAAc,IAAI;AAE9D,6CAA0B,MAAM;AAjClC;AAkCI,mBAAe,iBAAW,aAAX,mBAAqB,IAAI;AAAA,EAC1C,GAAG,CAAC,CAAC;AAEL,MAAI,aAAa;AACf,WAAO,mCAAa,UAAU,WAAW;AAAA,EAC3C;AAGA,SAAO;AACT;",
6
6
  "names": []
7
7
  }
@@ -1,20 +1,36 @@
1
1
  var __defProp = Object.defineProperty;
2
- var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
2
+ var __getOwnPropSymbols = Object.getOwnPropertySymbols;
3
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
4
+ var __propIsEnum = Object.prototype.propertyIsEnumerable;
5
+ var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
6
+ var __spreadValues = (a, b) => {
7
+ for (var prop in b || (b = {}))
8
+ if (__hasOwnProp.call(b, prop))
9
+ __defNormalProp(a, prop, b[prop]);
10
+ if (__getOwnPropSymbols)
11
+ for (var prop of __getOwnPropSymbols(b)) {
12
+ if (__propIsEnum.call(b, prop))
13
+ __defNormalProp(a, prop, b[prop]);
14
+ }
15
+ return a;
16
+ };
3
17
  import "@tamagui/polyfill-dev";
4
18
  import { isWeb, useIsomorphicLayoutEffect } from "@tamagui/core";
5
19
  import { YStack } from "@tamagui/stacks";
6
20
  import * as React from "react";
7
21
  import { createPortal } from "react-dom";
8
22
  import { Modal } from "react-native";
9
- const Portal = /* @__PURE__ */ __name((props) => {
10
- const contents = /* @__PURE__ */ React.createElement(YStack, {
23
+ const Portal = (props) => {
24
+ const contents = /* @__PURE__ */ React.createElement(YStack, __spreadValues({
11
25
  pointerEvents: "none",
12
26
  fullscreen: true,
13
- ...props
14
- });
27
+ position: isWeb ? "fixed" : "absolute"
28
+ }, props));
15
29
  if (!isWeb) {
16
30
  return /* @__PURE__ */ React.createElement(Modal, {
17
- visible: true
31
+ visible: true,
32
+ transparent: true,
33
+ pointerEvents: "none"
18
34
  }, contents);
19
35
  }
20
36
  const [hostElement, setHostElement] = React.useState(null);
@@ -26,7 +42,7 @@ const Portal = /* @__PURE__ */ __name((props) => {
26
42
  return createPortal(contents, hostElement);
27
43
  }
28
44
  return null;
29
- }, "Portal");
45
+ };
30
46
  export {
31
47
  Portal
32
48
  };
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../src/Portal.tsx"],
4
- "sourcesContent": ["import '@tamagui/polyfill-dev'\n\nimport { isWeb, useIsomorphicLayoutEffect } from '@tamagui/core'\nimport { YStack, YStackProps } from '@tamagui/stacks'\nimport * as React from 'react'\nimport { createPortal } from 'react-dom'\nimport { Modal } from 'react-native'\n\n// todo extract to package\nexport const Portal = (props: YStackProps) => {\n const contents = <YStack pointerEvents=\"none\" fullscreen {...props} />\n if (!isWeb) {\n return <Modal visible>{contents}</Modal>\n }\n const [hostElement, setHostElement] = React.useState<any>(null)\n\n useIsomorphicLayoutEffect(() => {\n setHostElement(globalThis.document?.body)\n }, [])\n\n if (hostElement) {\n return createPortal(contents, hostElement)\n }\n // ssr return null\n return null\n}\n"],
5
- "mappings": ";;AAAA;AAEA;AACA;AACA;AACA;AACA;AAGO,MAAM,SAAS,wBAAC,UAAuB;AAC5C,QAAM,WAAW,oCAAC;AAAA,IAAO,eAAc;AAAA,IAAO,YAAU;AAAA,OAAK;AAAA,GAAO;AACpE,MAAI,CAAC,OAAO;AACV,WAAO,oCAAC;AAAA,MAAM,SAAO;AAAA,OAAE,QAAS;AAAA,EAClC;AACA,QAAM,CAAC,aAAa,kBAAkB,MAAM,SAAc,IAAI;AAE9D,4BAA0B,MAAM;AAhBlC;AAiBI,mBAAe,iBAAW,aAAX,mBAAqB,IAAI;AAAA,EAC1C,GAAG,CAAC,CAAC;AAEL,MAAI,aAAa;AACf,WAAO,aAAa,UAAU,WAAW;AAAA,EAC3C;AAEA,SAAO;AACT,GAhBsB;",
4
+ "sourcesContent": ["/* eslint-disable react-hooks/rules-of-hooks */\nimport '@tamagui/polyfill-dev'\n\nimport { isWeb, useIsomorphicLayoutEffect } from '@tamagui/core'\nimport { YStack, YStackProps } from '@tamagui/stacks'\nimport * as React from 'react'\nimport { createPortal } from 'react-dom'\nimport { Modal } from 'react-native'\n\nexport type PortalProps = YStackProps\n\nexport const Portal = (props: PortalProps) => {\n const contents = (\n <YStack\n pointerEvents=\"none\"\n fullscreen\n // @ts-expect-error ok on web\n position={isWeb ? 'fixed' : 'absolute'}\n {...props}\n />\n )\n\n if (!isWeb) {\n // check if theme stays in context here\n return (\n <Modal visible transparent pointerEvents=\"none\">\n {contents}\n </Modal>\n )\n }\n\n const [hostElement, setHostElement] = React.useState<any>(null)\n\n useIsomorphicLayoutEffect(() => {\n setHostElement(globalThis.document?.body)\n }, [])\n\n if (hostElement) {\n return createPortal(contents, hostElement)\n }\n\n // ssr return null\n return null\n}\n"],
5
+ "mappings": ";;;;;;;;;;;;;;;;AACA;AAEA;AACA;AACA;AACA;AACA;AAIO,MAAM,SAAS,CAAC,UAAuB;AAC5C,QAAM,WACJ,oCAAC;AAAA,IACC,eAAc;AAAA,IACd,YAAU;AAAA,IAEV,UAAU,QAAQ,UAAU;AAAA,KACxB,MACN;AAGF,MAAI,CAAC,OAAO;AAEV,WACE,oCAAC;AAAA,MAAM,SAAO;AAAA,MAAC,aAAW;AAAA,MAAC,eAAc;AAAA,OACtC,QACH;AAAA,EAEJ;AAEA,QAAM,CAAC,aAAa,kBAAkB,MAAM,SAAc,IAAI;AAE9D,4BAA0B,MAAM;AAjClC;AAkCI,mBAAe,iBAAW,aAAX,mBAAqB,IAAI;AAAA,EAC1C,GAAG,CAAC,CAAC;AAEL,MAAI,aAAa;AACf,WAAO,aAAa,UAAU,WAAW;AAAA,EAC3C;AAGA,SAAO;AACT;",
6
6
  "names": []
7
7
  }
@@ -1,15 +1,13 @@
1
- var __defProp = Object.defineProperty;
2
- var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
3
1
  import "@tamagui/polyfill-dev";
4
2
  import { isWeb, useIsomorphicLayoutEffect } from "@tamagui/core";
5
3
  import { YStack } from "@tamagui/stacks";
6
4
  import * as React from "react";
7
5
  import { createPortal } from "react-dom";
8
6
  import { Modal } from "react-native";
9
- const Portal = /* @__PURE__ */ __name((props) => {
10
- const contents = <YStack pointerEvents="none" fullscreen {...props} />;
7
+ const Portal = (props) => {
8
+ const contents = <YStack pointerEvents="none" fullscreen position={isWeb ? "fixed" : "absolute"} {...props} />;
11
9
  if (!isWeb) {
12
- return <Modal visible>{contents}</Modal>;
10
+ return <Modal visible transparent pointerEvents="none">{contents}</Modal>;
13
11
  }
14
12
  const [hostElement, setHostElement] = React.useState(null);
15
13
  useIsomorphicLayoutEffect(() => {
@@ -20,7 +18,8 @@ const Portal = /* @__PURE__ */ __name((props) => {
20
18
  return createPortal(contents, hostElement);
21
19
  }
22
20
  return null;
23
- }, "Portal");
21
+ };
24
22
  export {
25
23
  Portal
26
24
  };
25
+ //# sourceMappingURL=Portal.js.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../src/Portal.tsx"],
4
+ "sourcesContent": ["/* eslint-disable react-hooks/rules-of-hooks */\nimport '@tamagui/polyfill-dev'\n\nimport { isWeb, useIsomorphicLayoutEffect } from '@tamagui/core'\nimport { YStack, YStackProps } from '@tamagui/stacks'\nimport * as React from 'react'\nimport { createPortal } from 'react-dom'\nimport { Modal } from 'react-native'\n\nexport type PortalProps = YStackProps\n\nexport const Portal = (props: PortalProps) => {\n const contents = (\n <YStack\n pointerEvents=\"none\"\n fullscreen\n // @ts-expect-error ok on web\n position={isWeb ? 'fixed' : 'absolute'}\n {...props}\n />\n )\n\n if (!isWeb) {\n // check if theme stays in context here\n return (\n <Modal visible transparent pointerEvents=\"none\">\n {contents}\n </Modal>\n )\n }\n\n const [hostElement, setHostElement] = React.useState<any>(null)\n\n useIsomorphicLayoutEffect(() => {\n setHostElement(globalThis.document?.body)\n }, [])\n\n if (hostElement) {\n return createPortal(contents, hostElement)\n }\n\n // ssr return null\n return null\n}\n"],
5
+ "mappings": "AACA;AAEA;AACA;AACA;AACA;AACA;AAIO,MAAM,SAAS,CAAC,UAAuB;AAC5C,QAAM,WACJ,CAAC,OACC,cAAc,OACd,WAEA,UAAU,QAAQ,UAAU,gBACxB,OACN;AAGF,MAAI,CAAC,OAAO;AAEV,WACE,CAAC,MAAM,QAAQ,YAAY,cAAc,QACtC,SACH,EAFC;AAAA,EAIL;AAEA,QAAM,CAAC,aAAa,kBAAkB,MAAM,SAAc,IAAI;AAE9D,4BAA0B,MAAM;AAjClC;AAkCI,mBAAe,iBAAW,aAAX,mBAAqB,IAAI;AAAA,EAC1C,GAAG,CAAC,CAAC;AAEL,MAAI,aAAa;AACf,WAAO,aAAa,UAAU,WAAW;AAAA,EAC3C;AAGA,SAAO;AACT;",
6
+ "names": []
7
+ }
package/dist/jsx/index.js CHANGED
@@ -1 +1,2 @@
1
1
  export * from "./Portal";
2
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../src/index.tsx"],
4
+ "sourcesContent": ["export * from './Portal'\n"],
5
+ "mappings": "AAAA;",
6
+ "names": []
7
+ }
package/package.json CHANGED
@@ -1,13 +1,13 @@
1
1
  {
2
2
  "name": "@tamagui/portal",
3
- "version": "1.0.0-beta.8",
4
- "sideEffects": true,
3
+ "version": "1.0.1-beta.101",
5
4
  "source": "src/index.ts",
6
- "typings": "types",
5
+ "types": "./types/index.d.ts",
7
6
  "main": "dist/cjs",
8
7
  "module": "dist/esm",
9
8
  "module:jsx": "dist/jsx",
10
9
  "files": [
10
+ "src",
11
11
  "types",
12
12
  "dist"
13
13
  ],
@@ -18,7 +18,7 @@
18
18
  "clean:build": "tamagui-build clean:build"
19
19
  },
20
20
  "dependencies": {
21
- "@tamagui/stacks": "^1.0.0-beta.8"
21
+ "@tamagui/stacks": "^1.0.1-beta.101"
22
22
  },
23
23
  "peerDependencies": {
24
24
  "react": "*",
@@ -26,8 +26,8 @@
26
26
  "react-native": "*"
27
27
  },
28
28
  "devDependencies": {
29
- "@tamagui/build": "^1.0.0-beta.8",
30
- "@types/react-native": "^0.67.3",
29
+ "@tamagui/build": "^1.0.1-beta.101",
30
+ "@types/react-native": "^0.69.2",
31
31
  "react": "*",
32
32
  "react-dom": "*",
33
33
  "react-native": "*"
package/src/Portal.tsx ADDED
@@ -0,0 +1,44 @@
1
+ /* eslint-disable react-hooks/rules-of-hooks */
2
+ import '@tamagui/polyfill-dev'
3
+
4
+ import { isWeb, useIsomorphicLayoutEffect } from '@tamagui/core'
5
+ import { YStack, YStackProps } from '@tamagui/stacks'
6
+ import * as React from 'react'
7
+ import { createPortal } from 'react-dom'
8
+ import { Modal } from 'react-native'
9
+
10
+ export type PortalProps = YStackProps
11
+
12
+ export const Portal = (props: PortalProps) => {
13
+ const contents = (
14
+ <YStack
15
+ pointerEvents="none"
16
+ fullscreen
17
+ // @ts-expect-error ok on web
18
+ position={isWeb ? 'fixed' : 'absolute'}
19
+ {...props}
20
+ />
21
+ )
22
+
23
+ if (!isWeb) {
24
+ // check if theme stays in context here
25
+ return (
26
+ <Modal visible transparent pointerEvents="none">
27
+ {contents}
28
+ </Modal>
29
+ )
30
+ }
31
+
32
+ const [hostElement, setHostElement] = React.useState<any>(null)
33
+
34
+ useIsomorphicLayoutEffect(() => {
35
+ setHostElement(globalThis.document?.body)
36
+ }, [])
37
+
38
+ if (hostElement) {
39
+ return createPortal(contents, hostElement)
40
+ }
41
+
42
+ // ssr return null
43
+ return null
44
+ }
package/src/index.tsx ADDED
@@ -0,0 +1 @@
1
+ export * from './Portal'
package/types/Portal.d.ts CHANGED
@@ -1,5 +1,5 @@
1
- /// <reference types="react" />
2
1
  import '@tamagui/polyfill-dev';
3
2
  import { YStackProps } from '@tamagui/stacks';
4
- export declare const Portal: (props: YStackProps) => JSX.Element | null;
3
+ export declare type PortalProps = YStackProps;
4
+ export declare const Portal: (props: PortalProps) => JSX.Element | null;
5
5
  //# sourceMappingURL=Portal.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"Portal.d.ts","sourceRoot":"","sources":["../src/Portal.tsx"],"names":[],"mappings":";AAAA,OAAO,uBAAuB,CAAA;AAG9B,OAAO,EAAU,WAAW,EAAE,MAAM,iBAAiB,CAAA;AAMrD,eAAO,MAAM,MAAM,UAAW,WAAW,uBAgBxC,CAAA"}
1
+ {"version":3,"file":"Portal.d.ts","sourceRoot":"","sources":["../src/Portal.tsx"],"names":[],"mappings":"AACA,OAAO,uBAAuB,CAAA;AAG9B,OAAO,EAAU,WAAW,EAAE,MAAM,iBAAiB,CAAA;AAKrD,oBAAY,WAAW,GAAG,WAAW,CAAA;AAErC,eAAO,MAAM,MAAM,UAAW,WAAW,uBAgCxC,CAAA"}
package/types/index.d.ts CHANGED
File without changes
File without changes