@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.
Files changed (169) hide show
  1. package/CHANGELOG.md +19 -0
  2. package/compass.yml +6 -3
  3. package/dist/cjs/card/card.js +5 -5
  4. package/dist/cjs/card/cardView.js +1 -1
  5. package/dist/cjs/card/inlinePlayerWrapper.js +4 -1
  6. package/dist/cjs/card/inlinePlayerWrapperStyles.js +2 -2
  7. package/dist/cjs/card/media-card-analytics-error-boundary.js +1 -1
  8. package/dist/cjs/card/ui/actionsBar/actionsBarWrapper.js +4 -1
  9. package/dist/cjs/card/ui/actionsBar/cardActions/cardActionButton.js +5 -1
  10. package/dist/cjs/card/ui/actionsBar/cardActions/cardActionsView.js +1 -1
  11. package/dist/cjs/card/ui/actionsBar/cardActions/styles.js +14 -2
  12. package/dist/cjs/card/ui/actionsBar/styles.js +13 -8
  13. package/dist/cjs/card/ui/blanket/blanket.js +2 -0
  14. package/dist/cjs/card/ui/blanket/styles.js +8 -2
  15. package/dist/cjs/card/ui/iconMessage/iconMessageWrapper.js +3 -0
  16. package/dist/cjs/card/ui/iconWrapper/iconWrapper.js +4 -1
  17. package/dist/cjs/card/ui/iconWrapper/styles.js +3 -0
  18. package/dist/cjs/card/ui/openMediaViewerButton/openMediaViewerButton.js +9 -20
  19. package/dist/cjs/card/ui/playButton/playButtonBackground.js +2 -1
  20. package/dist/cjs/card/ui/playButton/playButtonWrapper.js +2 -1
  21. package/dist/cjs/card/ui/playButton/styles.js +7 -0
  22. package/dist/cjs/card/ui/progressBar/styledBar.js +4 -1
  23. package/dist/cjs/card/ui/progressBar/styles.js +3 -0
  24. package/dist/cjs/card/ui/tickBox/tickBoxWrapper.js +14 -3
  25. package/dist/cjs/card/ui/titleBox/styles.js +24 -4
  26. package/dist/cjs/card/ui/titleBox/titleBoxComponents.js +30 -17
  27. package/dist/cjs/card/ui/unhandledErrorCard/index.js +22 -11
  28. package/dist/cjs/card/ui/wrapper/imageContainer.js +1 -0
  29. package/dist/cjs/card/ui/wrapper/styles.js +2 -2
  30. package/dist/cjs/card/ui/wrapper/wrapper.js +4 -1
  31. package/dist/cjs/card/v2/cardV2.js +1 -1
  32. package/dist/cjs/card/v2/cardViewV2.js +1 -1
  33. package/dist/cjs/card/v2/cardviews/cardViewWrapper.js +1 -0
  34. package/dist/cjs/card/v2/cardviews/errorCardView.js +1 -0
  35. package/dist/cjs/card/v2/cardviews/iconCardView.js +1 -0
  36. package/dist/cjs/card/v2/cardviews/imageCardView.js +1 -0
  37. package/dist/cjs/card/v2/cardviews/index.js +1 -0
  38. package/dist/cjs/card/v2/cardviews/loadingCardView.js +1 -0
  39. package/dist/cjs/card/v2/cardviews/processingCardView.js +1 -0
  40. package/dist/cjs/card/v2/cardviews/videoCardView.js +1 -0
  41. package/dist/cjs/card/v2/fileCard.js +1 -1
  42. package/dist/cjs/card/v2/svgView/svgView.js +1 -0
  43. package/dist/cjs/inline/loader.js +1 -1
  44. package/dist/cjs/inline/mediaInlineAnalyticsErrorBoundary.js +11 -11
  45. package/dist/cjs/utils/lightCards/errorIcon/index.js +10 -7
  46. package/dist/cjs/utils/lightCards/errorIcon/styles.js +3 -0
  47. package/dist/cjs/utils/lightCards/lightCardWrappers.js +9 -5
  48. package/dist/cjs/utils/lightCards/styles.js +10 -2
  49. package/dist/cjs/utils/ufoExperiences.js +1 -1
  50. package/dist/es2019/card/card.js +5 -5
  51. package/dist/es2019/card/cardView.js +1 -0
  52. package/dist/es2019/card/inlinePlayerWrapper.js +4 -1
  53. package/dist/es2019/card/inlinePlayerWrapperStyles.js +13 -12
  54. package/dist/es2019/card/media-card-analytics-error-boundary.js +1 -1
  55. package/dist/es2019/card/ui/actionsBar/actionsBarWrapper.js +4 -1
  56. package/dist/es2019/card/ui/actionsBar/cardActions/cardActionButton.js +4 -1
  57. package/dist/es2019/card/ui/actionsBar/cardActions/cardActionsView.js +1 -0
  58. package/dist/es2019/card/ui/actionsBar/cardActions/styles.js +14 -2
  59. package/dist/es2019/card/ui/actionsBar/styles.js +4 -1
  60. package/dist/es2019/card/ui/blanket/blanket.js +2 -0
  61. package/dist/es2019/card/ui/blanket/styles.js +7 -2
  62. package/dist/es2019/card/ui/iconMessage/iconMessageWrapper.js +2 -0
  63. package/dist/es2019/card/ui/iconWrapper/iconWrapper.js +4 -1
  64. package/dist/es2019/card/ui/iconWrapper/styles.js +2 -0
  65. package/dist/es2019/card/ui/openMediaViewerButton/openMediaViewerButton.js +7 -18
  66. package/dist/es2019/card/ui/playButton/playButtonBackground.js +2 -1
  67. package/dist/es2019/card/ui/playButton/playButtonWrapper.js +2 -1
  68. package/dist/es2019/card/ui/playButton/styles.js +6 -0
  69. package/dist/es2019/card/ui/progressBar/styledBar.js +4 -1
  70. package/dist/es2019/card/ui/progressBar/styles.js +2 -0
  71. package/dist/es2019/card/ui/tickBox/tickBoxWrapper.js +13 -3
  72. package/dist/es2019/card/ui/titleBox/styles.js +23 -4
  73. package/dist/es2019/card/ui/titleBox/titleBoxComponents.js +30 -17
  74. package/dist/es2019/card/ui/unhandledErrorCard/index.js +22 -10
  75. package/dist/es2019/card/ui/wrapper/imageContainer.js +1 -0
  76. package/dist/es2019/card/ui/wrapper/styles.js +22 -21
  77. package/dist/es2019/card/ui/wrapper/wrapper.js +4 -1
  78. package/dist/es2019/card/v2/cardV2.js +1 -1
  79. package/dist/es2019/card/v2/cardViewV2.js +1 -0
  80. package/dist/es2019/card/v2/cardviews/cardViewWrapper.js +1 -0
  81. package/dist/es2019/card/v2/cardviews/errorCardView.js +1 -0
  82. package/dist/es2019/card/v2/cardviews/iconCardView.js +1 -0
  83. package/dist/es2019/card/v2/cardviews/imageCardView.js +1 -0
  84. package/dist/es2019/card/v2/cardviews/index.js +1 -0
  85. package/dist/es2019/card/v2/cardviews/loadingCardView.js +1 -0
  86. package/dist/es2019/card/v2/cardviews/processingCardView.js +1 -0
  87. package/dist/es2019/card/v2/cardviews/videoCardView.js +1 -0
  88. package/dist/es2019/card/v2/fileCard.js +1 -1
  89. package/dist/es2019/card/v2/svgView/svgView.js +1 -0
  90. package/dist/es2019/inline/loader.js +1 -1
  91. package/dist/es2019/inline/mediaInlineAnalyticsErrorBoundary.js +11 -11
  92. package/dist/es2019/utils/lightCards/errorIcon/index.js +10 -6
  93. package/dist/es2019/utils/lightCards/errorIcon/styles.js +3 -0
  94. package/dist/es2019/utils/lightCards/lightCardWrappers.js +9 -5
  95. package/dist/es2019/utils/lightCards/styles.js +9 -2
  96. package/dist/es2019/utils/ufoExperiences.js +1 -1
  97. package/dist/esm/card/card.js +5 -5
  98. package/dist/esm/card/cardView.js +1 -0
  99. package/dist/esm/card/inlinePlayerWrapper.js +4 -1
  100. package/dist/esm/card/inlinePlayerWrapperStyles.js +2 -1
  101. package/dist/esm/card/media-card-analytics-error-boundary.js +1 -1
  102. package/dist/esm/card/ui/actionsBar/actionsBarWrapper.js +4 -1
  103. package/dist/esm/card/ui/actionsBar/cardActions/cardActionButton.js +4 -1
  104. package/dist/esm/card/ui/actionsBar/cardActions/cardActionsView.js +1 -0
  105. package/dist/esm/card/ui/actionsBar/cardActions/styles.js +14 -2
  106. package/dist/esm/card/ui/actionsBar/styles.js +12 -8
  107. package/dist/esm/card/ui/blanket/blanket.js +2 -0
  108. package/dist/esm/card/ui/blanket/styles.js +7 -2
  109. package/dist/esm/card/ui/iconMessage/iconMessageWrapper.js +2 -0
  110. package/dist/esm/card/ui/iconWrapper/iconWrapper.js +4 -1
  111. package/dist/esm/card/ui/iconWrapper/styles.js +2 -0
  112. package/dist/esm/card/ui/openMediaViewerButton/openMediaViewerButton.js +7 -18
  113. package/dist/esm/card/ui/playButton/playButtonBackground.js +2 -1
  114. package/dist/esm/card/ui/playButton/playButtonWrapper.js +2 -1
  115. package/dist/esm/card/ui/playButton/styles.js +6 -0
  116. package/dist/esm/card/ui/progressBar/styledBar.js +4 -1
  117. package/dist/esm/card/ui/progressBar/styles.js +2 -0
  118. package/dist/esm/card/ui/tickBox/tickBoxWrapper.js +13 -3
  119. package/dist/esm/card/ui/titleBox/styles.js +23 -4
  120. package/dist/esm/card/ui/titleBox/titleBoxComponents.js +30 -17
  121. package/dist/esm/card/ui/unhandledErrorCard/index.js +22 -10
  122. package/dist/esm/card/ui/wrapper/imageContainer.js +1 -0
  123. package/dist/esm/card/ui/wrapper/styles.js +2 -1
  124. package/dist/esm/card/ui/wrapper/wrapper.js +4 -1
  125. package/dist/esm/card/v2/cardV2.js +1 -1
  126. package/dist/esm/card/v2/cardViewV2.js +1 -0
  127. package/dist/esm/card/v2/cardviews/cardViewWrapper.js +1 -0
  128. package/dist/esm/card/v2/cardviews/errorCardView.js +1 -0
  129. package/dist/esm/card/v2/cardviews/iconCardView.js +1 -0
  130. package/dist/esm/card/v2/cardviews/imageCardView.js +1 -0
  131. package/dist/esm/card/v2/cardviews/index.js +1 -0
  132. package/dist/esm/card/v2/cardviews/loadingCardView.js +1 -0
  133. package/dist/esm/card/v2/cardviews/processingCardView.js +1 -0
  134. package/dist/esm/card/v2/cardviews/videoCardView.js +1 -0
  135. package/dist/esm/card/v2/fileCard.js +1 -1
  136. package/dist/esm/card/v2/svgView/svgView.js +1 -0
  137. package/dist/esm/inline/loader.js +1 -1
  138. package/dist/esm/inline/mediaInlineAnalyticsErrorBoundary.js +11 -11
  139. package/dist/esm/utils/lightCards/errorIcon/index.js +10 -6
  140. package/dist/esm/utils/lightCards/errorIcon/styles.js +3 -0
  141. package/dist/esm/utils/lightCards/lightCardWrappers.js +9 -5
  142. package/dist/esm/utils/lightCards/styles.js +9 -2
  143. package/dist/esm/utils/ufoExperiences.js +1 -1
  144. package/dist/types/card/ui/iconWrapper/styles.d.ts +1 -1
  145. package/dist/types/card/ui/openMediaViewerButton/openMediaViewerButton.d.ts +0 -1
  146. package/dist/types/card/ui/titleBox/styles.d.ts +1 -1
  147. package/dist/types/utils/preventClickThrough.d.ts +1 -1
  148. package/dist/types/utils/viewportDetector.d.ts +1 -1
  149. package/dist/types-ts4.5/card/ui/iconWrapper/styles.d.ts +1 -1
  150. package/dist/types-ts4.5/card/ui/openMediaViewerButton/openMediaViewerButton.d.ts +0 -1
  151. package/dist/types-ts4.5/card/ui/titleBox/styles.d.ts +1 -1
  152. package/dist/types-ts4.5/utils/preventClickThrough.d.ts +1 -1
  153. package/dist/types-ts4.5/utils/viewportDetector.d.ts +1 -1
  154. package/example-helpers/DelayedRender.tsx +19 -19
  155. package/example-helpers/cardViewWrapper.tsx +20 -22
  156. package/example-helpers/cards.tsx +268 -331
  157. package/example-helpers/developmentUseMessage.tsx +8 -9
  158. package/example-helpers/index.tsx +100 -124
  159. package/example-helpers/selectableCard.tsx +32 -35
  160. package/example-helpers/ssrHelpers.tsx +19 -29
  161. package/example-helpers/styles.ts +97 -73
  162. package/example-helpers/svg-helpers/cardContainer.tsx +22 -21
  163. package/example-helpers/svg-helpers/controls.tsx +11 -11
  164. package/example-helpers/svg-helpers/dimensionPicker.tsx +85 -93
  165. package/example-helpers/svg-helpers/svgContainer.tsx +19 -18
  166. package/example-helpers/svg-helpers/toggle.tsx +28 -29
  167. package/example-helpers/svg-helpers/uploader.ts +33 -33
  168. package/package.json +121 -120
  169. 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
- title,
8
- children,
9
- }: {
10
- title: string;
11
- children: React.ReactNode;
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
- <div
21
- style={{
22
- display: 'flex',
23
- flexWrap: 'wrap',
24
- gap: '10px',
25
- marginBottom: '10px',
26
- }}
27
- >
28
- {children}
29
- </div>
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
- 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
- },
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
- <Box xcss={controlsBoxStyles}>{children}</Box>
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
- targetName,
21
- dimensionName,
22
- onChange,
23
- initialValue,
24
- initialUnit,
20
+ targetName,
21
+ dimensionName,
22
+ onChange,
23
+ initialValue,
24
+ initialUnit,
25
25
  }: {
26
- initialValue?: number;
27
- initialUnit?: '%' | 'px';
28
- targetName: string;
29
- dimensionName: string;
30
- onChange: OnValue;
26
+ initialValue?: number;
27
+ initialUnit?: '%' | 'px';
28
+ targetName: string;
29
+ dimensionName: string;
30
+ onChange: OnValue;
31
31
  }) => {
32
- const rangeId = `range-${targetName}-${dimensionName}`;
32
+ const rangeId = `range-${targetName}-${dimensionName}`;
33
33
 
34
- const [isPercent, setIsPercent] = useState(initialUnit === '%');
35
- const [rawValue, setRawValue] = useState<number | undefined>(initialValue);
36
- const rangeValues = useMemo(
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
- const value = useMemo(
42
- () => (isPercent && !!rawValue && rawValue > 100 ? 100 : rawValue),
43
- [isPercent, rawValue],
44
- );
45
- const unit = useMemo(() => (isPercent ? '%' : 'px'), [isPercent]);
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
- useEffect(() => {
48
- onChange(value === undefined ? value : `${value}${unit}`);
49
- }, [value, unit, onChange]);
44
+ useEffect(() => {
45
+ onChange(value === undefined ? value : `${value}${unit}`);
46
+ }, [value, unit, onChange]);
50
47
 
51
- return (
52
- <Box xcss={boxStyles}>
53
- <Label htmlFor={rangeId}>
54
- {targetName} {dimensionName}:{' '}
55
- {value ? `${value} ${isPercent ? '%' : 'px'}` : 'Not set'}
56
- </Label>
57
- <ToggleBox
58
- label="Use %"
59
- defaultChecked={initialUnit === '%'}
60
- onChange={setIsPercent}
61
- />
62
- <ToggleBox
63
- label="Unset"
64
- defaultChecked={!initialValue}
65
- onChange={(value) => {
66
- value ? setRawValue(undefined) : setRawValue(defaultVlue);
67
- }}
68
- />
69
- {rawValue && (
70
- <Range
71
- id={rangeId}
72
- step={1}
73
- min={rangeValues[0]}
74
- max={rangeValues[1]}
75
- onChange={setRawValue}
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
- onContainerWidth,
85
- onContainerHeight,
86
- onImageWidth,
87
- onImageHeight,
76
+ onContainerWidth,
77
+ onContainerHeight,
78
+ onImageWidth,
79
+ onImageHeight,
88
80
  }: {
89
- onContainerWidth: OnValue;
90
- onContainerHeight: OnValue;
91
- onImageWidth: OnValue;
92
- onImageHeight: OnValue;
81
+ onContainerWidth: OnValue;
82
+ onContainerHeight: OnValue;
83
+ onImageWidth: OnValue;
84
+ onImageHeight: OnValue;
93
85
  }) => {
94
- return (
95
- <Flex alignItems="stretch" direction="row" xcss={wrapperStyles}>
96
- <DimensionPicker
97
- targetName="Container"
98
- dimensionName="width"
99
- onChange={onContainerWidth}
100
- initialValue={defaultVlue}
101
- />
102
- <DimensionPicker
103
- targetName="Container"
104
- dimensionName="height"
105
- onChange={onContainerHeight}
106
- initialValue={defaultVlue}
107
- />
108
- <DimensionPicker
109
- targetName="Image"
110
- dimensionName="width"
111
- onChange={onImageWidth}
112
- initialValue={80}
113
- initialUnit="%"
114
- />
115
- <DimensionPicker
116
- targetName="Image"
117
- dimensionName="height"
118
- onChange={onImageHeight}
119
- initialValue={80}
120
- initialUnit="%"
121
- />
122
- </Flex>
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
- 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',
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
- children,
20
- width,
21
- height,
20
+ children,
21
+ width,
22
+ height,
22
23
  }: {
23
- children: React.ReactNode;
24
- width?: string;
25
- height?: string;
24
+ children: React.ReactNode;
25
+ width?: string;
26
+ height?: string;
26
27
  }) => {
27
- return (
28
- <Box xcss={containerStyles} style={{ width, height }}>
29
- {children}
30
- </Box>
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
- let result = '';
9
- const characters =
10
- 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789';
11
- const charactersLength = characters.length;
12
- let counter = 0;
13
- while (counter < length) {
14
- result += characters.charAt(Math.floor(Math.random() * charactersLength));
15
- counter += 1;
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
- label,
22
- onChange,
23
- ...props
20
+ label,
21
+ onChange,
22
+ ...props
24
23
  }: Omit<React.ComponentProps<typeof Toggle>, 'onChange'> & {
25
- label: string;
26
- onChange: (val: boolean) => void;
24
+ label: string;
25
+ onChange: (val: boolean) => void;
27
26
  }) => {
28
- const [id] = useState(makeid());
27
+ const [id] = useState(makeid());
29
28
 
30
- return (
31
- <Box>
32
- <Label htmlFor={id}>{label}</Label>
33
- <Toggle
34
- onChange={evt => {
35
- const { checked } = evt.target;
36
- onChange(checked);
37
- }}
38
- {...props}
39
- id={id}
40
- />
41
- </Box>
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
- const mediaClient = useMediaClient();
8
- const [identifier, setIdentifier] = useState<FileIdentifier>();
9
- const [status, setStatus] = useState<string>('');
7
+ const mediaClient = useMediaClient();
8
+ const [identifier, setIdentifier] = useState<FileIdentifier>();
9
+ const [status, setStatus] = useState<string>('');
10
10
 
11
- const uploadFn = async (event: SyntheticEvent<HTMLInputElement>) => {
12
- if (!event.currentTarget.files || !event.currentTarget.files.length) {
13
- return;
14
- }
15
- setStatus('Uploading');
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
- const file = event.currentTarget.files[0];
18
- const uplodableFile = {
19
- content: file,
20
- name: file.name,
21
- collection: collectionName,
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
- 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
- };
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
- return { status, identifier, uploadFn };
43
+ return { status, identifier, uploadFn };
44
44
  };