@atlaskit/editor-plugin-table 7.6.4 → 7.6.6

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 (109) hide show
  1. package/CHANGELOG.md +14 -0
  2. package/dist/cjs/commands/column-resize.js +62 -16
  3. package/dist/cjs/commands/go-to-next-cell.js +5 -2
  4. package/dist/cjs/commands-with-analytics.js +8 -2
  5. package/dist/cjs/nodeviews/ExternalDropTargets.js +2 -0
  6. package/dist/cjs/nodeviews/TableComponent.js +8 -6
  7. package/dist/cjs/nodeviews/TableResizer.js +2 -1
  8. package/dist/cjs/plugin.js +58 -57
  9. package/dist/cjs/pm-plugins/keymap.js +26 -8
  10. package/dist/cjs/pm-plugins/main.js +15 -4
  11. package/dist/cjs/pm-plugins/table-resizing/event-handlers.js +4 -2
  12. package/dist/cjs/ui/DragHandle/index.js +2 -2
  13. package/dist/cjs/ui/DragPreview/index.js +2 -0
  14. package/dist/cjs/ui/FloatingContextualButton/FixedButton.js +10 -6
  15. package/dist/cjs/ui/FloatingDeleteButton/index.js +2 -0
  16. package/dist/cjs/ui/FloatingInsertButton/InsertButton.js +1 -0
  17. package/dist/cjs/ui/LayoutButton/index.js +2 -0
  18. package/dist/cjs/ui/TableFloatingColumnControls/ColumnControls/index.js +2 -0
  19. package/dist/cjs/ui/TableFloatingColumnControls/ColumnDropTargets/ColumnDropTarget.js +3 -0
  20. package/dist/cjs/ui/TableFloatingControls/CornerControls/ClassicCornerControls.js +1 -0
  21. package/dist/cjs/ui/TableFloatingControls/NumberColumn/index.js +1 -0
  22. package/dist/cjs/ui/TableFloatingControls/RowControls/ClassicControls.js +4 -0
  23. package/dist/cjs/ui/TableFloatingControls/RowControls/DragControls.js +3 -1
  24. package/dist/cjs/ui/common-styles.js +4 -0
  25. package/dist/cjs/ui/ui-styles.js +93 -37
  26. package/dist/es2019/commands/column-resize.js +53 -4
  27. package/dist/es2019/commands/go-to-next-cell.js +5 -2
  28. package/dist/es2019/commands-with-analytics.js +8 -2
  29. package/dist/es2019/nodeviews/ExternalDropTargets.js +2 -0
  30. package/dist/es2019/nodeviews/TableComponent.js +9 -7
  31. package/dist/es2019/nodeviews/TableResizer.js +2 -1
  32. package/dist/es2019/plugin.js +4 -2
  33. package/dist/es2019/pm-plugins/keymap.js +25 -9
  34. package/dist/es2019/pm-plugins/main.js +15 -4
  35. package/dist/es2019/pm-plugins/table-resizing/event-handlers.js +4 -2
  36. package/dist/es2019/ui/DragHandle/index.js +2 -2
  37. package/dist/es2019/ui/DragPreview/index.js +2 -0
  38. package/dist/es2019/ui/FloatingContextualButton/FixedButton.js +10 -6
  39. package/dist/es2019/ui/FloatingDeleteButton/index.js +2 -0
  40. package/dist/es2019/ui/FloatingInsertButton/InsertButton.js +1 -0
  41. package/dist/es2019/ui/LayoutButton/index.js +2 -0
  42. package/dist/es2019/ui/TableFloatingColumnControls/ColumnControls/index.js +2 -0
  43. package/dist/es2019/ui/TableFloatingColumnControls/ColumnDropTargets/ColumnDropTarget.js +3 -0
  44. package/dist/es2019/ui/TableFloatingControls/CornerControls/ClassicCornerControls.js +1 -0
  45. package/dist/es2019/ui/TableFloatingControls/NumberColumn/index.js +1 -0
  46. package/dist/es2019/ui/TableFloatingControls/RowControls/ClassicControls.js +4 -0
  47. package/dist/es2019/ui/TableFloatingControls/RowControls/DragControls.js +3 -1
  48. package/dist/es2019/ui/common-styles.js +4 -0
  49. package/dist/es2019/ui/ui-styles.js +66 -70
  50. package/dist/esm/commands/column-resize.js +62 -16
  51. package/dist/esm/commands/go-to-next-cell.js +5 -2
  52. package/dist/esm/commands-with-analytics.js +8 -2
  53. package/dist/esm/nodeviews/ExternalDropTargets.js +2 -0
  54. package/dist/esm/nodeviews/TableComponent.js +9 -7
  55. package/dist/esm/nodeviews/TableResizer.js +2 -1
  56. package/dist/esm/plugin.js +58 -57
  57. package/dist/esm/pm-plugins/keymap.js +26 -8
  58. package/dist/esm/pm-plugins/main.js +15 -4
  59. package/dist/esm/pm-plugins/table-resizing/event-handlers.js +4 -2
  60. package/dist/esm/ui/DragHandle/index.js +2 -2
  61. package/dist/esm/ui/DragPreview/index.js +2 -0
  62. package/dist/esm/ui/FloatingContextualButton/FixedButton.js +10 -6
  63. package/dist/esm/ui/FloatingDeleteButton/index.js +2 -0
  64. package/dist/esm/ui/FloatingInsertButton/InsertButton.js +1 -0
  65. package/dist/esm/ui/LayoutButton/index.js +2 -0
  66. package/dist/esm/ui/TableFloatingColumnControls/ColumnControls/index.js +2 -0
  67. package/dist/esm/ui/TableFloatingColumnControls/ColumnDropTargets/ColumnDropTarget.js +3 -0
  68. package/dist/esm/ui/TableFloatingControls/CornerControls/ClassicCornerControls.js +1 -0
  69. package/dist/esm/ui/TableFloatingControls/NumberColumn/index.js +1 -0
  70. package/dist/esm/ui/TableFloatingControls/RowControls/ClassicControls.js +4 -0
  71. package/dist/esm/ui/TableFloatingControls/RowControls/DragControls.js +3 -1
  72. package/dist/esm/ui/common-styles.js +4 -0
  73. package/dist/esm/ui/ui-styles.js +93 -37
  74. package/dist/types/commands/column-resize.d.ts +23 -4
  75. package/dist/types/commands/go-to-next-cell.d.ts +2 -1
  76. package/dist/types/commands-with-analytics.d.ts +2 -1
  77. package/dist/types/pm-plugins/keymap.d.ts +3 -1
  78. package/dist/types/types.d.ts +7 -0
  79. package/dist/types-ts4.5/commands/column-resize.d.ts +23 -4
  80. package/dist/types-ts4.5/commands/go-to-next-cell.d.ts +2 -1
  81. package/dist/types-ts4.5/commands-with-analytics.d.ts +2 -1
  82. package/dist/types-ts4.5/pm-plugins/keymap.d.ts +3 -1
  83. package/dist/types-ts4.5/types.d.ts +7 -0
  84. package/package.json +4 -4
  85. package/src/commands/column-resize.ts +105 -29
  86. package/src/commands/go-to-next-cell.ts +10 -2
  87. package/src/commands-with-analytics.ts +11 -5
  88. package/src/nodeviews/ExternalDropTargets.tsx +2 -0
  89. package/src/nodeviews/TableComponent.tsx +14 -16
  90. package/src/nodeviews/TableResizer.tsx +2 -1
  91. package/src/plugin.tsx +3 -1
  92. package/src/pm-plugins/keymap.ts +44 -6
  93. package/src/pm-plugins/main.ts +18 -4
  94. package/src/pm-plugins/table-resizing/event-handlers.ts +6 -2
  95. package/src/types.ts +8 -0
  96. package/src/ui/DragHandle/index.tsx +2 -2
  97. package/src/ui/DragPreview/index.tsx +2 -0
  98. package/src/ui/FloatingContextualButton/FixedButton.tsx +9 -6
  99. package/src/ui/FloatingDeleteButton/index.tsx +2 -0
  100. package/src/ui/FloatingInsertButton/InsertButton.tsx +1 -0
  101. package/src/ui/LayoutButton/index.tsx +2 -0
  102. package/src/ui/TableFloatingColumnControls/ColumnControls/index.tsx +2 -0
  103. package/src/ui/TableFloatingColumnControls/ColumnDropTargets/ColumnDropTarget.tsx +3 -0
  104. package/src/ui/TableFloatingControls/CornerControls/ClassicCornerControls.tsx +1 -0
  105. package/src/ui/TableFloatingControls/NumberColumn/index.tsx +1 -0
  106. package/src/ui/TableFloatingControls/RowControls/ClassicControls.tsx +4 -0
  107. package/src/ui/TableFloatingControls/RowControls/DragControls.tsx +5 -1
  108. package/src/ui/common-styles.ts +2 -0
  109. package/src/ui/ui-styles.ts +90 -79
@@ -14,14 +14,14 @@ const InsertLine = cssString => css`
14
14
  ${cssString}
15
15
  }
16
16
  `;
17
- const Marker = () => css`
18
- background-color: ${tableBorderColor};
19
- position: absolute;
20
- height: ${lineMarkerSize}px;
21
- width: ${lineMarkerSize}px;
22
- border-radius: 50%;
23
- pointer-events: none;
24
- `;
17
+ const Marker = () => css({
18
+ backgroundColor: tableBorderColor,
19
+ position: 'absolute',
20
+ height: `${lineMarkerSize}px`,
21
+ width: `${lineMarkerSize}px`,
22
+ borderRadius: '50%',
23
+ pointerEvents: 'none'
24
+ });
25
25
  export const InsertMarker = cssString => css`
26
26
  .${ClassName.CONTROLS_INSERT_MARKER} {
27
27
  ${Marker()};
@@ -49,6 +49,9 @@ const Button = cssString => css`
49
49
  }
50
50
  ${cssString}
51
51
  `;
52
+
53
+ // Explicit pixel values required here to ensure classic row controls align correctly
54
+ // eslint-disable-next-line @atlaskit/design-system/ensure-design-token-usage/preview
52
55
  export const HeaderButton = cssString => css`
53
56
  .${ClassName.CONTROLS_BUTTON} {
54
57
  background: ${tableHeaderCellBackgroundColor};
@@ -214,23 +217,15 @@ export const dragCornerControlButton = () => css`
214
217
  position: relative;
215
218
  }
216
219
  `;
217
- export const insertColumnButtonWrapper = () => css`
218
- ${InsertButton()}
219
- ${InsertButtonHover()}
220
- ${InsertLine(`
220
+ export const insertColumnButtonWrapper = () => css(InsertButton(), InsertButtonHover(), InsertLine(`
221
221
  width: 2px;
222
222
  left: 9px;
223
- `)}
224
- `;
225
- export const insertRowButtonWrapper = () => css`
226
- ${InsertButton()}
227
- ${InsertButtonHover()}
228
- ${InsertLine(`
223
+ `));
224
+ export const insertRowButtonWrapper = () => css(InsertButton(), InsertButtonHover(), InsertLine(`
229
225
  height: 2px;
230
226
  top: -11px;
231
227
  left: ${tableInsertColumnButtonSize - 1}px;
232
- `)}
233
- `;
228
+ `));
234
229
  export const columnControlsLineMarker = () => css`
235
230
  .${ClassName.TABLE_CONTAINER}.${ClassName.WITH_CONTROLS}
236
231
  table
@@ -324,40 +319,34 @@ const overflowShadowWidhoutDnD = isDragAndDropEnabled => {
324
319
  };
325
320
  const columnHeaderButton = cssString => {
326
321
  if (getBooleanFF('platform.editor.table.column-controls-styles-updated')) {
327
- return css`
328
- background: ${tableHeaderCellBackgroundColor};
329
- display: block;
330
- box-sizing: border-box;
331
- padding: 0;
332
-
333
- :focus {
334
- outline: none;
322
+ return css({
323
+ background: tableHeaderCellBackgroundColor,
324
+ display: 'block',
325
+ boxSizing: 'border-box',
326
+ padding: 0,
327
+ ':focus': {
328
+ outline: 'none'
335
329
  }
336
-
337
- ${cssString}
338
- `;
330
+ }, cssString);
339
331
  } else {
340
- return css`
341
- background: ${tableHeaderCellBackgroundColor};
342
- border: 1px solid ${tableBorderColor};
343
- display: block;
344
- box-sizing: border-box;
345
- padding: 0;
346
-
347
- :focus {
348
- outline: none;
332
+ return css({
333
+ background: tableHeaderCellBackgroundColor,
334
+ border: `1px solid ${tableBorderColor}`,
335
+ display: 'block',
336
+ boxSizing: 'border-box',
337
+ padding: 0,
338
+ ':focus': {
339
+ outline: 'none'
349
340
  }
350
-
351
- ${cssString}
352
- `;
341
+ }, cssString);
353
342
  }
354
343
  };
355
- const columnHeaderButtonSelected = () => css`
356
- color: ${`var(--ds-text-inverse, ${N0})`};
357
- background-color: ${tableToolbarSelectedColor};
358
- border-color: ${tableBorderSelectedColor};
359
- z-index: ${columnControlsSelectedZIndex};
360
- `;
344
+ const columnHeaderButtonSelected = () => css({
345
+ color: `var(--ds-text-inverse, ${N0})`,
346
+ backgroundColor: tableToolbarSelectedColor,
347
+ borderColor: tableBorderSelectedColor,
348
+ zIndex: columnControlsSelectedZIndex
349
+ });
361
350
  const getFloatingDotOverrides = () => {
362
351
  return getBooleanFF('platform.editor.custom-table-width') ? css`
363
352
  tr
@@ -680,6 +669,9 @@ const getLastColumnResizerOverrides = () => {
680
669
  }
681
670
  ` : '';
682
671
  };
672
+
673
+ // Explicit pixel values required here to ensure correct positioning and sizes of column resize handle
674
+ // eslint-disable-next-line @atlaskit/design-system/ensure-design-token-usage/preview
683
675
  const resizeHandleOverrides = isDragAndDropEnabled => {
684
676
  if (isDragAndDropEnabled) {
685
677
  return css`
@@ -786,27 +778,31 @@ export const resizeHandle = isDragAndDropEnabled => css`
786
778
  `;
787
779
 
788
780
  // Drag and Drop: drop target insert line
789
- const tableCellColumnInsertLineStyles = css`
790
- content: ' ';
791
- position: absolute;
792
- height: calc(100% + ${tableCellBorderWidth * 2}px);
793
- width: ${insertLineWidth}px;
794
- z-index: ${columnControlsZIndex * 2};
795
- `;
796
- const tableCellRowInsertLineStyles = css`
797
- content: ' ';
798
- position: absolute;
799
- left: ${"var(--ds-space-negative-025, -2px)"};
800
- height: ${insertLineWidth}px;
801
- width: calc(100% + ${tableCellBorderWidth * 2}px);
802
- z-index: ${columnControlsZIndex * 2};
803
- `;
804
- const insertLineActiveColor = css`
805
- background-color: ${tableBorderSelectedColor};
806
- `;
807
- const insertLineInactiveColor = css`
808
- background-color: ${`var(--ds-background-accent-gray-subtler, ${akEditorTableBorder})`};
809
- `;
781
+ const tableCellColumnInsertLineStyles = css({
782
+ content: "' '",
783
+ position: 'absolute',
784
+ height: `calc(100% + ${tableCellBorderWidth * 2}px)`,
785
+ width: `${insertLineWidth}px`,
786
+ zIndex: columnControlsZIndex * 2
787
+ });
788
+ const tableCellRowInsertLineStyles = css({
789
+ content: "' '",
790
+ position: 'absolute',
791
+ left: "var(--ds-space-negative-025, -2px)",
792
+ height: `${insertLineWidth}px`,
793
+ width: `calc(100% + ${tableCellBorderWidth * 2}px)`,
794
+ zIndex: columnControlsZIndex * 2
795
+ });
796
+ const insertLineActiveColor = css({
797
+ backgroundColor: tableBorderSelectedColor
798
+ });
799
+ const insertLineInactiveColor = css({
800
+ backgroundColor: `var(--ds-background-accent-gray-subtler, ${akEditorTableBorder})`
801
+ });
802
+
803
+ // Explicit pixel values required here to ensure correct positioning of line that is show on row
804
+ // or column drag
805
+ // eslint-disable-next-line @atlaskit/design-system/ensure-design-token-usage/preview
810
806
  export const insertLine = () => css`
811
807
  .${ClassName.TABLE_CONTAINER} {
812
808
  td.${ClassName.WITH_FIRST_COLUMN_INSERT_LINE}::before {
@@ -1,3 +1,4 @@
1
+ import { tableMessages as messages } from '@atlaskit/editor-common/messages';
1
2
  import { tableCellMinWidth } from '@atlaskit/editor-common/styles';
2
3
  import { TableMap } from '@atlaskit/editor-tables';
3
4
  import { findCellClosestToPos, findCellRectClosestToPos, findTableClosestToPos, getSelectionRect, isSelectionType, nextCell } from '@atlaskit/editor-tables/utils';
@@ -60,25 +61,35 @@ var updateResizeHandleAndStatePosition = function updateResizeHandleAndStatePosi
60
61
  return false;
61
62
  };
62
63
  };
63
- export var initiateKeyboardColumnResizing = function initiateKeyboardColumnResizing(state, dispatch, view) {
64
- if (!getBooleanFF('platform.editor.a11y-column-resizing_emcvz')) {
64
+ export var initiateKeyboardColumnResizing = function initiateKeyboardColumnResizing(_ref) {
65
+ var ariaNotify = _ref.ariaNotify,
66
+ getIntl = _ref.getIntl;
67
+ return function (state, dispatch, view) {
68
+ if (!getBooleanFF('platform.editor.a11y-column-resizing_emcvz')) {
69
+ return false;
70
+ }
71
+ var selection = state.selection;
72
+ var selectionRect = isSelectionType(selection, 'cell') ? getSelectionRect(selection) : findCellRectClosestToPos(selection.$from);
73
+ var cell = findCellClosestToPos(selection.$from);
74
+ if (ariaNotify && getIntl) {
75
+ ariaNotify(getIntl().formatMessage(messages.startedColumnResize));
76
+ }
77
+ if (selectionRect && cell && view) {
78
+ return updateResizeHandleAndStatePosition(selectionRect.top, selectionRect.right, cell.pos)(state, dispatch);
79
+ }
65
80
  return false;
66
- }
67
- var selection = state.selection;
68
- var selectionRect = isSelectionType(selection, 'cell') ? getSelectionRect(selection) : findCellRectClosestToPos(selection.$from);
69
- var cell = findCellClosestToPos(selection.$from);
70
- if (selectionRect && cell && view) {
71
- return updateResizeHandleAndStatePosition(selectionRect.top, selectionRect.right, cell.pos)(state, dispatch);
72
- }
73
- return false;
81
+ };
74
82
  };
75
- export var activateNextResizeArea = function activateNextResizeArea(direction) {
83
+ export var activateNextResizeArea = function activateNextResizeArea(_ref2) {
84
+ var direction = _ref2.direction,
85
+ ariaNotify = _ref2.ariaNotify,
86
+ getIntl = _ref2.getIntl;
76
87
  return function (state, dispatch, view) {
77
88
  if (!getBooleanFF('platform.editor.a11y-column-resizing_emcvz')) {
78
89
  return false;
79
90
  }
80
- var _ref = getTableResizingPluginState(state) || {},
81
- resizeHandlePos = _ref.resizeHandlePos;
91
+ var _ref3 = getTableResizingPluginState(state) || {},
92
+ resizeHandlePos = _ref3.resizeHandlePos;
82
93
  // If No resizing has initiated, skip to regular handler
83
94
  if (!resizeHandlePos) {
84
95
  return false;
@@ -101,6 +112,18 @@ export var activateNextResizeArea = function activateNextResizeArea(direction) {
101
112
  }
102
113
  var currentCellRect = tableMap.findCell($currentCell.pos - $currentCell.start(-1));
103
114
  var $nextCell = nextCell($currentCell, 'horiz', direction);
115
+ if (ariaNotify && getIntl) {
116
+ var columnDirection = '';
117
+ if (direction === 1) {
118
+ columnDirection = getIntl().formatMessage(messages.columnRightResize);
119
+ }
120
+ if (direction === -1) {
121
+ columnDirection = getIntl().formatMessage(messages.columnLeftResize);
122
+ }
123
+ ariaNotify(getIntl().formatMessage(messages.focusedOtherResize, {
124
+ direction: columnDirection
125
+ }));
126
+ }
104
127
  if ($nextCell) {
105
128
  // we are somewhere in between the side columns of the table
106
129
  var offset = $nextCell.pos - $nextCell.start(-1);
@@ -121,8 +144,12 @@ export var activateNextResizeArea = function activateNextResizeArea(direction) {
121
144
  return false;
122
145
  };
123
146
  };
124
- export var changeColumnWidthByStep = function changeColumnWidthByStep(stepSize, getEditorContainerWidth) {
125
- var isTableScalingEnabled = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;
147
+ export var changeColumnWidthByStep = function changeColumnWidthByStep(_ref4) {
148
+ var stepSize = _ref4.stepSize,
149
+ getEditorContainerWidth = _ref4.getEditorContainerWidth,
150
+ isTableScalingEnabled = _ref4.isTableScalingEnabled,
151
+ ariaNotify = _ref4.ariaNotify,
152
+ getIntl = _ref4.getIntl;
126
153
  return function (state, dispatch, view) {
127
154
  var customTr = state.tr;
128
155
  var fakeDispatch = function fakeDispatch(tr) {
@@ -184,10 +211,26 @@ export var changeColumnWidthByStep = function changeColumnWidthByStep(stepSize,
184
211
  if (dispatch) {
185
212
  dispatch(customTr);
186
213
  }
214
+ if (ariaNotify && getIntl) {
215
+ ariaNotify(getIntl().formatMessage(messages.changedColumnWidth, {
216
+ width: Math.floor(newResizeState.cols[colIndex].width)
217
+ }));
218
+ if (newResizeState.cols.length === colIndex + 1) {
219
+ if (newResizeState.overflow === true) {
220
+ ariaNotify(getIntl().formatMessage(messages.columnResizeLast));
221
+ }
222
+ if (newResizeState.overflow === false) {
223
+ ariaNotify(getIntl().formatMessage(messages.columnResizeOverflow));
224
+ }
225
+ }
226
+ }
187
227
  return true;
188
228
  };
189
229
  };
190
- export var stopKeyboardColumnResizing = function stopKeyboardColumnResizing(originalTr) {
230
+ export var stopKeyboardColumnResizing = function stopKeyboardColumnResizing(_ref5) {
231
+ var ariaNotify = _ref5.ariaNotify,
232
+ getIntl = _ref5.getIntl,
233
+ originalTr = _ref5.originalTr;
191
234
  return function (state, dispatch) {
192
235
  if (!getBooleanFF('platform.editor.a11y-column-resizing_emcvz')) {
193
236
  return false;
@@ -212,6 +255,9 @@ export var stopKeyboardColumnResizing = function stopKeyboardColumnResizing(orig
212
255
  }, function () {
213
256
  return customTr.setMeta('scrollIntoView', false);
214
257
  })(state, fakeDispatch);
258
+ if (ariaNotify && getIntl) {
259
+ ariaNotify(getIntl().formatMessage(messages.columnResizeStop));
260
+ }
215
261
  if (dispatch) {
216
262
  dispatch(customTr);
217
263
  return true;
@@ -10,7 +10,7 @@ import { getPluginState } from '../pm-plugins/plugin-factory';
10
10
  import { stopKeyboardColumnResizing } from './column-resize';
11
11
  var TAB_FORWARD_DIRECTION = 1;
12
12
  var TAB_BACKWARD_DIRECTION = -1;
13
- export var goToNextCell = function goToNextCell(editorAnalyticsAPI) {
13
+ export var goToNextCell = function goToNextCell(editorAnalyticsAPI, ariaNotify, getIntl) {
14
14
  return function (direction) {
15
15
  return function (state, dispatch, view) {
16
16
  var table = findTable(state.selection);
@@ -21,7 +21,10 @@ export var goToNextCell = function goToNextCell(editorAnalyticsAPI) {
21
21
  var _getPluginState;
22
22
  var isColumnResizing = (_getPluginState = getPluginState(state)) === null || _getPluginState === void 0 ? void 0 : _getPluginState.isKeyboardResize;
23
23
  if (isColumnResizing) {
24
- stopKeyboardColumnResizing()(state, dispatch, view);
24
+ stopKeyboardColumnResizing({
25
+ ariaNotify: ariaNotify,
26
+ getIntl: getIntl
27
+ })(state, dispatch, view);
25
28
  return true;
26
29
  }
27
30
  }
@@ -184,7 +184,7 @@ export var insertRowWithAnalytics = function insertRowWithAnalytics(editorAnalyt
184
184
  };
185
185
  };
186
186
  export var changeColumnWidthByStepWithAnalytics = function changeColumnWidthByStepWithAnalytics(editorAnalyticsAPI) {
187
- return function (stepSize, getEditorContainerWidth, isTableScalingEnabled, inputMethod) {
187
+ return function (stepSize, getEditorContainerWidth, isTableScalingEnabled, inputMethod, ariaNotify, getIntl) {
188
188
  return withEditorAnalyticsAPI(function (state) {
189
189
  var _getSelectedTableInfo2 = getSelectedTableInfo(state.selection),
190
190
  table = _getSelectedTableInfo2.table,
@@ -206,7 +206,13 @@ export var changeColumnWidthByStepWithAnalytics = function changeColumnWidthBySt
206
206
  totalColumnCount: totalColumnCount
207
207
  }
208
208
  };
209
- })(editorAnalyticsAPI)(changeColumnWidthByStep(stepSize, getEditorContainerWidth, isTableScalingEnabled));
209
+ })(editorAnalyticsAPI)(changeColumnWidthByStep({
210
+ stepSize: stepSize,
211
+ getEditorContainerWidth: getEditorContainerWidth,
212
+ isTableScalingEnabled: isTableScalingEnabled,
213
+ ariaNotify: ariaNotify,
214
+ getIntl: getIntl
215
+ }));
210
216
  };
211
217
  };
212
218
  export var insertColumnWithAnalytics = function insertColumnWithAnalytics(editorAnalyticsAPI) {
@@ -42,6 +42,7 @@ export var ExternalDropTargets = function ExternalDropTargets(_ref) {
42
42
  width: getTableWrapperWidth(),
43
43
  overflow: 'hidden',
44
44
  position: 'absolute',
45
+ // eslint-disable-next-line @atlaskit/design-system/ensure-design-token-usage/preview
45
46
  top: "-".concat(dropTargetExtendedWidth - tableMarginTop, "px"),
46
47
  pointerEvents: 'auto',
47
48
  zIndex: "".concat(dropTargetsZIndex)
@@ -51,6 +52,7 @@ export var ExternalDropTargets = function ExternalDropTargets(_ref) {
51
52
  style: {
52
53
  display: 'flex',
53
54
  // move drop targets based on table wrapper scroll
55
+ // eslint-disable-next-line @atlaskit/design-system/ensure-design-token-usage/preview
54
56
  marginLeft: "-".concat(getScrollOffset(), "px")
55
57
  }
56
58
  }, colWidths === null || colWidths === void 0 ? void 0 : colWidths.map(function (width, index) {
@@ -21,7 +21,7 @@ import { ACTION_SUBJECT, EVENT_TYPE, TABLE_ACTION } from '@atlaskit/editor-commo
21
21
  import { getParentNodeWidth, getTableContainerWidth } from '@atlaskit/editor-common/node-width';
22
22
  import { tableMarginSides } from '@atlaskit/editor-common/styles';
23
23
  import { browser, isValidPosition } from '@atlaskit/editor-common/utils';
24
- import { MAX_BROWSER_SCROLLBAR_HEIGHT, akEditorTableToolbarSize as tableToolbarSize } from '@atlaskit/editor-shared-styles';
24
+ import { akEditorTableToolbarSize as tableToolbarSize } from '@atlaskit/editor-shared-styles';
25
25
  import { findTable, isTableSelected } from '@atlaskit/editor-tables/utils';
26
26
  import { getBooleanFF } from '@atlaskit/platform-feature-flags';
27
27
  import { combine } from '@atlaskit/pragmatic-drag-and-drop/combine';
@@ -35,7 +35,6 @@ import { hasTableBeenResized } from '../pm-plugins/table-resizing/utils/colgroup
35
35
  import { TABLE_EDITOR_MARGIN } from '../pm-plugins/table-resizing/utils/consts';
36
36
  import { updateControls } from '../pm-plugins/table-resizing/utils/dom';
37
37
  import { TableCssClassName as ClassName, ShadowEvent } from '../types';
38
- import { tableOverflowShadowWidth, tableOverflowShadowWidthWide } from '../ui/consts';
39
38
  import TableFloatingColumnControls from '../ui/TableFloatingColumnControls';
40
39
  import TableFloatingControls from '../ui/TableFloatingControls';
41
40
  import { containsHeaderRow, isTableNested, tablesHaveDifferentColumnWidths, tablesHaveDifferentNoOfColumns } from '../utils';
@@ -741,7 +740,7 @@ var TableComponent = /*#__PURE__*/function (_React$Component) {
741
740
  style: {
742
741
  visibility: showBeforeShadow && hasHeaderRow ? 'visible' : 'hidden',
743
742
  top: "".concat(topStickyShadowPosition, "px"),
744
- paddingBottom: "".concat(isDragAndDropEnabled ? '1px' : '')
743
+ paddingBottom: "".concat(isDragAndDropEnabled && "var(--ds-space-025, 2px)")
745
744
  }
746
745
  }), /*#__PURE__*/React.createElement("div", {
747
746
  className: classnames(ClassName.TABLE_NODE_WRAPPER),
@@ -760,10 +759,11 @@ var TableComponent = /*#__PURE__*/function (_React$Component) {
760
759
  }, allowControls && colControls), stickyScrollbar && /*#__PURE__*/React.createElement("div", {
761
760
  className: ClassName.TABLE_STICKY_SCROLLBAR_CONTAINER,
762
761
  style: {
763
- height: MAX_BROWSER_SCROLLBAR_HEIGHT,
762
+ height: "var(--ds-space-250, 20px)",
763
+ // MAX_BROWSER_SCROLLBAR_HEIGHT
764
764
  display: 'none',
765
765
  // prevent unwanted scroll during table resize without removing scrollbar container from the dom
766
- width: isResizing ? '0px' : '100%'
766
+ width: isResizing ? "var(--ds-space-0, 0px)" : '100%'
767
767
  }
768
768
  }, /*#__PURE__*/React.createElement("div", {
769
769
  style: {
@@ -777,14 +777,16 @@ var TableComponent = /*#__PURE__*/function (_React$Component) {
777
777
  }), this.state.stickyHeader && /*#__PURE__*/React.createElement("div", {
778
778
  style: {
779
779
  position: 'absolute',
780
- right: getBooleanFF('platform.editor.custom-table-width') ? "".concat(getBooleanFF('platform.editor.table.increase-shadow-visibility_lh89r') ? tableOverflowShadowWidthWide : tableOverflowShadowWidth, "px") : '-2px'
780
+ right: getBooleanFF('platform.editor.custom-table-width') ? "".concat(getBooleanFF('platform.editor.table.increase-shadow-visibility_lh89r') ? "var(--ds-space-400, 32px)" // tableOverflowShadowWidthWide
781
+ : "var(--ds-space-100, 8px)" // tableOverflowShadowWidth
782
+ ) : "var(--ds-space-negative-025, -2px)"
781
783
  }
782
784
  }, /*#__PURE__*/React.createElement("div", {
783
785
  className: "".concat(ClassName.TABLE_RIGHT_SHADOW, " ").concat(ClassName.TABLE_STICKY_SHADOW),
784
786
  style: {
785
787
  visibility: showAfterShadow && hasHeaderRow ? 'visible' : 'hidden',
786
788
  top: "".concat(topStickyShadowPosition, "px"),
787
- paddingBottom: "".concat(isDragAndDropEnabled ? '1px' : '')
789
+ paddingBottom: "".concat(isDragAndDropEnabled && "var(--ds-space-025, 2px)")
788
790
  }
789
791
  })), /*#__PURE__*/React.createElement("div", {
790
792
  className: ClassName.TABLE_STICKY_SENTINEL_BOTTOM,
@@ -30,7 +30,7 @@ var handles = {
30
30
  };
31
31
  var handleStyles = {
32
32
  right: {
33
- // eslint-disable-next-line
33
+ // eslint-disable-next-line @atlaskit/design-system/ensure-design-token-usage/preview
34
34
  right: '-14px',
35
35
  marginTop: "var(--ds-space-150, 12px)"
36
36
  }
@@ -287,6 +287,7 @@ export var TableResizer = function TableResizer(_ref) {
287
287
  if (newWidth > maxWidth || newWidth < resizerMinWidth) {
288
288
  return;
289
289
  }
290
+ setLocalTableWidth(newWidth);
290
291
  handleResizeStop({
291
292
  width: width,
292
293
  x: 0,
@@ -169,14 +169,15 @@ var tablesPlugin = function tablesPlugin(_ref) {
169
169
  // plugin as it is currently swallowing backspace events inside tables
170
170
  {
171
171
  name: 'tableKeymap',
172
- plugin: function plugin() {
173
- var _ref6 = options || {},
174
- dragAndDropEnabled = _ref6.dragAndDropEnabled,
175
- _ref6$isTableScalingE = _ref6.isTableScalingEnabled,
176
- isTableScalingEnabled = _ref6$isTableScalingE === void 0 ? false : _ref6$isTableScalingE,
177
- _ref6$fullWidthEnable = _ref6.fullWidthEnabled,
178
- fullWidthEnabled = _ref6$fullWidthEnable === void 0 ? false : _ref6$fullWidthEnable;
179
- return keymapPlugin(defaultGetEditorContainerWidth, editorAnalyticsAPI, dragAndDropEnabled, isTableScalingEnabled, fullWidthEnabled);
172
+ plugin: function plugin(_ref6) {
173
+ var getIntl = _ref6.getIntl;
174
+ var _ref7 = options || {},
175
+ dragAndDropEnabled = _ref7.dragAndDropEnabled,
176
+ _ref7$isTableScalingE = _ref7.isTableScalingEnabled,
177
+ isTableScalingEnabled = _ref7$isTableScalingE === void 0 ? false : _ref7$isTableScalingE,
178
+ _ref7$fullWidthEnable = _ref7.fullWidthEnabled,
179
+ fullWidthEnabled = _ref7$fullWidthEnable === void 0 ? false : _ref7$fullWidthEnable;
180
+ return keymapPlugin(defaultGetEditorContainerWidth, editorAnalyticsAPI, dragAndDropEnabled, isTableScalingEnabled, fullWidthEnabled, api, getIntl);
180
181
  }
181
182
  }, {
182
183
  name: 'tableSelectionKeymap',
@@ -186,12 +187,12 @@ var tablesPlugin = function tablesPlugin(_ref) {
186
187
  }, {
187
188
  name: 'tableEditing',
188
189
  plugin: function plugin() {
189
- var _ref7 = options || {},
190
- dragAndDropEnabled = _ref7.dragAndDropEnabled;
190
+ var _ref8 = options || {},
191
+ dragAndDropEnabled = _ref8.dragAndDropEnabled;
191
192
  return tableEditing({
192
- reportFixedTable: function reportFixedTable(_ref8) {
193
- var tr = _ref8.tr,
194
- reason = _ref8.reason;
193
+ reportFixedTable: function reportFixedTable(_ref9) {
194
+ var tr = _ref9.tr,
195
+ reason = _ref9.reason;
195
196
  editorAnalyticsAPI === null || editorAnalyticsAPI === void 0 || editorAnalyticsAPI.attachAnalyticsEvent({
196
197
  action: TABLE_ACTION.FIXED,
197
198
  actionSubject: ACTION_SUBJECT.TABLE,
@@ -207,48 +208,48 @@ var tablesPlugin = function tablesPlugin(_ref) {
207
208
  }
208
209
  }, {
209
210
  name: 'tableStickyHeaders',
210
- plugin: function plugin(_ref9) {
211
- var dispatch = _ref9.dispatch,
212
- eventDispatcher = _ref9.eventDispatcher;
211
+ plugin: function plugin(_ref10) {
212
+ var dispatch = _ref10.dispatch,
213
+ eventDispatcher = _ref10.eventDispatcher;
213
214
  return options && options.tableOptions.stickyHeaders ? createStickyHeadersPlugin(dispatch, function () {
214
215
  return [];
215
216
  }) : undefined;
216
217
  }
217
218
  }, {
218
219
  name: 'tableDragAndDrop',
219
- plugin: function plugin(_ref10) {
220
- var dispatch = _ref10.dispatch;
220
+ plugin: function plugin(_ref11) {
221
+ var dispatch = _ref11.dispatch;
221
222
  return options !== null && options !== void 0 && options.dragAndDropEnabled ? createDragAndDropPlugin(dispatch, editorAnalyticsAPI) : undefined;
222
223
  }
223
224
  }, {
224
225
  name: 'tableLocalId',
225
- plugin: function plugin(_ref11) {
226
- var dispatch = _ref11.dispatch;
226
+ plugin: function plugin(_ref12) {
227
+ var dispatch = _ref12.dispatch;
227
228
  return createTableLocalIdPlugin(dispatch);
228
229
  }
229
230
  }, {
230
231
  name: 'tableWidth',
231
- plugin: function plugin(_ref12) {
232
+ plugin: function plugin(_ref13) {
232
233
  var _options$fullWidthEna;
233
- var dispatchAnalyticsEvent = _ref12.dispatchAnalyticsEvent,
234
- dispatch = _ref12.dispatch;
234
+ var dispatchAnalyticsEvent = _ref13.dispatchAnalyticsEvent,
235
+ dispatch = _ref13.dispatch;
235
236
  return options !== null && options !== void 0 && options.tableResizingEnabled ? createTableWidthPlugin(dispatch, dispatchAnalyticsEvent, (_options$fullWidthEna = options === null || options === void 0 ? void 0 : options.fullWidthEnabled) !== null && _options$fullWidthEna !== void 0 ? _options$fullWidthEna : false) : undefined;
236
237
  }
237
238
  },
238
239
  // TODO: should be deprecated and eventually replaced with 'tableAnalyticsPlugin'
239
240
  {
240
241
  name: 'tableOverflowAnalyticsPlugin',
241
- plugin: function plugin(_ref13) {
242
+ plugin: function plugin(_ref14) {
242
243
  var _options$tableResizin;
243
- var dispatch = _ref13.dispatch,
244
- dispatchAnalyticsEvent = _ref13.dispatchAnalyticsEvent;
244
+ var dispatch = _ref14.dispatch,
245
+ dispatchAnalyticsEvent = _ref14.dispatchAnalyticsEvent;
245
246
  return createTableOverflowAnalyticsPlugin(dispatch, dispatchAnalyticsEvent, (_options$tableResizin = options === null || options === void 0 ? void 0 : options.tableResizingEnabled) !== null && _options$tableResizin !== void 0 ? _options$tableResizin : false);
246
247
  }
247
248
  }, {
248
249
  name: 'tableAnalyticsPlugin',
249
- plugin: function plugin(_ref14) {
250
- var dispatch = _ref14.dispatch,
251
- dispatchAnalyticsEvent = _ref14.dispatchAnalyticsEvent;
250
+ plugin: function plugin(_ref15) {
251
+ var dispatch = _ref15.dispatch,
252
+ dispatchAnalyticsEvent = _ref15.dispatchAnalyticsEvent;
252
253
  return getBooleanFF('platform.editor.table.analytics-plugin-moved-event') ? createTableAnalyticsPlugin(dispatch, dispatchAnalyticsEvent) : undefined;
253
254
  }
254
255
  }, {
@@ -279,12 +280,12 @@ var tablesPlugin = function tablesPlugin(_ref) {
279
280
  }
280
281
  return plugins;
281
282
  },
282
- contentComponent: function contentComponent(_ref15) {
283
- var editorView = _ref15.editorView,
284
- popupsMountPoint = _ref15.popupsMountPoint,
285
- popupsBoundariesElement = _ref15.popupsBoundariesElement,
286
- popupsScrollableElement = _ref15.popupsScrollableElement,
287
- dispatchAnalyticsEvent = _ref15.dispatchAnalyticsEvent;
283
+ contentComponent: function contentComponent(_ref16) {
284
+ var editorView = _ref16.editorView,
285
+ popupsMountPoint = _ref16.popupsMountPoint,
286
+ popupsBoundariesElement = _ref16.popupsBoundariesElement,
287
+ popupsScrollableElement = _ref16.popupsScrollableElement,
288
+ dispatchAnalyticsEvent = _ref16.dispatchAnalyticsEvent;
288
289
  return /*#__PURE__*/React.createElement(ErrorBoundary, {
289
290
  component: ACTION_SUBJECT.TABLES_PLUGIN,
290
291
  dispatchAnalyticsEvent: dispatchAnalyticsEvent,
@@ -298,30 +299,30 @@ var tablesPlugin = function tablesPlugin(_ref) {
298
299
  stickyHeadersState: stickyHeadersPluginKey,
299
300
  dragAndDropState: dragAndDropPluginKey
300
301
  },
301
- render: function render(_ref16) {
302
- var resizingPluginState = _ref16.tableResizingPluginState,
303
- stickyHeadersState = _ref16.stickyHeadersState,
304
- tablePluginState = _ref16.tablePluginState,
305
- tableWidthPluginState = _ref16.tableWidthPluginState,
306
- dragAndDropState = _ref16.dragAndDropState;
302
+ render: function render(_ref17) {
303
+ var resizingPluginState = _ref17.tableResizingPluginState,
304
+ stickyHeadersState = _ref17.stickyHeadersState,
305
+ tablePluginState = _ref17.tablePluginState,
306
+ tableWidthPluginState = _ref17.tableWidthPluginState,
307
+ dragAndDropState = _ref17.dragAndDropState;
307
308
  var state = editorView.state;
308
309
  var isColumnResizing = resizingPluginState === null || resizingPluginState === void 0 ? void 0 : resizingPluginState.dragging;
309
310
  var isTableResizing = tableWidthPluginState === null || tableWidthPluginState === void 0 ? void 0 : tableWidthPluginState.resizing;
310
311
  var isResizing = isColumnResizing || isTableResizing;
311
- var _ref17 = tablePluginState,
312
- tableNode = _ref17.tableNode,
313
- tablePos = _ref17.tablePos,
314
- targetCellPosition = _ref17.targetCellPosition,
315
- isContextualMenuOpen = _ref17.isContextualMenuOpen,
316
- layout = _ref17.layout,
317
- tableRef = _ref17.tableRef,
318
- pluginConfig = _ref17.pluginConfig,
319
- insertColumnButtonIndex = _ref17.insertColumnButtonIndex,
320
- insertRowButtonIndex = _ref17.insertRowButtonIndex,
321
- isHeaderColumnEnabled = _ref17.isHeaderColumnEnabled,
322
- isHeaderRowEnabled = _ref17.isHeaderRowEnabled,
323
- isDragAndDropEnabled = _ref17.isDragAndDropEnabled,
324
- tableWrapperTarget = _ref17.tableWrapperTarget;
312
+ var _ref18 = tablePluginState,
313
+ tableNode = _ref18.tableNode,
314
+ tablePos = _ref18.tablePos,
315
+ targetCellPosition = _ref18.targetCellPosition,
316
+ isContextualMenuOpen = _ref18.isContextualMenuOpen,
317
+ layout = _ref18.layout,
318
+ tableRef = _ref18.tableRef,
319
+ pluginConfig = _ref18.pluginConfig,
320
+ insertColumnButtonIndex = _ref18.insertColumnButtonIndex,
321
+ insertRowButtonIndex = _ref18.insertRowButtonIndex,
322
+ isHeaderColumnEnabled = _ref18.isHeaderColumnEnabled,
323
+ isHeaderRowEnabled = _ref18.isHeaderRowEnabled,
324
+ isDragAndDropEnabled = _ref18.isDragAndDropEnabled,
325
+ tableWrapperTarget = _ref18.tableWrapperTarget;
325
326
  var allowControls = pluginConfig.allowControls;
326
327
  var stickyHeader = stickyHeadersState ? findStickyHeaderForTable(stickyHeadersState, tablePos) : undefined;
327
328
  var LayoutContent = options && !options.tableResizingEnabled && isLayoutSupported(state) && options.breakoutEnabled ? /*#__PURE__*/React.createElement(LayoutButton, {
@@ -402,8 +403,8 @@ var tablesPlugin = function tablesPlugin(_ref) {
402
403
  }));
403
404
  },
404
405
  pluginsOptions: {
405
- quickInsert: function quickInsert(_ref18) {
406
- var formatMessage = _ref18.formatMessage;
406
+ quickInsert: function quickInsert(_ref19) {
407
+ var formatMessage = _ref19.formatMessage;
407
408
  return [{
408
409
  id: 'table',
409
410
  title: formatMessage(messages.table),