@tpzdsp/next-toolkit 2.5.0 → 3.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +22 -13
- package/src/assets/styles/globals.css +75 -95
- package/src/assets/styles/ol.css +57 -16
- package/src/assets/styles/utils.css +80 -0
- package/src/components/Accordion/Accordion.css +85 -0
- package/src/components/Accordion/Accordion.stories.tsx +264 -0
- package/src/components/Accordion/Accordion.tsx +98 -0
- package/src/components/Alert/Alert.css +129 -0
- package/src/components/Alert/Alert.stories.tsx +291 -0
- package/src/components/Alert/Alert.tsx +76 -0
- package/src/components/BackLink/BackLink.css +12 -0
- package/src/components/BackLink/BackLink.stories.tsx +52 -0
- package/src/components/BackLink/BackLink.tsx +44 -0
- package/src/components/BackToTop/BackToTop.css +23 -0
- package/src/components/BackToTop/BackToTop.stories.tsx +41 -0
- package/src/components/BackToTop/BackToTop.tsx +48 -0
- package/src/components/Breadcrumb/Breadcrumb.css +42 -0
- package/src/components/Breadcrumb/Breadcrumb.stories.tsx +94 -0
- package/src/components/Breadcrumb/Breadcrumb.tsx +135 -0
- package/src/components/Button/Button.css +229 -0
- package/src/components/Button/Button.stories.tsx +140 -20
- package/src/components/Button/Button.tsx +53 -28
- package/src/components/Button/ButtonSkeleton.stories.tsx +50 -0
- package/src/components/Button/ButtonSkeleton.tsx +14 -0
- package/src/components/ButtonGroup/ButtonGroup.css +52 -0
- package/src/components/ButtonGroup/ButtonGroup.stories.tsx +156 -0
- package/src/components/ButtonGroup/ButtonGroup.tsx +50 -0
- package/src/components/ButtonLink/ButtonLink.css +114 -0
- package/src/components/ButtonLink/ButtonLink.stories.tsx +38 -51
- package/src/components/ButtonLink/ButtonLink.tsx +54 -23
- package/src/components/Card/Card.css +13 -0
- package/src/components/Card/Card.stories.tsx +98 -57
- package/src/components/Card/Card.tsx +4 -13
- package/src/components/CardGroup/CardGroup.css +10 -0
- package/src/components/CardGroup/CardGroup.stories.tsx +81 -0
- package/src/components/CardGroup/CardGroup.tsx +9 -0
- package/src/components/Checkbox/Checkbox.css +49 -0
- package/src/components/Checkbox/Checkbox.stories.tsx +86 -0
- package/src/components/Checkbox/Checkbox.tsx +32 -0
- package/src/components/Chip/Chip.css +54 -0
- package/src/components/Chip/Chip.stories.tsx +94 -0
- package/src/components/Chip/Chip.tsx +34 -0
- package/src/components/CookieBanner/CookieBanner.css +19 -0
- package/src/components/CookieBanner/CookieBanner.stories.tsx +52 -0
- package/src/components/CookieBanner/CookieBanner.tsx +55 -0
- package/src/components/CopyButton/CopyButton.stories.tsx +28 -0
- package/src/components/CopyButton/CopyButton.tsx +65 -0
- package/src/components/DateInput/DateInput.css +13 -0
- package/src/components/DateInput/DateInput.stories.tsx +131 -0
- package/src/components/DateInput/DateInput.test.tsx +21 -0
- package/src/components/DateInput/DateInput.tsx +98 -0
- package/src/components/Details/Details.css +28 -0
- package/src/components/Details/Details.stories.tsx +48 -0
- package/src/components/Details/Details.tsx +41 -0
- package/src/components/Dropdown/Dropdown.css +81 -0
- package/src/components/Dropdown/Dropdown.stories.tsx +131 -0
- package/src/components/Dropdown/Dropdown.tsx +69 -0
- package/src/components/ErrorBoundary/ErrorBoundary.stories.tsx +4 -39
- package/src/components/ErrorBoundary/ErrorBoundary.tsx +7 -4
- package/src/components/ErrorBoundary/ErrorFallback.tsx +32 -66
- package/src/components/ErrorModal/ErrorModal.css +32 -0
- package/src/components/ErrorModal/ErrorModal.stories.tsx +101 -0
- package/src/components/ErrorModal/ErrorModal.tsx +120 -0
- package/src/components/ErrorText/ErrorText.css +22 -0
- package/src/components/ErrorText/ErrorText.stories.tsx +42 -27
- package/src/components/ErrorText/ErrorText.tsx +10 -8
- package/src/components/ExternalLink/ExternalLink.css +12 -0
- package/src/components/ExternalLink/ExternalLink.stories.tsx +43 -0
- package/src/components/ExternalLink/ExternalLink.tsx +43 -0
- package/src/components/Fieldset/Fieldset.css +103 -0
- package/src/components/Fieldset/Fieldset.stories.tsx +304 -0
- package/src/components/Fieldset/Fieldset.tsx +38 -0
- package/src/components/FileUpload/FileUpload.css +85 -0
- package/src/components/FileUpload/FileUpload.stories.tsx +106 -0
- package/src/components/FileUpload/FileUpload.tsx +99 -0
- package/src/components/{layout/footer → Footer}/Copyright.tsx +4 -2
- package/src/components/Footer/Footer.stories.tsx +24 -0
- package/src/components/Footer/Footer.tsx +41 -0
- package/src/components/Footer/Licence.tsx +18 -0
- package/src/components/{layout/footer → Footer}/MetaLinks.tsx +8 -3
- package/src/components/Footer/Small/SmallFooter.tsx +43 -42
- package/src/components/Form/FormGroup.css +18 -0
- package/src/components/Form/FormGroup.stories.tsx +87 -0
- package/src/components/Form/FormGroup.tsx +16 -0
- package/src/components/{layout/header → Header}/Header.stories.tsx +26 -12
- package/src/components/Header/Header.test.tsx +87 -0
- package/src/components/Header/Header.tsx +303 -0
- package/src/components/Header/HeaderAppContent.tsx +120 -0
- package/src/components/Heading/Heading.css +40 -0
- package/src/components/Heading/Heading.stories.tsx +15 -5
- package/src/components/Heading/Heading.tsx +21 -44
- package/src/components/Heading/HeadingSkeleton.stories.tsx +30 -0
- package/src/components/Heading/HeadingSkeleton.tsx +14 -0
- package/src/components/Hero/Hero.css +19 -0
- package/src/components/Hero/Hero.stories.tsx +41 -0
- package/src/components/Hero/Hero.tsx +14 -0
- package/src/components/HintText/HintText.css +5 -0
- package/src/components/HintText/HintText.stories.tsx +29 -0
- package/src/components/HintText/HintText.tsx +13 -0
- package/src/components/InfoBox/InfoBox.css +38 -0
- package/src/components/InfoBox/InfoBox.stories.tsx +51 -403
- package/src/components/InfoBox/InfoBox.tsx +31 -158
- package/src/components/Input/Input.css +77 -0
- package/src/components/Input/Input.stories.tsx +123 -0
- package/src/components/Input/Input.tsx +74 -0
- package/src/components/InputGroup/InputGroup.css +140 -0
- package/src/components/InputGroup/InputGroup.stories.tsx +125 -0
- package/src/components/InputGroup/InputGroup.tsx +47 -0
- package/src/components/InsetText/InsetText.css +5 -0
- package/src/components/InsetText/InsetText.stories.tsx +30 -0
- package/src/components/InsetText/InsetText.tsx +9 -0
- package/src/components/Keyboard/Keyboard.css +9 -0
- package/src/components/Keyboard/Keyboard.stories.tsx +63 -0
- package/src/components/Keyboard/Keyboard.tsx +30 -0
- package/src/components/Label/Label.css +27 -0
- package/src/components/Label/Label.stories.tsx +40 -0
- package/src/components/Label/Label.tsx +17 -0
- package/src/components/LayerSwitcher/LayerSwitcher.css +59 -0
- package/src/components/LayerSwitcher/LayerSwitcher.stories.tsx +112 -0
- package/src/components/LayerSwitcher/LayerSwitcher.tsx +61 -0
- package/src/components/Layout/401/401.stories.tsx +23 -0
- package/src/components/Layout/401/401.tsx +1 -0
- package/src/components/Layout/403/403.stories.tsx +23 -0
- package/src/components/Layout/403/403.tsx +21 -0
- package/src/components/Layout/404/404.stories.tsx +23 -0
- package/src/components/Layout/404/404.tsx +28 -0
- package/src/components/Layout/500/500.stories.tsx +56 -0
- package/src/components/Layout/500/500.tsx +63 -0
- package/src/components/Layout/ButtonGroup/ButtonGroup.css +52 -0
- package/src/components/Layout/ButtonGroup/ButtonGroup.stories.tsx +156 -0
- package/src/components/Layout/ButtonGroup/ButtonGroup.tsx +50 -0
- package/src/components/Layout/HeadingGroup/HeadingGroup.css +21 -0
- package/src/components/Layout/HeadingGroup/HeadingGroup.stories.tsx +84 -0
- package/src/components/Layout/HeadingGroup/HeadingGroup.tsx +9 -0
- package/src/components/Layout/MainWrapper/MainWrapper.css +12 -0
- package/src/components/Layout/MainWrapper/MainWrapper.stories.tsx +36 -0
- package/src/components/Layout/MainWrapper/MainWrapper.tsx +14 -0
- package/src/components/Layout/PageShell/PageShell.css +42 -0
- package/src/components/Layout/PageShell/PageShell.stories.tsx +108 -0
- package/src/components/Layout/PageShell/PageShell.tsx +31 -0
- package/src/components/Layout/ParagraphGroup/ParagraphGroup.css +5 -0
- package/src/components/Layout/ParagraphGroup/ParagraphGroup.stories.tsx +34 -0
- package/src/components/Layout/ParagraphGroup/ParagraphGroup.tsx +9 -0
- package/src/components/Layout/Stack/Stack.css +29 -0
- package/src/components/Layout/Stack/Stack.stories.tsx +83 -0
- package/src/components/Layout/Stack/Stack.tsx +19 -0
- package/src/components/Layout/WidthContainer/WidthContainer.css +17 -0
- package/src/components/Layout/WidthContainer/WidthContainer.stories.tsx +59 -0
- package/src/components/Layout/WidthContainer/WidthContainer.tsx +13 -0
- package/src/components/Legend/Legend.css +95 -0
- package/src/components/Legend/Legend.stories.tsx +81 -0
- package/src/components/Legend/Legend.tsx +32 -0
- package/src/components/Legend/LegendDot.tsx +15 -0
- package/src/components/Legend/LegendPanel.stories.tsx +101 -0
- package/src/components/Legend/LegendPanel.tsx +68 -0
- package/src/components/Legend/LegendSkeleton.stories.tsx +87 -0
- package/src/components/Legend/LegendSkeleton.tsx +73 -0
- package/src/components/LegendSelect/LegendSelect.css +8 -0
- package/src/components/LegendSelect/LegendSelect.stories.tsx +80 -0
- package/src/components/LegendSelect/LegendSelect.tsx +26 -0
- package/src/components/Link/Link.css +98 -0
- package/src/components/Link/Link.stories.tsx +70 -0
- package/src/components/Link/Link.tsx +52 -0
- package/src/components/LinkButton/LinkButton.css +67 -0
- package/src/components/LinkButton/LinkButton.stories.tsx +90 -42
- package/src/components/LinkButton/LinkButton.tsx +50 -63
- package/src/components/LinkList/LinkList.css +28 -0
- package/src/components/LinkList/LinkList.stories.tsx +46 -0
- package/src/components/LinkList/LinkList.tsx +23 -0
- package/src/components/List/Li.tsx +9 -0
- package/src/components/List/List.css +9 -0
- package/src/components/List/OrderedList.stories.tsx +36 -0
- package/src/components/List/OrderedList.tsx +9 -0
- package/src/components/List/UnorderedList.stories.tsx +36 -0
- package/src/components/List/UnorderedList.tsx +9 -0
- package/src/components/LoadingBox/LoadingBox.css +27 -0
- package/src/components/LoadingBox/LoadingBox.stories.tsx +66 -0
- package/src/components/LoadingBox/LoadingBox.tsx +40 -0
- package/src/components/Modal/Modal.css +114 -0
- package/src/components/Modal/Modal.stories.tsx +41 -160
- package/src/components/Modal/Modal.tsx +132 -75
- package/src/components/NoScriptBanner/NoScriptBanner.css +17 -0
- package/src/components/NoScriptBanner/NoScriptBanner.stories.tsx +46 -0
- package/src/components/NoScriptBanner/NoScriptBanner.tsx +26 -0
- package/src/components/Paragraph/Paragraph.css +22 -0
- package/src/components/Paragraph/Paragraph.stories.tsx +1 -42
- package/src/components/Paragraph/Paragraph.tsx +4 -3
- package/src/components/Paragraph/ParagraphSkeleton.stories.tsx +44 -0
- package/src/components/Paragraph/ParagraphSkeleton.tsx +33 -0
- package/src/components/PasswordInput/PasswordInput.css +3 -0
- package/src/components/PasswordInput/PasswordInput.stories.tsx +47 -0
- package/src/components/PasswordInput/PasswordInput.tsx +45 -0
- package/src/components/PhaseBanner/PhaseBanner.css +12 -0
- package/src/components/PhaseBanner/PhaseBanner.stories.tsx +61 -0
- package/src/components/PhaseBanner/PhaseBanner.tsx +17 -0
- package/src/components/Popover/Popover.css +43 -0
- package/src/components/Popover/Popover.stories.tsx +102 -0
- package/src/components/Popover/Popover.tsx +40 -0
- package/src/components/Radio/Radio.css +69 -0
- package/src/components/Radio/Radio.stories.tsx +169 -0
- package/src/components/Radio/Radio.tsx +56 -0
- package/src/components/Resizable/Resizable.css +86 -0
- package/src/components/Resizable/Resizable.stories.tsx +123 -0
- package/src/components/Resizable/Resizable.tsx +86 -0
- package/src/components/ScrollArea/ScrollArea.css +9 -0
- package/src/components/ScrollArea/ScrollArea.stories.tsx +42 -0
- package/src/components/ScrollArea/ScrollArea.tsx +11 -0
- package/src/components/SearchBox/SearchBox.stories.tsx +88 -0
- package/src/components/SearchBox/SearchBox.tsx +36 -0
- package/src/components/Select/AsyncSelect.stories.tsx +84 -0
- package/src/components/Select/AsyncSelect.tsx +41 -0
- package/src/components/Select/Select.css +194 -0
- package/src/components/Select/Select.stories.tsx +162 -0
- package/src/components/Select/Select.test.tsx +36 -0
- package/src/components/Select/Select.tsx +291 -0
- package/src/components/Select/SelectSkeleton.stories.tsx +51 -0
- package/src/components/Select/SelectSkeleton.tsx +23 -0
- package/src/components/Separator/Separator.css +41 -0
- package/src/components/Separator/Separator.stories.tsx +63 -0
- package/src/components/Separator/Separator.tsx +42 -0
- package/src/components/Sidebar/ResizableSidebar.tsx +118 -0
- package/src/components/Sidebar/Sidebar.css +203 -0
- package/src/components/Sidebar/Sidebar.stories.tsx +438 -0
- package/src/components/Sidebar/Sidebar.tsx +225 -0
- package/src/components/Skeleton/Skeleton.css +16 -0
- package/src/components/Skeleton/Skeleton.stories.tsx +39 -0
- package/src/components/Skeleton/Skeleton.tsx +12 -0
- package/src/components/SkipLink/SkipLink.css +16 -0
- package/src/components/SkipLink/SkipLink.stories.tsx +40 -0
- package/src/components/SkipLink/SkipLink.tsx +15 -0
- package/src/components/Spinner/Spinner.css +30 -0
- package/src/components/Spinner/Spinner.stories.tsx +36 -0
- package/src/components/Spinner/Spinner.tsx +45 -0
- package/src/components/StartButton/StartButton.css +13 -0
- package/src/components/StartButton/StartButton.stories.tsx +68 -0
- package/src/components/StartButton/StartButton.tsx +50 -0
- package/src/components/SubmitButton/SubmitButton.stories.tsx +31 -0
- package/src/components/SubmitButton/SubmitButton.tsx +14 -0
- package/src/components/SummaryList/SummaryList.css +71 -0
- package/src/components/SummaryList/SummaryList.stories.tsx +211 -0
- package/src/components/SummaryList/SummaryList.tsx +41 -0
- package/src/components/SummaryList/SummaryListSkeleton.stories.tsx +67 -0
- package/src/components/SummaryList/SummaryListSkeleton.tsx +40 -0
- package/src/components/Tabs/Tabs.css +84 -0
- package/src/components/Tabs/Tabs.stories.tsx +133 -0
- package/src/components/Tabs/Tabs.tsx +66 -0
- package/src/components/Tag/Tag.css +8 -0
- package/src/components/Tag/Tag.stories.tsx +96 -0
- package/src/components/Tag/Tag.tsx +34 -0
- package/src/components/Textarea/Textarea.css +38 -0
- package/src/components/Textarea/Textarea.stories.tsx +131 -0
- package/src/components/Textarea/Textarea.tsx +50 -0
- package/src/components/TextareaCount/TextareaCount.css +17 -0
- package/src/components/TextareaCount/TextareaCount.stories.tsx +131 -0
- package/src/components/TextareaCount/TextareaCount.tsx +108 -0
- package/src/components/Tooltip/Tooltip.css +43 -0
- package/src/components/Tooltip/Tooltip.stories.tsx +110 -0
- package/src/components/Tooltip/Tooltip.tsx +53 -0
- package/src/components/WarningText/WarningText.css +20 -0
- package/src/components/WarningText/WarningText.stories.tsx +29 -0
- package/src/components/WarningText/WarningText.tsx +17 -0
- package/src/components/index.ts +342 -61
- package/src/errors/errorDisplay.ts +70 -0
- package/src/errors/index.ts +1 -0
- package/src/http/constants.ts +1 -0
- package/src/http/fetch.ts +7 -3
- package/src/map/LayerSwitcherPanel.tsx +2 -173
- package/src/map/LegendShim.tsx +2 -0
- package/src/map/MapComponent.tsx +7 -17
- package/src/map/MapControlsOverlay.tsx +68 -175
- package/src/map/Popup.tsx +71 -24
- package/src/map/geocoder/Geocoder.test.tsx +46 -3
- package/src/map/geocoder/Geocoder.tsx +155 -278
- package/src/map/index.ts +1 -1
- package/src/types/utils.ts +0 -10
- package/src/utils/components.ts +96 -0
- package/src/utils/index.ts +1 -0
- package/src/utils/utils.ts +0 -12
- package/src/assets/images/defra-logo.svg +0 -51
- package/src/assets/images/ea-logo.svg +0 -58
- package/src/assets/images/ogl.svg +0 -1
- package/src/components/Button/Button.test.tsx +0 -53
- package/src/components/ButtonLink/ButtonLink.test.tsx +0 -154
- package/src/components/Card/Card.test.tsx +0 -51
- package/src/components/ErrorBoundary/ErrorBoundary.test.tsx +0 -75
- package/src/components/ErrorBoundary/ErrorFallback.test.tsx +0 -107
- package/src/components/ErrorText/ErrorText.test.tsx +0 -33
- package/src/components/Heading/Heading.test.tsx +0 -22
- package/src/components/Hint/Hint.stories.tsx +0 -58
- package/src/components/Hint/Hint.test.tsx +0 -33
- package/src/components/Hint/Hint.tsx +0 -12
- package/src/components/InfoBox/InfoBox.test.tsx +0 -330
- package/src/components/InfoBox/types.ts +0 -6
- package/src/components/LinkButton/LinkButton.test.tsx +0 -177
- package/src/components/Modal/Modal.test.tsx +0 -246
- package/src/components/NotificationBanner/NotificationBanner.stories.tsx +0 -45
- package/src/components/NotificationBanner/NotificationBanner.test.tsx +0 -58
- package/src/components/NotificationBanner/NotificationBanner.tsx +0 -45
- package/src/components/Paragraph/Paragraph.test.tsx +0 -10
- package/src/components/SlidingPanel/SlidingPanel.stories.tsx +0 -129
- package/src/components/SlidingPanel/SlidingPanel.test.tsx +0 -83
- package/src/components/SlidingPanel/SlidingPanel.tsx +0 -258
- package/src/components/accordion/Accordion.stories.tsx +0 -234
- package/src/components/accordion/Accordion.test.tsx +0 -192
- package/src/components/accordion/Accordion.tsx +0 -73
- package/src/components/backToTop/BackToTop.stories.tsx +0 -407
- package/src/components/backToTop/BackToTop.test.tsx +0 -57
- package/src/components/backToTop/BackToTop.tsx +0 -134
- package/src/components/chip/Chip.stories.tsx +0 -61
- package/src/components/chip/Chip.test.tsx +0 -31
- package/src/components/chip/Chip.tsx +0 -23
- package/src/components/container/Container.tsx +0 -42
- package/src/components/cookieBanner/CookieBanner.stories.tsx +0 -257
- package/src/components/cookieBanner/CookieBanner.test.tsx +0 -68
- package/src/components/cookieBanner/CookieBanner.tsx +0 -73
- package/src/components/divider/RuleDivider.stories.tsx +0 -254
- package/src/components/divider/RuleDivider.test.tsx +0 -164
- package/src/components/divider/RuleDivider.tsx +0 -23
- package/src/components/dropdown/DropdownMenu.test.tsx +0 -211
- package/src/components/dropdown/DropdownMenu.tsx +0 -108
- package/src/components/dropdown/useDropdownMenu.ts +0 -249
- package/src/components/form/Input.stories.tsx +0 -435
- package/src/components/form/Input.test.tsx +0 -206
- package/src/components/form/Input.tsx +0 -23
- package/src/components/form/TextArea.stories.tsx +0 -464
- package/src/components/form/TextArea.test.tsx +0 -232
- package/src/components/form/TextArea.tsx +0 -23
- package/src/components/layout/footer/Footer.tsx +0 -26
- package/src/components/layout/footer/Licence.tsx +0 -19
- package/src/components/layout/header/Header.test.tsx +0 -36
- package/src/components/layout/header/Header.tsx +0 -90
- package/src/components/layout/header/HeaderAuthClient.test.tsx +0 -45
- package/src/components/layout/header/HeaderAuthClient.tsx +0 -40
- package/src/components/layout/header/HeaderNavClient.test.tsx +0 -44
- package/src/components/layout/header/HeaderNavClient.tsx +0 -67
- package/src/components/link/ExternalLink.test.tsx +0 -102
- package/src/components/link/ExternalLink.tsx +0 -29
- package/src/components/link/Link.tsx +0 -26
- package/src/components/select/Select.stories.tsx +0 -336
- package/src/components/select/Select.test.tsx +0 -474
- package/src/components/select/Select.tsx +0 -125
- package/src/components/select/SelectSkeleton.stories.tsx +0 -194
- package/src/components/select/SelectSkeleton.test.tsx +0 -104
- package/src/components/select/SelectSkeleton.tsx +0 -23
- package/src/components/select/common.ts +0 -3
- package/src/components/select/index.ts +0 -18
- package/src/components/skipLink/SkipLink.stories.tsx +0 -346
- package/src/components/skipLink/SkipLink.test.tsx +0 -22
- package/src/components/skipLink/SkipLink.tsx +0 -49
- package/src/map/LegendPanel.tsx +0 -85
- /package/src/{components → assets}/images/DefraLogo.tsx +0 -0
- /package/src/{components → assets}/images/EaLogo.tsx +0 -0
- /package/src/{components → assets}/images/OglLogo.tsx +0 -0
- /package/src/components/{googleAnalytics → GoogleAnalytics}/GlobalVars.tsx +0 -0
- /package/src/components/{googleAnalytics → GoogleAnalytics}/GoogleAnalytics.tsx +0 -0
|
@@ -1,73 +0,0 @@
|
|
|
1
|
-
'use client';
|
|
2
|
-
|
|
3
|
-
import { useRouter } from 'next/navigation';
|
|
4
|
-
import Script from 'next/script';
|
|
5
|
-
|
|
6
|
-
import { ExternalLink } from '@tpzdsp/next-toolkit/components';
|
|
7
|
-
|
|
8
|
-
const helpCookieUrl = 'https://environment.data.gov.uk/help/cookies';
|
|
9
|
-
|
|
10
|
-
export const CookieBanner = () => {
|
|
11
|
-
const router = useRouter();
|
|
12
|
-
|
|
13
|
-
const setPreferences = () => {
|
|
14
|
-
router.push(helpCookieUrl);
|
|
15
|
-
};
|
|
16
|
-
|
|
17
|
-
return (
|
|
18
|
-
<div id="cookie-banner" role="region" aria-label="cookie banner" style={{ display: 'none' }}>
|
|
19
|
-
<Script src="https://environment.data.gov.uk/shared/cookie-banner.js"></Script>
|
|
20
|
-
|
|
21
|
-
<div className="mx-auto max-w-[960px] p-[1rem]">
|
|
22
|
-
<h3 className="mb-4 text-base font-bold text-govukBlack">
|
|
23
|
-
Tell us whether you accept cookies
|
|
24
|
-
</h3>
|
|
25
|
-
|
|
26
|
-
<p className="mb-4 text-sm text-black">
|
|
27
|
-
We use essential cookies to give you the best online experience. Without them, this
|
|
28
|
-
service will not work.
|
|
29
|
-
</p>
|
|
30
|
-
|
|
31
|
-
<p className="mb-4 text-sm text-black">
|
|
32
|
-
We also use non-essential cookies to analyze site usage to continually improve the
|
|
33
|
-
services we provide you with.
|
|
34
|
-
</p>
|
|
35
|
-
|
|
36
|
-
<p className="mb-4 text-sm text-black">
|
|
37
|
-
Full details of cookies collected, and the functionality to change your cookie preference
|
|
38
|
-
at any time can be accessed on our{' '}
|
|
39
|
-
<ExternalLink href={helpCookieUrl}>Cookie Policy Page</ExternalLink>.
|
|
40
|
-
</p>
|
|
41
|
-
|
|
42
|
-
<div className="grid grid-cols-1 gap-4 md:grid-cols-[1fr_1fr_1fr]">
|
|
43
|
-
<div>
|
|
44
|
-
<button
|
|
45
|
-
className="focus:outline-3 relative box-border inline-block w-full cursor-pointer
|
|
46
|
-
appearance-none rounded-none border-2 border-transparent bg-green-500 px-[10px]
|
|
47
|
-
py-[7px] text-center align-top text-base font-normal leading-[19px] text-white
|
|
48
|
-
antialiased shadow-[0_2px_0_#002413] focus:bg-green-600 hover:bg-green-600
|
|
49
|
-
focus:outline focus:outline-offset-0 focus:outline-yellow-500"
|
|
50
|
-
id="accept-all-cookies"
|
|
51
|
-
type="submit"
|
|
52
|
-
>
|
|
53
|
-
Accept all cookies
|
|
54
|
-
</button>
|
|
55
|
-
</div>
|
|
56
|
-
|
|
57
|
-
<div>
|
|
58
|
-
<button
|
|
59
|
-
className="focus:outline-3 relative box-border inline-block w-full cursor-pointer
|
|
60
|
-
appearance-none rounded-none border-2 border-transparent bg-green-500 px-[10px]
|
|
61
|
-
py-[7px] text-center align-top text-base font-normal leading-[19px] text-white
|
|
62
|
-
antialiased shadow-[0_2px_0_#002413] focus:bg-green-600 hover:bg-green-600
|
|
63
|
-
focus:outline focus:outline-offset-0 focus:outline-yellow-500"
|
|
64
|
-
onClick={setPreferences}
|
|
65
|
-
>
|
|
66
|
-
Reject additional cookies
|
|
67
|
-
</button>
|
|
68
|
-
</div>
|
|
69
|
-
</div>
|
|
70
|
-
</div>
|
|
71
|
-
</div>
|
|
72
|
-
);
|
|
73
|
-
};
|
|
@@ -1,254 +0,0 @@
|
|
|
1
|
-
import type { Meta, StoryObj } from '@storybook/react-vite';
|
|
2
|
-
|
|
3
|
-
import { RuleDivider } from './RuleDivider';
|
|
4
|
-
|
|
5
|
-
const meta = {
|
|
6
|
-
title: 'Components/RuleDivider',
|
|
7
|
-
component: RuleDivider,
|
|
8
|
-
parameters: {
|
|
9
|
-
layout: 'centered',
|
|
10
|
-
},
|
|
11
|
-
tags: ['autodocs'],
|
|
12
|
-
} satisfies Meta<typeof RuleDivider>;
|
|
13
|
-
|
|
14
|
-
export default meta;
|
|
15
|
-
type Story = StoryObj<typeof meta>;
|
|
16
|
-
|
|
17
|
-
export const Default: Story = {
|
|
18
|
-
render: () => (
|
|
19
|
-
<div className="w-96">
|
|
20
|
-
<RuleDivider />
|
|
21
|
-
</div>
|
|
22
|
-
),
|
|
23
|
-
};
|
|
24
|
-
|
|
25
|
-
export const WithText: Story = {
|
|
26
|
-
render: () => (
|
|
27
|
-
<div className="w-96">
|
|
28
|
-
<RuleDivider>OR</RuleDivider>
|
|
29
|
-
</div>
|
|
30
|
-
),
|
|
31
|
-
};
|
|
32
|
-
|
|
33
|
-
export const WithLongerText: Story = {
|
|
34
|
-
render: () => (
|
|
35
|
-
<div className="w-96">
|
|
36
|
-
<RuleDivider>Continue Reading</RuleDivider>
|
|
37
|
-
</div>
|
|
38
|
-
),
|
|
39
|
-
};
|
|
40
|
-
export const WithIcon: Story = {
|
|
41
|
-
render: () => (
|
|
42
|
-
<div className="w-96">
|
|
43
|
-
<RuleDivider>
|
|
44
|
-
<svg
|
|
45
|
-
className="w-4 h-4"
|
|
46
|
-
fill="none"
|
|
47
|
-
stroke="currentColor"
|
|
48
|
-
viewBox="0 0 24 24"
|
|
49
|
-
xmlns="http://www.w3.org/2000/svg"
|
|
50
|
-
>
|
|
51
|
-
<path strokeLinecap="round" strokeLinejoin="round" strokeWidth={2} d="M12 4v16m8-8H4" />
|
|
52
|
-
</svg>
|
|
53
|
-
</RuleDivider>
|
|
54
|
-
</div>
|
|
55
|
-
),
|
|
56
|
-
};
|
|
57
|
-
|
|
58
|
-
export const WithStyledText: Story = {
|
|
59
|
-
render: () => (
|
|
60
|
-
<div className="w-96">
|
|
61
|
-
<RuleDivider>
|
|
62
|
-
<span className="text-sm text-gray-500 uppercase tracking-wide">Section Break</span>
|
|
63
|
-
</RuleDivider>
|
|
64
|
-
</div>
|
|
65
|
-
),
|
|
66
|
-
};
|
|
67
|
-
|
|
68
|
-
export const WithBoldText: Story = {
|
|
69
|
-
render: () => (
|
|
70
|
-
<div className="w-96">
|
|
71
|
-
<RuleDivider>
|
|
72
|
-
<strong className="text-gray-700">Important</strong>
|
|
73
|
-
</RuleDivider>
|
|
74
|
-
</div>
|
|
75
|
-
),
|
|
76
|
-
};
|
|
77
|
-
|
|
78
|
-
export const WithColoredText: Story = {
|
|
79
|
-
render: () => (
|
|
80
|
-
<div className="w-96">
|
|
81
|
-
<RuleDivider>
|
|
82
|
-
<span className="text-blue-600 font-medium">New Content</span>
|
|
83
|
-
</RuleDivider>
|
|
84
|
-
</div>
|
|
85
|
-
),
|
|
86
|
-
};
|
|
87
|
-
|
|
88
|
-
export const InContainer: Story = {
|
|
89
|
-
render: () => (
|
|
90
|
-
<div className="w-96 p-4 border rounded">
|
|
91
|
-
<p className="mb-4">This is some content above the divider.</p>
|
|
92
|
-
|
|
93
|
-
<RuleDivider>
|
|
94
|
-
<span className="text-gray-500">More below</span>
|
|
95
|
-
</RuleDivider>
|
|
96
|
-
|
|
97
|
-
<p className="mt-4">This is content below the divider.</p>
|
|
98
|
-
</div>
|
|
99
|
-
),
|
|
100
|
-
};
|
|
101
|
-
|
|
102
|
-
export const FormSeparator: Story = {
|
|
103
|
-
render: () => (
|
|
104
|
-
<div className="w-80 p-6 border rounded">
|
|
105
|
-
<div className="space-y-4">
|
|
106
|
-
<div>
|
|
107
|
-
<p className="block text-sm font-medium mb-1">Email</p>
|
|
108
|
-
|
|
109
|
-
<input
|
|
110
|
-
type="email"
|
|
111
|
-
className="w-full p-2 border border-gray-300 rounded"
|
|
112
|
-
placeholder="Enter your email"
|
|
113
|
-
/>
|
|
114
|
-
</div>
|
|
115
|
-
|
|
116
|
-
<div>
|
|
117
|
-
<p className="block text-sm font-medium mb-1">Password</p>
|
|
118
|
-
|
|
119
|
-
<input
|
|
120
|
-
type="password"
|
|
121
|
-
className="w-full p-2 border border-gray-300 rounded"
|
|
122
|
-
placeholder="Enter your password"
|
|
123
|
-
/>
|
|
124
|
-
</div>
|
|
125
|
-
</div>
|
|
126
|
-
|
|
127
|
-
<div className="my-6">
|
|
128
|
-
<RuleDivider>
|
|
129
|
-
<span className="text-xs text-gray-400 uppercase">OR</span>
|
|
130
|
-
</RuleDivider>
|
|
131
|
-
</div>
|
|
132
|
-
|
|
133
|
-
<button className="w-full py-2 px-4 bg-blue-500 text-white rounded hover:bg-blue-600">
|
|
134
|
-
Continue with Google
|
|
135
|
-
</button>
|
|
136
|
-
</div>
|
|
137
|
-
),
|
|
138
|
-
};
|
|
139
|
-
|
|
140
|
-
export const ContentSections: Story = {
|
|
141
|
-
render: () => (
|
|
142
|
-
<div className="max-w-2xl p-6 space-y-6">
|
|
143
|
-
<div>
|
|
144
|
-
<h2 className="text-xl font-bold mb-2">Introduction</h2>
|
|
145
|
-
|
|
146
|
-
<p className="text-gray-600">
|
|
147
|
-
This is the introduction section with some content that explains the topic.
|
|
148
|
-
</p>
|
|
149
|
-
</div>
|
|
150
|
-
|
|
151
|
-
<RuleDivider>
|
|
152
|
-
<span className="text-sm text-gray-500">Chapter 1</span>
|
|
153
|
-
</RuleDivider>
|
|
154
|
-
|
|
155
|
-
<div>
|
|
156
|
-
<h3 className="text-lg font-semibold mb-2">Getting Started</h3>
|
|
157
|
-
|
|
158
|
-
<p className="text-gray-600">
|
|
159
|
-
Here we dive into the first chapter with detailed explanations and examples.
|
|
160
|
-
</p>
|
|
161
|
-
</div>
|
|
162
|
-
|
|
163
|
-
<RuleDivider>
|
|
164
|
-
<span className="text-sm text-gray-500">Chapter 2</span>
|
|
165
|
-
</RuleDivider>
|
|
166
|
-
|
|
167
|
-
<div>
|
|
168
|
-
<h3 className="text-lg font-semibold mb-2">Advanced Topics</h3>
|
|
169
|
-
|
|
170
|
-
<p className="text-gray-600">This section covers more advanced concepts and use cases.</p>
|
|
171
|
-
</div>
|
|
172
|
-
</div>
|
|
173
|
-
),
|
|
174
|
-
};
|
|
175
|
-
|
|
176
|
-
export const MultipleInList: Story = {
|
|
177
|
-
render: () => (
|
|
178
|
-
<div className="w-80 space-y-4">
|
|
179
|
-
<RuleDivider />
|
|
180
|
-
|
|
181
|
-
<RuleDivider>
|
|
182
|
-
<span className="text-gray-600">Section A</span>
|
|
183
|
-
</RuleDivider>
|
|
184
|
-
|
|
185
|
-
<RuleDivider>
|
|
186
|
-
<span className="text-gray-600">Section B</span>
|
|
187
|
-
</RuleDivider>
|
|
188
|
-
|
|
189
|
-
<RuleDivider>
|
|
190
|
-
<span className="text-gray-600">Section C</span>
|
|
191
|
-
</RuleDivider>
|
|
192
|
-
|
|
193
|
-
<RuleDivider />
|
|
194
|
-
</div>
|
|
195
|
-
),
|
|
196
|
-
};
|
|
197
|
-
|
|
198
|
-
export const DifferentWidths: Story = {
|
|
199
|
-
render: () => (
|
|
200
|
-
<div className="space-y-6">
|
|
201
|
-
<div className="w-32">
|
|
202
|
-
<div className="text-sm mb-2">Small (w-32)</div>
|
|
203
|
-
|
|
204
|
-
<RuleDivider>
|
|
205
|
-
<span className="text-xs">OR</span>
|
|
206
|
-
</RuleDivider>
|
|
207
|
-
</div>
|
|
208
|
-
|
|
209
|
-
<div className="w-64">
|
|
210
|
-
<div className="text-sm mb-2">Medium (w-64)</div>
|
|
211
|
-
|
|
212
|
-
<RuleDivider>
|
|
213
|
-
<span className="text-sm">Continue</span>
|
|
214
|
-
</RuleDivider>
|
|
215
|
-
</div>
|
|
216
|
-
|
|
217
|
-
<div className="w-96">
|
|
218
|
-
<div className="text-sm mb-2">Large (w-96)</div>
|
|
219
|
-
|
|
220
|
-
<RuleDivider>
|
|
221
|
-
<span className="text-base">Section Divider</span>
|
|
222
|
-
</RuleDivider>
|
|
223
|
-
</div>
|
|
224
|
-
</div>
|
|
225
|
-
),
|
|
226
|
-
};
|
|
227
|
-
|
|
228
|
-
export const WithButton: Story = {
|
|
229
|
-
render: () => (
|
|
230
|
-
<RuleDivider>
|
|
231
|
-
<button className="px-3 py-1 text-xs bg-gray-100 text-gray-600 rounded hover:bg-gray-200">
|
|
232
|
-
Show More
|
|
233
|
-
</button>
|
|
234
|
-
</RuleDivider>
|
|
235
|
-
),
|
|
236
|
-
};
|
|
237
|
-
|
|
238
|
-
export const WithMultipleElements: Story = {
|
|
239
|
-
render: () => (
|
|
240
|
-
<RuleDivider>
|
|
241
|
-
<div className="flex items-center gap-2">
|
|
242
|
-
<svg className="w-3 h-3" fill="currentColor" viewBox="0 0 20 20">
|
|
243
|
-
<path
|
|
244
|
-
fillRule="evenodd"
|
|
245
|
-
d="M10 18a8 8 0 100-16 8 8 0 000 16zm3.707-9.293a1 1 0 00-1.414-1.414L9 10.586 7.707 9.293a1 1 0 00-1.414 1.414l2 2a1 1 0 001.414 0l4-4z"
|
|
246
|
-
clipRule="evenodd"
|
|
247
|
-
/>
|
|
248
|
-
</svg>
|
|
249
|
-
|
|
250
|
-
<span className="text-sm text-green-600">Completed</span>
|
|
251
|
-
</div>
|
|
252
|
-
</RuleDivider>
|
|
253
|
-
),
|
|
254
|
-
};
|
|
@@ -1,164 +0,0 @@
|
|
|
1
|
-
import { RuleDivider } from './RuleDivider';
|
|
2
|
-
import { render, screen } from '../../test/renderers';
|
|
3
|
-
|
|
4
|
-
describe('RuleDivider', () => {
|
|
5
|
-
it('should render with default props', () => {
|
|
6
|
-
const { container } = render(<RuleDivider />);
|
|
7
|
-
|
|
8
|
-
expect(container.firstChild).toBeInTheDocument();
|
|
9
|
-
});
|
|
10
|
-
|
|
11
|
-
it('should render single hr element when no children provided', () => {
|
|
12
|
-
const { container } = render(<RuleDivider />);
|
|
13
|
-
|
|
14
|
-
const hrElements = container.querySelectorAll('hr');
|
|
15
|
-
|
|
16
|
-
expect(hrElements).toHaveLength(1);
|
|
17
|
-
});
|
|
18
|
-
|
|
19
|
-
it('should have correct container classes', () => {
|
|
20
|
-
const { container } = render(<RuleDivider />);
|
|
21
|
-
|
|
22
|
-
const containerElement = container.firstChild as HTMLElement;
|
|
23
|
-
|
|
24
|
-
expect(containerElement).toHaveClass('flex', 'items-center');
|
|
25
|
-
});
|
|
26
|
-
|
|
27
|
-
it('should render with children', () => {
|
|
28
|
-
render(<RuleDivider>Divider Text</RuleDivider>);
|
|
29
|
-
|
|
30
|
-
expect(screen.getByText('Divider Text')).toBeInTheDocument();
|
|
31
|
-
});
|
|
32
|
-
|
|
33
|
-
it('should render two hr elements when children are provided', () => {
|
|
34
|
-
const { container } = render(<RuleDivider>With Text</RuleDivider>);
|
|
35
|
-
|
|
36
|
-
const hrElements = container.querySelectorAll('hr');
|
|
37
|
-
|
|
38
|
-
expect(hrElements).toHaveLength(2);
|
|
39
|
-
});
|
|
40
|
-
|
|
41
|
-
it('should apply correct classes to hr elements', () => {
|
|
42
|
-
const { container } = render(<RuleDivider />);
|
|
43
|
-
|
|
44
|
-
const hrElement = container.querySelector('hr');
|
|
45
|
-
|
|
46
|
-
expect(hrElement).toHaveClass('flex-grow');
|
|
47
|
-
});
|
|
48
|
-
|
|
49
|
-
it('should apply correct classes to span when children provided', () => {
|
|
50
|
-
const { container } = render(<RuleDivider>Test Content</RuleDivider>);
|
|
51
|
-
|
|
52
|
-
const spanElement = container.querySelector('span');
|
|
53
|
-
|
|
54
|
-
expect(spanElement).toHaveClass('px-2');
|
|
55
|
-
expect(spanElement).toHaveTextContent('Test Content');
|
|
56
|
-
});
|
|
57
|
-
|
|
58
|
-
it('should render complex children correctly', () => {
|
|
59
|
-
render(
|
|
60
|
-
<RuleDivider>
|
|
61
|
-
<strong>Bold Text</strong>
|
|
62
|
-
</RuleDivider>,
|
|
63
|
-
);
|
|
64
|
-
|
|
65
|
-
expect(screen.getByText('Bold Text')).toBeInTheDocument();
|
|
66
|
-
expect(screen.getByText('Bold Text').tagName).toBe('STRONG');
|
|
67
|
-
});
|
|
68
|
-
|
|
69
|
-
it('should handle multiple text nodes as children', () => {
|
|
70
|
-
render(<RuleDivider>Multiple words here</RuleDivider>);
|
|
71
|
-
|
|
72
|
-
expect(screen.getByText('Multiple words here')).toBeInTheDocument();
|
|
73
|
-
});
|
|
74
|
-
|
|
75
|
-
it('should render icon as children', () => {
|
|
76
|
-
const IconComponent = () => <svg data-testid="test-icon" />;
|
|
77
|
-
|
|
78
|
-
render(
|
|
79
|
-
<RuleDivider>
|
|
80
|
-
<IconComponent />
|
|
81
|
-
</RuleDivider>,
|
|
82
|
-
);
|
|
83
|
-
|
|
84
|
-
expect(screen.getByTestId('test-icon')).toBeInTheDocument();
|
|
85
|
-
});
|
|
86
|
-
|
|
87
|
-
it('should have proper structure when children provided', () => {
|
|
88
|
-
const { container } = render(<RuleDivider>Content</RuleDivider>);
|
|
89
|
-
|
|
90
|
-
const containerElement = container.firstChild as HTMLElement;
|
|
91
|
-
|
|
92
|
-
expect(containerElement.children).toHaveLength(3); // hr + span + hr
|
|
93
|
-
|
|
94
|
-
const [firstHr, span, secondHr] = containerElement.children;
|
|
95
|
-
|
|
96
|
-
expect(firstHr?.tagName).toBe('HR');
|
|
97
|
-
expect(span?.tagName).toBe('SPAN');
|
|
98
|
-
expect(secondHr?.tagName).toBe('HR');
|
|
99
|
-
});
|
|
100
|
-
|
|
101
|
-
it('should have proper structure when no children provided', () => {
|
|
102
|
-
const { container } = render(<RuleDivider />);
|
|
103
|
-
|
|
104
|
-
const containerElement = container.firstChild as HTMLElement;
|
|
105
|
-
|
|
106
|
-
expect(containerElement.children).toHaveLength(1); // only hr
|
|
107
|
-
|
|
108
|
-
const hrElement = containerElement.children[0];
|
|
109
|
-
|
|
110
|
-
expect(hrElement?.tagName).toBe('HR');
|
|
111
|
-
});
|
|
112
|
-
|
|
113
|
-
it('should handle empty string as children', () => {
|
|
114
|
-
const { container } = render(<RuleDivider>{''}</RuleDivider>);
|
|
115
|
-
|
|
116
|
-
// Empty string is falsy, so should behave like no children
|
|
117
|
-
const hrElements = container.querySelectorAll('hr');
|
|
118
|
-
|
|
119
|
-
expect(hrElements).toHaveLength(1);
|
|
120
|
-
|
|
121
|
-
const spanElement = container.querySelector('span');
|
|
122
|
-
|
|
123
|
-
expect(spanElement).not.toBeInTheDocument();
|
|
124
|
-
});
|
|
125
|
-
|
|
126
|
-
it('should handle null children correctly', () => {
|
|
127
|
-
const { container } = render(<RuleDivider>{null}</RuleDivider>);
|
|
128
|
-
|
|
129
|
-
// null should be considered falsy, so only one hr should render
|
|
130
|
-
const hrElements = container.querySelectorAll('hr');
|
|
131
|
-
|
|
132
|
-
expect(hrElements).toHaveLength(1);
|
|
133
|
-
|
|
134
|
-
const spanElement = container.querySelector('span');
|
|
135
|
-
|
|
136
|
-
expect(spanElement).not.toBeInTheDocument();
|
|
137
|
-
});
|
|
138
|
-
|
|
139
|
-
it('should handle undefined children correctly', () => {
|
|
140
|
-
const { container } = render(<RuleDivider>{undefined}</RuleDivider>);
|
|
141
|
-
|
|
142
|
-
// undefined should be considered falsy, so only one hr should render
|
|
143
|
-
const hrElements = container.querySelectorAll('hr');
|
|
144
|
-
|
|
145
|
-
expect(hrElements).toHaveLength(1);
|
|
146
|
-
|
|
147
|
-
const spanElement = container.querySelector('span');
|
|
148
|
-
|
|
149
|
-
expect(spanElement).not.toBeInTheDocument();
|
|
150
|
-
});
|
|
151
|
-
|
|
152
|
-
it('should render multiple child elements', () => {
|
|
153
|
-
render(
|
|
154
|
-
<RuleDivider>
|
|
155
|
-
<span>Text 1</span>
|
|
156
|
-
|
|
157
|
-
<span>Text 2</span>
|
|
158
|
-
</RuleDivider>,
|
|
159
|
-
);
|
|
160
|
-
|
|
161
|
-
expect(screen.getByText('Text 1')).toBeInTheDocument();
|
|
162
|
-
expect(screen.getByText('Text 2')).toBeInTheDocument();
|
|
163
|
-
});
|
|
164
|
-
});
|
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
import type { ExtendProps } from '../../types';
|
|
2
|
-
import { cn } from '../../utils';
|
|
3
|
-
|
|
4
|
-
type Props = {
|
|
5
|
-
children?: React.ReactNode;
|
|
6
|
-
};
|
|
7
|
-
|
|
8
|
-
export type RuleDividerProps = ExtendProps<'div', Props>;
|
|
9
|
-
|
|
10
|
-
export const RuleDivider = ({ children, className, ...props }: RuleDividerProps) => {
|
|
11
|
-
return (
|
|
12
|
-
<div className={cn('flex items-center', className)} {...props}>
|
|
13
|
-
<hr className="flex-grow" />
|
|
14
|
-
{children ? (
|
|
15
|
-
<>
|
|
16
|
-
<span className="px-2">{children}</span>
|
|
17
|
-
|
|
18
|
-
<hr className="flex-grow" />
|
|
19
|
-
</>
|
|
20
|
-
) : null}
|
|
21
|
-
</div>
|
|
22
|
-
);
|
|
23
|
-
};
|