@telus-uds/components-web 2.33.2 → 2.34.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 +20 -3
- package/lib/Badge/Badge.js +4 -2
- package/lib/BlockQuote/BlockQuote.js +4 -2
- package/lib/Breadcrumbs/Breadcrumbs.js +7 -5
- package/lib/Breadcrumbs/Item/Item.js +2 -13
- package/lib/Callout/Callout.js +4 -2
- package/lib/Card/Card.js +3 -5
- package/lib/Card/CardContent.js +4 -2
- package/lib/Countdown/Countdown.js +2 -6
- package/lib/Countdown/Segment.js +4 -2
- package/lib/DatePicker/CalendarContainer.js +2 -2
- package/lib/DatePicker/DatePicker.js +21 -35
- package/lib/Disclaimer/Disclaimer.js +4 -2
- package/lib/ExpandCollapseMini/ExpandCollapseMini.js +5 -11
- package/lib/ExpandCollapseMini/ExpandCollapseMiniControl.js +4 -2
- package/lib/Footnote/Footnote.js +32 -37
- package/lib/Footnote/FootnoteLink.js +5 -6
- package/lib/IconButton/IconButton.js +4 -11
- package/lib/Image/Image.js +5 -3
- package/lib/List/ListItem.js +2 -7
- package/lib/NavigationBar/NavigationBar.js +8 -18
- package/lib/NavigationBar/NavigationItem.js +4 -9
- package/lib/NavigationBar/NavigationSubMenu.js +8 -7
- package/lib/NavigationBar/index.js +2 -0
- package/lib/OptimizeImage/OptimizeImage.js +8 -8
- package/lib/OrderedList/Item.js +3 -9
- package/lib/OrderedList/OrderedList.js +5 -13
- package/lib/OrderedList/OrderedListBase.js +3 -8
- package/lib/Paragraph/Paragraph.js +5 -3
- package/lib/PreviewCard/PreviewCard.js +3 -5
- package/lib/PriceLockup/PriceLockup.js +4 -2
- package/lib/Progress/ProgressBar.js +4 -2
- package/lib/QuantitySelector/QuantitySelector.js +21 -24
- package/lib/QuantitySelector/SideButton.js +12 -20
- package/lib/ResponsiveImage/ResponsiveImage.js +4 -2
- package/lib/Ribbon/Ribbon.js +4 -2
- package/lib/SkeletonProvider/SkeletonImage.js +5 -3
- package/lib/SkeletonProvider/SkeletonProvider.js +3 -5
- package/lib/SkeletonProvider/SkeletonTypography.js +5 -3
- package/lib/Span/Span.js +5 -3
- package/lib/Spinner/Spinner.js +4 -2
- package/lib/Spinner/SpinnerContent.js +4 -2
- package/lib/StoryCard/StoryCard.js +3 -5
- package/lib/Table/Body.js +4 -2
- package/lib/Table/Cell.js +5 -3
- package/lib/Table/Header.js +6 -6
- package/lib/Table/Row.js +6 -6
- package/lib/Table/SubHeading.js +6 -6
- package/lib/Table/Table.js +6 -8
- package/lib/TermsAndConditions/ExpandCollapse.js +2 -7
- package/lib/TermsAndConditions/TermsAndConditions.js +5 -14
- package/lib/Testimonial/Testimonial.js +4 -2
- package/lib/Toast/Toast.js +4 -2
- package/lib/Video/Video.js +19 -55
- package/lib/VideoPicker/VideoPicker.js +38 -9
- package/lib/VideoPicker/VideoPickerPlayer.js +4 -2
- package/lib/VideoPicker/VideoPickerThumbnail.js +4 -2
- package/lib/VideoPicker/VideoSlider.js +7 -7
- package/lib/WaffleGrid/WaffleGrid.js +4 -2
- package/lib/WebVideo/WebVideo.js +51 -13
- package/lib/WebVideo/utils/index.js +58 -0
- package/lib/baseExports.js +6 -0
- package/lib/utils/theming/with-client-theme.js +1 -1
- package/lib/utils/theming/with-server-theme.js +1 -1
- package/lib-module/Badge/Badge.js +4 -2
- package/lib-module/BlockQuote/BlockQuote.js +4 -2
- package/lib-module/Breadcrumbs/Breadcrumbs.js +7 -5
- package/lib-module/Breadcrumbs/Item/Item.js +2 -11
- package/lib-module/Callout/Callout.js +4 -2
- package/lib-module/Card/Card.js +2 -3
- package/lib-module/Card/CardContent.js +4 -2
- package/lib-module/Countdown/Countdown.js +2 -3
- package/lib-module/Countdown/Segment.js +4 -2
- package/lib-module/DatePicker/CalendarContainer.js +2 -2
- package/lib-module/DatePicker/DatePicker.js +21 -33
- package/lib-module/Disclaimer/Disclaimer.js +4 -2
- package/lib-module/ExpandCollapseMini/ExpandCollapseMini.js +5 -9
- package/lib-module/ExpandCollapseMini/ExpandCollapseMiniControl.js +4 -2
- package/lib-module/Footnote/Footnote.js +31 -36
- package/lib-module/Footnote/FootnoteLink.js +5 -7
- package/lib-module/IconButton/IconButton.js +4 -9
- package/lib-module/Image/Image.js +5 -3
- package/lib-module/List/ListItem.js +2 -5
- package/lib-module/NavigationBar/NavigationBar.js +9 -17
- package/lib-module/NavigationBar/NavigationItem.js +5 -8
- package/lib-module/NavigationBar/NavigationSubMenu.js +9 -6
- package/lib-module/NavigationBar/index.js +2 -0
- package/lib-module/OptimizeImage/OptimizeImage.js +8 -6
- package/lib-module/OrderedList/Item.js +3 -7
- package/lib-module/OrderedList/OrderedList.js +6 -12
- package/lib-module/OrderedList/OrderedListBase.js +3 -6
- package/lib-module/Paragraph/Paragraph.js +6 -4
- package/lib-module/PreviewCard/PreviewCard.js +2 -3
- package/lib-module/PriceLockup/PriceLockup.js +4 -2
- package/lib-module/Progress/ProgressBar.js +4 -2
- package/lib-module/QuantitySelector/QuantitySelector.js +22 -23
- package/lib-module/QuantitySelector/SideButton.js +13 -21
- package/lib-module/ResponsiveImage/ResponsiveImage.js +4 -2
- package/lib-module/Ribbon/Ribbon.js +4 -2
- package/lib-module/SkeletonProvider/SkeletonImage.js +5 -3
- package/lib-module/SkeletonProvider/SkeletonProvider.js +3 -3
- package/lib-module/SkeletonProvider/SkeletonTypography.js +5 -3
- package/lib-module/Span/Span.js +6 -4
- package/lib-module/Spinner/Spinner.js +4 -2
- package/lib-module/Spinner/SpinnerContent.js +4 -2
- package/lib-module/StoryCard/StoryCard.js +2 -3
- package/lib-module/Table/Body.js +4 -2
- package/lib-module/Table/Cell.js +5 -3
- package/lib-module/Table/Header.js +6 -4
- package/lib-module/Table/Row.js +6 -4
- package/lib-module/Table/SubHeading.js +6 -4
- package/lib-module/Table/Table.js +6 -6
- package/lib-module/TermsAndConditions/ExpandCollapse.js +2 -5
- package/lib-module/TermsAndConditions/TermsAndConditions.js +5 -12
- package/lib-module/Testimonial/Testimonial.js +4 -2
- package/lib-module/Toast/Toast.js +4 -2
- package/lib-module/Video/Video.js +19 -53
- package/lib-module/VideoPicker/VideoPicker.js +37 -8
- package/lib-module/VideoPicker/VideoPickerPlayer.js +4 -2
- package/lib-module/VideoPicker/VideoPickerThumbnail.js +4 -2
- package/lib-module/VideoPicker/VideoSlider.js +7 -5
- package/lib-module/WaffleGrid/WaffleGrid.js +4 -2
- package/lib-module/WebVideo/WebVideo.js +51 -11
- package/lib-module/WebVideo/utils/index.js +50 -0
- package/lib-module/baseExports.js +1 -1
- package/lib-module/utils/theming/with-client-theme.js +2 -2
- package/lib-module/utils/theming/with-server-theme.js +2 -2
- package/package.json +3 -3
- package/src/Badge/Badge.jsx +5 -2
- package/src/BlockQuote/BlockQuote.jsx +120 -112
- package/src/Breadcrumbs/Breadcrumbs.jsx +84 -77
- package/src/Breadcrumbs/Item/Item.jsx +2 -9
- package/src/Callout/Callout.jsx +37 -40
- package/src/Card/Card.jsx +2 -3
- package/src/Card/CardContent.jsx +19 -14
- package/src/Countdown/Countdown.jsx +72 -71
- package/src/Countdown/Segment.jsx +40 -28
- package/src/DatePicker/CalendarContainer.jsx +2 -2
- package/src/DatePicker/DatePicker.jsx +21 -34
- package/src/Disclaimer/Disclaimer.jsx +5 -3
- package/src/ExpandCollapseMini/ExpandCollapseMini.jsx +37 -40
- package/src/ExpandCollapseMini/ExpandCollapseMiniControl.jsx +52 -44
- package/src/Footnote/Footnote.jsx +32 -38
- package/src/Footnote/FootnoteLink.jsx +41 -49
- package/src/IconButton/IconButton.jsx +19 -20
- package/src/Image/Image.jsx +40 -43
- package/src/List/ListItem.jsx +3 -5
- package/src/NavigationBar/NavigationBar.jsx +9 -18
- package/src/NavigationBar/NavigationItem.jsx +6 -5
- package/src/NavigationBar/NavigationSubMenu.jsx +104 -88
- package/src/NavigationBar/index.js +3 -0
- package/src/OptimizeImage/OptimizeImage.jsx +48 -41
- package/src/OrderedList/Item.jsx +34 -35
- package/src/OrderedList/OrderedList.jsx +4 -6
- package/src/OrderedList/OrderedListBase.jsx +2 -3
- package/src/Paragraph/Paragraph.jsx +21 -16
- package/src/PreviewCard/PreviewCard.jsx +2 -3
- package/src/PriceLockup/PriceLockup.jsx +143 -136
- package/src/Progress/ProgressBar.jsx +11 -3
- package/src/QuantitySelector/QuantitySelector.jsx +162 -154
- package/src/QuantitySelector/SideButton.jsx +52 -56
- package/src/ResponsiveImage/ResponsiveImage.jsx +16 -22
- package/src/Ribbon/Ribbon.jsx +85 -83
- package/src/SkeletonProvider/SkeletonImage.jsx +24 -15
- package/src/SkeletonProvider/SkeletonProvider.jsx +3 -3
- package/src/SkeletonProvider/SkeletonTypography.jsx +18 -13
- package/src/Span/Span.jsx +7 -5
- package/src/Spinner/Spinner.jsx +86 -79
- package/src/Spinner/SpinnerContent.jsx +31 -33
- package/src/StoryCard/StoryCard.jsx +2 -3
- package/src/Table/Body.jsx +5 -3
- package/src/Table/Cell.jsx +77 -67
- package/src/Table/Header.jsx +7 -5
- package/src/Table/Row.jsx +7 -5
- package/src/Table/SubHeading.jsx +7 -5
- package/src/Table/Table.jsx +6 -6
- package/src/TermsAndConditions/ExpandCollapse.jsx +2 -6
- package/src/TermsAndConditions/TermsAndConditions.jsx +5 -13
- package/src/Testimonial/Testimonial.jsx +148 -137
- package/src/Toast/Toast.jsx +68 -63
- package/src/Video/Video.jsx +25 -45
- package/src/VideoPicker/VideoPicker.jsx +114 -75
- package/src/VideoPicker/VideoPickerPlayer.jsx +13 -9
- package/src/VideoPicker/VideoPickerThumbnail.jsx +102 -94
- package/src/VideoPicker/VideoSlider.jsx +8 -6
- package/src/WaffleGrid/WaffleGrid.jsx +36 -40
- package/src/WebVideo/WebVideo.jsx +114 -60
- package/src/WebVideo/utils/index.js +56 -0
- package/src/baseExports.js +1 -0
- package/src/utils/theming/with-client-theme.jsx +2 -2
- package/src/utils/theming/with-server-theme.jsx +2 -2
- package/types/WebVideo.d.ts +2 -1
|
@@ -85,7 +85,7 @@ const ThumbnailTitleContainer = /*#__PURE__*/_styledComponents.default.div.withC
|
|
|
85
85
|
displayName: "VideoPickerThumbnail__ThumbnailTitleContainer",
|
|
86
86
|
componentId: "components-web__sc-1glxurq-2"
|
|
87
87
|
})(["display:-webkit-box;-webkit-line-clamp:2;-webkit-box-orient:vertical;overflow:hidden;"]);
|
|
88
|
-
const VideoPickerThumbnail = _ref7 => {
|
|
88
|
+
const VideoPickerThumbnail = /*#__PURE__*/_react.default.forwardRef((_ref7, ref) => {
|
|
89
89
|
let {
|
|
90
90
|
videoPlayerRef,
|
|
91
91
|
selectedVideoId,
|
|
@@ -185,6 +185,7 @@ const VideoPickerThumbnail = _ref7 => {
|
|
|
185
185
|
outline: 'none'
|
|
186
186
|
}];
|
|
187
187
|
},
|
|
188
|
+
ref: ref,
|
|
188
189
|
children: _ref10 => {
|
|
189
190
|
let {
|
|
190
191
|
hovered: hover,
|
|
@@ -207,7 +208,8 @@ const VideoPickerThumbnail = _ref7 => {
|
|
|
207
208
|
});
|
|
208
209
|
}
|
|
209
210
|
}, video.videoId);
|
|
210
|
-
};
|
|
211
|
+
});
|
|
212
|
+
VideoPickerThumbnail.displayName = 'VideoPickerThumbnail';
|
|
211
213
|
VideoPickerThumbnail.propTypes = {
|
|
212
214
|
selectedVideoId: _propTypes.default.string,
|
|
213
215
|
onSelectVideo: _propTypes.default.func,
|
|
@@ -4,24 +4,22 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.default = void 0;
|
|
7
|
-
var _react =
|
|
7
|
+
var _react = _interopRequireDefault(require("react"));
|
|
8
8
|
var _componentsBase = require("@telus-uds/components-base");
|
|
9
9
|
var _View = _interopRequireDefault(require("react-native-web/dist/cjs/exports/View"));
|
|
10
10
|
var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
11
11
|
var _jsxRuntime = require("react/jsx-runtime");
|
|
12
12
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
13
|
-
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function (nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
|
14
|
-
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
15
13
|
const {
|
|
16
14
|
useItemPositions
|
|
17
15
|
} = _componentsBase.horizontalScrollUtils;
|
|
18
|
-
const VideoSlider = _ref => {
|
|
16
|
+
const VideoSlider = /*#__PURE__*/_react.default.forwardRef((_ref, ref) => {
|
|
19
17
|
let {
|
|
20
18
|
children
|
|
21
19
|
} = _ref;
|
|
22
20
|
const viewport = (0, _componentsBase.useViewport)();
|
|
23
21
|
const [itemPositions] = useItemPositions();
|
|
24
|
-
const [containerWidth, setContainerWidth] =
|
|
22
|
+
const [containerWidth, setContainerWidth] = _react.default.useState(null);
|
|
25
23
|
const {
|
|
26
24
|
previousIcon: PreviousIcon,
|
|
27
25
|
nextIcon: NextIcon
|
|
@@ -53,7 +51,7 @@ const VideoSlider = _ref => {
|
|
|
53
51
|
tokens: {
|
|
54
52
|
flexGrow: 1
|
|
55
53
|
},
|
|
56
|
-
children: _react.default.Children.map(children, (child, index) => /*#__PURE__*/
|
|
54
|
+
children: _react.default.Children.map(children, (child, index) => /*#__PURE__*/_react.default.cloneElement(child, {
|
|
57
55
|
index,
|
|
58
56
|
itemPositions,
|
|
59
57
|
width: itemWidth
|
|
@@ -73,6 +71,7 @@ const VideoSlider = _ref => {
|
|
|
73
71
|
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_View.default, {
|
|
74
72
|
onLayout: onLayout,
|
|
75
73
|
style: overflow,
|
|
74
|
+
ref: ref,
|
|
76
75
|
children: containerWidth === null ?
|
|
77
76
|
// Use a 100% width non-scrollable parent until containerWidth is known, to avoid flicker
|
|
78
77
|
content : /*#__PURE__*/(0, _jsxRuntime.jsx)(_componentsBase.HorizontalScroll, {
|
|
@@ -82,7 +81,8 @@ const VideoSlider = _ref => {
|
|
|
82
81
|
children: content
|
|
83
82
|
})
|
|
84
83
|
});
|
|
85
|
-
};
|
|
84
|
+
});
|
|
85
|
+
VideoSlider.displayName = 'VideoSlider';
|
|
86
86
|
VideoSlider.propTypes = {
|
|
87
87
|
children: _propTypes.default.node
|
|
88
88
|
};
|
|
@@ -76,7 +76,7 @@ const Center = /*#__PURE__*/(0, _styledComponents.default)('div').withConfig({
|
|
|
76
76
|
/**
|
|
77
77
|
* The WaffleGrid is used to show items in a waffle like manner with borders surrounding the element
|
|
78
78
|
*/
|
|
79
|
-
const WaffleGrid = _ref2 => {
|
|
79
|
+
const WaffleGrid = /*#__PURE__*/_react.default.forwardRef((_ref2, ref) => {
|
|
80
80
|
let {
|
|
81
81
|
items,
|
|
82
82
|
rowSize = null,
|
|
@@ -92,6 +92,7 @@ const WaffleGrid = _ref2 => {
|
|
|
92
92
|
});
|
|
93
93
|
const currentRowSize = (0, _componentsBase.useResponsiveProp)(rowSize);
|
|
94
94
|
return /*#__PURE__*/(0, _jsxRuntime.jsx)(Container, {
|
|
95
|
+
ref: ref,
|
|
95
96
|
...selectProps(rest),
|
|
96
97
|
children: items.map(child => /*#__PURE__*/(0, _react.createElement)(Item, {
|
|
97
98
|
...themeTokens,
|
|
@@ -123,7 +124,8 @@ const WaffleGrid = _ref2 => {
|
|
|
123
124
|
})
|
|
124
125
|
})))
|
|
125
126
|
});
|
|
126
|
-
};
|
|
127
|
+
});
|
|
128
|
+
WaffleGrid.displayName = 'WaffleGrid';
|
|
127
129
|
WaffleGrid.propTypes = {
|
|
128
130
|
...selectedSystemPropTypes,
|
|
129
131
|
/**
|
package/lib/WebVideo/WebVideo.js
CHANGED
|
@@ -6,14 +6,13 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
6
6
|
exports.default = exports.VideoProps = void 0;
|
|
7
7
|
var _componentsBase = require("@telus-uds/components-base");
|
|
8
8
|
var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
9
|
-
var _react =
|
|
9
|
+
var _react = _interopRequireDefault(require("react"));
|
|
10
10
|
var _reactYoutube = _interopRequireDefault(require("react-youtube"));
|
|
11
11
|
var _styledComponents = _interopRequireDefault(require("styled-components"));
|
|
12
12
|
var _VideoSplash = _interopRequireDefault(require("../shared/VideoSplash/VideoSplash"));
|
|
13
13
|
var _utils = require("../utils");
|
|
14
|
+
var _utils2 = require("./utils");
|
|
14
15
|
var _jsxRuntime = require("react/jsx-runtime");
|
|
15
|
-
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function (nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
|
16
|
-
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
17
16
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
18
17
|
const [selectProps, selectedSystemPropTypes] = (0, _componentsBase.selectSystemProps)([_utils.htmlAttrs]);
|
|
19
18
|
const StyledPlayerContainer = /*#__PURE__*/_styledComponents.default.div.withConfig({
|
|
@@ -52,7 +51,7 @@ const AspectLimiter = /*#__PURE__*/_styledComponents.default.div.withConfig({
|
|
|
52
51
|
...aspectRatios[props.aspectRatio],
|
|
53
52
|
position: 'relative'
|
|
54
53
|
}));
|
|
55
|
-
const WebVideo = _ref => {
|
|
54
|
+
const WebVideo = /*#__PURE__*/_react.default.forwardRef((_ref, ref) => {
|
|
56
55
|
let {
|
|
57
56
|
videoId,
|
|
58
57
|
aspectRatio = '16:9',
|
|
@@ -61,15 +60,29 @@ const WebVideo = _ref => {
|
|
|
61
60
|
beginMuted = false,
|
|
62
61
|
videoLength,
|
|
63
62
|
copy,
|
|
64
|
-
onPlay,
|
|
65
|
-
onPause,
|
|
66
|
-
onEnd,
|
|
63
|
+
onPlay = () => {},
|
|
64
|
+
onPause = () => {},
|
|
65
|
+
onEnd = () => {},
|
|
66
|
+
onProgress = () => {},
|
|
67
67
|
onStart = () => {},
|
|
68
68
|
...rest
|
|
69
69
|
} = _ref;
|
|
70
|
-
const [started, setStarted] =
|
|
70
|
+
const [started, setStarted] = _react.default.useState(false);
|
|
71
|
+
const videoStateData = _react.default.useRef({
|
|
72
|
+
requestAnimationIds: [],
|
|
73
|
+
state: _utils2.YoutubePlayerState.UNSTARTED
|
|
74
|
+
});
|
|
75
|
+
const playerRef = _react.default.useRef(null);
|
|
76
|
+
const onPlayCallback = event => {
|
|
77
|
+
onPlay(event, videoStateData.current.state === _utils2.YoutubePlayerState.PAUSED);
|
|
78
|
+
videoStateData.current.state = _utils2.YoutubePlayerState.PLAYING;
|
|
79
|
+
if (onProgress) {
|
|
80
|
+
videoStateData.current.requestAnimationIds = (0, _utils2.triggerInProgressVideoIntervals)(onProgress, playerRef, event);
|
|
81
|
+
}
|
|
82
|
+
};
|
|
71
83
|
const initializeYoutubePlayer = event => {
|
|
72
84
|
onStart();
|
|
85
|
+
playerRef.current = event.target;
|
|
73
86
|
if (beginMuted) {
|
|
74
87
|
event.target.mute();
|
|
75
88
|
}
|
|
@@ -77,7 +90,23 @@ const WebVideo = _ref => {
|
|
|
77
90
|
event.target.playVideo(); // This plays the video after passing the splash screen on mobile.
|
|
78
91
|
};
|
|
79
92
|
|
|
93
|
+
const onEndVideoCallback = event => {
|
|
94
|
+
onEnd(event);
|
|
95
|
+
videoStateData.current.requestAnimationIds.forEach(id => cancelAnimationFrame(id));
|
|
96
|
+
videoStateData.current.requestAnimationIds = [];
|
|
97
|
+
videoStateData.current.state = _utils2.YoutubePlayerState.ENDED;
|
|
98
|
+
if (onProgress) {
|
|
99
|
+
onProgress(event, 100);
|
|
100
|
+
}
|
|
101
|
+
};
|
|
102
|
+
const onPauseVideoCallback = event => {
|
|
103
|
+
videoStateData.current.requestAnimationIds.forEach(id => cancelAnimationFrame(id));
|
|
104
|
+
onPause(event);
|
|
105
|
+
videoStateData.current.state = _utils2.YoutubePlayerState.PAUSED;
|
|
106
|
+
videoStateData.current.requestAnimationIds = [];
|
|
107
|
+
};
|
|
80
108
|
return /*#__PURE__*/(0, _jsxRuntime.jsx)(StyledPlayerContainer, {
|
|
109
|
+
ref: ref,
|
|
81
110
|
"data-testid": "web-video-container",
|
|
82
111
|
...selectProps(rest),
|
|
83
112
|
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(AspectLimiter, {
|
|
@@ -95,9 +124,9 @@ const WebVideo = _ref => {
|
|
|
95
124
|
}
|
|
96
125
|
},
|
|
97
126
|
onReady: initializeYoutubePlayer,
|
|
98
|
-
onPlay:
|
|
99
|
-
onPause:
|
|
100
|
-
onEnd:
|
|
127
|
+
onPlay: onPlayCallback,
|
|
128
|
+
onPause: onPauseVideoCallback,
|
|
129
|
+
onEnd: onEndVideoCallback
|
|
101
130
|
}) : /*#__PURE__*/(0, _jsxRuntime.jsx)(_VideoSplash.default, {
|
|
102
131
|
poster: posterSrc || `https://img.youtube.com/vi/${videoId}/maxresdefault.jpg`,
|
|
103
132
|
videoLength: videoLength,
|
|
@@ -108,7 +137,8 @@ const WebVideo = _ref => {
|
|
|
108
137
|
})
|
|
109
138
|
})
|
|
110
139
|
});
|
|
111
|
-
};
|
|
140
|
+
});
|
|
141
|
+
WebVideo.displayName = 'WebVideo';
|
|
112
142
|
const VideoProps = {
|
|
113
143
|
...selectedSystemPropTypes,
|
|
114
144
|
/**
|
|
@@ -154,7 +184,15 @@ const VideoProps = {
|
|
|
154
184
|
/**
|
|
155
185
|
* A function to be run when the video ends.
|
|
156
186
|
*/
|
|
157
|
-
onEnd: _propTypes.default.func
|
|
187
|
+
onEnd: _propTypes.default.func,
|
|
188
|
+
/**
|
|
189
|
+
* A function to be run when the video resumes.
|
|
190
|
+
*/
|
|
191
|
+
onResume: _propTypes.default.func,
|
|
192
|
+
/**
|
|
193
|
+
* A function to be run when the video progresses. This function will be run at 10%, 25%, 50%, 75% and 100%.
|
|
194
|
+
*/
|
|
195
|
+
onProgress: _propTypes.default.func
|
|
158
196
|
};
|
|
159
197
|
exports.VideoProps = VideoProps;
|
|
160
198
|
WebVideo.propTypes = VideoProps;
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.triggerInProgressVideoIntervals = exports.YoutubePlayerState = void 0;
|
|
7
|
+
/**
|
|
8
|
+
* Fires analytics events for inProgress analytics
|
|
9
|
+
* @param {current progress} progress
|
|
10
|
+
* @param {callback to run on defined milestones} onProgress
|
|
11
|
+
* @param {YouTube Video Event} event
|
|
12
|
+
*/
|
|
13
|
+
const fireVideoProgressEvents = (progress, onProgress, event) => {
|
|
14
|
+
const validProgressValues = [10, 25, 50, 75];
|
|
15
|
+
if (validProgressValues.includes(progress)) {
|
|
16
|
+
onProgress(event, progress);
|
|
17
|
+
}
|
|
18
|
+
};
|
|
19
|
+
const YoutubePlayerState = {
|
|
20
|
+
UNSTARTED: -1,
|
|
21
|
+
ENDED: 0,
|
|
22
|
+
PLAYING: 1,
|
|
23
|
+
PAUSED: 2,
|
|
24
|
+
BUFFERING: 3,
|
|
25
|
+
CUED: 5
|
|
26
|
+
};
|
|
27
|
+
exports.YoutubePlayerState = YoutubePlayerState;
|
|
28
|
+
const PERCENTAGE_MULTIPLIER = 100;
|
|
29
|
+
/**
|
|
30
|
+
* Run an interval to check the progress of the video and fire events at 10%, 25%, 50% and 75%
|
|
31
|
+
* @param {callback to run on defined milestones} onProgress
|
|
32
|
+
* @param {player reference} playerRef
|
|
33
|
+
* @param {YouTube video event} event
|
|
34
|
+
*/
|
|
35
|
+
const triggerInProgressVideoIntervals = (onProgress, playerRef, event) => {
|
|
36
|
+
const duration = playerRef.current.getDuration();
|
|
37
|
+
let lastProgress = null;
|
|
38
|
+
const requestAnimationFrameIds = [];
|
|
39
|
+
const frame = () => {
|
|
40
|
+
const currentTime = playerRef.current.getCurrentTime();
|
|
41
|
+
const progress = Math.round(currentTime / duration * PERCENTAGE_MULTIPLIER);
|
|
42
|
+
if (progress !== lastProgress) {
|
|
43
|
+
fireVideoProgressEvents(progress, onProgress, event);
|
|
44
|
+
lastProgress = progress;
|
|
45
|
+
}
|
|
46
|
+
if (currentTime < duration) {
|
|
47
|
+
requestAnimationFrameIds.push(requestAnimationFrame(frame));
|
|
48
|
+
}
|
|
49
|
+
};
|
|
50
|
+
|
|
51
|
+
// Cancel any previous animation frames
|
|
52
|
+
requestAnimationFrameIds.forEach(id => cancelAnimationFrame(id));
|
|
53
|
+
|
|
54
|
+
// Start a new animation frame
|
|
55
|
+
requestAnimationFrameIds.push(requestAnimationFrame(frame));
|
|
56
|
+
return requestAnimationFrameIds;
|
|
57
|
+
};
|
|
58
|
+
exports.triggerInProgressVideoIntervals = triggerInProgressVideoIntervals;
|
package/lib/baseExports.js
CHANGED
|
@@ -63,6 +63,12 @@ Object.defineProperty(exports, "ButtonLink", {
|
|
|
63
63
|
return _componentsBase.ButtonLink;
|
|
64
64
|
}
|
|
65
65
|
});
|
|
66
|
+
Object.defineProperty(exports, "CardGroup", {
|
|
67
|
+
enumerable: true,
|
|
68
|
+
get: function () {
|
|
69
|
+
return _componentsBase.CardGroup;
|
|
70
|
+
}
|
|
71
|
+
});
|
|
66
72
|
Object.defineProperty(exports, "Carousel", {
|
|
67
73
|
enumerable: true,
|
|
68
74
|
get: function () {
|
|
@@ -23,7 +23,7 @@ const withClientTheme = Component => {
|
|
|
23
23
|
});
|
|
24
24
|
};
|
|
25
25
|
UdsStyledComponent.propTypes = {
|
|
26
|
-
tokens:
|
|
26
|
+
tokens: (0, _componentsBase.getTokensPropType)(Component.displayName),
|
|
27
27
|
variant: _propTypes.default.string
|
|
28
28
|
};
|
|
29
29
|
return UdsStyledComponent;
|
|
@@ -25,7 +25,7 @@ const withServerTheme = (Component, componentName) => {
|
|
|
25
25
|
});
|
|
26
26
|
};
|
|
27
27
|
UdsStyledComponent.propTypes = {
|
|
28
|
-
tokens:
|
|
28
|
+
tokens: (0, _server.getTokensPropType)(componentName),
|
|
29
29
|
variant: _propTypes.default.string
|
|
30
30
|
};
|
|
31
31
|
return UdsStyledComponent;
|
|
@@ -46,7 +46,7 @@ const fontSizeMapping = {
|
|
|
46
46
|
14: 'small',
|
|
47
47
|
16: 'h6'
|
|
48
48
|
};
|
|
49
|
-
const Badge = _ref6 => {
|
|
49
|
+
const Badge = /*#__PURE__*/React.forwardRef((_ref6, ref) => {
|
|
50
50
|
let {
|
|
51
51
|
children,
|
|
52
52
|
tokens,
|
|
@@ -91,6 +91,7 @@ const Badge = _ref6 => {
|
|
|
91
91
|
fontWeight: fontWeight,
|
|
92
92
|
gradient: semanticGradient,
|
|
93
93
|
border: `${borderWidth}px solid ${borderColor}`,
|
|
94
|
+
ref: ref,
|
|
94
95
|
...selectProps(rest),
|
|
95
96
|
children: /*#__PURE__*/_jsx(Typography, {
|
|
96
97
|
tokens: {
|
|
@@ -104,7 +105,8 @@ const Badge = _ref6 => {
|
|
|
104
105
|
children: children
|
|
105
106
|
})
|
|
106
107
|
});
|
|
107
|
-
};
|
|
108
|
+
});
|
|
109
|
+
Badge.displayName = 'Badge';
|
|
108
110
|
Badge.propTypes = {
|
|
109
111
|
...selectedSystemPropTypes,
|
|
110
112
|
children: PropTypes.node,
|
|
@@ -49,7 +49,7 @@ const QuoteContainer = /*#__PURE__*/styled.div.withConfig({
|
|
|
49
49
|
} = _ref7;
|
|
50
50
|
return `${marginBottom}px`;
|
|
51
51
|
});
|
|
52
|
-
const BlockQuote = _ref8 => {
|
|
52
|
+
const BlockQuote = /*#__PURE__*/React.forwardRef((_ref8, ref) => {
|
|
53
53
|
let {
|
|
54
54
|
children,
|
|
55
55
|
link,
|
|
@@ -156,6 +156,7 @@ const BlockQuote = _ref8 => {
|
|
|
156
156
|
paddingRight: paddingRight,
|
|
157
157
|
width: width,
|
|
158
158
|
backgroundGradient: backgroundGradient,
|
|
159
|
+
ref: ref,
|
|
159
160
|
children: [renderQuote(), (additionalInfo || link) && /*#__PURE__*/_jsxs(StackView, {
|
|
160
161
|
space: 0,
|
|
161
162
|
children: [link && renderLink(), additionalInfo && /*#__PURE__*/_jsx(Typography, {
|
|
@@ -169,7 +170,8 @@ const BlockQuote = _ref8 => {
|
|
|
169
170
|
})]
|
|
170
171
|
})]
|
|
171
172
|
});
|
|
172
|
-
};
|
|
173
|
+
});
|
|
174
|
+
BlockQuote.displayName = 'BlockQuote';
|
|
173
175
|
BlockQuote.propTypes = {
|
|
174
176
|
...selectedSystemPropTypes,
|
|
175
177
|
...withLinkRouter.propTypes,
|
|
@@ -94,7 +94,7 @@ const getStructuredData = (items, baseUrl) => {
|
|
|
94
94
|
/**
|
|
95
95
|
* Display a hierarchy of links, commonly used for navigation.
|
|
96
96
|
*/
|
|
97
|
-
const Breadcrumbs = _ref2 => {
|
|
97
|
+
const Breadcrumbs = /*#__PURE__*/React.forwardRef((_ref2, ref) => {
|
|
98
98
|
let {
|
|
99
99
|
baseUrl,
|
|
100
100
|
children,
|
|
@@ -109,7 +109,7 @@ const Breadcrumbs = _ref2 => {
|
|
|
109
109
|
// React Helmet can cause a memory leak in SSR if not properly configured.
|
|
110
110
|
// Only run it in SSR if theme options tells us to.
|
|
111
111
|
/* const {
|
|
112
|
-
|
|
112
|
+
themeOptions: { enableHelmetSSR }
|
|
113
113
|
} = useTheme() */
|
|
114
114
|
// const isHydrating = useHydrationContext()
|
|
115
115
|
// const isSSR = typeof window === 'undefined' || isHydrating
|
|
@@ -122,12 +122,12 @@ const Breadcrumbs = _ref2 => {
|
|
|
122
122
|
children: breadcrumbName,
|
|
123
123
|
...itemRest
|
|
124
124
|
},
|
|
125
|
-
ref
|
|
125
|
+
ref: routeRef
|
|
126
126
|
} = _ref3;
|
|
127
127
|
return {
|
|
128
128
|
path: href,
|
|
129
129
|
breadcrumbName,
|
|
130
|
-
|
|
130
|
+
routeRef,
|
|
131
131
|
...itemRest
|
|
132
132
|
};
|
|
133
133
|
}) : routes.filter(route => route.path && route.breadcrumbName);
|
|
@@ -150,6 +150,7 @@ const Breadcrumbs = _ref2 => {
|
|
|
150
150
|
});
|
|
151
151
|
return /*#__PURE__*/_jsxs("nav", {
|
|
152
152
|
"aria-label": "Breadcrumb",
|
|
153
|
+
ref: ref,
|
|
153
154
|
...selectProps(rest),
|
|
154
155
|
children: [/*#__PURE__*/_jsx(StyledList, {
|
|
155
156
|
iconContainerSize: themeTokens.iconContainerSize,
|
|
@@ -181,7 +182,8 @@ const Breadcrumbs = _ref2 => {
|
|
|
181
182
|
})
|
|
182
183
|
}), metadata]
|
|
183
184
|
});
|
|
184
|
-
};
|
|
185
|
+
});
|
|
186
|
+
Breadcrumbs.displayName = 'Breadcrumbs';
|
|
185
187
|
Breadcrumbs.propTypes = {
|
|
186
188
|
...selectedSystemPropTypes,
|
|
187
189
|
tokens: getTokensPropType('Breadcrumbs'),
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import React
|
|
1
|
+
import React from 'react';
|
|
2
2
|
import PropTypes from 'prop-types';
|
|
3
3
|
import styled from 'styled-components';
|
|
4
4
|
import { Link, Typography, applyTextStyles, clickProps, selectSystemProps, useThemeTokens } from '@telus-uds/components-base';
|
|
@@ -76,7 +76,7 @@ const IconContainer = /*#__PURE__*/styled.span.withConfig({
|
|
|
76
76
|
return `${iconContainerSize + iconPadding * 2}px`;
|
|
77
77
|
}
|
|
78
78
|
});
|
|
79
|
-
const Item = /*#__PURE__*/forwardRef((_ref9, ref) => {
|
|
79
|
+
const Item = /*#__PURE__*/React.forwardRef((_ref9, ref) => {
|
|
80
80
|
let {
|
|
81
81
|
href,
|
|
82
82
|
children,
|
|
@@ -173,13 +173,4 @@ Item.propTypes = {
|
|
|
173
173
|
inverse: PropTypes.bool
|
|
174
174
|
})
|
|
175
175
|
};
|
|
176
|
-
|
|
177
|
-
// Since react/require-default-props eslint rule doesn't pick up default arguments as default props when combined with `forwardRef`
|
|
178
|
-
// - probably related https://github.com/yannickcr/eslint-plugin-react/issues/2760
|
|
179
|
-
Item.defaultProps = {
|
|
180
|
-
current: false,
|
|
181
|
-
variant: {
|
|
182
|
-
light: true
|
|
183
|
-
}
|
|
184
|
-
};
|
|
185
176
|
export default Item;
|
|
@@ -54,7 +54,7 @@ const CalloutContainer = /*#__PURE__*/styled.div.withConfig({
|
|
|
54
54
|
alignItems: verticalAlignToFlex(verticalAlign)
|
|
55
55
|
};
|
|
56
56
|
});
|
|
57
|
-
const Callout = _ref2 => {
|
|
57
|
+
const Callout = /*#__PURE__*/React.forwardRef((_ref2, ref) => {
|
|
58
58
|
let {
|
|
59
59
|
icon,
|
|
60
60
|
children,
|
|
@@ -88,6 +88,7 @@ const Callout = _ref2 => {
|
|
|
88
88
|
gap: gap,
|
|
89
89
|
borderRadius: borderRadius,
|
|
90
90
|
padding: `${paddingTop}px ${paddingRight}px ${paddingBottom}px ${paddingLeft}px`,
|
|
91
|
+
ref: ref,
|
|
91
92
|
...selectProps(rest),
|
|
92
93
|
children: [icon && /*#__PURE__*/_jsx(Icon, {
|
|
93
94
|
tokens: {
|
|
@@ -109,7 +110,8 @@ const Callout = _ref2 => {
|
|
|
109
110
|
children: children
|
|
110
111
|
})]
|
|
111
112
|
});
|
|
112
|
-
};
|
|
113
|
+
});
|
|
114
|
+
Callout.displayName = 'Callout';
|
|
113
115
|
Callout.propTypes = {
|
|
114
116
|
...selectedSystemPropTypes,
|
|
115
117
|
tokens: getTokensPropType('Callout'),
|
package/lib-module/Card/Card.js
CHANGED
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
|
|
2
|
-
import React, { forwardRef } from 'react';
|
|
1
|
+
import React from 'react';
|
|
3
2
|
import PropTypes from 'prop-types';
|
|
4
3
|
import { Card as CardBase, getTokensPropType, paddingProp, responsiveProps, selectSystemProps, StackView, useThemeTokens, useThemeTokensCallback, variantProp, a11yProps, viewProps, PressableCardBase } from '@telus-uds/components-base';
|
|
5
4
|
import CardContent from './CardContent';
|
|
@@ -39,7 +38,7 @@ const [selectProps, selectedSystemPropTypes] = selectSystemProps([a11yProps, vie
|
|
|
39
38
|
* ## Accessibility
|
|
40
39
|
* `Card` component accepts all the standard accessibility props.
|
|
41
40
|
*/
|
|
42
|
-
const Card = /*#__PURE__*/forwardRef(function () {
|
|
41
|
+
const Card = /*#__PURE__*/React.forwardRef(function () {
|
|
43
42
|
let {
|
|
44
43
|
children,
|
|
45
44
|
footer,
|
|
@@ -45,7 +45,7 @@ const CardContentContainer = /*#__PURE__*/styled.div.withConfig({
|
|
|
45
45
|
/**
|
|
46
46
|
* Card content, applying the card tokens as per the theme used.
|
|
47
47
|
*/
|
|
48
|
-
const CardContent = _ref2 => {
|
|
48
|
+
const CardContent = /*#__PURE__*/React.forwardRef((_ref2, ref) => {
|
|
49
49
|
let {
|
|
50
50
|
children,
|
|
51
51
|
flexContent,
|
|
@@ -62,10 +62,12 @@ const CardContent = _ref2 => {
|
|
|
62
62
|
...themeTokens,
|
|
63
63
|
flexContent: flexContent,
|
|
64
64
|
withFooter: withFooter,
|
|
65
|
+
ref: ref,
|
|
65
66
|
...selectProps(rest),
|
|
66
67
|
children: children
|
|
67
68
|
});
|
|
68
|
-
};
|
|
69
|
+
});
|
|
70
|
+
CardContent.displayName = 'CardContent';
|
|
69
71
|
CardContent.propTypes = {
|
|
70
72
|
...selectedSystemPropTypes,
|
|
71
73
|
/**
|
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
|
|
2
|
-
import React, { forwardRef } from 'react';
|
|
1
|
+
import React from 'react';
|
|
3
2
|
import PropTypes from 'prop-types';
|
|
4
3
|
import { Spacer, StackView, Typography, selectSystemProps, useViewport, useThemeTokens, applyTextStyles, getTokensPropType } from '@telus-uds/components-base';
|
|
5
4
|
import { viewports } from '@telus-uds/system-constants';
|
|
@@ -70,7 +69,7 @@ const getMainTextTokens = _ref2 => {
|
|
|
70
69
|
fontName: textTimerFontName
|
|
71
70
|
};
|
|
72
71
|
};
|
|
73
|
-
const Countdown = /*#__PURE__*/forwardRef((_ref3, ref) => {
|
|
72
|
+
const Countdown = /*#__PURE__*/React.forwardRef((_ref3, ref) => {
|
|
74
73
|
let {
|
|
75
74
|
copy = 'en',
|
|
76
75
|
targetTime,
|
|
@@ -38,7 +38,7 @@ const Container = /*#__PURE__*/styled.div.withConfig({
|
|
|
38
38
|
// A segment of the countdown string: we need to make sure it
|
|
39
39
|
// keeps its width constant to prevent the whole component from
|
|
40
40
|
// being automatically resized while using variable size fonts
|
|
41
|
-
const Segment = _ref2 => {
|
|
41
|
+
const Segment = /*#__PURE__*/React.forwardRef((_ref2, ref) => {
|
|
42
42
|
let {
|
|
43
43
|
copy = 'en',
|
|
44
44
|
segmentFontSize,
|
|
@@ -62,6 +62,7 @@ const Segment = _ref2 => {
|
|
|
62
62
|
segmentFontSize: segmentFontSize,
|
|
63
63
|
segmentWidth: segmentWidth,
|
|
64
64
|
variant: variant,
|
|
65
|
+
ref: ref,
|
|
65
66
|
children: /*#__PURE__*/_jsxs(StackView, {
|
|
66
67
|
direction: large || feature ? 'column' : 'row',
|
|
67
68
|
space: large || feature ? 0 : 1,
|
|
@@ -77,7 +78,8 @@ const Segment = _ref2 => {
|
|
|
77
78
|
})]
|
|
78
79
|
})
|
|
79
80
|
});
|
|
80
|
-
};
|
|
81
|
+
});
|
|
82
|
+
Segment.displayName = 'Segment';
|
|
81
83
|
Segment.propTypes = {
|
|
82
84
|
/**
|
|
83
85
|
* Copy language identifier or a dictionary instance.
|
|
@@ -20,7 +20,7 @@ const CalendarContainer = /*#__PURE__*/styled.div.withConfig({
|
|
|
20
20
|
return `
|
|
21
21
|
${defaultReactDatesCss}
|
|
22
22
|
> div {
|
|
23
|
-
z-index:
|
|
23
|
+
z-index: 1000;
|
|
24
24
|
}
|
|
25
25
|
.SingleDatePicker,
|
|
26
26
|
.SingleDatePickerInput {
|
|
@@ -32,7 +32,7 @@ const CalendarContainer = /*#__PURE__*/styled.div.withConfig({
|
|
|
32
32
|
border: 1px solid ${remainingTokens.singleDatePickerBorderColor};
|
|
33
33
|
border-radius: ${remainingTokens.singleDatePickerRadius}px;
|
|
34
34
|
padding: ${remainingTokens.singleDatePickerPaddingTopBottom}px ${remainingTokens.singleDatePickerLeftRight}px;
|
|
35
|
-
z-index:
|
|
35
|
+
z-index: 1000;
|
|
36
36
|
}
|
|
37
37
|
.DateInput {
|
|
38
38
|
width: 100%;
|