@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.
- package/CHANGELOG.md +49 -0
- package/dist/cjs/analytics/enums.js +2 -0
- package/dist/cjs/react/marks/alignment.js +11 -12
- package/dist/cjs/react/marks/breakout.js +7 -9
- package/dist/cjs/react/marks/link.js +13 -6
- package/dist/cjs/react/nodes/codeBlock.js +17 -16
- package/dist/cjs/react/nodes/codeBlockCopyButton.js +13 -11
- package/dist/cjs/react/nodes/embedCard.js +25 -33
- package/dist/cjs/react/nodes/heading-anchor.js +7 -6
- package/dist/cjs/react/nodes/heading.js +4 -2
- package/dist/cjs/react/nodes/layoutColumn.js +7 -2
- package/dist/cjs/react/nodes/media.js +7 -6
- package/dist/cjs/react/nodes/mediaSingle/index.js +15 -4
- package/dist/cjs/react/nodes/mediaSingle/styles.js +7 -10
- package/dist/cjs/react/nodes/panel.js +26 -16
- package/dist/cjs/react/nodes/table/sticky.js +63 -55
- package/dist/cjs/react/nodes/table.js +2 -10
- package/dist/cjs/react/utils/inject-props.js +33 -0
- package/dist/cjs/react/utils/performance/RenderTracking.js +52 -0
- package/dist/cjs/ui/Expand.js +52 -28
- package/dist/cjs/ui/MediaCard.js +4 -14
- package/dist/cjs/ui/Renderer/index.js +72 -64
- package/dist/cjs/ui/Renderer/style.js +62 -55
- package/dist/cjs/ui/Renderer/truncated-wrapper.js +19 -21
- package/dist/cjs/ui/SortingIcon.js +8 -9
- package/dist/cjs/ui/annotations/draft/component.js +22 -12
- package/dist/cjs/ui/annotations/element/mark.js +9 -5
- package/dist/cjs/ui/renderer-props.js +1 -3
- package/dist/cjs/version.json +1 -1
- package/dist/es2019/analytics/enums.js +2 -0
- package/dist/es2019/react/marks/alignment.js +15 -7
- package/dist/es2019/react/marks/breakout.js +6 -5
- package/dist/es2019/react/marks/link.js +8 -5
- package/dist/es2019/react/nodes/codeBlock.js +25 -23
- package/dist/es2019/react/nodes/codeBlockCopyButton.js +12 -9
- package/dist/es2019/react/nodes/embedCard.js +16 -16
- package/dist/es2019/react/nodes/heading-anchor.js +9 -6
- package/dist/es2019/react/nodes/heading.js +4 -2
- package/dist/es2019/react/nodes/layoutColumn.js +7 -3
- package/dist/es2019/react/nodes/media.js +9 -5
- package/dist/es2019/react/nodes/mediaSingle/index.js +10 -6
- package/dist/es2019/react/nodes/mediaSingle/styles.js +6 -7
- package/dist/es2019/react/nodes/panel.js +23 -16
- package/dist/es2019/react/nodes/table/sticky.js +55 -37
- package/dist/es2019/react/nodes/table.js +2 -5
- package/dist/es2019/react/utils/inject-props.js +24 -0
- package/dist/es2019/react/utils/performance/RenderTracking.js +37 -0
- package/dist/es2019/ui/Expand.js +65 -36
- package/dist/es2019/ui/MediaCard.js +3 -6
- package/dist/es2019/ui/Renderer/index.js +72 -57
- package/dist/es2019/ui/Renderer/style.js +370 -327
- package/dist/es2019/ui/Renderer/truncated-wrapper.js +26 -15
- package/dist/es2019/ui/SortingIcon.js +9 -7
- package/dist/es2019/ui/annotations/draft/component.js +18 -12
- package/dist/es2019/ui/annotations/element/mark.js +12 -6
- package/dist/es2019/ui/renderer-props.js +1 -1
- package/dist/es2019/version.json +1 -1
- package/dist/esm/analytics/enums.js +2 -0
- package/dist/esm/react/marks/alignment.js +13 -6
- package/dist/esm/react/marks/breakout.js +6 -5
- package/dist/esm/react/marks/link.js +7 -5
- package/dist/esm/react/nodes/codeBlock.js +18 -14
- package/dist/esm/react/nodes/codeBlockCopyButton.js +10 -7
- package/dist/esm/react/nodes/embedCard.js +19 -19
- package/dist/esm/react/nodes/heading-anchor.js +8 -6
- package/dist/esm/react/nodes/heading.js +4 -2
- package/dist/esm/react/nodes/layoutColumn.js +7 -3
- package/dist/esm/react/nodes/media.js +8 -5
- package/dist/esm/react/nodes/mediaSingle/index.js +11 -6
- package/dist/esm/react/nodes/mediaSingle/styles.js +5 -7
- package/dist/esm/react/nodes/panel.js +27 -15
- package/dist/esm/react/nodes/table/sticky.js +64 -53
- package/dist/esm/react/nodes/table.js +2 -8
- package/dist/esm/react/utils/inject-props.js +24 -0
- package/dist/esm/react/utils/performance/RenderTracking.js +39 -0
- package/dist/esm/ui/Expand.js +57 -29
- package/dist/esm/ui/MediaCard.js +3 -9
- package/dist/esm/ui/Renderer/index.js +74 -61
- package/dist/esm/ui/Renderer/style.js +58 -51
- package/dist/esm/ui/Renderer/truncated-wrapper.js +20 -14
- package/dist/esm/ui/SortingIcon.js +9 -7
- package/dist/esm/ui/annotations/draft/component.js +18 -11
- package/dist/esm/ui/annotations/element/mark.js +11 -4
- package/dist/esm/ui/renderer-props.js +1 -1
- package/dist/esm/version.json +1 -1
- package/dist/types/analytics/enums.d.ts +2 -0
- package/dist/types/analytics/events.d.ts +12 -2
- package/dist/types/react/marks/alignment.d.ts +2 -2
- package/dist/types/react/marks/breakout.d.ts +4 -3
- package/dist/types/react/marks/link.d.ts +2 -2
- package/dist/types/react/nodes/codeBlock.d.ts +4 -14
- package/dist/types/react/nodes/embedCard.d.ts +3 -2
- package/dist/types/react/nodes/heading-anchor.d.ts +1 -0
- package/dist/types/react/nodes/heading.d.ts +1 -0
- package/dist/types/react/nodes/index.d.ts +1 -13
- package/dist/types/react/nodes/layoutColumn.d.ts +3 -1
- package/dist/types/react/nodes/media.d.ts +3 -1
- package/dist/types/react/nodes/mediaSingle/index.d.ts +1 -0
- package/dist/types/react/nodes/mediaSingle/styles.d.ts +2 -3
- package/dist/types/react/nodes/panel.d.ts +3 -1
- package/dist/types/react/nodes/table/sticky.d.ts +4 -2
- package/dist/types/react/utils/inject-props.d.ts +6 -0
- package/dist/types/react/utils/performance/RenderTracking.d.ts +15 -0
- package/dist/types/ui/Expand.d.ts +3 -2
- package/dist/types/ui/MediaCard.d.ts +1 -3
- package/dist/types/ui/Renderer/index.d.ts +3 -26
- package/dist/types/ui/Renderer/style.d.ts +2 -3
- package/dist/types/ui/Renderer/truncated-wrapper.d.ts +3 -1
- package/dist/types/ui/SortingIcon.d.ts +3 -3
- package/dist/types/ui/annotations/draft/component.d.ts +1 -0
- package/dist/types/ui/annotations/element/mark.d.ts +1 -0
- package/dist/types/ui/renderer-props.d.ts +14 -2
- package/package.json +22 -23
|
@@ -32,14 +32,16 @@ function Heading(props) {
|
|
|
32
32
|
headingId,
|
|
33
33
|
dataAttributes,
|
|
34
34
|
allowHeadingAnchorLinks,
|
|
35
|
-
marks
|
|
35
|
+
marks,
|
|
36
|
+
invisible
|
|
36
37
|
} = props;
|
|
37
38
|
const HX = `h${props.level}`;
|
|
38
39
|
const showAnchorLink = !!props.showAnchorLink;
|
|
39
40
|
const isRightAligned = hasRightAlignmentMark(marks);
|
|
40
41
|
const enableNestedHeaderLinks = allowHeadingAnchorLinks && allowHeadingAnchorLinks.allowNestedHeaderLinks;
|
|
42
|
+
const headingIdToUse = invisible ? undefined : headingId;
|
|
41
43
|
return /*#__PURE__*/React.createElement(HX, _extends({
|
|
42
|
-
id:
|
|
44
|
+
id: headingIdToUse
|
|
43
45
|
}, dataAttributes), /*#__PURE__*/React.createElement(React.Fragment, null, showAnchorLink && isRightAligned ? WrapChildTextInSpan(props.children) : props.children, showAnchorLink && /*#__PURE__*/React.createElement(CopyTextConsumer, null, ({
|
|
44
46
|
copyTextToClipboard
|
|
45
47
|
}) => {
|
|
@@ -1,11 +1,15 @@
|
|
|
1
|
+
/** @jsx jsx */
|
|
1
2
|
import React from 'react';
|
|
2
|
-
import {
|
|
3
|
+
import { jsx } from '@emotion/react';
|
|
4
|
+
import { WidthProvider, clearNextSiblingMarginTopStyle } from '@atlaskit/editor-common/ui';
|
|
3
5
|
export default function LayoutSection(props) {
|
|
4
|
-
return
|
|
6
|
+
return jsx("div", {
|
|
5
7
|
"data-layout-column": true,
|
|
6
8
|
"data-column-width": props.width,
|
|
7
9
|
style: {
|
|
8
10
|
flexBasis: `${props.width}%`
|
|
9
11
|
}
|
|
10
|
-
},
|
|
12
|
+
}, jsx(WidthProvider, null, jsx("div", {
|
|
13
|
+
css: clearNextSiblingMarginTopStyle
|
|
14
|
+
}), props.children));
|
|
11
15
|
}
|
|
@@ -1,9 +1,12 @@
|
|
|
1
1
|
import _extends from "@babel/runtime/helpers/extends";
|
|
2
2
|
import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
3
|
+
|
|
4
|
+
/** @jsx jsx */
|
|
3
5
|
import React from 'react';
|
|
4
6
|
import { PureComponent } from 'react';
|
|
7
|
+
import { jsx } from '@emotion/react';
|
|
5
8
|
import { WithProviders } from '@atlaskit/editor-common/provider-factory';
|
|
6
|
-
import {
|
|
9
|
+
import { mediaLinkStyle } from '@atlaskit/editor-common/ui';
|
|
7
10
|
import { MediaCard } from '../../ui/MediaCard';
|
|
8
11
|
import { getEventHandler } from '../../utils';
|
|
9
12
|
import { ACTION, ACTION_SUBJECT, ACTION_SUBJECT_ID, EVENT_TYPE } from '../../analytics/enums';
|
|
@@ -29,7 +32,7 @@ export default class Media extends PureComponent {
|
|
|
29
32
|
const linkHref = linkMark === null || linkMark === void 0 ? void 0 : linkMark.attrs.href;
|
|
30
33
|
const eventHandlers = linkHref ? undefined : this.props.eventHandlers;
|
|
31
34
|
const shouldOpenMediaViewer = !linkHref && allowMediaViewer;
|
|
32
|
-
const mediaComponent =
|
|
35
|
+
const mediaComponent = jsx(MediaCard, _extends({
|
|
33
36
|
mediaProvider: mediaProvider,
|
|
34
37
|
contextIdentifierProvider: contextIdentifierProvider
|
|
35
38
|
}, this.props, {
|
|
@@ -40,11 +43,12 @@ export default class Media extends PureComponent {
|
|
|
40
43
|
shouldEnableDownloadButton: enableDownloadButton,
|
|
41
44
|
ssr: ssr
|
|
42
45
|
}));
|
|
43
|
-
return linkHref ?
|
|
46
|
+
return linkHref ? jsx("a", {
|
|
44
47
|
href: linkHref,
|
|
45
48
|
rel: "noreferrer noopener",
|
|
46
49
|
onClick: this.handleMediaLinkClick,
|
|
47
|
-
"data-block-link": linkHref
|
|
50
|
+
"data-block-link": linkHref,
|
|
51
|
+
css: mediaLinkStyle
|
|
48
52
|
}, mediaComponent) : mediaComponent;
|
|
49
53
|
});
|
|
50
54
|
|
|
@@ -88,7 +92,7 @@ export default class Media extends PureComponent {
|
|
|
88
92
|
return this.renderCard();
|
|
89
93
|
}
|
|
90
94
|
|
|
91
|
-
return
|
|
95
|
+
return jsx(WithProviders, {
|
|
92
96
|
providers: ['mediaProvider', 'contextIdentifierProvider'],
|
|
93
97
|
providerFactory: providers,
|
|
94
98
|
renderNode: this.renderCard
|
|
@@ -1,11 +1,13 @@
|
|
|
1
|
-
|
|
1
|
+
/** @jsx jsx */
|
|
2
|
+
import { default as React, Fragment } from 'react';
|
|
3
|
+
import { jsx } from '@emotion/react';
|
|
2
4
|
import { injectIntl } from 'react-intl-next';
|
|
3
5
|
import { getMediaFeatureFlag } from '@atlaskit/media-common';
|
|
4
|
-
import { mapBreakpointToLayoutMaxWidth, getBreakpoint, WidthConsumer } from '@atlaskit/editor-common/ui';
|
|
6
|
+
import { mapBreakpointToLayoutMaxWidth, getBreakpoint, MediaSingle as UIMediaSingle, WidthConsumer } from '@atlaskit/editor-common/ui';
|
|
5
7
|
import { akEditorFullWidthLayoutWidth, getAkEditorFullPageMaxWidth, akEditorDefaultLayoutWidth } from '@atlaskit/editor-shared-styles';
|
|
6
8
|
import { FullPagePadding } from '../../../ui/Renderer/style';
|
|
7
9
|
import { useObservedWidth } from '../../hooks/use-observed-width';
|
|
8
|
-
import {
|
|
10
|
+
import { uiMediaSingleBaseStyles, uiMediaSingleLayoutStyles } from './styles';
|
|
9
11
|
const DEFAULT_WIDTH = 250;
|
|
10
12
|
const DEFAULT_HEIGHT = 200;
|
|
11
13
|
|
|
@@ -166,7 +168,9 @@ const MediaSingle = props => {
|
|
|
166
168
|
disableOverlay: true,
|
|
167
169
|
featureFlags
|
|
168
170
|
});
|
|
169
|
-
|
|
171
|
+
const uiMediaSingleStyles = layout === 'full-width' || layout === 'wide' ? [uiMediaSingleBaseStyles, uiMediaSingleLayoutStyles] : [uiMediaSingleBaseStyles];
|
|
172
|
+
return jsx(UIMediaSingle, {
|
|
173
|
+
css: uiMediaSingleStyles,
|
|
170
174
|
handleMediaSingleRef: ref,
|
|
171
175
|
layout: layout,
|
|
172
176
|
width: width,
|
|
@@ -175,10 +179,10 @@ const MediaSingle = props => {
|
|
|
175
179
|
containerWidth: containerWidth,
|
|
176
180
|
pctWidth: pctWidth,
|
|
177
181
|
fullWidthMode: isFullWidth
|
|
178
|
-
},
|
|
182
|
+
}, jsx(Fragment, null, mediaComponent), isCaptionsFlaggedOn && caption);
|
|
179
183
|
};
|
|
180
184
|
|
|
181
|
-
return observedWidthFlag ? renderMediaSingle(observedWidth || document.body.offsetWidth) :
|
|
185
|
+
return observedWidthFlag ? renderMediaSingle(observedWidth || document.body.offsetWidth) : jsx(WidthConsumer, null, ({
|
|
182
186
|
width,
|
|
183
187
|
breakpoint
|
|
184
188
|
}) => {
|
|
@@ -1,10 +1,9 @@
|
|
|
1
|
-
|
|
2
|
-
import {
|
|
3
|
-
export const
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
1
|
+
/** @jsx jsx */
|
|
2
|
+
import { css } from '@emotion/react';
|
|
3
|
+
export const uiMediaSingleBaseStyles = css`
|
|
4
|
+
transition: all 0.1s linear;
|
|
5
|
+
`;
|
|
6
|
+
export const uiMediaSingleLayoutStyles = css`
|
|
7
7
|
margin-left: 50%;
|
|
8
8
|
transform: translateX(-50%);
|
|
9
|
-
` : ``} transition: all 0.1s linear;
|
|
10
9
|
`;
|
|
@@ -1,5 +1,8 @@
|
|
|
1
|
+
import _extends from "@babel/runtime/helpers/extends";
|
|
2
|
+
|
|
3
|
+
/** @jsx jsx */
|
|
1
4
|
import React from 'react';
|
|
2
|
-
import
|
|
5
|
+
import { css, jsx } from '@emotion/react';
|
|
3
6
|
import TipIcon from '@atlaskit/icon/glyph/editor/hint';
|
|
4
7
|
import { PanelType } from '@atlaskit/adf-schema';
|
|
5
8
|
import { PanelSharedCssClassName } from '@atlaskit/editor-common/styles';
|
|
@@ -10,23 +13,27 @@ import EmojiItem from './emoji'; // AFP-2532 TODO: Fix automatic suppressions be
|
|
|
10
13
|
import { themed } from '@atlaskit/theme';
|
|
11
14
|
import { getPanelBackgroundDarkModeColors } from '@atlaskit/editor-common/styles';
|
|
12
15
|
import { PanelInfoIcon, PanelSuccessIcon, PanelNoteIcon, PanelWarningIcon, PanelErrorIcon } from '@atlaskit/editor-common/icons';
|
|
13
|
-
const PanelStyled = styled.div`
|
|
14
|
-
${props => {
|
|
15
|
-
if (props['data-panel-type'] !== PanelType.CUSTOM || !props.backgroundColor) {
|
|
16
|
-
return '';
|
|
17
|
-
} // Similar to mainDynamicStyles()
|
|
18
16
|
|
|
17
|
+
const PanelStyled = props => {
|
|
18
|
+
let styles = themeProps => css``;
|
|
19
19
|
|
|
20
|
-
|
|
20
|
+
if (props['data-panel-type'] === PanelType.CUSTOM && props.backgroundColor) {
|
|
21
|
+
styles = themeProps => css`
|
|
21
22
|
&[data-panel-type=${PanelType.CUSTOM}] {
|
|
22
23
|
background-color: ${props.backgroundColor};
|
|
23
24
|
${themed({
|
|
24
|
-
|
|
25
|
-
|
|
25
|
+
dark: getPanelBackgroundDarkModeColors
|
|
26
|
+
})(themeProps)};
|
|
26
27
|
}
|
|
27
28
|
`;
|
|
28
|
-
}
|
|
29
|
-
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
return jsx("div", _extends({
|
|
32
|
+
css: styles
|
|
33
|
+
}, props), props.children);
|
|
34
|
+
};
|
|
35
|
+
|
|
36
|
+
PanelStyled.displayName = 'PanelStyled';
|
|
30
37
|
const panelIcons = {
|
|
31
38
|
info: PanelInfoIcon,
|
|
32
39
|
success: PanelSuccessIcon,
|
|
@@ -55,7 +62,7 @@ const Panel = props => {
|
|
|
55
62
|
const getIcon = () => {
|
|
56
63
|
if (panelType === PanelType.CUSTOM) {
|
|
57
64
|
if (panelIcon && providers) {
|
|
58
|
-
return
|
|
65
|
+
return jsx(EmojiItem, {
|
|
59
66
|
id: panelIconId,
|
|
60
67
|
text: panelIconText,
|
|
61
68
|
shortName: panelIcon,
|
|
@@ -67,7 +74,7 @@ const Panel = props => {
|
|
|
67
74
|
}
|
|
68
75
|
|
|
69
76
|
const Icon = panelIcons[panelType];
|
|
70
|
-
return
|
|
77
|
+
return jsx(Icon, {
|
|
71
78
|
label: `Panel ${panelType}`
|
|
72
79
|
});
|
|
73
80
|
};
|
|
@@ -76,13 +83,13 @@ const Panel = props => {
|
|
|
76
83
|
const icon = getIcon();
|
|
77
84
|
|
|
78
85
|
if (icon) {
|
|
79
|
-
return
|
|
86
|
+
return jsx("div", {
|
|
80
87
|
className: PanelSharedCssClassName.icon
|
|
81
88
|
}, icon);
|
|
82
89
|
}
|
|
83
90
|
};
|
|
84
91
|
|
|
85
|
-
return
|
|
92
|
+
return jsx(PanelStyled, {
|
|
86
93
|
className: PanelSharedCssClassName.prefix,
|
|
87
94
|
"data-panel-type": panelType,
|
|
88
95
|
"data-panel-color": panelColor,
|
|
@@ -90,7 +97,7 @@ const Panel = props => {
|
|
|
90
97
|
"data-panel-icon-id": panelIconId,
|
|
91
98
|
"data-panel-icon-text": panelIconText,
|
|
92
99
|
backgroundColor: panelColor
|
|
93
|
-
}, renderIcon(),
|
|
100
|
+
}, renderIcon(), jsx("div", {
|
|
94
101
|
className: PanelSharedCssClassName.content
|
|
95
102
|
}, children));
|
|
96
103
|
};
|
|
@@ -1,5 +1,6 @@
|
|
|
1
|
+
/** @jsx jsx */
|
|
1
2
|
import React from 'react';
|
|
2
|
-
import
|
|
3
|
+
import { css, jsx } from '@emotion/react';
|
|
3
4
|
import { TableSharedCssClassName } from '@atlaskit/editor-common/styles';
|
|
4
5
|
import { akEditorStickyHeaderZIndex } from '@atlaskit/editor-shared-styles';
|
|
5
6
|
import * as colors from '@atlaskit/theme/colors';
|
|
@@ -8,35 +9,29 @@ const {
|
|
|
8
9
|
} = colors;
|
|
9
10
|
import { findHorizontalOverflowScrollParent } from '../../../utils';
|
|
10
11
|
import { Table } from './table';
|
|
12
|
+
import { recursivelyInjectProps } from '../../utils/inject-props';
|
|
11
13
|
export const tableStickyPadding = 8;
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
left,
|
|
17
|
-
top
|
|
18
|
-
}) => ({
|
|
19
|
-
left: left && left < 0 ? left : undefined,
|
|
20
|
-
top
|
|
21
|
-
})
|
|
22
|
-
})`
|
|
23
|
-
position: relative;
|
|
24
|
-
`;
|
|
25
|
-
export const FixedTableDiv = styled.div.attrs({
|
|
26
|
-
style: ({
|
|
27
|
-
top,
|
|
28
|
-
wrapperWidth
|
|
29
|
-
}) => ({
|
|
30
|
-
top,
|
|
31
|
-
width: wrapperWidth
|
|
32
|
-
})
|
|
33
|
-
})`
|
|
34
|
-
${props => props.mode === 'stick' ? 'position: fixed' : ''};
|
|
35
|
-
${props => props.mode === 'pin-bottom' ? 'position: absolute' : ''};
|
|
36
|
-
${props => props.mode === 'none' ? 'display: none' : ''};
|
|
14
|
+
const fixedTableDivModeToPosition = {
|
|
15
|
+
stick: 'fixed',
|
|
16
|
+
'pin-bottom': 'absolute'
|
|
17
|
+
};
|
|
37
18
|
|
|
38
|
-
|
|
19
|
+
const getModeSpecificStyles = mode => {
|
|
20
|
+
if (mode === 'none') {
|
|
21
|
+
return css`
|
|
22
|
+
display: none;
|
|
23
|
+
`;
|
|
24
|
+
} else {
|
|
25
|
+
return css`
|
|
26
|
+
position: ${fixedTableDivModeToPosition[mode]};
|
|
27
|
+
`;
|
|
28
|
+
}
|
|
29
|
+
};
|
|
39
30
|
|
|
31
|
+
const fixedTableDivStaticStyles = (top, width) => css`
|
|
32
|
+
top: ${top}px;
|
|
33
|
+
width: ${width}px;
|
|
34
|
+
z-index: ${akEditorStickyHeaderZIndex};
|
|
40
35
|
&
|
|
41
36
|
.${TableSharedCssClassName.TABLE_CONTAINER},
|
|
42
37
|
&
|
|
@@ -62,7 +57,18 @@ export const FixedTableDiv = styled.div.attrs({
|
|
|
62
57
|
height: 100%;
|
|
63
58
|
}
|
|
64
59
|
`;
|
|
65
|
-
|
|
60
|
+
|
|
61
|
+
export const FixedTableDiv = props => {
|
|
62
|
+
const {
|
|
63
|
+
top,
|
|
64
|
+
wrapperWidth,
|
|
65
|
+
mode
|
|
66
|
+
} = props;
|
|
67
|
+
const fixedTableCss = [fixedTableDivStaticStyles(top, wrapperWidth), getModeSpecificStyles(mode)];
|
|
68
|
+
return jsx("div", {
|
|
69
|
+
css: fixedTableCss
|
|
70
|
+
}, props.children);
|
|
71
|
+
};
|
|
66
72
|
export const StickyTable = ({
|
|
67
73
|
top,
|
|
68
74
|
left,
|
|
@@ -79,32 +85,44 @@ export const StickyTable = ({
|
|
|
79
85
|
allowDynamicTextSizing,
|
|
80
86
|
rowHeight
|
|
81
87
|
}) => {
|
|
82
|
-
return
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
88
|
+
return jsx("div", {
|
|
89
|
+
css: {
|
|
90
|
+
left: left && left < 0 ? left : undefined,
|
|
91
|
+
top: mode === 'pin-bottom' ? top : undefined,
|
|
92
|
+
position: 'relative'
|
|
93
|
+
}
|
|
94
|
+
}, jsx(FixedTableDiv, {
|
|
86
95
|
top: mode === 'stick' ? top : undefined,
|
|
87
96
|
mode: rowHeight > 300 ? 'none' : mode,
|
|
88
97
|
wrapperWidth: wrapperWidth
|
|
89
|
-
},
|
|
98
|
+
}, jsx("div", {
|
|
90
99
|
className: `${TableSharedCssClassName.TABLE_CONTAINER} ${shadowClassNames}`,
|
|
91
100
|
"data-layout": layout,
|
|
92
101
|
style: {
|
|
93
102
|
width: tableWidth
|
|
94
103
|
}
|
|
95
|
-
},
|
|
96
|
-
|
|
104
|
+
}, jsx("div", {
|
|
105
|
+
ref: innerRef,
|
|
97
106
|
className: `${TableSharedCssClassName.TABLE_STICKY_WRAPPER}`,
|
|
98
107
|
style: {
|
|
99
108
|
overflow: 'hidden'
|
|
100
109
|
}
|
|
101
|
-
},
|
|
110
|
+
}, jsx(Table, {
|
|
102
111
|
columnWidths: columnWidths,
|
|
103
112
|
layout: layout,
|
|
104
113
|
isNumberColumnEnabled: isNumberColumnEnabled,
|
|
105
114
|
renderWidth: renderWidth,
|
|
106
115
|
allowDynamicTextSizing: allowDynamicTextSizing
|
|
107
|
-
},
|
|
116
|
+
},
|
|
117
|
+
/**
|
|
118
|
+
* @see https://product-fabric.atlassian.net/browse/ED-10235
|
|
119
|
+
* We pass prop 'invisible' to our table's children nodes meaning
|
|
120
|
+
* they exist inside of the 'invisible' duplicated table component that
|
|
121
|
+
* enables sticky headers.
|
|
122
|
+
*/
|
|
123
|
+
recursivelyInjectProps(children, {
|
|
124
|
+
invisible: true
|
|
125
|
+
}))))));
|
|
108
126
|
};
|
|
109
127
|
export class OverflowParent {
|
|
110
128
|
constructor(ref) {
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import _extends from "@babel/runtime/helpers/extends";
|
|
2
2
|
import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
3
3
|
import React from 'react';
|
|
4
|
-
import styled from 'styled-components';
|
|
5
4
|
import { calcTableWidth, TableSharedCssClassName, tableMarginTop } from '@atlaskit/editor-common/styles';
|
|
6
5
|
import { WidthConsumer, overflowShadow } from '@atlaskit/editor-common/ui';
|
|
7
6
|
import { createCompareNodes, convertProsemirrorTableNodeToArrayOfRows, hasMergedCell, compose } from '@atlaskit/editor-common/utils';
|
|
@@ -102,8 +101,6 @@ const tableCanBeSticky = (node, children) => {
|
|
|
102
101
|
return isHeaderRowEnabled(children) && node && node.firstChild && !hasRowspan(node.firstChild);
|
|
103
102
|
};
|
|
104
103
|
|
|
105
|
-
const MainTableContainer = styled.div``;
|
|
106
|
-
|
|
107
104
|
const canUseLinelength = appearance => appearance === 'full-page' || appearance === 'mobile';
|
|
108
105
|
|
|
109
106
|
export class TableContainer extends React.Component {
|
|
@@ -290,10 +287,10 @@ export class TableContainer extends React.Component {
|
|
|
290
287
|
columnWidths: columnWidths,
|
|
291
288
|
rowHeight: this.headerRowHeight,
|
|
292
289
|
allowDynamicTextSizing: allowDynamicTextSizing
|
|
293
|
-
}, [children && children[0]]), /*#__PURE__*/React.createElement(
|
|
290
|
+
}, [children && children[0]]), /*#__PURE__*/React.createElement("div", {
|
|
294
291
|
className: `${TableSharedCssClassName.TABLE_CONTAINER} ${this.props.shadowClassNames}`,
|
|
295
292
|
"data-layout": layout,
|
|
296
|
-
|
|
293
|
+
ref: this.props.handleRef,
|
|
297
294
|
style: {
|
|
298
295
|
width: tableWidth,
|
|
299
296
|
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(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,37 @@
|
|
|
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
|
+
const debouncedHandleAnalyticsEvent = useMemo(() => debounce(props.handleAnalyticsEvent, 500), [props.handleAnalyticsEvent]);
|
|
7
|
+
useComponentRenderTracking({
|
|
8
|
+
onRender: ({
|
|
9
|
+
renderCount,
|
|
10
|
+
propsDifference,
|
|
11
|
+
componentId
|
|
12
|
+
}) => {
|
|
13
|
+
if (!renderCount) {
|
|
14
|
+
return;
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
debouncedHandleAnalyticsEvent({
|
|
18
|
+
action: props.action,
|
|
19
|
+
actionSubject: props.actionSubject,
|
|
20
|
+
attributes: {
|
|
21
|
+
count: renderCount,
|
|
22
|
+
propsDifference: propsDifference,
|
|
23
|
+
componentId
|
|
24
|
+
},
|
|
25
|
+
eventType: EVENT_TYPE.OPERATIONAL
|
|
26
|
+
});
|
|
27
|
+
},
|
|
28
|
+
propsDiffingOptions: {
|
|
29
|
+
enabled: true,
|
|
30
|
+
props: props.componentProps,
|
|
31
|
+
propsToIgnore: props.propsToIgnore,
|
|
32
|
+
useShallow: props.useShallow
|
|
33
|
+
},
|
|
34
|
+
zeroBasedCount: true
|
|
35
|
+
});
|
|
36
|
+
return null;
|
|
37
|
+
}
|
package/dist/es2019/ui/Expand.js
CHANGED
|
@@ -1,17 +1,19 @@
|
|
|
1
1
|
import _extends from "@babel/runtime/helpers/extends";
|
|
2
|
-
|
|
3
|
-
|
|
2
|
+
|
|
3
|
+
/** @jsx jsx */
|
|
4
|
+
import React, { useRef, useCallback } from 'react';
|
|
5
|
+
import { css, jsx } from '@emotion/react';
|
|
4
6
|
import { gridSize, fontSize } from '@atlaskit/theme/constants';
|
|
5
7
|
import ChevronRightIcon from '@atlaskit/icon/glyph/chevron-right';
|
|
6
8
|
import Tooltip from '@atlaskit/tooltip';
|
|
7
|
-
import { expandMessages, sharedExpandStyles, WidthProvider, ExpandIconWrapper,
|
|
9
|
+
import { expandMessages, sharedExpandStyles, WidthProvider, ExpandIconWrapper, clearNextSiblingMarginTopStyle, ExpandLayoutWrapperWithRef } from '@atlaskit/editor-common/ui';
|
|
8
10
|
import { akEditorLineHeight, relativeFontSizeToBase16 } from '@atlaskit/editor-shared-styles';
|
|
9
11
|
import { PLATFORM, MODE } from '../analytics/events';
|
|
10
12
|
import { ACTION, ACTION_SUBJECT, EVENT_TYPE } from '../analytics/enums';
|
|
11
13
|
import { injectIntl } from 'react-intl-next';
|
|
12
14
|
import { ActiveHeaderIdConsumer } from './active-header-id-provider';
|
|
13
15
|
import _uniqueId from 'lodash/uniqueId';
|
|
14
|
-
const
|
|
16
|
+
const titleStyles = css`
|
|
15
17
|
outline: none;
|
|
16
18
|
border: none;
|
|
17
19
|
font-size: ${relativeFontSizeToBase16(fontSize())};
|
|
@@ -23,29 +25,53 @@ const Title = styled.span`
|
|
|
23
25
|
padding: 0 0 0 ${gridSize() / 2}px;
|
|
24
26
|
text-align: left;
|
|
25
27
|
`;
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
const
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
`;
|
|
28
|
+
|
|
29
|
+
const Container = props => {
|
|
30
|
+
const paddingBottom = `${props.expanded ? gridSize() : 0}px`;
|
|
31
|
+
const sharedContainerStyles = sharedExpandStyles.containerStyles(props);
|
|
32
|
+
|
|
33
|
+
const styles = themeProps => css`
|
|
34
|
+
${sharedContainerStyles(themeProps)}
|
|
35
|
+
padding: 0;
|
|
36
|
+
padding-bottom: ${paddingBottom};
|
|
37
|
+
`;
|
|
38
|
+
|
|
39
|
+
return jsx("div", _extends({
|
|
40
|
+
css: styles
|
|
41
|
+
}, props), props.children);
|
|
42
|
+
};
|
|
43
|
+
|
|
44
|
+
const TitleContainer = props => {
|
|
45
|
+
const paddingBottom = `${!props.expanded ? gridSize() : 0}px`;
|
|
46
|
+
|
|
47
|
+
const styles = themeProps => css`
|
|
48
|
+
${sharedExpandStyles.titleContainerStyles(themeProps)}
|
|
49
|
+
padding: ${gridSize()}px;
|
|
50
|
+
padding-bottom: ${paddingBottom};
|
|
51
|
+
`;
|
|
52
|
+
|
|
53
|
+
return jsx("button", _extends({
|
|
54
|
+
css: styles
|
|
55
|
+
}, props), props.children);
|
|
56
|
+
};
|
|
57
|
+
|
|
36
58
|
TitleContainer.displayName = 'TitleContainerButton';
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
59
|
+
|
|
60
|
+
const ContentContainer = props => {
|
|
61
|
+
const sharedContentStyles = sharedExpandStyles.contentStyles(props);
|
|
62
|
+
const visibility = props.expanded ? 'visible' : 'hidden';
|
|
63
|
+
|
|
64
|
+
const styles = themeProps => css`
|
|
65
|
+
${sharedContentStyles(themeProps)};
|
|
66
|
+
padding-right: ${gridSize() * 2}px;
|
|
67
|
+
padding-left: ${gridSize() * 5 - gridSize() / 2}px;
|
|
68
|
+
visibility: ${visibility};
|
|
69
|
+
`;
|
|
70
|
+
|
|
71
|
+
return jsx("div", _extends({
|
|
72
|
+
css: styles
|
|
73
|
+
}, props), props.children);
|
|
74
|
+
};
|
|
49
75
|
|
|
50
76
|
function fireExpandToggleAnalytics(nodeType, expanded, fireAnalyticsEvent) {
|
|
51
77
|
if (!fireAnalyticsEvent) {
|
|
@@ -80,16 +106,16 @@ function Expand({
|
|
|
80
106
|
} = useRef(_uniqueId('expand-title-'));
|
|
81
107
|
const handleFocus = useCallback(() => setFocused(true), []);
|
|
82
108
|
const handleBlur = useCallback(() => setFocused(false), []);
|
|
83
|
-
return
|
|
109
|
+
return jsx(Container, {
|
|
84
110
|
"data-node-type": nodeType,
|
|
85
111
|
"data-title": title,
|
|
86
112
|
"data-expanded": expanded,
|
|
87
113
|
expanded: expanded,
|
|
88
114
|
focused: focused
|
|
89
|
-
}, nestedHeaderIds && nestedHeaderIds.length > 0 ?
|
|
115
|
+
}, nestedHeaderIds && nestedHeaderIds.length > 0 ? jsx(ActiveHeaderIdConsumer, {
|
|
90
116
|
nestedHeaderIds: nestedHeaderIds,
|
|
91
117
|
onNestedHeaderIdMatch: () => setExpanded(true)
|
|
92
|
-
}) : null,
|
|
118
|
+
}) : null, jsx(TitleContainer, {
|
|
93
119
|
onClick: e => {
|
|
94
120
|
e.stopPropagation();
|
|
95
121
|
fireExpandToggleAnalytics(nodeType, expanded, fireAnalyticsEvent);
|
|
@@ -104,21 +130,24 @@ function Expand({
|
|
|
104
130
|
"aria-expanded": expanded,
|
|
105
131
|
contentEditable: false,
|
|
106
132
|
expanded: expanded
|
|
107
|
-
},
|
|
133
|
+
}, jsx(Tooltip, {
|
|
108
134
|
content: label,
|
|
109
135
|
position: "top",
|
|
110
136
|
tag: ExpandLayoutWrapperWithRef
|
|
111
|
-
},
|
|
137
|
+
}, jsx(ExpandIconWrapper, {
|
|
112
138
|
expanded: expanded
|
|
113
|
-
},
|
|
139
|
+
}, jsx(ChevronRightIcon, {
|
|
114
140
|
label: label
|
|
115
|
-
}))),
|
|
141
|
+
}))), jsx("span", {
|
|
142
|
+
css: titleStyles,
|
|
116
143
|
id: id
|
|
117
|
-
}, title || intl.formatMessage(expandMessages.expandDefaultTitle))),
|
|
144
|
+
}, title || intl.formatMessage(expandMessages.expandDefaultTitle))), jsx(ContentContainer, {
|
|
118
145
|
expanded: expanded
|
|
119
|
-
},
|
|
146
|
+
}, jsx("div", {
|
|
120
147
|
className: `${nodeType}-content-wrapper`
|
|
121
|
-
},
|
|
148
|
+
}, jsx(WidthProvider, null, jsx("div", {
|
|
149
|
+
css: clearNextSiblingMarginTopStyle
|
|
150
|
+
}), children))));
|
|
122
151
|
}
|
|
123
152
|
|
|
124
153
|
export default injectIntl(Expand);
|
|
@@ -1,11 +1,9 @@
|
|
|
1
1
|
import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
2
|
-
import React from 'react';
|
|
3
|
-
import { Component } from 'react';
|
|
2
|
+
import React, { Component } from 'react';
|
|
4
3
|
import { filter } from '@atlaskit/adf-utils';
|
|
5
4
|
import { Card, CardLoading, CardError } from '@atlaskit/media-card';
|
|
6
5
|
import { getMediaClient } from '@atlaskit/media-client';
|
|
7
6
|
import { withImageLoader } from '@atlaskit/editor-common/utils';
|
|
8
|
-
import styled from 'styled-components';
|
|
9
7
|
const mediaIdentifierMap = new Map();
|
|
10
8
|
export const getListOfIdentifiersFromDoc = doc => {
|
|
11
9
|
if (!doc) {
|
|
@@ -269,7 +267,7 @@ export class MediaCardInternal extends Component {
|
|
|
269
267
|
collectionName: collection,
|
|
270
268
|
occurrenceKey
|
|
271
269
|
};
|
|
272
|
-
return /*#__PURE__*/React.createElement(
|
|
270
|
+
return /*#__PURE__*/React.createElement("div", getClipboardAttrs({
|
|
273
271
|
id,
|
|
274
272
|
alt,
|
|
275
273
|
collection,
|
|
@@ -298,8 +296,7 @@ export class MediaCardInternal extends Component {
|
|
|
298
296
|
}));
|
|
299
297
|
}
|
|
300
298
|
|
|
301
|
-
}
|
|
302
|
-
export const CardWrapper = styled.div``; // Needed for copy & paste
|
|
299
|
+
} // Needed for copy & paste
|
|
303
300
|
|
|
304
301
|
export const getClipboardAttrs = ({
|
|
305
302
|
id,
|