@atlaskit/renderer 114.11.1 → 114.12.0

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 (72) hide show
  1. package/CHANGELOG.md +20 -0
  2. package/afm-cc/tsconfig.json +3 -0
  3. package/dist/cjs/react/marks/alignment.js +3 -15
  4. package/dist/cjs/react/nodes/blockCard.js +24 -8
  5. package/dist/cjs/react/nodes/codeBlock/components/codeBlockContainer.js +3 -10
  6. package/dist/cjs/react/nodes/codeBlock/components/lightWeightCodeBlock.js +8 -53
  7. package/dist/cjs/react/nodes/layoutColumn.js +3 -11
  8. package/dist/cjs/react/nodes/media/index.js +28 -58
  9. package/dist/cjs/react/nodes/panel.js +2 -26
  10. package/dist/cjs/react/nodes/table/colgroup.js +5 -2
  11. package/dist/cjs/react/nodes/table/sticky.js +3 -57
  12. package/dist/cjs/react/nodes/table/table.js +6 -1
  13. package/dist/cjs/react/nodes/table.js +51 -23
  14. package/dist/cjs/react/nodes/tableNew.js +550 -0
  15. package/dist/cjs/ui/Expand.js +12 -62
  16. package/dist/cjs/ui/Renderer/RendererStyleContainer.js +19 -42
  17. package/dist/cjs/ui/Renderer/breakout-ssr.js +22 -22
  18. package/dist/cjs/ui/Renderer/index.js +4 -2
  19. package/dist/cjs/ui/Renderer/style.js +2 -208
  20. package/dist/cjs/ui/annotations/draft/component.js +2 -17
  21. package/dist/cjs/ui/annotations/element/mark.js +12 -61
  22. package/dist/es2019/react/marks/alignment.js +2 -17
  23. package/dist/es2019/react/nodes/blockCard.js +24 -8
  24. package/dist/es2019/react/nodes/codeBlock/components/codeBlockContainer.js +2 -39
  25. package/dist/es2019/react/nodes/codeBlock/components/lightWeightCodeBlock.js +5 -50
  26. package/dist/es2019/react/nodes/layoutColumn.js +4 -12
  27. package/dist/es2019/react/nodes/media/index.js +3 -36
  28. package/dist/es2019/react/nodes/panel.js +2 -41
  29. package/dist/es2019/react/nodes/table/colgroup.js +5 -2
  30. package/dist/es2019/react/nodes/table/sticky.js +3 -70
  31. package/dist/es2019/react/nodes/table/table.js +6 -1
  32. package/dist/es2019/react/nodes/table.js +50 -22
  33. package/dist/es2019/react/nodes/tableNew.js +501 -0
  34. package/dist/es2019/ui/Expand.js +11 -67
  35. package/dist/es2019/ui/Renderer/RendererStyleContainer.js +20 -43
  36. package/dist/es2019/ui/Renderer/breakout-ssr.js +22 -22
  37. package/dist/es2019/ui/Renderer/index.js +4 -2
  38. package/dist/es2019/ui/Renderer/style.js +1 -889
  39. package/dist/es2019/ui/annotations/draft/component.js +2 -15
  40. package/dist/es2019/ui/annotations/element/mark.js +9 -71
  41. package/dist/esm/react/marks/alignment.js +2 -16
  42. package/dist/esm/react/nodes/blockCard.js +24 -8
  43. package/dist/esm/react/nodes/codeBlock/components/codeBlockContainer.js +2 -11
  44. package/dist/esm/react/nodes/codeBlock/components/lightWeightCodeBlock.js +7 -52
  45. package/dist/esm/react/nodes/layoutColumn.js +4 -12
  46. package/dist/esm/react/nodes/media/index.js +28 -58
  47. package/dist/esm/react/nodes/panel.js +3 -27
  48. package/dist/esm/react/nodes/table/colgroup.js +5 -2
  49. package/dist/esm/react/nodes/table/sticky.js +3 -57
  50. package/dist/esm/react/nodes/table/table.js +6 -1
  51. package/dist/esm/react/nodes/table.js +51 -21
  52. package/dist/esm/react/nodes/tableNew.js +544 -0
  53. package/dist/esm/ui/Expand.js +12 -62
  54. package/dist/esm/ui/Renderer/RendererStyleContainer.js +20 -43
  55. package/dist/esm/ui/Renderer/breakout-ssr.js +22 -22
  56. package/dist/esm/ui/Renderer/index.js +4 -2
  57. package/dist/esm/ui/Renderer/style.js +1 -203
  58. package/dist/esm/ui/annotations/draft/component.js +2 -17
  59. package/dist/esm/ui/annotations/element/mark.js +9 -56
  60. package/dist/types/react/nodes/codeBlock/components/lightWeightCodeBlock.d.ts +1 -1
  61. package/dist/types/react/nodes/table.d.ts +35 -254
  62. package/dist/types/react/nodes/tableNew.d.ts +83 -0
  63. package/dist/types/ui/Renderer/breakout-ssr.d.ts +1 -2
  64. package/dist/types/ui/Renderer/style.d.ts +0 -11
  65. package/dist/types/ui/annotations/element/mark.d.ts +30 -6
  66. package/dist/types-ts4.5/react/nodes/codeBlock/components/lightWeightCodeBlock.d.ts +1 -1
  67. package/dist/types-ts4.5/react/nodes/table.d.ts +35 -254
  68. package/dist/types-ts4.5/react/nodes/tableNew.d.ts +83 -0
  69. package/dist/types-ts4.5/ui/Renderer/breakout-ssr.d.ts +1 -2
  70. package/dist/types-ts4.5/ui/Renderer/style.d.ts +0 -11
  71. package/dist/types-ts4.5/ui/annotations/element/mark.d.ts +30 -6
  72. package/package.json +14 -7
@@ -0,0 +1,501 @@
1
+ import _defineProperty from "@babel/runtime/helpers/defineProperty";
2
+ /* eslint-disable @atlaskit/ui-styling-standard/no-classname-prop, @atlaskit/ui-styling-standard/enforce-style-prop */
3
+ import React from 'react';
4
+ import { TableSharedCssClassName, tableMarginTop } from '@atlaskit/editor-common/styles';
5
+ import { createCompareNodes, convertProsemirrorTableNodeToArrayOfRows, hasMergedCell, compose } from '@atlaskit/editor-common/utils';
6
+ import { SortOrder } from '@atlaskit/editor-common/types';
7
+ import { akEditorGutterPaddingDynamic } from '@atlaskit/editor-shared-styles';
8
+ import { editorExperiment } from '@atlaskit/tmp-editor-statsig/experiments';
9
+ import { TableHeader } from './tableCell';
10
+ import { StickyTable, tableStickyPadding, OverflowParent } from './table/sticky';
11
+ import { Table } from './table/table';
12
+ import { TableMap } from '@atlaskit/editor-tables/table-map';
13
+ import { isCommentAppearance, isFullWidthOrFullPageAppearance } from '../utils/appearance';
14
+ import { TableStickyScrollbar } from './TableStickyScrollbar';
15
+ const getResizerMinWidth = node => {
16
+ const currentColumnCount = getColgroupChildrenLength(node);
17
+ const minColumnWidth = Math.min(3, currentColumnCount) * COLUMN_MIN_WIDTH;
18
+ // add an extra pixel as the scale table logic will scale columns to be tableContainerWidth - 1
19
+ // the table can't scale past its min-width, so instead restrict table container min width to avoid that situation
20
+ return minColumnWidth + 1;
21
+ };
22
+ const getColgroupChildrenLength = table => {
23
+ const map = TableMap.get(table);
24
+ return map.width;
25
+ };
26
+ const gutterPadding = akEditorGutterPaddingDynamic() * 2;
27
+ const COLUMN_MIN_WIDTH = 48;
28
+ export const isTableResizingEnabled = appearance => isFullWidthOrFullPageAppearance(appearance) || isCommentAppearance(appearance) && editorExperiment('support_table_in_comment', true, {
29
+ exposure: true
30
+ });
31
+ export const isStickyScrollbarEnabled = appearance => isFullWidthOrFullPageAppearance(appearance) && editorExperiment('platform_renderer_table_sticky_scrollbar', true, {
32
+ exposure: true
33
+ });
34
+ export const orderChildren = (children, tableNode, smartCardStorage, tableOrderStatus) => {
35
+ if (!tableOrderStatus || tableOrderStatus.order === SortOrder.NO_ORDER) {
36
+ return children;
37
+ }
38
+ const {
39
+ order,
40
+ columnIndex
41
+ } = tableOrderStatus;
42
+ const compareNodesInOrder = createCompareNodes({
43
+ getInlineCardTextFromStore(attrs) {
44
+ const {
45
+ url
46
+ } = attrs;
47
+ if (!url) {
48
+ return null;
49
+ }
50
+ return smartCardStorage.get(url) || null;
51
+ }
52
+ }, order);
53
+ const tableArray = convertProsemirrorTableNodeToArrayOfRows(tableNode);
54
+ const tableArrayWithChildren = tableArray.map((rowNodes, index) => ({
55
+ rowNodes,
56
+ rowReact: children[index]
57
+ }));
58
+ const headerRow = tableArrayWithChildren.shift();
59
+ const sortedTable = tableArrayWithChildren.sort((rowA, rowB) => compareNodesInOrder(rowA.rowNodes[columnIndex], rowB.rowNodes[columnIndex]));
60
+ if (headerRow) {
61
+ sortedTable.unshift(headerRow);
62
+ }
63
+ return sortedTable.map(elem => elem.rowReact);
64
+ };
65
+ export const hasRowspan = row => {
66
+ let hasRowspan = false;
67
+ row.forEach(cell => hasRowspan = hasRowspan || cell.attrs.rowspan > 1);
68
+ return hasRowspan;
69
+ };
70
+ export const getRefTop = refElement => {
71
+ return Math.round(refElement.getBoundingClientRect().top);
72
+ };
73
+ export const shouldHeaderStick = (scrollTop, tableTop, tableBottom, rowHeight) => tableTop <= scrollTop && !(tableBottom - rowHeight <= scrollTop);
74
+ export const shouldHeaderPinBottom = (scrollTop, tableBottom, rowHeight) => tableBottom - rowHeight <= scrollTop && !(tableBottom < scrollTop);
75
+ export const addSortableColumn = (rows, tableOrderStatus, onSorting) => {
76
+ return React.Children.map(rows, (row, index) => {
77
+ if (index === 0) {
78
+ return /*#__PURE__*/React.cloneElement(React.Children.only(row), {
79
+ tableOrderStatus,
80
+ onSorting
81
+ });
82
+ }
83
+ return row;
84
+ });
85
+ };
86
+ export const isHeaderRowEnabled = rows => {
87
+ if (!rows.length) {
88
+ return false;
89
+ }
90
+ // Ignored via go/ees005
91
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
92
+ const {
93
+ children
94
+ } = rows[0].props;
95
+ if (!children.length) {
96
+ return false;
97
+ }
98
+ if (children.length === 1) {
99
+ return children[0].type === TableHeader;
100
+ }
101
+ return children.every(node => node.type === TableHeader);
102
+ };
103
+ export const tableCanBeSticky = (node, children) => {
104
+ return isHeaderRowEnabled(children) && node && node.firstChild && !hasRowspan(node.firstChild);
105
+ };
106
+ // Ignored via go/ees005
107
+ // eslint-disable-next-line @repo/internal/react/no-class-components
108
+ export class TableContainer extends React.Component {
109
+ constructor(...args) {
110
+ super(...args);
111
+ _defineProperty(this, "state", {
112
+ stickyMode: 'none',
113
+ wrapperWidth: 0,
114
+ headerRowHeight: 0
115
+ });
116
+ _defineProperty(this, "tableRef", /*#__PURE__*/React.createRef());
117
+ _defineProperty(this, "stickyHeaderRef", /*#__PURE__*/React.createRef());
118
+ _defineProperty(this, "stickyScrollbarRef", /*#__PURE__*/React.createRef());
119
+ // used for sync scroll + copying wrapper width to sticky header
120
+ _defineProperty(this, "stickyWrapperRef", /*#__PURE__*/React.createRef());
121
+ _defineProperty(this, "wrapperRef", /*#__PURE__*/React.createRef());
122
+ _defineProperty(this, "overflowParent", null);
123
+ _defineProperty(this, "updatedLayout", 'custom');
124
+ _defineProperty(this, "resizeObserver", null);
125
+ _defineProperty(this, "applyResizerChange", entries => {
126
+ let wrapperWidth = this.state.wrapperWidth;
127
+ let headerRowHeight = this.state.headerRowHeight;
128
+ for (const entry of entries) {
129
+ if (entry.target === this.wrapperRef.current) {
130
+ wrapperWidth = entry.contentRect.width;
131
+ } else if (entry.target === this.stickyHeaderRef.current) {
132
+ headerRowHeight = Math.round(entry.contentRect.height);
133
+ }
134
+ }
135
+ if (headerRowHeight !== this.state.headerRowHeight || wrapperWidth !== this.state.wrapperWidth) {
136
+ this.setState({
137
+ wrapperWidth,
138
+ headerRowHeight
139
+ });
140
+ }
141
+ });
142
+ _defineProperty(this, "componentWillUnmount", () => {
143
+ if (this.overflowParent) {
144
+ // Ignored via go/ees005
145
+ // eslint-disable-next-line @repo/internal/dom-events/no-unsafe-event-listeners
146
+ this.overflowParent.removeEventListener('scroll', this.onScroll);
147
+ }
148
+ if (this.nextFrame) {
149
+ cancelAnimationFrame(this.nextFrame);
150
+ }
151
+ if (this.resizeObserver) {
152
+ this.resizeObserver.disconnect();
153
+ }
154
+ if (this.stickyScrollbar) {
155
+ this.stickyScrollbar.dispose();
156
+ }
157
+ });
158
+ _defineProperty(this, "getScrollTop", () => {
159
+ const {
160
+ stickyHeaders
161
+ } = this.props;
162
+ const offsetTop = stickyHeaders && stickyHeaders.offsetTop || 0;
163
+ return (this.overflowParent ? this.overflowParent.top : 0) + offsetTop;
164
+ });
165
+ _defineProperty(this, "updateSticky", () => {
166
+ const tableElem = this.tableRef.current;
167
+ const refElem = this.stickyHeaderRef.current;
168
+ if (!tableElem || !refElem) {
169
+ return;
170
+ }
171
+ const scrollTop = this.getScrollTop() + tableStickyPadding;
172
+ const tableTop = getRefTop(tableElem);
173
+ const tableBottom = tableTop + tableElem.clientHeight;
174
+ const shouldSticky = shouldHeaderStick(scrollTop, tableTop, tableBottom, refElem.clientHeight);
175
+ const shouldPin = shouldHeaderPinBottom(scrollTop, tableBottom, refElem.clientHeight);
176
+ let stickyMode = 'none';
177
+ if (shouldPin) {
178
+ stickyMode = 'pin-bottom';
179
+ } else if (shouldSticky) {
180
+ stickyMode = 'stick';
181
+ }
182
+ if (this.state.stickyMode !== stickyMode) {
183
+ this.setState({
184
+ stickyMode
185
+ });
186
+ }
187
+ this.nextFrame = undefined;
188
+ });
189
+ _defineProperty(this, "onScroll", () => {
190
+ if (!this.nextFrame) {
191
+ this.nextFrame = requestAnimationFrame(this.updateSticky);
192
+ }
193
+ });
194
+ _defineProperty(this, "onWrapperScrolled", () => {
195
+ if (!this.wrapperRef.current || !this.stickyWrapperRef.current) {
196
+ return;
197
+ }
198
+ this.stickyWrapperRef.current.scrollLeft = this.wrapperRef.current.scrollLeft;
199
+ if (this.stickyScrollbarRef.current) {
200
+ this.stickyScrollbarRef.current.scrollLeft = this.wrapperRef.current.scrollLeft;
201
+ }
202
+ });
203
+ _defineProperty(this, "grabFirstRowRef", children => {
204
+ // Ignored via go/ees005
205
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
206
+ return React.Children.map(children || false, (child, idx) => {
207
+ if (idx === 0 && /*#__PURE__*/React.isValidElement(child)) {
208
+ return /*#__PURE__*/React.cloneElement(child, {
209
+ innerRef: this.stickyHeaderRef
210
+ });
211
+ }
212
+ return child;
213
+ });
214
+ });
215
+ }
216
+ componentDidMount() {
217
+ this.resizeObserver = new ResizeObserver(this.applyResizerChange);
218
+ if (this.wrapperRef.current) {
219
+ this.resizeObserver.observe(this.wrapperRef.current);
220
+ }
221
+ if (this.stickyHeaderRef.current) {
222
+ this.resizeObserver.observe(this.stickyHeaderRef.current);
223
+ }
224
+ if (this.props.stickyHeaders) {
225
+ var _this$props$stickyHea;
226
+ this.overflowParent = OverflowParent.fromElement(this.tableRef.current, (_this$props$stickyHea = this.props.stickyHeaders) === null || _this$props$stickyHea === void 0 ? void 0 : _this$props$stickyHea.defaultScrollRootId_DO_NOT_USE);
227
+ // Ignored via go/ees005
228
+ // eslint-disable-next-line @repo/internal/dom-events/no-unsafe-event-listeners
229
+ this.overflowParent.addEventListener('scroll', this.onScroll);
230
+ }
231
+ if (this.wrapperRef.current && isStickyScrollbarEnabled(this.props.rendererAppearance)) {
232
+ this.stickyScrollbar = new TableStickyScrollbar(this.wrapperRef.current);
233
+ }
234
+ }
235
+ componentDidUpdate(prevProps, prevState) {
236
+ // toggling sticky headers visiblity
237
+ if (this.props.stickyHeaders && !this.overflowParent) {
238
+ var _this$props$stickyHea2;
239
+ this.overflowParent = OverflowParent.fromElement(this.tableRef.current, (_this$props$stickyHea2 = this.props.stickyHeaders) === null || _this$props$stickyHea2 === void 0 ? void 0 : _this$props$stickyHea2.defaultScrollRootId_DO_NOT_USE);
240
+ } else if (!this.props.stickyHeaders && this.overflowParent) {
241
+ // Ignored via go/ees005
242
+ // eslint-disable-next-line @repo/internal/dom-events/no-unsafe-event-listeners
243
+ this.overflowParent.removeEventListener('scroll', this.onScroll);
244
+ this.overflowParent = null;
245
+ }
246
+
247
+ // offsetTop might have changed, re-position sticky header
248
+ if (this.props.stickyHeaders !== prevProps.stickyHeaders) {
249
+ this.updateSticky();
250
+ }
251
+
252
+ // sync horizontal scroll in floating div when toggling modes
253
+ if (prevState.stickyMode !== this.state.stickyMode) {
254
+ this.onWrapperScrolled();
255
+ }
256
+ }
257
+ get pinTop() {
258
+ if (!this.tableRef.current || !this.stickyHeaderRef.current) {
259
+ return;
260
+ }
261
+ return this.tableRef.current.offsetHeight - this.stickyHeaderRef.current.offsetHeight + tableMarginTop - tableStickyPadding;
262
+ }
263
+ get shouldAddOverflowParentOffsetTop_DO_NOT_USE() {
264
+ // IF the StickyHeaderConfig specifies that the default scroll root offsetTop should be added
265
+ // AND the StickyHeaderConfig specifies a default scroll root id
266
+ // AND the OverflowParent is the corresponding element
267
+ // THEN we should add the OverflowParent offset top (RETURN TRUE)
268
+ return this.props.stickyHeaders && !!this.props.stickyHeaders.shouldAddDefaultScrollRootOffsetTop_DO_NOT_USE && !!this.props.stickyHeaders.defaultScrollRootId_DO_NOT_USE && this.overflowParent && this.overflowParent.id === this.props.stickyHeaders.defaultScrollRootId_DO_NOT_USE;
269
+ }
270
+ get stickyTop() {
271
+ switch (this.state.stickyMode) {
272
+ case 'pin-bottom':
273
+ return this.pinTop;
274
+ case 'stick':
275
+ const offsetTop = this.props.stickyHeaders && this.props.stickyHeaders.offsetTop;
276
+ if (typeof offsetTop === 'number' && this.shouldAddOverflowParentOffsetTop_DO_NOT_USE) {
277
+ const overflowParentOffsetTop = this.overflowParent ? this.overflowParent.top : 0;
278
+ return offsetTop + overflowParentOffsetTop;
279
+ } else {
280
+ return offsetTop;
281
+ }
282
+ default:
283
+ return undefined;
284
+ }
285
+ }
286
+ render() {
287
+ var _this$tableRef$curren;
288
+ const {
289
+ isNumberColumnEnabled,
290
+ layout,
291
+ renderWidth,
292
+ columnWidths,
293
+ stickyHeaders,
294
+ tableNode,
295
+ rendererAppearance,
296
+ isInsideOfBlockNode,
297
+ isInsideOfTable,
298
+ isinsideMultiBodiedExtension,
299
+ allowTableResizing,
300
+ isPresentational
301
+ } = this.props;
302
+ const {
303
+ stickyMode
304
+ } = this.state;
305
+ const tableWidthAttribute = tableNode !== null && tableNode !== void 0 && tableNode.attrs.width ? `${tableNode === null || tableNode === void 0 ? void 0 : tableNode.attrs.width}px` : `100%`;
306
+ const children = React.Children.toArray(this.props.children);
307
+ let tableMinWidth;
308
+ if (tableNode) {
309
+ tableMinWidth = getResizerMinWidth(tableNode);
310
+ }
311
+
312
+ // Historically, tables in the full-width renderer had their layout set to 'default' which is deceiving.
313
+ // This check caters for those tables and helps with SSR logic
314
+ const isFullWidth = !(tableNode !== null && tableNode !== void 0 && tableNode.attrs.width) && rendererAppearance === 'full-width' && layout !== 'full-width';
315
+ if (isFullWidth) {
316
+ this.updatedLayout = 'full-width';
317
+ // if table has width explicity set, ensure SSR is handled
318
+ } else if (tableNode !== null && tableNode !== void 0 && tableNode.attrs.width) {
319
+ this.updatedLayout = 'custom';
320
+ } else {
321
+ this.updatedLayout = layout;
322
+ }
323
+ return /*#__PURE__*/React.createElement("div", {
324
+ // eslint-disable-next-line @atlaskit/ui-styling-standard/enforce-style-prop -- Ignored via go/DSP-18766
325
+ className: "table-alignment-container"
326
+ // eslint-disable-next-line @atlaskit/ui-styling-standard/enforce-style-prop
327
+ ,
328
+ style: {
329
+ display: 'flex',
330
+ justifyContent: 'center'
331
+ }
332
+ }, /*#__PURE__*/React.createElement("div", {
333
+ // eslint-disable-next-line @atlaskit/ui-styling-standard/enforce-style-prop -- Ignored via go/DSP-18766
334
+ className: "pm-table-resizer-container"
335
+ // eslint-disable-next-line @atlaskit/ui-styling-standard/enforce-style-prop
336
+ ,
337
+ style: {
338
+ width: `min(calc(100cqw - ${gutterPadding}px) ${tableWidthAttribute}`
339
+ }
340
+ }, /*#__PURE__*/React.createElement("div", {
341
+ // eslint-disable-next-line @atlaskit/ui-styling-standard/enforce-style-prop -- Ignored via go/DSP-18766
342
+ className: "resizer-item display-handle",
343
+ style: {
344
+ // eslint-disable-next-line @atlaskit/ui-styling-standard/enforce-style-prop
345
+ position: 'relative',
346
+ userSelect: 'auto',
347
+ boxSizing: 'border-box',
348
+ ['--ak-editor-table-gutter-padding']: `${gutterPadding}px`,
349
+ ['--ak-editor-table-max-width']: `1800px`,
350
+ ['--ak-editor-table-min-width']: `${tableMinWidth}px`,
351
+ // eslint-disable-next-line @atlaskit/ui-styling-standard/enforce-style-prop
352
+ minWidth: 'var(--ak-editor-table-min-width)',
353
+ maxWidth: `min(calc(100cqw - var(--ak-editor-table-gutter-padding)), var(--ak-editor-table-max-width))`,
354
+ width: `min(calc(100cqw - var(--ak-editor-table-gutter-padding)), ${tableWidthAttribute})`
355
+ }
356
+ }, /*#__PURE__*/React.createElement("span", {
357
+ className: "resizer-hover-zone"
358
+ }, /*#__PURE__*/React.createElement("div", {
359
+ // eslint-disable-next-line @atlaskit/ui-styling-standard/no-classname-prop -- Ignored via go/DSP-18766
360
+ className: `${TableSharedCssClassName.TABLE_CONTAINER} ${this.props.shadowClassNames || ''}`,
361
+ "data-number-column": tableNode === null || tableNode === void 0 ? void 0 : tableNode.attrs.isNumberColumnEnabled,
362
+ "data-layout": this.updatedLayout,
363
+ "data-testid": "table-container",
364
+ ref: this.props.handleRef
365
+ // eslint-disable-next-line @atlaskit/ui-styling-standard/enforce-style-prop -- Ignored via go/DSP-18766
366
+ }, isStickyScrollbarEnabled(this.props.rendererAppearance) && /*#__PURE__*/React.createElement("div", {
367
+ // eslint-disable-next-line @atlaskit/ui-styling-standard/no-classname-prop -- Ignored via go/DSP-18766
368
+ className: TableSharedCssClassName.TABLE_STICKY_SCROLLBAR_SENTINEL_TOP,
369
+ "data-testid": "sticky-scrollbar-sentinel-top"
370
+ }), stickyHeaders && tableNode && tableCanBeSticky(tableNode, children) && /*#__PURE__*/React.createElement(StickyTable, {
371
+ isNumberColumnEnabled: isNumberColumnEnabled,
372
+ renderWidth: renderWidth,
373
+ tableWidth: "inherit",
374
+ layout: layout,
375
+ handleRef: this.props.handleRef,
376
+ shadowClassNames: this.props.shadowClassNames,
377
+ top: this.stickyTop,
378
+ mode: stickyMode,
379
+ innerRef: this.stickyWrapperRef,
380
+ wrapperWidth: this.state.wrapperWidth,
381
+ columnWidths: columnWidths,
382
+ rowHeight: this.state.headerRowHeight,
383
+ tableNode: tableNode,
384
+ rendererAppearance: rendererAppearance,
385
+ allowTableResizing: allowTableResizing
386
+ }, [children && children[0]]), /*#__PURE__*/React.createElement("div", {
387
+ // eslint-disable-next-line @atlaskit/ui-styling-standard/no-classname-prop -- Ignored via go/DSP-18766
388
+ className: TableSharedCssClassName.TABLE_NODE_WRAPPER,
389
+ ref: this.wrapperRef,
390
+ "data-number-column": tableNode === null || tableNode === void 0 ? void 0 : tableNode.attrs.isNumberColumnEnabled,
391
+ "data-layout": tableNode === null || tableNode === void 0 ? void 0 : tableNode.attrs.layout,
392
+ "data-autosize": tableNode === null || tableNode === void 0 ? void 0 : tableNode.attrs.__autoSize,
393
+ "data-table-local-id": tableNode === null || tableNode === void 0 ? void 0 : tableNode.attrs.localId,
394
+ "data-table-width": tableNode === null || tableNode === void 0 ? void 0 : tableNode.attrs.width,
395
+ "data-vc": "table-node-wrapper",
396
+ onScroll: this.props.stickyHeaders && this.onWrapperScrolled
397
+ }, /*#__PURE__*/React.createElement(Table, {
398
+ innerRef: this.tableRef,
399
+ columnWidths: columnWidths,
400
+ layout: layout,
401
+ isNumberColumnEnabled: isNumberColumnEnabled,
402
+ renderWidth: renderWidth,
403
+ tableNode: tableNode,
404
+ rendererAppearance: rendererAppearance,
405
+ isInsideOfBlockNode: isInsideOfBlockNode,
406
+ isInsideOfTable: isInsideOfTable,
407
+ isinsideMultiBodiedExtension: isinsideMultiBodiedExtension,
408
+ allowTableResizing: allowTableResizing,
409
+ isPresentational: isPresentational
410
+ }, this.grabFirstRowRef(children))), isStickyScrollbarEnabled(this.props.rendererAppearance) && /*#__PURE__*/React.createElement("div", {
411
+ // eslint-disable-next-line @atlaskit/ui-styling-standard/no-classname-prop -- Ignored via go/DSP-18766
412
+ className: TableSharedCssClassName.TABLE_STICKY_SCROLLBAR_CONTAINER,
413
+ ref: this.stickyScrollbarRef,
414
+ "data-vc": "table-sticky-scrollbar-container",
415
+ style: {
416
+ // eslint-disable-next-line @atlaskit/ui-styling-standard/enforce-style-prop -- Ignored via go/DSP-18766
417
+ height: "var(--ds-space-250, 20px)",
418
+ // MAX_BROWSER_SCROLLBAR_HEIGHT
419
+ // Follow editor to hide by default so it does not show empty gap in SSR
420
+ // https://stash.atlassian.com/projects/ATLASSIAN/repos/atlassian-frontend-monorepo/browse/platform/packages/editor/editor-plugin-table/src/nodeviews/TableComponent.tsx#957
421
+ // eslint-disable-next-line @atlaskit/ui-styling-standard/enforce-style-prop -- Ignored via go/DSP-18766
422
+ display: 'block',
423
+ // eslint-disable-next-line @atlaskit/ui-styling-standard/enforce-style-prop
424
+ width: '100%'
425
+ }
426
+ }, /*#__PURE__*/React.createElement("div", {
427
+ style: {
428
+ width: (_this$tableRef$curren = this.tableRef.current) === null || _this$tableRef$curren === void 0 ? void 0 : _this$tableRef$curren.clientWidth,
429
+ // eslint-disable-next-line @atlaskit/ui-styling-standard/enforce-style-prop -- Ignored via go/DSP-18766
430
+ height: '100%'
431
+ }
432
+ })), isStickyScrollbarEnabled(this.props.rendererAppearance) && /*#__PURE__*/React.createElement("div", {
433
+ // eslint-disable-next-line @atlaskit/ui-styling-standard/no-classname-prop -- Ignored via go/DSP-18766
434
+ className: TableSharedCssClassName.TABLE_STICKY_SCROLLBAR_SENTINEL_BOTTOM,
435
+ "data-testid": "sticky-scrollbar-sentinel-bottom"
436
+ }))))));
437
+ }
438
+ }
439
+ // Ignored via go/ees005
440
+ // eslint-disable-next-line @repo/internal/react/no-class-components
441
+ export class TableProcessorWithContainerStyles extends React.Component {
442
+ constructor(...args) {
443
+ super(...args);
444
+ _defineProperty(this, "state", {
445
+ tableOrderStatus: undefined
446
+ });
447
+ // adds sortable + re-orders children
448
+ _defineProperty(this, "addSortableColumn", childrenArray => {
449
+ const {
450
+ tableNode,
451
+ allowColumnSorting,
452
+ smartCardStorage
453
+ } = this.props;
454
+ const {
455
+ tableOrderStatus
456
+ } = this.state;
457
+ if (allowColumnSorting && isHeaderRowEnabled(childrenArray) && tableNode && !hasMergedCell(tableNode)) {
458
+ return addSortableColumn(orderChildren(childrenArray, tableNode, smartCardStorage, tableOrderStatus), tableOrderStatus, this.changeSortOrder);
459
+ }
460
+ return childrenArray;
461
+ });
462
+ _defineProperty(this, "changeSortOrder", (columnIndex, sortOrder) => {
463
+ this.setState({
464
+ tableOrderStatus: {
465
+ columnIndex,
466
+ order: sortOrder
467
+ }
468
+ });
469
+ });
470
+ // Ignored via go/ees005
471
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
472
+ _defineProperty(this, "addNumberColumnIndexes", rows => {
473
+ const {
474
+ isNumberColumnEnabled
475
+ } = this.props;
476
+ const headerRowEnabled = isHeaderRowEnabled(rows);
477
+ return React.Children.map(rows, (row, index) => {
478
+ return /*#__PURE__*/React.cloneElement(React.Children.only(row), {
479
+ isNumberColumnEnabled,
480
+ index: headerRowEnabled ? index === 0 ? '' : index : index + 1
481
+ });
482
+ });
483
+ });
484
+ }
485
+ render() {
486
+ const {
487
+ children
488
+ } = this.props;
489
+ if (!children) {
490
+ return null;
491
+ }
492
+ const childrenArray = React.Children.toArray(children);
493
+ const orderedChildren = compose(this.addNumberColumnIndexes, this.addSortableColumn
494
+ // @ts-expect-error TS2345: Argument of type '(ReactChild | ReactFragment | ReactPortal)[]' is not assignable to parameter of type 'ReactElement<any, string | JSXElementConstructor<any>>[]'
495
+ )(childrenArray);
496
+
497
+ // Ignored via go/ees005
498
+ // eslint-disable-next-line react/jsx-props-no-spreading
499
+ return /*#__PURE__*/React.createElement(TableContainer, this.props, orderedChildren);
500
+ }
501
+ }
@@ -8,7 +8,7 @@ import { css, jsx } from '@emotion/react';
8
8
  import React, { useCallback, useRef } from 'react';
9
9
  // eslint-disable-next-line @atlaskit/design-system/no-deprecated-imports
10
10
  import { ACTION, ACTION_SUBJECT, EVENT_TYPE } from '@atlaskit/editor-common/analytics';
11
- import { clearNextSiblingMarginTopStyle, ExpandIconWrapper, ExpandLayoutWrapperWithRef, expandMessages, sharedExpandStyles, WidthProvider } from '@atlaskit/editor-common/ui';
11
+ import { ExpandIconWrapper, ExpandLayoutWrapperWithRef, expandMessages, WidthProvider } from '@atlaskit/editor-common/ui';
12
12
  import { akEditorLineHeight, akEditorSwoopCubicBezier, akLayoutGutterOffset } from '@atlaskit/editor-shared-styles';
13
13
  import { default as ChevronRightIconLegacy } from '@atlaskit/icon/glyph/chevron-right';
14
14
  import ChevronRightIcon from '@atlaskit/icon/utility/chevron-right';
@@ -17,7 +17,6 @@ import _uniqueId from 'lodash/uniqueId';
17
17
  import { injectIntl } from 'react-intl-next';
18
18
  import { MODE, PLATFORM } from '../analytics/events';
19
19
  import { ActiveHeaderIdConsumer } from './active-header-id-provider';
20
- import { componentWithFG } from '@atlaskit/platform-feature-flags-react';
21
20
  const titleStyles = css({
22
21
  outline: 'none',
23
22
  border: 'none',
@@ -117,55 +116,21 @@ const contentContainerStylesNotExpanded = css({
117
116
  userSelect: 'none'
118
117
  }
119
118
  });
120
- const ContainerOld = props => {
121
- const paddingBottom = props.expanded ? "var(--ds-space-100, 8px)" : "var(--ds-space-0, 0px)";
122
- const sharedContainerStyles = sharedExpandStyles.containerStyles(props);
123
-
124
- // eslint-disable-next-line @atlaskit/design-system/no-css-tagged-template-expression -- needs manual remediation
125
- const styles = () => css`
126
- ${sharedContainerStyles()}
127
- padding: 0;
128
- padding-bottom: ${paddingBottom};
129
- `;
130
- return (
131
- // Ignored via go/ees005
132
- // eslint-disable-next-line react/jsx-props-no-spreading, @atlaskit/design-system/consistent-css-prop-usage
133
- jsx("div", _extends({
134
- css: styles
135
- }, props), props.children)
136
- );
137
- };
138
- const ContainerNew = props => {
119
+ const clearNextSiblingMarginTopStyle = css({
120
+ // eslint-disable-next-line @atlaskit/ui-styling-standard/no-nested-selectors -- Ignored via go/DSP-18766
121
+ '& + *': {
122
+ // eslint-disable-next-line @atlaskit/design-system/ensure-design-token-usage/preview, @atlaskit/ui-styling-standard/no-important-styles -- Ignored via go/DSP-18766
123
+ marginTop: '0 !important'
124
+ }
125
+ });
126
+ const Container = props => {
139
127
  return jsx("div", _extends({
140
128
  css: [containerStyles, props['data-node-type'] === 'expand' && containerStylesDataNodeTypeExpand, props.expanded && containerStylesExpanded, props.focused && containerStylesFocused]
141
129
  // Ignored via go/ees005
142
130
  // eslint-disable-next-line react/jsx-props-no-spreading
143
131
  }, props), props.children);
144
132
  };
145
- const Container = componentWithFG('platform_editor_emotion_refactor_renderer', ContainerNew, ContainerOld);
146
- const TitleContainerOld = props => {
147
- const paddingBottom = !props.expanded ? "var(--ds-space-100, 8px)" : "var(--ds-space-0, 0px)";
148
-
149
- // eslint-disable-next-line @atlaskit/design-system/no-css-tagged-template-expression -- needs manual remediation
150
- const styles = () => css`
151
- ${sharedExpandStyles.titleContainerStyles()}
152
- padding: ${"var(--ds-space-100, 8px)"};
153
- padding-bottom: ${paddingBottom};
154
- `;
155
- const {
156
- expanded,
157
- ...buttonProps
158
- } = props;
159
- return (
160
- // Ignored via go/ees005
161
- // eslint-disable-next-line react/jsx-props-no-spreading, @atlaskit/design-system/consistent-css-prop-usage, @atlaskit/design-system/no-html-button
162
- jsx("button", _extends({
163
- type: "button",
164
- css: styles
165
- }, buttonProps), props.children)
166
- );
167
- };
168
- const TitleContainerNew = props => {
133
+ const TitleContainer = props => {
169
134
  const {
170
135
  expanded,
171
136
  ...buttonProps
@@ -180,35 +145,14 @@ const TitleContainerNew = props => {
180
145
  }, buttonProps), props.children)
181
146
  );
182
147
  };
183
- const TitleContainer = componentWithFG('platform_editor_emotion_refactor_renderer', TitleContainerNew, TitleContainerOld);
184
148
  TitleContainer.displayName = 'TitleContainerButton';
185
- const ContentContainerOld = props => {
186
- const sharedContentStyles = sharedExpandStyles.contentStyles(props);
187
- const visibility = props.expanded ? 'visible' : 'hidden';
188
-
189
- // eslint-disable-next-line @atlaskit/design-system/no-css-tagged-template-expression -- needs manual remediation
190
- const styles = () => css`
191
- ${sharedContentStyles()};
192
- padding-right: ${"var(--ds-space-200, 16px)"};
193
- padding-left: ${"var(--ds-space-400, 32px)"};
194
- visibility: ${visibility};
195
- `;
196
- return (
197
- // Ignored via go/ees005
198
- // eslint-disable-next-line react/jsx-props-no-spreading, @atlaskit/design-system/consistent-css-prop-usage
199
- jsx("div", _extends({
200
- css: styles
201
- }, props), props.children)
202
- );
203
- };
204
- const ContentContainerNew = props => {
149
+ const ContentContainer = props => {
205
150
  return jsx("div", _extends({
206
151
  css: [contentContainerStyles, props.expanded && contentContainerStylesExpanded, !props.expanded && contentContainerStylesNotExpanded]
207
152
  // Ignored via go/ees005
208
153
  // eslint-disable-next-line react/jsx-props-no-spreading
209
154
  }, props), props.children);
210
155
  };
211
- const ContentContainer = componentWithFG('platform_editor_emotion_refactor_renderer', ContentContainerNew, ContentContainerOld);
212
156
  function fireExpandToggleAnalytics(nodeType, expanded, fireAnalyticsEvent) {
213
157
  if (!fireAnalyticsEvent) {
214
158
  return;