@telus-uds/components-web 2.33.2 → 2.34.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 (192) hide show
  1. package/CHANGELOG.md +20 -3
  2. package/lib/Badge/Badge.js +4 -2
  3. package/lib/BlockQuote/BlockQuote.js +4 -2
  4. package/lib/Breadcrumbs/Breadcrumbs.js +7 -5
  5. package/lib/Breadcrumbs/Item/Item.js +2 -13
  6. package/lib/Callout/Callout.js +4 -2
  7. package/lib/Card/Card.js +3 -5
  8. package/lib/Card/CardContent.js +4 -2
  9. package/lib/Countdown/Countdown.js +2 -6
  10. package/lib/Countdown/Segment.js +4 -2
  11. package/lib/DatePicker/CalendarContainer.js +2 -2
  12. package/lib/DatePicker/DatePicker.js +21 -35
  13. package/lib/Disclaimer/Disclaimer.js +4 -2
  14. package/lib/ExpandCollapseMini/ExpandCollapseMini.js +5 -11
  15. package/lib/ExpandCollapseMini/ExpandCollapseMiniControl.js +4 -2
  16. package/lib/Footnote/Footnote.js +32 -37
  17. package/lib/Footnote/FootnoteLink.js +5 -6
  18. package/lib/IconButton/IconButton.js +4 -11
  19. package/lib/Image/Image.js +5 -3
  20. package/lib/List/ListItem.js +2 -7
  21. package/lib/NavigationBar/NavigationBar.js +8 -18
  22. package/lib/NavigationBar/NavigationItem.js +4 -9
  23. package/lib/NavigationBar/NavigationSubMenu.js +8 -7
  24. package/lib/NavigationBar/index.js +2 -0
  25. package/lib/OptimizeImage/OptimizeImage.js +8 -8
  26. package/lib/OrderedList/Item.js +3 -9
  27. package/lib/OrderedList/OrderedList.js +5 -13
  28. package/lib/OrderedList/OrderedListBase.js +3 -8
  29. package/lib/Paragraph/Paragraph.js +5 -3
  30. package/lib/PreviewCard/PreviewCard.js +3 -5
  31. package/lib/PriceLockup/PriceLockup.js +4 -2
  32. package/lib/Progress/ProgressBar.js +4 -2
  33. package/lib/QuantitySelector/QuantitySelector.js +21 -24
  34. package/lib/QuantitySelector/SideButton.js +12 -20
  35. package/lib/ResponsiveImage/ResponsiveImage.js +4 -2
  36. package/lib/Ribbon/Ribbon.js +4 -2
  37. package/lib/SkeletonProvider/SkeletonImage.js +5 -3
  38. package/lib/SkeletonProvider/SkeletonProvider.js +3 -5
  39. package/lib/SkeletonProvider/SkeletonTypography.js +5 -3
  40. package/lib/Span/Span.js +5 -3
  41. package/lib/Spinner/Spinner.js +4 -2
  42. package/lib/Spinner/SpinnerContent.js +4 -2
  43. package/lib/StoryCard/StoryCard.js +3 -5
  44. package/lib/Table/Body.js +4 -2
  45. package/lib/Table/Cell.js +5 -3
  46. package/lib/Table/Header.js +6 -6
  47. package/lib/Table/Row.js +6 -6
  48. package/lib/Table/SubHeading.js +6 -6
  49. package/lib/Table/Table.js +6 -8
  50. package/lib/TermsAndConditions/ExpandCollapse.js +2 -7
  51. package/lib/TermsAndConditions/TermsAndConditions.js +5 -14
  52. package/lib/Testimonial/Testimonial.js +4 -2
  53. package/lib/Toast/Toast.js +4 -2
  54. package/lib/Video/Video.js +19 -55
  55. package/lib/VideoPicker/VideoPicker.js +38 -9
  56. package/lib/VideoPicker/VideoPickerPlayer.js +4 -2
  57. package/lib/VideoPicker/VideoPickerThumbnail.js +4 -2
  58. package/lib/VideoPicker/VideoSlider.js +7 -7
  59. package/lib/WaffleGrid/WaffleGrid.js +4 -2
  60. package/lib/WebVideo/WebVideo.js +51 -13
  61. package/lib/WebVideo/utils/index.js +58 -0
  62. package/lib/baseExports.js +6 -0
  63. package/lib/utils/theming/with-client-theme.js +1 -1
  64. package/lib/utils/theming/with-server-theme.js +1 -1
  65. package/lib-module/Badge/Badge.js +4 -2
  66. package/lib-module/BlockQuote/BlockQuote.js +4 -2
  67. package/lib-module/Breadcrumbs/Breadcrumbs.js +7 -5
  68. package/lib-module/Breadcrumbs/Item/Item.js +2 -11
  69. package/lib-module/Callout/Callout.js +4 -2
  70. package/lib-module/Card/Card.js +2 -3
  71. package/lib-module/Card/CardContent.js +4 -2
  72. package/lib-module/Countdown/Countdown.js +2 -3
  73. package/lib-module/Countdown/Segment.js +4 -2
  74. package/lib-module/DatePicker/CalendarContainer.js +2 -2
  75. package/lib-module/DatePicker/DatePicker.js +21 -33
  76. package/lib-module/Disclaimer/Disclaimer.js +4 -2
  77. package/lib-module/ExpandCollapseMini/ExpandCollapseMini.js +5 -9
  78. package/lib-module/ExpandCollapseMini/ExpandCollapseMiniControl.js +4 -2
  79. package/lib-module/Footnote/Footnote.js +31 -36
  80. package/lib-module/Footnote/FootnoteLink.js +5 -7
  81. package/lib-module/IconButton/IconButton.js +4 -9
  82. package/lib-module/Image/Image.js +5 -3
  83. package/lib-module/List/ListItem.js +2 -5
  84. package/lib-module/NavigationBar/NavigationBar.js +9 -17
  85. package/lib-module/NavigationBar/NavigationItem.js +5 -8
  86. package/lib-module/NavigationBar/NavigationSubMenu.js +9 -6
  87. package/lib-module/NavigationBar/index.js +2 -0
  88. package/lib-module/OptimizeImage/OptimizeImage.js +8 -6
  89. package/lib-module/OrderedList/Item.js +3 -7
  90. package/lib-module/OrderedList/OrderedList.js +6 -12
  91. package/lib-module/OrderedList/OrderedListBase.js +3 -6
  92. package/lib-module/Paragraph/Paragraph.js +6 -4
  93. package/lib-module/PreviewCard/PreviewCard.js +2 -3
  94. package/lib-module/PriceLockup/PriceLockup.js +4 -2
  95. package/lib-module/Progress/ProgressBar.js +4 -2
  96. package/lib-module/QuantitySelector/QuantitySelector.js +22 -23
  97. package/lib-module/QuantitySelector/SideButton.js +13 -21
  98. package/lib-module/ResponsiveImage/ResponsiveImage.js +4 -2
  99. package/lib-module/Ribbon/Ribbon.js +4 -2
  100. package/lib-module/SkeletonProvider/SkeletonImage.js +5 -3
  101. package/lib-module/SkeletonProvider/SkeletonProvider.js +3 -3
  102. package/lib-module/SkeletonProvider/SkeletonTypography.js +5 -3
  103. package/lib-module/Span/Span.js +6 -4
  104. package/lib-module/Spinner/Spinner.js +4 -2
  105. package/lib-module/Spinner/SpinnerContent.js +4 -2
  106. package/lib-module/StoryCard/StoryCard.js +2 -3
  107. package/lib-module/Table/Body.js +4 -2
  108. package/lib-module/Table/Cell.js +5 -3
  109. package/lib-module/Table/Header.js +6 -4
  110. package/lib-module/Table/Row.js +6 -4
  111. package/lib-module/Table/SubHeading.js +6 -4
  112. package/lib-module/Table/Table.js +6 -6
  113. package/lib-module/TermsAndConditions/ExpandCollapse.js +2 -5
  114. package/lib-module/TermsAndConditions/TermsAndConditions.js +5 -12
  115. package/lib-module/Testimonial/Testimonial.js +4 -2
  116. package/lib-module/Toast/Toast.js +4 -2
  117. package/lib-module/Video/Video.js +19 -53
  118. package/lib-module/VideoPicker/VideoPicker.js +37 -8
  119. package/lib-module/VideoPicker/VideoPickerPlayer.js +4 -2
  120. package/lib-module/VideoPicker/VideoPickerThumbnail.js +4 -2
  121. package/lib-module/VideoPicker/VideoSlider.js +7 -5
  122. package/lib-module/WaffleGrid/WaffleGrid.js +4 -2
  123. package/lib-module/WebVideo/WebVideo.js +51 -11
  124. package/lib-module/WebVideo/utils/index.js +50 -0
  125. package/lib-module/baseExports.js +1 -1
  126. package/lib-module/utils/theming/with-client-theme.js +2 -2
  127. package/lib-module/utils/theming/with-server-theme.js +2 -2
  128. package/package.json +3 -3
  129. package/src/Badge/Badge.jsx +5 -2
  130. package/src/BlockQuote/BlockQuote.jsx +120 -112
  131. package/src/Breadcrumbs/Breadcrumbs.jsx +84 -77
  132. package/src/Breadcrumbs/Item/Item.jsx +2 -9
  133. package/src/Callout/Callout.jsx +37 -40
  134. package/src/Card/Card.jsx +2 -3
  135. package/src/Card/CardContent.jsx +19 -14
  136. package/src/Countdown/Countdown.jsx +72 -71
  137. package/src/Countdown/Segment.jsx +40 -28
  138. package/src/DatePicker/CalendarContainer.jsx +2 -2
  139. package/src/DatePicker/DatePicker.jsx +21 -34
  140. package/src/Disclaimer/Disclaimer.jsx +5 -3
  141. package/src/ExpandCollapseMini/ExpandCollapseMini.jsx +37 -40
  142. package/src/ExpandCollapseMini/ExpandCollapseMiniControl.jsx +52 -44
  143. package/src/Footnote/Footnote.jsx +32 -38
  144. package/src/Footnote/FootnoteLink.jsx +41 -49
  145. package/src/IconButton/IconButton.jsx +19 -20
  146. package/src/Image/Image.jsx +40 -43
  147. package/src/List/ListItem.jsx +3 -5
  148. package/src/NavigationBar/NavigationBar.jsx +9 -18
  149. package/src/NavigationBar/NavigationItem.jsx +6 -5
  150. package/src/NavigationBar/NavigationSubMenu.jsx +104 -88
  151. package/src/NavigationBar/index.js +3 -0
  152. package/src/OptimizeImage/OptimizeImage.jsx +48 -41
  153. package/src/OrderedList/Item.jsx +34 -35
  154. package/src/OrderedList/OrderedList.jsx +4 -6
  155. package/src/OrderedList/OrderedListBase.jsx +2 -3
  156. package/src/Paragraph/Paragraph.jsx +21 -16
  157. package/src/PreviewCard/PreviewCard.jsx +2 -3
  158. package/src/PriceLockup/PriceLockup.jsx +143 -136
  159. package/src/Progress/ProgressBar.jsx +11 -3
  160. package/src/QuantitySelector/QuantitySelector.jsx +162 -154
  161. package/src/QuantitySelector/SideButton.jsx +52 -56
  162. package/src/ResponsiveImage/ResponsiveImage.jsx +16 -22
  163. package/src/Ribbon/Ribbon.jsx +85 -83
  164. package/src/SkeletonProvider/SkeletonImage.jsx +24 -15
  165. package/src/SkeletonProvider/SkeletonProvider.jsx +3 -3
  166. package/src/SkeletonProvider/SkeletonTypography.jsx +18 -13
  167. package/src/Span/Span.jsx +7 -5
  168. package/src/Spinner/Spinner.jsx +86 -79
  169. package/src/Spinner/SpinnerContent.jsx +31 -33
  170. package/src/StoryCard/StoryCard.jsx +2 -3
  171. package/src/Table/Body.jsx +5 -3
  172. package/src/Table/Cell.jsx +77 -67
  173. package/src/Table/Header.jsx +7 -5
  174. package/src/Table/Row.jsx +7 -5
  175. package/src/Table/SubHeading.jsx +7 -5
  176. package/src/Table/Table.jsx +6 -6
  177. package/src/TermsAndConditions/ExpandCollapse.jsx +2 -6
  178. package/src/TermsAndConditions/TermsAndConditions.jsx +5 -13
  179. package/src/Testimonial/Testimonial.jsx +148 -137
  180. package/src/Toast/Toast.jsx +68 -63
  181. package/src/Video/Video.jsx +25 -45
  182. package/src/VideoPicker/VideoPicker.jsx +114 -75
  183. package/src/VideoPicker/VideoPickerPlayer.jsx +13 -9
  184. package/src/VideoPicker/VideoPickerThumbnail.jsx +102 -94
  185. package/src/VideoPicker/VideoSlider.jsx +8 -6
  186. package/src/WaffleGrid/WaffleGrid.jsx +36 -40
  187. package/src/WebVideo/WebVideo.jsx +114 -60
  188. package/src/WebVideo/utils/index.js +56 -0
  189. package/src/baseExports.js +1 -0
  190. package/src/utils/theming/with-client-theme.jsx +2 -2
  191. package/src/utils/theming/with-server-theme.jsx +2 -2
  192. package/types/WebVideo.d.ts +2 -1
@@ -1,10 +1,11 @@
1
1
  import { selectSystemProps } from '@telus-uds/components-base';
2
2
  import PropTypes from 'prop-types';
3
- import React, { useState } from 'react';
3
+ import React from 'react';
4
4
  import YouTube from 'react-youtube';
5
5
  import styled from 'styled-components';
6
6
  import VideoSplash from '../shared/VideoSplash/VideoSplash';
7
7
  import { htmlAttrs } from '../utils';
8
+ import { triggerInProgressVideoIntervals, YoutubePlayerState } from './utils';
8
9
  import { jsx as _jsx } from "react/jsx-runtime";
9
10
  const [selectProps, selectedSystemPropTypes] = selectSystemProps([htmlAttrs]);
10
11
  const StyledPlayerContainer = /*#__PURE__*/styled.div.withConfig({
@@ -43,7 +44,7 @@ const AspectLimiter = /*#__PURE__*/styled.div.withConfig({
43
44
  ...aspectRatios[props.aspectRatio],
44
45
  position: 'relative'
45
46
  }));
46
- const WebVideo = _ref => {
47
+ const WebVideo = /*#__PURE__*/React.forwardRef((_ref, ref) => {
47
48
  let {
48
49
  videoId,
49
50
  aspectRatio = '16:9',
@@ -52,15 +53,29 @@ const WebVideo = _ref => {
52
53
  beginMuted = false,
53
54
  videoLength,
54
55
  copy,
55
- onPlay,
56
- onPause,
57
- onEnd,
56
+ onPlay = () => {},
57
+ onPause = () => {},
58
+ onEnd = () => {},
59
+ onProgress = () => {},
58
60
  onStart = () => {},
59
61
  ...rest
60
62
  } = _ref;
61
- const [started, setStarted] = useState(false);
63
+ const [started, setStarted] = React.useState(false);
64
+ const videoStateData = React.useRef({
65
+ requestAnimationIds: [],
66
+ state: YoutubePlayerState.UNSTARTED
67
+ });
68
+ const playerRef = React.useRef(null);
69
+ const onPlayCallback = event => {
70
+ onPlay(event, videoStateData.current.state === YoutubePlayerState.PAUSED);
71
+ videoStateData.current.state = YoutubePlayerState.PLAYING;
72
+ if (onProgress) {
73
+ videoStateData.current.requestAnimationIds = triggerInProgressVideoIntervals(onProgress, playerRef, event);
74
+ }
75
+ };
62
76
  const initializeYoutubePlayer = event => {
63
77
  onStart();
78
+ playerRef.current = event.target;
64
79
  if (beginMuted) {
65
80
  event.target.mute();
66
81
  }
@@ -68,7 +83,23 @@ const WebVideo = _ref => {
68
83
  event.target.playVideo(); // This plays the video after passing the splash screen on mobile.
69
84
  };
70
85
 
86
+ const onEndVideoCallback = event => {
87
+ onEnd(event);
88
+ videoStateData.current.requestAnimationIds.forEach(id => cancelAnimationFrame(id));
89
+ videoStateData.current.requestAnimationIds = [];
90
+ videoStateData.current.state = YoutubePlayerState.ENDED;
91
+ if (onProgress) {
92
+ onProgress(event, 100);
93
+ }
94
+ };
95
+ const onPauseVideoCallback = event => {
96
+ videoStateData.current.requestAnimationIds.forEach(id => cancelAnimationFrame(id));
97
+ onPause(event);
98
+ videoStateData.current.state = YoutubePlayerState.PAUSED;
99
+ videoStateData.current.requestAnimationIds = [];
100
+ };
71
101
  return /*#__PURE__*/_jsx(StyledPlayerContainer, {
102
+ ref: ref,
72
103
  "data-testid": "web-video-container",
73
104
  ...selectProps(rest),
74
105
  children: /*#__PURE__*/_jsx(AspectLimiter, {
@@ -86,9 +117,9 @@ const WebVideo = _ref => {
86
117
  }
87
118
  },
88
119
  onReady: initializeYoutubePlayer,
89
- onPlay: onPlay,
90
- onPause: onPause,
91
- onEnd: onEnd
120
+ onPlay: onPlayCallback,
121
+ onPause: onPauseVideoCallback,
122
+ onEnd: onEndVideoCallback
92
123
  }) : /*#__PURE__*/_jsx(VideoSplash, {
93
124
  poster: posterSrc || `https://img.youtube.com/vi/${videoId}/maxresdefault.jpg`,
94
125
  videoLength: videoLength,
@@ -99,7 +130,8 @@ const WebVideo = _ref => {
99
130
  })
100
131
  })
101
132
  });
102
- };
133
+ });
134
+ WebVideo.displayName = 'WebVideo';
103
135
  export const VideoProps = {
104
136
  ...selectedSystemPropTypes,
105
137
  /**
@@ -145,7 +177,15 @@ export const VideoProps = {
145
177
  /**
146
178
  * A function to be run when the video ends.
147
179
  */
148
- onEnd: PropTypes.func
180
+ onEnd: PropTypes.func,
181
+ /**
182
+ * A function to be run when the video resumes.
183
+ */
184
+ onResume: PropTypes.func,
185
+ /**
186
+ * A function to be run when the video progresses. This function will be run at 10%, 25%, 50%, 75% and 100%.
187
+ */
188
+ onProgress: PropTypes.func
149
189
  };
150
190
  WebVideo.propTypes = VideoProps;
151
191
  export default WebVideo;
@@ -0,0 +1,50 @@
1
+ /**
2
+ * Fires analytics events for inProgress analytics
3
+ * @param {current progress} progress
4
+ * @param {callback to run on defined milestones} onProgress
5
+ * @param {YouTube Video Event} event
6
+ */
7
+ const fireVideoProgressEvents = (progress, onProgress, event) => {
8
+ const validProgressValues = [10, 25, 50, 75];
9
+ if (validProgressValues.includes(progress)) {
10
+ onProgress(event, progress);
11
+ }
12
+ };
13
+ export const YoutubePlayerState = {
14
+ UNSTARTED: -1,
15
+ ENDED: 0,
16
+ PLAYING: 1,
17
+ PAUSED: 2,
18
+ BUFFERING: 3,
19
+ CUED: 5
20
+ };
21
+ const PERCENTAGE_MULTIPLIER = 100;
22
+ /**
23
+ * Run an interval to check the progress of the video and fire events at 10%, 25%, 50% and 75%
24
+ * @param {callback to run on defined milestones} onProgress
25
+ * @param {player reference} playerRef
26
+ * @param {YouTube video event} event
27
+ */
28
+ export const triggerInProgressVideoIntervals = (onProgress, playerRef, event) => {
29
+ const duration = playerRef.current.getDuration();
30
+ let lastProgress = null;
31
+ const requestAnimationFrameIds = [];
32
+ const frame = () => {
33
+ const currentTime = playerRef.current.getCurrentTime();
34
+ const progress = Math.round(currentTime / duration * PERCENTAGE_MULTIPLIER);
35
+ if (progress !== lastProgress) {
36
+ fireVideoProgressEvents(progress, onProgress, event);
37
+ lastProgress = progress;
38
+ }
39
+ if (currentTime < duration) {
40
+ requestAnimationFrameIds.push(requestAnimationFrame(frame));
41
+ }
42
+ };
43
+
44
+ // Cancel any previous animation frames
45
+ requestAnimationFrameIds.forEach(id => cancelAnimationFrame(id));
46
+
47
+ // Start a new animation frame
48
+ requestAnimationFrameIds.push(requestAnimationFrame(frame));
49
+ return requestAnimationFrameIds;
50
+ };
@@ -5,7 +5,7 @@ export {
5
5
  /**
6
6
  * Most base components should be re-exported as-is.
7
7
  */
8
- A11yText, ActivityIndicator, Autocomplete, Box, Button, BaseProvider, A11yInfoProvider, ViewportProvider, ThemeProvider, ButtonDropdown, ButtonGroup, ButtonLink, Carousel, CarouselTabs, Checkbox, CheckboxGroup, ChevronLink, ColourToggle, Divider, ExpandCollapse, Feedback, FlexGrid, Icon, InputLabel, InputSupports, Link, Listbox, Modal, MultiSelectFilter, Notification, Pagination, Portal, QuickLinks, QuickLinksFeature, Radio, RadioGroup, RadioCard, RadioCardGroup, Responsive, Search, Select, SideNav, Skeleton, SkipLink, Spacer, StackView, StackWrap, StepTracker, Tabs, Tags, TextButton, TextArea, TextInput, Timeline, ToggleSwitch, ToggleSwitchGroup, TooltipButton, Tooltip, Typography, Validator,
8
+ A11yText, ActivityIndicator, Autocomplete, Box, Button, BaseProvider, A11yInfoProvider, ViewportProvider, ThemeProvider, ButtonDropdown, ButtonGroup, ButtonLink, CardGroup, Carousel, CarouselTabs, Checkbox, CheckboxGroup, ChevronLink, ColourToggle, Divider, ExpandCollapse, Feedback, FlexGrid, Icon, InputLabel, InputSupports, Link, Listbox, Modal, MultiSelectFilter, Notification, Pagination, Portal, QuickLinks, QuickLinksFeature, Radio, RadioGroup, RadioCard, RadioCardGroup, Responsive, Search, Select, SideNav, Skeleton, SkipLink, Spacer, StackView, StackWrap, StepTracker, Tabs, Tags, TextButton, TextArea, TextInput, Timeline, ToggleSwitch, ToggleSwitchGroup, TooltipButton, Tooltip, Typography, Validator,
9
9
  /*
10
10
  * Most utilities exported from @telus-uds/components-base are for building systems, not apps.
11
11
  * Re-export only those utilities with a stable API and known use cases within apps / pages.
@@ -1,6 +1,6 @@
1
1
  import React from 'react';
2
2
  import PropTypes from 'prop-types';
3
- import { useThemeTokens } from '@telus-uds/components-base';
3
+ import { getTokensPropType, useThemeTokens } from '@telus-uds/components-base';
4
4
  import { jsx as _jsx } from "react/jsx-runtime";
5
5
  const withClientTheme = Component => {
6
6
  const UdsStyledComponent = _ref => {
@@ -16,7 +16,7 @@ const withClientTheme = Component => {
16
16
  });
17
17
  };
18
18
  UdsStyledComponent.propTypes = {
19
- tokens: PropTypes.oneOfType([PropTypes.func, PropTypes.object]),
19
+ tokens: getTokensPropType(Component.displayName),
20
20
  variant: PropTypes.string
21
21
  };
22
22
  return UdsStyledComponent;
@@ -1,6 +1,6 @@
1
1
  import React from 'react';
2
2
  import PropTypes from 'prop-types';
3
- import { getThemeTokens } from '@telus-uds/components-base/server';
3
+ import { getThemeTokens, getTokensPropType } from '@telus-uds/components-base/server';
4
4
  import getTheme from './get-theme-from-server';
5
5
  import { jsx as _jsx } from "react/jsx-runtime";
6
6
  const withServerTheme = (Component, componentName) => {
@@ -18,7 +18,7 @@ const withServerTheme = (Component, componentName) => {
18
18
  });
19
19
  };
20
20
  UdsStyledComponent.propTypes = {
21
- tokens: PropTypes.oneOfType([PropTypes.func, PropTypes.object]),
21
+ tokens: getTokensPropType(componentName),
22
22
  variant: PropTypes.string
23
23
  };
24
24
  return UdsStyledComponent;
package/package.json CHANGED
@@ -5,7 +5,7 @@
5
5
  ],
6
6
  "dependencies": {
7
7
  "@gorhom/portal": "^1.0.14",
8
- "@telus-uds/components-base": "1.84.0",
8
+ "@telus-uds/components-base": "1.85.0",
9
9
  "@telus-uds/system-constants": "^1.3.0",
10
10
  "fscreen": "^1.2.0",
11
11
  "lodash.omit": "^4.5.0",
@@ -13,7 +13,7 @@
13
13
  "react-dates": "^21.8.0",
14
14
  "react-helmet-async": "^1.3.0",
15
15
  "react-moment-proptypes": "^1.8.1",
16
- "@telus-uds/system-theme-tokens": "^2.55.0",
16
+ "@telus-uds/system-theme-tokens": "^2.56.0",
17
17
  "prop-types": "^15.7.2",
18
18
  "lodash.throttle": "^4.1.1",
19
19
  "react-youtube": "^10.1.0",
@@ -83,5 +83,5 @@
83
83
  "skip": true
84
84
  },
85
85
  "types": "types/index.d.ts",
86
- "version": "2.33.2"
86
+ "version": "2.34.0"
87
87
  }
@@ -35,7 +35,7 @@ const fontSizeMapping = {
35
35
  16: 'h6'
36
36
  }
37
37
 
38
- const Badge = ({ children, tokens, variant = {}, ...rest }) => {
38
+ const Badge = React.forwardRef(({ children, tokens, variant = {}, ...rest }, ref) => {
39
39
  const {
40
40
  backgroundColor,
41
41
  gradient,
@@ -74,6 +74,7 @@ const Badge = ({ children, tokens, variant = {}, ...rest }) => {
74
74
  fontWeight={fontWeight}
75
75
  gradient={semanticGradient}
76
76
  border={`${borderWidth}px solid ${borderColor}`}
77
+ ref={ref}
77
78
  {...selectProps(rest)}
78
79
  >
79
80
  <Typography
@@ -84,7 +85,9 @@ const Badge = ({ children, tokens, variant = {}, ...rest }) => {
84
85
  </Typography>
85
86
  </BadgeContainer>
86
87
  )
87
- }
88
+ })
89
+
90
+ Badge.displayName = 'Badge'
88
91
 
89
92
  Badge.propTypes = {
90
93
  ...selectedSystemPropTypes,
@@ -38,132 +38,140 @@ const QuoteContainer = styled.div`
38
38
  margin-bottom: ${({ marginBottom }) => `${marginBottom}px`};
39
39
  `
40
40
 
41
- const BlockQuote = ({
42
- children,
43
- link,
44
- additionalInfo,
45
- linkHref,
46
- textStyle = 'large',
47
- LinkRouter,
48
- linkRouterProps,
49
- tokens,
50
- variant,
51
- ...rest
52
- }) => {
53
- const viewport = useViewport()
54
- const {
55
- color,
56
- paddingTop,
57
- paddingBottom,
58
- paddingLeft,
59
- paddingRight,
60
- marginBottom,
61
- width,
62
- backgroundGradient,
63
- titleHeadingFontSize,
64
- titleHeadingFontName,
65
- titleHeadingFontWeight,
66
- titleHeadingLineHeight,
67
- titleFontSize,
68
- titleFontName,
69
- titleFontWeight,
70
- titleLineHeight,
71
- linkFontSize,
72
- linkFontName,
73
- linkFontWeight,
74
- linkLineHeight
75
- } = useThemeTokens('BlockQuote', tokens, variant, {
76
- viewport
77
- })
78
- const mappedTextSize = textStyle === 'heading' ? 'h3' : textStyle
79
- const titleTokens =
80
- textStyle === 'heading'
81
- ? {
82
- fontSize: titleHeadingFontSize,
83
- fontName: titleHeadingFontName,
84
- fontWeight: titleHeadingFontWeight,
85
- lineHeight: titleHeadingLineHeight
86
- }
87
- : {
88
- fontSize: titleFontSize,
89
- fontName: titleFontName,
90
- fontWeight: titleFontWeight,
91
- lineHeight: titleLineHeight
92
- }
93
- const renderLink = () => {
94
- if (linkHref) {
41
+ const BlockQuote = React.forwardRef(
42
+ (
43
+ {
44
+ children,
45
+ link,
46
+ additionalInfo,
47
+ linkHref,
48
+ textStyle = 'large',
49
+ LinkRouter,
50
+ linkRouterProps,
51
+ tokens,
52
+ variant,
53
+ ...rest
54
+ },
55
+ ref
56
+ ) => {
57
+ const viewport = useViewport()
58
+ const {
59
+ color,
60
+ paddingTop,
61
+ paddingBottom,
62
+ paddingLeft,
63
+ paddingRight,
64
+ marginBottom,
65
+ width,
66
+ backgroundGradient,
67
+ titleHeadingFontSize,
68
+ titleHeadingFontName,
69
+ titleHeadingFontWeight,
70
+ titleHeadingLineHeight,
71
+ titleFontSize,
72
+ titleFontName,
73
+ titleFontWeight,
74
+ titleLineHeight,
75
+ linkFontSize,
76
+ linkFontName,
77
+ linkFontWeight,
78
+ linkLineHeight
79
+ } = useThemeTokens('BlockQuote', tokens, variant, {
80
+ viewport
81
+ })
82
+ const mappedTextSize = textStyle === 'heading' ? 'h3' : textStyle
83
+ const titleTokens =
84
+ textStyle === 'heading'
85
+ ? {
86
+ fontSize: titleHeadingFontSize,
87
+ fontName: titleHeadingFontName,
88
+ fontWeight: titleHeadingFontWeight,
89
+ lineHeight: titleHeadingLineHeight
90
+ }
91
+ : {
92
+ fontSize: titleFontSize,
93
+ fontName: titleFontName,
94
+ fontWeight: titleFontWeight,
95
+ lineHeight: titleLineHeight
96
+ }
97
+ const renderLink = () => {
98
+ if (linkHref) {
99
+ return (
100
+ <Link
101
+ href={linkHref}
102
+ tokens={{
103
+ blockFontSize: linkFontSize,
104
+ blockFontName: linkFontName,
105
+ blockFontWeight: linkFontWeight,
106
+ blockLineHeight: linkLineHeight,
107
+ color
108
+ }}
109
+ variant={{ alternative: true }}
110
+ LinkRouter={LinkRouter}
111
+ linkRouterProps={linkRouterProps}
112
+ >
113
+ {link}
114
+ </Link>
115
+ )
116
+ }
117
+
95
118
  return (
96
- <Link
97
- href={linkHref}
119
+ <Typography
98
120
  tokens={{
99
- blockFontSize: linkFontSize,
100
- blockFontName: linkFontName,
101
- blockFontWeight: linkFontWeight,
102
- blockLineHeight: linkLineHeight,
103
- color
121
+ color,
122
+ fontName: linkFontName,
123
+ fontSize: linkFontSize,
124
+ fontWeight: linkFontWeight,
125
+ lineHeight: linkLineHeight
104
126
  }}
105
- variant={{ alternative: true }}
106
- LinkRouter={LinkRouter}
107
- linkRouterProps={linkRouterProps}
108
127
  >
109
128
  {link}
110
- </Link>
129
+ </Typography>
111
130
  )
112
131
  }
113
132
 
114
- return (
115
- <Typography
116
- tokens={{
117
- color,
118
- fontName: linkFontName,
119
- fontSize: linkFontSize,
120
- fontWeight: linkFontWeight,
121
- lineHeight: linkLineHeight
122
- }}
123
- >
124
- {link}
125
- </Typography>
126
- )
127
- }
133
+ const renderQuote = () => {
134
+ const quote = (
135
+ <Typography tokens={{ color, ...titleTokens }} variant={{ size: mappedTextSize }}>
136
+ {children}
137
+ </Typography>
138
+ )
128
139
 
129
- const renderQuote = () => {
130
- const quote = (
131
- <Typography tokens={{ color, ...titleTokens }} variant={{ size: mappedTextSize }}>
132
- {children}
133
- </Typography>
134
- )
140
+ if (additionalInfo || link) {
141
+ return <QuoteContainer marginBottom={marginBottom}>{quote}</QuoteContainer>
142
+ }
135
143
 
136
- if (additionalInfo || link) {
137
- return <QuoteContainer marginBottom={marginBottom}>{quote}</QuoteContainer>
144
+ return quote
138
145
  }
139
146
 
140
- return quote
147
+ return (
148
+ <BlockQuoteContainer
149
+ {...selectProps(rest)}
150
+ paddingTop={paddingTop}
151
+ paddingBottom={paddingBottom}
152
+ paddingLeft={paddingLeft}
153
+ paddingRight={paddingRight}
154
+ width={width}
155
+ backgroundGradient={backgroundGradient}
156
+ ref={ref}
157
+ >
158
+ {renderQuote()}
159
+ {(additionalInfo || link) && (
160
+ <StackView space={0}>
161
+ {link && renderLink()}
162
+ {additionalInfo && (
163
+ <Typography tokens={{ color }} variant={{ size: 'small' }}>
164
+ {additionalInfo}
165
+ </Typography>
166
+ )}
167
+ </StackView>
168
+ )}
169
+ </BlockQuoteContainer>
170
+ )
141
171
  }
172
+ )
142
173
 
143
- return (
144
- <BlockQuoteContainer
145
- {...selectProps(rest)}
146
- paddingTop={paddingTop}
147
- paddingBottom={paddingBottom}
148
- paddingLeft={paddingLeft}
149
- paddingRight={paddingRight}
150
- width={width}
151
- backgroundGradient={backgroundGradient}
152
- >
153
- {renderQuote()}
154
- {(additionalInfo || link) && (
155
- <StackView space={0}>
156
- {link && renderLink()}
157
- {additionalInfo && (
158
- <Typography tokens={{ color }} variant={{ size: 'small' }}>
159
- {additionalInfo}
160
- </Typography>
161
- )}
162
- </StackView>
163
- )}
164
- </BlockQuoteContainer>
165
- )
166
- }
174
+ BlockQuote.displayName = 'BlockQuote'
167
175
 
168
176
  BlockQuote.propTypes = {
169
177
  ...selectedSystemPropTypes,