@telus-uds/components-web 2.33.2 → 2.34.1

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 +29 -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 +9 -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 +9 -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 +45 -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
@@ -68,81 +68,91 @@ const createStyledCell = (htmlElement) => styled[htmlElement]`
68
68
  const StyledHeaderCell = createStyledCell('th')
69
69
  const StyledDataCell = createStyledCell('td')
70
70
 
71
- const Cell = ({ children, isFirstInRow, align = 'left', tokens: cellTokens, type = 'default' }) => {
72
- const { text, isScrollable: isTableScrollable, tokens: tableTokens, spacing } = useTableContext()
73
- const themeTokens = { ...tableTokens, ...cellTokens }
71
+ const Cell = React.forwardRef(
72
+ ({ children, isFirstInRow, align = 'left', tokens: cellTokens, type = 'default' }, ref) => {
73
+ const {
74
+ text,
75
+ isScrollable: isTableScrollable,
76
+ tokens: tableTokens,
77
+ spacing
78
+ } = useTableContext()
79
+ const themeTokens = { ...tableTokens, ...cellTokens }
74
80
 
75
- const {
76
- cellMinWidth,
77
- cellBoxShadowColor,
78
- cellBackground,
79
- cellStickyShadow,
80
- cellPaddingTop,
81
- cellPaddingRight,
82
- cellPaddingLeft,
83
- cellPaddingBottom,
84
- fontName,
85
- fontWeight,
86
- fontSize,
87
- lineHeight,
88
- stickyBackgroundColor,
89
- fontColor,
90
- display
91
- } = useThemeTokens('Table', themeTokens, { spacing, type, text })
81
+ const {
82
+ cellMinWidth,
83
+ cellBoxShadowColor,
84
+ cellBackground,
85
+ cellStickyShadow,
86
+ cellPaddingTop,
87
+ cellPaddingRight,
88
+ cellPaddingLeft,
89
+ cellPaddingBottom,
90
+ fontName,
91
+ fontWeight,
92
+ fontSize,
93
+ lineHeight,
94
+ stickyBackgroundColor,
95
+ fontColor,
96
+ display
97
+ } = useThemeTokens('Table', themeTokens, { spacing, type, text })
92
98
 
93
- const sharedProps = {
94
- align,
95
- isSticky: isTableScrollable && isFirstInRow,
96
- cellBackground,
97
- cellMinWidth,
98
- cellStickyShadow: applyShadowToken(cellStickyShadow).boxShadow,
99
- cellPaddingTop,
100
- cellPaddingRight,
101
- cellPaddingLeft,
102
- cellPaddingBottom,
103
- stickyBackgroundColor,
104
- cellBoxShadowColor,
105
- display
106
- }
99
+ const sharedProps = {
100
+ align,
101
+ isSticky: isTableScrollable && isFirstInRow,
102
+ cellBackground,
103
+ cellMinWidth,
104
+ cellStickyShadow: applyShadowToken(cellStickyShadow).boxShadow,
105
+ cellPaddingTop,
106
+ cellPaddingRight,
107
+ cellPaddingLeft,
108
+ cellPaddingBottom,
109
+ stickyBackgroundColor,
110
+ cellBoxShadowColor,
111
+ display,
112
+ ref
113
+ }
107
114
 
108
- const typographyTokens = {
109
- fontName,
110
- fontWeight,
111
- fontSize,
112
- lineHeight,
113
- color: fontColor
114
- }
115
+ const typographyTokens = {
116
+ fontName,
117
+ fontWeight,
118
+ fontSize,
119
+ lineHeight,
120
+ color: fontColor
121
+ }
115
122
 
116
- switch (type) {
117
- case HEADER_TYPE.HEADING:
118
- return (
119
- <StyledHeaderCell scope="col" {...sharedProps} type={type}>
120
- <Typography tokens={typographyTokens}>{children}</Typography>
121
- </StyledHeaderCell>
122
- )
123
+ switch (type) {
124
+ case HEADER_TYPE.HEADING:
125
+ return (
126
+ <StyledHeaderCell scope="col" {...sharedProps} type={type}>
127
+ <Typography tokens={typographyTokens}>{children}</Typography>
128
+ </StyledHeaderCell>
129
+ )
123
130
 
124
- case HEADER_TYPE.SUBHEADING:
125
- return (
126
- <StyledHeaderCell scope="col" {...sharedProps} type={type}>
127
- <Typography tokens={typographyTokens}>{children}</Typography>
128
- </StyledHeaderCell>
129
- )
131
+ case HEADER_TYPE.SUBHEADING:
132
+ return (
133
+ <StyledHeaderCell scope="col" {...sharedProps} type={type}>
134
+ <Typography tokens={typographyTokens}>{children}</Typography>
135
+ </StyledHeaderCell>
136
+ )
130
137
 
131
- case HEADER_TYPE.ROWHEADING:
132
- return (
133
- <StyledHeaderCell scope="row" {...sharedProps} type={type}>
134
- <Typography tokens={typographyTokens}>{children}</Typography>
135
- </StyledHeaderCell>
136
- )
138
+ case HEADER_TYPE.ROWHEADING:
139
+ return (
140
+ <StyledHeaderCell scope="row" {...sharedProps} type={type}>
141
+ <Typography tokens={typographyTokens}>{children}</Typography>
142
+ </StyledHeaderCell>
143
+ )
137
144
 
138
- default:
139
- return (
140
- <StyledDataCell {...sharedProps}>
141
- <Typography tokens={typographyTokens}>{children}</Typography>
142
- </StyledDataCell>
143
- )
145
+ default:
146
+ return (
147
+ <StyledDataCell {...sharedProps}>
148
+ <Typography tokens={typographyTokens}>{children}</Typography>
149
+ </StyledDataCell>
150
+ )
151
+ }
144
152
  }
145
- }
153
+ )
154
+
155
+ Cell.displayName = 'Cell'
146
156
 
147
157
  Cell.propTypes = {
148
158
  type: PropTypes.oneOf(['default', 'heading', 'subHeading', 'rowHeading']),
@@ -1,19 +1,21 @@
1
- import React, { cloneElement } from 'react'
1
+ import React from 'react'
2
2
  import PropTypes from 'prop-types'
3
3
  import Row from './Row'
4
4
 
5
- const Header = ({ children }) => {
5
+ const Header = React.forwardRef(({ children }, ref) => {
6
6
  return (
7
- <thead>
7
+ <thead ref={ref}>
8
8
  <Row>
9
9
  {React.Children.map(children, (child) =>
10
10
  // TO DO: pass type as a variant instead of prop
11
- cloneElement(child, { type: 'heading' })
11
+ React.cloneElement(child, { type: 'heading' })
12
12
  )}
13
13
  </Row>
14
14
  </thead>
15
15
  )
16
- }
16
+ })
17
+
18
+ Header.displayName = 'Header'
17
19
 
18
20
  Header.propTypes = {
19
21
  children: PropTypes.node
package/src/Table/Row.jsx CHANGED
@@ -1,15 +1,17 @@
1
- import React, { cloneElement } from 'react'
1
+ import React from 'react'
2
2
  import PropTypes from 'prop-types'
3
3
 
4
- const Row = ({ children }) => {
4
+ const Row = React.forwardRef(({ children }, ref) => {
5
5
  return (
6
- <tr>
6
+ <tr ref={ref}>
7
7
  {React.Children.map(children, (child, index) =>
8
- cloneElement(child, { isFirstInRow: index === 0 })
8
+ React.cloneElement(child, { isFirstInRow: index === 0 })
9
9
  )}
10
10
  </tr>
11
11
  )
12
- }
12
+ })
13
+
14
+ Row.displayName = 'Row'
13
15
 
14
16
  Row.propTypes = {
15
17
  children: PropTypes.node
@@ -1,17 +1,19 @@
1
- import React, { cloneElement } from 'react'
1
+ import React from 'react'
2
2
  import PropTypes from 'prop-types'
3
3
  import Row from './Row'
4
4
 
5
- const Header = ({ children }) => {
5
+ const Header = React.forwardRef(({ children }, ref) => {
6
6
  return (
7
- <Row>
7
+ <Row ref={ref}>
8
8
  {React.Children.map(children, (child) =>
9
9
  // TO DO: pass type as a variant instead of prop
10
- cloneElement(child, { type: 'subHeading' })
10
+ React.cloneElement(child, { type: 'subHeading' })
11
11
  )}
12
12
  </Row>
13
13
  )
14
- }
14
+ })
15
+
16
+ Header.displayName = 'Header'
15
17
 
16
18
  Header.propTypes = {
17
19
  children: PropTypes.node
@@ -1,4 +1,4 @@
1
- import React, { useContext, useRef, useState } from 'react'
1
+ import React from 'react'
2
2
  import PropTypes from 'prop-types'
3
3
  import styled from 'styled-components'
4
4
  import {
@@ -26,7 +26,7 @@ const StyledTable = styled.table`
26
26
 
27
27
  const TableContext = React.createContext({})
28
28
 
29
- export const useTableContext = () => useContext(TableContext)
29
+ export const useTableContext = () => React.useContext(TableContext)
30
30
 
31
31
  /**
32
32
  * Use `Table` to display tabular data.
@@ -52,11 +52,11 @@ const Table = ({
52
52
  ...rest
53
53
  }) => {
54
54
  const { tablePaddingBottom, borderColor, borderWidth } = useThemeTokens('Table', tokens, variant)
55
- const containerRef = useRef()
56
- const tableRef = useRef()
55
+ const containerRef = React.useRef()
56
+ const tableRef = React.useRef()
57
57
 
58
- const [containerWidth, setContainerWidth] = useState(0)
59
- const [tableWidth, setTableWidth] = useState(0)
58
+ const [containerWidth, setContainerWidth] = React.useState(0)
59
+ const [tableWidth, setTableWidth] = React.useState(0)
60
60
 
61
61
  useSafeLayoutEffect(() => {
62
62
  const updateDimensions = () => {
@@ -1,4 +1,4 @@
1
- import React, { forwardRef } from 'react'
1
+ import React from 'react'
2
2
  import PropTypes from 'prop-types'
3
3
  import {
4
4
  ExpandCollapse as ExpandCollapseBase,
@@ -49,7 +49,7 @@ const getIconButtonTokens = ({
49
49
  outerBorderWidth: iconOuterBorderWidth
50
50
  })
51
51
 
52
- const ExpandCollapse = forwardRef(
52
+ const ExpandCollapse = React.forwardRef(
53
53
  ({ children, collapseTitle, expandTitle = collapseTitle }, ref) => {
54
54
  const getTokens = useThemeTokensCallback('TermsAndConditions', {}, {})
55
55
  const {
@@ -128,8 +128,4 @@ ExpandCollapse.propTypes = {
128
128
  expandTitle: PropTypes.string
129
129
  }
130
130
 
131
- ExpandCollapse.defaultProps = {
132
- expandTitle: undefined
133
- }
134
-
135
131
  export default ExpandCollapse
@@ -1,4 +1,4 @@
1
- import React, { forwardRef } from 'react'
1
+ import React from 'react'
2
2
  import PropTypes from 'prop-types'
3
3
  import styled from 'styled-components'
4
4
  import {
@@ -76,13 +76,13 @@ const MainContainer = styled.div`
76
76
  * - Responsive display based on breakpoints
77
77
  * - Use `copy` to set language, ‘en’ for English or ‘fr’ for French
78
78
  */
79
- const TermsAndConditions = forwardRef(
79
+ const TermsAndConditions = React.forwardRef(
80
80
  (
81
81
  {
82
82
  copy = 'en',
83
- indexedContent,
84
- nonIndexedContent,
85
- tokens,
83
+ indexedContent = [],
84
+ nonIndexedContent = [],
85
+ tokens = {},
86
86
  variant = {},
87
87
  dictionary = defaultDictionary,
88
88
  ...rest
@@ -198,12 +198,4 @@ TermsAndConditions.propTypes = {
198
198
  })
199
199
  }
200
200
 
201
- TermsAndConditions.defaultProps = {
202
- copy: 'en',
203
- indexedContent: [],
204
- nonIndexedContent: [],
205
- dictionary: defaultDictionary,
206
- tokens: {}
207
- }
208
-
209
201
  export default TermsAndConditions
@@ -48,65 +48,152 @@ const Figcaption = styled.figcaption(({ figcaptionGap }) => ({
48
48
  gap: figcaptionGap
49
49
  }))
50
50
 
51
- const Testimonial = ({
52
- showDivider,
53
- testimonial,
54
- title,
55
- imageSrc,
56
- image = imageSrc,
57
- additionalInfo,
58
- testimonialStyle = 'large',
59
- tokens,
60
- copy = 'en',
61
- variant = {},
62
- ...rest
63
- }) => {
64
- const viewport = useViewport()
65
- const {
66
- testimonialContainerGap,
67
- quoteContainerGap,
68
- dividerBorder,
69
- dividerBackgroundColor,
70
- figcaptionGap,
71
- textColor,
72
- icon,
73
- iconFr,
74
- iconColor,
75
- imageSize,
76
- testimonialFontSizeLarge,
77
- testimonialLineHeightLarge,
78
- testimonialFontWeightLarge,
79
- testimonialFontSizeHeading,
80
- testimonialLineHeightHeading,
81
- testimonialFontNameHeading,
82
- testimonialFontWeightHeading,
83
- authorFontSize,
84
- authorLineHeight,
85
- authorFontName,
86
- authorFontWeight,
87
- additionalFontSize,
88
- additionalLineHeight,
89
- additionalFontName,
90
- additionalFontWeight
91
- } = useThemeTokens('Testimonial', tokens, variant, { viewport })
51
+ const Testimonial = React.forwardRef(
52
+ (
53
+ {
54
+ showDivider,
55
+ testimonial,
56
+ title,
57
+ imageSrc,
58
+ image = imageSrc,
59
+ additionalInfo,
60
+ testimonialStyle = 'large',
61
+ tokens,
62
+ copy = 'en',
63
+ variant = {},
64
+ ...rest
65
+ },
66
+ ref
67
+ ) => {
68
+ const viewport = useViewport()
69
+ const {
70
+ testimonialContainerGap,
71
+ quoteContainerGap,
72
+ dividerBorder,
73
+ dividerBackgroundColor,
74
+ figcaptionGap,
75
+ textColor,
76
+ icon,
77
+ iconFr,
78
+ iconColor,
79
+ imageSize,
80
+ testimonialFontSizeLarge,
81
+ testimonialLineHeightLarge,
82
+ testimonialFontWeightLarge,
83
+ testimonialFontSizeHeading,
84
+ testimonialLineHeightHeading,
85
+ testimonialFontNameHeading,
86
+ testimonialFontWeightHeading,
87
+ authorFontSize,
88
+ authorLineHeight,
89
+ authorFontName,
90
+ authorFontWeight,
91
+ additionalFontSize,
92
+ additionalLineHeight,
93
+ additionalFontName,
94
+ additionalFontWeight
95
+ } = useThemeTokens('Testimonial', tokens, variant, { viewport })
92
96
 
93
- const getQuoteTestimonial = (open) => {
94
- let quote = ''
97
+ const getQuoteTestimonial = (open) => {
98
+ let quote = ''
95
99
 
96
- if (copy === 'en') quote = open ? '\u201C' : '\u201D'
97
- else quote = open ? '\u00AB ' : ' \u00BB'
100
+ if (copy === 'en') quote = open ? '\u201C' : '\u201D'
101
+ else quote = open ? '\u00AB ' : ' \u00BB'
98
102
 
99
- return quote
100
- }
103
+ return quote
104
+ }
101
105
 
102
- return (
103
- <TestimonialContainer testimonialContainerGap={testimonialContainerGap} {...selectProps(rest)}>
104
- <QuoteContainer quoteContainerGap={quoteContainerGap}>
105
- <Icon
106
- tokens={{ color: iconColor }}
107
- variant={{ size: 'micro' }}
108
- icon={copy === 'en' ? icon : iconFr}
109
- />
106
+ return (
107
+ <TestimonialContainer
108
+ testimonialContainerGap={testimonialContainerGap}
109
+ ref={ref}
110
+ {...selectProps(rest)}
111
+ >
112
+ <QuoteContainer quoteContainerGap={quoteContainerGap}>
113
+ <Icon
114
+ tokens={{ color: iconColor }}
115
+ variant={{ size: 'micro' }}
116
+ icon={copy === 'en' ? icon : iconFr}
117
+ />
118
+ {showDivider && (
119
+ <Divider
120
+ dividerBackgroundColor={dividerBackgroundColor}
121
+ dividerBorder={dividerBorder}
122
+ role="separator"
123
+ />
124
+ )}
125
+ </QuoteContainer>
126
+ <BlockQuote>
127
+ <Typography
128
+ variant={{ size: testimonialStyle === 'large' ? 'large' : 'h3' }}
129
+ tokens={{
130
+ color: textColor,
131
+ fontSize:
132
+ testimonialStyle === 'heading'
133
+ ? testimonialFontSizeHeading
134
+ : testimonialFontSizeLarge,
135
+ lineHeight:
136
+ testimonialStyle === 'heading'
137
+ ? testimonialLineHeightHeading
138
+ : testimonialLineHeightLarge,
139
+ fontName: testimonialFontNameHeading,
140
+ fontWeight:
141
+ testimonialStyle === 'heading'
142
+ ? testimonialFontWeightHeading
143
+ : testimonialFontWeightLarge
144
+ }}
145
+ >
146
+ {`${getQuoteTestimonial(true)}${testimonial}${getQuoteTestimonial()}`}
147
+ </Typography>
148
+ </BlockQuote>
149
+ {(image || title || additionalInfo) && (
150
+ <Figcaption figcaptionGap={figcaptionGap}>
151
+ {image &&
152
+ (typeof image === 'string' ? (
153
+ <Image
154
+ rounded="circle"
155
+ src={image}
156
+ alt={title}
157
+ width={imageSize}
158
+ height={imageSize}
159
+ />
160
+ ) : (
161
+ image
162
+ ))}
163
+ {(title || additionalInfo) && (
164
+ <AuthorInfoContainer>
165
+ {title && (
166
+ <Typography
167
+ variant={{ size: 'small' }}
168
+ tokens={{
169
+ color: textColor,
170
+ fontSize: authorFontSize,
171
+ lineHeight: authorLineHeight,
172
+ fontName: authorFontName,
173
+ fontWeight: authorFontWeight
174
+ }}
175
+ >
176
+ {title}
177
+ </Typography>
178
+ )}
179
+ {additionalInfo && (
180
+ <Typography
181
+ variant={{ size: 'small' }}
182
+ tokens={{
183
+ color: textColor,
184
+ fontSize: additionalFontSize,
185
+ lineHeight: additionalLineHeight,
186
+ fontName: additionalFontName,
187
+ fontWeight: additionalFontWeight
188
+ }}
189
+ >
190
+ {additionalInfo}
191
+ </Typography>
192
+ )}
193
+ </AuthorInfoContainer>
194
+ )}
195
+ </Figcaption>
196
+ )}
110
197
  {showDivider && (
111
198
  <Divider
112
199
  dividerBackgroundColor={dividerBackgroundColor}
@@ -114,88 +201,12 @@ const Testimonial = ({
114
201
  role="separator"
115
202
  />
116
203
  )}
117
- </QuoteContainer>
118
- <BlockQuote>
119
- <Typography
120
- variant={{ size: testimonialStyle === 'large' ? 'large' : 'h3' }}
121
- tokens={{
122
- color: textColor,
123
- fontSize:
124
- testimonialStyle === 'heading'
125
- ? testimonialFontSizeHeading
126
- : testimonialFontSizeLarge,
127
- lineHeight:
128
- testimonialStyle === 'heading'
129
- ? testimonialLineHeightHeading
130
- : testimonialLineHeightLarge,
131
- fontName: testimonialFontNameHeading,
132
- fontWeight:
133
- testimonialStyle === 'heading'
134
- ? testimonialFontWeightHeading
135
- : testimonialFontWeightLarge
136
- }}
137
- >
138
- {`${getQuoteTestimonial(true)}${testimonial}${getQuoteTestimonial()}`}
139
- </Typography>
140
- </BlockQuote>
141
- {(image || title || additionalInfo) && (
142
- <Figcaption figcaptionGap={figcaptionGap}>
143
- {image &&
144
- (typeof image === 'string' ? (
145
- <Image
146
- rounded="circle"
147
- src={image}
148
- alt={title}
149
- width={imageSize}
150
- height={imageSize}
151
- />
152
- ) : (
153
- image
154
- ))}
155
- {(title || additionalInfo) && (
156
- <AuthorInfoContainer>
157
- {title && (
158
- <Typography
159
- variant={{ size: 'small' }}
160
- tokens={{
161
- color: textColor,
162
- fontSize: authorFontSize,
163
- lineHeight: authorLineHeight,
164
- fontName: authorFontName,
165
- fontWeight: authorFontWeight
166
- }}
167
- >
168
- {title}
169
- </Typography>
170
- )}
171
- {additionalInfo && (
172
- <Typography
173
- variant={{ size: 'small' }}
174
- tokens={{
175
- color: textColor,
176
- fontSize: additionalFontSize,
177
- lineHeight: additionalLineHeight,
178
- fontName: additionalFontName,
179
- fontWeight: additionalFontWeight
180
- }}
181
- >
182
- {additionalInfo}
183
- </Typography>
184
- )}
185
- </AuthorInfoContainer>
186
- )}
187
- </Figcaption>
188
- )}
189
- {showDivider && (
190
- <Divider
191
- dividerBackgroundColor={dividerBackgroundColor}
192
- dividerBorder={dividerBorder}
193
- role="separator"
194
- />
195
- )}
196
- </TestimonialContainer>
197
- )
198
- }
204
+ </TestimonialContainer>
205
+ )
206
+ }
207
+ )
208
+
209
+ Testimonial.displayName = 'Testimonial'
199
210
 
200
211
  Testimonial.propTypes = {
201
212
  ...selectedSystemPropTypes,