@atlaskit/status 2.0.0 → 3.0.0

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.
Files changed (57) hide show
  1. package/CHANGELOG.md +8 -0
  2. package/afm-cc/tsconfig.json +3 -0
  3. package/afm-jira/tsconfig.json +3 -0
  4. package/afm-post-office/tsconfig.json +3 -0
  5. package/dist/cjs/components/analytics.js +1 -1
  6. package/dist/cjs/components/compiled/Status.compiled.css +3 -0
  7. package/dist/cjs/components/compiled/Status.js +132 -0
  8. package/dist/cjs/components/compiled/StatusPicker.compiled.css +5 -0
  9. package/dist/cjs/components/compiled/StatusPicker.js +120 -0
  10. package/dist/cjs/components/compiled/internal/color-palette.compiled.css +7 -0
  11. package/dist/cjs/components/compiled/internal/color-palette.js +106 -0
  12. package/dist/cjs/components/compiled/internal/color.compiled.css +27 -0
  13. package/dist/cjs/components/compiled/internal/color.js +122 -0
  14. package/dist/cjs/element.js +5 -7
  15. package/dist/cjs/index.js +7 -13
  16. package/dist/cjs/picker.js +5 -7
  17. package/dist/es2019/components/analytics.js +1 -1
  18. package/dist/es2019/components/compiled/Status.compiled.css +3 -0
  19. package/dist/es2019/components/compiled/Status.js +110 -0
  20. package/dist/es2019/components/compiled/StatusPicker.compiled.css +5 -0
  21. package/dist/es2019/components/compiled/StatusPicker.js +87 -0
  22. package/dist/es2019/components/compiled/internal/color-palette.compiled.css +7 -0
  23. package/dist/es2019/components/compiled/internal/color-palette.js +79 -0
  24. package/dist/es2019/components/compiled/internal/color.compiled.css +27 -0
  25. package/dist/es2019/components/compiled/internal/color.js +91 -0
  26. package/dist/es2019/element.js +5 -1
  27. package/dist/es2019/index.js +8 -2
  28. package/dist/es2019/picker.js +5 -1
  29. package/dist/esm/components/analytics.js +1 -1
  30. package/dist/esm/components/compiled/Status.compiled.css +3 -0
  31. package/dist/esm/components/compiled/Status.js +122 -0
  32. package/dist/esm/components/compiled/StatusPicker.compiled.css +5 -0
  33. package/dist/esm/components/compiled/StatusPicker.js +110 -0
  34. package/dist/esm/components/compiled/internal/color-palette.compiled.css +7 -0
  35. package/dist/esm/components/compiled/internal/color-palette.js +96 -0
  36. package/dist/esm/components/compiled/internal/color.compiled.css +27 -0
  37. package/dist/esm/components/compiled/internal/color.js +113 -0
  38. package/dist/esm/element.js +5 -1
  39. package/dist/esm/index.js +8 -2
  40. package/dist/esm/picker.js +5 -1
  41. package/dist/types/components/compiled/Status.d.ts +16 -0
  42. package/dist/types/components/compiled/StatusPicker.d.ts +16 -0
  43. package/dist/types/components/compiled/internal/color-palette.d.ts +11 -0
  44. package/dist/types/components/compiled/internal/color.d.ts +22 -0
  45. package/dist/types/element.d.ts +3 -1
  46. package/dist/types/index.d.ts +6 -2
  47. package/dist/types/picker.d.ts +5 -1
  48. package/dist/types-ts4.5/components/compiled/Status.d.ts +16 -0
  49. package/dist/types-ts4.5/components/compiled/StatusPicker.d.ts +16 -0
  50. package/dist/types-ts4.5/components/compiled/internal/color-palette.d.ts +11 -0
  51. package/dist/types-ts4.5/components/compiled/internal/color.d.ts +22 -0
  52. package/dist/types-ts4.5/element.d.ts +3 -1
  53. package/dist/types-ts4.5/index.d.ts +6 -2
  54. package/dist/types-ts4.5/picker.d.ts +5 -1
  55. package/element/package.json +3 -0
  56. package/package.json +13 -4
  57. package/picker/package.json +3 -0
@@ -1,6 +1,6 @@
1
1
  export const ELEMENTS_CHANNEL = 'fabric-elements';
2
2
  const packageName = "@atlaskit/status";
3
- const packageVersion = "2.0.0";
3
+ const packageVersion = "3.0.0";
4
4
  export const createStatusAnalyticsAndFire = createAnalyticsEvent => payload => {
5
5
  const statusPayload = {
6
6
  ...payload,
@@ -0,0 +1,3 @@
1
+ ._1frxnkob>*{vertical-align:middle}
2
+ ._1k0l7vkz>*{line-height:1pc}
3
+ ._d0dzdf4r>*{display:inline-block!important}
@@ -0,0 +1,110 @@
1
+ /* Status.tsx generated by @compiled/babel-plugin v0.36.1 */
2
+ import _defineProperty from "@babel/runtime/helpers/defineProperty";
3
+ import "./Status.compiled.css";
4
+ import * as React from 'react';
5
+ import { ax, ix } from "@compiled/react/runtime";
6
+ import { PureComponent } from 'react';
7
+ import Lozenge from '@atlaskit/lozenge/compiled';
8
+ import { withAnalyticsEvents } from '@atlaskit/analytics-next';
9
+ import { createStatusAnalyticsAndFire } from '../analytics';
10
+ import { ANALYTICS_HOVER_DELAY } from '../constants';
11
+ const colorToLozengeAppearanceMap = {
12
+ neutral: 'default',
13
+ purple: 'new',
14
+ blue: 'inprogress',
15
+ red: 'removed',
16
+ yellow: 'moved',
17
+ green: 'success'
18
+ };
19
+ const DEFAULT_APPEARANCE = 'default';
20
+ const MAX_WIDTH = 200;
21
+
22
+ /**
23
+ * This is to account for a bug in android chromium and should be removed
24
+ * when the editor fixes its focus handling with respect to Status.
25
+ *
26
+ * See DSP-7701 for additional context.
27
+ */
28
+ const inlineBlockStyles = null;
29
+
30
+ // eg. Version/4.0 Chrome/95.0.4638.50
31
+ const isAndroidChromium = typeof window !== 'undefined' && /Version\/.* Chrome\/.*/.test(window.navigator.userAgent);
32
+ class StatusInternal extends PureComponent {
33
+ constructor(...args) {
34
+ super(...args);
35
+ _defineProperty(this, "hoverStartTime", 0);
36
+ _defineProperty(this, "handleMouseEnter", _e => {
37
+ this.hoverStartTime = Date.now();
38
+ });
39
+ _defineProperty(this, "handleMouseLeave", _e => {
40
+ const {
41
+ onHover
42
+ } = this.props;
43
+ const delay = Date.now() - this.hoverStartTime;
44
+ if (delay >= ANALYTICS_HOVER_DELAY && onHover) {
45
+ onHover();
46
+ }
47
+ this.hoverStartTime = 0;
48
+ });
49
+ }
50
+ componentWillUnmount() {
51
+ this.hoverStartTime = 0;
52
+ }
53
+ render() {
54
+ const {
55
+ text,
56
+ color,
57
+ style,
58
+ role,
59
+ onClick,
60
+ isBold
61
+ } = this.props;
62
+ if (text.trim().length === 0) {
63
+ return null;
64
+ }
65
+ const appearance = colorToLozengeAppearanceMap[color] || DEFAULT_APPEARANCE;
66
+ // Note: ommitted data-local-id attribute to avoid copying/pasting the same localId
67
+ return /*#__PURE__*/React.createElement("span", {
68
+ // eslint-disable-next-line @atlaskit/ui-styling-standard/no-classname-prop -- Ignored via go/DSP-18766
69
+ className: ax([isAndroidChromium && "_d0dzdf4r _1k0l7vkz _1frxnkob", "status-lozenge-span"]),
70
+ onClick: onClick,
71
+ onMouseEnter: this.handleMouseEnter,
72
+ onMouseLeave: this.handleMouseLeave,
73
+ "data-node-type": "status",
74
+ "data-color": color,
75
+ "data-style": style,
76
+ role: role
77
+ }, /*#__PURE__*/React.createElement(Lozenge, {
78
+ appearance: appearance,
79
+ maxWidth: MAX_WIDTH,
80
+ isBold: isBold
81
+ }, text));
82
+ }
83
+ }
84
+ _defineProperty(StatusInternal, "displayName", 'StatusInternal');
85
+ export const Status = withAnalyticsEvents({
86
+ onClick: (createEvent, props) => {
87
+ const {
88
+ localId
89
+ } = props;
90
+ return createStatusAnalyticsAndFire(createEvent)({
91
+ action: 'clicked',
92
+ actionSubject: 'statusLozenge',
93
+ attributes: {
94
+ localId
95
+ }
96
+ });
97
+ },
98
+ onHover: (createEvent, props) => {
99
+ const {
100
+ localId
101
+ } = props;
102
+ return createStatusAnalyticsAndFire(createEvent)({
103
+ action: 'hovered',
104
+ actionSubject: 'statusLozenge',
105
+ attributes: {
106
+ localId
107
+ }
108
+ });
109
+ }
110
+ })(StatusInternal);
@@ -0,0 +1,5 @@
1
+
2
+ ._n634qx0o [data-ds--text-field--container]{border-color:var(--ds-border-bold,rgba(9,30,66,.42))}._18u0u2gc{margin-left:var(--ds-space-100,8px)}
3
+ ._19pkidpf{margin-top:0}
4
+ ._2hwxu2gc{margin-right:var(--ds-space-100,8px)}
5
+ ._otyridpf{margin-bottom:0}
@@ -0,0 +1,87 @@
1
+ /* StatusPicker.tsx generated by @compiled/babel-plugin v0.36.1 */
2
+ import _defineProperty from "@babel/runtime/helpers/defineProperty";
3
+ import "./StatusPicker.compiled.css";
4
+ import { ax, ix } from "@compiled/react/runtime";
5
+ import TextField from '@atlaskit/textfield';
6
+ import React, { PureComponent } from 'react';
7
+ import { injectIntl } from 'react-intl-next';
8
+ import ColorPalette from './internal/color-palette';
9
+ import { messages } from '../i18n';
10
+ import { N80A } from '@atlaskit/theme/colors';
11
+ const fieldTextWrapperStyles = null;
12
+ class Picker extends PureComponent {
13
+ constructor(...args) {
14
+ super(...args);
15
+ _defineProperty(this, "fieldTextWrapperKey", Math.random().toString());
16
+ _defineProperty(this, "colorPaletteKey", Math.random().toString());
17
+ _defineProperty(this, "onChange", evt => {
18
+ // @ts-ignore
19
+ this.props.onTextChanged(evt.target.value);
20
+ });
21
+ _defineProperty(this, "onKeyPress", event => {
22
+ if (event.key === 'Enter') {
23
+ this.props.onEnter();
24
+ }
25
+ });
26
+ _defineProperty(this, "handleInputRef", ref => {
27
+ this.inputRef = ref;
28
+ if (ref && this.props.autoFocus) {
29
+ this.focusInput();
30
+ }
31
+ });
32
+ _defineProperty(this, "focusInput", () => {
33
+ if (!this.inputRef) {
34
+ return;
35
+ }
36
+ // Defer to prevent editor scrolling to top
37
+ this.autofocusTimeout = setTimeout(() => {
38
+ var _this$inputRef;
39
+ (_this$inputRef = this.inputRef) === null || _this$inputRef === void 0 ? void 0 : _this$inputRef.focus();
40
+ });
41
+ });
42
+ }
43
+ render() {
44
+ const {
45
+ text,
46
+ selectedColor,
47
+ onColorClick,
48
+ onColorHover,
49
+ intl
50
+ } = this.props;
51
+
52
+ // Using <React.Fragment> instead of [] to workaround Enzyme
53
+ // (https://github.com/airbnb/enzyme/issues/1149)
54
+ return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement("div", {
55
+ key: this.fieldTextWrapperKey,
56
+ className: ax(["_19pkidpf _otyridpf _2hwxu2gc _18u0u2gc _n634qx0o"])
57
+ }, /*#__PURE__*/React.createElement(TextField, {
58
+ value: text,
59
+ isCompact: true,
60
+ ref: this.handleInputRef,
61
+ onChange: this.onChange,
62
+ onKeyPress: this.onKeyPress,
63
+ spellCheck: false,
64
+ autoComplete: "off",
65
+ "aria-label": intl.formatMessage(messages.statusInputLabel)
66
+ })), /*#__PURE__*/React.createElement(ColorPalette, {
67
+ key: this.colorPaletteKey,
68
+ onClick: onColorClick,
69
+ onHover: onColorHover,
70
+ selectedColor: selectedColor
71
+ }));
72
+ }
73
+ componentDidUpdate() {
74
+ if (this.inputRef && this.props.autoFocus) {
75
+ this.focusInput();
76
+ }
77
+ }
78
+ componentWillUnmount() {
79
+ if (this.autofocusTimeout !== undefined) {
80
+ clearTimeout(this.autofocusTimeout);
81
+ }
82
+ }
83
+ }
84
+ _defineProperty(Picker, "defaultProps", {
85
+ autoFocus: true
86
+ });
87
+ export const StatusPicker = injectIntl(Picker);
@@ -0,0 +1,7 @@
1
+ ._18u0u2gc{margin-left:var(--ds-space-100,8px)}
2
+ ._19bvidpf{padding-left:0}
3
+ ._19pku2gc{margin-top:var(--ds-space-100,8px)}
4
+ ._1e0c1txw{display:flex}
5
+ ._1n261g80{flex-wrap:wrap}
6
+ ._2hwxu2gc{margin-right:var(--ds-space-100,8px)}
7
+ ._otyridpf{margin-bottom:0}
@@ -0,0 +1,79 @@
1
+ /* color-palette.tsx generated by @compiled/babel-plugin v0.36.1 */
2
+ import "./color-palette.compiled.css";
3
+ import { ax, ix } from "@compiled/react/runtime";
4
+ import * as colors from '@atlaskit/theme/colors';
5
+ import React, { useEffect, useRef, useCallback, useState } from 'react';
6
+ import Color from './color';
7
+ import { fg } from '@atlaskit/platform-feature-flags';
8
+ const paletteLegacy = [['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})`]];
9
+ const paletteRefreshed = [['neutral', `var(--ds-background-accent-gray-subtler, ${colors.N300})`, `var(--ds-border-bold, ${colors.N400})`, `var(--ds-icon, ${colors.N400})`], ['blue', `var(--ds-background-information-pressed, ${colors.B300})`, `var(--ds-border-information, ${colors.B400})`, `var(--ds-icon, ${colors.N400})`], ['green', `var(--ds-background-success-pressed, ${colors.G300})`, `var(--ds-border-success, ${colors.G400})`, `var(--ds-icon, ${colors.N400})`], ['yellow', `var(--ds-background-warning-pressed, ${colors.Y300})`, `var(--ds-border-warning, ${colors.Y400})`, `var(--ds-icon, ${colors.N400})`], ['red', `var(--ds-background-danger-pressed, ${colors.R300})`, `var(--ds-border-danger, ${colors.R400})`, `var(--ds-icon, ${colors.R400})`], ['purple', `var(--ds-background-discovery-pressed, ${colors.P300})`, `var(--ds-border-discovery, ${colors.P400})`, `var(--ds-icon, ${colors.N400})`]];
10
+ const getPalette = () => fg('platform-component-visual-refresh') ? paletteRefreshed : paletteLegacy;
11
+ const palette = getPalette();
12
+
13
+ // eslint-disable-next-line @atlaskit/design-system/consistent-css-prop-usage, @atlaskit/design-system/no-css-tagged-template-expression -- Ignored via go/DSP-18766
14
+ const colorPaletteWrapperStyles = null;
15
+ const VK_LEFT = 37; //ArrowLeft
16
+ const VK_RIGHT = 39; //ArrowRight
17
+ const VK_UP = 38; //ArrowUp
18
+ const VK_DOWN = 40; //ArrowDown
19
+ const VK_TAB = 9;
20
+ export default (({
21
+ cols = 7,
22
+ onClick,
23
+ selectedColor,
24
+ className,
25
+ onHover
26
+ }) => {
27
+ const colorRefs = useRef([]);
28
+ const [currentFocusedColor, setCurrentFocusedColor] = useState(0);
29
+ useEffect(() => {
30
+ colorRefs.current = colorRefs.current.slice(0, palette.length);
31
+ }, []);
32
+ const memoizedHandleKeyDown = useCallback(e => {
33
+ let newColorIndex = null;
34
+ const nextColor = () => currentFocusedColor + 1 > palette.length - 1 ? 0 : currentFocusedColor + 1;
35
+ const previousColor = () => currentFocusedColor - 1 < 0 ? palette.length - 1 : currentFocusedColor - 1;
36
+ switch (e.keyCode) {
37
+ case VK_RIGHT:
38
+ case VK_DOWN:
39
+ e.preventDefault();
40
+ newColorIndex = nextColor();
41
+ break;
42
+ case VK_LEFT:
43
+ case VK_UP:
44
+ e.preventDefault();
45
+ newColorIndex = previousColor();
46
+ break;
47
+ case VK_TAB:
48
+ setCurrentFocusedColor(0);
49
+ break;
50
+ }
51
+ if (newColorIndex === null) {
52
+ return;
53
+ }
54
+ setCurrentFocusedColor(newColorIndex);
55
+ const newRef = colorRefs.current[newColorIndex];
56
+ newRef === null || newRef === void 0 ? void 0 : newRef.focus();
57
+ }, [currentFocusedColor, setCurrentFocusedColor, colorRefs]);
58
+ return /*#__PURE__*/React.createElement("ul", {
59
+ // eslint-disable-next-line @atlaskit/ui-styling-standard/no-classname-prop -- Ignored via go/DSP-18766
60
+ className: ax(["_19bvidpf _19pku2gc _2hwxu2gc _otyridpf _18u0u2gc _1e0c1txw _1n261g80", className]),
61
+ style: {
62
+ maxWidth: cols * 32
63
+ },
64
+ onKeyDown: memoizedHandleKeyDown
65
+ }, palette.map(([colorValue, backgroundColor, borderColor, iconColor], i) => {
66
+ return /*#__PURE__*/React.createElement(Color, {
67
+ key: colorValue,
68
+ value: colorValue,
69
+ backgroundColor: backgroundColor,
70
+ borderColor: borderColor,
71
+ iconColor: iconColor,
72
+ onClick: onClick,
73
+ onHover: onHover,
74
+ isSelected: colorValue === selectedColor,
75
+ tabIndex: i === 0 ? 0 : -1,
76
+ setRef: el => colorRefs.current[i] = el
77
+ });
78
+ }));
79
+ });
@@ -0,0 +1,27 @@
1
+
2
+ ._19it7r9e{border:var(--ds-border-width,1px) solid var(--ds-border,#091e4224)}
3
+ ._2rko12x7{border-radius:var(--ds-space-075,6px)}
4
+ ._2rkoglpi{border-radius:var(--ds-border-radius,4px)}._189et94y{border-width:1px}
5
+ ._1dqonqa1{border-style:solid}
6
+ ._1h6d1j28{border-color:transparent}
7
+ ._18m915vq{overflow-y:hidden}
8
+ ._18u0v77o{margin-left:var(--ds-space-025,2px)}
9
+ ._19bvt94y{padding-left:1px}
10
+ ._19bvze3t{padding-left:var(--ds-space-0,0)}
11
+ ._19pkidpf{margin-top:0}
12
+ ._1bsb1tcg{width:24px}
13
+ ._1e0c1txw{display:flex}
14
+ ._1e0c1ule{display:block}
15
+ ._1reo15vq{overflow-x:hidden}
16
+ ._2hwxv77o{margin-right:var(--ds-space-025,2px)}
17
+ ._4cvr1h6o{align-items:center}
18
+ ._4t3i1tcg{height:24px}
19
+ ._bfhkm7j4{background-color:var(--ds-background-neutral,#091e420f)}
20
+ ._ca0qt94y{padding-top:1px}
21
+ ._ca0qze3t{padding-top:var(--ds-space-0,0)}
22
+ ._n3tdt94y{padding-bottom:1px}
23
+ ._n3tdze3t{padding-bottom:var(--ds-space-0,0)}
24
+ ._otyridpf{margin-bottom:0}
25
+ ._u5f3t94y{padding-right:1px}
26
+ ._u5f3ze3t{padding-right:var(--ds-space-0,0)}
27
+ ._bfw717nx:hover{border:1px solid var(--ds-border,#c1c7d0)}
@@ -0,0 +1,91 @@
1
+ /* color.tsx generated by @compiled/babel-plugin v0.36.1 */
2
+ import _defineProperty from "@babel/runtime/helpers/defineProperty";
3
+ import "./color.compiled.css";
4
+ import * as React from 'react';
5
+ import { ax, ix } from "@compiled/react/runtime";
6
+ import EditorDoneIcon from '@atlaskit/icon/core/migration/check-mark--editor-done';
7
+ import { N50 } from '@atlaskit/theme/colors';
8
+ import { Pressable } from '@atlaskit/primitives/compiled';
9
+ import { PureComponent } from 'react';
10
+ import { FormattedMessage } from 'react-intl-next';
11
+ import { ANALYTICS_HOVER_DELAY } from '../../constants';
12
+ import { messages } from '../../i18n';
13
+ const styles = {
14
+ button: "_2rkoglpi _19it7r9e _1reo15vq _18m915vq _4t3i1tcg _1bsb1tcg _bfhkm7j4 _ca0qze3t _u5f3ze3t _n3tdze3t _19bvze3t _1e0c1ule"
15
+ };
16
+
17
+ // We have tried with changing border and padding from 1px to token near version 2px,
18
+ // the pop - up is being expanded to two lines.
19
+ const buttonWrapperStyles = null;
20
+ export default class Color extends PureComponent {
21
+ constructor(...args) {
22
+ super(...args);
23
+ _defineProperty(this, "hoverStartTime", 0);
24
+ _defineProperty(this, "onMouseEnter", () => {
25
+ this.hoverStartTime = Date.now();
26
+ });
27
+ _defineProperty(this, "onMouseLeave", () => {
28
+ const {
29
+ onHover
30
+ } = this.props;
31
+ const delay = Date.now() - this.hoverStartTime;
32
+ if (delay >= ANALYTICS_HOVER_DELAY && onHover) {
33
+ onHover(this.props.value);
34
+ }
35
+ this.hoverStartTime = 0;
36
+ });
37
+ _defineProperty(this, "onMouseDown", e => {
38
+ e.preventDefault();
39
+ });
40
+ _defineProperty(this, "onClick", e => {
41
+ const {
42
+ onClick,
43
+ value
44
+ } = this.props;
45
+ e.preventDefault();
46
+ onClick(value);
47
+ });
48
+ }
49
+ render() {
50
+ const {
51
+ tabIndex,
52
+ backgroundColor,
53
+ isSelected,
54
+ borderColor,
55
+ iconColor,
56
+ value,
57
+ setRef
58
+ } = this.props;
59
+ return /*#__PURE__*/React.createElement("li", {
60
+ className: ax(["_ca0qt94y _u5f3t94y _n3tdt94y _19bvt94y _2rko12x7 _189et94y _1dqonqa1 _1h6d1j28 _19pkidpf _2hwxv77o _otyridpf _18u0v77o _1e0c1txw _4cvr1h6o _bfw717nx"])
61
+ }, /*#__PURE__*/React.createElement(FormattedMessage, messages[`${value}Color`], labels => /*#__PURE__*/React.createElement(Pressable, {
62
+ xcss: styles.button,
63
+ onClick: this.onClick,
64
+ onMouseEnter: this.onMouseEnter,
65
+ onMouseLeave: this.onMouseLeave,
66
+ onMouseDown: this.onMouseDown,
67
+ tabIndex: tabIndex,
68
+ title: labels[0]
69
+ // button element does not support aria-selected.
70
+ // For button selected (to be precise pressed) or not
71
+ // use aria-pressed as per
72
+ // https://developer.mozilla.org/en-US/docs/Web/Accessibility/ARIA/Roles/button_role#associated_aria_roles_states_and_properties
73
+ ,
74
+ "aria-pressed": isSelected,
75
+ style: {
76
+ backgroundColor: backgroundColor || 'transparent',
77
+ // eslint-disable-next-line @atlaskit/ui-styling-standard/enforce-style-prop
78
+ color: iconColor,
79
+ // eslint-disable-next-line @atlaskit/ui-styling-standard/enforce-style-prop -- Ignored via go/DSP-18766
80
+ borderColor
81
+ },
82
+ ref: setRef
83
+ }, isSelected && /*#__PURE__*/React.createElement(EditorDoneIcon, {
84
+ color: "currentColor",
85
+ label: labels[0]
86
+ }))));
87
+ }
88
+ componentWillUnmount() {
89
+ this.hoverStartTime = 0;
90
+ }
91
+ }
@@ -1 +1,5 @@
1
- export { Status } from './components/Status';
1
+ import { componentWithFG } from '@atlaskit/platform-feature-flags-react';
2
+ import { Status as EmotionStatus } from './components/Status';
3
+ import { Status as CompiledStatus } from './components/compiled/Status';
4
+ const Status = componentWithFG('platform_editor_css_migrate_stage_1', CompiledStatus, EmotionStatus);
5
+ export { Status };
@@ -1,2 +1,8 @@
1
- export { Status } from './components/Status';
2
- export { StatusPicker } from './components/StatusPicker';
1
+ import { componentWithFG } from '@atlaskit/platform-feature-flags-react';
2
+ import { Status as EmotionStatus } from './components/Status';
3
+ import { Status as CompiledStatus } from './components/compiled/Status';
4
+ import { StatusPicker as EmotionStatusPicker } from './components/StatusPicker';
5
+ import { StatusPicker as CompiledStatusPicker } from './components/compiled/StatusPicker';
6
+ const Status = componentWithFG('platform_editor_css_migrate_stage_1', CompiledStatus, EmotionStatus);
7
+ const StatusPicker = componentWithFG('platform_editor_css_migrate_stage_1', CompiledStatusPicker, EmotionStatusPicker);
8
+ export { Status, StatusPicker };
@@ -1 +1,5 @@
1
- export { StatusPicker } from './components/StatusPicker';
1
+ import { componentWithFG } from '@atlaskit/platform-feature-flags-react';
2
+ import { StatusPicker as EmotionStatusPicker } from './components/StatusPicker';
3
+ import { StatusPicker as CompiledStatusPicker } from './components/compiled/StatusPicker';
4
+ const StatusPicker = componentWithFG('platform_editor_css_migrate_stage_1', CompiledStatusPicker, EmotionStatusPicker);
5
+ export { StatusPicker };
@@ -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 = "2.0.0";
6
+ var packageVersion = "3.0.0";
7
7
  export var createStatusAnalyticsAndFire = function createStatusAnalyticsAndFire(createAnalyticsEvent) {
8
8
  return function (payload) {
9
9
  var statusPayload = _objectSpread(_objectSpread({}, payload), {}, {
@@ -0,0 +1,3 @@
1
+ ._1frxnkob>*{vertical-align:middle}
2
+ ._1k0l7vkz>*{line-height:1pc}
3
+ ._d0dzdf4r>*{display:inline-block!important}
@@ -0,0 +1,122 @@
1
+ /* Status.tsx generated by @compiled/babel-plugin v0.36.1 */
2
+ import _classCallCheck from "@babel/runtime/helpers/classCallCheck";
3
+ import _createClass from "@babel/runtime/helpers/createClass";
4
+ import _possibleConstructorReturn from "@babel/runtime/helpers/possibleConstructorReturn";
5
+ import _getPrototypeOf from "@babel/runtime/helpers/getPrototypeOf";
6
+ import _inherits from "@babel/runtime/helpers/inherits";
7
+ import _defineProperty from "@babel/runtime/helpers/defineProperty";
8
+ import "./Status.compiled.css";
9
+ import * as React from 'react';
10
+ import { ax, ix } from "@compiled/react/runtime";
11
+ function _callSuper(t, o, e) { return o = _getPrototypeOf(o), _possibleConstructorReturn(t, _isNativeReflectConstruct() ? Reflect.construct(o, e || [], _getPrototypeOf(t).constructor) : o.apply(t, e)); }
12
+ function _isNativeReflectConstruct() { try { var t = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); } catch (t) {} return (_isNativeReflectConstruct = function _isNativeReflectConstruct() { return !!t; })(); }
13
+ import { PureComponent } from 'react';
14
+ import Lozenge from '@atlaskit/lozenge/compiled';
15
+ import { withAnalyticsEvents } from '@atlaskit/analytics-next';
16
+ import { createStatusAnalyticsAndFire } from '../analytics';
17
+ import { ANALYTICS_HOVER_DELAY } from '../constants';
18
+ var colorToLozengeAppearanceMap = {
19
+ neutral: 'default',
20
+ purple: 'new',
21
+ blue: 'inprogress',
22
+ red: 'removed',
23
+ yellow: 'moved',
24
+ green: 'success'
25
+ };
26
+ var DEFAULT_APPEARANCE = 'default';
27
+ var MAX_WIDTH = 200;
28
+
29
+ /**
30
+ * This is to account for a bug in android chromium and should be removed
31
+ * when the editor fixes its focus handling with respect to Status.
32
+ *
33
+ * See DSP-7701 for additional context.
34
+ */
35
+ var inlineBlockStyles = null;
36
+
37
+ // eg. Version/4.0 Chrome/95.0.4638.50
38
+ var isAndroidChromium = typeof window !== 'undefined' && /Version\/.* Chrome\/.*/.test(window.navigator.userAgent);
39
+ var StatusInternal = /*#__PURE__*/function (_PureComponent) {
40
+ function StatusInternal() {
41
+ var _this;
42
+ _classCallCheck(this, StatusInternal);
43
+ for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
44
+ args[_key] = arguments[_key];
45
+ }
46
+ _this = _callSuper(this, StatusInternal, [].concat(args));
47
+ _defineProperty(_this, "hoverStartTime", 0);
48
+ _defineProperty(_this, "handleMouseEnter", function (_e) {
49
+ _this.hoverStartTime = Date.now();
50
+ });
51
+ _defineProperty(_this, "handleMouseLeave", function (_e) {
52
+ var onHover = _this.props.onHover;
53
+ var delay = Date.now() - _this.hoverStartTime;
54
+ if (delay >= ANALYTICS_HOVER_DELAY && onHover) {
55
+ onHover();
56
+ }
57
+ _this.hoverStartTime = 0;
58
+ });
59
+ return _this;
60
+ }
61
+ _inherits(StatusInternal, _PureComponent);
62
+ return _createClass(StatusInternal, [{
63
+ key: "componentWillUnmount",
64
+ value: function componentWillUnmount() {
65
+ this.hoverStartTime = 0;
66
+ }
67
+ }, {
68
+ key: "render",
69
+ value: function render() {
70
+ var _this$props = this.props,
71
+ text = _this$props.text,
72
+ color = _this$props.color,
73
+ style = _this$props.style,
74
+ role = _this$props.role,
75
+ onClick = _this$props.onClick,
76
+ isBold = _this$props.isBold;
77
+ if (text.trim().length === 0) {
78
+ return null;
79
+ }
80
+ var appearance = colorToLozengeAppearanceMap[color] || DEFAULT_APPEARANCE;
81
+ // Note: ommitted data-local-id attribute to avoid copying/pasting the same localId
82
+ return /*#__PURE__*/React.createElement("span", {
83
+ // eslint-disable-next-line @atlaskit/ui-styling-standard/no-classname-prop -- Ignored via go/DSP-18766
84
+ className: ax([isAndroidChromium && "_d0dzdf4r _1k0l7vkz _1frxnkob", "status-lozenge-span"]),
85
+ onClick: onClick,
86
+ onMouseEnter: this.handleMouseEnter,
87
+ onMouseLeave: this.handleMouseLeave,
88
+ "data-node-type": "status",
89
+ "data-color": color,
90
+ "data-style": style,
91
+ role: role
92
+ }, /*#__PURE__*/React.createElement(Lozenge, {
93
+ appearance: appearance,
94
+ maxWidth: MAX_WIDTH,
95
+ isBold: isBold
96
+ }, text));
97
+ }
98
+ }]);
99
+ }(PureComponent);
100
+ _defineProperty(StatusInternal, "displayName", 'StatusInternal');
101
+ export var Status = withAnalyticsEvents({
102
+ onClick: function onClick(createEvent, props) {
103
+ var localId = props.localId;
104
+ return createStatusAnalyticsAndFire(createEvent)({
105
+ action: 'clicked',
106
+ actionSubject: 'statusLozenge',
107
+ attributes: {
108
+ localId: localId
109
+ }
110
+ });
111
+ },
112
+ onHover: function onHover(createEvent, props) {
113
+ var localId = props.localId;
114
+ return createStatusAnalyticsAndFire(createEvent)({
115
+ action: 'hovered',
116
+ actionSubject: 'statusLozenge',
117
+ attributes: {
118
+ localId: localId
119
+ }
120
+ });
121
+ }
122
+ })(StatusInternal);
@@ -0,0 +1,5 @@
1
+
2
+ ._n6346qow [data-ds--text-field--container]{border-color:var(--_wxcsqj)}._18u0u2gc{margin-left:var(--ds-space-100,8px)}
3
+ ._19pkidpf{margin-top:0}
4
+ ._2hwxu2gc{margin-right:var(--ds-space-100,8px)}
5
+ ._otyridpf{margin-bottom:0}