@atlaskit/editor-toolbar 2.6.46 → 2.7.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -1,5 +1,13 @@
1
1
  # @atlaskit/editor-toolbar
2
2
 
3
+ ## 2.7.0
4
+
5
+ ### Minor Changes
6
+
7
+ - [`6c8c928766851`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/6c8c928766851) -
8
+ Add an optional `ariaLabelledBy` prop to `ColorPalette` and expose all of its swatches as a single
9
+ radio group named by that element, behind platform_editor_a11y_color_palette_radiogroup
10
+
3
11
  ## 2.6.46
4
12
 
5
13
  ### Patch Changes
@@ -56,7 +56,8 @@ function getCheckMarkColor(color, useIconToken) {
56
56
  * - Customizable color mapping
57
57
  */
58
58
  var ColorPalette = function ColorPalette(_ref) {
59
- var _ref$cols = _ref.cols,
59
+ var ariaLabelledBy = _ref.ariaLabelledBy,
60
+ _ref$cols = _ref.cols,
60
61
  cols = _ref$cols === void 0 ? _utils.DEFAULT_COLOR_PICKER_COLUMNS : _ref$cols,
61
62
  _ref$gap = _ref.gap,
62
63
  gap = _ref$gap === void 0 ? 'space.050' : _ref$gap,
@@ -257,16 +258,16 @@ var ColorPalette = function ColorPalette(_ref) {
257
258
  }
258
259
  }
259
260
  }, [colorsPerRow, focusColorAt, onClick, onKeyDown]);
260
- return /*#__PURE__*/_react.default.createElement(_compiled.Grid, {
261
+ var paletteGrid = /*#__PURE__*/_react.default.createElement(_compiled.Grid, {
261
262
  gap: gap,
262
263
  ref: paletteRef,
263
- role: "group"
264
+ role: (0, _fg.fg)('platform_editor_a11y_color_palette_radiogroup') ? 'presentation' : 'group'
264
265
  }, colorsPerRow.map(function (row, rowIndex) {
265
266
  return /*#__PURE__*/_react.default.createElement(_compiled.Inline, {
266
267
  space: shouldUseInlineColorGap ? gap : undefined,
267
268
  rowSpace: shouldUseInlineColorGap ? undefined : gap,
268
269
  key: "row-first-color-".concat(row[0].value),
269
- role: "radiogroup"
270
+ role: (0, _fg.fg)('platform_editor_a11y_color_palette_radiogroup') ? 'presentation' : 'radiogroup'
270
271
  }, row.map(function (_ref2, colIndex) {
271
272
  var value = _ref2.value,
272
273
  label = _ref2.label,
@@ -307,5 +308,13 @@ var ColorPalette = function ColorPalette(_ref) {
307
308
  });
308
309
  }));
309
310
  }));
311
+ if ((0, _fg.fg)('platform_editor_a11y_color_palette_radiogroup')) {
312
+ // All swatches are one radio group; the grid and its rows only carry the layout
313
+ return /*#__PURE__*/_react.default.createElement("div", {
314
+ role: "radiogroup",
315
+ "aria-labelledby": ariaLabelledBy
316
+ }, paletteGrid);
317
+ }
318
+ return paletteGrid;
310
319
  };
311
320
  var _default = exports.default = ColorPalette;
@@ -46,6 +46,7 @@ function getCheckMarkColor(color, useIconToken) {
46
46
  * - Customizable color mapping
47
47
  */
48
48
  const ColorPalette = ({
49
+ ariaLabelledBy,
49
50
  cols = DEFAULT_COLOR_PICKER_COLUMNS,
50
51
  gap = 'space.050',
51
52
  onClick,
@@ -252,15 +253,15 @@ const ColorPalette = ({
252
253
  }
253
254
  }
254
255
  }, [colorsPerRow, focusColorAt, onClick, onKeyDown]);
255
- return /*#__PURE__*/React.createElement(Grid, {
256
+ const paletteGrid = /*#__PURE__*/React.createElement(Grid, {
256
257
  gap: gap,
257
258
  ref: paletteRef,
258
- role: "group"
259
+ role: fg('platform_editor_a11y_color_palette_radiogroup') ? 'presentation' : 'group'
259
260
  }, colorsPerRow.map((row, rowIndex) => /*#__PURE__*/React.createElement(Inline, {
260
261
  space: shouldUseInlineColorGap ? gap : undefined,
261
262
  rowSpace: shouldUseInlineColorGap ? undefined : gap,
262
263
  key: `row-first-color-${row[0].value}`,
263
- role: "radiogroup"
264
+ role: fg('platform_editor_a11y_color_palette_radiogroup') ? 'presentation' : 'radiogroup'
264
265
  }, row.map(({
265
266
  value,
266
267
  label,
@@ -301,5 +302,13 @@ const ColorPalette = ({
301
302
  tabIndex: shouldBeFocusable ? 0 : -1
302
303
  });
303
304
  }))));
305
+ if (fg('platform_editor_a11y_color_palette_radiogroup')) {
306
+ // All swatches are one radio group; the grid and its rows only carry the layout
307
+ return /*#__PURE__*/React.createElement("div", {
308
+ role: "radiogroup",
309
+ "aria-labelledby": ariaLabelledBy
310
+ }, paletteGrid);
311
+ }
312
+ return paletteGrid;
304
313
  };
305
314
  export default ColorPalette;
@@ -48,7 +48,8 @@ function getCheckMarkColor(color, useIconToken) {
48
48
  * - Customizable color mapping
49
49
  */
50
50
  var ColorPalette = function ColorPalette(_ref) {
51
- var _ref$cols = _ref.cols,
51
+ var ariaLabelledBy = _ref.ariaLabelledBy,
52
+ _ref$cols = _ref.cols,
52
53
  cols = _ref$cols === void 0 ? DEFAULT_COLOR_PICKER_COLUMNS : _ref$cols,
53
54
  _ref$gap = _ref.gap,
54
55
  gap = _ref$gap === void 0 ? 'space.050' : _ref$gap,
@@ -249,16 +250,16 @@ var ColorPalette = function ColorPalette(_ref) {
249
250
  }
250
251
  }
251
252
  }, [colorsPerRow, focusColorAt, onClick, onKeyDown]);
252
- return /*#__PURE__*/React.createElement(Grid, {
253
+ var paletteGrid = /*#__PURE__*/React.createElement(Grid, {
253
254
  gap: gap,
254
255
  ref: paletteRef,
255
- role: "group"
256
+ role: fg('platform_editor_a11y_color_palette_radiogroup') ? 'presentation' : 'group'
256
257
  }, colorsPerRow.map(function (row, rowIndex) {
257
258
  return /*#__PURE__*/React.createElement(Inline, {
258
259
  space: shouldUseInlineColorGap ? gap : undefined,
259
260
  rowSpace: shouldUseInlineColorGap ? undefined : gap,
260
261
  key: "row-first-color-".concat(row[0].value),
261
- role: "radiogroup"
262
+ role: fg('platform_editor_a11y_color_palette_radiogroup') ? 'presentation' : 'radiogroup'
262
263
  }, row.map(function (_ref2, colIndex) {
263
264
  var value = _ref2.value,
264
265
  label = _ref2.label,
@@ -299,5 +300,13 @@ var ColorPalette = function ColorPalette(_ref) {
299
300
  });
300
301
  }));
301
302
  }));
303
+ if (fg('platform_editor_a11y_color_palette_radiogroup')) {
304
+ // All swatches are one radio group; the grid and its rows only carry the layout
305
+ return /*#__PURE__*/React.createElement("div", {
306
+ role: "radiogroup",
307
+ "aria-labelledby": ariaLabelledBy
308
+ }, paletteGrid);
309
+ }
310
+ return paletteGrid;
302
311
  };
303
312
  export default ColorPalette;
@@ -11,5 +11,5 @@ import type { ColorPaletteProps } from './types';
11
11
  * - Design token integration
12
12
  * - Customizable color mapping
13
13
  */
14
- declare const ColorPalette: ({ cols, gap, onClick, onKeyDown, selectedColor, paletteOptions, }: ColorPaletteProps) => React.JSX.Element;
14
+ declare const ColorPalette: ({ ariaLabelledBy, cols, gap, onClick, onKeyDown, selectedColor, paletteOptions, }: ColorPaletteProps) => React.JSX.Element;
15
15
  export default ColorPalette;
@@ -48,6 +48,8 @@ export interface PaletteOptions {
48
48
  * Props for the main ColorPalette component
49
49
  */
50
50
  export interface ColorPaletteProps {
51
+ /** Id of the element whose text labels the palette's radio group */
52
+ ariaLabelledBy?: string;
51
53
  /** Optional CSS class name */
52
54
  className?: string;
53
55
  /** Number of columns in the palette grid */
package/package.json CHANGED
@@ -3,7 +3,7 @@
3
3
  "publishConfig": {
4
4
  "registry": "https://registry.npmjs.org/"
5
5
  },
6
- "version": "2.6.46",
6
+ "version": "2.7.0",
7
7
  "description": "Common UI for Toolbars across the platform",
8
8
  "atlassian": {
9
9
  "website": {
@@ -57,6 +57,7 @@
57
57
  "react-intl": "^5.25.1 || ^6.0.0 || ^7.0.0"
58
58
  },
59
59
  "devDependencies": {
60
+ "@atlassian/feature-flags-test-utils": "^1.3.0",
60
61
  "@atlassian/testing-library": "^0.11.0",
61
62
  "@atlassian/workbench": "workspace:*",
62
63
  "@testing-library/react": "^16.3.0",
@@ -68,6 +69,9 @@
68
69
  "cc_blocks_changeboarding": {
69
70
  "type": "boolean"
70
71
  },
72
+ "platform_editor_a11y_color_palette_radiogroup": {
73
+ "type": "boolean"
74
+ },
71
75
  "platform_editor_lovability_text_bg_color_patch_1": {
72
76
  "type": "boolean"
73
77
  },