@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,315 @@
|
|
|
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 _VideoProgressBar = _interopRequireDefault(require("./Controls/VideoProgressBar/VideoProgressBar"));
|
|
17
|
+
|
|
18
|
+
var _VolumeSlider = _interopRequireDefault(require("./Controls/VolumeSlider/VolumeSlider"));
|
|
19
|
+
|
|
20
|
+
var _VideoButton = _interopRequireDefault(require("./Controls/VideoButton/VideoButton"));
|
|
21
|
+
|
|
22
|
+
var _VideoMenu = _interopRequireDefault(require("./Controls/VideoMenu/VideoMenu"));
|
|
23
|
+
|
|
24
|
+
var _videoText = _interopRequireDefault(require("../videoText"));
|
|
25
|
+
|
|
26
|
+
var _utils = require("../../utils");
|
|
27
|
+
|
|
28
|
+
var _jsxRuntime = require("react/jsx-runtime");
|
|
29
|
+
|
|
30
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
31
|
+
|
|
32
|
+
const [selectProps, selectedSystemPropTypes] = (0, _componentsBase.selectSystemProps)([_utils.htmlAttrs]);
|
|
33
|
+
|
|
34
|
+
const getIcon = icon => /*#__PURE__*/(0, _jsxRuntime.jsx)(_componentsBase.Icon, {
|
|
35
|
+
icon: icon
|
|
36
|
+
});
|
|
37
|
+
|
|
38
|
+
const ControlBarContainer = /*#__PURE__*/_styledComponents.default.div.withConfig({
|
|
39
|
+
displayName: "ControlBar__ControlBarContainer",
|
|
40
|
+
componentId: "components-web__sc-13y61ky-0"
|
|
41
|
+
})(_ref => {
|
|
42
|
+
let {
|
|
43
|
+
isHidden,
|
|
44
|
+
isMobile
|
|
45
|
+
} = _ref;
|
|
46
|
+
return {
|
|
47
|
+
width: '100%',
|
|
48
|
+
position: 'relative',
|
|
49
|
+
transition: 'opacity 0.4s',
|
|
50
|
+
opacity: isHidden ? 0 : 1,
|
|
51
|
+
display: isMobile ? 'none' : undefined
|
|
52
|
+
};
|
|
53
|
+
});
|
|
54
|
+
|
|
55
|
+
const StyledControlBar = /*#__PURE__*/_styledComponents.default.div.withConfig({
|
|
56
|
+
displayName: "ControlBar__StyledControlBar",
|
|
57
|
+
componentId: "components-web__sc-13y61ky-1"
|
|
58
|
+
})(_ref2 => {
|
|
59
|
+
let {
|
|
60
|
+
padding
|
|
61
|
+
} = _ref2;
|
|
62
|
+
return {
|
|
63
|
+
boxSizing: 'border-box',
|
|
64
|
+
position: 'absolute',
|
|
65
|
+
width: '100%',
|
|
66
|
+
height: 56,
|
|
67
|
+
padding,
|
|
68
|
+
bottom: 0,
|
|
69
|
+
backgroundColor: 'rgba(42, 44, 46, 0.85)',
|
|
70
|
+
// TODO: replace with opaque greyThunder
|
|
71
|
+
margin: 'auto',
|
|
72
|
+
display: 'flex',
|
|
73
|
+
justifyContent: 'space-between',
|
|
74
|
+
zIndex: 9
|
|
75
|
+
};
|
|
76
|
+
});
|
|
77
|
+
|
|
78
|
+
const VideoProgressBarContainer = /*#__PURE__*/_styledComponents.default.div.withConfig({
|
|
79
|
+
displayName: "ControlBar__VideoProgressBarContainer",
|
|
80
|
+
componentId: "components-web__sc-13y61ky-2"
|
|
81
|
+
})({
|
|
82
|
+
display: 'flex',
|
|
83
|
+
flexGrow: 1
|
|
84
|
+
});
|
|
85
|
+
|
|
86
|
+
const MenuContainer = /*#__PURE__*/_styledComponents.default.div.withConfig({
|
|
87
|
+
displayName: "ControlBar__MenuContainer",
|
|
88
|
+
componentId: "components-web__sc-13y61ky-3"
|
|
89
|
+
})(_ref3 => {
|
|
90
|
+
let {
|
|
91
|
+
isOpen,
|
|
92
|
+
menuBottom,
|
|
93
|
+
menuRight,
|
|
94
|
+
menuMarginLeft
|
|
95
|
+
} = _ref3;
|
|
96
|
+
return {
|
|
97
|
+
position: 'absolute',
|
|
98
|
+
bottom: menuBottom,
|
|
99
|
+
right: menuRight,
|
|
100
|
+
display: isOpen ? 'block' : 'none',
|
|
101
|
+
marginLeft: menuMarginLeft
|
|
102
|
+
};
|
|
103
|
+
});
|
|
104
|
+
|
|
105
|
+
const ControlBar = _ref4 => {
|
|
106
|
+
let {
|
|
107
|
+
videoPlayer,
|
|
108
|
+
videoPlayerContainer,
|
|
109
|
+
sources,
|
|
110
|
+
tracks,
|
|
111
|
+
videoPlaying,
|
|
112
|
+
videoUnplayed,
|
|
113
|
+
videoBufferEnd,
|
|
114
|
+
isHidden = false,
|
|
115
|
+
videoLength,
|
|
116
|
+
videoCurrentTime,
|
|
117
|
+
videoCurrentVolume,
|
|
118
|
+
videoIsMuted,
|
|
119
|
+
setVolume,
|
|
120
|
+
isMobile,
|
|
121
|
+
tracksAvailable,
|
|
122
|
+
togglePlayPause,
|
|
123
|
+
setSeek,
|
|
124
|
+
toggleMute,
|
|
125
|
+
toggleFullscreen,
|
|
126
|
+
videoIsFullscreen,
|
|
127
|
+
setTextTracks,
|
|
128
|
+
selectedTextTrack,
|
|
129
|
+
resetInactivityTimer,
|
|
130
|
+
videoQuality,
|
|
131
|
+
setVideoQuality,
|
|
132
|
+
captionsMenuOpen,
|
|
133
|
+
setCaptionsMenuOpen,
|
|
134
|
+
qualityMenuOpen,
|
|
135
|
+
setQualityMenuOpen,
|
|
136
|
+
clearInactivityTimer,
|
|
137
|
+
copy,
|
|
138
|
+
compactModeThreshold,
|
|
139
|
+
videoPlayerWidth,
|
|
140
|
+
tokens,
|
|
141
|
+
variant,
|
|
142
|
+
...rest
|
|
143
|
+
} = _ref4;
|
|
144
|
+
const {
|
|
145
|
+
paddingTop,
|
|
146
|
+
paddingBottom,
|
|
147
|
+
paddingLeft: paddingLeftDefault,
|
|
148
|
+
paddingRight: paddingRightDefault,
|
|
149
|
+
paddingLeftCompactMode,
|
|
150
|
+
paddingRightCompactMode,
|
|
151
|
+
menuBottom,
|
|
152
|
+
menuRight,
|
|
153
|
+
menuMarginLeft,
|
|
154
|
+
captionsIcon,
|
|
155
|
+
settingsIcon,
|
|
156
|
+
minimizeIcon,
|
|
157
|
+
maximizeIcon
|
|
158
|
+
} = (0, _componentsBase.useThemeTokens)('VideoControlBar', tokens, variant);
|
|
159
|
+
|
|
160
|
+
const parseVideoQuality = () => {
|
|
161
|
+
return sources.map(source => {
|
|
162
|
+
if (!source.isFallback) {
|
|
163
|
+
return {
|
|
164
|
+
name: source.qualityName,
|
|
165
|
+
value: source.qualityRank
|
|
166
|
+
};
|
|
167
|
+
}
|
|
168
|
+
|
|
169
|
+
return {};
|
|
170
|
+
});
|
|
171
|
+
};
|
|
172
|
+
|
|
173
|
+
const parseTracks = () => {
|
|
174
|
+
const parsed = tracks.map((track, trackNumber) => {
|
|
175
|
+
return {
|
|
176
|
+
name: _videoText.default[copy][track.language],
|
|
177
|
+
value: trackNumber
|
|
178
|
+
};
|
|
179
|
+
});
|
|
180
|
+
parsed.unshift({
|
|
181
|
+
name: _videoText.default[copy].captionsNone,
|
|
182
|
+
value: -1
|
|
183
|
+
});
|
|
184
|
+
return parsed;
|
|
185
|
+
};
|
|
186
|
+
|
|
187
|
+
const paddingLeft = videoPlayerWidth > compactModeThreshold ? paddingLeftDefault : paddingLeftCompactMode;
|
|
188
|
+
const paddingRight = videoPlayerWidth > compactModeThreshold ? paddingRightDefault : paddingRightCompactMode;
|
|
189
|
+
const menuContainerStyleProps = {
|
|
190
|
+
menuBottom,
|
|
191
|
+
menuRight,
|
|
192
|
+
menuMarginLeft
|
|
193
|
+
};
|
|
194
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsx)(ControlBarContainer, {
|
|
195
|
+
isHidden: isHidden,
|
|
196
|
+
isMobile: isMobile,
|
|
197
|
+
...selectProps(rest),
|
|
198
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsxs)(StyledControlBar, {
|
|
199
|
+
padding: `${paddingTop}px ${paddingRight}px ${paddingBottom}px ${paddingLeft}px`,
|
|
200
|
+
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(VideoProgressBarContainer, {
|
|
201
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_VideoProgressBar.default, {
|
|
202
|
+
copy: copy,
|
|
203
|
+
videoPlayer: videoPlayer,
|
|
204
|
+
videoLength: videoLength,
|
|
205
|
+
videoCurrentTime: videoCurrentTime,
|
|
206
|
+
videoBufferEnd: videoBufferEnd,
|
|
207
|
+
setSeek: setSeek,
|
|
208
|
+
resetInactivityTimer: resetInactivityTimer
|
|
209
|
+
})
|
|
210
|
+
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_VolumeSlider.default, {
|
|
211
|
+
videoPlayer: videoPlayer,
|
|
212
|
+
videoCurrentVolume: videoCurrentVolume,
|
|
213
|
+
setVolume: setVolume,
|
|
214
|
+
videoIsMuted: videoIsMuted,
|
|
215
|
+
toggleMute: toggleMute,
|
|
216
|
+
resetInactivityTimer: resetInactivityTimer,
|
|
217
|
+
copy: copy,
|
|
218
|
+
compactModeThreshold: compactModeThreshold,
|
|
219
|
+
videoPlayerWidth: videoPlayerWidth,
|
|
220
|
+
disableFocus: videoUnplayed
|
|
221
|
+
}), /*#__PURE__*/(0, _jsxRuntime.jsxs)(_componentsBase.StackView, {
|
|
222
|
+
space: 3,
|
|
223
|
+
direction: "row",
|
|
224
|
+
children: [tracksAvailable && /*#__PURE__*/(0, _jsxRuntime.jsx)(_VideoButton.default, {
|
|
225
|
+
disableFocus: videoUnplayed,
|
|
226
|
+
label: _videoText.default[copy].captionsToggle,
|
|
227
|
+
icon: getIcon(captionsIcon),
|
|
228
|
+
onClick: () => {
|
|
229
|
+
setCaptionsMenuOpen(!captionsMenuOpen);
|
|
230
|
+
setQualityMenuOpen(false);
|
|
231
|
+
clearInactivityTimer();
|
|
232
|
+
},
|
|
233
|
+
onFocus: resetInactivityTimer,
|
|
234
|
+
onBlur: resetInactivityTimer
|
|
235
|
+
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_VideoButton.default, {
|
|
236
|
+
disableFocus: videoUnplayed,
|
|
237
|
+
label: _videoText.default[copy].qualityToggle,
|
|
238
|
+
icon: getIcon(settingsIcon),
|
|
239
|
+
onClick: () => {
|
|
240
|
+
setQualityMenuOpen(!qualityMenuOpen);
|
|
241
|
+
setCaptionsMenuOpen(false);
|
|
242
|
+
clearInactivityTimer();
|
|
243
|
+
},
|
|
244
|
+
onFocus: resetInactivityTimer,
|
|
245
|
+
onBlur: resetInactivityTimer
|
|
246
|
+
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_VideoButton.default, {
|
|
247
|
+
disableFocus: videoUnplayed,
|
|
248
|
+
label: _videoText.default[copy].fullScreenToggle,
|
|
249
|
+
icon: videoIsFullscreen ? getIcon(minimizeIcon) : getIcon(maximizeIcon),
|
|
250
|
+
onClick: toggleFullscreen,
|
|
251
|
+
onFocus: resetInactivityTimer,
|
|
252
|
+
onBlur: resetInactivityTimer
|
|
253
|
+
})]
|
|
254
|
+
}), captionsMenuOpen && /*#__PURE__*/(0, _jsxRuntime.jsx)(MenuContainer, {
|
|
255
|
+
isOpen: captionsMenuOpen,
|
|
256
|
+
...menuContainerStyleProps,
|
|
257
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_VideoMenu.default, {
|
|
258
|
+
menuLabel: _videoText.default[copy].captionsDialogue,
|
|
259
|
+
menuOptions: parseTracks(),
|
|
260
|
+
setSelection: setTextTracks,
|
|
261
|
+
selectedItem: selectedTextTrack,
|
|
262
|
+
copy: copy
|
|
263
|
+
})
|
|
264
|
+
}), qualityMenuOpen && /*#__PURE__*/(0, _jsxRuntime.jsx)(MenuContainer, {
|
|
265
|
+
isOpen: qualityMenuOpen,
|
|
266
|
+
...menuContainerStyleProps,
|
|
267
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_VideoMenu.default, {
|
|
268
|
+
menuLabel: _videoText.default[copy].qualityDialogue,
|
|
269
|
+
menuOptions: parseVideoQuality(),
|
|
270
|
+
setSelection: setVideoQuality,
|
|
271
|
+
selectedItem: videoQuality,
|
|
272
|
+
copy: copy
|
|
273
|
+
})
|
|
274
|
+
})]
|
|
275
|
+
})
|
|
276
|
+
});
|
|
277
|
+
};
|
|
278
|
+
|
|
279
|
+
ControlBar.propTypes = { ...selectedSystemPropTypes,
|
|
280
|
+
videoPlayer: _propTypes.default.object.isRequired,
|
|
281
|
+
videoPlayerContainer: _propTypes.default.object.isRequired,
|
|
282
|
+
sources: _propTypes.default.array.isRequired,
|
|
283
|
+
tracks: _propTypes.default.array,
|
|
284
|
+
videoPlaying: _propTypes.default.bool.isRequired,
|
|
285
|
+
videoUnplayed: _propTypes.default.bool.isRequired,
|
|
286
|
+
videoBufferEnd: _propTypes.default.number.isRequired,
|
|
287
|
+
isHidden: _propTypes.default.bool,
|
|
288
|
+
videoLength: _propTypes.default.number.isRequired,
|
|
289
|
+
videoCurrentTime: _propTypes.default.number.isRequired,
|
|
290
|
+
videoCurrentVolume: _propTypes.default.number.isRequired,
|
|
291
|
+
videoIsMuted: _propTypes.default.bool.isRequired,
|
|
292
|
+
setVolume: _propTypes.default.func.isRequired,
|
|
293
|
+
isMobile: _propTypes.default.bool.isRequired,
|
|
294
|
+
tracksAvailable: _propTypes.default.bool.isRequired,
|
|
295
|
+
togglePlayPause: _propTypes.default.func.isRequired,
|
|
296
|
+
setSeek: _propTypes.default.func.isRequired,
|
|
297
|
+
toggleMute: _propTypes.default.func.isRequired,
|
|
298
|
+
toggleFullscreen: _propTypes.default.func.isRequired,
|
|
299
|
+
videoIsFullscreen: _propTypes.default.bool.isRequired,
|
|
300
|
+
setTextTracks: _propTypes.default.func.isRequired,
|
|
301
|
+
selectedTextTrack: _propTypes.default.number.isRequired,
|
|
302
|
+
resetInactivityTimer: _propTypes.default.func.isRequired,
|
|
303
|
+
videoQuality: _propTypes.default.number.isRequired,
|
|
304
|
+
setVideoQuality: _propTypes.default.func.isRequired,
|
|
305
|
+
captionsMenuOpen: _propTypes.default.bool.isRequired,
|
|
306
|
+
setCaptionsMenuOpen: _propTypes.default.func.isRequired,
|
|
307
|
+
qualityMenuOpen: _propTypes.default.bool.isRequired,
|
|
308
|
+
setQualityMenuOpen: _propTypes.default.func.isRequired,
|
|
309
|
+
clearInactivityTimer: _propTypes.default.func.isRequired,
|
|
310
|
+
copy: _propTypes.default.oneOf(['en', 'fr']).isRequired,
|
|
311
|
+
compactModeThreshold: _propTypes.default.number.isRequired,
|
|
312
|
+
videoPlayerWidth: _propTypes.default.number.isRequired
|
|
313
|
+
};
|
|
314
|
+
var _default = ControlBar;
|
|
315
|
+
exports.default = _default;
|
|
@@ -0,0 +1,91 @@
|
|
|
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 StyledButton = /*#__PURE__*/_styledComponents.default.button.withConfig({
|
|
25
|
+
displayName: "VideoButton__StyledButton",
|
|
26
|
+
componentId: "components-web__sc-kfw0tr-0"
|
|
27
|
+
})(_ref => {
|
|
28
|
+
let {
|
|
29
|
+
color
|
|
30
|
+
} = _ref;
|
|
31
|
+
return {
|
|
32
|
+
background: 'none',
|
|
33
|
+
border: 'none',
|
|
34
|
+
padding: 0,
|
|
35
|
+
cursor: 'pointer',
|
|
36
|
+
display: 'inline-flex',
|
|
37
|
+
alignItems: 'stretch',
|
|
38
|
+
'svg path': {
|
|
39
|
+
fill: color
|
|
40
|
+
}
|
|
41
|
+
};
|
|
42
|
+
});
|
|
43
|
+
|
|
44
|
+
const VideoButton = _ref2 => {
|
|
45
|
+
let {
|
|
46
|
+
icon,
|
|
47
|
+
label,
|
|
48
|
+
disableFocus,
|
|
49
|
+
children,
|
|
50
|
+
tokens,
|
|
51
|
+
variant,
|
|
52
|
+
...rest
|
|
53
|
+
} = _ref2;
|
|
54
|
+
const {
|
|
55
|
+
color
|
|
56
|
+
} = (0, _componentsBase.useThemeTokens)('VideoButton', tokens, variant);
|
|
57
|
+
|
|
58
|
+
const handleOnKeyDown = event => {
|
|
59
|
+
const key = event.key || event.keyCode; // Disables playing by space bar, as that can be used to click a button
|
|
60
|
+
|
|
61
|
+
if (key === ' ' || key === 32) {
|
|
62
|
+
event.stopPropagation();
|
|
63
|
+
}
|
|
64
|
+
};
|
|
65
|
+
|
|
66
|
+
const handleClick = event => {
|
|
67
|
+
var _rest$onClick;
|
|
68
|
+
|
|
69
|
+
event.preventDefault();
|
|
70
|
+
(_rest$onClick = rest.onClick) === null || _rest$onClick === void 0 ? void 0 : _rest$onClick.call(rest, event);
|
|
71
|
+
};
|
|
72
|
+
|
|
73
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsxs)(StyledButton, {
|
|
74
|
+
"aria-label": label,
|
|
75
|
+
onKeyDown: handleOnKeyDown,
|
|
76
|
+
tabIndex: disableFocus ? '-1' : undefined,
|
|
77
|
+
color: color,
|
|
78
|
+
...selectProps(rest),
|
|
79
|
+
onClick: handleClick,
|
|
80
|
+
children: [icon, children]
|
|
81
|
+
});
|
|
82
|
+
};
|
|
83
|
+
|
|
84
|
+
VideoButton.propTypes = { ...selectedSystemPropTypes,
|
|
85
|
+
icon: _propTypes.default.element.isRequired,
|
|
86
|
+
label: _propTypes.default.string.isRequired,
|
|
87
|
+
disableFocus: _propTypes.default.bool.isRequired,
|
|
88
|
+
children: _propTypes.default.node
|
|
89
|
+
};
|
|
90
|
+
var _default = VideoButton;
|
|
91
|
+
exports.default = _default;
|
|
@@ -0,0 +1,186 @@
|
|
|
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 MenuContainer = /*#__PURE__*/_styledComponents.default.div.withConfig({
|
|
27
|
+
displayName: "VideoMenu__MenuContainer",
|
|
28
|
+
componentId: "components-web__sc-nllbhw-0"
|
|
29
|
+
})(_ref => {
|
|
30
|
+
let {
|
|
31
|
+
padding,
|
|
32
|
+
background
|
|
33
|
+
} = _ref;
|
|
34
|
+
return {
|
|
35
|
+
width: 114,
|
|
36
|
+
padding,
|
|
37
|
+
backgroundColor: background,
|
|
38
|
+
borderRadius: 5
|
|
39
|
+
};
|
|
40
|
+
});
|
|
41
|
+
|
|
42
|
+
const MenuButton = /*#__PURE__*/_styledComponents.default.button.withConfig({
|
|
43
|
+
displayName: "VideoMenu__MenuButton",
|
|
44
|
+
componentId: "components-web__sc-nllbhw-1"
|
|
45
|
+
})({
|
|
46
|
+
background: 'none',
|
|
47
|
+
border: 'none',
|
|
48
|
+
padding: 0,
|
|
49
|
+
width: '100%',
|
|
50
|
+
cursor: 'pointer',
|
|
51
|
+
display: 'flex',
|
|
52
|
+
justifyContent: 'space-between',
|
|
53
|
+
verticalAlign: 'middle'
|
|
54
|
+
});
|
|
55
|
+
|
|
56
|
+
const CheckmarkContainer = /*#__PURE__*/_styledComponents.default.div.withConfig({
|
|
57
|
+
displayName: "VideoMenu__CheckmarkContainer",
|
|
58
|
+
componentId: "components-web__sc-nllbhw-2"
|
|
59
|
+
})(_ref2 => {
|
|
60
|
+
let {
|
|
61
|
+
isSelectedItem,
|
|
62
|
+
checkMarkWidth,
|
|
63
|
+
checkMarkHeight,
|
|
64
|
+
checkMarkSelectedColor,
|
|
65
|
+
checkMarkHoverColor,
|
|
66
|
+
checkMarkFocusColor,
|
|
67
|
+
checkMarkUnselectedColor
|
|
68
|
+
} = _ref2;
|
|
69
|
+
return {
|
|
70
|
+
width: checkMarkWidth,
|
|
71
|
+
height: checkMarkHeight,
|
|
72
|
+
marginTop: 2,
|
|
73
|
+
outline: 'none',
|
|
74
|
+
[`${MenuButton} && svg`]: {
|
|
75
|
+
fill: isSelectedItem ? checkMarkSelectedColor : checkMarkUnselectedColor
|
|
76
|
+
},
|
|
77
|
+
[`${MenuButton}:hover && svg`]: {
|
|
78
|
+
fill: isSelectedItem ? checkMarkSelectedColor : checkMarkHoverColor
|
|
79
|
+
},
|
|
80
|
+
[`${MenuButton}:focus && svg`]: {
|
|
81
|
+
fill: isSelectedItem ? checkMarkSelectedColor : checkMarkFocusColor
|
|
82
|
+
}
|
|
83
|
+
};
|
|
84
|
+
});
|
|
85
|
+
|
|
86
|
+
const VideoMenu = _ref3 => {
|
|
87
|
+
let {
|
|
88
|
+
menuLabel,
|
|
89
|
+
menuOptions,
|
|
90
|
+
setSelection,
|
|
91
|
+
selectedItem,
|
|
92
|
+
copy,
|
|
93
|
+
tokens,
|
|
94
|
+
variant,
|
|
95
|
+
...rest
|
|
96
|
+
} = _ref3;
|
|
97
|
+
const {
|
|
98
|
+
padding,
|
|
99
|
+
background,
|
|
100
|
+
checkMarkWidth,
|
|
101
|
+
checkMarkHeight,
|
|
102
|
+
checkMarkSelectedColor,
|
|
103
|
+
checkMarkHoverColor,
|
|
104
|
+
checkMarkFocusColor,
|
|
105
|
+
checkMarkUnselectedColor,
|
|
106
|
+
checkMarkIcon
|
|
107
|
+
} = (0, _componentsBase.useThemeTokens)('VideoMenu', tokens, variant);
|
|
108
|
+
|
|
109
|
+
const getMenuItems = () => {
|
|
110
|
+
return menuOptions.map(option => {
|
|
111
|
+
if (option.name) {
|
|
112
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsxs)(MenuButton, {
|
|
113
|
+
"aria-haspopup": "true",
|
|
114
|
+
role: "menuitem",
|
|
115
|
+
"aria-label": `${option.name} ${menuLabel}. ${selectedItem === option.value ? _videoText.default[copy].itemSelected : _videoText.default[copy].itemUnselected}`,
|
|
116
|
+
selectedItem: selectedItem,
|
|
117
|
+
itemValue: option.value,
|
|
118
|
+
onClick: () => {
|
|
119
|
+
if (selectedItem !== option.value) {
|
|
120
|
+
setSelection(option.value);
|
|
121
|
+
}
|
|
122
|
+
},
|
|
123
|
+
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_componentsBase.Typography, {
|
|
124
|
+
variant: {
|
|
125
|
+
bold: true,
|
|
126
|
+
inverse: true
|
|
127
|
+
},
|
|
128
|
+
children: option.name
|
|
129
|
+
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(CheckmarkContainer, {
|
|
130
|
+
isSelectedItem: option.value === selectedItem,
|
|
131
|
+
checkMarkWidth: checkMarkWidth,
|
|
132
|
+
checkMarkHeight: checkMarkHeight,
|
|
133
|
+
checkMarkSelectedColor: checkMarkSelectedColor,
|
|
134
|
+
checkMarkHoverColor: checkMarkHoverColor,
|
|
135
|
+
checkMarkFocusColor: checkMarkFocusColor,
|
|
136
|
+
checkMarkUnselectedColor: checkMarkUnselectedColor,
|
|
137
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_componentsBase.Icon, {
|
|
138
|
+
icon: checkMarkIcon
|
|
139
|
+
})
|
|
140
|
+
})]
|
|
141
|
+
}, option.value);
|
|
142
|
+
}
|
|
143
|
+
|
|
144
|
+
return null;
|
|
145
|
+
});
|
|
146
|
+
};
|
|
147
|
+
|
|
148
|
+
const handleOnKeyDown = event => {
|
|
149
|
+
const key = event.key || event.keyCode; // Disables playing by space bar, as that can be used to click a button
|
|
150
|
+
|
|
151
|
+
if (key === ' ' || key === 32) {
|
|
152
|
+
event.stopPropagation();
|
|
153
|
+
}
|
|
154
|
+
};
|
|
155
|
+
|
|
156
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsx)(MenuContainer, {
|
|
157
|
+
onKeyDown: handleOnKeyDown,
|
|
158
|
+
padding: padding,
|
|
159
|
+
background: background,
|
|
160
|
+
...selectProps(rest),
|
|
161
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsxs)(_componentsBase.StackView, {
|
|
162
|
+
space: 2,
|
|
163
|
+
divider: true,
|
|
164
|
+
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_componentsBase.Typography, {
|
|
165
|
+
variant: {
|
|
166
|
+
bold: true,
|
|
167
|
+
inverse: true
|
|
168
|
+
},
|
|
169
|
+
children: menuLabel
|
|
170
|
+
}), /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
|
|
171
|
+
role: "menu",
|
|
172
|
+
children: getMenuItems()
|
|
173
|
+
})]
|
|
174
|
+
})
|
|
175
|
+
});
|
|
176
|
+
};
|
|
177
|
+
|
|
178
|
+
VideoMenu.propTypes = { ...selectedSystemPropTypes,
|
|
179
|
+
menuLabel: _propTypes.default.string.isRequired,
|
|
180
|
+
menuOptions: _propTypes.default.array.isRequired,
|
|
181
|
+
setSelection: _propTypes.default.func.isRequired,
|
|
182
|
+
selectedItem: _propTypes.default.oneOfType([_propTypes.default.number, _propTypes.default.string]).isRequired,
|
|
183
|
+
copy: _propTypes.default.oneOf(['en', 'fr']).isRequired
|
|
184
|
+
};
|
|
185
|
+
var _default = VideoMenu;
|
|
186
|
+
exports.default = _default;
|