@fluentui/react-portal 9.0.0-rc.8 → 9.0.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (29) hide show
  1. package/CHANGELOG.json +245 -1
  2. package/CHANGELOG.md +96 -2
  3. package/dist/index.d.ts +6 -7
  4. package/lib/components/Portal/Portal.js.map +1 -1
  5. package/lib/components/Portal/Portal.types.js.map +1 -1
  6. package/lib/components/Portal/renderPortal.js.map +1 -1
  7. package/lib/components/Portal/usePortal.js.map +1 -1
  8. package/lib/components/Portal/usePortalMountNode.js +28 -6
  9. package/lib/components/Portal/usePortalMountNode.js.map +1 -1
  10. package/lib/index.js +1 -1
  11. package/lib/index.js.map +1 -1
  12. package/lib/virtualParent/elementContains.js.map +1 -1
  13. package/lib/virtualParent/getParent.js.map +1 -1
  14. package/lib/virtualParent/getVirtualParent.js.map +1 -1
  15. package/lib/virtualParent/isVirtualElement.js.map +1 -1
  16. package/lib/virtualParent/setVirtualParent.js.map +1 -1
  17. package/lib-commonjs/components/Portal/Portal.js.map +1 -1
  18. package/lib-commonjs/components/Portal/renderPortal.js.map +1 -1
  19. package/lib-commonjs/components/Portal/usePortal.js.map +1 -1
  20. package/lib-commonjs/components/Portal/usePortalMountNode.js +28 -6
  21. package/lib-commonjs/components/Portal/usePortalMountNode.js.map +1 -1
  22. package/lib-commonjs/index.js +23 -6
  23. package/lib-commonjs/index.js.map +1 -1
  24. package/lib-commonjs/virtualParent/elementContains.js.map +1 -1
  25. package/lib-commonjs/virtualParent/getParent.js.map +1 -1
  26. package/lib-commonjs/virtualParent/getVirtualParent.js.map +1 -1
  27. package/lib-commonjs/virtualParent/isVirtualElement.js.map +1 -1
  28. package/lib-commonjs/virtualParent/setVirtualParent.js.map +1 -1
  29. package/package.json +6 -7
package/CHANGELOG.json CHANGED
@@ -2,7 +2,251 @@
2
2
  "name": "@fluentui/react-portal",
3
3
  "entries": [
4
4
  {
5
- "date": "Wed, 04 May 2022 13:24:15 GMT",
5
+ "date": "Tue, 28 Jun 2022 17:37:50 GMT",
6
+ "tag": "@fluentui/react-portal_v9.0.1",
7
+ "version": "9.0.1",
8
+ "comments": {
9
+ "patch": [
10
+ {
11
+ "author": "lingfangao@hotmail.com",
12
+ "package": "@fluentui/react-portal",
13
+ "commit": "3deda1fbbfb6ac2b1ad150d4dc6343f1f7fda85b",
14
+ "comment": "fix: Use caret dependency range for Griffel"
15
+ },
16
+ {
17
+ "author": "beachball",
18
+ "package": "@fluentui/react-portal",
19
+ "comment": "Bump @fluentui/react-tabster to v9.0.1",
20
+ "commit": "3deda1fbbfb6ac2b1ad150d4dc6343f1f7fda85b"
21
+ }
22
+ ]
23
+ }
24
+ },
25
+ {
26
+ "date": "Tue, 28 Jun 2022 15:13:48 GMT",
27
+ "tag": "@fluentui/react-portal_v9.0.0",
28
+ "version": "9.0.0",
29
+ "comments": {
30
+ "prerelease": [
31
+ {
32
+ "author": "lingfangao@hotmail.com",
33
+ "package": "@fluentui/react-portal",
34
+ "commit": "e0aabd850b15adf9c151ebd4e332f7c50ad6cfdf",
35
+ "comment": "Update 9.0.0-rc dependencies to use caret range"
36
+ },
37
+ {
38
+ "author": "olfedias@microsoft.com",
39
+ "package": "@fluentui/react-portal",
40
+ "commit": "bad6ad63ff7e2287519e7117f8a1963b623ae18e",
41
+ "comment": "feat: apply zIndex to Portal"
42
+ },
43
+ {
44
+ "author": "lingfangao@hotmail.com",
45
+ "package": "@fluentui/react-portal",
46
+ "commit": "675acea49c97f10837ddee9b8c4350ca27750125",
47
+ "comment": "Bump Griffel dependencies"
48
+ },
49
+ {
50
+ "author": "olfedias@microsoft.com",
51
+ "package": "@fluentui/react-portal",
52
+ "commit": "5f6b229b79dc7c83381414404b9b9c2c59d38ac8",
53
+ "comment": "fix: update to create new stacking context"
54
+ }
55
+ ],
56
+ "patch": [
57
+ {
58
+ "author": "lingfangao@hotmail.com",
59
+ "package": "@fluentui/react-portal",
60
+ "commit": "c7b1348bdad7aa883c29bfbc96ef2a32e6ebc7dd",
61
+ "comment": "feat: Initial 9.0.0 release"
62
+ },
63
+ {
64
+ "author": "beachball",
65
+ "package": "@fluentui/react-portal",
66
+ "comment": "Bump @fluentui/react-shared-contexts to v9.0.0",
67
+ "commit": "ba6c5d651559b91c815429c9a9357c4d5a390f3e"
68
+ },
69
+ {
70
+ "author": "beachball",
71
+ "package": "@fluentui/react-portal",
72
+ "comment": "Bump @fluentui/react-tabster to v9.0.0",
73
+ "commit": "ba6c5d651559b91c815429c9a9357c4d5a390f3e"
74
+ },
75
+ {
76
+ "author": "beachball",
77
+ "package": "@fluentui/react-portal",
78
+ "comment": "Bump @fluentui/react-utilities to v9.0.0",
79
+ "commit": "ba6c5d651559b91c815429c9a9357c4d5a390f3e"
80
+ }
81
+ ],
82
+ "none": [
83
+ {
84
+ "author": "tristan.watanabe@gmail.com",
85
+ "package": "@fluentui/react-portal",
86
+ "commit": "2e62f58ffd06597d9fb73fb4b7b1cba584b6cadf",
87
+ "comment": "chore: Move Portal stories to folder with index entry."
88
+ }
89
+ ]
90
+ }
91
+ },
92
+ {
93
+ "date": "Thu, 23 Jun 2022 14:25:31 GMT",
94
+ "tag": "@fluentui/react-portal_v9.0.0-rc.14",
95
+ "version": "9.0.0-rc.14",
96
+ "comments": {
97
+ "prerelease": [
98
+ {
99
+ "author": "beachball",
100
+ "package": "@fluentui/react-portal",
101
+ "comment": "Bump @fluentui/react-shared-contexts to v9.0.0-rc.11",
102
+ "commit": "b00790b7a0ea1473d8c3cc49c7ca0088002957ed"
103
+ },
104
+ {
105
+ "author": "beachball",
106
+ "package": "@fluentui/react-portal",
107
+ "comment": "Bump @fluentui/react-tabster to v9.0.0-rc.14",
108
+ "commit": "b00790b7a0ea1473d8c3cc49c7ca0088002957ed"
109
+ }
110
+ ]
111
+ }
112
+ },
113
+ {
114
+ "date": "Tue, 31 May 2022 21:28:41 GMT",
115
+ "tag": "@fluentui/react-portal_v9.0.0-rc.13",
116
+ "version": "9.0.0-rc.13",
117
+ "comments": {
118
+ "prerelease": [
119
+ {
120
+ "author": "bernardo.sunderhus@gmail.com",
121
+ "package": "@fluentui/react-portal",
122
+ "commit": "335ebfcfd47005003901b5e319782bfe9ccd89fd",
123
+ "comment": "updates import to react-shared-components"
124
+ },
125
+ {
126
+ "author": "beachball",
127
+ "package": "@fluentui/react-portal",
128
+ "comment": "Bump @fluentui/react-shared-contexts to v9.0.0-rc.10",
129
+ "commit": "335ebfcfd47005003901b5e319782bfe9ccd89fd"
130
+ },
131
+ {
132
+ "author": "beachball",
133
+ "package": "@fluentui/react-portal",
134
+ "comment": "Bump @fluentui/react-tabster to v9.0.0-rc.13",
135
+ "commit": "335ebfcfd47005003901b5e319782bfe9ccd89fd"
136
+ },
137
+ {
138
+ "author": "beachball",
139
+ "package": "@fluentui/react-portal",
140
+ "comment": "Bump @fluentui/react-utilities to v9.0.0-rc.10",
141
+ "commit": "335ebfcfd47005003901b5e319782bfe9ccd89fd"
142
+ }
143
+ ]
144
+ }
145
+ },
146
+ {
147
+ "date": "Thu, 26 May 2022 21:01:32 GMT",
148
+ "tag": "@fluentui/react-portal_v9.0.0-rc.12",
149
+ "version": "9.0.0-rc.12",
150
+ "comments": {
151
+ "prerelease": [
152
+ {
153
+ "author": "beachball",
154
+ "package": "@fluentui/react-portal",
155
+ "comment": "Bump @fluentui/react-tabster to v9.0.0-rc.12",
156
+ "commit": "3cf55ce998048554bf6a550de44403843ea8ede0"
157
+ }
158
+ ]
159
+ }
160
+ },
161
+ {
162
+ "date": "Mon, 23 May 2022 18:56:51 GMT",
163
+ "tag": "@fluentui/react-portal_v9.0.0-rc.11",
164
+ "version": "9.0.0-rc.11",
165
+ "comments": {
166
+ "prerelease": [
167
+ {
168
+ "author": "beachball",
169
+ "package": "@fluentui/react-portal",
170
+ "comment": "Bump @fluentui/react-shared-contexts to v9.0.0-rc.9",
171
+ "commit": "d4f80b17690e962d6a24e68959608d1ffe84aef6"
172
+ },
173
+ {
174
+ "author": "beachball",
175
+ "package": "@fluentui/react-portal",
176
+ "comment": "Bump @fluentui/react-tabster to v9.0.0-rc.11",
177
+ "commit": "d4f80b17690e962d6a24e68959608d1ffe84aef6"
178
+ }
179
+ ]
180
+ }
181
+ },
182
+ {
183
+ "date": "Mon, 23 May 2022 12:13:33 GMT",
184
+ "tag": "@fluentui/react-portal_v9.0.0-rc.10",
185
+ "version": "9.0.0-rc.10",
186
+ "comments": {
187
+ "prerelease": [
188
+ {
189
+ "author": "Humberto.Morimoto@microsoft.com",
190
+ "package": "@fluentui/react-portal",
191
+ "commit": "d98a253a7768cb781f106153804c8683670bbf8a",
192
+ "comment": "Removing PortalCommons type."
193
+ },
194
+ {
195
+ "author": "beachball",
196
+ "package": "@fluentui/react-portal",
197
+ "comment": "Bump @fluentui/react-shared-contexts to v9.0.0-rc.8",
198
+ "commit": "8d58f08997acf595e3eb7f628123e7fa7830c394"
199
+ },
200
+ {
201
+ "author": "beachball",
202
+ "package": "@fluentui/react-portal",
203
+ "comment": "Bump @fluentui/react-tabster to v9.0.0-rc.10",
204
+ "commit": "8d58f08997acf595e3eb7f628123e7fa7830c394"
205
+ },
206
+ {
207
+ "author": "beachball",
208
+ "package": "@fluentui/react-portal",
209
+ "comment": "Bump @fluentui/react-utilities to v9.0.0-rc.9",
210
+ "commit": "8d58f08997acf595e3eb7f628123e7fa7830c394"
211
+ }
212
+ ]
213
+ }
214
+ },
215
+ {
216
+ "date": "Thu, 05 May 2022 18:26:25 GMT",
217
+ "tag": "@fluentui/react-portal_v9.0.0-rc.9",
218
+ "version": "9.0.0-rc.9",
219
+ "comments": {
220
+ "prerelease": [
221
+ {
222
+ "author": "humberto_makoto@hotmail.com",
223
+ "package": "@fluentui/react-portal",
224
+ "commit": "5524a739358b616484c838819a5e89531aca1c1f",
225
+ "comment": "Removing star exports."
226
+ },
227
+ {
228
+ "author": "beachball",
229
+ "package": "@fluentui/react-portal",
230
+ "comment": "Bump @fluentui/react-shared-contexts to v9.0.0-rc.7",
231
+ "commit": "c5abb9c480ac94d12aa644d68d30773d77f2a159"
232
+ },
233
+ {
234
+ "author": "beachball",
235
+ "package": "@fluentui/react-portal",
236
+ "comment": "Bump @fluentui/react-tabster to v9.0.0-rc.9",
237
+ "commit": "c5abb9c480ac94d12aa644d68d30773d77f2a159"
238
+ },
239
+ {
240
+ "author": "beachball",
241
+ "package": "@fluentui/react-portal",
242
+ "comment": "Bump @fluentui/react-utilities to v9.0.0-rc.8",
243
+ "commit": "c5abb9c480ac94d12aa644d68d30773d77f2a159"
244
+ }
245
+ ]
246
+ }
247
+ },
248
+ {
249
+ "date": "Wed, 04 May 2022 13:26:47 GMT",
6
250
  "tag": "@fluentui/react-portal_v9.0.0-rc.8",
7
251
  "version": "9.0.0-rc.8",
8
252
  "comments": {
package/CHANGELOG.md CHANGED
@@ -1,12 +1,106 @@
1
1
  # Change Log - @fluentui/react-portal
2
2
 
3
- This log was last generated on Wed, 04 May 2022 13:24:15 GMT and should not be manually modified.
3
+ This log was last generated on Tue, 28 Jun 2022 17:37:50 GMT and should not be manually modified.
4
4
 
5
5
  <!-- Start content -->
6
6
 
7
+ ## [9.0.1](https://github.com/microsoft/fluentui/tree/@fluentui/react-portal_v9.0.1)
8
+
9
+ Tue, 28 Jun 2022 17:37:50 GMT
10
+ [Compare changes](https://github.com/microsoft/fluentui/compare/@fluentui/react-portal_v9.0.0..@fluentui/react-portal_v9.0.1)
11
+
12
+ ### Patches
13
+
14
+ - fix: Use caret dependency range for Griffel ([PR #23754](https://github.com/microsoft/fluentui/pull/23754) by lingfangao@hotmail.com)
15
+ - Bump @fluentui/react-tabster to v9.0.1 ([PR #23754](https://github.com/microsoft/fluentui/pull/23754) by beachball)
16
+
17
+ ## [9.0.0](https://github.com/microsoft/fluentui/tree/@fluentui/react-portal_v9.0.0)
18
+
19
+ Tue, 28 Jun 2022 15:13:48 GMT
20
+ [Compare changes](https://github.com/microsoft/fluentui/compare/@fluentui/react-portal_v9.0.0-rc.14..@fluentui/react-portal_v9.0.0)
21
+
22
+ ### Patches
23
+
24
+ - feat: Initial 9.0.0 release ([PR #23733](https://github.com/microsoft/fluentui/pull/23733) by lingfangao@hotmail.com)
25
+ - Bump @fluentui/react-shared-contexts to v9.0.0 ([commit](https://github.com/microsoft/fluentui/commit/ba6c5d651559b91c815429c9a9357c4d5a390f3e) by beachball)
26
+ - Bump @fluentui/react-tabster to v9.0.0 ([commit](https://github.com/microsoft/fluentui/commit/ba6c5d651559b91c815429c9a9357c4d5a390f3e) by beachball)
27
+ - Bump @fluentui/react-utilities to v9.0.0 ([commit](https://github.com/microsoft/fluentui/commit/ba6c5d651559b91c815429c9a9357c4d5a390f3e) by beachball)
28
+
29
+ ### Changes
30
+
31
+ - Update 9.0.0-rc dependencies to use caret range ([PR #23732](https://github.com/microsoft/fluentui/pull/23732) by lingfangao@hotmail.com)
32
+ - feat: apply zIndex to Portal ([PR #22933](https://github.com/microsoft/fluentui/pull/22933) by olfedias@microsoft.com)
33
+ - Bump Griffel dependencies ([PR #23688](https://github.com/microsoft/fluentui/pull/23688) by lingfangao@hotmail.com)
34
+ - fix: update to create new stacking context ([PR #23507](https://github.com/microsoft/fluentui/pull/23507) by olfedias@microsoft.com)
35
+
36
+ ## [9.0.0-rc.14](https://github.com/microsoft/fluentui/tree/@fluentui/react-portal_v9.0.0-rc.14)
37
+
38
+ Thu, 23 Jun 2022 14:25:31 GMT
39
+ [Compare changes](https://github.com/microsoft/fluentui/compare/@fluentui/react-portal_v9.0.0-rc.13..@fluentui/react-portal_v9.0.0-rc.14)
40
+
41
+ ### Changes
42
+
43
+ - Bump @fluentui/react-shared-contexts to v9.0.0-rc.11 ([PR #23608](https://github.com/microsoft/fluentui/pull/23608) by beachball)
44
+ - Bump @fluentui/react-tabster to v9.0.0-rc.14 ([PR #23608](https://github.com/microsoft/fluentui/pull/23608) by beachball)
45
+
46
+ ## [9.0.0-rc.13](https://github.com/microsoft/fluentui/tree/@fluentui/react-portal_v9.0.0-rc.13)
47
+
48
+ Tue, 31 May 2022 21:28:41 GMT
49
+ [Compare changes](https://github.com/microsoft/fluentui/compare/@fluentui/react-portal_v9.0.0-rc.12..@fluentui/react-portal_v9.0.0-rc.13)
50
+
51
+ ### Changes
52
+
53
+ - updates import to react-shared-components ([PR #23325](https://github.com/microsoft/fluentui/pull/23325) by bernardo.sunderhus@gmail.com)
54
+ - Bump @fluentui/react-shared-contexts to v9.0.0-rc.10 ([PR #23325](https://github.com/microsoft/fluentui/pull/23325) by beachball)
55
+ - Bump @fluentui/react-tabster to v9.0.0-rc.13 ([PR #23325](https://github.com/microsoft/fluentui/pull/23325) by beachball)
56
+ - Bump @fluentui/react-utilities to v9.0.0-rc.10 ([PR #23325](https://github.com/microsoft/fluentui/pull/23325) by beachball)
57
+
58
+ ## [9.0.0-rc.12](https://github.com/microsoft/fluentui/tree/@fluentui/react-portal_v9.0.0-rc.12)
59
+
60
+ Thu, 26 May 2022 21:01:32 GMT
61
+ [Compare changes](https://github.com/microsoft/fluentui/compare/@fluentui/react-portal_v9.0.0-rc.11..@fluentui/react-portal_v9.0.0-rc.12)
62
+
63
+ ### Changes
64
+
65
+ - Bump @fluentui/react-tabster to v9.0.0-rc.12 ([PR #23267](https://github.com/microsoft/fluentui/pull/23267) by beachball)
66
+
67
+ ## [9.0.0-rc.11](https://github.com/microsoft/fluentui/tree/@fluentui/react-portal_v9.0.0-rc.11)
68
+
69
+ Mon, 23 May 2022 18:56:51 GMT
70
+ [Compare changes](https://github.com/microsoft/fluentui/compare/@fluentui/react-portal_v9.0.0-rc.10..@fluentui/react-portal_v9.0.0-rc.11)
71
+
72
+ ### Changes
73
+
74
+ - Bump @fluentui/react-shared-contexts to v9.0.0-rc.9 ([PR #23146](https://github.com/microsoft/fluentui/pull/23146) by beachball)
75
+ - Bump @fluentui/react-tabster to v9.0.0-rc.11 ([PR #23146](https://github.com/microsoft/fluentui/pull/23146) by beachball)
76
+
77
+ ## [9.0.0-rc.10](https://github.com/microsoft/fluentui/tree/@fluentui/react-portal_v9.0.0-rc.10)
78
+
79
+ Mon, 23 May 2022 12:13:33 GMT
80
+ [Compare changes](https://github.com/microsoft/fluentui/compare/@fluentui/react-portal_v9.0.0-rc.9..@fluentui/react-portal_v9.0.0-rc.10)
81
+
82
+ ### Changes
83
+
84
+ - Removing PortalCommons type. ([PR #22969](https://github.com/microsoft/fluentui/pull/22969) by Humberto.Morimoto@microsoft.com)
85
+ - Bump @fluentui/react-shared-contexts to v9.0.0-rc.8 ([PR #23030](https://github.com/microsoft/fluentui/pull/23030) by beachball)
86
+ - Bump @fluentui/react-tabster to v9.0.0-rc.10 ([PR #23030](https://github.com/microsoft/fluentui/pull/23030) by beachball)
87
+ - Bump @fluentui/react-utilities to v9.0.0-rc.9 ([PR #23030](https://github.com/microsoft/fluentui/pull/23030) by beachball)
88
+
89
+ ## [9.0.0-rc.9](https://github.com/microsoft/fluentui/tree/@fluentui/react-portal_v9.0.0-rc.9)
90
+
91
+ Thu, 05 May 2022 18:26:25 GMT
92
+ [Compare changes](https://github.com/microsoft/fluentui/compare/@fluentui/react-portal_v9.0.0-rc.8..@fluentui/react-portal_v9.0.0-rc.9)
93
+
94
+ ### Changes
95
+
96
+ - Removing star exports. ([PR #22806](https://github.com/microsoft/fluentui/pull/22806) by humberto_makoto@hotmail.com)
97
+ - Bump @fluentui/react-shared-contexts to v9.0.0-rc.7 ([PR #22857](https://github.com/microsoft/fluentui/pull/22857) by beachball)
98
+ - Bump @fluentui/react-tabster to v9.0.0-rc.9 ([PR #22857](https://github.com/microsoft/fluentui/pull/22857) by beachball)
99
+ - Bump @fluentui/react-utilities to v9.0.0-rc.8 ([PR #22857](https://github.com/microsoft/fluentui/pull/22857) by beachball)
100
+
7
101
  ## [9.0.0-rc.8](https://github.com/microsoft/fluentui/tree/@fluentui/react-portal_v9.0.0-rc.8)
8
102
 
9
- Wed, 04 May 2022 13:24:15 GMT
103
+ Wed, 04 May 2022 13:26:47 GMT
10
104
  [Compare changes](https://github.com/microsoft/fluentui/compare/@fluentui/react-portal_v9.0.0-rc.7..@fluentui/react-portal_v9.0.0-rc.8)
11
105
 
12
106
  ### Changes
package/dist/index.d.ts CHANGED
@@ -14,21 +14,20 @@ export declare function elementContains(parent: HTMLElement | null, child: HTMLE
14
14
  */
15
15
  export declare const Portal: React_2.FC<PortalProps>;
16
16
 
17
- declare type PortalCommons = {
17
+ export declare type PortalProps = {
18
18
  /**
19
19
  * React children
20
20
  */
21
- children: React_2.ReactNode;
21
+ children?: React_2.ReactNode;
22
22
  /**
23
23
  * Where the portal children are mounted on DOM
24
- * @defaultValue a new element on document.body without any styling
24
+ *
25
+ * @default a new element on document.body without any styling
25
26
  */
26
- mountNode: HTMLElement | null;
27
+ mountNode?: HTMLElement | null;
27
28
  };
28
29
 
29
- export declare type PortalProps = Partial<PortalCommons>;
30
-
31
- export declare type PortalState = PortalCommons & {
30
+ export declare type PortalState = Pick<PortalProps, 'children'> & Required<Pick<PortalProps, 'mountNode'>> & {
32
31
  /** Indicates if a Portal should be rendered. */
33
32
  shouldRender: boolean;
34
33
  /**
@@ -1 +1 @@
1
- {"version":3,"sources":["components/Portal/Portal.tsx"],"names":[],"mappings":"AAEA,SAAS,kBAAT,QAAmC,aAAnC;AACA,SAAS,qBAAT,QAAsC,gBAAtC;AAGA;;;AAGG;;AACH,OAAO,MAAM,MAAM,GAA0B,KAAK,IAAG;AACnD,QAAM,KAAK,GAAG,kBAAkB,CAAC,KAAD,CAAhC;AAEA,SAAO,qBAAqB,CAAC,KAAD,CAA5B;AACD,CAJM;AAMP,MAAM,CAAC,WAAP,GAAqB,QAArB","sourcesContent":["import * as React from 'react';\n\nimport { usePortal_unstable } from './usePortal';\nimport { renderPortal_unstable } from './renderPortal';\nimport type { PortalProps } from './Portal.types';\n\n/**\n * A portal provides a way to render children into a DOM node\n * that exists outside the DOM hierarchy of the parent component.\n */\nexport const Portal: React.FC<PortalProps> = props => {\n const state = usePortal_unstable(props);\n\n return renderPortal_unstable(state);\n};\n\nPortal.displayName = 'Portal';\n"],"sourceRoot":"../src/"}
1
+ {"version":3,"sources":["components/Portal/Portal.tsx"],"names":[],"mappings":"AAEA,SAAS,kBAAT,QAAmC,aAAnC;AACA,SAAS,qBAAT,QAAsC,gBAAtC;AAGA;;;AAGG;;AACH,OAAO,MAAM,MAAM,GAA0B,KAAK,IAAG;EACnD,MAAM,KAAK,GAAG,kBAAkB,CAAC,KAAD,CAAhC;EAEA,OAAO,qBAAqB,CAAC,KAAD,CAA5B;AACD,CAJM;AAMP,MAAM,CAAC,WAAP,GAAqB,QAArB","sourcesContent":["import * as React from 'react';\n\nimport { usePortal_unstable } from './usePortal';\nimport { renderPortal_unstable } from './renderPortal';\nimport type { PortalProps } from './Portal.types';\n\n/**\n * A portal provides a way to render children into a DOM node\n * that exists outside the DOM hierarchy of the parent component.\n */\nexport const Portal: React.FC<PortalProps> = props => {\n const state = usePortal_unstable(props);\n\n return renderPortal_unstable(state);\n};\n\nPortal.displayName = 'Portal';\n"],"sourceRoot":"../src/"}
@@ -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: 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"]}
1
+ {"version":3,"file":"Portal.types.js","sourceRoot":"../src/","sources":["components/Portal/Portal.types.ts"],"names":[],"mappings":"","sourcesContent":["import * as React from 'react';\n\nexport type PortalProps = {\n /**\n * React children\n */\n children?: React.ReactNode;\n\n /**\n * Where the portal children are mounted on DOM\n *\n * @default a new element on document.body without any styling\n */\n mountNode?: HTMLElement | null;\n};\n\nexport type PortalState = Pick<PortalProps, 'children'> &\n Required<Pick<PortalProps, 'mountNode'>> & {\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 +1 @@
1
- {"version":3,"sources":["components/Portal/renderPortal.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,QAAZ,MAA0B,WAA1B;AACA,OAAO,KAAK,KAAZ,MAAuB,OAAvB;AAGA;;AAEG;;AACH,OAAO,MAAM,qBAAqB,GAAI,KAAD,IAA2C;AAC9E,sBACE,KAAA,CAAA,aAAA,CAAA,MAAA,EAAA;AAAM,IAAA,MAAM,EAAA,IAAZ;AAAa,IAAA,GAAG,EAAE,KAAK,CAAC;AAAxB,GAAA,EACG,KAAK,CAAC,YAAN,IAAsB,KAAK,CAAC,SAA5B,iBAAyC,QAAQ,CAAC,YAAT,CAAsB,KAAK,CAAC,QAA5B,EAAsC,KAAK,CAAC,SAA5C,CAD5C,CADF;AAKD,CANM","sourcesContent":["import * as ReactDOM from 'react-dom';\nimport * as React from 'react';\nimport type { PortalState } from './Portal.types';\n\n/**\n * Render the final JSX of Portal\n */\nexport const renderPortal_unstable = (state: PortalState): React.ReactElement => {\n return (\n <span hidden ref={state.virtualParentRootRef}>\n {state.shouldRender && state.mountNode && ReactDOM.createPortal(state.children, state.mountNode)}\n </span>\n );\n};\n"],"sourceRoot":"../src/"}
1
+ {"version":3,"sources":["components/Portal/renderPortal.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,QAAZ,MAA0B,WAA1B;AACA,OAAO,KAAK,KAAZ,MAAuB,OAAvB;AAGA;;AAEG;;AACH,OAAO,MAAM,qBAAqB,GAAI,KAAD,IAA2C;EAC9E,oBACE,KAAA,CAAA,aAAA,CAAA,MAAA,EAAA;IAAM,MAAM,EAAA,IAAZ;IAAa,GAAG,EAAE,KAAK,CAAC;EAAxB,CAAA,EACG,KAAK,CAAC,YAAN,IAAsB,KAAK,CAAC,SAA5B,iBAAyC,QAAQ,CAAC,YAAT,CAAsB,KAAK,CAAC,QAA5B,EAAsC,KAAK,CAAC,SAA5C,CAD5C,CADF;AAKD,CANM","sourcesContent":["import * as ReactDOM from 'react-dom';\nimport * as React from 'react';\nimport type { PortalState } from './Portal.types';\n\n/**\n * Render the final JSX of Portal\n */\nexport const renderPortal_unstable = (state: PortalState): React.ReactElement => {\n return (\n <span hidden ref={state.virtualParentRootRef}>\n {state.shouldRender && state.mountNode && ReactDOM.createPortal(state.children, state.mountNode)}\n </span>\n );\n};\n"],"sourceRoot":"../src/"}
@@ -1 +1 @@
1
- {"version":3,"sources":["components/Portal/usePortal.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAZ,MAAuB,OAAvB;AACA,SAAS,QAAT,QAAyB,2BAAzB;AACA,SAAS,kBAAT,QAAmC,sBAAnC;AACA,SAAS,gBAAT,QAAiC,2BAAjC;AAGA;;;;;;AAMG;;AACH,OAAO,MAAM,kBAAkB,GAAI,KAAD,IAAoC;AACpE,QAAM;AAAE,IAAA,QAAF;AAAY,IAAA;AAAZ,MAA0B,KAAhC;AAEA,QAAM,oBAAoB,GAAG,KAAK,CAAC,MAAN,CAA8B,IAA9B,CAA7B;AACA,QAAM,iBAAiB,GAAG,kBAAkB,CAAC;AAAE,IAAA,QAAQ,EAAE,CAAC,CAAC;AAAd,GAAD,CAA5C;AAEA,QAAM,KAAK,GAAgB;AACzB,IAAA,QADyB;AAEzB,IAAA,SAAS,EAAE,SAAS,KAAA,IAAT,IAAA,SAAS,KAAA,KAAA,CAAT,GAAA,SAAA,GAAa,iBAFC;AAGzB,IAAA,YAAY,EAAE,CAAC,QAAQ,EAHE;AAIzB,IAAA;AAJyB,GAA3B;AAOA,EAAA,KAAK,CAAC,SAAN,CAAgB,MAAK;AACnB,QAAI,KAAK,CAAC,oBAAN,CAA2B,OAA3B,IAAsC,KAAK,CAAC,SAAhD,EAA2D;AACzD,MAAA,gBAAgB,CAAC,KAAK,CAAC,SAAP,EAAkB,KAAK,CAAC,oBAAN,CAA2B,OAA7C,CAAhB;AACD;AACF,GAJD,EAIG,CAAC,KAAK,CAAC,oBAAP,EAA6B,KAAK,CAAC,SAAnC,CAJH;AAMA,SAAO,KAAP;AACD,CApBM","sourcesContent":["import * as React from 'react';\nimport { useIsSSR } from '@fluentui/react-utilities';\nimport { usePortalMountNode } from './usePortalMountNode';\nimport { setVirtualParent } from '../../virtualParent/index';\nimport type { PortalProps, PortalState } from './Portal.types';\n\n/**\n * Create the state required to render Portal.\n *\n * The returned state can be modified with hooks such as usePortalStyles, before being passed to renderPortal_unstable.\n *\n * @param props - props from this instance of Portal\n */\nexport const usePortal_unstable = (props: PortalProps): PortalState => {\n const { children, mountNode } = props;\n\n const virtualParentRootRef = React.useRef<HTMLSpanElement>(null);\n const fallbackMountNode = usePortalMountNode({ disabled: !!mountNode });\n\n const state: PortalState = {\n children,\n mountNode: mountNode ?? fallbackMountNode,\n shouldRender: !useIsSSR(),\n virtualParentRootRef,\n };\n\n React.useEffect(() => {\n if (state.virtualParentRootRef.current && state.mountNode) {\n setVirtualParent(state.mountNode, state.virtualParentRootRef.current);\n }\n }, [state.virtualParentRootRef, state.mountNode]);\n\n return state;\n};\n"],"sourceRoot":"../src/"}
1
+ {"version":3,"sources":["components/Portal/usePortal.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAZ,MAAuB,OAAvB;AACA,SAAS,QAAT,QAAyB,2BAAzB;AACA,SAAS,kBAAT,QAAmC,sBAAnC;AACA,SAAS,gBAAT,QAAiC,2BAAjC;AAGA;;;;;;AAMG;;AACH,OAAO,MAAM,kBAAkB,GAAI,KAAD,IAAoC;EACpE,MAAM;IAAE,QAAF;IAAY;EAAZ,IAA0B,KAAhC;EAEA,MAAM,oBAAoB,GAAG,KAAK,CAAC,MAAN,CAA8B,IAA9B,CAA7B;EACA,MAAM,iBAAiB,GAAG,kBAAkB,CAAC;IAAE,QAAQ,EAAE,CAAC,CAAC;EAAd,CAAD,CAA5C;EAEA,MAAM,KAAK,GAAgB;IACzB,QADyB;IAEzB,SAAS,EAAE,SAAS,KAAA,IAAT,IAAA,SAAS,KAAA,KAAA,CAAT,GAAA,SAAA,GAAa,iBAFC;IAGzB,YAAY,EAAE,CAAC,QAAQ,EAHE;IAIzB;EAJyB,CAA3B;EAOA,KAAK,CAAC,SAAN,CAAgB,MAAK;IACnB,IAAI,KAAK,CAAC,oBAAN,CAA2B,OAA3B,IAAsC,KAAK,CAAC,SAAhD,EAA2D;MACzD,gBAAgB,CAAC,KAAK,CAAC,SAAP,EAAkB,KAAK,CAAC,oBAAN,CAA2B,OAA7C,CAAhB;IACD;EACF,CAJD,EAIG,CAAC,KAAK,CAAC,oBAAP,EAA6B,KAAK,CAAC,SAAnC,CAJH;EAMA,OAAO,KAAP;AACD,CApBM","sourcesContent":["import * as React from 'react';\nimport { useIsSSR } from '@fluentui/react-utilities';\nimport { usePortalMountNode } from './usePortalMountNode';\nimport { setVirtualParent } from '../../virtualParent/index';\nimport type { PortalProps, PortalState } from './Portal.types';\n\n/**\n * Create the state required to render Portal.\n *\n * The returned state can be modified with hooks such as usePortalStyles, before being passed to renderPortal_unstable.\n *\n * @param props - props from this instance of Portal\n */\nexport const usePortal_unstable = (props: PortalProps): PortalState => {\n const { children, mountNode } = props;\n\n const virtualParentRootRef = React.useRef<HTMLSpanElement>(null);\n const fallbackMountNode = usePortalMountNode({ disabled: !!mountNode });\n\n const state: PortalState = {\n children,\n mountNode: mountNode ?? fallbackMountNode,\n shouldRender: !useIsSSR(),\n virtualParentRootRef,\n };\n\n React.useEffect(() => {\n if (state.virtualParentRootRef.current && state.mountNode) {\n setVirtualParent(state.mountNode, state.virtualParentRootRef.current);\n }\n }, [state.virtualParentRootRef, state.mountNode]);\n\n return state;\n};\n"],"sourceRoot":"../src/"}
@@ -1,30 +1,52 @@
1
1
  import * as React from 'react';
2
2
  import { useIsomorphicLayoutEffect } from '@fluentui/react-utilities';
3
- import { useThemeClassName, useFluent } from '@fluentui/react-shared-contexts';
3
+ import { useThemeClassName_unstable as useThemeClassName, useFluent_unstable as useFluent } from '@fluentui/react-shared-contexts';
4
4
  import { useKeyboardNavAttribute } from '@fluentui/react-tabster';
5
+ import { __styles, mergeClasses } from '@griffel/react';
6
+
7
+ const useStyles = /*#__PURE__*/__styles({
8
+ "root": {
9
+ "qhf8xq": "f10pi13n",
10
+ "Bj3rh1h": "f494woh"
11
+ }
12
+ }, {
13
+ "d": [".f10pi13n{position:relative;}", ".f494woh{z-index:1000000;}"]
14
+ });
5
15
  /**
6
16
  * Creates a new element on a document.body to mount portals
7
17
  */
8
18
 
19
+
9
20
  export const usePortalMountNode = options => {
10
- const themeClassName = useThemeClassName();
11
21
  const {
12
22
  targetDocument,
13
23
  dir
14
24
  } = useFluent();
25
+ const classes = useStyles();
26
+ const themeClassName = useThemeClassName();
27
+ const className = mergeClasses(themeClassName, classes.root);
15
28
  const element = React.useMemo(() => {
16
29
  if (targetDocument === undefined || options.disabled) {
17
30
  return null;
18
31
  }
19
32
 
20
33
  const newElement = targetDocument.createElement('div');
21
- newElement.setAttribute('class', themeClassName);
22
- newElement.setAttribute('dir', dir);
23
34
  targetDocument.body.appendChild(newElement);
24
35
  return newElement;
25
- }, [targetDocument, themeClassName, dir, options.disabled]);
26
- useKeyboardNavAttribute().current = element;
36
+ }, [targetDocument, options.disabled]);
27
37
  useIsomorphicLayoutEffect(() => {
38
+ if (element) {
39
+ const classesToApply = className.split(' ').filter(Boolean);
40
+ element.classList.add(...classesToApply);
41
+ element.setAttribute('dir', dir);
42
+ return () => {
43
+ element.classList.remove(...classesToApply);
44
+ element.removeAttribute('dir');
45
+ };
46
+ }
47
+ }, [element, className, dir]);
48
+ useKeyboardNavAttribute().current = element;
49
+ React.useEffect(() => {
28
50
  return () => {
29
51
  var _a;
30
52
 
@@ -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,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/"}
1
+ {"version":3,"sources":["components/Portal/usePortalMountNode.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAZ,MAAuB,OAAvB;AACA,SAAS,yBAAT,QAA0C,2BAA1C;AACA,SACE,0BAA0B,IAAI,iBADhC,EAEE,kBAAkB,IAAI,SAFxB,QAGO,iCAHP;AAIA,SAAS,uBAAT,QAAwC,yBAAxC;AACA,mBAAqB,YAArB,QAAyC,gBAAzC;;AASA,MAAM,SAAS,gBAAG;EAAA;IAAA;IAAA;EAAA;AAAA;EAAA;AAAA,EAAlB;AAOA;;AAEG;;;AACH,OAAO,MAAM,kBAAkB,GAAI,OAAD,IAA2D;EAC3F,MAAM;IAAE,cAAF;IAAkB;EAAlB,IAA0B,SAAS,EAAzC;EAEA,MAAM,OAAO,GAAG,SAAS,EAAzB;EACA,MAAM,cAAc,GAAG,iBAAiB,EAAxC;EAEA,MAAM,SAAS,GAAG,YAAY,CAAC,cAAD,EAAiB,OAAO,CAAC,IAAzB,CAA9B;EAEA,MAAM,OAAO,GAAG,KAAK,CAAC,OAAN,CAAc,MAAK;IACjC,IAAI,cAAc,KAAK,SAAnB,IAAgC,OAAO,CAAC,QAA5C,EAAsD;MACpD,OAAO,IAAP;IACD;;IAED,MAAM,UAAU,GAAG,cAAc,CAAC,aAAf,CAA6B,KAA7B,CAAnB;IACA,cAAc,CAAC,IAAf,CAAoB,WAApB,CAAgC,UAAhC;IAEA,OAAO,UAAP;EACD,CATe,EASb,CAAC,cAAD,EAAiB,OAAO,CAAC,QAAzB,CATa,CAAhB;EAWA,yBAAyB,CAAC,MAAK;IAC7B,IAAI,OAAJ,EAAa;MACX,MAAM,cAAc,GAAG,SAAS,CAAC,KAAV,CAAgB,GAAhB,EAAqB,MAArB,CAA4B,OAA5B,CAAvB;MAEA,OAAO,CAAC,SAAR,CAAkB,GAAlB,CAAsB,GAAG,cAAzB;MACA,OAAO,CAAC,YAAR,CAAqB,KAArB,EAA4B,GAA5B;MAEA,OAAO,MAAK;QACV,OAAO,CAAC,SAAR,CAAkB,MAAlB,CAAyB,GAAG,cAA5B;QACA,OAAO,CAAC,eAAR,CAAwB,KAAxB;MACD,CAHD;IAID;EACF,CAZwB,EAYtB,CAAC,OAAD,EAAU,SAAV,EAAqB,GAArB,CAZsB,CAAzB;EAcC,uBAAuB,GAA2C,OAAlE,GAA4E,OAA5E;EAED,KAAK,CAAC,SAAN,CAAgB,MAAK;IACnB,OAAO,MAAK;;;MACV,CAAA,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;IACD,CAFD;EAGD,CAJD,EAIG,CAAC,OAAD,CAJH;EAMA,OAAO,OAAP;AACD,CA1CM","sourcesContent":["import * as React from 'react';\nimport { useIsomorphicLayoutEffect } from '@fluentui/react-utilities';\nimport {\n useThemeClassName_unstable as useThemeClassName,\n useFluent_unstable as useFluent,\n} from '@fluentui/react-shared-contexts';\nimport { useKeyboardNavAttribute } from '@fluentui/react-tabster';\nimport { makeStyles, mergeClasses } from '@griffel/react';\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\nconst useStyles = makeStyles({\n root: {\n position: 'relative',\n zIndex: 1000000,\n },\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 { targetDocument, dir } = useFluent();\n\n const classes = useStyles();\n const themeClassName = useThemeClassName();\n\n const className = mergeClasses(themeClassName, classes.root);\n\n const element = React.useMemo(() => {\n if (targetDocument === undefined || options.disabled) {\n return null;\n }\n\n const newElement = targetDocument.createElement('div');\n targetDocument.body.appendChild(newElement);\n\n return newElement;\n }, [targetDocument, options.disabled]);\n\n useIsomorphicLayoutEffect(() => {\n if (element) {\n const classesToApply = className.split(' ').filter(Boolean);\n\n element.classList.add(...classesToApply);\n element.setAttribute('dir', dir);\n\n return () => {\n element.classList.remove(...classesToApply);\n element.removeAttribute('dir');\n };\n }\n }, [element, className, dir]);\n\n (useKeyboardNavAttribute() as React.MutableRefObject<HTMLElement>).current = element!;\n\n React.useEffect(() => {\n return () => {\n element?.parentElement?.removeChild(element);\n };\n }, [element]);\n\n return element;\n};\n"],"sourceRoot":"../src/"}
package/lib/index.js CHANGED
@@ -1,3 +1,3 @@
1
- export * from './components/Portal/index';
1
+ export { Portal, renderPortal_unstable, usePortal_unstable } from './components/Portal/index';
2
2
  export { elementContains, setVirtualParent } from './virtualParent/index';
3
3
  //# sourceMappingURL=index.js.map
package/lib/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"../src/","sources":["index.ts"],"names":[],"mappings":"AAAA,cAAc,2BAA2B,CAAC;AAC1C,OAAO,EAAE,eAAe,EAAE,gBAAgB,EAAE,MAAM,uBAAuB,CAAC","sourcesContent":["export * from './components/Portal/index';\nexport { elementContains, setVirtualParent } from './virtualParent/index';\n"]}
1
+ {"version":3,"file":"index.js","sourceRoot":"../src/","sources":["index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,qBAAqB,EAAE,kBAAkB,EAAE,MAAM,2BAA2B,CAAC;AAE9F,OAAO,EAAE,eAAe,EAAE,gBAAgB,EAAE,MAAM,uBAAuB,CAAC","sourcesContent":["export { Portal, renderPortal_unstable, usePortal_unstable } from './components/Portal/index';\nexport type { PortalProps, PortalState } from './components/Portal/index';\nexport { elementContains, setVirtualParent } from './virtualParent/index';\n"]}
@@ -1 +1 @@
1
- {"version":3,"sources":["virtualParent/elementContains.ts"],"names":[],"mappings":"AAAA,SAAS,SAAT,QAA0B,aAA1B;AACA;;;;;AAKG;;AACH,OAAM,SAAU,eAAV,CAA0B,MAA1B,EAAsD,KAAtD,EAA+E;AACnF,MAAI,CAAC,MAAD,IAAW,CAAC,KAAhB,EAAuB;AACrB,WAAO,KAAP;AACD;;AAED,MAAI,MAAM,KAAK,KAAf,EAAsB;AACpB,WAAO,IAAP;AACD,GAFD,MAEO;AACL,WAAO,KAAP,EAAc;AACZ,YAAM,UAAU,GAAuB,SAAS,CAAC,KAAD,CAAhD;;AAEA,UAAI,UAAU,KAAK,MAAnB,EAA2B;AACzB,eAAO,IAAP;AACD;;AAED,MAAA,KAAK,GAAG,UAAR;AACD;AACF;;AAED,SAAO,KAAP;AACD","sourcesContent":["import { getParent } from './getParent';\n/**\n * Similar functionality to `element.contains` DOM API for use with out of order DOM elements that\n * checks the virtual parent hierarchy. If a virtual parents exists, it is chosen over the actual parent\n *\n * @returns true if the child can find the parent in its virtual hierarchy\n */\nexport function elementContains(parent: HTMLElement | null, child: HTMLElement | null): boolean {\n if (!parent || !child) {\n return false;\n }\n\n if (parent === child) {\n return true;\n } else {\n while (child) {\n const nextParent: HTMLElement | null = getParent(child);\n\n if (nextParent === parent) {\n return true;\n }\n\n child = nextParent;\n }\n }\n\n return false;\n}\n"],"sourceRoot":"../src/"}
1
+ {"version":3,"sources":["virtualParent/elementContains.ts"],"names":[],"mappings":"AAAA,SAAS,SAAT,QAA0B,aAA1B;AACA;;;;;AAKG;;AACH,OAAM,SAAU,eAAV,CAA0B,MAA1B,EAAsD,KAAtD,EAA+E;EACnF,IAAI,CAAC,MAAD,IAAW,CAAC,KAAhB,EAAuB;IACrB,OAAO,KAAP;EACD;;EAED,IAAI,MAAM,KAAK,KAAf,EAAsB;IACpB,OAAO,IAAP;EACD,CAFD,MAEO;IACL,OAAO,KAAP,EAAc;MACZ,MAAM,UAAU,GAAuB,SAAS,CAAC,KAAD,CAAhD;;MAEA,IAAI,UAAU,KAAK,MAAnB,EAA2B;QACzB,OAAO,IAAP;MACD;;MAED,KAAK,GAAG,UAAR;IACD;EACF;;EAED,OAAO,KAAP;AACD","sourcesContent":["import { getParent } from './getParent';\n/**\n * Similar functionality to `element.contains` DOM API for use with out of order DOM elements that\n * checks the virtual parent hierarchy. If a virtual parents exists, it is chosen over the actual parent\n *\n * @returns true if the child can find the parent in its virtual hierarchy\n */\nexport function elementContains(parent: HTMLElement | null, child: HTMLElement | null): boolean {\n if (!parent || !child) {\n return false;\n }\n\n if (parent === child) {\n return true;\n } else {\n while (child) {\n const nextParent: HTMLElement | null = getParent(child);\n\n if (nextParent === parent) {\n return true;\n }\n\n child = nextParent;\n }\n }\n\n return false;\n}\n"],"sourceRoot":"../src/"}
@@ -1 +1 @@
1
- {"version":3,"sources":["virtualParent/getParent.ts"],"names":[],"mappings":"AAAA,SAAS,gBAAT,QAAiC,oBAAjC;AAEA;;;AAGG;;AACH,OAAM,SAAU,SAAV,CAAoB,KAApB,EAA6C;AACjD,SAAQ,KAAK,IAAI,gBAAgB,CAAC,KAAD,CAA1B,KAAuC,KAAK,KAAA,IAAL,IAAA,KAAK,KAAA,KAAA,CAAL,GAAK,KAAA,CAAL,GAAA,KAAK,CAAE,UAA9C,CAAP;AACD","sourcesContent":["import { getVirtualParent } from './getVirtualParent';\n\n/**\n * Gets the element which is the parent of a given element.\n * This method prefers the virtual parent over real DOM parent when present.\n */\nexport function getParent(child: HTMLElement | null): HTMLElement | null {\n return (child && getVirtualParent(child)) || (child?.parentNode as HTMLElement | null);\n}\n"],"sourceRoot":"../src/"}
1
+ {"version":3,"sources":["virtualParent/getParent.ts"],"names":[],"mappings":"AAAA,SAAS,gBAAT,QAAiC,oBAAjC;AAEA;;;AAGG;;AACH,OAAM,SAAU,SAAV,CAAoB,KAApB,EAA6C;EACjD,OAAQ,KAAK,IAAI,gBAAgB,CAAC,KAAD,CAA1B,KAAuC,KAAK,KAAA,IAAL,IAAA,KAAK,KAAA,KAAA,CAAL,GAAK,KAAA,CAAL,GAAA,KAAK,CAAE,UAA9C,CAAP;AACD","sourcesContent":["import { getVirtualParent } from './getVirtualParent';\n\n/**\n * Gets the element which is the parent of a given element.\n * This method prefers the virtual parent over real DOM parent when present.\n */\nexport function getParent(child: HTMLElement | null): HTMLElement | null {\n return (child && getVirtualParent(child)) || (child?.parentNode as HTMLElement | null);\n}\n"],"sourceRoot":"../src/"}
@@ -1 +1 @@
1
- {"version":3,"sources":["virtualParent/getVirtualParent.ts"],"names":[],"mappings":"AAAA,SAAS,gBAAT,QAAiC,oBAAjC;AACA;;AAEG;;AACH,OAAM,SAAU,gBAAV,CAA2B,KAA3B,EAA6C;AACjD,MAAI,MAAJ;;AACA,MAAI,gBAAgB,CAAC,KAAD,CAApB,EAA6B;AAC3B,IAAA,MAAM,GAAG,KAAK,CAAC,QAAN,CAAe,MAAxB;AACD;;AACD,SAAO,MAAP;AACD","sourcesContent":["import { isVirtualElement } from './isVirtualElement';\n/**\n * Gets the virtual parent given the child element, if it exists.\n */\nexport function getVirtualParent(child: HTMLElement): HTMLElement | undefined {\n let parent: HTMLElement | undefined;\n if (isVirtualElement(child)) {\n parent = child._virtual.parent;\n }\n return parent;\n}\n"],"sourceRoot":"../src/"}
1
+ {"version":3,"sources":["virtualParent/getVirtualParent.ts"],"names":[],"mappings":"AAAA,SAAS,gBAAT,QAAiC,oBAAjC;AACA;;AAEG;;AACH,OAAM,SAAU,gBAAV,CAA2B,KAA3B,EAA6C;EACjD,IAAI,MAAJ;;EACA,IAAI,gBAAgB,CAAC,KAAD,CAApB,EAA6B;IAC3B,MAAM,GAAG,KAAK,CAAC,QAAN,CAAe,MAAxB;EACD;;EACD,OAAO,MAAP;AACD","sourcesContent":["import { isVirtualElement } from './isVirtualElement';\n/**\n * Gets the virtual parent given the child element, if it exists.\n */\nexport function getVirtualParent(child: HTMLElement): HTMLElement | undefined {\n let parent: HTMLElement | undefined;\n if (isVirtualElement(child)) {\n parent = child._virtual.parent;\n }\n return parent;\n}\n"],"sourceRoot":"../src/"}
@@ -1 +1 @@
1
- {"version":3,"sources":["virtualParent/isVirtualElement.ts"],"names":[],"mappings":"AAEA;;AAEG;AACH,OAAM,SAAU,gBAAV,CAA2B,OAA3B,EAAgE;AACpE,SAAO,OAAO,IAAI,CAAC,CAAkB,OAAQ,CAAC,QAA9C;AACD","sourcesContent":["import type { VirtualElement } from './types';\n\n/**\n * Determines whether or not an element has the virtual hierarchy extension.\n */\nexport function isVirtualElement(element: HTMLElement | VirtualElement): element is VirtualElement {\n return element && !!(<VirtualElement>element)._virtual;\n}\n"],"sourceRoot":"../src/"}
1
+ {"version":3,"sources":["virtualParent/isVirtualElement.ts"],"names":[],"mappings":"AAEA;;AAEG;AACH,OAAM,SAAU,gBAAV,CAA2B,OAA3B,EAAgE;EACpE,OAAO,OAAO,IAAI,CAAC,CAAkB,OAAQ,CAAC,QAA9C;AACD","sourcesContent":["import type { VirtualElement } from './types';\n\n/**\n * Determines whether or not an element has the virtual hierarchy extension.\n */\nexport function isVirtualElement(element: HTMLElement | VirtualElement): element is VirtualElement {\n return element && !!(<VirtualElement>element)._virtual;\n}\n"],"sourceRoot":"../src/"}
@@ -1 +1 @@
1
- {"version":3,"sources":["virtualParent/setVirtualParent.ts"],"names":[],"mappings":"AAEA;;;;;AAKG;AACH,OAAM,SAAU,gBAAV,CAA2B,KAA3B,EAA+C,MAA/C,EAAmE;AACvE,MAAI,CAAC,KAAL,EAAY;AACV;AACD;;AAED,QAAM,YAAY,GAAmB,KAArC;;AAEA,MAAI,CAAC,YAAY,CAAC,QAAlB,EAA4B;AAC1B,IAAA,YAAY,CAAC,QAAb,GAAwB,EAAxB;AACD;;AAED,EAAA,YAAY,CAAC,QAAb,CAAsB,MAAtB,GAA+B,MAAM,IAAI,SAAzC;AACD","sourcesContent":["import type { VirtualElement } from './types';\n\n/**\n * Sets the virtual parent of an element.\n *\n * @param child - Theme element to set the virtual parent\n * @param parent - The virtual parent, use `undefined` to remove a virtual parent relationship\n */\nexport function setVirtualParent(child: HTMLElement, parent?: HTMLElement): void {\n if (!child) {\n return;\n }\n\n const virtualChild = <VirtualElement>child;\n\n if (!virtualChild._virtual) {\n virtualChild._virtual = {};\n }\n\n virtualChild._virtual.parent = parent || undefined;\n}\n"],"sourceRoot":"../src/"}
1
+ {"version":3,"sources":["virtualParent/setVirtualParent.ts"],"names":[],"mappings":"AAEA;;;;;AAKG;AACH,OAAM,SAAU,gBAAV,CAA2B,KAA3B,EAA+C,MAA/C,EAAmE;EACvE,IAAI,CAAC,KAAL,EAAY;IACV;EACD;;EAED,MAAM,YAAY,GAAmB,KAArC;;EAEA,IAAI,CAAC,YAAY,CAAC,QAAlB,EAA4B;IAC1B,YAAY,CAAC,QAAb,GAAwB,EAAxB;EACD;;EAED,YAAY,CAAC,QAAb,CAAsB,MAAtB,GAA+B,MAAM,IAAI,SAAzC;AACD","sourcesContent":["import type { VirtualElement } from './types';\n\n/**\n * Sets the virtual parent of an element.\n *\n * @param child - Theme element to set the virtual parent\n * @param parent - The virtual parent, use `undefined` to remove a virtual parent relationship\n */\nexport function setVirtualParent(child: HTMLElement, parent?: HTMLElement): void {\n if (!child) {\n return;\n }\n\n const virtualChild = <VirtualElement>child;\n\n if (!virtualChild._virtual) {\n virtualChild._virtual = {};\n }\n\n virtualChild._virtual.parent = parent || undefined;\n}\n"],"sourceRoot":"../src/"}
@@ -1 +1 @@
1
- {"version":3,"sources":["components/Portal/Portal.tsx"],"names":[],"mappings":";;;;;;;AAEA,MAAA,WAAA,gBAAA,OAAA,CAAA,aAAA,CAAA;;AACA,MAAA,cAAA,gBAAA,OAAA,CAAA,gBAAA,CAAA;AAGA;;;AAGG;;;AACI,MAAM,MAAM,GAA0B,KAAK,IAAG;AACnD,QAAM,KAAK,GAAG,WAAA,CAAA,kBAAA,CAAmB,KAAnB,CAAd;AAEA,SAAO,cAAA,CAAA,qBAAA,CAAsB,KAAtB,CAAP;AACD,CAJM;;AAAM,OAAA,CAAA,MAAA,GAAM,MAAN;AAMb,OAAA,CAAA,MAAA,CAAO,WAAP,GAAqB,QAArB","sourcesContent":["import * as React from 'react';\n\nimport { usePortal_unstable } from './usePortal';\nimport { renderPortal_unstable } from './renderPortal';\nimport type { PortalProps } from './Portal.types';\n\n/**\n * A portal provides a way to render children into a DOM node\n * that exists outside the DOM hierarchy of the parent component.\n */\nexport const Portal: React.FC<PortalProps> = props => {\n const state = usePortal_unstable(props);\n\n return renderPortal_unstable(state);\n};\n\nPortal.displayName = 'Portal';\n"],"sourceRoot":"../src/"}
1
+ {"version":3,"sources":["components/Portal/Portal.tsx"],"names":[],"mappings":";;;;;;;AAEA,MAAA,WAAA,gBAAA,OAAA,CAAA,aAAA,CAAA;;AACA,MAAA,cAAA,gBAAA,OAAA,CAAA,gBAAA,CAAA;AAGA;;;AAGG;;;AACI,MAAM,MAAM,GAA0B,KAAK,IAAG;EACnD,MAAM,KAAK,GAAG,WAAA,CAAA,kBAAA,CAAmB,KAAnB,CAAd;EAEA,OAAO,cAAA,CAAA,qBAAA,CAAsB,KAAtB,CAAP;AACD,CAJM;;AAAM,OAAA,CAAA,MAAA,GAAM,MAAN;AAMb,OAAA,CAAA,MAAA,CAAO,WAAP,GAAqB,QAArB","sourcesContent":["import * as React from 'react';\n\nimport { usePortal_unstable } from './usePortal';\nimport { renderPortal_unstable } from './renderPortal';\nimport type { PortalProps } from './Portal.types';\n\n/**\n * A portal provides a way to render children into a DOM node\n * that exists outside the DOM hierarchy of the parent component.\n */\nexport const Portal: React.FC<PortalProps> = props => {\n const state = usePortal_unstable(props);\n\n return renderPortal_unstable(state);\n};\n\nPortal.displayName = 'Portal';\n"],"sourceRoot":"../src/"}
@@ -1 +1 @@
1
- {"version":3,"sources":["components/Portal/renderPortal.tsx"],"names":[],"mappings":";;;;;;;AAAA,MAAA,QAAA,gBAAA,OAAA,CAAA,WAAA,CAAA;;AACA,MAAA,KAAA,gBAAA,OAAA,CAAA,OAAA,CAAA;AAGA;;AAEG;;;AACI,MAAM,qBAAqB,GAAI,KAAD,IAA2C;AAC9E,SACE,KAAA,CAAA,aAAA,CAAA,MAAA,EAAA;AAAM,IAAA,MAAM,EAAA,IAAZ;AAAa,IAAA,GAAG,EAAE,KAAK,CAAC;AAAxB,GAAA,EACG,KAAK,CAAC,YAAN,IAAsB,KAAK,CAAC,SAA5B,IAAyC,QAAQ,CAAC,YAAT,CAAsB,KAAK,CAAC,QAA5B,EAAsC,KAAK,CAAC,SAA5C,CAD5C,CADF;AAKD,CANM;;AAAM,OAAA,CAAA,qBAAA,GAAqB,qBAArB","sourcesContent":["import * as ReactDOM from 'react-dom';\nimport * as React from 'react';\nimport type { PortalState } from './Portal.types';\n\n/**\n * Render the final JSX of Portal\n */\nexport const renderPortal_unstable = (state: PortalState): React.ReactElement => {\n return (\n <span hidden ref={state.virtualParentRootRef}>\n {state.shouldRender && state.mountNode && ReactDOM.createPortal(state.children, state.mountNode)}\n </span>\n );\n};\n"],"sourceRoot":"../src/"}
1
+ {"version":3,"sources":["components/Portal/renderPortal.tsx"],"names":[],"mappings":";;;;;;;AAAA,MAAA,QAAA,gBAAA,OAAA,CAAA,WAAA,CAAA;;AACA,MAAA,KAAA,gBAAA,OAAA,CAAA,OAAA,CAAA;AAGA;;AAEG;;;AACI,MAAM,qBAAqB,GAAI,KAAD,IAA2C;EAC9E,OACE,KAAA,CAAA,aAAA,CAAA,MAAA,EAAA;IAAM,MAAM,EAAA,IAAZ;IAAa,GAAG,EAAE,KAAK,CAAC;EAAxB,CAAA,EACG,KAAK,CAAC,YAAN,IAAsB,KAAK,CAAC,SAA5B,IAAyC,QAAQ,CAAC,YAAT,CAAsB,KAAK,CAAC,QAA5B,EAAsC,KAAK,CAAC,SAA5C,CAD5C,CADF;AAKD,CANM;;AAAM,OAAA,CAAA,qBAAA,GAAqB,qBAArB","sourcesContent":["import * as ReactDOM from 'react-dom';\nimport * as React from 'react';\nimport type { PortalState } from './Portal.types';\n\n/**\n * Render the final JSX of Portal\n */\nexport const renderPortal_unstable = (state: PortalState): React.ReactElement => {\n return (\n <span hidden ref={state.virtualParentRootRef}>\n {state.shouldRender && state.mountNode && ReactDOM.createPortal(state.children, state.mountNode)}\n </span>\n );\n};\n"],"sourceRoot":"../src/"}
@@ -1 +1 @@
1
- {"version":3,"sources":["components/Portal/usePortal.ts"],"names":[],"mappings":";;;;;;;AAAA,MAAA,KAAA,gBAAA,OAAA,CAAA,OAAA,CAAA;;AACA,MAAA,iBAAA,gBAAA,OAAA,CAAA,2BAAA,CAAA;;AACA,MAAA,oBAAA,gBAAA,OAAA,CAAA,sBAAA,CAAA;;AACA,MAAA,OAAA,gBAAA,OAAA,CAAA,2BAAA,CAAA;AAGA;;;;;;AAMG;;;AACI,MAAM,kBAAkB,GAAI,KAAD,IAAoC;AACpE,QAAM;AAAE,IAAA,QAAF;AAAY,IAAA;AAAZ,MAA0B,KAAhC;AAEA,QAAM,oBAAoB,GAAG,KAAK,CAAC,MAAN,CAA8B,IAA9B,CAA7B;AACA,QAAM,iBAAiB,GAAG,oBAAA,CAAA,kBAAA,CAAmB;AAAE,IAAA,QAAQ,EAAE,CAAC,CAAC;AAAd,GAAnB,CAA1B;AAEA,QAAM,KAAK,GAAgB;AACzB,IAAA,QADyB;AAEzB,IAAA,SAAS,EAAE,SAAS,KAAA,IAAT,IAAA,SAAS,KAAA,KAAA,CAAT,GAAA,SAAA,GAAa,iBAFC;AAGzB,IAAA,YAAY,EAAE,CAAC,iBAAA,CAAA,QAAA,EAHU;AAIzB,IAAA;AAJyB,GAA3B;AAOA,EAAA,KAAK,CAAC,SAAN,CAAgB,MAAK;AACnB,QAAI,KAAK,CAAC,oBAAN,CAA2B,OAA3B,IAAsC,KAAK,CAAC,SAAhD,EAA2D;AACzD,MAAA,OAAA,CAAA,gBAAA,CAAiB,KAAK,CAAC,SAAvB,EAAkC,KAAK,CAAC,oBAAN,CAA2B,OAA7D;AACD;AACF,GAJD,EAIG,CAAC,KAAK,CAAC,oBAAP,EAA6B,KAAK,CAAC,SAAnC,CAJH;AAMA,SAAO,KAAP;AACD,CApBM;;AAAM,OAAA,CAAA,kBAAA,GAAkB,kBAAlB","sourcesContent":["import * as React from 'react';\nimport { useIsSSR } from '@fluentui/react-utilities';\nimport { usePortalMountNode } from './usePortalMountNode';\nimport { setVirtualParent } from '../../virtualParent/index';\nimport type { PortalProps, PortalState } from './Portal.types';\n\n/**\n * Create the state required to render Portal.\n *\n * The returned state can be modified with hooks such as usePortalStyles, before being passed to renderPortal_unstable.\n *\n * @param props - props from this instance of Portal\n */\nexport const usePortal_unstable = (props: PortalProps): PortalState => {\n const { children, mountNode } = props;\n\n const virtualParentRootRef = React.useRef<HTMLSpanElement>(null);\n const fallbackMountNode = usePortalMountNode({ disabled: !!mountNode });\n\n const state: PortalState = {\n children,\n mountNode: mountNode ?? fallbackMountNode,\n shouldRender: !useIsSSR(),\n virtualParentRootRef,\n };\n\n React.useEffect(() => {\n if (state.virtualParentRootRef.current && state.mountNode) {\n setVirtualParent(state.mountNode, state.virtualParentRootRef.current);\n }\n }, [state.virtualParentRootRef, state.mountNode]);\n\n return state;\n};\n"],"sourceRoot":"../src/"}
1
+ {"version":3,"sources":["components/Portal/usePortal.ts"],"names":[],"mappings":";;;;;;;AAAA,MAAA,KAAA,gBAAA,OAAA,CAAA,OAAA,CAAA;;AACA,MAAA,iBAAA,gBAAA,OAAA,CAAA,2BAAA,CAAA;;AACA,MAAA,oBAAA,gBAAA,OAAA,CAAA,sBAAA,CAAA;;AACA,MAAA,OAAA,gBAAA,OAAA,CAAA,2BAAA,CAAA;AAGA;;;;;;AAMG;;;AACI,MAAM,kBAAkB,GAAI,KAAD,IAAoC;EACpE,MAAM;IAAE,QAAF;IAAY;EAAZ,IAA0B,KAAhC;EAEA,MAAM,oBAAoB,GAAG,KAAK,CAAC,MAAN,CAA8B,IAA9B,CAA7B;EACA,MAAM,iBAAiB,GAAG,oBAAA,CAAA,kBAAA,CAAmB;IAAE,QAAQ,EAAE,CAAC,CAAC;EAAd,CAAnB,CAA1B;EAEA,MAAM,KAAK,GAAgB;IACzB,QADyB;IAEzB,SAAS,EAAE,SAAS,KAAA,IAAT,IAAA,SAAS,KAAA,KAAA,CAAT,GAAA,SAAA,GAAa,iBAFC;IAGzB,YAAY,EAAE,CAAC,iBAAA,CAAA,QAAA,EAHU;IAIzB;EAJyB,CAA3B;EAOA,KAAK,CAAC,SAAN,CAAgB,MAAK;IACnB,IAAI,KAAK,CAAC,oBAAN,CAA2B,OAA3B,IAAsC,KAAK,CAAC,SAAhD,EAA2D;MACzD,OAAA,CAAA,gBAAA,CAAiB,KAAK,CAAC,SAAvB,EAAkC,KAAK,CAAC,oBAAN,CAA2B,OAA7D;IACD;EACF,CAJD,EAIG,CAAC,KAAK,CAAC,oBAAP,EAA6B,KAAK,CAAC,SAAnC,CAJH;EAMA,OAAO,KAAP;AACD,CApBM;;AAAM,OAAA,CAAA,kBAAA,GAAkB,kBAAlB","sourcesContent":["import * as React from 'react';\nimport { useIsSSR } from '@fluentui/react-utilities';\nimport { usePortalMountNode } from './usePortalMountNode';\nimport { setVirtualParent } from '../../virtualParent/index';\nimport type { PortalProps, PortalState } from './Portal.types';\n\n/**\n * Create the state required to render Portal.\n *\n * The returned state can be modified with hooks such as usePortalStyles, before being passed to renderPortal_unstable.\n *\n * @param props - props from this instance of Portal\n */\nexport const usePortal_unstable = (props: PortalProps): PortalState => {\n const { children, mountNode } = props;\n\n const virtualParentRootRef = React.useRef<HTMLSpanElement>(null);\n const fallbackMountNode = usePortalMountNode({ disabled: !!mountNode });\n\n const state: PortalState = {\n children,\n mountNode: mountNode ?? fallbackMountNode,\n shouldRender: !useIsSSR(),\n virtualParentRootRef,\n };\n\n React.useEffect(() => {\n if (state.virtualParentRootRef.current && state.mountNode) {\n setVirtualParent(state.mountNode, state.virtualParentRootRef.current);\n }\n }, [state.virtualParentRootRef, state.mountNode]);\n\n return state;\n};\n"],"sourceRoot":"../src/"}
@@ -12,30 +12,52 @@ const react_utilities_1 = /*#__PURE__*/require("@fluentui/react-utilities");
12
12
  const react_shared_contexts_1 = /*#__PURE__*/require("@fluentui/react-shared-contexts");
13
13
 
14
14
  const react_tabster_1 = /*#__PURE__*/require("@fluentui/react-tabster");
15
+
16
+ const react_1 = /*#__PURE__*/require("@griffel/react");
17
+
18
+ const useStyles = /*#__PURE__*/react_1.__styles({
19
+ "root": {
20
+ "qhf8xq": "f10pi13n",
21
+ "Bj3rh1h": "f494woh"
22
+ }
23
+ }, {
24
+ "d": [".f10pi13n{position:relative;}", ".f494woh{z-index:1000000;}"]
25
+ });
15
26
  /**
16
27
  * Creates a new element on a document.body to mount portals
17
28
  */
18
29
 
19
30
 
20
31
  const usePortalMountNode = options => {
21
- const themeClassName = react_shared_contexts_1.useThemeClassName();
22
32
  const {
23
33
  targetDocument,
24
34
  dir
25
- } = react_shared_contexts_1.useFluent();
35
+ } = react_shared_contexts_1.useFluent_unstable();
36
+ const classes = useStyles();
37
+ const themeClassName = react_shared_contexts_1.useThemeClassName_unstable();
38
+ const className = react_1.mergeClasses(themeClassName, classes.root);
26
39
  const element = React.useMemo(() => {
27
40
  if (targetDocument === undefined || options.disabled) {
28
41
  return null;
29
42
  }
30
43
 
31
44
  const newElement = targetDocument.createElement('div');
32
- newElement.setAttribute('class', themeClassName);
33
- newElement.setAttribute('dir', dir);
34
45
  targetDocument.body.appendChild(newElement);
35
46
  return newElement;
36
- }, [targetDocument, themeClassName, dir, options.disabled]);
37
- react_tabster_1.useKeyboardNavAttribute().current = element;
47
+ }, [targetDocument, options.disabled]);
38
48
  react_utilities_1.useIsomorphicLayoutEffect(() => {
49
+ if (element) {
50
+ const classesToApply = className.split(' ').filter(Boolean);
51
+ element.classList.add(...classesToApply);
52
+ element.setAttribute('dir', dir);
53
+ return () => {
54
+ element.classList.remove(...classesToApply);
55
+ element.removeAttribute('dir');
56
+ };
57
+ }
58
+ }, [element, className, dir]);
59
+ react_tabster_1.useKeyboardNavAttribute().current = element;
60
+ React.useEffect(() => {
39
61
  return () => {
40
62
  var _a;
41
63
 
@@ -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,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/"}
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;;AAIA,MAAA,eAAA,gBAAA,OAAA,CAAA,yBAAA,CAAA;;AACA,MAAA,OAAA,gBAAA,OAAA,CAAA,gBAAA,CAAA;;AASA,MAAM,SAAS,gBAAG,OAAA,SAAA;EAAA;IAAA;IAAA;EAAA;AAAA;EAAA;AAAA,EAAlB;AAOA;;AAEG;;;AACI,MAAM,kBAAkB,GAAI,OAAD,IAA2D;EAC3F,MAAM;IAAE,cAAF;IAAkB;EAAlB,IAA0B,uBAAA,CAAA,kBAAA,EAAhC;EAEA,MAAM,OAAO,GAAG,SAAS,EAAzB;EACA,MAAM,cAAc,GAAG,uBAAA,CAAA,0BAAA,EAAvB;EAEA,MAAM,SAAS,GAAG,OAAA,CAAA,YAAA,CAAa,cAAb,EAA6B,OAAO,CAAC,IAArC,CAAlB;EAEA,MAAM,OAAO,GAAG,KAAK,CAAC,OAAN,CAAc,MAAK;IACjC,IAAI,cAAc,KAAK,SAAnB,IAAgC,OAAO,CAAC,QAA5C,EAAsD;MACpD,OAAO,IAAP;IACD;;IAED,MAAM,UAAU,GAAG,cAAc,CAAC,aAAf,CAA6B,KAA7B,CAAnB;IACA,cAAc,CAAC,IAAf,CAAoB,WAApB,CAAgC,UAAhC;IAEA,OAAO,UAAP;EACD,CATe,EASb,CAAC,cAAD,EAAiB,OAAO,CAAC,QAAzB,CATa,CAAhB;EAWA,iBAAA,CAAA,yBAAA,CAA0B,MAAK;IAC7B,IAAI,OAAJ,EAAa;MACX,MAAM,cAAc,GAAG,SAAS,CAAC,KAAV,CAAgB,GAAhB,EAAqB,MAArB,CAA4B,OAA5B,CAAvB;MAEA,OAAO,CAAC,SAAR,CAAkB,GAAlB,CAAsB,GAAG,cAAzB;MACA,OAAO,CAAC,YAAR,CAAqB,KAArB,EAA4B,GAA5B;MAEA,OAAO,MAAK;QACV,OAAO,CAAC,SAAR,CAAkB,MAAlB,CAAyB,GAAG,cAA5B;QACA,OAAO,CAAC,eAAR,CAAwB,KAAxB;MACD,CAHD;IAID;EACF,CAZD,EAYG,CAAC,OAAD,EAAU,SAAV,EAAqB,GAArB,CAZH;EAcC,eAAA,CAAA,uBAAA,GAAkE,OAAlE,GAA4E,OAA5E;EAED,KAAK,CAAC,SAAN,CAAgB,MAAK;IACnB,OAAO,MAAK;;;MACV,CAAA,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;IACD,CAFD;EAGD,CAJD,EAIG,CAAC,OAAD,CAJH;EAMA,OAAO,OAAP;AACD,CA1CM;;AAAM,OAAA,CAAA,kBAAA,GAAkB,kBAAlB","sourcesContent":["import * as React from 'react';\nimport { useIsomorphicLayoutEffect } from '@fluentui/react-utilities';\nimport {\n useThemeClassName_unstable as useThemeClassName,\n useFluent_unstable as useFluent,\n} from '@fluentui/react-shared-contexts';\nimport { useKeyboardNavAttribute } from '@fluentui/react-tabster';\nimport { makeStyles, mergeClasses } from '@griffel/react';\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\nconst useStyles = makeStyles({\n root: {\n position: 'relative',\n zIndex: 1000000,\n },\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 { targetDocument, dir } = useFluent();\n\n const classes = useStyles();\n const themeClassName = useThemeClassName();\n\n const className = mergeClasses(themeClassName, classes.root);\n\n const element = React.useMemo(() => {\n if (targetDocument === undefined || options.disabled) {\n return null;\n }\n\n const newElement = targetDocument.createElement('div');\n targetDocument.body.appendChild(newElement);\n\n return newElement;\n }, [targetDocument, options.disabled]);\n\n useIsomorphicLayoutEffect(() => {\n if (element) {\n const classesToApply = className.split(' ').filter(Boolean);\n\n element.classList.add(...classesToApply);\n element.setAttribute('dir', dir);\n\n return () => {\n element.classList.remove(...classesToApply);\n element.removeAttribute('dir');\n };\n }\n }, [element, className, dir]);\n\n (useKeyboardNavAttribute() as React.MutableRefObject<HTMLElement>).current = element!;\n\n React.useEffect(() => {\n return () => {\n element?.parentElement?.removeChild(element);\n };\n }, [element]);\n\n return element;\n};\n"],"sourceRoot":"../src/"}
@@ -3,24 +3,41 @@
3
3
  Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
- exports.setVirtualParent = exports.elementContains = void 0;
6
+ exports.setVirtualParent = exports.elementContains = exports.usePortal_unstable = exports.renderPortal_unstable = exports.Portal = void 0;
7
7
 
8
- const tslib_1 = /*#__PURE__*/require("tslib");
8
+ var index_1 = /*#__PURE__*/require("./components/Portal/index");
9
9
 
10
- tslib_1.__exportStar(require("./components/Portal/index"), exports);
10
+ Object.defineProperty(exports, "Portal", {
11
+ enumerable: true,
12
+ get: function () {
13
+ return index_1.Portal;
14
+ }
15
+ });
16
+ Object.defineProperty(exports, "renderPortal_unstable", {
17
+ enumerable: true,
18
+ get: function () {
19
+ return index_1.renderPortal_unstable;
20
+ }
21
+ });
22
+ Object.defineProperty(exports, "usePortal_unstable", {
23
+ enumerable: true,
24
+ get: function () {
25
+ return index_1.usePortal_unstable;
26
+ }
27
+ });
11
28
 
12
- var index_1 = /*#__PURE__*/require("./virtualParent/index");
29
+ var index_2 = /*#__PURE__*/require("./virtualParent/index");
13
30
 
14
31
  Object.defineProperty(exports, "elementContains", {
15
32
  enumerable: true,
16
33
  get: function () {
17
- return index_1.elementContains;
34
+ return index_2.elementContains;
18
35
  }
19
36
  });
20
37
  Object.defineProperty(exports, "setVirtualParent", {
21
38
  enumerable: true,
22
39
  get: function () {
23
- return index_1.setVirtualParent;
40
+ return index_2.setVirtualParent;
24
41
  }
25
42
  });
26
43
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["index.ts"],"names":[],"mappings":";;;;;;;;;AAAA,OAAA,CAAA,YAAA,CAAA,OAAA,CAAA,2BAAA,CAAA,EAAA,OAAA;;AACA,IAAA,OAAA,gBAAA,OAAA,CAAA,uBAAA,CAAA;;AAAS,MAAA,CAAA,cAAA,CAAA,OAAA,EAAA,iBAAA,EAAA;AAAA,EAAA,UAAA,EAAA,IAAA;AAAA,EAAA,GAAA,EAAA,YAAA;AAAA,WAAA,OAAA,CAAA,eAAA;AAAe;AAAf,CAAA;AAAiB,MAAA,CAAA,cAAA,CAAA,OAAA,EAAA,kBAAA,EAAA;AAAA,EAAA,UAAA,EAAA,IAAA;AAAA,EAAA,GAAA,EAAA,YAAA;AAAA,WAAA,OAAA,CAAA,gBAAA;AAAgB;AAAhB,CAAA","sourcesContent":["export * from './components/Portal/index';\nexport { elementContains, setVirtualParent } from './virtualParent/index';\n"],"sourceRoot":"../src/"}
1
+ {"version":3,"sources":["index.ts"],"names":[],"mappings":";;;;;;;AAAA,IAAA,OAAA,gBAAA,OAAA,CAAA,2BAAA,CAAA;;AAAS,MAAA,CAAA,cAAA,CAAA,OAAA,EAAA,QAAA,EAAA;EAAA,UAAA,EAAA,IAAA;EAAA,GAAA,EAAA,YAAA;IAAA,OAAA,OAAA,CAAA,MAAA;EAAM;AAAN,CAAA;AAAQ,MAAA,CAAA,cAAA,CAAA,OAAA,EAAA,uBAAA,EAAA;EAAA,UAAA,EAAA,IAAA;EAAA,GAAA,EAAA,YAAA;IAAA,OAAA,OAAA,CAAA,qBAAA;EAAqB;AAArB,CAAA;AAAuB,MAAA,CAAA,cAAA,CAAA,OAAA,EAAA,oBAAA,EAAA;EAAA,UAAA,EAAA,IAAA;EAAA,GAAA,EAAA,YAAA;IAAA,OAAA,OAAA,CAAA,kBAAA;EAAkB;AAAlB,CAAA;;AAExC,IAAA,OAAA,gBAAA,OAAA,CAAA,uBAAA,CAAA;;AAAS,MAAA,CAAA,cAAA,CAAA,OAAA,EAAA,iBAAA,EAAA;EAAA,UAAA,EAAA,IAAA;EAAA,GAAA,EAAA,YAAA;IAAA,OAAA,OAAA,CAAA,eAAA;EAAe;AAAf,CAAA;AAAiB,MAAA,CAAA,cAAA,CAAA,OAAA,EAAA,kBAAA,EAAA;EAAA,UAAA,EAAA,IAAA;EAAA,GAAA,EAAA,YAAA;IAAA,OAAA,OAAA,CAAA,gBAAA;EAAgB;AAAhB,CAAA","sourcesContent":["export { Portal, renderPortal_unstable, usePortal_unstable } from './components/Portal/index';\nexport type { PortalProps, PortalState } from './components/Portal/index';\nexport { elementContains, setVirtualParent } from './virtualParent/index';\n"],"sourceRoot":"../src/"}
@@ -1 +1 @@
1
- {"version":3,"sources":["virtualParent/elementContains.ts"],"names":[],"mappings":";;;;;;;AAAA,MAAA,WAAA,gBAAA,OAAA,CAAA,aAAA,CAAA;AACA;;;;;AAKG;;;AACH,SAAgB,eAAhB,CAAgC,MAAhC,EAA4D,KAA5D,EAAqF;AACnF,MAAI,CAAC,MAAD,IAAW,CAAC,KAAhB,EAAuB;AACrB,WAAO,KAAP;AACD;;AAED,MAAI,MAAM,KAAK,KAAf,EAAsB;AACpB,WAAO,IAAP;AACD,GAFD,MAEO;AACL,WAAO,KAAP,EAAc;AACZ,YAAM,UAAU,GAAuB,WAAA,CAAA,SAAA,CAAU,KAAV,CAAvC;;AAEA,UAAI,UAAU,KAAK,MAAnB,EAA2B;AACzB,eAAO,IAAP;AACD;;AAED,MAAA,KAAK,GAAG,UAAR;AACD;AACF;;AAED,SAAO,KAAP;AACD;;AApBD,OAAA,CAAA,eAAA,GAAA,eAAA","sourcesContent":["import { getParent } from './getParent';\n/**\n * Similar functionality to `element.contains` DOM API for use with out of order DOM elements that\n * checks the virtual parent hierarchy. If a virtual parents exists, it is chosen over the actual parent\n *\n * @returns true if the child can find the parent in its virtual hierarchy\n */\nexport function elementContains(parent: HTMLElement | null, child: HTMLElement | null): boolean {\n if (!parent || !child) {\n return false;\n }\n\n if (parent === child) {\n return true;\n } else {\n while (child) {\n const nextParent: HTMLElement | null = getParent(child);\n\n if (nextParent === parent) {\n return true;\n }\n\n child = nextParent;\n }\n }\n\n return false;\n}\n"],"sourceRoot":"../src/"}
1
+ {"version":3,"sources":["virtualParent/elementContains.ts"],"names":[],"mappings":";;;;;;;AAAA,MAAA,WAAA,gBAAA,OAAA,CAAA,aAAA,CAAA;AACA;;;;;AAKG;;;AACH,SAAgB,eAAhB,CAAgC,MAAhC,EAA4D,KAA5D,EAAqF;EACnF,IAAI,CAAC,MAAD,IAAW,CAAC,KAAhB,EAAuB;IACrB,OAAO,KAAP;EACD;;EAED,IAAI,MAAM,KAAK,KAAf,EAAsB;IACpB,OAAO,IAAP;EACD,CAFD,MAEO;IACL,OAAO,KAAP,EAAc;MACZ,MAAM,UAAU,GAAuB,WAAA,CAAA,SAAA,CAAU,KAAV,CAAvC;;MAEA,IAAI,UAAU,KAAK,MAAnB,EAA2B;QACzB,OAAO,IAAP;MACD;;MAED,KAAK,GAAG,UAAR;IACD;EACF;;EAED,OAAO,KAAP;AACD;;AApBD,OAAA,CAAA,eAAA,GAAA,eAAA","sourcesContent":["import { getParent } from './getParent';\n/**\n * Similar functionality to `element.contains` DOM API for use with out of order DOM elements that\n * checks the virtual parent hierarchy. If a virtual parents exists, it is chosen over the actual parent\n *\n * @returns true if the child can find the parent in its virtual hierarchy\n */\nexport function elementContains(parent: HTMLElement | null, child: HTMLElement | null): boolean {\n if (!parent || !child) {\n return false;\n }\n\n if (parent === child) {\n return true;\n } else {\n while (child) {\n const nextParent: HTMLElement | null = getParent(child);\n\n if (nextParent === parent) {\n return true;\n }\n\n child = nextParent;\n }\n }\n\n return false;\n}\n"],"sourceRoot":"../src/"}
@@ -1 +1 @@
1
- {"version":3,"sources":["virtualParent/getParent.ts"],"names":[],"mappings":";;;;;;;AAAA,MAAA,kBAAA,gBAAA,OAAA,CAAA,oBAAA,CAAA;AAEA;;;AAGG;;;AACH,SAAgB,SAAhB,CAA0B,KAA1B,EAAmD;AACjD,SAAQ,KAAK,IAAI,kBAAA,CAAA,gBAAA,CAAiB,KAAjB,CAAV,KAAuC,KAAK,KAAA,IAAL,IAAA,KAAK,KAAA,KAAA,CAAL,GAAK,KAAA,CAAL,GAAA,KAAK,CAAE,UAA9C,CAAP;AACD;;AAFD,OAAA,CAAA,SAAA,GAAA,SAAA","sourcesContent":["import { getVirtualParent } from './getVirtualParent';\n\n/**\n * Gets the element which is the parent of a given element.\n * This method prefers the virtual parent over real DOM parent when present.\n */\nexport function getParent(child: HTMLElement | null): HTMLElement | null {\n return (child && getVirtualParent(child)) || (child?.parentNode as HTMLElement | null);\n}\n"],"sourceRoot":"../src/"}
1
+ {"version":3,"sources":["virtualParent/getParent.ts"],"names":[],"mappings":";;;;;;;AAAA,MAAA,kBAAA,gBAAA,OAAA,CAAA,oBAAA,CAAA;AAEA;;;AAGG;;;AACH,SAAgB,SAAhB,CAA0B,KAA1B,EAAmD;EACjD,OAAQ,KAAK,IAAI,kBAAA,CAAA,gBAAA,CAAiB,KAAjB,CAAV,KAAuC,KAAK,KAAA,IAAL,IAAA,KAAK,KAAA,KAAA,CAAL,GAAK,KAAA,CAAL,GAAA,KAAK,CAAE,UAA9C,CAAP;AACD;;AAFD,OAAA,CAAA,SAAA,GAAA,SAAA","sourcesContent":["import { getVirtualParent } from './getVirtualParent';\n\n/**\n * Gets the element which is the parent of a given element.\n * This method prefers the virtual parent over real DOM parent when present.\n */\nexport function getParent(child: HTMLElement | null): HTMLElement | null {\n return (child && getVirtualParent(child)) || (child?.parentNode as HTMLElement | null);\n}\n"],"sourceRoot":"../src/"}
@@ -1 +1 @@
1
- {"version":3,"sources":["virtualParent/getVirtualParent.ts"],"names":[],"mappings":";;;;;;;AAAA,MAAA,kBAAA,gBAAA,OAAA,CAAA,oBAAA,CAAA;AACA;;AAEG;;;AACH,SAAgB,gBAAhB,CAAiC,KAAjC,EAAmD;AACjD,MAAI,MAAJ;;AACA,MAAI,kBAAA,CAAA,gBAAA,CAAiB,KAAjB,CAAJ,EAA6B;AAC3B,IAAA,MAAM,GAAG,KAAK,CAAC,QAAN,CAAe,MAAxB;AACD;;AACD,SAAO,MAAP;AACD;;AAND,OAAA,CAAA,gBAAA,GAAA,gBAAA","sourcesContent":["import { isVirtualElement } from './isVirtualElement';\n/**\n * Gets the virtual parent given the child element, if it exists.\n */\nexport function getVirtualParent(child: HTMLElement): HTMLElement | undefined {\n let parent: HTMLElement | undefined;\n if (isVirtualElement(child)) {\n parent = child._virtual.parent;\n }\n return parent;\n}\n"],"sourceRoot":"../src/"}
1
+ {"version":3,"sources":["virtualParent/getVirtualParent.ts"],"names":[],"mappings":";;;;;;;AAAA,MAAA,kBAAA,gBAAA,OAAA,CAAA,oBAAA,CAAA;AACA;;AAEG;;;AACH,SAAgB,gBAAhB,CAAiC,KAAjC,EAAmD;EACjD,IAAI,MAAJ;;EACA,IAAI,kBAAA,CAAA,gBAAA,CAAiB,KAAjB,CAAJ,EAA6B;IAC3B,MAAM,GAAG,KAAK,CAAC,QAAN,CAAe,MAAxB;EACD;;EACD,OAAO,MAAP;AACD;;AAND,OAAA,CAAA,gBAAA,GAAA,gBAAA","sourcesContent":["import { isVirtualElement } from './isVirtualElement';\n/**\n * Gets the virtual parent given the child element, if it exists.\n */\nexport function getVirtualParent(child: HTMLElement): HTMLElement | undefined {\n let parent: HTMLElement | undefined;\n if (isVirtualElement(child)) {\n parent = child._virtual.parent;\n }\n return parent;\n}\n"],"sourceRoot":"../src/"}
@@ -1 +1 @@
1
- {"version":3,"sources":["virtualParent/isVirtualElement.ts"],"names":[],"mappings":";;;;;;AAEA;;AAEG;;AACH,SAAgB,gBAAhB,CAAiC,OAAjC,EAAsE;AACpE,SAAO,OAAO,IAAI,CAAC,CAAkB,OAAQ,CAAC,QAA9C;AACD;;AAFD,OAAA,CAAA,gBAAA,GAAA,gBAAA","sourcesContent":["import type { VirtualElement } from './types';\n\n/**\n * Determines whether or not an element has the virtual hierarchy extension.\n */\nexport function isVirtualElement(element: HTMLElement | VirtualElement): element is VirtualElement {\n return element && !!(<VirtualElement>element)._virtual;\n}\n"],"sourceRoot":"../src/"}
1
+ {"version":3,"sources":["virtualParent/isVirtualElement.ts"],"names":[],"mappings":";;;;;;AAEA;;AAEG;;AACH,SAAgB,gBAAhB,CAAiC,OAAjC,EAAsE;EACpE,OAAO,OAAO,IAAI,CAAC,CAAkB,OAAQ,CAAC,QAA9C;AACD;;AAFD,OAAA,CAAA,gBAAA,GAAA,gBAAA","sourcesContent":["import type { VirtualElement } from './types';\n\n/**\n * Determines whether or not an element has the virtual hierarchy extension.\n */\nexport function isVirtualElement(element: HTMLElement | VirtualElement): element is VirtualElement {\n return element && !!(<VirtualElement>element)._virtual;\n}\n"],"sourceRoot":"../src/"}
@@ -1 +1 @@
1
- {"version":3,"sources":["virtualParent/setVirtualParent.ts"],"names":[],"mappings":";;;;;;AAEA;;;;;AAKG;;AACH,SAAgB,gBAAhB,CAAiC,KAAjC,EAAqD,MAArD,EAAyE;AACvE,MAAI,CAAC,KAAL,EAAY;AACV;AACD;;AAED,QAAM,YAAY,GAAmB,KAArC;;AAEA,MAAI,CAAC,YAAY,CAAC,QAAlB,EAA4B;AAC1B,IAAA,YAAY,CAAC,QAAb,GAAwB,EAAxB;AACD;;AAED,EAAA,YAAY,CAAC,QAAb,CAAsB,MAAtB,GAA+B,MAAM,IAAI,SAAzC;AACD;;AAZD,OAAA,CAAA,gBAAA,GAAA,gBAAA","sourcesContent":["import type { VirtualElement } from './types';\n\n/**\n * Sets the virtual parent of an element.\n *\n * @param child - Theme element to set the virtual parent\n * @param parent - The virtual parent, use `undefined` to remove a virtual parent relationship\n */\nexport function setVirtualParent(child: HTMLElement, parent?: HTMLElement): void {\n if (!child) {\n return;\n }\n\n const virtualChild = <VirtualElement>child;\n\n if (!virtualChild._virtual) {\n virtualChild._virtual = {};\n }\n\n virtualChild._virtual.parent = parent || undefined;\n}\n"],"sourceRoot":"../src/"}
1
+ {"version":3,"sources":["virtualParent/setVirtualParent.ts"],"names":[],"mappings":";;;;;;AAEA;;;;;AAKG;;AACH,SAAgB,gBAAhB,CAAiC,KAAjC,EAAqD,MAArD,EAAyE;EACvE,IAAI,CAAC,KAAL,EAAY;IACV;EACD;;EAED,MAAM,YAAY,GAAmB,KAArC;;EAEA,IAAI,CAAC,YAAY,CAAC,QAAlB,EAA4B;IAC1B,YAAY,CAAC,QAAb,GAAwB,EAAxB;EACD;;EAED,YAAY,CAAC,QAAb,CAAsB,MAAtB,GAA+B,MAAM,IAAI,SAAzC;AACD;;AAZD,OAAA,CAAA,gBAAA,GAAA,gBAAA","sourcesContent":["import type { VirtualElement } from './types';\n\n/**\n * Sets the virtual parent of an element.\n *\n * @param child - Theme element to set the virtual parent\n * @param parent - The virtual parent, use `undefined` to remove a virtual parent relationship\n */\nexport function setVirtualParent(child: HTMLElement, parent?: HTMLElement): void {\n if (!child) {\n return;\n }\n\n const virtualChild = <VirtualElement>child;\n\n if (!virtualChild._virtual) {\n virtualChild._virtual = {};\n }\n\n virtualChild._virtual.parent = parent || undefined;\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.8",
3
+ "version": "9.0.1",
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",
@@ -31,9 +31,10 @@
31
31
  "@fluentui/scripts": "^1.0.0"
32
32
  },
33
33
  "dependencies": {
34
- "@fluentui/react-shared-contexts": "9.0.0-rc.6",
35
- "@fluentui/react-tabster": "9.0.0-rc.8",
36
- "@fluentui/react-utilities": "9.0.0-rc.7",
34
+ "@fluentui/react-shared-contexts": "^9.0.0",
35
+ "@fluentui/react-tabster": "^9.0.1",
36
+ "@fluentui/react-utilities": "^9.0.0",
37
+ "@griffel/react": "^1.2.0",
37
38
  "tslib": "^2.1.0"
38
39
  },
39
40
  "peerDependencies": {
@@ -44,9 +45,7 @@
44
45
  },
45
46
  "beachball": {
46
47
  "disallowedChangeTypes": [
47
- "major",
48
- "minor",
49
- "patch"
48
+ "major"
50
49
  ]
51
50
  },
52
51
  "exports": {