@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
|
@@ -0,0 +1,203 @@
|
|
|
1
|
+
@layer components {
|
|
2
|
+
/* MARK: Provider
|
|
3
|
+
Flex shell. Horizontal (default) = row for left/right sidebars.
|
|
4
|
+
Vertical = column for top/bottom sidebars. Fills the height of whatever
|
|
5
|
+
it's placed in (not the viewport), so it works both as a full-page shell
|
|
6
|
+
and inside a container already constrained by a header/footer. Needs an
|
|
7
|
+
ancestor that actually establishes a height for this to have any effect,
|
|
8
|
+
the same requirement as any other height: 100% layout. */
|
|
9
|
+
.cn-sidebar-provider {
|
|
10
|
+
display: flex;
|
|
11
|
+
height: 100%;
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
.cn-sidebar-provider[data-orientation='vertical'] {
|
|
15
|
+
flex-direction: column;
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
/* MARK: Sidebar root
|
|
19
|
+
Flex child, the gap div inside drives the layout space. */
|
|
20
|
+
.cn-sidebar-root {
|
|
21
|
+
position: relative;
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
/* MARK: Gap div
|
|
25
|
+
In-flow placeholder. Horizontal sidebars animate width, vertical animate height. */
|
|
26
|
+
.cn-sidebar-gap {
|
|
27
|
+
flex-shrink: 0;
|
|
28
|
+
pointer-events: none;
|
|
29
|
+
width: var(--cn-sidebar-width, 16rem);
|
|
30
|
+
transition: width 0.2s ease;
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
[data-orientation='vertical'] .cn-sidebar-gap {
|
|
34
|
+
width: auto;
|
|
35
|
+
height: var(--cn-sidebar-height, 12rem);
|
|
36
|
+
transition: height 0.2s ease;
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
.cn-sidebar-root[data-state='collapsed'] .cn-sidebar-gap {
|
|
40
|
+
width: 0;
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
[data-orientation='vertical'] .cn-sidebar-root[data-state='collapsed'] .cn-sidebar-gap {
|
|
44
|
+
width: auto;
|
|
45
|
+
height: 0;
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
.cn-sidebar-root[data-variant='overlay'] .cn-sidebar-gap,
|
|
49
|
+
.cn-sidebar-root[data-mobile] .cn-sidebar-gap {
|
|
50
|
+
width: 0;
|
|
51
|
+
height: 0;
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
/* MARK: Panel
|
|
55
|
+
Absolutely positioned against cn-sidebar-root (position: relative above),
|
|
56
|
+
not the viewport, so the panel stretches to fill its container's height
|
|
57
|
+
rather than the full page. If the container happens to be full page
|
|
58
|
+
height already, this looks identical to position: fixed. Uses panel
|
|
59
|
+
background and border weight/colour. A container-query provider: this is
|
|
60
|
+
the actual available width for anything stacked inside a sidebar (Stack,
|
|
61
|
+
HeadingGroup, etc.), which is usually much narrower than the viewport, so
|
|
62
|
+
their spacing needs to key off this element's width, not the viewport's. */
|
|
63
|
+
.cn-sidebar {
|
|
64
|
+
position: absolute;
|
|
65
|
+
z-index: 20;
|
|
66
|
+
display: flex;
|
|
67
|
+
flex-direction: column;
|
|
68
|
+
overflow-y: auto;
|
|
69
|
+
background: var(--color-panel);
|
|
70
|
+
transition: transform 0.2s ease;
|
|
71
|
+
container-type: inline-size;
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
/* Left/right: full height, fixed width */
|
|
75
|
+
.cn-sidebar-root[data-side='left'] .cn-sidebar,
|
|
76
|
+
.cn-sidebar-root[data-side='right'] .cn-sidebar {
|
|
77
|
+
top: 0;
|
|
78
|
+
bottom: 0;
|
|
79
|
+
width: var(--cn-sidebar-width, 16rem);
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
.cn-sidebar-root[data-side='left'] .cn-sidebar {
|
|
83
|
+
left: 0;
|
|
84
|
+
border-right: var(--border-width-form) solid var(--color-panel-border);
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
.cn-sidebar-root[data-side='right'] .cn-sidebar {
|
|
88
|
+
right: 0;
|
|
89
|
+
border-left: var(--border-width-form) solid var(--color-panel-border);
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
.cn-sidebar-root[data-state='collapsed'][data-side='left'] .cn-sidebar {
|
|
93
|
+
transform: translateX(-100%);
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
.cn-sidebar-root[data-state='collapsed'][data-side='right'] .cn-sidebar {
|
|
97
|
+
transform: translateX(100%);
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
/* Top/bottom: full width, fixed height */
|
|
101
|
+
.cn-sidebar-root[data-side='top'] .cn-sidebar,
|
|
102
|
+
.cn-sidebar-root[data-side='bottom'] .cn-sidebar {
|
|
103
|
+
left: 0;
|
|
104
|
+
right: 0;
|
|
105
|
+
height: var(--cn-sidebar-height, 12rem);
|
|
106
|
+
overflow-x: auto;
|
|
107
|
+
overflow-y: hidden;
|
|
108
|
+
flex-direction: row;
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
.cn-sidebar-root[data-side='top'] .cn-sidebar {
|
|
112
|
+
top: 0;
|
|
113
|
+
border-bottom: var(--border-width-form) solid var(--color-panel-border);
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
.cn-sidebar-root[data-side='bottom'] .cn-sidebar {
|
|
117
|
+
bottom: 0;
|
|
118
|
+
border-top: var(--border-width-form) solid var(--color-panel-border);
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
.cn-sidebar-root[data-state='collapsed'][data-side='top'] .cn-sidebar {
|
|
122
|
+
transform: translateY(-100%);
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
.cn-sidebar-root[data-state='collapsed'][data-side='bottom'] .cn-sidebar {
|
|
126
|
+
transform: translateY(100%);
|
|
127
|
+
}
|
|
128
|
+
|
|
129
|
+
/* Mobile: full container */
|
|
130
|
+
.cn-sidebar-root[data-mobile] .cn-sidebar {
|
|
131
|
+
width: 100%;
|
|
132
|
+
height: 100%;
|
|
133
|
+
border: none;
|
|
134
|
+
}
|
|
135
|
+
|
|
136
|
+
.cn-sidebar-root[data-mobile][data-state='collapsed'] .cn-sidebar {
|
|
137
|
+
transform: translateX(-100%);
|
|
138
|
+
}
|
|
139
|
+
|
|
140
|
+
.cn-sidebar-root[data-mobile][data-state='collapsed'][data-side='right'] .cn-sidebar {
|
|
141
|
+
transform: translateX(100%);
|
|
142
|
+
}
|
|
143
|
+
|
|
144
|
+
/* MARK: Backdrop
|
|
145
|
+
Absolute (against cn-sidebar-root), same reasoning as the panel above:
|
|
146
|
+
it should only cover the sidebar's own container, not the full page. */
|
|
147
|
+
.cn-sidebar-backdrop {
|
|
148
|
+
position: absolute;
|
|
149
|
+
inset: 0;
|
|
150
|
+
z-index: 19;
|
|
151
|
+
background: rgb(0 0 0 / 50%);
|
|
152
|
+
}
|
|
153
|
+
|
|
154
|
+
/* MARK: Inset */
|
|
155
|
+
.cn-sidebar-inset {
|
|
156
|
+
flex: 1;
|
|
157
|
+
min-width: 0;
|
|
158
|
+
min-height: 0;
|
|
159
|
+
display: flex;
|
|
160
|
+
flex-direction: column;
|
|
161
|
+
}
|
|
162
|
+
|
|
163
|
+
/* MARK: Resizable sidebar (ResizableSidebar)
|
|
164
|
+
Used instead of cn-sidebar-root/cn-sidebar when the sidebar lives inside
|
|
165
|
+
a ResizablePanelGroup. No position/width rules here, ResizablePanel
|
|
166
|
+
already controls sizing, and the ResizableHandle is the visual divider
|
|
167
|
+
(so no border, unlike cn-sidebar). Height comes for free: this class
|
|
168
|
+
lands on ResizablePanel's own inner content div, which the library
|
|
169
|
+
already stretches to fill the panel via flexbox, the same mechanism
|
|
170
|
+
cn-sidebar-root relies on above. Same container-query provider reasoning
|
|
171
|
+
as cn-sidebar: its width is whatever the user has resized the panel to,
|
|
172
|
+
not the viewport. */
|
|
173
|
+
.cn-resizable-sidebar {
|
|
174
|
+
@apply flex flex-col overflow-y-auto @container;
|
|
175
|
+
background: var(--color-panel);
|
|
176
|
+
}
|
|
177
|
+
|
|
178
|
+
/* MARK: Resizable sidebar open/close (deliberately no transition)
|
|
179
|
+
react-resizable-panels sizes a panel via an inline flex-grow number (not
|
|
180
|
+
width or flex-basis), so animating it (as tried previously, via a
|
|
181
|
+
[data-panel]:has(> .cn-resizable-sidebar) transition) genuinely resizes
|
|
182
|
+
the panel's box on every frame, which squishes/reflows the header,
|
|
183
|
+
content and footer inside it for the whole 200ms, unlike cn-sidebar's
|
|
184
|
+
own translateX transform (same width throughout, just slides off
|
|
185
|
+
screen). A min-width workaround doesn't hold up either: expand()
|
|
186
|
+
restores whatever size the user last dragged to, not a fixed value CSS
|
|
187
|
+
could pin to, and permanently pinning one would fight the user's own
|
|
188
|
+
drag-resized width at rest. Snapping open/closed instantly avoids the
|
|
189
|
+
squish entirely. */
|
|
190
|
+
|
|
191
|
+
/* MARK: Structure */
|
|
192
|
+
.cn-sidebar-header {
|
|
193
|
+
@apply p-gds-2 flex items-center gap-gds-2 shrink-0;
|
|
194
|
+
}
|
|
195
|
+
|
|
196
|
+
.cn-sidebar-content {
|
|
197
|
+
@apply flex-1 overflow-y-auto;
|
|
198
|
+
}
|
|
199
|
+
|
|
200
|
+
.cn-sidebar-footer {
|
|
201
|
+
@apply p-gds-2 shrink-0;
|
|
202
|
+
}
|
|
203
|
+
}
|
|
@@ -0,0 +1,438 @@
|
|
|
1
|
+
import { LuPanelLeft } from 'react-icons/lu';
|
|
2
|
+
|
|
3
|
+
import type { Meta, StoryObj } from '@storybook/react-vite';
|
|
4
|
+
|
|
5
|
+
import { ResizableSidebar, ResizableSidebarHandle } from './ResizableSidebar';
|
|
6
|
+
import {
|
|
7
|
+
Sidebar,
|
|
8
|
+
SidebarClose,
|
|
9
|
+
SidebarContent,
|
|
10
|
+
SidebarFooter,
|
|
11
|
+
SidebarHeader,
|
|
12
|
+
SidebarInset,
|
|
13
|
+
SidebarProvider,
|
|
14
|
+
useSidebar,
|
|
15
|
+
} from './Sidebar';
|
|
16
|
+
import {
|
|
17
|
+
Accordion,
|
|
18
|
+
AccordionContent,
|
|
19
|
+
AccordionItem,
|
|
20
|
+
AccordionTrigger,
|
|
21
|
+
} from '../Accordion/Accordion';
|
|
22
|
+
import { Button } from '../Button/Button';
|
|
23
|
+
import { ResizablePanel, ResizablePanelGroup } from '../Resizable/Resizable';
|
|
24
|
+
import { Tabs, TabsContent, TabsList, TabsTrigger } from '../Tabs/Tabs';
|
|
25
|
+
|
|
26
|
+
const meta: Meta<typeof Sidebar> = {
|
|
27
|
+
title: 'Components/Sidebar',
|
|
28
|
+
component: Sidebar,
|
|
29
|
+
parameters: { layout: 'fullscreen' },
|
|
30
|
+
};
|
|
31
|
+
|
|
32
|
+
export default meta;
|
|
33
|
+
type Story = StoryObj<typeof Sidebar>;
|
|
34
|
+
|
|
35
|
+
const SidebarTrigger = () => {
|
|
36
|
+
const { toggleSidebar, open } = useSidebar();
|
|
37
|
+
|
|
38
|
+
return (
|
|
39
|
+
<Button
|
|
40
|
+
appearance="ghost"
|
|
41
|
+
onClick={toggleSidebar}
|
|
42
|
+
aria-expanded={open}
|
|
43
|
+
aria-label={open ? 'Close sidebar' : 'Open sidebar'}
|
|
44
|
+
>
|
|
45
|
+
<LuPanelLeft aria-hidden />
|
|
46
|
+
</Button>
|
|
47
|
+
);
|
|
48
|
+
};
|
|
49
|
+
|
|
50
|
+
const SampleContent = () => (
|
|
51
|
+
<Accordion type="multiple">
|
|
52
|
+
<AccordionItem value="layers">
|
|
53
|
+
<AccordionTrigger>Layers</AccordionTrigger>
|
|
54
|
+
|
|
55
|
+
<AccordionContent>Toggle individual map layers here.</AccordionContent>
|
|
56
|
+
</AccordionItem>
|
|
57
|
+
|
|
58
|
+
<AccordionItem value="filters">
|
|
59
|
+
<AccordionTrigger>Filters</AccordionTrigger>
|
|
60
|
+
|
|
61
|
+
<AccordionContent>Apply filters to narrow the displayed data.</AccordionContent>
|
|
62
|
+
</AccordionItem>
|
|
63
|
+
|
|
64
|
+
<AccordionItem value="legend">
|
|
65
|
+
<AccordionTrigger>Legend</AccordionTrigger>
|
|
66
|
+
|
|
67
|
+
<AccordionContent>Colour scale and symbol reference.</AccordionContent>
|
|
68
|
+
</AccordionItem>
|
|
69
|
+
</Accordion>
|
|
70
|
+
);
|
|
71
|
+
|
|
72
|
+
export const Push: Story = {
|
|
73
|
+
render: () => (
|
|
74
|
+
<div className="h-screen">
|
|
75
|
+
<SidebarProvider>
|
|
76
|
+
<Sidebar>
|
|
77
|
+
<SidebarHeader>
|
|
78
|
+
<strong className="text-body text-base flex-1">Filters</strong>
|
|
79
|
+
|
|
80
|
+
<SidebarClose />
|
|
81
|
+
</SidebarHeader>
|
|
82
|
+
|
|
83
|
+
<SidebarContent>
|
|
84
|
+
<SampleContent />
|
|
85
|
+
</SidebarContent>
|
|
86
|
+
|
|
87
|
+
<SidebarFooter>
|
|
88
|
+
<Button appearance="secondary" className="w-full">
|
|
89
|
+
Clear all
|
|
90
|
+
</Button>
|
|
91
|
+
</SidebarFooter>
|
|
92
|
+
</Sidebar>
|
|
93
|
+
|
|
94
|
+
<SidebarInset>
|
|
95
|
+
<header className="flex items-center gap-gds-2 p-gds-2 border-b border-divider">
|
|
96
|
+
<SidebarTrigger />
|
|
97
|
+
|
|
98
|
+
<h1 className="text-base font-bold text-body">Map view</h1>
|
|
99
|
+
</header>
|
|
100
|
+
|
|
101
|
+
<div className="p-gds-4 text-body">
|
|
102
|
+
<p>
|
|
103
|
+
Main content area. With <code>variant="push"</code> (default) the page
|
|
104
|
+
content shifts as the sidebar opens and closes.
|
|
105
|
+
</p>
|
|
106
|
+
</div>
|
|
107
|
+
</SidebarInset>
|
|
108
|
+
</SidebarProvider>
|
|
109
|
+
</div>
|
|
110
|
+
),
|
|
111
|
+
};
|
|
112
|
+
|
|
113
|
+
export const WithinConstrainedContainer: Story = {
|
|
114
|
+
parameters: {
|
|
115
|
+
docs: {
|
|
116
|
+
description: {
|
|
117
|
+
story:
|
|
118
|
+
'The sidebar fills the height of its own container, not the page. Here the outer shell has a fixed-height header and footer, and the sidebar only spans the inner area between them, rather than covering the whole viewport.',
|
|
119
|
+
},
|
|
120
|
+
},
|
|
121
|
+
},
|
|
122
|
+
render: () => (
|
|
123
|
+
<div className="flex h-screen flex-col">
|
|
124
|
+
<header
|
|
125
|
+
className="flex shrink-0 items-center gap-gds-2 p-gds-2 bg-panel border-b border-divider"
|
|
126
|
+
>
|
|
127
|
+
<h1 className="text-base font-bold text-body">App header</h1>
|
|
128
|
+
</header>
|
|
129
|
+
|
|
130
|
+
<div className="min-h-0 flex-1">
|
|
131
|
+
<SidebarProvider>
|
|
132
|
+
<Sidebar>
|
|
133
|
+
<SidebarHeader>
|
|
134
|
+
<strong className="text-body text-base flex-1">Filters</strong>
|
|
135
|
+
|
|
136
|
+
<SidebarClose />
|
|
137
|
+
</SidebarHeader>
|
|
138
|
+
|
|
139
|
+
<SidebarContent>
|
|
140
|
+
<SampleContent />
|
|
141
|
+
</SidebarContent>
|
|
142
|
+
</Sidebar>
|
|
143
|
+
|
|
144
|
+
<SidebarInset>
|
|
145
|
+
<header className="flex items-center gap-gds-2 p-gds-2 border-b border-divider">
|
|
146
|
+
<SidebarTrigger />
|
|
147
|
+
|
|
148
|
+
<h1 className="text-base font-bold text-body">Map view</h1>
|
|
149
|
+
</header>
|
|
150
|
+
|
|
151
|
+
<div className="p-gds-4 text-body">
|
|
152
|
+
<p>The sidebar panel stops above the footer instead of covering it.</p>
|
|
153
|
+
</div>
|
|
154
|
+
</SidebarInset>
|
|
155
|
+
</SidebarProvider>
|
|
156
|
+
</div>
|
|
157
|
+
|
|
158
|
+
<footer
|
|
159
|
+
className="flex shrink-0 items-center gap-gds-2 p-gds-2 bg-panel border-t border-divider"
|
|
160
|
+
>
|
|
161
|
+
<p className="text-body text-sm">App footer</p>
|
|
162
|
+
</footer>
|
|
163
|
+
</div>
|
|
164
|
+
),
|
|
165
|
+
};
|
|
166
|
+
|
|
167
|
+
export const WithFixedHeader: Story = {
|
|
168
|
+
parameters: {
|
|
169
|
+
docs: {
|
|
170
|
+
description: {
|
|
171
|
+
story:
|
|
172
|
+
'Put the trigger in an app-level header that never moves, instead of inside SidebarInset where it shifts or gets overlaid with the rest of the content. Override SidebarProvider to stack vertically with className="flex-col" (it\'s a flex row by default), put the header first, then wrap Sidebar and SidebarInset in a plain flex row div as the second child. The header stays put; only that row pushes or overlays.',
|
|
173
|
+
},
|
|
174
|
+
},
|
|
175
|
+
},
|
|
176
|
+
render: () => (
|
|
177
|
+
<div className="h-screen">
|
|
178
|
+
<SidebarProvider className="flex-col">
|
|
179
|
+
<header className="flex shrink-0 items-center gap-gds-2 p-gds-2 border-b border-divider">
|
|
180
|
+
<SidebarTrigger />
|
|
181
|
+
|
|
182
|
+
<h1 className="text-base font-bold text-body">App header</h1>
|
|
183
|
+
</header>
|
|
184
|
+
|
|
185
|
+
<div className="flex flex-1 min-h-0">
|
|
186
|
+
<Sidebar>
|
|
187
|
+
<SidebarHeader>
|
|
188
|
+
<strong className="text-body text-base flex-1">Filters</strong>
|
|
189
|
+
|
|
190
|
+
<SidebarClose />
|
|
191
|
+
</SidebarHeader>
|
|
192
|
+
|
|
193
|
+
<SidebarContent>
|
|
194
|
+
<SampleContent />
|
|
195
|
+
</SidebarContent>
|
|
196
|
+
</Sidebar>
|
|
197
|
+
|
|
198
|
+
<SidebarInset>
|
|
199
|
+
<div className="p-gds-4 text-body">
|
|
200
|
+
<p>The header above stays fixed. Only this content area shifts or is overlaid.</p>
|
|
201
|
+
</div>
|
|
202
|
+
</SidebarInset>
|
|
203
|
+
</div>
|
|
204
|
+
</SidebarProvider>
|
|
205
|
+
</div>
|
|
206
|
+
),
|
|
207
|
+
};
|
|
208
|
+
|
|
209
|
+
export const Resizable: Story = {
|
|
210
|
+
parameters: {
|
|
211
|
+
docs: {
|
|
212
|
+
description: {
|
|
213
|
+
story:
|
|
214
|
+
'Use ResizableSidebar instead of Sidebar to make the panel drag-resizable, by placing it inside a ResizablePanelGroup alongside a ResizableSidebarHandle and a plain ResizablePanel for the content. ResizableSidebar still reads open state from the same useSidebar() context as the trigger button, so opening and closing both work exactly as before: the drag handle just also lets the user resize it while open, and it snaps back to its previous size the next time it opens. ResizableSidebarHandle disables itself while closed, dragging or arrow-keying a fully collapsed panel back open is not reliable in the underlying library, so reopening goes through the trigger instead.',
|
|
215
|
+
},
|
|
216
|
+
},
|
|
217
|
+
},
|
|
218
|
+
render: () => (
|
|
219
|
+
<div className="h-screen">
|
|
220
|
+
<Tabs defaultValue="overview" className="flex h-full flex-col">
|
|
221
|
+
<SidebarProvider className="flex-col">
|
|
222
|
+
<div className="flex shrink-0 items-center gap-gds-2 p-gds-2 border-b border-divider">
|
|
223
|
+
<SidebarTrigger />
|
|
224
|
+
|
|
225
|
+
<TabsList>
|
|
226
|
+
<TabsTrigger value="overview">Overview</TabsTrigger>
|
|
227
|
+
|
|
228
|
+
<TabsTrigger value="details">Details</TabsTrigger>
|
|
229
|
+
|
|
230
|
+
<TabsTrigger value="history">History</TabsTrigger>
|
|
231
|
+
</TabsList>
|
|
232
|
+
</div>
|
|
233
|
+
|
|
234
|
+
<ResizablePanelGroup className="flex flex-1 min-h-0">
|
|
235
|
+
<ResizableSidebar>
|
|
236
|
+
<SidebarHeader>
|
|
237
|
+
<strong className="text-body text-base flex-1">Filters</strong>
|
|
238
|
+
</SidebarHeader>
|
|
239
|
+
|
|
240
|
+
<SidebarContent>
|
|
241
|
+
<SampleContent />
|
|
242
|
+
</SidebarContent>
|
|
243
|
+
</ResizableSidebar>
|
|
244
|
+
|
|
245
|
+
<ResizableSidebarHandle withHandle />
|
|
246
|
+
|
|
247
|
+
<ResizablePanel>
|
|
248
|
+
<SidebarInset>
|
|
249
|
+
<TabsContent value="overview">
|
|
250
|
+
<p className="p-gds-4 text-body">Overview tab content.</p>
|
|
251
|
+
</TabsContent>
|
|
252
|
+
|
|
253
|
+
<TabsContent value="details">
|
|
254
|
+
<p className="p-gds-4 text-body">Details tab content.</p>
|
|
255
|
+
</TabsContent>
|
|
256
|
+
|
|
257
|
+
<TabsContent value="history">
|
|
258
|
+
<p className="p-gds-4 text-body">History tab content.</p>
|
|
259
|
+
</TabsContent>
|
|
260
|
+
</SidebarInset>
|
|
261
|
+
</ResizablePanel>
|
|
262
|
+
</ResizablePanelGroup>
|
|
263
|
+
</SidebarProvider>
|
|
264
|
+
</Tabs>
|
|
265
|
+
</div>
|
|
266
|
+
),
|
|
267
|
+
};
|
|
268
|
+
|
|
269
|
+
export const Overlay: Story = {
|
|
270
|
+
render: () => (
|
|
271
|
+
<div className="h-screen">
|
|
272
|
+
<SidebarProvider>
|
|
273
|
+
<Sidebar variant="overlay">
|
|
274
|
+
<SidebarHeader>
|
|
275
|
+
<strong className="text-body text-base flex-1">Filters</strong>
|
|
276
|
+
|
|
277
|
+
<SidebarClose />
|
|
278
|
+
</SidebarHeader>
|
|
279
|
+
|
|
280
|
+
<SidebarContent>
|
|
281
|
+
<SampleContent />
|
|
282
|
+
</SidebarContent>
|
|
283
|
+
</Sidebar>
|
|
284
|
+
|
|
285
|
+
<SidebarInset>
|
|
286
|
+
<header className="flex items-center gap-gds-2 p-gds-2 border-b border-divider">
|
|
287
|
+
<SidebarTrigger />
|
|
288
|
+
|
|
289
|
+
<h1 className="text-base font-bold text-body">Map view</h1>
|
|
290
|
+
</header>
|
|
291
|
+
|
|
292
|
+
<div className="p-gds-4 text-body">
|
|
293
|
+
<p>
|
|
294
|
+
With <code>variant="overlay"</code> the sidebar floats above the content.
|
|
295
|
+
Click the X or the backdrop to close.
|
|
296
|
+
</p>
|
|
297
|
+
</div>
|
|
298
|
+
</SidebarInset>
|
|
299
|
+
</SidebarProvider>
|
|
300
|
+
</div>
|
|
301
|
+
),
|
|
302
|
+
};
|
|
303
|
+
|
|
304
|
+
export const RightSide: Story = {
|
|
305
|
+
render: () => (
|
|
306
|
+
<div className="h-screen">
|
|
307
|
+
<SidebarProvider>
|
|
308
|
+
<SidebarInset>
|
|
309
|
+
<header className="flex items-center gap-gds-2 p-gds-2 border-b border-divider">
|
|
310
|
+
<h1 className="text-base font-bold text-body flex-1">Map view</h1>
|
|
311
|
+
|
|
312
|
+
<SidebarTrigger />
|
|
313
|
+
</header>
|
|
314
|
+
|
|
315
|
+
<div className="p-gds-4 text-body">
|
|
316
|
+
<p>Sidebar anchored to the right.</p>
|
|
317
|
+
</div>
|
|
318
|
+
</SidebarInset>
|
|
319
|
+
|
|
320
|
+
<Sidebar side="right">
|
|
321
|
+
<SidebarHeader>
|
|
322
|
+
<strong className="text-body text-base flex-1">Details</strong>
|
|
323
|
+
|
|
324
|
+
<SidebarClose />
|
|
325
|
+
</SidebarHeader>
|
|
326
|
+
|
|
327
|
+
<SidebarContent>
|
|
328
|
+
<SampleContent />
|
|
329
|
+
</SidebarContent>
|
|
330
|
+
</Sidebar>
|
|
331
|
+
</SidebarProvider>
|
|
332
|
+
</div>
|
|
333
|
+
),
|
|
334
|
+
};
|
|
335
|
+
|
|
336
|
+
export const DefaultClosed: Story = {
|
|
337
|
+
render: () => (
|
|
338
|
+
<div className="h-screen">
|
|
339
|
+
<SidebarProvider defaultOpen={false}>
|
|
340
|
+
<Sidebar>
|
|
341
|
+
<SidebarHeader>
|
|
342
|
+
<strong className="text-body text-base flex-1">Filters</strong>
|
|
343
|
+
|
|
344
|
+
<SidebarClose />
|
|
345
|
+
</SidebarHeader>
|
|
346
|
+
|
|
347
|
+
<SidebarContent>
|
|
348
|
+
<SampleContent />
|
|
349
|
+
</SidebarContent>
|
|
350
|
+
</Sidebar>
|
|
351
|
+
|
|
352
|
+
<SidebarInset>
|
|
353
|
+
<header className="flex items-center gap-gds-2 p-gds-2 border-b border-divider">
|
|
354
|
+
<SidebarTrigger />
|
|
355
|
+
|
|
356
|
+
<h1 className="text-base font-bold text-body">Starts closed</h1>
|
|
357
|
+
</header>
|
|
358
|
+
|
|
359
|
+
<div className="p-gds-4 text-body">Toggle the sidebar with the button in the header.</div>
|
|
360
|
+
</SidebarInset>
|
|
361
|
+
</SidebarProvider>
|
|
362
|
+
</div>
|
|
363
|
+
),
|
|
364
|
+
};
|
|
365
|
+
|
|
366
|
+
export const TopDrawer: Story = {
|
|
367
|
+
render: () => (
|
|
368
|
+
<div className="h-screen">
|
|
369
|
+
<SidebarProvider orientation="vertical" height="10rem">
|
|
370
|
+
<Sidebar side="top">
|
|
371
|
+
<SidebarHeader>
|
|
372
|
+
<strong className="text-body text-base flex-1">Top drawer</strong>
|
|
373
|
+
|
|
374
|
+
<SidebarClose />
|
|
375
|
+
</SidebarHeader>
|
|
376
|
+
|
|
377
|
+
<SidebarContent className="flex-row p-gds-2 gap-gds-4">
|
|
378
|
+
<p className="text-body text-sm">Drawer content goes here — filters, controls, etc.</p>
|
|
379
|
+
</SidebarContent>
|
|
380
|
+
</Sidebar>
|
|
381
|
+
|
|
382
|
+
<SidebarInset>
|
|
383
|
+
<header className="flex items-center gap-gds-2 p-gds-2 border-b border-divider">
|
|
384
|
+
<SidebarTrigger />
|
|
385
|
+
|
|
386
|
+
<h1 className="text-base font-bold text-body">Map view</h1>
|
|
387
|
+
</header>
|
|
388
|
+
|
|
389
|
+
<div className="p-gds-4 text-body">
|
|
390
|
+
<p>
|
|
391
|
+
Set <code>side="top"</code> on the Sidebar.
|
|
392
|
+
</p>
|
|
393
|
+
|
|
394
|
+
<p>
|
|
395
|
+
Pass <code>orientation="vertical"</code> to the provider so the gap div
|
|
396
|
+
animates height as the drawer opens.
|
|
397
|
+
</p>
|
|
398
|
+
</div>
|
|
399
|
+
</SidebarInset>
|
|
400
|
+
</SidebarProvider>
|
|
401
|
+
</div>
|
|
402
|
+
),
|
|
403
|
+
};
|
|
404
|
+
|
|
405
|
+
export const BottomDrawer: Story = {
|
|
406
|
+
render: () => (
|
|
407
|
+
<div className="h-screen">
|
|
408
|
+
<SidebarProvider orientation="vertical" height="10rem">
|
|
409
|
+
<SidebarInset>
|
|
410
|
+
<header className="flex items-center gap-gds-2 p-gds-2 border-b border-divider">
|
|
411
|
+
<SidebarTrigger />
|
|
412
|
+
|
|
413
|
+
<h1 className="text-base font-bold text-body">Map view</h1>
|
|
414
|
+
</header>
|
|
415
|
+
|
|
416
|
+
<div className="p-gds-4 text-body">
|
|
417
|
+
<p>
|
|
418
|
+
<code>side="bottom"</code> — drawer slides up from the bottom of the
|
|
419
|
+
viewport.
|
|
420
|
+
</p>
|
|
421
|
+
</div>
|
|
422
|
+
</SidebarInset>
|
|
423
|
+
|
|
424
|
+
<Sidebar side="bottom">
|
|
425
|
+
<SidebarHeader>
|
|
426
|
+
<strong className="text-body text-base flex-1">Bottom drawer</strong>
|
|
427
|
+
|
|
428
|
+
<SidebarClose />
|
|
429
|
+
</SidebarHeader>
|
|
430
|
+
|
|
431
|
+
<SidebarContent className="p-gds-2">
|
|
432
|
+
<p className="text-body text-sm">Drawer content.</p>
|
|
433
|
+
</SidebarContent>
|
|
434
|
+
</Sidebar>
|
|
435
|
+
</SidebarProvider>
|
|
436
|
+
</div>
|
|
437
|
+
),
|
|
438
|
+
};
|