@fluentui/react-portal 9.0.14 → 9.0.15

Sign up to get free protection for your applications and to get access to all the features.
Files changed (50) hide show
  1. package/CHANGELOG.json +48 -1
  2. package/CHANGELOG.md +14 -2
  3. package/lib/components/Portal/Portal.js +0 -1
  4. package/lib/components/Portal/Portal.js.map +1 -1
  5. package/lib/components/Portal/renderPortal.js +0 -1
  6. package/lib/components/Portal/renderPortal.js.map +1 -1
  7. package/lib/components/Portal/usePortal.js +0 -1
  8. package/lib/components/Portal/usePortal.js.map +1 -1
  9. package/lib/components/Portal/usePortalMountNode.js +23 -29
  10. package/lib/components/Portal/usePortalMountNode.js.map +1 -1
  11. package/lib/virtualParent/elementContains.js +0 -5
  12. package/lib/virtualParent/elementContains.js.map +1 -1
  13. package/lib/virtualParent/getParent.js +0 -1
  14. package/lib/virtualParent/getParent.js.map +1 -1
  15. package/lib/virtualParent/getVirtualParent.js +0 -3
  16. package/lib/virtualParent/getVirtualParent.js.map +1 -1
  17. package/lib/virtualParent/isVirtualElement.js.map +1 -1
  18. package/lib/virtualParent/setVirtualParent.js +0 -3
  19. package/lib/virtualParent/setVirtualParent.js.map +1 -1
  20. package/lib-amd/components/Portal/usePortalMountNode.js +20 -21
  21. package/lib-amd/components/Portal/usePortalMountNode.js.map +1 -1
  22. package/lib-commonjs/Portal.js +0 -2
  23. package/lib-commonjs/Portal.js.map +1 -1
  24. package/lib-commonjs/components/Portal/Portal.js +0 -5
  25. package/lib-commonjs/components/Portal/Portal.js.map +1 -1
  26. package/lib-commonjs/components/Portal/Portal.types.js.map +1 -1
  27. package/lib-commonjs/components/Portal/index.js +0 -5
  28. package/lib-commonjs/components/Portal/index.js.map +1 -1
  29. package/lib-commonjs/components/Portal/renderPortal.js +0 -5
  30. package/lib-commonjs/components/Portal/renderPortal.js.map +1 -1
  31. package/lib-commonjs/components/Portal/usePortal.js +0 -6
  32. package/lib-commonjs/components/Portal/usePortal.js.map +1 -1
  33. package/lib-commonjs/components/Portal/usePortalMountNode.js +23 -34
  34. package/lib-commonjs/components/Portal/usePortalMountNode.js.map +1 -1
  35. package/lib-commonjs/index.js +0 -4
  36. package/lib-commonjs/index.js.map +1 -1
  37. package/lib-commonjs/virtualParent/elementContains.js +0 -8
  38. package/lib-commonjs/virtualParent/elementContains.js.map +1 -1
  39. package/lib-commonjs/virtualParent/getParent.js +0 -4
  40. package/lib-commonjs/virtualParent/getParent.js.map +1 -1
  41. package/lib-commonjs/virtualParent/getVirtualParent.js +0 -6
  42. package/lib-commonjs/virtualParent/getVirtualParent.js.map +1 -1
  43. package/lib-commonjs/virtualParent/index.js +0 -6
  44. package/lib-commonjs/virtualParent/index.js.map +1 -1
  45. package/lib-commonjs/virtualParent/isVirtualElement.js +0 -2
  46. package/lib-commonjs/virtualParent/isVirtualElement.js.map +1 -1
  47. package/lib-commonjs/virtualParent/setVirtualParent.js +0 -5
  48. package/lib-commonjs/virtualParent/setVirtualParent.js.map +1 -1
  49. package/lib-commonjs/virtualParent/types.js.map +1 -1
  50. package/package.json +7 -6
package/CHANGELOG.json CHANGED
@@ -2,7 +2,54 @@
2
2
  "name": "@fluentui/react-portal",
3
3
  "entries": [
4
4
  {
5
- "date": "Wed, 21 Dec 2022 10:17:16 GMT",
5
+ "date": "Wed, 04 Jan 2023 01:35:38 GMT",
6
+ "tag": "@fluentui/react-portal_v9.0.15",
7
+ "version": "9.0.15",
8
+ "comments": {
9
+ "none": [
10
+ {
11
+ "author": "martinhochel@microsoft.com",
12
+ "package": "@fluentui/react-portal",
13
+ "commit": "194b0cf0cc27c1c1233aa945f09b3ad29778d8ca",
14
+ "comment": "chore(scripts): use for @fluentui/scripts version within all package.json"
15
+ },
16
+ {
17
+ "author": "martinhochel@microsoft.com",
18
+ "package": "@fluentui/react-portal",
19
+ "commit": "4ec2b998b294d6d9c3196d3d82893bdd97d0c105",
20
+ "comment": "chore(scripts): move index.ts to to follow sub-folder domain packaging"
21
+ }
22
+ ],
23
+ "patch": [
24
+ {
25
+ "author": "lingfangao@hotmail.com",
26
+ "package": "@fluentui/react-portal",
27
+ "commit": "7cfaf78c93f1408c633c612939bf1a1305d7fc76",
28
+ "comment": "fix: Portals should render correctly in strict mode"
29
+ },
30
+ {
31
+ "author": "olfedias@microsoft.com",
32
+ "package": "@fluentui/react-portal",
33
+ "commit": "2c38f1e4ae07b2b60df596efe11015a68f166dbf",
34
+ "comment": "chore: Update Griffel to latest version"
35
+ },
36
+ {
37
+ "author": "beachball",
38
+ "package": "@fluentui/react-portal",
39
+ "comment": "Bump @fluentui/react-tabster to v9.3.5",
40
+ "commit": "3e322d15529451be153e97298873253e21af4082"
41
+ },
42
+ {
43
+ "author": "beachball",
44
+ "package": "@fluentui/react-portal",
45
+ "comment": "Bump @fluentui/react-utilities to v9.3.1",
46
+ "commit": "3e322d15529451be153e97298873253e21af4082"
47
+ }
48
+ ]
49
+ }
50
+ },
51
+ {
52
+ "date": "Wed, 21 Dec 2022 10:20:33 GMT",
6
53
  "tag": "@fluentui/react-portal_v9.0.14",
7
54
  "version": "9.0.14",
8
55
  "comments": {
package/CHANGELOG.md CHANGED
@@ -1,12 +1,24 @@
1
1
  # Change Log - @fluentui/react-portal
2
2
 
3
- This log was last generated on Wed, 21 Dec 2022 10:17:16 GMT and should not be manually modified.
3
+ This log was last generated on Wed, 04 Jan 2023 01:35:38 GMT and should not be manually modified.
4
4
 
5
5
  <!-- Start content -->
6
6
 
7
+ ## [9.0.15](https://github.com/microsoft/fluentui/tree/@fluentui/react-portal_v9.0.15)
8
+
9
+ Wed, 04 Jan 2023 01:35:38 GMT
10
+ [Compare changes](https://github.com/microsoft/fluentui/compare/@fluentui/react-portal_v9.0.14..@fluentui/react-portal_v9.0.15)
11
+
12
+ ### Patches
13
+
14
+ - fix: Portals should render correctly in strict mode ([PR #25956](https://github.com/microsoft/fluentui/pull/25956) by lingfangao@hotmail.com)
15
+ - chore: Update Griffel to latest version ([PR #26045](https://github.com/microsoft/fluentui/pull/26045) by olfedias@microsoft.com)
16
+ - Bump @fluentui/react-tabster to v9.3.5 ([PR #26114](https://github.com/microsoft/fluentui/pull/26114) by beachball)
17
+ - Bump @fluentui/react-utilities to v9.3.1 ([PR #26114](https://github.com/microsoft/fluentui/pull/26114) by beachball)
18
+
7
19
  ## [9.0.14](https://github.com/microsoft/fluentui/tree/@fluentui/react-portal_v9.0.14)
8
20
 
9
- Wed, 21 Dec 2022 10:17:16 GMT
21
+ Wed, 21 Dec 2022 10:20:33 GMT
10
22
  [Compare changes](https://github.com/microsoft/fluentui/compare/@fluentui/react-portal_v9.0.13..@fluentui/react-portal_v9.0.14)
11
23
 
12
24
  ### Patches
@@ -4,7 +4,6 @@ import { renderPortal_unstable } from './renderPortal';
4
4
  * A portal provides a way to render children into a DOM node
5
5
  * that exists outside the DOM hierarchy of the parent component.
6
6
  */
7
-
8
7
  export const Portal = props => {
9
8
  const state = usePortal_unstable(props);
10
9
  return renderPortal_unstable(state);
@@ -1 +1 @@
1
- {"version":3,"sources":["packages/react-components/react-portal/src/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
+ {"version":3,"mappings":"AAEA,SAASA,kBAAkB,QAAQ,aAAa;AAChD,SAASC,qBAAqB,QAAQ,gBAAgB;AAGtD;;;;AAIA,OAAO,MAAMC,MAAM,GAA0BC,KAAK,IAAG;EACnD,MAAMC,KAAK,GAAGJ,kBAAkB,CAACG,KAAK,CAAC;EAEvC,OAAOF,qBAAqB,CAACG,KAAK,CAAC;AACrC,CAAC;AAEDF,MAAM,CAACG,WAAW,GAAG,QAAQ","names":["usePortal_unstable","renderPortal_unstable","Portal","props","state","displayName"],"sourceRoot":"../src/","sources":["packages/react-components/react-portal/src/components/Portal/Portal.tsx"],"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"]}
@@ -3,7 +3,6 @@ import * as React from 'react';
3
3
  /**
4
4
  * Render the final JSX of Portal
5
5
  */
6
-
7
6
  export const renderPortal_unstable = state => {
8
7
  return /*#__PURE__*/React.createElement("span", {
9
8
  hidden: true,
@@ -1 +1 @@
1
- {"version":3,"sources":["packages/react-components/react-portal/src/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,SAAN,iBAAmB,QAAQ,CAAC,YAAT,CAAsB,KAAK,CAAC,QAA5B,EAAsC,KAAK,CAAC,SAA5C,CADtB,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.mountNode && ReactDOM.createPortal(state.children, state.mountNode)}\n </span>\n );\n};\n"],"sourceRoot":"../src/"}
1
+ {"version":3,"mappings":"AAAA,OAAO,KAAKA,QAAQ,MAAM,WAAW;AACrC,OAAO,KAAKC,KAAK,MAAM,OAAO;AAG9B;;;AAGA,OAAO,MAAMC,qBAAqB,GAAIC,KAAkB,IAAwB;EAC9E,oBACEF;IAAMG,MAAM;IAACC,GAAG,EAAEF,KAAK,CAACG;EAAoB,GACzCH,KAAK,CAACI,SAAS,iBAAIP,QAAQ,CAACQ,YAAY,CAACL,KAAK,CAACM,QAAQ,EAAEN,KAAK,CAACI,SAAS,CAAC,CACrE;AAEX,CAAC","names":["ReactDOM","React","renderPortal_unstable","state","hidden","ref","virtualParentRootRef","mountNode","createPortal","children"],"sourceRoot":"../src/","sources":["packages/react-components/react-portal/src/components/Portal/renderPortal.tsx"],"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.mountNode && ReactDOM.createPortal(state.children, state.mountNode)}\n </span>\n );\n};\n"]}
@@ -8,7 +8,6 @@ import { setVirtualParent } from '../../virtualParent/index';
8
8
  *
9
9
  * @param props - props from this instance of Portal
10
10
  */
11
-
12
11
  export const usePortal_unstable = props => {
13
12
  const {
14
13
  children,
@@ -1 +1 @@
1
- {"version":3,"sources":["packages/react-components/react-portal/src/components/Portal/usePortal.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAZ,MAAuB,OAAvB;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;EAHyB,CAA3B;EAMA,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,CAnBM","sourcesContent":["import * as React from 'react';\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 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,"mappings":"AAAA,OAAO,KAAKA,KAAK,MAAM,OAAO;AAC9B,SAASC,kBAAkB,QAAQ,sBAAsB;AACzD,SAASC,gBAAgB,QAAQ,2BAA2B;AAG5D;;;;;;;AAOA,OAAO,MAAMC,kBAAkB,GAAIC,KAAkB,IAAiB;EACpE,MAAM;IAAEC,QAAQ;IAAEC;EAAS,CAAE,GAAGF,KAAK;EAErC,MAAMG,oBAAoB,GAAGP,KAAK,CAACQ,MAAM,CAAkB,IAAI,CAAC;EAChE,MAAMC,iBAAiB,GAAGR,kBAAkB,CAAC;IAAES,QAAQ,EAAE,CAAC,CAACJ;EAAS,CAAE,CAAC;EAEvE,MAAMK,KAAK,GAAgB;IACzBN,QAAQ;IACRC,SAAS,EAAEA,SAAS,aAATA,SAAS,cAATA,SAAS,GAAIG,iBAAiB;IACzCF;GACD;EAEDP,KAAK,CAACY,SAAS,CAAC,MAAK;IACnB,IAAID,KAAK,CAACJ,oBAAoB,CAACM,OAAO,IAAIF,KAAK,CAACL,SAAS,EAAE;MACzDJ,gBAAgB,CAACS,KAAK,CAACL,SAAS,EAAEK,KAAK,CAACJ,oBAAoB,CAACM,OAAO,CAAC;;EAEzE,CAAC,EAAE,CAACF,KAAK,CAACJ,oBAAoB,EAAEI,KAAK,CAACL,SAAS,CAAC,CAAC;EAEjD,OAAOK,KAAK;AACd,CAAC","names":["React","usePortalMountNode","setVirtualParent","usePortal_unstable","props","children","mountNode","virtualParentRootRef","useRef","fallbackMountNode","disabled","state","useEffect","current"],"sourceRoot":"../src/","sources":["packages/react-components/react-portal/src/components/Portal/usePortal.ts"],"sourcesContent":["import * as React from 'react';\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 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"]}
@@ -2,20 +2,21 @@ import * as React from 'react';
2
2
  import { useThemeClassName_unstable as useThemeClassName, useFluent_unstable as useFluent } from '@fluentui/react-shared-contexts';
3
3
  import { __styles, mergeClasses } from '@griffel/react';
4
4
  import { useFocusVisible } from '@fluentui/react-tabster';
5
-
5
+ import { useDisposable } from 'use-disposable';
6
+ import { useIsomorphicLayoutEffect } from '@fluentui/react-utilities';
7
+ // String concatenation is used to prevent bundlers to complain with older versions of React
8
+ const useInsertionEffect = React['useInsertion' + 'Effect'] ? React['useInsertion' + 'Effect'] : useIsomorphicLayoutEffect;
6
9
  const useStyles = /*#__PURE__*/__styles({
7
- "root": {
8
- "qhf8xq": "f10pi13n",
9
- "Bj3rh1h": "f494woh"
10
+ root: {
11
+ qhf8xq: "f10pi13n",
12
+ Bj3rh1h: "f494woh"
10
13
  }
11
14
  }, {
12
- "d": [".f10pi13n{position:relative;}", ".f494woh{z-index:1000000;}"]
15
+ d: [".f10pi13n{position:relative;}", ".f494woh{z-index:1000000;}"]
13
16
  });
14
17
  /**
15
18
  * Creates a new element on a document.body to mount portals
16
19
  */
17
-
18
-
19
20
  export const usePortalMountNode = options => {
20
21
  const {
21
22
  targetDocument,
@@ -25,38 +26,31 @@ export const usePortalMountNode = options => {
25
26
  const classes = useStyles();
26
27
  const themeClassName = useThemeClassName();
27
28
  const className = mergeClasses(themeClassName, classes.root);
28
- const element = React.useMemo(() => {
29
+ const element = useDisposable(() => {
29
30
  if (targetDocument === undefined || options.disabled) {
30
- return null;
31
+ return [null, () => null];
31
32
  }
32
-
33
33
  const newElement = targetDocument.createElement('div');
34
34
  targetDocument.body.appendChild(newElement);
35
- return newElement;
36
- }, [targetDocument, options.disabled]); // This useMemo call is intentional
35
+ return [newElement, () => newElement.remove()];
36
+ }, [targetDocument]);
37
+ // This useEffect call is intentional
37
38
  // We don't want to re-create the portal element when its attributes change.
38
39
  // This also should not be done in an effect because, changing the value of css variables
39
40
  // after initial mount can trigger interesting CSS side effects like transitions.
40
-
41
- React.useMemo(() => {
42
- if (element) {
43
- const classesToApply = className.split(' ').filter(Boolean);
44
- element.classList.add(...classesToApply);
45
- element.setAttribute('dir', dir);
46
- focusVisibleRef.current = element;
47
- return () => {
48
- element.classList.remove(...classesToApply);
49
- element.removeAttribute('dir');
50
- };
41
+ useInsertionEffect(() => {
42
+ if (!element) {
43
+ return;
51
44
  }
52
- }, [className, dir, element, focusVisibleRef]);
53
- React.useEffect(() => {
45
+ const classesToApply = className.split(' ').filter(Boolean);
46
+ element.classList.add(...classesToApply);
47
+ element.setAttribute('dir', dir);
48
+ focusVisibleRef.current = element;
54
49
  return () => {
55
- var _a;
56
-
57
- (_a = element === null || element === void 0 ? void 0 : element.parentElement) === null || _a === void 0 ? void 0 : _a.removeChild(element);
50
+ element.classList.remove(...classesToApply);
51
+ element.removeAttribute('dir');
58
52
  };
59
- }, [element]);
53
+ }, [className, dir, element, focusVisibleRef]);
60
54
  return element;
61
55
  };
62
56
  //# sourceMappingURL=usePortalMountNode.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["packages/react-components/react-portal/src/components/Portal/usePortalMountNode.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAZ,MAAuB,OAAvB;AACA,SACE,0BAA0B,IAAI,iBADhC,EAEE,kBAAkB,IAAI,SAFxB,QAGO,iCAHP;AAIA,mBAAqB,YAArB,QAAyC,gBAAzC;AACA,SAAS,eAAT,QAAgC,yBAAhC;;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;EACA,MAAM,eAAe,GAAG,eAAe,EAAvC;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,CAT2F,CAoB3F;EACA;EACA;EACA;;EACA,KAAK,CAAC,OAAN,CAAc,MAAK;IACjB,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;MACA,eAAe,CAAC,OAAhB,GAA0B,OAA1B;MAEA,OAAO,MAAK;QACV,OAAO,CAAC,SAAR,CAAkB,MAAlB,CAAyB,GAAG,cAA5B;QACA,OAAO,CAAC,eAAR,CAAwB,KAAxB;MACD,CAHD;IAID;EACF,CAbD,EAaG,CAAC,SAAD,EAAY,GAAZ,EAAiB,OAAjB,EAA0B,eAA1B,CAbH;EAeA,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,CA9CM","sourcesContent":["import * as React from 'react';\nimport {\n useThemeClassName_unstable as useThemeClassName,\n useFluent_unstable as useFluent,\n} from '@fluentui/react-shared-contexts';\nimport { makeStyles, mergeClasses } from '@griffel/react';\nimport { useFocusVisible } 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\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 const focusVisibleRef = useFocusVisible<HTMLDivElement>() as React.MutableRefObject<HTMLElement | null>;\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 // This useMemo call is intentional\n // We don't want to re-create the portal element when its attributes change.\n // This also should not be done in an effect because, changing the value of css variables\n // after initial mount can trigger interesting CSS side effects like transitions.\n React.useMemo(() => {\n if (element) {\n const classesToApply = className.split(' ').filter(Boolean);\n\n element.classList.add(...classesToApply);\n element.setAttribute('dir', dir);\n focusVisibleRef.current = element;\n\n return () => {\n element.classList.remove(...classesToApply);\n element.removeAttribute('dir');\n };\n }\n }, [className, dir, element, focusVisibleRef]);\n\n React.useEffect(() => {\n return () => {\n element?.parentElement?.removeChild(element);\n };\n }, [element]);\n\n return element;\n};\n"],"sourceRoot":"../src/"}
1
+ {"version":3,"mappings":"AAAA,OAAO,KAAKA,KAAK,MAAM,OAAO;AAC9B,SACEC,0BAA0B,IAAIC,iBAAiB,EAC/CC,kBAAkB,IAAIC,SAAS,QAC1B,iCAAiC;AACxC,mBAAqBC,YAAY,QAAQ,gBAAgB;AACzD,SAASC,eAAe,QAAQ,yBAAyB;AACzD,SAASC,aAAa,QAAQ,gBAAgB;AAC9C,SAASC,yBAAyB,QAAQ,2BAA2B;AAErE;AACA,MAAMC,kBAAkB,GAAIT,KAAe,CAAC,cAAc,GAAG,QAAQ,CAAC,GACjEA,KAAe,CAAC,cAAc,GAAG,QAAQ,CAAC,GAC3CQ,yBAAyB;AAS7B,MAAME,SAAS,gBAAG;EAAA;IAAA;IAAA;EAAA;AAAA;EAAA;AAAA,EAKhB;AAEF;;;AAGA,OAAO,MAAMC,kBAAkB,GAAIC,OAAkC,IAAwB;EAC3F,MAAM;IAAEC,cAAc;IAAEC;EAAG,CAAE,GAAGV,SAAS,EAAE;EAC3C,MAAMW,eAAe,GAAGT,eAAe,EAAgE;EACvG,MAAMU,OAAO,GAAGN,SAAS,EAAE;EAC3B,MAAMO,cAAc,GAAGf,iBAAiB,EAAE;EAE1C,MAAMgB,SAAS,GAAGb,YAAY,CAACY,cAAc,EAAED,OAAO,CAACG,IAAI,CAAC;EAE5D,MAAMC,OAAO,GAAGb,aAAa,CAAC,MAAK;IACjC,IAAIM,cAAc,KAAKQ,SAAS,IAAIT,OAAO,CAACU,QAAQ,EAAE;MACpD,OAAO,CAAC,IAAI,EAAE,MAAM,IAAI,CAAC;;IAG3B,MAAMC,UAAU,GAAGV,cAAc,CAACW,aAAa,CAAC,KAAK,CAAC;IACtDX,cAAc,CAACY,IAAI,CAACC,WAAW,CAACH,UAAU,CAAC;IAC3C,OAAO,CAACA,UAAU,EAAE,MAAMA,UAAU,CAACI,MAAM,EAAE,CAAC;EAChD,CAAC,EAAE,CAACd,cAAc,CAAC,CAAC;EAEpB;EACA;EACA;EACA;EACAJ,kBAAkB,CAAC,MAAK;IACtB,IAAI,CAACW,OAAO,EAAE;MACZ;;IAGF,MAAMQ,cAAc,GAAGV,SAAS,CAACW,KAAK,CAAC,GAAG,CAAC,CAACC,MAAM,CAACC,OAAO,CAAC;IAE3DX,OAAO,CAACY,SAAS,CAACC,GAAG,CAAC,GAAGL,cAAc,CAAC;IACxCR,OAAO,CAACc,YAAY,CAAC,KAAK,EAAEpB,GAAG,CAAC;IAChCC,eAAe,CAACoB,OAAO,GAAGf,OAAO;IAEjC,OAAO,MAAK;MACVA,OAAO,CAACY,SAAS,CAACL,MAAM,CAAC,GAAGC,cAAc,CAAC;MAC3CR,OAAO,CAACgB,eAAe,CAAC,KAAK,CAAC;IAChC,CAAC;EACH,CAAC,EAAE,CAAClB,SAAS,EAAEJ,GAAG,EAAEM,OAAO,EAAEL,eAAe,CAAC,CAAC;EAE9C,OAAOK,OAAO;AAChB,CAAC","names":["React","useThemeClassName_unstable","useThemeClassName","useFluent_unstable","useFluent","mergeClasses","useFocusVisible","useDisposable","useIsomorphicLayoutEffect","useInsertionEffect","useStyles","usePortalMountNode","options","targetDocument","dir","focusVisibleRef","classes","themeClassName","className","root","element","undefined","disabled","newElement","createElement","body","appendChild","remove","classesToApply","split","filter","Boolean","classList","add","setAttribute","current","removeAttribute"],"sourceRoot":"../src/","sources":["packages/react-components/react-portal/src/components/Portal/usePortalMountNode.ts"],"sourcesContent":["import * as React from 'react';\nimport {\n useThemeClassName_unstable as useThemeClassName,\n useFluent_unstable as useFluent,\n} from '@fluentui/react-shared-contexts';\nimport { makeStyles, mergeClasses } from '@griffel/react';\nimport { useFocusVisible } from '@fluentui/react-tabster';\nimport { useDisposable } from 'use-disposable';\nimport { useIsomorphicLayoutEffect } from '@fluentui/react-utilities';\n\n// String concatenation is used to prevent bundlers to complain with older versions of React\nconst useInsertionEffect = (React as never)['useInsertion' + 'Effect']\n ? (React as never)['useInsertion' + 'Effect']\n : useIsomorphicLayoutEffect;\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 const focusVisibleRef = useFocusVisible<HTMLDivElement>() as React.MutableRefObject<HTMLElement | null>;\n const classes = useStyles();\n const themeClassName = useThemeClassName();\n\n const className = mergeClasses(themeClassName, classes.root);\n\n const element = useDisposable(() => {\n if (targetDocument === undefined || options.disabled) {\n return [null, () => null];\n }\n\n const newElement = targetDocument.createElement('div');\n targetDocument.body.appendChild(newElement);\n return [newElement, () => newElement.remove()];\n }, [targetDocument]);\n\n // This useEffect call is intentional\n // We don't want to re-create the portal element when its attributes change.\n // This also should not be done in an effect because, changing the value of css variables\n // after initial mount can trigger interesting CSS side effects like transitions.\n useInsertionEffect(() => {\n if (!element) {\n return;\n }\n\n const classesToApply = className.split(' ').filter(Boolean);\n\n element.classList.add(...classesToApply);\n element.setAttribute('dir', dir);\n focusVisibleRef.current = element;\n\n return () => {\n element.classList.remove(...classesToApply);\n element.removeAttribute('dir');\n };\n }, [className, dir, element, focusVisibleRef]);\n\n return element;\n};\n"]}
@@ -5,26 +5,21 @@ import { getParent } from './getParent';
5
5
  *
6
6
  * @returns true if the child can find the parent in its virtual hierarchy
7
7
  */
8
-
9
8
  export function elementContains(parent, child) {
10
9
  if (!parent || !child) {
11
10
  return false;
12
11
  }
13
-
14
12
  if (parent === child) {
15
13
  return true;
16
14
  } else {
17
15
  while (child) {
18
16
  const nextParent = getParent(child);
19
-
20
17
  if (nextParent === parent) {
21
18
  return true;
22
19
  }
23
-
24
20
  child = nextParent;
25
21
  }
26
22
  }
27
-
28
23
  return false;
29
24
  }
30
25
  //# sourceMappingURL=elementContains.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["packages/react-components/react-portal/src/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
+ {"version":3,"mappings":"AAAA,SAASA,SAAS,QAAQ,aAAa;AACvC;;;;;;AAMA,OAAM,SAAUC,eAAe,CAACC,MAA0B,EAAEC,KAAyB;EACnF,IAAI,CAACD,MAAM,IAAI,CAACC,KAAK,EAAE;IACrB,OAAO,KAAK;;EAGd,IAAID,MAAM,KAAKC,KAAK,EAAE;IACpB,OAAO,IAAI;GACZ,MAAM;IACL,OAAOA,KAAK,EAAE;MACZ,MAAMC,UAAU,GAAuBJ,SAAS,CAACG,KAAK,CAAC;MAEvD,IAAIC,UAAU,KAAKF,MAAM,EAAE;QACzB,OAAO,IAAI;;MAGbC,KAAK,GAAGC,UAAU;;;EAItB,OAAO,KAAK;AACd","names":["getParent","elementContains","parent","child","nextParent"],"sourceRoot":"../src/","sources":["packages/react-components/react-portal/src/virtualParent/elementContains.ts"],"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"]}
@@ -3,7 +3,6 @@ import { getVirtualParent } from './getVirtualParent';
3
3
  * Gets the element which is the parent of a given element.
4
4
  * This method prefers the virtual parent over real DOM parent when present.
5
5
  */
6
-
7
6
  export function getParent(child) {
8
7
  return child && getVirtualParent(child) || (child === null || child === void 0 ? void 0 : child.parentNode);
9
8
  }
@@ -1 +1 @@
1
- {"version":3,"sources":["packages/react-components/react-portal/src/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
+ {"version":3,"mappings":"AAAA,SAASA,gBAAgB,QAAQ,oBAAoB;AAErD;;;;AAIA,OAAM,SAAUC,SAAS,CAACC,KAAyB;EACjD,OAAQA,KAAK,IAAIF,gBAAgB,CAACE,KAAK,CAAC,KAAMA,KAAK,aAALA,KAAK,uBAALA,KAAK,CAAEC,UAAiC;AACxF","names":["getVirtualParent","getParent","child","parentNode"],"sourceRoot":"../src/","sources":["packages/react-components/react-portal/src/virtualParent/getParent.ts"],"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"]}
@@ -2,14 +2,11 @@ import { isVirtualElement } from './isVirtualElement';
2
2
  /**
3
3
  * Gets the virtual parent given the child element, if it exists.
4
4
  */
5
-
6
5
  export function getVirtualParent(child) {
7
6
  let parent;
8
-
9
7
  if (isVirtualElement(child)) {
10
8
  parent = child._virtual.parent;
11
9
  }
12
-
13
10
  return parent;
14
11
  }
15
12
  //# sourceMappingURL=getVirtualParent.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["packages/react-components/react-portal/src/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
+ {"version":3,"mappings":"AAAA,SAASA,gBAAgB,QAAQ,oBAAoB;AACrD;;;AAGA,OAAM,SAAUC,gBAAgB,CAACC,KAAkB;EACjD,IAAIC,MAA+B;EACnC,IAAIH,gBAAgB,CAACE,KAAK,CAAC,EAAE;IAC3BC,MAAM,GAAGD,KAAK,CAACE,QAAQ,CAACD,MAAM;;EAEhC,OAAOA,MAAM;AACf","names":["isVirtualElement","getVirtualParent","child","parent","_virtual"],"sourceRoot":"../src/","sources":["packages/react-components/react-portal/src/virtualParent/getVirtualParent.ts"],"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"]}
@@ -1 +1 @@
1
- {"version":3,"sources":["packages/react-components/react-portal/src/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
+ {"version":3,"mappings":"AAEA;;;AAGA,OAAM,SAAUA,gBAAgB,CAACC,OAAqC;EACpE,OAAOA,OAAO,IAAI,CAAC,CAAkBA,OAAQ,CAACC,QAAQ;AACxD","names":["isVirtualElement","element","_virtual"],"sourceRoot":"../src/","sources":["packages/react-components/react-portal/src/virtualParent/isVirtualElement.ts"],"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"]}
@@ -8,13 +8,10 @@ export function setVirtualParent(child, parent) {
8
8
  if (!child) {
9
9
  return;
10
10
  }
11
-
12
11
  const virtualChild = child;
13
-
14
12
  if (!virtualChild._virtual) {
15
13
  virtualChild._virtual = {};
16
14
  }
17
-
18
15
  virtualChild._virtual.parent = parent || undefined;
19
16
  }
20
17
  //# sourceMappingURL=setVirtualParent.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["packages/react-components/react-portal/src/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
+ {"version":3,"mappings":"AAEA;;;;;;AAMA,OAAM,SAAUA,gBAAgB,CAACC,KAAkB,EAAEC,MAAoB;EACvE,IAAI,CAACD,KAAK,EAAE;IACV;;EAGF,MAAME,YAAY,GAAmBF,KAAK;EAE1C,IAAI,CAACE,YAAY,CAACC,QAAQ,EAAE;IAC1BD,YAAY,CAACC,QAAQ,GAAG,EAAE;;EAG5BD,YAAY,CAACC,QAAQ,CAACF,MAAM,GAAGA,MAAM,IAAIG,SAAS;AACpD","names":["setVirtualParent","child","parent","virtualChild","_virtual","undefined"],"sourceRoot":"../src/","sources":["packages/react-components/react-portal/src/virtualParent/setVirtualParent.ts"],"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"]}
@@ -1,7 +1,11 @@
1
- define(["require", "exports", "react", "@fluentui/react-shared-contexts", "@griffel/react", "@fluentui/react-tabster"], function (require, exports, React, react_shared_contexts_1, react_1, react_tabster_1) {
1
+ define(["require", "exports", "react", "@fluentui/react-shared-contexts", "@griffel/react", "@fluentui/react-tabster", "use-disposable", "@fluentui/react-utilities"], function (require, exports, React, react_shared_contexts_1, react_1, react_tabster_1, use_disposable_1, react_utilities_1) {
2
2
  "use strict";
3
3
  Object.defineProperty(exports, "__esModule", { value: true });
4
4
  exports.usePortalMountNode = void 0;
5
+ // String concatenation is used to prevent bundlers to complain with older versions of React
6
+ var useInsertionEffect = React['useInsertion' + 'Effect']
7
+ ? React['useInsertion' + 'Effect']
8
+ : react_utilities_1.useIsomorphicLayoutEffect;
5
9
  var useStyles = react_1.makeStyles({
6
10
  root: {
7
11
  position: 'relative',
@@ -17,38 +21,33 @@ define(["require", "exports", "react", "@fluentui/react-shared-contexts", "@grif
17
21
  var classes = useStyles();
18
22
  var themeClassName = react_shared_contexts_1.useThemeClassName_unstable();
19
23
  var className = react_1.mergeClasses(themeClassName, classes.root);
20
- var element = React.useMemo(function () {
24
+ var element = use_disposable_1.useDisposable(function () {
21
25
  if (targetDocument === undefined || options.disabled) {
22
- return null;
26
+ return [null, function () { return null; }];
23
27
  }
24
28
  var newElement = targetDocument.createElement('div');
25
29
  targetDocument.body.appendChild(newElement);
26
- return newElement;
27
- }, [targetDocument, options.disabled]);
28
- // This useMemo call is intentional
30
+ return [newElement, function () { return newElement.remove(); }];
31
+ }, [targetDocument]);
32
+ // This useEffect call is intentional
29
33
  // We don't want to re-create the portal element when its attributes change.
30
34
  // This also should not be done in an effect because, changing the value of css variables
31
35
  // after initial mount can trigger interesting CSS side effects like transitions.
32
- React.useMemo(function () {
36
+ useInsertionEffect(function () {
33
37
  var _a;
34
- if (element) {
35
- var classesToApply_1 = className.split(' ').filter(Boolean);
36
- (_a = element.classList).add.apply(_a, classesToApply_1);
37
- element.setAttribute('dir', dir);
38
- focusVisibleRef.current = element;
39
- return function () {
40
- var _a;
41
- (_a = element.classList).remove.apply(_a, classesToApply_1);
42
- element.removeAttribute('dir');
43
- };
38
+ if (!element) {
39
+ return;
44
40
  }
45
- }, [className, dir, element, focusVisibleRef]);
46
- React.useEffect(function () {
41
+ var classesToApply = className.split(' ').filter(Boolean);
42
+ (_a = element.classList).add.apply(_a, classesToApply);
43
+ element.setAttribute('dir', dir);
44
+ focusVisibleRef.current = element;
47
45
  return function () {
48
46
  var _a;
49
- (_a = element === null || element === void 0 ? void 0 : element.parentElement) === null || _a === void 0 ? void 0 : _a.removeChild(element);
47
+ (_a = element.classList).remove.apply(_a, classesToApply);
48
+ element.removeAttribute('dir');
50
49
  };
51
- }, [element]);
50
+ }, [className, dir, element, focusVisibleRef]);
52
51
  return element;
53
52
  };
54
53
  exports.usePortalMountNode = usePortalMountNode;
@@ -1 +1 @@
1
- {"version":3,"file":"usePortalMountNode.js","sourceRoot":"","sources":["../../../../../../../../../packages/react-components/react-portal/src/components/Portal/usePortalMountNode.ts"],"names":[],"mappings":";;;;IAeA,IAAM,SAAS,GAAG,kBAAU,CAAC;QAC3B,IAAI,EAAE;YACJ,QAAQ,EAAE,UAAU;YACpB,MAAM,EAAE,OAAO;SAChB;KACF,CAAC,CAAC;IAEH;;OAEG;IACI,IAAM,kBAAkB,GAAG,UAAC,OAAkC;QAC7D,IAAA,KAA0B,0CAAS,EAAE,EAAnC,cAAc,oBAAA,EAAE,GAAG,SAAgB,CAAC;QAC5C,IAAM,eAAe,GAAG,+BAAe,EAAgE,CAAC;QAExG,IAAM,OAAO,GAAG,SAAS,EAAE,CAAC;QAC5B,IAAM,cAAc,GAAG,kDAAiB,EAAE,CAAC;QAE3C,IAAM,SAAS,GAAG,oBAAY,CAAC,cAAc,EAAE,OAAO,CAAC,IAAI,CAAC,CAAC;QAE7D,IAAM,OAAO,GAAG,KAAK,CAAC,OAAO,CAAC;YAC5B,IAAI,cAAc,KAAK,SAAS,IAAI,OAAO,CAAC,QAAQ,EAAE;gBACpD,OAAO,IAAI,CAAC;aACb;YAED,IAAM,UAAU,GAAG,cAAc,CAAC,aAAa,CAAC,KAAK,CAAC,CAAC;YACvD,cAAc,CAAC,IAAI,CAAC,WAAW,CAAC,UAAU,CAAC,CAAC;YAE5C,OAAO,UAAU,CAAC;QACpB,CAAC,EAAE,CAAC,cAAc,EAAE,OAAO,CAAC,QAAQ,CAAC,CAAC,CAAC;QAEvC,mCAAmC;QACnC,4EAA4E;QAC5E,yFAAyF;QACzF,iFAAiF;QACjF,KAAK,CAAC,OAAO,CAAC;;YACZ,IAAI,OAAO,EAAE;gBACX,IAAM,gBAAc,GAAG,SAAS,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC;gBAE5D,CAAA,KAAA,OAAO,CAAC,SAAS,CAAA,CAAC,GAAG,WAAI,gBAAc,EAAE;gBACzC,OAAO,CAAC,YAAY,CAAC,KAAK,EAAE,GAAG,CAAC,CAAC;gBACjC,eAAe,CAAC,OAAO,GAAG,OAAO,CAAC;gBAElC,OAAO;;oBACL,CAAA,KAAA,OAAO,CAAC,SAAS,CAAA,CAAC,MAAM,WAAI,gBAAc,EAAE;oBAC5C,OAAO,CAAC,eAAe,CAAC,KAAK,CAAC,CAAC;gBACjC,CAAC,CAAC;aACH;QACH,CAAC,EAAE,CAAC,SAAS,EAAE,GAAG,EAAE,OAAO,EAAE,eAAe,CAAC,CAAC,CAAC;QAE/C,KAAK,CAAC,SAAS,CAAC;YACd,OAAO;;gBACL,MAAA,OAAO,aAAP,OAAO,uBAAP,OAAO,CAAE,aAAa,0CAAE,WAAW,CAAC,OAAO,CAAC,CAAC;YAC/C,CAAC,CAAC;QACJ,CAAC,EAAE,CAAC,OAAO,CAAC,CAAC,CAAC;QAEd,OAAO,OAAO,CAAC;IACjB,CAAC,CAAC;IA9CW,QAAA,kBAAkB,sBA8C7B","sourcesContent":["import * as React from 'react';\nimport {\n useThemeClassName_unstable as useThemeClassName,\n useFluent_unstable as useFluent,\n} from '@fluentui/react-shared-contexts';\nimport { makeStyles, mergeClasses } from '@griffel/react';\nimport { useFocusVisible } 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\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 const focusVisibleRef = useFocusVisible<HTMLDivElement>() as React.MutableRefObject<HTMLElement | null>;\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 // This useMemo call is intentional\n // We don't want to re-create the portal element when its attributes change.\n // This also should not be done in an effect because, changing the value of css variables\n // after initial mount can trigger interesting CSS side effects like transitions.\n React.useMemo(() => {\n if (element) {\n const classesToApply = className.split(' ').filter(Boolean);\n\n element.classList.add(...classesToApply);\n element.setAttribute('dir', dir);\n focusVisibleRef.current = element;\n\n return () => {\n element.classList.remove(...classesToApply);\n element.removeAttribute('dir');\n };\n }\n }, [className, dir, element, focusVisibleRef]);\n\n React.useEffect(() => {\n return () => {\n element?.parentElement?.removeChild(element);\n };\n }, [element]);\n\n return element;\n};\n"]}
1
+ {"version":3,"file":"usePortalMountNode.js","sourceRoot":"","sources":["../../../../../../../../../packages/react-components/react-portal/src/components/Portal/usePortalMountNode.ts"],"names":[],"mappings":";;;;IAUA,4FAA4F;IAC5F,IAAM,kBAAkB,GAAI,KAAe,CAAC,cAAc,GAAG,QAAQ,CAAC;QACpE,CAAC,CAAE,KAAe,CAAC,cAAc,GAAG,QAAQ,CAAC;QAC7C,CAAC,CAAC,2CAAyB,CAAC;IAS9B,IAAM,SAAS,GAAG,kBAAU,CAAC;QAC3B,IAAI,EAAE;YACJ,QAAQ,EAAE,UAAU;YACpB,MAAM,EAAE,OAAO;SAChB;KACF,CAAC,CAAC;IAEH;;OAEG;IACI,IAAM,kBAAkB,GAAG,UAAC,OAAkC;QAC7D,IAAA,KAA0B,0CAAS,EAAE,EAAnC,cAAc,oBAAA,EAAE,GAAG,SAAgB,CAAC;QAC5C,IAAM,eAAe,GAAG,+BAAe,EAAgE,CAAC;QACxG,IAAM,OAAO,GAAG,SAAS,EAAE,CAAC;QAC5B,IAAM,cAAc,GAAG,kDAAiB,EAAE,CAAC;QAE3C,IAAM,SAAS,GAAG,oBAAY,CAAC,cAAc,EAAE,OAAO,CAAC,IAAI,CAAC,CAAC;QAE7D,IAAM,OAAO,GAAG,8BAAa,CAAC;YAC5B,IAAI,cAAc,KAAK,SAAS,IAAI,OAAO,CAAC,QAAQ,EAAE;gBACpD,OAAO,CAAC,IAAI,EAAE,cAAM,OAAA,IAAI,EAAJ,CAAI,CAAC,CAAC;aAC3B;YAED,IAAM,UAAU,GAAG,cAAc,CAAC,aAAa,CAAC,KAAK,CAAC,CAAC;YACvD,cAAc,CAAC,IAAI,CAAC,WAAW,CAAC,UAAU,CAAC,CAAC;YAC5C,OAAO,CAAC,UAAU,EAAE,cAAM,OAAA,UAAU,CAAC,MAAM,EAAE,EAAnB,CAAmB,CAAC,CAAC;QACjD,CAAC,EAAE,CAAC,cAAc,CAAC,CAAC,CAAC;QAErB,qCAAqC;QACrC,4EAA4E;QAC5E,yFAAyF;QACzF,iFAAiF;QACjF,kBAAkB,CAAC;;YACjB,IAAI,CAAC,OAAO,EAAE;gBACZ,OAAO;aACR;YAED,IAAM,cAAc,GAAG,SAAS,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC;YAE5D,CAAA,KAAA,OAAO,CAAC,SAAS,CAAA,CAAC,GAAG,WAAI,cAAc,EAAE;YACzC,OAAO,CAAC,YAAY,CAAC,KAAK,EAAE,GAAG,CAAC,CAAC;YACjC,eAAe,CAAC,OAAO,GAAG,OAAO,CAAC;YAElC,OAAO;;gBACL,CAAA,KAAA,OAAO,CAAC,SAAS,CAAA,CAAC,MAAM,WAAI,cAAc,EAAE;gBAC5C,OAAO,CAAC,eAAe,CAAC,KAAK,CAAC,CAAC;YACjC,CAAC,CAAC;QACJ,CAAC,EAAE,CAAC,SAAS,EAAE,GAAG,EAAE,OAAO,EAAE,eAAe,CAAC,CAAC,CAAC;QAE/C,OAAO,OAAO,CAAC;IACjB,CAAC,CAAC;IAxCW,QAAA,kBAAkB,sBAwC7B","sourcesContent":["import * as React from 'react';\nimport {\n useThemeClassName_unstable as useThemeClassName,\n useFluent_unstable as useFluent,\n} from '@fluentui/react-shared-contexts';\nimport { makeStyles, mergeClasses } from '@griffel/react';\nimport { useFocusVisible } from '@fluentui/react-tabster';\nimport { useDisposable } from 'use-disposable';\nimport { useIsomorphicLayoutEffect } from '@fluentui/react-utilities';\n\n// String concatenation is used to prevent bundlers to complain with older versions of React\nconst useInsertionEffect = (React as never)['useInsertion' + 'Effect']\n ? (React as never)['useInsertion' + 'Effect']\n : useIsomorphicLayoutEffect;\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 const focusVisibleRef = useFocusVisible<HTMLDivElement>() as React.MutableRefObject<HTMLElement | null>;\n const classes = useStyles();\n const themeClassName = useThemeClassName();\n\n const className = mergeClasses(themeClassName, classes.root);\n\n const element = useDisposable(() => {\n if (targetDocument === undefined || options.disabled) {\n return [null, () => null];\n }\n\n const newElement = targetDocument.createElement('div');\n targetDocument.body.appendChild(newElement);\n return [newElement, () => newElement.remove()];\n }, [targetDocument]);\n\n // This useEffect call is intentional\n // We don't want to re-create the portal element when its attributes change.\n // This also should not be done in an effect because, changing the value of css variables\n // after initial mount can trigger interesting CSS side effects like transitions.\n useInsertionEffect(() => {\n if (!element) {\n return;\n }\n\n const classesToApply = className.split(' ').filter(Boolean);\n\n element.classList.add(...classesToApply);\n element.setAttribute('dir', dir);\n focusVisibleRef.current = element;\n\n return () => {\n element.classList.remove(...classesToApply);\n element.removeAttribute('dir');\n };\n }, [className, dir, element, focusVisibleRef]);\n\n return element;\n};\n"]}
@@ -3,8 +3,6 @@
3
3
  Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
-
7
6
  const tslib_1 = /*#__PURE__*/require("tslib");
8
-
9
7
  tslib_1.__exportStar(require("./components/Portal/index"), exports);
10
8
  //# sourceMappingURL=Portal.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["packages/react-components/react-portal/src/Portal.ts"],"names":[],"mappings":";;;;;;;;AAAA,OAAA,CAAA,YAAA,CAAA,OAAA,CAAA,2BAAA,CAAA,EAAA,OAAA","sourcesContent":["export * from './components/Portal/index';\n"],"sourceRoot":"../src/"}
1
+ {"version":3,"mappings":";;;;;;AAAAA","names":["tslib_1"],"sourceRoot":"../src/","sources":["packages/react-components/react-portal/src/Portal.ts"],"sourcesContent":["export * from './components/Portal/index';\n"]}
@@ -4,21 +4,16 @@ Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
6
  exports.Portal = void 0;
7
-
8
7
  const usePortal_1 = /*#__PURE__*/require("./usePortal");
9
-
10
8
  const renderPortal_1 = /*#__PURE__*/require("./renderPortal");
11
9
  /**
12
10
  * A portal provides a way to render children into a DOM node
13
11
  * that exists outside the DOM hierarchy of the parent component.
14
12
  */
15
-
16
-
17
13
  const Portal = props => {
18
14
  const state = usePortal_1.usePortal_unstable(props);
19
15
  return renderPortal_1.renderPortal_unstable(state);
20
16
  };
21
-
22
17
  exports.Portal = Portal;
23
18
  exports.Portal.displayName = 'Portal';
24
19
  //# sourceMappingURL=Portal.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["packages/react-components/react-portal/src/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
+ {"version":3,"mappings":";;;;;;AAEA;AACA;AAGA;;;;AAIO,MAAMA,MAAM,GAA0BC,KAAK,IAAG;EACnD,MAAMC,KAAK,GAAGC,8BAAkB,CAACF,KAAK,CAAC;EAEvC,OAAOG,oCAAqB,CAACF,KAAK,CAAC;AACrC,CAAC;AAJYG,cAAM;AAMnBA,cAAM,CAACC,WAAW,GAAG,QAAQ","names":["Portal","props","state","usePortal_1","renderPortal_1","exports","displayName"],"sourceRoot":"../src/","sources":["packages/react-components/react-portal/src/components/Portal/Portal.tsx"],"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"]}
@@ -1 +1 @@
1
- {"version":3,"sources":[],"names":[],"mappings":"","sourceRoot":"../src/"}
1
+ {"version":3,"mappings":"","names":[],"sourceRoot":"../src/","sources":[],"sourcesContent":[]}
@@ -3,14 +3,9 @@
3
3
  Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
-
7
6
  const tslib_1 = /*#__PURE__*/require("tslib");
8
-
9
7
  tslib_1.__exportStar(require("./Portal"), exports);
10
-
11
8
  tslib_1.__exportStar(require("./Portal.types"), exports);
12
-
13
9
  tslib_1.__exportStar(require("./renderPortal"), exports);
14
-
15
10
  tslib_1.__exportStar(require("./usePortal"), exports);
16
11
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["packages/react-components/react-portal/src/components/Portal/index.ts"],"names":[],"mappings":";;;;;;;;AAAA,OAAA,CAAA,YAAA,CAAA,OAAA,CAAA,UAAA,CAAA,EAAA,OAAA;;AACA,OAAA,CAAA,YAAA,CAAA,OAAA,CAAA,gBAAA,CAAA,EAAA,OAAA;;AACA,OAAA,CAAA,YAAA,CAAA,OAAA,CAAA,gBAAA,CAAA,EAAA,OAAA;;AACA,OAAA,CAAA,YAAA,CAAA,OAAA,CAAA,aAAA,CAAA,EAAA,OAAA","sourcesContent":["export * from './Portal';\nexport * from './Portal.types';\nexport * from './renderPortal';\nexport * from './usePortal';\n"],"sourceRoot":"../src/"}
1
+ {"version":3,"mappings":";;;;;;AAAAA;AACAA;AACAA;AACAA","names":["tslib_1"],"sourceRoot":"../src/","sources":["packages/react-components/react-portal/src/components/Portal/index.ts"],"sourcesContent":["export * from './Portal';\nexport * from './Portal.types';\nexport * from './renderPortal';\nexport * from './usePortal';\n"]}
@@ -4,21 +4,16 @@ Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
6
  exports.renderPortal_unstable = void 0;
7
-
8
7
  const ReactDOM = /*#__PURE__*/require("react-dom");
9
-
10
8
  const React = /*#__PURE__*/require("react");
11
9
  /**
12
10
  * Render the final JSX of Portal
13
11
  */
14
-
15
-
16
12
  const renderPortal_unstable = state => {
17
13
  return React.createElement("span", {
18
14
  hidden: true,
19
15
  ref: state.virtualParentRootRef
20
16
  }, state.mountNode && ReactDOM.createPortal(state.children, state.mountNode));
21
17
  };
22
-
23
18
  exports.renderPortal_unstable = renderPortal_unstable;
24
19
  //# sourceMappingURL=renderPortal.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["packages/react-components/react-portal/src/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,SAAN,IAAmB,QAAQ,CAAC,YAAT,CAAsB,KAAK,CAAC,QAA5B,EAAsC,KAAK,CAAC,SAA5C,CADtB,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.mountNode && ReactDOM.createPortal(state.children, state.mountNode)}\n </span>\n );\n};\n"],"sourceRoot":"../src/"}
1
+ {"version":3,"mappings":";;;;;;AAAA;AACA;AAGA;;;AAGO,MAAMA,qBAAqB,GAAIC,KAAkB,IAAwB;EAC9E,OACEC;IAAMC,MAAM;IAACC,GAAG,EAAEH,KAAK,CAACI;EAAoB,GACzCJ,KAAK,CAACK,SAAS,IAAIC,QAAQ,CAACC,YAAY,CAACP,KAAK,CAACQ,QAAQ,EAAER,KAAK,CAACK,SAAS,CAAC,CACrE;AAEX,CAAC;AANYI,6BAAqB","names":["renderPortal_unstable","state","React","hidden","ref","virtualParentRootRef","mountNode","ReactDOM","createPortal","children","exports"],"sourceRoot":"../src/","sources":["packages/react-components/react-portal/src/components/Portal/renderPortal.tsx"],"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.mountNode && ReactDOM.createPortal(state.children, state.mountNode)}\n </span>\n );\n};\n"]}
@@ -4,11 +4,8 @@ Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
6
  exports.usePortal_unstable = void 0;
7
-
8
7
  const React = /*#__PURE__*/require("react");
9
-
10
8
  const usePortalMountNode_1 = /*#__PURE__*/require("./usePortalMountNode");
11
-
12
9
  const index_1 = /*#__PURE__*/require("../../virtualParent/index");
13
10
  /**
14
11
  * Create the state required to render Portal.
@@ -17,8 +14,6 @@ const index_1 = /*#__PURE__*/require("../../virtualParent/index");
17
14
  *
18
15
  * @param props - props from this instance of Portal
19
16
  */
20
-
21
-
22
17
  const usePortal_unstable = props => {
23
18
  const {
24
19
  children,
@@ -40,6 +35,5 @@ const usePortal_unstable = props => {
40
35
  }, [state.virtualParentRootRef, state.mountNode]);
41
36
  return state;
42
37
  };
43
-
44
38
  exports.usePortal_unstable = usePortal_unstable;
45
39
  //# sourceMappingURL=usePortal.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["packages/react-components/react-portal/src/components/Portal/usePortal.ts"],"names":[],"mappings":";;;;;;;AAAA,MAAA,KAAA,gBAAA,OAAA,CAAA,OAAA,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;EAHyB,CAA3B;EAMA,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,CAnBM;;AAAM,OAAA,CAAA,kBAAA,GAAkB,kBAAlB","sourcesContent":["import * as React from 'react';\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 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,"mappings":";;;;;;AAAA;AACA;AACA;AAGA;;;;;;;AAOO,MAAMA,kBAAkB,GAAIC,KAAkB,IAAiB;EACpE,MAAM;IAAEC,QAAQ;IAAEC;EAAS,CAAE,GAAGF,KAAK;EAErC,MAAMG,oBAAoB,GAAGC,KAAK,CAACC,MAAM,CAAkB,IAAI,CAAC;EAChE,MAAMC,iBAAiB,GAAGC,uCAAkB,CAAC;IAAEC,QAAQ,EAAE,CAAC,CAACN;EAAS,CAAE,CAAC;EAEvE,MAAMO,KAAK,GAAgB;IACzBR,QAAQ;IACRC,SAAS,EAAEA,SAAS,aAATA,SAAS,cAATA,SAAS,GAAII,iBAAiB;IACzCH;GACD;EAEDC,KAAK,CAACM,SAAS,CAAC,MAAK;IACnB,IAAID,KAAK,CAACN,oBAAoB,CAACQ,OAAO,IAAIF,KAAK,CAACP,SAAS,EAAE;MACzDU,wBAAgB,CAACH,KAAK,CAACP,SAAS,EAAEO,KAAK,CAACN,oBAAoB,CAACQ,OAAO,CAAC;;EAEzE,CAAC,EAAE,CAACF,KAAK,CAACN,oBAAoB,EAAEM,KAAK,CAACP,SAAS,CAAC,CAAC;EAEjD,OAAOO,KAAK;AACd,CAAC;AAnBYI,0BAAkB","names":["usePortal_unstable","props","children","mountNode","virtualParentRootRef","React","useRef","fallbackMountNode","usePortalMountNode_1","disabled","state","useEffect","current","index_1","exports"],"sourceRoot":"../src/","sources":["packages/react-components/react-portal/src/components/Portal/usePortal.ts"],"sourcesContent":["import * as React from 'react';\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 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"]}
@@ -4,28 +4,25 @@ Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
6
  exports.usePortalMountNode = void 0;
7
-
8
7
  const React = /*#__PURE__*/require("react");
9
-
10
8
  const react_shared_contexts_1 = /*#__PURE__*/require("@fluentui/react-shared-contexts");
11
-
12
9
  const react_1 = /*#__PURE__*/require("@griffel/react");
13
-
14
10
  const react_tabster_1 = /*#__PURE__*/require("@fluentui/react-tabster");
15
-
11
+ const use_disposable_1 = /*#__PURE__*/require("use-disposable");
12
+ const react_utilities_1 = /*#__PURE__*/require("@fluentui/react-utilities");
13
+ // String concatenation is used to prevent bundlers to complain with older versions of React
14
+ const useInsertionEffect = React['useInsertion' + 'Effect'] ? React['useInsertion' + 'Effect'] : react_utilities_1.useIsomorphicLayoutEffect;
16
15
  const useStyles = /*#__PURE__*/react_1.__styles({
17
- "root": {
18
- "qhf8xq": "f10pi13n",
19
- "Bj3rh1h": "f494woh"
16
+ root: {
17
+ qhf8xq: "f10pi13n",
18
+ Bj3rh1h: "f494woh"
20
19
  }
21
20
  }, {
22
- "d": [".f10pi13n{position:relative;}", ".f494woh{z-index:1000000;}"]
21
+ d: [".f10pi13n{position:relative;}", ".f494woh{z-index:1000000;}"]
23
22
  });
24
23
  /**
25
24
  * Creates a new element on a document.body to mount portals
26
25
  */
27
-
28
-
29
26
  const usePortalMountNode = options => {
30
27
  const {
31
28
  targetDocument,
@@ -35,40 +32,32 @@ const usePortalMountNode = options => {
35
32
  const classes = useStyles();
36
33
  const themeClassName = react_shared_contexts_1.useThemeClassName_unstable();
37
34
  const className = react_1.mergeClasses(themeClassName, classes.root);
38
- const element = React.useMemo(() => {
35
+ const element = use_disposable_1.useDisposable(() => {
39
36
  if (targetDocument === undefined || options.disabled) {
40
- return null;
37
+ return [null, () => null];
41
38
  }
42
-
43
39
  const newElement = targetDocument.createElement('div');
44
40
  targetDocument.body.appendChild(newElement);
45
- return newElement;
46
- }, [targetDocument, options.disabled]); // This useMemo call is intentional
41
+ return [newElement, () => newElement.remove()];
42
+ }, [targetDocument]);
43
+ // This useEffect call is intentional
47
44
  // We don't want to re-create the portal element when its attributes change.
48
45
  // This also should not be done in an effect because, changing the value of css variables
49
46
  // after initial mount can trigger interesting CSS side effects like transitions.
50
-
51
- React.useMemo(() => {
52
- if (element) {
53
- const classesToApply = className.split(' ').filter(Boolean);
54
- element.classList.add(...classesToApply);
55
- element.setAttribute('dir', dir);
56
- focusVisibleRef.current = element;
57
- return () => {
58
- element.classList.remove(...classesToApply);
59
- element.removeAttribute('dir');
60
- };
47
+ useInsertionEffect(() => {
48
+ if (!element) {
49
+ return;
61
50
  }
62
- }, [className, dir, element, focusVisibleRef]);
63
- React.useEffect(() => {
51
+ const classesToApply = className.split(' ').filter(Boolean);
52
+ element.classList.add(...classesToApply);
53
+ element.setAttribute('dir', dir);
54
+ focusVisibleRef.current = element;
64
55
  return () => {
65
- var _a;
66
-
67
- (_a = element === null || element === void 0 ? void 0 : element.parentElement) === null || _a === void 0 ? void 0 : _a.removeChild(element);
56
+ element.classList.remove(...classesToApply);
57
+ element.removeAttribute('dir');
68
58
  };
69
- }, [element]);
59
+ }, [className, dir, element, focusVisibleRef]);
70
60
  return element;
71
61
  };
72
-
73
62
  exports.usePortalMountNode = usePortalMountNode;
74
63
  //# sourceMappingURL=usePortalMountNode.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["packages/react-components/react-portal/src/components/Portal/usePortalMountNode.ts"],"names":[],"mappings":";;;;;;;AAAA,MAAA,KAAA,gBAAA,OAAA,CAAA,OAAA,CAAA;;AACA,MAAA,uBAAA,gBAAA,OAAA,CAAA,iCAAA,CAAA;;AAIA,MAAA,OAAA,gBAAA,OAAA,CAAA,gBAAA,CAAA;;AACA,MAAA,eAAA,gBAAA,OAAA,CAAA,yBAAA,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;EACA,MAAM,eAAe,GAAG,eAAA,CAAA,eAAA,EAAxB;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,CAT2F,CAoB3F;EACA;EACA;EACA;;EACA,KAAK,CAAC,OAAN,CAAc,MAAK;IACjB,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;MACA,eAAe,CAAC,OAAhB,GAA0B,OAA1B;MAEA,OAAO,MAAK;QACV,OAAO,CAAC,SAAR,CAAkB,MAAlB,CAAyB,GAAG,cAA5B;QACA,OAAO,CAAC,eAAR,CAAwB,KAAxB;MACD,CAHD;IAID;EACF,CAbD,EAaG,CAAC,SAAD,EAAY,GAAZ,EAAiB,OAAjB,EAA0B,eAA1B,CAbH;EAeA,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,CA9CM;;AAAM,OAAA,CAAA,kBAAA,GAAkB,kBAAlB","sourcesContent":["import * as React from 'react';\nimport {\n useThemeClassName_unstable as useThemeClassName,\n useFluent_unstable as useFluent,\n} from '@fluentui/react-shared-contexts';\nimport { makeStyles, mergeClasses } from '@griffel/react';\nimport { useFocusVisible } 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\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 const focusVisibleRef = useFocusVisible<HTMLDivElement>() as React.MutableRefObject<HTMLElement | null>;\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 // This useMemo call is intentional\n // We don't want to re-create the portal element when its attributes change.\n // This also should not be done in an effect because, changing the value of css variables\n // after initial mount can trigger interesting CSS side effects like transitions.\n React.useMemo(() => {\n if (element) {\n const classesToApply = className.split(' ').filter(Boolean);\n\n element.classList.add(...classesToApply);\n element.setAttribute('dir', dir);\n focusVisibleRef.current = element;\n\n return () => {\n element.classList.remove(...classesToApply);\n element.removeAttribute('dir');\n };\n }\n }, [className, dir, element, focusVisibleRef]);\n\n React.useEffect(() => {\n return () => {\n element?.parentElement?.removeChild(element);\n };\n }, [element]);\n\n return element;\n};\n"],"sourceRoot":"../src/"}
1
+ {"version":3,"mappings":";;;;;;AAAA;AACA;AAIA;AACA;AACA;AACA;AAEA;AACA,MAAMA,kBAAkB,GAAIC,KAAe,CAAC,cAAc,GAAG,QAAQ,CAAC,GACjEA,KAAe,CAAC,cAAc,GAAG,QAAQ,CAAC,GAC3CC,2CAAyB;AAS7B,MAAMC,SAAS,gBAAGC,gBAAU;EAAA;IAAA;IAAA;EAAA;AAAA;EAAA;AAAA,EAK1B;AAEF;;;AAGO,MAAMC,kBAAkB,GAAIC,OAAkC,IAAwB;EAC3F,MAAM;IAAEC,cAAc;IAAEC;EAAG,CAAE,GAAGC,0CAAS,EAAE;EAC3C,MAAMC,eAAe,GAAGC,+BAAe,EAAgE;EACvG,MAAMC,OAAO,GAAGT,SAAS,EAAE;EAC3B,MAAMU,cAAc,GAAGJ,kDAAiB,EAAE;EAE1C,MAAMK,SAAS,GAAGV,oBAAY,CAACS,cAAc,EAAED,OAAO,CAACG,IAAI,CAAC;EAE5D,MAAMC,OAAO,GAAGC,8BAAa,CAAC,MAAK;IACjC,IAAIV,cAAc,KAAKW,SAAS,IAAIZ,OAAO,CAACa,QAAQ,EAAE;MACpD,OAAO,CAAC,IAAI,EAAE,MAAM,IAAI,CAAC;;IAG3B,MAAMC,UAAU,GAAGb,cAAc,CAACc,aAAa,CAAC,KAAK,CAAC;IACtDd,cAAc,CAACe,IAAI,CAACC,WAAW,CAACH,UAAU,CAAC;IAC3C,OAAO,CAACA,UAAU,EAAE,MAAMA,UAAU,CAACI,MAAM,EAAE,CAAC;EAChD,CAAC,EAAE,CAACjB,cAAc,CAAC,CAAC;EAEpB;EACA;EACA;EACA;EACAP,kBAAkB,CAAC,MAAK;IACtB,IAAI,CAACgB,OAAO,EAAE;MACZ;;IAGF,MAAMS,cAAc,GAAGX,SAAS,CAACY,KAAK,CAAC,GAAG,CAAC,CAACC,MAAM,CAACC,OAAO,CAAC;IAE3DZ,OAAO,CAACa,SAAS,CAACC,GAAG,CAAC,GAAGL,cAAc,CAAC;IACxCT,OAAO,CAACe,YAAY,CAAC,KAAK,EAAEvB,GAAG,CAAC;IAChCE,eAAe,CAACsB,OAAO,GAAGhB,OAAO;IAEjC,OAAO,MAAK;MACVA,OAAO,CAACa,SAAS,CAACL,MAAM,CAAC,GAAGC,cAAc,CAAC;MAC3CT,OAAO,CAACiB,eAAe,CAAC,KAAK,CAAC;IAChC,CAAC;EACH,CAAC,EAAE,CAACnB,SAAS,EAAEN,GAAG,EAAEQ,OAAO,EAAEN,eAAe,CAAC,CAAC;EAE9C,OAAOM,OAAO;AAChB,CAAC;AAxCYkB,0BAAkB","names":["useInsertionEffect","React","react_utilities_1","useStyles","react_1","usePortalMountNode","options","targetDocument","dir","react_shared_contexts_1","focusVisibleRef","react_tabster_1","classes","themeClassName","className","root","element","use_disposable_1","undefined","disabled","newElement","createElement","body","appendChild","remove","classesToApply","split","filter","Boolean","classList","add","setAttribute","current","removeAttribute","exports"],"sourceRoot":"../src/","sources":["packages/react-components/react-portal/src/components/Portal/usePortalMountNode.ts"],"sourcesContent":["import * as React from 'react';\nimport {\n useThemeClassName_unstable as useThemeClassName,\n useFluent_unstable as useFluent,\n} from '@fluentui/react-shared-contexts';\nimport { makeStyles, mergeClasses } from '@griffel/react';\nimport { useFocusVisible } from '@fluentui/react-tabster';\nimport { useDisposable } from 'use-disposable';\nimport { useIsomorphicLayoutEffect } from '@fluentui/react-utilities';\n\n// String concatenation is used to prevent bundlers to complain with older versions of React\nconst useInsertionEffect = (React as never)['useInsertion' + 'Effect']\n ? (React as never)['useInsertion' + 'Effect']\n : useIsomorphicLayoutEffect;\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 const focusVisibleRef = useFocusVisible<HTMLDivElement>() as React.MutableRefObject<HTMLElement | null>;\n const classes = useStyles();\n const themeClassName = useThemeClassName();\n\n const className = mergeClasses(themeClassName, classes.root);\n\n const element = useDisposable(() => {\n if (targetDocument === undefined || options.disabled) {\n return [null, () => null];\n }\n\n const newElement = targetDocument.createElement('div');\n targetDocument.body.appendChild(newElement);\n return [newElement, () => newElement.remove()];\n }, [targetDocument]);\n\n // This useEffect call is intentional\n // We don't want to re-create the portal element when its attributes change.\n // This also should not be done in an effect because, changing the value of css variables\n // after initial mount can trigger interesting CSS side effects like transitions.\n useInsertionEffect(() => {\n if (!element) {\n return;\n }\n\n const classesToApply = className.split(' ').filter(Boolean);\n\n element.classList.add(...classesToApply);\n element.setAttribute('dir', dir);\n focusVisibleRef.current = element;\n\n return () => {\n element.classList.remove(...classesToApply);\n element.removeAttribute('dir');\n };\n }, [className, dir, element, focusVisibleRef]);\n\n return element;\n};\n"]}
@@ -4,9 +4,7 @@ Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
6
  exports.setVirtualParent = exports.elementContains = exports.usePortal_unstable = exports.renderPortal_unstable = exports.Portal = void 0;
7
-
8
7
  var index_1 = /*#__PURE__*/require("./components/Portal/index");
9
-
10
8
  Object.defineProperty(exports, "Portal", {
11
9
  enumerable: true,
12
10
  get: function () {
@@ -25,9 +23,7 @@ Object.defineProperty(exports, "usePortal_unstable", {
25
23
  return index_1.usePortal_unstable;
26
24
  }
27
25
  });
28
-
29
26
  var index_2 = /*#__PURE__*/require("./virtualParent/index");
30
-
31
27
  Object.defineProperty(exports, "elementContains", {
32
28
  enumerable: true,
33
29
  get: function () {
@@ -1 +1 @@
1
- {"version":3,"sources":["packages/react-components/react-portal/src/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
+ {"version":3,"mappings":";;;;;;AAAA;AAASA;EAAAC;EAAAC;IAAA,qBAAM;EAAA;AAAA;AAAEF;EAAAC;EAAAC;IAAA,oCAAqB;EAAA;AAAA;AAAEF;EAAAC;EAAAC;IAAA,iCAAkB;EAAA;AAAA;AAE1D;AAASF;EAAAC;EAAAC;IAAA,8BAAe;EAAA;AAAA;AAAEF;EAAAC;EAAAC;IAAA,+BAAgB;EAAA;AAAA","names":["Object","enumerable","get"],"sourceRoot":"../src/","sources":["packages/react-components/react-portal/src/index.ts"],"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"]}
@@ -4,7 +4,6 @@ Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
6
  exports.elementContains = void 0;
7
-
8
7
  const getParent_1 = /*#__PURE__*/require("./getParent");
9
8
  /**
10
9
  * Similar functionality to `element.contains` DOM API for use with out of order DOM elements that
@@ -12,29 +11,22 @@ const getParent_1 = /*#__PURE__*/require("./getParent");
12
11
  *
13
12
  * @returns true if the child can find the parent in its virtual hierarchy
14
13
  */
15
-
16
-
17
14
  function elementContains(parent, child) {
18
15
  if (!parent || !child) {
19
16
  return false;
20
17
  }
21
-
22
18
  if (parent === child) {
23
19
  return true;
24
20
  } else {
25
21
  while (child) {
26
22
  const nextParent = getParent_1.getParent(child);
27
-
28
23
  if (nextParent === parent) {
29
24
  return true;
30
25
  }
31
-
32
26
  child = nextParent;
33
27
  }
34
28
  }
35
-
36
29
  return false;
37
30
  }
38
-
39
31
  exports.elementContains = elementContains;
40
32
  //# sourceMappingURL=elementContains.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["packages/react-components/react-portal/src/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
+ {"version":3,"mappings":";;;;;;AAAA;AACA;;;;;;AAMA,SAAgBA,eAAe,CAACC,MAA0B,EAAEC,KAAyB;EACnF,IAAI,CAACD,MAAM,IAAI,CAACC,KAAK,EAAE;IACrB,OAAO,KAAK;;EAGd,IAAID,MAAM,KAAKC,KAAK,EAAE;IACpB,OAAO,IAAI;GACZ,MAAM;IACL,OAAOA,KAAK,EAAE;MACZ,MAAMC,UAAU,GAAuBC,qBAAS,CAACF,KAAK,CAAC;MAEvD,IAAIC,UAAU,KAAKF,MAAM,EAAE;QACzB,OAAO,IAAI;;MAGbC,KAAK,GAAGC,UAAU;;;EAItB,OAAO,KAAK;AACd;AApBAE","names":["elementContains","parent","child","nextParent","getParent_1","exports"],"sourceRoot":"../src/","sources":["packages/react-components/react-portal/src/virtualParent/elementContains.ts"],"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"]}
@@ -4,17 +4,13 @@ Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
6
  exports.getParent = void 0;
7
-
8
7
  const getVirtualParent_1 = /*#__PURE__*/require("./getVirtualParent");
9
8
  /**
10
9
  * Gets the element which is the parent of a given element.
11
10
  * This method prefers the virtual parent over real DOM parent when present.
12
11
  */
13
-
14
-
15
12
  function getParent(child) {
16
13
  return child && getVirtualParent_1.getVirtualParent(child) || (child === null || child === void 0 ? void 0 : child.parentNode);
17
14
  }
18
-
19
15
  exports.getParent = getParent;
20
16
  //# sourceMappingURL=getParent.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["packages/react-components/react-portal/src/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
+ {"version":3,"mappings":";;;;;;AAAA;AAEA;;;;AAIA,SAAgBA,SAAS,CAACC,KAAyB;EACjD,OAAQA,KAAK,IAAIC,mCAAgB,CAACD,KAAK,CAAC,KAAMA,KAAK,aAALA,KAAK,uBAALA,KAAK,CAAEE,UAAiC;AACxF;AAFAC","names":["getParent","child","getVirtualParent_1","parentNode","exports"],"sourceRoot":"../src/","sources":["packages/react-components/react-portal/src/virtualParent/getParent.ts"],"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"]}
@@ -4,22 +4,16 @@ Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
6
  exports.getVirtualParent = void 0;
7
-
8
7
  const isVirtualElement_1 = /*#__PURE__*/require("./isVirtualElement");
9
8
  /**
10
9
  * Gets the virtual parent given the child element, if it exists.
11
10
  */
12
-
13
-
14
11
  function getVirtualParent(child) {
15
12
  let parent;
16
-
17
13
  if (isVirtualElement_1.isVirtualElement(child)) {
18
14
  parent = child._virtual.parent;
19
15
  }
20
-
21
16
  return parent;
22
17
  }
23
-
24
18
  exports.getVirtualParent = getVirtualParent;
25
19
  //# sourceMappingURL=getVirtualParent.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["packages/react-components/react-portal/src/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
+ {"version":3,"mappings":";;;;;;AAAA;AACA;;;AAGA,SAAgBA,gBAAgB,CAACC,KAAkB;EACjD,IAAIC,MAA+B;EACnC,IAAIC,mCAAgB,CAACF,KAAK,CAAC,EAAE;IAC3BC,MAAM,GAAGD,KAAK,CAACG,QAAQ,CAACF,MAAM;;EAEhC,OAAOA,MAAM;AACf;AANAG","names":["getVirtualParent","child","parent","isVirtualElement_1","_virtual","exports"],"sourceRoot":"../src/","sources":["packages/react-components/react-portal/src/virtualParent/getVirtualParent.ts"],"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"]}
@@ -3,16 +3,10 @@
3
3
  Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
-
7
6
  const tslib_1 = /*#__PURE__*/require("tslib");
8
-
9
7
  tslib_1.__exportStar(require("./elementContains"), exports);
10
-
11
8
  tslib_1.__exportStar(require("./getParent"), exports);
12
-
13
9
  tslib_1.__exportStar(require("./getVirtualParent"), exports);
14
-
15
10
  tslib_1.__exportStar(require("./isVirtualElement"), exports);
16
-
17
11
  tslib_1.__exportStar(require("./setVirtualParent"), exports);
18
12
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["packages/react-components/react-portal/src/virtualParent/index.ts"],"names":[],"mappings":";;;;;;;;AAAA,OAAA,CAAA,YAAA,CAAA,OAAA,CAAA,mBAAA,CAAA,EAAA,OAAA;;AACA,OAAA,CAAA,YAAA,CAAA,OAAA,CAAA,aAAA,CAAA,EAAA,OAAA;;AACA,OAAA,CAAA,YAAA,CAAA,OAAA,CAAA,oBAAA,CAAA,EAAA,OAAA;;AACA,OAAA,CAAA,YAAA,CAAA,OAAA,CAAA,oBAAA,CAAA,EAAA,OAAA;;AACA,OAAA,CAAA,YAAA,CAAA,OAAA,CAAA,oBAAA,CAAA,EAAA,OAAA","sourcesContent":["export * from './elementContains';\nexport * from './getParent';\nexport * from './getVirtualParent';\nexport * from './isVirtualElement';\nexport * from './setVirtualParent';\n"],"sourceRoot":"../src/"}
1
+ {"version":3,"mappings":";;;;;;AAAAA;AACAA;AACAA;AACAA;AACAA","names":["tslib_1"],"sourceRoot":"../src/","sources":["packages/react-components/react-portal/src/virtualParent/index.ts"],"sourcesContent":["export * from './elementContains';\nexport * from './getParent';\nexport * from './getVirtualParent';\nexport * from './isVirtualElement';\nexport * from './setVirtualParent';\n"]}
@@ -7,10 +7,8 @@ exports.isVirtualElement = void 0;
7
7
  /**
8
8
  * Determines whether or not an element has the virtual hierarchy extension.
9
9
  */
10
-
11
10
  function isVirtualElement(element) {
12
11
  return element && !!element._virtual;
13
12
  }
14
-
15
13
  exports.isVirtualElement = isVirtualElement;
16
14
  //# sourceMappingURL=isVirtualElement.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["packages/react-components/react-portal/src/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
+ {"version":3,"mappings":";;;;;;AAEA;;;AAGA,SAAgBA,gBAAgB,CAACC,OAAqC;EACpE,OAAOA,OAAO,IAAI,CAAC,CAAkBA,OAAQ,CAACC,QAAQ;AACxD;AAFAC","names":["isVirtualElement","element","_virtual","exports"],"sourceRoot":"../src/","sources":["packages/react-components/react-portal/src/virtualParent/isVirtualElement.ts"],"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"]}
@@ -10,20 +10,15 @@ exports.setVirtualParent = void 0;
10
10
  * @param child - Theme element to set the virtual parent
11
11
  * @param parent - The virtual parent, use `undefined` to remove a virtual parent relationship
12
12
  */
13
-
14
13
  function setVirtualParent(child, parent) {
15
14
  if (!child) {
16
15
  return;
17
16
  }
18
-
19
17
  const virtualChild = child;
20
-
21
18
  if (!virtualChild._virtual) {
22
19
  virtualChild._virtual = {};
23
20
  }
24
-
25
21
  virtualChild._virtual.parent = parent || undefined;
26
22
  }
27
-
28
23
  exports.setVirtualParent = setVirtualParent;
29
24
  //# sourceMappingURL=setVirtualParent.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["packages/react-components/react-portal/src/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/"}
1
+ {"version":3,"mappings":";;;;;;AAEA;;;;;;AAMA,SAAgBA,gBAAgB,CAACC,KAAkB,EAAEC,MAAoB;EACvE,IAAI,CAACD,KAAK,EAAE;IACV;;EAGF,MAAME,YAAY,GAAmBF,KAAK;EAE1C,IAAI,CAACE,YAAY,CAACC,QAAQ,EAAE;IAC1BD,YAAY,CAACC,QAAQ,GAAG,EAAE;;EAG5BD,YAAY,CAACC,QAAQ,CAACF,MAAM,GAAGA,MAAM,IAAIG,SAAS;AACpD;AAZAC","names":["setVirtualParent","child","parent","virtualChild","_virtual","undefined","exports"],"sourceRoot":"../src/","sources":["packages/react-components/react-portal/src/virtualParent/setVirtualParent.ts"],"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"]}
@@ -1 +1 @@
1
- {"version":3,"sources":[],"names":[],"mappings":"","sourceRoot":"../src/"}
1
+ {"version":3,"mappings":"","names":[],"sourceRoot":"../src/","sources":[],"sourcesContent":[]}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@fluentui/react-portal",
3
- "version": "9.0.14",
3
+ "version": "9.0.15",
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",
@@ -27,14 +27,15 @@
27
27
  "devDependencies": {
28
28
  "@fluentui/eslint-plugin": "*",
29
29
  "@fluentui/react-conformance": "*",
30
- "@fluentui/scripts": "^1.0.0"
30
+ "@fluentui/scripts": "*"
31
31
  },
32
32
  "dependencies": {
33
33
  "@fluentui/react-shared-contexts": "^9.1.4",
34
- "@fluentui/react-tabster": "^9.3.4",
35
- "@fluentui/react-utilities": "^9.3.0",
36
- "@griffel/react": "^1.4.2",
37
- "tslib": "^2.1.0"
34
+ "@fluentui/react-tabster": "^9.3.5",
35
+ "@fluentui/react-utilities": "^9.3.1",
36
+ "@griffel/react": "^1.5.2",
37
+ "tslib": "^2.1.0",
38
+ "use-disposable": "^1.0.1"
38
39
  },
39
40
  "peerDependencies": {
40
41
  "@types/react": ">=16.8.0 <19.0.0",