@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
|
@@ -20,6 +20,10 @@ import { CustomMediaPlayer, InactivityDetector } from '@atlaskit/media-ui';
|
|
|
20
20
|
import { InlinePlayerWrapper } from './styled';
|
|
21
21
|
import { defaultImageCardDimensions } from '..';
|
|
22
22
|
import { CardLoading } from '../utils/lightCards/cardLoading';
|
|
23
|
+
import { ProgressBar } from './ui/progressBar/progressBar';
|
|
24
|
+
import { calcBreakpointSize } from './ui/styled';
|
|
25
|
+
import { isValidPercentageUnit } from '../utils/isValidPercentageUnit';
|
|
26
|
+
import { getElementDimension } from '../utils/getElementDimension';
|
|
23
27
|
export var inlinePlayerClassName = 'media-card-inline-player';
|
|
24
28
|
export var getPreferredVideoArtifact = function getPreferredVideoArtifact(fileState) {
|
|
25
29
|
if (fileState.status === 'processed' || fileState.status === 'processing') {
|
|
@@ -52,6 +56,8 @@ export var InlinePlayerBase = /*#__PURE__*/function (_Component) {
|
|
|
52
56
|
|
|
53
57
|
_defineProperty(_assertThisInitialized(_this), "state", {});
|
|
54
58
|
|
|
59
|
+
_defineProperty(_assertThisInitialized(_this), "divRef", /*#__PURE__*/React.createRef());
|
|
60
|
+
|
|
55
61
|
_defineProperty(_assertThisInitialized(_this), "setFileSrc", function (fileSrc) {
|
|
56
62
|
_this.setState({
|
|
57
63
|
fileSrc: fileSrc
|
|
@@ -126,6 +132,24 @@ export var InlinePlayerBase = /*#__PURE__*/function (_Component) {
|
|
|
126
132
|
});
|
|
127
133
|
});
|
|
128
134
|
|
|
135
|
+
_defineProperty(_assertThisInitialized(_this), "saveElementWidth", function () {
|
|
136
|
+
var dimensions = _this.props.dimensions;
|
|
137
|
+
|
|
138
|
+
if (!dimensions) {
|
|
139
|
+
return;
|
|
140
|
+
}
|
|
141
|
+
|
|
142
|
+
var width = dimensions.width;
|
|
143
|
+
|
|
144
|
+
if (width && isValidPercentageUnit(width) && !!_this.divRef.current) {
|
|
145
|
+
var elementWidth = getElementDimension(_this.divRef.current, 'width');
|
|
146
|
+
|
|
147
|
+
_this.setState({
|
|
148
|
+
elementWidth: elementWidth
|
|
149
|
+
});
|
|
150
|
+
}
|
|
151
|
+
});
|
|
152
|
+
|
|
129
153
|
return _this;
|
|
130
154
|
}
|
|
131
155
|
|
|
@@ -134,6 +158,7 @@ export var InlinePlayerBase = /*#__PURE__*/function (_Component) {
|
|
|
134
158
|
value: function componentDidMount() {
|
|
135
159
|
var _this2 = this;
|
|
136
160
|
|
|
161
|
+
this.saveElementWidth();
|
|
137
162
|
var _this$props3 = this.props,
|
|
138
163
|
mediaClient = _this$props3.mediaClient,
|
|
139
164
|
identifier = _this$props3.identifier;
|
|
@@ -152,30 +177,41 @@ export var InlinePlayerBase = /*#__PURE__*/function (_Component) {
|
|
|
152
177
|
while (1) {
|
|
153
178
|
switch (_context2.prev = _context2.next) {
|
|
154
179
|
case 0:
|
|
180
|
+
if (fileState.status === 'uploading') {
|
|
181
|
+
_this2.setState({
|
|
182
|
+
isUploading: true,
|
|
183
|
+
progress: fileState.progress
|
|
184
|
+
});
|
|
185
|
+
} else {
|
|
186
|
+
_this2.setState({
|
|
187
|
+
isUploading: false
|
|
188
|
+
});
|
|
189
|
+
}
|
|
190
|
+
|
|
155
191
|
existingFileSrc = _this2.state.fileSrc; // we want to reuse the existing fileSrc to prevent re renders
|
|
156
192
|
|
|
157
193
|
if (!existingFileSrc) {
|
|
158
|
-
_context2.next =
|
|
194
|
+
_context2.next = 4;
|
|
159
195
|
break;
|
|
160
196
|
}
|
|
161
197
|
|
|
162
198
|
return _context2.abrupt("return");
|
|
163
199
|
|
|
164
|
-
case
|
|
200
|
+
case 4:
|
|
165
201
|
if (!(fileState.status !== 'error' && fileState.preview)) {
|
|
166
|
-
_context2.next =
|
|
202
|
+
_context2.next = 13;
|
|
167
203
|
break;
|
|
168
204
|
}
|
|
169
205
|
|
|
170
|
-
_context2.next =
|
|
206
|
+
_context2.next = 7;
|
|
171
207
|
return fileState.preview;
|
|
172
208
|
|
|
173
|
-
case
|
|
209
|
+
case 7:
|
|
174
210
|
_yield$fileState$prev = _context2.sent;
|
|
175
211
|
value = _yield$fileState$prev.value;
|
|
176
212
|
|
|
177
213
|
if (!(value instanceof Blob && value.type.indexOf('video/') === 0)) {
|
|
178
|
-
_context2.next =
|
|
214
|
+
_context2.next = 13;
|
|
179
215
|
break;
|
|
180
216
|
}
|
|
181
217
|
|
|
@@ -185,9 +221,9 @@ export var InlinePlayerBase = /*#__PURE__*/function (_Component) {
|
|
|
185
221
|
|
|
186
222
|
return _context2.abrupt("return");
|
|
187
223
|
|
|
188
|
-
case
|
|
224
|
+
case 13:
|
|
189
225
|
if (!(fileState.status === 'processed' || fileState.status === 'processing')) {
|
|
190
|
-
_context2.next =
|
|
226
|
+
_context2.next = 30;
|
|
191
227
|
break;
|
|
192
228
|
}
|
|
193
229
|
|
|
@@ -195,7 +231,7 @@ export var InlinePlayerBase = /*#__PURE__*/function (_Component) {
|
|
|
195
231
|
artifacts = fileState.artifacts;
|
|
196
232
|
|
|
197
233
|
if (!(!artifactName || !artifacts)) {
|
|
198
|
-
_context2.next =
|
|
234
|
+
_context2.next = 19;
|
|
199
235
|
break;
|
|
200
236
|
}
|
|
201
237
|
|
|
@@ -203,34 +239,34 @@ export var InlinePlayerBase = /*#__PURE__*/function (_Component) {
|
|
|
203
239
|
|
|
204
240
|
return _context2.abrupt("return");
|
|
205
241
|
|
|
206
|
-
case
|
|
207
|
-
_context2.prev =
|
|
208
|
-
_context2.next =
|
|
242
|
+
case 19:
|
|
243
|
+
_context2.prev = 19;
|
|
244
|
+
_context2.next = 22;
|
|
209
245
|
return mediaClient.file.getArtifactURL(artifacts, artifactName, collectionName);
|
|
210
246
|
|
|
211
|
-
case
|
|
247
|
+
case 22:
|
|
212
248
|
_fileSrc = _context2.sent;
|
|
213
249
|
|
|
214
250
|
_this2.setFileSrc(_fileSrc);
|
|
215
251
|
|
|
216
|
-
_context2.next =
|
|
252
|
+
_context2.next = 30;
|
|
217
253
|
break;
|
|
218
254
|
|
|
219
|
-
case
|
|
220
|
-
_context2.prev =
|
|
221
|
-
_context2.t0 = _context2["catch"](
|
|
255
|
+
case 26:
|
|
256
|
+
_context2.prev = 26;
|
|
257
|
+
_context2.t0 = _context2["catch"](19);
|
|
222
258
|
onError = _this2.props.onError;
|
|
223
259
|
|
|
224
260
|
if (onError) {
|
|
225
261
|
onError(_context2.t0);
|
|
226
262
|
}
|
|
227
263
|
|
|
228
|
-
case
|
|
264
|
+
case 30:
|
|
229
265
|
case "end":
|
|
230
266
|
return _context2.stop();
|
|
231
267
|
}
|
|
232
268
|
}
|
|
233
|
-
}, _callee2, null, [[
|
|
269
|
+
}, _callee2, null, [[19, 26]]);
|
|
234
270
|
}));
|
|
235
271
|
|
|
236
272
|
function next(_x) {
|
|
@@ -247,6 +283,12 @@ export var InlinePlayerBase = /*#__PURE__*/function (_Component) {
|
|
|
247
283
|
this.unsubscribe();
|
|
248
284
|
this.revoke();
|
|
249
285
|
}
|
|
286
|
+
}, {
|
|
287
|
+
key: "breakpoint",
|
|
288
|
+
get: function get() {
|
|
289
|
+
var width = this.state.elementWidth || (this.props.dimensions ? this.props.dimensions.width : '') || defaultImageCardDimensions.width;
|
|
290
|
+
return calcBreakpointSize(parseInt("".concat(width), 10));
|
|
291
|
+
}
|
|
250
292
|
}, {
|
|
251
293
|
key: "render",
|
|
252
294
|
value: function render() {
|
|
@@ -259,8 +301,12 @@ export var InlinePlayerBase = /*#__PURE__*/function (_Component) {
|
|
|
259
301
|
selected = _this$props4.selected,
|
|
260
302
|
testId = _this$props4.testId,
|
|
261
303
|
identifier = _this$props4.identifier,
|
|
262
|
-
forwardRef = _this$props4.forwardRef
|
|
263
|
-
|
|
304
|
+
forwardRef = _this$props4.forwardRef,
|
|
305
|
+
autoplay = _this$props4.autoplay;
|
|
306
|
+
var _this$state = this.state,
|
|
307
|
+
fileSrc = _this$state.fileSrc,
|
|
308
|
+
isUploading = _this$state.isUploading,
|
|
309
|
+
progress = _this$state.progress;
|
|
264
310
|
|
|
265
311
|
if (!fileSrc) {
|
|
266
312
|
return /*#__PURE__*/React.createElement(CardLoading, {
|
|
@@ -281,7 +327,7 @@ export var InlinePlayerBase = /*#__PURE__*/function (_Component) {
|
|
|
281
327
|
type: "video",
|
|
282
328
|
src: fileSrc,
|
|
283
329
|
fileId: identifier.id,
|
|
284
|
-
isAutoPlay:
|
|
330
|
+
isAutoPlay: autoplay,
|
|
285
331
|
isHDAvailable: false,
|
|
286
332
|
onDownloadClick: _this3.onDownloadClick,
|
|
287
333
|
onFirstPlay: _this3.onFirstPlay,
|
|
@@ -291,7 +337,12 @@ export var InlinePlayerBase = /*#__PURE__*/function (_Component) {
|
|
|
291
337
|
originalDimensions: originalDimensions,
|
|
292
338
|
showControls: checkMouseMovement
|
|
293
339
|
});
|
|
294
|
-
})
|
|
340
|
+
}), isUploading ? /*#__PURE__*/React.createElement(ProgressBar, {
|
|
341
|
+
progress: progress,
|
|
342
|
+
breakpoint: this.breakpoint,
|
|
343
|
+
positionBottom: true,
|
|
344
|
+
showOnTop: true
|
|
345
|
+
}) : null);
|
|
295
346
|
}
|
|
296
347
|
}]);
|
|
297
348
|
|
package/dist/esm/root/styled.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import _taggedTemplateLiteral from "@babel/runtime/helpers/taggedTemplateLiteral";
|
|
2
2
|
|
|
3
|
-
var _templateObject, _templateObject2;
|
|
3
|
+
var _templateObject, _templateObject2, _templateObject3;
|
|
4
4
|
|
|
5
5
|
import styled from 'styled-components';
|
|
6
6
|
import { borderRadius } from '@atlaskit/theme/constants';
|
|
@@ -32,4 +32,5 @@ export var InlinePlayerWrapper = styled.div(_templateObject2 || (_templateObject
|
|
|
32
32
|
}, function (props) {
|
|
33
33
|
return getDimensionsWithDefault(props.dimensions).height || 'auto';
|
|
34
34
|
}, borderRadius(), getSelectedBorderStyle);
|
|
35
|
-
InlinePlayerWrapper.displayName = 'InlinePlayerWrapper';
|
|
35
|
+
InlinePlayerWrapper.displayName = 'InlinePlayerWrapper';
|
|
36
|
+
export var FormattedMessageWrapper = styled.span(_templateObject3 || (_templateObject3 = _taggedTemplateLiteral([""])));
|
|
@@ -2,7 +2,13 @@ import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
|
2
2
|
|
|
3
3
|
var _responsiveSettings;
|
|
4
4
|
|
|
5
|
-
|
|
5
|
+
export var Breakpoint;
|
|
6
|
+
|
|
7
|
+
(function (Breakpoint) {
|
|
8
|
+
Breakpoint["SMALL"] = "small";
|
|
9
|
+
Breakpoint["LARGE"] = "large";
|
|
10
|
+
})(Breakpoint || (Breakpoint = {}));
|
|
11
|
+
|
|
6
12
|
export var responsiveSettings = (_responsiveSettings = {}, _defineProperty(_responsiveSettings, Breakpoint.SMALL, {
|
|
7
13
|
fontSize: 11,
|
|
8
14
|
lineHeight: 14,
|
|
@@ -2,7 +2,8 @@ import _extends from "@babel/runtime/helpers/extends";
|
|
|
2
2
|
import React from 'react';
|
|
3
3
|
import { IconMessageWrapper } from './styled';
|
|
4
4
|
import { messages } from '@atlaskit/media-ui';
|
|
5
|
-
import { FormattedMessage } from 'react-intl';
|
|
5
|
+
import { FormattedMessage } from 'react-intl-next';
|
|
6
|
+
import { FormattedMessageWrapper } from '../../styled';
|
|
6
7
|
export var IconMessage = function IconMessage(_ref) {
|
|
7
8
|
var messageDescriptor = _ref.messageDescriptor,
|
|
8
9
|
_ref$animated = _ref.animated,
|
|
@@ -12,7 +13,7 @@ export var IconMessage = function IconMessage(_ref) {
|
|
|
12
13
|
return /*#__PURE__*/React.createElement(IconMessageWrapper, {
|
|
13
14
|
animated: animated,
|
|
14
15
|
reducedFont: reducedFont
|
|
15
|
-
}, /*#__PURE__*/React.createElement(FormattedMessage, messageDescriptor));
|
|
16
|
+
}, /*#__PURE__*/React.createElement(FormattedMessageWrapper, null, /*#__PURE__*/React.createElement(FormattedMessage, messageDescriptor)));
|
|
16
17
|
};
|
|
17
18
|
export var CreatingPreview = function CreatingPreview(_ref2) {
|
|
18
19
|
var disableAnimation = _ref2.disableAnimation;
|
|
@@ -26,10 +27,14 @@ export var PreviewUnavailable = function PreviewUnavailable(props) {
|
|
|
26
27
|
messageDescriptor: messages.preview_unavailable
|
|
27
28
|
}));
|
|
28
29
|
};
|
|
29
|
-
export var
|
|
30
|
+
export var FailedToLoad = function FailedToLoad(props) {
|
|
30
31
|
return /*#__PURE__*/React.createElement(IconMessage, _extends({}, props, {
|
|
31
|
-
messageDescriptor: messages.
|
|
32
|
-
|
|
32
|
+
messageDescriptor: messages.failed_to_load
|
|
33
|
+
}));
|
|
34
|
+
};
|
|
35
|
+
export var FailedToUpload = function FailedToUpload(props) {
|
|
36
|
+
return /*#__PURE__*/React.createElement(IconMessage, _extends({}, props, {
|
|
37
|
+
messageDescriptor: messages.failed_to_upload
|
|
33
38
|
}));
|
|
34
39
|
};
|
|
35
40
|
export var PreviewCurrentlyUnavailable = function PreviewCurrentlyUnavailable(props) {
|
|
@@ -1,122 +1,43 @@
|
|
|
1
|
+
import _taggedTemplateLiteral from "@babel/runtime/helpers/taggedTemplateLiteral";
|
|
1
2
|
import _extends from "@babel/runtime/helpers/extends";
|
|
2
|
-
import _classCallCheck from "@babel/runtime/helpers/classCallCheck";
|
|
3
|
-
import _createClass from "@babel/runtime/helpers/createClass";
|
|
4
|
-
import _assertThisInitialized from "@babel/runtime/helpers/assertThisInitialized";
|
|
5
|
-
import _inherits from "@babel/runtime/helpers/inherits";
|
|
6
|
-
import _possibleConstructorReturn from "@babel/runtime/helpers/possibleConstructorReturn";
|
|
7
|
-
import _getPrototypeOf from "@babel/runtime/helpers/getPrototypeOf";
|
|
8
|
-
import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
9
3
|
|
|
10
|
-
|
|
4
|
+
var _templateObject;
|
|
11
5
|
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
import React from 'react';
|
|
6
|
+
import React, { useEffect } from 'react';
|
|
15
7
|
import { MediaImage } from '@atlaskit/media-ui';
|
|
16
|
-
import { withAnalyticsEvents } from '@atlaskit/analytics-next';
|
|
17
|
-
import { fireMediaCardEvent, RenderEventAction, getRenderSucceededEventPayload, getRenderFailedFileUriPayload, getRenderFailedExternalUriPayload } from '../../../utils/analytics';
|
|
18
|
-
import { withFileAttributes } from '../../../utils/fileAttributesContext';
|
|
19
8
|
import { resizeModeToMediaImageProps } from '../../../utils/resizeModeToMediaImageProps';
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
createAnalyticsEvent = _this$props.createAnalyticsEvent,
|
|
39
|
-
fileAttributes = _this$props.fileAttributes,
|
|
40
|
-
timeElapsedTillCommenced = _this$props.timeElapsedTillCommenced;
|
|
41
|
-
|
|
42
|
-
if (fileAttributes && _this.shouldFireEvent(RenderEventAction.SUCCEEDED)) {
|
|
43
|
-
var timeElapsedTillSucceeded = performance.now();
|
|
44
|
-
var durationSinceCommenced = timeElapsedTillCommenced && timeElapsedTillSucceeded - timeElapsedTillCommenced;
|
|
45
|
-
var performanceAttributes = {
|
|
46
|
-
overall: {
|
|
47
|
-
durationSincePageStart: timeElapsedTillSucceeded,
|
|
48
|
-
durationSinceCommenced: durationSinceCommenced
|
|
49
|
-
}
|
|
50
|
-
};
|
|
51
|
-
fireMediaCardEvent(getRenderSucceededEventPayload(fileAttributes, performanceAttributes), createAnalyticsEvent);
|
|
52
|
-
}
|
|
53
|
-
});
|
|
54
|
-
|
|
55
|
-
_defineProperty(_assertThisInitialized(_this), "onImageError", function () {
|
|
56
|
-
var _this$props2 = _this.props,
|
|
57
|
-
onImageError = _this$props2.onImageError,
|
|
58
|
-
fileAttributes = _this$props2.fileAttributes;
|
|
59
|
-
onImageError && onImageError();
|
|
60
|
-
|
|
61
|
-
if (fileAttributes && _this.shouldFireEvent(RenderEventAction.FAILED)) {
|
|
62
|
-
var _this$props3 = _this.props,
|
|
63
|
-
createAnalyticsEvent = _this$props3.createAnalyticsEvent,
|
|
64
|
-
mediaItemType = _this$props3.mediaItemType,
|
|
65
|
-
timeElapsedTillCommenced = _this$props3.timeElapsedTillCommenced;
|
|
66
|
-
var timeElapsedTillFailed = performance.now();
|
|
67
|
-
var durationSinceCommenced = timeElapsedTillCommenced && timeElapsedTillFailed - timeElapsedTillCommenced;
|
|
68
|
-
var performanceAttributes = {
|
|
69
|
-
overall: {
|
|
70
|
-
durationSincePageStart: timeElapsedTillFailed,
|
|
71
|
-
durationSinceCommenced: durationSinceCommenced
|
|
72
|
-
}
|
|
73
|
-
};
|
|
74
|
-
|
|
75
|
-
if (mediaItemType === 'file') {
|
|
76
|
-
fireMediaCardEvent(getRenderFailedFileUriPayload(fileAttributes, performanceAttributes), createAnalyticsEvent);
|
|
77
|
-
} else if (mediaItemType === 'external-image') {
|
|
78
|
-
fireMediaCardEvent(getRenderFailedExternalUriPayload(fileAttributes, performanceAttributes), createAnalyticsEvent);
|
|
79
|
-
}
|
|
80
|
-
}
|
|
81
|
-
});
|
|
82
|
-
|
|
83
|
-
_defineProperty(_assertThisInitialized(_this), "shouldFireEvent", function (action) {
|
|
84
|
-
return !_this.lastAnalyticsAction || _this.lastAnalyticsAction !== action;
|
|
85
|
-
});
|
|
86
|
-
|
|
87
|
-
return _this;
|
|
88
|
-
}
|
|
89
|
-
|
|
90
|
-
_createClass(ImageRendererBase, [{
|
|
91
|
-
key: "componentDidMount",
|
|
92
|
-
value: function componentDidMount() {
|
|
93
|
-
// TODO: trigger accordingly with the succeeded event. This could be a breaking change
|
|
94
|
-
var _this$props4 = this.props,
|
|
95
|
-
onDisplayImage = _this$props4.onDisplayImage,
|
|
96
|
-
mediaType = _this$props4.mediaType;
|
|
97
|
-
|
|
98
|
-
if (mediaType === 'image' && onDisplayImage) {
|
|
99
|
-
onDisplayImage();
|
|
100
|
-
}
|
|
9
|
+
import styled from 'styled-components';
|
|
10
|
+
export var ImageRendererBase = function ImageRendererBase(_ref) {
|
|
11
|
+
var dataURI = _ref.dataURI,
|
|
12
|
+
previewOrientation = _ref.previewOrientation,
|
|
13
|
+
alt = _ref.alt,
|
|
14
|
+
resizeMode = _ref.resizeMode,
|
|
15
|
+
onImageLoad = _ref.onImageLoad,
|
|
16
|
+
onImageError = _ref.onImageError,
|
|
17
|
+
onDisplayImage = _ref.onDisplayImage,
|
|
18
|
+
mediaType = _ref.mediaType,
|
|
19
|
+
nativeLazyLoad = _ref.nativeLazyLoad,
|
|
20
|
+
forceSyncDisplay = _ref.forceSyncDisplay,
|
|
21
|
+
_ref$className = _ref.className,
|
|
22
|
+
className = _ref$className === void 0 ? 'media-card-image-renderer' : _ref$className;
|
|
23
|
+
useEffect(function () {
|
|
24
|
+
// TODO: trigger accordingly with the succeeded event. This could be a breaking change
|
|
25
|
+
if (mediaType === 'image' && onDisplayImage) {
|
|
26
|
+
onDisplayImage();
|
|
101
27
|
}
|
|
102
|
-
},
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
}]);
|
|
119
|
-
|
|
120
|
-
return ImageRendererBase;
|
|
121
|
-
}(React.Component);
|
|
122
|
-
export var ImageRenderer = withAnalyticsEvents()(withFileAttributes(ImageRendererBase));
|
|
28
|
+
}, [mediaType, onDisplayImage]);
|
|
29
|
+
return /*#__PURE__*/React.createElement(MediaImage, _extends({
|
|
30
|
+
className: className,
|
|
31
|
+
dataURI: dataURI,
|
|
32
|
+
alt: alt,
|
|
33
|
+
previewOrientation: previewOrientation,
|
|
34
|
+
onImageLoad: onImageLoad,
|
|
35
|
+
onImageError: onImageError,
|
|
36
|
+
loading: nativeLazyLoad ? 'lazy' : undefined,
|
|
37
|
+
forceSyncDisplay: forceSyncDisplay
|
|
38
|
+
}, resizeModeToMediaImageProps(resizeMode)));
|
|
39
|
+
};
|
|
40
|
+
export var ImageRenderer = styled(ImageRendererBase)(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n ", "\n"])), function (_ref2) {
|
|
41
|
+
var isImageVisible = _ref2.isImageVisible;
|
|
42
|
+
return "\n visibility: ".concat(isImageVisible ? 'visible' : 'hidden', ";\n");
|
|
43
|
+
});
|
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import { errorIcon } from '@atlaskit/media-ui/errorIcon';
|
|
3
3
|
import { WarningIconWrapper, LoadingRateLimitedContainer, CouldntLoadWrapper, ErrorWrapper, LoadingRateLimitedTextWrapper } from './styled';
|
|
4
|
+
import { FormattedMessageWrapper } from '../../styled';
|
|
4
5
|
import { messages } from '@atlaskit/media-ui';
|
|
5
|
-
import { FormattedMessage } from 'react-intl';
|
|
6
|
-
import { Breakpoint } from '../
|
|
6
|
+
import { FormattedMessage } from 'react-intl-next';
|
|
7
|
+
import { Breakpoint } from '../common';
|
|
7
8
|
export var LoadingRateLimited = function LoadingRateLimited(_ref) {
|
|
8
9
|
var _ref$breakpoint = _ref.breakpoint,
|
|
9
10
|
breakpoint = _ref$breakpoint === void 0 ? Breakpoint.SMALL : _ref$breakpoint,
|
|
@@ -12,5 +13,5 @@ export var LoadingRateLimited = function LoadingRateLimited(_ref) {
|
|
|
12
13
|
return /*#__PURE__*/React.createElement(LoadingRateLimitedContainer, null, /*#__PURE__*/React.createElement(WarningIconWrapper, null, errorIcon), /*#__PURE__*/React.createElement(LoadingRateLimitedTextWrapper, {
|
|
13
14
|
breakpoint: breakpoint,
|
|
14
15
|
positionBottom: positionBottom
|
|
15
|
-
}, /*#__PURE__*/React.createElement(CouldntLoadWrapper, null, /*#__PURE__*/React.createElement(FormattedMessage, messages.couldnt_load_file)), /*#__PURE__*/React.createElement(ErrorWrapper, null, /*#__PURE__*/React.createElement(FormattedMessage, messages.error_429))));
|
|
16
|
+
}, /*#__PURE__*/React.createElement(CouldntLoadWrapper, null, /*#__PURE__*/React.createElement(FormattedMessageWrapper, null, /*#__PURE__*/React.createElement(FormattedMessage, messages.couldnt_load_file))), /*#__PURE__*/React.createElement(ErrorWrapper, null, /*#__PURE__*/React.createElement(FormattedMessageWrapper, null, /*#__PURE__*/React.createElement(FormattedMessage, messages.error_429)))));
|
|
16
17
|
};
|
|
@@ -10,7 +10,7 @@ export var WarningIconWrapper = styled.div(_templateObject2 || (_templateObject2
|
|
|
10
10
|
export var LoadingRateLimitedTextWrapper = styled.div(_templateObject3 || (_templateObject3 = _taggedTemplateLiteral(["\n ", "\n"])), function (_ref) {
|
|
11
11
|
var breakpoint = _ref.breakpoint,
|
|
12
12
|
positionBottom = _ref.positionBottom;
|
|
13
|
-
return "\n margin-top: 10px;\n overflow: hidden;\n color: ".concat(N300, ";\n display: block;\n width:100%;\n text-align:center;\n ").concat(generateResponsiveStyles(breakpoint, positionBottom, 1), "\n ");
|
|
13
|
+
return "\n margin-top: 10px;\n overflow: hidden;\n color: ".concat(N300, ";\n display: block;\n width:100%;\n text-align:center;\n ").concat(generateResponsiveStyles(breakpoint, positionBottom, false, 1), "\n ");
|
|
14
14
|
});
|
|
15
15
|
LoadingRateLimitedTextWrapper.displayName = 'LoadingRateLimitedTextWrapper';
|
|
16
16
|
export var CouldntLoadWrapper = styled.div(_templateObject4 || (_templateObject4 = _taggedTemplateLiteral(["\n font-weight: 550;\n"])));
|
|
@@ -1,16 +1,19 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import { StyledBar } from './styled';
|
|
3
|
-
import { Breakpoint } from '../
|
|
3
|
+
import { Breakpoint } from '../common';
|
|
4
4
|
export var ProgressBar = function ProgressBar(_ref) {
|
|
5
5
|
var progress = _ref.progress,
|
|
6
6
|
_ref$breakpoint = _ref.breakpoint,
|
|
7
7
|
breakpoint = _ref$breakpoint === void 0 ? Breakpoint.SMALL : _ref$breakpoint,
|
|
8
8
|
_ref$positionBottom = _ref.positionBottom,
|
|
9
|
-
positionBottom = _ref$positionBottom === void 0 ? false : _ref$positionBottom
|
|
9
|
+
positionBottom = _ref$positionBottom === void 0 ? false : _ref$positionBottom,
|
|
10
|
+
_ref$showOnTop = _ref.showOnTop,
|
|
11
|
+
showOnTop = _ref$showOnTop === void 0 ? false : _ref$showOnTop;
|
|
10
12
|
var normalizedProgress = Math.min(1, Math.max(0, progress || 0)) * 100;
|
|
11
13
|
return /*#__PURE__*/React.createElement(StyledBar, {
|
|
12
14
|
progress: normalizedProgress,
|
|
13
15
|
breakpoint: breakpoint,
|
|
14
|
-
positionBottom: positionBottom
|
|
16
|
+
positionBottom: positionBottom,
|
|
17
|
+
showOnTop: showOnTop
|
|
15
18
|
});
|
|
16
19
|
};
|
|
@@ -6,8 +6,7 @@ import styled from 'styled-components';
|
|
|
6
6
|
import { borderRadius } from '@atlaskit/media-ui';
|
|
7
7
|
import { rgba } from '../../../styles/mixins';
|
|
8
8
|
import { N0, N400 } from '@atlaskit/theme/colors';
|
|
9
|
-
import { getTitleBoxHeight, responsiveSettings } from '../common';
|
|
10
|
-
import { Breakpoint } from '../Breakpoint';
|
|
9
|
+
import { Breakpoint, getTitleBoxHeight, responsiveSettings } from '../common';
|
|
11
10
|
var height = 3;
|
|
12
11
|
var padding = 1;
|
|
13
12
|
var width = 95; // %
|
|
@@ -20,17 +19,18 @@ var smallSizeSettings = {
|
|
|
20
19
|
var largeSizeSettings = {
|
|
21
20
|
marginBottom: 12
|
|
22
21
|
};
|
|
23
|
-
export function generateResponsiveStyles(breakpoint, positionBottom) {
|
|
24
|
-
var multiplier = arguments.length >
|
|
22
|
+
export function generateResponsiveStyles(breakpoint, positionBottom, showOnTop) {
|
|
23
|
+
var multiplier = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : 1;
|
|
25
24
|
var setting = breakpoint === Breakpoint.SMALL ? smallSizeSettings : largeSizeSettings;
|
|
26
25
|
var marginPositionBottom = responsiveSettings[breakpoint].titleBox.verticalPadding;
|
|
27
26
|
var marginBottom = setting.marginBottom * multiplier + (positionBottom ? marginPositionBottom : getTitleBoxHeight(breakpoint));
|
|
28
|
-
return "\n bottom: ".concat(marginBottom, "px\n ");
|
|
27
|
+
return "\n ".concat(showOnTop ? 'top' : 'bottom', ": ").concat(marginBottom, "px\n ");
|
|
29
28
|
}
|
|
30
29
|
export var StyledBar = styled.div(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n ", "\n"])), function (_ref) {
|
|
31
30
|
var progress = _ref.progress,
|
|
32
31
|
breakpoint = _ref.breakpoint,
|
|
33
|
-
positionBottom = _ref.positionBottom
|
|
34
|
-
|
|
32
|
+
positionBottom = _ref.positionBottom,
|
|
33
|
+
showOnTop = _ref.showOnTop;
|
|
34
|
+
return "\n ".concat(borderRadius, "\n overflow: hidden;\n position: absolute;\n width: ").concat(width, "%;\n left: ").concat(left, "%;\n background-color: ").concat(rgba(N0, 0.8), ";\n height: ").concat(height + padding * 2, "px;\n padding: ").concat(padding, "px;\n box-sizing: border-box;\n\n ::before {\n content: '';\n width: ").concat(progress, "%;\n height: 100%;\n background-color: ").concat(N400, ";\n ").concat(borderRadius, "\n display: block;\n }\n\n ").concat(generateResponsiveStyles(breakpoint, positionBottom, showOnTop), "\n");
|
|
35
35
|
});
|
|
36
36
|
StyledBar.displayName = 'StyledProgressBar';
|
|
@@ -1,26 +1,68 @@
|
|
|
1
1
|
import _taggedTemplateLiteral from "@babel/runtime/helpers/taggedTemplateLiteral";
|
|
2
|
+
import _slicedToArray from "@babel/runtime/helpers/slicedToArray";
|
|
2
3
|
|
|
3
|
-
var _templateObject;
|
|
4
|
+
var _templateObject, _templateObject2;
|
|
4
5
|
|
|
5
6
|
import styled from 'styled-components';
|
|
6
7
|
import { getCSSUnitValue } from '../../utils/getCSSUnitValue';
|
|
7
8
|
import { getDefaultCardDimensions } from '../../utils/cardDimensions';
|
|
9
|
+
import { fontFamily } from '@atlaskit/theme/constants';
|
|
10
|
+
import { borderRadius } from '@atlaskit/media-ui';
|
|
11
|
+
import { N20, N60A } from '@atlaskit/theme/colors';
|
|
12
|
+
import { akEditorSelectedBoxShadow } from '@atlaskit/editor-shared-styles/consts';
|
|
8
13
|
import { hideNativeBrowserTextSelectionStyles } from '@atlaskit/editor-shared-styles/selection';
|
|
14
|
+
import { transition } from '../../styles';
|
|
9
15
|
import { tickBoxClassName, tickboxFixedStyles } from './tickBox/styled';
|
|
16
|
+
import { fixedBlanketStyles, blanketClassName } from './blanket/styled';
|
|
10
17
|
import { fixedActionBarStyles, actionsBarClassName } from './actionsBar/styled';
|
|
11
18
|
import { fixedPlayButtonStyles, playButtonClassName } from './playButton/styled';
|
|
12
|
-
import {
|
|
19
|
+
import { Breakpoint, responsiveSettings } from './common';
|
|
20
|
+
var breakpointSizes = [[Breakpoint.SMALL, 599], [Breakpoint.LARGE, Infinity]];
|
|
21
|
+
export var calcBreakpointSize = function calcBreakpointSize() {
|
|
22
|
+
var wrapperWidth = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 0;
|
|
23
|
+
|
|
24
|
+
var _ref = breakpointSizes.find(function (_ref3) {
|
|
25
|
+
var _ref4 = _slicedToArray(_ref3, 2),
|
|
26
|
+
_breakpoint = _ref4[0],
|
|
27
|
+
limit = _ref4[1];
|
|
28
|
+
|
|
29
|
+
return wrapperWidth <= limit;
|
|
30
|
+
}) || [Breakpoint.SMALL],
|
|
31
|
+
_ref2 = _slicedToArray(_ref, 1),
|
|
32
|
+
breakpoint = _ref2[0];
|
|
33
|
+
|
|
34
|
+
return breakpoint;
|
|
35
|
+
};
|
|
36
|
+
|
|
37
|
+
var generateResponsiveStyles = function generateResponsiveStyles() {
|
|
38
|
+
var breakpoint = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : Breakpoint.SMALL;
|
|
39
|
+
var setting = responsiveSettings[breakpoint];
|
|
40
|
+
return "\n font-size: ".concat(setting.fontSize, "px;\n line-height: ").concat(setting.lineHeight, "px;\n ");
|
|
41
|
+
};
|
|
13
42
|
|
|
14
43
|
var getWrapperDimensions = function getWrapperDimensions(dimensions, appearance) {
|
|
15
|
-
var
|
|
16
|
-
width =
|
|
17
|
-
height =
|
|
44
|
+
var _ref5 = dimensions || {},
|
|
45
|
+
width = _ref5.width,
|
|
46
|
+
height = _ref5.height;
|
|
18
47
|
|
|
19
48
|
var _getDefaultCardDimens = getDefaultCardDimensions(appearance),
|
|
20
49
|
defaultWidth = _getDefaultCardDimens.width,
|
|
21
50
|
defaultHeight = _getDefaultCardDimens.height;
|
|
22
51
|
|
|
23
52
|
return "\n width: ".concat(getCSSUnitValue(width || defaultWidth), ";\n max-width: 100%;\n height: ").concat(getCSSUnitValue(height || defaultHeight), ";\n max-height: 100%;\n ");
|
|
53
|
+
}; // This is a trick to simulate the blue border without affecting the dimensions.
|
|
54
|
+
// CSS outline has no 'radius', therefore we can't achieve the same effect with it
|
|
55
|
+
|
|
56
|
+
|
|
57
|
+
var getWrapperShadow = function getWrapperShadow(disableOverlay, selected) {
|
|
58
|
+
var withOverlayShadow = !disableOverlay ? "0 1px 1px ".concat(N60A, ", 0 0 1px 0 ").concat(N60A) : '';
|
|
59
|
+
var selectedShadow = selected ? akEditorSelectedBoxShadow : '';
|
|
60
|
+
var shadow = [selectedShadow, withOverlayShadow].filter(Boolean).join(', ');
|
|
61
|
+
return shadow ? "box-shadow: ".concat(shadow, ";") : '';
|
|
62
|
+
};
|
|
63
|
+
|
|
64
|
+
var getCursorStyle = function getCursorStyle(shouldUsePointerCursor) {
|
|
65
|
+
return "cursor: ".concat(shouldUsePointerCursor ? 'pointer' : 'default', ";");
|
|
24
66
|
};
|
|
25
67
|
|
|
26
68
|
var getClickablePlayButtonStyles = function getClickablePlayButtonStyles(isPlayButtonClickable) {
|
|
@@ -39,12 +81,18 @@ var getSelectableTickBoxStyles = function getSelectableTickBoxStyles(isTickBoxSe
|
|
|
39
81
|
return "\n &:hover .".concat(tickBoxClassName, " {\n ").concat(tickboxFixedStyles, "\n }\n ");
|
|
40
82
|
};
|
|
41
83
|
|
|
42
|
-
export var NewFileExperienceWrapper = styled(
|
|
43
|
-
var
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
84
|
+
export var NewFileExperienceWrapper = styled.div(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n ", "\n"])), function (_ref6) {
|
|
85
|
+
var breakpoint = _ref6.breakpoint,
|
|
86
|
+
dimensions = _ref6.dimensions,
|
|
87
|
+
appearance = _ref6.appearance,
|
|
88
|
+
shouldUsePointerCursor = _ref6.shouldUsePointerCursor,
|
|
89
|
+
disableOverlay = _ref6.disableOverlay,
|
|
90
|
+
displayBackground = _ref6.displayBackground,
|
|
91
|
+
selected = _ref6.selected,
|
|
92
|
+
isPlayButtonClickable = _ref6.isPlayButtonClickable,
|
|
93
|
+
isTickBoxSelectable = _ref6.isTickBoxSelectable,
|
|
94
|
+
shouldDisplayTooltip = _ref6.shouldDisplayTooltip;
|
|
95
|
+
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(getWrapperShadow(disableOverlay, selected), "\n ").concat(generateResponsiveStyles(breakpoint), "\n ").concat(hideNativeBrowserTextSelectionStyles, "\n\n /* We use classnames from here exceptionally to be able to handle styles when the Card is on hover */\n ").concat(getClickablePlayButtonStyles(isPlayButtonClickable), "\n ").concat(getSelectableTickBoxStyles(isTickBoxSelectable), "\n &:hover .").concat(blanketClassName, " {\n ").concat(fixedBlanketStyles, "\n }\n\n &:hover .").concat(actionsBarClassName, " {\n ").concat(fixedActionBarStyles, "\n }\n\n /* Tooltip does not support percentage dimensions. We enforce them here */\n ").concat(shouldDisplayTooltip ? "> div { width: 100%; height: 100% }" : '', "\n");
|
|
49
96
|
});
|
|
50
|
-
NewFileExperienceWrapper.displayName = 'NewFileExperienceWrapper';
|
|
97
|
+
NewFileExperienceWrapper.displayName = 'NewFileExperienceWrapper';
|
|
98
|
+
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);
|