@atlaskit/editor-plugin-table 2.4.0 → 2.5.1
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.
- package/CHANGELOG.md +16 -0
- package/dist/cjs/plugins/table/nodeviews/TableResizer.js +2 -1
- package/dist/cjs/plugins/table/ui/FloatingContextualButton/styles.js +1 -1
- package/dist/cjs/plugins/table/ui/common-styles.js +1 -1
- package/dist/cjs/plugins/table/ui/consts.js +45 -7
- package/dist/cjs/plugins/table/ui/ui-styles.js +29 -15
- package/dist/cjs/version.json +1 -1
- package/dist/es2019/plugins/table/nodeviews/TableResizer.js +2 -1
- package/dist/es2019/plugins/table/ui/FloatingContextualButton/styles.js +1 -1
- package/dist/es2019/plugins/table/ui/common-styles.js +27 -27
- package/dist/es2019/plugins/table/ui/consts.js +42 -8
- package/dist/es2019/plugins/table/ui/ui-styles.js +38 -38
- package/dist/es2019/version.json +1 -1
- package/dist/esm/plugins/table/nodeviews/TableResizer.js +2 -1
- package/dist/esm/plugins/table/ui/FloatingContextualButton/styles.js +1 -1
- package/dist/esm/plugins/table/ui/common-styles.js +1 -1
- package/dist/esm/plugins/table/ui/consts.js +42 -8
- package/dist/esm/plugins/table/ui/ui-styles.js +31 -17
- package/dist/esm/version.json +1 -1
- package/dist/types/plugins/table/ui/consts.d.ts +10 -6
- package/dist/types/plugins/table/ui/ui-styles.d.ts +8 -8
- package/dist/types-ts4.5/plugins/table/ui/consts.d.ts +10 -6
- package/dist/types-ts4.5/plugins/table/ui/ui-styles.d.ts +8 -8
- package/package.json +2 -2
- package/src/__tests__/unit/pm-plugins/main.ts +11 -0
- package/src/__tests__/unit/ui/FloatingContextualButton.tsx +11 -0
- package/src/__tests__/unit/ui/FloatingInsertButton.tsx +11 -0
- package/src/plugins/table/nodeviews/TableResizer.tsx +1 -0
- package/src/plugins/table/ui/FloatingContextualButton/styles.ts +1 -1
- package/src/plugins/table/ui/common-styles.ts +27 -42
- package/src/plugins/table/ui/consts.ts +46 -19
- package/src/plugins/table/ui/ui-styles.ts +49 -64
|
@@ -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: ${
|
|
126
|
-
|
|
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: ${
|
|
137
|
-
|
|
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: ${
|
|
148
|
-
|
|
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: ${
|
|
236
|
-
color: ${
|
|
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: ${
|
|
243
|
-
color: ${
|
|
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: ${
|
|
318
|
-
|
|
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: ${
|
|
401
|
-
|
|
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
|
}
|