@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 +36 -0
- package/__perf__/withFlagGroup.tsx +7 -1
- package/dist/cjs/auto-dismiss-flag.js +1 -1
- package/dist/cjs/flag.js +32 -35
- package/dist/cjs/theme.js +84 -60
- package/dist/cjs/version.json +1 -1
- package/dist/es2019/auto-dismiss-flag.js +1 -1
- package/dist/es2019/flag.js +74 -56
- package/dist/es2019/theme.js +78 -53
- package/dist/es2019/version.json +1 -1
- package/dist/esm/auto-dismiss-flag.js +1 -1
- package/dist/esm/flag.js +33 -35
- package/dist/esm/theme.js +80 -53
- package/dist/esm/version.json +1 -1
- package/dist/types/theme.d.ts +2 -1
- package/package.json +12 -9
- package/dist/cjs/utils.js +0 -24
- package/dist/es2019/utils.js +0 -15
- package/dist/esm/utils.js +0 -15
- package/dist/types/utils.d.ts +0 -2
- package/utils/package.json +0 -7
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={
|
|
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.
|
|
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
|
|
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.
|
|
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
|
-
|
|
191
|
-
|
|
192
|
-
(0, _core.
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
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
|
-
|
|
8
|
+
var _colors = require("@atlaskit/theme/colors");
|
|
15
9
|
|
|
16
10
|
var flagBackgroundColor = {
|
|
17
11
|
error: {
|
|
18
|
-
light:
|
|
19
|
-
dark:
|
|
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:
|
|
23
|
-
dark:
|
|
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:
|
|
27
|
-
dark:
|
|
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:
|
|
31
|
-
dark:
|
|
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:
|
|
35
|
-
dark:
|
|
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 =
|
|
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:
|
|
49
|
-
dark:
|
|
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:
|
|
53
|
-
dark:
|
|
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:
|
|
57
|
-
dark:
|
|
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:
|
|
61
|
-
dark:
|
|
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:
|
|
65
|
-
dark:
|
|
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
|
-
|
|
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:
|
|
79
|
-
dark:
|
|
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:
|
|
83
|
-
dark:
|
|
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:
|
|
87
|
-
dark:
|
|
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:
|
|
91
|
-
dark:
|
|
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:
|
|
95
|
-
dark:
|
|
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:
|
|
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:
|
|
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:
|
|
120
|
-
dark:
|
|
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:
|
|
124
|
-
dark:
|
|
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:
|
|
130
|
-
dark:
|
|
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:
|
|
134
|
-
dark:
|
|
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:
|
|
138
|
-
dark:
|
|
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:
|
|
142
|
-
dark:
|
|
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:
|
|
146
|
-
dark:
|
|
169
|
+
light: "var(--ds-text-mediumEmphasis, ".concat(_colors.B400, ")"),
|
|
170
|
+
dark: "var(--ds-text-mediumEmphasis, ".concat(_colors.B100, ")")
|
|
147
171
|
}
|
|
148
172
|
};
|
|
149
173
|
|
package/dist/cjs/version.json
CHANGED
|
@@ -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.
|
|
7
|
+
const packageVersion = "14.4.2";
|
|
8
8
|
export const AUTO_DISMISS_SECONDS = 8;
|
|
9
9
|
|
|
10
10
|
function noop() {}
|
package/dist/es2019/flag.js
CHANGED
|
@@ -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.
|
|
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
|
-
|
|
166
|
-
|
|
167
|
-
|
|
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
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
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
|
-
|
|
206
|
-
|
|
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
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
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
|
|
package/dist/es2019/theme.js
CHANGED
|
@@ -1,118 +1,143 @@
|
|
|
1
|
-
import
|
|
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:
|
|
5
|
-
dark:
|
|
4
|
+
light: `var(--ds-background-overlay, ${R400})`,
|
|
5
|
+
dark: `var(--ds-background-overlay, ${R300})`
|
|
6
6
|
},
|
|
7
7
|
info: {
|
|
8
|
-
light:
|
|
9
|
-
dark:
|
|
8
|
+
light: `var(--ds-background-overlay, ${N500})`,
|
|
9
|
+
dark: `var(--ds-background-overlay, ${N500})`
|
|
10
10
|
},
|
|
11
11
|
normal: {
|
|
12
|
-
light:
|
|
13
|
-
dark:
|
|
12
|
+
light: `var(--ds-background-overlay, ${N0})`,
|
|
13
|
+
dark: `var(--ds-background-overlay, ${DN50})`
|
|
14
14
|
},
|
|
15
15
|
success: {
|
|
16
|
-
light:
|
|
17
|
-
dark:
|
|
16
|
+
light: `var(--ds-background-overlay, ${G400})`,
|
|
17
|
+
dark: `var(--ds-background-overlay, ${G300})`
|
|
18
18
|
},
|
|
19
19
|
warning: {
|
|
20
|
-
light:
|
|
21
|
-
dark:
|
|
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 =
|
|
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:
|
|
29
|
-
dark:
|
|
50
|
+
light: `var(--ds-text-highEmphasis, ${N0})`,
|
|
51
|
+
dark: `var(--ds-text-highEmphasis, ${DN40})`
|
|
30
52
|
},
|
|
31
53
|
info: {
|
|
32
|
-
light:
|
|
33
|
-
dark:
|
|
54
|
+
light: `var(--ds-text-highEmphasis, ${N0})`,
|
|
55
|
+
dark: `var(--ds-text-highEmphasis, ${DN600})`
|
|
34
56
|
},
|
|
35
57
|
normal: {
|
|
36
|
-
light:
|
|
37
|
-
dark:
|
|
58
|
+
light: `var(--ds-text-highEmphasis, ${N500})`,
|
|
59
|
+
dark: `var(--ds-text-highEmphasis, ${DN600})`
|
|
38
60
|
},
|
|
39
61
|
success: {
|
|
40
|
-
light:
|
|
41
|
-
dark:
|
|
62
|
+
light: `var(--ds-text-highEmphasis, ${N0})`,
|
|
63
|
+
dark: `var(--ds-text-highEmphasis, ${DN40})`
|
|
42
64
|
},
|
|
43
65
|
warning: {
|
|
44
|
-
light:
|
|
45
|
-
dark:
|
|
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
|
|
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:
|
|
53
|
-
dark:
|
|
77
|
+
light: `var(--ds-border-focus, ${N40})`,
|
|
78
|
+
dark: `var(--ds-border-focus, ${N40})`
|
|
54
79
|
},
|
|
55
80
|
info: {
|
|
56
|
-
light:
|
|
57
|
-
dark:
|
|
81
|
+
light: `var(--ds-border-focus, ${N40})`,
|
|
82
|
+
dark: `var(--ds-border-focus, ${N40})`
|
|
58
83
|
},
|
|
59
84
|
normal: {
|
|
60
|
-
light:
|
|
61
|
-
dark:
|
|
85
|
+
light: `var(--ds-border-focus, ${B100})`,
|
|
86
|
+
dark: `var(--ds-border-focus, ${B100})`
|
|
62
87
|
},
|
|
63
88
|
success: {
|
|
64
|
-
light:
|
|
65
|
-
dark:
|
|
89
|
+
light: `var(--ds-border-focus, ${N40})`,
|
|
90
|
+
dark: `var(--ds-border-focus, ${N40})`
|
|
66
91
|
},
|
|
67
92
|
warning: {
|
|
68
|
-
light:
|
|
69
|
-
dark:
|
|
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:
|
|
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:
|
|
109
|
+
light: `var(--ds-background-subtleNeutral-resting, ${lightButtonBackground})`,
|
|
110
|
+
dark: `var(--ds-background-subtleNeutral-resting, ${N30A})`
|
|
86
111
|
},
|
|
87
112
|
warning: {
|
|
88
|
-
light:
|
|
89
|
-
dark:
|
|
113
|
+
light: `var(--ds-background-subtleNeutral-resting, ${N30A})`,
|
|
114
|
+
dark: `var(--ds-background-subtleNeutral-resting, ${N30A})`
|
|
90
115
|
},
|
|
91
116
|
normal: {
|
|
92
|
-
light:
|
|
93
|
-
dark:
|
|
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:
|
|
99
|
-
dark:
|
|
123
|
+
light: `var(--ds-text-mediumEmphasis, ${N0})`,
|
|
124
|
+
dark: `var(--ds-text-mediumEmphasis, ${DN40})`
|
|
100
125
|
},
|
|
101
126
|
info: {
|
|
102
|
-
light:
|
|
103
|
-
dark:
|
|
127
|
+
light: `var(--ds-text-mediumEmphasis, ${N0})`,
|
|
128
|
+
dark: `var(--ds-text-mediumEmphasis, ${DN600})`
|
|
104
129
|
},
|
|
105
130
|
error: {
|
|
106
|
-
light:
|
|
107
|
-
dark:
|
|
131
|
+
light: `var(--ds-text-mediumEmphasis, ${N0})`,
|
|
132
|
+
dark: `var(--ds-text-mediumEmphasis, ${DN600})`
|
|
108
133
|
},
|
|
109
134
|
warning: {
|
|
110
|
-
light:
|
|
111
|
-
dark:
|
|
135
|
+
light: `var(--ds-text-mediumEmphasis, ${N700})`,
|
|
136
|
+
dark: `var(--ds-text-mediumEmphasis, ${DN40})`
|
|
112
137
|
},
|
|
113
138
|
normal: {
|
|
114
|
-
light:
|
|
115
|
-
dark:
|
|
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];
|
package/dist/es2019/version.json
CHANGED
|
@@ -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.
|
|
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.
|
|
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
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
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
|
|
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:
|
|
5
|
-
dark:
|
|
4
|
+
light: "var(--ds-background-overlay, ".concat(R400, ")"),
|
|
5
|
+
dark: "var(--ds-background-overlay, ".concat(R300, ")")
|
|
6
6
|
},
|
|
7
7
|
info: {
|
|
8
|
-
light:
|
|
9
|
-
dark:
|
|
8
|
+
light: "var(--ds-background-overlay, ".concat(N500, ")"),
|
|
9
|
+
dark: "var(--ds-background-overlay, ".concat(N500, ")")
|
|
10
10
|
},
|
|
11
11
|
normal: {
|
|
12
|
-
light:
|
|
13
|
-
dark:
|
|
12
|
+
light: "var(--ds-background-overlay, ".concat(N0, ")"),
|
|
13
|
+
dark: "var(--ds-background-overlay, ".concat(DN50, ")")
|
|
14
14
|
},
|
|
15
15
|
success: {
|
|
16
|
-
light:
|
|
17
|
-
dark:
|
|
16
|
+
light: "var(--ds-background-overlay, ".concat(G400, ")"),
|
|
17
|
+
dark: "var(--ds-background-overlay, ".concat(G300, ")")
|
|
18
18
|
},
|
|
19
19
|
warning: {
|
|
20
|
-
light:
|
|
21
|
-
dark:
|
|
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 =
|
|
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:
|
|
31
|
-
dark:
|
|
52
|
+
light: "var(--ds-text-highEmphasis, ".concat(N0, ")"),
|
|
53
|
+
dark: "var(--ds-text-highEmphasis, ".concat(DN40, ")")
|
|
32
54
|
},
|
|
33
55
|
info: {
|
|
34
|
-
light:
|
|
35
|
-
dark:
|
|
56
|
+
light: "var(--ds-text-highEmphasis, ".concat(N0, ")"),
|
|
57
|
+
dark: "var(--ds-text-highEmphasis, ".concat(DN600, ")")
|
|
36
58
|
},
|
|
37
59
|
normal: {
|
|
38
|
-
light:
|
|
39
|
-
dark:
|
|
60
|
+
light: "var(--ds-text-highEmphasis, ".concat(N500, ")"),
|
|
61
|
+
dark: "var(--ds-text-highEmphasis, ".concat(DN600, ")")
|
|
40
62
|
},
|
|
41
63
|
success: {
|
|
42
|
-
light:
|
|
43
|
-
dark:
|
|
64
|
+
light: "var(--ds-text-highEmphasis, ".concat(N0, ")"),
|
|
65
|
+
dark: "var(--ds-text-highEmphasis, ".concat(DN40, ")")
|
|
44
66
|
},
|
|
45
67
|
warning: {
|
|
46
|
-
light:
|
|
47
|
-
dark:
|
|
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
|
|
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:
|
|
57
|
-
dark:
|
|
83
|
+
light: "var(--ds-border-focus, ".concat(N40, ")"),
|
|
84
|
+
dark: "var(--ds-border-focus, ".concat(N40, ")")
|
|
58
85
|
},
|
|
59
86
|
info: {
|
|
60
|
-
light:
|
|
61
|
-
dark:
|
|
87
|
+
light: "var(--ds-border-focus, ".concat(N40, ")"),
|
|
88
|
+
dark: "var(--ds-border-focus, ".concat(N40, ")")
|
|
62
89
|
},
|
|
63
90
|
normal: {
|
|
64
|
-
light:
|
|
65
|
-
dark:
|
|
91
|
+
light: "var(--ds-border-focus, ".concat(B100, ")"),
|
|
92
|
+
dark: "var(--ds-border-focus, ".concat(B100, ")")
|
|
66
93
|
},
|
|
67
94
|
success: {
|
|
68
|
-
light:
|
|
69
|
-
dark:
|
|
95
|
+
light: "var(--ds-border-focus, ".concat(N40, ")"),
|
|
96
|
+
dark: "var(--ds-border-focus, ".concat(N40, ")")
|
|
70
97
|
},
|
|
71
98
|
warning: {
|
|
72
|
-
light:
|
|
73
|
-
dark:
|
|
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:
|
|
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:
|
|
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:
|
|
95
|
-
dark:
|
|
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:
|
|
99
|
-
dark:
|
|
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:
|
|
105
|
-
dark:
|
|
131
|
+
light: "var(--ds-text-mediumEmphasis, ".concat(N0, ")"),
|
|
132
|
+
dark: "var(--ds-text-mediumEmphasis, ".concat(DN40, ")")
|
|
106
133
|
},
|
|
107
134
|
info: {
|
|
108
|
-
light:
|
|
109
|
-
dark:
|
|
135
|
+
light: "var(--ds-text-mediumEmphasis, ".concat(N0, ")"),
|
|
136
|
+
dark: "var(--ds-text-mediumEmphasis, ".concat(DN600, ")")
|
|
110
137
|
},
|
|
111
138
|
error: {
|
|
112
|
-
light:
|
|
113
|
-
dark:
|
|
139
|
+
light: "var(--ds-text-mediumEmphasis, ".concat(N0, ")"),
|
|
140
|
+
dark: "var(--ds-text-mediumEmphasis, ".concat(DN600, ")")
|
|
114
141
|
},
|
|
115
142
|
warning: {
|
|
116
|
-
light:
|
|
117
|
-
dark:
|
|
143
|
+
light: "var(--ds-text-mediumEmphasis, ".concat(N700, ")"),
|
|
144
|
+
dark: "var(--ds-text-mediumEmphasis, ".concat(DN40, ")")
|
|
118
145
|
},
|
|
119
146
|
normal: {
|
|
120
|
-
light:
|
|
121
|
-
dark:
|
|
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) {
|
package/dist/esm/version.json
CHANGED
package/dist/types/theme.d.ts
CHANGED
|
@@ -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
|
|
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
|
+
"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": "^
|
|
29
|
-
"@atlaskit/icon": "^21.
|
|
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": "^
|
|
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": "^
|
|
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
|
-
"
|
|
71
|
+
"tokens",
|
|
72
|
+
"react-context"
|
|
71
73
|
],
|
|
72
|
-
"deprecation":
|
|
73
|
-
|
|
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;
|
package/dist/es2019/utils.js
DELETED
|
@@ -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
|
-
};
|
package/dist/types/utils.d.ts
DELETED