@atlaskit/portal 5.1.8 → 5.2.0

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,18 @@
1
1
  # @atlaskit/portal
2
2
 
3
+ ## 5.2.0
4
+
5
+ ### Minor Changes
6
+
7
+ - [`a45bf2e086e1d`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/a45bf2e086e1d) -
8
+ We are testing AppProvider subtree theming capabilities behind a feature flag. This is still in
9
+ development but working under minimal conditions. If this change is successful it will be
10
+ available in a later release.
11
+
12
+ ### Patch Changes
13
+
14
+ - Updated dependencies
15
+
3
16
  ## 5.1.8
4
17
 
5
18
  ### Patch Changes
@@ -564,7 +577,6 @@
564
577
 
565
578
  Remove namespace imports from React, ReactDom, and PropTypes- Updated dependencies
566
579
  [6548261c9a](https://bitbucket.org/atlassian/atlassian-frontend/commits/6548261c9a):
567
-
568
580
  - @atlaskit/docs@8.3.2
569
581
  - @atlaskit/visual-regression@0.1.9
570
582
  - @atlaskit/button@13.3.7
@@ -708,7 +720,6 @@ It is broken for ie11 if you are not polyfilling the `new Event` constructor
708
720
  - [patch][18dfac7332](https://bitbucket.org/atlassian/atlaskit-mk-2/commits/18dfac7332):
709
721
 
710
722
  In this PR, we are:
711
-
712
723
  - Re-introducing dist build folders
713
724
  - Adding back cjs
714
725
  - Replacing es5 by cjs and es2015 by esm
@@ -777,14 +788,12 @@ It is broken for ie11 if you are not polyfilling the `new Event` constructor
777
788
  ## 3.0.1
778
789
 
779
790
  - [patch][b0ef06c685](https://bitbucket.org/atlassian/atlaskit-mk-2/commits/b0ef06c685):
780
-
781
791
  - This is just a safety release in case anything strange happened in in the previous one. See Pull
782
792
  Request #5942 for details
783
793
 
784
794
  ## 3.0.0
785
795
 
786
796
  - [major][dacfb81ca1](https://bitbucket.org/atlassian/atlaskit-mk-2/commits/dacfb81ca1):
787
-
788
797
  - @atlaskit/portal has been converted to Typescript. Typescript consumers will now get static type
789
798
  safety. Flow types are no longer provided. No API or behavioural changes.
790
799
 
@@ -803,14 +812,12 @@ It is broken for ie11 if you are not polyfilling the `new Event` constructor
803
812
  ## 2.0.0
804
813
 
805
814
  - [major][7c17b35107](https://bitbucket.org/atlassian/atlaskit-mk-2/commits/7c17b35107):
806
-
807
815
  - Updates react and react-dom peer dependencies to react@^16.8.0 and react-dom@^16.8.0. To use
808
816
  this package, please ensure you use at least this version of react and react-dom.
809
817
 
810
818
  ## 1.0.0
811
819
 
812
820
  - [major][5b6b4d6a0f](https://bitbucket.org/atlassian/atlaskit-mk-2/commits/5b6b4d6a0f):
813
-
814
821
  - This major release indicates that this package is no longer under dev preview but is ready for
815
822
  use
816
823
 
@@ -830,14 +837,12 @@ It is broken for ie11 if you are not polyfilling the `new Event` constructor
830
837
  ## 0.3.0
831
838
 
832
839
  - [minor][ce4e1b4780](https://bitbucket.org/atlassian/atlaskit-mk-2/commits/ce4e1b4780):
833
-
834
840
  - zIndex prop now accepts string and number values. Portal consumers can now use css values like
835
841
  "unset" if needed.
836
842
 
837
843
  ## 0.2.2
838
844
 
839
845
  - [patch][98e11001ff](https://bitbucket.org/atlassian/atlaskit-mk-2/commits/98e11001ff):
840
-
841
846
  - Removes duplicate babel-runtime dependency
842
847
 
843
848
  ## 0.2.1
@@ -856,7 +861,6 @@ It is broken for ie11 if you are not polyfilling the `new Event` constructor
856
861
  ## 0.2.0
857
862
 
858
863
  - [minor][76299208e6](https://bitbucket.org/atlassian/atlaskit-mk-2/commits/76299208e6):
859
-
860
864
  - Drop ES5 from all the flow modules
861
865
 
862
866
  ### Dropping CJS support in all @atlaskit packages
@@ -901,7 +905,6 @@ It is broken for ie11 if you are not polyfilling the `new Event` constructor
901
905
  ## 0.1.0
902
906
 
903
907
  - [minor][27cacd44ab](https://bitbucket.org/atlassian/atlaskit-mk-2/commits/27cacd44ab):
904
-
905
908
  - Components inside Portal render after portal container element is attached to the DOM
906
909
 
907
910
  ## 0.0.18
@@ -956,13 +959,11 @@ It is broken for ie11 if you are not polyfilling the `new Event` constructor
956
959
  ## 0.0.14
957
960
 
958
961
  - [patch][1fb2c2a](https://bitbucket.org/atlassian/atlaskit-mk-2/commits/1fb2c2a):
959
-
960
962
  - Fixed issue where tooltips and modals would initially render in the wrong location
961
963
 
962
964
  ## 0.0.13
963
965
 
964
966
  - [patch][3f5a4dd](https://bitbucket.org/atlassian/atlaskit-mk-2/commits/3f5a4dd):
965
-
966
967
  - Replaces our own check for dom in ssr with exenv package
967
968
 
968
969
  ## 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.0",
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": "^3.3.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.2.0",
52
+ "@atlaskit/flag": "^17.8.0",
53
+ "@atlaskit/icon": "^29.4.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.9.0",
57
+ "@atlaskit/onboarding": "^14.5.0",
58
+ "@atlaskit/primitives": "^17.0.0",
59
+ "@atlaskit/section-message": "^8.12.0",
60
+ "@atlaskit/tokens": "^9.1.0",
61
+ "@atlaskit/tooltip": "^20.13.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
  }