@atlaskit/color-picker 3.2.27 → 3.3.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +22 -0
- package/dist/cjs/components/ColorCard.js +18 -8
- package/dist/cjs/components/ColorPaletteMenu.js +13 -5
- package/dist/cjs/components/ColorPicker.js +3 -3
- package/dist/cjs/components/Trigger.js +2 -1
- package/dist/cjs/index.js +1 -1
- package/dist/es2019/components/ColorCard.js +17 -7
- package/dist/es2019/components/ColorPaletteMenu.js +13 -5
- package/dist/es2019/components/ColorPicker.js +1 -1
- package/dist/es2019/components/Trigger.js +2 -1
- package/dist/esm/components/ColorCard.js +17 -7
- package/dist/esm/components/ColorPaletteMenu.js +13 -5
- package/dist/esm/components/ColorPicker.js +2 -2
- package/dist/esm/components/Trigger.js +2 -1
- package/dist/types/components/ColorCard.d.ts +2 -1
- package/dist/types/components/ColorPaletteMenu.d.ts +7 -4
- package/dist/types-ts4.5/components/ColorCard.d.ts +2 -1
- package/dist/types-ts4.5/components/ColorPaletteMenu.d.ts +7 -4
- package/package.json +10 -4
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,27 @@
|
|
|
1
1
|
# @atlaskit/color-picker
|
|
2
2
|
|
|
3
|
+
## 3.3.1
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- [#141027](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/141027)
|
|
8
|
+
[`0d28a5b25436c`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/0d28a5b25436c) -
|
|
9
|
+
[ux] Technical change - Expose event in onChange callback of ColorPaletteMenu
|
|
10
|
+
- Updated dependencies
|
|
11
|
+
|
|
12
|
+
## 3.3.0
|
|
13
|
+
|
|
14
|
+
### Minor Changes
|
|
15
|
+
|
|
16
|
+
- [#134622](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/134622)
|
|
17
|
+
[`66b5d35764e86`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/66b5d35764e86) -
|
|
18
|
+
Added feature flag for hiding trigger focus styles on expand
|
|
19
|
+
(https://product-fabric.atlassian.net/browse/DSP-20821)
|
|
20
|
+
|
|
21
|
+
### Patch Changes
|
|
22
|
+
|
|
23
|
+
- Updated dependencies
|
|
24
|
+
|
|
3
25
|
## 3.2.27
|
|
4
26
|
|
|
5
27
|
### Patch Changes
|
|
@@ -16,7 +16,7 @@ var _react2 = require("@emotion/react");
|
|
|
16
16
|
var _colors = require("@atlaskit/theme/colors");
|
|
17
17
|
var _useCallbackRef = require("use-callback-ref");
|
|
18
18
|
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); }
|
|
19
|
-
function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != _typeof(e) && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u &&
|
|
19
|
+
function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != _typeof(e) && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && {}.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
|
|
20
20
|
/**
|
|
21
21
|
* @jsxRuntime classic
|
|
22
22
|
* @jsx jsx
|
|
@@ -35,6 +35,7 @@ var ColorCard = /*#__PURE__*/(0, _react.forwardRef)(function (props, componentRe
|
|
|
35
35
|
checkMarkColor = _props$checkMarkColor === void 0 ? _colors.N0 : _props$checkMarkColor,
|
|
36
36
|
isTabbing = props.isTabbing,
|
|
37
37
|
onClick = props.onClick,
|
|
38
|
+
onClickOld = props.onClickOld,
|
|
38
39
|
onKeyDown = props.onKeyDown;
|
|
39
40
|
var ref = (0, _react.useRef)(null);
|
|
40
41
|
var isInitialFocus = (0, _react.useRef)(true);
|
|
@@ -44,18 +45,27 @@ var ColorCard = /*#__PURE__*/(0, _react.forwardRef)(function (props, componentRe
|
|
|
44
45
|
event.preventDefault();
|
|
45
46
|
}, []);
|
|
46
47
|
var handleClick = (0, _react.useCallback)(function (event) {
|
|
47
|
-
if (
|
|
48
|
-
|
|
49
|
-
|
|
48
|
+
if ((0, _platformFeatureFlags.fg)('platform_color_palette-expose-event')) {
|
|
49
|
+
if (onClick) {
|
|
50
|
+
event.preventDefault();
|
|
51
|
+
onClick(event, value);
|
|
52
|
+
}
|
|
53
|
+
} else {
|
|
54
|
+
if (onClickOld) {
|
|
55
|
+
event.preventDefault();
|
|
56
|
+
onClickOld(value);
|
|
57
|
+
}
|
|
50
58
|
}
|
|
51
|
-
}, [onClick, value]);
|
|
59
|
+
}, [onClick, onClickOld, value]);
|
|
52
60
|
var handleKeyDown = (0, _react.useCallback)(function (event) {
|
|
53
|
-
if ((isTabbingIgnored || isTabbing === undefined || isTabbing) && onClick && (event.key === _constants.KEY_ENTER || event.key === _constants.KEY_SPACE)) {
|
|
61
|
+
if ((isTabbingIgnored || 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
62
|
event.preventDefault();
|
|
55
63
|
if (isTabbing) {
|
|
56
64
|
event.stopPropagation();
|
|
57
65
|
}
|
|
58
|
-
|
|
66
|
+
|
|
67
|
+
// Remove optional call on FG cleanup platform_color_palette-expose-event
|
|
68
|
+
(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);
|
|
59
69
|
}
|
|
60
70
|
if ((0, _platformFeatureFlags.fg)('platform_color_palette_menu_timeline_bar_a11y')) {
|
|
61
71
|
if (isColorPaletteMenu) {
|
|
@@ -65,7 +75,7 @@ var ColorCard = /*#__PURE__*/(0, _react.forwardRef)(function (props, componentRe
|
|
|
65
75
|
event.preventDefault();
|
|
66
76
|
}
|
|
67
77
|
}
|
|
68
|
-
}, [isTabbing,
|
|
78
|
+
}, [isTabbingIgnored, isTabbing, onClick, onClickOld, value, isColorPaletteMenu, onKeyDown]);
|
|
69
79
|
(0, _react.useEffect)(function () {
|
|
70
80
|
if (!(0, _platformFeatureFlags.fg)('platform_color_palette_menu_timeline_bar_a11y')) {
|
|
71
81
|
var refCurrent = ref.current;
|
|
@@ -28,6 +28,7 @@ var ColorPaletteMenuWithoutAnalytics = exports.ColorPaletteMenuWithoutAnalytics
|
|
|
28
28
|
isFocusLockEnabled = _ref$isFocusLockEnabl === void 0 ? true : _ref$isFocusLockEnabl,
|
|
29
29
|
createAnalyticsEvent = _ref.createAnalyticsEvent,
|
|
30
30
|
onChange = _ref.onChange,
|
|
31
|
+
onChangeOld = _ref.onChangeOld,
|
|
31
32
|
palette = _ref.palette,
|
|
32
33
|
selectedColor = _ref.selectedColor,
|
|
33
34
|
checkMarkColor = _ref.checkMarkColor,
|
|
@@ -59,7 +60,7 @@ var ColorPaletteMenuWithoutAnalytics = exports.ColorPaletteMenuWithoutAnalytics
|
|
|
59
60
|
attributes: {
|
|
60
61
|
componentName: 'color-picker',
|
|
61
62
|
packageName: "@atlaskit/color-picker",
|
|
62
|
-
packageVersion: "3.
|
|
63
|
+
packageVersion: "3.3.1"
|
|
63
64
|
}
|
|
64
65
|
})(createAnalyticsEvent);
|
|
65
66
|
}
|
|
@@ -68,8 +69,12 @@ var ColorPaletteMenuWithoutAnalytics = exports.ColorPaletteMenuWithoutAnalytics
|
|
|
68
69
|
var colorCardRefs = (0, _react.useMemo)(function () {
|
|
69
70
|
return [];
|
|
70
71
|
}, []);
|
|
71
|
-
var
|
|
72
|
-
|
|
72
|
+
var handleChangeOld = function handleChangeOld(value) {
|
|
73
|
+
onChangeOld === null || onChangeOld === void 0 || onChangeOld(value, changeAnalyticsCaller());
|
|
74
|
+
};
|
|
75
|
+
var handleChange = function handleChange(event, value) {
|
|
76
|
+
// Set to required on FG cleanup platform_color_palette-expose-event
|
|
77
|
+
onChange === null || onChange === void 0 || onChange(event, value, changeAnalyticsCaller());
|
|
73
78
|
};
|
|
74
79
|
(0, _react.useEffect)(function () {
|
|
75
80
|
var _colorCardRefs$focuse;
|
|
@@ -129,8 +134,11 @@ var ColorPaletteMenuWithoutAnalytics = exports.ColorPaletteMenuWithoutAnalytics
|
|
|
129
134
|
value: value,
|
|
130
135
|
checkMarkColor: checkMarkColor,
|
|
131
136
|
isOption: true,
|
|
132
|
-
selected: value === selectedValue.value
|
|
137
|
+
selected: value === selectedValue.value
|
|
138
|
+
}, (0, _platformFeatureFlags.fg)('platform_color_palette-expose-event') ? {
|
|
133
139
|
onClick: handleChange
|
|
140
|
+
} : {
|
|
141
|
+
onClickOld: handleChangeOld
|
|
134
142
|
}, (0, _platformFeatureFlags.fg)('platform_color_palette_menu_timeline_bar_a11y') && {
|
|
135
143
|
ref: function ref(_ref4) {
|
|
136
144
|
colorCardRefs[index] = _ref4;
|
|
@@ -143,7 +151,7 @@ var ColorPaletteMenuWithoutAnalytics = exports.ColorPaletteMenuWithoutAnalytics
|
|
|
143
151
|
var _default = exports.default = (0, _analyticsNext.withAnalyticsContext)({
|
|
144
152
|
componentName: 'color-picker',
|
|
145
153
|
packageName: "@atlaskit/color-picker",
|
|
146
|
-
packageVersion: "3.
|
|
154
|
+
packageVersion: "3.3.1"
|
|
147
155
|
})((0, _analyticsNext.withAnalyticsEvents)()(ColorPaletteMenuWithoutAnalytics));
|
|
148
156
|
var colorCardWrapperStyles = (0, _react2.css)({
|
|
149
157
|
display: 'flex',
|
|
@@ -25,8 +25,8 @@ var _react2 = require("@emotion/react");
|
|
|
25
25
|
var _reactIntlNext = require("react-intl-next");
|
|
26
26
|
var _messages = _interopRequireDefault(require("../messages"));
|
|
27
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); }
|
|
28
|
-
function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != _typeof(e) && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u &&
|
|
29
|
-
function _createSuper(
|
|
28
|
+
function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != _typeof(e) && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && {}.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
|
|
29
|
+
function _createSuper(t) { var r = _isNativeReflectConstruct(); return function () { var e, o = (0, _getPrototypeOf2.default)(t); if (r) { var s = (0, _getPrototypeOf2.default)(this).constructor; e = Reflect.construct(o, arguments, s); } else e = o.apply(this, arguments); return (0, _possibleConstructorReturn2.default)(this, e); }; }
|
|
30
30
|
function _isNativeReflectConstruct() { try { var t = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); } catch (t) {} return (_isNativeReflectConstruct = function _isNativeReflectConstruct() { return !!t; })(); } /**
|
|
31
31
|
* @jsxRuntime classic
|
|
32
32
|
* @jsx jsx
|
|
@@ -42,7 +42,7 @@ var defaultPopperProps = {
|
|
|
42
42
|
placement: 'bottom-start'
|
|
43
43
|
};
|
|
44
44
|
var packageName = "@atlaskit/color-picker";
|
|
45
|
-
var packageVersion = "3.
|
|
45
|
+
var packageVersion = "3.3.1";
|
|
46
46
|
var ColorPickerWithoutAnalyticsBase = /*#__PURE__*/function (_React$Component) {
|
|
47
47
|
(0, _inherits2.default)(ColorPickerWithoutAnalyticsBase, _React$Component);
|
|
48
48
|
var _super = _createSuper(ColorPickerWithoutAnalyticsBase);
|
|
@@ -7,6 +7,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
7
7
|
exports.default = void 0;
|
|
8
8
|
var _react = require("react");
|
|
9
9
|
var _tooltip = _interopRequireDefault(require("@atlaskit/tooltip"));
|
|
10
|
+
var _platformFeatureFlags = require("@atlaskit/platform-feature-flags");
|
|
10
11
|
var _react2 = require("@emotion/react");
|
|
11
12
|
var _colors = require("@atlaskit/theme/colors");
|
|
12
13
|
/**
|
|
@@ -38,7 +39,7 @@ var ColorCard = function ColorCard(_ref) {
|
|
|
38
39
|
return (0, _react2.jsx)(_tooltip.default, {
|
|
39
40
|
content: label
|
|
40
41
|
}, (0, _react2.jsx)("button", {
|
|
41
|
-
css: [sharedColorContainerStyles, swatchSize === 'small' ? smallColorContainerSize : defaultColorContainerSize, colorCardButtonStyles, expanded && colorCardButtonFocusedStyles],
|
|
42
|
+
css: [sharedColorContainerStyles, swatchSize === 'small' ? smallColorContainerSize : defaultColorContainerSize, colorCardButtonStyles, expanded && !(0, _platformFeatureFlags.fg)('platform-design-system-dsp-20821-color-pickr-focus') && colorCardButtonFocusedStyles],
|
|
42
43
|
disabled: isDisabled,
|
|
43
44
|
onClick: handleClick,
|
|
44
45
|
onMouseDown: handleMouseDown,
|
package/dist/cjs/index.js
CHANGED
|
@@ -27,7 +27,7 @@ var _ColorPicker = _interopRequireWildcard(require("./components/ColorPicker"));
|
|
|
27
27
|
var _types = require("./types");
|
|
28
28
|
var _ColorPaletteMenu = _interopRequireWildcard(require("./components/ColorPaletteMenu"));
|
|
29
29
|
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); }
|
|
30
|
-
function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != _typeof(e) && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u &&
|
|
30
|
+
function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != _typeof(e) && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && {}.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
|
|
31
31
|
var Compact = exports.Compact = _types.Mode.Compact,
|
|
32
32
|
Standard = exports.Standard = _types.Mode.Standard;
|
|
33
33
|
var _default = exports.default = _ColorPicker.default;
|
|
@@ -23,6 +23,7 @@ const ColorCard = /*#__PURE__*/forwardRef((props, componentRef) => {
|
|
|
23
23
|
checkMarkColor = N0,
|
|
24
24
|
isTabbing,
|
|
25
25
|
onClick,
|
|
26
|
+
onClickOld,
|
|
26
27
|
onKeyDown
|
|
27
28
|
} = props;
|
|
28
29
|
const ref = useRef(null);
|
|
@@ -33,18 +34,27 @@ const ColorCard = /*#__PURE__*/forwardRef((props, componentRef) => {
|
|
|
33
34
|
event.preventDefault();
|
|
34
35
|
}, []);
|
|
35
36
|
const handleClick = useCallback(event => {
|
|
36
|
-
if (
|
|
37
|
-
|
|
38
|
-
|
|
37
|
+
if (fg('platform_color_palette-expose-event')) {
|
|
38
|
+
if (onClick) {
|
|
39
|
+
event.preventDefault();
|
|
40
|
+
onClick(event, value);
|
|
41
|
+
}
|
|
42
|
+
} else {
|
|
43
|
+
if (onClickOld) {
|
|
44
|
+
event.preventDefault();
|
|
45
|
+
onClickOld(value);
|
|
46
|
+
}
|
|
39
47
|
}
|
|
40
|
-
}, [onClick, value]);
|
|
48
|
+
}, [onClick, onClickOld, value]);
|
|
41
49
|
const handleKeyDown = useCallback(event => {
|
|
42
|
-
if ((isTabbingIgnored || isTabbing === undefined || isTabbing) && onClick && (event.key === KEY_ENTER || event.key === KEY_SPACE)) {
|
|
50
|
+
if ((isTabbingIgnored || 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
51
|
event.preventDefault();
|
|
44
52
|
if (isTabbing) {
|
|
45
53
|
event.stopPropagation();
|
|
46
54
|
}
|
|
47
|
-
|
|
55
|
+
|
|
56
|
+
// Remove optional call on FG cleanup platform_color_palette-expose-event
|
|
57
|
+
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);
|
|
48
58
|
}
|
|
49
59
|
if (fg('platform_color_palette_menu_timeline_bar_a11y')) {
|
|
50
60
|
if (isColorPaletteMenu) {
|
|
@@ -54,7 +64,7 @@ const ColorCard = /*#__PURE__*/forwardRef((props, componentRef) => {
|
|
|
54
64
|
event.preventDefault();
|
|
55
65
|
}
|
|
56
66
|
}
|
|
57
|
-
}, [isTabbing,
|
|
67
|
+
}, [isTabbingIgnored, isTabbing, onClick, onClickOld, value, isColorPaletteMenu, onKeyDown]);
|
|
58
68
|
useEffect(() => {
|
|
59
69
|
if (!fg('platform_color_palette_menu_timeline_bar_a11y')) {
|
|
60
70
|
const refCurrent = ref.current;
|
|
@@ -17,6 +17,7 @@ export const ColorPaletteMenuWithoutAnalytics = ({
|
|
|
17
17
|
isFocusLockEnabled = true,
|
|
18
18
|
createAnalyticsEvent,
|
|
19
19
|
onChange,
|
|
20
|
+
onChangeOld,
|
|
20
21
|
palette,
|
|
21
22
|
selectedColor,
|
|
22
23
|
checkMarkColor,
|
|
@@ -43,15 +44,19 @@ export const ColorPaletteMenuWithoutAnalytics = ({
|
|
|
43
44
|
attributes: {
|
|
44
45
|
componentName: 'color-picker',
|
|
45
46
|
packageName: "@atlaskit/color-picker",
|
|
46
|
-
packageVersion: "3.
|
|
47
|
+
packageVersion: "3.3.1"
|
|
47
48
|
}
|
|
48
49
|
})(createAnalyticsEvent);
|
|
49
50
|
}
|
|
50
51
|
return undefined;
|
|
51
52
|
};
|
|
52
53
|
const colorCardRefs = useMemo(() => [], []);
|
|
53
|
-
const
|
|
54
|
-
|
|
54
|
+
const handleChangeOld = value => {
|
|
55
|
+
onChangeOld === null || onChangeOld === void 0 ? void 0 : onChangeOld(value, changeAnalyticsCaller());
|
|
56
|
+
};
|
|
57
|
+
const handleChange = (event, value) => {
|
|
58
|
+
// Set to required on FG cleanup platform_color_palette-expose-event
|
|
59
|
+
onChange === null || onChange === void 0 ? void 0 : onChange(event, value, changeAnalyticsCaller());
|
|
55
60
|
};
|
|
56
61
|
useEffect(() => {
|
|
57
62
|
var _colorCardRefs$focuse;
|
|
@@ -107,8 +112,11 @@ export const ColorPaletteMenuWithoutAnalytics = ({
|
|
|
107
112
|
value: value,
|
|
108
113
|
checkMarkColor: checkMarkColor,
|
|
109
114
|
isOption: true,
|
|
110
|
-
selected: value === selectedValue.value
|
|
115
|
+
selected: value === selectedValue.value
|
|
116
|
+
}, fg('platform_color_palette-expose-event') ? {
|
|
111
117
|
onClick: handleChange
|
|
118
|
+
} : {
|
|
119
|
+
onClickOld: handleChangeOld
|
|
112
120
|
}, fg('platform_color_palette_menu_timeline_bar_a11y') && {
|
|
113
121
|
ref: ref => {
|
|
114
122
|
colorCardRefs[index] = ref;
|
|
@@ -120,7 +128,7 @@ export const ColorPaletteMenuWithoutAnalytics = ({
|
|
|
120
128
|
export default withAnalyticsContext({
|
|
121
129
|
componentName: 'color-picker',
|
|
122
130
|
packageName: "@atlaskit/color-picker",
|
|
123
|
-
packageVersion: "3.
|
|
131
|
+
packageVersion: "3.3.1"
|
|
124
132
|
})(withAnalyticsEvents()(ColorPaletteMenuWithoutAnalytics));
|
|
125
133
|
const colorCardWrapperStyles = css({
|
|
126
134
|
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.
|
|
29
|
+
const packageVersion = "3.3.1";
|
|
30
30
|
class ColorPickerWithoutAnalyticsBase extends React.Component {
|
|
31
31
|
constructor(...args) {
|
|
32
32
|
super(...args);
|
|
@@ -4,6 +4,7 @@
|
|
|
4
4
|
*/
|
|
5
5
|
import { useCallback } from 'react';
|
|
6
6
|
import Tooltip from '@atlaskit/tooltip';
|
|
7
|
+
import { fg } from '@atlaskit/platform-feature-flags';
|
|
7
8
|
// eslint-disable-next-line @atlaskit/ui-styling-standard/use-compiled -- Ignored via go/DSP-18766
|
|
8
9
|
import { css, jsx } from '@emotion/react';
|
|
9
10
|
import { B100, DN600A, N0 } from '@atlaskit/theme/colors';
|
|
@@ -29,7 +30,7 @@ const ColorCard = ({
|
|
|
29
30
|
return jsx(Tooltip, {
|
|
30
31
|
content: label
|
|
31
32
|
}, jsx("button", {
|
|
32
|
-
css: [sharedColorContainerStyles, swatchSize === 'small' ? smallColorContainerSize : defaultColorContainerSize, colorCardButtonStyles, expanded && colorCardButtonFocusedStyles],
|
|
33
|
+
css: [sharedColorContainerStyles, swatchSize === 'small' ? smallColorContainerSize : defaultColorContainerSize, colorCardButtonStyles, expanded && !fg('platform-design-system-dsp-20821-color-pickr-focus') && colorCardButtonFocusedStyles],
|
|
33
34
|
disabled: isDisabled,
|
|
34
35
|
onClick: handleClick,
|
|
35
36
|
onMouseDown: handleMouseDown,
|
|
@@ -23,6 +23,7 @@ var ColorCard = /*#__PURE__*/forwardRef(function (props, componentRef) {
|
|
|
23
23
|
checkMarkColor = _props$checkMarkColor === void 0 ? N0 : _props$checkMarkColor,
|
|
24
24
|
isTabbing = props.isTabbing,
|
|
25
25
|
onClick = props.onClick,
|
|
26
|
+
onClickOld = props.onClickOld,
|
|
26
27
|
onKeyDown = props.onKeyDown;
|
|
27
28
|
var ref = useRef(null);
|
|
28
29
|
var isInitialFocus = useRef(true);
|
|
@@ -32,18 +33,27 @@ var ColorCard = /*#__PURE__*/forwardRef(function (props, componentRef) {
|
|
|
32
33
|
event.preventDefault();
|
|
33
34
|
}, []);
|
|
34
35
|
var handleClick = useCallback(function (event) {
|
|
35
|
-
if (
|
|
36
|
-
|
|
37
|
-
|
|
36
|
+
if (fg('platform_color_palette-expose-event')) {
|
|
37
|
+
if (onClick) {
|
|
38
|
+
event.preventDefault();
|
|
39
|
+
onClick(event, value);
|
|
40
|
+
}
|
|
41
|
+
} else {
|
|
42
|
+
if (onClickOld) {
|
|
43
|
+
event.preventDefault();
|
|
44
|
+
onClickOld(value);
|
|
45
|
+
}
|
|
38
46
|
}
|
|
39
|
-
}, [onClick, value]);
|
|
47
|
+
}, [onClick, onClickOld, value]);
|
|
40
48
|
var handleKeyDown = useCallback(function (event) {
|
|
41
|
-
if ((isTabbingIgnored || isTabbing === undefined || isTabbing) && onClick && (event.key === KEY_ENTER || event.key === KEY_SPACE)) {
|
|
49
|
+
if ((isTabbingIgnored || 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
50
|
event.preventDefault();
|
|
43
51
|
if (isTabbing) {
|
|
44
52
|
event.stopPropagation();
|
|
45
53
|
}
|
|
46
|
-
|
|
54
|
+
|
|
55
|
+
// Remove optional call on FG cleanup platform_color_palette-expose-event
|
|
56
|
+
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);
|
|
47
57
|
}
|
|
48
58
|
if (fg('platform_color_palette_menu_timeline_bar_a11y')) {
|
|
49
59
|
if (isColorPaletteMenu) {
|
|
@@ -53,7 +63,7 @@ var ColorCard = /*#__PURE__*/forwardRef(function (props, componentRef) {
|
|
|
53
63
|
event.preventDefault();
|
|
54
64
|
}
|
|
55
65
|
}
|
|
56
|
-
}, [isTabbing,
|
|
66
|
+
}, [isTabbingIgnored, isTabbing, onClick, onClickOld, value, isColorPaletteMenu, onKeyDown]);
|
|
57
67
|
useEffect(function () {
|
|
58
68
|
if (!fg('platform_color_palette_menu_timeline_bar_a11y')) {
|
|
59
69
|
var refCurrent = ref.current;
|
|
@@ -19,6 +19,7 @@ export var ColorPaletteMenuWithoutAnalytics = function ColorPaletteMenuWithoutAn
|
|
|
19
19
|
isFocusLockEnabled = _ref$isFocusLockEnabl === void 0 ? true : _ref$isFocusLockEnabl,
|
|
20
20
|
createAnalyticsEvent = _ref.createAnalyticsEvent,
|
|
21
21
|
onChange = _ref.onChange,
|
|
22
|
+
onChangeOld = _ref.onChangeOld,
|
|
22
23
|
palette = _ref.palette,
|
|
23
24
|
selectedColor = _ref.selectedColor,
|
|
24
25
|
checkMarkColor = _ref.checkMarkColor,
|
|
@@ -50,7 +51,7 @@ export var ColorPaletteMenuWithoutAnalytics = function ColorPaletteMenuWithoutAn
|
|
|
50
51
|
attributes: {
|
|
51
52
|
componentName: 'color-picker',
|
|
52
53
|
packageName: "@atlaskit/color-picker",
|
|
53
|
-
packageVersion: "3.
|
|
54
|
+
packageVersion: "3.3.1"
|
|
54
55
|
}
|
|
55
56
|
})(createAnalyticsEvent);
|
|
56
57
|
}
|
|
@@ -59,8 +60,12 @@ export var ColorPaletteMenuWithoutAnalytics = function ColorPaletteMenuWithoutAn
|
|
|
59
60
|
var colorCardRefs = useMemo(function () {
|
|
60
61
|
return [];
|
|
61
62
|
}, []);
|
|
62
|
-
var
|
|
63
|
-
|
|
63
|
+
var handleChangeOld = function handleChangeOld(value) {
|
|
64
|
+
onChangeOld === null || onChangeOld === void 0 || onChangeOld(value, changeAnalyticsCaller());
|
|
65
|
+
};
|
|
66
|
+
var handleChange = function handleChange(event, value) {
|
|
67
|
+
// Set to required on FG cleanup platform_color_palette-expose-event
|
|
68
|
+
onChange === null || onChange === void 0 || onChange(event, value, changeAnalyticsCaller());
|
|
64
69
|
};
|
|
65
70
|
useEffect(function () {
|
|
66
71
|
var _colorCardRefs$focuse;
|
|
@@ -120,8 +125,11 @@ export var ColorPaletteMenuWithoutAnalytics = function ColorPaletteMenuWithoutAn
|
|
|
120
125
|
value: value,
|
|
121
126
|
checkMarkColor: checkMarkColor,
|
|
122
127
|
isOption: true,
|
|
123
|
-
selected: value === selectedValue.value
|
|
128
|
+
selected: value === selectedValue.value
|
|
129
|
+
}, fg('platform_color_palette-expose-event') ? {
|
|
124
130
|
onClick: handleChange
|
|
131
|
+
} : {
|
|
132
|
+
onClickOld: handleChangeOld
|
|
125
133
|
}, fg('platform_color_palette_menu_timeline_bar_a11y') && {
|
|
126
134
|
ref: function ref(_ref4) {
|
|
127
135
|
colorCardRefs[index] = _ref4;
|
|
@@ -134,7 +142,7 @@ export var ColorPaletteMenuWithoutAnalytics = function ColorPaletteMenuWithoutAn
|
|
|
134
142
|
export default withAnalyticsContext({
|
|
135
143
|
componentName: 'color-picker',
|
|
136
144
|
packageName: "@atlaskit/color-picker",
|
|
137
|
-
packageVersion: "3.
|
|
145
|
+
packageVersion: "3.3.1"
|
|
138
146
|
})(withAnalyticsEvents()(ColorPaletteMenuWithoutAnalytics));
|
|
139
147
|
var colorCardWrapperStyles = css({
|
|
140
148
|
display: 'flex',
|
|
@@ -6,7 +6,7 @@ import _inherits from "@babel/runtime/helpers/inherits";
|
|
|
6
6
|
import _possibleConstructorReturn from "@babel/runtime/helpers/possibleConstructorReturn";
|
|
7
7
|
import _getPrototypeOf from "@babel/runtime/helpers/getPrototypeOf";
|
|
8
8
|
import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
9
|
-
function _createSuper(
|
|
9
|
+
function _createSuper(t) { var r = _isNativeReflectConstruct(); return function () { var e, o = _getPrototypeOf(t); if (r) { var s = _getPrototypeOf(this).constructor; e = Reflect.construct(o, arguments, s); } else e = o.apply(this, arguments); return _possibleConstructorReturn(this, e); }; }
|
|
10
10
|
function _isNativeReflectConstruct() { try { var t = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); } catch (t) {} return (_isNativeReflectConstruct = function _isNativeReflectConstruct() { return !!t; })(); }
|
|
11
11
|
/**
|
|
12
12
|
* @jsxRuntime classic
|
|
@@ -34,7 +34,7 @@ var defaultPopperProps = {
|
|
|
34
34
|
placement: 'bottom-start'
|
|
35
35
|
};
|
|
36
36
|
var packageName = "@atlaskit/color-picker";
|
|
37
|
-
var packageVersion = "3.
|
|
37
|
+
var packageVersion = "3.3.1";
|
|
38
38
|
var ColorPickerWithoutAnalyticsBase = /*#__PURE__*/function (_React$Component) {
|
|
39
39
|
_inherits(ColorPickerWithoutAnalyticsBase, _React$Component);
|
|
40
40
|
var _super = _createSuper(ColorPickerWithoutAnalyticsBase);
|
|
@@ -4,6 +4,7 @@
|
|
|
4
4
|
*/
|
|
5
5
|
import { useCallback } from 'react';
|
|
6
6
|
import Tooltip from '@atlaskit/tooltip';
|
|
7
|
+
import { fg } from '@atlaskit/platform-feature-flags';
|
|
7
8
|
// eslint-disable-next-line @atlaskit/ui-styling-standard/use-compiled -- Ignored via go/DSP-18766
|
|
8
9
|
import { css, jsx } from '@emotion/react';
|
|
9
10
|
import { B100, DN600A, N0 } from '@atlaskit/theme/colors';
|
|
@@ -29,7 +30,7 @@ var ColorCard = function ColorCard(_ref) {
|
|
|
29
30
|
return jsx(Tooltip, {
|
|
30
31
|
content: label
|
|
31
32
|
}, jsx("button", {
|
|
32
|
-
css: [sharedColorContainerStyles, swatchSize === 'small' ? smallColorContainerSize : defaultColorContainerSize, colorCardButtonStyles, expanded && colorCardButtonFocusedStyles],
|
|
33
|
+
css: [sharedColorContainerStyles, swatchSize === 'small' ? smallColorContainerSize : defaultColorContainerSize, colorCardButtonStyles, expanded && !fg('platform-design-system-dsp-20821-color-pickr-focus') && colorCardButtonFocusedStyles],
|
|
33
34
|
disabled: isDisabled,
|
|
34
35
|
onClick: handleClick,
|
|
35
36
|
onMouseDown: handleMouseDown,
|
|
@@ -9,7 +9,8 @@ export interface Props {
|
|
|
9
9
|
type: ColorCardType;
|
|
10
10
|
value: string;
|
|
11
11
|
label: string;
|
|
12
|
-
|
|
12
|
+
onClickOld?: (value: string) => void;
|
|
13
|
+
onClick?: (event: React.MouseEvent | React.KeyboardEvent, value: string) => void;
|
|
13
14
|
onKeyDown?: KeyboardEventHandler<HTMLElement>;
|
|
14
15
|
checkMarkColor?: string;
|
|
15
16
|
selected?: boolean;
|
|
@@ -2,8 +2,9 @@
|
|
|
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 = {
|
|
9
10
|
/** the toggle that decides if users can tab outside the color picker (arrow keys will always cycle the focus) */
|
|
@@ -18,8 +19,10 @@ export type Props = {
|
|
|
18
19
|
cols: number;
|
|
19
20
|
/** color of checkmark on selected color */
|
|
20
21
|
checkMarkColor?: string;
|
|
22
|
+
/** onChange handler deprecated */
|
|
23
|
+
onChangeOld?: (value: string, analyticsEvent?: UIAnalyticsEvent) => void;
|
|
21
24
|
/** onChange handler */
|
|
22
|
-
onChange:
|
|
25
|
+
onChange?: (event: MouseEvent | KeyboardEvent, value: string, analyticsEvent?: UIAnalyticsEvent) => void;
|
|
23
26
|
/** You should not be accessing this prop under any circumstances. It is provided by @atlaskit/analytics-next. */
|
|
24
27
|
createAnalyticsEvent?: any;
|
|
25
28
|
/** style of the color-picker, either 'Compact' or 'Standard', default value is 'Standard' */
|
|
@@ -27,6 +30,6 @@ export type Props = {
|
|
|
27
30
|
/** the ref object (usually the currently selected color palette) that consumer can leverage to focus on load */
|
|
28
31
|
initialFocusRef?: Ref<HTMLDivElement>;
|
|
29
32
|
};
|
|
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>>;
|
|
33
|
+
export declare const ColorPaletteMenuWithoutAnalytics: ({ isFocusLockEnabled, createAnalyticsEvent, onChange, onChangeOld, palette, selectedColor, checkMarkColor, label, cols, mode, initialFocusRef, }: Props) => jsx.JSX.Element;
|
|
34
|
+
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" | "onChangeOld" | "mode"> & import("react").RefAttributes<any>>;
|
|
32
35
|
export default _default;
|
|
@@ -9,7 +9,8 @@ export interface Props {
|
|
|
9
9
|
type: ColorCardType;
|
|
10
10
|
value: string;
|
|
11
11
|
label: string;
|
|
12
|
-
|
|
12
|
+
onClickOld?: (value: string) => void;
|
|
13
|
+
onClick?: (event: React.MouseEvent | React.KeyboardEvent, value: string) => void;
|
|
13
14
|
onKeyDown?: KeyboardEventHandler<HTMLElement>;
|
|
14
15
|
checkMarkColor?: string;
|
|
15
16
|
selected?: boolean;
|
|
@@ -2,8 +2,9 @@
|
|
|
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 = {
|
|
9
10
|
/** the toggle that decides if users can tab outside the color picker (arrow keys will always cycle the focus) */
|
|
@@ -18,8 +19,10 @@ export type Props = {
|
|
|
18
19
|
cols: number;
|
|
19
20
|
/** color of checkmark on selected color */
|
|
20
21
|
checkMarkColor?: string;
|
|
22
|
+
/** onChange handler deprecated */
|
|
23
|
+
onChangeOld?: (value: string, analyticsEvent?: UIAnalyticsEvent) => void;
|
|
21
24
|
/** onChange handler */
|
|
22
|
-
onChange:
|
|
25
|
+
onChange?: (event: MouseEvent | KeyboardEvent, value: string, analyticsEvent?: UIAnalyticsEvent) => void;
|
|
23
26
|
/** You should not be accessing this prop under any circumstances. It is provided by @atlaskit/analytics-next. */
|
|
24
27
|
createAnalyticsEvent?: any;
|
|
25
28
|
/** style of the color-picker, either 'Compact' or 'Standard', default value is 'Standard' */
|
|
@@ -27,6 +30,6 @@ export type Props = {
|
|
|
27
30
|
/** the ref object (usually the currently selected color palette) that consumer can leverage to focus on load */
|
|
28
31
|
initialFocusRef?: Ref<HTMLDivElement>;
|
|
29
32
|
};
|
|
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>>;
|
|
33
|
+
export declare const ColorPaletteMenuWithoutAnalytics: ({ isFocusLockEnabled, createAnalyticsEvent, onChange, onChangeOld, palette, selectedColor, checkMarkColor, label, cols, mode, initialFocusRef, }: Props) => jsx.JSX.Element;
|
|
34
|
+
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" | "onChangeOld" | "mode"> & import("react").RefAttributes<any>>;
|
|
32
35
|
export default _default;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atlaskit/color-picker",
|
|
3
|
-
"version": "3.
|
|
3
|
+
"version": "3.3.1",
|
|
4
4
|
"description": "Jira Color Picker Component",
|
|
5
5
|
"publishConfig": {
|
|
6
6
|
"registry": "https://registry.npmjs.org/"
|
|
@@ -30,11 +30,11 @@
|
|
|
30
30
|
},
|
|
31
31
|
"dependencies": {
|
|
32
32
|
"@atlaskit/analytics-next": "^10.1.0",
|
|
33
|
-
"@atlaskit/icon": "^22.
|
|
33
|
+
"@atlaskit/icon": "^22.18.0",
|
|
34
34
|
"@atlaskit/platform-feature-flags": "0.3.0",
|
|
35
|
-
"@atlaskit/select": "^17.
|
|
35
|
+
"@atlaskit/select": "^17.18.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",
|
|
@@ -77,6 +77,12 @@
|
|
|
77
77
|
"platform-feature-flags": {
|
|
78
78
|
"platform_color_palette_menu_timeline_bar_a11y": {
|
|
79
79
|
"type": "boolean"
|
|
80
|
+
},
|
|
81
|
+
"platform_color_palette-expose-event": {
|
|
82
|
+
"type": "boolean"
|
|
83
|
+
},
|
|
84
|
+
"platform-design-system-dsp-20821-color-pickr-focus": {
|
|
85
|
+
"type": "boolean"
|
|
80
86
|
}
|
|
81
87
|
}
|
|
82
88
|
}
|