@telus-uds/components-web 2.21.1 → 2.22.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 (241) hide show
  1. package/CHANGELOG.md +22 -2
  2. package/lib/Badge/Badge.js +2 -14
  3. package/lib/Badge/index.js +0 -3
  4. package/lib/BlockQuote/BlockQuote.js +4 -25
  5. package/lib/BlockQuote/index.js +0 -3
  6. package/lib/Breadcrumbs/Breadcrumbs.js +9 -36
  7. package/lib/Breadcrumbs/Item/Item.js +15 -25
  8. package/lib/Breadcrumbs/index.js +0 -2
  9. package/lib/Callout/Callout.js +2 -24
  10. package/lib/Callout/index.js +0 -3
  11. package/lib/Card/Card.js +15 -29
  12. package/lib/Card/CardContent.js +5 -18
  13. package/lib/Card/CardFooter.js +7 -19
  14. package/lib/Card/index.js +0 -3
  15. package/lib/Countdown/Countdown.js +5 -24
  16. package/lib/Countdown/Segment.js +3 -15
  17. package/lib/Countdown/index.js +0 -3
  18. package/lib/Countdown/types.js +2 -7
  19. package/lib/Countdown/useCountdown.js +0 -7
  20. package/lib/DatePicker/CalendarContainer.js +0 -5
  21. package/lib/DatePicker/DatePicker.js +9 -61
  22. package/lib/DatePicker/dictionary.js +0 -8
  23. package/lib/DatePicker/index.js +0 -3
  24. package/lib/DatePicker/reactDatesCss.js +0 -2
  25. package/lib/Disclaimer/Disclaimer.js +5 -14
  26. package/lib/Disclaimer/index.js +0 -2
  27. package/lib/ExpandCollapseMini/ExpandCollapseMini.js +6 -17
  28. package/lib/ExpandCollapseMini/ExpandCollapseMiniControl.js +12 -25
  29. package/lib/ExpandCollapseMini/index.js +0 -3
  30. package/lib/Footnote/Footnote.js +17 -63
  31. package/lib/Footnote/FootnoteLink.js +3 -24
  32. package/lib/Footnote/index.js +0 -4
  33. package/lib/IconButton/IconButton.js +4 -14
  34. package/lib/IconButton/index.js +0 -3
  35. package/lib/Image/Image.js +5 -24
  36. package/lib/Image/index.js +0 -3
  37. package/lib/List/List.js +0 -2
  38. package/lib/List/ListItem.js +0 -8
  39. package/lib/List/index.js +0 -4
  40. package/lib/NavigationBar/NavigationBar.js +10 -35
  41. package/lib/NavigationBar/NavigationItem.js +5 -17
  42. package/lib/NavigationBar/NavigationSubMenu.js +3 -19
  43. package/lib/NavigationBar/collapseItems.js +6 -9
  44. package/lib/NavigationBar/index.js +0 -3
  45. package/lib/NavigationBar/resolveItemSelection.js +2 -3
  46. package/lib/OptimizeImage/OptimizeImage.js +6 -27
  47. package/lib/OptimizeImage/index.js +0 -3
  48. package/lib/OptimizeImage/utils/getFallbackUrl.js +0 -4
  49. package/lib/OptimizeImage/utils/getOptimizedUrl.js +0 -8
  50. package/lib/OptimizeImage/utils/hasWebpSupport.js +1 -5
  51. package/lib/OptimizeImage/utils/index.js +0 -4
  52. package/lib/OptimizeImage/utils/isSvgUrl.js +0 -1
  53. package/lib/OrderedList/Item.js +4 -21
  54. package/lib/OrderedList/ItemBase.js +2 -9
  55. package/lib/OrderedList/OrderedList.js +11 -22
  56. package/lib/OrderedList/OrderedListBase.js +3 -13
  57. package/lib/OrderedList/index.js +0 -4
  58. package/lib/Paragraph/Paragraph.js +3 -18
  59. package/lib/Paragraph/index.js +0 -3
  60. package/lib/PreviewCard/AuthorDate.js +1 -10
  61. package/lib/PreviewCard/PreviewCard.js +15 -35
  62. package/lib/PreviewCard/index.js +0 -3
  63. package/lib/PriceLockup/PriceLockup.js +78 -75
  64. package/lib/PriceLockup/index.js +0 -3
  65. package/lib/PriceLockup/tokens.js +0 -2
  66. package/lib/Progress/ProgressBar.js +5 -16
  67. package/lib/Progress/index.js +0 -4
  68. package/lib/QuantitySelector/QuantitySelector.js +8 -42
  69. package/lib/QuantitySelector/SideButton.js +4 -11
  70. package/lib/QuantitySelector/index.js +0 -3
  71. package/lib/QuantitySelector/styles.js +0 -6
  72. package/lib/ResponsiveImage/ResponsiveImage.js +5 -20
  73. package/lib/ResponsiveImage/index.js +0 -3
  74. package/lib/Ribbon/Ribbon.js +4 -20
  75. package/lib/Ribbon/index.js +0 -3
  76. package/lib/SkeletonProvider/SkeletonImage.js +0 -10
  77. package/lib/SkeletonProvider/SkeletonProvider.js +4 -22
  78. package/lib/SkeletonProvider/SkeletonTypography.js +0 -10
  79. package/lib/SkeletonProvider/index.js +0 -3
  80. package/lib/Span/Span.js +3 -17
  81. package/lib/Span/index.js +0 -3
  82. package/lib/Spinner/Spinner.js +11 -39
  83. package/lib/Spinner/SpinnerContent.js +2 -18
  84. package/lib/Spinner/index.js +0 -3
  85. package/lib/StoryCard/StoryCard.js +11 -31
  86. package/lib/StoryCard/index.js +0 -3
  87. package/lib/Table/Body.js +0 -6
  88. package/lib/Table/Cell.js +4 -24
  89. package/lib/Table/Header.js +0 -9
  90. package/lib/Table/Row.js +0 -8
  91. package/lib/Table/SubHeading.js +0 -9
  92. package/lib/Table/Table.js +5 -23
  93. package/lib/Table/index.js +0 -8
  94. package/lib/TermsAndConditions/ExpandCollapse.js +4 -14
  95. package/lib/TermsAndConditions/TermsAndConditions.js +7 -29
  96. package/lib/TermsAndConditions/index.js +0 -2
  97. package/lib/Testimonial/Testimonial.js +2 -26
  98. package/lib/Testimonial/index.js +0 -3
  99. package/lib/Toast/Toast.js +4 -25
  100. package/lib/Toast/index.js +0 -3
  101. package/lib/Video/ControlBar/ControlBar.js +2 -25
  102. package/lib/Video/ControlBar/Controls/VideoButton/VideoButton.js +4 -17
  103. package/lib/Video/ControlBar/Controls/VideoMenu/VideoMenu.js +4 -20
  104. package/lib/Video/ControlBar/Controls/VideoProgressBar/VideoProgressBar.js +12 -26
  105. package/lib/Video/ControlBar/Controls/VolumeSlider/VolumeSlider.js +8 -23
  106. package/lib/Video/MiddleControlButton/MiddleControlButton.js +2 -12
  107. package/lib/Video/Video.js +122 -194
  108. package/lib/Video/index.js +0 -3
  109. package/lib/VideoPicker/VideoPicker.js +6 -32
  110. package/lib/VideoPicker/VideoPickerPlayer.js +2 -10
  111. package/lib/VideoPicker/VideoPickerThumbnail.js +7 -28
  112. package/lib/VideoPicker/VideoSlider.js +7 -17
  113. package/lib/VideoPicker/index.js +0 -3
  114. package/lib/VideoPicker/videoPropType.js +2 -8
  115. package/lib/WaffleGrid/WaffleGrid.js +11 -28
  116. package/lib/WaffleGrid/index.js +0 -3
  117. package/lib/WebPortal/WebPortal.js +1 -5
  118. package/lib/WebPortal/index.js +0 -3
  119. package/lib/WebVideo/WebVideo.js +4 -30
  120. package/lib/WebVideo/index.js +0 -3
  121. package/lib/baseExports.js +6 -1
  122. package/lib/index.js +0 -49
  123. package/lib/shared/FullBleedContent/FullBleedContent.js +5 -17
  124. package/lib/shared/FullBleedContent/getFullBleedBorderRadius.js +0 -11
  125. package/lib/shared/FullBleedContent/index.js +0 -5
  126. package/lib/shared/FullBleedContent/useFullBleedContentProps.js +1 -12
  127. package/lib/shared/VideoSplash/SplashButton/SplashButton.js +2 -12
  128. package/lib/shared/VideoSplash/SplashButtonWithDetails/SplashButtonWithDetails.js +7 -23
  129. package/lib/shared/VideoSplash/VideoSplash.js +4 -17
  130. package/lib/shared/VideoSplash/helpers.js +0 -6
  131. package/lib/utils/index.js +0 -9
  132. package/lib/utils/logger.js +0 -6
  133. package/lib/utils/media.js +2 -11
  134. package/lib/utils/renderStructuredContent.js +14 -31
  135. package/lib/utils/ssr.js +0 -6
  136. package/lib/utils/transforms.js +0 -2
  137. package/lib/utils/useOverlaidPosition.js +6 -28
  138. package/lib/utils/useTypographyTheme.js +4 -5
  139. package/lib-module/Badge/Badge.js +2 -5
  140. package/lib-module/BlockQuote/BlockQuote.js +4 -15
  141. package/lib-module/Breadcrumbs/Breadcrumbs.js +9 -25
  142. package/lib-module/Breadcrumbs/Item/Item.js +15 -12
  143. package/lib-module/Callout/Callout.js +2 -16
  144. package/lib-module/Card/Card.js +14 -17
  145. package/lib-module/Card/CardContent.js +5 -8
  146. package/lib-module/Card/CardFooter.js +7 -9
  147. package/lib-module/Countdown/Countdown.js +6 -11
  148. package/lib-module/Countdown/Segment.js +6 -8
  149. package/lib-module/Countdown/types.js +2 -1
  150. package/lib-module/Countdown/useCountdown.js +0 -6
  151. package/lib-module/DatePicker/CalendarContainer.js +3 -1
  152. package/lib-module/DatePicker/DatePicker.js +9 -39
  153. package/lib-module/DatePicker/dictionary.js +0 -8
  154. package/lib-module/Disclaimer/Disclaimer.js +5 -4
  155. package/lib-module/ExpandCollapseMini/ExpandCollapseMini.js +6 -8
  156. package/lib-module/ExpandCollapseMini/ExpandCollapseMiniControl.js +13 -19
  157. package/lib-module/Footnote/Footnote.js +17 -41
  158. package/lib-module/Footnote/FootnoteLink.js +3 -12
  159. package/lib-module/IconButton/IconButton.js +4 -6
  160. package/lib-module/Image/Image.js +5 -14
  161. package/lib-module/NavigationBar/NavigationBar.js +10 -20
  162. package/lib-module/NavigationBar/NavigationItem.js +5 -5
  163. package/lib-module/NavigationBar/NavigationSubMenu.js +3 -8
  164. package/lib-module/NavigationBar/collapseItems.js +6 -8
  165. package/lib-module/NavigationBar/resolveItemSelection.js +2 -2
  166. package/lib-module/OptimizeImage/OptimizeImage.js +6 -16
  167. package/lib-module/OptimizeImage/utils/getFallbackUrl.js +0 -1
  168. package/lib-module/OptimizeImage/utils/getOptimizedUrl.js +0 -5
  169. package/lib-module/OptimizeImage/utils/hasWebpSupport.js +1 -5
  170. package/lib-module/OrderedList/Item.js +4 -7
  171. package/lib-module/OrderedList/ItemBase.js +2 -3
  172. package/lib-module/OrderedList/OrderedList.js +11 -9
  173. package/lib-module/OrderedList/OrderedListBase.js +3 -3
  174. package/lib-module/Paragraph/Paragraph.js +3 -8
  175. package/lib-module/PreviewCard/AuthorDate.js +1 -4
  176. package/lib-module/PreviewCard/PreviewCard.js +16 -19
  177. package/lib-module/PriceLockup/PriceLockup.js +78 -57
  178. package/lib-module/Progress/ProgressBar.js +7 -8
  179. package/lib-module/QuantitySelector/QuantitySelector.js +8 -30
  180. package/lib-module/QuantitySelector/SideButton.js +4 -6
  181. package/lib-module/ResponsiveImage/ResponsiveImage.js +5 -12
  182. package/lib-module/Ribbon/Ribbon.js +4 -9
  183. package/lib-module/SkeletonProvider/SkeletonImage.js +0 -5
  184. package/lib-module/SkeletonProvider/SkeletonProvider.js +4 -12
  185. package/lib-module/SkeletonProvider/SkeletonTypography.js +0 -5
  186. package/lib-module/Span/Span.js +3 -7
  187. package/lib-module/Spinner/Spinner.js +11 -24
  188. package/lib-module/Spinner/SpinnerContent.js +2 -8
  189. package/lib-module/StoryCard/StoryCard.js +12 -17
  190. package/lib-module/Table/Body.js +0 -2
  191. package/lib-module/Table/Cell.js +4 -14
  192. package/lib-module/Table/Header.js +0 -2
  193. package/lib-module/Table/Row.js +0 -2
  194. package/lib-module/Table/SubHeading.js +0 -2
  195. package/lib-module/Table/Table.js +5 -6
  196. package/lib-module/TermsAndConditions/ExpandCollapse.js +4 -2
  197. package/lib-module/TermsAndConditions/TermsAndConditions.js +7 -9
  198. package/lib-module/Testimonial/Testimonial.js +2 -11
  199. package/lib-module/Toast/Toast.js +4 -15
  200. package/lib-module/Video/ControlBar/ControlBar.js +2 -9
  201. package/lib-module/Video/ControlBar/Controls/VideoButton/VideoButton.js +4 -8
  202. package/lib-module/Video/ControlBar/Controls/VideoMenu/VideoMenu.js +4 -8
  203. package/lib-module/Video/ControlBar/Controls/VideoProgressBar/VideoProgressBar.js +12 -13
  204. package/lib-module/Video/ControlBar/Controls/VolumeSlider/VolumeSlider.js +8 -10
  205. package/lib-module/Video/MiddleControlButton/MiddleControlButton.js +2 -3
  206. package/lib-module/Video/Video.js +122 -173
  207. package/lib-module/VideoPicker/VideoPicker.js +6 -15
  208. package/lib-module/VideoPicker/VideoPickerPlayer.js +2 -3
  209. package/lib-module/VideoPicker/VideoPickerThumbnail.js +7 -13
  210. package/lib-module/VideoPicker/VideoSlider.js +6 -9
  211. package/lib-module/VideoPicker/videoPropType.js +2 -1
  212. package/lib-module/WaffleGrid/WaffleGrid.js +11 -15
  213. package/lib-module/WebPortal/WebPortal.js +1 -1
  214. package/lib-module/WebVideo/WebVideo.js +4 -15
  215. package/lib-module/baseExports.js +3 -2
  216. package/lib-module/index.js +0 -1
  217. package/lib-module/shared/FullBleedContent/FullBleedContent.js +5 -10
  218. package/lib-module/shared/FullBleedContent/getFullBleedBorderRadius.js +0 -10
  219. package/lib-module/shared/FullBleedContent/useFullBleedContentProps.js +1 -11
  220. package/lib-module/shared/VideoSplash/SplashButton/SplashButton.js +2 -3
  221. package/lib-module/shared/VideoSplash/SplashButtonWithDetails/SplashButtonWithDetails.js +7 -12
  222. package/lib-module/shared/VideoSplash/VideoSplash.js +4 -4
  223. package/lib-module/utils/logger.js +2 -2
  224. package/lib-module/utils/media.js +2 -9
  225. package/lib-module/utils/renderStructuredContent.js +14 -25
  226. package/lib-module/utils/ssr.js +0 -4
  227. package/lib-module/utils/useOverlaidPosition.js +8 -27
  228. package/lib-module/utils/useTypographyTheme.js +4 -4
  229. package/package.json +3 -3
  230. package/src/PriceLockup/PriceLockup.jsx +36 -11
  231. package/src/baseExports.js +1 -0
  232. package/src/index.js +0 -1
  233. package/lib/Modal/Modal.js +0 -146
  234. package/lib/Modal/ModalContent.js +0 -203
  235. package/lib/Modal/index.js +0 -13
  236. package/lib-module/Modal/Modal.js +0 -132
  237. package/lib-module/Modal/ModalContent.js +0 -181
  238. package/lib-module/Modal/index.js +0 -2
  239. package/src/Modal/Modal.jsx +0 -121
  240. package/src/Modal/ModalContent.jsx +0 -167
  241. package/src/Modal/index.js +0 -3
@@ -2,30 +2,28 @@
2
2
  * Make a list of items into a one-item list where all items are nested under the first item
3
3
  */
4
4
  const collapseItems = (items, selectedId) => {
5
- if (!(items !== null && items !== void 0 && items.length)) return items; // Give the root item the label of the current active link
6
- // (or the first item if for some reason there's no match on the selectedId)
5
+ if (!(items !== null && items !== void 0 && items.length)) return items;
7
6
 
7
+ // Give the root item the label of the current active link
8
+ // (or the first item if for some reason there's no match on the selectedId)
8
9
  let rootLabel = items[0].label;
9
-
10
10
  const isSelected = _ref => {
11
11
  let {
12
12
  label,
13
13
  id
14
14
  } = _ref;
15
15
  return selectedId === id ?? label;
16
- }; // Linter doesn't like for loops, simulate loop that breaks
17
-
16
+ };
18
17
 
18
+ // Linter doesn't like for loops, simulate loop that breaks
19
19
  items.some(item => {
20
20
  var _item$items;
21
-
22
21
  if (isSelected(item)) {
23
22
  rootLabel = item.label;
24
23
  return true; // break
25
24
  }
26
25
 
27
26
  const nestedMatch = (_item$items = item.items) === null || _item$items === void 0 ? void 0 : _item$items.find(isSelected);
28
-
29
27
  if (nestedMatch) {
30
28
  rootLabel = nestedMatch.label;
31
29
  return true; // break
@@ -33,11 +31,11 @@ const collapseItems = (items, selectedId) => {
33
31
 
34
32
  return false; // continue
35
33
  });
34
+
36
35
  return [{
37
36
  id: 'navigation-bar-root',
38
37
  label: rootLabel,
39
38
  items
40
39
  }];
41
40
  };
42
-
43
41
  export default collapseItems;
@@ -4,13 +4,13 @@ const resolveItemSelection = (_ref, selectedId) => {
4
4
  label,
5
5
  items
6
6
  } = _ref;
7
- const itemId = id ?? label; // Treat item as selected if it or any nested child matches the selected id
7
+ const itemId = id ?? label;
8
8
 
9
+ // Treat item as selected if it or any nested child matches the selected id
9
10
  const selected = Boolean(selectedId === itemId || (items === null || items === void 0 ? void 0 : items.some(item => resolveItemSelection(item, selectedId).selected)));
10
11
  return {
11
12
  itemId,
12
13
  selected
13
14
  };
14
15
  };
15
-
16
16
  export default resolveItemSelection;
@@ -6,7 +6,6 @@ import { hasWebpSupport, getOptimizedUrl, getFallbackUrl } from './utils';
6
6
  import { htmlAttrs } from '../utils';
7
7
  import { jsx as _jsx } from "react/jsx-runtime";
8
8
  const [selectProps, selectedSystemPropTypes] = selectSystemProps([htmlAttrs]);
9
-
10
9
  const OptimizeImage = _ref => {
11
10
  let {
12
11
  contentfulAssetUrl,
@@ -21,8 +20,9 @@ const OptimizeImage = _ref => {
21
20
  disableRetina = false,
22
21
  ...rest
23
22
  } = _ref;
24
- const [imgUrls, setImgUrls] = useState(); // `useHeight` is a deprecated TDS prop, replaced by `sizeByHeight`
23
+ const [imgUrls, setImgUrls] = useState();
25
24
 
25
+ // `useHeight` is a deprecated TDS prop, replaced by `sizeByHeight`
26
26
  const dimension = sizeByHeight || rest.useHeight ? 'h' : 'w';
27
27
  useEffect(() => {
28
28
  // Currently not all browsers support webP
@@ -38,64 +38,54 @@ const OptimizeImage = _ref => {
38
38
  });
39
39
  }, [contentfulAssetUrl, dimension, disableRetina, lg, md, quality, sm, xl, xs]);
40
40
  if (!imgUrls) return null;
41
- return /*#__PURE__*/_jsx(ResponsiveImage, { ...imgUrls,
41
+ return /*#__PURE__*/_jsx(ResponsiveImage, {
42
+ ...imgUrls,
42
43
  alt: alt,
43
44
  ...selectProps(rest)
44
45
  });
45
46
  };
46
-
47
- OptimizeImage.propTypes = { ...selectedSystemPropTypes,
48
-
47
+ OptimizeImage.propTypes = {
48
+ ...selectedSystemPropTypes,
49
49
  /**
50
50
  * The source to load the image. Only contentful image urls are supported. See https://www.contentful.com/developers/docs/references/images-api/ for details.
51
51
  */
52
52
  contentfulAssetUrl: PropTypes.string.isRequired,
53
-
54
53
  /**
55
54
  * Alternative text to display if image cannot be loaded or a screen reader is used.
56
55
  */
57
56
  alt: PropTypes.string.isRequired,
58
-
59
57
  /**
60
58
  * Customize quality as a percentage between 1 and 100.
61
59
  */
62
60
  quality: PropTypes.number,
63
-
64
61
  /**
65
62
  * Customize width for xs screen size in px, this may affect the quality of the image.
66
63
  */
67
64
  xs: PropTypes.number,
68
-
69
65
  /**
70
66
  * Customize width for sm screen size in px, this may affect the quality of the image.
71
67
  */
72
68
  sm: PropTypes.number,
73
-
74
69
  /**
75
70
  * Customize width for md screen size in px, this may affect the quality of the image.
76
71
  */
77
72
  md: PropTypes.number,
78
-
79
73
  /**
80
74
  * Customize width for lg screen size in px, this may affect the quality of the image.
81
75
  */
82
76
  lg: PropTypes.number,
83
-
84
77
  /**
85
78
  * Customize width for xl screen size in px, this may affect the quality of the image.
86
79
  */
87
80
  xl: PropTypes.number,
88
-
89
81
  /**
90
82
  * Switches size dimension to height, default is false
91
83
  */
92
84
  sizeByHeight: PropTypes.bool,
93
-
94
85
  /**
95
86
  * Turns off retina display functionality
96
87
  */
97
88
  disableRetina: PropTypes.bool,
98
-
99
89
  /**
100
90
  * Loading strategy.
101
91
  * @default 'eager'
@@ -3,6 +3,5 @@ export default function getFallbackUrl(url, width, quality) {
3
3
  if (!isSvgUrl(url)) {
4
4
  return `${url}?w=${width}&q=${quality}`;
5
5
  }
6
-
7
6
  return url;
8
7
  }
@@ -2,21 +2,16 @@ import isSvgUrl from './isSvgUrl';
2
2
  export default function getOptimizedUrl(url, dimension, size, quality, disableRetina, supportsWebp) {
3
3
  if (!isSvgUrl(url)) {
4
4
  let format = '';
5
-
6
5
  if (supportsWebp) {
7
6
  format = 'fm=webp';
8
7
  } else if (url.match(/\.jpe?g$/i)) {
9
8
  format = 'fm=jpg&fl=progressive';
10
9
  }
11
-
12
10
  let optimizedUrl = `${url}?${dimension}=${size}&q=${quality}&${format}`;
13
-
14
11
  if (!disableRetina) {
15
12
  optimizedUrl += `, ${url}?${dimension}=${size * 2}&q=${quality}&${format} 2x`;
16
13
  }
17
-
18
14
  return optimizedUrl;
19
15
  }
20
-
21
16
  return url;
22
17
  }
@@ -1,11 +1,11 @@
1
1
  let promise;
2
+
2
3
  /**
3
4
  * Taken directly from Google developers guide on how to detect browser support for WebP.
4
5
  *
5
6
  * @see https://developers.google.com/speed/webp/faq#in_your_own_javascript
6
7
  * @return {Promise<boolean>}
7
8
  */
8
-
9
9
  export default function hasWebpSupport() {
10
10
  // cache the result, so that this function runs only once
11
11
  if (!promise) {
@@ -14,19 +14,15 @@ export default function hasWebpSupport() {
14
14
  // check google guide if data strings are needed
15
15
  const lossy = 'UklGRiIAAABXRUJQVlA4IBYAAAAwAQCdASoBAAEADsD+JaQAA3AAAAAA';
16
16
  const img = document.createElement('img');
17
-
18
17
  img.onload = function onLoad() {
19
18
  const result = img.width > 0 && img.height > 0;
20
19
  resolve(result);
21
20
  };
22
-
23
21
  img.onerror = function onError() {
24
22
  resolve(false);
25
23
  };
26
-
27
24
  img.src = `data:image/webp;base64,${lossy}`;
28
25
  });
29
26
  }
30
-
31
27
  return promise;
32
28
  }
@@ -8,7 +8,6 @@ import { OL_COUNTER_NAME } from './constants';
8
8
  import { jsx as _jsx } from "react/jsx-runtime";
9
9
  import { jsxs as _jsxs } from "react/jsx-runtime";
10
10
  const [selectProps, selectedSystemPropTypes] = selectSystemProps([htmlAttrs]);
11
-
12
11
  const selectItemTextStyles = (_ref, themeOptions) => {
13
12
  let {
14
13
  itemFontWeight,
@@ -26,7 +25,6 @@ const selectItemTextStyles = (_ref, themeOptions) => {
26
25
  lineHeight: itemLineHeight
27
26
  });
28
27
  };
29
-
30
28
  const StyledItemBase = /*#__PURE__*/styled(ItemBase).withConfig({
31
29
  displayName: "Item__StyledItemBase",
32
30
  componentId: "components-web__sc-7jzwcq-0"
@@ -112,25 +110,24 @@ const Item = /*#__PURE__*/forwardRef((_ref3, ref) => {
112
110
  },
113
111
  tokens: headingTokens,
114
112
  children: title
115
- }), /*#__PURE__*/_jsx(ItemContent, { ...themeTokens,
113
+ }), /*#__PURE__*/_jsx(ItemContent, {
114
+ ...themeTokens,
116
115
  children: itemContent
117
116
  })]
118
117
  }) : itemContent
119
118
  });
120
119
  });
121
120
  Item.displayName = 'OrderedListItem';
122
- Item.propTypes = { ...selectedSystemPropTypes,
123
-
121
+ Item.propTypes = {
122
+ ...selectedSystemPropTypes,
124
123
  /**
125
124
  * Item content
126
125
  */
127
126
  children: PropTypes.node.isRequired,
128
-
129
127
  /**
130
128
  * Defines the title of the `OrderedList.Item`
131
129
  */
132
130
  title: PropTypes.string,
133
-
134
131
  /**
135
132
  * Item tokens
136
133
  */
@@ -8,17 +8,16 @@ const StyledItem = /*#__PURE__*/styled.li.withConfig({
8
8
  })({
9
9
  display: 'flex'
10
10
  });
11
-
12
11
  const Item = _ref => {
13
12
  let {
14
13
  children,
15
14
  ...rest
16
15
  } = _ref;
17
- return /*#__PURE__*/_jsx(StyledItem, { ...rest,
16
+ return /*#__PURE__*/_jsx(StyledItem, {
17
+ ...rest,
18
18
  children: children
19
19
  });
20
20
  };
21
-
22
21
  Item.propTypes = {
23
22
  /**
24
23
  * Item content
@@ -21,10 +21,10 @@ const StyledOrderedListBase = /*#__PURE__*/styled(OrderedListBase).withConfig({
21
21
  counterReset: `${OL_COUNTER_NAME} ${start - 1}`
22
22
  };
23
23
  });
24
+
24
25
  /**
25
26
  * Themed semantic ordered list.
26
27
  */
27
-
28
28
  const OrderedList = /*#__PURE__*/forwardRef((_ref2, ref) => {
29
29
  let {
30
30
  children,
@@ -35,31 +35,33 @@ const OrderedList = /*#__PURE__*/forwardRef((_ref2, ref) => {
35
35
  // Pass any variants "OrderedList" receives down to the individual list items.
36
36
  const childrenWithParentVariants = variant ? children.map(child => {
37
37
  var _child$props;
38
-
39
38
  const existingChildVariants = ((_child$props = child.props) === null || _child$props === void 0 ? void 0 : _child$props.variant) ?? {};
40
- return { ...child,
41
- props: { ...child.props,
42
- variant: { ...existingChildVariants,
39
+ return {
40
+ ...child,
41
+ props: {
42
+ ...child.props,
43
+ variant: {
44
+ ...existingChildVariants,
43
45
  ...variant
44
46
  }
45
47
  }
46
48
  };
47
49
  }) : children;
48
- return /*#__PURE__*/_jsx(StyledOrderedListBase, { ...selectProps(rest),
50
+ return /*#__PURE__*/_jsx(StyledOrderedListBase, {
51
+ ...selectProps(rest),
49
52
  ref: ref,
50
53
  start: start,
51
54
  children: childrenWithParentVariants
52
55
  });
53
56
  });
54
57
  OrderedList.displayName = 'OrderedList';
55
- OrderedList.propTypes = { ...selectedSystemPropTypes,
58
+ OrderedList.propTypes = {
59
+ ...selectedSystemPropTypes,
56
60
  tokens: getTokensPropType('OrderedList'),
57
-
58
61
  /**
59
62
  * A list of ordered items wrapped in `OrderedList.Item`.
60
63
  */
61
64
  children: PropTypes.node.isRequired,
62
-
63
65
  /**
64
66
  * The position to start the list with.
65
67
  */
@@ -13,17 +13,18 @@ const StyledList = /*#__PURE__*/styled.ol.withConfig({
13
13
  margin: 0,
14
14
  padding: 0
15
15
  });
16
+
16
17
  /**
17
18
  * Semantic ordered list.
18
19
  */
19
-
20
20
  const OrderedListBase = /*#__PURE__*/forwardRef((_ref, ref) => {
21
21
  let {
22
22
  children,
23
23
  start,
24
24
  ...rest
25
25
  } = _ref;
26
- return /*#__PURE__*/_jsx(StyledList, { ...rest,
26
+ return /*#__PURE__*/_jsx(StyledList, {
27
+ ...rest,
27
28
  ref: ref,
28
29
  start: start,
29
30
  children: children
@@ -35,7 +36,6 @@ OrderedListBase.propTypes = {
35
36
  * A list of ordered items wrapped in `OrderedListBase.Item`.
36
37
  */
37
38
  children: PropTypes.node.isRequired,
38
-
39
39
  /**
40
40
  * The position to start the list with.
41
41
  */
@@ -22,6 +22,7 @@ const StyledParagraph = /*#__PURE__*/styled.p.withConfig({
22
22
  margin-block-end: ${linesBetween}em;
23
23
  `;
24
24
  });
25
+
25
26
  /**
26
27
  * Block text as an HTML ```<p>``` element.
27
28
  *
@@ -32,7 +33,6 @@ const StyledParagraph = /*#__PURE__*/styled.p.withConfig({
32
33
  contrast.
33
34
  * - All Allium Typography variants other than header size variants are supported.
34
35
  */
35
-
36
36
  const Paragraph = _ref3 => {
37
37
  let {
38
38
  children,
@@ -53,33 +53,28 @@ const Paragraph = _ref3 => {
53
53
  children: children
54
54
  });
55
55
  };
56
-
57
- Paragraph.propTypes = { ...selectedSystemPropTypes,
56
+ Paragraph.propTypes = {
57
+ ...selectedSystemPropTypes,
58
58
  children: PropTypes.node.isRequired,
59
-
60
59
  /**
61
60
  * Adds a `data-testid` attribute to the element for testing purposes
62
61
  */
63
62
  testID: PropTypes.string,
64
-
65
63
  /**
66
64
  * Sets the alignment style for the paragraph. Same options as Typography's `align` prop.
67
65
  * 'justify' should be avoided as it usually reduces ease of reading.
68
66
  */
69
67
  align: PropTypes.oneOf(['auto', 'left', 'right', 'center', 'justify']),
70
-
71
68
  /**
72
69
  * How much space between consecutive paragraphs, or between a paragraph and its siblings, in CSS
73
70
  * `em` units: 1 gives space equal to one line of paragraph text, 0.5 would be half a line, etc.
74
71
  * @default 1
75
72
  */
76
73
  linesBetween: PropTypes.number,
77
-
78
74
  /**
79
75
  * Paragraph takes the same tokens overrides as Typography
80
76
  */
81
77
  tokens: PropTypes.oneOf([PropTypes.object, PropTypes.func]),
82
-
83
78
  /**
84
79
  * Paragraph takes any of Typography's theme variants except for header sizes
85
80
  */
@@ -1,6 +1,7 @@
1
1
  import React from 'react';
2
2
  import PropTypes from 'prop-types';
3
3
  import { StackWrap, Typography, useThemeTokens } from '@telus-uds/components-base';
4
+
4
5
  /**
5
6
  * A footer for PreviewCard that composes author and date in a standard way
6
7
  *
@@ -8,10 +9,8 @@ import { StackWrap, Typography, useThemeTokens } from '@telus-uds/components-bas
8
9
  * Add same locale-based date formatting as StoryCard when ready.
9
10
  * Get locale based on decision of https://github.com/telus/universal-design-system/issues/715
10
11
  */
11
-
12
12
  import { jsx as _jsx } from "react/jsx-runtime";
13
13
  import { jsxs as _jsxs } from "react/jsx-runtime";
14
-
15
14
  const AuthorDate = _ref => {
16
15
  let {
17
16
  author,
@@ -45,13 +44,11 @@ const AuthorDate = _ref => {
45
44
  })]
46
45
  });
47
46
  };
48
-
49
47
  AuthorDate.propTypes = {
50
48
  /**
51
49
  * Name of the author
52
50
  */
53
51
  author: PropTypes.string.isRequired,
54
-
55
52
  /**
56
53
  * Date of the post
57
54
  */
@@ -5,14 +5,16 @@ import omit from 'lodash.omit';
5
5
  import { Box, getThemeTokens, hrefAttrsProp, PressableCardBase, selectSystemProps, Spacer, StackView, Typography, a11yProps, focusHandlerProps, viewProps, withLinkRouter, useTheme, getTokensPropType } from '@telus-uds/components-base';
6
6
  import styled from 'styled-components';
7
7
  import FullBleedContent, { getFullBleedBorderRadius, useFullBleedContentProps } from '../shared/FullBleedContent';
8
- import AuthorDate from './AuthorDate'; // Passes React Native-oriented system props through UDS PressableCardBase
8
+ import AuthorDate from './AuthorDate';
9
9
 
10
+ // Passes React Native-oriented system props through UDS PressableCardBase
10
11
  import { jsx as _jsx } from "react/jsx-runtime";
11
12
  import { Fragment as _Fragment } from "react/jsx-runtime";
12
13
  import { jsxs as _jsxs } from "react/jsx-runtime";
13
- const [selectProps, selectedSystemPropTypes] = selectSystemProps([a11yProps, focusHandlerProps, viewProps]); // Stop changes to the card's inner border width causing the size and
14
- // apparent position of the full bleed image to change.
14
+ const [selectProps, selectedSystemPropTypes] = selectSystemProps([a11yProps, focusHandlerProps, viewProps]);
15
15
 
16
+ // Stop changes to the card's inner border width causing the size and
17
+ // apparent position of the full bleed image to change.
16
18
  const FullBleedOffsetOuter = /*#__PURE__*/styled.div.withConfig({
17
19
  displayName: "PreviewCard__FullBleedOffsetOuter",
18
20
  componentId: "components-web__sc-1yfz4de-0"
@@ -45,6 +47,7 @@ const defaultTokens = {
45
47
  contentFlexGrow: 0,
46
48
  contentFlexShrink: 0
47
49
  };
50
+
48
51
  /**
49
52
  * Showcase and guide users to another page, with a preview containing title and a footer.
50
53
  * Whole card is interactive, width expands based on column or container.
@@ -55,7 +58,6 @@ const defaultTokens = {
55
58
  * - Use `href` to set the target URL
56
59
  * - Use `fullBleedContent` to set the thumbnail image
57
60
  */
58
-
59
61
  const PreviewCard = /*#__PURE__*/forwardRef((_ref3, ref) => {
60
62
  let {
61
63
  tag,
@@ -71,7 +73,8 @@ const PreviewCard = /*#__PURE__*/forwardRef((_ref3, ref) => {
71
73
  fullBleedContentPosition,
72
74
  contentStackDirection,
73
75
  fullBleedContentProps
74
- } = useFullBleedContentProps({ ...fullBleedContent,
76
+ } = useFullBleedContentProps({
77
+ ...fullBleedContent,
75
78
  position: 'bottom'
76
79
  });
77
80
  const {
@@ -79,11 +82,10 @@ const PreviewCard = /*#__PURE__*/forwardRef((_ref3, ref) => {
79
82
  PreviewCard: theme
80
83
  }
81
84
  } = useTheme();
82
-
83
- const getPressableCardTokens = cardState => ({ ...omit(getThemeTokens(theme, {}, {}, cardState), 'separatorColor'),
85
+ const getPressableCardTokens = cardState => ({
86
+ ...omit(getThemeTokens(theme, {}, {}, cardState), 'separatorColor'),
84
87
  ...defaultTokens
85
88
  });
86
-
87
89
  const {
88
90
  hrefAttrs,
89
91
  rest: unusedRest
@@ -99,8 +101,8 @@ const PreviewCard = /*#__PURE__*/forwardRef((_ref3, ref) => {
99
101
  const {
100
102
  borderRadius,
101
103
  borderWidth
102
- } = getPressableCardTokens(cardState); // Stop content jumping around as border size changes
103
-
104
+ } = getPressableCardTokens(cardState);
105
+ // Stop content jumping around as border size changes
104
106
  const borderOffset = borderWidth - theme.tokens.borderWidth;
105
107
  const fullBleedBorderRadius = getFullBleedBorderRadius(borderRadius + borderOffset, fullBleedContentPosition);
106
108
  return /*#__PURE__*/_jsxs(StackView, {
@@ -162,12 +164,13 @@ const PreviewCard = /*#__PURE__*/forwardRef((_ref3, ref) => {
162
164
  }
163
165
  });
164
166
  });
165
- PreviewCard.displayName = 'PreviewCard'; // Provide standard author/date footer as a preset with the export
167
+ PreviewCard.displayName = 'PreviewCard';
166
168
 
169
+ // Provide standard author/date footer as a preset with the export
167
170
  PreviewCard.AuthorDate = AuthorDate;
168
- PreviewCard.propTypes = { ...selectedSystemPropTypes,
171
+ PreviewCard.propTypes = {
172
+ ...selectedSystemPropTypes,
169
173
  tokens: getTokensPropType('PreviewCard'),
170
-
171
174
  /**
172
175
  * The URL of the story to be navigated to. Note that `Video` component does not play well when used within
173
176
  * a `PreviewCard` with `href` prop set (the volume and progress sliders can be clicked but are not draggable).
@@ -176,35 +179,29 @@ PreviewCard.propTypes = { ...selectedSystemPropTypes,
176
179
  * @see https://github.com/telus/allium-design-system/issues/6
177
180
  */
178
181
  href: PropTypes.string,
179
-
180
182
  /**
181
183
  * Optional function to be called on press e.g. for within-page navigation.
182
184
  */
183
185
  onPress: PropTypes.func,
184
-
185
186
  /**
186
187
  * Text stating the category of the content.
187
188
  */
188
189
  tag: PropTypes.string,
189
-
190
190
  /**
191
191
  * Section containing additional information, such as author and date.
192
192
  * Use `<PreviewCard.AuthorDate author={...} date={...} />` here for author and date.
193
193
  */
194
194
  footer: PropTypes.oneOfType([PropTypes.node, PropTypes.string]),
195
-
196
195
  /**
197
196
  * Text stating the title or headline of the story.
198
197
  */
199
198
  title: PropTypes.string.isRequired,
200
-
201
199
  /**
202
200
  * Full bleed image to be placed on the card, deprecated in favor of `fullBleedContent`.
203
201
  *
204
202
  * @deprecated
205
203
  */
206
204
  fullBleedImage: PropTypes.exact(FullBleedContent.propTypes || {}),
207
-
208
205
  /**
209
206
  * Full bleed content to be placed on the card.
210
207
  */