@atlaskit/media-card 77.12.0 → 77.12.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 +8 -0
- package/dist/cjs/card/card.js +5 -5
- package/dist/cjs/card/inlinePlayerWrapperStyles.js +1 -1
- package/dist/cjs/card/media-card-analytics-error-boundary.js +1 -1
- package/dist/cjs/card/ui/wrapper/styles.js +1 -1
- package/dist/cjs/card/v2/cardV2.js +1 -1
- package/dist/cjs/card/v2/fileCard.js +1 -1
- package/dist/cjs/inline/loader.js +1 -1
- package/dist/cjs/inline/mediaInlineAnalyticsErrorBoundary.js +11 -11
- package/dist/cjs/utils/ufoExperiences.js +1 -1
- package/dist/es2019/card/card.js +5 -5
- package/dist/es2019/card/inlinePlayerWrapperStyles.js +12 -12
- package/dist/es2019/card/media-card-analytics-error-boundary.js +1 -1
- package/dist/es2019/card/ui/wrapper/styles.js +21 -21
- package/dist/es2019/card/v2/cardV2.js +1 -1
- package/dist/es2019/card/v2/fileCard.js +1 -1
- package/dist/es2019/inline/loader.js +1 -1
- package/dist/es2019/inline/mediaInlineAnalyticsErrorBoundary.js +11 -11
- package/dist/es2019/utils/ufoExperiences.js +1 -1
- package/dist/esm/card/card.js +5 -5
- package/dist/esm/card/inlinePlayerWrapperStyles.js +1 -1
- package/dist/esm/card/media-card-analytics-error-boundary.js +1 -1
- package/dist/esm/card/ui/wrapper/styles.js +1 -1
- package/dist/esm/card/v2/cardV2.js +1 -1
- package/dist/esm/card/v2/fileCard.js +1 -1
- package/dist/esm/inline/loader.js +1 -1
- package/dist/esm/inline/mediaInlineAnalyticsErrorBoundary.js +11 -11
- package/dist/esm/utils/ufoExperiences.js +1 -1
- package/dist/types/card/ui/iconWrapper/styles.d.ts +1 -1
- package/dist/types/card/ui/titleBox/styles.d.ts +1 -1
- package/dist/types/utils/preventClickThrough.d.ts +1 -1
- package/dist/types/utils/viewportDetector.d.ts +1 -1
- package/dist/types-ts4.5/card/ui/iconWrapper/styles.d.ts +1 -1
- package/dist/types-ts4.5/card/ui/titleBox/styles.d.ts +1 -1
- package/dist/types-ts4.5/utils/preventClickThrough.d.ts +1 -1
- package/dist/types-ts4.5/utils/viewportDetector.d.ts +1 -1
- package/example-helpers/DelayedRender.tsx +19 -19
- package/example-helpers/cardViewWrapper.tsx +18 -22
- package/example-helpers/cards.tsx +268 -331
- package/example-helpers/developmentUseMessage.tsx +8 -9
- package/example-helpers/index.tsx +100 -124
- package/example-helpers/selectableCard.tsx +32 -35
- package/example-helpers/ssrHelpers.tsx +19 -29
- package/example-helpers/styles.ts +73 -73
- package/example-helpers/svg-helpers/cardContainer.tsx +15 -21
- package/example-helpers/svg-helpers/controls.tsx +11 -11
- package/example-helpers/svg-helpers/dimensionPicker.tsx +85 -93
- package/example-helpers/svg-helpers/svgContainer.tsx +18 -18
- package/example-helpers/svg-helpers/toggle.tsx +28 -29
- package/example-helpers/svg-helpers/uploader.ts +33 -33
- package/package.json +5 -5
- package/report.api.md +227 -232
|
@@ -3,28 +3,22 @@ import React from 'react';
|
|
|
3
3
|
|
|
4
4
|
import { jsx } from '@emotion/react';
|
|
5
5
|
|
|
6
|
-
export const CardBox = ({
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
}
|
|
10
|
-
|
|
11
|
-
children: React.ReactNode;
|
|
12
|
-
}) => (
|
|
13
|
-
<div style={{ marginBottom: '10px' }}>
|
|
14
|
-
<h3 style={{ textAlign: 'center' }}>{title}</h3>
|
|
15
|
-
{children}
|
|
16
|
-
</div>
|
|
6
|
+
export const CardBox = ({ title, children }: { title: string; children: React.ReactNode }) => (
|
|
7
|
+
<div style={{ marginBottom: '10px' }}>
|
|
8
|
+
<h3 style={{ textAlign: 'center' }}>{title}</h3>
|
|
9
|
+
{children}
|
|
10
|
+
</div>
|
|
17
11
|
);
|
|
18
12
|
|
|
19
13
|
export const CardRow = ({ children }: { children: React.ReactNode }) => (
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
14
|
+
<div
|
|
15
|
+
style={{
|
|
16
|
+
display: 'flex',
|
|
17
|
+
flexWrap: 'wrap',
|
|
18
|
+
gap: '10px',
|
|
19
|
+
marginBottom: '10px',
|
|
20
|
+
}}
|
|
21
|
+
>
|
|
22
|
+
{children}
|
|
23
|
+
</div>
|
|
30
24
|
);
|
|
@@ -4,18 +4,18 @@ import { Box, xcss } from '@atlaskit/primitives';
|
|
|
4
4
|
import { media } from '@atlaskit/primitives/responsive';
|
|
5
5
|
|
|
6
6
|
const controlsBoxStyles = xcss({
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
7
|
+
maxWidth: '1500px',
|
|
8
|
+
width: '90%',
|
|
9
|
+
margin: 'auto',
|
|
10
|
+
padding: 'space.100',
|
|
11
|
+
[media.above.sm]: {
|
|
12
|
+
width: '70%',
|
|
13
|
+
},
|
|
14
|
+
[media.above.lg]: {
|
|
15
|
+
width: '50%',
|
|
16
|
+
},
|
|
17
17
|
});
|
|
18
18
|
|
|
19
19
|
export const ControlsBox = ({ children }: { children: ReactNode }) => (
|
|
20
|
-
|
|
20
|
+
<Box xcss={controlsBoxStyles}>{children}</Box>
|
|
21
21
|
);
|
|
@@ -17,108 +17,100 @@ type OnValue = (value: string | undefined) => void;
|
|
|
17
17
|
const defaultVlue = 500;
|
|
18
18
|
|
|
19
19
|
export const DimensionPicker = ({
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
20
|
+
targetName,
|
|
21
|
+
dimensionName,
|
|
22
|
+
onChange,
|
|
23
|
+
initialValue,
|
|
24
|
+
initialUnit,
|
|
25
25
|
}: {
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
26
|
+
initialValue?: number;
|
|
27
|
+
initialUnit?: '%' | 'px';
|
|
28
|
+
targetName: string;
|
|
29
|
+
dimensionName: string;
|
|
30
|
+
onChange: OnValue;
|
|
31
31
|
}) => {
|
|
32
|
-
|
|
32
|
+
const rangeId = `range-${targetName}-${dimensionName}`;
|
|
33
33
|
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
() => (isPercent ? percentRange : pixelRange),
|
|
38
|
-
[isPercent],
|
|
39
|
-
);
|
|
34
|
+
const [isPercent, setIsPercent] = useState(initialUnit === '%');
|
|
35
|
+
const [rawValue, setRawValue] = useState<number | undefined>(initialValue);
|
|
36
|
+
const rangeValues = useMemo(() => (isPercent ? percentRange : pixelRange), [isPercent]);
|
|
40
37
|
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
38
|
+
const value = useMemo(
|
|
39
|
+
() => (isPercent && !!rawValue && rawValue > 100 ? 100 : rawValue),
|
|
40
|
+
[isPercent, rawValue],
|
|
41
|
+
);
|
|
42
|
+
const unit = useMemo(() => (isPercent ? '%' : 'px'), [isPercent]);
|
|
46
43
|
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
44
|
+
useEffect(() => {
|
|
45
|
+
onChange(value === undefined ? value : `${value}${unit}`);
|
|
46
|
+
}, [value, unit, onChange]);
|
|
50
47
|
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
value={value}
|
|
77
|
-
/>
|
|
78
|
-
)}
|
|
79
|
-
</Box>
|
|
80
|
-
);
|
|
48
|
+
return (
|
|
49
|
+
<Box xcss={boxStyles}>
|
|
50
|
+
<Label htmlFor={rangeId}>
|
|
51
|
+
{targetName} {dimensionName}: {value ? `${value} ${isPercent ? '%' : 'px'}` : 'Not set'}
|
|
52
|
+
</Label>
|
|
53
|
+
<ToggleBox label="Use %" defaultChecked={initialUnit === '%'} onChange={setIsPercent} />
|
|
54
|
+
<ToggleBox
|
|
55
|
+
label="Unset"
|
|
56
|
+
defaultChecked={!initialValue}
|
|
57
|
+
onChange={(value) => {
|
|
58
|
+
value ? setRawValue(undefined) : setRawValue(defaultVlue);
|
|
59
|
+
}}
|
|
60
|
+
/>
|
|
61
|
+
{rawValue && (
|
|
62
|
+
<Range
|
|
63
|
+
id={rangeId}
|
|
64
|
+
step={1}
|
|
65
|
+
min={rangeValues[0]}
|
|
66
|
+
max={rangeValues[1]}
|
|
67
|
+
onChange={setRawValue}
|
|
68
|
+
value={value}
|
|
69
|
+
/>
|
|
70
|
+
)}
|
|
71
|
+
</Box>
|
|
72
|
+
);
|
|
81
73
|
};
|
|
82
74
|
|
|
83
75
|
export const DimensionsPicker = ({
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
76
|
+
onContainerWidth,
|
|
77
|
+
onContainerHeight,
|
|
78
|
+
onImageWidth,
|
|
79
|
+
onImageHeight,
|
|
88
80
|
}: {
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
81
|
+
onContainerWidth: OnValue;
|
|
82
|
+
onContainerHeight: OnValue;
|
|
83
|
+
onImageWidth: OnValue;
|
|
84
|
+
onImageHeight: OnValue;
|
|
93
85
|
}) => {
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
86
|
+
return (
|
|
87
|
+
<Flex alignItems="stretch" direction="row" xcss={wrapperStyles}>
|
|
88
|
+
<DimensionPicker
|
|
89
|
+
targetName="Container"
|
|
90
|
+
dimensionName="width"
|
|
91
|
+
onChange={onContainerWidth}
|
|
92
|
+
initialValue={defaultVlue}
|
|
93
|
+
/>
|
|
94
|
+
<DimensionPicker
|
|
95
|
+
targetName="Container"
|
|
96
|
+
dimensionName="height"
|
|
97
|
+
onChange={onContainerHeight}
|
|
98
|
+
initialValue={defaultVlue}
|
|
99
|
+
/>
|
|
100
|
+
<DimensionPicker
|
|
101
|
+
targetName="Image"
|
|
102
|
+
dimensionName="width"
|
|
103
|
+
onChange={onImageWidth}
|
|
104
|
+
initialValue={80}
|
|
105
|
+
initialUnit="%"
|
|
106
|
+
/>
|
|
107
|
+
<DimensionPicker
|
|
108
|
+
targetName="Image"
|
|
109
|
+
dimensionName="height"
|
|
110
|
+
onChange={onImageHeight}
|
|
111
|
+
initialValue={80}
|
|
112
|
+
initialUnit="%"
|
|
113
|
+
/>
|
|
114
|
+
</Flex>
|
|
115
|
+
);
|
|
124
116
|
};
|
|
@@ -6,27 +6,27 @@ import { jsx } from '@emotion/react';
|
|
|
6
6
|
import { Box, xcss } from '@atlaskit/primitives';
|
|
7
7
|
|
|
8
8
|
const containerStyles = xcss({
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
9
|
+
boxSizing: 'border-box',
|
|
10
|
+
borderColor: 'color.border.accent.orange',
|
|
11
|
+
borderStyle: 'solid',
|
|
12
|
+
borderWidth: 'border.width.indicator',
|
|
13
|
+
margin: 'auto',
|
|
14
|
+
marginTop: 'space.100',
|
|
15
|
+
backgroundColor: 'color.background.accent.green.subtler',
|
|
16
16
|
});
|
|
17
17
|
|
|
18
18
|
export const SvgContainer = ({
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
19
|
+
children,
|
|
20
|
+
width,
|
|
21
|
+
height,
|
|
22
22
|
}: {
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
23
|
+
children: React.ReactNode;
|
|
24
|
+
width?: string;
|
|
25
|
+
height?: string;
|
|
26
26
|
}) => {
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
27
|
+
return (
|
|
28
|
+
<Box xcss={containerStyles} style={{ width, height }}>
|
|
29
|
+
{children}
|
|
30
|
+
</Box>
|
|
31
|
+
);
|
|
32
32
|
};
|
|
@@ -5,39 +5,38 @@ import { Box } from '@atlaskit/primitives';
|
|
|
5
5
|
import Toggle from '@atlaskit/toggle';
|
|
6
6
|
|
|
7
7
|
function makeid(length = 12) {
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
return result;
|
|
8
|
+
let result = '';
|
|
9
|
+
const characters = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789';
|
|
10
|
+
const charactersLength = characters.length;
|
|
11
|
+
let counter = 0;
|
|
12
|
+
while (counter < length) {
|
|
13
|
+
result += characters.charAt(Math.floor(Math.random() * charactersLength));
|
|
14
|
+
counter += 1;
|
|
15
|
+
}
|
|
16
|
+
return result;
|
|
18
17
|
}
|
|
19
18
|
|
|
20
19
|
export const ToggleBox = ({
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
20
|
+
label,
|
|
21
|
+
onChange,
|
|
22
|
+
...props
|
|
24
23
|
}: Omit<React.ComponentProps<typeof Toggle>, 'onChange'> & {
|
|
25
|
-
|
|
26
|
-
|
|
24
|
+
label: string;
|
|
25
|
+
onChange: (val: boolean) => void;
|
|
27
26
|
}) => {
|
|
28
|
-
|
|
27
|
+
const [id] = useState(makeid());
|
|
29
28
|
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
29
|
+
return (
|
|
30
|
+
<Box>
|
|
31
|
+
<Label htmlFor={id}>{label}</Label>
|
|
32
|
+
<Toggle
|
|
33
|
+
onChange={(evt) => {
|
|
34
|
+
const { checked } = evt.target;
|
|
35
|
+
onChange(checked);
|
|
36
|
+
}}
|
|
37
|
+
{...props}
|
|
38
|
+
id={id}
|
|
39
|
+
/>
|
|
40
|
+
</Box>
|
|
41
|
+
);
|
|
43
42
|
};
|
|
@@ -4,41 +4,41 @@ import { type FileIdentifier } from '@atlaskit/media-client';
|
|
|
4
4
|
import { useMediaClient } from '@atlaskit/media-client-react';
|
|
5
5
|
|
|
6
6
|
export const useSvgUploader = (collectionName?: string) => {
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
7
|
+
const mediaClient = useMediaClient();
|
|
8
|
+
const [identifier, setIdentifier] = useState<FileIdentifier>();
|
|
9
|
+
const [status, setStatus] = useState<string>('');
|
|
10
10
|
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
11
|
+
const uploadFn = async (event: SyntheticEvent<HTMLInputElement>) => {
|
|
12
|
+
if (!event.currentTarget.files || !event.currentTarget.files.length) {
|
|
13
|
+
return;
|
|
14
|
+
}
|
|
15
|
+
setStatus('Uploading');
|
|
16
16
|
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
17
|
+
const file = event.currentTarget.files[0];
|
|
18
|
+
const uplodableFile = {
|
|
19
|
+
content: file,
|
|
20
|
+
name: file.name,
|
|
21
|
+
collection: collectionName,
|
|
22
|
+
};
|
|
23
23
|
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
24
|
+
mediaClient.file.upload(uplodableFile).subscribe({
|
|
25
|
+
next: ({ status, id }) => {
|
|
26
|
+
if (status === 'error') {
|
|
27
|
+
setStatus('Error while uploading');
|
|
28
|
+
return;
|
|
29
|
+
}
|
|
30
|
+
setStatus(status);
|
|
31
|
+
setIdentifier({
|
|
32
|
+
id,
|
|
33
|
+
mediaItemType: 'file' as const,
|
|
34
|
+
collectionName,
|
|
35
|
+
});
|
|
36
|
+
},
|
|
37
|
+
error: () => {
|
|
38
|
+
setStatus('Error while uploading');
|
|
39
|
+
},
|
|
40
|
+
});
|
|
41
|
+
};
|
|
42
42
|
|
|
43
|
-
|
|
43
|
+
return { status, identifier, uploadFn };
|
|
44
44
|
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atlaskit/media-card",
|
|
3
|
-
"version": "77.12.
|
|
3
|
+
"version": "77.12.1",
|
|
4
4
|
"description": "Includes all media card related components, CardView, CardViewSmall, Card...",
|
|
5
5
|
"publishConfig": {
|
|
6
6
|
"registry": "https://registry.npmjs.org/"
|
|
@@ -37,7 +37,7 @@
|
|
|
37
37
|
},
|
|
38
38
|
"dependencies": {
|
|
39
39
|
"@atlaskit/analytics-next": "^9.3.0",
|
|
40
|
-
"@atlaskit/dropdown-menu": "^12.
|
|
40
|
+
"@atlaskit/dropdown-menu": "^12.11.0",
|
|
41
41
|
"@atlaskit/editor-shared-styles": "^2.12.0",
|
|
42
42
|
"@atlaskit/icon": "^22.3.0",
|
|
43
43
|
"@atlaskit/media-client": "^27.2.0",
|
|
@@ -49,7 +49,7 @@
|
|
|
49
49
|
"@atlaskit/media-viewer": "^48.6.0",
|
|
50
50
|
"@atlaskit/platform-feature-flags": "^0.2.2",
|
|
51
51
|
"@atlaskit/spinner": "^16.1.0",
|
|
52
|
-
"@atlaskit/theme": "^12.
|
|
52
|
+
"@atlaskit/theme": "^12.9.0",
|
|
53
53
|
"@atlaskit/tokens": "^1.49.0",
|
|
54
54
|
"@atlaskit/tooltip": "^18.4.0",
|
|
55
55
|
"@atlaskit/ufo": "^0.2.0",
|
|
@@ -77,7 +77,7 @@
|
|
|
77
77
|
"@atlaskit/media-state": "^1.1.0",
|
|
78
78
|
"@atlaskit/media-test-data": "^2.3.0",
|
|
79
79
|
"@atlaskit/media-test-helpers": "^33.0.0",
|
|
80
|
-
"@atlaskit/primitives": "^
|
|
80
|
+
"@atlaskit/primitives": "^7.0.0",
|
|
81
81
|
"@atlaskit/range": "^7.2.0",
|
|
82
82
|
"@atlaskit/ssr": "*",
|
|
83
83
|
"@atlaskit/toggle": "^13.1.0",
|
|
@@ -106,7 +106,7 @@
|
|
|
106
106
|
"platform.media-experience.card-views-refactor_b91lr": {
|
|
107
107
|
"type": "boolean"
|
|
108
108
|
},
|
|
109
|
-
"platform.media-svg-
|
|
109
|
+
"platform.media-card-svg-rendering_6tdbv": {
|
|
110
110
|
"type": "boolean"
|
|
111
111
|
}
|
|
112
112
|
},
|