@telus-uds/components-web 2.43.0 → 3.0.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/.eslintrc.cjs +26 -0
- package/CHANGELOG.md +21 -2
- package/babel.config.cjs +4 -0
- package/jest.config.cjs +29 -0
- package/lib/Badge/Badge.js +21 -29
- package/lib/Badge/index.js +2 -10
- package/lib/BlockQuote/BlockQuote.js +31 -39
- package/lib/BlockQuote/index.js +2 -10
- package/lib/Breadcrumbs/Breadcrumbs.js +39 -49
- package/lib/Breadcrumbs/Item/Item.js +26 -34
- package/lib/Breadcrumbs/index.js +1 -13
- package/lib/Callout/Callout.js +19 -27
- package/lib/Callout/index.js +2 -10
- package/lib/Card/Card.js +44 -54
- package/lib/Card/CardContent.js +17 -25
- package/lib/Card/CardFooter.js +16 -24
- package/lib/Card/index.js +2 -10
- package/lib/Countdown/Countdown.js +34 -42
- package/lib/Countdown/Segment.js +26 -34
- package/lib/Countdown/constants.js +4 -14
- package/lib/Countdown/dictionary.js +2 -9
- package/lib/Countdown/index.js +2 -10
- package/lib/Countdown/types.js +18 -28
- package/lib/Countdown/useCountdown.js +4 -11
- package/lib/DatePicker/CalendarContainer.js +6 -12
- package/lib/DatePicker/DatePicker.js +105 -101
- package/lib/DatePicker/dictionary.js +1 -8
- package/lib/DatePicker/index.js +2 -10
- package/lib/DatePicker/reactDatesCss.js +3 -10
- package/lib/Disclaimer/Disclaimer.js +15 -23
- package/lib/Disclaimer/index.js +1 -13
- package/lib/ExpandCollapseMini/ExpandCollapseMini.js +16 -24
- package/lib/ExpandCollapseMini/ExpandCollapseMiniControl.js +17 -26
- package/lib/ExpandCollapseMini/index.js +2 -10
- package/lib/Footnote/Footnote.js +85 -95
- package/lib/Footnote/FootnoteLink.js +25 -33
- package/lib/Footnote/dictionary.js +2 -9
- package/lib/Footnote/index.js +4 -12
- package/lib/IconButton/IconButton.js +12 -20
- package/lib/IconButton/index.js +2 -10
- package/lib/Image/Image.js +17 -25
- package/lib/Image/index.js +6 -18
- package/lib/Image/server.js +4 -12
- package/lib/List/List.js +2 -9
- package/lib/List/ListItem.js +10 -18
- package/lib/List/index.js +4 -12
- package/lib/NavigationBar/NavigationBar.js +51 -59
- package/lib/NavigationBar/NavigationItem.js +19 -27
- package/lib/NavigationBar/NavigationSubMenu.js +34 -40
- package/lib/NavigationBar/collapseItems.js +1 -11
- package/lib/NavigationBar/index.js +4 -12
- package/lib/NavigationBar/resolveItemSelection.js +1 -8
- package/lib/OptimizeImage/OptimizeImage.js +26 -34
- package/lib/OptimizeImage/index.js +2 -10
- package/lib/OptimizeImage/utils/getFallbackUrl.js +3 -10
- package/lib/OptimizeImage/utils/getImageUrls.js +9 -16
- package/lib/OptimizeImage/utils/getOptimizedUrl.js +3 -10
- package/lib/OptimizeImage/utils/hasWebpSupport.js +1 -7
- package/lib/OptimizeImage/utils/index.js +5 -34
- package/lib/OptimizeImage/utils/isSvgUrl.js +1 -7
- package/lib/OrderedList/Item.js +28 -36
- package/lib/OrderedList/ItemBase.js +8 -16
- package/lib/OrderedList/OrderedList.js +22 -30
- package/lib/OrderedList/OrderedListBase.js +12 -20
- package/lib/OrderedList/constants.js +1 -8
- package/lib/OrderedList/index.js +4 -12
- package/lib/Paragraph/Paragraph.js +22 -30
- package/lib/Paragraph/index.js +2 -10
- package/lib/PreviewCard/AuthorDate.js +17 -21
- package/lib/PreviewCard/PreviewCard.js +40 -49
- package/lib/PreviewCard/index.js +2 -10
- package/lib/PriceLockup/PriceLockup.js +56 -64
- package/lib/PriceLockup/index.js +2 -10
- package/lib/PriceLockup/tokens.js +2 -9
- package/lib/Progress/ProgressBar.js +17 -24
- package/lib/Progress/index.js +4 -12
- package/lib/QuantitySelector/QuantitySelector.js +55 -63
- package/lib/QuantitySelector/SideButton.js +15 -23
- package/lib/QuantitySelector/dictionary.js +2 -9
- package/lib/QuantitySelector/index.js +2 -10
- package/lib/QuantitySelector/styles.js +4 -13
- package/lib/ResponsiveImage/ResponsiveImage.js +29 -37
- package/lib/ResponsiveImage/index.js +2 -10
- package/lib/Ribbon/Ribbon.js +22 -30
- package/lib/Ribbon/index.js +2 -10
- package/lib/SkeletonProvider/SkeletonImage.js +14 -22
- package/lib/SkeletonProvider/SkeletonProvider.js +17 -25
- package/lib/SkeletonProvider/SkeletonTypography.js +14 -22
- package/lib/SkeletonProvider/index.js +2 -10
- package/lib/Span/Span.js +23 -31
- package/lib/Span/index.js +2 -10
- package/lib/Spinner/Spinner.js +43 -51
- package/lib/Spinner/SpinnerContent.js +21 -29
- package/lib/Spinner/constants.js +4 -14
- package/lib/Spinner/index.js +2 -10
- package/lib/StoryCard/StoryCard.js +40 -49
- package/lib/StoryCard/index.js +2 -10
- package/lib/Table/Body.js +7 -15
- package/lib/Table/Cell.js +28 -38
- package/lib/Table/Header.js +11 -19
- package/lib/Table/Row.js +8 -16
- package/lib/Table/SubHeading.js +10 -18
- package/lib/Table/Table.js +26 -35
- package/lib/Table/index.js +12 -20
- package/lib/TermsAndConditions/ExpandCollapse.js +22 -30
- package/lib/TermsAndConditions/TermsAndConditions.js +52 -60
- package/lib/TermsAndConditions/dictionary.js +2 -9
- package/lib/TermsAndConditions/index.js +1 -13
- package/lib/Testimonial/Testimonial.js +37 -45
- package/lib/Testimonial/index.js +2 -10
- package/lib/Toast/Toast.js +32 -42
- package/lib/Toast/index.js +2 -10
- package/lib/Video/ControlBar/ControlBar.js +73 -81
- package/lib/Video/ControlBar/Controls/VideoButton/VideoButton.js +16 -24
- package/lib/Video/ControlBar/Controls/VideoMenu/VideoMenu.js +27 -35
- package/lib/Video/ControlBar/Controls/VideoProgressBar/VideoProgressBar.js +27 -36
- package/lib/Video/ControlBar/Controls/VolumeSlider/VolumeSlider.js +30 -38
- package/lib/Video/MiddleControlButton/MiddleControlButton.js +16 -24
- package/lib/Video/Video.js +74 -83
- package/lib/Video/index.js +2 -10
- package/lib/Video/videoText.js +1 -8
- package/lib/VideoPicker/VideoPicker.js +43 -53
- package/lib/VideoPicker/VideoPickerPlayer.js +17 -25
- package/lib/VideoPicker/VideoPickerThumbnail.js +38 -46
- package/lib/VideoPicker/VideoSlider.js +17 -26
- package/lib/VideoPicker/index.js +2 -10
- package/lib/VideoPicker/videoPropType.js +9 -18
- package/lib/WaffleGrid/WaffleGrid.js +33 -43
- package/lib/WaffleGrid/index.js +2 -10
- package/lib/WebVideo/WebVideo.js +42 -52
- package/lib/WebVideo/index.js +2 -10
- package/lib/WebVideo/utils/index.js +3 -11
- package/lib/baseExports.js +18 -431
- package/lib/index.js +38 -323
- package/lib/server.js +4 -12
- package/lib/shared/ConditionalWrapper/ConditionalWrapper.js +9 -17
- package/lib/shared/ConditionalWrapper/index.js +2 -10
- package/lib/shared/FullBleedContent/FullBleedContent.js +21 -29
- package/lib/shared/FullBleedContent/getFullBleedBorderRadius.js +1 -8
- package/lib/shared/FullBleedContent/index.js +4 -24
- package/lib/shared/FullBleedContent/useFullBleedContentProps.js +4 -11
- package/lib/shared/VideoSplash/SplashButton/SplashButton.js +19 -27
- package/lib/shared/VideoSplash/SplashButtonWithDetails/SplashButtonWithDetails.js +27 -35
- package/lib/shared/VideoSplash/VideoSplash.js +24 -32
- package/lib/shared/VideoSplash/helpers.js +5 -14
- package/lib/utils/index.js +10 -75
- package/lib/utils/isElementFocusable.js +1 -8
- package/lib/utils/logger.js +6 -15
- package/lib/utils/media.js +5 -11
- package/lib/utils/renderStructuredContent.js +8 -15
- package/lib/utils/ssr.js +5 -12
- package/lib/utils/theming/get-theme-from-server.js +2 -10
- package/lib/utils/theming/with-client-theme.js +9 -17
- package/lib/utils/theming/with-server-theme.js +11 -19
- package/lib/utils/transforms.js +3 -11
- package/lib/utils/useOverlaidPosition.js +15 -23
- package/lib/utils/useTypographyTheme.js +6 -13
- package/package.json +18 -20
- package/src/Card/Card.jsx +2 -2
- package/src/DatePicker/DatePicker.jsx +17 -4
- package/src/PreviewCard/AuthorDate.jsx +5 -3
- package/src/utils/logger.js +2 -2
- package/lib-module/Badge/Badge.js +0 -121
- package/lib-module/Badge/index.js +0 -2
- package/lib-module/BlockQuote/BlockQuote.js +0 -204
- package/lib-module/BlockQuote/index.js +0 -2
- package/lib-module/Breadcrumbs/Breadcrumbs.js +0 -250
- package/lib-module/Breadcrumbs/Item/Item.js +0 -175
- package/lib-module/Breadcrumbs/index.js +0 -1
- package/lib-module/Callout/Callout.js +0 -135
- package/lib-module/Callout/index.js +0 -2
- package/lib-module/Card/Card.js +0 -251
- package/lib-module/Card/CardContent.js +0 -90
- package/lib-module/Card/CardFooter.js +0 -78
- package/lib-module/Card/index.js +0 -2
- package/lib-module/Countdown/Countdown.js +0 -169
- package/lib-module/Countdown/Segment.js +0 -96
- package/lib-module/Countdown/constants.js +0 -4
- package/lib-module/Countdown/dictionary.js +0 -22
- package/lib-module/Countdown/index.js +0 -2
- package/lib-module/Countdown/types.js +0 -24
- package/lib-module/Countdown/useCountdown.js +0 -26
- package/lib-module/DatePicker/CalendarContainer.js +0 -208
- package/lib-module/DatePicker/DatePicker.js +0 -506
- package/lib-module/DatePicker/dictionary.js +0 -119
- package/lib-module/DatePicker/index.js +0 -2
- package/lib-module/DatePicker/reactDatesCss.js +0 -3
- package/lib-module/Disclaimer/Disclaimer.js +0 -54
- package/lib-module/Disclaimer/index.js +0 -1
- package/lib-module/ExpandCollapseMini/ExpandCollapseMini.js +0 -73
- package/lib-module/ExpandCollapseMini/ExpandCollapseMiniControl.js +0 -117
- package/lib-module/ExpandCollapseMini/index.js +0 -2
- package/lib-module/Footnote/Footnote.js +0 -632
- package/lib-module/Footnote/FootnoteLink.js +0 -118
- package/lib-module/Footnote/dictionary.js +0 -12
- package/lib-module/Footnote/index.js +0 -4
- package/lib-module/IconButton/IconButton.js +0 -55
- package/lib-module/IconButton/index.js +0 -2
- package/lib-module/Image/Image.js +0 -83
- package/lib-module/Image/index.js +0 -9
- package/lib-module/Image/server.js +0 -4
- package/lib-module/List/List.js +0 -2
- package/lib-module/List/ListItem.js +0 -28
- package/lib-module/List/index.js +0 -4
- package/lib-module/NavigationBar/NavigationBar.js +0 -224
- package/lib-module/NavigationBar/NavigationItem.js +0 -87
- package/lib-module/NavigationBar/NavigationSubMenu.js +0 -162
- package/lib-module/NavigationBar/collapseItems.js +0 -41
- package/lib-module/NavigationBar/index.js +0 -4
- package/lib-module/NavigationBar/resolveItemSelection.js +0 -16
- package/lib-module/OptimizeImage/OptimizeImage.js +0 -92
- package/lib-module/OptimizeImage/index.js +0 -2
- package/lib-module/OptimizeImage/utils/getFallbackUrl.js +0 -7
- package/lib-module/OptimizeImage/utils/getImageUrls.js +0 -12
- package/lib-module/OptimizeImage/utils/getOptimizedUrl.js +0 -17
- package/lib-module/OptimizeImage/utils/hasWebpSupport.js +0 -28
- package/lib-module/OptimizeImage/utils/index.js +0 -5
- package/lib-module/OptimizeImage/utils/isSvgUrl.js +0 -3
- package/lib-module/OrderedList/Item.js +0 -145
- package/lib-module/OrderedList/ItemBase.js +0 -27
- package/lib-module/OrderedList/OrderedList.js +0 -86
- package/lib-module/OrderedList/OrderedListBase.js +0 -45
- package/lib-module/OrderedList/constants.js +0 -2
- package/lib-module/OrderedList/index.js +0 -4
- package/lib-module/Paragraph/Paragraph.js +0 -90
- package/lib-module/Paragraph/index.js +0 -2
- package/lib-module/PreviewCard/AuthorDate.js +0 -57
- package/lib-module/PreviewCard/PreviewCard.js +0 -209
- package/lib-module/PreviewCard/index.js +0 -2
- package/lib-module/PriceLockup/PriceLockup.js +0 -335
- package/lib-module/PriceLockup/index.js +0 -2
- package/lib-module/PriceLockup/tokens.js +0 -55
- package/lib-module/Progress/ProgressBar.js +0 -83
- package/lib-module/Progress/index.js +0 -4
- package/lib-module/QuantitySelector/QuantitySelector.js +0 -261
- package/lib-module/QuantitySelector/SideButton.js +0 -70
- package/lib-module/QuantitySelector/dictionary.js +0 -26
- package/lib-module/QuantitySelector/index.js +0 -2
- package/lib-module/QuantitySelector/styles.js +0 -9
- package/lib-module/ResponsiveImage/ResponsiveImage.js +0 -95
- package/lib-module/ResponsiveImage/index.js +0 -2
- package/lib-module/Ribbon/Ribbon.js +0 -216
- package/lib-module/Ribbon/index.js +0 -2
- package/lib-module/SkeletonProvider/SkeletonImage.js +0 -39
- package/lib-module/SkeletonProvider/SkeletonProvider.js +0 -57
- package/lib-module/SkeletonProvider/SkeletonTypography.js +0 -38
- package/lib-module/SkeletonProvider/index.js +0 -2
- package/lib-module/Span/Span.js +0 -72
- package/lib-module/Span/index.js +0 -2
- package/lib-module/Spinner/Spinner.js +0 -215
- package/lib-module/Spinner/SpinnerContent.js +0 -94
- package/lib-module/Spinner/constants.js +0 -4
- package/lib-module/Spinner/index.js +0 -2
- package/lib-module/StoryCard/StoryCard.js +0 -212
- package/lib-module/StoryCard/index.js +0 -2
- package/lib-module/Table/Body.js +0 -17
- package/lib-module/Table/Cell.js +0 -176
- package/lib-module/Table/Header.js +0 -25
- package/lib-module/Table/Row.js +0 -19
- package/lib-module/Table/SubHeading.js +0 -23
- package/lib-module/Table/Table.js +0 -114
- package/lib-module/Table/index.js +0 -12
- package/lib-module/TermsAndConditions/ExpandCollapse.js +0 -153
- package/lib-module/TermsAndConditions/TermsAndConditions.js +0 -277
- package/lib-module/TermsAndConditions/dictionary.js +0 -16
- package/lib-module/TermsAndConditions/index.js +0 -1
- package/lib-module/Testimonial/Testimonial.js +0 -234
- package/lib-module/Testimonial/index.js +0 -2
- package/lib-module/Toast/Toast.js +0 -158
- package/lib-module/Toast/index.js +0 -2
- package/lib-module/Video/ControlBar/ControlBar.js +0 -288
- package/lib-module/Video/ControlBar/Controls/VideoButton/VideoButton.js +0 -70
- package/lib-module/Video/ControlBar/Controls/VideoMenu/VideoMenu.js +0 -163
- package/lib-module/Video/ControlBar/Controls/VideoProgressBar/VideoProgressBar.js +0 -203
- package/lib-module/Video/ControlBar/Controls/VolumeSlider/VolumeSlider.js +0 -191
- package/lib-module/Video/MiddleControlButton/MiddleControlButton.js +0 -71
- package/lib-module/Video/Video.js +0 -959
- package/lib-module/Video/index.js +0 -2
- package/lib-module/Video/videoText.js +0 -55
- package/lib-module/VideoPicker/VideoPicker.js +0 -190
- package/lib-module/VideoPicker/VideoPickerPlayer.js +0 -48
- package/lib-module/VideoPicker/VideoPickerThumbnail.js +0 -218
- package/lib-module/VideoPicker/VideoSlider.js +0 -82
- package/lib-module/VideoPicker/index.js +0 -2
- package/lib-module/VideoPicker/videoPropType.js +0 -10
- package/lib-module/WaffleGrid/WaffleGrid.js +0 -157
- package/lib-module/WaffleGrid/index.js +0 -2
- package/lib-module/WebVideo/WebVideo.js +0 -191
- package/lib-module/WebVideo/index.js +0 -2
- package/lib-module/WebVideo/utils/index.js +0 -50
- package/lib-module/baseExports.js +0 -19
- package/lib-module/index.js +0 -40
- package/lib-module/server.js +0 -5
- package/lib-module/shared/ConditionalWrapper/ConditionalWrapper.js +0 -22
- package/lib-module/shared/ConditionalWrapper/index.js +0 -2
- package/lib-module/shared/FullBleedContent/FullBleedContent.js +0 -101
- package/lib-module/shared/FullBleedContent/getFullBleedBorderRadius.js +0 -55
- package/lib-module/shared/FullBleedContent/index.js +0 -4
- package/lib-module/shared/FullBleedContent/useFullBleedContentProps.js +0 -55
- package/lib-module/shared/VideoSplash/SplashButton/SplashButton.js +0 -84
- package/lib-module/shared/VideoSplash/SplashButtonWithDetails/SplashButtonWithDetails.js +0 -223
- package/lib-module/shared/VideoSplash/VideoSplash.js +0 -65
- package/lib-module/shared/VideoSplash/helpers.js +0 -23
- package/lib-module/utils/index.js +0 -10
- package/lib-module/utils/isElementFocusable.js +0 -8
- package/lib-module/utils/logger.js +0 -18
- package/lib-module/utils/media.js +0 -39
- package/lib-module/utils/renderStructuredContent.js +0 -66
- package/lib-module/utils/ssr.js +0 -37
- package/lib-module/utils/theming/get-theme-from-server.js +0 -16
- package/lib-module/utils/theming/with-client-theme.js +0 -24
- package/lib-module/utils/theming/with-server-theme.js +0 -26
- package/lib-module/utils/transforms.js +0 -4
- package/lib-module/utils/useOverlaidPosition.js +0 -216
- package/lib-module/utils/useTypographyTheme.js +0 -24
|
@@ -1,22 +1,13 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
var _OrderedListBase = _interopRequireDefault(require("../OrderedList/OrderedListBase"));
|
|
12
|
-
var _ItemBase = _interopRequireDefault(require("../OrderedList/ItemBase"));
|
|
13
|
-
var _Image = _interopRequireDefault(require("../Image"));
|
|
14
|
-
var _utils = require("../utils");
|
|
15
|
-
var _jsxRuntime = require("react/jsx-runtime");
|
|
16
|
-
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
17
|
-
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); }
|
|
18
|
-
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; }
|
|
19
|
-
const [selectProps, selectedSystemPropTypes] = (0, _componentsBase.selectSystemProps)([_utils.htmlAttrs]);
|
|
1
|
+
import React, { createElement as _createElement } from 'react';
|
|
2
|
+
import PropTypes from 'prop-types';
|
|
3
|
+
import styled from 'styled-components';
|
|
4
|
+
import { Link, responsiveProps, selectSystemProps, useResponsiveProp, useThemeTokens, withLinkRouter, useViewport, Typography, getTokensPropType } from '@telus-uds/components-base';
|
|
5
|
+
import OrderedListBase from '../OrderedList/OrderedListBase';
|
|
6
|
+
import ItemBase from '../OrderedList/ItemBase';
|
|
7
|
+
import Image from '../Image';
|
|
8
|
+
import { htmlAttrs } from '../utils';
|
|
9
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
10
|
+
const [selectProps, selectedSystemPropTypes] = selectSystemProps([htmlAttrs]);
|
|
20
11
|
const row = (rowSize, rowBorderWidth) => ({
|
|
21
12
|
flexBasis: `calc(100% / ${rowSize})`,
|
|
22
13
|
[`:not(:nth-of-type(${rowSize}n + 1))`]: {
|
|
@@ -26,7 +17,7 @@ const row = (rowSize, rowBorderWidth) => ({
|
|
|
26
17
|
borderTopWidth: `${rowBorderWidth}px`
|
|
27
18
|
}
|
|
28
19
|
});
|
|
29
|
-
const Container = /*#__PURE__*/(
|
|
20
|
+
const Container = /*#__PURE__*/styled(OrderedListBase).withConfig({
|
|
30
21
|
displayName: "WaffleGrid__Container",
|
|
31
22
|
componentId: "components-web__sc-ec8g0a-0"
|
|
32
23
|
})({
|
|
@@ -35,7 +26,7 @@ const Container = /*#__PURE__*/(0, _styledComponents.default)(_OrderedListBase.d
|
|
|
35
26
|
flexWrap: 'wrap',
|
|
36
27
|
justifyContent: 'flex-start'
|
|
37
28
|
});
|
|
38
|
-
const Item = /*#__PURE__*/(
|
|
29
|
+
const Item = /*#__PURE__*/styled(ItemBase).withConfig({
|
|
39
30
|
displayName: "WaffleGrid__Item",
|
|
40
31
|
componentId: "components-web__sc-ec8g0a-1"
|
|
41
32
|
})(_ref => {
|
|
@@ -63,7 +54,7 @@ const Item = /*#__PURE__*/(0, _styledComponents.default)(_ItemBase.default).with
|
|
|
63
54
|
...row(rowSize, rowBorderWidth)
|
|
64
55
|
};
|
|
65
56
|
});
|
|
66
|
-
const Center = /*#__PURE__*/(
|
|
57
|
+
const Center = /*#__PURE__*/styled('div').withConfig({
|
|
67
58
|
displayName: "WaffleGrid__Center",
|
|
68
59
|
componentId: "components-web__sc-ec8g0a-2"
|
|
69
60
|
})({
|
|
@@ -76,7 +67,7 @@ const Center = /*#__PURE__*/(0, _styledComponents.default)('div').withConfig({
|
|
|
76
67
|
/**
|
|
77
68
|
* The WaffleGrid is used to show items in a waffle like manner with borders surrounding the element
|
|
78
69
|
*/
|
|
79
|
-
const WaffleGrid = /*#__PURE__*/
|
|
70
|
+
const WaffleGrid = /*#__PURE__*/React.forwardRef((_ref2, ref) => {
|
|
80
71
|
let {
|
|
81
72
|
items,
|
|
82
73
|
rowSize = null,
|
|
@@ -86,36 +77,36 @@ const WaffleGrid = /*#__PURE__*/_react.default.forwardRef((_ref2, ref) => {
|
|
|
86
77
|
linkRouterProps,
|
|
87
78
|
...rest
|
|
88
79
|
} = _ref2;
|
|
89
|
-
const viewport =
|
|
90
|
-
const themeTokens =
|
|
80
|
+
const viewport = useViewport();
|
|
81
|
+
const themeTokens = useThemeTokens('WaffleGrid', tokens, variant, {
|
|
91
82
|
viewport
|
|
92
83
|
});
|
|
93
|
-
const currentRowSize =
|
|
94
|
-
return /*#__PURE__*/(
|
|
84
|
+
const currentRowSize = useResponsiveProp(rowSize);
|
|
85
|
+
return /*#__PURE__*/_jsx(Container, {
|
|
95
86
|
ref: ref,
|
|
96
87
|
...selectProps(rest),
|
|
97
|
-
children: items.map(child => /*#__PURE__*/(
|
|
88
|
+
children: items.map(child => /*#__PURE__*/_createElement(Item, {
|
|
98
89
|
...themeTokens,
|
|
99
90
|
key: child.href,
|
|
100
91
|
rowSize: rowSize ? currentRowSize : themeTokens.rowSize
|
|
101
|
-
}, /*#__PURE__*/(
|
|
92
|
+
}, /*#__PURE__*/_jsx(Link, {
|
|
102
93
|
href: child.href,
|
|
103
94
|
LinkRouter: child.LinkRouter || LinkRouter,
|
|
104
95
|
linkRouterProps: {
|
|
105
96
|
...linkRouterProps,
|
|
106
97
|
...child.linkRouterProps
|
|
107
98
|
},
|
|
108
|
-
children: /*#__PURE__*/(
|
|
99
|
+
children: /*#__PURE__*/_jsxs(Center, {
|
|
109
100
|
children: [typeof child.image === 'string' ?
|
|
110
101
|
/*#__PURE__*/
|
|
111
102
|
// Assuming that string passed is the image URL
|
|
112
|
-
(
|
|
103
|
+
_jsx(Image, {
|
|
113
104
|
src: child.image,
|
|
114
105
|
alt: child.imageAltText,
|
|
115
106
|
width: 96
|
|
116
107
|
}) :
|
|
117
108
|
// Otherwise it must be an arbitrary content, which we just display by itself
|
|
118
|
-
child.image, /*#__PURE__*/(
|
|
109
|
+
child.image, /*#__PURE__*/_jsx(Typography, {
|
|
119
110
|
variant: {
|
|
120
111
|
weight: 'semibold'
|
|
121
112
|
},
|
|
@@ -131,35 +122,34 @@ WaffleGrid.propTypes = {
|
|
|
131
122
|
/**
|
|
132
123
|
* The image and the link to display. `items` should be an array of objects with the following keys:
|
|
133
124
|
*/
|
|
134
|
-
items:
|
|
125
|
+
items: PropTypes.arrayOf(PropTypes.shape({
|
|
135
126
|
/**
|
|
136
127
|
* The src attribute for the HTML img element or custom JSX content to render instead
|
|
137
128
|
*/
|
|
138
|
-
image:
|
|
129
|
+
image: PropTypes.oneOfType([PropTypes.string, PropTypes.node]),
|
|
139
130
|
/**
|
|
140
131
|
* The alt attribute for the HTML img element (note that this is ignored if a custom
|
|
141
132
|
* JSX content is used instead of an image URL)
|
|
142
133
|
*/
|
|
143
|
-
imageAltText:
|
|
134
|
+
imageAltText: PropTypes.string,
|
|
144
135
|
/**
|
|
145
136
|
* The text displayed under the image
|
|
146
137
|
*/
|
|
147
|
-
text:
|
|
138
|
+
text: PropTypes.string,
|
|
148
139
|
/**
|
|
149
140
|
* Target URL
|
|
150
141
|
*/
|
|
151
|
-
href:
|
|
152
|
-
...
|
|
142
|
+
href: PropTypes.string,
|
|
143
|
+
...withLinkRouter.propTypes
|
|
153
144
|
})).isRequired,
|
|
154
145
|
/**
|
|
155
146
|
* Sets the tokens for WaffleGrid element.
|
|
156
147
|
*/
|
|
157
|
-
tokens:
|
|
148
|
+
tokens: getTokensPropType('WaffleGrid'),
|
|
158
149
|
/**
|
|
159
150
|
* Row size, optionally depending on the viewport
|
|
160
151
|
*/
|
|
161
|
-
rowSize:
|
|
162
|
-
...
|
|
152
|
+
rowSize: responsiveProps.getTypeOptionallyByViewport(PropTypes.number),
|
|
153
|
+
...withLinkRouter.propTypes
|
|
163
154
|
};
|
|
164
|
-
|
|
165
|
-
exports.default = _default;
|
|
155
|
+
export default WaffleGrid;
|
package/lib/WaffleGrid/index.js
CHANGED
|
@@ -1,10 +1,2 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.default = void 0;
|
|
7
|
-
var _WaffleGrid = _interopRequireDefault(require("./WaffleGrid"));
|
|
8
|
-
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
9
|
-
var _default = _WaffleGrid.default;
|
|
10
|
-
exports.default = _default;
|
|
1
|
+
import WaffleGrid from './WaffleGrid';
|
|
2
|
+
export default WaffleGrid;
|
package/lib/WebVideo/WebVideo.js
CHANGED
|
@@ -1,21 +1,14 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
var _VideoSplash = _interopRequireDefault(require("../shared/VideoSplash/VideoSplash"));
|
|
13
|
-
var _utils = require("../utils");
|
|
14
|
-
var _utils2 = require("./utils");
|
|
15
|
-
var _jsxRuntime = require("react/jsx-runtime");
|
|
16
|
-
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
17
|
-
const [selectProps, selectedSystemPropTypes] = (0, _componentsBase.selectSystemProps)([_utils.htmlAttrs]);
|
|
18
|
-
const StyledPlayerContainer = /*#__PURE__*/_styledComponents.default.div.withConfig({
|
|
1
|
+
import { selectSystemProps } from '@telus-uds/components-base';
|
|
2
|
+
import PropTypes from 'prop-types';
|
|
3
|
+
import React from 'react';
|
|
4
|
+
import YouTube from 'react-youtube';
|
|
5
|
+
import styled from 'styled-components';
|
|
6
|
+
import VideoSplash from '../shared/VideoSplash/VideoSplash';
|
|
7
|
+
import { htmlAttrs } from '../utils';
|
|
8
|
+
import { triggerInProgressVideoIntervals, YoutubePlayerState } from './utils';
|
|
9
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
10
|
+
const [selectProps, selectedSystemPropTypes] = selectSystemProps([htmlAttrs]);
|
|
11
|
+
const StyledPlayerContainer = /*#__PURE__*/styled.div.withConfig({
|
|
19
12
|
displayName: "WebVideo__StyledPlayerContainer",
|
|
20
13
|
componentId: "components-web__sc-327a6k-0"
|
|
21
14
|
})({
|
|
@@ -23,7 +16,7 @@ const StyledPlayerContainer = /*#__PURE__*/_styledComponents.default.div.withCon
|
|
|
23
16
|
minWidth: 288,
|
|
24
17
|
outline: 'none'
|
|
25
18
|
});
|
|
26
|
-
const StyledYoutubePlayer = /*#__PURE__*/(
|
|
19
|
+
const StyledYoutubePlayer = /*#__PURE__*/styled(YouTube).withConfig({
|
|
27
20
|
displayName: "WebVideo__StyledYoutubePlayer",
|
|
28
21
|
componentId: "components-web__sc-327a6k-1"
|
|
29
22
|
})({
|
|
@@ -44,14 +37,14 @@ const aspectRatios = {
|
|
|
44
37
|
paddingTop: '100%'
|
|
45
38
|
}
|
|
46
39
|
};
|
|
47
|
-
const AspectLimiter = /*#__PURE__*/
|
|
40
|
+
const AspectLimiter = /*#__PURE__*/styled.div.withConfig({
|
|
48
41
|
displayName: "WebVideo__AspectLimiter",
|
|
49
42
|
componentId: "components-web__sc-327a6k-2"
|
|
50
43
|
})(props => ({
|
|
51
44
|
...aspectRatios[props.aspectRatio],
|
|
52
45
|
position: 'relative'
|
|
53
46
|
}));
|
|
54
|
-
const WebVideo = /*#__PURE__*/
|
|
47
|
+
const WebVideo = /*#__PURE__*/React.forwardRef((_ref, ref) => {
|
|
55
48
|
let {
|
|
56
49
|
videoId,
|
|
57
50
|
aspectRatio = '16:9',
|
|
@@ -67,17 +60,17 @@ const WebVideo = /*#__PURE__*/_react.default.forwardRef((_ref, ref) => {
|
|
|
67
60
|
onStart = () => {},
|
|
68
61
|
...rest
|
|
69
62
|
} = _ref;
|
|
70
|
-
const [started, setStarted] =
|
|
71
|
-
const videoStateData =
|
|
63
|
+
const [started, setStarted] = React.useState(false);
|
|
64
|
+
const videoStateData = React.useRef({
|
|
72
65
|
requestAnimationIds: [],
|
|
73
|
-
state:
|
|
66
|
+
state: YoutubePlayerState.UNSTARTED
|
|
74
67
|
});
|
|
75
|
-
const playerRef =
|
|
68
|
+
const playerRef = React.useRef(null);
|
|
76
69
|
const onPlayCallback = event => {
|
|
77
|
-
onPlay(event, videoStateData.current.state ===
|
|
78
|
-
videoStateData.current.state =
|
|
70
|
+
onPlay(event, videoStateData.current.state === YoutubePlayerState.PAUSED);
|
|
71
|
+
videoStateData.current.state = YoutubePlayerState.PLAYING;
|
|
79
72
|
if (onProgress) {
|
|
80
|
-
videoStateData.current.requestAnimationIds =
|
|
73
|
+
videoStateData.current.requestAnimationIds = triggerInProgressVideoIntervals(onProgress, playerRef, event);
|
|
81
74
|
}
|
|
82
75
|
};
|
|
83
76
|
const initializeYoutubePlayer = event => {
|
|
@@ -89,12 +82,11 @@ const WebVideo = /*#__PURE__*/_react.default.forwardRef((_ref, ref) => {
|
|
|
89
82
|
event.target.setVolume(defaultVolume);
|
|
90
83
|
event.target.playVideo(); // This plays the video after passing the splash screen on mobile.
|
|
91
84
|
};
|
|
92
|
-
|
|
93
85
|
const onEndVideoCallback = event => {
|
|
94
86
|
onEnd(event);
|
|
95
87
|
videoStateData.current.requestAnimationIds.forEach(id => cancelAnimationFrame(id));
|
|
96
88
|
videoStateData.current.requestAnimationIds = [];
|
|
97
|
-
videoStateData.current.state =
|
|
89
|
+
videoStateData.current.state = YoutubePlayerState.ENDED;
|
|
98
90
|
if (onProgress) {
|
|
99
91
|
onProgress(event, 100);
|
|
100
92
|
}
|
|
@@ -102,16 +94,16 @@ const WebVideo = /*#__PURE__*/_react.default.forwardRef((_ref, ref) => {
|
|
|
102
94
|
const onPauseVideoCallback = event => {
|
|
103
95
|
videoStateData.current.requestAnimationIds.forEach(id => cancelAnimationFrame(id));
|
|
104
96
|
onPause(event);
|
|
105
|
-
videoStateData.current.state =
|
|
97
|
+
videoStateData.current.state = YoutubePlayerState.PAUSED;
|
|
106
98
|
videoStateData.current.requestAnimationIds = [];
|
|
107
99
|
};
|
|
108
|
-
return /*#__PURE__*/(
|
|
100
|
+
return /*#__PURE__*/_jsx(StyledPlayerContainer, {
|
|
109
101
|
ref: ref,
|
|
110
102
|
"data-testid": "web-video-container",
|
|
111
103
|
...selectProps(rest),
|
|
112
|
-
children: /*#__PURE__*/(
|
|
104
|
+
children: /*#__PURE__*/_jsx(AspectLimiter, {
|
|
113
105
|
aspectRatio: aspectRatio,
|
|
114
|
-
children: started ? /*#__PURE__*/(
|
|
106
|
+
children: started ? /*#__PURE__*/_jsx(StyledYoutubePlayer, {
|
|
115
107
|
videoId: videoId,
|
|
116
108
|
opts: {
|
|
117
109
|
width: '100%',
|
|
@@ -127,7 +119,7 @@ const WebVideo = /*#__PURE__*/_react.default.forwardRef((_ref, ref) => {
|
|
|
127
119
|
onPlay: onPlayCallback,
|
|
128
120
|
onPause: onPauseVideoCallback,
|
|
129
121
|
onEnd: onEndVideoCallback
|
|
130
|
-
}) : /*#__PURE__*/(
|
|
122
|
+
}) : /*#__PURE__*/_jsx(VideoSplash, {
|
|
131
123
|
poster: posterSrc || `https://img.youtube.com/vi/${videoId}/maxresdefault.jpg`,
|
|
132
124
|
videoLength: videoLength,
|
|
133
125
|
copy: copy,
|
|
@@ -139,62 +131,60 @@ const WebVideo = /*#__PURE__*/_react.default.forwardRef((_ref, ref) => {
|
|
|
139
131
|
});
|
|
140
132
|
});
|
|
141
133
|
WebVideo.displayName = 'WebVideo';
|
|
142
|
-
const VideoProps = {
|
|
134
|
+
export const VideoProps = {
|
|
143
135
|
...selectedSystemPropTypes,
|
|
144
136
|
/**
|
|
145
137
|
* The video's ID, typically available via the video's URL.
|
|
146
138
|
*/
|
|
147
|
-
videoId:
|
|
139
|
+
videoId: PropTypes.string.isRequired,
|
|
148
140
|
/**
|
|
149
141
|
* The aspect ratio of the player.
|
|
150
142
|
*/
|
|
151
|
-
aspectRatio:
|
|
143
|
+
aspectRatio: PropTypes.oneOf(['16:9', '4:3', '1:1']),
|
|
152
144
|
/**
|
|
153
145
|
* A path of the image that will be displayed on the video's splash screen. If this is undefined, it will pull an image from the defined web video if available.
|
|
154
146
|
*/
|
|
155
|
-
posterSrc:
|
|
147
|
+
posterSrc: PropTypes.string,
|
|
156
148
|
/**
|
|
157
149
|
* The video's default volume, defined from 1 to 100. Please use the `beginMuted` prop to have the video start silenced.
|
|
158
150
|
*/
|
|
159
|
-
defaultVolume:
|
|
151
|
+
defaultVolume: PropTypes.number,
|
|
160
152
|
/**
|
|
161
153
|
* Defines if the video should start muted.
|
|
162
154
|
*/
|
|
163
|
-
beginMuted:
|
|
155
|
+
beginMuted: PropTypes.bool,
|
|
164
156
|
/**
|
|
165
157
|
* The video's length, which will be displayed on the splash screen. This is defined in seconds.
|
|
166
158
|
*/
|
|
167
|
-
videoLength:
|
|
159
|
+
videoLength: PropTypes.number.isRequired,
|
|
168
160
|
/**
|
|
169
161
|
* The splash screen UI's language as an ISO language code. It currently supports English and French.
|
|
170
162
|
*/
|
|
171
|
-
copy:
|
|
163
|
+
copy: PropTypes.oneOf(['en', 'fr']),
|
|
172
164
|
/**
|
|
173
165
|
* A function to be run when the play button is pressed on the video splash screen and the video is ready to play.
|
|
174
166
|
*/
|
|
175
|
-
onStart:
|
|
167
|
+
onStart: PropTypes.func,
|
|
176
168
|
/**
|
|
177
169
|
* A function to be run when the video is played.
|
|
178
170
|
*/
|
|
179
|
-
onPlay:
|
|
171
|
+
onPlay: PropTypes.func,
|
|
180
172
|
/**
|
|
181
173
|
* A function to be run when the video is paused.
|
|
182
174
|
*/
|
|
183
|
-
onPause:
|
|
175
|
+
onPause: PropTypes.func,
|
|
184
176
|
/**
|
|
185
177
|
* A function to be run when the video ends.
|
|
186
178
|
*/
|
|
187
|
-
onEnd:
|
|
179
|
+
onEnd: PropTypes.func,
|
|
188
180
|
/**
|
|
189
181
|
* A function to be run when the video resumes.
|
|
190
182
|
*/
|
|
191
|
-
onResume:
|
|
183
|
+
onResume: PropTypes.func,
|
|
192
184
|
/**
|
|
193
185
|
* A function to be run when the video progresses. This function will be run at 10%, 25%, 50%, 75% and 100%.
|
|
194
186
|
*/
|
|
195
|
-
onProgress:
|
|
187
|
+
onProgress: PropTypes.func
|
|
196
188
|
};
|
|
197
|
-
exports.VideoProps = VideoProps;
|
|
198
189
|
WebVideo.propTypes = VideoProps;
|
|
199
|
-
|
|
200
|
-
exports.default = _default;
|
|
190
|
+
export default WebVideo;
|
package/lib/WebVideo/index.js
CHANGED
|
@@ -1,10 +1,2 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.default = void 0;
|
|
7
|
-
var _WebVideo = _interopRequireDefault(require("./WebVideo"));
|
|
8
|
-
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
9
|
-
var _default = _WebVideo.default;
|
|
10
|
-
exports.default = _default;
|
|
1
|
+
import WebVideo from './WebVideo';
|
|
2
|
+
export default WebVideo;
|
|
@@ -1,9 +1,3 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.triggerInProgressVideoIntervals = exports.YoutubePlayerState = void 0;
|
|
7
1
|
/**
|
|
8
2
|
* Fires analytics events for inProgress analytics
|
|
9
3
|
* @param {current progress} progress
|
|
@@ -16,7 +10,7 @@ const fireVideoProgressEvents = (progress, onProgress, event) => {
|
|
|
16
10
|
onProgress(event, progress);
|
|
17
11
|
}
|
|
18
12
|
};
|
|
19
|
-
const YoutubePlayerState = {
|
|
13
|
+
export const YoutubePlayerState = {
|
|
20
14
|
UNSTARTED: -1,
|
|
21
15
|
ENDED: 0,
|
|
22
16
|
PLAYING: 1,
|
|
@@ -24,7 +18,6 @@ const YoutubePlayerState = {
|
|
|
24
18
|
BUFFERING: 3,
|
|
25
19
|
CUED: 5
|
|
26
20
|
};
|
|
27
|
-
exports.YoutubePlayerState = YoutubePlayerState;
|
|
28
21
|
const PERCENTAGE_MULTIPLIER = 100;
|
|
29
22
|
/**
|
|
30
23
|
* Run an interval to check the progress of the video and fire events at 10%, 25%, 50% and 75%
|
|
@@ -32,7 +25,7 @@ const PERCENTAGE_MULTIPLIER = 100;
|
|
|
32
25
|
* @param {player reference} playerRef
|
|
33
26
|
* @param {YouTube video event} event
|
|
34
27
|
*/
|
|
35
|
-
const triggerInProgressVideoIntervals = (onProgress, playerRef, event) => {
|
|
28
|
+
export const triggerInProgressVideoIntervals = (onProgress, playerRef, event) => {
|
|
36
29
|
const duration = playerRef.current.getDuration();
|
|
37
30
|
let lastProgress = null;
|
|
38
31
|
const requestAnimationFrameIds = [];
|
|
@@ -54,5 +47,4 @@ const triggerInProgressVideoIntervals = (onProgress, playerRef, event) => {
|
|
|
54
47
|
// Start a new animation frame
|
|
55
48
|
requestAnimationFrameIds.push(requestAnimationFrame(frame));
|
|
56
49
|
return requestAnimationFrameIds;
|
|
57
|
-
};
|
|
58
|
-
exports.triggerInProgressVideoIntervals = triggerInProgressVideoIntervals;
|
|
50
|
+
};
|