reso-ui 1.1.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/.github/workflows/cd.yml +49 -0
- package/.github/workflows/ci.yml +55 -0
- package/.github/workflows/release.yml +41 -0
- package/.husky/commit-msg +4 -0
- package/.storybook/main.js +51 -0
- package/.storybook/preview.js +9 -0
- package/CHANGELOG.md +20 -0
- package/README.md +209 -0
- package/__mocks__/fileMock.js +2 -0
- package/__mocks__/styleMock.js +2 -0
- package/commitlint.config.js +6 -0
- package/custom.d.ts +8 -0
- package/dist/09f84f6035cfbf7c3984b6177d36b516.ttf +0 -0
- package/dist/0d5fdfd739931f51a5df.ttf +1 -0
- package/dist/0e407c5680c91e584bb084ebfb5c086b.ttf +0 -0
- package/dist/2e942562af5b9b655c1f.ttf +1 -0
- package/dist/2f6d81277badc25ac944.ttf +1 -0
- package/dist/32743a4d0c4282e2070b574e6e5038ab.ttf +0 -0
- package/dist/3727d88dec67e1e78cf987dab60d9887.ttf +0 -0
- package/dist/3fcedd69c66d642ae94c.ttf +1 -0
- package/dist/404e299be26d78e6679447ea7cb2d41f.ttf +0 -0
- package/dist/47afb8d0034314dd9508.ttf +1 -0
- package/dist/4a24733ca942ad738fa2.ttf +1 -0
- package/dist/4e860c8656d815bb2429.ttf +1 -0
- package/dist/4e8cea18952c83074ec35f7bf1b176c4.ttf +0 -0
- package/dist/4ed78cd5d64af4efc3c714622b9372d4.ttf +0 -0
- package/dist/5568b72206d0e08121c5.ttf +1 -0
- package/dist/5ccd942a8800a68d44b6d3f5431909ec.ttf +0 -0
- package/dist/6fca6423291a2d06943a.ttf +1 -0
- package/dist/791134e64e8ef9da3f77.ttf +1 -0
- package/dist/8081832fc5cfbf634aa664a9eff0350e.ttf +0 -0
- package/dist/8c5e890c33607ed0e632.ttf +1 -0
- package/dist/9445d60ed014306b6aec1c69bf9d0174.ttf +0 -0
- package/dist/94b768c07879dde09ab4d5f6ad92cbc6.ttf +0 -0
- package/dist/9e1bb626874ed49aa343d66b8d66ceaf.ttf +0 -0
- package/dist/9e50c04f0efdf7813013.ttf +1 -0
- package/dist/9f57e7d4017ef9b93ae75e2c86f00d60.ttf +0 -0
- package/dist/a61eaf4c2e4d44d6db6a576706e9e6ae.ttf +0 -0
- package/dist/b10e7a6e913ca664cbdcb17894f9b419.ttf +0 -0
- package/dist/c0ee626f116bbcc4c721.ttf +1 -0
- package/dist/c27d458a5358094ac974.ttf +1 -0
- package/dist/c27efdacccfbcbd14ff2.ttf +1 -0
- package/dist/c76ea376f095f2e1e5138b226ad0f9cd.ttf +0 -0
- package/dist/cc7ee35ca49c83d4cfca932a03139f99.ttf +0 -0
- package/dist/cce5625b56ec678e42021270b84ef400.ttf +0 -0
- package/dist/ce3fff31c0f262aca227664f6f0d2fa2.ttf +0 -0
- package/dist/d01ea7f941ca3838ae97.ttf +1 -0
- package/dist/db767bc3ab4b2e42b4b1.ttf +1 -0
- package/dist/eacee5bb9c7fee5939aebf2335e5106a.ttf +0 -0
- package/dist/eebe2ceaa4fd239fe3fb.ttf +1 -0
- package/dist/eef56d4542bc2932ff9f.ttf +1 -0
- package/dist/f072662071f642a2e2b9.ttf +1 -0
- package/dist/f41b63c0bb0963ace821a2b99458c1cd.ttf +0 -0
- package/dist/f456d233db96b6889eeb.ttf +1 -0
- package/dist/fb248a35b11180453c6879a29d94eff4.ttf +0 -0
- package/dist/fb71f2d88c40660bb2e0.ttf +1 -0
- package/dist/main.js +2 -0
- package/dist/main.js.LICENSE.txt +20 -0
- package/jest-dom-setup.ts +1 -0
- package/jest.config.js +194 -0
- package/package.json +71 -0
- package/public/fallback-image-example.jpg +0 -0
- package/public/hero-example.jpg +0 -0
- package/public/image-example-2.jpg +0 -0
- package/public/image-example-3.jpg +0 -0
- package/public/image-example-4.jpg +0 -0
- package/public/image-example.jpg +0 -0
- package/public/index.html +12 -0
- package/release.config.js +29 -0
- package/src/App.scss +35 -0
- package/src/components/Banners/Banner/Banner.tsx +60 -0
- package/src/components/Banners/Banner/__test__/Banner.test.tsx +88 -0
- package/src/components/Banners/Banner/index.ts +3 -0
- package/src/components/Banners/Banner/stories/Banner.stories.tsx +81 -0
- package/src/components/Banners/Banner/stories/storiesStyle.scss +4 -0
- package/src/components/Banners/Banner/styles/Banner.layout.scss +51 -0
- package/src/components/Banners/Banner-Wrapper/Banner-Wrapper.tsx +45 -0
- package/src/components/Banners/Banner-Wrapper/__test__/Banner-Wrapper.test.tsx +72 -0
- package/src/components/Banners/Banner-Wrapper/index.ts +3 -0
- package/src/components/Banners/Banner-Wrapper/stories/Banner-Wrapper.stories.tsx +90 -0
- package/src/components/Banners/Banner-Wrapper/styles/Banner-Wrapper.layout.scss +18 -0
- package/src/components/Banners/index.ts +3 -0
- package/src/components/Buttons/Back/Back.tsx +80 -0
- package/src/components/Buttons/Back/__test__/Back.test.tsx +51 -0
- package/src/components/Buttons/Back/index.ts +3 -0
- package/src/components/Buttons/Back/stories/Back.stories.tsx +74 -0
- package/src/components/Buttons/Back/stories/storiesStyle.scss +11 -0
- package/src/components/Buttons/Back/styles/Back.layout.scss +12 -0
- package/src/components/Buttons/Back/styles/Back.theme.scss +7 -0
- package/src/components/Buttons/Button/Button.tsx +85 -0
- package/src/components/Buttons/Button/__test__/Button.test.tsx +66 -0
- package/src/components/Buttons/Button/index.ts +2 -0
- package/src/components/Buttons/Button/stories/Button.stories.tsx +90 -0
- package/src/components/Buttons/Button/stories/storiesStyle.scss +7 -0
- package/src/components/Buttons/Button/styles/Button.layout.scss +30 -0
- package/src/components/Buttons/Button/styles/Button.theme.scss +42 -0
- package/src/components/Buttons/index.ts +3 -0
- package/src/components/Card/Card-Container/Card-Container.tsx +59 -0
- package/src/components/Card/Card-Container/__test__/Card-Container.test.tsx +62 -0
- package/src/components/Card/Card-Container/index.ts +3 -0
- package/src/components/Card/Card-Container/stories/Card-Container.stories.tsx +45 -0
- package/src/components/Card/Card-Container/styles/Card-Container.layout.scss +8 -0
- package/src/components/Card/Card-Container/styles/Card-Container.theme.scss +9 -0
- package/src/components/Card/Card-Content/Card-Content.tsx +51 -0
- package/src/components/Card/Card-Content/__test__/Card-Content.test.tsx +84 -0
- package/src/components/Card/Card-Content/index.ts +3 -0
- package/src/components/Card/Card-Content/stories/Card-Content.stories.tsx +62 -0
- package/src/components/Card/Card-Content/styles/Card-Content.layout.scss +12 -0
- package/src/components/Card/Card-Summary-Value/Card-Summary-Value.tsx +39 -0
- package/src/components/Card/Card-Summary-Value/__test__/Card-Summary-Value.test.tsx +43 -0
- package/src/components/Card/Card-Summary-Value/index.ts +3 -0
- package/src/components/Card/Card-Summary-Value/stories/Card-Summary-Value.stories.tsx +60 -0
- package/src/components/Card/Card-Summary-Value/styles/Card-Summary-Value.layout.scss +7 -0
- package/src/components/Card/index.ts +4 -0
- package/src/components/Containers/Center-Container/Center-Container.tsx +40 -0
- package/src/components/Containers/Center-Container/__test__/Center-Container.test.tsx +39 -0
- package/src/components/Containers/Center-Container/index.ts +3 -0
- package/src/components/Containers/Center-Container/stories/Center-Container.stories.tsx +35 -0
- package/src/components/Containers/Center-Container/stories/storiesStyle.scss +10 -0
- package/src/components/Containers/Center-Container/styles/Center-Container.layout.scss +6 -0
- package/src/components/Containers/Flex/Flex.tsx +93 -0
- package/src/components/Containers/Flex/__test__/Flex.test.tsx +359 -0
- package/src/components/Containers/Flex/index.ts +3 -0
- package/src/components/Containers/Flex/stories/Flex.stories.tsx +73 -0
- package/src/components/Containers/Flex/stories/storiesStyle.scss +6 -0
- package/src/components/Containers/Flex/styles/Flex.layout.scss +54 -0
- package/src/components/Containers/Horizontal-Scroll-Container/Horizontal-Scroll-Container.tsx +51 -0
- package/src/components/Containers/Horizontal-Scroll-Container/__test__/Horizontal-Scroll-Container.test.tsx +50 -0
- package/src/components/Containers/Horizontal-Scroll-Container/index.ts +3 -0
- package/src/components/Containers/Horizontal-Scroll-Container/stories/Horizontal-Scroll-Container.stories.tsx +89 -0
- package/src/components/Containers/Horizontal-Scroll-Container/styles/Horizontal-Scroll-Container.layout.scss +12 -0
- package/src/components/Containers/Horizontal-Scroll-Item/Horizontal-Scroll-Item.tsx +48 -0
- package/src/components/Containers/Horizontal-Scroll-Item/__test__/Horizontal-Scroll-Item.test.tsx +50 -0
- package/src/components/Containers/Horizontal-Scroll-Item/index.ts +3 -0
- package/src/components/Containers/Horizontal-Scroll-Item/stories/Horizontal-Scroll-Item.stories.tsx +59 -0
- package/src/components/Containers/Horizontal-Scroll-Item/styles/Horizontal-Scroll-Item.layout.scss +5 -0
- package/src/components/Containers/Loading-Container/Loading-Container.tsx +100 -0
- package/src/components/Containers/Loading-Container/__test__/Loading-Container.test.tsx +197 -0
- package/src/components/Containers/Loading-Container/index.ts +3 -0
- package/src/components/Containers/Loading-Container/stories/Loading-Container.stories.tsx +113 -0
- package/src/components/Containers/Loading-Container/styles/Loading-Container.layout.scss +13 -0
- package/src/components/Containers/View/View.tsx +57 -0
- package/src/components/Containers/View/__test__/View.test.tsx +61 -0
- package/src/components/Containers/View/index.ts +3 -0
- package/src/components/Containers/View/stories/View.stories.tsx +60 -0
- package/src/components/Containers/View/stories/storiesStyle.scss +12 -0
- package/src/components/Containers/View/styles/View.layout.scss +6 -0
- package/src/components/Containers/View/styles/View.theme.scss +7 -0
- package/src/components/Containers/index.ts +7 -0
- package/src/components/Date-Selector/Date-Selector.tsx +266 -0
- package/src/components/Date-Selector/__test__/Date-Selector.test.tsx +435 -0
- package/src/components/Date-Selector/components/Date-Component-Navigation/Date-Component-Navigation.tsx +178 -0
- package/src/components/Date-Selector/components/Date-Component-Navigation/__test__/Date-Component-Navigation.test.tsx +297 -0
- package/src/components/Date-Selector/components/Date-Component-Navigation/styles/Date-Component-Navigation.layout.scss +26 -0
- package/src/components/Date-Selector/components/Date-Component-Navigation/styles/Date-Component-Navigation.theme.scss +12 -0
- package/src/components/Date-Selector/components/Date-Day-Name/Date-Day-Name.tsx +52 -0
- package/src/components/Date-Selector/components/Date-Day-Name/__test__/Date-Day-Name.test.tsx +52 -0
- package/src/components/Date-Selector/components/Date-Day-Name/styles/Date-Day-Name.layout.scss +5 -0
- package/src/components/Date-Selector/components/Date-Day-Name/styles/Date-Day-Name.theme.scss +4 -0
- package/src/components/Date-Selector/components/Date-Day-Number/Date-Day-Number.tsx +119 -0
- package/src/components/Date-Selector/components/Date-Day-Number/__test__/Date-Day-Number.test.tsx +201 -0
- package/src/components/Date-Selector/components/Date-Day-Number/styles/Date-Day-Number.layout.scss +22 -0
- package/src/components/Date-Selector/components/Date-Day-Number/styles/Date-Day-Number.theme.scss +15 -0
- package/src/components/Date-Selector/components/Date-Days-Grid/Date-Days-Grid.tsx +300 -0
- package/src/components/Date-Selector/components/Date-Days-Grid/__test__/Date-Days-Grid.test.tsx +536 -0
- package/src/components/Date-Selector/components/Date-Days-Grid/styles/Date-Days-Grid.layout.scss +11 -0
- package/src/components/Date-Selector/components/Date-Days-Grid/styles/Date-Days-Grid.theme.scss +3 -0
- package/src/components/Date-Selector/components/Date-Selector-Header/Date-Selector-Header.tsx +65 -0
- package/src/components/Date-Selector/components/Date-Selector-Header/__test__/Date-Selector-Header.test.tsx +101 -0
- package/src/components/Date-Selector/components/Date-Selector-Header/styles/Date-Selector-Header.layout.scss +27 -0
- package/src/components/Date-Selector/components/Date-Selector-Header/styles/Date-Selector-Header.theme.scss +4 -0
- package/src/components/Date-Selector/index.ts +3 -0
- package/src/components/Date-Selector/stories/Date-Selector.stories.tsx +140 -0
- package/src/components/Date-Selector/stories/storiesStyle.scss +4 -0
- package/src/components/Date-Selector/styles/Date-Selector.layout.scss +36 -0
- package/src/components/Date-Selector/styles/Date-Selector.shared.scss +4 -0
- package/src/components/Date-Selector/styles/Date-Selector.theme.scss +9 -0
- package/src/components/Date-Selector/types/index.ts +77 -0
- package/src/components/Date-Selector/utils/__test__/Date-Selector-Utils.test.ts +62 -0
- package/src/components/Date-Selector/utils/index.ts +76 -0
- package/src/components/Dialog/Dialog.tsx +213 -0
- package/src/components/Dialog/__test__/Dialog.test.tsx +220 -0
- package/src/components/Dialog/index.ts +3 -0
- package/src/components/Dialog/stories/Dialog.stories.tsx +124 -0
- package/src/components/Dialog/styles/Dialog.layout.scss +38 -0
- package/src/components/Dialog/styles/Dialog.theme.scss +21 -0
- package/src/components/Errors/Component-Error/Component-Error.tsx +92 -0
- package/src/components/Errors/Component-Error/__test__/Component-Error.test.tsx +93 -0
- package/src/components/Errors/Component-Error/index.ts +3 -0
- package/src/components/Errors/Component-Error/stories/Component-Error.stories.tsx +55 -0
- package/src/components/Errors/Component-Error/stories/storiesStyle.scss +4 -0
- package/src/components/Errors/Component-Error/styles/Component-Error.layout.scss +27 -0
- package/src/components/Errors/Component-Error/styles/Component-Error.theme.scss +12 -0
- package/src/components/Errors/Full-Screen-Error/Full-Screen-Error.tsx +91 -0
- package/src/components/Errors/Full-Screen-Error/__test__/Full-Screen-Error.test.tsx +81 -0
- package/src/components/Errors/Full-Screen-Error/index.ts +3 -0
- package/src/components/Errors/Full-Screen-Error/stories/Full-Screen-Error.stories.tsx +69 -0
- package/src/components/Errors/Full-Screen-Error/styles/Full-Screen-Error.layout.scss +26 -0
- package/src/components/Errors/Full-Screen-Error/styles/Full-Screen-Error.theme.scss +7 -0
- package/src/components/Errors/index.ts +3 -0
- package/src/components/Example/Example.tsx +51 -0
- package/src/components/Example/__test__/Example.test.tsx +12 -0
- package/src/components/Example/index.ts +3 -0
- package/src/components/Example/stories/Example.stories.tsx +48 -0
- package/src/components/Example/stories/storiesStyle.scss +4 -0
- package/src/components/Example/styles/Example.layout.scss +3 -0
- package/src/components/Example/styles/Example.theme.scss +8 -0
- package/src/components/External-Links/External-Links.tsx +93 -0
- package/src/components/External-Links/__test__/External-Links.test.tsx +81 -0
- package/src/components/External-Links/index.ts +3 -0
- package/src/components/External-Links/stories/External-Links.stories.tsx +111 -0
- package/src/components/External-Links/stories/storiesStyle.scss +7 -0
- package/src/components/External-Links/styles/External-Links.layout.scss +14 -0
- package/src/components/External-Links/styles/External-Links.theme.scss +4 -0
- package/src/components/Footer/Footer.tsx +56 -0
- package/src/components/Footer/__test__/Footer.test.tsx +63 -0
- package/src/components/Footer/index.ts +3 -0
- package/src/components/Footer/stories/Footer.stories.tsx +52 -0
- package/src/components/Footer/stories/storiesStyle.scss +5 -0
- package/src/components/Footer/styles/Footer.layout.scss +13 -0
- package/src/components/Footer/styles/Footer.theme.scss +4 -0
- package/src/components/Form/Form-Container/Form-Container.tsx +62 -0
- package/src/components/Form/Form-Container/__test__/Form-Container.test.tsx +75 -0
- package/src/components/Form/Form-Container/index.ts +3 -0
- package/src/components/Form/Form-Container/stories/Form-Container.stories.tsx +105 -0
- package/src/components/Form/Form-Container/styles/Form-Container.layout.scss +2 -0
- package/src/components/Form/Form-Container/styles/Form-Container.theme.scss +2 -0
- package/src/components/Form/Form-Input-Container/Form-Input-Container.tsx +61 -0
- package/src/components/Form/Form-Input-Container/__test__/Form-Input-Container.test.tsx +97 -0
- package/src/components/Form/Form-Input-Container/index.ts +3 -0
- package/src/components/Form/Form-Input-Container/stories/Form-Input-Container.stories.tsx +72 -0
- package/src/components/Form/Form-Input-Container/styles/Form-Input-Container.layout.scss +2 -0
- package/src/components/Form/Form-Input-Container/styles/Form-Input-Container.theme.scss +2 -0
- package/src/components/Form/Form-Types.ts +20 -0
- package/src/components/Form/Inputs/Input-Label/Input-Label.tsx +110 -0
- package/src/components/Form/Inputs/Input-Label/index.ts +3 -0
- package/src/components/Form/Inputs/Input-Label/styles/Input-Label.layout.scss +35 -0
- package/src/components/Form/Inputs/Input-Label/styles/Input-Label.theme.scss +7 -0
- package/src/components/Form/Inputs/Submit-Button/Submit-Button.tsx +61 -0
- package/src/components/Form/Inputs/Submit-Button/index.ts +3 -0
- package/src/components/Form/Inputs/Submit-Button/styles/Submit-Button.layout.scss +11 -0
- package/src/components/Form/Inputs/Submit-Button/styles/Submit-Button.theme.scss +6 -0
- package/src/components/Form/Inputs/Text-Input/Text-Input.tsx +100 -0
- package/src/components/Form/Inputs/Text-Input/index.ts +3 -0
- package/src/components/Form/Inputs/Text-Input/styles/Text-Input.layout.scss +12 -0
- package/src/components/Form/Inputs/Text-Input/styles/Text-Input.theme.scss +10 -0
- package/src/components/Form/Inputs/sharedStyles.scss +11 -0
- package/src/components/Form/Modular/Form-Contexts-Repository.ts +26 -0
- package/src/components/Form/Modular/Form-Data-Context.ts +11 -0
- package/src/components/Form/Modular/Hooks.ts +127 -0
- package/src/components/Form/Modular/Parent-Form-Context-Provider.tsx +22 -0
- package/src/components/Form/Sub-Form-Container/Sub-Form-Container.tsx +83 -0
- package/src/components/Form/Sub-Form-Container/__test__/Sub-Form-Container.test.tsx +82 -0
- package/src/components/Form/Sub-Form-Container/index.ts +3 -0
- package/src/components/Form/Sub-Form-Container/stories/Sub-Form-Container.stories.tsx +121 -0
- package/src/components/Form/Sub-Form-Container/styles/Sub-Form-Container.layout.scss +7 -0
- package/src/components/Form/Sub-Form-Container/styles/Sub-Form-Container.theme.scss +19 -0
- package/src/components/Form/index.ts +12 -0
- package/src/components/Icon/Icon.tsx +71 -0
- package/src/components/Icon/__test__/Icon.test.tsx +56 -0
- package/src/components/Icon/index.ts +3 -0
- package/src/components/Icon/stories/Icon.stories.tsx +98 -0
- package/src/components/Icon/styles/Icon.layout.scss +8 -0
- package/src/components/Icon/styles/Icon.theme.scss +0 -0
- package/src/components/Images/Hero/Hero.tsx +59 -0
- package/src/components/Images/Hero/__test__/Hero.test.tsx +102 -0
- package/src/components/Images/Hero/index.ts +3 -0
- package/src/components/Images/Hero/stories/Hero.stories.tsx +52 -0
- package/src/components/Images/Hero/stories/storyStyles.scss +3 -0
- package/src/components/Images/Hero/styles/Hero.layout.scss +13 -0
- package/src/components/Images/Image/Image.tsx +134 -0
- package/src/components/Images/Image/__test__/Image.test.tsx +149 -0
- package/src/components/Images/Image/index.ts +3 -0
- package/src/components/Images/Image/stories/Image.stories.tsx +90 -0
- package/src/components/Images/Image/stories/storyStyles.scss +3 -0
- package/src/components/Images/Image/styles/Image.layout.scss +48 -0
- package/src/components/Images/Multi-Image-Viewer/Multi-Image-Viewer.tsx +199 -0
- package/src/components/Images/Multi-Image-Viewer/__test__/Multi-Image-Viewer.test.tsx +317 -0
- package/src/components/Images/Multi-Image-Viewer/index.ts +3 -0
- package/src/components/Images/Multi-Image-Viewer/stories/Multi-Image-Viewer.stories.tsx +155 -0
- package/src/components/Images/Multi-Image-Viewer/stories/storiesStyle.scss +8 -0
- package/src/components/Images/Multi-Image-Viewer/styles/Multi-Image-Viewer.layout.scss +29 -0
- package/src/components/Images/Multi-Image-Viewer/styles/Multi-Image-Viewer.theme.scss +3 -0
- package/src/components/Images/index.ts +4 -0
- package/src/components/Loaders/Loader/Loader.tsx +77 -0
- package/src/components/Loaders/Loader/__test__/Loader.test.tsx +51 -0
- package/src/components/Loaders/Loader/index.ts +3 -0
- package/src/components/Loaders/Loader/stories/Loader.stories.tsx +49 -0
- package/src/components/Loaders/Loader/stories/storiesStyle.scss +7 -0
- package/src/components/Loaders/Loader/styles/Component-Loader.layout.scss +43 -0
- package/src/components/Loaders/Loader/styles/Component-Loader.theme.scss +9 -0
- package/src/components/Loaders/index.ts +2 -0
- package/src/components/Modal/Modal-Body/Modal-Body.tsx +52 -0
- package/src/components/Modal/Modal-Body/__test__/Modal-Body.test.tsx +61 -0
- package/src/components/Modal/Modal-Body/index.ts +3 -0
- package/src/components/Modal/Modal-Body/stories/Modal-Body.stories.tsx +75 -0
- package/src/components/Modal/Modal-Body/styles/Modal-Body.layout.scss +4 -0
- package/src/components/Modal/Modal-Container/Modal-Container.tsx +79 -0
- package/src/components/Modal/Modal-Container/__test__/Modal-Container.test.tsx +88 -0
- package/src/components/Modal/Modal-Container/index.ts +3 -0
- package/src/components/Modal/Modal-Container/stories/Modal-Container.stories.tsx +73 -0
- package/src/components/Modal/Modal-Container/stories/storiesStyle.scss +5 -0
- package/src/components/Modal/Modal-Container/styles/Modal-Container.layout.scss +21 -0
- package/src/components/Modal/Modal-Container/styles/Modal-Container.theme.scss +3 -0
- package/src/components/Modal/Modal-Header/Modal-Header.tsx +65 -0
- package/src/components/Modal/Modal-Header/__test__/Modal-Header.test.tsx +74 -0
- package/src/components/Modal/Modal-Header/index.ts +3 -0
- package/src/components/Modal/Modal-Header/stories/Modal-Header.stories.tsx +74 -0
- package/src/components/Modal/Modal-Header/styles/Modal-Header.layout.scss +15 -0
- package/src/components/Modal/Modal-Header/styles/Modal-Header.theme.scss +4 -0
- package/src/components/Modal/index.ts +4 -0
- package/src/components/Panel/Panel-Container/Panel-Container.tsx +47 -0
- package/src/components/Panel/Panel-Container/__test__/Panel-Container.test.tsx +50 -0
- package/src/components/Panel/Panel-Container/index.ts +3 -0
- package/src/components/Panel/Panel-Container/stories/Panel-Container.stories.tsx +49 -0
- package/src/components/Panel/Panel-Container/stories/storiesStyle.scss +3 -0
- package/src/components/Panel/Panel-Container/styles/Panel-Container.layout.scss +9 -0
- package/src/components/Panel/Panel-Container/styles/Panel-Container.theme.scss +4 -0
- package/src/components/Panel/Panel-Row/Panel-Row.tsx +80 -0
- package/src/components/Panel/Panel-Row/__test__/Panel-Row.test.tsx +45 -0
- package/src/components/Panel/Panel-Row/index.ts +3 -0
- package/src/components/Panel/Panel-Row/stories/Panel-Row.stories.tsx +57 -0
- package/src/components/Panel/Panel-Row/styles/Panel-Row.layout.scss +16 -0
- package/src/components/Panel/Panel-Title/Panel-Title.tsx +47 -0
- package/src/components/Panel/Panel-Title/__test__/Panel-Title.test.tsx +28 -0
- package/src/components/Panel/Panel-Title/index.ts +3 -0
- package/src/components/Panel/Panel-Title/stories/Panel-Title.stories.tsx +47 -0
- package/src/components/Panel/Panel-Title/styles/Panel-Title.layout.scss +7 -0
- package/src/components/Panel/Panel-Title/styles/Panel-Title.theme.scss +3 -0
- package/src/components/Panel/index.ts +4 -0
- package/src/components/Quantity-Counter/Quantity-Counter.tsx +73 -0
- package/src/components/Quantity-Counter/__test__/Quantity-Counter.test.tsx +75 -0
- package/src/components/Quantity-Counter/index.ts +3 -0
- package/src/components/Quantity-Counter/stories/Quantity-Counter.stories.tsx +26 -0
- package/src/components/Quantity-Counter/styles/Quantity-Counter.layout.scss +18 -0
- package/src/components/Quantity-Counter/styles/Quantity-Counter.theme.scss +3 -0
- package/src/hooks/useClickOutside.ts +21 -0
- package/src/hooks/useDisableBodyScroll.ts +15 -0
- package/src/icons/index.ts +50 -0
- package/src/icons/svg/ChevronDoubleLeft.svg +4 -0
- package/src/icons/svg/ChevronDoubleRight.svg +4 -0
- package/src/icons/svg/ChevronSingleLeft.svg +3 -0
- package/src/icons/svg/ChevronSingleRight.svg +3 -0
- package/src/icons/svg/about.svg +3 -0
- package/src/icons/svg/cart.svg +5 -0
- package/src/icons/svg/dashboard.svg +13 -0
- package/src/icons/svg/delete.svg +3 -0
- package/src/icons/svg/dropdown_down.svg +3 -0
- package/src/icons/svg/dropdown_up.svg +3 -0
- package/src/icons/svg/edit.svg +4 -0
- package/src/icons/svg/home.svg +3 -0
- package/src/icons/svg/loader.svg +10 -0
- package/src/icons/svg/logout.svg +12 -0
- package/src/icons/svg/orders.svg +3 -0
- package/src/icons/svg/products.svg +11 -0
- package/src/icons/svg/profile.svg +3 -0
- package/src/icons/svg/settings.svg +3 -0
- package/src/icons/svg/star-empty.svg +3 -0
- package/src/icons/svg/star-full.svg +3 -0
- package/src/icons/svg/star-half.svg +4 -0
- package/src/icons/svg/upload.svg +4 -0
- package/src/icons/svg/users.svg +15 -0
- package/src/index.ts +35 -0
- package/src/index.tsx +6 -0
- package/src/pending_components/form/check-box/check-box.js +30 -0
- package/src/pending_components/form/check-box/check-box.scss +34 -0
- package/src/pending_components/form/clickable-button/clickable-button.js +30 -0
- package/src/pending_components/form/clickable-button/clickable-button.scss +24 -0
- package/src/pending_components/form/dropdown-select/dropdown-select.js +87 -0
- package/src/pending_components/form/dropdown-select/dropdown-select.scss +108 -0
- package/src/pending_components/form/external-links-array-input/external-link-array-input.scss +39 -0
- package/src/pending_components/form/external-links-array-input/external-links-array-input.js +234 -0
- package/src/pending_components/form/form/form.js +17 -0
- package/src/pending_components/form/form/form.scss +0 -0
- package/src/pending_components/form/form-group/form-group.js +20 -0
- package/src/pending_components/form/form-group/form-group.scss +21 -0
- package/src/pending_components/form/input-field/input-field.js +57 -0
- package/src/pending_components/form/input-field/input-field.scss +22 -0
- package/src/pending_components/form/input-file/input-file.js +124 -0
- package/src/pending_components/form/input-file/input-file.scss +76 -0
- package/src/pending_components/form/input-label/input-label.js +47 -0
- package/src/pending_components/form/input-label/input-label.scss +17 -0
- package/src/pending_components/form/radio-button/radio-button.js +37 -0
- package/src/pending_components/form/radio-button/radio-button.scss +18 -0
- package/src/pending_components/form/submit-button/submit-button.js +18 -0
- package/src/pending_components/form/submit-button/submit-button.scss +24 -0
- package/src/pending_components/form/submit-button-fixed-button/submit-button-fixed-button.js +17 -0
- package/src/pending_components/form/submit-button-fixed-button/submit-button-fixed-button.scss +23 -0
- package/src/pending_components/form/submit-button-fixed-container/submit-button-fixed-container.js +9 -0
- package/src/pending_components/form/submit-button-fixed-container/submit-button-fixed-container.scss +15 -0
- package/src/pending_components/form/text-area/text-area.js +42 -0
- package/src/pending_components/form/text-area/text-area.scss +16 -0
- package/src/styles/_defaults.scss +22 -0
- package/src/styles/_fonts.scss +153 -0
- package/src/styles/_mixins.scss +33 -0
- package/src/styles/_spacings.scss +497 -0
- package/src/styles/_transitions.scss +27 -0
- package/src/styles/_typography.scss +85 -0
- package/src/styles/_variables.scss +5 -0
- package/src/styles/fonts/Dancing_Script/OFL.txt +93 -0
- package/src/styles/fonts/Dancing_Script/README.txt +66 -0
- package/src/styles/fonts/Dancing_Script/static/DancingScript-Bold.ttf +0 -0
- package/src/styles/fonts/Dancing_Script/static/DancingScript-Medium.ttf +0 -0
- package/src/styles/fonts/Dancing_Script/static/DancingScript-Regular.ttf +0 -0
- package/src/styles/fonts/Dancing_Script/static/DancingScript-SemiBold.ttf +0 -0
- package/src/styles/fonts/Poppins/OFL.txt +93 -0
- package/src/styles/fonts/Poppins/Poppins-Black.ttf +0 -0
- package/src/styles/fonts/Poppins/Poppins-BlackItalic.ttf +0 -0
- package/src/styles/fonts/Poppins/Poppins-Bold.ttf +0 -0
- package/src/styles/fonts/Poppins/Poppins-BoldItalic.ttf +0 -0
- package/src/styles/fonts/Poppins/Poppins-ExtraBold.ttf +0 -0
- package/src/styles/fonts/Poppins/Poppins-ExtraBoldItalic.ttf +0 -0
- package/src/styles/fonts/Poppins/Poppins-ExtraLight.ttf +0 -0
- package/src/styles/fonts/Poppins/Poppins-ExtraLightItalic.ttf +0 -0
- package/src/styles/fonts/Poppins/Poppins-Italic.ttf +0 -0
- package/src/styles/fonts/Poppins/Poppins-Light.ttf +0 -0
- package/src/styles/fonts/Poppins/Poppins-LightItalic.ttf +0 -0
- package/src/styles/fonts/Poppins/Poppins-Medium.ttf +0 -0
- package/src/styles/fonts/Poppins/Poppins-MediumItalic.ttf +0 -0
- package/src/styles/fonts/Poppins/Poppins-Regular.ttf +0 -0
- package/src/styles/fonts/Poppins/Poppins-SemiBold.ttf +0 -0
- package/src/styles/fonts/Poppins/Poppins-SemiBoldItalic.ttf +0 -0
- package/src/styles/fonts/Poppins/Poppins-Thin.ttf +0 -0
- package/src/styles/fonts/Poppins/Poppins-ThinItalic.ttf +0 -0
- package/src/styles/global.scss +113 -0
- package/src/styles/vars/_colors.scss +48 -0
- package/src/styles/vars/_fontSizes.scss +10 -0
- package/src/styles/vars/_layout.scss +67 -0
- package/src/styles/vars/_palette.scss +27 -0
- package/src/styles/vars/_transitions.scss +2 -0
- package/src/styles/vars_and_mixins.scss +2 -0
- package/src/types/IComponent.ts +9 -0
- package/src/types/IImageObject.ts +4 -0
- package/src/types/ILink.ts +4 -0
- package/src/types/IProduct.ts +6 -0
- package/src/types/ISpacingsProps.ts +28 -0
- package/src/types/ImageClickable.ts +3 -0
- package/src/types/Theme.ts +10 -0
- package/src/utils/arrays.ts +3 -0
- package/src/utils/styles.ts +128 -0
- package/src/utils/validations.ts +23 -0
- package/tsconfig.json +24 -0
- package/tslint.json +36 -0
- package/webpack.config.js +79 -0
- package/webpack.prod.js +24 -0
package/src/components/Date-Selector/components/Date-Days-Grid/__test__/Date-Days-Grid.test.tsx
ADDED
|
@@ -0,0 +1,536 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import classnames from "classnames";
|
|
3
|
+
import { DateDaysGrid } from "@components/Date-Selector/components/Date-Days-Grid/Date-Days-Grid";
|
|
4
|
+
import { render, screen } from "@testing-library/react";
|
|
5
|
+
import { methodHasValue, stringHasValue } from "@utils/validations";
|
|
6
|
+
|
|
7
|
+
// import from index does not work for jest.spyOn
|
|
8
|
+
import * as DateDayNameModule from "@components/Date-Selector/components/Date-Day-Name/Date-Day-Name";
|
|
9
|
+
import * as DateDayNumberModule from "@components/Date-Selector/components/Date-Day-Number/Date-Day-Number";
|
|
10
|
+
|
|
11
|
+
describe("Date Selector Days Grid Component Unit Tests", () => {
|
|
12
|
+
beforeEach(() => {
|
|
13
|
+
jest.spyOn(DateDayNameModule, "DateDayName").mockImplementation((props) => {
|
|
14
|
+
const { rootClassName, rootStyles, children } = props;
|
|
15
|
+
|
|
16
|
+
return (
|
|
17
|
+
<div
|
|
18
|
+
data-testid="date-selector-day-name-mock"
|
|
19
|
+
className={rootClassName}
|
|
20
|
+
style={rootStyles}
|
|
21
|
+
>
|
|
22
|
+
{children}
|
|
23
|
+
</div>
|
|
24
|
+
);
|
|
25
|
+
});
|
|
26
|
+
|
|
27
|
+
jest
|
|
28
|
+
.spyOn(DateDayNumberModule, "DateDayNumberComponent")
|
|
29
|
+
.mockImplementation((props) => {
|
|
30
|
+
const {
|
|
31
|
+
dayNumber,
|
|
32
|
+
dayNumberDisplay,
|
|
33
|
+
isToday,
|
|
34
|
+
isSelected,
|
|
35
|
+
disabled,
|
|
36
|
+
onClick,
|
|
37
|
+
rootClassName,
|
|
38
|
+
rootStyles,
|
|
39
|
+
} = props;
|
|
40
|
+
|
|
41
|
+
const containerClasses = classnames({
|
|
42
|
+
rootClassName: !!rootClassName,
|
|
43
|
+
date_day_number_mock_selected: isSelected,
|
|
44
|
+
date_day_number_mock_today: isToday,
|
|
45
|
+
date_day_number_mock_disabled: disabled,
|
|
46
|
+
});
|
|
47
|
+
|
|
48
|
+
const dayNumberText = stringHasValue(dayNumberDisplay)
|
|
49
|
+
? dayNumberDisplay
|
|
50
|
+
: dayNumber;
|
|
51
|
+
|
|
52
|
+
return (
|
|
53
|
+
<div
|
|
54
|
+
data-testid="date-selector-day-number-mock"
|
|
55
|
+
className={containerClasses}
|
|
56
|
+
style={rootStyles}
|
|
57
|
+
onClick={
|
|
58
|
+
methodHasValue(onClick) ? () => onClick(dayNumber) : undefined
|
|
59
|
+
}
|
|
60
|
+
>
|
|
61
|
+
{dayNumberText}
|
|
62
|
+
</div>
|
|
63
|
+
);
|
|
64
|
+
});
|
|
65
|
+
});
|
|
66
|
+
|
|
67
|
+
afterEach(() => {
|
|
68
|
+
jest.restoreAllMocks();
|
|
69
|
+
});
|
|
70
|
+
|
|
71
|
+
test("should render itself without error", () => {
|
|
72
|
+
const todayMock = new Date(2020, 5, 1); // Mon June 01 2020
|
|
73
|
+
|
|
74
|
+
const { debug } = render(
|
|
75
|
+
<DateDaysGrid
|
|
76
|
+
monthStartDay={0}
|
|
77
|
+
monthNumberOfDays={30}
|
|
78
|
+
prevMonthDays={31}
|
|
79
|
+
today={todayMock}
|
|
80
|
+
selectedYear={2020}
|
|
81
|
+
selectedMonth={5}
|
|
82
|
+
/>
|
|
83
|
+
);
|
|
84
|
+
|
|
85
|
+
// debug();
|
|
86
|
+
const component = screen.queryByTestId("date-selector-grid-root");
|
|
87
|
+
expect(component).toBeInTheDocument();
|
|
88
|
+
});
|
|
89
|
+
|
|
90
|
+
test("should apply default className", () => {
|
|
91
|
+
const todayMock = new Date(2020, 5, 1); // Mon June 01 2020
|
|
92
|
+
const { debug } = render(
|
|
93
|
+
<DateDaysGrid
|
|
94
|
+
monthStartDay={0}
|
|
95
|
+
monthNumberOfDays={30}
|
|
96
|
+
prevMonthDays={31}
|
|
97
|
+
today={todayMock}
|
|
98
|
+
selectedYear={2020}
|
|
99
|
+
selectedMonth={5}
|
|
100
|
+
/>
|
|
101
|
+
);
|
|
102
|
+
|
|
103
|
+
// debug();
|
|
104
|
+
const component = screen.queryByTestId("date-selector-grid-root");
|
|
105
|
+
expect(component).toHaveClass("date_days_grid_container");
|
|
106
|
+
});
|
|
107
|
+
|
|
108
|
+
test("should apply theme classNames when provided as prop", () => {
|
|
109
|
+
const todayMock = new Date(2020, 5, 1); // Mon June 01 2020
|
|
110
|
+
const { debug } = render(
|
|
111
|
+
<DateDaysGrid
|
|
112
|
+
monthStartDay={0}
|
|
113
|
+
monthNumberOfDays={30}
|
|
114
|
+
prevMonthDays={31}
|
|
115
|
+
today={todayMock}
|
|
116
|
+
selectedYear={2020}
|
|
117
|
+
selectedMonth={5}
|
|
118
|
+
theme="dark"
|
|
119
|
+
/>
|
|
120
|
+
);
|
|
121
|
+
|
|
122
|
+
// debug();
|
|
123
|
+
const component = screen.queryByTestId("date-selector-grid-root");
|
|
124
|
+
expect(component).toHaveClass("date_days_grid_theme_dark");
|
|
125
|
+
});
|
|
126
|
+
|
|
127
|
+
test("should apply custom className when provided as prop", () => {
|
|
128
|
+
const todayMock = new Date(2020, 5, 1); // Mon June 01 2020
|
|
129
|
+
const { debug } = render(
|
|
130
|
+
<DateDaysGrid
|
|
131
|
+
monthStartDay={0}
|
|
132
|
+
monthNumberOfDays={30}
|
|
133
|
+
prevMonthDays={31}
|
|
134
|
+
today={todayMock}
|
|
135
|
+
selectedYear={2020}
|
|
136
|
+
selectedMonth={5}
|
|
137
|
+
rootClassName="date_selector_grid_custom_className"
|
|
138
|
+
/>
|
|
139
|
+
);
|
|
140
|
+
|
|
141
|
+
// debug();
|
|
142
|
+
const component = screen.queryByTestId("date-selector-grid-root");
|
|
143
|
+
expect(component).toHaveClass("date_selector_grid_custom_className");
|
|
144
|
+
});
|
|
145
|
+
|
|
146
|
+
test("should apply custom styles when provided as prop", () => {
|
|
147
|
+
const todayMock = new Date(2020, 5, 1); // Mon June 01 2020
|
|
148
|
+
const { debug } = render(
|
|
149
|
+
<DateDaysGrid
|
|
150
|
+
monthStartDay={0}
|
|
151
|
+
monthNumberOfDays={30}
|
|
152
|
+
prevMonthDays={31}
|
|
153
|
+
today={todayMock}
|
|
154
|
+
selectedYear={2020}
|
|
155
|
+
selectedMonth={5}
|
|
156
|
+
rootStyles={{ border: "2px solid red" }}
|
|
157
|
+
/>
|
|
158
|
+
);
|
|
159
|
+
|
|
160
|
+
// debug();
|
|
161
|
+
const component = screen.queryByTestId("date-selector-grid-root");
|
|
162
|
+
expect(component).toHaveStyle("border: 2px solid red");
|
|
163
|
+
});
|
|
164
|
+
|
|
165
|
+
test("should render default day names correctly", () => {
|
|
166
|
+
const defaultDayNames = ["Mon", "Tue", "Wed", "Thu", "Fri", "Sat", "Sun"];
|
|
167
|
+
const todayMock = new Date(2020, 5, 1); // Mon June 01 2020
|
|
168
|
+
|
|
169
|
+
const { debug } = render(
|
|
170
|
+
<DateDaysGrid
|
|
171
|
+
monthStartDay={0}
|
|
172
|
+
monthNumberOfDays={30}
|
|
173
|
+
prevMonthDays={31}
|
|
174
|
+
today={todayMock}
|
|
175
|
+
selectedYear={2020}
|
|
176
|
+
selectedMonth={5}
|
|
177
|
+
/>
|
|
178
|
+
);
|
|
179
|
+
|
|
180
|
+
// debug();
|
|
181
|
+
const dayNameComponents = screen.queryAllByTestId(
|
|
182
|
+
"date-selector-day-name-mock"
|
|
183
|
+
);
|
|
184
|
+
|
|
185
|
+
dayNameComponents.map((component, idx) => {
|
|
186
|
+
expect(component).toHaveTextContent(defaultDayNames[idx]);
|
|
187
|
+
});
|
|
188
|
+
});
|
|
189
|
+
|
|
190
|
+
test("should render custom day names correctly", () => {
|
|
191
|
+
const customDayNames = ["Isn", "Sel", "Rab", "Kha", "Jum", "Sab", "Aha"];
|
|
192
|
+
const todayMock = new Date(2020, 5, 1); // Mon June 01 2020
|
|
193
|
+
|
|
194
|
+
const { debug } = render(
|
|
195
|
+
<DateDaysGrid
|
|
196
|
+
monthStartDay={0}
|
|
197
|
+
monthNumberOfDays={30}
|
|
198
|
+
prevMonthDays={31}
|
|
199
|
+
today={todayMock}
|
|
200
|
+
selectedYear={2020}
|
|
201
|
+
selectedMonth={5}
|
|
202
|
+
getDisplayDayName={(day) => {
|
|
203
|
+
return customDayNames[day];
|
|
204
|
+
}}
|
|
205
|
+
/>
|
|
206
|
+
);
|
|
207
|
+
|
|
208
|
+
// debug();
|
|
209
|
+
const dayNameComponents = screen.queryAllByTestId(
|
|
210
|
+
"date-selector-day-name-mock"
|
|
211
|
+
);
|
|
212
|
+
|
|
213
|
+
dayNameComponents.map((component, idx) => {
|
|
214
|
+
expect(component).toHaveTextContent(customDayNames[idx]);
|
|
215
|
+
});
|
|
216
|
+
});
|
|
217
|
+
|
|
218
|
+
test("should render 42 DayNumber components", () => {
|
|
219
|
+
// 6 rows x 7 columns
|
|
220
|
+
const todayMock = new Date(2020, 5, 1); // Mon June 01 2020
|
|
221
|
+
|
|
222
|
+
const { debug } = render(
|
|
223
|
+
<DateDaysGrid
|
|
224
|
+
monthStartDay={0}
|
|
225
|
+
monthNumberOfDays={30}
|
|
226
|
+
prevMonthDays={31}
|
|
227
|
+
today={todayMock}
|
|
228
|
+
selectedYear={2020}
|
|
229
|
+
selectedMonth={5}
|
|
230
|
+
/>
|
|
231
|
+
);
|
|
232
|
+
|
|
233
|
+
// debug();
|
|
234
|
+
const dayNumberComponents = screen.queryAllByTestId(
|
|
235
|
+
"date-selector-day-number-mock"
|
|
236
|
+
);
|
|
237
|
+
|
|
238
|
+
expect(dayNumberComponents.length).toEqual(42);
|
|
239
|
+
});
|
|
240
|
+
|
|
241
|
+
test("should render custom day numbers correctly", () => {
|
|
242
|
+
const customDayNumbers = { 1: "One", 2: "Two", 3: "Thr", 4: "Fou" };
|
|
243
|
+
const todayMock = new Date(2020, 5, 1); // Mon June 01 2020
|
|
244
|
+
|
|
245
|
+
const { debug } = render(
|
|
246
|
+
<DateDaysGrid
|
|
247
|
+
monthStartDay={0}
|
|
248
|
+
monthNumberOfDays={30}
|
|
249
|
+
prevMonthDays={31}
|
|
250
|
+
today={todayMock}
|
|
251
|
+
selectedYear={2020}
|
|
252
|
+
selectedMonth={5}
|
|
253
|
+
getDisplayDayNumber={(day) => {
|
|
254
|
+
if (customDayNumbers[day]) {
|
|
255
|
+
return customDayNumbers[day];
|
|
256
|
+
}
|
|
257
|
+
|
|
258
|
+
return day;
|
|
259
|
+
}}
|
|
260
|
+
/>
|
|
261
|
+
);
|
|
262
|
+
|
|
263
|
+
// debug();
|
|
264
|
+
const customDayNumber1 = screen.queryAllByText("One");
|
|
265
|
+
expect(customDayNumber1[0]).toBeInTheDocument();
|
|
266
|
+
|
|
267
|
+
const customDayNumber2 = screen.queryAllByText("Two");
|
|
268
|
+
expect(customDayNumber2[0]).toBeInTheDocument();
|
|
269
|
+
|
|
270
|
+
const customDayNumber3 = screen.queryAllByText("Thr");
|
|
271
|
+
expect(customDayNumber3[0]).toBeInTheDocument();
|
|
272
|
+
|
|
273
|
+
const customDayNumber4 = screen.queryAllByText("Fou");
|
|
274
|
+
expect(customDayNumber4[0]).toBeInTheDocument();
|
|
275
|
+
});
|
|
276
|
+
|
|
277
|
+
test("should render today DayNumber correctly", () => {
|
|
278
|
+
const todayMock = new Date(2020, 5, 1); // Mon June 01 2020
|
|
279
|
+
|
|
280
|
+
const { debug } = render(
|
|
281
|
+
<DateDaysGrid
|
|
282
|
+
monthStartDay={0}
|
|
283
|
+
monthNumberOfDays={30}
|
|
284
|
+
prevMonthDays={31}
|
|
285
|
+
today={todayMock}
|
|
286
|
+
selectedYear={2020}
|
|
287
|
+
selectedMonth={5}
|
|
288
|
+
/>
|
|
289
|
+
);
|
|
290
|
+
|
|
291
|
+
// debug();
|
|
292
|
+
const dayNumberComponents = screen.queryAllByText("1");
|
|
293
|
+
const today = dayNumberComponents[0];
|
|
294
|
+
|
|
295
|
+
expect(today).toBeInTheDocument();
|
|
296
|
+
expect(today).toHaveClass("date_day_number_mock_today");
|
|
297
|
+
});
|
|
298
|
+
|
|
299
|
+
test("should render 12 disabled days after June days are over", () => {
|
|
300
|
+
// because there only 30 days in June
|
|
301
|
+
// and there total of 6 rows x 7 columns rendered days = 42
|
|
302
|
+
// and first day of June 2020 starts on Monday (monthStartDay = 0)
|
|
303
|
+
const todayMock = new Date(2020, 5, 1); // Mon June 01 2020
|
|
304
|
+
|
|
305
|
+
const { debug } = render(
|
|
306
|
+
<DateDaysGrid
|
|
307
|
+
monthStartDay={0}
|
|
308
|
+
monthNumberOfDays={30}
|
|
309
|
+
prevMonthDays={31}
|
|
310
|
+
today={todayMock}
|
|
311
|
+
selectedYear={2020}
|
|
312
|
+
selectedMonth={5}
|
|
313
|
+
/>
|
|
314
|
+
);
|
|
315
|
+
|
|
316
|
+
// debug();
|
|
317
|
+
const dayNumberComponents = screen.queryAllByTestId(
|
|
318
|
+
"date-selector-day-number-mock"
|
|
319
|
+
);
|
|
320
|
+
|
|
321
|
+
const last12Days = dayNumberComponents.slice(-12);
|
|
322
|
+
last12Days.map((Day) => {
|
|
323
|
+
expect(Day).toHaveClass("date_day_number_mock_disabled");
|
|
324
|
+
});
|
|
325
|
+
});
|
|
326
|
+
|
|
327
|
+
test("should render 2 (before) and 10 (after) disabled days before June days start and after June days are over", () => {
|
|
328
|
+
// because there only 30 days in June
|
|
329
|
+
// and there total of 6 rows x 7 columns rendered days = 42
|
|
330
|
+
// and first day of June 2022 starts on Wednesday (monthStartDay = 2)
|
|
331
|
+
const todayMock = new Date(2022, 5, 1); // Wed June 01 2022
|
|
332
|
+
|
|
333
|
+
const { debug } = render(
|
|
334
|
+
<DateDaysGrid
|
|
335
|
+
monthStartDay={2}
|
|
336
|
+
monthNumberOfDays={30}
|
|
337
|
+
prevMonthDays={31}
|
|
338
|
+
today={todayMock}
|
|
339
|
+
selectedYear={2022}
|
|
340
|
+
selectedMonth={5}
|
|
341
|
+
/>
|
|
342
|
+
);
|
|
343
|
+
|
|
344
|
+
// debug();
|
|
345
|
+
const dayNumberComponents = screen.queryAllByTestId(
|
|
346
|
+
"date-selector-day-number-mock"
|
|
347
|
+
);
|
|
348
|
+
|
|
349
|
+
const first2Days = dayNumberComponents.slice(0, 2);
|
|
350
|
+
first2Days.map((Day) => {
|
|
351
|
+
expect(Day).toHaveClass("date_day_number_mock_disabled");
|
|
352
|
+
});
|
|
353
|
+
|
|
354
|
+
const last10Days = dayNumberComponents.slice(-10);
|
|
355
|
+
last10Days.map((Day) => {
|
|
356
|
+
expect(Day).toHaveClass("date_day_number_mock_disabled");
|
|
357
|
+
});
|
|
358
|
+
|
|
359
|
+
const juneDays = dayNumberComponents.slice(2, -10);
|
|
360
|
+
expect(juneDays.length).toEqual(30);
|
|
361
|
+
juneDays.map((Day) => {
|
|
362
|
+
expect(Day).not.toHaveClass("date_day_number_mock_disabled");
|
|
363
|
+
});
|
|
364
|
+
});
|
|
365
|
+
|
|
366
|
+
test("should render 1 selected day when passed as [value] prop", () => {
|
|
367
|
+
const todayMock = new Date(2020, 5, 1); // Mon June 01 2020
|
|
368
|
+
const selectedDate = new Date(2020, 5, 5);
|
|
369
|
+
|
|
370
|
+
const { debug } = render(
|
|
371
|
+
<DateDaysGrid
|
|
372
|
+
monthStartDay={0}
|
|
373
|
+
monthNumberOfDays={30}
|
|
374
|
+
prevMonthDays={31}
|
|
375
|
+
today={todayMock}
|
|
376
|
+
selectedYear={2020}
|
|
377
|
+
selectedMonth={5}
|
|
378
|
+
value={selectedDate}
|
|
379
|
+
/>
|
|
380
|
+
);
|
|
381
|
+
|
|
382
|
+
// debug();
|
|
383
|
+
const dayNumberComponents = screen.queryAllByText("5");
|
|
384
|
+
const today = dayNumberComponents[0];
|
|
385
|
+
|
|
386
|
+
expect(today).toBeInTheDocument();
|
|
387
|
+
expect(today).toHaveClass("date_day_number_mock_selected");
|
|
388
|
+
});
|
|
389
|
+
|
|
390
|
+
test("should render 1 selected and today day when passed as [value] prop", () => {
|
|
391
|
+
const todayMock = new Date(2020, 5, 1); // Mon June 01 2020
|
|
392
|
+
const selectedDate = new Date(2020, 5, 1);
|
|
393
|
+
|
|
394
|
+
const { debug } = render(
|
|
395
|
+
<DateDaysGrid
|
|
396
|
+
monthStartDay={0}
|
|
397
|
+
monthNumberOfDays={30}
|
|
398
|
+
prevMonthDays={31}
|
|
399
|
+
today={todayMock}
|
|
400
|
+
selectedYear={2020}
|
|
401
|
+
selectedMonth={5}
|
|
402
|
+
value={selectedDate}
|
|
403
|
+
/>
|
|
404
|
+
);
|
|
405
|
+
|
|
406
|
+
// debug();
|
|
407
|
+
const dayNumberComponents = screen.queryAllByText("1");
|
|
408
|
+
const today = dayNumberComponents[0];
|
|
409
|
+
|
|
410
|
+
expect(today).toBeInTheDocument();
|
|
411
|
+
expect(today).toHaveClass("date_day_number_mock_selected");
|
|
412
|
+
expect(today).toHaveClass("date_day_number_mock_today");
|
|
413
|
+
});
|
|
414
|
+
|
|
415
|
+
test("should call onClick when clicked a normal day", () => {
|
|
416
|
+
const onClickSpy = jest.fn();
|
|
417
|
+
const todayMock = new Date(2020, 5, 1); // Mon June 01 2020
|
|
418
|
+
|
|
419
|
+
const { debug } = render(
|
|
420
|
+
<DateDaysGrid
|
|
421
|
+
monthStartDay={0}
|
|
422
|
+
monthNumberOfDays={30}
|
|
423
|
+
prevMonthDays={31}
|
|
424
|
+
today={todayMock}
|
|
425
|
+
selectedYear={2020}
|
|
426
|
+
selectedMonth={5}
|
|
427
|
+
onClickDay={onClickSpy}
|
|
428
|
+
/>
|
|
429
|
+
);
|
|
430
|
+
|
|
431
|
+
// debug();
|
|
432
|
+
const dayNumberComponents = screen.queryAllByTestId(
|
|
433
|
+
"date-selector-day-number-mock"
|
|
434
|
+
);
|
|
435
|
+
|
|
436
|
+
dayNumberComponents[4].click(); // click on 5th June
|
|
437
|
+
|
|
438
|
+
expect(onClickSpy).toHaveBeenCalledWith(new Date(2020, 5, 5));
|
|
439
|
+
});
|
|
440
|
+
|
|
441
|
+
test("should not call onClick when clicked a disabled day", () => {
|
|
442
|
+
const onClickSpy = jest.fn();
|
|
443
|
+
const todayMock = new Date(2020, 5, 1); // Mon June 01 2020
|
|
444
|
+
|
|
445
|
+
const { debug } = render(
|
|
446
|
+
<DateDaysGrid
|
|
447
|
+
monthStartDay={0}
|
|
448
|
+
monthNumberOfDays={30}
|
|
449
|
+
prevMonthDays={31}
|
|
450
|
+
today={todayMock}
|
|
451
|
+
selectedYear={2020}
|
|
452
|
+
selectedMonth={5}
|
|
453
|
+
onClickDay={onClickSpy}
|
|
454
|
+
/>
|
|
455
|
+
);
|
|
456
|
+
|
|
457
|
+
// debug();
|
|
458
|
+
const dayNumberComponents = screen.queryAllByTestId(
|
|
459
|
+
"date-selector-day-number-mock"
|
|
460
|
+
);
|
|
461
|
+
const disabledDay = dayNumberComponents[dayNumberComponents.length - 1]; // 12th JULY - should be disabled
|
|
462
|
+
|
|
463
|
+
disabledDay.click();
|
|
464
|
+
|
|
465
|
+
expect(onClickSpy).not.toHaveBeenCalled();
|
|
466
|
+
});
|
|
467
|
+
|
|
468
|
+
test("should render 3 (before) disabled days before June if min date is passed as prop", () => {
|
|
469
|
+
const todayMock = new Date(2020, 5, 1); // Mon June 01 2020
|
|
470
|
+
const minDateMock = new Date(2020, 5, 4);
|
|
471
|
+
|
|
472
|
+
const { debug } = render(
|
|
473
|
+
<DateDaysGrid
|
|
474
|
+
monthStartDay={0}
|
|
475
|
+
monthNumberOfDays={30}
|
|
476
|
+
prevMonthDays={31}
|
|
477
|
+
today={todayMock}
|
|
478
|
+
selectedYear={2020}
|
|
479
|
+
selectedMonth={5}
|
|
480
|
+
minimumDate={minDateMock}
|
|
481
|
+
/>
|
|
482
|
+
);
|
|
483
|
+
|
|
484
|
+
// debug();
|
|
485
|
+
const dayNumberComponents = screen.queryAllByTestId(
|
|
486
|
+
"date-selector-day-number-mock"
|
|
487
|
+
);
|
|
488
|
+
|
|
489
|
+
const first3Days = dayNumberComponents.slice(0, 3);
|
|
490
|
+
first3Days.map((Day) => {
|
|
491
|
+
expect(Day).toHaveClass("date_day_number_mock_disabled");
|
|
492
|
+
});
|
|
493
|
+
|
|
494
|
+
const otherJuneDays = dayNumberComponents.slice(3, 30);
|
|
495
|
+
otherJuneDays.map((Day) => {
|
|
496
|
+
expect(Day).not.toHaveClass("date_day_number_mock_disabled");
|
|
497
|
+
});
|
|
498
|
+
|
|
499
|
+
const julyDays = dayNumberComponents.slice(30);
|
|
500
|
+
julyDays.map((Day) => {
|
|
501
|
+
expect(Day).toHaveClass("date_day_number_mock_disabled");
|
|
502
|
+
});
|
|
503
|
+
});
|
|
504
|
+
|
|
505
|
+
test("should render disabled days on 10th June onwards if max date is passed as prop", () => {
|
|
506
|
+
const todayMock = new Date(2020, 5, 1); // Mon June 01 2020
|
|
507
|
+
const maxDateMock = new Date(2020, 5, 10);
|
|
508
|
+
|
|
509
|
+
const { debug } = render(
|
|
510
|
+
<DateDaysGrid
|
|
511
|
+
monthStartDay={0}
|
|
512
|
+
monthNumberOfDays={30}
|
|
513
|
+
prevMonthDays={31}
|
|
514
|
+
today={todayMock}
|
|
515
|
+
selectedYear={2020}
|
|
516
|
+
selectedMonth={5}
|
|
517
|
+
maximumDate={maxDateMock}
|
|
518
|
+
/>
|
|
519
|
+
);
|
|
520
|
+
|
|
521
|
+
// debug();
|
|
522
|
+
const dayNumberComponents = screen.queryAllByTestId(
|
|
523
|
+
"date-selector-day-number-mock"
|
|
524
|
+
);
|
|
525
|
+
|
|
526
|
+
const first9Days = dayNumberComponents.slice(0, 10);
|
|
527
|
+
first9Days.map((Day) => {
|
|
528
|
+
expect(Day).not.toHaveClass("date_day_number_mock_disabled");
|
|
529
|
+
});
|
|
530
|
+
|
|
531
|
+
const otherDays = dayNumberComponents.slice(10);
|
|
532
|
+
otherDays.map((Day) => {
|
|
533
|
+
expect(Day).toHaveClass("date_day_number_mock_disabled");
|
|
534
|
+
});
|
|
535
|
+
});
|
|
536
|
+
});
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
|
|
3
|
+
// import base interface
|
|
4
|
+
import IComponent from "@interfaces/IComponent";
|
|
5
|
+
import IThemeProps from "@interfaces/Theme";
|
|
6
|
+
|
|
7
|
+
// styles
|
|
8
|
+
import "./styles/Date-Selector-Header.layout.scss";
|
|
9
|
+
import "./styles/Date-Selector-Header.theme.scss";
|
|
10
|
+
|
|
11
|
+
// utils
|
|
12
|
+
import {
|
|
13
|
+
createComponentStyles,
|
|
14
|
+
createLayoutStyles,
|
|
15
|
+
createThemeStyles,
|
|
16
|
+
} from "@utils/styles";
|
|
17
|
+
|
|
18
|
+
import { methodHasValue } from "@utils/validations";
|
|
19
|
+
|
|
20
|
+
export interface IDateSelectorHeaderProps extends IComponent, IThemeProps {
|
|
21
|
+
text: string;
|
|
22
|
+
opened?: boolean;
|
|
23
|
+
onClick?: () => void;
|
|
24
|
+
disabled?: boolean;
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
export const DateSelectorHeader = ({
|
|
28
|
+
text,
|
|
29
|
+
opened = false,
|
|
30
|
+
onClick,
|
|
31
|
+
disabled = false,
|
|
32
|
+
rootClassName,
|
|
33
|
+
rootStyles = {},
|
|
34
|
+
theme = "light",
|
|
35
|
+
}: IDateSelectorHeaderProps) => {
|
|
36
|
+
const containerStyles = createComponentStyles(
|
|
37
|
+
createLayoutStyles(
|
|
38
|
+
{
|
|
39
|
+
date_selector_header: true,
|
|
40
|
+
date_selector_header_opened: opened,
|
|
41
|
+
},
|
|
42
|
+
rootClassName,
|
|
43
|
+
{
|
|
44
|
+
disabled,
|
|
45
|
+
no_select: true,
|
|
46
|
+
}
|
|
47
|
+
),
|
|
48
|
+
createThemeStyles(`date_selector_header_theme_`, theme)
|
|
49
|
+
);
|
|
50
|
+
|
|
51
|
+
return (
|
|
52
|
+
<button
|
|
53
|
+
data-testid="date-selector-header-root"
|
|
54
|
+
className={containerStyles}
|
|
55
|
+
onClick={() => {
|
|
56
|
+
if (!disabled && methodHasValue(onClick)) {
|
|
57
|
+
onClick();
|
|
58
|
+
}
|
|
59
|
+
}}
|
|
60
|
+
style={rootStyles}
|
|
61
|
+
>
|
|
62
|
+
<span>{text}</span>
|
|
63
|
+
</button>
|
|
64
|
+
);
|
|
65
|
+
};
|