@atlaskit/renderer 91.0.0 → 93.0.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 (113) hide show
  1. package/CHANGELOG.md +49 -0
  2. package/dist/cjs/analytics/enums.js +2 -0
  3. package/dist/cjs/react/marks/alignment.js +11 -12
  4. package/dist/cjs/react/marks/breakout.js +7 -9
  5. package/dist/cjs/react/marks/link.js +13 -6
  6. package/dist/cjs/react/nodes/codeBlock.js +17 -16
  7. package/dist/cjs/react/nodes/codeBlockCopyButton.js +13 -11
  8. package/dist/cjs/react/nodes/embedCard.js +25 -33
  9. package/dist/cjs/react/nodes/heading-anchor.js +7 -6
  10. package/dist/cjs/react/nodes/heading.js +4 -2
  11. package/dist/cjs/react/nodes/layoutColumn.js +7 -2
  12. package/dist/cjs/react/nodes/media.js +7 -6
  13. package/dist/cjs/react/nodes/mediaSingle/index.js +15 -4
  14. package/dist/cjs/react/nodes/mediaSingle/styles.js +7 -10
  15. package/dist/cjs/react/nodes/panel.js +26 -16
  16. package/dist/cjs/react/nodes/table/sticky.js +63 -55
  17. package/dist/cjs/react/nodes/table.js +2 -10
  18. package/dist/cjs/react/utils/inject-props.js +33 -0
  19. package/dist/cjs/react/utils/performance/RenderTracking.js +52 -0
  20. package/dist/cjs/ui/Expand.js +52 -28
  21. package/dist/cjs/ui/MediaCard.js +4 -14
  22. package/dist/cjs/ui/Renderer/index.js +72 -64
  23. package/dist/cjs/ui/Renderer/style.js +62 -55
  24. package/dist/cjs/ui/Renderer/truncated-wrapper.js +19 -21
  25. package/dist/cjs/ui/SortingIcon.js +8 -9
  26. package/dist/cjs/ui/annotations/draft/component.js +22 -12
  27. package/dist/cjs/ui/annotations/element/mark.js +9 -5
  28. package/dist/cjs/ui/renderer-props.js +1 -3
  29. package/dist/cjs/version.json +1 -1
  30. package/dist/es2019/analytics/enums.js +2 -0
  31. package/dist/es2019/react/marks/alignment.js +15 -7
  32. package/dist/es2019/react/marks/breakout.js +6 -5
  33. package/dist/es2019/react/marks/link.js +8 -5
  34. package/dist/es2019/react/nodes/codeBlock.js +25 -23
  35. package/dist/es2019/react/nodes/codeBlockCopyButton.js +12 -9
  36. package/dist/es2019/react/nodes/embedCard.js +16 -16
  37. package/dist/es2019/react/nodes/heading-anchor.js +9 -6
  38. package/dist/es2019/react/nodes/heading.js +4 -2
  39. package/dist/es2019/react/nodes/layoutColumn.js +7 -3
  40. package/dist/es2019/react/nodes/media.js +9 -5
  41. package/dist/es2019/react/nodes/mediaSingle/index.js +10 -6
  42. package/dist/es2019/react/nodes/mediaSingle/styles.js +6 -7
  43. package/dist/es2019/react/nodes/panel.js +23 -16
  44. package/dist/es2019/react/nodes/table/sticky.js +55 -37
  45. package/dist/es2019/react/nodes/table.js +2 -5
  46. package/dist/es2019/react/utils/inject-props.js +24 -0
  47. package/dist/es2019/react/utils/performance/RenderTracking.js +37 -0
  48. package/dist/es2019/ui/Expand.js +65 -36
  49. package/dist/es2019/ui/MediaCard.js +3 -6
  50. package/dist/es2019/ui/Renderer/index.js +72 -57
  51. package/dist/es2019/ui/Renderer/style.js +370 -327
  52. package/dist/es2019/ui/Renderer/truncated-wrapper.js +26 -15
  53. package/dist/es2019/ui/SortingIcon.js +9 -7
  54. package/dist/es2019/ui/annotations/draft/component.js +18 -12
  55. package/dist/es2019/ui/annotations/element/mark.js +12 -6
  56. package/dist/es2019/ui/renderer-props.js +1 -1
  57. package/dist/es2019/version.json +1 -1
  58. package/dist/esm/analytics/enums.js +2 -0
  59. package/dist/esm/react/marks/alignment.js +13 -6
  60. package/dist/esm/react/marks/breakout.js +6 -5
  61. package/dist/esm/react/marks/link.js +7 -5
  62. package/dist/esm/react/nodes/codeBlock.js +18 -14
  63. package/dist/esm/react/nodes/codeBlockCopyButton.js +10 -7
  64. package/dist/esm/react/nodes/embedCard.js +19 -19
  65. package/dist/esm/react/nodes/heading-anchor.js +8 -6
  66. package/dist/esm/react/nodes/heading.js +4 -2
  67. package/dist/esm/react/nodes/layoutColumn.js +7 -3
  68. package/dist/esm/react/nodes/media.js +8 -5
  69. package/dist/esm/react/nodes/mediaSingle/index.js +11 -6
  70. package/dist/esm/react/nodes/mediaSingle/styles.js +5 -7
  71. package/dist/esm/react/nodes/panel.js +27 -15
  72. package/dist/esm/react/nodes/table/sticky.js +64 -53
  73. package/dist/esm/react/nodes/table.js +2 -8
  74. package/dist/esm/react/utils/inject-props.js +24 -0
  75. package/dist/esm/react/utils/performance/RenderTracking.js +39 -0
  76. package/dist/esm/ui/Expand.js +57 -29
  77. package/dist/esm/ui/MediaCard.js +3 -9
  78. package/dist/esm/ui/Renderer/index.js +74 -61
  79. package/dist/esm/ui/Renderer/style.js +58 -51
  80. package/dist/esm/ui/Renderer/truncated-wrapper.js +20 -14
  81. package/dist/esm/ui/SortingIcon.js +9 -7
  82. package/dist/esm/ui/annotations/draft/component.js +18 -11
  83. package/dist/esm/ui/annotations/element/mark.js +11 -4
  84. package/dist/esm/ui/renderer-props.js +1 -1
  85. package/dist/esm/version.json +1 -1
  86. package/dist/types/analytics/enums.d.ts +2 -0
  87. package/dist/types/analytics/events.d.ts +12 -2
  88. package/dist/types/react/marks/alignment.d.ts +2 -2
  89. package/dist/types/react/marks/breakout.d.ts +4 -3
  90. package/dist/types/react/marks/link.d.ts +2 -2
  91. package/dist/types/react/nodes/codeBlock.d.ts +4 -14
  92. package/dist/types/react/nodes/embedCard.d.ts +3 -2
  93. package/dist/types/react/nodes/heading-anchor.d.ts +1 -0
  94. package/dist/types/react/nodes/heading.d.ts +1 -0
  95. package/dist/types/react/nodes/index.d.ts +1 -13
  96. package/dist/types/react/nodes/layoutColumn.d.ts +3 -1
  97. package/dist/types/react/nodes/media.d.ts +3 -1
  98. package/dist/types/react/nodes/mediaSingle/index.d.ts +1 -0
  99. package/dist/types/react/nodes/mediaSingle/styles.d.ts +2 -3
  100. package/dist/types/react/nodes/panel.d.ts +3 -1
  101. package/dist/types/react/nodes/table/sticky.d.ts +4 -2
  102. package/dist/types/react/utils/inject-props.d.ts +6 -0
  103. package/dist/types/react/utils/performance/RenderTracking.d.ts +15 -0
  104. package/dist/types/ui/Expand.d.ts +3 -2
  105. package/dist/types/ui/MediaCard.d.ts +1 -3
  106. package/dist/types/ui/Renderer/index.d.ts +3 -26
  107. package/dist/types/ui/Renderer/style.d.ts +2 -3
  108. package/dist/types/ui/Renderer/truncated-wrapper.d.ts +3 -1
  109. package/dist/types/ui/SortingIcon.d.ts +3 -3
  110. package/dist/types/ui/annotations/draft/component.d.ts +1 -0
  111. package/dist/types/ui/annotations/element/mark.d.ts +1 -0
  112. package/dist/types/ui/renderer-props.d.ts +14 -2
  113. package/package.json +22 -23
@@ -11,10 +11,12 @@ function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflec
11
11
 
12
12
  function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
13
13
 
14
+ /** @jsx jsx */
14
15
  import React from 'react';
15
16
  import { PureComponent } from 'react';
17
+ import { jsx } from '@emotion/react';
16
18
  import { WithProviders } from '@atlaskit/editor-common/provider-factory';
17
- import { MediaLink } from '@atlaskit/editor-common/ui';
19
+ import { mediaLinkStyle } from '@atlaskit/editor-common/ui';
18
20
  import { MediaCard } from '../../ui/MediaCard';
19
21
  import { getEventHandler } from '../../utils';
20
22
  import { ACTION, ACTION_SUBJECT, ACTION_SUBJECT_ID, EVENT_TYPE } from '../../analytics/enums';
@@ -53,7 +55,7 @@ var Media = /*#__PURE__*/function (_PureComponent) {
53
55
  var linkHref = linkMark === null || linkMark === void 0 ? void 0 : linkMark.attrs.href;
54
56
  var eventHandlers = linkHref ? undefined : _this.props.eventHandlers;
55
57
  var shouldOpenMediaViewer = !linkHref && allowMediaViewer;
56
- var mediaComponent = /*#__PURE__*/React.createElement(MediaCard, _extends({
58
+ var mediaComponent = jsx(MediaCard, _extends({
57
59
  mediaProvider: mediaProvider,
58
60
  contextIdentifierProvider: contextIdentifierProvider
59
61
  }, _this.props, {
@@ -64,11 +66,12 @@ var Media = /*#__PURE__*/function (_PureComponent) {
64
66
  shouldEnableDownloadButton: enableDownloadButton,
65
67
  ssr: ssr
66
68
  }));
67
- return linkHref ? /*#__PURE__*/React.createElement(MediaLink, {
69
+ return linkHref ? jsx("a", {
68
70
  href: linkHref,
69
71
  rel: "noreferrer noopener",
70
72
  onClick: _this.handleMediaLinkClick,
71
- "data-block-link": linkHref
73
+ "data-block-link": linkHref,
74
+ css: mediaLinkStyle
72
75
  }, mediaComponent) : mediaComponent;
73
76
  });
74
77
 
@@ -115,7 +118,7 @@ var Media = /*#__PURE__*/function (_PureComponent) {
115
118
  return this.renderCard();
116
119
  }
117
120
 
118
- return /*#__PURE__*/React.createElement(WithProviders, {
121
+ return jsx(WithProviders, {
119
122
  providers: ['mediaProvider', 'contextIdentifierProvider'],
120
123
  providerFactory: providers,
121
124
  renderNode: this.renderCard
@@ -1,12 +1,15 @@
1
1
  import _slicedToArray from "@babel/runtime/helpers/slicedToArray";
2
- import { default as React } from 'react';
2
+
3
+ /** @jsx jsx */
4
+ import { default as React, Fragment } from 'react';
5
+ import { jsx } from '@emotion/react';
3
6
  import { injectIntl } from 'react-intl-next';
4
7
  import { getMediaFeatureFlag } from '@atlaskit/media-common';
5
- import { mapBreakpointToLayoutMaxWidth, getBreakpoint, WidthConsumer } from '@atlaskit/editor-common/ui';
8
+ import { mapBreakpointToLayoutMaxWidth, getBreakpoint, MediaSingle as UIMediaSingle, WidthConsumer } from '@atlaskit/editor-common/ui';
6
9
  import { akEditorFullWidthLayoutWidth, getAkEditorFullPageMaxWidth, akEditorDefaultLayoutWidth } from '@atlaskit/editor-shared-styles';
7
10
  import { FullPagePadding } from '../../../ui/Renderer/style';
8
11
  import { useObservedWidth } from '../../hooks/use-observed-width';
9
- import { ExtendedUIMediaSingle } from './styles';
12
+ import { uiMediaSingleBaseStyles, uiMediaSingleLayoutStyles } from './styles';
10
13
  var DEFAULT_WIDTH = 250;
11
14
  var DEFAULT_HEIGHT = 200;
12
15
 
@@ -175,7 +178,9 @@ var MediaSingle = function MediaSingle(props) {
175
178
  disableOverlay: true,
176
179
  featureFlags: featureFlags
177
180
  });
178
- return /*#__PURE__*/React.createElement(ExtendedUIMediaSingle, {
181
+ var uiMediaSingleStyles = layout === 'full-width' || layout === 'wide' ? [uiMediaSingleBaseStyles, uiMediaSingleLayoutStyles] : [uiMediaSingleBaseStyles];
182
+ return jsx(UIMediaSingle, {
183
+ css: uiMediaSingleStyles,
179
184
  handleMediaSingleRef: ref,
180
185
  layout: layout,
181
186
  width: width,
@@ -184,10 +189,10 @@ var MediaSingle = function MediaSingle(props) {
184
189
  containerWidth: containerWidth,
185
190
  pctWidth: pctWidth,
186
191
  fullWidthMode: isFullWidth
187
- }, /*#__PURE__*/React.createElement(React.Fragment, null, mediaComponent), isCaptionsFlaggedOn && caption);
192
+ }, jsx(Fragment, null, mediaComponent), isCaptionsFlaggedOn && caption);
188
193
  };
189
194
 
190
- return observedWidthFlag ? renderMediaSingle(observedWidth || document.body.offsetWidth) : /*#__PURE__*/React.createElement(WidthConsumer, null, function (_ref3) {
195
+ return observedWidthFlag ? renderMediaSingle(observedWidth || document.body.offsetWidth) : jsx(WidthConsumer, null, function (_ref3) {
191
196
  var width = _ref3.width,
192
197
  breakpoint = _ref3.breakpoint;
193
198
  return renderMediaSingle(width, breakpoint);
@@ -1,10 +1,8 @@
1
1
  import _taggedTemplateLiteral from "@babel/runtime/helpers/taggedTemplateLiteral";
2
2
 
3
- var _templateObject;
3
+ var _templateObject, _templateObject2;
4
4
 
5
- import styled from 'styled-components';
6
- import { MediaSingle as UIMediaSingle } from '@atlaskit/editor-common/ui';
7
- export var ExtendedUIMediaSingle = styled(UIMediaSingle)(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n ", " transition: all 0.1s linear;\n"])), function (_ref) {
8
- var layout = _ref.layout;
9
- return layout === 'full-width' || layout === 'wide' ? "\n margin-left: 50%;\n transform: translateX(-50%);\n " : "";
10
- });
5
+ /** @jsx jsx */
6
+ import { css } from '@emotion/react';
7
+ export var uiMediaSingleBaseStyles = css(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n transition: all 0.1s linear;\n"])));
8
+ export var uiMediaSingleLayoutStyles = css(_templateObject2 || (_templateObject2 = _taggedTemplateLiteral(["\n margin-left: 50%;\n transform: translateX(-50%);\n"])));
@@ -1,9 +1,11 @@
1
+ import _extends from "@babel/runtime/helpers/extends";
1
2
  import _taggedTemplateLiteral from "@babel/runtime/helpers/taggedTemplateLiteral";
2
3
 
3
- var _templateObject;
4
+ var _templateObject, _templateObject2;
4
5
 
6
+ /** @jsx jsx */
5
7
  import React from 'react';
6
- import styled from 'styled-components';
8
+ import { css, jsx } from '@emotion/react';
7
9
  import TipIcon from '@atlaskit/icon/glyph/editor/hint';
8
10
  import { PanelType } from '@atlaskit/adf-schema';
9
11
  import { PanelSharedCssClassName } from '@atlaskit/editor-common/styles';
@@ -14,16 +16,26 @@ import EmojiItem from './emoji'; // AFP-2532 TODO: Fix automatic suppressions be
14
16
  import { themed } from '@atlaskit/theme';
15
17
  import { getPanelBackgroundDarkModeColors } from '@atlaskit/editor-common/styles';
16
18
  import { PanelInfoIcon, PanelSuccessIcon, PanelNoteIcon, PanelWarningIcon, PanelErrorIcon } from '@atlaskit/editor-common/icons';
17
- var PanelStyled = styled.div(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n ", "\n"])), function (props) {
18
- if (props['data-panel-type'] !== PanelType.CUSTOM || !props.backgroundColor) {
19
- return '';
20
- } // Similar to mainDynamicStyles()
21
19
 
20
+ var PanelStyled = function PanelStyled(props) {
21
+ var styles = function styles(themeProps) {
22
+ return css(_templateObject || (_templateObject = _taggedTemplateLiteral([""])));
23
+ };
24
+
25
+ if (props['data-panel-type'] === PanelType.CUSTOM && props.backgroundColor) {
26
+ styles = function styles(themeProps) {
27
+ return css(_templateObject2 || (_templateObject2 = _taggedTemplateLiteral(["\n &[data-panel-type=", "] {\n background-color: ", ";\n ", ";\n }\n "])), PanelType.CUSTOM, props.backgroundColor, themed({
28
+ dark: getPanelBackgroundDarkModeColors
29
+ })(themeProps));
30
+ };
31
+ }
32
+
33
+ return jsx("div", _extends({
34
+ css: styles
35
+ }, props), props.children);
36
+ };
22
37
 
23
- return "\n &[data-panel-type=".concat(PanelType.CUSTOM, "] {\n background-color: ").concat(props.backgroundColor, ";\n ").concat(themed({
24
- dark: getPanelBackgroundDarkModeColors
25
- }), ";\n }\n ");
26
- });
38
+ PanelStyled.displayName = 'PanelStyled';
27
39
  var panelIcons = {
28
40
  info: PanelInfoIcon,
29
41
  success: PanelSuccessIcon,
@@ -50,7 +62,7 @@ var Panel = function Panel(props) {
50
62
  var getIcon = function getIcon() {
51
63
  if (panelType === PanelType.CUSTOM) {
52
64
  if (panelIcon && providers) {
53
- return /*#__PURE__*/React.createElement(EmojiItem, {
65
+ return jsx(EmojiItem, {
54
66
  id: panelIconId,
55
67
  text: panelIconText,
56
68
  shortName: panelIcon,
@@ -62,7 +74,7 @@ var Panel = function Panel(props) {
62
74
  }
63
75
 
64
76
  var Icon = panelIcons[panelType];
65
- return /*#__PURE__*/React.createElement(Icon, {
77
+ return jsx(Icon, {
66
78
  label: "Panel ".concat(panelType)
67
79
  });
68
80
  };
@@ -71,13 +83,13 @@ var Panel = function Panel(props) {
71
83
  var icon = getIcon();
72
84
 
73
85
  if (icon) {
74
- return /*#__PURE__*/React.createElement("div", {
86
+ return jsx("div", {
75
87
  className: PanelSharedCssClassName.icon
76
88
  }, icon);
77
89
  }
78
90
  };
79
91
 
80
- return /*#__PURE__*/React.createElement(PanelStyled, {
92
+ return jsx(PanelStyled, {
81
93
  className: PanelSharedCssClassName.prefix,
82
94
  "data-panel-type": panelType,
83
95
  "data-panel-color": panelColor,
@@ -85,7 +97,7 @@ var Panel = function Panel(props) {
85
97
  "data-panel-icon-id": panelIconId,
86
98
  "data-panel-icon-text": panelIconText,
87
99
  backgroundColor: panelColor
88
- }, renderIcon(), /*#__PURE__*/React.createElement("div", {
100
+ }, renderIcon(), jsx("div", {
89
101
  className: PanelSharedCssClassName.content
90
102
  }, children));
91
103
  };
@@ -4,85 +4,96 @@ import _taggedTemplateLiteral from "@babel/runtime/helpers/taggedTemplateLiteral
4
4
 
5
5
  var _templateObject, _templateObject2, _templateObject3;
6
6
 
7
+ /** @jsx jsx */
7
8
  import React from 'react';
8
- import styled from 'styled-components';
9
+ import { css, jsx } from '@emotion/react';
9
10
  import { TableSharedCssClassName } from '@atlaskit/editor-common/styles';
10
11
  import { akEditorStickyHeaderZIndex } from '@atlaskit/editor-shared-styles';
11
12
  import * as colors from '@atlaskit/theme/colors';
12
13
  var N40A = colors.N40A;
13
14
  import { findHorizontalOverflowScrollParent } from '../../../utils';
14
15
  import { Table } from './table';
16
+ import { recursivelyInjectProps } from '../../utils/inject-props';
15
17
  export var tableStickyPadding = 8;
16
- // creates a new stacking context and places the div in the same
17
- // position as the table
18
- var RelativeTableDiv = styled.div.attrs({
19
- style: function style(_ref) {
20
- var left = _ref.left,
21
- top = _ref.top;
22
- return {
23
- left: left && left < 0 ? left : undefined,
24
- top: top
25
- };
26
- }
27
- })(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n position: relative;\n"])));
28
- export var FixedTableDiv = styled.div.attrs({
29
- style: function style(_ref2) {
30
- var top = _ref2.top,
31
- wrapperWidth = _ref2.wrapperWidth;
32
- return {
33
- top: top,
34
- width: wrapperWidth
35
- };
18
+ var fixedTableDivModeToPosition = {
19
+ stick: 'fixed',
20
+ 'pin-bottom': 'absolute'
21
+ };
22
+
23
+ var getModeSpecificStyles = function getModeSpecificStyles(mode) {
24
+ if (mode === 'none') {
25
+ return css(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n display: none;\n "])));
26
+ } else {
27
+ return css(_templateObject2 || (_templateObject2 = _taggedTemplateLiteral(["\n position: ", ";\n "])), fixedTableDivModeToPosition[mode]);
36
28
  }
37
- })(_templateObject2 || (_templateObject2 = _taggedTemplateLiteral(["\n ", ";\n ", ";\n ", ";\n\n z-index: ", ";\n\n &\n .", ",\n &\n .", "\n > table {\n margin-top: 0;\n margin-bottom: 0;\n }\n\n border-top: ", "px solid white;\n background: white;\n box-shadow: 0 6px 4px -4px ", ";\n\n div[data-expanded='false'] & {\n display: none;\n }\n\n &\n .", ".right-shadow::after,\n &\n .", ".left-shadow::before {\n top: 0px;\n height: 100%;\n }\n"])), function (props) {
38
- return props.mode === 'stick' ? 'position: fixed' : '';
39
- }, function (props) {
40
- return props.mode === 'pin-bottom' ? 'position: absolute' : '';
41
- }, function (props) {
42
- return props.mode === 'none' ? 'display: none' : '';
43
- }, akEditorStickyHeaderZIndex, TableSharedCssClassName.TABLE_CONTAINER, TableSharedCssClassName.TABLE_STICKY_WRAPPER, tableStickyPadding, N40A, TableSharedCssClassName.TABLE_CONTAINER, TableSharedCssClassName.TABLE_CONTAINER);
44
- var StyledDiv = styled.div(_templateObject3 || (_templateObject3 = _taggedTemplateLiteral([""])));
45
- export var StickyTable = function StickyTable(_ref3) {
46
- var top = _ref3.top,
47
- left = _ref3.left,
48
- mode = _ref3.mode,
49
- shadowClassNames = _ref3.shadowClassNames,
50
- innerRef = _ref3.innerRef,
51
- wrapperWidth = _ref3.wrapperWidth,
52
- tableWidth = _ref3.tableWidth,
53
- isNumberColumnEnabled = _ref3.isNumberColumnEnabled,
54
- layout = _ref3.layout,
55
- children = _ref3.children,
56
- columnWidths = _ref3.columnWidths,
57
- renderWidth = _ref3.renderWidth,
58
- allowDynamicTextSizing = _ref3.allowDynamicTextSizing,
59
- rowHeight = _ref3.rowHeight;
60
- return /*#__PURE__*/React.createElement(RelativeTableDiv, {
61
- left: left,
62
- top: mode === 'pin-bottom' ? top : undefined
63
- }, /*#__PURE__*/React.createElement(FixedTableDiv, {
29
+ };
30
+
31
+ var fixedTableDivStaticStyles = function fixedTableDivStaticStyles(top, width) {
32
+ return css(_templateObject3 || (_templateObject3 = _taggedTemplateLiteral(["\n top: ", "px;\n width: ", "px;\n z-index: ", ";\n &\n .", ",\n &\n .", "\n > table {\n margin-top: 0;\n margin-bottom: 0;\n }\n\n border-top: ", "px solid white;\n background: white;\n box-shadow: 0 6px 4px -4px ", ";\n\n div[data-expanded='false'] & {\n display: none;\n }\n\n &\n .", ".right-shadow::after,\n &\n .", ".left-shadow::before {\n top: 0px;\n height: 100%;\n }\n"])), top, width, akEditorStickyHeaderZIndex, TableSharedCssClassName.TABLE_CONTAINER, TableSharedCssClassName.TABLE_STICKY_WRAPPER, tableStickyPadding, N40A, TableSharedCssClassName.TABLE_CONTAINER, TableSharedCssClassName.TABLE_CONTAINER);
33
+ };
34
+
35
+ export var FixedTableDiv = function FixedTableDiv(props) {
36
+ var top = props.top,
37
+ wrapperWidth = props.wrapperWidth,
38
+ mode = props.mode;
39
+ var fixedTableCss = [fixedTableDivStaticStyles(top, wrapperWidth), getModeSpecificStyles(mode)];
40
+ return jsx("div", {
41
+ css: fixedTableCss
42
+ }, props.children);
43
+ };
44
+ export var StickyTable = function StickyTable(_ref) {
45
+ var top = _ref.top,
46
+ left = _ref.left,
47
+ mode = _ref.mode,
48
+ shadowClassNames = _ref.shadowClassNames,
49
+ innerRef = _ref.innerRef,
50
+ wrapperWidth = _ref.wrapperWidth,
51
+ tableWidth = _ref.tableWidth,
52
+ isNumberColumnEnabled = _ref.isNumberColumnEnabled,
53
+ layout = _ref.layout,
54
+ children = _ref.children,
55
+ columnWidths = _ref.columnWidths,
56
+ renderWidth = _ref.renderWidth,
57
+ allowDynamicTextSizing = _ref.allowDynamicTextSizing,
58
+ rowHeight = _ref.rowHeight;
59
+ return jsx("div", {
60
+ css: {
61
+ left: left && left < 0 ? left : undefined,
62
+ top: mode === 'pin-bottom' ? top : undefined,
63
+ position: 'relative'
64
+ }
65
+ }, jsx(FixedTableDiv, {
64
66
  top: mode === 'stick' ? top : undefined,
65
67
  mode: rowHeight > 300 ? 'none' : mode,
66
68
  wrapperWidth: wrapperWidth
67
- }, /*#__PURE__*/React.createElement(StyledDiv, {
69
+ }, jsx("div", {
68
70
  className: "".concat(TableSharedCssClassName.TABLE_CONTAINER, " ").concat(shadowClassNames),
69
71
  "data-layout": layout,
70
72
  style: {
71
73
  width: tableWidth
72
74
  }
73
- }, /*#__PURE__*/React.createElement(StyledDiv, {
74
- innerRef: innerRef,
75
+ }, jsx("div", {
76
+ ref: innerRef,
75
77
  className: "".concat(TableSharedCssClassName.TABLE_STICKY_WRAPPER),
76
78
  style: {
77
79
  overflow: 'hidden'
78
80
  }
79
- }, /*#__PURE__*/React.createElement(Table, {
81
+ }, jsx(Table, {
80
82
  columnWidths: columnWidths,
81
83
  layout: layout,
82
84
  isNumberColumnEnabled: isNumberColumnEnabled,
83
85
  renderWidth: renderWidth,
84
86
  allowDynamicTextSizing: allowDynamicTextSizing
85
- }, children)))));
87
+ },
88
+ /**
89
+ * @see https://product-fabric.atlassian.net/browse/ED-10235
90
+ * We pass prop 'invisible' to our table's children nodes meaning
91
+ * they exist inside of the 'invisible' duplicated table component that
92
+ * enables sticky headers.
93
+ */
94
+ recursivelyInjectProps(children, {
95
+ invisible: true
96
+ }))))));
86
97
  };
87
98
  export var OverflowParent = /*#__PURE__*/function () {
88
99
  function OverflowParent(ref) {
@@ -6,16 +6,12 @@ import _inherits from "@babel/runtime/helpers/inherits";
6
6
  import _possibleConstructorReturn from "@babel/runtime/helpers/possibleConstructorReturn";
7
7
  import _getPrototypeOf from "@babel/runtime/helpers/getPrototypeOf";
8
8
  import _defineProperty from "@babel/runtime/helpers/defineProperty";
9
- import _taggedTemplateLiteral from "@babel/runtime/helpers/taggedTemplateLiteral";
10
-
11
- var _templateObject;
12
9
 
13
10
  function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }
14
11
 
15
12
  function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
16
13
 
17
14
  import React from 'react';
18
- import styled from 'styled-components';
19
15
  import { calcTableWidth, TableSharedCssClassName, tableMarginTop } from '@atlaskit/editor-common/styles';
20
16
  import { WidthConsumer, overflowShadow } from '@atlaskit/editor-common/ui';
21
17
  import { createCompareNodes, convertProsemirrorTableNodeToArrayOfRows, hasMergedCell, compose } from '@atlaskit/editor-common/utils';
@@ -124,8 +120,6 @@ var tableCanBeSticky = function tableCanBeSticky(node, children) {
124
120
  return isHeaderRowEnabled(children) && node && node.firstChild && !hasRowspan(node.firstChild);
125
121
  };
126
122
 
127
- var MainTableContainer = styled.div(_templateObject || (_templateObject = _taggedTemplateLiteral([""])));
128
-
129
123
  var canUseLinelength = function canUseLinelength(appearance) {
130
124
  return appearance === 'full-page' || appearance === 'mobile';
131
125
  };
@@ -330,10 +324,10 @@ export var TableContainer = /*#__PURE__*/function (_React$Component) {
330
324
  columnWidths: columnWidths,
331
325
  rowHeight: this.headerRowHeight,
332
326
  allowDynamicTextSizing: allowDynamicTextSizing
333
- }, [children && children[0]]), /*#__PURE__*/React.createElement(MainTableContainer, {
327
+ }, [children && children[0]]), /*#__PURE__*/React.createElement("div", {
334
328
  className: "".concat(TableSharedCssClassName.TABLE_CONTAINER, " ").concat(this.props.shadowClassNames),
335
329
  "data-layout": layout,
336
- innerRef: this.props.handleRef,
330
+ ref: this.props.handleRef,
337
331
  style: {
338
332
  width: tableWidth,
339
333
  left: left && left < 0 ? left : undefined
@@ -0,0 +1,24 @@
1
+ import React from 'react';
2
+ /**
3
+ * Helper function to recursively injects props to
4
+ * all valid children react nodes.
5
+ */
6
+
7
+ export function recursivelyInjectProps(children, propsToInject) {
8
+ return React.Children.toArray(children).map(function (child) {
9
+ // Cannot add a prop to an invalid element, so just return the child
10
+ if (! /*#__PURE__*/React.isValidElement(child)) {
11
+ return child;
12
+ } // Recursive call if child has nested children
13
+
14
+
15
+ if (child.props.children) {
16
+ child = /*#__PURE__*/React.cloneElement(child, {
17
+ children: recursivelyInjectProps(child.props.children, propsToInject)
18
+ });
19
+ } // Add props to react child node
20
+
21
+
22
+ return /*#__PURE__*/React.cloneElement(child, propsToInject);
23
+ });
24
+ }
@@ -0,0 +1,39 @@
1
+ import { useMemo } from 'react';
2
+ import debounce from 'lodash/debounce';
3
+ import { useComponentRenderTracking } from '@atlaskit/editor-common/utils';
4
+ import { EVENT_TYPE } from '../../../analytics/enums';
5
+ export function RenderTracking(props) {
6
+ var debouncedHandleAnalyticsEvent = useMemo(function () {
7
+ return debounce(props.handleAnalyticsEvent, 500);
8
+ }, [props.handleAnalyticsEvent]);
9
+ useComponentRenderTracking({
10
+ onRender: function onRender(_ref) {
11
+ var renderCount = _ref.renderCount,
12
+ propsDifference = _ref.propsDifference,
13
+ componentId = _ref.componentId;
14
+
15
+ if (!renderCount) {
16
+ return;
17
+ }
18
+
19
+ debouncedHandleAnalyticsEvent({
20
+ action: props.action,
21
+ actionSubject: props.actionSubject,
22
+ attributes: {
23
+ count: renderCount,
24
+ propsDifference: propsDifference,
25
+ componentId: componentId
26
+ },
27
+ eventType: EVENT_TYPE.OPERATIONAL
28
+ });
29
+ },
30
+ propsDiffingOptions: {
31
+ enabled: true,
32
+ props: props.componentProps,
33
+ propsToIgnore: props.propsToIgnore,
34
+ useShallow: props.useShallow
35
+ },
36
+ zeroBasedCount: true
37
+ });
38
+ return null;
39
+ }
@@ -4,35 +4,60 @@ import _taggedTemplateLiteral from "@babel/runtime/helpers/taggedTemplateLiteral
4
4
 
5
5
  var _templateObject, _templateObject2, _templateObject3, _templateObject4;
6
6
 
7
- import React, { forwardRef, useRef, useCallback } from 'react';
8
- import styled from 'styled-components';
7
+ /** @jsx jsx */
8
+ import React, { useRef, useCallback } from 'react';
9
+ import { css, jsx } from '@emotion/react';
9
10
  import { gridSize, fontSize } from '@atlaskit/theme/constants';
10
11
  import ChevronRightIcon from '@atlaskit/icon/glyph/chevron-right';
11
12
  import Tooltip from '@atlaskit/tooltip';
12
- import { expandMessages, sharedExpandStyles, WidthProvider, ExpandIconWrapper, ExpandLayoutWrapper, ClearNextSiblingMarginTop } from '@atlaskit/editor-common/ui';
13
+ import { expandMessages, sharedExpandStyles, WidthProvider, ExpandIconWrapper, clearNextSiblingMarginTopStyle, ExpandLayoutWrapperWithRef } from '@atlaskit/editor-common/ui';
13
14
  import { akEditorLineHeight, relativeFontSizeToBase16 } from '@atlaskit/editor-shared-styles';
14
15
  import { PLATFORM, MODE } from '../analytics/events';
15
16
  import { ACTION, ACTION_SUBJECT, EVENT_TYPE } from '../analytics/enums';
16
17
  import { injectIntl } from 'react-intl-next';
17
18
  import { ActiveHeaderIdConsumer } from './active-header-id-provider';
18
19
  import _uniqueId from 'lodash/uniqueId';
19
- var Title = styled.span(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n outline: none;\n border: none;\n font-size: ", ";\n line-height: ", ";\n font-weight: normal;\n display: flex;\n flex: 1;\n margin: 0;\n padding: 0 0 0 ", "px;\n text-align: left;\n"])), relativeFontSizeToBase16(fontSize()), akEditorLineHeight, gridSize() / 2);
20
- var Container = styled.div(_templateObject2 || (_templateObject2 = _taggedTemplateLiteral(["\n ", "\n padding: 0;\n padding-bottom: ", "px;\n"])), sharedExpandStyles.ContainerStyles, function (props) {
21
- return props.expanded ? gridSize() : 0;
22
- });
23
- var TitleContainer = styled.button(_templateObject3 || (_templateObject3 = _taggedTemplateLiteral(["\n ", "\n padding: ", "px;\n padding-bottom: ", "px;\n"])), sharedExpandStyles.TitleContainerStyles, gridSize(), function (props) {
24
- return !props.expanded ? gridSize() : 0;
25
- });
20
+ var titleStyles = css(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n outline: none;\n border: none;\n font-size: ", ";\n line-height: ", ";\n font-weight: normal;\n display: flex;\n flex: 1;\n margin: 0;\n padding: 0 0 0 ", "px;\n text-align: left;\n"])), relativeFontSizeToBase16(fontSize()), akEditorLineHeight, gridSize() / 2);
21
+
22
+ var Container = function Container(props) {
23
+ var paddingBottom = "".concat(props.expanded ? gridSize() : 0, "px");
24
+ var sharedContainerStyles = sharedExpandStyles.containerStyles(props);
25
+
26
+ var styles = function styles(themeProps) {
27
+ return css(_templateObject2 || (_templateObject2 = _taggedTemplateLiteral(["\n ", "\n padding: 0;\n padding-bottom: ", ";\n "])), sharedContainerStyles(themeProps), paddingBottom);
28
+ };
29
+
30
+ return jsx("div", _extends({
31
+ css: styles
32
+ }, props), props.children);
33
+ };
34
+
35
+ var TitleContainer = function TitleContainer(props) {
36
+ var paddingBottom = "".concat(!props.expanded ? gridSize() : 0, "px");
37
+
38
+ var styles = function styles(themeProps) {
39
+ return css(_templateObject3 || (_templateObject3 = _taggedTemplateLiteral(["\n ", "\n padding: ", "px;\n padding-bottom: ", ";\n "])), sharedExpandStyles.titleContainerStyles(themeProps), gridSize(), paddingBottom);
40
+ };
41
+
42
+ return jsx("button", _extends({
43
+ css: styles
44
+ }, props), props.children);
45
+ };
46
+
26
47
  TitleContainer.displayName = 'TitleContainerButton';
27
- var ContentContainer = styled.div(_templateObject4 || (_templateObject4 = _taggedTemplateLiteral(["\n ", ";\n padding-right: ", "px;\n padding-left: ", "px;\n visibility: ", ";\n"])), sharedExpandStyles.ContentStyles, gridSize() * 2, gridSize() * 5 - gridSize() / 2, function (props) {
28
- return props.expanded ? 'visible' : 'hidden';
29
- });
30
- var ExpandLayoutWrapperWithRef = /*#__PURE__*/forwardRef(function WithRef(props, ref) {
31
- // @ts-ignore: incorrect innerRef typing
32
- return /*#__PURE__*/React.createElement(ExpandLayoutWrapper, _extends({}, props, {
33
- innerRef: ref
34
- }));
35
- });
48
+
49
+ var ContentContainer = function ContentContainer(props) {
50
+ var sharedContentStyles = sharedExpandStyles.contentStyles(props);
51
+ var visibility = props.expanded ? 'visible' : 'hidden';
52
+
53
+ var styles = function styles(themeProps) {
54
+ return css(_templateObject4 || (_templateObject4 = _taggedTemplateLiteral(["\n ", ";\n padding-right: ", "px;\n padding-left: ", "px;\n visibility: ", ";\n "])), sharedContentStyles(themeProps), gridSize() * 2, gridSize() * 5 - gridSize() / 2, visibility);
55
+ };
56
+
57
+ return jsx("div", _extends({
58
+ css: styles
59
+ }, props), props.children);
60
+ };
36
61
 
37
62
  function fireExpandToggleAnalytics(nodeType, expanded, fireAnalyticsEvent) {
38
63
  if (!fireAnalyticsEvent) {
@@ -80,18 +105,18 @@ function Expand(_ref) {
80
105
  var handleBlur = useCallback(function () {
81
106
  return setFocused(false);
82
107
  }, []);
83
- return /*#__PURE__*/React.createElement(Container, {
108
+ return jsx(Container, {
84
109
  "data-node-type": nodeType,
85
110
  "data-title": title,
86
111
  "data-expanded": expanded,
87
112
  expanded: expanded,
88
113
  focused: focused
89
- }, nestedHeaderIds && nestedHeaderIds.length > 0 ? /*#__PURE__*/React.createElement(ActiveHeaderIdConsumer, {
114
+ }, nestedHeaderIds && nestedHeaderIds.length > 0 ? jsx(ActiveHeaderIdConsumer, {
90
115
  nestedHeaderIds: nestedHeaderIds,
91
116
  onNestedHeaderIdMatch: function onNestedHeaderIdMatch() {
92
117
  return setExpanded(true);
93
118
  }
94
- }) : null, /*#__PURE__*/React.createElement(TitleContainer, {
119
+ }) : null, jsx(TitleContainer, {
95
120
  onClick: function onClick(e) {
96
121
  e.stopPropagation();
97
122
  fireExpandToggleAnalytics(nodeType, expanded, fireAnalyticsEvent);
@@ -106,21 +131,24 @@ function Expand(_ref) {
106
131
  "aria-expanded": expanded,
107
132
  contentEditable: false,
108
133
  expanded: expanded
109
- }, /*#__PURE__*/React.createElement(Tooltip, {
134
+ }, jsx(Tooltip, {
110
135
  content: label,
111
136
  position: "top",
112
137
  tag: ExpandLayoutWrapperWithRef
113
- }, /*#__PURE__*/React.createElement(ExpandIconWrapper, {
138
+ }, jsx(ExpandIconWrapper, {
114
139
  expanded: expanded
115
- }, /*#__PURE__*/React.createElement(ChevronRightIcon, {
140
+ }, jsx(ChevronRightIcon, {
116
141
  label: label
117
- }))), /*#__PURE__*/React.createElement(Title, {
142
+ }))), jsx("span", {
143
+ css: titleStyles,
118
144
  id: id
119
- }, title || intl.formatMessage(expandMessages.expandDefaultTitle))), /*#__PURE__*/React.createElement(ContentContainer, {
145
+ }, title || intl.formatMessage(expandMessages.expandDefaultTitle))), jsx(ContentContainer, {
120
146
  expanded: expanded
121
- }, /*#__PURE__*/React.createElement("div", {
147
+ }, jsx("div", {
122
148
  className: "".concat(nodeType, "-content-wrapper")
123
- }, /*#__PURE__*/React.createElement(WidthProvider, null, /*#__PURE__*/React.createElement(ClearNextSiblingMarginTop, null), children))));
149
+ }, jsx(WidthProvider, null, jsx("div", {
150
+ css: clearNextSiblingMarginTopStyle
151
+ }), children))));
124
152
  }
125
153
 
126
154
  export default injectIntl(Expand);
@@ -1,4 +1,3 @@
1
- import _taggedTemplateLiteral from "@babel/runtime/helpers/taggedTemplateLiteral";
2
1
  import _regeneratorRuntime from "@babel/runtime/regenerator";
3
2
  import _asyncToGenerator from "@babel/runtime/helpers/asyncToGenerator";
4
3
  import _classCallCheck from "@babel/runtime/helpers/classCallCheck";
@@ -9,8 +8,6 @@ import _possibleConstructorReturn from "@babel/runtime/helpers/possibleConstruct
9
8
  import _getPrototypeOf from "@babel/runtime/helpers/getPrototypeOf";
10
9
  import _defineProperty from "@babel/runtime/helpers/defineProperty";
11
10
 
12
- var _templateObject;
13
-
14
11
  function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
15
12
 
16
13
  function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
@@ -19,13 +16,11 @@ function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflec
19
16
 
20
17
  function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
21
18
 
22
- import React from 'react';
23
- import { Component } from 'react';
19
+ import React, { Component } from 'react';
24
20
  import { filter } from '@atlaskit/adf-utils';
25
21
  import { Card, CardLoading, CardError } from '@atlaskit/media-card';
26
22
  import { getMediaClient } from '@atlaskit/media-client';
27
23
  import { withImageLoader } from '@atlaskit/editor-common/utils';
28
- import styled from 'styled-components';
29
24
  var mediaIdentifierMap = new Map();
30
25
  export var getListOfIdentifiersFromDoc = function getListOfIdentifiersFromDoc(doc) {
31
26
  if (!doc) {
@@ -355,7 +350,7 @@ export var MediaCardInternal = /*#__PURE__*/function (_Component) {
355
350
  collectionName: collection,
356
351
  occurrenceKey: occurrenceKey
357
352
  };
358
- return /*#__PURE__*/React.createElement(CardWrapper, getClipboardAttrs({
353
+ return /*#__PURE__*/React.createElement("div", getClipboardAttrs({
359
354
  id: id,
360
355
  alt: alt,
361
356
  collection: collection,
@@ -386,8 +381,7 @@ export var MediaCardInternal = /*#__PURE__*/function (_Component) {
386
381
  }]);
387
382
 
388
383
  return MediaCardInternal;
389
- }(Component);
390
- export var CardWrapper = styled.div(_templateObject || (_templateObject = _taggedTemplateLiteral([""]))); // Needed for copy & paste
384
+ }(Component); // Needed for copy & paste
391
385
 
392
386
  export var getClipboardAttrs = function getClipboardAttrs(_ref2) {
393
387
  var id = _ref2.id,