@cruk/cruk-react-components 5.0.7 → 6.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +20 -7
- package/lib/.storybook/main.d.ts +3 -0
- package/lib/.storybook/preview.d.ts +3 -0
- package/lib/node_modules/@babel/runtime/helpers/esm/objectWithoutPropertiesLoose.js +1 -1
- package/lib/node_modules/@babel/runtime/helpers/esm/objectWithoutPropertiesLoose.js.map +1 -1
- package/lib/node_modules/@babel/runtime/helpers/esm/toPrimitive.js +1 -1
- package/lib/node_modules/@babel/runtime/helpers/esm/toPrimitive.js.map +1 -1
- package/lib/node_modules/@fortawesome/free-solid-svg-icons/index.js +6 -1
- package/lib/node_modules/@fortawesome/free-solid-svg-icons/index.js.map +1 -1
- package/lib/node_modules/focus-lock/dist/es2015/focusInside.js.map +1 -1
- package/lib/node_modules/focus-lock/dist/es2015/focusIsHidden.js.map +1 -1
- package/lib/node_modules/focus-lock/dist/es2015/focusSolver.js +1 -1
- package/lib/node_modules/focus-lock/dist/es2015/moveFocusInside.js.map +1 -1
- package/lib/node_modules/focus-lock/dist/es2015/return-focus.js.map +1 -1
- package/lib/node_modules/focus-lock/dist/es2015/sibling.js +1 -1
- package/lib/node_modules/focus-lock/dist/es2015/sibling.js.map +1 -1
- package/lib/node_modules/focus-lock/dist/es2015/solver.js +1 -1
- package/lib/node_modules/focus-lock/dist/es2015/solver.js.map +1 -1
- package/lib/node_modules/focus-lock/dist/es2015/utils/DOMutils.js.map +1 -1
- package/lib/node_modules/focus-lock/dist/es2015/utils/all-affected.js +1 -1
- package/lib/node_modules/focus-lock/dist/es2015/utils/auto-focus.js.map +1 -1
- package/lib/node_modules/focus-lock/dist/es2015/utils/getActiveElement.js.map +1 -1
- package/lib/node_modules/focus-lock/dist/es2015/utils/is.js.map +1 -1
- package/lib/node_modules/focus-lock/dist/es2015/utils/parenting.js.map +1 -1
- package/lib/node_modules/focus-lock/dist/es2015/utils/tabOrder.js.map +1 -1
- package/lib/node_modules/focus-lock/dist/es2015/utils/tabUtils.js.map +1 -1
- package/lib/node_modules/react-focus-lock/dist/es2015/Combination.js +1 -1
- package/lib/node_modules/react-focus-lock/dist/es2015/Combination.js.map +1 -1
- package/lib/node_modules/react-focus-lock/dist/es2015/FocusGuard.js.map +1 -1
- package/lib/node_modules/react-focus-lock/dist/es2015/Lock.js +1 -1
- package/lib/node_modules/react-focus-lock/dist/es2015/Lock.js.map +1 -1
- package/lib/node_modules/react-focus-lock/dist/es2015/Trap.js +1 -1
- package/lib/node_modules/react-focus-lock/dist/es2015/Trap.js.map +1 -1
- package/lib/node_modules/react-intersection-observer/dist/index.js.map +1 -1
- package/lib/node_modules/tslib/tslib.es6.js +1 -1
- package/lib/node_modules/tslib/tslib.es6.js.map +1 -1
- package/lib/node_modules/use-sidecar/dist/es2015/medium.js.map +1 -1
- package/lib/{components → src/components}/AddressLookup/AddressLookup.stories.d.ts +4 -4
- package/lib/{components → src/components}/AddressLookup/index.d.ts +2 -2
- package/lib/src/components/AddressLookup/index.js +1 -1
- package/lib/src/components/AddressLookup/index.js.map +1 -1
- package/lib/src/components/AddressLookup/styles.js +38 -1
- package/lib/src/components/AddressLookup/styles.js.map +1 -1
- package/lib/{components → src/components}/Avatar/Avatar.stories.d.ts +1 -1
- package/lib/src/components/Avatar/index.js +1 -1
- package/lib/src/components/Avatar/index.js.map +1 -1
- package/lib/src/components/Avatar/styles.js +10 -1
- package/lib/src/components/Avatar/styles.js.map +1 -1
- package/lib/{components → src/components}/Badge/Badge.stories.d.ts +1 -1
- package/lib/src/components/Badge/index.js +1 -1
- package/lib/src/components/Badge/index.js.map +1 -1
- package/lib/src/components/Badge/styles.js +17 -1
- package/lib/src/components/Badge/styles.js.map +1 -1
- package/lib/{components → src/components}/Box/Box.stories.d.ts +2 -2
- package/lib/{components → src/components}/Box/index.d.ts +1 -1
- package/lib/src/components/Box/index.js +1 -1
- package/lib/src/components/Box/index.js.map +1 -1
- package/lib/src/components/Box/styles.js +13 -1
- package/lib/src/components/Box/styles.js.map +1 -1
- package/lib/{components → src/components}/Button/Button.stories.d.ts +2 -2
- package/lib/{components → src/components}/Button/index.d.ts +1 -1
- package/lib/src/components/Button/index.js +1 -1
- package/lib/src/components/Button/index.js.map +1 -1
- package/lib/src/components/Button/styles.js +108 -1
- package/lib/src/components/Button/styles.js.map +1 -1
- package/lib/{components → src/components}/Carousel/Carousel.stories.d.ts +2 -2
- package/lib/src/components/Carousel/Dots.js +1 -1
- package/lib/src/components/Carousel/Dots.js.map +1 -1
- package/lib/src/components/Carousel/index.js +1 -1
- package/lib/src/components/Carousel/index.js.map +1 -1
- package/lib/src/components/Carousel/styles.js +96 -1
- package/lib/src/components/Carousel/styles.js.map +1 -1
- package/lib/{components → src/components}/Checkbox/Checkbox.stories.d.ts +3 -3
- package/lib/{components → src/components}/Checkbox/index.d.ts +3 -3
- package/lib/src/components/Checkbox/index.js +1 -1
- package/lib/src/components/Checkbox/index.js.map +1 -1
- package/lib/src/components/Checkbox/styles.js +105 -1
- package/lib/src/components/Checkbox/styles.js.map +1 -1
- package/lib/{components → src/components}/Collapse/Collapse.stories.d.ts +1 -1
- package/lib/src/components/Collapse/index.js +1 -1
- package/lib/src/components/Collapse/index.js.map +1 -1
- package/lib/{components → src/components}/Collapse/styles.d.ts +11 -3
- package/lib/src/components/Collapse/styles.js +31 -1
- package/lib/src/components/Collapse/styles.js.map +1 -1
- package/lib/{components → src/components}/DateField/DateField.stories.d.ts +1 -1
- package/lib/src/components/DateField/index.js +1 -1
- package/lib/src/components/DateField/index.js.map +1 -1
- package/lib/{components → src/components}/DateField/styles.d.ts +12 -6
- package/lib/src/components/DateField/styles.js +26 -1
- package/lib/src/components/DateField/styles.js.map +1 -1
- package/lib/src/components/Divider.js +17 -1
- package/lib/src/components/Divider.js.map +1 -1
- package/lib/{components → src/components}/ErrorText/ErrorText.stories.d.ts +1 -1
- package/lib/src/components/ErrorText/index.js +1 -1
- package/lib/src/components/ErrorText/index.js.map +1 -1
- package/lib/src/components/ErrorText/styles.d.ts +16 -0
- package/lib/src/components/ErrorText/styles.js +5 -1
- package/lib/src/components/ErrorText/styles.js.map +1 -1
- package/lib/src/components/Flex.js +7 -1
- package/lib/src/components/Flex.js.map +1 -1
- package/lib/src/components/Fontface.js +1 -1
- package/lib/src/components/Fontface.js.map +1 -1
- package/lib/{components → src/components}/Footer/Footer.stories.d.ts +2 -2
- package/lib/src/components/Footer/index.js +1 -1
- package/lib/src/components/Footer/index.js.map +1 -1
- package/lib/{components → src/components}/Footer/styles.d.ts +3 -9
- package/lib/src/components/Footer/styles.js +69 -1
- package/lib/src/components/Footer/styles.js.map +1 -1
- package/lib/src/components/GlobalStyle.d.ts +2 -0
- package/lib/src/components/GlobalStyle.js +37 -1
- package/lib/src/components/GlobalStyle.js.map +1 -1
- package/lib/src/components/GlobalStyleNoFontFace.d.ts +2 -0
- package/lib/src/components/GlobalStyleNoFontFace.js +37 -1
- package/lib/src/components/GlobalStyleNoFontFace.js.map +1 -1
- package/lib/{components → src/components}/Header/Header.stories.d.ts +1 -1
- package/lib/src/components/Header/index.js +1 -1
- package/lib/src/components/Header/index.js.map +1 -1
- package/lib/src/components/Header/styles.js +109 -1
- package/lib/src/components/Header/styles.js.map +1 -1
- package/lib/{components → src/components}/Heading/Heading.stories.d.ts +1 -1
- package/lib/src/components/Heading/index.js +1 -1
- package/lib/src/components/Heading/index.js.map +1 -1
- package/lib/src/components/Heading/styles.js +75 -1
- package/lib/src/components/Heading/styles.js.map +1 -1
- package/lib/{components → src/components}/IconFa/IconFa.stories.d.ts +1 -1
- package/lib/src/components/IconFa/index.js +1 -1
- package/lib/src/components/IconFa/index.js.map +1 -1
- package/lib/src/components/IconFa/styles.js +10 -1
- package/lib/src/components/IconFa/styles.js.map +1 -1
- package/lib/{components → src/components}/InfoBox/InfoBox.stories.d.ts +2 -2
- package/lib/{components → src/components}/InfoBox/index.d.ts +1 -1
- package/lib/src/components/InfoBox/index.js +1 -1
- package/lib/src/components/InfoBox/index.js.map +1 -1
- package/lib/src/components/InfoBox/styles.d.ts +13 -0
- package/lib/src/components/InfoBox/styles.js +12 -1
- package/lib/src/components/InfoBox/styles.js.map +1 -1
- package/lib/src/components/LabelWrapper/index.js +1 -1
- package/lib/src/components/LabelWrapper/index.js.map +1 -1
- package/lib/src/components/LabelWrapper/styles.js +15 -1
- package/lib/src/components/LabelWrapper/styles.js.map +1 -1
- package/lib/{components → src/components}/LegendWrapper/LegendWrapper.stories.d.ts +1 -1
- package/lib/src/components/LegendWrapper/index.js +1 -1
- package/lib/src/components/LegendWrapper/index.js.map +1 -1
- package/lib/src/components/LegendWrapper/styles.js +34 -1
- package/lib/src/components/LegendWrapper/styles.js.map +1 -1
- package/lib/{components → src/components}/Link/Link.stories.d.ts +5 -2
- package/lib/{components → src/components}/Link/index.d.ts +4 -1
- package/lib/src/components/Link/index.js +1 -1
- package/lib/src/components/Link/index.js.map +1 -1
- package/lib/src/components/Link/styles.d.ts +20 -0
- package/lib/src/components/Link/styles.js +29 -1
- package/lib/src/components/Link/styles.js.map +1 -1
- package/lib/{components → src/components}/Loader/Loader.stories.d.ts +1 -1
- package/lib/src/components/Loader/index.js +1 -1
- package/lib/src/components/Loader/index.js.map +1 -1
- package/lib/src/components/Loader/styles.js +45 -1
- package/lib/src/components/Loader/styles.js.map +1 -1
- package/lib/{components → src/components}/Modal/Modal.stories.d.ts +1 -1
- package/lib/src/components/Modal/index.js +1 -1
- package/lib/src/components/Modal/index.js.map +1 -1
- package/lib/src/components/Modal/styles.d.ts +32 -0
- package/lib/src/components/Modal/styles.js +59 -1
- package/lib/src/components/Modal/styles.js.map +1 -1
- package/lib/{components → src/components}/Pagination/Pagination.stories.d.ts +1 -1
- package/lib/src/components/Pagination/index.js +1 -1
- package/lib/src/components/Pagination/index.js.map +1 -1
- package/lib/src/components/Pagination/styles.js +92 -1
- package/lib/src/components/Pagination/styles.js.map +1 -1
- package/lib/{components → src/components}/PopOver/Popover.stories.d.ts +1 -1
- package/lib/src/components/PopOver/index.js +1 -1
- package/lib/src/components/PopOver/index.js.map +1 -1
- package/lib/src/components/PopOver/styles.js +81 -1
- package/lib/src/components/PopOver/styles.js.map +1 -1
- package/lib/{components → src/components}/ProgressBar/ProgressBar.stories.d.ts +1 -1
- package/lib/src/components/ProgressBar/index.js +1 -1
- package/lib/src/components/ProgressBar/index.js.map +1 -1
- package/lib/src/components/ProgressBar/styles.js +132 -1
- package/lib/src/components/ProgressBar/styles.js.map +1 -1
- package/lib/{components → src/components}/Radio/Radio.stories.d.ts +3 -3
- package/lib/{components → src/components}/Radio/index.d.ts +3 -3
- package/lib/src/components/Radio/index.js +1 -1
- package/lib/src/components/Radio/index.js.map +1 -1
- package/lib/src/components/Radio/styles.js +125 -1
- package/lib/src/components/Radio/styles.js.map +1 -1
- package/lib/{components → src/components}/RadioConsent/Radio.stories.d.ts +1 -1
- package/lib/src/components/RadioConsent/index.js +1 -1
- package/lib/src/components/RadioConsent/index.js.map +1 -1
- package/lib/{components → src/components}/RadioConsent/styles.d.ts +6 -3
- package/lib/src/components/RadioConsent/styles.js +26 -1
- package/lib/src/components/RadioConsent/styles.js.map +1 -1
- package/lib/{components → src/components}/Select/Selelct.stories.d.ts +3 -3
- package/lib/{components → src/components}/Select/index.d.ts +3 -3
- package/lib/src/components/Select/index.js +1 -1
- package/lib/src/components/Select/index.js.map +1 -1
- package/lib/src/components/Select/styles.js +41 -1
- package/lib/src/components/Select/styles.js.map +1 -1
- package/lib/src/components/Spacing/index.js +1 -1
- package/lib/src/components/Spacing/index.js.map +1 -1
- package/lib/{components → src/components}/Step/Step.stories.d.ts +1 -1
- package/lib/src/components/Step/index.js +1 -1
- package/lib/src/components/Step/index.js.map +1 -1
- package/lib/src/components/Step/styles.js +79 -1
- package/lib/src/components/Step/styles.js.map +1 -1
- package/lib/{components → src/components}/Text/Text.stories.d.ts +2 -2
- package/lib/{components → src/components}/Text/index.d.ts +1 -1
- package/lib/src/components/Text/index.js +1 -1
- package/lib/src/components/Text/index.js.map +1 -1
- package/lib/src/components/Text/styles.js +19 -1
- package/lib/src/components/Text/styles.js.map +1 -1
- package/lib/{components → src/components}/TextAreaField/TextAreaField.stories.d.ts +2 -2
- package/lib/{components → src/components}/TextAreaField/index.d.ts +1 -1
- package/lib/src/components/TextAreaField/index.js +1 -1
- package/lib/src/components/TextAreaField/index.js.map +1 -1
- package/lib/src/components/TextAreaField/styles.js +29 -1
- package/lib/src/components/TextAreaField/styles.js.map +1 -1
- package/lib/{components → src/components}/TextField/TextField.stories.d.ts +2 -2
- package/lib/{components → src/components}/TextField/index.d.ts +1 -1
- package/lib/src/components/TextField/index.js +1 -1
- package/lib/src/components/TextField/index.js.map +1 -1
- package/lib/{components → src/components}/TextField/styles.d.ts +2 -6
- package/lib/src/components/TextField/styles.js +110 -1
- package/lib/src/components/TextField/styles.js.map +1 -1
- package/lib/src/components/ThemeCheatSheet.d.ts +7 -0
- package/lib/{components → src/components}/Totaliser/Totaliser.stories.d.ts +1 -1
- package/lib/src/components/Totaliser/index.js +1 -1
- package/lib/src/components/Totaliser/index.js.map +1 -1
- package/lib/src/components/Totaliser/styles.js +59 -1
- package/lib/src/components/Totaliser/styles.js.map +1 -1
- package/lib/{components → src/components}/UserBlock/UserBlock.stories.d.ts +1 -1
- package/lib/src/components/UserBlock/index.js +1 -1
- package/lib/src/components/UserBlock/index.js.map +1 -1
- package/lib/src/components/UserBlock/styles.js +21 -1
- package/lib/src/components/UserBlock/styles.js.map +1 -1
- package/lib/{hooks → src/hooks}/useEffectBrowser.d.ts +1 -1
- package/lib/src/hooks/useEffectBrowser.js +1 -1
- package/lib/src/hooks/useEffectBrowser.js.map +1 -1
- package/lib/src/hooks/useKey.js +1 -1
- package/lib/src/hooks/useKey.js.map +1 -1
- package/lib/{hooks → src/hooks}/useLayoutEffectBrowser.d.ts +1 -1
- package/lib/src/hooks/useLayoutEffectBrowser.js +1 -1
- package/lib/src/hooks/useLayoutEffectBrowser.js.map +1 -1
- package/lib/{hooks → src/hooks}/useScrollPosition.d.ts +2 -2
- package/lib/src/hooks/useScrollPosition.js +1 -1
- package/lib/src/hooks/useScrollPosition.js.map +1 -1
- package/lib/src/themes/bowelbabe.js +1 -1
- package/lib/src/themes/bowelbabe.js.map +1 -1
- package/lib/src/themes/cruk.js +1 -1
- package/lib/src/themes/cruk.js.map +1 -1
- package/lib/src/themes/rfl.js +1 -1
- package/lib/src/themes/rfl.js.map +1 -1
- package/lib/src/themes/su2c.js +1 -1
- package/lib/src/themes/su2c.js.map +1 -1
- package/lib/{types.d.ts → src/types.d.ts} +1 -3
- package/lib/src/utils/Helper.js +1 -1
- package/lib/src/utils/Helper.js.map +1 -1
- package/lib/src/utils/debounce.d.ts +2 -0
- package/lib/src/utils/debounce.js +1 -1
- package/lib/src/utils/debounce.js.map +1 -1
- package/lib/src/utils/themeUtils.js +1 -1
- package/lib/src/utils/themeUtils.js.map +1 -1
- package/package.json +37 -44
- package/lib/components/ErrorText/styles.d.ts +0 -8
- package/lib/components/GlobalStyle.d.ts +0 -2
- package/lib/components/GlobalStyleNoFontFace.d.ts +0 -2
- package/lib/components/InfoBox/styles.d.ts +0 -10
- package/lib/components/Link/styles.d.ts +0 -12
- package/lib/components/Modal/styles.d.ts +0 -21
- package/lib/components/ThemeCheatSheet.d.ts +0 -7
- package/lib/utils/debounce.d.ts +0 -2
- /package/lib/{components → src/components}/AddressLookup/AddressLookUp.test.cypress.d.ts +0 -0
- /package/lib/{components → src/components}/AddressLookup/styles.d.ts +0 -0
- /package/lib/{components → src/components}/AllThemesWrapper.d.ts +0 -0
- /package/lib/{components → src/components}/Avatar/Avatar.test.cypress.d.ts +0 -0
- /package/lib/{components → src/components}/Avatar/index.d.ts +0 -0
- /package/lib/{components → src/components}/Avatar/styles.d.ts +0 -0
- /package/lib/{components → src/components}/Badge/Badge.test.cypress.d.ts +0 -0
- /package/lib/{components → src/components}/Badge/index.d.ts +0 -0
- /package/lib/{components → src/components}/Badge/styles.d.ts +0 -0
- /package/lib/{components → src/components}/Box/Box.test.cypress.d.ts +0 -0
- /package/lib/{components → src/components}/Box/styles.d.ts +0 -0
- /package/lib/{components → src/components}/Button/Button.test.cypress.d.ts +0 -0
- /package/lib/{components → src/components}/Button/styles.d.ts +0 -0
- /package/lib/{components → src/components}/Carousel/Carousel.test.cypress.d.ts +0 -0
- /package/lib/{components → src/components}/Carousel/Dots.d.ts +0 -0
- /package/lib/{components → src/components}/Carousel/index.d.ts +0 -0
- /package/lib/{components → src/components}/Carousel/styles.d.ts +0 -0
- /package/lib/{components → src/components}/Checkbox/CheckBox.test.cypress.d.ts +0 -0
- /package/lib/{components → src/components}/Checkbox/styles.d.ts +0 -0
- /package/lib/{components → src/components}/Collapse/Collapse.test.cypress.d.ts +0 -0
- /package/lib/{components → src/components}/Collapse/index.d.ts +0 -0
- /package/lib/{components → src/components}/DateField/DateField.test.cypress.d.ts +0 -0
- /package/lib/{components → src/components}/DateField/index.d.ts +0 -0
- /package/lib/{components → src/components}/Divider.d.ts +0 -0
- /package/lib/{components → src/components}/ErrorText/ErrorText.test.cypress.d.ts +0 -0
- /package/lib/{components → src/components}/ErrorText/index.d.ts +0 -0
- /package/lib/{components → src/components}/Flex.d.ts +0 -0
- /package/lib/{components → src/components}/Fontface.d.ts +0 -0
- /package/lib/{components → src/components}/Footer/Footer.test.cypress.d.ts +0 -0
- /package/lib/{components → src/components}/Footer/index.d.ts +0 -0
- /package/lib/{components → src/components}/Header/Header.test.cypress.d.ts +0 -0
- /package/lib/{components → src/components}/Header/index.d.ts +0 -0
- /package/lib/{components → src/components}/Header/styles.d.ts +0 -0
- /package/lib/{components → src/components}/Heading/Heading.test.cypress.d.ts +0 -0
- /package/lib/{components → src/components}/Heading/index.d.ts +0 -0
- /package/lib/{components → src/components}/Heading/styles.d.ts +0 -0
- /package/lib/{components → src/components}/IconFa/IconFa.test.cypress.d.ts +0 -0
- /package/lib/{components → src/components}/IconFa/index.d.ts +0 -0
- /package/lib/{components → src/components}/IconFa/styles.d.ts +0 -0
- /package/lib/{components → src/components}/InfoBox/InfoBox.test.cypress.d.ts +0 -0
- /package/lib/{components → src/components}/LabelWrapper/index.d.ts +0 -0
- /package/lib/{components → src/components}/LabelWrapper/styles.d.ts +0 -0
- /package/lib/{components → src/components}/LegendWrapper/LegendWrapper.test.cypress.d.ts +0 -0
- /package/lib/{components → src/components}/LegendWrapper/index.d.ts +0 -0
- /package/lib/{components → src/components}/LegendWrapper/styles.d.ts +0 -0
- /package/lib/{components → src/components}/Link/Link.test.cypress.d.ts +0 -0
- /package/lib/{components → src/components}/Loader/Loader.test.cypress.d.ts +0 -0
- /package/lib/{components → src/components}/Loader/index.d.ts +0 -0
- /package/lib/{components → src/components}/Loader/styles.d.ts +0 -0
- /package/lib/{components → src/components}/Modal/Modal.test.cypress.d.ts +0 -0
- /package/lib/{components → src/components}/Modal/index.d.ts +0 -0
- /package/lib/{components → src/components}/Pagination/Pagination.test.cypress.d.ts +0 -0
- /package/lib/{components → src/components}/Pagination/index.d.ts +0 -0
- /package/lib/{components → src/components}/Pagination/styles.d.ts +0 -0
- /package/lib/{components → src/components}/PopOver/PopOver.test.cypress.d.ts +0 -0
- /package/lib/{components → src/components}/PopOver/index.d.ts +0 -0
- /package/lib/{components → src/components}/PopOver/styles.d.ts +0 -0
- /package/lib/{components → src/components}/ProgressBar/ProgressBar.test.cypress.d.ts +0 -0
- /package/lib/{components → src/components}/ProgressBar/index.d.ts +0 -0
- /package/lib/{components → src/components}/ProgressBar/styles.d.ts +0 -0
- /package/lib/{components → src/components}/Radio/Radio.test.cypress.d.ts +0 -0
- /package/lib/{components → src/components}/Radio/styles.d.ts +0 -0
- /package/lib/{components → src/components}/RadioConsent/RadioConsent.test.cypress.d.ts +0 -0
- /package/lib/{components → src/components}/RadioConsent/index.d.ts +0 -0
- /package/lib/{components → src/components}/Select/Select.test.cypress.d.ts +0 -0
- /package/lib/{components → src/components}/Select/styles.d.ts +0 -0
- /package/lib/{components → src/components}/Spacing/index.d.ts +0 -0
- /package/lib/{components → src/components}/Step/Step.test.cypress.d.ts +0 -0
- /package/lib/{components → src/components}/Step/index.d.ts +0 -0
- /package/lib/{components → src/components}/Step/styles.d.ts +0 -0
- /package/lib/{components → src/components}/Text/Text.test.cypress.d.ts +0 -0
- /package/lib/{components → src/components}/Text/styles.d.ts +0 -0
- /package/lib/{components → src/components}/TextAreaField/TextAreaField.test.cypress.d.ts +0 -0
- /package/lib/{components → src/components}/TextAreaField/styles.d.ts +0 -0
- /package/lib/{components → src/components}/TextField/TextField.test.cypress.d.ts +0 -0
- /package/lib/{components → src/components}/Totaliser/Totaliser.test.cypress.d.ts +0 -0
- /package/lib/{components → src/components}/Totaliser/index.d.ts +0 -0
- /package/lib/{components → src/components}/Totaliser/styles.d.ts +0 -0
- /package/lib/{components → src/components}/UserBlock/UserBlock.test.cypress.d.ts +0 -0
- /package/lib/{components → src/components}/UserBlock/index.d.ts +0 -0
- /package/lib/{components → src/components}/UserBlock/styles.d.ts +0 -0
- /package/lib/{components → src/components}/index.d.ts +0 -0
- /package/lib/{hooks → src/hooks}/useKey.d.ts +0 -0
- /package/lib/{themes → src/themes}/bowelbabe.d.ts +0 -0
- /package/lib/{themes → src/themes}/cruk.d.ts +0 -0
- /package/lib/{themes → src/themes}/rfl.d.ts +0 -0
- /package/lib/{themes → src/themes}/su2c.d.ts +0 -0
- /package/lib/{utils → src/utils}/Helper.d.ts +0 -0
- /package/lib/{utils → src/utils}/__tests__/testHelpers.test.d.ts +0 -0
- /package/lib/{utils → src/utils}/themeUtils.d.ts +0 -0
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sources":["../../../../src/components/Badge/index.tsx"],"sourcesContent":["import React, { type ReactNode } from \"react\";\nimport { useTheme } from \"styled-components\";\n\nimport { type SpaceType } from \"../../types\";\nimport { crukTheme as defaultTheme } from \"../../themes/cruk\";\n\nimport { StyledBadge } from \"./styles\";\nimport { themeColorOrString } from \"../../utils/themeUtils\";\n\nexport type BadgeProps = {\n /** background colour of badge */\n backgroundColor?: string;\n /** border colour of badge */\n borderColor?: string;\n /** text colour of badge */\n textColor?: string;\n /** size of badge */\n size?: SpaceType;\n /** contents of badge */\n children?: ReactNode;\n /** forces shape to have equal width and height set by size attribute */\n isSquare?: boolean;\n};\n\n/**\n * Displays a numeric or icon indicator. You can use the icon prop to\nindicate the importance of the badge to the user.\n\nNote that depending on how they are used, badges may be confusing for users\nof screen readers and similar assistive technologies. While the styling of\nbadges provides a visual cue as to their purpose, these users will simply\nbe presented with the content of the badge. Depending on the specific\nsituation, these badges may seem like random additional words or numbers\nat the end of a sentence, link, or button. Unless the context is clear,\nconsider including additional context with a visually hidden piece of\nadditional text.\n */\nexport function Badge({\n children,\n size = \"xs\",\n backgroundColor = \"primary\",\n borderColor = \"transparent\",\n textColor = \"textOnPrimary\",\n isSquare,\n}: BadgeProps) {\n const foundTheme = useTheme();\n const theme = {\n ...defaultTheme,\n ...foundTheme,\n };\n\n const isSquareCalculated = isSquare ?? !(typeof children === \"string\");\n\n return (\n <StyledBadge\n theme={theme}\n $isSquare={isSquareCalculated}\n $size={size}\n $backgroundColor={themeColorOrString(backgroundColor, theme)}\n $borderColor={themeColorOrString(borderColor, theme)}\n $textColor={themeColorOrString(textColor, theme)}\n >\n {children}\n </StyledBadge>\n );\n}\n\nexport default Badge;\n"],"names":["Badge","
|
|
1
|
+
{"version":3,"file":"index.js","sources":["../../../../src/components/Badge/index.tsx"],"sourcesContent":["import React, { type ReactNode } from \"react\";\nimport { useTheme } from \"styled-components\";\n\nimport { type SpaceType } from \"../../types\";\nimport { crukTheme as defaultTheme } from \"../../themes/cruk\";\n\nimport { StyledBadge } from \"./styles\";\nimport { themeColorOrString } from \"../../utils/themeUtils\";\n\nexport type BadgeProps = {\n /** background colour of badge */\n backgroundColor?: string;\n /** border colour of badge */\n borderColor?: string;\n /** text colour of badge */\n textColor?: string;\n /** size of badge */\n size?: SpaceType;\n /** contents of badge */\n children?: ReactNode;\n /** forces shape to have equal width and height set by size attribute */\n isSquare?: boolean;\n};\n\n/**\n * Displays a numeric or icon indicator. You can use the icon prop to\nindicate the importance of the badge to the user.\n\nNote that depending on how they are used, badges may be confusing for users\nof screen readers and similar assistive technologies. While the styling of\nbadges provides a visual cue as to their purpose, these users will simply\nbe presented with the content of the badge. Depending on the specific\nsituation, these badges may seem like random additional words or numbers\nat the end of a sentence, link, or button. Unless the context is clear,\nconsider including additional context with a visually hidden piece of\nadditional text.\n */\nexport function Badge({\n children,\n size = \"xs\",\n backgroundColor = \"primary\",\n borderColor = \"transparent\",\n textColor = \"textOnPrimary\",\n isSquare,\n}: BadgeProps) {\n const foundTheme = useTheme();\n const theme = {\n ...defaultTheme,\n ...foundTheme,\n };\n\n const isSquareCalculated = isSquare ?? !(typeof children === \"string\");\n\n return (\n <StyledBadge\n theme={theme}\n $isSquare={isSquareCalculated}\n $size={size}\n $backgroundColor={themeColorOrString(backgroundColor, theme)}\n $borderColor={themeColorOrString(borderColor, theme)}\n $textColor={themeColorOrString(textColor, theme)}\n >\n {children}\n </StyledBadge>\n );\n}\n\nexport default Badge;\n"],"names":["Badge","children","size","backgroundColor","borderColor","textColor","isSquare","foundTheme","useTheme","theme","defaultTheme","isSquareCalculated","React","createElement","StyledBadge","$isSquare","$size","$backgroundColor","themeColorOrString","$borderColor"],"mappings":"4NAqCM,SAAUA,GAAMC,SACpBA,EAAQC,KACRA,EAAO,KAAIC,gBACXA,EAAkB,UAASC,YAC3BA,EAAc,cAAaC,UAC3BA,EAAY,gBAAeC,SAC3BA,IAEA,MAAMC,EAAaC,IACbC,EAAQ,IACTC,KACAH,GAGCI,EAAqBL,KAAkC,iBAAbL,GAEhD,OACEW,EAACC,cAAAC,EACC,CAAAL,MAAOA,EAAKM,UACDJ,EAAkBK,MACtBd,EACWe,iBAAAC,EAAmBf,EAAiBM,GACxCU,aAAAD,EAAmBd,EAAaK,cAClCS,EAAmBb,EAAWI,IAEzCR,EAGP"}
|
|
@@ -1,2 +1,18 @@
|
|
|
1
|
-
import
|
|
1
|
+
import e from"styled-components";const i=e.span`
|
|
2
|
+
display: inline-block;
|
|
3
|
+
border-width: 1px;
|
|
4
|
+
border-style: solid;
|
|
5
|
+
text-align: center;
|
|
6
|
+
font-size: ${({theme:e})=>e.fontSizes.m};
|
|
7
|
+
padding: ${({theme:e,$isSquare:i})=>i?0:e.spacing.xxs};
|
|
8
|
+
border-radius: ${({$isSquare:e})=>e?"50%":" 1.5rem"};
|
|
9
|
+
height: ${({$isSquare:e,$size:i,theme:s})=>e?`calc(${s.spacing[i]} + ${s.spacing.xs})`:"auto"};
|
|
10
|
+
width: ${({$isSquare:e,$size:i,theme:s})=>e?`calc(${s.spacing[i]} + ${s.spacing.xs})`:"auto"};
|
|
11
|
+
line-height: ${({$isSquare:e,$size:i,theme:s})=>e?`calc(${s.spacing[i]} + ${s.spacing.xs})`:" 1rem"};
|
|
12
|
+
min-width: ${({$size:e,theme:i})=>`calc(${i.spacing[e]} + ${i.spacing.xs})`};
|
|
13
|
+
|
|
14
|
+
background-color: ${({$backgroundColor:e})=>e};
|
|
15
|
+
border-color: ${({$borderColor:e})=>e};
|
|
16
|
+
color: ${({$textColor:e})=>e};
|
|
17
|
+
`;export{i as StyledBadge,i as default};
|
|
2
18
|
//# sourceMappingURL=styles.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"styles.js","sources":["../../../../src/components/Badge/styles.ts"],"sourcesContent":["import styled from \"styled-components\";\n\nimport { type SpaceType, type ThemeType } from \"../../types\";\n\nexport const StyledBadge = styled.span<{\n $backgroundColor: string;\n $borderColor: string;\n $textColor: string;\n $isSquare: boolean;\n $size: SpaceType;\n theme: ThemeType;\n}>`\n display: inline-block;\n border-width: 1px;\n border-style: solid;\n text-align: center;\n font-size: ${({ theme }) => theme.fontSizes.m};\n padding: ${({ theme, $isSquare }) => ($isSquare ? 0 : theme.spacing.xxs)};\n border-radius: ${({ $isSquare }) => ($isSquare ? \"50%\" : ` 1.5rem`)};\n height: ${({ $isSquare, $size, theme }) =>\n $isSquare ? `calc(${theme.spacing[$size]} + ${theme.spacing.xs})` : `auto`};\n width: ${({ $isSquare, $size, theme }) =>\n $isSquare ? `calc(${theme.spacing[$size]} + ${theme.spacing.xs})` : `auto`};\n line-height: ${({ $isSquare, $size, theme }) =>\n $isSquare\n ? `calc(${theme.spacing[$size]} + ${theme.spacing.xs})`\n : ` 1rem`};\n min-width: ${({ $size, theme }) =>\n `calc(${theme.spacing[$size]} + ${theme.spacing.xs})`};\n\n background-color: ${({ $backgroundColor }) => $backgroundColor};\n border-color: ${({ $borderColor }) => $borderColor};\n color: ${({ $textColor }) => $textColor};\n`;\n\nexport default StyledBadge;\n"],"names":["StyledBadge","styled","span","
|
|
1
|
+
{"version":3,"file":"styles.js","sources":["../../../../src/components/Badge/styles.ts"],"sourcesContent":["import styled from \"styled-components\";\n\nimport { type SpaceType, type ThemeType } from \"../../types\";\n\nexport const StyledBadge = styled.span<{\n $backgroundColor: string;\n $borderColor: string;\n $textColor: string;\n $isSquare: boolean;\n $size: SpaceType;\n theme: ThemeType;\n}>`\n display: inline-block;\n border-width: 1px;\n border-style: solid;\n text-align: center;\n font-size: ${({ theme }) => theme.fontSizes.m};\n padding: ${({ theme, $isSquare }) => ($isSquare ? 0 : theme.spacing.xxs)};\n border-radius: ${({ $isSquare }) => ($isSquare ? \"50%\" : ` 1.5rem`)};\n height: ${({ $isSquare, $size, theme }) =>\n $isSquare ? `calc(${theme.spacing[$size]} + ${theme.spacing.xs})` : `auto`};\n width: ${({ $isSquare, $size, theme }) =>\n $isSquare ? `calc(${theme.spacing[$size]} + ${theme.spacing.xs})` : `auto`};\n line-height: ${({ $isSquare, $size, theme }) =>\n $isSquare\n ? `calc(${theme.spacing[$size]} + ${theme.spacing.xs})`\n : ` 1rem`};\n min-width: ${({ $size, theme }) =>\n `calc(${theme.spacing[$size]} + ${theme.spacing.xs})`};\n\n background-color: ${({ $backgroundColor }) => $backgroundColor};\n border-color: ${({ $borderColor }) => $borderColor};\n color: ${({ $textColor }) => $textColor};\n`;\n\nexport default StyledBadge;\n"],"names":["StyledBadge","styled","span","theme","fontSizes","m","$isSquare","spacing","xxs","$size","xs","$backgroundColor","$borderColor","$textColor"],"mappings":"iCAIa,MAAAA,EAAcC,EAAOC,IAOhC;;;;;eAKa,EAAGC,WAAYA,EAAMC,UAAUC;aACjC,EAAGF,QAAOG,eAAiBA,EAAY,EAAIH,EAAMI,QAAQC;mBACnD,EAAGF,eAAiBA,EAAY,MAAQ;YAC/C,EAAGA,YAAWG,QAAON,WAC7BG,EAAY,QAAQH,EAAMI,QAAQE,QAAYN,EAAMI,QAAQG,MAAQ;WAC7D,EAAGJ,YAAWG,QAAON,WAC5BG,EAAY,QAAQH,EAAMI,QAAQE,QAAYN,EAAMI,QAAQG,MAAQ;iBACvD,EAAGJ,YAAWG,QAAON,WAClCG,EACI,QAAQH,EAAMI,QAAQE,QAAYN,EAAMI,QAAQG,MAChD;eACO,EAAGD,QAAON,WACrB,QAAQA,EAAMI,QAAQE,QAAYN,EAAMI,QAAQG;;sBAE9B,EAAGC,sBAAuBA;kBAC9B,EAAGC,kBAAmBA;WAC7B,EAAGC,gBAAiBA;"}
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import React from "react";
|
|
2
|
-
import { StoryObj } from "@storybook/react";
|
|
2
|
+
import { type StoryObj } from "@storybook/react";
|
|
3
3
|
import Box from ".";
|
|
4
4
|
declare const _default: {
|
|
5
5
|
title: string;
|
|
6
|
-
component:
|
|
6
|
+
component: ({ ...props }: import(".").BoxProps) => React.JSX.Element;
|
|
7
7
|
args: {};
|
|
8
8
|
tags: string[];
|
|
9
9
|
};
|
|
@@ -14,5 +14,5 @@ export type BoxProps = SpacingProps & HTMLAttributes<HTMLElement> & {
|
|
|
14
14
|
* The more specific the the target the higher priority the css will have.
|
|
15
15
|
* For example `margin` will be overridden by the `marginVertical` or `marginHorizontal` props. `marginTop`, `marginBottom`, `marginLeft`, `marginRight` will override the the `marginVertical` and `marginHorizontal` props.
|
|
16
16
|
*/
|
|
17
|
-
export declare const Box:
|
|
17
|
+
export declare const Box: ({ ...props }: BoxProps) => React.JSX.Element;
|
|
18
18
|
export default Box;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import
|
|
1
|
+
import r from"react";import{useTheme as o}from"styled-components";import{crukTheme as e}from"../../themes/cruk.js";import{spacingPropsToSpacingPropsInternal as t}from"../Spacing/index.js";import{StyledBox as m}from"./styles.js";const n=({...n})=>{const{children:s,backgroundColor:c,ref:f,...i}=n,p=o(),a={...e,...p},l=t(i);return r.createElement(m,{theme:a,$backgroundColor:c,...l,ref:f},s)};export{n as Box,n as default};
|
|
2
2
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sources":["../../../../src/components/Box/index.tsx"],"sourcesContent":["import React, {\n type HTMLAttributes,\n type Ref,\n
|
|
1
|
+
{"version":3,"file":"index.js","sources":["../../../../src/components/Box/index.tsx"],"sourcesContent":["import React, {\n type HTMLAttributes,\n type Ref,\n type ReactNode,\n type ElementType,\n} from \"react\";\nimport { useTheme } from \"styled-components\";\n\nimport { crukTheme as defaultTheme } from \"../../themes/cruk\";\n\nimport {\n spacingPropsToSpacingPropsInternal,\n type SpacingProps,\n} from \"../Spacing\";\nimport { StyledBox } from \"./styles\";\n\nexport type BoxProps = SpacingProps &\n HTMLAttributes<HTMLElement> & {\n /** background color of box, this will add default padding */\n backgroundColor?: string;\n ref?: Ref<HTMLDivElement>;\n children?: ReactNode;\n /** styled-component polymorphic feature so you take the styling of a box and cast the component to be a \"span\" for example */\n as?: ElementType;\n };\n\n/**\n * Box is used to wrap other components to add margin and padding.\n * The values will be in the t-shirt sizes specified in the theme sizes.\n * The more specific the the target the higher priority the css will have.\n * For example `margin` will be overridden by the `marginVertical` or `marginHorizontal` props. `marginTop`, `marginBottom`, `marginLeft`, `marginRight` will override the the `marginVertical` and `marginHorizontal` props.\n */\nexport const Box = ({ ...props }: BoxProps) => {\n const { children, backgroundColor, ref, ...rest } = props;\n const foundTheme = useTheme();\n const theme = {\n ...defaultTheme,\n ...foundTheme,\n };\n const restWithInternalSpacingProps = spacingPropsToSpacingPropsInternal(rest);\n\n return (\n <StyledBox\n theme={theme}\n $backgroundColor={backgroundColor}\n {...restWithInternalSpacingProps}\n ref={ref}\n >\n {children}\n </StyledBox>\n );\n};\n\nexport default Box;\n"],"names":["Box","props","children","backgroundColor","ref","rest","foundTheme","useTheme","theme","defaultTheme","restWithInternalSpacingProps","spacingPropsToSpacingPropsInternal","React","createElement","StyledBox","$backgroundColor"],"mappings":"oOAgCa,MAAAA,EAAM,KAAMC,MACvB,MAAMC,SAAEA,EAAQC,gBAAEA,EAAeC,IAAEA,KAAQC,GAASJ,EAC9CK,EAAaC,IACbC,EAAQ,IACTC,KACAH,GAECI,EAA+BC,EAAmCN,GAExE,OACEO,EAACC,cAAAC,GACCN,MAAOA,EACWO,iBAAAZ,KACdO,EACJN,IAAKA,GAEJF,EACS"}
|
|
@@ -1,2 +1,14 @@
|
|
|
1
|
-
import
|
|
1
|
+
import o from"styled-components";import{spacing as r}from"../Spacing/index.js";const t=o.div`
|
|
2
|
+
background-color: ${({theme:o})=>o.colors.backgroundLight};
|
|
3
|
+
padding: ${({theme:o,$backgroundColor:r})=>r?o.spacing.s:0};
|
|
4
|
+
margin: 0 0 ${({theme:o})=>o.spacing.m} 0;
|
|
5
|
+
|
|
6
|
+
&:last-child {
|
|
7
|
+
margin-bottom: 0;
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
background-color: ${({theme:o,$backgroundColor:r})=>r&&void 0!==o.colors[r]?o.colors[r]:r||"transparent"};
|
|
11
|
+
|
|
12
|
+
${o=>r(o,o.theme)}
|
|
13
|
+
`;export{t as StyledBox,t as default};
|
|
2
14
|
//# sourceMappingURL=styles.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"styles.js","sources":["../../../../src/components/Box/styles.ts"],"sourcesContent":["import styled from \"styled-components\";\n\nimport { spacing, type SpacingPropsInternal } from \"../Spacing\";\nimport { type ColorKeyType, type ThemeType } from \"../../types\";\n\ntype StyledBoxProps = SpacingPropsInternal & {\n $backgroundColor?: string;\n $css?: string;\n theme: ThemeType;\n};\n\nexport const StyledBox = styled.div<StyledBoxProps>`\n background-color: ${({ theme }) => theme.colors.backgroundLight};\n padding: ${({ theme, $backgroundColor }) =>\n $backgroundColor ? theme.spacing.s : 0};\n margin: 0 0 ${({ theme }) => theme.spacing.m} 0;\n\n &:last-child {\n margin-bottom: 0;\n }\n\n background-color: ${({ theme, $backgroundColor }) =>\n $backgroundColor &&\n typeof theme.colors[$backgroundColor as ColorKeyType] !== \"undefined\"\n ? theme.colors[$backgroundColor as ColorKeyType]\n : $backgroundColor || \"transparent\"};\n\n ${(props) => spacing(props, props.theme as ThemeType)}\n`;\n\nexport default StyledBox;\n"],"names":["StyledBox","styled","div","
|
|
1
|
+
{"version":3,"file":"styles.js","sources":["../../../../src/components/Box/styles.ts"],"sourcesContent":["import styled from \"styled-components\";\n\nimport { spacing, type SpacingPropsInternal } from \"../Spacing\";\nimport { type ColorKeyType, type ThemeType } from \"../../types\";\n\ntype StyledBoxProps = SpacingPropsInternal & {\n $backgroundColor?: string;\n $css?: string;\n theme: ThemeType;\n};\n\nexport const StyledBox = styled.div<StyledBoxProps>`\n background-color: ${({ theme }) => theme.colors.backgroundLight};\n padding: ${({ theme, $backgroundColor }) =>\n $backgroundColor ? theme.spacing.s : 0};\n margin: 0 0 ${({ theme }) => theme.spacing.m} 0;\n\n &:last-child {\n margin-bottom: 0;\n }\n\n background-color: ${({ theme, $backgroundColor }) =>\n $backgroundColor &&\n typeof theme.colors[$backgroundColor as ColorKeyType] !== \"undefined\"\n ? theme.colors[$backgroundColor as ColorKeyType]\n : $backgroundColor || \"transparent\"};\n\n ${(props) => spacing(props, props.theme as ThemeType)}\n`;\n\nexport default StyledBox;\n"],"names":["StyledBox","styled","div","theme","colors","backgroundLight","$backgroundColor","spacing","s","m","props"],"mappings":"+EAWa,MAAAA,EAAYC,EAAOC,GAAmB;sBAC7B,EAAGC,WAAYA,EAAMC,OAAOC;aACrC,EAAGF,QAAOG,sBACnBA,EAAmBH,EAAMI,QAAQC,EAAI;gBACzB,EAAGL,WAAYA,EAAMI,QAAQE;;;;;;sBAMvB,EAAGN,QAAOG,sBAC5BA,QAC0D,IAAnDH,EAAMC,OAAOE,GAChBH,EAAMC,OAAOE,GACbA,GAAoB;;IAEvBI,GAAUH,EAAQG,EAAOA,EAAMP;"}
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import React from "react";
|
|
2
|
-
import { StoryObj } from "@storybook/react";
|
|
2
|
+
import { type StoryObj } from "@storybook/react";
|
|
3
3
|
import { Button } from "./";
|
|
4
4
|
declare const _default: {
|
|
5
5
|
title: string;
|
|
6
|
-
component:
|
|
6
|
+
component: (props: import("./").ButtonProps) => React.JSX.Element;
|
|
7
7
|
args: {
|
|
8
8
|
appearance: string;
|
|
9
9
|
disabled: boolean;
|
|
@@ -24,5 +24,5 @@ export type ButtonProps = ButtonHTMLAttributes<HTMLElement> & {
|
|
|
24
24
|
*
|
|
25
25
|
* Design system documentation SU2C https://zeroheight.com/79db39f7e/p/22ff0e-button/b/32e1a2
|
|
26
26
|
*/
|
|
27
|
-
export declare const Button:
|
|
27
|
+
export declare const Button: (props: ButtonProps) => React.JSX.Element;
|
|
28
28
|
export default Button;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import
|
|
1
|
+
import e from"react";import{useTheme as t}from"styled-components";import{crukTheme as r}from"../../themes/cruk.js";import{IconFa as n}from"../IconFa/index.js";import{StyledButton as o,Spacer as l}from"./styles.js";const m=m=>{const a=t(),i={...r,...a},{appearance:s="primary",isIconButton:c=!1,full:p=!1,size:f="m",children:h,ref:u,...d}=m,y=e.Children.toArray(h),$="string"==typeof y[0],g=y[0],j=!(!c&&(1===y.length&&!$&&g?.type)!==n);return e.createElement(o,{as:m.href?"a":"button",...m.href?{role:"button"}:{},$full:!!p,$size:f,$appearance:s,$isIconButton:j,...d,theme:i,ref:u},m.children&&y.length?e.Children.map(m.children,((t,r)=>e.createElement(l,{theme:i,key:r},t))):null)};export{m as Button,m as default};
|
|
2
2
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sources":["../../../../src/components/Button/index.tsx"],"sourcesContent":["import React, {\n type ReactNode,\n type ButtonHTMLAttributes,\n type Ref,\n
|
|
1
|
+
{"version":3,"file":"index.js","sources":["../../../../src/components/Button/index.tsx"],"sourcesContent":["import React, {\n type ReactNode,\n type ButtonHTMLAttributes,\n type Ref,\n type ReactElement,\n type ElementType,\n} from \"react\";\nimport { useTheme } from \"styled-components\";\n\nimport { crukTheme as defaultTheme } from \"../../themes/cruk\";\nimport { IconFa } from \"../IconFa\";\n\nimport { Spacer, StyledButton } from \"./styles\";\nimport { type ButtonAppearanceType } from \"../../types\";\n\nexport type ButtonProps = ButtonHTMLAttributes<HTMLElement> & {\n /** the look and feel of the button */\n appearance?: ButtonAppearanceType;\n /** flag to stretch but to 100% width */\n full?: boolean;\n /** this is a url which will convert the button to an anchor tag */\n href?: string;\n /** the height of the button, this will add padding not increase text size */\n size?: \"m\" | \"l\";\n css?: unknown;\n /** styled-components polymorphism where you can use the styling of a button but convert to another element like an anchor tag */\n as?: ElementType;\n /** flag to force button into an icon button shape which is square or round */\n isIconButton?: boolean;\n /** Element reference */\n ref?: Ref<HTMLElement>;\n /** Component reference */\n children?: ReactNode;\n};\n\n/**\n * Design system documentation CRUK https://zeroheight.com/23de8a59a/p/180ef6-buttons/b/32e1a2\n *\n * Design system documentation SU2C https://zeroheight.com/79db39f7e/p/22ff0e-button/b/32e1a2\n */\nexport const Button = (props: ButtonProps) => {\n const foundTheme = useTheme();\n const theme = {\n ...defaultTheme,\n ...foundTheme,\n };\n const {\n appearance = \"primary\",\n isIconButton = false,\n full = false,\n size = \"m\",\n children,\n ref,\n ...rest\n } = props;\n\n const childArray = React.Children.toArray(children);\n const isChildString = typeof childArray[0] === \"string\";\n const firstElement = childArray[0] as ReactElement<HTMLElement>;\n\n // button has a fixed width if there is a single icon\n const setIconButton = !!(\n isIconButton ||\n (childArray.length === 1 && !isChildString && firstElement?.type) === IconFa\n );\n\n return (\n <StyledButton\n as={props.href ? \"a\" : \"button\"}\n {...(props.href ? { role: \"button\" } : {})}\n $full={!!full}\n $size={size}\n $appearance={appearance}\n $isIconButton={setIconButton}\n {...rest}\n theme={theme}\n ref={ref}\n >\n {props.children && childArray.length\n ? React.Children.map(\n props.children,\n (child: ReactNode, index: number) => (\n <Spacer theme={theme} key={index}>\n {child}\n </Spacer>\n ),\n )\n : null}\n </StyledButton>\n );\n};\n\nexport default Button;\n"],"names":["Button","props","foundTheme","useTheme","theme","defaultTheme","appearance","isIconButton","full","size","children","ref","rest","childArray","React","Children","toArray","isChildString","firstElement","setIconButton","length","type","IconFa","createElement","StyledButton","as","href","role","$full","$size","$appearance","$isIconButton","map","child","index","Spacer","key"],"mappings":"sNAwCa,MAAAA,EAAUC,IACrB,MAAMC,EAAaC,IACbC,EAAQ,IACTC,KACAH,IAECI,WACJA,EAAa,UAASC,aACtBA,GAAe,EAAKC,KACpBA,GAAO,EAAKC,KACZA,EAAO,IAAGC,SACVA,EAAQC,IACRA,KACGC,GACDX,EAEEY,EAAaC,EAAMC,SAASC,QAAQN,GACpCO,EAAyC,iBAAlBJ,EAAW,GAClCK,EAAeL,EAAW,GAG1BM,KACJZ,IACuB,IAAtBM,EAAWO,SAAiBH,GAAiBC,GAAcG,QAAUC,GAGxE,OACER,EAAAS,cAACC,EAAY,CACXC,GAAIxB,EAAMyB,KAAO,IAAM,YAClBzB,EAAMyB,KAAO,CAAEC,KAAM,UAAa,CAAA,EAChCC,QAAEpB,EACFqB,MAAApB,EACMqB,YAAAxB,EACEyB,cAAAZ,KACXP,EACJR,MAAOA,EACPO,IAAKA,GAEJV,EAAMS,UAAYG,EAAWO,OAC1BN,EAAMC,SAASiB,IACb/B,EAAMS,UACN,CAACuB,EAAkBC,IACjBpB,EAAAS,cAACY,EAAM,CAAC/B,MAAOA,EAAOgC,IAAKF,GACxBD,KAIP,KACS"}
|
|
@@ -1,2 +1,109 @@
|
|
|
1
|
-
import
|
|
1
|
+
import o,{css as r}from"styled-components";const t="3rem",e="4rem",n=o.span`
|
|
2
|
+
margin-left: ${({theme:o})=>o.spacing.xxs};
|
|
3
|
+
&:first-of-type {
|
|
4
|
+
margin-left: 0;
|
|
5
|
+
}
|
|
6
|
+
`,a=o.button`
|
|
7
|
+
box-sizing: border-box;
|
|
8
|
+
min-height: ${t};
|
|
9
|
+
height: min-content;
|
|
10
|
+
display: inline-block;
|
|
11
|
+
vertical-align: middle;
|
|
12
|
+
|
|
13
|
+
padding: ${({theme:o,$isIconButton:r})=>r?"0":`calc( (${t} - ( ${o.button.buttonBorderThickness} * 2) - ${o.typography.lineHeight} ) / 2) ${o.button.horizontalPadding}`};
|
|
14
|
+
width: ${({$isIconButton:o})=>o?`${t}`:"auto"};
|
|
15
|
+
min-width: ${({$isIconButton:o})=>o?`${t}`:"auto"};
|
|
16
|
+
|
|
17
|
+
border-radius: ${({theme:o})=>o.button.borderRadius};
|
|
18
|
+
border-style: solid;
|
|
19
|
+
border-width: ${({theme:o})=>o.button.buttonBorderThickness};
|
|
20
|
+
|
|
21
|
+
transition:
|
|
22
|
+
color 0.2s ease,
|
|
23
|
+
background-color 0.2s ease,
|
|
24
|
+
border-color 0.2s ease;
|
|
25
|
+
|
|
26
|
+
cursor: pointer;
|
|
27
|
+
font-size: ${({theme:{fontSizes:{m:o}}})=>o};
|
|
28
|
+
font-family: ${({theme:{typography:{fontFamilyButtons:o}}})=>o};
|
|
29
|
+
font-weight: ${({theme:{typography:{fontWeightButtons:o}}})=>o};
|
|
30
|
+
text-align: center;
|
|
31
|
+
text-transform: ${({theme:o})=>o.button.textTransform};
|
|
32
|
+
text-decoration: ${({theme:o})=>o.button.textDecoration};
|
|
33
|
+
|
|
34
|
+
&:focus-visible {
|
|
35
|
+
outline: auto;
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
${o=>"primary"===o.$appearance&&r`
|
|
39
|
+
background-color: ${o.theme.colors.buttonPrimaryBackground};
|
|
40
|
+
border-color: ${o.theme.colors.buttonPrimaryBorder};
|
|
41
|
+
color: ${o.theme.colors.buttonPrimaryText} !important;
|
|
42
|
+
&:focus,
|
|
43
|
+
&:hover {
|
|
44
|
+
background-color: ${o.theme.colors.buttonPrimaryBackgroundHover};
|
|
45
|
+
border-color: ${o.theme.colors.buttonPrimaryBorderHover};
|
|
46
|
+
color: ${o.theme.colors.buttonPrimaryTextHover} !important;
|
|
47
|
+
}
|
|
48
|
+
&:disabled {
|
|
49
|
+
cursor: not-allowed;
|
|
50
|
+
background-color: ${o.theme.colors.buttonPrimaryDisabledBackground};
|
|
51
|
+
color: ${o.theme.colors.buttonPrimaryDisabledText} !important;
|
|
52
|
+
border-color: ${o.theme.colors.buttonPrimaryDisabledBorder};
|
|
53
|
+
}
|
|
54
|
+
`}
|
|
55
|
+
|
|
56
|
+
${o=>"secondary"===o.$appearance&&r`
|
|
57
|
+
background-color: ${o.theme.colors.buttonSecondaryBackground};
|
|
58
|
+
border-color: ${o.theme.colors.buttonSecondaryBorder};
|
|
59
|
+
color: ${o.theme.colors.buttonSecondaryText} !important;
|
|
60
|
+
&:focus,
|
|
61
|
+
&:hover {
|
|
62
|
+
background-color: ${o.theme.colors.buttonSecondaryBackgroundHover};
|
|
63
|
+
border-color: ${o.theme.colors.buttonSecondaryBorderHover};
|
|
64
|
+
color: ${o.theme.colors.buttonSecondaryTextHover} !important;
|
|
65
|
+
}
|
|
66
|
+
&:disabled {
|
|
67
|
+
cursor: not-allowed;
|
|
68
|
+
background-color: ${o.theme.colors.buttonSecondaryDisabledBackground};
|
|
69
|
+
color: ${o.theme.colors.buttonSecondaryDisabledText} !important;
|
|
70
|
+
border-color: ${o.theme.colors.buttonSecondaryDisabledBorder};
|
|
71
|
+
}
|
|
72
|
+
`}
|
|
73
|
+
|
|
74
|
+
${o=>"tertiary"===o.$appearance&&r`
|
|
75
|
+
display: inline-block;
|
|
76
|
+
padding: 0;
|
|
77
|
+
border: 0px;
|
|
78
|
+
background-color: rgba(255, 255, 255, 0);
|
|
79
|
+
transition: color 0.2s ease;
|
|
80
|
+
color: ${o.theme.colors.buttonTertiaryText};
|
|
81
|
+
&:focus,
|
|
82
|
+
&:hover {
|
|
83
|
+
color: ${o.theme.colors.buttonTertiaryTextHover};
|
|
84
|
+
}
|
|
85
|
+
&:disabled {
|
|
86
|
+
cursor: not-allowed;
|
|
87
|
+
background-color: transparent;
|
|
88
|
+
color: ${o.theme.colors.buttonTertiaryDisabledText} !important;
|
|
89
|
+
border-color: transparent;
|
|
90
|
+
}
|
|
91
|
+
`}
|
|
92
|
+
|
|
93
|
+
${({theme:o,$size:t,$isIconButton:n})=>"l"===t&&r`
|
|
94
|
+
min-height: ${e};
|
|
95
|
+
border-radius: ${o.button.borderRadiusLarge};
|
|
96
|
+
padding: ${n?"0":`calc( (${e} - ( ${o.button.buttonBorderThickness} * 2) - ${o.typography.lineHeight} ) / 2) ${o.spacing.m}`};
|
|
97
|
+
min-width: ${n?`${e}`:"auto"};
|
|
98
|
+
height: ${n?`${e}`:"min-content"};
|
|
99
|
+
`}
|
|
100
|
+
|
|
101
|
+
${o=>o.$full&&r`
|
|
102
|
+
width: 100%;
|
|
103
|
+
`}
|
|
104
|
+
|
|
105
|
+
${o=>o.$css&&r`
|
|
106
|
+
${o.$css}
|
|
107
|
+
`}
|
|
108
|
+
`;export{n as Spacer,a as StyledButton};
|
|
2
109
|
//# sourceMappingURL=styles.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"styles.js","sources":["../../../../src/components/Button/styles.ts"],"sourcesContent":["import styled, { css } from \"styled-components\";\n\nimport { type ThemeType, type ButtonAppearanceType } from \"../../types\";\n\nconst BUTTON_HEIGHT = \"3rem\";\nconst BUTTON_HEIGHT_LARGE = \"4rem\";\n\nexport const Spacer = styled.span<{ theme: ThemeType }>`\n margin-left: ${({ theme }) => theme.spacing.xxs};\n &:first-of-type {\n margin-left: 0;\n }\n`;\n\nexport const StyledButton = styled.button<{\n theme: ThemeType;\n href?: string;\n $isIconButton: boolean;\n $appearance?: ButtonAppearanceType;\n $full?: boolean;\n $size?: \"m\" | \"l\";\n $css?: string;\n}>`\n box-sizing: border-box;\n min-height: ${BUTTON_HEIGHT};\n height: min-content;\n display: inline-block;\n vertical-align: middle;\n\n padding: ${({ theme, $isIconButton }) =>\n $isIconButton\n ? \"0\"\n : `calc( (${BUTTON_HEIGHT} - ( ${theme.button.buttonBorderThickness} * 2) - ${theme.typography.lineHeight} ) / 2) ${theme.button.horizontalPadding}`};\n width: ${({ $isIconButton }) =>\n $isIconButton ? `${BUTTON_HEIGHT}` : \"auto\"};\n min-width: ${({ $isIconButton }) =>\n $isIconButton ? `${BUTTON_HEIGHT}` : \"auto\"};\n\n border-radius: ${({ theme }) => theme.button.borderRadius};\n border-style: solid;\n border-width: ${({ theme }) => theme.button.buttonBorderThickness};\n\n transition:\n color 0.2s ease,\n background-color 0.2s ease,\n border-color 0.2s ease;\n\n cursor: pointer;\n font-size: ${({\n theme: {\n fontSizes: { m },\n },\n }) => m};\n font-family: ${({\n theme: {\n typography: { fontFamilyButtons },\n },\n }) => fontFamilyButtons};\n font-weight: ${({\n theme: {\n typography: { fontWeightButtons },\n },\n }) => fontWeightButtons};\n text-align: center;\n text-transform: ${({ theme }) => theme.button.textTransform};\n text-decoration: ${({ theme }) => theme.button.textDecoration};\n\n &:focus-visible {\n outline: auto;\n }\n\n ${(props) =>\n props.$appearance === \"primary\" &&\n css`\n background-color: ${props.theme.colors.buttonPrimaryBackground};\n border-color: ${props.theme.colors.buttonPrimaryBorder};\n color: ${props.theme.colors.buttonPrimaryText} !important;\n &:focus,\n &:hover {\n background-color: ${props.theme.colors.buttonPrimaryBackgroundHover};\n border-color: ${props.theme.colors.buttonPrimaryBorderHover};\n color: ${props.theme.colors.buttonPrimaryTextHover} !important;\n }\n &:disabled {\n cursor: not-allowed;\n background-color: ${props.theme.colors.buttonPrimaryDisabledBackground};\n color: ${props.theme.colors.buttonPrimaryDisabledText} !important;\n border-color: ${props.theme.colors.buttonPrimaryDisabledBorder};\n }\n `}\n\n ${(props) =>\n props.$appearance === \"secondary\" &&\n css`\n background-color: ${props.theme.colors.buttonSecondaryBackground};\n border-color: ${props.theme.colors.buttonSecondaryBorder};\n color: ${props.theme.colors.buttonSecondaryText} !important;\n &:focus,\n &:hover {\n background-color: ${props.theme.colors.buttonSecondaryBackgroundHover};\n border-color: ${props.theme.colors.buttonSecondaryBorderHover};\n color: ${props.theme.colors.buttonSecondaryTextHover} !important;\n }\n &:disabled {\n cursor: not-allowed;\n background-color: ${props.theme.colors\n .buttonSecondaryDisabledBackground};\n color: ${props.theme.colors.buttonSecondaryDisabledText} !important;\n border-color: ${props.theme.colors.buttonSecondaryDisabledBorder};\n }\n `}\n\n ${(props) =>\n props.$appearance === \"tertiary\" &&\n css`\n display: inline-block;\n padding: 0;\n border: 0px;\n background-color: rgba(255, 255, 255, 0);\n transition: color 0.2s ease;\n color: ${props.theme.colors.buttonTertiaryText};\n &:focus,\n &:hover {\n color: ${props.theme.colors.buttonTertiaryTextHover};\n }\n &:disabled {\n cursor: not-allowed;\n background-color: transparent;\n color: ${props.theme.colors.buttonTertiaryDisabledText} !important;\n border-color: transparent;\n }\n `}\n \n ${({ theme, $size, $isIconButton }) =>\n $size === \"l\" &&\n css`\n min-height: ${BUTTON_HEIGHT_LARGE};\n border-radius: ${theme.button.borderRadiusLarge};\n padding: ${$isIconButton\n ? \"0\"\n : `calc( (${BUTTON_HEIGHT_LARGE} - ( ${theme.button.buttonBorderThickness} * 2) - ${theme.typography.lineHeight} ) / 2) ${theme.spacing.m}`};\n min-width: ${$isIconButton ? `${BUTTON_HEIGHT_LARGE}` : \"auto\"};\n height: ${$isIconButton ? `${BUTTON_HEIGHT_LARGE}` : \"min-content\"};\n `}\n\n ${(props) =>\n props.$full &&\n css`\n width: 100%;\n `}\n\n ${(props) =>\n props.$css &&\n css`\n ${props.$css}\n `}\n`;\n"],"names":["BUTTON_HEIGHT","BUTTON_HEIGHT_LARGE","Spacer","styled","span","
|
|
1
|
+
{"version":3,"file":"styles.js","sources":["../../../../src/components/Button/styles.ts"],"sourcesContent":["import styled, { css } from \"styled-components\";\n\nimport { type ThemeType, type ButtonAppearanceType } from \"../../types\";\n\nconst BUTTON_HEIGHT = \"3rem\";\nconst BUTTON_HEIGHT_LARGE = \"4rem\";\n\nexport const Spacer = styled.span<{ theme: ThemeType }>`\n margin-left: ${({ theme }) => theme.spacing.xxs};\n &:first-of-type {\n margin-left: 0;\n }\n`;\n\nexport const StyledButton = styled.button<{\n theme: ThemeType;\n href?: string;\n $isIconButton: boolean;\n $appearance?: ButtonAppearanceType;\n $full?: boolean;\n $size?: \"m\" | \"l\";\n $css?: string;\n}>`\n box-sizing: border-box;\n min-height: ${BUTTON_HEIGHT};\n height: min-content;\n display: inline-block;\n vertical-align: middle;\n\n padding: ${({ theme, $isIconButton }) =>\n $isIconButton\n ? \"0\"\n : `calc( (${BUTTON_HEIGHT} - ( ${theme.button.buttonBorderThickness} * 2) - ${theme.typography.lineHeight} ) / 2) ${theme.button.horizontalPadding}`};\n width: ${({ $isIconButton }) =>\n $isIconButton ? `${BUTTON_HEIGHT}` : \"auto\"};\n min-width: ${({ $isIconButton }) =>\n $isIconButton ? `${BUTTON_HEIGHT}` : \"auto\"};\n\n border-radius: ${({ theme }) => theme.button.borderRadius};\n border-style: solid;\n border-width: ${({ theme }) => theme.button.buttonBorderThickness};\n\n transition:\n color 0.2s ease,\n background-color 0.2s ease,\n border-color 0.2s ease;\n\n cursor: pointer;\n font-size: ${({\n theme: {\n fontSizes: { m },\n },\n }) => m};\n font-family: ${({\n theme: {\n typography: { fontFamilyButtons },\n },\n }) => fontFamilyButtons};\n font-weight: ${({\n theme: {\n typography: { fontWeightButtons },\n },\n }) => fontWeightButtons};\n text-align: center;\n text-transform: ${({ theme }) => theme.button.textTransform};\n text-decoration: ${({ theme }) => theme.button.textDecoration};\n\n &:focus-visible {\n outline: auto;\n }\n\n ${(props) =>\n props.$appearance === \"primary\" &&\n css`\n background-color: ${props.theme.colors.buttonPrimaryBackground};\n border-color: ${props.theme.colors.buttonPrimaryBorder};\n color: ${props.theme.colors.buttonPrimaryText} !important;\n &:focus,\n &:hover {\n background-color: ${props.theme.colors.buttonPrimaryBackgroundHover};\n border-color: ${props.theme.colors.buttonPrimaryBorderHover};\n color: ${props.theme.colors.buttonPrimaryTextHover} !important;\n }\n &:disabled {\n cursor: not-allowed;\n background-color: ${props.theme.colors.buttonPrimaryDisabledBackground};\n color: ${props.theme.colors.buttonPrimaryDisabledText} !important;\n border-color: ${props.theme.colors.buttonPrimaryDisabledBorder};\n }\n `}\n\n ${(props) =>\n props.$appearance === \"secondary\" &&\n css`\n background-color: ${props.theme.colors.buttonSecondaryBackground};\n border-color: ${props.theme.colors.buttonSecondaryBorder};\n color: ${props.theme.colors.buttonSecondaryText} !important;\n &:focus,\n &:hover {\n background-color: ${props.theme.colors.buttonSecondaryBackgroundHover};\n border-color: ${props.theme.colors.buttonSecondaryBorderHover};\n color: ${props.theme.colors.buttonSecondaryTextHover} !important;\n }\n &:disabled {\n cursor: not-allowed;\n background-color: ${props.theme.colors\n .buttonSecondaryDisabledBackground};\n color: ${props.theme.colors.buttonSecondaryDisabledText} !important;\n border-color: ${props.theme.colors.buttonSecondaryDisabledBorder};\n }\n `}\n\n ${(props) =>\n props.$appearance === \"tertiary\" &&\n css`\n display: inline-block;\n padding: 0;\n border: 0px;\n background-color: rgba(255, 255, 255, 0);\n transition: color 0.2s ease;\n color: ${props.theme.colors.buttonTertiaryText};\n &:focus,\n &:hover {\n color: ${props.theme.colors.buttonTertiaryTextHover};\n }\n &:disabled {\n cursor: not-allowed;\n background-color: transparent;\n color: ${props.theme.colors.buttonTertiaryDisabledText} !important;\n border-color: transparent;\n }\n `}\n \n ${({ theme, $size, $isIconButton }) =>\n $size === \"l\" &&\n css`\n min-height: ${BUTTON_HEIGHT_LARGE};\n border-radius: ${theme.button.borderRadiusLarge};\n padding: ${$isIconButton\n ? \"0\"\n : `calc( (${BUTTON_HEIGHT_LARGE} - ( ${theme.button.buttonBorderThickness} * 2) - ${theme.typography.lineHeight} ) / 2) ${theme.spacing.m}`};\n min-width: ${$isIconButton ? `${BUTTON_HEIGHT_LARGE}` : \"auto\"};\n height: ${$isIconButton ? `${BUTTON_HEIGHT_LARGE}` : \"min-content\"};\n `}\n\n ${(props) =>\n props.$full &&\n css`\n width: 100%;\n `}\n\n ${(props) =>\n props.$css &&\n css`\n ${props.$css}\n `}\n`;\n"],"names":["BUTTON_HEIGHT","BUTTON_HEIGHT_LARGE","Spacer","styled","span","theme","spacing","xxs","StyledButton","button","$isIconButton","buttonBorderThickness","typography","lineHeight","horizontalPadding","borderRadius","fontSizes","m","fontFamilyButtons","fontWeightButtons","textTransform","textDecoration","props","$appearance","css","colors","buttonPrimaryBackground","buttonPrimaryBorder","buttonPrimaryText","buttonPrimaryBackgroundHover","buttonPrimaryBorderHover","buttonPrimaryTextHover","buttonPrimaryDisabledBackground","buttonPrimaryDisabledText","buttonPrimaryDisabledBorder","buttonSecondaryBackground","buttonSecondaryBorder","buttonSecondaryText","buttonSecondaryBackgroundHover","buttonSecondaryBorderHover","buttonSecondaryTextHover","buttonSecondaryDisabledBackground","buttonSecondaryDisabledText","buttonSecondaryDisabledBorder","buttonTertiaryText","buttonTertiaryTextHover","buttonTertiaryDisabledText","$size","borderRadiusLarge","$full","$css"],"mappings":"2CAIA,MAAMA,EAAgB,OAChBC,EAAsB,OAEfC,EAASC,EAAOC,IAA0B;iBACtC,EAAGC,WAAYA,EAAMC,QAAQC;;;;EAMjCC,EAAeL,EAAOM,MAQjC;;gBAEcT;;;;;aAKH,EAAGK,QAAOK,mBACnBA,EACI,IACA,UAAUV,SAAqBK,EAAMI,OAAOE,gCAAgCN,EAAMO,WAAWC,qBAAqBR,EAAMI,OAAOK;WAC5H,EAAGJ,mBACVA,EAAgB,GAAGV,IAAkB;eAC1B,EAAGU,mBACdA,EAAgB,GAAGV,IAAkB;;mBAEtB,EAAGK,WAAYA,EAAMI,OAAOM;;kBAE7B,EAAGV,WAAYA,EAAMI,OAAOE;;;;;;;;eAQ/B,EACXN,OACEW,WAAaC,SAEXA;iBACS,EACbZ,OACEO,YAAcM,yBAEZA;iBACS,EACbb,OACEO,YAAcO,yBAEZA;;oBAEY,EAAGd,WAAYA,EAAMI,OAAOW;qBAC3B,EAAGf,WAAYA,EAAMI,OAAOY;;;;;;IAM5CC,GACqB,YAAtBA,EAAMC,aACNC,CAAG;0BACmBF,EAAMjB,MAAMoB,OAAOC;sBACvBJ,EAAMjB,MAAMoB,OAAOE;eAC1BL,EAAMjB,MAAMoB,OAAOG;;;4BAGNN,EAAMjB,MAAMoB,OAAOI;wBACvBP,EAAMjB,MAAMoB,OAAOK;iBAC1BR,EAAMjB,MAAMoB,OAAOM;;;;4BAIRT,EAAMjB,MAAMoB,OAAOO;iBAC9BV,EAAMjB,MAAMoB,OAAOQ;wBACZX,EAAMjB,MAAMoB,OAAOS;;;;IAItCZ,GACqB,cAAtBA,EAAMC,aACNC,CAAG;0BACmBF,EAAMjB,MAAMoB,OAAOU;sBACvBb,EAAMjB,MAAMoB,OAAOW;eAC1Bd,EAAMjB,MAAMoB,OAAOY;;;4BAGNf,EAAMjB,MAAMoB,OAAOa;wBACvBhB,EAAMjB,MAAMoB,OAAOc;iBAC1BjB,EAAMjB,MAAMoB,OAAOe;;;;4BAIRlB,EAAMjB,MAAMoB,OAC7BgB;iBACMnB,EAAMjB,MAAMoB,OAAOiB;wBACZpB,EAAMjB,MAAMoB,OAAOkB;;;;IAItCrB,GACqB,aAAtBA,EAAMC,aACNC,CAAG;;;;;;eAMQF,EAAMjB,MAAMoB,OAAOmB;;;iBAGjBtB,EAAMjB,MAAMoB,OAAOoB;;;;;iBAKnBvB,EAAMjB,MAAMoB,OAAOqB;;;;;IAKhC,EAAGzC,QAAO0C,QAAOrC,mBACP,MAAVqC,GACAvB,CAAG;oBACavB;uBACGI,EAAMI,OAAOuC;iBACnBtC,EACP,IACA,UAAUT,SAA2BI,EAAMI,OAAOE,gCAAgCN,EAAMO,WAAWC,qBAAqBR,EAAMC,QAAQW;mBAC7HP,EAAgB,GAAGT,IAAwB;gBAC9CS,EAAgB,GAAGT,IAAwB;;;IAGtDqB,GACDA,EAAM2B,OACNzB,CAAG;;;;IAIFF,GACDA,EAAM4B,MACN1B,CAAG;QACCF,EAAM4B;;"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import React from "react";
|
|
2
|
-
import { StoryObj } from "@storybook/react";
|
|
3
|
-
import Carousel, { CarouselProps } from ".";
|
|
2
|
+
import { type StoryObj } from "@storybook/react";
|
|
3
|
+
import Carousel, { type CarouselProps } from ".";
|
|
4
4
|
declare const _default: {
|
|
5
5
|
title: string;
|
|
6
6
|
component: React.MemoExoticComponent<({ startPosition, children, onPositionChanged, shrinkUnselectedPages, fullWidthChild, }: CarouselProps) => React.JSX.Element>;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import e from"react";import{faCaretLeft as
|
|
1
|
+
import e from"react";import{faCaretLeft as l,faCaretRight as t}from"../../../node_modules/@fortawesome/free-solid-svg-icons/index.js";import{IconFa as r}from"../IconFa/index.js";import{ButtonWrapper as o,CarouselButton as n,VerticalAlign as c,ScreenReaderOnly as a,DotContainer as i,Dot as s}from"./styles.js";const m=({count:m,currentPosition:u=0,scrollToPosition:d,next:E,previous:f})=>{const p=u!==m-1,x=0!==u,k=Array.from({length:m},((e,l)=>`arrayIndex${l}`));return e.createElement(o,null,e.createElement(n,{disabled:!x,"aria-label":"previous",onClick:()=>{f()}},e.createElement(c,null,e.createElement(r,{faIcon:l,size:"1.25em"}),e.createElement(a,null,"Scroll carousel to previous index"))),e.createElement(i,{$count:m},k.map(((l,t)=>{const r=t===u;return e.createElement(s,{key:l,role:"switch","aria-checked":r,onClick:()=>{d(t)},$selected:r},e.createElement(a,null,`Scroll carousel to index ${t}`))}))),e.createElement(n,{disabled:!p,"aria-label":"next",onClick:()=>{E()}},e.createElement(c,null,e.createElement(r,{faIcon:t,size:"1.25em"}),e.createElement(a,null,"Scroll carousel to previous index"))))};export{m as Dots,m as default};
|
|
2
2
|
//# sourceMappingURL=Dots.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Dots.js","sources":["../../../../src/components/Carousel/Dots.tsx"],"sourcesContent":["import React from \"react\";\nimport { faCaretLeft, faCaretRight } from \"@fortawesome/free-solid-svg-icons\";\n\nimport { IconFa } from \"../IconFa\";\n\nimport {\n DotContainer,\n Dot,\n CarouselButton,\n ButtonWrapper,\n VerticalAlign,\n ScreenReaderOnly,\n} from \"./styles\";\n\nexport const Dots = ({\n count,\n currentPosition = 0,\n scrollToPosition,\n next,\n previous,\n}: {\n count: number;\n currentPosition: number;\n scrollToPosition: (to: number) => void;\n next: () => void;\n previous: () => void;\n}) => {\n const moreOnRight = currentPosition !== count - 1;\n const moreOnLeft = currentPosition !== 0;\n const countArray = Array.from({ length: count }, (e, i) => `arrayIndex${i}`);\n\n return (\n <ButtonWrapper>\n <CarouselButton\n disabled={!moreOnLeft}\n aria-label=\"previous\"\n onClick={() => {\n previous();\n }}\n >\n <VerticalAlign>\n <IconFa faIcon={faCaretLeft} size=\"1.25em\" />\n <ScreenReaderOnly>Scroll carousel to previous index</ScreenReaderOnly>\n </VerticalAlign>\n </CarouselButton>\n\n <DotContainer $count={count}>\n {countArray.map((item, index) => {\n const isSelected = index === currentPosition;\n const scrollTo = () => {\n scrollToPosition(index);\n };\n return (\n <Dot\n key={item}\n role=\"switch\"\n aria-checked={isSelected}\n onClick={scrollTo}\n $selected={isSelected}\n >\n <ScreenReaderOnly>{`Scroll carousel to index ${index}`}</ScreenReaderOnly>\n </Dot>\n );\n })}\n </DotContainer>\n\n <CarouselButton\n disabled={!moreOnRight}\n aria-label=\"next\"\n onClick={() => {\n next();\n }}\n >\n <VerticalAlign>\n <IconFa faIcon={faCaretRight} size=\"1.25em\" />\n <ScreenReaderOnly>Scroll carousel to previous index</ScreenReaderOnly>\n </VerticalAlign>\n </CarouselButton>\n </ButtonWrapper>\n );\n};\n\nexport default Dots;\n"],"names":["Dots","
|
|
1
|
+
{"version":3,"file":"Dots.js","sources":["../../../../src/components/Carousel/Dots.tsx"],"sourcesContent":["import React from \"react\";\nimport { faCaretLeft, faCaretRight } from \"@fortawesome/free-solid-svg-icons\";\n\nimport { IconFa } from \"../IconFa\";\n\nimport {\n DotContainer,\n Dot,\n CarouselButton,\n ButtonWrapper,\n VerticalAlign,\n ScreenReaderOnly,\n} from \"./styles\";\n\nexport const Dots = ({\n count,\n currentPosition = 0,\n scrollToPosition,\n next,\n previous,\n}: {\n count: number;\n currentPosition: number;\n scrollToPosition: (to: number) => void;\n next: () => void;\n previous: () => void;\n}) => {\n const moreOnRight = currentPosition !== count - 1;\n const moreOnLeft = currentPosition !== 0;\n const countArray = Array.from({ length: count }, (e, i) => `arrayIndex${i}`);\n\n return (\n <ButtonWrapper>\n <CarouselButton\n disabled={!moreOnLeft}\n aria-label=\"previous\"\n onClick={() => {\n previous();\n }}\n >\n <VerticalAlign>\n <IconFa faIcon={faCaretLeft} size=\"1.25em\" />\n <ScreenReaderOnly>Scroll carousel to previous index</ScreenReaderOnly>\n </VerticalAlign>\n </CarouselButton>\n\n <DotContainer $count={count}>\n {countArray.map((item, index) => {\n const isSelected = index === currentPosition;\n const scrollTo = () => {\n scrollToPosition(index);\n };\n return (\n <Dot\n key={item}\n role=\"switch\"\n aria-checked={isSelected}\n onClick={scrollTo}\n $selected={isSelected}\n >\n <ScreenReaderOnly>{`Scroll carousel to index ${index}`}</ScreenReaderOnly>\n </Dot>\n );\n })}\n </DotContainer>\n\n <CarouselButton\n disabled={!moreOnRight}\n aria-label=\"next\"\n onClick={() => {\n next();\n }}\n >\n <VerticalAlign>\n <IconFa faIcon={faCaretRight} size=\"1.25em\" />\n <ScreenReaderOnly>Scroll carousel to previous index</ScreenReaderOnly>\n </VerticalAlign>\n </CarouselButton>\n </ButtonWrapper>\n );\n};\n\nexport default Dots;\n"],"names":["Dots","count","currentPosition","scrollToPosition","next","previous","moreOnRight","moreOnLeft","countArray","Array","from","length","e","i","React","ButtonWrapper","createElement","CarouselButton","disabled","onClick","VerticalAlign","IconFa","faIcon","faCaretLeft","size","ScreenReaderOnly","DotContainer","$count","map","item","index","isSelected","Dot","key","role","faCaretRight"],"mappings":"sTAca,MAAAA,EAAO,EAClBC,QACAC,kBAAkB,EAClBC,mBACAC,OACAC,eAQA,MAAMC,EAAcJ,IAAoBD,EAAQ,EAC1CM,EAAiC,IAApBL,EACbM,EAAaC,MAAMC,KAAK,CAAEC,OAAQV,IAAS,CAACW,EAAGC,IAAM,aAAaA,MAExE,OACEC,gBAACC,EAAa,KACZD,EAAAE,cAACC,EAAc,CACbC,UAAWX,EACA,aAAA,WACXY,QAAS,KACPd,GAAU,GAGZS,EAAAE,cAACI,EAAa,KACZN,EAACE,cAAAK,GAAOC,OAAQC,EAAaC,KAAK,WAClCV,EAACE,cAAAS,EAAqE,KAAA,uCAI1EX,EAAAE,cAACU,EAAY,CAAAC,OAAS1B,GACnBO,EAAWoB,KAAI,CAACC,EAAMC,KACrB,MAAMC,EAAaD,IAAU5B,EAI7B,OACEY,EAACE,cAAAgB,GACCC,IAAKJ,EACLK,KAAK,wBACSH,EACdZ,QARa,KACfhB,EAAiB2B,EAAM,YAQVC,GAEXjB,EAACE,cAAAS,OAAkB,4BAA4BK,KAC3C,KAKZhB,EAAAE,cAACC,EAAc,CACbC,UAAWZ,EACA,aAAA,OACXa,QAAS,KACPf,GAAM,GAGRU,EAAAE,cAACI,EAAa,KACZN,EAACE,cAAAK,GAAOC,OAAQa,EAAcX,KAAK,WACnCV,EAAAE,cAACS,EAAqE,KAAA,uCAG5D"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import e,{memo as t,useState as
|
|
1
|
+
import e,{memo as t,useState as r,useRef as n,useEffect as l}from"react";import{InView as o}from"../../../node_modules/react-intersection-observer/dist/index.js";import{Box as i}from"../Box/index.js";import{Dots as c}from"./Dots.js";import{CarouselWrapper as s,CarouselScrollArea as a,CarouselCard as d,CarouselCardInner as u}from"./styles.js";const m=({startPosition:t,children:m,onPositionChanged:h,shrinkUnselectedPages:f=!1,fullWidthChild:g=!1})=>{const E=e.useRef(void 0),p=void 0!==t,[v,C]=r(t||0),[$,x]=r(!p),P=n(null),T=e.Children.toArray(m).filter(Boolean),y=e=>{if(P?.current){const t=P.current.scrollWidth,r=0===e,n=e===P.current.children.length-1,l=P.current.children[e];if(!l)return;const o=l.offsetLeft;r?P.current.scrollTo(0,0):n?P.current.scrollTo(t,0):P.current.scrollTo(o,0),$||x(!0)}};l((()=>{p&&x(!1)}),[t]),l((()=>{$||y(t||0)}),[$]);const j=1===T.length;return e.createElement(e.Fragment,null,e.createElement(i,null,e.createElement(s,null,e.createElement(a,{ref:P,"aria-live":"assertive",$smoothScrolling:$,tabIndex:0},T.map(((t,r)=>{const n=r===v,l=`card-${r}`;return e.createElement(d,{key:l,$onlyChild:j,$fullWidthChild:g},e.createElement(o,{threshold:.5,as:"div",onChange:e=>{var t;e&&v!==(t=r)&&(C(t),E&&clearTimeout(E?.current),E.current=setTimeout((()=>{h&&$&&h(t)}),500))}},e.createElement(u,{$onlyChild:j,$isSelected:n,$shrinkUnselectedPages:f,$fullWidthChild:g},t)))}))))),T.length>1?e.createElement(i,null,e.createElement(c,{count:T.length,currentPosition:v,scrollToPosition:y,next:()=>{y(v+1)},previous:()=>{y(v-1)}})):null)};t(m);export{m as Carousel};
|
|
2
2
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sources":["../../../../src/components/Carousel/index.tsx"],"sourcesContent":["import React, {\n useState,\n useRef,\n useEffect,\n memo,\n type ReactNode,\n} from \"react\";\nimport { InView } from \"react-intersection-observer\";\n\nimport { Box } from \"../Box\";\nimport { Dots } from \"./Dots\";\n\nimport {\n CarouselWrapper,\n CarouselCardInner,\n CarouselCard,\n CarouselScrollArea,\n} from \"./styles\";\n\nexport type CarouselProps = {\n /** Index in which the carousel is scrolled to on mount */\n startPosition?: number;\n /** call back for on position changed first prop is the possition */\n onPositionChanged?: (position: number) => void;\n /** show item left and right of current smaller than current item */\n shrinkUnselectedPages?: boolean;\n /** childrent item of the carousel */\n children?: ReactNode;\n /** set carousel image to full width of parent */\n fullWidthChild?: boolean;\n};\n\n/**\n *\n * Lightweight carousel component that works with mouse and touch events,\n * Accepts react node array as children so will work with any html element as a child.\n *\n * Also works with external state that holds carousel postion,\n * by accepting a starting position as a prop, whilst also accepting a handler\n * with current position as a prop triggered when carousel component is interacted with.\n */\nexport const Carousel = ({\n startPosition,\n children,\n onPositionChanged,\n shrinkUnselectedPages = false,\n fullWidthChild = false,\n}: CarouselProps) => {\n const timer = React.useRef<NodeJS.Timeout | string | number | undefined>();\n const isStartPositionSet = typeof startPosition !== \"undefined\";\n const [currentPosition, setCurrentPosition] = useState(startPosition || 0);\n const [smoothScrolling, setSmoothScrolling] = useState(!isStartPositionSet);\n const scrollRef = useRef<HTMLUListElement>(null);\n\n // remove null children\n const childArray = React.Children.toArray(children).filter(Boolean);\n\n const setPosition = (to: number) => {\n if (currentPosition === to) return;\n setCurrentPosition(to);\n\n if (timer) {\n clearTimeout(timer?.current);\n }\n timer.current = setTimeout(() => {\n if (onPositionChanged && smoothScrolling) {\n // Timer to debounce and only send the new position at the end of the scroll.\n // When using external state which also sets start position,\n // if scrolling to a new position past multiple cards,\n // it would effectively scroll to the past the first adjacent card,\n // receive the postion of the first card and stop there before it scrolls any further.\n onPositionChanged(to);\n }\n }, 500);\n };\n\n const next = () => {\n scrollToPosition(currentPosition + 1);\n };\n\n const previous = () => {\n scrollToPosition(currentPosition - 1);\n };\n\n const scrollToPosition = (to: number) => {\n if (scrollRef?.current) {\n const containerWidth = scrollRef.current.scrollWidth;\n const totalItems = scrollRef.current.children.length;\n const atBegining = to === 0;\n const atEnd = to === totalItems - 1;\n\n const item = scrollRef.current.children[to] as HTMLElement;\n if (!item) return;\n const newScroll = item.offsetLeft;\n\n if (atBegining) {\n scrollRef.current.scrollTo(0, 0);\n } else if (atEnd) {\n scrollRef.current.scrollTo(containerWidth, 0);\n } else {\n scrollRef.current.scrollTo(newScroll, 0);\n }\n\n // always resume normal smooth scrolling behaviour after the first scroll\n if (!smoothScrolling) {\n setSmoothScrolling(true);\n }\n }\n };\n\n // Stop smooth scrolling when moving to a starting position\n useEffect(() => {\n if (isStartPositionSet) {\n setSmoothScrolling(false);\n }\n }, [startPosition]);\n\n useEffect(() => {\n if (!smoothScrolling) {\n scrollToPosition(startPosition || 0);\n }\n }, [smoothScrolling]);\n\n const onlyChild = childArray.length === 1;\n\n return (\n <>\n <Box>\n <CarouselWrapper>\n <CarouselScrollArea\n ref={scrollRef}\n aria-live=\"assertive\"\n $smoothScrolling={smoothScrolling}\n tabIndex={0}\n >\n {childArray.map((child, index) => {\n const isSelected = index === currentPosition;\n const keyString = `card-${index}`;\n return (\n <CarouselCard\n key={keyString}\n $onlyChild={onlyChild}\n $fullWidthChild={fullWidthChild}\n >\n <InView\n threshold={0.5}\n as=\"div\"\n onChange={(inView) => {\n if (inView) {\n setPosition(index);\n }\n }}\n >\n <CarouselCardInner\n $onlyChild={onlyChild}\n $isSelected={isSelected}\n $shrinkUnselectedPages={shrinkUnselectedPages}\n $fullWidthChild={fullWidthChild}\n >\n {child}\n </CarouselCardInner>\n </InView>\n </CarouselCard>\n );\n })}\n </CarouselScrollArea>\n </CarouselWrapper>\n </Box>\n {childArray.length > 1 ? (\n <Box>\n <Dots\n count={childArray.length}\n currentPosition={currentPosition}\n scrollToPosition={scrollToPosition}\n next={next}\n previous={previous}\n />\n </Box>\n ) : null}\n </>\n );\n};\n\nexport default memo(Carousel);\n"],"names":["Carousel","
|
|
1
|
+
{"version":3,"file":"index.js","sources":["../../../../src/components/Carousel/index.tsx"],"sourcesContent":["import React, {\n useState,\n useRef,\n useEffect,\n memo,\n type ReactNode,\n} from \"react\";\nimport { InView } from \"react-intersection-observer\";\n\nimport { Box } from \"../Box\";\nimport { Dots } from \"./Dots\";\n\nimport {\n CarouselWrapper,\n CarouselCardInner,\n CarouselCard,\n CarouselScrollArea,\n} from \"./styles\";\n\nexport type CarouselProps = {\n /** Index in which the carousel is scrolled to on mount */\n startPosition?: number;\n /** call back for on position changed first prop is the possition */\n onPositionChanged?: (position: number) => void;\n /** show item left and right of current smaller than current item */\n shrinkUnselectedPages?: boolean;\n /** childrent item of the carousel */\n children?: ReactNode;\n /** set carousel image to full width of parent */\n fullWidthChild?: boolean;\n};\n\n/**\n *\n * Lightweight carousel component that works with mouse and touch events,\n * Accepts react node array as children so will work with any html element as a child.\n *\n * Also works with external state that holds carousel postion,\n * by accepting a starting position as a prop, whilst also accepting a handler\n * with current position as a prop triggered when carousel component is interacted with.\n */\nexport const Carousel = ({\n startPosition,\n children,\n onPositionChanged,\n shrinkUnselectedPages = false,\n fullWidthChild = false,\n}: CarouselProps) => {\n const timer = React.useRef<NodeJS.Timeout | string | number | undefined>(\n undefined,\n );\n const isStartPositionSet = typeof startPosition !== \"undefined\";\n const [currentPosition, setCurrentPosition] = useState(startPosition || 0);\n const [smoothScrolling, setSmoothScrolling] = useState(!isStartPositionSet);\n const scrollRef = useRef<HTMLUListElement>(null);\n\n // remove null children\n const childArray = React.Children.toArray(children).filter(Boolean);\n\n const setPosition = (to: number) => {\n if (currentPosition === to) return;\n setCurrentPosition(to);\n\n if (timer) {\n clearTimeout(timer?.current);\n }\n timer.current = setTimeout(() => {\n if (onPositionChanged && smoothScrolling) {\n // Timer to debounce and only send the new position at the end of the scroll.\n // When using external state which also sets start position,\n // if scrolling to a new position past multiple cards,\n // it would effectively scroll to the past the first adjacent card,\n // receive the postion of the first card and stop there before it scrolls any further.\n onPositionChanged(to);\n }\n }, 500);\n };\n\n const next = () => {\n scrollToPosition(currentPosition + 1);\n };\n\n const previous = () => {\n scrollToPosition(currentPosition - 1);\n };\n\n const scrollToPosition = (to: number) => {\n if (scrollRef?.current) {\n const containerWidth = scrollRef.current.scrollWidth;\n const totalItems = scrollRef.current.children.length;\n const atBegining = to === 0;\n const atEnd = to === totalItems - 1;\n\n const item = scrollRef.current.children[to] as HTMLElement;\n if (!item) return;\n const newScroll = item.offsetLeft;\n\n if (atBegining) {\n scrollRef.current.scrollTo(0, 0);\n } else if (atEnd) {\n scrollRef.current.scrollTo(containerWidth, 0);\n } else {\n scrollRef.current.scrollTo(newScroll, 0);\n }\n\n // always resume normal smooth scrolling behaviour after the first scroll\n if (!smoothScrolling) {\n setSmoothScrolling(true);\n }\n }\n };\n\n // Stop smooth scrolling when moving to a starting position\n useEffect(() => {\n if (isStartPositionSet) {\n setSmoothScrolling(false);\n }\n }, [startPosition]);\n\n useEffect(() => {\n if (!smoothScrolling) {\n scrollToPosition(startPosition || 0);\n }\n }, [smoothScrolling]);\n\n const onlyChild = childArray.length === 1;\n\n return (\n <>\n <Box>\n <CarouselWrapper>\n <CarouselScrollArea\n ref={scrollRef}\n aria-live=\"assertive\"\n $smoothScrolling={smoothScrolling}\n tabIndex={0}\n >\n {childArray.map((child, index) => {\n const isSelected = index === currentPosition;\n const keyString = `card-${index}`;\n return (\n <CarouselCard\n key={keyString}\n $onlyChild={onlyChild}\n $fullWidthChild={fullWidthChild}\n >\n <InView\n threshold={0.5}\n as=\"div\"\n onChange={(inView) => {\n if (inView) {\n setPosition(index);\n }\n }}\n >\n <CarouselCardInner\n $onlyChild={onlyChild}\n $isSelected={isSelected}\n $shrinkUnselectedPages={shrinkUnselectedPages}\n $fullWidthChild={fullWidthChild}\n >\n {child}\n </CarouselCardInner>\n </InView>\n </CarouselCard>\n );\n })}\n </CarouselScrollArea>\n </CarouselWrapper>\n </Box>\n {childArray.length > 1 ? (\n <Box>\n <Dots\n count={childArray.length}\n currentPosition={currentPosition}\n scrollToPosition={scrollToPosition}\n next={next}\n previous={previous}\n />\n </Box>\n ) : null}\n </>\n );\n};\n\nexport default memo(Carousel);\n"],"names":["Carousel","startPosition","children","onPositionChanged","shrinkUnselectedPages","fullWidthChild","timer","React","useRef","undefined","isStartPositionSet","currentPosition","setCurrentPosition","useState","smoothScrolling","setSmoothScrolling","scrollRef","childArray","Children","toArray","filter","Boolean","scrollToPosition","to","current","containerWidth","scrollWidth","atBegining","atEnd","length","item","newScroll","offsetLeft","scrollTo","useEffect","onlyChild","createElement","Fragment","Box","CarouselWrapper","CarouselScrollArea","ref","$smoothScrolling","tabIndex","map","child","index","isSelected","keyString","CarouselCard","key","$onlyChild","$fullWidthChild","InView","threshold","as","onChange","inView","clearTimeout","setTimeout","CarouselCardInner","$isSelected","$shrinkUnselectedPages","Dots","count","next","previous","memo"],"mappings":"8VAyCaA,EAAW,EACtBC,gBACAC,WACAC,oBACAC,yBAAwB,EACxBC,kBAAiB,MAEjB,MAAMC,EAAQC,EAAMC,YAClBC,GAEIC,OAA8C,IAAlBT,GAC3BU,EAAiBC,GAAsBC,EAASZ,GAAiB,IACjEa,EAAiBC,GAAsBF,GAAUH,GAClDM,EAAYR,EAAyB,MAGrCS,EAAaV,EAAMW,SAASC,QAAQjB,GAAUkB,OAAOC,SA6BrDC,EAAoBC,IACxB,GAAIP,GAAWQ,QAAS,CACtB,MAAMC,EAAiBT,EAAUQ,QAAQE,YAEnCC,EAAoB,IAAPJ,EACbK,EAAQL,IAFKP,EAAUQ,QAAQtB,SAAS2B,OAEZ,EAE5BC,EAAOd,EAAUQ,QAAQtB,SAASqB,GACxC,IAAKO,EAAM,OACX,MAAMC,EAAYD,EAAKE,WAEnBL,EACFX,EAAUQ,QAAQS,SAAS,EAAG,GACrBL,EACTZ,EAAUQ,QAAQS,SAASR,EAAgB,GAE3CT,EAAUQ,QAAQS,SAASF,EAAW,GAInCjB,GACHC,GAAmB,KAMzBmB,GAAU,KACJxB,GACFK,GAAmB,KAEpB,CAACd,IAEJiC,GAAU,KACHpB,GACHQ,EAAiBrB,GAAiB,KAEnC,CAACa,IAEJ,MAAMqB,EAAkC,IAAtBlB,EAAWY,OAE7B,OACEtB,EAAA6B,cAAA7B,EAAA8B,SAAA,KACE9B,EAAA6B,cAACE,EAAG,KACF/B,EAAA6B,cAACG,EAAe,KACdhC,EAAC6B,cAAAI,GACCC,IAAKzB,EACK,YAAA,YACQ0B,iBAAA5B,EAClB6B,SAAU,GAET1B,EAAW2B,KAAI,CAACC,EAAOC,KACtB,MAAMC,EAAaD,IAAUnC,EACvBqC,EAAY,QAAQF,IAC1B,OACEvC,EAAC6B,cAAAa,EACC,CAAAC,IAAKF,EAASG,WACFhB,EAASiB,gBACJ/C,GAEjBE,EAAA6B,cAACiB,EAAM,CACLC,UAAW,GACXC,GAAG,MACHC,SAAWC,IA1FT,IAAClC,EA2FGkC,GA1FlB9C,KADeY,EA4FauB,KA1FhClC,EAAmBW,GAEfjB,GACFoD,aAAapD,GAAOkB,SAEtBlB,EAAMkB,QAAUmC,YAAW,KACrBxD,GAAqBW,GAMvBX,EAAkBoB,KAEnB,QAgFahB,EAAA6B,cAACwB,EAAiB,CAAAT,WACJhB,EAAS0B,YACRd,EACWe,uBAAA1D,EACPgD,gBAAA/C,GAEhBwC,IAGQ,OAMxB5B,EAAWY,OAAS,EACnBtB,EAAA6B,cAACE,EAAG,KACF/B,EAAA6B,cAAC2B,EAAI,CACHC,MAAO/C,EAAWY,OAClBlB,gBAAiBA,EACjBW,iBAAkBA,EAClB2C,KAlGG,KACX3C,EAAiBX,EAAkB,EAAE,EAkG7BuD,SA/FO,KACf5C,EAAiBX,EAAkB,EAAE,KAiG/B,KACH,EAIQwD,EAAKnE"}
|