@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,81 @@
|
|
|
1
|
+
import { ChangeEvent } from "react";
|
|
2
|
+
|
|
3
|
+
export enum InputType {
|
|
4
|
+
TEXT = 'text',
|
|
5
|
+
PASSWORD = 'password',
|
|
6
|
+
EMAIL = 'email',
|
|
7
|
+
NUMBER = 'number',
|
|
8
|
+
TEL = 'tel',
|
|
9
|
+
URL = 'url',
|
|
10
|
+
SEARCH = 'search',
|
|
11
|
+
DATE = 'date',
|
|
12
|
+
TIME = 'time',
|
|
13
|
+
DATETIME = 'datetime-local',
|
|
14
|
+
MONTH = 'month',
|
|
15
|
+
WEEK = 'week',
|
|
16
|
+
FILE = 'file',
|
|
17
|
+
TEXTAREA = 'textarea',
|
|
18
|
+
HIDDEN = 'hidden',
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
export interface Props {
|
|
22
|
+
/** Input type. */
|
|
23
|
+
type?: InputType;
|
|
24
|
+
/** Specify if input is required. */
|
|
25
|
+
required?: boolean;
|
|
26
|
+
/** Custom style attributes. */
|
|
27
|
+
className?: string;
|
|
28
|
+
/** OnChange function handler. */
|
|
29
|
+
onChange?: (e: ChangeEvent<HTMLInputElement | HTMLTextAreaElement>) => void;
|
|
30
|
+
/** Placeholder text. */
|
|
31
|
+
placeholder?: string;
|
|
32
|
+
/** Input name attribute. */
|
|
33
|
+
name?: string;
|
|
34
|
+
/** Input icon value. */
|
|
35
|
+
icon?: string;
|
|
36
|
+
/** Input status. */
|
|
37
|
+
disabled?: boolean;
|
|
38
|
+
autoComplete?:
|
|
39
|
+
| 'off'
|
|
40
|
+
| 'honorific-prefix'
|
|
41
|
+
| 'given-name'
|
|
42
|
+
| 'additional-name'
|
|
43
|
+
| 'family-name'
|
|
44
|
+
| 'honorific-suffix'
|
|
45
|
+
| 'nickname'
|
|
46
|
+
| 'email'
|
|
47
|
+
| 'username'
|
|
48
|
+
| 'new-password'
|
|
49
|
+
| 'current-password'
|
|
50
|
+
| 'one-time-code'
|
|
51
|
+
| 'organization-title'
|
|
52
|
+
| 'organization'
|
|
53
|
+
| 'street-address'
|
|
54
|
+
| 'address-line1'
|
|
55
|
+
| 'address-line2'
|
|
56
|
+
| 'address-line3'
|
|
57
|
+
| 'address-level4'
|
|
58
|
+
| 'address-level3'
|
|
59
|
+
| 'address-level2'
|
|
60
|
+
| 'address-level1'
|
|
61
|
+
| 'country'
|
|
62
|
+
| 'country-name'
|
|
63
|
+
| 'postal-code'
|
|
64
|
+
| 'cc-name'
|
|
65
|
+
| 'cc-given-name'
|
|
66
|
+
| 'cc-additional-name'
|
|
67
|
+
| 'cc-family-name'
|
|
68
|
+
| 'cc-number'
|
|
69
|
+
| 'cc-exp'
|
|
70
|
+
| 'cc-exp-month'
|
|
71
|
+
| 'cc-exp-year'
|
|
72
|
+
| 'cc-csc'
|
|
73
|
+
| 'cc-type'
|
|
74
|
+
| 'transaction-currency'
|
|
75
|
+
| 'transaction-amount'
|
|
76
|
+
| 'language'
|
|
77
|
+
| 'bday'
|
|
78
|
+
| 'bday-day'
|
|
79
|
+
| 'bday-month'
|
|
80
|
+
| 'bday-year';
|
|
81
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default } from './TextInput';
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
import type { Meta, StoryObj } from '@storybook/nextjs';
|
|
2
|
+
import Video from '.';
|
|
3
|
+
|
|
4
|
+
const meta: Meta<typeof Video> = {
|
|
5
|
+
title: 'UI/Video',
|
|
6
|
+
component: Video,
|
|
7
|
+
};
|
|
8
|
+
|
|
9
|
+
type Story = StoryObj<typeof Video>;
|
|
10
|
+
|
|
11
|
+
export const Default: Story = {
|
|
12
|
+
args: {
|
|
13
|
+
url: 'https://youtube.com/live/-mkSeTVKvIQ',
|
|
14
|
+
//url: 'https://youtube.com/live/E7IlXwmN5Hw', //private
|
|
15
|
+
isYoutube: true,
|
|
16
|
+
},
|
|
17
|
+
};
|
|
18
|
+
|
|
19
|
+
export const M3U8: Story = {
|
|
20
|
+
args: {
|
|
21
|
+
// url: 'https://d227lq76md6ahr.cloudfront.net/6f931020-437f-4484-a966-82e40c6a4e8c/hls/livestream--upper-body-blast--05-05-2024.m3u8',
|
|
22
|
+
sources: [
|
|
23
|
+
{
|
|
24
|
+
src: 'https://dgyf3rr1f57sz.cloudfront.net/c2d0b92e-f35d-4e6f-b232-69389744bfd3/hls/livestream--garuda-brick--06-09-2023.m3u8',
|
|
25
|
+
type: 'application/x-mpegURL',
|
|
26
|
+
},
|
|
27
|
+
],
|
|
28
|
+
options: {
|
|
29
|
+
poster: 'https://assets.nrgbarrebody.app/2021-05/202103%20NBP%20-%20NRG%20BarreBody-67-min.jpg',
|
|
30
|
+
autoplay: false,
|
|
31
|
+
muted: false,
|
|
32
|
+
onPause: () => console.log('paused'),
|
|
33
|
+
onPlay: () => console.log('play'),
|
|
34
|
+
onEnded: () => console.log('ended'),
|
|
35
|
+
},
|
|
36
|
+
},
|
|
37
|
+
};
|
|
38
|
+
|
|
39
|
+
export const MP4: Story = {
|
|
40
|
+
args: {
|
|
41
|
+
// url: 'https://d227lq76md6ahr.cloudfront.net/6f931020-437f-4484-a966-82e40c6a4e8c/hls/livestream--upper-body-blast--05-05-2024.m3u8',
|
|
42
|
+
sources: [
|
|
43
|
+
{
|
|
44
|
+
src: 'https://d227lq76md6ahr.cloudfront.net/348c47cd-b682-4c48-bdbd-e3a4ea3986d8/mp4/livestream--signature-express--12-08-2024_Mp4_Avc_Aac_16x9_1920x1080p_24Hz_6Mbps_qvbr.mp4',
|
|
45
|
+
type: 'video/mp4',
|
|
46
|
+
},
|
|
47
|
+
],
|
|
48
|
+
options: {
|
|
49
|
+
poster: 'https://assets.nrgbarrebody.app/2021-05/202103%20NBP%20-%20NRG%20BarreBody-67-min.jpg',
|
|
50
|
+
autoplay: false,
|
|
51
|
+
muted: false,
|
|
52
|
+
},
|
|
53
|
+
},
|
|
54
|
+
};
|
|
55
|
+
|
|
56
|
+
export const BackgroundVideo: Story = {
|
|
57
|
+
args: {
|
|
58
|
+
sources: [
|
|
59
|
+
{
|
|
60
|
+
src: 'https://d227lq76md6ahr.cloudfront.net/6f931020-437f-4484-a966-82e40c6a4e8c/hls/livestream--upper-body-blast--05-05-2024.m3u8',
|
|
61
|
+
type: 'application/x-mpegURL',
|
|
62
|
+
},
|
|
63
|
+
],
|
|
64
|
+
options: {
|
|
65
|
+
poster: 'https://assets.nrgbarrebody.app/2021-05/202103%20NBP%20-%20NRG%20BarreBody-67-min.jpg',
|
|
66
|
+
autoplay: true,
|
|
67
|
+
muted: true,
|
|
68
|
+
controls: false,
|
|
69
|
+
playsinline: true,
|
|
70
|
+
preferFullWindow: false,
|
|
71
|
+
},
|
|
72
|
+
},
|
|
73
|
+
};
|
|
74
|
+
|
|
75
|
+
export default meta;
|
|
@@ -0,0 +1,280 @@
|
|
|
1
|
+
import { forwardRef, useEffect, useImperativeHandle, useMemo, useRef } from 'react';
|
|
2
|
+
import cx from 'classnames';
|
|
3
|
+
import ReactPlayer from 'react-player/youtube';
|
|
4
|
+
import { isMobileOnly } from 'react-device-detect';
|
|
5
|
+
import { Props } from './Video.types';
|
|
6
|
+
import { twMerge } from 'tailwind-merge';
|
|
7
|
+
import videojs from 'video.js';
|
|
8
|
+
export interface VideoPlayerMethods {
|
|
9
|
+
play: () => void;
|
|
10
|
+
pause: () => void;
|
|
11
|
+
fullscreen: () => void;
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
const Video = forwardRef(function MyVideo(
|
|
15
|
+
{
|
|
16
|
+
url,
|
|
17
|
+
sources,
|
|
18
|
+
onReady,
|
|
19
|
+
onExitFullScreenCallback,
|
|
20
|
+
className,
|
|
21
|
+
options = {
|
|
22
|
+
playsinline: true,
|
|
23
|
+
preferFullWindow: true,
|
|
24
|
+
},
|
|
25
|
+
isYoutube = false,
|
|
26
|
+
defaultAudioTrack = 'No Music',
|
|
27
|
+
rounded = true,
|
|
28
|
+
aspectRatioValue,
|
|
29
|
+
// fullScreenOnly = false,
|
|
30
|
+
isModal = false,
|
|
31
|
+
}: Props,
|
|
32
|
+
ref: any,
|
|
33
|
+
) {
|
|
34
|
+
const reactPlayerRef = useRef<ReactPlayer>(null);
|
|
35
|
+
const videoRef = useRef<any>(null);
|
|
36
|
+
const playerRef = useRef<any>(null);
|
|
37
|
+
|
|
38
|
+
const aspectRatioConfig = useMemo(() => {
|
|
39
|
+
switch (aspectRatioValue) {
|
|
40
|
+
case '4/3':
|
|
41
|
+
return {
|
|
42
|
+
aspectRatio: '4:3',
|
|
43
|
+
className: 'aspect-[4/3]',
|
|
44
|
+
};
|
|
45
|
+
case '1/1':
|
|
46
|
+
return {
|
|
47
|
+
aspectRatio: '1:1',
|
|
48
|
+
className: 'aspect-[1/1]',
|
|
49
|
+
};
|
|
50
|
+
case '3/4':
|
|
51
|
+
return {
|
|
52
|
+
aspectRatio: '3:4',
|
|
53
|
+
className: 'aspect-[3/4]',
|
|
54
|
+
};
|
|
55
|
+
case '9/16':
|
|
56
|
+
return {
|
|
57
|
+
aspectRatio: '9:16',
|
|
58
|
+
className: 'aspect-[9/16]',
|
|
59
|
+
};
|
|
60
|
+
case '16/7':
|
|
61
|
+
return {
|
|
62
|
+
aspectRatio: '16:7',
|
|
63
|
+
className: 'aspect-[16/7]',
|
|
64
|
+
};
|
|
65
|
+
case '16/5':
|
|
66
|
+
return {
|
|
67
|
+
aspectRatio: '16:5',
|
|
68
|
+
className: 'aspect-[16/5]',
|
|
69
|
+
};
|
|
70
|
+
default:
|
|
71
|
+
return {
|
|
72
|
+
aspectRatio: '16:9',
|
|
73
|
+
className: 'aspect-[16/9]',
|
|
74
|
+
};
|
|
75
|
+
}
|
|
76
|
+
}, [aspectRatioValue]);
|
|
77
|
+
|
|
78
|
+
useEffect(() => {
|
|
79
|
+
// Do not initialize Video.js player if it's a YouTube video
|
|
80
|
+
if (isYoutube) return;
|
|
81
|
+
const videoOptions = {
|
|
82
|
+
autoplay: true,
|
|
83
|
+
controls: true,
|
|
84
|
+
muted: false,
|
|
85
|
+
playsInline: true,
|
|
86
|
+
preferFullWindow: true,
|
|
87
|
+
responsive: true,
|
|
88
|
+
fill: true,
|
|
89
|
+
fluid: !isModal,
|
|
90
|
+
// aspectRatio: aspectRatioConfig.aspectRatio || '16:9',
|
|
91
|
+
controlBar: {
|
|
92
|
+
skipButtons: !isMobileOnly
|
|
93
|
+
? {
|
|
94
|
+
forward: 30,
|
|
95
|
+
backward: 30,
|
|
96
|
+
}
|
|
97
|
+
: {},
|
|
98
|
+
volumePanel: {
|
|
99
|
+
inline: true,
|
|
100
|
+
},
|
|
101
|
+
},
|
|
102
|
+
html5: {
|
|
103
|
+
hls: {
|
|
104
|
+
enableLowInitialPlaylist: true, // Optional configuration for better HLS performance
|
|
105
|
+
},
|
|
106
|
+
},
|
|
107
|
+
...options, // Override default options
|
|
108
|
+
sources: sources,
|
|
109
|
+
};
|
|
110
|
+
|
|
111
|
+
// Make sure Video.js player is only initialized once
|
|
112
|
+
if (!playerRef.current) {
|
|
113
|
+
// The Video.js player needs to be _inside_ the component el for React 18 Strict Mode.
|
|
114
|
+
const videoElement = document.createElement('video-js');
|
|
115
|
+
|
|
116
|
+
// videoElement.classList.add('vjs-big-play-centered');
|
|
117
|
+
videoRef?.current?.appendChild(videoElement);
|
|
118
|
+
|
|
119
|
+
const player = (playerRef.current = videojs(videoElement, videoOptions, () => {
|
|
120
|
+
videojs.log('player is ready', player);
|
|
121
|
+
// player.playsinline(options.playsInline);
|
|
122
|
+
if (onReady) {
|
|
123
|
+
onReady(player);
|
|
124
|
+
}
|
|
125
|
+
}));
|
|
126
|
+
|
|
127
|
+
// if (fullScreenOnly) {
|
|
128
|
+
// player.requestFullscreen();
|
|
129
|
+
// player.play();
|
|
130
|
+
// }
|
|
131
|
+
|
|
132
|
+
// handle on play event.
|
|
133
|
+
if (videoOptions.onPlay && typeof videoOptions.onPlay === 'function') {
|
|
134
|
+
player.on('play', videoOptions.onPlay);
|
|
135
|
+
}
|
|
136
|
+
|
|
137
|
+
// handle on pause event.
|
|
138
|
+
if (videoOptions.onPause && typeof videoOptions.onPause === 'function') {
|
|
139
|
+
player.on('pause', videoOptions.onPause);
|
|
140
|
+
}
|
|
141
|
+
|
|
142
|
+
// handle on ended event.
|
|
143
|
+
if (videoOptions.onEnded && typeof videoOptions.onEnded === 'function') {
|
|
144
|
+
player.on('ended', videoOptions.onEnded);
|
|
145
|
+
}
|
|
146
|
+
|
|
147
|
+
// // Modals are temporary by default. They dispose themselves when they are
|
|
148
|
+
// // closed; so, we can create a new one each time the player is paused and
|
|
149
|
+
// // not worry about leaving extra nodes hanging around.
|
|
150
|
+
// var modal = player.createModal('This is a modal!');
|
|
151
|
+
|
|
152
|
+
// // When the modal closes, resume playback.
|
|
153
|
+
// modal.on('modalclose', function() {
|
|
154
|
+
// player.play();
|
|
155
|
+
// });
|
|
156
|
+
// });
|
|
157
|
+
|
|
158
|
+
// Wait for metadata to be loaded.
|
|
159
|
+
player.on('loadedmetadata', function () {
|
|
160
|
+
const audioTracksList = (player as any).audioTracks();
|
|
161
|
+
if (audioTracksList && audioTracksList.length) {
|
|
162
|
+
for (let i = 0; i < audioTracksList.length; i++) {
|
|
163
|
+
if (audioTracksList[i]?.label === defaultAudioTrack) {
|
|
164
|
+
audioTracksList[i].enabled = true;
|
|
165
|
+
}
|
|
166
|
+
}
|
|
167
|
+
}
|
|
168
|
+
});
|
|
169
|
+
|
|
170
|
+
player.on('fullscreenchange', function () {
|
|
171
|
+
// If player is in fullscreen mode, log state to console
|
|
172
|
+
if (player.isFullscreen()) {
|
|
173
|
+
console.log('Player is in fullscreen');
|
|
174
|
+
} else {
|
|
175
|
+
console.log('Player is not in fullscreen');
|
|
176
|
+
if (onExitFullScreenCallback && typeof onExitFullScreenCallback === 'function') {
|
|
177
|
+
onExitFullScreenCallback();
|
|
178
|
+
}
|
|
179
|
+
}
|
|
180
|
+
});
|
|
181
|
+
|
|
182
|
+
// You could update an existing player in the `else` block here
|
|
183
|
+
// on prop change, for example:
|
|
184
|
+
} else {
|
|
185
|
+
const player = playerRef.current;
|
|
186
|
+
|
|
187
|
+
player.autoplay(options.autoplay);
|
|
188
|
+
player.src(options.sources);
|
|
189
|
+
}
|
|
190
|
+
}, [options, videoRef]);
|
|
191
|
+
|
|
192
|
+
// Expose specific methods to parent
|
|
193
|
+
useImperativeHandle(ref, () => ({
|
|
194
|
+
play: () => {
|
|
195
|
+
if (playerRef.current) {
|
|
196
|
+
playerRef.current.play();
|
|
197
|
+
}
|
|
198
|
+
},
|
|
199
|
+
pause: () => {
|
|
200
|
+
if (playerRef.current) {
|
|
201
|
+
playerRef.current.pause();
|
|
202
|
+
}
|
|
203
|
+
},
|
|
204
|
+
fullscreen: () => {
|
|
205
|
+
if (playerRef.current) {
|
|
206
|
+
playerRef.current.requestFullscreen();
|
|
207
|
+
}
|
|
208
|
+
},
|
|
209
|
+
}));
|
|
210
|
+
|
|
211
|
+
// Dispose the Video.js player when the functional component unmounts
|
|
212
|
+
useEffect(() => {
|
|
213
|
+
// DO NOT dispose the player if it's a YouTube video
|
|
214
|
+
if (isYoutube) return;
|
|
215
|
+
const player = playerRef.current;
|
|
216
|
+
|
|
217
|
+
return () => {
|
|
218
|
+
if (player && !player.isDisposed()) {
|
|
219
|
+
player.dispose();
|
|
220
|
+
playerRef.current = null;
|
|
221
|
+
}
|
|
222
|
+
};
|
|
223
|
+
}, [playerRef]);
|
|
224
|
+
|
|
225
|
+
if (isYoutube && url) {
|
|
226
|
+
return (
|
|
227
|
+
<div data-testid="Video" className={cx('relative w-full h-full aspect-[16/9]', className)}>
|
|
228
|
+
<ReactPlayer
|
|
229
|
+
ref={reactPlayerRef}
|
|
230
|
+
className="react-player"
|
|
231
|
+
url={url}
|
|
232
|
+
width="100%"
|
|
233
|
+
height="100%"
|
|
234
|
+
controls
|
|
235
|
+
onReady={onReady}
|
|
236
|
+
config={{
|
|
237
|
+
// @ts-expect-error - TS doesn't know about the playerVars prop.
|
|
238
|
+
youtube: {
|
|
239
|
+
playerVars: {
|
|
240
|
+
// controls: 0, // Hide all controls
|
|
241
|
+
modestbranding: 1, // Remove YouTube logo from control bar
|
|
242
|
+
disablekb: 1, // Disable keyboard controls
|
|
243
|
+
},
|
|
244
|
+
},
|
|
245
|
+
}}
|
|
246
|
+
/>
|
|
247
|
+
</div>
|
|
248
|
+
);
|
|
249
|
+
}
|
|
250
|
+
|
|
251
|
+
if (isModal) {
|
|
252
|
+
return <div ref={videoRef} className="relative w-full h-full" />;
|
|
253
|
+
}
|
|
254
|
+
|
|
255
|
+
return (
|
|
256
|
+
<div
|
|
257
|
+
className={twMerge(
|
|
258
|
+
cx(
|
|
259
|
+
'relative w-full overflow-hidden h-full object-cover',
|
|
260
|
+
{
|
|
261
|
+
rouded: rounded,
|
|
262
|
+
},
|
|
263
|
+
aspectRatioConfig.className,
|
|
264
|
+
className,
|
|
265
|
+
),
|
|
266
|
+
)}>
|
|
267
|
+
<div data-vjs-player>
|
|
268
|
+
<div
|
|
269
|
+
ref={videoRef}
|
|
270
|
+
className={cx('object-cover bg-black flex items-center justify-center', aspectRatioConfig.className)}
|
|
271
|
+
/>
|
|
272
|
+
</div>
|
|
273
|
+
</div>
|
|
274
|
+
);
|
|
275
|
+
});
|
|
276
|
+
|
|
277
|
+
Video.displayName = 'Video';
|
|
278
|
+
|
|
279
|
+
export default Video;
|
|
280
|
+
export type { Props };
|
|
@@ -0,0 +1,147 @@
|
|
|
1
|
+
interface VideoJsPlayerOptions {
|
|
2
|
+
autoplay?: boolean;
|
|
3
|
+
controls?: boolean;
|
|
4
|
+
height?: number;
|
|
5
|
+
loop?: boolean;
|
|
6
|
+
muted?: boolean;
|
|
7
|
+
poster?: string;
|
|
8
|
+
preload?: 'auto' | 'metadata' | 'none';
|
|
9
|
+
sources?: { src: string; type?: string }[];
|
|
10
|
+
width?: number;
|
|
11
|
+
aspectRatio?: string;
|
|
12
|
+
controlBar?: {
|
|
13
|
+
remainingTimeDisplay?: {
|
|
14
|
+
displayNegative: boolean;
|
|
15
|
+
};
|
|
16
|
+
skipButtons?: {
|
|
17
|
+
forward: number;
|
|
18
|
+
backward: number;
|
|
19
|
+
};
|
|
20
|
+
volumePanel?: {
|
|
21
|
+
inline: boolean;
|
|
22
|
+
};
|
|
23
|
+
};
|
|
24
|
+
html5?: {
|
|
25
|
+
hls?: {
|
|
26
|
+
enableLowInitialPlaylist: boolean;
|
|
27
|
+
};
|
|
28
|
+
};
|
|
29
|
+
playbackRates?: number[];
|
|
30
|
+
plugins?: any[];
|
|
31
|
+
responsive?: boolean;
|
|
32
|
+
fill?: boolean;
|
|
33
|
+
fluid?: boolean;
|
|
34
|
+
preferFullWindow?: boolean;
|
|
35
|
+
audioOnlyMode?: boolean;
|
|
36
|
+
audioPosterMode?: boolean;
|
|
37
|
+
enableSmoothSeeking?: boolean;
|
|
38
|
+
experimentalSvgIcons?: boolean;
|
|
39
|
+
fullscreen?: {
|
|
40
|
+
options: {
|
|
41
|
+
navigationUI: 'hide' | 'show';
|
|
42
|
+
};
|
|
43
|
+
};
|
|
44
|
+
liveui?: boolean;
|
|
45
|
+
liveTracker?: {
|
|
46
|
+
trackingThreshold: number;
|
|
47
|
+
liveTolerance: number;
|
|
48
|
+
};
|
|
49
|
+
nativeControlsForTouch?: boolean;
|
|
50
|
+
normalizeAutoplay?: boolean;
|
|
51
|
+
notSupportedMessage?: string;
|
|
52
|
+
noUITitleAttributes?: boolean;
|
|
53
|
+
playsinline?: boolean;
|
|
54
|
+
techCanOverridePoster?: boolean;
|
|
55
|
+
techOrder?: string[];
|
|
56
|
+
userActions?: {
|
|
57
|
+
click?: boolean;
|
|
58
|
+
doubleClick?: boolean;
|
|
59
|
+
hotkeys?: {
|
|
60
|
+
fullscreenKey: string;
|
|
61
|
+
muteKey: string;
|
|
62
|
+
playPauseKey: string;
|
|
63
|
+
};
|
|
64
|
+
};
|
|
65
|
+
language?: string;
|
|
66
|
+
languages?: {
|
|
67
|
+
[key: string]: {
|
|
68
|
+
Play: string;
|
|
69
|
+
Pause: string;
|
|
70
|
+
Mute: string;
|
|
71
|
+
Unmute: string;
|
|
72
|
+
Fullscreen: string;
|
|
73
|
+
PictureInPicture: string;
|
|
74
|
+
RemainingTime: string;
|
|
75
|
+
TimeDivider: string;
|
|
76
|
+
Time: string;
|
|
77
|
+
Live: string;
|
|
78
|
+
Volume: string;
|
|
79
|
+
Aired: string;
|
|
80
|
+
PlaybackRate: string;
|
|
81
|
+
Subtitles: string;
|
|
82
|
+
AudioTracks: string;
|
|
83
|
+
Settings: string;
|
|
84
|
+
Quality: string;
|
|
85
|
+
Speed: string;
|
|
86
|
+
Normal: string;
|
|
87
|
+
QualityBadge: string;
|
|
88
|
+
Rewind: string;
|
|
89
|
+
Forward: string;
|
|
90
|
+
FullscreenOff: string;
|
|
91
|
+
PictureInPictureOn: string;
|
|
92
|
+
PictureInPictureOff: string;
|
|
93
|
+
VolumePanel: string;
|
|
94
|
+
AudioTrack: string;
|
|
95
|
+
YouAreWatchingLive: string;
|
|
96
|
+
YouAreWatchingLiveEvent: string;
|
|
97
|
+
YouAreWatchingLiveStream: string;
|
|
98
|
+
LiveEvent: string;
|
|
99
|
+
LiveStream: string;
|
|
100
|
+
};
|
|
101
|
+
};
|
|
102
|
+
inactivityTimeout?: number;
|
|
103
|
+
breakpoints?: {
|
|
104
|
+
[key: string]: {
|
|
105
|
+
width: number;
|
|
106
|
+
height: number;
|
|
107
|
+
};
|
|
108
|
+
};
|
|
109
|
+
controlBarBreakpoints?: {
|
|
110
|
+
[key: string]: {
|
|
111
|
+
width: number;
|
|
112
|
+
height: number;
|
|
113
|
+
};
|
|
114
|
+
};
|
|
115
|
+
playbackRate?: number;
|
|
116
|
+
// Event Handlers
|
|
117
|
+
onReady?: (player: any) => void; // Player ready event handler
|
|
118
|
+
onPlay?: (event: Event) => void; // Play event handler
|
|
119
|
+
onPause?: (event: Event) => void; // Pause event handler
|
|
120
|
+
onEnded?: (event: Event) => void; // Ended event handler
|
|
121
|
+
onError?: (event: Event) => void; // Error event handler
|
|
122
|
+
onTimeUpdate?: (event: Event) => void; // Time update event handler
|
|
123
|
+
onVolumeChange?: (event: Event) => void; // Volume change event handler
|
|
124
|
+
onFullscreenChange?: (event: Event) => void; // Fullscreen change event handler
|
|
125
|
+
|
|
126
|
+
// Custom Components
|
|
127
|
+
// [key: string]: any; // Allow additional properties for custom components
|
|
128
|
+
}
|
|
129
|
+
|
|
130
|
+
export interface Props {
|
|
131
|
+
url?: string;
|
|
132
|
+
autoPlay?: boolean;
|
|
133
|
+
muted?: boolean;
|
|
134
|
+
preload?: 'auto' | 'metadata' | 'none';
|
|
135
|
+
title?: string;
|
|
136
|
+
sources?: { src: string; type?: string }[];
|
|
137
|
+
className?: string;
|
|
138
|
+
options?: VideoJsPlayerOptions;
|
|
139
|
+
isYoutube?: boolean;
|
|
140
|
+
onReady?: (player: any) => void;
|
|
141
|
+
onExitFullScreenCallback?: () => void;
|
|
142
|
+
defaultAudioTrack?: string;
|
|
143
|
+
rounded?: boolean;
|
|
144
|
+
aspectRatioValue?: '16/9' | '4/3' | '1/1' | '3/4' | '9/16' | '16/7' | '16/5';
|
|
145
|
+
fullScreenOnly?: boolean;
|
|
146
|
+
isModal?: boolean;
|
|
147
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default } from './Video';
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import type { Meta, StoryObj } from '@storybook/nextjs';
|
|
2
|
+
import VisitUs from '.';
|
|
3
|
+
|
|
4
|
+
const meta: Meta<typeof VisitUs> = {
|
|
5
|
+
title: 'MOLECULES/VisitUs',
|
|
6
|
+
component: VisitUs,
|
|
7
|
+
};
|
|
8
|
+
|
|
9
|
+
type Story = StoryObj<typeof VisitUs>;
|
|
10
|
+
|
|
11
|
+
export const Default: Story = {
|
|
12
|
+
args: {
|
|
13
|
+
facebook: {
|
|
14
|
+
title: 'Facebook',
|
|
15
|
+
url: 'https://www.facebook.com',
|
|
16
|
+
},
|
|
17
|
+
twitter: {
|
|
18
|
+
title: 'Twitter',
|
|
19
|
+
url: 'https://www.twitter.com',
|
|
20
|
+
},
|
|
21
|
+
instagram: {
|
|
22
|
+
title: 'Instagram',
|
|
23
|
+
url: 'https://www.instagram.com',
|
|
24
|
+
},
|
|
25
|
+
linkedin: {
|
|
26
|
+
title: 'LinkedIn',
|
|
27
|
+
url: 'https://www.linkedin.com',
|
|
28
|
+
},
|
|
29
|
+
},
|
|
30
|
+
};
|
|
31
|
+
|
|
32
|
+
export default meta;
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { Props } from './VisitUs.types';
|
|
3
|
+
import Button from '../Button';
|
|
4
|
+
import { BTN_SIZES, BTN_VARIANTS } from '../Button/Button.types';
|
|
5
|
+
|
|
6
|
+
const VisitUs = ({ testID, facebook, twitter, instagram, linkedin, youtube }: Props) => {
|
|
7
|
+
return (
|
|
8
|
+
<div data-testid={testID || '"VisitUs"'} className="flex gap-2">
|
|
9
|
+
{facebook && (
|
|
10
|
+
<Button
|
|
11
|
+
variant={BTN_VARIANTS.PRIMARY}
|
|
12
|
+
size={BTN_SIZES.MEDIUM}
|
|
13
|
+
icon="mdi:facebook"
|
|
14
|
+
onClick={() => window.open(facebook.url)}
|
|
15
|
+
/>
|
|
16
|
+
)}
|
|
17
|
+
{twitter && (
|
|
18
|
+
<Button
|
|
19
|
+
variant={BTN_VARIANTS.PRIMARY}
|
|
20
|
+
size={BTN_SIZES.MEDIUM}
|
|
21
|
+
icon="mdi:twitter"
|
|
22
|
+
onClick={() => window.open(twitter.url)}
|
|
23
|
+
/>
|
|
24
|
+
)}
|
|
25
|
+
{instagram && (
|
|
26
|
+
<Button
|
|
27
|
+
variant={BTN_VARIANTS.PRIMARY}
|
|
28
|
+
size={BTN_SIZES.MEDIUM}
|
|
29
|
+
icon="mdi:instagram"
|
|
30
|
+
onClick={() => window.open(instagram.url)}
|
|
31
|
+
/>
|
|
32
|
+
)}
|
|
33
|
+
{linkedin && (
|
|
34
|
+
<Button
|
|
35
|
+
variant={BTN_VARIANTS.PRIMARY}
|
|
36
|
+
size={BTN_SIZES.MEDIUM}
|
|
37
|
+
icon="mdi:linkedin"
|
|
38
|
+
onClick={() => window.open(linkedin.url)}
|
|
39
|
+
/>
|
|
40
|
+
)}
|
|
41
|
+
{youtube && (
|
|
42
|
+
<Button
|
|
43
|
+
variant={BTN_VARIANTS.PRIMARY}
|
|
44
|
+
size={BTN_SIZES.MEDIUM}
|
|
45
|
+
icon="mdi:youtube"
|
|
46
|
+
onClick={() => window.open(youtube.url)}
|
|
47
|
+
/>
|
|
48
|
+
)}
|
|
49
|
+
</div>
|
|
50
|
+
);
|
|
51
|
+
};
|
|
52
|
+
|
|
53
|
+
VisitUs.displayName = 'VisitUs';
|
|
54
|
+
|
|
55
|
+
export default VisitUs;
|
|
56
|
+
export type { Props };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default } from './VisitUs';
|