@atlaskit/status 1.3.7 → 1.4.1
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 +12 -0
- package/dist/cjs/components/analytics.js +1 -1
- package/dist/cjs/components/internal/color-palette.js +18 -26
- package/dist/cjs/components/internal/color.js +1 -1
- package/dist/es2019/components/analytics.js +1 -1
- package/dist/es2019/components/internal/color-palette.js +10 -16
- package/dist/es2019/components/internal/color.js +1 -1
- package/dist/esm/components/analytics.js +1 -1
- package/dist/esm/components/internal/color-palette.js +19 -27
- package/dist/esm/components/internal/color.js +1 -1
- package/package.json +4 -2
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,17 @@
|
|
|
1
1
|
# @atlaskit/status
|
|
2
2
|
|
|
3
|
+
## 1.4.1
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- [`beb32df5147`](https://bitbucket.org/atlassian/atlassian-frontend/commits/beb32df5147) - [ECA11Y-45] [ECA11Y-22] Change the tab key handling the status popup to improve accessibility.
|
|
8
|
+
|
|
9
|
+
## 1.4.0
|
|
10
|
+
|
|
11
|
+
### Minor Changes
|
|
12
|
+
|
|
13
|
+
- [`11861bb36d4`](https://bitbucket.org/atlassian/atlassian-frontend/commits/11861bb36d4) - [ux] [ECA11Y-44] [ECA11Y-22] [ECA11Y-19] Change the focus order in the status popup to improve accessibility.
|
|
14
|
+
|
|
3
15
|
## 1.3.7
|
|
4
16
|
|
|
5
17
|
### Patch Changes
|
|
@@ -11,7 +11,7 @@ function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t =
|
|
|
11
11
|
var ELEMENTS_CHANNEL = 'fabric-elements';
|
|
12
12
|
exports.ELEMENTS_CHANNEL = ELEMENTS_CHANNEL;
|
|
13
13
|
var packageName = "@atlaskit/status";
|
|
14
|
-
var packageVersion = "1.
|
|
14
|
+
var packageVersion = "1.4.1";
|
|
15
15
|
var createStatusAnalyticsAndFire = function createStatusAnalyticsAndFire(createAnalyticsEvent) {
|
|
16
16
|
return function (payload) {
|
|
17
17
|
var statusPayload = _objectSpread(_objectSpread({}, payload), {}, {
|
|
@@ -17,7 +17,7 @@ var _templateObject;
|
|
|
17
17
|
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); }
|
|
18
18
|
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; }
|
|
19
19
|
var palette = [['neutral', "var(--ds-background-neutral, ".concat(colors.N40, ")"), "var(--ds-border-bold, ".concat(colors.N400, ")"), "var(--ds-icon, ".concat(colors.N400, ")")], ['purple', "var(--ds-background-discovery, ".concat(colors.P50, ")"), "var(--ds-border-discovery, ".concat(colors.P400, ")"), "var(--ds-icon-discovery, ".concat(colors.P400, ")")], ['blue', "var(--ds-background-information, ".concat(colors.B50, ")"), "var(--ds-border-information, ".concat(colors.B400, ")"), "var(--ds-icon-information, ".concat(colors.B400, ")")], ['red', "var(--ds-background-danger, ".concat(colors.R50, ")"), "var(--ds-border-danger, ".concat(colors.R400, ")"), "var(--ds-icon-danger, ".concat(colors.R400, ")")], ['yellow', "var(--ds-background-warning, ".concat(colors.Y50, ")"), "var(--ds-border-warning, ".concat(colors.Y400, ")"), "var(--ds-icon-warning, ".concat(colors.Y400, ")")], ['green', "var(--ds-background-success, ".concat(colors.G50, ")"), "var(--ds-border-success, ".concat(colors.G400, ")"), "var(--ds-icon-success, ".concat(colors.G400, ")")]];
|
|
20
|
-
var colorPaletteWrapperStyles = (0, _react2.css)(_templateObject || (_templateObject = (0, _taggedTemplateLiteral2.default)(["\n margin: ", " ", " 0\n ", ";\n /* Firefox bug fix: https://product-fabric.atlassian.net/browse/ED-1789 */\n display: flex;\n flex-wrap: wrap;\n"])), "var(--ds-space-100, 8px)", "var(--ds-space-100, 8px)", "var(--ds-space-100, 8px)");
|
|
20
|
+
var colorPaletteWrapperStyles = (0, _react2.css)(_templateObject || (_templateObject = (0, _taggedTemplateLiteral2.default)(["\n padding-left: 0px;\n margin: ", " ", " 0\n ", ";\n /* Firefox bug fix: https://product-fabric.atlassian.net/browse/ED-1789 */\n display: flex;\n flex-wrap: wrap;\n"])), "var(--ds-space-100, 8px)", "var(--ds-space-100, 8px)", "var(--ds-space-100, 8px)");
|
|
21
21
|
var VK_LEFT = 37; //ArrowLeft
|
|
22
22
|
var VK_RIGHT = 39; //ArrowRight
|
|
23
23
|
var VK_UP = 38; //ArrowUp
|
|
@@ -31,21 +31,20 @@ var _default = function _default(_ref) {
|
|
|
31
31
|
className = _ref.className,
|
|
32
32
|
onHover = _ref.onHover;
|
|
33
33
|
var colorRefs = (0, _react.useRef)([]);
|
|
34
|
+
var _useState = (0, _react.useState)(0),
|
|
35
|
+
_useState2 = (0, _slicedToArray2.default)(_useState, 2),
|
|
36
|
+
currentFocusedColor = _useState2[0],
|
|
37
|
+
setCurrentFocusedColor = _useState2[1];
|
|
34
38
|
(0, _react.useEffect)(function () {
|
|
35
39
|
colorRefs.current = colorRefs.current.slice(0, palette.length);
|
|
36
40
|
}, []);
|
|
37
41
|
var memoizedHandleKeyDown = (0, _react.useCallback)(function (e) {
|
|
38
|
-
var colorIndex = palette.findIndex(function (_ref2) {
|
|
39
|
-
var _ref3 = (0, _slicedToArray2.default)(_ref2, 1),
|
|
40
|
-
colorValue = _ref3[0];
|
|
41
|
-
return colorValue === selectedColor;
|
|
42
|
-
});
|
|
43
42
|
var newColorIndex = null;
|
|
44
43
|
var nextColor = function nextColor() {
|
|
45
|
-
return
|
|
44
|
+
return currentFocusedColor + 1 > palette.length - 1 ? 0 : currentFocusedColor + 1;
|
|
46
45
|
};
|
|
47
46
|
var previousColor = function previousColor() {
|
|
48
|
-
return
|
|
47
|
+
return currentFocusedColor - 1 < 0 ? palette.length - 1 : currentFocusedColor - 1;
|
|
49
48
|
};
|
|
50
49
|
switch (e.keyCode) {
|
|
51
50
|
case VK_RIGHT:
|
|
@@ -59,22 +58,16 @@ var _default = function _default(_ref) {
|
|
|
59
58
|
newColorIndex = previousColor();
|
|
60
59
|
break;
|
|
61
60
|
case VK_TAB:
|
|
62
|
-
|
|
63
|
-
if (e.shiftKey) {
|
|
64
|
-
newColorIndex = previousColor();
|
|
65
|
-
} else {
|
|
66
|
-
newColorIndex = nextColor();
|
|
67
|
-
}
|
|
61
|
+
setCurrentFocusedColor(0);
|
|
68
62
|
break;
|
|
69
63
|
}
|
|
70
64
|
if (newColorIndex === null) {
|
|
71
65
|
return;
|
|
72
66
|
}
|
|
73
|
-
|
|
67
|
+
setCurrentFocusedColor(newColorIndex);
|
|
74
68
|
var newRef = colorRefs.current[newColorIndex];
|
|
75
69
|
newRef === null || newRef === void 0 ? void 0 : newRef.focus();
|
|
76
|
-
|
|
77
|
-
}, [selectedColor, onClick, colorRefs]);
|
|
70
|
+
}, [currentFocusedColor, setCurrentFocusedColor, colorRefs]);
|
|
78
71
|
return (
|
|
79
72
|
/**
|
|
80
73
|
We need to disable below eslint rule becuase of role "radiogroup". This role was added
|
|
@@ -83,20 +76,19 @@ var _default = function _default(_ref) {
|
|
|
83
76
|
Task added in https://product-fabric.atlassian.net/wiki/spaces/E/pages/3182068181/Potential+improvements#Moderate-changes.
|
|
84
77
|
*/
|
|
85
78
|
// eslint-disable-next-line jsx-a11y/interactive-supports-focus
|
|
86
|
-
(0, _react2.jsx)("
|
|
79
|
+
(0, _react2.jsx)("ul", {
|
|
87
80
|
css: colorPaletteWrapperStyles,
|
|
88
81
|
className: className,
|
|
89
|
-
role: "radiogroup",
|
|
90
82
|
style: {
|
|
91
83
|
maxWidth: cols * 32
|
|
92
84
|
},
|
|
93
85
|
onKeyDown: memoizedHandleKeyDown
|
|
94
|
-
}, palette.map(function (
|
|
95
|
-
var
|
|
96
|
-
colorValue =
|
|
97
|
-
backgroundColor =
|
|
98
|
-
borderColor =
|
|
99
|
-
iconColor =
|
|
86
|
+
}, palette.map(function (_ref2, i) {
|
|
87
|
+
var _ref3 = (0, _slicedToArray2.default)(_ref2, 4),
|
|
88
|
+
colorValue = _ref3[0],
|
|
89
|
+
backgroundColor = _ref3[1],
|
|
90
|
+
borderColor = _ref3[2],
|
|
91
|
+
iconColor = _ref3[3];
|
|
100
92
|
return (0, _react2.jsx)(_color.default, {
|
|
101
93
|
key: colorValue,
|
|
102
94
|
value: colorValue,
|
|
@@ -106,7 +98,7 @@ var _default = function _default(_ref) {
|
|
|
106
98
|
onClick: onClick,
|
|
107
99
|
onHover: onHover,
|
|
108
100
|
isSelected: colorValue === selectedColor,
|
|
109
|
-
tabIndex:
|
|
101
|
+
tabIndex: i === 0 ? 0 : -1,
|
|
110
102
|
setRef: function setRef(el) {
|
|
111
103
|
return colorRefs.current[i] = el;
|
|
112
104
|
}
|
|
@@ -75,7 +75,7 @@ var Color = /*#__PURE__*/function (_PureComponent) {
|
|
|
75
75
|
iconColor = _this$props2.iconColor,
|
|
76
76
|
value = _this$props2.value,
|
|
77
77
|
setRef = _this$props2.setRef;
|
|
78
|
-
return (0, _react2.jsx)("
|
|
78
|
+
return (0, _react2.jsx)("li", {
|
|
79
79
|
css: buttonWrapperStyles
|
|
80
80
|
}, (0, _react2.jsx)(_reactIntlNext.FormattedMessage, _i18n.messages["".concat(value, "Color")], function (labels) {
|
|
81
81
|
return (0, _react2.jsx)("button", {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
export const ELEMENTS_CHANNEL = 'fabric-elements';
|
|
2
2
|
const packageName = "@atlaskit/status";
|
|
3
|
-
const packageVersion = "1.
|
|
3
|
+
const packageVersion = "1.4.1";
|
|
4
4
|
export const createStatusAnalyticsAndFire = createAnalyticsEvent => payload => {
|
|
5
5
|
const statusPayload = {
|
|
6
6
|
...payload,
|
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
/** @jsx jsx */
|
|
2
2
|
import * as colors from '@atlaskit/theme/colors';
|
|
3
|
-
import React, { useEffect, useRef, useCallback } from 'react';
|
|
3
|
+
import React, { useEffect, useRef, useCallback, useState } from 'react';
|
|
4
4
|
import { css, jsx } from '@emotion/react';
|
|
5
5
|
import Color from './color';
|
|
6
6
|
const palette = [['neutral', `var(--ds-background-neutral, ${colors.N40})`, `var(--ds-border-bold, ${colors.N400})`, `var(--ds-icon, ${colors.N400})`], ['purple', `var(--ds-background-discovery, ${colors.P50})`, `var(--ds-border-discovery, ${colors.P400})`, `var(--ds-icon-discovery, ${colors.P400})`], ['blue', `var(--ds-background-information, ${colors.B50})`, `var(--ds-border-information, ${colors.B400})`, `var(--ds-icon-information, ${colors.B400})`], ['red', `var(--ds-background-danger, ${colors.R50})`, `var(--ds-border-danger, ${colors.R400})`, `var(--ds-icon-danger, ${colors.R400})`], ['yellow', `var(--ds-background-warning, ${colors.Y50})`, `var(--ds-border-warning, ${colors.Y400})`, `var(--ds-icon-warning, ${colors.Y400})`], ['green', `var(--ds-background-success, ${colors.G50})`, `var(--ds-border-success, ${colors.G400})`, `var(--ds-icon-success, ${colors.G400})`]];
|
|
7
7
|
const colorPaletteWrapperStyles = css`
|
|
8
|
+
padding-left: 0px;
|
|
8
9
|
margin: ${"var(--ds-space-100, 8px)"} ${"var(--ds-space-100, 8px)"} 0
|
|
9
10
|
${"var(--ds-space-100, 8px)"};
|
|
10
11
|
/* Firefox bug fix: https://product-fabric.atlassian.net/browse/ED-1789 */
|
|
@@ -24,14 +25,14 @@ export default (({
|
|
|
24
25
|
onHover
|
|
25
26
|
}) => {
|
|
26
27
|
const colorRefs = useRef([]);
|
|
28
|
+
const [currentFocusedColor, setCurrentFocusedColor] = useState(0);
|
|
27
29
|
useEffect(() => {
|
|
28
30
|
colorRefs.current = colorRefs.current.slice(0, palette.length);
|
|
29
31
|
}, []);
|
|
30
32
|
const memoizedHandleKeyDown = useCallback(e => {
|
|
31
|
-
const colorIndex = palette.findIndex(([colorValue]) => colorValue === selectedColor);
|
|
32
33
|
let newColorIndex = null;
|
|
33
|
-
const nextColor = () =>
|
|
34
|
-
const previousColor = () =>
|
|
34
|
+
const nextColor = () => currentFocusedColor + 1 > palette.length - 1 ? 0 : currentFocusedColor + 1;
|
|
35
|
+
const previousColor = () => currentFocusedColor - 1 < 0 ? palette.length - 1 : currentFocusedColor - 1;
|
|
35
36
|
switch (e.keyCode) {
|
|
36
37
|
case VK_RIGHT:
|
|
37
38
|
case VK_DOWN:
|
|
@@ -44,22 +45,16 @@ export default (({
|
|
|
44
45
|
newColorIndex = previousColor();
|
|
45
46
|
break;
|
|
46
47
|
case VK_TAB:
|
|
47
|
-
|
|
48
|
-
if (e.shiftKey) {
|
|
49
|
-
newColorIndex = previousColor();
|
|
50
|
-
} else {
|
|
51
|
-
newColorIndex = nextColor();
|
|
52
|
-
}
|
|
48
|
+
setCurrentFocusedColor(0);
|
|
53
49
|
break;
|
|
54
50
|
}
|
|
55
51
|
if (newColorIndex === null) {
|
|
56
52
|
return;
|
|
57
53
|
}
|
|
58
|
-
|
|
54
|
+
setCurrentFocusedColor(newColorIndex);
|
|
59
55
|
const newRef = colorRefs.current[newColorIndex];
|
|
60
56
|
newRef === null || newRef === void 0 ? void 0 : newRef.focus();
|
|
61
|
-
|
|
62
|
-
}, [selectedColor, onClick, colorRefs]);
|
|
57
|
+
}, [currentFocusedColor, setCurrentFocusedColor, colorRefs]);
|
|
63
58
|
return (
|
|
64
59
|
/**
|
|
65
60
|
We need to disable below eslint rule becuase of role "radiogroup". This role was added
|
|
@@ -68,10 +63,9 @@ export default (({
|
|
|
68
63
|
Task added in https://product-fabric.atlassian.net/wiki/spaces/E/pages/3182068181/Potential+improvements#Moderate-changes.
|
|
69
64
|
*/
|
|
70
65
|
// eslint-disable-next-line jsx-a11y/interactive-supports-focus
|
|
71
|
-
jsx("
|
|
66
|
+
jsx("ul", {
|
|
72
67
|
css: colorPaletteWrapperStyles,
|
|
73
68
|
className: className,
|
|
74
|
-
role: "radiogroup",
|
|
75
69
|
style: {
|
|
76
70
|
maxWidth: cols * 32
|
|
77
71
|
},
|
|
@@ -86,7 +80,7 @@ export default (({
|
|
|
86
80
|
onClick: onClick,
|
|
87
81
|
onHover: onHover,
|
|
88
82
|
isSelected: colorValue === selectedColor,
|
|
89
|
-
tabIndex:
|
|
83
|
+
tabIndex: i === 0 ? 0 : -1,
|
|
90
84
|
setRef: el => colorRefs.current[i] = el
|
|
91
85
|
});
|
|
92
86
|
}))
|
|
@@ -70,7 +70,7 @@ export default class Color extends PureComponent {
|
|
|
70
70
|
value,
|
|
71
71
|
setRef
|
|
72
72
|
} = this.props;
|
|
73
|
-
return jsx("
|
|
73
|
+
return jsx("li", {
|
|
74
74
|
css: buttonWrapperStyles
|
|
75
75
|
}, jsx(FormattedMessage, messages[`${value}Color`], labels => jsx("button", {
|
|
76
76
|
css: buttonStyles,
|
|
@@ -3,7 +3,7 @@ function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbol
|
|
|
3
3
|
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
4
4
|
export var ELEMENTS_CHANNEL = 'fabric-elements';
|
|
5
5
|
var packageName = "@atlaskit/status";
|
|
6
|
-
var packageVersion = "1.
|
|
6
|
+
var packageVersion = "1.4.1";
|
|
7
7
|
export var createStatusAnalyticsAndFire = function createStatusAnalyticsAndFire(createAnalyticsEvent) {
|
|
8
8
|
return function (payload) {
|
|
9
9
|
var statusPayload = _objectSpread(_objectSpread({}, payload), {}, {
|
|
@@ -3,11 +3,11 @@ import _taggedTemplateLiteral from "@babel/runtime/helpers/taggedTemplateLiteral
|
|
|
3
3
|
var _templateObject;
|
|
4
4
|
/** @jsx jsx */
|
|
5
5
|
import * as colors from '@atlaskit/theme/colors';
|
|
6
|
-
import React, { useEffect, useRef, useCallback } from 'react';
|
|
6
|
+
import React, { useEffect, useRef, useCallback, useState } from 'react';
|
|
7
7
|
import { css, jsx } from '@emotion/react';
|
|
8
8
|
import Color from './color';
|
|
9
9
|
var palette = [['neutral', "var(--ds-background-neutral, ".concat(colors.N40, ")"), "var(--ds-border-bold, ".concat(colors.N400, ")"), "var(--ds-icon, ".concat(colors.N400, ")")], ['purple', "var(--ds-background-discovery, ".concat(colors.P50, ")"), "var(--ds-border-discovery, ".concat(colors.P400, ")"), "var(--ds-icon-discovery, ".concat(colors.P400, ")")], ['blue', "var(--ds-background-information, ".concat(colors.B50, ")"), "var(--ds-border-information, ".concat(colors.B400, ")"), "var(--ds-icon-information, ".concat(colors.B400, ")")], ['red', "var(--ds-background-danger, ".concat(colors.R50, ")"), "var(--ds-border-danger, ".concat(colors.R400, ")"), "var(--ds-icon-danger, ".concat(colors.R400, ")")], ['yellow', "var(--ds-background-warning, ".concat(colors.Y50, ")"), "var(--ds-border-warning, ".concat(colors.Y400, ")"), "var(--ds-icon-warning, ".concat(colors.Y400, ")")], ['green', "var(--ds-background-success, ".concat(colors.G50, ")"), "var(--ds-border-success, ".concat(colors.G400, ")"), "var(--ds-icon-success, ".concat(colors.G400, ")")]];
|
|
10
|
-
var colorPaletteWrapperStyles = css(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n margin: ", " ", " 0\n ", ";\n /* Firefox bug fix: https://product-fabric.atlassian.net/browse/ED-1789 */\n display: flex;\n flex-wrap: wrap;\n"])), "var(--ds-space-100, 8px)", "var(--ds-space-100, 8px)", "var(--ds-space-100, 8px)");
|
|
10
|
+
var colorPaletteWrapperStyles = css(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n padding-left: 0px;\n margin: ", " ", " 0\n ", ";\n /* Firefox bug fix: https://product-fabric.atlassian.net/browse/ED-1789 */\n display: flex;\n flex-wrap: wrap;\n"])), "var(--ds-space-100, 8px)", "var(--ds-space-100, 8px)", "var(--ds-space-100, 8px)");
|
|
11
11
|
var VK_LEFT = 37; //ArrowLeft
|
|
12
12
|
var VK_RIGHT = 39; //ArrowRight
|
|
13
13
|
var VK_UP = 38; //ArrowUp
|
|
@@ -21,21 +21,20 @@ export default (function (_ref) {
|
|
|
21
21
|
className = _ref.className,
|
|
22
22
|
onHover = _ref.onHover;
|
|
23
23
|
var colorRefs = useRef([]);
|
|
24
|
+
var _useState = useState(0),
|
|
25
|
+
_useState2 = _slicedToArray(_useState, 2),
|
|
26
|
+
currentFocusedColor = _useState2[0],
|
|
27
|
+
setCurrentFocusedColor = _useState2[1];
|
|
24
28
|
useEffect(function () {
|
|
25
29
|
colorRefs.current = colorRefs.current.slice(0, palette.length);
|
|
26
30
|
}, []);
|
|
27
31
|
var memoizedHandleKeyDown = useCallback(function (e) {
|
|
28
|
-
var colorIndex = palette.findIndex(function (_ref2) {
|
|
29
|
-
var _ref3 = _slicedToArray(_ref2, 1),
|
|
30
|
-
colorValue = _ref3[0];
|
|
31
|
-
return colorValue === selectedColor;
|
|
32
|
-
});
|
|
33
32
|
var newColorIndex = null;
|
|
34
33
|
var nextColor = function nextColor() {
|
|
35
|
-
return
|
|
34
|
+
return currentFocusedColor + 1 > palette.length - 1 ? 0 : currentFocusedColor + 1;
|
|
36
35
|
};
|
|
37
36
|
var previousColor = function previousColor() {
|
|
38
|
-
return
|
|
37
|
+
return currentFocusedColor - 1 < 0 ? palette.length - 1 : currentFocusedColor - 1;
|
|
39
38
|
};
|
|
40
39
|
switch (e.keyCode) {
|
|
41
40
|
case VK_RIGHT:
|
|
@@ -49,22 +48,16 @@ export default (function (_ref) {
|
|
|
49
48
|
newColorIndex = previousColor();
|
|
50
49
|
break;
|
|
51
50
|
case VK_TAB:
|
|
52
|
-
|
|
53
|
-
if (e.shiftKey) {
|
|
54
|
-
newColorIndex = previousColor();
|
|
55
|
-
} else {
|
|
56
|
-
newColorIndex = nextColor();
|
|
57
|
-
}
|
|
51
|
+
setCurrentFocusedColor(0);
|
|
58
52
|
break;
|
|
59
53
|
}
|
|
60
54
|
if (newColorIndex === null) {
|
|
61
55
|
return;
|
|
62
56
|
}
|
|
63
|
-
|
|
57
|
+
setCurrentFocusedColor(newColorIndex);
|
|
64
58
|
var newRef = colorRefs.current[newColorIndex];
|
|
65
59
|
newRef === null || newRef === void 0 ? void 0 : newRef.focus();
|
|
66
|
-
|
|
67
|
-
}, [selectedColor, onClick, colorRefs]);
|
|
60
|
+
}, [currentFocusedColor, setCurrentFocusedColor, colorRefs]);
|
|
68
61
|
return (
|
|
69
62
|
/**
|
|
70
63
|
We need to disable below eslint rule becuase of role "radiogroup". This role was added
|
|
@@ -73,20 +66,19 @@ export default (function (_ref) {
|
|
|
73
66
|
Task added in https://product-fabric.atlassian.net/wiki/spaces/E/pages/3182068181/Potential+improvements#Moderate-changes.
|
|
74
67
|
*/
|
|
75
68
|
// eslint-disable-next-line jsx-a11y/interactive-supports-focus
|
|
76
|
-
jsx("
|
|
69
|
+
jsx("ul", {
|
|
77
70
|
css: colorPaletteWrapperStyles,
|
|
78
71
|
className: className,
|
|
79
|
-
role: "radiogroup",
|
|
80
72
|
style: {
|
|
81
73
|
maxWidth: cols * 32
|
|
82
74
|
},
|
|
83
75
|
onKeyDown: memoizedHandleKeyDown
|
|
84
|
-
}, palette.map(function (
|
|
85
|
-
var
|
|
86
|
-
colorValue =
|
|
87
|
-
backgroundColor =
|
|
88
|
-
borderColor =
|
|
89
|
-
iconColor =
|
|
76
|
+
}, palette.map(function (_ref2, i) {
|
|
77
|
+
var _ref3 = _slicedToArray(_ref2, 4),
|
|
78
|
+
colorValue = _ref3[0],
|
|
79
|
+
backgroundColor = _ref3[1],
|
|
80
|
+
borderColor = _ref3[2],
|
|
81
|
+
iconColor = _ref3[3];
|
|
90
82
|
return jsx(Color, {
|
|
91
83
|
key: colorValue,
|
|
92
84
|
value: colorValue,
|
|
@@ -96,7 +88,7 @@ export default (function (_ref) {
|
|
|
96
88
|
onClick: onClick,
|
|
97
89
|
onHover: onHover,
|
|
98
90
|
isSelected: colorValue === selectedColor,
|
|
99
|
-
tabIndex:
|
|
91
|
+
tabIndex: i === 0 ? 0 : -1,
|
|
100
92
|
setRef: function setRef(el) {
|
|
101
93
|
return colorRefs.current[i] = el;
|
|
102
94
|
}
|
|
@@ -65,7 +65,7 @@ var Color = /*#__PURE__*/function (_PureComponent) {
|
|
|
65
65
|
iconColor = _this$props2.iconColor,
|
|
66
66
|
value = _this$props2.value,
|
|
67
67
|
setRef = _this$props2.setRef;
|
|
68
|
-
return jsx("
|
|
68
|
+
return jsx("li", {
|
|
69
69
|
css: buttonWrapperStyles
|
|
70
70
|
}, jsx(FormattedMessage, messages["".concat(value, "Color")], function (labels) {
|
|
71
71
|
return jsx("button", {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atlaskit/status",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.4.1",
|
|
4
4
|
"description": "Fabric Status React Components",
|
|
5
5
|
"publishConfig": {
|
|
6
6
|
"registry": "https://registry.npmjs.org/"
|
|
@@ -30,7 +30,7 @@
|
|
|
30
30
|
"@atlaskit/lozenge": "^11.4.0",
|
|
31
31
|
"@atlaskit/textfield": "^5.6.0",
|
|
32
32
|
"@atlaskit/theme": "^12.6.0",
|
|
33
|
-
"@atlaskit/tokens": "^1.
|
|
33
|
+
"@atlaskit/tokens": "^1.25.0",
|
|
34
34
|
"@babel/runtime": "^7.0.0",
|
|
35
35
|
"@emotion/react": "^11.7.1"
|
|
36
36
|
},
|
|
@@ -43,6 +43,8 @@
|
|
|
43
43
|
"@atlaskit/elements-test-helpers": "^0.7.0",
|
|
44
44
|
"@atlaskit/visual-regression": "*",
|
|
45
45
|
"@atlassian/atlassian-frontend-prettier-config-1.0.1": "npm:@atlassian/atlassian-frontend-prettier-config@1.0.1",
|
|
46
|
+
"@testing-library/jest-dom": "^5.16.5",
|
|
47
|
+
"@testing-library/react": "^12.1.5",
|
|
46
48
|
"enzyme": "^3.10.0",
|
|
47
49
|
"enzyme-adapter-react-16": "^1.15.1",
|
|
48
50
|
"react": "^16.8.0",
|