@atlaskit/top-layer 6.2.2 → 6.2.4

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/top-layer
2
2
 
3
+ ## 6.2.4
4
+
5
+ ### Patch Changes
6
+
7
+ - [`4247678302a95`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/4247678302a95) -
8
+ Fixed server-side rendering errors and warnings in the top-layer popover, dialog and popper paths
9
+ (`platform-dst-top-layer`).
10
+ - Updated dependencies
11
+
12
+ ## 6.2.3
13
+
14
+ ### Patch Changes
15
+
16
+ - [`aaf461aabb51c`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/aaf461aabb51c) -
17
+ `Popover` and `Dialog` now use the default text colour (`color.text`). Before, the browser gave
18
+ them its own default (`CanvasText`). This only affects content that does not set its own text
19
+ colour. In light and dark mode, that content now looks the same as content rendered in a portal
20
+ under `<body>`.
21
+
3
22
  ## 6.2.2
4
23
 
5
24
  ### Patch Changes
@@ -27,6 +27,7 @@
27
27
  ._2hwx1wug{margin-right:auto}
28
28
  ._6hkqidpf:defined:defined:defined{inset-block-end:0}
29
29
  ._722r1ule[open][open][open]{display:block}
30
+ ._9kefi7uo:defined:defined:defined{color:var(--ds-text,#292a2e)}
30
31
  ._ao8dglyw:defined:defined:defined{max-height:none}
31
32
  ._dbnbze3t:defined:defined:defined{padding-block-end:var(--ds-space-0,0)}
32
33
  ._goh41wug:defined:defined:defined{pointer-events:auto}
@@ -14,14 +14,16 @@ var _react2 = require("@compiled/react");
14
14
  var _bindEventListener = require("bind-event-listener");
15
15
  var _mergeRefs = _interopRequireDefault(require("@atlaskit/ds-lib/merge-refs"));
16
16
  var _noop = _interopRequireDefault(require("@atlaskit/ds-lib/noop"));
17
+ var _useLayoutEffect = require("@atlaskit/ds-lib/use-layout-effect");
17
18
  var _useNotifyOpenLayerObserver = require("@atlaskit/layering/use-notify-open-layer-observer");
18
19
  var _useAnimatedVisibility = require("../internal/use-animated-visibility");
19
20
  var _useFocusWrap = require("../internal/use-focus-wrap");
20
21
  var _useSafariEscapeFix2 = require("../internal/use-safari-escape-fix");
21
22
  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); }
22
- // Surface reset. KEEP IN SYNC with `surfaceResetStyles` in `popover/popover.tsx`.
23
+ // Surface reset, including `color` (the UA `dialog` rule sets `CanvasText`).
24
+ // KEEP IN SYNC with `surfaceResetStyles` in `popover/popover.tsx`.
23
25
  var surfaceResetStyles = {
24
- root: "_goh41wug _ux9u4jg8 _19w84jg8 _1f6b4jg8 _tcxkv2br _m466idpf _1b80glyw"
26
+ root: "_goh41wug _ux9u4jg8 _19w84jg8 _1f6b4jg8 _tcxkv2br _m466idpf _1b80glyw _9kefi7uo"
25
27
  };
26
28
  true;
27
29
  var dialogStyles = {
@@ -82,7 +84,7 @@ var Dialog = exports.Dialog = /*#__PURE__*/(0, _react.forwardRef)(function Dialo
82
84
  var dismissedByRef = (0, _react.useRef)(dismissedBy);
83
85
  var onCloseRef = (0, _react.useRef)(onClose);
84
86
  // Keep native event handlers stable while ensuring they read the latest committed props.
85
- (0, _react.useLayoutEffect)(function () {
87
+ (0, _useLayoutEffect.useLayoutEffect)(function () {
86
88
  dismissedByRef.current = dismissedBy;
87
89
  onCloseRef.current = onClose;
88
90
  }, [dismissedBy, onClose]);
@@ -101,7 +103,7 @@ var Dialog = exports.Dialog = /*#__PURE__*/(0, _react.forwardRef)(function Dialo
101
103
  // Ordering is important: bind native lifecycle listeners before the later
102
104
  // layout effect calls showModal() or close(), because `beforetoggle` fires
103
105
  // synchronously during those calls.
104
- (0, _react.useLayoutEffect)(function () {
106
+ (0, _useLayoutEffect.useLayoutEffect)(function () {
105
107
  if (!isMounted) {
106
108
  return;
107
109
  }
@@ -160,7 +162,7 @@ var Dialog = exports.Dialog = /*#__PURE__*/(0, _react.forwardRef)(function Dialo
160
162
  // No-op: no current use case for programmatic close via OpenLayerObserver.
161
163
  onClose: _noop.default
162
164
  });
163
- (0, _react.useLayoutEffect)(function () {
165
+ (0, _useLayoutEffect.useLayoutEffect)(function () {
164
166
  var dialog = ownRef.current;
165
167
  if (!dialog) {
166
168
  return;
@@ -4,8 +4,8 @@ Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
6
  exports.DialogScrollLock = DialogScrollLock;
7
- var _react = require("react");
8
7
  var _browserApis = require("@atlaskit/browser-apis");
8
+ var _useLayoutEffect = require("@atlaskit/ds-lib/use-layout-effect");
9
9
  /**
10
10
  * __DialogScrollLock__
11
11
  *
@@ -37,7 +37,7 @@ var _browserApis = require("@atlaskit/browser-apis");
37
37
  */
38
38
  function DialogScrollLock(_ref) {
39
39
  var isOpen = _ref.isOpen;
40
- (0, _react.useLayoutEffect)(function () {
40
+ (0, _useLayoutEffect.useLayoutEffect)(function () {
41
41
  var _getDocument;
42
42
  if (!isOpen) {
43
43
  return;
@@ -8,6 +8,7 @@ exports.useAnchoredPopoverAtPoint = useAnchoredPopoverAtPoint;
8
8
  var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
9
9
  var _objectWithoutProperties2 = _interopRequireDefault(require("@babel/runtime/helpers/objectWithoutProperties"));
10
10
  var _react = require("react");
11
+ var _useLayoutEffect = require("@atlaskit/ds-lib/use-layout-effect");
11
12
  var _useAnchoredPopover = require("./use-anchored-popover");
12
13
  var _excluded = ["getPoint", "isEnabled"];
13
14
  /**
@@ -97,7 +98,7 @@ function useAnchoredPopoverAtPoint(_ref2) {
97
98
  // effect must not depend on anything the delegated effect does not: a dependency
98
99
  // here alone re-creates the element without that hook writing an `anchor-name`
99
100
  // onto it, and positioning silently dies.
100
- (0, _react.useLayoutEffect)(function () {
101
+ (0, _useLayoutEffect.useLayoutEffect)(function () {
101
102
  if (!isEnabled) {
102
103
  return;
103
104
  }
@@ -6,6 +6,7 @@ Object.defineProperty(exports, "__esModule", {
6
6
  exports.useAnchoredPopover = useAnchoredPopover;
7
7
  var _react = require("react");
8
8
  var _useId = require("@atlaskit/ds-lib/use-id");
9
+ var _useLayoutEffect = require("@atlaskit/ds-lib/use-layout-effect");
9
10
  var _applyAnchorPositioning = require("./anchor-positioning/apply-anchor-positioning");
10
11
  var _anchoredPopoverSize = require("./anchored-popover-size");
11
12
  var _applyJavascriptFallbackPositioning = require("./javascript-fallback/apply-javascript-fallback-positioning");
@@ -214,7 +215,7 @@ function useAnchoredPopover(_ref3) {
214
215
  // element (the point hook remounts its `<div>`).
215
216
  var fallbackAnchorName = useNewAnchorName();
216
217
  var stablePlacement = useStablePlacement(placement);
217
- (0, _react.useLayoutEffect)(function () {
218
+ (0, _useLayoutEffect.useLayoutEffect)(function () {
218
219
  if (!isEnabled) {
219
220
  return;
220
221
  }
@@ -8,6 +8,7 @@ exports.useAnimatedVisibility = useAnimatedVisibility;
8
8
  var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));
9
9
  var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
10
10
  var _react = require("react");
11
+ var _useLayoutEffect = require("@atlaskit/ds-lib/use-layout-effect");
11
12
  var _isNativeElementOpen = require("./is-native-element-open");
12
13
  var _reducedMotion = require("./reduced-motion");
13
14
  function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
@@ -208,7 +209,7 @@ function useAnimatedVisibility(_ref4) {
208
209
  var onEnterFinishRef = (0, _react.useRef)(onEnterFinish);
209
210
  var onExitFinishRef = (0, _react.useRef)(onExitFinish);
210
211
  var willAnimateRef = (0, _react.useRef)(willAnimate);
211
- (0, _react.useLayoutEffect)(function () {
212
+ (0, _useLayoutEffect.useLayoutEffect)(function () {
212
213
  onEnterFinishRef.current = onEnterFinish;
213
214
  onExitFinishRef.current = onExitFinish;
214
215
  willAnimateRef.current = willAnimate;
@@ -324,7 +325,7 @@ function useAnimatedVisibility(_ref4) {
324
325
  onSettled: settleExit
325
326
  });
326
327
  }, [elementRef, settleExit]);
327
- (0, _react.useLayoutEffect)(function () {
328
+ (0, _useLayoutEffect.useLayoutEffect)(function () {
328
329
  return function () {
329
330
  // Prevent a pending animation or microtask from notifying after unmount.
330
331
  cancelExitSettlementRef.current();
@@ -25,6 +25,7 @@
25
25
  ._1s8uglyw:defined:defined:defined{rotate:none}
26
26
  ._1s9z1a5r{transition-behavior:allow-discrete}
27
27
  ._1yd01wug:defined:defined:defined{min-width:auto}
28
+ ._9kefi7uo:defined:defined:defined{color:var(--ds-text,#292a2e)}
28
29
  ._ao8dglyw:defined:defined:defined{max-height:none}
29
30
  ._az2pidpf:defined:defined:defined{padding-top:0}
30
31
  ._b2a9idpf:defined:defined:defined{margin-top:0}
@@ -14,6 +14,7 @@ var _react2 = require("@compiled/react");
14
14
  var _bindEventListener = require("bind-event-listener");
15
15
  var _mergeRefs = _interopRequireDefault(require("@atlaskit/ds-lib/merge-refs"));
16
16
  var _once = _interopRequireDefault(require("@atlaskit/ds-lib/once"));
17
+ var _useLayoutEffect = require("@atlaskit/ds-lib/use-layout-effect");
17
18
  var _useNotifyOpenLayerObserver = require("@atlaskit/layering/use-notify-open-layer-observer");
18
19
  var _isNativeElementOpen = require("../internal/is-native-element-open");
19
20
  var _resolvePlacement2 = require("../internal/resolve-placement");
@@ -62,14 +63,19 @@ var supportsPopoverHint = (0, _once.default)(function () {
62
63
  *
63
64
  * The host is still a DOM child of its trigger for inheritance, so it inherits
64
65
  * values like `pointer-events: none` or `white-space: nowrap`. Resets them to
65
- * what `<body>` gave the portal path. `color`, `font` and direction still inherit.
66
+ * what `<body>` gave the portal path. `font` and direction still inherit.
66
67
  * Not `all: initial`: that would also override the UA `[popover]` rules.
67
68
  *
69
+ * `color` is a reset too: the UA `[popover]` rule sets `color: CanvasText`, so
70
+ * the host never inherits a colour. `color.text` is what `<body>` gave the portal
71
+ * path. Not `inherit`, which would take the trigger's colour (for example a link).
72
+ * See `notes/decisions/surface-reset-color.md`.
73
+ *
68
74
  * KEEP IN SYNC with `dialog/dialog-content.tsx` (ADS forbids shared styles).
69
75
  * The `satisfies` check below catches drift.
70
76
  */
71
77
  var surfaceResetStyles = {
72
- root: "_goh41wug _ux9u4jg8 _19w84jg8 _1f6b4jg8 _tcxkv2br _m466idpf _1b80glyw"
78
+ root: "_goh41wug _ux9u4jg8 _19w84jg8 _1f6b4jg8 _tcxkv2br _m466idpf _1b80glyw _9kefi7uo"
73
79
  };
74
80
  true;
75
81
  var styles = {
@@ -167,7 +173,7 @@ var Popover = exports.Popover = /*#__PURE__*/(0, _react.forwardRef)(function Pop
167
173
  // Keep the semantic callback current without rebinding native lifecycle
168
174
  // listeners during the same commit that calls showPopover()/hidePopover().
169
175
  var onCloseRef = (0, _react.useRef)(onClose);
170
- (0, _react.useLayoutEffect)(function () {
176
+ (0, _useLayoutEffect.useLayoutEffect)(function () {
171
177
  onCloseRef.current = onClose;
172
178
  }, [onClose]);
173
179
 
@@ -290,7 +296,7 @@ var Popover = exports.Popover = /*#__PURE__*/(0, _react.forwardRef)(function Pop
290
296
  // first dispatch, dropping the `focusRestorationTargetRef` snapshot
291
297
  // and breaking nested-popover focus restoration on close. React runs
292
298
  // layout effects in source order on the same commit.
293
- (0, _react.useLayoutEffect)(function () {
299
+ (0, _useLayoutEffect.useLayoutEffect)(function () {
294
300
  var element = ownRef.current;
295
301
  if (!element) {
296
302
  return;
@@ -339,7 +345,7 @@ var Popover = exports.Popover = /*#__PURE__*/(0, _react.forwardRef)(function Pop
339
345
  // Show/hide based on isOpen. `showPopover`/`hidePopover` are no-ops when
340
346
  // already in the target state. Try/catch guards `InvalidStateError` on
341
347
  // disconnected elements (StrictMode/concurrent/unmount edge cases).
342
- (0, _react.useLayoutEffect)(function () {
348
+ (0, _useLayoutEffect.useLayoutEffect)(function () {
343
349
  var element = ownRef.current;
344
350
  if (!element) {
345
351
  return;
@@ -27,6 +27,7 @@
27
27
  ._2hwx1wug{margin-right:auto}
28
28
  ._6hkqidpf:defined:defined:defined{inset-block-end:0}
29
29
  ._722r1ule[open][open][open]{display:block}
30
+ ._9kefi7uo:defined:defined:defined{color:var(--ds-text,#292a2e)}
30
31
  ._ao8dglyw:defined:defined:defined{max-height:none}
31
32
  ._dbnbze3t:defined:defined:defined{padding-block-end:var(--ds-space-0,0)}
32
33
  ._goh41wug:defined:defined:defined{pointer-events:auto}
@@ -1,18 +1,20 @@
1
1
  /* dialog-content.tsx generated by @compiled/babel-plugin v3.0.2 */
2
2
  import "./dialog-content.compiled.css";
3
3
  import { ax, ix } from "@compiled/react/runtime";
4
- import React, { forwardRef, useCallback, useId, useLayoutEffect, useRef } from 'react';
4
+ import React, { forwardRef, useCallback, useId, useRef } from 'react';
5
5
  import { cx } from '@compiled/react';
6
6
  import { bindAll } from 'bind-event-listener';
7
7
  import mergeRefs from '@atlaskit/ds-lib/merge-refs';
8
8
  import noop from '@atlaskit/ds-lib/noop';
9
+ import { useLayoutEffect } from '@atlaskit/ds-lib/use-layout-effect';
9
10
  import { useNotifyOpenLayerObserver } from '@atlaskit/layering/use-notify-open-layer-observer';
10
11
  import { useAnimatedVisibility } from '../internal/use-animated-visibility';
11
12
  import { useFocusWrap } from '../internal/use-focus-wrap';
12
13
  import { useSafariEscapeFix } from '../internal/use-safari-escape-fix';
13
- // Surface reset. KEEP IN SYNC with `surfaceResetStyles` in `popover/popover.tsx`.
14
+ // Surface reset, including `color` (the UA `dialog` rule sets `CanvasText`).
15
+ // KEEP IN SYNC with `surfaceResetStyles` in `popover/popover.tsx`.
14
16
  const surfaceResetStyles = {
15
- root: "_goh41wug _ux9u4jg8 _19w84jg8 _1f6b4jg8 _tcxkv2br _m466idpf _1b80glyw"
17
+ root: "_goh41wug _ux9u4jg8 _19w84jg8 _1f6b4jg8 _tcxkv2br _m466idpf _1b80glyw _9kefi7uo"
16
18
  };
17
19
  true;
18
20
  const dialogStyles = {
@@ -1,5 +1,5 @@
1
- import { useLayoutEffect } from 'react';
2
1
  import { getDocument } from '@atlaskit/browser-apis';
2
+ import { useLayoutEffect } from '@atlaskit/ds-lib/use-layout-effect';
3
3
  /**
4
4
  * __DialogScrollLock__
5
5
  *
@@ -7,7 +7,8 @@
7
7
  * See `notes/decisions/anchored-popover-at-point.md` for why this is a sibling
8
8
  * hook instead of an anchor union inside `useAnchoredPopover`.
9
9
  */
10
- import { useLayoutEffect, useRef } from 'react';
10
+ import { useRef } from 'react';
11
+ import { useLayoutEffect } from '@atlaskit/ds-lib/use-layout-effect';
11
12
  import { useAnchoredPopover } from './use-anchored-popover';
12
13
 
13
14
  /**
@@ -10,8 +10,9 @@
10
10
  * See `notes/architecture/positioning.md` and
11
11
  * `notes/decisions/fit-available-space.md`.
12
12
  */
13
- import { useLayoutEffect, useMemo } from 'react';
13
+ import { useMemo } from 'react';
14
14
  import { useId } from '@atlaskit/ds-lib/use-id';
15
+ import { useLayoutEffect } from '@atlaskit/ds-lib/use-layout-effect';
15
16
  import { applyAnchorPositioning } from './anchor-positioning/apply-anchor-positioning';
16
17
  import { getAnchoredPopoverSizeDeclarations } from './anchored-popover-size';
17
18
  import { applyJavaScriptFallbackPositioning } from './javascript-fallback/apply-javascript-fallback-positioning';
@@ -1,4 +1,5 @@
1
- import { useCallback, useEffect, useLayoutEffect, useReducer, useRef } from 'react';
1
+ import { useCallback, useEffect, useReducer, useRef } from 'react';
2
+ import { useLayoutEffect } from '@atlaskit/ds-lib/use-layout-effect';
2
3
  import { isNativeElementOpen } from './is-native-element-open';
3
4
  import { prefersReducedMotion } from './reduced-motion';
4
5
  function runCancellableSettlement({
@@ -25,6 +25,7 @@
25
25
  ._1s8uglyw:defined:defined:defined{rotate:none}
26
26
  ._1s9z1a5r{transition-behavior:allow-discrete}
27
27
  ._1yd01wug:defined:defined:defined{min-width:auto}
28
+ ._9kefi7uo:defined:defined:defined{color:var(--ds-text,#292a2e)}
28
29
  ._ao8dglyw:defined:defined:defined{max-height:none}
29
30
  ._az2pidpf:defined:defined:defined{padding-top:0}
30
31
  ._b2a9idpf:defined:defined:defined{margin-top:0}
@@ -1,11 +1,12 @@
1
1
  /* popover.tsx generated by @compiled/babel-plugin v3.0.2 */
2
2
  import "./popover.compiled.css";
3
3
  import { ax, ix } from "@compiled/react/runtime";
4
- import React, { forwardRef, useCallback, useId, useLayoutEffect, useMemo, useRef } from 'react';
4
+ import React, { forwardRef, useCallback, useId, useMemo, useRef } from 'react';
5
5
  import { cx } from '@compiled/react';
6
6
  import { bind } from 'bind-event-listener';
7
7
  import mergeRefs from '@atlaskit/ds-lib/merge-refs';
8
8
  import once from '@atlaskit/ds-lib/once';
9
+ import { useLayoutEffect } from '@atlaskit/ds-lib/use-layout-effect';
9
10
  import { useNotifyOpenLayerObserver } from '@atlaskit/layering/use-notify-open-layer-observer';
10
11
  import { isNativeElementOpen } from '../internal/is-native-element-open';
11
12
  import { resolvePlacement } from '../internal/resolve-placement';
@@ -56,14 +57,19 @@ const supportsPopoverHint = once(() => {
56
57
  *
57
58
  * The host is still a DOM child of its trigger for inheritance, so it inherits
58
59
  * values like `pointer-events: none` or `white-space: nowrap`. Resets them to
59
- * what `<body>` gave the portal path. `color`, `font` and direction still inherit.
60
+ * what `<body>` gave the portal path. `font` and direction still inherit.
60
61
  * Not `all: initial`: that would also override the UA `[popover]` rules.
61
62
  *
63
+ * `color` is a reset too: the UA `[popover]` rule sets `color: CanvasText`, so
64
+ * the host never inherits a colour. `color.text` is what `<body>` gave the portal
65
+ * path. Not `inherit`, which would take the trigger's colour (for example a link).
66
+ * See `notes/decisions/surface-reset-color.md`.
67
+ *
62
68
  * KEEP IN SYNC with `dialog/dialog-content.tsx` (ADS forbids shared styles).
63
69
  * The `satisfies` check below catches drift.
64
70
  */
65
71
  const surfaceResetStyles = {
66
- root: "_goh41wug _ux9u4jg8 _19w84jg8 _1f6b4jg8 _tcxkv2br _m466idpf _1b80glyw"
72
+ root: "_goh41wug _ux9u4jg8 _19w84jg8 _1f6b4jg8 _tcxkv2br _m466idpf _1b80glyw _9kefi7uo"
67
73
  };
68
74
  true;
69
75
  const styles = {
@@ -27,6 +27,7 @@
27
27
  ._2hwx1wug{margin-right:auto}
28
28
  ._6hkqidpf:defined:defined:defined{inset-block-end:0}
29
29
  ._722r1ule[open][open][open]{display:block}
30
+ ._9kefi7uo:defined:defined:defined{color:var(--ds-text,#292a2e)}
30
31
  ._ao8dglyw:defined:defined:defined{max-height:none}
31
32
  ._dbnbze3t:defined:defined:defined{padding-block-end:var(--ds-space-0,0)}
32
33
  ._goh41wug:defined:defined:defined{pointer-events:auto}
@@ -1,18 +1,20 @@
1
1
  /* dialog-content.tsx generated by @compiled/babel-plugin v3.0.2 */
2
2
  import "./dialog-content.compiled.css";
3
3
  import { ax, ix } from "@compiled/react/runtime";
4
- import React, { forwardRef, useCallback, useId, useLayoutEffect, useRef } from 'react';
4
+ import React, { forwardRef, useCallback, useId, useRef } from 'react';
5
5
  import { cx } from '@compiled/react';
6
6
  import { bindAll } from 'bind-event-listener';
7
7
  import mergeRefs from '@atlaskit/ds-lib/merge-refs';
8
8
  import noop from '@atlaskit/ds-lib/noop';
9
+ import { useLayoutEffect } from '@atlaskit/ds-lib/use-layout-effect';
9
10
  import { useNotifyOpenLayerObserver } from '@atlaskit/layering/use-notify-open-layer-observer';
10
11
  import { useAnimatedVisibility } from '../internal/use-animated-visibility';
11
12
  import { useFocusWrap } from '../internal/use-focus-wrap';
12
13
  import { useSafariEscapeFix } from '../internal/use-safari-escape-fix';
13
- // Surface reset. KEEP IN SYNC with `surfaceResetStyles` in `popover/popover.tsx`.
14
+ // Surface reset, including `color` (the UA `dialog` rule sets `CanvasText`).
15
+ // KEEP IN SYNC with `surfaceResetStyles` in `popover/popover.tsx`.
14
16
  var surfaceResetStyles = {
15
- root: "_goh41wug _ux9u4jg8 _19w84jg8 _1f6b4jg8 _tcxkv2br _m466idpf _1b80glyw"
17
+ root: "_goh41wug _ux9u4jg8 _19w84jg8 _1f6b4jg8 _tcxkv2br _m466idpf _1b80glyw _9kefi7uo"
16
18
  };
17
19
  true;
18
20
  var dialogStyles = {
@@ -1,5 +1,5 @@
1
- import { useLayoutEffect } from 'react';
2
1
  import { getDocument } from '@atlaskit/browser-apis';
2
+ import { useLayoutEffect } from '@atlaskit/ds-lib/use-layout-effect';
3
3
  /**
4
4
  * __DialogScrollLock__
5
5
  *
@@ -12,7 +12,8 @@ function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t =
12
12
  * See `notes/decisions/anchored-popover-at-point.md` for why this is a sibling
13
13
  * hook instead of an anchor union inside `useAnchoredPopover`.
14
14
  */
15
- import { useLayoutEffect, useRef } from 'react';
15
+ import { useRef } from 'react';
16
+ import { useLayoutEffect } from '@atlaskit/ds-lib/use-layout-effect';
16
17
  import { useAnchoredPopover } from './use-anchored-popover';
17
18
 
18
19
  /**
@@ -10,8 +10,9 @@
10
10
  * See `notes/architecture/positioning.md` and
11
11
  * `notes/decisions/fit-available-space.md`.
12
12
  */
13
- import { useLayoutEffect, useMemo } from 'react';
13
+ import { useMemo } from 'react';
14
14
  import { useId } from '@atlaskit/ds-lib/use-id';
15
+ import { useLayoutEffect } from '@atlaskit/ds-lib/use-layout-effect';
15
16
  import { applyAnchorPositioning } from './anchor-positioning/apply-anchor-positioning';
16
17
  import { getAnchoredPopoverSizeDeclarations } from './anchored-popover-size';
17
18
  import { applyJavaScriptFallbackPositioning } from './javascript-fallback/apply-javascript-fallback-positioning';
@@ -2,7 +2,8 @@ import _slicedToArray from "@babel/runtime/helpers/slicedToArray";
2
2
  import _defineProperty from "@babel/runtime/helpers/defineProperty";
3
3
  function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
4
4
  function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
5
- import { useCallback, useEffect, useLayoutEffect, useReducer, useRef } from 'react';
5
+ import { useCallback, useEffect, useReducer, useRef } from 'react';
6
+ import { useLayoutEffect } from '@atlaskit/ds-lib/use-layout-effect';
6
7
  import { isNativeElementOpen } from './is-native-element-open';
7
8
  import { prefersReducedMotion } from './reduced-motion';
8
9
  function runCancellableSettlement(_ref) {
@@ -25,6 +25,7 @@
25
25
  ._1s8uglyw:defined:defined:defined{rotate:none}
26
26
  ._1s9z1a5r{transition-behavior:allow-discrete}
27
27
  ._1yd01wug:defined:defined:defined{min-width:auto}
28
+ ._9kefi7uo:defined:defined:defined{color:var(--ds-text,#292a2e)}
28
29
  ._ao8dglyw:defined:defined:defined{max-height:none}
29
30
  ._az2pidpf:defined:defined:defined{padding-top:0}
30
31
  ._b2a9idpf:defined:defined:defined{margin-top:0}
@@ -1,11 +1,12 @@
1
1
  /* popover.tsx generated by @compiled/babel-plugin v3.0.2 */
2
2
  import "./popover.compiled.css";
3
3
  import { ax, ix } from "@compiled/react/runtime";
4
- import React, { forwardRef, useCallback, useId, useLayoutEffect, useMemo, useRef } from 'react';
4
+ import React, { forwardRef, useCallback, useId, useMemo, useRef } from 'react';
5
5
  import { cx } from '@compiled/react';
6
6
  import { bind } from 'bind-event-listener';
7
7
  import mergeRefs from '@atlaskit/ds-lib/merge-refs';
8
8
  import once from '@atlaskit/ds-lib/once';
9
+ import { useLayoutEffect } from '@atlaskit/ds-lib/use-layout-effect';
9
10
  import { useNotifyOpenLayerObserver } from '@atlaskit/layering/use-notify-open-layer-observer';
10
11
  import { isNativeElementOpen } from '../internal/is-native-element-open';
11
12
  import { resolvePlacement } from '../internal/resolve-placement';
@@ -53,14 +54,19 @@ var supportsPopoverHint = once(function () {
53
54
  *
54
55
  * The host is still a DOM child of its trigger for inheritance, so it inherits
55
56
  * values like `pointer-events: none` or `white-space: nowrap`. Resets them to
56
- * what `<body>` gave the portal path. `color`, `font` and direction still inherit.
57
+ * what `<body>` gave the portal path. `font` and direction still inherit.
57
58
  * Not `all: initial`: that would also override the UA `[popover]` rules.
58
59
  *
60
+ * `color` is a reset too: the UA `[popover]` rule sets `color: CanvasText`, so
61
+ * the host never inherits a colour. `color.text` is what `<body>` gave the portal
62
+ * path. Not `inherit`, which would take the trigger's colour (for example a link).
63
+ * See `notes/decisions/surface-reset-color.md`.
64
+ *
59
65
  * KEEP IN SYNC with `dialog/dialog-content.tsx` (ADS forbids shared styles).
60
66
  * The `satisfies` check below catches drift.
61
67
  */
62
68
  var surfaceResetStyles = {
63
- root: "_goh41wug _ux9u4jg8 _19w84jg8 _1f6b4jg8 _tcxkv2br _m466idpf _1b80glyw"
69
+ root: "_goh41wug _ux9u4jg8 _19w84jg8 _1f6b4jg8 _tcxkv2br _m466idpf _1b80glyw _9kefi7uo"
64
70
  };
65
71
  true;
66
72
  var styles = {
@@ -7,7 +7,13 @@ type TSurfaceResetDeclarations = {
7
7
  textAlign: 'start';
8
8
  textIndent: '0';
9
9
  textTransform: 'none';
10
+ color: 'var(--ds-text)';
10
11
  };
12
+ /**
13
+ * `cssMap` widens string literals to `string`, but keeps the literal type that
14
+ * `token()` returns.
15
+ */
16
+ type TCompiledValue<TValue> = TValue extends `var(--ds-${string})` ? TValue : string;
11
17
  /**
12
18
  * The surface reset is duplicated in `popover/popover.tsx` and
13
19
  * `dialog/dialog-content.tsx` (ADS forbids shared styles). Each copy checks
@@ -18,7 +24,7 @@ type TSurfaceResetDeclarations = {
18
24
  */
19
25
  export type TBoostedSurfaceReset<TSelector extends string> = CompiledStyles<{
20
26
  [TKey in TSelector]: {
21
- [TProperty in keyof TSurfaceResetDeclarations]: string;
27
+ [TProperty in keyof TSurfaceResetDeclarations]: TCompiledValue<TSurfaceResetDeclarations[TProperty]>;
22
28
  };
23
29
  }>;
24
30
  type TIsIdentical<A, B> = (<T>() => T extends A ? 1 : 2) extends <T>() => (T extends B ? 1 : 2) ? true : false;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaskit/top-layer",
3
- "version": "6.2.2",
3
+ "version": "6.2.4",
4
4
  "description": "Low-level layering primitives based on popover and dialog",
5
5
  "homepage": "https://atlassian.design/components/top-layer",
6
6
  "repository": "https://bitbucket.org/atlassian/atlassian-frontend-mirror",
@@ -40,7 +40,7 @@
40
40
  "@atlaskit/ds-lib": "^8.0.0",
41
41
  "@atlaskit/layering": "^6.0.0",
42
42
  "@atlaskit/react-compiler-gating": "^0.2.0",
43
- "@atlaskit/tokens": "^20.3.0",
43
+ "@atlaskit/tokens": "^20.4.0",
44
44
  "@babel/runtime": "^7.0.0",
45
45
  "@compiled/react": "^1.0.2",
46
46
  "bind-event-listener": "^3.0.0",