@4alldigital/foundation-ui--core 3.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE.txt +21 -0
- package/package.json +35 -0
- package/src/__mocks__/_examples/cnbc.ts +146 -0
- package/src/__mocks__/_examples/nrg.ts +222 -0
- package/src/__mocks__/empty-module.js +0 -0
- package/src/__mocks__/fileMock.js +3 -0
- package/src/__mocks__/fileTransformer.js +8 -0
- package/src/__mocks__/mockSearchData.js +511 -0
- package/src/__mocks__/nrglogo.svg +74 -0
- package/src/__mocks__/styleMock.js +3 -0
- package/src/__mocks__/tempPolyFills.js +5 -0
- package/src/components/Accordion/Accordion.stories.tsx +33 -0
- package/src/components/Accordion/Accordion.tsx +53 -0
- package/src/components/Accordion/Accordion.types.ts +8 -0
- package/src/components/Accordion/index.ts +1 -0
- package/src/components/AnimationCounter/AnimationCounter.stories.tsx +22 -0
- package/src/components/AnimationCounter/AnimationCounter.tsx +51 -0
- package/src/components/AnimationCounter/AnimationCounter.types.ts +10 -0
- package/src/components/AnimationCounter/index.ts +1 -0
- package/src/components/AnimationSet1/AnimationSet1.stories.tsx +36 -0
- package/src/components/AnimationSet1/AnimationSet1.tsx +107 -0
- package/src/components/AnimationSet1/AnimationSet1.types.ts +12 -0
- package/src/components/AnimationSet1/index.ts +1 -0
- package/src/components/Authenticator/Authenticator.stories.tsx +37 -0
- package/src/components/Authenticator/Authenticator.tsx +84 -0
- package/src/components/Authenticator/Authenticator.types.ts +7 -0
- package/src/components/Authenticator/index.ts +1 -0
- package/src/components/Avatar/Avatar.stories.tsx +26 -0
- package/src/components/Avatar/Avatar.tsx +88 -0
- package/src/components/Avatar/Avatar.types.ts +8 -0
- package/src/components/Avatar/index.ts +1 -0
- package/src/components/Banner/Banner.stories.tsx +59 -0
- package/src/components/Banner/Banner.tsx +60 -0
- package/src/components/Banner/Banner.types.ts +9 -0
- package/src/components/Banner/index.ts +1 -0
- package/src/components/Blockquote/Blockquote.stories.tsx +20 -0
- package/src/components/Blockquote/Blockquote.tsx +32 -0
- package/src/components/Blockquote/Blockquote.types.ts +8 -0
- package/src/components/Blockquote/index.ts +1 -0
- package/src/components/Button/Button.stories.tsx +50 -0
- package/src/components/Button/Button.tsx +117 -0
- package/src/components/Button/Button.types.ts +43 -0
- package/src/components/Button/index.ts +1 -0
- package/src/components/ButtonGroup/ButtonGroup.stories.tsx +59 -0
- package/src/components/ButtonGroup/ButtonGroup.tsx +35 -0
- package/src/components/ButtonGroup/ButtonGroup.types.ts +5 -0
- package/src/components/ButtonGroup/index.ts +1 -0
- package/src/components/Calendar/Calendar.stories.tsx +100 -0
- package/src/components/Calendar/Calendar.tsx +91 -0
- package/src/components/Calendar/Calendar.types.ts +10 -0
- package/src/components/Calendar/index.ts +2 -0
- package/src/components/Card/Card.stories.tsx +487 -0
- package/src/components/Card/Card.tsx +32 -0
- package/src/components/Card/Card.types.ts +79 -0
- package/src/components/Card/constants/index.ts +8 -0
- package/src/components/Card/index.ts +1 -0
- package/src/components/Card/types/CardBasic/CardBasic.tsx +262 -0
- package/src/components/Card/types/CardBasic/CardBasic.types.ts +7 -0
- package/src/components/Card/types/CardBasic/index.ts +1 -0
- package/src/components/Card/types/CardData/CardData.tsx +68 -0
- package/src/components/Card/types/CardData/CardData.types.ts +21 -0
- package/src/components/Card/types/CardData/index.ts +1 -0
- package/src/components/Card/types/CardHorz/CardHorz.tsx +80 -0
- package/src/components/Card/types/CardHorz/CardHorz.types.ts +8 -0
- package/src/components/Card/types/CardHorz/index.ts +1 -0
- package/src/components/Card/types/CardIcon/CardIcon.tsx +76 -0
- package/src/components/Card/types/CardIcon/CardIcon.types.ts +8 -0
- package/src/components/Card/types/CardIcon/index.ts +1 -0
- package/src/components/Card/types/CardMedia/CardMedia.tsx +277 -0
- package/src/components/Card/types/CardMedia/CardMedia.types.ts +5 -0
- package/src/components/Card/types/CardMedia/index.ts +1 -0
- package/src/components/Card/types/CardVideo/CardVideo.tsx +262 -0
- package/src/components/Card/types/CardVideo/CardVideo.types.ts +11 -0
- package/src/components/Card/types/CardVideo/index.ts +1 -0
- package/src/components/CardGrid/CardGrid.stories.tsx +122 -0
- package/src/components/CardGrid/CardGrid.tsx +25 -0
- package/src/components/CardGrid/CardGrid.types.ts +7 -0
- package/src/components/CardGrid/index.ts +1 -0
- package/src/components/Carousel/Carousel.stories.tsx +351 -0
- package/src/components/Carousel/Carousel.tsx +174 -0
- package/src/components/Carousel/Carousel.types.ts +32 -0
- package/src/components/Carousel/MIGRATION.md +156 -0
- package/src/components/Carousel/index.ts +1 -0
- package/src/components/Cart/Cart.stories.tsx +92 -0
- package/src/components/Cart/Cart.tsx +194 -0
- package/src/components/Cart/Cart.types.ts +4 -0
- package/src/components/Cart/index.ts +1 -0
- package/src/components/Checkbox/Checkbox.stories.tsx +18 -0
- package/src/components/Checkbox/Checkbox.tsx +38 -0
- package/src/components/Checkbox/Checkbox.types.ts +15 -0
- package/src/components/Checkbox/index.ts +1 -0
- package/src/components/Chip/Chip.stories.tsx +37 -0
- package/src/components/Chip/Chip.tsx +104 -0
- package/src/components/Chip/Chip.types.ts +13 -0
- package/src/components/Chip/index.ts +1 -0
- package/src/components/Collapsible/Collapsible.stories.tsx +139 -0
- package/src/components/Collapsible/Collapsible.tsx +75 -0
- package/src/components/Collapsible/Collapsible.types.ts +14 -0
- package/src/components/Collapsible/index.ts +3 -0
- package/src/components/Container/Container.stories.tsx +17 -0
- package/src/components/Container/Container.tsx +51 -0
- package/src/components/Container/Container.types.ts +17 -0
- package/src/components/Container/index.ts +1 -0
- package/src/components/ContentPageLayout/ContentPageLayout.stories.tsx +17 -0
- package/src/components/ContentPageLayout/ContentPageLayout.tsx +38 -0
- package/src/components/ContentPageLayout/ContentPageLayout.types.ts +17 -0
- package/src/components/ContentPageLayout/index.ts +1 -0
- package/src/components/ContentRowsLayout/ContentRowsLayout.stories.tsx +19 -0
- package/src/components/ContentRowsLayout/ContentRowsLayout.tsx +30 -0
- package/src/components/ContentRowsLayout/ContentRowsLayout.types.ts +15 -0
- package/src/components/ContentRowsLayout/index.ts +1 -0
- package/src/components/Copy/Copy.stories.tsx +28 -0
- package/src/components/Copy/Copy.tsx +43 -0
- package/src/components/Copy/Copy.types.tsx +53 -0
- package/src/components/Copy/index.tsx +1 -0
- package/src/components/DisplayHeading/DisplayHeading.stories.tsx +17 -0
- package/src/components/DisplayHeading/DisplayHeading.tsx +43 -0
- package/src/components/DisplayHeading/DisplayHeading.types.ts +8 -0
- package/src/components/DisplayHeading/index.ts +1 -0
- package/src/components/FileUpload/FileUpload.stories.tsx +18 -0
- package/src/components/FileUpload/FileUpload.tsx +41 -0
- package/src/components/FileUpload/FileUpload.types.ts +9 -0
- package/src/components/FileUpload/index.ts +1 -0
- package/src/components/Footer/Footer.stories.tsx +17 -0
- package/src/components/Footer/Footer.tsx +78 -0
- package/src/components/Footer/Footer.types.ts +4 -0
- package/src/components/Footer/index.ts +1 -0
- package/src/components/Form/Form.stories.tsx +81 -0
- package/src/components/Form/Form.tsx +98 -0
- package/src/components/Form/Form.types.ts +34 -0
- package/src/components/Form/index.ts +1 -0
- package/src/components/FormField/FormField.stories.tsx +205 -0
- package/src/components/FormField/FormField.tsx +258 -0
- package/src/components/FormField/FormField.types.ts +89 -0
- package/src/components/FormField/index.ts +1 -0
- package/src/components/FormSelect/FormSelect.stories.tsx +27 -0
- package/src/components/FormSelect/FormSelect.tsx +46 -0
- package/src/components/FormSelect/FormSelect.types.ts +45 -0
- package/src/components/FormSelect/index.ts +1 -0
- package/src/components/FullContentBackgroundImage/FullContentBackgroundImage.stories.tsx +18 -0
- package/src/components/FullContentBackgroundImage/FullContentBackgroundImage.tsx +26 -0
- package/src/components/FullContentBackgroundImage/FullContentBackgroundImage.types.ts +6 -0
- package/src/components/FullContentBackgroundImage/index.ts +1 -0
- package/src/components/FullScreenVideoModal/FullScreenVideoModal.stories.tsx +34 -0
- package/src/components/FullScreenVideoModal/FullScreenVideoModal.tsx +41 -0
- package/src/components/FullScreenVideoModal/FullScreenVideoModal.types.ts +9 -0
- package/src/components/FullScreenVideoModal/index.ts +1 -0
- package/src/components/Header/Header.stories.tsx +51 -0
- package/src/components/Header/Header.tsx +170 -0
- package/src/components/Header/Header.types.ts +11 -0
- package/src/components/Header/index.ts +1 -0
- package/src/components/Heading/Heading.stories.tsx +57 -0
- package/src/components/Heading/Heading.tsx +47 -0
- package/src/components/Heading/Heading.types.ts +35 -0
- package/src/components/Heading/index.ts +1 -0
- package/src/components/Hero/Hero.stories.tsx +17 -0
- package/src/components/Hero/Hero.tsx +28 -0
- package/src/components/Hero/Hero.types.ts +17 -0
- package/src/components/Hero/index.ts +1 -0
- package/src/components/Hr/Hr.stories.tsx +13 -0
- package/src/components/Hr/Hr.tsx +16 -0
- package/src/components/Hr/Hr.types.ts +3 -0
- package/src/components/Hr/index.ts +1 -0
- package/src/components/HtmlContent/HtmlContent.stories.tsx +29 -0
- package/src/components/HtmlContent/HtmlContent.tsx +36 -0
- package/src/components/HtmlContent/HtmlContent.types.ts +6 -0
- package/src/components/HtmlContent/index.ts +1 -0
- package/src/components/Icon/Icon.stories.tsx +26 -0
- package/src/components/Icon/Icon.tsx +24 -0
- package/src/components/Icon/Icon.types.ts +8 -0
- package/src/components/Icon/index.ts +2 -0
- package/src/components/Image/Image.stories.tsx +32 -0
- package/src/components/Image/Image.tsx +71 -0
- package/src/components/Image/Image.types.ts +20 -0
- package/src/components/Image/index.ts +1 -0
- package/src/components/Label/Label.stories.tsx +18 -0
- package/src/components/Label/Label.tsx +17 -0
- package/src/components/Label/Label.types.ts +9 -0
- package/src/components/Label/index.ts +1 -0
- package/src/components/Link/Link.stories.tsx +25 -0
- package/src/components/Link/Link.tsx +85 -0
- package/src/components/Link/Link.types.ts +14 -0
- package/src/components/Link/index.ts +1 -0
- package/src/components/List/List.stories.tsx +38 -0
- package/src/components/List/List.tsx +17 -0
- package/src/components/List/List.types.ts +27 -0
- package/src/components/List/index.ts +1 -0
- package/src/components/ListItem/ListItem.stories.tsx +61 -0
- package/src/components/ListItem/ListItem.tsx +53 -0
- package/src/components/ListItem/ListItem.types.ts +10 -0
- package/src/components/ListItem/index.ts +1 -0
- package/src/components/Loader/Loader.stories.tsx +17 -0
- package/src/components/Loader/Loader.tsx +34 -0
- package/src/components/Loader/Loader.types.ts +5 -0
- package/src/components/Loader/index.ts +1 -0
- package/src/components/Logo/Logo.stories.tsx +17 -0
- package/src/components/Logo/Logo.tsx +17 -0
- package/src/components/Logo/Logo.types.ts +6 -0
- package/src/components/Logo/index.ts +1 -0
- package/src/components/Menu/Menu.stories.tsx +37 -0
- package/src/components/Menu/Menu.tsx +45 -0
- package/src/components/Menu/Menu.types.ts +15 -0
- package/src/components/Menu/index.ts +1 -0
- package/src/components/Notice/Notice.stories.tsx +49 -0
- package/src/components/Notice/Notice.tsx +63 -0
- package/src/components/Notice/Notice.types.ts +11 -0
- package/src/components/Notice/index.ts +1 -0
- package/src/components/OTPInput/OTPInput.stories.tsx +18 -0
- package/src/components/OTPInput/OTPInput.tsx +80 -0
- package/src/components/OTPInput/OTPInput.types.ts +8 -0
- package/src/components/OTPInput/index.ts +1 -0
- package/src/components/PanelCards/PanelCards.stories.tsx +125 -0
- package/src/components/PanelCards/PanelCards.tsx +81 -0
- package/src/components/PanelCards/PanelCards.types.ts +11 -0
- package/src/components/PanelCards/index.ts +1 -0
- package/src/components/PanelCustom/PanelCustom.stories.tsx +18 -0
- package/src/components/PanelCustom/PanelCustom.tsx +39 -0
- package/src/components/PanelCustom/PanelCustom.types.ts +20 -0
- package/src/components/PanelCustom/index.ts +1 -0
- package/src/components/PanelFeature/PanelFeature.stories.tsx +46 -0
- package/src/components/PanelFeature/PanelFeature.tsx +83 -0
- package/src/components/PanelFeature/PanelFeature.types.ts +27 -0
- package/src/components/PanelFeature/index.ts +1 -0
- package/src/components/PanelHero/PanelHero.stories.tsx +126 -0
- package/src/components/PanelHero/PanelHero.tsx +184 -0
- package/src/components/PanelHero/PanelHero.types.ts +19 -0
- package/src/components/PanelHero/index.ts +1 -0
- package/src/components/PanelIntro/PanelIntro.stories.tsx +38 -0
- package/src/components/PanelIntro/PanelIntro.tsx +139 -0
- package/src/components/PanelIntro/PanelIntro.types.ts +19 -0
- package/src/components/PanelIntro/index.ts +1 -0
- package/src/components/PanelProduct/PanelProduct.stories.tsx +24 -0
- package/src/components/PanelProduct/PanelProduct.tsx +87 -0
- package/src/components/PanelProduct/PanelProduct.types.ts +14 -0
- package/src/components/PanelProduct/index.ts +1 -0
- package/src/components/PanelScroller/PanelScroller.stories.tsx +81 -0
- package/src/components/PanelScroller/PanelScroller.tsx +58 -0
- package/src/components/PanelScroller/PanelScroller.types.ts +8 -0
- package/src/components/PanelScroller/index.ts +1 -0
- package/src/components/PanelVideo/PanelVideo.stories.tsx +42 -0
- package/src/components/PanelVideo/PanelVideo.tsx +81 -0
- package/src/components/PanelVideo/PanelVideo.types.ts +11 -0
- package/src/components/PanelVideo/index.ts +1 -0
- package/src/components/Radio/Radio.stories.tsx +24 -0
- package/src/components/Radio/Radio.tsx +44 -0
- package/src/components/Radio/Radio.types.ts +13 -0
- package/src/components/Radio/index.ts +1 -0
- package/src/components/Schedule/Schedule.stories.tsx +96 -0
- package/src/components/Schedule/Schedule.tsx +118 -0
- package/src/components/Schedule/Schedule.types.ts +64 -0
- package/src/components/Schedule/index.ts +1 -0
- package/src/components/ScheduleItem/ScheduleItem.stories.tsx +21 -0
- package/src/components/ScheduleItem/ScheduleItem.tsx +77 -0
- package/src/components/ScheduleItem/ScheduleItem.types.ts +8 -0
- package/src/components/ScheduleItem/index.ts +1 -0
- package/src/components/Screen/Screen.stories.tsx +27 -0
- package/src/components/Screen/Screen.tsx +63 -0
- package/src/components/Screen/Screen.types.ts +16 -0
- package/src/components/Screen/index.ts +1 -0
- package/src/components/ShadcnButton/ShadcnButton.tsx +57 -0
- package/src/components/ShadcnButton/index.ts +2 -0
- package/src/components/ShadcnCarousel/ShadcnCarousel.tsx +261 -0
- package/src/components/ShadcnCarousel/index.ts +9 -0
- package/src/components/Share/Share.stories.tsx +17 -0
- package/src/components/Share/Share.tsx +60 -0
- package/src/components/Share/Share.types.ts +12 -0
- package/src/components/Share/index.ts +1 -0
- package/src/components/SubscriptionManager/SubscriptionManager.stories.tsx +177 -0
- package/src/components/SubscriptionManager/SubscriptionManager.tsx +369 -0
- package/src/components/SubscriptionManager/SubscriptionManager.types.ts +36 -0
- package/src/components/SubscriptionManager/index.ts +1 -0
- package/src/components/Switch/Switch.stories.tsx +20 -0
- package/src/components/Switch/Switch.tsx +30 -0
- package/src/components/Switch/Switch.types.ts +7 -0
- package/src/components/Switch/index.ts +1 -0
- package/src/components/Tabs/Tabs.stories.tsx +34 -0
- package/src/components/Tabs/Tabs.tsx +42 -0
- package/src/components/Tabs/Tabs.types.ts +8 -0
- package/src/components/Tabs/index.ts +1 -0
- package/src/components/TextInput/TextInput.stories.tsx +18 -0
- package/src/components/TextInput/TextInput.tsx +78 -0
- package/src/components/TextInput/TextInput.types.ts +81 -0
- package/src/components/TextInput/index.ts +1 -0
- package/src/components/Video/Video.stories.tsx +75 -0
- package/src/components/Video/Video.tsx +280 -0
- package/src/components/Video/Video.types.ts +147 -0
- package/src/components/Video/index.ts +1 -0
- package/src/components/VisitUs/VisitUs.stories.tsx +32 -0
- package/src/components/VisitUs/VisitUs.tsx +56 -0
- package/src/components/VisitUs/VisitUs.types.ts +13 -0
- package/src/components/VisitUs/index.ts +1 -0
- package/src/components/index.ts +143 -0
- package/src/constants/index.ts +6 -0
- package/src/context/Amplify/index.tsx +65 -0
- package/src/context/App/index.tsx +93 -0
- package/src/context/Cart/index.tsx +64 -0
- package/src/context/ExampleContext/index.tsx +34 -0
- package/src/context/Theme/index.tsx +37 -0
- package/src/context/index.ts +18 -0
- package/src/features/Search/Search.stories.tsx +395 -0
- package/src/features/Search/Search.tsx +204 -0
- package/src/features/Search/Search.types.ts +41 -0
- package/src/features/Search/config/config-helper.ts +219 -0
- package/src/features/Search/index.ts +1 -0
- package/src/features/Search/view-helpers/appendClassName.ts +14 -0
- package/src/features/Search/view-helpers/formatResult.ts +97 -0
- package/src/features/Search/view-helpers/getFilterValueDisplay.ts +10 -0
- package/src/features/Search/view-helpers/getUrlSanitizer.ts +23 -0
- package/src/features/Search/view-helpers/index.ts +4 -0
- package/src/features/Search/views/Layout/Layout.tsx +50 -0
- package/src/features/Search/views/Layout/Layout.types.ts +13 -0
- package/src/features/Search/views/Layout/index.ts +1 -0
- package/src/features/Search/views/MultiCheckboxFacet/MultiCheckboxFacet.tsx +85 -0
- package/src/features/Search/views/MultiCheckboxFacet/MultiCheckboxFacet.types.ts +5 -0
- package/src/features/Search/views/MultiCheckboxFacet/index.ts +1 -0
- package/src/features/Search/views/Paging/Paging.tsx +35 -0
- package/src/features/Search/views/Paging/Paging.types.ts +24 -0
- package/src/features/Search/views/Paging/index.ts +1 -0
- package/src/features/Search/views/PagingInfo/PagingInfo.tsx +34 -0
- package/src/features/Search/views/PagingInfo/PagingInfo.types.ts +26 -0
- package/src/features/Search/views/PagingInfo/index.ts +1 -0
- package/src/features/Search/views/Result/Result.tsx +84 -0
- package/src/features/Search/views/Result/Result.types.ts +47 -0
- package/src/features/Search/views/Result/index.ts +1 -0
- package/src/features/Search/views/Results/Results.tsx +16 -0
- package/src/features/Search/views/Results/Results.types.ts +24 -0
- package/src/features/Search/views/Results/index.ts +1 -0
- package/src/features/Search/views/ResultsPerPage/ResultsPerPage.tsx +32 -0
- package/src/features/Search/views/ResultsPerPage/ResultsPerPage.types.ts +26 -0
- package/src/features/Search/views/ResultsPerPage/index.ts +1 -0
- package/src/features/Search/views/SearchBox/SearchBox.tsx +51 -0
- package/src/features/Search/views/SearchBox/SearchBox.types.ts +10 -0
- package/src/features/Search/views/SearchBox/index.ts +1 -0
- package/src/features/Search/views/Sidebar/Sidebar.tsx +14 -0
- package/src/features/Search/views/Sidebar/Sidebar.types.ts +3 -0
- package/src/features/Search/views/Sidebar/index.ts +1 -0
- package/src/features/Search/views/SingleLinksFacet/SingleLinksFacet.tsx +62 -0
- package/src/features/Search/views/SingleLinksFacet/SingleLinksFacet.types.ts +5 -0
- package/src/features/Search/views/SingleLinksFacet/index.ts +1 -0
- package/src/features/Search/views/SingleSelectFacet/SingleSelectFacet.tsx +34 -0
- package/src/features/Search/views/SingleSelectFacet/SingleSelectFacet.types.ts +5 -0
- package/src/features/Search/views/SingleSelectFacet/index.ts +1 -0
- package/src/features/Search/views/Sorting/Sorting.tsx +24 -0
- package/src/features/Search/views/Sorting/Sorting.types.ts +25 -0
- package/src/features/Search/views/Sorting/index.ts +1 -0
- package/src/features/index.ts +11 -0
- package/src/forms/ForgotPasswordForm/ForgotPasswordForm.stories.tsx +19 -0
- package/src/forms/ForgotPasswordForm/ForgotPasswordForm.tsx +28 -0
- package/src/forms/ForgotPasswordForm/ForgotPasswordForm.types.ts +3 -0
- package/src/forms/ForgotPasswordForm/index.ts +1 -0
- package/src/forms/LoginForm/LoginForm.stories.tsx +67 -0
- package/src/forms/LoginForm/LoginForm.tsx +112 -0
- package/src/forms/LoginForm/LoginForm.types.ts +7 -0
- package/src/forms/LoginForm/index.ts +1 -0
- package/src/forms/ProfileForm/ProfileForm.stories.tsx +23 -0
- package/src/forms/ProfileForm/ProfileForm.tsx +40 -0
- package/src/forms/ProfileForm/ProfileForm.types.ts +6 -0
- package/src/forms/ProfileForm/index.ts +1 -0
- package/src/forms/PromoCodeForm/PromoCodeForm.stories.tsx +19 -0
- package/src/forms/PromoCodeForm/PromoCodeForm.tsx +22 -0
- package/src/forms/PromoCodeForm/PromoCodeForm.types.ts +4 -0
- package/src/forms/PromoCodeForm/index.ts +1 -0
- package/src/forms/RegisterForm/RegisterForm.stories.tsx +85 -0
- package/src/forms/RegisterForm/RegisterForm.tsx +108 -0
- package/src/forms/RegisterForm/RegisterForm.types.ts +6 -0
- package/src/forms/RegisterForm/index.ts +1 -0
- package/src/forms/ResetPasswordAuthForm/ResetPasswordAuthForm.stories.tsx +23 -0
- package/src/forms/ResetPasswordAuthForm/ResetPasswordAuthForm.tsx +39 -0
- package/src/forms/ResetPasswordAuthForm/ResetPasswordAuthForm.types.ts +3 -0
- package/src/forms/ResetPasswordAuthForm/index.ts +1 -0
- package/src/forms/ResetPasswordForm/ResetPasswordForm.stories.tsx +23 -0
- package/src/forms/ResetPasswordForm/ResetPasswordForm.tsx +30 -0
- package/src/forms/ResetPasswordForm/ResetPasswordForm.types.ts +3 -0
- package/src/forms/ResetPasswordForm/index.ts +1 -0
- package/src/forms/SubscriptionForm/SubscriptionForm.stories.tsx +31 -0
- package/src/forms/SubscriptionForm/SubscriptionForm.tsx +46 -0
- package/src/forms/SubscriptionForm/SubscriptionForm.types.ts +6 -0
- package/src/forms/SubscriptionForm/index.ts +1 -0
- package/src/forms/constants/index.ts +13 -0
- package/src/forms/index.ts +17 -0
- package/src/forms/validations/index.ts +39 -0
- package/src/hooks/index.ts +2 -0
- package/src/hooks/useLanguage.ts +18 -0
- package/src/hooks/useTheme.ts +6 -0
- package/src/index.ts +8 -0
- package/src/react-app-env.d.ts +1 -0
- package/src/setupTests.ts +5 -0
- package/src/templates/AccountScreen/AccountScreen.stories.tsx +67 -0
- package/src/templates/AccountScreen/AccountScreen.tsx +78 -0
- package/src/templates/AccountScreen/AccountScreen.types.ts +31 -0
- package/src/templates/AccountScreen/index.ts +1 -0
- package/src/templates/AuthScreen/AuthScreen.stories.tsx +33 -0
- package/src/templates/AuthScreen/AuthScreen.tsx +21 -0
- package/src/templates/AuthScreen/AuthScreen.types.ts +8 -0
- package/src/templates/AuthScreen/index.ts +1 -0
- package/src/templates/CardGridScreen/CardGridScreen.stories.tsx +95 -0
- package/src/templates/CardGridScreen/CardGridScreen.tsx +43 -0
- package/src/templates/CardGridScreen/CardGridScreen.types.ts +11 -0
- package/src/templates/CardGridScreen/index.ts +1 -0
- package/src/templates/CatalogueScreen/CatalogueScreen.stories.tsx +31 -0
- package/src/templates/CatalogueScreen/CatalogueScreen.tsx +21 -0
- package/src/templates/CatalogueScreen/CatalogueScreen.types.ts +8 -0
- package/src/templates/CatalogueScreen/index.ts +1 -0
- package/src/templates/ChallengeLibraryScreen/ChallengeLibraryScreen.stories.tsx +171 -0
- package/src/templates/ChallengeLibraryScreen/ChallengeLibraryScreen.tsx +36 -0
- package/src/templates/ChallengeLibraryScreen/ChallengeLibraryScreen.types.ts +9 -0
- package/src/templates/ChallengeLibraryScreen/index.ts +1 -0
- package/src/templates/ChallengeScreen/ChallengeScreen.stories.tsx +65 -0
- package/src/templates/ChallengeScreen/ChallengeScreen.tsx +88 -0
- package/src/templates/ChallengeScreen/ChallengeScreen.types.ts +22 -0
- package/src/templates/ChallengeScreen/index.ts +1 -0
- package/src/templates/ContentScreen/ContentScreen.stories.tsx +71 -0
- package/src/templates/ContentScreen/ContentScreen.tsx +55 -0
- package/src/templates/ContentScreen/ContentScreen.types.ts +9 -0
- package/src/templates/ContentScreen/index.ts +1 -0
- package/src/templates/DashboardScreen/DashboardScreen.stories.tsx +490 -0
- package/src/templates/DashboardScreen/DashboardScreen.tsx +156 -0
- package/src/templates/DashboardScreen/DashboardScreen.types.ts +28 -0
- package/src/templates/DashboardScreen/index.ts +1 -0
- package/src/templates/FAQScreen/FAQScreen.stories.tsx +278 -0
- package/src/templates/FAQScreen/FAQScreen.tsx +32 -0
- package/src/templates/FAQScreen/FAQScreen.types.ts +14 -0
- package/src/templates/FAQScreen/index.ts +1 -0
- package/src/templates/HomeScreen/HomeScreen.stories.tsx +315 -0
- package/src/templates/HomeScreen/HomeScreen.tsx +50 -0
- package/src/templates/HomeScreen/HomeScreen.types.ts +23 -0
- package/src/templates/HomeScreen/index.ts +1 -0
- package/src/templates/LogoutScreen/LogoutScreen.stories.tsx +20 -0
- package/src/templates/LogoutScreen/LogoutScreen.tsx +25 -0
- package/src/templates/LogoutScreen/LogoutScreen.types.ts +4 -0
- package/src/templates/LogoutScreen/index.ts +1 -0
- package/src/templates/MenuScreen/MenuScreen.stories.tsx +36 -0
- package/src/templates/MenuScreen/MenuScreen.tsx +32 -0
- package/src/templates/MenuScreen/MenuScreen.types.ts +11 -0
- package/src/templates/MenuScreen/index.ts +1 -0
- package/src/templates/NotFoundScreen/NotFoundScreen.stories.tsx +20 -0
- package/src/templates/NotFoundScreen/NotFoundScreen.tsx +31 -0
- package/src/templates/NotFoundScreen/NotFoundScreen.types.ts +5 -0
- package/src/templates/NotFoundScreen/index.ts +1 -0
- package/src/templates/PasswordResetAuthScreen/PasswordResetAuthScreen.stories.tsx +27 -0
- package/src/templates/PasswordResetAuthScreen/PasswordResetAuthScreen.tsx +20 -0
- package/src/templates/PasswordResetAuthScreen/PasswordResetAuthScreen.types.ts +6 -0
- package/src/templates/PasswordResetAuthScreen/index.ts +1 -0
- package/src/templates/PasswordResetScreen/PasswordResetScreen.stories.tsx +22 -0
- package/src/templates/PasswordResetScreen/PasswordResetScreen.tsx +19 -0
- package/src/templates/PasswordResetScreen/PasswordResetScreen.types.ts +6 -0
- package/src/templates/PasswordResetScreen/index.ts +1 -0
- package/src/templates/ProfileScreen/ProfileScreen.stories.tsx +41 -0
- package/src/templates/ProfileScreen/ProfileScreen.tsx +30 -0
- package/src/templates/ProfileScreen/ProfileScreen.types.ts +24 -0
- package/src/templates/ProfileScreen/index.ts +1 -0
- package/src/templates/ScheduleScreen/ScheduleScreen.stories.tsx +174 -0
- package/src/templates/ScheduleScreen/ScheduleScreen.tsx +29 -0
- package/src/templates/ScheduleScreen/ScheduleScreen.types.ts +9 -0
- package/src/templates/ScheduleScreen/index.ts +1 -0
- package/src/templates/SubscriptionScreen/SubscriptionScreen.stories.tsx +98 -0
- package/src/templates/SubscriptionScreen/SubscriptionScreen.tsx +49 -0
- package/src/templates/SubscriptionScreen/SubscriptionScreen.types.ts +28 -0
- package/src/templates/SubscriptionScreen/index.ts +1 -0
- package/src/templates/WorkoutScreen/WorkoutScreen.stories.tsx +173 -0
- package/src/templates/WorkoutScreen/WorkoutScreen.tsx +230 -0
- package/src/templates/WorkoutScreen/WorkoutScreen.types.ts +34 -0
- package/src/templates/WorkoutScreen/index.ts +1 -0
- package/src/templates/index.ts +40 -0
- package/src/translations/en.ts +777 -0
- package/src/translations/fr.ts +182 -0
- package/src/translations/index.ts +2 -0
- package/src/utils/htmlParser/index.tsx +22 -0
- package/src/utils/index.ts +38 -0
- package/src/utils/parseDuration/index.ts +94 -0
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
import cx from 'classnames';
|
|
2
|
+
import { Props } from './Banner.types';
|
|
3
|
+
import Heading from '../Heading';
|
|
4
|
+
import { HEADING_TAGS } from '../Heading/Heading.types';
|
|
5
|
+
import Copy from '../Copy';
|
|
6
|
+
import Icon from '../Icon';
|
|
7
|
+
import Link from '../Link';
|
|
8
|
+
|
|
9
|
+
const Banner = ({ id, testID, title, text, icon, href, className }: Props) => {
|
|
10
|
+
const classes = cx(
|
|
11
|
+
'rounded-lg p-6 shadow-sm',
|
|
12
|
+
'bg-tertiary text-card-text border-gray-200',
|
|
13
|
+
'dark:bg-darkCardBackground dark:text-darkCardText dark:border-gray-700',
|
|
14
|
+
className,
|
|
15
|
+
);
|
|
16
|
+
|
|
17
|
+
const content = (
|
|
18
|
+
<div className="flex gap-4 items-start">
|
|
19
|
+
{icon && (
|
|
20
|
+
<div className="flex-shrink-0 mt-1">
|
|
21
|
+
<Icon name={icon} className="w-6 h-6" />
|
|
22
|
+
</div>
|
|
23
|
+
)}
|
|
24
|
+
<div className="flex-1">
|
|
25
|
+
{title && (
|
|
26
|
+
<Heading tag={HEADING_TAGS.H4} className="mb-2">
|
|
27
|
+
{title}
|
|
28
|
+
</Heading>
|
|
29
|
+
)}
|
|
30
|
+
<Copy className="mb-0">{text}</Copy>
|
|
31
|
+
</div>
|
|
32
|
+
{href && (
|
|
33
|
+
<div className="flex-shrink-0">
|
|
34
|
+
<Icon name="mdi:chevron-right" className="w-6 h-6" />
|
|
35
|
+
</div>
|
|
36
|
+
)}
|
|
37
|
+
</div>
|
|
38
|
+
);
|
|
39
|
+
|
|
40
|
+
if (href) {
|
|
41
|
+
return (
|
|
42
|
+
<Link href={href} className="block no-underline hover:no-underline" testID={testID || id || 'Banner'}>
|
|
43
|
+
<div className={cx(classes, 'hover:shadow-md transition-shadow duration-200 cursor-pointer')}>
|
|
44
|
+
{content}
|
|
45
|
+
</div>
|
|
46
|
+
</Link>
|
|
47
|
+
);
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
return (
|
|
51
|
+
<div data-testid={testID || id || 'Banner'} className={classes}>
|
|
52
|
+
{content}
|
|
53
|
+
</div>
|
|
54
|
+
);
|
|
55
|
+
};
|
|
56
|
+
|
|
57
|
+
Banner.displayName = 'Banner';
|
|
58
|
+
|
|
59
|
+
export default Banner;
|
|
60
|
+
export type { Props };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default } from './Banner';
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import type { Meta, StoryObj } from '@storybook/nextjs';
|
|
2
|
+
import Blockquote from '.';
|
|
3
|
+
|
|
4
|
+
const meta: Meta<typeof Blockquote> = {
|
|
5
|
+
title: 'ATOMS/Blockquote',
|
|
6
|
+
component: Blockquote,
|
|
7
|
+
};
|
|
8
|
+
|
|
9
|
+
type Story = StoryObj<typeof Blockquote>;
|
|
10
|
+
|
|
11
|
+
export const Default: Story = {
|
|
12
|
+
args: {
|
|
13
|
+
showIcon: true,
|
|
14
|
+
citation: 'Joe BloggsVille',
|
|
15
|
+
citationAttribute: 'CEO of WFO',
|
|
16
|
+
text: 'Lorem ipsum dolor sit amet, elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua.',
|
|
17
|
+
},
|
|
18
|
+
};
|
|
19
|
+
|
|
20
|
+
export default meta;
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import cx from 'classnames';
|
|
2
|
+
import { Props } from './Blockquote.types';
|
|
3
|
+
import Icon from '../Icon';
|
|
4
|
+
|
|
5
|
+
const Blockquote = ({
|
|
6
|
+
text,
|
|
7
|
+
citation,
|
|
8
|
+
className,
|
|
9
|
+
citationAttribute,
|
|
10
|
+
showIcon = true,
|
|
11
|
+
}: Props) => {
|
|
12
|
+
const classes = cx('text-xl italic font-bold', className);
|
|
13
|
+
return (
|
|
14
|
+
<blockquote data-testid="Blockquote" className={classes}>
|
|
15
|
+
{showIcon && <Icon name="mdi:comment-quote" size={42} />}
|
|
16
|
+
<div>{text}</div>
|
|
17
|
+
{citation && (
|
|
18
|
+
<figcaption className="flex flex-start items-center mt-6 space-x-3">
|
|
19
|
+
<div className="flex items-center divide-x-2">
|
|
20
|
+
<cite className="pr-3 font-medium">{citation}</cite>
|
|
21
|
+
{citationAttribute && <cite className="pl-3 text-sm font-light">{citationAttribute}</cite>}
|
|
22
|
+
</div>
|
|
23
|
+
</figcaption>
|
|
24
|
+
)}
|
|
25
|
+
</blockquote>
|
|
26
|
+
);
|
|
27
|
+
};
|
|
28
|
+
|
|
29
|
+
Blockquote.displayName = 'Blockquote';
|
|
30
|
+
|
|
31
|
+
export default Blockquote;
|
|
32
|
+
export type { Props };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default } from './Blockquote';
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
import type { Meta, StoryObj } from '@storybook/nextjs';
|
|
2
|
+
import Button from '.';
|
|
3
|
+
import { BTN_VARIANTS } from './Button.types';
|
|
4
|
+
|
|
5
|
+
type Story = StoryObj<typeof Button>;
|
|
6
|
+
|
|
7
|
+
const meta: Meta<typeof Button> = {
|
|
8
|
+
title: 'ATOMS/Button',
|
|
9
|
+
component: Button,
|
|
10
|
+
};
|
|
11
|
+
|
|
12
|
+
export default meta;
|
|
13
|
+
|
|
14
|
+
/* STORIES */
|
|
15
|
+
export const Default: Story = {
|
|
16
|
+
args: {
|
|
17
|
+
children: <>Default Btn</>,
|
|
18
|
+
},
|
|
19
|
+
};
|
|
20
|
+
|
|
21
|
+
export const WithIcon: Story = {
|
|
22
|
+
args: {
|
|
23
|
+
variant: BTN_VARIANTS.PRIMARY,
|
|
24
|
+
children: <>Example Btn</>,
|
|
25
|
+
icon: 'carbon:arrow-right',
|
|
26
|
+
},
|
|
27
|
+
};
|
|
28
|
+
|
|
29
|
+
export const IconOnly: Story = {
|
|
30
|
+
args: {
|
|
31
|
+
variant: BTN_VARIANTS.PRIMARY,
|
|
32
|
+
icon: 'carbon:arrow-right',
|
|
33
|
+
},
|
|
34
|
+
};
|
|
35
|
+
|
|
36
|
+
export const AsLink: Story = {
|
|
37
|
+
args: {
|
|
38
|
+
variant: BTN_VARIANTS.LINK,
|
|
39
|
+
children: <>Example Link</>,
|
|
40
|
+
icon: 'carbon:arrow-right',
|
|
41
|
+
},
|
|
42
|
+
};
|
|
43
|
+
|
|
44
|
+
export const LoadingButton: Story = {
|
|
45
|
+
args: {
|
|
46
|
+
variant: BTN_VARIANTS.PRIMARY,
|
|
47
|
+
children: <>Example Btn</>,
|
|
48
|
+
isLoading: true,
|
|
49
|
+
},
|
|
50
|
+
};
|
|
@@ -0,0 +1,117 @@
|
|
|
1
|
+
import cx from 'classnames';
|
|
2
|
+
import { twMerge } from 'tailwind-merge';
|
|
3
|
+
import { BTN_SIZES, BTN_TYPES, BTN_VARIANTS, Props } from './Button.types';
|
|
4
|
+
import Icon from '../Icon';
|
|
5
|
+
import Loader from '../Loader';
|
|
6
|
+
|
|
7
|
+
const Button = ({
|
|
8
|
+
variant = BTN_VARIANTS.PRIMARY,
|
|
9
|
+
size = BTN_SIZES.MEDIUM,
|
|
10
|
+
type = BTN_TYPES.BUTTON,
|
|
11
|
+
wide = false,
|
|
12
|
+
rounded = false,
|
|
13
|
+
raised = false,
|
|
14
|
+
uppercase,
|
|
15
|
+
children,
|
|
16
|
+
id,
|
|
17
|
+
disabled,
|
|
18
|
+
ariaLabel,
|
|
19
|
+
onClick,
|
|
20
|
+
icon,
|
|
21
|
+
external,
|
|
22
|
+
iconFirst,
|
|
23
|
+
outline,
|
|
24
|
+
testID,
|
|
25
|
+
className,
|
|
26
|
+
isLoading,
|
|
27
|
+
offsetFont = false,
|
|
28
|
+
}: Props) => {
|
|
29
|
+
const smallX = wide ? 'px-5' : 'px-3';
|
|
30
|
+
const mediumX = wide ? 'px-8' : 'px-4';
|
|
31
|
+
const largeX = wide ? 'px-11' : 'px-5';
|
|
32
|
+
|
|
33
|
+
const sizes = {
|
|
34
|
+
small: {
|
|
35
|
+
x: children && !rounded ? smallX : children ? 'px-3' : 'px-1',
|
|
36
|
+
y: 'py-1',
|
|
37
|
+
space: 'space-x-2',
|
|
38
|
+
text: 'text-sm',
|
|
39
|
+
icon: 'w-3 h-3',
|
|
40
|
+
},
|
|
41
|
+
medium: {
|
|
42
|
+
x: children && !rounded ? mediumX : children ? 'px-4' : 'px-2',
|
|
43
|
+
y: 'py-2',
|
|
44
|
+
space: 'space-x-3',
|
|
45
|
+
text: 'text-base',
|
|
46
|
+
icon: 'w-5 h-5',
|
|
47
|
+
},
|
|
48
|
+
large: {
|
|
49
|
+
x: children && !rounded ? largeX : children ? 'px-5' : 'px-3',
|
|
50
|
+
y: 'py-3',
|
|
51
|
+
space: 'space-x-4',
|
|
52
|
+
text: 'text-lg',
|
|
53
|
+
icon: 'w-6 h-6',
|
|
54
|
+
},
|
|
55
|
+
};
|
|
56
|
+
|
|
57
|
+
const classes = twMerge(
|
|
58
|
+
cx(
|
|
59
|
+
'button rounded-btnBorderRadius',
|
|
60
|
+
{ shadow: raised },
|
|
61
|
+
{ uppercase: uppercase },
|
|
62
|
+
{ 'auto-cols-auto grid-cols-2 gap-4': isLoading || icon || external },
|
|
63
|
+
{ 'flex-row-reverse': iconFirst },
|
|
64
|
+
{ 'opacity-50 cursor-not-allowed': disabled },
|
|
65
|
+
`${sizes?.[size]?.y} ${sizes?.[size]?.x} ${sizes?.[size]?.text}`,
|
|
66
|
+
{ 'text-white border-primary bg-primary hover:bg-primary-darker': variant === BTN_VARIANTS.PRIMARY },
|
|
67
|
+
{ 'text-white border-secondary bg-secondary hover:bg-secondary-darker': variant === BTN_VARIANTS.SECONDARY },
|
|
68
|
+
{ 'text-black border-tertiary bg-tertiary hover:bg-tertiary-darker': variant === BTN_VARIANTS.TERTIARY },
|
|
69
|
+
{ 'border-primary bg-transparent text-body-text dark:text-body-text-dark hover:bg-opacity-30': outline },
|
|
70
|
+
{ 'border-primary-300 dark:border-primary-400 hover:border-primary-400 dark:hover:border-primary-500': outline },
|
|
71
|
+
{
|
|
72
|
+
'px-0 text-body-text dark:text-body-text-dark border-transparent bg-transparent hover:bg-transparent shadow-none group-hover:invert':
|
|
73
|
+
variant === BTN_VARIANTS.LINK,
|
|
74
|
+
},
|
|
75
|
+
{ 'rounded-full leading-none': rounded },
|
|
76
|
+
className,
|
|
77
|
+
),
|
|
78
|
+
);
|
|
79
|
+
|
|
80
|
+
const iconClasses = cx(sizes?.[size]?.icon);
|
|
81
|
+
|
|
82
|
+
return (
|
|
83
|
+
<button
|
|
84
|
+
id={id}
|
|
85
|
+
data-testid={testID || id || 'Button'}
|
|
86
|
+
onClick={onClick}
|
|
87
|
+
className={classes}
|
|
88
|
+
type={type}
|
|
89
|
+
disabled={disabled}
|
|
90
|
+
aria-label={ariaLabel}
|
|
91
|
+
role="button">
|
|
92
|
+
<>
|
|
93
|
+
{offsetFont ? <span className="brand-font-offset">{children}</span>: children}
|
|
94
|
+
{icon && !external && (
|
|
95
|
+
<span className="flex items-center">
|
|
96
|
+
<Icon name={icon} className={iconClasses} />
|
|
97
|
+
</span>
|
|
98
|
+
)}
|
|
99
|
+
{external && (
|
|
100
|
+
<span className="flex items-center">
|
|
101
|
+
<Icon name="carbon:launch" className={iconClasses} />
|
|
102
|
+
</span>
|
|
103
|
+
)}
|
|
104
|
+
{isLoading && (
|
|
105
|
+
<div className="flex items-center">
|
|
106
|
+
<Loader size={4} />
|
|
107
|
+
</div>
|
|
108
|
+
)}
|
|
109
|
+
</>
|
|
110
|
+
</button>
|
|
111
|
+
);
|
|
112
|
+
};
|
|
113
|
+
|
|
114
|
+
Button.displayName = 'Button';
|
|
115
|
+
|
|
116
|
+
export default Button;
|
|
117
|
+
export type { Props };
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import { MouseEventHandler, ReactNode } from 'react';
|
|
2
|
+
|
|
3
|
+
export enum BTN_TYPES {
|
|
4
|
+
SUBMIT = 'submit',
|
|
5
|
+
RESET = 'reset',
|
|
6
|
+
BUTTON = 'button',
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
export enum BTN_VARIANTS {
|
|
10
|
+
PRIMARY = 'primary',
|
|
11
|
+
SECONDARY = 'secondary',
|
|
12
|
+
TERTIARY = 'tertiary',
|
|
13
|
+
LINK = 'link',
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
export enum BTN_SIZES {
|
|
17
|
+
SMALL = 'small',
|
|
18
|
+
MEDIUM = 'medium',
|
|
19
|
+
LARGE = 'large',
|
|
20
|
+
}
|
|
21
|
+
export interface Props {
|
|
22
|
+
variant?: BTN_VARIANTS;
|
|
23
|
+
size?: BTN_SIZES;
|
|
24
|
+
uppercase?: boolean;
|
|
25
|
+
children?: ReactNode;
|
|
26
|
+
type?: BTN_TYPES;
|
|
27
|
+
disabled?: boolean;
|
|
28
|
+
ariaLabel?: string;
|
|
29
|
+
onClick?: MouseEventHandler<HTMLButtonElement>;
|
|
30
|
+
icon?: string;
|
|
31
|
+
external?: boolean;
|
|
32
|
+
iconFirst?: boolean;
|
|
33
|
+
raised?: boolean;
|
|
34
|
+
outline?: boolean;
|
|
35
|
+
wide?: boolean;
|
|
36
|
+
rounded?: boolean;
|
|
37
|
+
id?: string;
|
|
38
|
+
testID?: string;
|
|
39
|
+
className?: string;
|
|
40
|
+
isLoading?: boolean;
|
|
41
|
+
iconOnly?: boolean;
|
|
42
|
+
offsetFont?: boolean;
|
|
43
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default } from './Button';
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
import type { Meta, StoryObj } from '@storybook/nextjs';
|
|
2
|
+
import ButtonGroup from '.';
|
|
3
|
+
import { BTN_SIZES, BTN_VARIANTS } from '../Button/Button.types';
|
|
4
|
+
|
|
5
|
+
const meta: Meta<typeof ButtonGroup> = {
|
|
6
|
+
title: 'MOLECULES/ButtonGroup',
|
|
7
|
+
component: ButtonGroup,
|
|
8
|
+
};
|
|
9
|
+
|
|
10
|
+
type Story = StoryObj<typeof ButtonGroup>;
|
|
11
|
+
|
|
12
|
+
export const Default: Story = {
|
|
13
|
+
args: {
|
|
14
|
+
buttonData: [
|
|
15
|
+
{
|
|
16
|
+
id: 'button1',
|
|
17
|
+
variant: BTN_VARIANTS.PRIMARY,
|
|
18
|
+
children: 'Button 1',
|
|
19
|
+
},
|
|
20
|
+
{
|
|
21
|
+
id: 'button2',
|
|
22
|
+
variant: BTN_VARIANTS.PRIMARY,
|
|
23
|
+
children: 'Button 2',
|
|
24
|
+
},
|
|
25
|
+
{
|
|
26
|
+
id: 'button3',
|
|
27
|
+
variant: BTN_VARIANTS.PRIMARY,
|
|
28
|
+
children: 'Button 3',
|
|
29
|
+
},
|
|
30
|
+
],
|
|
31
|
+
},
|
|
32
|
+
};
|
|
33
|
+
|
|
34
|
+
export const SecondaryButtons: Story = {
|
|
35
|
+
args: {
|
|
36
|
+
buttonData: [
|
|
37
|
+
{
|
|
38
|
+
id: 'button1',
|
|
39
|
+
variant: BTN_VARIANTS.SECONDARY,
|
|
40
|
+
children: 'Button Small',
|
|
41
|
+
size: BTN_SIZES.SMALL,
|
|
42
|
+
},
|
|
43
|
+
{
|
|
44
|
+
id: 'button2',
|
|
45
|
+
variant: BTN_VARIANTS.SECONDARY,
|
|
46
|
+
children: 'Button 2',
|
|
47
|
+
size: BTN_SIZES.SMALL,
|
|
48
|
+
},
|
|
49
|
+
{
|
|
50
|
+
id: 'button3',
|
|
51
|
+
variant: BTN_VARIANTS.SECONDARY,
|
|
52
|
+
children: 'Button 3',
|
|
53
|
+
size: BTN_SIZES.SMALL,
|
|
54
|
+
},
|
|
55
|
+
],
|
|
56
|
+
},
|
|
57
|
+
};
|
|
58
|
+
|
|
59
|
+
export default meta;
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import cx from 'classnames';
|
|
3
|
+
import { Props } from './ButtonGroup.types';
|
|
4
|
+
import Button from '../Button/Button';
|
|
5
|
+
|
|
6
|
+
const ButtonGroup = ({ testID, buttonData }: Props) => {
|
|
7
|
+
return (
|
|
8
|
+
<div data-testid={testID || 'ButtonGroup'} className="inline-flex rounded" role="group">
|
|
9
|
+
{buttonData?.map((data, index) => {
|
|
10
|
+
const isNotFirstOrLast = index > 0 && index < buttonData.length - 1;
|
|
11
|
+
const isFirst = index === 0;
|
|
12
|
+
const isLast = index === buttonData.length - 1;
|
|
13
|
+
const buttonClasses = cx(
|
|
14
|
+
{ 'rounded-none': isNotFirstOrLast },
|
|
15
|
+
{
|
|
16
|
+
'rounded-r': isFirst,
|
|
17
|
+
'rounded-l': isLast,
|
|
18
|
+
},
|
|
19
|
+
);
|
|
20
|
+
return (
|
|
21
|
+
<div key={data.id}>
|
|
22
|
+
<Button {...data} className={buttonClasses}>
|
|
23
|
+
{data.children}
|
|
24
|
+
</Button>
|
|
25
|
+
</div>
|
|
26
|
+
);
|
|
27
|
+
})}
|
|
28
|
+
</div>
|
|
29
|
+
);
|
|
30
|
+
};
|
|
31
|
+
|
|
32
|
+
ButtonGroup.displayName = 'ButtonGroup';
|
|
33
|
+
|
|
34
|
+
export default ButtonGroup;
|
|
35
|
+
export type { Props };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default } from './ButtonGroup';
|
|
@@ -0,0 +1,100 @@
|
|
|
1
|
+
import type { Meta, StoryObj } from '@storybook/nextjs';
|
|
2
|
+
import { useState } from 'react';
|
|
3
|
+
import Calendar from '.';
|
|
4
|
+
import { addDays, subDays } from 'date-fns';
|
|
5
|
+
|
|
6
|
+
const meta: Meta<typeof Calendar> = {
|
|
7
|
+
title: 'ATOMS/Calendar',
|
|
8
|
+
component: Calendar,
|
|
9
|
+
};
|
|
10
|
+
|
|
11
|
+
type Story = StoryObj<typeof Calendar>;
|
|
12
|
+
|
|
13
|
+
export const Default: Story = {
|
|
14
|
+
render: () => {
|
|
15
|
+
const [selected, setSelected] = useState<Date | undefined>(new Date());
|
|
16
|
+
|
|
17
|
+
return (
|
|
18
|
+
<Calendar
|
|
19
|
+
selected={selected}
|
|
20
|
+
onSelect={setSelected}
|
|
21
|
+
/>
|
|
22
|
+
);
|
|
23
|
+
},
|
|
24
|
+
};
|
|
25
|
+
|
|
26
|
+
export const WithHighlightedDates: Story = {
|
|
27
|
+
render: () => {
|
|
28
|
+
const [selected, setSelected] = useState<Date | undefined>(new Date());
|
|
29
|
+
const today = new Date();
|
|
30
|
+
|
|
31
|
+
// Simulate dates with classes
|
|
32
|
+
const datesWithClasses = [
|
|
33
|
+
today,
|
|
34
|
+
addDays(today, 1),
|
|
35
|
+
addDays(today, 2),
|
|
36
|
+
addDays(today, 5),
|
|
37
|
+
subDays(today, 2),
|
|
38
|
+
subDays(today, 5),
|
|
39
|
+
];
|
|
40
|
+
|
|
41
|
+
return (
|
|
42
|
+
<div className="space-y-4">
|
|
43
|
+
<div>
|
|
44
|
+
<h3 className="text-lg font-semibold mb-2">
|
|
45
|
+
Calendar with Classes
|
|
46
|
+
</h3>
|
|
47
|
+
<p className="text-sm text-gray-600 mb-4">
|
|
48
|
+
Highlighted dates have scheduled classes
|
|
49
|
+
</p>
|
|
50
|
+
</div>
|
|
51
|
+
<Calendar
|
|
52
|
+
selected={selected}
|
|
53
|
+
onSelect={setSelected}
|
|
54
|
+
datesWithContent={datesWithClasses}
|
|
55
|
+
/>
|
|
56
|
+
{selected && (
|
|
57
|
+
<div className="mt-4 p-4 bg-grey-100 dark:bg-grey-800 rounded">
|
|
58
|
+
<p className="text-sm">
|
|
59
|
+
Selected: {selected.toLocaleDateString()}
|
|
60
|
+
</p>
|
|
61
|
+
</div>
|
|
62
|
+
)}
|
|
63
|
+
</div>
|
|
64
|
+
);
|
|
65
|
+
},
|
|
66
|
+
};
|
|
67
|
+
|
|
68
|
+
export const WithDisabledDates: Story = {
|
|
69
|
+
render: () => {
|
|
70
|
+
const [selected, setSelected] = useState<Date | undefined>(new Date());
|
|
71
|
+
const today = new Date();
|
|
72
|
+
|
|
73
|
+
return (
|
|
74
|
+
<Calendar
|
|
75
|
+
selected={selected}
|
|
76
|
+
onSelect={setSelected}
|
|
77
|
+
disabled={[
|
|
78
|
+
{ before: today },
|
|
79
|
+
{ dayOfWeek: [0, 6] }, // Disable weekends
|
|
80
|
+
]}
|
|
81
|
+
/>
|
|
82
|
+
);
|
|
83
|
+
},
|
|
84
|
+
};
|
|
85
|
+
|
|
86
|
+
export const MultipleMonths: Story = {
|
|
87
|
+
render: () => {
|
|
88
|
+
const [selected, setSelected] = useState<Date | undefined>(new Date());
|
|
89
|
+
|
|
90
|
+
return (
|
|
91
|
+
<Calendar
|
|
92
|
+
selected={selected}
|
|
93
|
+
onSelect={setSelected}
|
|
94
|
+
numberOfMonths={2}
|
|
95
|
+
/>
|
|
96
|
+
);
|
|
97
|
+
},
|
|
98
|
+
};
|
|
99
|
+
|
|
100
|
+
export default meta;
|
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
|
|
3
|
+
import { DayPicker, getDefaultClassNames } from 'react-day-picker';
|
|
4
|
+
import { twMerge } from 'tailwind-merge';
|
|
5
|
+
import { CalendarProps } from './Calendar.types';
|
|
6
|
+
import Icon from '../Icon';
|
|
7
|
+
|
|
8
|
+
const Calendar = ({
|
|
9
|
+
testID,
|
|
10
|
+
className,
|
|
11
|
+
classNames,
|
|
12
|
+
selected,
|
|
13
|
+
onSelect,
|
|
14
|
+
datesWithContent = [],
|
|
15
|
+
disabled,
|
|
16
|
+
showOutsideDays = true,
|
|
17
|
+
...props
|
|
18
|
+
}: CalendarProps) => {
|
|
19
|
+
const defaultClassNames = getDefaultClassNames();
|
|
20
|
+
|
|
21
|
+
return (
|
|
22
|
+
<div data-testid={testID || 'Calendar'} className="flex justify-center">
|
|
23
|
+
<DayPicker
|
|
24
|
+
mode="single"
|
|
25
|
+
selected={selected}
|
|
26
|
+
onSelect={onSelect}
|
|
27
|
+
disabled={disabled}
|
|
28
|
+
showOutsideDays={showOutsideDays}
|
|
29
|
+
modifiers={{
|
|
30
|
+
hasContent: datesWithContent,
|
|
31
|
+
}}
|
|
32
|
+
modifiersClassNames={{
|
|
33
|
+
hasContent: 'has-content-date',
|
|
34
|
+
}}
|
|
35
|
+
className={twMerge('p-3 w-fit', className)}
|
|
36
|
+
classNames={{
|
|
37
|
+
root: twMerge('w-fit', defaultClassNames.root),
|
|
38
|
+
months: twMerge('relative flex flex-col gap-4 md:flex-row', defaultClassNames.months),
|
|
39
|
+
month: twMerge('flex w-full flex-col gap-4', defaultClassNames.month),
|
|
40
|
+
nav: twMerge(
|
|
41
|
+
'absolute inset-x-0 top-0 flex w-full items-center justify-between gap-1',
|
|
42
|
+
defaultClassNames.nav,
|
|
43
|
+
),
|
|
44
|
+
button_previous: twMerge(
|
|
45
|
+
'inline-flex items-center justify-center rounded-md h-9 w-9 bg-transparent p-0 opacity-50 hover:opacity-100 transition-opacity',
|
|
46
|
+
defaultClassNames.button_previous,
|
|
47
|
+
),
|
|
48
|
+
button_next: twMerge(
|
|
49
|
+
'inline-flex items-center justify-center rounded-md h-9 w-9 bg-transparent p-0 opacity-50 hover:opacity-100 transition-opacity',
|
|
50
|
+
defaultClassNames.button_next,
|
|
51
|
+
),
|
|
52
|
+
month_caption: twMerge('flex h-9 w-full items-center justify-center px-9', defaultClassNames.month_caption),
|
|
53
|
+
caption_label: twMerge('select-none font-medium text-sm', defaultClassNames.caption_label),
|
|
54
|
+
weekdays: twMerge('flex', defaultClassNames.weekdays),
|
|
55
|
+
weekday: twMerge(
|
|
56
|
+
'text-grey-600 dark:text-grey-400 flex-1 select-none rounded-md text-[0.8rem] font-normal',
|
|
57
|
+
defaultClassNames.weekday,
|
|
58
|
+
),
|
|
59
|
+
week: twMerge('mt-2 flex w-full', defaultClassNames.week),
|
|
60
|
+
day: twMerge(
|
|
61
|
+
defaultClassNames.day,
|
|
62
|
+
'relative aspect-square h-full w-full select-none p-0 text-center [&[data-selected="true"]>button]:border-grey-800',
|
|
63
|
+
),
|
|
64
|
+
day_button: twMerge(
|
|
65
|
+
defaultClassNames.day_button,
|
|
66
|
+
'h-9 w-9 p-0 font-normal inline-flex items-center justify-center rounded-md text-body-text dark:text-body-text-dark',
|
|
67
|
+
'hover:bg-grey-100 dark:hover:bg-grey-800 hover:text-body-text dark:hover:text-body-text-dark',
|
|
68
|
+
'focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-primary',
|
|
69
|
+
'disabled:pointer-events-none disabled:opacity-50',
|
|
70
|
+
'data-[today=true]:bg-grey-100 data-[today=true]:dark:bg-grey-800',
|
|
71
|
+
),
|
|
72
|
+
outside: twMerge('text-grey-400 dark:text-grey-600 opacity-50', defaultClassNames.outside),
|
|
73
|
+
disabled: twMerge('text-grey-400 dark:text-grey-600 opacity-50', defaultClassNames.disabled),
|
|
74
|
+
hidden: twMerge('invisible', defaultClassNames.hidden),
|
|
75
|
+
...classNames,
|
|
76
|
+
}}
|
|
77
|
+
components={{
|
|
78
|
+
Chevron: ({ orientation }: { orientation?: 'up' | 'down' | 'left' | 'right' }) => (
|
|
79
|
+
<Icon name={orientation === 'left' ? 'mdi:chevron-left' : 'mdi:chevron-right'} className="h-4 w-4" />
|
|
80
|
+
),
|
|
81
|
+
}}
|
|
82
|
+
{...props}
|
|
83
|
+
/>
|
|
84
|
+
</div>
|
|
85
|
+
);
|
|
86
|
+
};
|
|
87
|
+
|
|
88
|
+
Calendar.displayName = 'Calendar';
|
|
89
|
+
|
|
90
|
+
export default Calendar;
|
|
91
|
+
export type { CalendarProps };
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { DayPickerProps, Matcher } from 'react-day-picker';
|
|
2
|
+
|
|
3
|
+
export interface CalendarProps extends Omit<DayPickerProps, 'mode'> {
|
|
4
|
+
testID?: string;
|
|
5
|
+
className?: string;
|
|
6
|
+
selected?: Date;
|
|
7
|
+
onSelect?: (date: Date | undefined) => void;
|
|
8
|
+
datesWithContent?: Date[];
|
|
9
|
+
disabled?: Matcher | Matcher[];
|
|
10
|
+
}
|