@telus-uds/components-web 1.8.0 → 1.10.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.
- package/CHANGELOG.md +41 -2
- package/lib/Autocomplete/Autocomplete.js +393 -0
- package/lib/Autocomplete/Loading.js +51 -0
- package/lib/Autocomplete/Suggestions.js +81 -0
- package/lib/Autocomplete/constants.js +19 -0
- package/lib/Autocomplete/dictionary.js +19 -0
- package/lib/Autocomplete/index.js +13 -0
- package/lib/Breadcrumbs/Breadcrumbs.js +8 -3
- package/lib/Callout/Callout.js +3 -0
- package/lib/Card/Card.js +180 -0
- package/lib/Card/CardContent.js +110 -0
- package/lib/Card/CardFooter.js +98 -0
- package/lib/Card/index.js +13 -0
- package/lib/Countdown/Countdown.js +189 -0
- package/lib/Countdown/Segment.js +111 -0
- package/lib/Countdown/constants.js +14 -0
- package/lib/Countdown/dictionary.js +29 -0
- package/lib/Countdown/index.js +13 -0
- package/lib/Countdown/types.js +39 -0
- package/lib/Countdown/useCountdown.js +40 -0
- package/lib/Footnote/Footnote.js +67 -24
- package/lib/Modal/ModalContent.js +11 -4
- package/lib/OptimizeImage/OptimizeImage.js +127 -0
- package/lib/OptimizeImage/index.js +13 -0
- package/lib/OptimizeImage/utils/getFallbackUrl.js +18 -0
- package/lib/OptimizeImage/utils/getOptimizedUrl.js +32 -0
- package/lib/OptimizeImage/utils/hasWebpSupport.js +38 -0
- package/lib/OptimizeImage/utils/index.js +31 -0
- package/lib/OptimizeImage/utils/isSvgUrl.js +10 -0
- package/lib/QuantitySelector/QuantitySelector.js +253 -0
- package/lib/QuantitySelector/dictionary.js +33 -0
- package/lib/QuantitySelector/index.js +13 -0
- package/lib/QuantitySelector/styles.js +40 -0
- package/lib/StoryCard/StoryCard.js +244 -0
- package/lib/StoryCard/index.js +13 -0
- package/lib/TermsAndConditions/ExpandCollapse.js +141 -0
- package/lib/TermsAndConditions/TermsAndConditions.js +221 -0
- package/lib/TermsAndConditions/dictionary.js +19 -0
- package/lib/TermsAndConditions/index.js +15 -0
- package/lib/Testimonial/Testimonial.js +226 -0
- package/lib/Testimonial/index.js +13 -0
- package/lib/Toast/Toast.js +15 -8
- package/lib/Video/ControlBar/ControlBar.js +315 -0
- package/lib/Video/ControlBar/Controls/VideoButton/VideoButton.js +91 -0
- package/lib/Video/ControlBar/Controls/VideoMenu/VideoMenu.js +186 -0
- package/lib/Video/ControlBar/Controls/VideoProgressBar/VideoProgressBar.js +221 -0
- package/lib/Video/ControlBar/Controls/VolumeSlider/VolumeSlider.js +213 -0
- package/lib/Video/MiddleControlButton/MiddleControlButton.js +89 -0
- package/lib/Video/Video.js +1072 -0
- package/lib/Video/index.js +13 -0
- package/lib/Video/videoText.js +62 -0
- package/lib/WebVideo/WebVideo.js +170 -0
- package/lib/WebVideo/index.js +13 -0
- package/lib/baseExports.js +0 -6
- package/lib/index.js +91 -1
- package/lib/shared/VideoSplash/SplashButton/SplashButton.js +102 -0
- package/lib/shared/VideoSplash/SplashButtonWithDetails/SplashButtonWithDetails.js +234 -0
- package/lib/shared/VideoSplash/VideoSplash.js +86 -0
- package/lib/shared/VideoSplash/helpers.js +38 -0
- package/lib/utils/index.js +8 -0
- package/lib-module/Autocomplete/Autocomplete.js +369 -0
- package/lib-module/Autocomplete/Loading.js +38 -0
- package/lib-module/Autocomplete/Suggestions.js +64 -0
- package/lib-module/Autocomplete/constants.js +5 -0
- package/lib-module/Autocomplete/dictionary.js +12 -0
- package/lib-module/Autocomplete/index.js +2 -0
- package/lib-module/Breadcrumbs/Breadcrumbs.js +8 -3
- package/lib-module/Callout/Callout.js +3 -0
- package/lib-module/Card/Card.js +158 -0
- package/lib-module/Card/CardContent.js +92 -0
- package/lib-module/Card/CardFooter.js +80 -0
- package/lib-module/Card/index.js +2 -0
- package/lib-module/Countdown/Countdown.js +165 -0
- package/lib-module/Countdown/Segment.js +94 -0
- package/lib-module/Countdown/constants.js +4 -0
- package/lib-module/Countdown/dictionary.js +22 -0
- package/lib-module/Countdown/index.js +2 -0
- package/lib-module/Countdown/types.js +23 -0
- package/lib-module/Countdown/useCountdown.js +32 -0
- package/lib-module/Footnote/Footnote.js +65 -24
- package/lib-module/Modal/ModalContent.js +10 -4
- package/lib-module/OptimizeImage/OptimizeImage.js +106 -0
- package/lib-module/OptimizeImage/index.js +2 -0
- package/lib-module/OptimizeImage/utils/getFallbackUrl.js +8 -0
- package/lib-module/OptimizeImage/utils/getOptimizedUrl.js +22 -0
- package/lib-module/OptimizeImage/utils/hasWebpSupport.js +32 -0
- package/lib-module/OptimizeImage/utils/index.js +4 -0
- package/lib-module/OptimizeImage/utils/isSvgUrl.js +3 -0
- package/lib-module/QuantitySelector/QuantitySelector.js +232 -0
- package/lib-module/QuantitySelector/dictionary.js +26 -0
- package/lib-module/QuantitySelector/index.js +2 -0
- package/lib-module/QuantitySelector/styles.js +21 -0
- package/lib-module/StoryCard/StoryCard.js +220 -0
- package/lib-module/StoryCard/index.js +2 -0
- package/lib-module/TermsAndConditions/ExpandCollapse.js +120 -0
- package/lib-module/TermsAndConditions/TermsAndConditions.js +193 -0
- package/lib-module/TermsAndConditions/dictionary.js +12 -0
- package/lib-module/TermsAndConditions/index.js +1 -0
- package/lib-module/Testimonial/Testimonial.js +204 -0
- package/lib-module/Testimonial/index.js +2 -0
- package/lib-module/Toast/Toast.js +15 -8
- package/lib-module/Video/ControlBar/ControlBar.js +292 -0
- package/lib-module/Video/ControlBar/Controls/VideoButton/VideoButton.js +74 -0
- package/lib-module/Video/ControlBar/Controls/VideoMenu/VideoMenu.js +167 -0
- package/lib-module/Video/ControlBar/Controls/VideoProgressBar/VideoProgressBar.js +201 -0
- package/lib-module/Video/ControlBar/Controls/VolumeSlider/VolumeSlider.js +193 -0
- package/lib-module/Video/MiddleControlButton/MiddleControlButton.js +72 -0
- package/lib-module/Video/Video.js +1042 -0
- package/lib-module/Video/index.js +2 -0
- package/lib-module/Video/videoText.js +55 -0
- package/lib-module/WebVideo/WebVideo.js +144 -0
- package/lib-module/WebVideo/index.js +2 -0
- package/lib-module/baseExports.js +1 -1
- package/lib-module/index.js +10 -0
- package/lib-module/shared/VideoSplash/SplashButton/SplashButton.js +85 -0
- package/lib-module/shared/VideoSplash/SplashButtonWithDetails/SplashButtonWithDetails.js +216 -0
- package/lib-module/shared/VideoSplash/VideoSplash.js +65 -0
- package/lib-module/shared/VideoSplash/helpers.js +23 -0
- package/lib-module/utils/index.js +2 -1
- package/package.json +7 -5
- package/src/Autocomplete/Autocomplete.jsx +354 -0
- package/src/Autocomplete/Loading.jsx +18 -0
- package/src/Autocomplete/Suggestions.jsx +52 -0
- package/src/Autocomplete/constants.js +6 -0
- package/src/Autocomplete/dictionary.js +12 -0
- package/src/Autocomplete/index.js +3 -0
- package/src/Breadcrumbs/Breadcrumbs.jsx +4 -3
- package/src/Callout/Callout.jsx +1 -1
- package/src/Card/Card.jsx +170 -0
- package/src/Card/CardContent.jsx +88 -0
- package/src/Card/CardFooter.jsx +70 -0
- package/src/Card/index.js +3 -0
- package/src/Countdown/Countdown.jsx +144 -0
- package/src/Countdown/Segment.jsx +69 -0
- package/src/Countdown/constants.js +4 -0
- package/src/Countdown/dictionary.js +22 -0
- package/src/Countdown/index.js +3 -0
- package/src/Countdown/types.js +23 -0
- package/src/Countdown/useCountdown.js +34 -0
- package/src/Footnote/Footnote.jsx +73 -23
- package/src/Modal/ModalContent.jsx +8 -4
- package/src/OptimizeImage/OptimizeImage.jsx +131 -0
- package/src/OptimizeImage/index.js +3 -0
- package/src/OptimizeImage/utils/getFallbackUrl.js +9 -0
- package/src/OptimizeImage/utils/getOptimizedUrl.js +30 -0
- package/src/OptimizeImage/utils/hasWebpSupport.js +33 -0
- package/src/OptimizeImage/utils/index.js +5 -0
- package/src/OptimizeImage/utils/isSvgUrl.js +3 -0
- package/src/QuantitySelector/QuantitySelector.jsx +245 -0
- package/src/QuantitySelector/dictionary.js +27 -0
- package/src/QuantitySelector/index.js +3 -0
- package/src/QuantitySelector/styles.js +83 -0
- package/src/StoryCard/StoryCard.jsx +198 -0
- package/src/StoryCard/index.js +3 -0
- package/src/TermsAndConditions/ExpandCollapse.jsx +106 -0
- package/src/TermsAndConditions/TermsAndConditions.jsx +161 -0
- package/src/TermsAndConditions/dictionary.js +12 -0
- package/src/TermsAndConditions/index.js +1 -0
- package/src/Testimonial/Testimonial.jsx +169 -0
- package/src/Testimonial/index.js +3 -0
- package/src/Toast/Toast.jsx +12 -5
- package/src/Video/ControlBar/ControlBar.jsx +261 -0
- package/src/Video/ControlBar/Controls/VideoButton/VideoButton.jsx +61 -0
- package/src/Video/ControlBar/Controls/VideoMenu/VideoMenu.jsx +159 -0
- package/src/Video/ControlBar/Controls/VideoProgressBar/VideoProgressBar.jsx +185 -0
- package/src/Video/ControlBar/Controls/VolumeSlider/VolumeSlider.jsx +184 -0
- package/src/Video/MiddleControlButton/MiddleControlButton.jsx +64 -0
- package/src/Video/Video.jsx +988 -0
- package/src/Video/index.js +3 -0
- package/src/Video/videoText.js +58 -0
- package/src/WebVideo/WebVideo.jsx +131 -0
- package/src/WebVideo/index.js +3 -0
- package/src/baseExports.js +0 -1
- package/src/index.js +10 -0
- package/src/shared/VideoSplash/SplashButton/SplashButton.jsx +64 -0
- package/src/shared/VideoSplash/SplashButtonWithDetails/SplashButtonWithDetails.jsx +128 -0
- package/src/shared/VideoSplash/VideoSplash.jsx +50 -0
- package/src/shared/VideoSplash/helpers.js +27 -0
- package/src/utils/index.js +10 -1
- package/types/Autocomplete.d.ts +32 -0
- package/types/Card.d.ts +45 -0
- package/types/ControlBar.d.ts +59 -0
- package/types/MiddleControlButton.d.ts +15 -0
- package/types/Video.d.ts +39 -0
- package/types/VideoButton.d.ts +14 -0
- package/types/VideoMenu.d.ts +16 -0
- package/types/VideoProgressBar.d.ts +17 -0
- package/types/VolumeSlider.d.ts +20 -0
|
@@ -0,0 +1,221 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.default = void 0;
|
|
7
|
+
|
|
8
|
+
var _react = _interopRequireDefault(require("react"));
|
|
9
|
+
|
|
10
|
+
var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
11
|
+
|
|
12
|
+
var _styledComponents = _interopRequireDefault(require("styled-components"));
|
|
13
|
+
|
|
14
|
+
var _componentsBase = require("@telus-uds/components-base");
|
|
15
|
+
|
|
16
|
+
var _videoText = _interopRequireDefault(require("../../../videoText"));
|
|
17
|
+
|
|
18
|
+
var _utils = require("../../../../utils");
|
|
19
|
+
|
|
20
|
+
var _jsxRuntime = require("react/jsx-runtime");
|
|
21
|
+
|
|
22
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
23
|
+
|
|
24
|
+
const [selectProps, selectedSystemPropTypes] = (0, _componentsBase.selectSystemProps)([_utils.htmlAttrs]);
|
|
25
|
+
|
|
26
|
+
const ProgressBarContainer = /*#__PURE__*/_styledComponents.default.div.withConfig({
|
|
27
|
+
displayName: "VideoProgressBar__ProgressBarContainer",
|
|
28
|
+
componentId: "components-web__sc-d9tm07-0"
|
|
29
|
+
})({
|
|
30
|
+
display: 'flex',
|
|
31
|
+
width: '100%',
|
|
32
|
+
alignItems: 'center'
|
|
33
|
+
});
|
|
34
|
+
|
|
35
|
+
const sharedStyles = _ref => {
|
|
36
|
+
let {
|
|
37
|
+
thumbHeight,
|
|
38
|
+
thumbWidth,
|
|
39
|
+
thumbBackground,
|
|
40
|
+
trackGradientStart,
|
|
41
|
+
trackGradientEnd
|
|
42
|
+
} = _ref;
|
|
43
|
+
return {
|
|
44
|
+
thumb: {
|
|
45
|
+
appearance: 'none',
|
|
46
|
+
height: thumbHeight,
|
|
47
|
+
width: thumbWidth,
|
|
48
|
+
borderRadius: '50%',
|
|
49
|
+
background: thumbBackground,
|
|
50
|
+
cursor: 'pointer',
|
|
51
|
+
marginTop: -3,
|
|
52
|
+
'&:hover': {
|
|
53
|
+
transform: 'scale(1.5)'
|
|
54
|
+
}
|
|
55
|
+
},
|
|
56
|
+
track: videoBufferDisplay => ({
|
|
57
|
+
width: '100%',
|
|
58
|
+
height: 2,
|
|
59
|
+
cursor: 'pointer',
|
|
60
|
+
borderRadius: 1.3,
|
|
61
|
+
background: `linear-gradient(to right, ${trackGradientStart} 0%,${trackGradientEnd} ${videoBufferDisplay - 0.01}% ,rgba(255,255,255,0.5) ${videoBufferDisplay}%)` // TODO: replace with opaque white from palette
|
|
62
|
+
|
|
63
|
+
})
|
|
64
|
+
};
|
|
65
|
+
};
|
|
66
|
+
|
|
67
|
+
const StyledProgressBar = /*#__PURE__*/_styledComponents.default.input.attrs(_ref2 => {
|
|
68
|
+
let {
|
|
69
|
+
videoCurrentTime
|
|
70
|
+
} = _ref2;
|
|
71
|
+
return {
|
|
72
|
+
value: videoCurrentTime
|
|
73
|
+
};
|
|
74
|
+
}).withConfig({
|
|
75
|
+
displayName: "VideoProgressBar__StyledProgressBar",
|
|
76
|
+
componentId: "components-web__sc-d9tm07-1"
|
|
77
|
+
})(_ref3 => {
|
|
78
|
+
let {
|
|
79
|
+
videoBufferDisplay,
|
|
80
|
+
rangeBackground,
|
|
81
|
+
...sharedProps
|
|
82
|
+
} = _ref3;
|
|
83
|
+
return {
|
|
84
|
+
width: '100%',
|
|
85
|
+
cursor: 'pointer',
|
|
86
|
+
padding: '5px 0',
|
|
87
|
+
'input[type=range]&': {
|
|
88
|
+
appearance: 'none',
|
|
89
|
+
width: '100%',
|
|
90
|
+
background: rangeBackground
|
|
91
|
+
},
|
|
92
|
+
'input[type=range]&:focus': {
|
|
93
|
+
outline: 'none'
|
|
94
|
+
},
|
|
95
|
+
'input[type=range]&::-webkit-slider-thumb': sharedStyles(sharedProps).thumb,
|
|
96
|
+
'input[type=range]&::-moz-range-thumb': { ...sharedStyles(sharedProps).thumb,
|
|
97
|
+
border: 'none'
|
|
98
|
+
},
|
|
99
|
+
'input[type=range]&::-ms-thumb': { ...sharedStyles(sharedProps).thumb,
|
|
100
|
+
margin: 0,
|
|
101
|
+
border: 'none'
|
|
102
|
+
},
|
|
103
|
+
'input[type=range]&::-webkit-slider-runnable-track': sharedStyles(sharedProps).track(videoBufferDisplay),
|
|
104
|
+
'input[type=range]&::-moz-range-track': sharedStyles(sharedProps).track(videoBufferDisplay),
|
|
105
|
+
'input[type=range]&::-ms-track': { ...sharedStyles(sharedProps).track(videoBufferDisplay),
|
|
106
|
+
margin: '6px 0',
|
|
107
|
+
border: 'none'
|
|
108
|
+
},
|
|
109
|
+
'input[type=range]&::-ms-fill-lower': {
|
|
110
|
+
background: rangeBackground
|
|
111
|
+
},
|
|
112
|
+
'input[type=range]&::-ms-tooltip': {
|
|
113
|
+
display: 'none'
|
|
114
|
+
}
|
|
115
|
+
};
|
|
116
|
+
});
|
|
117
|
+
|
|
118
|
+
const StyledTimestamp = /*#__PURE__*/_styledComponents.default.span.withConfig({
|
|
119
|
+
displayName: "VideoProgressBar__StyledTimestamp",
|
|
120
|
+
componentId: "components-web__sc-d9tm07-2"
|
|
121
|
+
})(_ref4 => {
|
|
122
|
+
let {
|
|
123
|
+
margin
|
|
124
|
+
} = _ref4;
|
|
125
|
+
return {
|
|
126
|
+
margin
|
|
127
|
+
};
|
|
128
|
+
}); // TODO: unify with the helper from `VideoSplash`
|
|
129
|
+
|
|
130
|
+
|
|
131
|
+
function getTimestamp(duration) {
|
|
132
|
+
const minutes = Math.floor(duration / 60);
|
|
133
|
+
const seconds = Math.floor(duration - 60 * minutes);
|
|
134
|
+
return `${minutes}:${seconds < 10 ? 0 : ''}${seconds}`;
|
|
135
|
+
}
|
|
136
|
+
|
|
137
|
+
const VideoProgressBar = _ref5 => {
|
|
138
|
+
let {
|
|
139
|
+
copy = 'en',
|
|
140
|
+
videoLength,
|
|
141
|
+
videoCurrentTime,
|
|
142
|
+
videoBufferEnd,
|
|
143
|
+
setSeek,
|
|
144
|
+
resetInactivityTimer,
|
|
145
|
+
tokens,
|
|
146
|
+
variant,
|
|
147
|
+
...rest
|
|
148
|
+
} = _ref5;
|
|
149
|
+
const {
|
|
150
|
+
thumbHeight,
|
|
151
|
+
thumbWidth,
|
|
152
|
+
thumbBackground,
|
|
153
|
+
timestampMarginLeft,
|
|
154
|
+
timestampMarginRight,
|
|
155
|
+
trackGradientStart,
|
|
156
|
+
trackGradientEnd,
|
|
157
|
+
rangeBackground
|
|
158
|
+
} = (0, _componentsBase.useThemeTokens)('VideoProgressBar', tokens, variant);
|
|
159
|
+
|
|
160
|
+
const videoProgressBar = /*#__PURE__*/_react.default.createRef();
|
|
161
|
+
|
|
162
|
+
const handleVideoSkip = () => {
|
|
163
|
+
setSeek(videoProgressBar.current.value);
|
|
164
|
+
};
|
|
165
|
+
|
|
166
|
+
const videoBufferDisplay = videoBufferEnd / videoLength * 100;
|
|
167
|
+
const isVideoUnplayed = videoCurrentTime === -1;
|
|
168
|
+
const currentTime = isVideoUnplayed ? 0 : videoCurrentTime;
|
|
169
|
+
const remainingTime = isVideoUnplayed ? videoLength : videoLength - videoCurrentTime;
|
|
170
|
+
const currentTimestamp = getTimestamp(currentTime);
|
|
171
|
+
const remainingTimestamp = getTimestamp(remainingTime);
|
|
172
|
+
const sharedProps = {
|
|
173
|
+
thumbWidth,
|
|
174
|
+
thumbHeight,
|
|
175
|
+
thumbBackground,
|
|
176
|
+
trackGradientStart,
|
|
177
|
+
trackGradientEnd,
|
|
178
|
+
rangeBackground
|
|
179
|
+
};
|
|
180
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsxs)(ProgressBarContainer, { ...selectProps(rest),
|
|
181
|
+
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(StyledTimestamp, {
|
|
182
|
+
margin: `0 ${timestampMarginRight}px 0 ${timestampMarginLeft}px`,
|
|
183
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_componentsBase.Typography, {
|
|
184
|
+
variant: {
|
|
185
|
+
inverse: true
|
|
186
|
+
},
|
|
187
|
+
children: currentTimestamp
|
|
188
|
+
})
|
|
189
|
+
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(StyledProgressBar, {
|
|
190
|
+
"aria-label": _videoText.default[copy].videoProgressBarLabel,
|
|
191
|
+
type: "range",
|
|
192
|
+
step: "any",
|
|
193
|
+
max: videoLength,
|
|
194
|
+
videoCurrentTime: videoCurrentTime,
|
|
195
|
+
onChange: handleVideoSkip,
|
|
196
|
+
onFocus: resetInactivityTimer,
|
|
197
|
+
videoBufferDisplay: videoBufferDisplay,
|
|
198
|
+
ref: videoProgressBar,
|
|
199
|
+
tabIndex: "-1",
|
|
200
|
+
...sharedProps
|
|
201
|
+
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(StyledTimestamp, {
|
|
202
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_componentsBase.Typography, {
|
|
203
|
+
variant: {
|
|
204
|
+
inverse: true
|
|
205
|
+
},
|
|
206
|
+
children: remainingTimestamp
|
|
207
|
+
})
|
|
208
|
+
})]
|
|
209
|
+
});
|
|
210
|
+
};
|
|
211
|
+
|
|
212
|
+
VideoProgressBar.propTypes = { ...selectedSystemPropTypes,
|
|
213
|
+
copy: _propTypes.default.oneOf(['en', 'fr']),
|
|
214
|
+
videoLength: _propTypes.default.number.isRequired,
|
|
215
|
+
videoCurrentTime: _propTypes.default.number.isRequired,
|
|
216
|
+
videoBufferEnd: _propTypes.default.number.isRequired,
|
|
217
|
+
setSeek: _propTypes.default.func.isRequired,
|
|
218
|
+
resetInactivityTimer: _propTypes.default.func.isRequired
|
|
219
|
+
};
|
|
220
|
+
var _default = VideoProgressBar;
|
|
221
|
+
exports.default = _default;
|
|
@@ -0,0 +1,213 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.default = void 0;
|
|
7
|
+
|
|
8
|
+
var _react = _interopRequireDefault(require("react"));
|
|
9
|
+
|
|
10
|
+
var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
11
|
+
|
|
12
|
+
var _styledComponents = _interopRequireDefault(require("styled-components"));
|
|
13
|
+
|
|
14
|
+
var _componentsBase = require("@telus-uds/components-base");
|
|
15
|
+
|
|
16
|
+
var _VideoButton = _interopRequireDefault(require("../VideoButton/VideoButton"));
|
|
17
|
+
|
|
18
|
+
var _videoText = _interopRequireDefault(require("../../../videoText"));
|
|
19
|
+
|
|
20
|
+
var _utils = require("../../../../utils");
|
|
21
|
+
|
|
22
|
+
var _jsxRuntime = require("react/jsx-runtime");
|
|
23
|
+
|
|
24
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
25
|
+
|
|
26
|
+
const [selectProps, selectedSystemPropTypes] = (0, _componentsBase.selectSystemProps)([_utils.htmlAttrs]);
|
|
27
|
+
|
|
28
|
+
const VolumeSliderContainer = /*#__PURE__*/_styledComponents.default.div.withConfig({
|
|
29
|
+
displayName: "VolumeSlider__VolumeSliderContainer",
|
|
30
|
+
componentId: "components-web__sc-apixz4-0"
|
|
31
|
+
})(_ref => {
|
|
32
|
+
let {
|
|
33
|
+
videoPlayerWidth,
|
|
34
|
+
compactModeThreshold,
|
|
35
|
+
margin
|
|
36
|
+
} = _ref;
|
|
37
|
+
return {
|
|
38
|
+
display: 'flex',
|
|
39
|
+
width: videoPlayerWidth > compactModeThreshold ? '12%' : '20%',
|
|
40
|
+
maxWidth: 120,
|
|
41
|
+
margin,
|
|
42
|
+
alignItems: 'center'
|
|
43
|
+
};
|
|
44
|
+
});
|
|
45
|
+
|
|
46
|
+
const sharedStyles = _ref2 => {
|
|
47
|
+
let {
|
|
48
|
+
thumbHeight,
|
|
49
|
+
thumbWidth,
|
|
50
|
+
thumbBackground,
|
|
51
|
+
trackGradientStart,
|
|
52
|
+
trackGradientEnd
|
|
53
|
+
} = _ref2;
|
|
54
|
+
return {
|
|
55
|
+
thumb: {
|
|
56
|
+
appearance: 'none',
|
|
57
|
+
height: thumbHeight,
|
|
58
|
+
width: thumbWidth,
|
|
59
|
+
borderRadius: '50%',
|
|
60
|
+
background: thumbBackground,
|
|
61
|
+
cursor: 'pointer',
|
|
62
|
+
marginTop: -3,
|
|
63
|
+
'&:hover': {
|
|
64
|
+
transform: 'scale(1.5)'
|
|
65
|
+
}
|
|
66
|
+
},
|
|
67
|
+
track: videoCurrentVolume => ({
|
|
68
|
+
width: '100%',
|
|
69
|
+
height: 2,
|
|
70
|
+
cursor: 'pointer',
|
|
71
|
+
borderRadius: 1.3,
|
|
72
|
+
background: `linear-gradient(to right, ${trackGradientStart} 0%, ${trackGradientEnd} ${videoCurrentVolume * 100 - 0.01}%, rgba(255,255,255,0.5) ${videoCurrentVolume * 100}%)`
|
|
73
|
+
})
|
|
74
|
+
};
|
|
75
|
+
};
|
|
76
|
+
|
|
77
|
+
const StyledVolumeSlider = /*#__PURE__*/_styledComponents.default.input.attrs(_ref3 => {
|
|
78
|
+
let {
|
|
79
|
+
videoCurrentVolume
|
|
80
|
+
} = _ref3;
|
|
81
|
+
return {
|
|
82
|
+
value: videoCurrentVolume
|
|
83
|
+
};
|
|
84
|
+
}).withConfig({
|
|
85
|
+
displayName: "VolumeSlider__StyledVolumeSlider",
|
|
86
|
+
componentId: "components-web__sc-apixz4-1"
|
|
87
|
+
})(_ref4 => {
|
|
88
|
+
let {
|
|
89
|
+
videoCurrentVolume,
|
|
90
|
+
rangeBackground,
|
|
91
|
+
...sharedProps
|
|
92
|
+
} = _ref4;
|
|
93
|
+
return {
|
|
94
|
+
width: '100%',
|
|
95
|
+
cursor: 'pointer',
|
|
96
|
+
padding: '5px 0',
|
|
97
|
+
'input[type=range]&': {
|
|
98
|
+
appearance: 'none',
|
|
99
|
+
width: '100%',
|
|
100
|
+
background: rangeBackground
|
|
101
|
+
},
|
|
102
|
+
'input[type=range]&:focus': {
|
|
103
|
+
outline: 'none'
|
|
104
|
+
},
|
|
105
|
+
'input[type=range]&::-webkit-slider-thumb': sharedStyles(sharedProps).thumb,
|
|
106
|
+
'input[type=range]&::-moz-range-thumb': { ...sharedStyles.thumb,
|
|
107
|
+
border: 'none'
|
|
108
|
+
},
|
|
109
|
+
'input[type=range]&::-ms-thumb': { ...sharedStyles.thumb,
|
|
110
|
+
margin: 0,
|
|
111
|
+
border: 'none'
|
|
112
|
+
},
|
|
113
|
+
'input[type=range]&::-webkit-slider-runnable-track': sharedStyles(sharedProps).track(videoCurrentVolume),
|
|
114
|
+
'input[type=range]&::-moz-range-track': sharedStyles(sharedProps).track(videoCurrentVolume),
|
|
115
|
+
'input[type=range]&::-ms-track': { ...sharedStyles(sharedProps).track(videoCurrentVolume),
|
|
116
|
+
margin: '6px 0',
|
|
117
|
+
border: 'none'
|
|
118
|
+
},
|
|
119
|
+
'input[type=range]&::-ms-fill-lower': {
|
|
120
|
+
background: 'transparent'
|
|
121
|
+
},
|
|
122
|
+
'input[type=range]&::-ms-tooltip': {
|
|
123
|
+
display: 'none'
|
|
124
|
+
}
|
|
125
|
+
};
|
|
126
|
+
});
|
|
127
|
+
|
|
128
|
+
const VolumeSlider = _ref5 => {
|
|
129
|
+
let {
|
|
130
|
+
setVolume,
|
|
131
|
+
compactModeThreshold,
|
|
132
|
+
disableFocus,
|
|
133
|
+
videoPlayerWidth,
|
|
134
|
+
videoIsMuted,
|
|
135
|
+
videoCurrentVolume,
|
|
136
|
+
copy,
|
|
137
|
+
toggleMute,
|
|
138
|
+
resetInactivityTimer,
|
|
139
|
+
tokens,
|
|
140
|
+
variant,
|
|
141
|
+
...rest
|
|
142
|
+
} = _ref5;
|
|
143
|
+
|
|
144
|
+
const refVolumeSlider = _react.default.useRef();
|
|
145
|
+
|
|
146
|
+
const {
|
|
147
|
+
marginLeft,
|
|
148
|
+
marginRight,
|
|
149
|
+
thumbHeight,
|
|
150
|
+
thumbWidth,
|
|
151
|
+
thumbBackground,
|
|
152
|
+
trackGradientStart,
|
|
153
|
+
trackGradientEnd,
|
|
154
|
+
rangeBackground,
|
|
155
|
+
mutedIcon,
|
|
156
|
+
unmutedIcon
|
|
157
|
+
} = (0, _componentsBase.useThemeTokens)('VideoVolumeSlider', tokens, variant);
|
|
158
|
+
const sharedProps = {
|
|
159
|
+
thumbHeight,
|
|
160
|
+
thumbWidth,
|
|
161
|
+
thumbBackground,
|
|
162
|
+
trackGradientStart,
|
|
163
|
+
trackGradientEnd,
|
|
164
|
+
rangeBackground
|
|
165
|
+
};
|
|
166
|
+
|
|
167
|
+
const handleVolumeChange = () => setVolume(refVolumeSlider.current.value);
|
|
168
|
+
|
|
169
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsxs)(VolumeSliderContainer, {
|
|
170
|
+
compactModeThreshold: compactModeThreshold,
|
|
171
|
+
videoPlayerWidth: videoPlayerWidth,
|
|
172
|
+
margin: `0 ${marginRight}px 0 ${marginLeft}px`,
|
|
173
|
+
...selectProps(rest),
|
|
174
|
+
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_VideoButton.default, {
|
|
175
|
+
icon: videoIsMuted ? /*#__PURE__*/(0, _jsxRuntime.jsx)(_componentsBase.Icon, {
|
|
176
|
+
icon: mutedIcon
|
|
177
|
+
}) : /*#__PURE__*/(0, _jsxRuntime.jsx)(_componentsBase.Icon, {
|
|
178
|
+
icon: unmutedIcon
|
|
179
|
+
}),
|
|
180
|
+
label: videoIsMuted ? _videoText.default[copy].unmute : _videoText.default[copy].mute,
|
|
181
|
+
disableFocus: disableFocus,
|
|
182
|
+
onClick: toggleMute,
|
|
183
|
+
onFocus: resetInactivityTimer
|
|
184
|
+
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(StyledVolumeSlider, {
|
|
185
|
+
type: "range",
|
|
186
|
+
min: "0",
|
|
187
|
+
max: "1",
|
|
188
|
+
step: "any",
|
|
189
|
+
value: videoCurrentVolume,
|
|
190
|
+
videoCurrentVolume: videoCurrentVolume,
|
|
191
|
+
ref: refVolumeSlider,
|
|
192
|
+
onChange: handleVolumeChange,
|
|
193
|
+
onFocus: resetInactivityTimer,
|
|
194
|
+
tabIndex: "-1",
|
|
195
|
+
"aria-label": _videoText.default[copy].volumeSliderLabel,
|
|
196
|
+
...sharedProps
|
|
197
|
+
})]
|
|
198
|
+
});
|
|
199
|
+
};
|
|
200
|
+
|
|
201
|
+
VolumeSlider.propTypes = { ...selectedSystemPropTypes,
|
|
202
|
+
videoCurrentVolume: _propTypes.default.number.isRequired,
|
|
203
|
+
setVolume: _propTypes.default.func.isRequired,
|
|
204
|
+
videoIsMuted: _propTypes.default.bool.isRequired,
|
|
205
|
+
toggleMute: _propTypes.default.func.isRequired,
|
|
206
|
+
resetInactivityTimer: _propTypes.default.func.isRequired,
|
|
207
|
+
copy: _propTypes.default.oneOf(['en', 'fr']).isRequired,
|
|
208
|
+
compactModeThreshold: _propTypes.default.number.isRequired,
|
|
209
|
+
videoPlayerWidth: _propTypes.default.number.isRequired,
|
|
210
|
+
disableFocus: _propTypes.default.bool.isRequired
|
|
211
|
+
};
|
|
212
|
+
var _default = VolumeSlider;
|
|
213
|
+
exports.default = _default;
|
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.default = void 0;
|
|
7
|
+
|
|
8
|
+
var _react = _interopRequireDefault(require("react"));
|
|
9
|
+
|
|
10
|
+
var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
11
|
+
|
|
12
|
+
var _styledComponents = _interopRequireDefault(require("styled-components"));
|
|
13
|
+
|
|
14
|
+
var _componentsBase = require("@telus-uds/components-base");
|
|
15
|
+
|
|
16
|
+
var _utils = require("../../utils");
|
|
17
|
+
|
|
18
|
+
var _jsxRuntime = require("react/jsx-runtime");
|
|
19
|
+
|
|
20
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
21
|
+
|
|
22
|
+
const [selectProps, selectedSystemPropTypes] = (0, _componentsBase.selectSystemProps)([_utils.htmlAttrs]);
|
|
23
|
+
|
|
24
|
+
const StyledMiddleControlButton = /*#__PURE__*/_styledComponents.default.button.withConfig({
|
|
25
|
+
displayName: "MiddleControlButton__StyledMiddleControlButton",
|
|
26
|
+
componentId: "components-web__sc-1um2s37-0"
|
|
27
|
+
})(_ref => {
|
|
28
|
+
let {
|
|
29
|
+
isHidden,
|
|
30
|
+
width,
|
|
31
|
+
height,
|
|
32
|
+
background
|
|
33
|
+
} = _ref;
|
|
34
|
+
return {
|
|
35
|
+
width,
|
|
36
|
+
height,
|
|
37
|
+
borderRadius: '50%',
|
|
38
|
+
transition: 'opacity 0.4s',
|
|
39
|
+
opacity: isHidden ? 0 : 1,
|
|
40
|
+
background,
|
|
41
|
+
display: 'flex',
|
|
42
|
+
justifyContent: 'center',
|
|
43
|
+
border: 'none',
|
|
44
|
+
padding: 0,
|
|
45
|
+
font: 'inherit',
|
|
46
|
+
cursor: 'pointer',
|
|
47
|
+
alignItems: 'center'
|
|
48
|
+
};
|
|
49
|
+
});
|
|
50
|
+
|
|
51
|
+
const MiddleControlButton = _ref2 => {
|
|
52
|
+
let {
|
|
53
|
+
icon: Icon,
|
|
54
|
+
isHidden = false,
|
|
55
|
+
onClick,
|
|
56
|
+
onFocus,
|
|
57
|
+
tokens,
|
|
58
|
+
variant,
|
|
59
|
+
...rest
|
|
60
|
+
} = _ref2;
|
|
61
|
+
const {
|
|
62
|
+
width,
|
|
63
|
+
height,
|
|
64
|
+
background,
|
|
65
|
+
iconColor
|
|
66
|
+
} = (0, _componentsBase.useThemeTokens)('VideoMiddleControlButton', tokens, variant);
|
|
67
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsx)(StyledMiddleControlButton, {
|
|
68
|
+
isHidden: isHidden,
|
|
69
|
+
onClick: onClick,
|
|
70
|
+
onFocus: onFocus,
|
|
71
|
+
width: width,
|
|
72
|
+
height: height,
|
|
73
|
+
background: background,
|
|
74
|
+
...selectProps(rest),
|
|
75
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(Icon, {
|
|
76
|
+
color: iconColor,
|
|
77
|
+
size: 24
|
|
78
|
+
})
|
|
79
|
+
});
|
|
80
|
+
};
|
|
81
|
+
|
|
82
|
+
MiddleControlButton.propTypes = { ...selectedSystemPropTypes,
|
|
83
|
+
icon: _propTypes.default.elementType.isRequired,
|
|
84
|
+
isHidden: _propTypes.default.bool,
|
|
85
|
+
onClick: _propTypes.default.func,
|
|
86
|
+
onFocus: _propTypes.default.func
|
|
87
|
+
};
|
|
88
|
+
var _default = MiddleControlButton;
|
|
89
|
+
exports.default = _default;
|