@atlaskit/flag 14.5.1 → 14.5.2

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.
Files changed (47) hide show
  1. package/CHANGELOG.md +10 -0
  2. package/__perf__/withFlagGroup.tsx +1 -1
  3. package/dist/cjs/auto-dismiss-flag.js +4 -4
  4. package/dist/cjs/flag-actions.js +50 -6
  5. package/dist/cjs/flag-group.js +56 -18
  6. package/dist/cjs/flag.js +83 -106
  7. package/dist/cjs/internal/description.js +32 -0
  8. package/dist/cjs/internal/dismiss-button.js +83 -0
  9. package/dist/cjs/{expander.js → internal/expander.js} +15 -7
  10. package/dist/cjs/internal/index.js +39 -0
  11. package/dist/cjs/internal/title.js +32 -0
  12. package/dist/cjs/theme.js +61 -61
  13. package/dist/cjs/version.json +1 -1
  14. package/dist/es2019/auto-dismiss-flag.js +2 -3
  15. package/dist/es2019/flag-actions.js +50 -32
  16. package/dist/es2019/flag-group.js +48 -65
  17. package/dist/es2019/flag.js +77 -164
  18. package/dist/es2019/internal/description.js +22 -0
  19. package/dist/es2019/internal/dismiss-button.js +63 -0
  20. package/dist/es2019/{expander.js → internal/expander.js} +14 -10
  21. package/dist/es2019/internal/index.js +4 -0
  22. package/dist/es2019/internal/title.js +22 -0
  23. package/dist/es2019/theme.js +61 -61
  24. package/dist/es2019/version.json +1 -1
  25. package/dist/esm/auto-dismiss-flag.js +2 -3
  26. package/dist/esm/flag-actions.js +49 -6
  27. package/dist/esm/flag-group.js +52 -16
  28. package/dist/esm/flag.js +79 -101
  29. package/dist/esm/internal/description.js +23 -0
  30. package/dist/esm/internal/dismiss-button.js +63 -0
  31. package/dist/esm/{expander.js → internal/expander.js} +14 -5
  32. package/dist/esm/internal/index.js +4 -0
  33. package/dist/esm/internal/title.js +23 -0
  34. package/dist/esm/theme.js +61 -61
  35. package/dist/esm/version.json +1 -1
  36. package/dist/types/flag-actions.d.ts +4 -4
  37. package/dist/types/flag-group.d.ts +2 -2
  38. package/dist/types/flag.d.ts +1 -1
  39. package/dist/types/internal/description.d.ts +7 -0
  40. package/dist/types/internal/dismiss-button.d.ts +11 -0
  41. package/dist/types/internal/expander.d.ts +8 -0
  42. package/dist/types/internal/index.d.ts +4 -0
  43. package/dist/types/internal/title.d.ts +6 -0
  44. package/dist/types/theme.d.ts +1 -1
  45. package/package.json +7 -3
  46. package/dist/types/expander.d.ts +0 -9
  47. package/expander/package.json +0 -7
@@ -1,23 +1,31 @@
1
1
  "use strict";
2
2
 
3
- var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
-
5
3
  Object.defineProperty(exports, "__esModule", {
6
4
  value: true
7
5
  });
8
6
  exports.default = void 0;
9
7
 
10
- var _taggedTemplateLiteral2 = _interopRequireDefault(require("@babel/runtime/helpers/taggedTemplateLiteral"));
11
-
12
8
  var _core = require("@emotion/core");
13
9
 
14
10
  var _motion = require("@atlaskit/motion");
15
11
 
16
12
  var _constants = require("@atlaskit/theme/constants");
17
13
 
18
- var _templateObject;
19
-
14
+ /** @jsx jsx */
20
15
  var paddingLeft = (0, _constants.gridSize)() * 5;
16
+ var expanderStyles = (0, _core.css)({
17
+ display: 'flex',
18
+ minWidth: 0,
19
+ maxHeight: 0,
20
+ padding: "0 0 0 ".concat(paddingLeft, "px"),
21
+ justifyContent: 'center',
22
+ flex: '1 1 100%',
23
+ flexDirection: 'column',
24
+ transition: "max-height 0.3s"
25
+ });
26
+ var expandedStyles = (0, _core.css)({
27
+ maxHeight: 150
28
+ });
21
29
 
22
30
  var Expander = function Expander(_ref) {
23
31
  var children = _ref.children,
@@ -28,7 +36,7 @@ var Expander = function Expander(_ref) {
28
36
  // the the reveal because we don't know the height of the content.
29
37
  return (0, _core.jsx)("div", {
30
38
  "aria-hidden": !isExpanded,
31
- css: (0, _core.css)(_templateObject || (_templateObject = (0, _taggedTemplateLiteral2.default)(["\n max-height: ", "px;\n transition: max-height 0.3s;\n display: flex;\n flex: 1 1 100%;\n flex-direction: column;\n justify-content: center;\n min-width: 0;\n padding: 0 0 0 ", "px;\n "])), isExpanded ? 150 : 0, paddingLeft),
39
+ css: [expanderStyles, isExpanded && expandedStyles],
32
40
  "data-testid": testId && "".concat(testId, "-expander")
33
41
  }, (0, _core.jsx)(_motion.ExitingPersistence, {
34
42
  appear: true
@@ -0,0 +1,39 @@
1
+ "use strict";
2
+
3
+ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
+
5
+ Object.defineProperty(exports, "__esModule", {
6
+ value: true
7
+ });
8
+ Object.defineProperty(exports, "Description", {
9
+ enumerable: true,
10
+ get: function get() {
11
+ return _description.default;
12
+ }
13
+ });
14
+ Object.defineProperty(exports, "DismissButton", {
15
+ enumerable: true,
16
+ get: function get() {
17
+ return _dismissButton.default;
18
+ }
19
+ });
20
+ Object.defineProperty(exports, "Expander", {
21
+ enumerable: true,
22
+ get: function get() {
23
+ return _expander.default;
24
+ }
25
+ });
26
+ Object.defineProperty(exports, "Title", {
27
+ enumerable: true,
28
+ get: function get() {
29
+ return _title.default;
30
+ }
31
+ });
32
+
33
+ var _title = _interopRequireDefault(require("./title"));
34
+
35
+ var _description = _interopRequireDefault(require("./description"));
36
+
37
+ var _expander = _interopRequireDefault(require("./expander"));
38
+
39
+ var _dismissButton = _interopRequireDefault(require("./dismiss-button"));
@@ -0,0 +1,32 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.default = void 0;
7
+
8
+ var _core = require("@emotion/core");
9
+
10
+ /** @jsx jsx */
11
+ var titleStyles = (0, _core.css)({
12
+ padding: "0 0 0 16px",
13
+ flex: 1,
14
+ fontWeight: 600,
15
+ overflow: 'hidden',
16
+ textOverflow: 'ellipsis',
17
+ whiteSpace: 'nowrap'
18
+ });
19
+
20
+ var Title = function Title(_ref) {
21
+ var color = _ref.color,
22
+ children = _ref.children;
23
+ return (0, _core.jsx)("span", {
24
+ style: {
25
+ color: color
26
+ },
27
+ css: titleStyles
28
+ }, children);
29
+ };
30
+
31
+ var _default = Title;
32
+ exports.default = _default;
package/dist/cjs/theme.js CHANGED
@@ -9,24 +9,24 @@ var _colors = require("@atlaskit/theme/colors");
9
9
 
10
10
  var flagBackgroundColor = {
11
11
  error: {
12
- light: "var(--ds-background-overlay, ".concat(_colors.R400, ")"),
13
- dark: "var(--ds-background-overlay, ".concat(_colors.R300, ")")
12
+ light: "var(--ds-surface-overlay, ".concat(_colors.R400, ")"),
13
+ dark: "var(--ds-surface-overlay, ".concat(_colors.R300, ")")
14
14
  },
15
15
  info: {
16
- light: "var(--ds-background-overlay, ".concat(_colors.N500, ")"),
17
- dark: "var(--ds-background-overlay, ".concat(_colors.N500, ")")
16
+ light: "var(--ds-surface-overlay, ".concat(_colors.N500, ")"),
17
+ dark: "var(--ds-surface-overlay, ".concat(_colors.N500, ")")
18
18
  },
19
19
  normal: {
20
- light: "var(--ds-background-overlay, ".concat(_colors.N0, ")"),
21
- dark: "var(--ds-background-overlay, ".concat(_colors.DN50, ")")
20
+ light: "var(--ds-surface-overlay, ".concat(_colors.N0, ")"),
21
+ dark: "var(--ds-surface-overlay, ".concat(_colors.DN50, ")")
22
22
  },
23
23
  success: {
24
- light: "var(--ds-background-overlay, ".concat(_colors.G400, ")"),
25
- dark: "var(--ds-background-overlay, ".concat(_colors.G300, ")")
24
+ light: "var(--ds-surface-overlay, ".concat(_colors.G400, ")"),
25
+ dark: "var(--ds-surface-overlay, ".concat(_colors.G300, ")")
26
26
  },
27
27
  warning: {
28
- light: "var(--ds-background-overlay, ".concat(_colors.Y200, ")"),
29
- dark: "var(--ds-background-overlay, ".concat(_colors.Y300, ")")
28
+ light: "var(--ds-surface-overlay, ".concat(_colors.Y200, ")"),
29
+ dark: "var(--ds-surface-overlay, ".concat(_colors.Y300, ")")
30
30
  }
31
31
  };
32
32
 
@@ -35,50 +35,50 @@ var getFlagBackgroundColor = function getFlagBackgroundColor(appearance, mode) {
35
35
  };
36
36
 
37
37
  exports.getFlagBackgroundColor = getFlagBackgroundColor;
38
- var flagBorderColor = "var(--ds-background-overlay, ".concat(_colors.N60A, ")");
38
+ var flagBorderColor = "var(--ds-surface-overlay, ".concat(_colors.N60A, ")");
39
39
  exports.flagBorderColor = flagBorderColor;
40
40
  var flagIconColor = {
41
41
  error: {
42
- light: "var(--ds-iconBorder-danger, ".concat(_colors.N0, ")"),
43
- dark: "var(--ds-iconBorder-danger, ".concat(_colors.DN40, ")")
42
+ light: "var(--ds-icon-danger, ".concat(_colors.N0, ")"),
43
+ dark: "var(--ds-icon-danger, ".concat(_colors.DN40, ")")
44
44
  },
45
45
  info: {
46
- light: "var(--ds-iconBorder-discovery, ".concat(_colors.N0, ")"),
47
- dark: "var(--ds-iconBorder-discovery, ".concat(_colors.DN600, ")")
46
+ light: "var(--ds-icon-discovery, ".concat(_colors.N0, ")"),
47
+ dark: "var(--ds-icon-discovery, ".concat(_colors.DN600, ")")
48
48
  },
49
49
  normal: {
50
- light: "var(--ds-iconBorder-brand, ".concat(_colors.N500, ")"),
51
- dark: "var(--ds-iconBorder-brand, ".concat(_colors.DN600, ")")
50
+ light: "var(--ds-icon-brand, ".concat(_colors.N500, ")"),
51
+ dark: "var(--ds-icon-brand, ".concat(_colors.DN600, ")")
52
52
  },
53
53
  success: {
54
- light: "var(--ds-iconBorder-success, ".concat(_colors.N0, ")"),
55
- dark: "var(--ds-iconBorder-success, ".concat(_colors.DN40, ")")
54
+ light: "var(--ds-icon-success, ".concat(_colors.N0, ")"),
55
+ dark: "var(--ds-icon-success, ".concat(_colors.DN40, ")")
56
56
  },
57
57
  warning: {
58
- light: "var(--ds-iconBorder-warning, ".concat(_colors.N700, ")"),
59
- dark: "var(--ds-iconBorder-warning, ".concat(_colors.DN40, ")")
58
+ light: "var(--ds-icon-warning, ".concat(_colors.N700, ")"),
59
+ dark: "var(--ds-icon-warning, ".concat(_colors.DN40, ")")
60
60
  }
61
61
  };
62
62
  var flagTextColor = {
63
63
  error: {
64
- light: "var(--ds-text-highEmphasis, ".concat(_colors.N0, ")"),
65
- dark: "var(--ds-text-highEmphasis, ".concat(_colors.DN40, ")")
64
+ light: "var(--ds-text, ".concat(_colors.N0, ")"),
65
+ dark: "var(--ds-text, ".concat(_colors.DN40, ")")
66
66
  },
67
67
  info: {
68
- light: "var(--ds-text-highEmphasis, ".concat(_colors.N0, ")"),
69
- dark: "var(--ds-text-highEmphasis, ".concat(_colors.DN600, ")")
68
+ light: "var(--ds-text, ".concat(_colors.N0, ")"),
69
+ dark: "var(--ds-text, ".concat(_colors.DN600, ")")
70
70
  },
71
71
  normal: {
72
- light: "var(--ds-text-highEmphasis, ".concat(_colors.N500, ")"),
73
- dark: "var(--ds-text-highEmphasis, ".concat(_colors.DN600, ")")
72
+ light: "var(--ds-text, ".concat(_colors.N500, ")"),
73
+ dark: "var(--ds-text, ".concat(_colors.DN600, ")")
74
74
  },
75
75
  success: {
76
- light: "var(--ds-text-highEmphasis, ".concat(_colors.N0, ")"),
77
- dark: "var(--ds-text-highEmphasis, ".concat(_colors.DN40, ")")
76
+ light: "var(--ds-text, ".concat(_colors.N0, ")"),
77
+ dark: "var(--ds-text, ".concat(_colors.DN40, ")")
78
78
  },
79
79
  warning: {
80
- light: "var(--ds-text-highEmphasis, ".concat(_colors.N700, ")"),
81
- dark: "var(--ds-text-highEmphasis, ".concat(_colors.DN40, ")")
80
+ light: "var(--ds-text, ".concat(_colors.N700, ")"),
81
+ dark: "var(--ds-text, ".concat(_colors.DN40, ")")
82
82
  }
83
83
  };
84
84
 
@@ -99,24 +99,24 @@ var flagShadowColor = _colors.N50A;
99
99
  exports.flagShadowColor = flagShadowColor;
100
100
  var flagFocusRingColor = {
101
101
  error: {
102
- light: "var(--ds-border-focus, ".concat(_colors.N40, ")"),
103
- dark: "var(--ds-border-focus, ".concat(_colors.N40, ")")
102
+ light: "var(--ds-border-focused, ".concat(_colors.N40, ")"),
103
+ dark: "var(--ds-border-focused, ".concat(_colors.N40, ")")
104
104
  },
105
105
  info: {
106
- light: "var(--ds-border-focus, ".concat(_colors.N40, ")"),
107
- dark: "var(--ds-border-focus, ".concat(_colors.N40, ")")
106
+ light: "var(--ds-border-focused, ".concat(_colors.N40, ")"),
107
+ dark: "var(--ds-border-focused, ".concat(_colors.N40, ")")
108
108
  },
109
109
  normal: {
110
- light: "var(--ds-border-focus, ".concat(_colors.B100, ")"),
111
- dark: "var(--ds-border-focus, ".concat(_colors.B100, ")")
110
+ light: "var(--ds-border-focused, ".concat(_colors.B100, ")"),
111
+ dark: "var(--ds-border-focused, ".concat(_colors.B100, ")")
112
112
  },
113
113
  success: {
114
- light: "var(--ds-border-focus, ".concat(_colors.N40, ")"),
115
- dark: "var(--ds-border-focus, ".concat(_colors.N40, ")")
114
+ light: "var(--ds-border-focused, ".concat(_colors.N40, ")"),
115
+ dark: "var(--ds-border-focused, ".concat(_colors.N40, ")")
116
116
  },
117
117
  warning: {
118
- light: "var(--ds-border-focus, ".concat(_colors.N200, ")"),
119
- dark: "var(--ds-border-focus, ".concat(_colors.N200, ")")
118
+ light: "var(--ds-border-focused, ".concat(_colors.N200, ")"),
119
+ dark: "var(--ds-border-focused, ".concat(_colors.N200, ")")
120
120
  }
121
121
  };
122
122
 
@@ -128,46 +128,46 @@ exports.getFlagFocusRingColor = getFlagFocusRingColor;
128
128
  var lightButtonBackground = 'rgba(255, 255, 255, 0.08)';
129
129
  var actionBackground = {
130
130
  success: {
131
- light: "var(--ds-background-subtleNeutral-resting, ".concat(lightButtonBackground, ")"),
132
- dark: "var(--ds-background-subtleNeutral-resting, ".concat(_colors.N30A, ")")
131
+ light: "var(--ds-background-neutral, ".concat(lightButtonBackground, ")"),
132
+ dark: "var(--ds-background-neutral, ".concat(_colors.N30A, ")")
133
133
  },
134
134
  info: {
135
- light: "var(--ds-background-subtleNeutral-resting, ".concat(lightButtonBackground, ")"),
136
- dark: "var(--ds-background-subtleNeutral-resting, ".concat(lightButtonBackground, ")")
135
+ light: "var(--ds-background-neutral, ".concat(lightButtonBackground, ")"),
136
+ dark: "var(--ds-background-neutral, ".concat(lightButtonBackground, ")")
137
137
  },
138
138
  error: {
139
- light: "var(--ds-background-subtleNeutral-resting, ".concat(lightButtonBackground, ")"),
140
- dark: "var(--ds-background-subtleNeutral-resting, ".concat(_colors.N30A, ")")
139
+ light: "var(--ds-background-neutral, ".concat(lightButtonBackground, ")"),
140
+ dark: "var(--ds-background-neutral, ".concat(_colors.N30A, ")")
141
141
  },
142
142
  warning: {
143
- light: "var(--ds-background-subtleNeutral-resting, ".concat(_colors.N30A, ")"),
144
- dark: "var(--ds-background-subtleNeutral-resting, ".concat(_colors.N30A, ")")
143
+ light: "var(--ds-background-neutral, ".concat(_colors.N30A, ")"),
144
+ dark: "var(--ds-background-neutral, ".concat(_colors.N30A, ")")
145
145
  },
146
146
  normal: {
147
- light: "var(--ds-background-subtleNeutral-resting, none)",
148
- dark: "var(--ds-background-subtleNeutral-resting, none)"
147
+ light: "var(--ds-background-neutral, none)",
148
+ dark: "var(--ds-background-neutral, none)"
149
149
  }
150
150
  };
151
151
  var actionColor = {
152
152
  success: {
153
- light: "var(--ds-text-mediumEmphasis, ".concat(_colors.N0, ")"),
154
- dark: "var(--ds-text-mediumEmphasis, ".concat(_colors.DN40, ")")
153
+ light: "var(--ds-text-subtle, ".concat(_colors.N0, ")"),
154
+ dark: "var(--ds-text-subtle, ".concat(_colors.DN40, ")")
155
155
  },
156
156
  info: {
157
- light: "var(--ds-text-mediumEmphasis, ".concat(_colors.N0, ")"),
158
- dark: "var(--ds-text-mediumEmphasis, ".concat(_colors.DN600, ")")
157
+ light: "var(--ds-text-subtle, ".concat(_colors.N0, ")"),
158
+ dark: "var(--ds-text-subtle, ".concat(_colors.DN600, ")")
159
159
  },
160
160
  error: {
161
- light: "var(--ds-text-mediumEmphasis, ".concat(_colors.N0, ")"),
162
- dark: "var(--ds-text-mediumEmphasis, ".concat(_colors.DN600, ")")
161
+ light: "var(--ds-text-subtle, ".concat(_colors.N0, ")"),
162
+ dark: "var(--ds-text-subtle, ".concat(_colors.DN600, ")")
163
163
  },
164
164
  warning: {
165
- light: "var(--ds-text-mediumEmphasis, ".concat(_colors.N700, ")"),
166
- dark: "var(--ds-text-mediumEmphasis, ".concat(_colors.DN40, ")")
165
+ light: "var(--ds-text-subtle, ".concat(_colors.N700, ")"),
166
+ dark: "var(--ds-text-subtle, ".concat(_colors.DN40, ")")
167
167
  },
168
168
  normal: {
169
- light: "var(--ds-text-mediumEmphasis, ".concat(_colors.B400, ")"),
170
- dark: "var(--ds-text-mediumEmphasis, ".concat(_colors.B100, ")")
169
+ light: "var(--ds-text-subtle, ".concat(_colors.B400, ")"),
170
+ dark: "var(--ds-text-subtle, ".concat(_colors.B100, ")")
171
171
  }
172
172
  };
173
173
 
@@ -1,5 +1,5 @@
1
1
  {
2
2
  "name": "@atlaskit/flag",
3
- "version": "14.5.1",
3
+ "version": "14.5.2",
4
4
  "sideEffects": false
5
5
  }
@@ -1,14 +1,13 @@
1
1
  import _extends from "@babel/runtime/helpers/extends";
2
2
  import React, { useCallback, useEffect, useRef } from 'react';
3
3
  import { usePlatformLeafEventHandler } from '@atlaskit/analytics-next/usePlatformLeafEventHandler';
4
+ import noop from '@atlaskit/ds-lib/noop';
4
5
  import Flag from './flag';
5
6
  import { useFlagGroup } from './flag-group';
6
7
  const packageName = "@atlaskit/flag";
7
- const packageVersion = "14.5.1";
8
+ const packageVersion = "14.5.2";
8
9
  export const AUTO_DISMISS_SECONDS = 8;
9
10
 
10
- function noop() {}
11
-
12
11
  const AutoDismissFlag = props => {
13
12
  const {
14
13
  id,
@@ -1,3 +1,5 @@
1
+ /* eslint-disable @repo/internal/styles/no-nested-styles */
2
+
1
3
  /** @jsx jsx */
2
4
  import { css, jsx } from '@emotion/core';
3
5
  import Button from '@atlaskit/button/custom-theme-button';
@@ -7,6 +9,46 @@ import { getActionBackground, getActionColor, getFlagFocusRingColor } from './th
7
9
  const gridSize = getGridSize();
8
10
  const separatorWidth = gridSize * 2;
9
11
  const defaultAppearanceTranslate = gridSize / 4;
12
+ const separatorStyles = css({
13
+ display: 'inline-block',
14
+ width: separatorWidth,
15
+ textAlign: 'center'
16
+ });
17
+ const actionContainerStyles = css({
18
+ display: 'flex',
19
+ paddingTop: gridSize,
20
+ alignItems: 'center',
21
+ flexWrap: 'wrap',
22
+ transform: `translateX(-${defaultAppearanceTranslate}px)`
23
+ });
24
+ const boldActionContainerStyles = css({
25
+ transform: 0
26
+ });
27
+ const buttonStyles = css({
28
+ '&&, a&&': {
29
+ marginLeft: 0,
30
+ padding: `0 ${gridSize}px !important`,
31
+ background: `var(--bg-color)`,
32
+ color: `var(--color) !important`,
33
+ fontWeight: 500
34
+ },
35
+ '&&:focus, a&&:focus': {
36
+ boxShadow: `0 0 0 2px var(--focus-color)`
37
+ },
38
+ '&&:hover, &&:active, a&&:hover, a&&:active': {
39
+ textDecoration: 'underline'
40
+ }
41
+ });
42
+ const appeanceNormalButtonStyles = css({
43
+ '&&, a&&': {
44
+ padding: '0 !important'
45
+ }
46
+ });
47
+ const isBoldButtonStyles = css({
48
+ '&&, a&&': {
49
+ marginLeft: gridSize
50
+ }
51
+ });
10
52
 
11
53
  const FlagActions = props => {
12
54
  const {
@@ -23,20 +65,10 @@ const FlagActions = props => {
23
65
 
24
66
  const isBold = appearance !== DEFAULT_APPEARANCE;
25
67
  return jsx("div", {
26
- css: css`
27
- display: flex;
28
- flex-wrap: wrap;
29
- padding-top: ${gridSize}px;
30
- transform: ${appearance === DEFAULT_APPEARANCE ? `translateX(-${defaultAppearanceTranslate}px)` : 0};
31
- align-items: center;
32
- `,
68
+ css: [actionContainerStyles, isBold && boldActionContainerStyles],
33
69
  "data-testid": testId && `${testId}-actions`
34
70
  }, actions.map((action, index) => [index && !isBold ? jsx("div", {
35
- css: css`
36
- text-align: center;
37
- display: inline-block;
38
- width: ${separatorWidth}px;
39
- `,
71
+ css: separatorStyles,
40
72
  key: index + 0.5
41
73
  }, "\xB7") : '', jsx(Button, {
42
74
  onClick: action.onClick,
@@ -47,26 +79,12 @@ const FlagActions = props => {
47
79
  spacing: "compact",
48
80
  testId: action.testId,
49
81
  key: index,
50
- css: css`
51
- &&,
52
- a&& {
53
- margin-left: ${index && isBold ? gridSize : 0}px;
54
- font-weight: 500;
55
- padding: 0 ${appearance === 'normal' ? 0 : gridSize}px !important;
56
- background: ${getActionBackground(appearance, mode)};
57
- color: ${getActionColor(appearance, mode)} !important;
58
- }
59
- &&:focus,
60
- a&&:focus {
61
- box-shadow: 0 0 0 2px ${getFlagFocusRingColor(appearance, mode)};
62
- }
63
- &&:hover,
64
- &&:active,
65
- a&&:hover,
66
- a&&:active {
67
- text-decoration: underline;
68
- }
69
- `
82
+ style: {
83
+ '--color': getActionColor(appearance, mode),
84
+ '--bg-color': getActionBackground(appearance, mode),
85
+ '--focus-color': getFlagFocusRingColor(appearance, mode)
86
+ },
87
+ css: [buttonStyles, isBold && isBoldButtonStyles, appearance === 'normal' && appeanceNormalButtonStyles]
70
88
  }, action.content)]));
71
89
  };
72
90
 
@@ -4,6 +4,8 @@ import _extends from "@babel/runtime/helpers/extends";
4
4
  import { Children, createContext, useContext, useMemo } from 'react';
5
5
  import { css, jsx } from '@emotion/core';
6
6
  import { easeIn, ExitingPersistence, SlideIn } from '@atlaskit/motion';
7
+ import VisuallyHidden from '@atlaskit/visually-hidden';
8
+ import noop from '@atlaskit/ds-lib/noop';
7
9
  import Portal from '@atlaskit/portal';
8
10
  import { gridSize as getGridSize, layers } from '@atlaskit/theme/constants';
9
11
  const gridSize = getGridSize();
@@ -11,9 +13,6 @@ export const flagWidth = gridSize * 50;
11
13
  export const flagAnimationTime = 400;
12
14
  const flagBottom = gridSize * 6;
13
15
  const flagLeft = gridSize * 10;
14
-
15
- function noop() {}
16
-
17
16
  const defaultFlagGroupContext = {
18
17
  onDismissed: () => {},
19
18
  isDismissAllowed: false
@@ -24,38 +23,51 @@ export function useFlagGroup() {
24
23
  } // transition: none is set on first-of-type to prevent a bug in Firefox
25
24
  // that causes a broken transition
26
25
 
27
- const baseStyles = `
28
- bottom: 0;
29
- position: absolute;
30
- width: ${flagWidth}px;
31
- transition: transform ${flagAnimationTime}ms ease-in-out;
32
-
33
- @media (max-width: 560px) {
34
- width: 100vw;
35
- }
36
-
37
- &:first-of-type {
38
- transition: none;
39
- transform: translate(0,0);
26
+ const baseStyles = css({
27
+ width: flagWidth,
28
+ position: 'absolute',
29
+ bottom: 0,
30
+ transition: `transform ${flagAnimationTime}ms ease-in-out`,
31
+ '@media (max-width: 560px)': {
32
+ width: '100vw'
33
+ },
34
+ ':first-of-type': {
35
+ transform: `translate(0,0)`,
36
+ transition: 'none'
37
+ },
38
+ ':nth-of-type(n + 2)': {
39
+ animationDuration: '0ms',
40
+ transform: `translateX(0) translateY(100%) translateY(${2 * gridSize}px)`
41
+ },
42
+ ':nth-of-type(1)': {
43
+ zIndex: 5
44
+ },
45
+ ':nth-of-type(2)': {
46
+ zIndex: 4
47
+ },
48
+ '&:nth-of-type(n + 4)': {
49
+ visibility: 'hidden'
40
50
  }
51
+ }); // Transform needed to push up while 1st flag is leaving
52
+ // Exiting time should match the exiting time of motion so is halved
41
53
 
42
- &:nth-of-type(n + 2) {
43
- animation-duration: 0ms;
44
- transform: translateX(0) translateY(100%) translateY(${2 * gridSize}px);
54
+ const dismissAllowedStyles = css({
55
+ // eslint-disable-next-line @repo/internal/styles/no-nested-styles
56
+ '&& + *': {
57
+ transform: `translate(0, 0)`,
58
+ transitionDuration: `${flagAnimationTime / 2}ms`
45
59
  }
46
-
47
- /* Layer the 'primary' flag above the 'secondary' flag */
48
- &:nth-of-type(1) {
49
- z-index: 5;
50
- }
51
- &:nth-of-type(2) {
52
- z-index: 4;
53
- }
54
-
55
- &:nth-of-type(n + 4) {
56
- visibility: hidden;
60
+ });
61
+ const flagGroupContainerStyles = css({
62
+ position: 'fixed',
63
+ zIndex: layers.flag(),
64
+ bottom: flagBottom,
65
+ left: flagLeft,
66
+ '@media (max-width: 560px)': {
67
+ bottom: 0,
68
+ left: 0
57
69
  }
58
- `;
70
+ });
59
71
 
60
72
  const FlagGroup = props => {
61
73
  const {
@@ -75,21 +87,12 @@ const FlagGroup = props => {
75
87
  return children && typeof children === 'object' ? Children.map(children, (flag, index) => {
76
88
  const isDismissAllowed = index === 0;
77
89
  return jsx(SlideIn, {
78
- enterFrom: 'left',
79
- fade: 'inout',
90
+ enterFrom: "left",
91
+ fade: "inout",
80
92
  duration: flagAnimationTime,
81
93
  animationTimingFunction: () => easeIn
82
94
  }, props => jsx("div", _extends({}, props, {
83
- css: css`
84
- ${baseStyles}
85
- ${isDismissAllowed ? // Transform needed to push up while 1st flag is leaving
86
- // Exiting time should match the exiting time of motion so is halved
87
- `
88
- && + * {
89
- transform: translate(0, 0);
90
- transition-duration: ${flagAnimationTime / 2}ms
91
- }` : ''}
92
- `
95
+ css: [baseStyles, isDismissAllowed && dismissAllowedStyles]
93
96
  }), jsx(FlagGroupContext.Provider, {
94
97
  value: // Only the first flag should be able to be dismissed.
95
98
  isDismissAllowed ? dismissFlagContext : defaultFlagGroupContext
@@ -101,28 +104,8 @@ const FlagGroup = props => {
101
104
  zIndex: layers.flag()
102
105
  }, jsx("div", {
103
106
  id: id,
104
- css: css`
105
- bottom: ${flagBottom}px;
106
- left: ${flagLeft}px;
107
- position: fixed;
108
- z-index: ${layers.flag()};
109
- @media (max-width: 560px) {
110
- bottom: 0;
111
- left: 0;
112
- }
113
- `
114
- }, hasFlags ? jsx(LabelTag, {
115
- css: css`
116
- border: 0;
117
- clip: rect(1px, 1px, 1px, 1px);
118
- height: 1px;
119
- overflow: hidden;
120
- padding: 0;
121
- position: absolute;
122
- white-space: nowrap;
123
- width: 1px;
124
- `
125
- }, label) : null, jsx(ExitingPersistence, {
107
+ css: flagGroupContainerStyles
108
+ }, hasFlags ? jsx(VisuallyHidden, null, jsx(LabelTag, null, label)) : null, jsx(ExitingPersistence, {
126
109
  appear: false
127
110
  }, renderChildren())));
128
111
  };