@atlaskit/renderer 108.18.0 → 108.20.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 (97) hide show
  1. package/CHANGELOG.md +17 -0
  2. package/afm-cc/tsconfig.json +109 -0
  3. package/dist/cjs/react/marks/alignment.js +3 -2
  4. package/dist/cjs/react/marks/breakout.js +3 -2
  5. package/dist/cjs/react/marks/link.js +4 -3
  6. package/dist/cjs/react/nodes/blockCard.js +13 -11
  7. package/dist/cjs/react/nodes/codeBlock/codeBlock.js +5 -2
  8. package/dist/cjs/react/nodes/codeBlock/components/codeBlockButtonContainer.js +6 -4
  9. package/dist/cjs/react/nodes/codeBlock/components/codeBlockContainer.js +3 -2
  10. package/dist/cjs/react/nodes/codeBlock/components/codeBlockCopyButton.js +11 -8
  11. package/dist/cjs/react/nodes/codeBlock/components/codeBlockWrapButton.js +11 -8
  12. package/dist/cjs/react/nodes/codeBlock/components/lightWeightCodeBlock.js +8 -7
  13. package/dist/cjs/react/nodes/codeBlock/windowedCodeBlock.js +6 -5
  14. package/dist/cjs/react/nodes/embedCard.js +9 -8
  15. package/dist/cjs/react/nodes/heading-anchor.js +5 -4
  16. package/dist/cjs/react/nodes/layoutColumn.js +3 -2
  17. package/dist/cjs/react/nodes/media/index.js +11 -8
  18. package/dist/cjs/react/nodes/mediaInline.js +47 -20
  19. package/dist/cjs/react/nodes/mediaSingle/index.js +6 -3
  20. package/dist/cjs/react/nodes/mediaSingle/styles.js +1 -0
  21. package/dist/cjs/react/nodes/panel.js +9 -7
  22. package/dist/cjs/react/nodes/table/sticky.js +7 -6
  23. package/dist/cjs/ui/Expand.js +18 -16
  24. package/dist/cjs/ui/MediaCard.js +74 -71
  25. package/dist/cjs/ui/Renderer/index.js +28 -35
  26. package/dist/cjs/ui/Renderer/truncated-wrapper.js +3 -2
  27. package/dist/cjs/ui/SortingIcon.js +5 -4
  28. package/dist/cjs/ui/annotations/draft/component.js +9 -8
  29. package/dist/cjs/ui/annotations/element/mark.js +2 -1
  30. package/dist/es2019/react/marks/alignment.js +4 -3
  31. package/dist/es2019/react/marks/breakout.js +4 -3
  32. package/dist/es2019/react/marks/link.js +5 -4
  33. package/dist/es2019/react/nodes/blockCard.js +13 -12
  34. package/dist/es2019/react/nodes/codeBlock/codeBlock.js +4 -2
  35. package/dist/es2019/react/nodes/codeBlock/components/codeBlockButtonContainer.js +6 -5
  36. package/dist/es2019/react/nodes/codeBlock/components/codeBlockContainer.js +4 -3
  37. package/dist/es2019/react/nodes/codeBlock/components/codeBlockCopyButton.js +7 -5
  38. package/dist/es2019/react/nodes/codeBlock/components/codeBlockWrapButton.js +9 -7
  39. package/dist/es2019/react/nodes/codeBlock/components/lightWeightCodeBlock.js +9 -8
  40. package/dist/es2019/react/nodes/codeBlock/windowedCodeBlock.js +6 -4
  41. package/dist/es2019/react/nodes/embedCard.js +10 -9
  42. package/dist/es2019/react/nodes/heading-anchor.js +6 -5
  43. package/dist/es2019/react/nodes/layoutColumn.js +4 -3
  44. package/dist/es2019/react/nodes/media/index.js +13 -7
  45. package/dist/es2019/react/nodes/mediaInline.js +20 -12
  46. package/dist/es2019/react/nodes/mediaSingle/index.js +6 -3
  47. package/dist/es2019/react/nodes/mediaSingle/styles.js +1 -0
  48. package/dist/es2019/react/nodes/panel.js +8 -7
  49. package/dist/es2019/react/nodes/table/sticky.js +8 -7
  50. package/dist/es2019/ui/Expand.js +17 -16
  51. package/dist/es2019/ui/MediaCard.js +29 -25
  52. package/dist/es2019/ui/Renderer/index.js +31 -36
  53. package/dist/es2019/ui/Renderer/truncated-wrapper.js +4 -3
  54. package/dist/es2019/ui/SortingIcon.js +6 -5
  55. package/dist/es2019/ui/annotations/draft/component.js +10 -9
  56. package/dist/es2019/ui/annotations/element/mark.js +3 -2
  57. package/dist/esm/react/marks/alignment.js +4 -3
  58. package/dist/esm/react/marks/breakout.js +4 -3
  59. package/dist/esm/react/marks/link.js +5 -4
  60. package/dist/esm/react/nodes/blockCard.js +13 -12
  61. package/dist/esm/react/nodes/codeBlock/codeBlock.js +4 -2
  62. package/dist/esm/react/nodes/codeBlock/components/codeBlockButtonContainer.js +6 -5
  63. package/dist/esm/react/nodes/codeBlock/components/codeBlockContainer.js +4 -3
  64. package/dist/esm/react/nodes/codeBlock/components/codeBlockCopyButton.js +7 -5
  65. package/dist/esm/react/nodes/codeBlock/components/codeBlockWrapButton.js +9 -7
  66. package/dist/esm/react/nodes/codeBlock/components/lightWeightCodeBlock.js +9 -8
  67. package/dist/esm/react/nodes/codeBlock/windowedCodeBlock.js +6 -4
  68. package/dist/esm/react/nodes/embedCard.js +10 -9
  69. package/dist/esm/react/nodes/heading-anchor.js +6 -5
  70. package/dist/esm/react/nodes/layoutColumn.js +4 -3
  71. package/dist/esm/react/nodes/media/index.js +14 -8
  72. package/dist/esm/react/nodes/mediaInline.js +48 -21
  73. package/dist/esm/react/nodes/mediaSingle/index.js +6 -3
  74. package/dist/esm/react/nodes/mediaSingle/styles.js +1 -0
  75. package/dist/esm/react/nodes/panel.js +8 -7
  76. package/dist/esm/react/nodes/table/sticky.js +8 -7
  77. package/dist/esm/ui/Expand.js +17 -16
  78. package/dist/esm/ui/MediaCard.js +74 -71
  79. package/dist/esm/ui/Renderer/index.js +31 -36
  80. package/dist/esm/ui/Renderer/truncated-wrapper.js +4 -3
  81. package/dist/esm/ui/SortingIcon.js +6 -5
  82. package/dist/esm/ui/annotations/draft/component.js +10 -9
  83. package/dist/esm/ui/annotations/element/mark.js +3 -2
  84. package/dist/types/react/nodes/media/index.d.ts +3 -2
  85. package/dist/types/react/nodes/mediaInline.d.ts +1 -2
  86. package/dist/types/ui/MediaCard.d.ts +5 -6
  87. package/dist/types/ui/Renderer/index.d.ts +1 -2
  88. package/dist/types-ts4.5/react/nodes/media/index.d.ts +3 -2
  89. package/dist/types-ts4.5/react/nodes/mediaInline.d.ts +1 -2
  90. package/dist/types-ts4.5/ui/MediaCard.d.ts +5 -6
  91. package/dist/types-ts4.5/ui/Renderer/index.d.ts +1 -2
  92. package/package.json +2 -1
  93. package/dist/cjs/react/utils/EditorMediaClientProvider.js +0 -40
  94. package/dist/es2019/react/utils/EditorMediaClientProvider.js +0 -27
  95. package/dist/esm/react/utils/EditorMediaClientProvider.js +0 -30
  96. package/dist/types/react/utils/EditorMediaClientProvider.d.ts +0 -5
  97. package/dist/types-ts4.5/react/utils/EditorMediaClientProvider.d.ts +0 -5
@@ -1,4 +1,5 @@
1
- import { css } from '@emotion/react';
1
+ /** @jsx jsx */
2
+ import { css, jsx } from '@emotion/react';
2
3
  import { WidthConsumer } from '@atlaskit/editor-common/ui';
3
4
  import { calcBreakoutWidth } from '@atlaskit/editor-common/utils';
4
5
  import { blockNodesVerticalMargin } from '@atlaskit/editor-shared-styles';
@@ -8,9 +9,9 @@ export const wrapperStyles = css`
8
9
  transform: translateX(-50%);
9
10
  `;
10
11
  export default function Breakout(props) {
11
- return /*#__PURE__*/React.createElement(WidthConsumer, null, ({
12
+ return jsx(WidthConsumer, null, ({
12
13
  width
13
- }) => /*#__PURE__*/React.createElement("div", {
14
+ }) => jsx("div", {
14
15
  css: wrapperStyles,
15
16
  "data-mode": props.mode,
16
17
  style: {
@@ -1,6 +1,7 @@
1
1
  import _extends from "@babel/runtime/helpers/extends";
2
+ /** @jsx jsx */
2
3
  import React, { Fragment } from 'react';
3
- import { css } from '@emotion/react';
4
+ import { css, jsx } from '@emotion/react';
4
5
  import { B400, B300, B500 } from '@atlaskit/theme/colors';
5
6
  import { getEventHandler } from '../../utils';
6
7
  import { PLATFORM, MODE } from '../../analytics/events';
@@ -38,7 +39,7 @@ export default function Link(props) {
38
39
  }
39
40
  const handler = getEventHandler(eventHandlers, 'link');
40
41
  if (isMediaLink) {
41
- return /*#__PURE__*/React.createElement(Fragment, null, props.children);
42
+ return jsx(Fragment, null, props.children);
42
43
  }
43
44
  const analyticsData = {
44
45
  attributes: {
@@ -47,9 +48,9 @@ export default function Link(props) {
47
48
  // Below is added for the future implementation of Linking Platform namespaced analytic context
48
49
  location: 'renderer'
49
50
  };
50
- return /*#__PURE__*/React.createElement(AnalyticsContext, {
51
+ return jsx(AnalyticsContext, {
51
52
  data: analyticsData
52
- }, /*#__PURE__*/React.createElement(LinkUrl, _extends({
53
+ }, jsx(LinkUrl, _extends({
53
54
  css: anchorStyles,
54
55
  onClick: e => {
55
56
  if (fireAnalyticsEvent) {
@@ -1,6 +1,7 @@
1
1
  import _extends from "@babel/runtime/helpers/extends";
2
+ /** @jsx jsx */
2
3
  import { useMemo } from 'react';
3
- import { css } from '@emotion/react';
4
+ import { css, jsx } from '@emotion/react';
4
5
  import { Card } from '@atlaskit/smart-card';
5
6
  import { UnsupportedBlock, UnsupportedInline, WidthConsumer } from '@atlaskit/editor-common/ui';
6
7
  import { getPlatform } from '../../utils';
@@ -56,7 +57,7 @@ export default function BlockCard(props) {
56
57
  };
57
58
  if (props.datasource) {
58
59
  if (platform === 'mobile') {
59
- return /*#__PURE__*/React.createElement(InlineCard, props);
60
+ return jsx(InlineCard, props);
60
61
  }
61
62
  const views = props.datasource.views;
62
63
  const tableView = views.find(view => view.type === 'table');
@@ -75,18 +76,18 @@ export default function BlockCard(props) {
75
76
  datasource,
76
77
  layout
77
78
  } = props;
78
- return /*#__PURE__*/React.createElement(AnalyticsContext, {
79
+ return jsx(AnalyticsContext, {
79
80
  data: analyticsData
80
- }, /*#__PURE__*/React.createElement(CardErrorBoundary, _extends({
81
+ }, jsx(CardErrorBoundary, _extends({
81
82
  unsupportedComponent: UnsupportedInline
82
- }, cardProps), /*#__PURE__*/React.createElement(WidthConsumer, null, ({
83
+ }, cardProps), jsx(WidthConsumer, null, ({
83
84
  width
84
- }) => /*#__PURE__*/React.createElement("div", {
85
+ }) => jsx("div", {
85
86
  css: datasourceContainerStyle,
86
87
  style: {
87
88
  width: calcBreakoutWidth(layout, width)
88
89
  }
89
- }, /*#__PURE__*/React.createElement(DatasourceTableView, {
90
+ }, jsx(DatasourceTableView, {
90
91
  datasourceId: datasource.id,
91
92
  parameters: datasource.parameters,
92
93
  visibleColumnKeys: visibleColumnKeys,
@@ -94,21 +95,21 @@ export default function BlockCard(props) {
94
95
  url: url
95
96
  })))));
96
97
  }
97
- return /*#__PURE__*/React.createElement(InlineCard, {
98
+ return jsx(InlineCard, {
98
99
  data: data,
99
100
  url: url
100
101
  });
101
102
  }
102
- return /*#__PURE__*/React.createElement(AnalyticsContext, {
103
+ return jsx(AnalyticsContext, {
103
104
  data: analyticsData
104
- }, /*#__PURE__*/React.createElement("div", {
105
+ }, jsx("div", {
105
106
  className: "blockCardView-content-wrap",
106
107
  "data-block-card": true,
107
108
  "data-card-data": data ? JSON.stringify(data) : undefined,
108
109
  "data-card-url": url
109
- }, /*#__PURE__*/React.createElement(CardErrorBoundary, _extends({
110
+ }, jsx(CardErrorBoundary, _extends({
110
111
  unsupportedComponent: UnsupportedBlock
111
- }, cardProps), /*#__PURE__*/React.createElement(Card, _extends({
112
+ }, cardProps), jsx(Card, _extends({
112
113
  appearance: "block",
113
114
  showActions: rendererAppearance !== 'mobile',
114
115
  platform: platform,
@@ -1,4 +1,6 @@
1
+ /** @jsx jsx */
1
2
  import { useState } from 'react';
3
+ import { jsx } from '@emotion/react';
2
4
  import { injectIntl } from 'react-intl-next';
3
5
  import { CodeBlockSharedCssClassName } from '@atlaskit/editor-common/styles';
4
6
  import { CodeBlock as AkCodeBlock } from '@atlaskit/code';
@@ -15,14 +17,14 @@ function CodeBlock(props) {
15
17
  const codeBidiWarningLabel = props.intl.formatMessage(codeBidiWarningMessages.label);
16
18
  const className = [CodeBlockSharedCssClassName.CODEBLOCK_CONTAINER, props.className].join(' ');
17
19
  const [wrapLongLines, setWrapLongLines] = useState(false);
18
- return /*#__PURE__*/React.createElement(CodeBlockContainer, {
20
+ return jsx(CodeBlockContainer, {
19
21
  allowCopyToClipboard: allowCopyToClipboard,
20
22
  allowWrapCodeBlock: allowWrapCodeBlock,
21
23
  className: className,
22
24
  setWrapLongLines: setWrapLongLines,
23
25
  text: text,
24
26
  wrapLongLines: wrapLongLines
25
- }, /*#__PURE__*/React.createElement(AkCodeBlock, {
27
+ }, jsx(AkCodeBlock, {
26
28
  language: language,
27
29
  text: text,
28
30
  codeBidiWarningLabel: codeBidiWarningLabel,
@@ -1,4 +1,5 @@
1
- import { css } from '@emotion/react';
1
+ /** @jsx jsx */
2
+ import { jsx, css } from '@emotion/react';
2
3
  import CopyButton from './codeBlockCopyButton';
3
4
  import CodeWrapButton from './codeBlockWrapButton';
4
5
  import { N0, N20, N30, N700 } from '@atlaskit/theme/colors';
@@ -45,14 +46,14 @@ const CodeBlockButtonContainer = ({
45
46
  text,
46
47
  wrapLongLines
47
48
  }) => {
48
- return /*#__PURE__*/React.createElement("div", {
49
+ return jsx("div", {
49
50
  css: codeBlockButtonsWrapper
50
- }, /*#__PURE__*/React.createElement("div", {
51
+ }, jsx("div", {
51
52
  css: codeBlockButtonsStyle
52
- }, allowWrapCodeBlock && /*#__PURE__*/React.createElement(CodeWrapButton, {
53
+ }, allowWrapCodeBlock && jsx(CodeWrapButton, {
53
54
  setWrapLongLines: setWrapLongLines,
54
55
  wrapLongLines: wrapLongLines
55
- }), allowCopyToClipboard && /*#__PURE__*/React.createElement(CopyButton, {
56
+ }), allowCopyToClipboard && jsx(CopyButton, {
56
57
  content: text
57
58
  })));
58
59
  };
@@ -1,4 +1,5 @@
1
- import { css } from '@emotion/react';
1
+ /** @jsx jsx */
2
+ import { jsx, css } from '@emotion/react';
2
3
  import { overflowShadow, relativeFontSizeToBase16 } from '@atlaskit/editor-shared-styles';
3
4
  import { N20, DN50 } from '@atlaskit/theme/colors';
4
5
  import { themed } from '@atlaskit/theme/components';
@@ -47,10 +48,10 @@ const CodeBlockContainer = ({
47
48
  text,
48
49
  wrapLongLines
49
50
  }) => {
50
- return /*#__PURE__*/React.createElement("div", {
51
+ return jsx("div", {
51
52
  className: className,
52
53
  css: codeBlockStyleOverrides
53
- }, /*#__PURE__*/React.createElement(CodeBlockButtonContainer, {
54
+ }, jsx(CodeBlockButtonContainer, {
54
55
  allowCopyToClipboard: allowCopyToClipboard,
55
56
  allowWrapCodeBlock: allowWrapCodeBlock,
56
57
  setWrapLongLines: setWrapLongLines,
@@ -1,3 +1,5 @@
1
+ /** @jsx jsx */
2
+ import { jsx } from '@emotion/react';
1
3
  import React, { useState } from 'react';
2
4
  import { injectIntl } from 'react-intl-next';
3
5
  import Tooltip from '@atlaskit/tooltip';
@@ -17,20 +19,20 @@ const CopyButton = ({
17
19
  setTooltip(intl.formatMessage(codeBlockButtonMessages.copyCodeToClipboard));
18
20
  setClassName('copy-to-clipboard');
19
21
  };
20
- return /*#__PURE__*/React.createElement(AnalyticsContext.Consumer, null, ({
22
+ return jsx(AnalyticsContext.Consumer, null, ({
21
23
  fireAnalyticsEvent
22
- }) => /*#__PURE__*/React.createElement("span", null, /*#__PURE__*/React.createElement(Tooltip, {
24
+ }) => jsx("span", null, jsx(Tooltip, {
23
25
  content: tooltip,
24
26
  hideTooltipOnClick: false,
25
27
  position: "top"
26
- }, /*#__PURE__*/React.createElement("div", {
28
+ }, jsx("div", {
27
29
  onMouseLeave: onMouseLeave
28
- }, /*#__PURE__*/React.createElement(Button, {
30
+ }, jsx(Button, {
29
31
  appearance: "subtle",
30
32
  "aria-haspopup": true,
31
33
  "aria-label": tooltip,
32
34
  className: className,
33
- iconBefore: /*#__PURE__*/React.createElement(CopyIcon, {
35
+ iconBefore: jsx(CopyIcon, {
34
36
  label: tooltip
35
37
  }),
36
38
  onClick: event => {
@@ -1,3 +1,5 @@
1
+ /** @jsx jsx */
2
+ import { jsx } from '@emotion/react';
1
3
  import React from 'react';
2
4
  import { injectIntl } from 'react-intl-next';
3
5
  import Tooltip from '@atlaskit/tooltip';
@@ -7,15 +9,15 @@ import { codeBlockButtonMessages } from '@atlaskit/editor-common/messages';
7
9
  import { ACTION, ACTION_SUBJECT, ACTION_SUBJECT_ID, EVENT_TYPE } from '../../../../analytics/enums';
8
10
  import AnalyticsContext from '../../../../analytics/analyticsContext';
9
11
  const WrapIcon = () => {
10
- return /*#__PURE__*/React.createElement("svg", {
12
+ return jsx("svg", {
11
13
  width: "24",
12
14
  height: "24",
13
15
  fill: "none",
14
16
  viewBox: "0 0 24 24"
15
- }, /*#__PURE__*/React.createElement("g", {
17
+ }, jsx("g", {
16
18
  fill: "currentColor",
17
19
  clipPath: "url(#clip0_654_431)"
18
- }, /*#__PURE__*/React.createElement("path", {
20
+ }, jsx("path", {
19
21
  d: "M20 4h-1v16h1V4ZM3 8a1 1 0 0 1 1-1h9.5a4.5 4.5 0 1 1 0 9h-2.086l.293.293a1 1 0 0 1-1.414 1.414l-2-2a1 1 0 0 1 0-1.414l2-2a1 1 0 0 1 1.414 1.414l-.293.293H13.5a2.5 2.5 0 0 0 0-5H4a1 1 0 0 1-1-1Z",
20
22
  clipRule: "evenodd",
21
23
  fillRule: "evenodd"
@@ -27,18 +29,18 @@ const CodeBlockWrapButton = ({
27
29
  intl
28
30
  }) => {
29
31
  const wrapMessage = intl.formatMessage(wrapLongLines ? codeBlockButtonMessages.unwrapCode : codeBlockButtonMessages.wrapCode);
30
- return /*#__PURE__*/React.createElement(AnalyticsContext.Consumer, null, ({
32
+ return jsx(AnalyticsContext.Consumer, null, ({
31
33
  fireAnalyticsEvent
32
- }) => /*#__PURE__*/React.createElement("span", null, /*#__PURE__*/React.createElement(Tooltip, {
34
+ }) => jsx("span", null, jsx(Tooltip, {
33
35
  content: wrapMessage,
34
36
  hideTooltipOnClick: false,
35
37
  position: "top"
36
- }, /*#__PURE__*/React.createElement(Button, {
38
+ }, jsx(Button, {
37
39
  appearance: "subtle",
38
40
  "aria-haspopup": true,
39
41
  "aria-label": wrapMessage,
40
42
  className: `wrap-code ${wrapLongLines ? 'clicked' : ''}`,
41
- iconBefore: /*#__PURE__*/React.createElement(Icon, {
43
+ iconBefore: jsx(Icon, {
42
44
  glyph: WrapIcon,
43
45
  label: ""
44
46
  }),
@@ -1,5 +1,6 @@
1
+ /** @jsx jsx */
1
2
  import React, { forwardRef, useMemo } from 'react';
2
- import { css, useTheme } from '@emotion/react';
3
+ import { css, jsx, useTheme } from '@emotion/react';
3
4
  import { blockNodesVerticalMargin } from '@atlaskit/editor-shared-styles';
4
5
  import { codeBlockSharedStyles, CodeBlockSharedCssClassName } from '@atlaskit/editor-common/styles';
5
6
  import { useBidiWarnings } from '../../../hooks/use-bidi-warnings';
@@ -40,20 +41,20 @@ const LightWeightCodeBlock = /*#__PURE__*/forwardRef(({
40
41
  enableWarningTooltip: codeBidiWarningTooltipEnabled
41
42
  });
42
43
  const classNames = [LightWeightCodeBlockCssClassName.CONTAINER, className].join(' ');
43
- return /*#__PURE__*/React.createElement("div", {
44
+ return jsx("div", {
44
45
  className: classNames,
45
46
  ref: ref,
46
47
  css: [codeBlockSharedStyles(theme), lightWeightCodeBlockStyles]
47
- }, /*#__PURE__*/React.createElement("div", {
48
+ }, jsx("div", {
48
49
  className: CodeBlockSharedCssClassName.CODEBLOCK_CONTAINER
49
- }, /*#__PURE__*/React.createElement("div", {
50
+ }, jsx("div", {
50
51
  className: CodeBlockSharedCssClassName.CODEBLOCK_CONTENT_WRAPPER
51
- }, /*#__PURE__*/React.createElement("div", {
52
+ }, jsx("div", {
52
53
  className: CodeBlockSharedCssClassName.CODEBLOCK_LINE_NUMBER_GUTTER
53
- }, textRows.map((_, index) => /*#__PURE__*/React.createElement("span", {
54
+ }, textRows.map((_, index) => jsx("span", {
54
55
  key: index
55
- }))), /*#__PURE__*/React.createElement("div", {
56
+ }))), jsx("div", {
56
57
  className: CodeBlockSharedCssClassName.CODEBLOCK_CONTENT
57
- }, /*#__PURE__*/React.createElement("code", null, renderBidiWarnings(text))))));
58
+ }, jsx("code", null, renderBidiWarnings(text))))));
58
59
  });
59
60
  export default LightWeightCodeBlock;
@@ -1,4 +1,6 @@
1
+ /** @jsx jsx */
1
2
  import { Fragment, lazy, memo, Suspense, useState } from 'react';
3
+ import { jsx } from '@emotion/react';
2
4
  import { CodeBlockSharedCssClassName } from '@atlaskit/editor-common/styles';
3
5
  import { useInViewport } from '../../hooks/use-in-viewport';
4
6
  import { useBidiWarnings } from '../../hooks/use-bidi-warnings';
@@ -26,23 +28,23 @@ const WindowedCodeBlock = ({
26
28
  trackingRef
27
29
  } = useInViewport();
28
30
  const className = joinWithSpaces(CodeBlockSharedCssClassName.CODEBLOCK_CONTAINER, rootClassName);
29
- const memoizedLightWeightCodeBlock = /*#__PURE__*/React.createElement(MemoizedLightWeightCodeBlock, {
31
+ const memoizedLightWeightCodeBlock = jsx(MemoizedLightWeightCodeBlock, {
30
32
  ref: trackingRef,
31
33
  text: text,
32
34
  codeBidiWarningTooltipEnabled: codeBidiWarningTooltipEnabled,
33
35
  className: rootClassName
34
36
  });
35
37
  const [wrapLongLines, setWrapLongLines] = useState(false);
36
- return isInViewport ? /*#__PURE__*/React.createElement(Fragment, null, /*#__PURE__*/React.createElement(Suspense, {
38
+ return isInViewport ? jsx(Fragment, null, jsx(Suspense, {
37
39
  fallback: memoizedLightWeightCodeBlock
38
- }, /*#__PURE__*/React.createElement(CodeBlockContainer, {
40
+ }, jsx(CodeBlockContainer, {
39
41
  allowCopyToClipboard: allowCopyToClipboard,
40
42
  allowWrapCodeBlock: allowWrapCodeBlock,
41
43
  className: className,
42
44
  setWrapLongLines: setWrapLongLines,
43
45
  text: text,
44
46
  wrapLongLines: wrapLongLines
45
- }, /*#__PURE__*/React.createElement(LazyAkCodeBlock, {
47
+ }, jsx(LazyAkCodeBlock, {
46
48
  language: language,
47
49
  text: text,
48
50
  codeBidiWarningLabel: warningLabel,
@@ -1,5 +1,6 @@
1
1
  import _extends from "@babel/runtime/helpers/extends";
2
- import { css } from '@emotion/react';
2
+ /** @jsx jsx */
3
+ import { css, jsx } from '@emotion/react';
3
4
  import { useMemo, useContext, useState, useRef } from 'react';
4
5
  import { Card, EmbedResizeMessageListener } from '@atlaskit/smart-card';
5
6
  import { SmartCardContext } from '@atlaskit/link-provider';
@@ -97,9 +98,9 @@ export default function EmbedCard(props) {
97
98
  // Below is added for the future implementation of Linking Platform namespaced analytic context
98
99
  location: 'renderer'
99
100
  };
100
- return /*#__PURE__*/React.createElement(AnalyticsContext, {
101
+ return jsx(AnalyticsContext, {
101
102
  data: analyticsData
102
- }, /*#__PURE__*/React.createElement(WidthConsumer, null, ({
103
+ }, jsx(WidthConsumer, null, ({
103
104
  width: documentWidth
104
105
  }) => {
105
106
  const isFullWidth = rendererAppearance === 'full-width';
@@ -126,12 +127,12 @@ export default function EmbedCard(props) {
126
127
  throw err;
127
128
  }
128
129
  };
129
- return /*#__PURE__*/React.createElement(CardErrorBoundary, _extends({
130
+ return jsx(CardErrorBoundary, _extends({
130
131
  unsupportedComponent: UnsupportedBlock
131
- }, cardProps), /*#__PURE__*/React.createElement(EmbedResizeMessageListener, {
132
+ }, cardProps), jsx(EmbedResizeMessageListener, {
132
133
  embedIframeRef: embedIframeRef,
133
134
  onHeightUpdate: setLiveHeight
134
- }, /*#__PURE__*/React.createElement(UIMediaSingle, {
135
+ }, jsx(UIMediaSingle, {
135
136
  css: uiMediaSingleStyles,
136
137
  layout: layout,
137
138
  width: originalWidth,
@@ -142,9 +143,9 @@ export default function EmbedCard(props) {
142
143
  nodeType: "embedCard",
143
144
  lineLength: isInsideOfBlockNode ? containerWidth : lineLength,
144
145
  hasFallbackContainer: hasPreview
145
- }, /*#__PURE__*/React.createElement("div", {
146
+ }, jsx("div", {
146
147
  css: embedCardWrapperStyles
147
- }, /*#__PURE__*/React.createElement("div", {
148
+ }, jsx("div", {
148
149
  className: "embedCardView-content-wrap",
149
150
  "data-embed-card": true,
150
151
  "data-layout": layout,
@@ -152,7 +153,7 @@ export default function EmbedCard(props) {
152
153
  "data-card-data": data ? JSON.stringify(data) : undefined,
153
154
  "data-card-url": url,
154
155
  "data-card-original-height": originalHeight
155
- }, /*#__PURE__*/React.createElement(Card, _extends({
156
+ }, jsx(Card, _extends({
156
157
  appearance: "embed"
157
158
  }, cardProps, {
158
159
  onResolve: onResolve,
@@ -1,7 +1,8 @@
1
1
  import _defineProperty from "@babel/runtime/helpers/defineProperty";
2
2
  import _extends from "@babel/runtime/helpers/extends";
3
+ /** @jsx jsx */
3
4
  import React from 'react';
4
- import { css } from '@emotion/react';
5
+ import { css, jsx } from '@emotion/react';
5
6
  import { N200, N500, B400 } from '@atlaskit/theme/colors';
6
7
  import LinkIcon from '@atlaskit/icon/glyph/link';
7
8
  import Tooltip from '@atlaskit/tooltip';
@@ -13,7 +14,7 @@ const CopyAnchorWrapperWithRef = /*#__PURE__*/React.forwardRef((props, ref) => {
13
14
  children,
14
15
  ...rest
15
16
  } = props;
16
- return /*#__PURE__*/React.createElement("span", _extends({}, rest, {
17
+ return jsx("span", _extends({}, rest, {
17
18
  className: HeadingAnchorWrapperClassName,
18
19
  ref: ref
19
20
  }), children);
@@ -64,12 +65,12 @@ class HeadingAnchor extends React.PureComponent {
64
65
  this.setTooltipState(headingAnchorLinkMessages.copyHeadingLinkToClipboard);
65
66
  });
66
67
  _defineProperty(this, "renderAnchorButton", () => {
67
- return /*#__PURE__*/React.createElement("button", {
68
+ return jsx("button", {
68
69
  css: copyAnchorButtonStyles,
69
70
  onMouseLeave: this.resetMessage,
70
71
  onClick: this.copyToClipboard,
71
72
  "aria-label": this.state.tooltipMessage
72
- }, /*#__PURE__*/React.createElement(LinkIcon, {
73
+ }, jsx(LinkIcon, {
73
74
  label: this.getCopyAriaLabel(),
74
75
  size: this.props.level > 3 ? 'small' : 'medium',
75
76
  primaryColor: this.state.isClicked ? `var(--ds-icon-selected, ${B400})` : `var(--ds-icon-subtle, ${N200})`
@@ -87,7 +88,7 @@ class HeadingAnchor extends React.PureComponent {
87
88
  // We set the key to the message to ensure it remounts when the message
88
89
  // changes, so that it correctly repositions.
89
90
  // @see https://ecosystem.atlassian.net/projects/AK/queues/issue/AK-6548
90
- return /*#__PURE__*/React.createElement(Tooltip, {
91
+ return jsx(Tooltip, {
91
92
  tag: CopyAnchorWrapperWithRef,
92
93
  content: tooltipMessage,
93
94
  position: "top",
@@ -1,18 +1,19 @@
1
+ /** @jsx jsx */
1
2
  import React from 'react';
2
- import { css } from '@emotion/react';
3
+ import { jsx, css } from '@emotion/react';
3
4
  import { WidthProvider, clearNextSiblingMarginTopStyle, clearNextSiblingBlockMarkMarginTopStyle } from '@atlaskit/editor-common/ui';
4
5
  const layoutColumnClearMarginTopStyles = css`
5
6
  ${clearNextSiblingMarginTopStyle}
6
7
  ${clearNextSiblingBlockMarkMarginTopStyle}
7
8
  `;
8
9
  export default function LayoutSection(props) {
9
- return /*#__PURE__*/React.createElement("div", {
10
+ return jsx("div", {
10
11
  "data-layout-column": true,
11
12
  "data-column-width": props.width,
12
13
  style: {
13
14
  flexBasis: `${props.width}%`
14
15
  }
15
- }, /*#__PURE__*/React.createElement(WidthProvider, null, /*#__PURE__*/React.createElement("div", {
16
+ }, jsx(WidthProvider, null, jsx("div", {
16
17
  css: layoutColumnClearMarginTopStyles
17
18
  }), props.children));
18
19
  }
@@ -1,6 +1,10 @@
1
1
  import _extends from "@babel/runtime/helpers/extends";
2
2
  import _defineProperty from "@babel/runtime/helpers/defineProperty";
3
- import React, { PureComponent } from 'react';
3
+ /** @jsx jsx */
4
+
5
+ import React from 'react';
6
+ import { PureComponent } from 'react';
7
+ import { jsx } from '@emotion/react';
4
8
  import { AnalyticsContext } from '@atlaskit/analytics-next';
5
9
  import { MEDIA_CONTEXT } from '@atlaskit/analytics-namespaced-context';
6
10
  import { WithProviders } from '@atlaskit/editor-common/provider-factory';
@@ -17,6 +21,7 @@ export default class Media extends PureComponent {
17
21
  _defineProperty(this, "renderCard", (providers = {}) => {
18
22
  var _borderMark$attrs$col, _borderMark$attrs$siz;
19
23
  const {
24
+ mediaProvider,
20
25
  contextIdentifierProvider
21
26
  } = providers;
22
27
  const {
@@ -34,13 +39,14 @@ export default class Media extends PureComponent {
34
39
  const linkHref = linkMark === null || linkMark === void 0 ? void 0 : linkMark.attrs.href;
35
40
  const eventHandlers = linkHref ? undefined : this.props.eventHandlers;
36
41
  const shouldOpenMediaViewer = !linkHref && allowMediaViewer;
37
- const mediaComponent = /*#__PURE__*/React.createElement(AnalyticsContext, {
42
+ const mediaComponent = jsx(AnalyticsContext, {
38
43
  data: {
39
44
  [MEDIA_CONTEXT]: {
40
45
  border: !!borderMark
41
46
  }
42
47
  }
43
- }, /*#__PURE__*/React.createElement(MediaCard, _extends({
48
+ }, jsx(MediaCard, _extends({
49
+ mediaProvider: mediaProvider,
44
50
  contextIdentifierProvider: contextIdentifierProvider
45
51
  }, this.props, {
46
52
  shouldOpenMediaViewer: shouldOpenMediaViewer,
@@ -51,15 +57,15 @@ export default class Media extends PureComponent {
51
57
  ssr: ssr
52
58
  })));
53
59
  const paletteColorValue = hexToEditorBorderPaletteColor(borderColor) || borderColor;
54
- const mediaComponentWithBorder = borderMark ? /*#__PURE__*/React.createElement("div", {
60
+ const mediaComponentWithBorder = borderMark ? jsx("div", {
55
61
  "data-mark-type": "border",
56
62
  "data-color": borderColor,
57
63
  "data-size": borderWidth,
58
64
  css: borderStyle(paletteColorValue, borderWidth)
59
- }, /*#__PURE__*/React.createElement(MediaBorderGapFiller, {
65
+ }, jsx(MediaBorderGapFiller, {
60
66
  borderColor: borderColor
61
67
  }), mediaComponent) : mediaComponent;
62
- return linkHref ? /*#__PURE__*/React.createElement("a", {
68
+ return linkHref ? jsx("a", {
63
69
  href: linkHref,
64
70
  rel: "noreferrer noopener",
65
71
  onClick: this.handleMediaLinkClick,
@@ -101,7 +107,7 @@ export default class Media extends PureComponent {
101
107
  if (!providers) {
102
108
  return this.renderCard();
103
109
  }
104
- return /*#__PURE__*/React.createElement(WithProviders, {
110
+ return jsx(WithProviders, {
105
111
  providers: ['mediaProvider', 'contextIdentifierProvider'],
106
112
  providerFactory: providers,
107
113
  renderNode: this.renderCard
@@ -3,7 +3,7 @@ import React, { useEffect, useState, useCallback } from 'react';
3
3
  import { MediaInlineCard } from '@atlaskit/media-card';
4
4
  import { MediaInlineCardErroredView, MediaInlineCardLoadingView, messages } from '@atlaskit/media-ui';
5
5
  import { WithProviders } from '@atlaskit/editor-common/provider-factory';
6
- import { MediaClientContext } from '@atlaskit/media-client-react';
6
+ import { getMediaClient } from '@atlaskit/media-client-react';
7
7
  import { getClipboardAttrs, mediaIdentifierMap } from '../../ui/MediaCard';
8
8
  import { createIntl, injectIntl } from 'react-intl-next';
9
9
  export const RenderMediaInline = ({
@@ -12,31 +12,31 @@ export const RenderMediaInline = ({
12
12
  clipboardAttrs,
13
13
  mediaInlineProviders,
14
14
  collection: collectionName,
15
+ featureFlags,
15
16
  eventHandlers,
16
17
  identifier
17
18
  }) => {
18
19
  const [contextIdentifierProvider, setContextIdentifierProvider] = useState();
20
+ const [viewMediaClientConfigState, setViewMediaClientConfigState] = useState();
19
21
  const [fileState, setFileState] = useState();
20
- const mediaClient = React.useContext(MediaClientContext);
21
22
  const updateContext = async contextIdentifierProvider => {
22
23
  if (contextIdentifierProvider) {
23
24
  const resolvedContextID = await contextIdentifierProvider;
24
25
  setContextIdentifierProvider(resolvedContextID);
25
26
  }
26
27
  };
27
- const updateFileState = useCallback(async id => {
28
+ const updateFileState = useCallback(async (id, mediaClientConfig) => {
29
+ const mediaClient = getMediaClient(mediaClientConfig);
28
30
  const options = {
29
31
  collectionName
30
32
  };
31
33
  try {
32
- if (mediaClient) {
33
- const fileState = await mediaClient.file.getCurrentState(id, options);
34
- setFileState(fileState);
35
- }
34
+ const fileState = await mediaClient.file.getCurrentState(id, options);
35
+ setFileState(fileState);
36
36
  } catch (error) {
37
37
  // do not set state on error
38
38
  }
39
- }, [collectionName, mediaClient]);
39
+ }, [collectionName]);
40
40
  useEffect(() => {
41
41
  const {
42
42
  id
@@ -54,20 +54,28 @@ export const RenderMediaInline = ({
54
54
  }, [identifier, collectionName]);
55
55
  useEffect(() => {
56
56
  const {
57
+ mediaProvider,
57
58
  contextIdentifierProvider
58
59
  } = mediaInlineProviders;
59
60
  const {
60
61
  id
61
62
  } = clipboardAttrs;
63
+ updateViewMediaClientConfigState(mediaProvider);
62
64
  updateContext(contextIdentifierProvider);
63
- id && updateFileState(id);
64
- }, [mediaInlineProviders, contextIdentifierProvider, clipboardAttrs, updateFileState]);
65
+ id && viewMediaClientConfigState && updateFileState(id, viewMediaClientConfigState);
66
+ }, [mediaInlineProviders, contextIdentifierProvider, clipboardAttrs, viewMediaClientConfigState, updateFileState]);
67
+ const updateViewMediaClientConfigState = async mediaProvider => {
68
+ if (mediaProvider) {
69
+ const mediaClientConfig = await mediaProvider;
70
+ setViewMediaClientConfigState(mediaClientConfig.viewMediaClientConfig);
71
+ }
72
+ };
65
73
 
66
74
  /*
67
75
  * Only show the loading view if the media provider is not ready
68
76
  * prevents calling the media API before the provider is ready
69
77
  */
70
- if (!mediaClient) {
78
+ if (!viewMediaClientConfigState) {
71
79
  return /*#__PURE__*/React.createElement(MediaInlineCardLoadingView, {
72
80
  message: "",
73
81
  isSelected: false
@@ -101,7 +109,7 @@ export const RenderMediaInline = ({
101
109
  onClick: handleMediaInlineClick,
102
110
  shouldOpenMediaViewer: shouldOpenMediaViewer,
103
111
  shouldDisplayToolTip: shouldDisplayToolTip,
104
- mediaClientConfig: mediaClient.mediaClientConfig,
112
+ mediaClientConfig: viewMediaClientConfigState,
105
113
  mediaViewerItems: Array.from(mediaIdentifierMap.values())
106
114
  }) : /*#__PURE__*/React.createElement(MediaInlineCardErroredView, {
107
115
  message: (intl || createIntl({
@@ -1,4 +1,7 @@
1
+ /** @jsx jsx */
2
+
1
3
  import { default as React, Fragment } from 'react';
4
+ import { jsx } from '@emotion/react';
2
5
  import { injectIntl } from 'react-intl-next';
3
6
  import { MediaSingle as UIMediaSingle, WidthConsumer } from '@atlaskit/editor-common/ui';
4
7
  import { akEditorFullWidthLayoutWidth, akEditorDefaultLayoutWidth, akEditorWideLayoutWidth } from '@atlaskit/editor-shared-styles';
@@ -150,7 +153,7 @@ const MediaSingle = props => {
150
153
  featureFlags
151
154
  });
152
155
  const uiMediaSingleStyles = layout === 'full-width' || layout === 'wide' ? [uiMediaSingleBaseStyles, uiMediaSingleLayoutStyles] : [uiMediaSingleBaseStyles];
153
- return /*#__PURE__*/React.createElement(UIMediaSingle, {
156
+ return jsx(UIMediaSingle, {
154
157
  css: uiMediaSingleStyles,
155
158
  handleMediaSingleRef: ref,
156
159
  layout: layout,
@@ -163,9 +166,9 @@ const MediaSingle = props => {
163
166
  widthType
164
167
  },
165
168
  fullWidthMode: isFullWidth
166
- }, /*#__PURE__*/React.createElement(Fragment, null, mediaComponent), allowCaptions && caption);
169
+ }, jsx(Fragment, null, mediaComponent), allowCaptions && caption);
167
170
  };
168
- return /*#__PURE__*/React.createElement(WidthConsumer, null, ({
171
+ return jsx(WidthConsumer, null, ({
169
172
  width
170
173
  }) => {
171
174
  // Note: in SSR mode the `window` object is not defined,
@@ -1,3 +1,4 @@
1
+ /** @jsx jsx */
1
2
  import { css } from '@emotion/react';
2
3
  export const uiMediaSingleBaseStyles = css`
3
4
  transition: all 0.1s linear;