@atlaskit/media-file-preview 0.4.2 → 0.5.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -1,5 +1,17 @@
1
1
  # @atlaskit/media-file-preview
2
2
 
3
+ ## 0.5.1
4
+
5
+ ### Patch Changes
6
+
7
+ - [#83116](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/83116) [`8d4e99057fe0`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/8d4e99057fe0) - Upgrade Typescript from `4.9.5` to `5.4.2`
8
+
9
+ ## 0.5.0
10
+
11
+ ### Minor Changes
12
+
13
+ - [#73279](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/73279) [`cdad00f21119`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/cdad00f21119) - Create useMediaImage hook
14
+
3
15
  ## 0.4.2
4
16
 
5
17
  ### Patch Changes
@@ -19,7 +19,7 @@ var _getPrototypeOf2 = _interopRequireDefault(require("@babel/runtime/helpers/ge
19
19
  var _wrapNativeSuper2 = _interopRequireDefault(require("@babel/runtime/helpers/wrapNativeSuper"));
20
20
  var _mediaClientReact = require("@atlaskit/media-client-react");
21
21
  function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = (0, _getPrototypeOf2.default)(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = (0, _getPrototypeOf2.default)(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return (0, _possibleConstructorReturn2.default)(this, result); }; }
22
- 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; } }
22
+ function _isNativeReflectConstruct() { try { var t = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); } catch (t) {} return (_isNativeReflectConstruct = function _isNativeReflectConstruct() { return !!t; })(); }
23
23
  /**
24
24
  * Primary reason is logged through Data Portal.
25
25
  * Make sure all the values are whitelisted in Measure -> Event Regitry -> "mediaCardRender failed" event
@@ -14,7 +14,7 @@ var _getPrototypeOf2 = _interopRequireDefault(require("@babel/runtime/helpers/ge
14
14
  var _eventemitter = require("eventemitter2");
15
15
  var _lru_map = require("lru_map");
16
16
  function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = (0, _getPrototypeOf2.default)(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = (0, _getPrototypeOf2.default)(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return (0, _possibleConstructorReturn2.default)(this, result); }; }
17
- 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; } }
17
+ function _isNativeReflectConstruct() { try { var t = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); } catch (t) {} return (_isNativeReflectConstruct = function _isNativeReflectConstruct() { return !!t; })(); }
18
18
  var PREVIEW_CACHE_LRU_SIZE = exports.PREVIEW_CACHE_LRU_SIZE = 50;
19
19
  var ExtendedLRUCache = /*#__PURE__*/function (_LRUMap) {
20
20
  (0, _inherits2.default)(ExtendedLRUCache, _LRUMap);
package/dist/cjs/index.js CHANGED
@@ -9,4 +9,11 @@ Object.defineProperty(exports, "useFilePreview", {
9
9
  return _useFilePreview.useFilePreview;
10
10
  }
11
11
  });
12
- var _useFilePreview = require("./useFilePreview");
12
+ Object.defineProperty(exports, "useMediaImage", {
13
+ enumerable: true,
14
+ get: function get() {
15
+ return _useMediaImage.useMediaImage;
16
+ }
17
+ });
18
+ var _useFilePreview = require("./useFilePreview");
19
+ var _useMediaImage = require("./useMediaImage");
package/dist/cjs/types.js CHANGED
@@ -1,5 +1 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
1
+ "use strict";
@@ -0,0 +1,64 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.useMediaImage = void 0;
7
+ var _react = require("react");
8
+ var _useFilePreview2 = require("./useFilePreview");
9
+ var useMediaImage = exports.useMediaImage = function useMediaImage(_ref) {
10
+ var identifier = _ref.identifier,
11
+ resizeMode = _ref.resizeMode,
12
+ dimensions = _ref.dimensions,
13
+ ssr = _ref.ssr,
14
+ mediaBlobUrlAttrs = _ref.mediaBlobUrlAttrs,
15
+ traceContext = _ref.traceContext,
16
+ skipRemote = _ref.skipRemote,
17
+ allowAnimated = _ref.allowAnimated,
18
+ upscale = _ref.upscale,
19
+ maxAge = _ref.maxAge,
20
+ onLoadCallback = _ref.onLoad,
21
+ onErrorCallback = _ref.onError;
22
+ var _useFilePreview = (0, _useFilePreview2.useFilePreview)({
23
+ identifier: identifier,
24
+ resizeMode: resizeMode,
25
+ dimensions: dimensions,
26
+ ssr: ssr,
27
+ mediaBlobUrlAttrs: mediaBlobUrlAttrs,
28
+ traceContext: traceContext,
29
+ skipRemote: skipRemote,
30
+ allowAnimated: allowAnimated,
31
+ upscale: upscale,
32
+ maxAge: maxAge
33
+ }),
34
+ preview = _useFilePreview.preview,
35
+ status = _useFilePreview.status,
36
+ error = _useFilePreview.error,
37
+ onImageError = _useFilePreview.onImageError,
38
+ onImageLoad = _useFilePreview.onImageLoad,
39
+ getSsrScriptProps = _useFilePreview.getSsrScriptProps;
40
+ var onLoad = (0, _react.useCallback)(function () {
41
+ onLoadCallback && onLoadCallback();
42
+ onImageLoad(preview);
43
+ }, [onImageLoad, onLoadCallback, preview]);
44
+ var onError = (0, _react.useCallback)(function () {
45
+ onErrorCallback && onErrorCallback();
46
+ onImageError(preview);
47
+ }, [onErrorCallback, onImageError, preview]);
48
+ var getImgProps = (0, _react.useCallback)(function () {
49
+ return {
50
+ src: preview === null || preview === void 0 ? void 0 : preview.dataURI,
51
+ onLoad: onLoad,
52
+ onError: onError,
53
+ 'data-test-file-id': identifier.id,
54
+ 'data-test-collection': identifier.collectionName,
55
+ 'data-test-preview-source': preview === null || preview === void 0 ? void 0 : preview.source
56
+ };
57
+ }, [identifier.collectionName, identifier.id, onError, onLoad, preview === null || preview === void 0 ? void 0 : preview.dataURI, preview === null || preview === void 0 ? void 0 : preview.source]);
58
+ return {
59
+ status: status,
60
+ error: error,
61
+ getImgProps: getImgProps,
62
+ getSsrScriptProps: getSsrScriptProps
63
+ };
64
+ };
@@ -3,6 +3,7 @@ import { createObjectURLCache } from './objectURLCache';
3
3
 
4
4
  // Dimensions are used to create a key.
5
5
  // Cache is invalidated when different dimensions are provided.
6
+
6
7
  export const getCacheKey = (id, mode) => {
7
8
  const resizeMode = mode || 'crop';
8
9
  return [id, resizeMode].join('-');
@@ -4,6 +4,7 @@ import { printFunctionCall, printScript } from './printScript';
4
4
  // Any changes to this file must be tested directly in product before merging.
5
5
  // The scripts printed here might differ from what we observe in our internal tests
6
6
  // due to minimification, for example.
7
+
7
8
  export const GLOBAL_MEDIA_CARD_SSR = 'mediaCardSsr';
8
9
  export const GLOBAL_MEDIA_NAMESPACE = '__MEDIA_INTERNAL';
9
10
  export function getMediaGlobalScope(globalScope = window) {
@@ -1 +1,2 @@
1
- export { useFilePreview } from './useFilePreview';
1
+ export { useFilePreview } from './useFilePreview';
2
+ export { useMediaImage } from './useMediaImage';
@@ -1 +0,0 @@
1
- export {};
@@ -0,0 +1,58 @@
1
+ import { useCallback } from 'react';
2
+ import { useFilePreview } from './useFilePreview';
3
+ export const useMediaImage = ({
4
+ identifier,
5
+ resizeMode,
6
+ dimensions,
7
+ ssr,
8
+ mediaBlobUrlAttrs,
9
+ traceContext,
10
+ skipRemote,
11
+ allowAnimated,
12
+ upscale,
13
+ maxAge,
14
+ onLoad: onLoadCallback,
15
+ onError: onErrorCallback
16
+ }) => {
17
+ const {
18
+ preview,
19
+ status,
20
+ error,
21
+ onImageError,
22
+ onImageLoad,
23
+ getSsrScriptProps
24
+ } = useFilePreview({
25
+ identifier,
26
+ resizeMode,
27
+ dimensions,
28
+ ssr,
29
+ mediaBlobUrlAttrs,
30
+ traceContext,
31
+ skipRemote,
32
+ allowAnimated,
33
+ upscale,
34
+ maxAge
35
+ });
36
+ const onLoad = useCallback(() => {
37
+ onLoadCallback && onLoadCallback();
38
+ onImageLoad(preview);
39
+ }, [onImageLoad, onLoadCallback, preview]);
40
+ const onError = useCallback(() => {
41
+ onErrorCallback && onErrorCallback();
42
+ onImageError(preview);
43
+ }, [onErrorCallback, onImageError, preview]);
44
+ const getImgProps = useCallback(() => ({
45
+ src: preview === null || preview === void 0 ? void 0 : preview.dataURI,
46
+ onLoad,
47
+ onError,
48
+ 'data-test-file-id': identifier.id,
49
+ 'data-test-collection': identifier.collectionName,
50
+ 'data-test-preview-source': preview === null || preview === void 0 ? void 0 : preview.source
51
+ }), [identifier.collectionName, identifier.id, onError, onLoad, preview === null || preview === void 0 ? void 0 : preview.dataURI, preview === null || preview === void 0 ? void 0 : preview.source]);
52
+ return {
53
+ status,
54
+ error,
55
+ getImgProps,
56
+ getSsrScriptProps
57
+ };
58
+ };
@@ -6,7 +6,7 @@ import _possibleConstructorReturn from "@babel/runtime/helpers/possibleConstruct
6
6
  import _getPrototypeOf from "@babel/runtime/helpers/getPrototypeOf";
7
7
  import _wrapNativeSuper from "@babel/runtime/helpers/wrapNativeSuper";
8
8
  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); }; }
9
- function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
9
+ function _isNativeReflectConstruct() { try { var t = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); } catch (t) {} return (_isNativeReflectConstruct = function _isNativeReflectConstruct() { return !!t; })(); }
10
10
  import { MediaFileStateError } from '@atlaskit/media-client-react';
11
11
 
12
12
  /**
@@ -5,6 +5,7 @@ import { createObjectURLCache } from './objectURLCache';
5
5
 
6
6
  // Dimensions are used to create a key.
7
7
  // Cache is invalidated when different dimensions are provided.
8
+
8
9
  export var getCacheKey = function getCacheKey(id, mode) {
9
10
  var resizeMode = mode || 'crop';
10
11
  return [id, resizeMode].join('-');
@@ -5,7 +5,7 @@ import _inherits from "@babel/runtime/helpers/inherits";
5
5
  import _possibleConstructorReturn from "@babel/runtime/helpers/possibleConstructorReturn";
6
6
  import _getPrototypeOf from "@babel/runtime/helpers/getPrototypeOf";
7
7
  function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }
8
- 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; } }
8
+ function _isNativeReflectConstruct() { try { var t = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); } catch (t) {} return (_isNativeReflectConstruct = function _isNativeReflectConstruct() { return !!t; })(); }
9
9
  import { EventEmitter2 } from 'eventemitter2';
10
10
  import { LRUMap } from 'lru_map';
11
11
  export var PREVIEW_CACHE_LRU_SIZE = 50;
@@ -4,6 +4,7 @@ import { printFunctionCall, printScript } from './printScript';
4
4
  // Any changes to this file must be tested directly in product before merging.
5
5
  // The scripts printed here might differ from what we observe in our internal tests
6
6
  // due to minimification, for example.
7
+
7
8
  export var GLOBAL_MEDIA_CARD_SSR = 'mediaCardSsr';
8
9
  export var GLOBAL_MEDIA_NAMESPACE = '__MEDIA_INTERNAL';
9
10
  export function getMediaGlobalScope() {
package/dist/esm/index.js CHANGED
@@ -1 +1,2 @@
1
- export { useFilePreview } from './useFilePreview';
1
+ export { useFilePreview } from './useFilePreview';
2
+ export { useMediaImage } from './useMediaImage';
package/dist/esm/types.js CHANGED
@@ -1 +0,0 @@
1
- export {};
@@ -0,0 +1,58 @@
1
+ import { useCallback } from 'react';
2
+ import { useFilePreview } from './useFilePreview';
3
+ export var useMediaImage = function useMediaImage(_ref) {
4
+ var identifier = _ref.identifier,
5
+ resizeMode = _ref.resizeMode,
6
+ dimensions = _ref.dimensions,
7
+ ssr = _ref.ssr,
8
+ mediaBlobUrlAttrs = _ref.mediaBlobUrlAttrs,
9
+ traceContext = _ref.traceContext,
10
+ skipRemote = _ref.skipRemote,
11
+ allowAnimated = _ref.allowAnimated,
12
+ upscale = _ref.upscale,
13
+ maxAge = _ref.maxAge,
14
+ onLoadCallback = _ref.onLoad,
15
+ onErrorCallback = _ref.onError;
16
+ var _useFilePreview = useFilePreview({
17
+ identifier: identifier,
18
+ resizeMode: resizeMode,
19
+ dimensions: dimensions,
20
+ ssr: ssr,
21
+ mediaBlobUrlAttrs: mediaBlobUrlAttrs,
22
+ traceContext: traceContext,
23
+ skipRemote: skipRemote,
24
+ allowAnimated: allowAnimated,
25
+ upscale: upscale,
26
+ maxAge: maxAge
27
+ }),
28
+ preview = _useFilePreview.preview,
29
+ status = _useFilePreview.status,
30
+ error = _useFilePreview.error,
31
+ onImageError = _useFilePreview.onImageError,
32
+ onImageLoad = _useFilePreview.onImageLoad,
33
+ getSsrScriptProps = _useFilePreview.getSsrScriptProps;
34
+ var onLoad = useCallback(function () {
35
+ onLoadCallback && onLoadCallback();
36
+ onImageLoad(preview);
37
+ }, [onImageLoad, onLoadCallback, preview]);
38
+ var onError = useCallback(function () {
39
+ onErrorCallback && onErrorCallback();
40
+ onImageError(preview);
41
+ }, [onErrorCallback, onImageError, preview]);
42
+ var getImgProps = useCallback(function () {
43
+ return {
44
+ src: preview === null || preview === void 0 ? void 0 : preview.dataURI,
45
+ onLoad: onLoad,
46
+ onError: onError,
47
+ 'data-test-file-id': identifier.id,
48
+ 'data-test-collection': identifier.collectionName,
49
+ 'data-test-preview-source': preview === null || preview === void 0 ? void 0 : preview.source
50
+ };
51
+ }, [identifier.collectionName, identifier.id, onError, onLoad, preview === null || preview === void 0 ? void 0 : preview.dataURI, preview === null || preview === void 0 ? void 0 : preview.source]);
52
+ return {
53
+ status: status,
54
+ error: error,
55
+ getImgProps: getImgProps,
56
+ getSsrScriptProps: getSsrScriptProps
57
+ };
58
+ };
@@ -1,2 +1,5 @@
1
1
  export { useFilePreview } from './useFilePreview';
2
+ export type { UseFilePreviewParams } from './useFilePreview';
3
+ export { useMediaImage } from './useMediaImage';
4
+ export type { UseMediaImageParams } from './useMediaImage';
2
5
  export type { MediaFilePreview } from './types';
@@ -0,0 +1,43 @@
1
+ /// <reference types="react" />
2
+ import { FileIdentifier, MediaBlobUrlAttrs, MediaStoreGetFileImageParams } from '@atlaskit/media-client';
3
+ import { MediaTraceContext, SSR } from '@atlaskit/media-common';
4
+ import { MediaFilePreviewDimensions } from './types';
5
+ export interface UseMediaImageParams {
6
+ /** Instance of file identifier. */
7
+ readonly identifier: FileIdentifier;
8
+ /** Resize the media to 'crop' | 'fit' | 'full-fit' */
9
+ readonly resizeMode?: MediaStoreGetFileImageParams['mode'];
10
+ /** Dimensions to be requested to the server. Will be scaled x2 in Retina Displays */
11
+ readonly dimensions?: MediaFilePreviewDimensions;
12
+ /** Server-Side-Rendering modes are "server" and "client" */
13
+ readonly ssr?: SSR;
14
+ /** Attributes to attach to the created Blob Url */
15
+ readonly mediaBlobUrlAttrs?: MediaBlobUrlAttrs;
16
+ /** Trace context to be passed to the backend requests */
17
+ readonly traceContext?: MediaTraceContext;
18
+ /** Do not fetch a remote preview. Helpful for lazy loading */
19
+ readonly skipRemote?: boolean;
20
+ /** Define whether an animated image is acceptable to return */
21
+ readonly allowAnimated?: boolean;
22
+ /** Define the upscale strategy for this image. */
23
+ readonly upscale?: boolean;
24
+ /** Make the client receive the response with the given max-age cache control header. Minimum: 0, maximum: 9223372036854776000.
25
+ */
26
+ readonly maxAge?: number;
27
+ /** On image load and on error callback from the parent. We are keeping the name same to streamline the customer experience when using these properties back to their image components */
28
+ readonly onLoad?: () => void;
29
+ readonly onError?: () => void;
30
+ }
31
+ export declare const useMediaImage: ({ identifier, resizeMode, dimensions, ssr, mediaBlobUrlAttrs, traceContext, skipRemote, allowAnimated, upscale, maxAge, onLoad: onLoadCallback, onError: onErrorCallback, }: UseMediaImageParams) => {
32
+ status: import("./types").MediaFilePreviewStatus;
33
+ error: import("./errors").MediaFilePreviewError | undefined;
34
+ getImgProps: () => {
35
+ src: string | undefined;
36
+ onLoad: () => void;
37
+ onError: () => void;
38
+ 'data-test-file-id': string;
39
+ 'data-test-collection': string | undefined;
40
+ 'data-test-preview-source': import("./types").MediaFilePreviewSource | undefined;
41
+ };
42
+ getSsrScriptProps: (() => import("react").ScriptHTMLAttributes<HTMLScriptElement>) | undefined;
43
+ };
@@ -1,2 +1,5 @@
1
1
  export { useFilePreview } from './useFilePreview';
2
+ export type { UseFilePreviewParams } from './useFilePreview';
3
+ export { useMediaImage } from './useMediaImage';
4
+ export type { UseMediaImageParams } from './useMediaImage';
2
5
  export type { MediaFilePreview } from './types';
@@ -0,0 +1,43 @@
1
+ /// <reference types="react" />
2
+ import { FileIdentifier, MediaBlobUrlAttrs, MediaStoreGetFileImageParams } from '@atlaskit/media-client';
3
+ import { MediaTraceContext, SSR } from '@atlaskit/media-common';
4
+ import { MediaFilePreviewDimensions } from './types';
5
+ export interface UseMediaImageParams {
6
+ /** Instance of file identifier. */
7
+ readonly identifier: FileIdentifier;
8
+ /** Resize the media to 'crop' | 'fit' | 'full-fit' */
9
+ readonly resizeMode?: MediaStoreGetFileImageParams['mode'];
10
+ /** Dimensions to be requested to the server. Will be scaled x2 in Retina Displays */
11
+ readonly dimensions?: MediaFilePreviewDimensions;
12
+ /** Server-Side-Rendering modes are "server" and "client" */
13
+ readonly ssr?: SSR;
14
+ /** Attributes to attach to the created Blob Url */
15
+ readonly mediaBlobUrlAttrs?: MediaBlobUrlAttrs;
16
+ /** Trace context to be passed to the backend requests */
17
+ readonly traceContext?: MediaTraceContext;
18
+ /** Do not fetch a remote preview. Helpful for lazy loading */
19
+ readonly skipRemote?: boolean;
20
+ /** Define whether an animated image is acceptable to return */
21
+ readonly allowAnimated?: boolean;
22
+ /** Define the upscale strategy for this image. */
23
+ readonly upscale?: boolean;
24
+ /** Make the client receive the response with the given max-age cache control header. Minimum: 0, maximum: 9223372036854776000.
25
+ */
26
+ readonly maxAge?: number;
27
+ /** On image load and on error callback from the parent. We are keeping the name same to streamline the customer experience when using these properties back to their image components */
28
+ readonly onLoad?: () => void;
29
+ readonly onError?: () => void;
30
+ }
31
+ export declare const useMediaImage: ({ identifier, resizeMode, dimensions, ssr, mediaBlobUrlAttrs, traceContext, skipRemote, allowAnimated, upscale, maxAge, onLoad: onLoadCallback, onError: onErrorCallback, }: UseMediaImageParams) => {
32
+ status: import("./types").MediaFilePreviewStatus;
33
+ error: import("./errors").MediaFilePreviewError | undefined;
34
+ getImgProps: () => {
35
+ src: string | undefined;
36
+ onLoad: () => void;
37
+ onError: () => void;
38
+ 'data-test-file-id': string;
39
+ 'data-test-collection': string | undefined;
40
+ 'data-test-preview-source': import("./types").MediaFilePreviewSource | undefined;
41
+ };
42
+ getSsrScriptProps: (() => import("react").ScriptHTMLAttributes<HTMLScriptElement>) | undefined;
43
+ };
@@ -0,0 +1,30 @@
1
+ /* eslint-disable @atlaskit/design-system/ensure-design-token-usage */
2
+ /* eslint-disable @atlaskit/design-system/prefer-primitives */
3
+ import React, { ReactNode } from 'react';
4
+
5
+ type TerminalTextDisplayProps = {
6
+ children: ReactNode;
7
+ };
8
+
9
+ export const TerminalTextDisplay: React.FC<TerminalTextDisplayProps> = ({
10
+ children,
11
+ }): React.ReactElement | null => (
12
+ <div
13
+ style={{
14
+ backgroundColor: '#000000',
15
+ color: '#33FF00',
16
+ borderRadius: 5,
17
+ // eslint-disable-next-line @atlaskit/design-system/ensure-design-token-usage/preview
18
+ padding: 20,
19
+ fontFamily: 'Courier New, monospace',
20
+ lineHeight: '1.4',
21
+ maxWidth: 600,
22
+ width: '100%',
23
+ fontSize: '1.1em',
24
+ whiteSpace: 'pre-wrap',
25
+ overflow: 'auto',
26
+ }}
27
+ >
28
+ {children}
29
+ </div>
30
+ );
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaskit/media-file-preview",
3
- "version": "0.4.2",
3
+ "version": "0.5.1",
4
4
  "description": "A React Hook to fetch and render file previews. It's overloaded with fancy features like SSR, lazy loading, memory cache and local preview.",
5
5
  "author": "Atlassian Pty Ltd",
6
6
  "license": "Apache-2.0",
@@ -35,10 +35,10 @@
35
35
  ".": "./src/index.ts"
36
36
  },
37
37
  "dependencies": {
38
- "@atlaskit/media-client": "^26.1.0",
38
+ "@atlaskit/media-client": "^26.2.0",
39
39
  "@atlaskit/media-client-react": "^2.0.1",
40
- "@atlaskit/media-common": "^11.0.0",
41
- "@atlaskit/media-ui": "^25.1.0",
40
+ "@atlaskit/media-common": "^11.1.0",
41
+ "@atlaskit/media-ui": "^25.4.0",
42
42
  "@babel/runtime": "^7.0.0",
43
43
  "eventemitter2": "^4.1.0",
44
44
  "lru_map": "^0.4.1"
@@ -58,7 +58,7 @@
58
58
  "@testing-library/react": "^12.1.5",
59
59
  "@testing-library/react-hooks": "^8.0.1",
60
60
  "react-dom": "^16.8.0",
61
- "typescript": "~4.9.5",
61
+ "typescript": "~5.4.2",
62
62
  "wait-for-expect": "^1.2.0"
63
63
  },
64
64
  "techstack": {
@@ -97,4 +97,4 @@
97
97
  }
98
98
  },
99
99
  "prettier": "@atlassian/atlassian-frontend-prettier-config-1.0.0"
100
- }
100
+ }