@atlaskit/top-layer 6.2.2 → 6.2.3

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,15 @@
1
1
  # @atlaskit/top-layer
2
2
 
3
+ ## 6.2.3
4
+
5
+ ### Patch Changes
6
+
7
+ - [`aaf461aabb51c`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/aaf461aabb51c) -
8
+ `Popover` and `Dialog` now use the default text colour (`color.text`). Before, the browser gave
9
+ them its own default (`CanvasText`). This only affects content that does not set its own text
10
+ colour. In light and dark mode, that content now looks the same as content rendered in a portal
11
+ under `<body>`.
12
+
3
13
  ## 6.2.2
4
14
 
5
15
  ### 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}
@@ -19,9 +19,10 @@ var _useAnimatedVisibility = require("../internal/use-animated-visibility");
19
19
  var _useFocusWrap = require("../internal/use-focus-wrap");
20
20
  var _useSafariEscapeFix2 = require("../internal/use-safari-escape-fix");
21
21
  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`.
22
+ // Surface reset, including `color` (the UA `dialog` rule sets `CanvasText`).
23
+ // KEEP IN SYNC with `surfaceResetStyles` in `popover/popover.tsx`.
23
24
  var surfaceResetStyles = {
24
- root: "_goh41wug _ux9u4jg8 _19w84jg8 _1f6b4jg8 _tcxkv2br _m466idpf _1b80glyw"
25
+ root: "_goh41wug _ux9u4jg8 _19w84jg8 _1f6b4jg8 _tcxkv2br _m466idpf _1b80glyw _9kefi7uo"
25
26
  };
26
27
  true;
27
28
  var dialogStyles = {
@@ -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}
@@ -62,14 +62,19 @@ var supportsPopoverHint = (0, _once.default)(function () {
62
62
  *
63
63
  * The host is still a DOM child of its trigger for inheritance, so it inherits
64
64
  * 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.
65
+ * what `<body>` gave the portal path. `font` and direction still inherit.
66
66
  * Not `all: initial`: that would also override the UA `[popover]` rules.
67
67
  *
68
+ * `color` is a reset too: the UA `[popover]` rule sets `color: CanvasText`, so
69
+ * the host never inherits a colour. `color.text` is what `<body>` gave the portal
70
+ * path. Not `inherit`, which would take the trigger's colour (for example a link).
71
+ * See `notes/decisions/surface-reset-color.md`.
72
+ *
68
73
  * KEEP IN SYNC with `dialog/dialog-content.tsx` (ADS forbids shared styles).
69
74
  * The `satisfies` check below catches drift.
70
75
  */
71
76
  var surfaceResetStyles = {
72
- root: "_goh41wug _ux9u4jg8 _19w84jg8 _1f6b4jg8 _tcxkv2br _m466idpf _1b80glyw"
77
+ root: "_goh41wug _ux9u4jg8 _19w84jg8 _1f6b4jg8 _tcxkv2br _m466idpf _1b80glyw _9kefi7uo"
73
78
  };
74
79
  true;
75
80
  var 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}
@@ -10,9 +10,10 @@ import { useNotifyOpenLayerObserver } from '@atlaskit/layering/use-notify-open-l
10
10
  import { useAnimatedVisibility } from '../internal/use-animated-visibility';
11
11
  import { useFocusWrap } from '../internal/use-focus-wrap';
12
12
  import { useSafariEscapeFix } from '../internal/use-safari-escape-fix';
13
- // Surface reset. KEEP IN SYNC with `surfaceResetStyles` in `popover/popover.tsx`.
13
+ // Surface reset, including `color` (the UA `dialog` rule sets `CanvasText`).
14
+ // KEEP IN SYNC with `surfaceResetStyles` in `popover/popover.tsx`.
14
15
  const surfaceResetStyles = {
15
- root: "_goh41wug _ux9u4jg8 _19w84jg8 _1f6b4jg8 _tcxkv2br _m466idpf _1b80glyw"
16
+ root: "_goh41wug _ux9u4jg8 _19w84jg8 _1f6b4jg8 _tcxkv2br _m466idpf _1b80glyw _9kefi7uo"
16
17
  };
17
18
  true;
18
19
  const dialogStyles = {
@@ -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}
@@ -56,14 +56,19 @@ const supportsPopoverHint = once(() => {
56
56
  *
57
57
  * The host is still a DOM child of its trigger for inheritance, so it inherits
58
58
  * 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.
59
+ * what `<body>` gave the portal path. `font` and direction still inherit.
60
60
  * Not `all: initial`: that would also override the UA `[popover]` rules.
61
61
  *
62
+ * `color` is a reset too: the UA `[popover]` rule sets `color: CanvasText`, so
63
+ * the host never inherits a colour. `color.text` is what `<body>` gave the portal
64
+ * path. Not `inherit`, which would take the trigger's colour (for example a link).
65
+ * See `notes/decisions/surface-reset-color.md`.
66
+ *
62
67
  * KEEP IN SYNC with `dialog/dialog-content.tsx` (ADS forbids shared styles).
63
68
  * The `satisfies` check below catches drift.
64
69
  */
65
70
  const surfaceResetStyles = {
66
- root: "_goh41wug _ux9u4jg8 _19w84jg8 _1f6b4jg8 _tcxkv2br _m466idpf _1b80glyw"
71
+ root: "_goh41wug _ux9u4jg8 _19w84jg8 _1f6b4jg8 _tcxkv2br _m466idpf _1b80glyw _9kefi7uo"
67
72
  };
68
73
  true;
69
74
  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}
@@ -10,9 +10,10 @@ import { useNotifyOpenLayerObserver } from '@atlaskit/layering/use-notify-open-l
10
10
  import { useAnimatedVisibility } from '../internal/use-animated-visibility';
11
11
  import { useFocusWrap } from '../internal/use-focus-wrap';
12
12
  import { useSafariEscapeFix } from '../internal/use-safari-escape-fix';
13
- // Surface reset. KEEP IN SYNC with `surfaceResetStyles` in `popover/popover.tsx`.
13
+ // Surface reset, including `color` (the UA `dialog` rule sets `CanvasText`).
14
+ // KEEP IN SYNC with `surfaceResetStyles` in `popover/popover.tsx`.
14
15
  var surfaceResetStyles = {
15
- root: "_goh41wug _ux9u4jg8 _19w84jg8 _1f6b4jg8 _tcxkv2br _m466idpf _1b80glyw"
16
+ root: "_goh41wug _ux9u4jg8 _19w84jg8 _1f6b4jg8 _tcxkv2br _m466idpf _1b80glyw _9kefi7uo"
16
17
  };
17
18
  true;
18
19
  var dialogStyles = {
@@ -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}
@@ -53,14 +53,19 @@ var supportsPopoverHint = once(function () {
53
53
  *
54
54
  * The host is still a DOM child of its trigger for inheritance, so it inherits
55
55
  * 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.
56
+ * what `<body>` gave the portal path. `font` and direction still inherit.
57
57
  * Not `all: initial`: that would also override the UA `[popover]` rules.
58
58
  *
59
+ * `color` is a reset too: the UA `[popover]` rule sets `color: CanvasText`, so
60
+ * the host never inherits a colour. `color.text` is what `<body>` gave the portal
61
+ * path. Not `inherit`, which would take the trigger's colour (for example a link).
62
+ * See `notes/decisions/surface-reset-color.md`.
63
+ *
59
64
  * KEEP IN SYNC with `dialog/dialog-content.tsx` (ADS forbids shared styles).
60
65
  * The `satisfies` check below catches drift.
61
66
  */
62
67
  var surfaceResetStyles = {
63
- root: "_goh41wug _ux9u4jg8 _19w84jg8 _1f6b4jg8 _tcxkv2br _m466idpf _1b80glyw"
68
+ root: "_goh41wug _ux9u4jg8 _19w84jg8 _1f6b4jg8 _tcxkv2br _m466idpf _1b80glyw _9kefi7uo"
64
69
  };
65
70
  true;
66
71
  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.3",
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",