@atlaskit/editor-plugin-table 7.28.8 → 7.28.10

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.
Files changed (56) hide show
  1. package/CHANGELOG.md +16 -0
  2. package/dist/cjs/nodeviews/TableComponent.js +4 -9
  3. package/dist/cjs/plugin.js +1 -1
  4. package/dist/cjs/pm-plugins/view-mode-sort/index.js +9 -8
  5. package/dist/cjs/ui/FloatingContextualButton/index.js +2 -1
  6. package/dist/cjs/ui/FloatingContextualButton/styles.js +9 -4
  7. package/dist/cjs/ui/FloatingContextualMenu/ContextualMenu.js +76 -45
  8. package/dist/cjs/ui/FloatingContextualMenu/styles.js +1 -10
  9. package/dist/cjs/ui/FloatingDragMenu/DragMenu.js +19 -12
  10. package/dist/cjs/ui/FloatingDragMenu/styles.js +1 -7
  11. package/dist/cjs/ui/icons/SortingIconWrapper.js +18 -0
  12. package/dist/cjs/utils/drag-menu.js +47 -14
  13. package/dist/es2019/nodeviews/TableComponent.js +4 -10
  14. package/dist/es2019/plugin.js +1 -1
  15. package/dist/es2019/pm-plugins/view-mode-sort/index.js +9 -8
  16. package/dist/es2019/ui/FloatingContextualButton/index.js +2 -1
  17. package/dist/es2019/ui/FloatingContextualButton/styles.js +6 -1
  18. package/dist/es2019/ui/FloatingContextualMenu/ContextualMenu.js +77 -46
  19. package/dist/es2019/ui/FloatingContextualMenu/styles.js +0 -9
  20. package/dist/es2019/ui/FloatingDragMenu/DragMenu.js +20 -13
  21. package/dist/es2019/ui/FloatingDragMenu/styles.js +0 -6
  22. package/dist/es2019/ui/icons/SortingIconWrapper.js +12 -0
  23. package/dist/es2019/utils/drag-menu.js +50 -17
  24. package/dist/esm/nodeviews/TableComponent.js +4 -9
  25. package/dist/esm/plugin.js +1 -1
  26. package/dist/esm/pm-plugins/view-mode-sort/index.js +9 -8
  27. package/dist/esm/ui/FloatingContextualButton/index.js +2 -1
  28. package/dist/esm/ui/FloatingContextualButton/styles.js +8 -2
  29. package/dist/esm/ui/FloatingContextualMenu/ContextualMenu.js +77 -46
  30. package/dist/esm/ui/FloatingContextualMenu/styles.js +0 -9
  31. package/dist/esm/ui/FloatingDragMenu/DragMenu.js +20 -13
  32. package/dist/esm/ui/FloatingDragMenu/styles.js +0 -6
  33. package/dist/esm/ui/icons/SortingIconWrapper.js +11 -0
  34. package/dist/esm/utils/drag-menu.js +47 -14
  35. package/dist/types/pm-plugins/view-mode-sort/index.d.ts +1 -1
  36. package/dist/types/ui/FloatingContextualMenu/styles.d.ts +0 -1
  37. package/dist/types/ui/FloatingDragMenu/styles.d.ts +0 -1
  38. package/dist/types/ui/icons/SortingIconWrapper.d.ts +10 -0
  39. package/dist/types/utils/drag-menu.d.ts +4 -2
  40. package/dist/types-ts4.5/pm-plugins/view-mode-sort/index.d.ts +1 -1
  41. package/dist/types-ts4.5/ui/FloatingContextualMenu/styles.d.ts +0 -1
  42. package/dist/types-ts4.5/ui/FloatingDragMenu/styles.d.ts +0 -1
  43. package/dist/types-ts4.5/ui/icons/SortingIconWrapper.d.ts +10 -0
  44. package/dist/types-ts4.5/utils/drag-menu.d.ts +4 -2
  45. package/package.json +5 -2
  46. package/src/nodeviews/TableComponent.tsx +1 -5
  47. package/src/plugin.tsx +1 -1
  48. package/src/pm-plugins/view-mode-sort/index.ts +6 -8
  49. package/src/ui/FloatingContextualButton/index.tsx +2 -2
  50. package/src/ui/FloatingContextualButton/styles.ts +5 -0
  51. package/src/ui/FloatingContextualMenu/ContextualMenu.tsx +75 -36
  52. package/src/ui/FloatingContextualMenu/styles.ts +0 -8
  53. package/src/ui/FloatingDragMenu/DragMenu.tsx +20 -15
  54. package/src/ui/FloatingDragMenu/styles.ts +0 -6
  55. package/src/ui/icons/SortingIconWrapper.tsx +20 -0
  56. package/src/utils/drag-menu.ts +73 -43
@@ -9,6 +9,20 @@ var _toConsumableArray2 = _interopRequireDefault(require("@babel/runtime/helpers
9
9
  var _customSteps = require("@atlaskit/custom-steps");
10
10
  var _analytics = require("@atlaskit/editor-common/analytics");
11
11
  var _keymaps = require("@atlaskit/editor-common/keymaps");
12
+ var _sortAscending = _interopRequireDefault(require("@atlaskit/icon/core/sort-ascending"));
13
+ var _sortDescending = _interopRequireDefault(require("@atlaskit/icon/core/sort-descending"));
14
+ var _tableCellClear = _interopRequireDefault(require("@atlaskit/icon/core/table-cell-clear"));
15
+ var _tableColumnAddLeft = _interopRequireDefault(require("@atlaskit/icon/core/table-column-add-left"));
16
+ var _tableColumnAddRight = _interopRequireDefault(require("@atlaskit/icon/core/table-column-add-right"));
17
+ var _tableColumnDelete = _interopRequireDefault(require("@atlaskit/icon/core/table-column-delete"));
18
+ var _tableColumnMoveLeft = _interopRequireDefault(require("@atlaskit/icon/core/table-column-move-left"));
19
+ var _tableColumnMoveRight = _interopRequireDefault(require("@atlaskit/icon/core/table-column-move-right"));
20
+ var _tableColumnsDistribute = _interopRequireDefault(require("@atlaskit/icon/core/table-columns-distribute"));
21
+ var _tableRowAddAbove = _interopRequireDefault(require("@atlaskit/icon/core/table-row-add-above"));
22
+ var _tableRowAddBelow = _interopRequireDefault(require("@atlaskit/icon/core/table-row-add-below"));
23
+ var _tableRowDelete = _interopRequireDefault(require("@atlaskit/icon/core/table-row-delete"));
24
+ var _tableRowMoveDown = _interopRequireDefault(require("@atlaskit/icon/core/table-row-move-down"));
25
+ var _tableRowMoveUp = _interopRequireDefault(require("@atlaskit/icon/core/table-row-move-up"));
12
26
  var _arrowDown = _interopRequireDefault(require("@atlaskit/icon/glyph/arrow-down"));
13
27
  var _arrowLeft = _interopRequireDefault(require("@atlaskit/icon/glyph/arrow-left"));
14
28
  var _arrowRight = _interopRequireDefault(require("@atlaskit/icon/glyph/arrow-right"));
@@ -83,27 +97,32 @@ var getDragMenuConfig = exports.getDragMenuConfig = function getDragMenuConfig(d
83
97
  var addOptions = direction === 'row' ? [{
84
98
  label: 'above',
85
99
  offset: 0,
86
- icon: _icons.AddRowAboveIcon,
100
+ icon: _tableRowAddAbove.default,
101
+ iconFallback: _icons.AddRowAboveIcon,
87
102
  keymap: _keymaps.addRowBefore
88
103
  }, {
89
104
  label: 'below',
90
105
  offset: 1,
91
- icon: _icons.AddRowBelowIcon,
106
+ icon: _tableRowAddBelow.default,
107
+ iconFallback: _icons.AddRowBelowIcon,
92
108
  keymap: _keymaps.addRowAfter
93
109
  }] : [{
94
110
  label: 'left',
95
111
  offset: 0,
96
- icon: _icons.AddColLeftIcon,
112
+ icon: _tableColumnAddLeft.default,
113
+ iconFallback: _icons.AddColLeftIcon,
97
114
  keymap: _keymaps.addColumnBefore
98
115
  }, {
99
116
  label: 'right',
100
117
  offset: 1,
101
- icon: _icons.AddColRightIcon,
118
+ icon: _tableColumnAddRight.default,
119
+ iconFallback: _icons.AddColRightIcon,
102
120
  keymap: _keymaps.addColumnAfter
103
121
  }];
104
122
  var moveOptions = direction === 'row' ? [{
105
123
  label: 'up',
106
- icon: _arrowUp.default,
124
+ icon: _tableRowMoveUp.default,
125
+ iconFallback: _arrowUp.default,
107
126
  keymap: _keymaps.moveRowUp,
108
127
  canMove: canMove('table-row', -1, (_tableMap$height = tableMap === null || tableMap === void 0 ? void 0 : tableMap.height) !== null && _tableMap$height !== void 0 ? _tableMap$height : 0, selection, selectionRect),
109
128
  getOriginIndexes: _selection.getSelectedRowIndexes,
@@ -112,7 +131,8 @@ var getDragMenuConfig = exports.getDragMenuConfig = function getDragMenuConfig(d
112
131
  }
113
132
  }, {
114
133
  label: 'down',
115
- icon: _arrowDown.default,
134
+ icon: _tableRowMoveDown.default,
135
+ iconFallback: _arrowDown.default,
116
136
  keymap: _keymaps.moveRowDown,
117
137
  canMove: canMove('table-row', 1, (_tableMap$height2 = tableMap === null || tableMap === void 0 ? void 0 : tableMap.height) !== null && _tableMap$height2 !== void 0 ? _tableMap$height2 : 0, selection, selectionRect),
118
138
  getOriginIndexes: _selection.getSelectedRowIndexes,
@@ -121,7 +141,8 @@ var getDragMenuConfig = exports.getDragMenuConfig = function getDragMenuConfig(d
121
141
  }
122
142
  }] : [{
123
143
  label: 'left',
124
- icon: _arrowLeft.default,
144
+ icon: _tableColumnMoveLeft.default,
145
+ iconFallback: _arrowLeft.default,
125
146
  keymap: _keymaps.moveColumnLeft,
126
147
  canMove: canMove('table-column', -1, (_tableMap$width = tableMap === null || tableMap === void 0 ? void 0 : tableMap.width) !== null && _tableMap$width !== void 0 ? _tableMap$width : 0, selection, selectionRect),
127
148
  getOriginIndexes: _selection.getSelectedColumnIndexes,
@@ -130,7 +151,8 @@ var getDragMenuConfig = exports.getDragMenuConfig = function getDragMenuConfig(d
130
151
  }
131
152
  }, {
132
153
  label: 'right',
133
- icon: _arrowRight.default,
154
+ icon: _tableColumnMoveRight.default,
155
+ iconFallback: _arrowRight.default,
134
156
  keymap: _keymaps.moveColumnRight,
135
157
  canMove: canMove('table-column', 1, (_tableMap$width2 = tableMap === null || tableMap === void 0 ? void 0 : tableMap.width) !== null && _tableMap$width2 !== void 0 ? _tableMap$width2 : 0, selection, selectionRect),
136
158
  getOriginIndexes: _selection.getSelectedColumnIndexes,
@@ -141,21 +163,25 @@ var getDragMenuConfig = exports.getDragMenuConfig = function getDragMenuConfig(d
141
163
  var sortOptions = direction === 'column' ? [{
142
164
  label: 'increasing',
143
165
  order: _customSteps.TableSortOrder.ASC,
144
- icon: _chevronDoubleUp.default
166
+ icon: _sortAscending.default,
167
+ iconFallback: _chevronDoubleUp.default
145
168
  }, {
146
169
  label: 'decreasing',
147
170
  order: _customSteps.TableSortOrder.DESC,
148
- icon: _chevronDoubleDown.default
171
+ icon: _sortDescending.default,
172
+ iconFallback: _chevronDoubleDown.default
149
173
  }] : [];
150
174
  var sortConfigs = (0, _toConsumableArray2.default)(sortOptions.map(function (_ref) {
151
175
  var label = _ref.label,
152
176
  order = _ref.order,
153
- icon = _ref.icon;
177
+ icon = _ref.icon,
178
+ iconFallback = _ref.iconFallback;
154
179
  return {
155
180
  id: "sort_column_".concat(order),
156
181
  title: "Sort ".concat(label),
157
182
  disabled: hasMergedCellsInTable,
158
183
  icon: icon,
184
+ iconFallback: iconFallback,
159
185
  onClick: function onClick(state, dispatch) {
160
186
  (0, _commandsWithAnalytics.sortColumnWithAnalytics)(editorAnalyticsAPI)(_analytics.INPUT_METHOD.TABLE_CONTEXT_MENU, index !== null && index !== void 0 ? index : 0, order)(state, dispatch);
161
187
  return true;
@@ -166,11 +192,13 @@ var getDragMenuConfig = exports.getDragMenuConfig = function getDragMenuConfig(d
166
192
  var label = _ref2.label,
167
193
  offset = _ref2.offset,
168
194
  icon = _ref2.icon,
195
+ iconFallback = _ref2.iconFallback,
169
196
  keymap = _ref2.keymap;
170
197
  return {
171
198
  id: "add_".concat(direction, "_").concat(label),
172
199
  title: "Add ".concat(direction, " ").concat(label),
173
200
  icon: icon,
201
+ iconFallback: iconFallback,
174
202
  onClick: function onClick(state, dispatch) {
175
203
  if (direction === 'row') {
176
204
  (0, _commandsWithAnalytics.insertRowWithAnalytics)(editorAnalyticsAPI, tableDuplicateCellColouring)(_analytics.INPUT_METHOD.TABLE_CONTEXT_MENU, {
@@ -200,7 +228,8 @@ var getDragMenuConfig = exports.getDragMenuConfig = function getDragMenuConfig(d
200
228
  }
201
229
  return false;
202
230
  },
203
- icon: _layoutThreeEqual.default
231
+ icon: _tableColumnsDistribute.default,
232
+ iconFallback: _layoutThreeEqual.default
204
233
  } : undefined, {
205
234
  id: 'clear_cells',
206
235
  title: 'Clear cells',
@@ -208,7 +237,8 @@ var getDragMenuConfig = exports.getDragMenuConfig = function getDragMenuConfig(d
208
237
  (0, _commandsWithAnalytics.emptyMultipleCellsWithAnalytics)(editorAnalyticsAPI)(_analytics.INPUT_METHOD.TABLE_CONTEXT_MENU, targetCellPosition)(state, dispatch);
209
238
  return true;
210
239
  },
211
- icon: _crossCircle.default,
240
+ icon: _tableCellClear.default,
241
+ iconFallback: _crossCircle.default,
212
242
  keymap: (0, _keymaps.tooltip)(_keymaps.backspace)
213
243
  }, {
214
244
  id: "delete_".concat(direction),
@@ -221,12 +251,14 @@ var getDragMenuConfig = exports.getDragMenuConfig = function getDragMenuConfig(d
221
251
  }
222
252
  return true;
223
253
  },
224
- icon: _remove.default,
254
+ icon: direction === 'row' ? _tableRowDelete.default : _tableColumnDelete.default,
255
+ iconFallback: _remove.default,
225
256
  keymap: direction === 'row' ? (0, _keymaps.tooltip)(_keymaps.deleteRow) : (0, _keymaps.tooltip)(_keymaps.deleteColumn)
226
257
  }], (0, _toConsumableArray2.default)(moveOptions.map(function (_ref3) {
227
258
  var label = _ref3.label,
228
259
  canMove = _ref3.canMove,
229
260
  icon = _ref3.icon,
261
+ iconFallback = _ref3.iconFallback,
230
262
  keymap = _ref3.keymap,
231
263
  getOriginIndexes = _ref3.getOriginIndexes,
232
264
  getTargetIndex = _ref3.getTargetIndex;
@@ -235,6 +267,7 @@ var getDragMenuConfig = exports.getDragMenuConfig = function getDragMenuConfig(d
235
267
  title: "Move ".concat(direction, " ").concat(label),
236
268
  disabled: !canMove,
237
269
  icon: icon,
270
+ iconFallback: iconFallback,
238
271
  onClick: function onClick(state, dispatch) {
239
272
  if (canMove) {
240
273
  requestAnimationFrame(function () {
@@ -339,7 +339,7 @@ class TableComponent extends React.Component {
339
339
  }
340
340
  }
341
341
  componentDidMount() {
342
- var _this$props$pluginInj, _this$props$pluginInj2, _this$table2, _this$table3;
342
+ var _this$table, _this$table2, _this$table3;
343
343
  const {
344
344
  allowColumnResizing,
345
345
  eventDispatcher,
@@ -349,13 +349,7 @@ class TableComponent extends React.Component {
349
349
  getEditorFeatureFlags,
350
350
  isTableScalingEnabled
351
351
  } = this.props;
352
- const {
353
- mode
354
- } = ((_this$props$pluginInj = this.props.pluginInjectionApi) === null || _this$props$pluginInj === void 0 ? void 0 : (_this$props$pluginInj2 = _this$props$pluginInj.editorViewMode) === null || _this$props$pluginInj2 === void 0 ? void 0 : _this$props$pluginInj2.sharedState.currentState()) || {};
355
- if (mode === 'view') {
356
- var _this$table;
357
- this === null || this === void 0 ? void 0 : (_this$table = this.table) === null || _this$table === void 0 ? void 0 : _this$table.addEventListener('mouseenter', this.handleMouseEnter);
358
- }
352
+ this === null || this === void 0 ? void 0 : (_this$table = this.table) === null || _this$table === void 0 ? void 0 : _this$table.addEventListener('mouseenter', this.handleMouseEnter);
359
353
  this === null || this === void 0 ? void 0 : (_this$table2 = this.table) === null || _this$table2 === void 0 ? void 0 : _this$table2.addEventListener('mouseout', this.handleMouseOut);
360
354
  this === null || this === void 0 ? void 0 : (_this$table3 = this.table) === null || _this$table3 === void 0 ? void 0 : _this$table3.addEventListener('mouseover', this.handleMouseOver);
361
355
  const {
@@ -625,8 +619,8 @@ class TableComponent extends React.Component {
625
619
  const isNoOfColumnsChanged = tablesHaveDifferentNoOfColumns(currentTable, previousTable);
626
620
  const isNoOfRowsChanged = tablesHaveDifferentNoOfRows(currentTable, previousTable);
627
621
  if (isNoOfColumnsChanged || isNoOfRowsChanged) {
628
- var _this$props$pluginInj3, _this$props$pluginInj4;
629
- (_this$props$pluginInj3 = this.props.pluginInjectionApi) === null || _this$props$pluginInj3 === void 0 ? void 0 : (_this$props$pluginInj4 = _this$props$pluginInj3.accessibilityUtils) === null || _this$props$pluginInj4 === void 0 ? void 0 : _this$props$pluginInj4.actions.ariaNotify(getAssistiveMessage(previousTable, currentTable, this.props.intl), {
622
+ var _this$props$pluginInj, _this$props$pluginInj2;
623
+ (_this$props$pluginInj = this.props.pluginInjectionApi) === null || _this$props$pluginInj === void 0 ? void 0 : (_this$props$pluginInj2 = _this$props$pluginInj.accessibilityUtils) === null || _this$props$pluginInj2 === void 0 ? void 0 : _this$props$pluginInj2.actions.ariaNotify(getAssistiveMessage(previousTable, currentTable, this.props.intl), {
630
624
  priority: 'important'
631
625
  });
632
626
  }
@@ -263,7 +263,7 @@ const tablesPlugin = ({
263
263
  }, {
264
264
  name: 'tableViewModeSort',
265
265
  plugin: () => {
266
- return api !== null && api !== void 0 && api.editorViewMode ? createViewModeSortPlugin(api.editorViewMode) : undefined;
266
+ return api !== null && api !== void 0 && api.editorViewMode ? createViewModeSortPlugin(api) : undefined;
267
267
  }
268
268
  }, {
269
269
  name: 'tableLocalId',
@@ -8,15 +8,15 @@ import { createElement } from 'react';
8
8
  import ReactDOM from 'react-dom';
9
9
  import { RawIntlProvider } from 'react-intl-next';
10
10
  import { SafePlugin } from '@atlaskit/editor-common/safe-plugin';
11
- import { SortingIcon } from '@atlaskit/editor-common/table';
12
11
  import { SortOrder } from '@atlaskit/editor-common/types';
13
12
  import { Decoration, DecorationSet } from '@atlaskit/editor-prosemirror/view';
14
13
  import { TableMap } from '@atlaskit/editor-tables/table-map';
14
+ import { SortingIconWrapper } from '../../ui/icons/SortingIconWrapper';
15
15
  import { getPluginState } from '../plugin-factory';
16
16
  import { IS_DISABLED_CLASS_NAME, SORT_INDEX_DATA_ATTRIBUTE, SORTING_ICON_CLASS_NAME } from './consts';
17
17
  import { tableViewModeSortPluginKey as key } from './plugin-key';
18
18
  import { getTableElements, toggleSort } from './utils';
19
- export const createPlugin = editorViewModeAPI => {
19
+ export const createPlugin = api => {
20
20
  return new SafePlugin({
21
21
  state: {
22
22
  init: () => ({
@@ -25,11 +25,12 @@ export const createPlugin = editorViewModeAPI => {
25
25
  allTables: []
26
26
  }),
27
27
  apply(tr, pluginState, oldState) {
28
+ var _api$editorViewMode;
28
29
  // TODO - move this mode check to plugin creation if possible. Right now it's here because the initial state
29
30
  // does not appear correct when the plugin is created.
30
31
  const {
31
32
  mode
32
- } = (editorViewModeAPI === null || editorViewModeAPI === void 0 ? void 0 : editorViewModeAPI.sharedState.currentState()) || {};
33
+ } = ((_api$editorViewMode = api.editorViewMode) === null || _api$editorViewMode === void 0 ? void 0 : _api$editorViewMode.sharedState.currentState()) || {};
33
34
  if (mode !== 'view') {
34
35
  return pluginState;
35
36
  }
@@ -77,7 +78,6 @@ export const createPlugin = editorViewModeAPI => {
77
78
  const map = TableMap.get(tableNode);
78
79
  const hasMergedCells = new Set(map.map).size !== map.map.length;
79
80
  map.mapByRow[0].forEach((cell, index) => {
80
- // return pluginState;
81
81
  decs.push(Decoration.widget(cell + pos + 2, () => {
82
82
  var _sort$tableId;
83
83
  const element = document.createElement('div');
@@ -98,11 +98,12 @@ export const createPlugin = editorViewModeAPI => {
98
98
  } = getPluginState(oldState);
99
99
  ReactDOM.render( /*#__PURE__*/createElement(RawIntlProvider, {
100
100
  value: getIntl()
101
- }, /*#__PURE__*/createElement(SortingIcon, {
101
+ }, /*#__PURE__*/createElement(SortingIconWrapper, {
102
102
  isSortingAllowed: !hasMergedCells,
103
103
  sortOrdered,
104
104
  onClick: () => {},
105
- onKeyDown: () => {}
105
+ onKeyDown: () => {},
106
+ api
106
107
  })), element);
107
108
  return element;
108
109
  }));
@@ -129,11 +130,11 @@ export const createPlugin = editorViewModeAPI => {
129
130
  },
130
131
  key,
131
132
  appendTransaction: (trs, oldState, newState) => {
132
- var _key$getState;
133
+ var _api$editorViewMode2, _key$getState;
133
134
  // return newState.tr;
134
135
  const {
135
136
  mode
136
- } = (editorViewModeAPI === null || editorViewModeAPI === void 0 ? void 0 : editorViewModeAPI.sharedState.currentState()) || {};
137
+ } = (api === null || api === void 0 ? void 0 : (_api$editorViewMode2 = api.editorViewMode) === null || _api$editorViewMode2 === void 0 ? void 0 : _api$editorViewMode2.sharedState.currentState()) || {};
137
138
  if (mode !== 'view') {
138
139
  return newState.tr;
139
140
  }
@@ -15,7 +15,7 @@ import { Popup } from '@atlaskit/editor-common/ui';
15
15
  import { ToolbarButton } from '@atlaskit/editor-common/ui-menu';
16
16
  import { findDomRefAtPos } from '@atlaskit/editor-prosemirror/utils';
17
17
  import { akEditorSmallZIndex } from '@atlaskit/editor-shared-styles';
18
- import ExpandIcon from '@atlaskit/icon/glyph/chevron-down';
18
+ import ExpandIcon from '@atlaskit/icon/utility/migration/chevron-down';
19
19
  import { fg } from '@atlaskit/platform-feature-flags';
20
20
  import { toggleContextualMenu } from '../../commands';
21
21
  import { TableCssClassName as ClassName } from '../../types';
@@ -86,6 +86,7 @@ const FloatingContextualButtonInner = /*#__PURE__*/React.memo(props => {
86
86
  onClick: handleClick,
87
87
  iconBefore: jsx(ExpandIcon, {
88
88
  label: "",
89
+ color: "currentColor",
89
90
  isFacadeDisabled: true
90
91
  }),
91
92
  "aria-label": labelCellOptions,
@@ -1,5 +1,6 @@
1
1
  // eslint-disable-next-line @atlaskit/ui-styling-standard/use-compiled -- Ignored via go/DSP-18766
2
2
  import { css } from '@emotion/react';
3
+ import { fg } from '@atlaskit/platform-feature-flags';
3
4
  import { N0, N20, N30A, N700 } from '@atlaskit/theme/colors';
4
5
  import { contextualMenuTriggerSize } from '../consts';
5
6
  export const tableFloatingCellButtonStyles = () => css({
@@ -11,7 +12,11 @@ export const tableFloatingCellButtonStyles = () => css({
11
12
  display: 'flex',
12
13
  // eslint-disable-next-line @atlaskit/ui-styling-standard/no-imported-style-values, @atlaskit/ui-styling-standard/no-unsafe-values -- Ignored via go/DSP-18766
13
14
  height: `${contextualMenuTriggerSize + 2}px`,
14
- flexDirection: 'column'
15
+ flexDirection: 'column',
16
+ // eslint-disable-next-line @atlaskit/ui-styling-standard/no-imported-style-values, @atlaskit/ui-styling-standard/no-unsafe-values
17
+ ...(fg('platform-visual-refresh-icons') && {
18
+ width: "var(--ds-space-250, 20px)"
19
+ })
15
20
  },
16
21
  // eslint-disable-next-line @atlaskit/ui-styling-standard/no-nested-selectors, @atlaskit/ui-styling-standard/no-unsafe-selectors -- Ignored via go/DSP-18766
17
22
  '&& button': {
@@ -19,10 +19,19 @@ import { closestElement } from '@atlaskit/editor-common/utils';
19
19
  import { hexToEditorBackgroundPaletteColor } from '@atlaskit/editor-palette';
20
20
  import { shortcutStyle } from '@atlaskit/editor-shared-styles/shortcut';
21
21
  import { splitCell } from '@atlaskit/editor-tables/utils';
22
- import CrossCircleIcon from '@atlaskit/icon/glyph/cross-circle';
23
- import EditorBackgroundColorIcon from '@atlaskit/icon/glyph/editor/background-color';
24
- import RemoveIcon from '@atlaskit/icon/glyph/editor/remove';
22
+ import CrossCircleIcon from '@atlaskit/icon/core/migration/cross-circle';
23
+ import RemoveIcon from '@atlaskit/icon/core/migration/delete--editor-remove';
24
+ import EditorBackgroundColorIcon from '@atlaskit/icon/core/migration/paint-bucket--editor-background-color';
25
+ import PaintBucketIcon from '@atlaskit/icon/core/paint-bucket';
26
+ import TableCellClearIcon from '@atlaskit/icon/core/table-cell-clear';
27
+ import TableCellMergeIcon from '@atlaskit/icon/core/table-cell-merge';
28
+ import TableCellSplitIcon from '@atlaskit/icon/core/table-cell-split';
29
+ import TableColumnAddRightIcon from '@atlaskit/icon/core/table-column-add-right';
30
+ import TableColumnDeleteIcon from '@atlaskit/icon/core/table-column-delete';
31
+ import TableRowAddBelowIcon from '@atlaskit/icon/core/table-row-add-below';
32
+ import TableRowDeleteIcon from '@atlaskit/icon/core/table-row-delete';
25
33
  import { fg } from '@atlaskit/platform-feature-flags';
34
+ import { Box, xcss } from '@atlaskit/primitives';
26
35
  import { clearHoverSelection, hoverColumns, hoverMergedCells, hoverRows, setFocusToCellMenu, toggleContextualMenu } from '../../commands';
27
36
  import { deleteColumnsWithAnalytics, deleteRowsWithAnalytics, distributeColumnsWidthsWithAnalytics, emptyMultipleCellsWithAnalytics, insertColumnWithAnalytics, insertRowWithAnalytics, mergeCellsWithAnalytics, setColorWithAnalytics, sortColumnWithAnalytics, splitCellWithAnalytics } from '../../commands-with-analytics';
28
37
  import { getPluginState } from '../../pm-plugins/plugin-factory';
@@ -33,8 +42,13 @@ import { TableCssClassName as ClassName } from '../../types';
33
42
  import { getMergedCellsPositions, getSelectedColumnIndexes, getSelectedRowIndexes } from '../../utils';
34
43
  import { colorPalletteColumns, contextualMenuDropdownWidth, contextualMenuDropdownWidthDnD } from '../consts';
35
44
  import { AddColRightIcon, AddRowBelowIcon, MergeCellsIcon, SplitCellIcon } from '../icons';
36
- import { cellColourPreviewStyles, elementBeforeIconStyles } from './styles';
45
+ import { cellColourPreviewStyles } from './styles';
37
46
  const arrowsList = new Set(['ArrowRight', 'ArrowLeft']);
47
+ const elementBeforeIconStyles = xcss({
48
+ marginRight: 'space.negative.075',
49
+ display: 'flex'
50
+ });
51
+ // eslint-disable-next-line @repo/internal/react/no-class-components
38
52
  export class ContextualMenu extends Component {
39
53
  constructor(...args) {
40
54
  super(...args);
@@ -90,13 +104,13 @@ export class ContextualMenu extends Component {
90
104
  value: {
91
105
  name: 'background'
92
106
  },
93
- elemBefore: isDragAndDropEnabled ?
94
- // eslint-disable-next-line @atlaskit/ui-styling-standard/no-imported-style-values, @atlaskit/design-system/consistent-css-prop-usage -- Ignored via go/DSP-18766
95
- jsx("span", {
96
- css: elementBeforeIconStyles
97
- }, jsx(EditorBackgroundColorIcon, {
107
+ elemBefore: isDragAndDropEnabled ? jsx(Box, {
108
+ xcss: elementBeforeIconStyles
109
+ }, jsx(PaintBucketIcon, {
110
+ color: "currentColor",
111
+ spacing: "spacious",
98
112
  label: formatMessage(messages.backgroundColor),
99
- size: "medium"
113
+ LEGACY_fallbackIcon: EditorBackgroundColorIcon
100
114
  })) : undefined,
101
115
  elemAfter:
102
116
  // eslint-disable-next-line @atlaskit/ui-styling-standard/no-classname-prop -- Ignored via go/DSP-18766
@@ -178,22 +192,28 @@ export class ContextualMenu extends Component {
178
192
  name: 'merge'
179
193
  },
180
194
  isDisabled: !canMergeCells(state.tr),
181
- elemBefore: isDragAndDropEnabled ?
182
- // eslint-disable-next-line @atlaskit/ui-styling-standard/no-imported-style-values, @atlaskit/design-system/consistent-css-prop-usage -- Ignored via go/DSP-18766
183
- jsx("span", {
184
- css: elementBeforeIconStyles
185
- }, jsx(MergeCellsIcon, null)) : undefined
195
+ elemBefore: isDragAndDropEnabled ? jsx(Box, {
196
+ xcss: elementBeforeIconStyles
197
+ }, jsx(TableCellMergeIcon, {
198
+ color: "currentColor",
199
+ spacing: "spacious",
200
+ label: formatMessage(messages.mergeCells),
201
+ LEGACY_fallbackIcon: MergeCellsIcon
202
+ })) : undefined
186
203
  }, {
187
204
  content: formatMessage(messages.splitCell),
188
205
  value: {
189
206
  name: 'split'
190
207
  },
191
208
  isDisabled: !splitCell(state),
192
- elemBefore: isDragAndDropEnabled ?
193
- // eslint-disable-next-line @atlaskit/ui-styling-standard/no-imported-style-values, @atlaskit/design-system/consistent-css-prop-usage -- Ignored via go/DSP-18766
194
- jsx("span", {
195
- css: elementBeforeIconStyles
196
- }, jsx(SplitCellIcon, null)) : undefined
209
+ elemBefore: isDragAndDropEnabled ? jsx(Box, {
210
+ xcss: elementBeforeIconStyles
211
+ }, jsx(TableCellSplitIcon, {
212
+ color: "currentColor",
213
+ spacing: "spacious",
214
+ label: formatMessage(messages.splitCell),
215
+ LEGACY_fallbackIcon: SplitCellIcon
216
+ })) : undefined
197
217
  }];
198
218
  }
199
219
  return [];
@@ -220,9 +240,14 @@ export class ContextualMenu extends Component {
220
240
  }, tooltip(addColumnAfter)),
221
241
  elemBefore: isDragAndDropEnabled ?
222
242
  // eslint-disable-next-line @atlaskit/ui-styling-standard/no-imported-style-values, @atlaskit/design-system/consistent-css-prop-usage -- Ignored via go/DSP-18766
223
- jsx("span", {
224
- css: elementBeforeIconStyles
225
- }, jsx(AddColRightIcon, null)) : undefined,
243
+ jsx(Box, {
244
+ xcss: elementBeforeIconStyles
245
+ }, jsx(TableColumnAddRightIcon, {
246
+ color: "currentColor",
247
+ spacing: "spacious",
248
+ label: formatMessage(messages.addColumnRight),
249
+ LEGACY_fallbackIcon: AddColRightIcon
250
+ })) : undefined,
226
251
  'aria-label': fg('platform_editor_announce_cell_options_hotkeys') ? tooltip(addColumnAfter, String(content)) : undefined
227
252
  };
228
253
  });
@@ -246,11 +271,14 @@ export class ContextualMenu extends Component {
246
271
  elemAfter: jsx("div", {
247
272
  css: shortcutStyle
248
273
  }, tooltip(addRowAfter)),
249
- elemBefore: isDragAndDropEnabled ?
250
- // eslint-disable-next-line @atlaskit/ui-styling-standard/no-imported-style-values, @atlaskit/design-system/consistent-css-prop-usage -- Ignored via go/DSP-18766
251
- jsx("span", {
252
- css: elementBeforeIconStyles
253
- }, jsx(AddRowBelowIcon, null)) : undefined,
274
+ elemBefore: isDragAndDropEnabled ? jsx(Box, {
275
+ xcss: elementBeforeIconStyles
276
+ }, jsx(TableRowAddBelowIcon, {
277
+ color: "currentColor",
278
+ spacing: "spacious",
279
+ label: formatMessage(messages.addRowBelow),
280
+ LEGACY_fallbackIcon: AddRowBelowIcon
281
+ })) : undefined,
254
282
  'aria-label': fg('platform_editor_announce_cell_options_hotkeys') ? tooltip(addRowAfter, String(content)) : undefined
255
283
  };
256
284
  });
@@ -285,14 +313,15 @@ export class ContextualMenu extends Component {
285
313
  elemAfter: jsx("div", {
286
314
  css: shortcutStyle
287
315
  }, tooltip(backspace)),
288
- elemBefore: isDragAndDropEnabled ?
289
- // eslint-disable-next-line @atlaskit/ui-styling-standard/no-imported-style-values, @atlaskit/design-system/consistent-css-prop-usage -- Ignored via go/DSP-18766
290
- jsx("span", {
291
- css: elementBeforeIconStyles
292
- }, jsx(CrossCircleIcon, {
316
+ elemBefore: isDragAndDropEnabled ? jsx(Box, {
317
+ xcss: elementBeforeIconStyles
318
+ }, jsx(TableCellClearIcon, {
319
+ color: "currentColor",
320
+ spacing: "spacious",
293
321
  label: formatMessage(messages.clearCells, {
294
322
  0: Math.max(noOfColumns, noOfRows)
295
- })
323
+ }),
324
+ LEGACY_fallbackIcon: CrossCircleIcon
296
325
  })) : undefined,
297
326
  'aria-label': fg('platform_editor_announce_cell_options_hotkeys') ? tooltip(backspace, String(content)) : undefined
298
327
  };
@@ -320,14 +349,15 @@ export class ContextualMenu extends Component {
320
349
  value: {
321
350
  name: 'delete_column'
322
351
  },
323
- elemBefore: isDragAndDropEnabled ?
324
- // eslint-disable-next-line @atlaskit/ui-styling-standard/no-imported-style-values, @atlaskit/design-system/consistent-css-prop-usage -- Ignored via go/DSP-18766
325
- jsx("span", {
326
- css: elementBeforeIconStyles
327
- }, jsx(RemoveIcon, {
352
+ elemBefore: isDragAndDropEnabled ? jsx(Box, {
353
+ xcss: elementBeforeIconStyles
354
+ }, jsx(TableColumnDeleteIcon, {
355
+ color: "currentColor",
356
+ spacing: "spacious",
328
357
  label: formatMessage(messages.removeColumns, {
329
358
  0: noOfColumns
330
- })
359
+ }),
360
+ LEGACY_fallbackIcon: RemoveIcon
331
361
  })) : undefined
332
362
  };
333
363
  });
@@ -354,14 +384,15 @@ export class ContextualMenu extends Component {
354
384
  value: {
355
385
  name: 'delete_row'
356
386
  },
357
- elemBefore: isDragAndDropEnabled ?
358
- // eslint-disable-next-line @atlaskit/ui-styling-standard/no-imported-style-values, @atlaskit/design-system/consistent-css-prop-usage -- Ignored via go/DSP-18766
359
- jsx("span", {
360
- css: elementBeforeIconStyles
361
- }, jsx(RemoveIcon, {
387
+ elemBefore: isDragAndDropEnabled ? jsx(Box, {
388
+ xcss: elementBeforeIconStyles
389
+ }, jsx(TableRowDeleteIcon, {
390
+ color: "currentColor",
391
+ spacing: "spacious",
362
392
  label: formatMessage(messages.removeRows, {
363
393
  0: noOfRows
364
- })
394
+ }),
395
+ LEGACY_fallbackIcon: RemoveIcon
365
396
  })) : undefined
366
397
  };
367
398
  });
@@ -10,15 +10,6 @@ export const cellColourPreviewStyles = selectedColor => css({
10
10
  background: selectedColor
11
11
  }
12
12
  });
13
-
14
- // eslint-disable-next-line @atlaskit/ui-styling-standard/no-exported-styles -- Ignored via go/DSP-18766
15
- export const elementBeforeIconStyles = css({
16
- marginRight: "var(--ds-space-negative-075, -6px)",
17
- display: 'flex'
18
- });
19
-
20
- // TODO Delete this comment after verifying space token -> previous value `padding: 8px`
21
- // TODO Delete this comment after verifying space token -> previous value `margin-left: 4px`
22
13
  export const tablePopupStyles = (isDragAndDropEnabled
23
14
  // eslint-disable-next-line @atlaskit/design-system/no-css-tagged-template-expression -- needs manual remediation
24
15
  ) => css`
@@ -20,7 +20,9 @@ import { hexToEditorBackgroundPaletteColor } from '@atlaskit/editor-palette';
20
20
  import { shortcutStyle } from '@atlaskit/editor-shared-styles/shortcut';
21
21
  import { TableMap } from '@atlaskit/editor-tables/table-map';
22
22
  import { findCellRectClosestToPos, getSelectionRect, isSelectionType } from '@atlaskit/editor-tables/utils';
23
- import EditorBackgroundColorIcon from '@atlaskit/icon/glyph/editor/background-color';
23
+ import EditorBackgroundColorIcon from '@atlaskit/icon/core/migration/paint-bucket--editor-background-color';
24
+ import PaintBucketIcon from '@atlaskit/icon/core/paint-bucket';
25
+ import { Box, xcss } from '@atlaskit/primitives';
24
26
  import Toggle from '@atlaskit/toggle';
25
27
  import { clearHoverSelection, hoverColumns, hoverRows } from '../../commands';
26
28
  import { setColorWithAnalytics, toggleHeaderColumnWithAnalytics, toggleHeaderRowWithAnalytics, toggleNumberColumnWithAnalytics } from '../../commands-with-analytics';
@@ -32,7 +34,7 @@ import { checkIfHeaderColumnEnabled, checkIfHeaderRowEnabled, checkIfNumberColum
32
34
  import { getDragMenuConfig } from '../../utils/drag-menu';
33
35
  import { colorPalletteColumns } from '../consts';
34
36
  import { DropdownMenu } from './DropdownMenu';
35
- import { cellColourPreviewStyles, dragMenuBackgroundColorStyles, elementBeforeIconStyles, toggleStyles } from './styles';
37
+ import { cellColourPreviewStyles, dragMenuBackgroundColorStyles, toggleStyles } from './styles';
36
38
  const MapDragMenuOptionIdToMessage = {
37
39
  add_row_above: {
38
40
  message: messages.addRowAbove,
@@ -97,6 +99,10 @@ const getGroupedDragMenuConfig = tableSortColumnReorder => {
97
99
  tableSortColumnReorder ? groupedDragMenuConfig.unshift(sortColumnItems) : groupedDragMenuConfig.push(sortColumnItems);
98
100
  return groupedDragMenuConfig;
99
101
  };
102
+ const elementBeforeIconStyles = xcss({
103
+ marginRight: 'space.negative.075',
104
+ display: 'flex'
105
+ });
100
106
  const convertToDropdownItems = (dragMenuConfig, formatMessage, tableSortColumnReorder = false, selectionRect) => {
101
107
  const groupedDragMenuConfig = getGroupedDragMenuConfig(tableSortColumnReorder);
102
108
  let menuItemsArr = [...Array(groupedDragMenuConfig.length)].map(() => []);
@@ -144,12 +150,13 @@ const convertToDropdownItems = (dragMenuConfig, formatMessage, tableSortColumnRe
144
150
  name: item.id
145
151
  },
146
152
  isDisabled: item.disabled,
147
- elemBefore: item.icon ?
148
- // eslint-disable-next-line @atlaskit/ui-styling-standard/no-imported-style-values, @atlaskit/design-system/consistent-css-prop-usage -- Ignored via go/DSP-18766
149
- jsx("span", {
150
- css: elementBeforeIconStyles
153
+ elemBefore: item.icon ? jsx(Box, {
154
+ xcss: elementBeforeIconStyles
151
155
  }, jsx(item.icon, {
152
- label: formatMessage(MapDragMenuOptionIdToMessage[item.id].message, options)
156
+ color: "currentColor",
157
+ spacing: "spacious",
158
+ label: formatMessage(MapDragMenuOptionIdToMessage[item.id].message, options),
159
+ LEGACY_fallbackIcon: item.iconFallback ? item.iconFallback : undefined
153
160
  })) : undefined,
154
161
  // eslint-disable-next-line @atlaskit/ui-styling-standard/no-imported-style-values, @atlaskit/design-system/consistent-css-prop-usage -- Ignored via go/DSP-18766
155
162
  elemAfter: item.keymap ? jsx("div", {
@@ -256,13 +263,13 @@ const DragMenu = /*#__PURE__*/React.memo(({
256
263
  value: {
257
264
  name: 'background'
258
265
  },
259
- elemBefore:
260
- // eslint-disable-next-line @atlaskit/ui-styling-standard/no-imported-style-values, @atlaskit/design-system/consistent-css-prop-usage -- Ignored via go/DSP-18766
261
- jsx("span", {
262
- css: elementBeforeIconStyles
263
- }, jsx(EditorBackgroundColorIcon, {
266
+ elemBefore: jsx(Box, {
267
+ xcss: elementBeforeIconStyles
268
+ }, jsx(PaintBucketIcon, {
269
+ color: "currentColor",
270
+ spacing: "spacious",
264
271
  label: formatMessage(messages.backgroundColor),
265
- size: "medium"
272
+ LEGACY_fallbackIcon: EditorBackgroundColorIcon
266
273
  })),
267
274
  elemAfter: jsx("div", {
268
275
  // eslint-disable-next-line @atlaskit/ui-styling-standard/no-classname-prop -- Ignored via go/DSP-18766
@@ -11,12 +11,6 @@ export const cellColourPreviewStyles = selectedColor => css({
11
11
  }
12
12
  });
13
13
 
14
- // eslint-disable-next-line @atlaskit/ui-styling-standard/no-exported-styles -- Ignored via go/DSP-18766
15
- export const elementBeforeIconStyles = css({
16
- marginRight: "var(--ds-space-negative-075, -6px)",
17
- display: 'flex'
18
- });
19
-
20
14
  // eslint-disable-next-line @atlaskit/design-system/no-css-tagged-template-expression -- needs manual remediation
21
15
  export const dragMenuBackgroundColorStyles = (tableSortColumnReorder = false) => css`
22
16
  .${ClassName.DRAG_SUBMENU} {
@@ -0,0 +1,12 @@
1
+ import React from 'react';
2
+ import { useSharedPluginState } from '@atlaskit/editor-common/hooks';
3
+ import { SortingIcon } from '@atlaskit/editor-common/table';
4
+ export const SortingIconWrapper = props => {
5
+ const {
6
+ editorViewModeState
7
+ } = useSharedPluginState(props.api, ['editorViewMode']);
8
+ if ((editorViewModeState === null || editorViewModeState === void 0 ? void 0 : editorViewModeState.mode) === 'edit') {
9
+ return null;
10
+ }
11
+ return /*#__PURE__*/React.createElement(SortingIcon, props);
12
+ };