@atlaskit/portal 5.1.8 → 5.2.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -1,5 +1,24 @@
1
1
  # @atlaskit/portal
2
2
 
3
+ ## 5.2.1
4
+
5
+ ### Patch Changes
6
+
7
+ - Updated dependencies
8
+
9
+ ## 5.2.0
10
+
11
+ ### Minor Changes
12
+
13
+ - [`a45bf2e086e1d`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/a45bf2e086e1d) -
14
+ We are testing AppProvider subtree theming capabilities behind a feature flag. This is still in
15
+ development but working under minimal conditions. If this change is successful it will be
16
+ available in a later release.
17
+
18
+ ### Patch Changes
19
+
20
+ - Updated dependencies
21
+
3
22
  ## 5.1.8
4
23
 
5
24
  ### Patch Changes
@@ -564,7 +583,6 @@
564
583
 
565
584
  Remove namespace imports from React, ReactDom, and PropTypes- Updated dependencies
566
585
  [6548261c9a](https://bitbucket.org/atlassian/atlassian-frontend/commits/6548261c9a):
567
-
568
586
  - @atlaskit/docs@8.3.2
569
587
  - @atlaskit/visual-regression@0.1.9
570
588
  - @atlaskit/button@13.3.7
@@ -708,7 +726,6 @@ It is broken for ie11 if you are not polyfilling the `new Event` constructor
708
726
  - [patch][18dfac7332](https://bitbucket.org/atlassian/atlaskit-mk-2/commits/18dfac7332):
709
727
 
710
728
  In this PR, we are:
711
-
712
729
  - Re-introducing dist build folders
713
730
  - Adding back cjs
714
731
  - Replacing es5 by cjs and es2015 by esm
@@ -777,14 +794,12 @@ It is broken for ie11 if you are not polyfilling the `new Event` constructor
777
794
  ## 3.0.1
778
795
 
779
796
  - [patch][b0ef06c685](https://bitbucket.org/atlassian/atlaskit-mk-2/commits/b0ef06c685):
780
-
781
797
  - This is just a safety release in case anything strange happened in in the previous one. See Pull
782
798
  Request #5942 for details
783
799
 
784
800
  ## 3.0.0
785
801
 
786
802
  - [major][dacfb81ca1](https://bitbucket.org/atlassian/atlaskit-mk-2/commits/dacfb81ca1):
787
-
788
803
  - @atlaskit/portal has been converted to Typescript. Typescript consumers will now get static type
789
804
  safety. Flow types are no longer provided. No API or behavioural changes.
790
805
 
@@ -803,14 +818,12 @@ It is broken for ie11 if you are not polyfilling the `new Event` constructor
803
818
  ## 2.0.0
804
819
 
805
820
  - [major][7c17b35107](https://bitbucket.org/atlassian/atlaskit-mk-2/commits/7c17b35107):
806
-
807
821
  - Updates react and react-dom peer dependencies to react@^16.8.0 and react-dom@^16.8.0. To use
808
822
  this package, please ensure you use at least this version of react and react-dom.
809
823
 
810
824
  ## 1.0.0
811
825
 
812
826
  - [major][5b6b4d6a0f](https://bitbucket.org/atlassian/atlaskit-mk-2/commits/5b6b4d6a0f):
813
-
814
827
  - This major release indicates that this package is no longer under dev preview but is ready for
815
828
  use
816
829
 
@@ -830,14 +843,12 @@ It is broken for ie11 if you are not polyfilling the `new Event` constructor
830
843
  ## 0.3.0
831
844
 
832
845
  - [minor][ce4e1b4780](https://bitbucket.org/atlassian/atlaskit-mk-2/commits/ce4e1b4780):
833
-
834
846
  - zIndex prop now accepts string and number values. Portal consumers can now use css values like
835
847
  "unset" if needed.
836
848
 
837
849
  ## 0.2.2
838
850
 
839
851
  - [patch][98e11001ff](https://bitbucket.org/atlassian/atlaskit-mk-2/commits/98e11001ff):
840
-
841
852
  - Removes duplicate babel-runtime dependency
842
853
 
843
854
  ## 0.2.1
@@ -856,7 +867,6 @@ It is broken for ie11 if you are not polyfilling the `new Event` constructor
856
867
  ## 0.2.0
857
868
 
858
869
  - [minor][76299208e6](https://bitbucket.org/atlassian/atlaskit-mk-2/commits/76299208e6):
859
-
860
870
  - Drop ES5 from all the flow modules
861
871
 
862
872
  ### Dropping CJS support in all @atlaskit packages
@@ -901,7 +911,6 @@ It is broken for ie11 if you are not polyfilling the `new Event` constructor
901
911
  ## 0.1.0
902
912
 
903
913
  - [minor][27cacd44ab](https://bitbucket.org/atlassian/atlaskit-mk-2/commits/27cacd44ab):
904
-
905
914
  - Components inside Portal render after portal container element is attached to the DOM
906
915
 
907
916
  ## 0.0.18
@@ -956,13 +965,11 @@ It is broken for ie11 if you are not polyfilling the `new Event` constructor
956
965
  ## 0.0.14
957
966
 
958
967
  - [patch][1fb2c2a](https://bitbucket.org/atlassian/atlaskit-mk-2/commits/1fb2c2a):
959
-
960
968
  - Fixed issue where tooltips and modals would initially render in the wrong location
961
969
 
962
970
  ## 0.0.13
963
971
 
964
972
  - [patch][3f5a4dd](https://bitbucket.org/atlassian/atlaskit-mk-2/commits/3f5a4dd):
965
-
966
973
  - Replaces our own check for dom in ssr with exenv package
967
974
 
968
975
  ## 0.0.12
@@ -9,6 +9,8 @@ exports.default = InternalPortalNew;
9
9
  var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));
10
10
  var _react = _interopRequireWildcard(require("react"));
11
11
  var _reactDom = require("react-dom");
12
+ var _appProvider = require("@atlaskit/app-provider");
13
+ var _platformFeatureFlags = require("@atlaskit/platform-feature-flags");
12
14
  var _useIsomorphicLayoutEffect = require("../hooks/use-isomorphic-layout-effect");
13
15
  var _portalDomUtils = require("../utils/portal-dom-utils");
14
16
  function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r = new WeakMap(), n = new WeakMap(); return (_interopRequireWildcard = function _interopRequireWildcard(e, t) { if (!t && e && e.__esModule) return e; var o, i, f = { __proto__: null, default: e }; if (null === e || "object" != _typeof(e) && "function" != typeof e) return f; if (o = t ? n : r) { if (o.has(e)) return o.get(e); o.set(e, f); } for (var _t in e) "default" !== _t && {}.hasOwnProperty.call(e, _t) && ((i = (o = Object.defineProperty) && Object.getOwnPropertyDescriptor(e, _t)) && (i.get || i.set) ? o(f, _t, i) : f[_t] = e[_t]); return f; })(e, t); }
@@ -19,6 +21,7 @@ function InternalPortalNew(props) {
19
21
  _useState2 = (0, _slicedToArray2.default)(_useState, 2),
20
22
  atlaskitPortal = _useState2[0],
21
23
  setAtlaskitPortal = _useState2[1];
24
+ var colorMode = (0, _appProvider.useColorMode)();
22
25
  (0, _useIsomorphicLayoutEffect.useIsomorphicLayoutEffect)(function () {
23
26
  var tempPortalContainer = (0, _portalDomUtils.createAtlaskitPortal)(zIndex);
24
27
  setAtlaskitPortal(tempPortalContainer);
@@ -42,6 +45,8 @@ function InternalPortalNew(props) {
42
45
  */
43
46
  var suspendedChildren = /*#__PURE__*/_react.default.createElement(_react.Suspense, {
44
47
  fallback: null
45
- }, children);
48
+ }, colorMode && (0, _platformFeatureFlags.fg)('platform_dst_subtree_theming') ? /*#__PURE__*/_react.default.createElement(_appProvider.ThemeProvider, {
49
+ defaultColorMode: colorMode
50
+ }, children) : children);
46
51
  return atlaskitPortal ? /*#__PURE__*/(0, _reactDom.createPortal)(suspendedChildren, atlaskitPortal) : null;
47
52
  }
@@ -1,18 +1,23 @@
1
1
  "use strict";
2
2
 
3
+ var _typeof = require("@babel/runtime/helpers/typeof");
3
4
  Object.defineProperty(exports, "__esModule", {
4
5
  value: true
5
6
  });
6
7
  exports.default = InternalPortal;
7
- var _react = require("react");
8
+ var _react = _interopRequireWildcard(require("react"));
8
9
  var _reactDom = require("react-dom");
10
+ var _appProvider = require("@atlaskit/app-provider");
11
+ var _platformFeatureFlags = require("@atlaskit/platform-feature-flags");
9
12
  var _portalDomUtils = require("../utils/portal-dom-utils");
13
+ function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r = new WeakMap(), n = new WeakMap(); return (_interopRequireWildcard = function _interopRequireWildcard(e, t) { if (!t && e && e.__esModule) return e; var o, i, f = { __proto__: null, default: e }; if (null === e || "object" != _typeof(e) && "function" != typeof e) return f; if (o = t ? n : r) { if (o.has(e)) return o.get(e); o.set(e, f); } for (var _t in e) "default" !== _t && {}.hasOwnProperty.call(e, _t) && ((i = (o = Object.defineProperty) && Object.getOwnPropertyDescriptor(e, _t)) && (i.get || i.set) ? o(f, _t, i) : f[_t] = e[_t]); return f; })(e, t); }
10
14
  function InternalPortal(props) {
11
15
  var zIndex = props.zIndex,
12
16
  children = props.children;
13
17
  var container = (0, _react.useMemo)(function () {
14
18
  return (0, _portalDomUtils.createContainer)(zIndex);
15
19
  }, [zIndex]);
20
+ var colorMode = (0, _appProvider.useColorMode)();
16
21
 
17
22
  // This is in the render method instead of useEffect so that
18
23
  // the portal will be added to the DOM before the children render.
@@ -24,5 +29,7 @@ function InternalPortal(props) {
24
29
  (0, _portalDomUtils.removePortalContainer)(container);
25
30
  };
26
31
  }, [container]);
27
- return /*#__PURE__*/(0, _reactDom.createPortal)(children, container);
32
+ return /*#__PURE__*/(0, _reactDom.createPortal)(colorMode && (0, _platformFeatureFlags.fg)('platform_dst_subtree_theming') ? /*#__PURE__*/_react.default.createElement(_appProvider.ThemeProvider, {
33
+ defaultColorMode: colorMode
34
+ }, children) : children, container);
28
35
  }
@@ -1,5 +1,7 @@
1
1
  import React, { Suspense, useState } from 'react';
2
2
  import { createPortal } from 'react-dom';
3
+ import { ThemeProvider, useColorMode } from '@atlaskit/app-provider';
4
+ import { fg } from '@atlaskit/platform-feature-flags';
3
5
  import { useIsomorphicLayoutEffect } from '../hooks/use-isomorphic-layout-effect';
4
6
  import { createAtlaskitPortal, createPortalParent } from '../utils/portal-dom-utils';
5
7
  export default function InternalPortalNew(props) {
@@ -8,6 +10,7 @@ export default function InternalPortalNew(props) {
8
10
  children
9
11
  } = props;
10
12
  const [atlaskitPortal, setAtlaskitPortal] = useState(null);
13
+ const colorMode = useColorMode();
11
14
  useIsomorphicLayoutEffect(() => {
12
15
  const tempPortalContainer = createAtlaskitPortal(zIndex);
13
16
  setAtlaskitPortal(tempPortalContainer);
@@ -31,6 +34,8 @@ export default function InternalPortalNew(props) {
31
34
  */
32
35
  const suspendedChildren = /*#__PURE__*/React.createElement(Suspense, {
33
36
  fallback: null
34
- }, children);
37
+ }, colorMode && fg('platform_dst_subtree_theming') ? /*#__PURE__*/React.createElement(ThemeProvider, {
38
+ defaultColorMode: colorMode
39
+ }, children) : children);
35
40
  return atlaskitPortal ? /*#__PURE__*/createPortal(suspendedChildren, atlaskitPortal) : null;
36
41
  }
@@ -1,5 +1,7 @@
1
- import { useEffect, useMemo } from 'react';
1
+ import React, { useEffect, useMemo } from 'react';
2
2
  import { createPortal } from 'react-dom';
3
+ import { ThemeProvider, useColorMode } from '@atlaskit/app-provider';
4
+ import { fg } from '@atlaskit/platform-feature-flags';
3
5
  import { appendPortalContainerIfNotAppended, createContainer, removePortalContainer } from '../utils/portal-dom-utils';
4
6
  export default function InternalPortal(props) {
5
7
  const {
@@ -7,6 +9,7 @@ export default function InternalPortal(props) {
7
9
  children
8
10
  } = props;
9
11
  const container = useMemo(() => createContainer(zIndex), [zIndex]);
12
+ const colorMode = useColorMode();
10
13
 
11
14
  // This is in the render method instead of useEffect so that
12
15
  // the portal will be added to the DOM before the children render.
@@ -18,5 +21,7 @@ export default function InternalPortal(props) {
18
21
  removePortalContainer(container);
19
22
  };
20
23
  }, [container]);
21
- return /*#__PURE__*/createPortal(children, container);
24
+ return /*#__PURE__*/createPortal(colorMode && fg('platform_dst_subtree_theming') ? /*#__PURE__*/React.createElement(ThemeProvider, {
25
+ defaultColorMode: colorMode
26
+ }, children) : children, container);
22
27
  }
@@ -1,6 +1,8 @@
1
1
  import _slicedToArray from "@babel/runtime/helpers/slicedToArray";
2
2
  import React, { Suspense, useState } from 'react';
3
3
  import { createPortal } from 'react-dom';
4
+ import { ThemeProvider, useColorMode } from '@atlaskit/app-provider';
5
+ import { fg } from '@atlaskit/platform-feature-flags';
4
6
  import { useIsomorphicLayoutEffect } from '../hooks/use-isomorphic-layout-effect';
5
7
  import { createAtlaskitPortal, createPortalParent } from '../utils/portal-dom-utils';
6
8
  export default function InternalPortalNew(props) {
@@ -10,6 +12,7 @@ export default function InternalPortalNew(props) {
10
12
  _useState2 = _slicedToArray(_useState, 2),
11
13
  atlaskitPortal = _useState2[0],
12
14
  setAtlaskitPortal = _useState2[1];
15
+ var colorMode = useColorMode();
13
16
  useIsomorphicLayoutEffect(function () {
14
17
  var tempPortalContainer = createAtlaskitPortal(zIndex);
15
18
  setAtlaskitPortal(tempPortalContainer);
@@ -33,6 +36,8 @@ export default function InternalPortalNew(props) {
33
36
  */
34
37
  var suspendedChildren = /*#__PURE__*/React.createElement(Suspense, {
35
38
  fallback: null
36
- }, children);
39
+ }, colorMode && fg('platform_dst_subtree_theming') ? /*#__PURE__*/React.createElement(ThemeProvider, {
40
+ defaultColorMode: colorMode
41
+ }, children) : children);
37
42
  return atlaskitPortal ? /*#__PURE__*/createPortal(suspendedChildren, atlaskitPortal) : null;
38
43
  }
@@ -1,5 +1,7 @@
1
- import { useEffect, useMemo } from 'react';
1
+ import React, { useEffect, useMemo } from 'react';
2
2
  import { createPortal } from 'react-dom';
3
+ import { ThemeProvider, useColorMode } from '@atlaskit/app-provider';
4
+ import { fg } from '@atlaskit/platform-feature-flags';
3
5
  import { appendPortalContainerIfNotAppended, createContainer, removePortalContainer } from '../utils/portal-dom-utils';
4
6
  export default function InternalPortal(props) {
5
7
  var zIndex = props.zIndex,
@@ -7,6 +9,7 @@ export default function InternalPortal(props) {
7
9
  var container = useMemo(function () {
8
10
  return createContainer(zIndex);
9
11
  }, [zIndex]);
12
+ var colorMode = useColorMode();
10
13
 
11
14
  // This is in the render method instead of useEffect so that
12
15
  // the portal will be added to the DOM before the children render.
@@ -18,5 +21,7 @@ export default function InternalPortal(props) {
18
21
  removePortalContainer(container);
19
22
  };
20
23
  }, [container]);
21
- return /*#__PURE__*/createPortal(children, container);
24
+ return /*#__PURE__*/createPortal(colorMode && fg('platform_dst_subtree_theming') ? /*#__PURE__*/React.createElement(ThemeProvider, {
25
+ defaultColorMode: colorMode
26
+ }, children) : children, container);
22
27
  }
@@ -1,4 +1,4 @@
1
- import { type ReactPortal } from 'react';
1
+ import React, { type ReactPortal } from 'react';
2
2
  interface InternalPortalProps {
3
3
  children: React.ReactNode;
4
4
  zIndex: number | string;
@@ -1,3 +1,3 @@
1
1
  import React from 'react';
2
2
  import type { PortalProps } from './types';
3
- export default function Portal({ zIndex, children, mountStrategy }: PortalProps): React.JSX.Element | null;
3
+ export default function Portal({ zIndex, children, mountStrategy, }: PortalProps): React.JSX.Element | null;
@@ -1,4 +1,4 @@
1
- import { type ReactPortal } from 'react';
1
+ import React, { type ReactPortal } from 'react';
2
2
  interface InternalPortalProps {
3
3
  children: React.ReactNode;
4
4
  zIndex: number | string;
@@ -1,3 +1,3 @@
1
1
  import React from 'react';
2
2
  import type { PortalProps } from './types';
3
- export default function Portal({ zIndex, children, mountStrategy }: PortalProps): React.JSX.Element | null;
3
+ export default function Portal({ zIndex, children, mountStrategy, }: PortalProps): React.JSX.Element | null;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaskit/portal",
3
- "version": "5.1.8",
3
+ "version": "5.2.1",
4
4
  "description": "A wrapper for rendering components in React portals.",
5
5
  "publishConfig": {
6
6
  "registry": "https://registry.npmjs.org/"
@@ -32,6 +32,7 @@
32
32
  }
33
33
  },
34
34
  "dependencies": {
35
+ "@atlaskit/app-provider": "^4.0.0",
35
36
  "@atlaskit/platform-feature-flags": "^1.1.0",
36
37
  "@atlaskit/theme": "^21.0.0",
37
38
  "@babel/runtime": "^7.0.0"
@@ -44,27 +45,24 @@
44
45
  "@af/accessibility-testing": "workspace:^",
45
46
  "@af/integration-testing": "workspace:^",
46
47
  "@af/visual-regression": "workspace:^",
47
- "@atlaskit/button": "^23.4.0",
48
- "@atlaskit/code": "^17.2.0",
49
- "@atlaskit/css": "^0.14.0",
50
- "@atlaskit/docs": "^11.1.0",
51
- "@atlaskit/ds-lib": "^5.1.0",
52
- "@atlaskit/flag": "^17.4.0",
53
- "@atlaskit/icon": "^28.2.0",
48
+ "@atlaskit/button": "^23.9.0",
49
+ "@atlaskit/code": "^17.4.0",
50
+ "@atlaskit/css": "^0.19.0",
51
+ "@atlaskit/docs": "^11.3.0",
52
+ "@atlaskit/flag": "^17.8.0",
53
+ "@atlaskit/icon": "^30.0.0",
54
54
  "@atlaskit/inline-dialog": "^18.0.0",
55
- "@atlaskit/link": "^3.2.0",
56
- "@atlaskit/modal-dialog": "^14.3.0",
57
- "@atlaskit/onboarding": "^14.4.0",
58
- "@atlaskit/primitives": "^14.15.0",
59
- "@atlaskit/section-message": "^8.7.0",
60
- "@atlaskit/ssr": "workspace:^",
61
- "@atlaskit/tokens": "^6.3.0",
62
- "@atlaskit/tooltip": "^20.4.0",
63
- "@atlassian/feature-flags-test-utils": "^0.3.0",
64
- "@atlassian/ssr-tests": "^0.3.0",
65
- "@compiled/react": "^0.18.3",
66
- "@testing-library/react": "^13.4.0",
67
- "@testing-library/react-hooks": "^8.0.1",
55
+ "@atlaskit/link": "^3.3.0",
56
+ "@atlaskit/modal-dialog": "^14.10.0",
57
+ "@atlaskit/onboarding": "^14.5.0",
58
+ "@atlaskit/primitives": "^18.0.0",
59
+ "@atlaskit/section-message": "^8.12.0",
60
+ "@atlaskit/tokens": "^11.0.0",
61
+ "@atlaskit/tooltip": "^20.14.0",
62
+ "@atlassian/feature-flags-test-utils": "^1.0.0",
63
+ "@atlassian/ssr-tests": "workspace:^",
64
+ "@compiled/react": "^0.18.6",
65
+ "@testing-library/react": "^16.3.0",
68
66
  "bind-event-listener": "^3.0.0",
69
67
  "raf-stub": "^2.0.1"
70
68
  },
@@ -97,6 +95,9 @@
97
95
  "platform-feature-flags": {
98
96
  "platform_design_system_team_portal_logic_r18_fix": {
99
97
  "type": "boolean"
98
+ },
99
+ "platform_dst_subtree_theming": {
100
+ "type": "boolean"
100
101
  }
101
102
  }
102
103
  }