@fluentui/react-portal 9.0.0-nightly.d730088d7f.0 → 9.0.0-rc.10

Sign up to get free protection for your applications and to get access to all the features.
Files changed (96) hide show
  1. package/CHANGELOG.json +465 -20
  2. package/CHANGELOG.md +209 -75
  3. package/dist/{react-portal.d.ts → index.d.ts} +11 -11
  4. package/{lib → dist}/tsdoc-metadata.json +0 -0
  5. package/lib/Portal.js.map +1 -1
  6. package/lib/components/Portal/Portal.js +8 -6
  7. package/lib/components/Portal/Portal.js.map +1 -1
  8. package/lib/components/Portal/Portal.types.js.map +1 -1
  9. package/lib/components/Portal/index.js.map +1 -1
  10. package/lib/components/Portal/renderPortal.js +6 -2
  11. package/lib/components/Portal/renderPortal.js.map +1 -1
  12. package/lib/components/Portal/usePortal.js +23 -17
  13. package/lib/components/Portal/usePortal.js.map +1 -1
  14. package/lib/components/Portal/usePortalMountNode.js +27 -21
  15. package/lib/components/Portal/usePortalMountNode.js.map +1 -1
  16. package/lib/index.js +1 -1
  17. package/lib/index.js.map +1 -1
  18. package/lib/virtualParent/elementContains.js +18 -14
  19. package/lib/virtualParent/elementContains.js.map +1 -1
  20. package/lib/virtualParent/getParent.js +2 -1
  21. package/lib/virtualParent/getParent.js.map +1 -1
  22. package/lib/virtualParent/getVirtualParent.js +8 -5
  23. package/lib/virtualParent/getVirtualParent.js.map +1 -1
  24. package/lib/virtualParent/index.js.map +1 -1
  25. package/lib/virtualParent/isVirtualElement.js +1 -1
  26. package/lib/virtualParent/isVirtualElement.js.map +1 -1
  27. package/lib/virtualParent/setVirtualParent.js +11 -8
  28. package/lib/virtualParent/setVirtualParent.js.map +1 -1
  29. package/lib/virtualParent/types.js.map +1 -1
  30. package/lib-commonjs/Portal.js +7 -2
  31. package/lib-commonjs/Portal.js.map +1 -1
  32. package/lib-commonjs/components/Portal/Portal.js +16 -7
  33. package/lib-commonjs/components/Portal/Portal.js.map +1 -1
  34. package/lib-commonjs/components/Portal/Portal.types.js +4 -1
  35. package/lib-commonjs/components/Portal/Portal.types.js.map +1 -1
  36. package/lib-commonjs/components/Portal/index.js +10 -2
  37. package/lib-commonjs/components/Portal/index.js.map +1 -1
  38. package/lib-commonjs/components/Portal/renderPortal.js +18 -7
  39. package/lib-commonjs/components/Portal/renderPortal.js.map +1 -1
  40. package/lib-commonjs/components/Portal/usePortal.js +39 -24
  41. package/lib-commonjs/components/Portal/usePortal.js.map +1 -1
  42. package/lib-commonjs/components/Portal/usePortalMountNode.js +41 -26
  43. package/lib-commonjs/components/Portal/usePortalMountNode.js.map +1 -1
  44. package/lib-commonjs/index.js +41 -7
  45. package/lib-commonjs/index.js.map +1 -1
  46. package/lib-commonjs/virtualParent/elementContains.js +26 -16
  47. package/lib-commonjs/virtualParent/elementContains.js.map +1 -1
  48. package/lib-commonjs/virtualParent/getParent.js +10 -3
  49. package/lib-commonjs/virtualParent/getParent.js.map +1 -1
  50. package/lib-commonjs/virtualParent/getVirtualParent.js +16 -7
  51. package/lib-commonjs/virtualParent/getVirtualParent.js.map +1 -1
  52. package/lib-commonjs/virtualParent/index.js +11 -2
  53. package/lib-commonjs/virtualParent/index.js.map +1 -1
  54. package/lib-commonjs/virtualParent/isVirtualElement.js +7 -2
  55. package/lib-commonjs/virtualParent/isVirtualElement.js.map +1 -1
  56. package/lib-commonjs/virtualParent/setVirtualParent.js +17 -9
  57. package/lib-commonjs/virtualParent/setVirtualParent.js.map +1 -1
  58. package/lib-commonjs/virtualParent/types.js +4 -1
  59. package/lib-commonjs/virtualParent/types.js.map +1 -1
  60. package/package.json +17 -22
  61. package/lib/Portal.d.ts +0 -1
  62. package/lib/common/isConformant.d.ts +0 -4
  63. package/lib/common/isConformant.js +0 -9
  64. package/lib/common/isConformant.js.map +0 -1
  65. package/lib/components/Portal/Portal.d.ts +0 -6
  66. package/lib/components/Portal/Portal.types.d.ts +0 -21
  67. package/lib/components/Portal/index.d.ts +0 -4
  68. package/lib/components/Portal/renderPortal.d.ts +0 -6
  69. package/lib/components/Portal/usePortal.d.ts +0 -9
  70. package/lib/components/Portal/usePortalMountNode.d.ts +0 -10
  71. package/lib/index.d.ts +0 -2
  72. package/lib/virtualParent/elementContains.d.ts +0 -7
  73. package/lib/virtualParent/getParent.d.ts +0 -5
  74. package/lib/virtualParent/getVirtualParent.d.ts +0 -4
  75. package/lib/virtualParent/index.d.ts +0 -5
  76. package/lib/virtualParent/isVirtualElement.d.ts +0 -5
  77. package/lib/virtualParent/setVirtualParent.d.ts +0 -7
  78. package/lib/virtualParent/types.d.ts +0 -5
  79. package/lib-commonjs/Portal.d.ts +0 -1
  80. package/lib-commonjs/common/isConformant.d.ts +0 -4
  81. package/lib-commonjs/common/isConformant.js +0 -13
  82. package/lib-commonjs/common/isConformant.js.map +0 -1
  83. package/lib-commonjs/components/Portal/Portal.d.ts +0 -6
  84. package/lib-commonjs/components/Portal/Portal.types.d.ts +0 -21
  85. package/lib-commonjs/components/Portal/index.d.ts +0 -4
  86. package/lib-commonjs/components/Portal/renderPortal.d.ts +0 -6
  87. package/lib-commonjs/components/Portal/usePortal.d.ts +0 -9
  88. package/lib-commonjs/components/Portal/usePortalMountNode.d.ts +0 -10
  89. package/lib-commonjs/index.d.ts +0 -2
  90. package/lib-commonjs/virtualParent/elementContains.d.ts +0 -7
  91. package/lib-commonjs/virtualParent/getParent.d.ts +0 -5
  92. package/lib-commonjs/virtualParent/getVirtualParent.d.ts +0 -4
  93. package/lib-commonjs/virtualParent/index.d.ts +0 -5
  94. package/lib-commonjs/virtualParent/isVirtualElement.d.ts +0 -5
  95. package/lib-commonjs/virtualParent/setVirtualParent.d.ts +0 -7
  96. package/lib-commonjs/virtualParent/types.d.ts +0 -5
@@ -1,33 +1,48 @@
1
1
  "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.usePortal = void 0;
4
- var React = require("react");
5
- var react_utilities_1 = require("@fluentui/react-utilities");
6
- var usePortalMountNode_1 = require("./usePortalMountNode");
7
- var index_1 = require("../../virtualParent/index");
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.usePortal_unstable = void 0;
7
+
8
+ const React = /*#__PURE__*/require("react");
9
+
10
+ const react_utilities_1 = /*#__PURE__*/require("@fluentui/react-utilities");
11
+
12
+ const usePortalMountNode_1 = /*#__PURE__*/require("./usePortalMountNode");
13
+
14
+ const index_1 = /*#__PURE__*/require("../../virtualParent/index");
8
15
  /**
9
16
  * Create the state required to render Portal.
10
17
  *
11
- * The returned state can be modified with hooks such as usePortalStyles, before being passed to renderPortal.
18
+ * The returned state can be modified with hooks such as usePortalStyles, before being passed to renderPortal_unstable.
12
19
  *
13
20
  * @param props - props from this instance of Portal
14
21
  */
15
- var usePortal = function (props) {
16
- var children = props.children, mountNode = props.mountNode;
17
- var virtualParentRootRef = React.useRef(null);
18
- var fallbackMountNode = usePortalMountNode_1.usePortalMountNode({ disabled: !!mountNode });
19
- var state = {
20
- children: children,
21
- mountNode: mountNode !== null && mountNode !== void 0 ? mountNode : fallbackMountNode,
22
- shouldRender: !react_utilities_1.useIsSSR(),
23
- virtualParentRootRef: virtualParentRootRef,
24
- };
25
- React.useEffect(function () {
26
- if (state.virtualParentRootRef.current && state.mountNode) {
27
- index_1.setVirtualParent(state.mountNode, state.virtualParentRootRef.current);
28
- }
29
- }, [state.virtualParentRootRef, state.mountNode]);
30
- return state;
22
+
23
+
24
+ const usePortal_unstable = props => {
25
+ const {
26
+ children,
27
+ mountNode
28
+ } = props;
29
+ const virtualParentRootRef = React.useRef(null);
30
+ const fallbackMountNode = usePortalMountNode_1.usePortalMountNode({
31
+ disabled: !!mountNode
32
+ });
33
+ const state = {
34
+ children,
35
+ mountNode: mountNode !== null && mountNode !== void 0 ? mountNode : fallbackMountNode,
36
+ shouldRender: !react_utilities_1.useIsSSR(),
37
+ virtualParentRootRef
38
+ };
39
+ React.useEffect(() => {
40
+ if (state.virtualParentRootRef.current && state.mountNode) {
41
+ index_1.setVirtualParent(state.mountNode, state.virtualParentRootRef.current);
42
+ }
43
+ }, [state.virtualParentRootRef, state.mountNode]);
44
+ return state;
31
45
  };
32
- exports.usePortal = usePortal;
46
+
47
+ exports.usePortal_unstable = usePortal_unstable;
33
48
  //# sourceMappingURL=usePortal.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"usePortal.js","sourceRoot":"","sources":["../../../src/components/Portal/usePortal.ts"],"names":[],"mappings":";;;AAAA,6BAA+B;AAC/B,6DAAqD;AACrD,2DAA0D;AAC1D,mDAA6D;AAG7D;;;;;;GAMG;AACI,IAAM,SAAS,GAAG,UAAC,KAAkB;IAClC,IAAA,QAAQ,GAAgB,KAAK,SAArB,EAAE,SAAS,GAAK,KAAK,UAAV,CAAW;IAEtC,IAAM,oBAAoB,GAAG,KAAK,CAAC,MAAM,CAAkB,IAAI,CAAC,CAAC;IACjE,IAAM,iBAAiB,GAAG,uCAAkB,CAAC,EAAE,QAAQ,EAAE,CAAC,CAAC,SAAS,EAAE,CAAC,CAAC;IAExE,IAAM,KAAK,GAAgB;QACzB,QAAQ,UAAA;QACR,SAAS,EAAE,SAAS,aAAT,SAAS,cAAT,SAAS,GAAI,iBAAiB;QACzC,YAAY,EAAE,CAAC,0BAAQ,EAAE;QACzB,oBAAoB,sBAAA;KACrB,CAAC;IAEF,KAAK,CAAC,SAAS,CAAC;QACd,IAAI,KAAK,CAAC,oBAAoB,CAAC,OAAO,IAAI,KAAK,CAAC,SAAS,EAAE;YACzD,wBAAgB,CAAC,KAAK,CAAC,SAAS,EAAE,KAAK,CAAC,oBAAoB,CAAC,OAAO,CAAC,CAAC;SACvE;IACH,CAAC,EAAE,CAAC,KAAK,CAAC,oBAAoB,EAAE,KAAK,CAAC,SAAS,CAAC,CAAC,CAAC;IAElD,OAAO,KAAK,CAAC;AACf,CAAC,CAAC;AApBW,QAAA,SAAS,aAoBpB"}
1
+ {"version":3,"sources":["components/Portal/usePortal.ts"],"names":[],"mappings":";;;;;;;AAAA,MAAA,KAAA,gBAAA,OAAA,CAAA,OAAA,CAAA;;AACA,MAAA,iBAAA,gBAAA,OAAA,CAAA,2BAAA,CAAA;;AACA,MAAA,oBAAA,gBAAA,OAAA,CAAA,sBAAA,CAAA;;AACA,MAAA,OAAA,gBAAA,OAAA,CAAA,2BAAA,CAAA;AAGA;;;;;;AAMG;;;AACI,MAAM,kBAAkB,GAAI,KAAD,IAAoC;AACpE,QAAM;AAAE,IAAA,QAAF;AAAY,IAAA;AAAZ,MAA0B,KAAhC;AAEA,QAAM,oBAAoB,GAAG,KAAK,CAAC,MAAN,CAA8B,IAA9B,CAA7B;AACA,QAAM,iBAAiB,GAAG,oBAAA,CAAA,kBAAA,CAAmB;AAAE,IAAA,QAAQ,EAAE,CAAC,CAAC;AAAd,GAAnB,CAA1B;AAEA,QAAM,KAAK,GAAgB;AACzB,IAAA,QADyB;AAEzB,IAAA,SAAS,EAAE,SAAS,KAAA,IAAT,IAAA,SAAS,KAAA,KAAA,CAAT,GAAA,SAAA,GAAa,iBAFC;AAGzB,IAAA,YAAY,EAAE,CAAC,iBAAA,CAAA,QAAA,EAHU;AAIzB,IAAA;AAJyB,GAA3B;AAOA,EAAA,KAAK,CAAC,SAAN,CAAgB,MAAK;AACnB,QAAI,KAAK,CAAC,oBAAN,CAA2B,OAA3B,IAAsC,KAAK,CAAC,SAAhD,EAA2D;AACzD,MAAA,OAAA,CAAA,gBAAA,CAAiB,KAAK,CAAC,SAAvB,EAAkC,KAAK,CAAC,oBAAN,CAA2B,OAA7D;AACD;AACF,GAJD,EAIG,CAAC,KAAK,CAAC,oBAAP,EAA6B,KAAK,CAAC,SAAnC,CAJH;AAMA,SAAO,KAAP;AACD,CApBM;;AAAM,OAAA,CAAA,kBAAA,GAAkB,kBAAlB","sourcesContent":["import * as React from 'react';\nimport { useIsSSR } from '@fluentui/react-utilities';\nimport { usePortalMountNode } from './usePortalMountNode';\nimport { setVirtualParent } from '../../virtualParent/index';\nimport type { PortalProps, PortalState } from './Portal.types';\n\n/**\n * Create the state required to render Portal.\n *\n * The returned state can be modified with hooks such as usePortalStyles, before being passed to renderPortal_unstable.\n *\n * @param props - props from this instance of Portal\n */\nexport const usePortal_unstable = (props: PortalProps): PortalState => {\n const { children, mountNode } = props;\n\n const virtualParentRootRef = React.useRef<HTMLSpanElement>(null);\n const fallbackMountNode = usePortalMountNode({ disabled: !!mountNode });\n\n const state: PortalState = {\n children,\n mountNode: mountNode ?? fallbackMountNode,\n shouldRender: !useIsSSR(),\n virtualParentRootRef,\n };\n\n React.useEffect(() => {\n if (state.virtualParentRootRef.current && state.mountNode) {\n setVirtualParent(state.mountNode, state.virtualParentRootRef.current);\n }\n }, [state.virtualParentRootRef, state.mountNode]);\n\n return state;\n};\n"],"sourceRoot":"../src/"}
@@ -1,34 +1,49 @@
1
1
  "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
3
6
  exports.usePortalMountNode = void 0;
4
- var React = require("react");
5
- var react_utilities_1 = require("@fluentui/react-utilities");
6
- var react_shared_contexts_1 = require("@fluentui/react-shared-contexts");
7
- var react_tabster_1 = require("@fluentui/react-tabster");
7
+
8
+ const React = /*#__PURE__*/require("react");
9
+
10
+ const react_utilities_1 = /*#__PURE__*/require("@fluentui/react-utilities");
11
+
12
+ const react_shared_contexts_1 = /*#__PURE__*/require("@fluentui/react-shared-contexts");
13
+
14
+ const react_tabster_1 = /*#__PURE__*/require("@fluentui/react-tabster");
8
15
  /**
9
16
  * Creates a new element on a document.body to mount portals
10
17
  */
11
- var usePortalMountNode = function (options) {
12
- var themeClassName = react_shared_contexts_1.useThemeClassName();
13
- var _a = react_shared_contexts_1.useFluent(), targetDocument = _a.targetDocument, dir = _a.dir;
14
- var element = React.useMemo(function () {
15
- if (targetDocument === undefined || options.disabled) {
16
- return undefined;
17
- }
18
- var newElement = targetDocument.createElement('div');
19
- newElement.setAttribute('class', themeClassName);
20
- newElement.setAttribute('dir', dir);
21
- targetDocument.body.appendChild(newElement);
22
- return newElement;
23
- }, [targetDocument, themeClassName, dir, options.disabled]);
24
- react_tabster_1.useKeyboardNavAttribute().current = element;
25
- react_utilities_1.useIsomorphicLayoutEffect(function () {
26
- return function () {
27
- var _a;
28
- (_a = element === null || element === void 0 ? void 0 : element.parentElement) === null || _a === void 0 ? void 0 : _a.removeChild(element);
29
- };
30
- }, [element]);
31
- return element;
18
+
19
+
20
+ const usePortalMountNode = options => {
21
+ const themeClassName = react_shared_contexts_1.useThemeClassName();
22
+ const {
23
+ targetDocument,
24
+ dir
25
+ } = react_shared_contexts_1.useFluent();
26
+ const element = React.useMemo(() => {
27
+ if (targetDocument === undefined || options.disabled) {
28
+ return null;
29
+ }
30
+
31
+ const newElement = targetDocument.createElement('div');
32
+ newElement.setAttribute('class', themeClassName);
33
+ newElement.setAttribute('dir', dir);
34
+ targetDocument.body.appendChild(newElement);
35
+ return newElement;
36
+ }, [targetDocument, themeClassName, dir, options.disabled]);
37
+ react_tabster_1.useKeyboardNavAttribute().current = element;
38
+ react_utilities_1.useIsomorphicLayoutEffect(() => {
39
+ return () => {
40
+ var _a;
41
+
42
+ (_a = element === null || element === void 0 ? void 0 : element.parentElement) === null || _a === void 0 ? void 0 : _a.removeChild(element);
43
+ };
44
+ }, [element]);
45
+ return element;
32
46
  };
47
+
33
48
  exports.usePortalMountNode = usePortalMountNode;
34
49
  //# sourceMappingURL=usePortalMountNode.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"usePortalMountNode.js","sourceRoot":"","sources":["../../../src/components/Portal/usePortalMountNode.ts"],"names":[],"mappings":";;;AAAA,6BAA+B;AAC/B,6DAAsE;AACtE,yEAA+E;AAC/E,yDAAkE;AASlE;;GAEG;AACI,IAAM,kBAAkB,GAAG,UAAC,OAAkC;IACnE,IAAM,cAAc,GAAG,yCAAiB,EAAE,CAAC;IACrC,IAAA,KAA0B,iCAAS,EAAE,EAAnC,cAAc,oBAAA,EAAE,GAAG,SAAgB,CAAC;IAE5C,IAAM,OAAO,GAAG,KAAK,CAAC,OAAO,CAAC;QAC5B,IAAI,cAAc,KAAK,SAAS,IAAI,OAAO,CAAC,QAAQ,EAAE;YACpD,OAAO,SAAS,CAAC;SAClB;QAED,IAAM,UAAU,GAAG,cAAc,CAAC,aAAa,CAAC,KAAK,CAAC,CAAC;QACvD,UAAU,CAAC,YAAY,CAAC,OAAO,EAAE,cAAc,CAAC,CAAC;QACjD,UAAU,CAAC,YAAY,CAAC,KAAK,EAAE,GAAG,CAAC,CAAC;QACpC,cAAc,CAAC,IAAI,CAAC,WAAW,CAAC,UAAU,CAAC,CAAC;QAE5C,OAAO,UAAU,CAAC;IACpB,CAAC,EAAE,CAAC,cAAc,EAAE,cAAc,EAAE,GAAG,EAAE,OAAO,CAAC,QAAQ,CAAC,CAAC,CAAC;IAE3D,uCAAuB,EAA0C,CAAC,OAAO,GAAG,OAAQ,CAAC;IAEtF,2CAAyB,CAAC;QACxB,OAAO;;YACL,MAAA,OAAO,aAAP,OAAO,uBAAP,OAAO,CAAE,aAAa,0CAAE,WAAW,CAAC,OAAO,EAAE;QAC/C,CAAC,CAAC;IACJ,CAAC,EAAE,CAAC,OAAO,CAAC,CAAC,CAAC;IAEd,OAAO,OAAO,CAAC;AACjB,CAAC,CAAC;AA1BW,QAAA,kBAAkB,sBA0B7B"}
1
+ {"version":3,"sources":["components/Portal/usePortalMountNode.ts"],"names":[],"mappings":";;;;;;;AAAA,MAAA,KAAA,gBAAA,OAAA,CAAA,OAAA,CAAA;;AACA,MAAA,iBAAA,gBAAA,OAAA,CAAA,2BAAA,CAAA;;AACA,MAAA,uBAAA,gBAAA,OAAA,CAAA,iCAAA,CAAA;;AACA,MAAA,eAAA,gBAAA,OAAA,CAAA,yBAAA,CAAA;AASA;;AAEG;;;AACI,MAAM,kBAAkB,GAAI,OAAD,IAA2D;AAC3F,QAAM,cAAc,GAAG,uBAAA,CAAA,iBAAA,EAAvB;AACA,QAAM;AAAE,IAAA,cAAF;AAAkB,IAAA;AAAlB,MAA0B,uBAAA,CAAA,SAAA,EAAhC;AAEA,QAAM,OAAO,GAAG,KAAK,CAAC,OAAN,CAAc,MAAK;AACjC,QAAI,cAAc,KAAK,SAAnB,IAAgC,OAAO,CAAC,QAA5C,EAAsD;AACpD,aAAO,IAAP;AACD;;AAED,UAAM,UAAU,GAAG,cAAc,CAAC,aAAf,CAA6B,KAA7B,CAAnB;AACA,IAAA,UAAU,CAAC,YAAX,CAAwB,OAAxB,EAAiC,cAAjC;AACA,IAAA,UAAU,CAAC,YAAX,CAAwB,KAAxB,EAA+B,GAA/B;AACA,IAAA,cAAc,CAAC,IAAf,CAAoB,WAApB,CAAgC,UAAhC;AAEA,WAAO,UAAP;AACD,GAXe,EAWb,CAAC,cAAD,EAAiB,cAAjB,EAAiC,GAAjC,EAAsC,OAAO,CAAC,QAA9C,CAXa,CAAhB;AAaC,EAAA,eAAA,CAAA,uBAAA,GAAkE,OAAlE,GAA4E,OAA5E;AAED,EAAA,iBAAA,CAAA,yBAAA,CAA0B,MAAK;AAC7B,WAAO,MAAK;;;AACV,OAAA,EAAA,GAAA,OAAO,KAAA,IAAP,IAAA,OAAO,KAAA,KAAA,CAAP,GAAO,KAAA,CAAP,GAAA,OAAO,CAAE,aAAT,MAAsB,IAAtB,IAAsB,EAAA,KAAA,KAAA,CAAtB,GAAsB,KAAA,CAAtB,GAAsB,EAAA,CAAE,WAAF,CAAc,OAAd,CAAtB;AACD,KAFD;AAGD,GAJD,EAIG,CAAC,OAAD,CAJH;AAMA,SAAO,OAAP;AACD,CA1BM;;AAAM,OAAA,CAAA,kBAAA,GAAkB,kBAAlB","sourcesContent":["import * as React from 'react';\nimport { useIsomorphicLayoutEffect } from '@fluentui/react-utilities';\nimport { useThemeClassName, useFluent } from '@fluentui/react-shared-contexts';\nimport { useKeyboardNavAttribute } from '@fluentui/react-tabster';\n\nexport type UsePortalMountNodeOptions = {\n /**\n * Since hooks cannot be called conditionally use this flag to disable creating the node\n */\n disabled?: boolean;\n};\n\n/**\n * Creates a new element on a document.body to mount portals\n */\nexport const usePortalMountNode = (options: UsePortalMountNodeOptions): HTMLElement | null => {\n const themeClassName = useThemeClassName();\n const { targetDocument, dir } = useFluent();\n\n const element = React.useMemo(() => {\n if (targetDocument === undefined || options.disabled) {\n return null;\n }\n\n const newElement = targetDocument.createElement('div');\n newElement.setAttribute('class', themeClassName);\n newElement.setAttribute('dir', dir);\n targetDocument.body.appendChild(newElement);\n\n return newElement;\n }, [targetDocument, themeClassName, dir, options.disabled]);\n\n (useKeyboardNavAttribute() as React.MutableRefObject<HTMLElement>).current = element!;\n\n useIsomorphicLayoutEffect(() => {\n return () => {\n element?.parentElement?.removeChild(element);\n };\n }, [element]);\n\n return element;\n};\n"],"sourceRoot":"../src/"}
@@ -1,9 +1,43 @@
1
1
  "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.setVirtualParent = exports.elementContains = void 0;
4
- var tslib_1 = require("tslib");
5
- tslib_1.__exportStar(require("./components/Portal/index"), exports);
6
- var index_1 = require("./virtualParent/index");
7
- Object.defineProperty(exports, "elementContains", { enumerable: true, get: function () { return index_1.elementContains; } });
8
- Object.defineProperty(exports, "setVirtualParent", { enumerable: true, get: function () { return index_1.setVirtualParent; } });
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.setVirtualParent = exports.elementContains = exports.usePortal_unstable = exports.renderPortal_unstable = exports.Portal = void 0;
7
+
8
+ var index_1 = /*#__PURE__*/require("./components/Portal/index");
9
+
10
+ Object.defineProperty(exports, "Portal", {
11
+ enumerable: true,
12
+ get: function () {
13
+ return index_1.Portal;
14
+ }
15
+ });
16
+ Object.defineProperty(exports, "renderPortal_unstable", {
17
+ enumerable: true,
18
+ get: function () {
19
+ return index_1.renderPortal_unstable;
20
+ }
21
+ });
22
+ Object.defineProperty(exports, "usePortal_unstable", {
23
+ enumerable: true,
24
+ get: function () {
25
+ return index_1.usePortal_unstable;
26
+ }
27
+ });
28
+
29
+ var index_2 = /*#__PURE__*/require("./virtualParent/index");
30
+
31
+ Object.defineProperty(exports, "elementContains", {
32
+ enumerable: true,
33
+ get: function () {
34
+ return index_2.elementContains;
35
+ }
36
+ });
37
+ Object.defineProperty(exports, "setVirtualParent", {
38
+ enumerable: true,
39
+ get: function () {
40
+ return index_2.setVirtualParent;
41
+ }
42
+ });
9
43
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;;AAAA,oEAA0C;AAC1C,+CAA0E;AAAjE,wGAAA,eAAe,OAAA;AAAE,yGAAA,gBAAgB,OAAA"}
1
+ {"version":3,"sources":["index.ts"],"names":[],"mappings":";;;;;;;AAAA,IAAA,OAAA,gBAAA,OAAA,CAAA,2BAAA,CAAA;;AAAS,MAAA,CAAA,cAAA,CAAA,OAAA,EAAA,QAAA,EAAA;AAAA,EAAA,UAAA,EAAA,IAAA;AAAA,EAAA,GAAA,EAAA,YAAA;AAAA,WAAA,OAAA,CAAA,MAAA;AAAM;AAAN,CAAA;AAAQ,MAAA,CAAA,cAAA,CAAA,OAAA,EAAA,uBAAA,EAAA;AAAA,EAAA,UAAA,EAAA,IAAA;AAAA,EAAA,GAAA,EAAA,YAAA;AAAA,WAAA,OAAA,CAAA,qBAAA;AAAqB;AAArB,CAAA;AAAuB,MAAA,CAAA,cAAA,CAAA,OAAA,EAAA,oBAAA,EAAA;AAAA,EAAA,UAAA,EAAA,IAAA;AAAA,EAAA,GAAA,EAAA,YAAA;AAAA,WAAA,OAAA,CAAA,kBAAA;AAAkB;AAAlB,CAAA;;AAExC,IAAA,OAAA,gBAAA,OAAA,CAAA,uBAAA,CAAA;;AAAS,MAAA,CAAA,cAAA,CAAA,OAAA,EAAA,iBAAA,EAAA;AAAA,EAAA,UAAA,EAAA,IAAA;AAAA,EAAA,GAAA,EAAA,YAAA;AAAA,WAAA,OAAA,CAAA,eAAA;AAAe;AAAf,CAAA;AAAiB,MAAA,CAAA,cAAA,CAAA,OAAA,EAAA,kBAAA,EAAA;AAAA,EAAA,UAAA,EAAA,IAAA;AAAA,EAAA,GAAA,EAAA,YAAA;AAAA,WAAA,OAAA,CAAA,gBAAA;AAAgB;AAAhB,CAAA","sourcesContent":["export { 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,30 +1,40 @@
1
1
  "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
3
6
  exports.elementContains = void 0;
4
- var getParent_1 = require("./getParent");
7
+
8
+ const getParent_1 = /*#__PURE__*/require("./getParent");
5
9
  /**
6
10
  * Similar functionality to `element.contains` DOM API for use with out of order DOM elements that
7
11
  * checks the virtual parent hierarchy. If a virtual parents exists, it is chosen over the actual parent
8
12
  *
9
13
  * @returns true if the child can find the parent in its virtual hierarchy
10
14
  */
15
+
16
+
11
17
  function elementContains(parent, child) {
12
- if (!parent || !child) {
13
- return false;
14
- }
15
- if (parent === child) {
18
+ if (!parent || !child) {
19
+ return false;
20
+ }
21
+
22
+ if (parent === child) {
23
+ return true;
24
+ } else {
25
+ while (child) {
26
+ const nextParent = getParent_1.getParent(child);
27
+
28
+ if (nextParent === parent) {
16
29
  return true;
30
+ }
31
+
32
+ child = nextParent;
17
33
  }
18
- else {
19
- while (child) {
20
- var nextParent = getParent_1.getParent(child);
21
- if (nextParent === parent) {
22
- return true;
23
- }
24
- child = nextParent;
25
- }
26
- }
27
- return false;
34
+ }
35
+
36
+ return false;
28
37
  }
38
+
29
39
  exports.elementContains = elementContains;
30
40
  //# sourceMappingURL=elementContains.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"elementContains.js","sourceRoot":"","sources":["../../src/virtualParent/elementContains.ts"],"names":[],"mappings":";;;AAAA,yCAAwC;AACxC;;;;;GAKG;AACH,SAAgB,eAAe,CAAC,MAA0B,EAAE,KAAyB;IACnF,IAAI,CAAC,MAAM,IAAI,CAAC,KAAK,EAAE;QACrB,OAAO,KAAK,CAAC;KACd;IAED,IAAI,MAAM,KAAK,KAAK,EAAE;QACpB,OAAO,IAAI,CAAC;KACb;SAAM;QACL,OAAO,KAAK,EAAE;YACZ,IAAM,UAAU,GAAuB,qBAAS,CAAC,KAAK,CAAC,CAAC;YAExD,IAAI,UAAU,KAAK,MAAM,EAAE;gBACzB,OAAO,IAAI,CAAC;aACb;YAED,KAAK,GAAG,UAAU,CAAC;SACpB;KACF;IAED,OAAO,KAAK,CAAC;AACf,CAAC;AApBD,0CAoBC"}
1
+ {"version":3,"sources":["virtualParent/elementContains.ts"],"names":[],"mappings":";;;;;;;AAAA,MAAA,WAAA,gBAAA,OAAA,CAAA,aAAA,CAAA;AACA;;;;;AAKG;;;AACH,SAAgB,eAAhB,CAAgC,MAAhC,EAA4D,KAA5D,EAAqF;AACnF,MAAI,CAAC,MAAD,IAAW,CAAC,KAAhB,EAAuB;AACrB,WAAO,KAAP;AACD;;AAED,MAAI,MAAM,KAAK,KAAf,EAAsB;AACpB,WAAO,IAAP;AACD,GAFD,MAEO;AACL,WAAO,KAAP,EAAc;AACZ,YAAM,UAAU,GAAuB,WAAA,CAAA,SAAA,CAAU,KAAV,CAAvC;;AAEA,UAAI,UAAU,KAAK,MAAnB,EAA2B;AACzB,eAAO,IAAP;AACD;;AAED,MAAA,KAAK,GAAG,UAAR;AACD;AACF;;AAED,SAAO,KAAP;AACD;;AApBD,OAAA,CAAA,eAAA,GAAA,eAAA","sourcesContent":["import { getParent } from './getParent';\n/**\n * Similar functionality to `element.contains` DOM API for use with out of order DOM elements that\n * checks the virtual parent hierarchy. If a virtual parents exists, it is chosen over the actual parent\n *\n * @returns true if the child can find the parent in its virtual hierarchy\n */\nexport function elementContains(parent: HTMLElement | null, child: HTMLElement | null): boolean {\n if (!parent || !child) {\n return false;\n }\n\n if (parent === child) {\n return true;\n } else {\n while (child) {\n const nextParent: HTMLElement | null = getParent(child);\n\n if (nextParent === parent) {\n return true;\n }\n\n child = nextParent;\n }\n }\n\n return false;\n}\n"],"sourceRoot":"../src/"}
@@ -1,13 +1,20 @@
1
1
  "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
3
6
  exports.getParent = void 0;
4
- var getVirtualParent_1 = require("./getVirtualParent");
7
+
8
+ const getVirtualParent_1 = /*#__PURE__*/require("./getVirtualParent");
5
9
  /**
6
10
  * Gets the element which is the parent of a given element.
7
11
  * This method prefers the virtual parent over real DOM parent when present.
8
12
  */
13
+
14
+
9
15
  function getParent(child) {
10
- return (child && getVirtualParent_1.getVirtualParent(child)) || (child === null || child === void 0 ? void 0 : child.parentNode);
16
+ return child && getVirtualParent_1.getVirtualParent(child) || (child === null || child === void 0 ? void 0 : child.parentNode);
11
17
  }
18
+
12
19
  exports.getParent = getParent;
13
20
  //# sourceMappingURL=getParent.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"getParent.js","sourceRoot":"","sources":["../../src/virtualParent/getParent.ts"],"names":[],"mappings":";;;AAAA,uDAAsD;AAEtD;;;GAGG;AACH,SAAgB,SAAS,CAAC,KAAyB;IACjD,OAAO,CAAC,KAAK,IAAI,mCAAgB,CAAC,KAAK,CAAC,CAAC,KAAK,KAAK,aAAL,KAAK,uBAAL,KAAK,CAAE,UAAiC,CAAA,CAAC;AACzF,CAAC;AAFD,8BAEC"}
1
+ {"version":3,"sources":["virtualParent/getParent.ts"],"names":[],"mappings":";;;;;;;AAAA,MAAA,kBAAA,gBAAA,OAAA,CAAA,oBAAA,CAAA;AAEA;;;AAGG;;;AACH,SAAgB,SAAhB,CAA0B,KAA1B,EAAmD;AACjD,SAAQ,KAAK,IAAI,kBAAA,CAAA,gBAAA,CAAiB,KAAjB,CAAV,KAAuC,KAAK,KAAA,IAAL,IAAA,KAAK,KAAA,KAAA,CAAL,GAAK,KAAA,CAAL,GAAA,KAAK,CAAE,UAA9C,CAAP;AACD;;AAFD,OAAA,CAAA,SAAA,GAAA,SAAA","sourcesContent":["import { getVirtualParent } from './getVirtualParent';\n\n/**\n * Gets the element which is the parent of a given element.\n * This method prefers the virtual parent over real DOM parent when present.\n */\nexport function getParent(child: HTMLElement | null): HTMLElement | null {\n return (child && getVirtualParent(child)) || (child?.parentNode as HTMLElement | null);\n}\n"],"sourceRoot":"../src/"}
@@ -1,16 +1,25 @@
1
1
  "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
3
6
  exports.getVirtualParent = void 0;
4
- var isVirtualElement_1 = require("./isVirtualElement");
7
+
8
+ const isVirtualElement_1 = /*#__PURE__*/require("./isVirtualElement");
5
9
  /**
6
10
  * Gets the virtual parent given the child element, if it exists.
7
11
  */
12
+
13
+
8
14
  function getVirtualParent(child) {
9
- var parent;
10
- if (isVirtualElement_1.isVirtualElement(child)) {
11
- parent = child._virtual.parent;
12
- }
13
- return parent;
15
+ let parent;
16
+
17
+ if (isVirtualElement_1.isVirtualElement(child)) {
18
+ parent = child._virtual.parent;
19
+ }
20
+
21
+ return parent;
14
22
  }
23
+
15
24
  exports.getVirtualParent = getVirtualParent;
16
25
  //# sourceMappingURL=getVirtualParent.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"getVirtualParent.js","sourceRoot":"","sources":["../../src/virtualParent/getVirtualParent.ts"],"names":[],"mappings":";;;AAAA,uDAAsD;AACtD;;GAEG;AACH,SAAgB,gBAAgB,CAAC,KAAkB;IACjD,IAAI,MAA+B,CAAC;IACpC,IAAI,mCAAgB,CAAC,KAAK,CAAC,EAAE;QAC3B,MAAM,GAAG,KAAK,CAAC,QAAQ,CAAC,MAAM,CAAC;KAChC;IACD,OAAO,MAAM,CAAC;AAChB,CAAC;AAND,4CAMC"}
1
+ {"version":3,"sources":["virtualParent/getVirtualParent.ts"],"names":[],"mappings":";;;;;;;AAAA,MAAA,kBAAA,gBAAA,OAAA,CAAA,oBAAA,CAAA;AACA;;AAEG;;;AACH,SAAgB,gBAAhB,CAAiC,KAAjC,EAAmD;AACjD,MAAI,MAAJ;;AACA,MAAI,kBAAA,CAAA,gBAAA,CAAiB,KAAjB,CAAJ,EAA6B;AAC3B,IAAA,MAAM,GAAG,KAAK,CAAC,QAAN,CAAe,MAAxB;AACD;;AACD,SAAO,MAAP;AACD;;AAND,OAAA,CAAA,gBAAA,GAAA,gBAAA","sourcesContent":["import { isVirtualElement } from './isVirtualElement';\n/**\n * Gets the virtual parent given the child element, if it exists.\n */\nexport function getVirtualParent(child: HTMLElement): HTMLElement | undefined {\n let parent: HTMLElement | undefined;\n if (isVirtualElement(child)) {\n parent = child._virtual.parent;\n }\n return parent;\n}\n"],"sourceRoot":"../src/"}
@@ -1,9 +1,18 @@
1
1
  "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- var tslib_1 = require("tslib");
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+
7
+ const tslib_1 = /*#__PURE__*/require("tslib");
8
+
4
9
  tslib_1.__exportStar(require("./elementContains"), exports);
10
+
5
11
  tslib_1.__exportStar(require("./getParent"), exports);
12
+
6
13
  tslib_1.__exportStar(require("./getVirtualParent"), exports);
14
+
7
15
  tslib_1.__exportStar(require("./isVirtualElement"), exports);
16
+
8
17
  tslib_1.__exportStar(require("./setVirtualParent"), exports);
9
18
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/virtualParent/index.ts"],"names":[],"mappings":";;;AAAA,4DAAkC;AAClC,sDAA4B;AAC5B,6DAAmC;AACnC,6DAAmC;AACnC,6DAAmC"}
1
+ {"version":3,"sources":["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,11 +1,16 @@
1
1
  "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
3
6
  exports.isVirtualElement = void 0;
4
7
  /**
5
8
  * Determines whether or not an element has the virtual hierarchy extension.
6
9
  */
10
+
7
11
  function isVirtualElement(element) {
8
- return element && !!element._virtual;
12
+ return element && !!element._virtual;
9
13
  }
14
+
10
15
  exports.isVirtualElement = isVirtualElement;
11
16
  //# sourceMappingURL=isVirtualElement.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"isVirtualElement.js","sourceRoot":"","sources":["../../src/virtualParent/isVirtualElement.ts"],"names":[],"mappings":";;;AAEA;;GAEG;AACH,SAAgB,gBAAgB,CAAC,OAAqC;IACpE,OAAO,OAAO,IAAI,CAAC,CAAkB,OAAQ,CAAC,QAAQ,CAAC;AACzD,CAAC;AAFD,4CAEC"}
1
+ {"version":3,"sources":["virtualParent/isVirtualElement.ts"],"names":[],"mappings":";;;;;;AAEA;;AAEG;;AACH,SAAgB,gBAAhB,CAAiC,OAAjC,EAAsE;AACpE,SAAO,OAAO,IAAI,CAAC,CAAkB,OAAQ,CAAC,QAA9C;AACD;;AAFD,OAAA,CAAA,gBAAA,GAAA,gBAAA","sourcesContent":["import type { VirtualElement } from './types';\n\n/**\n * Determines whether or not an element has the virtual hierarchy extension.\n */\nexport function isVirtualElement(element: HTMLElement | VirtualElement): element is VirtualElement {\n return element && !!(<VirtualElement>element)._virtual;\n}\n"],"sourceRoot":"../src/"}
@@ -1,5 +1,8 @@
1
1
  "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
3
6
  exports.setVirtualParent = void 0;
4
7
  /**
5
8
  * Sets the virtual parent of an element.
@@ -7,15 +10,20 @@ exports.setVirtualParent = void 0;
7
10
  * @param child - Theme element to set the virtual parent
8
11
  * @param parent - The virtual parent, use `undefined` to remove a virtual parent relationship
9
12
  */
13
+
10
14
  function setVirtualParent(child, parent) {
11
- if (!child) {
12
- return;
13
- }
14
- var virtualChild = child;
15
- if (!virtualChild._virtual) {
16
- virtualChild._virtual = {};
17
- }
18
- virtualChild._virtual.parent = parent || undefined;
15
+ if (!child) {
16
+ return;
17
+ }
18
+
19
+ const virtualChild = child;
20
+
21
+ if (!virtualChild._virtual) {
22
+ virtualChild._virtual = {};
23
+ }
24
+
25
+ virtualChild._virtual.parent = parent || undefined;
19
26
  }
27
+
20
28
  exports.setVirtualParent = setVirtualParent;
21
29
  //# sourceMappingURL=setVirtualParent.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"setVirtualParent.js","sourceRoot":"","sources":["../../src/virtualParent/setVirtualParent.ts"],"names":[],"mappings":";;;AAEA;;;;;GAKG;AACH,SAAgB,gBAAgB,CAAC,KAAkB,EAAE,MAAoB;IACvE,IAAI,CAAC,KAAK,EAAE;QACV,OAAO;KACR;IAED,IAAM,YAAY,GAAmB,KAAK,CAAC;IAE3C,IAAI,CAAC,YAAY,CAAC,QAAQ,EAAE;QAC1B,YAAY,CAAC,QAAQ,GAAG,EAAE,CAAC;KAC5B;IAED,YAAY,CAAC,QAAQ,CAAC,MAAM,GAAG,MAAM,IAAI,SAAS,CAAC;AACrD,CAAC;AAZD,4CAYC"}
1
+ {"version":3,"sources":["virtualParent/setVirtualParent.ts"],"names":[],"mappings":";;;;;;AAEA;;;;;AAKG;;AACH,SAAgB,gBAAhB,CAAiC,KAAjC,EAAqD,MAArD,EAAyE;AACvE,MAAI,CAAC,KAAL,EAAY;AACV;AACD;;AAED,QAAM,YAAY,GAAmB,KAArC;;AAEA,MAAI,CAAC,YAAY,CAAC,QAAlB,EAA4B;AAC1B,IAAA,YAAY,CAAC,QAAb,GAAwB,EAAxB;AACD;;AAED,EAAA,YAAY,CAAC,QAAb,CAAsB,MAAtB,GAA+B,MAAM,IAAI,SAAzC;AACD;;AAZD,OAAA,CAAA,gBAAA,GAAA,gBAAA","sourcesContent":["import type { VirtualElement } from './types';\n\n/**\n * Sets the virtual parent of an element.\n *\n * @param child - Theme element to set the virtual parent\n * @param parent - The virtual parent, use `undefined` to remove a virtual parent relationship\n */\nexport function setVirtualParent(child: HTMLElement, parent?: HTMLElement): void {\n if (!child) {\n return;\n }\n\n const virtualChild = <VirtualElement>child;\n\n if (!virtualChild._virtual) {\n virtualChild._virtual = {};\n }\n\n virtualChild._virtual.parent = parent || undefined;\n}\n"],"sourceRoot":"../src/"}
@@ -1,3 +1,6 @@
1
1
  "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
3
6
  //# sourceMappingURL=types.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"types.js","sourceRoot":"","sources":["../../src/virtualParent/types.ts"],"names":[],"mappings":""}
1
+ {"version":3,"sources":[],"names":[],"mappings":"","sourceRoot":"../src/"}
package/package.json CHANGED
@@ -1,10 +1,10 @@
1
1
  {
2
2
  "name": "@fluentui/react-portal",
3
- "version": "9.0.0-nightly.d730088d7f.0",
3
+ "version": "9.0.0-rc.10",
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",
7
- "typings": "lib/index.d.ts",
7
+ "typings": "dist/index.d.ts",
8
8
  "sideEffects": false,
9
9
  "repository": {
10
10
  "type": "git",
@@ -19,32 +19,21 @@
19
19
  "just": "just-scripts",
20
20
  "lint": "just-scripts lint",
21
21
  "start": "yarn storybook",
22
- "test": "jest",
22
+ "test": "jest --passWithNoTests",
23
23
  "docs": "api-extractor run --config=config/api-extractor.local.json --local",
24
- "build:local": "tsc -p . --module esnext --emitDeclarationOnly && node ../../scripts/typescript/normalize-import --output dist/react-portal/src && yarn docs",
25
- "storybook": "start-storybook"
24
+ "build:local": "tsc -p ./tsconfig.lib.json --module esnext --emitDeclarationOnly && node ../../../scripts/typescript/normalize-import --output ./dist/packages/react-components/react-portal/src && yarn docs",
25
+ "storybook": "node ../../../scripts/storybook/runner",
26
+ "type-check": "tsc -b tsconfig.json"
26
27
  },
27
28
  "devDependencies": {
28
29
  "@fluentui/eslint-plugin": "*",
29
- "@fluentui/jest-serializer-make-styles": "9.0.0-nightly.d730088d7f.0",
30
30
  "@fluentui/react-conformance": "*",
31
- "@fluentui/scripts": "^1.0.0",
32
- "@types/enzyme": "3.10.3",
33
- "@types/enzyme-adapter-react-16": "1.0.3",
34
- "@types/react": "16.9.42",
35
- "@types/react-dom": "16.9.10",
36
- "@types/react-test-renderer": "^16.0.0",
37
- "enzyme": "~3.10.0",
38
- "enzyme-adapter-react-16": "^1.15.0",
39
- "react": "16.8.6",
40
- "react-dom": "16.8.6",
41
- "react-test-renderer": "^16.3.0"
31
+ "@fluentui/scripts": "^1.0.0"
42
32
  },
43
33
  "dependencies": {
44
- "@fluentui/react-make-styles": "9.0.0-nightly.d730088d7f.0",
45
- "@fluentui/react-shared-contexts": "9.0.0-nightly.d730088d7f.0",
46
- "@fluentui/react-tabster": "9.0.0-nightly.d730088d7f.0",
47
- "@fluentui/react-utilities": "9.0.0-nightly.d730088d7f.0",
34
+ "@fluentui/react-shared-contexts": "9.0.0-rc.8",
35
+ "@fluentui/react-tabster": "9.0.0-rc.10",
36
+ "@fluentui/react-utilities": "9.0.0-rc.9",
48
37
  "tslib": "^2.1.0"
49
38
  },
50
39
  "peerDependencies": {
@@ -54,11 +43,17 @@
54
43
  "react-dom": ">=16.8.0 <18.0.0"
55
44
  },
56
45
  "beachball": {
57
- "tag": "beta",
58
46
  "disallowedChangeTypes": [
59
47
  "major",
60
48
  "minor",
61
49
  "patch"
62
50
  ]
51
+ },
52
+ "exports": {
53
+ ".": {
54
+ "types": "./lib/index.d.ts",
55
+ "import": "./lib/index.js",
56
+ "require": "./lib-commonjs/index.js"
57
+ }
63
58
  }
64
59
  }
package/lib/Portal.d.ts DELETED
@@ -1 +0,0 @@
1
- export * from './components/Portal/index';
@@ -1,4 +0,0 @@
1
- import type { IsConformantOptions } from '@fluentui/react-conformance';
2
- export declare function isConformant<TProps = {}>(testInfo: Omit<IsConformantOptions<TProps>, 'componentPath'> & {
3
- componentPath?: string;
4
- }): void;
@@ -1,9 +0,0 @@
1
- import { isConformant as baseIsConformant } from '@fluentui/react-conformance';
2
- export function isConformant(testInfo) {
3
- var defaultOptions = {
4
- asPropHandlesRef: true,
5
- componentPath: module.parent.filename.replace('.test', ''),
6
- };
7
- baseIsConformant(defaultOptions, testInfo);
8
- }
9
- //# sourceMappingURL=isConformant.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"isConformant.js","sourceRoot":"","sources":["../../src/common/isConformant.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,IAAI,gBAAgB,EAAE,MAAM,6BAA6B,CAAC;AAG/E,MAAM,UAAU,YAAY,CAC1B,QAAyF;IAEzF,IAAM,cAAc,GAAyC;QAC3D,gBAAgB,EAAE,IAAI;QACtB,aAAa,EAAE,MAAO,CAAC,MAAO,CAAC,QAAQ,CAAC,OAAO,CAAC,OAAO,EAAE,EAAE,CAAC;KAC7D,CAAC;IAEF,gBAAgB,CAAC,cAAc,EAAE,QAAQ,CAAC,CAAC;AAC7C,CAAC"}
@@ -1,6 +0,0 @@
1
- import * as React from 'react';
2
- import type { PortalProps } from './Portal.types';
3
- /**
4
- * Component that renders children in a React portal
5
- */
6
- export declare const Portal: React.FC<PortalProps>;
@@ -1,21 +0,0 @@
1
- import * as React from 'react';
2
- export declare type PortalCommons = {
3
- /**
4
- * React children
5
- */
6
- children: React.ReactNode;
7
- /**
8
- * Where the portal children are mounted on DOM
9
- * @defaultValue a new element on document.body without any styling
10
- */
11
- mountNode: HTMLDivElement | undefined;
12
- };
13
- export declare type PortalProps = Partial<PortalCommons>;
14
- export declare type PortalState = PortalCommons & {
15
- /** Indicates if a Portal should be rendered. */
16
- shouldRender: boolean;
17
- /**
18
- * Ref to the root span element as virtual parent
19
- */
20
- virtualParentRootRef: React.MutableRefObject<HTMLSpanElement | null>;
21
- };
@@ -1,4 +0,0 @@
1
- export * from './Portal';
2
- export * from './Portal.types';
3
- export * from './renderPortal';
4
- export * from './usePortal';