@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,84 @@
|
|
|
1
|
+
import { Props } from './Result.types';
|
|
2
|
+
import cx from 'classnames';
|
|
3
|
+
import he from 'he';
|
|
4
|
+
import { getEscapedField } from '../../view-helpers';
|
|
5
|
+
import Card from '../../../../components/Card';
|
|
6
|
+
import { CardVariant, ImageData } from '../../../../components/Card/Card.types';
|
|
7
|
+
import { ResultAsTypes } from '../../Search.types';
|
|
8
|
+
|
|
9
|
+
function Result({
|
|
10
|
+
className,
|
|
11
|
+
result,
|
|
12
|
+
// onClickLink,
|
|
13
|
+
as,
|
|
14
|
+
cardMap = {
|
|
15
|
+
idField: { fieldName: 'uuid' },
|
|
16
|
+
titleField: { fieldName: 'title' },
|
|
17
|
+
descriptionField: { fieldName: 'description' },
|
|
18
|
+
imageField: { fieldName: 'image' },
|
|
19
|
+
},
|
|
20
|
+
}: Props) {
|
|
21
|
+
// Pass fields into the relevant Card.
|
|
22
|
+
// const fields: any = formatResult(result);
|
|
23
|
+
const { idField, titleField, imageField, videoField, descriptionField, metaDataFields, cardProps } = cardMap;
|
|
24
|
+
|
|
25
|
+
const id: string = idField && getEscapedField(result[idField.fieldName]);
|
|
26
|
+
const title = titleField && getEscapedField(result[titleField.fieldName]);
|
|
27
|
+
const defaultImageUrl = imageField && getEscapedField(result[imageField.fieldName]);
|
|
28
|
+
const imageUrl = defaultImageUrl ? defaultImageUrl : getEscapedField(result['image']);
|
|
29
|
+
const videoUrl =
|
|
30
|
+
videoField && videoField.formatter
|
|
31
|
+
? videoField.formatter(getEscapedField(result[videoField.fieldName]))
|
|
32
|
+
: videoField && getEscapedField(result[videoField.fieldName]);
|
|
33
|
+
const description = descriptionField && getEscapedField(result[descriptionField.fieldName]);
|
|
34
|
+
const metaData =
|
|
35
|
+
metaDataFields &&
|
|
36
|
+
metaDataFields.map(field => {
|
|
37
|
+
const value = getEscapedField(result[field.fieldName]);
|
|
38
|
+
if (field.formatter && typeof field.formatter === 'function') {
|
|
39
|
+
return field.formatter(value);
|
|
40
|
+
}
|
|
41
|
+
});
|
|
42
|
+
|
|
43
|
+
const resultView = () => {
|
|
44
|
+
const imageData: ImageData = {
|
|
45
|
+
src: imageUrl || '',
|
|
46
|
+
alt: title || '',
|
|
47
|
+
title: title || '',
|
|
48
|
+
width: 500,
|
|
49
|
+
height: 500,
|
|
50
|
+
};
|
|
51
|
+
|
|
52
|
+
// Support dynamic actionsData as a function that receives the result
|
|
53
|
+
const actions = typeof cardMap.actionsData === 'function'
|
|
54
|
+
? cardMap.actionsData(result)
|
|
55
|
+
: cardMap.actionsData;
|
|
56
|
+
|
|
57
|
+
const cardData = {
|
|
58
|
+
id,
|
|
59
|
+
title: he.decode(title),
|
|
60
|
+
image: imageData,
|
|
61
|
+
video: videoUrl,
|
|
62
|
+
description,
|
|
63
|
+
metaData,
|
|
64
|
+
actions,
|
|
65
|
+
onClick: cardMap.onClickLink,
|
|
66
|
+
};
|
|
67
|
+
|
|
68
|
+
switch (as) {
|
|
69
|
+
case ResultAsTypes.cardMedia:
|
|
70
|
+
return <Card variant={CardVariant.MEDIA} data={cardData} {...cardProps} />;
|
|
71
|
+
case ResultAsTypes.cardVideo:
|
|
72
|
+
return <Card variant={CardVariant.VIDEO} data={cardData} {...cardProps} isMuted={false} />;
|
|
73
|
+
default:
|
|
74
|
+
return <Card variant={CardVariant.BASIC} data={cardData} {...cardProps} />;
|
|
75
|
+
}
|
|
76
|
+
};
|
|
77
|
+
|
|
78
|
+
return <li className={cx('relative', className)}>{resultView()}</li>;
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
Result.displayName = 'Result';
|
|
82
|
+
|
|
83
|
+
export default Result;
|
|
84
|
+
export type { Props };
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
import { BaseContainerProps } from '@elastic/react-search-ui/lib/esm/types';
|
|
2
|
+
import { SearchContextState } from '@elastic/search-ui';
|
|
3
|
+
import { ResultAsTypes } from '../../Search.types';
|
|
4
|
+
import { Actions } from '../../../../components/Card/Card.types';
|
|
5
|
+
|
|
6
|
+
export type ResultContainerContext = Pick<SearchContextState, 'trackClickThrough'>;
|
|
7
|
+
|
|
8
|
+
export type ResultContainerProps = BaseContainerProps &
|
|
9
|
+
ResultContainerContext & {
|
|
10
|
+
view?: React.ComponentType<ResultViewProps>;
|
|
11
|
+
clickThroughTags?: string[];
|
|
12
|
+
titleField?: string;
|
|
13
|
+
urlField?: string;
|
|
14
|
+
thumbnailField?: string;
|
|
15
|
+
result: any; // TODO: typing `SearchResult`;
|
|
16
|
+
shouldTrackClickThrough?: boolean;
|
|
17
|
+
};
|
|
18
|
+
|
|
19
|
+
export type ResultViewProps = BaseContainerProps &
|
|
20
|
+
Pick<ResultContainerProps, 'result' | 'titleField' | 'urlField' | 'thumbnailField'> & {
|
|
21
|
+
key?: string;
|
|
22
|
+
onClickLink: () => void;
|
|
23
|
+
};
|
|
24
|
+
|
|
25
|
+
interface FormatterField {
|
|
26
|
+
fieldName: string;
|
|
27
|
+
formatter?: (value: any) => any;
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
export interface cardMap {
|
|
31
|
+
idField: FormatterField;
|
|
32
|
+
titleField: FormatterField;
|
|
33
|
+
descriptionField?: FormatterField;
|
|
34
|
+
imageField?: FormatterField;
|
|
35
|
+
videoField?: FormatterField;
|
|
36
|
+
metaDataFields?: FormatterField[];
|
|
37
|
+
clickThroughPathField?: string;
|
|
38
|
+
actionsData?: Actions | ((result: any) => Actions);
|
|
39
|
+
cardProps?: any; // TODO: typing `CardProps`;
|
|
40
|
+
onClickLink?: (data: any) => void;
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
export interface Props extends ResultViewProps {
|
|
44
|
+
custom?: string;
|
|
45
|
+
as: ResultAsTypes;
|
|
46
|
+
cardMap?: cardMap;
|
|
47
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default } from './Result';
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import cx from 'classnames';
|
|
2
|
+
import { Props } from './Results.types';
|
|
3
|
+
|
|
4
|
+
function Results({ children, className, gridClasses, ...rest }: Props & React.HTMLAttributes<HTMLUListElement>) {
|
|
5
|
+
const layoutClasses = gridClasses || 'grid-cols-1 md:grid-cols-2 lg:grid-cols-3';
|
|
6
|
+
return (
|
|
7
|
+
<ul className={cx('relative grid gap-4 mb-4', layoutClasses, className)} {...rest}>
|
|
8
|
+
{children}
|
|
9
|
+
</ul>
|
|
10
|
+
);
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
Results.displayName = 'Results';
|
|
14
|
+
|
|
15
|
+
export default Results;
|
|
16
|
+
export type { Props };
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { ResultViewProps } from "@elastic/react-search-ui-views";
|
|
2
|
+
import { BaseContainerProps } from "@elastic/react-search-ui/lib/esm/types";
|
|
3
|
+
import { SearchContextState } from "@elastic/search-ui";
|
|
4
|
+
|
|
5
|
+
export type ResultsContainerContext = Pick<SearchContextState, 'results'>;
|
|
6
|
+
|
|
7
|
+
export type ResultsContainerProps = BaseContainerProps &
|
|
8
|
+
ResultsContainerContext & {
|
|
9
|
+
view?: React.ComponentType<ResultsViewProps>;
|
|
10
|
+
resultView?: React.ComponentType<ResultViewProps>;
|
|
11
|
+
clickThroughTags?: string[];
|
|
12
|
+
titleField?: string;
|
|
13
|
+
urlField?: string;
|
|
14
|
+
thumbnailField?: string;
|
|
15
|
+
results: any[]; // SearchResult[]; TODO type the RESULT
|
|
16
|
+
shouldTrackClickThrough?: boolean;
|
|
17
|
+
};
|
|
18
|
+
|
|
19
|
+
export type ResultsViewProps = BaseContainerProps;
|
|
20
|
+
|
|
21
|
+
export interface Props extends ResultsViewProps {
|
|
22
|
+
custom?: string;
|
|
23
|
+
gridClasses?: string;
|
|
24
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default } from './Results';
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import cx from 'classnames';
|
|
2
|
+
import { Props } from './ResultsPerPage.types';
|
|
3
|
+
import Label from '../../../../components/Label';
|
|
4
|
+
import FormSelect from '../../../../components/FormSelect';
|
|
5
|
+
import { COPY_TRANSFORM } from '../../../../components/Copy/Copy.types';
|
|
6
|
+
import STRINGS from '../../../../translations';
|
|
7
|
+
|
|
8
|
+
function ResultsPerPage({ className, onChange, options, label }: Props) {
|
|
9
|
+
// Return nothing without options.
|
|
10
|
+
if (!options) {
|
|
11
|
+
return <></>;
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
return (
|
|
15
|
+
<div className={cx('m-0 p-0 mb-2 border-none', className)}>
|
|
16
|
+
<Label className="text-sm mr-2" transform={COPY_TRANSFORM.UPPERCASE}>
|
|
17
|
+
{STRINGS.UI.SHOW}
|
|
18
|
+
</Label>
|
|
19
|
+
<FormSelect
|
|
20
|
+
id={label || 'ResultsPerPage'}
|
|
21
|
+
options={options.map((option) => ({ label: option.toString(), value: option }))}
|
|
22
|
+
onChange={(o: any) => onChange(o.target.value)}
|
|
23
|
+
className="min-w-20"
|
|
24
|
+
/>
|
|
25
|
+
</div>
|
|
26
|
+
);
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
ResultsPerPage.displayName = 'ResultsPerPage';
|
|
30
|
+
|
|
31
|
+
export default ResultsPerPage;
|
|
32
|
+
export type { Props };
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { Rename } from '@elastic/react-search-ui-views';
|
|
2
|
+
import { BaseContainerProps } from '@elastic/react-search-ui/lib/esm/types';
|
|
3
|
+
import { SearchContextState } from '@elastic/search-ui';
|
|
4
|
+
|
|
5
|
+
export type ResultsPerPageContainerContext = Pick<SearchContextState, 'resultsPerPage' | 'setResultsPerPage'>;
|
|
6
|
+
|
|
7
|
+
export type ResultsPerPageContainerProps = BaseContainerProps &
|
|
8
|
+
ResultsPerPageContainerContext & {
|
|
9
|
+
view?: React.ComponentType<ResultsPerPageViewProps>;
|
|
10
|
+
options?: number[];
|
|
11
|
+
};
|
|
12
|
+
|
|
13
|
+
export type ResultsPerPageViewProps = BaseContainerProps &
|
|
14
|
+
Pick<ResultsPerPageContainerProps, 'options'> &
|
|
15
|
+
Rename<
|
|
16
|
+
ResultsPerPageContainerContext,
|
|
17
|
+
{
|
|
18
|
+
setResultsPerPage: 'onChange';
|
|
19
|
+
resultsPerPage: 'value';
|
|
20
|
+
}
|
|
21
|
+
>;
|
|
22
|
+
|
|
23
|
+
export interface Props extends ResultsPerPageViewProps {
|
|
24
|
+
custom?: string;
|
|
25
|
+
label?: string;
|
|
26
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default } from './ResultsPerPage';
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
import { BTN_TYPES, BTN_VARIANTS } from '../../../../components/Button/Button.types';
|
|
2
|
+
import Button from '../../../../components/Button';
|
|
3
|
+
import TextInput from '../../../../components/TextInput';
|
|
4
|
+
import { InputType } from '../../../../components/TextInput/TextInput.types';
|
|
5
|
+
import { Props } from './SearchBox.types';
|
|
6
|
+
import cx from 'classnames';
|
|
7
|
+
|
|
8
|
+
function SearchBox({
|
|
9
|
+
className,
|
|
10
|
+
onChange,
|
|
11
|
+
onSubmit,
|
|
12
|
+
wasSearched,
|
|
13
|
+
placeholder,
|
|
14
|
+
allowReset = false,
|
|
15
|
+
resetTrigger = () => {},
|
|
16
|
+
}: Props) {
|
|
17
|
+
return (
|
|
18
|
+
<div className={cx('m-0 md:px-48', className)}>
|
|
19
|
+
<form onSubmit={e => onSubmit(e)} className="flex items-center">
|
|
20
|
+
<div className="flex-1 bg-body-bg dark:bg-body-bg-dark bg-opacity-80 rounded">
|
|
21
|
+
<TextInput
|
|
22
|
+
name="SearchBoxInput"
|
|
23
|
+
type={InputType.TEXT}
|
|
24
|
+
placeholder={placeholder || 'Search now...'}
|
|
25
|
+
onChange={e => {
|
|
26
|
+
onChange(e?.target?.value);
|
|
27
|
+
}}
|
|
28
|
+
/>
|
|
29
|
+
</div>
|
|
30
|
+
<div className="pl-4">
|
|
31
|
+
<div className="flex flex-row gap-2">
|
|
32
|
+
{wasSearched && allowReset && (
|
|
33
|
+
<Button
|
|
34
|
+
type={BTN_TYPES.BUTTON}
|
|
35
|
+
onClick={() => resetTrigger('', { shouldClearFilters: false })}
|
|
36
|
+
variant={BTN_VARIANTS.SECONDARY}
|
|
37
|
+
icon="mdi:restore"
|
|
38
|
+
/>
|
|
39
|
+
)}
|
|
40
|
+
<Button type={BTN_TYPES.SUBMIT} variant={BTN_VARIANTS.PRIMARY} icon="mdi:magnify" />
|
|
41
|
+
</div>
|
|
42
|
+
</div>
|
|
43
|
+
</form>
|
|
44
|
+
</div>
|
|
45
|
+
);
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
SearchBox.displayName = 'SearchBox';
|
|
49
|
+
|
|
50
|
+
export default SearchBox;
|
|
51
|
+
export type { Props };
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
export interface Props {
|
|
2
|
+
onChange: (data?: any) => void;
|
|
3
|
+
onSubmit: (data?: any) => void;
|
|
4
|
+
className?: string;
|
|
5
|
+
value?: string;
|
|
6
|
+
wasSearched?: boolean;
|
|
7
|
+
placeholder?: string;
|
|
8
|
+
allowReset?: boolean;
|
|
9
|
+
resetTrigger?: (data?: any, options?: any) => void;
|
|
10
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default } from './SearchBox';
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { Props } from './Sidebar.types';
|
|
3
|
+
|
|
4
|
+
const Sidebar = ({ foo }: Props) => {
|
|
5
|
+
return (
|
|
6
|
+
<div data-testid="Sidebar" className="foo-bar">{foo}</div>
|
|
7
|
+
);
|
|
8
|
+
};
|
|
9
|
+
|
|
10
|
+
Sidebar.displayName = 'Sidebar';
|
|
11
|
+
|
|
12
|
+
export default Sidebar;
|
|
13
|
+
export type { Props };
|
|
14
|
+
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default } from './Sidebar';
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import cx from 'classnames';
|
|
3
|
+
import { getFilterValueDisplay } from '../../view-helpers';
|
|
4
|
+
import { Props } from './SingleLinksFacet.types';
|
|
5
|
+
import type { FieldValue } from '@elastic/search-ui';
|
|
6
|
+
import Label from '../../../../components/Label';
|
|
7
|
+
import Copy from '../../../../components/Copy';
|
|
8
|
+
import { COPY_SIZE, COPY_TAG, COPY_TRANSFORM } from '../../../../components/Copy/Copy.types';
|
|
9
|
+
import Button from '../../../../components/Button';
|
|
10
|
+
import { BTN_SIZES } from '../../../../components/Button/Button.types';
|
|
11
|
+
import Icon from '../../../../components/Icon';
|
|
12
|
+
|
|
13
|
+
function SingleLinksFacet({ className, label, onRemove, onSelect, options }: Props) {
|
|
14
|
+
const value = options.filter((o) => o.selected).map((o) => o.value)[0];
|
|
15
|
+
return (
|
|
16
|
+
<fieldset className={cx('m-0 p-0 mt-4 mb-2 border-none', className)}>
|
|
17
|
+
<div>
|
|
18
|
+
<Label transform={COPY_TRANSFORM.UPPERCASE}>
|
|
19
|
+
{label}
|
|
20
|
+
</Label>
|
|
21
|
+
<ul className="ul list-none p-0">
|
|
22
|
+
{value && (
|
|
23
|
+
<li className="m-0 flex justify-between items-center flex-1">
|
|
24
|
+
{getFilterValueDisplay(value)}
|
|
25
|
+
<span className="ml-1 px-1">
|
|
26
|
+
<Button onClick={() => onRemove(value as FieldValue)} size={BTN_SIZES.SMALL} rounded>
|
|
27
|
+
<Icon name="mdi:close" />
|
|
28
|
+
</Button>
|
|
29
|
+
</span>
|
|
30
|
+
</li>
|
|
31
|
+
)}
|
|
32
|
+
{!value &&
|
|
33
|
+
options.map((option) => {
|
|
34
|
+
const filterValue = getFilterValueDisplay(option.value);
|
|
35
|
+
return (
|
|
36
|
+
<li className="m-0 flex justify-between" key={filterValue}>
|
|
37
|
+
<a
|
|
38
|
+
className="no-underline visited:text-body-text"
|
|
39
|
+
data-transaction-name={`facet - ${label}`}
|
|
40
|
+
href="/"
|
|
41
|
+
onClick={(e) => {
|
|
42
|
+
e.preventDefault();
|
|
43
|
+
onSelect(option.value as FieldValue);
|
|
44
|
+
}}>
|
|
45
|
+
<label className="label pl-0 leading-none text-body-text dark:text-body-text-dark">{filterValue}</label>
|
|
46
|
+
</a>
|
|
47
|
+
<Copy as={COPY_TAG.SPAN} size={COPY_SIZE.MEDIUM}>
|
|
48
|
+
{option.count.toLocaleString('en')}
|
|
49
|
+
</Copy>
|
|
50
|
+
</li>
|
|
51
|
+
);
|
|
52
|
+
})}
|
|
53
|
+
</ul>
|
|
54
|
+
</div>
|
|
55
|
+
</fieldset>
|
|
56
|
+
);
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
SingleLinksFacet.displayName = 'SingleLinksFacet';
|
|
60
|
+
|
|
61
|
+
export default SingleLinksFacet;
|
|
62
|
+
export type { Props };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default } from './SingleLinksFacet';
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import cx from 'classnames';
|
|
2
|
+
import { Props } from './SingleSelectFacet.types';
|
|
3
|
+
import FormSelect from '../../../../components/FormSelect';
|
|
4
|
+
import Label from '../../../../components/Label';
|
|
5
|
+
import { COPY_TRANSFORM } from '../../../../components/Copy/Copy.types';
|
|
6
|
+
|
|
7
|
+
function SingleSelectFacet({ className, label, onChange, options }: Props) {
|
|
8
|
+
const selectBoxOptions = options.map(option => {
|
|
9
|
+
return {
|
|
10
|
+
value: option.value,
|
|
11
|
+
label: `${option.value} (${option.count})`,
|
|
12
|
+
};
|
|
13
|
+
});
|
|
14
|
+
return (
|
|
15
|
+
<fieldset className={cx('m-0 p-0 mt-4 mb-2 border-none', className)}>
|
|
16
|
+
<Label className="text-sm" transform={COPY_TRANSFORM.UPPERCASE}>
|
|
17
|
+
{label}
|
|
18
|
+
</Label>
|
|
19
|
+
<FormSelect
|
|
20
|
+
id={label}
|
|
21
|
+
options={selectBoxOptions}
|
|
22
|
+
onChange={(o: any) => {
|
|
23
|
+
console.debug('SingleSelectFacet onChange', o.target.value);
|
|
24
|
+
onChange(o.target.value);
|
|
25
|
+
}}
|
|
26
|
+
/>
|
|
27
|
+
</fieldset>
|
|
28
|
+
);
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
SingleSelectFacet.displayName = 'SingleSelectFacet';
|
|
32
|
+
|
|
33
|
+
export default SingleSelectFacet;
|
|
34
|
+
export type { Props };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default } from './SingleSelectFacet';
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import cx from 'classnames';
|
|
2
|
+
import { Props } from './Sorting.types';
|
|
3
|
+
import FormSelect from '../../../../components/FormSelect';
|
|
4
|
+
import { COPY_TRANSFORM } from '../../../../components/Copy/Copy.types';
|
|
5
|
+
import Label from '../../../../components/Label';
|
|
6
|
+
|
|
7
|
+
function Sorting({ className, label, onChange, options }: Props) {
|
|
8
|
+
if (!options) {
|
|
9
|
+
return null;
|
|
10
|
+
}
|
|
11
|
+
return (
|
|
12
|
+
<div className={cx('m-0 p-0 mb-2 border-none', className)}>
|
|
13
|
+
<Label className="text-sm" transform={COPY_TRANSFORM.UPPERCASE}>
|
|
14
|
+
{label}
|
|
15
|
+
</Label>
|
|
16
|
+
<FormSelect id={label || 'Sorting'} options={options} onChange={(o: any) => onChange(o.target.value)} />
|
|
17
|
+
</div>
|
|
18
|
+
);
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
Sorting.displayName = 'Sorting';
|
|
22
|
+
|
|
23
|
+
export default Sorting;
|
|
24
|
+
export type { Props };
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { BaseContainerProps } from '@elastic/react-search-ui/lib/esm/types';
|
|
2
|
+
import { SearchContextState } from '@elastic/search-ui';
|
|
3
|
+
|
|
4
|
+
export type SortingContainerContext = Pick<SearchContextState, 'sortDirection' | 'sortField' | 'sortList' | 'setSort'>;
|
|
5
|
+
|
|
6
|
+
export type SortingContainerProps = BaseContainerProps &
|
|
7
|
+
SortingContainerContext & {
|
|
8
|
+
view?: React.ComponentType<SortingViewProps>;
|
|
9
|
+
label?: string;
|
|
10
|
+
sortOptions: any;
|
|
11
|
+
};
|
|
12
|
+
|
|
13
|
+
export type SortingViewProps = BaseContainerProps &
|
|
14
|
+
Pick<SortingContainerProps, 'label'> & {
|
|
15
|
+
onChange: (sortData?: any) => void;
|
|
16
|
+
options: {
|
|
17
|
+
value: string;
|
|
18
|
+
label: string;
|
|
19
|
+
}[];
|
|
20
|
+
value: string;
|
|
21
|
+
};
|
|
22
|
+
|
|
23
|
+
export interface Props extends SortingViewProps {
|
|
24
|
+
custom?: string;
|
|
25
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default } from './Sorting';
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
// Features
|
|
2
|
+
export { default as Search } from './Search';
|
|
3
|
+
|
|
4
|
+
// Feature Helpers
|
|
5
|
+
export { default as SingleSelectFacet } from './Search/views/SingleSelectFacet';
|
|
6
|
+
export { default as SingleLinksFacet } from './Search/views/SingleLinksFacet';
|
|
7
|
+
export { default as MultiCheckboxFacet } from './Search/views/MultiCheckboxFacet';
|
|
8
|
+
|
|
9
|
+
// Types
|
|
10
|
+
export { ResultAsTypes } from './Search/Search.types';
|
|
11
|
+
export type { Props as SearchProps } from './Search/Search.types';
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import type { Meta, StoryObj } from '@storybook/nextjs';
|
|
2
|
+
import ForgotPasswordForm from '.';
|
|
3
|
+
|
|
4
|
+
const meta: Meta<typeof ForgotPasswordForm> = {
|
|
5
|
+
title: 'FORMS/ForgotPasswordForm',
|
|
6
|
+
component: ForgotPasswordForm,
|
|
7
|
+
};
|
|
8
|
+
|
|
9
|
+
type Story = StoryObj<typeof ForgotPasswordForm>;
|
|
10
|
+
|
|
11
|
+
export const Default: Story = {
|
|
12
|
+
args: {
|
|
13
|
+
handleSubmit: (values: any) => {
|
|
14
|
+
console.log(values);
|
|
15
|
+
},
|
|
16
|
+
},
|
|
17
|
+
};
|
|
18
|
+
|
|
19
|
+
export default meta;
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { Props } from './ForgotPasswordForm.types';
|
|
3
|
+
import Form from '../../components/Form';
|
|
4
|
+
import FormField from '../../components/FormField';
|
|
5
|
+
import { FIELD_TYPES } from '../../components/FormField/FormField.types';
|
|
6
|
+
import { validEmail } from '../validations';
|
|
7
|
+
import STRINGS from '../../translations';
|
|
8
|
+
|
|
9
|
+
const ForgotPasswordForm = ({ handleSubmit }: Props) => {
|
|
10
|
+
return (
|
|
11
|
+
<div data-testid="ForgotPasswordForm" className="form-wrapper">
|
|
12
|
+
<Form onSubmit={handleSubmit} submit={STRINGS.FORMS.FORGOT_PASSWORD_FORM.SUBMIT}>
|
|
13
|
+
<FormField
|
|
14
|
+
name="email"
|
|
15
|
+
type={FIELD_TYPES.EMAIL}
|
|
16
|
+
label={STRINGS.FORMS.FORGOT_PASSWORD_FORM.EMAIL}
|
|
17
|
+
required
|
|
18
|
+
validations={validEmail}
|
|
19
|
+
/>
|
|
20
|
+
</Form>
|
|
21
|
+
</div>
|
|
22
|
+
);
|
|
23
|
+
};
|
|
24
|
+
|
|
25
|
+
ForgotPasswordForm.displayName = 'ForgotPasswordForm';
|
|
26
|
+
|
|
27
|
+
export default ForgotPasswordForm;
|
|
28
|
+
export type { Props };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default } from './ForgotPasswordForm';
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
import { useState } from 'react';
|
|
2
|
+
import type { Meta, StoryObj } from '@storybook/nextjs';
|
|
3
|
+
import { toast } from 'react-toastify';
|
|
4
|
+
import LoginForm from '.';
|
|
5
|
+
|
|
6
|
+
const meta: Meta<typeof LoginForm> = {
|
|
7
|
+
title: 'FORMS/LoginForm',
|
|
8
|
+
component: LoginForm,
|
|
9
|
+
};
|
|
10
|
+
|
|
11
|
+
type Story = StoryObj<typeof LoginForm>;
|
|
12
|
+
|
|
13
|
+
export const Default: Story = {
|
|
14
|
+
args: {},
|
|
15
|
+
render: () => {
|
|
16
|
+
const [accessToken, setAccessToken] = useState<string | null>(null);
|
|
17
|
+
|
|
18
|
+
const handleTokenCallback = (tokens: any) => {
|
|
19
|
+
console.log('handleTokenCallback', tokens);
|
|
20
|
+
setAccessToken(tokens.accessToken);
|
|
21
|
+
};
|
|
22
|
+
|
|
23
|
+
const handleSubmit = async (values: any) => {
|
|
24
|
+
try {
|
|
25
|
+
console.log('Login values', values);
|
|
26
|
+
const response = await fetch('http://localhost:9003/1.0/user/login', {
|
|
27
|
+
method: 'POST',
|
|
28
|
+
headers: {
|
|
29
|
+
'Content-Type': 'application/json',
|
|
30
|
+
},
|
|
31
|
+
body: JSON.stringify(values),
|
|
32
|
+
});
|
|
33
|
+
const json = await response.json();
|
|
34
|
+
if (response.ok) {
|
|
35
|
+
console.log('Login json', json);
|
|
36
|
+
toast.info(json?.message);
|
|
37
|
+
}
|
|
38
|
+
throw new Error(json?.message);
|
|
39
|
+
} catch (err: any) {
|
|
40
|
+
console.log(err);
|
|
41
|
+
toast.error(err.message);
|
|
42
|
+
}
|
|
43
|
+
};
|
|
44
|
+
|
|
45
|
+
// const now = new Date().getTime();
|
|
46
|
+
// const initialValues = {
|
|
47
|
+
// email: `joe+${now}@4alldigital.com`,
|
|
48
|
+
// password: 'Password123!',
|
|
49
|
+
// };
|
|
50
|
+
|
|
51
|
+
return (
|
|
52
|
+
<>
|
|
53
|
+
{!accessToken && (
|
|
54
|
+
<LoginForm
|
|
55
|
+
handleSubmit={handleSubmit}
|
|
56
|
+
// initialValues={initialValues}
|
|
57
|
+
handleTokenCallback={handleTokenCallback}
|
|
58
|
+
showSocialButtons={true}
|
|
59
|
+
/>
|
|
60
|
+
)}
|
|
61
|
+
{accessToken && <div>Access token: {accessToken}</div>}
|
|
62
|
+
</>
|
|
63
|
+
);
|
|
64
|
+
},
|
|
65
|
+
};
|
|
66
|
+
|
|
67
|
+
export default meta;
|