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