@fluentui/react-portal 9.0.0-alpha.45 → 9.0.0-alpha.49

Sign up to get free protection for your applications and to get access to all the features.
package/CHANGELOG.json CHANGED
@@ -2,7 +2,79 @@
2
2
  "name": "@fluentui/react-portal",
3
3
  "entries": [
4
4
  {
5
- "date": "Fri, 10 Sep 2021 07:36:18 GMT",
5
+ "date": "Fri, 17 Sep 2021 07:32:57 GMT",
6
+ "tag": "@fluentui/react-portal_v9.0.0-alpha.49",
7
+ "version": "9.0.0-alpha.49",
8
+ "comments": {
9
+ "prerelease": [
10
+ {
11
+ "author": "Humberto.Morimoto@microsoft.com",
12
+ "package": "@fluentui/react-portal",
13
+ "commit": "90d71a0914acbb73a0365d60a85237e3d58ef575",
14
+ "comment": "Bump @fluentui/react-portal to v9.0.0-alpha.49"
15
+ }
16
+ ]
17
+ }
18
+ },
19
+ {
20
+ "date": "Thu, 16 Sep 2021 07:38:39 GMT",
21
+ "tag": "@fluentui/react-portal_v9.0.0-alpha.48",
22
+ "version": "9.0.0-alpha.48",
23
+ "comments": {
24
+ "prerelease": [
25
+ {
26
+ "author": "behowell@microsoft.com",
27
+ "package": "@fluentui/react-portal",
28
+ "commit": "fbe41e2877a20ce0f3c01b5188e17c12f941cc4c",
29
+ "comment": "Bump @fluentui/react-portal to v9.0.0-alpha.48"
30
+ }
31
+ ]
32
+ }
33
+ },
34
+ {
35
+ "date": "Tue, 14 Sep 2021 20:09:02 GMT",
36
+ "tag": "@fluentui/react-portal_v9.0.0-alpha.47",
37
+ "version": "9.0.0-alpha.47",
38
+ "comments": {
39
+ "prerelease": [
40
+ {
41
+ "author": "bsunderhus@microsoft.com",
42
+ "package": "@fluentui/react-portal",
43
+ "commit": "10495c31fb5c5cf48b4665601a75a0cfabb6a03c",
44
+ "comment": "Bump @fluentui/react-portal to v9.0.0-alpha.47"
45
+ }
46
+ ]
47
+ }
48
+ },
49
+ {
50
+ "date": "Fri, 10 Sep 2021 16:31:53 GMT",
51
+ "tag": "@fluentui/react-portal_v9.0.0-alpha.46",
52
+ "version": "9.0.0-alpha.46",
53
+ "comments": {
54
+ "prerelease": [
55
+ {
56
+ "author": "olfedias@microsoft.com",
57
+ "package": "@fluentui/react-portal",
58
+ "comment": "use simplified prop merging",
59
+ "commit": "01a06f5b2aa14ae96a2fca056d34d99a5ad124e0"
60
+ },
61
+ {
62
+ "author": "lingfangao@hotmail.com",
63
+ "package": "@fluentui/react-portal",
64
+ "comment": "chore(v9): Move all internal v9 dependencies from caret to fixed version",
65
+ "commit": "01a06f5b2aa14ae96a2fca056d34d99a5ad124e0"
66
+ },
67
+ {
68
+ "author": "lingfangao@hotmail.com",
69
+ "package": "@fluentui/react-portal",
70
+ "commit": "01a06f5b2aa14ae96a2fca056d34d99a5ad124e0",
71
+ "comment": "Bump @fluentui/react-portal to v9.0.0-alpha.46"
72
+ }
73
+ ]
74
+ }
75
+ },
76
+ {
77
+ "date": "Fri, 10 Sep 2021 07:39:51 GMT",
6
78
  "tag": "@fluentui/react-portal_v9.0.0-alpha.45",
7
79
  "version": "9.0.0-alpha.45",
8
80
  "comments": {
package/CHANGELOG.md CHANGED
@@ -1,12 +1,50 @@
1
1
  # Change Log - @fluentui/react-portal
2
2
 
3
- This log was last generated on Fri, 10 Sep 2021 07:36:18 GMT and should not be manually modified.
3
+ This log was last generated on Fri, 17 Sep 2021 07:32:57 GMT and should not be manually modified.
4
4
 
5
5
  <!-- Start content -->
6
6
 
7
+ ## [9.0.0-alpha.49](https://github.com/microsoft/fluentui/tree/@fluentui/react-portal_v9.0.0-alpha.49)
8
+
9
+ Fri, 17 Sep 2021 07:32:57 GMT
10
+ [Compare changes](https://github.com/microsoft/fluentui/compare/@fluentui/react-portal_v9.0.0-alpha.48..@fluentui/react-portal_v9.0.0-alpha.49)
11
+
12
+ ### Changes
13
+
14
+ - Bump @fluentui/react-portal to v9.0.0-alpha.49 ([PR #19840](https://github.com/microsoft/fluentui/pull/19840) by Humberto.Morimoto@microsoft.com)
15
+
16
+ ## [9.0.0-alpha.48](https://github.com/microsoft/fluentui/tree/@fluentui/react-portal_v9.0.0-alpha.48)
17
+
18
+ Thu, 16 Sep 2021 07:38:39 GMT
19
+ [Compare changes](https://github.com/microsoft/fluentui/compare/@fluentui/react-portal_v9.0.0-alpha.47..@fluentui/react-portal_v9.0.0-alpha.48)
20
+
21
+ ### Changes
22
+
23
+ - Bump @fluentui/react-portal to v9.0.0-alpha.48 ([PR #19815](https://github.com/microsoft/fluentui/pull/19815) by behowell@microsoft.com)
24
+
25
+ ## [9.0.0-alpha.47](https://github.com/microsoft/fluentui/tree/@fluentui/react-portal_v9.0.0-alpha.47)
26
+
27
+ Tue, 14 Sep 2021 20:09:02 GMT
28
+ [Compare changes](https://github.com/microsoft/fluentui/compare/@fluentui/react-portal_v9.0.0-alpha.46..@fluentui/react-portal_v9.0.0-alpha.47)
29
+
30
+ ### Changes
31
+
32
+ - Bump @fluentui/react-portal to v9.0.0-alpha.47 ([PR #19155](https://github.com/microsoft/fluentui/pull/19155) by bsunderhus@microsoft.com)
33
+
34
+ ## [9.0.0-alpha.46](https://github.com/microsoft/fluentui/tree/@fluentui/react-portal_v9.0.0-alpha.46)
35
+
36
+ Fri, 10 Sep 2021 16:31:53 GMT
37
+ [Compare changes](https://github.com/microsoft/fluentui/compare/@fluentui/react-portal_v9.0.0-alpha.45..@fluentui/react-portal_v9.0.0-alpha.46)
38
+
39
+ ### Changes
40
+
41
+ - use simplified prop merging ([PR #19748](https://github.com/microsoft/fluentui/pull/19748) by olfedias@microsoft.com)
42
+ - chore(v9): Move all internal v9 dependencies from caret to fixed version ([PR #19748](https://github.com/microsoft/fluentui/pull/19748) by lingfangao@hotmail.com)
43
+ - Bump @fluentui/react-portal to v9.0.0-alpha.46 ([PR #19748](https://github.com/microsoft/fluentui/pull/19748) by lingfangao@hotmail.com)
44
+
7
45
  ## [9.0.0-alpha.45](https://github.com/microsoft/fluentui/tree/@fluentui/react-portal_v9.0.0-alpha.45)
8
46
 
9
- Fri, 10 Sep 2021 07:36:18 GMT
47
+ Fri, 10 Sep 2021 07:39:51 GMT
10
48
  [Compare changes](https://github.com/microsoft/fluentui/compare/@fluentui/react-portal_v9.0.0-alpha.44..@fluentui/react-portal_v9.0.0-alpha.45)
11
49
 
12
50
  ### Changes
@@ -13,19 +13,22 @@ export declare function elementContains(parent: HTMLElement | null, child: HTMLE
13
13
  */
14
14
  export declare const Portal: React_2.FC<PortalProps>;
15
15
 
16
- export declare interface PortalProps {
16
+ export declare interface PortalCommons {
17
17
  /**
18
18
  * React children
19
19
  */
20
- children?: React_2.ReactNode;
20
+ children: React_2.ReactNode;
21
21
  /**
22
22
  * Where the portal children are mounted on DOM
23
23
  * @defaultValue a new element on document.body without any styling
24
24
  */
25
- mountNode?: HTMLDivElement | null;
25
+ mountNode: HTMLDivElement | undefined;
26
26
  }
27
27
 
28
- export declare interface PortalState extends PortalProps {
28
+ export declare interface PortalProps extends Partial<PortalCommons> {
29
+ }
30
+
31
+ export declare interface PortalState extends PortalCommons {
29
32
  /** Indicates if a Portal should be rendered. */
30
33
  shouldRender: boolean;
31
34
  /**
@@ -53,8 +56,7 @@ export declare function setVirtualParent(child: HTMLElement, parent?: HTMLElemen
53
56
  * The returned state can be modified with hooks such as usePortalStyles, before being passed to renderPortal.
54
57
  *
55
58
  * @param props - props from this instance of Portal
56
- * @param defaultProps - (optional) default prop values provided by the implementing type
57
59
  */
58
- export declare const usePortal: (props: PortalProps, defaultProps?: PortalProps | undefined) => PortalState;
60
+ export declare const usePortal: (props: PortalProps) => PortalState;
59
61
 
60
62
  export { }
@@ -1,16 +1,18 @@
1
1
  import * as React from 'react';
2
- export interface PortalProps {
2
+ export interface PortalCommons {
3
3
  /**
4
4
  * React children
5
5
  */
6
- children?: React.ReactNode;
6
+ children: React.ReactNode;
7
7
  /**
8
8
  * Where the portal children are mounted on DOM
9
9
  * @defaultValue a new element on document.body without any styling
10
10
  */
11
- mountNode?: HTMLDivElement | null;
11
+ mountNode: HTMLDivElement | undefined;
12
12
  }
13
- export interface PortalState extends PortalProps {
13
+ export interface PortalProps extends Partial<PortalCommons> {
14
+ }
15
+ export interface PortalState extends PortalCommons {
14
16
  /** Indicates if a Portal should be rendered. */
15
17
  shouldRender: boolean;
16
18
  /**
@@ -1 +1 @@
1
- {"version":3,"file":"Portal.types.js","sourceRoot":"../src/","sources":["components/Portal/Portal.types.ts"],"names":[],"mappings":"","sourcesContent":["import * as React from 'react';\n\nexport interface PortalProps {\n /**\n * React children\n */\n children?: React.ReactNode;\n /**\n * Where the portal children are mounted on DOM\n * @defaultValue a new element on document.body without any styling\n */\n mountNode?: HTMLDivElement | null;\n\n /**\n * React events should not bubble up the portal\n */\n // TODO clarify if this is still needed\n // disableEventBubbling?: 'first' | 'last';\n}\n\nexport interface PortalState extends PortalProps {\n /** Indicates if a Portal should be rendered. */\n shouldRender: boolean;\n\n /**\n * Ref to the root span element as virtual parent\n */\n virtualParentRootRef: React.MutableRefObject<HTMLSpanElement | null>;\n}\n"]}
1
+ {"version":3,"file":"Portal.types.js","sourceRoot":"../src/","sources":["components/Portal/Portal.types.ts"],"names":[],"mappings":"","sourcesContent":["import * as React from 'react';\n\nexport interface PortalCommons {\n /**\n * React children\n */\n children: React.ReactNode;\n /**\n * Where the portal children are mounted on DOM\n * @defaultValue a new element on document.body without any styling\n */\n mountNode: HTMLDivElement | undefined;\n}\n\nexport interface PortalProps extends Partial<PortalCommons> {}\n\nexport interface PortalState extends PortalCommons {\n /** Indicates if a Portal should be rendered. */\n shouldRender: boolean;\n\n /**\n * Ref to the root span element as virtual parent\n */\n virtualParentRootRef: React.MutableRefObject<HTMLSpanElement | null>;\n}\n"]}
@@ -5,6 +5,5 @@ import type { PortalProps, PortalState } from './Portal.types';
5
5
  * The returned state can be modified with hooks such as usePortalStyles, before being passed to renderPortal.
6
6
  *
7
7
  * @param props - props from this instance of Portal
8
- * @param defaultProps - (optional) default prop values provided by the implementing type
9
8
  */
10
- export declare const usePortal: (props: PortalProps, defaultProps?: PortalProps | undefined) => PortalState;
9
+ export declare const usePortal: (props: PortalProps) => PortalState;
@@ -1,22 +1,24 @@
1
1
  import * as React from 'react';
2
- import { makeMergeProps, useIsSSR } from '@fluentui/react-utilities';
2
+ import { useIsSSR } from '@fluentui/react-utilities';
3
3
  import { usePortalMountNode } from './usePortalMountNode';
4
4
  import { setVirtualParent } from '../../virtualParent/index';
5
- var mergeProps = makeMergeProps();
6
5
  /**
7
6
  * Create the state required to render Portal.
8
7
  *
9
8
  * The returned state can be modified with hooks such as usePortalStyles, before being passed to renderPortal.
10
9
  *
11
10
  * @param props - props from this instance of Portal
12
- * @param defaultProps - (optional) default prop values provided by the implementing type
13
11
  */
14
- export var usePortal = function (props, defaultProps) {
15
- var _a;
12
+ export var usePortal = function (props) {
13
+ var children = props.children, mountNode = props.mountNode;
16
14
  var virtualParentRootRef = React.useRef(null);
17
- var state = mergeProps({ shouldRender: !useIsSSR(), virtualParentRootRef: virtualParentRootRef }, defaultProps, props);
18
- var fallbackMountNode = usePortalMountNode({ disabled: !!state.mountNode });
19
- state.mountNode = (_a = state.mountNode) !== null && _a !== void 0 ? _a : fallbackMountNode;
15
+ var fallbackMountNode = usePortalMountNode({ disabled: !!mountNode });
16
+ var state = {
17
+ children: children,
18
+ mountNode: mountNode !== null && mountNode !== void 0 ? mountNode : fallbackMountNode,
19
+ shouldRender: !useIsSSR(),
20
+ virtualParentRootRef: virtualParentRootRef,
21
+ };
20
22
  React.useEffect(function () {
21
23
  if (state.virtualParentRootRef.current && state.mountNode) {
22
24
  setVirtualParent(state.mountNode, state.virtualParentRootRef.current);
@@ -1 +1 @@
1
- {"version":3,"file":"usePortal.js","sourceRoot":"../src/","sources":["components/Portal/usePortal.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,EAAE,cAAc,EAAE,QAAQ,EAAE,MAAM,2BAA2B,CAAC;AACrE,OAAO,EAAE,kBAAkB,EAAE,MAAM,sBAAsB,CAAC;AAC1D,OAAO,EAAE,gBAAgB,EAAE,MAAM,2BAA2B,CAAC;AAG7D,IAAM,UAAU,GAAG,cAAc,EAAe,CAAC;AAEjD;;;;;;;GAOG;AACH,MAAM,CAAC,IAAM,SAAS,GAAG,UAAC,KAAkB,EAAE,YAA0B;;IACtE,IAAM,oBAAoB,GAAG,KAAK,CAAC,MAAM,CAAkB,IAAI,CAAC,CAAC;IACjE,IAAM,KAAK,GAAG,UAAU,CAAC,EAAE,YAAY,EAAE,CAAC,QAAQ,EAAE,EAAE,oBAAoB,sBAAA,EAAE,EAAE,YAAY,EAAE,KAAK,CAAC,CAAC;IACnG,IAAM,iBAAiB,GAAG,kBAAkB,CAAC,EAAE,QAAQ,EAAE,CAAC,CAAC,KAAK,CAAC,SAAS,EAAE,CAAC,CAAC;IAE9E,KAAK,CAAC,SAAS,SAAG,KAAK,CAAC,SAAS,mCAAI,iBAAiB,CAAC;IAEvD,KAAK,CAAC,SAAS,CAAC;QACd,IAAI,KAAK,CAAC,oBAAoB,CAAC,OAAO,IAAI,KAAK,CAAC,SAAS,EAAE;YACzD,gBAAgB,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","sourcesContent":["import * as React from 'react';\nimport { makeMergeProps, useIsSSR } from '@fluentui/react-utilities';\nimport { usePortalMountNode } from './usePortalMountNode';\nimport { setVirtualParent } from '../../virtualParent/index';\nimport type { PortalProps, PortalState } from './Portal.types';\n\nconst mergeProps = makeMergeProps<PortalState>();\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.\n *\n * @param props - props from this instance of Portal\n * @param defaultProps - (optional) default prop values provided by the implementing type\n */\nexport const usePortal = (props: PortalProps, defaultProps?: PortalProps): PortalState => {\n const virtualParentRootRef = React.useRef<HTMLSpanElement>(null);\n const state = mergeProps({ shouldRender: !useIsSSR(), virtualParentRootRef }, defaultProps, props);\n const fallbackMountNode = usePortalMountNode({ disabled: !!state.mountNode });\n\n state.mountNode = state.mountNode ?? fallbackMountNode;\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"]}
1
+ {"version":3,"file":"usePortal.js","sourceRoot":"../src/","sources":["components/Portal/usePortal.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,EAAE,QAAQ,EAAE,MAAM,2BAA2B,CAAC;AACrD,OAAO,EAAE,kBAAkB,EAAE,MAAM,sBAAsB,CAAC;AAC1D,OAAO,EAAE,gBAAgB,EAAE,MAAM,2BAA2B,CAAC;AAG7D;;;;;;GAMG;AACH,MAAM,CAAC,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,kBAAkB,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,QAAQ,EAAE;QACzB,oBAAoB,sBAAA;KACrB,CAAC;IAEF,KAAK,CAAC,SAAS,CAAC;QACd,IAAI,KAAK,CAAC,oBAAoB,CAAC,OAAO,IAAI,KAAK,CAAC,SAAS,EAAE;YACzD,gBAAgB,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","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.\n *\n * @param props - props from this instance of Portal\n */\nexport const usePortal = (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"]}
@@ -1,16 +1,18 @@
1
1
  import * as React from 'react';
2
- export interface PortalProps {
2
+ export interface PortalCommons {
3
3
  /**
4
4
  * React children
5
5
  */
6
- children?: React.ReactNode;
6
+ children: React.ReactNode;
7
7
  /**
8
8
  * Where the portal children are mounted on DOM
9
9
  * @defaultValue a new element on document.body without any styling
10
10
  */
11
- mountNode?: HTMLDivElement | null;
11
+ mountNode: HTMLDivElement | undefined;
12
12
  }
13
- export interface PortalState extends PortalProps {
13
+ export interface PortalProps extends Partial<PortalCommons> {
14
+ }
15
+ export interface PortalState extends PortalCommons {
14
16
  /** Indicates if a Portal should be rendered. */
15
17
  shouldRender: boolean;
16
18
  /**
@@ -1 +1 @@
1
- {"version":3,"file":"Portal.types.js","sourceRoot":"../src/","sources":["components/Portal/Portal.types.ts"],"names":[],"mappings":"","sourcesContent":["import * as React from 'react';\n\nexport interface PortalProps {\n /**\n * React children\n */\n children?: React.ReactNode;\n /**\n * Where the portal children are mounted on DOM\n * @defaultValue a new element on document.body without any styling\n */\n mountNode?: HTMLDivElement | null;\n\n /**\n * React events should not bubble up the portal\n */\n // TODO clarify if this is still needed\n // disableEventBubbling?: 'first' | 'last';\n}\n\nexport interface PortalState extends PortalProps {\n /** Indicates if a Portal should be rendered. */\n shouldRender: boolean;\n\n /**\n * Ref to the root span element as virtual parent\n */\n virtualParentRootRef: React.MutableRefObject<HTMLSpanElement | null>;\n}\n"]}
1
+ {"version":3,"file":"Portal.types.js","sourceRoot":"../src/","sources":["components/Portal/Portal.types.ts"],"names":[],"mappings":"","sourcesContent":["import * as React from 'react';\n\nexport interface PortalCommons {\n /**\n * React children\n */\n children: React.ReactNode;\n /**\n * Where the portal children are mounted on DOM\n * @defaultValue a new element on document.body without any styling\n */\n mountNode: HTMLDivElement | undefined;\n}\n\nexport interface PortalProps extends Partial<PortalCommons> {}\n\nexport interface PortalState extends PortalCommons {\n /** Indicates if a Portal should be rendered. */\n shouldRender: boolean;\n\n /**\n * Ref to the root span element as virtual parent\n */\n virtualParentRootRef: React.MutableRefObject<HTMLSpanElement | null>;\n}\n"]}
@@ -5,6 +5,5 @@ import type { PortalProps, PortalState } from './Portal.types';
5
5
  * The returned state can be modified with hooks such as usePortalStyles, before being passed to renderPortal.
6
6
  *
7
7
  * @param props - props from this instance of Portal
8
- * @param defaultProps - (optional) default prop values provided by the implementing type
9
8
  */
10
- export declare const usePortal: (props: PortalProps, defaultProps?: PortalProps | undefined) => PortalState;
9
+ export declare const usePortal: (props: PortalProps) => PortalState;
@@ -2,21 +2,23 @@ define(["require", "exports", "react", "@fluentui/react-utilities", "./usePortal
2
2
  "use strict";
3
3
  Object.defineProperty(exports, "__esModule", { value: true });
4
4
  exports.usePortal = void 0;
5
- var mergeProps = react_utilities_1.makeMergeProps();
6
5
  /**
7
6
  * Create the state required to render Portal.
8
7
  *
9
8
  * The returned state can be modified with hooks such as usePortalStyles, before being passed to renderPortal.
10
9
  *
11
10
  * @param props - props from this instance of Portal
12
- * @param defaultProps - (optional) default prop values provided by the implementing type
13
11
  */
14
- var usePortal = function (props, defaultProps) {
15
- var _a;
12
+ var usePortal = function (props) {
13
+ var children = props.children, mountNode = props.mountNode;
16
14
  var virtualParentRootRef = React.useRef(null);
17
- var state = mergeProps({ shouldRender: !react_utilities_1.useIsSSR(), virtualParentRootRef: virtualParentRootRef }, defaultProps, props);
18
- var fallbackMountNode = usePortalMountNode_1.usePortalMountNode({ disabled: !!state.mountNode });
19
- state.mountNode = (_a = state.mountNode) !== null && _a !== void 0 ? _a : fallbackMountNode;
15
+ var fallbackMountNode = usePortalMountNode_1.usePortalMountNode({ disabled: !!mountNode });
16
+ var state = {
17
+ children: children,
18
+ mountNode: mountNode !== null && mountNode !== void 0 ? mountNode : fallbackMountNode,
19
+ shouldRender: !react_utilities_1.useIsSSR(),
20
+ virtualParentRootRef: virtualParentRootRef,
21
+ };
20
22
  React.useEffect(function () {
21
23
  if (state.virtualParentRootRef.current && state.mountNode) {
22
24
  index_1.setVirtualParent(state.mountNode, state.virtualParentRootRef.current);
@@ -1 +1 @@
1
- {"version":3,"file":"usePortal.js","sourceRoot":"../src/","sources":["components/Portal/usePortal.ts"],"names":[],"mappings":";;;;IAMA,IAAM,UAAU,GAAG,gCAAc,EAAe,CAAC;IAEjD;;;;;;;OAOG;IACI,IAAM,SAAS,GAAG,UAAC,KAAkB,EAAE,YAA0B;;QACtE,IAAM,oBAAoB,GAAG,KAAK,CAAC,MAAM,CAAkB,IAAI,CAAC,CAAC;QACjE,IAAM,KAAK,GAAG,UAAU,CAAC,EAAE,YAAY,EAAE,CAAC,0BAAQ,EAAE,EAAE,oBAAoB,sBAAA,EAAE,EAAE,YAAY,EAAE,KAAK,CAAC,CAAC;QACnG,IAAM,iBAAiB,GAAG,uCAAkB,CAAC,EAAE,QAAQ,EAAE,CAAC,CAAC,KAAK,CAAC,SAAS,EAAE,CAAC,CAAC;QAE9E,KAAK,CAAC,SAAS,SAAG,KAAK,CAAC,SAAS,mCAAI,iBAAiB,CAAC;QAEvD,KAAK,CAAC,SAAS,CAAC;YACd,IAAI,KAAK,CAAC,oBAAoB,CAAC,OAAO,IAAI,KAAK,CAAC,SAAS,EAAE;gBACzD,wBAAgB,CAAC,KAAK,CAAC,SAAS,EAAE,KAAK,CAAC,oBAAoB,CAAC,OAAO,CAAC,CAAC;aACvE;QACH,CAAC,EAAE,CAAC,KAAK,CAAC,oBAAoB,EAAE,KAAK,CAAC,SAAS,CAAC,CAAC,CAAC;QAElD,OAAO,KAAK,CAAC;IACf,CAAC,CAAC;IAdW,QAAA,SAAS,aAcpB","sourcesContent":["import * as React from 'react';\nimport { makeMergeProps, useIsSSR } from '@fluentui/react-utilities';\nimport { usePortalMountNode } from './usePortalMountNode';\nimport { setVirtualParent } from '../../virtualParent/index';\nimport type { PortalProps, PortalState } from './Portal.types';\n\nconst mergeProps = makeMergeProps<PortalState>();\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.\n *\n * @param props - props from this instance of Portal\n * @param defaultProps - (optional) default prop values provided by the implementing type\n */\nexport const usePortal = (props: PortalProps, defaultProps?: PortalProps): PortalState => {\n const virtualParentRootRef = React.useRef<HTMLSpanElement>(null);\n const state = mergeProps({ shouldRender: !useIsSSR(), virtualParentRootRef }, defaultProps, props);\n const fallbackMountNode = usePortalMountNode({ disabled: !!state.mountNode });\n\n state.mountNode = state.mountNode ?? fallbackMountNode;\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"]}
1
+ {"version":3,"file":"usePortal.js","sourceRoot":"../src/","sources":["components/Portal/usePortal.ts"],"names":[],"mappings":";;;;IAMA;;;;;;OAMG;IACI,IAAM,SAAS,GAAG,UAAC,KAAkB;QAClC,IAAA,QAAQ,GAAgB,KAAK,SAArB,EAAE,SAAS,GAAK,KAAK,UAAV,CAAW;QAEtC,IAAM,oBAAoB,GAAG,KAAK,CAAC,MAAM,CAAkB,IAAI,CAAC,CAAC;QACjE,IAAM,iBAAiB,GAAG,uCAAkB,CAAC,EAAE,QAAQ,EAAE,CAAC,CAAC,SAAS,EAAE,CAAC,CAAC;QAExE,IAAM,KAAK,GAAgB;YACzB,QAAQ,UAAA;YACR,SAAS,EAAE,SAAS,aAAT,SAAS,cAAT,SAAS,GAAI,iBAAiB;YACzC,YAAY,EAAE,CAAC,0BAAQ,EAAE;YACzB,oBAAoB,sBAAA;SACrB,CAAC;QAEF,KAAK,CAAC,SAAS,CAAC;YACd,IAAI,KAAK,CAAC,oBAAoB,CAAC,OAAO,IAAI,KAAK,CAAC,SAAS,EAAE;gBACzD,wBAAgB,CAAC,KAAK,CAAC,SAAS,EAAE,KAAK,CAAC,oBAAoB,CAAC,OAAO,CAAC,CAAC;aACvE;QACH,CAAC,EAAE,CAAC,KAAK,CAAC,oBAAoB,EAAE,KAAK,CAAC,SAAS,CAAC,CAAC,CAAC;QAElD,OAAO,KAAK,CAAC;IACf,CAAC,CAAC;IApBW,QAAA,SAAS,aAoBpB","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.\n *\n * @param props - props from this instance of Portal\n */\nexport const usePortal = (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"]}
@@ -1,16 +1,18 @@
1
1
  import * as React from 'react';
2
- export interface PortalProps {
2
+ export interface PortalCommons {
3
3
  /**
4
4
  * React children
5
5
  */
6
- children?: React.ReactNode;
6
+ children: React.ReactNode;
7
7
  /**
8
8
  * Where the portal children are mounted on DOM
9
9
  * @defaultValue a new element on document.body without any styling
10
10
  */
11
- mountNode?: HTMLDivElement | null;
11
+ mountNode: HTMLDivElement | undefined;
12
12
  }
13
- export interface PortalState extends PortalProps {
13
+ export interface PortalProps extends Partial<PortalCommons> {
14
+ }
15
+ export interface PortalState extends PortalCommons {
14
16
  /** Indicates if a Portal should be rendered. */
15
17
  shouldRender: boolean;
16
18
  /**
@@ -1 +1 @@
1
- {"version":3,"file":"Portal.types.js","sourceRoot":"../src/","sources":["components/Portal/Portal.types.ts"],"names":[],"mappings":"","sourcesContent":["import * as React from 'react';\n\nexport interface PortalProps {\n /**\n * React children\n */\n children?: React.ReactNode;\n /**\n * Where the portal children are mounted on DOM\n * @defaultValue a new element on document.body without any styling\n */\n mountNode?: HTMLDivElement | null;\n\n /**\n * React events should not bubble up the portal\n */\n // TODO clarify if this is still needed\n // disableEventBubbling?: 'first' | 'last';\n}\n\nexport interface PortalState extends PortalProps {\n /** Indicates if a Portal should be rendered. */\n shouldRender: boolean;\n\n /**\n * Ref to the root span element as virtual parent\n */\n virtualParentRootRef: React.MutableRefObject<HTMLSpanElement | null>;\n}\n"]}
1
+ {"version":3,"file":"Portal.types.js","sourceRoot":"../src/","sources":["components/Portal/Portal.types.ts"],"names":[],"mappings":"","sourcesContent":["import * as React from 'react';\n\nexport interface PortalCommons {\n /**\n * React children\n */\n children: React.ReactNode;\n /**\n * Where the portal children are mounted on DOM\n * @defaultValue a new element on document.body without any styling\n */\n mountNode: HTMLDivElement | undefined;\n}\n\nexport interface PortalProps extends Partial<PortalCommons> {}\n\nexport interface PortalState extends PortalCommons {\n /** Indicates if a Portal should be rendered. */\n shouldRender: boolean;\n\n /**\n * Ref to the root span element as virtual parent\n */\n virtualParentRootRef: React.MutableRefObject<HTMLSpanElement | null>;\n}\n"]}
@@ -5,6 +5,5 @@ import type { PortalProps, PortalState } from './Portal.types';
5
5
  * The returned state can be modified with hooks such as usePortalStyles, before being passed to renderPortal.
6
6
  *
7
7
  * @param props - props from this instance of Portal
8
- * @param defaultProps - (optional) default prop values provided by the implementing type
9
8
  */
10
- export declare const usePortal: (props: PortalProps, defaultProps?: PortalProps | undefined) => PortalState;
9
+ export declare const usePortal: (props: PortalProps) => PortalState;
@@ -5,21 +5,23 @@ var React = require("react");
5
5
  var react_utilities_1 = require("@fluentui/react-utilities");
6
6
  var usePortalMountNode_1 = require("./usePortalMountNode");
7
7
  var index_1 = require("../../virtualParent/index");
8
- var mergeProps = react_utilities_1.makeMergeProps();
9
8
  /**
10
9
  * Create the state required to render Portal.
11
10
  *
12
11
  * The returned state can be modified with hooks such as usePortalStyles, before being passed to renderPortal.
13
12
  *
14
13
  * @param props - props from this instance of Portal
15
- * @param defaultProps - (optional) default prop values provided by the implementing type
16
14
  */
17
- var usePortal = function (props, defaultProps) {
18
- var _a;
15
+ var usePortal = function (props) {
16
+ var children = props.children, mountNode = props.mountNode;
19
17
  var virtualParentRootRef = React.useRef(null);
20
- var state = mergeProps({ shouldRender: !react_utilities_1.useIsSSR(), virtualParentRootRef: virtualParentRootRef }, defaultProps, props);
21
- var fallbackMountNode = usePortalMountNode_1.usePortalMountNode({ disabled: !!state.mountNode });
22
- state.mountNode = (_a = state.mountNode) !== null && _a !== void 0 ? _a : fallbackMountNode;
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
+ };
23
25
  React.useEffect(function () {
24
26
  if (state.virtualParentRootRef.current && state.mountNode) {
25
27
  index_1.setVirtualParent(state.mountNode, state.virtualParentRootRef.current);
@@ -1 +1 @@
1
- {"version":3,"file":"usePortal.js","sourceRoot":"../src/","sources":["components/Portal/usePortal.ts"],"names":[],"mappings":";;;AAAA,6BAA+B;AAC/B,6DAAqE;AACrE,2DAA0D;AAC1D,mDAA6D;AAG7D,IAAM,UAAU,GAAG,gCAAc,EAAe,CAAC;AAEjD;;;;;;;GAOG;AACI,IAAM,SAAS,GAAG,UAAC,KAAkB,EAAE,YAA0B;;IACtE,IAAM,oBAAoB,GAAG,KAAK,CAAC,MAAM,CAAkB,IAAI,CAAC,CAAC;IACjE,IAAM,KAAK,GAAG,UAAU,CAAC,EAAE,YAAY,EAAE,CAAC,0BAAQ,EAAE,EAAE,oBAAoB,sBAAA,EAAE,EAAE,YAAY,EAAE,KAAK,CAAC,CAAC;IACnG,IAAM,iBAAiB,GAAG,uCAAkB,CAAC,EAAE,QAAQ,EAAE,CAAC,CAAC,KAAK,CAAC,SAAS,EAAE,CAAC,CAAC;IAE9E,KAAK,CAAC,SAAS,SAAG,KAAK,CAAC,SAAS,mCAAI,iBAAiB,CAAC;IAEvD,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;AAdW,QAAA,SAAS,aAcpB","sourcesContent":["import * as React from 'react';\nimport { makeMergeProps, useIsSSR } from '@fluentui/react-utilities';\nimport { usePortalMountNode } from './usePortalMountNode';\nimport { setVirtualParent } from '../../virtualParent/index';\nimport type { PortalProps, PortalState } from './Portal.types';\n\nconst mergeProps = makeMergeProps<PortalState>();\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.\n *\n * @param props - props from this instance of Portal\n * @param defaultProps - (optional) default prop values provided by the implementing type\n */\nexport const usePortal = (props: PortalProps, defaultProps?: PortalProps): PortalState => {\n const virtualParentRootRef = React.useRef<HTMLSpanElement>(null);\n const state = mergeProps({ shouldRender: !useIsSSR(), virtualParentRootRef }, defaultProps, props);\n const fallbackMountNode = usePortalMountNode({ disabled: !!state.mountNode });\n\n state.mountNode = state.mountNode ?? fallbackMountNode;\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"]}
1
+ {"version":3,"file":"usePortal.js","sourceRoot":"../src/","sources":["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","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.\n *\n * @param props - props from this instance of Portal\n */\nexport const usePortal = (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"]}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@fluentui/react-portal",
3
- "version": "9.0.0-alpha.45",
3
+ "version": "9.0.0-alpha.49",
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",
@@ -26,7 +26,7 @@
26
26
  },
27
27
  "devDependencies": {
28
28
  "@fluentui/eslint-plugin": "^1.4.1",
29
- "@fluentui/jest-serializer-make-styles": "^9.0.0-alpha.38",
29
+ "@fluentui/jest-serializer-make-styles": "9.0.0-alpha.42",
30
30
  "@fluentui/react-conformance": "^0.5.0",
31
31
  "@fluentui/scripts": "^1.0.0",
32
32
  "@types/enzyme": "3.10.3",
@@ -41,10 +41,10 @@
41
41
  "react-test-renderer": "^16.3.0"
42
42
  },
43
43
  "dependencies": {
44
- "@fluentui/react-make-styles": "^9.0.0-alpha.63",
45
- "@fluentui/react-shared-contexts": "^9.0.0-alpha.23",
46
- "@fluentui/react-tabster": "^9.0.0-alpha.57",
47
- "@fluentui/react-utilities": "^9.0.0-alpha.45",
44
+ "@fluentui/react-make-styles": "9.0.0-alpha.67",
45
+ "@fluentui/react-shared-contexts": "9.0.0-alpha.24",
46
+ "@fluentui/react-tabster": "9.0.0-alpha.61",
47
+ "@fluentui/react-utilities": "9.0.0-alpha.49",
48
48
  "tslib": "^2.1.0"
49
49
  },
50
50
  "peerDependencies": {