@atlaskit/status 1.4.0 → 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 +6 -0
- package/dist/cjs/components/analytics.js +1 -1
- package/dist/cjs/components/internal/color-palette.js +15 -22
- package/dist/es2019/components/analytics.js +1 -1
- package/dist/es2019/components/internal/color-palette.js +7 -13
- package/dist/esm/components/analytics.js +1 -1
- package/dist/esm/components/internal/color-palette.js +16 -23
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,11 @@
|
|
|
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
|
+
|
|
3
9
|
## 1.4.0
|
|
4
10
|
|
|
5
11
|
### Minor 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.4.
|
|
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), {}, {
|
|
@@ -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
|
|
@@ -90,12 +83,12 @@ var _default = function _default(_ref) {
|
|
|
90
83
|
maxWidth: cols * 32
|
|
91
84
|
},
|
|
92
85
|
onKeyDown: memoizedHandleKeyDown
|
|
93
|
-
}, palette.map(function (
|
|
94
|
-
var
|
|
95
|
-
colorValue =
|
|
96
|
-
backgroundColor =
|
|
97
|
-
borderColor =
|
|
98
|
-
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];
|
|
99
92
|
return (0, _react2.jsx)(_color.default, {
|
|
100
93
|
key: colorValue,
|
|
101
94
|
value: colorValue,
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
export const ELEMENTS_CHANNEL = 'fabric-elements';
|
|
2
2
|
const packageName = "@atlaskit/status";
|
|
3
|
-
const packageVersion = "1.4.
|
|
3
|
+
const packageVersion = "1.4.1";
|
|
4
4
|
export const createStatusAnalyticsAndFire = createAnalyticsEvent => payload => {
|
|
5
5
|
const statusPayload = {
|
|
6
6
|
...payload,
|
|
@@ -1,6 +1,6 @@
|
|
|
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})`]];
|
|
@@ -25,14 +25,14 @@ export default (({
|
|
|
25
25
|
onHover
|
|
26
26
|
}) => {
|
|
27
27
|
const colorRefs = useRef([]);
|
|
28
|
+
const [currentFocusedColor, setCurrentFocusedColor] = useState(0);
|
|
28
29
|
useEffect(() => {
|
|
29
30
|
colorRefs.current = colorRefs.current.slice(0, palette.length);
|
|
30
31
|
}, []);
|
|
31
32
|
const memoizedHandleKeyDown = useCallback(e => {
|
|
32
|
-
const colorIndex = palette.findIndex(([colorValue]) => colorValue === selectedColor);
|
|
33
33
|
let newColorIndex = null;
|
|
34
|
-
const nextColor = () =>
|
|
35
|
-
const previousColor = () =>
|
|
34
|
+
const nextColor = () => currentFocusedColor + 1 > palette.length - 1 ? 0 : currentFocusedColor + 1;
|
|
35
|
+
const previousColor = () => currentFocusedColor - 1 < 0 ? palette.length - 1 : currentFocusedColor - 1;
|
|
36
36
|
switch (e.keyCode) {
|
|
37
37
|
case VK_RIGHT:
|
|
38
38
|
case VK_DOWN:
|
|
@@ -45,22 +45,16 @@ export default (({
|
|
|
45
45
|
newColorIndex = previousColor();
|
|
46
46
|
break;
|
|
47
47
|
case VK_TAB:
|
|
48
|
-
|
|
49
|
-
if (e.shiftKey) {
|
|
50
|
-
newColorIndex = previousColor();
|
|
51
|
-
} else {
|
|
52
|
-
newColorIndex = nextColor();
|
|
53
|
-
}
|
|
48
|
+
setCurrentFocusedColor(0);
|
|
54
49
|
break;
|
|
55
50
|
}
|
|
56
51
|
if (newColorIndex === null) {
|
|
57
52
|
return;
|
|
58
53
|
}
|
|
59
|
-
|
|
54
|
+
setCurrentFocusedColor(newColorIndex);
|
|
60
55
|
const newRef = colorRefs.current[newColorIndex];
|
|
61
56
|
newRef === null || newRef === void 0 ? void 0 : newRef.focus();
|
|
62
|
-
|
|
63
|
-
}, [selectedColor, onClick, colorRefs]);
|
|
57
|
+
}, [currentFocusedColor, setCurrentFocusedColor, colorRefs]);
|
|
64
58
|
return (
|
|
65
59
|
/**
|
|
66
60
|
We need to disable below eslint rule becuase of role "radiogroup". This role was added
|
|
@@ -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.4.
|
|
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,7 +3,7 @@ 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, ")")]];
|
|
@@ -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
|
|
@@ -80,12 +73,12 @@ export default (function (_ref) {
|
|
|
80
73
|
maxWidth: cols * 32
|
|
81
74
|
},
|
|
82
75
|
onKeyDown: memoizedHandleKeyDown
|
|
83
|
-
}, palette.map(function (
|
|
84
|
-
var
|
|
85
|
-
colorValue =
|
|
86
|
-
backgroundColor =
|
|
87
|
-
borderColor =
|
|
88
|
-
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];
|
|
89
82
|
return jsx(Color, {
|
|
90
83
|
key: colorValue,
|
|
91
84
|
value: colorValue,
|