@fluentui/react-portal 9.2.6 → 9.2.7

Sign up to get free protection for your applications and to get access to all the features.
package/CHANGELOG.json CHANGED
@@ -2,7 +2,54 @@
2
2
  "name": "@fluentui/react-portal",
3
3
  "entries": [
4
4
  {
5
- "date": "Mon, 17 Apr 2023 17:50:13 GMT",
5
+ "date": "Fri, 12 May 2023 20:22:02 GMT",
6
+ "tag": "@fluentui/react-portal_v9.2.7",
7
+ "version": "9.2.7",
8
+ "comments": {
9
+ "none": [
10
+ {
11
+ "author": "martinhochel@microsoft.com",
12
+ "package": "@fluentui/react-portal",
13
+ "commit": "dbda7fa69e3000aaf8dd4a061e254ebd35198b8e",
14
+ "comment": "fix: update npmignore files to fix npm8/node16 regression how npm publish works"
15
+ }
16
+ ],
17
+ "patch": [
18
+ {
19
+ "author": "olfedias@microsoft.com",
20
+ "package": "@fluentui/react-portal",
21
+ "commit": "c28decb23d191a0daaaf6d5d1832429715102129",
22
+ "comment": "chore: exclude .swcrc from being published"
23
+ },
24
+ {
25
+ "author": "olfedias@microsoft.com",
26
+ "package": "@fluentui/react-portal",
27
+ "commit": "9d6394b6c751092fd1d4e26ccc618b5ba05086ec",
28
+ "comment": "chore: move makeStyles() calls to .styles.ts files"
29
+ },
30
+ {
31
+ "author": "beachball",
32
+ "package": "@fluentui/react-portal",
33
+ "comment": "Bump @fluentui/react-shared-contexts to v9.4.0",
34
+ "commit": "79c08ce5bbf6387b2b18ba4c3d2d5681e0177d4b"
35
+ },
36
+ {
37
+ "author": "beachball",
38
+ "package": "@fluentui/react-portal",
39
+ "comment": "Bump @fluentui/react-tabster to v9.7.0",
40
+ "commit": "79c08ce5bbf6387b2b18ba4c3d2d5681e0177d4b"
41
+ },
42
+ {
43
+ "author": "beachball",
44
+ "package": "@fluentui/react-portal",
45
+ "comment": "Bump @fluentui/react-utilities to v9.8.1",
46
+ "commit": "79c08ce5bbf6387b2b18ba4c3d2d5681e0177d4b"
47
+ }
48
+ ]
49
+ }
50
+ },
51
+ {
52
+ "date": "Mon, 17 Apr 2023 17:54:02 GMT",
6
53
  "tag": "@fluentui/react-portal_v9.2.6",
7
54
  "version": "9.2.6",
8
55
  "comments": {
package/CHANGELOG.md CHANGED
@@ -1,12 +1,25 @@
1
1
  # Change Log - @fluentui/react-portal
2
2
 
3
- This log was last generated on Mon, 17 Apr 2023 17:50:13 GMT and should not be manually modified.
3
+ This log was last generated on Fri, 12 May 2023 20:22:02 GMT and should not be manually modified.
4
4
 
5
5
  <!-- Start content -->
6
6
 
7
+ ## [9.2.7](https://github.com/microsoft/fluentui/tree/@fluentui/react-portal_v9.2.7)
8
+
9
+ Fri, 12 May 2023 20:22:02 GMT
10
+ [Compare changes](https://github.com/microsoft/fluentui/compare/@fluentui/react-portal_v9.2.6..@fluentui/react-portal_v9.2.7)
11
+
12
+ ### Patches
13
+
14
+ - chore: exclude .swcrc from being published ([PR #27740](https://github.com/microsoft/fluentui/pull/27740) by olfedias@microsoft.com)
15
+ - chore: move makeStyles() calls to .styles.ts files ([PR #27698](https://github.com/microsoft/fluentui/pull/27698) by olfedias@microsoft.com)
16
+ - Bump @fluentui/react-shared-contexts to v9.4.0 ([PR #27827](https://github.com/microsoft/fluentui/pull/27827) by beachball)
17
+ - Bump @fluentui/react-tabster to v9.7.0 ([PR #27827](https://github.com/microsoft/fluentui/pull/27827) by beachball)
18
+ - Bump @fluentui/react-utilities to v9.8.1 ([PR #27827](https://github.com/microsoft/fluentui/pull/27827) by beachball)
19
+
7
20
  ## [9.2.6](https://github.com/microsoft/fluentui/tree/@fluentui/react-portal_v9.2.6)
8
21
 
9
- Mon, 17 Apr 2023 17:50:13 GMT
22
+ Mon, 17 Apr 2023 17:54:02 GMT
10
23
  [Compare changes](https://github.com/microsoft/fluentui/compare/@fluentui/react-portal_v9.2.5..@fluentui/react-portal_v9.2.6)
11
24
 
12
25
  ### Patches
@@ -1,17 +1,10 @@
1
1
  import * as React from 'react';
2
2
  import { useThemeClassName_unstable as useThemeClassName, useFluent_unstable as useFluent } from '@fluentui/react-shared-contexts';
3
- import { __styles, mergeClasses } from '@griffel/react';
3
+ import { mergeClasses } from '@griffel/react';
4
4
  import { useFocusVisible } from '@fluentui/react-tabster';
5
5
  import { useDisposable } from 'use-disposable';
6
+ import { usePortalMountNodeStylesStyles } from './usePortalMountNodeStyles.styles';
6
7
  const useInsertionEffect = React['useInsertion' + 'Effect'];
7
- const useStyles = /*#__PURE__*/__styles({
8
- root: {
9
- qhf8xq: "f10pi13n",
10
- Bj3rh1h: "f494woh"
11
- }
12
- }, {
13
- d: [".f10pi13n{position:relative;}", ".f494woh{z-index:1000000;}"]
14
- });
15
8
  /**
16
9
  * Creates a new element on a "document.body" to mount portals.
17
10
  */
@@ -21,7 +14,7 @@ export const usePortalMountNode = options => {
21
14
  dir
22
15
  } = useFluent();
23
16
  const focusVisibleRef = useFocusVisible();
24
- const classes = useStyles();
17
+ const classes = usePortalMountNodeStylesStyles();
25
18
  const themeClassName = useThemeClassName();
26
19
  const className = mergeClasses(themeClassName, classes.root, options.className);
27
20
  const element = useDisposable(() => {
@@ -1 +1 @@
1
- {"version":3,"names":["React","useThemeClassName_unstable","useThemeClassName","useFluent_unstable","useFluent","__styles","mergeClasses","useFocusVisible","useDisposable","useInsertionEffect","useStyles","root","qhf8xq","Bj3rh1h","d","usePortalMountNode","options","targetDocument","dir","focusVisibleRef","classes","themeClassName","className","element","undefined","disabled","newElement","createElement","body","appendChild","remove","classesToApply","split","filter","Boolean","classList","add","setAttribute","current","removeAttribute","useMemo"],"sources":["../../../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';\n\nconst useInsertionEffect = (React as never)['useInsertion' + 'Effect'] as typeof React.useLayoutEffect | undefined;\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 className?: string;\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, options.className);\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 if (useInsertionEffect) {\n // eslint-disable-next-line react-hooks/rules-of-hooks\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 } else {\n // This useMemo call is intentional for React 17\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 // eslint-disable-next-line react-hooks/rules-of-hooks\n React.useMemo(() => {\n if (!element) {\n return;\n }\n\n // Force replace all classes\n element.className = className;\n element.setAttribute('dir', dir);\n focusVisibleRef.current = element;\n }, [className, dir, element, focusVisibleRef]);\n }\n\n return element;\n};\n"],"mappings":"AAAA,YAAYA,KAAA,MAAW;AACvB,SACEC,0BAAA,IAA8BC,iBAAiB,EAC/CC,kBAAA,IAAsBC,SAAS,QAC1B;AACP,SAAAC,QAAA,EAAqBC,YAAY,QAAQ;AACzC,SAASC,eAAe,QAAQ;AAChC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,CAAQY,SAAS,CAACL,MAAM,IAAIC,cAAA;QAC5BR,OAAA,CAAQgB,eAAe,CAAC;MAC1B;IACF,GAAG,CAACjB,SAAA,EAAWJ,GAAA,EAAKK,OAAA,EAASJ,eAAA,CAAgB;EAC/C,OAAO;IACL;IACA;IACA;IACA;IACA;IACAnB,KAAA,CAAMwC,OAAO,CAAC,MAAM;MAClB,IAAI,CAACjB,OAAA,EAAS;QACZ;MACF;MAEA;MACAA,OAAA,CAAQD,SAAS,GAAGA,SAAA;MACpBC,OAAA,CAAQc,YAAY,CAAC,OAAOnB,GAAA;MAC5BC,eAAA,CAAgBmB,OAAO,GAAGf,OAAA;IAC5B,GAAG,CAACD,SAAA,EAAWJ,GAAA,EAAKK,OAAA,EAASJ,eAAA,CAAgB;EAC/C;EAEA,OAAOI,OAAA;AACT"}
1
+ {"version":3,"names":["React","useThemeClassName_unstable","useThemeClassName","useFluent_unstable","useFluent","mergeClasses","useFocusVisible","useDisposable","usePortalMountNodeStylesStyles","useInsertionEffect","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","useMemo"],"sources":["../../../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 { mergeClasses } from '@griffel/react';\nimport { useFocusVisible } from '@fluentui/react-tabster';\nimport { useDisposable } from 'use-disposable';\n\nimport { usePortalMountNodeStylesStyles } from './usePortalMountNodeStyles.styles';\n\nconst useInsertionEffect = (React as never)['useInsertion' + 'Effect'] as typeof React.useLayoutEffect | undefined;\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 className?: string;\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 = usePortalMountNodeStylesStyles();\n const themeClassName = useThemeClassName();\n\n const className = mergeClasses(themeClassName, classes.root, options.className);\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 if (useInsertionEffect) {\n // eslint-disable-next-line react-hooks/rules-of-hooks\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 } else {\n // This useMemo call is intentional for React 17\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 // eslint-disable-next-line react-hooks/rules-of-hooks\n React.useMemo(() => {\n if (!element) {\n return;\n }\n\n // Force replace all classes\n element.className = className;\n element.setAttribute('dir', dir);\n focusVisibleRef.current = element;\n }, [className, dir, element, focusVisibleRef]);\n }\n\n return element;\n};\n"],"mappings":"AAAA,YAAYA,KAAA,MAAW;AACvB,SACEC,0BAAA,IAA8BC,iBAAiB,EAC/CC,kBAAA,IAAsBC,SAAS,QAC1B;AACP,SAASC,YAAY,QAAQ;AAC7B,SAASC,eAAe,QAAQ;AAChC,SAASC,aAAa,QAAQ;AAE9B,SAASC,8BAA8B,QAAQ;AAE/C,MAAMC,kBAAA,GAAqBT,KAAgB,CAAC,iBAAiB,SAAS;AAWtE;;;AAGA,OAAO,MAAMU,kBAAA,GAAsBC,OAAA,IAA2D;EAC5F,MA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AS;QACZ;MACF;MAEA;MACAA,OAAA,CAAQF,SAAS,GAAGA,SAAA;MACpBE,OAAA,CAAQc,YAAY,CAAC,OAAOpB,GAAA;MAC5BC,eAAA,CAAgBoB,OAAO,GAAGf,OAAA;IAC5B,GAAG,CAACF,SAAA,EAAWJ,GAAA,EAAKM,OAAA,EAASL,eAAA,CAAgB;EAC/C;EAEA,OAAOK,OAAA;AACT"}
@@ -0,0 +1,10 @@
1
+ import { __styles } from '@griffel/react';
2
+ export const usePortalMountNodeStylesStyles = /*#__PURE__*/__styles({
3
+ root: {
4
+ qhf8xq: "f10pi13n",
5
+ Bj3rh1h: "f494woh"
6
+ }
7
+ }, {
8
+ d: [".f10pi13n{position:relative;}", ".f494woh{z-index:1000000;}"]
9
+ });
10
+ //# sourceMappingURL=usePortalMountNodeStyles.styles.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["__styles","usePortalMountNodeStylesStyles","root","qhf8xq","Bj3rh1h","d"],"sources":["../../../src/components/Portal/usePortalMountNodeStyles.styles.ts"],"sourcesContent":["import { makeStyles } from '@griffel/react';\n\nexport const usePortalMountNodeStylesStyles = makeStyles({\n root: {\n position: 'relative',\n zIndex: 1000000,\n },\n});\n"],"mappings":"AAAA,SAAAA,QAAA,QAA2B;AAE3B,OAAO,MAAMC,8BAAA,gBAAiCD,QAAA;EAAAE,IAAA;IAAAC,MAAA;IAAAC,OAAA;EAAA;AAAA;EAAAC,CAAA;AAAA,EAK9C"}
@@ -12,22 +12,12 @@ const _reactSharedContexts = require("@fluentui/react-shared-contexts");
12
12
  const _react1 = require("@griffel/react");
13
13
  const _reactTabster = require("@fluentui/react-tabster");
14
14
  const _useDisposable = require("use-disposable");
15
+ const _usePortalMountNodeStylesStyles = require("./usePortalMountNodeStyles.styles");
15
16
  const useInsertionEffect = _react['useInsertion' + 'Effect'];
16
- const useStyles = /*#__PURE__*/ (0, _react1["__styles"])({
17
- root: {
18
- qhf8xq: "f10pi13n",
19
- Bj3rh1h: "f494woh"
20
- }
21
- }, {
22
- d: [
23
- ".f10pi13n{position:relative;}",
24
- ".f494woh{z-index:1000000;}"
25
- ]
26
- });
27
17
  const usePortalMountNode = (options)=>{
28
18
  const { targetDocument , dir } = (0, _reactSharedContexts.useFluent_unstable)();
29
19
  const focusVisibleRef = (0, _reactTabster.useFocusVisible)();
30
- const classes = useStyles();
20
+ const classes = (0, _usePortalMountNodeStylesStyles.usePortalMountNodeStylesStyles)();
31
21
  const themeClassName = (0, _reactSharedContexts.useThemeClassName_unstable)();
32
22
  const className = (0, _react1.mergeClasses)(themeClassName, classes.root, options.className);
33
23
  const element = (0, _useDisposable.useDisposable)(()=>{
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../lib/components/Portal/usePortalMountNode.js"],"sourcesContent":["import * as React from 'react';\nimport { useThemeClassName_unstable as useThemeClassName, useFluent_unstable as useFluent } from '@fluentui/react-shared-contexts';\nimport { __styles, mergeClasses } from '@griffel/react';\nimport { useFocusVisible } from '@fluentui/react-tabster';\nimport { useDisposable } from 'use-disposable';\nconst useInsertionEffect = React['useInsertion' + 'Effect'];\nconst useStyles = /*#__PURE__*/__styles({\n root: {\n qhf8xq: \"f10pi13n\",\n Bj3rh1h: \"f494woh\"\n }\n}, {\n d: [\".f10pi13n{position:relative;}\", \".f494woh{z-index:1000000;}\"]\n});\n/**\n * Creates a new element on a \"document.body\" to mount portals.\n */\nexport const usePortalMountNode = options => {\n const {\n targetDocument,\n dir\n } = useFluent();\n const focusVisibleRef = useFocusVisible();\n const classes = useStyles();\n const themeClassName = useThemeClassName();\n const className = mergeClasses(themeClassName, classes.root, options.className);\n const element = useDisposable(() => {\n if (targetDocument === undefined || options.disabled) {\n return [null, () => null];\n }\n const newElement = targetDocument.createElement('div');\n targetDocument.body.appendChild(newElement);\n return [newElement, () => newElement.remove()];\n }, [targetDocument]);\n if (useInsertionEffect) {\n // eslint-disable-next-line react-hooks/rules-of-hooks\n useInsertionEffect(() => {\n if (!element) {\n return;\n }\n const classesToApply = className.split(' ').filter(Boolean);\n element.classList.add(...classesToApply);\n element.setAttribute('dir', dir);\n focusVisibleRef.current = element;\n return () => {\n element.classList.remove(...classesToApply);\n element.removeAttribute('dir');\n };\n }, [className, dir, element, focusVisibleRef]);\n } else {\n // This useMemo call is intentional for React 17\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 // eslint-disable-next-line react-hooks/rules-of-hooks\n React.useMemo(() => {\n if (!element) {\n return;\n }\n // Force replace all classes\n element.className = className;\n element.setAttribute('dir', dir);\n focusVisibleRef.current = element;\n }, [className, dir, element, focusVisibleRef]);\n }\n return element;\n};\n//# sourceMappingURL=usePortalMountNode.js.map"],"names":["usePortalMountNode","useInsertionEffect","React","useStyles","__styles","root","qhf8xq","Bj3rh1h","d","options","targetDocument","dir","useFluent","focusVisibleRef","useFocusVisible","classes","themeClassName","useThemeClassName","className","mergeClasses","element","useDisposable","undefined","disabled","newElement","createElement","body","appendChild","remove","classesToApply","split","filter","Boolean","classList","add","setAttribute","current","removeAttribute","useMemo"],"mappings":";;;;+BAiBaA;;aAAAA;;;6DAjBU;qCAC0E;wBAC1D;8BACP;+BACF;AAC9B,MAAMC,qBAAqBC,MAAK,CAAC,iBAAiB,SAAS;AAC3D,MAAMC,YAAY,WAAW,GAAEC,IAAAA,mBAAQ,EAAC;IACtCC,MAAM;QACJC,QAAQ;QACRC,SAAS;IACX;AACF,GAAG;IACDC,GAAG;QAAC;QAAiC;KAA6B;AACpE;AAIO,MAAMR,qBAAqBS,CAAAA,UAAW;IAC3C,MAAM,EACJC,eAAc,EACdC,IAAG,EACJ,GAAGC,IAAAA,uCAAS;IACb,MAAMC,kBAAkBC,IAAAA,6BAAe;IACvC,MAAMC,UAAUZ;IAChB,MAAMa,iBAAiBC,IAAAA,+CAAiB;IACxC,MAAMC,YAAYC,IAAAA,oBAAY,EAACH,gBAAgBD,QAAQV,IAAI,EAAEI,QAAQS,SAAS;IAC9E,MAAME,UAAUC,IAAAA,4BAAa,EAAC,IAAM;QAClC,IAAIX,mBAAmBY,aAAab,QAAQc,QAAQ,EAAE;YACpD,OAAO;gBAAC,IAAI;gBAAE,IAAM,IAAI;aAAC;QAC3B,CAAC;QACD,MAAMC,aAAad,eAAee,aAAa,CAAC;QAChDf,eAAegB,IAAI,CAACC,WAAW,CAACH;QAChC,OAAO;YAACA;YAAY,IAAMA,WAAWI,MAAM;SAAG;IAChD,GAAG;QAAClB;KAAe;IACnB,IAAIT,oBAAoB;QACtB,sDAAsD;QACtDA,mBAAmB,IAAM;YACvB,IAAI,CAACmB,SAAS;gBACZ;YACF,CAAC;YACD,MAAMS,iBAAiBX,UAAUY,KAAK,CAAC,KAAKC,MAAM,CAACC;YACnDZ,QAAQa,SAAS,CAACC,GAAG,IAAIL;YACzBT,QAAQe,YAAY,CAAC,OAAOxB;YAC5BE,gBAAgBuB,OAAO,GAAGhB;YAC1B,OAAO,IAAM;gBACXA,QAAQa,SAAS,CAACL,MAAM,IAAIC;gBAC5BT,QAAQiB,eAAe,CAAC;YAC1B;QACF,GAAG;YAACnB;YAAWP;YAAKS;YAASP;SAAgB;IAC/C,OAAO;QACL,gDAAgD;QAChD,4EAA4E;QAC5E,yFAAyF;QACzF,iFAAiF;QACjF,sDAAsD;QACtDX,OAAMoC,OAAO,CAAC,IAAM;YAClB,IAAI,CAAClB,SAAS;gBACZ;YACF,CAAC;YACD,4BAA4B;YAC5BA,QAAQF,SAAS,GAAGA;YACpBE,QAAQe,YAAY,CAAC,OAAOxB;YAC5BE,gBAAgBuB,OAAO,GAAGhB;QAC5B,GAAG;YAACF;YAAWP;YAAKS;YAASP;SAAgB;IAC/C,CAAC;IACD,OAAOO;AACT,GACA,8CAA8C"}
1
+ {"version":3,"sources":["../../../lib/components/Portal/usePortalMountNode.js"],"sourcesContent":["import * as React from 'react';\nimport { useThemeClassName_unstable as useThemeClassName, useFluent_unstable as useFluent } from '@fluentui/react-shared-contexts';\nimport { mergeClasses } from '@griffel/react';\nimport { useFocusVisible } from '@fluentui/react-tabster';\nimport { useDisposable } from 'use-disposable';\nimport { usePortalMountNodeStylesStyles } from './usePortalMountNodeStyles.styles';\nconst useInsertionEffect = React['useInsertion' + 'Effect'];\n/**\n * Creates a new element on a \"document.body\" to mount portals.\n */\nexport const usePortalMountNode = options => {\n const {\n targetDocument,\n dir\n } = useFluent();\n const focusVisibleRef = useFocusVisible();\n const classes = usePortalMountNodeStylesStyles();\n const themeClassName = useThemeClassName();\n const className = mergeClasses(themeClassName, classes.root, options.className);\n const element = useDisposable(() => {\n if (targetDocument === undefined || options.disabled) {\n return [null, () => null];\n }\n const newElement = targetDocument.createElement('div');\n targetDocument.body.appendChild(newElement);\n return [newElement, () => newElement.remove()];\n }, [targetDocument]);\n if (useInsertionEffect) {\n // eslint-disable-next-line react-hooks/rules-of-hooks\n useInsertionEffect(() => {\n if (!element) {\n return;\n }\n const classesToApply = className.split(' ').filter(Boolean);\n element.classList.add(...classesToApply);\n element.setAttribute('dir', dir);\n focusVisibleRef.current = element;\n return () => {\n element.classList.remove(...classesToApply);\n element.removeAttribute('dir');\n };\n }, [className, dir, element, focusVisibleRef]);\n } else {\n // This useMemo call is intentional for React 17\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 // eslint-disable-next-line react-hooks/rules-of-hooks\n React.useMemo(() => {\n if (!element) {\n return;\n }\n // Force replace all classes\n element.className = className;\n element.setAttribute('dir', dir);\n focusVisibleRef.current = element;\n }, [className, dir, element, focusVisibleRef]);\n }\n return element;\n};\n//# sourceMappingURL=usePortalMountNode.js.map"],"names":["usePortalMountNode","useInsertionEffect","React","options","targetDocument","dir","useFluent","focusVisibleRef","useFocusVisible","classes","usePortalMountNodeStylesStyles","themeClassName","useThemeClassName","className","mergeClasses","root","element","useDisposable","undefined","disabled","newElement","createElement","body","appendChild","remove","classesToApply","split","filter","Boolean","classList","add","setAttrib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zF,iFAAiF;QACjF,sDAAsD;QACtDL,OAAMgC,OAAO,CAAC,IAAM;YAClB,IAAI,CAAClB,SAAS;gBACZ;YACF,CAAC;YACD,4BAA4B;YAC5BA,QAAQH,SAAS,GAAGA;YACpBG,QAAQe,YAAY,CAAC,OAAO1B;YAC5BE,gBAAgByB,OAAO,GAAGhB;QAC5B,GAAG;YAACH;YAAWR;YAAKW;YAAST;SAAgB;IAC/C,CAAC;IACD,OAAOS;AACT,GACA,8CAA8C"}
@@ -0,0 +1,22 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", {
3
+ value: true
4
+ });
5
+ Object.defineProperty(exports, "usePortalMountNodeStylesStyles", {
6
+ enumerable: true,
7
+ get: ()=>usePortalMountNodeStylesStyles
8
+ });
9
+ const _react = require("@griffel/react");
10
+ const usePortalMountNodeStylesStyles = /*#__PURE__*/ (0, _react["__styles"])({
11
+ root: {
12
+ qhf8xq: "f10pi13n",
13
+ Bj3rh1h: "f494woh"
14
+ }
15
+ }, {
16
+ d: [
17
+ ".f10pi13n{position:relative;}",
18
+ ".f494woh{z-index:1000000;}"
19
+ ]
20
+ }); //# sourceMappingURL=usePortalMountNodeStyles.styles.js.map
21
+
22
+ //# sourceMappingURL=usePortalMountNodeStyles.styles.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../../lib/components/Portal/usePortalMountNodeStyles.styles.js"],"sourcesContent":["import { __styles } from '@griffel/react';\nexport const usePortalMountNodeStylesStyles = /*#__PURE__*/__styles({\n root: {\n qhf8xq: \"f10pi13n\",\n Bj3rh1h: \"f494woh\"\n }\n}, {\n d: [\".f10pi13n{position:relative;}\", \".f494woh{z-index:1000000;}\"]\n});\n//# sourceMappingURL=usePortalMountNodeStyles.styles.js.map"],"names":["usePortalMountNodeStylesStyles","__styles","root","qhf8xq","Bj3rh1h","d"],"mappings":";;;;+BACaA;;aAAAA;;uBADY;AAClB,MAAMA,iCAAiC,WAAW,GAAEC,IAAAA,kBAAQ,EAAC;IAClEC,MAAM;QACJC,QAAQ;QACRC,SAAS;IACX;AACF,GAAG;IACDC,GAAG;QAAC;QAAiC;KAA6B;AACpE,IACA,2DAA2D"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@fluentui/react-portal",
3
- "version": "9.2.6",
3
+ "version": "9.2.7",
4
4
  "description": "A utility component that creates portals compatible with Fluent UI",
5
5
  "main": "lib-commonjs/index.js",
6
6
  "module": "lib/index.js",
@@ -31,9 +31,9 @@
31
31
  "@fluentui/scripts-tasks": "*"
32
32
  },
33
33
  "dependencies": {
34
- "@fluentui/react-shared-contexts": "^9.3.3",
35
- "@fluentui/react-tabster": "^9.6.5",
36
- "@fluentui/react-utilities": "^9.8.0",
34
+ "@fluentui/react-shared-contexts": "^9.4.0",
35
+ "@fluentui/react-tabster": "^9.7.0",
36
+ "@fluentui/react-utilities": "^9.8.1",
37
37
  "@griffel/react": "^1.5.2",
38
38
  "@swc/helpers": "^0.4.14",
39
39
  "use-disposable": "^1.0.1"
package/.swcrc DELETED
@@ -1,30 +0,0 @@
1
- {
2
- "$schema": "https://json.schemastore.org/swcrc",
3
- "exclude": [
4
- "/testing",
5
- "/**/*.cy.ts",
6
- "/**/*.cy.tsx",
7
- "/**/*.spec.ts",
8
- "/**/*.spec.tsx",
9
- "/**/*.test.ts",
10
- "/**/*.test.tsx"
11
- ],
12
- "jsc": {
13
- "parser": {
14
- "syntax": "typescript",
15
- "tsx": true,
16
- "decorators": false,
17
- "dynamicImport": false
18
- },
19
- "externalHelpers": true,
20
- "transform": {
21
- "react": {
22
- "runtime": "classic",
23
- "useSpread": true
24
- }
25
- },
26
- "target": "es2019"
27
- },
28
- "minify": false,
29
- "sourceMaps": true
30
- }