@telus-uds/components-web 3.4.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 +22 -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/cjs/NavigationBar/collapseItems.js +43 -0
- 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 -21
- 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 +5 -5
- 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 +18 -12
- package/lib/esm/DatePicker/reactDatesCss.js +3 -0
- package/lib/{Disclaimer → esm/Disclaimer}/Disclaimer.js +6 -5
- package/lib/{Footnote → esm/Footnote}/Footnote.js +39 -15
- package/lib/{Footnote → esm/Footnote}/FootnoteLink.js +6 -5
- package/lib/{NavigationBar → esm/NavigationBar}/NavigationBar.js +6 -5
- package/lib/{NavigationBar → esm/NavigationBar}/NavigationItem.js +6 -5
- 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 +6 -5
- 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/{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 +16 -17
- package/lib/{TermsAndConditions → esm/TermsAndConditions}/ExpandCollapse.js +13 -7
- 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 +13 -64
- package/lib/{Video → esm/Video}/ControlBar/ControlBar.js +18 -8
- package/lib/{Video → esm/Video}/ControlBar/Controls/VideoButton/VideoButton.js +6 -5
- 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 +26 -10
- package/lib/{VideoPicker → esm/VideoPicker}/VideoPicker.js +20 -44
- package/lib/{VideoPicker → esm/VideoPicker}/VideoPickerThumbnail.js +18 -52
- package/lib/{WaffleGrid → esm/WaffleGrid}/WaffleGrid.js +14 -7
- package/lib/{WebVideo → esm/WebVideo}/WebVideo.js +14 -9
- package/lib/{index.js → esm/index.js} +1 -1
- 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}/ssr.js +1 -4
- package/package.json +17 -16
- package/src/Badge/Badge.jsx +2 -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 +1 -3
- 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/index.js +1 -1
- 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 +1 -2
- package/lib/DatePicker/reactDatesCss.js +0 -830
- package/lib/QuantitySelector/styles.js +0 -18
- package/lib/Table/Row.js +0 -19
- package/lib/utils/theming/styled-components.js +0 -26
- 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}/NavigationSubMenu.js +0 -0
- /package/lib/{NavigationBar → esm/NavigationBar}/collapseItems.js +0 -0
- /package/lib/{NavigationBar → esm/NavigationBar}/index.js +0 -0
- /package/lib/{NavigationBar → esm/NavigationBar}/resolveItemSelection.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}/SkeletonImage.js +0 -0
- /package/lib/{SkeletonProvider → esm/SkeletonProvider}/SkeletonProvider.js +0 -0
- /package/lib/{SkeletonProvider → esm/SkeletonProvider}/SkeletonTypography.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/{baseExports.js → esm/baseExports.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}/scrollToAnchor.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}/useOverlaidPosition.js +0 -0
- /package/lib/{utils → esm/utils}/useTypographyTheme.js +0 -0
|
@@ -0,0 +1,94 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.default = void 0;
|
|
7
|
+
var _react = _interopRequireDefault(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 _utils = require("../utils");
|
|
12
|
+
var _jsxRuntime = require("react/jsx-runtime");
|
|
13
|
+
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
14
|
+
const [selectProps, selectedSystemPropTypes] = (0, _componentsBase.selectSystemProps)([_utils.htmlAttrs]);
|
|
15
|
+
const defaultMaxWidth = 192;
|
|
16
|
+
const ItemContainer = /*#__PURE__*/_styledComponents.default.div.withConfig({
|
|
17
|
+
displayName: "NavigationItem__ItemContainer",
|
|
18
|
+
componentId: "components-web__sc-ql9x7c-0"
|
|
19
|
+
})(_ref => {
|
|
20
|
+
let {
|
|
21
|
+
targetWidth
|
|
22
|
+
} = _ref;
|
|
23
|
+
return {
|
|
24
|
+
display: 'flex',
|
|
25
|
+
flexDirection: 'column',
|
|
26
|
+
justifyContent: 'center',
|
|
27
|
+
maxWidth: `${Math.max(defaultMaxWidth, targetWidth ?? 0)}px`,
|
|
28
|
+
flexGrow: targetWidth ? 1 : 0,
|
|
29
|
+
flexShrink: 1
|
|
30
|
+
};
|
|
31
|
+
});
|
|
32
|
+
|
|
33
|
+
/**
|
|
34
|
+
* NavigationItem within a NavigationBar component.
|
|
35
|
+
*
|
|
36
|
+
* This is rendered automatically by `NavigationBar` and isn't intended be used directly.
|
|
37
|
+
*/
|
|
38
|
+
const NavigationItem = /*#__PURE__*/_react.default.forwardRef((_ref2, ref) => {
|
|
39
|
+
let {
|
|
40
|
+
accessibilityRole = 'link',
|
|
41
|
+
// @todo switch to 'button' for dropdowns
|
|
42
|
+
children,
|
|
43
|
+
id,
|
|
44
|
+
onClick: handleClick = () => {},
|
|
45
|
+
selected = false,
|
|
46
|
+
accessibilityState = {
|
|
47
|
+
current: selected ? 'page' : false
|
|
48
|
+
},
|
|
49
|
+
href,
|
|
50
|
+
tokens,
|
|
51
|
+
variant = {},
|
|
52
|
+
LinkRouter,
|
|
53
|
+
linkRouterProps,
|
|
54
|
+
...rest
|
|
55
|
+
} = _ref2;
|
|
56
|
+
const selectedProps = selectProps(rest);
|
|
57
|
+
const targetWidth = (0, _componentsBase.useResponsiveProp)({
|
|
58
|
+
xs: 288,
|
|
59
|
+
lg: null
|
|
60
|
+
});
|
|
61
|
+
const viewport = (0, _componentsBase.useViewport)();
|
|
62
|
+
const getTokens = (0, _componentsBase.useThemeTokensCallback)('NavigationBar', tokens, variant);
|
|
63
|
+
const getStateTokens = state => getTokens({
|
|
64
|
+
...state,
|
|
65
|
+
viewport
|
|
66
|
+
});
|
|
67
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsx)(ItemContainer, {
|
|
68
|
+
targetWidth: targetWidth,
|
|
69
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_componentsBase.Button, {
|
|
70
|
+
accessibilityRole: accessibilityRole,
|
|
71
|
+
accessibilityState: accessibilityState,
|
|
72
|
+
onPress: handleClick,
|
|
73
|
+
ref: ref,
|
|
74
|
+
tokens: getStateTokens,
|
|
75
|
+
variant: {
|
|
76
|
+
selected
|
|
77
|
+
},
|
|
78
|
+
href: href,
|
|
79
|
+
LinkRouter: LinkRouter,
|
|
80
|
+
linkRouterProps: linkRouterProps,
|
|
81
|
+
...selectedProps,
|
|
82
|
+
children: children
|
|
83
|
+
})
|
|
84
|
+
});
|
|
85
|
+
});
|
|
86
|
+
NavigationItem.displayName = 'NavigationItem';
|
|
87
|
+
NavigationItem.propTypes = {
|
|
88
|
+
...selectedSystemPropTypes,
|
|
89
|
+
tokens: (0, _componentsBase.getTokensPropType)('NavigationBar'),
|
|
90
|
+
onClick: _propTypes.default.func,
|
|
91
|
+
selected: _propTypes.default.bool,
|
|
92
|
+
children: _propTypes.default.oneOfType([_propTypes.default.string, _propTypes.default.func]).isRequired
|
|
93
|
+
};
|
|
94
|
+
var _default = exports.default = NavigationItem;
|
|
@@ -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 = _interopRequireDefault(require("react"));
|
|
8
|
+
var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
9
|
+
var _componentsBase = require("@telus-uds/components-base");
|
|
10
|
+
var _NavigationItem = _interopRequireDefault(require("./NavigationItem"));
|
|
11
|
+
var _useOverlaidPosition = _interopRequireDefault(require("../utils/useOverlaidPosition"));
|
|
12
|
+
var _resolveItemSelection = _interopRequireDefault(require("./resolveItemSelection"));
|
|
13
|
+
var _jsxRuntime = require("react/jsx-runtime");
|
|
14
|
+
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
15
|
+
/**
|
|
16
|
+
* A NavigationItem that opens or closes a Listbox of other NavigationItems.
|
|
17
|
+
*
|
|
18
|
+
* This is rendered automatically by `NavigationBar` and isn't intended be used directly.
|
|
19
|
+
*/const NavigationSubMenu = /*#__PURE__*/_react.default.forwardRef((_ref, ref) => {
|
|
20
|
+
let {
|
|
21
|
+
children,
|
|
22
|
+
id,
|
|
23
|
+
isOpen = false,
|
|
24
|
+
tokens = {},
|
|
25
|
+
label,
|
|
26
|
+
onClick,
|
|
27
|
+
selectedId,
|
|
28
|
+
items = [],
|
|
29
|
+
openOverlayRef,
|
|
30
|
+
LinkRouter,
|
|
31
|
+
linkRouterProps,
|
|
32
|
+
itemsContainerRef
|
|
33
|
+
} = _ref;
|
|
34
|
+
const focusTrapRef = _react.default.useRef();
|
|
35
|
+
const maxWidth = 289; // Slightly over 288 of nav item to account for subpixel rounding
|
|
36
|
+
const defaultOffsets = {
|
|
37
|
+
offsets: {
|
|
38
|
+
vertical: 4
|
|
39
|
+
}
|
|
40
|
+
};
|
|
41
|
+
const {
|
|
42
|
+
align,
|
|
43
|
+
offsets,
|
|
44
|
+
minWidth
|
|
45
|
+
} = (0, _componentsBase.useResponsiveProp)({
|
|
46
|
+
xs: {
|
|
47
|
+
...defaultOffsets,
|
|
48
|
+
align: {
|
|
49
|
+
top: 'bottom',
|
|
50
|
+
left: 'left'
|
|
51
|
+
},
|
|
52
|
+
minWidth: maxWidth
|
|
53
|
+
},
|
|
54
|
+
sm: {
|
|
55
|
+
...defaultOffsets,
|
|
56
|
+
align: {
|
|
57
|
+
top: 'bottom',
|
|
58
|
+
right: 'right'
|
|
59
|
+
},
|
|
60
|
+
minWidth: maxWidth
|
|
61
|
+
},
|
|
62
|
+
lg: {
|
|
63
|
+
...defaultOffsets,
|
|
64
|
+
align: {
|
|
65
|
+
top: 'bottom',
|
|
66
|
+
center: 'center'
|
|
67
|
+
},
|
|
68
|
+
minWidth: 192
|
|
69
|
+
}
|
|
70
|
+
});
|
|
71
|
+
const {
|
|
72
|
+
overlaidPosition,
|
|
73
|
+
sourceRef,
|
|
74
|
+
targetRef,
|
|
75
|
+
onTargetLayout,
|
|
76
|
+
isReady
|
|
77
|
+
} = (0, _useOverlaidPosition.default)({
|
|
78
|
+
isShown: isOpen,
|
|
79
|
+
offsets,
|
|
80
|
+
align
|
|
81
|
+
});
|
|
82
|
+
const {
|
|
83
|
+
selected
|
|
84
|
+
} = (0, _resolveItemSelection.default)({
|
|
85
|
+
id,
|
|
86
|
+
label,
|
|
87
|
+
items
|
|
88
|
+
}, selectedId);
|
|
89
|
+
const handleClick = event => {
|
|
90
|
+
if (typeof onClick === 'function') onClick(event);
|
|
91
|
+
};
|
|
92
|
+
const {
|
|
93
|
+
icoMenu
|
|
94
|
+
} = (0, _componentsBase.useThemeTokens)('NavigationBar', {}, {}, {
|
|
95
|
+
expanded: isOpen
|
|
96
|
+
});
|
|
97
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsxs)(_jsxRuntime.Fragment, {
|
|
98
|
+
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_NavigationItem.default, {
|
|
99
|
+
ref: sourceRef,
|
|
100
|
+
accessibilityRole: "button",
|
|
101
|
+
id: id,
|
|
102
|
+
selected: selected,
|
|
103
|
+
onClick: handleClick,
|
|
104
|
+
icon: icoMenu,
|
|
105
|
+
tokens: tokens,
|
|
106
|
+
children: _ref2 => {
|
|
107
|
+
let {
|
|
108
|
+
textStyles
|
|
109
|
+
} = _ref2;
|
|
110
|
+
return [children, /*#__PURE__*/(0, _jsxRuntime.jsx)(_componentsBase.Icon, {
|
|
111
|
+
icon: icoMenu,
|
|
112
|
+
variant: {
|
|
113
|
+
size: 'micro'
|
|
114
|
+
},
|
|
115
|
+
tokens: {
|
|
116
|
+
color: textStyles[0]?.color
|
|
117
|
+
}
|
|
118
|
+
}, `${id}_icon`)];
|
|
119
|
+
}
|
|
120
|
+
}), isOpen && /*#__PURE__*/(0, _jsxRuntime.jsxs)(_jsxRuntime.Fragment, {
|
|
121
|
+
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_componentsBase.Listbox.Overlay, {
|
|
122
|
+
overlaidPosition: overlaidPosition,
|
|
123
|
+
maxWidth: maxWidth,
|
|
124
|
+
minWidth: minWidth,
|
|
125
|
+
isReady: isReady,
|
|
126
|
+
onLayout: onTargetLayout,
|
|
127
|
+
ref: openOverlayRef,
|
|
128
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_componentsBase.Listbox, {
|
|
129
|
+
items: items,
|
|
130
|
+
firstItemRef: targetRef,
|
|
131
|
+
parentRef: sourceRef,
|
|
132
|
+
selectedId: selectedId,
|
|
133
|
+
LinkRouter: LinkRouter,
|
|
134
|
+
linkRouterProps: linkRouterProps,
|
|
135
|
+
ref: itemsContainerRef || ref
|
|
136
|
+
})
|
|
137
|
+
}), /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
|
|
138
|
+
// This catches and shifts focus to other interactive elements.
|
|
139
|
+
// eslint-disable-next-line jsx-a11y/no-noninteractive-tabindex
|
|
140
|
+
tabIndex: 0,
|
|
141
|
+
ref: focusTrapRef,
|
|
142
|
+
onFocus: () => targetRef.current.focus()
|
|
143
|
+
})]
|
|
144
|
+
})]
|
|
145
|
+
});
|
|
146
|
+
});
|
|
147
|
+
NavigationSubMenu.displayName = 'NavigationSubMenu';
|
|
148
|
+
|
|
149
|
+
// @TODO - proper prop types and comments
|
|
150
|
+
NavigationSubMenu.propTypes = {
|
|
151
|
+
tokens: (0, _componentsBase.getTokensPropType)('NavigationBar'),
|
|
152
|
+
children: _propTypes.default.node,
|
|
153
|
+
id: _propTypes.default.string,
|
|
154
|
+
isOpen: _propTypes.default.bool,
|
|
155
|
+
label: _propTypes.default.string,
|
|
156
|
+
onClick: _propTypes.default.func,
|
|
157
|
+
selectedId: _propTypes.default.string,
|
|
158
|
+
items: _propTypes.default.array,
|
|
159
|
+
openOverlayRef: _propTypes.default.object,
|
|
160
|
+
LinkRouter: _propTypes.default.elementType,
|
|
161
|
+
linkRouterProps: _propTypes.default.object,
|
|
162
|
+
itemsContainerRef: _propTypes.default.object
|
|
163
|
+
};
|
|
164
|
+
var _default = exports.default = NavigationSubMenu;
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.default = void 0;
|
|
7
|
+
/**
|
|
8
|
+
* Make a list of items into a one-item list where all items are nested under the first item
|
|
9
|
+
*/
|
|
10
|
+
const collapseItems = (items, selectedId) => {
|
|
11
|
+
if (!items?.length) return items;
|
|
12
|
+
|
|
13
|
+
// Give the root item the label of the current active link
|
|
14
|
+
// (or the first item if for some reason there's no match on the selectedId)
|
|
15
|
+
let rootLabel = items[0].label;
|
|
16
|
+
const isSelected = _ref => {
|
|
17
|
+
let {
|
|
18
|
+
label,
|
|
19
|
+
id
|
|
20
|
+
} = _ref;
|
|
21
|
+
return selectedId === id ?? label;
|
|
22
|
+
};
|
|
23
|
+
|
|
24
|
+
// Linter doesn't like for loops, simulate loop that breaks
|
|
25
|
+
items.some(item => {
|
|
26
|
+
if (isSelected(item)) {
|
|
27
|
+
rootLabel = item.label;
|
|
28
|
+
return true; // break
|
|
29
|
+
}
|
|
30
|
+
const nestedMatch = item.items?.find(isSelected);
|
|
31
|
+
if (nestedMatch) {
|
|
32
|
+
rootLabel = nestedMatch.label;
|
|
33
|
+
return true; // break
|
|
34
|
+
}
|
|
35
|
+
return false; // continue
|
|
36
|
+
});
|
|
37
|
+
return [{
|
|
38
|
+
id: 'navigation-bar-root',
|
|
39
|
+
label: rootLabel,
|
|
40
|
+
items
|
|
41
|
+
}];
|
|
42
|
+
};
|
|
43
|
+
var _default = exports.default = collapseItems;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.default = void 0;
|
|
7
|
+
var _NavigationBar = _interopRequireDefault(require("./NavigationBar"));
|
|
8
|
+
var _NavigationItem = _interopRequireDefault(require("./NavigationItem"));
|
|
9
|
+
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
10
|
+
_NavigationBar.default.Item = _NavigationItem.default;
|
|
11
|
+
var _default = exports.default = _NavigationBar.default;
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.default = void 0;
|
|
7
|
+
const resolveItemSelection = (_ref, selectedId) => {
|
|
8
|
+
let {
|
|
9
|
+
id,
|
|
10
|
+
label,
|
|
11
|
+
items
|
|
12
|
+
} = _ref;
|
|
13
|
+
const itemId = id ?? label;
|
|
14
|
+
|
|
15
|
+
// Treat item as selected if it or any nested child matches the selected id
|
|
16
|
+
const selected = Boolean(selectedId === itemId || items?.some(item => resolveItemSelection(item, selectedId).selected));
|
|
17
|
+
return {
|
|
18
|
+
itemId,
|
|
19
|
+
selected
|
|
20
|
+
};
|
|
21
|
+
};
|
|
22
|
+
var _default = exports.default = resolveItemSelection;
|
|
@@ -0,0 +1,99 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.default = void 0;
|
|
7
|
+
var _react = _interopRequireDefault(require("react"));
|
|
8
|
+
var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
9
|
+
var _componentsBase = require("@telus-uds/components-base");
|
|
10
|
+
var _ResponsiveImage = _interopRequireDefault(require("../ResponsiveImage"));
|
|
11
|
+
var _utils = require("./utils");
|
|
12
|
+
var _utils2 = require("../utils");
|
|
13
|
+
var _jsxRuntime = require("react/jsx-runtime");
|
|
14
|
+
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
15
|
+
const [selectProps, selectedSystemPropTypes] = (0, _componentsBase.selectSystemProps)([_utils2.htmlAttrs]);
|
|
16
|
+
const OptimizeImage = /*#__PURE__*/_react.default.forwardRef((_ref, ref) => {
|
|
17
|
+
let {
|
|
18
|
+
contentfulAssetUrl,
|
|
19
|
+
alt,
|
|
20
|
+
quality = 80,
|
|
21
|
+
xs = 320,
|
|
22
|
+
sm = 576,
|
|
23
|
+
md = 768,
|
|
24
|
+
lg = 992,
|
|
25
|
+
xl = 1200,
|
|
26
|
+
sizeByHeight = false,
|
|
27
|
+
disableRetina = false,
|
|
28
|
+
...rest
|
|
29
|
+
} = _ref;
|
|
30
|
+
// `useHeight` is a deprecated TDS prop, replaced by `sizeByHeight`
|
|
31
|
+
const dimension = sizeByHeight || rest.useHeight ? 'h' : 'w';
|
|
32
|
+
// by default assuming webP support for SSR
|
|
33
|
+
const [imgUrls, setImgUrls] = _react.default.useState((0, _utils.getImageUrls)(contentfulAssetUrl, dimension, xs, sm, md, lg, xl, quality, disableRetina, true));
|
|
34
|
+
_react.default.useEffect(() => {
|
|
35
|
+
// Checking for webP support for CSR
|
|
36
|
+
(0, _utils.hasWebpSupport)().then(supportsWebp => {
|
|
37
|
+
const imageUrls = (0, _utils.getImageUrls)(contentfulAssetUrl, dimension, xs, sm, md, lg, xl, quality, disableRetina, supportsWebp);
|
|
38
|
+
setImgUrls(imageUrls);
|
|
39
|
+
});
|
|
40
|
+
}, [contentfulAssetUrl, dimension, disableRetina, lg, md, quality, sm, xl, xs]);
|
|
41
|
+
if (!imgUrls) return null;
|
|
42
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_ResponsiveImage.default, {
|
|
43
|
+
...imgUrls,
|
|
44
|
+
alt: alt,
|
|
45
|
+
...selectProps(rest),
|
|
46
|
+
ref: ref
|
|
47
|
+
});
|
|
48
|
+
});
|
|
49
|
+
OptimizeImage.displayName = 'OptimizeImage';
|
|
50
|
+
OptimizeImage.propTypes = {
|
|
51
|
+
...selectedSystemPropTypes,
|
|
52
|
+
/**
|
|
53
|
+
* The source to load the image. Only contentful image urls are supported. See https://www.contentful.com/developers/docs/references/images-api/ for details.
|
|
54
|
+
*/
|
|
55
|
+
contentfulAssetUrl: _propTypes.default.string.isRequired,
|
|
56
|
+
/**
|
|
57
|
+
* Alternative text to display if image cannot be loaded or a screen reader is used.
|
|
58
|
+
*/
|
|
59
|
+
alt: _propTypes.default.string.isRequired,
|
|
60
|
+
/**
|
|
61
|
+
* Customize quality as a percentage between 1 and 100.
|
|
62
|
+
*/
|
|
63
|
+
quality: _propTypes.default.number,
|
|
64
|
+
/**
|
|
65
|
+
* Customize width for xs screen size in px, this may affect the quality of the image.
|
|
66
|
+
*/
|
|
67
|
+
xs: _propTypes.default.number,
|
|
68
|
+
/**
|
|
69
|
+
* Customize width for sm screen size in px, this may affect the quality of the image.
|
|
70
|
+
*/
|
|
71
|
+
sm: _propTypes.default.number,
|
|
72
|
+
/**
|
|
73
|
+
* Customize width for md screen size in px, this may affect the quality of the image.
|
|
74
|
+
*/
|
|
75
|
+
md: _propTypes.default.number,
|
|
76
|
+
/**
|
|
77
|
+
* Customize width for lg screen size in px, this may affect the quality of the image.
|
|
78
|
+
*/
|
|
79
|
+
lg: _propTypes.default.number,
|
|
80
|
+
/**
|
|
81
|
+
* Customize width for xl screen size in px, this may affect the quality of the image.
|
|
82
|
+
*/
|
|
83
|
+
xl: _propTypes.default.number,
|
|
84
|
+
/**
|
|
85
|
+
* Switches size dimension to height, default is false
|
|
86
|
+
*/
|
|
87
|
+
sizeByHeight: _propTypes.default.bool,
|
|
88
|
+
/**
|
|
89
|
+
* Turns off retina display functionality
|
|
90
|
+
*/
|
|
91
|
+
disableRetina: _propTypes.default.bool,
|
|
92
|
+
/**
|
|
93
|
+
* Loading strategy.
|
|
94
|
+
* @default 'eager'
|
|
95
|
+
* @see https://developer.mozilla.org/en-US/docs/Web/HTML/Element/img#attr-loading
|
|
96
|
+
*/
|
|
97
|
+
loading: _propTypes.default.oneOf(['eager', 'lazy'])
|
|
98
|
+
};
|
|
99
|
+
var _default = exports.default = OptimizeImage;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.default = void 0;
|
|
7
|
+
var _OptimizeImage = _interopRequireDefault(require("./OptimizeImage"));
|
|
8
|
+
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
9
|
+
var _default = exports.default = _OptimizeImage.default;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.default = getFallbackUrl;
|
|
7
|
+
var _isSvgUrl = _interopRequireDefault(require("./isSvgUrl"));
|
|
8
|
+
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
9
|
+
function getFallbackUrl(url, dimension, size, quality) {
|
|
10
|
+
if (!(0, _isSvgUrl.default)(url)) {
|
|
11
|
+
return `${url}?${dimension}=${size}&q=${quality}`;
|
|
12
|
+
}
|
|
13
|
+
return url;
|
|
14
|
+
}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.default = getImageUrls;
|
|
7
|
+
var _getOptimizedUrl = _interopRequireDefault(require("./getOptimizedUrl"));
|
|
8
|
+
var _getFallbackUrl = _interopRequireDefault(require("./getFallbackUrl"));
|
|
9
|
+
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
10
|
+
function getImageUrls(contentfulAssetUrl, dimension, xs, sm, md, lg, xl, quality, disableRetina, supportsWebp) {
|
|
11
|
+
return {
|
|
12
|
+
xsSrc: (0, _getOptimizedUrl.default)(contentfulAssetUrl, dimension, xs, quality, disableRetina, supportsWebp),
|
|
13
|
+
smSrc: (0, _getOptimizedUrl.default)(contentfulAssetUrl, dimension, sm, quality, disableRetina, supportsWebp),
|
|
14
|
+
mdSrc: (0, _getOptimizedUrl.default)(contentfulAssetUrl, dimension, md, quality, disableRetina, supportsWebp),
|
|
15
|
+
lgSrc: (0, _getOptimizedUrl.default)(contentfulAssetUrl, dimension, lg, quality, disableRetina, supportsWebp),
|
|
16
|
+
xlSrc: (0, _getOptimizedUrl.default)(contentfulAssetUrl, dimension, xl, quality, disableRetina, supportsWebp),
|
|
17
|
+
fallbackSrc: (0, _getFallbackUrl.default)(contentfulAssetUrl, dimension, xl, quality)
|
|
18
|
+
};
|
|
19
|
+
}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.default = getOptimizedUrl;
|
|
7
|
+
var _isSvgUrl = _interopRequireDefault(require("./isSvgUrl"));
|
|
8
|
+
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
9
|
+
function getOptimizedUrl(url, dimension, size, quality, disableRetina, supportsWebp) {
|
|
10
|
+
if (!(0, _isSvgUrl.default)(url)) {
|
|
11
|
+
let format = '';
|
|
12
|
+
if (supportsWebp) {
|
|
13
|
+
format = 'fm=webp';
|
|
14
|
+
} else if (url.match(/\.jpe?g$/i)) {
|
|
15
|
+
format = 'fm=jpg&fl=progressive';
|
|
16
|
+
}
|
|
17
|
+
let optimizedUrl = `${url}?${dimension}=${size}&q=${quality}&${format}`;
|
|
18
|
+
if (!disableRetina) {
|
|
19
|
+
optimizedUrl += `, ${url}?${dimension}=${size * 2}&q=${quality}&${format} 2x`;
|
|
20
|
+
}
|
|
21
|
+
return optimizedUrl;
|
|
22
|
+
}
|
|
23
|
+
return url;
|
|
24
|
+
}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.default = hasWebpSupport;
|
|
7
|
+
let promise;
|
|
8
|
+
|
|
9
|
+
/**
|
|
10
|
+
* Taken directly from Google developers guide on how to detect browser support for WebP.
|
|
11
|
+
*
|
|
12
|
+
* @see https://developers.google.com/speed/webp/faq#in_your_own_javascript
|
|
13
|
+
* @return {Promise<boolean>}
|
|
14
|
+
*/
|
|
15
|
+
function hasWebpSupport() {
|
|
16
|
+
// cache the result, so that this function runs only once
|
|
17
|
+
if (!promise) {
|
|
18
|
+
promise = new Promise(resolve => {
|
|
19
|
+
// basic support. other test forms exist for lossless, alpha, and animation types.
|
|
20
|
+
// check google guide if data strings are needed
|
|
21
|
+
const lossy = 'UklGRiIAAABXRUJQVlA4IBYAAAAwAQCdASoBAAEADsD+JaQAA3AAAAAA';
|
|
22
|
+
const img = document.createElement('img');
|
|
23
|
+
img.onload = function onLoad() {
|
|
24
|
+
const result = img.width > 0 && img.height > 0;
|
|
25
|
+
resolve(result);
|
|
26
|
+
};
|
|
27
|
+
img.onerror = function onError() {
|
|
28
|
+
resolve(false);
|
|
29
|
+
};
|
|
30
|
+
img.src = `data:image/webp;base64,${lossy}`;
|
|
31
|
+
});
|
|
32
|
+
}
|
|
33
|
+
return promise;
|
|
34
|
+
}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
Object.defineProperty(exports, "getFallbackUrl", {
|
|
7
|
+
enumerable: true,
|
|
8
|
+
get: function () {
|
|
9
|
+
return _getFallbackUrl.default;
|
|
10
|
+
}
|
|
11
|
+
});
|
|
12
|
+
Object.defineProperty(exports, "getImageUrls", {
|
|
13
|
+
enumerable: true,
|
|
14
|
+
get: function () {
|
|
15
|
+
return _getImageUrls.default;
|
|
16
|
+
}
|
|
17
|
+
});
|
|
18
|
+
Object.defineProperty(exports, "getOptimizedUrl", {
|
|
19
|
+
enumerable: true,
|
|
20
|
+
get: function () {
|
|
21
|
+
return _getOptimizedUrl.default;
|
|
22
|
+
}
|
|
23
|
+
});
|
|
24
|
+
Object.defineProperty(exports, "hasWebpSupport", {
|
|
25
|
+
enumerable: true,
|
|
26
|
+
get: function () {
|
|
27
|
+
return _hasWebpSupport.default;
|
|
28
|
+
}
|
|
29
|
+
});
|
|
30
|
+
var _getOptimizedUrl = _interopRequireDefault(require("./getOptimizedUrl"));
|
|
31
|
+
var _getFallbackUrl = _interopRequireDefault(require("./getFallbackUrl"));
|
|
32
|
+
var _hasWebpSupport = _interopRequireDefault(require("./hasWebpSupport"));
|
|
33
|
+
var _getImageUrls = _interopRequireDefault(require("./getImageUrls"));
|
|
34
|
+
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|