@atlaskit/editor-plugin-table 7.16.11 → 7.16.13

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 (254) hide show
  1. package/.eslintrc.js +3 -3
  2. package/CHANGELOG.md +16 -0
  3. package/dist/cjs/commands/misc.js +3 -3
  4. package/dist/cjs/nodeviews/TableCell.js +10 -10
  5. package/dist/cjs/nodeviews/TableContainer.js +83 -27
  6. package/dist/cjs/nodeviews/TableResizer.js +40 -19
  7. package/dist/cjs/nodeviews/TableRow.js +23 -23
  8. package/dist/cjs/pm-plugins/table-resizing/plugin.js +3 -3
  9. package/dist/cjs/pm-plugins/table-resizing/utils/resize-state.js +4 -4
  10. package/dist/cjs/pm-plugins/table-resizing/utils/scale-table.js +3 -3
  11. package/dist/cjs/ui/FloatingContextualMenu/styles.js +1 -1
  12. package/dist/cjs/ui/FloatingDragMenu/styles.js +1 -1
  13. package/dist/cjs/ui/common-styles.js +13 -13
  14. package/dist/cjs/ui/ui-styles.js +25 -25
  15. package/dist/cjs/utils/guidelines.js +7 -4
  16. package/dist/cjs/utils/merged-cells.js +3 -3
  17. package/dist/cjs/utils/snapping.js +7 -8
  18. package/dist/es2019/commands/misc.js +3 -3
  19. package/dist/es2019/nodeviews/TableContainer.js +70 -9
  20. package/dist/es2019/nodeviews/TableResizer.js +42 -21
  21. package/dist/es2019/nodeviews/TableRow.js +21 -21
  22. package/dist/es2019/pm-plugins/table-resizing/plugin.js +3 -3
  23. package/dist/es2019/pm-plugins/table-resizing/utils/resize-state.js +4 -4
  24. package/dist/es2019/pm-plugins/table-resizing/utils/scale-table.js +3 -3
  25. package/dist/es2019/ui/FloatingContextualMenu/styles.js +47 -47
  26. package/dist/es2019/ui/FloatingDragMenu/styles.js +30 -30
  27. package/dist/es2019/ui/common-styles.js +802 -816
  28. package/dist/es2019/ui/ui-styles.js +665 -678
  29. package/dist/es2019/utils/guidelines.js +5 -2
  30. package/dist/es2019/utils/merged-cells.js +3 -3
  31. package/dist/es2019/utils/snapping.js +5 -6
  32. package/dist/esm/commands/misc.js +3 -3
  33. package/dist/esm/nodeviews/TableCell.js +10 -10
  34. package/dist/esm/nodeviews/TableContainer.js +85 -29
  35. package/dist/esm/nodeviews/TableResizer.js +42 -21
  36. package/dist/esm/nodeviews/TableRow.js +23 -23
  37. package/dist/esm/pm-plugins/table-resizing/plugin.js +3 -3
  38. package/dist/esm/pm-plugins/table-resizing/utils/resize-state.js +4 -4
  39. package/dist/esm/pm-plugins/table-resizing/utils/scale-table.js +3 -3
  40. package/dist/esm/ui/FloatingContextualMenu/styles.js +1 -1
  41. package/dist/esm/ui/FloatingDragMenu/styles.js +1 -1
  42. package/dist/esm/ui/common-styles.js +13 -13
  43. package/dist/esm/ui/ui-styles.js +25 -25
  44. package/dist/esm/utils/guidelines.js +6 -3
  45. package/dist/esm/utils/merged-cells.js +3 -3
  46. package/dist/esm/utils/snapping.js +6 -7
  47. package/dist/types/nodeviews/TableResizer.d.ts +2 -1
  48. package/dist/types/pm-plugins/decorations/utils/index.d.ts +1 -1
  49. package/dist/types/pm-plugins/drag-and-drop/utils/autoscrollers.d.ts +1 -1
  50. package/dist/types/pm-plugins/drag-and-drop/utils/getDragBehaviour.d.ts +1 -1
  51. package/dist/types/pm-plugins/table-resizing/utils/index.d.ts +1 -1
  52. package/dist/types/ui/ColumnResizeWidget/index.d.ts +1 -1
  53. package/dist/types/ui/FloatingAlignmentButtons/FloatingAlignmentButtons.d.ts +1 -1
  54. package/dist/types/ui/FloatingToolbarLabel/FloatingToolbarLabel.d.ts +1 -1
  55. package/dist/types/ui/TableFloatingColumnControls/ColumnDropTargets/ColumnDropTarget.d.ts +1 -1
  56. package/dist/types/ui/TableFloatingControls/CornerControls/index.d.ts +1 -1
  57. package/dist/types/ui/icons/DragHandleDisabledIcon.d.ts +1 -1
  58. package/dist/types/utils/guidelines.d.ts +2 -1
  59. package/dist/types/utils/snapping.d.ts +3 -2
  60. package/dist/types-ts4.5/nodeviews/TableResizer.d.ts +2 -1
  61. package/dist/types-ts4.5/pm-plugins/decorations/utils/index.d.ts +1 -1
  62. package/dist/types-ts4.5/pm-plugins/drag-and-drop/utils/autoscrollers.d.ts +1 -1
  63. package/dist/types-ts4.5/pm-plugins/drag-and-drop/utils/getDragBehaviour.d.ts +1 -1
  64. package/dist/types-ts4.5/pm-plugins/table-resizing/utils/index.d.ts +1 -1
  65. package/dist/types-ts4.5/ui/ColumnResizeWidget/index.d.ts +1 -1
  66. package/dist/types-ts4.5/ui/FloatingAlignmentButtons/FloatingAlignmentButtons.d.ts +1 -1
  67. package/dist/types-ts4.5/ui/FloatingToolbarLabel/FloatingToolbarLabel.d.ts +1 -1
  68. package/dist/types-ts4.5/ui/TableFloatingColumnControls/ColumnDropTargets/ColumnDropTarget.d.ts +1 -1
  69. package/dist/types-ts4.5/ui/TableFloatingControls/CornerControls/index.d.ts +1 -1
  70. package/dist/types-ts4.5/ui/icons/DragHandleDisabledIcon.d.ts +1 -1
  71. package/dist/types-ts4.5/utils/guidelines.d.ts +2 -1
  72. package/dist/types-ts4.5/utils/snapping.d.ts +3 -2
  73. package/docs/0-intro.tsx +9 -7
  74. package/package.json +3 -3
  75. package/report.api.md +67 -66
  76. package/src/commands/clear.ts +36 -44
  77. package/src/commands/collapse.ts +8 -8
  78. package/src/commands/column-resize.ts +412 -452
  79. package/src/commands/delete.ts +14 -14
  80. package/src/commands/display-mode.ts +10 -11
  81. package/src/commands/go-to-next-cell.ts +48 -54
  82. package/src/commands/hover.ts +210 -227
  83. package/src/commands/index.ts +35 -35
  84. package/src/commands/insert.ts +208 -235
  85. package/src/commands/misc.ts +655 -748
  86. package/src/commands/referentiality.ts +9 -9
  87. package/src/commands/selection.ts +433 -563
  88. package/src/commands/sort.ts +68 -86
  89. package/src/commands/split-cell.ts +14 -14
  90. package/src/commands/toggle.ts +69 -67
  91. package/src/commands-with-analytics.ts +570 -639
  92. package/src/create-plugin-config.ts +13 -13
  93. package/src/event-handlers.ts +513 -612
  94. package/src/handlers.ts +120 -133
  95. package/src/nodeviews/ExternalDropTargets.tsx +68 -73
  96. package/src/nodeviews/OverflowShadowsObserver.ts +148 -157
  97. package/src/nodeviews/TableCell.ts +47 -54
  98. package/src/nodeviews/TableComponent.tsx +1018 -1112
  99. package/src/nodeviews/TableComponentWithSharedState.tsx +91 -94
  100. package/src/nodeviews/TableContainer.tsx +384 -340
  101. package/src/nodeviews/TableNodeViewBase.ts +19 -24
  102. package/src/nodeviews/TableResizer.tsx +642 -653
  103. package/src/nodeviews/TableRow.ts +580 -629
  104. package/src/nodeviews/TableStickyScrollbar.ts +173 -190
  105. package/src/nodeviews/__mocks__/OverflowShadowsObserver.ts +8 -8
  106. package/src/nodeviews/__mocks__/OverridableMock.ts +14 -15
  107. package/src/nodeviews/table.tsx +345 -375
  108. package/src/nodeviews/types.ts +21 -24
  109. package/src/nodeviews/update-overflow-shadows.ts +8 -14
  110. package/src/plugin.tsx +578 -603
  111. package/src/pm-plugins/analytics/actions.ts +10 -12
  112. package/src/pm-plugins/analytics/commands.ts +31 -37
  113. package/src/pm-plugins/analytics/plugin-factory.ts +4 -2
  114. package/src/pm-plugins/analytics/plugin-key.ts +1 -3
  115. package/src/pm-plugins/analytics/plugin.ts +60 -70
  116. package/src/pm-plugins/analytics/reducer.ts +19 -19
  117. package/src/pm-plugins/analytics/types.ts +10 -10
  118. package/src/pm-plugins/analytics/utils/moved-event.ts +38 -38
  119. package/src/pm-plugins/decorations/plugin.ts +58 -77
  120. package/src/pm-plugins/decorations/utils/column-controls.ts +59 -71
  121. package/src/pm-plugins/decorations/utils/column-resizing.ts +50 -57
  122. package/src/pm-plugins/decorations/utils/compose-decorations.ts +6 -6
  123. package/src/pm-plugins/decorations/utils/index.ts +3 -6
  124. package/src/pm-plugins/decorations/utils/types.ts +7 -12
  125. package/src/pm-plugins/default-table-selection.ts +3 -3
  126. package/src/pm-plugins/drag-and-drop/actions.ts +25 -25
  127. package/src/pm-plugins/drag-and-drop/commands-with-analytics.ts +158 -190
  128. package/src/pm-plugins/drag-and-drop/commands.ts +154 -170
  129. package/src/pm-plugins/drag-and-drop/consts.ts +4 -5
  130. package/src/pm-plugins/drag-and-drop/plugin-factory.ts +23 -20
  131. package/src/pm-plugins/drag-and-drop/plugin-key.ts +1 -3
  132. package/src/pm-plugins/drag-and-drop/plugin.ts +329 -383
  133. package/src/pm-plugins/drag-and-drop/reducer.ts +30 -30
  134. package/src/pm-plugins/drag-and-drop/types.ts +8 -8
  135. package/src/pm-plugins/drag-and-drop/utils/autoscrollers.ts +38 -41
  136. package/src/pm-plugins/drag-and-drop/utils/getDragBehaviour.ts +3 -6
  137. package/src/pm-plugins/drag-and-drop/utils/monitor.ts +57 -70
  138. package/src/pm-plugins/keymap.ts +208 -220
  139. package/src/pm-plugins/main.ts +348 -400
  140. package/src/pm-plugins/plugin-factory.ts +32 -34
  141. package/src/pm-plugins/safari-delete-composition-text-issue-workaround.ts +83 -97
  142. package/src/pm-plugins/sticky-headers/commands.ts +2 -6
  143. package/src/pm-plugins/sticky-headers/plugin-key.ts +1 -3
  144. package/src/pm-plugins/sticky-headers/plugin-state.ts +41 -44
  145. package/src/pm-plugins/sticky-headers/plugin.ts +4 -4
  146. package/src/pm-plugins/sticky-headers/types.ts +8 -8
  147. package/src/pm-plugins/sticky-headers/util.ts +10 -10
  148. package/src/pm-plugins/table-analytics.ts +70 -72
  149. package/src/pm-plugins/table-local-id.ts +180 -184
  150. package/src/pm-plugins/table-resizing/commands.ts +72 -85
  151. package/src/pm-plugins/table-resizing/event-handlers.ts +298 -317
  152. package/src/pm-plugins/table-resizing/plugin-factory.ts +10 -10
  153. package/src/pm-plugins/table-resizing/plugin-key.ts +1 -3
  154. package/src/pm-plugins/table-resizing/plugin.ts +61 -68
  155. package/src/pm-plugins/table-resizing/reducer.ts +30 -33
  156. package/src/pm-plugins/table-resizing/utils/colgroup.ts +84 -84
  157. package/src/pm-plugins/table-resizing/utils/column-state.ts +78 -81
  158. package/src/pm-plugins/table-resizing/utils/content-width.ts +94 -114
  159. package/src/pm-plugins/table-resizing/utils/dom.ts +93 -110
  160. package/src/pm-plugins/table-resizing/utils/index.ts +29 -34
  161. package/src/pm-plugins/table-resizing/utils/misc.ts +94 -119
  162. package/src/pm-plugins/table-resizing/utils/resize-column.ts +93 -106
  163. package/src/pm-plugins/table-resizing/utils/resize-logic.ts +240 -257
  164. package/src/pm-plugins/table-resizing/utils/resize-state.ts +343 -372
  165. package/src/pm-plugins/table-resizing/utils/scale-table.ts +202 -207
  166. package/src/pm-plugins/table-resizing/utils/types.ts +17 -17
  167. package/src/pm-plugins/table-resizing/utils/unit-to-number.ts +1 -2
  168. package/src/pm-plugins/table-selection-keymap.ts +25 -51
  169. package/src/pm-plugins/table-width.ts +191 -204
  170. package/src/pm-plugins/view-mode-sort/index.ts +223 -227
  171. package/src/pm-plugins/view-mode-sort/plugin-key.ts +3 -2
  172. package/src/pm-plugins/view-mode-sort/types.ts +12 -12
  173. package/src/pm-plugins/view-mode-sort/utils.ts +108 -117
  174. package/src/reducer.ts +139 -155
  175. package/src/toolbar.tsx +815 -905
  176. package/src/transforms/column-width.ts +186 -213
  177. package/src/transforms/delete-columns.ts +208 -222
  178. package/src/transforms/delete-rows.ts +117 -121
  179. package/src/transforms/fix-tables.ts +190 -215
  180. package/src/transforms/merge.ts +263 -269
  181. package/src/transforms/replace-table.ts +27 -43
  182. package/src/transforms/split.ts +65 -75
  183. package/src/types.ts +421 -427
  184. package/src/ui/ColumnResizeWidget/index.tsx +40 -47
  185. package/src/ui/DragHandle/HandleIconComponent.tsx +9 -13
  186. package/src/ui/DragHandle/index.tsx +221 -250
  187. package/src/ui/DragPreview/index.tsx +35 -35
  188. package/src/ui/FloatingAlignmentButtons/FloatingAlignmentButtons.tsx +33 -41
  189. package/src/ui/FloatingContextualButton/FixedButton.tsx +154 -157
  190. package/src/ui/FloatingContextualButton/index.tsx +109 -115
  191. package/src/ui/FloatingContextualButton/styles.ts +43 -46
  192. package/src/ui/FloatingContextualMenu/ContextualMenu.tsx +634 -694
  193. package/src/ui/FloatingContextualMenu/index.tsx +83 -101
  194. package/src/ui/FloatingContextualMenu/styles.ts +57 -65
  195. package/src/ui/FloatingDeleteButton/DeleteButton.tsx +37 -37
  196. package/src/ui/FloatingDeleteButton/getPopUpOptions.ts +47 -57
  197. package/src/ui/FloatingDeleteButton/index.tsx +319 -350
  198. package/src/ui/FloatingDragMenu/DragMenu.tsx +555 -596
  199. package/src/ui/FloatingDragMenu/DropdownMenu.tsx +152 -162
  200. package/src/ui/FloatingDragMenu/index.tsx +88 -102
  201. package/src/ui/FloatingDragMenu/styles.ts +51 -54
  202. package/src/ui/FloatingInsertButton/InsertButton.tsx +204 -217
  203. package/src/ui/FloatingInsertButton/getPopupOptions.ts +100 -115
  204. package/src/ui/FloatingInsertButton/index.tsx +248 -292
  205. package/src/ui/FloatingToolbarLabel/FloatingToolbarLabel.tsx +24 -29
  206. package/src/ui/TableFloatingColumnControls/ColumnControls/index.tsx +308 -329
  207. package/src/ui/TableFloatingColumnControls/ColumnDropTargets/ColumnDropTarget.tsx +85 -94
  208. package/src/ui/TableFloatingColumnControls/ColumnDropTargets/index.tsx +46 -46
  209. package/src/ui/TableFloatingColumnControls/index.tsx +116 -136
  210. package/src/ui/TableFloatingControls/CornerControls/ClassicCornerControls.tsx +79 -91
  211. package/src/ui/TableFloatingControls/CornerControls/DragCornerControls.tsx +95 -102
  212. package/src/ui/TableFloatingControls/CornerControls/index.tsx +1 -4
  213. package/src/ui/TableFloatingControls/CornerControls/types.ts +8 -8
  214. package/src/ui/TableFloatingControls/FloatingControlsWithSelection.tsx +50 -50
  215. package/src/ui/TableFloatingControls/NumberColumn/index.tsx +111 -124
  216. package/src/ui/TableFloatingControls/RowControls/ClassicControls.tsx +86 -105
  217. package/src/ui/TableFloatingControls/RowControls/DragControls.tsx +305 -341
  218. package/src/ui/TableFloatingControls/RowDropTarget/index.tsx +72 -75
  219. package/src/ui/TableFloatingControls/index.tsx +191 -193
  220. package/src/ui/TableFullWidthLabel/index.tsx +20 -20
  221. package/src/ui/common-styles.ts +880 -912
  222. package/src/ui/consts.ts +29 -74
  223. package/src/ui/icons/AddColLeftIcon.tsx +33 -39
  224. package/src/ui/icons/AddColRightIcon.tsx +33 -39
  225. package/src/ui/icons/AddRowAboveIcon.tsx +16 -22
  226. package/src/ui/icons/AddRowBelowIcon.tsx +33 -39
  227. package/src/ui/icons/DisplayModeIcon.tsx +31 -31
  228. package/src/ui/icons/DragHandleDisabledIcon.tsx +19 -21
  229. package/src/ui/icons/DragHandleIcon.tsx +12 -12
  230. package/src/ui/icons/DragInMotionIcon.tsx +45 -52
  231. package/src/ui/icons/MergeCellsIcon.tsx +22 -28
  232. package/src/ui/icons/MinimisedHandle.tsx +9 -9
  233. package/src/ui/icons/SplitCellIcon.tsx +30 -36
  234. package/src/ui/ui-styles.ts +769 -798
  235. package/src/utils/alignment.ts +1 -1
  236. package/src/utils/analytics.ts +192 -208
  237. package/src/utils/collapse.ts +55 -64
  238. package/src/utils/column-controls.ts +237 -254
  239. package/src/utils/create.ts +30 -30
  240. package/src/utils/decoration.ts +482 -502
  241. package/src/utils/dom.ts +127 -134
  242. package/src/utils/drag-menu.ts +322 -373
  243. package/src/utils/get-allow-add-column-custom-step.ts +4 -5
  244. package/src/utils/guidelines.ts +16 -21
  245. package/src/utils/index.ts +68 -68
  246. package/src/utils/merged-cells.ts +245 -254
  247. package/src/utils/nodes.ts +91 -106
  248. package/src/utils/paste.ts +119 -135
  249. package/src/utils/row-controls.ts +199 -213
  250. package/src/utils/selection.ts +77 -87
  251. package/src/utils/snapping.ts +87 -100
  252. package/src/utils/table.ts +44 -44
  253. package/src/utils/transforms.ts +5 -5
  254. package/src/utils/update-plugin-state-decorations.ts +5 -9
@@ -2,25 +2,22 @@
2
2
 
3
3
  import { css } from '@emotion/react';
4
4
 
5
- import {
6
- tableMarginTop,
7
- tableSharedStyle,
8
- } from '@atlaskit/editor-common/styles';
5
+ import { tableMarginTop, tableSharedStyle } from '@atlaskit/editor-common/styles';
9
6
  import { SORTABLE_COLUMN_ICON_CLASSNAME } from '@atlaskit/editor-common/table';
10
7
  import type { FeatureFlags } from '@atlaskit/editor-common/types';
11
8
  import { browser } from '@atlaskit/editor-common/utils';
12
9
  import {
13
- akEditorSelectedNodeClassName,
14
- akEditorSmallZIndex,
15
- akEditorStickyHeaderZIndex,
16
- akEditorTableCellOnStickyHeaderZIndex,
17
- akEditorTableNumberColumnWidth,
18
- akEditorTableToolbarSize,
19
- akEditorUnitZIndex,
20
- getSelectionStyles,
21
- MAX_BROWSER_SCROLLBAR_HEIGHT,
22
- relativeFontSizeToBase16,
23
- SelectionStyle,
10
+ akEditorSelectedNodeClassName,
11
+ akEditorSmallZIndex,
12
+ akEditorStickyHeaderZIndex,
13
+ akEditorTableCellOnStickyHeaderZIndex,
14
+ akEditorTableNumberColumnWidth,
15
+ akEditorTableToolbarSize,
16
+ akEditorUnitZIndex,
17
+ getSelectionStyles,
18
+ MAX_BROWSER_SCROLLBAR_HEIGHT,
19
+ relativeFontSizeToBase16,
20
+ SelectionStyle,
24
21
  } from '@atlaskit/editor-shared-styles';
25
22
  import { scrollbarStyles } from '@atlaskit/editor-shared-styles/scrollbar';
26
23
  import { getBooleanFF } from '@atlaskit/platform-feature-flags';
@@ -32,51 +29,51 @@ import { SORTING_ICON_CLASS_NAME } from '../pm-plugins/view-mode-sort/consts';
32
29
  import { TableCssClassName as ClassName } from '../types';
33
30
 
34
31
  import {
35
- columnControlsDecorationHeight,
36
- resizeHandlerAreaWidth,
37
- resizeHandlerZIndex,
38
- resizeLineWidth,
39
- rowControlsZIndex,
40
- stickyHeaderBorderBottomWidth,
41
- stickyRowOffsetTop,
42
- tableBorderColor,
43
- tableBorderDeleteColor,
44
- tableBorderRadiusSize,
45
- tableBorderSelectedColor,
46
- tableCellBackgroundColor,
47
- tableCellDeleteColor,
48
- tableCellSelectedColor,
49
- tableControlsSpacing,
50
- tableHeaderCellBackgroundColor,
51
- tableInsertColumnButtonSize,
52
- tableOverflowShadowWidth,
53
- tablePadding,
54
- tableScrollbarOffset,
55
- tableTextColor,
56
- tableToolbarDeleteColor,
57
- tableToolbarSelectedColor,
58
- tableToolbarSize,
32
+ columnControlsDecorationHeight,
33
+ resizeHandlerAreaWidth,
34
+ resizeHandlerZIndex,
35
+ resizeLineWidth,
36
+ rowControlsZIndex,
37
+ stickyHeaderBorderBottomWidth,
38
+ stickyRowOffsetTop,
39
+ tableBorderColor,
40
+ tableBorderDeleteColor,
41
+ tableBorderRadiusSize,
42
+ tableBorderSelectedColor,
43
+ tableCellBackgroundColor,
44
+ tableCellDeleteColor,
45
+ tableCellSelectedColor,
46
+ tableControlsSpacing,
47
+ tableHeaderCellBackgroundColor,
48
+ tableInsertColumnButtonSize,
49
+ tableOverflowShadowWidth,
50
+ tablePadding,
51
+ tableScrollbarOffset,
52
+ tableTextColor,
53
+ tableToolbarDeleteColor,
54
+ tableToolbarSelectedColor,
55
+ tableToolbarSize,
59
56
  } from './consts';
60
57
  import {
61
- columnControlsDecoration,
62
- columnControlsLineMarker,
63
- DeleteButton,
64
- dragCornerControlButton,
65
- dragInsertButtonWrapper,
66
- floatingColumnControls,
67
- HeaderButton,
68
- HeaderButtonDanger,
69
- HeaderButtonHover,
70
- hoveredCell,
71
- hoveredDeleteButton,
72
- hoveredWarningCell,
73
- insertColumnButtonWrapper,
74
- insertLine,
75
- InsertMarker,
76
- insertRowButtonWrapper,
77
- OverflowShadow,
78
- resizeHandle,
79
- rowControlsWrapperDotStyle,
58
+ columnControlsDecoration,
59
+ columnControlsLineMarker,
60
+ DeleteButton,
61
+ dragCornerControlButton,
62
+ dragInsertButtonWrapper,
63
+ floatingColumnControls,
64
+ HeaderButton,
65
+ HeaderButtonDanger,
66
+ HeaderButtonHover,
67
+ hoveredCell,
68
+ hoveredDeleteButton,
69
+ hoveredWarningCell,
70
+ insertColumnButtonWrapper,
71
+ insertLine,
72
+ InsertMarker,
73
+ insertRowButtonWrapper,
74
+ OverflowShadow,
75
+ resizeHandle,
76
+ rowControlsWrapperDotStyle,
80
77
  } from './ui-styles';
81
78
 
82
79
  const cornerControlHeight = tableToolbarSize + 1;
@@ -104,9 +101,7 @@ const rangeSelectionStyles = `
104
101
  `;
105
102
 
106
103
  const sentinelStyles = `.${ClassName.TABLE_CONTAINER} {
107
- > .${ClassName.TABLE_STICKY_SENTINEL_TOP}, > .${
108
- ClassName.TABLE_STICKY_SENTINEL_BOTTOM
109
- } {
104
+ > .${ClassName.TABLE_STICKY_SENTINEL_TOP}, > .${ClassName.TABLE_STICKY_SENTINEL_BOTTOM} {
110
105
  position: absolute;
111
106
  width: 100%;
112
107
  height: 1px;
@@ -119,9 +114,7 @@ const sentinelStyles = `.${ClassName.TABLE_CONTAINER} {
119
114
  top: ${columnControlsDecorationHeight}px;
120
115
  }
121
116
  > .${ClassName.TABLE_STICKY_SENTINEL_BOTTOM} {
122
- bottom: ${
123
- tableScrollbarOffset + stickyRowOffsetTop + tablePadding * 2 + 23
124
- }px;
117
+ bottom: ${tableScrollbarOffset + stickyRowOffsetTop + tablePadding * 2 + 23}px;
125
118
  }
126
119
  &.${ClassName.WITH_CONTROLS} {
127
120
  > .${ClassName.TABLE_STICKY_SENTINEL_TOP} {
@@ -164,9 +157,9 @@ const stickyScrollbarContainerStyles = `.${ClassName.TABLE_CONTAINER} {
164
157
  }`;
165
158
 
166
159
  const stickyScrollbarStyles = (featureFlags?: FeatureFlags) => {
167
- return featureFlags?.stickyScrollbar
168
- ? `${stickyScrollbarContainerStyles} ${stickyScrollbarSentinelStyles}`
169
- : '';
160
+ return featureFlags?.stickyScrollbar
161
+ ? `${stickyScrollbarContainerStyles} ${stickyScrollbarSentinelStyles}`
162
+ : '';
170
163
  };
171
164
 
172
165
  const shadowSentinelStyles = `
@@ -187,167 +180,161 @@ const shadowSentinelStyles = `
187
180
  `;
188
181
 
189
182
  const breakoutWidthStyling = () => {
190
- return css`
191
- > *:not([data-mark-type='fragment'])
192
- .${ClassName.NODEVIEW_WRAPPER}
193
- .${ClassName.TABLE_CONTAINER} {
194
- margin-left: unset !important;
195
- width: 100% !important;
196
- }
197
-
198
- > [data-mark-type='fragment']
199
- *
200
- .${ClassName.NODEVIEW_WRAPPER}
201
- .${ClassName.TABLE_CONTAINER} {
202
- margin-left: unset !important;
203
- width: 100% !important;
204
- }
205
- `;
183
+ return css`
184
+ > *:not([data-mark-type='fragment'])
185
+ .${ClassName.NODEVIEW_WRAPPER}
186
+ .${ClassName.TABLE_CONTAINER} {
187
+ margin-left: unset !important;
188
+ width: 100% !important;
189
+ }
190
+
191
+ > [data-mark-type='fragment'] * .${ClassName.NODEVIEW_WRAPPER} .${ClassName.TABLE_CONTAINER} {
192
+ margin-left: unset !important;
193
+ width: 100% !important;
194
+ }
195
+ `;
206
196
  };
207
197
 
208
198
  const viewModeSortStyles = () => {
209
- if (getBooleanFF('platform.editor.table.live-pages-sorting_4malx')) {
210
- return css`
211
- th {
212
- .${SORTING_ICON_CLASS_NAME} {
213
- + p {
214
- margin-top: 0 !important;
215
- }
216
- }
217
-
218
- &:has(.is-active) {
219
- .${SORTABLE_COLUMN_ICON_CLASSNAME} {
220
- opacity: 1;
221
- }
222
- }
223
-
224
- .${SORTABLE_COLUMN_ICON_CLASSNAME} {
225
- opacity: 0;
226
- &:focus {
227
- opacity: 1;
228
- }
229
- }
230
-
231
- &:hover {
232
- .${SORTABLE_COLUMN_ICON_CLASSNAME} {
233
- opacity: 1;
234
- }
235
- }
236
- }
237
- `;
238
- }
199
+ if (getBooleanFF('platform.editor.table.live-pages-sorting_4malx')) {
200
+ return css`
201
+ th {
202
+ .${SORTING_ICON_CLASS_NAME} {
203
+ + p {
204
+ margin-top: 0 !important;
205
+ }
206
+ }
207
+
208
+ &:has(.is-active) {
209
+ .${SORTABLE_COLUMN_ICON_CLASSNAME} {
210
+ opacity: 1;
211
+ }
212
+ }
213
+
214
+ .${SORTABLE_COLUMN_ICON_CLASSNAME} {
215
+ opacity: 0;
216
+ &:focus {
217
+ opacity: 1;
218
+ }
219
+ }
220
+
221
+ &:hover {
222
+ .${SORTABLE_COLUMN_ICON_CLASSNAME} {
223
+ opacity: 1;
224
+ }
225
+ }
226
+ }
227
+ `;
228
+ }
239
229
  };
240
230
 
241
231
  const numberColumnFix = () => {
242
- if (getBooleanFF('platform.editor.table.editor-num-col-style-changes')) {
243
- return '';
244
- }
245
-
246
- return css`
247
- > table[data-number-column='true'] {
248
- width: calc(100% - 1px);
249
- }
250
- `;
232
+ if (getBooleanFF('platform.editor.table.editor-num-col-style-changes')) {
233
+ return '';
234
+ }
235
+
236
+ return css`
237
+ > table[data-number-column='true'] {
238
+ width: calc(100% - 1px);
239
+ }
240
+ `;
251
241
  };
252
242
 
253
243
  const tableBorderStyles = () => {
254
- return `border-color: ${tableBorderDeleteColor}`;
244
+ return `border-color: ${tableBorderDeleteColor}`;
255
245
  };
256
246
 
257
247
  // eslint-disable-next-line @atlaskit/design-system/ensure-design-token-usage/preview
258
248
  const tableStickyHeaderColumnControlsDecorationsStyle = () => {
259
- return css`
260
- .${ClassName.TABLE_STICKY} .${ClassName.COLUMN_CONTROLS_DECORATIONS} {
261
- z-index: 0;
262
- left: -1px;
263
- }
264
-
265
- .${ClassName.TABLE_STICKY}
266
- .${ClassName.COLUMN_CONTROLS_DECORATIONS}::after {
267
- border-left: 1px solid ${tableBorderColor};
268
- }
269
-
270
- .${ClassName.TABLE_STICKY}
271
- tr:first-of-type
272
- th.${ClassName.TABLE_HEADER_CELL} {
273
- &.${ClassName.COLUMN_SELECTED}, &.${ClassName.HOVERED_COLUMN} {
274
- .${ClassName.COLUMN_CONTROLS_DECORATIONS}::after {
275
- left: 0;
276
- }
277
- }
278
- }
279
- `;
249
+ return css`
250
+ .${ClassName.TABLE_STICKY} .${ClassName.COLUMN_CONTROLS_DECORATIONS} {
251
+ z-index: 0;
252
+ left: -1px;
253
+ }
254
+
255
+ .${ClassName.TABLE_STICKY} .${ClassName.COLUMN_CONTROLS_DECORATIONS}::after {
256
+ border-left: 1px solid ${tableBorderColor};
257
+ }
258
+
259
+ .${ClassName.TABLE_STICKY} tr:first-of-type th.${ClassName.TABLE_HEADER_CELL} {
260
+ &.${ClassName.COLUMN_SELECTED}, &.${ClassName.HOVERED_COLUMN} {
261
+ .${ClassName.COLUMN_CONTROLS_DECORATIONS}::after {
262
+ left: 0;
263
+ }
264
+ }
265
+ }
266
+ `;
280
267
  };
281
268
 
282
269
  const tableStickyHeaderFirefoxFixStyle = () => {
283
- /*
270
+ /*
284
271
  This is MAGIC!
285
272
  This fixes a bug which occurs in firefox when the first row becomes sticky.
286
273
  see https://product-fabric.atlassian.net/browse/ED-19177
287
274
  */
288
- if (browser.gecko) {
289
- return css`
290
- .${ClassName.TABLE_STICKY} > tbody::before {
291
- content: '';
292
- }
293
- `;
294
- }
275
+ if (browser.gecko) {
276
+ return css`
277
+ .${ClassName.TABLE_STICKY} > tbody::before {
278
+ content: '';
279
+ }
280
+ `;
281
+ }
295
282
  };
296
283
 
297
284
  // re-exporting these styles to use in Gemini test when table node view is rendered outside of PM
298
285
  export const baseTableStyles = (props: { featureFlags?: FeatureFlags }) => css`
299
- ${tableSharedStyle()};
300
- ${columnControlsLineMarker()};
301
- ${hoveredDeleteButton()};
302
- ${hoveredCell()};
303
- ${hoveredWarningCell};
304
- ${props.featureFlags?.tableDragAndDrop && insertLine()};
305
- ${resizeHandle(props.featureFlags?.tableDragAndDrop)};
306
- ${rangeSelectionStyles};
307
- ${viewModeSortStyles()};
308
-
309
- .${ClassName.LAST_ITEM_IN_CELL} {
310
- margin-bottom: 0;
311
- }
312
-
313
- .${ClassName.TABLE_NODE_WRAPPER} {
314
- td.${ClassName.TABLE_CELL}, th.${ClassName.TABLE_HEADER_CELL} {
315
- position: relative;
316
- overflow: visible;
317
- }
318
-
319
- td.${ClassName.TABLE_CELL} {
320
- background-color: ${tableCellBackgroundColor};
321
-
322
- // ED-15246: Trello card is visible through a border of a table border
323
- // This fixes a border issue caused by relative positioned table cells
324
- &::after {
325
- height: 100%;
326
- content: '';
327
- border-left: 1px solid ${tableBorderColor};
328
- border-bottom: 1px solid ${tableBorderColor};
329
- position: absolute;
330
- right: 0px;
331
- top: 0px;
332
- bottom: 0;
333
- width: 100%;
334
- display: inline-block;
335
- pointer-events: none;
336
- }
337
- }
338
- }
339
-
340
- .${ClassName.CONTROLS_FLOATING_BUTTON_COLUMN} {
341
- ${insertColumnButtonWrapper()}
342
- }
343
-
344
- .${ClassName.CONTROLS_FLOATING_BUTTON_ROW} {
345
- ${insertRowButtonWrapper()}
346
- }
347
-
348
- ${dragInsertButtonWrapper()}
349
-
350
- ${dragCornerControlButton()}
286
+ ${tableSharedStyle()};
287
+ ${columnControlsLineMarker()};
288
+ ${hoveredDeleteButton()};
289
+ ${hoveredCell()};
290
+ ${hoveredWarningCell};
291
+ ${props.featureFlags?.tableDragAndDrop && insertLine()};
292
+ ${resizeHandle(props.featureFlags?.tableDragAndDrop)};
293
+ ${rangeSelectionStyles};
294
+ ${viewModeSortStyles()};
295
+
296
+ .${ClassName.LAST_ITEM_IN_CELL} {
297
+ margin-bottom: 0;
298
+ }
299
+
300
+ .${ClassName.TABLE_NODE_WRAPPER} {
301
+ td.${ClassName.TABLE_CELL}, th.${ClassName.TABLE_HEADER_CELL} {
302
+ position: relative;
303
+ overflow: visible;
304
+ }
305
+
306
+ td.${ClassName.TABLE_CELL} {
307
+ background-color: ${tableCellBackgroundColor};
308
+
309
+ // ED-15246: Trello card is visible through a border of a table border
310
+ // This fixes a border issue caused by relative positioned table cells
311
+ &::after {
312
+ height: 100%;
313
+ content: '';
314
+ border-left: 1px solid ${tableBorderColor};
315
+ border-bottom: 1px solid ${tableBorderColor};
316
+ position: absolute;
317
+ right: 0px;
318
+ top: 0px;
319
+ bottom: 0;
320
+ width: 100%;
321
+ display: inline-block;
322
+ pointer-events: none;
323
+ }
324
+ }
325
+ }
326
+
327
+ .${ClassName.CONTROLS_FLOATING_BUTTON_COLUMN} {
328
+ ${insertColumnButtonWrapper()}
329
+ }
330
+
331
+ .${ClassName.CONTROLS_FLOATING_BUTTON_ROW} {
332
+ ${insertRowButtonWrapper()}
333
+ }
334
+
335
+ ${dragInsertButtonWrapper()}
336
+
337
+ ${dragCornerControlButton()}
351
338
 
352
339
  /* Delete button */
353
340
  ${DeleteButton()}
@@ -355,317 +342,311 @@ export const baseTableStyles = (props: { featureFlags?: FeatureFlags }) => css`
355
342
 
356
343
  /* sticky styles */
357
344
  .${ClassName.TABLE_STICKY} .${ClassName.NUMBERED_COLUMN} .${ClassName.NUMBERED_COLUMN_BUTTON}:first-of-type {
358
- margin-top: ${stickyRowOffsetTop + 2}px;
359
- width: ${akEditorTableNumberColumnWidth}px;
360
-
361
- position: fixed !important;
362
- z-index: ${akEditorStickyHeaderZIndex} !important;
363
- box-shadow: 0px -${stickyRowOffsetTop}px ${token('elevation.surface', 'white')};
364
- border-right: 0 none;
365
- /* top set by NumberColumn component */
366
- }
345
+ margin-top: ${stickyRowOffsetTop + 2}px;
346
+ width: ${akEditorTableNumberColumnWidth}px;
367
347
 
368
- .${ClassName.TABLE_STICKY} .${ClassName.CORNER_CONTROLS}.sticky {
369
- position: fixed !important;
370
- /* needs to be above row controls */
371
- z-index: ${akEditorSmallZIndex} !important;
372
- background: ${token('elevation.surface', 'white')};
348
+ position: fixed !important;
349
+ z-index: ${akEditorStickyHeaderZIndex} !important;
350
+ box-shadow: 0px -${stickyRowOffsetTop}px ${token('elevation.surface', 'white')};
351
+ border-right: 0 none;
352
+ /* top set by NumberColumn component */
353
+ }
373
354
 
374
- width: ${tableToolbarSize}px;
375
- height: ${tableToolbarSize}px;
376
- }
355
+ .${ClassName.TABLE_STICKY} .${ClassName.CORNER_CONTROLS}.sticky {
356
+ position: fixed !important;
357
+ /* needs to be above row controls */
358
+ z-index: ${akEditorSmallZIndex} !important;
359
+ background: ${token('elevation.surface', 'white')};
377
360
 
378
- .${ClassName.CORNER_CONTROLS}.sticky .${ClassName.CONTROLS_CORNER_BUTTON} {
379
- border-bottom: 0px none;
380
- border-right: 0px none;
361
+ width: ${tableToolbarSize}px;
362
+ height: ${tableToolbarSize}px;
363
+ }
381
364
 
382
- height: ${tableToolbarSize}px;
383
- width: ${tableToolbarSize}px;
384
- }
365
+ .${ClassName.CORNER_CONTROLS}.sticky .${ClassName.CONTROLS_CORNER_BUTTON} {
366
+ border-bottom: 0px none;
367
+ border-right: 0px none;
385
368
 
386
- ${tableStickyHeaderColumnControlsDecorationsStyle()}
369
+ height: ${tableToolbarSize}px;
370
+ width: ${tableToolbarSize}px;
371
+ }
387
372
 
388
- ${tableStickyHeaderFirefoxFixStyle()}
373
+ ${tableStickyHeaderColumnControlsDecorationsStyle()}
374
+
375
+ ${tableStickyHeaderFirefoxFixStyle()}
389
376
 
390
377
  .${ClassName.TABLE_STICKY}
391
378
  .${ClassName.ROW_CONTROLS}
392
379
  .${ClassName.ROW_CONTROLS_BUTTON_WRAP}.sticky {
393
- position: fixed !important;
394
- z-index: ${akEditorStickyHeaderZIndex} !important;
395
- display: flex;
396
- border-left: ${tableToolbarSize}px solid
397
- ${token('elevation.surface', 'white')};
398
- margin-left: -${tableToolbarSize}px;
399
- }
400
-
401
- .${ClassName.TABLE_STICKY} col:first-of-type {
402
- /* moving rows out of a table layout does weird things in Chrome */
403
- border-right: 1px solid ${token('elevation.surface', 'green')};
404
- }
405
-
406
- tr.sticky {
407
- padding-top: ${stickyRowOffsetTop}px;
408
- position: fixed;
409
- display: grid;
410
-
411
- /* to keep it above cell selection but below date and other nodes popups that are inside sticky header */
412
- z-index: ${akEditorTableCellOnStickyHeaderZIndex - 5};
413
-
414
- overflow-y: visible;
415
- overflow-x: hidden;
416
-
417
- grid-auto-flow: column;
418
-
419
- /* background for where controls apply */
420
- background: ${token('elevation.surface', 'white')};
421
- box-sizing: content-box;
422
-
423
- margin-top: 2px;
424
-
425
- box-shadow: 0 6px 4px -4px ${token('elevation.shadow.overflow.perimeter', N40A)};
426
- margin-left: -1px;
427
-
428
- &.no-pointer-events {
429
- pointer-events: none;
430
- }
431
- }
432
-
433
- .${ClassName.TABLE_STICKY} .${ClassName.TABLE_STICKY_SHADOW} {
434
- left: unset;
435
- position: fixed;
436
- /* needs to be above sticky header row and below date and other nodes popups that are inside sticky header */
437
- z-index: ${akEditorTableCellOnStickyHeaderZIndex};
438
- }
439
-
440
- .${ClassName.WITH_CONTROLS}.${ClassName.TABLE_STICKY}
441
- .${ClassName.TABLE_STICKY_SHADOW} {
442
- padding-bottom: ${tableToolbarSize}px;
443
- }
444
-
445
- tr.sticky th {
446
- border-bottom: ${stickyHeaderBorderBottomWidth}px solid ${tableBorderColor};
447
- margin-right: -1px;
448
- }
449
-
450
- .${ClassName.TABLE_STICKY} tr.sticky > th:last-child {
451
- border-right-width: 1px;
452
- }
453
-
454
- /* add left edge for first cell */
455
- .${ClassName.TABLE_STICKY} tr.sticky > th:first-of-type {
456
- margin-left: 0px;
457
- }
458
-
459
- /* add a little bit so the scroll lines up with the table */
460
- .${ClassName.TABLE_STICKY} tr.sticky::after {
461
- content: ' ';
462
- width: ${insertColumnButtonOffset + 1}px;
463
- }
464
-
465
- /* To fix jumpiness caused in Chrome Browsers for sticky headers */
466
- .${ClassName.TABLE_STICKY} .sticky + tr {
467
- min-height: 0px;
468
- }
469
-
470
- /* move resize line a little in sticky bar */
471
- .${ClassName.TABLE_CONTAINER}.${ClassName.TABLE_STICKY} {
472
- tr.sticky
473
- td.${ClassName.WITH_RESIZE_LINE},
474
- tr.sticky
475
- th.${ClassName.WITH_RESIZE_LINE} {
476
- .${ClassName.RESIZE_HANDLE_DECORATION}::after {
477
- right: ${(resizeHandlerAreaWidth - resizeLineWidth) / 2 + 1}px;
478
- }
479
- }
480
-
481
- /* when selected put it back to normal -- :not selector would be nicer */
482
- tr.sticky
483
- td.${ClassName.WITH_RESIZE_LINE}.${ClassName.SELECTED_CELL},
484
- tr.sticky
485
- th.${ClassName.WITH_RESIZE_LINE}.${ClassName.SELECTED_CELL} {
486
- .${ClassName.RESIZE_HANDLE_DECORATION}::after {
487
- right: ${(resizeHandlerAreaWidth - resizeLineWidth) / 2}px;
488
- }
489
- }
490
- }
491
-
492
- tr.sticky .${ClassName.HOVERED_CELL}, tr.sticky .${ClassName.SELECTED_CELL} {
493
- z-index: 1;
494
- }
495
-
496
- .${ClassName.WITH_CONTROLS} tr.sticky {
497
- padding-top: ${tableControlsSpacing}px;
498
- }
499
-
500
- .${ClassName.WITH_CONTROLS}.${ClassName.TABLE_STICKY}
501
- .${ClassName.NUMBERED_COLUMN}
502
- .${ClassName.NUMBERED_COLUMN_BUTTON}:first-of-type {
503
- margin-top: ${tableControlsSpacing + 2}px;
504
- }
505
-
506
- .${ClassName.CORNER_CONTROLS}.sticky {
507
- border-top: ${tableControlsSpacing - tableToolbarSize + 2}px solid
508
- ${token('elevation.surface', 'white')};
509
- }
510
-
511
- ${sentinelStyles}
512
- ${OverflowShadow(props.featureFlags?.tableDragAndDrop)}
380
+ position: fixed !important;
381
+ z-index: ${akEditorStickyHeaderZIndex} !important;
382
+ display: flex;
383
+ border-left: ${tableToolbarSize}px solid ${token('elevation.surface', 'white')};
384
+ margin-left: -${tableToolbarSize}px;
385
+ }
386
+
387
+ .${ClassName.TABLE_STICKY} col:first-of-type {
388
+ /* moving rows out of a table layout does weird things in Chrome */
389
+ border-right: 1px solid ${token('elevation.surface', 'green')};
390
+ }
391
+
392
+ tr.sticky {
393
+ padding-top: ${stickyRowOffsetTop}px;
394
+ position: fixed;
395
+ display: grid;
396
+
397
+ /* to keep it above cell selection but below date and other nodes popups that are inside sticky header */
398
+ z-index: ${akEditorTableCellOnStickyHeaderZIndex - 5};
399
+
400
+ overflow-y: visible;
401
+ overflow-x: hidden;
402
+
403
+ grid-auto-flow: column;
404
+
405
+ /* background for where controls apply */
406
+ background: ${token('elevation.surface', 'white')};
407
+ box-sizing: content-box;
408
+
409
+ margin-top: 2px;
410
+
411
+ box-shadow: 0 6px 4px -4px ${token('elevation.shadow.overflow.perimeter', N40A)};
412
+ margin-left: -1px;
413
+
414
+ &.no-pointer-events {
415
+ pointer-events: none;
416
+ }
417
+ }
418
+
419
+ .${ClassName.TABLE_STICKY} .${ClassName.TABLE_STICKY_SHADOW} {
420
+ left: unset;
421
+ position: fixed;
422
+ /* needs to be above sticky header row and below date and other nodes popups that are inside sticky header */
423
+ z-index: ${akEditorTableCellOnStickyHeaderZIndex};
424
+ }
425
+
426
+ .${ClassName.WITH_CONTROLS}.${ClassName.TABLE_STICKY} .${ClassName.TABLE_STICKY_SHADOW} {
427
+ padding-bottom: ${tableToolbarSize}px;
428
+ }
429
+
430
+ tr.sticky th {
431
+ border-bottom: ${stickyHeaderBorderBottomWidth}px solid ${tableBorderColor};
432
+ margin-right: -1px;
433
+ }
434
+
435
+ .${ClassName.TABLE_STICKY} tr.sticky > th:last-child {
436
+ border-right-width: 1px;
437
+ }
438
+
439
+ /* add left edge for first cell */
440
+ .${ClassName.TABLE_STICKY} tr.sticky > th:first-of-type {
441
+ margin-left: 0px;
442
+ }
443
+
444
+ /* add a little bit so the scroll lines up with the table */
445
+ .${ClassName.TABLE_STICKY} tr.sticky::after {
446
+ content: ' ';
447
+ width: ${insertColumnButtonOffset + 1}px;
448
+ }
449
+
450
+ /* To fix jumpiness caused in Chrome Browsers for sticky headers */
451
+ .${ClassName.TABLE_STICKY} .sticky + tr {
452
+ min-height: 0px;
453
+ }
454
+
455
+ /* move resize line a little in sticky bar */
456
+ .${ClassName.TABLE_CONTAINER}.${ClassName.TABLE_STICKY} {
457
+ tr.sticky td.${ClassName.WITH_RESIZE_LINE}, tr.sticky th.${ClassName.WITH_RESIZE_LINE} {
458
+ .${ClassName.RESIZE_HANDLE_DECORATION}::after {
459
+ right: ${(resizeHandlerAreaWidth - resizeLineWidth) / 2 + 1}px;
460
+ }
461
+ }
462
+
463
+ /* when selected put it back to normal -- :not selector would be nicer */
464
+ tr.sticky
465
+ td.${ClassName.WITH_RESIZE_LINE}.${ClassName.SELECTED_CELL},
466
+ tr.sticky
467
+ th.${ClassName.WITH_RESIZE_LINE}.${ClassName.SELECTED_CELL} {
468
+ .${ClassName.RESIZE_HANDLE_DECORATION}::after {
469
+ right: ${(resizeHandlerAreaWidth - resizeLineWidth) / 2}px;
470
+ }
471
+ }
472
+ }
473
+
474
+ tr.sticky .${ClassName.HOVERED_CELL}, tr.sticky .${ClassName.SELECTED_CELL} {
475
+ z-index: 1;
476
+ }
477
+
478
+ .${ClassName.WITH_CONTROLS} tr.sticky {
479
+ padding-top: ${tableControlsSpacing}px;
480
+ }
481
+
482
+ .${ClassName.WITH_CONTROLS}.${ClassName.TABLE_STICKY}
483
+ .${ClassName.NUMBERED_COLUMN}
484
+ .${ClassName.NUMBERED_COLUMN_BUTTON}:first-of-type {
485
+ margin-top: ${tableControlsSpacing + 2}px;
486
+ }
487
+
488
+ .${ClassName.CORNER_CONTROLS}.sticky {
489
+ border-top: ${tableControlsSpacing - tableToolbarSize + 2}px solid
490
+ ${token('elevation.surface', 'white')};
491
+ }
492
+
493
+ ${sentinelStyles}
494
+ ${OverflowShadow(props.featureFlags?.tableDragAndDrop)}
513
495
  ${stickyScrollbarStyles(props.featureFlags)}
514
496
 
515
497
  .${ClassName.TABLE_STICKY} .${ClassName.TABLE_STICKY_SHADOW} {
516
- height: 0; // stop overflow flash & set correct height in update-overflow-shadows.ts
517
- }
518
-
519
- .less-padding {
520
- padding: 0 ${tablePadding}px;
521
-
522
- .${ClassName.DRAG_ROW_CONTROLS_WRAPPER},
523
- .${ClassName.ROW_CONTROLS_WRAPPER} {
524
- padding: 0 ${tablePadding}px;
525
-
526
- // https://product-fabric.atlassian.net/browse/ED-16386
527
- // Fixes issue where the extra padding that is added here throws off the position
528
- // of the rows control dot
529
- &::after {
530
- right: 6px !important;
531
- }
532
- }
533
-
534
- .${ClassName.DRAG_COLUMN_CONTROLS_WRAPPER} {
535
- padding: 0 ${tablePadding}px;
536
- }
537
-
538
- &.${ClassName.TABLE_CONTAINER}[data-number-column='true'] {
539
- padding-left: ${akEditorTableNumberColumnWidth + tablePadding - 1}px;
540
- }
541
- .${ClassName.TABLE_LEFT_SHADOW}, .${ClassName.TABLE_RIGHT_SHADOW} {
542
- width: ${tableOverflowShadowWidth}px;
543
- }
544
-
545
- .${ClassName.TABLE_LEFT_SHADOW} {
546
- left: 6px;
547
- }
548
-
549
- .${ClassName.TABLE_RIGHT_SHADOW} {
550
- left: calc(100% - 6px);
551
- }
552
- }
553
-
554
- > .${ClassName.NODEVIEW_WRAPPER} {
555
- /**
498
+ height: 0; // stop overflow flash & set correct height in update-overflow-shadows.ts
499
+ }
500
+
501
+ .less-padding {
502
+ padding: 0 ${tablePadding}px;
503
+
504
+ .${ClassName.DRAG_ROW_CONTROLS_WRAPPER}, .${ClassName.ROW_CONTROLS_WRAPPER} {
505
+ padding: 0 ${tablePadding}px;
506
+
507
+ // https://product-fabric.atlassian.net/browse/ED-16386
508
+ // Fixes issue where the extra padding that is added here throws off the position
509
+ // of the rows control dot
510
+ &::after {
511
+ right: 6px !important;
512
+ }
513
+ }
514
+
515
+ .${ClassName.DRAG_COLUMN_CONTROLS_WRAPPER} {
516
+ padding: 0 ${tablePadding}px;
517
+ }
518
+
519
+ &.${ClassName.TABLE_CONTAINER}[data-number-column='true'] {
520
+ padding-left: ${akEditorTableNumberColumnWidth + tablePadding - 1}px;
521
+ }
522
+ .${ClassName.TABLE_LEFT_SHADOW}, .${ClassName.TABLE_RIGHT_SHADOW} {
523
+ width: ${tableOverflowShadowWidth}px;
524
+ }
525
+
526
+ .${ClassName.TABLE_LEFT_SHADOW} {
527
+ left: 6px;
528
+ }
529
+
530
+ .${ClassName.TABLE_RIGHT_SHADOW} {
531
+ left: calc(100% - 6px);
532
+ }
533
+ }
534
+
535
+ > .${ClassName.NODEVIEW_WRAPPER} {
536
+ /**
556
537
  * Prevent margins collapsing, aids with placing the gap-cursor correctly
557
538
  * @see https://developer.mozilla.org/en-US/docs/Web/CSS/CSS_Box_Model/Mastering_margin_collapsing
558
539
  *
559
540
  * TODO: Enable this, many tests will fail!
560
541
  * border-top: 1px solid transparent;
561
542
  */
562
- }
543
+ }
563
544
 
564
- /* Breakout only works on top level unless wrapped in fragment mark */
565
- ${breakoutWidthStyling()}
545
+ /* Breakout only works on top level unless wrapped in fragment mark */
546
+ ${breakoutWidthStyling()}
566
547
 
567
- ${columnControlsDecoration()};
568
- ${rowControlsWrapperDotStyle()};
548
+ ${columnControlsDecoration()};
549
+ ${rowControlsWrapperDotStyle()};
569
550
 
570
- /* Corner controls */
571
- .${ClassName.CORNER_CONTROLS} {
572
- width: ${tableToolbarSize + 1}px;
573
- height: ${cornerControlHeight}px;
574
- display: none;
551
+ /* Corner controls */
552
+ .${ClassName.CORNER_CONTROLS} {
553
+ width: ${tableToolbarSize + 1}px;
554
+ height: ${cornerControlHeight}px;
555
+ display: none;
575
556
 
576
- .${ClassName.CORNER_CONTROLS_INSERT_ROW_MARKER} {
577
- position: relative;
557
+ .${ClassName.CORNER_CONTROLS_INSERT_ROW_MARKER} {
558
+ position: relative;
578
559
 
579
- ${InsertMarker(
580
- `
560
+ ${InsertMarker(
561
+ `
581
562
  left: -11px;
582
563
  top: 9px;
583
564
  `,
584
- )};
585
- }
586
- }
587
-
588
- .${ClassName.CORNER_CONTROLS}.sticky {
589
- .${ClassName.CORNER_CONTROLS_INSERT_ROW_MARKER} {
590
- /* sticky row insert dot overlaps other row insert and messes things up */
591
- display: none !important;
592
- }
593
- }
594
-
595
- .${ClassName.CONTROLS_CORNER_BUTTON} {
596
- position: absolute;
597
- top: 0;
598
- width: ${tableToolbarSize + 1}px;
599
- height: ${tableToolbarSize + 1}px;
600
- border: 1px solid ${tableBorderColor};
601
- border-radius: 0;
602
- border-top-left-radius: ${tableBorderRadiusSize}px;
603
- background: ${tableHeaderCellBackgroundColor};
604
- box-sizing: border-box;
605
- padding: 0;
606
- :focus {
607
- outline: none;
608
- }
609
- }
610
- .active .${ClassName.CONTROLS_CORNER_BUTTON} {
611
- border-color: ${tableBorderSelectedColor};
612
- background: ${tableToolbarSelectedColor};
613
- }
614
-
615
- .${ClassName.TABLE_CONTAINER}[data-number-column='true'] {
616
- .${ClassName.CORNER_CONTROLS}, .${ClassName.CONTROLS_CORNER_BUTTON} {
617
- width: ${akEditorTableToolbarSize + akEditorTableNumberColumnWidth + 1}px;
618
- }
619
- .${ClassName.ROW_CONTROLS} .${ClassName.CONTROLS_BUTTON} {
620
- border-right-width: 0;
621
- }
622
- }
623
-
624
- :not(.${ClassName.IS_RESIZING}) .${ClassName.CONTROLS_CORNER_BUTTON}:hover {
625
- border-color: ${tableBorderSelectedColor};
626
- background: ${tableToolbarSelectedColor};
627
- cursor: pointer;
628
- }
629
-
630
- :not(.${ClassName.IS_RESIZING})
631
- .${ClassName.CONTROLS_CORNER_BUTTON}.${ClassName.HOVERED_CELL_IN_DANGER} {
632
- border-color: ${tableBorderDeleteColor};
633
- background: ${tableToolbarDeleteColor};
634
- }
635
-
636
- /* Row controls */
637
- .${ClassName.ROW_CONTROLS} {
638
- width: ${tableToolbarSize}px;
639
- box-sizing: border-box;
640
- display: none;
641
- position: relative;
642
-
643
- ${InsertMarker(
644
- `
565
+ )};
566
+ }
567
+ }
568
+
569
+ .${ClassName.CORNER_CONTROLS}.sticky {
570
+ .${ClassName.CORNER_CONTROLS_INSERT_ROW_MARKER} {
571
+ /* sticky row insert dot overlaps other row insert and messes things up */
572
+ display: none !important;
573
+ }
574
+ }
575
+
576
+ .${ClassName.CONTROLS_CORNER_BUTTON} {
577
+ position: absolute;
578
+ top: 0;
579
+ width: ${tableToolbarSize + 1}px;
580
+ height: ${tableToolbarSize + 1}px;
581
+ border: 1px solid ${tableBorderColor};
582
+ border-radius: 0;
583
+ border-top-left-radius: ${tableBorderRadiusSize}px;
584
+ background: ${tableHeaderCellBackgroundColor};
585
+ box-sizing: border-box;
586
+ padding: 0;
587
+ :focus {
588
+ outline: none;
589
+ }
590
+ }
591
+ .active .${ClassName.CONTROLS_CORNER_BUTTON} {
592
+ border-color: ${tableBorderSelectedColor};
593
+ background: ${tableToolbarSelectedColor};
594
+ }
595
+
596
+ .${ClassName.TABLE_CONTAINER}[data-number-column='true'] {
597
+ .${ClassName.CORNER_CONTROLS}, .${ClassName.CONTROLS_CORNER_BUTTON} {
598
+ width: ${akEditorTableToolbarSize + akEditorTableNumberColumnWidth + 1}px;
599
+ }
600
+ .${ClassName.ROW_CONTROLS} .${ClassName.CONTROLS_BUTTON} {
601
+ border-right-width: 0;
602
+ }
603
+ }
604
+
605
+ :not(.${ClassName.IS_RESIZING}) .${ClassName.CONTROLS_CORNER_BUTTON}:hover {
606
+ border-color: ${tableBorderSelectedColor};
607
+ background: ${tableToolbarSelectedColor};
608
+ cursor: pointer;
609
+ }
610
+
611
+ :not(.${ClassName.IS_RESIZING})
612
+ .${ClassName.CONTROLS_CORNER_BUTTON}.${ClassName.HOVERED_CELL_IN_DANGER} {
613
+ border-color: ${tableBorderDeleteColor};
614
+ background: ${tableToolbarDeleteColor};
615
+ }
616
+
617
+ /* Row controls */
618
+ .${ClassName.ROW_CONTROLS} {
619
+ width: ${tableToolbarSize}px;
620
+ box-sizing: border-box;
621
+ display: none;
622
+ position: relative;
623
+
624
+ ${InsertMarker(
625
+ `
645
626
  bottom: -1px;
646
627
  left: -11px;
647
628
  `,
648
- )};
649
-
650
- .${ClassName.ROW_CONTROLS_INNER} {
651
- display: flex;
652
- flex-direction: column;
653
- }
654
- .${ClassName.ROW_CONTROLS_BUTTON_WRAP}:last-child > button {
655
- border-bottom-left-radius: ${tableBorderRadiusSize}px;
656
- }
657
- .${ClassName.ROW_CONTROLS_BUTTON_WRAP} {
658
- position: relative;
659
- margin-top: -1px;
660
- }
661
- .${ClassName.ROW_CONTROLS_BUTTON_WRAP}:hover,
662
- .${ClassName.ROW_CONTROLS_BUTTON_WRAP}.active,
663
- .${ClassName.CONTROLS_BUTTON}:hover {
664
- z-index: ${akEditorUnitZIndex};
665
- }
666
-
667
- ${HeaderButton(
668
- `
629
+ )};
630
+
631
+ .${ClassName.ROW_CONTROLS_INNER} {
632
+ display: flex;
633
+ flex-direction: column;
634
+ }
635
+ .${ClassName.ROW_CONTROLS_BUTTON_WRAP}:last-child > button {
636
+ border-bottom-left-radius: ${tableBorderRadiusSize}px;
637
+ }
638
+ .${ClassName.ROW_CONTROLS_BUTTON_WRAP} {
639
+ position: relative;
640
+ margin-top: -1px;
641
+ }
642
+ .${ClassName.ROW_CONTROLS_BUTTON_WRAP}:hover,
643
+ .${ClassName.ROW_CONTROLS_BUTTON_WRAP}.active,
644
+ .${ClassName.CONTROLS_BUTTON}:hover {
645
+ z-index: ${akEditorUnitZIndex};
646
+ }
647
+
648
+ ${HeaderButton(
649
+ `
669
650
  border-bottom: 1px solid ${tableBorderColor};
670
651
  border-right: 0px;
671
652
  border-radius: 0;
@@ -683,450 +664,437 @@ export const baseTableStyles = (props: { featureFlags?: FeatureFlags }) => css`
683
664
  top: 0;
684
665
  }
685
666
  `,
686
- )}
687
- }
688
-
689
- .${ClassName.DRAG_ROW_CONTROLS} {
690
- display: grid;
691
- align-items: center;
692
- position: absolute;
693
- z-index: ${akEditorUnitZIndex};
694
-
695
- .${ClassName.DRAG_ROW_FLOATING_INSERT_DOT_WRAPPER} {
696
- position: absolute;
697
- align-self: end;
698
- height: 100%;
699
- width: 18px;
700
- }
701
-
702
- .${ClassName.DRAG_ROW_FLOATING_INSERT_DOT} {
703
- position: absolute;
704
- bottom: -3px;
705
- left: 2px;
706
- background-color: ${token(
707
- 'color.background.accent.gray.subtler',
708
- '#C1C7D0',
709
- )};
710
- height: 4px;
711
- width: 4px;
712
- border-radius: 50%;
713
- pointer-events: none;
714
- }
715
- }
716
-
717
- .${ClassName.DRAG_COLUMN_CONTROLS} {
718
- .${ClassName.DRAG_COLUMN_CONTROLS_INNER} {
719
- height: 24px;
720
- position: absolute;
721
- top: ${token('space.negative.150', '-12px')};
722
- z-index: ${resizeHandlerZIndex};
723
- }
724
-
725
- .${ClassName.DRAG_COLUMN_FLOATING_INSERT_DOT_WRAPPER} {
726
- position: absolute;
727
- height: 24px;
728
- width: 100%;
729
- }
730
-
731
- .${ClassName.DRAG_COLUMN_FLOATING_INSERT_DOT} {
732
- background-color: ${token(
733
- 'color.background.accent.gray.subtler',
734
- '#C1C7D0',
735
- )};
736
- height: 4px;
737
- width: 4px;
738
- border-radius: 50%;
739
- position: absolute;
740
- right: -2px;
741
- }
742
- }
743
-
744
- .${ClassName.DRAG_HANDLE_BUTTON_CLICKABLE_ZONE} {
745
- background: none;
746
- border: none;
747
- outline: none;
748
- position: absolute;
749
- margin: 0;
750
- padding: 0;
751
- display: flex;
752
- align-items: center;
753
- cursor: pointer;
754
-
755
- :focus {
756
- outline: none;
757
- }
758
- }
759
-
760
- .${ClassName.DRAG_HANDLE_BUTTON_CONTAINER} {
761
- cursor: grab;
762
- pointer-events: auto;
763
-
764
- line-height: 0;
765
- padding: 0;
766
- border-radius: 6px;
767
- width: max-content;
768
- border: 2px solid ${token('elevation.surface', N0)};
769
-
770
- display: flex;
771
- justify-content: center;
772
- align-items: center;
773
- background: transparent;
774
- outline: none;
775
-
776
- &.placeholder {
777
- background-color: transparent;
778
- border: 2px solid transparent;
779
- }
780
-
781
- &.${ClassName.DRAG_HANDLE_DISABLED} {
782
- cursor: pointer;
783
- & svg {
784
- & > rect.${ClassName.DRAG_HANDLE_MINIMISED} {
785
- fill: ${token('color.background.accent.gray.subtler', '#DCDFE4')};
786
- }
787
- & > rect {
788
- fill: ${token('color.background.accent.gray.subtlest', '#F4F5F7')};
789
- }
790
- & > g > rect {
791
- fill: ${token('color.icon.disabled', '#BFDBF847')};
792
- }
793
- }
794
- }
795
-
796
- &:not(.${ClassName.DRAG_HANDLE_DISABLED}) {
797
- & svg {
798
- rect {
799
- fill: ${token('color.background.accent.gray.subtler', '#DCDFE4')};
800
- }
801
- g {
802
- fill: ${token('color.icon.subtle', '#626f86')};
803
- }
804
- }
805
-
806
- &:hover {
807
- svg {
808
- rect {
809
- fill: ${token('color.background.accent.blue.subtle', '#579DFF')};
810
- }
811
- g {
812
- fill: ${token('color.icon.inverse', '#FFF')};
813
- }
814
- }
815
- }
816
-
817
- &:active {
818
- cursor: grabbing;
819
- }
820
-
821
- &.selected {
822
- :focus {
823
- outline: 2px solid ${token('color.border.focused', '#2684FF')};
824
- outline-offset: 1px;
825
- }
826
-
827
- &:active {
828
- outline: none;
829
- }
830
-
831
- svg {
832
- rect {
833
- fill: ${token('color.background.accent.blue.subtle', '#579dff')};
834
- }
835
- g {
836
- fill: ${token('color.icon.inverse', '#fff')};
837
- }
838
- }
839
- }
840
-
841
- &.danger {
842
- svg {
843
- rect {
844
- fill: ${token(
845
- 'color.background.accent.red.subtler.pressed',
846
- '#F87462',
847
- )};
848
- }
849
- g {
850
- fill: ${token('color.border.inverse', '#FFF')};
851
- }
852
- }
853
- }
854
- }
855
- }
856
-
857
- ${floatingColumnControls()}
858
-
859
- :not(.${ClassName.IS_RESIZING}) .${ClassName.ROW_CONTROLS} {
860
- ${HeaderButtonHover()}
861
- ${HeaderButtonDanger()}
862
- }
863
-
864
- /* Numbered column */
865
- .${ClassName.NUMBERED_COLUMN} {
866
- position: relative;
867
- float: right;
868
- margin-left: ${akEditorTableToolbarSize}px;
869
- top: ${props.featureFlags?.tableDragAndDrop
870
- ? 0
871
- : akEditorTableToolbarSize}px;
872
- width: ${akEditorTableNumberColumnWidth + 1}px;
873
- box-sizing: border-box;
874
- }
875
-
876
- .${ClassName.NUMBERED_COLUMN_BUTTON} {
877
- border: 1px solid ${tableBorderColor};
878
- box-sizing: border-box;
879
- margin-top: -1px;
880
- padding-bottom: 2px;
881
- padding: 10px 2px;
882
- text-align: center;
883
- font-size: ${relativeFontSizeToBase16(fontSize())};
884
- background-color: ${tableHeaderCellBackgroundColor};
885
- color: ${tableTextColor};
886
- border-color: ${tableBorderColor};
887
-
888
- :first-child:not(style),
889
- style:first-child + * {
890
- margin-top: 0;
891
- }
892
- :last-child {
893
- border-bottom: 1px solid ${tableBorderColor};
894
- }
895
- }
896
-
897
- // add a background above the first numbered column cell when sticky header is engaged
898
- // which hides the table when scrolling
899
- .${ClassName.TABLE_STICKY} {
900
- .${ClassName.NUMBERED_COLUMN_BUTTON_DISABLED}:first-of-type::after {
901
- content: '';
902
- display: block;
903
- height: 33px;
904
- width: 100%;
905
- background-color: ${token('elevation.surface', 'white')};
906
- position: absolute;
907
-
908
- // the extra pixel is accounting for borders
909
- top: -34px;
910
- left: -1px;
911
- }
912
- }
913
-
914
- .${ClassName.WITH_CONTROLS} {
915
- .${ClassName.CORNER_CONTROLS}, .${ClassName.ROW_CONTROLS} {
916
- display: block;
917
- }
918
- .${ClassName.NUMBERED_COLUMN} {
919
- padding-left: 0px;
920
-
921
- .${ClassName.NUMBERED_COLUMN_BUTTON} {
922
- border-left: 0 none;
923
- }
924
-
925
- .${ClassName.NUMBERED_COLUMN_BUTTON}.active {
926
- border-bottom: 1px solid ${tableBorderSelectedColor};
927
- border-color: ${tableBorderSelectedColor};
928
- background-color: ${tableToolbarSelectedColor};
929
- position: relative;
930
- z-index: ${akEditorUnitZIndex};
931
- color: ${token('color.text.selected', N0)};
932
- }
933
- }
934
- }
935
- :not(.${ClassName.IS_RESIZING}) .${ClassName.WITH_CONTROLS} {
936
- .${ClassName.NUMBERED_COLUMN_BUTTON}:not(.${ClassName.NUMBERED_COLUMN_BUTTON_DISABLED}) {
937
- cursor: pointer;
938
- }
939
- .${ClassName.NUMBERED_COLUMN_BUTTON}:not(.${ClassName.NUMBERED_COLUMN_BUTTON_DISABLED}):hover {
940
- border-bottom: 1px solid ${tableBorderSelectedColor};
941
- border-color: ${tableBorderSelectedColor};
942
- background-color: ${tableToolbarSelectedColor};
943
- position: relative;
944
- z-index: ${akEditorUnitZIndex};
945
- color: ${token('color.text.selected', N0)};
946
- }
947
- .${ClassName.NUMBERED_COLUMN_BUTTON}.${ClassName.HOVERED_CELL_IN_DANGER} {
948
- background-color: ${tableToolbarDeleteColor};
949
- border: 1px solid ${tableBorderDeleteColor};
950
- border-left: 0;
951
- color: ${token('color.text.danger', R500)};
952
- position: relative;
953
- z-index: ${akEditorUnitZIndex};
954
- }
955
- }
956
-
957
- /* Table */
958
- .${ClassName.TABLE_NODE_WRAPPER} > table {
959
- table-layout: fixed;
960
- white-space: normal;
961
- border-top: none;
962
- // 1px border width offset added here to prevent unwanted overflow and scolling - ED-16212
963
- margin-right: -1px;
964
- // Allows better positioning for the shadow sentinels - ED-16668
965
- position: relative;
966
-
967
- > tbody > tr {
968
- white-space: pre-wrap;
969
- }
970
-
971
- .${ClassName.COLUMN_CONTROLS_DECORATIONS} + * {
972
- margin-top: 0;
973
- }
974
-
975
- /*
667
+ )}
668
+ }
669
+
670
+ .${ClassName.DRAG_ROW_CONTROLS} {
671
+ display: grid;
672
+ align-items: center;
673
+ position: absolute;
674
+ z-index: ${akEditorUnitZIndex};
675
+
676
+ .${ClassName.DRAG_ROW_FLOATING_INSERT_DOT_WRAPPER} {
677
+ position: absolute;
678
+ align-self: end;
679
+ height: 100%;
680
+ width: 18px;
681
+ }
682
+
683
+ .${ClassName.DRAG_ROW_FLOATING_INSERT_DOT} {
684
+ position: absolute;
685
+ bottom: -3px;
686
+ left: 2px;
687
+ background-color: ${token('color.background.accent.gray.subtler', '#C1C7D0')};
688
+ height: 4px;
689
+ width: 4px;
690
+ border-radius: 50%;
691
+ pointer-events: none;
692
+ }
693
+ }
694
+
695
+ .${ClassName.DRAG_COLUMN_CONTROLS} {
696
+ .${ClassName.DRAG_COLUMN_CONTROLS_INNER} {
697
+ height: 24px;
698
+ position: absolute;
699
+ top: ${token('space.negative.150', '-12px')};
700
+ z-index: ${resizeHandlerZIndex};
701
+ }
702
+
703
+ .${ClassName.DRAG_COLUMN_FLOATING_INSERT_DOT_WRAPPER} {
704
+ position: absolute;
705
+ height: 24px;
706
+ width: 100%;
707
+ }
708
+
709
+ .${ClassName.DRAG_COLUMN_FLOATING_INSERT_DOT} {
710
+ background-color: ${token('color.background.accent.gray.subtler', '#C1C7D0')};
711
+ height: 4px;
712
+ width: 4px;
713
+ border-radius: 50%;
714
+ position: absolute;
715
+ right: -2px;
716
+ }
717
+ }
718
+
719
+ .${ClassName.DRAG_HANDLE_BUTTON_CLICKABLE_ZONE} {
720
+ background: none;
721
+ border: none;
722
+ outline: none;
723
+ position: absolute;
724
+ margin: 0;
725
+ padding: 0;
726
+ display: flex;
727
+ align-items: center;
728
+ cursor: pointer;
729
+
730
+ :focus {
731
+ outline: none;
732
+ }
733
+ }
734
+
735
+ .${ClassName.DRAG_HANDLE_BUTTON_CONTAINER} {
736
+ cursor: grab;
737
+ pointer-events: auto;
738
+
739
+ line-height: 0;
740
+ padding: 0;
741
+ border-radius: 6px;
742
+ width: max-content;
743
+ border: 2px solid ${token('elevation.surface', N0)};
744
+
745
+ display: flex;
746
+ justify-content: center;
747
+ align-items: center;
748
+ background: transparent;
749
+ outline: none;
750
+
751
+ &.placeholder {
752
+ background-color: transparent;
753
+ border: 2px solid transparent;
754
+ }
755
+
756
+ &.${ClassName.DRAG_HANDLE_DISABLED} {
757
+ cursor: pointer;
758
+ & svg {
759
+ & > rect.${ClassName.DRAG_HANDLE_MINIMISED} {
760
+ fill: ${token('color.background.accent.gray.subtler', '#DCDFE4')};
761
+ }
762
+ & > rect {
763
+ fill: ${token('color.background.accent.gray.subtlest', '#F4F5F7')};
764
+ }
765
+ & > g > rect {
766
+ fill: ${token('color.icon.disabled', '#BFDBF847')};
767
+ }
768
+ }
769
+ }
770
+
771
+ &:not(.${ClassName.DRAG_HANDLE_DISABLED}) {
772
+ & svg {
773
+ rect {
774
+ fill: ${token('color.background.accent.gray.subtler', '#DCDFE4')};
775
+ }
776
+ g {
777
+ fill: ${token('color.icon.subtle', '#626f86')};
778
+ }
779
+ }
780
+
781
+ &:hover {
782
+ svg {
783
+ rect {
784
+ fill: ${token('color.background.accent.blue.subtle', '#579DFF')};
785
+ }
786
+ g {
787
+ fill: ${token('color.icon.inverse', '#FFF')};
788
+ }
789
+ }
790
+ }
791
+
792
+ &:active {
793
+ cursor: grabbing;
794
+ }
795
+
796
+ &.selected {
797
+ :focus {
798
+ outline: 2px solid ${token('color.border.focused', '#2684FF')};
799
+ outline-offset: 1px;
800
+ }
801
+
802
+ &:active {
803
+ outline: none;
804
+ }
805
+
806
+ svg {
807
+ rect {
808
+ fill: ${token('color.background.accent.blue.subtle', '#579dff')};
809
+ }
810
+ g {
811
+ fill: ${token('color.icon.inverse', '#fff')};
812
+ }
813
+ }
814
+ }
815
+
816
+ &.danger {
817
+ svg {
818
+ rect {
819
+ fill: ${token('color.background.accent.red.subtler.pressed', '#F87462')};
820
+ }
821
+ g {
822
+ fill: ${token('color.border.inverse', '#FFF')};
823
+ }
824
+ }
825
+ }
826
+ }
827
+ }
828
+
829
+ ${floatingColumnControls()}
830
+
831
+ :not(.${ClassName.IS_RESIZING}) .${ClassName.ROW_CONTROLS} {
832
+ ${HeaderButtonHover()}
833
+ ${HeaderButtonDanger()}
834
+ }
835
+
836
+ /* Numbered column */
837
+ .${ClassName.NUMBERED_COLUMN} {
838
+ position: relative;
839
+ float: right;
840
+ margin-left: ${akEditorTableToolbarSize}px;
841
+ top: ${props.featureFlags?.tableDragAndDrop ? 0 : akEditorTableToolbarSize}px;
842
+ width: ${akEditorTableNumberColumnWidth + 1}px;
843
+ box-sizing: border-box;
844
+ }
845
+
846
+ .${ClassName.NUMBERED_COLUMN_BUTTON} {
847
+ border: 1px solid ${tableBorderColor};
848
+ box-sizing: border-box;
849
+ margin-top: -1px;
850
+ padding-bottom: 2px;
851
+ padding: 10px 2px;
852
+ text-align: center;
853
+ font-size: ${relativeFontSizeToBase16(fontSize())};
854
+ background-color: ${tableHeaderCellBackgroundColor};
855
+ color: ${tableTextColor};
856
+ border-color: ${tableBorderColor};
857
+
858
+ :first-child:not(style),
859
+ style:first-child + * {
860
+ margin-top: 0;
861
+ }
862
+ :last-child {
863
+ border-bottom: 1px solid ${tableBorderColor};
864
+ }
865
+ }
866
+
867
+ // add a background above the first numbered column cell when sticky header is engaged
868
+ // which hides the table when scrolling
869
+ .${ClassName.TABLE_STICKY} {
870
+ .${ClassName.NUMBERED_COLUMN_BUTTON_DISABLED}:first-of-type::after {
871
+ content: '';
872
+ display: block;
873
+ height: 33px;
874
+ width: 100%;
875
+ background-color: ${token('elevation.surface', 'white')};
876
+ position: absolute;
877
+
878
+ // the extra pixel is accounting for borders
879
+ top: -34px;
880
+ left: -1px;
881
+ }
882
+ }
883
+
884
+ .${ClassName.WITH_CONTROLS} {
885
+ .${ClassName.CORNER_CONTROLS}, .${ClassName.ROW_CONTROLS} {
886
+ display: block;
887
+ }
888
+ .${ClassName.NUMBERED_COLUMN} {
889
+ padding-left: 0px;
890
+
891
+ .${ClassName.NUMBERED_COLUMN_BUTTON} {
892
+ border-left: 0 none;
893
+ }
894
+
895
+ .${ClassName.NUMBERED_COLUMN_BUTTON}.active {
896
+ border-bottom: 1px solid ${tableBorderSelectedColor};
897
+ border-color: ${tableBorderSelectedColor};
898
+ background-color: ${tableToolbarSelectedColor};
899
+ position: relative;
900
+ z-index: ${akEditorUnitZIndex};
901
+ color: ${token('color.text.selected', N0)};
902
+ }
903
+ }
904
+ }
905
+ :not(.${ClassName.IS_RESIZING}) .${ClassName.WITH_CONTROLS} {
906
+ .${ClassName.NUMBERED_COLUMN_BUTTON}:not(.${ClassName.NUMBERED_COLUMN_BUTTON_DISABLED}) {
907
+ cursor: pointer;
908
+ }
909
+ .${ClassName.NUMBERED_COLUMN_BUTTON}:not(.${ClassName.NUMBERED_COLUMN_BUTTON_DISABLED}):hover {
910
+ border-bottom: 1px solid ${tableBorderSelectedColor};
911
+ border-color: ${tableBorderSelectedColor};
912
+ background-color: ${tableToolbarSelectedColor};
913
+ position: relative;
914
+ z-index: ${akEditorUnitZIndex};
915
+ color: ${token('color.text.selected', N0)};
916
+ }
917
+ .${ClassName.NUMBERED_COLUMN_BUTTON}.${ClassName.HOVERED_CELL_IN_DANGER} {
918
+ background-color: ${tableToolbarDeleteColor};
919
+ border: 1px solid ${tableBorderDeleteColor};
920
+ border-left: 0;
921
+ color: ${token('color.text.danger', R500)};
922
+ position: relative;
923
+ z-index: ${akEditorUnitZIndex};
924
+ }
925
+ }
926
+
927
+ /* Table */
928
+ .${ClassName.TABLE_NODE_WRAPPER} > table {
929
+ table-layout: fixed;
930
+ white-space: normal;
931
+ border-top: none;
932
+ // 1px border width offset added here to prevent unwanted overflow and scolling - ED-16212
933
+ margin-right: -1px;
934
+ // Allows better positioning for the shadow sentinels - ED-16668
935
+ position: relative;
936
+
937
+ > tbody > tr {
938
+ white-space: pre-wrap;
939
+ }
940
+
941
+ .${ClassName.COLUMN_CONTROLS_DECORATIONS} + * {
942
+ margin-top: 0;
943
+ }
944
+
945
+ /*
976
946
  * Headings have a top margin by default, but we don't want this on the
977
947
  * first heading within table header cells.
978
948
  *
979
949
  * This specifically sets margin-top for the first heading within a header
980
950
  * cell when center/right aligned.
981
951
  */
982
- th.${ClassName.TABLE_HEADER_CELL} > .fabric-editor-block-mark {
983
- > h1:first-of-type,
984
- > h2:first-of-type,
985
- > h3:first-of-type,
986
- > h4:first-of-type,
987
- > h5:first-of-type,
988
- > h6:first-of-type {
989
- margin-top: 0;
990
- }
991
- }
992
-
993
- .${ClassName.SELECTED_CELL}, .${ClassName.HOVERED_CELL_IN_DANGER} {
994
- position: relative;
995
- }
996
- /* Give selected cells a blue overlay */
997
- .${ClassName.SELECTED_CELL}::after,
998
- .${ClassName.HOVERED_CELL_IN_DANGER}::after {
999
- z-index: ${akEditorSmallZIndex};
1000
- position: absolute;
1001
- content: '';
1002
- left: 0;
1003
- right: 0;
1004
- top: 0;
1005
- bottom: 0;
1006
- width: 100%;
1007
- pointer-events: none;
1008
- }
1009
- .${ClassName.SELECTED_CELL} {
1010
- border: 1px solid ${tableBorderSelectedColor};
1011
- }
1012
- .${ClassName.SELECTED_CELL}::after {
1013
- background: ${tableCellSelectedColor};
1014
- z-index: ${akEditorSmallZIndex};
1015
- }
1016
- th.${ClassName.HOVERED_CELL_IN_DANGER}::after,
1017
- td.${ClassName.HOVERED_CELL_IN_DANGER}::after {
1018
- background: ${tableCellDeleteColor};
1019
- z-index: ${akEditorUnitZIndex * 100};
1020
- }
1021
- // ED-15246: Trello card is visible through a border of a table border
1022
- /* ED-19064: To fix when enable header column in the table,
952
+ th.${ClassName.TABLE_HEADER_CELL} > .fabric-editor-block-mark {
953
+ > h1:first-of-type,
954
+ > h2:first-of-type,
955
+ > h3:first-of-type,
956
+ > h4:first-of-type,
957
+ > h5:first-of-type,
958
+ > h6:first-of-type {
959
+ margin-top: 0;
960
+ }
961
+ }
962
+
963
+ .${ClassName.SELECTED_CELL}, .${ClassName.HOVERED_CELL_IN_DANGER} {
964
+ position: relative;
965
+ }
966
+ /* Give selected cells a blue overlay */
967
+ .${ClassName.SELECTED_CELL}::after, .${ClassName.HOVERED_CELL_IN_DANGER}::after {
968
+ z-index: ${akEditorSmallZIndex};
969
+ position: absolute;
970
+ content: '';
971
+ left: 0;
972
+ right: 0;
973
+ top: 0;
974
+ bottom: 0;
975
+ width: 100%;
976
+ pointer-events: none;
977
+ }
978
+ .${ClassName.SELECTED_CELL} {
979
+ border: 1px solid ${tableBorderSelectedColor};
980
+ }
981
+ .${ClassName.SELECTED_CELL}::after {
982
+ background: ${tableCellSelectedColor};
983
+ z-index: ${akEditorSmallZIndex};
984
+ }
985
+ th.${ClassName.HOVERED_CELL_IN_DANGER}::after, td.${ClassName.HOVERED_CELL_IN_DANGER}::after {
986
+ background: ${tableCellDeleteColor};
987
+ z-index: ${akEditorUnitZIndex * 100};
988
+ }
989
+ // ED-15246: Trello card is visible through a border of a table border
990
+ /* ED-19064: To fix when enable header column in the table,
1023
991
  and selection the header column, the right border is not tableBorderSelectedColor
1024
992
  when deleting the header column, the right border is not tableToolbarDeleteColor */
1025
- td.${ClassName.HOVERED_CELL},
1026
- td.${ClassName.SELECTED_CELL},
1027
- th.${ClassName.TABLE_HEADER_CELL}.${ClassName.SELECTED_CELL},
1028
- th.${ClassName.TABLE_HEADER_CELL}.${ClassName.HOVERED_CELL} {
1029
- &::after {
1030
- height: 100%;
1031
- width: 100%;
1032
- border: 1px solid ${tableBorderSelectedColor};
1033
- content: '';
1034
- position: absolute;
1035
- left: -1px;
1036
- top: -1px;
1037
- bottom: 0;
1038
- z-index: ${akEditorSmallZIndex};
1039
- display: inline-block;
1040
- pointer-events: none;
1041
- }
1042
- &.${ClassName.HOVERED_CELL_IN_DANGER}::after {
1043
- ${tableBorderStyles()};
1044
- z-index: ${akEditorUnitZIndex * 100};
1045
- }
1046
-
1047
- &.${ClassName.HOVERED_NO_HIGHLIGHT}.${ClassName.HOVERED_CELL_IN_DANGER}::after {
1048
- ${tableBorderStyles()};
1049
- z-index: ${akEditorUnitZIndex * 100};
1050
- }
1051
- }
1052
- }
1053
-
1054
- // override for DnD controls
1055
- .${ClassName.DRAG_ROW_CONTROLS_WRAPPER} {
1056
- position: absolute;
1057
- margin-top: ${tableMarginTop}px;
1058
- left: -${tableToolbarSize + 1}px;
1059
- z-index: ${rowControlsZIndex + 4};
1060
- }
1061
-
1062
- .${ClassName.ROW_CONTROLS_WRAPPER} {
1063
- position: absolute;
1064
- /* top of corner control is table margin top - corner control height + 1 pixel of table border. */
1065
- top: ${tableMarginTop - cornerControlHeight + 1}px;
1066
- left: -${tableToolbarSize}px;
1067
- }
1068
-
1069
- .${ClassName.DRAG_ROW_CONTROLS_WRAPPER}.${ClassName.TABLE_LEFT_SHADOW},
1070
- .${ClassName.ROW_CONTROLS_WRAPPER}.${ClassName.TABLE_LEFT_SHADOW} {
1071
- z-index: ${akEditorUnitZIndex};
1072
- }
1073
-
1074
- .${ClassName.DRAG_COLUMN_CONTROLS_WRAPPER} {
1075
- position: absolute;
1076
- top: ${tableMarginTop}px;
1077
- }
1078
-
1079
- .${ClassName.TABLE_STICKY} .${ClassName.DRAG_COLUMN_CONTROLS_WRAPPER} {
1080
- position: fixed;
1081
- /* higher zIndex than sticky header which is akEditorTableCellOnStickyHeaderZIndex - 5 */
1082
- z-index: ${akEditorTableCellOnStickyHeaderZIndex - 4};
1083
- }
1084
-
1085
- .${ClassName.TABLE_NODE_WRAPPER} {
1086
- padding-bottom: 0px;
1087
- /* fixes gap cursor height */
1088
- overflow: auto;
1089
- overflow-y: hidden;
1090
- position: relative;
1091
-
1092
- ${numberColumnFix()}
1093
- }
993
+ td.${ClassName.HOVERED_CELL},
994
+ td.${ClassName.SELECTED_CELL},
995
+ th.${ClassName.TABLE_HEADER_CELL}.${ClassName.SELECTED_CELL},
996
+ th.${ClassName.TABLE_HEADER_CELL}.${ClassName.HOVERED_CELL} {
997
+ &::after {
998
+ height: 100%;
999
+ width: 100%;
1000
+ border: 1px solid ${tableBorderSelectedColor};
1001
+ content: '';
1002
+ position: absolute;
1003
+ left: -1px;
1004
+ top: -1px;
1005
+ bottom: 0;
1006
+ z-index: ${akEditorSmallZIndex};
1007
+ display: inline-block;
1008
+ pointer-events: none;
1009
+ }
1010
+ &.${ClassName.HOVERED_CELL_IN_DANGER}::after {
1011
+ ${tableBorderStyles()};
1012
+ z-index: ${akEditorUnitZIndex * 100};
1013
+ }
1014
+
1015
+ &.${ClassName.HOVERED_NO_HIGHLIGHT}.${ClassName.HOVERED_CELL_IN_DANGER}::after {
1016
+ ${tableBorderStyles()};
1017
+ z-index: ${akEditorUnitZIndex * 100};
1018
+ }
1019
+ }
1020
+ }
1021
+
1022
+ // override for DnD controls
1023
+ .${ClassName.DRAG_ROW_CONTROLS_WRAPPER} {
1024
+ position: absolute;
1025
+ margin-top: ${tableMarginTop}px;
1026
+ left: -${tableToolbarSize + 1}px;
1027
+ z-index: ${rowControlsZIndex + 4};
1028
+ }
1029
+
1030
+ .${ClassName.ROW_CONTROLS_WRAPPER} {
1031
+ position: absolute;
1032
+ /* top of corner control is table margin top - corner control height + 1 pixel of table border. */
1033
+ top: ${tableMarginTop - cornerControlHeight + 1}px;
1034
+ left: -${tableToolbarSize}px;
1035
+ }
1036
+
1037
+ .${ClassName.DRAG_ROW_CONTROLS_WRAPPER}.${ClassName.TABLE_LEFT_SHADOW},
1038
+ .${ClassName.ROW_CONTROLS_WRAPPER}.${ClassName.TABLE_LEFT_SHADOW} {
1039
+ z-index: ${akEditorUnitZIndex};
1040
+ }
1041
+
1042
+ .${ClassName.DRAG_COLUMN_CONTROLS_WRAPPER} {
1043
+ position: absolute;
1044
+ top: ${tableMarginTop}px;
1045
+ }
1046
+
1047
+ .${ClassName.TABLE_STICKY} .${ClassName.DRAG_COLUMN_CONTROLS_WRAPPER} {
1048
+ position: fixed;
1049
+ /* higher zIndex than sticky header which is akEditorTableCellOnStickyHeaderZIndex - 5 */
1050
+ z-index: ${akEditorTableCellOnStickyHeaderZIndex - 4};
1051
+ }
1052
+
1053
+ .${ClassName.TABLE_NODE_WRAPPER} {
1054
+ padding-bottom: 0px;
1055
+ /* fixes gap cursor height */
1056
+ overflow: auto;
1057
+ overflow-y: hidden;
1058
+ position: relative;
1059
+
1060
+ ${numberColumnFix()}
1061
+ }
1094
1062
  `;
1095
1063
 
1096
1064
  // TODO: https://product-fabric.atlassian.net/browse/DSP-4139
1097
1065
  export const tableStyles = (props: { featureFlags?: FeatureFlags }) => css`
1098
- .ProseMirror {
1099
- ${baseTableStyles(props)}
1100
- }
1101
-
1102
- .ProseMirror.${ClassName.IS_RESIZING} {
1103
- .${ClassName.TABLE_NODE_WRAPPER} {
1104
- overflow-x: auto;
1105
- ${scrollbarStyles};
1106
- }
1107
- }
1108
-
1109
- .ProseMirror.${ClassName.RESIZE_CURSOR} {
1110
- cursor: col-resize;
1111
- }
1112
-
1113
- ${shadowSentinelStyles}
1066
+ .ProseMirror {
1067
+ ${baseTableStyles(props)}
1068
+ }
1069
+
1070
+ .ProseMirror.${ClassName.IS_RESIZING} {
1071
+ .${ClassName.TABLE_NODE_WRAPPER} {
1072
+ overflow-x: auto;
1073
+ ${scrollbarStyles};
1074
+ }
1075
+ }
1076
+
1077
+ .ProseMirror.${ClassName.RESIZE_CURSOR} {
1078
+ cursor: col-resize;
1079
+ }
1080
+
1081
+ ${shadowSentinelStyles}
1114
1082
  `;
1115
1083
 
1116
1084
  // eslint-disable-next-line @atlaskit/design-system/ensure-design-token-usage/preview
1117
1085
  export const tableFullPageEditorStyles = css`
1118
- .ProseMirror .${ClassName.TABLE_NODE_WRAPPER} > table {
1119
- margin-left: 0;
1120
- // 1px border width offset added here to prevent unwanted overflow and scolling - ED-16212
1121
- margin-right: -1px;
1122
- width: 100%;
1123
- }
1086
+ .ProseMirror .${ClassName.TABLE_NODE_WRAPPER} > table {
1087
+ margin-left: 0;
1088
+ // 1px border width offset added here to prevent unwanted overflow and scolling - ED-16212
1089
+ margin-right: -1px;
1090
+ width: 100%;
1091
+ }
1124
1092
  `;
1125
1093
 
1126
1094
  export const tableCommentEditorStyles = css`
1127
- .ProseMirror .${ClassName.TABLE_NODE_WRAPPER} > table {
1128
- margin-left: 0;
1129
- margin-right: 0;
1130
- ${scrollbarStyles};
1131
- }
1095
+ .ProseMirror .${ClassName.TABLE_NODE_WRAPPER} > table {
1096
+ margin-left: 0;
1097
+ margin-right: 0;
1098
+ ${scrollbarStyles};
1099
+ }
1132
1100
  `;