@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,215 @@
|
|
|
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 _lodash = _interopRequireDefault(require("lodash.omit"));
|
|
10
|
+
var _componentsBase = require("@telus-uds/components-base");
|
|
11
|
+
var _styledComponents = _interopRequireDefault(require("styled-components"));
|
|
12
|
+
var _FullBleedContent = _interopRequireWildcard(require("../shared/FullBleedContent"));
|
|
13
|
+
var _AuthorDate = _interopRequireDefault(require("./AuthorDate"));
|
|
14
|
+
var _jsxRuntime = require("react/jsx-runtime");
|
|
15
|
+
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); }
|
|
16
|
+
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; }
|
|
17
|
+
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
18
|
+
// Passes React Native-oriented system props through UDS PressableCardBase
|
|
19
|
+
const [selectProps, selectedSystemPropTypes] = (0, _componentsBase.selectSystemProps)([_componentsBase.a11yProps, _componentsBase.focusHandlerProps, _componentsBase.viewProps]);
|
|
20
|
+
|
|
21
|
+
// Stop changes to the card's inner border width causing the size and
|
|
22
|
+
// apparent position of the full bleed image to change.
|
|
23
|
+
const FullBleedOffsetOuter = /*#__PURE__*/_styledComponents.default.div.withConfig({
|
|
24
|
+
displayName: "PreviewCard__FullBleedOffsetOuter",
|
|
25
|
+
componentId: "components-web__sc-1yfz4de-0"
|
|
26
|
+
})(_ref => {
|
|
27
|
+
let {
|
|
28
|
+
borderOffset
|
|
29
|
+
} = _ref;
|
|
30
|
+
return {
|
|
31
|
+
overflow: 'hidden',
|
|
32
|
+
marginTop: borderOffset * 2
|
|
33
|
+
};
|
|
34
|
+
});
|
|
35
|
+
const FullBleedOffsetInner = /*#__PURE__*/_styledComponents.default.div.withConfig({
|
|
36
|
+
displayName: "PreviewCard__FullBleedOffsetInner",
|
|
37
|
+
componentId: "components-web__sc-1yfz4de-1"
|
|
38
|
+
})(_ref2 => {
|
|
39
|
+
let {
|
|
40
|
+
borderOffset
|
|
41
|
+
} = _ref2;
|
|
42
|
+
return {
|
|
43
|
+
position: 'relative',
|
|
44
|
+
margin: 0 - borderOffset
|
|
45
|
+
};
|
|
46
|
+
});
|
|
47
|
+
const defaultTokens = {
|
|
48
|
+
minWidth: 0,
|
|
49
|
+
shadow: null,
|
|
50
|
+
contentAlignItems: 'stretch',
|
|
51
|
+
contentJustifyContent: 'flex-start',
|
|
52
|
+
contentFlexGrow: 0,
|
|
53
|
+
contentFlexShrink: 0
|
|
54
|
+
};
|
|
55
|
+
|
|
56
|
+
/**
|
|
57
|
+
* Showcase and guide users to another page, with a preview containing title and a footer.
|
|
58
|
+
* Whole card is interactive, width expands based on column or container.
|
|
59
|
+
*
|
|
60
|
+
* - Use `tag` to show category of content
|
|
61
|
+
* - Use `title` to show title of the story
|
|
62
|
+
* - Use `footer` to show text such as the author / date
|
|
63
|
+
* - Use `href` to set the target URL
|
|
64
|
+
* - Use `fullBleedContent` to set the thumbnail image
|
|
65
|
+
*/
|
|
66
|
+
const PreviewCard = /*#__PURE__*/_react.default.forwardRef((_ref3, ref) => {
|
|
67
|
+
let {
|
|
68
|
+
tag,
|
|
69
|
+
title,
|
|
70
|
+
footer,
|
|
71
|
+
fullBleedImage,
|
|
72
|
+
fullBleedContent = fullBleedImage,
|
|
73
|
+
onPress,
|
|
74
|
+
href,
|
|
75
|
+
...rest
|
|
76
|
+
} = _ref3;
|
|
77
|
+
const {
|
|
78
|
+
fullBleedContentPosition,
|
|
79
|
+
contentStackDirection,
|
|
80
|
+
fullBleedContentProps
|
|
81
|
+
} = (0, _FullBleedContent.useFullBleedContentProps)({
|
|
82
|
+
...fullBleedContent,
|
|
83
|
+
position: 'bottom'
|
|
84
|
+
});
|
|
85
|
+
const {
|
|
86
|
+
components: {
|
|
87
|
+
PreviewCard: theme
|
|
88
|
+
}
|
|
89
|
+
} = (0, _componentsBase.useTheme)();
|
|
90
|
+
const getPressableCardTokens = cardState => ({
|
|
91
|
+
...(0, _lodash.default)((0, _componentsBase.getThemeTokens)(theme, {}, {}, cardState), 'separatorColor'),
|
|
92
|
+
...defaultTokens
|
|
93
|
+
});
|
|
94
|
+
const {
|
|
95
|
+
hrefAttrs,
|
|
96
|
+
rest: unusedRest
|
|
97
|
+
} = _componentsBase.hrefAttrsProp.bundle(rest);
|
|
98
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_componentsBase.PressableCardBase, {
|
|
99
|
+
onPress: onPress,
|
|
100
|
+
href: href,
|
|
101
|
+
hrefAttrs: hrefAttrs,
|
|
102
|
+
tokens: getPressableCardTokens,
|
|
103
|
+
ref: ref,
|
|
104
|
+
...selectProps(unusedRest),
|
|
105
|
+
children: cardState => {
|
|
106
|
+
const {
|
|
107
|
+
borderRadius,
|
|
108
|
+
borderWidth
|
|
109
|
+
} = getPressableCardTokens(cardState);
|
|
110
|
+
// Stop content jumping around as border size changes
|
|
111
|
+
const borderOffset = borderWidth - theme.tokens.borderWidth;
|
|
112
|
+
const fullBleedBorderRadius = (0, _FullBleedContent.getFullBleedBorderRadius)(borderRadius + borderOffset, fullBleedContentPosition);
|
|
113
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsxs)(_componentsBase.StackView, {
|
|
114
|
+
direction: contentStackDirection,
|
|
115
|
+
tokens: {
|
|
116
|
+
justifyContent: 'space-between',
|
|
117
|
+
flexGrow: 1
|
|
118
|
+
},
|
|
119
|
+
children: [/*#__PURE__*/(0, _jsxRuntime.jsxs)(_componentsBase.Box, {
|
|
120
|
+
horizontal: {
|
|
121
|
+
xs: 4,
|
|
122
|
+
lg: 5,
|
|
123
|
+
options: {
|
|
124
|
+
subtract: borderOffset
|
|
125
|
+
}
|
|
126
|
+
},
|
|
127
|
+
vertical: {
|
|
128
|
+
xs: 5,
|
|
129
|
+
lg: 7,
|
|
130
|
+
options: {
|
|
131
|
+
subtract: borderOffset
|
|
132
|
+
}
|
|
133
|
+
},
|
|
134
|
+
children: [Boolean(tag) && /*#__PURE__*/(0, _jsxRuntime.jsxs)(_jsxRuntime.Fragment, {
|
|
135
|
+
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_componentsBase.Typography, {
|
|
136
|
+
variant: {
|
|
137
|
+
size: 'eyebrow'
|
|
138
|
+
},
|
|
139
|
+
children: tag
|
|
140
|
+
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_componentsBase.Spacer, {
|
|
141
|
+
space: 2
|
|
142
|
+
})]
|
|
143
|
+
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_componentsBase.Typography, {
|
|
144
|
+
variant: {
|
|
145
|
+
size: 'h4'
|
|
146
|
+
},
|
|
147
|
+
children: title
|
|
148
|
+
}), Boolean(footer) && /*#__PURE__*/(0, _jsxRuntime.jsxs)(_jsxRuntime.Fragment, {
|
|
149
|
+
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_componentsBase.Spacer, {
|
|
150
|
+
space: 2
|
|
151
|
+
}), typeof footer === 'string' ? /*#__PURE__*/(0, _jsxRuntime.jsx)(_componentsBase.Typography, {
|
|
152
|
+
variant: {
|
|
153
|
+
size: 'small'
|
|
154
|
+
},
|
|
155
|
+
children: footer
|
|
156
|
+
}) : footer]
|
|
157
|
+
})]
|
|
158
|
+
}), Boolean(fullBleedContentProps.src || fullBleedContentProps.content) && /*#__PURE__*/(0, _jsxRuntime.jsx)(FullBleedOffsetOuter, {
|
|
159
|
+
borderOffset: borderOffset,
|
|
160
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(FullBleedOffsetInner, {
|
|
161
|
+
borderOffset: borderOffset,
|
|
162
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_FullBleedContent.default, {
|
|
163
|
+
borderRadius: fullBleedBorderRadius,
|
|
164
|
+
...fullBleedContentProps
|
|
165
|
+
})
|
|
166
|
+
})
|
|
167
|
+
})]
|
|
168
|
+
});
|
|
169
|
+
}
|
|
170
|
+
});
|
|
171
|
+
});
|
|
172
|
+
PreviewCard.displayName = 'PreviewCard';
|
|
173
|
+
|
|
174
|
+
// Provide standard author/date footer as a preset with the export
|
|
175
|
+
PreviewCard.AuthorDate = _AuthorDate.default;
|
|
176
|
+
PreviewCard.propTypes = {
|
|
177
|
+
...selectedSystemPropTypes,
|
|
178
|
+
tokens: (0, _componentsBase.getTokensPropType)('PreviewCard'),
|
|
179
|
+
/**
|
|
180
|
+
* The URL of the story to be navigated to. Note that `Video` component does not play well when used within
|
|
181
|
+
* a `PreviewCard` with `href` prop set (the volume and progress sliders can be clicked but are not draggable).
|
|
182
|
+
* Please use `onPress` prop instead `href` to organize navigation in cases like this.
|
|
183
|
+
*
|
|
184
|
+
* @see https://github.com/telus/allium-design-system/issues/6
|
|
185
|
+
*/
|
|
186
|
+
href: _propTypes.default.string,
|
|
187
|
+
/**
|
|
188
|
+
* Optional function to be called on press e.g. for within-page navigation.
|
|
189
|
+
*/
|
|
190
|
+
onPress: _propTypes.default.func,
|
|
191
|
+
/**
|
|
192
|
+
* Text stating the category of the content.
|
|
193
|
+
*/
|
|
194
|
+
tag: _propTypes.default.string,
|
|
195
|
+
/**
|
|
196
|
+
* Section containing additional information, such as author and date.
|
|
197
|
+
* Use `<PreviewCard.AuthorDate author={...} date={...} />` here for author and date.
|
|
198
|
+
*/
|
|
199
|
+
footer: _propTypes.default.oneOfType([_propTypes.default.node, _propTypes.default.string]),
|
|
200
|
+
/**
|
|
201
|
+
* Text stating the title or headline of the story.
|
|
202
|
+
*/
|
|
203
|
+
title: _propTypes.default.string.isRequired,
|
|
204
|
+
/**
|
|
205
|
+
* Full bleed image to be placed on the card, deprecated in favor of `fullBleedContent`.
|
|
206
|
+
*
|
|
207
|
+
* @deprecated
|
|
208
|
+
*/
|
|
209
|
+
fullBleedImage: _propTypes.default.exact(_FullBleedContent.default.propTypes || {}),
|
|
210
|
+
/**
|
|
211
|
+
* Full bleed content to be placed on the card.
|
|
212
|
+
*/
|
|
213
|
+
fullBleedContent: _propTypes.default.exact(_FullBleedContent.default.propTypes || {})
|
|
214
|
+
};
|
|
215
|
+
var _default = exports.default = (0, _componentsBase.withLinkRouter)(PreviewCard);
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.default = void 0;
|
|
7
|
+
var _PreviewCard = _interopRequireDefault(require("./PreviewCard"));
|
|
8
|
+
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
9
|
+
var _default = exports.default = _PreviewCard.default;
|
|
@@ -0,0 +1,356 @@
|
|
|
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 _FootnoteLink = _interopRequireDefault(require("../Footnote/FootnoteLink"));
|
|
12
|
+
var _tokens = _interopRequireDefault(require("./tokens"));
|
|
13
|
+
var _utils = require("../utils");
|
|
14
|
+
var _jsxRuntime = require("react/jsx-runtime");
|
|
15
|
+
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
16
|
+
const [selectProps, selectedSystemPropTypes] = (0, _componentsBase.selectSystemProps)([_utils.htmlAttrs]);
|
|
17
|
+
const PriceLockupContainer = /*#__PURE__*/_styledComponents.default.div.withConfig({
|
|
18
|
+
displayName: "PriceLockup__PriceLockupContainer",
|
|
19
|
+
componentId: "components-web__sc-1x6duay-0"
|
|
20
|
+
})(["align-items:", ";display:flex;flex-direction:column;width:fit-content;"], _ref => {
|
|
21
|
+
let {
|
|
22
|
+
alignItemsText
|
|
23
|
+
} = _ref;
|
|
24
|
+
return alignItemsText;
|
|
25
|
+
});
|
|
26
|
+
const PriceContainer = /*#__PURE__*/_styledComponents.default.div.withConfig({
|
|
27
|
+
displayName: "PriceLockup__PriceContainer",
|
|
28
|
+
componentId: "components-web__sc-1x6duay-1"
|
|
29
|
+
})(["display:flex;margin-bottom:", ";"], _ref2 => {
|
|
30
|
+
let {
|
|
31
|
+
priceMarginBottom
|
|
32
|
+
} = _ref2;
|
|
33
|
+
return priceMarginBottom;
|
|
34
|
+
});
|
|
35
|
+
const FootnoteContainer = /*#__PURE__*/_styledComponents.default.div.withConfig({
|
|
36
|
+
displayName: "PriceLockup__FootnoteContainer",
|
|
37
|
+
componentId: "components-web__sc-1x6duay-2"
|
|
38
|
+
})(["display:flex;margin-top:", ";gap:", ";"], _ref3 => {
|
|
39
|
+
let {
|
|
40
|
+
footnoteMarginTop
|
|
41
|
+
} = _ref3;
|
|
42
|
+
return footnoteMarginTop;
|
|
43
|
+
}, _ref4 => {
|
|
44
|
+
let {
|
|
45
|
+
footnoteGap
|
|
46
|
+
} = _ref4;
|
|
47
|
+
return footnoteGap;
|
|
48
|
+
});
|
|
49
|
+
const BottomTextContainer = /*#__PURE__*/_styledComponents.default.div.withConfig({
|
|
50
|
+
displayName: "PriceLockup__BottomTextContainer",
|
|
51
|
+
componentId: "components-web__sc-1x6duay-3"
|
|
52
|
+
})(["margin-top:", ";"], _ref5 => {
|
|
53
|
+
let {
|
|
54
|
+
bottomTextMarginTop
|
|
55
|
+
} = _ref5;
|
|
56
|
+
return bottomTextMarginTop;
|
|
57
|
+
});
|
|
58
|
+
const BottomLinksContainer = /*#__PURE__*/_styledComponents.default.div.withConfig({
|
|
59
|
+
displayName: "PriceLockup__BottomLinksContainer",
|
|
60
|
+
componentId: "components-web__sc-1x6duay-4"
|
|
61
|
+
})(["align-self:center;margin-left:", ";"], _ref6 => {
|
|
62
|
+
let {
|
|
63
|
+
bottomLinksMarginLeft
|
|
64
|
+
} = _ref6;
|
|
65
|
+
return bottomLinksMarginLeft;
|
|
66
|
+
});
|
|
67
|
+
const TopTextContainer = /*#__PURE__*/_styledComponents.default.div.withConfig({
|
|
68
|
+
displayName: "PriceLockup__TopTextContainer",
|
|
69
|
+
componentId: "components-web__sc-1x6duay-5"
|
|
70
|
+
})(["margin-bottom:", ";"], _ref7 => {
|
|
71
|
+
let {
|
|
72
|
+
topTextMarginBottom
|
|
73
|
+
} = _ref7;
|
|
74
|
+
return topTextMarginBottom;
|
|
75
|
+
});
|
|
76
|
+
const PriceTextContainer = /*#__PURE__*/_styledComponents.default.div.withConfig({
|
|
77
|
+
displayName: "PriceLockup__PriceTextContainer",
|
|
78
|
+
componentId: "components-web__sc-1x6duay-6"
|
|
79
|
+
})(["display:flex;flex-direction:", ";"], _ref8 => {
|
|
80
|
+
let {
|
|
81
|
+
ratePosition
|
|
82
|
+
} = _ref8;
|
|
83
|
+
return ratePosition === 'bottom' ? 'column' : 'row';
|
|
84
|
+
});
|
|
85
|
+
const RateContainer = /*#__PURE__*/_styledComponents.default.div.withConfig({
|
|
86
|
+
displayName: "PriceLockup__RateContainer",
|
|
87
|
+
componentId: "components-web__sc-1x6duay-7"
|
|
88
|
+
})(["display:flex;"]);
|
|
89
|
+
const RateTextContainer = /*#__PURE__*/_styledComponents.default.div.withConfig({
|
|
90
|
+
displayName: "PriceLockup__RateTextContainer",
|
|
91
|
+
componentId: "components-web__sc-1x6duay-8"
|
|
92
|
+
})(["align-self:", ";"], _ref9 => {
|
|
93
|
+
let {
|
|
94
|
+
ratePosition
|
|
95
|
+
} = _ref9;
|
|
96
|
+
return ratePosition === 'bottom' ? 'flex-start' : 'flex-end';
|
|
97
|
+
});
|
|
98
|
+
const StrikeThroughContainer = /*#__PURE__*/_styledComponents.default.div.withConfig({
|
|
99
|
+
displayName: "PriceLockup__StrikeThroughContainer",
|
|
100
|
+
componentId: "components-web__sc-1x6duay-9"
|
|
101
|
+
})(["display:flex;position:relative;align-items:center;::before{content:'';width:100%;top:", ";height:", ";background:", ";position:absolute;}"], _ref10 => {
|
|
102
|
+
let {
|
|
103
|
+
strikeThroughPosition
|
|
104
|
+
} = _ref10;
|
|
105
|
+
return `${strikeThroughPosition}px`;
|
|
106
|
+
}, _ref11 => {
|
|
107
|
+
let {
|
|
108
|
+
strikeThroughHeight
|
|
109
|
+
} = _ref11;
|
|
110
|
+
return `${strikeThroughHeight}px`;
|
|
111
|
+
}, _ref12 => {
|
|
112
|
+
let {
|
|
113
|
+
strikeThroughColor
|
|
114
|
+
} = _ref12;
|
|
115
|
+
return strikeThroughColor;
|
|
116
|
+
});
|
|
117
|
+
const TypographyContainer = /*#__PURE__*/_styledComponents.default.div.withConfig({
|
|
118
|
+
displayName: "PriceLockup__TypographyContainer",
|
|
119
|
+
componentId: "components-web__sc-1x6duay-10"
|
|
120
|
+
})(["display:flex;padding-top:", ";"], _ref13 => {
|
|
121
|
+
let {
|
|
122
|
+
paddingTop
|
|
123
|
+
} = _ref13;
|
|
124
|
+
return `${paddingTop || 0}px`;
|
|
125
|
+
});
|
|
126
|
+
const selectFootnoteLinkStyles = _ref14 => {
|
|
127
|
+
let {
|
|
128
|
+
footnoteLinkColor,
|
|
129
|
+
footnoteLinkFontName,
|
|
130
|
+
footnoteLinkFontWeight,
|
|
131
|
+
footnoteLinkLineHeight
|
|
132
|
+
} = _ref14;
|
|
133
|
+
return {
|
|
134
|
+
color: footnoteLinkColor,
|
|
135
|
+
fontName: footnoteLinkFontName,
|
|
136
|
+
fontWeight: footnoteLinkFontWeight,
|
|
137
|
+
lineHeight: footnoteLinkLineHeight
|
|
138
|
+
};
|
|
139
|
+
};
|
|
140
|
+
const selectStrikeThroughTokens = _ref15 => {
|
|
141
|
+
let {
|
|
142
|
+
strikeThroughPosition,
|
|
143
|
+
strikeThroughHeight,
|
|
144
|
+
strikeThroughColor
|
|
145
|
+
} = _ref15;
|
|
146
|
+
return {
|
|
147
|
+
strikeThroughHeight,
|
|
148
|
+
strikeThroughPosition,
|
|
149
|
+
strikeThroughColor
|
|
150
|
+
};
|
|
151
|
+
};
|
|
152
|
+
const PriceLockup = /*#__PURE__*/_react.default.forwardRef((_ref16, ref) => {
|
|
153
|
+
let {
|
|
154
|
+
size = 'medium',
|
|
155
|
+
signDirection = 'left',
|
|
156
|
+
footnoteLinks = [],
|
|
157
|
+
topText,
|
|
158
|
+
price,
|
|
159
|
+
currencySymbol = '$',
|
|
160
|
+
rateText,
|
|
161
|
+
ratePosition = 'right',
|
|
162
|
+
bottomText,
|
|
163
|
+
onClickFootnote,
|
|
164
|
+
strikeThrough,
|
|
165
|
+
a11yText,
|
|
166
|
+
tokens: priceLockupTokens,
|
|
167
|
+
variant = {},
|
|
168
|
+
...rest
|
|
169
|
+
} = _ref16;
|
|
170
|
+
const viewport = (0, _componentsBase.useViewport)();
|
|
171
|
+
const {
|
|
172
|
+
footnoteMarginTop,
|
|
173
|
+
footnoteGap,
|
|
174
|
+
bottomTextMarginTop,
|
|
175
|
+
priceMarginBottom,
|
|
176
|
+
bottomLinksMarginLeft,
|
|
177
|
+
topTextMarginBottom,
|
|
178
|
+
fontColor,
|
|
179
|
+
dividerColor,
|
|
180
|
+
footnoteLinkFontSize,
|
|
181
|
+
alignItemsText,
|
|
182
|
+
...themeTokens
|
|
183
|
+
} = (0, _componentsBase.useThemeTokens)('PriceLockup', priceLockupTokens, {
|
|
184
|
+
...variant,
|
|
185
|
+
size
|
|
186
|
+
}, {
|
|
187
|
+
viewport,
|
|
188
|
+
strikeThrough
|
|
189
|
+
});
|
|
190
|
+
const typographyTokens = (0, _tokens.default)(themeTokens);
|
|
191
|
+
const priceString = String(price);
|
|
192
|
+
const lastDotPosition = priceString.lastIndexOf('.');
|
|
193
|
+
const lastCommaPosition = priceString.lastIndexOf(',');
|
|
194
|
+
const [separator, separatorPosition] = lastDotPosition > lastCommaPosition ? ['.', lastDotPosition] : [',', lastCommaPosition];
|
|
195
|
+
|
|
196
|
+
// If the separator is at the fourth character from the end of the string or more, it's most probably
|
|
197
|
+
// a part of the amount, and the cents are not included in the price string
|
|
198
|
+
const hasCents = separatorPosition !== -1 && separatorPosition >= priceString.length - 3;
|
|
199
|
+
const amount = hasCents ? priceString.substring(0, separatorPosition) : priceString;
|
|
200
|
+
const cents = hasCents ? priceString.substring(separatorPosition + 1) : null;
|
|
201
|
+
const renderTypography = (value, tokens, position) => {
|
|
202
|
+
const {
|
|
203
|
+
paddingTop,
|
|
204
|
+
...restOfTokens
|
|
205
|
+
} = tokens;
|
|
206
|
+
const customProps = position === 'bottom' ? {
|
|
207
|
+
variant: {
|
|
208
|
+
size: 'micro'
|
|
209
|
+
},
|
|
210
|
+
tokens: {
|
|
211
|
+
color: fontColor
|
|
212
|
+
}
|
|
213
|
+
} : {
|
|
214
|
+
tokens: {
|
|
215
|
+
...restOfTokens,
|
|
216
|
+
color: fontColor
|
|
217
|
+
}
|
|
218
|
+
};
|
|
219
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsx)(TypographyContainer, {
|
|
220
|
+
paddingTop: paddingTop,
|
|
221
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_componentsBase.Typography, {
|
|
222
|
+
...customProps,
|
|
223
|
+
children: value
|
|
224
|
+
})
|
|
225
|
+
});
|
|
226
|
+
};
|
|
227
|
+
const renderCurrencySymbol = () => renderTypography(`${currencySymbol}`, typographyTokens.dollarSign);
|
|
228
|
+
const renderFootnoteLinks = () => footnoteLinks && footnoteLinks.length > 0 ? /*#__PURE__*/(0, _jsxRuntime.jsx)(_FootnoteLink.default, {
|
|
229
|
+
fontSize: footnoteLinkFontSize,
|
|
230
|
+
tokens: selectFootnoteLinkStyles(themeTokens),
|
|
231
|
+
number: footnoteLinks,
|
|
232
|
+
onClick: onClickFootnote
|
|
233
|
+
}) : null;
|
|
234
|
+
const renderAmount = () => {
|
|
235
|
+
const amountComponent = renderTypography(amount, typographyTokens.amount);
|
|
236
|
+
if (strikeThrough) {
|
|
237
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsxs)(_jsxRuntime.Fragment, {
|
|
238
|
+
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_componentsBase.A11yText, {
|
|
239
|
+
text: a11yText
|
|
240
|
+
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(StrikeThroughContainer, {
|
|
241
|
+
...selectStrikeThroughTokens(themeTokens),
|
|
242
|
+
children: amountComponent
|
|
243
|
+
})]
|
|
244
|
+
});
|
|
245
|
+
}
|
|
246
|
+
return amountComponent;
|
|
247
|
+
};
|
|
248
|
+
const renderPrice = () => /*#__PURE__*/(0, _jsxRuntime.jsxs)(_jsxRuntime.Fragment, {
|
|
249
|
+
children: [/*#__PURE__*/(0, _jsxRuntime.jsxs)(PriceContainer, {
|
|
250
|
+
priceMarginBottom: `${priceMarginBottom}px`,
|
|
251
|
+
children: [/*#__PURE__*/(0, _jsxRuntime.jsxs)(PriceTextContainer, {
|
|
252
|
+
ratePosition: ratePosition,
|
|
253
|
+
children: [/*#__PURE__*/(0, _jsxRuntime.jsxs)(RateContainer, {
|
|
254
|
+
children: [signDirection === 'left' && renderCurrencySymbol(), renderAmount(), cents && renderTypography(`${separator}${cents}`, typographyTokens.cents), signDirection === 'right' && /*#__PURE__*/(0, _jsxRuntime.jsxs)(_jsxRuntime.Fragment, {
|
|
255
|
+
children: ["\xA0", renderCurrencySymbol()]
|
|
256
|
+
})]
|
|
257
|
+
}), rateText && /*#__PURE__*/(0, _jsxRuntime.jsx)(RateTextContainer, {
|
|
258
|
+
ratePosition: ratePosition,
|
|
259
|
+
children: renderTypography(rateText, typographyTokens.rate, ratePosition)
|
|
260
|
+
})]
|
|
261
|
+
}), !bottomText && footnoteLinks.length <= 3 && /*#__PURE__*/(0, _jsxRuntime.jsx)(BottomLinksContainer, {
|
|
262
|
+
bottomLinksMarginLeft: `${bottomLinksMarginLeft}px`,
|
|
263
|
+
children: renderFootnoteLinks()
|
|
264
|
+
})]
|
|
265
|
+
}), !bottomText && footnoteLinks.length > 3 && renderFootnoteLinks()]
|
|
266
|
+
});
|
|
267
|
+
const renderFootnoteContent = () => /*#__PURE__*/(0, _jsxRuntime.jsxs)(_jsxRuntime.Fragment, {
|
|
268
|
+
children: [/*#__PURE__*/(0, _jsxRuntime.jsxs)(FootnoteContainer, {
|
|
269
|
+
footnoteMarginTop: `${footnoteMarginTop}px`,
|
|
270
|
+
footnoteGap: `${footnoteGap}px`,
|
|
271
|
+
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(BottomTextContainer, {
|
|
272
|
+
bottomTextMarginTop: `${bottomTextMarginTop}px`,
|
|
273
|
+
children: renderTypography(bottomText, typographyTokens.bottomText)
|
|
274
|
+
}), footnoteLinks.length <= 3 && renderFootnoteLinks()]
|
|
275
|
+
}), footnoteLinks.length > 3 && renderFootnoteLinks()]
|
|
276
|
+
});
|
|
277
|
+
if (strikeThrough && !a11yText) {
|
|
278
|
+
(0, _utils.warn)('PriceLockup', 'a11yText must be provided with strikethrough pricing');
|
|
279
|
+
}
|
|
280
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsxs)(PriceLockupContainer, {
|
|
281
|
+
...selectProps(rest),
|
|
282
|
+
alignItemsText: alignItemsText,
|
|
283
|
+
ref: ref,
|
|
284
|
+
children: [topText && /*#__PURE__*/(0, _jsxRuntime.jsx)(TopTextContainer, {
|
|
285
|
+
topTextMarginBottom: `${topTextMarginBottom}px`,
|
|
286
|
+
children: renderTypography(topText, typographyTokens.topText)
|
|
287
|
+
}), renderPrice(), bottomText && /*#__PURE__*/(0, _jsxRuntime.jsx)(_componentsBase.Divider, {
|
|
288
|
+
testID: "price-lockup-divider",
|
|
289
|
+
role: "separator",
|
|
290
|
+
tokens: {
|
|
291
|
+
color: dividerColor ?? 'rgba(0, 0, 0, 0)'
|
|
292
|
+
}
|
|
293
|
+
}), bottomText && renderFootnoteContent()]
|
|
294
|
+
});
|
|
295
|
+
});
|
|
296
|
+
PriceLockup.displayName = 'PriceLockup';
|
|
297
|
+
PriceLockup.propTypes = {
|
|
298
|
+
...selectedSystemPropTypes,
|
|
299
|
+
/**
|
|
300
|
+
* Size of the component
|
|
301
|
+
*
|
|
302
|
+
* Micro for mini cart pricing, small for pricing in product catalogue pages, medium for pricing in product comparison cards and large for pricing in banners and promo cards
|
|
303
|
+
*/
|
|
304
|
+
size: _propTypes.default.oneOf(['micro', 'small', 'medium', 'large']),
|
|
305
|
+
/**
|
|
306
|
+
* If currency symbol other than `$` to be used
|
|
307
|
+
*/
|
|
308
|
+
currencySymbol: _propTypes.default.string,
|
|
309
|
+
/**
|
|
310
|
+
* Shows additional info above the price
|
|
311
|
+
*/
|
|
312
|
+
topText: _propTypes.default.string,
|
|
313
|
+
/**
|
|
314
|
+
* Monetary value (including decimals separated by ".")
|
|
315
|
+
*/
|
|
316
|
+
price: _propTypes.default.string.isRequired,
|
|
317
|
+
/**
|
|
318
|
+
* Shows month/year unit
|
|
319
|
+
*/
|
|
320
|
+
rateText: _propTypes.default.string,
|
|
321
|
+
/**
|
|
322
|
+
* Shows additional info below the price with a `Divider`
|
|
323
|
+
*/
|
|
324
|
+
bottomText: _propTypes.default.string,
|
|
325
|
+
/**
|
|
326
|
+
* Displays which side the currency should apperar (left, right)
|
|
327
|
+
*/
|
|
328
|
+
signDirection: _propTypes.default.oneOf(['right', 'left']),
|
|
329
|
+
/**
|
|
330
|
+
* Displays where the rate should apperar (bottom, right)
|
|
331
|
+
*/
|
|
332
|
+
ratePosition: _propTypes.default.oneOf(['right', 'bottom']),
|
|
333
|
+
/**
|
|
334
|
+
* Shows additional link for context
|
|
335
|
+
*/
|
|
336
|
+
footnoteLinks: _propTypes.default.arrayOf(_propTypes.default.oneOfType([_propTypes.default.number, _propTypes.default.string])),
|
|
337
|
+
/**
|
|
338
|
+
* Function to be called when a footnote link is clicked
|
|
339
|
+
*/
|
|
340
|
+
onClickFootnote: _propTypes.default.func,
|
|
341
|
+
/**
|
|
342
|
+
* To show price savings comparison
|
|
343
|
+
*/
|
|
344
|
+
strikeThrough: _propTypes.default.bool,
|
|
345
|
+
/**
|
|
346
|
+
* To provide a11y text for `PriceLockup` component
|
|
347
|
+
*
|
|
348
|
+
* **Note:** a11yText will override strikethrough price, so it must include price (ie. "was 50 dollars per month")
|
|
349
|
+
*/
|
|
350
|
+
a11yText: _propTypes.default.string,
|
|
351
|
+
/**
|
|
352
|
+
* `PriceLockup` tokens
|
|
353
|
+
*/
|
|
354
|
+
tokens: (0, _componentsBase.getTokensPropType)('PriceLockup')
|
|
355
|
+
};
|
|
356
|
+
var _default = exports.default = PriceLockup;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.default = void 0;
|
|
7
|
+
var _PriceLockup = _interopRequireDefault(require("./PriceLockup"));
|
|
8
|
+
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
9
|
+
var _default = exports.default = _PriceLockup.default;
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.default = void 0;
|
|
7
|
+
// map typography tokens accordenly
|
|
8
|
+
var _default = _ref => {
|
|
9
|
+
let {
|
|
10
|
+
topTextFontSize,
|
|
11
|
+
fontColor,
|
|
12
|
+
topTextLineHeight,
|
|
13
|
+
currencySymbolFontSize,
|
|
14
|
+
currencySymbolLineHeight,
|
|
15
|
+
currencySymbolFontWeight,
|
|
16
|
+
currencySymbolPaddingTop,
|
|
17
|
+
amountFontSize,
|
|
18
|
+
amountLineHeight,
|
|
19
|
+
amountLetterSpacing,
|
|
20
|
+
amountFontWeight,
|
|
21
|
+
centsFontSize,
|
|
22
|
+
centsLineHeight,
|
|
23
|
+
centsPaddingTop,
|
|
24
|
+
rateFontSize,
|
|
25
|
+
rateLineHeight,
|
|
26
|
+
bottomTextFontSize,
|
|
27
|
+
bottomTextLineHeight,
|
|
28
|
+
rateFontWeight,
|
|
29
|
+
centsFontWeight
|
|
30
|
+
} = _ref;
|
|
31
|
+
return {
|
|
32
|
+
topText: {
|
|
33
|
+
fontSize: topTextFontSize,
|
|
34
|
+
lineHeight: topTextLineHeight
|
|
35
|
+
},
|
|
36
|
+
dollarSign: {
|
|
37
|
+
fontSize: currencySymbolFontSize,
|
|
38
|
+
lineHeight: currencySymbolLineHeight,
|
|
39
|
+
fontWeight: currencySymbolFontWeight,
|
|
40
|
+
paddingTop: currencySymbolPaddingTop
|
|
41
|
+
},
|
|
42
|
+
amount: {
|
|
43
|
+
color: fontColor,
|
|
44
|
+
fontSize: amountFontSize,
|
|
45
|
+
lineHeight: amountLineHeight,
|
|
46
|
+
letterSpacing: amountLetterSpacing,
|
|
47
|
+
fontWeight: amountFontWeight
|
|
48
|
+
},
|
|
49
|
+
cents: {
|
|
50
|
+
fontSize: centsFontSize,
|
|
51
|
+
lineHeight: centsLineHeight,
|
|
52
|
+
fontWeight: centsFontWeight,
|
|
53
|
+
paddingTop: centsPaddingTop
|
|
54
|
+
},
|
|
55
|
+
rate: {
|
|
56
|
+
fontSize: rateFontSize,
|
|
57
|
+
lineHeight: rateLineHeight,
|
|
58
|
+
fontWeight: rateFontWeight
|
|
59
|
+
},
|
|
60
|
+
bottomText: {
|
|
61
|
+
fontSize: bottomTextFontSize,
|
|
62
|
+
lineHeight: bottomTextLineHeight
|
|
63
|
+
}
|
|
64
|
+
};
|
|
65
|
+
};
|
|
66
|
+
exports.default = _default;
|