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
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
|
|
3
|
+
// import base interface
|
|
4
|
+
import IComponent from "@interfaces/IComponent";
|
|
5
|
+
import IThemeProps from "@interfaces/Theme";
|
|
6
|
+
import { IMarginProps } from "@interfaces/ISpacingsProps";
|
|
7
|
+
|
|
8
|
+
// styles
|
|
9
|
+
import "./styles/Button.layout.scss";
|
|
10
|
+
import "./styles/Button.theme.scss";
|
|
11
|
+
|
|
12
|
+
// utils
|
|
13
|
+
import {
|
|
14
|
+
createComponentStyles,
|
|
15
|
+
createLayoutStyles,
|
|
16
|
+
createThemeStyles,
|
|
17
|
+
withSpacingsProps,
|
|
18
|
+
} from "@utils/styles";
|
|
19
|
+
|
|
20
|
+
import { methodHasValue } from "@utils/validations";
|
|
21
|
+
|
|
22
|
+
export interface IButtonProps extends IComponent, IThemeProps, IMarginProps {
|
|
23
|
+
type?: "plain" | "primary" | "link";
|
|
24
|
+
role?: "button" | "submit";
|
|
25
|
+
id?: string;
|
|
26
|
+
text: string;
|
|
27
|
+
onClick?: () => void;
|
|
28
|
+
disabled?: boolean;
|
|
29
|
+
inheritWidth?: boolean;
|
|
30
|
+
inline?: boolean;
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
export const Button = ({
|
|
34
|
+
id = null,
|
|
35
|
+
type = "plain",
|
|
36
|
+
role = "button",
|
|
37
|
+
text,
|
|
38
|
+
onClick,
|
|
39
|
+
disabled = false,
|
|
40
|
+
inheritWidth = false,
|
|
41
|
+
inline = false,
|
|
42
|
+
rootClassName,
|
|
43
|
+
rootStyles = {},
|
|
44
|
+
theme = "light",
|
|
45
|
+
...spacingsProps
|
|
46
|
+
}: IButtonProps) => {
|
|
47
|
+
const containerStyles = createComponentStyles(
|
|
48
|
+
createLayoutStyles(
|
|
49
|
+
withSpacingsProps(
|
|
50
|
+
{
|
|
51
|
+
button_container: true,
|
|
52
|
+
button_container_inheritWidth: inheritWidth,
|
|
53
|
+
button_container_inline: inline,
|
|
54
|
+
button_container_link: type === "link",
|
|
55
|
+
button_text: true,
|
|
56
|
+
},
|
|
57
|
+
spacingsProps
|
|
58
|
+
),
|
|
59
|
+
rootClassName,
|
|
60
|
+
{
|
|
61
|
+
disabled,
|
|
62
|
+
no_select: true,
|
|
63
|
+
}
|
|
64
|
+
),
|
|
65
|
+
createThemeStyles(`button_${type}_theme_`, theme)
|
|
66
|
+
);
|
|
67
|
+
|
|
68
|
+
return (
|
|
69
|
+
<button
|
|
70
|
+
id={id ? id : null}
|
|
71
|
+
data-testid="button-root"
|
|
72
|
+
className={containerStyles}
|
|
73
|
+
style={rootStyles}
|
|
74
|
+
type={role}
|
|
75
|
+
onClick={() => {
|
|
76
|
+
if (methodHasValue(onClick)) {
|
|
77
|
+
onClick();
|
|
78
|
+
}
|
|
79
|
+
}}
|
|
80
|
+
disabled={disabled}
|
|
81
|
+
>
|
|
82
|
+
{text}
|
|
83
|
+
</button>
|
|
84
|
+
);
|
|
85
|
+
};
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import { render, screen } from "@testing-library/react";
|
|
3
|
+
import { Button } from "@components/Buttons/Button";
|
|
4
|
+
|
|
5
|
+
describe("Generic Button Component Unit Tests", () => {
|
|
6
|
+
test("should render itself without error", () => {
|
|
7
|
+
const { debug } = render(<Button text="test" />);
|
|
8
|
+
|
|
9
|
+
// debug();
|
|
10
|
+
const component = screen.queryByTestId("button-root");
|
|
11
|
+
expect(component).toBeInTheDocument();
|
|
12
|
+
expect(component).toHaveTextContent("test");
|
|
13
|
+
});
|
|
14
|
+
|
|
15
|
+
test("should apply inheritWidth className when provided as prop", () => {
|
|
16
|
+
render(<Button text="test" inheritWidth />);
|
|
17
|
+
|
|
18
|
+
const component = screen.queryByTestId("button-root");
|
|
19
|
+
expect(component).toHaveClass("button_container_inheritWidth");
|
|
20
|
+
});
|
|
21
|
+
|
|
22
|
+
test("should apply inline className when provided as prop", () => {
|
|
23
|
+
render(<Button text="test" inline />);
|
|
24
|
+
|
|
25
|
+
const component = screen.queryByTestId("button-root");
|
|
26
|
+
expect(component).toHaveClass("button_container_inline");
|
|
27
|
+
});
|
|
28
|
+
|
|
29
|
+
test("should apply link className when type is link", () => {
|
|
30
|
+
render(<Button text="test" type="link" />);
|
|
31
|
+
|
|
32
|
+
const component = screen.queryByTestId("button-root");
|
|
33
|
+
expect(component).toHaveClass("button_container_link");
|
|
34
|
+
});
|
|
35
|
+
|
|
36
|
+
test("should apply disabled className when provided as prop", () => {
|
|
37
|
+
render(<Button text="test" disabled />);
|
|
38
|
+
|
|
39
|
+
const component = screen.queryByTestId("button-root");
|
|
40
|
+
expect(component).toHaveClass("component_disabled");
|
|
41
|
+
});
|
|
42
|
+
|
|
43
|
+
test("should apply custom className when provided as prop", () => {
|
|
44
|
+
render(<Button text="test" rootClassName="sample_class" />);
|
|
45
|
+
|
|
46
|
+
const component = screen.queryByTestId("button-root");
|
|
47
|
+
expect(component).toHaveClass("sample_class");
|
|
48
|
+
});
|
|
49
|
+
|
|
50
|
+
test("should apply custom styles when provided as prop", () => {
|
|
51
|
+
render(<Button text="test" rootStyles={{ border: "2px solid red" }} />);
|
|
52
|
+
|
|
53
|
+
const component = screen.queryByTestId("button-root");
|
|
54
|
+
expect(component).toHaveStyle("border: 2px solid red");
|
|
55
|
+
});
|
|
56
|
+
|
|
57
|
+
test("should execute onClick when provided as prop", () => {
|
|
58
|
+
const onClickSpy = jest.fn();
|
|
59
|
+
render(<Button text="test" onClick={onClickSpy} />);
|
|
60
|
+
|
|
61
|
+
const component = screen.queryByTestId("button-root");
|
|
62
|
+
component.click();
|
|
63
|
+
|
|
64
|
+
expect(onClickSpy).toHaveBeenCalled();
|
|
65
|
+
});
|
|
66
|
+
});
|
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import { ComponentStory, ComponentMeta } from "@storybook/react";
|
|
3
|
+
|
|
4
|
+
// always import from index to include global styles
|
|
5
|
+
import { Button } from "@components/Buttons/Button";
|
|
6
|
+
import "./storiesStyle.scss";
|
|
7
|
+
|
|
8
|
+
import dedent from "ts-dedent";
|
|
9
|
+
|
|
10
|
+
// More on default export: https://storybook.js.org/docs/react/writing-stories/introduction#default-export
|
|
11
|
+
export default {
|
|
12
|
+
title: "Buttons/Button",
|
|
13
|
+
component: Button,
|
|
14
|
+
// More on argTypes: https://storybook.js.org/docs/react/api/argtypes
|
|
15
|
+
argTypes: {
|
|
16
|
+
// backgroundColor: { control: "color" },
|
|
17
|
+
},
|
|
18
|
+
parameters: {
|
|
19
|
+
docs: {
|
|
20
|
+
description: {
|
|
21
|
+
component: dedent`
|
|
22
|
+
A generic button component.
|
|
23
|
+
|
|
24
|
+
It supports Margin props.
|
|
25
|
+
|
|
26
|
+
You can customize hover behaviour via rootClassName.
|
|
27
|
+
|
|
28
|
+
Import statement: \`import { Button } from 'reso-ui/Button'\`
|
|
29
|
+
`,
|
|
30
|
+
},
|
|
31
|
+
},
|
|
32
|
+
},
|
|
33
|
+
} as ComponentMeta<typeof Button>;
|
|
34
|
+
|
|
35
|
+
const ComponentTemplate: ComponentStory<typeof Button> = (args) => {
|
|
36
|
+
const storyProps = {
|
|
37
|
+
text: "Click",
|
|
38
|
+
onClick: () => {
|
|
39
|
+
alert("Button clicked!");
|
|
40
|
+
},
|
|
41
|
+
...args,
|
|
42
|
+
};
|
|
43
|
+
return <Button {...storyProps} />;
|
|
44
|
+
};
|
|
45
|
+
|
|
46
|
+
export const Default = ComponentTemplate.bind({});
|
|
47
|
+
Default.args = {};
|
|
48
|
+
|
|
49
|
+
export const DefaultPrimary = ComponentTemplate.bind({});
|
|
50
|
+
DefaultPrimary.args = {
|
|
51
|
+
type: "primary",
|
|
52
|
+
};
|
|
53
|
+
|
|
54
|
+
export const DefaultLink = ComponentTemplate.bind({});
|
|
55
|
+
DefaultLink.args = {
|
|
56
|
+
type: "link",
|
|
57
|
+
};
|
|
58
|
+
|
|
59
|
+
export const Disabled = ComponentTemplate.bind({});
|
|
60
|
+
Disabled.args = {
|
|
61
|
+
disabled: true,
|
|
62
|
+
};
|
|
63
|
+
|
|
64
|
+
export const WithCustomStyle = ComponentTemplate.bind({});
|
|
65
|
+
WithCustomStyle.args = {
|
|
66
|
+
rootStyles: {
|
|
67
|
+
borderColor: "green",
|
|
68
|
+
borderWidth: "4px",
|
|
69
|
+
},
|
|
70
|
+
};
|
|
71
|
+
|
|
72
|
+
export const WithCustomClass = ComponentTemplate.bind({});
|
|
73
|
+
WithCustomClass.args = {
|
|
74
|
+
rootClassName: "button_generic_custom_class",
|
|
75
|
+
};
|
|
76
|
+
|
|
77
|
+
export const UseParentComponentWidth = () => {
|
|
78
|
+
return (
|
|
79
|
+
<div
|
|
80
|
+
style={{
|
|
81
|
+
width: "320px",
|
|
82
|
+
height: "120px",
|
|
83
|
+
border: "2px solid blue",
|
|
84
|
+
padding: "10px",
|
|
85
|
+
}}
|
|
86
|
+
>
|
|
87
|
+
<Button text="Click" inheritWidth />
|
|
88
|
+
</div>
|
|
89
|
+
);
|
|
90
|
+
};
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
.button_container {
|
|
2
|
+
display: block;
|
|
3
|
+
width: 120px;
|
|
4
|
+
height: 48px;
|
|
5
|
+
border-width: 1px;
|
|
6
|
+
border-style: solid;
|
|
7
|
+
border-radius: $border-radius-default;
|
|
8
|
+
transition: background-color ease 0.1s;
|
|
9
|
+
cursor: pointer;
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
.button_container_inheritWidth {
|
|
13
|
+
width: 100%;
|
|
14
|
+
min-width: inherit;
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
.button_container_inline {
|
|
18
|
+
display: inline-block;
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
.button_container_link {
|
|
22
|
+
// border: 2px solid red;
|
|
23
|
+
border: none;
|
|
24
|
+
padding: $padding-xxsmall;
|
|
25
|
+
width: fit-content;
|
|
26
|
+
height: initial;
|
|
27
|
+
&:hover {
|
|
28
|
+
text-decoration: underline;
|
|
29
|
+
}
|
|
30
|
+
}
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
///////////////////////////////
|
|
2
|
+
// for type Plain
|
|
3
|
+
///////////////////////////////
|
|
4
|
+
.button_plain_theme_light {
|
|
5
|
+
@include use_theme($primary-grey-light, "light");
|
|
6
|
+
border-color: $primary-grey-medium;
|
|
7
|
+
&:hover {
|
|
8
|
+
background: $primary-grey-dark;
|
|
9
|
+
color: $fc-light;
|
|
10
|
+
}
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
.button_plain_theme_dark {
|
|
14
|
+
@include use_theme($primary-grey-dark, "dark");
|
|
15
|
+
border-color: $primary-grey-medium;
|
|
16
|
+
&:hover {
|
|
17
|
+
background: $primary-grey-medium-light;
|
|
18
|
+
color: $fc-dark;
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
///////////////////////////////
|
|
23
|
+
// for type Primary
|
|
24
|
+
///////////////////////////////
|
|
25
|
+
.button_primary_theme_light {
|
|
26
|
+
@include use_theme($bg-button-primary, "dark");
|
|
27
|
+
border: none;
|
|
28
|
+
opacity: 0.9;
|
|
29
|
+
&:hover {
|
|
30
|
+
// background: $bg-button-primary;
|
|
31
|
+
// color: $fc-light;
|
|
32
|
+
opacity: 1;
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
///////////////////////////////
|
|
37
|
+
// for type Link
|
|
38
|
+
///////////////////////////////
|
|
39
|
+
.button_link_theme_light {
|
|
40
|
+
@include use_theme(unset, "light");
|
|
41
|
+
color: $lc-blue;
|
|
42
|
+
}
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
|
|
3
|
+
// import base interface
|
|
4
|
+
import IComponent from "@interfaces/IComponent";
|
|
5
|
+
import IThemeProps from "@interfaces/Theme";
|
|
6
|
+
import ISpacingsProps, { IMarginProps } from "@interfaces/ISpacingsProps";
|
|
7
|
+
|
|
8
|
+
// styles
|
|
9
|
+
import "./styles/Card-Container.layout.scss";
|
|
10
|
+
import "./styles/Card-Container.theme.scss";
|
|
11
|
+
|
|
12
|
+
// utils
|
|
13
|
+
import {
|
|
14
|
+
createComponentStyles,
|
|
15
|
+
createLayoutStyles,
|
|
16
|
+
createThemeStyles,
|
|
17
|
+
withSpacingsProps,
|
|
18
|
+
} from "@utils/styles";
|
|
19
|
+
|
|
20
|
+
export interface ICardContainerProps
|
|
21
|
+
extends IComponent,
|
|
22
|
+
IThemeProps,
|
|
23
|
+
ISpacingsProps {
|
|
24
|
+
children: React.ReactNode;
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
export const Card = ({
|
|
28
|
+
children,
|
|
29
|
+
rootClassName,
|
|
30
|
+
rootStyles = {},
|
|
31
|
+
theme = "light",
|
|
32
|
+
...spacingsProps
|
|
33
|
+
}: ICardContainerProps) => {
|
|
34
|
+
const containerStyles = createComponentStyles(
|
|
35
|
+
createLayoutStyles(
|
|
36
|
+
withSpacingsProps(
|
|
37
|
+
{
|
|
38
|
+
card_container: true,
|
|
39
|
+
},
|
|
40
|
+
spacingsProps
|
|
41
|
+
),
|
|
42
|
+
rootClassName,
|
|
43
|
+
{
|
|
44
|
+
no_select: true,
|
|
45
|
+
}
|
|
46
|
+
),
|
|
47
|
+
createThemeStyles("card_container_theme_", theme)
|
|
48
|
+
);
|
|
49
|
+
|
|
50
|
+
return (
|
|
51
|
+
<div
|
|
52
|
+
className={containerStyles}
|
|
53
|
+
style={rootStyles}
|
|
54
|
+
data-testid="card-container-root"
|
|
55
|
+
>
|
|
56
|
+
{children}
|
|
57
|
+
</div>
|
|
58
|
+
);
|
|
59
|
+
};
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import { render, screen } from "@testing-library/react";
|
|
3
|
+
import { Card } from "@components/Card/";
|
|
4
|
+
|
|
5
|
+
const SampleComponent = () => {
|
|
6
|
+
return (
|
|
7
|
+
<div data-testid="card-container-child-test">
|
|
8
|
+
<p>This is a sample component</p>
|
|
9
|
+
</div>
|
|
10
|
+
);
|
|
11
|
+
};
|
|
12
|
+
|
|
13
|
+
describe("Card Container Component Unit Tests", () => {
|
|
14
|
+
test("should render itself and children without error", () => {
|
|
15
|
+
const { debug } = render(
|
|
16
|
+
<Card>
|
|
17
|
+
<SampleComponent />
|
|
18
|
+
</Card>
|
|
19
|
+
);
|
|
20
|
+
|
|
21
|
+
// debug();
|
|
22
|
+
const component = screen.queryByTestId("card-container-root");
|
|
23
|
+
expect(component).toBeInTheDocument();
|
|
24
|
+
expect(component).toHaveClass("card_container");
|
|
25
|
+
|
|
26
|
+
const child = screen.queryByTestId("card-container-child-test");
|
|
27
|
+
expect(child).toBeInTheDocument();
|
|
28
|
+
});
|
|
29
|
+
|
|
30
|
+
test("should have custom rootClassName when passed as prop", () => {
|
|
31
|
+
render(
|
|
32
|
+
<Card rootClassName="test_custom_className">
|
|
33
|
+
<SampleComponent />
|
|
34
|
+
</Card>
|
|
35
|
+
);
|
|
36
|
+
|
|
37
|
+
const component = screen.queryByTestId("card-container-root");
|
|
38
|
+
expect(component).toHaveClass("test_custom_className");
|
|
39
|
+
});
|
|
40
|
+
|
|
41
|
+
test("should have custom rootStyles when passed as prop", () => {
|
|
42
|
+
render(
|
|
43
|
+
<Card rootStyles={{ border: "2px solid red" }}>
|
|
44
|
+
<SampleComponent />
|
|
45
|
+
</Card>
|
|
46
|
+
);
|
|
47
|
+
|
|
48
|
+
const component = screen.queryByTestId("card-container-root");
|
|
49
|
+
expect(component).toHaveStyle("border: 2px solid red");
|
|
50
|
+
});
|
|
51
|
+
|
|
52
|
+
test("should apply padding class when passed as prop", () => {
|
|
53
|
+
render(
|
|
54
|
+
<Card pa={5}>
|
|
55
|
+
<SampleComponent />
|
|
56
|
+
</Card>
|
|
57
|
+
);
|
|
58
|
+
|
|
59
|
+
const component = screen.queryByTestId("card-container-root");
|
|
60
|
+
expect(component).toHaveClass("spacing-pa-5");
|
|
61
|
+
});
|
|
62
|
+
});
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import { ComponentStory, ComponentMeta } from "@storybook/react";
|
|
3
|
+
|
|
4
|
+
// always import from index to include global styles
|
|
5
|
+
import { Card } from "@components/Card";
|
|
6
|
+
|
|
7
|
+
import dedent from "ts-dedent";
|
|
8
|
+
|
|
9
|
+
// More on default export: https://storybook.js.org/docs/react/writing-stories/introduction#default-export
|
|
10
|
+
export default {
|
|
11
|
+
title: "Card/Container",
|
|
12
|
+
component: Card,
|
|
13
|
+
// More on argTypes: https://storybook.js.org/docs/react/api/argtypes
|
|
14
|
+
argTypes: {
|
|
15
|
+
// backgroundColor: { control: "color" },
|
|
16
|
+
},
|
|
17
|
+
parameters: {
|
|
18
|
+
docs: {
|
|
19
|
+
description: {
|
|
20
|
+
component: dedent`
|
|
21
|
+
A container component with customised look and feel.
|
|
22
|
+
|
|
23
|
+
It supports both Margin and Padding props.
|
|
24
|
+
`,
|
|
25
|
+
},
|
|
26
|
+
},
|
|
27
|
+
},
|
|
28
|
+
} as ComponentMeta<typeof Card>;
|
|
29
|
+
|
|
30
|
+
const ComponentTemplate: ComponentStory<typeof Card> = (args) => (
|
|
31
|
+
<Card pa={5} {...args}>
|
|
32
|
+
Sample
|
|
33
|
+
</Card>
|
|
34
|
+
);
|
|
35
|
+
|
|
36
|
+
export const Default = ComponentTemplate.bind({});
|
|
37
|
+
Default.args = {};
|
|
38
|
+
|
|
39
|
+
export const WithCustomStyle = ComponentTemplate.bind({});
|
|
40
|
+
WithCustomStyle.args = {
|
|
41
|
+
rootStyles: {
|
|
42
|
+
background: "green",
|
|
43
|
+
color: "white",
|
|
44
|
+
},
|
|
45
|
+
};
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
|
|
3
|
+
// import base interface
|
|
4
|
+
import IComponent from "@interfaces/IComponent";
|
|
5
|
+
import ISpacingsProps from "@interfaces/ISpacingsProps";
|
|
6
|
+
|
|
7
|
+
// styles
|
|
8
|
+
import "./styles/Card-Content.layout.scss";
|
|
9
|
+
|
|
10
|
+
// utils
|
|
11
|
+
import {
|
|
12
|
+
createComponentStyles,
|
|
13
|
+
createLayoutStyles,
|
|
14
|
+
withSpacingsProps,
|
|
15
|
+
} from "@utils/styles";
|
|
16
|
+
|
|
17
|
+
export interface ICardContentProps extends IComponent, ISpacingsProps {
|
|
18
|
+
children: React.ReactNode;
|
|
19
|
+
wrap?: boolean;
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
export const CardContent = ({
|
|
23
|
+
children,
|
|
24
|
+
wrap = true,
|
|
25
|
+
rootClassName,
|
|
26
|
+
rootStyles = {},
|
|
27
|
+
...spacingProps
|
|
28
|
+
}: ICardContentProps) => {
|
|
29
|
+
const containerStyles = createComponentStyles(
|
|
30
|
+
createLayoutStyles(
|
|
31
|
+
withSpacingsProps(
|
|
32
|
+
{
|
|
33
|
+
card_content_container: true,
|
|
34
|
+
card_content_container_wrap: wrap,
|
|
35
|
+
},
|
|
36
|
+
spacingProps
|
|
37
|
+
),
|
|
38
|
+
rootClassName
|
|
39
|
+
)
|
|
40
|
+
);
|
|
41
|
+
|
|
42
|
+
return (
|
|
43
|
+
<div
|
|
44
|
+
className={containerStyles}
|
|
45
|
+
style={rootStyles}
|
|
46
|
+
data-testid="card-content-root"
|
|
47
|
+
>
|
|
48
|
+
{children}
|
|
49
|
+
</div>
|
|
50
|
+
);
|
|
51
|
+
};
|
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import { render, screen } from "@testing-library/react";
|
|
3
|
+
import { CardContent } from "@components/Card/Card-Content";
|
|
4
|
+
|
|
5
|
+
const SampleComponent = () => {
|
|
6
|
+
return (
|
|
7
|
+
<div data-testid="card-content-child-test">
|
|
8
|
+
<p>This is a sample component</p>
|
|
9
|
+
</div>
|
|
10
|
+
);
|
|
11
|
+
};
|
|
12
|
+
|
|
13
|
+
describe("Card Content Component Unit Tests", () => {
|
|
14
|
+
test("should render itself and children without error", () => {
|
|
15
|
+
const { debug } = render(
|
|
16
|
+
<CardContent>
|
|
17
|
+
<SampleComponent />
|
|
18
|
+
</CardContent>
|
|
19
|
+
);
|
|
20
|
+
|
|
21
|
+
// debug();
|
|
22
|
+
const component = screen.queryByTestId("card-content-root");
|
|
23
|
+
expect(component).toBeInTheDocument();
|
|
24
|
+
expect(component).toHaveClass("card_content_container");
|
|
25
|
+
|
|
26
|
+
const child = screen.queryByTestId("card-content-child-test");
|
|
27
|
+
expect(child).toBeInTheDocument();
|
|
28
|
+
});
|
|
29
|
+
|
|
30
|
+
test("should apply wrap class by default", () => {
|
|
31
|
+
render(
|
|
32
|
+
<CardContent pa={5}>
|
|
33
|
+
<SampleComponent />
|
|
34
|
+
</CardContent>
|
|
35
|
+
);
|
|
36
|
+
|
|
37
|
+
const component = screen.queryByTestId("card-content-root");
|
|
38
|
+
expect(component).toHaveClass("card_content_container_wrap");
|
|
39
|
+
});
|
|
40
|
+
|
|
41
|
+
test("should not apply wrap class when passed as prop", () => {
|
|
42
|
+
render(
|
|
43
|
+
<CardContent pa={5} wrap={false}>
|
|
44
|
+
<SampleComponent />
|
|
45
|
+
</CardContent>
|
|
46
|
+
);
|
|
47
|
+
|
|
48
|
+
const component = screen.queryByTestId("card-content-root");
|
|
49
|
+
expect(component).not.toHaveClass("card_content_container_wrap");
|
|
50
|
+
});
|
|
51
|
+
|
|
52
|
+
test("should have custom rootClassName when passed as prop", () => {
|
|
53
|
+
render(
|
|
54
|
+
<CardContent rootClassName="test_custom_className">
|
|
55
|
+
<SampleComponent />
|
|
56
|
+
</CardContent>
|
|
57
|
+
);
|
|
58
|
+
|
|
59
|
+
const component = screen.queryByTestId("card-content-root");
|
|
60
|
+
expect(component).toHaveClass("test_custom_className");
|
|
61
|
+
});
|
|
62
|
+
|
|
63
|
+
test("should have custom rootStyles when passed as prop", () => {
|
|
64
|
+
render(
|
|
65
|
+
<CardContent rootStyles={{ border: "2px solid red" }}>
|
|
66
|
+
<SampleComponent />
|
|
67
|
+
</CardContent>
|
|
68
|
+
);
|
|
69
|
+
|
|
70
|
+
const component = screen.queryByTestId("card-content-root");
|
|
71
|
+
expect(component).toHaveStyle("border: 2px solid red");
|
|
72
|
+
});
|
|
73
|
+
|
|
74
|
+
test("should apply padding class when passed as prop", () => {
|
|
75
|
+
render(
|
|
76
|
+
<CardContent pa={5}>
|
|
77
|
+
<SampleComponent />
|
|
78
|
+
</CardContent>
|
|
79
|
+
);
|
|
80
|
+
|
|
81
|
+
const component = screen.queryByTestId("card-content-root");
|
|
82
|
+
expect(component).toHaveClass("spacing-pa-5");
|
|
83
|
+
});
|
|
84
|
+
});
|