@atlaskit/renderer 90.0.0 → 92.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +28 -0
- package/dist/cjs/analytics/enums.js +1 -0
- package/dist/cjs/react/nodes/codeBlock.js +17 -16
- 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/table/sticky.js +13 -2
- package/dist/cjs/react/utils/inject-props.js +33 -0
- package/dist/cjs/ui/Expand.js +15 -11
- package/dist/cjs/ui/Renderer/index.js +44 -25
- package/dist/cjs/ui/Renderer/style.js +19 -7
- package/dist/cjs/ui/annotations/draft/component.js +22 -12
- package/dist/cjs/ui/annotations/element/mark.js +9 -5
- package/dist/cjs/version.json +1 -1
- package/dist/es2019/analytics/enums.js +1 -0
- package/dist/es2019/react/nodes/codeBlock.js +25 -23
- 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/table/sticky.js +16 -5
- package/dist/es2019/react/utils/inject-props.js +24 -0
- package/dist/es2019/ui/Expand.js +17 -12
- package/dist/es2019/ui/Renderer/index.js +45 -25
- package/dist/es2019/ui/Renderer/style.js +40 -24
- package/dist/es2019/ui/annotations/draft/component.js +18 -12
- package/dist/es2019/ui/annotations/element/mark.js +12 -6
- package/dist/es2019/version.json +1 -1
- package/dist/esm/analytics/enums.js +1 -0
- package/dist/esm/react/nodes/codeBlock.js +18 -14
- 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/table/sticky.js +12 -2
- package/dist/esm/react/utils/inject-props.js +24 -0
- package/dist/esm/ui/Expand.js +16 -12
- package/dist/esm/ui/Renderer/index.js +46 -25
- package/dist/esm/ui/Renderer/style.js +16 -8
- package/dist/esm/ui/annotations/draft/component.js +18 -11
- package/dist/esm/ui/annotations/element/mark.js +11 -4
- package/dist/esm/version.json +1 -1
- package/dist/types/analytics/enums.d.ts +1 -0
- package/dist/types/analytics/events.d.ts +6 -1
- package/dist/types/react/nodes/codeBlock.d.ts +4 -14
- 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/utils/inject-props.d.ts +6 -0
- package/dist/types/ui/Expand.d.ts +1 -0
- package/dist/types/ui/Renderer/index.d.ts +5 -3
- package/dist/types/ui/Renderer/style.d.ts +3 -1
- package/dist/types/ui/annotations/draft/component.d.ts +1 -0
- package/dist/types/ui/annotations/element/mark.d.ts +1 -0
- package/package.json +14 -13
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import styled, { css } from 'styled-components';
|
|
1
|
+
import styled, { css as deprecatedCss } from 'styled-components';
|
|
2
|
+
import { css } from '@emotion/react';
|
|
2
3
|
import { themed } from '@atlaskit/theme/components';
|
|
3
4
|
import { gridSize, fontFamily, fontSize, borderRadius } from '@atlaskit/theme/constants';
|
|
4
5
|
import * as colors from '@atlaskit/theme/colors';
|
|
@@ -33,7 +34,7 @@ export const headingSizes = {
|
|
|
33
34
|
}
|
|
34
35
|
};
|
|
35
36
|
|
|
36
|
-
const headingAnchorStyle = headingTag =>
|
|
37
|
+
const headingAnchorStyle = headingTag => deprecatedCss`
|
|
37
38
|
/**
|
|
38
39
|
* The copy link button doesn't reserve space in the DOM so that
|
|
39
40
|
* the text alignment isn't impacted by the button/icon's space.
|
|
@@ -266,10 +267,43 @@ const fullWidthStyles = ({
|
|
|
266
267
|
width: 100% !important;
|
|
267
268
|
}
|
|
268
269
|
`;
|
|
269
|
-
};
|
|
270
|
+
};
|
|
270
271
|
|
|
272
|
+
export const rendererStyles = theme => {
|
|
273
|
+
// This is required to be compatible with styled-components prop structure.
|
|
274
|
+
const props = {
|
|
275
|
+
theme
|
|
276
|
+
};
|
|
277
|
+
return css`
|
|
278
|
+
${tableSharedStyle(props)}
|
|
279
|
+
|
|
280
|
+
${whitespaceSharedStyles};
|
|
281
|
+
${blockquoteSharedStyles};
|
|
282
|
+
${headingsSharedStyles(props)};
|
|
283
|
+
|
|
284
|
+
${paragraphSharedStyles};
|
|
285
|
+
${listsSharedStyles};
|
|
286
|
+
${indentationSharedStyles};
|
|
287
|
+
${blockMarksSharedStyles};
|
|
288
|
+
${codeMarkSharedStyles(props)};
|
|
289
|
+
${shadowSharedStyle};
|
|
290
|
+
${dateSharedStyle};
|
|
291
|
+
${textColorStyles};
|
|
292
|
+
${tasksAndDecisionsStyles};
|
|
293
|
+
${smartCardSharedStyles}
|
|
294
|
+
|
|
295
|
+
/* plugin styles*/
|
|
296
|
+
${mediaSingleSharedStyle} &
|
|
297
|
+
div[class^='image-wrap-'] + div[class^='image-wrap-'] {
|
|
298
|
+
margin-left: 0;
|
|
299
|
+
margin-right: 0;
|
|
300
|
+
}
|
|
271
301
|
|
|
272
|
-
|
|
302
|
+
${columnLayoutSharedStyle};
|
|
303
|
+
`;
|
|
304
|
+
}; // prettier-ignore
|
|
305
|
+
|
|
306
|
+
export const DeprecatedWrapper = styled.div`
|
|
273
307
|
font-size: ${editorFontSize}px;
|
|
274
308
|
line-height: 1.5rem;
|
|
275
309
|
color: ${themed({
|
|
@@ -322,21 +356,8 @@ export const Wrapper = styled.div`
|
|
|
322
356
|
color: ${colors.placeholderText};
|
|
323
357
|
}
|
|
324
358
|
|
|
325
|
-
${whitespaceSharedStyles};
|
|
326
|
-
${blockquoteSharedStyles};
|
|
327
|
-
${headingsSharedStyles};
|
|
328
359
|
${panelSharedStyles};
|
|
329
360
|
${ruleSharedStyles};
|
|
330
|
-
${paragraphSharedStyles};
|
|
331
|
-
${listsSharedStyles};
|
|
332
|
-
${indentationSharedStyles};
|
|
333
|
-
${blockMarksSharedStyles};
|
|
334
|
-
${codeMarkSharedStyles};
|
|
335
|
-
${shadowSharedStyle};
|
|
336
|
-
${dateSharedStyle};
|
|
337
|
-
${textColorStyles};
|
|
338
|
-
${tasksAndDecisionsStyles};
|
|
339
|
-
${smartCardSharedStyles}
|
|
340
361
|
|
|
341
362
|
& .UnknownBlock {
|
|
342
363
|
font-family: ${fontFamily()};
|
|
@@ -401,11 +422,7 @@ export const Wrapper = styled.div`
|
|
|
401
422
|
|
|
402
423
|
${alignedHeadingAnchorStyle}
|
|
403
424
|
|
|
404
|
-
|
|
405
|
-
div[class^='image-wrap-'] + div[class^='image-wrap-'] {
|
|
406
|
-
margin-left: 0;
|
|
407
|
-
margin-right: 0;
|
|
408
|
-
}
|
|
425
|
+
|
|
409
426
|
|
|
410
427
|
/* Breakout for tables and extensions */
|
|
411
428
|
.${RendererCssClassName.DOCUMENT} > {
|
|
@@ -436,7 +453,7 @@ export const Wrapper = styled.div`
|
|
|
436
453
|
overflow-x: auto;
|
|
437
454
|
}
|
|
438
455
|
|
|
439
|
-
|
|
456
|
+
|
|
440
457
|
|
|
441
458
|
.${TableSharedCssClassName.TABLE_CONTAINER} {
|
|
442
459
|
z-index: 0;
|
|
@@ -602,7 +619,6 @@ export const Wrapper = styled.div`
|
|
|
602
619
|
}
|
|
603
620
|
}
|
|
604
621
|
|
|
605
|
-
${columnLayoutSharedStyle};
|
|
606
622
|
& [data-layout-section] {
|
|
607
623
|
margin-top: ${gridSize() * 2.5}px;
|
|
608
624
|
& > div + div {
|
|
@@ -1,26 +1,32 @@
|
|
|
1
1
|
import _extends from "@babel/runtime/helpers/extends";
|
|
2
|
-
|
|
2
|
+
|
|
3
|
+
/** @jsx jsx */
|
|
4
|
+
import React, { Fragment } from 'react';
|
|
5
|
+
import { css, jsx } from '@emotion/react';
|
|
3
6
|
import { InsertDraftPosition } from '../types';
|
|
4
7
|
import { AnnotationsDraftContext } from '../context';
|
|
5
8
|
import { splitText, calcTextSplitOffset } from './text';
|
|
6
9
|
import { calcInsertDraftPositionOnText } from './position';
|
|
7
10
|
import { dataAttributes } from './dom';
|
|
8
|
-
import styled from 'styled-components';
|
|
9
11
|
import { AnnotationSharedCSSByState } from '@atlaskit/editor-common/styles';
|
|
10
|
-
|
|
12
|
+
|
|
13
|
+
const markStyles = props => css`
|
|
11
14
|
color: inherit;
|
|
12
15
|
background-color: unset;
|
|
13
16
|
-webkit-tap-highlight-color: rgba(0, 0, 0, 0);
|
|
14
17
|
|
|
15
|
-
${AnnotationSharedCSSByState.focus};
|
|
18
|
+
${AnnotationSharedCSSByState(props).focus};
|
|
16
19
|
`;
|
|
20
|
+
|
|
17
21
|
export const AnnotationDraft = ({
|
|
18
22
|
draftPosition,
|
|
19
23
|
children
|
|
20
24
|
}) => {
|
|
21
|
-
return
|
|
25
|
+
return jsx("mark", _extends({
|
|
22
26
|
"data-renderer-mark": true
|
|
23
|
-
}, dataAttributes(draftPosition)
|
|
27
|
+
}, dataAttributes(draftPosition), {
|
|
28
|
+
css: markStyles
|
|
29
|
+
}), children);
|
|
24
30
|
};
|
|
25
31
|
export const getAnnotationIndex = (annotationPosition, fragmentCount) => {
|
|
26
32
|
if (annotationPosition === InsertDraftPosition.START) {
|
|
@@ -45,13 +51,13 @@ export const applyAnnotationOnText = ({
|
|
|
45
51
|
const annotateIndex = getAnnotationIndex(shouldApplyAnnotationAt, texts.length);
|
|
46
52
|
return texts.map((value, index) => {
|
|
47
53
|
if (annotateIndex === index) {
|
|
48
|
-
return
|
|
54
|
+
return jsx(AnnotationDraft, {
|
|
49
55
|
key: index,
|
|
50
56
|
draftPosition: draftPosition
|
|
51
57
|
}, value);
|
|
52
58
|
}
|
|
53
59
|
|
|
54
|
-
return
|
|
60
|
+
return jsx(React.Fragment, {
|
|
55
61
|
key: index
|
|
56
62
|
}, value);
|
|
57
63
|
});
|
|
@@ -75,11 +81,11 @@ export const TextWithAnnotationDraft = ({
|
|
|
75
81
|
}, [nextDraftPosition, textPosition]);
|
|
76
82
|
|
|
77
83
|
if (shouldApplyAnnotationAt === false || !nextDraftPosition) {
|
|
78
|
-
return
|
|
84
|
+
return jsx(Fragment, null, children);
|
|
79
85
|
}
|
|
80
86
|
|
|
81
87
|
if (shouldApplyAnnotationAt === InsertDraftPosition.AROUND_TEXT) {
|
|
82
|
-
return
|
|
88
|
+
return jsx(AnnotationDraft, {
|
|
83
89
|
key: 0,
|
|
84
90
|
draftPosition: nextDraftPosition
|
|
85
91
|
}, children);
|
|
@@ -89,7 +95,7 @@ export const TextWithAnnotationDraft = ({
|
|
|
89
95
|
const texts = splitText(children, offsets);
|
|
90
96
|
|
|
91
97
|
if (!texts) {
|
|
92
|
-
return
|
|
98
|
+
return jsx(Fragment, null, children);
|
|
93
99
|
}
|
|
94
100
|
|
|
95
101
|
const components = applyAnnotationOnText({
|
|
@@ -97,5 +103,5 @@ export const TextWithAnnotationDraft = ({
|
|
|
97
103
|
shouldApplyAnnotationAt,
|
|
98
104
|
draftPosition: nextDraftPosition
|
|
99
105
|
});
|
|
100
|
-
return
|
|
106
|
+
return jsx(Fragment, null, components);
|
|
101
107
|
};
|
|
@@ -1,22 +1,26 @@
|
|
|
1
1
|
import _extends from "@babel/runtime/helpers/extends";
|
|
2
|
+
|
|
3
|
+
/** @jsx jsx */
|
|
2
4
|
import React, { useMemo, useCallback } from 'react';
|
|
5
|
+
import { css, jsx } from '@emotion/react';
|
|
3
6
|
import { AnnotationSharedCSSByState } from '@atlaskit/editor-common/styles';
|
|
4
7
|
import { AnnotationMarkStates } from '@atlaskit/adf-schema';
|
|
5
|
-
|
|
6
|
-
const
|
|
8
|
+
|
|
9
|
+
const markStyles = props => css`
|
|
7
10
|
color: inherit;
|
|
8
11
|
background-color: unset;
|
|
9
12
|
-webkit-tap-highlight-color: rgba(0, 0, 0, 0);
|
|
10
13
|
|
|
11
14
|
&[data-mark-annotation-state='${AnnotationMarkStates.ACTIVE}'] {
|
|
12
|
-
${AnnotationSharedCSSByState.blur};
|
|
15
|
+
${AnnotationSharedCSSByState(props).blur};
|
|
13
16
|
|
|
14
17
|
&:focus,
|
|
15
18
|
&[data-has-focus='true'] {
|
|
16
|
-
${AnnotationSharedCSSByState.focus};
|
|
19
|
+
${AnnotationSharedCSSByState(props).focus};
|
|
17
20
|
}
|
|
18
21
|
}
|
|
19
22
|
`;
|
|
23
|
+
|
|
20
24
|
export const MarkComponent = ({
|
|
21
25
|
annotationParentIds,
|
|
22
26
|
children,
|
|
@@ -49,8 +53,10 @@ export const MarkComponent = ({
|
|
|
49
53
|
} : {
|
|
50
54
|
'aria-details': annotationIds.join(', ')
|
|
51
55
|
};
|
|
52
|
-
return
|
|
56
|
+
return jsx("mark", _extends({
|
|
53
57
|
id: id,
|
|
54
58
|
onClick: onMarkClick
|
|
55
|
-
}, accessibility, overriddenData
|
|
59
|
+
}, accessibility, overriddenData, {
|
|
60
|
+
css: markStyles
|
|
61
|
+
}), children);
|
|
56
62
|
};
|
package/dist/es2019/version.json
CHANGED
|
@@ -12,6 +12,7 @@ export var ACTION;
|
|
|
12
12
|
(function (ACTION) {
|
|
13
13
|
ACTION["STARTED"] = "started";
|
|
14
14
|
ACTION["RENDERED"] = "rendered";
|
|
15
|
+
ACTION["RENDERER_TTI"] = "tti";
|
|
15
16
|
ACTION["CRASHED"] = "unhandledErrorCaught";
|
|
16
17
|
ACTION["INVALID_PROSEMIRROR_DOCUMENT"] = "invalidProsemirrorDocument";
|
|
17
18
|
ACTION["SELECT_ALL_CAUGHT"] = "selectAllCaught";
|
|
@@ -2,9 +2,9 @@ import _taggedTemplateLiteral from "@babel/runtime/helpers/taggedTemplateLiteral
|
|
|
2
2
|
|
|
3
3
|
var _templateObject;
|
|
4
4
|
|
|
5
|
-
|
|
5
|
+
/** @jsx jsx */
|
|
6
|
+
import { jsx, css } from '@emotion/react';
|
|
6
7
|
import { injectIntl } from 'react-intl-next';
|
|
7
|
-
import styled from 'styled-components';
|
|
8
8
|
import { CodeBlock as AkCodeBlock } from '@atlaskit/code';
|
|
9
9
|
import { overflowShadow, relativeFontSizeToBase16 } from '@atlaskit/editor-shared-styles';
|
|
10
10
|
import { N20, DN50 } from '@atlaskit/theme/colors';
|
|
@@ -14,6 +14,16 @@ import { codeBidiWarningMessages } from '@atlaskit/editor-common/messages';
|
|
|
14
14
|
import { useFeatureFlags } from '../../use-feature-flags';
|
|
15
15
|
import CopyButton from './codeBlockCopyButton';
|
|
16
16
|
|
|
17
|
+
var codeBlockStyle = function codeBlockStyle(props) {
|
|
18
|
+
return css(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n tab-size: 4;\n [data-ds--code--code-block] {\n font-size: ", ";\n line-height: 1.5rem;\n background-image: ", ";\n background-attachment: local, scroll, scroll;\n background-position: 100% 0, 100% 0, 0 0;\n\n "])), relativeFontSizeToBase16(fontSize()), overflowShadow({
|
|
19
|
+
background: themed({
|
|
20
|
+
light: N20,
|
|
21
|
+
dark: DN50
|
|
22
|
+
})(props),
|
|
23
|
+
width: "".concat(gridSize(), "px")
|
|
24
|
+
}));
|
|
25
|
+
};
|
|
26
|
+
|
|
17
27
|
function CodeBlock(props) {
|
|
18
28
|
var text = props.text,
|
|
19
29
|
language = props.language,
|
|
@@ -23,11 +33,12 @@ function CodeBlock(props) {
|
|
|
23
33
|
var featureFlags = useFeatureFlags();
|
|
24
34
|
var codeBidiWarningLabel = props.intl.formatMessage(codeBidiWarningMessages.label);
|
|
25
35
|
var className = ['code-block', props.className].join(' ');
|
|
26
|
-
return
|
|
27
|
-
className: className
|
|
28
|
-
|
|
36
|
+
return jsx("div", {
|
|
37
|
+
className: className,
|
|
38
|
+
css: codeBlockStyle
|
|
39
|
+
}, allowCopyToClipboard ? jsx(CopyButton, {
|
|
29
40
|
content: text
|
|
30
|
-
}) : null,
|
|
41
|
+
}) : null, jsx(AkCodeBlock, {
|
|
31
42
|
language: language,
|
|
32
43
|
text: text,
|
|
33
44
|
codeBidiWarnings: featureFlags === null || featureFlags === void 0 ? void 0 : featureFlags.codeBidiWarnings,
|
|
@@ -36,11 +47,4 @@ function CodeBlock(props) {
|
|
|
36
47
|
}));
|
|
37
48
|
}
|
|
38
49
|
|
|
39
|
-
|
|
40
|
-
export default styled(IntlCodeBlock)(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n tab-size: 4;\n [data-ds--code--code-block] {\n font-size: ", ";\n line-height: 1.5rem;\n background-image: ", ";\n background-attachment: local, scroll, scroll;\n background-position: 100% 0, 100% 0, 0 0;\n }\n"])), relativeFontSizeToBase16(fontSize()), overflowShadow({
|
|
41
|
-
background: themed({
|
|
42
|
-
light: N20,
|
|
43
|
-
dark: DN50
|
|
44
|
-
}),
|
|
45
|
-
width: "".concat(gridSize(), "px")
|
|
46
|
-
}));
|
|
50
|
+
export default injectIntl(CodeBlock);
|
|
@@ -34,13 +34,15 @@ function Heading(props) {
|
|
|
34
34
|
var headingId = props.headingId,
|
|
35
35
|
dataAttributes = props.dataAttributes,
|
|
36
36
|
allowHeadingAnchorLinks = props.allowHeadingAnchorLinks,
|
|
37
|
-
marks = props.marks
|
|
37
|
+
marks = props.marks,
|
|
38
|
+
invisible = props.invisible;
|
|
38
39
|
var HX = "h".concat(props.level);
|
|
39
40
|
var showAnchorLink = !!props.showAnchorLink;
|
|
40
41
|
var isRightAligned = hasRightAlignmentMark(marks);
|
|
41
42
|
var enableNestedHeaderLinks = allowHeadingAnchorLinks && allowHeadingAnchorLinks.allowNestedHeaderLinks;
|
|
43
|
+
var headingIdToUse = invisible ? undefined : headingId;
|
|
42
44
|
return /*#__PURE__*/React.createElement(HX, _extends({
|
|
43
|
-
id:
|
|
45
|
+
id: headingIdToUse
|
|
44
46
|
}, dataAttributes), /*#__PURE__*/React.createElement(React.Fragment, null, showAnchorLink && isRightAligned ? WrapChildTextInSpan(props.children) : props.children, showAnchorLink && /*#__PURE__*/React.createElement(CopyTextConsumer, null, function (_ref) {
|
|
45
47
|
var copyTextToClipboard = _ref.copyTextToClipboard;
|
|
46
48
|
return headingId && /*#__PURE__*/React.createElement(AnalyticsContext.Consumer, null, function (_ref2) {
|
|
@@ -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: "".concat(props.width, "%")
|
|
9
11
|
}
|
|
10
|
-
},
|
|
12
|
+
}, jsx(WidthProvider, null, jsx("div", {
|
|
13
|
+
css: clearNextSiblingMarginTopStyle
|
|
14
|
+
}), props.children));
|
|
11
15
|
}
|
|
@@ -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 {
|
|
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 =
|
|
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 ?
|
|
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
|
|
121
|
+
return jsx(WithProviders, {
|
|
119
122
|
providers: ['mediaProvider', 'contextIdentifierProvider'],
|
|
120
123
|
providerFactory: providers,
|
|
121
124
|
renderNode: this.renderCard
|
|
@@ -12,6 +12,7 @@ import * as colors from '@atlaskit/theme/colors';
|
|
|
12
12
|
var N40A = colors.N40A;
|
|
13
13
|
import { findHorizontalOverflowScrollParent } from '../../../utils';
|
|
14
14
|
import { Table } from './table';
|
|
15
|
+
import { recursivelyInjectProps } from '../../utils/inject-props';
|
|
15
16
|
export var tableStickyPadding = 8;
|
|
16
17
|
// creates a new stacking context and places the div in the same
|
|
17
18
|
// position as the table
|
|
@@ -34,7 +35,7 @@ export var FixedTableDiv = styled.div.attrs({
|
|
|
34
35
|
width: wrapperWidth
|
|
35
36
|
};
|
|
36
37
|
}
|
|
37
|
-
})(_templateObject2 || (_templateObject2 = _taggedTemplateLiteral(["\n ", ";\n ", ";\n ", ";\n\n z-index: ", ";\n\n
|
|
38
|
+
})(_templateObject2 || (_templateObject2 = _taggedTemplateLiteral(["\n ", ";\n ", ";\n ", ";\n\n z-index: ", ";\n\n // Fix this when move we move this to use emotion\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
39
|
return props.mode === 'stick' ? 'position: fixed' : '';
|
|
39
40
|
}, function (props) {
|
|
40
41
|
return props.mode === 'pin-bottom' ? 'position: absolute' : '';
|
|
@@ -82,7 +83,16 @@ export var StickyTable = function StickyTable(_ref3) {
|
|
|
82
83
|
isNumberColumnEnabled: isNumberColumnEnabled,
|
|
83
84
|
renderWidth: renderWidth,
|
|
84
85
|
allowDynamicTextSizing: allowDynamicTextSizing
|
|
85
|
-
},
|
|
86
|
+
},
|
|
87
|
+
/**
|
|
88
|
+
* @see https://product-fabric.atlassian.net/browse/ED-10235
|
|
89
|
+
* We pass prop 'invisible' to our table's children nodes meaning
|
|
90
|
+
* they exist inside of the 'invisible' duplicated table component that
|
|
91
|
+
* enables sticky headers.
|
|
92
|
+
*/
|
|
93
|
+
recursivelyInjectProps(children, {
|
|
94
|
+
invisible: true
|
|
95
|
+
}))))));
|
|
86
96
|
};
|
|
87
97
|
export var OverflowParent = /*#__PURE__*/function () {
|
|
88
98
|
function OverflowParent(ref) {
|
|
@@ -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
|
+
}
|
package/dist/esm/ui/Expand.js
CHANGED
|
@@ -4,12 +4,14 @@ import _taggedTemplateLiteral from "@babel/runtime/helpers/taggedTemplateLiteral
|
|
|
4
4
|
|
|
5
5
|
var _templateObject, _templateObject2, _templateObject3, _templateObject4;
|
|
6
6
|
|
|
7
|
+
/** @jsx jsx */
|
|
7
8
|
import React, { forwardRef, useRef, useCallback } from 'react';
|
|
9
|
+
import { jsx } from '@emotion/react';
|
|
8
10
|
import styled from 'styled-components';
|
|
9
11
|
import { gridSize, fontSize } from '@atlaskit/theme/constants';
|
|
10
12
|
import ChevronRightIcon from '@atlaskit/icon/glyph/chevron-right';
|
|
11
13
|
import Tooltip from '@atlaskit/tooltip';
|
|
12
|
-
import { expandMessages, sharedExpandStyles, WidthProvider, ExpandIconWrapper, ExpandLayoutWrapper,
|
|
14
|
+
import { expandMessages, sharedExpandStyles, WidthProvider, ExpandIconWrapper, ExpandLayoutWrapper, clearNextSiblingMarginTopStyle } from '@atlaskit/editor-common/ui';
|
|
13
15
|
import { akEditorLineHeight, relativeFontSizeToBase16 } from '@atlaskit/editor-shared-styles';
|
|
14
16
|
import { PLATFORM, MODE } from '../analytics/events';
|
|
15
17
|
import { ACTION, ACTION_SUBJECT, EVENT_TYPE } from '../analytics/enums';
|
|
@@ -29,7 +31,7 @@ var ContentContainer = styled.div(_templateObject4 || (_templateObject4 = _tagge
|
|
|
29
31
|
});
|
|
30
32
|
var ExpandLayoutWrapperWithRef = /*#__PURE__*/forwardRef(function WithRef(props, ref) {
|
|
31
33
|
// @ts-ignore: incorrect innerRef typing
|
|
32
|
-
return
|
|
34
|
+
return jsx(ExpandLayoutWrapper, _extends({}, props, {
|
|
33
35
|
innerRef: ref
|
|
34
36
|
}));
|
|
35
37
|
});
|
|
@@ -80,18 +82,18 @@ function Expand(_ref) {
|
|
|
80
82
|
var handleBlur = useCallback(function () {
|
|
81
83
|
return setFocused(false);
|
|
82
84
|
}, []);
|
|
83
|
-
return
|
|
85
|
+
return jsx(Container, {
|
|
84
86
|
"data-node-type": nodeType,
|
|
85
87
|
"data-title": title,
|
|
86
88
|
"data-expanded": expanded,
|
|
87
89
|
expanded: expanded,
|
|
88
90
|
focused: focused
|
|
89
|
-
}, nestedHeaderIds && nestedHeaderIds.length > 0 ?
|
|
91
|
+
}, nestedHeaderIds && nestedHeaderIds.length > 0 ? jsx(ActiveHeaderIdConsumer, {
|
|
90
92
|
nestedHeaderIds: nestedHeaderIds,
|
|
91
93
|
onNestedHeaderIdMatch: function onNestedHeaderIdMatch() {
|
|
92
94
|
return setExpanded(true);
|
|
93
95
|
}
|
|
94
|
-
}) : null,
|
|
96
|
+
}) : null, jsx(TitleContainer, {
|
|
95
97
|
onClick: function onClick(e) {
|
|
96
98
|
e.stopPropagation();
|
|
97
99
|
fireExpandToggleAnalytics(nodeType, expanded, fireAnalyticsEvent);
|
|
@@ -106,21 +108,23 @@ function Expand(_ref) {
|
|
|
106
108
|
"aria-expanded": expanded,
|
|
107
109
|
contentEditable: false,
|
|
108
110
|
expanded: expanded
|
|
109
|
-
},
|
|
111
|
+
}, jsx(Tooltip, {
|
|
110
112
|
content: label,
|
|
111
113
|
position: "top",
|
|
112
114
|
tag: ExpandLayoutWrapperWithRef
|
|
113
|
-
},
|
|
115
|
+
}, jsx(ExpandIconWrapper, {
|
|
114
116
|
expanded: expanded
|
|
115
|
-
},
|
|
117
|
+
}, jsx(ChevronRightIcon, {
|
|
116
118
|
label: label
|
|
117
|
-
}))),
|
|
119
|
+
}))), jsx(Title, {
|
|
118
120
|
id: id
|
|
119
|
-
}, title || intl.formatMessage(expandMessages.expandDefaultTitle))),
|
|
121
|
+
}, title || intl.formatMessage(expandMessages.expandDefaultTitle))), jsx(ContentContainer, {
|
|
120
122
|
expanded: expanded
|
|
121
|
-
},
|
|
123
|
+
}, jsx("div", {
|
|
122
124
|
className: "".concat(nodeType, "-content-wrapper")
|
|
123
|
-
},
|
|
125
|
+
}, jsx(WidthProvider, null, jsx("div", {
|
|
126
|
+
css: clearNextSiblingMarginTopStyle
|
|
127
|
+
}), children))));
|
|
124
128
|
}
|
|
125
129
|
|
|
126
130
|
export default injectIntl(Expand);
|