@atlaskit/color-picker 3.2.14 → 3.2.16
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 +17 -0
- package/codemods/1.0.0-popper-props.ts +75 -88
- package/codemods/__tests__/1.0.0-popper-props.ts +51 -51
- package/codemods/utils/helpers.ts +250 -261
- package/dist/cjs/components/ColorCard.js +19 -17
- package/dist/cjs/components/ColorPaletteMenu.js +9 -4
- package/dist/cjs/components/ColorPicker.js +3 -5
- package/dist/cjs/components/Trigger.js +8 -14
- package/dist/cjs/components/components.js +1 -0
- package/dist/cjs/messages.js +5 -0
- package/dist/cjs/utils.js +1 -2
- package/dist/es2019/components/ColorCard.js +20 -17
- package/dist/es2019/components/ColorPaletteMenu.js +9 -4
- package/dist/es2019/components/ColorPicker.js +3 -5
- package/dist/es2019/components/Trigger.js +8 -14
- package/dist/es2019/components/components.js +1 -0
- package/dist/es2019/messages.js +5 -0
- package/dist/es2019/utils.js +1 -2
- package/dist/esm/components/ColorCard.js +19 -17
- package/dist/esm/components/ColorPaletteMenu.js +9 -4
- package/dist/esm/components/ColorPicker.js +3 -5
- package/dist/esm/components/Trigger.js +8 -14
- package/dist/esm/components/components.js +1 -0
- package/dist/esm/messages.js +5 -0
- package/dist/esm/utils.js +1 -2
- package/dist/types/messages.d.ts +5 -0
- package/dist/types-ts4.5/messages.d.ts +5 -0
- package/docs/0-intro.tsx +35 -34
- package/package.json +5 -8
- package/report.api.md +103 -107
|
@@ -34,7 +34,7 @@ var ColorPaletteMenuWithoutAnalytics = exports.ColorPaletteMenuWithoutAnalytics
|
|
|
34
34
|
attributes: {
|
|
35
35
|
componentName: 'color-picker',
|
|
36
36
|
packageName: "@atlaskit/color-picker",
|
|
37
|
-
packageVersion: "3.2.
|
|
37
|
+
packageVersion: "3.2.16"
|
|
38
38
|
}
|
|
39
39
|
})(createAnalyticsEvent);
|
|
40
40
|
}
|
|
@@ -49,13 +49,18 @@ var ColorPaletteMenuWithoutAnalytics = exports.ColorPaletteMenuWithoutAnalytics
|
|
|
49
49
|
var fullLabel = "".concat(label, ", ").concat(selectedValue.label, " selected");
|
|
50
50
|
return (0, _react.jsx)("div", {
|
|
51
51
|
"aria-label": fullLabel,
|
|
52
|
-
role: "radiogroup"
|
|
52
|
+
role: "radiogroup"
|
|
53
|
+
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-imported-style-values -- Ignored via go/DSP-18766
|
|
54
|
+
,
|
|
53
55
|
css: [colorPaletteMenuStyles, mode === _types.Mode.Standard && colorPaletteMenuStandardStyles],
|
|
54
56
|
style: {
|
|
57
|
+
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-imported-style-values -- Ignored via go/DSP-18766
|
|
55
58
|
width: "".concat((0, _utils.getWidth)(cols, mode), "px")
|
|
56
59
|
}
|
|
57
60
|
}, (0, _react.jsx)("div", {
|
|
58
|
-
css: [colorPaletteContainerStyles,
|
|
61
|
+
css: [colorPaletteContainerStyles,
|
|
62
|
+
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-imported-style-values -- Ignored via go/DSP-18766
|
|
63
|
+
mode === _types.Mode.Compact && colorPaletteContainerCompactStyles]
|
|
59
64
|
}, options.map(function (_ref2) {
|
|
60
65
|
var label = _ref2.label,
|
|
61
66
|
value = _ref2.value;
|
|
@@ -76,7 +81,7 @@ var ColorPaletteMenuWithoutAnalytics = exports.ColorPaletteMenuWithoutAnalytics
|
|
|
76
81
|
var _default = exports.default = (0, _analyticsNext.withAnalyticsContext)({
|
|
77
82
|
componentName: 'color-picker',
|
|
78
83
|
packageName: "@atlaskit/color-picker",
|
|
79
|
-
packageVersion: "3.2.
|
|
84
|
+
packageVersion: "3.2.16"
|
|
80
85
|
})((0, _analyticsNext.withAnalyticsEvents)()(ColorPaletteMenuWithoutAnalytics));
|
|
81
86
|
var colorCardWrapperStyles = (0, _react.css)({
|
|
82
87
|
display: 'flex',
|
|
@@ -22,7 +22,6 @@ var _constants = require("../constants");
|
|
|
22
22
|
var _analyticsNext = require("@atlaskit/analytics-next");
|
|
23
23
|
var _utils = require("../utils");
|
|
24
24
|
var _react2 = require("@emotion/react");
|
|
25
|
-
var _platformFeatureFlags = require("@atlaskit/platform-feature-flags");
|
|
26
25
|
var _reactIntlNext = require("react-intl-next");
|
|
27
26
|
var _messages = _interopRequireDefault(require("../messages"));
|
|
28
27
|
function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(e) { return e ? t : r; })(e); }
|
|
@@ -40,7 +39,7 @@ var defaultPopperProps = {
|
|
|
40
39
|
placement: 'bottom-start'
|
|
41
40
|
};
|
|
42
41
|
var packageName = "@atlaskit/color-picker";
|
|
43
|
-
var packageVersion = "3.2.
|
|
42
|
+
var packageVersion = "3.2.16";
|
|
44
43
|
var ColorPickerWithoutAnalyticsBase = /*#__PURE__*/function (_React$Component) {
|
|
45
44
|
(0, _inherits2.default)(ColorPickerWithoutAnalyticsBase, _React$Component);
|
|
46
45
|
var _super = _createSuper(ColorPickerWithoutAnalyticsBase);
|
|
@@ -86,7 +85,7 @@ var ColorPickerWithoutAnalyticsBase = /*#__PURE__*/function (_React$Component) {
|
|
|
86
85
|
_this.setState({
|
|
87
86
|
isTabbing: false
|
|
88
87
|
});
|
|
89
|
-
} else if (
|
|
88
|
+
} else if (key === 'Escape') {
|
|
90
89
|
e.stopPropagation();
|
|
91
90
|
}
|
|
92
91
|
});
|
|
@@ -132,8 +131,7 @@ var ColorPickerWithoutAnalyticsBase = /*#__PURE__*/function (_React$Component) {
|
|
|
132
131
|
ref: ref
|
|
133
132
|
}, (0, _react2.jsx)(_Trigger.default, (0, _extends2.default)({}, value, {
|
|
134
133
|
label: fullLabel,
|
|
135
|
-
expanded: isOpen
|
|
136
|
-
}, (0, _platformFeatureFlags.getBooleanFF)('platform.color-picker-radio-button-functionality_6hkcy') && {
|
|
134
|
+
expanded: isOpen,
|
|
137
135
|
swatchSize: selectedColourSwatchSize,
|
|
138
136
|
isDisabled: isDisabledSelectedSwatch
|
|
139
137
|
})));
|
|
@@ -5,12 +5,10 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
5
5
|
value: true
|
|
6
6
|
});
|
|
7
7
|
exports.default = void 0;
|
|
8
|
-
var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
|
|
9
8
|
var _react = require("react");
|
|
10
9
|
var _tooltip = _interopRequireDefault(require("@atlaskit/tooltip"));
|
|
11
10
|
var _react2 = require("@emotion/react");
|
|
12
11
|
var _colors = require("@atlaskit/theme/colors");
|
|
13
|
-
var _platformFeatureFlags = require("@atlaskit/platform-feature-flags");
|
|
14
12
|
/** @jsx jsx */
|
|
15
13
|
|
|
16
14
|
var ColorCard = function ColorCard(_ref) {
|
|
@@ -33,29 +31,23 @@ var ColorCard = function ColorCard(_ref) {
|
|
|
33
31
|
}, [onClick]);
|
|
34
32
|
return (0, _react2.jsx)(_tooltip.default, {
|
|
35
33
|
content: label
|
|
36
|
-
}, (0, _react2.jsx)("button",
|
|
34
|
+
}, (0, _react2.jsx)("button", {
|
|
37
35
|
css: [sharedColorContainerStyles, swatchSize === 'small' ? smallColorContainerSize : defaultColorContainerSize, colorCardButtonStyles, expanded && colorCardButtonFocusedStyles],
|
|
38
|
-
disabled: isDisabled
|
|
39
|
-
} : {
|
|
40
|
-
css: [sharedColorContainerStyles, defaultColorContainerSize, colorCardButtonStyles, expanded && colorCardButtonFocusedStyles]
|
|
41
|
-
}, {
|
|
36
|
+
disabled: isDisabled,
|
|
42
37
|
onClick: handleClick,
|
|
43
38
|
onMouseDown: handleMouseDown,
|
|
44
39
|
"aria-label": label,
|
|
45
40
|
"aria-expanded": expanded,
|
|
46
41
|
"aria-haspopup": true,
|
|
47
42
|
type: "button"
|
|
48
|
-
}
|
|
43
|
+
}, (0, _react2.jsx)("span", {
|
|
49
44
|
css: colorCardWrapperStyles
|
|
50
|
-
}, (0, _react2.jsx)("span",
|
|
51
|
-
css: [colorCardContentStyles, swatchSize === 'small' ? smallColorCardContentSize : defaultColorCardContentSize]
|
|
52
|
-
} : {
|
|
53
|
-
css: [colorCardContentStyles, defaultColorCardContentSize]
|
|
54
|
-
}, {
|
|
45
|
+
}, (0, _react2.jsx)("span", {
|
|
46
|
+
css: [colorCardContentStyles, swatchSize === 'small' ? smallColorCardContentSize : defaultColorCardContentSize],
|
|
55
47
|
style: {
|
|
56
48
|
background: value || 'transparent'
|
|
57
49
|
}
|
|
58
|
-
}))))
|
|
50
|
+
}))));
|
|
59
51
|
};
|
|
60
52
|
var _default = exports.default = ColorCard;
|
|
61
53
|
var sharedColorContainerStyles = (0, _react2.css)({
|
|
@@ -81,9 +73,11 @@ var defaultColorContainerSize = (0, _react2.css)({
|
|
|
81
73
|
height: "var(--ds-space-400, 32px)"
|
|
82
74
|
});
|
|
83
75
|
var colorCardButtonStyles = (0, _react2.css)({
|
|
76
|
+
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-unsafe-selectors -- Ignored via go/DSP-18766
|
|
84
77
|
':hover': {
|
|
85
78
|
borderColor: "var(--ds-background-neutral-subtle, ".concat(_colors.N0, ")")
|
|
86
79
|
},
|
|
80
|
+
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-unsafe-selectors -- Ignored via go/DSP-18766
|
|
87
81
|
':not(:focus):hover, :focus': {
|
|
88
82
|
borderColor: "var(--ds-border-focused, ".concat(_colors.B100, ")"),
|
|
89
83
|
outline: 'none'
|
|
@@ -19,6 +19,7 @@ var MenuList = exports.MenuList = function MenuList(props) {
|
|
|
19
19
|
css: colorPaletteContainerStyles,
|
|
20
20
|
role: "radiogroup",
|
|
21
21
|
style: {
|
|
22
|
+
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-imported-style-values -- Ignored via go/DSP-18766
|
|
22
23
|
maxWidth: cols ? (0, _utils.getWidth)(cols) : undefined
|
|
23
24
|
},
|
|
24
25
|
ref: innerRef
|
package/dist/cjs/messages.js
CHANGED
|
@@ -10,5 +10,10 @@ var _default = exports.default = (0, _reactIntlNext.defineMessages)({
|
|
|
10
10
|
id: 'jira.color-picker.src.color-picker-aria-label',
|
|
11
11
|
defaultMessage: '{color} selected, {message}',
|
|
12
12
|
description: 'This text is used as aria-label text in color picker component'
|
|
13
|
+
},
|
|
14
|
+
colorCardRadioItemLabel: {
|
|
15
|
+
id: 'jira.color-picker.src.color-card-radio-item-label',
|
|
16
|
+
defaultMessage: 'color option',
|
|
17
|
+
description: 'This text is used as aria-label text in color card component for radio item'
|
|
13
18
|
}
|
|
14
19
|
});
|
package/dist/cjs/utils.js
CHANGED
|
@@ -9,7 +9,6 @@ var _theme = require("@atlaskit/theme");
|
|
|
9
9
|
var _constants = require("./constants");
|
|
10
10
|
var _memoizeOne = _interopRequireDefault(require("memoize-one"));
|
|
11
11
|
var _types = require("./types");
|
|
12
|
-
var _platformFeatureFlags = require("@atlaskit/platform-feature-flags");
|
|
13
12
|
// AFP-2532 TODO: Fix automatic suppressions below
|
|
14
13
|
// eslint-disable-next-line @atlassian/tangerine/import/entry-points
|
|
15
14
|
|
|
@@ -20,7 +19,7 @@ var getWidth = exports.getWidth = function getWidth(cols, mode) {
|
|
|
20
19
|
var getOptions = exports.getOptions = (0, _memoizeOne.default)(function (palette, selectedColor, showDefaultSwatchColor) {
|
|
21
20
|
var focusedItemIndex = 0;
|
|
22
21
|
var defaultSelectedColor = palette[0];
|
|
23
|
-
if (
|
|
22
|
+
if (!showDefaultSwatchColor) {
|
|
24
23
|
defaultSelectedColor = {
|
|
25
24
|
label: '',
|
|
26
25
|
value: ''
|
|
@@ -5,8 +5,10 @@ import EditorDoneIcon from '@atlaskit/icon/glyph/editor/done';
|
|
|
5
5
|
import Tooltip from '@atlaskit/tooltip';
|
|
6
6
|
import { KEY_ENTER, KEY_SPACE } from '../constants';
|
|
7
7
|
import { css, jsx } from '@emotion/react';
|
|
8
|
+
import { useIntl } from 'react-intl-next';
|
|
8
9
|
import { N0, DN600A, B75 } from '@atlaskit/theme/colors';
|
|
9
10
|
import { getBooleanFF } from '@atlaskit/platform-feature-flags';
|
|
11
|
+
import messages from '../messages';
|
|
10
12
|
const ColorCard = props => {
|
|
11
13
|
const {
|
|
12
14
|
value,
|
|
@@ -19,6 +21,9 @@ const ColorCard = props => {
|
|
|
19
21
|
onKeyDown
|
|
20
22
|
} = props;
|
|
21
23
|
const ref = useRef(null);
|
|
24
|
+
const {
|
|
25
|
+
formatMessage
|
|
26
|
+
} = useIntl();
|
|
22
27
|
const handleMouseDown = useCallback(event => {
|
|
23
28
|
event.preventDefault();
|
|
24
29
|
}, []);
|
|
@@ -41,19 +46,17 @@ const ColorCard = props => {
|
|
|
41
46
|
}
|
|
42
47
|
}, [isTabbing, onKeyDown, value]);
|
|
43
48
|
useEffect(() => {
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
};
|
|
56
|
-
}
|
|
49
|
+
const refCurrent = ref.current;
|
|
50
|
+
const handleKeyDown = e => {
|
|
51
|
+
if (e.key === 'Tab') {
|
|
52
|
+
e.stopPropagation();
|
|
53
|
+
e.preventDefault();
|
|
54
|
+
}
|
|
55
|
+
};
|
|
56
|
+
refCurrent === null || refCurrent === void 0 ? void 0 : refCurrent.addEventListener('keydown', handleKeyDown);
|
|
57
|
+
return () => {
|
|
58
|
+
refCurrent === null || refCurrent === void 0 ? void 0 : refCurrent.removeEventListener('keydown', handleKeyDown);
|
|
59
|
+
};
|
|
57
60
|
}, []);
|
|
58
61
|
return jsx(Tooltip, {
|
|
59
62
|
content: label
|
|
@@ -64,11 +67,10 @@ const ColorCard = props => {
|
|
|
64
67
|
onKeyDown: handleKeyDown,
|
|
65
68
|
role: "radio",
|
|
66
69
|
"aria-checked": selected
|
|
67
|
-
},
|
|
68
|
-
'aria-label':
|
|
70
|
+
}, getBooleanFF('platform.jca11y-2997-remove-duplicate-screen-reader-announcements_fz13s') && {
|
|
71
|
+
'aria-label': formatMessage(messages.colorCardRadioItemLabel)
|
|
69
72
|
}, {
|
|
70
|
-
tabIndex: 0
|
|
71
|
-
}, getBooleanFF('platform.color-picker-radio-button-functionality_6hkcy') && {
|
|
73
|
+
tabIndex: 0,
|
|
72
74
|
ref: ref
|
|
73
75
|
}), jsx("div", {
|
|
74
76
|
css: colorCardWrapperStyles
|
|
@@ -86,6 +88,7 @@ const ColorCard = props => {
|
|
|
86
88
|
};
|
|
87
89
|
export default ColorCard;
|
|
88
90
|
const colorCardOptionTabbingStyles = css({
|
|
91
|
+
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-unsafe-selectors -- Ignored via go/DSP-18766
|
|
89
92
|
':hover, :focus': {
|
|
90
93
|
borderColor: `var(--ds-border-focused, ${B75})`
|
|
91
94
|
}
|
|
@@ -24,7 +24,7 @@ export const ColorPaletteMenuWithoutAnalytics = ({
|
|
|
24
24
|
attributes: {
|
|
25
25
|
componentName: 'color-picker',
|
|
26
26
|
packageName: "@atlaskit/color-picker",
|
|
27
|
-
packageVersion: "3.2.
|
|
27
|
+
packageVersion: "3.2.16"
|
|
28
28
|
}
|
|
29
29
|
})(createAnalyticsEvent);
|
|
30
30
|
}
|
|
@@ -40,13 +40,18 @@ export const ColorPaletteMenuWithoutAnalytics = ({
|
|
|
40
40
|
const fullLabel = `${label}, ${selectedValue.label} selected`;
|
|
41
41
|
return jsx("div", {
|
|
42
42
|
"aria-label": fullLabel,
|
|
43
|
-
role: "radiogroup"
|
|
43
|
+
role: "radiogroup"
|
|
44
|
+
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-imported-style-values -- Ignored via go/DSP-18766
|
|
45
|
+
,
|
|
44
46
|
css: [colorPaletteMenuStyles, mode === Mode.Standard && colorPaletteMenuStandardStyles],
|
|
45
47
|
style: {
|
|
48
|
+
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-imported-style-values -- Ignored via go/DSP-18766
|
|
46
49
|
width: `${getWidth(cols, mode)}px`
|
|
47
50
|
}
|
|
48
51
|
}, jsx("div", {
|
|
49
|
-
css: [colorPaletteContainerStyles,
|
|
52
|
+
css: [colorPaletteContainerStyles,
|
|
53
|
+
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-imported-style-values -- Ignored via go/DSP-18766
|
|
54
|
+
mode === Mode.Compact && colorPaletteContainerCompactStyles]
|
|
50
55
|
}, options.map(({
|
|
51
56
|
label,
|
|
52
57
|
value
|
|
@@ -66,7 +71,7 @@ export const ColorPaletteMenuWithoutAnalytics = ({
|
|
|
66
71
|
export default withAnalyticsContext({
|
|
67
72
|
componentName: 'color-picker',
|
|
68
73
|
packageName: "@atlaskit/color-picker",
|
|
69
|
-
packageVersion: "3.2.
|
|
74
|
+
packageVersion: "3.2.16"
|
|
70
75
|
})(withAnalyticsEvents()(ColorPaletteMenuWithoutAnalytics));
|
|
71
76
|
const colorCardWrapperStyles = css({
|
|
72
77
|
display: 'flex',
|
|
@@ -9,7 +9,6 @@ import { KEY_ARROW_DOWN, KEY_ARROW_UP, KEY_TAB } from '../constants';
|
|
|
9
9
|
import { createAndFireEvent, withAnalyticsContext, withAnalyticsEvents } from '@atlaskit/analytics-next';
|
|
10
10
|
import { getOptions } from '../utils';
|
|
11
11
|
import { css, jsx } from '@emotion/react';
|
|
12
|
-
import { getBooleanFF } from '@atlaskit/platform-feature-flags';
|
|
13
12
|
import { injectIntl } from 'react-intl-next';
|
|
14
13
|
import messages from '../messages';
|
|
15
14
|
const defaultPopperProps = {
|
|
@@ -23,7 +22,7 @@ const defaultPopperProps = {
|
|
|
23
22
|
placement: 'bottom-start'
|
|
24
23
|
};
|
|
25
24
|
const packageName = "@atlaskit/color-picker";
|
|
26
|
-
const packageVersion = "3.2.
|
|
25
|
+
const packageVersion = "3.2.16";
|
|
27
26
|
class ColorPickerWithoutAnalyticsBase extends React.Component {
|
|
28
27
|
constructor(...args) {
|
|
29
28
|
super(...args);
|
|
@@ -64,7 +63,7 @@ class ColorPickerWithoutAnalyticsBase extends React.Component {
|
|
|
64
63
|
this.setState({
|
|
65
64
|
isTabbing: false
|
|
66
65
|
});
|
|
67
|
-
} else if (
|
|
66
|
+
} else if (key === 'Escape') {
|
|
68
67
|
e.stopPropagation();
|
|
69
68
|
}
|
|
70
69
|
});
|
|
@@ -106,8 +105,7 @@ class ColorPickerWithoutAnalyticsBase extends React.Component {
|
|
|
106
105
|
ref: ref
|
|
107
106
|
}, jsx(Trigger, _extends({}, value, {
|
|
108
107
|
label: fullLabel,
|
|
109
|
-
expanded: isOpen
|
|
110
|
-
}, getBooleanFF('platform.color-picker-radio-button-functionality_6hkcy') && {
|
|
108
|
+
expanded: isOpen,
|
|
111
109
|
swatchSize: selectedColourSwatchSize,
|
|
112
110
|
isDisabled: isDisabledSelectedSwatch
|
|
113
111
|
}))),
|
|
@@ -1,10 +1,8 @@
|
|
|
1
|
-
import _extends from "@babel/runtime/helpers/extends";
|
|
2
1
|
/** @jsx jsx */
|
|
3
2
|
import { useCallback } from 'react';
|
|
4
3
|
import Tooltip from '@atlaskit/tooltip';
|
|
5
4
|
import { css, jsx } from '@emotion/react';
|
|
6
5
|
import { B100, DN600A, N0 } from '@atlaskit/theme/colors';
|
|
7
|
-
import { getBooleanFF } from '@atlaskit/platform-feature-flags';
|
|
8
6
|
const ColorCard = ({
|
|
9
7
|
value,
|
|
10
8
|
label,
|
|
@@ -25,29 +23,23 @@ const ColorCard = ({
|
|
|
25
23
|
}, [onClick]);
|
|
26
24
|
return jsx(Tooltip, {
|
|
27
25
|
content: label
|
|
28
|
-
}, jsx("button",
|
|
26
|
+
}, jsx("button", {
|
|
29
27
|
css: [sharedColorContainerStyles, swatchSize === 'small' ? smallColorContainerSize : defaultColorContainerSize, colorCardButtonStyles, expanded && colorCardButtonFocusedStyles],
|
|
30
|
-
disabled: isDisabled
|
|
31
|
-
} : {
|
|
32
|
-
css: [sharedColorContainerStyles, defaultColorContainerSize, colorCardButtonStyles, expanded && colorCardButtonFocusedStyles]
|
|
33
|
-
}, {
|
|
28
|
+
disabled: isDisabled,
|
|
34
29
|
onClick: handleClick,
|
|
35
30
|
onMouseDown: handleMouseDown,
|
|
36
31
|
"aria-label": label,
|
|
37
32
|
"aria-expanded": expanded,
|
|
38
33
|
"aria-haspopup": true,
|
|
39
34
|
type: "button"
|
|
40
|
-
}
|
|
35
|
+
}, jsx("span", {
|
|
41
36
|
css: colorCardWrapperStyles
|
|
42
|
-
}, jsx("span",
|
|
43
|
-
css: [colorCardContentStyles, swatchSize === 'small' ? smallColorCardContentSize : defaultColorCardContentSize]
|
|
44
|
-
} : {
|
|
45
|
-
css: [colorCardContentStyles, defaultColorCardContentSize]
|
|
46
|
-
}, {
|
|
37
|
+
}, jsx("span", {
|
|
38
|
+
css: [colorCardContentStyles, swatchSize === 'small' ? smallColorCardContentSize : defaultColorCardContentSize],
|
|
47
39
|
style: {
|
|
48
40
|
background: value || 'transparent'
|
|
49
41
|
}
|
|
50
|
-
}))))
|
|
42
|
+
}))));
|
|
51
43
|
};
|
|
52
44
|
export default ColorCard;
|
|
53
45
|
const sharedColorContainerStyles = css({
|
|
@@ -73,9 +65,11 @@ const defaultColorContainerSize = css({
|
|
|
73
65
|
height: "var(--ds-space-400, 32px)"
|
|
74
66
|
});
|
|
75
67
|
const colorCardButtonStyles = css({
|
|
68
|
+
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-unsafe-selectors -- Ignored via go/DSP-18766
|
|
76
69
|
':hover': {
|
|
77
70
|
borderColor: `var(--ds-background-neutral-subtle, ${N0})`
|
|
78
71
|
},
|
|
72
|
+
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-unsafe-selectors -- Ignored via go/DSP-18766
|
|
79
73
|
':not(:focus):hover, :focus': {
|
|
80
74
|
borderColor: `var(--ds-border-focused, ${B100})`,
|
|
81
75
|
outline: 'none'
|
|
@@ -16,6 +16,7 @@ export const MenuList = props => {
|
|
|
16
16
|
css: colorPaletteContainerStyles,
|
|
17
17
|
role: "radiogroup",
|
|
18
18
|
style: {
|
|
19
|
+
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-imported-style-values -- Ignored via go/DSP-18766
|
|
19
20
|
maxWidth: cols ? getWidth(cols) : undefined
|
|
20
21
|
},
|
|
21
22
|
ref: innerRef
|
package/dist/es2019/messages.js
CHANGED
|
@@ -4,5 +4,10 @@ export default defineMessages({
|
|
|
4
4
|
id: 'jira.color-picker.src.color-picker-aria-label',
|
|
5
5
|
defaultMessage: '{color} selected, {message}',
|
|
6
6
|
description: 'This text is used as aria-label text in color picker component'
|
|
7
|
+
},
|
|
8
|
+
colorCardRadioItemLabel: {
|
|
9
|
+
id: 'jira.color-picker.src.color-card-radio-item-label',
|
|
10
|
+
defaultMessage: 'color option',
|
|
11
|
+
description: 'This text is used as aria-label text in color card component for radio item'
|
|
7
12
|
}
|
|
8
13
|
});
|
package/dist/es2019/utils.js
CHANGED
|
@@ -4,7 +4,6 @@ import { gridSize } from '@atlaskit/theme';
|
|
|
4
4
|
import { COLOR_CARD_SIZE } from './constants';
|
|
5
5
|
import memoizeOne from 'memoize-one';
|
|
6
6
|
import { Mode } from './types';
|
|
7
|
-
import { getBooleanFF } from '@atlaskit/platform-feature-flags';
|
|
8
7
|
export const getWidth = (cols, mode) => {
|
|
9
8
|
const width = cols * (COLOR_CARD_SIZE + gridSize() / 2);
|
|
10
9
|
return mode === Mode.Standard ? width + gridSize() : width;
|
|
@@ -12,7 +11,7 @@ export const getWidth = (cols, mode) => {
|
|
|
12
11
|
export const getOptions = memoizeOne((palette, selectedColor, showDefaultSwatchColor) => {
|
|
13
12
|
let focusedItemIndex = 0;
|
|
14
13
|
let defaultSelectedColor = palette[0];
|
|
15
|
-
if (
|
|
14
|
+
if (!showDefaultSwatchColor) {
|
|
16
15
|
defaultSelectedColor = {
|
|
17
16
|
label: '',
|
|
18
17
|
value: ''
|
|
@@ -5,8 +5,10 @@ import EditorDoneIcon from '@atlaskit/icon/glyph/editor/done';
|
|
|
5
5
|
import Tooltip from '@atlaskit/tooltip';
|
|
6
6
|
import { KEY_ENTER, KEY_SPACE } from '../constants';
|
|
7
7
|
import { css, jsx } from '@emotion/react';
|
|
8
|
+
import { useIntl } from 'react-intl-next';
|
|
8
9
|
import { N0, DN600A, B75 } from '@atlaskit/theme/colors';
|
|
9
10
|
import { getBooleanFF } from '@atlaskit/platform-feature-flags';
|
|
11
|
+
import messages from '../messages';
|
|
10
12
|
var ColorCard = function ColorCard(props) {
|
|
11
13
|
var value = props.value,
|
|
12
14
|
label = props.label,
|
|
@@ -18,6 +20,8 @@ var ColorCard = function ColorCard(props) {
|
|
|
18
20
|
onClick = props.onClick,
|
|
19
21
|
onKeyDown = props.onKeyDown;
|
|
20
22
|
var ref = useRef(null);
|
|
23
|
+
var _useIntl = useIntl(),
|
|
24
|
+
formatMessage = _useIntl.formatMessage;
|
|
21
25
|
var handleMouseDown = useCallback(function (event) {
|
|
22
26
|
event.preventDefault();
|
|
23
27
|
}, []);
|
|
@@ -38,19 +42,17 @@ var ColorCard = function ColorCard(props) {
|
|
|
38
42
|
}
|
|
39
43
|
}, [isTabbing, onKeyDown, value]);
|
|
40
44
|
useEffect(function () {
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
};
|
|
53
|
-
}
|
|
45
|
+
var refCurrent = ref.current;
|
|
46
|
+
var handleKeyDown = function handleKeyDown(e) {
|
|
47
|
+
if (e.key === 'Tab') {
|
|
48
|
+
e.stopPropagation();
|
|
49
|
+
e.preventDefault();
|
|
50
|
+
}
|
|
51
|
+
};
|
|
52
|
+
refCurrent === null || refCurrent === void 0 || refCurrent.addEventListener('keydown', handleKeyDown);
|
|
53
|
+
return function () {
|
|
54
|
+
refCurrent === null || refCurrent === void 0 || refCurrent.removeEventListener('keydown', handleKeyDown);
|
|
55
|
+
};
|
|
54
56
|
}, []);
|
|
55
57
|
return jsx(Tooltip, {
|
|
56
58
|
content: label
|
|
@@ -61,11 +63,10 @@ var ColorCard = function ColorCard(props) {
|
|
|
61
63
|
onKeyDown: handleKeyDown,
|
|
62
64
|
role: "radio",
|
|
63
65
|
"aria-checked": selected
|
|
64
|
-
},
|
|
65
|
-
'aria-label':
|
|
66
|
+
}, getBooleanFF('platform.jca11y-2997-remove-duplicate-screen-reader-announcements_fz13s') && {
|
|
67
|
+
'aria-label': formatMessage(messages.colorCardRadioItemLabel)
|
|
66
68
|
}, {
|
|
67
|
-
tabIndex: 0
|
|
68
|
-
}, getBooleanFF('platform.color-picker-radio-button-functionality_6hkcy') && {
|
|
69
|
+
tabIndex: 0,
|
|
69
70
|
ref: ref
|
|
70
71
|
}), jsx("div", {
|
|
71
72
|
css: colorCardWrapperStyles
|
|
@@ -83,6 +84,7 @@ var ColorCard = function ColorCard(props) {
|
|
|
83
84
|
};
|
|
84
85
|
export default ColorCard;
|
|
85
86
|
var colorCardOptionTabbingStyles = css({
|
|
87
|
+
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-unsafe-selectors -- Ignored via go/DSP-18766
|
|
86
88
|
':hover, :focus': {
|
|
87
89
|
borderColor: "var(--ds-border-focused, ".concat(B75, ")")
|
|
88
90
|
}
|
|
@@ -26,7 +26,7 @@ export var ColorPaletteMenuWithoutAnalytics = function ColorPaletteMenuWithoutAn
|
|
|
26
26
|
attributes: {
|
|
27
27
|
componentName: 'color-picker',
|
|
28
28
|
packageName: "@atlaskit/color-picker",
|
|
29
|
-
packageVersion: "3.2.
|
|
29
|
+
packageVersion: "3.2.16"
|
|
30
30
|
}
|
|
31
31
|
})(createAnalyticsEvent);
|
|
32
32
|
}
|
|
@@ -41,13 +41,18 @@ export var ColorPaletteMenuWithoutAnalytics = function ColorPaletteMenuWithoutAn
|
|
|
41
41
|
var fullLabel = "".concat(label, ", ").concat(selectedValue.label, " selected");
|
|
42
42
|
return jsx("div", {
|
|
43
43
|
"aria-label": fullLabel,
|
|
44
|
-
role: "radiogroup"
|
|
44
|
+
role: "radiogroup"
|
|
45
|
+
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-imported-style-values -- Ignored via go/DSP-18766
|
|
46
|
+
,
|
|
45
47
|
css: [colorPaletteMenuStyles, mode === Mode.Standard && colorPaletteMenuStandardStyles],
|
|
46
48
|
style: {
|
|
49
|
+
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-imported-style-values -- Ignored via go/DSP-18766
|
|
47
50
|
width: "".concat(getWidth(cols, mode), "px")
|
|
48
51
|
}
|
|
49
52
|
}, jsx("div", {
|
|
50
|
-
css: [colorPaletteContainerStyles,
|
|
53
|
+
css: [colorPaletteContainerStyles,
|
|
54
|
+
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-imported-style-values -- Ignored via go/DSP-18766
|
|
55
|
+
mode === Mode.Compact && colorPaletteContainerCompactStyles]
|
|
51
56
|
}, options.map(function (_ref2) {
|
|
52
57
|
var label = _ref2.label,
|
|
53
58
|
value = _ref2.value;
|
|
@@ -68,7 +73,7 @@ export var ColorPaletteMenuWithoutAnalytics = function ColorPaletteMenuWithoutAn
|
|
|
68
73
|
export default withAnalyticsContext({
|
|
69
74
|
componentName: 'color-picker',
|
|
70
75
|
packageName: "@atlaskit/color-picker",
|
|
71
|
-
packageVersion: "3.2.
|
|
76
|
+
packageVersion: "3.2.16"
|
|
72
77
|
})(withAnalyticsEvents()(ColorPaletteMenuWithoutAnalytics));
|
|
73
78
|
var colorCardWrapperStyles = css({
|
|
74
79
|
display: 'flex',
|
|
@@ -17,7 +17,6 @@ import { KEY_ARROW_DOWN, KEY_ARROW_UP, KEY_TAB } from '../constants';
|
|
|
17
17
|
import { createAndFireEvent, withAnalyticsContext, withAnalyticsEvents } from '@atlaskit/analytics-next';
|
|
18
18
|
import { getOptions } from '../utils';
|
|
19
19
|
import { css, jsx } from '@emotion/react';
|
|
20
|
-
import { getBooleanFF } from '@atlaskit/platform-feature-flags';
|
|
21
20
|
import { injectIntl } from 'react-intl-next';
|
|
22
21
|
import messages from '../messages';
|
|
23
22
|
var defaultPopperProps = {
|
|
@@ -31,7 +30,7 @@ var defaultPopperProps = {
|
|
|
31
30
|
placement: 'bottom-start'
|
|
32
31
|
};
|
|
33
32
|
var packageName = "@atlaskit/color-picker";
|
|
34
|
-
var packageVersion = "3.2.
|
|
33
|
+
var packageVersion = "3.2.16";
|
|
35
34
|
var ColorPickerWithoutAnalyticsBase = /*#__PURE__*/function (_React$Component) {
|
|
36
35
|
_inherits(ColorPickerWithoutAnalyticsBase, _React$Component);
|
|
37
36
|
var _super = _createSuper(ColorPickerWithoutAnalyticsBase);
|
|
@@ -77,7 +76,7 @@ var ColorPickerWithoutAnalyticsBase = /*#__PURE__*/function (_React$Component) {
|
|
|
77
76
|
_this.setState({
|
|
78
77
|
isTabbing: false
|
|
79
78
|
});
|
|
80
|
-
} else if (
|
|
79
|
+
} else if (key === 'Escape') {
|
|
81
80
|
e.stopPropagation();
|
|
82
81
|
}
|
|
83
82
|
});
|
|
@@ -123,8 +122,7 @@ var ColorPickerWithoutAnalyticsBase = /*#__PURE__*/function (_React$Component) {
|
|
|
123
122
|
ref: ref
|
|
124
123
|
}, jsx(Trigger, _extends({}, value, {
|
|
125
124
|
label: fullLabel,
|
|
126
|
-
expanded: isOpen
|
|
127
|
-
}, getBooleanFF('platform.color-picker-radio-button-functionality_6hkcy') && {
|
|
125
|
+
expanded: isOpen,
|
|
128
126
|
swatchSize: selectedColourSwatchSize,
|
|
129
127
|
isDisabled: isDisabledSelectedSwatch
|
|
130
128
|
})));
|
|
@@ -1,10 +1,8 @@
|
|
|
1
|
-
import _extends from "@babel/runtime/helpers/extends";
|
|
2
1
|
/** @jsx jsx */
|
|
3
2
|
import { useCallback } from 'react';
|
|
4
3
|
import Tooltip from '@atlaskit/tooltip';
|
|
5
4
|
import { css, jsx } from '@emotion/react';
|
|
6
5
|
import { B100, DN600A, N0 } from '@atlaskit/theme/colors';
|
|
7
|
-
import { getBooleanFF } from '@atlaskit/platform-feature-flags';
|
|
8
6
|
var ColorCard = function ColorCard(_ref) {
|
|
9
7
|
var value = _ref.value,
|
|
10
8
|
label = _ref.label,
|
|
@@ -25,29 +23,23 @@ var ColorCard = function ColorCard(_ref) {
|
|
|
25
23
|
}, [onClick]);
|
|
26
24
|
return jsx(Tooltip, {
|
|
27
25
|
content: label
|
|
28
|
-
}, jsx("button",
|
|
26
|
+
}, jsx("button", {
|
|
29
27
|
css: [sharedColorContainerStyles, swatchSize === 'small' ? smallColorContainerSize : defaultColorContainerSize, colorCardButtonStyles, expanded && colorCardButtonFocusedStyles],
|
|
30
|
-
disabled: isDisabled
|
|
31
|
-
} : {
|
|
32
|
-
css: [sharedColorContainerStyles, defaultColorContainerSize, colorCardButtonStyles, expanded && colorCardButtonFocusedStyles]
|
|
33
|
-
}, {
|
|
28
|
+
disabled: isDisabled,
|
|
34
29
|
onClick: handleClick,
|
|
35
30
|
onMouseDown: handleMouseDown,
|
|
36
31
|
"aria-label": label,
|
|
37
32
|
"aria-expanded": expanded,
|
|
38
33
|
"aria-haspopup": true,
|
|
39
34
|
type: "button"
|
|
40
|
-
}
|
|
35
|
+
}, jsx("span", {
|
|
41
36
|
css: colorCardWrapperStyles
|
|
42
|
-
}, jsx("span",
|
|
43
|
-
css: [colorCardContentStyles, swatchSize === 'small' ? smallColorCardContentSize : defaultColorCardContentSize]
|
|
44
|
-
} : {
|
|
45
|
-
css: [colorCardContentStyles, defaultColorCardContentSize]
|
|
46
|
-
}, {
|
|
37
|
+
}, jsx("span", {
|
|
38
|
+
css: [colorCardContentStyles, swatchSize === 'small' ? smallColorCardContentSize : defaultColorCardContentSize],
|
|
47
39
|
style: {
|
|
48
40
|
background: value || 'transparent'
|
|
49
41
|
}
|
|
50
|
-
}))))
|
|
42
|
+
}))));
|
|
51
43
|
};
|
|
52
44
|
export default ColorCard;
|
|
53
45
|
var sharedColorContainerStyles = css({
|
|
@@ -73,9 +65,11 @@ var defaultColorContainerSize = css({
|
|
|
73
65
|
height: "var(--ds-space-400, 32px)"
|
|
74
66
|
});
|
|
75
67
|
var colorCardButtonStyles = css({
|
|
68
|
+
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-unsafe-selectors -- Ignored via go/DSP-18766
|
|
76
69
|
':hover': {
|
|
77
70
|
borderColor: "var(--ds-background-neutral-subtle, ".concat(N0, ")")
|
|
78
71
|
},
|
|
72
|
+
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-unsafe-selectors -- Ignored via go/DSP-18766
|
|
79
73
|
':not(:focus):hover, :focus': {
|
|
80
74
|
borderColor: "var(--ds-border-focused, ".concat(B100, ")"),
|
|
81
75
|
outline: 'none'
|
|
@@ -12,6 +12,7 @@ export var MenuList = function MenuList(props) {
|
|
|
12
12
|
css: colorPaletteContainerStyles,
|
|
13
13
|
role: "radiogroup",
|
|
14
14
|
style: {
|
|
15
|
+
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-imported-style-values -- Ignored via go/DSP-18766
|
|
15
16
|
maxWidth: cols ? getWidth(cols) : undefined
|
|
16
17
|
},
|
|
17
18
|
ref: innerRef
|
package/dist/esm/messages.js
CHANGED
|
@@ -4,5 +4,10 @@ export default defineMessages({
|
|
|
4
4
|
id: 'jira.color-picker.src.color-picker-aria-label',
|
|
5
5
|
defaultMessage: '{color} selected, {message}',
|
|
6
6
|
description: 'This text is used as aria-label text in color picker component'
|
|
7
|
+
},
|
|
8
|
+
colorCardRadioItemLabel: {
|
|
9
|
+
id: 'jira.color-picker.src.color-card-radio-item-label',
|
|
10
|
+
defaultMessage: 'color option',
|
|
11
|
+
description: 'This text is used as aria-label text in color card component for radio item'
|
|
7
12
|
}
|
|
8
13
|
});
|