@cruk/cruk-react-components 5.0.8 → 6.0.1
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/{src/components → components}/AddressLookup/AddressLookup.stories.d.ts +1 -1
- package/lib/{src/components → components}/AddressLookup/index.d.ts +1 -1
- package/lib/{src/components → components}/Box/Box.stories.d.ts +1 -1
- package/lib/{src/components → components}/Box/index.d.ts +1 -1
- package/lib/{src/components → components}/Button/Button.stories.d.ts +1 -1
- package/lib/{src/components → components}/Button/index.d.ts +1 -1
- package/lib/{src/components → components}/Checkbox/Checkbox.stories.d.ts +1 -1
- package/lib/{src/components → components}/Checkbox/index.d.ts +3 -3
- package/lib/{src/components → components}/Collapse/styles.d.ts +11 -3
- package/lib/{src/components → components}/DateField/styles.d.ts +12 -6
- package/lib/components/ErrorText/styles.d.ts +16 -0
- package/lib/{src/components → components}/Footer/styles.d.ts +3 -9
- package/lib/components/GlobalStyle.d.ts +2 -0
- package/lib/components/GlobalStyleNoFontFace.d.ts +2 -0
- package/lib/{src/components → components}/InfoBox/InfoBox.stories.d.ts +1 -1
- package/lib/{src/components → components}/InfoBox/index.d.ts +1 -1
- package/lib/components/InfoBox/styles.d.ts +13 -0
- package/lib/{src/components → components}/Link/Link.stories.d.ts +4 -1
- package/lib/{src/components → components}/Link/index.d.ts +4 -1
- package/lib/components/Link/styles.d.ts +20 -0
- package/lib/components/Modal/styles.d.ts +32 -0
- package/lib/{src/components → components}/Radio/Radio.stories.d.ts +1 -1
- package/lib/{src/components → components}/Radio/index.d.ts +3 -3
- package/lib/{src/components → components}/RadioConsent/styles.d.ts +6 -3
- package/lib/{src/components → components}/Select/Selelct.stories.d.ts +1 -1
- package/lib/{src/components → components}/Select/index.d.ts +3 -3
- package/lib/{src/components → components}/Text/Text.stories.d.ts +1 -1
- package/lib/{src/components → components}/Text/index.d.ts +1 -1
- package/lib/{src/components → components}/TextAreaField/TextAreaField.stories.d.ts +1 -1
- package/lib/{src/components → components}/TextAreaField/index.d.ts +1 -1
- package/lib/{src/components → components}/TextField/TextField.stories.d.ts +1 -1
- package/lib/{src/components → components}/TextField/index.d.ts +1 -1
- package/lib/{src/components → components}/TextField/styles.d.ts +2 -6
- package/lib/components/ThemeCheatSheet.d.ts +7 -0
- package/lib/{src/hooks → hooks}/useScrollPosition.d.ts +2 -2
- package/lib/node_modules/tslib/tslib.es6.js +1 -1
- package/lib/node_modules/tslib/tslib.es6.js.map +1 -1
- 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 +1 -38
- package/lib/src/components/AddressLookup/styles.js.map +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 +1 -10
- package/lib/src/components/Avatar/styles.js.map +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 +1 -17
- package/lib/src/components/Badge/styles.js.map +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 +1 -13
- package/lib/src/components/Box/styles.js.map +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 +1 -108
- package/lib/src/components/Button/styles.js.map +1 -1
- 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 +1 -96
- package/lib/src/components/Carousel/styles.js.map +1 -1
- 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 +1 -105
- package/lib/src/components/Checkbox/styles.js.map +1 -1
- package/lib/src/components/Collapse/index.js +1 -1
- package/lib/src/components/Collapse/index.js.map +1 -1
- package/lib/src/components/Collapse/styles.js +1 -31
- package/lib/src/components/Collapse/styles.js.map +1 -1
- package/lib/src/components/DateField/index.js +1 -1
- package/lib/src/components/DateField/index.js.map +1 -1
- package/lib/src/components/DateField/styles.js +1 -26
- package/lib/src/components/DateField/styles.js.map +1 -1
- package/lib/src/components/Divider.js +1 -17
- package/lib/src/components/Divider.js.map +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.js +1 -5
- package/lib/src/components/ErrorText/styles.js.map +1 -1
- package/lib/src/components/Flex.js +1 -7
- 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/src/components/Footer/index.js +1 -1
- package/lib/src/components/Footer/index.js.map +1 -1
- package/lib/src/components/Footer/styles.js +1 -69
- package/lib/src/components/Footer/styles.js.map +1 -1
- package/lib/src/components/GlobalStyle.js +1 -37
- package/lib/src/components/GlobalStyle.js.map +1 -1
- package/lib/src/components/GlobalStyleNoFontFace.js +1 -37
- package/lib/src/components/GlobalStyleNoFontFace.js.map +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 +1 -109
- package/lib/src/components/Header/styles.js.map +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 +1 -75
- package/lib/src/components/Heading/styles.js.map +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 +1 -10
- package/lib/src/components/IconFa/styles.js.map +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.js +1 -12
- 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 +1 -15
- package/lib/src/components/LabelWrapper/styles.js.map +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 +1 -34
- package/lib/src/components/LegendWrapper/styles.js.map +1 -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.js +1 -29
- package/lib/src/components/Link/styles.js.map +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 +1 -45
- package/lib/src/components/Loader/styles.js.map +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.js +1 -59
- package/lib/src/components/Modal/styles.js.map +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 +1 -92
- package/lib/src/components/Pagination/styles.js.map +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 +1 -81
- package/lib/src/components/PopOver/styles.js.map +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 +1 -132
- package/lib/src/components/ProgressBar/styles.js.map +1 -1
- 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 +1 -125
- package/lib/src/components/Radio/styles.js.map +1 -1
- package/lib/src/components/RadioConsent/index.js +1 -1
- package/lib/src/components/RadioConsent/index.js.map +1 -1
- package/lib/src/components/RadioConsent/styles.js +1 -26
- package/lib/src/components/RadioConsent/styles.js.map +1 -1
- 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 +1 -41
- 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/src/components/Step/index.js +1 -1
- package/lib/src/components/Step/index.js.map +1 -1
- package/lib/src/components/Step/styles.js +1 -79
- package/lib/src/components/Step/styles.js.map +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 +1 -19
- package/lib/src/components/Text/styles.js.map +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 +1 -29
- package/lib/src/components/TextAreaField/styles.js.map +1 -1
- package/lib/src/components/TextField/index.js +1 -1
- package/lib/src/components/TextField/index.js.map +1 -1
- package/lib/src/components/TextField/styles.js +1 -110
- package/lib/src/components/TextField/styles.js.map +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 +1 -59
- package/lib/src/components/Totaliser/styles.js.map +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 +1 -21
- package/lib/src/components/UserBlock/styles.js.map +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/src/hooks/useLayoutEffectBrowser.js +1 -1
- package/lib/src/hooks/useLayoutEffectBrowser.js.map +1 -1
- 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/src/utils/Helper.js +1 -1
- package/lib/src/utils/Helper.js.map +1 -1
- 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 +15 -15
- package/lib/.storybook/main.d.ts +0 -3
- package/lib/.storybook/preview.d.ts +0 -3
- package/lib/src/components/ErrorText/styles.d.ts +0 -8
- package/lib/src/components/GlobalStyle.d.ts +0 -2
- package/lib/src/components/GlobalStyleNoFontFace.d.ts +0 -2
- package/lib/src/components/InfoBox/styles.d.ts +0 -10
- package/lib/src/components/Link/styles.d.ts +0 -12
- package/lib/src/components/Modal/styles.d.ts +0 -21
- package/lib/src/components/ThemeCheatSheet.d.ts +0 -7
- /package/lib/{src/components → components}/AddressLookup/AddressLookUp.test.cypress.d.ts +0 -0
- /package/lib/{src/components → components}/AddressLookup/styles.d.ts +0 -0
- /package/lib/{src/components → components}/AllThemesWrapper.d.ts +0 -0
- /package/lib/{src/components → components}/Avatar/Avatar.stories.d.ts +0 -0
- /package/lib/{src/components → components}/Avatar/Avatar.test.cypress.d.ts +0 -0
- /package/lib/{src/components → components}/Avatar/index.d.ts +0 -0
- /package/lib/{src/components → components}/Avatar/styles.d.ts +0 -0
- /package/lib/{src/components → components}/Badge/Badge.stories.d.ts +0 -0
- /package/lib/{src/components → components}/Badge/Badge.test.cypress.d.ts +0 -0
- /package/lib/{src/components → components}/Badge/index.d.ts +0 -0
- /package/lib/{src/components → components}/Badge/styles.d.ts +0 -0
- /package/lib/{src/components → components}/Box/Box.test.cypress.d.ts +0 -0
- /package/lib/{src/components → components}/Box/styles.d.ts +0 -0
- /package/lib/{src/components → components}/Button/Button.test.cypress.d.ts +0 -0
- /package/lib/{src/components → components}/Button/styles.d.ts +0 -0
- /package/lib/{src/components → components}/Carousel/Carousel.stories.d.ts +0 -0
- /package/lib/{src/components → components}/Carousel/Carousel.test.cypress.d.ts +0 -0
- /package/lib/{src/components → components}/Carousel/Dots.d.ts +0 -0
- /package/lib/{src/components → components}/Carousel/index.d.ts +0 -0
- /package/lib/{src/components → components}/Carousel/styles.d.ts +0 -0
- /package/lib/{src/components → components}/Checkbox/CheckBox.test.cypress.d.ts +0 -0
- /package/lib/{src/components → components}/Checkbox/styles.d.ts +0 -0
- /package/lib/{src/components → components}/Collapse/Collapse.stories.d.ts +0 -0
- /package/lib/{src/components → components}/Collapse/Collapse.test.cypress.d.ts +0 -0
- /package/lib/{src/components → components}/Collapse/index.d.ts +0 -0
- /package/lib/{src/components → components}/DateField/DateField.stories.d.ts +0 -0
- /package/lib/{src/components → components}/DateField/DateField.test.cypress.d.ts +0 -0
- /package/lib/{src/components → components}/DateField/index.d.ts +0 -0
- /package/lib/{src/components → components}/Divider.d.ts +0 -0
- /package/lib/{src/components → components}/ErrorText/ErrorText.stories.d.ts +0 -0
- /package/lib/{src/components → components}/ErrorText/ErrorText.test.cypress.d.ts +0 -0
- /package/lib/{src/components → components}/ErrorText/index.d.ts +0 -0
- /package/lib/{src/components → components}/Flex.d.ts +0 -0
- /package/lib/{src/components → components}/Fontface.d.ts +0 -0
- /package/lib/{src/components → components}/Footer/Footer.stories.d.ts +0 -0
- /package/lib/{src/components → components}/Footer/Footer.test.cypress.d.ts +0 -0
- /package/lib/{src/components → components}/Footer/index.d.ts +0 -0
- /package/lib/{src/components → components}/Header/Header.stories.d.ts +0 -0
- /package/lib/{src/components → components}/Header/Header.test.cypress.d.ts +0 -0
- /package/lib/{src/components → components}/Header/index.d.ts +0 -0
- /package/lib/{src/components → components}/Header/styles.d.ts +0 -0
- /package/lib/{src/components → components}/Heading/Heading.stories.d.ts +0 -0
- /package/lib/{src/components → components}/Heading/Heading.test.cypress.d.ts +0 -0
- /package/lib/{src/components → components}/Heading/index.d.ts +0 -0
- /package/lib/{src/components → components}/Heading/styles.d.ts +0 -0
- /package/lib/{src/components → components}/IconFa/IconFa.stories.d.ts +0 -0
- /package/lib/{src/components → components}/IconFa/IconFa.test.cypress.d.ts +0 -0
- /package/lib/{src/components → components}/IconFa/index.d.ts +0 -0
- /package/lib/{src/components → components}/IconFa/styles.d.ts +0 -0
- /package/lib/{src/components → components}/InfoBox/InfoBox.test.cypress.d.ts +0 -0
- /package/lib/{src/components → components}/LabelWrapper/index.d.ts +0 -0
- /package/lib/{src/components → components}/LabelWrapper/styles.d.ts +0 -0
- /package/lib/{src/components → components}/LegendWrapper/LegendWrapper.stories.d.ts +0 -0
- /package/lib/{src/components → components}/LegendWrapper/LegendWrapper.test.cypress.d.ts +0 -0
- /package/lib/{src/components → components}/LegendWrapper/index.d.ts +0 -0
- /package/lib/{src/components → components}/LegendWrapper/styles.d.ts +0 -0
- /package/lib/{src/components → components}/Link/Link.test.cypress.d.ts +0 -0
- /package/lib/{src/components → components}/Loader/Loader.stories.d.ts +0 -0
- /package/lib/{src/components → components}/Loader/Loader.test.cypress.d.ts +0 -0
- /package/lib/{src/components → components}/Loader/index.d.ts +0 -0
- /package/lib/{src/components → components}/Loader/styles.d.ts +0 -0
- /package/lib/{src/components → components}/Modal/Modal.stories.d.ts +0 -0
- /package/lib/{src/components → components}/Modal/Modal.test.cypress.d.ts +0 -0
- /package/lib/{src/components → components}/Modal/index.d.ts +0 -0
- /package/lib/{src/components → components}/Pagination/Pagination.stories.d.ts +0 -0
- /package/lib/{src/components → components}/Pagination/Pagination.test.cypress.d.ts +0 -0
- /package/lib/{src/components → components}/Pagination/index.d.ts +0 -0
- /package/lib/{src/components → components}/Pagination/styles.d.ts +0 -0
- /package/lib/{src/components → components}/PopOver/PopOver.test.cypress.d.ts +0 -0
- /package/lib/{src/components → components}/PopOver/Popover.stories.d.ts +0 -0
- /package/lib/{src/components → components}/PopOver/index.d.ts +0 -0
- /package/lib/{src/components → components}/PopOver/styles.d.ts +0 -0
- /package/lib/{src/components → components}/ProgressBar/ProgressBar.stories.d.ts +0 -0
- /package/lib/{src/components → components}/ProgressBar/ProgressBar.test.cypress.d.ts +0 -0
- /package/lib/{src/components → components}/ProgressBar/index.d.ts +0 -0
- /package/lib/{src/components → components}/ProgressBar/styles.d.ts +0 -0
- /package/lib/{src/components → components}/Radio/Radio.test.cypress.d.ts +0 -0
- /package/lib/{src/components → components}/Radio/styles.d.ts +0 -0
- /package/lib/{src/components → components}/RadioConsent/Radio.stories.d.ts +0 -0
- /package/lib/{src/components → components}/RadioConsent/RadioConsent.test.cypress.d.ts +0 -0
- /package/lib/{src/components → components}/RadioConsent/index.d.ts +0 -0
- /package/lib/{src/components → components}/Select/Select.test.cypress.d.ts +0 -0
- /package/lib/{src/components → components}/Select/styles.d.ts +0 -0
- /package/lib/{src/components → components}/Spacing/index.d.ts +0 -0
- /package/lib/{src/components → components}/Step/Step.stories.d.ts +0 -0
- /package/lib/{src/components → components}/Step/Step.test.cypress.d.ts +0 -0
- /package/lib/{src/components → components}/Step/index.d.ts +0 -0
- /package/lib/{src/components → components}/Step/styles.d.ts +0 -0
- /package/lib/{src/components → components}/Text/Text.test.cypress.d.ts +0 -0
- /package/lib/{src/components → components}/Text/styles.d.ts +0 -0
- /package/lib/{src/components → components}/TextAreaField/TextAreaField.test.cypress.d.ts +0 -0
- /package/lib/{src/components → components}/TextAreaField/styles.d.ts +0 -0
- /package/lib/{src/components → components}/TextField/TextField.test.cypress.d.ts +0 -0
- /package/lib/{src/components → components}/Totaliser/Totaliser.stories.d.ts +0 -0
- /package/lib/{src/components → components}/Totaliser/Totaliser.test.cypress.d.ts +0 -0
- /package/lib/{src/components → components}/Totaliser/index.d.ts +0 -0
- /package/lib/{src/components → components}/Totaliser/styles.d.ts +0 -0
- /package/lib/{src/components → components}/UserBlock/UserBlock.stories.d.ts +0 -0
- /package/lib/{src/components → components}/UserBlock/UserBlock.test.cypress.d.ts +0 -0
- /package/lib/{src/components → components}/UserBlock/index.d.ts +0 -0
- /package/lib/{src/components → components}/UserBlock/styles.d.ts +0 -0
- /package/lib/{src/components → components}/index.d.ts +0 -0
- /package/lib/{src/hooks → hooks}/useEffectBrowser.d.ts +0 -0
- /package/lib/{src/hooks → hooks}/useKey.d.ts +0 -0
- /package/lib/{src/hooks → hooks}/useLayoutEffectBrowser.d.ts +0 -0
- /package/lib/{src/themes → themes}/bowelbabe.d.ts +0 -0
- /package/lib/{src/themes → themes}/cruk.d.ts +0 -0
- /package/lib/{src/themes → themes}/rfl.d.ts +0 -0
- /package/lib/{src/themes → themes}/su2c.d.ts +0 -0
- /package/lib/{src/types.d.ts → types.d.ts} +0 -0
- /package/lib/{src/utils → utils}/Helper.d.ts +0 -0
- /package/lib/{src/utils → utils}/__tests__/testHelpers.test.d.ts +0 -0
- /package/lib/{src/utils → utils}/debounce.d.ts +0 -0
- /package/lib/{src/utils → utils}/themeUtils.d.ts +0 -0
|
@@ -1,109 +1,2 @@
|
|
|
1
|
-
import o,{css as r}from"styled-components";
|
|
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};
|
|
1
|
+
import{__makeTemplateObject as n}from"../../../node_modules/tslib/tslib.es6.js";import o,{css as r}from"styled-components";var t,e,c,a,i,l,d,s,u="3rem",b="4rem",m=o.span(t||(t=n(["\n margin-left: ",";\n &:first-of-type {\n margin-left: 0;\n }\n"],["\n margin-left: ",";\n &:first-of-type {\n margin-left: 0;\n }\n"])),(function(n){return n.theme.spacing.xxs})),h=o.button(s||(s=n(["\n box-sizing: border-box;\n min-height: ",";\n height: min-content;\n display: inline-block;\n vertical-align: middle;\n\n padding: ",";\n width: ",";\n min-width: ",";\n\n border-radius: ",";\n border-style: solid;\n border-width: ",";\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 font-family: ",";\n font-weight: ",";\n text-align: center;\n text-transform: ",";\n text-decoration: ",";\n\n &:focus-visible {\n outline: auto;\n }\n\n ","\n\n ","\n\n ","\n \n ","\n\n ","\n\n ","\n"],["\n box-sizing: border-box;\n min-height: ",";\n height: min-content;\n display: inline-block;\n vertical-align: middle;\n\n padding: ",";\n width: ",";\n min-width: ",";\n\n border-radius: ",";\n border-style: solid;\n border-width: ",";\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 font-family: ",";\n font-weight: ",";\n text-align: center;\n text-transform: ",";\n text-decoration: ",";\n\n &:focus-visible {\n outline: auto;\n }\n\n ","\n\n ","\n\n ","\n \n ","\n\n ","\n\n ","\n"])),u,(function(n){var o=n.theme;return n.$isIconButton?"0":"calc( (".concat(u," - ( ").concat(o.button.buttonBorderThickness," * 2) - ").concat(o.typography.lineHeight," ) / 2) ").concat(o.button.horizontalPadding)}),(function(n){return n.$isIconButton?"".concat(u):"auto"}),(function(n){return n.$isIconButton?"".concat(u):"auto"}),(function(n){return n.theme.button.borderRadius}),(function(n){return n.theme.button.buttonBorderThickness}),(function(n){return n.theme.fontSizes.m}),(function(n){return n.theme.typography.fontFamilyButtons}),(function(n){return n.theme.typography.fontWeightButtons}),(function(n){return n.theme.button.textTransform}),(function(n){return n.theme.button.textDecoration}),(function(o){return"primary"===o.$appearance&&r(e||(e=n(["\n background-color: ",";\n border-color: ",";\n color: "," !important;\n &:focus,\n &:hover {\n background-color: ",";\n border-color: ",";\n color: "," !important;\n }\n &:disabled {\n cursor: not-allowed;\n background-color: ",";\n color: "," !important;\n border-color: ",";\n }\n "],["\n background-color: ",";\n border-color: ",";\n color: "," !important;\n &:focus,\n &:hover {\n background-color: ",";\n border-color: ",";\n color: "," !important;\n }\n &:disabled {\n cursor: not-allowed;\n background-color: ",";\n color: "," !important;\n border-color: ",";\n }\n "])),o.theme.colors.buttonPrimaryBackground,o.theme.colors.buttonPrimaryBorder,o.theme.colors.buttonPrimaryText,o.theme.colors.buttonPrimaryBackgroundHover,o.theme.colors.buttonPrimaryBorderHover,o.theme.colors.buttonPrimaryTextHover,o.theme.colors.buttonPrimaryDisabledBackground,o.theme.colors.buttonPrimaryDisabledText,o.theme.colors.buttonPrimaryDisabledBorder)}),(function(o){return"secondary"===o.$appearance&&r(c||(c=n(["\n background-color: ",";\n border-color: ",";\n color: "," !important;\n &:focus,\n &:hover {\n background-color: ",";\n border-color: ",";\n color: "," !important;\n }\n &:disabled {\n cursor: not-allowed;\n background-color: ",";\n color: "," !important;\n border-color: ",";\n }\n "],["\n background-color: ",";\n border-color: ",";\n color: "," !important;\n &:focus,\n &:hover {\n background-color: ",";\n border-color: ",";\n color: "," !important;\n }\n &:disabled {\n cursor: not-allowed;\n background-color: ",";\n color: "," !important;\n border-color: ",";\n }\n "])),o.theme.colors.buttonSecondaryBackground,o.theme.colors.buttonSecondaryBorder,o.theme.colors.buttonSecondaryText,o.theme.colors.buttonSecondaryBackgroundHover,o.theme.colors.buttonSecondaryBorderHover,o.theme.colors.buttonSecondaryTextHover,o.theme.colors.buttonSecondaryDisabledBackground,o.theme.colors.buttonSecondaryDisabledText,o.theme.colors.buttonSecondaryDisabledBorder)}),(function(o){return"tertiary"===o.$appearance&&r(a||(a=n(["\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: ",";\n &:focus,\n &:hover {\n color: ",";\n }\n &:disabled {\n cursor: not-allowed;\n background-color: transparent;\n color: "," !important;\n border-color: transparent;\n }\n "],["\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: ",";\n &:focus,\n &:hover {\n color: ",";\n }\n &:disabled {\n cursor: not-allowed;\n background-color: transparent;\n color: "," !important;\n border-color: transparent;\n }\n "])),o.theme.colors.buttonTertiaryText,o.theme.colors.buttonTertiaryTextHover,o.theme.colors.buttonTertiaryDisabledText)}),(function(o){var t=o.theme,e=o.$size,c=o.$isIconButton;return"l"===e&&r(i||(i=n(["\n min-height: ",";\n border-radius: ",";\n padding: ",";\n min-width: ",";\n height: ",";\n "],["\n min-height: ",";\n border-radius: ",";\n padding: ",";\n min-width: ",";\n height: ",";\n "])),b,t.button.borderRadiusLarge,c?"0":"calc( (".concat(b," - ( ").concat(t.button.buttonBorderThickness," * 2) - ").concat(t.typography.lineHeight," ) / 2) ").concat(t.spacing.m),c?"".concat(b):"auto",c?"".concat(b):"min-content")}),(function(o){return o.$full&&r(l||(l=n(["\n width: 100%;\n "],["\n width: 100%;\n "])))}),(function(o){return o.$css&&r(d||(d=n(["\n ","\n "],["\n ","\n "])),o.$css)}));export{m as Spacer,h as StyledButton};
|
|
109
2
|
//# 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","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":"
|
|
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","templateObject_1","__makeTemplateObject","_a","theme","spacing","xxs","StyledButton","button","$isIconButton","concat","buttonBorderThickness","typography","lineHeight","horizontalPadding","borderRadius","fontSizes","m","fontFamilyButtons","fontWeightButtons","textTransform","textDecoration","props","$appearance","css","colors","buttonPrimaryBackground","buttonPrimaryBorder","buttonPrimaryText","buttonPrimaryBackgroundHover","buttonPrimaryBorderHover","buttonPrimaryTextHover","buttonPrimaryDisabledBackground","buttonPrimaryDisabledText","buttonPrimaryDisabledBorder","templateObject_3","buttonSecondaryBackground","buttonSecondaryBorder","buttonSecondaryText","buttonSecondaryBackgroundHover","buttonSecondaryBorderHover","buttonSecondaryTextHover","buttonSecondaryDisabledBackground","buttonSecondaryDisabledText","buttonSecondaryDisabledBorder","templateObject_4","buttonTertiaryText","buttonTertiaryTextHover","buttonTertiaryDisabledText","$size","templateObject_5","borderRadiusLarge","$full","templateObject_6","$css","templateObject_7"],"mappings":"2HAIA,oBAAMA,EAAgB,OAChBC,EAAsB,OAEfC,EAASC,EAAOC,KAAIC,IAAAA,EAAAC,EAAA,CAAA,oBAAA,sDAAA,CAAsB,oBACN,yDAAhC,SAACC,GAAc,OAAPA,EAAAC,MAAaC,QAAQC,GAAd,IAMnBC,EAAeR,EAAOS,unBAQjC,8CAE2B,gGAQ6H,eAE3G,mBAEA,yBAEY,8CAEQ,8IAY1D,qBAKgB,qBAKA,+CAEoC,yBACE,0DAwB1D,SAqBA,SAqBA,WAYA,SAMA,SAMA,QAnIWZ,GAKH,SAACO,OAAEC,EAAKD,EAAAC,MACjB,OADgCD,EAAAM,cAE5B,IACA,iBAAUb,EAAa,SAAAc,OAAQN,EAAMI,OAAOG,sBAAqB,YAAAD,OAAWN,EAAMQ,WAAWC,WAAU,YAAAH,OAAWN,EAAMI,OAAOM,kBAFnI,IAGO,SAACX,GACR,OADuBA,EAAAM,cACP,GAAAC,OAAGd,GAAkB,MAArC,IACW,SAACO,GACZ,OAD2BA,EAAAM,cACX,GAAAC,OAAGd,GAAkB,MAArC,IAEe,SAACO,GAAc,OAAPA,EAAAC,MAAaI,OAAOO,YAAb,IAEhB,SAACZ,GAAc,OAAPA,EAAAC,MAAaI,OAAOG,qBAAb,IAQlB,SAACR,GAIR,OAFYA,EAAAC,MAAAY,UAAAC,CAEZ,IACS,SAACd,GAIV,OAF6BA,EAAAC,MAAAQ,WAAAM,iBAE7B,IACS,SAACf,GAIV,OAF6BA,EAAAC,MAAAQ,WAAAO,iBAE7B,IAEY,SAAChB,GAAc,OAAPA,EAAAC,MAAaI,OAAOY,aAAb,IACd,SAACjB,GAAc,OAAPA,EAAAC,MAAaI,OAAOa,cAAb,IAMhC,SAACC,GACD,MAAsB,YAAtBA,EAAMC,aACNC,yYAAG,6BAC6D,0BACR,mBACT,4EAGwB,4BACR,qBACT,sGAIoB,qBACjB,uCACS,sBAb5CF,EAAMlB,MAAMqB,OAAOC,wBACvBJ,EAAMlB,MAAMqB,OAAOE,oBAC1BL,EAAMlB,MAAMqB,OAAOG,kBAGNN,EAAMlB,MAAMqB,OAAOI,6BACvBP,EAAMlB,MAAMqB,OAAOK,yBAC1BR,EAAMlB,MAAMqB,OAAOM,uBAIRT,EAAMlB,MAAMqB,OAAOO,gCAC9BV,EAAMlB,MAAMqB,OAAOQ,0BACZX,EAAMlB,MAAMqB,OAAOS,4BAfvC,IAmBA,SAACZ,GACD,MAAsB,cAAtBA,EAAMC,aACNC,EAAGW,IAAAA,EAAAjC,EAAA,CAAA,6BAAA,0BAAA,mBAAA,4EAAA,4BAAA,qBAAA,sGAAA,qBAAA,uCAAA,oBAAA,CAAA,6BAC+D,0BACR,mBACT,4EAGwB,4BACR,qBACT,sGAKhB,qBACmB,uCACS,sBAd9CoB,EAAMlB,MAAMqB,OAAOW,0BACvBd,EAAMlB,MAAMqB,OAAOY,sBAC1Bf,EAAMlB,MAAMqB,OAAOa,oBAGNhB,EAAMlB,MAAMqB,OAAOc,+BACvBjB,EAAMlB,MAAMqB,OAAOe,2BAC1BlB,EAAMlB,MAAMqB,OAAOgB,yBAIRnB,EAAMlB,MAAMqB,OAC7BiB,kCACMpB,EAAMlB,MAAMqB,OAAOkB,4BACZrB,EAAMlB,MAAMqB,OAAOmB,8BAhBvC,IAoBA,SAACtB,GACD,MAAsB,aAAtBA,EAAMC,aACNC,EAAGqB,IAAAA,EAAA3C,EAAA,CAAA,4KAAA,sDAAA,wHAAA,mEAAA,CAAA,4KAM6C,sDAGO,wHAKG,qEAR/CoB,EAAMlB,MAAMqB,OAAOqB,mBAGjBxB,EAAMlB,MAAMqB,OAAOsB,wBAKnBzB,EAAMlB,MAAMqB,OAAOuB,2BAfhC,IAoBA,SAAC7C,GAAE,IAAAC,UAAO6C,EAAK9C,EAAA8C,MAAExC,EAAaN,EAAAM,cAC9B,MAAU,MAAVwC,GACAzB,EAAG0B,IAAAA,EAAAhD,EAAA,CAAA,uBAAA,2BAAA,qBAAA,uBAAA,oBAAA,WAAA,CAAA,uBACgC,2BACc,qBAG8F,uBAC/E,oBACI,aANpDL,EACGO,EAAMI,OAAO2C,kBACnB1C,EACP,IACA,iBAAUZ,EAAmB,SAAAa,OAAQN,EAAMI,OAAOG,sBAAqB,YAAAD,OAAWN,EAAMQ,WAAWC,WAAU,YAAAH,OAAWN,EAAMC,QAAQY,GAC7HR,EAAgB,GAAGC,OAAAb,GAAwB,OAC9CY,EAAgB,GAAGC,OAAAb,GAAwB,cARvD,IAWA,SAACyB,GACD,OAAAA,EAAM8B,OACN5B,EAAG6B,IAAAA,EAAAnD,EAAA,CAAA,8BAAA,CAAA,gCADH,IAKA,SAACoB,GACD,OAAAA,EAAMgC,MACN9B,EAAG+B,IAAAA,EAAArD,EAAA,CAAA,WAAA,UAAA,CAAA,WACW,YAAVoB,EAAMgC,KAFV"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import e from"react";import{faCaretLeft as
|
|
1
|
+
import e from"react";import{faCaretLeft as n,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 l,VerticalAlign as c,ScreenReaderOnly as a,DotContainer as i,Dot as s}from"./styles.js";var u=function(u){var m=u.count,d=u.currentPosition,f=void 0===d?0:d,E=u.scrollToPosition,p=u.next,v=u.previous,x=f!==m-1,k=0!==f,b=Array.from({length:m},(function(e,n){return"arrayIndex".concat(n)}));return e.createElement(o,null,e.createElement(l,{disabled:!k,"aria-label":"previous",onClick:function(){v()}},e.createElement(c,null,e.createElement(r,{faIcon:n,size:"1.25em"}),e.createElement(a,null,"Scroll carousel to previous index"))),e.createElement(i,{$count:m},b.map((function(n,t){var r=t===f;return e.createElement(s,{key:n,role:"switch","aria-checked":r,onClick:function(){E(t)},$selected:r},e.createElement(a,null,"Scroll carousel to index ".concat(t)))}))),e.createElement(l,{disabled:!x,"aria-label":"next",onClick:function(){p()}},e.createElement(c,null,e.createElement(r,{faIcon:t,size:"1.25em"}),e.createElement(a,null,"Scroll carousel to previous index"))))};export{u as Dots,u 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","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":"
|
|
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","_a","count","_b","currentPosition","scrollToPosition","next","previous","moreOnRight","moreOnLeft","countArray","Array","from","length","e","i","concat","React","ButtonWrapper","createElement","CarouselButton","disabled","onClick","VerticalAlign","IconFa","faIcon","faCaretLeft","size","ScreenReaderOnly","DotContainer","$count","map","item","index","isSelected","Dot","key","role","faCaretRight"],"mappings":"sTAcO,IAAMA,EAAO,SAACC,GACnB,IAAAC,UACAC,EAAAF,EAAAG,gBAAAA,aAAkB,EAACD,EACnBE,qBACAC,EAAIL,EAAAK,KACJC,EAAQN,EAAAM,SAQFC,EAAcJ,IAAoBF,EAAQ,EAC1CO,EAAiC,IAApBL,EACbM,EAAaC,MAAMC,KAAK,CAAEC,OAAQX,IAAS,SAACY,EAAGC,GAAM,MAAA,aAAAC,OAAaD,EAAG,IAE3E,OACEE,gBAACC,EAAa,KACZD,EAACE,cAAAC,EACC,CAAAC,UAAWZ,EACA,aAAA,WACXa,QAAS,WACPf,MAGFU,EAAAE,cAACI,EAAa,KACZN,EAACE,cAAAK,GAAOC,OAAQC,EAAaC,KAAK,WAClCV,EAACE,cAAAS,EAAqE,KAAA,uCAI1EX,EAACE,cAAAU,EAAqB,CAAAC,OAAA5B,GACnBQ,EAAWqB,KAAI,SAACC,EAAMC,GACrB,IAAMC,EAAaD,IAAU7B,EAI7B,OACEa,EAACE,cAAAgB,GACCC,IAAKJ,EACLK,KAAK,wBACSH,EACdZ,QARa,WACfjB,EAAiB4B,EAClB,YAOcC,GAEXjB,EAACE,cAAAS,OAAkB,4BAA4BZ,OAAAiB,IAGrD,KAGFhB,EAACE,cAAAC,EACC,CAAAC,UAAWb,EACA,aAAA,OACXc,QAAS,WACPhB,MAGFW,EAAAE,cAACI,EAAa,KACZN,EAACE,cAAAK,GAAOC,OAAQa,EAAcX,KAAK,WACnCV,EAAAE,cAACS,EAAqE,KAAA,uCAKhF"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import e,{memo as t,useState as
|
|
1
|
+
import e,{memo as t,useState as n,useRef as r,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 u,CarouselScrollArea as s,CarouselCard as a,CarouselCardInner as d}from"./styles.js";var f=function(t){var f=t.startPosition,m=t.children,h=t.onPositionChanged,v=t.shrinkUnselectedPages,g=void 0!==v&&v,E=t.fullWidthChild,p=void 0!==E&&E,C=e.useRef(void 0),$=void 0!==f,x=n(f||0),P=x[0],T=x[1],y=n(!$),j=y[0],W=y[1],k=r(null),b=e.Children.toArray(m).filter(Boolean),B=function(e){if(null==k?void 0:k.current){var t=k.current.scrollWidth,n=0===e,r=e===k.current.children.length-1,l=k.current.children[e];if(!l)return;var o=l.offsetLeft;n?k.current.scrollTo(0,0):r?k.current.scrollTo(t,0):k.current.scrollTo(o,0),j||W(!0)}};l((function(){$&&W(!1)}),[f]),l((function(){j||B(f||0)}),[j]);var S=1===b.length;return e.createElement(e.Fragment,null,e.createElement(i,null,e.createElement(u,null,e.createElement(s,{ref:k,"aria-live":"assertive",$smoothScrolling:j,tabIndex:0},b.map((function(t,n){var r=n===P,l="card-".concat(n);return e.createElement(a,{key:l,$onlyChild:S,$fullWidthChild:p},e.createElement(o,{threshold:.5,as:"div",onChange:function(e){var t;e&&P!==(t=n)&&(T(t),C&&clearTimeout(null==C?void 0:C.current),C.current=setTimeout((function(){h&&j&&h(t)}),500))}},e.createElement(d,{$onlyChild:S,$isSelected:r,$shrinkUnselectedPages:g,$fullWidthChild:p},t)))}))))),b.length>1?e.createElement(i,null,e.createElement(c,{count:b.length,currentPosition:P,scrollToPosition:B,next:function(){B(P+1)},previous:function(){B(P-1)}})):null)};t(f);export{f 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","startPosition","children","onPositionChanged","shrinkUnselectedPages","fullWidthChild","timer","React","useRef","isStartPositionSet","currentPosition","setCurrentPosition","
|
|
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","_a","startPosition","children","onPositionChanged","_b","shrinkUnselectedPages","undefined","_c","fullWidthChild","timer","React","useRef","isStartPositionSet","_d","useState","currentPosition","setCurrentPosition","_e","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","tabIndex","map","child","index","isSelected","keyString","concat","CarouselCard","key","$onlyChild","$fullWidthChild","InView","threshold","as","onChange","inView","clearTimeout","setTimeout","CarouselCardInner","$isSelected","$shrinkUnselectedPages","Dots","count","next","previous","memo"],"mappings":"wVAyCO,IAAMA,EAAW,SAACC,OACvBC,EAAaD,EAAAC,cACbC,EAAQF,EAAAE,SACRC,EAAiBH,EAAAG,kBACjBC,EAA6BJ,EAAAK,sBAA7BA,OAAwBC,IAAAF,KACxBG,EAAAP,EAAAQ,eAAAA,OAAcF,IAAAC,GAAQA,EAEhBE,EAAQC,EAAMC,YAClBL,GAEIM,OAA8C,IAAlBX,EAC5BY,EAAwCC,EAASb,GAAiB,GAAjEc,EAAeF,EAAA,GAAEG,OAClBC,EAAwCH,GAAUF,GAAjDM,EAAeD,EAAA,GAAEE,EAAkBF,EAAA,GACpCG,EAAYT,EAAyB,MAGrCU,EAAaX,EAAMY,SAASC,QAAQrB,GAAUsB,OAAOC,SA6BrDC,EAAmB,SAACC,GACxB,GAAIP,aAASd,EAATc,EAAWQ,QAAS,CACtB,IAAMC,EAAiBT,EAAUQ,QAAQE,YAEnCC,EAAoB,IAAPJ,EACbK,EAAQL,IAFKP,EAAUQ,QAAQ1B,SAAS+B,OAEZ,EAE5BC,EAAOd,EAAUQ,QAAQ1B,SAASyB,GACxC,IAAKO,EAAM,OACX,IAAMC,EAAYD,EAAKE,WAEnBL,EACFX,EAAUQ,QAAQS,SAAS,EAAG,GACrBL,EACTZ,EAAUQ,QAAQS,SAASR,EAAgB,GAE3CT,EAAUQ,QAAQS,SAASF,EAAW,GAInCjB,GACHC,GAAmB,GAGxB,EAGDmB,GAAU,WACJ1B,GACFO,GAAmB,EAEvB,GAAG,CAAClB,IAEJqC,GAAU,WACHpB,GACHQ,EAAiBzB,GAAiB,EAEtC,GAAG,CAACiB,IAEJ,IAAMqB,EAAkC,IAAtBlB,EAAWY,OAE7B,OACEvB,EAAA8B,cAAA9B,EAAA+B,SAAA,KACE/B,EAAA8B,cAACE,EAAG,KACFhC,EAAA8B,cAACG,EAAe,KACdjC,EAAC8B,cAAAI,GACCC,IAAKzB,EACK,YAAA,6BACQF,EAClB4B,SAAU,GAETzB,EAAW0B,KAAI,SAACC,EAAOC,GACtB,IAAMC,EAAaD,IAAUlC,EACvBoC,EAAY,QAAQC,OAAAH,GAC1B,OACEvC,EAAC8B,cAAAa,EACC,CAAAC,IAAKH,EAASI,WACFhB,EAASiB,gBACJhD,GAEjBE,EAAA8B,cAACiB,EAAM,CACLC,UAAW,GACXC,GAAG,MACHC,SAAU,SAACC,GA1FT,IAAClC,EA2FGkC,GA1FlB9C,KADeY,EA4FasB,KA1FhCjC,EAAmBW,GAEflB,GACFqD,aAAarD,eAAAA,EAAOmB,SAEtBnB,EAAMmB,QAAUmC,YAAW,WACrB5D,GAAqBe,GAMvBf,EAAkBwB,EAErB,GAAE,QAgFajB,EAAA8B,cAACwB,EAAiB,CAAAT,WACJhB,EAAS0B,YACRf,EACWgB,uBAAA7D,EACPmD,gBAAAhD,GAEhBwC,IAKV,OAIN3B,EAAWY,OAAS,EACnBvB,EAAA8B,cAACE,EAAG,KACFhC,EAAA8B,cAAC2B,EAAI,CACHC,MAAO/C,EAAWY,OAClBlB,gBAAiBA,EACjBW,iBAAkBA,EAClB2C,KAlGG,WACX3C,EAAiBX,EAAkB,EACpC,EAiGSuD,SA/FO,WACf5C,EAAiBX,EAAkB,EACpC,KAgGO,KAGV,EAEewD,EAAKxE"}
|
|
@@ -1,97 +1,2 @@
|
|
|
1
|
-
import e from"styled-components";
|
|
2
|
-
position: relative;
|
|
3
|
-
width: 100%;
|
|
4
|
-
overflow-y: hidden;
|
|
5
|
-
`,t=e.ul`
|
|
6
|
-
position: relative;
|
|
7
|
-
overflow-x: scroll;
|
|
8
|
-
scroll-snap-type: x mandatory;
|
|
9
|
-
scroll-behavior: ${({$smoothScrolling:e})=>e?"smooth":"auto"};
|
|
10
|
-
-webkit-overflow-scrolling: touch;
|
|
11
|
-
white-space: nowrap;
|
|
12
|
-
padding-left: 0;
|
|
13
|
-
padding-right: 0;
|
|
14
|
-
padding-bottom: 20px;
|
|
15
|
-
margin-bottom: -20px;
|
|
16
|
-
height: 100%;
|
|
17
|
-
`,i=e.li`
|
|
18
|
-
scroll-snap-align: center;
|
|
19
|
-
display: inline-block;
|
|
20
|
-
width: ${({$onlyChild:e,$fullWidthChild:o})=>e||o?"100%":"80%"};
|
|
21
|
-
`,r=e.div`
|
|
22
|
-
transition: transform 0.2s linear;
|
|
23
|
-
transform: ${({$isSelected:e,$shrinkUnselectedPages:o,$onlyChild:t,$fullWidthChild:i})=>t||e&&o||i?"scale(1)":"scale(0.9)"};
|
|
24
|
-
`,n=e.div`
|
|
25
|
-
display: flex;
|
|
26
|
-
justify-content: center;
|
|
27
|
-
`,s=e.span`
|
|
28
|
-
display: block;
|
|
29
|
-
margin: auto;
|
|
30
|
-
height: 2rem;
|
|
31
|
-
line-height: 1.75rem;
|
|
32
|
-
`,l=e.button`
|
|
33
|
-
height: 100%;
|
|
34
|
-
cursor: pointer;
|
|
35
|
-
background-color: rgba(255, 255, 255, 0);
|
|
36
|
-
border: none;
|
|
37
|
-
/* TODO if this makes it into the component library carouselButtonColor should be a theme prop */
|
|
38
|
-
color: ${({disabled:e,theme:o})=>e?o.colors.disabled:"su2c"===o.name?o.colors.textDark:o.colors.primary};
|
|
39
|
-
font-size: ${({theme:e})=>e.fontSizes.xxxl};
|
|
40
|
-
font-weight: 600;
|
|
41
|
-
transition:
|
|
42
|
-
color 0.3s ease,
|
|
43
|
-
transform 0.3s ease;
|
|
44
|
-
max-width: 3rem;
|
|
45
|
-
padding: 0;
|
|
46
|
-
vertical-align: middle;
|
|
47
|
-
user-select: none;
|
|
48
|
-
|
|
49
|
-
transform: scale(0.8);
|
|
50
|
-
&:hover {
|
|
51
|
-
transform: ${({disabled:e})=>e?"scale(0.8)":"scale(1)"};
|
|
52
|
-
}
|
|
53
|
-
`,a=e.div`
|
|
54
|
-
display: flex;
|
|
55
|
-
flex-direction: row;
|
|
56
|
-
justify-content: center;
|
|
57
|
-
display: ${({$count:e})=>e>6?"none":"flex"};
|
|
58
|
-
|
|
59
|
-
@media (min-width: ${({theme:e})=>e.breakpoint.tablet}) {
|
|
60
|
-
display: ${({$count:e})=>e>10?"none":"flex"};
|
|
61
|
-
}
|
|
62
|
-
|
|
63
|
-
@media (min-width: ${({theme:e})=>e.breakpoint.desktop}) {
|
|
64
|
-
display: ${({$count:e})=>e>20?"none":"flex"};
|
|
65
|
-
}
|
|
66
|
-
`,d=e.button`
|
|
67
|
-
border: none;
|
|
68
|
-
outline-offset: ${({theme:e})=>e.spacing.xxs};
|
|
69
|
-
padding: 0;
|
|
70
|
-
margin: ${({theme:e})=>`auto ${e.spacing.xxs}`};
|
|
71
|
-
width: ${({theme:e})=>e.fontSizes.l};
|
|
72
|
-
height: ${({theme:e})=>e.fontSizes.l};
|
|
73
|
-
border-radius: 50%;
|
|
74
|
-
/* TODO if this makes it into the component library carouselButtonColor should be a theme prop */
|
|
75
|
-
border: ${({theme:e})=>`solid 1px ${"su2c"===e.name?e.colors.textDark:e.colors.primary}`};
|
|
76
|
-
background-color: ${({theme:e,$selected:o})=>o?`${"su2c"===e.name?e.colors.textDark:e.colors.primary}`:e.colors.backgroundLight};
|
|
77
|
-
user-select: none;
|
|
78
|
-
transition:
|
|
79
|
-
background-color 0.3s ease,
|
|
80
|
-
transform 0.3s ease;
|
|
81
|
-
transform: scale(0.8);
|
|
82
|
-
&:hover {
|
|
83
|
-
transform: scale(1);
|
|
84
|
-
}
|
|
85
|
-
`,c=e.span`
|
|
86
|
-
border: 0px;
|
|
87
|
-
clip: rect(0px, 0px, 0px, 0px);
|
|
88
|
-
height: 1px;
|
|
89
|
-
margin-bottom: -1px;
|
|
90
|
-
margin-right: -1px;
|
|
91
|
-
overflow: hidden;
|
|
92
|
-
padding: 0px;
|
|
93
|
-
position: absolute;
|
|
94
|
-
white-space: nowrap;
|
|
95
|
-
width: 1px;
|
|
96
|
-
`;export{n as ButtonWrapper,l as CarouselButton,i as CarouselCard,r as CarouselCardInner,t as CarouselScrollArea,o as CarouselWrapper,d as Dot,a as DotContainer,c as ScreenReaderOnly,s as VerticalAlign};
|
|
1
|
+
import{__makeTemplateObject as n}from"../../../node_modules/tslib/tslib.es6.js";import e from"styled-components";var o,t,r,i,a,s,l,c,d,p,h=e.div(o||(o=n(["\n position: relative;\n width: 100%;\n overflow-y: hidden;\n"],["\n position: relative;\n width: 100%;\n overflow-y: hidden;\n"]))),m=e.ul(t||(t=n(["\n position: relative;\n overflow-x: scroll;\n scroll-snap-type: x mandatory;\n scroll-behavior: ",";\n -webkit-overflow-scrolling: touch;\n white-space: nowrap;\n padding-left: 0;\n padding-right: 0;\n padding-bottom: 20px;\n margin-bottom: -20px;\n height: 100%;\n"],["\n position: relative;\n overflow-x: scroll;\n scroll-snap-type: x mandatory;\n scroll-behavior: ",";\n -webkit-overflow-scrolling: touch;\n white-space: nowrap;\n padding-left: 0;\n padding-right: 0;\n padding-bottom: 20px;\n margin-bottom: -20px;\n height: 100%;\n"])),(function(n){return n.$smoothScrolling?"smooth":"auto"})),u=e.li(r||(r=n(["\n scroll-snap-align: center;\n display: inline-block;\n width: ",";\n"],["\n scroll-snap-align: center;\n display: inline-block;\n width: ",";\n"])),(function(n){var e=n.$onlyChild,o=n.$fullWidthChild;return e||o?"100%":"80%"})),f=e.div(i||(i=n(["\n transition: transform 0.2s linear;\n transform: ",";\n"],["\n transition: transform 0.2s linear;\n transform: ",";\n"])),(function(n){var e=n.$isSelected,o=n.$shrinkUnselectedPages,t=n.$onlyChild,r=n.$fullWidthChild;return t||e&&o||r?"scale(1)":"scale(0.9)"})),g=e.div(a||(a=n(["\n display: flex;\n justify-content: center;\n"],["\n display: flex;\n justify-content: center;\n"]))),b=e.span(s||(s=n(["\n display: block;\n margin: auto;\n height: 2rem;\n line-height: 1.75rem;\n"],["\n display: block;\n margin: auto;\n height: 2rem;\n line-height: 1.75rem;\n"]))),x=e.button(l||(l=n(["\n height: 100%;\n cursor: pointer;\n background-color: rgba(255, 255, 255, 0);\n border: none;\n /* TODO if this makes it into the component library carouselButtonColor should be a theme prop */\n color: ",";\n font-size: ",";\n font-weight: 600;\n transition:\n color 0.3s ease,\n transform 0.3s ease;\n max-width: 3rem;\n padding: 0;\n vertical-align: middle;\n user-select: none;\n\n transform: scale(0.8);\n &:hover {\n transform: ",";\n }\n"],["\n height: 100%;\n cursor: pointer;\n background-color: rgba(255, 255, 255, 0);\n border: none;\n /* TODO if this makes it into the component library carouselButtonColor should be a theme prop */\n color: ",";\n font-size: ",";\n font-weight: 600;\n transition:\n color 0.3s ease,\n transform 0.3s ease;\n max-width: 3rem;\n padding: 0;\n vertical-align: middle;\n user-select: none;\n\n transform: scale(0.8);\n &:hover {\n transform: ",";\n }\n"])),(function(n){var e=n.disabled,o=n.theme;return e?o.colors.disabled:"su2c"===o.name?o.colors.textDark:o.colors.primary}),(function(n){return n.theme.fontSizes.xxxl}),(function(n){return n.disabled?"scale(0.8)":"scale(1)"})),w=e.div(c||(c=n(["\n display: flex;\n flex-direction: row;\n justify-content: center;\n display: ",";\n\n @media (min-width: ",") {\n display: ",";\n }\n\n @media (min-width: ",") {\n display: ",";\n }\n"],["\n display: flex;\n flex-direction: row;\n justify-content: center;\n display: ",";\n\n @media (min-width: ",") {\n display: ",";\n }\n\n @media (min-width: ",") {\n display: ",";\n }\n"])),(function(n){return n.$count>6?"none":"flex"}),(function(n){return n.theme.breakpoint.tablet}),(function(n){return n.$count>10?"none":"flex"}),(function(n){return n.theme.breakpoint.desktop}),(function(n){return n.$count>20?"none":"flex"})),y=e.button(d||(d=n(["\n border: none;\n outline-offset: ",";\n padding: 0;\n margin: ",";\n width: ",";\n height: ",";\n border-radius: 50%;\n /* TODO if this makes it into the component library carouselButtonColor should be a theme prop */\n border: ",";\n background-color: ",";\n user-select: none;\n transition:\n background-color 0.3s ease,\n transform 0.3s ease;\n transform: scale(0.8);\n &:hover {\n transform: scale(1);\n }\n"],["\n border: none;\n outline-offset: ",";\n padding: 0;\n margin: ",";\n width: ",";\n height: ",";\n border-radius: 50%;\n /* TODO if this makes it into the component library carouselButtonColor should be a theme prop */\n border: ",";\n background-color: ",";\n user-select: none;\n transition:\n background-color 0.3s ease,\n transform 0.3s ease;\n transform: scale(0.8);\n &:hover {\n transform: scale(1);\n }\n"])),(function(n){return n.theme.spacing.xxs}),(function(n){var e=n.theme;return"auto ".concat(e.spacing.xxs)}),(function(n){return n.theme.fontSizes.l}),(function(n){return n.theme.fontSizes.l}),(function(n){var e=n.theme;return"solid 1px ".concat("su2c"===e.name?e.colors.textDark:e.colors.primary)}),(function(n){var e=n.theme;return n.$selected?"".concat("su2c"===e.name?e.colors.textDark:e.colors.primary):e.colors.backgroundLight})),v=e.span(p||(p=n(["\n border: 0px;\n clip: rect(0px, 0px, 0px, 0px);\n height: 1px;\n margin-bottom: -1px;\n margin-right: -1px;\n overflow: hidden;\n padding: 0px;\n position: absolute;\n white-space: nowrap;\n width: 1px;\n"],["\n border: 0px;\n clip: rect(0px, 0px, 0px, 0px);\n height: 1px;\n margin-bottom: -1px;\n margin-right: -1px;\n overflow: hidden;\n padding: 0px;\n position: absolute;\n white-space: nowrap;\n width: 1px;\n"])));export{g as ButtonWrapper,x as CarouselButton,u as CarouselCard,f as CarouselCardInner,m as CarouselScrollArea,h as CarouselWrapper,y as Dot,w as DotContainer,v as ScreenReaderOnly,b as VerticalAlign};
|
|
97
2
|
//# sourceMappingURL=styles.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"styles.js","sources":["../../../../src/components/Carousel/styles.ts"],"sourcesContent":["import styled from \"styled-components\";\n\nimport { type ThemeType } from \"../../types\";\n\nexport const CarouselWrapper = styled.div`\n position: relative;\n width: 100%;\n overflow-y: hidden;\n`;\n\nexport const CarouselScrollArea = styled.ul<{\n $smoothScrolling: boolean;\n}>`\n position: relative;\n overflow-x: scroll;\n scroll-snap-type: x mandatory;\n scroll-behavior: ${({ $smoothScrolling }) =>\n $smoothScrolling ? \"smooth\" : \"auto\"};\n -webkit-overflow-scrolling: touch;\n white-space: nowrap;\n padding-left: 0;\n padding-right: 0;\n padding-bottom: 20px;\n margin-bottom: -20px;\n height: 100%;\n`;\n\nexport const CarouselCard = styled.li<{\n $onlyChild: boolean;\n $fullWidthChild: boolean;\n}>`\n scroll-snap-align: center;\n display: inline-block;\n width: ${({ $onlyChild, $fullWidthChild }) =>\n $onlyChild || $fullWidthChild ? \"100%\" : \"80%\"};\n`;\n\nexport const CarouselCardInner = styled.div<{\n $isSelected: boolean;\n $shrinkUnselectedPages: boolean;\n $onlyChild: boolean;\n $fullWidthChild: boolean;\n}>`\n transition: transform 0.2s linear;\n transform: ${({\n $isSelected,\n $shrinkUnselectedPages,\n $onlyChild,\n $fullWidthChild,\n }) =>\n $onlyChild || ($isSelected && $shrinkUnselectedPages) || $fullWidthChild\n ? \"scale(1)\"\n : \"scale(0.9)\"};\n`;\n\nexport const ButtonWrapper = styled.div`\n display: flex;\n justify-content: center;\n`;\n\nexport const VerticalAlign = styled.span`\n display: block;\n margin: auto;\n height: 2rem;\n line-height: 1.75rem;\n`;\n\nexport const CarouselButton = styled.button<{\n disabled: boolean;\n theme: ThemeType;\n}>`\n height: 100%;\n cursor: pointer;\n background-color: rgba(255, 255, 255, 0);\n border: none;\n /* TODO if this makes it into the component library carouselButtonColor should be a theme prop */\n color: ${({ disabled, theme }) =>\n disabled\n ? theme.colors.disabled\n : theme.name === \"su2c\"\n ? theme.colors.textDark\n : theme.colors.primary};\n font-size: ${({ theme }) => theme.fontSizes.xxxl};\n font-weight: 600;\n transition:\n color 0.3s ease,\n transform 0.3s ease;\n max-width: 3rem;\n padding: 0;\n vertical-align: middle;\n user-select: none;\n\n transform: scale(0.8);\n &:hover {\n transform: ${({ disabled }) => (disabled ? \"scale(0.8)\" : \"scale(1)\")};\n }\n`;\n\nexport const DotContainer = styled.div<{ $count: number; theme: ThemeType }>`\n display: flex;\n flex-direction: row;\n justify-content: center;\n display: ${({ $count }) => ($count > 6 ? \"none\" : \"flex\")};\n\n @media (min-width: ${({ theme }) => theme.breakpoint.tablet}) {\n display: ${({ $count }) => ($count > 10 ? \"none\" : \"flex\")};\n }\n\n @media (min-width: ${({ theme }) => theme.breakpoint.desktop}) {\n display: ${({ $count }) => ($count > 20 ? \"none\" : \"flex\")};\n }\n`;\n\nexport const Dot = styled.button<{ $selected: boolean; theme: ThemeType }>`\n border: none;\n outline-offset: ${({ theme }) => theme.spacing.xxs};\n padding: 0;\n margin: ${({ theme }) => `auto ${theme.spacing.xxs}`};\n width: ${({ theme }) => theme.fontSizes.l};\n height: ${({ theme }) => theme.fontSizes.l};\n border-radius: 50%;\n /* TODO if this makes it into the component library carouselButtonColor should be a theme prop */\n border: ${({ theme }) =>\n `solid 1px ${\n theme.name === \"su2c\" ? theme.colors.textDark : theme.colors.primary\n }`};\n background-color: ${({ theme, $selected }) =>\n $selected\n ? `${\n theme.name === \"su2c\" ? theme.colors.textDark : theme.colors.primary\n }`\n : theme.colors.backgroundLight};\n user-select: none;\n transition:\n background-color 0.3s ease,\n transform 0.3s ease;\n transform: scale(0.8);\n &:hover {\n transform: scale(1);\n }\n`;\n\n// TODO move to its own component\nexport const ScreenReaderOnly = styled.span`\n border: 0px;\n clip: rect(0px, 0px, 0px, 0px);\n height: 1px;\n margin-bottom: -1px;\n margin-right: -1px;\n overflow: hidden;\n padding: 0px;\n position: absolute;\n white-space: nowrap;\n width: 1px;\n`;\n"],"names":["CarouselWrapper","styled","div","CarouselScrollArea","ul","$smoothScrolling","CarouselCard","li","$onlyChild","$fullWidthChild","CarouselCardInner","$isSelected","$shrinkUnselectedPages","ButtonWrapper","VerticalAlign","span","CarouselButton","button","disabled","theme","colors","name","textDark","primary","fontSizes","xxxl","DotContainer","$count","breakpoint","tablet","desktop","Dot","spacing","xxs","l","$selected","backgroundLight","ScreenReaderOnly"],"mappings":"
|
|
1
|
+
{"version":3,"file":"styles.js","sources":["../../../../src/components/Carousel/styles.ts"],"sourcesContent":["import styled from \"styled-components\";\n\nimport { type ThemeType } from \"../../types\";\n\nexport const CarouselWrapper = styled.div`\n position: relative;\n width: 100%;\n overflow-y: hidden;\n`;\n\nexport const CarouselScrollArea = styled.ul<{\n $smoothScrolling: boolean;\n}>`\n position: relative;\n overflow-x: scroll;\n scroll-snap-type: x mandatory;\n scroll-behavior: ${({ $smoothScrolling }) =>\n $smoothScrolling ? \"smooth\" : \"auto\"};\n -webkit-overflow-scrolling: touch;\n white-space: nowrap;\n padding-left: 0;\n padding-right: 0;\n padding-bottom: 20px;\n margin-bottom: -20px;\n height: 100%;\n`;\n\nexport const CarouselCard = styled.li<{\n $onlyChild: boolean;\n $fullWidthChild: boolean;\n}>`\n scroll-snap-align: center;\n display: inline-block;\n width: ${({ $onlyChild, $fullWidthChild }) =>\n $onlyChild || $fullWidthChild ? \"100%\" : \"80%\"};\n`;\n\nexport const CarouselCardInner = styled.div<{\n $isSelected: boolean;\n $shrinkUnselectedPages: boolean;\n $onlyChild: boolean;\n $fullWidthChild: boolean;\n}>`\n transition: transform 0.2s linear;\n transform: ${({\n $isSelected,\n $shrinkUnselectedPages,\n $onlyChild,\n $fullWidthChild,\n }) =>\n $onlyChild || ($isSelected && $shrinkUnselectedPages) || $fullWidthChild\n ? \"scale(1)\"\n : \"scale(0.9)\"};\n`;\n\nexport const ButtonWrapper = styled.div`\n display: flex;\n justify-content: center;\n`;\n\nexport const VerticalAlign = styled.span`\n display: block;\n margin: auto;\n height: 2rem;\n line-height: 1.75rem;\n`;\n\nexport const CarouselButton = styled.button<{\n disabled: boolean;\n theme: ThemeType;\n}>`\n height: 100%;\n cursor: pointer;\n background-color: rgba(255, 255, 255, 0);\n border: none;\n /* TODO if this makes it into the component library carouselButtonColor should be a theme prop */\n color: ${({ disabled, theme }) =>\n disabled\n ? theme.colors.disabled\n : theme.name === \"su2c\"\n ? theme.colors.textDark\n : theme.colors.primary};\n font-size: ${({ theme }) => theme.fontSizes.xxxl};\n font-weight: 600;\n transition:\n color 0.3s ease,\n transform 0.3s ease;\n max-width: 3rem;\n padding: 0;\n vertical-align: middle;\n user-select: none;\n\n transform: scale(0.8);\n &:hover {\n transform: ${({ disabled }) => (disabled ? \"scale(0.8)\" : \"scale(1)\")};\n }\n`;\n\nexport const DotContainer = styled.div<{ $count: number; theme: ThemeType }>`\n display: flex;\n flex-direction: row;\n justify-content: center;\n display: ${({ $count }) => ($count > 6 ? \"none\" : \"flex\")};\n\n @media (min-width: ${({ theme }) => theme.breakpoint.tablet}) {\n display: ${({ $count }) => ($count > 10 ? \"none\" : \"flex\")};\n }\n\n @media (min-width: ${({ theme }) => theme.breakpoint.desktop}) {\n display: ${({ $count }) => ($count > 20 ? \"none\" : \"flex\")};\n }\n`;\n\nexport const Dot = styled.button<{ $selected: boolean; theme: ThemeType }>`\n border: none;\n outline-offset: ${({ theme }) => theme.spacing.xxs};\n padding: 0;\n margin: ${({ theme }) => `auto ${theme.spacing.xxs}`};\n width: ${({ theme }) => theme.fontSizes.l};\n height: ${({ theme }) => theme.fontSizes.l};\n border-radius: 50%;\n /* TODO if this makes it into the component library carouselButtonColor should be a theme prop */\n border: ${({ theme }) =>\n `solid 1px ${\n theme.name === \"su2c\" ? theme.colors.textDark : theme.colors.primary\n }`};\n background-color: ${({ theme, $selected }) =>\n $selected\n ? `${\n theme.name === \"su2c\" ? theme.colors.textDark : theme.colors.primary\n }`\n : theme.colors.backgroundLight};\n user-select: none;\n transition:\n background-color 0.3s ease,\n transform 0.3s ease;\n transform: scale(0.8);\n &:hover {\n transform: scale(1);\n }\n`;\n\n// TODO move to its own component\nexport const ScreenReaderOnly = styled.span`\n border: 0px;\n clip: rect(0px, 0px, 0px, 0px);\n height: 1px;\n margin-bottom: -1px;\n margin-right: -1px;\n overflow: hidden;\n padding: 0px;\n position: absolute;\n white-space: nowrap;\n width: 1px;\n`;\n"],"names":["CarouselWrapper","styled","div","templateObject_1","__makeTemplateObject","CarouselScrollArea","ul","templateObject_2","_a","$smoothScrolling","CarouselCard","li","templateObject_3","$onlyChild","$fullWidthChild","CarouselCardInner","templateObject_4","$isSelected","$shrinkUnselectedPages","ButtonWrapper","templateObject_5","VerticalAlign","span","templateObject_6","CarouselButton","button","templateObject_7","disabled","theme","colors","name","textDark","primary","fontSizes","xxxl","DotContainer","$count","breakpoint","tablet","desktop","Dot","templateObject_9","spacing","xxs","l","concat","$selected","backgroundLight","ScreenReaderOnly","templateObject_10"],"mappings":"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"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import e,
|
|
1
|
+
import{__assign as e,__rest as r}from"../../../node_modules/tslib/tslib.es6.js";import o from"react";import{useTheme as t,ThemeProvider as s}from"styled-components";import{faCheck as i}from"../../../node_modules/@fortawesome/free-solid-svg-icons/index.js";import{crukTheme as l}from"../../themes/cruk.js";import{ErrorText as a}from"../ErrorText/index.js";import{IconFa as d}from"../IconFa/index.js";import{StyledLabel as m,StyledInput as c,SelectedBorder as n,CheckWrapper as f,Check as u}from"./styles.js";var h=function(h){var p=t(),E=e(e({},l),p),b=h.children,x=h.hasError,j=h.errorMessage,k=h.ref,v=r(h,["children","hasError","errorMessage","ref"]);return o.createElement(s,{theme:E},o.createElement(m,{$hasError:x||!!j||!1,$checked:h.checked||h.defaultChecked||!1,$disabled:h.disabled||!1},o.createElement(c,e({},v,{disabled:h.disabled||!1,type:"checkbox",ref:k,"aria-describedby":h.id&&j?"".concat(h.id,"-error"):void 0})),o.createElement(n,null),b||h.value,E.utilities.useDefaultFromControls?null:o.createElement(f,null,o.createElement(u,null,o.createElement(d,{faIcon:i,color:"check",size:"1.25em"})))),!!j&&o.createElement(a,{marginTop:"xxs",id:h.id?"".concat(h.id,"-error"):void 0},j))};export{h as Checkbox,h as default};
|
|
2
2
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sources":["../../../../src/components/Checkbox/index.tsx"],"sourcesContent":["import React, {\n type InputHTMLAttributes,\n type Ref,\n
|
|
1
|
+
{"version":3,"file":"index.js","sources":["../../../../src/components/Checkbox/index.tsx"],"sourcesContent":["import React, {\n type InputHTMLAttributes,\n type Ref,\n type ReactNode,\n} from \"react\";\nimport { useTheme, ThemeProvider } from \"styled-components\";\nimport { faCheck } from \"@fortawesome/free-solid-svg-icons\";\n\nimport { crukTheme as defaultTheme } from \"../../themes/cruk\";\nimport { ErrorText } from \"../ErrorText\";\nimport { IconFa } from \"../IconFa\";\n\nimport {\n StyledLabel,\n StyledInput,\n CheckWrapper,\n Check,\n SelectedBorder,\n} from \"./styles\";\n\nexport type CheckBoxProps = InputHTMLAttributes<HTMLInputElement> & {\n ref?: Ref<HTMLInputElement>;\n /** flag for error styling */\n hasError?: boolean;\n /** error message text */\n errorMessage?: string;\n children?: ReactNode;\n};\n\n/**\n * Checkboxes allow the user to select one or more items.\n *\n * The value or children becomes the label, if you want an outer label for a checkbox or group of checkboxes please use a LegendWrapper component\n */\nexport const Checkbox = (props: CheckBoxProps) => {\n const foundTheme = useTheme();\n const theme = {\n ...defaultTheme,\n ...foundTheme,\n };\n\n const { children, hasError, errorMessage, ref, ...rest } = props;\n\n return (\n <ThemeProvider theme={theme}>\n <StyledLabel\n $hasError={hasError || !!errorMessage || false}\n $checked={props.checked || props.defaultChecked || false}\n $disabled={props.disabled || false}\n >\n <StyledInput\n {...rest}\n disabled={props.disabled || false}\n type=\"checkbox\"\n ref={ref}\n aria-describedby={\n !!props.id && !!errorMessage ? `${props.id}-error` : undefined\n }\n />\n <SelectedBorder />\n {children || props.value}\n {theme.utilities.useDefaultFromControls ? null : (\n <CheckWrapper>\n <Check>\n <IconFa faIcon={faCheck} color=\"check\" size=\"1.25em\" />\n </Check>\n </CheckWrapper>\n )}\n </StyledLabel>\n {!!errorMessage && (\n <ErrorText\n marginTop=\"xxs\"\n id={props.id ? `${props.id}-error` : undefined}\n >\n {errorMessage}\n </ErrorText>\n )}\n </ThemeProvider>\n );\n};\n\nexport default Checkbox;\n"],"names":["Checkbox","props","foundTheme","useTheme","theme","__assign","defaultTheme","children","hasError","errorMessage","ref","rest","__rest","React","createElement","ThemeProvider","StyledLabel","$hasError","$checked","checked","defaultChecked","disabled","StyledInput","type","id","concat","undefined","SelectedBorder","value","utilities","useDefaultFromControls","CheckWrapper","Check","IconFa","faIcon","faCheck","color","size","ErrorText","marginTop"],"mappings":"2fAkCO,IAAMA,EAAW,SAACC,GACvB,IAAMC,EAAaC,IACbC,EACDC,EAAAA,EAAA,CAAA,EAAAC,GACAJ,GAGGK,EAAmDN,EAA3CM,SAAEC,EAAyCP,EAAKO,SAApCC,EAA+BR,eAAjBS,EAAiBT,EAAdS,IAAKC,EAAIC,EAAKX,EAArD,CAAkD,WAAA,WAAA,eAAA,QAExD,OACEY,EAACC,cAAAC,EAAc,CAAAX,MAAOA,GACpBS,EAACC,cAAAE,EACY,CAAAC,UAAAT,KAAcC,IAAgB,EAAKS,SACpCjB,EAAMkB,SAAWlB,EAAMmB,iBAAkB,YACxCnB,EAAMoB,WAAY,GAE7BR,EAAAC,cAACQ,EACKjB,EAAA,CAAA,EAAAM,GACJU,SAAUpB,EAAMoB,WAAY,EAC5BE,KAAK,WACLb,IAAKA,EAAG,mBAEJT,EAAMuB,IAAQf,EAAe,GAAGgB,OAAAxB,EAAMuB,GAAE,eAAWE,KAGzDb,EAAAC,cAACa,EAAiB,MACjBpB,GAAYN,EAAM2B,MAClBxB,EAAMyB,UAAUC,uBAAyB,KACxCjB,gBAACkB,EAAY,KACXlB,EAAAC,cAACkB,EAAK,KACJnB,EAAAC,cAACmB,EAAO,CAAAC,OAAQC,EAASC,MAAM,QAAQC,KAAK,gBAKjD5B,GACDI,gBAACyB,EAAS,CACRC,UAAU,MACVf,GAAIvB,EAAMuB,GAAK,GAAGC,OAAAxB,EAAMuB,kBAAaE,GAEpCjB,GAKX"}
|
|
@@ -1,106 +1,2 @@
|
|
|
1
|
-
import o,{css as
|
|
2
|
-
display: inline-block;
|
|
3
|
-
height: ${t};
|
|
4
|
-
width: ${t};
|
|
5
|
-
position: absolute;
|
|
6
|
-
top: calc(50% - (${t} / 2));
|
|
7
|
-
left: ${({theme:{spacing:{xs:o}}})=>o};
|
|
8
|
-
`,r=o.span`
|
|
9
|
-
display: block;
|
|
10
|
-
position: relative;
|
|
11
|
-
border: 2px solid ${({theme:o})=>o.colors.selectionBorder};
|
|
12
|
-
height: ${t};
|
|
13
|
-
width: ${t};
|
|
14
|
-
top: 0;
|
|
15
|
-
bottom: 0;
|
|
16
|
-
left: 0;
|
|
17
|
-
right: 0;
|
|
18
|
-
z-index: 5;
|
|
19
|
-
transition: border 0.25s ease;
|
|
20
|
-
overflow: hidden;
|
|
21
|
-
|
|
22
|
-
svg {
|
|
23
|
-
path {
|
|
24
|
-
transition: transform 0.25s ease;
|
|
25
|
-
transform: rotateY(90deg);
|
|
26
|
-
transform-origin: center;
|
|
27
|
-
}
|
|
28
|
-
}
|
|
29
|
-
`,s=o.label`
|
|
30
|
-
box-sizing: border-box;
|
|
31
|
-
*,
|
|
32
|
-
*:after,
|
|
33
|
-
*:before {
|
|
34
|
-
box-sizing: border-box;
|
|
35
|
-
}
|
|
36
|
-
line-height: ${({theme:o})=>o.typography.lineHeight};
|
|
37
|
-
font-size: ${({theme:o})=>o.typography.fontSizeBase};
|
|
38
|
-
font-family: ${({theme:o})=>o.typography.fontFamilyBase};
|
|
39
|
-
|
|
40
|
-
background-color: ${({theme:o})=>o.colors.backgroundLight};
|
|
41
|
-
position: relative;
|
|
42
|
-
|
|
43
|
-
cursor: ${({$disabled:o})=>o?"not-allowed":"pointer"};
|
|
44
|
-
display: block;
|
|
45
|
-
|
|
46
|
-
color: ${({theme:o,$disabled:e})=>e?o.colors.disabled:o.colors.textDark};
|
|
47
|
-
padding: ${({theme:o})=>`calc( (3em - ( ${o.utilities.inputBorderWidth} * 2) - ${o.typography.lineHeight} ) / 2) ${o.spacing.m} calc( (3em - ( ${o.utilities.inputBorderWidth} * 2) - ${o.typography.lineHeight} ) / 2) ${o.spacing.xl}`};
|
|
48
|
-
&:focus ~ ${i} ${r} {
|
|
49
|
-
outline: 2px solid #7aacfe; /* for non-webkit browsers */
|
|
50
|
-
outline: 5px auto -webkit-focus-ring-color;
|
|
51
|
-
}
|
|
52
|
-
|
|
53
|
-
svg {
|
|
54
|
-
path {
|
|
55
|
-
fill: ${({theme:o,$disabled:e})=>e&&o.colors.disabled};
|
|
56
|
-
}
|
|
57
|
-
}
|
|
58
|
-
|
|
59
|
-
${({theme:o,$disabled:t,$checked:s,$hasError:l})=>o.utilities.useDefaultFromControls?null:e`
|
|
60
|
-
min-height: 2rem;
|
|
61
|
-
|
|
62
|
-
${i} ${r} {
|
|
63
|
-
border: solid ${"2px"}
|
|
64
|
-
${t?o.colors.disabled:l?o.colors.danger:s?o.colors.check:o.colors.inputBorder};
|
|
65
|
-
}
|
|
66
|
-
|
|
67
|
-
&:hover ${i} ${r} {
|
|
68
|
-
border: solid ${"2px"}
|
|
69
|
-
${t?o.colors.disabled:o.colours};
|
|
70
|
-
}
|
|
71
|
-
`}
|
|
72
|
-
`,l=o.div`
|
|
73
|
-
position: absolute;
|
|
74
|
-
top: 0;
|
|
75
|
-
left: 0;
|
|
76
|
-
width: 100%;
|
|
77
|
-
height: 100%;
|
|
78
|
-
`,n=o.input`
|
|
79
|
-
margin-right: 5px !important;
|
|
80
|
-
|
|
81
|
-
${({theme:o})=>o.utilities.useDefaultFromControls?e`
|
|
82
|
-
position: absolute;
|
|
83
|
-
display: inline-block;
|
|
84
|
-
transform: translate(-50%, -50%);
|
|
85
|
-
top: 50%;
|
|
86
|
-
margin: 0;
|
|
87
|
-
padding: 0;
|
|
88
|
-
left: ${o.spacing.s};
|
|
89
|
-
`:e`
|
|
90
|
-
/* This hides the original input */
|
|
91
|
-
position: absolute;
|
|
92
|
-
left: ${o.spacing.xxs};
|
|
93
|
-
opacity: 0;
|
|
94
|
-
|
|
95
|
-
&:focus ~ ${l} {
|
|
96
|
-
outline: none !important;
|
|
97
|
-
box-shadow: inset 0 0 0 2px ${o.colors.inputBorder};
|
|
98
|
-
box-shadow: inset 0 0 0 2px -webkit-focus-ring-color;
|
|
99
|
-
}
|
|
100
|
-
|
|
101
|
-
&:checked ~ ${i} svg path {
|
|
102
|
-
transform: rotateY(0deg);
|
|
103
|
-
}
|
|
104
|
-
`}
|
|
105
|
-
`;export{r as Check,i as CheckWrapper,l as SelectedBorder,n as StyledInput,s as StyledLabel};
|
|
1
|
+
import{__makeTemplateObject as n}from"../../../node_modules/tslib/tslib.es6.js";import o,{css as t}from"styled-components";var i,e,r,s,a,l,c,d,p="1.5rem",h=o.div(i||(i=n(["\n display: inline-block;\n height: ",";\n width: ",";\n position: absolute;\n top: calc(50% - ("," / 2));\n left: ",";\n"],["\n display: inline-block;\n height: ",";\n width: ",";\n position: absolute;\n top: calc(50% - ("," / 2));\n left: ",";\n"])),p,p,p,(function(n){return n.theme.spacing.xs})),u=o.span(e||(e=n(["\n display: block;\n position: relative;\n border: 2px solid ",";\n height: ",";\n width: ",";\n top: 0;\n bottom: 0;\n left: 0;\n right: 0;\n z-index: 5;\n transition: border 0.25s ease;\n overflow: hidden;\n\n svg {\n path {\n transition: transform 0.25s ease;\n transform: rotateY(90deg);\n transform-origin: center;\n }\n }\n"],["\n display: block;\n position: relative;\n border: 2px solid ",";\n height: ",";\n width: ",";\n top: 0;\n bottom: 0;\n left: 0;\n right: 0;\n z-index: 5;\n transition: border 0.25s ease;\n overflow: hidden;\n\n svg {\n path {\n transition: transform 0.25s ease;\n transform: rotateY(90deg);\n transform-origin: center;\n }\n }\n"])),(function(n){return n.theme.colors.selectionBorder}),p,p),b=o.label(s||(s=n(["\n box-sizing: border-box;\n *,\n *:after,\n *:before {\n box-sizing: border-box;\n }\n line-height: ",";\n font-size: ",";\n font-family: ",";\n\n background-color: ",";\n position: relative;\n\n cursor: ",";\n display: block;\n\n color: ",";\n padding: ",";\n &:focus ~ "," "," {\n outline: 2px solid #7aacfe; /* for non-webkit browsers */\n outline: 5px auto -webkit-focus-ring-color;\n }\n\n svg {\n path {\n fill: ",";\n }\n }\n\n ","\n"],["\n box-sizing: border-box;\n *,\n *:after,\n *:before {\n box-sizing: border-box;\n }\n line-height: ",";\n font-size: ",";\n font-family: ",";\n\n background-color: ",";\n position: relative;\n\n cursor: ",";\n display: block;\n\n color: ",";\n padding: ",";\n &:focus ~ "," "," {\n outline: 2px solid #7aacfe; /* for non-webkit browsers */\n outline: 5px auto -webkit-focus-ring-color;\n }\n\n svg {\n path {\n fill: ",";\n }\n }\n\n ","\n"])),(function(n){return n.theme.typography.lineHeight}),(function(n){return n.theme.typography.fontSizeBase}),(function(n){return n.theme.typography.fontFamilyBase}),(function(n){return n.theme.colors.backgroundLight}),(function(n){return n.$disabled?"not-allowed":"pointer"}),(function(n){var o=n.theme;return n.$disabled?o.colors.disabled:o.colors.textDark}),(function(n){var o=n.theme;return"calc( (".concat("3em"," - ( ").concat(o.utilities.inputBorderWidth," * 2) - ").concat(o.typography.lineHeight," ) / 2) ").concat(o.spacing.m," calc( (").concat("3em"," - ( ").concat(o.utilities.inputBorderWidth," * 2) - ").concat(o.typography.lineHeight," ) / 2) ").concat(o.spacing.xl)}),h,u,(function(n){var o=n.theme;return n.$disabled&&o.colors.disabled}),(function(o){var i=o.theme,e=o.$disabled,s=o.$checked,a=o.$hasError;return i.utilities.useDefaultFromControls?null:t(r||(r=n(["\n min-height: 2rem;\n\n "," "," {\n border: solid ","\n ",";\n }\n\n &:hover "," "," {\n border: solid ","\n ",";\n }\n "],["\n min-height: 2rem;\n\n "," "," {\n border: solid ","\n ",";\n }\n\n &:hover "," "," {\n border: solid ","\n ",";\n }\n "])),h,u,"2px",e?i.colors.disabled:a?i.colors.danger:s?i.colors.check:i.colors.inputBorder,h,u,"2px",e?i.colors.disabled:i.colours)})),f=o.div(a||(a=n(["\n position: absolute;\n top: 0;\n left: 0;\n width: 100%;\n height: 100%;\n"],["\n position: absolute;\n top: 0;\n left: 0;\n width: 100%;\n height: 100%;\n"]))),g=o.input(d||(d=n(["\n margin-right: 5px !important;\n\n ","\n"],["\n margin-right: 5px !important;\n\n ","\n"])),(function(o){var i=o.theme;return i.utilities.useDefaultFromControls?t(l||(l=n(["\n position: absolute;\n display: inline-block;\n transform: translate(-50%, -50%);\n top: 50%;\n margin: 0;\n padding: 0;\n left: ",";\n "],["\n position: absolute;\n display: inline-block;\n transform: translate(-50%, -50%);\n top: 50%;\n margin: 0;\n padding: 0;\n left: ",";\n "])),i.spacing.s):t(c||(c=n(["\n /* This hides the original input */\n position: absolute;\n left: ",";\n opacity: 0;\n\n &:focus ~ "," {\n outline: none !important;\n box-shadow: inset 0 0 0 2px ",";\n box-shadow: inset 0 0 0 2px -webkit-focus-ring-color;\n }\n\n &:checked ~ "," svg path {\n transform: rotateY(0deg);\n }\n "],["\n /* This hides the original input */\n position: absolute;\n left: ",";\n opacity: 0;\n\n &:focus ~ "," {\n outline: none !important;\n box-shadow: inset 0 0 0 2px ",";\n box-shadow: inset 0 0 0 2px -webkit-focus-ring-color;\n }\n\n &:checked ~ "," svg path {\n transform: rotateY(0deg);\n }\n "])),i.spacing.xxs,f,i.colors.inputBorder,h)}));export{u as Check,h as CheckWrapper,f as SelectedBorder,g as StyledInput,b as StyledLabel};
|
|
106
2
|
//# sourceMappingURL=styles.js.map
|