@atlaskit/media-ui 16.5.0 → 17.2.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 +80 -0
- package/dist/cjs/BlockCard/components/Byline.js +4 -2
- package/dist/cjs/BlockCard/components/Content.js +6 -2
- package/dist/cjs/BlockCard/components/ContentHeader.js +6 -2
- package/dist/cjs/BlockCard/components/Icon.js +3 -3
- package/dist/cjs/BlockCard/components/Link.js +3 -1
- package/dist/cjs/BlockCard/components/Modal.js +13 -21
- package/dist/cjs/BlockCard/components/ModalHeader.js +7 -2
- package/dist/cjs/BlockCard/components/Name.js +6 -2
- package/dist/cjs/BlockCard/views/ErroredView.js +5 -1
- package/dist/cjs/BlockCard/views/ForbiddenView.js +5 -2
- package/dist/cjs/BlockCard/views/NotFoundView.js +5 -1
- package/dist/cjs/BlockCard/views/ResolvedView.js +5 -2
- package/dist/cjs/EmbedCard/components/Frame.js +1 -1
- package/dist/cjs/MediaInlineCard/ErroredView/index.js +93 -0
- package/dist/cjs/MediaInlineCard/Frame/index.js +98 -0
- package/dist/cjs/MediaInlineCard/Frame/styled.js +54 -0
- package/dist/cjs/MediaInlineCard/Icon.js +30 -0
- package/dist/cjs/MediaInlineCard/IconAndTitleLayout/index.js +131 -0
- package/dist/cjs/MediaInlineCard/IconAndTitleLayout/styled.js +72 -0
- package/dist/cjs/MediaInlineCard/LoadedView/index.js +66 -0
- package/dist/cjs/MediaInlineCard/LoadingView/index.js +85 -0
- package/dist/cjs/MediaInlineCard/LoadingView/styled.js +19 -0
- package/dist/cjs/MediaInlineCard/index.js +29 -0
- package/dist/cjs/MediaInlineCard/styled.js +25 -0
- package/dist/cjs/classNames.js +52 -0
- package/dist/cjs/codeViewer.js +8 -0
- package/dist/cjs/customMediaPlayer/analytics/events/screen/customMediaPlayer.js +35 -0
- package/dist/cjs/customMediaPlayer/analytics/events/track/playCount.js +35 -0
- package/dist/cjs/customMediaPlayer/analytics/events/track/played.js +35 -0
- package/dist/cjs/customMediaPlayer/analytics/events/ui/mediaButtonClicked.js +33 -0
- package/dist/cjs/customMediaPlayer/analytics/events/ui/playPauseBlanketClicked.js +32 -0
- package/dist/cjs/customMediaPlayer/analytics/events/ui/playbackSpeedChanged.js +32 -0
- package/dist/cjs/customMediaPlayer/analytics/events/ui/shortcutPressed.js +33 -0
- package/dist/cjs/customMediaPlayer/analytics/events/ui/timeRangeNavigated.js +33 -0
- package/dist/cjs/customMediaPlayer/analytics/index.js +89 -0
- package/dist/cjs/customMediaPlayer/analytics/utils/analytics.js +29 -0
- package/dist/cjs/customMediaPlayer/analytics/utils/playbackAttributes.js +40 -0
- package/dist/cjs/customMediaPlayer/fullscreen.js +4 -2
- package/dist/cjs/customMediaPlayer/icons.js +61 -0
- package/dist/cjs/customMediaPlayer/index.js +345 -83
- package/dist/cjs/customMediaPlayer/playbackSpeedControls.js +4 -2
- package/dist/cjs/customMediaPlayer/timeRange.js +6 -1
- package/dist/cjs/customMediaPlayer/types.js +5 -0
- package/dist/cjs/ellipsify.js +42 -40
- package/dist/cjs/index.js +22 -2
- package/dist/cjs/locales.js +17 -0
- package/dist/cjs/mediaImage/index.js +8 -4
- package/dist/cjs/mediaImage/styled.js +32 -4
- package/dist/cjs/messages.js +22 -7
- package/dist/cjs/shortcut.js +12 -5
- package/dist/cjs/version.json +1 -1
- package/dist/es2019/BlockCard/components/Byline.js +4 -2
- package/dist/es2019/BlockCard/components/Content.js +3 -1
- package/dist/es2019/BlockCard/components/ContentHeader.js +3 -1
- package/dist/es2019/BlockCard/components/Icon.js +3 -3
- package/dist/es2019/BlockCard/components/Link.js +3 -1
- package/dist/es2019/BlockCard/components/Modal.js +30 -19
- package/dist/es2019/BlockCard/components/ModalHeader.js +60 -55
- package/dist/es2019/BlockCard/components/Name.js +3 -1
- package/dist/es2019/BlockCard/views/ErroredView.js +2 -0
- package/dist/es2019/BlockCard/views/ForbiddenView.js +3 -1
- package/dist/es2019/BlockCard/views/NotFoundView.js +2 -0
- package/dist/es2019/BlockCard/views/ResolvedView.js +3 -1
- package/dist/es2019/EmbedCard/components/Frame.js +1 -1
- package/dist/es2019/MediaInlineCard/ErroredView/index.js +43 -0
- package/dist/es2019/MediaInlineCard/Frame/index.js +60 -0
- package/dist/es2019/MediaInlineCard/Frame/styled.js +60 -0
- package/dist/es2019/MediaInlineCard/Icon.js +23 -0
- package/dist/es2019/MediaInlineCard/IconAndTitleLayout/index.js +90 -0
- package/dist/es2019/MediaInlineCard/IconAndTitleLayout/styled.js +103 -0
- package/dist/es2019/MediaInlineCard/LoadedView/index.js +25 -0
- package/dist/es2019/MediaInlineCard/LoadingView/index.js +42 -0
- package/dist/es2019/MediaInlineCard/LoadingView/styled.js +6 -0
- package/dist/es2019/MediaInlineCard/index.js +3 -0
- package/dist/es2019/MediaInlineCard/styled.js +9 -0
- package/dist/es2019/classNames.js +8 -3
- package/dist/es2019/codeViewer.js +8 -0
- package/dist/es2019/customMediaPlayer/analytics/events/screen/customMediaPlayer.js +16 -0
- package/dist/es2019/customMediaPlayer/analytics/events/track/playCount.js +16 -0
- package/dist/es2019/customMediaPlayer/analytics/events/track/played.js +16 -0
- package/dist/es2019/customMediaPlayer/analytics/events/ui/mediaButtonClicked.js +18 -0
- package/dist/es2019/customMediaPlayer/analytics/events/ui/playPauseBlanketClicked.js +17 -0
- package/dist/es2019/customMediaPlayer/analytics/events/ui/playbackSpeedChanged.js +17 -0
- package/dist/es2019/customMediaPlayer/analytics/events/ui/shortcutPressed.js +18 -0
- package/dist/es2019/customMediaPlayer/analytics/events/ui/timeRangeNavigated.js +18 -0
- package/dist/es2019/customMediaPlayer/analytics/index.js +9 -0
- package/dist/es2019/customMediaPlayer/analytics/utils/analytics.js +14 -0
- package/dist/es2019/customMediaPlayer/analytics/utils/playbackAttributes.js +31 -0
- package/dist/es2019/customMediaPlayer/fullscreen.js +4 -2
- package/dist/es2019/customMediaPlayer/icons.js +49 -0
- package/dist/es2019/customMediaPlayer/index.js +357 -78
- package/dist/es2019/customMediaPlayer/playbackSpeedControls.js +4 -2
- package/dist/es2019/customMediaPlayer/timeRange.js +9 -1
- package/dist/es2019/customMediaPlayer/types.js +1 -0
- package/dist/es2019/ellipsify.js +22 -16
- package/dist/es2019/index.js +2 -1
- package/dist/es2019/locales.js +3 -0
- package/dist/es2019/mediaImage/index.js +8 -4
- package/dist/es2019/mediaImage/styled.js +29 -8
- package/dist/es2019/messages.js +22 -7
- package/dist/es2019/shortcut.js +12 -5
- package/dist/es2019/version.json +1 -1
- package/dist/esm/BlockCard/components/Byline.js +4 -2
- package/dist/esm/BlockCard/components/Content.js +3 -1
- package/dist/esm/BlockCard/components/ContentHeader.js +3 -1
- package/dist/esm/BlockCard/components/Icon.js +3 -3
- package/dist/esm/BlockCard/components/Link.js +3 -1
- package/dist/esm/BlockCard/components/Modal.js +31 -22
- package/dist/esm/BlockCard/components/ModalHeader.js +6 -2
- package/dist/esm/BlockCard/components/Name.js +3 -1
- package/dist/esm/BlockCard/views/ErroredView.js +2 -0
- package/dist/esm/BlockCard/views/ForbiddenView.js +3 -1
- package/dist/esm/BlockCard/views/NotFoundView.js +2 -0
- package/dist/esm/BlockCard/views/ResolvedView.js +3 -1
- package/dist/esm/EmbedCard/components/Frame.js +1 -1
- package/dist/esm/MediaInlineCard/ErroredView/index.js +70 -0
- package/dist/esm/MediaInlineCard/Frame/index.js +84 -0
- package/dist/esm/MediaInlineCard/Frame/styled.js +39 -0
- package/dist/esm/MediaInlineCard/Icon.js +15 -0
- package/dist/esm/MediaInlineCard/IconAndTitleLayout/index.js +113 -0
- package/dist/esm/MediaInlineCard/IconAndTitleLayout/styled.js +33 -0
- package/dist/esm/MediaInlineCard/LoadedView/index.js +50 -0
- package/dist/esm/MediaInlineCard/LoadingView/index.js +66 -0
- package/dist/esm/MediaInlineCard/LoadingView/styled.js +7 -0
- package/dist/esm/MediaInlineCard/index.js +3 -0
- package/dist/esm/MediaInlineCard/styled.js +11 -0
- package/dist/esm/classNames.js +8 -3
- package/dist/esm/codeViewer.js +8 -0
- package/dist/esm/customMediaPlayer/analytics/events/screen/customMediaPlayer.js +23 -0
- package/dist/esm/customMediaPlayer/analytics/events/track/playCount.js +23 -0
- package/dist/esm/customMediaPlayer/analytics/events/track/played.js +23 -0
- package/dist/esm/customMediaPlayer/analytics/events/ui/mediaButtonClicked.js +23 -0
- package/dist/esm/customMediaPlayer/analytics/events/ui/playPauseBlanketClicked.js +22 -0
- package/dist/esm/customMediaPlayer/analytics/events/ui/playbackSpeedChanged.js +22 -0
- package/dist/esm/customMediaPlayer/analytics/events/ui/shortcutPressed.js +23 -0
- package/dist/esm/customMediaPlayer/analytics/events/ui/timeRangeNavigated.js +23 -0
- package/dist/esm/customMediaPlayer/analytics/index.js +9 -0
- package/dist/esm/customMediaPlayer/analytics/utils/analytics.js +14 -0
- package/dist/esm/customMediaPlayer/analytics/utils/playbackAttributes.js +29 -0
- package/dist/esm/customMediaPlayer/fullscreen.js +4 -2
- package/dist/esm/customMediaPlayer/icons.js +49 -0
- package/dist/esm/customMediaPlayer/index.js +354 -78
- package/dist/esm/customMediaPlayer/playbackSpeedControls.js +4 -2
- package/dist/esm/customMediaPlayer/timeRange.js +6 -1
- package/dist/esm/customMediaPlayer/types.js +1 -0
- package/dist/esm/ellipsify.js +38 -36
- package/dist/esm/index.js +2 -1
- package/dist/esm/locales.js +3 -0
- package/dist/esm/mediaImage/index.js +8 -4
- package/dist/esm/mediaImage/styled.js +31 -4
- package/dist/esm/messages.js +22 -7
- package/dist/esm/shortcut.js +12 -5
- package/dist/esm/version.json +1 -1
- package/dist/types/BlockCard/components/Byline.d.ts +2 -1
- package/dist/types/BlockCard/components/Content.d.ts +1 -0
- package/dist/types/BlockCard/components/ContentHeader.d.ts +1 -0
- package/dist/types/BlockCard/components/Link.d.ts +2 -1
- package/dist/types/BlockCard/components/ModalHeader.d.ts +2 -2
- package/dist/types/BlockCard/components/Name.d.ts +1 -0
- package/dist/types/BlockCard/views/ErroredView.d.ts +1 -0
- package/dist/types/BlockCard/views/ForbiddenView.d.ts +1 -0
- package/dist/types/BlockCard/views/NotFoundView.d.ts +1 -0
- package/dist/types/BlockCard/views/ResolvedView.d.ts +1 -0
- package/dist/types/MediaInlineCard/ErroredView/index.d.ts +16 -0
- package/dist/types/MediaInlineCard/Frame/index.d.ts +17 -0
- package/dist/types/MediaInlineCard/Frame/styled.d.ts +5 -0
- package/dist/types/MediaInlineCard/Icon.d.ts +3 -0
- package/dist/types/MediaInlineCard/IconAndTitleLayout/index.d.ts +18 -0
- package/dist/types/MediaInlineCard/IconAndTitleLayout/styled.d.ts +12 -0
- package/dist/types/MediaInlineCard/LoadedView/index.d.ts +18 -0
- package/dist/types/MediaInlineCard/LoadingView/index.d.ts +17 -0
- package/dist/types/MediaInlineCard/LoadingView/styled.d.ts +2 -0
- package/dist/types/MediaInlineCard/index.d.ts +6 -0
- package/dist/types/MediaInlineCard/styled.d.ts +2 -0
- package/dist/types/classNames.d.ts +7 -2
- package/dist/types/customMediaPlayer/analytics/events/screen/customMediaPlayer.d.ts +5 -0
- package/dist/types/customMediaPlayer/analytics/events/track/playCount.d.ts +5 -0
- package/dist/types/customMediaPlayer/analytics/events/track/played.d.ts +5 -0
- package/dist/types/customMediaPlayer/analytics/events/ui/mediaButtonClicked.d.ts +5 -0
- package/dist/types/customMediaPlayer/analytics/events/ui/playPauseBlanketClicked.d.ts +5 -0
- package/dist/types/customMediaPlayer/analytics/events/ui/playbackSpeedChanged.d.ts +5 -0
- package/dist/types/customMediaPlayer/analytics/events/ui/shortcutPressed.d.ts +5 -0
- package/dist/types/customMediaPlayer/analytics/events/ui/timeRangeNavigated.d.ts +5 -0
- package/dist/types/customMediaPlayer/analytics/index.d.ts +11 -0
- package/dist/types/customMediaPlayer/analytics/utils/analytics.d.ts +19 -0
- package/dist/types/customMediaPlayer/analytics/utils/playbackAttributes.d.ts +24 -0
- package/dist/types/customMediaPlayer/icons.d.ts +3 -0
- package/dist/types/customMediaPlayer/index.d.ts +44 -30
- package/dist/types/customMediaPlayer/playbackSpeedControls.d.ts +1 -0
- package/dist/types/customMediaPlayer/timeRange.d.ts +1 -0
- package/dist/types/customMediaPlayer/types.d.ts +4 -0
- package/dist/types/index.d.ts +3 -1
- package/dist/types/locales.d.ts +4 -0
- package/dist/types/mediaImage/index.d.ts +2 -0
- package/dist/types/mediaImage/styled.d.ts +5 -2
- package/dist/types/messages.d.ts +1 -1
- package/dist/types/shortcut.d.ts +15 -4
- package/locales/package.json +7 -0
- package/package.json +17 -14
package/dist/es2019/index.js
CHANGED
|
@@ -4,6 +4,7 @@ export { DownloadAction } from './BlockCard/actions/DownloadAction';
|
|
|
4
4
|
export { ViewAction } from './BlockCard/actions/ViewAction';
|
|
5
5
|
export { AuthorizeAction, BlockCardErroredView, BlockCardNotFoundView, BlockCardForbiddenView, BlockCardResolvedView, BlockCardResolvingView, BlockCardUnauthorisedView, ForbiddenAction, PreviewAction } from './BlockCard';
|
|
6
6
|
export { InlineCardErroredView, InlineCardForbiddenView, InlineCardResolvedView, InlineCardResolvingView, InlineCardUnauthorizedView } from './InlineCard';
|
|
7
|
+
export { MediaInlineCardErroredView, MediaInlineCardLoadedView, MediaInlineCardLoadingView } from './MediaInlineCard';
|
|
7
8
|
export { CardLinkView } from './LinkView';
|
|
8
9
|
export { Ellipsify } from './ellipsify';
|
|
9
10
|
export { toHumanReadableMediaSize } from './humanReadableSize';
|
|
@@ -16,7 +17,7 @@ export { InfiniteScroll } from './infiniteScroll';
|
|
|
16
17
|
export { ExifOrientation, getCssFromImageOrientation, getImageInfo, getMetaTagNumericValue, getOrientation, getScaleFactor, getScaleFactorFromFile, isRotated, readImageMetaData } from './imageMetaData';
|
|
17
18
|
export { dataURItoFile, fileToArrayBuffer, fileToDataURI, getFileInfo, getFileInfoFromSrc, loadImage, findParentByClassname, getMimeIcon } from './util';
|
|
18
19
|
export { MimeTypeIcon } from './mime-type-icon';
|
|
19
|
-
export {
|
|
20
|
+
export { CustomMediaPlayer } from './customMediaPlayer/index';
|
|
20
21
|
export { TimeRange } from './customMediaPlayer/timeRange';
|
|
21
22
|
export { hideControlsClassName } from './classNames';
|
|
22
23
|
export { Shortcut, keyCodes } from './shortcut';
|
|
@@ -64,7 +64,9 @@ export class MediaImage extends Component {
|
|
|
64
64
|
previewOrientation,
|
|
65
65
|
crossOrigin,
|
|
66
66
|
onImageError,
|
|
67
|
-
alt = ''
|
|
67
|
+
alt = '',
|
|
68
|
+
loading,
|
|
69
|
+
forceSyncDisplay
|
|
68
70
|
} = this.props;
|
|
69
71
|
const {
|
|
70
72
|
parentWidth,
|
|
@@ -269,7 +271,7 @@ export class MediaImage extends Component {
|
|
|
269
271
|
and we can do that only when image is loaded (and we have image size)
|
|
270
272
|
*/
|
|
271
273
|
|
|
272
|
-
const showImage = isImageLoaded || isFitStrategy && !isImageRotated;
|
|
274
|
+
const showImage = forceSyncDisplay || isImageLoaded || isFitStrategy && !isImageRotated;
|
|
273
275
|
const style = {
|
|
274
276
|
transform: 'translate(-50%, -50%)'
|
|
275
277
|
};
|
|
@@ -360,13 +362,14 @@ export class MediaImage extends Component {
|
|
|
360
362
|
}
|
|
361
363
|
|
|
362
364
|
return /*#__PURE__*/React.createElement(ImageComponent, {
|
|
365
|
+
loading: loading,
|
|
363
366
|
"data-testid": "media-image",
|
|
364
367
|
draggable: false,
|
|
365
368
|
alt: alt,
|
|
366
369
|
style: style,
|
|
367
370
|
onLoad: this.onImageLoad,
|
|
368
371
|
onError: onImageError,
|
|
369
|
-
|
|
372
|
+
imageRef: this.imageRef,
|
|
370
373
|
src: dataURI,
|
|
371
374
|
crossOrigin: crossOrigin
|
|
372
375
|
});
|
|
@@ -376,5 +379,6 @@ export class MediaImage extends Component {
|
|
|
376
379
|
|
|
377
380
|
_defineProperty(MediaImage, "defaultProps", {
|
|
378
381
|
crop: true,
|
|
379
|
-
stretch: false
|
|
382
|
+
stretch: false,
|
|
383
|
+
forceSyncDisplay: false
|
|
380
384
|
});
|
|
@@ -1,8 +1,29 @@
|
|
|
1
|
-
import
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
1
|
+
import _extends from "@babel/runtime/helpers/extends";
|
|
2
|
+
import React from 'react';
|
|
3
|
+
const imgStyle = {
|
|
4
|
+
position: 'absolute',
|
|
5
|
+
left: '50%',
|
|
6
|
+
top: '50%',
|
|
7
|
+
objectFit: 'contain',
|
|
8
|
+
imageOrientation: 'none'
|
|
9
|
+
};
|
|
10
|
+
/*
|
|
11
|
+
This image component falls back to using the native React CSS in JS styling because
|
|
12
|
+
in Styled Components 3.6.2 the additinoal loading property is stripped from the final html.
|
|
13
|
+
This is not the case when using the JSX <img> tag, it is also fixed in the latest versionm of
|
|
14
|
+
styled-components.
|
|
15
|
+
*/
|
|
16
|
+
|
|
17
|
+
export const ImageComponent = props => {
|
|
18
|
+
const {
|
|
19
|
+
style,
|
|
20
|
+
imageRef,
|
|
21
|
+
...otherProps
|
|
22
|
+
} = props;
|
|
23
|
+
return /*#__PURE__*/React.createElement("img", _extends({}, otherProps, {
|
|
24
|
+
ref: imageRef,
|
|
25
|
+
style: { ...imgStyle,
|
|
26
|
+
...style
|
|
27
|
+
}
|
|
28
|
+
}));
|
|
29
|
+
};
|
package/dist/es2019/messages.js
CHANGED
|
@@ -50,6 +50,11 @@ export const messages = defineMessages({
|
|
|
50
50
|
defaultMessage: 'Failed to load',
|
|
51
51
|
description: 'We show this message when we have an error loading a file'
|
|
52
52
|
},
|
|
53
|
+
failed_to_upload: {
|
|
54
|
+
id: 'fabric.media.failed_to_upload',
|
|
55
|
+
defaultMessage: 'Failed to upload',
|
|
56
|
+
description: 'We show this message when we have an error uploading a file'
|
|
57
|
+
},
|
|
53
58
|
recent_uploads: {
|
|
54
59
|
id: 'fabric.media.recent_uploads',
|
|
55
60
|
defaultMessage: 'Recent uploads',
|
|
@@ -442,12 +447,12 @@ export const messages = defineMessages({
|
|
|
442
447
|
},
|
|
443
448
|
play: {
|
|
444
449
|
id: 'fabric.media.play',
|
|
445
|
-
defaultMessage: '
|
|
450
|
+
defaultMessage: 'Play',
|
|
446
451
|
description: ''
|
|
447
452
|
},
|
|
448
453
|
pause: {
|
|
449
454
|
id: 'fabric.media.pause',
|
|
450
|
-
defaultMessage: '
|
|
455
|
+
defaultMessage: 'Pause',
|
|
451
456
|
description: ''
|
|
452
457
|
},
|
|
453
458
|
disable_fullscreen: {
|
|
@@ -515,6 +520,11 @@ export const messages = defineMessages({
|
|
|
515
520
|
defaultMessage: 'text',
|
|
516
521
|
description: ''
|
|
517
522
|
},
|
|
523
|
+
displayThumbnail: {
|
|
524
|
+
id: 'fabric.media.display_thumbnail',
|
|
525
|
+
defaultMessage: 'Display thumbnail',
|
|
526
|
+
description: 'Display file with as a thumbnail.'
|
|
527
|
+
},
|
|
518
528
|
search: {
|
|
519
529
|
id: 'fabric.media.search',
|
|
520
530
|
defaultMessage: 'search',
|
|
@@ -540,6 +550,16 @@ export const messages = defineMessages({
|
|
|
540
550
|
defaultMessage: 'Playback speed',
|
|
541
551
|
description: 'In the context of a video player, it allows user to switch the speed of the video'
|
|
542
552
|
},
|
|
553
|
+
skipBackward: {
|
|
554
|
+
id: 'fabric.media.skip_backward',
|
|
555
|
+
defaultMessage: 'Back 10 seconds',
|
|
556
|
+
description: 'In the context of a video player, it allows user to skip 10 seconds of play time backward.'
|
|
557
|
+
},
|
|
558
|
+
skipForward: {
|
|
559
|
+
id: 'fabric.media.skip_forward',
|
|
560
|
+
defaultMessage: 'Forward 10 seconds',
|
|
561
|
+
description: 'In the context of a video player, it allows user to skip 10 seconds of play time forward.'
|
|
562
|
+
},
|
|
543
563
|
playbackDefaultSpeed: {
|
|
544
564
|
id: 'fabric.media.playback_default_speed',
|
|
545
565
|
defaultMessage: 'Default',
|
|
@@ -575,11 +595,6 @@ export const messages = defineMessages({
|
|
|
575
595
|
defaultMessage: 'Error 429',
|
|
576
596
|
description: 'Error 429 is thrown'
|
|
577
597
|
},
|
|
578
|
-
preview_rateLimited: {
|
|
579
|
-
id: 'fabric.media.preview_rateLimited',
|
|
580
|
-
defaultMessage: 'We had difficulties creating a preview',
|
|
581
|
-
description: 'The preview is rate limited'
|
|
582
|
-
},
|
|
583
598
|
close_and_reopen: {
|
|
584
599
|
id: 'fabric.media.close_and_reopen',
|
|
585
600
|
defaultMessage: 'Try closing this file and reopening.',
|
package/dist/es2019/shortcut.js
CHANGED
|
@@ -1,8 +1,10 @@
|
|
|
1
1
|
import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
2
2
|
import { Component } from 'react';
|
|
3
3
|
export const keyCodes = {
|
|
4
|
-
space:
|
|
5
|
-
m:
|
|
4
|
+
space: 'Space',
|
|
5
|
+
m: 'KeyM',
|
|
6
|
+
rightArrow: 'ArrowRight',
|
|
7
|
+
leftArrow: 'ArrowLeft'
|
|
6
8
|
};
|
|
7
9
|
export class Shortcut extends Component {
|
|
8
10
|
constructor(...args) {
|
|
@@ -10,11 +12,16 @@ export class Shortcut extends Component {
|
|
|
10
12
|
|
|
11
13
|
_defineProperty(this, "keyHandler", e => {
|
|
12
14
|
const {
|
|
13
|
-
|
|
14
|
-
|
|
15
|
+
handler,
|
|
16
|
+
code,
|
|
17
|
+
keyCode
|
|
15
18
|
} = this.props;
|
|
16
19
|
|
|
17
|
-
if (e.keyCode === keyCode) {
|
|
20
|
+
if (keyCode !== undefined && e.keyCode === keyCode) {
|
|
21
|
+
handler();
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
if (code !== undefined && e.code === code) {
|
|
18
25
|
handler();
|
|
19
26
|
}
|
|
20
27
|
});
|
package/dist/es2019/version.json
CHANGED
|
@@ -5,7 +5,8 @@ import { gs, mq } from '../utils';
|
|
|
5
5
|
export var Byline = function Byline(_ref) {
|
|
6
6
|
var text = _ref.text,
|
|
7
7
|
children = _ref.children,
|
|
8
|
-
testId = _ref.testId
|
|
8
|
+
testId = _ref.testId,
|
|
9
|
+
className = _ref.className;
|
|
9
10
|
return jsx("span", {
|
|
10
11
|
css: mq({
|
|
11
12
|
fontSize: gs(1.5),
|
|
@@ -27,6 +28,7 @@ export var Byline = function Byline(_ref) {
|
|
|
27
28
|
// due to HTML its unwrapping behaviour on paste.
|
|
28
29
|
MozUserSelect: 'none'
|
|
29
30
|
}),
|
|
30
|
-
"data-testid": testId
|
|
31
|
+
"data-testid": testId,
|
|
32
|
+
className: className
|
|
31
33
|
}, text || children);
|
|
32
34
|
};
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
/** @jsx jsx */
|
|
2
2
|
import { jsx } from '@emotion/core';
|
|
3
3
|
import { gs, mq } from '../utils';
|
|
4
|
+
export var blockCardContentClassName = 'block-card-content';
|
|
4
5
|
export var Content = function Content(_ref) {
|
|
5
6
|
var children = _ref.children,
|
|
6
7
|
_ref$isCompact = _ref.isCompact,
|
|
@@ -13,6 +14,7 @@ export var Content = function Content(_ref) {
|
|
|
13
14
|
justifyContent: isCompact ? 'unset' : ['unset', 'space-between'],
|
|
14
15
|
flexGrow: 1
|
|
15
16
|
}),
|
|
16
|
-
"data-trello-do-not-use-override": "block-card-content"
|
|
17
|
+
"data-trello-do-not-use-override": "block-card-content",
|
|
18
|
+
className: blockCardContentClassName
|
|
17
19
|
}, children);
|
|
18
20
|
};
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
/** @jsx jsx */
|
|
2
2
|
import { jsx } from '@emotion/core';
|
|
3
|
+
export var blockCardContentHeaderClassName = 'block-card-content-header';
|
|
3
4
|
export var ContentHeader = function ContentHeader(_ref) {
|
|
4
5
|
var onClick = _ref.onClick,
|
|
5
6
|
link = _ref.link,
|
|
@@ -15,6 +16,7 @@ export var ContentHeader = function ContentHeader(_ref) {
|
|
|
15
16
|
// due to HTML its unwrapping behaviour on paste.
|
|
16
17
|
MozUserSelect: 'none'
|
|
17
18
|
},
|
|
18
|
-
"data-trello-do-not-use-override": "block-card-content-header"
|
|
19
|
+
"data-trello-do-not-use-override": "block-card-content-header",
|
|
20
|
+
className: blockCardContentHeaderClassName
|
|
19
21
|
}, children);
|
|
20
22
|
};
|
|
@@ -24,8 +24,7 @@ export var Icon = function Icon(_ref) {
|
|
|
24
24
|
width: gs(2)
|
|
25
25
|
},
|
|
26
26
|
src: url,
|
|
27
|
-
"data-testid": "".concat(testId, "-image")
|
|
28
|
-
className: blockCardIconImageClassName
|
|
27
|
+
"data-testid": "".concat(testId, "-image")
|
|
29
28
|
}),
|
|
30
29
|
errored: placeholder
|
|
31
30
|
});
|
|
@@ -37,6 +36,7 @@ export var Icon = function Icon(_ref) {
|
|
|
37
36
|
alignItems: 'center',
|
|
38
37
|
justifyContent: 'center'
|
|
39
38
|
},
|
|
40
|
-
"data-testid": testId
|
|
39
|
+
"data-testid": testId,
|
|
40
|
+
className: blockCardIconImageClassName
|
|
41
41
|
}, icon || image || placeholder);
|
|
42
42
|
};
|
|
@@ -4,9 +4,11 @@ import { B400 } from '@atlaskit/theme/colors';
|
|
|
4
4
|
export var Link = function Link(_ref) {
|
|
5
5
|
var url = _ref.url,
|
|
6
6
|
_ref$testId = _ref.testId,
|
|
7
|
-
testId = _ref$testId === void 0 ? 'block-card' : _ref$testId
|
|
7
|
+
testId = _ref$testId === void 0 ? 'block-card' : _ref$testId,
|
|
8
|
+
className = _ref.className;
|
|
8
9
|
return jsx("span", {
|
|
9
10
|
"data-testid": "".concat(testId, "-link"),
|
|
11
|
+
className: className,
|
|
10
12
|
css: {
|
|
11
13
|
color: B400,
|
|
12
14
|
wordBreak: 'break-all'
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import _extends from "@babel/runtime/helpers/extends";
|
|
2
1
|
import _slicedToArray from "@babel/runtime/helpers/slicedToArray";
|
|
3
2
|
import _classCallCheck from "@babel/runtime/helpers/classCallCheck";
|
|
4
3
|
import _createClass from "@babel/runtime/helpers/createClass";
|
|
@@ -10,9 +9,25 @@ function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflec
|
|
|
10
9
|
|
|
11
10
|
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; } }
|
|
12
11
|
|
|
12
|
+
/* TODO: (from codemod)
|
|
13
|
+
We have converted this file as best we could but you might still need
|
|
14
|
+
to manually complete migrating this usage of ModalDialog.
|
|
15
|
+
|
|
16
|
+
This file uses one or more of the following ModalDialog props: 'components', 'header',
|
|
17
|
+
'footer', 'body'. These props have been removed as part of moving to
|
|
18
|
+
a compositional API.
|
|
19
|
+
|
|
20
|
+
The render props that used to be exposed by the custom component APIs are
|
|
21
|
+
now accessible using the 'useModal' hook instead: 'testId', 'titleId', and 'onClose'.
|
|
22
|
+
|
|
23
|
+
We are also no longer exposing 'appearance' as render prop, so this needs to be
|
|
24
|
+
manually passed to your custom components.
|
|
25
|
+
|
|
26
|
+
For a complete guide on customization using the new compositional API, refer to the docs at
|
|
27
|
+
https://atlassian.design/components/modal-dialog/examples#customizing-modal-dialog. */
|
|
13
28
|
import React, { useState } from 'react';
|
|
14
|
-
import ModalDialog, { ModalTransition } from '@atlaskit/modal-dialog';
|
|
15
|
-
import { Header
|
|
29
|
+
import ModalDialog, { ModalTransition, ModalBody } from '@atlaskit/modal-dialog';
|
|
30
|
+
import { Header } from './ModalHeader';
|
|
16
31
|
import { getIframeSandboxAttribute } from '../../util';
|
|
17
32
|
var iframeStyles = {
|
|
18
33
|
width: "100%",
|
|
@@ -78,28 +93,22 @@ var Modal = function Modal(_ref) {
|
|
|
78
93
|
width: "large",
|
|
79
94
|
testId: testId,
|
|
80
95
|
onOpenComplete: onOpen,
|
|
81
|
-
components: {
|
|
82
|
-
// TODO modal body wants to be original modal with height 100% - find out how to add
|
|
83
|
-
Header: function Header(props) {
|
|
84
|
-
return /*#__PURE__*/React.createElement(_Header, _extends({}, props, {
|
|
85
|
-
providerName: providerName,
|
|
86
|
-
icon: icon,
|
|
87
|
-
metadata: metadata,
|
|
88
|
-
url: url,
|
|
89
|
-
title: title,
|
|
90
|
-
label: closeLabel,
|
|
91
|
-
download: download,
|
|
92
|
-
byline: byline,
|
|
93
|
-
onViewActionClick: onViewActionClick,
|
|
94
|
-
onDownloadActionClick: onDownloadActionClick
|
|
95
|
-
}));
|
|
96
|
-
}
|
|
97
|
-
},
|
|
98
96
|
onClose: function onClose() {
|
|
99
97
|
setIsOpen(false);
|
|
100
98
|
},
|
|
101
99
|
onCloseComplete: onClose
|
|
102
|
-
},
|
|
100
|
+
}, /*#__PURE__*/React.createElement(Header, {
|
|
101
|
+
providerName: providerName,
|
|
102
|
+
icon: icon,
|
|
103
|
+
metadata: metadata,
|
|
104
|
+
url: url,
|
|
105
|
+
title: title,
|
|
106
|
+
label: closeLabel,
|
|
107
|
+
download: download,
|
|
108
|
+
byline: byline,
|
|
109
|
+
onViewActionClick: onViewActionClick,
|
|
110
|
+
onDownloadActionClick: onDownloadActionClick
|
|
111
|
+
}), /*#__PURE__*/React.createElement(ModalBody, null, src ? /*#__PURE__*/React.createElement("iframe", {
|
|
103
112
|
style: iframeStyles,
|
|
104
113
|
name: iframeName,
|
|
105
114
|
frameBorder: 0,
|
|
@@ -110,7 +119,7 @@ var Modal = function Modal(_ref) {
|
|
|
110
119
|
name: iframeName,
|
|
111
120
|
frameBorder: 0,
|
|
112
121
|
sandbox: sandbox
|
|
113
|
-
})));
|
|
122
|
+
}))));
|
|
114
123
|
};
|
|
115
124
|
|
|
116
125
|
export default ModalWithErrorBoundary;
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
/** @jsx jsx */
|
|
2
2
|
import { jsx } from '@emotion/core';
|
|
3
3
|
import { Fragment as F } from 'react';
|
|
4
|
+
import { useModal } from '@atlaskit/modal-dialog';
|
|
4
5
|
import EditorCloseIcon from '@atlaskit/icon/glyph/editor/close';
|
|
5
6
|
import ShortcutIcon from '@atlaskit/icon/glyph/shortcut';
|
|
6
7
|
import Button from '@atlaskit/button/custom-theme-button';
|
|
@@ -12,8 +13,7 @@ import { MetadataList } from './MetadataList';
|
|
|
12
13
|
import { Byline } from './Byline';
|
|
13
14
|
import { messages } from '../../messages';
|
|
14
15
|
export var Header = function Header(_ref) {
|
|
15
|
-
var
|
|
16
|
-
title = _ref.title,
|
|
16
|
+
var title = _ref.title,
|
|
17
17
|
label = _ref.label,
|
|
18
18
|
_ref$metadata = _ref.metadata,
|
|
19
19
|
metadata = _ref$metadata === void 0 ? {
|
|
@@ -26,6 +26,10 @@ export var Header = function Header(_ref) {
|
|
|
26
26
|
byline = _ref.byline,
|
|
27
27
|
onViewActionClick = _ref.onViewActionClick,
|
|
28
28
|
onDownloadActionClick = _ref.onDownloadActionClick;
|
|
29
|
+
|
|
30
|
+
var _useModal = useModal(),
|
|
31
|
+
onClose = _useModal.onClose;
|
|
32
|
+
|
|
29
33
|
return jsx("div", {
|
|
30
34
|
style: {
|
|
31
35
|
paddingLeft: gs(3),
|
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
import { jsx } from '@emotion/core';
|
|
3
3
|
import { fontSize } from '@atlaskit/theme/constants';
|
|
4
4
|
import { gs } from '../utils';
|
|
5
|
+
export var blockCardContentHeaderNameClassName = 'block-card-content-header-name';
|
|
5
6
|
export var Name = function Name(_ref) {
|
|
6
7
|
var name = _ref.name,
|
|
7
8
|
_ref$isLeftPadded = _ref.isLeftPadded,
|
|
@@ -26,6 +27,7 @@ export var Name = function Name(_ref) {
|
|
|
26
27
|
maxHeight: gs(6)
|
|
27
28
|
},
|
|
28
29
|
"data-testid": testId,
|
|
29
|
-
"data-trello-do-not-use-override": "block-card-content-header-name"
|
|
30
|
+
"data-trello-do-not-use-override": "block-card-content-header-name",
|
|
31
|
+
className: blockCardContentHeaderNameClassName
|
|
30
32
|
}, name);
|
|
31
33
|
};
|
|
@@ -24,6 +24,7 @@ import { RetryAction } from '../actions/RetryAction';
|
|
|
24
24
|
|
|
25
25
|
var textDescriptionProps = _objectSpread({}, messages.could_not_load_link);
|
|
26
26
|
|
|
27
|
+
export var blockCardErroredViewClassName = 'block-card-errored-view';
|
|
27
28
|
export var ErroredView = function ErroredView(_ref) {
|
|
28
29
|
var _ref$isSelected = _ref.isSelected,
|
|
29
30
|
isSelected = _ref$isSelected === void 0 ? false : _ref$isSelected,
|
|
@@ -47,6 +48,7 @@ export var ErroredView = function ErroredView(_ref) {
|
|
|
47
48
|
return jsx(Frame, {
|
|
48
49
|
isSelected: isSelected,
|
|
49
50
|
testId: testId,
|
|
51
|
+
className: blockCardErroredViewClassName,
|
|
50
52
|
isFluidHeight: true,
|
|
51
53
|
inheritDimensions: inheritDimensions
|
|
52
54
|
}, jsx(Content, {
|
|
@@ -18,6 +18,7 @@ import { handleClickCommon } from '../utils/handlers';
|
|
|
18
18
|
import { Link } from '../components/Link';
|
|
19
19
|
import { UnresolvedText } from '../components/UnresolvedText';
|
|
20
20
|
export var blockCardForbiddenViewClassName = 'block-card-forbidden-view';
|
|
21
|
+
export var blockCardForbiddenViewLinkClassName = 'block-card-forbidden-view-link';
|
|
21
22
|
export var ForbiddenView = function ForbiddenView(_ref) {
|
|
22
23
|
var _ref$context = _ref.context,
|
|
23
24
|
context = _ref$context === void 0 ? {
|
|
@@ -58,7 +59,8 @@ export var ForbiddenView = function ForbiddenView(_ref) {
|
|
|
58
59
|
link: link
|
|
59
60
|
}, jsx(Link, {
|
|
60
61
|
url: link,
|
|
61
|
-
testId: testId
|
|
62
|
+
testId: testId,
|
|
63
|
+
className: blockCardForbiddenViewLinkClassName
|
|
62
64
|
})), jsx(Byline, null, jsx(UnresolvedText, {
|
|
63
65
|
icon: jsx(LockIcon, {
|
|
64
66
|
label: "forbidden-lock-icon",
|
|
@@ -23,6 +23,7 @@ import { handleClickCommon } from '../utils/handlers';
|
|
|
23
23
|
|
|
24
24
|
var textDescriptionProps = _objectSpread({}, messages.not_found_description);
|
|
25
25
|
|
|
26
|
+
export var blockCardNotFoundViewClassName = 'block-card-not-found-view';
|
|
26
27
|
export var NotFoundView = function NotFoundView(_ref) {
|
|
27
28
|
var _ref$context = _ref.context,
|
|
28
29
|
context = _ref$context === void 0 ? {
|
|
@@ -44,6 +45,7 @@ export var NotFoundView = function NotFoundView(_ref) {
|
|
|
44
45
|
return jsx(Frame, {
|
|
45
46
|
isSelected: isSelected,
|
|
46
47
|
testId: testId,
|
|
48
|
+
className: blockCardNotFoundViewClassName,
|
|
47
49
|
isFluidHeight: true
|
|
48
50
|
}, jsx(Content, {
|
|
49
51
|
isCompact: true
|
|
@@ -18,6 +18,7 @@ import { ContentFooter } from '../components/ContentFooter';
|
|
|
18
18
|
import { gs } from '../utils';
|
|
19
19
|
import { handleClickCommon } from '../utils/handlers';
|
|
20
20
|
export var blockCardResolvedViewClassName = 'block-card-resolved-view';
|
|
21
|
+
export var blockCardResolvedViewByClassName = 'block-card-resolved-view-by';
|
|
21
22
|
export var ResolvedView = function ResolvedView(_ref) {
|
|
22
23
|
var _ref$icon = _ref.icon,
|
|
23
24
|
icon = _ref$icon === void 0 ? {} : _ref$icon,
|
|
@@ -58,7 +59,8 @@ export var ResolvedView = function ResolvedView(_ref) {
|
|
|
58
59
|
items: details
|
|
59
60
|
}) : undefined;
|
|
60
61
|
var resolvedByline = jsx(Byline, {
|
|
61
|
-
testId: testId ? "".concat(testId, "-by") : undefined
|
|
62
|
+
testId: testId ? "".concat(testId, "-by") : undefined,
|
|
63
|
+
className: blockCardResolvedViewByClassName
|
|
62
64
|
}, byline);
|
|
63
65
|
|
|
64
66
|
var handleClick = function handleClick(event) {
|
|
@@ -36,7 +36,7 @@ export var Frame = /*#__PURE__*/React.forwardRef(function (_ref, iframeRef) {
|
|
|
36
36
|
},
|
|
37
37
|
allowFullScreen: true,
|
|
38
38
|
scrolling: "yes",
|
|
39
|
-
allow: "autoplay; encrypted-media",
|
|
39
|
+
allow: "autoplay; encrypted-media; clipboard-write",
|
|
40
40
|
onLoad: function onLoad() {
|
|
41
41
|
return setIframeLoaded(true);
|
|
42
42
|
},
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
import _classCallCheck from "@babel/runtime/helpers/classCallCheck";
|
|
2
|
+
import _createClass from "@babel/runtime/helpers/createClass";
|
|
3
|
+
import _assertThisInitialized from "@babel/runtime/helpers/assertThisInitialized";
|
|
4
|
+
import _inherits from "@babel/runtime/helpers/inherits";
|
|
5
|
+
import _possibleConstructorReturn from "@babel/runtime/helpers/possibleConstructorReturn";
|
|
6
|
+
import _getPrototypeOf from "@babel/runtime/helpers/getPrototypeOf";
|
|
7
|
+
import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
8
|
+
|
|
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
|
+
|
|
11
|
+
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; } }
|
|
12
|
+
|
|
13
|
+
import React from 'react';
|
|
14
|
+
import { R300 } from '@atlaskit/theme/colors';
|
|
15
|
+
import WarningIcon from '@atlaskit/icon/glyph/warning';
|
|
16
|
+
import { Frame } from '../Frame';
|
|
17
|
+
import { IconAndTitleLayout } from '../IconAndTitleLayout';
|
|
18
|
+
import { AKIconWrapper } from '../Icon';
|
|
19
|
+
import { NoLinkAppearance } from '../styled';
|
|
20
|
+
export var MediaInlineCardErroredView = /*#__PURE__*/function (_React$Component) {
|
|
21
|
+
_inherits(MediaInlineCardErroredView, _React$Component);
|
|
22
|
+
|
|
23
|
+
var _super = _createSuper(MediaInlineCardErroredView);
|
|
24
|
+
|
|
25
|
+
function MediaInlineCardErroredView() {
|
|
26
|
+
var _this;
|
|
27
|
+
|
|
28
|
+
_classCallCheck(this, MediaInlineCardErroredView);
|
|
29
|
+
|
|
30
|
+
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
|
|
31
|
+
args[_key] = arguments[_key];
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
_this = _super.call.apply(_super, [this].concat(args));
|
|
35
|
+
|
|
36
|
+
_defineProperty(_assertThisInitialized(_this), "renderMessage", function () {
|
|
37
|
+
var message = _this.props.message;
|
|
38
|
+
var errorMessage = /*#__PURE__*/React.createElement(NoLinkAppearance, null, message);
|
|
39
|
+
return /*#__PURE__*/React.createElement(React.Fragment, null, errorMessage);
|
|
40
|
+
});
|
|
41
|
+
|
|
42
|
+
return _this;
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
_createClass(MediaInlineCardErroredView, [{
|
|
46
|
+
key: "render",
|
|
47
|
+
value: function render() {
|
|
48
|
+
var _this$props = this.props,
|
|
49
|
+
onClick = _this$props.onClick,
|
|
50
|
+
isSelected = _this$props.isSelected,
|
|
51
|
+
_this$props$testId = _this$props.testId,
|
|
52
|
+
testId = _this$props$testId === void 0 ? 'media-inline-card-errored-view' : _this$props$testId,
|
|
53
|
+
icon = _this$props.icon;
|
|
54
|
+
return /*#__PURE__*/React.createElement(Frame, {
|
|
55
|
+
testId: testId,
|
|
56
|
+
onClick: onClick,
|
|
57
|
+
isSelected: isSelected
|
|
58
|
+
}, /*#__PURE__*/React.createElement(IconAndTitleLayout, {
|
|
59
|
+
icon: icon || /*#__PURE__*/React.createElement(AKIconWrapper, null, /*#__PURE__*/React.createElement(WarningIcon, {
|
|
60
|
+
label: "error",
|
|
61
|
+
size: "small",
|
|
62
|
+
primaryColor: R300
|
|
63
|
+
})),
|
|
64
|
+
title: this.renderMessage()
|
|
65
|
+
}));
|
|
66
|
+
}
|
|
67
|
+
}]);
|
|
68
|
+
|
|
69
|
+
return MediaInlineCardErroredView;
|
|
70
|
+
}(React.Component);
|
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
import _classCallCheck from "@babel/runtime/helpers/classCallCheck";
|
|
2
|
+
import _createClass from "@babel/runtime/helpers/createClass";
|
|
3
|
+
import _assertThisInitialized from "@babel/runtime/helpers/assertThisInitialized";
|
|
4
|
+
import _inherits from "@babel/runtime/helpers/inherits";
|
|
5
|
+
import _possibleConstructorReturn from "@babel/runtime/helpers/possibleConstructorReturn";
|
|
6
|
+
import _getPrototypeOf from "@babel/runtime/helpers/getPrototypeOf";
|
|
7
|
+
import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
8
|
+
|
|
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
|
+
|
|
11
|
+
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; } }
|
|
12
|
+
|
|
13
|
+
import React from 'react';
|
|
14
|
+
import { Wrapper } from './styled';
|
|
15
|
+
export var Frame = /*#__PURE__*/function (_React$Component) {
|
|
16
|
+
_inherits(Frame, _React$Component);
|
|
17
|
+
|
|
18
|
+
var _super = _createSuper(Frame);
|
|
19
|
+
|
|
20
|
+
function Frame() {
|
|
21
|
+
var _this;
|
|
22
|
+
|
|
23
|
+
_classCallCheck(this, Frame);
|
|
24
|
+
|
|
25
|
+
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
|
|
26
|
+
args[_key] = arguments[_key];
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
_this = _super.call.apply(_super, [this].concat(args));
|
|
30
|
+
|
|
31
|
+
_defineProperty(_assertThisInitialized(_this), "handleClick", function (event) {
|
|
32
|
+
var onClick = _this.props.onClick;
|
|
33
|
+
|
|
34
|
+
if (onClick) {
|
|
35
|
+
event.preventDefault();
|
|
36
|
+
event.stopPropagation();
|
|
37
|
+
onClick(event);
|
|
38
|
+
}
|
|
39
|
+
});
|
|
40
|
+
|
|
41
|
+
_defineProperty(_assertThisInitialized(_this), "handleKeyPress", function (event) {
|
|
42
|
+
if (event.key !== ' ' && event.key !== 'Enter') {
|
|
43
|
+
return;
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
var onClick = _this.props.onClick;
|
|
47
|
+
|
|
48
|
+
if (onClick) {
|
|
49
|
+
event.preventDefault();
|
|
50
|
+
event.stopPropagation();
|
|
51
|
+
onClick(event);
|
|
52
|
+
}
|
|
53
|
+
});
|
|
54
|
+
|
|
55
|
+
_defineProperty(_assertThisInitialized(_this), "handleMouseDown", function (e) {
|
|
56
|
+
e.preventDefault();
|
|
57
|
+
});
|
|
58
|
+
|
|
59
|
+
return _this;
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
_createClass(Frame, [{
|
|
63
|
+
key: "render",
|
|
64
|
+
value: function render() {
|
|
65
|
+
var _this$props = this.props,
|
|
66
|
+
isSelected = _this$props.isSelected,
|
|
67
|
+
children = _this$props.children,
|
|
68
|
+
onClick = _this$props.onClick,
|
|
69
|
+
testId = _this$props.testId;
|
|
70
|
+
var isInteractive = Boolean(onClick);
|
|
71
|
+
return /*#__PURE__*/React.createElement(Wrapper, {
|
|
72
|
+
isSelected: isSelected,
|
|
73
|
+
tabIndex: isInteractive ? 0 : undefined,
|
|
74
|
+
role: isInteractive ? 'button' : undefined,
|
|
75
|
+
onClick: this.handleClick,
|
|
76
|
+
onMouseDown: this.handleMouseDown,
|
|
77
|
+
onKeyPress: this.handleKeyPress,
|
|
78
|
+
"data-testid": testId
|
|
79
|
+
}, children);
|
|
80
|
+
}
|
|
81
|
+
}]);
|
|
82
|
+
|
|
83
|
+
return Frame;
|
|
84
|
+
}(React.Component);
|