@telus-uds/components-web 2.44.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 +13 -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 +94 -103
- 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 +1 -2
- 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 -519
- 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,158 +0,0 @@
|
|
|
1
|
-
var _withLinkRouter$propT, _withLinkRouter$propT2;
|
|
2
|
-
import React from 'react';
|
|
3
|
-
import PropTypes from 'prop-types';
|
|
4
|
-
import { ChevronLink, selectSystemProps, useThemeTokens, Typography, withLinkRouter, Spacer, useViewport, getTokensPropType } from '@telus-uds/components-base';
|
|
5
|
-
import styled, { keyframes, css } from 'styled-components';
|
|
6
|
-
import { htmlAttrs } from '../utils';
|
|
7
|
-
import { jsx as _jsx } from "react/jsx-runtime";
|
|
8
|
-
import { jsxs as _jsxs } from "react/jsx-runtime";
|
|
9
|
-
const [selectProps, selectedSystemPropTypes] = selectSystemProps([htmlAttrs]);
|
|
10
|
-
const transform = property => (from, to) => keyframes(["from{", ":", ";}to{", ":", ";}"], property, from, property, to);
|
|
11
|
-
const slideDown = property => function (from, to) {
|
|
12
|
-
let end = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : to;
|
|
13
|
-
return keyframes(["0%{", ":", ";}99%{", ":", ";}100%{", ":", ";}"], property, from, property, to, property, end);
|
|
14
|
-
};
|
|
15
|
-
const animation = props => css(["", " 1s ease-in-out 2s forwards,", " 1s ease-in-out 2s forwards,", " 1s ease-in-out 2s forwards,", " 1s ease-in-out 3.2s forwards;& *{animation:", " 1s ease-in-out 3s forwards;}& > a div{animation:", " 1s ease-in-out 3s forwards;}& > a svg{animation:", " 1s ease-in-out 3s forwards;}& > a div{animation:", " 1s ease-in-out 3s forwards;}"], slideDown('height')(`${props.animationHeightBefore}px`, `${props.animationHeightAfter}px`, 'auto'), transform('padding-bottom')(`${props.animationPaddingBottomBefore}px`, `${props.animationPaddingBottomAfter}px`), transform('padding-top')(`${props.animationPaddingTopBefore}px`, `${props.animationPaddingTopAfter}px`), transform('background')(props.animationBackgroundColorBefore, props.animationBackgroundColorAfter), transform('color')(props.animationColorBefore, props.animationColorAfter), transform('color')(props.animationDivColorBefore, props.animationDivColorAfter), transform('fill')(props.animationFillColorBefore, props.animationFillColorAfter), transform('color')(props.animationFillColorBefore, props.animationFillColorAfter));
|
|
16
|
-
const ToastContainer = /*#__PURE__*/styled.div.withConfig({
|
|
17
|
-
displayName: "Toast__ToastContainer",
|
|
18
|
-
componentId: "components-web__sc-p78jdh-0"
|
|
19
|
-
})(["display:flex;justify-content:center;align-items:center;flex-wrap:wrap;padding-left:", "px;padding-right:", "px;background:", ";gap:", ";height:0;overflow:hidden;animation:", ";"], _ref => {
|
|
20
|
-
let {
|
|
21
|
-
padding
|
|
22
|
-
} = _ref;
|
|
23
|
-
return padding;
|
|
24
|
-
}, _ref2 => {
|
|
25
|
-
let {
|
|
26
|
-
padding
|
|
27
|
-
} = _ref2;
|
|
28
|
-
return padding;
|
|
29
|
-
}, _ref3 => {
|
|
30
|
-
let {
|
|
31
|
-
containerBackgroundColor
|
|
32
|
-
} = _ref3;
|
|
33
|
-
return containerBackgroundColor;
|
|
34
|
-
}, _ref4 => {
|
|
35
|
-
let {
|
|
36
|
-
containerGap
|
|
37
|
-
} = _ref4;
|
|
38
|
-
return containerGap;
|
|
39
|
-
}, animation);
|
|
40
|
-
const Toast = /*#__PURE__*/React.forwardRef((_ref5, ref) => {
|
|
41
|
-
let {
|
|
42
|
-
toast,
|
|
43
|
-
copy,
|
|
44
|
-
headline,
|
|
45
|
-
link,
|
|
46
|
-
tokens,
|
|
47
|
-
variant = {},
|
|
48
|
-
...rest
|
|
49
|
-
} = _ref5;
|
|
50
|
-
// viewport hook added to work adjust the padding to different sizes
|
|
51
|
-
const viewport = useViewport();
|
|
52
|
-
const {
|
|
53
|
-
containerBackgroundColor,
|
|
54
|
-
containerGap,
|
|
55
|
-
animationHeightBefore,
|
|
56
|
-
animationHeightAfter,
|
|
57
|
-
animationPaddingBottomBefore,
|
|
58
|
-
animationPaddingBottomAfter,
|
|
59
|
-
animationPaddingTopBefore,
|
|
60
|
-
animationPaddingTopAfter,
|
|
61
|
-
animationBackgroundColorBefore,
|
|
62
|
-
animationBackgroundColorAfter,
|
|
63
|
-
animationColorBefore,
|
|
64
|
-
animationColorAfter,
|
|
65
|
-
chevronlinkFontWeight,
|
|
66
|
-
...extraTokens
|
|
67
|
-
} = useThemeTokens('Toast', tokens, variant, {
|
|
68
|
-
viewport
|
|
69
|
-
});
|
|
70
|
-
|
|
71
|
-
// inherit ChevronLink tokens for animation colors
|
|
72
|
-
const {
|
|
73
|
-
color: chevronDefaultColor
|
|
74
|
-
} = useThemeTokens('ChevronLink', {}, {});
|
|
75
|
-
const {
|
|
76
|
-
color: chevronInverseColor
|
|
77
|
-
} = useThemeTokens('ChevronLink', {}, {
|
|
78
|
-
inverse: true
|
|
79
|
-
});
|
|
80
|
-
if (!toast) {
|
|
81
|
-
return null;
|
|
82
|
-
}
|
|
83
|
-
return /*#__PURE__*/_jsxs(ToastContainer, {
|
|
84
|
-
containerBackgroundColor: containerBackgroundColor,
|
|
85
|
-
containerGap: containerGap,
|
|
86
|
-
animationHeightBefore: animationHeightBefore,
|
|
87
|
-
animationHeightAfter: animationHeightAfter,
|
|
88
|
-
animationPaddingBottomBefore: animationPaddingBottomBefore,
|
|
89
|
-
animationPaddingBottomAfter: animationPaddingBottomAfter,
|
|
90
|
-
animationPaddingTopBefore: animationPaddingTopBefore,
|
|
91
|
-
animationPaddingTopAfter: animationPaddingTopAfter,
|
|
92
|
-
animationBackgroundColorBefore: animationBackgroundColorBefore,
|
|
93
|
-
animationBackgroundColorAfter: animationBackgroundColorAfter,
|
|
94
|
-
animationColorBefore: animationColorBefore,
|
|
95
|
-
animationColorAfter: animationColorAfter,
|
|
96
|
-
animationFillColorBefore: chevronInverseColor,
|
|
97
|
-
animationFillColorAfter: chevronDefaultColor,
|
|
98
|
-
ref: ref,
|
|
99
|
-
...extraTokens,
|
|
100
|
-
...selectProps(rest),
|
|
101
|
-
children: [headline && /*#__PURE__*/_jsx(Typography, {
|
|
102
|
-
variant: {
|
|
103
|
-
bold: true,
|
|
104
|
-
inverse: true
|
|
105
|
-
},
|
|
106
|
-
children: headline
|
|
107
|
-
}), /*#__PURE__*/_jsx(Spacer, {
|
|
108
|
-
space: 2,
|
|
109
|
-
direction: "row"
|
|
110
|
-
}), /*#__PURE__*/_jsx(Typography, {
|
|
111
|
-
variant: {
|
|
112
|
-
inverse: true
|
|
113
|
-
},
|
|
114
|
-
children: copy
|
|
115
|
-
}), /*#__PURE__*/_jsx(Spacer, {
|
|
116
|
-
space: 2,
|
|
117
|
-
direction: "row"
|
|
118
|
-
}), link && /*#__PURE__*/_jsx(ChevronLink, {
|
|
119
|
-
variant: {
|
|
120
|
-
inverse: true
|
|
121
|
-
},
|
|
122
|
-
tokens: {
|
|
123
|
-
blockFontWeight: chevronlinkFontWeight
|
|
124
|
-
},
|
|
125
|
-
href: link.href,
|
|
126
|
-
LinkRouter: link.LinkRouter,
|
|
127
|
-
linkRouterProps: link.linkRouterProps,
|
|
128
|
-
children: link.text
|
|
129
|
-
})]
|
|
130
|
-
});
|
|
131
|
-
});
|
|
132
|
-
Toast.displayName = 'Toast';
|
|
133
|
-
Toast.propTypes = {
|
|
134
|
-
...selectedSystemPropTypes,
|
|
135
|
-
tokens: getTokensPropType('Toast'),
|
|
136
|
-
/**
|
|
137
|
-
* If true, the toast will be displayed
|
|
138
|
-
*/
|
|
139
|
-
toast: PropTypes.bool,
|
|
140
|
-
/**
|
|
141
|
-
* The copy to display in the toast
|
|
142
|
-
*/
|
|
143
|
-
copy: PropTypes.string.isRequired,
|
|
144
|
-
/**
|
|
145
|
-
* The headline to display in the toast (before copy)
|
|
146
|
-
*/
|
|
147
|
-
headline: PropTypes.string,
|
|
148
|
-
/**
|
|
149
|
-
* The link to display in the toast (after copy)
|
|
150
|
-
*/
|
|
151
|
-
link: PropTypes.shape({
|
|
152
|
-
href: PropTypes.string.isRequired,
|
|
153
|
-
text: PropTypes.string.isRequired,
|
|
154
|
-
LinkRouter: (_withLinkRouter$propT = withLinkRouter.propTypes) === null || _withLinkRouter$propT === void 0 ? void 0 : _withLinkRouter$propT.LinkRouter,
|
|
155
|
-
linkRouterProps: (_withLinkRouter$propT2 = withLinkRouter.propTypes) === null || _withLinkRouter$propT2 === void 0 ? void 0 : _withLinkRouter$propT2.linkRouterProps
|
|
156
|
-
})
|
|
157
|
-
};
|
|
158
|
-
export default Toast;
|
|
@@ -1,288 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import PropTypes from 'prop-types';
|
|
3
|
-
import styled from 'styled-components';
|
|
4
|
-
import { StackView, useThemeTokens, selectSystemProps, Icon, useViewport } from '@telus-uds/components-base';
|
|
5
|
-
import VideoProgressBar from './Controls/VideoProgressBar/VideoProgressBar';
|
|
6
|
-
import VolumeSlider from './Controls/VolumeSlider/VolumeSlider';
|
|
7
|
-
import VideoButton from './Controls/VideoButton/VideoButton';
|
|
8
|
-
import VideoMenu from './Controls/VideoMenu/VideoMenu';
|
|
9
|
-
import videoText from '../videoText';
|
|
10
|
-
import { htmlAttrs } from '../../utils';
|
|
11
|
-
import { jsx as _jsx } from "react/jsx-runtime";
|
|
12
|
-
import { jsxs as _jsxs } from "react/jsx-runtime";
|
|
13
|
-
const [selectProps, selectedSystemPropTypes] = selectSystemProps([htmlAttrs]);
|
|
14
|
-
const getIcon = icon => /*#__PURE__*/_jsx(Icon, {
|
|
15
|
-
icon: icon
|
|
16
|
-
});
|
|
17
|
-
const ControlBarContainer = /*#__PURE__*/styled.div.withConfig({
|
|
18
|
-
displayName: "ControlBar__ControlBarContainer",
|
|
19
|
-
componentId: "components-web__sc-13y61ky-0"
|
|
20
|
-
})(_ref => {
|
|
21
|
-
let {
|
|
22
|
-
isHidden,
|
|
23
|
-
isMobile
|
|
24
|
-
} = _ref;
|
|
25
|
-
return {
|
|
26
|
-
width: '100%',
|
|
27
|
-
position: 'relative',
|
|
28
|
-
transition: 'opacity 0.4s',
|
|
29
|
-
opacity: isHidden ? 0 : 1,
|
|
30
|
-
display: isMobile ? 'none' : undefined
|
|
31
|
-
};
|
|
32
|
-
});
|
|
33
|
-
const StyledControlBar = /*#__PURE__*/styled.div.withConfig({
|
|
34
|
-
displayName: "ControlBar__StyledControlBar",
|
|
35
|
-
componentId: "components-web__sc-13y61ky-1"
|
|
36
|
-
})(_ref2 => {
|
|
37
|
-
let {
|
|
38
|
-
padding,
|
|
39
|
-
height
|
|
40
|
-
} = _ref2;
|
|
41
|
-
return {
|
|
42
|
-
boxSizing: 'border-box',
|
|
43
|
-
position: 'absolute',
|
|
44
|
-
width: '100%',
|
|
45
|
-
height,
|
|
46
|
-
padding,
|
|
47
|
-
bottom: 0,
|
|
48
|
-
backgroundColor: 'rgba(42, 44, 46, 0.85)',
|
|
49
|
-
// TODO: replace with opaque greyThunder
|
|
50
|
-
margin: 'auto',
|
|
51
|
-
display: 'flex',
|
|
52
|
-
justifyContent: 'space-between',
|
|
53
|
-
zIndex: 9
|
|
54
|
-
};
|
|
55
|
-
});
|
|
56
|
-
const VideoProgressBarContainer = /*#__PURE__*/styled.div.withConfig({
|
|
57
|
-
displayName: "ControlBar__VideoProgressBarContainer",
|
|
58
|
-
componentId: "components-web__sc-13y61ky-2"
|
|
59
|
-
})({
|
|
60
|
-
display: 'flex',
|
|
61
|
-
flexGrow: 1
|
|
62
|
-
});
|
|
63
|
-
const MenuContainer = /*#__PURE__*/styled.div.withConfig({
|
|
64
|
-
displayName: "ControlBar__MenuContainer",
|
|
65
|
-
componentId: "components-web__sc-13y61ky-3"
|
|
66
|
-
})(_ref3 => {
|
|
67
|
-
let {
|
|
68
|
-
isOpen,
|
|
69
|
-
menuBottom,
|
|
70
|
-
menuRight,
|
|
71
|
-
menuMarginLeft
|
|
72
|
-
} = _ref3;
|
|
73
|
-
return {
|
|
74
|
-
position: 'absolute',
|
|
75
|
-
bottom: menuBottom,
|
|
76
|
-
right: menuRight,
|
|
77
|
-
display: isOpen ? 'block' : 'none',
|
|
78
|
-
marginLeft: menuMarginLeft
|
|
79
|
-
};
|
|
80
|
-
});
|
|
81
|
-
const ControlBar = _ref4 => {
|
|
82
|
-
let {
|
|
83
|
-
videoPlayer,
|
|
84
|
-
videoPlayerContainer,
|
|
85
|
-
sources,
|
|
86
|
-
tracks,
|
|
87
|
-
videoPlaying,
|
|
88
|
-
videoUnplayed,
|
|
89
|
-
videoBufferEnd,
|
|
90
|
-
isHidden = false,
|
|
91
|
-
videoLength,
|
|
92
|
-
videoCurrentTime,
|
|
93
|
-
videoCurrentVolume,
|
|
94
|
-
videoIsMuted,
|
|
95
|
-
setVolume,
|
|
96
|
-
isMobile,
|
|
97
|
-
tracksAvailable,
|
|
98
|
-
togglePlayPause,
|
|
99
|
-
setSeek,
|
|
100
|
-
toggleMute,
|
|
101
|
-
toggleFullscreen,
|
|
102
|
-
videoIsFullscreen,
|
|
103
|
-
setTextTracks,
|
|
104
|
-
selectedTextTrack,
|
|
105
|
-
resetInactivityTimer,
|
|
106
|
-
videoQuality,
|
|
107
|
-
setVideoQuality,
|
|
108
|
-
captionsMenuOpen,
|
|
109
|
-
setCaptionsMenuOpen,
|
|
110
|
-
qualityMenuOpen,
|
|
111
|
-
setQualityMenuOpen,
|
|
112
|
-
clearInactivityTimer,
|
|
113
|
-
copy,
|
|
114
|
-
compactModeThreshold,
|
|
115
|
-
videoPlayerWidth,
|
|
116
|
-
tokens,
|
|
117
|
-
variant,
|
|
118
|
-
...rest
|
|
119
|
-
} = _ref4;
|
|
120
|
-
const viewport = useViewport();
|
|
121
|
-
const {
|
|
122
|
-
paddingTop,
|
|
123
|
-
paddingBottom,
|
|
124
|
-
paddingLeft,
|
|
125
|
-
paddingRight,
|
|
126
|
-
menuBottom,
|
|
127
|
-
menuRight,
|
|
128
|
-
menuMarginLeft,
|
|
129
|
-
captionsIcon,
|
|
130
|
-
settingsIcon,
|
|
131
|
-
minimizeIcon,
|
|
132
|
-
maximizeIcon,
|
|
133
|
-
height
|
|
134
|
-
} = useThemeTokens('VideoControlBar', tokens, variant, {
|
|
135
|
-
viewport
|
|
136
|
-
});
|
|
137
|
-
const parseVideoQuality = () => {
|
|
138
|
-
return sources.map(source => {
|
|
139
|
-
if (!source.isFallback) {
|
|
140
|
-
return {
|
|
141
|
-
name: source.qualityName,
|
|
142
|
-
value: source.qualityRank
|
|
143
|
-
};
|
|
144
|
-
}
|
|
145
|
-
return {};
|
|
146
|
-
});
|
|
147
|
-
};
|
|
148
|
-
const parseTracks = () => {
|
|
149
|
-
const parsed = tracks.map((track, trackNumber) => {
|
|
150
|
-
return {
|
|
151
|
-
name: videoText[copy][track.language],
|
|
152
|
-
value: trackNumber
|
|
153
|
-
};
|
|
154
|
-
});
|
|
155
|
-
parsed.unshift({
|
|
156
|
-
name: videoText[copy].captionsNone,
|
|
157
|
-
value: -1
|
|
158
|
-
});
|
|
159
|
-
return parsed;
|
|
160
|
-
};
|
|
161
|
-
const menuContainerStyleProps = {
|
|
162
|
-
menuBottom,
|
|
163
|
-
menuRight,
|
|
164
|
-
menuMarginLeft
|
|
165
|
-
};
|
|
166
|
-
return /*#__PURE__*/_jsx(ControlBarContainer, {
|
|
167
|
-
isHidden: isHidden,
|
|
168
|
-
isMobile: isMobile,
|
|
169
|
-
...selectProps(rest),
|
|
170
|
-
children: /*#__PURE__*/_jsxs(StyledControlBar, {
|
|
171
|
-
padding: `${paddingTop}px ${paddingRight}px ${paddingBottom}px ${paddingLeft}px`,
|
|
172
|
-
height: `${height}px`,
|
|
173
|
-
children: [/*#__PURE__*/_jsx(VideoProgressBarContainer, {
|
|
174
|
-
children: /*#__PURE__*/_jsx(VideoProgressBar, {
|
|
175
|
-
copy: copy,
|
|
176
|
-
videoPlayer: videoPlayer,
|
|
177
|
-
playing: videoPlaying,
|
|
178
|
-
videoLength: videoLength,
|
|
179
|
-
videoCurrentTime: videoCurrentTime,
|
|
180
|
-
videoBufferEnd: videoBufferEnd,
|
|
181
|
-
setSeek: setSeek,
|
|
182
|
-
resetInactivityTimer: resetInactivityTimer
|
|
183
|
-
})
|
|
184
|
-
}), /*#__PURE__*/_jsx(VolumeSlider, {
|
|
185
|
-
videoPlayer: videoPlayer,
|
|
186
|
-
videoCurrentVolume: videoCurrentVolume,
|
|
187
|
-
setVolume: setVolume,
|
|
188
|
-
videoIsMuted: videoIsMuted,
|
|
189
|
-
toggleMute: toggleMute,
|
|
190
|
-
resetInactivityTimer: resetInactivityTimer,
|
|
191
|
-
copy: copy,
|
|
192
|
-
compactModeThreshold: compactModeThreshold,
|
|
193
|
-
videoPlayerWidth: videoPlayerWidth,
|
|
194
|
-
disableFocus: videoUnplayed
|
|
195
|
-
}), /*#__PURE__*/_jsxs(StackView, {
|
|
196
|
-
space: 3,
|
|
197
|
-
direction: "row",
|
|
198
|
-
children: [tracksAvailable && /*#__PURE__*/_jsx(VideoButton, {
|
|
199
|
-
disableFocus: videoUnplayed,
|
|
200
|
-
label: videoText[copy].captionsToggle,
|
|
201
|
-
icon: getIcon(captionsIcon),
|
|
202
|
-
onClick: () => {
|
|
203
|
-
setCaptionsMenuOpen(!captionsMenuOpen);
|
|
204
|
-
setQualityMenuOpen(false);
|
|
205
|
-
clearInactivityTimer();
|
|
206
|
-
},
|
|
207
|
-
onFocus: resetInactivityTimer,
|
|
208
|
-
onBlur: resetInactivityTimer
|
|
209
|
-
}), /*#__PURE__*/_jsx(VideoButton, {
|
|
210
|
-
disableFocus: videoUnplayed,
|
|
211
|
-
label: videoText[copy].qualityToggle,
|
|
212
|
-
icon: getIcon(settingsIcon),
|
|
213
|
-
onClick: () => {
|
|
214
|
-
setQualityMenuOpen(!qualityMenuOpen);
|
|
215
|
-
setCaptionsMenuOpen(false);
|
|
216
|
-
clearInactivityTimer();
|
|
217
|
-
},
|
|
218
|
-
onFocus: resetInactivityTimer,
|
|
219
|
-
onBlur: resetInactivityTimer
|
|
220
|
-
}), /*#__PURE__*/_jsx(VideoButton, {
|
|
221
|
-
disableFocus: videoUnplayed,
|
|
222
|
-
label: videoText[copy].fullScreenToggle,
|
|
223
|
-
icon: videoIsFullscreen ? getIcon(minimizeIcon) : getIcon(maximizeIcon),
|
|
224
|
-
onClick: toggleFullscreen,
|
|
225
|
-
onFocus: resetInactivityTimer,
|
|
226
|
-
onBlur: resetInactivityTimer
|
|
227
|
-
})]
|
|
228
|
-
}), captionsMenuOpen && /*#__PURE__*/_jsx(MenuContainer, {
|
|
229
|
-
isOpen: captionsMenuOpen,
|
|
230
|
-
...menuContainerStyleProps,
|
|
231
|
-
children: /*#__PURE__*/_jsx(VideoMenu, {
|
|
232
|
-
menuLabel: videoText[copy].captionsDialogue,
|
|
233
|
-
menuOptions: parseTracks(),
|
|
234
|
-
setSelection: setTextTracks,
|
|
235
|
-
selectedItem: selectedTextTrack,
|
|
236
|
-
copy: copy
|
|
237
|
-
})
|
|
238
|
-
}), qualityMenuOpen && /*#__PURE__*/_jsx(MenuContainer, {
|
|
239
|
-
isOpen: qualityMenuOpen,
|
|
240
|
-
...menuContainerStyleProps,
|
|
241
|
-
children: /*#__PURE__*/_jsx(VideoMenu, {
|
|
242
|
-
menuLabel: videoText[copy].qualityDialogue,
|
|
243
|
-
menuOptions: parseVideoQuality(),
|
|
244
|
-
setSelection: setVideoQuality,
|
|
245
|
-
selectedItem: videoQuality,
|
|
246
|
-
copy: copy
|
|
247
|
-
})
|
|
248
|
-
})]
|
|
249
|
-
})
|
|
250
|
-
});
|
|
251
|
-
};
|
|
252
|
-
ControlBar.propTypes = {
|
|
253
|
-
...selectedSystemPropTypes,
|
|
254
|
-
videoPlayer: PropTypes.object.isRequired,
|
|
255
|
-
videoPlayerContainer: PropTypes.object.isRequired,
|
|
256
|
-
sources: PropTypes.array.isRequired,
|
|
257
|
-
tracks: PropTypes.array,
|
|
258
|
-
videoPlaying: PropTypes.bool.isRequired,
|
|
259
|
-
videoUnplayed: PropTypes.bool.isRequired,
|
|
260
|
-
videoBufferEnd: PropTypes.number.isRequired,
|
|
261
|
-
isHidden: PropTypes.bool,
|
|
262
|
-
videoLength: PropTypes.number.isRequired,
|
|
263
|
-
videoCurrentTime: PropTypes.number.isRequired,
|
|
264
|
-
videoCurrentVolume: PropTypes.number.isRequired,
|
|
265
|
-
videoIsMuted: PropTypes.bool.isRequired,
|
|
266
|
-
setVolume: PropTypes.func.isRequired,
|
|
267
|
-
isMobile: PropTypes.bool.isRequired,
|
|
268
|
-
tracksAvailable: PropTypes.bool.isRequired,
|
|
269
|
-
togglePlayPause: PropTypes.func.isRequired,
|
|
270
|
-
setSeek: PropTypes.func.isRequired,
|
|
271
|
-
toggleMute: PropTypes.func.isRequired,
|
|
272
|
-
toggleFullscreen: PropTypes.func.isRequired,
|
|
273
|
-
videoIsFullscreen: PropTypes.bool.isRequired,
|
|
274
|
-
setTextTracks: PropTypes.func.isRequired,
|
|
275
|
-
selectedTextTrack: PropTypes.number.isRequired,
|
|
276
|
-
resetInactivityTimer: PropTypes.func.isRequired,
|
|
277
|
-
videoQuality: PropTypes.number.isRequired,
|
|
278
|
-
setVideoQuality: PropTypes.func.isRequired,
|
|
279
|
-
captionsMenuOpen: PropTypes.bool.isRequired,
|
|
280
|
-
setCaptionsMenuOpen: PropTypes.func.isRequired,
|
|
281
|
-
qualityMenuOpen: PropTypes.bool.isRequired,
|
|
282
|
-
setQualityMenuOpen: PropTypes.func.isRequired,
|
|
283
|
-
clearInactivityTimer: PropTypes.func.isRequired,
|
|
284
|
-
copy: PropTypes.oneOf(['en', 'fr']).isRequired,
|
|
285
|
-
compactModeThreshold: PropTypes.number.isRequired,
|
|
286
|
-
videoPlayerWidth: PropTypes.number.isRequired
|
|
287
|
-
};
|
|
288
|
-
export default ControlBar;
|
|
@@ -1,70 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import PropTypes from 'prop-types';
|
|
3
|
-
import styled from 'styled-components';
|
|
4
|
-
import { useThemeTokens, selectSystemProps } from '@telus-uds/components-base';
|
|
5
|
-
import { htmlAttrs } from '../../../../utils';
|
|
6
|
-
import { jsxs as _jsxs } from "react/jsx-runtime";
|
|
7
|
-
const [selectProps, selectedSystemPropTypes] = selectSystemProps([htmlAttrs]);
|
|
8
|
-
const StyledButton = /*#__PURE__*/styled.button.withConfig({
|
|
9
|
-
displayName: "VideoButton__StyledButton",
|
|
10
|
-
componentId: "components-web__sc-kfw0tr-0"
|
|
11
|
-
})(_ref => {
|
|
12
|
-
let {
|
|
13
|
-
color
|
|
14
|
-
} = _ref;
|
|
15
|
-
return {
|
|
16
|
-
background: 'none',
|
|
17
|
-
border: 'none',
|
|
18
|
-
padding: 0,
|
|
19
|
-
cursor: 'pointer',
|
|
20
|
-
display: 'inline-flex',
|
|
21
|
-
alignItems: 'stretch',
|
|
22
|
-
'svg path': {
|
|
23
|
-
fill: color
|
|
24
|
-
}
|
|
25
|
-
};
|
|
26
|
-
});
|
|
27
|
-
const VideoButton = _ref2 => {
|
|
28
|
-
let {
|
|
29
|
-
icon,
|
|
30
|
-
label,
|
|
31
|
-
disableFocus,
|
|
32
|
-
children,
|
|
33
|
-
tokens,
|
|
34
|
-
variant,
|
|
35
|
-
...rest
|
|
36
|
-
} = _ref2;
|
|
37
|
-
const {
|
|
38
|
-
color
|
|
39
|
-
} = useThemeTokens('VideoButton', tokens, variant);
|
|
40
|
-
const handleOnKeyDown = event => {
|
|
41
|
-
const key = event.key || event.keyCode;
|
|
42
|
-
|
|
43
|
-
// Disables playing by space bar, as that can be used to click a button
|
|
44
|
-
if (key === ' ' || key === 32) {
|
|
45
|
-
event.stopPropagation();
|
|
46
|
-
}
|
|
47
|
-
};
|
|
48
|
-
const handleClick = event => {
|
|
49
|
-
var _rest$onClick;
|
|
50
|
-
event.preventDefault();
|
|
51
|
-
(_rest$onClick = rest.onClick) === null || _rest$onClick === void 0 ? void 0 : _rest$onClick.call(rest, event);
|
|
52
|
-
};
|
|
53
|
-
return /*#__PURE__*/_jsxs(StyledButton, {
|
|
54
|
-
"aria-label": label,
|
|
55
|
-
onKeyDown: handleOnKeyDown,
|
|
56
|
-
tabIndex: disableFocus ? '-1' : undefined,
|
|
57
|
-
color: color,
|
|
58
|
-
...selectProps(rest),
|
|
59
|
-
onClick: handleClick,
|
|
60
|
-
children: [icon, children]
|
|
61
|
-
});
|
|
62
|
-
};
|
|
63
|
-
VideoButton.propTypes = {
|
|
64
|
-
...selectedSystemPropTypes,
|
|
65
|
-
icon: PropTypes.element.isRequired,
|
|
66
|
-
label: PropTypes.string.isRequired,
|
|
67
|
-
disableFocus: PropTypes.bool.isRequired,
|
|
68
|
-
children: PropTypes.node
|
|
69
|
-
};
|
|
70
|
-
export default VideoButton;
|
|
@@ -1,163 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import PropTypes from 'prop-types';
|
|
3
|
-
import styled from 'styled-components';
|
|
4
|
-
import { StackView, Typography, useThemeTokens, selectSystemProps, Icon } from '@telus-uds/components-base';
|
|
5
|
-
import videoText from '../../../videoText';
|
|
6
|
-
import { htmlAttrs } from '../../../../utils';
|
|
7
|
-
import { jsx as _jsx } from "react/jsx-runtime";
|
|
8
|
-
import { jsxs as _jsxs } from "react/jsx-runtime";
|
|
9
|
-
const [selectProps, selectedSystemPropTypes] = selectSystemProps([htmlAttrs]);
|
|
10
|
-
const MenuContainer = /*#__PURE__*/styled.div.withConfig({
|
|
11
|
-
displayName: "VideoMenu__MenuContainer",
|
|
12
|
-
componentId: "components-web__sc-nllbhw-0"
|
|
13
|
-
})(_ref => {
|
|
14
|
-
let {
|
|
15
|
-
padding,
|
|
16
|
-
background
|
|
17
|
-
} = _ref;
|
|
18
|
-
return {
|
|
19
|
-
width: 114,
|
|
20
|
-
padding,
|
|
21
|
-
backgroundColor: background,
|
|
22
|
-
borderRadius: 5
|
|
23
|
-
};
|
|
24
|
-
});
|
|
25
|
-
const MenuButton = /*#__PURE__*/styled.button.withConfig({
|
|
26
|
-
displayName: "VideoMenu__MenuButton",
|
|
27
|
-
componentId: "components-web__sc-nllbhw-1"
|
|
28
|
-
})({
|
|
29
|
-
background: 'none',
|
|
30
|
-
border: 'none',
|
|
31
|
-
padding: 0,
|
|
32
|
-
width: '100%',
|
|
33
|
-
cursor: 'pointer',
|
|
34
|
-
display: 'flex',
|
|
35
|
-
justifyContent: 'space-between',
|
|
36
|
-
verticalAlign: 'middle'
|
|
37
|
-
});
|
|
38
|
-
const CheckmarkContainer = /*#__PURE__*/styled.div.withConfig({
|
|
39
|
-
displayName: "VideoMenu__CheckmarkContainer",
|
|
40
|
-
componentId: "components-web__sc-nllbhw-2"
|
|
41
|
-
})(_ref2 => {
|
|
42
|
-
let {
|
|
43
|
-
isSelectedItem,
|
|
44
|
-
checkMarkWidth,
|
|
45
|
-
checkMarkHeight,
|
|
46
|
-
checkMarkSelectedColor,
|
|
47
|
-
checkMarkHoverColor,
|
|
48
|
-
checkMarkFocusColor,
|
|
49
|
-
checkMarkUnselectedColor
|
|
50
|
-
} = _ref2;
|
|
51
|
-
return {
|
|
52
|
-
width: checkMarkWidth,
|
|
53
|
-
height: checkMarkHeight,
|
|
54
|
-
marginTop: 2,
|
|
55
|
-
outline: 'none',
|
|
56
|
-
[`${MenuButton} && svg`]: {
|
|
57
|
-
fill: isSelectedItem ? checkMarkSelectedColor : checkMarkUnselectedColor
|
|
58
|
-
},
|
|
59
|
-
[`${MenuButton}:hover && svg`]: {
|
|
60
|
-
fill: isSelectedItem ? checkMarkSelectedColor : checkMarkHoverColor
|
|
61
|
-
},
|
|
62
|
-
[`${MenuButton}:focus && svg`]: {
|
|
63
|
-
fill: isSelectedItem ? checkMarkSelectedColor : checkMarkFocusColor
|
|
64
|
-
}
|
|
65
|
-
};
|
|
66
|
-
});
|
|
67
|
-
const VideoMenu = _ref3 => {
|
|
68
|
-
let {
|
|
69
|
-
menuLabel,
|
|
70
|
-
menuOptions,
|
|
71
|
-
setSelection,
|
|
72
|
-
selectedItem,
|
|
73
|
-
copy,
|
|
74
|
-
tokens,
|
|
75
|
-
variant,
|
|
76
|
-
...rest
|
|
77
|
-
} = _ref3;
|
|
78
|
-
const {
|
|
79
|
-
padding,
|
|
80
|
-
background,
|
|
81
|
-
checkMarkWidth,
|
|
82
|
-
checkMarkHeight,
|
|
83
|
-
checkMarkSelectedColor,
|
|
84
|
-
checkMarkHoverColor,
|
|
85
|
-
checkMarkFocusColor,
|
|
86
|
-
checkMarkUnselectedColor,
|
|
87
|
-
checkMarkIcon
|
|
88
|
-
} = useThemeTokens('VideoMenu', tokens, variant);
|
|
89
|
-
const getMenuItems = () => {
|
|
90
|
-
return menuOptions.map(option => {
|
|
91
|
-
if (option.name) {
|
|
92
|
-
return /*#__PURE__*/_jsxs(MenuButton, {
|
|
93
|
-
"aria-haspopup": "true",
|
|
94
|
-
role: "menuitem",
|
|
95
|
-
"aria-label": `${option.name} ${menuLabel}. ${selectedItem === option.value ? videoText[copy].itemSelected : videoText[copy].itemUnselected}`,
|
|
96
|
-
selectedItem: selectedItem,
|
|
97
|
-
itemValue: option.value,
|
|
98
|
-
onClick: () => {
|
|
99
|
-
if (selectedItem !== option.value) {
|
|
100
|
-
setSelection(option.value);
|
|
101
|
-
}
|
|
102
|
-
},
|
|
103
|
-
children: [/*#__PURE__*/_jsx(Typography, {
|
|
104
|
-
variant: {
|
|
105
|
-
bold: true,
|
|
106
|
-
inverse: true
|
|
107
|
-
},
|
|
108
|
-
children: option.name
|
|
109
|
-
}), /*#__PURE__*/_jsx(CheckmarkContainer, {
|
|
110
|
-
isSelectedItem: option.value === selectedItem,
|
|
111
|
-
checkMarkWidth: checkMarkWidth,
|
|
112
|
-
checkMarkHeight: checkMarkHeight,
|
|
113
|
-
checkMarkSelectedColor: checkMarkSelectedColor,
|
|
114
|
-
checkMarkHoverColor: checkMarkHoverColor,
|
|
115
|
-
checkMarkFocusColor: checkMarkFocusColor,
|
|
116
|
-
checkMarkUnselectedColor: checkMarkUnselectedColor,
|
|
117
|
-
children: /*#__PURE__*/_jsx(Icon, {
|
|
118
|
-
icon: checkMarkIcon
|
|
119
|
-
})
|
|
120
|
-
})]
|
|
121
|
-
}, option.value);
|
|
122
|
-
}
|
|
123
|
-
return null;
|
|
124
|
-
});
|
|
125
|
-
};
|
|
126
|
-
const handleOnKeyDown = event => {
|
|
127
|
-
const key = event.key || event.keyCode;
|
|
128
|
-
|
|
129
|
-
// Disables playing by space bar, as that can be used to click a button
|
|
130
|
-
if (key === ' ' || key === 32) {
|
|
131
|
-
event.stopPropagation();
|
|
132
|
-
}
|
|
133
|
-
};
|
|
134
|
-
return /*#__PURE__*/_jsx(MenuContainer, {
|
|
135
|
-
onKeyDown: handleOnKeyDown,
|
|
136
|
-
padding: padding,
|
|
137
|
-
background: background,
|
|
138
|
-
...selectProps(rest),
|
|
139
|
-
children: /*#__PURE__*/_jsxs(StackView, {
|
|
140
|
-
space: 2,
|
|
141
|
-
divider: true,
|
|
142
|
-
children: [/*#__PURE__*/_jsx(Typography, {
|
|
143
|
-
variant: {
|
|
144
|
-
bold: true,
|
|
145
|
-
inverse: true
|
|
146
|
-
},
|
|
147
|
-
children: menuLabel
|
|
148
|
-
}), /*#__PURE__*/_jsx("div", {
|
|
149
|
-
role: "menu",
|
|
150
|
-
children: getMenuItems()
|
|
151
|
-
})]
|
|
152
|
-
})
|
|
153
|
-
});
|
|
154
|
-
};
|
|
155
|
-
VideoMenu.propTypes = {
|
|
156
|
-
...selectedSystemPropTypes,
|
|
157
|
-
menuLabel: PropTypes.string.isRequired,
|
|
158
|
-
menuOptions: PropTypes.array.isRequired,
|
|
159
|
-
setSelection: PropTypes.func.isRequired,
|
|
160
|
-
selectedItem: PropTypes.oneOfType([PropTypes.number, PropTypes.string]).isRequired,
|
|
161
|
-
copy: PropTypes.oneOf(['en', 'fr']).isRequired
|
|
162
|
-
};
|
|
163
|
-
export default VideoMenu;
|