@atlaskit/smart-card 19.1.9 → 19.1.10
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 +6 -0
- package/dist/cjs/utils/index.js +8 -2
- package/dist/cjs/version.json +1 -1
- package/dist/cjs/view/CardWithUrl/component-lazy/index.js +3 -3
- package/dist/cjs/view/EmbedCard/components/styled.js +29 -13
- package/dist/es2019/utils/index.js +2 -1
- package/dist/es2019/version.json +1 -1
- package/dist/es2019/view/CardWithUrl/component-lazy/index.js +1 -1
- package/dist/es2019/view/EmbedCard/components/styled.js +22 -4
- package/dist/esm/state/actions/index.js +1 -1
- package/dist/esm/state/hooks/usePrefetch.js +1 -1
- package/dist/esm/utils/index.js +3 -0
- package/dist/esm/utils/mocks.js +1 -1
- package/dist/esm/version.json +1 -1
- package/dist/esm/view/BlockCard/actions/DownloadAction.js +1 -1
- package/dist/esm/view/BlockCard/actions/PreviewAction.js +1 -1
- package/dist/esm/view/BlockCard/actions/RetryAction.js +1 -1
- package/dist/esm/view/BlockCard/actions/ViewAction.js +1 -1
- package/dist/esm/view/CardWithUrl/component-lazy/index.js +1 -1
- package/dist/esm/view/EmbedCard/components/styled.js +14 -4
- package/dist/types/utils/index.d.ts +1 -0
- package/dist/types/view/EmbedCard/components/styled.d.ts +3 -0
- package/dist/types/view/__mocks__/intersection-observer.mock.d.ts +12 -0
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,11 @@
|
|
|
1
1
|
# @atlaskit/smart-card
|
|
2
2
|
|
|
3
|
+
## 19.1.10
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- [`009e3475b29`](https://bitbucket.org/atlassian/atlassian-frontend/commits/009e3475b29) - Duplicate isIntersectionObserverSupported from media-ui to smart-card
|
|
8
|
+
|
|
3
9
|
## 19.1.9
|
|
4
10
|
|
|
5
11
|
### Patch Changes
|
package/dist/cjs/utils/index.js
CHANGED
|
@@ -7,7 +7,7 @@ var _typeof = require("@babel/runtime/helpers/typeof");
|
|
|
7
7
|
Object.defineProperty(exports, "__esModule", {
|
|
8
8
|
value: true
|
|
9
9
|
});
|
|
10
|
-
exports.isSpecialKey = exports.isSpecialEvent = exports.isSpecialClick = exports.isIframe = exports.isCardWithData = exports.handleOnClick = exports.getLabelForFileType = exports.getIframeSandboxAttribute = exports.getIconForFileType = void 0;
|
|
10
|
+
exports.isSpecialKey = exports.isSpecialEvent = exports.isSpecialClick = exports.isIntersectionObserverSupported = exports.isIframe = exports.isCardWithData = exports.handleOnClick = exports.getLabelForFileType = exports.getIframeSandboxAttribute = exports.getIconForFileType = void 0;
|
|
11
11
|
|
|
12
12
|
var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));
|
|
13
13
|
|
|
@@ -368,4 +368,10 @@ var handleOnClick = function handleOnClick(handler) {
|
|
|
368
368
|
};
|
|
369
369
|
};
|
|
370
370
|
|
|
371
|
-
exports.handleOnClick = handleOnClick;
|
|
371
|
+
exports.handleOnClick = handleOnClick;
|
|
372
|
+
|
|
373
|
+
var isIntersectionObserverSupported = function isIntersectionObserverSupported() {
|
|
374
|
+
return typeof IntersectionObserver !== 'undefined';
|
|
375
|
+
};
|
|
376
|
+
|
|
377
|
+
exports.isIntersectionObserverSupported = isIntersectionObserverSupported;
|
package/dist/cjs/version.json
CHANGED
|
@@ -9,14 +9,14 @@ exports.default = LazyCardWithUrlContent;
|
|
|
9
9
|
|
|
10
10
|
var _react = _interopRequireDefault(require("react"));
|
|
11
11
|
|
|
12
|
-
var _mediaUi = require("@atlaskit/media-ui");
|
|
13
|
-
|
|
14
12
|
var _LazyLazilyRenderCard = require("./LazyLazilyRenderCard");
|
|
15
13
|
|
|
16
14
|
var _LazyIntersectionObserverCard = require("./LazyIntersectionObserverCard");
|
|
17
15
|
|
|
16
|
+
var _utils = require("../../../utils");
|
|
17
|
+
|
|
18
18
|
function LazyCardWithUrlContent(props) {
|
|
19
|
-
if ((0,
|
|
19
|
+
if ((0, _utils.isIntersectionObserverSupported)()) {
|
|
20
20
|
return /*#__PURE__*/_react.default.createElement(_LazyIntersectionObserverCard.LazyIntersectionObserverCard, props);
|
|
21
21
|
} else {
|
|
22
22
|
return /*#__PURE__*/_react.default.createElement(_LazyLazilyRenderCard.LazyLazilyRenderCard, props);
|
|
@@ -7,14 +7,12 @@ var _typeof = require("@babel/runtime/helpers/typeof");
|
|
|
7
7
|
Object.defineProperty(exports, "__esModule", {
|
|
8
8
|
value: true
|
|
9
9
|
});
|
|
10
|
-
exports.maxAvatarCount = exports.embedHeaderHeight = exports.className = exports.cardShadow = exports.Wrapper = exports.UsersWrapper = exports.Title = exports.Thumbnail = exports.TextWrapper = exports.ResolvedViewIconWrapper = exports.LinkWrapper = exports.Image = exports.IconWrapper = exports.Header = exports.Description = exports.ContentWrapper = exports.Content = exports.Byline = exports.AlertWrapper = exports.ActionsWrapper = void 0;
|
|
10
|
+
exports.maxAvatarCount = exports.embedHeaderHeight = exports.ellipsis = exports.csssize = exports.className = exports.cardShadow = exports.borderRadius = exports.Wrapper = exports.UsersWrapper = exports.Title = exports.Thumbnail = exports.TextWrapper = exports.ResolvedViewIconWrapper = exports.LinkWrapper = exports.Image = exports.IconWrapper = exports.Header = exports.Description = exports.ContentWrapper = exports.Content = exports.Byline = exports.AlertWrapper = exports.ActionsWrapper = void 0;
|
|
11
11
|
|
|
12
12
|
var _taggedTemplateLiteral2 = _interopRequireDefault(require("@babel/runtime/helpers/taggedTemplateLiteral"));
|
|
13
13
|
|
|
14
14
|
var _styled = _interopRequireDefault(require("@emotion/styled"));
|
|
15
15
|
|
|
16
|
-
var _mediaUi = require("@atlaskit/media-ui");
|
|
17
|
-
|
|
18
16
|
var _constants = require("@atlaskit/theme/constants");
|
|
19
17
|
|
|
20
18
|
var colors = _interopRequireWildcard(require("@atlaskit/theme/colors"));
|
|
@@ -33,6 +31,24 @@ var className = 'media-card-frame';
|
|
|
33
31
|
exports.className = className;
|
|
34
32
|
var cardShadow = "";
|
|
35
33
|
exports.cardShadow = cardShadow;
|
|
34
|
+
var borderRadius = "\n border-radius: ".concat((0, _constants.borderRadius)(), "px;\n");
|
|
35
|
+
exports.borderRadius = borderRadius;
|
|
36
|
+
|
|
37
|
+
var ellipsis = function ellipsis() {
|
|
38
|
+
var maxWidth = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : '100%';
|
|
39
|
+
var unit = typeof maxWidth === 'number' ? 'px' : '';
|
|
40
|
+
return "\n max-width: ".concat(maxWidth).concat(unit, ";\n overflow: hidden;\n text-overflow: ellipsis;\n white-space: nowrap;\n ");
|
|
41
|
+
};
|
|
42
|
+
|
|
43
|
+
exports.ellipsis = ellipsis;
|
|
44
|
+
|
|
45
|
+
var csssize = function csssize() {
|
|
46
|
+
var value = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : '100%';
|
|
47
|
+
var unit = typeof value === 'number' ? 'px' : '';
|
|
48
|
+
return "\n width: ".concat(value).concat(unit, ";\n height: ").concat(value).concat(unit, ";\n ");
|
|
49
|
+
};
|
|
50
|
+
|
|
51
|
+
exports.csssize = csssize;
|
|
36
52
|
|
|
37
53
|
function minWidth(_ref) {
|
|
38
54
|
var minWidth = _ref.minWidth;
|
|
@@ -64,7 +80,7 @@ function getinteractiveStyles(_ref3) {
|
|
|
64
80
|
|
|
65
81
|
function selected(_ref4) {
|
|
66
82
|
var isSelected = _ref4.isSelected;
|
|
67
|
-
return isSelected ? "\n ".concat(visibleStyles, "\n &::after {\n cursor: pointer;\n box-shadow: 0 0 0 3px ").concat((0, _tokens.token)('color.border.selected', colors.B100), ";\n content: '';\n outline: none;\n position: absolute;\n height: 100%;\n width: 100%;\n left: 0;\n ").concat(
|
|
83
|
+
return isSelected ? "\n ".concat(visibleStyles, "\n &::after {\n cursor: pointer;\n box-shadow: 0 0 0 3px ").concat((0, _tokens.token)('color.border.selected', colors.B100), ";\n content: '';\n outline: none;\n position: absolute;\n height: 100%;\n width: 100%;\n left: 0;\n ").concat(borderRadius, "\n }\n ") : '';
|
|
68
84
|
}
|
|
69
85
|
|
|
70
86
|
var height = function height(_ref5) {
|
|
@@ -73,7 +89,7 @@ var height = function height(_ref5) {
|
|
|
73
89
|
};
|
|
74
90
|
|
|
75
91
|
var wrapperStyles = function wrapperStyles(props) {
|
|
76
|
-
return "\n ".concat(
|
|
92
|
+
return "\n ".concat(borderRadius, "\n ").concat(minWidth(props), "\n ").concat(maxWidth(props), "\n ").concat(getinteractiveStyles(props), "\n ").concat(visible(props), "\n display: inline-flex;\n flex-direction: column;\n box-sizing: border-box;\n font-family: ").concat((0, _constants.fontFamily)(), ";\n width: 100%;\n user-select: none;\n line-height: initial;\n transition: background 0.3s;\n position: relative;\n ").concat(height(props), ";\n ").concat(selected(props), "\n\n &:after {\n content: '';\n background: transparent;\n transition: background 0.3s, box-shadow 0.3s;\n position: absolute;\n width: calc(100% + ").concat((0, _utils.gs)(2), ");\n height: calc(100% + ").concat((0, _utils.gs)(1), ");\n left: -").concat((0, _utils.gs)(1), ";\n ").concat(borderRadius, "\n }\n");
|
|
77
93
|
};
|
|
78
94
|
|
|
79
95
|
var visibleStyles = "\n background-color: ".concat((0, _tokens.token)('color.background.neutral.subtle', colors.N30), ";\n\n &:after {\n background: ").concat((0, _tokens.token)('color.background.neutral', colors.N30), " !important;\n }\n .embed-header {\n opacity: 1;\n }");
|
|
@@ -101,7 +117,7 @@ var Header = _styled.default.div(_templateObject3 || (_templateObject3 = (0, _ta
|
|
|
101
117
|
|
|
102
118
|
exports.Header = Header;
|
|
103
119
|
|
|
104
|
-
var IconWrapper = _styled.default.div(_templateObject4 || (_templateObject4 = (0, _taggedTemplateLiteral2.default)(["\n ", "\n ", "\n ", " margin-right: 4px;\n"])),
|
|
120
|
+
var IconWrapper = _styled.default.div(_templateObject4 || (_templateObject4 = (0, _taggedTemplateLiteral2.default)(["\n ", "\n ", "\n ", " margin-right: 4px;\n"])), borderRadius, csssize(16), function (_ref7) {
|
|
105
121
|
var isPlaceholder = _ref7.isPlaceholder;
|
|
106
122
|
|
|
107
123
|
if (isPlaceholder) {
|
|
@@ -117,18 +133,18 @@ var TextWrapper = _styled.default.div(_templateObject5 || (_templateObject5 = (0
|
|
|
117
133
|
var isPlaceholder = _ref8.isPlaceholder;
|
|
118
134
|
|
|
119
135
|
if (isPlaceholder) {
|
|
120
|
-
return "\n ".concat(
|
|
136
|
+
return "\n ".concat(borderRadius, "\n width: 125px;\n height: 12px;\n background-color: ").concat((0, _tokens.token)('color.skeleton', colors.N30), ";\n ");
|
|
121
137
|
} else {
|
|
122
138
|
return '';
|
|
123
139
|
}
|
|
124
|
-
}, (0, _tokens.token)('color.text.subtlest', colors.N300),
|
|
140
|
+
}, (0, _tokens.token)('color.text.subtlest', colors.N300), ellipsis('none'));
|
|
125
141
|
|
|
126
142
|
exports.TextWrapper = TextWrapper;
|
|
127
143
|
|
|
128
144
|
// NB: `overflow` is kept as `hidden` since
|
|
129
145
|
// the internal contents of the `iframe` should
|
|
130
146
|
// manage scrolling behaviour.
|
|
131
|
-
var Content = _styled.default.div(_templateObject6 || (_templateObject6 = (0, _taggedTemplateLiteral2.default)(["\n ", "\n ", "\n background-color: ", ";\n position: absolute;\n z-index: 1;\n width: 100%;\n top: ", ";\n overflow: hidden;\n height: calc(100% - ", ");\n transition: box-shadow 0.3s;\n\n > .calc-height > div > div {\n left: unset !important;\n width: unset !important;\n height: unset !important;\n position: initial !important;\n padding-bottom: unset !important;\n }\n > .embed-preview > div {\n margin: 0 auto;\n }\n\n ", ";\n"])),
|
|
147
|
+
var Content = _styled.default.div(_templateObject6 || (_templateObject6 = (0, _taggedTemplateLiteral2.default)(["\n ", "\n ", "\n background-color: ", ";\n position: absolute;\n z-index: 1;\n width: 100%;\n top: ", ";\n overflow: hidden;\n height: calc(100% - ", ");\n transition: box-shadow 0.3s;\n\n > .calc-height > div > div {\n left: unset !important;\n width: unset !important;\n height: unset !important;\n position: initial !important;\n padding-bottom: unset !important;\n }\n > .embed-preview > div {\n margin: 0 auto;\n }\n\n ", ";\n"])), borderRadius, cardShadow, (0, _tokens.token)('elevation.surface', 'white'), (0, _utils.gs)(4), (0, _utils.gs)(4), function (_ref9) {
|
|
132
148
|
var isInteractive = _ref9.isInteractive;
|
|
133
149
|
|
|
134
150
|
if (isInteractive) {
|
|
@@ -142,8 +158,8 @@ exports.Content = Content;
|
|
|
142
158
|
|
|
143
159
|
var Image = _styled.default.img(_templateObject7 || (_templateObject7 = (0, _taggedTemplateLiteral2.default)(["\n ", "\n ", "\n\n /* hide the alt text when the image cannot be found */\n overflow: hidden;\n"])), function (_ref10) {
|
|
144
160
|
var size = _ref10.size;
|
|
145
|
-
return (
|
|
146
|
-
},
|
|
161
|
+
return csssize(size);
|
|
162
|
+
}, borderRadius);
|
|
147
163
|
|
|
148
164
|
exports.Image = Image;
|
|
149
165
|
var maxAvatarCount = 6;
|
|
@@ -157,7 +173,7 @@ var Title = _styled.default.div(_templateObject9 || (_templateObject9 = (0, _tag
|
|
|
157
173
|
|
|
158
174
|
exports.Title = Title;
|
|
159
175
|
|
|
160
|
-
var Byline = _styled.default.div(_templateObject10 || (_templateObject10 = (0, _taggedTemplateLiteral2.default)(["\n margin-top: 4px;\n color: ", ";\n font-size: 12px;\n font-weight: normal;\n line-height: ", ";\n ", ";\n"])), (0, _tokens.token)('color.text.subtlest', colors.N300), 16 / 12,
|
|
176
|
+
var Byline = _styled.default.div(_templateObject10 || (_templateObject10 = (0, _taggedTemplateLiteral2.default)(["\n margin-top: 4px;\n color: ", ";\n font-size: 12px;\n font-weight: normal;\n line-height: ", ";\n ", ";\n"])), (0, _tokens.token)('color.text.subtlest', colors.N300), 16 / 12, ellipsis('100%'));
|
|
161
177
|
|
|
162
178
|
exports.Byline = Byline;
|
|
163
179
|
|
|
@@ -169,7 +185,7 @@ var ResolvedViewIconWrapper = _styled.default.div(_templateObject12 || (_templat
|
|
|
169
185
|
|
|
170
186
|
exports.ResolvedViewIconWrapper = ResolvedViewIconWrapper;
|
|
171
187
|
|
|
172
|
-
var Thumbnail = _styled.default.div(_templateObject13 || (_templateObject13 = (0, _taggedTemplateLiteral2.default)(["\n ", "\n ", "\n float: right;\n margin: 4px 0 12px 12px;\n background-color: ", ";\n background-image: url(", ");\n background-size: cover;\n"])),
|
|
188
|
+
var Thumbnail = _styled.default.div(_templateObject13 || (_templateObject13 = (0, _taggedTemplateLiteral2.default)(["\n ", "\n ", "\n float: right;\n margin: 4px 0 12px 12px;\n background-color: ", ";\n background-image: url(", ");\n background-size: cover;\n"])), borderRadius, csssize(48), (0, _tokens.token)('color.skeleton', colors.N30), function (_ref11) {
|
|
173
189
|
var src = _ref11.src;
|
|
174
190
|
return src;
|
|
175
191
|
});
|
package/dist/es2019/version.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import { isIntersectionObserverSupported } from '@atlaskit/media-ui';
|
|
3
2
|
import { LazyLazilyRenderCard } from './LazyLazilyRenderCard';
|
|
4
3
|
import { LazyIntersectionObserverCard } from './LazyIntersectionObserverCard';
|
|
4
|
+
import { isIntersectionObserverSupported } from '../../../utils';
|
|
5
5
|
export default function LazyCardWithUrlContent(props) {
|
|
6
6
|
if (isIntersectionObserverSupported()) {
|
|
7
7
|
return /*#__PURE__*/React.createElement(LazyIntersectionObserverCard, props);
|
|
@@ -1,11 +1,29 @@
|
|
|
1
1
|
import styled from '@emotion/styled';
|
|
2
|
-
import {
|
|
3
|
-
import { fontFamily } from '@atlaskit/theme/constants';
|
|
2
|
+
import { borderRadius as akBorderRadius, fontFamily } from '@atlaskit/theme/constants';
|
|
4
3
|
import * as colors from '@atlaskit/theme/colors';
|
|
5
4
|
import { token } from '@atlaskit/tokens';
|
|
6
5
|
import { gs as gridSize } from '../../common/utils';
|
|
7
6
|
export const className = 'media-card-frame';
|
|
8
7
|
export const cardShadow = ``;
|
|
8
|
+
export const borderRadius = `
|
|
9
|
+
border-radius: ${akBorderRadius()}px;
|
|
10
|
+
`;
|
|
11
|
+
export const ellipsis = (maxWidth = '100%') => {
|
|
12
|
+
const unit = typeof maxWidth === 'number' ? 'px' : '';
|
|
13
|
+
return `
|
|
14
|
+
max-width: ${maxWidth}${unit};
|
|
15
|
+
overflow: hidden;
|
|
16
|
+
text-overflow: ellipsis;
|
|
17
|
+
white-space: nowrap;
|
|
18
|
+
`;
|
|
19
|
+
};
|
|
20
|
+
export const csssize = (value = '100%') => {
|
|
21
|
+
const unit = typeof value === 'number' ? 'px' : '';
|
|
22
|
+
return `
|
|
23
|
+
width: ${value}${unit};
|
|
24
|
+
height: ${value}${unit};
|
|
25
|
+
`;
|
|
26
|
+
};
|
|
9
27
|
|
|
10
28
|
function minWidth({
|
|
11
29
|
minWidth
|
|
@@ -135,7 +153,7 @@ export const Header = styled.div`
|
|
|
135
153
|
`;
|
|
136
154
|
export const IconWrapper = styled.div`
|
|
137
155
|
${borderRadius}
|
|
138
|
-
${
|
|
156
|
+
${csssize(16)}
|
|
139
157
|
${({
|
|
140
158
|
isPlaceholder
|
|
141
159
|
}) => {
|
|
@@ -253,7 +271,7 @@ export const ResolvedViewIconWrapper = styled.div`
|
|
|
253
271
|
`;
|
|
254
272
|
export const Thumbnail = styled.div`
|
|
255
273
|
${borderRadius}
|
|
256
|
-
${
|
|
274
|
+
${csssize(48)}
|
|
257
275
|
float: right;
|
|
258
276
|
margin: 4px 0 12px 12px;
|
|
259
277
|
background-color: ${token('color.skeleton', colors.N30)};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import _asyncToGenerator from "@babel/runtime/helpers/asyncToGenerator";
|
|
2
1
|
import _regeneratorRuntime from "@babel/runtime/regenerator";
|
|
2
|
+
import _asyncToGenerator from "@babel/runtime/helpers/asyncToGenerator";
|
|
3
3
|
import { useMemo, useCallback } from 'react';
|
|
4
4
|
import { auth } from '@atlaskit/outbound-auth-flow-client';
|
|
5
5
|
import { APIError } from '@atlaskit/linking-common';
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import _asyncToGenerator from "@babel/runtime/helpers/asyncToGenerator";
|
|
2
1
|
import _regeneratorRuntime from "@babel/runtime/regenerator";
|
|
2
|
+
import _asyncToGenerator from "@babel/runtime/helpers/asyncToGenerator";
|
|
3
3
|
import { useCallback } from 'react';
|
|
4
4
|
import { useSmartLinkContext } from '@atlaskit/link-provider';
|
|
5
5
|
export function usePrefetch(url) {
|
package/dist/esm/utils/index.js
CHANGED
|
@@ -224,4 +224,7 @@ export var handleOnClick = function handleOnClick(handler) {
|
|
|
224
224
|
e.stopPropagation();
|
|
225
225
|
handler();
|
|
226
226
|
};
|
|
227
|
+
};
|
|
228
|
+
export var isIntersectionObserverSupported = function isIntersectionObserverSupported() {
|
|
229
|
+
return typeof IntersectionObserver !== 'undefined';
|
|
227
230
|
};
|
package/dist/esm/utils/mocks.js
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
|
+
import _regeneratorRuntime from "@babel/runtime/regenerator";
|
|
1
2
|
import _asyncToGenerator from "@babel/runtime/helpers/asyncToGenerator";
|
|
2
3
|
import _classCallCheck from "@babel/runtime/helpers/classCallCheck";
|
|
3
4
|
import _createClass from "@babel/runtime/helpers/createClass";
|
|
4
5
|
import _inherits from "@babel/runtime/helpers/inherits";
|
|
5
6
|
import _possibleConstructorReturn from "@babel/runtime/helpers/possibleConstructorReturn";
|
|
6
7
|
import _getPrototypeOf from "@babel/runtime/helpers/getPrototypeOf";
|
|
7
|
-
import _regeneratorRuntime from "@babel/runtime/regenerator";
|
|
8
8
|
|
|
9
9
|
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); }; }
|
|
10
10
|
|
package/dist/esm/version.json
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import _asyncToGenerator from "@babel/runtime/helpers/asyncToGenerator";
|
|
2
1
|
import _regeneratorRuntime from "@babel/runtime/regenerator";
|
|
2
|
+
import _asyncToGenerator from "@babel/runtime/helpers/asyncToGenerator";
|
|
3
3
|
import React from 'react';
|
|
4
4
|
import { FormattedMessage } from 'react-intl-next';
|
|
5
5
|
import { downloadUrl } from '@atlaskit/media-common';
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
+
import _regeneratorRuntime from "@babel/runtime/regenerator";
|
|
1
2
|
import _extends from "@babel/runtime/helpers/extends";
|
|
2
3
|
import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
3
4
|
import _objectWithoutProperties from "@babel/runtime/helpers/objectWithoutProperties";
|
|
4
5
|
import _asyncToGenerator from "@babel/runtime/helpers/asyncToGenerator";
|
|
5
6
|
var _excluded = ["popupMountPointId", "onClose"],
|
|
6
7
|
_excluded2 = ["details"];
|
|
7
|
-
import _regeneratorRuntime from "@babel/runtime/regenerator";
|
|
8
8
|
|
|
9
9
|
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
|
10
10
|
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import _asyncToGenerator from "@babel/runtime/helpers/asyncToGenerator";
|
|
2
1
|
import _regeneratorRuntime from "@babel/runtime/regenerator";
|
|
2
|
+
import _asyncToGenerator from "@babel/runtime/helpers/asyncToGenerator";
|
|
3
3
|
import React from 'react';
|
|
4
4
|
import { FormattedMessage } from 'react-intl-next';
|
|
5
5
|
import { messages } from '@atlaskit/media-ui/messages';
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import _asyncToGenerator from "@babel/runtime/helpers/asyncToGenerator";
|
|
2
1
|
import _regeneratorRuntime from "@babel/runtime/regenerator";
|
|
2
|
+
import _asyncToGenerator from "@babel/runtime/helpers/asyncToGenerator";
|
|
3
3
|
import React from 'react';
|
|
4
4
|
import { FormattedMessage } from 'react-intl-next';
|
|
5
5
|
import { messages } from '@atlaskit/media-ui/messages';
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import { isIntersectionObserverSupported } from '@atlaskit/media-ui';
|
|
3
2
|
import { LazyLazilyRenderCard } from './LazyLazilyRenderCard';
|
|
4
3
|
import { LazyIntersectionObserverCard } from './LazyIntersectionObserverCard';
|
|
4
|
+
import { isIntersectionObserverSupported } from '../../../utils';
|
|
5
5
|
export default function LazyCardWithUrlContent(props) {
|
|
6
6
|
if (isIntersectionObserverSupported()) {
|
|
7
7
|
return /*#__PURE__*/React.createElement(LazyIntersectionObserverCard, props);
|
|
@@ -3,13 +3,23 @@ import _taggedTemplateLiteral from "@babel/runtime/helpers/taggedTemplateLiteral
|
|
|
3
3
|
var _templateObject, _templateObject2, _templateObject3, _templateObject4, _templateObject5, _templateObject6, _templateObject7, _templateObject8, _templateObject9, _templateObject10, _templateObject11, _templateObject12, _templateObject13, _templateObject14, _templateObject15, _templateObject16;
|
|
4
4
|
|
|
5
5
|
import styled from '@emotion/styled';
|
|
6
|
-
import {
|
|
7
|
-
import { fontFamily } from '@atlaskit/theme/constants';
|
|
6
|
+
import { borderRadius as akBorderRadius, fontFamily } from '@atlaskit/theme/constants';
|
|
8
7
|
import * as colors from '@atlaskit/theme/colors';
|
|
9
8
|
import { token } from '@atlaskit/tokens';
|
|
10
9
|
import { gs as gridSize } from '../../common/utils';
|
|
11
10
|
export var className = 'media-card-frame';
|
|
12
11
|
export var cardShadow = "";
|
|
12
|
+
export var borderRadius = "\n border-radius: ".concat(akBorderRadius(), "px;\n");
|
|
13
|
+
export var ellipsis = function ellipsis() {
|
|
14
|
+
var maxWidth = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : '100%';
|
|
15
|
+
var unit = typeof maxWidth === 'number' ? 'px' : '';
|
|
16
|
+
return "\n max-width: ".concat(maxWidth).concat(unit, ";\n overflow: hidden;\n text-overflow: ellipsis;\n white-space: nowrap;\n ");
|
|
17
|
+
};
|
|
18
|
+
export var csssize = function csssize() {
|
|
19
|
+
var value = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : '100%';
|
|
20
|
+
var unit = typeof value === 'number' ? 'px' : '';
|
|
21
|
+
return "\n width: ".concat(value).concat(unit, ";\n height: ").concat(value).concat(unit, ";\n ");
|
|
22
|
+
};
|
|
13
23
|
|
|
14
24
|
function minWidth(_ref) {
|
|
15
25
|
var minWidth = _ref.minWidth;
|
|
@@ -68,7 +78,7 @@ export var Wrapper = styled.div(_templateObject2 || (_templateObject2 = _taggedT
|
|
|
68
78
|
});
|
|
69
79
|
export var embedHeaderHeight = 32;
|
|
70
80
|
export var Header = styled.div(_templateObject3 || (_templateObject3 = _taggedTemplateLiteral(["\n height: ", "px;\n position: absolute;\n z-index: 1;\n width: 100%;\n display: flex;\n align-items: center;\n color: ", ";\n opacity: 0;\n transition: 300ms opacity cubic-bezier(0.15, 1, 0.3, 1);\n"])), embedHeaderHeight, token('color.icon', colors.N300));
|
|
71
|
-
export var IconWrapper = styled.div(_templateObject4 || (_templateObject4 = _taggedTemplateLiteral(["\n ", "\n ", "\n ", " margin-right: 4px;\n"])), borderRadius,
|
|
81
|
+
export var IconWrapper = styled.div(_templateObject4 || (_templateObject4 = _taggedTemplateLiteral(["\n ", "\n ", "\n ", " margin-right: 4px;\n"])), borderRadius, csssize(16), function (_ref7) {
|
|
72
82
|
var isPlaceholder = _ref7.isPlaceholder;
|
|
73
83
|
|
|
74
84
|
if (isPlaceholder) {
|
|
@@ -108,7 +118,7 @@ export var Title = styled.div(_templateObject9 || (_templateObject9 = _taggedTem
|
|
|
108
118
|
export var Byline = styled.div(_templateObject10 || (_templateObject10 = _taggedTemplateLiteral(["\n margin-top: 4px;\n color: ", ";\n font-size: 12px;\n font-weight: normal;\n line-height: ", ";\n ", ";\n"])), token('color.text.subtlest', colors.N300), 16 / 12, ellipsis('100%'));
|
|
109
119
|
export var Description = styled.div(_templateObject11 || (_templateObject11 = _taggedTemplateLiteral(["\n margin-top: 7px;\n color: ", ";\n font-size: 12px;\n font-weight: normal;\n line-height: ", ";\n max-height: ", "px;\n overflow: hidden;\n"])), token('color.text', colors.N800), 18 / 12, 18 * 3);
|
|
110
120
|
export var ResolvedViewIconWrapper = styled.div(_templateObject12 || (_templateObject12 = _taggedTemplateLiteral(["\n margin-top: 4px;\n"])));
|
|
111
|
-
export var Thumbnail = styled.div(_templateObject13 || (_templateObject13 = _taggedTemplateLiteral(["\n ", "\n ", "\n float: right;\n margin: 4px 0 12px 12px;\n background-color: ", ";\n background-image: url(", ");\n background-size: cover;\n"])), borderRadius,
|
|
121
|
+
export var Thumbnail = styled.div(_templateObject13 || (_templateObject13 = _taggedTemplateLiteral(["\n ", "\n ", "\n float: right;\n margin: 4px 0 12px 12px;\n background-color: ", ";\n background-image: url(", ");\n background-size: cover;\n"])), borderRadius, csssize(48), token('color.skeleton', colors.N30), function (_ref11) {
|
|
112
122
|
var src = _ref11.src;
|
|
113
123
|
return src;
|
|
114
124
|
});
|
|
@@ -9,3 +9,4 @@ export declare const getIconForFileType: (fileMimeType: string) => React.ReactNo
|
|
|
9
9
|
export declare const getLabelForFileType: (fileMimeType: string) => React.ReactNode | undefined;
|
|
10
10
|
export declare const getIframeSandboxAttribute: (isTrusted: boolean) => "allow-downloads allow-forms allow-popups allow-popups-to-escape-sandbox allow-presentation allow-same-origin allow-scripts" | undefined;
|
|
11
11
|
export declare const handleOnClick: (handler: Function) => (e: React.BaseSyntheticEvent) => void;
|
|
12
|
+
export declare const isIntersectionObserverSupported: () => boolean;
|
|
@@ -10,6 +10,9 @@ export interface WrapperProps {
|
|
|
10
10
|
isVisible?: boolean;
|
|
11
11
|
inheritDimensions?: boolean;
|
|
12
12
|
}
|
|
13
|
+
export declare const borderRadius: string;
|
|
14
|
+
export declare const ellipsis: (maxWidth?: string | number) => string;
|
|
15
|
+
export declare const csssize: (value?: string | number) => string;
|
|
13
16
|
export declare const LinkWrapper: import("@emotion/styled-base").StyledComponent<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, WrapperProps, any>;
|
|
14
17
|
export declare const Wrapper: import("@emotion/styled-base").StyledComponent<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, WrapperProps, any>;
|
|
15
18
|
export declare const embedHeaderHeight = 32;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
/// <reference types="jest" />
|
|
2
|
+
export declare class MockIntersectionObserver implements IntersectionObserver {
|
|
3
|
+
callback: IntersectionObserverCallback;
|
|
4
|
+
readonly root: Element | null;
|
|
5
|
+
readonly rootMargin: string;
|
|
6
|
+
readonly thresholds: ReadonlyArray<number>;
|
|
7
|
+
constructor(callback: IntersectionObserverCallback);
|
|
8
|
+
observe(_element: HTMLElement): void;
|
|
9
|
+
disconnect: jest.Mock<any, any>;
|
|
10
|
+
takeRecords: jest.Mock<any, any>;
|
|
11
|
+
unobserve: jest.Mock<any, any>;
|
|
12
|
+
}
|