@atlaskit/status 5.10.1 → 5.11.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 +22 -0
- package/afm-products/tsconfig.json +3 -0
- package/dist/cjs/components/Status.js +8 -11
- package/dist/cjs/components/StatusPicker.js +10 -2
- package/dist/cjs/components/analytics.js +1 -1
- package/dist/cjs/components/i18n.js +22 -2
- package/dist/cjs/components/internal/color-palette.js +25 -6
- package/dist/cjs/components/internal/color.js +2 -1
- package/dist/cjs/components/status-colors.js +228 -0
- package/dist/es2019/components/Status.js +9 -11
- package/dist/es2019/components/StatusPicker.js +11 -2
- package/dist/es2019/components/analytics.js +1 -1
- package/dist/es2019/components/i18n.js +22 -2
- package/dist/es2019/components/internal/color-palette.js +24 -6
- package/dist/es2019/components/internal/color.js +2 -1
- package/dist/es2019/components/status-colors.js +217 -0
- package/dist/esm/components/Status.js +9 -11
- package/dist/esm/components/StatusPicker.js +11 -2
- package/dist/esm/components/analytics.js +1 -1
- package/dist/esm/components/i18n.js +22 -2
- package/dist/esm/components/internal/color-palette.js +25 -6
- package/dist/esm/components/internal/color.js +2 -1
- package/dist/esm/components/status-colors.js +223 -0
- package/dist/types/components/Status.d.ts +6 -1
- package/dist/types/components/StatusPicker.d.ts +11 -0
- package/dist/types/components/i18n.d.ts +30 -10
- package/dist/types/components/internal/color-palette.d.ts +4 -1
- package/dist/types/components/status-colors.d.ts +66 -0
- package/package.json +7 -2
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,27 @@
|
|
|
1
1
|
# @atlaskit/status
|
|
2
2
|
|
|
3
|
+
## 5.11.1
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- Updated dependencies
|
|
8
|
+
|
|
9
|
+
## 5.11.0
|
|
10
|
+
|
|
11
|
+
### Minor Changes
|
|
12
|
+
|
|
13
|
+
- [`30567ec57fc8c`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/30567ec57fc8c) -
|
|
14
|
+
[ux] Add an optional `palette` prop to `StatusPicker` (`'default' | 'extended'`). `extended`
|
|
15
|
+
offers ten colours instead of six and can emit hex values through `onColorClick`; `default` is
|
|
16
|
+
unchanged, so existing consumers keep today's six named colours. Status colours now come from a
|
|
17
|
+
single registry, and `Status` renders hex behind `platform_editor_gracefully_render_status_color`.
|
|
18
|
+
The ten-colour picker is rolled out by `platform_editor_update_status_colors` in
|
|
19
|
+
`@atlaskit/editor-plugin-status`.
|
|
20
|
+
|
|
21
|
+
### Patch Changes
|
|
22
|
+
|
|
23
|
+
- Updated dependencies
|
|
24
|
+
|
|
3
25
|
## 5.10.1
|
|
4
26
|
|
|
5
27
|
### Patch Changes
|
|
@@ -21,18 +21,15 @@ var _lozenge = _interopRequireDefault(require("@atlaskit/lozenge/lozenge"));
|
|
|
21
21
|
var _withAnalyticsEvents = _interopRequireDefault(require("@atlaskit/analytics-next/withAnalyticsEvents"));
|
|
22
22
|
var _analytics = require("./analytics");
|
|
23
23
|
var _constants = require("./constants");
|
|
24
|
+
var _statusColors = require("./status-colors");
|
|
24
25
|
function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r = new WeakMap(), n = new WeakMap(); return (_interopRequireWildcard = function _interopRequireWildcard(e, t) { if (!t && e && e.__esModule) return e; var o, i, f = { __proto__: null, default: e }; if (null === e || "object" != _typeof(e) && "function" != typeof e) return f; if (o = t ? n : r) { if (o.has(e)) return o.get(e); o.set(e, f); } for (var _t in e) "default" !== _t && {}.hasOwnProperty.call(e, _t) && ((i = (o = Object.defineProperty) && Object.getOwnPropertyDescriptor(e, _t)) && (i.get || i.set) ? o(f, _t, i) : f[_t] = e[_t]); return f; })(e, t); }
|
|
25
26
|
function _callSuper(t, o, e) { return o = (0, _getPrototypeOf2.default)(o), (0, _possibleConstructorReturn2.default)(t, _isNativeReflectConstruct() ? Reflect.construct(o, e || [], (0, _getPrototypeOf2.default)(t).constructor) : o.apply(t, e)); }
|
|
26
27
|
function _isNativeReflectConstruct() { try { var t = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); } catch (t) {} return (_isNativeReflectConstruct = function _isNativeReflectConstruct() { return !!t; })(); }
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
yellow: 'warning',
|
|
33
|
-
green: 'success'
|
|
34
|
-
};
|
|
35
|
-
var DEFAULT_APPEARANCE = 'neutral';
|
|
28
|
+
/**
|
|
29
|
+
* What the ADF `color` attribute can hold. `HexColor` is the closed set we persist — do
|
|
30
|
+
* not substitute it here, or graceful rendering of unknown hex becomes a type error.
|
|
31
|
+
*/
|
|
32
|
+
|
|
36
33
|
var MAX_WIDTH = 200;
|
|
37
34
|
|
|
38
35
|
/**
|
|
@@ -108,7 +105,7 @@ var StatusInternal = /*#__PURE__*/function (_PureComponent) {
|
|
|
108
105
|
if (text.trim().length === 0) {
|
|
109
106
|
return null;
|
|
110
107
|
}
|
|
111
|
-
var appearance =
|
|
108
|
+
var appearance = (0, _statusColors.getLozengeAppearance)(color);
|
|
112
109
|
// Note: ommitted data-local-id attribute to avoid copying/pasting the same localId
|
|
113
110
|
return /*#__PURE__*/React.createElement("span", {
|
|
114
111
|
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-classname-prop -- Ignored via go/DSP-18766
|
|
@@ -121,7 +118,7 @@ var StatusInternal = /*#__PURE__*/function (_PureComponent) {
|
|
|
121
118
|
onBlur: this.handleBlur,
|
|
122
119
|
tabIndex: onClick ? -1 : undefined,
|
|
123
120
|
"data-node-type": "status",
|
|
124
|
-
"data-color": color,
|
|
121
|
+
"data-color": (0, _statusColors.normalizeColor)(color),
|
|
125
122
|
"data-style": style,
|
|
126
123
|
role: role
|
|
127
124
|
}, /*#__PURE__*/React.createElement(_lozenge.default, {
|
|
@@ -23,6 +23,12 @@ var _i18n = require("./i18n");
|
|
|
23
23
|
function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r = new WeakMap(), n = new WeakMap(); return (_interopRequireWildcard = function _interopRequireWildcard(e, t) { if (!t && e && e.__esModule) return e; var o, i, f = { __proto__: null, default: e }; if (null === e || "object" != _typeof(e) && "function" != typeof e) return f; if (o = t ? n : r) { if (o.has(e)) return o.get(e); o.set(e, f); } for (var _t in e) "default" !== _t && {}.hasOwnProperty.call(e, _t) && ((i = (o = Object.defineProperty) && Object.getOwnPropertyDescriptor(e, _t)) && (i.get || i.set) ? o(f, _t, i) : f[_t] = e[_t]); return f; })(e, t); }
|
|
24
24
|
function _callSuper(t, o, e) { return o = (0, _getPrototypeOf2.default)(o), (0, _possibleConstructorReturn2.default)(t, _isNativeReflectConstruct() ? Reflect.construct(o, e || [], (0, _getPrototypeOf2.default)(t).constructor) : o.apply(t, e)); }
|
|
25
25
|
function _isNativeReflectConstruct() { try { var t = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); } catch (t) {} return (_isNativeReflectConstruct = function _isNativeReflectConstruct() { return !!t; })(); }
|
|
26
|
+
/**
|
|
27
|
+
* Which set of selectable values the picker offers.
|
|
28
|
+
* - `default`: the six named colours.
|
|
29
|
+
* - `extended`: ten colours; hues without an existing name are persisted as hex.
|
|
30
|
+
*/
|
|
31
|
+
|
|
26
32
|
var fieldTextWrapperStyles = null;
|
|
27
33
|
|
|
28
34
|
// Keep the existing content position while reserving space inside the scrollport for focus rings.
|
|
@@ -74,12 +80,14 @@ var Picker = /*#__PURE__*/function (_PureComponent) {
|
|
|
74
80
|
onColorClick = _this$props.onColorClick,
|
|
75
81
|
onColorHover = _this$props.onColorHover,
|
|
76
82
|
intl = _this$props.intl,
|
|
77
|
-
scrollableContent = _this$props.scrollableContent
|
|
83
|
+
scrollableContent = _this$props.scrollableContent,
|
|
84
|
+
palette = _this$props.palette;
|
|
78
85
|
var colorPalette = /*#__PURE__*/_react.default.createElement(_colorPalette.default, {
|
|
79
86
|
key: this.colorPaletteKey,
|
|
80
87
|
onClick: onColorClick,
|
|
81
88
|
onHover: onColorHover,
|
|
82
|
-
selectedColor: selectedColor
|
|
89
|
+
selectedColor: selectedColor,
|
|
90
|
+
palette: palette
|
|
83
91
|
});
|
|
84
92
|
|
|
85
93
|
// Using <React.Fragment> instead of [] to workaround Enzyme
|
|
@@ -10,7 +10,7 @@ function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbol
|
|
|
10
10
|
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) { (0, _defineProperty2.default)(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; }
|
|
11
11
|
var ELEMENTS_CHANNEL = exports.ELEMENTS_CHANNEL = 'fabric-elements';
|
|
12
12
|
var packageName = "@atlaskit/status";
|
|
13
|
-
var packageVersion = "5.
|
|
13
|
+
var packageVersion = "5.11.0";
|
|
14
14
|
var createStatusAnalyticsAndFire = exports.createStatusAnalyticsAndFire = function createStatusAnalyticsAndFire(createAnalyticsEvent) {
|
|
15
15
|
return function (payload) {
|
|
16
16
|
var statusPayload = _objectSpread(_objectSpread({}, payload), {}, {
|
|
@@ -8,8 +8,8 @@ var _reactIntl = require("react-intl");
|
|
|
8
8
|
var messages = exports.messages = (0, _reactIntl.defineMessages)({
|
|
9
9
|
neutralColor: {
|
|
10
10
|
id: 'fabric.status.color.grey',
|
|
11
|
-
defaultMessage: '
|
|
12
|
-
description: 'Tooltip for the
|
|
11
|
+
defaultMessage: 'Gray',
|
|
12
|
+
description: 'Tooltip for the gray color in color palette'
|
|
13
13
|
},
|
|
14
14
|
purpleColor: {
|
|
15
15
|
id: 'fabric.status.color.purple',
|
|
@@ -36,6 +36,26 @@ var messages = exports.messages = (0, _reactIntl.defineMessages)({
|
|
|
36
36
|
defaultMessage: 'Green',
|
|
37
37
|
description: 'Tooltip for the green color in color palette'
|
|
38
38
|
},
|
|
39
|
+
tealColor: {
|
|
40
|
+
id: 'fabric.status.color.teal',
|
|
41
|
+
defaultMessage: 'Teal',
|
|
42
|
+
description: 'Tooltip for the teal color in color palette'
|
|
43
|
+
},
|
|
44
|
+
limeColor: {
|
|
45
|
+
id: 'fabric.status.color.lime',
|
|
46
|
+
defaultMessage: 'Lime',
|
|
47
|
+
description: 'Tooltip for the lime color in color palette'
|
|
48
|
+
},
|
|
49
|
+
orangeColor: {
|
|
50
|
+
id: 'fabric.status.color.orange',
|
|
51
|
+
defaultMessage: 'Orange',
|
|
52
|
+
description: 'Tooltip for the orange color in color palette'
|
|
53
|
+
},
|
|
54
|
+
magentaColor: {
|
|
55
|
+
id: 'fabric.status.color.magenta',
|
|
56
|
+
defaultMessage: 'Magenta',
|
|
57
|
+
description: 'Tooltip for the magenta color in color palette'
|
|
58
|
+
},
|
|
39
59
|
statusInputLabel: {
|
|
40
60
|
id: 'fabric.status.input.label',
|
|
41
61
|
defaultMessage: 'Set a status',
|
|
@@ -13,12 +13,29 @@ var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/sli
|
|
|
13
13
|
var _react = _interopRequireWildcard(require("react"));
|
|
14
14
|
var _fg = require("@atlaskit/platform-feature-flags/fg");
|
|
15
15
|
var _useThemeObserver2 = require("@atlaskit/tokens/use-theme-observer");
|
|
16
|
+
var _statusColors = require("../status-colors");
|
|
16
17
|
var _color = _interopRequireDefault(require("./color"));
|
|
17
18
|
function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r = new WeakMap(), n = new WeakMap(); return (_interopRequireWildcard = function _interopRequireWildcard(e, t) { if (!t && e && e.__esModule) return e; var o, i, f = { __proto__: null, default: e }; if (null === e || "object" != _typeof(e) && "function" != typeof e) return f; if (o = t ? n : r) { if (o.has(e)) return o.get(e); o.set(e, f); } for (var _t in e) "default" !== _t && {}.hasOwnProperty.call(e, _t) && ((i = (o = Object.defineProperty) && Object.getOwnPropertyDescriptor(e, _t)) && (i.get || i.set) ? o(f, _t, i) : f[_t] = e[_t]); return f; })(e, t); }
|
|
18
19
|
var paletteLegacy = [['neutral', "var(--ds-background-neutral, #0515240F)", "var(--ds-border-bold, #7D818A)", "var(--ds-icon, #292A2E)"], ['purple', "var(--ds-background-discovery, #F8EEFE)", "var(--ds-border-discovery, #AF59E1)", "var(--ds-icon-discovery, #AF59E1)"], ['blue', "var(--ds-background-information, #E9F2FE)", "var(--ds-border-information, #357DE8)", "var(--ds-icon-information, #357DE8)"], ['red', "var(--ds-background-danger, #FFECEB)", "var(--ds-border-danger, #E2483D)", "var(--ds-icon-danger, #C9372C)"], ['yellow', "var(--ds-background-warning, #FFF5DB)", "var(--ds-border-warning, #E06C00)", "var(--ds-icon-warning, #E06C00)"], ['green', "var(--ds-background-success, #EFFFD6)", "var(--ds-border-success, #6A9A23)", "var(--ds-icon-success, #6A9A23)"]];
|
|
19
20
|
var paletteRefreshed = [['neutral', "var(--ds-background-accent-gray-subtler, #DDDEE1)", "var(--ds-border-bold, #7D818A)", "var(--ds-icon, #292A2E)"], ['blue', "var(--ds-background-information-pressed, #ADCBFB)", "var(--ds-border-information, #357DE8)", "var(--ds-icon, #292A2E)"], ['green', "var(--ds-background-success-pressed, #BDE97C)", "var(--ds-border-success, #6A9A23)", "var(--ds-icon, #292A2E)"], ['yellow', "var(--ds-background-warning-pressed, #FBD779)", "var(--ds-border-warning, #E06C00)", "var(--ds-icon, #292A2E)"], ['red', "var(--ds-background-danger-pressed, #FFB8B2)", "var(--ds-border-danger, #E2483D)", "var(--ds-icon, #292A2E)"], ['purple', "var(--ds-background-discovery-pressed, #E3BDFA)", "var(--ds-border-discovery, #AF59E1)", "var(--ds-icon, #292A2E)"]];
|
|
20
21
|
var paletteTeam26 = [['neutral', "var(--ds-background-neutral, #0515240F)", '#CACBCF', '#63666B', "var(--ds-icon, #292A2E)"], ['blue', "var(--ds-background-information-subtler, #CFE1FD)", '#8FB8F6', '#1558BC', "var(--ds-icon, #292A2E)"], ['green', "var(--ds-background-success-subtler, #D3F1A7)", '#B3DF72', '#4C6B1F', "var(--ds-icon, #292A2E)"], ['yellow', "var(--ds-background-warning-subtler, #FCE4A6)", '#FBC828', '#9E4C00', "var(--ds-icon, #292A2E)"], ['red', "var(--ds-background-danger-subtler, #FFD5D2)", '#FD9891', '#AE2E24', "var(--ds-icon, #292A2E)"], ['purple', "var(--ds-background-discovery-subtler, #EED7FC)", '#D8A0F7', '#803FA5', "var(--ds-icon, #292A2E)"]];
|
|
22
|
+
// Derived from the status colour registry so the swatch list, the Lozenge appearances
|
|
23
|
+
// and the i18n keys cannot drift apart. See COLORS.
|
|
24
|
+
var paletteHex = _statusColors.PICKER_SWATCHES.flatMap(function (value) {
|
|
25
|
+
var swatch = _statusColors.COLORS[value].swatch;
|
|
26
|
+
return swatch ? [[value, swatch.backgroundColor, swatch.borderColor, _statusColors.SWATCH_ICON_COLOR]] : [];
|
|
27
|
+
});
|
|
28
|
+
|
|
29
|
+
/** Columns each variant is laid out in; `extended` wraps its ten swatches onto two rows. */
|
|
30
|
+
var variantToCols = {
|
|
31
|
+
default: 7,
|
|
32
|
+
extended: 5
|
|
33
|
+
};
|
|
21
34
|
var getPalette = function getPalette(colorMode) {
|
|
35
|
+
var variant = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 'default';
|
|
36
|
+
if (variant === 'extended') {
|
|
37
|
+
return paletteHex;
|
|
38
|
+
}
|
|
22
39
|
if ((0, _fg.fg)('platform-dst-lozenge-tag-badge-visual-uplifts')) {
|
|
23
40
|
var isDark = colorMode === 'dark';
|
|
24
41
|
return paletteTeam26.map(function (_ref) {
|
|
@@ -37,15 +54,17 @@ var getPalette = function getPalette(colorMode) {
|
|
|
37
54
|
// eslint-disable-next-line @atlaskit/design-system/consistent-css-prop-usage, @atlaskit/design-system/no-css-tagged-template-expression -- Ignored via go/DSP-18766
|
|
38
55
|
var colorPaletteWrapperStyles = null;
|
|
39
56
|
var _default = exports.default = function _default(_ref3) {
|
|
40
|
-
var
|
|
41
|
-
cols = _ref3$cols === void 0 ? 7 : _ref3$cols,
|
|
57
|
+
var cols = _ref3.cols,
|
|
42
58
|
onClick = _ref3.onClick,
|
|
43
59
|
selectedColor = _ref3.selectedColor,
|
|
44
60
|
className = _ref3.className,
|
|
45
|
-
onHover = _ref3.onHover
|
|
61
|
+
onHover = _ref3.onHover,
|
|
62
|
+
_ref3$palette = _ref3.palette,
|
|
63
|
+
variant = _ref3$palette === void 0 ? 'default' : _ref3$palette;
|
|
46
64
|
var _useThemeObserver = (0, _useThemeObserver2.useThemeObserver)(),
|
|
47
65
|
colorMode = _useThemeObserver.colorMode;
|
|
48
|
-
var palette = getPalette(colorMode);
|
|
66
|
+
var palette = getPalette(colorMode, variant);
|
|
67
|
+
var resolvedCols = cols !== null && cols !== void 0 ? cols : variantToCols[variant];
|
|
49
68
|
var colorRefs = (0, _react.useRef)([]);
|
|
50
69
|
(0, _react.useEffect)(function () {
|
|
51
70
|
colorRefs.current = colorRefs.current.slice(0, palette.length);
|
|
@@ -82,7 +101,7 @@ var _default = exports.default = function _default(_ref3) {
|
|
|
82
101
|
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-classname-prop -- Ignored via go/DSP-18766
|
|
83
102
|
className: (0, _runtime.ax)(["_19bvidpf _19pku2gc _2hwxu2gc _otyridpf _18u0u2gc _1e0c1txw _1n261g80", className]),
|
|
84
103
|
style: {
|
|
85
|
-
maxWidth:
|
|
104
|
+
maxWidth: resolvedCols * 32
|
|
86
105
|
}
|
|
87
106
|
}, palette.map(function (_ref4, i) {
|
|
88
107
|
var _ref5 = (0, _slicedToArray2.default)(_ref4, 4),
|
|
@@ -98,7 +117,7 @@ var _default = exports.default = function _default(_ref3) {
|
|
|
98
117
|
iconColor: iconColor,
|
|
99
118
|
onClick: onClick,
|
|
100
119
|
onHover: onHover,
|
|
101
|
-
isSelected: colorValue
|
|
120
|
+
isSelected: (0, _statusColors.isSwatchSelected)(colorValue, selectedColor),
|
|
102
121
|
tabIndex: i === 0 ? 0 : -1,
|
|
103
122
|
setRef: function setRef(el) {
|
|
104
123
|
return colorRefs.current[i] = el;
|
|
@@ -22,6 +22,7 @@ var _compiled = require("@atlaskit/primitives/compiled");
|
|
|
22
22
|
var _reactIntl = require("react-intl");
|
|
23
23
|
var _constants = require("../constants");
|
|
24
24
|
var _i18n = require("../i18n");
|
|
25
|
+
var _statusColors = require("../status-colors");
|
|
25
26
|
function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r = new WeakMap(), n = new WeakMap(); return (_interopRequireWildcard = function _interopRequireWildcard(e, t) { if (!t && e && e.__esModule) return e; var o, i, f = { __proto__: null, default: e }; if (null === e || "object" != _typeof(e) && "function" != typeof e) return f; if (o = t ? n : r) { if (o.has(e)) return o.get(e); o.set(e, f); } for (var _t in e) "default" !== _t && {}.hasOwnProperty.call(e, _t) && ((i = (o = Object.defineProperty) && Object.getOwnPropertyDescriptor(e, _t)) && (i.get || i.set) ? o(f, _t, i) : f[_t] = e[_t]); return f; })(e, t); }
|
|
26
27
|
function _callSuper(t, o, e) { return o = (0, _getPrototypeOf2.default)(o), (0, _possibleConstructorReturn2.default)(t, _isNativeReflectConstruct() ? Reflect.construct(o, e || [], (0, _getPrototypeOf2.default)(t).constructor) : o.apply(t, e)); }
|
|
27
28
|
function _isNativeReflectConstruct() { try { var t = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); } catch (t) {} return (_isNativeReflectConstruct = function _isNativeReflectConstruct() { return !!t; })(); }
|
|
@@ -77,7 +78,7 @@ var Color = exports.default = /*#__PURE__*/function (_PureComponent) {
|
|
|
77
78
|
onKeyDown = _this$props2.onKeyDown;
|
|
78
79
|
return /*#__PURE__*/React.createElement("li", {
|
|
79
80
|
className: (0, _runtime.ax)(["_2rko12x7 _189ee4h9 _1dqonqa1 _1h6d1j28 _19pkze3t _2hwxv77o _otyrze3t _18u0v77o _1e0c1txw _4cvr1h6o _ca0qe4h9 _u5f3e4h9 _n3tde4h9 _19bve4h9 _bfw7ia51"])
|
|
80
|
-
}, /*#__PURE__*/React.createElement(_reactIntl.FormattedMessage, _i18n.messages[
|
|
81
|
+
}, /*#__PURE__*/React.createElement(_reactIntl.FormattedMessage, _i18n.messages[(0, _statusColors.getColorLabelKey)(value)], function (labels) {
|
|
81
82
|
return /*#__PURE__*/React.createElement(_compiled.Pressable, {
|
|
82
83
|
xcss: styles.button,
|
|
83
84
|
onClick: _this2.onClick,
|
|
@@ -0,0 +1,228 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.normalizeColor = exports.isSwatchSelected = exports.isNamedColor = exports.getLozengeAppearance = exports.getColorLabelKey = exports.colorToLozengeAppearanceMap = exports.SWATCH_ICON_COLOR = exports.PICKER_SWATCHES = exports.NAMED_COLORS = exports.HEX_PALETTE = exports.DEFAULT_LOZENGE_APPEARANCE = exports.COLORS = void 0;
|
|
7
|
+
var _unsafeExpValNoExposure = require("@atlaskit/platform-feature-experiments/unsafe-exp-val-no-exposure");
|
|
8
|
+
var _fg = require("@atlaskit/platform-feature-flags/fg");
|
|
9
|
+
/** Named colours the ADF `color` attribute can carry. */
|
|
10
|
+
|
|
11
|
+
var NAMED_COLORS = exports.NAMED_COLORS = ['neutral', 'purple', 'blue', 'red', 'yellow', 'green'];
|
|
12
|
+
|
|
13
|
+
/**
|
|
14
|
+
* Hex ids the picker persists — the hues with no existing named ADF colour.
|
|
15
|
+
* Each is the panel-medium hex for that accent, so it resolves to the same token
|
|
16
|
+
* the editor palette would give it.
|
|
17
|
+
*/
|
|
18
|
+
|
|
19
|
+
var HEX_PALETTE = exports.HEX_PALETTE = ['#B3F5FF',
|
|
20
|
+
// Teal
|
|
21
|
+
'#ABF5D1',
|
|
22
|
+
// Green
|
|
23
|
+
'#D3F1A7',
|
|
24
|
+
// Lime — named `green` renders identically
|
|
25
|
+
'#FFF0B3',
|
|
26
|
+
// Yellow
|
|
27
|
+
'#FCE4A6',
|
|
28
|
+
// Orange — named `yellow` renders identically
|
|
29
|
+
'#FDD0EC' // Magenta
|
|
30
|
+
];
|
|
31
|
+
var DEFAULT_LOZENGE_APPEARANCE = exports.DEFAULT_LOZENGE_APPEARANCE = 'neutral';
|
|
32
|
+
|
|
33
|
+
/** Pre-experiment mapping. Delete with `platform_editor_update_status_colors`. */
|
|
34
|
+
var colorToLozengeAppearanceMap = exports.colorToLozengeAppearanceMap = {
|
|
35
|
+
neutral: 'neutral',
|
|
36
|
+
purple: 'discovery',
|
|
37
|
+
blue: 'information',
|
|
38
|
+
red: 'danger',
|
|
39
|
+
yellow: 'warning',
|
|
40
|
+
green: 'success'
|
|
41
|
+
};
|
|
42
|
+
|
|
43
|
+
/**
|
|
44
|
+
* Check-mark colour for the selected swatch. Uniform across the ten-colour palette, so
|
|
45
|
+
* it is not a per-colour field. (The legacy six-colour palette does vary it, which is
|
|
46
|
+
* why `ColorProps` still takes it per swatch.)
|
|
47
|
+
*/
|
|
48
|
+
var SWATCH_ICON_COLOR = exports.SWATCH_ICON_COLOR = "var(--ds-icon, #292A2E)";
|
|
49
|
+
|
|
50
|
+
/**
|
|
51
|
+
* Keys of `messages` usable as a swatch's accessible name. Kept as a union so
|
|
52
|
+
* `getColorLabelKey` returns something `messages` is guaranteed to have — the
|
|
53
|
+
* call site in `color.tsx` then needs no cast, and an unregistered colour cannot
|
|
54
|
+
* produce a missing key.
|
|
55
|
+
*/
|
|
56
|
+
|
|
57
|
+
/**
|
|
58
|
+
* Single source of truth for status colours: appearance, swatch tokens and i18n key.
|
|
59
|
+
* Typed as a total `Record`, so adding a value to NAMED_COLORS or HEX_PALETTE
|
|
60
|
+
* fails to compile until it is described here.
|
|
61
|
+
*
|
|
62
|
+
* Legacy named `yellow`/`green` have no swatch — they are not offered separately,
|
|
63
|
+
* because `accent-orange`/`accent-lime` are byte-identical to the Orange/Lime swatches
|
|
64
|
+
* in both themes. The distinct Yellow and Green swatches are the #FFF0B3 / #ABF5D1 hues.
|
|
65
|
+
*
|
|
66
|
+
* CSS cannot be derived from this: Compiled needs static literals and the styling lint
|
|
67
|
+
* rule rejects computed values. `statusStylesHexAccent` in editor-core mirrors it by hand.
|
|
68
|
+
*/
|
|
69
|
+
var COLORS = exports.COLORS = {
|
|
70
|
+
neutral: {
|
|
71
|
+
appearance: 'neutral',
|
|
72
|
+
labelKey: 'neutralColor',
|
|
73
|
+
swatch: {
|
|
74
|
+
backgroundColor: "var(--ds-background-neutral, #0515240F)",
|
|
75
|
+
borderColor: "var(--ds-border, #0B120E24)"
|
|
76
|
+
}
|
|
77
|
+
},
|
|
78
|
+
blue: {
|
|
79
|
+
appearance: 'accent-blue',
|
|
80
|
+
labelKey: 'blueColor',
|
|
81
|
+
swatch: {
|
|
82
|
+
backgroundColor: "var(--ds-background-accent-blue-subtler, #CFE1FD)",
|
|
83
|
+
borderColor: "var(--ds-border-accent-blue-subtle, #8FB8F6)"
|
|
84
|
+
}
|
|
85
|
+
},
|
|
86
|
+
'#B3F5FF': {
|
|
87
|
+
appearance: 'accent-teal',
|
|
88
|
+
labelKey: 'tealColor',
|
|
89
|
+
swatch: {
|
|
90
|
+
backgroundColor: "var(--ds-background-accent-teal-subtler, #C6EDFB)",
|
|
91
|
+
borderColor: "var(--ds-border-accent-teal-subtle, #9DD9EE)"
|
|
92
|
+
}
|
|
93
|
+
},
|
|
94
|
+
'#ABF5D1': {
|
|
95
|
+
appearance: 'accent-green',
|
|
96
|
+
labelKey: 'greenColor',
|
|
97
|
+
swatch: {
|
|
98
|
+
backgroundColor: "var(--ds-background-accent-green-subtler, #BAF3DB)",
|
|
99
|
+
borderColor: "var(--ds-border-accent-green-subtle, #7EE2B8)"
|
|
100
|
+
}
|
|
101
|
+
},
|
|
102
|
+
'#D3F1A7': {
|
|
103
|
+
appearance: 'accent-lime',
|
|
104
|
+
labelKey: 'limeColor',
|
|
105
|
+
swatch: {
|
|
106
|
+
backgroundColor: "var(--ds-background-accent-lime-subtler, #D3F1A7)",
|
|
107
|
+
borderColor: "var(--ds-border-accent-lime-subtle, #B3DF72)"
|
|
108
|
+
}
|
|
109
|
+
},
|
|
110
|
+
'#FFF0B3': {
|
|
111
|
+
appearance: 'accent-yellow',
|
|
112
|
+
labelKey: 'yellowColor',
|
|
113
|
+
swatch: {
|
|
114
|
+
backgroundColor: "var(--ds-background-accent-yellow-subtler, #F5E989)",
|
|
115
|
+
borderColor: "var(--ds-border-accent-yellow-subtle, #EED12B)"
|
|
116
|
+
}
|
|
117
|
+
},
|
|
118
|
+
'#FCE4A6': {
|
|
119
|
+
appearance: 'accent-orange',
|
|
120
|
+
labelKey: 'orangeColor',
|
|
121
|
+
swatch: {
|
|
122
|
+
backgroundColor: "var(--ds-background-accent-orange-subtler, #FCE4A6)",
|
|
123
|
+
borderColor: "var(--ds-border-accent-orange-subtle, #FBC828)"
|
|
124
|
+
}
|
|
125
|
+
},
|
|
126
|
+
red: {
|
|
127
|
+
appearance: 'accent-red',
|
|
128
|
+
labelKey: 'redColor',
|
|
129
|
+
swatch: {
|
|
130
|
+
backgroundColor: "var(--ds-background-accent-red-subtler, #FFD5D2)",
|
|
131
|
+
borderColor: "var(--ds-border-accent-red-subtle, #FD9891)"
|
|
132
|
+
}
|
|
133
|
+
},
|
|
134
|
+
'#FDD0EC': {
|
|
135
|
+
appearance: 'accent-magenta',
|
|
136
|
+
labelKey: 'magentaColor',
|
|
137
|
+
swatch: {
|
|
138
|
+
backgroundColor: "var(--ds-background-accent-magenta-subtler, #FDD0EC)",
|
|
139
|
+
borderColor: "var(--ds-border-accent-magenta-subtle, #F797D2)"
|
|
140
|
+
}
|
|
141
|
+
},
|
|
142
|
+
purple: {
|
|
143
|
+
appearance: 'accent-purple',
|
|
144
|
+
labelKey: 'purpleColor',
|
|
145
|
+
swatch: {
|
|
146
|
+
backgroundColor: "var(--ds-background-accent-purple-subtler, #EED7FC)",
|
|
147
|
+
borderColor: "var(--ds-border-accent-purple-subtle, #D8A0F7)"
|
|
148
|
+
}
|
|
149
|
+
},
|
|
150
|
+
yellow: {
|
|
151
|
+
appearance: 'accent-orange',
|
|
152
|
+
labelKey: 'yellowColor'
|
|
153
|
+
},
|
|
154
|
+
green: {
|
|
155
|
+
appearance: 'accent-lime',
|
|
156
|
+
labelKey: 'greenColor'
|
|
157
|
+
}
|
|
158
|
+
};
|
|
159
|
+
|
|
160
|
+
/** Swatch order in the ten-colour picker: two rows of five. */
|
|
161
|
+
var PICKER_SWATCHES = exports.PICKER_SWATCHES = ['neutral',
|
|
162
|
+
// Gray
|
|
163
|
+
'blue',
|
|
164
|
+
// Blue
|
|
165
|
+
'#B3F5FF',
|
|
166
|
+
// Teal
|
|
167
|
+
'#ABF5D1',
|
|
168
|
+
// Green
|
|
169
|
+
'#D3F1A7',
|
|
170
|
+
// Lime
|
|
171
|
+
'#FFF0B3',
|
|
172
|
+
// Yellow
|
|
173
|
+
'#FCE4A6',
|
|
174
|
+
// Orange
|
|
175
|
+
'red',
|
|
176
|
+
// Red
|
|
177
|
+
'#FDD0EC',
|
|
178
|
+
// Magenta
|
|
179
|
+
'purple' // Purple
|
|
180
|
+
];
|
|
181
|
+
var isNamedColor = exports.isNamedColor = function isNamedColor(color) {
|
|
182
|
+
return NAMED_COLORS.includes(color);
|
|
183
|
+
};
|
|
184
|
+
var normalizeColor = exports.normalizeColor = function normalizeColor(color) {
|
|
185
|
+
return color.startsWith('#') ? color.toUpperCase() : color;
|
|
186
|
+
};
|
|
187
|
+
var specFor = function specFor(color) {
|
|
188
|
+
return COLORS[normalizeColor(color)];
|
|
189
|
+
};
|
|
190
|
+
|
|
191
|
+
/**
|
|
192
|
+
* Falls back to the neutral label rather than building a key from the colour: an
|
|
193
|
+
* unregistered value would otherwise yield a key `messages` does not have, and
|
|
194
|
+
* spreading the resulting `undefined` into `FormattedMessage` throws.
|
|
195
|
+
*/
|
|
196
|
+
var getColorLabelKey = exports.getColorLabelKey = function getColorLabelKey(color) {
|
|
197
|
+
var _specFor$labelKey, _specFor;
|
|
198
|
+
return (_specFor$labelKey = (_specFor = specFor(color)) === null || _specFor === void 0 ? void 0 : _specFor.labelKey) !== null && _specFor$labelKey !== void 0 ? _specFor$labelKey : 'neutralColor';
|
|
199
|
+
};
|
|
200
|
+
var isSwatchSelected = exports.isSwatchSelected = function isSwatchSelected(swatchValue, selectedColor) {
|
|
201
|
+
var _specFor2, _specFor3;
|
|
202
|
+
if (!selectedColor) {
|
|
203
|
+
return false;
|
|
204
|
+
}
|
|
205
|
+
if (normalizeColor(swatchValue) === normalizeColor(selectedColor)) {
|
|
206
|
+
return true;
|
|
207
|
+
}
|
|
208
|
+
|
|
209
|
+
// A swatch also counts as selected when it renders the same hue under a different
|
|
210
|
+
// id — legacy named `green`/`yellow` share the Lime/Orange swatches. Unknown values
|
|
211
|
+
// have no spec, so they never collide on the neutral fallback.
|
|
212
|
+
var swatchAppearance = (_specFor2 = specFor(swatchValue)) === null || _specFor2 === void 0 ? void 0 : _specFor2.appearance;
|
|
213
|
+
return swatchAppearance !== undefined && swatchAppearance === ((_specFor3 = specFor(selectedColor)) === null || _specFor3 === void 0 ? void 0 : _specFor3.appearance);
|
|
214
|
+
};
|
|
215
|
+
var getLozengeAppearance = exports.getLozengeAppearance = function getLozengeAppearance(color) {
|
|
216
|
+
var isUpdateStatusColorsEnabled = (0, _unsafeExpValNoExposure.UNSAFE_expValNoExposure)('platform_editor_update_status_colors', 'isEnabled', false);
|
|
217
|
+
|
|
218
|
+
// Named colours are recoloured only by the experiment. `gracefully_render_status_color`
|
|
219
|
+
// is a read-path gate for hex written by another cohort, so it must never reach here.
|
|
220
|
+
if (isNamedColor(color)) {
|
|
221
|
+
return isUpdateStatusColorsEnabled ? COLORS[color].appearance : colorToLozengeAppearanceMap[color];
|
|
222
|
+
}
|
|
223
|
+
if (isUpdateStatusColorsEnabled || (0, _fg.fg)('platform_editor_gracefully_render_status_color')) {
|
|
224
|
+
var _specFor$appearance, _specFor4;
|
|
225
|
+
return (_specFor$appearance = (_specFor4 = specFor(color)) === null || _specFor4 === void 0 ? void 0 : _specFor4.appearance) !== null && _specFor$appearance !== void 0 ? _specFor$appearance : DEFAULT_LOZENGE_APPEARANCE;
|
|
226
|
+
}
|
|
227
|
+
return DEFAULT_LOZENGE_APPEARANCE;
|
|
228
|
+
};
|
|
@@ -8,15 +8,13 @@ import Lozenge from '@atlaskit/lozenge/lozenge';
|
|
|
8
8
|
import withAnalyticsEvents from '@atlaskit/analytics-next/withAnalyticsEvents';
|
|
9
9
|
import { createStatusAnalyticsAndFire } from './analytics';
|
|
10
10
|
import { ANALYTICS_HOVER_DELAY } from './constants';
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
};
|
|
19
|
-
const DEFAULT_APPEARANCE = 'neutral';
|
|
11
|
+
import { getLozengeAppearance, normalizeColor } from './status-colors';
|
|
12
|
+
|
|
13
|
+
/**
|
|
14
|
+
* What the ADF `color` attribute can hold. `HexColor` is the closed set we persist — do
|
|
15
|
+
* not substitute it here, or graceful rendering of unknown hex becomes a type error.
|
|
16
|
+
*/
|
|
17
|
+
|
|
20
18
|
const MAX_WIDTH = 200;
|
|
21
19
|
|
|
22
20
|
/**
|
|
@@ -88,7 +86,7 @@ class StatusInternal extends PureComponent {
|
|
|
88
86
|
if (text.trim().length === 0) {
|
|
89
87
|
return null;
|
|
90
88
|
}
|
|
91
|
-
const appearance =
|
|
89
|
+
const appearance = getLozengeAppearance(color);
|
|
92
90
|
// Note: ommitted data-local-id attribute to avoid copying/pasting the same localId
|
|
93
91
|
return /*#__PURE__*/React.createElement("span", {
|
|
94
92
|
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-classname-prop -- Ignored via go/DSP-18766
|
|
@@ -101,7 +99,7 @@ class StatusInternal extends PureComponent {
|
|
|
101
99
|
onBlur: this.handleBlur,
|
|
102
100
|
tabIndex: onClick ? -1 : undefined,
|
|
103
101
|
"data-node-type": "status",
|
|
104
|
-
"data-color": color,
|
|
102
|
+
"data-color": normalizeColor(color),
|
|
105
103
|
"data-style": style,
|
|
106
104
|
role: role
|
|
107
105
|
}, /*#__PURE__*/React.createElement(Lozenge, {
|
|
@@ -7,6 +7,13 @@ import React, { PureComponent } from 'react';
|
|
|
7
7
|
import { injectIntl } from 'react-intl';
|
|
8
8
|
import ColorPalette from './internal/color-palette';
|
|
9
9
|
import { messages } from './i18n';
|
|
10
|
+
|
|
11
|
+
/**
|
|
12
|
+
* Which set of selectable values the picker offers.
|
|
13
|
+
* - `default`: the six named colours.
|
|
14
|
+
* - `extended`: ten colours; hues without an existing name are persisted as hex.
|
|
15
|
+
*/
|
|
16
|
+
|
|
10
17
|
const fieldTextWrapperStyles = null;
|
|
11
18
|
|
|
12
19
|
// Keep the existing content position while reserving space inside the scrollport for focus rings.
|
|
@@ -49,13 +56,15 @@ class Picker extends PureComponent {
|
|
|
49
56
|
onColorClick,
|
|
50
57
|
onColorHover,
|
|
51
58
|
intl,
|
|
52
|
-
scrollableContent
|
|
59
|
+
scrollableContent,
|
|
60
|
+
palette
|
|
53
61
|
} = this.props;
|
|
54
62
|
const colorPalette = /*#__PURE__*/React.createElement(ColorPalette, {
|
|
55
63
|
key: this.colorPaletteKey,
|
|
56
64
|
onClick: onColorClick,
|
|
57
65
|
onHover: onColorHover,
|
|
58
|
-
selectedColor: selectedColor
|
|
66
|
+
selectedColor: selectedColor,
|
|
67
|
+
palette: palette
|
|
59
68
|
});
|
|
60
69
|
|
|
61
70
|
// Using <React.Fragment> instead of [] to workaround Enzyme
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
export const ELEMENTS_CHANNEL = 'fabric-elements';
|
|
2
2
|
const packageName = "@atlaskit/status";
|
|
3
|
-
const packageVersion = "5.
|
|
3
|
+
const packageVersion = "5.11.0";
|
|
4
4
|
export const createStatusAnalyticsAndFire = createAnalyticsEvent => payload => {
|
|
5
5
|
const statusPayload = {
|
|
6
6
|
...payload,
|
|
@@ -2,8 +2,8 @@ import { defineMessages } from 'react-intl';
|
|
|
2
2
|
export const messages = defineMessages({
|
|
3
3
|
neutralColor: {
|
|
4
4
|
id: 'fabric.status.color.grey',
|
|
5
|
-
defaultMessage: '
|
|
6
|
-
description: 'Tooltip for the
|
|
5
|
+
defaultMessage: 'Gray',
|
|
6
|
+
description: 'Tooltip for the gray color in color palette'
|
|
7
7
|
},
|
|
8
8
|
purpleColor: {
|
|
9
9
|
id: 'fabric.status.color.purple',
|
|
@@ -30,6 +30,26 @@ export const messages = defineMessages({
|
|
|
30
30
|
defaultMessage: 'Green',
|
|
31
31
|
description: 'Tooltip for the green color in color palette'
|
|
32
32
|
},
|
|
33
|
+
tealColor: {
|
|
34
|
+
id: 'fabric.status.color.teal',
|
|
35
|
+
defaultMessage: 'Teal',
|
|
36
|
+
description: 'Tooltip for the teal color in color palette'
|
|
37
|
+
},
|
|
38
|
+
limeColor: {
|
|
39
|
+
id: 'fabric.status.color.lime',
|
|
40
|
+
defaultMessage: 'Lime',
|
|
41
|
+
description: 'Tooltip for the lime color in color palette'
|
|
42
|
+
},
|
|
43
|
+
orangeColor: {
|
|
44
|
+
id: 'fabric.status.color.orange',
|
|
45
|
+
defaultMessage: 'Orange',
|
|
46
|
+
description: 'Tooltip for the orange color in color palette'
|
|
47
|
+
},
|
|
48
|
+
magentaColor: {
|
|
49
|
+
id: 'fabric.status.color.magenta',
|
|
50
|
+
defaultMessage: 'Magenta',
|
|
51
|
+
description: 'Tooltip for the magenta color in color palette'
|
|
52
|
+
},
|
|
33
53
|
statusInputLabel: {
|
|
34
54
|
id: 'fabric.status.input.label',
|
|
35
55
|
defaultMessage: 'Set a status',
|