@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.
- package/CHANGELOG.md +27 -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/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/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/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/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/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/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/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/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/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,74 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import PropTypes from 'prop-types';
|
|
3
|
+
import styled from 'styled-components';
|
|
4
|
+
import { useThemeTokens, selectSystemProps } from '@telus-uds/components-base';
|
|
5
|
+
import { htmlAttrs } from '../../../../utils';
|
|
6
|
+
import { jsxs as _jsxs } from "react/jsx-runtime";
|
|
7
|
+
const [selectProps, selectedSystemPropTypes] = selectSystemProps([htmlAttrs]);
|
|
8
|
+
const StyledButton = /*#__PURE__*/styled.button.withConfig({
|
|
9
|
+
displayName: "VideoButton__StyledButton",
|
|
10
|
+
componentId: "components-web__sc-kfw0tr-0"
|
|
11
|
+
})(_ref => {
|
|
12
|
+
let {
|
|
13
|
+
color
|
|
14
|
+
} = _ref;
|
|
15
|
+
return {
|
|
16
|
+
background: 'none',
|
|
17
|
+
border: 'none',
|
|
18
|
+
padding: 0,
|
|
19
|
+
cursor: 'pointer',
|
|
20
|
+
display: 'inline-flex',
|
|
21
|
+
alignItems: 'stretch',
|
|
22
|
+
'svg path': {
|
|
23
|
+
fill: color
|
|
24
|
+
}
|
|
25
|
+
};
|
|
26
|
+
});
|
|
27
|
+
|
|
28
|
+
const VideoButton = _ref2 => {
|
|
29
|
+
let {
|
|
30
|
+
icon,
|
|
31
|
+
label,
|
|
32
|
+
disableFocus,
|
|
33
|
+
children,
|
|
34
|
+
tokens,
|
|
35
|
+
variant,
|
|
36
|
+
...rest
|
|
37
|
+
} = _ref2;
|
|
38
|
+
const {
|
|
39
|
+
color
|
|
40
|
+
} = useThemeTokens('VideoButton', tokens, variant);
|
|
41
|
+
|
|
42
|
+
const handleOnKeyDown = event => {
|
|
43
|
+
const key = event.key || event.keyCode; // Disables playing by space bar, as that can be used to click a button
|
|
44
|
+
|
|
45
|
+
if (key === ' ' || key === 32) {
|
|
46
|
+
event.stopPropagation();
|
|
47
|
+
}
|
|
48
|
+
};
|
|
49
|
+
|
|
50
|
+
const handleClick = event => {
|
|
51
|
+
var _rest$onClick;
|
|
52
|
+
|
|
53
|
+
event.preventDefault();
|
|
54
|
+
(_rest$onClick = rest.onClick) === null || _rest$onClick === void 0 ? void 0 : _rest$onClick.call(rest, event);
|
|
55
|
+
};
|
|
56
|
+
|
|
57
|
+
return /*#__PURE__*/_jsxs(StyledButton, {
|
|
58
|
+
"aria-label": label,
|
|
59
|
+
onKeyDown: handleOnKeyDown,
|
|
60
|
+
tabIndex: disableFocus ? '-1' : undefined,
|
|
61
|
+
color: color,
|
|
62
|
+
...selectProps(rest),
|
|
63
|
+
onClick: handleClick,
|
|
64
|
+
children: [icon, children]
|
|
65
|
+
});
|
|
66
|
+
};
|
|
67
|
+
|
|
68
|
+
VideoButton.propTypes = { ...selectedSystemPropTypes,
|
|
69
|
+
icon: PropTypes.element.isRequired,
|
|
70
|
+
label: PropTypes.string.isRequired,
|
|
71
|
+
disableFocus: PropTypes.bool.isRequired,
|
|
72
|
+
children: PropTypes.node
|
|
73
|
+
};
|
|
74
|
+
export default VideoButton;
|
|
@@ -0,0 +1,167 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import PropTypes from 'prop-types';
|
|
3
|
+
import styled from 'styled-components';
|
|
4
|
+
import { StackView, Typography, useThemeTokens, selectSystemProps, Icon } from '@telus-uds/components-base';
|
|
5
|
+
import videoText from '../../../videoText';
|
|
6
|
+
import { htmlAttrs } from '../../../../utils';
|
|
7
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
8
|
+
import { jsxs as _jsxs } from "react/jsx-runtime";
|
|
9
|
+
const [selectProps, selectedSystemPropTypes] = selectSystemProps([htmlAttrs]);
|
|
10
|
+
const MenuContainer = /*#__PURE__*/styled.div.withConfig({
|
|
11
|
+
displayName: "VideoMenu__MenuContainer",
|
|
12
|
+
componentId: "components-web__sc-nllbhw-0"
|
|
13
|
+
})(_ref => {
|
|
14
|
+
let {
|
|
15
|
+
padding,
|
|
16
|
+
background
|
|
17
|
+
} = _ref;
|
|
18
|
+
return {
|
|
19
|
+
width: 114,
|
|
20
|
+
padding,
|
|
21
|
+
backgroundColor: background,
|
|
22
|
+
borderRadius: 5
|
|
23
|
+
};
|
|
24
|
+
});
|
|
25
|
+
const MenuButton = /*#__PURE__*/styled.button.withConfig({
|
|
26
|
+
displayName: "VideoMenu__MenuButton",
|
|
27
|
+
componentId: "components-web__sc-nllbhw-1"
|
|
28
|
+
})({
|
|
29
|
+
background: 'none',
|
|
30
|
+
border: 'none',
|
|
31
|
+
padding: 0,
|
|
32
|
+
width: '100%',
|
|
33
|
+
cursor: 'pointer',
|
|
34
|
+
display: 'flex',
|
|
35
|
+
justifyContent: 'space-between',
|
|
36
|
+
verticalAlign: 'middle'
|
|
37
|
+
});
|
|
38
|
+
const CheckmarkContainer = /*#__PURE__*/styled.div.withConfig({
|
|
39
|
+
displayName: "VideoMenu__CheckmarkContainer",
|
|
40
|
+
componentId: "components-web__sc-nllbhw-2"
|
|
41
|
+
})(_ref2 => {
|
|
42
|
+
let {
|
|
43
|
+
isSelectedItem,
|
|
44
|
+
checkMarkWidth,
|
|
45
|
+
checkMarkHeight,
|
|
46
|
+
checkMarkSelectedColor,
|
|
47
|
+
checkMarkHoverColor,
|
|
48
|
+
checkMarkFocusColor,
|
|
49
|
+
checkMarkUnselectedColor
|
|
50
|
+
} = _ref2;
|
|
51
|
+
return {
|
|
52
|
+
width: checkMarkWidth,
|
|
53
|
+
height: checkMarkHeight,
|
|
54
|
+
marginTop: 2,
|
|
55
|
+
outline: 'none',
|
|
56
|
+
[`${MenuButton} && svg`]: {
|
|
57
|
+
fill: isSelectedItem ? checkMarkSelectedColor : checkMarkUnselectedColor
|
|
58
|
+
},
|
|
59
|
+
[`${MenuButton}:hover && svg`]: {
|
|
60
|
+
fill: isSelectedItem ? checkMarkSelectedColor : checkMarkHoverColor
|
|
61
|
+
},
|
|
62
|
+
[`${MenuButton}:focus && svg`]: {
|
|
63
|
+
fill: isSelectedItem ? checkMarkSelectedColor : checkMarkFocusColor
|
|
64
|
+
}
|
|
65
|
+
};
|
|
66
|
+
});
|
|
67
|
+
|
|
68
|
+
const VideoMenu = _ref3 => {
|
|
69
|
+
let {
|
|
70
|
+
menuLabel,
|
|
71
|
+
menuOptions,
|
|
72
|
+
setSelection,
|
|
73
|
+
selectedItem,
|
|
74
|
+
copy,
|
|
75
|
+
tokens,
|
|
76
|
+
variant,
|
|
77
|
+
...rest
|
|
78
|
+
} = _ref3;
|
|
79
|
+
const {
|
|
80
|
+
padding,
|
|
81
|
+
background,
|
|
82
|
+
checkMarkWidth,
|
|
83
|
+
checkMarkHeight,
|
|
84
|
+
checkMarkSelectedColor,
|
|
85
|
+
checkMarkHoverColor,
|
|
86
|
+
checkMarkFocusColor,
|
|
87
|
+
checkMarkUnselectedColor,
|
|
88
|
+
checkMarkIcon
|
|
89
|
+
} = useThemeTokens('VideoMenu', tokens, variant);
|
|
90
|
+
|
|
91
|
+
const getMenuItems = () => {
|
|
92
|
+
return menuOptions.map(option => {
|
|
93
|
+
if (option.name) {
|
|
94
|
+
return /*#__PURE__*/_jsxs(MenuButton, {
|
|
95
|
+
"aria-haspopup": "true",
|
|
96
|
+
role: "menuitem",
|
|
97
|
+
"aria-label": `${option.name} ${menuLabel}. ${selectedItem === option.value ? videoText[copy].itemSelected : videoText[copy].itemUnselected}`,
|
|
98
|
+
selectedItem: selectedItem,
|
|
99
|
+
itemValue: option.value,
|
|
100
|
+
onClick: () => {
|
|
101
|
+
if (selectedItem !== option.value) {
|
|
102
|
+
setSelection(option.value);
|
|
103
|
+
}
|
|
104
|
+
},
|
|
105
|
+
children: [/*#__PURE__*/_jsx(Typography, {
|
|
106
|
+
variant: {
|
|
107
|
+
bold: true,
|
|
108
|
+
inverse: true
|
|
109
|
+
},
|
|
110
|
+
children: option.name
|
|
111
|
+
}), /*#__PURE__*/_jsx(CheckmarkContainer, {
|
|
112
|
+
isSelectedItem: option.value === selectedItem,
|
|
113
|
+
checkMarkWidth: checkMarkWidth,
|
|
114
|
+
checkMarkHeight: checkMarkHeight,
|
|
115
|
+
checkMarkSelectedColor: checkMarkSelectedColor,
|
|
116
|
+
checkMarkHoverColor: checkMarkHoverColor,
|
|
117
|
+
checkMarkFocusColor: checkMarkFocusColor,
|
|
118
|
+
checkMarkUnselectedColor: checkMarkUnselectedColor,
|
|
119
|
+
children: /*#__PURE__*/_jsx(Icon, {
|
|
120
|
+
icon: checkMarkIcon
|
|
121
|
+
})
|
|
122
|
+
})]
|
|
123
|
+
}, option.value);
|
|
124
|
+
}
|
|
125
|
+
|
|
126
|
+
return null;
|
|
127
|
+
});
|
|
128
|
+
};
|
|
129
|
+
|
|
130
|
+
const handleOnKeyDown = event => {
|
|
131
|
+
const key = event.key || event.keyCode; // Disables playing by space bar, as that can be used to click a button
|
|
132
|
+
|
|
133
|
+
if (key === ' ' || key === 32) {
|
|
134
|
+
event.stopPropagation();
|
|
135
|
+
}
|
|
136
|
+
};
|
|
137
|
+
|
|
138
|
+
return /*#__PURE__*/_jsx(MenuContainer, {
|
|
139
|
+
onKeyDown: handleOnKeyDown,
|
|
140
|
+
padding: padding,
|
|
141
|
+
background: background,
|
|
142
|
+
...selectProps(rest),
|
|
143
|
+
children: /*#__PURE__*/_jsxs(StackView, {
|
|
144
|
+
space: 2,
|
|
145
|
+
divider: true,
|
|
146
|
+
children: [/*#__PURE__*/_jsx(Typography, {
|
|
147
|
+
variant: {
|
|
148
|
+
bold: true,
|
|
149
|
+
inverse: true
|
|
150
|
+
},
|
|
151
|
+
children: menuLabel
|
|
152
|
+
}), /*#__PURE__*/_jsx("div", {
|
|
153
|
+
role: "menu",
|
|
154
|
+
children: getMenuItems()
|
|
155
|
+
})]
|
|
156
|
+
})
|
|
157
|
+
});
|
|
158
|
+
};
|
|
159
|
+
|
|
160
|
+
VideoMenu.propTypes = { ...selectedSystemPropTypes,
|
|
161
|
+
menuLabel: PropTypes.string.isRequired,
|
|
162
|
+
menuOptions: PropTypes.array.isRequired,
|
|
163
|
+
setSelection: PropTypes.func.isRequired,
|
|
164
|
+
selectedItem: PropTypes.oneOfType([PropTypes.number, PropTypes.string]).isRequired,
|
|
165
|
+
copy: PropTypes.oneOf(['en', 'fr']).isRequired
|
|
166
|
+
};
|
|
167
|
+
export default VideoMenu;
|
|
@@ -0,0 +1,201 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import PropTypes from 'prop-types';
|
|
3
|
+
import styled from 'styled-components';
|
|
4
|
+
import { Typography, useThemeTokens, selectSystemProps } from '@telus-uds/components-base';
|
|
5
|
+
import videoText from '../../../videoText';
|
|
6
|
+
import { htmlAttrs } from '../../../../utils';
|
|
7
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
8
|
+
import { jsxs as _jsxs } from "react/jsx-runtime";
|
|
9
|
+
const [selectProps, selectedSystemPropTypes] = selectSystemProps([htmlAttrs]);
|
|
10
|
+
const ProgressBarContainer = /*#__PURE__*/styled.div.withConfig({
|
|
11
|
+
displayName: "VideoProgressBar__ProgressBarContainer",
|
|
12
|
+
componentId: "components-web__sc-d9tm07-0"
|
|
13
|
+
})({
|
|
14
|
+
display: 'flex',
|
|
15
|
+
width: '100%',
|
|
16
|
+
alignItems: 'center'
|
|
17
|
+
});
|
|
18
|
+
|
|
19
|
+
const sharedStyles = _ref => {
|
|
20
|
+
let {
|
|
21
|
+
thumbHeight,
|
|
22
|
+
thumbWidth,
|
|
23
|
+
thumbBackground,
|
|
24
|
+
trackGradientStart,
|
|
25
|
+
trackGradientEnd
|
|
26
|
+
} = _ref;
|
|
27
|
+
return {
|
|
28
|
+
thumb: {
|
|
29
|
+
appearance: 'none',
|
|
30
|
+
height: thumbHeight,
|
|
31
|
+
width: thumbWidth,
|
|
32
|
+
borderRadius: '50%',
|
|
33
|
+
background: thumbBackground,
|
|
34
|
+
cursor: 'pointer',
|
|
35
|
+
marginTop: -3,
|
|
36
|
+
'&:hover': {
|
|
37
|
+
transform: 'scale(1.5)'
|
|
38
|
+
}
|
|
39
|
+
},
|
|
40
|
+
track: videoBufferDisplay => ({
|
|
41
|
+
width: '100%',
|
|
42
|
+
height: 2,
|
|
43
|
+
cursor: 'pointer',
|
|
44
|
+
borderRadius: 1.3,
|
|
45
|
+
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
|
|
46
|
+
|
|
47
|
+
})
|
|
48
|
+
};
|
|
49
|
+
};
|
|
50
|
+
|
|
51
|
+
const StyledProgressBar = /*#__PURE__*/styled.input.attrs(_ref2 => {
|
|
52
|
+
let {
|
|
53
|
+
videoCurrentTime
|
|
54
|
+
} = _ref2;
|
|
55
|
+
return {
|
|
56
|
+
value: videoCurrentTime
|
|
57
|
+
};
|
|
58
|
+
}).withConfig({
|
|
59
|
+
displayName: "VideoProgressBar__StyledProgressBar",
|
|
60
|
+
componentId: "components-web__sc-d9tm07-1"
|
|
61
|
+
})(_ref3 => {
|
|
62
|
+
let {
|
|
63
|
+
videoBufferDisplay,
|
|
64
|
+
rangeBackground,
|
|
65
|
+
...sharedProps
|
|
66
|
+
} = _ref3;
|
|
67
|
+
return {
|
|
68
|
+
width: '100%',
|
|
69
|
+
cursor: 'pointer',
|
|
70
|
+
padding: '5px 0',
|
|
71
|
+
'input[type=range]&': {
|
|
72
|
+
appearance: 'none',
|
|
73
|
+
width: '100%',
|
|
74
|
+
background: rangeBackground
|
|
75
|
+
},
|
|
76
|
+
'input[type=range]&:focus': {
|
|
77
|
+
outline: 'none'
|
|
78
|
+
},
|
|
79
|
+
'input[type=range]&::-webkit-slider-thumb': sharedStyles(sharedProps).thumb,
|
|
80
|
+
'input[type=range]&::-moz-range-thumb': { ...sharedStyles(sharedProps).thumb,
|
|
81
|
+
border: 'none'
|
|
82
|
+
},
|
|
83
|
+
'input[type=range]&::-ms-thumb': { ...sharedStyles(sharedProps).thumb,
|
|
84
|
+
margin: 0,
|
|
85
|
+
border: 'none'
|
|
86
|
+
},
|
|
87
|
+
'input[type=range]&::-webkit-slider-runnable-track': sharedStyles(sharedProps).track(videoBufferDisplay),
|
|
88
|
+
'input[type=range]&::-moz-range-track': sharedStyles(sharedProps).track(videoBufferDisplay),
|
|
89
|
+
'input[type=range]&::-ms-track': { ...sharedStyles(sharedProps).track(videoBufferDisplay),
|
|
90
|
+
margin: '6px 0',
|
|
91
|
+
border: 'none'
|
|
92
|
+
},
|
|
93
|
+
'input[type=range]&::-ms-fill-lower': {
|
|
94
|
+
background: rangeBackground
|
|
95
|
+
},
|
|
96
|
+
'input[type=range]&::-ms-tooltip': {
|
|
97
|
+
display: 'none'
|
|
98
|
+
}
|
|
99
|
+
};
|
|
100
|
+
});
|
|
101
|
+
const StyledTimestamp = /*#__PURE__*/styled.span.withConfig({
|
|
102
|
+
displayName: "VideoProgressBar__StyledTimestamp",
|
|
103
|
+
componentId: "components-web__sc-d9tm07-2"
|
|
104
|
+
})(_ref4 => {
|
|
105
|
+
let {
|
|
106
|
+
margin
|
|
107
|
+
} = _ref4;
|
|
108
|
+
return {
|
|
109
|
+
margin
|
|
110
|
+
};
|
|
111
|
+
}); // TODO: unify with the helper from `VideoSplash`
|
|
112
|
+
|
|
113
|
+
function getTimestamp(duration) {
|
|
114
|
+
const minutes = Math.floor(duration / 60);
|
|
115
|
+
const seconds = Math.floor(duration - 60 * minutes);
|
|
116
|
+
return `${minutes}:${seconds < 10 ? 0 : ''}${seconds}`;
|
|
117
|
+
}
|
|
118
|
+
|
|
119
|
+
const VideoProgressBar = _ref5 => {
|
|
120
|
+
let {
|
|
121
|
+
copy = 'en',
|
|
122
|
+
videoLength,
|
|
123
|
+
videoCurrentTime,
|
|
124
|
+
videoBufferEnd,
|
|
125
|
+
setSeek,
|
|
126
|
+
resetInactivityTimer,
|
|
127
|
+
tokens,
|
|
128
|
+
variant,
|
|
129
|
+
...rest
|
|
130
|
+
} = _ref5;
|
|
131
|
+
const {
|
|
132
|
+
thumbHeight,
|
|
133
|
+
thumbWidth,
|
|
134
|
+
thumbBackground,
|
|
135
|
+
timestampMarginLeft,
|
|
136
|
+
timestampMarginRight,
|
|
137
|
+
trackGradientStart,
|
|
138
|
+
trackGradientEnd,
|
|
139
|
+
rangeBackground
|
|
140
|
+
} = useThemeTokens('VideoProgressBar', tokens, variant);
|
|
141
|
+
const videoProgressBar = /*#__PURE__*/React.createRef();
|
|
142
|
+
|
|
143
|
+
const handleVideoSkip = () => {
|
|
144
|
+
setSeek(videoProgressBar.current.value);
|
|
145
|
+
};
|
|
146
|
+
|
|
147
|
+
const videoBufferDisplay = videoBufferEnd / videoLength * 100;
|
|
148
|
+
const isVideoUnplayed = videoCurrentTime === -1;
|
|
149
|
+
const currentTime = isVideoUnplayed ? 0 : videoCurrentTime;
|
|
150
|
+
const remainingTime = isVideoUnplayed ? videoLength : videoLength - videoCurrentTime;
|
|
151
|
+
const currentTimestamp = getTimestamp(currentTime);
|
|
152
|
+
const remainingTimestamp = getTimestamp(remainingTime);
|
|
153
|
+
const sharedProps = {
|
|
154
|
+
thumbWidth,
|
|
155
|
+
thumbHeight,
|
|
156
|
+
thumbBackground,
|
|
157
|
+
trackGradientStart,
|
|
158
|
+
trackGradientEnd,
|
|
159
|
+
rangeBackground
|
|
160
|
+
};
|
|
161
|
+
return /*#__PURE__*/_jsxs(ProgressBarContainer, { ...selectProps(rest),
|
|
162
|
+
children: [/*#__PURE__*/_jsx(StyledTimestamp, {
|
|
163
|
+
margin: `0 ${timestampMarginRight}px 0 ${timestampMarginLeft}px`,
|
|
164
|
+
children: /*#__PURE__*/_jsx(Typography, {
|
|
165
|
+
variant: {
|
|
166
|
+
inverse: true
|
|
167
|
+
},
|
|
168
|
+
children: currentTimestamp
|
|
169
|
+
})
|
|
170
|
+
}), /*#__PURE__*/_jsx(StyledProgressBar, {
|
|
171
|
+
"aria-label": videoText[copy].videoProgressBarLabel,
|
|
172
|
+
type: "range",
|
|
173
|
+
step: "any",
|
|
174
|
+
max: videoLength,
|
|
175
|
+
videoCurrentTime: videoCurrentTime,
|
|
176
|
+
onChange: handleVideoSkip,
|
|
177
|
+
onFocus: resetInactivityTimer,
|
|
178
|
+
videoBufferDisplay: videoBufferDisplay,
|
|
179
|
+
ref: videoProgressBar,
|
|
180
|
+
tabIndex: "-1",
|
|
181
|
+
...sharedProps
|
|
182
|
+
}), /*#__PURE__*/_jsx(StyledTimestamp, {
|
|
183
|
+
children: /*#__PURE__*/_jsx(Typography, {
|
|
184
|
+
variant: {
|
|
185
|
+
inverse: true
|
|
186
|
+
},
|
|
187
|
+
children: remainingTimestamp
|
|
188
|
+
})
|
|
189
|
+
})]
|
|
190
|
+
});
|
|
191
|
+
};
|
|
192
|
+
|
|
193
|
+
VideoProgressBar.propTypes = { ...selectedSystemPropTypes,
|
|
194
|
+
copy: PropTypes.oneOf(['en', 'fr']),
|
|
195
|
+
videoLength: PropTypes.number.isRequired,
|
|
196
|
+
videoCurrentTime: PropTypes.number.isRequired,
|
|
197
|
+
videoBufferEnd: PropTypes.number.isRequired,
|
|
198
|
+
setSeek: PropTypes.func.isRequired,
|
|
199
|
+
resetInactivityTimer: PropTypes.func.isRequired
|
|
200
|
+
};
|
|
201
|
+
export default VideoProgressBar;
|
|
@@ -0,0 +1,193 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import PropTypes from 'prop-types';
|
|
3
|
+
import styled from 'styled-components';
|
|
4
|
+
import { Icon, useThemeTokens, selectSystemProps } from '@telus-uds/components-base';
|
|
5
|
+
import VideoButton from '../VideoButton/VideoButton';
|
|
6
|
+
import videoText from '../../../videoText';
|
|
7
|
+
import { htmlAttrs } from '../../../../utils';
|
|
8
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
9
|
+
import { jsxs as _jsxs } from "react/jsx-runtime";
|
|
10
|
+
const [selectProps, selectedSystemPropTypes] = selectSystemProps([htmlAttrs]);
|
|
11
|
+
const VolumeSliderContainer = /*#__PURE__*/styled.div.withConfig({
|
|
12
|
+
displayName: "VolumeSlider__VolumeSliderContainer",
|
|
13
|
+
componentId: "components-web__sc-apixz4-0"
|
|
14
|
+
})(_ref => {
|
|
15
|
+
let {
|
|
16
|
+
videoPlayerWidth,
|
|
17
|
+
compactModeThreshold,
|
|
18
|
+
margin
|
|
19
|
+
} = _ref;
|
|
20
|
+
return {
|
|
21
|
+
display: 'flex',
|
|
22
|
+
width: videoPlayerWidth > compactModeThreshold ? '12%' : '20%',
|
|
23
|
+
maxWidth: 120,
|
|
24
|
+
margin,
|
|
25
|
+
alignItems: 'center'
|
|
26
|
+
};
|
|
27
|
+
});
|
|
28
|
+
|
|
29
|
+
const sharedStyles = _ref2 => {
|
|
30
|
+
let {
|
|
31
|
+
thumbHeight,
|
|
32
|
+
thumbWidth,
|
|
33
|
+
thumbBackground,
|
|
34
|
+
trackGradientStart,
|
|
35
|
+
trackGradientEnd
|
|
36
|
+
} = _ref2;
|
|
37
|
+
return {
|
|
38
|
+
thumb: {
|
|
39
|
+
appearance: 'none',
|
|
40
|
+
height: thumbHeight,
|
|
41
|
+
width: thumbWidth,
|
|
42
|
+
borderRadius: '50%',
|
|
43
|
+
background: thumbBackground,
|
|
44
|
+
cursor: 'pointer',
|
|
45
|
+
marginTop: -3,
|
|
46
|
+
'&:hover': {
|
|
47
|
+
transform: 'scale(1.5)'
|
|
48
|
+
}
|
|
49
|
+
},
|
|
50
|
+
track: videoCurrentVolume => ({
|
|
51
|
+
width: '100%',
|
|
52
|
+
height: 2,
|
|
53
|
+
cursor: 'pointer',
|
|
54
|
+
borderRadius: 1.3,
|
|
55
|
+
background: `linear-gradient(to right, ${trackGradientStart} 0%, ${trackGradientEnd} ${videoCurrentVolume * 100 - 0.01}%, rgba(255,255,255,0.5) ${videoCurrentVolume * 100}%)`
|
|
56
|
+
})
|
|
57
|
+
};
|
|
58
|
+
};
|
|
59
|
+
|
|
60
|
+
const StyledVolumeSlider = /*#__PURE__*/styled.input.attrs(_ref3 => {
|
|
61
|
+
let {
|
|
62
|
+
videoCurrentVolume
|
|
63
|
+
} = _ref3;
|
|
64
|
+
return {
|
|
65
|
+
value: videoCurrentVolume
|
|
66
|
+
};
|
|
67
|
+
}).withConfig({
|
|
68
|
+
displayName: "VolumeSlider__StyledVolumeSlider",
|
|
69
|
+
componentId: "components-web__sc-apixz4-1"
|
|
70
|
+
})(_ref4 => {
|
|
71
|
+
let {
|
|
72
|
+
videoCurrentVolume,
|
|
73
|
+
rangeBackground,
|
|
74
|
+
...sharedProps
|
|
75
|
+
} = _ref4;
|
|
76
|
+
return {
|
|
77
|
+
width: '100%',
|
|
78
|
+
cursor: 'pointer',
|
|
79
|
+
padding: '5px 0',
|
|
80
|
+
'input[type=range]&': {
|
|
81
|
+
appearance: 'none',
|
|
82
|
+
width: '100%',
|
|
83
|
+
background: rangeBackground
|
|
84
|
+
},
|
|
85
|
+
'input[type=range]&:focus': {
|
|
86
|
+
outline: 'none'
|
|
87
|
+
},
|
|
88
|
+
'input[type=range]&::-webkit-slider-thumb': sharedStyles(sharedProps).thumb,
|
|
89
|
+
'input[type=range]&::-moz-range-thumb': { ...sharedStyles.thumb,
|
|
90
|
+
border: 'none'
|
|
91
|
+
},
|
|
92
|
+
'input[type=range]&::-ms-thumb': { ...sharedStyles.thumb,
|
|
93
|
+
margin: 0,
|
|
94
|
+
border: 'none'
|
|
95
|
+
},
|
|
96
|
+
'input[type=range]&::-webkit-slider-runnable-track': sharedStyles(sharedProps).track(videoCurrentVolume),
|
|
97
|
+
'input[type=range]&::-moz-range-track': sharedStyles(sharedProps).track(videoCurrentVolume),
|
|
98
|
+
'input[type=range]&::-ms-track': { ...sharedStyles(sharedProps).track(videoCurrentVolume),
|
|
99
|
+
margin: '6px 0',
|
|
100
|
+
border: 'none'
|
|
101
|
+
},
|
|
102
|
+
'input[type=range]&::-ms-fill-lower': {
|
|
103
|
+
background: 'transparent'
|
|
104
|
+
},
|
|
105
|
+
'input[type=range]&::-ms-tooltip': {
|
|
106
|
+
display: 'none'
|
|
107
|
+
}
|
|
108
|
+
};
|
|
109
|
+
});
|
|
110
|
+
|
|
111
|
+
const VolumeSlider = _ref5 => {
|
|
112
|
+
let {
|
|
113
|
+
setVolume,
|
|
114
|
+
compactModeThreshold,
|
|
115
|
+
disableFocus,
|
|
116
|
+
videoPlayerWidth,
|
|
117
|
+
videoIsMuted,
|
|
118
|
+
videoCurrentVolume,
|
|
119
|
+
copy,
|
|
120
|
+
toggleMute,
|
|
121
|
+
resetInactivityTimer,
|
|
122
|
+
tokens,
|
|
123
|
+
variant,
|
|
124
|
+
...rest
|
|
125
|
+
} = _ref5;
|
|
126
|
+
const refVolumeSlider = React.useRef();
|
|
127
|
+
const {
|
|
128
|
+
marginLeft,
|
|
129
|
+
marginRight,
|
|
130
|
+
thumbHeight,
|
|
131
|
+
thumbWidth,
|
|
132
|
+
thumbBackground,
|
|
133
|
+
trackGradientStart,
|
|
134
|
+
trackGradientEnd,
|
|
135
|
+
rangeBackground,
|
|
136
|
+
mutedIcon,
|
|
137
|
+
unmutedIcon
|
|
138
|
+
} = useThemeTokens('VideoVolumeSlider', tokens, variant);
|
|
139
|
+
const sharedProps = {
|
|
140
|
+
thumbHeight,
|
|
141
|
+
thumbWidth,
|
|
142
|
+
thumbBackground,
|
|
143
|
+
trackGradientStart,
|
|
144
|
+
trackGradientEnd,
|
|
145
|
+
rangeBackground
|
|
146
|
+
};
|
|
147
|
+
|
|
148
|
+
const handleVolumeChange = () => setVolume(refVolumeSlider.current.value);
|
|
149
|
+
|
|
150
|
+
return /*#__PURE__*/_jsxs(VolumeSliderContainer, {
|
|
151
|
+
compactModeThreshold: compactModeThreshold,
|
|
152
|
+
videoPlayerWidth: videoPlayerWidth,
|
|
153
|
+
margin: `0 ${marginRight}px 0 ${marginLeft}px`,
|
|
154
|
+
...selectProps(rest),
|
|
155
|
+
children: [/*#__PURE__*/_jsx(VideoButton, {
|
|
156
|
+
icon: videoIsMuted ? /*#__PURE__*/_jsx(Icon, {
|
|
157
|
+
icon: mutedIcon
|
|
158
|
+
}) : /*#__PURE__*/_jsx(Icon, {
|
|
159
|
+
icon: unmutedIcon
|
|
160
|
+
}),
|
|
161
|
+
label: videoIsMuted ? videoText[copy].unmute : videoText[copy].mute,
|
|
162
|
+
disableFocus: disableFocus,
|
|
163
|
+
onClick: toggleMute,
|
|
164
|
+
onFocus: resetInactivityTimer
|
|
165
|
+
}), /*#__PURE__*/_jsx(StyledVolumeSlider, {
|
|
166
|
+
type: "range",
|
|
167
|
+
min: "0",
|
|
168
|
+
max: "1",
|
|
169
|
+
step: "any",
|
|
170
|
+
value: videoCurrentVolume,
|
|
171
|
+
videoCurrentVolume: videoCurrentVolume,
|
|
172
|
+
ref: refVolumeSlider,
|
|
173
|
+
onChange: handleVolumeChange,
|
|
174
|
+
onFocus: resetInactivityTimer,
|
|
175
|
+
tabIndex: "-1",
|
|
176
|
+
"aria-label": videoText[copy].volumeSliderLabel,
|
|
177
|
+
...sharedProps
|
|
178
|
+
})]
|
|
179
|
+
});
|
|
180
|
+
};
|
|
181
|
+
|
|
182
|
+
VolumeSlider.propTypes = { ...selectedSystemPropTypes,
|
|
183
|
+
videoCurrentVolume: PropTypes.number.isRequired,
|
|
184
|
+
setVolume: PropTypes.func.isRequired,
|
|
185
|
+
videoIsMuted: PropTypes.bool.isRequired,
|
|
186
|
+
toggleMute: PropTypes.func.isRequired,
|
|
187
|
+
resetInactivityTimer: PropTypes.func.isRequired,
|
|
188
|
+
copy: PropTypes.oneOf(['en', 'fr']).isRequired,
|
|
189
|
+
compactModeThreshold: PropTypes.number.isRequired,
|
|
190
|
+
videoPlayerWidth: PropTypes.number.isRequired,
|
|
191
|
+
disableFocus: PropTypes.bool.isRequired
|
|
192
|
+
};
|
|
193
|
+
export default VolumeSlider;
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import PropTypes from 'prop-types';
|
|
3
|
+
import styled from 'styled-components';
|
|
4
|
+
import { useThemeTokens, selectSystemProps } from '@telus-uds/components-base';
|
|
5
|
+
import { htmlAttrs } from '../../utils';
|
|
6
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
7
|
+
const [selectProps, selectedSystemPropTypes] = selectSystemProps([htmlAttrs]);
|
|
8
|
+
const StyledMiddleControlButton = /*#__PURE__*/styled.button.withConfig({
|
|
9
|
+
displayName: "MiddleControlButton__StyledMiddleControlButton",
|
|
10
|
+
componentId: "components-web__sc-1um2s37-0"
|
|
11
|
+
})(_ref => {
|
|
12
|
+
let {
|
|
13
|
+
isHidden,
|
|
14
|
+
width,
|
|
15
|
+
height,
|
|
16
|
+
background
|
|
17
|
+
} = _ref;
|
|
18
|
+
return {
|
|
19
|
+
width,
|
|
20
|
+
height,
|
|
21
|
+
borderRadius: '50%',
|
|
22
|
+
transition: 'opacity 0.4s',
|
|
23
|
+
opacity: isHidden ? 0 : 1,
|
|
24
|
+
background,
|
|
25
|
+
display: 'flex',
|
|
26
|
+
justifyContent: 'center',
|
|
27
|
+
border: 'none',
|
|
28
|
+
padding: 0,
|
|
29
|
+
font: 'inherit',
|
|
30
|
+
cursor: 'pointer',
|
|
31
|
+
alignItems: 'center'
|
|
32
|
+
};
|
|
33
|
+
});
|
|
34
|
+
|
|
35
|
+
const MiddleControlButton = _ref2 => {
|
|
36
|
+
let {
|
|
37
|
+
icon: Icon,
|
|
38
|
+
isHidden = false,
|
|
39
|
+
onClick,
|
|
40
|
+
onFocus,
|
|
41
|
+
tokens,
|
|
42
|
+
variant,
|
|
43
|
+
...rest
|
|
44
|
+
} = _ref2;
|
|
45
|
+
const {
|
|
46
|
+
width,
|
|
47
|
+
height,
|
|
48
|
+
background,
|
|
49
|
+
iconColor
|
|
50
|
+
} = useThemeTokens('VideoMiddleControlButton', tokens, variant);
|
|
51
|
+
return /*#__PURE__*/_jsx(StyledMiddleControlButton, {
|
|
52
|
+
isHidden: isHidden,
|
|
53
|
+
onClick: onClick,
|
|
54
|
+
onFocus: onFocus,
|
|
55
|
+
width: width,
|
|
56
|
+
height: height,
|
|
57
|
+
background: background,
|
|
58
|
+
...selectProps(rest),
|
|
59
|
+
children: /*#__PURE__*/_jsx(Icon, {
|
|
60
|
+
color: iconColor,
|
|
61
|
+
size: 24
|
|
62
|
+
})
|
|
63
|
+
});
|
|
64
|
+
};
|
|
65
|
+
|
|
66
|
+
MiddleControlButton.propTypes = { ...selectedSystemPropTypes,
|
|
67
|
+
icon: PropTypes.elementType.isRequired,
|
|
68
|
+
isHidden: PropTypes.bool,
|
|
69
|
+
onClick: PropTypes.func,
|
|
70
|
+
onFocus: PropTypes.func
|
|
71
|
+
};
|
|
72
|
+
export default MiddleControlButton;
|