@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,525 @@
|
|
|
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 _reactMomentProptypes = _interopRequireDefault(require("react-moment-proptypes"));
|
|
10
|
+
require("react-dates/initialize");
|
|
11
|
+
var _reactDates = require("react-dates");
|
|
12
|
+
var _componentsBase = require("@telus-uds/components-base");
|
|
13
|
+
var _styledComponents = _interopRequireDefault(require("styled-components"));
|
|
14
|
+
var _moment = _interopRequireDefault(require("moment"));
|
|
15
|
+
var _lodash = require("lodash");
|
|
16
|
+
var _CalendarContainer = _interopRequireDefault(require("./CalendarContainer"));
|
|
17
|
+
var _dictionary = _interopRequireDefault(require("./dictionary"));
|
|
18
|
+
var _utils = require("../utils");
|
|
19
|
+
var _jsxRuntime = require("react/jsx-runtime");
|
|
20
|
+
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
21
|
+
const [selectProps, selectedSystemPropTypes] = (0, _componentsBase.selectSystemProps)([_utils.htmlAttrs]);
|
|
22
|
+
const getResponsiveDaySize = function () {
|
|
23
|
+
let inline = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false;
|
|
24
|
+
let viewport = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 'md';
|
|
25
|
+
if (viewport === 'xs') {
|
|
26
|
+
return inline ? undefined : 36;
|
|
27
|
+
}
|
|
28
|
+
return inline ? 60 : 44;
|
|
29
|
+
};
|
|
30
|
+
const getResponsiveCircleSize = function () {
|
|
31
|
+
let inline = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false;
|
|
32
|
+
let viewport = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 'md';
|
|
33
|
+
if (viewport === 'xs') {
|
|
34
|
+
return 26;
|
|
35
|
+
}
|
|
36
|
+
return inline ? 44 : 26;
|
|
37
|
+
};
|
|
38
|
+
const MonthCenterContainer = /*#__PURE__*/_styledComponents.default.div.withConfig({
|
|
39
|
+
displayName: "DatePicker__MonthCenterContainer",
|
|
40
|
+
componentId: "components-web__sc-mz8fi3-0"
|
|
41
|
+
})({
|
|
42
|
+
display: 'flex',
|
|
43
|
+
justifyContent: 'center'
|
|
44
|
+
});
|
|
45
|
+
const DateInputWrapper = /*#__PURE__*/_styledComponents.default.div.withConfig({
|
|
46
|
+
displayName: "DatePicker__DateInputWrapper",
|
|
47
|
+
componentId: "components-web__sc-mz8fi3-1"
|
|
48
|
+
})({
|
|
49
|
+
display: 'flex',
|
|
50
|
+
flexDirection: 'column'
|
|
51
|
+
});
|
|
52
|
+
const PortalPositionedContainer = /*#__PURE__*/_styledComponents.default.div.withConfig({
|
|
53
|
+
displayName: "DatePicker__PortalPositionedContainer",
|
|
54
|
+
componentId: "components-web__sc-mz8fi3-2"
|
|
55
|
+
})({
|
|
56
|
+
position: 'absolute',
|
|
57
|
+
left: _ref => {
|
|
58
|
+
let {
|
|
59
|
+
left
|
|
60
|
+
} = _ref;
|
|
61
|
+
return `${left}px`;
|
|
62
|
+
},
|
|
63
|
+
top: _ref2 => {
|
|
64
|
+
let {
|
|
65
|
+
top
|
|
66
|
+
} = _ref2;
|
|
67
|
+
return `${top}px`;
|
|
68
|
+
}
|
|
69
|
+
});
|
|
70
|
+
const getInitialVisibleMonth = (initialVisibleMonth, inputDate) => {
|
|
71
|
+
if (initialVisibleMonth === '' || inputDate instanceof _moment.default) {
|
|
72
|
+
return null;
|
|
73
|
+
}
|
|
74
|
+
return () => (0, _moment.default)(initialVisibleMonth);
|
|
75
|
+
};
|
|
76
|
+
|
|
77
|
+
/**
|
|
78
|
+
* Use DatePicker to select a date on a calendar.
|
|
79
|
+
*
|
|
80
|
+
* ## Usage Criteria
|
|
81
|
+
*
|
|
82
|
+
* - Use DatePicker to select a date on a calendar
|
|
83
|
+
* - Available in 2 formats: Overlay and Inline
|
|
84
|
+
*
|
|
85
|
+
* ### Overlay DatePicker
|
|
86
|
+
* - Use Overlay to display in a modal container
|
|
87
|
+
* - Use Overlay whenever possible as it is the most accessible solution; the input form field is type-accessible and optimized for mobile customers
|
|
88
|
+
* - Includes an input form field to allow manual key-in of dates
|
|
89
|
+
* - Opens the modal when the input form field receives focus
|
|
90
|
+
* - Width expands 100% until max-width of 340px
|
|
91
|
+
*
|
|
92
|
+
* ### Inline DatePicker
|
|
93
|
+
* - Use Inline to display the DatePicker in a larger vieweable area; allows the customer to quickly and easily date availability
|
|
94
|
+
* - Does not include an input form field
|
|
95
|
+
* - Optimized for keyboard interaction and tablet touch
|
|
96
|
+
* - Recommended for viewports greater than or equal to 576px
|
|
97
|
+
*/
|
|
98
|
+
const DatePicker = /*#__PURE__*/_react.default.forwardRef((_ref3, ref) => {
|
|
99
|
+
let {
|
|
100
|
+
copy = 'en',
|
|
101
|
+
id,
|
|
102
|
+
date,
|
|
103
|
+
dateFormat = 'DD / MM / YYYY',
|
|
104
|
+
feedback,
|
|
105
|
+
inline = false,
|
|
106
|
+
isDayDisabled,
|
|
107
|
+
label,
|
|
108
|
+
onDateChange = () => {},
|
|
109
|
+
hint,
|
|
110
|
+
hintPosition = 'inline',
|
|
111
|
+
tooltip,
|
|
112
|
+
tokens,
|
|
113
|
+
variant = {},
|
|
114
|
+
validation,
|
|
115
|
+
disabled = false,
|
|
116
|
+
prevTestID = '',
|
|
117
|
+
nextTestID = '',
|
|
118
|
+
placeholder = dateFormat,
|
|
119
|
+
initialVisibleMonth = '',
|
|
120
|
+
...rest
|
|
121
|
+
} = _ref3;
|
|
122
|
+
const [inputDate, setInputDate] = _react.default.useState(date instanceof _moment.default ? date : undefined);
|
|
123
|
+
const [inputText, setInputText] = _react.default.useState(date instanceof _moment.default ? date.format(dateFormat) : '');
|
|
124
|
+
const dateFormatWithoutSpaces = dateFormat.replace(/\s/g, '');
|
|
125
|
+
const textInputRef = _react.default.useRef();
|
|
126
|
+
const prevButtonRef = _react.default.useRef();
|
|
127
|
+
const [datePickerPosition, setDatePickerPosition] = _react.default.useState({
|
|
128
|
+
left: 0,
|
|
129
|
+
top: 0
|
|
130
|
+
});
|
|
131
|
+
const datePickerRef = _react.default.useRef(null);
|
|
132
|
+
(0, _componentsBase.useSafeLayoutEffect)(() => {
|
|
133
|
+
const updateDatePickerPosition = () => {
|
|
134
|
+
if (inline || !textInputRef?.current) return;
|
|
135
|
+
const {
|
|
136
|
+
left,
|
|
137
|
+
top
|
|
138
|
+
} = textInputRef.current.getBoundingClientRect();
|
|
139
|
+
const inputTop = top + window.scrollY;
|
|
140
|
+
const inputLeft = left + window.scrollX;
|
|
141
|
+
setDatePickerPosition({
|
|
142
|
+
top: inputTop + textInputRef.current.offsetHeight,
|
|
143
|
+
left: inputLeft
|
|
144
|
+
});
|
|
145
|
+
};
|
|
146
|
+
const throttledUpdate = (0, _lodash.throttle)(updateDatePickerPosition, 100, {
|
|
147
|
+
leading: false
|
|
148
|
+
});
|
|
149
|
+
|
|
150
|
+
// Initial call to set the position
|
|
151
|
+
throttledUpdate();
|
|
152
|
+
|
|
153
|
+
// Register event listeners
|
|
154
|
+
window.addEventListener('resize', throttledUpdate);
|
|
155
|
+
window.addEventListener('scroll', updateDatePickerPosition, {
|
|
156
|
+
capture: true
|
|
157
|
+
});
|
|
158
|
+
return () => {
|
|
159
|
+
window.removeEventListener('resize', throttledUpdate);
|
|
160
|
+
window.removeEventListener('scroll', updateDatePickerPosition, {
|
|
161
|
+
capture: true
|
|
162
|
+
});
|
|
163
|
+
};
|
|
164
|
+
}, []);
|
|
165
|
+
const [isFocused, setIsFocused] = _react.default.useState(false);
|
|
166
|
+
const [isClickedInside, setIsClickedInside] = _react.default.useState(false);
|
|
167
|
+
const getCopy = (0, _componentsBase.useCopy)({
|
|
168
|
+
dictionary: _dictionary.default,
|
|
169
|
+
copy
|
|
170
|
+
});
|
|
171
|
+
_react.default.useEffect(() => {
|
|
172
|
+
/**
|
|
173
|
+
* `date` could be passed as `null` to reset the value so explicitly
|
|
174
|
+
* checking for not being `undefined`
|
|
175
|
+
*/
|
|
176
|
+
if (!(0, _lodash.isUndefined)(date) && !(0, _moment.default)(date).isSame(inputDate)) {
|
|
177
|
+
setInputDate(date);
|
|
178
|
+
setInputText(date instanceof _moment.default ? date.format(dateFormat) : '');
|
|
179
|
+
}
|
|
180
|
+
}, [date, inputDate, dateFormat]);
|
|
181
|
+
_react.default.useEffect(() => {
|
|
182
|
+
let timeoutId;
|
|
183
|
+
if (prevButtonRef.current && isFocused) {
|
|
184
|
+
timeoutId = setTimeout(() => prevButtonRef.current.focus(), 100);
|
|
185
|
+
}
|
|
186
|
+
return () => clearTimeout(timeoutId);
|
|
187
|
+
}, [isFocused]);
|
|
188
|
+
_react.default.useEffect(() => {
|
|
189
|
+
if (inputText !== '' && inputDate !== undefined) {
|
|
190
|
+
textInputRef?.current?.focus();
|
|
191
|
+
}
|
|
192
|
+
}, [inputDate, inputText]);
|
|
193
|
+
const onFocusChange = _ref4 => {
|
|
194
|
+
let {
|
|
195
|
+
focused
|
|
196
|
+
} = _ref4;
|
|
197
|
+
if (!isClickedInside) {
|
|
198
|
+
setIsFocused(focused);
|
|
199
|
+
}
|
|
200
|
+
setIsClickedInside(false);
|
|
201
|
+
};
|
|
202
|
+
const handleFocus = event => {
|
|
203
|
+
if (event.target.tagName === 'INPUT' && !disabled && inputDate === undefined && inputText === '') {
|
|
204
|
+
setIsFocused(true);
|
|
205
|
+
}
|
|
206
|
+
};
|
|
207
|
+
const handleMouseDown = event => {
|
|
208
|
+
if (!disabled) {
|
|
209
|
+
if (event.target.tagName === 'INPUT') {
|
|
210
|
+
setIsClickedInside(true);
|
|
211
|
+
setIsFocused(true);
|
|
212
|
+
} else if (event.target.tagName === 'path') {
|
|
213
|
+
// needed to handle the case where the user clicks on the tooltip icon
|
|
214
|
+
setIsClickedInside(true);
|
|
215
|
+
event.stopPropagation();
|
|
216
|
+
} else {
|
|
217
|
+
event.stopPropagation();
|
|
218
|
+
}
|
|
219
|
+
}
|
|
220
|
+
};
|
|
221
|
+
const onChange = value => {
|
|
222
|
+
setInputDate(value);
|
|
223
|
+
setInputText(value.format(dateFormat));
|
|
224
|
+
setIsFocused(false);
|
|
225
|
+
if (onDateChange) onDateChange(value);
|
|
226
|
+
};
|
|
227
|
+
const onChangeInput = value => {
|
|
228
|
+
if (value === '' || (0, _moment.default)(value.replace(/\s/g, ''), dateFormatWithoutSpaces, true).isValid()) {
|
|
229
|
+
if (value === '') {
|
|
230
|
+
setInputDate(undefined); // Set inputDate to undefined if input is empty
|
|
231
|
+
onDateChange?.(undefined);
|
|
232
|
+
} else {
|
|
233
|
+
setInputDate((0, _moment.default)(value, dateFormat));
|
|
234
|
+
onDateChange?.((0, _moment.default)(value, dateFormat));
|
|
235
|
+
}
|
|
236
|
+
setInputText(value === '' ? '' : (0, _moment.default)(value, dateFormatWithoutSpaces).format(dateFormat));
|
|
237
|
+
} else {
|
|
238
|
+
setInputText(value);
|
|
239
|
+
}
|
|
240
|
+
};
|
|
241
|
+
const handleOnKeyPress = event => {
|
|
242
|
+
if (event.key === 'Backspace' && inputText === '') {
|
|
243
|
+
setInputDate(undefined);
|
|
244
|
+
onDateChange?.(undefined);
|
|
245
|
+
}
|
|
246
|
+
};
|
|
247
|
+
const handleValidation = inputValidation => {
|
|
248
|
+
const momentDate = (0, _moment.default)(inputText, dateFormat, true);
|
|
249
|
+
const isValidDate = momentDate.isValid();
|
|
250
|
+
if (!isValidDate && inputText !== '') {
|
|
251
|
+
return 'error';
|
|
252
|
+
}
|
|
253
|
+
if (inputValidation === 'error' || inputValidation === 'success') {
|
|
254
|
+
return inputValidation;
|
|
255
|
+
}
|
|
256
|
+
return inputValidation;
|
|
257
|
+
};
|
|
258
|
+
const viewport = (0, _componentsBase.useViewport)();
|
|
259
|
+
const daySize = getResponsiveDaySize(inline, viewport);
|
|
260
|
+
const circleSize = getResponsiveCircleSize(inline, viewport);
|
|
261
|
+
const HiddenInputFieldContainer = /*#__PURE__*/_styledComponents.default.div.withConfig({
|
|
262
|
+
displayName: "DatePicker__HiddenInputFieldContainer",
|
|
263
|
+
componentId: "components-web__sc-mz8fi3-3"
|
|
264
|
+
})(["height:", ";width:", ";overflow:hidden;"], props => props.height, props => props.width);
|
|
265
|
+
const {
|
|
266
|
+
hiddenInputFieldContainerHeight,
|
|
267
|
+
hiddenInputFieldContainerWidth,
|
|
268
|
+
previousIcon,
|
|
269
|
+
nextIcon,
|
|
270
|
+
...remainingTokens
|
|
271
|
+
} = (0, _componentsBase.useThemeTokens)('DatePicker', tokens, {
|
|
272
|
+
...variant,
|
|
273
|
+
inline
|
|
274
|
+
}, {
|
|
275
|
+
viewport
|
|
276
|
+
});
|
|
277
|
+
const defaultFontTokens = (0, _componentsBase.applyTextStyles)({
|
|
278
|
+
fontName: remainingTokens.calendarDayDefaultFontName,
|
|
279
|
+
fontWeight: remainingTokens.calendarDayDefaultFontWeight
|
|
280
|
+
});
|
|
281
|
+
const calendarMonthFontTokens = (0, _componentsBase.applyTextStyles)({
|
|
282
|
+
fontName: remainingTokens.calendarMonthCaptionFontName,
|
|
283
|
+
fontWeight: remainingTokens.calendarMonthCaptionFontWeight
|
|
284
|
+
});
|
|
285
|
+
const calendarWeekFontTokens = (0, _componentsBase.applyTextStyles)({
|
|
286
|
+
fontName: remainingTokens.dayPickerWeekHeaderFontName,
|
|
287
|
+
fontWeight: remainingTokens.dayPickerWeekHeaderFontWeight
|
|
288
|
+
});
|
|
289
|
+
const renderPrevButton = _ref5 => {
|
|
290
|
+
let {
|
|
291
|
+
onClick
|
|
292
|
+
} = _ref5;
|
|
293
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_componentsBase.IconButton, {
|
|
294
|
+
onPress: () => {
|
|
295
|
+
onClick();
|
|
296
|
+
},
|
|
297
|
+
icon: previousIcon,
|
|
298
|
+
variant: {
|
|
299
|
+
size: 'small'
|
|
300
|
+
},
|
|
301
|
+
testID: prevTestID,
|
|
302
|
+
ref: prevButtonRef
|
|
303
|
+
});
|
|
304
|
+
};
|
|
305
|
+
const renderNextButton = _ref6 => {
|
|
306
|
+
let {
|
|
307
|
+
onClick
|
|
308
|
+
} = _ref6;
|
|
309
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_componentsBase.IconButton, {
|
|
310
|
+
onPress: () => {
|
|
311
|
+
onClick();
|
|
312
|
+
},
|
|
313
|
+
icon: nextIcon,
|
|
314
|
+
variant: {
|
|
315
|
+
size: 'small'
|
|
316
|
+
},
|
|
317
|
+
testID: nextTestID
|
|
318
|
+
});
|
|
319
|
+
};
|
|
320
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_jsxRuntime.Fragment, {
|
|
321
|
+
children: inline ? /*#__PURE__*/(0, _jsxRuntime.jsxs)(_jsxRuntime.Fragment, {
|
|
322
|
+
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(HiddenInputFieldContainer, {
|
|
323
|
+
height: hiddenInputFieldContainerHeight,
|
|
324
|
+
width: hiddenInputFieldContainerWidth,
|
|
325
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsx)("input", {
|
|
326
|
+
ref: ref,
|
|
327
|
+
id: id,
|
|
328
|
+
type: "text",
|
|
329
|
+
value: inputText,
|
|
330
|
+
readOnly: true
|
|
331
|
+
})
|
|
332
|
+
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_CalendarContainer.default, {
|
|
333
|
+
...selectProps(rest),
|
|
334
|
+
daySize: daySize,
|
|
335
|
+
validation: validation,
|
|
336
|
+
remainingTokens: remainingTokens,
|
|
337
|
+
calendarDayDefaultHeight: circleSize,
|
|
338
|
+
calendarDayDefaultWidth: circleSize,
|
|
339
|
+
calendarMonthFontTokens: calendarMonthFontTokens,
|
|
340
|
+
calendarWeekFontTokens: calendarWeekFontTokens,
|
|
341
|
+
defaultFontTokens: defaultFontTokens,
|
|
342
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactDates.DayPickerSingleDateController, {
|
|
343
|
+
date: inputDate,
|
|
344
|
+
onDateChange: onChange,
|
|
345
|
+
focused: (inputDate ?? isFocused) || initialVisibleMonth !== '',
|
|
346
|
+
onFocusChange: onFocusChange,
|
|
347
|
+
numberOfMonths: 1,
|
|
348
|
+
hideKeyboardShortcutsPanel: true,
|
|
349
|
+
keepOpenOnDateSelect: false,
|
|
350
|
+
daySize: daySize,
|
|
351
|
+
renderNavPrevButton: renderPrevButton,
|
|
352
|
+
renderNavNextButton: renderNextButton,
|
|
353
|
+
isOutsideRange: isDayDisabled,
|
|
354
|
+
phrases: getCopy(),
|
|
355
|
+
initialVisibleMonth: getInitialVisibleMonth(initialVisibleMonth, inputDate),
|
|
356
|
+
renderMonthElement: _ref7 => {
|
|
357
|
+
let {
|
|
358
|
+
month
|
|
359
|
+
} = _ref7;
|
|
360
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsx)(MonthCenterContainer, {
|
|
361
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsxs)("div", {
|
|
362
|
+
children: [_dictionary.default[copy] ? _dictionary.default[copy].months[month.month()] : month.format('MMMM'), ' ', month.year()]
|
|
363
|
+
})
|
|
364
|
+
});
|
|
365
|
+
},
|
|
366
|
+
renderWeekHeaderElement: day => /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
|
|
367
|
+
children: _dictionary.default[copy] ? _dictionary.default[copy].weekDays[day] : day
|
|
368
|
+
})
|
|
369
|
+
})
|
|
370
|
+
})]
|
|
371
|
+
}) : /*#__PURE__*/(0, _jsxRuntime.jsx)(DateInputWrapper, {
|
|
372
|
+
onMouseDown: handleMouseDown,
|
|
373
|
+
onFocus: handleFocus,
|
|
374
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_componentsBase.TextInput, {
|
|
375
|
+
copy: copy,
|
|
376
|
+
feedback: feedback,
|
|
377
|
+
hint: hint,
|
|
378
|
+
placeholder: placeholder,
|
|
379
|
+
onChange: onChangeInput,
|
|
380
|
+
onKeyPress: handleOnKeyPress,
|
|
381
|
+
tooltip: tooltip,
|
|
382
|
+
hintPosition: hintPosition,
|
|
383
|
+
label: label ?? _dictionary.default[copy]?.roleDescription,
|
|
384
|
+
value: inputText,
|
|
385
|
+
validation: handleValidation(validation),
|
|
386
|
+
inactive: disabled,
|
|
387
|
+
ref: textInputRef,
|
|
388
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_componentsBase.Portal, {
|
|
389
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(PortalPositionedContainer, {
|
|
390
|
+
top: datePickerPosition.top,
|
|
391
|
+
left: datePickerPosition.left,
|
|
392
|
+
ref: datePickerRef,
|
|
393
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_CalendarContainer.default, {
|
|
394
|
+
...selectProps(rest),
|
|
395
|
+
daySize: daySize,
|
|
396
|
+
validation: validation,
|
|
397
|
+
remainingTokens: remainingTokens,
|
|
398
|
+
calendarDayDefaultHeight: circleSize,
|
|
399
|
+
calendarDayDefaultWidth: circleSize,
|
|
400
|
+
calendarMonthFontTokens: calendarMonthFontTokens,
|
|
401
|
+
calendarWeekFontTokens: calendarWeekFontTokens,
|
|
402
|
+
defaultFontTokens: defaultFontTokens,
|
|
403
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactDates.SingleDatePicker, {
|
|
404
|
+
date: inputDate,
|
|
405
|
+
disabled: disabled,
|
|
406
|
+
onDateChange: onChange,
|
|
407
|
+
focused: isFocused,
|
|
408
|
+
onFocusChange: onFocusChange,
|
|
409
|
+
numberOfMonths: 1,
|
|
410
|
+
hideKeyboardShortcutsPanel: true,
|
|
411
|
+
keepOpenOnDateSelect: true,
|
|
412
|
+
daySize: daySize,
|
|
413
|
+
ref: ref,
|
|
414
|
+
renderNavPrevButton: renderPrevButton,
|
|
415
|
+
isOutsideRange: isDayDisabled,
|
|
416
|
+
phrases: getCopy(),
|
|
417
|
+
id: id,
|
|
418
|
+
renderNavNextButton: renderNextButton,
|
|
419
|
+
initialVisibleMonth: getInitialVisibleMonth(initialVisibleMonth, inputDate),
|
|
420
|
+
renderMonthElement: _ref8 => {
|
|
421
|
+
let {
|
|
422
|
+
month
|
|
423
|
+
} = _ref8;
|
|
424
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsx)(MonthCenterContainer, {
|
|
425
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsxs)("div", {
|
|
426
|
+
children: [_dictionary.default[copy] ? _dictionary.default[copy].months[month.month()] : month.format('MMMM'), ' ', month.year()]
|
|
427
|
+
})
|
|
428
|
+
});
|
|
429
|
+
},
|
|
430
|
+
renderWeekHeaderElement: day => /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
|
|
431
|
+
children: _dictionary.default[copy] ? _dictionary.default[copy].weekDays[day] : day
|
|
432
|
+
})
|
|
433
|
+
})
|
|
434
|
+
})
|
|
435
|
+
})
|
|
436
|
+
})
|
|
437
|
+
})
|
|
438
|
+
})
|
|
439
|
+
});
|
|
440
|
+
});
|
|
441
|
+
DatePicker.displayName = 'DatePicker';
|
|
442
|
+
DatePicker.propTypes = {
|
|
443
|
+
...selectedSystemPropTypes,
|
|
444
|
+
tokens: (0, _componentsBase.getTokensPropType)('DatePicker'),
|
|
445
|
+
/**
|
|
446
|
+
* A unique identifier.
|
|
447
|
+
*/
|
|
448
|
+
id: _propTypes.default.string.isRequired,
|
|
449
|
+
/**
|
|
450
|
+
* Whether the English or French copy will be used (e.g. for accessibility labels).
|
|
451
|
+
*/
|
|
452
|
+
copy: _propTypes.default.oneOf(['en', 'fr']),
|
|
453
|
+
/**
|
|
454
|
+
* A Moment instance representing the currently selected date, i.e. `moment()`
|
|
455
|
+
*/
|
|
456
|
+
date: _reactMomentProptypes.default.momentObj,
|
|
457
|
+
/**
|
|
458
|
+
* A Moment instance representing the currently selected date, i.e. `moment()`
|
|
459
|
+
*/
|
|
460
|
+
dateFormat: _propTypes.default.string,
|
|
461
|
+
/**
|
|
462
|
+
* Optional date format for the date input. If not set, the default value will be `DD / MM / YYYY`
|
|
463
|
+
*/
|
|
464
|
+
feedback: _propTypes.default.string,
|
|
465
|
+
/**
|
|
466
|
+
* Event triggered every time a new date is clicked on
|
|
467
|
+
* @param {Moment} date The new date that was selected
|
|
468
|
+
*/
|
|
469
|
+
onDateChange: _propTypes.default.func,
|
|
470
|
+
/**
|
|
471
|
+
* A function determining whether a given date should be disabled
|
|
472
|
+
* @param {Moment} date The date to optionally disable
|
|
473
|
+
* @returns {bool}
|
|
474
|
+
*/
|
|
475
|
+
isDayDisabled: _propTypes.default.func,
|
|
476
|
+
/**
|
|
477
|
+
* The field label to be displayed above the calendar
|
|
478
|
+
*/
|
|
479
|
+
label: _propTypes.default.string,
|
|
480
|
+
/**
|
|
481
|
+
* A flag determining if the calendar picker is standalone or an input with overlay
|
|
482
|
+
*/
|
|
483
|
+
inline: _propTypes.default.bool,
|
|
484
|
+
/**
|
|
485
|
+
* A short description of the expected input.
|
|
486
|
+
*/
|
|
487
|
+
hint: _propTypes.default.string,
|
|
488
|
+
/**
|
|
489
|
+
* Position of the hint relative to label. Use `below` to display a larger hint below the label.
|
|
490
|
+
*/
|
|
491
|
+
hintPosition: _propTypes.default.oneOf(['inline', 'below']),
|
|
492
|
+
/**
|
|
493
|
+
* Content of an optional `Tooltip`. If set, a tooltip button will be shown next to the label.
|
|
494
|
+
*/
|
|
495
|
+
tooltip: _propTypes.default.string,
|
|
496
|
+
/**
|
|
497
|
+
* Use to visually mark an input as valid or invalid.
|
|
498
|
+
*/
|
|
499
|
+
validation: _propTypes.default.oneOf(['error', 'success']),
|
|
500
|
+
/**
|
|
501
|
+
* Disable the input which will not open the calendar picker
|
|
502
|
+
*/
|
|
503
|
+
disabled: _propTypes.default.bool,
|
|
504
|
+
/**
|
|
505
|
+
* A unique identifier for the previous icon button located on the datepicker.
|
|
506
|
+
* This is for automation testing purposes.
|
|
507
|
+
* Will be added as a `data-testid-prev` attribute for example.
|
|
508
|
+
*/
|
|
509
|
+
prevTestID: _propTypes.default.string,
|
|
510
|
+
/**
|
|
511
|
+
* A unique identifier for the next icon button located on the datepicker.
|
|
512
|
+
* This is for automation testing purposes.
|
|
513
|
+
* Will be added as a `data-testid-next` attribute for example.
|
|
514
|
+
*/
|
|
515
|
+
nextTestID: _propTypes.default.string,
|
|
516
|
+
/**
|
|
517
|
+
* Optional placeholder for the date input. If not set, the default value will be equal to the `dateFormat` prop
|
|
518
|
+
*/
|
|
519
|
+
placeholder: _propTypes.default.string,
|
|
520
|
+
/**
|
|
521
|
+
* The initial month to display when the calendar is opened. Expects a string in the format `YYYY-MM`
|
|
522
|
+
*/
|
|
523
|
+
initialVisibleMonth: _propTypes.default.string
|
|
524
|
+
};
|
|
525
|
+
var _default = exports.default = DatePicker;
|
|
@@ -0,0 +1,125 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.default = void 0;
|
|
7
|
+
// from https://github.com/airbnb/react-dates/blob/master/src/defaultPhrases.js
|
|
8
|
+
const calendarLabel = 'Calendrier';
|
|
9
|
+
const roleDescription = 'Sélecteur de date';
|
|
10
|
+
const closeDatePicker = 'Fermer ';
|
|
11
|
+
const clearDate = 'Supprimer la date';
|
|
12
|
+
const jumpToPrevMonth = 'Reculer pour passer au mois précédent.';
|
|
13
|
+
const jumpToNextMonth = 'Avancer pour passer au mois suivant.';
|
|
14
|
+
const keyboardShortcuts = 'Raccourcis clavier ';
|
|
15
|
+
const showKeyboardShortcutsPanel = 'Ouvrir le panneau de raccourcis clavier.';
|
|
16
|
+
const hideKeyboardShortcutsPanel = 'Fermez le panneau de raccourcis.';
|
|
17
|
+
const openThisPanel = 'Ouvrir le panneau. ';
|
|
18
|
+
const enterKey = 'Touche Entrée ';
|
|
19
|
+
const leftArrowRightArrow = 'Touches de direction droite et gauche';
|
|
20
|
+
const upArrowDownArrow = 'Touches de direction haut et bas';
|
|
21
|
+
const pageUpPageDown = 'Touches Page précédente et Page suivante';
|
|
22
|
+
const homeEnd = 'Touches Accueil et Fin';
|
|
23
|
+
const escape = 'Touche Échap.';
|
|
24
|
+
const questionMark = `Point d'interrogation`;
|
|
25
|
+
const selectFocusedDate = 'Sélectionner la date mise au point.';
|
|
26
|
+
const moveFocusByOneDay = `Reculer (à gauche) et avancer (à droite) d'un jour.`;
|
|
27
|
+
const moveFocusByOneWeek = `Reculer (vers le haut) et avancer (vers le bas) d'une semaine.`;
|
|
28
|
+
const moveFocusByOneMonth = 'Changer de mois.';
|
|
29
|
+
const moveFocustoStartAndEndOfWeek = 'Aller au premier ou au dernier jour de la semaine.';
|
|
30
|
+
const returnFocusToInput = 'Revenir au champ de saisie de la date.';
|
|
31
|
+
const keyboardForwardNavigationInstructions = `Naviguer vers l'avant pour interagir avec le calendrier et sélectionner une date. Appuyer sur la touche Point d'interrogation pour obtenir les raccourcis clavier permettant de modifier les dates.`;
|
|
32
|
+
const keyboardBackwardNavigationInstructions = `Naviguer en arrière pour interagir avec le calendrier et sélectionner une date. Appuyer sur la touche Point d'interrogation pour obtenir les raccourcis clavier permettant de modifier les dates.`;
|
|
33
|
+
const months = ['Janvier', 'Février', 'Mars', 'Avril', 'Mai', 'Juin', 'Julliet', 'Août', 'Septembre', 'Octobre', 'Novembre', 'Décembre'];
|
|
34
|
+
const weekDays = {
|
|
35
|
+
Su: 'Dim',
|
|
36
|
+
Mo: 'Lun',
|
|
37
|
+
Tu: 'Mar',
|
|
38
|
+
We: 'Mer',
|
|
39
|
+
Th: 'Jeu',
|
|
40
|
+
Fr: 'Ven',
|
|
41
|
+
Sa: 'Sam'
|
|
42
|
+
};
|
|
43
|
+
const chooseAvailableStartDate = _ref => {
|
|
44
|
+
let {
|
|
45
|
+
date
|
|
46
|
+
} = _ref;
|
|
47
|
+
return `Choisir ${date}. Disponible.`;
|
|
48
|
+
};
|
|
49
|
+
const chooseAvailableEndDate = _ref2 => {
|
|
50
|
+
let {
|
|
51
|
+
date
|
|
52
|
+
} = _ref2;
|
|
53
|
+
return `Non disponible. ${date}`;
|
|
54
|
+
};
|
|
55
|
+
const chooseAvailableDate = _ref3 => {
|
|
56
|
+
let {
|
|
57
|
+
date
|
|
58
|
+
} = _ref3;
|
|
59
|
+
return date;
|
|
60
|
+
};
|
|
61
|
+
const dateIsUnavailable = _ref4 => {
|
|
62
|
+
let {
|
|
63
|
+
date
|
|
64
|
+
} = _ref4;
|
|
65
|
+
return `Not available. ${date}`;
|
|
66
|
+
};
|
|
67
|
+
const dateIsSelected = _ref5 => {
|
|
68
|
+
let {
|
|
69
|
+
date
|
|
70
|
+
} = _ref5;
|
|
71
|
+
return `Choisie. ${date}`;
|
|
72
|
+
};
|
|
73
|
+
const dateIsSelectedAsStartDate = _ref6 => {
|
|
74
|
+
let {
|
|
75
|
+
date
|
|
76
|
+
} = _ref6;
|
|
77
|
+
return `Choisie comme date de début. ${date}`;
|
|
78
|
+
};
|
|
79
|
+
const dateIsSelectedAsEndDate = _ref7 => {
|
|
80
|
+
let {
|
|
81
|
+
date
|
|
82
|
+
} = _ref7;
|
|
83
|
+
return `Choisie comme date de fin. ${date}`;
|
|
84
|
+
};
|
|
85
|
+
const dictionary = {
|
|
86
|
+
en: undefined,
|
|
87
|
+
// uses react-dates defaults
|
|
88
|
+
fr: {
|
|
89
|
+
calendarLabel,
|
|
90
|
+
roleDescription,
|
|
91
|
+
jumpToPrevMonth,
|
|
92
|
+
jumpToNextMonth,
|
|
93
|
+
keyboardShortcuts,
|
|
94
|
+
showKeyboardShortcutsPanel,
|
|
95
|
+
hideKeyboardShortcutsPanel,
|
|
96
|
+
openThisPanel,
|
|
97
|
+
enterKey,
|
|
98
|
+
leftArrowRightArrow,
|
|
99
|
+
upArrowDownArrow,
|
|
100
|
+
pageUpPageDown,
|
|
101
|
+
homeEnd,
|
|
102
|
+
escape,
|
|
103
|
+
questionMark,
|
|
104
|
+
selectFocusedDate,
|
|
105
|
+
moveFocusByOneDay,
|
|
106
|
+
moveFocusByOneWeek,
|
|
107
|
+
moveFocusByOneMonth,
|
|
108
|
+
moveFocustoStartAndEndOfWeek,
|
|
109
|
+
returnFocusToInput,
|
|
110
|
+
months,
|
|
111
|
+
weekDays,
|
|
112
|
+
chooseAvailableStartDate,
|
|
113
|
+
chooseAvailableEndDate,
|
|
114
|
+
chooseAvailableDate,
|
|
115
|
+
dateIsUnavailable,
|
|
116
|
+
dateIsSelected,
|
|
117
|
+
dateIsSelectedAsStartDate,
|
|
118
|
+
dateIsSelectedAsEndDate,
|
|
119
|
+
closeDatePicker,
|
|
120
|
+
clearDate,
|
|
121
|
+
keyboardForwardNavigationInstructions,
|
|
122
|
+
keyboardBackwardNavigationInstructions
|
|
123
|
+
}
|
|
124
|
+
};
|
|
125
|
+
var _default = exports.default = dictionary;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.default = void 0;
|
|
7
|
+
var _DatePicker = _interopRequireDefault(require("./DatePicker"));
|
|
8
|
+
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
9
|
+
var _default = exports.default = _DatePicker.default;
|