@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,258 @@
|
|
|
1
|
+
import { useState } from 'react';
|
|
2
|
+
import { Controller, useFormContext } from 'react-hook-form';
|
|
3
|
+
import cx from 'classnames';
|
|
4
|
+
import { FIELD_TYPES, Props } from './FormField.types';
|
|
5
|
+
import TextInput from '../TextInput';
|
|
6
|
+
import { InputType } from '../TextInput/TextInput.types';
|
|
7
|
+
import Checkbox from '../Checkbox';
|
|
8
|
+
import Label from '../Label';
|
|
9
|
+
import FormSelect from '../FormSelect';
|
|
10
|
+
import RadioGroup from '../Radio';
|
|
11
|
+
import Switch from '../Switch';
|
|
12
|
+
import Copy from '../Copy';
|
|
13
|
+
import { COPY_SIZE } from '../Copy/Copy.types';
|
|
14
|
+
import FileUpload from '../FileUpload';
|
|
15
|
+
import Icon from '../Icon';
|
|
16
|
+
|
|
17
|
+
const FormField = ({
|
|
18
|
+
name,
|
|
19
|
+
type,
|
|
20
|
+
label,
|
|
21
|
+
required,
|
|
22
|
+
className,
|
|
23
|
+
icon,
|
|
24
|
+
options,
|
|
25
|
+
disabled,
|
|
26
|
+
description,
|
|
27
|
+
showPasswordLabel,
|
|
28
|
+
hidePasswordLabel,
|
|
29
|
+
validations = {},
|
|
30
|
+
fileUploadCallback = () => {},
|
|
31
|
+
autoComplete,
|
|
32
|
+
}: Props) => {
|
|
33
|
+
const [passwordShowStatus, setPasswordShow] = useState(false);
|
|
34
|
+
const { control, formState } = useFormContext();
|
|
35
|
+
|
|
36
|
+
const { errors } = formState;
|
|
37
|
+
|
|
38
|
+
const renderType = (type: string, field: any) => {
|
|
39
|
+
switch (type) {
|
|
40
|
+
case FIELD_TYPES.HIDDEN:
|
|
41
|
+
return <input type={InputType.HIDDEN} disabled={disabled} {...field} />;
|
|
42
|
+
case FIELD_TYPES.TEXT:
|
|
43
|
+
return (
|
|
44
|
+
<TextInput
|
|
45
|
+
type={InputType.TEXT}
|
|
46
|
+
required={required || Boolean(validations.required)}
|
|
47
|
+
icon={icon}
|
|
48
|
+
className={className}
|
|
49
|
+
disabled={disabled}
|
|
50
|
+
autoComplete={autoComplete}
|
|
51
|
+
{...field}
|
|
52
|
+
/>
|
|
53
|
+
);
|
|
54
|
+
case FIELD_TYPES.PASSWORD: {
|
|
55
|
+
const toggleType = passwordShowStatus ? InputType.TEXT : InputType.PASSWORD;
|
|
56
|
+
const btnClass = 'appearance-none border-none bg-transparent flex items-center';
|
|
57
|
+
return (
|
|
58
|
+
<div className="relative">
|
|
59
|
+
<span
|
|
60
|
+
className="absolute right-0 top-0 flex items-center justify-center h-full z-10 pr-2"
|
|
61
|
+
onClick={() => setPasswordShow((pS) => !pS)}
|
|
62
|
+
role="button"
|
|
63
|
+
tabIndex={0}>
|
|
64
|
+
{passwordShowStatus ? (
|
|
65
|
+
<button type="button" aria-label={hidePasswordLabel} className={cx(btnClass, 'form-icon')}>
|
|
66
|
+
<Icon name="mdi:eye-off" size={24} />
|
|
67
|
+
</button>
|
|
68
|
+
) : (
|
|
69
|
+
<button type="button" aria-label={showPasswordLabel} className={cx(btnClass, 'form-icon')}>
|
|
70
|
+
<Icon name="mdi:eye" size={24} />
|
|
71
|
+
</button>
|
|
72
|
+
)}
|
|
73
|
+
</span>
|
|
74
|
+
<TextInput
|
|
75
|
+
type={toggleType as InputType}
|
|
76
|
+
required={required || Boolean(validations.required)}
|
|
77
|
+
icon={icon}
|
|
78
|
+
className={className}
|
|
79
|
+
disabled={disabled}
|
|
80
|
+
autoComplete={autoComplete}
|
|
81
|
+
{...field}
|
|
82
|
+
/>
|
|
83
|
+
</div>
|
|
84
|
+
);
|
|
85
|
+
}
|
|
86
|
+
case FIELD_TYPES.TEXTAREA:
|
|
87
|
+
return (
|
|
88
|
+
<TextInput
|
|
89
|
+
type={InputType.TEXTAREA}
|
|
90
|
+
required={required || Boolean(validations.required)}
|
|
91
|
+
icon={icon}
|
|
92
|
+
className={className}
|
|
93
|
+
disabled={disabled}
|
|
94
|
+
{...field}
|
|
95
|
+
/>
|
|
96
|
+
);
|
|
97
|
+
case FIELD_TYPES.EMAIL:
|
|
98
|
+
return (
|
|
99
|
+
<TextInput
|
|
100
|
+
type={InputType.EMAIL}
|
|
101
|
+
required={required || Boolean(validations.required)}
|
|
102
|
+
icon={icon}
|
|
103
|
+
className={className}
|
|
104
|
+
disabled={disabled}
|
|
105
|
+
autoComplete={autoComplete}
|
|
106
|
+
{...field}
|
|
107
|
+
/>
|
|
108
|
+
);
|
|
109
|
+
case FIELD_TYPES.DATE:
|
|
110
|
+
return (
|
|
111
|
+
<TextInput
|
|
112
|
+
type={InputType.DATE}
|
|
113
|
+
required={required || Boolean(validations.required)}
|
|
114
|
+
icon={icon}
|
|
115
|
+
className={className}
|
|
116
|
+
disabled={disabled}
|
|
117
|
+
{...field}
|
|
118
|
+
/>
|
|
119
|
+
);
|
|
120
|
+
case FIELD_TYPES.DATETIME:
|
|
121
|
+
return (
|
|
122
|
+
<TextInput
|
|
123
|
+
type={InputType.DATETIME}
|
|
124
|
+
required={required || Boolean(validations.required)}
|
|
125
|
+
icon={icon}
|
|
126
|
+
className={className}
|
|
127
|
+
disabled={disabled}
|
|
128
|
+
{...field}
|
|
129
|
+
/>
|
|
130
|
+
);
|
|
131
|
+
case FIELD_TYPES.NUMBER:
|
|
132
|
+
return (
|
|
133
|
+
<TextInput
|
|
134
|
+
type={InputType.NUMBER}
|
|
135
|
+
required={required || Boolean(validations.required)}
|
|
136
|
+
icon={icon}
|
|
137
|
+
className={className}
|
|
138
|
+
disabled={disabled}
|
|
139
|
+
{...field}
|
|
140
|
+
/>
|
|
141
|
+
);
|
|
142
|
+
case FIELD_TYPES.CHECKBOX:
|
|
143
|
+
return (
|
|
144
|
+
<Checkbox
|
|
145
|
+
required={required || Boolean(validations.required)}
|
|
146
|
+
id={name}
|
|
147
|
+
className={className}
|
|
148
|
+
label={label}
|
|
149
|
+
disabled={disabled}
|
|
150
|
+
{...field}
|
|
151
|
+
/>
|
|
152
|
+
);
|
|
153
|
+
case FIELD_TYPES.RADIO:
|
|
154
|
+
return (
|
|
155
|
+
<RadioGroup
|
|
156
|
+
required={required || Boolean(validations.required)}
|
|
157
|
+
id={name}
|
|
158
|
+
className={className}
|
|
159
|
+
options={options}
|
|
160
|
+
disabled={disabled}
|
|
161
|
+
{...field}
|
|
162
|
+
/>
|
|
163
|
+
);
|
|
164
|
+
case FIELD_TYPES.SWITCH:
|
|
165
|
+
return (
|
|
166
|
+
<Switch
|
|
167
|
+
id={name}
|
|
168
|
+
required={required || Boolean(validations.required)}
|
|
169
|
+
className={className}
|
|
170
|
+
disabled={disabled}
|
|
171
|
+
{...field}
|
|
172
|
+
/>
|
|
173
|
+
);
|
|
174
|
+
case FIELD_TYPES.SELECT:
|
|
175
|
+
return (
|
|
176
|
+
<FormSelect
|
|
177
|
+
required={required || Boolean(validations.required)}
|
|
178
|
+
id={name}
|
|
179
|
+
className={className}
|
|
180
|
+
disabled={disabled}
|
|
181
|
+
label={label}
|
|
182
|
+
options={options}
|
|
183
|
+
{...field}
|
|
184
|
+
/>
|
|
185
|
+
);
|
|
186
|
+
case FIELD_TYPES.FILE:
|
|
187
|
+
return (
|
|
188
|
+
<FileUpload
|
|
189
|
+
required={required || Boolean(validations.required)}
|
|
190
|
+
id={name}
|
|
191
|
+
className={className}
|
|
192
|
+
disabled={disabled}
|
|
193
|
+
onChangeCallback={(event) => {
|
|
194
|
+
fileUploadCallback(event);
|
|
195
|
+
}}
|
|
196
|
+
{...field}
|
|
197
|
+
/>
|
|
198
|
+
);
|
|
199
|
+
default:
|
|
200
|
+
return (
|
|
201
|
+
<TextInput
|
|
202
|
+
type={InputType.TEXT}
|
|
203
|
+
required={required || Boolean(validations.required)}
|
|
204
|
+
disabled={disabled}
|
|
205
|
+
icon={icon}
|
|
206
|
+
className={className}
|
|
207
|
+
{...field}
|
|
208
|
+
/>
|
|
209
|
+
);
|
|
210
|
+
}
|
|
211
|
+
};
|
|
212
|
+
|
|
213
|
+
// TODO: HELPER CLASSES : data-[invalid=true]:bg-error data-[valid]:bg-success
|
|
214
|
+
const showLabel = label && type !== FIELD_TYPES.CHECKBOX;
|
|
215
|
+
const labelWithAsterisk = required || Boolean(validations.required) ? `${label} *` : label;
|
|
216
|
+
return (
|
|
217
|
+
<div className="relative">
|
|
218
|
+
<div data-testid="FormField" className="mb-4">
|
|
219
|
+
{showLabel && (
|
|
220
|
+
<div className="flex items-baseline justify-between">
|
|
221
|
+
<Label id={name}>{labelWithAsterisk}</Label>
|
|
222
|
+
</div>
|
|
223
|
+
)}
|
|
224
|
+
<div className="mb-1">
|
|
225
|
+
<Controller
|
|
226
|
+
// https://stackoverflow.com/questions/47012169/a-component-is-changing-an-uncontrolled-input-of-type-text-to-be-controlled-erro
|
|
227
|
+
defaultValue={''}
|
|
228
|
+
name={name}
|
|
229
|
+
control={control}
|
|
230
|
+
rules={validations}
|
|
231
|
+
render={({ field }) => {
|
|
232
|
+
return renderType(type, field);
|
|
233
|
+
}}
|
|
234
|
+
/>
|
|
235
|
+
</div>
|
|
236
|
+
{description && (
|
|
237
|
+
<div className="formfield-description">
|
|
238
|
+
<Copy size={COPY_SIZE.SMALL} className="mb-0">
|
|
239
|
+
{description}
|
|
240
|
+
</Copy>
|
|
241
|
+
</div>
|
|
242
|
+
)}
|
|
243
|
+
{errors[name] && (
|
|
244
|
+
<div className="formfield-error text-error italic">
|
|
245
|
+
<Copy size={COPY_SIZE.SMALL} className="mb-0">
|
|
246
|
+
{errors?.[name]?.message?.toString()}
|
|
247
|
+
</Copy>
|
|
248
|
+
</div>
|
|
249
|
+
)}
|
|
250
|
+
</div>
|
|
251
|
+
</div>
|
|
252
|
+
);
|
|
253
|
+
};
|
|
254
|
+
|
|
255
|
+
FormField.displayName = 'FormField';
|
|
256
|
+
|
|
257
|
+
export default FormField;
|
|
258
|
+
export type { Props };
|
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
import { OptionsType } from '../FormSelect/FormSelect.types';
|
|
2
|
+
|
|
3
|
+
export enum FIELD_TYPES {
|
|
4
|
+
TEXT = 'text',
|
|
5
|
+
TEXTAREA = 'textarea',
|
|
6
|
+
SELECT = 'select',
|
|
7
|
+
CHECKBOX = 'checkbox',
|
|
8
|
+
RADIO = 'radio',
|
|
9
|
+
SWITCH = 'switch',
|
|
10
|
+
DATE = 'date',
|
|
11
|
+
TIME = 'time',
|
|
12
|
+
DATETIME = 'datetime',
|
|
13
|
+
FILE = 'file',
|
|
14
|
+
PASSWORD = 'password',
|
|
15
|
+
EMAIL = 'email',
|
|
16
|
+
NUMBER = 'number',
|
|
17
|
+
TEL = 'tel',
|
|
18
|
+
URL = 'url',
|
|
19
|
+
SEARCH = 'search',
|
|
20
|
+
HIDDEN = 'hidden',
|
|
21
|
+
// MONTH = 'month',
|
|
22
|
+
// WEEK = 'week',
|
|
23
|
+
// HIDDEN = 'hidden',
|
|
24
|
+
// COLOR = 'color',
|
|
25
|
+
// RANGE = 'range',
|
|
26
|
+
// CURRENCY = 'currency',
|
|
27
|
+
// PERCENT = 'percent',
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
export interface Props {
|
|
31
|
+
type: FIELD_TYPES;
|
|
32
|
+
name: string;
|
|
33
|
+
className?: string;
|
|
34
|
+
label?: string | React.ReactNode[];
|
|
35
|
+
required?: boolean;
|
|
36
|
+
icon?: string;
|
|
37
|
+
options?: Array<OptionsType>;
|
|
38
|
+
disabled?: boolean;
|
|
39
|
+
description?: string;
|
|
40
|
+
showPasswordLabel?: string;
|
|
41
|
+
hidePasswordLabel?: string;
|
|
42
|
+
onChange?: (e: any) => void;
|
|
43
|
+
validations?: any;
|
|
44
|
+
fileUploadCallback?: (file: any) => void;
|
|
45
|
+
autoComplete?:
|
|
46
|
+
| 'off'
|
|
47
|
+
| 'full-name'
|
|
48
|
+
| 'honorific-prefix'
|
|
49
|
+
| 'given-name'
|
|
50
|
+
| 'additional-name'
|
|
51
|
+
| 'family-name'
|
|
52
|
+
| 'honorific-suffix'
|
|
53
|
+
| 'nickname'
|
|
54
|
+
| 'email'
|
|
55
|
+
| 'username'
|
|
56
|
+
| 'new-password'
|
|
57
|
+
| 'current-password'
|
|
58
|
+
| 'one-time-code'
|
|
59
|
+
| 'organization-title'
|
|
60
|
+
| 'organization'
|
|
61
|
+
| 'street-address'
|
|
62
|
+
| 'address-line1'
|
|
63
|
+
| 'address-line2'
|
|
64
|
+
| 'address-line3'
|
|
65
|
+
| 'address-level4'
|
|
66
|
+
| 'address-level3'
|
|
67
|
+
| 'address-level2'
|
|
68
|
+
| 'address-level1'
|
|
69
|
+
| 'country'
|
|
70
|
+
| 'country-name'
|
|
71
|
+
| 'postal-code'
|
|
72
|
+
| 'cc-name'
|
|
73
|
+
| 'cc-given-name'
|
|
74
|
+
| 'cc-additional-name'
|
|
75
|
+
| 'cc-family-name'
|
|
76
|
+
| 'cc-number'
|
|
77
|
+
| 'cc-exp'
|
|
78
|
+
| 'cc-exp-month'
|
|
79
|
+
| 'cc-exp-year'
|
|
80
|
+
| 'cc-csc'
|
|
81
|
+
| 'cc-type'
|
|
82
|
+
| 'transaction-currency'
|
|
83
|
+
| 'transaction-amount'
|
|
84
|
+
| 'language'
|
|
85
|
+
| 'bday'
|
|
86
|
+
| 'bday-day'
|
|
87
|
+
| 'bday-month'
|
|
88
|
+
| 'bday-year';
|
|
89
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default } from './FormField';
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import type { Meta, StoryObj } from '@storybook/nextjs';
|
|
2
|
+
import FormSelect from '.';
|
|
3
|
+
|
|
4
|
+
const meta: Meta<typeof FormSelect> = {
|
|
5
|
+
title: 'MOLECULES/FormSelect',
|
|
6
|
+
component: FormSelect,
|
|
7
|
+
};
|
|
8
|
+
|
|
9
|
+
type Story = StoryObj<typeof FormSelect>;
|
|
10
|
+
|
|
11
|
+
export const Default: Story = {};
|
|
12
|
+
|
|
13
|
+
Default.args = {
|
|
14
|
+
options: [
|
|
15
|
+
{ value: 'value-1', label: 'Option one' },
|
|
16
|
+
{ value: 'value-2', label: 'Option two' },
|
|
17
|
+
{ value: 'value-3', label: 'Option three' },
|
|
18
|
+
{ value: 'value-4', label: 'Option four' },
|
|
19
|
+
{ value: 'value-5', label: 'Option five' },
|
|
20
|
+
{ value: 'value-6', label: 'Option six' },
|
|
21
|
+
{ value: 'value-7', label: 'Option seven' },
|
|
22
|
+
],
|
|
23
|
+
label: 'Select',
|
|
24
|
+
required: false,
|
|
25
|
+
};
|
|
26
|
+
|
|
27
|
+
export default meta;
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import cx from 'classnames';
|
|
3
|
+
import { Props } from './FormSelect.types';
|
|
4
|
+
import Icon from '../Icon';
|
|
5
|
+
|
|
6
|
+
const FormSelect = React.forwardRef(function MyInput(
|
|
7
|
+
{ id, name, options, required, className, disabled, ...rest }: Props,
|
|
8
|
+
ref: any,
|
|
9
|
+
) {
|
|
10
|
+
if (!options) {
|
|
11
|
+
throw new Error('FormSelect requires options prop');
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
return (
|
|
15
|
+
<div id={id} className={cx('pb-2 min-w-20', className)}>
|
|
16
|
+
<div className="relative">
|
|
17
|
+
<select
|
|
18
|
+
ref={ref}
|
|
19
|
+
// id={id}
|
|
20
|
+
name={name}
|
|
21
|
+
disabled={disabled}
|
|
22
|
+
required={required}
|
|
23
|
+
className="form-item text-input pr-10"
|
|
24
|
+
{...rest}>
|
|
25
|
+
{options.map((option, index) => (
|
|
26
|
+
<option
|
|
27
|
+
key={`${option?.value?.toString()}--${index}`}
|
|
28
|
+
value={option?.value?.toString()}
|
|
29
|
+
disabled={option.disabled}
|
|
30
|
+
className="bg-body-bg dark:bg-body-bg-dark">
|
|
31
|
+
{option.label}
|
|
32
|
+
</option>
|
|
33
|
+
))}
|
|
34
|
+
</select>
|
|
35
|
+
<div className="form-icon absolute inset-0 z-10 pointer-events-none h-full w-12 items-center justify-center top-0 right-0 left-auto flex">
|
|
36
|
+
<Icon name="mdi:chevron-down" size={24} className="pointer-events-none" />
|
|
37
|
+
</div>
|
|
38
|
+
</div>
|
|
39
|
+
</div>
|
|
40
|
+
);
|
|
41
|
+
});
|
|
42
|
+
|
|
43
|
+
FormSelect.displayName = 'FormSelect';
|
|
44
|
+
|
|
45
|
+
export default FormSelect;
|
|
46
|
+
export type { Props };
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import { FilterValue } from '@elastic/search-ui';
|
|
2
|
+
|
|
3
|
+
export type OptionsType = {
|
|
4
|
+
value: string | FilterValue;
|
|
5
|
+
label: string;
|
|
6
|
+
/** The selected option's value. */
|
|
7
|
+
defaultValue?: string;
|
|
8
|
+
disabled?: boolean;
|
|
9
|
+
};
|
|
10
|
+
|
|
11
|
+
export interface Props {
|
|
12
|
+
/** The selected option's value. */
|
|
13
|
+
options?: Array<OptionsType>;
|
|
14
|
+
/** Unique id for the field, required for a11y. */
|
|
15
|
+
id: string;
|
|
16
|
+
/** The select visible default label value. */
|
|
17
|
+
label?: string | React.ReactNode[];
|
|
18
|
+
/** Is field required. */
|
|
19
|
+
required?: boolean;
|
|
20
|
+
/** Additional classes. */
|
|
21
|
+
className?: string;
|
|
22
|
+
/** Dropdown icon color. */
|
|
23
|
+
iconColor?: string;
|
|
24
|
+
/** Dropdown icon color. */
|
|
25
|
+
itemIcon?: string;
|
|
26
|
+
/** Additional wrapper CSS classes. */
|
|
27
|
+
wrapperStyles?: string;
|
|
28
|
+
/** Select Up Icon. */
|
|
29
|
+
selectIconUp?: string;
|
|
30
|
+
/** Select Down Icon. */
|
|
31
|
+
selectIconDown?: string;
|
|
32
|
+
/** Select Form Item Name. */
|
|
33
|
+
name?: string;
|
|
34
|
+
/** Is field disabled. */
|
|
35
|
+
disabled?: boolean;
|
|
36
|
+
/** The selected option's value. */
|
|
37
|
+
onChange?: (e: React.ChangeEvent<HTMLSelectElement>) => void;
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
export interface ItemProps {
|
|
41
|
+
children: React.ReactNode;
|
|
42
|
+
value: string;
|
|
43
|
+
itemIcon: string;
|
|
44
|
+
iconColor?: string;
|
|
45
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default } from './FormSelect';
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import type { Meta, StoryObj } from '@storybook/nextjs';
|
|
2
|
+
import FullContentBackgroundImage from '.';
|
|
3
|
+
|
|
4
|
+
const meta: Meta<typeof FullContentBackgroundImage> = {
|
|
5
|
+
title: 'UI/FullContentBackgroundImage',
|
|
6
|
+
component: FullContentBackgroundImage,
|
|
7
|
+
};
|
|
8
|
+
|
|
9
|
+
type Story = StoryObj<typeof FullContentBackgroundImage>;
|
|
10
|
+
|
|
11
|
+
export const Default: Story = {
|
|
12
|
+
args: {
|
|
13
|
+
image: 'https://picsum.photos/1600/800',
|
|
14
|
+
children: <div>Content</div>,
|
|
15
|
+
},
|
|
16
|
+
};
|
|
17
|
+
|
|
18
|
+
export default meta;
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { Props } from './FullContentBackgroundImage.types';
|
|
3
|
+
|
|
4
|
+
const FullContentBackgroundImage = ({ testID, children, image, imageMob }: Props) => {
|
|
5
|
+
if (!image && !imageMob) {
|
|
6
|
+
return <div>{children}</div>;
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
return (
|
|
10
|
+
<div
|
|
11
|
+
data-testid={testID || '"FullContentBackgroundImage"'}
|
|
12
|
+
className="bg-center bg-no-repeat bg-cover min-h-screen w-screen overflow-hidden fixed top-0 left-0 right-0 bottom-0 z-0">
|
|
13
|
+
<span
|
|
14
|
+
className="absolute h-screen w-screen top-0 left-0 right-0 bottom-0 opacity-30 bg-cover bg-center blur-md"
|
|
15
|
+
style={{
|
|
16
|
+
backgroundImage: `url(${image})`,
|
|
17
|
+
}}></span>
|
|
18
|
+
{children}
|
|
19
|
+
</div>
|
|
20
|
+
);
|
|
21
|
+
};
|
|
22
|
+
|
|
23
|
+
FullContentBackgroundImage.displayName = 'FullContentBackgroundImage';
|
|
24
|
+
|
|
25
|
+
export default FullContentBackgroundImage;
|
|
26
|
+
export type { Props };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default } from './FullContentBackgroundImage';
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import type { Meta, StoryObj } from '@storybook/nextjs';
|
|
2
|
+
import FullScreenVideoModal from '.';
|
|
3
|
+
|
|
4
|
+
const meta: Meta<typeof FullScreenVideoModal> = {
|
|
5
|
+
title: 'UI/FullScreenVideoModal',
|
|
6
|
+
component: FullScreenVideoModal,
|
|
7
|
+
};
|
|
8
|
+
|
|
9
|
+
type Story = StoryObj<typeof FullScreenVideoModal>;
|
|
10
|
+
|
|
11
|
+
export const Default: Story = {
|
|
12
|
+
// parameters: {
|
|
13
|
+
// layout: 'fullscreen',
|
|
14
|
+
// },
|
|
15
|
+
args: {
|
|
16
|
+
videoProps: {
|
|
17
|
+
sources: [
|
|
18
|
+
{
|
|
19
|
+
src: 'https://d227lq76md6ahr.cloudfront.net/6f931020-437f-4484-a966-82e40c6a4e8c/hls/livestream--upper-body-blast--05-05-2024.m3u8',
|
|
20
|
+
type: 'application/x-mpegURL',
|
|
21
|
+
},
|
|
22
|
+
],
|
|
23
|
+
options: {
|
|
24
|
+
poster: 'https://assets.nrgbarrebody.app/2021-05/202103%20NBP%20-%20NRG%20BarreBody-67-min.jpg',
|
|
25
|
+
autoplay: true,
|
|
26
|
+
muted: false,
|
|
27
|
+
fluid: false,
|
|
28
|
+
},
|
|
29
|
+
isModal: true,
|
|
30
|
+
},
|
|
31
|
+
},
|
|
32
|
+
};
|
|
33
|
+
|
|
34
|
+
export default meta;
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import React, { useEffect, useState } from 'react';
|
|
2
|
+
import { Props } from './FullScreenVideoModal.types';
|
|
3
|
+
import Modal from 'react-modal';
|
|
4
|
+
import Video from '../Video';
|
|
5
|
+
import Button from '../Button';
|
|
6
|
+
|
|
7
|
+
const FullScreenVideoModal = ({
|
|
8
|
+
testID,
|
|
9
|
+
modalOpen = true,
|
|
10
|
+
videoProps,
|
|
11
|
+
ariaHideApp = false,
|
|
12
|
+
onCloseCallback = () => {},
|
|
13
|
+
}: Props) => {
|
|
14
|
+
const [modalIsOpen, setModalIsOpen] = useState(false);
|
|
15
|
+
|
|
16
|
+
useEffect(() => {
|
|
17
|
+
if (modalOpen) {
|
|
18
|
+
setModalIsOpen(true);
|
|
19
|
+
}
|
|
20
|
+
}, [modalOpen]);
|
|
21
|
+
|
|
22
|
+
return (
|
|
23
|
+
<Modal
|
|
24
|
+
isOpen={modalIsOpen}
|
|
25
|
+
onRequestClose={onCloseCallback}
|
|
26
|
+
className="absolute bg-none top-1/2 left-1/2 right-auto bottom-auto mr-[-50%] transform translate-x-[-50%] translate-y-[-50%] w-full h-full p-0"
|
|
27
|
+
overlayClassName="fixed top-0 left-0 right-0 bottom-0 bg-black bg-opacity-100 z-50"
|
|
28
|
+
ariaHideApp={ariaHideApp} // Only use in development, adjust for production use
|
|
29
|
+
data-testid={testID || 'FullScreenVideoModal'}>
|
|
30
|
+
<div className="h-full relative">
|
|
31
|
+
<Button rounded icon="mdi:close" onClick={onCloseCallback} className="absolute top-4 right-4 z-50" />
|
|
32
|
+
<Video {...videoProps} />
|
|
33
|
+
</div>
|
|
34
|
+
</Modal>
|
|
35
|
+
);
|
|
36
|
+
};
|
|
37
|
+
|
|
38
|
+
FullScreenVideoModal.displayName = 'FullScreenVideoModal';
|
|
39
|
+
|
|
40
|
+
export default FullScreenVideoModal;
|
|
41
|
+
export type { Props };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default } from './FullScreenVideoModal';
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
import type { Meta, StoryObj } from '@storybook/nextjs';
|
|
2
|
+
import Header from '.';
|
|
3
|
+
import React from 'react';
|
|
4
|
+
|
|
5
|
+
const meta: Meta<typeof Header> = {
|
|
6
|
+
title: 'LAYOUTS/Header',
|
|
7
|
+
component: Header,
|
|
8
|
+
parameters: {
|
|
9
|
+
layout: 'fullscreen',
|
|
10
|
+
},
|
|
11
|
+
};
|
|
12
|
+
|
|
13
|
+
type Story = StoryObj<typeof Header>;
|
|
14
|
+
|
|
15
|
+
export const Default: Story = {
|
|
16
|
+
args: {
|
|
17
|
+
testID: 'header-story',
|
|
18
|
+
userPicture: 'https://dpyu2eix72mhm.cloudfront.net/1723117330741-CB12A65C-FBBD-4F91-89F4-1AE8BB9AC72F.jpg',
|
|
19
|
+
},
|
|
20
|
+
render: props => {
|
|
21
|
+
const [isLoggedIn, setIsLoggedIn] = React.useState(false);
|
|
22
|
+
|
|
23
|
+
return (
|
|
24
|
+
<div>
|
|
25
|
+
<Header
|
|
26
|
+
{...props}
|
|
27
|
+
loginCallback={() => setIsLoggedIn(true)}
|
|
28
|
+
logoutCallback={() => setIsLoggedIn(false)}
|
|
29
|
+
isAuthenticated={isLoggedIn}
|
|
30
|
+
/>
|
|
31
|
+
</div>
|
|
32
|
+
);
|
|
33
|
+
},
|
|
34
|
+
};
|
|
35
|
+
|
|
36
|
+
export const LogoOnly: Story = {
|
|
37
|
+
args: {
|
|
38
|
+
testID: 'header-story',
|
|
39
|
+
logoOnly: true,
|
|
40
|
+
},
|
|
41
|
+
render: props => {
|
|
42
|
+
|
|
43
|
+
return (
|
|
44
|
+
<div>
|
|
45
|
+
<Header {...props} />
|
|
46
|
+
</div>
|
|
47
|
+
);
|
|
48
|
+
},
|
|
49
|
+
};
|
|
50
|
+
|
|
51
|
+
export default meta;
|