@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
@@ -2,6 +2,20 @@ import _toConsumableArray from "@babel/runtime/helpers/toConsumableArray";
2
2
  import { TableSortOrder as SortOrder } from '@atlaskit/custom-steps';
3
3
  import { INPUT_METHOD } from '@atlaskit/editor-common/analytics';
4
4
  import { addColumnAfter, addColumnBefore, addRowAfter, addRowBefore, backspace, deleteColumn, deleteRow, moveColumnLeft, moveColumnRight, moveRowDown, moveRowUp, tooltip } from '@atlaskit/editor-common/keymaps';
5
+ import SortAscendingIcon from '@atlaskit/icon/core/sort-ascending';
6
+ import SortDescendingIcon from '@atlaskit/icon/core/sort-descending';
7
+ import TableCellClearIcon from '@atlaskit/icon/core/table-cell-clear';
8
+ import TableColumnAddLeftIcon from '@atlaskit/icon/core/table-column-add-left';
9
+ import TableColumnAddRightIcon from '@atlaskit/icon/core/table-column-add-right';
10
+ import TableColumnDeleteIcon from '@atlaskit/icon/core/table-column-delete';
11
+ import TableColumnMoveLeftIcon from '@atlaskit/icon/core/table-column-move-left';
12
+ import TableColumnMoveRightIcon from '@atlaskit/icon/core/table-column-move-right';
13
+ import TableColumnsDistributeIcon from '@atlaskit/icon/core/table-columns-distribute';
14
+ import TableRowAddAboveIcon from '@atlaskit/icon/core/table-row-add-above';
15
+ import TableRowAddBelowIcon from '@atlaskit/icon/core/table-row-add-below';
16
+ import TableRowDeleteIcon from '@atlaskit/icon/core/table-row-delete';
17
+ import TableRowMoveDownIcon from '@atlaskit/icon/core/table-row-move-down';
18
+ import TableRowMoveUpIcon from '@atlaskit/icon/core/table-row-move-up';
5
19
  import ArrowDownIcon from '@atlaskit/icon/glyph/arrow-down';
6
20
  import ArrowLeftIcon from '@atlaskit/icon/glyph/arrow-left';
7
21
  import ArrowRightIcon from '@atlaskit/icon/glyph/arrow-right';
@@ -76,27 +90,32 @@ export var getDragMenuConfig = function getDragMenuConfig(direction, getEditorCo
76
90
  var addOptions = direction === 'row' ? [{
77
91
  label: 'above',
78
92
  offset: 0,
79
- icon: AddRowAboveIcon,
93
+ icon: TableRowAddAboveIcon,
94
+ iconFallback: AddRowAboveIcon,
80
95
  keymap: addRowBefore
81
96
  }, {
82
97
  label: 'below',
83
98
  offset: 1,
84
- icon: AddRowBelowIcon,
99
+ icon: TableRowAddBelowIcon,
100
+ iconFallback: AddRowBelowIcon,
85
101
  keymap: addRowAfter
86
102
  }] : [{
87
103
  label: 'left',
88
104
  offset: 0,
89
- icon: AddColLeftIcon,
105
+ icon: TableColumnAddLeftIcon,
106
+ iconFallback: AddColLeftIcon,
90
107
  keymap: addColumnBefore
91
108
  }, {
92
109
  label: 'right',
93
110
  offset: 1,
94
- icon: AddColRightIcon,
111
+ icon: TableColumnAddRightIcon,
112
+ iconFallback: AddColRightIcon,
95
113
  keymap: addColumnAfter
96
114
  }];
97
115
  var moveOptions = direction === 'row' ? [{
98
116
  label: 'up',
99
- icon: ArrowUpIcon,
117
+ icon: TableRowMoveUpIcon,
118
+ iconFallback: ArrowUpIcon,
100
119
  keymap: moveRowUp,
101
120
  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),
102
121
  getOriginIndexes: getSelectedRowIndexes,
@@ -105,7 +124,8 @@ export var getDragMenuConfig = function getDragMenuConfig(direction, getEditorCo
105
124
  }
106
125
  }, {
107
126
  label: 'down',
108
- icon: ArrowDownIcon,
127
+ icon: TableRowMoveDownIcon,
128
+ iconFallback: ArrowDownIcon,
109
129
  keymap: moveRowDown,
110
130
  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),
111
131
  getOriginIndexes: getSelectedRowIndexes,
@@ -114,7 +134,8 @@ export var getDragMenuConfig = function getDragMenuConfig(direction, getEditorCo
114
134
  }
115
135
  }] : [{
116
136
  label: 'left',
117
- icon: ArrowLeftIcon,
137
+ icon: TableColumnMoveLeftIcon,
138
+ iconFallback: ArrowLeftIcon,
118
139
  keymap: moveColumnLeft,
119
140
  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),
120
141
  getOriginIndexes: getSelectedColumnIndexes,
@@ -123,7 +144,8 @@ export var getDragMenuConfig = function getDragMenuConfig(direction, getEditorCo
123
144
  }
124
145
  }, {
125
146
  label: 'right',
126
- icon: ArrowRightIcon,
147
+ icon: TableColumnMoveRightIcon,
148
+ iconFallback: ArrowRightIcon,
127
149
  keymap: moveColumnRight,
128
150
  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),
129
151
  getOriginIndexes: getSelectedColumnIndexes,
@@ -134,21 +156,25 @@ export var getDragMenuConfig = function getDragMenuConfig(direction, getEditorCo
134
156
  var sortOptions = direction === 'column' ? [{
135
157
  label: 'increasing',
136
158
  order: SortOrder.ASC,
137
- icon: HipchatChevronDoubleUpIcon
159
+ icon: SortAscendingIcon,
160
+ iconFallback: HipchatChevronDoubleUpIcon
138
161
  }, {
139
162
  label: 'decreasing',
140
163
  order: SortOrder.DESC,
141
- icon: HipchatChevronDoubleDownIcon
164
+ icon: SortDescendingIcon,
165
+ iconFallback: HipchatChevronDoubleDownIcon
142
166
  }] : [];
143
167
  var sortConfigs = _toConsumableArray(sortOptions.map(function (_ref) {
144
168
  var label = _ref.label,
145
169
  order = _ref.order,
146
- icon = _ref.icon;
170
+ icon = _ref.icon,
171
+ iconFallback = _ref.iconFallback;
147
172
  return {
148
173
  id: "sort_column_".concat(order),
149
174
  title: "Sort ".concat(label),
150
175
  disabled: hasMergedCellsInTable,
151
176
  icon: icon,
177
+ iconFallback: iconFallback,
152
178
  onClick: function onClick(state, dispatch) {
153
179
  sortColumnWithAnalytics(editorAnalyticsAPI)(INPUT_METHOD.TABLE_CONTEXT_MENU, index !== null && index !== void 0 ? index : 0, order)(state, dispatch);
154
180
  return true;
@@ -159,11 +185,13 @@ export var getDragMenuConfig = function getDragMenuConfig(direction, getEditorCo
159
185
  var label = _ref2.label,
160
186
  offset = _ref2.offset,
161
187
  icon = _ref2.icon,
188
+ iconFallback = _ref2.iconFallback,
162
189
  keymap = _ref2.keymap;
163
190
  return {
164
191
  id: "add_".concat(direction, "_").concat(label),
165
192
  title: "Add ".concat(direction, " ").concat(label),
166
193
  icon: icon,
194
+ iconFallback: iconFallback,
167
195
  onClick: function onClick(state, dispatch) {
168
196
  if (direction === 'row') {
169
197
  insertRowWithAnalytics(editorAnalyticsAPI, tableDuplicateCellColouring)(INPUT_METHOD.TABLE_CONTEXT_MENU, {
@@ -193,7 +221,8 @@ export var getDragMenuConfig = function getDragMenuConfig(direction, getEditorCo
193
221
  }
194
222
  return false;
195
223
  },
196
- icon: EditorLayoutThreeEqualIcon
224
+ icon: TableColumnsDistributeIcon,
225
+ iconFallback: EditorLayoutThreeEqualIcon
197
226
  } : undefined, {
198
227
  id: 'clear_cells',
199
228
  title: 'Clear cells',
@@ -201,7 +230,8 @@ export var getDragMenuConfig = function getDragMenuConfig(direction, getEditorCo
201
230
  emptyMultipleCellsWithAnalytics(editorAnalyticsAPI)(INPUT_METHOD.TABLE_CONTEXT_MENU, targetCellPosition)(state, dispatch);
202
231
  return true;
203
232
  },
204
- icon: CrossCircleIcon,
233
+ icon: TableCellClearIcon,
234
+ iconFallback: CrossCircleIcon,
205
235
  keymap: tooltip(backspace)
206
236
  }, {
207
237
  id: "delete_".concat(direction),
@@ -214,12 +244,14 @@ export var getDragMenuConfig = function getDragMenuConfig(direction, getEditorCo
214
244
  }
215
245
  return true;
216
246
  },
217
- icon: RemoveIcon,
247
+ icon: direction === 'row' ? TableRowDeleteIcon : TableColumnDeleteIcon,
248
+ iconFallback: RemoveIcon,
218
249
  keymap: direction === 'row' ? tooltip(deleteRow) : tooltip(deleteColumn)
219
250
  }], _toConsumableArray(moveOptions.map(function (_ref3) {
220
251
  var label = _ref3.label,
221
252
  canMove = _ref3.canMove,
222
253
  icon = _ref3.icon,
254
+ iconFallback = _ref3.iconFallback,
223
255
  keymap = _ref3.keymap,
224
256
  getOriginIndexes = _ref3.getOriginIndexes,
225
257
  getTargetIndex = _ref3.getTargetIndex;
@@ -228,6 +260,7 @@ export var getDragMenuConfig = function getDragMenuConfig(direction, getEditorCo
228
260
  title: "Move ".concat(direction, " ").concat(label),
229
261
  disabled: !canMove,
230
262
  icon: icon,
263
+ iconFallback: iconFallback,
231
264
  onClick: function onClick(state, dispatch) {
232
265
  if (canMove) {
233
266
  requestAnimationFrame(function () {
@@ -7,4 +7,4 @@ import { SafePlugin } from '@atlaskit/editor-common/safe-plugin';
7
7
  import type { ExtractInjectionAPI } from '@atlaskit/editor-common/types';
8
8
  import type tablePlugin from '../../plugin';
9
9
  import type { ViewModeSortPluginState } from './types';
10
- export declare const createPlugin: (editorViewModeAPI: ExtractInjectionAPI<typeof tablePlugin>['editorViewMode']) => SafePlugin<ViewModeSortPluginState>;
10
+ export declare const createPlugin: (api: ExtractInjectionAPI<typeof tablePlugin>) => SafePlugin<ViewModeSortPluginState>;
@@ -1,3 +1,2 @@
1
1
  export declare const cellColourPreviewStyles: (selectedColor: string) => import("@emotion/react").SerializedStyles;
2
- export declare const elementBeforeIconStyles: import("@emotion/react").SerializedStyles;
3
2
  export declare const tablePopupStyles: (isDragAndDropEnabled: boolean | undefined) => import("@emotion/react").SerializedStyles;
@@ -1,4 +1,3 @@
1
1
  export declare const cellColourPreviewStyles: (selectedColor: string) => import("@emotion/react").SerializedStyles;
2
- export declare const elementBeforeIconStyles: import("@emotion/react").SerializedStyles;
3
2
  export declare const dragMenuBackgroundColorStyles: (tableSortColumnReorder?: boolean) => import("@emotion/react").SerializedStyles;
4
3
  export declare const toggleStyles: import("@emotion/react").SerializedStyles;
@@ -0,0 +1,10 @@
1
+ import React from 'react';
2
+ import { SortingIcon } from '@atlaskit/editor-common/table';
3
+ import type { ExtractInjectionAPI } from '@atlaskit/editor-common/types';
4
+ import type { TablePlugin } from '../../plugin';
5
+ type SortingIconProps = React.ComponentProps<typeof SortingIcon>;
6
+ type SortingIconWrapperProps = SortingIconProps & {
7
+ api: ExtractInjectionAPI<TablePlugin>;
8
+ };
9
+ export declare const SortingIconWrapper: (props: SortingIconWrapperProps) => JSX.Element | null;
10
+ export {};
@@ -1,17 +1,19 @@
1
1
  /// <reference types="react" />
2
2
  import type { EditorAnalyticsAPI } from '@atlaskit/editor-common/analytics';
3
- import type { Command, DropdownOptionT, GetEditorContainerWidth, IconProps } from '@atlaskit/editor-common/types';
3
+ import type { Command, DropdownOptionT, GetEditorContainerWidth } from '@atlaskit/editor-common/types';
4
4
  import type { AriaLiveElementAttributes } from '@atlaskit/editor-plugin-accessibility-utils';
5
5
  import type { Selection } from '@atlaskit/editor-prosemirror/state';
6
6
  import type { EditorView } from '@atlaskit/editor-prosemirror/view';
7
7
  import type { Rect, TableMap } from '@atlaskit/editor-tables/table-map';
8
+ import type { UNSAFE_NewIconProps } from '@atlaskit/icon/types';
8
9
  import type { DraggableData, DraggableType, PluginInjectionAPI, TableDirection } from '../types';
9
10
  export declare const getTargetIndex: (selectedIndexes: number[], direction: DraggableData['direction']) => number;
10
11
  export declare const canMove: (sourceType: DraggableType, direction: DraggableData['direction'], totalItemsOfSourceTypeCount: number, selection: Selection, selectionRect?: Rect) => boolean;
11
12
  export type DragMenuOptionIdType = 'add_row_above' | 'add_row_below' | 'add_column_left' | 'add_column_right' | 'distribute_columns' | 'clear_cells' | 'delete_row' | 'delete_column' | 'move_column_left' | 'move_column_right' | 'move_row_up' | 'move_row_down' | 'sort_column_asc' | 'sort_column_desc';
12
13
  export interface DragMenuConfig extends Omit<DropdownOptionT<Command>, 'icon'> {
13
14
  id: DragMenuOptionIdType;
14
- icon?: React.ComponentType<React.PropsWithChildren<IconProps>>;
15
+ icon?: React.ComponentType<React.PropsWithChildren<UNSAFE_NewIconProps>>;
16
+ iconFallback?: React.ComponentType<React.PropsWithChildren<UNSAFE_NewIconProps>>;
15
17
  keymap?: string;
16
18
  }
17
19
  export declare const getDragMenuConfig: (direction: TableDirection, getEditorContainerWidth: GetEditorContainerWidth, hasMergedCellsInTable: boolean, editorView: EditorView, api: PluginInjectionAPI | undefined | null, tableMap?: TableMap, index?: number, targetCellPosition?: number, selectionRect?: Rect, editorAnalyticsAPI?: EditorAnalyticsAPI, isHeaderRowRequired?: boolean, isTableScalingEnabled?: boolean, tableDuplicateCellColouring?: boolean, isTableFixedColumnWidthsOptionEnabled?: boolean, shouldUseIncreasedScalingPercent?: boolean, tableSortColumnReorder?: boolean, ariaNotifyPlugin?: ((message: string, ariaLiveElementAttributes?: AriaLiveElementAttributes) => void) | undefined, isCommentEditor?: boolean) => DragMenuConfig[];
@@ -7,4 +7,4 @@ import { SafePlugin } from '@atlaskit/editor-common/safe-plugin';
7
7
  import type { ExtractInjectionAPI } from '@atlaskit/editor-common/types';
8
8
  import type tablePlugin from '../../plugin';
9
9
  import type { ViewModeSortPluginState } from './types';
10
- export declare const createPlugin: (editorViewModeAPI: ExtractInjectionAPI<typeof tablePlugin>['editorViewMode']) => SafePlugin<ViewModeSortPluginState>;
10
+ export declare const createPlugin: (api: ExtractInjectionAPI<typeof tablePlugin>) => SafePlugin<ViewModeSortPluginState>;
@@ -1,3 +1,2 @@
1
1
  export declare const cellColourPreviewStyles: (selectedColor: string) => import("@emotion/react").SerializedStyles;
2
- export declare const elementBeforeIconStyles: import("@emotion/react").SerializedStyles;
3
2
  export declare const tablePopupStyles: (isDragAndDropEnabled: boolean | undefined) => import("@emotion/react").SerializedStyles;
@@ -1,4 +1,3 @@
1
1
  export declare const cellColourPreviewStyles: (selectedColor: string) => import("@emotion/react").SerializedStyles;
2
- export declare const elementBeforeIconStyles: import("@emotion/react").SerializedStyles;
3
2
  export declare const dragMenuBackgroundColorStyles: (tableSortColumnReorder?: boolean) => import("@emotion/react").SerializedStyles;
4
3
  export declare const toggleStyles: import("@emotion/react").SerializedStyles;
@@ -0,0 +1,10 @@
1
+ import React from 'react';
2
+ import { SortingIcon } from '@atlaskit/editor-common/table';
3
+ import type { ExtractInjectionAPI } from '@atlaskit/editor-common/types';
4
+ import type { TablePlugin } from '../../plugin';
5
+ type SortingIconProps = React.ComponentProps<typeof SortingIcon>;
6
+ type SortingIconWrapperProps = SortingIconProps & {
7
+ api: ExtractInjectionAPI<TablePlugin>;
8
+ };
9
+ export declare const SortingIconWrapper: (props: SortingIconWrapperProps) => JSX.Element | null;
10
+ export {};
@@ -1,17 +1,19 @@
1
1
  /// <reference types="react" />
2
2
  import type { EditorAnalyticsAPI } from '@atlaskit/editor-common/analytics';
3
- import type { Command, DropdownOptionT, GetEditorContainerWidth, IconProps } from '@atlaskit/editor-common/types';
3
+ import type { Command, DropdownOptionT, GetEditorContainerWidth } from '@atlaskit/editor-common/types';
4
4
  import type { AriaLiveElementAttributes } from '@atlaskit/editor-plugin-accessibility-utils';
5
5
  import type { Selection } from '@atlaskit/editor-prosemirror/state';
6
6
  import type { EditorView } from '@atlaskit/editor-prosemirror/view';
7
7
  import type { Rect, TableMap } from '@atlaskit/editor-tables/table-map';
8
+ import type { UNSAFE_NewIconProps } from '@atlaskit/icon/types';
8
9
  import type { DraggableData, DraggableType, PluginInjectionAPI, TableDirection } from '../types';
9
10
  export declare const getTargetIndex: (selectedIndexes: number[], direction: DraggableData['direction']) => number;
10
11
  export declare const canMove: (sourceType: DraggableType, direction: DraggableData['direction'], totalItemsOfSourceTypeCount: number, selection: Selection, selectionRect?: Rect) => boolean;
11
12
  export type DragMenuOptionIdType = 'add_row_above' | 'add_row_below' | 'add_column_left' | 'add_column_right' | 'distribute_columns' | 'clear_cells' | 'delete_row' | 'delete_column' | 'move_column_left' | 'move_column_right' | 'move_row_up' | 'move_row_down' | 'sort_column_asc' | 'sort_column_desc';
12
13
  export interface DragMenuConfig extends Omit<DropdownOptionT<Command>, 'icon'> {
13
14
  id: DragMenuOptionIdType;
14
- icon?: React.ComponentType<React.PropsWithChildren<IconProps>>;
15
+ icon?: React.ComponentType<React.PropsWithChildren<UNSAFE_NewIconProps>>;
16
+ iconFallback?: React.ComponentType<React.PropsWithChildren<UNSAFE_NewIconProps>>;
15
17
  keymap?: string;
16
18
  }
17
19
  export declare const getDragMenuConfig: (direction: TableDirection, getEditorContainerWidth: GetEditorContainerWidth, hasMergedCellsInTable: boolean, editorView: EditorView, api: PluginInjectionAPI | undefined | null, tableMap?: TableMap, index?: number, targetCellPosition?: number, selectionRect?: Rect, editorAnalyticsAPI?: EditorAnalyticsAPI, isHeaderRowRequired?: boolean, isTableScalingEnabled?: boolean, tableDuplicateCellColouring?: boolean, isTableFixedColumnWidthsOptionEnabled?: boolean, shouldUseIncreasedScalingPercent?: boolean, tableSortColumnReorder?: boolean, ariaNotifyPlugin?: ((message: string, ariaLiveElementAttributes?: AriaLiveElementAttributes) => void) | undefined, isCommentEditor?: boolean) => DragMenuConfig[];
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaskit/editor-plugin-table",
3
- "version": "7.28.8",
3
+ "version": "7.28.10",
4
4
  "description": "Table plugin for the @atlaskit/editor",
5
5
  "publishConfig": {
6
6
  "registry": "https://registry.npmjs.org/"
@@ -30,7 +30,7 @@
30
30
  "@atlaskit/adf-schema": "^40.9.0",
31
31
  "@atlaskit/button": "^20.2.0",
32
32
  "@atlaskit/custom-steps": "^0.7.0",
33
- "@atlaskit/editor-common": "^93.1.0",
33
+ "@atlaskit/editor-common": "^93.2.0",
34
34
  "@atlaskit/editor-palette": "1.6.1",
35
35
  "@atlaskit/editor-plugin-accessibility-utils": "^1.2.0",
36
36
  "@atlaskit/editor-plugin-analytics": "^1.8.0",
@@ -117,6 +117,9 @@
117
117
  },
118
118
  "platform_editor_breakout_use_css": {
119
119
  "type": "boolean"
120
+ },
121
+ "platform-visual-refresh-icons": {
122
+ "type": "boolean"
120
123
  }
121
124
  }
122
125
  }
@@ -228,11 +228,7 @@ class TableComponent extends React.Component<ComponentProps, TableState> {
228
228
  isTableScalingEnabled,
229
229
  } = this.props;
230
230
 
231
- const { mode } =
232
- this.props.pluginInjectionApi?.editorViewMode?.sharedState.currentState() || {};
233
- if (mode === 'view') {
234
- this?.table?.addEventListener('mouseenter', this.handleMouseEnter);
235
- }
231
+ this?.table?.addEventListener('mouseenter', this.handleMouseEnter);
236
232
 
237
233
  this?.table?.addEventListener('mouseout', this.handleMouseOut);
238
234
 
package/src/plugin.tsx CHANGED
@@ -436,7 +436,7 @@ const tablesPlugin: TablePlugin = ({ config: options, api }) => {
436
436
  {
437
437
  name: 'tableViewModeSort',
438
438
  plugin: () => {
439
- return api?.editorViewMode ? createViewModeSortPlugin(api.editorViewMode) : undefined;
439
+ return api?.editorViewMode ? createViewModeSortPlugin(api) : undefined;
440
440
  },
441
441
  },
442
442
  {
@@ -10,13 +10,13 @@ import ReactDOM from 'react-dom';
10
10
  import { RawIntlProvider } from 'react-intl-next';
11
11
 
12
12
  import { SafePlugin } from '@atlaskit/editor-common/safe-plugin';
13
- import { SortingIcon } from '@atlaskit/editor-common/table';
14
13
  import type { ExtractInjectionAPI } from '@atlaskit/editor-common/types';
15
14
  import { SortOrder } from '@atlaskit/editor-common/types';
16
15
  import { Decoration, DecorationSet } from '@atlaskit/editor-prosemirror/view';
17
16
  import { TableMap } from '@atlaskit/editor-tables/table-map';
18
17
 
19
18
  import type tablePlugin from '../../plugin';
19
+ import { SortingIconWrapper } from '../../ui/icons/SortingIconWrapper';
20
20
  import { getPluginState } from '../plugin-factory';
21
21
 
22
22
  import {
@@ -28,9 +28,7 @@ import { tableViewModeSortPluginKey as key } from './plugin-key';
28
28
  import type { ViewModeSortPluginState } from './types';
29
29
  import { getTableElements, toggleSort } from './utils';
30
30
 
31
- export const createPlugin = (
32
- editorViewModeAPI: ExtractInjectionAPI<typeof tablePlugin>['editorViewMode'],
33
- ) => {
31
+ export const createPlugin = (api: ExtractInjectionAPI<typeof tablePlugin>) => {
34
32
  return new SafePlugin({
35
33
  state: {
36
34
  init: () => ({
@@ -41,7 +39,7 @@ export const createPlugin = (
41
39
  apply(tr, pluginState: ViewModeSortPluginState, oldState) {
42
40
  // TODO - move this mode check to plugin creation if possible. Right now it's here because the initial state
43
41
  // does not appear correct when the plugin is created.
44
- const { mode } = editorViewModeAPI?.sharedState.currentState() || {};
42
+ const { mode } = api.editorViewMode?.sharedState.currentState() || {};
45
43
  if (mode !== 'view') {
46
44
  return pluginState;
47
45
  }
@@ -86,7 +84,6 @@ export const createPlugin = (
86
84
  const map = TableMap.get(tableNode);
87
85
  const hasMergedCells = new Set(map.map).size !== map.map.length;
88
86
  map.mapByRow[0].forEach((cell, index) => {
89
- // return pluginState;
90
87
  decs.push(
91
88
  Decoration.widget(cell + pos + 2, () => {
92
89
  const element = document.createElement('div');
@@ -109,11 +106,12 @@ export const createPlugin = (
109
106
  createElement(
110
107
  RawIntlProvider,
111
108
  { value: getIntl() },
112
- createElement(SortingIcon, {
109
+ createElement(SortingIconWrapper, {
113
110
  isSortingAllowed: !hasMergedCells,
114
111
  sortOrdered,
115
112
  onClick: () => {},
116
113
  onKeyDown: () => {},
114
+ api,
117
115
  }),
118
116
  ),
119
117
  element,
@@ -146,7 +144,7 @@ export const createPlugin = (
146
144
  key,
147
145
  appendTransaction: (trs, oldState, newState) => {
148
146
  // return newState.tr;
149
- const { mode } = editorViewModeAPI?.sharedState.currentState() || {};
147
+ const { mode } = api?.editorViewMode?.sharedState.currentState() || {};
150
148
  if (mode !== 'view') {
151
149
  return newState.tr;
152
150
  }
@@ -20,7 +20,7 @@ import type { Node as PMNode } from '@atlaskit/editor-prosemirror/model';
20
20
  import { findDomRefAtPos } from '@atlaskit/editor-prosemirror/utils';
21
21
  import type { EditorView } from '@atlaskit/editor-prosemirror/view';
22
22
  import { akEditorSmallZIndex } from '@atlaskit/editor-shared-styles';
23
- import ExpandIcon from '@atlaskit/icon/glyph/chevron-down';
23
+ import ExpandIcon from '@atlaskit/icon/utility/migration/chevron-down';
24
24
  import { fg } from '@atlaskit/platform-feature-flags';
25
25
 
26
26
  import { toggleContextualMenu } from '../../commands';
@@ -110,7 +110,7 @@ const FloatingContextualButtonInner = React.memo((props: Props & WrappedComponen
110
110
  fg('platform_editor_a11y_table_context_menu') ? focusToContextMenuTrigger : undefined
111
111
  }
112
112
  onClick={handleClick}
113
- iconBefore={<ExpandIcon label="" isFacadeDisabled={true} />}
113
+ iconBefore={<ExpandIcon label="" color="currentColor" isFacadeDisabled={true} />}
114
114
  aria-label={labelCellOptions}
115
115
  aria-expanded={
116
116
  fg('platform_editor_a11y_table_context_menu') ? isContextualMenuOpen : undefined
@@ -1,6 +1,7 @@
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
3
 
4
+ import { fg } from '@atlaskit/platform-feature-flags';
4
5
  import { N0, N20, N30A, N700 } from '@atlaskit/theme/colors';
5
6
  import { token } from '@atlaskit/tokens';
6
7
 
@@ -17,6 +18,10 @@ export const tableFloatingCellButtonStyles = () =>
17
18
  // eslint-disable-next-line @atlaskit/ui-styling-standard/no-imported-style-values, @atlaskit/ui-styling-standard/no-unsafe-values -- Ignored via go/DSP-18766
18
19
  height: `${contextualMenuTriggerSize + 2}px`,
19
20
  flexDirection: 'column',
21
+ // eslint-disable-next-line @atlaskit/ui-styling-standard/no-imported-style-values, @atlaskit/ui-styling-standard/no-unsafe-values
22
+ ...(fg('platform-visual-refresh-icons') && {
23
+ width: token('space.250', '20px'),
24
+ }),
20
25
  },
21
26
  // eslint-disable-next-line @atlaskit/ui-styling-standard/no-nested-selectors, @atlaskit/ui-styling-standard/no-unsafe-selectors -- Ignored via go/DSP-18766
22
27
  '&& button': {
@@ -42,10 +42,19 @@ import type { EditorView } from '@atlaskit/editor-prosemirror/view';
42
42
  import { shortcutStyle } from '@atlaskit/editor-shared-styles/shortcut';
43
43
  import type { Rect } from '@atlaskit/editor-tables/table-map';
44
44
  import { splitCell } from '@atlaskit/editor-tables/utils';
45
- import CrossCircleIcon from '@atlaskit/icon/glyph/cross-circle';
46
- import EditorBackgroundColorIcon from '@atlaskit/icon/glyph/editor/background-color';
47
- import RemoveIcon from '@atlaskit/icon/glyph/editor/remove';
45
+ import CrossCircleIcon from '@atlaskit/icon/core/migration/cross-circle';
46
+ import RemoveIcon from '@atlaskit/icon/core/migration/delete--editor-remove';
47
+ import EditorBackgroundColorIcon from '@atlaskit/icon/core/migration/paint-bucket--editor-background-color';
48
+ import PaintBucketIcon from '@atlaskit/icon/core/paint-bucket';
49
+ import TableCellClearIcon from '@atlaskit/icon/core/table-cell-clear';
50
+ import TableCellMergeIcon from '@atlaskit/icon/core/table-cell-merge';
51
+ import TableCellSplitIcon from '@atlaskit/icon/core/table-cell-split';
52
+ import TableColumnAddRightIcon from '@atlaskit/icon/core/table-column-add-right';
53
+ import TableColumnDeleteIcon from '@atlaskit/icon/core/table-column-delete';
54
+ import TableRowAddBelowIcon from '@atlaskit/icon/core/table-row-add-below';
55
+ import TableRowDeleteIcon from '@atlaskit/icon/core/table-row-delete';
48
56
  import { fg } from '@atlaskit/platform-feature-flags';
57
+ import { Box, xcss } from '@atlaskit/primitives';
49
58
 
50
59
  import {
51
60
  clearHoverSelection,
@@ -85,7 +94,7 @@ import {
85
94
  } from '../consts';
86
95
  import { AddColRightIcon, AddRowBelowIcon, MergeCellsIcon, SplitCellIcon } from '../icons';
87
96
 
88
- import { cellColourPreviewStyles, elementBeforeIconStyles } from './styles';
97
+ import { cellColourPreviewStyles } from './styles';
89
98
 
90
99
  interface Props {
91
100
  editorView: EditorView;
@@ -111,6 +120,12 @@ interface State {
111
120
  isOpenAllowed: boolean;
112
121
  }
113
122
  const arrowsList = new Set(['ArrowRight', 'ArrowLeft']);
123
+
124
+ const elementBeforeIconStyles = xcss({
125
+ marginRight: 'space.negative.075',
126
+ display: 'flex',
127
+ });
128
+ // eslint-disable-next-line @repo/internal/react/no-class-components
114
129
  export class ContextualMenu extends Component<Props & WrappedComponentProps, State> {
115
130
  state: State = {
116
131
  isSubmenuOpen: false,
@@ -248,13 +263,14 @@ export class ContextualMenu extends Component<Props & WrappedComponentProps, Sta
248
263
  : formatMessage(messages.cellBackground),
249
264
  value: { name: 'background' },
250
265
  elemBefore: isDragAndDropEnabled ? (
251
- // eslint-disable-next-line @atlaskit/ui-styling-standard/no-imported-style-values, @atlaskit/design-system/consistent-css-prop-usage -- Ignored via go/DSP-18766
252
- <span css={elementBeforeIconStyles}>
253
- <EditorBackgroundColorIcon
266
+ <Box xcss={elementBeforeIconStyles}>
267
+ <PaintBucketIcon
268
+ color="currentColor"
269
+ spacing="spacious"
254
270
  label={formatMessage(messages.backgroundColor)}
255
- size="medium"
271
+ LEGACY_fallbackIcon={EditorBackgroundColorIcon}
256
272
  />
257
- </span>
273
+ </Box>
258
274
  ) : undefined,
259
275
  elemAfter: (
260
276
  // eslint-disable-next-line @atlaskit/ui-styling-standard/no-classname-prop -- Ignored via go/DSP-18766
@@ -345,10 +361,14 @@ export class ContextualMenu extends Component<Props & WrappedComponentProps, Sta
345
361
  value: { name: 'merge' },
346
362
  isDisabled: !canMergeCells(state.tr),
347
363
  elemBefore: isDragAndDropEnabled ? (
348
- // eslint-disable-next-line @atlaskit/ui-styling-standard/no-imported-style-values, @atlaskit/design-system/consistent-css-prop-usage -- Ignored via go/DSP-18766
349
- <span css={elementBeforeIconStyles}>
350
- <MergeCellsIcon />
351
- </span>
364
+ <Box xcss={elementBeforeIconStyles}>
365
+ <TableCellMergeIcon
366
+ color="currentColor"
367
+ spacing="spacious"
368
+ label={formatMessage(messages.mergeCells)}
369
+ LEGACY_fallbackIcon={MergeCellsIcon}
370
+ />
371
+ </Box>
352
372
  ) : undefined,
353
373
  },
354
374
  {
@@ -356,10 +376,14 @@ export class ContextualMenu extends Component<Props & WrappedComponentProps, Sta
356
376
  value: { name: 'split' },
357
377
  isDisabled: !splitCell(state),
358
378
  elemBefore: isDragAndDropEnabled ? (
359
- // eslint-disable-next-line @atlaskit/ui-styling-standard/no-imported-style-values, @atlaskit/design-system/consistent-css-prop-usage -- Ignored via go/DSP-18766
360
- <span css={elementBeforeIconStyles}>
361
- <SplitCellIcon />
362
- </span>
379
+ <Box xcss={elementBeforeIconStyles}>
380
+ <TableCellSplitIcon
381
+ color="currentColor"
382
+ spacing="spacious"
383
+ label={formatMessage(messages.splitCell)}
384
+ LEGACY_fallbackIcon={SplitCellIcon}
385
+ />
386
+ </Box>
363
387
  ) : undefined,
364
388
  },
365
389
  ] as MenuItem[];
@@ -384,9 +408,14 @@ export class ContextualMenu extends Component<Props & WrappedComponentProps, Sta
384
408
  elemAfter: <div css={shortcutStyle}>{tooltip(addColumnAfter)}</div>,
385
409
  elemBefore: isDragAndDropEnabled ? (
386
410
  // eslint-disable-next-line @atlaskit/ui-styling-standard/no-imported-style-values, @atlaskit/design-system/consistent-css-prop-usage -- Ignored via go/DSP-18766
387
- <span css={elementBeforeIconStyles}>
388
- <AddColRightIcon />
389
- </span>
411
+ <Box xcss={elementBeforeIconStyles}>
412
+ <TableColumnAddRightIcon
413
+ color="currentColor"
414
+ spacing="spacious"
415
+ label={formatMessage(messages.addColumnRight)}
416
+ LEGACY_fallbackIcon={AddColRightIcon}
417
+ />
418
+ </Box>
390
419
  ) : undefined,
391
420
  'aria-label': fg('platform_editor_announce_cell_options_hotkeys')
392
421
  ? tooltip(addColumnAfter, String(content))
@@ -408,10 +437,14 @@ export class ContextualMenu extends Component<Props & WrappedComponentProps, Sta
408
437
  // eslint-disable-next-line @atlaskit/ui-styling-standard/no-imported-style-values, @atlaskit/design-system/consistent-css-prop-usage -- Ignored via go/DSP-18766
409
438
  elemAfter: <div css={shortcutStyle}>{tooltip(addRowAfter)}</div>,
410
439
  elemBefore: isDragAndDropEnabled ? (
411
- // eslint-disable-next-line @atlaskit/ui-styling-standard/no-imported-style-values, @atlaskit/design-system/consistent-css-prop-usage -- Ignored via go/DSP-18766
412
- <span css={elementBeforeIconStyles}>
413
- <AddRowBelowIcon />
414
- </span>
440
+ <Box xcss={elementBeforeIconStyles}>
441
+ <TableRowAddBelowIcon
442
+ color="currentColor"
443
+ spacing="spacious"
444
+ label={formatMessage(messages.addRowBelow)}
445
+ LEGACY_fallbackIcon={AddRowBelowIcon}
446
+ />
447
+ </Box>
415
448
  ) : undefined,
416
449
  'aria-label': fg('platform_editor_announce_cell_options_hotkeys')
417
450
  ? tooltip(addRowAfter, String(content))
@@ -440,14 +473,16 @@ export class ContextualMenu extends Component<Props & WrappedComponentProps, Sta
440
473
  // eslint-disable-next-line @atlaskit/ui-styling-standard/no-imported-style-values, @atlaskit/design-system/consistent-css-prop-usage -- Ignored via go/DSP-18766
441
474
  elemAfter: <div css={shortcutStyle}>{tooltip(backspace)}</div>,
442
475
  elemBefore: isDragAndDropEnabled ? (
443
- // eslint-disable-next-line @atlaskit/ui-styling-standard/no-imported-style-values, @atlaskit/design-system/consistent-css-prop-usage -- Ignored via go/DSP-18766
444
- <span css={elementBeforeIconStyles}>
445
- <CrossCircleIcon
476
+ <Box xcss={elementBeforeIconStyles}>
477
+ <TableCellClearIcon
478
+ color="currentColor"
479
+ spacing="spacious"
446
480
  label={formatMessage(messages.clearCells, {
447
481
  0: Math.max(noOfColumns, noOfRows),
448
482
  })}
483
+ LEGACY_fallbackIcon={CrossCircleIcon}
449
484
  />
450
- </span>
485
+ </Box>
451
486
  ) : undefined,
452
487
  'aria-label': fg('platform_editor_announce_cell_options_hotkeys')
453
488
  ? tooltip(backspace, String(content))
@@ -472,14 +507,16 @@ export class ContextualMenu extends Component<Props & WrappedComponentProps, Sta
472
507
  }),
473
508
  value: { name: 'delete_column' },
474
509
  elemBefore: isDragAndDropEnabled ? (
475
- // eslint-disable-next-line @atlaskit/ui-styling-standard/no-imported-style-values, @atlaskit/design-system/consistent-css-prop-usage -- Ignored via go/DSP-18766
476
- <span css={elementBeforeIconStyles}>
477
- <RemoveIcon
510
+ <Box xcss={elementBeforeIconStyles}>
511
+ <TableColumnDeleteIcon
512
+ color="currentColor"
513
+ spacing="spacious"
478
514
  label={formatMessage(messages.removeColumns, {
479
515
  0: noOfColumns,
480
516
  })}
517
+ LEGACY_fallbackIcon={RemoveIcon}
481
518
  />
482
- </span>
519
+ </Box>
483
520
  ) : undefined,
484
521
  } as MenuItem;
485
522
  };
@@ -501,14 +538,16 @@ export class ContextualMenu extends Component<Props & WrappedComponentProps, Sta
501
538
  }),
502
539
  value: { name: 'delete_row' },
503
540
  elemBefore: isDragAndDropEnabled ? (
504
- // eslint-disable-next-line @atlaskit/ui-styling-standard/no-imported-style-values, @atlaskit/design-system/consistent-css-prop-usage -- Ignored via go/DSP-18766
505
- <span css={elementBeforeIconStyles}>
506
- <RemoveIcon
541
+ <Box xcss={elementBeforeIconStyles}>
542
+ <TableRowDeleteIcon
543
+ color="currentColor"
544
+ spacing="spacious"
507
545
  label={formatMessage(messages.removeRows, {
508
546
  0: noOfRows,
509
547
  })}
548
+ LEGACY_fallbackIcon={RemoveIcon}
510
549
  />
511
- </span>
550
+ </Box>
512
551
  ) : undefined,
513
552
  } as MenuItem;
514
553
  };