@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,234 @@
|
|
|
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 _helpers = require("../helpers");
|
|
17
|
+
|
|
18
|
+
var _jsxRuntime = require("react/jsx-runtime");
|
|
19
|
+
|
|
20
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
21
|
+
|
|
22
|
+
const ButtonContainer = /*#__PURE__*/_styledComponents.default.button.withConfig({
|
|
23
|
+
displayName: "SplashButtonWithDetails__ButtonContainer",
|
|
24
|
+
componentId: "components-web__sc-1edwy9o-0"
|
|
25
|
+
})({
|
|
26
|
+
background: 'none',
|
|
27
|
+
border: 0,
|
|
28
|
+
position: 'absolute',
|
|
29
|
+
width: '100%',
|
|
30
|
+
height: '100%',
|
|
31
|
+
padding: 0,
|
|
32
|
+
cursor: 'pointer'
|
|
33
|
+
});
|
|
34
|
+
|
|
35
|
+
const ButtonContent = /*#__PURE__*/_styledComponents.default.div.withConfig({
|
|
36
|
+
displayName: "SplashButtonWithDetails__ButtonContent",
|
|
37
|
+
componentId: "components-web__sc-1edwy9o-1"
|
|
38
|
+
})({
|
|
39
|
+
background: _ref => {
|
|
40
|
+
let {
|
|
41
|
+
buttonBackground
|
|
42
|
+
} = _ref;
|
|
43
|
+
return buttonBackground;
|
|
44
|
+
},
|
|
45
|
+
border: _ref2 => {
|
|
46
|
+
let {
|
|
47
|
+
buttonBorderColor
|
|
48
|
+
} = _ref2;
|
|
49
|
+
return `1px solid ${buttonBorderColor}`;
|
|
50
|
+
},
|
|
51
|
+
borderRadius: _ref3 => {
|
|
52
|
+
let {
|
|
53
|
+
buttonRadius
|
|
54
|
+
} = _ref3;
|
|
55
|
+
return `${buttonRadius}px`;
|
|
56
|
+
},
|
|
57
|
+
position: 'absolute',
|
|
58
|
+
left: _ref4 => {
|
|
59
|
+
let {
|
|
60
|
+
buttonLeftPosition
|
|
61
|
+
} = _ref4;
|
|
62
|
+
return `${buttonLeftPosition}px`;
|
|
63
|
+
},
|
|
64
|
+
bottom: _ref5 => {
|
|
65
|
+
let {
|
|
66
|
+
buttonBottomPosition
|
|
67
|
+
} = _ref5;
|
|
68
|
+
return `${buttonBottomPosition}px`;
|
|
69
|
+
},
|
|
70
|
+
boxSizing: 'border-box',
|
|
71
|
+
display: 'flex',
|
|
72
|
+
alignItems: 'center',
|
|
73
|
+
minHeight: _ref6 => {
|
|
74
|
+
let {
|
|
75
|
+
buttonMinHeight
|
|
76
|
+
} = _ref6;
|
|
77
|
+
return `${buttonMinHeight}px`;
|
|
78
|
+
},
|
|
79
|
+
paddingRight: _ref7 => {
|
|
80
|
+
let {
|
|
81
|
+
buttonPaddingLeft
|
|
82
|
+
} = _ref7;
|
|
83
|
+
return `${buttonPaddingLeft}px`;
|
|
84
|
+
},
|
|
85
|
+
paddingLeft: _ref8 => {
|
|
86
|
+
let {
|
|
87
|
+
buttonPaddingRight
|
|
88
|
+
} = _ref8;
|
|
89
|
+
return `${buttonPaddingRight}px`;
|
|
90
|
+
},
|
|
91
|
+
transition: 'background 0.2s ease-in-out',
|
|
92
|
+
[`${ButtonContainer}:hover &`]: {
|
|
93
|
+
background: _ref9 => {
|
|
94
|
+
let {
|
|
95
|
+
buttonContentChildrenBackground
|
|
96
|
+
} = _ref9;
|
|
97
|
+
return buttonContentChildrenBackground;
|
|
98
|
+
}
|
|
99
|
+
}
|
|
100
|
+
});
|
|
101
|
+
|
|
102
|
+
const PlayIconContainer = /*#__PURE__*/_styledComponents.default.div.withConfig({
|
|
103
|
+
displayName: "SplashButtonWithDetails__PlayIconContainer",
|
|
104
|
+
componentId: "components-web__sc-1edwy9o-2"
|
|
105
|
+
})({
|
|
106
|
+
display: 'flex',
|
|
107
|
+
justifyContent: 'center',
|
|
108
|
+
alignItems: 'center',
|
|
109
|
+
width: 32,
|
|
110
|
+
height: 32,
|
|
111
|
+
background: _ref10 => {
|
|
112
|
+
let {
|
|
113
|
+
playIconContainerBackground
|
|
114
|
+
} = _ref10;
|
|
115
|
+
return playIconContainerBackground ?? 'none';
|
|
116
|
+
},
|
|
117
|
+
borderRadius: '100%',
|
|
118
|
+
transition: 'background 0.2s ease-in-out'
|
|
119
|
+
});
|
|
120
|
+
|
|
121
|
+
const DetailsContainer = /*#__PURE__*/_styledComponents.default.div.withConfig({
|
|
122
|
+
displayName: "SplashButtonWithDetails__DetailsContainer",
|
|
123
|
+
componentId: "components-web__sc-1edwy9o-3"
|
|
124
|
+
})({
|
|
125
|
+
display: 'flex',
|
|
126
|
+
flexDirection: 'column',
|
|
127
|
+
alignItems: 'flex-start',
|
|
128
|
+
paddingLeft: _ref11 => {
|
|
129
|
+
let {
|
|
130
|
+
detailsContainerPadding
|
|
131
|
+
} = _ref11;
|
|
132
|
+
return `${detailsContainerPadding}px`;
|
|
133
|
+
}
|
|
134
|
+
});
|
|
135
|
+
|
|
136
|
+
const selectPlayIconContainerTokens = _ref12 => {
|
|
137
|
+
let {
|
|
138
|
+
playIconContainerBackground
|
|
139
|
+
} = _ref12;
|
|
140
|
+
return {
|
|
141
|
+
playIconContainerBackground
|
|
142
|
+
};
|
|
143
|
+
};
|
|
144
|
+
|
|
145
|
+
const selectDetailsContainerTokens = _ref13 => {
|
|
146
|
+
let {
|
|
147
|
+
detailsContainerPadding
|
|
148
|
+
} = _ref13;
|
|
149
|
+
return {
|
|
150
|
+
detailsContainerPadding
|
|
151
|
+
};
|
|
152
|
+
};
|
|
153
|
+
|
|
154
|
+
const selectButtonContentTokens = _ref14 => {
|
|
155
|
+
let {
|
|
156
|
+
buttonBackground,
|
|
157
|
+
buttonBorderColor,
|
|
158
|
+
buttonRadius,
|
|
159
|
+
buttonLeftPosition,
|
|
160
|
+
buttonBottomPosition,
|
|
161
|
+
buttonMinHeight,
|
|
162
|
+
buttonPaddingLeft,
|
|
163
|
+
buttonPaddingRight
|
|
164
|
+
} = _ref14;
|
|
165
|
+
return {
|
|
166
|
+
buttonBackground,
|
|
167
|
+
buttonBorderColor,
|
|
168
|
+
buttonRadius,
|
|
169
|
+
buttonLeftPosition,
|
|
170
|
+
buttonBottomPosition,
|
|
171
|
+
buttonMinHeight,
|
|
172
|
+
buttonPaddingLeft,
|
|
173
|
+
buttonPaddingRight
|
|
174
|
+
};
|
|
175
|
+
};
|
|
176
|
+
|
|
177
|
+
const SplashButtonWithDetails = _ref15 => {
|
|
178
|
+
let {
|
|
179
|
+
label,
|
|
180
|
+
tokens,
|
|
181
|
+
variant,
|
|
182
|
+
copy,
|
|
183
|
+
videoLength
|
|
184
|
+
} = _ref15;
|
|
185
|
+
const {
|
|
186
|
+
buttonContentChildrenBackground
|
|
187
|
+
} = (0, _componentsBase.useThemeTokens)('SplashButtonWithDetails', tokens, variant, {
|
|
188
|
+
hover: true
|
|
189
|
+
});
|
|
190
|
+
const {
|
|
191
|
+
playIcon: PlayIcon,
|
|
192
|
+
playIconColor,
|
|
193
|
+
...themeTokens
|
|
194
|
+
} = (0, _componentsBase.useThemeTokens)('SplashButtonWithDetails', tokens, variant);
|
|
195
|
+
const mappedVideoLength = (0, _helpers.getTimestamp)(videoLength, copy);
|
|
196
|
+
const ariaLabel = (0, _helpers.getAriaLabel)(mappedVideoLength, copy);
|
|
197
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsx)(ButtonContainer, {
|
|
198
|
+
"aria-label": ariaLabel,
|
|
199
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsxs)(ButtonContent, { ...selectButtonContentTokens(themeTokens),
|
|
200
|
+
buttonContentChildrenBackground: buttonContentChildrenBackground,
|
|
201
|
+
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(PlayIconContainer, { ...selectPlayIconContainerTokens(themeTokens),
|
|
202
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(PlayIcon, {
|
|
203
|
+
size: 13,
|
|
204
|
+
color: playIconColor
|
|
205
|
+
})
|
|
206
|
+
}), /*#__PURE__*/(0, _jsxRuntime.jsxs)(DetailsContainer, { ...selectDetailsContainerTokens(themeTokens),
|
|
207
|
+
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_componentsBase.Typography, {
|
|
208
|
+
variant: {
|
|
209
|
+
bold: true
|
|
210
|
+
},
|
|
211
|
+
children: label
|
|
212
|
+
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_componentsBase.Typography, {
|
|
213
|
+
variant: {
|
|
214
|
+
colour: 'secondary'
|
|
215
|
+
/* TODO: this is not the same color as in designs */
|
|
216
|
+
,
|
|
217
|
+
size: 'micro'
|
|
218
|
+
},
|
|
219
|
+
children: mappedVideoLength.timestamp
|
|
220
|
+
})]
|
|
221
|
+
})]
|
|
222
|
+
})
|
|
223
|
+
});
|
|
224
|
+
};
|
|
225
|
+
|
|
226
|
+
SplashButtonWithDetails.propTypes = {
|
|
227
|
+
label: _propTypes.default.string,
|
|
228
|
+
tokens: _propTypes.default.object,
|
|
229
|
+
variant: _propTypes.default.object,
|
|
230
|
+
videoLength: _propTypes.default.number,
|
|
231
|
+
copy: _propTypes.default.oneOf(['en', 'fr'])
|
|
232
|
+
};
|
|
233
|
+
var _default = SplashButtonWithDetails;
|
|
234
|
+
exports.default = _default;
|
|
@@ -0,0 +1,86 @@
|
|
|
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 _systemConstants = require("@telus-uds/system-constants");
|
|
17
|
+
|
|
18
|
+
var _SplashButton = _interopRequireDefault(require("./SplashButton/SplashButton"));
|
|
19
|
+
|
|
20
|
+
var _SplashButtonWithDetails = _interopRequireDefault(require("./SplashButtonWithDetails/SplashButtonWithDetails"));
|
|
21
|
+
|
|
22
|
+
var _videoText = _interopRequireDefault(require("../../Video/videoText"));
|
|
23
|
+
|
|
24
|
+
var _utils = require("../../utils");
|
|
25
|
+
|
|
26
|
+
var _jsxRuntime = require("react/jsx-runtime");
|
|
27
|
+
|
|
28
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
29
|
+
|
|
30
|
+
const [selectProps, selectedSystemPropTypes] = (0, _componentsBase.selectSystemProps)([_utils.htmlAttrs]);
|
|
31
|
+
|
|
32
|
+
const SplashBackground = /*#__PURE__*/_styledComponents.default.div.withConfig({
|
|
33
|
+
displayName: "VideoSplash__SplashBackground",
|
|
34
|
+
componentId: "components-web__sc-1ejxt6-0"
|
|
35
|
+
})(_ref => {
|
|
36
|
+
let {
|
|
37
|
+
videoPoster
|
|
38
|
+
} = _ref;
|
|
39
|
+
return {
|
|
40
|
+
backgroundImage: `url(${videoPoster})`,
|
|
41
|
+
backgroundSize: 'cover',
|
|
42
|
+
backgroundPosition: 'center',
|
|
43
|
+
position: 'absolute',
|
|
44
|
+
top: 0,
|
|
45
|
+
width: '100%',
|
|
46
|
+
height: '100%',
|
|
47
|
+
// fixes vertical alignment on IE 11
|
|
48
|
+
cursor: 'pointer'
|
|
49
|
+
};
|
|
50
|
+
});
|
|
51
|
+
|
|
52
|
+
const VideoSplash = _ref2 => {
|
|
53
|
+
let {
|
|
54
|
+
poster,
|
|
55
|
+
videoLength,
|
|
56
|
+
simpleMode,
|
|
57
|
+
copy = 'en',
|
|
58
|
+
onClick,
|
|
59
|
+
...rest
|
|
60
|
+
} = _ref2;
|
|
61
|
+
const viewport = (0, _componentsBase.useViewport)();
|
|
62
|
+
const showDetails = !simpleMode && viewport !== _systemConstants.viewports.xs;
|
|
63
|
+
const label = _videoText.default[copy].watch;
|
|
64
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsx)(SplashBackground, { ...selectProps(rest),
|
|
65
|
+
onClick: onClick,
|
|
66
|
+
videoPoster: poster,
|
|
67
|
+
children: showDetails ? /*#__PURE__*/(0, _jsxRuntime.jsx)(_SplashButtonWithDetails.default, {
|
|
68
|
+
videoLength: videoLength,
|
|
69
|
+
copy: copy,
|
|
70
|
+
label: label
|
|
71
|
+
}) : /*#__PURE__*/(0, _jsxRuntime.jsx)(_SplashButton.default, {
|
|
72
|
+
videoLength: videoLength,
|
|
73
|
+
copy: copy
|
|
74
|
+
})
|
|
75
|
+
});
|
|
76
|
+
};
|
|
77
|
+
|
|
78
|
+
VideoSplash.propTypes = { ...selectedSystemPropTypes,
|
|
79
|
+
onClick: _propTypes.default.func,
|
|
80
|
+
poster: _propTypes.default.string,
|
|
81
|
+
videoLength: _propTypes.default.number.isRequired,
|
|
82
|
+
simpleMode: _propTypes.default.bool,
|
|
83
|
+
copy: _propTypes.default.oneOf(['en', 'fr'])
|
|
84
|
+
};
|
|
85
|
+
var _default = VideoSplash;
|
|
86
|
+
exports.default = _default;
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.getTimestamp = exports.getAriaLabel = void 0;
|
|
7
|
+
|
|
8
|
+
var _videoText = _interopRequireDefault(require("../../Video/videoText"));
|
|
9
|
+
|
|
10
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
11
|
+
|
|
12
|
+
const getTimestamp = (videoLength, copy) => {
|
|
13
|
+
const minutes = Math.floor(videoLength / 60);
|
|
14
|
+
const seconds = Math.ceil(videoLength % 60);
|
|
15
|
+
const minutesText = minutes > 0 ? `${minutes}min ` : '';
|
|
16
|
+
const secondsText = `${seconds}${copy === 'fr' ? 's' : 'sec'}`;
|
|
17
|
+
const timestamp = `${minutesText}${secondsText}`;
|
|
18
|
+
return {
|
|
19
|
+
minutes,
|
|
20
|
+
seconds,
|
|
21
|
+
timestamp
|
|
22
|
+
};
|
|
23
|
+
};
|
|
24
|
+
|
|
25
|
+
exports.getTimestamp = getTimestamp;
|
|
26
|
+
|
|
27
|
+
const getAriaLabel = (timestamp, copy) => {
|
|
28
|
+
const {
|
|
29
|
+
minutes,
|
|
30
|
+
seconds
|
|
31
|
+
} = timestamp;
|
|
32
|
+
const text = _videoText.default[copy];
|
|
33
|
+
const minutesText = `${minutes} ${minutes !== 1 ? text.minutes : text.minute}`;
|
|
34
|
+
const secondsText = `${seconds} ${seconds !== 1 ? text.seconds : text.second}`;
|
|
35
|
+
return text.ariaLabel.replace('{minutes}', minutesText).replace('{seconds}', secondsText);
|
|
36
|
+
};
|
|
37
|
+
|
|
38
|
+
exports.getAriaLabel = getAriaLabel;
|
package/lib/utils/index.js
CHANGED
|
@@ -27,6 +27,12 @@ Object.defineProperty(exports, "transformGradient", {
|
|
|
27
27
|
return _transforms.transformGradient;
|
|
28
28
|
}
|
|
29
29
|
});
|
|
30
|
+
Object.defineProperty(exports, "useOverlaidPosition", {
|
|
31
|
+
enumerable: true,
|
|
32
|
+
get: function () {
|
|
33
|
+
return _useOverlaidPosition.default;
|
|
34
|
+
}
|
|
35
|
+
});
|
|
30
36
|
Object.defineProperty(exports, "useTypographyTheme", {
|
|
31
37
|
enumerable: true,
|
|
32
38
|
get: function () {
|
|
@@ -52,4 +58,6 @@ var _media = _interopRequireDefault(require("./media"));
|
|
|
52
58
|
|
|
53
59
|
var _renderStructuredContent = _interopRequireDefault(require("./renderStructuredContent"));
|
|
54
60
|
|
|
61
|
+
var _useOverlaidPosition = _interopRequireDefault(require("./useOverlaidPosition"));
|
|
62
|
+
|
|
55
63
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|