@atlaskit/status 1.2.8 → 1.2.10
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/Status.js +10 -39
- package/dist/cjs/components/StatusPicker.js +7 -37
- package/dist/cjs/components/analytics.js +1 -10
- package/dist/cjs/components/i18n.js +0 -2
- package/dist/cjs/components/internal/color-palette.js +10 -40
- package/dist/cjs/components/internal/color.js +11 -45
- package/dist/cjs/element.js +0 -1
- package/dist/cjs/i18n/cs.js +0 -1
- package/dist/cjs/i18n/da.js +0 -1
- package/dist/cjs/i18n/de.js +0 -1
- package/dist/cjs/i18n/en.js +0 -1
- package/dist/cjs/i18n/en_GB.js +0 -1
- package/dist/cjs/i18n/en_ZZ.js +0 -1
- package/dist/cjs/i18n/es.js +0 -1
- package/dist/cjs/i18n/et.js +0 -1
- package/dist/cjs/i18n/fi.js +0 -1
- package/dist/cjs/i18n/fr.js +0 -1
- package/dist/cjs/i18n/hu.js +0 -1
- package/dist/cjs/i18n/index.js +0 -30
- package/dist/cjs/i18n/it.js +0 -1
- package/dist/cjs/i18n/ja.js +0 -1
- package/dist/cjs/i18n/ko.js +0 -1
- package/dist/cjs/i18n/nb.js +0 -1
- package/dist/cjs/i18n/nl.js +0 -1
- package/dist/cjs/i18n/pl.js +0 -1
- package/dist/cjs/i18n/pt_BR.js +0 -1
- package/dist/cjs/i18n/pt_PT.js +0 -1
- package/dist/cjs/i18n/ru.js +0 -1
- package/dist/cjs/i18n/sk.js +0 -1
- package/dist/cjs/i18n/sv.js +0 -1
- package/dist/cjs/i18n/th.js +0 -1
- package/dist/cjs/i18n/tr.js +0 -1
- package/dist/cjs/i18n/uk.js +0 -1
- package/dist/cjs/i18n/vi.js +0 -1
- package/dist/cjs/i18n/zh.js +0 -1
- package/dist/cjs/i18n/zh_TW.js +0 -1
- package/dist/cjs/index.js +0 -2
- package/dist/cjs/picker.js +0 -1
- package/dist/cjs/version.json +1 -1
- package/dist/es2019/components/Status.js +5 -19
- package/dist/es2019/components/StatusPicker.js +3 -13
- package/dist/es2019/components/analytics.js +3 -4
- package/dist/es2019/components/internal/color-palette.js +0 -13
- package/dist/es2019/components/internal/color.js +2 -12
- package/dist/es2019/version.json +1 -1
- package/dist/esm/components/Status.js +10 -32
- package/dist/esm/components/StatusPicker.js +7 -26
- package/dist/esm/components/analytics.js +1 -6
- package/dist/esm/components/internal/color-palette.js +10 -27
- package/dist/esm/components/internal/color.js +11 -33
- package/dist/esm/version.json +1 -1
- package/package.json +6 -4
|
@@ -5,11 +5,8 @@ import _inherits from "@babel/runtime/helpers/inherits";
|
|
|
5
5
|
import _possibleConstructorReturn from "@babel/runtime/helpers/possibleConstructorReturn";
|
|
6
6
|
import _getPrototypeOf from "@babel/runtime/helpers/getPrototypeOf";
|
|
7
7
|
import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
8
|
-
|
|
9
8
|
function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }
|
|
10
|
-
|
|
11
9
|
function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
|
|
12
|
-
|
|
13
10
|
/** @jsx jsx */
|
|
14
11
|
import { PureComponent } from 'react';
|
|
15
12
|
import { css, jsx } from '@emotion/react';
|
|
@@ -17,7 +14,6 @@ import Lozenge from '@atlaskit/lozenge';
|
|
|
17
14
|
import { withAnalyticsEvents } from '@atlaskit/analytics-next';
|
|
18
15
|
import { createStatusAnalyticsAndFire } from './analytics';
|
|
19
16
|
import { ANALYTICS_HOVER_DELAY } from './constants';
|
|
20
|
-
|
|
21
17
|
/* eslint-disable @atlaskit/design-system/ensure-design-token-usage */
|
|
22
18
|
var colorToLozengeAppearanceMap = {
|
|
23
19
|
neutral: 'default',
|
|
@@ -31,59 +27,46 @@ var colorToLozengeAppearanceMap = {
|
|
|
31
27
|
|
|
32
28
|
var DEFAULT_APPEARANCE = 'default';
|
|
33
29
|
var MAX_WIDTH = 200;
|
|
30
|
+
|
|
34
31
|
/**
|
|
35
32
|
* This is to account for a bug in android chromium and should be removed
|
|
36
33
|
* when the editor fixes its focus handling with respect to Status.
|
|
37
34
|
*
|
|
38
35
|
* See DSP-7701 for additional context.
|
|
39
36
|
*/
|
|
40
|
-
|
|
41
37
|
var inlineBlockStyles = css({
|
|
42
38
|
'& > *': {
|
|
43
39
|
display: 'inline-block !important',
|
|
44
40
|
lineHeight: '16px'
|
|
45
41
|
}
|
|
46
|
-
});
|
|
42
|
+
});
|
|
47
43
|
|
|
44
|
+
// eg. Version/4.0 Chrome/95.0.4638.50
|
|
48
45
|
var isAndroidChromium = typeof window !== 'undefined' && /Version\/.* Chrome\/.*/.test(window.navigator.userAgent);
|
|
49
|
-
|
|
50
46
|
var StatusInternal = /*#__PURE__*/function (_PureComponent) {
|
|
51
47
|
_inherits(StatusInternal, _PureComponent);
|
|
52
|
-
|
|
53
48
|
var _super = _createSuper(StatusInternal);
|
|
54
|
-
|
|
55
49
|
function StatusInternal() {
|
|
56
50
|
var _this;
|
|
57
|
-
|
|
58
51
|
_classCallCheck(this, StatusInternal);
|
|
59
|
-
|
|
60
52
|
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
|
|
61
53
|
args[_key] = arguments[_key];
|
|
62
54
|
}
|
|
63
|
-
|
|
64
55
|
_this = _super.call.apply(_super, [this].concat(args));
|
|
65
|
-
|
|
66
56
|
_defineProperty(_assertThisInitialized(_this), "hoverStartTime", 0);
|
|
67
|
-
|
|
68
57
|
_defineProperty(_assertThisInitialized(_this), "handleMouseEnter", function (_e) {
|
|
69
58
|
_this.hoverStartTime = Date.now();
|
|
70
59
|
});
|
|
71
|
-
|
|
72
60
|
_defineProperty(_assertThisInitialized(_this), "handleMouseLeave", function (_e) {
|
|
73
61
|
var onHover = _this.props.onHover;
|
|
74
|
-
|
|
75
62
|
var delay = Date.now() - _this.hoverStartTime;
|
|
76
|
-
|
|
77
63
|
if (delay >= ANALYTICS_HOVER_DELAY && onHover) {
|
|
78
64
|
onHover();
|
|
79
65
|
}
|
|
80
|
-
|
|
81
66
|
_this.hoverStartTime = 0;
|
|
82
67
|
});
|
|
83
|
-
|
|
84
68
|
return _this;
|
|
85
69
|
}
|
|
86
|
-
|
|
87
70
|
_createClass(StatusInternal, [{
|
|
88
71
|
key: "componentWillUnmount",
|
|
89
72
|
value: function componentWillUnmount() {
|
|
@@ -93,18 +76,16 @@ var StatusInternal = /*#__PURE__*/function (_PureComponent) {
|
|
|
93
76
|
key: "render",
|
|
94
77
|
value: function render() {
|
|
95
78
|
var _this$props = this.props,
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
79
|
+
text = _this$props.text,
|
|
80
|
+
color = _this$props.color,
|
|
81
|
+
style = _this$props.style,
|
|
82
|
+
role = _this$props.role,
|
|
83
|
+
onClick = _this$props.onClick;
|
|
102
84
|
if (text.trim().length === 0) {
|
|
103
85
|
return null;
|
|
104
86
|
}
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
87
|
+
var appearance = colorToLozengeAppearanceMap[color] || DEFAULT_APPEARANCE;
|
|
88
|
+
// Note: ommitted data-local-id attribute to avoid copying/pasting the same localId
|
|
108
89
|
return jsx("span", {
|
|
109
90
|
css: isAndroidChromium ? inlineBlockStyles : undefined,
|
|
110
91
|
className: "status-lozenge-span",
|
|
@@ -121,12 +102,9 @@ var StatusInternal = /*#__PURE__*/function (_PureComponent) {
|
|
|
121
102
|
}, text));
|
|
122
103
|
}
|
|
123
104
|
}]);
|
|
124
|
-
|
|
125
105
|
return StatusInternal;
|
|
126
106
|
}(PureComponent);
|
|
127
|
-
|
|
128
107
|
_defineProperty(StatusInternal, "displayName", 'StatusInternal');
|
|
129
|
-
|
|
130
108
|
export var Status = withAnalyticsEvents({
|
|
131
109
|
onClick: function onClick(createEvent, props) {
|
|
132
110
|
var localId = props.localId;
|
|
@@ -6,13 +6,9 @@ import _possibleConstructorReturn from "@babel/runtime/helpers/possibleConstruct
|
|
|
6
6
|
import _getPrototypeOf from "@babel/runtime/helpers/getPrototypeOf";
|
|
7
7
|
import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
8
8
|
import _taggedTemplateLiteral from "@babel/runtime/helpers/taggedTemplateLiteral";
|
|
9
|
-
|
|
10
9
|
var _templateObject;
|
|
11
|
-
|
|
12
10
|
function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }
|
|
13
|
-
|
|
14
11
|
function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
|
|
15
|
-
|
|
16
12
|
/** @jsx jsx */
|
|
17
13
|
import TextField from '@atlaskit/textfield';
|
|
18
14
|
import { gridSize } from '@atlaskit/theme/constants';
|
|
@@ -22,38 +18,27 @@ import { css, jsx } from '@emotion/react';
|
|
|
22
18
|
import ColorPalette from './internal/color-palette';
|
|
23
19
|
import { messages } from './i18n';
|
|
24
20
|
var fieldTextWrapperStyles = css(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n margin: 0 ", "px;\n"])), gridSize());
|
|
25
|
-
|
|
26
21
|
var Picker = /*#__PURE__*/function (_PureComponent) {
|
|
27
22
|
_inherits(Picker, _PureComponent);
|
|
28
|
-
|
|
29
23
|
var _super = _createSuper(Picker);
|
|
30
|
-
|
|
31
24
|
function Picker() {
|
|
32
25
|
var _this;
|
|
33
|
-
|
|
34
26
|
_classCallCheck(this, Picker);
|
|
35
|
-
|
|
36
27
|
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
|
|
37
28
|
args[_key] = arguments[_key];
|
|
38
29
|
}
|
|
39
|
-
|
|
40
30
|
_this = _super.call.apply(_super, [this].concat(args));
|
|
41
|
-
|
|
42
31
|
_defineProperty(_assertThisInitialized(_this), "fieldTextWrapperKey", Math.random().toString());
|
|
43
|
-
|
|
44
32
|
_defineProperty(_assertThisInitialized(_this), "colorPaletteKey", Math.random().toString());
|
|
45
|
-
|
|
46
33
|
_defineProperty(_assertThisInitialized(_this), "onChange", function (evt) {
|
|
47
34
|
// @ts-ignore
|
|
48
35
|
_this.props.onTextChanged(evt.target.value);
|
|
49
36
|
});
|
|
50
|
-
|
|
51
37
|
_defineProperty(_assertThisInitialized(_this), "onKeyPress", function (event) {
|
|
52
38
|
if (event.key === 'Enter') {
|
|
53
39
|
_this.props.onEnter();
|
|
54
40
|
}
|
|
55
41
|
});
|
|
56
|
-
|
|
57
42
|
_defineProperty(_assertThisInitialized(_this), "handleInputRef", function (ref) {
|
|
58
43
|
if (ref && _this.props.autoFocus) {
|
|
59
44
|
// Defer to prevent editor scrolling to top (See FS-3227, also ED-2992)
|
|
@@ -62,21 +47,20 @@ var Picker = /*#__PURE__*/function (_PureComponent) {
|
|
|
62
47
|
}, 50);
|
|
63
48
|
}
|
|
64
49
|
});
|
|
65
|
-
|
|
66
50
|
return _this;
|
|
67
51
|
}
|
|
68
|
-
|
|
69
52
|
_createClass(Picker, [{
|
|
70
53
|
key: "render",
|
|
71
54
|
value: function render() {
|
|
72
55
|
var _this$props = this.props,
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
// (https://github.com/airbnb/enzyme/issues/1149)
|
|
56
|
+
text = _this$props.text,
|
|
57
|
+
selectedColor = _this$props.selectedColor,
|
|
58
|
+
onColorClick = _this$props.onColorClick,
|
|
59
|
+
onColorHover = _this$props.onColorHover,
|
|
60
|
+
intl = _this$props.intl;
|
|
79
61
|
|
|
62
|
+
// Using <React.Fragment> instead of [] to workaround Enzyme
|
|
63
|
+
// (https://github.com/airbnb/enzyme/issues/1149)
|
|
80
64
|
return jsx(React.Fragment, null, jsx("div", {
|
|
81
65
|
css: fieldTextWrapperStyles,
|
|
82
66
|
key: this.fieldTextWrapperKey
|
|
@@ -97,12 +81,9 @@ var Picker = /*#__PURE__*/function (_PureComponent) {
|
|
|
97
81
|
}));
|
|
98
82
|
}
|
|
99
83
|
}]);
|
|
100
|
-
|
|
101
84
|
return Picker;
|
|
102
85
|
}(PureComponent);
|
|
103
|
-
|
|
104
86
|
_defineProperty(Picker, "defaultProps", {
|
|
105
87
|
autoFocus: true
|
|
106
88
|
});
|
|
107
|
-
|
|
108
89
|
export var StatusPicker = injectIntl(Picker);
|
|
@@ -1,22 +1,17 @@
|
|
|
1
1
|
import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
2
|
-
|
|
3
2
|
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
|
4
|
-
|
|
5
3
|
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
|
|
6
|
-
|
|
7
4
|
export var ELEMENTS_CHANNEL = 'fabric-elements';
|
|
8
5
|
var packageName = "@atlaskit/status";
|
|
9
|
-
var packageVersion = "1.2.
|
|
6
|
+
var packageVersion = "1.2.10";
|
|
10
7
|
export var createStatusAnalyticsAndFire = function createStatusAnalyticsAndFire(createAnalyticsEvent) {
|
|
11
8
|
return function (payload) {
|
|
12
9
|
var statusPayload = _objectSpread(_objectSpread({}, payload), {}, {
|
|
13
10
|
eventType: 'ui'
|
|
14
11
|
});
|
|
15
|
-
|
|
16
12
|
if (!statusPayload.attributes) {
|
|
17
13
|
statusPayload.attributes = {};
|
|
18
14
|
}
|
|
19
|
-
|
|
20
15
|
statusPayload.attributes.packageName = packageName;
|
|
21
16
|
statusPayload.attributes.packageVersion = packageVersion;
|
|
22
17
|
statusPayload.attributes.componentName = 'status';
|
|
@@ -1,8 +1,6 @@
|
|
|
1
1
|
import _slicedToArray from "@babel/runtime/helpers/slicedToArray";
|
|
2
2
|
import _taggedTemplateLiteral from "@babel/runtime/helpers/taggedTemplateLiteral";
|
|
3
|
-
|
|
4
3
|
var _templateObject;
|
|
5
|
-
|
|
6
4
|
/** @jsx jsx */
|
|
7
5
|
import { gridSize } from '@atlaskit/theme/constants';
|
|
8
6
|
import * as colors from '@atlaskit/theme/colors';
|
|
@@ -12,21 +10,17 @@ import Color from './color';
|
|
|
12
10
|
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, ")")]];
|
|
13
11
|
var colorPaletteWrapperStyles = css(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n margin: ", "px ", "px 0 ", "px;\n /* Firefox bug fix: https://product-fabric.atlassian.net/browse/ED-1789 */\n display: flex;\n flex-wrap: wrap;\n"])), gridSize(), gridSize(), gridSize());
|
|
14
12
|
var VK_LEFT = 37; //ArrowLeft
|
|
15
|
-
|
|
16
13
|
var VK_RIGHT = 39; //ArrowRight
|
|
17
|
-
|
|
18
14
|
var VK_UP = 38; //ArrowUp
|
|
19
|
-
|
|
20
15
|
var VK_DOWN = 40; //ArrowDown
|
|
21
|
-
|
|
22
16
|
var VK_TAB = 9;
|
|
23
17
|
export default (function (_ref) {
|
|
24
18
|
var _ref$cols = _ref.cols,
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
19
|
+
cols = _ref$cols === void 0 ? 7 : _ref$cols,
|
|
20
|
+
onClick = _ref.onClick,
|
|
21
|
+
selectedColor = _ref.selectedColor,
|
|
22
|
+
className = _ref.className,
|
|
23
|
+
onHover = _ref.onHover;
|
|
30
24
|
var colorRefs = useRef([]);
|
|
31
25
|
useEffect(function () {
|
|
32
26
|
colorRefs.current = colorRefs.current.slice(0, palette.length);
|
|
@@ -34,49 +28,39 @@ export default (function (_ref) {
|
|
|
34
28
|
var memoizedHandleKeyDown = useCallback(function (e) {
|
|
35
29
|
var colorIndex = palette.findIndex(function (_ref2) {
|
|
36
30
|
var _ref3 = _slicedToArray(_ref2, 1),
|
|
37
|
-
|
|
38
|
-
|
|
31
|
+
colorValue = _ref3[0];
|
|
39
32
|
return colorValue === selectedColor;
|
|
40
33
|
});
|
|
41
34
|
var newColorIndex = null;
|
|
42
|
-
|
|
43
35
|
var nextColor = function nextColor() {
|
|
44
36
|
return colorIndex + 1 > palette.length - 1 ? 0 : colorIndex + 1;
|
|
45
37
|
};
|
|
46
|
-
|
|
47
38
|
var previousColor = function previousColor() {
|
|
48
39
|
return colorIndex - 1 < 0 ? palette.length - 1 : colorIndex - 1;
|
|
49
40
|
};
|
|
50
|
-
|
|
51
41
|
switch (e.keyCode) {
|
|
52
42
|
case VK_RIGHT:
|
|
53
43
|
case VK_DOWN:
|
|
54
44
|
e.preventDefault();
|
|
55
45
|
newColorIndex = nextColor();
|
|
56
46
|
break;
|
|
57
|
-
|
|
58
47
|
case VK_LEFT:
|
|
59
48
|
case VK_UP:
|
|
60
49
|
e.preventDefault();
|
|
61
50
|
newColorIndex = previousColor();
|
|
62
51
|
break;
|
|
63
|
-
|
|
64
52
|
case VK_TAB:
|
|
65
53
|
e.preventDefault();
|
|
66
|
-
|
|
67
54
|
if (e.shiftKey) {
|
|
68
55
|
newColorIndex = previousColor();
|
|
69
56
|
} else {
|
|
70
57
|
newColorIndex = nextColor();
|
|
71
58
|
}
|
|
72
|
-
|
|
73
59
|
break;
|
|
74
60
|
}
|
|
75
|
-
|
|
76
61
|
if (newColorIndex === null) {
|
|
77
62
|
return;
|
|
78
63
|
}
|
|
79
|
-
|
|
80
64
|
var newColorValue = palette[newColorIndex][0];
|
|
81
65
|
var newRef = colorRefs.current[newColorIndex];
|
|
82
66
|
newRef === null || newRef === void 0 ? void 0 : newRef.focus();
|
|
@@ -100,11 +84,10 @@ export default (function (_ref) {
|
|
|
100
84
|
onKeyDown: memoizedHandleKeyDown
|
|
101
85
|
}, palette.map(function (_ref4, i) {
|
|
102
86
|
var _ref5 = _slicedToArray(_ref4, 4),
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
87
|
+
colorValue = _ref5[0],
|
|
88
|
+
backgroundColor = _ref5[1],
|
|
89
|
+
borderColor = _ref5[2],
|
|
90
|
+
iconColor = _ref5[3];
|
|
108
91
|
return jsx(Color, {
|
|
109
92
|
key: colorValue,
|
|
110
93
|
value: colorValue,
|
|
@@ -6,13 +6,9 @@ import _possibleConstructorReturn from "@babel/runtime/helpers/possibleConstruct
|
|
|
6
6
|
import _getPrototypeOf from "@babel/runtime/helpers/getPrototypeOf";
|
|
7
7
|
import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
8
8
|
import _taggedTemplateLiteral from "@babel/runtime/helpers/taggedTemplateLiteral";
|
|
9
|
-
|
|
10
9
|
var _templateObject, _templateObject2;
|
|
11
|
-
|
|
12
10
|
function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }
|
|
13
|
-
|
|
14
11
|
function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
|
|
15
|
-
|
|
16
12
|
/** @jsx jsx */
|
|
17
13
|
import EditorDoneIcon from '@atlaskit/icon/glyph/editor/done';
|
|
18
14
|
import { N900, N0, N50 } from '@atlaskit/theme/colors';
|
|
@@ -23,69 +19,52 @@ import { ANALYTICS_HOVER_DELAY } from '../constants';
|
|
|
23
19
|
import { messages } from '../i18n';
|
|
24
20
|
var buttonStyles = css(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n height: 24px;\n width: 24px;\n background: ", ";\n padding: 0;\n border-radius: 4px;\n border: 1px solid ", ";\n cursor: pointer;\n display: block;\n box-sizing: border-box;\n overflow: hidden;\n"])), "var(--ds-background-neutral, ".concat(N900, ")"), "var(--ds-border, ".concat(N0, ")"));
|
|
25
21
|
var buttonWrapperStyles = css(_templateObject2 || (_templateObject2 = _taggedTemplateLiteral(["\n border: 1px solid transparent;\n margin: 0 2px;\n font-size: 0;\n display: flex;\n align-items: center;\n padding: 1px;\n border-radius: 6px;\n &:hover {\n border: 1px solid ", ";\n }\n"])), "var(--ds-border, ".concat(N50, ")"));
|
|
26
|
-
|
|
27
22
|
var Color = /*#__PURE__*/function (_PureComponent) {
|
|
28
23
|
_inherits(Color, _PureComponent);
|
|
29
|
-
|
|
30
24
|
var _super = _createSuper(Color);
|
|
31
|
-
|
|
32
25
|
function Color() {
|
|
33
26
|
var _this;
|
|
34
|
-
|
|
35
27
|
_classCallCheck(this, Color);
|
|
36
|
-
|
|
37
28
|
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
|
|
38
29
|
args[_key] = arguments[_key];
|
|
39
30
|
}
|
|
40
|
-
|
|
41
31
|
_this = _super.call.apply(_super, [this].concat(args));
|
|
42
|
-
|
|
43
32
|
_defineProperty(_assertThisInitialized(_this), "hoverStartTime", 0);
|
|
44
|
-
|
|
45
33
|
_defineProperty(_assertThisInitialized(_this), "onMouseEnter", function () {
|
|
46
34
|
_this.hoverStartTime = Date.now();
|
|
47
35
|
});
|
|
48
|
-
|
|
49
36
|
_defineProperty(_assertThisInitialized(_this), "onMouseLeave", function () {
|
|
50
37
|
var onHover = _this.props.onHover;
|
|
51
|
-
|
|
52
38
|
var delay = Date.now() - _this.hoverStartTime;
|
|
53
|
-
|
|
54
39
|
if (delay >= ANALYTICS_HOVER_DELAY && onHover) {
|
|
55
40
|
onHover(_this.props.value);
|
|
56
41
|
}
|
|
57
|
-
|
|
58
42
|
_this.hoverStartTime = 0;
|
|
59
43
|
});
|
|
60
|
-
|
|
61
44
|
_defineProperty(_assertThisInitialized(_this), "onMouseDown", function (e) {
|
|
62
45
|
e.preventDefault();
|
|
63
46
|
});
|
|
64
|
-
|
|
65
47
|
_defineProperty(_assertThisInitialized(_this), "onClick", function (e) {
|
|
66
48
|
var _this$props = _this.props,
|
|
67
|
-
|
|
68
|
-
|
|
49
|
+
onClick = _this$props.onClick,
|
|
50
|
+
value = _this$props.value;
|
|
69
51
|
e.preventDefault();
|
|
70
52
|
onClick(value);
|
|
71
53
|
});
|
|
72
|
-
|
|
73
54
|
return _this;
|
|
74
55
|
}
|
|
75
|
-
|
|
76
56
|
_createClass(Color, [{
|
|
77
57
|
key: "render",
|
|
78
58
|
value: function render() {
|
|
79
59
|
var _this2 = this;
|
|
80
|
-
|
|
81
60
|
var _this$props2 = this.props,
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
61
|
+
tabIndex = _this$props2.tabIndex,
|
|
62
|
+
backgroundColor = _this$props2.backgroundColor,
|
|
63
|
+
isSelected = _this$props2.isSelected,
|
|
64
|
+
borderColor = _this$props2.borderColor,
|
|
65
|
+
iconColor = _this$props2.iconColor,
|
|
66
|
+
value = _this$props2.value,
|
|
67
|
+
setRef = _this$props2.setRef;
|
|
89
68
|
return jsx("span", {
|
|
90
69
|
css: buttonWrapperStyles
|
|
91
70
|
}, jsx(FormattedMessage, messages["".concat(value, "Color")], function (labels) {
|
|
@@ -97,7 +76,8 @@ var Color = /*#__PURE__*/function (_PureComponent) {
|
|
|
97
76
|
onMouseDown: _this2.onMouseDown,
|
|
98
77
|
tabIndex: tabIndex,
|
|
99
78
|
className: "".concat(isSelected ? 'selected' : ''),
|
|
100
|
-
title: labels[0]
|
|
79
|
+
title: labels[0]
|
|
80
|
+
// button element does not support aria-selected.
|
|
101
81
|
// For button selected (to be precise pressed) or not
|
|
102
82
|
// use aria-pressed as per
|
|
103
83
|
// https://developer.mozilla.org/en-US/docs/Web/Accessibility/ARIA/Roles/button_role#associated_aria_roles_states_and_properties
|
|
@@ -120,8 +100,6 @@ var Color = /*#__PURE__*/function (_PureComponent) {
|
|
|
120
100
|
this.hoverStartTime = 0;
|
|
121
101
|
}
|
|
122
102
|
}]);
|
|
123
|
-
|
|
124
103
|
return Color;
|
|
125
104
|
}(PureComponent);
|
|
126
|
-
|
|
127
105
|
export { Color as default };
|
package/dist/esm/version.json
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atlaskit/status",
|
|
3
|
-
"version": "1.2.
|
|
3
|
+
"version": "1.2.10",
|
|
4
4
|
"description": "Fabric Status React Components",
|
|
5
5
|
"publishConfig": {
|
|
6
6
|
"registry": "https://registry.npmjs.org/"
|
|
@@ -25,12 +25,12 @@
|
|
|
25
25
|
"access": "public"
|
|
26
26
|
},
|
|
27
27
|
"dependencies": {
|
|
28
|
-
"@atlaskit/analytics-next": "^
|
|
28
|
+
"@atlaskit/analytics-next": "^9.0.0",
|
|
29
29
|
"@atlaskit/icon": "^21.11.0",
|
|
30
30
|
"@atlaskit/lozenge": "^11.3.0",
|
|
31
31
|
"@atlaskit/textfield": "^5.3.0",
|
|
32
32
|
"@atlaskit/theme": "^12.2.0",
|
|
33
|
-
"@atlaskit/tokens": "^
|
|
33
|
+
"@atlaskit/tokens": "^1.2.0",
|
|
34
34
|
"@babel/runtime": "^7.0.0",
|
|
35
35
|
"@emotion/react": "^11.7.1"
|
|
36
36
|
},
|
|
@@ -59,7 +59,9 @@
|
|
|
59
59
|
"prettier": "@atlassian/atlassian-frontend-prettier-config-1.0.1",
|
|
60
60
|
"techstack": {
|
|
61
61
|
"@repo/internal": {
|
|
62
|
-
"
|
|
62
|
+
"design-tokens": [
|
|
63
|
+
"color"
|
|
64
|
+
]
|
|
63
65
|
}
|
|
64
66
|
}
|
|
65
67
|
}
|