@telus-uds/components-web 3.4.0 → 4.0.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 (368) hide show
  1. package/.eslintrc.cjs +7 -1
  2. package/CHANGELOG.md +22 -2
  3. package/jest.config.cjs +1 -1
  4. package/lib/cjs/Badge/Badge.js +128 -0
  5. package/lib/cjs/Badge/index.js +9 -0
  6. package/lib/cjs/BlockQuote/BlockQuote.js +256 -0
  7. package/lib/cjs/BlockQuote/index.js +9 -0
  8. package/lib/cjs/Breadcrumbs/Breadcrumbs.js +264 -0
  9. package/lib/cjs/Breadcrumbs/Item/Item.js +180 -0
  10. package/lib/cjs/Breadcrumbs/index.js +13 -0
  11. package/lib/cjs/Callout/Callout.js +141 -0
  12. package/lib/cjs/Callout/index.js +9 -0
  13. package/lib/cjs/Card/Card.js +257 -0
  14. package/lib/cjs/Card/CardContent.js +97 -0
  15. package/lib/cjs/Card/CardFooter.js +85 -0
  16. package/lib/cjs/Card/index.js +9 -0
  17. package/lib/cjs/Countdown/Countdown.js +268 -0
  18. package/lib/cjs/Countdown/Segment.js +108 -0
  19. package/lib/cjs/Countdown/constants.js +10 -0
  20. package/lib/cjs/Countdown/dictionary.js +28 -0
  21. package/lib/cjs/Countdown/index.js +9 -0
  22. package/lib/cjs/Countdown/types.js +31 -0
  23. package/lib/cjs/Countdown/useCountdown.js +32 -0
  24. package/lib/cjs/DatePicker/CalendarContainer.js +214 -0
  25. package/lib/cjs/DatePicker/DatePicker.js +525 -0
  26. package/lib/cjs/DatePicker/dictionary.js +125 -0
  27. package/lib/cjs/DatePicker/index.js +9 -0
  28. package/lib/cjs/DatePicker/reactDatesCss.js +9 -0
  29. package/lib/cjs/Disclaimer/Disclaimer.js +61 -0
  30. package/lib/cjs/Disclaimer/index.js +13 -0
  31. package/lib/cjs/Footnote/Footnote.js +637 -0
  32. package/lib/cjs/Footnote/FootnoteLink.js +125 -0
  33. package/lib/cjs/Footnote/dictionary.js +18 -0
  34. package/lib/cjs/Footnote/index.js +11 -0
  35. package/lib/cjs/IconButton/IconButton.js +62 -0
  36. package/lib/cjs/IconButton/index.js +9 -0
  37. package/lib/cjs/Image/Image.js +90 -0
  38. package/lib/cjs/Image/index.js +20 -0
  39. package/lib/cjs/Image/server.js +11 -0
  40. package/lib/cjs/List/List.js +8 -0
  41. package/lib/cjs/List/ListItem.js +34 -0
  42. package/lib/cjs/List/index.js +11 -0
  43. package/lib/cjs/NavigationBar/NavigationBar.js +282 -0
  44. package/lib/cjs/NavigationBar/NavigationItem.js +94 -0
  45. package/lib/cjs/NavigationBar/NavigationSubMenu.js +164 -0
  46. package/lib/cjs/NavigationBar/collapseItems.js +43 -0
  47. package/lib/cjs/NavigationBar/index.js +11 -0
  48. package/lib/cjs/NavigationBar/resolveItemSelection.js +22 -0
  49. package/lib/cjs/OptimizeImage/OptimizeImage.js +99 -0
  50. package/lib/cjs/OptimizeImage/index.js +9 -0
  51. package/lib/cjs/OptimizeImage/utils/getFallbackUrl.js +14 -0
  52. package/lib/cjs/OptimizeImage/utils/getImageUrls.js +19 -0
  53. package/lib/cjs/OptimizeImage/utils/getOptimizedUrl.js +24 -0
  54. package/lib/cjs/OptimizeImage/utils/hasWebpSupport.js +34 -0
  55. package/lib/cjs/OptimizeImage/utils/index.js +34 -0
  56. package/lib/cjs/OptimizeImage/utils/isSvgUrl.js +9 -0
  57. package/lib/cjs/OrderedList/Item.js +151 -0
  58. package/lib/cjs/OrderedList/ItemBase.js +34 -0
  59. package/lib/cjs/OrderedList/OrderedList.js +92 -0
  60. package/lib/cjs/OrderedList/OrderedListBase.js +52 -0
  61. package/lib/cjs/OrderedList/constants.js +8 -0
  62. package/lib/cjs/OrderedList/index.js +11 -0
  63. package/lib/cjs/Paragraph/Paragraph.js +97 -0
  64. package/lib/cjs/Paragraph/index.js +9 -0
  65. package/lib/cjs/PreviewCard/AuthorDate.js +63 -0
  66. package/lib/cjs/PreviewCard/PreviewCard.js +215 -0
  67. package/lib/cjs/PreviewCard/index.js +9 -0
  68. package/lib/cjs/PriceLockup/PriceLockup.js +356 -0
  69. package/lib/cjs/PriceLockup/index.js +9 -0
  70. package/lib/cjs/PriceLockup/tokens.js +66 -0
  71. package/lib/cjs/Progress/ProgressBar.js +99 -0
  72. package/lib/cjs/Progress/index.js +11 -0
  73. package/lib/cjs/QuantitySelector/QuantitySelector.js +267 -0
  74. package/lib/cjs/QuantitySelector/SideButton.js +77 -0
  75. package/lib/cjs/QuantitySelector/dictionary.js +32 -0
  76. package/lib/cjs/QuantitySelector/index.js +9 -0
  77. package/lib/cjs/QuantitySelector/styles.js +16 -0
  78. package/lib/cjs/ResponsiveImage/ResponsiveImage.js +107 -0
  79. package/lib/cjs/ResponsiveImage/index.js +9 -0
  80. package/lib/cjs/Ribbon/Ribbon.js +222 -0
  81. package/lib/cjs/Ribbon/index.js +9 -0
  82. package/lib/cjs/SkeletonProvider/SkeletonImage.js +45 -0
  83. package/lib/cjs/SkeletonProvider/SkeletonProvider.js +63 -0
  84. package/lib/cjs/SkeletonProvider/SkeletonTypography.js +44 -0
  85. package/lib/cjs/SkeletonProvider/index.js +9 -0
  86. package/lib/cjs/Span/Span.js +79 -0
  87. package/lib/cjs/Span/index.js +9 -0
  88. package/lib/cjs/Spinner/Spinner.js +221 -0
  89. package/lib/cjs/Spinner/SpinnerContent.js +100 -0
  90. package/lib/cjs/Spinner/constants.js +10 -0
  91. package/lib/cjs/Spinner/index.js +9 -0
  92. package/lib/cjs/StoryCard/StoryCard.js +219 -0
  93. package/lib/cjs/StoryCard/index.js +9 -0
  94. package/lib/cjs/Table/Body.js +24 -0
  95. package/lib/cjs/Table/Cell.js +187 -0
  96. package/lib/cjs/Table/Header.js +32 -0
  97. package/lib/cjs/Table/Row.js +41 -0
  98. package/lib/cjs/Table/SubHeading.js +30 -0
  99. package/lib/cjs/Table/Table.js +124 -0
  100. package/lib/cjs/Table/index.js +19 -0
  101. package/lib/cjs/TermsAndConditions/ExpandCollapse.js +160 -0
  102. package/lib/cjs/TermsAndConditions/TermsAndConditions.js +283 -0
  103. package/lib/cjs/TermsAndConditions/dictionary.js +22 -0
  104. package/lib/cjs/TermsAndConditions/index.js +13 -0
  105. package/lib/cjs/Testimonial/Testimonial.js +240 -0
  106. package/lib/cjs/Testimonial/index.js +9 -0
  107. package/lib/cjs/Toast/Toast.js +165 -0
  108. package/lib/cjs/Toast/index.js +9 -0
  109. package/lib/cjs/Video/ControlBar/ControlBar.js +294 -0
  110. package/lib/cjs/Video/ControlBar/Controls/VideoButton/VideoButton.js +76 -0
  111. package/lib/cjs/Video/ControlBar/Controls/VideoMenu/VideoMenu.js +169 -0
  112. package/lib/cjs/Video/ControlBar/Controls/VideoProgressBar/VideoProgressBar.js +211 -0
  113. package/lib/cjs/Video/ControlBar/Controls/VolumeSlider/VolumeSlider.js +197 -0
  114. package/lib/cjs/Video/MiddleControlButton/MiddleControlButton.js +78 -0
  115. package/lib/cjs/Video/Video.js +964 -0
  116. package/lib/cjs/Video/index.js +9 -0
  117. package/lib/cjs/Video/videoText.js +61 -0
  118. package/lib/cjs/VideoPicker/VideoPicker.js +197 -0
  119. package/lib/cjs/VideoPicker/VideoPickerPlayer.js +54 -0
  120. package/lib/cjs/VideoPicker/VideoPickerThumbnail.js +223 -0
  121. package/lib/cjs/VideoPicker/VideoSlider.js +88 -0
  122. package/lib/cjs/VideoPicker/index.js +9 -0
  123. package/lib/cjs/VideoPicker/videoPropType.js +17 -0
  124. package/lib/cjs/WaffleGrid/WaffleGrid.js +164 -0
  125. package/lib/cjs/WaffleGrid/index.js +9 -0
  126. package/lib/cjs/WebVideo/WebVideo.js +197 -0
  127. package/lib/cjs/WebVideo/index.js +9 -0
  128. package/lib/cjs/WebVideo/utils/index.js +57 -0
  129. package/lib/cjs/baseExports.js +438 -0
  130. package/lib/cjs/index.js +317 -0
  131. package/lib/cjs/server.js +13 -0
  132. package/lib/cjs/shared/ConditionalWrapper/ConditionalWrapper.js +29 -0
  133. package/lib/cjs/shared/ConditionalWrapper/index.js +9 -0
  134. package/lib/cjs/shared/FullBleedContent/FullBleedContent.js +108 -0
  135. package/lib/cjs/shared/FullBleedContent/getFullBleedBorderRadius.js +61 -0
  136. package/lib/cjs/shared/FullBleedContent/index.js +23 -0
  137. package/lib/cjs/shared/FullBleedContent/useFullBleedContentProps.js +61 -0
  138. package/lib/cjs/shared/VideoSplash/SplashButton/SplashButton.js +91 -0
  139. package/lib/cjs/shared/VideoSplash/SplashButtonWithDetails/SplashButtonWithDetails.js +229 -0
  140. package/lib/cjs/shared/VideoSplash/VideoSplash.js +72 -0
  141. package/lib/cjs/shared/VideoSplash/helpers.js +32 -0
  142. package/lib/cjs/utils/index.js +88 -0
  143. package/lib/cjs/utils/isElementFocusable.js +14 -0
  144. package/lib/cjs/utils/logger.js +24 -0
  145. package/lib/cjs/utils/media.js +45 -0
  146. package/lib/cjs/utils/renderStructuredContent.js +71 -0
  147. package/lib/cjs/utils/scrollToAnchor.js +25 -0
  148. package/lib/cjs/utils/ssr.js +50 -0
  149. package/lib/cjs/utils/theming/get-theme-from-server.js +24 -0
  150. package/lib/cjs/utils/theming/with-client-theme.js +31 -0
  151. package/lib/cjs/utils/theming/with-server-theme.js +33 -0
  152. package/lib/cjs/utils/transforms.js +11 -0
  153. package/lib/cjs/utils/useOverlaidPosition.js +222 -0
  154. package/lib/cjs/utils/useTypographyTheme.js +30 -0
  155. package/lib/{Badge → esm/Badge}/Badge.js +11 -21
  156. package/lib/{BlockQuote → esm/BlockQuote}/BlockQuote.js +17 -31
  157. package/lib/{Breadcrumbs → esm/Breadcrumbs}/Breadcrumbs.js +6 -5
  158. package/lib/{Breadcrumbs → esm/Breadcrumbs}/Item/Item.js +10 -6
  159. package/lib/{Callout → esm/Callout}/Callout.js +6 -5
  160. package/lib/{Card → esm/Card}/Card.js +5 -5
  161. package/lib/{Card → esm/Card}/CardContent.js +6 -5
  162. package/lib/{Card → esm/Card}/CardFooter.js +6 -5
  163. package/lib/{Countdown → esm/Countdown}/Countdown.js +53 -32
  164. package/lib/{Countdown → esm/Countdown}/Segment.js +6 -6
  165. package/lib/{DatePicker → esm/DatePicker}/CalendarContainer.js +5 -5
  166. package/lib/{DatePicker → esm/DatePicker}/DatePicker.js +18 -12
  167. package/lib/esm/DatePicker/reactDatesCss.js +3 -0
  168. package/lib/{Disclaimer → esm/Disclaimer}/Disclaimer.js +6 -5
  169. package/lib/{Footnote → esm/Footnote}/Footnote.js +39 -15
  170. package/lib/{Footnote → esm/Footnote}/FootnoteLink.js +6 -5
  171. package/lib/{NavigationBar → esm/NavigationBar}/NavigationBar.js +6 -5
  172. package/lib/{NavigationBar → esm/NavigationBar}/NavigationItem.js +6 -5
  173. package/lib/{OrderedList → esm/OrderedList}/Item.js +10 -6
  174. package/lib/{OrderedList → esm/OrderedList}/ItemBase.js +5 -5
  175. package/lib/{OrderedList → esm/OrderedList}/OrderedList.js +6 -5
  176. package/lib/{OrderedList → esm/OrderedList}/OrderedListBase.js +5 -5
  177. package/lib/{Paragraph → esm/Paragraph}/Paragraph.js +8 -16
  178. package/lib/{PreviewCard → esm/PreviewCard}/PreviewCard.js +10 -7
  179. package/lib/{PriceLockup → esm/PriceLockup}/PriceLockup.js +59 -69
  180. package/lib/{Progress → esm/Progress}/ProgressBar.js +6 -6
  181. package/lib/esm/QuantitySelector/styles.js +9 -0
  182. package/lib/{Ribbon → esm/Ribbon}/Ribbon.js +31 -57
  183. package/lib/{Span → esm/Span}/Span.js +7 -6
  184. package/lib/{Spinner → esm/Spinner}/Spinner.js +18 -8
  185. package/lib/{Spinner → esm/Spinner}/SpinnerContent.js +6 -5
  186. package/lib/{StoryCard → esm/StoryCard}/StoryCard.js +10 -7
  187. package/lib/{Table → esm/Table}/Cell.js +16 -45
  188. package/lib/esm/Table/Row.js +34 -0
  189. package/lib/{Table → esm/Table}/Table.js +16 -17
  190. package/lib/{TermsAndConditions → esm/TermsAndConditions}/ExpandCollapse.js +13 -7
  191. package/lib/{TermsAndConditions → esm/TermsAndConditions}/TermsAndConditions.js +22 -9
  192. package/lib/{Testimonial → esm/Testimonial}/Testimonial.js +26 -10
  193. package/lib/{Toast → esm/Toast}/Toast.js +13 -64
  194. package/lib/{Video → esm/Video}/ControlBar/ControlBar.js +18 -8
  195. package/lib/{Video → esm/Video}/ControlBar/Controls/VideoButton/VideoButton.js +6 -5
  196. package/lib/{Video → esm/Video}/ControlBar/Controls/VideoMenu/VideoMenu.js +14 -7
  197. package/lib/{Video → esm/Video}/ControlBar/Controls/VideoProgressBar/VideoProgressBar.js +14 -7
  198. package/lib/{Video → esm/Video}/ControlBar/Controls/VolumeSlider/VolumeSlider.js +10 -6
  199. package/lib/{Video → esm/Video}/MiddleControlButton/MiddleControlButton.js +6 -5
  200. package/lib/{Video → esm/Video}/Video.js +26 -10
  201. package/lib/{VideoPicker → esm/VideoPicker}/VideoPicker.js +20 -44
  202. package/lib/{VideoPicker → esm/VideoPicker}/VideoPickerThumbnail.js +18 -52
  203. package/lib/{WaffleGrid → esm/WaffleGrid}/WaffleGrid.js +14 -7
  204. package/lib/{WebVideo → esm/WebVideo}/WebVideo.js +14 -9
  205. package/lib/{index.js → esm/index.js} +1 -1
  206. package/lib/{shared → esm/shared}/FullBleedContent/FullBleedContent.js +5 -5
  207. package/lib/{shared → esm/shared}/VideoSplash/SplashButton/SplashButton.js +9 -6
  208. package/lib/{shared → esm/shared}/VideoSplash/SplashButtonWithDetails/SplashButtonWithDetails.js +17 -8
  209. package/lib/{shared → esm/shared}/VideoSplash/VideoSplash.js +6 -5
  210. package/lib/{utils → esm/utils}/index.js +1 -2
  211. package/lib/{utils → esm/utils}/ssr.js +1 -4
  212. package/package.json +17 -16
  213. package/src/Badge/Badge.jsx +2 -3
  214. package/src/BlockQuote/BlockQuote.jsx +2 -3
  215. package/src/Breadcrumbs/Breadcrumbs.jsx +2 -3
  216. package/src/Breadcrumbs/Item/Item.jsx +2 -3
  217. package/src/Callout/Callout.jsx +2 -4
  218. package/src/Card/Card.jsx +1 -3
  219. package/src/Card/CardContent.jsx +2 -3
  220. package/src/Card/CardFooter.jsx +2 -3
  221. package/src/Countdown/Countdown.jsx +62 -36
  222. package/src/Countdown/Segment.jsx +1 -3
  223. package/src/DatePicker/CalendarContainer.jsx +1 -3
  224. package/src/DatePicker/DatePicker.jsx +2 -3
  225. package/src/DatePicker/reactDatesCss.js +1 -3
  226. package/src/Disclaimer/Disclaimer.jsx +2 -3
  227. package/src/Footnote/Footnote.jsx +2 -10
  228. package/src/Footnote/FootnoteLink.jsx +2 -3
  229. package/src/NavigationBar/NavigationBar.jsx +2 -3
  230. package/src/NavigationBar/NavigationItem.jsx +2 -3
  231. package/src/OrderedList/Item.jsx +2 -3
  232. package/src/OrderedList/ItemBase.jsx +1 -3
  233. package/src/OrderedList/OrderedList.jsx +2 -3
  234. package/src/OrderedList/OrderedListBase.jsx +1 -3
  235. package/src/Paragraph/Paragraph.jsx +2 -4
  236. package/src/PreviewCard/PreviewCard.jsx +1 -3
  237. package/src/PriceLockup/PriceLockup.jsx +2 -3
  238. package/src/Progress/ProgressBar.jsx +1 -3
  239. package/src/QuantitySelector/styles.js +1 -3
  240. package/src/Ribbon/Ribbon.jsx +2 -3
  241. package/src/Span/Span.jsx +2 -4
  242. package/src/Spinner/Spinner.jsx +2 -3
  243. package/src/Spinner/SpinnerContent.jsx +2 -3
  244. package/src/StoryCard/StoryCard.jsx +1 -3
  245. package/src/Table/Cell.jsx +4 -5
  246. package/src/Table/Row.jsx +13 -2
  247. package/src/Table/Table.jsx +14 -5
  248. package/src/TermsAndConditions/ExpandCollapse.jsx +1 -3
  249. package/src/TermsAndConditions/TermsAndConditions.jsx +2 -3
  250. package/src/Testimonial/Testimonial.jsx +2 -3
  251. package/src/Toast/Toast.jsx +2 -3
  252. package/src/Video/ControlBar/ControlBar.jsx +2 -4
  253. package/src/Video/ControlBar/Controls/VideoButton/VideoButton.jsx +2 -4
  254. package/src/Video/ControlBar/Controls/VideoMenu/VideoMenu.jsx +2 -4
  255. package/src/Video/ControlBar/Controls/VideoProgressBar/VideoProgressBar.jsx +2 -4
  256. package/src/Video/ControlBar/Controls/VolumeSlider/VolumeSlider.jsx +2 -4
  257. package/src/Video/MiddleControlButton/MiddleControlButton.jsx +2 -4
  258. package/src/Video/Video.jsx +2 -4
  259. package/src/VideoPicker/VideoPicker.jsx +2 -4
  260. package/src/VideoPicker/VideoPickerThumbnail.jsx +1 -3
  261. package/src/WaffleGrid/WaffleGrid.jsx +2 -3
  262. package/src/WebVideo/WebVideo.jsx +3 -4
  263. package/src/index.js +1 -1
  264. package/src/shared/FullBleedContent/FullBleedContent.jsx +1 -3
  265. package/src/shared/VideoSplash/SplashButton/SplashButton.jsx +1 -3
  266. package/src/shared/VideoSplash/SplashButtonWithDetails/SplashButtonWithDetails.jsx +1 -4
  267. package/src/shared/VideoSplash/VideoSplash.jsx +2 -3
  268. package/src/utils/index.js +1 -3
  269. package/src/utils/ssr.js +1 -2
  270. package/lib/DatePicker/reactDatesCss.js +0 -830
  271. package/lib/QuantitySelector/styles.js +0 -18
  272. package/lib/Table/Row.js +0 -19
  273. package/lib/utils/theming/styled-components.js +0 -26
  274. package/src/utils/theming/styled-components.js +0 -23
  275. /package/lib/{Badge → esm/Badge}/index.js +0 -0
  276. /package/lib/{BlockQuote → esm/BlockQuote}/index.js +0 -0
  277. /package/lib/{Breadcrumbs → esm/Breadcrumbs}/index.js +0 -0
  278. /package/lib/{Callout → esm/Callout}/index.js +0 -0
  279. /package/lib/{Card → esm/Card}/index.js +0 -0
  280. /package/lib/{Countdown → esm/Countdown}/constants.js +0 -0
  281. /package/lib/{Countdown → esm/Countdown}/dictionary.js +0 -0
  282. /package/lib/{Countdown → esm/Countdown}/index.js +0 -0
  283. /package/lib/{Countdown → esm/Countdown}/types.js +0 -0
  284. /package/lib/{Countdown → esm/Countdown}/useCountdown.js +0 -0
  285. /package/lib/{DatePicker → esm/DatePicker}/dictionary.js +0 -0
  286. /package/lib/{DatePicker → esm/DatePicker}/index.js +0 -0
  287. /package/lib/{Disclaimer → esm/Disclaimer}/index.js +0 -0
  288. /package/lib/{Footnote → esm/Footnote}/dictionary.js +0 -0
  289. /package/lib/{Footnote → esm/Footnote}/index.js +0 -0
  290. /package/lib/{IconButton → esm/IconButton}/IconButton.js +0 -0
  291. /package/lib/{IconButton → esm/IconButton}/index.js +0 -0
  292. /package/lib/{Image → esm/Image}/Image.js +0 -0
  293. /package/lib/{Image → esm/Image}/index.js +0 -0
  294. /package/lib/{Image → esm/Image}/server.js +0 -0
  295. /package/lib/{List → esm/List}/List.js +0 -0
  296. /package/lib/{List → esm/List}/ListItem.js +0 -0
  297. /package/lib/{List → esm/List}/index.js +0 -0
  298. /package/lib/{NavigationBar → esm/NavigationBar}/NavigationSubMenu.js +0 -0
  299. /package/lib/{NavigationBar → esm/NavigationBar}/collapseItems.js +0 -0
  300. /package/lib/{NavigationBar → esm/NavigationBar}/index.js +0 -0
  301. /package/lib/{NavigationBar → esm/NavigationBar}/resolveItemSelection.js +0 -0
  302. /package/lib/{OptimizeImage → esm/OptimizeImage}/OptimizeImage.js +0 -0
  303. /package/lib/{OptimizeImage → esm/OptimizeImage}/index.js +0 -0
  304. /package/lib/{OptimizeImage → esm/OptimizeImage}/utils/getFallbackUrl.js +0 -0
  305. /package/lib/{OptimizeImage → esm/OptimizeImage}/utils/getImageUrls.js +0 -0
  306. /package/lib/{OptimizeImage → esm/OptimizeImage}/utils/getOptimizedUrl.js +0 -0
  307. /package/lib/{OptimizeImage → esm/OptimizeImage}/utils/hasWebpSupport.js +0 -0
  308. /package/lib/{OptimizeImage → esm/OptimizeImage}/utils/index.js +0 -0
  309. /package/lib/{OptimizeImage → esm/OptimizeImage}/utils/isSvgUrl.js +0 -0
  310. /package/lib/{OrderedList → esm/OrderedList}/constants.js +0 -0
  311. /package/lib/{OrderedList → esm/OrderedList}/index.js +0 -0
  312. /package/lib/{Paragraph → esm/Paragraph}/index.js +0 -0
  313. /package/lib/{PreviewCard → esm/PreviewCard}/AuthorDate.js +0 -0
  314. /package/lib/{PreviewCard → esm/PreviewCard}/index.js +0 -0
  315. /package/lib/{PriceLockup → esm/PriceLockup}/index.js +0 -0
  316. /package/lib/{PriceLockup → esm/PriceLockup}/tokens.js +0 -0
  317. /package/lib/{Progress → esm/Progress}/index.js +0 -0
  318. /package/lib/{QuantitySelector → esm/QuantitySelector}/QuantitySelector.js +0 -0
  319. /package/lib/{QuantitySelector → esm/QuantitySelector}/SideButton.js +0 -0
  320. /package/lib/{QuantitySelector → esm/QuantitySelector}/dictionary.js +0 -0
  321. /package/lib/{QuantitySelector → esm/QuantitySelector}/index.js +0 -0
  322. /package/lib/{ResponsiveImage → esm/ResponsiveImage}/ResponsiveImage.js +0 -0
  323. /package/lib/{ResponsiveImage → esm/ResponsiveImage}/index.js +0 -0
  324. /package/lib/{Ribbon → esm/Ribbon}/index.js +0 -0
  325. /package/lib/{SkeletonProvider → esm/SkeletonProvider}/SkeletonImage.js +0 -0
  326. /package/lib/{SkeletonProvider → esm/SkeletonProvider}/SkeletonProvider.js +0 -0
  327. /package/lib/{SkeletonProvider → esm/SkeletonProvider}/SkeletonTypography.js +0 -0
  328. /package/lib/{SkeletonProvider → esm/SkeletonProvider}/index.js +0 -0
  329. /package/lib/{Span → esm/Span}/index.js +0 -0
  330. /package/lib/{Spinner → esm/Spinner}/constants.js +0 -0
  331. /package/lib/{Spinner → esm/Spinner}/index.js +0 -0
  332. /package/lib/{StoryCard → esm/StoryCard}/index.js +0 -0
  333. /package/lib/{Table → esm/Table}/Body.js +0 -0
  334. /package/lib/{Table → esm/Table}/Header.js +0 -0
  335. /package/lib/{Table → esm/Table}/SubHeading.js +0 -0
  336. /package/lib/{Table → esm/Table}/index.js +0 -0
  337. /package/lib/{TermsAndConditions → esm/TermsAndConditions}/dictionary.js +0 -0
  338. /package/lib/{TermsAndConditions → esm/TermsAndConditions}/index.js +0 -0
  339. /package/lib/{Testimonial → esm/Testimonial}/index.js +0 -0
  340. /package/lib/{Toast → esm/Toast}/index.js +0 -0
  341. /package/lib/{Video → esm/Video}/index.js +0 -0
  342. /package/lib/{Video → esm/Video}/videoText.js +0 -0
  343. /package/lib/{VideoPicker → esm/VideoPicker}/VideoPickerPlayer.js +0 -0
  344. /package/lib/{VideoPicker → esm/VideoPicker}/VideoSlider.js +0 -0
  345. /package/lib/{VideoPicker → esm/VideoPicker}/index.js +0 -0
  346. /package/lib/{VideoPicker → esm/VideoPicker}/videoPropType.js +0 -0
  347. /package/lib/{WaffleGrid → esm/WaffleGrid}/index.js +0 -0
  348. /package/lib/{WebVideo → esm/WebVideo}/index.js +0 -0
  349. /package/lib/{WebVideo → esm/WebVideo}/utils/index.js +0 -0
  350. /package/lib/{baseExports.js → esm/baseExports.js} +0 -0
  351. /package/lib/{server.js → esm/server.js} +0 -0
  352. /package/lib/{shared → esm/shared}/ConditionalWrapper/ConditionalWrapper.js +0 -0
  353. /package/lib/{shared → esm/shared}/ConditionalWrapper/index.js +0 -0
  354. /package/lib/{shared → esm/shared}/FullBleedContent/getFullBleedBorderRadius.js +0 -0
  355. /package/lib/{shared → esm/shared}/FullBleedContent/index.js +0 -0
  356. /package/lib/{shared → esm/shared}/FullBleedContent/useFullBleedContentProps.js +0 -0
  357. /package/lib/{shared → esm/shared}/VideoSplash/helpers.js +0 -0
  358. /package/lib/{utils → esm/utils}/isElementFocusable.js +0 -0
  359. /package/lib/{utils → esm/utils}/logger.js +0 -0
  360. /package/lib/{utils → esm/utils}/media.js +0 -0
  361. /package/lib/{utils → esm/utils}/renderStructuredContent.js +0 -0
  362. /package/lib/{utils → esm/utils}/scrollToAnchor.js +0 -0
  363. /package/lib/{utils → esm/utils}/theming/get-theme-from-server.js +0 -0
  364. /package/lib/{utils → esm/utils}/theming/with-client-theme.js +0 -0
  365. /package/lib/{utils → esm/utils}/theming/with-server-theme.js +0 -0
  366. /package/lib/{utils → esm/utils}/transforms.js +0 -0
  367. /package/lib/{utils → esm/utils}/useOverlaidPosition.js +0 -0
  368. /package/lib/{utils → esm/utils}/useTypographyTheme.js +0 -0
@@ -0,0 +1,94 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.default = void 0;
7
+ var _react = _interopRequireDefault(require("react"));
8
+ var _propTypes = _interopRequireDefault(require("prop-types"));
9
+ var _componentsBase = require("@telus-uds/components-base");
10
+ var _styledComponents = _interopRequireDefault(require("styled-components"));
11
+ var _utils = require("../utils");
12
+ var _jsxRuntime = require("react/jsx-runtime");
13
+ function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
14
+ const [selectProps, selectedSystemPropTypes] = (0, _componentsBase.selectSystemProps)([_utils.htmlAttrs]);
15
+ const defaultMaxWidth = 192;
16
+ const ItemContainer = /*#__PURE__*/_styledComponents.default.div.withConfig({
17
+ displayName: "NavigationItem__ItemContainer",
18
+ componentId: "components-web__sc-ql9x7c-0"
19
+ })(_ref => {
20
+ let {
21
+ targetWidth
22
+ } = _ref;
23
+ return {
24
+ display: 'flex',
25
+ flexDirection: 'column',
26
+ justifyContent: 'center',
27
+ maxWidth: `${Math.max(defaultMaxWidth, targetWidth ?? 0)}px`,
28
+ flexGrow: targetWidth ? 1 : 0,
29
+ flexShrink: 1
30
+ };
31
+ });
32
+
33
+ /**
34
+ * NavigationItem within a NavigationBar component.
35
+ *
36
+ * This is rendered automatically by `NavigationBar` and isn't intended be used directly.
37
+ */
38
+ const NavigationItem = /*#__PURE__*/_react.default.forwardRef((_ref2, ref) => {
39
+ let {
40
+ accessibilityRole = 'link',
41
+ // @todo switch to 'button' for dropdowns
42
+ children,
43
+ id,
44
+ onClick: handleClick = () => {},
45
+ selected = false,
46
+ accessibilityState = {
47
+ current: selected ? 'page' : false
48
+ },
49
+ href,
50
+ tokens,
51
+ variant = {},
52
+ LinkRouter,
53
+ linkRouterProps,
54
+ ...rest
55
+ } = _ref2;
56
+ const selectedProps = selectProps(rest);
57
+ const targetWidth = (0, _componentsBase.useResponsiveProp)({
58
+ xs: 288,
59
+ lg: null
60
+ });
61
+ const viewport = (0, _componentsBase.useViewport)();
62
+ const getTokens = (0, _componentsBase.useThemeTokensCallback)('NavigationBar', tokens, variant);
63
+ const getStateTokens = state => getTokens({
64
+ ...state,
65
+ viewport
66
+ });
67
+ return /*#__PURE__*/(0, _jsxRuntime.jsx)(ItemContainer, {
68
+ targetWidth: targetWidth,
69
+ children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_componentsBase.Button, {
70
+ accessibilityRole: accessibilityRole,
71
+ accessibilityState: accessibilityState,
72
+ onPress: handleClick,
73
+ ref: ref,
74
+ tokens: getStateTokens,
75
+ variant: {
76
+ selected
77
+ },
78
+ href: href,
79
+ LinkRouter: LinkRouter,
80
+ linkRouterProps: linkRouterProps,
81
+ ...selectedProps,
82
+ children: children
83
+ })
84
+ });
85
+ });
86
+ NavigationItem.displayName = 'NavigationItem';
87
+ NavigationItem.propTypes = {
88
+ ...selectedSystemPropTypes,
89
+ tokens: (0, _componentsBase.getTokensPropType)('NavigationBar'),
90
+ onClick: _propTypes.default.func,
91
+ selected: _propTypes.default.bool,
92
+ children: _propTypes.default.oneOfType([_propTypes.default.string, _propTypes.default.func]).isRequired
93
+ };
94
+ var _default = exports.default = NavigationItem;
@@ -0,0 +1,164 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.default = void 0;
7
+ var _react = _interopRequireDefault(require("react"));
8
+ var _propTypes = _interopRequireDefault(require("prop-types"));
9
+ var _componentsBase = require("@telus-uds/components-base");
10
+ var _NavigationItem = _interopRequireDefault(require("./NavigationItem"));
11
+ var _useOverlaidPosition = _interopRequireDefault(require("../utils/useOverlaidPosition"));
12
+ var _resolveItemSelection = _interopRequireDefault(require("./resolveItemSelection"));
13
+ var _jsxRuntime = require("react/jsx-runtime");
14
+ function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
15
+ /**
16
+ * A NavigationItem that opens or closes a Listbox of other NavigationItems.
17
+ *
18
+ * This is rendered automatically by `NavigationBar` and isn't intended be used directly.
19
+ */const NavigationSubMenu = /*#__PURE__*/_react.default.forwardRef((_ref, ref) => {
20
+ let {
21
+ children,
22
+ id,
23
+ isOpen = false,
24
+ tokens = {},
25
+ label,
26
+ onClick,
27
+ selectedId,
28
+ items = [],
29
+ openOverlayRef,
30
+ LinkRouter,
31
+ linkRouterProps,
32
+ itemsContainerRef
33
+ } = _ref;
34
+ const focusTrapRef = _react.default.useRef();
35
+ const maxWidth = 289; // Slightly over 288 of nav item to account for subpixel rounding
36
+ const defaultOffsets = {
37
+ offsets: {
38
+ vertical: 4
39
+ }
40
+ };
41
+ const {
42
+ align,
43
+ offsets,
44
+ minWidth
45
+ } = (0, _componentsBase.useResponsiveProp)({
46
+ xs: {
47
+ ...defaultOffsets,
48
+ align: {
49
+ top: 'bottom',
50
+ left: 'left'
51
+ },
52
+ minWidth: maxWidth
53
+ },
54
+ sm: {
55
+ ...defaultOffsets,
56
+ align: {
57
+ top: 'bottom',
58
+ right: 'right'
59
+ },
60
+ minWidth: maxWidth
61
+ },
62
+ lg: {
63
+ ...defaultOffsets,
64
+ align: {
65
+ top: 'bottom',
66
+ center: 'center'
67
+ },
68
+ minWidth: 192
69
+ }
70
+ });
71
+ const {
72
+ overlaidPosition,
73
+ sourceRef,
74
+ targetRef,
75
+ onTargetLayout,
76
+ isReady
77
+ } = (0, _useOverlaidPosition.default)({
78
+ isShown: isOpen,
79
+ offsets,
80
+ align
81
+ });
82
+ const {
83
+ selected
84
+ } = (0, _resolveItemSelection.default)({
85
+ id,
86
+ label,
87
+ items
88
+ }, selectedId);
89
+ const handleClick = event => {
90
+ if (typeof onClick === 'function') onClick(event);
91
+ };
92
+ const {
93
+ icoMenu
94
+ } = (0, _componentsBase.useThemeTokens)('NavigationBar', {}, {}, {
95
+ expanded: isOpen
96
+ });
97
+ return /*#__PURE__*/(0, _jsxRuntime.jsxs)(_jsxRuntime.Fragment, {
98
+ children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_NavigationItem.default, {
99
+ ref: sourceRef,
100
+ accessibilityRole: "button",
101
+ id: id,
102
+ selected: selected,
103
+ onClick: handleClick,
104
+ icon: icoMenu,
105
+ tokens: tokens,
106
+ children: _ref2 => {
107
+ let {
108
+ textStyles
109
+ } = _ref2;
110
+ return [children, /*#__PURE__*/(0, _jsxRuntime.jsx)(_componentsBase.Icon, {
111
+ icon: icoMenu,
112
+ variant: {
113
+ size: 'micro'
114
+ },
115
+ tokens: {
116
+ color: textStyles[0]?.color
117
+ }
118
+ }, `${id}_icon`)];
119
+ }
120
+ }), isOpen && /*#__PURE__*/(0, _jsxRuntime.jsxs)(_jsxRuntime.Fragment, {
121
+ children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_componentsBase.Listbox.Overlay, {
122
+ overlaidPosition: overlaidPosition,
123
+ maxWidth: maxWidth,
124
+ minWidth: minWidth,
125
+ isReady: isReady,
126
+ onLayout: onTargetLayout,
127
+ ref: openOverlayRef,
128
+ children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_componentsBase.Listbox, {
129
+ items: items,
130
+ firstItemRef: targetRef,
131
+ parentRef: sourceRef,
132
+ selectedId: selectedId,
133
+ LinkRouter: LinkRouter,
134
+ linkRouterProps: linkRouterProps,
135
+ ref: itemsContainerRef || ref
136
+ })
137
+ }), /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
138
+ // This catches and shifts focus to other interactive elements.
139
+ // eslint-disable-next-line jsx-a11y/no-noninteractive-tabindex
140
+ tabIndex: 0,
141
+ ref: focusTrapRef,
142
+ onFocus: () => targetRef.current.focus()
143
+ })]
144
+ })]
145
+ });
146
+ });
147
+ NavigationSubMenu.displayName = 'NavigationSubMenu';
148
+
149
+ // @TODO - proper prop types and comments
150
+ NavigationSubMenu.propTypes = {
151
+ tokens: (0, _componentsBase.getTokensPropType)('NavigationBar'),
152
+ children: _propTypes.default.node,
153
+ id: _propTypes.default.string,
154
+ isOpen: _propTypes.default.bool,
155
+ label: _propTypes.default.string,
156
+ onClick: _propTypes.default.func,
157
+ selectedId: _propTypes.default.string,
158
+ items: _propTypes.default.array,
159
+ openOverlayRef: _propTypes.default.object,
160
+ LinkRouter: _propTypes.default.elementType,
161
+ linkRouterProps: _propTypes.default.object,
162
+ itemsContainerRef: _propTypes.default.object
163
+ };
164
+ var _default = exports.default = NavigationSubMenu;
@@ -0,0 +1,43 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.default = void 0;
7
+ /**
8
+ * Make a list of items into a one-item list where all items are nested under the first item
9
+ */
10
+ const collapseItems = (items, selectedId) => {
11
+ if (!items?.length) return items;
12
+
13
+ // Give the root item the label of the current active link
14
+ // (or the first item if for some reason there's no match on the selectedId)
15
+ let rootLabel = items[0].label;
16
+ const isSelected = _ref => {
17
+ let {
18
+ label,
19
+ id
20
+ } = _ref;
21
+ return selectedId === id ?? label;
22
+ };
23
+
24
+ // Linter doesn't like for loops, simulate loop that breaks
25
+ items.some(item => {
26
+ if (isSelected(item)) {
27
+ rootLabel = item.label;
28
+ return true; // break
29
+ }
30
+ const nestedMatch = item.items?.find(isSelected);
31
+ if (nestedMatch) {
32
+ rootLabel = nestedMatch.label;
33
+ return true; // break
34
+ }
35
+ return false; // continue
36
+ });
37
+ return [{
38
+ id: 'navigation-bar-root',
39
+ label: rootLabel,
40
+ items
41
+ }];
42
+ };
43
+ var _default = exports.default = collapseItems;
@@ -0,0 +1,11 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.default = void 0;
7
+ var _NavigationBar = _interopRequireDefault(require("./NavigationBar"));
8
+ var _NavigationItem = _interopRequireDefault(require("./NavigationItem"));
9
+ function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
10
+ _NavigationBar.default.Item = _NavigationItem.default;
11
+ var _default = exports.default = _NavigationBar.default;
@@ -0,0 +1,22 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.default = void 0;
7
+ const resolveItemSelection = (_ref, selectedId) => {
8
+ let {
9
+ id,
10
+ label,
11
+ items
12
+ } = _ref;
13
+ const itemId = id ?? label;
14
+
15
+ // Treat item as selected if it or any nested child matches the selected id
16
+ const selected = Boolean(selectedId === itemId || items?.some(item => resolveItemSelection(item, selectedId).selected));
17
+ return {
18
+ itemId,
19
+ selected
20
+ };
21
+ };
22
+ var _default = exports.default = resolveItemSelection;
@@ -0,0 +1,99 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.default = void 0;
7
+ var _react = _interopRequireDefault(require("react"));
8
+ var _propTypes = _interopRequireDefault(require("prop-types"));
9
+ var _componentsBase = require("@telus-uds/components-base");
10
+ var _ResponsiveImage = _interopRequireDefault(require("../ResponsiveImage"));
11
+ var _utils = require("./utils");
12
+ var _utils2 = require("../utils");
13
+ var _jsxRuntime = require("react/jsx-runtime");
14
+ function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
15
+ const [selectProps, selectedSystemPropTypes] = (0, _componentsBase.selectSystemProps)([_utils2.htmlAttrs]);
16
+ const OptimizeImage = /*#__PURE__*/_react.default.forwardRef((_ref, ref) => {
17
+ let {
18
+ contentfulAssetUrl,
19
+ alt,
20
+ quality = 80,
21
+ xs = 320,
22
+ sm = 576,
23
+ md = 768,
24
+ lg = 992,
25
+ xl = 1200,
26
+ sizeByHeight = false,
27
+ disableRetina = false,
28
+ ...rest
29
+ } = _ref;
30
+ // `useHeight` is a deprecated TDS prop, replaced by `sizeByHeight`
31
+ const dimension = sizeByHeight || rest.useHeight ? 'h' : 'w';
32
+ // by default assuming webP support for SSR
33
+ const [imgUrls, setImgUrls] = _react.default.useState((0, _utils.getImageUrls)(contentfulAssetUrl, dimension, xs, sm, md, lg, xl, quality, disableRetina, true));
34
+ _react.default.useEffect(() => {
35
+ // Checking for webP support for CSR
36
+ (0, _utils.hasWebpSupport)().then(supportsWebp => {
37
+ const imageUrls = (0, _utils.getImageUrls)(contentfulAssetUrl, dimension, xs, sm, md, lg, xl, quality, disableRetina, supportsWebp);
38
+ setImgUrls(imageUrls);
39
+ });
40
+ }, [contentfulAssetUrl, dimension, disableRetina, lg, md, quality, sm, xl, xs]);
41
+ if (!imgUrls) return null;
42
+ return /*#__PURE__*/(0, _jsxRuntime.jsx)(_ResponsiveImage.default, {
43
+ ...imgUrls,
44
+ alt: alt,
45
+ ...selectProps(rest),
46
+ ref: ref
47
+ });
48
+ });
49
+ OptimizeImage.displayName = 'OptimizeImage';
50
+ OptimizeImage.propTypes = {
51
+ ...selectedSystemPropTypes,
52
+ /**
53
+ * The source to load the image. Only contentful image urls are supported. See https://www.contentful.com/developers/docs/references/images-api/ for details.
54
+ */
55
+ contentfulAssetUrl: _propTypes.default.string.isRequired,
56
+ /**
57
+ * Alternative text to display if image cannot be loaded or a screen reader is used.
58
+ */
59
+ alt: _propTypes.default.string.isRequired,
60
+ /**
61
+ * Customize quality as a percentage between 1 and 100.
62
+ */
63
+ quality: _propTypes.default.number,
64
+ /**
65
+ * Customize width for xs screen size in px, this may affect the quality of the image.
66
+ */
67
+ xs: _propTypes.default.number,
68
+ /**
69
+ * Customize width for sm screen size in px, this may affect the quality of the image.
70
+ */
71
+ sm: _propTypes.default.number,
72
+ /**
73
+ * Customize width for md screen size in px, this may affect the quality of the image.
74
+ */
75
+ md: _propTypes.default.number,
76
+ /**
77
+ * Customize width for lg screen size in px, this may affect the quality of the image.
78
+ */
79
+ lg: _propTypes.default.number,
80
+ /**
81
+ * Customize width for xl screen size in px, this may affect the quality of the image.
82
+ */
83
+ xl: _propTypes.default.number,
84
+ /**
85
+ * Switches size dimension to height, default is false
86
+ */
87
+ sizeByHeight: _propTypes.default.bool,
88
+ /**
89
+ * Turns off retina display functionality
90
+ */
91
+ disableRetina: _propTypes.default.bool,
92
+ /**
93
+ * Loading strategy.
94
+ * @default 'eager'
95
+ * @see https://developer.mozilla.org/en-US/docs/Web/HTML/Element/img#attr-loading
96
+ */
97
+ loading: _propTypes.default.oneOf(['eager', 'lazy'])
98
+ };
99
+ var _default = exports.default = OptimizeImage;
@@ -0,0 +1,9 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.default = void 0;
7
+ var _OptimizeImage = _interopRequireDefault(require("./OptimizeImage"));
8
+ function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
9
+ var _default = exports.default = _OptimizeImage.default;
@@ -0,0 +1,14 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.default = getFallbackUrl;
7
+ var _isSvgUrl = _interopRequireDefault(require("./isSvgUrl"));
8
+ function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
9
+ function getFallbackUrl(url, dimension, size, quality) {
10
+ if (!(0, _isSvgUrl.default)(url)) {
11
+ return `${url}?${dimension}=${size}&q=${quality}`;
12
+ }
13
+ return url;
14
+ }
@@ -0,0 +1,19 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.default = getImageUrls;
7
+ var _getOptimizedUrl = _interopRequireDefault(require("./getOptimizedUrl"));
8
+ var _getFallbackUrl = _interopRequireDefault(require("./getFallbackUrl"));
9
+ function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
10
+ function getImageUrls(contentfulAssetUrl, dimension, xs, sm, md, lg, xl, quality, disableRetina, supportsWebp) {
11
+ return {
12
+ xsSrc: (0, _getOptimizedUrl.default)(contentfulAssetUrl, dimension, xs, quality, disableRetina, supportsWebp),
13
+ smSrc: (0, _getOptimizedUrl.default)(contentfulAssetUrl, dimension, sm, quality, disableRetina, supportsWebp),
14
+ mdSrc: (0, _getOptimizedUrl.default)(contentfulAssetUrl, dimension, md, quality, disableRetina, supportsWebp),
15
+ lgSrc: (0, _getOptimizedUrl.default)(contentfulAssetUrl, dimension, lg, quality, disableRetina, supportsWebp),
16
+ xlSrc: (0, _getOptimizedUrl.default)(contentfulAssetUrl, dimension, xl, quality, disableRetina, supportsWebp),
17
+ fallbackSrc: (0, _getFallbackUrl.default)(contentfulAssetUrl, dimension, xl, quality)
18
+ };
19
+ }
@@ -0,0 +1,24 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.default = getOptimizedUrl;
7
+ var _isSvgUrl = _interopRequireDefault(require("./isSvgUrl"));
8
+ function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
9
+ function getOptimizedUrl(url, dimension, size, quality, disableRetina, supportsWebp) {
10
+ if (!(0, _isSvgUrl.default)(url)) {
11
+ let format = '';
12
+ if (supportsWebp) {
13
+ format = 'fm=webp';
14
+ } else if (url.match(/\.jpe?g$/i)) {
15
+ format = 'fm=jpg&fl=progressive';
16
+ }
17
+ let optimizedUrl = `${url}?${dimension}=${size}&q=${quality}&${format}`;
18
+ if (!disableRetina) {
19
+ optimizedUrl += `, ${url}?${dimension}=${size * 2}&q=${quality}&${format} 2x`;
20
+ }
21
+ return optimizedUrl;
22
+ }
23
+ return url;
24
+ }
@@ -0,0 +1,34 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.default = hasWebpSupport;
7
+ let promise;
8
+
9
+ /**
10
+ * Taken directly from Google developers guide on how to detect browser support for WebP.
11
+ *
12
+ * @see https://developers.google.com/speed/webp/faq#in_your_own_javascript
13
+ * @return {Promise<boolean>}
14
+ */
15
+ function hasWebpSupport() {
16
+ // cache the result, so that this function runs only once
17
+ if (!promise) {
18
+ promise = new Promise(resolve => {
19
+ // basic support. other test forms exist for lossless, alpha, and animation types.
20
+ // check google guide if data strings are needed
21
+ const lossy = 'UklGRiIAAABXRUJQVlA4IBYAAAAwAQCdASoBAAEADsD+JaQAA3AAAAAA';
22
+ const img = document.createElement('img');
23
+ img.onload = function onLoad() {
24
+ const result = img.width > 0 && img.height > 0;
25
+ resolve(result);
26
+ };
27
+ img.onerror = function onError() {
28
+ resolve(false);
29
+ };
30
+ img.src = `data:image/webp;base64,${lossy}`;
31
+ });
32
+ }
33
+ return promise;
34
+ }
@@ -0,0 +1,34 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ Object.defineProperty(exports, "getFallbackUrl", {
7
+ enumerable: true,
8
+ get: function () {
9
+ return _getFallbackUrl.default;
10
+ }
11
+ });
12
+ Object.defineProperty(exports, "getImageUrls", {
13
+ enumerable: true,
14
+ get: function () {
15
+ return _getImageUrls.default;
16
+ }
17
+ });
18
+ Object.defineProperty(exports, "getOptimizedUrl", {
19
+ enumerable: true,
20
+ get: function () {
21
+ return _getOptimizedUrl.default;
22
+ }
23
+ });
24
+ Object.defineProperty(exports, "hasWebpSupport", {
25
+ enumerable: true,
26
+ get: function () {
27
+ return _hasWebpSupport.default;
28
+ }
29
+ });
30
+ var _getOptimizedUrl = _interopRequireDefault(require("./getOptimizedUrl"));
31
+ var _getFallbackUrl = _interopRequireDefault(require("./getFallbackUrl"));
32
+ var _hasWebpSupport = _interopRequireDefault(require("./hasWebpSupport"));
33
+ var _getImageUrls = _interopRequireDefault(require("./getImageUrls"));
34
+ function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
@@ -0,0 +1,9 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.default = isSvgUrl;
7
+ function isSvgUrl(url) {
8
+ return !!url.match(/\.svg$/i);
9
+ }