@atlaskit/flag 14.3.3 → 14.4.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.
package/CHANGELOG.md CHANGED
@@ -1,5 +1,41 @@
1
1
  # @atlaskit/flag
2
2
 
3
+ ## 14.4.2
4
+
5
+ ### Minor Changes
6
+
7
+ - [`4567d73813c`](https://bitbucket.org/atlassian/atlassian-frontend/commits/4567d73813c) - Instrumented flag with the new theming package, `@atlaskit/tokens`.
8
+
9
+ New tokens will be visible only in applications configured to use the new Tokens API (currently in alpha).
10
+ These changes are intended to be interoperable with the legacy theme implementation. Legacy dark mode users should expect no visual or breaking changes.
11
+
12
+ ### Patch Changes
13
+
14
+ - [`f460cc7c411`](https://bitbucket.org/atlassian/atlassian-frontend/commits/f460cc7c411) - Builds for this package now pass through a tokens babel plugin, removing runtime invocations of the tokens() function and improving bundle size.
15
+ - Updated dependencies
16
+
17
+ ## 14.4.1
18
+
19
+ ### Patch Changes
20
+
21
+ - Updated dependencies
22
+
23
+ ## 14.4.0
24
+
25
+ ### Minor Changes
26
+
27
+ - [`230e1862182`](https://bitbucket.org/atlassian/atlassian-frontend/commits/230e1862182) - Fix a11y eslint error in Flag component
28
+
29
+ ### Patch Changes
30
+
31
+ - Updated dependencies
32
+
33
+ ## 14.3.4
34
+
35
+ ### Patch Changes
36
+
37
+ - [`378d1cef00f`](https://bitbucket.org/atlassian/atlassian-frontend/commits/378d1cef00f) - Bump `@atlaskit/theme` to version `^11.3.0`.
38
+
3
39
  ## 14.3.3
4
40
 
5
41
  ### Patch Changes
@@ -2,6 +2,7 @@ import React from 'react';
2
2
 
3
3
  import SuccessIcon from '@atlaskit/icon/glyph/check-circle';
4
4
  import { G400 } from '@atlaskit/theme/colors';
5
+ import { token } from '@atlaskit/tokens';
5
6
 
6
7
  import Flag, { FlagGroup } from '../src';
7
8
 
@@ -9,7 +10,12 @@ export default () => (
9
10
  <FlagGroup>
10
11
  <Flag
11
12
  appearance="success"
12
- icon={<SuccessIcon label="Success" secondaryColor={G400} />}
13
+ icon={
14
+ <SuccessIcon
15
+ label="Success"
16
+ secondaryColor={token('color.iconBorder.success', G400)}
17
+ />
18
+ }
13
19
  id="success"
14
20
  key="success"
15
21
  title="Connected"
@@ -24,7 +24,7 @@ function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "functio
24
24
  function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
25
25
 
26
26
  var packageName = "@atlaskit/flag";
27
- var packageVersion = "14.3.3";
27
+ var packageVersion = "14.4.2";
28
28
  var AUTO_DISMISS_SECONDS = 8;
29
29
  exports.AUTO_DISMISS_SECONDS = AUTO_DISMISS_SECONDS;
30
30
 
package/dist/cjs/flag.js CHANGED
@@ -41,9 +41,7 @@ var _flagActions = _interopRequireDefault(require("./flag-actions"));
41
41
 
42
42
  var _flagGroup = require("./flag-group");
43
43
 
44
- var _utils = require("./utils");
45
-
46
- var _templateObject, _templateObject2, _templateObject3, _templateObject4, _templateObject5;
44
+ var _templateObject, _templateObject2, _templateObject3, _templateObject4, _templateObject5, _templateObject6;
47
45
 
48
46
  function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) { symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); } keys.push.apply(keys, symbols); } return keys; }
49
47
 
@@ -54,7 +52,7 @@ function noop() {}
54
52
  var analyticsAttributes = {
55
53
  componentName: 'flag',
56
54
  packageName: "@atlaskit/flag",
57
- packageVersion: "14.3.3"
55
+ packageVersion: "14.4.2"
58
56
  };
59
57
  var gridSize = (0, _constants.gridSize)();
60
58
  var doubleGridSize = gridSize * 2;
@@ -178,44 +176,43 @@ var Flag = function Flag(props) {
178
176
  onBlur: onBlurAnalytics
179
177
  };
180
178
  var OptionalDismissButton = renderToggleOrDismissButton;
181
- var boxShadow = "0 20px 32px -8px ".concat(_theme.flagShadowColor);
179
+ var boxShadow = "var(--ds-overlay, ".concat("0 20px 32px -8px ".concat(_theme.flagShadowColor), ")");
182
180
 
183
181
  if (!isBold) {
184
- boxShadow = "0 0 1px ".concat(_theme.flagBorderColor, ", ").concat(boxShadow);
182
+ boxShadow = "var(--ds-overlay, ".concat("0 0 1px ".concat(_theme.flagBorderColor, ", ").concat(boxShadow), ")");
185
183
  }
186
184
 
187
185
  return (0, _core.jsx)(_components.default.Consumer, null, function (tokens) {
188
186
  var mode = tokens.mode;
189
187
  var textColour = (0, _theme.getFlagTextColor)(appearance, mode);
190
- return (// https://product-fabric.atlassian.net/browse/DST-1972
191
- // eslint-disable-next-line jsx-a11y/no-noninteractive-element-interactions
192
- (0, _core.jsx)("div", (0, _extends2.default)({
193
- css: (0, _core.css)(_templateObject2 || (_templateObject2 = (0, _taggedTemplateLiteral2.default)(["\n background-color: ", ";\n border-radius: ", "px;\n box-sizing: border-box;\n box-shadow: ", ";\n color: ", ";\n padding: ", "px;\n transition: background-color 200ms;\n width: 100%;\n z-index: ", ";\n\n &:focus {\n outline: none;\n box-shadow: 0 0 0 2px ", ";\n }\n "])), (0, _theme.getFlagBackgroundColor)(appearance, mode), (0, _constants.borderRadius)(), boxShadow, textColour, doubleGridSize, _constants.layers.flag(), (0, _theme.getFlagFocusRingColor)(appearance, mode)),
194
- role: "alert" // eslint-disable-next-line jsx-a11y/no-noninteractive-tabindex
195
- ,
196
- tabIndex: 0,
197
- onMouseDown: _utils.onMouseDownBlur,
198
- "data-testid": testId
199
- }, autoDismissProps), (0, _core.jsx)("div", {
200
- css: (0, _core.css)(_templateObject3 || (_templateObject3 = (0, _taggedTemplateLiteral2.default)(["\n display: flex;\n align-items: center;\n height: ", "px;\n "])), headerHeight)
201
- }, icon, (0, _core.jsx)("span", {
202
- css: (0, _core.css)(_templateObject4 || (_templateObject4 = (0, _taggedTemplateLiteral2.default)(["\n color: ", ";\n font-weight: 600;\n flex: 1;\n overflow: hidden;\n text-overflow: ellipsis;\n white-space: nowrap;\n padding: 0 0 0 ", "px;\n "])), textColour, doubleGridSize)
203
- }, title), (0, _core.jsx)(OptionalDismissButton, {
204
- mode: mode
205
- })), (0, _core.jsx)(_expander.default, {
206
- isExpanded: !isBold || isExpanded,
207
- testId: testId
208
- }, description && (0, _core.jsx)("div", {
209
- css: (0, _core.css)(_templateObject5 || (_templateObject5 = (0, _taggedTemplateLiteral2.default)(["\n color: ", ";\n word-wrap: break-word;\n overflow: auto;\n max-height: 100px; /* height is defined as 5 lines maximum by design */\n "])), textColour),
210
- "data-testid": testId && "".concat(testId, "-description")
211
- }, description), (0, _core.jsx)(_flagActions.default, {
212
- actions: actions,
213
- appearance: appearance,
214
- linkComponent: linkComponent,
215
- testId: testId,
216
- mode: mode
217
- })))
218
- );
188
+ var iconColour = (0, _theme.getFlagIconColor)(appearance, mode);
189
+ return (0, _core.jsx)("div", (0, _extends2.default)({
190
+ css: (0, _core.css)(_templateObject2 || (_templateObject2 = (0, _taggedTemplateLiteral2.default)(["\n background-color: ", ";\n border-radius: ", "px;\n box-shadow: ", ";\n color: ", ";\n transition: background-color 200ms;\n width: 100%;\n z-index: ", ";\n "])), (0, _theme.getFlagBackgroundColor)(appearance, mode), (0, _constants.borderRadius)(), boxShadow, textColour, _constants.layers.flag()),
191
+ role: "alert",
192
+ "data-testid": testId
193
+ }, autoDismissProps), (0, _core.jsx)("div", {
194
+ css: (0, _core.css)(_templateObject3 || (_templateObject3 = (0, _taggedTemplateLiteral2.default)(["\n width: 100%;\n padding: ", "px;\n box-sizing: border-box;\n border-radius: ", "px;\n\n &:focus-visible {\n outline: none;\n box-shadow: 0 0 0 2px\n ", ";\n }\n\n @supports not selector(*:focus-visible) {\n &:focus {\n outline: none;\n box-shadow: 0 0 0 2px\n ", ";\n }\n }\n\n @media screen and (forced-colors: active),\n screen and (-ms-high-contrast: active) {\n &:focus-visible {\n outline: 1px solid;\n }\n }\n "])), doubleGridSize, (0, _constants.borderRadius)(), (0, _theme.getFlagFocusRingColor)(appearance, mode), (0, _theme.getFlagFocusRingColor)(appearance, mode)) // eslint-disable-next-line jsx-a11y/no-noninteractive-tabindex
195
+ ,
196
+ tabIndex: 0
197
+ }, (0, _core.jsx)("div", {
198
+ css: (0, _core.css)(_templateObject4 || (_templateObject4 = (0, _taggedTemplateLiteral2.default)(["\n color: ", ";\n display: flex;\n align-items: center;\n height: ", "px;\n "])), iconColour, headerHeight)
199
+ }, icon, (0, _core.jsx)("span", {
200
+ css: (0, _core.css)(_templateObject5 || (_templateObject5 = (0, _taggedTemplateLiteral2.default)(["\n color: ", ";\n font-weight: 600;\n flex: 1;\n overflow: hidden;\n text-overflow: ellipsis;\n white-space: nowrap;\n padding: 0 0 0 ", "px;\n "])), textColour, doubleGridSize)
201
+ }, title), (0, _core.jsx)(OptionalDismissButton, {
202
+ mode: mode
203
+ })), (0, _core.jsx)(_expander.default, {
204
+ isExpanded: !isBold || isExpanded,
205
+ testId: testId
206
+ }, description && (0, _core.jsx)("div", {
207
+ css: (0, _core.css)(_templateObject6 || (_templateObject6 = (0, _taggedTemplateLiteral2.default)(["\n color: ", ";\n word-wrap: break-word;\n overflow: auto;\n max-height: 100px; /* height is defined as 5 lines maximum by design */\n "])), textColour),
208
+ "data-testid": testId && "".concat(testId, "-description")
209
+ }, description), (0, _core.jsx)(_flagActions.default, {
210
+ actions: actions,
211
+ appearance: appearance,
212
+ linkComponent: linkComponent,
213
+ testId: testId,
214
+ mode: mode
215
+ }))));
219
216
  });
220
217
  };
221
218
 
package/dist/cjs/theme.js CHANGED
@@ -1,38 +1,32 @@
1
1
  "use strict";
2
2
 
3
- var _typeof = require("@babel/runtime/helpers/typeof");
4
-
5
3
  Object.defineProperty(exports, "__esModule", {
6
4
  value: true
7
5
  });
8
- exports.getActionColor = exports.getActionBackground = exports.getFlagFocusRingColor = exports.flagShadowColor = exports.getFlagTextColor = exports.flagBorderColor = exports.getFlagBackgroundColor = void 0;
9
-
10
- var colors = _interopRequireWildcard(require("@atlaskit/theme/colors"));
11
-
12
- function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
6
+ exports.getActionColor = exports.getActionBackground = exports.getFlagFocusRingColor = exports.flagShadowColor = exports.getFlagIconColor = exports.getFlagTextColor = exports.flagBorderColor = exports.getFlagBackgroundColor = void 0;
13
7
 
14
- function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
8
+ var _colors = require("@atlaskit/theme/colors");
15
9
 
16
10
  var flagBackgroundColor = {
17
11
  error: {
18
- light: colors.R400,
19
- dark: colors.R300
12
+ light: "var(--ds-background-overlay, ".concat(_colors.R400, ")"),
13
+ dark: "var(--ds-background-overlay, ".concat(_colors.R300, ")")
20
14
  },
21
15
  info: {
22
- light: colors.N500,
23
- dark: colors.N500
16
+ light: "var(--ds-background-overlay, ".concat(_colors.N500, ")"),
17
+ dark: "var(--ds-background-overlay, ".concat(_colors.N500, ")")
24
18
  },
25
19
  normal: {
26
- light: colors.N0,
27
- dark: colors.DN50
20
+ light: "var(--ds-background-overlay, ".concat(_colors.N0, ")"),
21
+ dark: "var(--ds-background-overlay, ".concat(_colors.DN50, ")")
28
22
  },
29
23
  success: {
30
- light: colors.G400,
31
- dark: colors.G300
24
+ light: "var(--ds-background-overlay, ".concat(_colors.G400, ")"),
25
+ dark: "var(--ds-background-overlay, ".concat(_colors.G300, ")")
32
26
  },
33
27
  warning: {
34
- light: colors.Y200,
35
- dark: colors.Y300
28
+ light: "var(--ds-background-overlay, ".concat(_colors.Y200, ")"),
29
+ dark: "var(--ds-background-overlay, ".concat(_colors.Y300, ")")
36
30
  }
37
31
  };
38
32
 
@@ -41,28 +35,50 @@ var getFlagBackgroundColor = function getFlagBackgroundColor(appearance, mode) {
41
35
  };
42
36
 
43
37
  exports.getFlagBackgroundColor = getFlagBackgroundColor;
44
- var flagBorderColor = colors.N60A;
38
+ var flagBorderColor = "var(--ds-background-overlay, ".concat(_colors.N60A, ")");
45
39
  exports.flagBorderColor = flagBorderColor;
40
+ var flagIconColor = {
41
+ error: {
42
+ light: "var(--ds-iconBorder-danger, ".concat(_colors.N0, ")"),
43
+ dark: "var(--ds-iconBorder-danger, ".concat(_colors.DN40, ")")
44
+ },
45
+ info: {
46
+ light: "var(--ds-iconBorder-discovery, ".concat(_colors.N0, ")"),
47
+ dark: "var(--ds-iconBorder-discovery, ".concat(_colors.DN600, ")")
48
+ },
49
+ normal: {
50
+ light: "var(--ds-iconBorder-brand, ".concat(_colors.N500, ")"),
51
+ dark: "var(--ds-iconBorder-brand, ".concat(_colors.DN600, ")")
52
+ },
53
+ success: {
54
+ light: "var(--ds-iconBorder-success, ".concat(_colors.N0, ")"),
55
+ dark: "var(--ds-iconBorder-success, ".concat(_colors.DN40, ")")
56
+ },
57
+ warning: {
58
+ light: "var(--ds-iconBorder-warning, ".concat(_colors.N700, ")"),
59
+ dark: "var(--ds-iconBorder-warning, ".concat(_colors.DN40, ")")
60
+ }
61
+ };
46
62
  var flagTextColor = {
47
63
  error: {
48
- light: colors.N0,
49
- dark: colors.DN40
64
+ light: "var(--ds-text-highEmphasis, ".concat(_colors.N0, ")"),
65
+ dark: "var(--ds-text-highEmphasis, ".concat(_colors.DN40, ")")
50
66
  },
51
67
  info: {
52
- light: colors.N0,
53
- dark: colors.DN600
68
+ light: "var(--ds-text-highEmphasis, ".concat(_colors.N0, ")"),
69
+ dark: "var(--ds-text-highEmphasis, ".concat(_colors.DN600, ")")
54
70
  },
55
71
  normal: {
56
- light: colors.N500,
57
- dark: colors.DN600
72
+ light: "var(--ds-text-highEmphasis, ".concat(_colors.N500, ")"),
73
+ dark: "var(--ds-text-highEmphasis, ".concat(_colors.DN600, ")")
58
74
  },
59
75
  success: {
60
- light: colors.N0,
61
- dark: colors.DN40
76
+ light: "var(--ds-text-highEmphasis, ".concat(_colors.N0, ")"),
77
+ dark: "var(--ds-text-highEmphasis, ".concat(_colors.DN40, ")")
62
78
  },
63
79
  warning: {
64
- light: colors.N700,
65
- dark: colors.DN40
80
+ light: "var(--ds-text-highEmphasis, ".concat(_colors.N700, ")"),
81
+ dark: "var(--ds-text-highEmphasis, ".concat(_colors.DN40, ")")
66
82
  }
67
83
  };
68
84
 
@@ -71,28 +87,36 @@ var getFlagTextColor = function getFlagTextColor(appearance, mode) {
71
87
  };
72
88
 
73
89
  exports.getFlagTextColor = getFlagTextColor;
74
- var flagShadowColor = colors.N50A;
90
+
91
+ var getFlagIconColor = function getFlagIconColor(appearance, mode) {
92
+ return flagIconColor[appearance][mode];
93
+ }; // token set in flag.tsx instead
94
+ // eslint-disable-next-line @atlaskit/design-system/ensure-design-token-usage
95
+
96
+
97
+ exports.getFlagIconColor = getFlagIconColor;
98
+ var flagShadowColor = _colors.N50A;
75
99
  exports.flagShadowColor = flagShadowColor;
76
100
  var flagFocusRingColor = {
77
101
  error: {
78
- light: colors.N40,
79
- dark: colors.N40
102
+ light: "var(--ds-border-focus, ".concat(_colors.N40, ")"),
103
+ dark: "var(--ds-border-focus, ".concat(_colors.N40, ")")
80
104
  },
81
105
  info: {
82
- light: colors.N40,
83
- dark: colors.N40
106
+ light: "var(--ds-border-focus, ".concat(_colors.N40, ")"),
107
+ dark: "var(--ds-border-focus, ".concat(_colors.N40, ")")
84
108
  },
85
109
  normal: {
86
- light: colors.B100,
87
- dark: colors.B100
110
+ light: "var(--ds-border-focus, ".concat(_colors.B100, ")"),
111
+ dark: "var(--ds-border-focus, ".concat(_colors.B100, ")")
88
112
  },
89
113
  success: {
90
- light: colors.N40,
91
- dark: colors.N40
114
+ light: "var(--ds-border-focus, ".concat(_colors.N40, ")"),
115
+ dark: "var(--ds-border-focus, ".concat(_colors.N40, ")")
92
116
  },
93
117
  warning: {
94
- light: colors.N200,
95
- dark: colors.N200
118
+ light: "var(--ds-border-focus, ".concat(_colors.N200, ")"),
119
+ dark: "var(--ds-border-focus, ".concat(_colors.N200, ")")
96
120
  }
97
121
  };
98
122
 
@@ -104,46 +128,46 @@ exports.getFlagFocusRingColor = getFlagFocusRingColor;
104
128
  var lightButtonBackground = 'rgba(255, 255, 255, 0.08)';
105
129
  var actionBackground = {
106
130
  success: {
107
- light: lightButtonBackground,
108
- dark: colors.N30A
131
+ light: "var(--ds-background-subtleNeutral-resting, ".concat(lightButtonBackground, ")"),
132
+ dark: "var(--ds-background-subtleNeutral-resting, ".concat(_colors.N30A, ")")
109
133
  },
110
134
  info: {
111
- light: lightButtonBackground,
112
- dark: lightButtonBackground
135
+ light: "var(--ds-background-subtleNeutral-resting, ".concat(lightButtonBackground, ")"),
136
+ dark: "var(--ds-background-subtleNeutral-resting, ".concat(lightButtonBackground, ")")
113
137
  },
114
138
  error: {
115
- light: lightButtonBackground,
116
- dark: colors.N30A
139
+ light: "var(--ds-background-subtleNeutral-resting, ".concat(lightButtonBackground, ")"),
140
+ dark: "var(--ds-background-subtleNeutral-resting, ".concat(_colors.N30A, ")")
117
141
  },
118
142
  warning: {
119
- light: colors.N30A,
120
- dark: colors.N30A
143
+ light: "var(--ds-background-subtleNeutral-resting, ".concat(_colors.N30A, ")"),
144
+ dark: "var(--ds-background-subtleNeutral-resting, ".concat(_colors.N30A, ")")
121
145
  },
122
146
  normal: {
123
- light: 'none',
124
- dark: 'none'
147
+ light: "var(--ds-background-subtleNeutral-resting, none)",
148
+ dark: "var(--ds-background-subtleNeutral-resting, none)"
125
149
  }
126
150
  };
127
151
  var actionColor = {
128
152
  success: {
129
- light: colors.N0,
130
- dark: colors.DN40
153
+ light: "var(--ds-text-mediumEmphasis, ".concat(_colors.N0, ")"),
154
+ dark: "var(--ds-text-mediumEmphasis, ".concat(_colors.DN40, ")")
131
155
  },
132
156
  info: {
133
- light: colors.N0,
134
- dark: colors.DN600
157
+ light: "var(--ds-text-mediumEmphasis, ".concat(_colors.N0, ")"),
158
+ dark: "var(--ds-text-mediumEmphasis, ".concat(_colors.DN600, ")")
135
159
  },
136
160
  error: {
137
- light: colors.N0,
138
- dark: colors.DN600
161
+ light: "var(--ds-text-mediumEmphasis, ".concat(_colors.N0, ")"),
162
+ dark: "var(--ds-text-mediumEmphasis, ".concat(_colors.DN600, ")")
139
163
  },
140
164
  warning: {
141
- light: colors.N700,
142
- dark: colors.DN40
165
+ light: "var(--ds-text-mediumEmphasis, ".concat(_colors.N700, ")"),
166
+ dark: "var(--ds-text-mediumEmphasis, ".concat(_colors.DN40, ")")
143
167
  },
144
168
  normal: {
145
- light: colors.B400,
146
- dark: colors.B100
169
+ light: "var(--ds-text-mediumEmphasis, ".concat(_colors.B400, ")"),
170
+ dark: "var(--ds-text-mediumEmphasis, ".concat(_colors.B100, ")")
147
171
  }
148
172
  };
149
173
 
@@ -1,5 +1,5 @@
1
1
  {
2
2
  "name": "@atlaskit/flag",
3
- "version": "14.3.3",
3
+ "version": "14.4.2",
4
4
  "sideEffects": false
5
5
  }
@@ -4,7 +4,7 @@ import { usePlatformLeafEventHandler } from '@atlaskit/analytics-next/usePlatfor
4
4
  import Flag from './flag';
5
5
  import { useFlagGroup } from './flag-group';
6
6
  const packageName = "@atlaskit/flag";
7
- const packageVersion = "14.3.3";
7
+ const packageVersion = "14.4.2";
8
8
  export const AUTO_DISMISS_SECONDS = 8;
9
9
 
10
10
  function noop() {}
@@ -10,18 +10,17 @@ import GlobalTheme from '@atlaskit/theme/components';
10
10
  import { borderRadius, gridSize as getGridSize, layers } from '@atlaskit/theme/constants';
11
11
  import { usePlatformLeafEventHandler } from '@atlaskit/analytics-next/usePlatformLeafEventHandler';
12
12
  import { DEFAULT_APPEARANCE } from './constants';
13
- import { flagBorderColor, flagShadowColor, getFlagBackgroundColor, getFlagFocusRingColor, getFlagTextColor } from './theme';
13
+ import { flagBorderColor, flagShadowColor, getFlagBackgroundColor, getFlagFocusRingColor, getFlagTextColor, getFlagIconColor } from './theme';
14
14
  import Expander from './expander';
15
15
  import Actions from './flag-actions';
16
16
  import { useFlagGroup } from './flag-group';
17
- import { onMouseDownBlur } from './utils';
18
17
 
19
18
  function noop() {}
20
19
 
21
20
  const analyticsAttributes = {
22
21
  componentName: 'flag',
23
22
  packageName: "@atlaskit/flag",
24
- packageVersion: "14.3.3"
23
+ packageVersion: "14.4.2"
25
24
  };
26
25
  const gridSize = getGridSize();
27
26
  const doubleGridSize = gridSize * 2;
@@ -153,76 +152,95 @@ const Flag = props => {
153
152
  onBlur: onBlurAnalytics
154
153
  };
155
154
  const OptionalDismissButton = renderToggleOrDismissButton;
156
- let boxShadow = `0 20px 32px -8px ${flagShadowColor}`;
155
+ let boxShadow = `var(--ds-overlay, ${`0 20px 32px -8px ${flagShadowColor}`})`;
157
156
 
158
157
  if (!isBold) {
159
- boxShadow = `0 0 1px ${flagBorderColor}, ${boxShadow}`;
158
+ boxShadow = `var(--ds-overlay, ${`0 0 1px ${flagBorderColor}, ${boxShadow}`})`;
160
159
  }
161
160
 
162
161
  return jsx(GlobalTheme.Consumer, null, tokens => {
163
162
  const mode = tokens.mode;
164
163
  const textColour = getFlagTextColor(appearance, mode);
165
- return (// https://product-fabric.atlassian.net/browse/DST-1972
166
- // eslint-disable-next-line jsx-a11y/no-noninteractive-element-interactions
167
- jsx("div", _extends({
168
- css: css`
164
+ const iconColour = getFlagIconColor(appearance, mode);
165
+ return jsx("div", _extends({
166
+ css: css`
169
167
  background-color: ${getFlagBackgroundColor(appearance, mode)};
170
168
  border-radius: ${borderRadius()}px;
171
- box-sizing: border-box;
172
169
  box-shadow: ${boxShadow};
173
170
  color: ${textColour};
174
- padding: ${doubleGridSize}px;
175
171
  transition: background-color 200ms;
176
172
  width: 100%;
177
173
  z-index: ${layers.flag()};
178
-
179
- &:focus {
180
- outline: none;
181
- box-shadow: 0 0 0 2px ${getFlagFocusRingColor(appearance, mode)};
182
- }
183
174
  `,
184
- role: "alert" // eslint-disable-next-line jsx-a11y/no-noninteractive-tabindex
185
- ,
186
- tabIndex: 0,
187
- onMouseDown: onMouseDownBlur,
188
- "data-testid": testId
189
- }, autoDismissProps), jsx("div", {
190
- css: css`
191
- display: flex;
192
- align-items: center;
193
- height: ${headerHeight}px;
194
- `
195
- }, icon, jsx("span", {
196
- css: css`
197
- color: ${textColour};
198
- font-weight: 600;
199
- flex: 1;
200
- overflow: hidden;
201
- text-overflow: ellipsis;
202
- white-space: nowrap;
203
- padding: 0 0 0 ${doubleGridSize}px;
175
+ role: "alert",
176
+ "data-testid": testId
177
+ }, autoDismissProps), jsx("div", {
178
+ css: css`
179
+ width: 100%;
180
+ padding: ${doubleGridSize}px;
181
+ box-sizing: border-box;
182
+ border-radius: ${borderRadius()}px;
183
+
184
+ &:focus-visible {
185
+ outline: none;
186
+ box-shadow: 0 0 0 2px
187
+ ${getFlagFocusRingColor(appearance, mode)};
188
+ }
189
+
190
+ @supports not selector(*:focus-visible) {
191
+ &:focus {
192
+ outline: none;
193
+ box-shadow: 0 0 0 2px
194
+ ${getFlagFocusRingColor(appearance, mode)};
195
+ }
196
+ }
197
+
198
+ @media screen and (forced-colors: active),
199
+ screen and (-ms-high-contrast: active) {
200
+ &:focus-visible {
201
+ outline: 1px solid;
202
+ }
203
+ }
204
+ ` // eslint-disable-next-line jsx-a11y/no-noninteractive-tabindex
205
+ ,
206
+ tabIndex: 0
207
+ }, jsx("div", {
208
+ css: css`
209
+ color: ${iconColour};
210
+ display: flex;
211
+ align-items: center;
212
+ height: ${headerHeight}px;
204
213
  `
205
- }, title), jsx(OptionalDismissButton, {
206
- mode: mode
207
- })), jsx(Expander, {
208
- isExpanded: !isBold || isExpanded,
209
- testId: testId
210
- }, description && jsx("div", {
211
- css: css`
214
+ }, icon, jsx("span", {
215
+ css: css`
212
216
  color: ${textColour};
213
- word-wrap: break-word;
214
- overflow: auto;
215
- max-height: 100px; /* height is defined as 5 lines maximum by design */
216
- `,
217
- "data-testid": testId && `${testId}-description`
218
- }, description), jsx(Actions, {
219
- actions: actions,
220
- appearance: appearance,
221
- linkComponent: linkComponent,
222
- testId: testId,
223
- mode: mode
224
- })))
225
- );
217
+ font-weight: 600;
218
+ flex: 1;
219
+ overflow: hidden;
220
+ text-overflow: ellipsis;
221
+ white-space: nowrap;
222
+ padding: 0 0 0 ${doubleGridSize}px;
223
+ `
224
+ }, title), jsx(OptionalDismissButton, {
225
+ mode: mode
226
+ })), jsx(Expander, {
227
+ isExpanded: !isBold || isExpanded,
228
+ testId: testId
229
+ }, description && jsx("div", {
230
+ css: css`
231
+ color: ${textColour};
232
+ word-wrap: break-word;
233
+ overflow: auto;
234
+ max-height: 100px; /* height is defined as 5 lines maximum by design */
235
+ `,
236
+ "data-testid": testId && `${testId}-description`
237
+ }, description), jsx(Actions, {
238
+ actions: actions,
239
+ appearance: appearance,
240
+ linkComponent: linkComponent,
241
+ testId: testId,
242
+ mode: mode
243
+ }))));
226
244
  });
227
245
  };
228
246
 
@@ -1,118 +1,143 @@
1
- import * as colors from '@atlaskit/theme/colors';
1
+ import { B100, B400, DN40, DN50, DN600, G300, G400, N0, N200, N30A, N40, N500, N50A, N60A, N700, R300, R400, Y200, Y300 } from '@atlaskit/theme/colors';
2
2
  const flagBackgroundColor = {
3
3
  error: {
4
- light: colors.R400,
5
- dark: colors.R300
4
+ light: `var(--ds-background-overlay, ${R400})`,
5
+ dark: `var(--ds-background-overlay, ${R300})`
6
6
  },
7
7
  info: {
8
- light: colors.N500,
9
- dark: colors.N500
8
+ light: `var(--ds-background-overlay, ${N500})`,
9
+ dark: `var(--ds-background-overlay, ${N500})`
10
10
  },
11
11
  normal: {
12
- light: colors.N0,
13
- dark: colors.DN50
12
+ light: `var(--ds-background-overlay, ${N0})`,
13
+ dark: `var(--ds-background-overlay, ${DN50})`
14
14
  },
15
15
  success: {
16
- light: colors.G400,
17
- dark: colors.G300
16
+ light: `var(--ds-background-overlay, ${G400})`,
17
+ dark: `var(--ds-background-overlay, ${G300})`
18
18
  },
19
19
  warning: {
20
- light: colors.Y200,
21
- dark: colors.Y300
20
+ light: `var(--ds-background-overlay, ${Y200})`,
21
+ dark: `var(--ds-background-overlay, ${Y300})`
22
22
  }
23
23
  };
24
24
  export const getFlagBackgroundColor = (appearance, mode) => flagBackgroundColor[appearance][mode];
25
- export const flagBorderColor = colors.N60A;
25
+ export const flagBorderColor = `var(--ds-background-overlay, ${N60A})`;
26
+ const flagIconColor = {
27
+ error: {
28
+ light: `var(--ds-iconBorder-danger, ${N0})`,
29
+ dark: `var(--ds-iconBorder-danger, ${DN40})`
30
+ },
31
+ info: {
32
+ light: `var(--ds-iconBorder-discovery, ${N0})`,
33
+ dark: `var(--ds-iconBorder-discovery, ${DN600})`
34
+ },
35
+ normal: {
36
+ light: `var(--ds-iconBorder-brand, ${N500})`,
37
+ dark: `var(--ds-iconBorder-brand, ${DN600})`
38
+ },
39
+ success: {
40
+ light: `var(--ds-iconBorder-success, ${N0})`,
41
+ dark: `var(--ds-iconBorder-success, ${DN40})`
42
+ },
43
+ warning: {
44
+ light: `var(--ds-iconBorder-warning, ${N700})`,
45
+ dark: `var(--ds-iconBorder-warning, ${DN40})`
46
+ }
47
+ };
26
48
  const flagTextColor = {
27
49
  error: {
28
- light: colors.N0,
29
- dark: colors.DN40
50
+ light: `var(--ds-text-highEmphasis, ${N0})`,
51
+ dark: `var(--ds-text-highEmphasis, ${DN40})`
30
52
  },
31
53
  info: {
32
- light: colors.N0,
33
- dark: colors.DN600
54
+ light: `var(--ds-text-highEmphasis, ${N0})`,
55
+ dark: `var(--ds-text-highEmphasis, ${DN600})`
34
56
  },
35
57
  normal: {
36
- light: colors.N500,
37
- dark: colors.DN600
58
+ light: `var(--ds-text-highEmphasis, ${N500})`,
59
+ dark: `var(--ds-text-highEmphasis, ${DN600})`
38
60
  },
39
61
  success: {
40
- light: colors.N0,
41
- dark: colors.DN40
62
+ light: `var(--ds-text-highEmphasis, ${N0})`,
63
+ dark: `var(--ds-text-highEmphasis, ${DN40})`
42
64
  },
43
65
  warning: {
44
- light: colors.N700,
45
- dark: colors.DN40
66
+ light: `var(--ds-text-highEmphasis, ${N700})`,
67
+ dark: `var(--ds-text-highEmphasis, ${DN40})`
46
68
  }
47
69
  };
48
70
  export const getFlagTextColor = (appearance, mode) => flagTextColor[appearance][mode];
49
- export const flagShadowColor = colors.N50A;
71
+ export const getFlagIconColor = (appearance, mode) => flagIconColor[appearance][mode]; // token set in flag.tsx instead
72
+ // eslint-disable-next-line @atlaskit/design-system/ensure-design-token-usage
73
+
74
+ export const flagShadowColor = N50A;
50
75
  const flagFocusRingColor = {
51
76
  error: {
52
- light: colors.N40,
53
- dark: colors.N40
77
+ light: `var(--ds-border-focus, ${N40})`,
78
+ dark: `var(--ds-border-focus, ${N40})`
54
79
  },
55
80
  info: {
56
- light: colors.N40,
57
- dark: colors.N40
81
+ light: `var(--ds-border-focus, ${N40})`,
82
+ dark: `var(--ds-border-focus, ${N40})`
58
83
  },
59
84
  normal: {
60
- light: colors.B100,
61
- dark: colors.B100
85
+ light: `var(--ds-border-focus, ${B100})`,
86
+ dark: `var(--ds-border-focus, ${B100})`
62
87
  },
63
88
  success: {
64
- light: colors.N40,
65
- dark: colors.N40
89
+ light: `var(--ds-border-focus, ${N40})`,
90
+ dark: `var(--ds-border-focus, ${N40})`
66
91
  },
67
92
  warning: {
68
- light: colors.N200,
69
- dark: colors.N200
93
+ light: `var(--ds-border-focus, ${N200})`,
94
+ dark: `var(--ds-border-focus, ${N200})`
70
95
  }
71
96
  };
72
97
  export const getFlagFocusRingColor = (appearance, mode) => flagFocusRingColor[appearance][mode];
73
98
  const lightButtonBackground = 'rgba(255, 255, 255, 0.08)';
74
99
  const actionBackground = {
75
100
  success: {
76
- light: lightButtonBackground,
77
- dark: colors.N30A
101
+ light: `var(--ds-background-subtleNeutral-resting, ${lightButtonBackground})`,
102
+ dark: `var(--ds-background-subtleNeutral-resting, ${N30A})`
78
103
  },
79
104
  info: {
80
- light: lightButtonBackground,
81
- dark: lightButtonBackground
105
+ light: `var(--ds-background-subtleNeutral-resting, ${lightButtonBackground})`,
106
+ dark: `var(--ds-background-subtleNeutral-resting, ${lightButtonBackground})`
82
107
  },
83
108
  error: {
84
- light: lightButtonBackground,
85
- dark: colors.N30A
109
+ light: `var(--ds-background-subtleNeutral-resting, ${lightButtonBackground})`,
110
+ dark: `var(--ds-background-subtleNeutral-resting, ${N30A})`
86
111
  },
87
112
  warning: {
88
- light: colors.N30A,
89
- dark: colors.N30A
113
+ light: `var(--ds-background-subtleNeutral-resting, ${N30A})`,
114
+ dark: `var(--ds-background-subtleNeutral-resting, ${N30A})`
90
115
  },
91
116
  normal: {
92
- light: 'none',
93
- dark: 'none'
117
+ light: "var(--ds-background-subtleNeutral-resting, none)",
118
+ dark: "var(--ds-background-subtleNeutral-resting, none)"
94
119
  }
95
120
  };
96
121
  const actionColor = {
97
122
  success: {
98
- light: colors.N0,
99
- dark: colors.DN40
123
+ light: `var(--ds-text-mediumEmphasis, ${N0})`,
124
+ dark: `var(--ds-text-mediumEmphasis, ${DN40})`
100
125
  },
101
126
  info: {
102
- light: colors.N0,
103
- dark: colors.DN600
127
+ light: `var(--ds-text-mediumEmphasis, ${N0})`,
128
+ dark: `var(--ds-text-mediumEmphasis, ${DN600})`
104
129
  },
105
130
  error: {
106
- light: colors.N0,
107
- dark: colors.DN600
131
+ light: `var(--ds-text-mediumEmphasis, ${N0})`,
132
+ dark: `var(--ds-text-mediumEmphasis, ${DN600})`
108
133
  },
109
134
  warning: {
110
- light: colors.N700,
111
- dark: colors.DN40
135
+ light: `var(--ds-text-mediumEmphasis, ${N700})`,
136
+ dark: `var(--ds-text-mediumEmphasis, ${DN40})`
112
137
  },
113
138
  normal: {
114
- light: colors.B400,
115
- dark: colors.B100
139
+ light: `var(--ds-text-mediumEmphasis, ${B400})`,
140
+ dark: `var(--ds-text-mediumEmphasis, ${B100})`
116
141
  }
117
142
  };
118
143
  export const getActionBackground = (appearance, mode) => actionBackground[appearance][mode];
@@ -1,5 +1,5 @@
1
1
  {
2
2
  "name": "@atlaskit/flag",
3
- "version": "14.3.3",
3
+ "version": "14.4.2",
4
4
  "sideEffects": false
5
5
  }
@@ -4,7 +4,7 @@ import { usePlatformLeafEventHandler } from '@atlaskit/analytics-next/usePlatfor
4
4
  import Flag from './flag';
5
5
  import { useFlagGroup } from './flag-group';
6
6
  var packageName = "@atlaskit/flag";
7
- var packageVersion = "14.3.3";
7
+ var packageVersion = "14.4.2";
8
8
  export var AUTO_DISMISS_SECONDS = 8;
9
9
 
10
10
  function noop() {}
package/dist/esm/flag.js CHANGED
@@ -3,7 +3,7 @@ import _taggedTemplateLiteral from "@babel/runtime/helpers/taggedTemplateLiteral
3
3
  import _defineProperty from "@babel/runtime/helpers/defineProperty";
4
4
  import _slicedToArray from "@babel/runtime/helpers/slicedToArray";
5
5
 
6
- var _templateObject, _templateObject2, _templateObject3, _templateObject4, _templateObject5;
6
+ var _templateObject, _templateObject2, _templateObject3, _templateObject4, _templateObject5, _templateObject6;
7
7
 
8
8
  function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) { symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); } keys.push.apply(keys, symbols); } return keys; }
9
9
 
@@ -19,18 +19,17 @@ import GlobalTheme from '@atlaskit/theme/components';
19
19
  import { borderRadius, gridSize as getGridSize, layers } from '@atlaskit/theme/constants';
20
20
  import { usePlatformLeafEventHandler } from '@atlaskit/analytics-next/usePlatformLeafEventHandler';
21
21
  import { DEFAULT_APPEARANCE } from './constants';
22
- import { flagBorderColor, flagShadowColor, getFlagBackgroundColor, getFlagFocusRingColor, getFlagTextColor } from './theme';
22
+ import { flagBorderColor, flagShadowColor, getFlagBackgroundColor, getFlagFocusRingColor, getFlagTextColor, getFlagIconColor } from './theme';
23
23
  import Expander from './expander';
24
24
  import Actions from './flag-actions';
25
25
  import { useFlagGroup } from './flag-group';
26
- import { onMouseDownBlur } from './utils';
27
26
 
28
27
  function noop() {}
29
28
 
30
29
  var analyticsAttributes = {
31
30
  componentName: 'flag',
32
31
  packageName: "@atlaskit/flag",
33
- packageVersion: "14.3.3"
32
+ packageVersion: "14.4.2"
34
33
  };
35
34
  var gridSize = getGridSize();
36
35
  var doubleGridSize = gridSize * 2;
@@ -154,44 +153,43 @@ var Flag = function Flag(props) {
154
153
  onBlur: onBlurAnalytics
155
154
  };
156
155
  var OptionalDismissButton = renderToggleOrDismissButton;
157
- var boxShadow = "0 20px 32px -8px ".concat(flagShadowColor);
156
+ var boxShadow = "var(--ds-overlay, ".concat("0 20px 32px -8px ".concat(flagShadowColor), ")");
158
157
 
159
158
  if (!isBold) {
160
- boxShadow = "0 0 1px ".concat(flagBorderColor, ", ").concat(boxShadow);
159
+ boxShadow = "var(--ds-overlay, ".concat("0 0 1px ".concat(flagBorderColor, ", ").concat(boxShadow), ")");
161
160
  }
162
161
 
163
162
  return jsx(GlobalTheme.Consumer, null, function (tokens) {
164
163
  var mode = tokens.mode;
165
164
  var textColour = getFlagTextColor(appearance, mode);
166
- return (// https://product-fabric.atlassian.net/browse/DST-1972
167
- // eslint-disable-next-line jsx-a11y/no-noninteractive-element-interactions
168
- jsx("div", _extends({
169
- css: css(_templateObject2 || (_templateObject2 = _taggedTemplateLiteral(["\n background-color: ", ";\n border-radius: ", "px;\n box-sizing: border-box;\n box-shadow: ", ";\n color: ", ";\n padding: ", "px;\n transition: background-color 200ms;\n width: 100%;\n z-index: ", ";\n\n &:focus {\n outline: none;\n box-shadow: 0 0 0 2px ", ";\n }\n "])), getFlagBackgroundColor(appearance, mode), borderRadius(), boxShadow, textColour, doubleGridSize, layers.flag(), getFlagFocusRingColor(appearance, mode)),
170
- role: "alert" // eslint-disable-next-line jsx-a11y/no-noninteractive-tabindex
171
- ,
172
- tabIndex: 0,
173
- onMouseDown: onMouseDownBlur,
174
- "data-testid": testId
175
- }, autoDismissProps), jsx("div", {
176
- css: css(_templateObject3 || (_templateObject3 = _taggedTemplateLiteral(["\n display: flex;\n align-items: center;\n height: ", "px;\n "])), headerHeight)
177
- }, icon, jsx("span", {
178
- css: css(_templateObject4 || (_templateObject4 = _taggedTemplateLiteral(["\n color: ", ";\n font-weight: 600;\n flex: 1;\n overflow: hidden;\n text-overflow: ellipsis;\n white-space: nowrap;\n padding: 0 0 0 ", "px;\n "])), textColour, doubleGridSize)
179
- }, title), jsx(OptionalDismissButton, {
180
- mode: mode
181
- })), jsx(Expander, {
182
- isExpanded: !isBold || isExpanded,
183
- testId: testId
184
- }, description && jsx("div", {
185
- css: css(_templateObject5 || (_templateObject5 = _taggedTemplateLiteral(["\n color: ", ";\n word-wrap: break-word;\n overflow: auto;\n max-height: 100px; /* height is defined as 5 lines maximum by design */\n "])), textColour),
186
- "data-testid": testId && "".concat(testId, "-description")
187
- }, description), jsx(Actions, {
188
- actions: actions,
189
- appearance: appearance,
190
- linkComponent: linkComponent,
191
- testId: testId,
192
- mode: mode
193
- })))
194
- );
165
+ var iconColour = getFlagIconColor(appearance, mode);
166
+ return jsx("div", _extends({
167
+ css: css(_templateObject2 || (_templateObject2 = _taggedTemplateLiteral(["\n background-color: ", ";\n border-radius: ", "px;\n box-shadow: ", ";\n color: ", ";\n transition: background-color 200ms;\n width: 100%;\n z-index: ", ";\n "])), getFlagBackgroundColor(appearance, mode), borderRadius(), boxShadow, textColour, layers.flag()),
168
+ role: "alert",
169
+ "data-testid": testId
170
+ }, autoDismissProps), jsx("div", {
171
+ css: css(_templateObject3 || (_templateObject3 = _taggedTemplateLiteral(["\n width: 100%;\n padding: ", "px;\n box-sizing: border-box;\n border-radius: ", "px;\n\n &:focus-visible {\n outline: none;\n box-shadow: 0 0 0 2px\n ", ";\n }\n\n @supports not selector(*:focus-visible) {\n &:focus {\n outline: none;\n box-shadow: 0 0 0 2px\n ", ";\n }\n }\n\n @media screen and (forced-colors: active),\n screen and (-ms-high-contrast: active) {\n &:focus-visible {\n outline: 1px solid;\n }\n }\n "])), doubleGridSize, borderRadius(), getFlagFocusRingColor(appearance, mode), getFlagFocusRingColor(appearance, mode)) // eslint-disable-next-line jsx-a11y/no-noninteractive-tabindex
172
+ ,
173
+ tabIndex: 0
174
+ }, jsx("div", {
175
+ css: css(_templateObject4 || (_templateObject4 = _taggedTemplateLiteral(["\n color: ", ";\n display: flex;\n align-items: center;\n height: ", "px;\n "])), iconColour, headerHeight)
176
+ }, icon, jsx("span", {
177
+ css: css(_templateObject5 || (_templateObject5 = _taggedTemplateLiteral(["\n color: ", ";\n font-weight: 600;\n flex: 1;\n overflow: hidden;\n text-overflow: ellipsis;\n white-space: nowrap;\n padding: 0 0 0 ", "px;\n "])), textColour, doubleGridSize)
178
+ }, title), jsx(OptionalDismissButton, {
179
+ mode: mode
180
+ })), jsx(Expander, {
181
+ isExpanded: !isBold || isExpanded,
182
+ testId: testId
183
+ }, description && jsx("div", {
184
+ css: css(_templateObject6 || (_templateObject6 = _taggedTemplateLiteral(["\n color: ", ";\n word-wrap: break-word;\n overflow: auto;\n max-height: 100px; /* height is defined as 5 lines maximum by design */\n "])), textColour),
185
+ "data-testid": testId && "".concat(testId, "-description")
186
+ }, description), jsx(Actions, {
187
+ actions: actions,
188
+ appearance: appearance,
189
+ linkComponent: linkComponent,
190
+ testId: testId,
191
+ mode: mode
192
+ }))));
195
193
  });
196
194
  };
197
195
 
package/dist/esm/theme.js CHANGED
@@ -1,76 +1,103 @@
1
- import * as colors from '@atlaskit/theme/colors';
1
+ import { B100, B400, DN40, DN50, DN600, G300, G400, N0, N200, N30A, N40, N500, N50A, N60A, N700, R300, R400, Y200, Y300 } from '@atlaskit/theme/colors';
2
2
  var flagBackgroundColor = {
3
3
  error: {
4
- light: colors.R400,
5
- dark: colors.R300
4
+ light: "var(--ds-background-overlay, ".concat(R400, ")"),
5
+ dark: "var(--ds-background-overlay, ".concat(R300, ")")
6
6
  },
7
7
  info: {
8
- light: colors.N500,
9
- dark: colors.N500
8
+ light: "var(--ds-background-overlay, ".concat(N500, ")"),
9
+ dark: "var(--ds-background-overlay, ".concat(N500, ")")
10
10
  },
11
11
  normal: {
12
- light: colors.N0,
13
- dark: colors.DN50
12
+ light: "var(--ds-background-overlay, ".concat(N0, ")"),
13
+ dark: "var(--ds-background-overlay, ".concat(DN50, ")")
14
14
  },
15
15
  success: {
16
- light: colors.G400,
17
- dark: colors.G300
16
+ light: "var(--ds-background-overlay, ".concat(G400, ")"),
17
+ dark: "var(--ds-background-overlay, ".concat(G300, ")")
18
18
  },
19
19
  warning: {
20
- light: colors.Y200,
21
- dark: colors.Y300
20
+ light: "var(--ds-background-overlay, ".concat(Y200, ")"),
21
+ dark: "var(--ds-background-overlay, ".concat(Y300, ")")
22
22
  }
23
23
  };
24
24
  export var getFlagBackgroundColor = function getFlagBackgroundColor(appearance, mode) {
25
25
  return flagBackgroundColor[appearance][mode];
26
26
  };
27
- export var flagBorderColor = colors.N60A;
27
+ export var flagBorderColor = "var(--ds-background-overlay, ".concat(N60A, ")");
28
+ var flagIconColor = {
29
+ error: {
30
+ light: "var(--ds-iconBorder-danger, ".concat(N0, ")"),
31
+ dark: "var(--ds-iconBorder-danger, ".concat(DN40, ")")
32
+ },
33
+ info: {
34
+ light: "var(--ds-iconBorder-discovery, ".concat(N0, ")"),
35
+ dark: "var(--ds-iconBorder-discovery, ".concat(DN600, ")")
36
+ },
37
+ normal: {
38
+ light: "var(--ds-iconBorder-brand, ".concat(N500, ")"),
39
+ dark: "var(--ds-iconBorder-brand, ".concat(DN600, ")")
40
+ },
41
+ success: {
42
+ light: "var(--ds-iconBorder-success, ".concat(N0, ")"),
43
+ dark: "var(--ds-iconBorder-success, ".concat(DN40, ")")
44
+ },
45
+ warning: {
46
+ light: "var(--ds-iconBorder-warning, ".concat(N700, ")"),
47
+ dark: "var(--ds-iconBorder-warning, ".concat(DN40, ")")
48
+ }
49
+ };
28
50
  var flagTextColor = {
29
51
  error: {
30
- light: colors.N0,
31
- dark: colors.DN40
52
+ light: "var(--ds-text-highEmphasis, ".concat(N0, ")"),
53
+ dark: "var(--ds-text-highEmphasis, ".concat(DN40, ")")
32
54
  },
33
55
  info: {
34
- light: colors.N0,
35
- dark: colors.DN600
56
+ light: "var(--ds-text-highEmphasis, ".concat(N0, ")"),
57
+ dark: "var(--ds-text-highEmphasis, ".concat(DN600, ")")
36
58
  },
37
59
  normal: {
38
- light: colors.N500,
39
- dark: colors.DN600
60
+ light: "var(--ds-text-highEmphasis, ".concat(N500, ")"),
61
+ dark: "var(--ds-text-highEmphasis, ".concat(DN600, ")")
40
62
  },
41
63
  success: {
42
- light: colors.N0,
43
- dark: colors.DN40
64
+ light: "var(--ds-text-highEmphasis, ".concat(N0, ")"),
65
+ dark: "var(--ds-text-highEmphasis, ".concat(DN40, ")")
44
66
  },
45
67
  warning: {
46
- light: colors.N700,
47
- dark: colors.DN40
68
+ light: "var(--ds-text-highEmphasis, ".concat(N700, ")"),
69
+ dark: "var(--ds-text-highEmphasis, ".concat(DN40, ")")
48
70
  }
49
71
  };
50
72
  export var getFlagTextColor = function getFlagTextColor(appearance, mode) {
51
73
  return flagTextColor[appearance][mode];
52
74
  };
53
- export var flagShadowColor = colors.N50A;
75
+ export var getFlagIconColor = function getFlagIconColor(appearance, mode) {
76
+ return flagIconColor[appearance][mode];
77
+ }; // token set in flag.tsx instead
78
+ // eslint-disable-next-line @atlaskit/design-system/ensure-design-token-usage
79
+
80
+ export var flagShadowColor = N50A;
54
81
  var flagFocusRingColor = {
55
82
  error: {
56
- light: colors.N40,
57
- dark: colors.N40
83
+ light: "var(--ds-border-focus, ".concat(N40, ")"),
84
+ dark: "var(--ds-border-focus, ".concat(N40, ")")
58
85
  },
59
86
  info: {
60
- light: colors.N40,
61
- dark: colors.N40
87
+ light: "var(--ds-border-focus, ".concat(N40, ")"),
88
+ dark: "var(--ds-border-focus, ".concat(N40, ")")
62
89
  },
63
90
  normal: {
64
- light: colors.B100,
65
- dark: colors.B100
91
+ light: "var(--ds-border-focus, ".concat(B100, ")"),
92
+ dark: "var(--ds-border-focus, ".concat(B100, ")")
66
93
  },
67
94
  success: {
68
- light: colors.N40,
69
- dark: colors.N40
95
+ light: "var(--ds-border-focus, ".concat(N40, ")"),
96
+ dark: "var(--ds-border-focus, ".concat(N40, ")")
70
97
  },
71
98
  warning: {
72
- light: colors.N200,
73
- dark: colors.N200
99
+ light: "var(--ds-border-focus, ".concat(N200, ")"),
100
+ dark: "var(--ds-border-focus, ".concat(N200, ")")
74
101
  }
75
102
  };
76
103
  export var getFlagFocusRingColor = function getFlagFocusRingColor(appearance, mode) {
@@ -79,46 +106,46 @@ export var getFlagFocusRingColor = function getFlagFocusRingColor(appearance, mo
79
106
  var lightButtonBackground = 'rgba(255, 255, 255, 0.08)';
80
107
  var actionBackground = {
81
108
  success: {
82
- light: lightButtonBackground,
83
- dark: colors.N30A
109
+ light: "var(--ds-background-subtleNeutral-resting, ".concat(lightButtonBackground, ")"),
110
+ dark: "var(--ds-background-subtleNeutral-resting, ".concat(N30A, ")")
84
111
  },
85
112
  info: {
86
- light: lightButtonBackground,
87
- dark: lightButtonBackground
113
+ light: "var(--ds-background-subtleNeutral-resting, ".concat(lightButtonBackground, ")"),
114
+ dark: "var(--ds-background-subtleNeutral-resting, ".concat(lightButtonBackground, ")")
88
115
  },
89
116
  error: {
90
- light: lightButtonBackground,
91
- dark: colors.N30A
117
+ light: "var(--ds-background-subtleNeutral-resting, ".concat(lightButtonBackground, ")"),
118
+ dark: "var(--ds-background-subtleNeutral-resting, ".concat(N30A, ")")
92
119
  },
93
120
  warning: {
94
- light: colors.N30A,
95
- dark: colors.N30A
121
+ light: "var(--ds-background-subtleNeutral-resting, ".concat(N30A, ")"),
122
+ dark: "var(--ds-background-subtleNeutral-resting, ".concat(N30A, ")")
96
123
  },
97
124
  normal: {
98
- light: 'none',
99
- dark: 'none'
125
+ light: "var(--ds-background-subtleNeutral-resting, none)",
126
+ dark: "var(--ds-background-subtleNeutral-resting, none)"
100
127
  }
101
128
  };
102
129
  var actionColor = {
103
130
  success: {
104
- light: colors.N0,
105
- dark: colors.DN40
131
+ light: "var(--ds-text-mediumEmphasis, ".concat(N0, ")"),
132
+ dark: "var(--ds-text-mediumEmphasis, ".concat(DN40, ")")
106
133
  },
107
134
  info: {
108
- light: colors.N0,
109
- dark: colors.DN600
135
+ light: "var(--ds-text-mediumEmphasis, ".concat(N0, ")"),
136
+ dark: "var(--ds-text-mediumEmphasis, ".concat(DN600, ")")
110
137
  },
111
138
  error: {
112
- light: colors.N0,
113
- dark: colors.DN600
139
+ light: "var(--ds-text-mediumEmphasis, ".concat(N0, ")"),
140
+ dark: "var(--ds-text-mediumEmphasis, ".concat(DN600, ")")
114
141
  },
115
142
  warning: {
116
- light: colors.N700,
117
- dark: colors.DN40
143
+ light: "var(--ds-text-mediumEmphasis, ".concat(N700, ")"),
144
+ dark: "var(--ds-text-mediumEmphasis, ".concat(DN40, ")")
118
145
  },
119
146
  normal: {
120
- light: colors.B400,
121
- dark: colors.B100
147
+ light: "var(--ds-text-mediumEmphasis, ".concat(B400, ")"),
148
+ dark: "var(--ds-text-mediumEmphasis, ".concat(B100, ")")
122
149
  }
123
150
  };
124
151
  export var getActionBackground = function getActionBackground(appearance, mode) {
@@ -1,5 +1,5 @@
1
1
  {
2
2
  "name": "@atlaskit/flag",
3
- "version": "14.3.3",
3
+ "version": "14.4.2",
4
4
  "sideEffects": false
5
5
  }
@@ -1,8 +1,9 @@
1
1
  import { ThemeModes } from '@atlaskit/theme/types';
2
2
  import { AppearanceTypes } from './types';
3
3
  export declare const getFlagBackgroundColor: (appearance: AppearanceTypes, mode: ThemeModes) => string;
4
- export declare const flagBorderColor = "rgba(9, 30, 66, 0.31)";
4
+ export declare const flagBorderColor: "var(--ds-background-overlay)";
5
5
  export declare const getFlagTextColor: (appearance: AppearanceTypes, mode: ThemeModes) => string;
6
+ export declare const getFlagIconColor: (appearance: AppearanceTypes, mode: ThemeModes) => string;
6
7
  export declare const flagShadowColor = "rgba(9, 30, 66, 0.25)";
7
8
  export declare const getFlagFocusRingColor: (appearance: AppearanceTypes, mode: ThemeModes) => string;
8
9
  export declare const getActionBackground: (appearance: AppearanceTypes, mode: ThemeModes) => string;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaskit/flag",
3
- "version": "14.3.3",
3
+ "version": "14.4.2",
4
4
  "description": "A flag is used for confirmations, alerts, and acknowledgments that require minimal user interaction, often displayed using a flag group.",
5
5
  "publishConfig": {
6
6
  "registry": "https://registry.npmjs.org/"
@@ -25,11 +25,12 @@
25
25
  },
26
26
  "dependencies": {
27
27
  "@atlaskit/analytics-next": "^8.0.0",
28
- "@atlaskit/button": "^15.1.0",
29
- "@atlaskit/icon": "^21.6.0",
28
+ "@atlaskit/button": "^16.0.0",
29
+ "@atlaskit/icon": "^21.9.0",
30
30
  "@atlaskit/motion": "^1.0.0",
31
31
  "@atlaskit/portal": "^4.0.0",
32
- "@atlaskit/theme": "^11.0.0",
32
+ "@atlaskit/theme": "^12.0.0",
33
+ "@atlaskit/tokens": "^0.4.0",
33
34
  "@babel/runtime": "^7.0.0",
34
35
  "@emotion/core": "^10.0.9"
35
36
  },
@@ -39,11 +40,11 @@
39
40
  "devDependencies": {
40
41
  "@atlaskit/build-utils": "*",
41
42
  "@atlaskit/docs": "*",
42
- "@atlaskit/field-radio-group": "^8.0.0",
43
43
  "@atlaskit/radio": "^5.2.0",
44
+ "@atlaskit/section-message": "^6.0.0",
44
45
  "@atlaskit/spinner": "^15.0.0",
45
46
  "@atlaskit/ssr": "*",
46
- "@atlaskit/theme": "^11.0.0",
47
+ "@atlaskit/theme": "^12.0.0",
47
48
  "@atlaskit/visual-regression": "*",
48
49
  "@atlaskit/webdriver-runner": "*",
49
50
  "@atlassian/atlassian-frontend-prettier-config-1.0.1": "npm:@atlassian/atlassian-frontend-prettier-config@1.0.1",
@@ -67,10 +68,12 @@
67
68
  "analytics-next"
68
69
  ],
69
70
  "theming": [
70
- "new-theming-api"
71
+ "tokens",
72
+ "react-context"
71
73
  ],
72
- "deprecation": [
73
- "no-deprecated-imports"
74
+ "deprecation": "no-deprecated-imports",
75
+ "styling": [
76
+ "emotion"
74
77
  ]
75
78
  }
76
79
  },
package/dist/cjs/utils.js DELETED
@@ -1,24 +0,0 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports.onMouseDownBlur = void 0;
7
-
8
- // Prevent a focus ring if clicked
9
- var onMouseDownBlur = function onMouseDownBlur(e) {
10
- var currentTarget = e.currentTarget;
11
- var focusedDuringMouseDown = currentTarget === document.activeElement;
12
- requestAnimationFrame(function () {
13
- if (focusedDuringMouseDown && currentTarget !== document.activeElement && document.body.contains(currentTarget)) {
14
- currentTarget.focus();
15
- return;
16
- }
17
-
18
- if (!focusedDuringMouseDown && document.activeElement && document.activeElement instanceof HTMLElement) {
19
- document.activeElement.blur();
20
- }
21
- });
22
- };
23
-
24
- exports.onMouseDownBlur = onMouseDownBlur;
@@ -1,15 +0,0 @@
1
- // Prevent a focus ring if clicked
2
- export const onMouseDownBlur = e => {
3
- const currentTarget = e.currentTarget;
4
- const focusedDuringMouseDown = currentTarget === document.activeElement;
5
- requestAnimationFrame(() => {
6
- if (focusedDuringMouseDown && currentTarget !== document.activeElement && document.body.contains(currentTarget)) {
7
- currentTarget.focus();
8
- return;
9
- }
10
-
11
- if (!focusedDuringMouseDown && document.activeElement && document.activeElement instanceof HTMLElement) {
12
- document.activeElement.blur();
13
- }
14
- });
15
- };
package/dist/esm/utils.js DELETED
@@ -1,15 +0,0 @@
1
- // Prevent a focus ring if clicked
2
- export var onMouseDownBlur = function onMouseDownBlur(e) {
3
- var currentTarget = e.currentTarget;
4
- var focusedDuringMouseDown = currentTarget === document.activeElement;
5
- requestAnimationFrame(function () {
6
- if (focusedDuringMouseDown && currentTarget !== document.activeElement && document.body.contains(currentTarget)) {
7
- currentTarget.focus();
8
- return;
9
- }
10
-
11
- if (!focusedDuringMouseDown && document.activeElement && document.activeElement instanceof HTMLElement) {
12
- document.activeElement.blur();
13
- }
14
- });
15
- };
@@ -1,2 +0,0 @@
1
- import { MouseEvent } from 'react';
2
- export declare const onMouseDownBlur: (e: MouseEvent<HTMLElement>) => void;
@@ -1,7 +0,0 @@
1
- {
2
- "name": "@atlaskit/flag/utils",
3
- "main": "../dist/cjs/utils.js",
4
- "module": "../dist/esm/utils.js",
5
- "module:es2019": "../dist/es2019/utils.js",
6
- "types": "../dist/types/utils.d.ts"
7
- }