@atlaskit/media-card 77.12.0 → 77.12.2
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 +19 -0
- package/compass.yml +6 -3
- package/dist/cjs/card/card.js +5 -5
- package/dist/cjs/card/cardView.js +1 -1
- package/dist/cjs/card/inlinePlayerWrapper.js +4 -1
- package/dist/cjs/card/inlinePlayerWrapperStyles.js +2 -2
- package/dist/cjs/card/media-card-analytics-error-boundary.js +1 -1
- package/dist/cjs/card/ui/actionsBar/actionsBarWrapper.js +4 -1
- package/dist/cjs/card/ui/actionsBar/cardActions/cardActionButton.js +5 -1
- package/dist/cjs/card/ui/actionsBar/cardActions/cardActionsView.js +1 -1
- package/dist/cjs/card/ui/actionsBar/cardActions/styles.js +14 -2
- package/dist/cjs/card/ui/actionsBar/styles.js +13 -8
- package/dist/cjs/card/ui/blanket/blanket.js +2 -0
- package/dist/cjs/card/ui/blanket/styles.js +8 -2
- package/dist/cjs/card/ui/iconMessage/iconMessageWrapper.js +3 -0
- package/dist/cjs/card/ui/iconWrapper/iconWrapper.js +4 -1
- package/dist/cjs/card/ui/iconWrapper/styles.js +3 -0
- package/dist/cjs/card/ui/openMediaViewerButton/openMediaViewerButton.js +9 -20
- package/dist/cjs/card/ui/playButton/playButtonBackground.js +2 -1
- package/dist/cjs/card/ui/playButton/playButtonWrapper.js +2 -1
- package/dist/cjs/card/ui/playButton/styles.js +7 -0
- package/dist/cjs/card/ui/progressBar/styledBar.js +4 -1
- package/dist/cjs/card/ui/progressBar/styles.js +3 -0
- package/dist/cjs/card/ui/tickBox/tickBoxWrapper.js +14 -3
- package/dist/cjs/card/ui/titleBox/styles.js +24 -4
- package/dist/cjs/card/ui/titleBox/titleBoxComponents.js +30 -17
- package/dist/cjs/card/ui/unhandledErrorCard/index.js +22 -11
- package/dist/cjs/card/ui/wrapper/imageContainer.js +1 -0
- package/dist/cjs/card/ui/wrapper/styles.js +2 -2
- package/dist/cjs/card/ui/wrapper/wrapper.js +4 -1
- package/dist/cjs/card/v2/cardV2.js +1 -1
- package/dist/cjs/card/v2/cardViewV2.js +1 -1
- package/dist/cjs/card/v2/cardviews/cardViewWrapper.js +1 -0
- package/dist/cjs/card/v2/cardviews/errorCardView.js +1 -0
- package/dist/cjs/card/v2/cardviews/iconCardView.js +1 -0
- package/dist/cjs/card/v2/cardviews/imageCardView.js +1 -0
- package/dist/cjs/card/v2/cardviews/index.js +1 -0
- package/dist/cjs/card/v2/cardviews/loadingCardView.js +1 -0
- package/dist/cjs/card/v2/cardviews/processingCardView.js +1 -0
- package/dist/cjs/card/v2/cardviews/videoCardView.js +1 -0
- package/dist/cjs/card/v2/fileCard.js +1 -1
- package/dist/cjs/card/v2/svgView/svgView.js +1 -0
- package/dist/cjs/inline/loader.js +1 -1
- package/dist/cjs/inline/mediaInlineAnalyticsErrorBoundary.js +11 -11
- package/dist/cjs/utils/lightCards/errorIcon/index.js +10 -7
- package/dist/cjs/utils/lightCards/errorIcon/styles.js +3 -0
- package/dist/cjs/utils/lightCards/lightCardWrappers.js +9 -5
- package/dist/cjs/utils/lightCards/styles.js +10 -2
- package/dist/cjs/utils/ufoExperiences.js +1 -1
- package/dist/es2019/card/card.js +5 -5
- package/dist/es2019/card/cardView.js +1 -0
- package/dist/es2019/card/inlinePlayerWrapper.js +4 -1
- package/dist/es2019/card/inlinePlayerWrapperStyles.js +13 -12
- package/dist/es2019/card/media-card-analytics-error-boundary.js +1 -1
- package/dist/es2019/card/ui/actionsBar/actionsBarWrapper.js +4 -1
- package/dist/es2019/card/ui/actionsBar/cardActions/cardActionButton.js +4 -1
- package/dist/es2019/card/ui/actionsBar/cardActions/cardActionsView.js +1 -0
- package/dist/es2019/card/ui/actionsBar/cardActions/styles.js +14 -2
- package/dist/es2019/card/ui/actionsBar/styles.js +4 -1
- package/dist/es2019/card/ui/blanket/blanket.js +2 -0
- package/dist/es2019/card/ui/blanket/styles.js +7 -2
- package/dist/es2019/card/ui/iconMessage/iconMessageWrapper.js +2 -0
- package/dist/es2019/card/ui/iconWrapper/iconWrapper.js +4 -1
- package/dist/es2019/card/ui/iconWrapper/styles.js +2 -0
- package/dist/es2019/card/ui/openMediaViewerButton/openMediaViewerButton.js +7 -18
- package/dist/es2019/card/ui/playButton/playButtonBackground.js +2 -1
- package/dist/es2019/card/ui/playButton/playButtonWrapper.js +2 -1
- package/dist/es2019/card/ui/playButton/styles.js +6 -0
- package/dist/es2019/card/ui/progressBar/styledBar.js +4 -1
- package/dist/es2019/card/ui/progressBar/styles.js +2 -0
- package/dist/es2019/card/ui/tickBox/tickBoxWrapper.js +13 -3
- package/dist/es2019/card/ui/titleBox/styles.js +23 -4
- package/dist/es2019/card/ui/titleBox/titleBoxComponents.js +30 -17
- package/dist/es2019/card/ui/unhandledErrorCard/index.js +22 -10
- package/dist/es2019/card/ui/wrapper/imageContainer.js +1 -0
- package/dist/es2019/card/ui/wrapper/styles.js +22 -21
- package/dist/es2019/card/ui/wrapper/wrapper.js +4 -1
- package/dist/es2019/card/v2/cardV2.js +1 -1
- package/dist/es2019/card/v2/cardViewV2.js +1 -0
- package/dist/es2019/card/v2/cardviews/cardViewWrapper.js +1 -0
- package/dist/es2019/card/v2/cardviews/errorCardView.js +1 -0
- package/dist/es2019/card/v2/cardviews/iconCardView.js +1 -0
- package/dist/es2019/card/v2/cardviews/imageCardView.js +1 -0
- package/dist/es2019/card/v2/cardviews/index.js +1 -0
- package/dist/es2019/card/v2/cardviews/loadingCardView.js +1 -0
- package/dist/es2019/card/v2/cardviews/processingCardView.js +1 -0
- package/dist/es2019/card/v2/cardviews/videoCardView.js +1 -0
- package/dist/es2019/card/v2/fileCard.js +1 -1
- package/dist/es2019/card/v2/svgView/svgView.js +1 -0
- package/dist/es2019/inline/loader.js +1 -1
- package/dist/es2019/inline/mediaInlineAnalyticsErrorBoundary.js +11 -11
- package/dist/es2019/utils/lightCards/errorIcon/index.js +10 -6
- package/dist/es2019/utils/lightCards/errorIcon/styles.js +3 -0
- package/dist/es2019/utils/lightCards/lightCardWrappers.js +9 -5
- package/dist/es2019/utils/lightCards/styles.js +9 -2
- package/dist/es2019/utils/ufoExperiences.js +1 -1
- package/dist/esm/card/card.js +5 -5
- package/dist/esm/card/cardView.js +1 -0
- package/dist/esm/card/inlinePlayerWrapper.js +4 -1
- package/dist/esm/card/inlinePlayerWrapperStyles.js +2 -1
- package/dist/esm/card/media-card-analytics-error-boundary.js +1 -1
- package/dist/esm/card/ui/actionsBar/actionsBarWrapper.js +4 -1
- package/dist/esm/card/ui/actionsBar/cardActions/cardActionButton.js +4 -1
- package/dist/esm/card/ui/actionsBar/cardActions/cardActionsView.js +1 -0
- package/dist/esm/card/ui/actionsBar/cardActions/styles.js +14 -2
- package/dist/esm/card/ui/actionsBar/styles.js +12 -8
- package/dist/esm/card/ui/blanket/blanket.js +2 -0
- package/dist/esm/card/ui/blanket/styles.js +7 -2
- package/dist/esm/card/ui/iconMessage/iconMessageWrapper.js +2 -0
- package/dist/esm/card/ui/iconWrapper/iconWrapper.js +4 -1
- package/dist/esm/card/ui/iconWrapper/styles.js +2 -0
- package/dist/esm/card/ui/openMediaViewerButton/openMediaViewerButton.js +7 -18
- package/dist/esm/card/ui/playButton/playButtonBackground.js +2 -1
- package/dist/esm/card/ui/playButton/playButtonWrapper.js +2 -1
- package/dist/esm/card/ui/playButton/styles.js +6 -0
- package/dist/esm/card/ui/progressBar/styledBar.js +4 -1
- package/dist/esm/card/ui/progressBar/styles.js +2 -0
- package/dist/esm/card/ui/tickBox/tickBoxWrapper.js +13 -3
- package/dist/esm/card/ui/titleBox/styles.js +23 -4
- package/dist/esm/card/ui/titleBox/titleBoxComponents.js +30 -17
- package/dist/esm/card/ui/unhandledErrorCard/index.js +22 -10
- package/dist/esm/card/ui/wrapper/imageContainer.js +1 -0
- package/dist/esm/card/ui/wrapper/styles.js +2 -1
- package/dist/esm/card/ui/wrapper/wrapper.js +4 -1
- package/dist/esm/card/v2/cardV2.js +1 -1
- package/dist/esm/card/v2/cardViewV2.js +1 -0
- package/dist/esm/card/v2/cardviews/cardViewWrapper.js +1 -0
- package/dist/esm/card/v2/cardviews/errorCardView.js +1 -0
- package/dist/esm/card/v2/cardviews/iconCardView.js +1 -0
- package/dist/esm/card/v2/cardviews/imageCardView.js +1 -0
- package/dist/esm/card/v2/cardviews/index.js +1 -0
- package/dist/esm/card/v2/cardviews/loadingCardView.js +1 -0
- package/dist/esm/card/v2/cardviews/processingCardView.js +1 -0
- package/dist/esm/card/v2/cardviews/videoCardView.js +1 -0
- package/dist/esm/card/v2/fileCard.js +1 -1
- package/dist/esm/card/v2/svgView/svgView.js +1 -0
- package/dist/esm/inline/loader.js +1 -1
- package/dist/esm/inline/mediaInlineAnalyticsErrorBoundary.js +11 -11
- package/dist/esm/utils/lightCards/errorIcon/index.js +10 -6
- package/dist/esm/utils/lightCards/errorIcon/styles.js +3 -0
- package/dist/esm/utils/lightCards/lightCardWrappers.js +9 -5
- package/dist/esm/utils/lightCards/styles.js +9 -2
- package/dist/esm/utils/ufoExperiences.js +1 -1
- package/dist/types/card/ui/iconWrapper/styles.d.ts +1 -1
- package/dist/types/card/ui/openMediaViewerButton/openMediaViewerButton.d.ts +0 -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/openMediaViewerButton/openMediaViewerButton.d.ts +0 -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 +20 -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 +97 -73
- package/example-helpers/svg-helpers/cardContainer.tsx +22 -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 +19 -18
- package/example-helpers/svg-helpers/toggle.tsx +28 -29
- package/example-helpers/svg-helpers/uploader.ts +33 -33
- package/package.json +121 -120
- package/report.api.md +227 -232
|
@@ -1,30 +1,31 @@
|
|
|
1
1
|
/** @jsx jsx */
|
|
2
2
|
import React from 'react';
|
|
3
3
|
|
|
4
|
+
// eslint-disable-next-line @atlaskit/ui-styling-standard/use-compiled -- Ignored via go/DSP-18766
|
|
4
5
|
import { jsx } from '@emotion/react';
|
|
5
6
|
|
|
6
|
-
export const CardBox = ({
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
}
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
<div style={{ marginBottom: '10px' }}>
|
|
14
|
-
<h3 style={{ textAlign: 'center' }}>{title}</h3>
|
|
15
|
-
{children}
|
|
16
|
-
</div>
|
|
7
|
+
export const CardBox = ({ title, children }: { title: string; children: React.ReactNode }) => (
|
|
8
|
+
// eslint-disable-next-line @atlaskit/ui-styling-standard/enforce-style-prop -- Ignored via go/DSP-18766
|
|
9
|
+
<div style={{ marginBottom: '10px' }}>
|
|
10
|
+
{/* eslint-disable-next-line @atlaskit/ui-styling-standard/enforce-style-prop -- Ignored via go/DSP-18766 */}
|
|
11
|
+
<h3 style={{ textAlign: 'center' }}>{title}</h3>
|
|
12
|
+
{children}
|
|
13
|
+
</div>
|
|
17
14
|
);
|
|
18
15
|
|
|
19
16
|
export const CardRow = ({ children }: { children: React.ReactNode }) => (
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
17
|
+
<div
|
|
18
|
+
style={{
|
|
19
|
+
// eslint-disable-next-line @atlaskit/ui-styling-standard/enforce-style-prop -- Ignored via go/DSP-18766
|
|
20
|
+
display: 'flex',
|
|
21
|
+
// eslint-disable-next-line @atlaskit/ui-styling-standard/enforce-style-prop -- Ignored via go/DSP-18766
|
|
22
|
+
flexWrap: 'wrap',
|
|
23
|
+
// eslint-disable-next-line @atlaskit/ui-styling-standard/enforce-style-prop -- Ignored via go/DSP-18766
|
|
24
|
+
gap: '10px',
|
|
25
|
+
// eslint-disable-next-line @atlaskit/ui-styling-standard/enforce-style-prop -- Ignored via go/DSP-18766
|
|
26
|
+
marginBottom: '10px',
|
|
27
|
+
}}
|
|
28
|
+
>
|
|
29
|
+
{children}
|
|
30
|
+
</div>
|
|
30
31
|
);
|
|
@@ -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
|
};
|
|
@@ -1,32 +1,33 @@
|
|
|
1
1
|
/** @jsx jsx */
|
|
2
2
|
import React from 'react';
|
|
3
3
|
|
|
4
|
+
// eslint-disable-next-line @atlaskit/ui-styling-standard/use-compiled -- Ignored via go/DSP-18766
|
|
4
5
|
import { jsx } from '@emotion/react';
|
|
5
6
|
|
|
6
7
|
import { Box, xcss } from '@atlaskit/primitives';
|
|
7
8
|
|
|
8
9
|
const containerStyles = xcss({
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
10
|
+
boxSizing: 'border-box',
|
|
11
|
+
borderColor: 'color.border.accent.orange',
|
|
12
|
+
borderStyle: 'solid',
|
|
13
|
+
borderWidth: 'border.width.indicator',
|
|
14
|
+
margin: 'auto',
|
|
15
|
+
marginTop: 'space.100',
|
|
16
|
+
backgroundColor: 'color.background.accent.green.subtler',
|
|
16
17
|
});
|
|
17
18
|
|
|
18
19
|
export const SvgContainer = ({
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
20
|
+
children,
|
|
21
|
+
width,
|
|
22
|
+
height,
|
|
22
23
|
}: {
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
24
|
+
children: React.ReactNode;
|
|
25
|
+
width?: string;
|
|
26
|
+
height?: string;
|
|
26
27
|
}) => {
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
28
|
+
return (
|
|
29
|
+
<Box xcss={containerStyles} style={{ width, height }}>
|
|
30
|
+
{children}
|
|
31
|
+
</Box>
|
|
32
|
+
);
|
|
32
33
|
};
|
|
@@ -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
|
};
|