@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
@@ -2,14 +2,13 @@ import React from 'react';
2
2
  import InlineMessage from '@atlaskit/inline-message';
3
3
 
4
4
  const DevelopmentUseMessage: React.FC = () => (
5
- // eslint-disable-next-line @atlaskit/ui-styling-standard/enforce-style-prop -- Ignored via go/DSP-18766
6
- <div style={{ textAlign: 'center' }}>
7
- <InlineMessage appearance="warning" title="Development use only">
8
- The purpose of this example is to explore on edge cases for this
9
- component's feature. Some ways of using the component in here might not be
10
- the standard way. It is discouraged to use this code as a base for
11
- consumers.
12
- </InlineMessage>
13
- </div>
5
+ // eslint-disable-next-line @atlaskit/ui-styling-standard/enforce-style-prop -- Ignored via go/DSP-18766
6
+ <div style={{ textAlign: 'center' }}>
7
+ <InlineMessage appearance="warning" title="Development use only">
8
+ The purpose of this example is to explore on edge cases for this component's feature. Some
9
+ ways of using the component in here might not be the standard way. It is discouraged to use
10
+ this code as a base for consumers.
11
+ </InlineMessage>
12
+ </div>
14
13
  );
15
14
  export default DevelopmentUseMessage;
@@ -3,16 +3,14 @@
3
3
  import React, { type PropsWithChildren } from 'react';
4
4
  import { type FileItem, type Identifier } from '@atlaskit/media-client';
5
5
  import {
6
- createPollingMaxAttemptsError,
7
- createRateLimitedError,
8
- createStorybookMediaClientConfig,
9
- enableMediaUfoLogger,
10
- FeatureFlagsWrapper,
6
+ createPollingMaxAttemptsError,
7
+ createRateLimitedError,
8
+ createStorybookMediaClientConfig,
9
+ enableMediaUfoLogger,
10
+ FeatureFlagsWrapper,
11
11
  } from '@atlaskit/media-test-helpers';
12
12
  import CrossIcon from '@atlaskit/icon/glyph/cross';
13
- import FabricAnalyticsListeners, {
14
- type AnalyticsWebClient,
15
- } from '@atlaskit/analytics-listeners';
13
+ import FabricAnalyticsListeners, { type AnalyticsWebClient } from '@atlaskit/analytics-listeners';
16
14
  import { payloadPublisher } from '@atlassian/ufo';
17
15
 
18
16
  import AnnotateIcon from '@atlaskit/icon/glyph/media-services/annotate';
@@ -24,159 +22,137 @@ import DevelopmentUseMessage from './developmentUseMessage';
24
22
  const mediaClientConfig = createStorybookMediaClientConfig();
25
23
 
26
24
  export const clickHandler = (result: CardEvent) => {
27
- result.event.preventDefault();
28
- console.log('click', result.mediaItemDetails);
25
+ result.event.preventDefault();
26
+ console.log('click', result.mediaItemDetails);
29
27
  };
30
28
 
31
29
  export const mouseEnterHandler = (result: CardEvent) => {
32
- result.event.preventDefault();
33
- console.log('mouseEnter', result.mediaItemDetails);
30
+ result.event.preventDefault();
31
+ console.log('mouseEnter', result.mediaItemDetails);
34
32
  };
35
33
 
36
- export const createApiCards = (
37
- appearance: CardAppearance,
38
- identifier: Identifier,
39
- ) => {
40
- // API methods
41
- const apiCards = [
42
- {
43
- title: 'not selectable',
44
- content: (
45
- <Card
46
- mediaClientConfig={mediaClientConfig}
47
- appearance={appearance}
48
- identifier={identifier}
49
- onClick={clickHandler}
50
- onMouseEnter={mouseEnterHandler}
51
- />
52
- ),
53
- },
54
- ];
55
-
56
- const selectableCard = {
57
- title: 'selectable',
58
- content: (
59
- <SelectableCard
60
- mediaClientConfig={mediaClientConfig}
61
- identifier={identifier}
62
- />
63
- ),
64
- };
65
-
66
- if (appearance === 'image') {
67
- return [...apiCards, selectableCard];
68
- }
69
-
70
- return apiCards;
34
+ export const createApiCards = (appearance: CardAppearance, identifier: Identifier) => {
35
+ // API methods
36
+ const apiCards = [
37
+ {
38
+ title: 'not selectable',
39
+ content: (
40
+ <Card
41
+ mediaClientConfig={mediaClientConfig}
42
+ appearance={appearance}
43
+ identifier={identifier}
44
+ onClick={clickHandler}
45
+ onMouseEnter={mouseEnterHandler}
46
+ />
47
+ ),
48
+ },
49
+ ];
50
+
51
+ const selectableCard = {
52
+ title: 'selectable',
53
+ content: <SelectableCard mediaClientConfig={mediaClientConfig} identifier={identifier} />,
54
+ };
55
+
56
+ if (appearance === 'image') {
57
+ return [...apiCards, selectableCard];
58
+ }
59
+
60
+ return apiCards;
71
61
  };
72
62
 
73
63
  export const openAction = {
74
- label: 'Open',
75
- handler: () => {
76
- console.log('open');
77
- },
64
+ label: 'Open',
65
+ handler: () => {
66
+ console.log('open');
67
+ },
78
68
  };
79
69
  export const closeAction = {
80
- label: 'Close',
81
- handler: () => {
82
- console.log('close');
83
- },
70
+ label: 'Close',
71
+ handler: () => {
72
+ console.log('close');
73
+ },
84
74
  };
85
75
  export const deleteAction = {
86
- label: 'Delete',
87
- handler: () => {
88
- console.log('delete');
89
- },
90
- icon: <CrossIcon size="small" label="delete" />,
76
+ label: 'Delete',
77
+ handler: () => {
78
+ console.log('delete');
79
+ },
80
+ icon: <CrossIcon size="small" label="delete" />,
91
81
  };
92
82
 
93
83
  export const annotateCardAction: CardAction = {
94
- label: 'Annotate',
95
- handler: () => {
96
- console.log('annotate');
97
- },
98
- icon: <AnnotateIcon size="small" label="annotate" />,
84
+ label: 'Annotate',
85
+ handler: () => {
86
+ console.log('annotate');
87
+ },
88
+ icon: <AnnotateIcon size="small" label="annotate" />,
99
89
  };
100
90
 
101
- export const actions = [
102
- openAction,
103
- closeAction,
104
- annotateCardAction,
105
- deleteAction,
106
- ];
91
+ export const actions = [openAction, closeAction, annotateCardAction, deleteAction];
107
92
 
108
93
  export const anotherAction: CardAction = {
109
- label: 'Some other action',
110
- handler: (item?: FileItem) => {
111
- console.log('Some other action', item);
112
- },
94
+ label: 'Some other action',
95
+ handler: (item?: FileItem) => {
96
+ console.log('Some other action', item);
97
+ },
113
98
  };
114
99
 
115
100
  export const annotateAction: CardAction = {
116
- label: 'Annotate',
117
- handler: (item?: FileItem) => {
118
- console.log('annotate', item);
119
- },
101
+ label: 'Annotate',
102
+ handler: (item?: FileItem) => {
103
+ console.log('annotate', item);
104
+ },
120
105
  };
121
106
 
122
107
  export const cardsActions = [anotherAction, annotateAction];
123
108
  export const wrongMediaClientConfig = createStorybookMediaClientConfig({
124
- authType: 'client',
109
+ authType: 'client',
125
110
  });
126
111
  export const wrongCollection = 'adfasdf';
127
112
 
128
113
  export type MainWrapperProps = PropsWithChildren<{
129
- developmentOnly?: boolean;
130
- disableFeatureFlagWrapper?: boolean;
114
+ developmentOnly?: boolean;
115
+ disableFeatureFlagWrapper?: boolean;
131
116
  }>;
132
117
 
133
118
  export const MainWrapper = ({
134
- children,
135
- developmentOnly,
136
- disableFeatureFlagWrapper = false,
119
+ children,
120
+ developmentOnly,
121
+ disableFeatureFlagWrapper = false,
137
122
  }: MainWrapperProps) => {
138
- enableMediaUfoLogger(payloadPublisher);
139
- return (
140
- <>
141
- {developmentOnly && <DevelopmentUseMessage />}
142
- {!disableFeatureFlagWrapper ? (
143
- <FeatureFlagsWrapper>{children}</FeatureFlagsWrapper>
144
- ) : (
145
- <>{children}</>
146
- )}
147
- </>
148
- );
123
+ enableMediaUfoLogger(payloadPublisher);
124
+ return (
125
+ <>
126
+ {developmentOnly && <DevelopmentUseMessage />}
127
+ {!disableFeatureFlagWrapper ? (
128
+ <FeatureFlagsWrapper>{children}</FeatureFlagsWrapper>
129
+ ) : (
130
+ <>{children}</>
131
+ )}
132
+ </>
133
+ );
149
134
  };
150
135
 
151
- export const mediaCardErrorState = (
152
- error?: string,
153
- ): MediaCardError | undefined => {
154
- switch (error) {
155
- case 'rateLimitedError':
156
- return new MediaCardError('error-file-state', createRateLimitedError());
157
- case 'pollingMaxAttemptsError':
158
- return new MediaCardError(
159
- 'error-file-state',
160
- createPollingMaxAttemptsError(),
161
- );
162
- case 'uploadError':
163
- return new MediaCardError('upload');
164
- default:
165
- return undefined;
166
- }
136
+ export const mediaCardErrorState = (error?: string): MediaCardError | undefined => {
137
+ switch (error) {
138
+ case 'rateLimitedError':
139
+ return new MediaCardError('error-file-state', createRateLimitedError());
140
+ case 'pollingMaxAttemptsError':
141
+ return new MediaCardError('error-file-state', createPollingMaxAttemptsError());
142
+ case 'uploadError':
143
+ return new MediaCardError('upload');
144
+ default:
145
+ return undefined;
146
+ }
167
147
  };
168
148
 
169
149
  export const SSRAnalyticsWrapper = ({ children }: PropsWithChildren<{}>) => {
170
- const mockClient: AnalyticsWebClient = {
171
- sendUIEvent: (e) => console.debug('UI event', e),
172
- sendOperationalEvent: (e) => console.debug('Operational event', e),
173
- sendTrackEvent: (e) => console.debug('Track event', e),
174
- sendScreenEvent: (e) => console.debug('Screen event', e),
175
- };
176
-
177
- return (
178
- <FabricAnalyticsListeners client={mockClient}>
179
- {children}
180
- </FabricAnalyticsListeners>
181
- );
150
+ const mockClient: AnalyticsWebClient = {
151
+ sendUIEvent: (e) => console.debug('UI event', e),
152
+ sendOperationalEvent: (e) => console.debug('Operational event', e),
153
+ sendTrackEvent: (e) => console.debug('Track event', e),
154
+ sendScreenEvent: (e) => console.debug('Screen event', e),
155
+ };
156
+
157
+ return <FabricAnalyticsListeners client={mockClient}>{children}</FabricAnalyticsListeners>;
182
158
  };
@@ -5,45 +5,42 @@ import { type Identifier } from '@atlaskit/media-client';
5
5
  import { Card } from '../src';
6
6
 
7
7
  export interface SelectableCardProps {
8
- mediaClientConfig: MediaClientConfig;
9
- identifier: Identifier;
8
+ mediaClientConfig: MediaClientConfig;
9
+ identifier: Identifier;
10
10
  }
11
11
 
12
- export class SelectableCard extends Component<
13
- SelectableCardProps,
14
- { selected: boolean }
15
- > {
16
- constructor(props: SelectableCardProps) {
17
- super(props);
18
- this.state = { selected: false };
19
- }
12
+ export class SelectableCard extends Component<SelectableCardProps, { selected: boolean }> {
13
+ constructor(props: SelectableCardProps) {
14
+ super(props);
15
+ this.state = { selected: false };
16
+ }
20
17
 
21
- render() {
22
- const { mediaClientConfig, identifier } = this.props;
23
- const { selected } = this.state;
18
+ render() {
19
+ const { mediaClientConfig, identifier } = this.props;
20
+ const { selected } = this.state;
24
21
 
25
- if (!mediaClientConfig) {
26
- return null;
27
- }
22
+ if (!mediaClientConfig) {
23
+ return null;
24
+ }
28
25
 
29
- return (
30
- <Card
31
- mediaClientConfig={mediaClientConfig}
32
- identifier={identifier}
33
- appearance="image"
34
- selectable={true}
35
- selected={selected}
36
- onClick={this.onClick}
37
- actions={[{ label: 'add', handler: () => {} }]}
38
- />
39
- );
40
- }
26
+ return (
27
+ <Card
28
+ mediaClientConfig={mediaClientConfig}
29
+ identifier={identifier}
30
+ appearance="image"
31
+ selectable={true}
32
+ selected={selected}
33
+ onClick={this.onClick}
34
+ actions={[{ label: 'add', handler: () => {} }]}
35
+ />
36
+ );
37
+ }
41
38
 
42
- private onClick = (): void => {
43
- this.setState((prevState) => {
44
- return {
45
- selected: !prevState.selected,
46
- };
47
- });
48
- };
39
+ private onClick = (): void => {
40
+ this.setState((prevState) => {
41
+ return {
42
+ selected: !prevState.selected,
43
+ };
44
+ });
45
+ };
49
46
  }
@@ -4,40 +4,30 @@ import ReactDOMServer from 'react-dom/server';
4
4
  import { SSRAnalyticsWrapper } from '.';
5
5
 
6
6
  export interface SimulateSsrParams
7
- extends React.DetailedHTMLProps<
8
- React.HTMLAttributes<HTMLDivElement>,
9
- HTMLDivElement
10
- > {
11
- serverPage: React.ReactNode;
12
- hydratePage?: React.ReactNode;
7
+ extends React.DetailedHTMLProps<React.HTMLAttributes<HTMLDivElement>, HTMLDivElement> {
8
+ serverPage: React.ReactNode;
9
+ hydratePage?: React.ReactNode;
13
10
  }
14
11
 
15
12
  const randomStr = () => Math.random().toString(36).substr(2, 9);
16
13
  const generateSsrPageId = () => `media-ssr-page-${randomStr()}-${randomStr()}`;
17
14
 
18
- export const SimulateSsr = ({
19
- serverPage,
20
- hydratePage,
21
- ...divProps
22
- }: SimulateSsrParams) => {
23
- const id = useMemo(generateSsrPageId, []);
15
+ export const SimulateSsr = ({ serverPage, hydratePage, ...divProps }: SimulateSsrParams) => {
16
+ const id = useMemo(generateSsrPageId, []);
24
17
 
25
- useEffect(() => {
26
- const txt = ReactDOMServer.renderToString(
27
- <SSRAnalyticsWrapper>{serverPage}</SSRAnalyticsWrapper>,
28
- );
29
- const elem = document.querySelector(`#${id}`);
30
- if (elem) {
31
- elem.innerHTML = txt;
32
- if (hydratePage) {
33
- ReactDOM.hydrate(
34
- <SSRAnalyticsWrapper>{hydratePage}</SSRAnalyticsWrapper>,
35
- elem,
36
- );
37
- }
38
- }
39
- }, [id, hydratePage, serverPage]);
18
+ useEffect(() => {
19
+ const txt = ReactDOMServer.renderToString(
20
+ <SSRAnalyticsWrapper>{serverPage}</SSRAnalyticsWrapper>,
21
+ );
22
+ const elem = document.querySelector(`#${id}`);
23
+ if (elem) {
24
+ elem.innerHTML = txt;
25
+ if (hydratePage) {
26
+ ReactDOM.hydrate(<SSRAnalyticsWrapper>{hydratePage}</SSRAnalyticsWrapper>, elem);
27
+ }
28
+ }
29
+ }, [id, hydratePage, serverPage]);
40
30
 
41
- // eslint-disable-next-line @atlaskit/design-system/prefer-primitives
42
- return <div id={id} {...divProps}></div>;
31
+ // eslint-disable-next-line @atlaskit/design-system/prefer-primitives
32
+ return <div id={id} {...divProps}></div>;
43
33
  };
@@ -1,122 +1,146 @@
1
1
  import { token } from '@atlaskit/tokens';
2
+ // eslint-disable-next-line @atlaskit/ui-styling-standard/use-compiled -- Ignored via go/DSP-18766
2
3
  import { css } from '@emotion/react';
3
4
 
5
+ // eslint-disable-next-line @atlaskit/ui-styling-standard/no-exported-styles, @atlaskit/design-system/no-exported-css -- Ignored via go/DSP-18766
4
6
  export const editableCardOptionsStyles = css({
5
- padding: token('space.250', '20px'),
6
- borderBottom: `1px solid ${token('color.border', '#ccc')}`,
7
- maxWidth: '700px',
7
+ padding: token('space.250', '20px'),
8
+ borderBottom: `1px solid ${token('color.border', '#ccc')}`,
9
+ maxWidth: '700px',
8
10
  });
9
11
 
12
+ // eslint-disable-next-line @atlaskit/ui-styling-standard/no-exported-styles, @atlaskit/design-system/no-exported-css -- Ignored via go/DSP-18766
10
13
  export const sliderWrapperStyles = css({
11
- display: 'flex',
12
- width: '50%',
13
- '> *': {
14
- flex: 1,
15
- margin: token('space.100', '8px'),
16
- },
14
+ display: 'flex',
15
+ width: '50%',
16
+ // eslint-disable-next-line @atlaskit/ui-styling-standard/no-nested-selectors -- Ignored via go/DSP-18766
17
+ '> *': {
18
+ flex: 1,
19
+ margin: token('space.100', '8px'),
20
+ },
17
21
  });
18
22
 
23
+ // eslint-disable-next-line @atlaskit/ui-styling-standard/no-exported-styles, @atlaskit/design-system/no-exported-css -- Ignored via go/DSP-18766
19
24
  export const editableCardContentStyles = css({
20
- padding: token('space.250', '20px'),
21
- border: '2px dashed',
22
- margin: `${token('space.0', '0px')} ${token('space.150', '12px')} ${token(
23
- 'space.600',
24
- '48px',
25
- )} ${token('space.150', '12px')}`,
26
- overflow: 'hidden',
27
- background: token('color.background.accent.orange.subtlest', 'antiquewhite'),
28
- boxSizing: 'border-box',
25
+ padding: token('space.250', '20px'),
26
+ border: '2px dashed',
27
+ margin: `${token('space.0', '0px')} ${token('space.150', '12px')} ${token(
28
+ 'space.600',
29
+ '48px',
30
+ )} ${token('space.150', '12px')}`,
31
+ overflow: 'hidden',
32
+ background: token('color.background.accent.orange.subtlest', 'antiquewhite'),
33
+ boxSizing: 'border-box',
29
34
  });
30
35
 
36
+ // eslint-disable-next-line @atlaskit/ui-styling-standard/no-exported-styles, @atlaskit/design-system/no-exported-css -- Ignored via go/DSP-18766
31
37
  export const optionsWrapperStyles = css({
32
- display: 'flex',
33
- '> *': {
34
- flex: 1,
35
- margin: token('space.100', '8px'),
36
- },
38
+ display: 'flex',
39
+ // eslint-disable-next-line @atlaskit/ui-styling-standard/no-nested-selectors -- Ignored via go/DSP-18766
40
+ '> *': {
41
+ flex: 1,
42
+ margin: token('space.100', '8px'),
43
+ },
37
44
  });
38
45
 
46
+ // eslint-disable-next-line @atlaskit/ui-styling-standard/no-exported-styles, @atlaskit/design-system/no-exported-css -- Ignored via go/DSP-18766
39
47
  export const cardDimensionsWrapperStyles = css({
40
- margin: `${token('space.100', '8px')} ${token('space.100', '8px')} ${token(
41
- 'space.250',
42
- '20px',
43
- )} ${token('space.100', '8px')}`,
44
- display: 'flex',
45
- '> div': {
46
- border: `1px solid ${token('color.border.bold', 'black')}`,
47
- margin: token('space.075', '6px'),
48
- padding: token('space.075', '6px'),
49
- borderRadius: '3px',
50
- },
48
+ margin: `${token('space.100', '8px')} ${token('space.100', '8px')} ${token(
49
+ 'space.250',
50
+ '20px',
51
+ )} ${token('space.100', '8px')}`,
52
+ display: 'flex',
53
+ // eslint-disable-next-line @atlaskit/ui-styling-standard/no-nested-selectors -- Ignored via go/DSP-18766
54
+ '> div': {
55
+ border: `1px solid ${token('color.border.bold', 'black')}`,
56
+ margin: token('space.075', '6px'),
57
+ padding: token('space.075', '6px'),
58
+ borderRadius: '3px',
59
+ },
51
60
  });
52
61
 
62
+ // eslint-disable-next-line @atlaskit/ui-styling-standard/no-exported-styles, @atlaskit/design-system/no-exported-css -- Ignored via go/DSP-18766
53
63
  export const flexWrapperStyles = css({
54
- display: 'flex',
64
+ display: 'flex',
55
65
  });
66
+ // eslint-disable-next-line @atlaskit/ui-styling-standard/no-exported-styles, @atlaskit/design-system/no-exported-css -- Ignored via go/DSP-18766
56
67
  export const cardPreviewWrapperStyles = css({
57
- flex: 1,
68
+ flex: 1,
58
69
  });
59
70
 
71
+ // eslint-disable-next-line @atlaskit/ui-styling-standard/no-exported-styles, @atlaskit/design-system/no-exported-css -- Ignored via go/DSP-18766
60
72
  export const cardWrapperStyles = css({
61
- border: `1px solid ${token('color.border.bold', 'black')}`,
62
- padding: token('space.150', '12px'),
63
- margin: token('space.075', '6px'),
64
- flexDirection: 'column',
65
- width: '310px',
66
- height: '280px',
67
- overflow: 'auto',
68
- display: 'inline-block',
73
+ border: `1px solid ${token('color.border.bold', 'black')}`,
74
+ padding: token('space.150', '12px'),
75
+ margin: token('space.075', '6px'),
76
+ flexDirection: 'column',
77
+ width: '310px',
78
+ height: '280px',
79
+ overflow: 'auto',
80
+ display: 'inline-block',
69
81
  });
70
82
 
83
+ // eslint-disable-next-line @atlaskit/ui-styling-standard/no-exported-styles, @atlaskit/design-system/no-exported-css -- Ignored via go/DSP-18766
71
84
  export const cardFlowHeaderStyles = css({
72
- margin: `${token('space.250', '20px')} auto`,
73
- padding: `${token('space.150', '12px')} ${token('space.0', '0px')}`,
85
+ margin: `${token('space.250', '20px')} auto`,
86
+ padding: `${token('space.150', '12px')} ${token('space.0', '0px')}`,
74
87
  });
75
88
 
89
+ // eslint-disable-next-line @atlaskit/ui-styling-standard/no-exported-styles, @atlaskit/design-system/no-exported-css -- Ignored via go/DSP-18766
76
90
  export const externalIdentifierWrapperStyles = css({
77
- display: 'flex',
78
- justifyContent: 'space-around',
79
- margin: `${token('space.0', '0px')} auto`,
80
- h2: {
81
- marginBottom: token('space.150', '12px'),
82
- },
91
+ display: 'flex',
92
+ justifyContent: 'space-around',
93
+ margin: `${token('space.0', '0px')} auto`,
94
+ // eslint-disable-next-line @atlaskit/ui-styling-standard/no-nested-selectors -- Ignored via go/DSP-18766
95
+ h2: {
96
+ marginBottom: token('space.150', '12px'),
97
+ },
83
98
  });
84
99
 
100
+ // eslint-disable-next-line @atlaskit/ui-styling-standard/no-exported-styles, @atlaskit/design-system/no-exported-css -- Ignored via go/DSP-18766
85
101
  export const unhandledErrorCardWrapperStyles = css({
86
- padding: token('space.250', '20px'),
87
- '> div:first-child': {
88
- display: 'flex',
89
- marginBottom: token('space.250', '20px'),
90
- },
91
- label: {
92
- marginRight: token('space.250', '20px'),
93
- },
102
+ padding: token('space.250', '20px'),
103
+ // eslint-disable-next-line @atlaskit/ui-styling-standard/no-nested-selectors, @atlaskit/ui-styling-standard/no-unsafe-selectors -- Ignored via go/DSP-18766
104
+ '> div:first-child': {
105
+ display: 'flex',
106
+ marginBottom: token('space.250', '20px'),
107
+ },
108
+ // eslint-disable-next-line @atlaskit/ui-styling-standard/no-nested-selectors -- Ignored via go/DSP-18766
109
+ label: {
110
+ marginRight: token('space.250', '20px'),
111
+ },
94
112
  });
95
113
 
114
+ // eslint-disable-next-line @atlaskit/ui-styling-standard/no-exported-styles, @atlaskit/design-system/no-exported-css -- Ignored via go/DSP-18766
96
115
  export const inlineCardVideoWrapperItemStyles = css({
97
- padding: token('space.150', '12px'),
98
- border: `1px solid ${token('color.border.bold', 'black')}`,
99
- margin: token('space.150', '12px'),
116
+ padding: token('space.150', '12px'),
117
+ border: `1px solid ${token('color.border.bold', 'black')}`,
118
+ margin: token('space.150', '12px'),
100
119
  });
101
120
 
121
+ // eslint-disable-next-line @atlaskit/ui-styling-standard/no-exported-styles, @atlaskit/design-system/no-exported-css -- Ignored via go/DSP-18766
102
122
  export const mediaViewerExampleColumnStyles = css({
103
- flex: 1,
123
+ flex: 1,
104
124
  });
105
125
 
126
+ // eslint-disable-next-line @atlaskit/ui-styling-standard/no-exported-styles, @atlaskit/design-system/no-exported-css -- Ignored via go/DSP-18766
106
127
  export const mediaViewerExampleWrapperStyles = css({
107
- display: 'flex',
128
+ display: 'flex',
108
129
  });
109
130
 
131
+ // eslint-disable-next-line @atlaskit/ui-styling-standard/no-exported-styles, @atlaskit/design-system/no-exported-css -- Ignored via go/DSP-18766
110
132
  export const mediaInlineWrapperStyles = css({
111
- display: 'flex',
112
- alignItems: 'center',
113
- flexDirection: 'column',
114
- margin: token('space.1000', '80px'),
133
+ display: 'flex',
134
+ alignItems: 'center',
135
+ flexDirection: 'column',
136
+ margin: token('space.1000', '80px'),
115
137
  });
116
138
 
139
+ // eslint-disable-next-line @atlaskit/ui-styling-standard/no-exported-styles, @atlaskit/design-system/no-exported-css -- Ignored via go/DSP-18766
117
140
  export const mediaInlineTableStyles = css({
118
- width: '800px',
119
- 'tr, td': {
120
- border: `1px solid ${token('color.border', '#ddd')}`,
121
- },
141
+ width: '800px',
142
+ // eslint-disable-next-line @atlaskit/ui-styling-standard/no-nested-selectors -- Ignored via go/DSP-18766
143
+ 'tr, td': {
144
+ border: `1px solid ${token('color.border', '#ddd')}`,
145
+ },
122
146
  });