@atlaskit/editor-plugin-table 2.5.0 → 2.5.2

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 (29) hide show
  1. package/CHANGELOG.md +12 -0
  2. package/dist/cjs/plugins/table/ui/FloatingContextualButton/styles.js +1 -1
  3. package/dist/cjs/plugins/table/ui/common-styles.js +1 -1
  4. package/dist/cjs/plugins/table/ui/consts.js +46 -8
  5. package/dist/cjs/plugins/table/ui/ui-styles.js +29 -15
  6. package/dist/cjs/version.json +1 -1
  7. package/dist/es2019/plugins/table/ui/FloatingContextualButton/styles.js +1 -1
  8. package/dist/es2019/plugins/table/ui/common-styles.js +27 -27
  9. package/dist/es2019/plugins/table/ui/consts.js +43 -9
  10. package/dist/es2019/plugins/table/ui/ui-styles.js +38 -38
  11. package/dist/es2019/version.json +1 -1
  12. package/dist/esm/plugins/table/ui/FloatingContextualButton/styles.js +1 -1
  13. package/dist/esm/plugins/table/ui/common-styles.js +1 -1
  14. package/dist/esm/plugins/table/ui/consts.js +43 -9
  15. package/dist/esm/plugins/table/ui/ui-styles.js +31 -17
  16. package/dist/esm/version.json +1 -1
  17. package/dist/types/plugins/table/ui/consts.d.ts +11 -7
  18. package/dist/types/plugins/table/ui/ui-styles.d.ts +8 -8
  19. package/dist/types-ts4.5/plugins/table/ui/consts.d.ts +11 -7
  20. package/dist/types-ts4.5/plugins/table/ui/ui-styles.d.ts +8 -8
  21. package/package.json +2 -2
  22. package/src/__tests__/unit/pm-plugins/main.ts +11 -0
  23. package/src/__tests__/unit/ui/FloatingContextualButton.tsx +11 -0
  24. package/src/__tests__/unit/ui/FloatingInsertButton.tsx +11 -0
  25. package/src/plugins/table/ui/FloatingContextualButton/styles.ts +1 -1
  26. package/src/plugins/table/ui/common-styles.ts +27 -42
  27. package/src/plugins/table/ui/consts.ts +47 -20
  28. package/src/plugins/table/ui/ui-styles.ts +49 -64
  29. package/tmp/api-report-tmp.d.ts +108 -0
@@ -10,17 +10,7 @@ import {
10
10
  akEditorTableNumberColumnWidth,
11
11
  akEditorUnitZIndex,
12
12
  } from '@atlaskit/editor-shared-styles';
13
- import {
14
- B300,
15
- N0,
16
- N20A,
17
- N300,
18
- N40A,
19
- N60A,
20
- R300,
21
- Y200,
22
- Y50,
23
- } from '@atlaskit/theme/colors';
13
+ import { B300, N0, N300, N40A, N60A, Y200, Y50 } from '@atlaskit/theme/colors';
24
14
  import { borderRadius } from '@atlaskit/theme/constants';
25
15
  import { ThemeProps } from '@atlaskit/theme/types';
26
16
  import { token } from '@atlaskit/tokens';
@@ -39,6 +29,10 @@ import {
39
29
  tableBorderDeleteColor,
40
30
  tableBorderSelectedColor,
41
31
  tableCellDeleteColor,
32
+ tableCellHoverDeleteIconBackground,
33
+ tableCellHoverDeleteIconColor,
34
+ tableCellSelectedDeleteIconBackground,
35
+ tableCellSelectedDeleteIconColor,
42
36
  tableDeleteButtonSize,
43
37
  tableHeaderCellBackgroundColor,
44
38
  tableInsertColumnButtonSize,
@@ -47,9 +41,9 @@ import {
47
41
  tableToolbarSize,
48
42
  } from './consts';
49
43
 
50
- const InsertLine = (cssString?: string) => css`
44
+ const InsertLine = (props: ThemeProps, cssString?: string) => css`
51
45
  .${ClassName.CONTROLS_INSERT_LINE} {
52
- background: ${tableBorderSelectedColor};
46
+ background: ${tableBorderSelectedColor(props)};
53
47
  display: none;
54
48
  position: absolute;
55
49
  z-index: ${akEditorUnitZIndex};
@@ -122,33 +116,24 @@ export const HeaderButton = (props: ThemeProps, cssString?: string) => css`
122
116
 
123
117
  .active .${ClassName.CONTROLS_BUTTON} {
124
118
  color: ${token('color.icon.inverse', N0)};
125
- background-color: ${token(
126
- 'color.background.selected',
127
- tableToolbarSelectedColor,
128
- )};
129
- border-color: ${tableBorderSelectedColor};
119
+ background-color: ${tableToolbarSelectedColor(props)};
120
+ border-color: ${tableBorderSelectedColor(props)};
130
121
  }
131
122
  `;
132
123
 
133
- export const HeaderButtonHover = () => css`
124
+ export const HeaderButtonHover = (props: ThemeProps) => css`
134
125
  .${ClassName.CONTROLS_BUTTON}:hover {
135
126
  color: ${token('color.icon.inverse', N0)};
136
- background-color: ${token(
137
- 'color.background.selected',
138
- tableToolbarSelectedColor,
139
- )};
140
- border-color: ${tableBorderSelectedColor};
127
+ background-color: ${tableToolbarSelectedColor(props)};
128
+ border-color: ${tableBorderSelectedColor(props)};
141
129
  cursor: pointer;
142
130
  }
143
131
  `;
144
132
 
145
- export const HeaderButtonDanger = () => css`
133
+ export const HeaderButtonDanger = (props: ThemeProps) => css`
146
134
  .${ClassName.HOVERED_CELL_IN_DANGER} .${ClassName.CONTROLS_BUTTON} {
147
- background-color: ${token(
148
- 'color.background.danger',
149
- tableToolbarDeleteColor,
150
- )};
151
- border-color: ${tableBorderDeleteColor};
135
+ background-color: ${tableToolbarDeleteColor(props)};
136
+ border-color: ${tableBorderDeleteColor(props)};
152
137
  position: relative;
153
138
  z-index: ${akEditorUnitZIndex};
154
139
  }
@@ -191,23 +176,29 @@ const InsertButtonHover = () => css`
191
176
  }
192
177
  `;
193
178
 
194
- export const insertColumnButtonWrapper = css`
179
+ export const insertColumnButtonWrapper = (props: ThemeProps) => css`
195
180
  ${InsertButton()}
196
181
  ${InsertButtonHover()}
197
- ${InsertLine(`
182
+ ${InsertLine(
183
+ props,
184
+ `
198
185
  width: 2px;
199
186
  left: 9px;
200
- `)}
187
+ `,
188
+ )}
201
189
  `;
202
190
 
203
- export const insertRowButtonWrapper = css`
191
+ export const insertRowButtonWrapper = (props: ThemeProps) => css`
204
192
  ${InsertButton()}
205
193
  ${InsertButtonHover()}
206
- ${InsertLine(`
194
+ ${InsertLine(
195
+ props,
196
+ `
207
197
  height: 2px;
208
198
  top: -11px;
209
199
  left: ${tableInsertColumnButtonSize - 1}px;
210
- `)}
200
+ `,
201
+ )}
211
202
  `;
212
203
 
213
204
  export const columnControlsLineMarker = () => css`
@@ -223,7 +214,7 @@ export const columnControlsLineMarker = () => css`
223
214
  }
224
215
  `;
225
216
 
226
- export const DeleteButton = css`
217
+ export const DeleteButton = (props: ThemeProps) => css`
227
218
  .${ClassName.CONTROLS_DELETE_BUTTON_WRAP},
228
219
  .${ClassName.CONTROLS_DELETE_BUTTON} {
229
220
  height: ${tableDeleteButtonSize}px;
@@ -232,15 +223,15 @@ export const DeleteButton = css`
232
223
  .${ClassName.CONTROLS_DELETE_BUTTON_WRAP} {
233
224
  .${ClassName.CONTROLS_DELETE_BUTTON} {
234
225
  ${Button(`
235
- background: ${token('color.background.neutral', N20A)};
236
- color: ${token('color.icon', N300)};
226
+ background: ${tableCellSelectedDeleteIconBackground(props)};
227
+ color: ${tableCellSelectedDeleteIconColor(props)};
237
228
  `)}
238
229
  }
239
230
  }
240
231
 
241
232
  .${ClassName.CONTROLS_DELETE_BUTTON}:hover {
242
- background: ${token('color.background.danger.bold', R300)};
243
- color: ${token('color.icon.inverse', 'white')};
233
+ background: ${tableCellHoverDeleteIconBackground(props)};
234
+ color: ${tableCellHoverDeleteIconColor(props)};
244
235
  cursor: pointer;
245
236
  }
246
237
  `;
@@ -312,13 +303,10 @@ const columnHeaderButton = (props: ThemeProps, cssString?: string) => css`
312
303
  ${cssString}
313
304
  `;
314
305
 
315
- const columnHeaderButtonSelected = css`
306
+ const columnHeaderButtonSelected = (props: ThemeProps) => css`
316
307
  color: ${token('color.text.inverse', N0)};
317
- background-color: ${token(
318
- 'color.background.selected',
319
- tableToolbarSelectedColor,
320
- )};
321
- border-color: ${tableBorderSelectedColor};
308
+ background-color: ${tableToolbarSelectedColor(props)};
309
+ border-color: ${tableBorderSelectedColor(props)};
322
310
  z-index: ${columnControlsSelectedZIndex};
323
311
  `;
324
312
 
@@ -392,16 +380,13 @@ export const columnControlsDecoration = (props: ThemeProps) => css`
392
380
  &.${ClassName.HOVERED_COLUMN},
393
381
  &.${ClassName.HOVERED_TABLE} {
394
382
  .${ClassName.COLUMN_CONTROLS_DECORATIONS}::after {
395
- ${columnHeaderButtonSelected};
383
+ ${columnHeaderButtonSelected(props)};
396
384
  }
397
385
 
398
386
  &.${ClassName.HOVERED_CELL_IN_DANGER}
399
387
  .${ClassName.COLUMN_CONTROLS_DECORATIONS}::after {
400
- background-color: ${token(
401
- 'color.background.danger',
402
- tableToolbarDeleteColor,
403
- )};
404
- border: 1px solid ${tableBorderDeleteColor};
388
+ background-color: ${tableToolbarDeleteColor(props)};
389
+ border: 1px solid ${tableBorderDeleteColor(props)};
405
390
  border-bottom: none;
406
391
  z-index: ${akEditorUnitZIndex * 100};
407
392
  }
@@ -417,30 +402,30 @@ export const columnControlsDecoration = (props: ThemeProps) => css`
417
402
  tr:first-of-type
418
403
  th.${ClassName.TABLE_HEADER_CELL} {
419
404
  .${ClassName.COLUMN_CONTROLS_DECORATIONS}::after {
420
- ${columnHeaderButtonSelected};
405
+ ${columnHeaderButtonSelected(props)};
421
406
  }
422
407
  }
423
408
  `;
424
409
 
425
- export const hoveredDeleteButton = css`
410
+ export const hoveredDeleteButton = (props: ThemeProps) => css`
426
411
  .${ClassName.TABLE_CONTAINER}.${ClassName.HOVERED_DELETE_BUTTON} {
427
412
  .${ClassName.SELECTED_CELL},
428
413
  .${ClassName.COLUMN_SELECTED},
429
414
  .${ClassName.HOVERED_CELL} {
430
- border: 1px solid ${tableBorderDeleteColor};
415
+ border: 1px solid ${tableBorderDeleteColor(props)};
431
416
  }
432
417
  .${ClassName.SELECTED_CELL}::after {
433
- background: ${tableCellDeleteColor};
418
+ background: ${tableCellDeleteColor(props)};
434
419
  }
435
420
  }
436
421
  `;
437
422
 
438
- export const hoveredCell = css`
423
+ export const hoveredCell = (props: ThemeProps) => css`
439
424
  :not(.${ClassName.IS_RESIZING})
440
425
  .${ClassName.TABLE_CONTAINER}:not(.${ClassName.HOVERED_DELETE_BUTTON}) {
441
426
  .${ClassName.HOVERED_CELL} {
442
427
  position: relative;
443
- border: 1px solid ${tableBorderSelectedColor};
428
+ border: 1px solid ${tableBorderSelectedColor(props)};
444
429
  }
445
430
  }
446
431
  `;
@@ -458,7 +443,7 @@ export const hoveredWarningCell = css`
458
443
  }
459
444
  `;
460
445
 
461
- export const resizeHandle = css`
446
+ export const resizeHandle = (props: ThemeProps) => css`
462
447
  .${ClassName.TABLE_CONTAINER} {
463
448
  .${ClassName.RESIZE_HANDLE_DECORATION} {
464
449
  background-color: transparent;
@@ -478,7 +463,7 @@ export const resizeHandle = css`
478
463
  top: -1px;
479
464
  width: ${resizeLineWidth}px;
480
465
  height: calc(100% + 2px);
481
- background-color: ${tableBorderSelectedColor};
466
+ background-color: ${tableBorderSelectedColor(props)};
482
467
  z-index: ${columnControlsZIndex * 2};
483
468
  }
484
469
 
@@ -488,7 +473,7 @@ export const resizeHandle = css`
488
473
  position: absolute;
489
474
  width: ${resizeLineWidth}px;
490
475
  height: calc(100% + ${tableToolbarSize + tableCellBorderWidth}px);
491
- background-color: ${tableBorderSelectedColor};
476
+ background-color: ${tableBorderSelectedColor(props)};
492
477
  z-index: ${columnControlsZIndex * 2};
493
478
  top: -${tableToolbarSize + tableCellBorderWidth}px;
494
479
  }
@@ -500,7 +485,7 @@ export const resizeHandle = css`
500
485
  top: -1px;
501
486
  width: ${resizeLineWidth}px;
502
487
  height: calc(100% + 2px);
503
- background-color: ${tableBorderSelectedColor};
488
+ background-color: ${tableBorderSelectedColor(props)};
504
489
  z-index: ${columnControlsZIndex * 2};
505
490
  }
506
491
 
@@ -510,7 +495,7 @@ export const resizeHandle = css`
510
495
  position: absolute;
511
496
  width: ${resizeLineWidth}px;
512
497
  height: calc(100% + ${tableToolbarSize + tableCellBorderWidth}px);
513
- background-color: ${tableBorderSelectedColor};
498
+ background-color: ${tableBorderSelectedColor(props)};
514
499
  z-index: ${columnControlsZIndex * 2};
515
500
  top: -${tableToolbarSize + tableCellBorderWidth}px;
516
501
  }
@@ -0,0 +1,108 @@
1
+ ## API Report File for "@atlaskit/editor-plugin-table"
2
+
3
+ > Do not edit this file. It is a report generated by [API Extractor](https://api-extractor.com/).
4
+
5
+ ```ts
6
+
7
+ import { AnalyticsEventPayload } from '@atlaskit/editor-common/analytics';
8
+ import type { analyticsPlugin } from '@atlaskit/editor-plugin-analytics';
9
+ import type { Command } from '@atlaskit/editor-common/types';
10
+ import type { contentInsertionPlugin } from '@atlaskit/editor-plugin-content-insertion';
11
+ import type { EditorSelectionAPI } from '@atlaskit/editor-common/selection';
12
+ import type { GetEditorFeatureFlags } from '@atlaskit/editor-common/types';
13
+ import type { guidelinePlugin } from '@atlaskit/editor-plugin-guideline';
14
+ import type { NextEditorPlugin } from '@atlaskit/editor-common/types';
15
+ import { TableLayout } from '@atlaskit/adf-schema';
16
+ import type { widthPlugin } from '@atlaskit/editor-plugin-width';
17
+
18
+ // @public (undocumented)
19
+ type InsertTableAction = (analyticsPayload: AnalyticsEventPayload) => Command;
20
+
21
+ // @public (undocumented)
22
+ type PermittedLayoutsDescriptor = 'all' | TableLayout[];
23
+
24
+ // @public (undocumented)
25
+ interface PluginConfig {
26
+ // (undocumented)
27
+ advanced?: boolean;
28
+ // (undocumented)
29
+ allowAddColumnWithCustomStep?: boolean;
30
+ // (undocumented)
31
+ allowBackgroundColor?: boolean;
32
+ // (undocumented)
33
+ allowCellOptionsInFloatingToolbar?: boolean;
34
+ // (undocumented)
35
+ allowCollapse?: boolean;
36
+ // (undocumented)
37
+ allowColumnResizing?: boolean;
38
+ // (undocumented)
39
+ allowColumnSorting?: boolean;
40
+ // (undocumented)
41
+ allowControls?: boolean;
42
+ // (undocumented)
43
+ allowDistributeColumns?: boolean;
44
+ // (undocumented)
45
+ allowHeaderColumn?: boolean;
46
+ // (undocumented)
47
+ allowHeaderRow?: boolean;
48
+ // (undocumented)
49
+ allowMergeCells?: boolean;
50
+ // (undocumented)
51
+ allowNumberColumn?: boolean;
52
+ // (undocumented)
53
+ initialRenderOptimization?: boolean;
54
+ // (undocumented)
55
+ isHeaderRowRequired?: boolean;
56
+ // (undocumented)
57
+ mouseMoveOptimization?: boolean;
58
+ // (undocumented)
59
+ permittedLayouts?: PermittedLayoutsDescriptor;
60
+ // (undocumented)
61
+ stickyHeaders?: boolean;
62
+ // (undocumented)
63
+ stickyHeadersOptimization?: boolean;
64
+ // (undocumented)
65
+ tableCellOptimization?: boolean;
66
+ // (undocumented)
67
+ tableOverflowShadowsOptimization?: boolean;
68
+ // (undocumented)
69
+ tableRenderOptimization?: boolean;
70
+ }
71
+
72
+ // @public (undocumented)
73
+ interface TablePluginOptions {
74
+ // (undocumented)
75
+ allowContextualMenu?: boolean;
76
+ // (undocumented)
77
+ breakoutEnabled?: boolean;
78
+ // (undocumented)
79
+ editorSelectionAPI?: EditorSelectionAPI;
80
+ // (undocumented)
81
+ fullWidthEnabled?: boolean;
82
+ // (undocumented)
83
+ getEditorFeatureFlags?: GetEditorFeatureFlags;
84
+ // (undocumented)
85
+ tableOptions: PluginConfig;
86
+ // (undocumented)
87
+ tableResizingEnabled?: boolean;
88
+ // (undocumented)
89
+ wasFullWidthEnabled?: boolean;
90
+ }
91
+
92
+ // @public (undocumented)
93
+ export const tablesPlugin: NextEditorPlugin<'table', {
94
+ pluginConfiguration: TablePluginOptions | undefined;
95
+ actions: {
96
+ insertTable: InsertTableAction;
97
+ };
98
+ dependencies: [
99
+ typeof analyticsPlugin,
100
+ typeof contentInsertionPlugin,
101
+ typeof widthPlugin,
102
+ typeof guidelinePlugin
103
+ ];
104
+ }>;
105
+
106
+ // (No @packageDocumentation comment for this package)
107
+
108
+ ```