@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,55 +0,0 @@
|
|
|
1
|
-
const videoText = {
|
|
2
|
-
en: {
|
|
3
|
-
videoPlayer: 'Press the space bar or K to toggle play and pause. Use the left and right arrow keys or the comma and period keys to scrub through the video. Use the up and down arrow keys, the dash and equal keys, or the add and subtract number pad keys to increase and decrease volume. Press M to toggle mute. Press F to toggle fullscreen. Press escape to exit instructions and return to video.',
|
|
4
|
-
videoSelected: 'Video selected. Press Q to listen to controls.',
|
|
5
|
-
videoSelectedSimple: 'Video selected. Press the space bar or K to toggle play and pause.',
|
|
6
|
-
mute: 'Mute',
|
|
7
|
-
unmute: 'Unmute',
|
|
8
|
-
watch: 'Watch the video',
|
|
9
|
-
replay: 'Replay the video',
|
|
10
|
-
itemSelected: 'This is the currently selected option.',
|
|
11
|
-
itemUnselected: 'Select to switch to this option.',
|
|
12
|
-
captionsToggle: 'Select captions',
|
|
13
|
-
captionsDialogue: 'Captions',
|
|
14
|
-
captionsNone: 'None',
|
|
15
|
-
qualityToggle: 'Change video quality',
|
|
16
|
-
qualityDialogue: 'Quality',
|
|
17
|
-
fullScreenToggle: 'Toggle fullscreen',
|
|
18
|
-
minute: 'minute',
|
|
19
|
-
minutes: 'minutes',
|
|
20
|
-
second: 'second',
|
|
21
|
-
seconds: 'seconds',
|
|
22
|
-
ariaLabel: 'Play video. Video length is {minutes} and {seconds}.',
|
|
23
|
-
volumeSliderLabel: 'Adjust the volume',
|
|
24
|
-
videoProgressBarLabel: 'Progress bar',
|
|
25
|
-
en: 'English',
|
|
26
|
-
fr: 'French'
|
|
27
|
-
},
|
|
28
|
-
fr: {
|
|
29
|
-
videoPlayer: 'Appuyer sur K pour basculer entre lecture et pause. Utiliser les flèches gauche et droite ou les touches virgule et point pour reculer ou faire une avance rapide dans la vidéo. Utiliser les flèches ascendante et descendante, les touches tiret et égal ou les touches plus et moins du clavier numérique pour contrôler le volume. Appuyer sur la touche M pour désactiver le son. Appuyer sur F pour basculer en mode plein écran. Appuyer sur la touche d’échappement pour quitter les instructions et retourner à la vidéo.',
|
|
30
|
-
videoSelected: 'Vidéo sélectionnée. Appuyer sur Q pour écouter les contrôles',
|
|
31
|
-
videoSelectedSimple: 'Vidéo sélectionnée. Appuyer sur K pour basculer entre lecture et pause.',
|
|
32
|
-
mute: 'Désactiver le son',
|
|
33
|
-
unmute: 'Activer le son',
|
|
34
|
-
watch: 'Voir la vidéo',
|
|
35
|
-
replay: 'Relire la vidéo',
|
|
36
|
-
itemSelected: 'Cette option est déjà sélectionnée.',
|
|
37
|
-
itemUnselected: 'Sélectionner pour basculer à cette option.',
|
|
38
|
-
captionsToggle: 'Sélectionner les sous-titres',
|
|
39
|
-
captionsDialogue: 'Sous-titres',
|
|
40
|
-
captionsNone: 'Aucun',
|
|
41
|
-
qualityToggle: 'Modifier la qualité de la vidéo',
|
|
42
|
-
qualityDialogue: 'Qualité',
|
|
43
|
-
fullScreenToggle: 'Basculer en mode plein écran',
|
|
44
|
-
minute: 'minute',
|
|
45
|
-
minutes: 'minutes',
|
|
46
|
-
second: 'seconde',
|
|
47
|
-
seconds: 'secondes',
|
|
48
|
-
ariaLabel: 'Lire la vidéo. La durée de la vidéo est de {minutes} et {seconds}.',
|
|
49
|
-
volumeSliderLabel: 'Réglez le volume',
|
|
50
|
-
videoProgressBarLabel: 'Barre de progression',
|
|
51
|
-
en: 'Anglais',
|
|
52
|
-
fr: 'Français'
|
|
53
|
-
}
|
|
54
|
-
};
|
|
55
|
-
export default videoText;
|
|
@@ -1,190 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import PropTypes from 'prop-types';
|
|
3
|
-
import { viewports } from '@telus-uds/system-constants';
|
|
4
|
-
import { selectSystemProps, StackView, useThemeTokens, useViewport, getTokensPropType } from '@telus-uds/components-base';
|
|
5
|
-
import styled, { css } from 'styled-components';
|
|
6
|
-
import { VideoPropType } from './videoPropType';
|
|
7
|
-
import VideoPickerThumbnail from './VideoPickerThumbnail';
|
|
8
|
-
import VideoPickerPlayer from './VideoPickerPlayer';
|
|
9
|
-
import VideoSlider from './VideoSlider';
|
|
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 framedContainerStyles = _ref => {
|
|
15
|
-
let {
|
|
16
|
-
framedContainerBackgroundColor,
|
|
17
|
-
framedContainerBorderWidth,
|
|
18
|
-
framedContainerBorderColor,
|
|
19
|
-
framedContainerBorderRadius,
|
|
20
|
-
framedMaxHeight
|
|
21
|
-
} = _ref;
|
|
22
|
-
return css(["background-color:", ";border:", "px solid ", ";border-radius:", "px;& > div{max-height:", "px;}"], framedContainerBackgroundColor, framedContainerBorderWidth, framedContainerBorderColor, framedContainerBorderRadius, framedMaxHeight);
|
|
23
|
-
};
|
|
24
|
-
const VideoPickerContainer = /*#__PURE__*/styled.div.withConfig({
|
|
25
|
-
displayName: "VideoPicker__VideoPickerContainer",
|
|
26
|
-
componentId: "components-web__sc-x6lxp0-0"
|
|
27
|
-
})(["", ""], _ref2 => {
|
|
28
|
-
let {
|
|
29
|
-
isFramed,
|
|
30
|
-
...tokens
|
|
31
|
-
} = _ref2;
|
|
32
|
-
return isFramed && framedContainerStyles(tokens);
|
|
33
|
-
});
|
|
34
|
-
const framedPlayerContainerStyles = _ref3 => {
|
|
35
|
-
let {
|
|
36
|
-
framedMaxHeight,
|
|
37
|
-
framedContainerPadding
|
|
38
|
-
} = _ref3;
|
|
39
|
-
return css(["width:66.67%;padding:", "px;max-height:", "px;flex-shrink:0;box-sizing:border-box;"], framedContainerPadding, framedMaxHeight);
|
|
40
|
-
};
|
|
41
|
-
const VideoPlayerContainer = /*#__PURE__*/styled.div.withConfig({
|
|
42
|
-
displayName: "VideoPicker__VideoPlayerContainer",
|
|
43
|
-
componentId: "components-web__sc-x6lxp0-1"
|
|
44
|
-
})(["", " overflow:auto;"], _ref4 => {
|
|
45
|
-
let {
|
|
46
|
-
isFramed,
|
|
47
|
-
...tokens
|
|
48
|
-
} = _ref4;
|
|
49
|
-
return isFramed && framedPlayerContainerStyles(tokens);
|
|
50
|
-
});
|
|
51
|
-
const framedVideoListContainerStyle = /*#__PURE__*/css(["max-height:", "px;overflow:auto;flex-direction:column;"], _ref5 => {
|
|
52
|
-
let {
|
|
53
|
-
framedMaxHeight
|
|
54
|
-
} = _ref5;
|
|
55
|
-
return framedMaxHeight;
|
|
56
|
-
});
|
|
57
|
-
const VideoListContainer = /*#__PURE__*/styled.div.withConfig({
|
|
58
|
-
displayName: "VideoPicker__VideoListContainer",
|
|
59
|
-
componentId: "components-web__sc-x6lxp0-2"
|
|
60
|
-
})(["display:flex;justify-content:flex-start;position:relative;flex-grow:1;flex-direction:column;", ""], props => props.isFramed && framedVideoListContainerStyle);
|
|
61
|
-
const VideoPicker = /*#__PURE__*/React.forwardRef((_ref6, ref) => {
|
|
62
|
-
var _videoList$;
|
|
63
|
-
let {
|
|
64
|
-
videoList = [],
|
|
65
|
-
selectedVideo = (_videoList$ = videoList[0]) === null || _videoList$ === void 0 ? void 0 : _videoList$.videoId,
|
|
66
|
-
frame,
|
|
67
|
-
onStartVideo = () => {},
|
|
68
|
-
onSelectVideo = () => {},
|
|
69
|
-
onPlay = () => {},
|
|
70
|
-
onPause = () => {},
|
|
71
|
-
onProgress = () => {},
|
|
72
|
-
...rest
|
|
73
|
-
} = _ref6;
|
|
74
|
-
const viewport = useViewport();
|
|
75
|
-
const {
|
|
76
|
-
stackViewDividerColor,
|
|
77
|
-
...themeTokens
|
|
78
|
-
} = useThemeTokens('VideoPicker');
|
|
79
|
-
const [currentVideoId, setCurrentVideoId] = React.useState(selectedVideo);
|
|
80
|
-
const videoPlayerRef = React.useRef(null);
|
|
81
|
-
const currentVideo = videoList.find(video => video.videoId === currentVideoId);
|
|
82
|
-
React.useEffect(() => {
|
|
83
|
-
// Update current video if parent changes which video id it passes down
|
|
84
|
-
setCurrentVideoId(selectedVideo);
|
|
85
|
-
}, [selectedVideo]);
|
|
86
|
-
const addVideoEventHandlers = video => {
|
|
87
|
-
if (!video) return {};
|
|
88
|
-
return {
|
|
89
|
-
...video,
|
|
90
|
-
onPlay: video.onPlay || onPlay,
|
|
91
|
-
onPause: video.onPause || onPause,
|
|
92
|
-
onProgress: video.onProgress || onProgress
|
|
93
|
-
};
|
|
94
|
-
};
|
|
95
|
-
|
|
96
|
-
// `frame` variant should only work on larger screens
|
|
97
|
-
const isFramed = frame && [viewports.lg, viewports.xl].includes(viewport);
|
|
98
|
-
const hasSlider = !frame && [viewports.md, viewports.lg, viewports.xl].includes(viewport);
|
|
99
|
-
const listElements = videoList.map((video, index) => /*#__PURE__*/_jsx(VideoPickerThumbnail, {
|
|
100
|
-
video: video,
|
|
101
|
-
videoPlayerRef: videoPlayerRef,
|
|
102
|
-
selectedVideoId: currentVideoId,
|
|
103
|
-
onSelectVideo: current => {
|
|
104
|
-
setCurrentVideoId(current.videoId);
|
|
105
|
-
onSelectVideo(current);
|
|
106
|
-
},
|
|
107
|
-
layout: !hasSlider ? 'horizontal' : 'vertical',
|
|
108
|
-
index: index,
|
|
109
|
-
isFramed: isFramed
|
|
110
|
-
}, video.videoId));
|
|
111
|
-
return /*#__PURE__*/_jsx(VideoPickerContainer, {
|
|
112
|
-
ref: ref,
|
|
113
|
-
isFramed: isFramed,
|
|
114
|
-
...selectProps(rest),
|
|
115
|
-
...themeTokens,
|
|
116
|
-
children: /*#__PURE__*/_jsxs(StackView, {
|
|
117
|
-
divider: isFramed ? {
|
|
118
|
-
tokens: {
|
|
119
|
-
color: stackViewDividerColor
|
|
120
|
-
}
|
|
121
|
-
} : {
|
|
122
|
-
variant: {
|
|
123
|
-
decorative: true
|
|
124
|
-
}
|
|
125
|
-
},
|
|
126
|
-
space: isFramed ? 0 : 4 // everything has internal padding in `frame` variant
|
|
127
|
-
,
|
|
128
|
-
direction: isFramed ? 'row' : 'column',
|
|
129
|
-
children: [/*#__PURE__*/_jsx(VideoPlayerContainer, {
|
|
130
|
-
...themeTokens,
|
|
131
|
-
isFramed: isFramed,
|
|
132
|
-
children: /*#__PURE__*/_jsx(VideoPickerPlayer, {
|
|
133
|
-
video: addVideoEventHandlers(currentVideo, onPlay, onPause, onProgress),
|
|
134
|
-
videoPlayerRef: videoPlayerRef,
|
|
135
|
-
onStartVideo: onStartVideo
|
|
136
|
-
})
|
|
137
|
-
}), hasSlider ? /*#__PURE__*/_jsx(VideoSlider, {
|
|
138
|
-
children: listElements
|
|
139
|
-
}) : /*#__PURE__*/_jsx(VideoListContainer, {
|
|
140
|
-
viewport: viewport,
|
|
141
|
-
"data-testid": "video-list-container",
|
|
142
|
-
isFramed: isFramed,
|
|
143
|
-
children: listElements
|
|
144
|
-
})]
|
|
145
|
-
})
|
|
146
|
-
});
|
|
147
|
-
});
|
|
148
|
-
VideoPicker.displayName = 'VideoPicker';
|
|
149
|
-
VideoPicker.propTypes = {
|
|
150
|
-
...selectedSystemPropTypes,
|
|
151
|
-
tokens: getTokensPropType('VideoPicker'),
|
|
152
|
-
/**
|
|
153
|
-
* Id of the currently selected video (defaults to the first video if not set).
|
|
154
|
-
*/
|
|
155
|
-
selectedVideo: PropTypes.string,
|
|
156
|
-
/**
|
|
157
|
-
* An array of Video objects.
|
|
158
|
-
*/
|
|
159
|
-
videoList: PropTypes.arrayOf(VideoPropType),
|
|
160
|
-
/**
|
|
161
|
-
* Use to display the picker in a container and the playlist as a sidebar (only available for breakpoints LG and larger)
|
|
162
|
-
*/
|
|
163
|
-
frame: PropTypes.bool,
|
|
164
|
-
/**
|
|
165
|
-
* Callback function trigerred when the video player starts playing video.
|
|
166
|
-
* @param {object} video - The video object that is playing.
|
|
167
|
-
*/
|
|
168
|
-
onStartVideo: PropTypes.func,
|
|
169
|
-
/**
|
|
170
|
-
* Callback function trigerred when a video is selected from the thumbnail list.
|
|
171
|
-
* @param {object} video - The video object that is selected.
|
|
172
|
-
*/
|
|
173
|
-
onSelectVideo: PropTypes.func,
|
|
174
|
-
/**
|
|
175
|
-
* Callback function trigerred during progress milestones 10% 25% 50% 75% 100%.
|
|
176
|
-
* @param {object} event - The event object.
|
|
177
|
-
*/
|
|
178
|
-
onProgress: PropTypes.func,
|
|
179
|
-
/**
|
|
180
|
-
* Callback function trigerred when the video player starts playing video.
|
|
181
|
-
* @param {object} event - The event object.
|
|
182
|
-
*/
|
|
183
|
-
onPlay: PropTypes.func,
|
|
184
|
-
/**
|
|
185
|
-
* Callback function trigerred when the video gets paused.
|
|
186
|
-
* @param {object} event - The event object.
|
|
187
|
-
*/
|
|
188
|
-
onPause: PropTypes.func
|
|
189
|
-
};
|
|
190
|
-
export default VideoPicker;
|
|
@@ -1,48 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import { StackView, Typography } from '@telus-uds/components-base';
|
|
3
|
-
import PropTypes from 'prop-types';
|
|
4
|
-
import WebVideo from '../WebVideo/WebVideo';
|
|
5
|
-
import { VideoPropType, RefPropType } from './videoPropType';
|
|
6
|
-
import { jsx as _jsx } from "react/jsx-runtime";
|
|
7
|
-
import { jsxs as _jsxs } from "react/jsx-runtime";
|
|
8
|
-
const VideoPickerPlayer = /*#__PURE__*/React.forwardRef((_ref, ref) => {
|
|
9
|
-
let {
|
|
10
|
-
video = {},
|
|
11
|
-
videoPlayerRef,
|
|
12
|
-
onStartVideo = () => {}
|
|
13
|
-
} = _ref;
|
|
14
|
-
return /*#__PURE__*/_jsxs(StackView, {
|
|
15
|
-
space: 3,
|
|
16
|
-
tokens: {
|
|
17
|
-
flexShrink: 1
|
|
18
|
-
},
|
|
19
|
-
ref: ref,
|
|
20
|
-
children: [/*#__PURE__*/_jsx("div", {
|
|
21
|
-
ref: videoPlayerRef,
|
|
22
|
-
children: video.videoId && /*#__PURE__*/_jsx(WebVideo, {
|
|
23
|
-
...video,
|
|
24
|
-
onStart: () => onStartVideo(video)
|
|
25
|
-
})
|
|
26
|
-
}), /*#__PURE__*/_jsxs(StackView, {
|
|
27
|
-
space: 2,
|
|
28
|
-
children: [/*#__PURE__*/_jsx(Typography, {
|
|
29
|
-
variant: {
|
|
30
|
-
size: 'h3'
|
|
31
|
-
},
|
|
32
|
-
children: video.title
|
|
33
|
-
}), /*#__PURE__*/_jsx(Typography, {
|
|
34
|
-
variant: {
|
|
35
|
-
colour: 'default'
|
|
36
|
-
},
|
|
37
|
-
children: video.description
|
|
38
|
-
})]
|
|
39
|
-
})]
|
|
40
|
-
});
|
|
41
|
-
});
|
|
42
|
-
VideoPickerPlayer.displayName = 'VideoPickerPlayer';
|
|
43
|
-
VideoPickerPlayer.propTypes = {
|
|
44
|
-
video: VideoPropType,
|
|
45
|
-
videoPlayerRef: RefPropType,
|
|
46
|
-
onStartVideo: PropTypes.func
|
|
47
|
-
};
|
|
48
|
-
export default VideoPickerPlayer;
|
|
@@ -1,218 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import Pressable from "react-native-web/dist/exports/Pressable";
|
|
3
|
-
import StyleSheet from "react-native-web/dist/exports/StyleSheet";
|
|
4
|
-
import PropTypes from 'prop-types';
|
|
5
|
-
import { viewports } from '@telus-uds/system-constants';
|
|
6
|
-
import styled from 'styled-components';
|
|
7
|
-
import { StackView, Typography, useViewport, horizontalScrollUtils, useThemeTokensCallback } from '@telus-uds/components-base';
|
|
8
|
-
import { getTimestamp } from '../shared/VideoSplash/helpers';
|
|
9
|
-
import { VideoPropType, RefPropType } from './videoPropType';
|
|
10
|
-
import VideoSplash from '../shared/VideoSplash/VideoSplash';
|
|
11
|
-
import { jsx as _jsx } from "react/jsx-runtime";
|
|
12
|
-
import { jsxs as _jsxs } from "react/jsx-runtime";
|
|
13
|
-
const {
|
|
14
|
-
getItemPositionLayoutHandler,
|
|
15
|
-
itemPositionsPropType
|
|
16
|
-
} = horizontalScrollUtils;
|
|
17
|
-
|
|
18
|
-
// Use a React Native (web) outer container so it can take an onLayout callback, to
|
|
19
|
-
// access position in VideoSlider's UDS HorizontalScroll and update its itemPositions
|
|
20
|
-
const createReactNativeStyles = _ref => {
|
|
21
|
-
let {
|
|
22
|
-
pressablePaddingBottom,
|
|
23
|
-
pressablePaddingVertical,
|
|
24
|
-
pressablePaddingHorizontal,
|
|
25
|
-
pressableBorderTopWidth,
|
|
26
|
-
pressableBorderTopColor
|
|
27
|
-
} = _ref;
|
|
28
|
-
return StyleSheet.create({
|
|
29
|
-
container: {
|
|
30
|
-
cursor: 'pointer'
|
|
31
|
-
},
|
|
32
|
-
horizontal: {
|
|
33
|
-
paddingBottom: pressablePaddingBottom
|
|
34
|
-
},
|
|
35
|
-
framed: {
|
|
36
|
-
paddingVertical: pressablePaddingVertical,
|
|
37
|
-
paddingHorizontal: pressablePaddingHorizontal
|
|
38
|
-
},
|
|
39
|
-
framedLine: {
|
|
40
|
-
borderTopWidth: pressableBorderTopWidth,
|
|
41
|
-
borderTopColor: pressableBorderTopColor
|
|
42
|
-
}
|
|
43
|
-
});
|
|
44
|
-
};
|
|
45
|
-
const ImageContainer = /*#__PURE__*/styled.div.withConfig({
|
|
46
|
-
displayName: "VideoPickerThumbnail__ImageContainer",
|
|
47
|
-
componentId: "components-web__sc-1glxurq-0"
|
|
48
|
-
})(["padding:", ";border:", ";border-radius:", "px;"], props => `${props.outerBorderGap}px`, props => `${props.outerBorderWidth}px solid ${props.outerBorderColor}`, _ref2 => {
|
|
49
|
-
let {
|
|
50
|
-
outerBorderRadius
|
|
51
|
-
} = _ref2;
|
|
52
|
-
return outerBorderRadius;
|
|
53
|
-
});
|
|
54
|
-
const VideoThumbnail = /*#__PURE__*/styled.div.withConfig({
|
|
55
|
-
displayName: "VideoPickerThumbnail__VideoThumbnail",
|
|
56
|
-
componentId: "components-web__sc-1glxurq-1"
|
|
57
|
-
})(["position:relative;width:", ";flex-shrink:0;* button{display:none;}&::before{content:'';display:block;padding-bottom:56.25%;}&::after{content:'';border:", "px solid;border-color:", ";border-radius:", "px;position:absolute;top:0;left:0;right:0;bottom:0;}& > div{border-radius:", "px;}"], props => props.layout === 'vertical' ? '100%' : '144px', _ref3 => {
|
|
58
|
-
let {
|
|
59
|
-
borderWidth
|
|
60
|
-
} = _ref3;
|
|
61
|
-
return borderWidth;
|
|
62
|
-
}, _ref4 => {
|
|
63
|
-
let {
|
|
64
|
-
borderColor
|
|
65
|
-
} = _ref4;
|
|
66
|
-
return borderColor;
|
|
67
|
-
}, _ref5 => {
|
|
68
|
-
let {
|
|
69
|
-
borderRadius
|
|
70
|
-
} = _ref5;
|
|
71
|
-
return borderRadius;
|
|
72
|
-
}, _ref6 => {
|
|
73
|
-
let {
|
|
74
|
-
borderRadius
|
|
75
|
-
} = _ref6;
|
|
76
|
-
return borderRadius;
|
|
77
|
-
});
|
|
78
|
-
const ThumbnailTitleContainer = /*#__PURE__*/styled.div.withConfig({
|
|
79
|
-
displayName: "VideoPickerThumbnail__ThumbnailTitleContainer",
|
|
80
|
-
componentId: "components-web__sc-1glxurq-2"
|
|
81
|
-
})(["display:-webkit-box;-webkit-line-clamp:2;-webkit-box-orient:vertical;overflow:hidden;"]);
|
|
82
|
-
const VideoPickerThumbnail = /*#__PURE__*/React.forwardRef((_ref7, ref) => {
|
|
83
|
-
let {
|
|
84
|
-
videoPlayerRef,
|
|
85
|
-
selectedVideoId,
|
|
86
|
-
video,
|
|
87
|
-
onSelectVideo,
|
|
88
|
-
layout = 'vertical',
|
|
89
|
-
isFramed,
|
|
90
|
-
itemPositions,
|
|
91
|
-
index,
|
|
92
|
-
width = '100%'
|
|
93
|
-
} = _ref7;
|
|
94
|
-
const viewport = useViewport();
|
|
95
|
-
const getTokens = useThemeTokensCallback('VideoPickerThumbnail', {}, {});
|
|
96
|
-
const {
|
|
97
|
-
timestamp
|
|
98
|
-
} = getTimestamp(video.videoLength, video.copy);
|
|
99
|
-
const isPlaying = selectedVideoId === video.videoId;
|
|
100
|
-
const renderThumbnailImage = themeTokens => {
|
|
101
|
-
return /*#__PURE__*/_jsx(VideoThumbnail, {
|
|
102
|
-
...themeTokens,
|
|
103
|
-
isPlaying: isPlaying,
|
|
104
|
-
layout: layout,
|
|
105
|
-
children: /*#__PURE__*/_jsx(VideoSplash, {
|
|
106
|
-
simpleMode: true,
|
|
107
|
-
poster: video.posterSrc || `https://img.youtube.com/vi/${video.videoId}/maxresdefault.jpg`,
|
|
108
|
-
videoLength: video.videoLength,
|
|
109
|
-
copy: video.copy
|
|
110
|
-
})
|
|
111
|
-
});
|
|
112
|
-
};
|
|
113
|
-
const renderThumbnailInfo = _ref8 => {
|
|
114
|
-
let {
|
|
115
|
-
titleColor,
|
|
116
|
-
subTitleColor
|
|
117
|
-
} = _ref8;
|
|
118
|
-
return /*#__PURE__*/_jsxs(StackView, {
|
|
119
|
-
space: 2,
|
|
120
|
-
tokens: {
|
|
121
|
-
flexShrink: 1
|
|
122
|
-
},
|
|
123
|
-
children: [/*#__PURE__*/_jsx(ThumbnailTitleContainer, {
|
|
124
|
-
viewport: viewport,
|
|
125
|
-
children: /*#__PURE__*/_jsx(Typography, {
|
|
126
|
-
variant: {
|
|
127
|
-
bold: true
|
|
128
|
-
},
|
|
129
|
-
tokens: {
|
|
130
|
-
color: titleColor
|
|
131
|
-
},
|
|
132
|
-
children: video.title
|
|
133
|
-
})
|
|
134
|
-
}), viewport !== viewports.xs && /*#__PURE__*/_jsx(Typography, {
|
|
135
|
-
variant: {
|
|
136
|
-
size: 'micro'
|
|
137
|
-
},
|
|
138
|
-
tokens: {
|
|
139
|
-
color: subTitleColor
|
|
140
|
-
},
|
|
141
|
-
children: timestamp
|
|
142
|
-
})]
|
|
143
|
-
});
|
|
144
|
-
};
|
|
145
|
-
const handleLayout = itemPositions !== undefined ? getItemPositionLayoutHandler(itemPositions.positions, index) : undefined;
|
|
146
|
-
const onKeyPress = event => {
|
|
147
|
-
if (['Space', 'Enter'].includes(event.key)) {
|
|
148
|
-
var _videoPlayerRef$curre;
|
|
149
|
-
onSelectVideo(video);
|
|
150
|
-
const splashButton = (_videoPlayerRef$curre = videoPlayerRef.current) === null || _videoPlayerRef$curre === void 0 ? void 0 : _videoPlayerRef$curre.querySelector('button');
|
|
151
|
-
if (splashButton) splashButton.focus();
|
|
152
|
-
}
|
|
153
|
-
};
|
|
154
|
-
return /*#__PURE__*/_jsx(Pressable, {
|
|
155
|
-
onLayout: handleLayout,
|
|
156
|
-
onPress: () => onSelectVideo(video),
|
|
157
|
-
testID: `thumbnail-container-${video.videoId}`,
|
|
158
|
-
onKeyPress: onKeyPress,
|
|
159
|
-
accessibilityRole: "radio",
|
|
160
|
-
accessibilityState: {
|
|
161
|
-
checked: isPlaying
|
|
162
|
-
},
|
|
163
|
-
style: _ref9 => {
|
|
164
|
-
let {
|
|
165
|
-
hovered: hover,
|
|
166
|
-
focused: focus,
|
|
167
|
-
pressed
|
|
168
|
-
} = _ref9;
|
|
169
|
-
const themeTokens = getTokens({
|
|
170
|
-
hover,
|
|
171
|
-
focus,
|
|
172
|
-
pressed,
|
|
173
|
-
selected: isPlaying
|
|
174
|
-
});
|
|
175
|
-
const rnStyles = createReactNativeStyles(themeTokens);
|
|
176
|
-
return [rnStyles.container, layout === 'horizontal' && rnStyles.horizontal, isFramed && rnStyles.framed, isFramed && index > 0 && rnStyles.framedLine, {
|
|
177
|
-
width
|
|
178
|
-
}, {
|
|
179
|
-
outline: 'none'
|
|
180
|
-
}];
|
|
181
|
-
},
|
|
182
|
-
ref: ref,
|
|
183
|
-
children: _ref10 => {
|
|
184
|
-
let {
|
|
185
|
-
hovered: hover,
|
|
186
|
-
focused: focus,
|
|
187
|
-
pressed
|
|
188
|
-
} = _ref10;
|
|
189
|
-
const themeTokens = getTokens({
|
|
190
|
-
hover,
|
|
191
|
-
focus,
|
|
192
|
-
pressed,
|
|
193
|
-
selected: isPlaying
|
|
194
|
-
});
|
|
195
|
-
return /*#__PURE__*/_jsxs(StackView, {
|
|
196
|
-
space: layout === 'vertical' ? 2 : 3,
|
|
197
|
-
direction: layout === 'vertical' ? 'column' : 'row',
|
|
198
|
-
children: [/*#__PURE__*/_jsx(ImageContainer, {
|
|
199
|
-
...themeTokens,
|
|
200
|
-
children: renderThumbnailImage(themeTokens)
|
|
201
|
-
}), renderThumbnailInfo(themeTokens)]
|
|
202
|
-
});
|
|
203
|
-
}
|
|
204
|
-
}, video.videoId);
|
|
205
|
-
});
|
|
206
|
-
VideoPickerThumbnail.displayName = 'VideoPickerThumbnail';
|
|
207
|
-
VideoPickerThumbnail.propTypes = {
|
|
208
|
-
selectedVideoId: PropTypes.string,
|
|
209
|
-
onSelectVideo: PropTypes.func,
|
|
210
|
-
video: VideoPropType,
|
|
211
|
-
videoPlayerRef: RefPropType,
|
|
212
|
-
layout: PropTypes.oneOf(['vertical', 'horizontal']),
|
|
213
|
-
isFramed: PropTypes.bool,
|
|
214
|
-
itemPositions: itemPositionsPropType,
|
|
215
|
-
index: PropTypes.number,
|
|
216
|
-
width: PropTypes.oneOfType([PropTypes.number, PropTypes.string])
|
|
217
|
-
};
|
|
218
|
-
export default VideoPickerThumbnail;
|
|
@@ -1,82 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import { HorizontalScroll, HorizontalScrollButton, horizontalScrollUtils, StackView, useThemeTokens, useViewport } from '@telus-uds/components-base';
|
|
3
|
-
import View from "react-native-web/dist/exports/View";
|
|
4
|
-
import PropTypes from 'prop-types';
|
|
5
|
-
import { jsx as _jsx } from "react/jsx-runtime";
|
|
6
|
-
const {
|
|
7
|
-
useItemPositions
|
|
8
|
-
} = horizontalScrollUtils;
|
|
9
|
-
const VideoSlider = /*#__PURE__*/React.forwardRef((_ref, ref) => {
|
|
10
|
-
let {
|
|
11
|
-
children
|
|
12
|
-
} = _ref;
|
|
13
|
-
const viewport = useViewport();
|
|
14
|
-
const [itemPositions] = useItemPositions();
|
|
15
|
-
const [containerWidth, setContainerWidth] = React.useState(null);
|
|
16
|
-
const {
|
|
17
|
-
previousIcon: PreviousIcon,
|
|
18
|
-
nextIcon: NextIcon
|
|
19
|
-
} = useThemeTokens('VideoPickerSlider');
|
|
20
|
-
const onLayout = _ref2 => {
|
|
21
|
-
let {
|
|
22
|
-
nativeEvent: {
|
|
23
|
-
layout: {
|
|
24
|
-
width
|
|
25
|
-
}
|
|
26
|
-
}
|
|
27
|
-
} = _ref2;
|
|
28
|
-
setContainerWidth(width);
|
|
29
|
-
};
|
|
30
|
-
const itemsGap = 32; // '5' on spacing scale
|
|
31
|
-
const itemsCount = viewport === 'lg' || viewport === 'xl' ? 4 : 3;
|
|
32
|
-
const itemGapPortioned = (itemsCount - 1) * itemsGap / itemsCount;
|
|
33
|
-
const itemWidth = containerWidth === null ?
|
|
34
|
-
// For first render, we don't know container width, so avoid flicker with static % width
|
|
35
|
-
`calc(${Math.round(100 / itemsCount)}% - ${Math.round(itemGapPortioned)}px)` :
|
|
36
|
-
// After first render, can't use % widths because parent is > 100% width horizontal scroll area
|
|
37
|
-
Math.max(containerWidth / itemsCount - itemGapPortioned, 0 // Prevent negative width breaking layout on very narrow containers
|
|
38
|
-
);
|
|
39
|
-
|
|
40
|
-
const content = /*#__PURE__*/_jsx(StackView, {
|
|
41
|
-
space: 5,
|
|
42
|
-
direction: "row",
|
|
43
|
-
accessibilityRole: "radiogroup",
|
|
44
|
-
tokens: {
|
|
45
|
-
flexGrow: 1
|
|
46
|
-
},
|
|
47
|
-
children: React.Children.map(children, (child, index) => /*#__PURE__*/React.cloneElement(child, {
|
|
48
|
-
index,
|
|
49
|
-
itemPositions,
|
|
50
|
-
width: itemWidth
|
|
51
|
-
}))
|
|
52
|
-
});
|
|
53
|
-
const overflow = containerWidth === null && {
|
|
54
|
-
overflow: 'hidden'
|
|
55
|
-
};
|
|
56
|
-
const horizontalScrollTokens = {
|
|
57
|
-
nextIcon: NextIcon,
|
|
58
|
-
previousIcon: PreviousIcon,
|
|
59
|
-
gutter: 0,
|
|
60
|
-
borderBottomWidth: 0,
|
|
61
|
-
borderBottomColor: 'transparent',
|
|
62
|
-
buttonClearance: 0
|
|
63
|
-
};
|
|
64
|
-
return /*#__PURE__*/_jsx(View, {
|
|
65
|
-
onLayout: onLayout,
|
|
66
|
-
style: overflow,
|
|
67
|
-
ref: ref,
|
|
68
|
-
children: containerWidth === null ?
|
|
69
|
-
// Use a 100% width non-scrollable parent until containerWidth is known, to avoid flicker
|
|
70
|
-
content : /*#__PURE__*/_jsx(HorizontalScroll, {
|
|
71
|
-
ScrollButton: HorizontalScrollButton,
|
|
72
|
-
itemPositions: itemPositions,
|
|
73
|
-
tokens: horizontalScrollTokens,
|
|
74
|
-
children: content
|
|
75
|
-
})
|
|
76
|
-
});
|
|
77
|
-
});
|
|
78
|
-
VideoSlider.displayName = 'VideoSlider';
|
|
79
|
-
VideoSlider.propTypes = {
|
|
80
|
-
children: PropTypes.node
|
|
81
|
-
};
|
|
82
|
-
export default VideoSlider;
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
import PropTypes from 'prop-types';
|
|
2
|
-
import { VideoProps } from '../WebVideo/WebVideo';
|
|
3
|
-
export const VideoPropType = PropTypes.shape({
|
|
4
|
-
...VideoProps,
|
|
5
|
-
title: PropTypes.string,
|
|
6
|
-
description: PropTypes.string
|
|
7
|
-
});
|
|
8
|
-
export const RefPropType = PropTypes.shape({
|
|
9
|
-
current: PropTypes.object
|
|
10
|
-
});
|