@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
@@ -1,6 +1,20 @@
1
1
  import { TableSortOrder as SortOrder } from '@atlaskit/custom-steps';
2
2
  import { INPUT_METHOD } from '@atlaskit/editor-common/analytics';
3
3
  import { addColumnAfter, addColumnBefore, addRowAfter, addRowBefore, backspace, deleteColumn, deleteRow, moveColumnLeft, moveColumnRight, moveRowDown, moveRowUp, tooltip } from '@atlaskit/editor-common/keymaps';
4
+ import SortAscendingIcon from '@atlaskit/icon/core/sort-ascending';
5
+ import SortDescendingIcon from '@atlaskit/icon/core/sort-descending';
6
+ import TableCellClearIcon from '@atlaskit/icon/core/table-cell-clear';
7
+ import TableColumnAddLeftIcon from '@atlaskit/icon/core/table-column-add-left';
8
+ import TableColumnAddRightIcon from '@atlaskit/icon/core/table-column-add-right';
9
+ import TableColumnDeleteIcon from '@atlaskit/icon/core/table-column-delete';
10
+ import TableColumnMoveLeftIcon from '@atlaskit/icon/core/table-column-move-left';
11
+ import TableColumnMoveRightIcon from '@atlaskit/icon/core/table-column-move-right';
12
+ import TableColumnsDistributeIcon from '@atlaskit/icon/core/table-columns-distribute';
13
+ import TableRowAddAboveIcon from '@atlaskit/icon/core/table-row-add-above';
14
+ import TableRowAddBelowIcon from '@atlaskit/icon/core/table-row-add-below';
15
+ import TableRowDeleteIcon from '@atlaskit/icon/core/table-row-delete';
16
+ import TableRowMoveDownIcon from '@atlaskit/icon/core/table-row-move-down';
17
+ import TableRowMoveUpIcon from '@atlaskit/icon/core/table-row-move-up';
4
18
  import ArrowDownIcon from '@atlaskit/icon/glyph/arrow-down';
5
19
  import ArrowLeftIcon from '@atlaskit/icon/glyph/arrow-left';
6
20
  import ArrowRightIcon from '@atlaskit/icon/glyph/arrow-right';
@@ -69,48 +83,56 @@ export const getDragMenuConfig = (direction, getEditorContainerWidth, hasMergedC
69
83
  const addOptions = direction === 'row' ? [{
70
84
  label: 'above',
71
85
  offset: 0,
72
- icon: AddRowAboveIcon,
86
+ icon: TableRowAddAboveIcon,
87
+ iconFallback: AddRowAboveIcon,
73
88
  keymap: addRowBefore
74
89
  }, {
75
90
  label: 'below',
76
91
  offset: 1,
77
- icon: AddRowBelowIcon,
92
+ icon: TableRowAddBelowIcon,
93
+ iconFallback: AddRowBelowIcon,
78
94
  keymap: addRowAfter
79
95
  }] : [{
80
96
  label: 'left',
81
97
  offset: 0,
82
- icon: AddColLeftIcon,
98
+ icon: TableColumnAddLeftIcon,
99
+ iconFallback: AddColLeftIcon,
83
100
  keymap: addColumnBefore
84
101
  }, {
85
102
  label: 'right',
86
103
  offset: 1,
87
- icon: AddColRightIcon,
104
+ icon: TableColumnAddRightIcon,
105
+ iconFallback: AddColRightIcon,
88
106
  keymap: addColumnAfter
89
107
  }];
90
108
  const moveOptions = direction === 'row' ? [{
91
109
  label: 'up',
92
- icon: ArrowUpIcon,
110
+ icon: TableRowMoveUpIcon,
111
+ iconFallback: ArrowUpIcon,
93
112
  keymap: moveRowUp,
94
113
  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),
95
114
  getOriginIndexes: getSelectedRowIndexes,
96
115
  getTargetIndex: selectionRect => selectionRect.top - 1
97
116
  }, {
98
117
  label: 'down',
99
- icon: ArrowDownIcon,
118
+ icon: TableRowMoveDownIcon,
119
+ iconFallback: ArrowDownIcon,
100
120
  keymap: moveRowDown,
101
121
  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),
102
122
  getOriginIndexes: getSelectedRowIndexes,
103
123
  getTargetIndex: selectionRect => selectionRect.bottom
104
124
  }] : [{
105
125
  label: 'left',
106
- icon: ArrowLeftIcon,
126
+ icon: TableColumnMoveLeftIcon,
127
+ iconFallback: ArrowLeftIcon,
107
128
  keymap: moveColumnLeft,
108
129
  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),
109
130
  getOriginIndexes: getSelectedColumnIndexes,
110
131
  getTargetIndex: selectionRect => selectionRect.left - 1
111
132
  }, {
112
133
  label: 'right',
113
- icon: ArrowRightIcon,
134
+ icon: TableColumnMoveRightIcon,
135
+ iconFallback: ArrowRightIcon,
114
136
  keymap: moveColumnRight,
115
137
  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),
116
138
  getOriginIndexes: getSelectedColumnIndexes,
@@ -119,21 +141,25 @@ export const getDragMenuConfig = (direction, getEditorContainerWidth, hasMergedC
119
141
  const sortOptions = direction === 'column' ? [{
120
142
  label: 'increasing',
121
143
  order: SortOrder.ASC,
122
- icon: HipchatChevronDoubleUpIcon
144
+ icon: SortAscendingIcon,
145
+ iconFallback: HipchatChevronDoubleUpIcon
123
146
  }, {
124
147
  label: 'decreasing',
125
148
  order: SortOrder.DESC,
126
- icon: HipchatChevronDoubleDownIcon
149
+ icon: SortDescendingIcon,
150
+ iconFallback: HipchatChevronDoubleDownIcon
127
151
  }] : [];
128
152
  const sortConfigs = [...sortOptions.map(({
129
153
  label,
130
154
  order,
131
- icon
155
+ icon,
156
+ iconFallback
132
157
  }) => ({
133
158
  id: `sort_column_${order}`,
134
159
  title: `Sort ${label}`,
135
160
  disabled: hasMergedCellsInTable,
136
- icon,
161
+ icon: icon,
162
+ iconFallback: iconFallback,
137
163
  onClick: (state, dispatch) => {
138
164
  sortColumnWithAnalytics(editorAnalyticsAPI)(INPUT_METHOD.TABLE_CONTEXT_MENU, index !== null && index !== void 0 ? index : 0, order)(state, dispatch);
139
165
  return true;
@@ -143,11 +169,13 @@ export const getDragMenuConfig = (direction, getEditorContainerWidth, hasMergedC
143
169
  label,
144
170
  offset,
145
171
  icon,
172
+ iconFallback,
146
173
  keymap
147
174
  }) => ({
148
175
  id: `add_${direction}_${label}`,
149
176
  title: `Add ${direction} ${label}`,
150
- icon,
177
+ icon: icon,
178
+ iconFallback: iconFallback,
151
179
  onClick: (state, dispatch) => {
152
180
  if (direction === 'row') {
153
181
  insertRowWithAnalytics(editorAnalyticsAPI, tableDuplicateCellColouring)(INPUT_METHOD.TABLE_CONTEXT_MENU, {
@@ -176,7 +204,8 @@ export const getDragMenuConfig = (direction, getEditorContainerWidth, hasMergedC
176
204
  }
177
205
  return false;
178
206
  },
179
- icon: EditorLayoutThreeEqualIcon
207
+ icon: TableColumnsDistributeIcon,
208
+ iconFallback: EditorLayoutThreeEqualIcon
180
209
  } : undefined, {
181
210
  id: 'clear_cells',
182
211
  title: 'Clear cells',
@@ -184,7 +213,8 @@ export const getDragMenuConfig = (direction, getEditorContainerWidth, hasMergedC
184
213
  emptyMultipleCellsWithAnalytics(editorAnalyticsAPI)(INPUT_METHOD.TABLE_CONTEXT_MENU, targetCellPosition)(state, dispatch);
185
214
  return true;
186
215
  },
187
- icon: CrossCircleIcon,
216
+ icon: TableCellClearIcon,
217
+ iconFallback: CrossCircleIcon,
188
218
  keymap: tooltip(backspace)
189
219
  }, {
190
220
  id: `delete_${direction}`,
@@ -197,12 +227,14 @@ export const getDragMenuConfig = (direction, getEditorContainerWidth, hasMergedC
197
227
  }
198
228
  return true;
199
229
  },
200
- icon: RemoveIcon,
230
+ icon: direction === 'row' ? TableRowDeleteIcon : TableColumnDeleteIcon,
231
+ iconFallback: RemoveIcon,
201
232
  keymap: direction === 'row' ? tooltip(deleteRow) : tooltip(deleteColumn)
202
233
  }, ...moveOptions.map(({
203
234
  label,
204
235
  canMove,
205
236
  icon,
237
+ iconFallback,
206
238
  keymap,
207
239
  getOriginIndexes,
208
240
  getTargetIndex
@@ -210,7 +242,8 @@ export const getDragMenuConfig = (direction, getEditorContainerWidth, hasMergedC
210
242
  id: `move_${direction}_${label}`,
211
243
  title: `Move ${direction} ${label}`,
212
244
  disabled: !canMove,
213
- icon,
245
+ icon: icon,
246
+ iconFallback: iconFallback,
214
247
  onClick: (state, dispatch) => {
215
248
  if (canMove) {
216
249
  requestAnimationFrame(() => {
@@ -351,7 +351,7 @@ var TableComponent = /*#__PURE__*/function (_React$Component) {
351
351
  _createClass(TableComponent, [{
352
352
  key: "componentDidMount",
353
353
  value: function componentDidMount() {
354
- var _this$props$pluginInj, _this$table2, _this$table3;
354
+ var _this$table, _this$table2, _this$table3;
355
355
  var _this$props7 = this.props,
356
356
  allowColumnResizing = _this$props7.allowColumnResizing,
357
357
  eventDispatcher = _this$props7.eventDispatcher,
@@ -360,12 +360,7 @@ var TableComponent = /*#__PURE__*/function (_React$Component) {
360
360
  getNode = _this$props7.getNode,
361
361
  getEditorFeatureFlags = _this$props7.getEditorFeatureFlags,
362
362
  isTableScalingEnabled = _this$props7.isTableScalingEnabled;
363
- var _ref = ((_this$props$pluginInj = this.props.pluginInjectionApi) === null || _this$props$pluginInj === void 0 || (_this$props$pluginInj = _this$props$pluginInj.editorViewMode) === null || _this$props$pluginInj === void 0 ? void 0 : _this$props$pluginInj.sharedState.currentState()) || {},
364
- mode = _ref.mode;
365
- if (mode === 'view') {
366
- var _this$table;
367
- this === null || this === void 0 || (_this$table = this.table) === null || _this$table === void 0 || _this$table.addEventListener('mouseenter', this.handleMouseEnter);
368
- }
363
+ this === null || this === void 0 || (_this$table = this.table) === null || _this$table === void 0 || _this$table.addEventListener('mouseenter', this.handleMouseEnter);
369
364
  this === null || this === void 0 || (_this$table2 = this.table) === null || _this$table2 === void 0 || _this$table2.addEventListener('mouseout', this.handleMouseOut);
370
365
  this === null || this === void 0 || (_this$table3 = this.table) === null || _this$table3 === void 0 || _this$table3.addEventListener('mouseover', this.handleMouseOver);
371
366
  var _getEditorFeatureFlag = getEditorFeatureFlags(),
@@ -640,8 +635,8 @@ var TableComponent = /*#__PURE__*/function (_React$Component) {
640
635
  var isNoOfColumnsChanged = tablesHaveDifferentNoOfColumns(currentTable, previousTable);
641
636
  var isNoOfRowsChanged = tablesHaveDifferentNoOfRows(currentTable, previousTable);
642
637
  if (isNoOfColumnsChanged || isNoOfRowsChanged) {
643
- var _this$props$pluginInj2;
644
- (_this$props$pluginInj2 = this.props.pluginInjectionApi) === null || _this$props$pluginInj2 === void 0 || (_this$props$pluginInj2 = _this$props$pluginInj2.accessibilityUtils) === null || _this$props$pluginInj2 === void 0 || _this$props$pluginInj2.actions.ariaNotify(getAssistiveMessage(previousTable, currentTable, this.props.intl), {
638
+ var _this$props$pluginInj;
639
+ (_this$props$pluginInj = this.props.pluginInjectionApi) === null || _this$props$pluginInj === void 0 || (_this$props$pluginInj = _this$props$pluginInj.accessibilityUtils) === null || _this$props$pluginInj === void 0 || _this$props$pluginInj.actions.ariaNotify(getAssistiveMessage(previousTable, currentTable, this.props.intl), {
645
640
  priority: 'important'
646
641
  });
647
642
  }
@@ -268,7 +268,7 @@ var tablesPlugin = function tablesPlugin(_ref) {
268
268
  }, {
269
269
  name: 'tableViewModeSort',
270
270
  plugin: function plugin() {
271
- return api !== null && api !== void 0 && api.editorViewMode ? createViewModeSortPlugin(api.editorViewMode) : undefined;
271
+ return api !== null && api !== void 0 && api.editorViewMode ? createViewModeSortPlugin(api) : undefined;
272
272
  }
273
273
  }, {
274
274
  name: 'tableLocalId',
@@ -16,15 +16,15 @@ import { createElement } from 'react';
16
16
  import ReactDOM from 'react-dom';
17
17
  import { RawIntlProvider } from 'react-intl-next';
18
18
  import { SafePlugin } from '@atlaskit/editor-common/safe-plugin';
19
- import { SortingIcon } from '@atlaskit/editor-common/table';
20
19
  import { SortOrder } from '@atlaskit/editor-common/types';
21
20
  import { Decoration, DecorationSet } from '@atlaskit/editor-prosemirror/view';
22
21
  import { TableMap } from '@atlaskit/editor-tables/table-map';
22
+ import { SortingIconWrapper } from '../../ui/icons/SortingIconWrapper';
23
23
  import { getPluginState } from '../plugin-factory';
24
24
  import { IS_DISABLED_CLASS_NAME, SORT_INDEX_DATA_ATTRIBUTE, SORTING_ICON_CLASS_NAME } from './consts';
25
25
  import { tableViewModeSortPluginKey as key } from './plugin-key';
26
26
  import { getTableElements, toggleSort } from './utils';
27
- export var createPlugin = function createPlugin(editorViewModeAPI) {
27
+ export var createPlugin = function createPlugin(api) {
28
28
  return new SafePlugin({
29
29
  state: {
30
30
  init: function init() {
@@ -35,9 +35,10 @@ export var createPlugin = function createPlugin(editorViewModeAPI) {
35
35
  };
36
36
  },
37
37
  apply: function apply(tr, pluginState, oldState) {
38
+ var _api$editorViewMode;
38
39
  // TODO - move this mode check to plugin creation if possible. Right now it's here because the initial state
39
40
  // does not appear correct when the plugin is created.
40
- var _ref = (editorViewModeAPI === null || editorViewModeAPI === void 0 ? void 0 : editorViewModeAPI.sharedState.currentState()) || {},
41
+ var _ref = ((_api$editorViewMode = api.editorViewMode) === null || _api$editorViewMode === void 0 ? void 0 : _api$editorViewMode.sharedState.currentState()) || {},
41
42
  mode = _ref.mode;
42
43
  if (mode !== 'view') {
43
44
  return pluginState;
@@ -96,7 +97,6 @@ export var createPlugin = function createPlugin(editorViewModeAPI) {
96
97
  var map = TableMap.get(tableNode);
97
98
  var hasMergedCells = new Set(map.map).size !== map.map.length;
98
99
  map.mapByRow[0].forEach(function (cell, index) {
99
- // return pluginState;
100
100
  decs.push(Decoration.widget(cell + pos + 2, function () {
101
101
  var _sort$tableId;
102
102
  var element = document.createElement('div');
@@ -116,11 +116,12 @@ export var createPlugin = function createPlugin(editorViewModeAPI) {
116
116
  getIntl = _getPluginState.getIntl;
117
117
  ReactDOM.render( /*#__PURE__*/createElement(RawIntlProvider, {
118
118
  value: getIntl()
119
- }, /*#__PURE__*/createElement(SortingIcon, {
119
+ }, /*#__PURE__*/createElement(SortingIconWrapper, {
120
120
  isSortingAllowed: !hasMergedCells,
121
121
  sortOrdered: sortOrdered,
122
122
  onClick: function onClick() {},
123
- onKeyDown: function onKeyDown() {}
123
+ onKeyDown: function onKeyDown() {},
124
+ api: api
124
125
  })), element);
125
126
  return element;
126
127
  }));
@@ -147,9 +148,9 @@ export var createPlugin = function createPlugin(editorViewModeAPI) {
147
148
  },
148
149
  key: key,
149
150
  appendTransaction: function appendTransaction(trs, oldState, newState) {
150
- var _key$getState;
151
+ var _api$editorViewMode2, _key$getState;
151
152
  // return newState.tr;
152
- var _ref8 = (editorViewModeAPI === null || editorViewModeAPI === void 0 ? void 0 : editorViewModeAPI.sharedState.currentState()) || {},
153
+ var _ref8 = (api === null || api === void 0 || (_api$editorViewMode2 = api.editorViewMode) === null || _api$editorViewMode2 === void 0 ? void 0 : _api$editorViewMode2.sharedState.currentState()) || {},
153
154
  mode = _ref8.mode;
154
155
  if (mode !== 'view') {
155
156
  return newState.tr;
@@ -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';
@@ -78,6 +78,7 @@ var FloatingContextualButtonInner = /*#__PURE__*/React.memo(function (props) {
78
78
  onClick: handleClick,
79
79
  iconBefore: jsx(ExpandIcon, {
80
80
  label: "",
81
+ color: "currentColor",
81
82
  isFacadeDisabled: true
82
83
  }),
83
84
  "aria-label": labelCellOptions,
@@ -1,11 +1,15 @@
1
+ import _defineProperty from "@babel/runtime/helpers/defineProperty";
2
+ function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
3
+ function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
1
4
  // eslint-disable-next-line @atlaskit/ui-styling-standard/use-compiled -- Ignored via go/DSP-18766
2
5
  import { css } from '@emotion/react';
6
+ import { fg } from '@atlaskit/platform-feature-flags';
3
7
  import { N0, N20, N30A, N700 } from '@atlaskit/theme/colors';
4
8
  import { contextualMenuTriggerSize } from '../consts';
5
9
  export var tableFloatingCellButtonStyles = function tableFloatingCellButtonStyles() {
6
10
  return css({
7
11
  // eslint-disable-next-line @atlaskit/ui-styling-standard/no-nested-selectors -- Ignored via go/DSP-18766
8
- '> div': {
12
+ '> div': _objectSpread({
9
13
  // Sits behind button to provide surface-color background
10
14
  background: "var(--ds-surface, ".concat(N20, ")"),
11
15
  borderRadius: "var(--ds-border-radius, 3px)",
@@ -13,7 +17,9 @@ export var tableFloatingCellButtonStyles = function tableFloatingCellButtonStyle
13
17
  // eslint-disable-next-line @atlaskit/ui-styling-standard/no-imported-style-values, @atlaskit/ui-styling-standard/no-unsafe-values -- Ignored via go/DSP-18766
14
18
  height: "".concat(contextualMenuTriggerSize + 2, "px"),
15
19
  flexDirection: 'column'
16
- },
20
+ }, fg('platform-visual-refresh-icons') && {
21
+ width: "var(--ds-space-250, 20px)"
22
+ }),
17
23
  // eslint-disable-next-line @atlaskit/ui-styling-standard/no-nested-selectors, @atlaskit/ui-styling-standard/no-unsafe-selectors -- Ignored via go/DSP-18766
18
24
  '&& button': {
19
25
  background: "var(--ds-background-neutral, none)",
@@ -30,10 +30,19 @@ import { closestElement } from '@atlaskit/editor-common/utils';
30
30
  import { hexToEditorBackgroundPaletteColor } from '@atlaskit/editor-palette';
31
31
  import { shortcutStyle } from '@atlaskit/editor-shared-styles/shortcut';
32
32
  import { splitCell } from '@atlaskit/editor-tables/utils';
33
- import CrossCircleIcon from '@atlaskit/icon/glyph/cross-circle';
34
- import EditorBackgroundColorIcon from '@atlaskit/icon/glyph/editor/background-color';
35
- import RemoveIcon from '@atlaskit/icon/glyph/editor/remove';
33
+ import CrossCircleIcon from '@atlaskit/icon/core/migration/cross-circle';
34
+ import RemoveIcon from '@atlaskit/icon/core/migration/delete--editor-remove';
35
+ import EditorBackgroundColorIcon from '@atlaskit/icon/core/migration/paint-bucket--editor-background-color';
36
+ import PaintBucketIcon from '@atlaskit/icon/core/paint-bucket';
37
+ import TableCellClearIcon from '@atlaskit/icon/core/table-cell-clear';
38
+ import TableCellMergeIcon from '@atlaskit/icon/core/table-cell-merge';
39
+ import TableCellSplitIcon from '@atlaskit/icon/core/table-cell-split';
40
+ import TableColumnAddRightIcon from '@atlaskit/icon/core/table-column-add-right';
41
+ import TableColumnDeleteIcon from '@atlaskit/icon/core/table-column-delete';
42
+ import TableRowAddBelowIcon from '@atlaskit/icon/core/table-row-add-below';
43
+ import TableRowDeleteIcon from '@atlaskit/icon/core/table-row-delete';
36
44
  import { fg } from '@atlaskit/platform-feature-flags';
45
+ import { Box, xcss } from '@atlaskit/primitives';
37
46
  import { clearHoverSelection, hoverColumns, hoverMergedCells, hoverRows, setFocusToCellMenu, toggleContextualMenu } from '../../commands';
38
47
  import { deleteColumnsWithAnalytics, deleteRowsWithAnalytics, distributeColumnsWidthsWithAnalytics, emptyMultipleCellsWithAnalytics, insertColumnWithAnalytics, insertRowWithAnalytics, mergeCellsWithAnalytics, setColorWithAnalytics, sortColumnWithAnalytics, splitCellWithAnalytics } from '../../commands-with-analytics';
39
48
  import { getPluginState } from '../../pm-plugins/plugin-factory';
@@ -44,8 +53,13 @@ import { TableCssClassName as ClassName } from '../../types';
44
53
  import { getMergedCellsPositions, getSelectedColumnIndexes, getSelectedRowIndexes } from '../../utils';
45
54
  import { colorPalletteColumns, contextualMenuDropdownWidth, contextualMenuDropdownWidthDnD } from '../consts';
46
55
  import { AddColRightIcon, AddRowBelowIcon, MergeCellsIcon, SplitCellIcon } from '../icons';
47
- import { cellColourPreviewStyles, elementBeforeIconStyles } from './styles';
56
+ import { cellColourPreviewStyles } from './styles';
48
57
  var arrowsList = new Set(['ArrowRight', 'ArrowLeft']);
58
+ var elementBeforeIconStyles = xcss({
59
+ marginRight: 'space.negative.075',
60
+ display: 'flex'
61
+ });
62
+ // eslint-disable-next-line @repo/internal/react/no-class-components
49
63
  export var ContextualMenu = /*#__PURE__*/function (_Component) {
50
64
  _inherits(ContextualMenu, _Component);
51
65
  var _super = _createSuper(ContextualMenu);
@@ -100,13 +114,13 @@ export var ContextualMenu = /*#__PURE__*/function (_Component) {
100
114
  value: {
101
115
  name: 'background'
102
116
  },
103
- elemBefore: isDragAndDropEnabled ?
104
- // eslint-disable-next-line @atlaskit/ui-styling-standard/no-imported-style-values, @atlaskit/design-system/consistent-css-prop-usage -- Ignored via go/DSP-18766
105
- jsx("span", {
106
- css: elementBeforeIconStyles
107
- }, jsx(EditorBackgroundColorIcon, {
117
+ elemBefore: isDragAndDropEnabled ? jsx(Box, {
118
+ xcss: elementBeforeIconStyles
119
+ }, jsx(PaintBucketIcon, {
120
+ color: "currentColor",
121
+ spacing: "spacious",
108
122
  label: formatMessage(messages.backgroundColor),
109
- size: "medium"
123
+ LEGACY_fallbackIcon: EditorBackgroundColorIcon
110
124
  })) : undefined,
111
125
  elemAfter:
112
126
  // eslint-disable-next-line @atlaskit/ui-styling-standard/no-classname-prop -- Ignored via go/DSP-18766
@@ -182,22 +196,28 @@ export var ContextualMenu = /*#__PURE__*/function (_Component) {
182
196
  name: 'merge'
183
197
  },
184
198
  isDisabled: !canMergeCells(state.tr),
185
- elemBefore: isDragAndDropEnabled ?
186
- // eslint-disable-next-line @atlaskit/ui-styling-standard/no-imported-style-values, @atlaskit/design-system/consistent-css-prop-usage -- Ignored via go/DSP-18766
187
- jsx("span", {
188
- css: elementBeforeIconStyles
189
- }, jsx(MergeCellsIcon, null)) : undefined
199
+ elemBefore: isDragAndDropEnabled ? jsx(Box, {
200
+ xcss: elementBeforeIconStyles
201
+ }, jsx(TableCellMergeIcon, {
202
+ color: "currentColor",
203
+ spacing: "spacious",
204
+ label: formatMessage(messages.mergeCells),
205
+ LEGACY_fallbackIcon: MergeCellsIcon
206
+ })) : undefined
190
207
  }, {
191
208
  content: formatMessage(messages.splitCell),
192
209
  value: {
193
210
  name: 'split'
194
211
  },
195
212
  isDisabled: !splitCell(state),
196
- elemBefore: isDragAndDropEnabled ?
197
- // eslint-disable-next-line @atlaskit/ui-styling-standard/no-imported-style-values, @atlaskit/design-system/consistent-css-prop-usage -- Ignored via go/DSP-18766
198
- jsx("span", {
199
- css: elementBeforeIconStyles
200
- }, jsx(SplitCellIcon, null)) : undefined
213
+ elemBefore: isDragAndDropEnabled ? jsx(Box, {
214
+ xcss: elementBeforeIconStyles
215
+ }, jsx(TableCellSplitIcon, {
216
+ color: "currentColor",
217
+ spacing: "spacious",
218
+ label: formatMessage(messages.splitCell),
219
+ LEGACY_fallbackIcon: SplitCellIcon
220
+ })) : undefined
201
221
  }];
202
222
  }
203
223
  return [];
@@ -220,9 +240,14 @@ export var ContextualMenu = /*#__PURE__*/function (_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
  });
@@ -242,11 +267,14 @@ export var ContextualMenu = /*#__PURE__*/function (_Component) {
242
267
  elemAfter: jsx("div", {
243
268
  css: shortcutStyle
244
269
  }, tooltip(addRowAfter)),
245
- elemBefore: isDragAndDropEnabled ?
246
- // eslint-disable-next-line @atlaskit/ui-styling-standard/no-imported-style-values, @atlaskit/design-system/consistent-css-prop-usage -- Ignored via go/DSP-18766
247
- jsx("span", {
248
- css: elementBeforeIconStyles
249
- }, jsx(AddRowBelowIcon, null)) : undefined,
270
+ elemBefore: isDragAndDropEnabled ? jsx(Box, {
271
+ xcss: elementBeforeIconStyles
272
+ }, jsx(TableRowAddBelowIcon, {
273
+ color: "currentColor",
274
+ spacing: "spacious",
275
+ label: formatMessage(messages.addRowBelow),
276
+ LEGACY_fallbackIcon: AddRowBelowIcon
277
+ })) : undefined,
250
278
  'aria-label': fg('platform_editor_announce_cell_options_hotkeys') ? tooltip(addRowAfter, String(content)) : undefined
251
279
  };
252
280
  });
@@ -275,14 +303,15 @@ export var ContextualMenu = /*#__PURE__*/function (_Component) {
275
303
  elemAfter: jsx("div", {
276
304
  css: shortcutStyle
277
305
  }, tooltip(backspace)),
278
- elemBefore: isDragAndDropEnabled ?
279
- // eslint-disable-next-line @atlaskit/ui-styling-standard/no-imported-style-values, @atlaskit/design-system/consistent-css-prop-usage -- Ignored via go/DSP-18766
280
- jsx("span", {
281
- css: elementBeforeIconStyles
282
- }, jsx(CrossCircleIcon, {
306
+ elemBefore: isDragAndDropEnabled ? jsx(Box, {
307
+ xcss: elementBeforeIconStyles
308
+ }, jsx(TableCellClearIcon, {
309
+ color: "currentColor",
310
+ spacing: "spacious",
283
311
  label: formatMessage(messages.clearCells, {
284
312
  0: Math.max(noOfColumns, noOfRows)
285
- })
313
+ }),
314
+ LEGACY_fallbackIcon: CrossCircleIcon
286
315
  })) : undefined,
287
316
  'aria-label': fg('platform_editor_announce_cell_options_hotkeys') ? tooltip(backspace, String(content)) : undefined
288
317
  };
@@ -304,14 +333,15 @@ export var ContextualMenu = /*#__PURE__*/function (_Component) {
304
333
  value: {
305
334
  name: 'delete_column'
306
335
  },
307
- elemBefore: isDragAndDropEnabled ?
308
- // eslint-disable-next-line @atlaskit/ui-styling-standard/no-imported-style-values, @atlaskit/design-system/consistent-css-prop-usage -- Ignored via go/DSP-18766
309
- jsx("span", {
310
- css: elementBeforeIconStyles
311
- }, jsx(RemoveIcon, {
336
+ elemBefore: isDragAndDropEnabled ? jsx(Box, {
337
+ xcss: elementBeforeIconStyles
338
+ }, jsx(TableColumnDeleteIcon, {
339
+ color: "currentColor",
340
+ spacing: "spacious",
312
341
  label: formatMessage(messages.removeColumns, {
313
342
  0: noOfColumns
314
- })
343
+ }),
344
+ LEGACY_fallbackIcon: RemoveIcon
315
345
  })) : undefined
316
346
  };
317
347
  });
@@ -332,14 +362,15 @@ export var ContextualMenu = /*#__PURE__*/function (_Component) {
332
362
  value: {
333
363
  name: 'delete_row'
334
364
  },
335
- elemBefore: isDragAndDropEnabled ?
336
- // eslint-disable-next-line @atlaskit/ui-styling-standard/no-imported-style-values, @atlaskit/design-system/consistent-css-prop-usage -- Ignored via go/DSP-18766
337
- jsx("span", {
338
- css: elementBeforeIconStyles
339
- }, jsx(RemoveIcon, {
365
+ elemBefore: isDragAndDropEnabled ? jsx(Box, {
366
+ xcss: elementBeforeIconStyles
367
+ }, jsx(TableRowDeleteIcon, {
368
+ color: "currentColor",
369
+ spacing: "spacious",
340
370
  label: formatMessage(messages.removeRows, {
341
371
  0: noOfRows
342
- })
372
+ }),
373
+ LEGACY_fallbackIcon: RemoveIcon
343
374
  })) : undefined
344
375
  };
345
376
  });
@@ -14,15 +14,6 @@ export var cellColourPreviewStyles = function cellColourPreviewStyles(selectedCo
14
14
  }
15
15
  });
16
16
  };
17
-
18
- // eslint-disable-next-line @atlaskit/ui-styling-standard/no-exported-styles -- Ignored via go/DSP-18766
19
- export var elementBeforeIconStyles = css({
20
- marginRight: "var(--ds-space-negative-075, -6px)",
21
- display: 'flex'
22
- });
23
-
24
- // TODO Delete this comment after verifying space token -> previous value `padding: 8px`
25
- // TODO Delete this comment after verifying space token -> previous value `margin-left: 4px`
26
17
  export var tablePopupStyles = function tablePopupStyles(isDragAndDropEnabled
27
18
  // eslint-disable-next-line @atlaskit/design-system/no-css-tagged-template-expression -- needs manual remediation
28
19
  ) {
@@ -22,7 +22,9 @@ import { hexToEditorBackgroundPaletteColor } from '@atlaskit/editor-palette';
22
22
  import { shortcutStyle } from '@atlaskit/editor-shared-styles/shortcut';
23
23
  import { TableMap } from '@atlaskit/editor-tables/table-map';
24
24
  import { findCellRectClosestToPos, getSelectionRect, isSelectionType } from '@atlaskit/editor-tables/utils';
25
- import EditorBackgroundColorIcon from '@atlaskit/icon/glyph/editor/background-color';
25
+ import EditorBackgroundColorIcon from '@atlaskit/icon/core/migration/paint-bucket--editor-background-color';
26
+ import PaintBucketIcon from '@atlaskit/icon/core/paint-bucket';
27
+ import { Box, xcss } from '@atlaskit/primitives';
26
28
  import Toggle from '@atlaskit/toggle';
27
29
  import { clearHoverSelection, hoverColumns, hoverRows } from '../../commands';
28
30
  import { setColorWithAnalytics, toggleHeaderColumnWithAnalytics, toggleHeaderRowWithAnalytics, toggleNumberColumnWithAnalytics } from '../../commands-with-analytics';
@@ -34,7 +36,7 @@ import { checkIfHeaderColumnEnabled, checkIfHeaderRowEnabled, checkIfNumberColum
34
36
  import { getDragMenuConfig } from '../../utils/drag-menu';
35
37
  import { colorPalletteColumns } from '../consts';
36
38
  import { DropdownMenu } from './DropdownMenu';
37
- import { cellColourPreviewStyles, dragMenuBackgroundColorStyles, elementBeforeIconStyles, toggleStyles } from './styles';
39
+ import { cellColourPreviewStyles, dragMenuBackgroundColorStyles, toggleStyles } from './styles';
38
40
  var MapDragMenuOptionIdToMessage = {
39
41
  add_row_above: {
40
42
  message: messages.addRowAbove,
@@ -99,6 +101,10 @@ var getGroupedDragMenuConfig = function getGroupedDragMenuConfig(tableSortColumn
99
101
  tableSortColumnReorder ? groupedDragMenuConfig.unshift(sortColumnItems) : groupedDragMenuConfig.push(sortColumnItems);
100
102
  return groupedDragMenuConfig;
101
103
  };
104
+ var elementBeforeIconStyles = xcss({
105
+ marginRight: 'space.negative.075',
106
+ display: 'flex'
107
+ });
102
108
  var convertToDropdownItems = function convertToDropdownItems(dragMenuConfig, formatMessage) {
103
109
  var tableSortColumnReorder = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;
104
110
  var selectionRect = arguments.length > 3 ? arguments[3] : undefined;
@@ -150,12 +156,13 @@ var convertToDropdownItems = function convertToDropdownItems(dragMenuConfig, for
150
156
  name: item.id
151
157
  },
152
158
  isDisabled: item.disabled,
153
- elemBefore: item.icon ?
154
- // 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
- jsx("span", {
156
- css: elementBeforeIconStyles
159
+ elemBefore: item.icon ? jsx(Box, {
160
+ xcss: elementBeforeIconStyles
157
161
  }, jsx(item.icon, {
158
- label: formatMessage(MapDragMenuOptionIdToMessage[item.id].message, options)
162
+ color: "currentColor",
163
+ spacing: "spacious",
164
+ label: formatMessage(MapDragMenuOptionIdToMessage[item.id].message, options),
165
+ LEGACY_fallbackIcon: item.iconFallback ? item.iconFallback : undefined
159
166
  })) : undefined,
160
167
  // eslint-disable-next-line @atlaskit/ui-styling-standard/no-imported-style-values, @atlaskit/design-system/consistent-css-prop-usage -- Ignored via go/DSP-18766
161
168
  elemAfter: item.keymap ? jsx("div", {
@@ -253,13 +260,13 @@ var DragMenu = /*#__PURE__*/React.memo(function (_ref) {
253
260
  value: {
254
261
  name: 'background'
255
262
  },
256
- elemBefore:
257
- // eslint-disable-next-line @atlaskit/ui-styling-standard/no-imported-style-values, @atlaskit/design-system/consistent-css-prop-usage -- Ignored via go/DSP-18766
258
- jsx("span", {
259
- css: elementBeforeIconStyles
260
- }, jsx(EditorBackgroundColorIcon, {
263
+ elemBefore: jsx(Box, {
264
+ xcss: elementBeforeIconStyles
265
+ }, jsx(PaintBucketIcon, {
266
+ color: "currentColor",
267
+ spacing: "spacious",
261
268
  label: formatMessage(messages.backgroundColor),
262
- size: "medium"
269
+ LEGACY_fallbackIcon: EditorBackgroundColorIcon
263
270
  })),
264
271
  elemAfter: jsx("div", {
265
272
  // eslint-disable-next-line @atlaskit/ui-styling-standard/no-classname-prop -- Ignored via go/DSP-18766
@@ -15,12 +15,6 @@ export var cellColourPreviewStyles = function cellColourPreviewStyles(selectedCo
15
15
  });
16
16
  };
17
17
 
18
- // eslint-disable-next-line @atlaskit/ui-styling-standard/no-exported-styles -- Ignored via go/DSP-18766
19
- export var elementBeforeIconStyles = css({
20
- marginRight: "var(--ds-space-negative-075, -6px)",
21
- display: 'flex'
22
- });
23
-
24
18
  // eslint-disable-next-line @atlaskit/design-system/no-css-tagged-template-expression -- needs manual remediation
25
19
  export var dragMenuBackgroundColorStyles = function dragMenuBackgroundColorStyles() {
26
20
  var tableSortColumnReorder = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false;
@@ -0,0 +1,11 @@
1
+ import React from 'react';
2
+ import { useSharedPluginState } from '@atlaskit/editor-common/hooks';
3
+ import { SortingIcon } from '@atlaskit/editor-common/table';
4
+ export var SortingIconWrapper = function SortingIconWrapper(props) {
5
+ var _useSharedPluginState = useSharedPluginState(props.api, ['editorViewMode']),
6
+ editorViewModeState = _useSharedPluginState.editorViewModeState;
7
+ if ((editorViewModeState === null || editorViewModeState === void 0 ? void 0 : editorViewModeState.mode) === 'edit') {
8
+ return null;
9
+ }
10
+ return /*#__PURE__*/React.createElement(SortingIcon, props);
11
+ };