@fluentui/react-portal 9.0.0-rc.3 → 9.0.0-rc.6

Sign up to get free protection for your applications and to get access to all the features.
package/CHANGELOG.json CHANGED
@@ -2,7 +2,108 @@
2
2
  "name": "@fluentui/react-portal",
3
3
  "entries": [
4
4
  {
5
- "date": "Fri, 18 Feb 2022 13:33:48 GMT",
5
+ "date": "Tue, 19 Apr 2022 19:13:58 GMT",
6
+ "tag": "@fluentui/react-portal_v9.0.0-rc.6",
7
+ "version": "9.0.0-rc.6",
8
+ "comments": {
9
+ "prerelease": [
10
+ {
11
+ "author": "olfedias@microsoft.com",
12
+ "package": "@fluentui/react-portal",
13
+ "commit": "8e3c8527ab8f6779dc3db03fd14d1d77b7fcf709",
14
+ "comment": "update `mountNode` types to accept HTMLElement"
15
+ },
16
+ {
17
+ "author": "beachball",
18
+ "package": "@fluentui/react-portal",
19
+ "comment": "Bump @fluentui/react-shared-contexts to v9.0.0-rc.5",
20
+ "commit": "9c8592decacb9f7b1dc608a03c9f991918806008"
21
+ },
22
+ {
23
+ "author": "beachball",
24
+ "package": "@fluentui/react-portal",
25
+ "comment": "Bump @fluentui/react-tabster to v9.0.0-rc.6",
26
+ "commit": "9c8592decacb9f7b1dc608a03c9f991918806008"
27
+ },
28
+ {
29
+ "author": "beachball",
30
+ "package": "@fluentui/react-portal",
31
+ "comment": "Bump @fluentui/react-utilities to v9.0.0-rc.6",
32
+ "commit": "9c8592decacb9f7b1dc608a03c9f991918806008"
33
+ }
34
+ ],
35
+ "none": [
36
+ {
37
+ "author": "mgodbolt@microsoft.com",
38
+ "package": "@fluentui/react-portal",
39
+ "commit": "905e46db07ada986fd7885531f72a71b7bbaabdc",
40
+ "comment": "create v9 api extractor config and set all v9 packags to use it, suppress forgotten export"
41
+ },
42
+ {
43
+ "author": "elcraig@microsoft.com",
44
+ "package": "@fluentui/react-portal",
45
+ "commit": "b7f17e976f9e058f39c9fce4f0f9bb6eb4dfa577",
46
+ "comment": "Update React dev deps and hoist them to the repo root"
47
+ }
48
+ ]
49
+ }
50
+ },
51
+ {
52
+ "date": "Fri, 04 Mar 2022 05:17:38 GMT",
53
+ "tag": "@fluentui/react-portal_v9.0.0-rc.5",
54
+ "version": "9.0.0-rc.5",
55
+ "comments": {
56
+ "prerelease": [
57
+ {
58
+ "author": "dzearing@microsoft.com",
59
+ "package": "@fluentui/react-portal",
60
+ "commit": "f2f1c0ea948cc3517eeb442c05433eb0918def29",
61
+ "comment": "Adding explicit export maps on all consumer packages for FUIR 8 and 9."
62
+ },
63
+ {
64
+ "author": "beachball",
65
+ "package": "@fluentui/react-portal",
66
+ "comment": "Bump @fluentui/react-shared-contexts to v9.0.0-rc.4",
67
+ "commit": "1494f0b620f6d5aae7f0aef33fc9e8f6eb7f8749"
68
+ },
69
+ {
70
+ "author": "beachball",
71
+ "package": "@fluentui/react-portal",
72
+ "comment": "Bump @fluentui/react-tabster to v9.0.0-rc.5",
73
+ "commit": "1494f0b620f6d5aae7f0aef33fc9e8f6eb7f8749"
74
+ },
75
+ {
76
+ "author": "beachball",
77
+ "package": "@fluentui/react-portal",
78
+ "comment": "Bump @fluentui/react-utilities to v9.0.0-rc.5",
79
+ "commit": "1494f0b620f6d5aae7f0aef33fc9e8f6eb7f8749"
80
+ }
81
+ ]
82
+ }
83
+ },
84
+ {
85
+ "date": "Tue, 01 Mar 2022 02:17:40 GMT",
86
+ "tag": "@fluentui/react-portal_v9.0.0-rc.4",
87
+ "version": "9.0.0-rc.4",
88
+ "comments": {
89
+ "prerelease": [
90
+ {
91
+ "author": "beachball",
92
+ "package": "@fluentui/react-portal",
93
+ "comment": "Bump @fluentui/react-tabster to v9.0.0-rc.4",
94
+ "commit": "0bc1e755543ed69443d5d03e1976c630583242f7"
95
+ },
96
+ {
97
+ "author": "beachball",
98
+ "package": "@fluentui/react-portal",
99
+ "comment": "Bump @fluentui/react-utilities to v9.0.0-rc.4",
100
+ "commit": "0bc1e755543ed69443d5d03e1976c630583242f7"
101
+ }
102
+ ]
103
+ }
104
+ },
105
+ {
106
+ "date": "Fri, 18 Feb 2022 13:35:33 GMT",
6
107
  "tag": "@fluentui/react-portal_v9.0.0-rc.3",
7
108
  "version": "9.0.0-rc.3",
8
109
  "comments": {
package/CHANGELOG.md CHANGED
@@ -1,12 +1,46 @@
1
1
  # Change Log - @fluentui/react-portal
2
2
 
3
- This log was last generated on Fri, 18 Feb 2022 13:33:48 GMT and should not be manually modified.
3
+ This log was last generated on Tue, 19 Apr 2022 19:13:58 GMT and should not be manually modified.
4
4
 
5
5
  <!-- Start content -->
6
6
 
7
+ ## [9.0.0-rc.6](https://github.com/microsoft/fluentui/tree/@fluentui/react-portal_v9.0.0-rc.6)
8
+
9
+ Tue, 19 Apr 2022 19:13:58 GMT
10
+ [Compare changes](https://github.com/microsoft/fluentui/compare/@fluentui/react-portal_v9.0.0-rc.5..@fluentui/react-portal_v9.0.0-rc.6)
11
+
12
+ ### Changes
13
+
14
+ - update `mountNode` types to accept HTMLElement ([PR #22153](https://github.com/microsoft/fluentui/pull/22153) by olfedias@microsoft.com)
15
+ - Bump @fluentui/react-shared-contexts to v9.0.0-rc.5 ([PR #22367](https://github.com/microsoft/fluentui/pull/22367) by beachball)
16
+ - Bump @fluentui/react-tabster to v9.0.0-rc.6 ([PR #22367](https://github.com/microsoft/fluentui/pull/22367) by beachball)
17
+ - Bump @fluentui/react-utilities to v9.0.0-rc.6 ([PR #22367](https://github.com/microsoft/fluentui/pull/22367) by beachball)
18
+
19
+ ## [9.0.0-rc.5](https://github.com/microsoft/fluentui/tree/@fluentui/react-portal_v9.0.0-rc.5)
20
+
21
+ Fri, 04 Mar 2022 05:17:38 GMT
22
+ [Compare changes](https://github.com/microsoft/fluentui/compare/@fluentui/react-portal_v9.0.0-rc.4..@fluentui/react-portal_v9.0.0-rc.5)
23
+
24
+ ### Changes
25
+
26
+ - Adding explicit export maps on all consumer packages for FUIR 8 and 9. ([PR #21508](https://github.com/microsoft/fluentui/pull/21508) by dzearing@microsoft.com)
27
+ - Bump @fluentui/react-shared-contexts to v9.0.0-rc.4 ([PR #21947](https://github.com/microsoft/fluentui/pull/21947) by beachball)
28
+ - Bump @fluentui/react-tabster to v9.0.0-rc.5 ([PR #21947](https://github.com/microsoft/fluentui/pull/21947) by beachball)
29
+ - Bump @fluentui/react-utilities to v9.0.0-rc.5 ([PR #21947](https://github.com/microsoft/fluentui/pull/21947) by beachball)
30
+
31
+ ## [9.0.0-rc.4](https://github.com/microsoft/fluentui/tree/@fluentui/react-portal_v9.0.0-rc.4)
32
+
33
+ Tue, 01 Mar 2022 02:17:40 GMT
34
+ [Compare changes](https://github.com/microsoft/fluentui/compare/@fluentui/react-portal_v9.0.0-rc.3..@fluentui/react-portal_v9.0.0-rc.4)
35
+
36
+ ### Changes
37
+
38
+ - Bump @fluentui/react-tabster to v9.0.0-rc.4 ([PR #21884](https://github.com/microsoft/fluentui/pull/21884) by beachball)
39
+ - Bump @fluentui/react-utilities to v9.0.0-rc.4 ([PR #21884](https://github.com/microsoft/fluentui/pull/21884) by beachball)
40
+
7
41
  ## [9.0.0-rc.3](https://github.com/microsoft/fluentui/tree/@fluentui/react-portal_v9.0.0-rc.3)
8
42
 
9
- Fri, 18 Feb 2022 13:33:48 GMT
43
+ Fri, 18 Feb 2022 13:35:33 GMT
10
44
  [Compare changes](https://github.com/microsoft/fluentui/compare/@fluentui/react-portal_v9.0.0-rc.1..@fluentui/react-portal_v9.0.0-rc.3)
11
45
 
12
46
  ### Changes
@@ -23,7 +23,7 @@ declare type PortalCommons = {
23
23
  * Where the portal children are mounted on DOM
24
24
  * @defaultValue a new element on document.body without any styling
25
25
  */
26
- mountNode: HTMLDivElement | undefined;
26
+ mountNode: HTMLElement | null;
27
27
  };
28
28
 
29
29
  export declare type PortalProps = Partial<PortalCommons>;
@@ -8,7 +8,7 @@ declare type PortalCommons = {
8
8
  * Where the portal children are mounted on DOM
9
9
  * @defaultValue a new element on document.body without any styling
10
10
  */
11
- mountNode: HTMLDivElement | undefined;
11
+ mountNode: HTMLElement | null;
12
12
  };
13
13
  export declare type PortalProps = Partial<PortalCommons>;
14
14
  export declare type PortalState = PortalCommons & {
@@ -1 +1 @@
1
- {"version":3,"file":"Portal.types.js","sourceRoot":"../src/","sources":["components/Portal/Portal.types.ts"],"names":[],"mappings":"","sourcesContent":["import * as React from 'react';\n\ntype PortalCommons = {\n /**\n * React children\n */\n children: React.ReactNode;\n /**\n * Where the portal children are mounted on DOM\n * @defaultValue a new element on document.body without any styling\n */\n mountNode: HTMLDivElement | undefined;\n};\n\nexport type PortalProps = Partial<PortalCommons>;\n\nexport type PortalState = PortalCommons & {\n /** Indicates if a Portal should be rendered. */\n shouldRender: boolean;\n\n /**\n * Ref to the root span element as virtual parent\n */\n virtualParentRootRef: React.MutableRefObject<HTMLSpanElement | null>;\n};\n"]}
1
+ {"version":3,"file":"Portal.types.js","sourceRoot":"../src/","sources":["components/Portal/Portal.types.ts"],"names":[],"mappings":"","sourcesContent":["import * as React from 'react';\n\ntype PortalCommons = {\n /**\n * React children\n */\n children: React.ReactNode;\n /**\n * Where the portal children are mounted on DOM\n * @defaultValue a new element on document.body without any styling\n */\n mountNode: HTMLElement | null;\n};\n\nexport type PortalProps = Partial<PortalCommons>;\n\nexport type PortalState = PortalCommons & {\n /** Indicates if a Portal should be rendered. */\n shouldRender: boolean;\n\n /**\n * Ref to the root span element as virtual parent\n */\n virtualParentRootRef: React.MutableRefObject<HTMLSpanElement | null>;\n};\n"]}
@@ -7,4 +7,4 @@ export declare type UsePortalMountNodeOptions = {
7
7
  /**
8
8
  * Creates a new element on a document.body to mount portals
9
9
  */
10
- export declare const usePortalMountNode: (options: UsePortalMountNodeOptions) => HTMLDivElement | undefined;
10
+ export declare const usePortalMountNode: (options: UsePortalMountNodeOptions) => HTMLElement | null;
@@ -14,7 +14,7 @@ export const usePortalMountNode = options => {
14
14
  } = useFluent();
15
15
  const element = React.useMemo(() => {
16
16
  if (targetDocument === undefined || options.disabled) {
17
- return undefined;
17
+ return null;
18
18
  }
19
19
 
20
20
  const newElement = targetDocument.createElement('div');
@@ -1 +1 @@
1
- {"version":3,"sources":["components/Portal/usePortalMountNode.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAZ,MAAuB,OAAvB;AACA,SAAS,yBAAT,QAA0C,2BAA1C;AACA,SAAS,iBAAT,EAA4B,SAA5B,QAA6C,iCAA7C;AACA,SAAS,uBAAT,QAAwC,yBAAxC;AASA;;AAEG;;AACH,OAAO,MAAM,kBAAkB,GAAI,OAAD,IAAuC;AACvE,QAAM,cAAc,GAAG,iBAAiB,EAAxC;AACA,QAAM;AAAE,IAAA,cAAF;AAAkB,IAAA;AAAlB,MAA0B,SAAS,EAAzC;AAEA,QAAM,OAAO,GAAG,KAAK,CAAC,OAAN,CAAc,MAAK;AACjC,QAAI,cAAc,KAAK,SAAnB,IAAgC,OAAO,CAAC,QAA5C,EAAsD;AACpD,aAAO,SAAP;AACD;;AAED,UAAM,UAAU,GAAG,cAAc,CAAC,aAAf,CAA6B,KAA7B,CAAnB;AACA,IAAA,UAAU,CAAC,YAAX,CAAwB,OAAxB,EAAiC,cAAjC;AACA,IAAA,UAAU,CAAC,YAAX,CAAwB,KAAxB,EAA+B,GAA/B;AACA,IAAA,cAAc,CAAC,IAAf,CAAoB,WAApB,CAAgC,UAAhC;AAEA,WAAO,UAAP;AACD,GAXe,EAWb,CAAC,cAAD,EAAiB,cAAjB,EAAiC,GAAjC,EAAsC,OAAO,CAAC,QAA9C,CAXa,CAAhB;AAaC,EAAA,uBAAuB,GAA2C,OAAlE,GAA4E,OAA5E;AAED,EAAA,yBAAyB,CAAC,MAAK;AAC7B,WAAO,MAAK;;;AACV,OAAA,EAAA,GAAA,OAAO,KAAA,IAAP,IAAA,OAAO,KAAA,KAAA,CAAP,GAAO,KAAA,CAAP,GAAA,OAAO,CAAE,aAAT,MAAsB,IAAtB,IAAsB,EAAA,KAAA,KAAA,CAAtB,GAAsB,KAAA,CAAtB,GAAsB,EAAA,CAAE,WAAF,CAAc,OAAd,CAAtB;AACD,KAFD;AAGD,GAJwB,EAItB,CAAC,OAAD,CAJsB,CAAzB;AAMA,SAAO,OAAP;AACD,CA1BM","sourcesContent":["import * as React from 'react';\nimport { useIsomorphicLayoutEffect } from '@fluentui/react-utilities';\nimport { useThemeClassName, useFluent } from '@fluentui/react-shared-contexts';\nimport { useKeyboardNavAttribute } from '@fluentui/react-tabster';\n\nexport type UsePortalMountNodeOptions = {\n /**\n * Since hooks cannot be called conditionally use this flag to disable creating the node\n */\n disabled?: boolean;\n};\n\n/**\n * Creates a new element on a document.body to mount portals\n */\nexport const usePortalMountNode = (options: UsePortalMountNodeOptions) => {\n const themeClassName = useThemeClassName();\n const { targetDocument, dir } = useFluent();\n\n const element = React.useMemo(() => {\n if (targetDocument === undefined || options.disabled) {\n return undefined;\n }\n\n const newElement = targetDocument.createElement('div');\n newElement.setAttribute('class', themeClassName);\n newElement.setAttribute('dir', dir);\n targetDocument.body.appendChild(newElement);\n\n return newElement;\n }, [targetDocument, themeClassName, dir, options.disabled]);\n\n (useKeyboardNavAttribute() as React.MutableRefObject<HTMLElement>).current = element!;\n\n useIsomorphicLayoutEffect(() => {\n return () => {\n element?.parentElement?.removeChild(element);\n };\n }, [element]);\n\n return element;\n};\n"],"sourceRoot":"../src/"}
1
+ {"version":3,"sources":["components/Portal/usePortalMountNode.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAZ,MAAuB,OAAvB;AACA,SAAS,yBAAT,QAA0C,2BAA1C;AACA,SAAS,iBAAT,EAA4B,SAA5B,QAA6C,iCAA7C;AACA,SAAS,uBAAT,QAAwC,yBAAxC;AASA;;AAEG;;AACH,OAAO,MAAM,kBAAkB,GAAI,OAAD,IAA2D;AAC3F,QAAM,cAAc,GAAG,iBAAiB,EAAxC;AACA,QAAM;AAAE,IAAA,cAAF;AAAkB,IAAA;AAAlB,MAA0B,SAAS,EAAzC;AAEA,QAAM,OAAO,GAAG,KAAK,CAAC,OAAN,CAAc,MAAK;AACjC,QAAI,cAAc,KAAK,SAAnB,IAAgC,OAAO,CAAC,QAA5C,EAAsD;AACpD,aAAO,IAAP;AACD;;AAED,UAAM,UAAU,GAAG,cAAc,CAAC,aAAf,CAA6B,KAA7B,CAAnB;AACA,IAAA,UAAU,CAAC,YAAX,CAAwB,OAAxB,EAAiC,cAAjC;AACA,IAAA,UAAU,CAAC,YAAX,CAAwB,KAAxB,EAA+B,GAA/B;AACA,IAAA,cAAc,CAAC,IAAf,CAAoB,WAApB,CAAgC,UAAhC;AAEA,WAAO,UAAP;AACD,GAXe,EAWb,CAAC,cAAD,EAAiB,cAAjB,EAAiC,GAAjC,EAAsC,OAAO,CAAC,QAA9C,CAXa,CAAhB;AAaC,EAAA,uBAAuB,GAA2C,OAAlE,GAA4E,OAA5E;AAED,EAAA,yBAAyB,CAAC,MAAK;AAC7B,WAAO,MAAK;;;AACV,OAAA,EAAA,GAAA,OAAO,KAAA,IAAP,IAAA,OAAO,KAAA,KAAA,CAAP,GAAO,KAAA,CAAP,GAAA,OAAO,CAAE,aAAT,MAAsB,IAAtB,IAAsB,EAAA,KAAA,KAAA,CAAtB,GAAsB,KAAA,CAAtB,GAAsB,EAAA,CAAE,WAAF,CAAc,OAAd,CAAtB;AACD,KAFD;AAGD,GAJwB,EAItB,CAAC,OAAD,CAJsB,CAAzB;AAMA,SAAO,OAAP;AACD,CA1BM","sourcesContent":["import * as React from 'react';\nimport { useIsomorphicLayoutEffect } from '@fluentui/react-utilities';\nimport { useThemeClassName, useFluent } from '@fluentui/react-shared-contexts';\nimport { useKeyboardNavAttribute } from '@fluentui/react-tabster';\n\nexport type UsePortalMountNodeOptions = {\n /**\n * Since hooks cannot be called conditionally use this flag to disable creating the node\n */\n disabled?: boolean;\n};\n\n/**\n * Creates a new element on a document.body to mount portals\n */\nexport const usePortalMountNode = (options: UsePortalMountNodeOptions): HTMLElement | null => {\n const themeClassName = useThemeClassName();\n const { targetDocument, dir } = useFluent();\n\n const element = React.useMemo(() => {\n if (targetDocument === undefined || options.disabled) {\n return null;\n }\n\n const newElement = targetDocument.createElement('div');\n newElement.setAttribute('class', themeClassName);\n newElement.setAttribute('dir', dir);\n targetDocument.body.appendChild(newElement);\n\n return newElement;\n }, [targetDocument, themeClassName, dir, options.disabled]);\n\n (useKeyboardNavAttribute() as React.MutableRefObject<HTMLElement>).current = element!;\n\n useIsomorphicLayoutEffect(() => {\n return () => {\n element?.parentElement?.removeChild(element);\n };\n }, [element]);\n\n return element;\n};\n"],"sourceRoot":"../src/"}
@@ -8,7 +8,7 @@ declare type PortalCommons = {
8
8
  * Where the portal children are mounted on DOM
9
9
  * @defaultValue a new element on document.body without any styling
10
10
  */
11
- mountNode: HTMLDivElement | undefined;
11
+ mountNode: HTMLElement | null;
12
12
  };
13
13
  export declare type PortalProps = Partial<PortalCommons>;
14
14
  export declare type PortalState = PortalCommons & {
@@ -7,4 +7,4 @@ export declare type UsePortalMountNodeOptions = {
7
7
  /**
8
8
  * Creates a new element on a document.body to mount portals
9
9
  */
10
- export declare const usePortalMountNode: (options: UsePortalMountNodeOptions) => HTMLDivElement | undefined;
10
+ export declare const usePortalMountNode: (options: UsePortalMountNodeOptions) => HTMLElement | null;
@@ -25,7 +25,7 @@ const usePortalMountNode = options => {
25
25
  } = react_shared_contexts_1.useFluent();
26
26
  const element = React.useMemo(() => {
27
27
  if (targetDocument === undefined || options.disabled) {
28
- return undefined;
28
+ return null;
29
29
  }
30
30
 
31
31
  const newElement = targetDocument.createElement('div');
@@ -1 +1 @@
1
- {"version":3,"sources":["components/Portal/usePortalMountNode.ts"],"names":[],"mappings":";;;;;;;AAAA,MAAA,KAAA,gBAAA,OAAA,CAAA,OAAA,CAAA;;AACA,MAAA,iBAAA,gBAAA,OAAA,CAAA,2BAAA,CAAA;;AACA,MAAA,uBAAA,gBAAA,OAAA,CAAA,iCAAA,CAAA;;AACA,MAAA,eAAA,gBAAA,OAAA,CAAA,yBAAA,CAAA;AASA;;AAEG;;;AACI,MAAM,kBAAkB,GAAI,OAAD,IAAuC;AACvE,QAAM,cAAc,GAAG,uBAAA,CAAA,iBAAA,EAAvB;AACA,QAAM;AAAE,IAAA,cAAF;AAAkB,IAAA;AAAlB,MAA0B,uBAAA,CAAA,SAAA,EAAhC;AAEA,QAAM,OAAO,GAAG,KAAK,CAAC,OAAN,CAAc,MAAK;AACjC,QAAI,cAAc,KAAK,SAAnB,IAAgC,OAAO,CAAC,QAA5C,EAAsD;AACpD,aAAO,SAAP;AACD;;AAED,UAAM,UAAU,GAAG,cAAc,CAAC,aAAf,CAA6B,KAA7B,CAAnB;AACA,IAAA,UAAU,CAAC,YAAX,CAAwB,OAAxB,EAAiC,cAAjC;AACA,IAAA,UAAU,CAAC,YAAX,CAAwB,KAAxB,EAA+B,GAA/B;AACA,IAAA,cAAc,CAAC,IAAf,CAAoB,WAApB,CAAgC,UAAhC;AAEA,WAAO,UAAP;AACD,GAXe,EAWb,CAAC,cAAD,EAAiB,cAAjB,EAAiC,GAAjC,EAAsC,OAAO,CAAC,QAA9C,CAXa,CAAhB;AAaC,EAAA,eAAA,CAAA,uBAAA,GAAkE,OAAlE,GAA4E,OAA5E;AAED,EAAA,iBAAA,CAAA,yBAAA,CAA0B,MAAK;AAC7B,WAAO,MAAK;;;AACV,OAAA,EAAA,GAAA,OAAO,KAAA,IAAP,IAAA,OAAO,KAAA,KAAA,CAAP,GAAO,KAAA,CAAP,GAAA,OAAO,CAAE,aAAT,MAAsB,IAAtB,IAAsB,EAAA,KAAA,KAAA,CAAtB,GAAsB,KAAA,CAAtB,GAAsB,EAAA,CAAE,WAAF,CAAc,OAAd,CAAtB;AACD,KAFD;AAGD,GAJD,EAIG,CAAC,OAAD,CAJH;AAMA,SAAO,OAAP;AACD,CA1BM;;AAAM,OAAA,CAAA,kBAAA,GAAkB,kBAAlB","sourcesContent":["import * as React from 'react';\nimport { useIsomorphicLayoutEffect } from '@fluentui/react-utilities';\nimport { useThemeClassName, useFluent } from '@fluentui/react-shared-contexts';\nimport { useKeyboardNavAttribute } from '@fluentui/react-tabster';\n\nexport type UsePortalMountNodeOptions = {\n /**\n * Since hooks cannot be called conditionally use this flag to disable creating the node\n */\n disabled?: boolean;\n};\n\n/**\n * Creates a new element on a document.body to mount portals\n */\nexport const usePortalMountNode = (options: UsePortalMountNodeOptions) => {\n const themeClassName = useThemeClassName();\n const { targetDocument, dir } = useFluent();\n\n const element = React.useMemo(() => {\n if (targetDocument === undefined || options.disabled) {\n return undefined;\n }\n\n const newElement = targetDocument.createElement('div');\n newElement.setAttribute('class', themeClassName);\n newElement.setAttribute('dir', dir);\n targetDocument.body.appendChild(newElement);\n\n return newElement;\n }, [targetDocument, themeClassName, dir, options.disabled]);\n\n (useKeyboardNavAttribute() as React.MutableRefObject<HTMLElement>).current = element!;\n\n useIsomorphicLayoutEffect(() => {\n return () => {\n element?.parentElement?.removeChild(element);\n };\n }, [element]);\n\n return element;\n};\n"],"sourceRoot":"../src/"}
1
+ {"version":3,"sources":["components/Portal/usePortalMountNode.ts"],"names":[],"mappings":";;;;;;;AAAA,MAAA,KAAA,gBAAA,OAAA,CAAA,OAAA,CAAA;;AACA,MAAA,iBAAA,gBAAA,OAAA,CAAA,2BAAA,CAAA;;AACA,MAAA,uBAAA,gBAAA,OAAA,CAAA,iCAAA,CAAA;;AACA,MAAA,eAAA,gBAAA,OAAA,CAAA,yBAAA,CAAA;AASA;;AAEG;;;AACI,MAAM,kBAAkB,GAAI,OAAD,IAA2D;AAC3F,QAAM,cAAc,GAAG,uBAAA,CAAA,iBAAA,EAAvB;AACA,QAAM;AAAE,IAAA,cAAF;AAAkB,IAAA;AAAlB,MAA0B,uBAAA,CAAA,SAAA,EAAhC;AAEA,QAAM,OAAO,GAAG,KAAK,CAAC,OAAN,CAAc,MAAK;AACjC,QAAI,cAAc,KAAK,SAAnB,IAAgC,OAAO,CAAC,QAA5C,EAAsD;AACpD,aAAO,IAAP;AACD;;AAED,UAAM,UAAU,GAAG,cAAc,CAAC,aAAf,CAA6B,KAA7B,CAAnB;AACA,IAAA,UAAU,CAAC,YAAX,CAAwB,OAAxB,EAAiC,cAAjC;AACA,IAAA,UAAU,CAAC,YAAX,CAAwB,KAAxB,EAA+B,GAA/B;AACA,IAAA,cAAc,CAAC,IAAf,CAAoB,WAApB,CAAgC,UAAhC;AAEA,WAAO,UAAP;AACD,GAXe,EAWb,CAAC,cAAD,EAAiB,cAAjB,EAAiC,GAAjC,EAAsC,OAAO,CAAC,QAA9C,CAXa,CAAhB;AAaC,EAAA,eAAA,CAAA,uBAAA,GAAkE,OAAlE,GAA4E,OAA5E;AAED,EAAA,iBAAA,CAAA,yBAAA,CAA0B,MAAK;AAC7B,WAAO,MAAK;;;AACV,OAAA,EAAA,GAAA,OAAO,KAAA,IAAP,IAAA,OAAO,KAAA,KAAA,CAAP,GAAO,KAAA,CAAP,GAAA,OAAO,CAAE,aAAT,MAAsB,IAAtB,IAAsB,EAAA,KAAA,KAAA,CAAtB,GAAsB,KAAA,CAAtB,GAAsB,EAAA,CAAE,WAAF,CAAc,OAAd,CAAtB;AACD,KAFD;AAGD,GAJD,EAIG,CAAC,OAAD,CAJH;AAMA,SAAO,OAAP;AACD,CA1BM;;AAAM,OAAA,CAAA,kBAAA,GAAkB,kBAAlB","sourcesContent":["import * as React from 'react';\nimport { useIsomorphicLayoutEffect } from '@fluentui/react-utilities';\nimport { useThemeClassName, useFluent } from '@fluentui/react-shared-contexts';\nimport { useKeyboardNavAttribute } from '@fluentui/react-tabster';\n\nexport type UsePortalMountNodeOptions = {\n /**\n * Since hooks cannot be called conditionally use this flag to disable creating the node\n */\n disabled?: boolean;\n};\n\n/**\n * Creates a new element on a document.body to mount portals\n */\nexport const usePortalMountNode = (options: UsePortalMountNodeOptions): HTMLElement | null => {\n const themeClassName = useThemeClassName();\n const { targetDocument, dir } = useFluent();\n\n const element = React.useMemo(() => {\n if (targetDocument === undefined || options.disabled) {\n return null;\n }\n\n const newElement = targetDocument.createElement('div');\n newElement.setAttribute('class', themeClassName);\n newElement.setAttribute('dir', dir);\n targetDocument.body.appendChild(newElement);\n\n return newElement;\n }, [targetDocument, themeClassName, dir, options.disabled]);\n\n (useKeyboardNavAttribute() as React.MutableRefObject<HTMLElement>).current = element!;\n\n useIsomorphicLayoutEffect(() => {\n return () => {\n element?.parentElement?.removeChild(element);\n };\n }, [element]);\n\n return element;\n};\n"],"sourceRoot":"../src/"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@fluentui/react-portal",
3
- "version": "9.0.0-rc.3",
3
+ "version": "9.0.0-rc.6",
4
4
  "description": "A utility component that creates portals compatible with Fluent UI",
5
5
  "main": "lib-commonjs/index.js",
6
6
  "module": "lib/index.js",
@@ -28,22 +28,12 @@
28
28
  "devDependencies": {
29
29
  "@fluentui/eslint-plugin": "*",
30
30
  "@fluentui/react-conformance": "*",
31
- "@fluentui/scripts": "^1.0.0",
32
- "@types/enzyme": "3.10.3",
33
- "@types/enzyme-adapter-react-16": "1.0.3",
34
- "@types/react": "16.9.42",
35
- "@types/react-dom": "16.9.10",
36
- "@types/react-test-renderer": "^16.0.0",
37
- "enzyme": "~3.10.0",
38
- "enzyme-adapter-react-16": "^1.15.0",
39
- "react": "16.8.6",
40
- "react-dom": "16.8.6",
41
- "react-test-renderer": "^16.3.0"
31
+ "@fluentui/scripts": "^1.0.0"
42
32
  },
43
33
  "dependencies": {
44
- "@fluentui/react-shared-contexts": "9.0.0-rc.3",
45
- "@fluentui/react-tabster": "9.0.0-rc.3",
46
- "@fluentui/react-utilities": "9.0.0-rc.3",
34
+ "@fluentui/react-shared-contexts": "9.0.0-rc.5",
35
+ "@fluentui/react-tabster": "9.0.0-rc.6",
36
+ "@fluentui/react-utilities": "9.0.0-rc.6",
47
37
  "tslib": "^2.1.0"
48
38
  },
49
39
  "peerDependencies": {
@@ -58,5 +48,12 @@
58
48
  "minor",
59
49
  "patch"
60
50
  ]
51
+ },
52
+ "exports": {
53
+ ".": {
54
+ "types": "./lib/index.d.ts",
55
+ "import": "./lib/index.js",
56
+ "require": "./lib-commonjs/index.js"
57
+ }
61
58
  }
62
59
  }