@atlaskit/editor-plugin-table 7.6.2 → 7.6.4

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