@atlaskit/flag 14.4.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 (51) hide show
  1. package/CHANGELOG.md +47 -0
  2. package/__perf__/withFlagGroup.tsx +7 -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 +57 -19
  6. package/dist/cjs/flag-provider.js +6 -4
  7. package/dist/cjs/flag.js +85 -107
  8. package/dist/cjs/index.js +12 -12
  9. package/dist/cjs/internal/description.js +32 -0
  10. package/dist/cjs/internal/dismiss-button.js +83 -0
  11. package/dist/cjs/{expander.js → internal/expander.js} +15 -7
  12. package/dist/cjs/internal/index.js +39 -0
  13. package/dist/cjs/internal/title.js +32 -0
  14. package/dist/cjs/theme.js +84 -60
  15. package/dist/cjs/version.json +1 -1
  16. package/dist/es2019/auto-dismiss-flag.js +2 -3
  17. package/dist/es2019/flag-actions.js +50 -32
  18. package/dist/es2019/flag-group.js +48 -65
  19. package/dist/es2019/flag.js +77 -162
  20. package/dist/es2019/internal/description.js +22 -0
  21. package/dist/es2019/internal/dismiss-button.js +63 -0
  22. package/dist/es2019/{expander.js → internal/expander.js} +14 -10
  23. package/dist/es2019/internal/index.js +4 -0
  24. package/dist/es2019/internal/title.js +22 -0
  25. package/dist/es2019/theme.js +78 -53
  26. package/dist/es2019/version.json +1 -1
  27. package/dist/esm/auto-dismiss-flag.js +2 -3
  28. package/dist/esm/flag-actions.js +49 -6
  29. package/dist/esm/flag-group.js +52 -16
  30. package/dist/esm/flag-provider.js +4 -3
  31. package/dist/esm/flag.js +81 -102
  32. package/dist/esm/internal/description.js +23 -0
  33. package/dist/esm/internal/dismiss-button.js +63 -0
  34. package/dist/esm/{expander.js → internal/expander.js} +14 -5
  35. package/dist/esm/internal/index.js +4 -0
  36. package/dist/esm/internal/title.js +23 -0
  37. package/dist/esm/theme.js +80 -53
  38. package/dist/esm/version.json +1 -1
  39. package/dist/types/auto-dismiss-flag.d.ts +1 -0
  40. package/dist/types/flag-actions.d.ts +4 -4
  41. package/dist/types/flag-group.d.ts +2 -2
  42. package/dist/types/flag.d.ts +2 -1
  43. package/dist/types/internal/description.d.ts +7 -0
  44. package/dist/types/internal/dismiss-button.d.ts +11 -0
  45. package/dist/types/internal/expander.d.ts +8 -0
  46. package/dist/types/internal/index.d.ts +4 -0
  47. package/dist/types/internal/title.d.ts +6 -0
  48. package/dist/types/theme.d.ts +2 -1
  49. package/package.json +14 -10
  50. package/dist/types/expander.d.ts +0 -9
  51. package/expander/package.json +0 -7
package/dist/cjs/index.js CHANGED
@@ -5,12 +5,6 @@ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefau
5
5
  Object.defineProperty(exports, "__esModule", {
6
6
  value: true
7
7
  });
8
- Object.defineProperty(exports, "default", {
9
- enumerable: true,
10
- get: function get() {
11
- return _flag.default;
12
- }
13
- });
14
8
  Object.defineProperty(exports, "AutoDismissFlag", {
15
9
  enumerable: true,
16
10
  get: function get() {
@@ -23,22 +17,28 @@ Object.defineProperty(exports, "FlagGroup", {
23
17
  return _flagGroup.default;
24
18
  }
25
19
  });
26
- Object.defineProperty(exports, "useFlags", {
20
+ Object.defineProperty(exports, "FlagsProvider", {
27
21
  enumerable: true,
28
22
  get: function get() {
29
- return _flagProvider.useFlags;
23
+ return _flagProvider.FlagsProvider;
30
24
  }
31
25
  });
32
- Object.defineProperty(exports, "withFlagsProvider", {
26
+ Object.defineProperty(exports, "default", {
33
27
  enumerable: true,
34
28
  get: function get() {
35
- return _flagProvider.withFlagsProvider;
29
+ return _flag.default;
36
30
  }
37
31
  });
38
- Object.defineProperty(exports, "FlagsProvider", {
32
+ Object.defineProperty(exports, "useFlags", {
39
33
  enumerable: true,
40
34
  get: function get() {
41
- return _flagProvider.FlagsProvider;
35
+ return _flagProvider.useFlags;
36
+ }
37
+ });
38
+ Object.defineProperty(exports, "withFlagsProvider", {
39
+ enumerable: true,
40
+ get: function get() {
41
+ return _flagProvider.withFlagsProvider;
42
42
  }
43
43
  });
44
44
 
@@ -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 descriptionStyles = (0, _core.css)({
12
+ /* height is defined as 5 lines maximum by design */
13
+ maxHeight: 100,
14
+ overflow: 'auto',
15
+ wordWrap: 'break-word'
16
+ });
17
+
18
+ var Description = function Description(_ref) {
19
+ var color = _ref.color,
20
+ testId = _ref.testId,
21
+ children = _ref.children;
22
+ return (0, _core.jsx)("div", {
23
+ style: {
24
+ color: color
25
+ },
26
+ css: descriptionStyles,
27
+ "data-testid": testId
28
+ }, children);
29
+ };
30
+
31
+ var _default = Description;
32
+ exports.default = _default;
@@ -0,0 +1,83 @@
1
+ "use strict";
2
+
3
+ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
+
5
+ Object.defineProperty(exports, "__esModule", {
6
+ value: true
7
+ });
8
+ exports.default = void 0;
9
+
10
+ var _react = require("react");
11
+
12
+ var _core = require("@emotion/core");
13
+
14
+ var _focusRing = _interopRequireDefault(require("@atlaskit/focus-ring"));
15
+
16
+ var _chevronDown = _interopRequireDefault(require("@atlaskit/icon/glyph/chevron-down"));
17
+
18
+ var _chevronUp = _interopRequireDefault(require("@atlaskit/icon/glyph/chevron-up"));
19
+
20
+ var _cross = _interopRequireDefault(require("@atlaskit/icon/glyph/cross"));
21
+
22
+ var _constants = require("@atlaskit/theme/constants");
23
+
24
+ var _components = require("@atlaskit/theme/components");
25
+
26
+ var _theme = require("../theme");
27
+
28
+ /** @jsx jsx */
29
+ var gridSize = (0, _constants.gridSize)();
30
+ var borderRadius = (0, _constants.borderRadius)();
31
+ var dismissButtonStyles = (0, _core.css)({
32
+ marginLeft: gridSize,
33
+ padding: 0,
34
+ flex: '0 0 auto',
35
+ appearance: 'none',
36
+ background: 'none',
37
+ border: 'none',
38
+ borderRadius: borderRadius,
39
+ cursor: 'pointer',
40
+ lineHeight: '1',
41
+ whiteSpace: 'nowrap'
42
+ });
43
+
44
+ var DismissButton = function DismissButton(_ref) {
45
+ var appearance = _ref.appearance,
46
+ onClick = _ref.onClick,
47
+ isBold = _ref.isBold,
48
+ isExpanded = _ref.isExpanded,
49
+ testId = _ref.testId;
50
+
51
+ var _useGlobalTheme = (0, _components.useGlobalTheme)(),
52
+ mode = _useGlobalTheme.mode;
53
+
54
+ var ButtonIcon = _cross.default;
55
+ var buttonLabel = 'Dismiss';
56
+ var size = 'small';
57
+ var buttonTestId = testId && "".concat(testId, "-dismiss");
58
+
59
+ if (isBold) {
60
+ ButtonIcon = isExpanded ? _chevronUp.default : _chevronDown.default;
61
+ buttonLabel = isExpanded ? 'Collapse' : 'Expand';
62
+ size = 'large';
63
+ buttonTestId = testId && "".concat(testId, "-toggle");
64
+ }
65
+
66
+ return (0, _core.jsx)(_focusRing.default, null, (0, _core.jsx)("button", {
67
+ style: {
68
+ color: (0, _theme.getFlagTextColor)(appearance, mode)
69
+ },
70
+ css: dismissButtonStyles,
71
+ onClick: onClick,
72
+ "data-testid": buttonTestId,
73
+ type: "button",
74
+ "aria-expanded": isBold ? isExpanded : undefined
75
+ }, (0, _core.jsx)(ButtonIcon, {
76
+ label: buttonLabel,
77
+ size: size
78
+ })));
79
+ };
80
+
81
+ var _default = /*#__PURE__*/(0, _react.memo)(DismissButton);
82
+
83
+ exports.default = _default;
@@ -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
@@ -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.getFlagTextColor = exports.getFlagIconColor = exports.getFlagFocusRingColor = exports.getFlagBackgroundColor = exports.getActionColor = exports.getActionBackground = exports.flagShadowColor = exports.flagBorderColor = 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-surface-overlay, ".concat(_colors.R400, ")"),
13
+ dark: "var(--ds-surface-overlay, ".concat(_colors.R300, ")")
20
14
  },
21
15
  info: {
22
- light: colors.N500,
23
- dark: colors.N500
16
+ light: "var(--ds-surface-overlay, ".concat(_colors.N500, ")"),
17
+ dark: "var(--ds-surface-overlay, ".concat(_colors.N500, ")")
24
18
  },
25
19
  normal: {
26
- light: colors.N0,
27
- dark: colors.DN50
20
+ light: "var(--ds-surface-overlay, ".concat(_colors.N0, ")"),
21
+ dark: "var(--ds-surface-overlay, ".concat(_colors.DN50, ")")
28
22
  },
29
23
  success: {
30
- light: colors.G400,
31
- dark: colors.G300
24
+ light: "var(--ds-surface-overlay, ".concat(_colors.G400, ")"),
25
+ dark: "var(--ds-surface-overlay, ".concat(_colors.G300, ")")
32
26
  },
33
27
  warning: {
34
- light: colors.Y200,
35
- dark: colors.Y300
28
+ light: "var(--ds-surface-overlay, ".concat(_colors.Y200, ")"),
29
+ dark: "var(--ds-surface-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-surface-overlay, ".concat(_colors.N60A, ")");
45
39
  exports.flagBorderColor = flagBorderColor;
40
+ var flagIconColor = {
41
+ error: {
42
+ light: "var(--ds-icon-danger, ".concat(_colors.N0, ")"),
43
+ dark: "var(--ds-icon-danger, ".concat(_colors.DN40, ")")
44
+ },
45
+ info: {
46
+ light: "var(--ds-icon-discovery, ".concat(_colors.N0, ")"),
47
+ dark: "var(--ds-icon-discovery, ".concat(_colors.DN600, ")")
48
+ },
49
+ normal: {
50
+ light: "var(--ds-icon-brand, ".concat(_colors.N500, ")"),
51
+ dark: "var(--ds-icon-brand, ".concat(_colors.DN600, ")")
52
+ },
53
+ success: {
54
+ light: "var(--ds-icon-success, ".concat(_colors.N0, ")"),
55
+ dark: "var(--ds-icon-success, ".concat(_colors.DN40, ")")
56
+ },
57
+ warning: {
58
+ light: "var(--ds-icon-warning, ".concat(_colors.N700, ")"),
59
+ dark: "var(--ds-icon-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, ".concat(_colors.N0, ")"),
65
+ dark: "var(--ds-text, ".concat(_colors.DN40, ")")
50
66
  },
51
67
  info: {
52
- light: colors.N0,
53
- dark: colors.DN600
68
+ light: "var(--ds-text, ".concat(_colors.N0, ")"),
69
+ dark: "var(--ds-text, ".concat(_colors.DN600, ")")
54
70
  },
55
71
  normal: {
56
- light: colors.N500,
57
- dark: colors.DN600
72
+ light: "var(--ds-text, ".concat(_colors.N500, ")"),
73
+ dark: "var(--ds-text, ".concat(_colors.DN600, ")")
58
74
  },
59
75
  success: {
60
- light: colors.N0,
61
- dark: colors.DN40
76
+ light: "var(--ds-text, ".concat(_colors.N0, ")"),
77
+ dark: "var(--ds-text, ".concat(_colors.DN40, ")")
62
78
  },
63
79
  warning: {
64
- light: colors.N700,
65
- dark: colors.DN40
80
+ light: "var(--ds-text, ".concat(_colors.N700, ")"),
81
+ dark: "var(--ds-text, ".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-focused, ".concat(_colors.N40, ")"),
103
+ dark: "var(--ds-border-focused, ".concat(_colors.N40, ")")
80
104
  },
81
105
  info: {
82
- light: colors.N40,
83
- dark: colors.N40
106
+ light: "var(--ds-border-focused, ".concat(_colors.N40, ")"),
107
+ dark: "var(--ds-border-focused, ".concat(_colors.N40, ")")
84
108
  },
85
109
  normal: {
86
- light: colors.B100,
87
- dark: colors.B100
110
+ light: "var(--ds-border-focused, ".concat(_colors.B100, ")"),
111
+ dark: "var(--ds-border-focused, ".concat(_colors.B100, ")")
88
112
  },
89
113
  success: {
90
- light: colors.N40,
91
- dark: colors.N40
114
+ light: "var(--ds-border-focused, ".concat(_colors.N40, ")"),
115
+ dark: "var(--ds-border-focused, ".concat(_colors.N40, ")")
92
116
  },
93
117
  warning: {
94
- light: colors.N200,
95
- dark: colors.N200
118
+ light: "var(--ds-border-focused, ".concat(_colors.N200, ")"),
119
+ dark: "var(--ds-border-focused, ".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-neutral, ".concat(lightButtonBackground, ")"),
132
+ dark: "var(--ds-background-neutral, ".concat(_colors.N30A, ")")
109
133
  },
110
134
  info: {
111
- light: lightButtonBackground,
112
- dark: lightButtonBackground
135
+ light: "var(--ds-background-neutral, ".concat(lightButtonBackground, ")"),
136
+ dark: "var(--ds-background-neutral, ".concat(lightButtonBackground, ")")
113
137
  },
114
138
  error: {
115
- light: lightButtonBackground,
116
- dark: colors.N30A
139
+ light: "var(--ds-background-neutral, ".concat(lightButtonBackground, ")"),
140
+ dark: "var(--ds-background-neutral, ".concat(_colors.N30A, ")")
117
141
  },
118
142
  warning: {
119
- light: colors.N30A,
120
- dark: colors.N30A
143
+ light: "var(--ds-background-neutral, ".concat(_colors.N30A, ")"),
144
+ dark: "var(--ds-background-neutral, ".concat(_colors.N30A, ")")
121
145
  },
122
146
  normal: {
123
- light: 'none',
124
- dark: 'none'
147
+ light: "var(--ds-background-neutral, none)",
148
+ dark: "var(--ds-background-neutral, 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-subtle, ".concat(_colors.N0, ")"),
154
+ dark: "var(--ds-text-subtle, ".concat(_colors.DN40, ")")
131
155
  },
132
156
  info: {
133
- light: colors.N0,
134
- dark: colors.DN600
157
+ light: "var(--ds-text-subtle, ".concat(_colors.N0, ")"),
158
+ dark: "var(--ds-text-subtle, ".concat(_colors.DN600, ")")
135
159
  },
136
160
  error: {
137
- light: colors.N0,
138
- dark: colors.DN600
161
+ light: "var(--ds-text-subtle, ".concat(_colors.N0, ")"),
162
+ dark: "var(--ds-text-subtle, ".concat(_colors.DN600, ")")
139
163
  },
140
164
  warning: {
141
- light: colors.N700,
142
- dark: colors.DN40
165
+ light: "var(--ds-text-subtle, ".concat(_colors.N700, ")"),
166
+ dark: "var(--ds-text-subtle, ".concat(_colors.DN40, ")")
143
167
  },
144
168
  normal: {
145
- light: colors.B400,
146
- dark: colors.B100
169
+ light: "var(--ds-text-subtle, ".concat(_colors.B400, ")"),
170
+ dark: "var(--ds-text-subtle, ".concat(_colors.B100, ")")
147
171
  }
148
172
  };
149
173
 
@@ -1,5 +1,5 @@
1
1
  {
2
2
  "name": "@atlaskit/flag",
3
- "version": "14.4.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.4.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