@cruk/cruk-react-components 5.0.7 → 5.0.8
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/lib/.storybook/main.d.ts +3 -0
- package/lib/.storybook/preview.d.ts +3 -0
- package/lib/node_modules/@babel/runtime/helpers/esm/objectWithoutPropertiesLoose.js +1 -1
- package/lib/node_modules/@babel/runtime/helpers/esm/objectWithoutPropertiesLoose.js.map +1 -1
- package/lib/node_modules/@babel/runtime/helpers/esm/toPrimitive.js +1 -1
- package/lib/node_modules/@babel/runtime/helpers/esm/toPrimitive.js.map +1 -1
- package/lib/node_modules/@fortawesome/free-solid-svg-icons/index.js +6 -1
- package/lib/node_modules/@fortawesome/free-solid-svg-icons/index.js.map +1 -1
- package/lib/node_modules/focus-lock/dist/es2015/focusInside.js.map +1 -1
- package/lib/node_modules/focus-lock/dist/es2015/focusIsHidden.js.map +1 -1
- package/lib/node_modules/focus-lock/dist/es2015/focusSolver.js +1 -1
- package/lib/node_modules/focus-lock/dist/es2015/moveFocusInside.js.map +1 -1
- package/lib/node_modules/focus-lock/dist/es2015/return-focus.js.map +1 -1
- package/lib/node_modules/focus-lock/dist/es2015/sibling.js +1 -1
- package/lib/node_modules/focus-lock/dist/es2015/sibling.js.map +1 -1
- package/lib/node_modules/focus-lock/dist/es2015/solver.js +1 -1
- package/lib/node_modules/focus-lock/dist/es2015/solver.js.map +1 -1
- package/lib/node_modules/focus-lock/dist/es2015/utils/DOMutils.js.map +1 -1
- package/lib/node_modules/focus-lock/dist/es2015/utils/all-affected.js +1 -1
- package/lib/node_modules/focus-lock/dist/es2015/utils/auto-focus.js.map +1 -1
- package/lib/node_modules/focus-lock/dist/es2015/utils/getActiveElement.js.map +1 -1
- package/lib/node_modules/focus-lock/dist/es2015/utils/is.js.map +1 -1
- package/lib/node_modules/focus-lock/dist/es2015/utils/parenting.js.map +1 -1
- package/lib/node_modules/focus-lock/dist/es2015/utils/tabOrder.js.map +1 -1
- package/lib/node_modules/focus-lock/dist/es2015/utils/tabUtils.js.map +1 -1
- package/lib/node_modules/react-focus-lock/dist/es2015/Combination.js +1 -1
- package/lib/node_modules/react-focus-lock/dist/es2015/Combination.js.map +1 -1
- package/lib/node_modules/react-focus-lock/dist/es2015/FocusGuard.js.map +1 -1
- package/lib/node_modules/react-focus-lock/dist/es2015/Lock.js +1 -1
- package/lib/node_modules/react-focus-lock/dist/es2015/Lock.js.map +1 -1
- package/lib/node_modules/react-focus-lock/dist/es2015/Trap.js +1 -1
- package/lib/node_modules/react-focus-lock/dist/es2015/Trap.js.map +1 -1
- package/lib/node_modules/react-intersection-observer/dist/index.js.map +1 -1
- package/lib/node_modules/tslib/tslib.es6.js +1 -1
- package/lib/node_modules/tslib/tslib.es6.js.map +1 -1
- package/lib/node_modules/use-sidecar/dist/es2015/medium.js.map +1 -1
- package/lib/{components → src/components}/AddressLookup/AddressLookup.stories.d.ts +4 -4
- package/lib/{components → src/components}/AddressLookup/index.d.ts +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 +38 -1
- package/lib/src/components/AddressLookup/styles.js.map +1 -1
- package/lib/{components → src/components}/Avatar/Avatar.stories.d.ts +1 -1
- package/lib/src/components/Avatar/index.js +1 -1
- package/lib/src/components/Avatar/index.js.map +1 -1
- package/lib/src/components/Avatar/styles.js +10 -1
- package/lib/src/components/Avatar/styles.js.map +1 -1
- package/lib/{components → src/components}/Badge/Badge.stories.d.ts +1 -1
- package/lib/src/components/Badge/index.js +1 -1
- package/lib/src/components/Badge/index.js.map +1 -1
- package/lib/src/components/Badge/styles.js +17 -1
- package/lib/src/components/Badge/styles.js.map +1 -1
- package/lib/{components → src/components}/Box/Box.stories.d.ts +1 -1
- package/lib/src/components/Box/index.js +1 -1
- package/lib/src/components/Box/index.js.map +1 -1
- package/lib/src/components/Box/styles.js +13 -1
- package/lib/src/components/Box/styles.js.map +1 -1
- package/lib/{components → src/components}/Button/Button.stories.d.ts +1 -1
- package/lib/src/components/Button/index.js +1 -1
- package/lib/src/components/Button/index.js.map +1 -1
- package/lib/src/components/Button/styles.js +108 -1
- package/lib/src/components/Button/styles.js.map +1 -1
- package/lib/{components → src/components}/Carousel/Carousel.stories.d.ts +2 -2
- package/lib/src/components/Carousel/Dots.js +1 -1
- package/lib/src/components/Carousel/Dots.js.map +1 -1
- package/lib/src/components/Carousel/index.js +1 -1
- package/lib/src/components/Carousel/index.js.map +1 -1
- package/lib/src/components/Carousel/styles.js +96 -1
- package/lib/src/components/Carousel/styles.js.map +1 -1
- package/lib/{components → src/components}/Checkbox/Checkbox.stories.d.ts +2 -2
- package/lib/src/components/Checkbox/index.js +1 -1
- package/lib/src/components/Checkbox/index.js.map +1 -1
- package/lib/src/components/Checkbox/styles.js +105 -1
- package/lib/src/components/Checkbox/styles.js.map +1 -1
- package/lib/{components → src/components}/Collapse/Collapse.stories.d.ts +1 -1
- package/lib/src/components/Collapse/index.js +1 -1
- package/lib/src/components/Collapse/index.js.map +1 -1
- package/lib/src/components/Collapse/styles.js +31 -1
- package/lib/src/components/Collapse/styles.js.map +1 -1
- package/lib/{components → src/components}/DateField/DateField.stories.d.ts +1 -1
- package/lib/src/components/DateField/index.js +1 -1
- package/lib/src/components/DateField/index.js.map +1 -1
- package/lib/src/components/DateField/styles.js +26 -1
- package/lib/src/components/DateField/styles.js.map +1 -1
- package/lib/src/components/Divider.js +17 -1
- package/lib/src/components/Divider.js.map +1 -1
- package/lib/{components → src/components}/ErrorText/ErrorText.stories.d.ts +1 -1
- package/lib/src/components/ErrorText/index.js +1 -1
- package/lib/src/components/ErrorText/index.js.map +1 -1
- package/lib/src/components/ErrorText/styles.js +5 -1
- package/lib/src/components/ErrorText/styles.js.map +1 -1
- package/lib/src/components/Flex.js +7 -1
- package/lib/src/components/Flex.js.map +1 -1
- package/lib/src/components/Fontface.js +1 -1
- package/lib/src/components/Fontface.js.map +1 -1
- package/lib/{components → src/components}/Footer/Footer.stories.d.ts +2 -2
- package/lib/src/components/Footer/index.js +1 -1
- package/lib/src/components/Footer/index.js.map +1 -1
- package/lib/src/components/Footer/styles.js +69 -1
- package/lib/src/components/Footer/styles.js.map +1 -1
- package/lib/src/components/GlobalStyle.js +37 -1
- package/lib/src/components/GlobalStyle.js.map +1 -1
- package/lib/src/components/GlobalStyleNoFontFace.js +37 -1
- package/lib/src/components/GlobalStyleNoFontFace.js.map +1 -1
- package/lib/{components → src/components}/Header/Header.stories.d.ts +1 -1
- package/lib/src/components/Header/index.js +1 -1
- package/lib/src/components/Header/index.js.map +1 -1
- package/lib/src/components/Header/styles.js +109 -1
- package/lib/src/components/Header/styles.js.map +1 -1
- package/lib/{components → src/components}/Heading/Heading.stories.d.ts +1 -1
- package/lib/src/components/Heading/index.js +1 -1
- package/lib/src/components/Heading/index.js.map +1 -1
- package/lib/src/components/Heading/styles.js +75 -1
- package/lib/src/components/Heading/styles.js.map +1 -1
- package/lib/{components → src/components}/IconFa/IconFa.stories.d.ts +1 -1
- package/lib/src/components/IconFa/index.js +1 -1
- package/lib/src/components/IconFa/index.js.map +1 -1
- package/lib/src/components/IconFa/styles.js +10 -1
- package/lib/src/components/IconFa/styles.js.map +1 -1
- package/lib/{components → src/components}/InfoBox/InfoBox.stories.d.ts +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 +12 -1
- package/lib/src/components/InfoBox/styles.js.map +1 -1
- package/lib/src/components/LabelWrapper/index.js +1 -1
- package/lib/src/components/LabelWrapper/index.js.map +1 -1
- package/lib/src/components/LabelWrapper/styles.js +15 -1
- package/lib/src/components/LabelWrapper/styles.js.map +1 -1
- package/lib/{components → src/components}/LegendWrapper/LegendWrapper.stories.d.ts +1 -1
- package/lib/src/components/LegendWrapper/index.js +1 -1
- package/lib/src/components/LegendWrapper/index.js.map +1 -1
- package/lib/src/components/LegendWrapper/styles.js +34 -1
- package/lib/src/components/LegendWrapper/styles.js.map +1 -1
- package/lib/{components → src/components}/Link/Link.stories.d.ts +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 +29 -1
- package/lib/src/components/Link/styles.js.map +1 -1
- package/lib/{components → src/components}/Loader/Loader.stories.d.ts +1 -1
- package/lib/src/components/Loader/index.js +1 -1
- package/lib/src/components/Loader/index.js.map +1 -1
- package/lib/src/components/Loader/styles.js +45 -1
- package/lib/src/components/Loader/styles.js.map +1 -1
- package/lib/{components → src/components}/Modal/Modal.stories.d.ts +1 -1
- package/lib/src/components/Modal/index.js +1 -1
- package/lib/src/components/Modal/index.js.map +1 -1
- package/lib/src/components/Modal/styles.js +59 -1
- package/lib/src/components/Modal/styles.js.map +1 -1
- package/lib/{components → src/components}/Pagination/Pagination.stories.d.ts +1 -1
- package/lib/src/components/Pagination/index.js +1 -1
- package/lib/src/components/Pagination/index.js.map +1 -1
- package/lib/src/components/Pagination/styles.js +92 -1
- package/lib/src/components/Pagination/styles.js.map +1 -1
- package/lib/{components → src/components}/PopOver/Popover.stories.d.ts +1 -1
- package/lib/src/components/PopOver/index.js +1 -1
- package/lib/src/components/PopOver/index.js.map +1 -1
- package/lib/src/components/PopOver/styles.js +81 -1
- package/lib/src/components/PopOver/styles.js.map +1 -1
- package/lib/{components → src/components}/ProgressBar/ProgressBar.stories.d.ts +1 -1
- package/lib/src/components/ProgressBar/index.js +1 -1
- package/lib/src/components/ProgressBar/index.js.map +1 -1
- package/lib/src/components/ProgressBar/styles.js +132 -1
- package/lib/src/components/ProgressBar/styles.js.map +1 -1
- package/lib/{components → src/components}/Radio/Radio.stories.d.ts +2 -2
- package/lib/src/components/Radio/index.js +1 -1
- package/lib/src/components/Radio/index.js.map +1 -1
- package/lib/src/components/Radio/styles.js +125 -1
- package/lib/src/components/Radio/styles.js.map +1 -1
- package/lib/{components → src/components}/RadioConsent/Radio.stories.d.ts +1 -1
- package/lib/src/components/RadioConsent/index.js +1 -1
- package/lib/src/components/RadioConsent/index.js.map +1 -1
- package/lib/src/components/RadioConsent/styles.js +26 -1
- package/lib/src/components/RadioConsent/styles.js.map +1 -1
- package/lib/{components → src/components}/Select/Selelct.stories.d.ts +2 -2
- package/lib/src/components/Select/index.js +1 -1
- package/lib/src/components/Select/index.js.map +1 -1
- package/lib/src/components/Select/styles.js +41 -1
- package/lib/src/components/Select/styles.js.map +1 -1
- package/lib/src/components/Spacing/index.js +1 -1
- package/lib/src/components/Spacing/index.js.map +1 -1
- package/lib/{components → src/components}/Step/Step.stories.d.ts +1 -1
- package/lib/src/components/Step/index.js +1 -1
- package/lib/src/components/Step/index.js.map +1 -1
- package/lib/src/components/Step/styles.js +79 -1
- package/lib/src/components/Step/styles.js.map +1 -1
- package/lib/{components → src/components}/Text/Text.stories.d.ts +1 -1
- package/lib/src/components/Text/index.js +1 -1
- package/lib/src/components/Text/index.js.map +1 -1
- package/lib/src/components/Text/styles.js +19 -1
- package/lib/src/components/Text/styles.js.map +1 -1
- package/lib/{components → src/components}/TextAreaField/TextAreaField.stories.d.ts +1 -1
- package/lib/src/components/TextAreaField/index.js +1 -1
- package/lib/src/components/TextAreaField/index.js.map +1 -1
- package/lib/src/components/TextAreaField/styles.js +29 -1
- package/lib/src/components/TextAreaField/styles.js.map +1 -1
- package/lib/{components → src/components}/TextField/TextField.stories.d.ts +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 +110 -1
- package/lib/src/components/TextField/styles.js.map +1 -1
- package/lib/{components → src/components}/Totaliser/Totaliser.stories.d.ts +1 -1
- package/lib/src/components/Totaliser/index.js +1 -1
- package/lib/src/components/Totaliser/index.js.map +1 -1
- package/lib/src/components/Totaliser/styles.js +59 -1
- package/lib/src/components/Totaliser/styles.js.map +1 -1
- package/lib/{components → src/components}/UserBlock/UserBlock.stories.d.ts +1 -1
- package/lib/src/components/UserBlock/index.js +1 -1
- package/lib/src/components/UserBlock/index.js.map +1 -1
- package/lib/src/components/UserBlock/styles.js +21 -1
- package/lib/src/components/UserBlock/styles.js.map +1 -1
- package/lib/{hooks → src/hooks}/useEffectBrowser.d.ts +1 -1
- package/lib/src/hooks/useEffectBrowser.js +1 -1
- package/lib/src/hooks/useEffectBrowser.js.map +1 -1
- package/lib/src/hooks/useKey.js +1 -1
- package/lib/src/hooks/useKey.js.map +1 -1
- package/lib/{hooks → src/hooks}/useLayoutEffectBrowser.d.ts +1 -1
- package/lib/src/hooks/useLayoutEffectBrowser.js +1 -1
- package/lib/src/hooks/useLayoutEffectBrowser.js.map +1 -1
- package/lib/src/hooks/useScrollPosition.js +1 -1
- package/lib/src/hooks/useScrollPosition.js.map +1 -1
- package/lib/src/themes/bowelbabe.js +1 -1
- package/lib/src/themes/bowelbabe.js.map +1 -1
- package/lib/src/themes/cruk.js +1 -1
- package/lib/src/themes/cruk.js.map +1 -1
- package/lib/src/themes/rfl.js +1 -1
- package/lib/src/themes/rfl.js.map +1 -1
- package/lib/src/themes/su2c.js +1 -1
- package/lib/src/themes/su2c.js.map +1 -1
- package/lib/{types.d.ts → src/types.d.ts} +1 -3
- package/lib/src/utils/Helper.js +1 -1
- package/lib/src/utils/Helper.js.map +1 -1
- package/lib/src/utils/debounce.d.ts +2 -0
- package/lib/src/utils/debounce.js +1 -1
- package/lib/src/utils/debounce.js.map +1 -1
- package/lib/src/utils/themeUtils.js +1 -1
- package/lib/src/utils/themeUtils.js.map +1 -1
- package/package.json +23 -30
- package/lib/utils/debounce.d.ts +0 -2
- /package/lib/{components → src/components}/AddressLookup/AddressLookUp.test.cypress.d.ts +0 -0
- /package/lib/{components → src/components}/AddressLookup/styles.d.ts +0 -0
- /package/lib/{components → src/components}/AllThemesWrapper.d.ts +0 -0
- /package/lib/{components → src/components}/Avatar/Avatar.test.cypress.d.ts +0 -0
- /package/lib/{components → src/components}/Avatar/index.d.ts +0 -0
- /package/lib/{components → src/components}/Avatar/styles.d.ts +0 -0
- /package/lib/{components → src/components}/Badge/Badge.test.cypress.d.ts +0 -0
- /package/lib/{components → src/components}/Badge/index.d.ts +0 -0
- /package/lib/{components → src/components}/Badge/styles.d.ts +0 -0
- /package/lib/{components → src/components}/Box/Box.test.cypress.d.ts +0 -0
- /package/lib/{components → src/components}/Box/index.d.ts +0 -0
- /package/lib/{components → src/components}/Box/styles.d.ts +0 -0
- /package/lib/{components → src/components}/Button/Button.test.cypress.d.ts +0 -0
- /package/lib/{components → src/components}/Button/index.d.ts +0 -0
- /package/lib/{components → src/components}/Button/styles.d.ts +0 -0
- /package/lib/{components → src/components}/Carousel/Carousel.test.cypress.d.ts +0 -0
- /package/lib/{components → src/components}/Carousel/Dots.d.ts +0 -0
- /package/lib/{components → src/components}/Carousel/index.d.ts +0 -0
- /package/lib/{components → src/components}/Carousel/styles.d.ts +0 -0
- /package/lib/{components → src/components}/Checkbox/CheckBox.test.cypress.d.ts +0 -0
- /package/lib/{components → src/components}/Checkbox/index.d.ts +0 -0
- /package/lib/{components → src/components}/Checkbox/styles.d.ts +0 -0
- /package/lib/{components → src/components}/Collapse/Collapse.test.cypress.d.ts +0 -0
- /package/lib/{components → src/components}/Collapse/index.d.ts +0 -0
- /package/lib/{components → src/components}/Collapse/styles.d.ts +0 -0
- /package/lib/{components → src/components}/DateField/DateField.test.cypress.d.ts +0 -0
- /package/lib/{components → src/components}/DateField/index.d.ts +0 -0
- /package/lib/{components → src/components}/DateField/styles.d.ts +0 -0
- /package/lib/{components → src/components}/Divider.d.ts +0 -0
- /package/lib/{components → src/components}/ErrorText/ErrorText.test.cypress.d.ts +0 -0
- /package/lib/{components → src/components}/ErrorText/index.d.ts +0 -0
- /package/lib/{components → src/components}/ErrorText/styles.d.ts +0 -0
- /package/lib/{components → src/components}/Flex.d.ts +0 -0
- /package/lib/{components → src/components}/Fontface.d.ts +0 -0
- /package/lib/{components → src/components}/Footer/Footer.test.cypress.d.ts +0 -0
- /package/lib/{components → src/components}/Footer/index.d.ts +0 -0
- /package/lib/{components → src/components}/Footer/styles.d.ts +0 -0
- /package/lib/{components → src/components}/GlobalStyle.d.ts +0 -0
- /package/lib/{components → src/components}/GlobalStyleNoFontFace.d.ts +0 -0
- /package/lib/{components → src/components}/Header/Header.test.cypress.d.ts +0 -0
- /package/lib/{components → src/components}/Header/index.d.ts +0 -0
- /package/lib/{components → src/components}/Header/styles.d.ts +0 -0
- /package/lib/{components → src/components}/Heading/Heading.test.cypress.d.ts +0 -0
- /package/lib/{components → src/components}/Heading/index.d.ts +0 -0
- /package/lib/{components → src/components}/Heading/styles.d.ts +0 -0
- /package/lib/{components → src/components}/IconFa/IconFa.test.cypress.d.ts +0 -0
- /package/lib/{components → src/components}/IconFa/index.d.ts +0 -0
- /package/lib/{components → src/components}/IconFa/styles.d.ts +0 -0
- /package/lib/{components → src/components}/InfoBox/InfoBox.test.cypress.d.ts +0 -0
- /package/lib/{components → src/components}/InfoBox/index.d.ts +0 -0
- /package/lib/{components → src/components}/InfoBox/styles.d.ts +0 -0
- /package/lib/{components → src/components}/LabelWrapper/index.d.ts +0 -0
- /package/lib/{components → src/components}/LabelWrapper/styles.d.ts +0 -0
- /package/lib/{components → src/components}/LegendWrapper/LegendWrapper.test.cypress.d.ts +0 -0
- /package/lib/{components → src/components}/LegendWrapper/index.d.ts +0 -0
- /package/lib/{components → src/components}/LegendWrapper/styles.d.ts +0 -0
- /package/lib/{components → src/components}/Link/Link.test.cypress.d.ts +0 -0
- /package/lib/{components → src/components}/Link/index.d.ts +0 -0
- /package/lib/{components → src/components}/Link/styles.d.ts +0 -0
- /package/lib/{components → src/components}/Loader/Loader.test.cypress.d.ts +0 -0
- /package/lib/{components → src/components}/Loader/index.d.ts +0 -0
- /package/lib/{components → src/components}/Loader/styles.d.ts +0 -0
- /package/lib/{components → src/components}/Modal/Modal.test.cypress.d.ts +0 -0
- /package/lib/{components → src/components}/Modal/index.d.ts +0 -0
- /package/lib/{components → src/components}/Modal/styles.d.ts +0 -0
- /package/lib/{components → src/components}/Pagination/Pagination.test.cypress.d.ts +0 -0
- /package/lib/{components → src/components}/Pagination/index.d.ts +0 -0
- /package/lib/{components → src/components}/Pagination/styles.d.ts +0 -0
- /package/lib/{components → src/components}/PopOver/PopOver.test.cypress.d.ts +0 -0
- /package/lib/{components → src/components}/PopOver/index.d.ts +0 -0
- /package/lib/{components → src/components}/PopOver/styles.d.ts +0 -0
- /package/lib/{components → src/components}/ProgressBar/ProgressBar.test.cypress.d.ts +0 -0
- /package/lib/{components → src/components}/ProgressBar/index.d.ts +0 -0
- /package/lib/{components → src/components}/ProgressBar/styles.d.ts +0 -0
- /package/lib/{components → src/components}/Radio/Radio.test.cypress.d.ts +0 -0
- /package/lib/{components → src/components}/Radio/index.d.ts +0 -0
- /package/lib/{components → src/components}/Radio/styles.d.ts +0 -0
- /package/lib/{components → src/components}/RadioConsent/RadioConsent.test.cypress.d.ts +0 -0
- /package/lib/{components → src/components}/RadioConsent/index.d.ts +0 -0
- /package/lib/{components → src/components}/RadioConsent/styles.d.ts +0 -0
- /package/lib/{components → src/components}/Select/Select.test.cypress.d.ts +0 -0
- /package/lib/{components → src/components}/Select/index.d.ts +0 -0
- /package/lib/{components → src/components}/Select/styles.d.ts +0 -0
- /package/lib/{components → src/components}/Spacing/index.d.ts +0 -0
- /package/lib/{components → src/components}/Step/Step.test.cypress.d.ts +0 -0
- /package/lib/{components → src/components}/Step/index.d.ts +0 -0
- /package/lib/{components → src/components}/Step/styles.d.ts +0 -0
- /package/lib/{components → src/components}/Text/Text.test.cypress.d.ts +0 -0
- /package/lib/{components → src/components}/Text/index.d.ts +0 -0
- /package/lib/{components → src/components}/Text/styles.d.ts +0 -0
- /package/lib/{components → src/components}/TextAreaField/TextAreaField.test.cypress.d.ts +0 -0
- /package/lib/{components → src/components}/TextAreaField/index.d.ts +0 -0
- /package/lib/{components → src/components}/TextAreaField/styles.d.ts +0 -0
- /package/lib/{components → src/components}/TextField/TextField.test.cypress.d.ts +0 -0
- /package/lib/{components → src/components}/TextField/index.d.ts +0 -0
- /package/lib/{components → src/components}/TextField/styles.d.ts +0 -0
- /package/lib/{components → src/components}/ThemeCheatSheet.d.ts +0 -0
- /package/lib/{components → src/components}/Totaliser/Totaliser.test.cypress.d.ts +0 -0
- /package/lib/{components → src/components}/Totaliser/index.d.ts +0 -0
- /package/lib/{components → src/components}/Totaliser/styles.d.ts +0 -0
- /package/lib/{components → src/components}/UserBlock/UserBlock.test.cypress.d.ts +0 -0
- /package/lib/{components → src/components}/UserBlock/index.d.ts +0 -0
- /package/lib/{components → src/components}/UserBlock/styles.d.ts +0 -0
- /package/lib/{components → src/components}/index.d.ts +0 -0
- /package/lib/{hooks → src/hooks}/useKey.d.ts +0 -0
- /package/lib/{hooks → src/hooks}/useScrollPosition.d.ts +0 -0
- /package/lib/{themes → src/themes}/bowelbabe.d.ts +0 -0
- /package/lib/{themes → src/themes}/cruk.d.ts +0 -0
- /package/lib/{themes → src/themes}/rfl.d.ts +0 -0
- /package/lib/{themes → src/themes}/su2c.d.ts +0 -0
- /package/lib/{utils → src/utils}/Helper.d.ts +0 -0
- /package/lib/{utils → src/utils}/__tests__/testHelpers.test.d.ts +0 -0
- /package/lib/{utils → src/utils}/themeUtils.d.ts +0 -0
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sources":["../../../../src/components/Heading/index.tsx"],"sourcesContent":["import React, { type HTMLAttributes, type ElementType } from \"react\";\nimport { useTheme } from \"styled-components\";\n\nimport { crukTheme as defaultTheme } from \"../../themes/cruk\";\nimport {\n spacingPropsToSpacingPropsInternal,\n type SpacingProps,\n} from \"../Spacing\";\n\nimport {\n type FontSizeType,\n type WordBreakType,\n type OverflowWrapType,\n} from \"../../types\";\nimport { H1, H2, H3, H4, H5, H6 } from \"./styles\";\n\nexport type HeadingProps = SpacingProps &\n HTMLAttributes<HTMLElement> & {\n h1?: boolean;\n h2?: boolean;\n h3?: boolean;\n h4?: boolean;\n h5?: boolean;\n h6?: boolean;\n /** font size FontSizeType t-shirt sizes */\n textSize?: FontSizeType;\n /** horizontal alignment of text */\n textAlign?: \"left\" | \"right\" | \"center\";\n /** color of text */\n textColor?: string;\n /** word-break behavior */\n wordBreak?: WordBreakType;\n /** overflow-wrap behavior */\n overflowWrap?: OverflowWrapType;\n /** styled-component polymorphic feature so you take the styling of a header and cast the component to be a \"span\" for example */\n as?: ElementType;\n };\n\n/**\n * \n * Use headings consistently to create a clear hierarchy throughout your service.\nMarkup headings semantically using the appropriate <h#> level HTML element and\nuse the corresponding heading class (h1, h2, h3, ....). Write all headings in sentence case. Heading differs from the Text component by using a different font-family and it changes the font size according to the screen width breakpoints.\n * \n */\nexport function Heading({\n textSize,\n textAlign,\n textColor,\n wordBreak,\n overflowWrap,\n h1,\n h2,\n h3,\n h4,\n h5,\n h6,\n ...props\n}: HeadingProps) {\n const foundTheme = useTheme();\n const theme = {\n ...defaultTheme,\n ...foundTheme,\n };\n\n const propsConvertedToInternalSpacingProps =\n spacingPropsToSpacingPropsInternal(props);\n\n if (h1)\n return (\n <H1\n {...propsConvertedToInternalSpacingProps}\n theme={theme}\n $textSize={textSize}\n $textAlign={textAlign}\n $textColor={textColor}\n $wordBreak={wordBreak}\n $overflowWrap={overflowWrap}\n />\n );\n if (h2)\n return (\n <H2\n {...propsConvertedToInternalSpacingProps}\n theme={theme}\n $textSize={textSize}\n $textAlign={textAlign}\n $textColor={textColor}\n $wordBreak={wordBreak}\n $overflowWrap={overflowWrap}\n />\n );\n if (h3)\n return (\n <H3\n {...propsConvertedToInternalSpacingProps}\n theme={theme}\n $textSize={textSize}\n $textAlign={textAlign}\n $textColor={textColor}\n $wordBreak={wordBreak}\n $overflowWrap={overflowWrap}\n />\n );\n if (h4)\n return (\n <H4\n {...propsConvertedToInternalSpacingProps}\n theme={theme}\n $textSize={textSize}\n $textAlign={textAlign}\n $textColor={textColor}\n $wordBreak={wordBreak}\n $overflowWrap={overflowWrap}\n />\n );\n if (h5)\n return (\n <H5\n {...propsConvertedToInternalSpacingProps}\n theme={theme}\n $textSize={textSize}\n $textAlign={textAlign}\n $textColor={textColor}\n $wordBreak={wordBreak}\n $overflowWrap={overflowWrap}\n />\n );\n if (h6)\n return (\n <H6\n {...propsConvertedToInternalSpacingProps}\n theme={theme}\n $textSize={textSize}\n $textAlign={textAlign}\n $textColor={textColor}\n $wordBreak={wordBreak}\n $overflowWrap={overflowWrap}\n />\n );\n return (\n <H2\n {...propsConvertedToInternalSpacingProps}\n theme={theme}\n $textSize={textSize}\n $textAlign={textAlign}\n $textColor={textColor}\n $wordBreak={wordBreak}\n $overflowWrap={overflowWrap}\n />\n );\n}\n\nexport default Heading;\n"],"names":["Heading","
|
|
1
|
+
{"version":3,"file":"index.js","sources":["../../../../src/components/Heading/index.tsx"],"sourcesContent":["import React, { type HTMLAttributes, type ElementType } from \"react\";\nimport { useTheme } from \"styled-components\";\n\nimport { crukTheme as defaultTheme } from \"../../themes/cruk\";\nimport {\n spacingPropsToSpacingPropsInternal,\n type SpacingProps,\n} from \"../Spacing\";\n\nimport {\n type FontSizeType,\n type WordBreakType,\n type OverflowWrapType,\n} from \"../../types\";\nimport { H1, H2, H3, H4, H5, H6 } from \"./styles\";\n\nexport type HeadingProps = SpacingProps &\n HTMLAttributes<HTMLElement> & {\n h1?: boolean;\n h2?: boolean;\n h3?: boolean;\n h4?: boolean;\n h5?: boolean;\n h6?: boolean;\n /** font size FontSizeType t-shirt sizes */\n textSize?: FontSizeType;\n /** horizontal alignment of text */\n textAlign?: \"left\" | \"right\" | \"center\";\n /** color of text */\n textColor?: string;\n /** word-break behavior */\n wordBreak?: WordBreakType;\n /** overflow-wrap behavior */\n overflowWrap?: OverflowWrapType;\n /** styled-component polymorphic feature so you take the styling of a header and cast the component to be a \"span\" for example */\n as?: ElementType;\n };\n\n/**\n * \n * Use headings consistently to create a clear hierarchy throughout your service.\nMarkup headings semantically using the appropriate <h#> level HTML element and\nuse the corresponding heading class (h1, h2, h3, ....). Write all headings in sentence case. Heading differs from the Text component by using a different font-family and it changes the font size according to the screen width breakpoints.\n * \n */\nexport function Heading({\n textSize,\n textAlign,\n textColor,\n wordBreak,\n overflowWrap,\n h1,\n h2,\n h3,\n h4,\n h5,\n h6,\n ...props\n}: HeadingProps) {\n const foundTheme = useTheme();\n const theme = {\n ...defaultTheme,\n ...foundTheme,\n };\n\n const propsConvertedToInternalSpacingProps =\n spacingPropsToSpacingPropsInternal(props);\n\n if (h1)\n return (\n <H1\n {...propsConvertedToInternalSpacingProps}\n theme={theme}\n $textSize={textSize}\n $textAlign={textAlign}\n $textColor={textColor}\n $wordBreak={wordBreak}\n $overflowWrap={overflowWrap}\n />\n );\n if (h2)\n return (\n <H2\n {...propsConvertedToInternalSpacingProps}\n theme={theme}\n $textSize={textSize}\n $textAlign={textAlign}\n $textColor={textColor}\n $wordBreak={wordBreak}\n $overflowWrap={overflowWrap}\n />\n );\n if (h3)\n return (\n <H3\n {...propsConvertedToInternalSpacingProps}\n theme={theme}\n $textSize={textSize}\n $textAlign={textAlign}\n $textColor={textColor}\n $wordBreak={wordBreak}\n $overflowWrap={overflowWrap}\n />\n );\n if (h4)\n return (\n <H4\n {...propsConvertedToInternalSpacingProps}\n theme={theme}\n $textSize={textSize}\n $textAlign={textAlign}\n $textColor={textColor}\n $wordBreak={wordBreak}\n $overflowWrap={overflowWrap}\n />\n );\n if (h5)\n return (\n <H5\n {...propsConvertedToInternalSpacingProps}\n theme={theme}\n $textSize={textSize}\n $textAlign={textAlign}\n $textColor={textColor}\n $wordBreak={wordBreak}\n $overflowWrap={overflowWrap}\n />\n );\n if (h6)\n return (\n <H6\n {...propsConvertedToInternalSpacingProps}\n theme={theme}\n $textSize={textSize}\n $textAlign={textAlign}\n $textColor={textColor}\n $wordBreak={wordBreak}\n $overflowWrap={overflowWrap}\n />\n );\n return (\n <H2\n {...propsConvertedToInternalSpacingProps}\n theme={theme}\n $textSize={textSize}\n $textAlign={textAlign}\n $textColor={textColor}\n $wordBreak={wordBreak}\n $overflowWrap={overflowWrap}\n />\n );\n}\n\nexport default Heading;\n"],"names":["Heading","textSize","textAlign","textColor","wordBreak","overflowWrap","h1","h2","h3","h4","h5","h6","props","foundTheme","useTheme","theme","defaultTheme","propsConvertedToInternalSpacingProps","spacingPropsToSpacingPropsInternal","React","H1","$textSize","$textAlign","$wordBreak","$overflowWrap","H2","H3","H4","H5","H6"],"mappings":"qQA6CgB,SAAAA,GAAQC,SACtBA,EAAQC,UACRA,EAASC,UACTA,EAASC,UACTA,EAASC,aACTA,EAAYC,GACZA,EAAEC,GACFA,EAAEC,GACFA,EAAEC,GACFA,EAAEC,GACFA,EAAEC,GACFA,KACGC,IAEH,MAAMC,EAAaC,IACbC,EAAQ,IACTC,KACAH,GAGCI,EACJC,EAAmCN,GAErC,OAAIN,EAEAa,gBAACC,EAAE,IACGH,EACJF,MAAOA,EAAKM,UACDpB,EACCqB,WAAApB,aACAC,EAASoB,WACTnB,EACGoB,cAAAnB,IAGjBE,EAEAY,gBAACM,EAAE,IACGR,EACJF,MAAOA,EAAKM,UACDpB,EACCqB,WAAApB,aACAC,EAASoB,WACTnB,EACGoB,cAAAnB,IAGjBG,EAEAW,gBAACO,EAAE,IACGT,EACJF,MAAOA,EAAKM,UACDpB,EACCqB,WAAApB,aACAC,EAASoB,WACTnB,EACGoB,cAAAnB,IAGjBI,EAEAU,gBAACQ,EAAE,IACGV,EACJF,MAAOA,EAAKM,UACDpB,EACCqB,WAAApB,aACAC,EAASoB,WACTnB,EACGoB,cAAAnB,IAGjBK,EAEAS,gBAACS,EAAE,IACGX,EACJF,MAAOA,EAAKM,UACDpB,EACCqB,WAAApB,aACAC,EAASoB,WACTnB,EACGoB,cAAAnB,IAGjBM,EAEAQ,gBAACU,EAAE,IACGZ,EACJF,MAAOA,EAAKM,UACDpB,EACCqB,WAAApB,aACAC,EAASoB,WACTnB,EACGoB,cAAAnB,IAInBc,gBAACM,EAAE,IACGR,EACJF,MAAOA,EAAKM,UACDpB,EACCqB,WAAApB,aACAC,EAASoB,WACTnB,EACGoB,cAAAnB,GAGrB"}
|
|
@@ -1,2 +1,76 @@
|
|
|
1
|
-
import
|
|
1
|
+
import e,{css as t}from"styled-components";import{spacing as i}from"../Spacing/index.js";const n=e=>t`
|
|
2
|
+
font-family: ${e.theme.typography.fontFamilyHeadings};
|
|
3
|
+
font-weight: ${e.theme.typography.fontWeightHeadings};
|
|
4
|
+
word-break: ${e.$wordBreak||"normal"};
|
|
5
|
+
overflow-wrap: ${e.$overflowWrap||"break-word"};
|
|
6
|
+
color: ${e.$textColor&&void 0!==e.theme.colors[e.$textColor]?e.theme.colors[e.$textColor]:e.$textColor||e.theme.colors.textHeaderDefault};
|
|
7
|
+
line-height: ${e.theme.typography.headerLineHeight};
|
|
8
|
+
text-transform: ${e.theme.typography.headerTextTransform};
|
|
9
|
+
margin-top: ${e.theme.spacing.m};
|
|
10
|
+
margin-bottom: ${e.theme.spacing.s};
|
|
11
|
+
max-width: 100%;
|
|
12
|
+
text-align: ${e.$textAlign||"left"};
|
|
13
|
+
|
|
14
|
+
&:first-child {
|
|
15
|
+
margin-top: 0;
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
${()=>{const{theme:t,...n}=e;return i(n,e.theme)}}
|
|
19
|
+
`,o=(e,t,i)=>{switch(e){case"m":return i.fontSizes.m;case"l":return i.fontSizes.l;case"xl":return i.fontSizes.xl;case"xxl":return i.fontSizes.xxl;case"xxxl":return i.fontSizes.xxxl;case"xxxxl":return i.fontSizes.xxxxl;default:return t}},l=(e,t,i)=>{switch(e){case"m":return i.fontSizes.m;case"l":case"xl":return i.fontSizes.l;case"xxl":return i.fontSizes.xl;case"xxxl":return i.fontSizes.xxl;case"xxxxl":return i.fontSizes.xxxl;default:return t}},x=(e,t,i)=>{switch(e){case"m":return i.fontSizes.m;case"l":case"xl":case"xxl":return i.fontSizes.l;case"xxxl":return i.fontSizes.xl;case"xxxxl":return i.fontSizes.xxl;default:return t}},s=e.h1`
|
|
20
|
+
${e=>n(e)}
|
|
21
|
+
font-size: ${({theme:e,$textSize:t})=>x(t||null,e.fontSizes.xxl,e)};
|
|
22
|
+
@media (min-width: ${({theme:e})=>e.breakpoint.tablet}) {
|
|
23
|
+
font-size: ${({theme:e,$textSize:t})=>l(t||null,e.fontSizes.xxxl,e)};
|
|
24
|
+
}
|
|
25
|
+
@media (min-width: ${({theme:e})=>e.breakpoint.desktop}) {
|
|
26
|
+
font-size: ${({theme:e,$textSize:t})=>o(t||null,e.fontSizes.xxxxl,e)};
|
|
27
|
+
}
|
|
28
|
+
`,m=e.h2`
|
|
29
|
+
${e=>n(e)}
|
|
30
|
+
font-size: ${({theme:e,$textSize:t})=>x(t||null,e.fontSizes.xl,e)};
|
|
31
|
+
@media (min-width: ${({theme:e})=>e.breakpoint.tablet}) {
|
|
32
|
+
font-size: ${({theme:e,$textSize:t})=>l(t||null,e.fontSizes.xxl,e)};
|
|
33
|
+
}
|
|
34
|
+
@media (min-width: ${({theme:e})=>e.breakpoint.desktop}) {
|
|
35
|
+
font-size: ${({theme:e,$textSize:t})=>o(t||null,e.fontSizes.xxxl,e)};
|
|
36
|
+
}
|
|
37
|
+
`,r=e.h3`
|
|
38
|
+
${e=>n(e)}
|
|
39
|
+
font-size: ${({theme:e,$textSize:t})=>x(t||null,e.fontSizes.l,e)};
|
|
40
|
+
@media (min-width: ${({theme:e})=>e.breakpoint.tablet}) {
|
|
41
|
+
font-size: ${({theme:e,$textSize:t})=>l(t||null,e.fontSizes.xl,e)};
|
|
42
|
+
}
|
|
43
|
+
@media (min-width: ${({theme:e})=>e.breakpoint.desktop}) {
|
|
44
|
+
font-size: ${({theme:e,$textSize:t})=>o(t||null,e.fontSizes.xxl,e)};
|
|
45
|
+
}
|
|
46
|
+
`,a=e.h4`
|
|
47
|
+
${e=>n(e)}
|
|
48
|
+
font-size: ${({theme:e,$textSize:t})=>x(t||null,e.fontSizes.l,e)};
|
|
49
|
+
@media (min-width: ${({theme:e})=>e.breakpoint.tablet}) {
|
|
50
|
+
font-size: ${({theme:e,$textSize:t})=>l(t||null,e.fontSizes.l,e)};
|
|
51
|
+
}
|
|
52
|
+
@media (min-width: ${({theme:e})=>e.breakpoint.desktop}) {
|
|
53
|
+
font-size: ${({theme:e,$textSize:t})=>o(t||null,e.fontSizes.xl,e)};
|
|
54
|
+
}
|
|
55
|
+
`,h=e.h5`
|
|
56
|
+
${e=>n(e)}
|
|
57
|
+
|
|
58
|
+
font-size: ${({theme:e,$textSize:t})=>x(t||null,e.fontSizes.l,e)};
|
|
59
|
+
@media (min-width: ${({theme:e})=>e.breakpoint.tablet}) {
|
|
60
|
+
font-size: ${({theme:e,$textSize:t})=>l(t||null,e.fontSizes.l,e)};
|
|
61
|
+
}
|
|
62
|
+
@media (min-width: ${({theme:e})=>e.breakpoint.desktop}) {
|
|
63
|
+
font-size: ${({theme:e,$textSize:t})=>o(t||null,e.fontSizes.l,e)};
|
|
64
|
+
}
|
|
65
|
+
`,$=e.h6`
|
|
66
|
+
${e=>n(e)}
|
|
67
|
+
|
|
68
|
+
font-size: ${({theme:e,$textSize:t})=>x(t||null,e.fontSizes.m,e)};
|
|
69
|
+
@media (min-width: ${({theme:e})=>e.breakpoint.tablet}) {
|
|
70
|
+
font-size: ${({theme:e,$textSize:t})=>l(t||null,e.fontSizes.m,e)};
|
|
71
|
+
}
|
|
72
|
+
@media (min-width: ${({theme:e})=>e.breakpoint.desktop}) {
|
|
73
|
+
font-size: ${({theme:e,$textSize:t})=>o(t||null,e.fontSizes.m,e)};
|
|
74
|
+
}
|
|
75
|
+
`;export{s as H1,m as H2,r as H3,a as H4,h as H5,$ as H6};
|
|
2
76
|
//# sourceMappingURL=styles.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"styles.js","sources":["../../../../src/components/Heading/styles.ts"],"sourcesContent":["import styled, { css } from \"styled-components\";\n\nimport { spacing, type SpacingPropsInternal } from \"../Spacing\";\n\nimport {\n type ThemeType,\n type FontSizeType,\n type ColorKeyType,\n type WordBreakType,\n type OverflowWrapType,\n} from \"../../types\";\n\ntype StyledHeadingProps = SpacingPropsInternal & {\n theme: ThemeType;\n $textSize?: FontSizeType;\n $textAlign?: \"left\" | \"right\" | \"center\";\n $textColor?: string;\n $wordBreak?: WordBreakType;\n $overflowWrap?: OverflowWrapType;\n};\n\nconst StyledHeading = (props: StyledHeadingProps) => css`\n font-family: ${props.theme.typography.fontFamilyHeadings};\n font-weight: ${props.theme.typography.fontWeightHeadings};\n word-break: ${props.$wordBreak || \"normal\"};\n overflow-wrap: ${props.$overflowWrap || \"break-word\"};\n color: ${props.$textColor &&\n typeof props.theme.colors[props.$textColor as ColorKeyType] !== \"undefined\"\n ? props.theme.colors[props.$textColor as ColorKeyType]\n : props.$textColor || props.theme.colors.textHeaderDefault};\n line-height: ${props.theme.typography.headerLineHeight};\n text-transform: ${props.theme.typography.headerTextTransform};\n margin-top: ${props.theme.spacing.m};\n margin-bottom: ${props.theme.spacing.s};\n max-width: 100%;\n text-align: ${props.$textAlign || \"left\"};\n\n &:first-child {\n margin-top: 0;\n }\n\n ${() => {\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n const { theme, ...propsWithoutTheme } = props;\n\n return spacing(propsWithoutTheme, props.theme);\n }}\n`;\n\nconst desktopFontSize = (\n $textSize: FontSizeType | null,\n defaultFontSize: string,\n theme: ThemeType,\n) => {\n switch ($textSize) {\n case \"m\":\n return theme.fontSizes.m;\n case \"l\":\n return theme.fontSizes.l;\n case \"xl\":\n return theme.fontSizes.xl;\n case \"xxl\":\n return theme.fontSizes.xxl;\n case \"xxxl\":\n return theme.fontSizes.xxxl;\n case \"xxxxl\":\n return theme.fontSizes.xxxxl;\n\n default:\n return defaultFontSize;\n }\n};\n\n// everything drops down a size on the typography scale\nconst tabletFontSize = (\n $textSize: FontSizeType | null,\n defaultFontSize: string,\n theme: ThemeType,\n) => {\n switch ($textSize) {\n case \"m\":\n return theme.fontSizes.m;\n case \"l\":\n return theme.fontSizes.l;\n case \"xl\":\n return theme.fontSizes.l;\n case \"xxl\":\n return theme.fontSizes.xl;\n case \"xxxl\":\n return theme.fontSizes.xxl;\n case \"xxxxl\":\n return theme.fontSizes.xxxl;\n\n default:\n return defaultFontSize;\n }\n};\n\n// everything drops down two sizes on the typography scale\nconst mobileFontSize = (\n $textSize: FontSizeType | null,\n defaultFontSize: string,\n theme: ThemeType,\n) => {\n switch ($textSize) {\n case \"m\":\n return theme.fontSizes.m;\n case \"l\":\n return theme.fontSizes.l;\n case \"xl\":\n return theme.fontSizes.l;\n case \"xxl\":\n return theme.fontSizes.l;\n case \"xxxl\":\n return theme.fontSizes.xl;\n case \"xxxxl\":\n return theme.fontSizes.xxl;\n\n default:\n return defaultFontSize;\n }\n};\n\nexport const H1 = styled.h1<StyledHeadingProps>`\n ${(props) => StyledHeading(props)}\n font-size: ${({ theme, $textSize }) =>\n mobileFontSize($textSize || null, theme.fontSizes.xxl, theme)};\n @media (min-width: ${({ theme }) => theme.breakpoint.tablet}) {\n font-size: ${({ theme, $textSize }) =>\n tabletFontSize($textSize || null, theme.fontSizes.xxxl, theme)};\n }\n @media (min-width: ${({ theme }) => theme.breakpoint.desktop}) {\n font-size: ${({ theme, $textSize }) =>\n desktopFontSize($textSize || null, theme.fontSizes.xxxxl, theme)};\n }\n`;\n\nexport const H2 = styled.h2<StyledHeadingProps>`\n ${(props) => StyledHeading(props)}\n font-size: ${({ theme, $textSize }) =>\n mobileFontSize($textSize || null, theme.fontSizes.xl, theme)};\n @media (min-width: ${({ theme }) => theme.breakpoint.tablet}) {\n font-size: ${({ theme, $textSize }) =>\n tabletFontSize($textSize || null, theme.fontSizes.xxl, theme)};\n }\n @media (min-width: ${({ theme }) => theme.breakpoint.desktop}) {\n font-size: ${({ theme, $textSize }) =>\n desktopFontSize($textSize || null, theme.fontSizes.xxxl, theme)};\n }\n`;\n\nexport const H3 = styled.h3<StyledHeadingProps>`\n ${(props) => StyledHeading(props)}\n font-size: ${({ theme, $textSize }) =>\n mobileFontSize($textSize || null, theme.fontSizes.l, theme)};\n @media (min-width: ${({ theme }) => theme.breakpoint.tablet}) {\n font-size: ${({ theme, $textSize }) =>\n tabletFontSize($textSize || null, theme.fontSizes.xl, theme)};\n }\n @media (min-width: ${({ theme }) => theme.breakpoint.desktop}) {\n font-size: ${({ theme, $textSize }) =>\n desktopFontSize($textSize || null, theme.fontSizes.xxl, theme)};\n }\n`;\n\nexport const H4 = styled.h4<StyledHeadingProps>`\n ${(props) => StyledHeading(props)}\n font-size: ${({ theme, $textSize }) =>\n mobileFontSize($textSize || null, theme.fontSizes.l, theme)};\n @media (min-width: ${({ theme }) => theme.breakpoint.tablet}) {\n font-size: ${({ theme, $textSize }) =>\n tabletFontSize($textSize || null, theme.fontSizes.l, theme)};\n }\n @media (min-width: ${({ theme }) => theme.breakpoint.desktop}) {\n font-size: ${({ theme, $textSize }) =>\n desktopFontSize($textSize || null, theme.fontSizes.xl, theme)};\n }\n`;\n\nexport const H5 = styled.h5<StyledHeadingProps>`\n ${(props) => StyledHeading(props)}\n\n font-size: ${({ theme, $textSize }) =>\n mobileFontSize($textSize || null, theme.fontSizes.l, theme)};\n @media (min-width: ${({ theme }) => theme.breakpoint.tablet}) {\n font-size: ${({ theme, $textSize }) =>\n tabletFontSize($textSize || null, theme.fontSizes.l, theme)};\n }\n @media (min-width: ${({ theme }) => theme.breakpoint.desktop}) {\n font-size: ${({ theme, $textSize }) =>\n desktopFontSize($textSize || null, theme.fontSizes.l, theme)};\n }\n`;\n\nexport const H6 = styled.h6<StyledHeadingProps>`\n ${(props) => StyledHeading(props)}\n\n font-size: ${({ theme, $textSize }) =>\n mobileFontSize($textSize || null, theme.fontSizes.m, theme)};\n @media (min-width: ${({ theme }) => theme.breakpoint.tablet}) {\n font-size: ${({ theme, $textSize }) =>\n tabletFontSize($textSize || null, theme.fontSizes.m, theme)};\n }\n @media (min-width: ${({ theme }) => theme.breakpoint.desktop}) {\n font-size: ${({ theme, $textSize }) =>\n desktopFontSize($textSize || null, theme.fontSizes.m, theme)};\n }\n`;\n"],"names":["StyledHeading","props","css","templateObject_1","__makeTemplateObject","theme","typography","fontFamilyHeadings","fontWeightHeadings","$wordBreak","$overflowWrap","$textColor","colors","textHeaderDefault","headerLineHeight","headerTextTransform","spacing","m","s","$textAlign","propsWithoutTheme","__rest","desktopFontSize","$textSize","defaultFontSize","fontSizes","l","xl","xxl","xxxl","xxxxl","tabletFontSize","mobileFontSize","H1","styled","h1","templateObject_2","_a","breakpoint","tablet","desktop","H2","h2","templateObject_3","H3","h3","templateObject_4","H4","h4","templateObject_5","H5","h5","templateObject_6","H6","h6","templateObject_7"],"mappings":"qLAqBA,kBAAMA,EAAgB,SAACC,GAA8B,OAAAC,EAAGC,IAAAA,EAAAC,EAAA,CAAA,oBAAA,qBAAA,oBAAA,uBAAA,eAAA,qBAAA,wBAAA,oBAAA,uBAAA,wCAAA,wDAAA,MAAA,CAAA,oBACE,qBACA,oBACd,uBACU,eAIQ,qBACN,wBACM,oBACzB,uBACG,wCAEE,wDAWvC,QAxBcH,EAAMI,MAAMC,WAAWC,mBACvBN,EAAMI,MAAMC,WAAWE,mBACxBP,EAAMQ,YAAc,SACjBR,EAAMS,eAAiB,aAC/BT,EAAMU,iBACiD,IAAzDV,EAAMI,MAAMO,OAAOX,EAAMU,YAC5BV,EAAMI,MAAMO,OAAOX,EAAMU,YACzBV,EAAMU,YAAcV,EAAMI,MAAMO,OAAOC,kBAC5BZ,EAAMI,MAAMC,WAAWQ,iBACpBb,EAAMI,MAAMC,WAAWS,oBAC3Bd,EAAMI,MAAMW,QAAQC,EACjBhB,EAAMI,MAAMW,QAAQE,EAEvBjB,EAAMkB,YAAc,QAMhC,WAEwClB,EAA3BI,MAAK,IAAAe,EAAiBC,EAAKpB,EAAlC,CAA+B,UAErC,OAAOe,EAAQI,EAAmBnB,EAAMI,MAC1C,GACD,EAEKiB,EAAkB,SACtBC,EACAC,EACAnB,GAEA,OAAQkB,GACN,IAAK,IACH,OAAOlB,EAAMoB,UAA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R,EAAGZ,EAAtD"}
|
|
1
|
+
{"version":3,"file":"styles.js","sources":["../../../../src/components/Heading/styles.ts"],"sourcesContent":["import styled, { css } from \"styled-components\";\n\nimport { spacing, type SpacingPropsInternal } from \"../Spacing\";\n\nimport {\n type ThemeType,\n type FontSizeType,\n type ColorKeyType,\n type WordBreakType,\n type OverflowWrapType,\n} from \"../../types\";\n\ntype StyledHeadingProps = SpacingPropsInternal & {\n theme: ThemeType;\n $textSize?: FontSizeType;\n $textAlign?: \"left\" | \"right\" | \"center\";\n $textColor?: string;\n $wordBreak?: WordBreakType;\n $overflowWrap?: OverflowWrapType;\n};\n\nconst StyledHeading = (props: StyledHeadingProps) => css`\n font-family: ${props.theme.typography.fontFamilyHeadings};\n font-weight: ${props.theme.typography.fontWeightHeadings};\n word-break: ${props.$wordBreak || \"normal\"};\n overflow-wrap: ${props.$overflowWrap || \"break-word\"};\n color: ${props.$textColor &&\n typeof props.theme.colors[props.$textColor as ColorKeyType] !== \"undefined\"\n ? props.theme.colors[props.$textColor as ColorKeyType]\n : props.$textColor || props.theme.colors.textHeaderDefault};\n line-height: ${props.theme.typography.headerLineHeight};\n text-transform: ${props.theme.typography.headerTextTransform};\n margin-top: ${props.theme.spacing.m};\n margin-bottom: ${props.theme.spacing.s};\n max-width: 100%;\n text-align: ${props.$textAlign || \"left\"};\n\n &:first-child {\n margin-top: 0;\n }\n\n ${() => {\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n const { theme, ...propsWithoutTheme } = props;\n\n return spacing(propsWithoutTheme, props.theme);\n }}\n`;\n\nconst desktopFontSize = (\n $textSize: FontSizeType | null,\n defaultFontSize: string,\n theme: ThemeType,\n) => {\n switch ($textSize) {\n case \"m\":\n return theme.fontSizes.m;\n case \"l\":\n return theme.fontSizes.l;\n case \"xl\":\n return theme.fontSizes.xl;\n case \"xxl\":\n return theme.fontSizes.xxl;\n case \"xxxl\":\n return theme.fontSizes.xxxl;\n case \"xxxxl\":\n return theme.fontSizes.xxxxl;\n\n default:\n return defaultFontSize;\n }\n};\n\n// everything drops down a size on the typography scale\nconst tabletFontSize = (\n $textSize: FontSizeType | null,\n defaultFontSize: string,\n theme: ThemeType,\n) => {\n switch ($textSize) {\n case \"m\":\n return theme.fontSizes.m;\n case \"l\":\n return theme.fontSizes.l;\n case \"xl\":\n return theme.fontSizes.l;\n case \"xxl\":\n return theme.fontSizes.xl;\n case \"xxxl\":\n return theme.fontSizes.xxl;\n case \"xxxxl\":\n return theme.fontSizes.xxxl;\n\n default:\n return defaultFontSize;\n }\n};\n\n// everything drops down two sizes on the typography scale\nconst mobileFontSize = (\n $textSize: FontSizeType | null,\n defaultFontSize: string,\n theme: ThemeType,\n) => {\n switch ($textSize) {\n case \"m\":\n return theme.fontSizes.m;\n case \"l\":\n return theme.fontSizes.l;\n case \"xl\":\n return theme.fontSizes.l;\n case \"xxl\":\n return theme.fontSizes.l;\n case \"xxxl\":\n return theme.fontSizes.xl;\n case \"xxxxl\":\n return theme.fontSizes.xxl;\n\n default:\n return defaultFontSize;\n }\n};\n\nexport const H1 = styled.h1<StyledHeadingProps>`\n ${(props) => StyledHeading(props)}\n font-size: ${({ theme, $textSize }) =>\n mobileFontSize($textSize || null, theme.fontSizes.xxl, theme)};\n @media (min-width: ${({ theme }) => theme.breakpoint.tablet}) {\n font-size: ${({ theme, $textSize }) =>\n tabletFontSize($textSize || null, theme.fontSizes.xxxl, theme)};\n }\n @media (min-width: ${({ theme }) => theme.breakpoint.desktop}) {\n font-size: ${({ theme, $textSize }) =>\n desktopFontSize($textSize || null, theme.fontSizes.xxxxl, theme)};\n }\n`;\n\nexport const H2 = styled.h2<StyledHeadingProps>`\n ${(props) => StyledHeading(props)}\n font-size: ${({ theme, $textSize }) =>\n mobileFontSize($textSize || null, theme.fontSizes.xl, theme)};\n @media (min-width: ${({ theme }) => theme.breakpoint.tablet}) {\n font-size: ${({ theme, $textSize }) =>\n tabletFontSize($textSize || null, theme.fontSizes.xxl, theme)};\n }\n @media (min-width: ${({ theme }) => theme.breakpoint.desktop}) {\n font-size: ${({ theme, $textSize }) =>\n desktopFontSize($textSize || null, theme.fontSizes.xxxl, theme)};\n }\n`;\n\nexport const H3 = styled.h3<StyledHeadingProps>`\n ${(props) => StyledHeading(props)}\n font-size: ${({ theme, $textSize }) =>\n mobileFontSize($textSize || null, theme.fontSizes.l, theme)};\n @media (min-width: ${({ theme }) => theme.breakpoint.tablet}) {\n font-size: ${({ theme, $textSize }) =>\n tabletFontSize($textSize || null, theme.fontSizes.xl, theme)};\n }\n @media (min-width: ${({ theme }) => theme.breakpoint.desktop}) {\n font-size: ${({ theme, $textSize }) =>\n desktopFontSize($textSize || null, theme.fontSizes.xxl, theme)};\n }\n`;\n\nexport const H4 = styled.h4<StyledHeadingProps>`\n ${(props) => StyledHeading(props)}\n font-size: ${({ theme, $textSize }) =>\n mobileFontSize($textSize || null, theme.fontSizes.l, theme)};\n @media (min-width: ${({ theme }) => theme.breakpoint.tablet}) {\n font-size: ${({ theme, $textSize }) =>\n tabletFontSize($textSize || null, theme.fontSizes.l, theme)};\n }\n @media (min-width: ${({ theme }) => theme.breakpoint.desktop}) {\n font-size: ${({ theme, $textSize }) =>\n desktopFontSize($textSize || null, theme.fontSizes.xl, theme)};\n }\n`;\n\nexport const H5 = styled.h5<StyledHeadingProps>`\n ${(props) => StyledHeading(props)}\n\n font-size: ${({ theme, $textSize }) =>\n mobileFontSize($textSize || null, theme.fontSizes.l, theme)};\n @media (min-width: ${({ theme }) => theme.breakpoint.tablet}) {\n font-size: ${({ theme, $textSize }) =>\n tabletFontSize($textSize || null, theme.fontSizes.l, theme)};\n }\n @media (min-width: ${({ theme }) => theme.breakpoint.desktop}) {\n font-size: ${({ theme, $textSize }) =>\n desktopFontSize($textSize || null, theme.fontSizes.l, theme)};\n }\n`;\n\nexport const H6 = styled.h6<StyledHeadingProps>`\n ${(props) => StyledHeading(props)}\n\n font-size: ${({ theme, $textSize }) =>\n mobileFontSize($textSize || null, theme.fontSizes.m, theme)};\n @media (min-width: ${({ theme }) => theme.breakpoint.tablet}) {\n font-size: ${({ theme, $textSize }) =>\n tabletFontSize($textSize || null, theme.fontSizes.m, theme)};\n }\n @media (min-width: ${({ theme }) => theme.breakpoint.desktop}) {\n font-size: ${({ theme, $textSize }) =>\n desktopFontSize($textSize || null, theme.fontSizes.m, theme)};\n }\n`;\n"],"names":["StyledHeading","props","css","theme","typography","fontFamilyHeadings","fontWeightHeadings","$wordBreak","$overflowWrap","$textColor","colors","textHeaderDefault","headerLineHeight","headerTextTransform","spacing","m","s","$textAlign","propsWithoutTheme","desktopFontSize","$textSize","defaultFontSize","fontSizes","l","xl","xxl","xxxl","xxxxl","tabletFontSize","mobileFontSize","H1","styled","h1","breakpoint","tablet","desktop","H2","h2","H3","h3","H4","h4","H5","h5","H6","h6"],"mappings":"yFAqBA,MAAMA,EAAiBC,GAA8BC,CAAG;iBACvCD,EAAME,MAAMC,WAAWC;iBACvBJ,EAAME,MAAMC,WAAWE;gBACxBL,EAAMM,YAAc;mBACjBN,EAAMO,eAAiB;WAC/BP,EAAMQ,iBACiD,IAAzDR,EAAME,MAAMO,OAAOT,EAAMQ,YAC5BR,EAAME,MAAMO,OAAOT,EAAMQ,YACzBR,EAAMQ,YAAcR,EAAME,MAAMO,OAAOC;iBAC5BV,EAAME,MAAMC,WAAWQ;oBACpBX,EAAME,MAAMC,WAAWS;gBAC3BZ,EAAME,MAAMW,QAAQC;mBACjBd,EAAME,MAAMW,QAAQE;;gBAEvBf,EAAMgB,YAAc;;;;;;IAMhC,KAEA,MAAMd,MAAEA,KAAUe,GAAsBjB,EAExC,OAAOa,EAAQI,EAAmBjB,EAAME,MAAM;EAI5CgB,EAAkB,CACtBC,EACAC,EACAlB,KAEA,OAAQiB,GACN,IAAK,IACH,OAAOjB,EAAMmB,UAAUP,EACzB,IAAK,IACH,OAAOZ,EAAMmB,UAAUC,EACzB,IAAK,KACH,OAAOpB,EAAMmB,UAAUE,GACzB,IAAK,MACH,OAAOrB,EAAM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B;;EAI/CyC,EAAKb,EAAOc,EAAsB;IAC1C5C,GAAUD,EAAcC;;eAEd,EAAGE,QAAOiB,eACrBS,EAAeT,GAAa,KAAMjB,EAAMmB,UAAUP,EAAGZ;uBAClC,EAAGA,WAAYA,EAAM8B,WAAWC;iBACtC,EAAG/B,QAAOiB,eACrBQ,EAAeR,GAAa,KAAMjB,EAAMmB,UAAUP,EAAGZ;;uBAEpC,EAAGA,WAAYA,EAAM8B,WAAWE;iBACtC,EAAGhC,QAAOiB,eACrBD,EAAgBC,GAAa,KAAMjB,EAAMmB,UAAUP,EAAGZ;;"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import
|
|
1
|
+
import e from"react";import{useTheme as t}from"styled-components";import{crukTheme as o}from"../../themes/cruk.js";import{StyledIcon as r}from"./styles.js";import{themeColorOrString as m,themeSizeOrString as s}from"../../utils/themeUtils.js";function i({faIcon:i,color:n,size:c="1.1rem"}){const l=t(),p={...o,...l},[a,f,,,u]=i.icon;return e.createElement(r,{theme:p,role:"presentation",viewBox:`0 0 ${a} ${f}`,$size:s(c,p),$color:m(n,p)},u&&e.createElement("path",{d:u}))}export{i as IconFa,i as default};
|
|
2
2
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sources":["../../../../src/components/IconFa/index.tsx"],"sourcesContent":["import React from \"react\";\nimport { useTheme } from \"styled-components\";\nimport { type IconDefinition } from \"@fortawesome/fontawesome-common-types\";\nimport { crukTheme as defaultTheme } from \"../../themes/cruk\";\n\nimport { StyledIcon } from \"./styles\";\nimport { themeColorOrString, themeSizeOrString } from \"../../utils/themeUtils\";\n\nexport type IconFaProps = {\n /** imported icon definition from \"@fortawesome/free-solid-svg-icons\" or \"@fortawesome/free-brands-svg-icons\" */\n faIcon: IconDefinition;\n /** color of icon, inherits current text colour by default */\n color?: string;\n /** size of ion 1.1em by default */\n size?: string;\n};\n\n/**\n * The IconFa component (Icon Font Awesome) displays an icon glyph as an `<svg>` element.\n *\n * This is an svg icon wrapper where a font awesome icon definition can be passed in a long with colour and size\n * */\nexport function IconFa({ faIcon, color, size = \"1.1rem\" }: IconFaProps) {\n const foundTheme = useTheme();\n const theme = {\n ...defaultTheme,\n ...foundTheme,\n };\n const [width, height, , , svgPathData] = faIcon.icon;\n\n return (\n <StyledIcon\n theme={theme}\n role=\"presentation\"\n viewBox={`0 0 ${width} ${height}`}\n $size={themeSizeOrString(size, theme)}\n $color={themeColorOrString(color, theme)}\n >\n {svgPathData && <path d={svgPathData as string} />}\n </StyledIcon>\n );\n}\n\nexport default IconFa;\n"],"names":["IconFa","
|
|
1
|
+
{"version":3,"file":"index.js","sources":["../../../../src/components/IconFa/index.tsx"],"sourcesContent":["import React from \"react\";\nimport { useTheme } from \"styled-components\";\nimport { type IconDefinition } from \"@fortawesome/fontawesome-common-types\";\nimport { crukTheme as defaultTheme } from \"../../themes/cruk\";\n\nimport { StyledIcon } from \"./styles\";\nimport { themeColorOrString, themeSizeOrString } from \"../../utils/themeUtils\";\n\nexport type IconFaProps = {\n /** imported icon definition from \"@fortawesome/free-solid-svg-icons\" or \"@fortawesome/free-brands-svg-icons\" */\n faIcon: IconDefinition;\n /** color of icon, inherits current text colour by default */\n color?: string;\n /** size of ion 1.1em by default */\n size?: string;\n};\n\n/**\n * The IconFa component (Icon Font Awesome) displays an icon glyph as an `<svg>` element.\n *\n * This is an svg icon wrapper where a font awesome icon definition can be passed in a long with colour and size\n * */\nexport function IconFa({ faIcon, color, size = \"1.1rem\" }: IconFaProps) {\n const foundTheme = useTheme();\n const theme = {\n ...defaultTheme,\n ...foundTheme,\n };\n const [width, height, , , svgPathData] = faIcon.icon;\n\n return (\n <StyledIcon\n theme={theme}\n role=\"presentation\"\n viewBox={`0 0 ${width} ${height}`}\n $size={themeSizeOrString(size, theme)}\n $color={themeColorOrString(color, theme)}\n >\n {svgPathData && <path d={svgPathData as string} />}\n </StyledIcon>\n );\n}\n\nexport default IconFa;\n"],"names":["IconFa","faIcon","color","size","foundTheme","useTheme","theme","defaultTheme","width","height","svgPathData","icon","React","createElement","StyledIcon","role","viewBox","$size","themeSizeOrString","$color","themeColorOrString","d"],"mappings":"kPAsBM,SAAUA,GAAOC,OAAEA,EAAMC,MAAEA,EAAKC,KAAEA,EAAO,WAC7C,MAAMC,EAAaC,IACbC,EAAQ,IACTC,KACAH,IAEEI,EAAOC,EAAY,CAAA,CAAAC,GAAeT,EAAOU,KAEhD,OACEC,EAACC,cAAAC,GACCR,MAAOA,EACPS,KAAK,eACLC,QAAS,OAAOR,KAASC,IAClBQ,MAAAC,EAAkBf,EAAMG,GAAMa,OAC7BC,EAAmBlB,EAAOI,IAEjCI,GAAeE,wBAAMS,EAAGX,IAG/B"}
|
|
@@ -1,2 +1,11 @@
|
|
|
1
|
-
import
|
|
1
|
+
import i from"styled-components";const e=i.svg`
|
|
2
|
+
display: inline-block;
|
|
3
|
+
height: ${({$size:i})=>i};
|
|
4
|
+
margin-top: -0.2em;
|
|
5
|
+
vertical-align: middle;
|
|
6
|
+
width: ${({$size:i})=>i};
|
|
7
|
+
path {
|
|
8
|
+
fill: ${({$color:i})=>i};
|
|
9
|
+
}
|
|
10
|
+
`;export{e as StyledIcon,e as default};
|
|
2
11
|
//# sourceMappingURL=styles.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"styles.js","sources":["../../../../src/components/IconFa/styles.ts"],"sourcesContent":["import styled from \"styled-components\";\nimport { type ThemeType } from \"../../types\";\n\nexport const StyledIcon = styled.svg<{\n theme: ThemeType;\n $color?: string;\n $size: string;\n}>`\n display: inline-block;\n height: ${({ $size }) => $size};\n margin-top: -0.2em;\n vertical-align: middle;\n width: ${({ $size }) => $size};\n path {\n fill: ${({ $color }) => $color};\n }\n`;\n\nexport default StyledIcon;\n"],"names":["StyledIcon","styled","svg","
|
|
1
|
+
{"version":3,"file":"styles.js","sources":["../../../../src/components/IconFa/styles.ts"],"sourcesContent":["import styled from \"styled-components\";\nimport { type ThemeType } from \"../../types\";\n\nexport const StyledIcon = styled.svg<{\n theme: ThemeType;\n $color?: string;\n $size: string;\n}>`\n display: inline-block;\n height: ${({ $size }) => $size};\n margin-top: -0.2em;\n vertical-align: middle;\n width: ${({ $size }) => $size};\n path {\n fill: ${({ $color }) => $color};\n }\n`;\n\nexport default StyledIcon;\n"],"names":["StyledIcon","styled","svg","$size","$color"],"mappings":"iCAGa,MAAAA,EAAaC,EAAOC,GAI/B;;YAEU,EAAGC,WAAYA;;;WAGhB,EAAGA,WAAYA;;YAEd,EAAGC,YAAaA;;"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import
|
|
1
|
+
import e,{forwardRef as o}from"react";import{useTheme as t}from"styled-components";import{crukTheme as r}from"../../themes/cruk.js";import{Box as n}from"../Box/index.js";import{Text as m}from"../Text/index.js";import{Heading as i}from"../Heading/index.js";import{StyledInfoBox as l}from"./styles.js";const a=o((({children:o,titleText:a,titleTextColor:s,descriptionText:c,descriptionTextColor:x,icon:d,...p},g)=>{const f=t(),C={...r,...f},k=p.backgroundColor||C.tokenColors.grey_200;return e.createElement(l,{theme:C,...p,backgroundColor:k,margin:p.margin||"none",ref:g},d&&e.createElement(n,{marginRight:"s"},d),e.createElement("div",null,a&&e.createElement(i,{as:"p",margin:"none",h4:!0,marginBottom:"xxs",textColor:s||C.colors.textDark},a),c&&e.createElement(m,{textColor:x||C.colors.textDark,marginBottom:"none"},c),o))}));a.displayName="InfoBox";export{a as InfoBox,a as default};
|
|
2
2
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sources":["../../../../src/components/InfoBox/index.tsx"],"sourcesContent":["import React, {\n type HTMLAttributes,\n type Ref,\n forwardRef,\n type ReactNode,\n type ElementType,\n} from \"react\";\nimport { useTheme } from \"styled-components\";\n\nimport { crukTheme as defaultTheme } from \"../../themes/cruk\";\nimport { Box } from \"../Box\";\nimport { Text } from \"../Text\";\nimport { Heading } from \"../Heading\";\n\nimport { type SpacingProps } from \"../Spacing\";\nimport { StyledInfoBox } from \"./styles\";\n\nexport type InfoBoxProps = SpacingProps &\n HTMLAttributes<HTMLElement> & {\n /** background color of wrapping element, this will add default padding */\n backgroundColor?: string;\n /** Title text */\n titleText: string;\n /** Title text colour */\n titleTextColor?: string;\n /** Description text */\n descriptionText: string;\n /** Description text colour */\n descriptionTextColor?: string;\n /** Space for extra element underneath description */\n children?: ReactNode;\n /** Icon in left column usually 2em squared */\n icon?: ReactNode;\n ref?: Ref<HTMLElement>;\n /** styled-component polymorphic feature so you take the styling of a box and cast the component to be a \"span\" for example */\n as?: ElementType;\n };\n\n/**\n * Box is used to wrap other components to add margin and padding. The values will be in the t-shirt sizes specified in the theme sizes.\n \n The more specific the the target the higher priority the css will have. For example `margin` will be overridden by the `marginVertical` or `marginHorizontal` props. `marginTop`, `marginBottom`, `marginLeft`, `marginRight` will override the the `marginVertical` and `marginHorizontal` props.\n */\nexport const InfoBox = forwardRef(\n (\n {\n children,\n titleText,\n titleTextColor,\n descriptionText,\n descriptionTextColor,\n icon,\n ...spacingAndHTMLElementProps\n }: InfoBoxProps,\n ref?: Ref<HTMLElement>,\n ) => {\n const foundTheme = useTheme();\n const theme = {\n ...defaultTheme,\n ...foundTheme,\n };\n\n const backgroundColorOrDefault =\n spacingAndHTMLElementProps.backgroundColor || theme.tokenColors.grey_200;\n\n return (\n <StyledInfoBox\n theme={theme}\n {...spacingAndHTMLElementProps}\n backgroundColor={backgroundColorOrDefault}\n margin={spacingAndHTMLElementProps.margin || \"none\"}\n ref={ref}\n >\n {icon && <Box marginRight=\"s\">{icon}</Box>}\n <div>\n {titleText && (\n <Heading\n as=\"p\"\n margin=\"none\"\n h4\n marginBottom=\"xxs\"\n textColor={titleTextColor || theme.colors.textDark}\n >\n {titleText}\n </Heading>\n )}\n {descriptionText && (\n <Text\n textColor={descriptionTextColor || theme.colors.textDark}\n marginBottom=\"none\"\n >\n {descriptionText}\n </Text>\n )}\n {children}\n </div>\n </StyledInfoBox>\n );\n },\n);\n\nexport default InfoBox;\n"],"names":["InfoBox","forwardRef","
|
|
1
|
+
{"version":3,"file":"index.js","sources":["../../../../src/components/InfoBox/index.tsx"],"sourcesContent":["import React, {\n type HTMLAttributes,\n type Ref,\n forwardRef,\n type ReactNode,\n type ElementType,\n} from \"react\";\nimport { useTheme } from \"styled-components\";\n\nimport { crukTheme as defaultTheme } from \"../../themes/cruk\";\nimport { Box } from \"../Box\";\nimport { Text } from \"../Text\";\nimport { Heading } from \"../Heading\";\n\nimport { type SpacingProps } from \"../Spacing\";\nimport { StyledInfoBox } from \"./styles\";\n\nexport type InfoBoxProps = SpacingProps &\n HTMLAttributes<HTMLElement> & {\n /** background color of wrapping element, this will add default padding */\n backgroundColor?: string;\n /** Title text */\n titleText: string;\n /** Title text colour */\n titleTextColor?: string;\n /** Description text */\n descriptionText: string;\n /** Description text colour */\n descriptionTextColor?: string;\n /** Space for extra element underneath description */\n children?: ReactNode;\n /** Icon in left column usually 2em squared */\n icon?: ReactNode;\n ref?: Ref<HTMLElement>;\n /** styled-component polymorphic feature so you take the styling of a box and cast the component to be a \"span\" for example */\n as?: ElementType;\n };\n\n/**\n * Box is used to wrap other components to add margin and padding. The values will be in the t-shirt sizes specified in the theme sizes.\n \n The more specific the the target the higher priority the css will have. For example `margin` will be overridden by the `marginVertical` or `marginHorizontal` props. `marginTop`, `marginBottom`, `marginLeft`, `marginRight` will override the the `marginVertical` and `marginHorizontal` props.\n */\nexport const InfoBox = forwardRef(\n (\n {\n children,\n titleText,\n titleTextColor,\n descriptionText,\n descriptionTextColor,\n icon,\n ...spacingAndHTMLElementProps\n }: InfoBoxProps,\n ref?: Ref<HTMLElement>,\n ) => {\n const foundTheme = useTheme();\n const theme = {\n ...defaultTheme,\n ...foundTheme,\n };\n\n const backgroundColorOrDefault =\n spacingAndHTMLElementProps.backgroundColor || theme.tokenColors.grey_200;\n\n return (\n <StyledInfoBox\n theme={theme}\n {...spacingAndHTMLElementProps}\n backgroundColor={backgroundColorOrDefault}\n margin={spacingAndHTMLElementProps.margin || \"none\"}\n ref={ref}\n >\n {icon && <Box marginRight=\"s\">{icon}</Box>}\n <div>\n {titleText && (\n <Heading\n as=\"p\"\n margin=\"none\"\n h4\n marginBottom=\"xxs\"\n textColor={titleTextColor || theme.colors.textDark}\n >\n {titleText}\n </Heading>\n )}\n {descriptionText && (\n <Text\n textColor={descriptionTextColor || theme.colors.textDark}\n marginBottom=\"none\"\n >\n {descriptionText}\n </Text>\n )}\n {children}\n </div>\n </StyledInfoBox>\n );\n },\n);\n\nInfoBox.displayName = \"InfoBox\";\n\nexport default InfoBox;\n"],"names":["InfoBox","forwardRef","children","titleText","titleTextColor","descriptionText","descriptionTextColor","icon","spacingAndHTMLElementProps","ref","foundTheme","useTheme","theme","defaultTheme","backgroundColorOrDefault","backgroundColor","tokenColors","grey_200","React","createElement","StyledInfoBox","margin","Box","marginRight","Heading","as","h4","marginBottom","textColor","colors","textDark","Text","displayName"],"mappings":"4SA2Ca,MAAAA,EAAUC,GACrB,EAEIC,WACAC,YACAC,iBACAC,kBACAC,uBACAC,UACGC,GAELC,KAEA,MAAMC,EAAaC,IACbC,EAAQ,IACTC,KACAH,GAGCI,EACJN,EAA2BO,iBAAmBH,EAAMI,YAAYC,SAElE,OACEC,EAACC,cAAAC,EACC,CAAAR,MAAOA,KACHJ,EACJO,gBAAiBD,EACjBO,OAAQb,EAA2Ba,QAAU,OAC7CZ,IAAKA,GAEJF,GAAQW,gBAACI,EAAG,CAACC,YAAY,KAAKhB,GAC/BW,EAAAC,cAAA,MAAA,KACGhB,GACCe,EAACC,cAAAK,EACC,CAAAC,GAAG,IACHJ,OAAO,OACPK,IAAE,EACFC,aAAa,MACbC,UAAWxB,GAAkBQ,EAAMiB,OAAOC,UAEzC3B,GAGJE,GACCa,EAACC,cAAAY,GACCH,UAAWtB,GAAwBM,EAAMiB,OAAOC,SAChDH,aAAa,QAEZtB,GAGJH,GAEW,IAKtBF,EAAQgC,YAAc"}
|
|
@@ -1,2 +1,13 @@
|
|
|
1
|
-
import
|
|
1
|
+
import s,{css as o}from"styled-components";import{Box as t}from"../Box/index.js";const e=s(t)`
|
|
2
|
+
display: flex;
|
|
3
|
+
flex-shrink: 0;
|
|
4
|
+
|
|
5
|
+
svg {
|
|
6
|
+
margin-top: 0;
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
${s=>s.css&&o`
|
|
10
|
+
${s.css}
|
|
11
|
+
`}
|
|
12
|
+
`;export{e as StyledInfoBox,e as default};
|
|
2
13
|
//# sourceMappingURL=styles.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"styles.js","sources":["../../../../src/components/InfoBox/styles.ts"],"sourcesContent":["import styled, { css } from \"styled-components\";\n\nimport { type ThemeType } from \"../../types\";\nimport Box, { type BoxProps } from \"../Box\";\n\ntype InfoBoxProps = BoxProps & {\n css?: string;\n theme: ThemeType;\n};\n\nexport const StyledInfoBox = styled(Box)<InfoBoxProps>`\n display: flex;\n flex-shrink: 0;\n\n svg {\n margin-top: 0;\n }\n\n ${(props) =>\n props.css &&\n css`\n ${props.css}\n `}\n`;\n\nexport default StyledInfoBox;\n"],"names":["StyledInfoBox","styled","Box","
|
|
1
|
+
{"version":3,"file":"styles.js","sources":["../../../../src/components/InfoBox/styles.ts"],"sourcesContent":["import styled, { css } from \"styled-components\";\n\nimport { type ThemeType } from \"../../types\";\nimport Box, { type BoxProps } from \"../Box\";\n\ntype InfoBoxProps = BoxProps & {\n css?: string;\n theme: ThemeType;\n};\n\nexport const StyledInfoBox = styled(Box)<InfoBoxProps>`\n display: flex;\n flex-shrink: 0;\n\n svg {\n margin-top: 0;\n }\n\n ${(props) =>\n props.css &&\n css`\n ${props.css}\n `}\n`;\n\nexport default StyledInfoBox;\n"],"names":["StyledInfoBox","styled","Box","props","css"],"mappings":"uFAUaA,EAAgBC,EAAOC,EAAkB;;;;;;;;IAQjDC,GACDA,EAAMC,KACNA,CAAG;QACCD,EAAMC;;"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import
|
|
1
|
+
import e from"react";import{useTheme as t,ThemeProvider as r}from"styled-components";import{Text as n}from"../Text/index.js";import{crukTheme as m}from"../../themes/cruk.js";import{Label as l,LabelText as o,RequiredText as i}from"./styles.js";function a({label:a,hintText:c,required:s=!1,hideRequiredInLabel:u=!1,children:f,...p}){const d=t(),h={...m,...d},E=c&&("string"==typeof c&&c.length||"number"==typeof c)?e.createElement(n,null,c):c;return e.createElement(r,{theme:h},a?e.createElement(l,{...p},e.createElement(o,{$hasHintText:!!c},a,s&&!u&&e.createElement(i,null," (required)")),E,f):e.createElement(e.Fragment,null,f))}export{a as LabelWrapper,a as default};
|
|
2
2
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sources":["../../../../src/components/LabelWrapper/index.tsx"],"sourcesContent":["import React, { type LabelHTMLAttributes, type ReactNode } from \"react\";\nimport { useTheme, ThemeProvider } from \"styled-components\";\n\nimport { Text } from \"../Text\";\nimport { crukTheme as defaultTheme } from \"../../themes/cruk\";\n\nimport { LabelText, Label, RequiredText } from \"./styles\";\n\ntype LabelWrapperProps = LabelHTMLAttributes<HTMLLabelElement> & {\n /** label text */\n label: string;\n /** hint text or react element in it's place */\n hintText?: ReactNode;\n /** when required (required) appears in label */\n required?: boolean;\n /** flag to stop (required) appearing in label, useful for compound form components like DateInput */\n hideRequiredInLabel?: boolean;\n children?: ReactNode;\n};\n\nexport function LabelWrapper({\n label,\n hintText,\n required = false,\n hideRequiredInLabel = false,\n children,\n ...otherHTMLLabelProps\n}: LabelWrapperProps) {\n const foundTheme = useTheme();\n const theme = {\n ...defaultTheme,\n ...foundTheme,\n };\n\n const hintTextElement =\n !!hintText &&\n ((typeof hintText === \"string\" && hintText.length) ||\n typeof hintText === \"number\") ? (\n <Text>{hintText}</Text>\n ) : (\n hintText\n );\n\n return (\n <ThemeProvider theme={theme}>\n {label ? (\n <Label {...otherHTMLLabelProps}>\n <LabelText $hasHintText={!!hintText}>\n {label}\n {required && !hideRequiredInLabel && (\n <RequiredText>{` (required)`}</RequiredText>\n )}\n </LabelText>\n {hintTextElement}\n {children}\n </Label>\n ) : (\n <>{children}</>\n )}\n </ThemeProvider>\n );\n}\n\nexport default LabelWrapper;\n"],"names":["LabelWrapper","
|
|
1
|
+
{"version":3,"file":"index.js","sources":["../../../../src/components/LabelWrapper/index.tsx"],"sourcesContent":["import React, { type LabelHTMLAttributes, type ReactNode } from \"react\";\nimport { useTheme, ThemeProvider } from \"styled-components\";\n\nimport { Text } from \"../Text\";\nimport { crukTheme as defaultTheme } from \"../../themes/cruk\";\n\nimport { LabelText, Label, RequiredText } from \"./styles\";\n\ntype LabelWrapperProps = LabelHTMLAttributes<HTMLLabelElement> & {\n /** label text */\n label: string;\n /** hint text or react element in it's place */\n hintText?: ReactNode;\n /** when required (required) appears in label */\n required?: boolean;\n /** flag to stop (required) appearing in label, useful for compound form components like DateInput */\n hideRequiredInLabel?: boolean;\n children?: ReactNode;\n};\n\nexport function LabelWrapper({\n label,\n hintText,\n required = false,\n hideRequiredInLabel = false,\n children,\n ...otherHTMLLabelProps\n}: LabelWrapperProps) {\n const foundTheme = useTheme();\n const theme = {\n ...defaultTheme,\n ...foundTheme,\n };\n\n const hintTextElement =\n !!hintText &&\n ((typeof hintText === \"string\" && hintText.length) ||\n typeof hintText === \"number\") ? (\n <Text>{hintText}</Text>\n ) : (\n hintText\n );\n\n return (\n <ThemeProvider theme={theme}>\n {label ? (\n <Label {...otherHTMLLabelProps}>\n <LabelText $hasHintText={!!hintText}>\n {label}\n {required && !hideRequiredInLabel && (\n <RequiredText>{` (required)`}</RequiredText>\n )}\n </LabelText>\n {hintTextElement}\n {children}\n </Label>\n ) : (\n <>{children}</>\n )}\n </ThemeProvider>\n );\n}\n\nexport default LabelWrapper;\n"],"names":["LabelWrapper","label","hintText","required","hideRequiredInLabel","children","otherHTMLLabelProps","foundTheme","useTheme","theme","defaultTheme","hintTextElement","length","React","createElement","Text","ThemeProvider","Label","LabelText","$hasHintText","RequiredText","Fragment"],"mappings":"mPAoBM,SAAUA,GAAaC,MAC3BA,EAAKC,SACLA,EAAQC,SACRA,GAAW,EAAKC,oBAChBA,GAAsB,EAAKC,SAC3BA,KACGC,IAEH,MAAMC,EAAaC,IACbC,EAAQ,IACTC,KACAH,GAGCI,EACFT,IACoB,iBAAbA,GAAyBA,EAASU,QACrB,iBAAbV,GACPW,EAACC,cAAAC,OAAMb,GAAgB,EAK3B,OACEW,EAACC,cAAAE,EAAc,CAAAP,MAAOA,GACnBR,EACCY,EAACC,cAAAG,MAAUX,GACTO,EAAAC,cAACI,EAAS,CAAAC,eAAiBjB,GACxBD,EACAE,IAAaC,GACZS,EAACC,cAAAM,EAAc,KAAA,gBAGlBT,EACAN,GAGHQ,EAAGC,cAAAD,EAAAQ,SAAA,KAAAhB,GAIX"}
|
|
@@ -1,2 +1,16 @@
|
|
|
1
|
-
import
|
|
1
|
+
import t from"styled-components";const e=t.label`
|
|
2
|
+
position: relative;
|
|
3
|
+
display: block;
|
|
4
|
+
width: 100%;
|
|
5
|
+
font-family: ${({theme:t})=>t.typography.fontFamilyLabel};
|
|
6
|
+
font-weight: ${({theme:t})=>t.typography.fontWeightLabels};
|
|
7
|
+
`,o=t.span`
|
|
8
|
+
font-family: ${({theme:t})=>t.typography.fontFamilyLabel};
|
|
9
|
+
font-weight: ${({theme:t})=>t.typography.fontWeightBase};
|
|
10
|
+
`,a=t.span`
|
|
11
|
+
font-family: ${({theme:t})=>t.typography.fontFamilyLabel};
|
|
12
|
+
font-weight: ${({theme:t})=>t.typography.fontWeightLabels};
|
|
13
|
+
display: block;
|
|
14
|
+
margin-bottom: ${({$hasHintText:t,theme:e})=>t?e.spacing.xxs:e.spacing.xs};
|
|
15
|
+
`;export{e as Label,a as LabelText,o as RequiredText};
|
|
2
16
|
//# sourceMappingURL=styles.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"styles.js","sources":["../../../../src/components/LabelWrapper/styles.ts"],"sourcesContent":["import styled from \"styled-components\";\nimport { type ThemeType } from \"../../types\";\n\ntype LabelTextProp = {\n $hasHintText: boolean;\n theme: ThemeType;\n};\n\nexport const Label = styled.label<{ theme: ThemeType }>`\n position: relative;\n display: block;\n width: 100%;\n font-family: ${({ theme }) => theme.typography.fontFamilyLabel};\n font-weight: ${({ theme }) => theme.typography.fontWeightLabels};\n`;\n\nexport const RequiredText = styled.span<{ theme: ThemeType }>`\n font-family: ${({ theme }) => theme.typography.fontFamilyLabel};\n font-weight: ${({ theme }) => theme.typography.fontWeightBase};\n`;\n\nexport const LabelText = styled.span<LabelTextProp>`\n font-family: ${({ theme }) => theme.typography.fontFamilyLabel};\n font-weight: ${({ theme }) => theme.typography.fontWeightLabels};\n display: block;\n margin-bottom: ${({ $hasHintText, theme }) =>\n $hasHintText ? theme.spacing.xxs : theme.spacing.xs};\n`;\n"],"names":["Label","styled","label","
|
|
1
|
+
{"version":3,"file":"styles.js","sources":["../../../../src/components/LabelWrapper/styles.ts"],"sourcesContent":["import styled from \"styled-components\";\nimport { type ThemeType } from \"../../types\";\n\ntype LabelTextProp = {\n $hasHintText: boolean;\n theme: ThemeType;\n};\n\nexport const Label = styled.label<{ theme: ThemeType }>`\n position: relative;\n display: block;\n width: 100%;\n font-family: ${({ theme }) => theme.typography.fontFamilyLabel};\n font-weight: ${({ theme }) => theme.typography.fontWeightLabels};\n`;\n\nexport const RequiredText = styled.span<{ theme: ThemeType }>`\n font-family: ${({ theme }) => theme.typography.fontFamilyLabel};\n font-weight: ${({ theme }) => theme.typography.fontWeightBase};\n`;\n\nexport const LabelText = styled.span<LabelTextProp>`\n font-family: ${({ theme }) => theme.typography.fontFamilyLabel};\n font-weight: ${({ theme }) => theme.typography.fontWeightLabels};\n display: block;\n margin-bottom: ${({ $hasHintText, theme }) =>\n $hasHintText ? theme.spacing.xxs : theme.spacing.xs};\n`;\n"],"names":["Label","styled","label","theme","typography","fontFamilyLabel","fontWeightLabels","RequiredText","span","fontWeightBase","LabelText","$hasHintText","spacing","xxs","xs"],"mappings":"iCAQa,MAAAA,EAAQC,EAAOC,KAA2B;;;;iBAItC,EAAGC,WAAYA,EAAMC,WAAWC;iBAChC,EAAGF,WAAYA,EAAMC,WAAWE;EAGpCC,EAAeN,EAAOO,IAA0B;iBAC5C,EAAGL,WAAYA,EAAMC,WAAWC;iBAChC,EAAGF,WAAYA,EAAMC,WAAWK;EAGpCC,EAAYT,EAAOO,IAAmB;iBAClC,EAAGL,WAAYA,EAAMC,WAAWC;iBAChC,EAAGF,WAAYA,EAAMC,WAAWE;;mBAE9B,EAAGK,eAAcR,WAChCQ,EAAeR,EAAMS,QAAQC,IAAMV,EAAMS,QAAQE;"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import
|
|
1
|
+
import e from"react";import{useTheme as r,ThemeProvider as t}from"styled-components";import{crukTheme as n}from"../../themes/cruk.js";import{ErrorText as m}from"../ErrorText/index.js";import{Text as o}from"../Text/index.js";import{StyledFieldset as s,LegendSpan as a}from"./styles.js";function i({children:i,legendText:l,required:c,errorMessage:p,hasError:x,hintText:f,...E}){const d=r(),h={...n,...d},u=!f||"string"!=typeof f&&"number"!=typeof f?f:e.createElement(o,{as:"span"},f);return e.createElement(t,{theme:h},e.createElement(s,{$hasError:x||!!p||!1,$hasHintText:!!f},l&&e.createElement("legend",{...E},e.createElement(a,{$hasHintText:!!f},l," ",c&&e.createElement("span",null,"(required)")),u),i,!!p&&e.createElement(m,{marginTop:"xxs"},p)))}export{i as LegendWrapper,i as default};
|
|
2
2
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sources":["../../../../src/components/LegendWrapper/index.tsx"],"sourcesContent":["import React, { type HTMLAttributes, type ReactNode } from \"react\";\nimport { useTheme, ThemeProvider } from \"styled-components\";\n\nimport { crukTheme as defaultTheme } from \"../../themes/cruk\";\nimport { ErrorText } from \"../ErrorText\";\nimport { Text } from \"../Text\";\n\nimport { StyledFieldset, LegendSpan } from \"./styles\";\n\nexport type LegendWrapperProps = HTMLAttributes<HTMLLegendElement> & {\n children?: ReactNode;\n /** legend text */\n legendText: string;\n /** error message text */\n errorMessage?: string;\n /** flag for error styling */\n hasError?: boolean;\n /** when required (required) appears in legend */\n required?: boolean;\n /** hint text */\n hintText?: ReactNode;\n};\n/**\n * LegendWrapper allows the user to add an outer label for a checkbox / group of checkboxes / radio buttons or a group of radio buttons.\n *\n * hasError and errorMessage props are just props that can be passed into the component.\n * There is no functionality checking if the children are valid/required etc this functionality will be needed to ne added outside of this component.\n */\nexport function LegendWrapper({\n children,\n legendText,\n required,\n errorMessage,\n hasError,\n hintText,\n ...restOfHTMLAttributes\n}: LegendWrapperProps) {\n const foundTheme = useTheme();\n const theme = {\n ...defaultTheme,\n ...foundTheme,\n };\n\n const hintTextElement =\n !!hintText &&\n (typeof hintText === \"string\" || typeof hintText === \"number\") ? (\n <Text as=\"span\">{hintText}</Text>\n ) : (\n hintText\n );\n return (\n <ThemeProvider theme={theme}>\n <StyledFieldset\n $hasError={hasError || !!errorMessage || false}\n $hasHintText={!!hintText}\n >\n {legendText && (\n <legend {...restOfHTMLAttributes}>\n <LegendSpan $hasHintText={!!hintText}>\n {legendText} {required && <span>(required)</span>}\n </LegendSpan>\n {hintTextElement}\n </legend>\n )}\n {children}\n {!!errorMessage && (\n <ErrorText marginTop=\"xxs\">{errorMessage}</ErrorText>\n )}\n </StyledFieldset>\n </ThemeProvider>\n );\n}\n\nexport default LegendWrapper;\n"],"names":["LegendWrapper","
|
|
1
|
+
{"version":3,"file":"index.js","sources":["../../../../src/components/LegendWrapper/index.tsx"],"sourcesContent":["import React, { type HTMLAttributes, type ReactNode } from \"react\";\nimport { useTheme, ThemeProvider } from \"styled-components\";\n\nimport { crukTheme as defaultTheme } from \"../../themes/cruk\";\nimport { ErrorText } from \"../ErrorText\";\nimport { Text } from \"../Text\";\n\nimport { StyledFieldset, LegendSpan } from \"./styles\";\n\nexport type LegendWrapperProps = HTMLAttributes<HTMLLegendElement> & {\n children?: ReactNode;\n /** legend text */\n legendText: string;\n /** error message text */\n errorMessage?: string;\n /** flag for error styling */\n hasError?: boolean;\n /** when required (required) appears in legend */\n required?: boolean;\n /** hint text */\n hintText?: ReactNode;\n};\n/**\n * LegendWrapper allows the user to add an outer label for a checkbox / group of checkboxes / radio buttons or a group of radio buttons.\n *\n * hasError and errorMessage props are just props that can be passed into the component.\n * There is no functionality checking if the children are valid/required etc this functionality will be needed to ne added outside of this component.\n */\nexport function LegendWrapper({\n children,\n legendText,\n required,\n errorMessage,\n hasError,\n hintText,\n ...restOfHTMLAttributes\n}: LegendWrapperProps) {\n const foundTheme = useTheme();\n const theme = {\n ...defaultTheme,\n ...foundTheme,\n };\n\n const hintTextElement =\n !!hintText &&\n (typeof hintText === \"string\" || typeof hintText === \"number\") ? (\n <Text as=\"span\">{hintText}</Text>\n ) : (\n hintText\n );\n return (\n <ThemeProvider theme={theme}>\n <StyledFieldset\n $hasError={hasError || !!errorMessage || false}\n $hasHintText={!!hintText}\n >\n {legendText && (\n <legend {...restOfHTMLAttributes}>\n <LegendSpan $hasHintText={!!hintText}>\n {legendText} {required && <span>(required)</span>}\n </LegendSpan>\n {hintTextElement}\n </legend>\n )}\n {children}\n {!!errorMessage && (\n <ErrorText marginTop=\"xxs\">{errorMessage}</ErrorText>\n )}\n </StyledFieldset>\n </ThemeProvider>\n );\n}\n\nexport default LegendWrapper;\n"],"names":["LegendWrapper","children","legendText","required","errorMessage","hasError","hintText","restOfHTMLAttributes","foundTheme","useTheme","theme","defaultTheme","hintTextElement","React","createElement","Text","as","ThemeProvider","StyledFieldset","$hasError","$hasHintText","LegendSpan","ErrorText","marginTop"],"mappings":"sSA4BgBA,GAAcC,SAC5BA,EAAQC,WACRA,EAAUC,SACVA,EAAQC,aACRA,EAAYC,SACZA,EAAQC,SACRA,KACGC,IAEH,MAAMC,EAAaC,IACbC,EAAQ,IACTC,KACAH,GAGCI,GACFN,GACmB,iBAAbA,GAA6C,iBAAbA,EAGtC,EAFAO,EAAAC,cAACC,EAAI,CAACC,GAAG,QAAQV,GAIrB,OACEO,EAACC,cAAAG,EAAc,CAAAP,MAAOA,GACpBG,EAAAC,cAACI,EAAc,CAAAC,UACFd,KAAcD,IAAgB,EAAKgB,eAC9Bd,GAEfJ,GACCW,EAAAC,cAAA,SAAA,IAAYP,GACVM,EAAAC,cAACO,EAAU,CAAAD,eAAiBd,GACzBJ,MAAaC,GAAYU,2CAE3BD,GAGJX,IACEG,GACDS,EAAAC,cAACQ,EAAU,CAAAC,UAAU,OAAOnB,IAKtC"}
|
|
@@ -1,2 +1,35 @@
|
|
|
1
|
-
import
|
|
1
|
+
import e from"styled-components";const o=e.span`
|
|
2
|
+
display: block;
|
|
3
|
+
color: ${({theme:e})=>e.colors.textDark};
|
|
4
|
+
font-size: ${({theme:e})=>e.fontSizes.m};
|
|
5
|
+
line-height: ${({theme:e})=>e.typography.lineHeight};
|
|
6
|
+
font-weight: ${({theme:e})=>e.typography.fontWeightLabels};
|
|
7
|
+
font-family: ${({theme:e})=>e.typography.fontFamilyLabel};
|
|
8
|
+
min-width: 3em;
|
|
9
|
+
margin-bottom: ${({$hasHintText:e,theme:o})=>e?o.spacing.xxs:0};
|
|
10
|
+
|
|
11
|
+
& > * {
|
|
12
|
+
font-weight: ${({theme:e})=>e.typography.fontWeightBase};
|
|
13
|
+
}
|
|
14
|
+
`,t=e.fieldset`
|
|
15
|
+
*,
|
|
16
|
+
*:after,
|
|
17
|
+
*:before {
|
|
18
|
+
-webkit-box-sizing: border-box;
|
|
19
|
+
-moz-box-sizing: border-box;
|
|
20
|
+
box-sizing: border-box;
|
|
21
|
+
}
|
|
22
|
+
border: none;
|
|
23
|
+
padding: 0;
|
|
24
|
+
legend {
|
|
25
|
+
margin-bottom: ${({theme:e})=>e.spacing.xs};
|
|
26
|
+
}
|
|
27
|
+
label {
|
|
28
|
+
border-color: ${({$hasError:e,theme:o})=>e&&o.colors.textError};
|
|
29
|
+
margin-bottom: ${({theme:e})=>e.spacing.none};
|
|
30
|
+
&:last-of-type {
|
|
31
|
+
margin-bottom: 0;
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
`;export{o as LegendSpan,t as StyledFieldset};
|
|
2
35
|
//# sourceMappingURL=styles.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"styles.js","sources":["../../../../src/components/LegendWrapper/styles.ts"],"sourcesContent":["import styled from \"styled-components\";\n\nimport { type ThemeType } from \"../../types\";\n\ntype StyledFieldsetProps = {\n $hasError?: boolean;\n $hasHintText?: boolean;\n theme: ThemeType;\n};\n\nexport const LegendSpan = styled.span<{\n $hasHintText: boolean;\n theme: ThemeType;\n}>`\n display: block;\n color: ${({ theme }) => theme.colors.textDark};\n font-size: ${({ theme }) => theme.fontSizes.m};\n line-height: ${({ theme }) => theme.typography.lineHeight};\n font-weight: ${({ theme }) => theme.typography.fontWeightLabels};\n font-family: ${({ theme }) => theme.typography.fontFamilyLabel};\n min-width: 3em;\n margin-bottom: ${({ $hasHintText, theme }) =>\n $hasHintText ? theme.spacing.xxs : 0};\n\n & > * {\n font-weight: ${({ theme }) => theme.typography.fontWeightBase};\n }\n`;\n\nexport const StyledFieldset = styled.fieldset<StyledFieldsetProps>`\n *,\n *:after,\n *:before {\n -webkit-box-sizing: border-box;\n -moz-box-sizing: border-box;\n box-sizing: border-box;\n }\n border: none;\n padding: 0;\n legend {\n margin-bottom: ${({ theme }) => theme.spacing.xs};\n }\n label {\n border-color: ${({ $hasError, theme }) =>\n $hasError && theme.colors.textError};\n margin-bottom: ${({ theme }) => theme.spacing.none};\n &:last-of-type {\n margin-bottom: 0;\n }\n }\n`;\n"],"names":["LegendSpan","styled","span","
|
|
1
|
+
{"version":3,"file":"styles.js","sources":["../../../../src/components/LegendWrapper/styles.ts"],"sourcesContent":["import styled from \"styled-components\";\n\nimport { type ThemeType } from \"../../types\";\n\ntype StyledFieldsetProps = {\n $hasError?: boolean;\n $hasHintText?: boolean;\n theme: ThemeType;\n};\n\nexport const LegendSpan = styled.span<{\n $hasHintText: boolean;\n theme: ThemeType;\n}>`\n display: block;\n color: ${({ theme }) => theme.colors.textDark};\n font-size: ${({ theme }) => theme.fontSizes.m};\n line-height: ${({ theme }) => theme.typography.lineHeight};\n font-weight: ${({ theme }) => theme.typography.fontWeightLabels};\n font-family: ${({ theme }) => theme.typography.fontFamilyLabel};\n min-width: 3em;\n margin-bottom: ${({ $hasHintText, theme }) =>\n $hasHintText ? theme.spacing.xxs : 0};\n\n & > * {\n font-weight: ${({ theme }) => theme.typography.fontWeightBase};\n }\n`;\n\nexport const StyledFieldset = styled.fieldset<StyledFieldsetProps>`\n *,\n *:after,\n *:before {\n -webkit-box-sizing: border-box;\n -moz-box-sizing: border-box;\n box-sizing: border-box;\n }\n border: none;\n padding: 0;\n legend {\n margin-bottom: ${({ theme }) => theme.spacing.xs};\n }\n label {\n border-color: ${({ $hasError, theme }) =>\n $hasError && theme.colors.textError};\n margin-bottom: ${({ theme }) => theme.spacing.none};\n &:last-of-type {\n margin-bottom: 0;\n }\n }\n`;\n"],"names":["LegendSpan","styled","span","theme","colors","textDark","fontSizes","m","typography","lineHeight","fontWeightLabels","fontFamilyLabel","$hasHintText","spacing","xxs","fontWeightBase","StyledFieldset","fieldset","xs","$hasError","textError","none"],"mappings":"iCAUa,MAAAA,EAAaC,EAAOC,IAG/B;;WAES,EAAGC,WAAYA,EAAMC,OAAOC;eACxB,EAAGF,WAAYA,EAAMG,UAAUC;iBAC7B,EAAGJ,WAAYA,EAAMK,WAAWC;iBAChC,EAAGN,WAAYA,EAAMK,WAAWE;iBAChC,EAAGP,WAAYA,EAAMK,WAAWG;;mBAE9B,EAAGC,eAAcT,WAChCS,EAAeT,EAAMU,QAAQC,IAAM;;;mBAGpB,EAAGX,WAAYA,EAAMK,WAAWO;;EAItCC,EAAiBf,EAAOgB,QAA6B;;;;;;;;;;;qBAW7C,EAAGd,WAAYA,EAAMU,QAAQK;;;oBAG9B,EAAGC,YAAWhB,WAC5BgB,GAAahB,EAAMC,OAAOgB;qBACX,EAAGjB,WAAYA,EAAMU,QAAQQ;;;;;"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import
|
|
1
|
+
import e,{forwardRef as r}from"react";import{useTheme as t,ThemeProvider as o}from"styled-components";import{crukTheme as a}from"../../themes/cruk.js";import{StyledLink as m}from"./styles.js";const n=r(((r,n)=>{const s=t(),l={...a,...s},p=r.rel?r.rel:"_blank"===r.target?"noopener noreferrer":"",c=r.as&&"a"!==r.as?void 0:"a",{textHoverColor:f,appearance:i,...d}=r;return e.createElement(o,{theme:l},e.createElement(m,{...d,$textHoverColor:f,$appearance:i,theme:l,rel:p,forwardedAs:c,ref:n},r.children))}));n.displayName="Link";export{n as Link,n as default};
|
|
2
2
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sources":["../../../../src/components/Link/index.tsx"],"sourcesContent":["import React, {\n type AnchorHTMLAttributes,\n forwardRef,\n type Ref,\n type ElementType,\n type ReactNode,\n} from \"react\";\nimport { useTheme, ThemeProvider } from \"styled-components\";\n\nimport { crukTheme as defaultTheme } from \"../../themes/cruk\";\n\nimport { type TextProps } from \"../Text\";\nimport { StyledLink } from \"./styles\";\n\nexport type LinkProps = Omit<AnchorHTMLAttributes<HTMLElement>, \"nonce\"> &\n Omit<TextProps, \"as\" | \"ref\" | \"nonce\"> & {\n /** link text hover colour */\n textHoverColor?: string;\n /** link appearance variant, undefined is a standarding link withing a text block */\n appearance?: \"primary\" | \"secondary\";\n /** styled-components polymorphism where you can use the styling of a link but convert to another element like a button */\n ref?: Ref<HTMLElement>;\n /** styled-component polymorphic feature so you take the styling of a link and cast the component to be a \"span\" for example */\n as?: ElementType;\n /** Component children */\n children?: ReactNode;\n };\n\n/** Links are for wrapping plain text or elements to create clickable link.\n * This is to be treated as an anchor tag with the addition of the Text component API.\n * This component contains standard Anchor tag props like 'href' and 'target', but it also contains Text component props like 'textColor' and 'textAlign'.\n *\n * A link should really only be used for navigation to take a user to as new location.\n * The onClick handler can be use for more complicated scenarios.\n *\n * If you want something that looks like a link but behaves like a button ie. nothing to do with navigation, please consider using Link with as='button'\n *\n * If you want something that looks like a button but behaves like a link ie. it takes the user to a new location, please consider using Button and simply passing it an href, it will automatically turn into a link. */\nexport const Link = forwardRef((props: LinkProps, ref?: Ref<HTMLElement>) => {\n const foundTheme = useTheme();\n const theme = {\n ...defaultTheme,\n ...foundTheme,\n };\n // security by default\n const rel = props.rel\n ? props.rel\n : props.target === \"_blank\"\n ? \"noopener noreferrer\"\n : \"\";\n\n // only forward As anchor if we are not casting as something that is not an anchor\n const forwardAs = props.as && props.as !== \"a\" ? undefined : \"a\";\n\n const { textHoverColor, appearance, ...rest } = props;\n\n return (\n <ThemeProvider theme={theme}>\n <StyledLink\n {...rest}\n $textHoverColor={textHoverColor}\n $appearance={appearance}\n theme={theme}\n rel={rel}\n forwardedAs={forwardAs}\n ref={ref}\n >\n {props.children}\n </StyledLink>\n </ThemeProvider>\n );\n});\n\nexport default Link;\n"],"names":["Link","forwardRef","props","ref","foundTheme","useTheme","theme","
|
|
1
|
+
{"version":3,"file":"index.js","sources":["../../../../src/components/Link/index.tsx"],"sourcesContent":["import React, {\n type AnchorHTMLAttributes,\n forwardRef,\n type Ref,\n type ElementType,\n type ReactNode,\n} from \"react\";\nimport { useTheme, ThemeProvider } from \"styled-components\";\n\nimport { crukTheme as defaultTheme } from \"../../themes/cruk\";\n\nimport { type TextProps } from \"../Text\";\nimport { StyledLink } from \"./styles\";\n\nexport type LinkProps = Omit<AnchorHTMLAttributes<HTMLElement>, \"nonce\"> &\n Omit<TextProps, \"as\" | \"ref\" | \"nonce\"> & {\n /** link text hover colour */\n textHoverColor?: string;\n /** link appearance variant, undefined is a standarding link withing a text block */\n appearance?: \"primary\" | \"secondary\";\n /** styled-components polymorphism where you can use the styling of a link but convert to another element like a button */\n ref?: Ref<HTMLElement>;\n /** styled-component polymorphic feature so you take the styling of a link and cast the component to be a \"span\" for example */\n as?: ElementType;\n /** Component children */\n children?: ReactNode;\n };\n\n/** Links are for wrapping plain text or elements to create clickable link.\n * This is to be treated as an anchor tag with the addition of the Text component API.\n * This component contains standard Anchor tag props like 'href' and 'target', but it also contains Text component props like 'textColor' and 'textAlign'.\n *\n * A link should really only be used for navigation to take a user to as new location.\n * The onClick handler can be use for more complicated scenarios.\n *\n * If you want something that looks like a link but behaves like a button ie. nothing to do with navigation, please consider using Link with as='button'\n *\n * If you want something that looks like a button but behaves like a link ie. it takes the user to a new location, please consider using Button and simply passing it an href, it will automatically turn into a link. */\nexport const Link = forwardRef((props: LinkProps, ref?: Ref<HTMLElement>) => {\n const foundTheme = useTheme();\n const theme = {\n ...defaultTheme,\n ...foundTheme,\n };\n // security by default\n const rel = props.rel\n ? props.rel\n : props.target === \"_blank\"\n ? \"noopener noreferrer\"\n : \"\";\n\n // only forward As anchor if we are not casting as something that is not an anchor\n const forwardAs = props.as && props.as !== \"a\" ? undefined : \"a\";\n\n const { textHoverColor, appearance, ...rest } = props;\n\n return (\n <ThemeProvider theme={theme}>\n <StyledLink\n {...rest}\n $textHoverColor={textHoverColor}\n $appearance={appearance}\n theme={theme}\n rel={rel}\n forwardedAs={forwardAs}\n ref={ref}\n >\n {props.children}\n </StyledLink>\n </ThemeProvider>\n );\n});\n\nLink.displayName = \"Link\";\n\nexport default Link;\n"],"names":["Link","forwardRef","props","ref","foundTheme","useTheme","theme","defaultTheme","rel","target","forwardAs","as","undefined","textHoverColor","appearance","rest","React","createElement","ThemeProvider","StyledLink","$textHoverColor","$appearance","forwardedAs","children","displayName"],"mappings":"gMAsCa,MAAAA,EAAOC,GAAW,CAACC,EAAkBC,KAChD,MAAMC,EAAaC,IACbC,EAAQ,IACTC,KACAH,GAGCI,EAAMN,EAAMM,IACdN,EAAMM,IACW,WAAjBN,EAAMO,OACJ,sBACA,GAGAC,EAAYR,EAAMS,IAAmB,MAAbT,EAAMS,QAAaC,EAAY,KAEvDC,eAAEA,EAAcC,WAAEA,KAAeC,GAASb,EAEhD,OACEc,EAACC,cAAAC,EAAc,CAAAZ,MAAOA,GACpBU,EAAAC,cAACE,EAAU,IACLJ,EAAIK,gBACSP,EAAcQ,YAClBP,EACbR,MAAOA,EACPE,IAAKA,EACLc,YAAaZ,EACbP,IAAKA,GAEJD,EAAMqB,UAEK,IAIpBvB,EAAKwB,YAAc"}
|
|
@@ -1,2 +1,30 @@
|
|
|
1
|
-
import
|
|
1
|
+
import e from"styled-components";import{Text as o}from"../Text/index.js";const r=e(o)`
|
|
2
|
+
transition:
|
|
3
|
+
color 0.2s ease,
|
|
4
|
+
background-size 0.3s ease;
|
|
5
|
+
overflow-wrap: break-word;
|
|
6
|
+
background-color: rgba(255, 255, 255, 0);
|
|
7
|
+
border: none;
|
|
8
|
+
padding: 0;
|
|
9
|
+
color: ${({theme:{colors:e,utilities:{useBackgroundStyleLinks:o}},textColor:r,$appearance:a})=>r&&void 0!==e[r]?e[r]:r||(!a&&o?"currentColor":a&&"primary"===a?e.linkColorSecondary:e.linkColor)};
|
|
10
|
+
text-decoration: ${({$appearance:e,theme:{typography:{linkTextDecoration:o,LinkPrimaryTextDecoration:r}}})=>"primary"===e?r:"secondary"===e?"none":o};
|
|
11
|
+
font-family: ${({$appearance:e,theme:{typography:{fontFamilyBase:o,fontFamilyLinks:r}}})=>"primary"===e||"secondary"===e?r:o};
|
|
12
|
+
letter-spacing: ${({$appearance:e,theme:{typography:{LinkLetterSpacing:o}}})=>"primary"===e||"secondary"===e?o:"0px"};
|
|
13
|
+
|
|
14
|
+
background: ${({$appearance:e,theme:o,theme:{utilities:{useBackgroundStyleLinks:r}}})=>r&&!e?`linear-gradient(180deg, rgba(255, 255, 255, 0) 0px, ${o.colors.primary} -4px);`:void 0};
|
|
15
|
+
background-repeat: no-repeat;
|
|
16
|
+
background-position-y: calc(100%);
|
|
17
|
+
background-size: 100% 2px;
|
|
18
|
+
font-weight: ${({theme:e})=>e.typography.fontWeightLinks};
|
|
19
|
+
|
|
20
|
+
&:focus-visible {
|
|
21
|
+
outline: auto;
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
&:hover {
|
|
25
|
+
cursor: pointer;
|
|
26
|
+
background-size: 100% 100%;
|
|
27
|
+
color: ${({theme:{colors:e,utilities:{useBackgroundStyleLinks:o}},$textHoverColor:r,$appearance:a})=>!r&&o?e.textDark:r&&void 0!==e[r]?e[r]:r?a&&"primary"===a?e.linkColorHover:e.linkColorSecondaryHover:e.linkColorHover};
|
|
28
|
+
}
|
|
29
|
+
`;export{r as StyledLink,r as default};
|
|
2
30
|
//# sourceMappingURL=styles.js.map
|