@atlaskit/portal 5.1.7 → 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,25 @@
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
+
16
+ ## 5.1.8
17
+
18
+ ### Patch Changes
19
+
20
+ - [`042005250a589`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/042005250a589) -
21
+ Typescript fixes
22
+
3
23
  ## 5.1.7
4
24
 
5
25
  ### Patch Changes
@@ -557,7 +577,6 @@
557
577
 
558
578
  Remove namespace imports from React, ReactDom, and PropTypes- Updated dependencies
559
579
  [6548261c9a](https://bitbucket.org/atlassian/atlassian-frontend/commits/6548261c9a):
560
-
561
580
  - @atlaskit/docs@8.3.2
562
581
  - @atlaskit/visual-regression@0.1.9
563
582
  - @atlaskit/button@13.3.7
@@ -701,7 +720,6 @@ It is broken for ie11 if you are not polyfilling the `new Event` constructor
701
720
  - [patch][18dfac7332](https://bitbucket.org/atlassian/atlaskit-mk-2/commits/18dfac7332):
702
721
 
703
722
  In this PR, we are:
704
-
705
723
  - Re-introducing dist build folders
706
724
  - Adding back cjs
707
725
  - Replacing es5 by cjs and es2015 by esm
@@ -770,14 +788,12 @@ It is broken for ie11 if you are not polyfilling the `new Event` constructor
770
788
  ## 3.0.1
771
789
 
772
790
  - [patch][b0ef06c685](https://bitbucket.org/atlassian/atlaskit-mk-2/commits/b0ef06c685):
773
-
774
791
  - This is just a safety release in case anything strange happened in in the previous one. See Pull
775
792
  Request #5942 for details
776
793
 
777
794
  ## 3.0.0
778
795
 
779
796
  - [major][dacfb81ca1](https://bitbucket.org/atlassian/atlaskit-mk-2/commits/dacfb81ca1):
780
-
781
797
  - @atlaskit/portal has been converted to Typescript. Typescript consumers will now get static type
782
798
  safety. Flow types are no longer provided. No API or behavioural changes.
783
799
 
@@ -796,14 +812,12 @@ It is broken for ie11 if you are not polyfilling the `new Event` constructor
796
812
  ## 2.0.0
797
813
 
798
814
  - [major][7c17b35107](https://bitbucket.org/atlassian/atlaskit-mk-2/commits/7c17b35107):
799
-
800
815
  - Updates react and react-dom peer dependencies to react@^16.8.0 and react-dom@^16.8.0. To use
801
816
  this package, please ensure you use at least this version of react and react-dom.
802
817
 
803
818
  ## 1.0.0
804
819
 
805
820
  - [major][5b6b4d6a0f](https://bitbucket.org/atlassian/atlaskit-mk-2/commits/5b6b4d6a0f):
806
-
807
821
  - This major release indicates that this package is no longer under dev preview but is ready for
808
822
  use
809
823
 
@@ -823,14 +837,12 @@ It is broken for ie11 if you are not polyfilling the `new Event` constructor
823
837
  ## 0.3.0
824
838
 
825
839
  - [minor][ce4e1b4780](https://bitbucket.org/atlassian/atlaskit-mk-2/commits/ce4e1b4780):
826
-
827
840
  - zIndex prop now accepts string and number values. Portal consumers can now use css values like
828
841
  "unset" if needed.
829
842
 
830
843
  ## 0.2.2
831
844
 
832
845
  - [patch][98e11001ff](https://bitbucket.org/atlassian/atlaskit-mk-2/commits/98e11001ff):
833
-
834
846
  - Removes duplicate babel-runtime dependency
835
847
 
836
848
  ## 0.2.1
@@ -849,7 +861,6 @@ It is broken for ie11 if you are not polyfilling the `new Event` constructor
849
861
  ## 0.2.0
850
862
 
851
863
  - [minor][76299208e6](https://bitbucket.org/atlassian/atlaskit-mk-2/commits/76299208e6):
852
-
853
864
  - Drop ES5 from all the flow modules
854
865
 
855
866
  ### Dropping CJS support in all @atlaskit packages
@@ -894,7 +905,6 @@ It is broken for ie11 if you are not polyfilling the `new Event` constructor
894
905
  ## 0.1.0
895
906
 
896
907
  - [minor][27cacd44ab](https://bitbucket.org/atlassian/atlaskit-mk-2/commits/27cacd44ab):
897
-
898
908
  - Components inside Portal render after portal container element is attached to the DOM
899
909
 
900
910
  ## 0.0.18
@@ -949,13 +959,11 @@ It is broken for ie11 if you are not polyfilling the `new Event` constructor
949
959
  ## 0.0.14
950
960
 
951
961
  - [patch][1fb2c2a](https://bitbucket.org/atlassian/atlaskit-mk-2/commits/1fb2c2a):
952
-
953
962
  - Fixed issue where tooltips and modals would initially render in the wrong location
954
963
 
955
964
  ## 0.0.13
956
965
 
957
966
  - [patch][3f5a4dd](https://bitbucket.org/atlassian/atlaskit-mk-2/commits/3f5a4dd):
958
-
959
967
  - Replaces our own check for dom in ssr with exenv package
960
968
 
961
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
  }
@@ -73,6 +73,7 @@ var createAtlaskitPortal = exports.createAtlaskitPortal = function createAtlaski
73
73
  atlaskitportal.style.zIndex = "".concat(zIndex);
74
74
  return atlaskitportal;
75
75
  }
76
+ return;
76
77
  };
77
78
  var createPortalParent = exports.createPortalParent = function createPortalParent() {
78
79
  //atlaskit-portal-container div
@@ -88,4 +89,5 @@ var createPortalParent = exports.createPortalParent = function createPortalParen
88
89
  }
89
90
  return parentElement;
90
91
  }
92
+ return;
91
93
  };
@@ -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
  }
@@ -68,6 +68,7 @@ export const createAtlaskitPortal = zIndex => {
68
68
  atlaskitportal.style.zIndex = `${zIndex}`;
69
69
  return atlaskitportal;
70
70
  }
71
+ return;
71
72
  };
72
73
  export const createPortalParent = () => {
73
74
  //atlaskit-portal-container div
@@ -83,4 +84,5 @@ export const createPortalParent = () => {
83
84
  }
84
85
  return parentElement;
85
86
  }
87
+ return;
86
88
  };
@@ -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
  }
@@ -68,6 +68,7 @@ export var createAtlaskitPortal = function createAtlaskitPortal(zIndex) {
68
68
  atlaskitportal.style.zIndex = "".concat(zIndex);
69
69
  return atlaskitportal;
70
70
  }
71
+ return;
71
72
  };
72
73
  export var createPortalParent = function createPortalParent() {
73
74
  //atlaskit-portal-container div
@@ -83,4 +84,5 @@ export var createPortalParent = function createPortalParent() {
83
84
  }
84
85
  return parentElement;
85
86
  }
87
+ return;
86
88
  };
@@ -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.7",
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.0.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.14.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
  }