@atlaskit/color-picker 3.2.24 → 3.2.26

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 CHANGED
@@ -1,5 +1,24 @@
1
1
  # @atlaskit/color-picker
2
2
 
3
+ ## 3.2.26
4
+
5
+ ### Patch Changes
6
+
7
+ - [#132551](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/132551)
8
+ [`793d8a11244a8`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/793d8a11244a8) -
9
+ Improve initial focus on the color picker when loaded
10
+
11
+ ## 3.2.25
12
+
13
+ ### Patch Changes
14
+
15
+ - [#132178](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/132178)
16
+ [`93caf7dc621cc`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/93caf7dc621cc) -
17
+ Add support for consumers to set initial focus in color picker
18
+ - [#132178](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/132178)
19
+ [`93caf7dc621cc`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/93caf7dc621cc) -
20
+ Implemented roving tabIndex for color palatte menu
21
+
3
22
  ## 3.2.24
4
23
 
5
24
  ### Patch Changes
@@ -25,7 +25,8 @@ function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e;
25
25
  // eslint-disable-next-line @atlaskit/ui-styling-standard/use-compiled -- Ignored via go/DSP-18766
26
26
 
27
27
  var ColorCard = /*#__PURE__*/(0, _react.forwardRef)(function (props, componentRef) {
28
- var value = props.value,
28
+ var initialFocusRef = props.initialFocusRef,
29
+ value = props.value,
29
30
  label = props.label,
30
31
  selected = props.selected,
31
32
  focused = props.focused,
@@ -33,9 +34,9 @@ var ColorCard = /*#__PURE__*/(0, _react.forwardRef)(function (props, componentRe
33
34
  checkMarkColor = _props$checkMarkColor === void 0 ? _colors.N0 : _props$checkMarkColor,
34
35
  isTabbing = props.isTabbing,
35
36
  onClick = props.onClick,
36
- onKeyDown = props.onKeyDown,
37
- onTabPress = props.onTabPress;
37
+ onKeyDown = props.onKeyDown;
38
38
  var ref = (0, _react.useRef)(null);
39
+ var isInitialFocus = (0, _react.useRef)(true);
39
40
  var handleMouseDown = (0, _react.useCallback)(function (event) {
40
41
  event.preventDefault();
41
42
  }, []);
@@ -57,9 +58,6 @@ var ColorCard = /*#__PURE__*/(0, _react.forwardRef)(function (props, componentRe
57
58
  }, [isTabbing, onClick, value]);
58
59
  var handleKeyDown = (0, _react.useCallback)(function (event) {
59
60
  var key = event.key;
60
- if (key === 'Tab') {
61
- onTabPress === null || onTabPress === void 0 || onTabPress(event.shiftKey);
62
- }
63
61
  if ((isTabbing === undefined || isTabbing) && (key === _constants.KEY_ENTER || key === _constants.KEY_SPACE)) {
64
62
  event.preventDefault();
65
63
  if (isTabbing) {
@@ -68,7 +66,7 @@ var ColorCard = /*#__PURE__*/(0, _react.forwardRef)(function (props, componentRe
68
66
  onClick === null || onClick === void 0 || onClick(value);
69
67
  }
70
68
  onKeyDown === null || onKeyDown === void 0 || onKeyDown(event);
71
- }, [isTabbing, onTabPress, onClick, onKeyDown, value]);
69
+ }, [isTabbing, onClick, onKeyDown, value]);
72
70
 
73
71
  // TODO: Remove this useEffect when the feature flag 'platform_color_palette_menu_timeline_bar_a11y' is cleaned up
74
72
  (0, _react.useEffect)(function () {
@@ -89,25 +87,33 @@ var ColorCard = /*#__PURE__*/(0, _react.forwardRef)(function (props, componentRe
89
87
  (0, _react.useImperativeHandle)(componentRef, function () {
90
88
  return {
91
89
  focus: function focus() {
92
- var _ref$current;
93
- (_ref$current = ref.current) === null || _ref$current === void 0 || _ref$current.focus();
90
+ if ((0, _platformFeatureFlags.fg)('platform_color_palette_menu_timeline_bar_a11y')) {
91
+ if (isInitialFocus.current) {
92
+ var _ref$current;
93
+ !initialFocusRef && ((_ref$current = ref.current) === null || _ref$current === void 0 ? void 0 : _ref$current.focus());
94
+ isInitialFocus.current = false;
95
+ } else {
96
+ var _ref$current2;
97
+ (_ref$current2 = ref.current) === null || _ref$current2 === void 0 || _ref$current2.focus();
98
+ }
99
+ }
94
100
  }
95
101
  };
96
- }, []);
102
+ }, [initialFocusRef]);
97
103
  return (0, _react2.jsx)(_tooltip.default, {
98
104
  content: label
99
105
  }, function (tooltipProps) {
100
106
  delete tooltipProps['aria-describedby'];
101
107
  return (0, _react2.jsx)("div", (0, _extends2.default)({}, tooltipProps, {
102
- css: [sharedColorContainerStyles, (isTabbing === undefined || isTabbing) && colorCardOptionTabbingStyles, focused && !isTabbing && colorCardOptionFocusedStyles],
103
- onClick: handleClick,
104
- onMouseDown: handleMouseDown,
105
- onKeyDown: (0, _platformFeatureFlags.fg)('platform_color_palette_menu_timeline_bar_a11y') ? handleKeyDown : handleKeyDownOld,
108
+ ref: initialFocusRef ? (0, _useCallbackRef.mergeRefs)([ref, tooltipProps.ref, initialFocusRef]) : (0, _useCallbackRef.mergeRefs)([ref, tooltipProps.ref]),
106
109
  role: (0, _platformFeatureFlags.fg)('platform_color_palette_menu_timeline_bar_a11y') ? 'menuitemradio' : 'radio',
110
+ tabIndex: (0, _platformFeatureFlags.fg)('platform_color_palette_menu_timeline_bar_a11y') ? selected ? 0 : -1 : 0,
107
111
  "aria-checked": selected,
108
112
  "aria-label": label,
109
- tabIndex: 0,
110
- ref: (0, _useCallbackRef.mergeRefs)([ref, tooltipProps.ref])
113
+ css: [sharedColorContainerStyles, (isTabbing === undefined || isTabbing) && colorCardOptionTabbingStyles, focused && !isTabbing && colorCardOptionFocusedStyles],
114
+ onClick: handleClick,
115
+ onMouseDown: handleMouseDown,
116
+ onKeyDown: (0, _platformFeatureFlags.fg)('platform_color_palette_menu_timeline_bar_a11y') ? handleKeyDown : handleKeyDownOld
111
117
  }), (0, _react2.jsx)("div", {
112
118
  css: colorCardWrapperStyles
113
119
  }, (0, _react2.jsx)("div", {
@@ -33,7 +33,8 @@ var ColorPaletteMenuWithoutAnalytics = exports.ColorPaletteMenuWithoutAnalytics
33
33
  _ref$cols = _ref.cols,
34
34
  cols = _ref$cols === void 0 ? 6 : _ref$cols,
35
35
  _ref$mode = _ref.mode,
36
- mode = _ref$mode === void 0 ? _types.Mode.Standard : _ref$mode;
36
+ mode = _ref$mode === void 0 ? _types.Mode.Standard : _ref$mode,
37
+ initialFocusRef = _ref.initialFocusRef;
37
38
  var createAndFireEventOnAtlaskit = (0, _analyticsNext.createAndFireEvent)('atlaskit');
38
39
  var changeAnalyticsCaller = function changeAnalyticsCaller() {
39
40
  if (createAnalyticsEvent) {
@@ -43,7 +44,7 @@ var ColorPaletteMenuWithoutAnalytics = exports.ColorPaletteMenuWithoutAnalytics
43
44
  attributes: {
44
45
  componentName: 'color-picker',
45
46
  packageName: "@atlaskit/color-picker",
46
- packageVersion: "3.2.24"
47
+ packageVersion: "3.2.26"
47
48
  }
48
49
  })(createAnalyticsEvent);
49
50
  }
@@ -89,10 +90,6 @@ var ColorPaletteMenuWithoutAnalytics = exports.ColorPaletteMenuWithoutAnalytics
89
90
  break;
90
91
  }
91
92
  }, [setFocusedIndex, options]);
92
- var onTabPress = function onTabPress() {
93
- var backwards = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false;
94
- setFocusedIndex(backwards ? 0 : options.length - 1);
95
- };
96
93
  return (0, _react2.jsx)("div", {
97
94
  "aria-label": fullLabel,
98
95
  role: (0, _platformFeatureFlags.fg)('platform_color_palette_menu_timeline_bar_a11y') ? 'group' : 'radiogroup'
@@ -124,7 +121,7 @@ var ColorPaletteMenuWithoutAnalytics = exports.ColorPaletteMenuWithoutAnalytics
124
121
  ref: function ref(_ref4) {
125
122
  return colorCardRefs[index] = _ref4;
126
123
  },
127
- onTabPress: onTabPress,
124
+ initialFocusRef: value === selectedValue.value ? initialFocusRef : undefined,
128
125
  onKeyDown: handleKeyDown
129
126
  })));
130
127
  })));
@@ -132,7 +129,7 @@ var ColorPaletteMenuWithoutAnalytics = exports.ColorPaletteMenuWithoutAnalytics
132
129
  var _default = exports.default = (0, _analyticsNext.withAnalyticsContext)({
133
130
  componentName: 'color-picker',
134
131
  packageName: "@atlaskit/color-picker",
135
- packageVersion: "3.2.24"
132
+ packageVersion: "3.2.26"
136
133
  })((0, _analyticsNext.withAnalyticsEvents)()(ColorPaletteMenuWithoutAnalytics));
137
134
  var colorCardWrapperStyles = (0, _react2.css)({
138
135
  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.2.24";
45
+ var packageVersion = "3.2.26";
46
46
  var ColorPickerWithoutAnalyticsBase = /*#__PURE__*/function (_React$Component) {
47
47
  (0, _inherits2.default)(ColorPickerWithoutAnalyticsBase, _React$Component);
48
48
  var _super = _createSuper(ColorPickerWithoutAnalyticsBase);
@@ -14,6 +14,7 @@ import { N0, DN600A, B75 } from '@atlaskit/theme/colors';
14
14
  import { mergeRefs } from 'use-callback-ref';
15
15
  const ColorCard = /*#__PURE__*/forwardRef((props, componentRef) => {
16
16
  const {
17
+ initialFocusRef,
17
18
  value,
18
19
  label,
19
20
  selected,
@@ -21,10 +22,10 @@ const ColorCard = /*#__PURE__*/forwardRef((props, componentRef) => {
21
22
  checkMarkColor = N0,
22
23
  isTabbing,
23
24
  onClick,
24
- onKeyDown,
25
- onTabPress
25
+ onKeyDown
26
26
  } = props;
27
27
  const ref = useRef(null);
28
+ const isInitialFocus = useRef(true);
28
29
  const handleMouseDown = useCallback(event => {
29
30
  event.preventDefault();
30
31
  }, []);
@@ -50,9 +51,6 @@ const ColorCard = /*#__PURE__*/forwardRef((props, componentRef) => {
50
51
  const {
51
52
  key
52
53
  } = event;
53
- if (key === 'Tab') {
54
- onTabPress === null || onTabPress === void 0 ? void 0 : onTabPress(event.shiftKey);
55
- }
56
54
  if ((isTabbing === undefined || isTabbing) && (key === KEY_ENTER || key === KEY_SPACE)) {
57
55
  event.preventDefault();
58
56
  if (isTabbing) {
@@ -61,7 +59,7 @@ const ColorCard = /*#__PURE__*/forwardRef((props, componentRef) => {
61
59
  onClick === null || onClick === void 0 ? void 0 : onClick(value);
62
60
  }
63
61
  onKeyDown === null || onKeyDown === void 0 ? void 0 : onKeyDown(event);
64
- }, [isTabbing, onTabPress, onClick, onKeyDown, value]);
62
+ }, [isTabbing, onClick, onKeyDown, value]);
65
63
 
66
64
  // TODO: Remove this useEffect when the feature flag 'platform_color_palette_menu_timeline_bar_a11y' is cleaned up
67
65
  useEffect(() => {
@@ -81,24 +79,32 @@ const ColorCard = /*#__PURE__*/forwardRef((props, componentRef) => {
81
79
  }, []);
82
80
  useImperativeHandle(componentRef, () => ({
83
81
  focus: () => {
84
- var _ref$current;
85
- (_ref$current = ref.current) === null || _ref$current === void 0 ? void 0 : _ref$current.focus();
82
+ if (fg('platform_color_palette_menu_timeline_bar_a11y')) {
83
+ if (isInitialFocus.current) {
84
+ var _ref$current;
85
+ !initialFocusRef && ((_ref$current = ref.current) === null || _ref$current === void 0 ? void 0 : _ref$current.focus());
86
+ isInitialFocus.current = false;
87
+ } else {
88
+ var _ref$current2;
89
+ (_ref$current2 = ref.current) === null || _ref$current2 === void 0 ? void 0 : _ref$current2.focus();
90
+ }
91
+ }
86
92
  }
87
- }), []);
93
+ }), [initialFocusRef]);
88
94
  return jsx(Tooltip, {
89
95
  content: label
90
96
  }, tooltipProps => {
91
97
  delete tooltipProps['aria-describedby'];
92
98
  return jsx("div", _extends({}, tooltipProps, {
93
- css: [sharedColorContainerStyles, (isTabbing === undefined || isTabbing) && colorCardOptionTabbingStyles, focused && !isTabbing && colorCardOptionFocusedStyles],
94
- onClick: handleClick,
95
- onMouseDown: handleMouseDown,
96
- onKeyDown: fg('platform_color_palette_menu_timeline_bar_a11y') ? handleKeyDown : handleKeyDownOld,
99
+ ref: initialFocusRef ? mergeRefs([ref, tooltipProps.ref, initialFocusRef]) : mergeRefs([ref, tooltipProps.ref]),
97
100
  role: fg('platform_color_palette_menu_timeline_bar_a11y') ? 'menuitemradio' : 'radio',
101
+ tabIndex: fg('platform_color_palette_menu_timeline_bar_a11y') ? selected ? 0 : -1 : 0,
98
102
  "aria-checked": selected,
99
103
  "aria-label": label,
100
- tabIndex: 0,
101
- ref: mergeRefs([ref, tooltipProps.ref])
104
+ css: [sharedColorContainerStyles, (isTabbing === undefined || isTabbing) && colorCardOptionTabbingStyles, focused && !isTabbing && colorCardOptionFocusedStyles],
105
+ onClick: handleClick,
106
+ onMouseDown: handleMouseDown,
107
+ onKeyDown: fg('platform_color_palette_menu_timeline_bar_a11y') ? handleKeyDown : handleKeyDownOld
102
108
  }), jsx("div", {
103
109
  css: colorCardWrapperStyles
104
110
  }, jsx("div", {
@@ -20,7 +20,8 @@ export const ColorPaletteMenuWithoutAnalytics = ({
20
20
  checkMarkColor,
21
21
  label = 'Color picker',
22
22
  cols = 6,
23
- mode = Mode.Standard
23
+ mode = Mode.Standard,
24
+ initialFocusRef
24
25
  }) => {
25
26
  const createAndFireEventOnAtlaskit = createAndFireEvent('atlaskit');
26
27
  const changeAnalyticsCaller = () => {
@@ -31,7 +32,7 @@ export const ColorPaletteMenuWithoutAnalytics = ({
31
32
  attributes: {
32
33
  componentName: 'color-picker',
33
34
  packageName: "@atlaskit/color-picker",
34
- packageVersion: "3.2.24"
35
+ packageVersion: "3.2.26"
35
36
  }
36
37
  })(createAnalyticsEvent);
37
38
  }
@@ -68,9 +69,6 @@ export const ColorPaletteMenuWithoutAnalytics = ({
68
69
  break;
69
70
  }
70
71
  }, [setFocusedIndex, options]);
71
- const onTabPress = (backwards = false) => {
72
- setFocusedIndex(backwards ? 0 : options.length - 1);
73
- };
74
72
  return jsx("div", {
75
73
  "aria-label": fullLabel,
76
74
  role: fg('platform_color_palette_menu_timeline_bar_a11y') ? 'group' : 'radiogroup'
@@ -100,14 +98,14 @@ export const ColorPaletteMenuWithoutAnalytics = ({
100
98
  onClick: handleChange
101
99
  }, fg('platform_color_palette_menu_timeline_bar_a11y') && {
102
100
  ref: ref => colorCardRefs[index] = ref,
103
- onTabPress,
101
+ initialFocusRef: value === selectedValue.value ? initialFocusRef : undefined,
104
102
  onKeyDown: handleKeyDown
105
103
  }))))));
106
104
  };
107
105
  export default withAnalyticsContext({
108
106
  componentName: 'color-picker',
109
107
  packageName: "@atlaskit/color-picker",
110
- packageVersion: "3.2.24"
108
+ packageVersion: "3.2.26"
111
109
  })(withAnalyticsEvents()(ColorPaletteMenuWithoutAnalytics));
112
110
  const colorCardWrapperStyles = css({
113
111
  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.2.24";
29
+ const packageVersion = "3.2.26";
30
30
  class ColorPickerWithoutAnalyticsBase extends React.Component {
31
31
  constructor(...args) {
32
32
  super(...args);
@@ -13,7 +13,8 @@ import { css, jsx } from '@emotion/react';
13
13
  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
- var value = props.value,
16
+ var initialFocusRef = props.initialFocusRef,
17
+ value = props.value,
17
18
  label = props.label,
18
19
  selected = props.selected,
19
20
  focused = props.focused,
@@ -21,9 +22,9 @@ var ColorCard = /*#__PURE__*/forwardRef(function (props, componentRef) {
21
22
  checkMarkColor = _props$checkMarkColor === void 0 ? N0 : _props$checkMarkColor,
22
23
  isTabbing = props.isTabbing,
23
24
  onClick = props.onClick,
24
- onKeyDown = props.onKeyDown,
25
- onTabPress = props.onTabPress;
25
+ onKeyDown = props.onKeyDown;
26
26
  var ref = useRef(null);
27
+ var isInitialFocus = useRef(true);
27
28
  var handleMouseDown = useCallback(function (event) {
28
29
  event.preventDefault();
29
30
  }, []);
@@ -45,9 +46,6 @@ var ColorCard = /*#__PURE__*/forwardRef(function (props, componentRef) {
45
46
  }, [isTabbing, onClick, value]);
46
47
  var handleKeyDown = useCallback(function (event) {
47
48
  var key = event.key;
48
- if (key === 'Tab') {
49
- onTabPress === null || onTabPress === void 0 || onTabPress(event.shiftKey);
50
- }
51
49
  if ((isTabbing === undefined || isTabbing) && (key === KEY_ENTER || key === KEY_SPACE)) {
52
50
  event.preventDefault();
53
51
  if (isTabbing) {
@@ -56,7 +54,7 @@ var ColorCard = /*#__PURE__*/forwardRef(function (props, componentRef) {
56
54
  onClick === null || onClick === void 0 || onClick(value);
57
55
  }
58
56
  onKeyDown === null || onKeyDown === void 0 || onKeyDown(event);
59
- }, [isTabbing, onTabPress, onClick, onKeyDown, value]);
57
+ }, [isTabbing, onClick, onKeyDown, value]);
60
58
 
61
59
  // TODO: Remove this useEffect when the feature flag 'platform_color_palette_menu_timeline_bar_a11y' is cleaned up
62
60
  useEffect(function () {
@@ -77,25 +75,33 @@ var ColorCard = /*#__PURE__*/forwardRef(function (props, componentRef) {
77
75
  useImperativeHandle(componentRef, function () {
78
76
  return {
79
77
  focus: function focus() {
80
- var _ref$current;
81
- (_ref$current = ref.current) === null || _ref$current === void 0 || _ref$current.focus();
78
+ if (fg('platform_color_palette_menu_timeline_bar_a11y')) {
79
+ if (isInitialFocus.current) {
80
+ var _ref$current;
81
+ !initialFocusRef && ((_ref$current = ref.current) === null || _ref$current === void 0 ? void 0 : _ref$current.focus());
82
+ isInitialFocus.current = false;
83
+ } else {
84
+ var _ref$current2;
85
+ (_ref$current2 = ref.current) === null || _ref$current2 === void 0 || _ref$current2.focus();
86
+ }
87
+ }
82
88
  }
83
89
  };
84
- }, []);
90
+ }, [initialFocusRef]);
85
91
  return jsx(Tooltip, {
86
92
  content: label
87
93
  }, function (tooltipProps) {
88
94
  delete tooltipProps['aria-describedby'];
89
95
  return jsx("div", _extends({}, tooltipProps, {
90
- css: [sharedColorContainerStyles, (isTabbing === undefined || isTabbing) && colorCardOptionTabbingStyles, focused && !isTabbing && colorCardOptionFocusedStyles],
91
- onClick: handleClick,
92
- onMouseDown: handleMouseDown,
93
- onKeyDown: fg('platform_color_palette_menu_timeline_bar_a11y') ? handleKeyDown : handleKeyDownOld,
96
+ ref: initialFocusRef ? mergeRefs([ref, tooltipProps.ref, initialFocusRef]) : mergeRefs([ref, tooltipProps.ref]),
94
97
  role: fg('platform_color_palette_menu_timeline_bar_a11y') ? 'menuitemradio' : 'radio',
98
+ tabIndex: fg('platform_color_palette_menu_timeline_bar_a11y') ? selected ? 0 : -1 : 0,
95
99
  "aria-checked": selected,
96
100
  "aria-label": label,
97
- tabIndex: 0,
98
- ref: mergeRefs([ref, tooltipProps.ref])
101
+ css: [sharedColorContainerStyles, (isTabbing === undefined || isTabbing) && colorCardOptionTabbingStyles, focused && !isTabbing && colorCardOptionFocusedStyles],
102
+ onClick: handleClick,
103
+ onMouseDown: handleMouseDown,
104
+ onKeyDown: fg('platform_color_palette_menu_timeline_bar_a11y') ? handleKeyDown : handleKeyDownOld
99
105
  }), jsx("div", {
100
106
  css: colorCardWrapperStyles
101
107
  }, jsx("div", {
@@ -24,7 +24,8 @@ export var ColorPaletteMenuWithoutAnalytics = function ColorPaletteMenuWithoutAn
24
24
  _ref$cols = _ref.cols,
25
25
  cols = _ref$cols === void 0 ? 6 : _ref$cols,
26
26
  _ref$mode = _ref.mode,
27
- mode = _ref$mode === void 0 ? Mode.Standard : _ref$mode;
27
+ mode = _ref$mode === void 0 ? Mode.Standard : _ref$mode,
28
+ initialFocusRef = _ref.initialFocusRef;
28
29
  var createAndFireEventOnAtlaskit = createAndFireEvent('atlaskit');
29
30
  var changeAnalyticsCaller = function changeAnalyticsCaller() {
30
31
  if (createAnalyticsEvent) {
@@ -34,7 +35,7 @@ export var ColorPaletteMenuWithoutAnalytics = function ColorPaletteMenuWithoutAn
34
35
  attributes: {
35
36
  componentName: 'color-picker',
36
37
  packageName: "@atlaskit/color-picker",
37
- packageVersion: "3.2.24"
38
+ packageVersion: "3.2.26"
38
39
  }
39
40
  })(createAnalyticsEvent);
40
41
  }
@@ -80,10 +81,6 @@ export var ColorPaletteMenuWithoutAnalytics = function ColorPaletteMenuWithoutAn
80
81
  break;
81
82
  }
82
83
  }, [setFocusedIndex, options]);
83
- var onTabPress = function onTabPress() {
84
- var backwards = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false;
85
- setFocusedIndex(backwards ? 0 : options.length - 1);
86
- };
87
84
  return jsx("div", {
88
85
  "aria-label": fullLabel,
89
86
  role: fg('platform_color_palette_menu_timeline_bar_a11y') ? 'group' : 'radiogroup'
@@ -115,7 +112,7 @@ export var ColorPaletteMenuWithoutAnalytics = function ColorPaletteMenuWithoutAn
115
112
  ref: function ref(_ref4) {
116
113
  return colorCardRefs[index] = _ref4;
117
114
  },
118
- onTabPress: onTabPress,
115
+ initialFocusRef: value === selectedValue.value ? initialFocusRef : undefined,
119
116
  onKeyDown: handleKeyDown
120
117
  })));
121
118
  })));
@@ -123,7 +120,7 @@ export var ColorPaletteMenuWithoutAnalytics = function ColorPaletteMenuWithoutAn
123
120
  export default withAnalyticsContext({
124
121
  componentName: 'color-picker',
125
122
  packageName: "@atlaskit/color-picker",
126
- packageVersion: "3.2.24"
123
+ packageVersion: "3.2.26"
127
124
  })(withAnalyticsEvents()(ColorPaletteMenuWithoutAnalytics));
128
125
  var colorCardWrapperStyles = css({
129
126
  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.2.24";
37
+ var packageVersion = "3.2.26";
38
38
  var ColorPickerWithoutAnalyticsBase = /*#__PURE__*/function (_React$Component) {
39
39
  _inherits(ColorPickerWithoutAnalyticsBase, _React$Component);
40
40
  var _super = _createSuper(ColorPickerWithoutAnalyticsBase);
@@ -2,8 +2,9 @@
2
2
  * @jsxRuntime classic
3
3
  * @jsx jsx
4
4
  */
5
- import React, { type KeyboardEventHandler } from 'react';
5
+ import React, { type KeyboardEventHandler, type Ref } from 'react';
6
6
  export interface Props {
7
+ initialFocusRef?: Ref<HTMLDivElement>;
7
8
  value: string;
8
9
  label: string;
9
10
  onClick?: (value: string) => void;
@@ -13,7 +14,6 @@ export interface Props {
13
14
  focused?: boolean;
14
15
  isOption?: boolean;
15
16
  isTabbing?: boolean;
16
- onTabPress?: (backwards: boolean) => void;
17
17
  }
18
18
  export type ColorCardRef = {
19
19
  focus: () => void;
@@ -1,4 +1,8 @@
1
- /// <reference types="react" />
1
+ /**
2
+ * @jsxRuntime classic
3
+ * @jsx jsx
4
+ */
5
+ import { type Ref } from 'react';
2
6
  import { Mode, type Palette } from '../types';
3
7
  import { jsx } from '@emotion/react';
4
8
  export type Props = {
@@ -18,7 +22,9 @@ export type Props = {
18
22
  createAnalyticsEvent?: any;
19
23
  /** style of the color-picker, either 'Compact' or 'Standard', default value is 'Standard' */
20
24
  mode?: Mode;
25
+ /** the ref object (usually the currently selected color palette) that consumer can leverage to focus on load */
26
+ initialFocusRef?: Ref<HTMLDivElement>;
21
27
  };
22
- export declare const ColorPaletteMenuWithoutAnalytics: ({ createAnalyticsEvent, onChange, palette, selectedColor, checkMarkColor, label, cols, mode, }: Props) => jsx.JSX.Element;
23
- 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" | "checkMarkColor" | "cols" | "palette" | "selectedColor" | "mode"> & import("react").RefAttributes<any>>;
28
+ export declare const ColorPaletteMenuWithoutAnalytics: ({ createAnalyticsEvent, onChange, palette, selectedColor, checkMarkColor, label, cols, mode, initialFocusRef, }: Props) => jsx.JSX.Element;
29
+ 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" | "mode"> & import("react").RefAttributes<any>>;
24
30
  export default _default;
@@ -2,8 +2,9 @@
2
2
  * @jsxRuntime classic
3
3
  * @jsx jsx
4
4
  */
5
- import React, { type KeyboardEventHandler } from 'react';
5
+ import React, { type KeyboardEventHandler, type Ref } from 'react';
6
6
  export interface Props {
7
+ initialFocusRef?: Ref<HTMLDivElement>;
7
8
  value: string;
8
9
  label: string;
9
10
  onClick?: (value: string) => void;
@@ -13,7 +14,6 @@ export interface Props {
13
14
  focused?: boolean;
14
15
  isOption?: boolean;
15
16
  isTabbing?: boolean;
16
- onTabPress?: (backwards: boolean) => void;
17
17
  }
18
18
  export type ColorCardRef = {
19
19
  focus: () => void;
@@ -1,4 +1,8 @@
1
- /// <reference types="react" />
1
+ /**
2
+ * @jsxRuntime classic
3
+ * @jsx jsx
4
+ */
5
+ import { type Ref } from 'react';
2
6
  import { Mode, type Palette } from '../types';
3
7
  import { jsx } from '@emotion/react';
4
8
  export type Props = {
@@ -18,7 +22,9 @@ export type Props = {
18
22
  createAnalyticsEvent?: any;
19
23
  /** style of the color-picker, either 'Compact' or 'Standard', default value is 'Standard' */
20
24
  mode?: Mode;
25
+ /** the ref object (usually the currently selected color palette) that consumer can leverage to focus on load */
26
+ initialFocusRef?: Ref<HTMLDivElement>;
21
27
  };
22
- export declare const ColorPaletteMenuWithoutAnalytics: ({ createAnalyticsEvent, onChange, palette, selectedColor, checkMarkColor, label, cols, mode, }: Props) => jsx.JSX.Element;
23
- 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" | "checkMarkColor" | "cols" | "palette" | "selectedColor" | "mode"> & import("react").RefAttributes<any>>;
28
+ export declare const ColorPaletteMenuWithoutAnalytics: ({ createAnalyticsEvent, onChange, palette, selectedColor, checkMarkColor, label, cols, mode, initialFocusRef, }: Props) => jsx.JSX.Element;
29
+ 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" | "mode"> & import("react").RefAttributes<any>>;
24
30
  export default _default;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaskit/color-picker",
3
- "version": "3.2.24",
3
+ "version": "3.2.26",
4
4
  "description": "Jira Color Picker Component",
5
5
  "publishConfig": {
6
6
  "registry": "https://registry.npmjs.org/"
@@ -34,11 +34,11 @@
34
34
  },
35
35
  "dependencies": {
36
36
  "@atlaskit/analytics-next": "^10.1.0",
37
- "@atlaskit/icon": "^22.12.0",
37
+ "@atlaskit/icon": "^22.14.0",
38
38
  "@atlaskit/platform-feature-flags": "0.3.0",
39
- "@atlaskit/select": "^17.13.0",
39
+ "@atlaskit/select": "^17.15.0",
40
40
  "@atlaskit/theme": "^13.0.0",
41
- "@atlaskit/tokens": "^1.58.0",
41
+ "@atlaskit/tokens": "^1.59.0",
42
42
  "@atlaskit/tooltip": "^18.7.0",
43
43
  "@babel/runtime": "^7.0.0",
44
44
  "@emotion/react": "^11.7.1",