@atlaskit/color-picker 3.3.0 → 3.3.2
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/dist/cjs/components/ColorCard.js +32 -36
- package/dist/cjs/components/ColorPaletteMenu.js +22 -8
- package/dist/cjs/components/ColorPicker.js +1 -1
- package/dist/cjs/components/components.js +1 -2
- package/dist/es2019/components/ColorCard.js +31 -37
- package/dist/es2019/components/ColorPaletteMenu.js +19 -7
- package/dist/es2019/components/ColorPicker.js +1 -1
- package/dist/es2019/components/components.js +1 -2
- package/dist/esm/components/ColorCard.js +33 -37
- package/dist/esm/components/ColorPaletteMenu.js +22 -8
- package/dist/esm/components/ColorPicker.js +1 -1
- package/dist/esm/components/components.js +1 -2
- package/dist/types/components/ColorCard.d.ts +4 -1
- package/dist/types/components/ColorPaletteMenu.d.ts +11 -4
- package/dist/types-ts4.5/components/ColorCard.d.ts +4 -1
- package/dist/types-ts4.5/components/ColorPaletteMenu.d.ts +11 -4
- package/package.json +4 -4
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,22 @@
|
|
|
1
1
|
# @atlaskit/color-picker
|
|
2
2
|
|
|
3
|
+
## 3.3.2
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- [#141841](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/141841)
|
|
8
|
+
[`c47656cb21bcc`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/c47656cb21bcc) -
|
|
9
|
+
Clean up color palette menu A11y FG
|
|
10
|
+
|
|
11
|
+
## 3.3.1
|
|
12
|
+
|
|
13
|
+
### Patch Changes
|
|
14
|
+
|
|
15
|
+
- [#141027](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/141027)
|
|
16
|
+
[`0d28a5b25436c`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/0d28a5b25436c) -
|
|
17
|
+
[ux] Technical change - Expose event in onChange callback of ColorPaletteMenu
|
|
18
|
+
- Updated dependencies
|
|
19
|
+
|
|
3
20
|
## 3.3.0
|
|
4
21
|
|
|
5
22
|
### Minor Changes
|
|
@@ -26,7 +26,11 @@ function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e;
|
|
|
26
26
|
|
|
27
27
|
var ColorCard = /*#__PURE__*/(0, _react.forwardRef)(function (props, componentRef) {
|
|
28
28
|
var type = props.type,
|
|
29
|
+
_props$autoFocus = props.autoFocus,
|
|
30
|
+
autoFocus = _props$autoFocus === void 0 ? true : _props$autoFocus,
|
|
29
31
|
initialFocusRef = props.initialFocusRef,
|
|
32
|
+
_props$isInsideMenu = props.isInsideMenu,
|
|
33
|
+
isInsideMenu = _props$isInsideMenu === void 0 ? true : _props$isInsideMenu,
|
|
30
34
|
value = props.value,
|
|
31
35
|
label = props.label,
|
|
32
36
|
selected = props.selected,
|
|
@@ -35,59 +39,51 @@ var ColorCard = /*#__PURE__*/(0, _react.forwardRef)(function (props, componentRe
|
|
|
35
39
|
checkMarkColor = _props$checkMarkColor === void 0 ? _colors.N0 : _props$checkMarkColor,
|
|
36
40
|
isTabbing = props.isTabbing,
|
|
37
41
|
onClick = props.onClick,
|
|
42
|
+
onClickOld = props.onClickOld,
|
|
38
43
|
onKeyDown = props.onKeyDown;
|
|
39
44
|
var ref = (0, _react.useRef)(null);
|
|
40
45
|
var isInitialFocus = (0, _react.useRef)(true);
|
|
41
46
|
var isColorPaletteMenu = type === _constants.COLOR_PALETTE_MENU;
|
|
42
|
-
var isTabbingIgnored = (0, _platformFeatureFlags.fg)('platform_color_palette_menu_timeline_bar_a11y') ? isColorPaletteMenu : false;
|
|
43
47
|
var handleMouseDown = (0, _react.useCallback)(function (event) {
|
|
44
48
|
event.preventDefault();
|
|
45
49
|
}, []);
|
|
46
50
|
var handleClick = (0, _react.useCallback)(function (event) {
|
|
47
|
-
if (
|
|
48
|
-
|
|
49
|
-
|
|
51
|
+
if ((0, _platformFeatureFlags.fg)('platform_color_palette-expose-event')) {
|
|
52
|
+
if (onClick) {
|
|
53
|
+
event.preventDefault();
|
|
54
|
+
onClick(event, value);
|
|
55
|
+
}
|
|
56
|
+
} else {
|
|
57
|
+
if (onClickOld) {
|
|
58
|
+
event.preventDefault();
|
|
59
|
+
onClickOld(value);
|
|
60
|
+
}
|
|
50
61
|
}
|
|
51
|
-
}, [onClick, value]);
|
|
62
|
+
}, [onClick, onClickOld, value]);
|
|
52
63
|
var handleKeyDown = (0, _react.useCallback)(function (event) {
|
|
53
|
-
if ((
|
|
64
|
+
if ((isColorPaletteMenu || isTabbing === undefined || isTabbing) && (onClickOld && !(0, _platformFeatureFlags.fg)('platform_color_palette-expose-event') || onClick && (0, _platformFeatureFlags.fg)('platform_color_palette-expose-event')) && (event.key === _constants.KEY_ENTER || event.key === _constants.KEY_SPACE)) {
|
|
54
65
|
event.preventDefault();
|
|
55
66
|
if (isTabbing) {
|
|
56
67
|
event.stopPropagation();
|
|
57
68
|
}
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
if (isColorPaletteMenu) {
|
|
62
|
-
onKeyDown === null || onKeyDown === void 0 || onKeyDown(event);
|
|
63
|
-
} else if (event.key === _constants.KEY_TAB) {
|
|
64
|
-
event.stopPropagation();
|
|
65
|
-
event.preventDefault();
|
|
66
|
-
}
|
|
69
|
+
|
|
70
|
+
// Remove optional call on FG cleanup platform_color_palette-expose-event
|
|
71
|
+
(0, _platformFeatureFlags.fg)('platform_color_palette-expose-event') ? onClick === null || onClick === void 0 ? void 0 : onClick(event, value) : onClickOld === null || onClickOld === void 0 ? void 0 : onClickOld(value);
|
|
67
72
|
}
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
if (
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
if (event.key === _constants.KEY_TAB) {
|
|
74
|
-
event.stopPropagation();
|
|
75
|
-
event.preventDefault();
|
|
76
|
-
}
|
|
77
|
-
};
|
|
78
|
-
refCurrent === null || refCurrent === void 0 || refCurrent.addEventListener('keydown', handleTabKey);
|
|
79
|
-
return function () {
|
|
80
|
-
refCurrent === null || refCurrent === void 0 || refCurrent.removeEventListener('keydown', handleTabKey);
|
|
81
|
-
};
|
|
73
|
+
if (isColorPaletteMenu) {
|
|
74
|
+
onKeyDown === null || onKeyDown === void 0 || onKeyDown(event);
|
|
75
|
+
} else if (event.key === _constants.KEY_TAB) {
|
|
76
|
+
event.preventDefault();
|
|
77
|
+
event.stopPropagation();
|
|
82
78
|
}
|
|
83
|
-
}, []);
|
|
79
|
+
}, [isColorPaletteMenu, isTabbing, value, onClick, onClickOld, onKeyDown]);
|
|
84
80
|
(0, _react.useImperativeHandle)(componentRef, function () {
|
|
85
81
|
return {
|
|
86
82
|
focus: function focus() {
|
|
87
|
-
if (
|
|
83
|
+
if (isColorPaletteMenu) {
|
|
88
84
|
if (isInitialFocus.current) {
|
|
89
85
|
var _ref$current;
|
|
90
|
-
!initialFocusRef && ((_ref$current = ref.current) === null || _ref$current === void 0 ? void 0 : _ref$current.focus());
|
|
86
|
+
autoFocus && !initialFocusRef && ((_ref$current = ref.current) === null || _ref$current === void 0 ? void 0 : _ref$current.focus());
|
|
91
87
|
isInitialFocus.current = false;
|
|
92
88
|
} else {
|
|
93
89
|
var _ref$current2;
|
|
@@ -96,18 +92,18 @@ var ColorCard = /*#__PURE__*/(0, _react.forwardRef)(function (props, componentRe
|
|
|
96
92
|
}
|
|
97
93
|
}
|
|
98
94
|
};
|
|
99
|
-
}, [
|
|
95
|
+
}, [autoFocus, isColorPaletteMenu, initialFocusRef]);
|
|
100
96
|
return (0, _react2.jsx)(_tooltip.default, {
|
|
101
97
|
content: label
|
|
102
98
|
}, function (tooltipProps) {
|
|
103
99
|
delete tooltipProps['aria-describedby'];
|
|
104
100
|
return (0, _react2.jsx)("div", (0, _extends2.default)({}, tooltipProps, {
|
|
105
101
|
ref: initialFocusRef ? (0, _useCallbackRef.mergeRefs)([ref, tooltipProps.ref, initialFocusRef]) : (0, _useCallbackRef.mergeRefs)([ref, tooltipProps.ref]),
|
|
106
|
-
role:
|
|
107
|
-
tabIndex:
|
|
102
|
+
role: isInsideMenu ? 'menuitemradio' : 'radio',
|
|
103
|
+
tabIndex: selected ? 0 : -1,
|
|
108
104
|
"aria-checked": selected,
|
|
109
105
|
"aria-label": label,
|
|
110
|
-
css: [sharedColorContainerStyles, (
|
|
106
|
+
css: [sharedColorContainerStyles, (isColorPaletteMenu || isTabbing === undefined || isTabbing) && colorCardOptionTabbingStyles, focused && (isColorPaletteMenu || !isTabbing) && colorCardOptionFocusedStyles],
|
|
111
107
|
onClick: handleClick,
|
|
112
108
|
onMouseDown: handleMouseDown,
|
|
113
109
|
onKeyDown: handleKeyDown
|
|
@@ -24,10 +24,15 @@ var _colors = require("@atlaskit/theme/colors");
|
|
|
24
24
|
// eslint-disable-next-line @atlaskit/ui-styling-standard/use-compiled -- Ignored via go/DSP-18766
|
|
25
25
|
|
|
26
26
|
var ColorPaletteMenuWithoutAnalytics = exports.ColorPaletteMenuWithoutAnalytics = function ColorPaletteMenuWithoutAnalytics(_ref) {
|
|
27
|
-
var _ref$
|
|
27
|
+
var _ref$autoFocus = _ref.autoFocus,
|
|
28
|
+
autoFocus = _ref$autoFocus === void 0 ? true : _ref$autoFocus,
|
|
29
|
+
_ref$isFocusLockEnabl = _ref.isFocusLockEnabled,
|
|
28
30
|
isFocusLockEnabled = _ref$isFocusLockEnabl === void 0 ? true : _ref$isFocusLockEnabl,
|
|
31
|
+
_ref$isInsideMenu = _ref.isInsideMenu,
|
|
32
|
+
isInsideMenu = _ref$isInsideMenu === void 0 ? true : _ref$isInsideMenu,
|
|
29
33
|
createAnalyticsEvent = _ref.createAnalyticsEvent,
|
|
30
34
|
onChange = _ref.onChange,
|
|
35
|
+
onChangeOld = _ref.onChangeOld,
|
|
31
36
|
palette = _ref.palette,
|
|
32
37
|
selectedColor = _ref.selectedColor,
|
|
33
38
|
checkMarkColor = _ref.checkMarkColor,
|
|
@@ -59,7 +64,7 @@ var ColorPaletteMenuWithoutAnalytics = exports.ColorPaletteMenuWithoutAnalytics
|
|
|
59
64
|
attributes: {
|
|
60
65
|
componentName: 'color-picker',
|
|
61
66
|
packageName: "@atlaskit/color-picker",
|
|
62
|
-
packageVersion: "3.3.
|
|
67
|
+
packageVersion: "3.3.2"
|
|
63
68
|
}
|
|
64
69
|
})(createAnalyticsEvent);
|
|
65
70
|
}
|
|
@@ -68,8 +73,12 @@ var ColorPaletteMenuWithoutAnalytics = exports.ColorPaletteMenuWithoutAnalytics
|
|
|
68
73
|
var colorCardRefs = (0, _react.useMemo)(function () {
|
|
69
74
|
return [];
|
|
70
75
|
}, []);
|
|
71
|
-
var
|
|
72
|
-
|
|
76
|
+
var handleChangeOld = function handleChangeOld(value) {
|
|
77
|
+
onChangeOld === null || onChangeOld === void 0 || onChangeOld(value, changeAnalyticsCaller());
|
|
78
|
+
};
|
|
79
|
+
var handleChange = function handleChange(event, value) {
|
|
80
|
+
// Set to required on FG cleanup platform_color_palette-expose-event
|
|
81
|
+
onChange === null || onChange === void 0 || onChange(event, value, changeAnalyticsCaller());
|
|
73
82
|
};
|
|
74
83
|
(0, _react.useEffect)(function () {
|
|
75
84
|
var _colorCardRefs$focuse;
|
|
@@ -105,7 +114,7 @@ var ColorPaletteMenuWithoutAnalytics = exports.ColorPaletteMenuWithoutAnalytics
|
|
|
105
114
|
}, [isFocusLockEnabled, selectedColorIndex, setFocusedIndex, options]);
|
|
106
115
|
return (0, _react2.jsx)("div", {
|
|
107
116
|
"aria-label": fullLabel,
|
|
108
|
-
role:
|
|
117
|
+
role: isInsideMenu ? 'group' : 'radiogroup'
|
|
109
118
|
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-imported-style-values -- Ignored via go/DSP-18766
|
|
110
119
|
,
|
|
111
120
|
css: [colorPaletteMenuStyles, mode === _types.Mode.Standard && colorPaletteMenuStandardStyles],
|
|
@@ -129,13 +138,18 @@ var ColorPaletteMenuWithoutAnalytics = exports.ColorPaletteMenuWithoutAnalytics
|
|
|
129
138
|
value: value,
|
|
130
139
|
checkMarkColor: checkMarkColor,
|
|
131
140
|
isOption: true,
|
|
132
|
-
selected: value === selectedValue.value
|
|
141
|
+
selected: value === selectedValue.value
|
|
142
|
+
}, (0, _platformFeatureFlags.fg)('platform_color_palette-expose-event') ? {
|
|
133
143
|
onClick: handleChange
|
|
134
|
-
}
|
|
144
|
+
} : {
|
|
145
|
+
onClickOld: handleChangeOld
|
|
146
|
+
}, {
|
|
135
147
|
ref: function ref(_ref4) {
|
|
136
148
|
colorCardRefs[index] = _ref4;
|
|
137
149
|
},
|
|
150
|
+
autoFocus: autoFocus,
|
|
138
151
|
initialFocusRef: value === selectedValue.value ? initialFocusRef : undefined,
|
|
152
|
+
isInsideMenu: isInsideMenu,
|
|
139
153
|
onKeyDown: handleKeyDown
|
|
140
154
|
})));
|
|
141
155
|
})));
|
|
@@ -143,7 +157,7 @@ var ColorPaletteMenuWithoutAnalytics = exports.ColorPaletteMenuWithoutAnalytics
|
|
|
143
157
|
var _default = exports.default = (0, _analyticsNext.withAnalyticsContext)({
|
|
144
158
|
componentName: 'color-picker',
|
|
145
159
|
packageName: "@atlaskit/color-picker",
|
|
146
|
-
packageVersion: "3.3.
|
|
160
|
+
packageVersion: "3.3.2"
|
|
147
161
|
})((0, _analyticsNext.withAnalyticsEvents)()(ColorPaletteMenuWithoutAnalytics));
|
|
148
162
|
var colorCardWrapperStyles = (0, _react2.css)({
|
|
149
163
|
display: 'flex',
|
|
@@ -42,7 +42,7 @@ var defaultPopperProps = {
|
|
|
42
42
|
placement: 'bottom-start'
|
|
43
43
|
};
|
|
44
44
|
var packageName = "@atlaskit/color-picker";
|
|
45
|
-
var packageVersion = "3.3.
|
|
45
|
+
var packageVersion = "3.3.2";
|
|
46
46
|
var ColorPickerWithoutAnalyticsBase = /*#__PURE__*/function (_React$Component) {
|
|
47
47
|
(0, _inherits2.default)(ColorPickerWithoutAnalyticsBase, _React$Component);
|
|
48
48
|
var _super = _createSuper(ColorPickerWithoutAnalyticsBase);
|
|
@@ -6,7 +6,6 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
6
6
|
});
|
|
7
7
|
exports.Placeholder = exports.Option = exports.MenuList = exports.DropdownIndicator = void 0;
|
|
8
8
|
var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
|
|
9
|
-
var _platformFeatureFlags = require("@atlaskit/platform-feature-flags");
|
|
10
9
|
var _ColorCard = _interopRequireDefault(require("./ColorCard"));
|
|
11
10
|
var _utils = require("../utils");
|
|
12
11
|
var _react = require("@emotion/react");
|
|
@@ -24,7 +23,7 @@ var MenuList = exports.MenuList = function MenuList(props) {
|
|
|
24
23
|
children = props.children;
|
|
25
24
|
return (0, _react.jsx)("div", {
|
|
26
25
|
css: colorPaletteContainerStyles,
|
|
27
|
-
role:
|
|
26
|
+
role: "group",
|
|
28
27
|
style: {
|
|
29
28
|
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-imported-style-values -- Ignored via go/DSP-18766
|
|
30
29
|
maxWidth: cols ? (0, _utils.getWidth)(cols) : undefined
|
|
@@ -3,7 +3,7 @@ import _extends from "@babel/runtime/helpers/extends";
|
|
|
3
3
|
* @jsxRuntime classic
|
|
4
4
|
* @jsx jsx
|
|
5
5
|
*/
|
|
6
|
-
import React, { useCallback,
|
|
6
|
+
import React, { useCallback, useRef, useImperativeHandle, forwardRef } from 'react';
|
|
7
7
|
import EditorDoneIcon from '@atlaskit/icon/glyph/editor/done';
|
|
8
8
|
import Tooltip from '@atlaskit/tooltip';
|
|
9
9
|
import { fg } from '@atlaskit/platform-feature-flags';
|
|
@@ -15,7 +15,9 @@ import { mergeRefs } from 'use-callback-ref';
|
|
|
15
15
|
const ColorCard = /*#__PURE__*/forwardRef((props, componentRef) => {
|
|
16
16
|
const {
|
|
17
17
|
type,
|
|
18
|
+
autoFocus = true,
|
|
18
19
|
initialFocusRef,
|
|
20
|
+
isInsideMenu = true,
|
|
19
21
|
value,
|
|
20
22
|
label,
|
|
21
23
|
selected,
|
|
@@ -23,59 +25,51 @@ const ColorCard = /*#__PURE__*/forwardRef((props, componentRef) => {
|
|
|
23
25
|
checkMarkColor = N0,
|
|
24
26
|
isTabbing,
|
|
25
27
|
onClick,
|
|
28
|
+
onClickOld,
|
|
26
29
|
onKeyDown
|
|
27
30
|
} = props;
|
|
28
31
|
const ref = useRef(null);
|
|
29
32
|
const isInitialFocus = useRef(true);
|
|
30
33
|
const isColorPaletteMenu = type === COLOR_PALETTE_MENU;
|
|
31
|
-
const isTabbingIgnored = fg('platform_color_palette_menu_timeline_bar_a11y') ? isColorPaletteMenu : false;
|
|
32
34
|
const handleMouseDown = useCallback(event => {
|
|
33
35
|
event.preventDefault();
|
|
34
36
|
}, []);
|
|
35
37
|
const handleClick = useCallback(event => {
|
|
36
|
-
if (
|
|
37
|
-
|
|
38
|
-
|
|
38
|
+
if (fg('platform_color_palette-expose-event')) {
|
|
39
|
+
if (onClick) {
|
|
40
|
+
event.preventDefault();
|
|
41
|
+
onClick(event, value);
|
|
42
|
+
}
|
|
43
|
+
} else {
|
|
44
|
+
if (onClickOld) {
|
|
45
|
+
event.preventDefault();
|
|
46
|
+
onClickOld(value);
|
|
47
|
+
}
|
|
39
48
|
}
|
|
40
|
-
}, [onClick, value]);
|
|
49
|
+
}, [onClick, onClickOld, value]);
|
|
41
50
|
const handleKeyDown = useCallback(event => {
|
|
42
|
-
if ((
|
|
51
|
+
if ((isColorPaletteMenu || isTabbing === undefined || isTabbing) && (onClickOld && !fg('platform_color_palette-expose-event') || onClick && fg('platform_color_palette-expose-event')) && (event.key === KEY_ENTER || event.key === KEY_SPACE)) {
|
|
43
52
|
event.preventDefault();
|
|
44
53
|
if (isTabbing) {
|
|
45
54
|
event.stopPropagation();
|
|
46
55
|
}
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
if (isColorPaletteMenu) {
|
|
51
|
-
onKeyDown === null || onKeyDown === void 0 ? void 0 : onKeyDown(event);
|
|
52
|
-
} else if (event.key === KEY_TAB) {
|
|
53
|
-
event.stopPropagation();
|
|
54
|
-
event.preventDefault();
|
|
55
|
-
}
|
|
56
|
+
|
|
57
|
+
// Remove optional call on FG cleanup platform_color_palette-expose-event
|
|
58
|
+
fg('platform_color_palette-expose-event') ? onClick === null || onClick === void 0 ? void 0 : onClick(event, value) : onClickOld === null || onClickOld === void 0 ? void 0 : onClickOld(value);
|
|
56
59
|
}
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
if (
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
if (event.key === KEY_TAB) {
|
|
63
|
-
event.stopPropagation();
|
|
64
|
-
event.preventDefault();
|
|
65
|
-
}
|
|
66
|
-
};
|
|
67
|
-
refCurrent === null || refCurrent === void 0 ? void 0 : refCurrent.addEventListener('keydown', handleTabKey);
|
|
68
|
-
return () => {
|
|
69
|
-
refCurrent === null || refCurrent === void 0 ? void 0 : refCurrent.removeEventListener('keydown', handleTabKey);
|
|
70
|
-
};
|
|
60
|
+
if (isColorPaletteMenu) {
|
|
61
|
+
onKeyDown === null || onKeyDown === void 0 ? void 0 : onKeyDown(event);
|
|
62
|
+
} else if (event.key === KEY_TAB) {
|
|
63
|
+
event.preventDefault();
|
|
64
|
+
event.stopPropagation();
|
|
71
65
|
}
|
|
72
|
-
}, []);
|
|
66
|
+
}, [isColorPaletteMenu, isTabbing, value, onClick, onClickOld, onKeyDown]);
|
|
73
67
|
useImperativeHandle(componentRef, () => ({
|
|
74
68
|
focus: () => {
|
|
75
|
-
if (
|
|
69
|
+
if (isColorPaletteMenu) {
|
|
76
70
|
if (isInitialFocus.current) {
|
|
77
71
|
var _ref$current;
|
|
78
|
-
!initialFocusRef && ((_ref$current = ref.current) === null || _ref$current === void 0 ? void 0 : _ref$current.focus());
|
|
72
|
+
autoFocus && !initialFocusRef && ((_ref$current = ref.current) === null || _ref$current === void 0 ? void 0 : _ref$current.focus());
|
|
79
73
|
isInitialFocus.current = false;
|
|
80
74
|
} else {
|
|
81
75
|
var _ref$current2;
|
|
@@ -83,18 +77,18 @@ const ColorCard = /*#__PURE__*/forwardRef((props, componentRef) => {
|
|
|
83
77
|
}
|
|
84
78
|
}
|
|
85
79
|
}
|
|
86
|
-
}), [
|
|
80
|
+
}), [autoFocus, isColorPaletteMenu, initialFocusRef]);
|
|
87
81
|
return jsx(Tooltip, {
|
|
88
82
|
content: label
|
|
89
83
|
}, tooltipProps => {
|
|
90
84
|
delete tooltipProps['aria-describedby'];
|
|
91
85
|
return jsx("div", _extends({}, tooltipProps, {
|
|
92
86
|
ref: initialFocusRef ? mergeRefs([ref, tooltipProps.ref, initialFocusRef]) : mergeRefs([ref, tooltipProps.ref]),
|
|
93
|
-
role:
|
|
94
|
-
tabIndex:
|
|
87
|
+
role: isInsideMenu ? 'menuitemradio' : 'radio',
|
|
88
|
+
tabIndex: selected ? 0 : -1,
|
|
95
89
|
"aria-checked": selected,
|
|
96
90
|
"aria-label": label,
|
|
97
|
-
css: [sharedColorContainerStyles, (
|
|
91
|
+
css: [sharedColorContainerStyles, (isColorPaletteMenu || isTabbing === undefined || isTabbing) && colorCardOptionTabbingStyles, focused && (isColorPaletteMenu || !isTabbing) && colorCardOptionFocusedStyles],
|
|
98
92
|
onClick: handleClick,
|
|
99
93
|
onMouseDown: handleMouseDown,
|
|
100
94
|
onKeyDown: handleKeyDown
|
|
@@ -14,9 +14,12 @@ import { css, jsx } from '@emotion/react';
|
|
|
14
14
|
import { COLOR_PALETTE_MENU, KEY_ARROW_UP, KEY_ARROW_DOWN, KEY_ARROW_LEFT, KEY_ARROW_RIGHT, KEY_TAB } from '../constants';
|
|
15
15
|
import { N0, N40 } from '@atlaskit/theme/colors';
|
|
16
16
|
export const ColorPaletteMenuWithoutAnalytics = ({
|
|
17
|
+
autoFocus = true,
|
|
17
18
|
isFocusLockEnabled = true,
|
|
19
|
+
isInsideMenu = true,
|
|
18
20
|
createAnalyticsEvent,
|
|
19
21
|
onChange,
|
|
22
|
+
onChangeOld,
|
|
20
23
|
palette,
|
|
21
24
|
selectedColor,
|
|
22
25
|
checkMarkColor,
|
|
@@ -43,15 +46,19 @@ export const ColorPaletteMenuWithoutAnalytics = ({
|
|
|
43
46
|
attributes: {
|
|
44
47
|
componentName: 'color-picker',
|
|
45
48
|
packageName: "@atlaskit/color-picker",
|
|
46
|
-
packageVersion: "3.3.
|
|
49
|
+
packageVersion: "3.3.2"
|
|
47
50
|
}
|
|
48
51
|
})(createAnalyticsEvent);
|
|
49
52
|
}
|
|
50
53
|
return undefined;
|
|
51
54
|
};
|
|
52
55
|
const colorCardRefs = useMemo(() => [], []);
|
|
53
|
-
const
|
|
54
|
-
|
|
56
|
+
const handleChangeOld = value => {
|
|
57
|
+
onChangeOld === null || onChangeOld === void 0 ? void 0 : onChangeOld(value, changeAnalyticsCaller());
|
|
58
|
+
};
|
|
59
|
+
const handleChange = (event, value) => {
|
|
60
|
+
// Set to required on FG cleanup platform_color_palette-expose-event
|
|
61
|
+
onChange === null || onChange === void 0 ? void 0 : onChange(event, value, changeAnalyticsCaller());
|
|
55
62
|
};
|
|
56
63
|
useEffect(() => {
|
|
57
64
|
var _colorCardRefs$focuse;
|
|
@@ -83,7 +90,7 @@ export const ColorPaletteMenuWithoutAnalytics = ({
|
|
|
83
90
|
}, [isFocusLockEnabled, selectedColorIndex, setFocusedIndex, options]);
|
|
84
91
|
return jsx("div", {
|
|
85
92
|
"aria-label": fullLabel,
|
|
86
|
-
role:
|
|
93
|
+
role: isInsideMenu ? 'group' : 'radiogroup'
|
|
87
94
|
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-imported-style-values -- Ignored via go/DSP-18766
|
|
88
95
|
,
|
|
89
96
|
css: [colorPaletteMenuStyles, mode === Mode.Standard && colorPaletteMenuStandardStyles],
|
|
@@ -107,20 +114,25 @@ export const ColorPaletteMenuWithoutAnalytics = ({
|
|
|
107
114
|
value: value,
|
|
108
115
|
checkMarkColor: checkMarkColor,
|
|
109
116
|
isOption: true,
|
|
110
|
-
selected: value === selectedValue.value
|
|
117
|
+
selected: value === selectedValue.value
|
|
118
|
+
}, fg('platform_color_palette-expose-event') ? {
|
|
111
119
|
onClick: handleChange
|
|
112
|
-
}
|
|
120
|
+
} : {
|
|
121
|
+
onClickOld: handleChangeOld
|
|
122
|
+
}, {
|
|
113
123
|
ref: ref => {
|
|
114
124
|
colorCardRefs[index] = ref;
|
|
115
125
|
},
|
|
126
|
+
autoFocus: autoFocus,
|
|
116
127
|
initialFocusRef: value === selectedValue.value ? initialFocusRef : undefined,
|
|
128
|
+
isInsideMenu: isInsideMenu,
|
|
117
129
|
onKeyDown: handleKeyDown
|
|
118
130
|
}))))));
|
|
119
131
|
};
|
|
120
132
|
export default withAnalyticsContext({
|
|
121
133
|
componentName: 'color-picker',
|
|
122
134
|
packageName: "@atlaskit/color-picker",
|
|
123
|
-
packageVersion: "3.3.
|
|
135
|
+
packageVersion: "3.3.2"
|
|
124
136
|
})(withAnalyticsEvents()(ColorPaletteMenuWithoutAnalytics));
|
|
125
137
|
const colorCardWrapperStyles = css({
|
|
126
138
|
display: 'flex',
|
|
@@ -26,7 +26,7 @@ const defaultPopperProps = {
|
|
|
26
26
|
placement: 'bottom-start'
|
|
27
27
|
};
|
|
28
28
|
const packageName = "@atlaskit/color-picker";
|
|
29
|
-
const packageVersion = "3.3.
|
|
29
|
+
const packageVersion = "3.3.2";
|
|
30
30
|
class ColorPickerWithoutAnalyticsBase extends React.Component {
|
|
31
31
|
constructor(...args) {
|
|
32
32
|
super(...args);
|
|
@@ -4,7 +4,6 @@ import _extends from "@babel/runtime/helpers/extends";
|
|
|
4
4
|
* @jsx jsx
|
|
5
5
|
*/
|
|
6
6
|
|
|
7
|
-
import { fg } from '@atlaskit/platform-feature-flags';
|
|
8
7
|
import ColorCard from './ColorCard';
|
|
9
8
|
import { getWidth } from '../utils';
|
|
10
9
|
// eslint-disable-next-line @atlaskit/ui-styling-standard/use-compiled -- Ignored via go/DSP-18766
|
|
@@ -20,7 +19,7 @@ export const MenuList = props => {
|
|
|
20
19
|
} = props;
|
|
21
20
|
return jsx("div", {
|
|
22
21
|
css: colorPaletteContainerStyles,
|
|
23
|
-
role:
|
|
22
|
+
role: "group",
|
|
24
23
|
style: {
|
|
25
24
|
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-imported-style-values -- Ignored via go/DSP-18766
|
|
26
25
|
maxWidth: cols ? getWidth(cols) : undefined
|
|
@@ -3,7 +3,7 @@ import _extends from "@babel/runtime/helpers/extends";
|
|
|
3
3
|
* @jsxRuntime classic
|
|
4
4
|
* @jsx jsx
|
|
5
5
|
*/
|
|
6
|
-
import React, { useCallback,
|
|
6
|
+
import React, { useCallback, useRef, useImperativeHandle, forwardRef } from 'react';
|
|
7
7
|
import EditorDoneIcon from '@atlaskit/icon/glyph/editor/done';
|
|
8
8
|
import Tooltip from '@atlaskit/tooltip';
|
|
9
9
|
import { fg } from '@atlaskit/platform-feature-flags';
|
|
@@ -14,7 +14,11 @@ import { N0, DN600A, B75 } from '@atlaskit/theme/colors';
|
|
|
14
14
|
import { mergeRefs } from 'use-callback-ref';
|
|
15
15
|
var ColorCard = /*#__PURE__*/forwardRef(function (props, componentRef) {
|
|
16
16
|
var type = props.type,
|
|
17
|
+
_props$autoFocus = props.autoFocus,
|
|
18
|
+
autoFocus = _props$autoFocus === void 0 ? true : _props$autoFocus,
|
|
17
19
|
initialFocusRef = props.initialFocusRef,
|
|
20
|
+
_props$isInsideMenu = props.isInsideMenu,
|
|
21
|
+
isInsideMenu = _props$isInsideMenu === void 0 ? true : _props$isInsideMenu,
|
|
18
22
|
value = props.value,
|
|
19
23
|
label = props.label,
|
|
20
24
|
selected = props.selected,
|
|
@@ -23,59 +27,51 @@ var ColorCard = /*#__PURE__*/forwardRef(function (props, componentRef) {
|
|
|
23
27
|
checkMarkColor = _props$checkMarkColor === void 0 ? N0 : _props$checkMarkColor,
|
|
24
28
|
isTabbing = props.isTabbing,
|
|
25
29
|
onClick = props.onClick,
|
|
30
|
+
onClickOld = props.onClickOld,
|
|
26
31
|
onKeyDown = props.onKeyDown;
|
|
27
32
|
var ref = useRef(null);
|
|
28
33
|
var isInitialFocus = useRef(true);
|
|
29
34
|
var isColorPaletteMenu = type === COLOR_PALETTE_MENU;
|
|
30
|
-
var isTabbingIgnored = fg('platform_color_palette_menu_timeline_bar_a11y') ? isColorPaletteMenu : false;
|
|
31
35
|
var handleMouseDown = useCallback(function (event) {
|
|
32
36
|
event.preventDefault();
|
|
33
37
|
}, []);
|
|
34
38
|
var handleClick = useCallback(function (event) {
|
|
35
|
-
if (
|
|
36
|
-
|
|
37
|
-
|
|
39
|
+
if (fg('platform_color_palette-expose-event')) {
|
|
40
|
+
if (onClick) {
|
|
41
|
+
event.preventDefault();
|
|
42
|
+
onClick(event, value);
|
|
43
|
+
}
|
|
44
|
+
} else {
|
|
45
|
+
if (onClickOld) {
|
|
46
|
+
event.preventDefault();
|
|
47
|
+
onClickOld(value);
|
|
48
|
+
}
|
|
38
49
|
}
|
|
39
|
-
}, [onClick, value]);
|
|
50
|
+
}, [onClick, onClickOld, value]);
|
|
40
51
|
var handleKeyDown = useCallback(function (event) {
|
|
41
|
-
if ((
|
|
52
|
+
if ((isColorPaletteMenu || isTabbing === undefined || isTabbing) && (onClickOld && !fg('platform_color_palette-expose-event') || onClick && fg('platform_color_palette-expose-event')) && (event.key === KEY_ENTER || event.key === KEY_SPACE)) {
|
|
42
53
|
event.preventDefault();
|
|
43
54
|
if (isTabbing) {
|
|
44
55
|
event.stopPropagation();
|
|
45
56
|
}
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
if (isColorPaletteMenu) {
|
|
50
|
-
onKeyDown === null || onKeyDown === void 0 || onKeyDown(event);
|
|
51
|
-
} else if (event.key === KEY_TAB) {
|
|
52
|
-
event.stopPropagation();
|
|
53
|
-
event.preventDefault();
|
|
54
|
-
}
|
|
57
|
+
|
|
58
|
+
// Remove optional call on FG cleanup platform_color_palette-expose-event
|
|
59
|
+
fg('platform_color_palette-expose-event') ? onClick === null || onClick === void 0 ? void 0 : onClick(event, value) : onClickOld === null || onClickOld === void 0 ? void 0 : onClickOld(value);
|
|
55
60
|
}
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
if (
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
if (event.key === KEY_TAB) {
|
|
62
|
-
event.stopPropagation();
|
|
63
|
-
event.preventDefault();
|
|
64
|
-
}
|
|
65
|
-
};
|
|
66
|
-
refCurrent === null || refCurrent === void 0 || refCurrent.addEventListener('keydown', handleTabKey);
|
|
67
|
-
return function () {
|
|
68
|
-
refCurrent === null || refCurrent === void 0 || refCurrent.removeEventListener('keydown', handleTabKey);
|
|
69
|
-
};
|
|
61
|
+
if (isColorPaletteMenu) {
|
|
62
|
+
onKeyDown === null || onKeyDown === void 0 || onKeyDown(event);
|
|
63
|
+
} else if (event.key === KEY_TAB) {
|
|
64
|
+
event.preventDefault();
|
|
65
|
+
event.stopPropagation();
|
|
70
66
|
}
|
|
71
|
-
}, []);
|
|
67
|
+
}, [isColorPaletteMenu, isTabbing, value, onClick, onClickOld, onKeyDown]);
|
|
72
68
|
useImperativeHandle(componentRef, function () {
|
|
73
69
|
return {
|
|
74
70
|
focus: function focus() {
|
|
75
|
-
if (
|
|
71
|
+
if (isColorPaletteMenu) {
|
|
76
72
|
if (isInitialFocus.current) {
|
|
77
73
|
var _ref$current;
|
|
78
|
-
!initialFocusRef && ((_ref$current = ref.current) === null || _ref$current === void 0 ? void 0 : _ref$current.focus());
|
|
74
|
+
autoFocus && !initialFocusRef && ((_ref$current = ref.current) === null || _ref$current === void 0 ? void 0 : _ref$current.focus());
|
|
79
75
|
isInitialFocus.current = false;
|
|
80
76
|
} else {
|
|
81
77
|
var _ref$current2;
|
|
@@ -84,18 +80,18 @@ var ColorCard = /*#__PURE__*/forwardRef(function (props, componentRef) {
|
|
|
84
80
|
}
|
|
85
81
|
}
|
|
86
82
|
};
|
|
87
|
-
}, [
|
|
83
|
+
}, [autoFocus, isColorPaletteMenu, initialFocusRef]);
|
|
88
84
|
return jsx(Tooltip, {
|
|
89
85
|
content: label
|
|
90
86
|
}, function (tooltipProps) {
|
|
91
87
|
delete tooltipProps['aria-describedby'];
|
|
92
88
|
return jsx("div", _extends({}, tooltipProps, {
|
|
93
89
|
ref: initialFocusRef ? mergeRefs([ref, tooltipProps.ref, initialFocusRef]) : mergeRefs([ref, tooltipProps.ref]),
|
|
94
|
-
role:
|
|
95
|
-
tabIndex:
|
|
90
|
+
role: isInsideMenu ? 'menuitemradio' : 'radio',
|
|
91
|
+
tabIndex: selected ? 0 : -1,
|
|
96
92
|
"aria-checked": selected,
|
|
97
93
|
"aria-label": label,
|
|
98
|
-
css: [sharedColorContainerStyles, (
|
|
94
|
+
css: [sharedColorContainerStyles, (isColorPaletteMenu || isTabbing === undefined || isTabbing) && colorCardOptionTabbingStyles, focused && (isColorPaletteMenu || !isTabbing) && colorCardOptionFocusedStyles],
|
|
99
95
|
onClick: handleClick,
|
|
100
96
|
onMouseDown: handleMouseDown,
|
|
101
97
|
onKeyDown: handleKeyDown
|
|
@@ -15,10 +15,15 @@ import { css, jsx } from '@emotion/react';
|
|
|
15
15
|
import { COLOR_PALETTE_MENU, KEY_ARROW_UP, KEY_ARROW_DOWN, KEY_ARROW_LEFT, KEY_ARROW_RIGHT, KEY_TAB } from '../constants';
|
|
16
16
|
import { N0, N40 } from '@atlaskit/theme/colors';
|
|
17
17
|
export var ColorPaletteMenuWithoutAnalytics = function ColorPaletteMenuWithoutAnalytics(_ref) {
|
|
18
|
-
var _ref$
|
|
18
|
+
var _ref$autoFocus = _ref.autoFocus,
|
|
19
|
+
autoFocus = _ref$autoFocus === void 0 ? true : _ref$autoFocus,
|
|
20
|
+
_ref$isFocusLockEnabl = _ref.isFocusLockEnabled,
|
|
19
21
|
isFocusLockEnabled = _ref$isFocusLockEnabl === void 0 ? true : _ref$isFocusLockEnabl,
|
|
22
|
+
_ref$isInsideMenu = _ref.isInsideMenu,
|
|
23
|
+
isInsideMenu = _ref$isInsideMenu === void 0 ? true : _ref$isInsideMenu,
|
|
20
24
|
createAnalyticsEvent = _ref.createAnalyticsEvent,
|
|
21
25
|
onChange = _ref.onChange,
|
|
26
|
+
onChangeOld = _ref.onChangeOld,
|
|
22
27
|
palette = _ref.palette,
|
|
23
28
|
selectedColor = _ref.selectedColor,
|
|
24
29
|
checkMarkColor = _ref.checkMarkColor,
|
|
@@ -50,7 +55,7 @@ export var ColorPaletteMenuWithoutAnalytics = function ColorPaletteMenuWithoutAn
|
|
|
50
55
|
attributes: {
|
|
51
56
|
componentName: 'color-picker',
|
|
52
57
|
packageName: "@atlaskit/color-picker",
|
|
53
|
-
packageVersion: "3.3.
|
|
58
|
+
packageVersion: "3.3.2"
|
|
54
59
|
}
|
|
55
60
|
})(createAnalyticsEvent);
|
|
56
61
|
}
|
|
@@ -59,8 +64,12 @@ export var ColorPaletteMenuWithoutAnalytics = function ColorPaletteMenuWithoutAn
|
|
|
59
64
|
var colorCardRefs = useMemo(function () {
|
|
60
65
|
return [];
|
|
61
66
|
}, []);
|
|
62
|
-
var
|
|
63
|
-
|
|
67
|
+
var handleChangeOld = function handleChangeOld(value) {
|
|
68
|
+
onChangeOld === null || onChangeOld === void 0 || onChangeOld(value, changeAnalyticsCaller());
|
|
69
|
+
};
|
|
70
|
+
var handleChange = function handleChange(event, value) {
|
|
71
|
+
// Set to required on FG cleanup platform_color_palette-expose-event
|
|
72
|
+
onChange === null || onChange === void 0 || onChange(event, value, changeAnalyticsCaller());
|
|
64
73
|
};
|
|
65
74
|
useEffect(function () {
|
|
66
75
|
var _colorCardRefs$focuse;
|
|
@@ -96,7 +105,7 @@ export var ColorPaletteMenuWithoutAnalytics = function ColorPaletteMenuWithoutAn
|
|
|
96
105
|
}, [isFocusLockEnabled, selectedColorIndex, setFocusedIndex, options]);
|
|
97
106
|
return jsx("div", {
|
|
98
107
|
"aria-label": fullLabel,
|
|
99
|
-
role:
|
|
108
|
+
role: isInsideMenu ? 'group' : 'radiogroup'
|
|
100
109
|
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-imported-style-values -- Ignored via go/DSP-18766
|
|
101
110
|
,
|
|
102
111
|
css: [colorPaletteMenuStyles, mode === Mode.Standard && colorPaletteMenuStandardStyles],
|
|
@@ -120,13 +129,18 @@ export var ColorPaletteMenuWithoutAnalytics = function ColorPaletteMenuWithoutAn
|
|
|
120
129
|
value: value,
|
|
121
130
|
checkMarkColor: checkMarkColor,
|
|
122
131
|
isOption: true,
|
|
123
|
-
selected: value === selectedValue.value
|
|
132
|
+
selected: value === selectedValue.value
|
|
133
|
+
}, fg('platform_color_palette-expose-event') ? {
|
|
124
134
|
onClick: handleChange
|
|
125
|
-
}
|
|
135
|
+
} : {
|
|
136
|
+
onClickOld: handleChangeOld
|
|
137
|
+
}, {
|
|
126
138
|
ref: function ref(_ref4) {
|
|
127
139
|
colorCardRefs[index] = _ref4;
|
|
128
140
|
},
|
|
141
|
+
autoFocus: autoFocus,
|
|
129
142
|
initialFocusRef: value === selectedValue.value ? initialFocusRef : undefined,
|
|
143
|
+
isInsideMenu: isInsideMenu,
|
|
130
144
|
onKeyDown: handleKeyDown
|
|
131
145
|
})));
|
|
132
146
|
})));
|
|
@@ -134,7 +148,7 @@ export var ColorPaletteMenuWithoutAnalytics = function ColorPaletteMenuWithoutAn
|
|
|
134
148
|
export default withAnalyticsContext({
|
|
135
149
|
componentName: 'color-picker',
|
|
136
150
|
packageName: "@atlaskit/color-picker",
|
|
137
|
-
packageVersion: "3.3.
|
|
151
|
+
packageVersion: "3.3.2"
|
|
138
152
|
})(withAnalyticsEvents()(ColorPaletteMenuWithoutAnalytics));
|
|
139
153
|
var colorCardWrapperStyles = css({
|
|
140
154
|
display: 'flex',
|
|
@@ -34,7 +34,7 @@ var defaultPopperProps = {
|
|
|
34
34
|
placement: 'bottom-start'
|
|
35
35
|
};
|
|
36
36
|
var packageName = "@atlaskit/color-picker";
|
|
37
|
-
var packageVersion = "3.3.
|
|
37
|
+
var packageVersion = "3.3.2";
|
|
38
38
|
var ColorPickerWithoutAnalyticsBase = /*#__PURE__*/function (_React$Component) {
|
|
39
39
|
_inherits(ColorPickerWithoutAnalyticsBase, _React$Component);
|
|
40
40
|
var _super = _createSuper(ColorPickerWithoutAnalyticsBase);
|
|
@@ -4,7 +4,6 @@ import _extends from "@babel/runtime/helpers/extends";
|
|
|
4
4
|
* @jsx jsx
|
|
5
5
|
*/
|
|
6
6
|
|
|
7
|
-
import { fg } from '@atlaskit/platform-feature-flags';
|
|
8
7
|
import ColorCard from './ColorCard';
|
|
9
8
|
import { getWidth } from '../utils';
|
|
10
9
|
// eslint-disable-next-line @atlaskit/ui-styling-standard/use-compiled -- Ignored via go/DSP-18766
|
|
@@ -16,7 +15,7 @@ export var MenuList = function MenuList(props) {
|
|
|
16
15
|
children = props.children;
|
|
17
16
|
return jsx("div", {
|
|
18
17
|
css: colorPaletteContainerStyles,
|
|
19
|
-
role:
|
|
18
|
+
role: "group",
|
|
20
19
|
style: {
|
|
21
20
|
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-imported-style-values -- Ignored via go/DSP-18766
|
|
22
21
|
maxWidth: cols ? getWidth(cols) : undefined
|
|
@@ -5,11 +5,14 @@
|
|
|
5
5
|
import React, { type KeyboardEventHandler, type Ref } from 'react';
|
|
6
6
|
import type { ColorCardType } from '../types';
|
|
7
7
|
export interface Props {
|
|
8
|
+
autoFocus?: boolean;
|
|
8
9
|
initialFocusRef?: Ref<HTMLDivElement>;
|
|
10
|
+
isInsideMenu?: boolean;
|
|
9
11
|
type: ColorCardType;
|
|
10
12
|
value: string;
|
|
11
13
|
label: string;
|
|
12
|
-
|
|
14
|
+
onClickOld?: (value: string) => void;
|
|
15
|
+
onClick?: (event: React.MouseEvent | React.KeyboardEvent, value: string) => void;
|
|
13
16
|
onKeyDown?: KeyboardEventHandler<HTMLElement>;
|
|
14
17
|
checkMarkColor?: string;
|
|
15
18
|
selected?: boolean;
|
|
@@ -2,12 +2,17 @@
|
|
|
2
2
|
* @jsxRuntime classic
|
|
3
3
|
* @jsx jsx
|
|
4
4
|
*/
|
|
5
|
-
import { type Ref } from 'react';
|
|
5
|
+
import { type KeyboardEvent, type MouseEvent, type Ref } from 'react';
|
|
6
6
|
import { Mode, type Palette } from '../types';
|
|
7
|
+
import { type UIAnalyticsEvent } from '@atlaskit/analytics-next';
|
|
7
8
|
import { jsx } from '@emotion/react';
|
|
8
9
|
export type Props = {
|
|
10
|
+
/** the toggle that decides if the selected color will be automatically focused on load */
|
|
11
|
+
autoFocus?: boolean;
|
|
9
12
|
/** the toggle that decides if users can tab outside the color picker (arrow keys will always cycle the focus) */
|
|
10
13
|
isFocusLockEnabled?: boolean;
|
|
14
|
+
/** the toggle that decides if menu-related assistive technology should be applied */
|
|
15
|
+
isInsideMenu?: boolean;
|
|
11
16
|
/** color picker button label */
|
|
12
17
|
label?: string;
|
|
13
18
|
/** list of available colors */
|
|
@@ -18,8 +23,10 @@ export type Props = {
|
|
|
18
23
|
cols: number;
|
|
19
24
|
/** color of checkmark on selected color */
|
|
20
25
|
checkMarkColor?: string;
|
|
26
|
+
/** onChange handler deprecated */
|
|
27
|
+
onChangeOld?: (value: string, analyticsEvent?: UIAnalyticsEvent) => void;
|
|
21
28
|
/** onChange handler */
|
|
22
|
-
onChange:
|
|
29
|
+
onChange?: (event: MouseEvent | KeyboardEvent, value: string, analyticsEvent?: UIAnalyticsEvent) => void;
|
|
23
30
|
/** You should not be accessing this prop under any circumstances. It is provided by @atlaskit/analytics-next. */
|
|
24
31
|
createAnalyticsEvent?: any;
|
|
25
32
|
/** style of the color-picker, either 'Compact' or 'Standard', default value is 'Standard' */
|
|
@@ -27,6 +34,6 @@ export type Props = {
|
|
|
27
34
|
/** the ref object (usually the currently selected color palette) that consumer can leverage to focus on load */
|
|
28
35
|
initialFocusRef?: Ref<HTMLDivElement>;
|
|
29
36
|
};
|
|
30
|
-
export declare const ColorPaletteMenuWithoutAnalytics: ({ isFocusLockEnabled, createAnalyticsEvent, onChange, palette, selectedColor, checkMarkColor, label, cols, mode, initialFocusRef, }: Props) => jsx.JSX.Element;
|
|
31
|
-
declare const _default: import("react").ForwardRefExoticComponent<Pick<Omit<Props, keyof import("@atlaskit/analytics-next").WithAnalyticsEventsProps> & import("react").RefAttributes<any> & import("@atlaskit/analytics-next").WithContextProps, "label" | "analyticsContext" | "key" | "onChange" | "initialFocusRef" | "checkMarkColor" | "cols" | "palette" | "selectedColor" | "isFocusLockEnabled" | "mode"> & import("react").RefAttributes<any>>;
|
|
37
|
+
export declare const ColorPaletteMenuWithoutAnalytics: ({ autoFocus, isFocusLockEnabled, isInsideMenu, createAnalyticsEvent, onChange, onChangeOld, palette, selectedColor, checkMarkColor, label, cols, mode, initialFocusRef, }: Props) => jsx.JSX.Element;
|
|
38
|
+
declare const _default: import("react").ForwardRefExoticComponent<Pick<Omit<Props, keyof import("@atlaskit/analytics-next").WithAnalyticsEventsProps> & import("react").RefAttributes<any> & import("@atlaskit/analytics-next").WithContextProps, "label" | "analyticsContext" | "key" | "autoFocus" | "onChange" | "initialFocusRef" | "isInsideMenu" | "checkMarkColor" | "cols" | "palette" | "selectedColor" | "isFocusLockEnabled" | "onChangeOld" | "mode"> & import("react").RefAttributes<any>>;
|
|
32
39
|
export default _default;
|
|
@@ -5,11 +5,14 @@
|
|
|
5
5
|
import React, { type KeyboardEventHandler, type Ref } from 'react';
|
|
6
6
|
import type { ColorCardType } from '../types';
|
|
7
7
|
export interface Props {
|
|
8
|
+
autoFocus?: boolean;
|
|
8
9
|
initialFocusRef?: Ref<HTMLDivElement>;
|
|
10
|
+
isInsideMenu?: boolean;
|
|
9
11
|
type: ColorCardType;
|
|
10
12
|
value: string;
|
|
11
13
|
label: string;
|
|
12
|
-
|
|
14
|
+
onClickOld?: (value: string) => void;
|
|
15
|
+
onClick?: (event: React.MouseEvent | React.KeyboardEvent, value: string) => void;
|
|
13
16
|
onKeyDown?: KeyboardEventHandler<HTMLElement>;
|
|
14
17
|
checkMarkColor?: string;
|
|
15
18
|
selected?: boolean;
|
|
@@ -2,12 +2,17 @@
|
|
|
2
2
|
* @jsxRuntime classic
|
|
3
3
|
* @jsx jsx
|
|
4
4
|
*/
|
|
5
|
-
import { type Ref } from 'react';
|
|
5
|
+
import { type KeyboardEvent, type MouseEvent, type Ref } from 'react';
|
|
6
6
|
import { Mode, type Palette } from '../types';
|
|
7
|
+
import { type UIAnalyticsEvent } from '@atlaskit/analytics-next';
|
|
7
8
|
import { jsx } from '@emotion/react';
|
|
8
9
|
export type Props = {
|
|
10
|
+
/** the toggle that decides if the selected color will be automatically focused on load */
|
|
11
|
+
autoFocus?: boolean;
|
|
9
12
|
/** the toggle that decides if users can tab outside the color picker (arrow keys will always cycle the focus) */
|
|
10
13
|
isFocusLockEnabled?: boolean;
|
|
14
|
+
/** the toggle that decides if menu-related assistive technology should be applied */
|
|
15
|
+
isInsideMenu?: boolean;
|
|
11
16
|
/** color picker button label */
|
|
12
17
|
label?: string;
|
|
13
18
|
/** list of available colors */
|
|
@@ -18,8 +23,10 @@ export type Props = {
|
|
|
18
23
|
cols: number;
|
|
19
24
|
/** color of checkmark on selected color */
|
|
20
25
|
checkMarkColor?: string;
|
|
26
|
+
/** onChange handler deprecated */
|
|
27
|
+
onChangeOld?: (value: string, analyticsEvent?: UIAnalyticsEvent) => void;
|
|
21
28
|
/** onChange handler */
|
|
22
|
-
onChange:
|
|
29
|
+
onChange?: (event: MouseEvent | KeyboardEvent, value: string, analyticsEvent?: UIAnalyticsEvent) => void;
|
|
23
30
|
/** You should not be accessing this prop under any circumstances. It is provided by @atlaskit/analytics-next. */
|
|
24
31
|
createAnalyticsEvent?: any;
|
|
25
32
|
/** style of the color-picker, either 'Compact' or 'Standard', default value is 'Standard' */
|
|
@@ -27,6 +34,6 @@ export type Props = {
|
|
|
27
34
|
/** the ref object (usually the currently selected color palette) that consumer can leverage to focus on load */
|
|
28
35
|
initialFocusRef?: Ref<HTMLDivElement>;
|
|
29
36
|
};
|
|
30
|
-
export declare const ColorPaletteMenuWithoutAnalytics: ({ isFocusLockEnabled, createAnalyticsEvent, onChange, palette, selectedColor, checkMarkColor, label, cols, mode, initialFocusRef, }: Props) => jsx.JSX.Element;
|
|
31
|
-
declare const _default: import("react").ForwardRefExoticComponent<Pick<Omit<Props, keyof import("@atlaskit/analytics-next").WithAnalyticsEventsProps> & import("react").RefAttributes<any> & import("@atlaskit/analytics-next").WithContextProps, "label" | "analyticsContext" | "key" | "onChange" | "initialFocusRef" | "checkMarkColor" | "cols" | "palette" | "selectedColor" | "isFocusLockEnabled" | "mode"> & import("react").RefAttributes<any>>;
|
|
37
|
+
export declare const ColorPaletteMenuWithoutAnalytics: ({ autoFocus, isFocusLockEnabled, isInsideMenu, createAnalyticsEvent, onChange, onChangeOld, palette, selectedColor, checkMarkColor, label, cols, mode, initialFocusRef, }: Props) => jsx.JSX.Element;
|
|
38
|
+
declare const _default: import("react").ForwardRefExoticComponent<Pick<Omit<Props, keyof import("@atlaskit/analytics-next").WithAnalyticsEventsProps> & import("react").RefAttributes<any> & import("@atlaskit/analytics-next").WithContextProps, "label" | "analyticsContext" | "key" | "autoFocus" | "onChange" | "initialFocusRef" | "isInsideMenu" | "checkMarkColor" | "cols" | "palette" | "selectedColor" | "isFocusLockEnabled" | "onChangeOld" | "mode"> & import("react").RefAttributes<any>>;
|
|
32
39
|
export default _default;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atlaskit/color-picker",
|
|
3
|
-
"version": "3.3.
|
|
3
|
+
"version": "3.3.2",
|
|
4
4
|
"description": "Jira Color Picker Component",
|
|
5
5
|
"publishConfig": {
|
|
6
6
|
"registry": "https://registry.npmjs.org/"
|
|
@@ -32,9 +32,9 @@
|
|
|
32
32
|
"@atlaskit/analytics-next": "^10.1.0",
|
|
33
33
|
"@atlaskit/icon": "^22.18.0",
|
|
34
34
|
"@atlaskit/platform-feature-flags": "0.3.0",
|
|
35
|
-
"@atlaskit/select": "^17.
|
|
35
|
+
"@atlaskit/select": "^17.19.0",
|
|
36
36
|
"@atlaskit/theme": "^13.0.0",
|
|
37
|
-
"@atlaskit/tokens": "^1.
|
|
37
|
+
"@atlaskit/tokens": "^1.60.0",
|
|
38
38
|
"@atlaskit/tooltip": "^18.7.0",
|
|
39
39
|
"@babel/runtime": "^7.0.0",
|
|
40
40
|
"@emotion/react": "^11.7.1",
|
|
@@ -75,7 +75,7 @@
|
|
|
75
75
|
}
|
|
76
76
|
},
|
|
77
77
|
"platform-feature-flags": {
|
|
78
|
-
"
|
|
78
|
+
"platform_color_palette-expose-event": {
|
|
79
79
|
"type": "boolean"
|
|
80
80
|
},
|
|
81
81
|
"platform-design-system-dsp-20821-color-pickr-focus": {
|