@atlaskit/media-viewer 52.8.4 → 52.8.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +6 -0
- package/example-helpers/NativeMediaPreview.tsx +1 -1
- package/example-helpers/centeredForm.tsx +1 -1
- package/example-helpers/index.ts +30 -5
- package/example-helpers/styles.ts +6 -6
- package/example-helpers/svg/delayApiResponses.ts +1 -1
- package/example-helpers/svg/toggle.tsx +1 -1
- package/example-helpers/svg/uploader.ts +6 -2
- package/example-helpers/svg/useSelectOptions.ts +10 -2
- package/package.json +2 -2
package/CHANGELOG.md
CHANGED
|
@@ -22,7 +22,7 @@ export const NativeMediaPreview = ({
|
|
|
22
22
|
identifier,
|
|
23
23
|
mediaClient,
|
|
24
24
|
onClick,
|
|
25
|
-
}: NativeMediaViewerProps) => {
|
|
25
|
+
}: NativeMediaViewerProps): React.JSX.Element => {
|
|
26
26
|
const [url, setUrl] = useState('dataURI' in identifier ? identifier.dataURI : '');
|
|
27
27
|
const [isPreviewUnavailable, setIsPreviewUnavailable] = useState(false);
|
|
28
28
|
|
|
@@ -8,7 +8,7 @@ const centeredFormStyles = xcss({
|
|
|
8
8
|
margin: 'auto',
|
|
9
9
|
});
|
|
10
10
|
|
|
11
|
-
export const CenteredForm = ({ children }: { children: ReactNode }) => (
|
|
11
|
+
export const CenteredForm = ({ children }: { children: ReactNode }): React.JSX.Element => (
|
|
12
12
|
<Stack alignInline="center" alignBlock="center" grow="fill" xcss={centeredFormStyles}>
|
|
13
13
|
<Box>{children}</Box>
|
|
14
14
|
</Stack>
|
package/example-helpers/index.ts
CHANGED
|
@@ -175,27 +175,52 @@ export const zipWithNestedFolderItem: FileIdentifier = {
|
|
|
175
175
|
occurrenceKey: 'testOccurrenceKey',
|
|
176
176
|
};
|
|
177
177
|
|
|
178
|
-
export const zipItemMultipleFoldersAtRoot
|
|
178
|
+
export const zipItemMultipleFoldersAtRoot: {
|
|
179
|
+
occurrenceKey: string;
|
|
180
|
+
mediaItemType: "file";
|
|
181
|
+
id: string;
|
|
182
|
+
collectionName?: string;
|
|
183
|
+
} = {
|
|
179
184
|
...zipItemMultipleFoldersAtRootId,
|
|
180
185
|
occurrenceKey: 'testOccurenceKey',
|
|
181
186
|
};
|
|
182
187
|
|
|
183
|
-
export const zipItemLargeInnerFile
|
|
188
|
+
export const zipItemLargeInnerFile: {
|
|
189
|
+
occurrenceKey: string;
|
|
190
|
+
mediaItemType: "file";
|
|
191
|
+
id: string;
|
|
192
|
+
collectionName?: string;
|
|
193
|
+
} = {
|
|
184
194
|
...zipItemLargeInnerFileId,
|
|
185
195
|
occurrenceKey: 'testOccurrenceKey',
|
|
186
196
|
};
|
|
187
197
|
|
|
188
|
-
export const codeItem
|
|
198
|
+
export const codeItem: {
|
|
199
|
+
occurrenceKey: string;
|
|
200
|
+
mediaItemType: "file";
|
|
201
|
+
id: string;
|
|
202
|
+
collectionName?: string;
|
|
203
|
+
} = {
|
|
189
204
|
...codeFileId,
|
|
190
205
|
occurrenceKey: 'testOccurrenceKey',
|
|
191
206
|
};
|
|
192
207
|
|
|
193
|
-
export const emailItem
|
|
208
|
+
export const emailItem: {
|
|
209
|
+
occurrenceKey: string;
|
|
210
|
+
mediaItemType: "file";
|
|
211
|
+
id: string;
|
|
212
|
+
collectionName?: string;
|
|
213
|
+
} = {
|
|
194
214
|
...emailFileId,
|
|
195
215
|
occurrenceKey: 'testOccurrenceKey',
|
|
196
216
|
};
|
|
197
217
|
|
|
198
|
-
export const emailFailedItem
|
|
218
|
+
export const emailFailedItem: {
|
|
219
|
+
occurrenceKey: string;
|
|
220
|
+
mediaItemType: "file";
|
|
221
|
+
id: string;
|
|
222
|
+
collectionName?: string;
|
|
223
|
+
} = {
|
|
199
224
|
...emailUnsupportedFileId,
|
|
200
225
|
occurrenceKey: 'testOccurrenceKey',
|
|
201
226
|
};
|
|
@@ -1,27 +1,27 @@
|
|
|
1
1
|
// eslint-disable-next-line @atlaskit/ui-styling-standard/use-compiled -- Ignored via go/DSP-18766
|
|
2
|
-
import { css } from '@emotion/react';
|
|
2
|
+
import { css, type SerializedStyles } from '@emotion/react';
|
|
3
3
|
import { token } from '@atlaskit/tokens';
|
|
4
4
|
|
|
5
5
|
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-exported-styles -- Ignored via go/DSP-18766
|
|
6
|
-
export const containerStyles = css({
|
|
6
|
+
export const containerStyles: SerializedStyles = css({
|
|
7
7
|
display: 'flex',
|
|
8
8
|
flexDirection: 'row',
|
|
9
9
|
flexWrap: 'wrap',
|
|
10
10
|
});
|
|
11
11
|
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-exported-styles -- Ignored via go/DSP-18766
|
|
12
|
-
export const groupStyles = css({
|
|
12
|
+
export const groupStyles: SerializedStyles = css({
|
|
13
13
|
width: '250px',
|
|
14
14
|
padding: token('space.250', '20px'),
|
|
15
15
|
});
|
|
16
16
|
|
|
17
17
|
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-exported-styles -- Ignored via go/DSP-18766
|
|
18
|
-
export const buttonListStyles = css({
|
|
18
|
+
export const buttonListStyles: SerializedStyles = css({
|
|
19
19
|
paddingLeft: 0,
|
|
20
20
|
listStyle: 'none',
|
|
21
21
|
});
|
|
22
22
|
|
|
23
23
|
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-exported-styles -- Ignored via go/DSP-18766
|
|
24
|
-
export const mVSidebarStyles = css({
|
|
24
|
+
export const mVSidebarStyles: SerializedStyles = css({
|
|
25
25
|
height: 'calc(100vh - 64px)',
|
|
26
26
|
padding: token('space.400', '32px'),
|
|
27
27
|
overflow: 'auto',
|
|
@@ -38,7 +38,7 @@ export const mVSidebarStyles = css({
|
|
|
38
38
|
});
|
|
39
39
|
|
|
40
40
|
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-exported-styles -- Ignored via go/DSP-18766
|
|
41
|
-
export const mVSidebarHeaderStyles = css({
|
|
41
|
+
export const mVSidebarHeaderStyles: SerializedStyles = css({
|
|
42
42
|
display: 'flex',
|
|
43
43
|
width: '100%',
|
|
44
44
|
justifyContent: 'space-between',
|
|
@@ -6,7 +6,7 @@ type Endpoints = Partial<Record<keyof MediaApi, number>>;
|
|
|
6
6
|
export const delayApiResponses = (
|
|
7
7
|
mediaApi: MediaApi,
|
|
8
8
|
{ getImage, getItems, getFileBinary }: Endpoints,
|
|
9
|
-
) => {
|
|
9
|
+
): void => {
|
|
10
10
|
const baseGetImage = mediaApi.getImage;
|
|
11
11
|
mediaApi.getImage = async (...params) => {
|
|
12
12
|
await sleep(getImage);
|
|
@@ -4,12 +4,16 @@ import { type FileIdentifier } from '@atlaskit/media-client';
|
|
|
4
4
|
import { getMediaClient } from '@atlaskit/media-client-react';
|
|
5
5
|
import { type MediaClientConfig } from '@atlaskit/media-client';
|
|
6
6
|
|
|
7
|
-
export const useSvgUploader = (config: MediaClientConfig, collectionName?: string)
|
|
7
|
+
export const useSvgUploader = (config: MediaClientConfig, collectionName?: string): {
|
|
8
|
+
status: string;
|
|
9
|
+
identifier: FileIdentifier | undefined;
|
|
10
|
+
uploadFn: (event: SyntheticEvent<HTMLInputElement>) => Promise<void>;
|
|
11
|
+
} => {
|
|
8
12
|
const mediaClient = getMediaClient(config);
|
|
9
13
|
const [identifier, setIdentifier] = useState<FileIdentifier>();
|
|
10
14
|
const [status, setStatus] = useState<string>('');
|
|
11
15
|
|
|
12
|
-
const uploadFn = async (event: SyntheticEvent<HTMLInputElement>) => {
|
|
16
|
+
const uploadFn = async (event: SyntheticEvent<HTMLInputElement>): Promise<void> => {
|
|
13
17
|
if (!event.currentTarget.files || !event.currentTarget.files.length) {
|
|
14
18
|
return;
|
|
15
19
|
}
|
|
@@ -1,7 +1,15 @@
|
|
|
1
|
-
import { useState, useMemo } from 'react';
|
|
1
|
+
import { useState, useMemo, type Dispatch, type SetStateAction } from 'react';
|
|
2
2
|
import { type FileIdentifier } from '@atlaskit/media-client';
|
|
3
3
|
|
|
4
|
-
export const useSelectOptions = (identifiers: FileIdentifier[], fileKeys: string[])
|
|
4
|
+
export const useSelectOptions = (identifiers: FileIdentifier[], fileKeys: string[]): {
|
|
5
|
+
options: {
|
|
6
|
+
label: string;
|
|
7
|
+
value: FileIdentifier;
|
|
8
|
+
}[]; defaultOption: {
|
|
9
|
+
label: string;
|
|
10
|
+
value: FileIdentifier;
|
|
11
|
+
}; identifier: FileIdentifier; setIdentifier: Dispatch<SetStateAction<FileIdentifier>>;
|
|
12
|
+
} => {
|
|
5
13
|
const defaultOption = useMemo(
|
|
6
14
|
() => ({ label: fileKeys[0], value: identifiers[0] }),
|
|
7
15
|
[identifiers, fileKeys],
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atlaskit/media-viewer",
|
|
3
|
-
"version": "52.8.
|
|
3
|
+
"version": "52.8.5",
|
|
4
4
|
"description": "MediaViewer is Atlassian's powerful solution for viewing files on the web. It's both powerful and extendable yet easy-to-integrate",
|
|
5
5
|
"publishConfig": {
|
|
6
6
|
"registry": "https://registry.npmjs.org/"
|
|
@@ -54,7 +54,7 @@
|
|
|
54
54
|
"@atlaskit/textfield": "^8.2.0",
|
|
55
55
|
"@atlaskit/theme": "^22.0.0",
|
|
56
56
|
"@atlaskit/tokens": "^11.1.0",
|
|
57
|
-
"@atlaskit/tooltip": "^
|
|
57
|
+
"@atlaskit/tooltip": "^21.0.0",
|
|
58
58
|
"@atlaskit/ufo": "^0.4.0",
|
|
59
59
|
"@babel/runtime": "^7.0.0",
|
|
60
60
|
"@codemirror/language": "6.10.8",
|