@atlaskit/media-card 77.11.2 → 77.12.0

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 (289) hide show
  1. package/CHANGELOG.md +2815 -2809
  2. package/dist/cjs/card/card.js +1 -1
  3. package/dist/cjs/card/cardView.js +6 -8
  4. package/dist/cjs/card/inlinePlayerWrapper.js +3 -1
  5. package/dist/cjs/card/media-card-analytics-error-boundary.js +1 -1
  6. package/dist/cjs/card/ui/actionsBar/actionsBarWrapper.js +3 -1
  7. package/dist/cjs/card/ui/actionsBar/cardActions/cardActionButton.js +3 -1
  8. package/dist/cjs/card/ui/actionsBar/cardActions/cardActionIconButton.js +3 -1
  9. package/dist/cjs/card/ui/actionsBar/cardActions/cardActionsDropdownMenu.js +3 -1
  10. package/dist/cjs/card/ui/blanket/blanket.js +3 -1
  11. package/dist/cjs/card/ui/playButton/playButtonBackground.js +1 -0
  12. package/dist/cjs/card/ui/playButton/playButtonWrapper.js +7 -4
  13. package/dist/cjs/card/ui/styles.js +1 -12
  14. package/dist/cjs/card/ui/tickBox/tickBoxWrapper.js +3 -1
  15. package/dist/cjs/card/ui/wrapper/imageContainer.js +52 -0
  16. package/dist/cjs/card/ui/wrapper/index.js +8 -1
  17. package/dist/cjs/card/ui/wrapper/wrapper.js +3 -1
  18. package/dist/cjs/card/v2/cardV2.js +1 -1
  19. package/dist/cjs/card/v2/cardViewV2.js +15 -17
  20. package/dist/cjs/card/v2/cardviews/cardViewWrapper.js +8 -9
  21. package/dist/cjs/card/v2/cardviews/index.js +4 -2
  22. package/dist/cjs/card/v2/fileCard.js +71 -21
  23. package/dist/cjs/card/v2/svgView/helpers.js +16 -0
  24. package/dist/cjs/card/v2/svgView/index.js +12 -0
  25. package/dist/cjs/card/v2/svgView/svgView.js +134 -0
  26. package/dist/cjs/inline/loader.js +1 -1
  27. package/dist/cjs/inline/mediaInlineAnalyticsErrorBoundary.js +11 -7
  28. package/dist/cjs/utils/ufoExperiences.js +1 -1
  29. package/dist/es2019/card/card.js +1 -1
  30. package/dist/es2019/card/cardView.js +8 -10
  31. package/dist/es2019/card/inlinePlayerWrapper.js +3 -1
  32. package/dist/es2019/card/media-card-analytics-error-boundary.js +1 -1
  33. package/dist/es2019/card/ui/actionsBar/actionsBarWrapper.js +3 -1
  34. package/dist/es2019/card/ui/actionsBar/cardActions/cardActionButton.js +3 -1
  35. package/dist/es2019/card/ui/actionsBar/cardActions/cardActionIconButton.js +3 -1
  36. package/dist/es2019/card/ui/actionsBar/cardActions/cardActionsDropdownMenu.js +3 -1
  37. package/dist/es2019/card/ui/blanket/blanket.js +3 -1
  38. package/dist/es2019/card/ui/playButton/playButtonBackground.js +1 -0
  39. package/dist/es2019/card/ui/playButton/playButtonWrapper.js +7 -4
  40. package/dist/es2019/card/ui/styles.js +0 -11
  41. package/dist/es2019/card/ui/tickBox/tickBoxWrapper.js +3 -1
  42. package/dist/es2019/card/ui/wrapper/imageContainer.js +44 -0
  43. package/dist/es2019/card/ui/wrapper/index.js +2 -1
  44. package/dist/es2019/card/ui/wrapper/wrapper.js +3 -1
  45. package/dist/es2019/card/v2/cardV2.js +1 -1
  46. package/dist/es2019/card/v2/cardViewV2.js +16 -18
  47. package/dist/es2019/card/v2/cardviews/cardViewWrapper.js +8 -9
  48. package/dist/es2019/card/v2/cardviews/index.js +4 -2
  49. package/dist/es2019/card/v2/fileCard.js +57 -9
  50. package/dist/es2019/card/v2/svgView/helpers.js +12 -0
  51. package/dist/es2019/card/v2/svgView/index.js +1 -0
  52. package/dist/es2019/card/v2/svgView/svgView.js +113 -0
  53. package/dist/es2019/inline/loader.js +1 -1
  54. package/dist/es2019/inline/mediaInlineAnalyticsErrorBoundary.js +11 -7
  55. package/dist/es2019/utils/ufoExperiences.js +1 -1
  56. package/dist/esm/card/card.js +1 -1
  57. package/dist/esm/card/cardView.js +8 -10
  58. package/dist/esm/card/inlinePlayerWrapper.js +3 -1
  59. package/dist/esm/card/media-card-analytics-error-boundary.js +1 -1
  60. package/dist/esm/card/ui/actionsBar/actionsBarWrapper.js +3 -1
  61. package/dist/esm/card/ui/actionsBar/cardActions/cardActionButton.js +3 -1
  62. package/dist/esm/card/ui/actionsBar/cardActions/cardActionIconButton.js +3 -1
  63. package/dist/esm/card/ui/actionsBar/cardActions/cardActionsDropdownMenu.js +3 -1
  64. package/dist/esm/card/ui/blanket/blanket.js +3 -1
  65. package/dist/esm/card/ui/playButton/playButtonBackground.js +1 -0
  66. package/dist/esm/card/ui/playButton/playButtonWrapper.js +7 -4
  67. package/dist/esm/card/ui/styles.js +0 -11
  68. package/dist/esm/card/ui/tickBox/tickBoxWrapper.js +3 -1
  69. package/dist/esm/card/ui/wrapper/imageContainer.js +45 -0
  70. package/dist/esm/card/ui/wrapper/index.js +2 -1
  71. package/dist/esm/card/ui/wrapper/wrapper.js +3 -1
  72. package/dist/esm/card/v2/cardV2.js +1 -1
  73. package/dist/esm/card/v2/cardViewV2.js +16 -18
  74. package/dist/esm/card/v2/cardviews/cardViewWrapper.js +9 -10
  75. package/dist/esm/card/v2/cardviews/index.js +4 -2
  76. package/dist/esm/card/v2/fileCard.js +72 -21
  77. package/dist/esm/card/v2/svgView/helpers.js +10 -0
  78. package/dist/esm/card/v2/svgView/index.js +1 -0
  79. package/dist/esm/card/v2/svgView/svgView.js +123 -0
  80. package/dist/esm/inline/loader.js +1 -1
  81. package/dist/esm/inline/mediaInlineAnalyticsErrorBoundary.js +11 -7
  82. package/dist/esm/utils/ufoExperiences.js +1 -1
  83. package/dist/types/card/actions.d.ts +2 -2
  84. package/dist/types/card/card.d.ts +5 -5
  85. package/dist/types/card/cardAnalytics.d.ts +4 -4
  86. package/dist/types/card/cardState.d.ts +2 -2
  87. package/dist/types/card/cardSwitcher.d.ts +1 -1
  88. package/dist/types/card/cardView.d.ts +8 -8
  89. package/dist/types/card/getCardPreview/cache.d.ts +3 -3
  90. package/dist/types/card/getCardPreview/filePreviewStatus.d.ts +2 -2
  91. package/dist/types/card/getCardPreview/helpers.d.ts +3 -3
  92. package/dist/types/card/getCardPreview/index.d.ts +5 -5
  93. package/dist/types/card/getCardStatus.d.ts +2 -2
  94. package/dist/types/card/inlinePlayer.d.ts +4 -4
  95. package/dist/types/card/inlinePlayerWrapper.d.ts +1 -1
  96. package/dist/types/card/inlinePlayerWrapperStyles.d.ts +1 -1
  97. package/dist/types/card/media-card-analytics-error-boundary.d.ts +4 -4
  98. package/dist/types/card/types.d.ts +4 -3
  99. package/dist/types/card/ui/actionsBar/actionsBar.d.ts +1 -1
  100. package/dist/types/card/ui/actionsBar/actionsBarWrapper.d.ts +1 -1
  101. package/dist/types/card/ui/actionsBar/cardActions/cardActionButton.d.ts +1 -1
  102. package/dist/types/card/ui/actionsBar/cardActions/cardActionIconButton.d.ts +2 -2
  103. package/dist/types/card/ui/actionsBar/cardActions/cardActionsDropdownMenu.d.ts +2 -2
  104. package/dist/types/card/ui/actionsBar/cardActions/cardActionsView.d.ts +2 -2
  105. package/dist/types/card/ui/actionsBar/cardActions/styles.d.ts +3 -2
  106. package/dist/types/card/ui/actionsBar/types.d.ts +2 -2
  107. package/dist/types/card/ui/iconMessage/iconMessageWrapper.d.ts +1 -1
  108. package/dist/types/card/ui/iconMessage/index.d.ts +1 -1
  109. package/dist/types/card/ui/iconMessage/types.d.ts +2 -2
  110. package/dist/types/card/ui/iconWrapper/iconWrapper.d.ts +1 -1
  111. package/dist/types/card/ui/iconWrapper/styles.d.ts +2 -2
  112. package/dist/types/card/ui/iconWrapper/types.d.ts +1 -1
  113. package/dist/types/card/ui/imageRenderer/imageRenderer.d.ts +2 -2
  114. package/dist/types/card/ui/imageRenderer/resizeModeToMediaImageProps.d.ts +1 -1
  115. package/dist/types/card/ui/openMediaViewerButton/openMediaViewerButton.d.ts +1 -1
  116. package/dist/types/card/ui/progressBar/styledBar.d.ts +1 -1
  117. package/dist/types/card/ui/progressBar/styles.d.ts +1 -1
  118. package/dist/types/card/ui/progressBar/types.d.ts +1 -1
  119. package/dist/types/card/ui/styles.d.ts +2 -3
  120. package/dist/types/card/ui/tickBox/tickBox.d.ts +1 -1
  121. package/dist/types/card/ui/tickBox/tickBoxWrapper.d.ts +1 -1
  122. package/dist/types/card/ui/titleBox/failedTitleBox.d.ts +1 -1
  123. package/dist/types/card/ui/titleBox/styles.d.ts +1 -1
  124. package/dist/types/card/ui/titleBox/titleBox.d.ts +1 -1
  125. package/dist/types/card/ui/titleBox/titleBoxComponents.d.ts +1 -1
  126. package/dist/types/card/ui/titleBox/types.d.ts +3 -3
  127. package/dist/types/card/ui/unhandledErrorCard/index.d.ts +1 -1
  128. package/dist/types/card/ui/unhandledErrorCard/types.d.ts +1 -1
  129. package/dist/types/card/ui/wrapper/imageContainer.d.ts +15 -0
  130. package/dist/types/card/ui/wrapper/index.d.ts +1 -0
  131. package/dist/types/card/ui/wrapper/styles.d.ts +1 -1
  132. package/dist/types/card/ui/wrapper/types.d.ts +6 -5
  133. package/dist/types/card/ui/wrapper/wrapper.d.ts +1 -1
  134. package/dist/types/card/useBreakpoint.d.ts +2 -2
  135. package/dist/types/card/v2/cardV2.d.ts +3 -3
  136. package/dist/types/card/v2/cardV2Loader.d.ts +1 -1
  137. package/dist/types/card/v2/cardViewV2.d.ts +10 -9
  138. package/dist/types/card/v2/cardWithMediaClientV2.d.ts +1 -1
  139. package/dist/types/card/v2/cardviews/cardViewWrapper.d.ts +8 -7
  140. package/dist/types/card/v2/cardviews/errorCardView.d.ts +4 -4
  141. package/dist/types/card/v2/cardviews/iconCardView.d.ts +3 -3
  142. package/dist/types/card/v2/cardviews/imageCardView.d.ts +4 -4
  143. package/dist/types/card/v2/cardviews/index.d.ts +9 -8
  144. package/dist/types/card/v2/cardviews/loadingCardView.d.ts +3 -3
  145. package/dist/types/card/v2/cardviews/processingCardView.d.ts +2 -2
  146. package/dist/types/card/v2/cardviews/videoCardView.d.ts +4 -4
  147. package/dist/types/card/v2/externalImageCard.d.ts +3 -3
  148. package/dist/types/card/v2/fileCard.d.ts +5 -5
  149. package/dist/types/card/v2/inlinePlayerV2.d.ts +4 -4
  150. package/dist/types/card/v2/svgView/helpers.d.ts +3 -0
  151. package/dist/types/card/v2/svgView/index.d.ts +1 -0
  152. package/dist/types/card/v2/svgView/svgView.d.ts +31 -0
  153. package/dist/types/errors.d.ts +2 -2
  154. package/dist/types/inline/loader.d.ts +3 -3
  155. package/dist/types/inline/mediaInlineAnalyticsErrorBoundary.d.ts +3 -3
  156. package/dist/types/inline/mediaInlineCard.d.ts +4 -4
  157. package/dist/types/inline/mediaInlineCardAnalytics.d.ts +2 -2
  158. package/dist/types/types.d.ts +6 -6
  159. package/dist/types/utils/analytics/analytics.d.ts +5 -5
  160. package/dist/types/utils/cardDimensions.d.ts +1 -1
  161. package/dist/types/utils/dimensionComparer.d.ts +1 -1
  162. package/dist/types/utils/getDataURIDimension.d.ts +3 -3
  163. package/dist/types/utils/getMediaCardCursor.d.ts +1 -1
  164. package/dist/types/utils/globalScope/getSSRData.d.ts +1 -1
  165. package/dist/types/utils/globalScope/globalScope.d.ts +5 -5
  166. package/dist/types/utils/globalScope/types.d.ts +2 -2
  167. package/dist/types/utils/lightCards/cardError.d.ts +1 -1
  168. package/dist/types/utils/lightCards/cardLoading.d.ts +1 -1
  169. package/dist/types/utils/lightCards/getDimensionsWithDefault.d.ts +1 -1
  170. package/dist/types/utils/lightCards/lightCardWrappers.d.ts +1 -1
  171. package/dist/types/utils/lightCards/styles.d.ts +1 -1
  172. package/dist/types/utils/lightCards/types.d.ts +2 -2
  173. package/dist/types/utils/metadata.d.ts +1 -1
  174. package/dist/types/utils/objectURLCache.d.ts +1 -1
  175. package/dist/types/utils/preventClickThrough.d.ts +1 -1
  176. package/dist/types/utils/ufoExperiences.d.ts +4 -4
  177. package/dist/types/utils/useCurrentValueRef.d.ts +1 -1
  178. package/dist/types/utils/videoIsPlayable.d.ts +1 -1
  179. package/dist/types/utils/viewportDetector.d.ts +1 -1
  180. package/dist/types-ts4.5/card/actions.d.ts +2 -2
  181. package/dist/types-ts4.5/card/card.d.ts +5 -5
  182. package/dist/types-ts4.5/card/cardAnalytics.d.ts +4 -4
  183. package/dist/types-ts4.5/card/cardState.d.ts +2 -2
  184. package/dist/types-ts4.5/card/cardSwitcher.d.ts +1 -1
  185. package/dist/types-ts4.5/card/cardView.d.ts +8 -8
  186. package/dist/types-ts4.5/card/getCardPreview/cache.d.ts +3 -3
  187. package/dist/types-ts4.5/card/getCardPreview/filePreviewStatus.d.ts +2 -2
  188. package/dist/types-ts4.5/card/getCardPreview/helpers.d.ts +3 -3
  189. package/dist/types-ts4.5/card/getCardPreview/index.d.ts +5 -5
  190. package/dist/types-ts4.5/card/getCardStatus.d.ts +2 -2
  191. package/dist/types-ts4.5/card/inlinePlayer.d.ts +4 -4
  192. package/dist/types-ts4.5/card/inlinePlayerWrapper.d.ts +1 -1
  193. package/dist/types-ts4.5/card/inlinePlayerWrapperStyles.d.ts +1 -1
  194. package/dist/types-ts4.5/card/media-card-analytics-error-boundary.d.ts +4 -4
  195. package/dist/types-ts4.5/card/types.d.ts +4 -3
  196. package/dist/types-ts4.5/card/ui/actionsBar/actionsBar.d.ts +1 -1
  197. package/dist/types-ts4.5/card/ui/actionsBar/actionsBarWrapper.d.ts +1 -1
  198. package/dist/types-ts4.5/card/ui/actionsBar/cardActions/cardActionButton.d.ts +1 -1
  199. package/dist/types-ts4.5/card/ui/actionsBar/cardActions/cardActionIconButton.d.ts +2 -2
  200. package/dist/types-ts4.5/card/ui/actionsBar/cardActions/cardActionsDropdownMenu.d.ts +2 -2
  201. package/dist/types-ts4.5/card/ui/actionsBar/cardActions/cardActionsView.d.ts +2 -2
  202. package/dist/types-ts4.5/card/ui/actionsBar/cardActions/styles.d.ts +3 -2
  203. package/dist/types-ts4.5/card/ui/actionsBar/types.d.ts +2 -2
  204. package/dist/types-ts4.5/card/ui/iconMessage/iconMessageWrapper.d.ts +1 -1
  205. package/dist/types-ts4.5/card/ui/iconMessage/index.d.ts +1 -1
  206. package/dist/types-ts4.5/card/ui/iconMessage/types.d.ts +2 -2
  207. package/dist/types-ts4.5/card/ui/iconWrapper/iconWrapper.d.ts +1 -1
  208. package/dist/types-ts4.5/card/ui/iconWrapper/styles.d.ts +2 -2
  209. package/dist/types-ts4.5/card/ui/iconWrapper/types.d.ts +1 -1
  210. package/dist/types-ts4.5/card/ui/imageRenderer/imageRenderer.d.ts +2 -2
  211. package/dist/types-ts4.5/card/ui/imageRenderer/resizeModeToMediaImageProps.d.ts +1 -1
  212. package/dist/types-ts4.5/card/ui/openMediaViewerButton/openMediaViewerButton.d.ts +1 -1
  213. package/dist/types-ts4.5/card/ui/progressBar/styledBar.d.ts +1 -1
  214. package/dist/types-ts4.5/card/ui/progressBar/styles.d.ts +1 -1
  215. package/dist/types-ts4.5/card/ui/progressBar/types.d.ts +1 -1
  216. package/dist/types-ts4.5/card/ui/styles.d.ts +2 -3
  217. package/dist/types-ts4.5/card/ui/tickBox/tickBox.d.ts +1 -1
  218. package/dist/types-ts4.5/card/ui/tickBox/tickBoxWrapper.d.ts +1 -1
  219. package/dist/types-ts4.5/card/ui/titleBox/failedTitleBox.d.ts +1 -1
  220. package/dist/types-ts4.5/card/ui/titleBox/styles.d.ts +1 -1
  221. package/dist/types-ts4.5/card/ui/titleBox/titleBox.d.ts +1 -1
  222. package/dist/types-ts4.5/card/ui/titleBox/titleBoxComponents.d.ts +1 -1
  223. package/dist/types-ts4.5/card/ui/titleBox/types.d.ts +3 -3
  224. package/dist/types-ts4.5/card/ui/unhandledErrorCard/index.d.ts +1 -1
  225. package/dist/types-ts4.5/card/ui/unhandledErrorCard/types.d.ts +1 -1
  226. package/dist/types-ts4.5/card/ui/wrapper/imageContainer.d.ts +15 -0
  227. package/dist/types-ts4.5/card/ui/wrapper/index.d.ts +1 -0
  228. package/dist/types-ts4.5/card/ui/wrapper/styles.d.ts +1 -1
  229. package/dist/types-ts4.5/card/ui/wrapper/types.d.ts +6 -5
  230. package/dist/types-ts4.5/card/ui/wrapper/wrapper.d.ts +1 -1
  231. package/dist/types-ts4.5/card/useBreakpoint.d.ts +2 -2
  232. package/dist/types-ts4.5/card/v2/cardV2.d.ts +3 -3
  233. package/dist/types-ts4.5/card/v2/cardV2Loader.d.ts +1 -1
  234. package/dist/types-ts4.5/card/v2/cardViewV2.d.ts +10 -9
  235. package/dist/types-ts4.5/card/v2/cardWithMediaClientV2.d.ts +1 -1
  236. package/dist/types-ts4.5/card/v2/cardviews/cardViewWrapper.d.ts +8 -7
  237. package/dist/types-ts4.5/card/v2/cardviews/errorCardView.d.ts +4 -4
  238. package/dist/types-ts4.5/card/v2/cardviews/iconCardView.d.ts +3 -3
  239. package/dist/types-ts4.5/card/v2/cardviews/imageCardView.d.ts +4 -4
  240. package/dist/types-ts4.5/card/v2/cardviews/index.d.ts +9 -8
  241. package/dist/types-ts4.5/card/v2/cardviews/loadingCardView.d.ts +3 -3
  242. package/dist/types-ts4.5/card/v2/cardviews/processingCardView.d.ts +2 -2
  243. package/dist/types-ts4.5/card/v2/cardviews/videoCardView.d.ts +4 -4
  244. package/dist/types-ts4.5/card/v2/externalImageCard.d.ts +3 -3
  245. package/dist/types-ts4.5/card/v2/fileCard.d.ts +5 -5
  246. package/dist/types-ts4.5/card/v2/inlinePlayerV2.d.ts +4 -4
  247. package/dist/types-ts4.5/card/v2/svgView/helpers.d.ts +3 -0
  248. package/dist/types-ts4.5/card/v2/svgView/index.d.ts +1 -0
  249. package/dist/types-ts4.5/card/v2/svgView/svgView.d.ts +31 -0
  250. package/dist/types-ts4.5/errors.d.ts +2 -2
  251. package/dist/types-ts4.5/inline/loader.d.ts +3 -3
  252. package/dist/types-ts4.5/inline/mediaInlineAnalyticsErrorBoundary.d.ts +3 -3
  253. package/dist/types-ts4.5/inline/mediaInlineCard.d.ts +4 -4
  254. package/dist/types-ts4.5/inline/mediaInlineCardAnalytics.d.ts +2 -2
  255. package/dist/types-ts4.5/types.d.ts +6 -6
  256. package/dist/types-ts4.5/utils/analytics/analytics.d.ts +5 -5
  257. package/dist/types-ts4.5/utils/cardDimensions.d.ts +1 -1
  258. package/dist/types-ts4.5/utils/dimensionComparer.d.ts +1 -1
  259. package/dist/types-ts4.5/utils/getDataURIDimension.d.ts +3 -3
  260. package/dist/types-ts4.5/utils/getMediaCardCursor.d.ts +1 -1
  261. package/dist/types-ts4.5/utils/globalScope/getSSRData.d.ts +1 -1
  262. package/dist/types-ts4.5/utils/globalScope/globalScope.d.ts +5 -5
  263. package/dist/types-ts4.5/utils/globalScope/types.d.ts +2 -2
  264. package/dist/types-ts4.5/utils/lightCards/cardError.d.ts +1 -1
  265. package/dist/types-ts4.5/utils/lightCards/cardLoading.d.ts +1 -1
  266. package/dist/types-ts4.5/utils/lightCards/getDimensionsWithDefault.d.ts +1 -1
  267. package/dist/types-ts4.5/utils/lightCards/lightCardWrappers.d.ts +1 -1
  268. package/dist/types-ts4.5/utils/lightCards/styles.d.ts +1 -1
  269. package/dist/types-ts4.5/utils/lightCards/types.d.ts +2 -2
  270. package/dist/types-ts4.5/utils/metadata.d.ts +1 -1
  271. package/dist/types-ts4.5/utils/objectURLCache.d.ts +1 -1
  272. package/dist/types-ts4.5/utils/preventClickThrough.d.ts +1 -1
  273. package/dist/types-ts4.5/utils/ufoExperiences.d.ts +4 -4
  274. package/dist/types-ts4.5/utils/useCurrentValueRef.d.ts +1 -1
  275. package/dist/types-ts4.5/utils/videoIsPlayable.d.ts +1 -1
  276. package/dist/types-ts4.5/utils/viewportDetector.d.ts +1 -1
  277. package/example-helpers/cards.tsx +3 -1
  278. package/example-helpers/developmentUseMessage.tsx +1 -0
  279. package/example-helpers/index.tsx +4 -4
  280. package/example-helpers/selectableCard.tsx +2 -2
  281. package/example-helpers/svg-helpers/cardContainer.tsx +30 -0
  282. package/example-helpers/svg-helpers/controls.tsx +21 -0
  283. package/example-helpers/svg-helpers/delayApiResponses.ts +31 -0
  284. package/example-helpers/svg-helpers/dimensionPicker.tsx +124 -0
  285. package/example-helpers/svg-helpers/index.ts +7 -0
  286. package/example-helpers/svg-helpers/svgContainer.tsx +32 -0
  287. package/example-helpers/svg-helpers/toggle.tsx +43 -0
  288. package/example-helpers/svg-helpers/uploader.ts +44 -0
  289. package/package.json +20 -14
@@ -1,5 +1,5 @@
1
- import { NumericalCardDimensions } from '@atlaskit/media-common';
2
- import { MediaCardErrorInfo } from '../../utils/analytics';
1
+ import { type NumericalCardDimensions } from '@atlaskit/media-common';
2
+ import { type MediaCardErrorInfo } from '../../utils/analytics';
3
3
  export type MediaCardSsrData = {
4
4
  dataURI?: string;
5
5
  dimensions?: Partial<NumericalCardDimensions>;
@@ -1,5 +1,5 @@
1
1
  import { Component } from 'react';
2
- import { StaticCardProps } from './types';
2
+ import { type StaticCardProps } from './types';
3
3
  export interface ErrorCardProps extends StaticCardProps {
4
4
  readonly size: 'small' | 'medium' | 'large' | 'xlarge';
5
5
  }
@@ -1,5 +1,5 @@
1
1
  import { Component } from 'react';
2
- import { StaticCardProps } from './types';
2
+ import { type StaticCardProps } from './types';
3
3
  export declare class CardLoading extends Component<StaticCardProps, {}> {
4
4
  render(): JSX.Element;
5
5
  }
@@ -1,2 +1,2 @@
1
- import { CardDimensions } from '../../types';
1
+ import { type CardDimensions } from '../../types';
2
2
  export declare const getDimensionsWithDefault: (dimensions?: CardDimensions) => CardDimensions;
@@ -1,4 +1,4 @@
1
1
  /**@jsx jsx */
2
2
  import { jsx } from '@emotion/react';
3
- import { WrapperProps } from './types';
3
+ import { type WrapperProps } from './types';
4
4
  export declare const Wrapper: (props: WrapperProps) => jsx.JSX.Element;
@@ -1,2 +1,2 @@
1
- import { WrapperProps } from './types';
1
+ import { type WrapperProps } from './types';
2
2
  export declare const wrapperStyles: ({ dimensions }: WrapperProps) => import("@emotion/react").SerializedStyles;
@@ -1,6 +1,6 @@
1
1
  /// <reference types="react" />
2
- import { CardDimensions } from '../../types';
3
- import { MediaFeatureFlags } from '@atlaskit/media-common';
2
+ import { type CardDimensions } from '../../types';
3
+ import { type MediaFeatureFlags } from '@atlaskit/media-common';
4
4
  export interface StaticCardProps {
5
5
  dimensions?: CardDimensions;
6
6
  testId?: string;
@@ -1,2 +1,2 @@
1
- import { FileState, FileDetails, Identifier } from '@atlaskit/media-client';
1
+ import { type FileState, type FileDetails, type Identifier } from '@atlaskit/media-client';
2
2
  export declare const getFileDetails: (identifier: Identifier, fileState?: FileState) => FileDetails;
@@ -1,4 +1,4 @@
1
- import { CardPreview } from '../types';
1
+ import { type CardPreview } from '../types';
2
2
  export declare const PREVIEW_CACHE_LRU_SIZE = 50;
3
3
  export declare class ObjectURLCache {
4
4
  private readonly cache;
@@ -1,5 +1,5 @@
1
1
  import React from 'react';
2
- import { ReactNode } from 'react';
2
+ import { type ReactNode } from 'react';
3
3
  export type PreventClickThroughProps = {
4
4
  readonly children?: ReactNode;
5
5
  };
@@ -1,8 +1,8 @@
1
- import { CardStatus } from '../types';
2
- import { FileAttributes } from '@atlaskit/media-common';
3
- import { SSRStatus } from './analytics';
1
+ import { type CardStatus } from '../types';
2
+ import { type FileAttributes } from '@atlaskit/media-common';
3
+ import { type SSRStatus } from './analytics';
4
4
  import { MediaCardError } from '../errors';
5
- import { FileStateFlags } from '../types';
5
+ import { type FileStateFlags } from '../types';
6
6
  type SucceedUfoPayload = {
7
7
  fileAttributes: FileAttributes;
8
8
  ssrReliability: SSRStatus;
@@ -1,2 +1,2 @@
1
- import { MutableRefObject } from 'react';
1
+ import { type MutableRefObject } from 'react';
2
2
  export declare function useCurrentValueRef<T>(value: T): MutableRefObject<T>;
@@ -1,2 +1,2 @@
1
- import { FileState } from '@atlaskit/media-client';
1
+ import { type FileState } from '@atlaskit/media-client';
2
2
  export declare const videoIsPlayable: (isBannedLocalPreview: boolean, fileState?: FileState, mimeType?: string) => boolean;
@@ -1,4 +1,4 @@
1
- import { PropsWithChildren } from 'react';
1
+ import { type PropsWithChildren } from 'react';
2
2
  export type ViewportDetectorProps = PropsWithChildren<{
3
3
  cardEl: HTMLElement | null;
4
4
  onVisible: () => void;
@@ -12,7 +12,7 @@ import {
12
12
  wideImageFileId,
13
13
  largeImageFileId,
14
14
  } from '@atlaskit/media-test-helpers';
15
- import { FileIdentifier } from '@atlaskit/media-client';
15
+ import { type FileIdentifier } from '@atlaskit/media-client';
16
16
 
17
17
  import { createApiCards, actions } from '.';
18
18
  import { CardLoading, CardError, Card } from '../src';
@@ -207,6 +207,7 @@ export const lightDefaultCards = [
207
207
  {
208
208
  title: 'Medium Loading',
209
209
  content: (
210
+ // eslint-disable-next-line @atlaskit/ui-styling-standard/enforce-style-prop -- Ignored via go/DSP-18766
210
211
  <div style={divStyle}>
211
212
  <CardLoading />
212
213
  </div>
@@ -215,6 +216,7 @@ export const lightDefaultCards = [
215
216
  {
216
217
  title: 'Medium Error',
217
218
  content: (
219
+ // eslint-disable-next-line @atlaskit/ui-styling-standard/enforce-style-prop -- Ignored via go/DSP-18766
218
220
  <div style={divStyle}>
219
221
  <CardError />
220
222
  </div>
@@ -2,6 +2,7 @@ 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
5
6
  <div style={{ textAlign: 'center' }}>
6
7
  <InlineMessage appearance="warning" title="Development use only">
7
8
  The purpose of this example is to explore on edge cases for this
@@ -1,7 +1,7 @@
1
1
  // eslint-disable-line no-console
2
2
 
3
- import React, { PropsWithChildren } from 'react';
4
- import { FileItem, Identifier } from '@atlaskit/media-client';
3
+ import React, { type PropsWithChildren } from 'react';
4
+ import { type FileItem, type Identifier } from '@atlaskit/media-client';
5
5
  import {
6
6
  createPollingMaxAttemptsError,
7
7
  createRateLimitedError,
@@ -11,13 +11,13 @@ import {
11
11
  } from '@atlaskit/media-test-helpers';
12
12
  import CrossIcon from '@atlaskit/icon/glyph/cross';
13
13
  import FabricAnalyticsListeners, {
14
- AnalyticsWebClient,
14
+ type AnalyticsWebClient,
15
15
  } from '@atlaskit/analytics-listeners';
16
16
  import { payloadPublisher } from '@atlassian/ufo';
17
17
 
18
18
  import AnnotateIcon from '@atlaskit/icon/glyph/media-services/annotate';
19
19
  import { SelectableCard } from './selectableCard';
20
- import { Card, CardAppearance, CardEvent, CardAction } from '../src';
20
+ import { Card, type CardAppearance, type CardEvent, type CardAction } from '../src';
21
21
  import { MediaCardError } from '../src/errors';
22
22
  import DevelopmentUseMessage from './developmentUseMessage';
23
23
 
@@ -1,7 +1,7 @@
1
1
  import React from 'react';
2
2
  import { Component } from 'react';
3
- import { MediaClientConfig } from '@atlaskit/media-core';
4
- import { Identifier } from '@atlaskit/media-client';
3
+ import { type MediaClientConfig } from '@atlaskit/media-core';
4
+ import { type Identifier } from '@atlaskit/media-client';
5
5
  import { Card } from '../src';
6
6
 
7
7
  export interface SelectableCardProps {
@@ -0,0 +1,30 @@
1
+ /** @jsx jsx */
2
+ import React from 'react';
3
+
4
+ import { jsx } from '@emotion/react';
5
+
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>
17
+ );
18
+
19
+ 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>
30
+ );
@@ -0,0 +1,21 @@
1
+ import React, { type ReactNode } from 'react';
2
+
3
+ import { Box, xcss } from '@atlaskit/primitives';
4
+ import { media } from '@atlaskit/primitives/responsive';
5
+
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
+ },
17
+ });
18
+
19
+ export const ControlsBox = ({ children }: { children: ReactNode }) => (
20
+ <Box xcss={controlsBoxStyles}>{children}</Box>
21
+ );
@@ -0,0 +1,31 @@
1
+ import { type MediaApi } from '@atlaskit/media-client';
2
+ import { sleep } from '@atlaskit/media-test-helpers';
3
+
4
+ type Endpoints = {
5
+ getImage: number;
6
+ getItems: number;
7
+ getFileBinary: number;
8
+ };
9
+
10
+ export const delayApiResponses = (
11
+ mediaApi: MediaApi,
12
+ { getImage, getItems, getFileBinary }: Endpoints,
13
+ ) => {
14
+ const baseGetImage = mediaApi.getImage;
15
+ mediaApi.getImage = async (...params) => {
16
+ await sleep(getImage);
17
+ return baseGetImage(...params);
18
+ };
19
+
20
+ const baseGetItems = mediaApi.getItems;
21
+ mediaApi.getItems = async (...params) => {
22
+ await sleep(getItems);
23
+ return baseGetItems(...params);
24
+ };
25
+
26
+ const baseGetFileBinary = mediaApi.getFileBinary;
27
+ mediaApi.getFileBinary = async (...params) => {
28
+ await sleep(getFileBinary);
29
+ return baseGetFileBinary(...params);
30
+ };
31
+ };
@@ -0,0 +1,124 @@
1
+ import React, { useEffect, useMemo, useState } from 'react';
2
+
3
+ import { Label } from '@atlaskit/form';
4
+ import { Box, Flex, xcss } from '@atlaskit/primitives';
5
+ import Range from '@atlaskit/range';
6
+
7
+ import { ToggleBox } from './toggle';
8
+
9
+ const boxStyles = xcss({ width: '25%', padding: 'space.025' });
10
+ const wrapperStyles = xcss({ padding: 'space.025' });
11
+
12
+ const pixelRange = [1, 1600];
13
+ const percentRange = [1, 100];
14
+
15
+ type OnValue = (value: string | undefined) => void;
16
+
17
+ const defaultVlue = 500;
18
+
19
+ export const DimensionPicker = ({
20
+ targetName,
21
+ dimensionName,
22
+ onChange,
23
+ initialValue,
24
+ initialUnit,
25
+ }: {
26
+ initialValue?: number;
27
+ initialUnit?: '%' | 'px';
28
+ targetName: string;
29
+ dimensionName: string;
30
+ onChange: OnValue;
31
+ }) => {
32
+ const rangeId = `range-${targetName}-${dimensionName}`;
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
+ );
40
+
41
+ const value = useMemo(
42
+ () => (isPercent && !!rawValue && rawValue > 100 ? 100 : rawValue),
43
+ [isPercent, rawValue],
44
+ );
45
+ const unit = useMemo(() => (isPercent ? '%' : 'px'), [isPercent]);
46
+
47
+ useEffect(() => {
48
+ onChange(value === undefined ? value : `${value}${unit}`);
49
+ }, [value, unit, onChange]);
50
+
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
+ );
81
+ };
82
+
83
+ export const DimensionsPicker = ({
84
+ onContainerWidth,
85
+ onContainerHeight,
86
+ onImageWidth,
87
+ onImageHeight,
88
+ }: {
89
+ onContainerWidth: OnValue;
90
+ onContainerHeight: OnValue;
91
+ onImageWidth: OnValue;
92
+ onImageHeight: OnValue;
93
+ }) => {
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
+ );
124
+ };
@@ -0,0 +1,7 @@
1
+ export { ControlsBox } from './controls';
2
+ export { DimensionsPicker } from './dimensionPicker';
3
+ export { ToggleBox } from './toggle';
4
+ export { SvgContainer } from './svgContainer';
5
+ export { useSvgUploader } from './uploader';
6
+ export { CardBox, CardRow } from './cardContainer';
7
+ export { delayApiResponses } from './delayApiResponses';
@@ -0,0 +1,32 @@
1
+ /** @jsx jsx */
2
+ import React from 'react';
3
+
4
+ import { jsx } from '@emotion/react';
5
+
6
+ import { Box, xcss } from '@atlaskit/primitives';
7
+
8
+ 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',
16
+ });
17
+
18
+ export const SvgContainer = ({
19
+ children,
20
+ width,
21
+ height,
22
+ }: {
23
+ children: React.ReactNode;
24
+ width?: string;
25
+ height?: string;
26
+ }) => {
27
+ return (
28
+ <Box xcss={containerStyles} style={{ width, height }}>
29
+ {children}
30
+ </Box>
31
+ );
32
+ };
@@ -0,0 +1,43 @@
1
+ import React, { useState } from 'react';
2
+
3
+ import { Label } from '@atlaskit/form';
4
+ import { Box } from '@atlaskit/primitives';
5
+ import Toggle from '@atlaskit/toggle';
6
+
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;
18
+ }
19
+
20
+ export const ToggleBox = ({
21
+ label,
22
+ onChange,
23
+ ...props
24
+ }: Omit<React.ComponentProps<typeof Toggle>, 'onChange'> & {
25
+ label: string;
26
+ onChange: (val: boolean) => void;
27
+ }) => {
28
+ const [id] = useState(makeid());
29
+
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
+ );
43
+ };
@@ -0,0 +1,44 @@
1
+ import { type SyntheticEvent, useState } from 'react';
2
+
3
+ import { type FileIdentifier } from '@atlaskit/media-client';
4
+ import { useMediaClient } from '@atlaskit/media-client-react';
5
+
6
+ export const useSvgUploader = (collectionName?: string) => {
7
+ const mediaClient = useMediaClient();
8
+ const [identifier, setIdentifier] = useState<FileIdentifier>();
9
+ const [status, setStatus] = useState<string>('');
10
+
11
+ const uploadFn = async (event: SyntheticEvent<HTMLInputElement>) => {
12
+ if (!event.currentTarget.files || !event.currentTarget.files.length) {
13
+ return;
14
+ }
15
+ setStatus('Uploading');
16
+
17
+ const file = event.currentTarget.files[0];
18
+ const uplodableFile = {
19
+ content: file,
20
+ name: file.name,
21
+ collection: collectionName,
22
+ };
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
+ };
42
+
43
+ return { status, identifier, uploadFn };
44
+ };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaskit/media-card",
3
- "version": "77.11.2",
3
+ "version": "77.12.0",
4
4
  "description": "Includes all media card related components, CardView, CardViewSmall, Card...",
5
5
  "publishConfig": {
6
6
  "registry": "https://registry.npmjs.org/"
@@ -38,19 +38,20 @@
38
38
  "dependencies": {
39
39
  "@atlaskit/analytics-next": "^9.3.0",
40
40
  "@atlaskit/dropdown-menu": "^12.10.0",
41
- "@atlaskit/editor-shared-styles": "^2.10.0",
42
- "@atlaskit/icon": "^22.1.0",
43
- "@atlaskit/media-client": "^27.0.0",
41
+ "@atlaskit/editor-shared-styles": "^2.12.0",
42
+ "@atlaskit/icon": "^22.3.0",
43
+ "@atlaskit/media-client": "^27.2.0",
44
44
  "@atlaskit/media-client-react": "^2.0.0",
45
45
  "@atlaskit/media-common": "^11.2.0",
46
46
  "@atlaskit/media-file-preview": "^0.5.0",
47
+ "@atlaskit/media-svg": "^0.1.3",
47
48
  "@atlaskit/media-ui": "^25.10.0",
48
- "@atlaskit/media-viewer": "^48.5.0",
49
+ "@atlaskit/media-viewer": "^48.6.0",
49
50
  "@atlaskit/platform-feature-flags": "^0.2.2",
50
51
  "@atlaskit/spinner": "^16.1.0",
51
- "@atlaskit/theme": "^12.7.0",
52
- "@atlaskit/tokens": "^1.45.0",
53
- "@atlaskit/tooltip": "^18.3.0",
52
+ "@atlaskit/theme": "^12.8.0",
53
+ "@atlaskit/tokens": "^1.49.0",
54
+ "@atlaskit/tooltip": "^18.4.0",
54
55
  "@atlaskit/ufo": "^0.2.0",
55
56
  "@atlaskit/ufo-interaction-ignore": "^1.1.0",
56
57
  "@babel/runtime": "^7.0.0",
@@ -69,16 +70,19 @@
69
70
  "@af/integration-testing": "*",
70
71
  "@atlaskit/analytics-listeners": "^8.9.0",
71
72
  "@atlaskit/analytics-namespaced-context": "^6.9.0",
73
+ "@atlaskit/form": "^10.2.0",
72
74
  "@atlaskit/inline-message": "^12.1.0",
73
75
  "@atlaskit/media-core": "^34.2.0",
74
76
  "@atlaskit/media-picker": "^66.4.0",
75
- "@atlaskit/media-state": "^1.0.0",
76
- "@atlaskit/media-test-data": "^2.1.0",
77
+ "@atlaskit/media-state": "^1.1.0",
78
+ "@atlaskit/media-test-data": "^2.3.0",
77
79
  "@atlaskit/media-test-helpers": "^33.0.0",
78
- "@atlaskit/primitives": "^6.1.0",
80
+ "@atlaskit/primitives": "^6.5.0",
81
+ "@atlaskit/range": "^7.2.0",
79
82
  "@atlaskit/ssr": "*",
83
+ "@atlaskit/toggle": "^13.1.0",
80
84
  "@atlaskit/visual-regression": "*",
81
- "@atlassian/atlassian-frontend-prettier-config-1.0.1": "npm:@atlassian/atlassian-frontend-prettier-config@1.0.1",
85
+ "@atlassian/feature-flags-test-utils": "^0.2.0",
82
86
  "@atlassian/ufo": "^0.2.0",
83
87
  "@testing-library/dom": "^8.17.1",
84
88
  "@testing-library/react": "^12.1.5",
@@ -101,6 +105,9 @@
101
105
  },
102
106
  "platform.media-experience.card-views-refactor_b91lr": {
103
107
  "type": "boolean"
108
+ },
109
+ "platform.media-svg-rendering": {
110
+ "type": "boolean"
104
111
  }
105
112
  },
106
113
  "techstack": {
@@ -110,6 +117,5 @@
110
117
  "spacing"
111
118
  ]
112
119
  }
113
- },
114
- "prettier": "@atlassian/atlassian-frontend-prettier-config-1.0.1"
120
+ }
115
121
  }