@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
@@ -115,7 +115,6 @@ const DetailsContainer = /*#__PURE__*/styled.div.withConfig({
115
115
  return `${detailsContainerPadding}px`;
116
116
  }
117
117
  });
118
-
119
118
  const selectPlayIconContainerTokens = _ref12 => {
120
119
  let {
121
120
  playIconContainerBackground
@@ -124,7 +123,6 @@ const selectPlayIconContainerTokens = _ref12 => {
124
123
  playIconContainerBackground
125
124
  };
126
125
  };
127
-
128
126
  const selectDetailsContainerTokens = _ref13 => {
129
127
  let {
130
128
  detailsContainerPadding
@@ -133,7 +131,6 @@ const selectDetailsContainerTokens = _ref13 => {
133
131
  detailsContainerPadding
134
132
  };
135
133
  };
136
-
137
134
  const selectButtonContentTokens = _ref14 => {
138
135
  let {
139
136
  buttonBackground,
@@ -156,7 +153,6 @@ const selectButtonContentTokens = _ref14 => {
156
153
  buttonPaddingRight
157
154
  };
158
155
  };
159
-
160
156
  const getLabelTokens = _ref15 => {
161
157
  let {
162
158
  labelFontName: fontName,
@@ -167,7 +163,6 @@ const getLabelTokens = _ref15 => {
167
163
  fontWeight
168
164
  };
169
165
  };
170
-
171
166
  const SplashButtonWithDetails = _ref16 => {
172
167
  let {
173
168
  label,
@@ -190,14 +185,17 @@ const SplashButtonWithDetails = _ref16 => {
190
185
  const ariaLabel = getAriaLabel(mappedVideoLength, copy);
191
186
  return /*#__PURE__*/_jsx(ButtonContainer, {
192
187
  "aria-label": ariaLabel,
193
- children: /*#__PURE__*/_jsxs(ButtonContent, { ...selectButtonContentTokens(themeTokens),
188
+ children: /*#__PURE__*/_jsxs(ButtonContent, {
189
+ ...selectButtonContentTokens(themeTokens),
194
190
  buttonContentChildrenBackground: buttonContentChildrenBackground,
195
- children: [/*#__PURE__*/_jsx(PlayIconContainer, { ...selectPlayIconContainerTokens(themeTokens),
191
+ children: [/*#__PURE__*/_jsx(PlayIconContainer, {
192
+ ...selectPlayIconContainerTokens(themeTokens),
196
193
  children: /*#__PURE__*/_jsx(PlayIcon, {
197
194
  size: 13,
198
195
  color: playIconColor
199
196
  })
200
- }), /*#__PURE__*/_jsxs(DetailsContainer, { ...selectDetailsContainerTokens(themeTokens),
197
+ }), /*#__PURE__*/_jsxs(DetailsContainer, {
198
+ ...selectDetailsContainerTokens(themeTokens),
201
199
  children: [/*#__PURE__*/_jsx(Typography, {
202
200
  variant: {
203
201
  bold: true
@@ -206,9 +204,7 @@ const SplashButtonWithDetails = _ref16 => {
206
204
  children: label
207
205
  }), /*#__PURE__*/_jsx(Typography, {
208
206
  variant: {
209
- colour: 'secondary'
210
- /* TODO: this is not the same color as in designs */
211
- ,
207
+ colour: 'secondary' /* TODO: this is not the same color as in designs */,
212
208
  size: 'micro'
213
209
  },
214
210
  children: mappedVideoLength.timestamp
@@ -217,7 +213,6 @@ const SplashButtonWithDetails = _ref16 => {
217
213
  })
218
214
  });
219
215
  };
220
-
221
216
  SplashButtonWithDetails.propTypes = {
222
217
  label: PropTypes.string,
223
218
  tokens: PropTypes.object,
@@ -28,7 +28,6 @@ const SplashBackground = /*#__PURE__*/styled.div.withConfig({
28
28
  cursor: 'pointer'
29
29
  };
30
30
  });
31
-
32
31
  const VideoSplash = _ref2 => {
33
32
  let {
34
33
  poster,
@@ -41,7 +40,8 @@ const VideoSplash = _ref2 => {
41
40
  const viewport = useViewport();
42
41
  const showDetails = !simpleMode && viewport !== viewports.xs;
43
42
  const label = videoText[copy].watch;
44
- return /*#__PURE__*/_jsx(SplashBackground, { ...selectProps(rest),
43
+ return /*#__PURE__*/_jsx(SplashBackground, {
44
+ ...selectProps(rest),
45
45
  onClick: onClick,
46
46
  videoPoster: poster,
47
47
  children: showDetails ? /*#__PURE__*/_jsx(SplashButtonWithDetails, {
@@ -54,8 +54,8 @@ const VideoSplash = _ref2 => {
54
54
  })
55
55
  });
56
56
  };
57
-
58
- VideoSplash.propTypes = { ...selectedSystemPropTypes,
57
+ VideoSplash.propTypes = {
58
+ ...selectedSystemPropTypes,
59
59
  onClick: PropTypes.func,
60
60
  poster: PropTypes.string,
61
61
  videoLength: PropTypes.number.isRequired,
@@ -2,16 +2,16 @@ export const deprecate = (componentName, message) => {
2
2
  if (process.env.NODE_ENV === 'production') {
3
3
  return;
4
4
  }
5
-
6
5
  console.warn(`[Allium] [Deprecate] ${componentName}: ${message}`); // eslint-disable-line no-console
7
6
  };
7
+
8
8
  export const warn = (componentName, message) => {
9
9
  if (process.env.NODE_ENV === 'production') {
10
10
  return;
11
11
  }
12
-
13
12
  console.warn(`[Allium] ${componentName}: ${message}`); // eslint-disable-line no-console
14
13
  };
14
+
15
15
  export default {
16
16
  deprecate,
17
17
  warn
@@ -2,25 +2,20 @@ import { viewports } from '@telus-uds/system-constants';
2
2
  export default function media() {
3
3
  return {
4
4
  query: {},
5
-
6
5
  from(breakpoint) {
7
6
  if (breakpoint !== viewports.xs) {
8
7
  this.query.minWidth = breakpoint;
9
8
  }
10
-
11
9
  return this;
12
10
  },
13
-
14
11
  until(breakpoint) {
15
12
  this.query.maxWidth = breakpoint;
16
13
  return this;
17
14
  },
18
-
19
15
  and(custom) {
20
16
  this.query.and = custom;
21
17
  return this;
22
18
  },
23
-
24
19
  css(style) {
25
20
  const {
26
21
  minWidth,
@@ -29,18 +24,16 @@ export default function media() {
29
24
  } = this.query;
30
25
  const min = minWidth ? `(min-width: ${viewports.map.get(minWidth)}px)` : undefined;
31
26
  const max = maxWidth ? `(max-width: ${viewports.map.get(maxWidth) - 1}px)` : undefined;
32
-
33
27
  if (typeof min !== 'undefined' || typeof max !== 'undefined' || typeof and !== 'undefined') {
34
28
  const mediaQuery = `@media ${[min, max, and].filter(a => a).join(' and ')}`;
35
29
  this.query = {};
36
30
  return {
37
- [mediaQuery]: { ...(typeof style === 'function' ? style() : style)
31
+ [mediaQuery]: {
32
+ ...(typeof style === 'function' ? style() : style)
38
33
  }
39
34
  };
40
35
  }
41
-
42
36
  return typeof style === 'function' ? style() : style;
43
37
  }
44
-
45
38
  };
46
39
  }
@@ -1,77 +1,66 @@
1
1
  import React from 'react';
2
2
  import { Link } from '@telus-uds/components-base';
3
+
3
4
  /**
4
5
  * Takes a string content and marks up all the links in it by wrapping them
5
6
  * in `Link` component.
6
7
  */
7
-
8
8
  import { createElement as _createElement } from "react";
9
9
  import { jsx as _jsx } from "react/jsx-runtime";
10
-
11
10
  const generateLinks = content => {
12
11
  const linkRegex = /<\s*a([^>]*)>(.*?)<\s*\/\s*a>/g;
13
12
  const attributeRegex = /(\w+)\s*=\s*((["'])(.*?)\3|(?=\s|\/>))/g;
14
13
  const parts = content.split(linkRegex);
15
-
16
14
  if (parts.length === 1) {
17
15
  return parts;
18
- } // Start with first anchor text, attributes will be in the previous part
19
-
16
+ }
20
17
 
18
+ // Start with first anchor text, attributes will be in the previous part
21
19
  for (let i = 2; i < parts.length; i += 3) {
22
- const o = {}; // Get attributes from previous part
23
-
24
- const attributes = parts[i - 1].trim(); // Create object from attributes
20
+ const o = {};
21
+ // Get attributes from previous part
22
+ const attributes = parts[i - 1].trim();
25
23
 
24
+ // Create object from attributes
26
25
  const matchedAttributes = attributes.match(attributeRegex);
27
-
28
26
  if (matchedAttributes) {
29
27
  matchedAttributes.forEach(attribute => {
30
28
  const split = attribute.split('=');
31
29
  o[split[0]] = split[1].substr(1, split[1].length - 2);
32
30
  });
33
- } // Remove anchor attributes from parts
34
-
35
-
36
- parts[i - 1] = undefined; // Replace anchor text with Link in parts
37
-
38
- parts[i] = /*#__PURE__*/_createElement(Link, { ...o,
31
+ }
32
+ // Remove anchor attributes from parts
33
+ parts[i - 1] = undefined;
34
+ // Replace anchor text with Link in parts
35
+ parts[i] = /*#__PURE__*/_createElement(Link, {
36
+ ...o,
39
37
  key: i
40
38
  }, parts[i]);
41
39
  }
42
-
43
40
  return parts;
44
41
  };
42
+
45
43
  /**
46
44
  * Takes an array of strings and in each element replaces the breaks with `<br>` tags.
47
45
  */
48
-
49
-
50
46
  const generateBreaks = parts => {
51
47
  const breakRegex = /<br\s?\/*>/g;
52
48
  const partsWithBreaks = parts;
53
-
54
49
  for (let i = 0; i < partsWithBreaks.length; i += 1) {
55
50
  if (typeof partsWithBreaks[i] === 'string' && partsWithBreaks[i].search(breakRegex) !== -1) {
56
51
  const toSplit = partsWithBreaks[i].split(breakRegex);
57
-
58
52
  for (let x = 1; x < toSplit.length; x += 2) {
59
53
  toSplit.splice(x, 0, /*#__PURE__*/_jsx("br", {}, `break-${i}-${x}`));
60
54
  }
61
-
62
55
  partsWithBreaks[i] = toSplit;
63
56
  }
64
57
  }
65
-
66
58
  return partsWithBreaks;
67
59
  };
68
-
69
60
  const renderStructuredContent = content => {
70
61
  if (typeof content !== 'string') {
71
62
  return content;
72
63
  }
73
-
74
64
  return generateBreaks(generateLinks(content));
75
65
  };
76
-
77
66
  export default renderStructuredContent;
@@ -17,7 +17,6 @@ import { ssrStyles as baseSsrStyles } from '@telus-uds/components-base';
17
17
  * @param {boolean} [options.styleGetters]
18
18
  * @param {(ReactElement) => ReactElement} [options.collectStyles]
19
19
  */
20
-
21
20
  const ssrStyles = function () {
22
21
  let appName = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 'Allium app';
23
22
  let {
@@ -25,17 +24,14 @@ const ssrStyles = function () {
25
24
  collectStyles = renderedApp => renderedApp
26
25
  } = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
27
26
  const sheet = new ServerStyleSheet();
28
-
29
27
  const getStyledComponentsStyles = () => {
30
28
  const styles = sheet.getStyleElement();
31
29
  sheet.seal();
32
30
  return styles;
33
31
  };
34
-
35
32
  return baseSsrStyles(appName, {
36
33
  styleGetters: [getStyledComponentsStyles, ...styleGetters],
37
34
  collectStyles: renderedApp => collectStyles(sheet.collectStyles(renderedApp))
38
35
  });
39
36
  };
40
-
41
37
  export default ssrStyles;
@@ -1,9 +1,8 @@
1
- import { useCallback, useEffect, useRef, useState } from 'react'; // TODO: add react-native as a peer dep and support native apps too.
1
+ import { useCallback, useEffect, useRef, useState } from 'react';
2
+ // TODO: add react-native as a peer dep and support native apps too.
2
3
  // That requires some fiddling with Allium repo storybook config, babel, etc,
3
4
  // unless ADS gets merged back into UDS monorepo.
4
-
5
5
  import Dimensions from "react-native-web/dist/exports/Dimensions";
6
-
7
6
  const adjustHorizontalToFit = (initialOffset, windowWidth, sourceWidth) => {
8
7
  const offset = Math.max(0, initialOffset);
9
8
  const otherEdgeOverflow = Math.max(0, offset + sourceWidth - windowWidth);
@@ -14,34 +13,29 @@ const adjustHorizontalToFit = (initialOffset, windowWidth, sourceWidth) => {
14
13
  if (tooWideBy) adjusted.width = Math.max(0, sourceWidth - tooWideBy);
15
14
  return adjusted;
16
15
  };
17
-
18
16
  const getPosition = _ref => {
19
17
  let {
20
18
  edge,
21
19
  fromEdge,
22
20
  sourceSize
23
21
  } = _ref;
24
-
25
22
  switch (edge) {
26
23
  case 'near':
27
24
  return fromEdge;
28
-
29
25
  case 'mid':
30
26
  return fromEdge + sourceSize / 2;
31
-
32
27
  case 'far':
33
28
  return fromEdge + sourceSize;
34
-
35
29
  default:
36
30
  return 0;
37
31
  }
38
32
  };
39
-
40
33
  const getEdgeType = (align, alignSide) => {
41
34
  const alignTo = align[alignSide];
42
35
  const edge = ['center', 'middle'].includes(alignTo) && 'mid' || (alignSide === alignTo ? 'near' : 'far');
43
36
  return edge;
44
37
  };
38
+
45
39
  /**
46
40
  * Based on UDS's private getTooltipPosition but generalised.
47
41
  *
@@ -52,8 +46,6 @@ const getEdgeType = (align, alignSide) => {
52
46
  * before it is shown, which makes it account for the width being limiting in styles, custom font
53
47
  * rendering, etc.
54
48
  */
55
-
56
-
57
49
  function getOverlaidPosition(_ref2) {
58
50
  let {
59
51
  sourceLayout,
@@ -68,8 +60,9 @@ function getOverlaidPosition(_ref2) {
68
60
  const {
69
61
  scrollX = 0,
70
62
  scrollY = 0
71
- } = typeof window === 'object' ? window : {}; // Will have top, bottom, left and/or right offsets depending on `align`
63
+ } = typeof window === 'object' ? window : {};
72
64
 
65
+ // Will have top, bottom, left and/or right offsets depending on `align`
73
66
  const positioning = {};
74
67
  if (align.top) positioning.top = getPosition({
75
68
  edge: getEdgeType(align, 'top'),
@@ -101,20 +94,18 @@ function getOverlaidPosition(_ref2) {
101
94
  fromEdge: windowDimensions.width - (sourceLayout.x + scrollX + sourceLayout.width - (offsets.horizontal ?? 0)),
102
95
  sourceSize: sourceLayout.width
103
96
  });
104
-
105
97
  if (!(align.left && align.right)) {
106
98
  // Check if the position and/or width need adjusting to fit on the screen
107
99
  const side = align.right ? 'right' : 'left';
108
100
  const adjusted = adjustHorizontalToFit(positioning[side], windowDimensions.width, sourceLayout.width);
109
101
  if (typeof adjusted.width === 'number') positioning.width = adjusted.width;
110
-
111
102
  if (typeof adjusted.offset === 'number') {
112
103
  positioning[side] = adjusted.offset;
113
104
  }
114
105
  }
115
-
116
106
  return positioning;
117
107
  }
108
+
118
109
  /**
119
110
  * Positions an element in a modal or portal so that it appears tooltip-like below the
120
111
  * target element.
@@ -123,8 +114,6 @@ function getOverlaidPosition(_ref2) {
123
114
  * a small task because UDS's tooltip logic only really works for short text - it might be
124
115
  * better to use a third-party library).
125
116
  */
126
-
127
-
128
117
  const useOverlaidPosition = _ref3 => {
129
118
  let {
130
119
  isShown = false,
@@ -137,8 +126,9 @@ const useOverlaidPosition = _ref3 => {
137
126
  } = _ref3;
138
127
  // Element in main document flow that the targetRef element is positioned around
139
128
  const sourceRef = useRef(null);
140
- const [sourceLayout, setSourceLayout] = useState(null); // Element in a modal or portal overlay positioned to appear adjacent to sourceRef
129
+ const [sourceLayout, setSourceLayout] = useState(null);
141
130
 
131
+ // Element in a modal or portal overlay positioned to appear adjacent to sourceRef
142
132
  const targetRef = useRef(null);
143
133
  const [targetDimensions, setTargetDimensions] = useState(null);
144
134
  const [windowDimensions, setWindowDimensions] = useState(null);
@@ -163,7 +153,6 @@ const useOverlaidPosition = _ref3 => {
163
153
  height
164
154
  };
165
155
  }
166
-
167
156
  return previousDimensions;
168
157
  });
169
158
  }, []);
@@ -171,7 +160,6 @@ const useOverlaidPosition = _ref3 => {
171
160
  useEffect(() => {
172
161
  const handleDimensionsChange = _ref5 => {
173
162
  var _sourceRef$current;
174
-
175
163
  let {
176
164
  window
177
165
  } = _ref5;
@@ -186,12 +174,9 @@ const useOverlaidPosition = _ref3 => {
186
174
  });
187
175
  });
188
176
  };
189
-
190
177
  let subscription;
191
-
192
178
  const unsubscribe = () => {
193
179
  var _subscription;
194
-
195
180
  if (typeof ((_subscription = subscription) === null || _subscription === void 0 ? void 0 : _subscription.remove) === 'function') {
196
181
  // React Native >=0.65.0
197
182
  subscription.remove();
@@ -199,11 +184,9 @@ const useOverlaidPosition = _ref3 => {
199
184
  // React Native <0.65.0
200
185
  Dimensions.remove('change', handleDimensionsChange);
201
186
  }
202
-
203
187
  setSourceLayout(null);
204
188
  setTargetDimensions(null);
205
189
  };
206
-
207
190
  if (readyToShow) {
208
191
  subscription = Dimensions.addEventListener('change', handleDimensionsChange);
209
192
  handleDimensionsChange({
@@ -212,7 +195,6 @@ const useOverlaidPosition = _ref3 => {
212
195
  } else {
213
196
  unsubscribe();
214
197
  }
215
-
216
198
  return unsubscribe;
217
199
  }, [readyToShow]);
218
200
  const isReady = Boolean(isShown && sourceLayout && windowDimensions && targetDimensions);
@@ -231,5 +213,4 @@ const useOverlaidPosition = _ref3 => {
231
213
  isReady
232
214
  };
233
215
  };
234
-
235
216
  export default useOverlaidPosition;
@@ -1,5 +1,4 @@
1
1
  import { applyTextStyles, useTheme, useThemeTokens, useViewport } from '@telus-uds/components-base';
2
-
3
2
  const useTypographyTheme = (variant, tokens) => {
4
3
  const viewport = useViewport();
5
4
  const themeTokens = useThemeTokens('Typography', tokens, variant, {
@@ -12,13 +11,14 @@ const useTypographyTheme = (variant, tokens) => {
12
11
  fontSize,
13
12
  lineHeight,
14
13
  ...rnStyles
15
- } = applyTextStyles({ ...themeTokens,
14
+ } = applyTextStyles({
15
+ ...themeTokens,
16
16
  themeOptions
17
17
  });
18
- return { ...rnStyles,
18
+ return {
19
+ ...rnStyles,
19
20
  fontSize: `${fontSize}px`,
20
21
  lineHeight: `${lineHeight}px`
21
22
  };
22
23
  };
23
-
24
24
  export default useTypographyTheme;
package/package.json CHANGED
@@ -5,14 +5,14 @@
5
5
  ],
6
6
  "dependencies": {
7
7
  "@gorhom/portal": "^1.0.14",
8
- "@telus-uds/components-base": "1.65.0",
8
+ "@telus-uds/components-base": "1.67.0",
9
9
  "@telus-uds/system-constants": "^1.3.0",
10
10
  "fscreen": "^1.2.0",
11
11
  "lodash.omit": "^4.5.0",
12
12
  "react-dates": "^21.8.0",
13
13
  "react-helmet-async": "^1.3.0",
14
14
  "react-moment-proptypes": "^1.8.1",
15
- "@telus-uds/system-theme-tokens": "^2.42.0",
15
+ "@telus-uds/system-theme-tokens": "^2.44.0",
16
16
  "prop-types": "^15.7.2",
17
17
  "lodash.throttle": "^4.1.1",
18
18
  "react-youtube": "^10.1.0",
@@ -62,5 +62,5 @@
62
62
  "skip": true
63
63
  },
64
64
  "types": "types/index.d.ts",
65
- "version": "2.21.1"
65
+ "version": "2.22.0"
66
66
  }
@@ -46,8 +46,17 @@ const TopTextContainer = styled.div`
46
46
  margin-bottom: ${({ topTextMarginBottom }) => topTextMarginBottom};
47
47
  `
48
48
 
49
+ const PriceTextContainer = styled.div`
50
+ display: flex;
51
+ flex-direction: ${({ ratePosition }) => (ratePosition === 'bottom' ? 'column' : 'row')};
52
+ `
53
+
54
+ const RateContainer = styled.div`
55
+ display: flex;
56
+ `
57
+
49
58
  const RateTextContainer = styled.div`
50
- align-self: flex-end;
59
+ align-self: ${({ ratePosition }) => (ratePosition === 'bottom' ? 'flex-start' : 'flex-end')};
51
60
  `
52
61
 
53
62
  const StrikeThroughContainer = styled.div`
@@ -96,6 +105,7 @@ const PriceLockup = ({
96
105
  price,
97
106
  currencySymbol = '$',
98
107
  rateText,
108
+ ratePosition = 'right',
99
109
  bottomText,
100
110
  onClickFootnote,
101
111
  strikeThrough,
@@ -135,9 +145,13 @@ const PriceLockup = ({
135
145
  const amount = hasCents ? priceString.substring(0, separatorPosition) : priceString
136
146
  const cents = hasCents ? priceString.substring(separatorPosition + 1) : null
137
147
 
138
- const renderTypography = (value, tokens) => (
139
- <Typography tokens={{ ...tokens, color: fontColor }}>{value}</Typography>
140
- )
148
+ const renderTypography = (value, tokens, position) => {
149
+ const customProps =
150
+ position === 'bottom'
151
+ ? { variant: { size: 'micro' }, tokens: { color: fontColor } }
152
+ : { tokens: { ...tokens, color: fontColor } }
153
+ return <Typography {...customProps}>{value}</Typography>
154
+ }
141
155
 
142
156
  const renderCurrencySymbol = () =>
143
157
  renderTypography(`${currencySymbol}`, typographyTokens.dollarSign)
@@ -171,13 +185,20 @@ const PriceLockup = ({
171
185
  const renderPrice = () => (
172
186
  <>
173
187
  <PriceContainer priceMarginBottom={`${priceMarginBottom}px`}>
174
- {signDirection === 'left' && renderCurrencySymbol()}
175
- {renderAmount()}
176
- {cents && renderTypography(`${separator}${cents}`, typographyTokens.cents)}
177
- {signDirection === 'right' && <>&nbsp;{renderCurrencySymbol()}</>}
178
- {rateText && (
179
- <RateTextContainer>{renderTypography(rateText, typographyTokens.rate)}</RateTextContainer>
180
- )}
188
+ <PriceTextContainer ratePosition={ratePosition}>
189
+ <RateContainer>
190
+ {signDirection === 'left' && renderCurrencySymbol()}
191
+ {renderAmount()}
192
+ {cents && renderTypography(`${separator}${cents}`, typographyTokens.cents)}
193
+ {signDirection === 'right' && <>&nbsp;{renderCurrencySymbol()}</>}
194
+ </RateContainer>
195
+ {rateText && (
196
+ <RateTextContainer ratePosition={ratePosition}>
197
+ {renderTypography(rateText, typographyTokens.rate, ratePosition)}
198
+ </RateTextContainer>
199
+ )}
200
+ </PriceTextContainer>
201
+
181
202
  {!bottomText && footnoteLinks.length <= 3 && (
182
203
  <BottomLinksContainer bottomLinksMarginLeft={`${bottomLinksMarginLeft}px`}>
183
204
  {renderFootnoteLinks()}
@@ -259,6 +280,10 @@ PriceLockup.propTypes = {
259
280
  * Displays which side the currency should apperar (left, right)
260
281
  */
261
282
  signDirection: PropTypes.oneOf(['right', 'left']),
283
+ /**
284
+ * Displays where the rate should apperar (bottom, right)
285
+ */
286
+ ratePosition: PropTypes.oneOf(['right', 'bottom']),
262
287
  /**
263
288
  * Shows additional link for context
264
289
  */
@@ -31,6 +31,7 @@ export {
31
31
  InputSupports,
32
32
  Link,
33
33
  Listbox,
34
+ Modal,
34
35
  MultiSelectFilter,
35
36
  Notification,
36
37
  Pagination,
package/src/index.js CHANGED
@@ -1,5 +1,4 @@
1
1
  export { default as Badge } from './Badge'
2
- export { default as Modal } from './Modal'
3
2
  export { default as OrderedList } from './OrderedList'
4
3
  export { default as PreviewCard } from './PreviewCard'
5
4
  export { default as ResponsiveImage } from './ResponsiveImage'