@atlaskit/media-card 71.0.0 → 73.1.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 +104 -0
- package/dist/cjs/actions.js +2 -2
- package/dist/cjs/errors.js +83 -8
- package/dist/cjs/files/cardImageView/cardOverlay/styled.js +1 -1
- package/dist/cjs/files/cardImageView/index.js +53 -104
- package/dist/cjs/files/cardImageView/styled.js +1 -1
- package/dist/cjs/files/index.js +0 -6
- package/dist/cjs/index.js +8 -8
- package/dist/cjs/root/card/cardAnalytics.js +4 -16
- package/dist/cjs/root/card/cardLoader.js +66 -124
- package/dist/cjs/root/card/cardState.js +50 -0
- package/dist/cjs/root/card/getCardPreview/cache.js +10 -5
- package/dist/cjs/root/card/getCardPreview/filePreviewStatus.js +53 -0
- package/dist/cjs/root/card/getCardPreview/helpers.js +14 -22
- package/dist/cjs/root/card/getCardPreview/index.js +177 -97
- package/dist/cjs/root/card/getCardStatus.js +7 -1
- package/dist/cjs/root/card/index.js +384 -285
- package/dist/cjs/root/cardView.js +113 -88
- package/dist/cjs/root/inline/loader.js +47 -15
- package/dist/cjs/root/inline/mediaInlineCard.js +33 -12
- package/dist/cjs/root/inlinePlayer.js +77 -24
- package/dist/cjs/root/styled.js +7 -3
- package/dist/cjs/root/ui/actionsBar/styled.js +1 -1
- package/dist/cjs/root/ui/blanket/styled.js +1 -1
- package/dist/cjs/root/ui/common.js +11 -5
- package/dist/cjs/root/ui/iconMessage/index.js +16 -7
- package/dist/cjs/root/ui/iconWrapper/styled.js +1 -1
- package/dist/cjs/root/ui/imageRenderer/imageRenderer.js +47 -123
- package/dist/cjs/root/ui/loadingRateLimited/loadingRateLimited.js +6 -4
- package/dist/cjs/root/ui/loadingRateLimited/styled.js +2 -2
- package/dist/cjs/root/ui/playButton/styled.js +1 -1
- package/dist/cjs/root/ui/progressBar/progressBar.js +7 -4
- package/dist/cjs/root/ui/progressBar/styled.js +8 -9
- package/dist/cjs/root/ui/styled.js +80 -17
- package/dist/cjs/root/ui/tickBox/styled.js +1 -1
- package/dist/cjs/root/ui/titleBox/failedTitleBox.js +9 -3
- package/dist/cjs/root/ui/titleBox/styled.js +2 -4
- package/dist/cjs/root/ui/titleBox/titleBox.js +2 -2
- package/dist/cjs/styles/index.js +25 -23
- package/dist/cjs/styles/mixins.js +1 -1
- package/dist/cjs/utils/analytics.js +7 -44
- package/dist/cjs/utils/breakpoint.js +1 -1
- package/dist/cjs/utils/cardActions/cardActionsDropdownMenu.js +18 -9
- package/dist/cjs/utils/cardActions/index.js +10 -10
- package/dist/cjs/utils/cardActions/styled.js +1 -1
- package/dist/cjs/utils/cardDimensions.js +1 -1
- package/dist/cjs/utils/dimensionComparer.js +1 -1
- package/dist/cjs/utils/getErrorMessage.js +2 -2
- package/dist/cjs/utils/index.js +46 -46
- package/dist/cjs/utils/lightCards/styled.js +1 -1
- package/dist/cjs/utils/metadata.js +11 -3
- package/dist/cjs/utils/objectURLCache.js +7 -1
- package/dist/cjs/utils/shouldDisplayImageThumbnail.js +1 -1
- package/dist/cjs/utils/viewportDetector.js +49 -22
- package/dist/cjs/version.json +1 -1
- package/dist/es2019/errors.js +42 -2
- package/dist/es2019/files/cardImageView/index.js +8 -61
- package/dist/es2019/files/index.js +1 -1
- package/dist/es2019/root/card/cardAnalytics.js +3 -14
- package/dist/es2019/root/card/cardLoader.js +47 -53
- package/dist/es2019/root/card/cardState.js +26 -0
- package/dist/es2019/root/card/getCardPreview/cache.js +5 -0
- package/dist/es2019/root/card/getCardPreview/filePreviewStatus.js +38 -0
- package/dist/es2019/root/card/getCardPreview/helpers.js +2 -12
- package/dist/es2019/root/card/getCardPreview/index.js +112 -73
- package/dist/es2019/root/card/getCardStatus.js +1 -0
- package/dist/es2019/root/card/index.js +308 -190
- package/dist/es2019/root/cardView.js +97 -68
- package/dist/es2019/root/inline/loader.js +17 -5
- package/dist/es2019/root/inline/mediaInlineCard.js +32 -11
- package/dist/es2019/root/inlinePlayer.js +56 -4
- package/dist/es2019/root/styled.js +2 -1
- package/dist/es2019/root/ui/common.js +7 -1
- package/dist/es2019/root/ui/iconMessage/index.js +8 -5
- package/dist/es2019/root/ui/imageRenderer/imageRenderer.js +35 -88
- package/dist/es2019/root/ui/loadingRateLimited/loadingRateLimited.js +4 -3
- package/dist/es2019/root/ui/loadingRateLimited/styled.js +1 -1
- package/dist/es2019/root/ui/progressBar/progressBar.js +5 -3
- package/dist/es2019/root/ui/progressBar/styled.js +7 -6
- package/dist/es2019/root/ui/styled.js +65 -4
- package/dist/es2019/root/ui/titleBox/failedTitleBox.js +6 -3
- package/dist/es2019/root/ui/titleBox/styled.js +1 -2
- package/dist/es2019/root/ui/titleBox/titleBox.js +1 -1
- package/dist/es2019/utils/analytics.js +5 -34
- package/dist/es2019/utils/cardActions/cardActionsDropdownMenu.js +8 -4
- package/dist/es2019/utils/dimensionComparer.js +1 -1
- package/dist/es2019/utils/getErrorMessage.js +1 -1
- package/dist/es2019/utils/metadata.js +12 -4
- package/dist/es2019/utils/objectURLCache.js +5 -0
- package/dist/es2019/utils/shouldDisplayImageThumbnail.js +1 -1
- package/dist/es2019/utils/viewportDetector.js +48 -18
- package/dist/es2019/version.json +1 -1
- package/dist/esm/actions.js +2 -2
- package/dist/esm/errors.js +64 -4
- package/dist/esm/files/cardImageView/index.js +51 -102
- package/dist/esm/files/index.js +1 -1
- package/dist/esm/root/card/cardAnalytics.js +3 -15
- package/dist/esm/root/card/cardLoader.js +66 -126
- package/dist/esm/root/card/cardState.js +32 -0
- package/dist/esm/root/card/getCardPreview/cache.js +9 -2
- package/dist/esm/root/card/getCardPreview/filePreviewStatus.js +38 -0
- package/dist/esm/root/card/getCardPreview/helpers.js +13 -21
- package/dist/esm/root/card/getCardPreview/index.js +144 -91
- package/dist/esm/root/card/getCardStatus.js +3 -0
- package/dist/esm/root/card/index.js +396 -288
- package/dist/esm/root/cardView.js +113 -86
- package/dist/esm/root/inline/loader.js +48 -15
- package/dist/esm/root/inline/mediaInlineCard.js +32 -11
- package/dist/esm/root/inlinePlayer.js +74 -23
- package/dist/esm/root/styled.js +3 -2
- package/dist/esm/root/ui/common.js +7 -1
- package/dist/esm/root/ui/iconMessage/index.js +10 -5
- package/dist/esm/root/ui/imageRenderer/imageRenderer.js +37 -116
- package/dist/esm/root/ui/loadingRateLimited/loadingRateLimited.js +4 -3
- package/dist/esm/root/ui/loadingRateLimited/styled.js +1 -1
- package/dist/esm/root/ui/progressBar/progressBar.js +6 -3
- package/dist/esm/root/ui/progressBar/styled.js +7 -7
- package/dist/esm/root/ui/styled.js +61 -13
- package/dist/esm/root/ui/titleBox/failedTitleBox.js +7 -3
- package/dist/esm/root/ui/titleBox/styled.js +1 -2
- package/dist/esm/root/ui/titleBox/titleBox.js +1 -1
- package/dist/esm/utils/analytics.js +5 -36
- package/dist/esm/utils/cardActions/cardActionsDropdownMenu.js +17 -9
- package/dist/esm/utils/dimensionComparer.js +1 -1
- package/dist/esm/utils/getErrorMessage.js +1 -1
- package/dist/esm/utils/metadata.js +12 -4
- package/dist/esm/utils/objectURLCache.js +6 -0
- package/dist/esm/utils/shouldDisplayImageThumbnail.js +1 -1
- package/dist/esm/utils/viewportDetector.js +48 -21
- package/dist/esm/version.json +1 -1
- package/dist/types/errors.d.ts +15 -1
- package/dist/types/files/cardImageView/index.d.ts +4 -13
- package/dist/types/files/cardImageView/styled.d.ts +1 -1
- package/dist/types/files/index.d.ts +1 -1
- package/dist/types/index.d.ts +7 -4
- package/dist/types/root/card/cardAnalytics.d.ts +1 -6
- package/dist/types/root/card/cardLoader.d.ts +5 -19
- package/dist/types/root/card/cardState.d.ts +5 -0
- package/dist/types/root/card/getCardPreview/cache.d.ts +3 -1
- package/dist/types/root/card/getCardPreview/filePreviewStatus.d.ts +5 -0
- package/dist/types/root/card/getCardPreview/helpers.d.ts +3 -4
- package/dist/types/root/card/getCardPreview/index.d.ts +24 -14
- package/dist/types/root/card/getCardStatus.d.ts +1 -0
- package/dist/types/root/card/index.d.ts +20 -18
- package/dist/types/root/cardView.d.ts +13 -8
- package/dist/types/root/inline/loader.d.ts +2 -0
- package/dist/types/root/inline/mediaInlineCard.d.ts +3 -5
- package/dist/types/root/inlinePlayer.d.ts +8 -1
- package/dist/types/root/styled.d.ts +1 -0
- package/dist/types/root/ui/common.d.ts +4 -1
- package/dist/types/root/ui/iconMessage/index.d.ts +4 -3
- package/dist/types/root/ui/iconWrapper/styled.d.ts +1 -1
- package/dist/types/root/ui/imageRenderer/imageRenderer.d.ts +14 -15
- package/dist/types/root/ui/loadingRateLimited/loadingRateLimited.d.ts +2 -1
- package/dist/types/root/ui/loadingRateLimited/styled.d.ts +1 -1
- package/dist/types/root/ui/playButton/playButton.d.ts +1 -0
- package/dist/types/root/ui/progressBar/progressBar.d.ts +4 -2
- package/dist/types/root/ui/progressBar/styled.d.ts +3 -2
- package/dist/types/root/ui/styled.d.ts +10 -3
- package/dist/types/root/ui/tickBox/tickBox.d.ts +1 -0
- package/dist/types/root/ui/titleBox/failedTitleBox.d.ts +3 -1
- package/dist/types/root/ui/titleBox/styled.d.ts +1 -1
- package/dist/types/root/ui/titleBox/titleBox.d.ts +2 -10
- package/dist/types/styles/mixins.d.ts +1 -1
- package/dist/types/types.d.ts +7 -1
- package/dist/types/utils/analytics.d.ts +6 -15
- package/dist/types/utils/cardDimensions.d.ts +4 -4
- package/dist/types/utils/dimensionComparer.d.ts +1 -1
- package/dist/types/utils/getErrorMessage.d.ts +1 -0
- package/dist/types/utils/metadata.d.ts +2 -2
- package/dist/types/utils/objectURLCache.d.ts +2 -1
- package/dist/types/utils/viewportDetector.d.ts +13 -5
- package/example-helpers/developmentUseMessage.tsx +14 -0
- package/example-helpers/index.tsx +55 -4
- package/example-helpers/selectableCard.tsx +2 -1
- package/package.json +18 -16
- package/dist/cjs/root/card/cardSSRView.js +0 -112
- package/dist/cjs/root/card/getCardPreview/types.js +0 -5
- package/dist/cjs/root/ui/Breakpoint.js +0 -13
- package/dist/cjs/root/ui/styledSSR.js +0 -108
- package/dist/cjs/utils/fileAttributesContext.js +0 -40
- package/dist/cjs/utils/lazyContent/index.js +0 -56
- package/dist/cjs/utils/lazyContent/styled.js +0 -23
- package/dist/es2019/root/card/cardSSRView.js +0 -92
- package/dist/es2019/root/card/getCardPreview/types.js +0 -1
- package/dist/es2019/root/ui/Breakpoint.js +0 -6
- package/dist/es2019/root/ui/styledSSR.js +0 -93
- package/dist/es2019/utils/fileAttributesContext.js +0 -19
- package/dist/es2019/utils/lazyContent/index.js +0 -18
- package/dist/es2019/utils/lazyContent/styled.js +0 -12
- package/dist/esm/root/card/cardSSRView.js +0 -91
- package/dist/esm/root/card/getCardPreview/types.js +0 -1
- package/dist/esm/root/ui/Breakpoint.js +0 -6
- package/dist/esm/root/ui/styledSSR.js +0 -76
- package/dist/esm/utils/fileAttributesContext.js +0 -18
- package/dist/esm/utils/lazyContent/index.js +0 -41
- package/dist/esm/utils/lazyContent/styled.js +0 -14
- package/dist/types/root/card/cardSSRView.d.ts +0 -13
- package/dist/types/root/card/getCardPreview/types.d.ts +0 -5
- package/dist/types/root/ui/Breakpoint.d.ts +0 -4
- package/dist/types/root/ui/styledSSR.d.ts +0 -16
- package/dist/types/utils/fileAttributesContext.d.ts +0 -10
- package/dist/types/utils/lazyContent/index.d.ts +0 -11
- package/dist/types/utils/lazyContent/styled.d.ts +0 -5
|
@@ -1,93 +0,0 @@
|
|
|
1
|
-
import styled from 'styled-components';
|
|
2
|
-
import { akEditorSelectedBoxShadow } from '@atlaskit/editor-shared-styles/consts';
|
|
3
|
-
import { N20, N60A } from '@atlaskit/theme/colors';
|
|
4
|
-
import { fontFamily } from '@atlaskit/theme/constants';
|
|
5
|
-
import { hideNativeBrowserTextSelectionStyles } from '@atlaskit/editor-shared-styles/selection';
|
|
6
|
-
import { borderRadius } from '@atlaskit/media-ui';
|
|
7
|
-
import { transition } from '../../styles';
|
|
8
|
-
import { getDefaultCardDimensions } from '../../utils/cardDimensions';
|
|
9
|
-
import { getCSSUnitValue } from '../../utils/getCSSUnitValue';
|
|
10
|
-
import { fixedBlanketStyles, blanketClassName } from './blanket/styled';
|
|
11
|
-
import { responsiveSettings } from './common';
|
|
12
|
-
import { Breakpoint } from './Breakpoint';
|
|
13
|
-
export const SSRFileExperienceWrapper = styled.div`
|
|
14
|
-
${({
|
|
15
|
-
breakpoint,
|
|
16
|
-
dimensions,
|
|
17
|
-
appearance,
|
|
18
|
-
shouldUsePointerCursor,
|
|
19
|
-
displayBackground,
|
|
20
|
-
disableOverlay,
|
|
21
|
-
selected
|
|
22
|
-
}) => `
|
|
23
|
-
${transition()}
|
|
24
|
-
box-sizing: border-box;
|
|
25
|
-
* {
|
|
26
|
-
box-sizing: border-box;
|
|
27
|
-
}
|
|
28
|
-
position: relative;
|
|
29
|
-
font-family: ${fontFamily()};
|
|
30
|
-
${getWrapperDimensions(dimensions, appearance)}
|
|
31
|
-
${displayBackground ? `background-color: ${N20};` : ''}
|
|
32
|
-
${borderRadius}
|
|
33
|
-
${getCursorStyle(shouldUsePointerCursor)}
|
|
34
|
-
${generateResponsiveStyles(breakpoint)}
|
|
35
|
-
${hideNativeBrowserTextSelectionStyles}
|
|
36
|
-
${getWrapperShadow(disableOverlay, selected)}
|
|
37
|
-
`}
|
|
38
|
-
&:hover .${blanketClassName} {
|
|
39
|
-
${fixedBlanketStyles}
|
|
40
|
-
}
|
|
41
|
-
`;
|
|
42
|
-
SSRFileExperienceWrapper.displayName = 'SSRFileExperienceWrapper';
|
|
43
|
-
export const getWrapperDimensions = (dimensions, appearance) => {
|
|
44
|
-
const {
|
|
45
|
-
width,
|
|
46
|
-
height
|
|
47
|
-
} = dimensions || {};
|
|
48
|
-
const {
|
|
49
|
-
width: defaultWidth,
|
|
50
|
-
height: defaultHeight
|
|
51
|
-
} = getDefaultCardDimensions(appearance);
|
|
52
|
-
return `
|
|
53
|
-
width: ${getCSSUnitValue(width || defaultWidth)};
|
|
54
|
-
max-width: 100%;
|
|
55
|
-
height: ${getCSSUnitValue(height || defaultHeight)};
|
|
56
|
-
max-height: 100%;
|
|
57
|
-
`;
|
|
58
|
-
};
|
|
59
|
-
|
|
60
|
-
const generateResponsiveStyles = (breakpoint = Breakpoint.SMALL) => {
|
|
61
|
-
const setting = responsiveSettings[breakpoint];
|
|
62
|
-
return `
|
|
63
|
-
font-size: ${setting.fontSize}px;
|
|
64
|
-
line-height: ${setting.lineHeight}px;
|
|
65
|
-
`;
|
|
66
|
-
};
|
|
67
|
-
|
|
68
|
-
const getCursorStyle = shouldUsePointerCursor => `cursor: ${shouldUsePointerCursor ? 'pointer' : 'default'};`; // This is a trick to simulate the blue border without affecting the dimensions.
|
|
69
|
-
// CSS outline has no 'radius', therefore we can't achieve the same effect with it
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
const getWrapperShadow = (disableOverlay, selected) => {
|
|
73
|
-
const withOverlayShadow = !disableOverlay ? `0 1px 1px ${N60A}, 0 0 1px 0 ${N60A}` : '';
|
|
74
|
-
const selectedShadow = selected ? akEditorSelectedBoxShadow : '';
|
|
75
|
-
const shadow = [selectedShadow, withOverlayShadow].filter(Boolean).join(', ');
|
|
76
|
-
return shadow ? `box-shadow: ${shadow};` : '';
|
|
77
|
-
};
|
|
78
|
-
|
|
79
|
-
export const CardImageContainer = styled.div`
|
|
80
|
-
display: flex;
|
|
81
|
-
position: relative;
|
|
82
|
-
max-width: 100%;
|
|
83
|
-
width: 100%;
|
|
84
|
-
height: 100%;
|
|
85
|
-
max-height: 100%;
|
|
86
|
-
overflow: hidden;
|
|
87
|
-
${borderRadius}
|
|
88
|
-
`;
|
|
89
|
-
const breakpointSizes = [[Breakpoint.SMALL, 599], [Breakpoint.LARGE, Infinity]];
|
|
90
|
-
export const calcBreakpointSize = (wrapperWidth = 0) => {
|
|
91
|
-
const [breakpoint] = breakpointSizes.find(([_breakpoint, limit]) => wrapperWidth <= limit) || [Breakpoint.SMALL];
|
|
92
|
-
return breakpoint;
|
|
93
|
-
};
|
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
import _extends from "@babel/runtime/helpers/extends";
|
|
2
|
-
import React, { useContext } from 'react';
|
|
3
|
-
const FileAttributesContext = /*#__PURE__*/React.createContext(null);
|
|
4
|
-
export const FileAttributesProvider = ({
|
|
5
|
-
children,
|
|
6
|
-
data
|
|
7
|
-
}) => {
|
|
8
|
-
return data ? /*#__PURE__*/React.createElement(FileAttributesContext.Provider, {
|
|
9
|
-
value: data
|
|
10
|
-
}, children) : /*#__PURE__*/React.createElement(React.Fragment, null, children);
|
|
11
|
-
};
|
|
12
|
-
export function withFileAttributes(Component) {
|
|
13
|
-
return props => {
|
|
14
|
-
const fileAttributes = useContext(FileAttributesContext);
|
|
15
|
-
return fileAttributes ? /*#__PURE__*/React.createElement(Component, _extends({}, props, {
|
|
16
|
-
fileAttributes: fileAttributes
|
|
17
|
-
})) : /*#__PURE__*/React.createElement(Component, props);
|
|
18
|
-
};
|
|
19
|
-
}
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import { Wrapper } from './styled';
|
|
3
|
-
export class LazyContent extends React.Component {
|
|
4
|
-
render() {
|
|
5
|
-
const {
|
|
6
|
-
children,
|
|
7
|
-
placeholder,
|
|
8
|
-
onRender
|
|
9
|
-
} = this.props;
|
|
10
|
-
return /*#__PURE__*/React.createElement(Wrapper, {
|
|
11
|
-
offset: 300,
|
|
12
|
-
onRender: onRender,
|
|
13
|
-
placeholder: placeholder,
|
|
14
|
-
content: children
|
|
15
|
-
});
|
|
16
|
-
}
|
|
17
|
-
|
|
18
|
-
}
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
// @ts-ignore: unused variable
|
|
2
|
-
// prettier-ignore
|
|
3
|
-
import LazilyRender from 'react-lazily-render'; // @ts-ignore: unused variable
|
|
4
|
-
// prettier-ignore
|
|
5
|
-
|
|
6
|
-
import styled from 'styled-components';
|
|
7
|
-
import { size } from '@atlaskit/media-ui'; // We need to override the element provided by the library
|
|
8
|
-
// in order to make it get the parent dimensions.
|
|
9
|
-
|
|
10
|
-
export const Wrapper = styled(LazilyRender)`
|
|
11
|
-
${size()};
|
|
12
|
-
`;
|
|
@@ -1,91 +0,0 @@
|
|
|
1
|
-
import _extends from "@babel/runtime/helpers/extends";
|
|
2
|
-
|
|
3
|
-
/*
|
|
4
|
-
* This file is designed to be optimised for maximum performance.
|
|
5
|
-
* Because of this the imports are optimised to import only what is required
|
|
6
|
-
* If you're adding a new dependency please ensure that the
|
|
7
|
-
* imported file only contains and depends on only what is required for it to function.
|
|
8
|
-
*/
|
|
9
|
-
import React from 'react';
|
|
10
|
-
import { MediaImage } from '@atlaskit/media-ui';
|
|
11
|
-
import SpinnerIcon from '@atlaskit/spinner';
|
|
12
|
-
import { getRequestedDimensions } from '../../utils/getDataURIDimension';
|
|
13
|
-
import { defaultImageCardDimensions } from '../../utils/cardDimensions';
|
|
14
|
-
import { IconWrapper } from '../ui/iconWrapper/styled';
|
|
15
|
-
import { SSRFileExperienceWrapper, CardImageContainer, calcBreakpointSize } from '../ui/styledSSR';
|
|
16
|
-
import { Blanket } from '../ui/blanket/styled';
|
|
17
|
-
import { newFileExperienceClassName } from './cardConstants';
|
|
18
|
-
import { resizeModeToMediaImageProps } from '../../utils/resizeModeToMediaImageProps';
|
|
19
|
-
export var CardSSRView = function CardSSRView(_ref) {
|
|
20
|
-
var identifier = _ref.identifier,
|
|
21
|
-
dimensions = _ref.dimensions,
|
|
22
|
-
mediaClient = _ref.mediaClient,
|
|
23
|
-
resizeMode = _ref.resizeMode,
|
|
24
|
-
disableOverlay = _ref.disableOverlay,
|
|
25
|
-
isLazy = _ref.isLazy;
|
|
26
|
-
var dataURI;
|
|
27
|
-
|
|
28
|
-
try {
|
|
29
|
-
var _getRequestedDimensio = getRequestedDimensions({
|
|
30
|
-
dimensions: dimensions
|
|
31
|
-
}),
|
|
32
|
-
width = _getRequestedDimensio.width,
|
|
33
|
-
height = _getRequestedDimensio.height;
|
|
34
|
-
|
|
35
|
-
var mode = resizeMode === 'stretchy-fit' ? 'full-fit' : resizeMode;
|
|
36
|
-
dataURI = mediaClient.getImageUrlSync(identifier.id, {
|
|
37
|
-
collection: identifier.collectionName,
|
|
38
|
-
mode: mode,
|
|
39
|
-
width: width,
|
|
40
|
-
height: height,
|
|
41
|
-
allowAnimated: true
|
|
42
|
-
});
|
|
43
|
-
} catch (e) {
|
|
44
|
-
// if we are unable to get the image url (eg missing auth) we want to continue rendering with a spinner
|
|
45
|
-
dataURI = '';
|
|
46
|
-
}
|
|
47
|
-
|
|
48
|
-
var shouldDisplayBackground = !dataURI || !disableOverlay;
|
|
49
|
-
return /*#__PURE__*/React.createElement(SSRFileExperienceWrapper, {
|
|
50
|
-
className: newFileExperienceClassName,
|
|
51
|
-
dimensions: dimensions,
|
|
52
|
-
breakpoint: calculateBreakpoint(dimensions),
|
|
53
|
-
shouldUsePointerCursor: Boolean(dataURI),
|
|
54
|
-
displayBackground: shouldDisplayBackground,
|
|
55
|
-
disableOverlay: disableOverlay,
|
|
56
|
-
selected: false,
|
|
57
|
-
"data-testid": "media-card-view"
|
|
58
|
-
}, /*#__PURE__*/React.createElement(CardImageContainer, {
|
|
59
|
-
className: "media-file-card-view",
|
|
60
|
-
"data-testid": "media-file-card-view"
|
|
61
|
-
}, /*#__PURE__*/React.createElement(IconWrapper, {
|
|
62
|
-
breakpoint: calculateBreakpoint(dimensions),
|
|
63
|
-
hasTitleBox: false
|
|
64
|
-
}, /*#__PURE__*/React.createElement(SpinnerIcon, null)), !!dataURI && /*#__PURE__*/React.createElement(MediaImage, _extends({
|
|
65
|
-
dataURI: dataURI // alt={alt} // having alt text causes the image to fail to render with a broken image.
|
|
66
|
-
// onImageLoad={this.onImageLoad} // TODO add these back as part of tracking performance.
|
|
67
|
-
// onImageError={this.onImageError}
|
|
68
|
-
|
|
69
|
-
}, resizeModeToMediaImageProps(resizeMode), {
|
|
70
|
-
loading: getLazyValue(isLazy)
|
|
71
|
-
})), !disableOverlay && /*#__PURE__*/React.createElement(Blanket, {
|
|
72
|
-
isFixed: false
|
|
73
|
-
})));
|
|
74
|
-
};
|
|
75
|
-
|
|
76
|
-
function getLazyValue(isLazy) {
|
|
77
|
-
switch (isLazy) {
|
|
78
|
-
case false:
|
|
79
|
-
return 'eager';
|
|
80
|
-
|
|
81
|
-
default:
|
|
82
|
-
return 'lazy';
|
|
83
|
-
}
|
|
84
|
-
}
|
|
85
|
-
|
|
86
|
-
function calculateBreakpoint(dimensions) {
|
|
87
|
-
var _dimensions$width;
|
|
88
|
-
|
|
89
|
-
var width = (_dimensions$width = dimensions === null || dimensions === void 0 ? void 0 : dimensions.width) !== null && _dimensions$width !== void 0 ? _dimensions$width : defaultImageCardDimensions.width;
|
|
90
|
-
return calcBreakpointSize(parseInt("".concat(width), 10));
|
|
91
|
-
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
|
@@ -1,76 +0,0 @@
|
|
|
1
|
-
import _slicedToArray from "@babel/runtime/helpers/slicedToArray";
|
|
2
|
-
import _taggedTemplateLiteral from "@babel/runtime/helpers/taggedTemplateLiteral";
|
|
3
|
-
|
|
4
|
-
var _templateObject, _templateObject2;
|
|
5
|
-
|
|
6
|
-
import styled from 'styled-components';
|
|
7
|
-
import { akEditorSelectedBoxShadow } from '@atlaskit/editor-shared-styles/consts';
|
|
8
|
-
import { N20, N60A } from '@atlaskit/theme/colors';
|
|
9
|
-
import { fontFamily } from '@atlaskit/theme/constants';
|
|
10
|
-
import { hideNativeBrowserTextSelectionStyles } from '@atlaskit/editor-shared-styles/selection';
|
|
11
|
-
import { borderRadius } from '@atlaskit/media-ui';
|
|
12
|
-
import { transition } from '../../styles';
|
|
13
|
-
import { getDefaultCardDimensions } from '../../utils/cardDimensions';
|
|
14
|
-
import { getCSSUnitValue } from '../../utils/getCSSUnitValue';
|
|
15
|
-
import { fixedBlanketStyles, blanketClassName } from './blanket/styled';
|
|
16
|
-
import { responsiveSettings } from './common';
|
|
17
|
-
import { Breakpoint } from './Breakpoint';
|
|
18
|
-
export var SSRFileExperienceWrapper = styled.div(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n ", "\n &:hover .", " {\n ", "\n }\n"])), function (_ref) {
|
|
19
|
-
var breakpoint = _ref.breakpoint,
|
|
20
|
-
dimensions = _ref.dimensions,
|
|
21
|
-
appearance = _ref.appearance,
|
|
22
|
-
shouldUsePointerCursor = _ref.shouldUsePointerCursor,
|
|
23
|
-
displayBackground = _ref.displayBackground,
|
|
24
|
-
disableOverlay = _ref.disableOverlay,
|
|
25
|
-
selected = _ref.selected;
|
|
26
|
-
return "\n ".concat(transition(), "\n box-sizing: border-box;\n * {\n box-sizing: border-box;\n }\n position: relative;\n font-family: ").concat(fontFamily(), ";\n ").concat(getWrapperDimensions(dimensions, appearance), "\n ").concat(displayBackground ? "background-color: ".concat(N20, ";") : '', "\n ").concat(borderRadius, "\n ").concat(getCursorStyle(shouldUsePointerCursor), "\n ").concat(generateResponsiveStyles(breakpoint), "\n ").concat(hideNativeBrowserTextSelectionStyles, "\n ").concat(getWrapperShadow(disableOverlay, selected), "\n ");
|
|
27
|
-
}, blanketClassName, fixedBlanketStyles);
|
|
28
|
-
SSRFileExperienceWrapper.displayName = 'SSRFileExperienceWrapper';
|
|
29
|
-
export var getWrapperDimensions = function getWrapperDimensions(dimensions, appearance) {
|
|
30
|
-
var _ref2 = dimensions || {},
|
|
31
|
-
width = _ref2.width,
|
|
32
|
-
height = _ref2.height;
|
|
33
|
-
|
|
34
|
-
var _getDefaultCardDimens = getDefaultCardDimensions(appearance),
|
|
35
|
-
defaultWidth = _getDefaultCardDimens.width,
|
|
36
|
-
defaultHeight = _getDefaultCardDimens.height;
|
|
37
|
-
|
|
38
|
-
return "\n width: ".concat(getCSSUnitValue(width || defaultWidth), ";\n max-width: 100%;\n height: ").concat(getCSSUnitValue(height || defaultHeight), ";\n max-height: 100%;\n ");
|
|
39
|
-
};
|
|
40
|
-
|
|
41
|
-
var generateResponsiveStyles = function generateResponsiveStyles() {
|
|
42
|
-
var breakpoint = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : Breakpoint.SMALL;
|
|
43
|
-
var setting = responsiveSettings[breakpoint];
|
|
44
|
-
return "\n font-size: ".concat(setting.fontSize, "px;\n line-height: ").concat(setting.lineHeight, "px;\n ");
|
|
45
|
-
};
|
|
46
|
-
|
|
47
|
-
var getCursorStyle = function getCursorStyle(shouldUsePointerCursor) {
|
|
48
|
-
return "cursor: ".concat(shouldUsePointerCursor ? 'pointer' : 'default', ";");
|
|
49
|
-
}; // This is a trick to simulate the blue border without affecting the dimensions.
|
|
50
|
-
// CSS outline has no 'radius', therefore we can't achieve the same effect with it
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
var getWrapperShadow = function getWrapperShadow(disableOverlay, selected) {
|
|
54
|
-
var withOverlayShadow = !disableOverlay ? "0 1px 1px ".concat(N60A, ", 0 0 1px 0 ").concat(N60A) : '';
|
|
55
|
-
var selectedShadow = selected ? akEditorSelectedBoxShadow : '';
|
|
56
|
-
var shadow = [selectedShadow, withOverlayShadow].filter(Boolean).join(', ');
|
|
57
|
-
return shadow ? "box-shadow: ".concat(shadow, ";") : '';
|
|
58
|
-
};
|
|
59
|
-
|
|
60
|
-
export var CardImageContainer = styled.div(_templateObject2 || (_templateObject2 = _taggedTemplateLiteral(["\n display: flex;\n position: relative;\n max-width: 100%;\n width: 100%;\n height: 100%;\n max-height: 100%;\n overflow: hidden;\n ", "\n"])), borderRadius);
|
|
61
|
-
var breakpointSizes = [[Breakpoint.SMALL, 599], [Breakpoint.LARGE, Infinity]];
|
|
62
|
-
export var calcBreakpointSize = function calcBreakpointSize() {
|
|
63
|
-
var wrapperWidth = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 0;
|
|
64
|
-
|
|
65
|
-
var _ref3 = breakpointSizes.find(function (_ref5) {
|
|
66
|
-
var _ref6 = _slicedToArray(_ref5, 2),
|
|
67
|
-
_breakpoint = _ref6[0],
|
|
68
|
-
limit = _ref6[1];
|
|
69
|
-
|
|
70
|
-
return wrapperWidth <= limit;
|
|
71
|
-
}) || [Breakpoint.SMALL],
|
|
72
|
-
_ref4 = _slicedToArray(_ref3, 1),
|
|
73
|
-
breakpoint = _ref4[0];
|
|
74
|
-
|
|
75
|
-
return breakpoint;
|
|
76
|
-
};
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
import _extends from "@babel/runtime/helpers/extends";
|
|
2
|
-
import React, { useContext } from 'react';
|
|
3
|
-
var FileAttributesContext = /*#__PURE__*/React.createContext(null);
|
|
4
|
-
export var FileAttributesProvider = function FileAttributesProvider(_ref) {
|
|
5
|
-
var children = _ref.children,
|
|
6
|
-
data = _ref.data;
|
|
7
|
-
return data ? /*#__PURE__*/React.createElement(FileAttributesContext.Provider, {
|
|
8
|
-
value: data
|
|
9
|
-
}, children) : /*#__PURE__*/React.createElement(React.Fragment, null, children);
|
|
10
|
-
};
|
|
11
|
-
export function withFileAttributes(Component) {
|
|
12
|
-
return function (props) {
|
|
13
|
-
var fileAttributes = useContext(FileAttributesContext);
|
|
14
|
-
return fileAttributes ? /*#__PURE__*/React.createElement(Component, _extends({}, props, {
|
|
15
|
-
fileAttributes: fileAttributes
|
|
16
|
-
})) : /*#__PURE__*/React.createElement(Component, props);
|
|
17
|
-
};
|
|
18
|
-
}
|
|
@@ -1,41 +0,0 @@
|
|
|
1
|
-
import _classCallCheck from "@babel/runtime/helpers/classCallCheck";
|
|
2
|
-
import _createClass from "@babel/runtime/helpers/createClass";
|
|
3
|
-
import _inherits from "@babel/runtime/helpers/inherits";
|
|
4
|
-
import _possibleConstructorReturn from "@babel/runtime/helpers/possibleConstructorReturn";
|
|
5
|
-
import _getPrototypeOf from "@babel/runtime/helpers/getPrototypeOf";
|
|
6
|
-
|
|
7
|
-
function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }
|
|
8
|
-
|
|
9
|
-
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; } }
|
|
10
|
-
|
|
11
|
-
import React from 'react';
|
|
12
|
-
import { Wrapper } from './styled';
|
|
13
|
-
export var LazyContent = /*#__PURE__*/function (_React$Component) {
|
|
14
|
-
_inherits(LazyContent, _React$Component);
|
|
15
|
-
|
|
16
|
-
var _super = _createSuper(LazyContent);
|
|
17
|
-
|
|
18
|
-
function LazyContent() {
|
|
19
|
-
_classCallCheck(this, LazyContent);
|
|
20
|
-
|
|
21
|
-
return _super.apply(this, arguments);
|
|
22
|
-
}
|
|
23
|
-
|
|
24
|
-
_createClass(LazyContent, [{
|
|
25
|
-
key: "render",
|
|
26
|
-
value: function render() {
|
|
27
|
-
var _this$props = this.props,
|
|
28
|
-
children = _this$props.children,
|
|
29
|
-
placeholder = _this$props.placeholder,
|
|
30
|
-
onRender = _this$props.onRender;
|
|
31
|
-
return /*#__PURE__*/React.createElement(Wrapper, {
|
|
32
|
-
offset: 300,
|
|
33
|
-
onRender: onRender,
|
|
34
|
-
placeholder: placeholder,
|
|
35
|
-
content: children
|
|
36
|
-
});
|
|
37
|
-
}
|
|
38
|
-
}]);
|
|
39
|
-
|
|
40
|
-
return LazyContent;
|
|
41
|
-
}(React.Component);
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
import _taggedTemplateLiteral from "@babel/runtime/helpers/taggedTemplateLiteral";
|
|
2
|
-
|
|
3
|
-
var _templateObject;
|
|
4
|
-
|
|
5
|
-
// @ts-ignore: unused variable
|
|
6
|
-
// prettier-ignore
|
|
7
|
-
import LazilyRender from 'react-lazily-render'; // @ts-ignore: unused variable
|
|
8
|
-
// prettier-ignore
|
|
9
|
-
|
|
10
|
-
import styled from 'styled-components';
|
|
11
|
-
import { size } from '@atlaskit/media-ui'; // We need to override the element provided by the library
|
|
12
|
-
// in order to make it get the parent dimensions.
|
|
13
|
-
|
|
14
|
-
export var Wrapper = styled(LazilyRender)(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n ", ";\n"])), size());
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
import { FC } from 'react';
|
|
2
|
-
import { FileIdentifier, ImageResizeMode, MediaClient } from '@atlaskit/media-client';
|
|
3
|
-
import { CardDimensions } from '../../utils/cardDimensions';
|
|
4
|
-
export interface CardSSRViewProps {
|
|
5
|
-
readonly identifier: FileIdentifier;
|
|
6
|
-
readonly dimensions?: CardDimensions;
|
|
7
|
-
readonly mediaClient: MediaClient;
|
|
8
|
-
readonly resizeMode: ImageResizeMode;
|
|
9
|
-
readonly alt?: string;
|
|
10
|
-
readonly disableOverlay: boolean;
|
|
11
|
-
readonly isLazy?: boolean;
|
|
12
|
-
}
|
|
13
|
-
export declare const CardSSRView: FC<CardSSRViewProps>;
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
/// <reference types="react" />
|
|
2
|
-
import { CardDimensions, CardAppearance } from '../..';
|
|
3
|
-
import { Breakpoint } from './Breakpoint';
|
|
4
|
-
export interface BaseNewFileExperienceWrapperProps {
|
|
5
|
-
breakpoint: Breakpoint;
|
|
6
|
-
dimensions?: CardDimensions;
|
|
7
|
-
appearance?: CardAppearance;
|
|
8
|
-
shouldUsePointerCursor: boolean;
|
|
9
|
-
displayBackground: boolean;
|
|
10
|
-
disableOverlay: boolean;
|
|
11
|
-
selected: boolean;
|
|
12
|
-
}
|
|
13
|
-
export declare const SSRFileExperienceWrapper: import("styled-components").StyledComponentClass<import("react").ClassAttributes<HTMLDivElement> & import("react").HTMLAttributes<HTMLDivElement> & BaseNewFileExperienceWrapperProps, any, import("react").ClassAttributes<HTMLDivElement> & import("react").HTMLAttributes<HTMLDivElement> & BaseNewFileExperienceWrapperProps>;
|
|
14
|
-
export declare const getWrapperDimensions: (dimensions?: CardDimensions | undefined, appearance?: "auto" | "image" | "square" | "horizontal" | undefined) => string;
|
|
15
|
-
export declare const CardImageContainer: import("styled-components").StyledComponentClass<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, any, import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>>;
|
|
16
|
-
export declare const calcBreakpointSize: (wrapperWidth?: number) => Breakpoint;
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import { FileAttributes } from '@atlaskit/media-common';
|
|
3
|
-
export declare type FileAttributesProviderProps = {
|
|
4
|
-
data: FileAttributes;
|
|
5
|
-
};
|
|
6
|
-
export declare const FileAttributesProvider: React.FC<FileAttributesProviderProps>;
|
|
7
|
-
export declare type WithFileAttributesProps = {
|
|
8
|
-
fileAttributes?: FileAttributes;
|
|
9
|
-
};
|
|
10
|
-
export declare function withFileAttributes<Props>(Component: React.ComponentType<Props & WithFileAttributesProps>): React.FC<Props>;
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
export interface LazyContentProps {
|
|
3
|
-
placeholder?: JSX.Element;
|
|
4
|
-
children?: React.ReactNode;
|
|
5
|
-
onRender?: () => void;
|
|
6
|
-
}
|
|
7
|
-
export interface LazyContentState {
|
|
8
|
-
}
|
|
9
|
-
export declare class LazyContent extends React.Component<LazyContentProps, LazyContentState> {
|
|
10
|
-
render(): JSX.Element;
|
|
11
|
-
}
|
|
@@ -1,5 +0,0 @@
|
|
|
1
|
-
import { LazilyRenderProps } from 'react-lazily-render';
|
|
2
|
-
import { StyledComponentClass } from 'styled-components';
|
|
3
|
-
export declare const Wrapper: StyledComponentClass<LazilyRenderProps, any, Pick<LazilyRenderProps, "className" | "placeholder" | "children" | "content" | "offset" | "component" | "onRender" | "scrollContainer"> & {
|
|
4
|
-
theme?: any;
|
|
5
|
-
}>;
|