@cruk/cruk-react-components 5.0.6 → 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/{components → src/components}/Badge/index.d.ts +3 -1
- package/lib/src/components/Badge/index.js +1 -1
- package/lib/src/components/Badge/index.js.map +1 -1
- package/lib/{components → src/components}/Badge/styles.d.ts +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 -29
- 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}/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":"styles.js","sources":["../../../../src/components/Link/styles.ts"],"sourcesContent":["import { type AnchorHTMLAttributes } from \"react\";\nimport styled from \"styled-components\";\n\nimport Text, { type TextProps } from \"../Text\";\n\nimport { type ThemeType, type ColorKeyType } from \"../../types\";\n\ntype StyledLinkProps = AnchorHTMLAttributes<HTMLElement> &\n TextProps & {\n theme: ThemeType;\n $appearance?: \"primary\" | \"secondary\";\n $textHoverColor?: string;\n };\n\nexport const StyledLink = styled(Text)<StyledLinkProps>`\n transition:\n color 0.2s ease,\n background-size 0.3s ease;\n overflow-wrap: break-word;\n background-color: rgba(255, 255, 255, 0);\n border: none;\n padding: 0;\n color: ${({\n theme: {\n colors,\n utilities: { useBackgroundStyleLinks },\n },\n textColor,\n $appearance,\n }) =>\n textColor && typeof colors[textColor as ColorKeyType] !== \"undefined\"\n ? colors[textColor as ColorKeyType]\n : textColor ||\n (!$appearance && useBackgroundStyleLinks\n ? \"currentColor\"\n : $appearance && $appearance === \"primary\"\n ? colors.linkColorSecondary\n : colors.linkColor)};\n text-decoration: ${({\n $appearance,\n theme: {\n typography: { linkTextDecoration, LinkPrimaryTextDecoration },\n },\n }) =>\n $appearance === \"primary\"\n ? LinkPrimaryTextDecoration\n : $appearance === \"secondary\"\n ? \"none\"\n : linkTextDecoration};\n font-family: ${({\n $appearance,\n theme: {\n typography: { fontFamilyBase, fontFamilyLinks },\n },\n }) =>\n $appearance === \"primary\" || $appearance === \"secondary\"\n ? fontFamilyLinks\n : fontFamilyBase};\n letter-spacing: ${({\n $appearance,\n theme: {\n typography: { LinkLetterSpacing },\n },\n }) =>\n $appearance === \"primary\" || $appearance === \"secondary\"\n ? LinkLetterSpacing\n : \"0px\"};\n\n background: ${({\n $appearance,\n theme,\n theme: {\n utilities: { useBackgroundStyleLinks },\n },\n }) =>\n useBackgroundStyleLinks && !$appearance\n ? `linear-gradient(180deg, rgba(255, 255, 255, 0) 0px, ${theme.colors.primary} -4px);`\n : undefined};\n background-repeat: no-repeat;\n background-position-y: calc(100%);\n background-size: 100% 2px;\n font-weight: ${({ theme }) => theme.typography.fontWeightLinks};\n\n &:focus-visible {\n outline: auto;\n }\n\n &:hover {\n cursor: pointer;\n background-size: 100% 100%;\n color: ${({\n theme: {\n colors,\n utilities: { useBackgroundStyleLinks },\n },\n $textHoverColor,\n $appearance,\n }) =>\n !$textHoverColor && useBackgroundStyleLinks\n ? colors.textDark\n : $textHoverColor &&\n typeof colors[$textHoverColor as ColorKeyType] !== \"undefined\"\n ? colors[$textHoverColor as ColorKeyType]\n : $textHoverColor\n ? $appearance && $appearance === \"primary\"\n ? colors.linkColorHover\n : colors.linkColorSecondaryHover\n : colors.linkColorHover};\n }\n`;\n\nexport default StyledLink;\n"],"names":["StyledLink","styled","Text","
|
|
1
|
+
{"version":3,"file":"styles.js","sources":["../../../../src/components/Link/styles.ts"],"sourcesContent":["import { type AnchorHTMLAttributes } from \"react\";\nimport styled from \"styled-components\";\n\nimport Text, { type TextProps } from \"../Text\";\n\nimport { type ThemeType, type ColorKeyType } from \"../../types\";\n\ntype StyledLinkProps = AnchorHTMLAttributes<HTMLElement> &\n TextProps & {\n theme: ThemeType;\n $appearance?: \"primary\" | \"secondary\";\n $textHoverColor?: string;\n };\n\nexport const StyledLink = styled(Text)<StyledLinkProps>`\n transition:\n color 0.2s ease,\n background-size 0.3s ease;\n overflow-wrap: break-word;\n background-color: rgba(255, 255, 255, 0);\n border: none;\n padding: 0;\n color: ${({\n theme: {\n colors,\n utilities: { useBackgroundStyleLinks },\n },\n textColor,\n $appearance,\n }) =>\n textColor && typeof colors[textColor as ColorKeyType] !== \"undefined\"\n ? colors[textColor as ColorKeyType]\n : textColor ||\n (!$appearance && useBackgroundStyleLinks\n ? \"currentColor\"\n : $appearance && $appearance === \"primary\"\n ? colors.linkColorSecondary\n : colors.linkColor)};\n text-decoration: ${({\n $appearance,\n theme: {\n typography: { linkTextDecoration, LinkPrimaryTextDecoration },\n },\n }) =>\n $appearance === \"primary\"\n ? LinkPrimaryTextDecoration\n : $appearance === \"secondary\"\n ? \"none\"\n : linkTextDecoration};\n font-family: ${({\n $appearance,\n theme: {\n typography: { fontFamilyBase, fontFamilyLinks },\n },\n }) =>\n $appearance === \"primary\" || $appearance === \"secondary\"\n ? fontFamilyLinks\n : fontFamilyBase};\n letter-spacing: ${({\n $appearance,\n theme: {\n typography: { LinkLetterSpacing },\n },\n }) =>\n $appearance === \"primary\" || $appearance === \"secondary\"\n ? LinkLetterSpacing\n : \"0px\"};\n\n background: ${({\n $appearance,\n theme,\n theme: {\n utilities: { useBackgroundStyleLinks },\n },\n }) =>\n useBackgroundStyleLinks && !$appearance\n ? `linear-gradient(180deg, rgba(255, 255, 255, 0) 0px, ${theme.colors.primary} -4px);`\n : undefined};\n background-repeat: no-repeat;\n background-position-y: calc(100%);\n background-size: 100% 2px;\n font-weight: ${({ theme }) => theme.typography.fontWeightLinks};\n\n &:focus-visible {\n outline: auto;\n }\n\n &:hover {\n cursor: pointer;\n background-size: 100% 100%;\n color: ${({\n theme: {\n colors,\n utilities: { useBackgroundStyleLinks },\n },\n $textHoverColor,\n $appearance,\n }) =>\n !$textHoverColor && useBackgroundStyleLinks\n ? colors.textDark\n : $textHoverColor &&\n typeof colors[$textHoverColor as ColorKeyType] !== \"undefined\"\n ? colors[$textHoverColor as ColorKeyType]\n : $textHoverColor\n ? $appearance && $appearance === \"primary\"\n ? colors.linkColorHover\n : colors.linkColorSecondaryHover\n : colors.linkColorHover};\n }\n`;\n\nexport default StyledLink;\n"],"names":["StyledLink","styled","Text","theme","colors","utilities","useBackgroundStyleLinks","textColor","$appearance","linkColorSecondary","linkColor","typography","linkTextDecoration","LinkPrimaryTextDecoration","fontFamilyBase","fontFamilyLinks","LinkLetterSpacing","primary","undefined","fontWeightLinks","$textHoverColor","textDark","linkColorHover","linkColorSecondaryHover"],"mappings":"+EAcaA,EAAaC,EAAOC,EAAsB;;;;;;;;WAQ5C,EACPC,OACEC,SACAC,WAAaC,4BAEfC,YACAC,iBAEAD,QAA0D,IAAtCH,EAAOG,GACvBH,EAAOG,GACPA,KACEC,GAAeF,EACb,eACAE,GAA+B,YAAhBA,EACbJ,EAAOK,mBACPL,EAAOM;qBACA,EACjBF,cACAL,OACEQ,YAAcC,qBAAoBC,iCAGpB,YAAhBL,EACIK,EACgB,cAAhBL,EACE,OACAI;iBACO,EACbJ,cACAL,OACEQ,YAAcG,iBAAgBC,uBAGhB,YAAhBP,GAA6C,cAAhBA,EACzBO,EACAD;oBACY,EAChBN,cACAL,OACEQ,YAAcK,yBAGA,YAAhBR,GAA6C,cAAhBA,EACzBQ,EACA;;gBAEQ,EACZR,cACAL,QACAA,OACEE,WAAaC,+BAGfA,IAA4BE,EACxB,uDAAuDL,EAAMC,OAAOa,sBACpEC;;;;iBAIS,EAAGf,WAAYA,EAAMQ,WAAWQ;;;;;;;;;aASpC,EACPhB,OACEC,SACAC,WAAaC,4BAEfc,kBACAZ,kBAECY,GAAmBd,EAChBF,EAAOiB,SACPD,QACqD,IAA5ChB,EAAOgB,GACdhB,EAAOgB,GACPA,EACEZ,GAA+B,YAAhBA,EACbJ,EAAOkB,eACPlB,EAAOmB,wBACTnB,EAAOkB;;"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import
|
|
1
|
+
import e from"react";import{useTheme as t,ThemeProvider as n}from"styled-components";import{crukTheme as r}from"../../themes/cruk.js";import{ScreenReaderOnly as l,Spinner as m}from"./styles.js";function a(){const a=t(),o={...r,...a};return e.createElement(n,{theme:o},e.createElement(e.Fragment,null,e.createElement(l,{role:"alert"},"Loading"),e.createElement(m,null,e.createElement("span",null),e.createElement("span",null),e.createElement("span",null))))}export{a as Loader,a as default};
|
|
2
2
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sources":["../../../../src/components/Loader/index.tsx"],"sourcesContent":["import React from \"react\";\nimport { ThemeProvider, useTheme } from \"styled-components\";\n\nimport { crukTheme as defaultTheme } from \"../../themes/cruk\";\n\nimport { ScreenReaderOnly, Spinner } from \"./styles\";\n\n/**\n *\n * Loaders are used after some user interaction that we assume will take some time to complete. They inform the user that their request is beeing processed and that they should wait.\n */\nexport function Loader() {\n const foundTheme = useTheme();\n const theme = {\n ...defaultTheme,\n ...foundTheme,\n };\n\n return (\n <ThemeProvider theme={theme}>\n <>\n <ScreenReaderOnly role=\"alert\">Loading</ScreenReaderOnly>\n <Spinner>\n <span />\n <span />\n <span />\n </Spinner>\n </>\n </ThemeProvider>\n );\n}\n\nexport default Loader;\n"],"names":["Loader","foundTheme","useTheme","theme","
|
|
1
|
+
{"version":3,"file":"index.js","sources":["../../../../src/components/Loader/index.tsx"],"sourcesContent":["import React from \"react\";\nimport { ThemeProvider, useTheme } from \"styled-components\";\n\nimport { crukTheme as defaultTheme } from \"../../themes/cruk\";\n\nimport { ScreenReaderOnly, Spinner } from \"./styles\";\n\n/**\n *\n * Loaders are used after some user interaction that we assume will take some time to complete. They inform the user that their request is beeing processed and that they should wait.\n */\nexport function Loader() {\n const foundTheme = useTheme();\n const theme = {\n ...defaultTheme,\n ...foundTheme,\n };\n\n return (\n <ThemeProvider theme={theme}>\n <>\n <ScreenReaderOnly role=\"alert\">Loading</ScreenReaderOnly>\n <Spinner>\n <span />\n <span />\n <span />\n </Spinner>\n </>\n </ThemeProvider>\n );\n}\n\nexport default Loader;\n"],"names":["Loader","foundTheme","useTheme","theme","defaultTheme","React","createElement","ThemeProvider","Fragment","ScreenReaderOnly","role","Spinner"],"mappings":"2MAWgBA,IACd,MAAMC,EAAaC,IACbC,EAAQ,IACTC,KACAH,GAGL,OACEI,EAACC,cAAAC,EAAc,CAAAJ,MAAOA,GACpBE,EAAAC,cAAAD,EAAAG,SAAA,KACEH,EAAAC,cAACG,EAAgB,CAACC,KAAK,SAAkC,WACzDL,EAAAC,cAACK,EAAO,KACNN,EAAQC,cAAA,OAAA,MACRD,EAAQC,cAAA,OAAA,MACRD,EAAAC,cAAA,OAAA,QAKV"}
|
|
@@ -1,2 +1,46 @@
|
|
|
1
|
-
import
|
|
1
|
+
import o,{keyframes as t}from"styled-components";const n=t`
|
|
2
|
+
0%,
|
|
3
|
+
80%,
|
|
4
|
+
100% {
|
|
5
|
+
transform: scale(0)
|
|
6
|
+
}
|
|
7
|
+
40% {
|
|
8
|
+
transform: scale(1)
|
|
9
|
+
}
|
|
10
|
+
`,a=o.p`
|
|
11
|
+
position: absolute;
|
|
12
|
+
left: -10000px;
|
|
13
|
+
top: auto;
|
|
14
|
+
width: 1px;
|
|
15
|
+
height: 1px;
|
|
16
|
+
overflow: hidden;
|
|
17
|
+
`,e=o.div`
|
|
18
|
+
width: 100%;
|
|
19
|
+
text-align: center;
|
|
20
|
+
margin-top: ${({theme:o})=>o.spacing.s};
|
|
21
|
+
|
|
22
|
+
span {
|
|
23
|
+
display: inline-block;
|
|
24
|
+
width: 16px;
|
|
25
|
+
height: 16px;
|
|
26
|
+
margin: 0 2px;
|
|
27
|
+
background-color: ${({theme:o})=>o.colors.loaderColor1};
|
|
28
|
+
border-radius: 100%;
|
|
29
|
+
animation: ${n} 1.2s infinite ease-in-out both;
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
span:nth-child(1) {
|
|
33
|
+
animation-delay: -0.32s;
|
|
34
|
+
-webkit-animation-delay: -0.32s;
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
span:nth-child(2) {
|
|
38
|
+
background-color: ${({theme:o})=>o.colors.loaderColor2};
|
|
39
|
+
animation-delay: -0.16s;
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
span:nth-child(3) {
|
|
43
|
+
background-color: ${({theme:o})=>o.colors.loaderColor3};
|
|
44
|
+
}
|
|
45
|
+
`;export{a as ScreenReaderOnly,e as Spinner};
|
|
2
46
|
//# sourceMappingURL=styles.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"styles.js","sources":["../../../../src/components/Loader/styles.ts"],"sourcesContent":["import styled, { keyframes } from \"styled-components\";\nimport { type ThemeType } from \"../../types\";\n\ntype SpinnerProps = {\n theme: ThemeType;\n};\n\nconst BounceDelay = keyframes`\n 0%,\n 80%,\n 100% {\n transform: scale(0)\n }\n 40% {\n transform: scale(1)\n }\n`;\n\nexport const ScreenReaderOnly = styled.p`\n position: absolute;\n left: -10000px;\n top: auto;\n width: 1px;\n height: 1px;\n overflow: hidden;\n`;\n\nexport const Spinner = styled.div<SpinnerProps>`\n width: 100%;\n text-align: center;\n margin-top: ${({ theme }) => theme.spacing.s};\n\n span {\n display: inline-block;\n width: 16px;\n height: 16px;\n margin: 0 2px;\n background-color: ${({ theme }) => theme.colors.loaderColor1};\n border-radius: 100%;\n animation: ${BounceDelay} 1.2s infinite ease-in-out both;\n }\n\n span:nth-child(1) {\n animation-delay: -0.32s;\n -webkit-animation-delay: -0.32s;\n }\n\n span:nth-child(2) {\n background-color: ${({ theme }) => theme.colors.loaderColor2};\n animation-delay: -0.16s;\n }\n\n span:nth-child(3) {\n background-color: ${({ theme }) => theme.colors.loaderColor3};\n }\n`;\n"],"names":["BounceDelay","keyframes","
|
|
1
|
+
{"version":3,"file":"styles.js","sources":["../../../../src/components/Loader/styles.ts"],"sourcesContent":["import styled, { keyframes } from \"styled-components\";\nimport { type ThemeType } from \"../../types\";\n\ntype SpinnerProps = {\n theme: ThemeType;\n};\n\nconst BounceDelay = keyframes`\n 0%,\n 80%,\n 100% {\n transform: scale(0)\n }\n 40% {\n transform: scale(1)\n }\n`;\n\nexport const ScreenReaderOnly = styled.p`\n position: absolute;\n left: -10000px;\n top: auto;\n width: 1px;\n height: 1px;\n overflow: hidden;\n`;\n\nexport const Spinner = styled.div<SpinnerProps>`\n width: 100%;\n text-align: center;\n margin-top: ${({ theme }) => theme.spacing.s};\n\n span {\n display: inline-block;\n width: 16px;\n height: 16px;\n margin: 0 2px;\n background-color: ${({ theme }) => theme.colors.loaderColor1};\n border-radius: 100%;\n animation: ${BounceDelay} 1.2s infinite ease-in-out both;\n }\n\n span:nth-child(1) {\n animation-delay: -0.32s;\n -webkit-animation-delay: -0.32s;\n }\n\n span:nth-child(2) {\n background-color: ${({ theme }) => theme.colors.loaderColor2};\n animation-delay: -0.16s;\n }\n\n span:nth-child(3) {\n background-color: ${({ theme }) => theme.colors.loaderColor3};\n }\n`;\n"],"names":["BounceDelay","keyframes","ScreenReaderOnly","styled","p","Spinner","div","theme","spacing","s","colors","loaderColor1","loaderColor2","loaderColor3"],"mappings":"iDAOA,MAAMA,EAAcC,CAAS;;;;;;;;;EAWhBC,EAAmBC,EAAOC,CAAC;;;;;;;EAS3BC,EAAUF,EAAOG,GAAiB;;;gBAG/B,EAAGC,WAAYA,EAAMC,QAAQC;;;;;;;wBAOrB,EAAGF,WAAYA,EAAMG,OAAOC;;iBAEnCX;;;;;;;;;wBASO,EAAGO,WAAYA,EAAMG,OAAOE;;;;;wBAK5B,EAAGL,WAAYA,EAAMG,OAAOG;;"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import
|
|
1
|
+
import e,{useEffect as t}from"react";import{createPortal as o}from"react-dom";import{useTheme as n,ThemeProvider as i}from"styled-components";import a from"../../../node_modules/react-focus-lock/dist/es2015/Combination.js";import{faClose as r}from"../../../node_modules/@fortawesome/free-solid-svg-icons/index.js";import{IconFa as d}from"../IconFa/index.js";import{crukTheme as m}from"../../themes/cruk.js";import{Wrapper as l,Content as c,CloseButton as g,Background as s}from"./styles.js";function p({modalName:p,closeFunction:u,showCloseButton:f,maxWidth:h="500px",top:w="1rem",backgroundColor:y="backgroundLight",children:E,width:b="90%",margin:k,marginHorizontal:x,marginVertical:L,marginTop:v,marginRight:C,marginBottom:j="xxl",marginLeft:B,padding:$="xs",paddingHorizontal:z,paddingVertical:F,paddingTop:H,paddingRight:R,paddingBottom:T,paddingLeft:V,isAnimated:A=!0}){const I=n(),W={...m,...I},_=e.useCallback((e=>{"Escape"===e.key&&u&&u()}),[u]);return t((()=>{if("undefined"!=typeof window)return document.body.style.overflow="hidden",document.addEventListener("keydown",_),()=>{"undefined"!=typeof window&&(document.body.style.overflow="unset",document.removeEventListener("keydown",_))}}),[_]),e.createElement(e.Fragment,null,"undefined"!=typeof window?o(e.createElement("section",null,e.createElement(a,{returnFocus:!0},e.createElement(i,{theme:W},e.createElement(l,{role:"dialog","aria-modal":"true","aria-label":p},e.createElement(c,{backgroundColor:y,$maxWidth:h,$width:b,$top:w,margin:k,marginHorizontal:x,marginVertical:L,marginTop:v,marginRight:C,marginBottom:j,marginLeft:B,padding:$,paddingHorizontal:z,paddingVertical:F,paddingTop:H,paddingRight:R,paddingBottom:T,paddingLeft:V,$isAnimated:A},f&&u?e.createElement(g,{"aria-label":"close",appearance:"tertiary",onClick:()=>{u()}},e.createElement(d,{faIcon:r})):null,E),e.createElement(s,{$isAnimated:A}))))),document.body):null)}export{p as Modal,p as default};
|
|
2
2
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sources":["../../../../src/components/Modal/index.tsx"],"sourcesContent":["import React, { type ReactNode, useEffect } from \"react\";\nimport { createPortal } from \"react-dom\";\nimport { ThemeProvider, useTheme } from \"styled-components\";\nimport FocusLock from \"react-focus-lock\";\nimport { faClose } from \"@fortawesome/free-solid-svg-icons\";\n\nimport { IconFa } from \"../IconFa\";\nimport { crukTheme as defaultTheme } from \"../../themes/cruk\";\n\nimport { CloseButton, Wrapper, Content, Background } from \"./styles\";\n\nimport { type SpacingProps } from \"../Spacing\";\n\nexport type ModalProps = SpacingProps & {\n /** modal name used for aria-label */\n modalName: string;\n /** callback function called on modal close */\n closeFunction: () => void;\n /** flag to reveal close button with cross in the top right of modal */\n showCloseButton?: boolean;\n /** set max width of modal */\n maxWidth?: string;\n /** set space from top of view port that modal appears */\n top?: string;\n /** background color of dialogue */\n backgroundColor?: string;\n /** children components */\n children?: ReactNode;\n /** width of modal */\n width?: string;\n /** turn on animate in modal */\n isAnimated?: boolean;\n};\n\n/**\n *\n * Use a modal to display content over top of the rest of the site which must be interacted with before the user can continue.\n * ## How modals work\n * - Modals are positioned over everything else in the document and remove scroll from the \"body\" tag so that modal content scrolls instead.\n * - Modals are unmounted when closed.\n * - Modal's \"trap\" focus in them, ensuring the keyboard navigation cycles through the modal, and not the rest of the page.\n * ## Accessibility\n * - Once the Modal is appeared on the screen, the focus must be within the Modal container which will enable the screen readers to be able to navigate within the Modal. You may wish to hide the close button so that a user must click on another button to confirm a choice before the modal is closed. However closing with the 'ESC' key must always work, so the props which contains the function that allows the modal to close itself 'closeFunction' is always required.\n */\nexport function Modal({\n modalName,\n closeFunction,\n showCloseButton,\n maxWidth = \"500px\",\n top = \"1rem\",\n backgroundColor = \"backgroundLight\",\n children,\n width = \"90%\",\n margin,\n marginHorizontal,\n marginVertical,\n marginTop,\n marginRight,\n marginBottom = \"xxl\",\n marginLeft,\n padding = \"xs\",\n paddingHorizontal,\n paddingVertical,\n paddingTop,\n paddingRight,\n paddingBottom,\n paddingLeft,\n isAnimated = true,\n}: ModalProps) {\n const foundTheme = useTheme();\n const theme = {\n ...defaultTheme,\n ...foundTheme,\n };\n const closeByEsc = (event: KeyboardEvent): void => {\n
|
|
1
|
+
{"version":3,"file":"index.js","sources":["../../../../src/components/Modal/index.tsx"],"sourcesContent":["import React, { type ReactNode, useEffect } from \"react\";\nimport { createPortal } from \"react-dom\";\nimport { ThemeProvider, useTheme } from \"styled-components\";\nimport FocusLock from \"react-focus-lock\";\nimport { faClose } from \"@fortawesome/free-solid-svg-icons\";\n\nimport { IconFa } from \"../IconFa\";\nimport { crukTheme as defaultTheme } from \"../../themes/cruk\";\n\nimport { CloseButton, Wrapper, Content, Background } from \"./styles\";\n\nimport { type SpacingProps } from \"../Spacing\";\n\nexport type ModalProps = SpacingProps & {\n /** modal name used for aria-label */\n modalName: string;\n /** callback function called on modal close */\n closeFunction: () => void;\n /** flag to reveal close button with cross in the top right of modal */\n showCloseButton?: boolean;\n /** set max width of modal */\n maxWidth?: string;\n /** set space from top of view port that modal appears */\n top?: string;\n /** background color of dialogue */\n backgroundColor?: string;\n /** children components */\n children?: ReactNode;\n /** width of modal */\n width?: string;\n /** turn on animate in modal */\n isAnimated?: boolean;\n};\n\n/**\n *\n * Use a modal to display content over top of the rest of the site which must be interacted with before the user can continue.\n * ## How modals work\n * - Modals are positioned over everything else in the document and remove scroll from the \"body\" tag so that modal content scrolls instead.\n * - Modals are unmounted when closed.\n * - Modal's \"trap\" focus in them, ensuring the keyboard navigation cycles through the modal, and not the rest of the page.\n * ## Accessibility\n * - Once the Modal is appeared on the screen, the focus must be within the Modal container which will enable the screen readers to be able to navigate within the Modal. You may wish to hide the close button so that a user must click on another button to confirm a choice before the modal is closed. However closing with the 'ESC' key must always work, so the props which contains the function that allows the modal to close itself 'closeFunction' is always required.\n */\nexport function Modal({\n modalName,\n closeFunction,\n showCloseButton,\n maxWidth = \"500px\",\n top = \"1rem\",\n backgroundColor = \"backgroundLight\",\n children,\n width = \"90%\",\n margin,\n marginHorizontal,\n marginVertical,\n marginTop,\n marginRight,\n marginBottom = \"xxl\",\n marginLeft,\n padding = \"xs\",\n paddingHorizontal,\n paddingVertical,\n paddingTop,\n paddingRight,\n paddingBottom,\n paddingLeft,\n isAnimated = true,\n}: ModalProps) {\n const foundTheme = useTheme();\n const theme = {\n ...defaultTheme,\n ...foundTheme,\n };\n const closeByEsc = React.useCallback(\n (event: KeyboardEvent): void => {\n if (event.key === \"Escape\" && !!closeFunction) {\n closeFunction();\n }\n },\n [closeFunction],\n );\n\n useEffect(() => {\n if (typeof window === `undefined`) {\n return undefined;\n }\n document.body.style.overflow = \"hidden\";\n document.addEventListener(\"keydown\", closeByEsc);\n\n return () => {\n if (typeof window === `undefined`) {\n return;\n }\n document.body.style.overflow = \"unset\";\n document.removeEventListener(\"keydown\", closeByEsc);\n };\n }, [closeByEsc]);\n\n return (\n <>\n {typeof window !== `undefined`\n ? createPortal(\n <section>\n <FocusLock returnFocus>\n <ThemeProvider theme={theme}>\n <Wrapper\n role=\"dialog\"\n aria-modal=\"true\"\n aria-label={modalName}\n >\n <Content\n backgroundColor={backgroundColor}\n $maxWidth={maxWidth}\n $width={width}\n $top={top}\n margin={margin}\n marginHorizontal={marginHorizontal}\n marginVertical={marginVertical}\n marginTop={marginTop}\n marginRight={marginRight}\n marginBottom={marginBottom}\n marginLeft={marginLeft}\n padding={padding}\n paddingHorizontal={paddingHorizontal}\n paddingVertical={paddingVertical}\n paddingTop={paddingTop}\n paddingRight={paddingRight}\n paddingBottom={paddingBottom}\n paddingLeft={paddingLeft}\n $isAnimated={isAnimated}\n >\n {showCloseButton && closeFunction ? (\n <CloseButton\n aria-label=\"close\"\n appearance=\"tertiary\"\n onClick={() => {\n closeFunction();\n }}\n >\n <IconFa faIcon={faClose} />\n </CloseButton>\n ) : null}\n {children}\n </Content>\n <Background $isAnimated={isAnimated} />\n </Wrapper>\n </ThemeProvider>\n </FocusLock>\n </section>,\n document.body,\n )\n : null}\n </>\n );\n}\n\nexport default Modal;\n"],"names":["Modal","modalName","closeFunction","showCloseButton","maxWidth","top","backgroundColor","children","width","margin","marginHorizontal","marginVertical","marginTop","marginRight","marginBottom","marginLeft","padding","paddingHorizontal","paddingVertical","paddingTop","paddingRight","paddingBottom","paddingLeft","isAnimated","foundTheme","useTheme","theme","defaultTheme","closeByEsc","React","useCallback","event","key","useEffect","window","document","body","style","overflow","addEventListener","removeEventListener","createElement","Fragment","createPortal","FocusLock","returnFocus","ThemeProvider","Wrapper","role","Content","$maxWidth","$width","$top","CloseButton","appearance","onClick","IconFa","faIcon","faClose","Background","$isAnimated"],"mappings":"2eA4CgB,SAAAA,GAAMC,UACpBA,EAASC,cACTA,EAAaC,gBACbA,EAAeC,SACfA,EAAW,QAAOC,IAClBA,EAAM,OAAMC,gBACZA,EAAkB,kBAAiBC,SACnCA,EAAQC,MACRA,EAAQ,MAAKC,OACbA,EAAMC,iBACNA,EAAgBC,eAChBA,EAAcC,UACdA,EAASC,YACTA,EAAWC,aACXA,EAAe,MAAKC,WACpBA,EAAUC,QACVA,EAAU,KAAIC,kBACdA,EAAiBC,gBACjBA,EAAeC,WACfA,EAAUC,aACVA,EAAYC,cACZA,EAAaC,YACbA,EAAWC,WACXA,GAAa,IAEb,MAAMC,EAAaC,IACbC,EAAQ,IACTC,KACAH,GAECI,EAAaC,EAAMC,aACtBC,IACmB,WAAdA,EAAMC,KAAsB9B,GAC9BA,MAGJ,CAACA,IAmBH,OAhBA+B,GAAU,KACR,GAAsB,oBAAXC,OAMX,OAHAC,SAASC,KAAKC,MAAMC,SAAW,SAC/BH,SAASI,iBAAiB,UAAWX,GAE9B,KACiB,oBAAXM,SAGXC,SAASC,KAAKC,MAAMC,SAAW,QAC/BH,SAASK,oBAAoB,UAAWZ,GAAW,CACpD,GACA,CAACA,IAGFC,EAAAY,cAAAZ,EAAAa,SAAA,KACqB,oBAAXR,OACJS,EACEd,EAAAY,cAAA,UAAA,KACEZ,EAACY,cAAAG,GAAUC,aAAW,GACpBhB,EAAAY,cAACK,EAAa,CAACpB,MAAOA,GACpBG,EAACY,cAAAM,GACCC,KAAK,SACM,aAAA,oBACC/C,GAEZ4B,EAAAY,cAACQ,EAAO,CACN3C,gBAAiBA,EACN4C,UAAA9C,EACH+C,OAAA3C,EACF4C,KAAA/C,EACNI,OAAQA,EACRC,iBAAkBA,EAClBC,eAAgBA,EAChBC,UAAWA,EACXC,YAAaA,EACbC,aAAcA,EACdC,WAAYA,EACZC,QAASA,EACTC,kBAAmBA,EACnBC,gBAAiBA,EACjBC,WAAYA,EACZC,aAAcA,EACdC,cAAeA,EACfC,YAAaA,cACAC,GAEZpB,GAAmBD,EAClB2B,gBAACwB,EAAW,CAAA,aACC,QACXC,WAAW,WACXC,QAAS,KACPrD,GAAe,GAGjB2B,EAACY,cAAAe,EAAO,CAAAC,OAAQC,KAEhB,KACHnD,GAEHsB,EAAAY,cAACkB,EAAU,CAAAC,YAAcrC,QAKjCY,SAASC,MAEX,KAGV"}
|
|
@@ -1,2 +1,60 @@
|
|
|
1
|
-
import
|
|
1
|
+
import o,{keyframes as i}from"styled-components";import{Box as t}from"../Box/index.js";import{Button as n}from"../Button/index.js";const a=o.div`
|
|
2
|
+
height: 100%;
|
|
3
|
+
overflow-x: hidden;
|
|
4
|
+
overflow-y: auto;
|
|
5
|
+
position: fixed;
|
|
6
|
+
top: 0;
|
|
7
|
+
width: 100%;
|
|
8
|
+
z-index: 9999;
|
|
9
|
+
`,e=i`
|
|
10
|
+
from {
|
|
11
|
+
opacity: 0;
|
|
12
|
+
transform: scale(0);
|
|
13
|
+
}
|
|
14
|
+
to {
|
|
15
|
+
opacity: 1;
|
|
16
|
+
transform: scale(1);
|
|
17
|
+
}
|
|
18
|
+
`,m=i`
|
|
19
|
+
from {
|
|
20
|
+
opacity: 0;
|
|
21
|
+
}
|
|
22
|
+
to {
|
|
23
|
+
opacity: 0.5;
|
|
24
|
+
}
|
|
25
|
+
`,r=o(t)`
|
|
26
|
+
background-color: ${({theme:{colors:o},backgroundColor:i})=>void 0!==i?void 0!==o[i]?o[i]:i:o.backgroundLight};
|
|
27
|
+
position: relative;
|
|
28
|
+
box-shadow: 0 3px 10px rgba(0, 0, 0, 0.3);
|
|
29
|
+
margin: ${({$top:o})=>`${o} auto auto auto`};
|
|
30
|
+
width: ${({$width:o})=>o};
|
|
31
|
+
min-height: 10rem;
|
|
32
|
+
max-width: ${({$maxWidth:o})=>o};
|
|
33
|
+
z-index: 9999;
|
|
34
|
+
animation-direction: normal;
|
|
35
|
+
animation-timing-function: ease-in-out;
|
|
36
|
+
animation-duration: 0.2s;
|
|
37
|
+
animation-name: ${({$isAnimated:o})=>o?e:"none"};
|
|
38
|
+
`,d=o(n)`
|
|
39
|
+
float: right;
|
|
40
|
+
margin-left: ${({theme:{spacing:{xs:o}}})=>o};
|
|
41
|
+
font-size: 1.2rem;
|
|
42
|
+
padding: 0;
|
|
43
|
+
`,s=o.div`
|
|
44
|
+
background: ${({theme:o})=>o.colors.modalBackdrop};
|
|
45
|
+
bottom: 0;
|
|
46
|
+
left: 0;
|
|
47
|
+
opacity: 0.5;
|
|
48
|
+
position: fixed;
|
|
49
|
+
right: 0;
|
|
50
|
+
top: 0;
|
|
51
|
+
transition:
|
|
52
|
+
opacity 0.3s,
|
|
53
|
+
bottom 0s 0.3s;
|
|
54
|
+
z-index: 100;
|
|
55
|
+
animation-direction: normal;
|
|
56
|
+
animation-timing-function: ease-in-out;
|
|
57
|
+
animation-duration: 0.3s;
|
|
58
|
+
animation-name: ${({$isAnimated:o})=>o?m:"none"};
|
|
59
|
+
`;export{s as Background,d as CloseButton,r as Content,a as Wrapper};
|
|
2
60
|
//# sourceMappingURL=styles.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"styles.js","sources":["../../../../src/components/Modal/styles.ts"],"sourcesContent":["import styled, { keyframes } from \"styled-components\";\nimport { type ColorKeyType, type ThemeType } from \"../../types\";\nimport Box from \"../Box\";\nimport { Button } from \"../Button\";\n\nexport const Wrapper = styled.div`\n height: 100%;\n overflow-x: hidden;\n overflow-y: auto;\n position: fixed;\n top: 0;\n width: 100%;\n z-index: 9999;\n`;\n\nconst grow = keyframes`\n from {\n opacity: 0;\n transform: scale(0);\n }\n to {\n opacity: 1;\n transform: scale(1);\n }\n`;\n\nconst fade = keyframes`\n from {\n opacity: 0;\n }\n to {\n opacity: 0.5;\n }\n`;\n\nexport const Content = styled(Box)<{\n $backgroundColor?: string;\n $top: string;\n $width: string;\n $maxWidth: string;\n $isAnimated?: boolean;\n theme: ThemeType;\n}>`\n background-color: ${({ theme: { colors }, backgroundColor }) =>\n backgroundColor !== undefined
|
|
1
|
+
{"version":3,"file":"styles.js","sources":["../../../../src/components/Modal/styles.ts"],"sourcesContent":["import styled, { keyframes } from \"styled-components\";\nimport { type ColorKeyType, type ThemeType } from \"../../types\";\nimport Box from \"../Box\";\nimport { Button } from \"../Button\";\n\nexport const Wrapper = styled.div`\n height: 100%;\n overflow-x: hidden;\n overflow-y: auto;\n position: fixed;\n top: 0;\n width: 100%;\n z-index: 9999;\n`;\n\nconst grow = keyframes`\n from {\n opacity: 0;\n transform: scale(0);\n }\n to {\n opacity: 1;\n transform: scale(1);\n }\n`;\n\nconst fade = keyframes`\n from {\n opacity: 0;\n }\n to {\n opacity: 0.5;\n }\n`;\n\nexport const Content = styled(Box)<{\n $backgroundColor?: string;\n $top: string;\n $width: string;\n $maxWidth: string;\n $isAnimated?: boolean;\n theme: ThemeType;\n}>`\n background-color: ${({ theme: { colors }, backgroundColor }) =>\n backgroundColor !== undefined\n ? colors[backgroundColor as ColorKeyType] !== undefined\n ? colors[backgroundColor as ColorKeyType]\n : backgroundColor\n : colors.backgroundLight};\n position: relative;\n box-shadow: 0 3px 10px rgba(0, 0, 0, 0.3);\n margin: ${({ $top }) => `${$top} auto auto auto`};\n width: ${({ $width }) => $width};\n min-height: 10rem;\n max-width: ${({ $maxWidth }) => $maxWidth};\n z-index: 9999;\n animation-direction: normal;\n animation-timing-function: ease-in-out;\n animation-duration: 0.2s;\n animation-name: ${({ $isAnimated }) => ($isAnimated ? grow : \"none\")};\n`;\n\nexport const CloseButton = styled(Button)<{\n theme: ThemeType;\n}>`\n float: right;\n margin-left: ${({\n theme: {\n spacing: { xs },\n },\n }) => xs};\n font-size: 1.2rem;\n padding: 0;\n`;\n\nexport const Background = styled.div<{\n theme: ThemeType;\n $isAnimated?: boolean;\n}>`\n background: ${({ theme }) => theme.colors.modalBackdrop};\n bottom: 0;\n left: 0;\n opacity: 0.5;\n position: fixed;\n right: 0;\n top: 0;\n transition:\n opacity 0.3s,\n bottom 0s 0.3s;\n z-index: 100;\n animation-direction: normal;\n animation-timing-function: ease-in-out;\n animation-duration: 0.3s;\n animation-name: ${({ $isAnimated }) => ($isAnimated ? fade : \"none\")};\n`;\n"],"names":["Wrapper","styled","div","grow","keyframes","fade","Content","Box","theme","colors","backgroundColor","undefined","backgroundLight","$top","$width","$maxWidth","$isAnimated","CloseButton","Button","spacing","xs","Background","modalBackdrop"],"mappings":"mIAKa,MAAAA,EAAUC,EAAOC,GAAG;;;;;;;;EAU3BC,EAAOC,CAAS;;;;;;;;;EAWhBC,EAAOD,CAAS;;;;;;;EASTE,EAAUL,EAAOM,EAO5B;sBACoB,EAAGC,OAASC,UAAUC,0BACpBC,IAApBD,OACgDC,IAA5CF,EAAOC,GACLD,EAAOC,GACPA,EACFD,EAAOG;;;YAGH,EAAGC,UAAW,GAAGA;WAClB,EAAGC,YAAaA;;eAEZ,EAAGC,eAAgBA;;;;;oBAKd,EAAGC,iBAAmBA,EAAcb,EAAO;EAGlDc,EAAchB,EAAOiB,EAEhC;;iBAEe,EACbV,OACEW,SAAWC,UAETA;;;EAKKC,EAAapB,EAAOC,GAG/B;gBACc,EAAGM,WAAYA,EAAMC,OAAOa;;;;;;;;;;;;;;oBAcxB,EAAGN,iBAAmBA,EAAcX,EAAO;"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import
|
|
1
|
+
import e from"react";import{useTheme as t,ThemeProvider as a}from"styled-components";import{crukTheme as l}from"../../themes/cruk.js";import{PagerWrapper as n,PagerList as c,PagerItem as r,PagerLink as i}from"./styles.js";function s({current:s,items:o,hideLast:m,pagerCallback:d,perPage:p,searchParam:u="page",children:f,id:E}){const $=t(),h={...l,...$},b=p>0?p:1,k=Math.ceil(o/b)||1,y=e=>({href:`${"undefined"!=typeof window?window.location.pathname:""}?${u?`${u}=${e}`:""}`,onClick:t=>{t.preventDefault(),d(e)}});return e.createElement(a,{theme:h},o>p&&e.createElement(n,null,e.createElement(c,null,e.createElement(r,{key:"Prev"},e.createElement(i,{"data-cta":E?`${E}-prev`:null,name:"Prev","aria-disabled":1===s,...1===s&&{tabIndex:-1},...1!==s&&y(s-1),$disabled:1===s},"Prev")),((t,a)=>{const l=[];let n=[];for(let n=1;n<=a;n+=1)l.push(e.createElement(r,{key:n},e.createElement(i,{"data-cta":E?`${E}-${n}`:null,$active:n===t,...y(n),"aria-label":`page ${n} of ${a}`},n)));const c=l.slice(0,1).concat(e.createElement(r,{key:"first"},e.createElement("span",null,"..."))),s=l.slice(l.length-1).concat(e.createElement(r,{key:"last"},e.createElement("span",null,"..."))).reverse();return n=l.slice(0,a),a>7&&(n=t<=4?m?l.slice(0,7):l.slice(0,5).concat(s):t>a-4?c.concat(l.slice(-5)):m?c.concat(l.slice(t-3,t+2)):c.concat(l.slice(t-2,t+1)).concat(s)),n})(s,k),e.createElement(r,{key:"Next"},e.createElement(i,{"data-cta":E?`${E}-next`:null,name:"Next","aria-disabled":s===k,...s===k&&{tabIndex:-1},...s!==k&&y(s+1),$disabled:s===k},"Next"))),f))}export{s as Pagination,s as default};
|
|
2
2
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sources":["../../../../src/components/Pagination/index.tsx"],"sourcesContent":["import React, {\n type HTMLAttributes,\n type MouseEvent,\n type ReactNode,\n type TouchEvent,\n} from \"react\";\nimport { ThemeProvider, useTheme } from \"styled-components\";\n\nimport { crukTheme as defaultTheme } from \"../../themes/cruk\";\n\nimport { PagerItem, PagerLink, PagerList, PagerWrapper } from \"./styles\";\n\nexport type PaginationProps = {\n /** set current page number */\n current: number;\n /** total number of pages */\n items: number;\n /** don't show an ellipsise and then the last page link, usefull for search results where the last page isn't important */\n hideLast?: boolean;\n /** callback function which is passed the selected page number on click */\n pagerCallback: (n: number) => void;\n /** number of items per page */\n perPage: number;\n /** the name of the search param in the url that is modified on page click, defaults to 'page' */\n searchParam?: string;\n children?: ReactNode;\n} & HTMLAttributes<HTMLElement>;\n\n/**\n * \n * Pagination is used when we are viewing large amounts of data.\nData is split into multiple pages and pagination is used to\neasily navigate through these pages.\n */\nexport function Pagination({\n current,\n items,\n hideLast,\n pagerCallback,\n perPage,\n searchParam = \"page\",\n children,\n id,\n}: PaginationProps) {\n const foundTheme = useTheme();\n const theme = {\n ...defaultTheme,\n ...foundTheme,\n };\n const perPageValue = perPage > 0 ? perPage : 1;\n const totalPages = Math.ceil(items / perPageValue) || 1;\n\n const linkProps = (number: number) => ({\n href: `${typeof window !== \"undefined\" ? window.location.pathname : \"\"}?${\n searchParam ? `${searchParam}=${number}` : \"\"\n }`,\n onClick: (e: TouchEvent | MouseEvent) => {\n e.preventDefault();\n pagerCallback(number);\n },\n });\n\n const renderPager = (active: number, total: number) => {\n const list = [];\n let pager = [];\n // get the list of items\n for (let number = 1; number <= total; number += 1) {\n list.push(\n <PagerItem key={number}>\n <PagerLink\n data-cta={id ? `${id}-${number}` : null}\n $active={number === active}\n {...linkProps(number)}\n aria-label={`page ${number} of ${total}`}\n >\n {number}\n </PagerLink>\n </PagerItem>,\n );\n }\n const first = list.slice(0, 1).concat(\n <PagerItem key=\"first\">\n <span>...</span>\n </PagerItem>,\n );\n const last = list\n .slice(list.length - 1)\n .concat(\n <PagerItem key=\"last\">\n <span>...</span>\n </PagerItem>,\n )\n .reverse();\n pager = list.slice(0, total);\n if (total > 7) {\n if (active <= 4) {\n pager = hideLast ? list.slice(0, 7) : list.slice(0, 5).concat(last);\n } else {\n pager =\n active > total - 4\n ? first.concat(list.slice(-5))\n : hideLast\n ? first.concat(list.slice(active - 3, active + 2))\n : first.concat(list.slice(active - 2, active + 1)).concat(last);\n }\n }\n return pager;\n };\n\n return (\n <ThemeProvider theme={theme}>\n {items > perPage && (\n <PagerWrapper>\n <PagerList>\n <PagerItem key=\"Prev\">\n <PagerLink\n data-cta={id ? `${id}-prev` : null}\n name=\"Prev\"\n aria-disabled={current === 1}\n {...(current === 1 && { tabIndex: -1 })}\n {...(current !== 1 && linkProps(current - 1))}\n $disabled={current === 1}\n >\n Prev\n </PagerLink>\n </PagerItem>\n {renderPager(current, totalPages)}\n <PagerItem key=\"Next\">\n <PagerLink\n data-cta={id ? `${id}-next` : null}\n name=\"Next\"\n aria-disabled={current === totalPages}\n {...(current === totalPages && { tabIndex: -1 })}\n {...(current !== totalPages && linkProps(current + 1))}\n $disabled={current === totalPages}\n >\n Next\n </PagerLink>\n </PagerItem>\n </PagerList>\n {children}\n </PagerWrapper>\n )}\n </ThemeProvider>\n );\n}\n\nexport default Pagination;\n"],"names":["Pagination","
|
|
1
|
+
{"version":3,"file":"index.js","sources":["../../../../src/components/Pagination/index.tsx"],"sourcesContent":["import React, {\n type HTMLAttributes,\n type MouseEvent,\n type ReactNode,\n type TouchEvent,\n} from \"react\";\nimport { ThemeProvider, useTheme } from \"styled-components\";\n\nimport { crukTheme as defaultTheme } from \"../../themes/cruk\";\n\nimport { PagerItem, PagerLink, PagerList, PagerWrapper } from \"./styles\";\n\nexport type PaginationProps = {\n /** set current page number */\n current: number;\n /** total number of pages */\n items: number;\n /** don't show an ellipsise and then the last page link, usefull for search results where the last page isn't important */\n hideLast?: boolean;\n /** callback function which is passed the selected page number on click */\n pagerCallback: (n: number) => void;\n /** number of items per page */\n perPage: number;\n /** the name of the search param in the url that is modified on page click, defaults to 'page' */\n searchParam?: string;\n children?: ReactNode;\n} & HTMLAttributes<HTMLElement>;\n\n/**\n * \n * Pagination is used when we are viewing large amounts of data.\nData is split into multiple pages and pagination is used to\neasily navigate through these pages.\n */\nexport function Pagination({\n current,\n items,\n hideLast,\n pagerCallback,\n perPage,\n searchParam = \"page\",\n children,\n id,\n}: PaginationProps) {\n const foundTheme = useTheme();\n const theme = {\n ...defaultTheme,\n ...foundTheme,\n };\n const perPageValue = perPage > 0 ? perPage : 1;\n const totalPages = Math.ceil(items / perPageValue) || 1;\n\n const linkProps = (number: number) => ({\n href: `${typeof window !== \"undefined\" ? window.location.pathname : \"\"}?${\n searchParam ? `${searchParam}=${number}` : \"\"\n }`,\n onClick: (e: TouchEvent | MouseEvent) => {\n e.preventDefault();\n pagerCallback(number);\n },\n });\n\n const renderPager = (active: number, total: number) => {\n const list = [];\n let pager = [];\n // get the list of items\n for (let number = 1; number <= total; number += 1) {\n list.push(\n <PagerItem key={number}>\n <PagerLink\n data-cta={id ? `${id}-${number}` : null}\n $active={number === active}\n {...linkProps(number)}\n aria-label={`page ${number} of ${total}`}\n >\n {number}\n </PagerLink>\n </PagerItem>,\n );\n }\n const first = list.slice(0, 1).concat(\n <PagerItem key=\"first\">\n <span>...</span>\n </PagerItem>,\n );\n const last = list\n .slice(list.length - 1)\n .concat(\n <PagerItem key=\"last\">\n <span>...</span>\n </PagerItem>,\n )\n .reverse();\n pager = list.slice(0, total);\n if (total > 7) {\n if (active <= 4) {\n pager = hideLast ? list.slice(0, 7) : list.slice(0, 5).concat(last);\n } else {\n pager =\n active > total - 4\n ? first.concat(list.slice(-5))\n : hideLast\n ? first.concat(list.slice(active - 3, active + 2))\n : first.concat(list.slice(active - 2, active + 1)).concat(last);\n }\n }\n return pager;\n };\n\n return (\n <ThemeProvider theme={theme}>\n {items > perPage && (\n <PagerWrapper>\n <PagerList>\n <PagerItem key=\"Prev\">\n <PagerLink\n data-cta={id ? `${id}-prev` : null}\n name=\"Prev\"\n aria-disabled={current === 1}\n {...(current === 1 && { tabIndex: -1 })}\n {...(current !== 1 && linkProps(current - 1))}\n $disabled={current === 1}\n >\n Prev\n </PagerLink>\n </PagerItem>\n {renderPager(current, totalPages)}\n <PagerItem key=\"Next\">\n <PagerLink\n data-cta={id ? `${id}-next` : null}\n name=\"Next\"\n aria-disabled={current === totalPages}\n {...(current === totalPages && { tabIndex: -1 })}\n {...(current !== totalPages && linkProps(current + 1))}\n $disabled={current === totalPages}\n >\n Next\n </PagerLink>\n </PagerItem>\n </PagerList>\n {children}\n </PagerWrapper>\n )}\n </ThemeProvider>\n );\n}\n\nexport default Pagination;\n"],"names":["Pagination","current","items","hideLast","pagerCallback","perPage","searchParam","children","id","foundTheme","useTheme","theme","defaultTheme","perPageValue","totalPages","Math","ceil","linkProps","number","href","window","location","pathname","onClick","e","preventDefault","React","createElement","ThemeProvider","PagerWrapper","PagerList","PagerItem","key","PagerLink","name","tabIndex","active","total","list","pager","push","$active","first","slice","concat","last","length","reverse","renderPager","$disabled"],"mappings":"8NAkCM,SAAUA,GAAWC,QACzBA,EAAOC,MACPA,EAAKC,SACLA,EAAQC,cACRA,EAAaC,QACbA,EAAOC,YACPA,EAAc,OAAMC,SACpBA,EAAQC,GACRA,IAEA,MAAMC,EAAaC,IACbC,EAAQ,IACTC,KACAH,GAECI,EAAeR,EAAU,EAAIA,EAAU,EACvCS,EAAaC,KAAKC,KAAKd,EAAQW,IAAiB,EAEhDI,EAAaC,IAAoB,CACrCC,KAAM,GAAqB,oBAAXC,OAAyBA,OAAOC,SAASC,SAAW,MAClEhB,EAAc,GAAGA,KAAeY,IAAW,KAE7CK,QAAUC,IACRA,EAAEC,iBACFrB,EAAcc,EAAO,IAmDzB,OACEQ,EAAAC,cAACC,EAAa,CAACjB,MAAOA,GACnBT,EAAQG,GACPqB,gBAACG,EAAY,KACXH,EAAAC,cAACG,EAAS,KACRJ,EAAAC,cAACI,EAAS,CAACC,IAAI,QACbN,EAACC,cAAAM,EACW,CAAA,WAAAzB,EAAK,GAAGA,SAAY,KAC9B0B,KAAK,OACU,gBAAY,IAAZjC,KACE,IAAZA,GAAiB,CAAEkC,UAAY,MACnB,IAAZlC,GAAiBgB,EAAUhB,EAAU,aACnB,IAAZA,GAAa,SA3DlB,EAACmC,EAAgBC,KACnC,MAAMC,EAAO,GACb,IAAIC,EAAQ,GAEZ,IAAK,IAAIrB,EAAS,EAAGA,GAAUmB,EAAOnB,GAAU,EAC9CoB,EAAKE,KACHd,EAAAC,cAACI,EAAU,CAAAC,IAAKd,GACdQ,EAAAC,cAACM,EAAS,CAAA,WACEzB,EAAK,GAAGA,KAAMU,IAAW,KAC1BuB,QAAAvB,IAAWkB,KAChBnB,EAAUC,gBACF,QAAQA,QAAamB,KAEhCnB,KAKT,MAAMwB,EAAQJ,EAAKK,MAAM,EAAG,GAAGC,OAC7BlB,EAAAC,cAACI,EAAU,CAAAC,IAAI,SACbN,EAAgBC,cAAA,OAAA,KAAA,SAGdkB,EAAOP,EACVK,MAAML,EAAKQ,OAAS,GACpBF,OACClB,EAACC,cAAAI,EAAU,CAAAC,IAAI,QACbN,EAAAC,cAAA,OAAA,KAAA,SAGHoB,UAcH,OAbAR,EAAQD,EAAKK,MAAM,EAAGN,GAClBA,EAAQ,IAERE,EADEH,GAAU,EACJjC,EAAWmC,EAAKK,MAAM,EAAG,GAAKL,EAAKK,MAAM,EAAG,GAAGC,OAAOC,GAG5DT,EAASC,EAAQ,EACbK,EAAME,OAAON,EAAKK,OAAM,IACxBxC,EACEuC,EAAME,OAAON,EAAKK,MAAMP,EAAS,EAAGA,EAAS,IAC7CM,EAAME,OAAON,EAAKK,MAAMP,EAAS,EAAGA,EAAS,IAAIQ,OAAOC,IAG7DN,CAAK,EAoBHS,CAAY/C,EAASa,GACtBY,EAAAC,cAACI,EAAS,CAACC,IAAI,QACbN,EAACC,cAAAM,EACW,CAAA,WAAAzB,EAAK,GAAGA,SAAY,KAC9B0B,KAAK,OACU,gBAAAjC,IAAYa,KACtBb,IAAYa,GAAc,CAAEqB,UAAY,MACxClC,IAAYa,GAAcG,EAAUhB,EAAU,GACxCgD,UAAAhD,IAAYa,GAGb,UAGfP,GAKX"}
|
|
@@ -1,2 +1,93 @@
|
|
|
1
|
-
import
|
|
1
|
+
import o,{css as e}from"styled-components";const t=o.div`
|
|
2
|
+
display: table;
|
|
3
|
+
width: 100%;
|
|
4
|
+
clear: both;
|
|
5
|
+
text-align: center;
|
|
6
|
+
`,n=o.ul`
|
|
7
|
+
display: inline-block;
|
|
8
|
+
padding-left: 0;
|
|
9
|
+
margin: 20px 0;
|
|
10
|
+
`,i=o.a`
|
|
11
|
+
font-weight: normal;
|
|
12
|
+
font-family: ${({theme:{typography:{fontFamilyBase:o}}})=>o};
|
|
13
|
+
font-size: ${({theme:{fontSizes:{s:o}}})=>o};
|
|
14
|
+
color: ${({theme:o})=>o.colors.textLight};
|
|
15
|
+
background-color: ${({theme:o})=>o.colors.paginationBackground};
|
|
16
|
+
cursor: pointer;
|
|
17
|
+
border-radius: 0;
|
|
18
|
+
margin: ${({theme:o})=>o.spacing.xxs};
|
|
19
|
+
padding: 7px 11px;
|
|
20
|
+
text-decoration: none;
|
|
21
|
+
&:active,
|
|
22
|
+
&:focus,
|
|
23
|
+
&:hover {
|
|
24
|
+
opacity: 0.88;
|
|
25
|
+
text-decoration: underline;
|
|
26
|
+
}
|
|
27
|
+
&:visited {
|
|
28
|
+
text-decoration: none;
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
&:focus-visible {
|
|
32
|
+
outline: auto;
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
${({$active:o,theme:t})=>o&&e`
|
|
36
|
+
color: ${t.colors.textDark};
|
|
37
|
+
background-color: ${t.colors.paginationActive};
|
|
38
|
+
cursor: default;
|
|
39
|
+
&:hover {
|
|
40
|
+
background-color: ${t.colors.paginationActive};
|
|
41
|
+
text-decoration: none;
|
|
42
|
+
}
|
|
43
|
+
`}
|
|
44
|
+
|
|
45
|
+
${({name:o,theme:t,$disabled:n})=>("Prev"===o||"Next"===o)&&e`
|
|
46
|
+
color: ${n?t.colors.disabled:t.colors.paginationText};
|
|
47
|
+
background-color: transparent;
|
|
48
|
+
font-weight: bold;
|
|
49
|
+
padding: 8px 6px;
|
|
50
|
+
background-color: transparent;
|
|
51
|
+
&:focus,
|
|
52
|
+
&:hover {
|
|
53
|
+
background-color: transparent;
|
|
54
|
+
text-decoration: underline;
|
|
55
|
+
}
|
|
56
|
+
&:active,
|
|
57
|
+
&:visited {
|
|
58
|
+
text-decoration: none;
|
|
59
|
+
}
|
|
60
|
+
`}
|
|
61
|
+
|
|
62
|
+
${({theme:o,$disabled:t})=>t&&e`
|
|
63
|
+
color: $ ${o.colors.disabled};
|
|
64
|
+
cursor: not-allowed;
|
|
65
|
+
pointer-events:none
|
|
66
|
+
text-decoration: none;
|
|
67
|
+
&:hover,
|
|
68
|
+
&:focus,
|
|
69
|
+
&:active,
|
|
70
|
+
&:visited {
|
|
71
|
+
color: ${o.colors.disabled};
|
|
72
|
+
text-decoration: none;
|
|
73
|
+
}
|
|
74
|
+
`}
|
|
75
|
+
`,r=o.li`
|
|
76
|
+
display: none;
|
|
77
|
+
&:first-child,
|
|
78
|
+
&:last-child {
|
|
79
|
+
display: inline;
|
|
80
|
+
}
|
|
81
|
+
@media (min-width: ${o=>o.theme.breakpoint.mobile}) {
|
|
82
|
+
display: inline;
|
|
83
|
+
}
|
|
84
|
+
span {
|
|
85
|
+
border: none;
|
|
86
|
+
min-width: 30px;
|
|
87
|
+
padding: 5px;
|
|
88
|
+
margin: 1px;
|
|
89
|
+
border-radius: 0;
|
|
90
|
+
border-width: ${o=>o.theme.breakpoint.mobile};
|
|
91
|
+
}
|
|
92
|
+
`;export{r as PagerItem,i as PagerLink,n as PagerList,t as PagerWrapper};
|
|
2
93
|
//# sourceMappingURL=styles.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"styles.js","sources":["../../../../src/components/Pagination/styles.ts"],"sourcesContent":["import styled, { css } from \"styled-components\";\nimport { type ThemeType } from \"../../types\";\n\nexport const PagerWrapper = styled.div`\n display: table;\n width: 100%;\n clear: both;\n text-align: center;\n`;\n\nexport const PagerList = styled.ul`\n display: inline-block;\n padding-left: 0;\n margin: 20px 0;\n`;\n\nexport const PagerLink = styled.a<{\n name?: string;\n theme: ThemeType;\n $active?: boolean;\n $disabled?: boolean;\n}>`\n font-weight: normal;\n font-family: ${({\n theme: {\n typography: { fontFamilyBase },\n },\n }) => fontFamilyBase};\n font-size: ${({\n theme: {\n fontSizes: { s },\n },\n }) => s};\n color: ${({ theme }) => theme.colors.textLight};\n background-color: ${({ theme }) => theme.colors.paginationBackground};\n cursor: pointer;\n border-radius: 0;\n margin: ${({ theme }) => theme.spacing.xxs};\n padding: 7px 11px;\n text-decoration: none;\n &:active,\n &:focus,\n &:hover {\n opacity: 0.88;\n text-decoration: underline;\n }\n &:visited {\n text-decoration: none;\n }\n\n &:focus-visible {\n outline: auto;\n }\n\n ${({ $active, theme }) =>\n $active &&\n css`\n color: ${theme.colors.textDark};\n background-color: ${theme.colors.paginationActive};\n cursor: default;\n &:hover {\n background-color: ${theme.colors.paginationActive};\n text-decoration: none;\n }\n `}\n\n ${({ name, theme, $disabled }) =>\n (name === \"Prev\" || name === \"Next\") &&\n css`\n color: ${$disabled ? theme.colors.disabled : theme.colors.paginationText};\n background-color: transparent;\n font-weight: bold;\n padding: 8px 6px;\n background-color: transparent;\n &:focus,\n &:hover {\n background-color: transparent;\n text-decoration: underline;\n }\n &:active,\n &:visited {\n text-decoration: none;\n }\n `}\n\n ${({ theme, $disabled }) =>\n $disabled &&\n css`\n color: $ ${theme.colors.disabled};\n cursor: not-allowed;\n pointer-events:none\n text-decoration: none;\n &:hover,\n &:focus,\n &:active,\n &:visited {\n color: ${theme.colors.disabled};\n text-decoration: none;\n }\n `}\n`;\n\nexport const PagerItem = styled.li<{ theme: ThemeType }>`\n display: none;\n &:first-child,\n &:last-child {\n display: inline;\n }\n @media (min-width: ${(props) => props.theme.breakpoint.mobile}) {\n display: inline;\n }\n span {\n border: none;\n min-width: 30px;\n padding: 5px;\n margin: 1px;\n border-radius: 0;\n border-width: ${(props) => props.theme.breakpoint.mobile};\n }\n`;\n"],"names":["PagerWrapper","styled","div","
|
|
1
|
+
{"version":3,"file":"styles.js","sources":["../../../../src/components/Pagination/styles.ts"],"sourcesContent":["import styled, { css } from \"styled-components\";\nimport { type ThemeType } from \"../../types\";\n\nexport const PagerWrapper = styled.div`\n display: table;\n width: 100%;\n clear: both;\n text-align: center;\n`;\n\nexport const PagerList = styled.ul`\n display: inline-block;\n padding-left: 0;\n margin: 20px 0;\n`;\n\nexport const PagerLink = styled.a<{\n name?: string;\n theme: ThemeType;\n $active?: boolean;\n $disabled?: boolean;\n}>`\n font-weight: normal;\n font-family: ${({\n theme: {\n typography: { fontFamilyBase },\n },\n }) => fontFamilyBase};\n font-size: ${({\n theme: {\n fontSizes: { s },\n },\n }) => s};\n color: ${({ theme }) => theme.colors.textLight};\n background-color: ${({ theme }) => theme.colors.paginationBackground};\n cursor: pointer;\n border-radius: 0;\n margin: ${({ theme }) => theme.spacing.xxs};\n padding: 7px 11px;\n text-decoration: none;\n &:active,\n &:focus,\n &:hover {\n opacity: 0.88;\n text-decoration: underline;\n }\n &:visited {\n text-decoration: none;\n }\n\n &:focus-visible {\n outline: auto;\n }\n\n ${({ $active, theme }) =>\n $active &&\n css`\n color: ${theme.colors.textDark};\n background-color: ${theme.colors.paginationActive};\n cursor: default;\n &:hover {\n background-color: ${theme.colors.paginationActive};\n text-decoration: none;\n }\n `}\n\n ${({ name, theme, $disabled }) =>\n (name === \"Prev\" || name === \"Next\") &&\n css`\n color: ${$disabled ? theme.colors.disabled : theme.colors.paginationText};\n background-color: transparent;\n font-weight: bold;\n padding: 8px 6px;\n background-color: transparent;\n &:focus,\n &:hover {\n background-color: transparent;\n text-decoration: underline;\n }\n &:active,\n &:visited {\n text-decoration: none;\n }\n `}\n\n ${({ theme, $disabled }) =>\n $disabled &&\n css`\n color: $ ${theme.colors.disabled};\n cursor: not-allowed;\n pointer-events:none\n text-decoration: none;\n &:hover,\n &:focus,\n &:active,\n &:visited {\n color: ${theme.colors.disabled};\n text-decoration: none;\n }\n `}\n`;\n\nexport const PagerItem = styled.li<{ theme: ThemeType }>`\n display: none;\n &:first-child,\n &:last-child {\n display: inline;\n }\n @media (min-width: ${(props) => props.theme.breakpoint.mobile}) {\n display: inline;\n }\n span {\n border: none;\n min-width: 30px;\n padding: 5px;\n margin: 1px;\n border-radius: 0;\n border-width: ${(props) => props.theme.breakpoint.mobile};\n }\n`;\n"],"names":["PagerWrapper","styled","div","PagerList","ul","PagerLink","a","theme","typography","fontFamilyBase","fontSizes","s","colors","textLight","paginationBackground","spacing","xxs","$active","css","textDark","paginationActive","name","$disabled","disabled","paginationText","PagerItem","li","props","breakpoint","mobile"],"mappings":"2CAGa,MAAAA,EAAeC,EAAOC,GAAG;;;;;EAOzBC,EAAYF,EAAOG,EAAE;;;;EAMrBC,EAAYJ,EAAOK,CAK9B;;iBAEe,EACbC,OACEC,YAAcC,sBAEZA;eACO,EACXF,OACEG,WAAaC,SAEXA;WACG,EAAGJ,WAAYA,EAAMK,OAAOC;sBACjB,EAAGN,WAAYA,EAAMK,OAAOE;;;YAGtC,EAAGP,WAAYA,EAAMQ,QAAQC;;;;;;;;;;;;;;;;;IAiBrC,EAAGC,UAASV,WACZU,GACAC,CAAG;eACQX,EAAMK,OAAOO;0BACFZ,EAAMK,OAAOQ;;;4BAGXb,EAAMK,OAAOQ;;;;;IAKrC,EAAGC,OAAMd,QAAOe,gBACN,SAATD,GAA4B,SAATA,IACpBH,CAAG;eACQI,EAAYf,EAAMK,OAAOW,SAAWhB,EAAMK,OAAOY;;;;;;;;;;;;;;;;IAgB5D,EAAGjB,QAAOe,eACVA,GACAJ,CAAG;iBACUX,EAAMK,OAAOW;;;;;;;;iBAQbhB,EAAMK,OAAOW;;;;EAMjBE,EAAYxB,EAAOyB,EAAwB;;;;;;uBAMhCC,GAAUA,EAAMpB,MAAMqB,WAAWC;;;;;;;;;oBASpCF,GAAUA,EAAMpB,MAAMqB,WAAWC;;"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import
|
|
1
|
+
import e,{useRef as t,useState as o,useEffect as r}from"react";import{useTheme as n,ThemeProvider as a}from"styled-components";import{useKey as i}from"../../hooks/useKey.js";import{crukTheme as m}from"../../themes/cruk.js";import{useEffectBrowser as l}from"../../hooks/useEffectBrowser.js";import{PopOverWrapper as s,PopOverModal as c}from"./styles.js";function d({onPopOverIsOpenChange:d,children:p,minWidth:u,maxWidth:f,position:h,modalLabel:E,modalContent:k,css:$,full:g=!1}){const j=t(null),[v,x]=o(!1),y=n(),C={...m,...y},W=()=>x(!v),L=()=>x(!1),b=e=>{j.current&&!j.current.contains(e.target)&&L()};return i((()=>{L()}),{detectKeys:["Escape"]},[]),r((()=>{d&&d(v)}),[v,d]),l((()=>(document.addEventListener("click",b,!0),()=>{document.removeEventListener("click",b,!0)})),[]),e.createElement(a,{theme:C},e.createElement(s,{$full:g,$css:$,ref:j},e.Children.map(p,(t=>e.cloneElement(t,{onClick:W,"aria-expanded":v,"aria-haspopup":"dialog"}))),v?e.createElement(c,{$maxWidth:f||"none",$minWidth:u||"auto",$position:h||"top",theme:C,role:"dialog","aria-label":E,"aria-modal":v},k):null))}export{d as PopOver,d as default};
|
|
2
2
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sources":["../../../../src/components/PopOver/index.tsx"],"sourcesContent":["import React, {\n useState,\n useEffect,\n useRef,\n
|
|
1
|
+
{"version":3,"file":"index.js","sources":["../../../../src/components/PopOver/index.tsx"],"sourcesContent":["import React, {\n useState,\n useEffect,\n useRef,\n type ReactElement,\n type ReactNode,\n} from \"react\";\nimport { ThemeProvider, useTheme } from \"styled-components\";\n\nimport { useKey } from \"../../hooks/useKey\";\nimport { crukTheme as defaultTheme } from \"../../themes/cruk\";\nimport { useEffectBrowser } from \"../../hooks/useEffectBrowser\";\n\nimport { type PopOverPositionType } from \"../../types\";\nimport { PopOverWrapper, PopOverModal } from \"./styles\";\n\nexport type PopOverProps = {\n /** modalLabel: used for aria-label of modal */\n modalLabel: string;\n /** modalContent: contents in side the popover modal */\n modalContent: ReactNode;\n /** position: position that the popover opens relative to the triggering element, the trigger element is the child of the component */\n position?: PopOverPositionType;\n /** full: enable child button extend full width */\n full?: boolean;\n /** maxWidth: popover modal max width */\n maxWidth?: string;\n /** minWidth: popover modal min width */\n minWidth?: string;\n /** onPopOverIsOpenChange: popover isOpen changed handler */\n onPopOverIsOpenChange?: (isOpen: boolean) => void;\n children?: ReactNode;\n css?: string;\n};\n\n/**\n * Popover is a non-modal dialog that floats around its disclosure. It's\ncommonly used for displaying additional rich content on top of something.\n*/\nexport function PopOver({\n onPopOverIsOpenChange,\n children,\n minWidth,\n maxWidth,\n position,\n modalLabel,\n modalContent,\n css,\n full = false,\n}: PopOverProps) {\n const popRef = useRef<HTMLDivElement>(null);\n const [showPopOver, setShowPopOver] = useState(false);\n const foundTheme = useTheme();\n const theme = {\n ...defaultTheme,\n ...foundTheme,\n };\n\n const toggle = () => setShowPopOver(!showPopOver);\n const closePopOver = () => setShowPopOver(false);\n\n // outside click closes popover\n const handleDocumentClick = (e: MouseEvent) => {\n if (!!popRef.current && !popRef.current.contains(e.target as Node)) {\n closePopOver();\n }\n };\n\n useKey(\n () => {\n closePopOver();\n },\n {\n detectKeys: [\"Escape\"],\n },\n [],\n );\n\n useEffect(() => {\n if (onPopOverIsOpenChange) {\n onPopOverIsOpenChange(showPopOver);\n }\n }, [showPopOver, onPopOverIsOpenChange]);\n\n useEffectBrowser(() => {\n document.addEventListener(\"click\", handleDocumentClick, true);\n return () => {\n document.removeEventListener(\"click\", handleDocumentClick, true);\n };\n }, []);\n\n return (\n <ThemeProvider theme={theme}>\n <PopOverWrapper $full={full} $css={css} ref={popRef}>\n {React.Children.map(\n children as ReactElement,\n (child: React.ReactElement) =>\n React.cloneElement(child, {\n onClick: toggle,\n \"aria-expanded\": showPopOver,\n \"aria-haspopup\": \"dialog\",\n }),\n )}\n {showPopOver ? (\n <PopOverModal\n $maxWidth={maxWidth || \"none\"}\n $minWidth={minWidth || \"auto\"}\n $position={position || \"top\"}\n theme={theme}\n role=\"dialog\"\n aria-label={modalLabel}\n aria-modal={showPopOver}\n >\n {modalContent}\n </PopOverModal>\n ) : null}\n </PopOverWrapper>\n </ThemeProvider>\n );\n}\n\nexport default PopOver;\n"],"names":["PopOver","onPopOverIsOpenChange","children","minWidth","maxWidth","position","modalLabel","modalContent","css","full","popRef","useRef","showPopOver","setShowPopOver","useState","foundTheme","useTheme","theme","defaultTheme","toggle","closePopOver","handleDocumentClick","e","current","contains","target","useKey","detectKeys","useEffect","useEffectBrowser","document","addEventListener","removeEventListener","React","createElement","ThemeProvider","PopOverWrapper","$css","ref","Children","map","child","cloneElement","onClick","PopOverModal","$minWidth","role"],"mappings":"iWAuCM,SAAUA,GAAQC,sBACtBA,EAAqBC,SACrBA,EAAQC,SACRA,EAAQC,SACRA,EAAQC,SACRA,EAAQC,WACRA,EAAUC,aACVA,EAAYC,IACZA,EAAGC,KACHA,GAAO,IAEP,MAAMC,EAASC,EAAuB,OAC/BC,EAAaC,GAAkBC,GAAS,GACzCC,EAAaC,IACbC,EAAQ,IACTC,KACAH,GAGCI,EAAS,IAAMN,GAAgBD,GAC/BQ,EAAe,IAAMP,GAAe,GAGpCQ,EAAuBC,IACrBZ,EAAOa,UAAYb,EAAOa,QAAQC,SAASF,EAAEG,SACjDL,KA2BJ,OAvBAM,GACE,KACEN,GAAc,GAEhB,CACEO,WAAY,CAAC,WAEf,IAGFC,GAAU,KACJ3B,GACFA,EAAsBW,KAEvB,CAACA,EAAaX,IAEjB4B,GAAiB,KACfC,SAASC,iBAAiB,QAASV,GAAqB,GACjD,KACLS,SAASE,oBAAoB,QAASX,GAAqB,EAAK,IAEjE,IAGDY,EAACC,cAAAC,EAAc,CAAAlB,MAAOA,GACpBgB,EAACC,cAAAE,SAAsB3B,EAAI4B,KAAQ7B,EAAK8B,IAAK5B,GAC1CuB,EAAMM,SAASC,IACdtC,GACCuC,GACCR,EAAMS,aAAaD,EAAO,CACxBE,QAASxB,EACT,gBAAiBP,EACjB,gBAAiB,aAGtBA,EACCqB,EAACC,cAAAU,aACYxC,GAAY,OAAMyC,UAClB1C,GAAY,iBACZE,GAAY,MACvBY,MAAOA,EACP6B,KAAK,SACO,aAAAxC,eACAM,GAEXL,GAED,MAIZ"}
|