@telus-uds/components-web 1.8.0 → 1.9.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 (179) hide show
  1. package/CHANGELOG.md +27 -2
  2. package/lib/Autocomplete/Autocomplete.js +393 -0
  3. package/lib/Autocomplete/Loading.js +51 -0
  4. package/lib/Autocomplete/Suggestions.js +81 -0
  5. package/lib/Autocomplete/constants.js +19 -0
  6. package/lib/Autocomplete/dictionary.js +19 -0
  7. package/lib/Autocomplete/index.js +13 -0
  8. package/lib/Callout/Callout.js +3 -0
  9. package/lib/Card/Card.js +180 -0
  10. package/lib/Card/CardContent.js +110 -0
  11. package/lib/Card/CardFooter.js +98 -0
  12. package/lib/Card/index.js +13 -0
  13. package/lib/Countdown/Countdown.js +189 -0
  14. package/lib/Countdown/Segment.js +111 -0
  15. package/lib/Countdown/constants.js +14 -0
  16. package/lib/Countdown/dictionary.js +29 -0
  17. package/lib/Countdown/index.js +13 -0
  18. package/lib/Countdown/types.js +39 -0
  19. package/lib/Countdown/useCountdown.js +40 -0
  20. package/lib/Modal/ModalContent.js +11 -4
  21. package/lib/OptimizeImage/OptimizeImage.js +127 -0
  22. package/lib/OptimizeImage/index.js +13 -0
  23. package/lib/OptimizeImage/utils/getFallbackUrl.js +18 -0
  24. package/lib/OptimizeImage/utils/getOptimizedUrl.js +32 -0
  25. package/lib/OptimizeImage/utils/hasWebpSupport.js +38 -0
  26. package/lib/OptimizeImage/utils/index.js +31 -0
  27. package/lib/OptimizeImage/utils/isSvgUrl.js +10 -0
  28. package/lib/QuantitySelector/QuantitySelector.js +253 -0
  29. package/lib/QuantitySelector/dictionary.js +33 -0
  30. package/lib/QuantitySelector/index.js +13 -0
  31. package/lib/QuantitySelector/styles.js +40 -0
  32. package/lib/StoryCard/StoryCard.js +244 -0
  33. package/lib/StoryCard/index.js +13 -0
  34. package/lib/TermsAndConditions/ExpandCollapse.js +141 -0
  35. package/lib/TermsAndConditions/TermsAndConditions.js +221 -0
  36. package/lib/TermsAndConditions/dictionary.js +19 -0
  37. package/lib/TermsAndConditions/index.js +15 -0
  38. package/lib/Testimonial/Testimonial.js +226 -0
  39. package/lib/Testimonial/index.js +13 -0
  40. package/lib/Video/ControlBar/ControlBar.js +315 -0
  41. package/lib/Video/ControlBar/Controls/VideoButton/VideoButton.js +91 -0
  42. package/lib/Video/ControlBar/Controls/VideoMenu/VideoMenu.js +186 -0
  43. package/lib/Video/ControlBar/Controls/VideoProgressBar/VideoProgressBar.js +221 -0
  44. package/lib/Video/ControlBar/Controls/VolumeSlider/VolumeSlider.js +213 -0
  45. package/lib/Video/MiddleControlButton/MiddleControlButton.js +89 -0
  46. package/lib/Video/Video.js +1072 -0
  47. package/lib/Video/index.js +13 -0
  48. package/lib/Video/videoText.js +62 -0
  49. package/lib/WebVideo/WebVideo.js +170 -0
  50. package/lib/WebVideo/index.js +13 -0
  51. package/lib/baseExports.js +0 -6
  52. package/lib/index.js +91 -1
  53. package/lib/shared/VideoSplash/SplashButton/SplashButton.js +102 -0
  54. package/lib/shared/VideoSplash/SplashButtonWithDetails/SplashButtonWithDetails.js +234 -0
  55. package/lib/shared/VideoSplash/VideoSplash.js +86 -0
  56. package/lib/shared/VideoSplash/helpers.js +38 -0
  57. package/lib/utils/index.js +8 -0
  58. package/lib-module/Autocomplete/Autocomplete.js +369 -0
  59. package/lib-module/Autocomplete/Loading.js +38 -0
  60. package/lib-module/Autocomplete/Suggestions.js +64 -0
  61. package/lib-module/Autocomplete/constants.js +5 -0
  62. package/lib-module/Autocomplete/dictionary.js +12 -0
  63. package/lib-module/Autocomplete/index.js +2 -0
  64. package/lib-module/Callout/Callout.js +3 -0
  65. package/lib-module/Card/Card.js +158 -0
  66. package/lib-module/Card/CardContent.js +92 -0
  67. package/lib-module/Card/CardFooter.js +80 -0
  68. package/lib-module/Card/index.js +2 -0
  69. package/lib-module/Countdown/Countdown.js +165 -0
  70. package/lib-module/Countdown/Segment.js +94 -0
  71. package/lib-module/Countdown/constants.js +4 -0
  72. package/lib-module/Countdown/dictionary.js +22 -0
  73. package/lib-module/Countdown/index.js +2 -0
  74. package/lib-module/Countdown/types.js +23 -0
  75. package/lib-module/Countdown/useCountdown.js +32 -0
  76. package/lib-module/Modal/ModalContent.js +10 -4
  77. package/lib-module/OptimizeImage/OptimizeImage.js +106 -0
  78. package/lib-module/OptimizeImage/index.js +2 -0
  79. package/lib-module/OptimizeImage/utils/getFallbackUrl.js +8 -0
  80. package/lib-module/OptimizeImage/utils/getOptimizedUrl.js +22 -0
  81. package/lib-module/OptimizeImage/utils/hasWebpSupport.js +32 -0
  82. package/lib-module/OptimizeImage/utils/index.js +4 -0
  83. package/lib-module/OptimizeImage/utils/isSvgUrl.js +3 -0
  84. package/lib-module/QuantitySelector/QuantitySelector.js +232 -0
  85. package/lib-module/QuantitySelector/dictionary.js +26 -0
  86. package/lib-module/QuantitySelector/index.js +2 -0
  87. package/lib-module/QuantitySelector/styles.js +21 -0
  88. package/lib-module/StoryCard/StoryCard.js +220 -0
  89. package/lib-module/StoryCard/index.js +2 -0
  90. package/lib-module/TermsAndConditions/ExpandCollapse.js +120 -0
  91. package/lib-module/TermsAndConditions/TermsAndConditions.js +193 -0
  92. package/lib-module/TermsAndConditions/dictionary.js +12 -0
  93. package/lib-module/TermsAndConditions/index.js +1 -0
  94. package/lib-module/Testimonial/Testimonial.js +204 -0
  95. package/lib-module/Testimonial/index.js +2 -0
  96. package/lib-module/Video/ControlBar/ControlBar.js +292 -0
  97. package/lib-module/Video/ControlBar/Controls/VideoButton/VideoButton.js +74 -0
  98. package/lib-module/Video/ControlBar/Controls/VideoMenu/VideoMenu.js +167 -0
  99. package/lib-module/Video/ControlBar/Controls/VideoProgressBar/VideoProgressBar.js +201 -0
  100. package/lib-module/Video/ControlBar/Controls/VolumeSlider/VolumeSlider.js +193 -0
  101. package/lib-module/Video/MiddleControlButton/MiddleControlButton.js +72 -0
  102. package/lib-module/Video/Video.js +1042 -0
  103. package/lib-module/Video/index.js +2 -0
  104. package/lib-module/Video/videoText.js +55 -0
  105. package/lib-module/WebVideo/WebVideo.js +144 -0
  106. package/lib-module/WebVideo/index.js +2 -0
  107. package/lib-module/baseExports.js +1 -1
  108. package/lib-module/index.js +10 -0
  109. package/lib-module/shared/VideoSplash/SplashButton/SplashButton.js +85 -0
  110. package/lib-module/shared/VideoSplash/SplashButtonWithDetails/SplashButtonWithDetails.js +216 -0
  111. package/lib-module/shared/VideoSplash/VideoSplash.js +65 -0
  112. package/lib-module/shared/VideoSplash/helpers.js +23 -0
  113. package/lib-module/utils/index.js +2 -1
  114. package/package.json +7 -5
  115. package/src/Autocomplete/Autocomplete.jsx +354 -0
  116. package/src/Autocomplete/Loading.jsx +18 -0
  117. package/src/Autocomplete/Suggestions.jsx +52 -0
  118. package/src/Autocomplete/constants.js +6 -0
  119. package/src/Autocomplete/dictionary.js +12 -0
  120. package/src/Autocomplete/index.js +3 -0
  121. package/src/Callout/Callout.jsx +1 -1
  122. package/src/Card/Card.jsx +170 -0
  123. package/src/Card/CardContent.jsx +88 -0
  124. package/src/Card/CardFooter.jsx +70 -0
  125. package/src/Card/index.js +3 -0
  126. package/src/Countdown/Countdown.jsx +144 -0
  127. package/src/Countdown/Segment.jsx +69 -0
  128. package/src/Countdown/constants.js +4 -0
  129. package/src/Countdown/dictionary.js +22 -0
  130. package/src/Countdown/index.js +3 -0
  131. package/src/Countdown/types.js +23 -0
  132. package/src/Countdown/useCountdown.js +34 -0
  133. package/src/Modal/ModalContent.jsx +8 -4
  134. package/src/OptimizeImage/OptimizeImage.jsx +131 -0
  135. package/src/OptimizeImage/index.js +3 -0
  136. package/src/OptimizeImage/utils/getFallbackUrl.js +9 -0
  137. package/src/OptimizeImage/utils/getOptimizedUrl.js +30 -0
  138. package/src/OptimizeImage/utils/hasWebpSupport.js +33 -0
  139. package/src/OptimizeImage/utils/index.js +5 -0
  140. package/src/OptimizeImage/utils/isSvgUrl.js +3 -0
  141. package/src/QuantitySelector/QuantitySelector.jsx +245 -0
  142. package/src/QuantitySelector/dictionary.js +27 -0
  143. package/src/QuantitySelector/index.js +3 -0
  144. package/src/QuantitySelector/styles.js +83 -0
  145. package/src/StoryCard/StoryCard.jsx +198 -0
  146. package/src/StoryCard/index.js +3 -0
  147. package/src/TermsAndConditions/ExpandCollapse.jsx +106 -0
  148. package/src/TermsAndConditions/TermsAndConditions.jsx +161 -0
  149. package/src/TermsAndConditions/dictionary.js +12 -0
  150. package/src/TermsAndConditions/index.js +1 -0
  151. package/src/Testimonial/Testimonial.jsx +169 -0
  152. package/src/Testimonial/index.js +3 -0
  153. package/src/Video/ControlBar/ControlBar.jsx +261 -0
  154. package/src/Video/ControlBar/Controls/VideoButton/VideoButton.jsx +61 -0
  155. package/src/Video/ControlBar/Controls/VideoMenu/VideoMenu.jsx +159 -0
  156. package/src/Video/ControlBar/Controls/VideoProgressBar/VideoProgressBar.jsx +185 -0
  157. package/src/Video/ControlBar/Controls/VolumeSlider/VolumeSlider.jsx +184 -0
  158. package/src/Video/MiddleControlButton/MiddleControlButton.jsx +64 -0
  159. package/src/Video/Video.jsx +988 -0
  160. package/src/Video/index.js +3 -0
  161. package/src/Video/videoText.js +58 -0
  162. package/src/WebVideo/WebVideo.jsx +131 -0
  163. package/src/WebVideo/index.js +3 -0
  164. package/src/baseExports.js +0 -1
  165. package/src/index.js +10 -0
  166. package/src/shared/VideoSplash/SplashButton/SplashButton.jsx +64 -0
  167. package/src/shared/VideoSplash/SplashButtonWithDetails/SplashButtonWithDetails.jsx +128 -0
  168. package/src/shared/VideoSplash/VideoSplash.jsx +50 -0
  169. package/src/shared/VideoSplash/helpers.js +27 -0
  170. package/src/utils/index.js +10 -1
  171. package/types/Autocomplete.d.ts +32 -0
  172. package/types/Card.d.ts +45 -0
  173. package/types/ControlBar.d.ts +59 -0
  174. package/types/MiddleControlButton.d.ts +15 -0
  175. package/types/Video.d.ts +39 -0
  176. package/types/VideoButton.d.ts +14 -0
  177. package/types/VideoMenu.d.ts +16 -0
  178. package/types/VideoProgressBar.d.ts +17 -0
  179. package/types/VolumeSlider.d.ts +20 -0
@@ -0,0 +1,184 @@
1
+ import React from 'react'
2
+ import PropTypes from 'prop-types'
3
+ import styled from 'styled-components'
4
+
5
+ import { Icon, useThemeTokens, selectSystemProps } from '@telus-uds/components-base'
6
+
7
+ import VideoButton from '../VideoButton/VideoButton'
8
+ import videoText from '../../../videoText'
9
+ import { htmlAttrs } from '../../../../utils'
10
+
11
+ const [selectProps, selectedSystemPropTypes] = selectSystemProps([htmlAttrs])
12
+
13
+ const VolumeSliderContainer = styled.div(({ videoPlayerWidth, compactModeThreshold, margin }) => ({
14
+ display: 'flex',
15
+ width: videoPlayerWidth > compactModeThreshold ? '12%' : '20%',
16
+ maxWidth: 120,
17
+ margin,
18
+ alignItems: 'center'
19
+ }))
20
+
21
+ const sharedStyles = ({
22
+ thumbHeight,
23
+ thumbWidth,
24
+ thumbBackground,
25
+ trackGradientStart,
26
+ trackGradientEnd
27
+ }) => ({
28
+ thumb: {
29
+ appearance: 'none',
30
+ height: thumbHeight,
31
+ width: thumbWidth,
32
+ borderRadius: '50%',
33
+ background: thumbBackground,
34
+ cursor: 'pointer',
35
+ marginTop: -3,
36
+
37
+ '&:hover': {
38
+ transform: 'scale(1.5)'
39
+ }
40
+ },
41
+ track: (videoCurrentVolume) => ({
42
+ width: '100%',
43
+ height: 2,
44
+ cursor: 'pointer',
45
+ borderRadius: 1.3,
46
+ background: `linear-gradient(to right, ${trackGradientStart} 0%, ${trackGradientEnd} ${
47
+ videoCurrentVolume * 100 - 0.01
48
+ }%, rgba(255,255,255,0.5) ${videoCurrentVolume * 100}%)`
49
+ })
50
+ })
51
+
52
+ const StyledVolumeSlider = styled.input.attrs(({ videoCurrentVolume }) => ({
53
+ value: videoCurrentVolume
54
+ }))(({ videoCurrentVolume, rangeBackground, ...sharedProps }) => {
55
+ return {
56
+ width: '100%',
57
+ cursor: 'pointer',
58
+ padding: '5px 0',
59
+
60
+ 'input[type=range]&': {
61
+ appearance: 'none',
62
+ width: '100%',
63
+ background: rangeBackground
64
+ },
65
+
66
+ 'input[type=range]&:focus': {
67
+ outline: 'none'
68
+ },
69
+
70
+ 'input[type=range]&::-webkit-slider-thumb': sharedStyles(sharedProps).thumb,
71
+ 'input[type=range]&::-moz-range-thumb': {
72
+ ...sharedStyles.thumb,
73
+ border: 'none'
74
+ },
75
+ 'input[type=range]&::-ms-thumb': {
76
+ ...sharedStyles.thumb,
77
+ margin: 0,
78
+ border: 'none'
79
+ },
80
+
81
+ 'input[type=range]&::-webkit-slider-runnable-track':
82
+ sharedStyles(sharedProps).track(videoCurrentVolume),
83
+ 'input[type=range]&::-moz-range-track': sharedStyles(sharedProps).track(videoCurrentVolume),
84
+ 'input[type=range]&::-ms-track': {
85
+ ...sharedStyles(sharedProps).track(videoCurrentVolume),
86
+ margin: '6px 0',
87
+ border: 'none'
88
+ },
89
+
90
+ 'input[type=range]&::-ms-fill-lower': {
91
+ background: 'transparent'
92
+ },
93
+ 'input[type=range]&::-ms-tooltip': {
94
+ display: 'none'
95
+ }
96
+ }
97
+ })
98
+
99
+ const VolumeSlider = ({
100
+ setVolume,
101
+ compactModeThreshold,
102
+ disableFocus,
103
+ videoPlayerWidth,
104
+ videoIsMuted,
105
+ videoCurrentVolume,
106
+ copy,
107
+ toggleMute,
108
+ resetInactivityTimer,
109
+ tokens,
110
+ variant,
111
+ ...rest
112
+ }) => {
113
+ const refVolumeSlider = React.useRef()
114
+
115
+ const {
116
+ marginLeft,
117
+ marginRight,
118
+ thumbHeight,
119
+ thumbWidth,
120
+ thumbBackground,
121
+ trackGradientStart,
122
+ trackGradientEnd,
123
+ rangeBackground,
124
+ mutedIcon,
125
+ unmutedIcon
126
+ } = useThemeTokens('VideoVolumeSlider', tokens, variant)
127
+
128
+ const sharedProps = {
129
+ thumbHeight,
130
+ thumbWidth,
131
+ thumbBackground,
132
+ trackGradientStart,
133
+ trackGradientEnd,
134
+ rangeBackground
135
+ }
136
+
137
+ const handleVolumeChange = () => setVolume(refVolumeSlider.current.value)
138
+
139
+ return (
140
+ <VolumeSliderContainer
141
+ compactModeThreshold={compactModeThreshold}
142
+ videoPlayerWidth={videoPlayerWidth}
143
+ margin={`0 ${marginRight}px 0 ${marginLeft}px`}
144
+ {...selectProps(rest)}
145
+ >
146
+ <VideoButton
147
+ icon={videoIsMuted ? <Icon icon={mutedIcon} /> : <Icon icon={unmutedIcon} />}
148
+ label={videoIsMuted ? videoText[copy].unmute : videoText[copy].mute}
149
+ disableFocus={disableFocus}
150
+ onClick={toggleMute}
151
+ onFocus={resetInactivityTimer}
152
+ />
153
+ <StyledVolumeSlider
154
+ type="range"
155
+ min="0"
156
+ max="1"
157
+ step="any"
158
+ value={videoCurrentVolume}
159
+ videoCurrentVolume={videoCurrentVolume}
160
+ ref={refVolumeSlider}
161
+ onChange={handleVolumeChange}
162
+ onFocus={resetInactivityTimer}
163
+ tabIndex="-1"
164
+ aria-label={videoText[copy].volumeSliderLabel}
165
+ {...sharedProps}
166
+ />
167
+ </VolumeSliderContainer>
168
+ )
169
+ }
170
+
171
+ VolumeSlider.propTypes = {
172
+ ...selectedSystemPropTypes,
173
+ videoCurrentVolume: PropTypes.number.isRequired,
174
+ setVolume: PropTypes.func.isRequired,
175
+ videoIsMuted: PropTypes.bool.isRequired,
176
+ toggleMute: PropTypes.func.isRequired,
177
+ resetInactivityTimer: PropTypes.func.isRequired,
178
+ copy: PropTypes.oneOf(['en', 'fr']).isRequired,
179
+ compactModeThreshold: PropTypes.number.isRequired,
180
+ videoPlayerWidth: PropTypes.number.isRequired,
181
+ disableFocus: PropTypes.bool.isRequired
182
+ }
183
+
184
+ export default VolumeSlider
@@ -0,0 +1,64 @@
1
+ import React from 'react'
2
+ import PropTypes from 'prop-types'
3
+ import styled from 'styled-components'
4
+
5
+ import { useThemeTokens, selectSystemProps } from '@telus-uds/components-base'
6
+ import { htmlAttrs } from '../../utils'
7
+
8
+ const [selectProps, selectedSystemPropTypes] = selectSystemProps([htmlAttrs])
9
+
10
+ const StyledMiddleControlButton = styled.button(({ isHidden, width, height, background }) => ({
11
+ width,
12
+ height,
13
+ borderRadius: '50%',
14
+ transition: 'opacity 0.4s',
15
+ opacity: isHidden ? 0 : 1,
16
+ background,
17
+ display: 'flex',
18
+ justifyContent: 'center',
19
+ border: 'none',
20
+ padding: 0,
21
+ font: 'inherit',
22
+ cursor: 'pointer',
23
+ alignItems: 'center'
24
+ }))
25
+
26
+ const MiddleControlButton = ({
27
+ icon: Icon,
28
+ isHidden = false,
29
+ onClick,
30
+ onFocus,
31
+ tokens,
32
+ variant,
33
+ ...rest
34
+ }) => {
35
+ const { width, height, background, iconColor } = useThemeTokens(
36
+ 'VideoMiddleControlButton',
37
+ tokens,
38
+ variant
39
+ )
40
+
41
+ return (
42
+ <StyledMiddleControlButton
43
+ isHidden={isHidden}
44
+ onClick={onClick}
45
+ onFocus={onFocus}
46
+ width={width}
47
+ height={height}
48
+ background={background}
49
+ {...selectProps(rest)}
50
+ >
51
+ <Icon color={iconColor} size={24} />
52
+ </StyledMiddleControlButton>
53
+ )
54
+ }
55
+
56
+ MiddleControlButton.propTypes = {
57
+ ...selectedSystemPropTypes,
58
+ icon: PropTypes.elementType.isRequired,
59
+ isHidden: PropTypes.bool,
60
+ onClick: PropTypes.func,
61
+ onFocus: PropTypes.func
62
+ }
63
+
64
+ export default MiddleControlButton