@atlaskit/editor-plugin-table 7.16.7 → 7.16.9

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 (135) hide show
  1. package/CHANGELOG.md +17 -0
  2. package/dist/cjs/commands/misc.js +11 -1
  3. package/dist/cjs/nodeviews/ExternalDropTargets.js +4 -0
  4. package/dist/cjs/nodeviews/TableComponent.js +28 -5
  5. package/dist/cjs/nodeviews/TableContainer.js +38 -12
  6. package/dist/cjs/nodeviews/TableResizer.js +27 -6
  7. package/dist/cjs/toolbar.js +17 -7
  8. package/dist/cjs/ui/ColumnResizeWidget/index.js +2 -0
  9. package/dist/cjs/ui/DragHandle/index.js +10 -3
  10. package/dist/cjs/ui/DragPreview/index.js +1 -0
  11. package/dist/cjs/ui/FloatingContextualButton/FixedButton.js +12 -1
  12. package/dist/cjs/ui/FloatingContextualButton/index.js +3 -1
  13. package/dist/cjs/ui/FloatingContextualMenu/ContextualMenu.js +7 -2
  14. package/dist/cjs/ui/FloatingDeleteButton/DeleteButton.js +7 -2
  15. package/dist/cjs/ui/FloatingDeleteButton/index.js +2 -0
  16. package/dist/cjs/ui/FloatingDragMenu/DragMenu.js +7 -2
  17. package/dist/cjs/ui/FloatingDragMenu/DropdownMenu.js +61 -57
  18. package/dist/cjs/ui/FloatingInsertButton/InsertButton.js +36 -14
  19. package/dist/cjs/ui/TableFloatingColumnControls/ColumnControls/index.js +22 -4
  20. package/dist/cjs/ui/TableFloatingColumnControls/ColumnDropTargets/ColumnDropTarget.js +2 -0
  21. package/dist/cjs/ui/TableFloatingColumnControls/ColumnDropTargets/index.js +4 -1
  22. package/dist/cjs/ui/TableFloatingColumnControls/index.js +3 -1
  23. package/dist/cjs/ui/TableFloatingControls/CornerControls/ClassicCornerControls.js +12 -3
  24. package/dist/cjs/ui/TableFloatingControls/CornerControls/DragCornerControls.js +2 -0
  25. package/dist/cjs/ui/TableFloatingControls/NumberColumn/index.js +13 -4
  26. package/dist/cjs/ui/TableFloatingControls/RowControls/ClassicControls.js +50 -43
  27. package/dist/cjs/ui/TableFloatingControls/RowControls/DragControls.js +16 -2
  28. package/dist/cjs/ui/TableFloatingControls/RowDropTarget/index.js +3 -1
  29. package/dist/cjs/ui/TableFloatingControls/index.js +80 -76
  30. package/dist/cjs/ui/icons/DragHandleDisabledIcon.js +3 -1
  31. package/dist/cjs/ui/icons/DragInMotionIcon.js +3 -1
  32. package/dist/cjs/ui/icons/MinimisedHandle.js +1 -0
  33. package/dist/es2019/commands/misc.js +10 -0
  34. package/dist/es2019/nodeviews/ExternalDropTargets.js +4 -0
  35. package/dist/es2019/nodeviews/TableComponent.js +28 -5
  36. package/dist/es2019/nodeviews/TableContainer.js +37 -12
  37. package/dist/es2019/nodeviews/TableResizer.js +27 -6
  38. package/dist/es2019/toolbar.js +13 -3
  39. package/dist/es2019/ui/ColumnResizeWidget/index.js +2 -0
  40. package/dist/es2019/ui/DragHandle/index.js +10 -3
  41. package/dist/es2019/ui/DragPreview/index.js +1 -0
  42. package/dist/es2019/ui/FloatingContextualButton/FixedButton.js +12 -1
  43. package/dist/es2019/ui/FloatingContextualButton/index.js +3 -1
  44. package/dist/es2019/ui/FloatingContextualMenu/ContextualMenu.js +7 -2
  45. package/dist/es2019/ui/FloatingDeleteButton/DeleteButton.js +7 -2
  46. package/dist/es2019/ui/FloatingDeleteButton/index.js +2 -0
  47. package/dist/es2019/ui/FloatingDragMenu/DragMenu.js +7 -2
  48. package/dist/es2019/ui/FloatingDragMenu/DropdownMenu.js +56 -52
  49. package/dist/es2019/ui/FloatingInsertButton/InsertButton.js +36 -14
  50. package/dist/es2019/ui/TableFloatingColumnControls/ColumnControls/index.js +22 -4
  51. package/dist/es2019/ui/TableFloatingColumnControls/ColumnDropTargets/ColumnDropTarget.js +2 -0
  52. package/dist/es2019/ui/TableFloatingColumnControls/ColumnDropTargets/index.js +4 -1
  53. package/dist/es2019/ui/TableFloatingColumnControls/index.js +3 -1
  54. package/dist/es2019/ui/TableFloatingControls/CornerControls/ClassicCornerControls.js +12 -3
  55. package/dist/es2019/ui/TableFloatingControls/CornerControls/DragCornerControls.js +2 -0
  56. package/dist/es2019/ui/TableFloatingControls/NumberColumn/index.js +13 -4
  57. package/dist/es2019/ui/TableFloatingControls/RowControls/ClassicControls.js +47 -40
  58. package/dist/es2019/ui/TableFloatingControls/RowControls/DragControls.js +16 -2
  59. package/dist/es2019/ui/TableFloatingControls/RowDropTarget/index.js +3 -1
  60. package/dist/es2019/ui/TableFloatingControls/index.js +78 -74
  61. package/dist/es2019/ui/icons/DragHandleDisabledIcon.js +3 -1
  62. package/dist/es2019/ui/icons/DragInMotionIcon.js +3 -1
  63. package/dist/es2019/ui/icons/MinimisedHandle.js +1 -0
  64. package/dist/esm/commands/misc.js +10 -0
  65. package/dist/esm/nodeviews/ExternalDropTargets.js +4 -0
  66. package/dist/esm/nodeviews/TableComponent.js +28 -5
  67. package/dist/esm/nodeviews/TableContainer.js +38 -12
  68. package/dist/esm/nodeviews/TableResizer.js +29 -8
  69. package/dist/esm/toolbar.js +16 -4
  70. package/dist/esm/ui/ColumnResizeWidget/index.js +2 -0
  71. package/dist/esm/ui/DragHandle/index.js +10 -3
  72. package/dist/esm/ui/DragPreview/index.js +1 -0
  73. package/dist/esm/ui/FloatingContextualButton/FixedButton.js +12 -1
  74. package/dist/esm/ui/FloatingContextualButton/index.js +3 -1
  75. package/dist/esm/ui/FloatingContextualMenu/ContextualMenu.js +7 -2
  76. package/dist/esm/ui/FloatingDeleteButton/DeleteButton.js +7 -2
  77. package/dist/esm/ui/FloatingDeleteButton/index.js +2 -0
  78. package/dist/esm/ui/FloatingDragMenu/DragMenu.js +7 -2
  79. package/dist/esm/ui/FloatingDragMenu/DropdownMenu.js +61 -57
  80. package/dist/esm/ui/FloatingInsertButton/InsertButton.js +36 -14
  81. package/dist/esm/ui/TableFloatingColumnControls/ColumnControls/index.js +22 -4
  82. package/dist/esm/ui/TableFloatingColumnControls/ColumnDropTargets/ColumnDropTarget.js +2 -0
  83. package/dist/esm/ui/TableFloatingColumnControls/ColumnDropTargets/index.js +4 -1
  84. package/dist/esm/ui/TableFloatingColumnControls/index.js +3 -1
  85. package/dist/esm/ui/TableFloatingControls/CornerControls/ClassicCornerControls.js +12 -3
  86. package/dist/esm/ui/TableFloatingControls/CornerControls/DragCornerControls.js +2 -0
  87. package/dist/esm/ui/TableFloatingControls/NumberColumn/index.js +13 -4
  88. package/dist/esm/ui/TableFloatingControls/RowControls/ClassicControls.js +50 -43
  89. package/dist/esm/ui/TableFloatingControls/RowControls/DragControls.js +16 -2
  90. package/dist/esm/ui/TableFloatingControls/RowDropTarget/index.js +3 -1
  91. package/dist/esm/ui/TableFloatingControls/index.js +80 -76
  92. package/dist/esm/ui/icons/DragHandleDisabledIcon.js +3 -1
  93. package/dist/esm/ui/icons/DragInMotionIcon.js +3 -1
  94. package/dist/esm/ui/icons/MinimisedHandle.js +1 -0
  95. package/dist/types/commands/misc.d.ts +2 -1
  96. package/dist/types/nodeviews/TableContainer.d.ts +3 -2
  97. package/dist/types/nodeviews/TableResizer.d.ts +2 -1
  98. package/dist/types/toolbar.d.ts +2 -1
  99. package/dist/types-ts4.5/commands/misc.d.ts +2 -1
  100. package/dist/types-ts4.5/nodeviews/TableContainer.d.ts +3 -2
  101. package/dist/types-ts4.5/nodeviews/TableResizer.d.ts +2 -1
  102. package/dist/types-ts4.5/toolbar.d.ts +2 -1
  103. package/docs/0-intro.tsx +1 -0
  104. package/package.json +2 -2
  105. package/src/commands/misc.ts +20 -1
  106. package/src/nodeviews/ExternalDropTargets.tsx +4 -0
  107. package/src/nodeviews/TableComponent.tsx +18 -0
  108. package/src/nodeviews/TableContainer.tsx +17 -1
  109. package/src/nodeviews/TableResizer.tsx +52 -6
  110. package/src/toolbar.tsx +20 -1
  111. package/src/ui/ColumnResizeWidget/index.tsx +2 -0
  112. package/src/ui/DragHandle/index.tsx +3 -0
  113. package/src/ui/DragPreview/index.tsx +1 -0
  114. package/src/ui/FloatingContextualButton/FixedButton.tsx +10 -0
  115. package/src/ui/FloatingContextualButton/index.tsx +1 -0
  116. package/src/ui/FloatingContextualMenu/ContextualMenu.tsx +3 -0
  117. package/src/ui/FloatingDeleteButton/DeleteButton.tsx +4 -0
  118. package/src/ui/FloatingDeleteButton/index.tsx +2 -0
  119. package/src/ui/FloatingDragMenu/DragMenu.tsx +3 -0
  120. package/src/ui/FloatingDragMenu/DropdownMenu.tsx +3 -0
  121. package/src/ui/FloatingInsertButton/InsertButton.tsx +14 -0
  122. package/src/ui/TableFloatingColumnControls/ColumnControls/index.tsx +16 -1
  123. package/src/ui/TableFloatingColumnControls/ColumnDropTargets/ColumnDropTarget.tsx +2 -0
  124. package/src/ui/TableFloatingColumnControls/ColumnDropTargets/index.tsx +2 -0
  125. package/src/ui/TableFloatingColumnControls/index.tsx +1 -0
  126. package/src/ui/TableFloatingControls/CornerControls/ClassicCornerControls.tsx +6 -0
  127. package/src/ui/TableFloatingControls/CornerControls/DragCornerControls.tsx +4 -0
  128. package/src/ui/TableFloatingControls/NumberColumn/index.tsx +5 -0
  129. package/src/ui/TableFloatingControls/RowControls/ClassicControls.tsx +5 -0
  130. package/src/ui/TableFloatingControls/RowControls/DragControls.tsx +15 -1
  131. package/src/ui/TableFloatingControls/RowDropTarget/index.tsx +1 -0
  132. package/src/ui/TableFloatingControls/index.tsx +1 -0
  133. package/src/ui/icons/DragHandleDisabledIcon.tsx +1 -0
  134. package/src/ui/icons/DragInMotionIcon.tsx +1 -0
  135. package/src/ui/icons/MinimisedHandle.tsx +1 -0
@@ -12,18 +12,20 @@ import { focusTableResizer, ToolTipContent } from '@atlaskit/editor-common/keyma
12
12
  import { tableMessages as messages } from '@atlaskit/editor-common/messages';
13
13
  import { ResizerNext } from '@atlaskit/editor-common/resizer';
14
14
  import { browser } from '@atlaskit/editor-common/utils';
15
+ import { chainCommands } from '@atlaskit/editor-prosemirror/commands';
15
16
  import { findTable } from '@atlaskit/editor-tables/utils';
16
17
  import { getBooleanFF } from '@atlaskit/platform-feature-flags';
17
- import { updateWidthToWidest } from '../commands/misc';
18
+ import { setTableAlignmentWithTableContentWithPos, updateWidthToWidest } from '../commands/misc';
18
19
  import { META_KEYS } from '../pm-plugins/table-analytics';
19
20
  import { COLUMN_MIN_WIDTH, getColgroupChildrenLength, previewScaleTable, scaleTable, TABLE_MAX_WIDTH } from '../pm-plugins/table-resizing/utils';
20
21
  import { pluginKey as tableWidthPluginKey } from '../pm-plugins/table-width';
21
22
  import { TABLE_GUIDELINE_VISIBLE_ADJUSTMENT, TABLE_HIGHLIGHT_GAP, TABLE_HIGHLIGHT_TOLERANCE, TABLE_SNAP_GAP } from '../ui/consts';
22
- import { normaliseAlignment } from '../utils/alignment';
23
+ import { ALIGN_CENTER, ALIGN_START, normaliseAlignment } from '../utils/alignment';
23
24
  import { generateResizedPayload, generateResizeFrameRatePayloads, useMeasureFramerate } from '../utils/analytics';
24
25
  import { defaultGuidelines, defaultGuidelinesForPreserveTable } from '../utils/guidelines';
25
26
  import { defaultSnappingWidths, defaultTablePreserveSnappingWidths, findClosestSnap } from '../utils/snapping';
26
27
  var RESIZE_STEP_VALUE = 10;
28
+ var FULL_WIDTH_EDITOR_CONTENT_WIDTH = 1800;
27
29
  var handles = {
28
30
  right: true
29
31
  };
@@ -78,6 +80,7 @@ export var TableResizer = function TableResizer(_ref) {
78
80
  width = _ref.width,
79
81
  maxWidth = _ref.maxWidth,
80
82
  containerWidth = _ref.containerWidth,
83
+ lineLength = _ref.lineLength,
81
84
  updateWidth = _ref.updateWidth,
82
85
  onResizeStop = _ref.onResizeStop,
83
86
  onResizeStart = _ref.onResizeStart,
@@ -131,21 +134,37 @@ export var TableResizer = function TableResizer(_ref) {
131
134
  x: isTableScalingEnabled ? defaultTablePreserveSnappingWidths(containerWidth, isTableAlignmentEnabled) : defaultSnappingWidths
132
135
  } : undefined;
133
136
  }, [snappingEnabled, isTableScalingEnabled, isTableAlignmentEnabled, containerWidth]);
137
+ var switchToCenterAlignment = useCallback(function (pos, node, newWidth, state, dispatch) {
138
+ if (isTableAlignmentEnabled && node && node.attrs.layout === ALIGN_START && newWidth > lineLength && lineLength < FULL_WIDTH_EDITOR_CONTENT_WIDTH &&
139
+ // We don't want to switch alignment in Full-width editor
140
+ isResizing.current) {
141
+ var tableNodeWithPos = {
142
+ pos: pos,
143
+ node: node
144
+ };
145
+ var _tr = setTableAlignmentWithTableContentWithPos(ALIGN_CENTER, tableNodeWithPos)(state);
146
+ if (_tr) {
147
+ dispatch(_tr);
148
+ }
149
+ return true;
150
+ }
151
+ return false;
152
+ }, [lineLength, isTableAlignmentEnabled, isResizing]);
134
153
  useEffect(function () {
135
154
  return function () {
136
155
  // only bring back the cursor if this table was deleted - i.e. if a user was resizing, then another
137
156
  // deleted this table
138
157
  if (isResizing.current) {
139
158
  var dispatch = editorView.dispatch,
140
- _tr = editorView.state.tr;
159
+ _tr2 = editorView.state.tr;
141
160
  displayGapCursor(true);
142
161
  displayGuideline([]);
143
- _tr.setMeta(tableWidthPluginKey, {
162
+ _tr2.setMeta(tableWidthPluginKey, {
144
163
  resizing: false,
145
164
  tableLocalId: '',
146
165
  tableRef: null
147
166
  });
148
- dispatch(_tr);
167
+ dispatch(_tr2);
149
168
  }
150
169
  };
151
170
  }, [editorView, displayGuideline, displayGapCursor]);
@@ -201,10 +220,12 @@ export var TableResizer = function TableResizer(_ref) {
201
220
  })[0];
202
221
  var isFullWidthGuidelineActive = closestSnap.keys.includes(fullWidthGuideline.key);
203
222
  var shouldUpdateWidthToWidest = !!isTableScalingEnabled && isFullWidthGuidelineActive;
204
- updateWidthToWidest(_defineProperty({}, currentTableNodeLocalId, shouldUpdateWidthToWidest))(state, dispatch);
223
+ chainCommands(function (state, dispatch) {
224
+ return switchToCenterAlignment(pos, node, newWidth, state, dispatch);
225
+ }, updateWidthToWidest(_defineProperty({}, currentTableNodeLocalId, shouldUpdateWidthToWidest)))(state, dispatch);
205
226
  updateWidth(shouldUpdateWidthToWidest ? TABLE_MAX_WIDTH : newWidth);
206
227
  return newWidth;
207
- }, [countFrames, isTableScalingEnabled, isTableAlignmentEnabled, tableRef, node, editorView, updateActiveGuidelines, containerWidth, updateWidth, getPos]);
228
+ }, [countFrames, isTableScalingEnabled, isTableAlignmentEnabled, tableRef, node, editorView, updateActiveGuidelines, containerWidth, updateWidth, getPos, switchToCenterAlignment]);
208
229
  var scheduleResize = useMemo(function () {
209
230
  return rafSchd(handleResize);
210
231
  }, [handleResize]);
@@ -357,7 +378,7 @@ export var TableResizer = function TableResizer(_ref) {
357
378
  (_updateTooltip$curren = updateTooltip.current) === null || _updateTooltip$curren === void 0 || _updateTooltip$curren.call(updateTooltip);
358
379
  }
359
380
  }, [width]);
360
- var resizeRatio = !isTableAlignmentEnabled || isTableAlignmentEnabled && normaliseAlignment(node.attrs.layout) === 'center' ? 2 : 1;
381
+ var resizeRatio = !isTableAlignmentEnabled || isTableAlignmentEnabled && normaliseAlignment(node.attrs.layout) === ALIGN_CENTER ? 2 : 1;
361
382
  return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(ResizerNext, {
362
383
  ref: resizerRef,
363
384
  enable: handles,
@@ -1,5 +1,8 @@
1
1
  import _extends from "@babel/runtime/helpers/extends";
2
+ import _defineProperty from "@babel/runtime/helpers/defineProperty";
2
3
  import _toConsumableArray from "@babel/runtime/helpers/toConsumableArray";
4
+ 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; }
5
+ 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; }
3
6
  /** @jsx jsx */
4
7
  import { jsx } from '@emotion/react';
5
8
  import { TableSortOrder as SortOrder } from '@atlaskit/custom-steps';
@@ -320,7 +323,7 @@ export var getToolbarConfig = function getToolbarConfig(getEditorContainerWidth,
320
323
  var menu = getToolbarMenuConfig(config, pluginState, intl, editorAnalyticsAPI);
321
324
  var alignmentMenu;
322
325
  var isNested = pluginState.tablePos && isTableNested(state, pluginState.tablePos);
323
- alignmentMenu = options !== null && options !== void 0 && options.isTableAlignmentEnabled && !isNested ? getAlignmentOptionsConfig(state, intl, editorAnalyticsAPI) : [];
326
+ alignmentMenu = options !== null && options !== void 0 && options.isTableAlignmentEnabled && !isNested ? getAlignmentOptionsConfig(state, intl, editorAnalyticsAPI, getEditorContainerWidth) : [];
324
327
  var cellItems;
325
328
  cellItems = pluginState.isDragAndDropEnabled ? [] : getCellItems(state, getEditorView(), intl, getEditorContainerWidth, editorAnalyticsAPI, options === null || options === void 0 ? void 0 : options.isTableScalingEnabled);
326
329
  var columnSettingsItems;
@@ -584,7 +587,7 @@ var highlightColumnsHandler = function highlightColumnsHandler(state, dispatch)
584
587
  }
585
588
  return false;
586
589
  };
587
- export var getAlignmentOptionsConfig = function getAlignmentOptionsConfig(editorState, _ref6, editorAnalyticsAPI) {
590
+ export var getAlignmentOptionsConfig = function getAlignmentOptionsConfig(editorState, _ref6, editorAnalyticsAPI, getEditorContainerWidth) {
588
591
  var formatMessage = _ref6.formatMessage;
589
592
  var tableObject = findTable(editorState.selection);
590
593
  if (!tableObject) {
@@ -610,14 +613,16 @@ export var getAlignmentOptionsConfig = function getAlignmentOptionsConfig(editor
610
613
  value = alignmentIcon.value,
611
614
  icon = alignmentIcon.icon;
612
615
  var currentLayout = tableObject.node.attrs.layout;
613
- return {
616
+ return _objectSpread({
614
617
  id: id,
615
618
  type: 'button',
616
619
  icon: icon,
617
620
  title: formatMessage(layoutToMessages[value]),
618
621
  selected: normaliseAlignment(currentLayout) === value,
619
622
  onClick: setTableAlignmentWithAnalytics(editorAnalyticsAPI)(value, currentLayout, INPUT_METHOD.FLOATING_TB)
620
- };
623
+ }, isLayoutOptionDisabled(tableObject.node, getEditorContainerWidth) && {
624
+ disabled: value !== 'center'
625
+ });
621
626
  });
622
627
  var alignmentItemOptions = {
623
628
  render: function render(props) {
@@ -644,4 +649,11 @@ export var getSelectedAlignmentIcon = function getSelectedAlignmentIcon(alignmen
644
649
  return alignmentIcons.find(function (icon) {
645
650
  return icon.value === normaliseAlignment(selectedAlignment);
646
651
  });
652
+ };
653
+ export var isLayoutOptionDisabled = function isLayoutOptionDisabled(selectedNode, getEditorContainerWidth) {
654
+ var lineLength = getEditorContainerWidth().lineLength;
655
+ if (selectedNode && lineLength && selectedNode.attrs.width > lineLength) {
656
+ return true;
657
+ }
658
+ return false;
647
659
  };
@@ -14,6 +14,7 @@ export var ColumnResizeWidget = function ColumnResizeWidget(_ref) {
14
14
  formatMessage = _useIntl.formatMessage;
15
15
  if (!includeTooltip) {
16
16
  return jsx("div", {
17
+ // eslint-disable-next-line @atlaskit/ui-styling-standard/no-classname-prop -- Ignored via go/DSP-18766
17
18
  className: TableCssClassName.RESIZE_HANDLE_DECORATION,
18
19
  "data-start-index": startIndex,
19
20
  "data-end-index": endIndex
@@ -30,6 +31,7 @@ export var ColumnResizeWidget = function ColumnResizeWidget(_ref) {
30
31
  mousePosition: "auto-start"
31
32
  }, function (tooltipProps) {
32
33
  return jsx("div", _extends({
34
+ // eslint-disable-next-line @atlaskit/ui-styling-standard/no-classname-prop -- Ignored via go/DSP-18766
33
35
  className: TableCssClassName.RESIZE_HANDLE_DECORATION,
34
36
  "data-start-index": startIndex,
35
37
  "data-end-index": endIndex
@@ -146,7 +146,9 @@ var DragHandleComponent = function DragHandleComponent(_ref) {
146
146
  }, [tableLocalId, direction, indexes, isRow, editorView.state.selection, hasMergedCells]);
147
147
  var showDragMenuAnchorId = isRow ? 'drag-handle-button-row' : 'drag-handle-button-column';
148
148
  return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement("button", {
149
- type: "button",
149
+ type: "button"
150
+ // eslint-disable-next-line @atlaskit/ui-styling-standard/no-classname-prop -- Ignored via go/DSP-18766
151
+ ,
150
152
  className: ClassName.DRAG_HANDLE_BUTTON_CLICKABLE_ZONE,
151
153
  "data-testid": "table-drag-handle-clickable-zone-button",
152
154
  style: {
@@ -171,7 +173,9 @@ var DragHandleComponent = function DragHandleComponent(_ref) {
171
173
  onClick: onClick
172
174
  }), /*#__PURE__*/React.createElement("button", {
173
175
  type: "button",
174
- id: isDragMenuTarget ? showDragMenuAnchorId : undefined,
176
+ id: isDragMenuTarget ? showDragMenuAnchorId : undefined
177
+ // eslint-disable-next-line @atlaskit/ui-styling-standard/no-classname-prop -- Ignored via go/DSP-18766
178
+ ,
175
179
  className: classnames(ClassName.DRAG_HANDLE_BUTTON_CONTAINER, appearance, _defineProperty({}, ClassName.DRAG_HANDLE_DISABLED, hasMergedCells)),
176
180
  ref: dragHandleDivRef,
177
181
  style: {
@@ -198,7 +202,10 @@ var DragHandleComponent = function DragHandleComponent(_ref) {
198
202
  }
199
203
  }, appearance !== 'placeholder' ?
200
204
  // cannot block pointer events in Firefox as it breaks Dragging functionality
201
- browser.gecko ? /*#__PURE__*/React.createElement(HandleIconComponent, handleIconProps) : /*#__PURE__*/React.createElement("span", {
205
+ browser.gecko ? /*#__PURE__*/React.createElement(HandleIconComponent, handleIconProps) :
206
+ /*#__PURE__*/
207
+ // eslint-disable-next-line @atlaskit/ui-styling-standard/enforce-style-prop -- Ignored via go/DSP-18766
208
+ React.createElement("span", {
202
209
  style: {
203
210
  pointerEvents: 'none'
204
211
  }
@@ -23,6 +23,7 @@ export var DragPreview = function DragPreview(_ref) {
23
23
  }
24
24
  }, /*#__PURE__*/React.createElement(DragInMotionIcon, {
25
25
  style: {
26
+ // eslint-disable-next-line @atlaskit/ui-styling-standard/enforce-style-prop -- Ignored via go/DSP-18766
26
27
  position: 'absolute',
27
28
  // eslint-disable-next-line @atlaskit/design-system/ensure-design-token-usage/preview
28
29
  marginLeft: "".concat(marginLeft, "px"),
@@ -91,19 +91,26 @@ export var FixedButton = function FixedButton(_ref2) {
91
91
  React.createElement("div", {
92
92
  ref: observerTargetRef,
93
93
  style: {
94
+ // eslint-disable-next-line @atlaskit/ui-styling-standard/enforce-style-prop -- Ignored via go/DSP-18766
94
95
  position: 'absolute',
96
+ // eslint-disable-next-line @atlaskit/ui-styling-standard/enforce-style-prop -- Ignored via go/DSP-18766
95
97
  top: "var(--ds-space-0, 0px)",
98
+ // eslint-disable-next-line @atlaskit/ui-styling-standard/enforce-style-prop -- Ignored via go/DSP-18766
96
99
  left: "var(--ds-space-0, 0px)",
100
+ // eslint-disable-next-line @atlaskit/ui-styling-standard/enforce-style-prop -- Ignored via go/DSP-18766
97
101
  width: "var(--ds-space-250, 20px)",
98
102
  // BUTTON_WIDTH
103
+ // eslint-disable-next-line @atlaskit/ui-styling-standard/enforce-style-prop -- Ignored via go/DSP-18766
99
104
  height: "var(--ds-space-250, 20px)" // BUTTON_WIDTH
100
105
  }
101
106
  }, /*#__PURE__*/React.createElement("div", {
102
107
  ref: fixedButtonRef,
103
108
  style: {
109
+ // eslint-disable-next-line @atlaskit/ui-styling-standard/enforce-style-prop -- Ignored via go/DSP-18766
104
110
  position: 'fixed',
105
111
  // eslint-disable-next-line @atlaskit/design-system/ensure-design-token-usage/preview
106
112
  top: stickyHeader.top + stickyHeader.padding + offset * 2,
113
+ // eslint-disable-next-line @atlaskit/ui-styling-standard/enforce-style-prop -- Ignored via go/DSP-18766
107
114
  zIndex: akEditorTableCellOnStickyHeaderZIndex,
108
115
  // eslint-disable-next-line @atlaskit/design-system/ensure-design-token-usage/preview
109
116
  left: calcLeftPos({
@@ -112,10 +119,14 @@ export var FixedButton = function FixedButton(_ref2) {
112
119
  cellRefWidth: targetCellRef.clientWidth,
113
120
  offset: offset
114
121
  }),
122
+ // eslint-disable-next-line @atlaskit/ui-styling-standard/enforce-style-prop -- Ignored via go/DSP-18766
115
123
  width: "var(--ds-space-250, 20px)",
116
124
  // BUTTON_WIDTH
125
+ // eslint-disable-next-line @atlaskit/ui-styling-standard/enforce-style-prop -- Ignored via go/DSP-18766
117
126
  height: "var(--ds-space-250, 20px)" // BUTTON_WIDTH
118
- },
127
+ }
128
+ // eslint-disable-next-line @atlaskit/ui-styling-standard/no-classname-prop -- Ignored via go/DSP-18766
129
+ ,
119
130
  className: ClassName.CONTEXTUAL_MENU_BUTTON_FIXED
120
131
  }, children)), mountTo);
121
132
  };
@@ -46,7 +46,9 @@ var FloatingContextualButtonInner = /*#__PURE__*/React.memo(function (props) {
46
46
  var labelCellOptions = formatMessage(messages.cellOptions);
47
47
  var button = jsx("div", {
48
48
  css: [tableFloatingCellButtonStyles(), isContextualMenuOpen && tableFloatingCellButtonSelectedStyles()]
49
- }, jsx(ToolbarButton, {
49
+ }, jsx(ToolbarButton
50
+ // eslint-disable-next-line @atlaskit/ui-styling-standard/no-classname-prop -- Ignored via go/DSP-18766
51
+ , {
50
52
  className: ClassName.CONTEXTUAL_MENU_BUTTON,
51
53
  selected: isContextualMenuOpen,
52
54
  title: labelCellOptions,
@@ -89,12 +89,17 @@ export var ContextualMenu = /*#__PURE__*/function (_Component) {
89
89
  label: formatMessage(messages.backgroundColor),
90
90
  size: "medium"
91
91
  })) : undefined,
92
- elemAfter: jsx("div", {
92
+ elemAfter:
93
+ // eslint-disable-next-line @atlaskit/ui-styling-standard/no-classname-prop -- Ignored via go/DSP-18766
94
+ jsx("div", {
93
95
  className: DropdownMenuSharedCssClassName.SUBMENU
94
96
  }, jsx("div", {
95
- css: cellColourPreviewStyles(background),
97
+ css: cellColourPreviewStyles(background)
98
+ // eslint-disable-next-line @atlaskit/ui-styling-standard/no-classname-prop -- Ignored via go/DSP-18766
99
+ ,
96
100
  className: isDragAndDropEnabled ? ClassName.CONTEXTUAL_MENU_ICON_SMALL : ClassName.CONTEXTUAL_MENU_ICON
97
101
  }), isSubmenuOpen && jsx("div", {
102
+ // eslint-disable-next-line @atlaskit/ui-styling-standard/no-classname-prop -- Ignored via go/DSP-18766
98
103
  className: ClassName.CONTEXTUAL_SUBMENU,
99
104
  ref: _this.handleSubMenuRef
100
105
  }, jsx(ColorPalette, {
@@ -9,7 +9,10 @@ var DeleteButton = function DeleteButton(_ref) {
9
9
  removeLabel = _ref.removeLabel,
10
10
  formatMessage = _ref.intl.formatMessage;
11
11
  return /*#__PURE__*/React.createElement("div", {
12
- className: ClassName.CONTROLS_DELETE_BUTTON_WRAP,
12
+ // eslint-disable-next-line @atlaskit/ui-styling-standard/no-classname-prop -- Ignored via go/DSP-18766
13
+ className: ClassName.CONTROLS_DELETE_BUTTON_WRAP
14
+ // eslint-disable-next-line @atlaskit/ui-styling-standard/enforce-style-prop -- Ignored via go/DSP-18766
15
+ ,
13
16
  style: style,
14
17
  onMouseEnter: onMouseEnter,
15
18
  onMouseLeave: onMouseLeave
@@ -17,7 +20,9 @@ var DeleteButton = function DeleteButton(_ref) {
17
20
  type: "button",
18
21
  "aria-label": formatMessage(removeLabel, {
19
22
  0: 1
20
- }),
23
+ })
24
+ // eslint-disable-next-line @atlaskit/ui-styling-standard/no-classname-prop -- Ignored via go/DSP-18766
25
+ ,
21
26
  className: ClassName.CONTROLS_DELETE_BUTTON,
22
27
  onMouseDown: onClick,
23
28
  onMouseMove: function onMouseMove(e) {
@@ -198,9 +198,11 @@ var FloatingDeleteButton = /*#__PURE__*/function (_Component) {
198
198
  });
199
199
  return /*#__PURE__*/createPortal( /*#__PURE__*/React.createElement("div", {
200
200
  style: {
201
+ // eslint-disable-next-line @atlaskit/ui-styling-standard/enforce-style-prop -- Ignored via go/DSP-18766
201
202
  position: 'fixed',
202
203
  // eslint-disable-next-line @atlaskit/design-system/ensure-design-token-usage/preview
203
204
  top: pos.top,
205
+ // eslint-disable-next-line @atlaskit/ui-styling-standard/enforce-style-prop -- Ignored via go/DSP-18766
204
206
  zIndex: stickyRowZIndex,
205
207
  // eslint-disable-next-line @atlaskit/design-system/ensure-design-token-usage/preview
206
208
  left: rect.left + (pos.left || 0) - (this.state.selectionType === 'column' ? this.state.scrollLeft : 0) - (this.props.isNumberColumnEnabled ? akEditorTableNumberColumnWidth : 0)
@@ -251,12 +251,17 @@ export var DragMenu = /*#__PURE__*/React.memo(function (_ref) {
251
251
  size: "medium"
252
252
  })),
253
253
  elemAfter: jsx("div", {
254
+ // eslint-disable-next-line @atlaskit/ui-styling-standard/no-classname-prop -- Ignored via go/DSP-18766
254
255
  className: DropdownMenuSharedCssClassName.SUBMENU,
255
256
  css: dragMenuBackgroundColorStyles
256
257
  }, jsx("div", {
257
- css: cellColourPreviewStyles(background),
258
+ css: cellColourPreviewStyles(background)
259
+ // eslint-disable-next-line @atlaskit/ui-styling-standard/no-classname-prop -- Ignored via go/DSP-18766
260
+ ,
258
261
  className: ClassName.DRAG_SUBMENU_ICON
259
- }), isSubmenuOpen && jsx("div", {
262
+ }), isSubmenuOpen &&
263
+ // eslint-disable-next-line @atlaskit/ui-styling-standard/no-classname-prop -- Ignored via go/DSP-18766
264
+ jsx("div", {
260
265
  className: ClassName.DRAG_SUBMENU,
261
266
  ref: handleSubMenuRef
262
267
  }, jsx(ArrowKeyNavigationProvider, {
@@ -82,69 +82,73 @@ export var DropdownMenu = function DropdownMenu(_ref) {
82
82
  }));
83
83
  })));
84
84
  };
85
- return /*#__PURE__*/React.createElement("div", {
86
- className: "drag-dropdown-menu-wrapper"
87
- }, /*#__PURE__*/React.createElement("div", {
88
- className: "drag-dropdown-menu-popup-ref",
89
- ref: handleRef
90
- }), /*#__PURE__*/React.createElement(Popup, {
91
- target: targetRefDiv,
92
- mountTo: mountPoint,
93
- boundariesElement: boundariesElement,
94
- scrollableElement: scrollableElement,
95
- onPlacementChanged: function onPlacementChanged(placement) {
96
- setPopupPlacement(placement);
97
- },
98
- fitHeight: fitHeight,
99
- fitWidth: fitWidth,
100
- zIndex: akEditorFloatingPanelZIndex,
101
- offset: [offsetX, offsetY],
102
- allowOutOfBounds: true // required as this popup is child of a parent popup, should be allowed to be out of bound of the parent popup, otherwise horizontal offset is not right
103
- }, disableKeyboardHandling ? innerMenu() : /*#__PURE__*/React.createElement(ArrowKeyNavigationProvider, {
104
- closeOnTab: true,
105
- type: ArrowKeyNavigationType.MENU,
106
- handleClose: function handleClose() {
107
- return _handleClose('handle');
108
- },
109
- onSelection: function onSelection(index) {
110
- var results = items.flatMap(function (item) {
111
- return 'items' in item ? item.items : item;
112
- });
85
+ return (
86
+ /*#__PURE__*/
87
+ // eslint-disable-next-line @atlaskit/ui-styling-standard/no-classname-prop -- Ignored via go/DSP-18766
88
+ React.createElement("div", {
89
+ className: "drag-dropdown-menu-wrapper"
90
+ }, /*#__PURE__*/React.createElement("div", {
91
+ className: "drag-dropdown-menu-popup-ref",
92
+ ref: handleRef
93
+ }), /*#__PURE__*/React.createElement(Popup, {
94
+ target: targetRefDiv,
95
+ mountTo: mountPoint,
96
+ boundariesElement: boundariesElement,
97
+ scrollableElement: scrollableElement,
98
+ onPlacementChanged: function onPlacementChanged(placement) {
99
+ setPopupPlacement(placement);
100
+ },
101
+ fitHeight: fitHeight,
102
+ fitWidth: fitWidth,
103
+ zIndex: akEditorFloatingPanelZIndex,
104
+ offset: [offsetX, offsetY],
105
+ allowOutOfBounds: true // required as this popup is child of a parent popup, should be allowed to be out of bound of the parent popup, otherwise horizontal offset is not right
106
+ }, disableKeyboardHandling ? innerMenu() : /*#__PURE__*/React.createElement(ArrowKeyNavigationProvider, {
107
+ closeOnTab: true,
108
+ type: ArrowKeyNavigationType.MENU,
109
+ handleClose: function handleClose() {
110
+ return _handleClose('handle');
111
+ },
112
+ onSelection: function onSelection(index) {
113
+ var results = items.flatMap(function (item) {
114
+ return 'items' in item ? item.items : item;
115
+ });
113
116
 
114
- // onSelection is called when any focusable element is 'activated'
115
- // this is an issue as some menu items have toggles, which cause the index value
116
- // in the callback to be outside of array length.
117
- // The logic below normalises the index value based on the number
118
- // of menu items with 2 focusable elements, and adjusts the index to ensure
119
- // the correct menu item is sent in onItemActivated callback
120
- var keys = ['row_numbers', 'header_row', 'header_column'];
121
- var doubleItemCount = 0;
122
- var firstIndex = results.findIndex(function (value) {
123
- return keys.includes(value.key);
124
- });
125
- if (firstIndex === -1 || index <= firstIndex) {
126
- onItemActivated && onItemActivated({
127
- item: results[index]
117
+ // onSelection is called when any focusable element is 'activated'
118
+ // this is an issue as some menu items have toggles, which cause the index value
119
+ // in the callback to be outside of array length.
120
+ // The logic below normalises the index value based on the number
121
+ // of menu items with 2 focusable elements, and adjusts the index to ensure
122
+ // the correct menu item is sent in onItemActivated callback
123
+ var keys = ['row_numbers', 'header_row', 'header_column'];
124
+ var doubleItemCount = 0;
125
+ var firstIndex = results.findIndex(function (value) {
126
+ return keys.includes(value.key);
128
127
  });
129
- return;
130
- }
131
- for (var i = firstIndex; i < results.length; i += 1) {
132
- if (keys.includes(results[i].key)) {
133
- doubleItemCount += 1;
134
- }
135
- if (firstIndex % 2 === 0 && index - doubleItemCount === i) {
128
+ if (firstIndex === -1 || index <= firstIndex) {
136
129
  onItemActivated && onItemActivated({
137
- item: results[i]
130
+ item: results[index]
138
131
  });
139
132
  return;
140
133
  }
141
- if (firstIndex % 2 === 1 && index - doubleItemCount === i) {
142
- onItemActivated && onItemActivated({
143
- item: results[i]
144
- });
145
- return;
134
+ for (var i = firstIndex; i < results.length; i += 1) {
135
+ if (keys.includes(results[i].key)) {
136
+ doubleItemCount += 1;
137
+ }
138
+ if (firstIndex % 2 === 0 && index - doubleItemCount === i) {
139
+ onItemActivated && onItemActivated({
140
+ item: results[i]
141
+ });
142
+ return;
143
+ }
144
+ if (firstIndex % 2 === 1 && index - doubleItemCount === i) {
145
+ onItemActivated && onItemActivated({
146
+ item: results[i]
147
+ });
148
+ return;
149
+ }
146
150
  }
147
151
  }
148
- }
149
- }, innerMenu())));
152
+ }, innerMenu())))
153
+ );
150
154
  };
@@ -68,12 +68,16 @@ export var InsertButtonForDragAndDrop = function InsertButtonForDragAndDrop(_ref
68
68
  }),
69
69
  position: "top"
70
70
  }, /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement("div", {
71
+ // eslint-disable-next-line @atlaskit/ui-styling-standard/no-classname-prop -- Ignored via go/DSP-18766
71
72
  className: classnames(ClassName.DRAG_CONTROLS_INSERT_BUTTON_INNER, (_classnames = {}, _defineProperty(_classnames, ClassName.DRAG_CONTROLS_INSERT_BUTTON_INNER_ROW, isRow), _defineProperty(_classnames, ClassName.DRAG_CONTROLS_INSERT_BUTTON_INNER_COLUMN, !isRow), _classnames))
72
73
  }, /*#__PURE__*/React.createElement("button", {
73
- type: "button",
74
+ type: "button"
75
+ // eslint-disable-next-line @atlaskit/ui-styling-standard/no-classname-prop -- Ignored via go/DSP-18766
76
+ ,
74
77
  className: ClassName.DRAG_CONTROLS_INSERT_BUTTON,
75
78
  onMouseDown: onMouseDown
76
79
  }, /*#__PURE__*/React.createElement("svg", {
80
+ // eslint-disable-next-line @atlaskit/ui-styling-standard/no-classname-prop -- Ignored via go/DSP-18766
77
81
  className: ClassName.CONTROLS_BUTTON_ICON,
78
82
  width: "16",
79
83
  height: "16",
@@ -84,7 +88,10 @@ export var InsertButtonForDragAndDrop = function InsertButtonForDragAndDrop(_ref
84
88
  d: "M8 4C7.44771 4 7 4.44771 7 5V7H5C4.44771 7 4 7.44771 4 8C4 8.55229 4.44771 9 5 9H7V11C7 11.5523 7.44771 12 8 12C8.55229 12 9 11.5523 9 11V9H11C11.5523 9 12 8.55229 12 8C12 7.44771 11.5523 7 11 7H9V5C9 4.44771 8.55229 4 8 4Z",
85
89
  fill: "currentColor"
86
90
  })))), /*#__PURE__*/React.createElement("div", {
87
- className: ClassName.CONTROLS_INSERT_LINE,
91
+ // eslint-disable-next-line @atlaskit/ui-styling-standard/no-classname-prop -- Ignored via go/DSP-18766
92
+ className: ClassName.CONTROLS_INSERT_LINE
93
+ // eslint-disable-next-line @atlaskit/ui-styling-standard/enforce-style-prop -- Ignored via go/DSP-18766
94
+ ,
88
95
  style: type === 'row' ? {
89
96
  width: getInsertLineWidth(tableRef, true),
90
97
  left: "var(--ds-space-150, 12px)"
@@ -95,11 +102,16 @@ export var InsertButtonForDragAndDrop = function InsertButtonForDragAndDrop(_ref
95
102
  }
96
103
  })));
97
104
  var floatingButtonClassName = isRow ? ClassName.CONTROLS_FLOATING_BUTTON_ROW : ClassName.CONTROLS_FLOATING_BUTTON_COLUMN;
98
- return /*#__PURE__*/React.createElement("div", {
99
- className: floatingButtonClassName
100
- }, /*#__PURE__*/React.createElement("div", {
101
- className: "".concat(ClassName.DRAG_CONTROLS_INSERT_BUTTON_WRAP, " ").concat(ClassName.CONTROLS_INSERT_ROW)
102
- }, content));
105
+ return (
106
+ /*#__PURE__*/
107
+ // eslint-disable-next-line @atlaskit/ui-styling-standard/no-classname-prop -- Ignored via go/DSP-18766
108
+ React.createElement("div", {
109
+ className: floatingButtonClassName
110
+ }, /*#__PURE__*/React.createElement("div", {
111
+ // eslint-disable-next-line @atlaskit/ui-styling-standard/no-classname-prop -- Ignored via go/DSP-18766
112
+ className: "".concat(ClassName.DRAG_CONTROLS_INSERT_BUTTON_WRAP, " ").concat(ClassName.CONTROLS_INSERT_ROW)
113
+ }, content))
114
+ );
103
115
  };
104
116
  export var DragAndDropInsertButton = injectIntl(InsertButtonForDragAndDrop);
105
117
  var InsertButton = function InsertButton(_ref3) {
@@ -117,7 +129,9 @@ var InsertButton = function InsertButton(_ref3) {
117
129
  }, /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement("div", {
118
130
  className: ClassName.CONTROLS_INSERT_BUTTON_INNER
119
131
  }, /*#__PURE__*/React.createElement("button", {
120
- type: "button",
132
+ type: "button"
133
+ // eslint-disable-next-line @atlaskit/ui-styling-standard/no-classname-prop -- Ignored via go/DSP-18766
134
+ ,
121
135
  className: ClassName.CONTROLS_INSERT_BUTTON,
122
136
  onMouseDown: onMouseDown
123
137
  }, /*#__PURE__*/React.createElement("svg", {
@@ -127,7 +141,10 @@ var InsertButton = function InsertButton(_ref3) {
127
141
  fill: "currentColor",
128
142
  fillRule: "evenodd"
129
143
  })))), /*#__PURE__*/React.createElement("div", {
130
- className: ClassName.CONTROLS_INSERT_LINE,
144
+ // eslint-disable-next-line @atlaskit/ui-styling-standard/no-classname-prop -- Ignored via go/DSP-18766
145
+ className: ClassName.CONTROLS_INSERT_LINE
146
+ // eslint-disable-next-line @atlaskit/ui-styling-standard/enforce-style-prop -- Ignored via go/DSP-18766
147
+ ,
131
148
  style: type === 'row' ? {
132
149
  width: getInsertLineWidth(tableRef)
133
150
  } : {
@@ -135,10 +152,15 @@ var InsertButton = function InsertButton(_ref3) {
135
152
  }
136
153
  })));
137
154
  var floatingButtonClassName = type === 'column' ? ClassName.CONTROLS_FLOATING_BUTTON_COLUMN : ClassName.CONTROLS_FLOATING_BUTTON_ROW;
138
- return /*#__PURE__*/React.createElement("div", {
139
- className: floatingButtonClassName
140
- }, /*#__PURE__*/React.createElement("div", {
141
- className: "".concat(ClassName.CONTROLS_INSERT_BUTTON_WRAP, " ").concat(ClassName.CONTROLS_INSERT_ROW)
142
- }, content));
155
+ return (
156
+ /*#__PURE__*/
157
+ // eslint-disable-next-line @atlaskit/ui-styling-standard/no-classname-prop -- Ignored via go/DSP-18766
158
+ React.createElement("div", {
159
+ className: floatingButtonClassName
160
+ }, /*#__PURE__*/React.createElement("div", {
161
+ // eslint-disable-next-line @atlaskit/ui-styling-standard/no-classname-prop -- Ignored via go/DSP-18766
162
+ className: "".concat(ClassName.CONTROLS_INSERT_BUTTON_WRAP, " ").concat(ClassName.CONTROLS_INSERT_ROW)
163
+ }, content))
164
+ );
143
165
  };
144
166
  export default injectIntl(InsertButton);