@navikt/ds-react 0.7.4 → 0.8.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/cjs/accordion/Accordion.js +10 -26
- package/cjs/accordion/AccordionContent.js +60 -0
- package/cjs/accordion/AccordionHeader.js +66 -0
- package/cjs/accordion/AccordionItem.js +62 -0
- package/cjs/accordion/index.js +6 -2
- package/cjs/accordion-menu/AccordionMenu.js +5 -1
- package/cjs/accordion-menu/AccordionMenuCollapsable.js +3 -3
- package/cjs/accordion-menu/AccordionMenuItem.js +4 -4
- package/cjs/accordion-menu/index.js +5 -5
- package/cjs/alert/Alert.js +18 -12
- package/cjs/alert/AlertContent.js +50 -0
- package/cjs/alert/AlertTitle.js +49 -0
- package/cjs/alert/index.js +6 -2
- package/cjs/button/Button.js +5 -3
- package/cjs/button/index.js +6 -2
- package/cjs/card/MicroCard.js +3 -3
- package/cjs/card/index.js +6 -2
- package/cjs/copy-to-clipboard/CopyToClipboard.js +9 -8
- package/cjs/copy-to-clipboard/index.js +6 -2
- package/cjs/form/ConfirmationPanel.js +2 -2
- package/cjs/form/ErrorMessage.js +1 -1
- package/cjs/form/Fieldset/Fieldset.js +2 -2
- package/cjs/form/Fieldset/index.js +5 -1
- package/cjs/form/Fieldset/useFieldset.js +2 -1
- package/cjs/form/Select.js +3 -3
- package/cjs/form/TextField.js +2 -2
- package/cjs/form/Textarea.js +5 -4
- package/cjs/form/checkbox/Checkbox.js +2 -2
- package/cjs/form/checkbox/CheckboxGroup.js +2 -2
- package/cjs/form/checkbox/index.js +6 -2
- package/cjs/form/checkbox/useCheckbox.js +2 -1
- package/cjs/form/error-summary/ErrorSummary.js +4 -4
- package/cjs/form/error-summary/ErrorSummaryItem.js +2 -2
- package/cjs/form/error-summary/index.js +6 -2
- package/cjs/form/index.js +9 -5
- package/cjs/form/radio/Radio.js +2 -2
- package/cjs/form/radio/RadioGroup.js +2 -2
- package/cjs/form/radio/index.js +6 -2
- package/cjs/form/radio/useRadio.js +2 -1
- package/cjs/form/search-field/SearchField.js +3 -3
- package/cjs/form/search-field/SearchFieldButton.js +2 -2
- package/cjs/form/search-field/SearchFieldClearButton.js +3 -3
- package/cjs/form/search-field/SearchFieldInput.js +2 -2
- package/cjs/form/search-field/index.js +8 -4
- package/cjs/form/useFormField.js +3 -2
- package/cjs/grid/Cell.js +2 -2
- package/cjs/{content-container → grid}/ContentContainer.js +3 -3
- package/cjs/grid/Grid.js +1 -1
- package/cjs/grid/index.js +10 -3
- package/cjs/{layouts/product-page/ProductPageSection.js → guide-panel/Guide.js} +7 -5
- package/cjs/guide-panel/GuidePanel.js +47 -0
- package/cjs/guide-panel/Illustration.js +24 -0
- package/cjs/guide-panel/index.js +19 -0
- package/cjs/guide-panel/package.json +6 -0
- package/cjs/help-text/HelpText.js +64 -0
- package/cjs/help-text/index.js +19 -0
- package/cjs/help-text/package.json +6 -0
- package/cjs/index.js +6 -6
- package/cjs/internal-header/InternalHeader.js +1 -1
- package/cjs/internal-header/InternalHeaderTitle.js +1 -1
- package/cjs/internal-header/InternalHeaderUser.js +1 -1
- package/cjs/internal-header/index.js +8 -4
- package/cjs/link/Link.js +3 -3
- package/cjs/link/index.js +6 -2
- package/cjs/link-panel/LinkPanel.js +10 -10
- package/cjs/link-panel/LinkPanelDescription.js +43 -0
- package/cjs/link-panel/LinkPanelTitle.js +42 -0
- package/cjs/link-panel/index.js +6 -2
- package/cjs/loader/Loader.js +4 -7
- package/cjs/loader/index.js +6 -2
- package/cjs/modal/Modal.js +6 -4
- package/cjs/{accordion-anchor-menu/AccordionAnchorMenu.js → modal/ModalContent.js} +5 -11
- package/cjs/modal/index.js +6 -2
- package/cjs/{header/Header.js → page-header/PageHeader.js} +10 -9
- package/cjs/page-header/index.js +19 -0
- package/cjs/page-header/package.json +6 -0
- package/cjs/panel/Panel.js +2 -2
- package/cjs/panel/index.js +6 -2
- package/cjs/popover/Popover.js +13 -4
- package/cjs/popover/PopoverContent.js +42 -0
- package/cjs/popover/index.js +6 -2
- package/cjs/speech-bubble/Bubble.js +1 -1
- package/cjs/speech-bubble/SpeechBubble.js +1 -1
- package/cjs/speech-bubble/index.js +7 -3
- package/cjs/tag/Tag.js +5 -3
- package/cjs/tag/index.js +6 -2
- package/cjs/typography/BodyLong.js +3 -3
- package/cjs/typography/BodyShort.js +3 -3
- package/cjs/typography/Detail.js +3 -3
- package/cjs/typography/{Title.js → Heading.js} +8 -8
- package/cjs/typography/Ingress.js +2 -2
- package/cjs/typography/Label.js +3 -3
- package/cjs/typography/index.js +11 -7
- package/cjs/util/index.js +3 -2
- package/cjs/util/useId.js +5 -4
- package/esm/accordion/Accordion.d.ts +11 -22
- package/esm/accordion/Accordion.js +9 -25
- package/esm/accordion/Accordion.js.map +1 -1
- package/esm/accordion/AccordionContent.d.ts +10 -0
- package/esm/accordion/AccordionContent.js +37 -0
- package/esm/accordion/AccordionContent.js.map +1 -0
- package/esm/accordion/AccordionHeader.d.ts +10 -0
- package/esm/accordion/AccordionHeader.js +43 -0
- package/esm/accordion/AccordionHeader.js.map +1 -0
- package/esm/accordion/AccordionItem.d.ts +35 -0
- package/esm/accordion/AccordionItem.js +38 -0
- package/esm/accordion/AccordionItem.js.map +1 -0
- package/esm/accordion-menu/AccordionMenu.d.ts +9 -3
- package/esm/accordion-menu/AccordionMenu.js +4 -0
- package/esm/accordion-menu/AccordionMenu.js.map +1 -1
- package/esm/accordion-menu/AccordionMenuCollapsable.d.ts +3 -2
- package/esm/accordion-menu/AccordionMenuCollapsable.js +2 -2
- package/esm/accordion-menu/AccordionMenuCollapsable.js.map +1 -1
- package/esm/accordion-menu/AccordionMenuItem.d.ts +11 -10
- package/esm/accordion-menu/AccordionMenuItem.js +3 -3
- package/esm/accordion-menu/AccordionMenuItem.js.map +1 -1
- package/esm/accordion-menu/index.d.ts +3 -3
- package/esm/accordion-menu/index.js +0 -2
- package/esm/accordion-menu/index.js.map +1 -1
- package/esm/alert/Alert.d.ts +26 -4
- package/esm/alert/Alert.js +17 -12
- package/esm/alert/Alert.js.map +1 -1
- package/esm/alert/AlertContent.d.ts +10 -0
- package/esm/alert/AlertContent.js +27 -0
- package/esm/alert/AlertContent.js.map +1 -0
- package/esm/alert/AlertTitle.d.ts +10 -0
- package/esm/alert/AlertTitle.js +26 -0
- package/esm/alert/AlertTitle.js.map +1 -0
- package/esm/button/Button.d.ts +5 -4
- package/esm/button/Button.js +4 -2
- package/esm/button/Button.js.map +1 -1
- package/esm/card/MicroCard.d.ts +7 -7
- package/esm/card/MicroCard.js +2 -2
- package/esm/card/MicroCard.js.map +1 -1
- package/esm/copy-to-clipboard/CopyToClipboard.d.ts +9 -7
- package/esm/copy-to-clipboard/CopyToClipboard.js +10 -9
- package/esm/copy-to-clipboard/CopyToClipboard.js.map +1 -1
- package/esm/form/ConfirmationPanel.js +1 -1
- package/esm/form/ConfirmationPanel.js.map +1 -1
- package/esm/form/ErrorMessage.d.ts +1 -0
- package/esm/form/ErrorMessage.js +1 -1
- package/esm/form/ErrorMessage.js.map +1 -1
- package/esm/form/Fieldset/Fieldset.d.ts +1 -1
- package/esm/form/Fieldset/Fieldset.js +1 -1
- package/esm/form/Fieldset/Fieldset.js.map +1 -1
- package/esm/form/Fieldset/useFieldset.d.ts +1 -1
- package/esm/form/Select.js +2 -2
- package/esm/form/Select.js.map +1 -1
- package/esm/form/TextField.js +1 -1
- package/esm/form/TextField.js.map +1 -1
- package/esm/form/Textarea.js +2 -2
- package/esm/form/Textarea.js.map +1 -1
- package/esm/form/checkbox/Checkbox.js +1 -1
- package/esm/form/checkbox/Checkbox.js.map +1 -1
- package/esm/form/checkbox/CheckboxGroup.js +1 -1
- package/esm/form/checkbox/CheckboxGroup.js.map +1 -1
- package/esm/form/checkbox/useCheckbox.d.ts +1 -1
- package/esm/form/checkbox/useCheckbox.js +2 -1
- package/esm/form/checkbox/useCheckbox.js.map +1 -1
- package/esm/form/error-summary/ErrorSummary.d.ts +2 -2
- package/esm/form/error-summary/ErrorSummary.js +4 -4
- package/esm/form/error-summary/ErrorSummary.js.map +1 -1
- package/esm/form/error-summary/ErrorSummaryItem.d.ts +6 -9
- package/esm/form/error-summary/ErrorSummaryItem.js +1 -1
- package/esm/form/error-summary/ErrorSummaryItem.js.map +1 -1
- package/esm/form/radio/Radio.js +1 -1
- package/esm/form/radio/Radio.js.map +1 -1
- package/esm/form/radio/RadioGroup.js +1 -1
- package/esm/form/radio/RadioGroup.js.map +1 -1
- package/esm/form/radio/useRadio.d.ts +1 -1
- package/esm/form/radio/useRadio.js.map +1 -1
- package/esm/form/search-field/SearchField.d.ts +1 -1
- package/esm/form/search-field/SearchField.js +2 -2
- package/esm/form/search-field/SearchField.js.map +1 -1
- package/esm/form/search-field/SearchFieldButton.d.ts +2 -2
- package/esm/form/search-field/SearchFieldButton.js +1 -1
- package/esm/form/search-field/SearchFieldButton.js.map +1 -1
- package/esm/form/search-field/SearchFieldClearButton.d.ts +2 -2
- package/esm/form/search-field/SearchFieldClearButton.js +2 -2
- package/esm/form/search-field/SearchFieldClearButton.js.map +1 -1
- package/esm/form/search-field/SearchFieldInput.js +1 -1
- package/esm/form/search-field/SearchFieldInput.js.map +1 -1
- package/esm/form/useFormField.d.ts +2 -2
- package/esm/form/useFormField.js +1 -1
- package/esm/form/useFormField.js.map +1 -1
- package/esm/grid/Cell.js +1 -1
- package/esm/grid/Cell.js.map +1 -1
- package/esm/{content-container → grid}/ContentContainer.d.ts +1 -1
- package/esm/{content-container → grid}/ContentContainer.js +2 -2
- package/esm/grid/ContentContainer.js.map +1 -0
- package/esm/grid/index.d.ts +2 -0
- package/esm/grid/index.js +2 -0
- package/esm/grid/index.js.map +1 -1
- package/esm/guide-panel/Guide.d.ts +14 -0
- package/esm/guide-panel/Guide.js +21 -0
- package/esm/guide-panel/Guide.js.map +1 -0
- package/esm/guide-panel/GuidePanel.d.ts +18 -0
- package/esm/guide-panel/GuidePanel.js +24 -0
- package/esm/guide-panel/GuidePanel.js.map +1 -0
- package/esm/guide-panel/Illustration.d.ts +2 -0
- package/esm/guide-panel/Illustration.js +18 -0
- package/esm/guide-panel/Illustration.js.map +1 -0
- package/esm/guide-panel/index.d.ts +3 -0
- package/esm/guide-panel/index.js +3 -0
- package/esm/guide-panel/index.js.map +1 -0
- package/esm/help-text/HelpText.d.ts +15 -0
- package/esm/help-text/HelpText.js +41 -0
- package/esm/help-text/HelpText.js.map +1 -0
- package/esm/help-text/index.d.ts +2 -0
- package/esm/help-text/index.js +3 -0
- package/esm/help-text/index.js.map +1 -0
- package/esm/index.d.ts +4 -5
- package/esm/index.js +5 -5
- package/esm/index.js.map +1 -1
- package/esm/link/Link.d.ts +2 -5
- package/esm/link/Link.js +2 -2
- package/esm/link/Link.js.map +1 -1
- package/esm/link-panel/LinkPanel.d.ts +16 -21
- package/esm/link-panel/LinkPanel.js +9 -8
- package/esm/link-panel/LinkPanel.js.map +1 -1
- package/esm/link-panel/LinkPanelDescription.d.ts +7 -0
- package/esm/link-panel/LinkPanelDescription.js +19 -0
- package/esm/link-panel/LinkPanelDescription.js.map +1 -0
- package/esm/link-panel/LinkPanelTitle.d.ts +8 -0
- package/esm/link-panel/LinkPanelTitle.js +18 -0
- package/esm/link-panel/LinkPanelTitle.js.map +1 -0
- package/esm/loader/Loader.d.ts +3 -3
- package/esm/loader/Loader.js +3 -6
- package/esm/loader/Loader.js.map +1 -1
- package/esm/modal/Modal.d.ts +6 -6
- package/esm/modal/Modal.js +5 -3
- package/esm/modal/Modal.js.map +1 -1
- package/esm/modal/ModalContent.d.ts +10 -0
- package/esm/modal/ModalContent.js +19 -0
- package/esm/modal/ModalContent.js.map +1 -0
- package/esm/modal/index.d.ts +1 -0
- package/esm/modal/index.js.map +1 -1
- package/esm/page-header/PageHeader.d.ts +27 -0
- package/esm/page-header/PageHeader.js +24 -0
- package/esm/page-header/PageHeader.js.map +1 -0
- package/esm/page-header/index.d.ts +2 -0
- package/esm/page-header/index.js +3 -0
- package/esm/page-header/index.js.map +1 -0
- package/esm/panel/Panel.d.ts +12 -15
- package/esm/panel/Panel.js +1 -1
- package/esm/panel/Panel.js.map +1 -1
- package/esm/popover/Popover.d.ts +13 -8
- package/esm/popover/Popover.js +12 -3
- package/esm/popover/Popover.js.map +1 -1
- package/esm/popover/PopoverContent.d.ts +10 -0
- package/esm/popover/PopoverContent.js +19 -0
- package/esm/popover/PopoverContent.js.map +1 -0
- package/esm/popover/index.d.ts +1 -0
- package/esm/speech-bubble/Bubble.d.ts +1 -1
- package/esm/tag/Tag.d.ts +7 -1
- package/esm/tag/Tag.js +4 -2
- package/esm/tag/Tag.js.map +1 -1
- package/esm/typography/BodyLong.d.ts +16 -19
- package/esm/typography/BodyLong.js +2 -2
- package/esm/typography/BodyLong.js.map +1 -1
- package/esm/typography/BodyShort.d.ts +16 -19
- package/esm/typography/BodyShort.js +2 -2
- package/esm/typography/BodyShort.js.map +1 -1
- package/esm/typography/Detail.d.ts +16 -19
- package/esm/typography/Detail.js +2 -2
- package/esm/typography/Detail.js.map +1 -1
- package/esm/typography/Heading.d.ts +24 -0
- package/esm/typography/{Title.js → Heading.js} +8 -8
- package/esm/typography/Heading.js.map +1 -0
- package/esm/typography/Ingress.d.ts +11 -14
- package/esm/typography/Ingress.js +1 -1
- package/esm/typography/Ingress.js.map +1 -1
- package/esm/typography/Label.d.ts +16 -19
- package/esm/typography/Label.js +2 -2
- package/esm/typography/Label.js.map +1 -1
- package/esm/typography/index.d.ts +1 -1
- package/esm/typography/index.js +1 -1
- package/esm/typography/index.js.map +1 -1
- package/esm/util/OverridableComponent.d.ts +6 -25
- package/esm/util/OverridableComponent.js +1 -0
- package/esm/util/useId.d.ts +2 -0
- package/esm/util/useId.js +1 -1
- package/esm/util/useId.js.map +1 -1
- package/package.json +6 -3
- package/src/accordion/Accordion.tsx +23 -98
- package/src/accordion/AccordionContent.tsx +59 -0
- package/src/accordion/AccordionHeader.tsx +84 -0
- package/src/accordion/AccordionItem.tsx +93 -0
- package/src/accordion/stories/accordion.stories.mdx +55 -16
- package/src/accordion/stories/accordion.stories.tsx +76 -43
- package/src/accordion-menu/AccordionMenu.tsx +18 -3
- package/src/accordion-menu/AccordionMenuCollapsable.tsx +32 -29
- package/src/accordion-menu/AccordionMenuItem.tsx +17 -18
- package/src/accordion-menu/index.ts +3 -6
- package/src/accordion-menu/stories/accordion-menu.stories.mdx +34 -38
- package/src/accordion-menu/stories/accordion-menu.stories.tsx +60 -79
- package/src/alert/Alert.tsx +66 -43
- package/src/alert/AlertContent.tsx +41 -0
- package/src/alert/AlertTitle.tsx +41 -0
- package/src/alert/stories/alert.stories.mdx +48 -7
- package/src/alert/stories/alert.stories.tsx +95 -11
- package/src/button/Button.tsx +24 -11
- package/src/button/stories/button.stories.mdx +13 -14
- package/src/button/stories/button.stories.tsx +28 -17
- package/src/card/MicroCard.tsx +25 -23
- package/src/copy-to-clipboard/CopyToClipboard.tsx +34 -30
- package/src/copy-to-clipboard/stories/copy-to-clipboard.stories.tsx +9 -10
- package/src/copy-to-clipboard/stories/copy.stories.mdx +24 -14
- package/src/form/ConfirmationPanel.tsx +1 -1
- package/src/form/ErrorMessage.tsx +2 -2
- package/src/form/Fieldset/Fieldset.tsx +2 -2
- package/src/form/Select.tsx +2 -2
- package/src/form/TextField.tsx +1 -1
- package/src/form/Textarea.tsx +2 -2
- package/src/form/checkbox/Checkbox.tsx +1 -1
- package/src/form/checkbox/CheckboxGroup.tsx +1 -1
- package/src/form/checkbox/stories/checkbox.stories.mdx +7 -3
- package/src/form/checkbox/stories/checkbox.stories.tsx +1 -1
- package/src/form/error-summary/ErrorSummary.tsx +18 -17
- package/src/form/error-summary/ErrorSummaryItem.tsx +11 -11
- package/src/form/error-summary/stories/error-summary.stories.tsx +2 -2
- package/src/form/radio/Radio.tsx +1 -1
- package/src/form/radio/RadioGroup.tsx +1 -1
- package/src/form/radio/stories/radio.stories.mdx +11 -3
- package/src/form/radio/stories/radio.stories.tsx +1 -1
- package/src/form/search-field/SearchField.tsx +3 -3
- package/src/form/search-field/SearchFieldButton.tsx +3 -3
- package/src/form/search-field/SearchFieldClearButton.tsx +5 -5
- package/src/form/search-field/SearchFieldInput.tsx +3 -2
- package/src/form/search-field/stories/search-field-example.tsx +9 -10
- package/src/form/search-field/stories/search-field.stories.mdx +23 -68
- package/src/form/search-field/stories/search-field.stories.tsx +48 -15
- package/src/form/stories/confirmation-panel.stories.mdx +2 -2
- package/src/form/stories/confirmation-panel.stories.tsx +3 -3
- package/src/form/stories/fieldset.stories.mdx +2 -2
- package/src/form/stories/fieldset.stories.tsx +1 -1
- package/src/form/stories/live-examples.tsx +2 -2
- package/src/form/stories/select.stories.mdx +2 -2
- package/src/form/stories/select.stories.tsx +1 -1
- package/src/form/stories/text-field.stories.mdx +2 -2
- package/src/form/stories/text-field.stories.tsx +1 -1
- package/src/form/stories/textarea.stories.mdx +2 -2
- package/src/form/stories/textarea.stories.tsx +1 -1
- package/src/form/useFormField.ts +2 -2
- package/src/grid/Cell.tsx +1 -1
- package/src/{content-container → grid}/ContentContainer.tsx +3 -5
- package/src/grid/index.ts +2 -0
- package/src/grid/stories/grid.stories.mdx +24 -5
- package/src/grid/stories/grid.stories.tsx +10 -2
- package/src/grid/stories/styles.css +16 -0
- package/src/guide-panel/Guide.tsx +34 -0
- package/src/guide-panel/GuidePanel.tsx +39 -0
- package/src/guide-panel/Illustration.tsx +99 -0
- package/src/guide-panel/index.ts +3 -0
- package/src/guide-panel/stories/example.css +13 -0
- package/src/guide-panel/stories/guidepanel.stories.mdx +81 -0
- package/src/guide-panel/stories/guidepanel.stories.tsx +68 -0
- package/src/help-text/HelpText.tsx +78 -0
- package/src/help-text/index.ts +2 -0
- package/src/help-text/stories/help-text.stories.mdx +35 -0
- package/src/help-text/stories/help-text.stories.tsx +32 -0
- package/src/index.ts +6 -5
- package/src/link/Link.tsx +7 -18
- package/src/link/stories/link.stories.tsx +30 -3
- package/src/link-panel/LinkPanel.tsx +32 -44
- package/src/link-panel/LinkPanelDescription.tsx +23 -0
- package/src/link-panel/LinkPanelTitle.tsx +27 -0
- package/src/link-panel/stories/link-panel.stories.mdx +52 -23
- package/src/link-panel/stories/link-panel.stories.tsx +43 -34
- package/src/loader/Loader.tsx +13 -10
- package/src/loader/stories/loader.stories.mdx +27 -28
- package/src/loader/stories/loader.stories.tsx +31 -91
- package/src/modal/Modal.tsx +16 -14
- package/src/modal/ModalContent.tsx +26 -0
- package/src/modal/index.ts +1 -0
- package/src/modal/stories/modal.stories.mdx +10 -1
- package/src/modal/stories/modal.stories.tsx +20 -23
- package/src/page-header/PageHeader.tsx +76 -0
- package/src/page-header/index.ts +2 -0
- package/src/{header → page-header}/stories/header.stories.mdx +31 -24
- package/src/{header → page-header}/stories/header.stories.tsx +27 -27
- package/src/{header → page-header}/stories/pictogram.tsx +0 -0
- package/src/panel/Panel.tsx +14 -23
- package/src/popover/Popover.tsx +29 -11
- package/src/popover/PopoverContent.tsx +26 -0
- package/src/popover/index.ts +1 -0
- package/src/popover/stories/popover.stories.tsx +6 -8
- package/src/speech-bubble/Bubble.tsx +1 -1
- package/src/tag/Tag.tsx +18 -10
- package/src/tag/stories/tag.stories.mdx +24 -0
- package/src/tag/stories/tag.stories.tsx +13 -0
- package/src/typography/BodyLong.tsx +22 -21
- package/src/typography/BodyShort.tsx +22 -21
- package/src/typography/Detail.tsx +22 -21
- package/src/typography/Heading.tsx +45 -0
- package/src/typography/Ingress.tsx +23 -24
- package/src/typography/Label.tsx +21 -21
- package/src/typography/index.ts +1 -1
- package/src/typography/stories/typography.stories.tsx +18 -23
- package/src/util/OverridableComponent.ts +7 -44
- package/src/util/useId.ts +1 -1
- package/cjs/accordion-anchor-menu/AccordionAnchorMenuCollapsable.js +0 -4
- package/cjs/accordion-anchor-menu/AccordionAnchorMenuItem.js +0 -44
- package/cjs/accordion-anchor-menu/ActiveAnchorStore.js +0 -68
- package/cjs/accordion-anchor-menu/index.js +0 -8
- package/cjs/accordion-anchor-menu/package.json +0 -6
- package/cjs/content-container/index.js +0 -15
- package/cjs/content-container/package.json +0 -6
- package/cjs/header/index.js +0 -15
- package/cjs/header/package.json +0 -6
- package/cjs/layouts/index.js +0 -8
- package/cjs/layouts/package.json +0 -6
- package/cjs/layouts/product-page/ProductPageLayout.js +0 -62
- package/cjs/layouts/product-page/ProductPagePanel.js +0 -63
- package/esm/accordion-anchor-menu/AccordionAnchorMenu.d.ts +0 -7
- package/esm/accordion-anchor-menu/AccordionAnchorMenu.js +0 -25
- package/esm/accordion-anchor-menu/AccordionAnchorMenu.js.map +0 -1
- package/esm/accordion-anchor-menu/AccordionAnchorMenuCollapsable.d.ts +0 -1
- package/esm/accordion-anchor-menu/AccordionAnchorMenuCollapsable.js +0 -2
- package/esm/accordion-anchor-menu/AccordionAnchorMenuCollapsable.js.map +0 -1
- package/esm/accordion-anchor-menu/AccordionAnchorMenuItem.d.ts +0 -3
- package/esm/accordion-anchor-menu/AccordionAnchorMenuItem.js +0 -24
- package/esm/accordion-anchor-menu/AccordionAnchorMenuItem.js.map +0 -1
- package/esm/accordion-anchor-menu/ActiveAnchorStore.d.ts +0 -11
- package/esm/accordion-anchor-menu/ActiveAnchorStore.js +0 -47
- package/esm/accordion-anchor-menu/ActiveAnchorStore.js.map +0 -1
- package/esm/accordion-anchor-menu/index.d.ts +0 -3
- package/esm/accordion-anchor-menu/index.js +0 -4
- package/esm/accordion-anchor-menu/index.js.map +0 -1
- package/esm/content-container/ContentContainer.js.map +0 -1
- package/esm/content-container/index.d.ts +0 -2
- package/esm/content-container/index.js +0 -3
- package/esm/content-container/index.js.map +0 -1
- package/esm/header/Header.d.ts +0 -27
- package/esm/header/Header.js +0 -23
- package/esm/header/Header.js.map +0 -1
- package/esm/header/index.d.ts +0 -2
- package/esm/header/index.js +0 -3
- package/esm/header/index.js.map +0 -1
- package/esm/layouts/index.d.ts +0 -3
- package/esm/layouts/index.js +0 -4
- package/esm/layouts/index.js.map +0 -1
- package/esm/layouts/product-page/ProductPageLayout.d.ts +0 -7
- package/esm/layouts/product-page/ProductPageLayout.js +0 -39
- package/esm/layouts/product-page/ProductPageLayout.js.map +0 -1
- package/esm/layouts/product-page/ProductPagePanel.d.ts +0 -12
- package/esm/layouts/product-page/ProductPagePanel.js +0 -40
- package/esm/layouts/product-page/ProductPagePanel.js.map +0 -1
- package/esm/layouts/product-page/ProductPageSection.d.ts +0 -10
- package/esm/layouts/product-page/ProductPageSection.js +0 -19
- package/esm/layouts/product-page/ProductPageSection.js.map +0 -1
- package/esm/typography/Title.d.ts +0 -25
- package/esm/typography/Title.js.map +0 -1
- package/src/accordion-anchor-menu/AccordionAnchorMenu.tsx +0 -35
- package/src/accordion-anchor-menu/AccordionAnchorMenuCollapsable.tsx +0 -1
- package/src/accordion-anchor-menu/AccordionAnchorMenuItem.tsx +0 -39
- package/src/accordion-anchor-menu/ActiveAnchorStore.tsx +0 -73
- package/src/accordion-anchor-menu/index.ts +0 -3
- package/src/accordion-anchor-menu/stories/menu.stories.mdx +0 -14
- package/src/accordion-anchor-menu/stories/menu.stories.tsx +0 -125
- package/src/content-container/index.ts +0 -2
- package/src/content-container/stories/container.stories.mdx +0 -31
- package/src/content-container/stories/container.stories.tsx +0 -33
- package/src/content-container/stories/style.css +0 -15
- package/src/form/stories/error-uu.stories.tsx +0 -75
- package/src/header/Header.tsx +0 -69
- package/src/header/index.ts +0 -2
- package/src/layouts/index.ts +0 -3
- package/src/layouts/product-page/ProductPageLayout.tsx +0 -60
- package/src/layouts/product-page/ProductPagePanel.tsx +0 -72
- package/src/layouts/product-page/ProductPageSection.tsx +0 -46
- package/src/layouts/stories/components/sections/Left.tsx +0 -22
- package/src/layouts/stories/components/sections/Main.tsx +0 -133
- package/src/layouts/stories/components/sections/Right.tsx +0 -8
- package/src/layouts/stories/components/styles.css +0 -12
- package/src/layouts/stories/layout.stories.mdx +0 -8
- package/src/layouts/stories/product-page-layout.stories.tsx +0 -90
- package/src/loader/stories/demo.css +0 -18
- package/src/typography/Title.tsx +0 -56
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
import React from "react";
|
|
2
|
-
import { ReactNode } from "react";
|
|
3
|
-
export interface ProductPagePanelProps extends React.HTMLAttributes<HTMLDivElement> {
|
|
4
|
-
children: React.ReactNode;
|
|
5
|
-
anchor: string;
|
|
6
|
-
title: string;
|
|
7
|
-
icon?: ReactNode;
|
|
8
|
-
highlight?: boolean;
|
|
9
|
-
whiteBackground?: boolean;
|
|
10
|
-
}
|
|
11
|
-
declare const ProductPagePanel: React.ForwardRefExoticComponent<ProductPagePanelProps & React.RefAttributes<HTMLDivElement>>;
|
|
12
|
-
export default ProductPagePanel;
|
|
@@ -1,40 +0,0 @@
|
|
|
1
|
-
var __rest = (this && this.__rest) || function (s, e) {
|
|
2
|
-
var t = {};
|
|
3
|
-
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
4
|
-
t[p] = s[p];
|
|
5
|
-
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
|
6
|
-
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
7
|
-
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
|
8
|
-
t[p[i]] = s[p[i]];
|
|
9
|
-
}
|
|
10
|
-
return t;
|
|
11
|
-
};
|
|
12
|
-
import React, { useEffect, useRef } from "react";
|
|
13
|
-
import { forwardRef } from "react";
|
|
14
|
-
import cl from "classnames";
|
|
15
|
-
import { Title, CopyToClipboard } from "../../";
|
|
16
|
-
import { Attachment } from "@navikt/ds-icons";
|
|
17
|
-
const ProductPagePanel = forwardRef((_a, ref) => {
|
|
18
|
-
var { children, className, title, highlight, icon, anchor } = _a, rest = __rest(_a, ["children", "className", "title", "highlight", "icon", "anchor"]);
|
|
19
|
-
const copyRef = useRef(null);
|
|
20
|
-
useEffect(() => {
|
|
21
|
-
const header = document.getElementById("navds-layout-body");
|
|
22
|
-
header === null || header === void 0 ? void 0 : header.classList.add("navds-layout__body--padding");
|
|
23
|
-
}, []);
|
|
24
|
-
const getLink = () => {
|
|
25
|
-
const { href, hash } = window.location;
|
|
26
|
-
const urlWithoutHash = href.replace(hash, "");
|
|
27
|
-
return `${urlWithoutHash}#${anchor}`;
|
|
28
|
-
};
|
|
29
|
-
return (React.createElement("div", Object.assign({ ref: ref, className: cl("navds-layout__panel", icon && "navds-layout__panel--icon-margin", highlight && "navds-layout__panel--highlight", className) }, rest),
|
|
30
|
-
React.createElement("div", { className: "navds-layout__panel-anchor" },
|
|
31
|
-
React.createElement("div", { id: anchor, className: cl("navds-layout__panel-anchor--child", {
|
|
32
|
-
"navds-layout__panel-anchor--child--icon": !!icon,
|
|
33
|
-
}) })),
|
|
34
|
-
icon && React.createElement("div", { className: "navds-layout__panel-icon" }, icon),
|
|
35
|
-
React.createElement(Title, { size: "xl", className: "navds-layout__panel-title", level: 2 }, title),
|
|
36
|
-
React.createElement(CopyToClipboard, { className: "navds-layout__panel-copy", ref: copyRef, text: getLink(), label: "Kopierte lenke til panel", icon: React.createElement(Attachment, null) }, "Kopier lenke"),
|
|
37
|
-
React.createElement("div", { className: "navds-layout__panel-content" }, children)));
|
|
38
|
-
});
|
|
39
|
-
export default ProductPagePanel;
|
|
40
|
-
//# sourceMappingURL=ProductPagePanel.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"ProductPagePanel.js","sourceRoot":"","sources":["../../../src/layouts/product-page/ProductPagePanel.tsx"],"names":[],"mappings":";;;;;;;;;;;AAAA,OAAO,KAAK,EAAE,EAAE,SAAS,EAAE,MAAM,EAAE,MAAM,OAAO,CAAC;AACjD,OAAO,EAAE,UAAU,EAAa,MAAM,OAAO,CAAC;AAC9C,OAAO,EAAE,MAAM,YAAY,CAAC;AAC5B,OAAO,EAAE,KAAK,EAAE,eAAe,EAAE,MAAM,QAAQ,CAAC;AAChD,OAAO,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;AAY9C,MAAM,gBAAgB,GAAG,UAAU,CACjC,CAAC,EAAgE,EAAE,GAAG,EAAE,EAAE;QAAzE,EAAE,QAAQ,EAAE,SAAS,EAAE,KAAK,EAAE,SAAS,EAAE,IAAI,EAAE,MAAM,OAAW,EAAN,IAAI,cAA9D,iEAAgE,CAAF;IAC7D,MAAM,OAAO,GAAG,MAAM,CAAC,IAAI,CAAC,CAAC;IAE7B,SAAS,CAAC,GAAG,EAAE;QACb,MAAM,MAAM,GAAG,QAAQ,CAAC,cAAc,CAAC,mBAAmB,CAAC,CAAC;QAC5D,MAAM,aAAN,MAAM,uBAAN,MAAM,CAAE,SAAS,CAAC,GAAG,CAAC,6BAA6B,EAAE;IACvD,CAAC,EAAE,EAAE,CAAC,CAAC;IAEP,MAAM,OAAO,GAAG,GAAG,EAAE;QACnB,MAAM,EAAE,IAAI,EAAE,IAAI,EAAE,GAAG,MAAM,CAAC,QAAQ,CAAC;QACvC,MAAM,cAAc,GAAG,IAAI,CAAC,OAAO,CAAC,IAAI,EAAE,EAAE,CAAC,CAAC;QAC9C,OAAO,GAAG,cAAc,IAAI,MAAM,EAAE,CAAC;IACvC,CAAC,CAAC;IAEF,OAAO,CACL,2CACE,GAAG,EAAE,GAAG,EACR,SAAS,EAAE,EAAE,CACX,qBAAqB,EACrB,IAAI,IAAI,kCAAkC,EAC1C,SAAS,IAAI,gCAAgC,EAC7C,SAAS,CACV,IACG,IAAI;QAER,6BAAK,SAAS,EAAC,4BAA4B;YACzC,6BACE,EAAE,EAAE,MAAM,EACV,SAAS,EAAE,EAAE,CAAC,mCAAmC,EAAE;oBACjD,yCAAyC,EAAE,CAAC,CAAC,IAAI;iBAClD,CAAC,GACF,CACE;QACL,IAAI,IAAI,6BAAK,SAAS,EAAE,0BAA0B,IAAG,IAAI,CAAO;QACjE,oBAAC,KAAK,IAAC,IAAI,EAAE,IAAI,EAAE,SAAS,EAAE,2BAA2B,EAAE,KAAK,EAAE,CAAC,IAChE,KAAK,CACA;QAER,oBAAC,eAAe,IACd,SAAS,EAAC,0BAA0B,EACpC,GAAG,EAAE,OAAO,EACZ,IAAI,EAAE,OAAO,EAAE,EACf,KAAK,EAAC,0BAA0B,EAChC,IAAI,EAAE,oBAAC,UAAU,OAAG,mBAGJ;QAElB,6BAAK,SAAS,EAAE,6BAA6B,IAAG,QAAQ,CAAO,CAC3D,CACP,CAAC;AACJ,CAAC,CACF,CAAC;AAEF,eAAe,gBAAgB,CAAC"}
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
import React, { HTMLAttributes } from "react";
|
|
2
|
-
export interface ProductPageSectionProps extends HTMLAttributes<HTMLDivElement> {
|
|
3
|
-
left?: boolean;
|
|
4
|
-
right?: boolean;
|
|
5
|
-
whiteBackground?: boolean;
|
|
6
|
-
withPadding?: boolean;
|
|
7
|
-
sticky?: boolean;
|
|
8
|
-
}
|
|
9
|
-
declare const ProductPageSection: React.ForwardRefExoticComponent<ProductPageSectionProps & React.RefAttributes<HTMLDivElement>>;
|
|
10
|
-
export default ProductPageSection;
|
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
var __rest = (this && this.__rest) || function (s, e) {
|
|
2
|
-
var t = {};
|
|
3
|
-
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
4
|
-
t[p] = s[p];
|
|
5
|
-
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
|
6
|
-
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
7
|
-
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
|
8
|
-
t[p[i]] = s[p[i]];
|
|
9
|
-
}
|
|
10
|
-
return t;
|
|
11
|
-
};
|
|
12
|
-
import React, { forwardRef } from "react";
|
|
13
|
-
import cl from "classnames";
|
|
14
|
-
const ProductPageSection = forwardRef((_a, ref) => {
|
|
15
|
-
var { left, right, children, whiteBackground = true, withPadding = true, sticky, className } = _a, rest = __rest(_a, ["left", "right", "children", "whiteBackground", "withPadding", "sticky", "className"]);
|
|
16
|
-
return (React.createElement("div", Object.assign({ ref: ref, className: cl("navds-layout__section", left && "navds-layout__section--left", right && "navds-layout__section--right", !left && !right && "navds-layout__section--main", whiteBackground && "navds-layout__section--white", withPadding && "navds-layout__section--padding", sticky && "navds-layout__section--sticky", className) }, rest), children));
|
|
17
|
-
});
|
|
18
|
-
export default ProductPageSection;
|
|
19
|
-
//# sourceMappingURL=ProductPageSection.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"ProductPageSection.js","sourceRoot":"","sources":["../../../src/layouts/product-page/ProductPageSection.tsx"],"names":[],"mappings":";;;;;;;;;;;AAAA,OAAO,KAAK,EAAE,EAAE,UAAU,EAAkB,MAAM,OAAO,CAAC;AAC1D,OAAO,EAAE,MAAM,YAAY,CAAC;AAW5B,MAAM,kBAAkB,GAAG,UAAU,CACnC,CACE,EASC,EACD,GAAG,EACH,EAAE;QAXF,EACE,IAAI,EACJ,KAAK,EACL,QAAQ,EACR,eAAe,GAAG,IAAI,EACtB,WAAW,GAAG,IAAI,EAClB,MAAM,EACN,SAAS,OAEV,EADI,IAAI,cART,sFASC,CADQ;IAGN,OAAA,CACH,2CACE,GAAG,EAAE,GAAG,EACR,SAAS,EAAE,EAAE,CACX,uBAAuB,EACvB,IAAI,IAAI,6BAA6B,EACrC,KAAK,IAAI,8BAA8B,EACvC,CAAC,IAAI,IAAI,CAAC,KAAK,IAAI,6BAA6B,EAChD,eAAe,IAAI,8BAA8B,EACjD,WAAW,IAAI,gCAAgC,EAC/C,MAAM,IAAI,+BAA+B,EACzC,SAAS,CACV,IACG,IAAI,GAEP,QAAQ,CACL,CACP,CAAA;CAAA,CACF,CAAC;AAEF,eAAe,kBAAkB,CAAC"}
|
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
import React from "react";
|
|
2
|
-
import { OverridableComponent } from "../util";
|
|
3
|
-
export interface TitleProps {
|
|
4
|
-
props: {
|
|
5
|
-
/**
|
|
6
|
-
* Heading level
|
|
7
|
-
*/
|
|
8
|
-
level?: 1 | 2 | 3 | 4 | 5 | "1" | "2" | "3" | "4" | "5";
|
|
9
|
-
/**
|
|
10
|
-
* Sizes from largest "2xl" to smallest "s"
|
|
11
|
-
*/
|
|
12
|
-
size: "2xl" | "xl" | "l" | "m" | "s";
|
|
13
|
-
/**
|
|
14
|
-
* Paragraph text
|
|
15
|
-
*/
|
|
16
|
-
children: React.ReactNode;
|
|
17
|
-
/**
|
|
18
|
-
* Adds margins to typo
|
|
19
|
-
*/
|
|
20
|
-
spacing?: boolean;
|
|
21
|
-
} & React.HTMLAttributes<HTMLHeadingElement>;
|
|
22
|
-
defaultComponent: "h1";
|
|
23
|
-
}
|
|
24
|
-
declare const Title: OverridableComponent<TitleProps>;
|
|
25
|
-
export default Title;
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"Title.js","sourceRoot":"","sources":["../../src/typography/Title.tsx"],"names":[],"mappings":";;;;;;;;;;;AAAA,OAAO,KAAK,EAAE,EAAE,UAAU,EAAE,MAAM,OAAO,CAAC;AAC1C,OAAO,EAAE,MAAM,YAAY,CAAC;AAyB5B,MAAM,KAAK,GAAqC,UAAU,CACxD,CACE,EAQC,EACD,GAAG,EACH,EAAE;QAVF,EACE,KAAK,GAAG,CAAC,EACT,IAAI,GAAG,KAAK,EACZ,OAAO,EACP,SAAS,EACT,QAAQ,EACR,SAAS,OAEV,EADI,IAAI,cAPT,kEAQC,CADQ;IAIT,IAAI,UAAU,GAAG,SAAS,aAAT,SAAS,cAAT,SAAS,GAAK,IAAI,KAAK,EAAwB,CAAC;IAEjE,OAAO,CACL,oBAAC,UAAU,oBACL,IAAI,IACR,GAAG,EAAE,GAAG,EACR,SAAS,EAAE,EAAE,CAAC,SAAS,EAAE,aAAa,EAAE,gBAAgB,IAAI,EAAE,EAAE;YAC9D,qBAAqB,EAAE,CAAC,CAAC,OAAO;SACjC,CAAC,KAED,QAAQ,CACE,CACd,CAAC;AACJ,CAAC,CACF,CAAC;AAEF,eAAe,KAAK,CAAC"}
|
|
@@ -1,35 +0,0 @@
|
|
|
1
|
-
import React, { forwardRef, HTMLAttributes } from "react";
|
|
2
|
-
import { AccordionMenu as BaseAccordionMenu } from "../accordion-menu";
|
|
3
|
-
import { Title } from "..";
|
|
4
|
-
import { ActiveAnchorProvider } from "./ActiveAnchorStore";
|
|
5
|
-
import cl from "classnames";
|
|
6
|
-
|
|
7
|
-
export interface AccordionAnchorMenuProps
|
|
8
|
-
extends HTMLAttributes<HTMLDivElement> {
|
|
9
|
-
title?: string;
|
|
10
|
-
children: React.ReactNode;
|
|
11
|
-
}
|
|
12
|
-
|
|
13
|
-
const AccordionAnchorMenu = forwardRef<
|
|
14
|
-
HTMLDivElement,
|
|
15
|
-
AccordionAnchorMenuProps
|
|
16
|
-
>(({ children, title, className, ...rest }, ref) => (
|
|
17
|
-
<div
|
|
18
|
-
className={cl("navds-accordion-anchor-menu", className)}
|
|
19
|
-
ref={ref}
|
|
20
|
-
{...rest}
|
|
21
|
-
>
|
|
22
|
-
{title && (
|
|
23
|
-
<Title level={2} size="m" className="navds-accordion-anchor-menu__title">
|
|
24
|
-
{title}
|
|
25
|
-
</Title>
|
|
26
|
-
)}
|
|
27
|
-
<ActiveAnchorProvider>
|
|
28
|
-
<BaseAccordionMenu aria-label={title || "Meny"}>
|
|
29
|
-
{children}
|
|
30
|
-
</BaseAccordionMenu>
|
|
31
|
-
</ActiveAnchorProvider>
|
|
32
|
-
</div>
|
|
33
|
-
));
|
|
34
|
-
|
|
35
|
-
export default AccordionAnchorMenu;
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export { AccordionMenuCollapsable as AccordionAnchorMenuCollapsable } from "../accordion-menu";
|
|
@@ -1,39 +0,0 @@
|
|
|
1
|
-
import React, { forwardRef, useEffect } from "react";
|
|
2
|
-
import { AccordionMenuItem, AccordionMenuItemType } from "../accordion-menu";
|
|
3
|
-
import { useStore } from "./ActiveAnchorStore";
|
|
4
|
-
|
|
5
|
-
const AccordionAnchorMenuItem: AccordionMenuItemType = forwardRef(
|
|
6
|
-
(props, ref) => {
|
|
7
|
-
const isAnchorActive = useIsAnchorActive(
|
|
8
|
-
props.href && props.href.split("#")[1]
|
|
9
|
-
);
|
|
10
|
-
|
|
11
|
-
return (
|
|
12
|
-
<AccordionMenuItem
|
|
13
|
-
{...props}
|
|
14
|
-
ref={ref}
|
|
15
|
-
active={props.active || isAnchorActive}
|
|
16
|
-
/>
|
|
17
|
-
);
|
|
18
|
-
}
|
|
19
|
-
);
|
|
20
|
-
|
|
21
|
-
const useIsAnchorActive = (anchor: string | undefined) => {
|
|
22
|
-
const { activeAnchor, registerAnchor, unregisterAnchor } = useStore();
|
|
23
|
-
|
|
24
|
-
useEffect(() => {
|
|
25
|
-
if (anchor) {
|
|
26
|
-
const target = document.getElementById(anchor);
|
|
27
|
-
if (target) {
|
|
28
|
-
registerAnchor(anchor);
|
|
29
|
-
return () => {
|
|
30
|
-
unregisterAnchor(anchor);
|
|
31
|
-
};
|
|
32
|
-
}
|
|
33
|
-
}
|
|
34
|
-
}, [anchor, registerAnchor, unregisterAnchor]);
|
|
35
|
-
|
|
36
|
-
return (anchor && activeAnchor === anchor) || false;
|
|
37
|
-
};
|
|
38
|
-
|
|
39
|
-
export default AccordionAnchorMenuItem;
|
|
@@ -1,73 +0,0 @@
|
|
|
1
|
-
import React, {
|
|
2
|
-
createContext,
|
|
3
|
-
useCallback,
|
|
4
|
-
useContext,
|
|
5
|
-
useState,
|
|
6
|
-
useEffect,
|
|
7
|
-
} from "react";
|
|
8
|
-
|
|
9
|
-
export interface ActiveAnchorStore {
|
|
10
|
-
activeAnchor?: string;
|
|
11
|
-
registerAnchor: (anchor: string) => void;
|
|
12
|
-
unregisterAnchor: (anchor: string) => void;
|
|
13
|
-
}
|
|
14
|
-
|
|
15
|
-
export const ActiveAnchorContext = createContext({} as ActiveAnchorStore);
|
|
16
|
-
export const ActiveAnchorProvider = ({
|
|
17
|
-
children,
|
|
18
|
-
}: {
|
|
19
|
-
children: React.ReactNode;
|
|
20
|
-
}) => {
|
|
21
|
-
const [anchors, setAnchors] = useState<string[]>([]);
|
|
22
|
-
const [activeAnchor, setActiveAnchor] = useState<string>();
|
|
23
|
-
|
|
24
|
-
useEffect(() => {
|
|
25
|
-
const scrollListener = () => {
|
|
26
|
-
const offset = 100;
|
|
27
|
-
const lastPassedAnchor = anchors
|
|
28
|
-
.map((anchor) => document.getElementById(anchor) as HTMLElement)
|
|
29
|
-
.map((element: HTMLElement) => ({
|
|
30
|
-
id: element.id,
|
|
31
|
-
top: element.getBoundingClientRect().top - offset,
|
|
32
|
-
scrolledToBottom:
|
|
33
|
-
window.innerHeight + window.pageYOffset >=
|
|
34
|
-
document.body.offsetHeight,
|
|
35
|
-
}))
|
|
36
|
-
.filter((element) => element.scrolledToBottom || element.top <= 0)
|
|
37
|
-
.sort((a, b) => (a.top < b.top ? -1 : 1))
|
|
38
|
-
.map((anchor) => anchor.id)
|
|
39
|
-
.pop();
|
|
40
|
-
|
|
41
|
-
// Set active anchor and related url hash
|
|
42
|
-
if (lastPassedAnchor && activeAnchor !== lastPassedAnchor) {
|
|
43
|
-
const { href, hash } = window.location;
|
|
44
|
-
const urlWithoutHash = href.replace(hash, "");
|
|
45
|
-
const urlWithAnchor = `${urlWithoutHash}#${lastPassedAnchor}`;
|
|
46
|
-
const title = document.title;
|
|
47
|
-
window.history.replaceState(window.history.state, title, urlWithAnchor);
|
|
48
|
-
setActiveAnchor(lastPassedAnchor);
|
|
49
|
-
}
|
|
50
|
-
};
|
|
51
|
-
window.addEventListener("scroll", scrollListener);
|
|
52
|
-
return () => {
|
|
53
|
-
window.removeEventListener("scroll", scrollListener);
|
|
54
|
-
};
|
|
55
|
-
}, [anchors, activeAnchor]);
|
|
56
|
-
|
|
57
|
-
return (
|
|
58
|
-
<ActiveAnchorContext.Provider
|
|
59
|
-
value={{
|
|
60
|
-
activeAnchor,
|
|
61
|
-
registerAnchor: useCallback((anchor) => {
|
|
62
|
-
setAnchors((anchors) => [...anchors, anchor]);
|
|
63
|
-
}, []),
|
|
64
|
-
unregisterAnchor: useCallback((anchor) => {
|
|
65
|
-
setAnchors((anchors) => anchors.filter((a) => a !== anchor));
|
|
66
|
-
}, []),
|
|
67
|
-
}}
|
|
68
|
-
>
|
|
69
|
-
{children}
|
|
70
|
-
</ActiveAnchorContext.Provider>
|
|
71
|
-
);
|
|
72
|
-
};
|
|
73
|
-
export const useStore = () => useContext(ActiveAnchorContext);
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
import { Meta, Canvas } from "@storybook/addon-docs";
|
|
2
|
-
import { AccordionAnchorMenu } from "../../index";
|
|
3
|
-
import { Success } from "@navikt/ds-react";
|
|
4
|
-
|
|
5
|
-
<Meta title="ds-react/accordion-anchor-menu/intro" />
|
|
6
|
-
|
|
7
|
-
# AccordionAnchorMenu
|
|
8
|
-
|
|
9
|
-
NOTE: Komponenten er ikke oppdatert og er veldig buggy. Ville ungått bruk av denne om mulig og bare brukt
|
|
10
|
-
vanlig `AccordionMenu`. Hvorvidt vi kommer til å oppdatere denne og ta den med i 1.0 er usikkert.
|
|
11
|
-
|
|
12
|
-
`AccordionAnchorMenu` er en meny-komponent som implementerer `AccordionMenu` med context
|
|
13
|
-
for lytting på aktiv anchor/heading. Dette vil si at active-state settes automatisk.
|
|
14
|
-
når man scroller forbi den relevante linken på siden.
|
|
@@ -1,125 +0,0 @@
|
|
|
1
|
-
import * as React from "react";
|
|
2
|
-
import {
|
|
3
|
-
AccordionAnchorMenu as Menu,
|
|
4
|
-
AccordionAnchorMenuCollapsable as Collapsable,
|
|
5
|
-
AccordionAnchorMenuItem as Item,
|
|
6
|
-
} from "../index";
|
|
7
|
-
import {
|
|
8
|
-
ProductPageLayout as Layout,
|
|
9
|
-
ProductPageSection as Section,
|
|
10
|
-
ProductPagePanel as Panel,
|
|
11
|
-
} from "../../index";
|
|
12
|
-
import { Right } from "../../layouts/stories/components/sections/Right";
|
|
13
|
-
import { LightBulb, Telephone } from "@navikt/ds-icons";
|
|
14
|
-
import { MainOne } from "../../layouts/stories/components/sections/Main";
|
|
15
|
-
import { MainTwo } from "../../layouts/stories/components/sections/Main";
|
|
16
|
-
import { MainThree } from "../../layouts/stories/components/sections/Main";
|
|
17
|
-
import { Link, HashRouter as Router } from "react-router-dom";
|
|
18
|
-
|
|
19
|
-
export default {
|
|
20
|
-
title: "ds-react/accordion-anchor-menu",
|
|
21
|
-
component: { Menu },
|
|
22
|
-
parameters: {
|
|
23
|
-
layout: "fullscreen",
|
|
24
|
-
},
|
|
25
|
-
};
|
|
26
|
-
|
|
27
|
-
export const All = () => (
|
|
28
|
-
<Layout title={"Nunc et lorem"}>
|
|
29
|
-
<Section left sticky withPadding={false}>
|
|
30
|
-
<Menu title={"Minima"}>
|
|
31
|
-
<Item href={"#leo-quis"}>Leo quis</Item>
|
|
32
|
-
<Collapsable title={"Proin accumsan"}>
|
|
33
|
-
<Item href={"#nulla-pariatur"}>Nulla pariatur</Item>
|
|
34
|
-
<Item href={"#luctus-justo"}>Luctus justo</Item>
|
|
35
|
-
</Collapsable>
|
|
36
|
-
<Item href={"#maecenas-in-pretium"}>Maecenas in pretium</Item>
|
|
37
|
-
</Menu>
|
|
38
|
-
</Section>
|
|
39
|
-
<Section whiteBackground={false} withPadding={false}>
|
|
40
|
-
<Panel
|
|
41
|
-
title={"Leo quis"}
|
|
42
|
-
anchor={"leo-quis"}
|
|
43
|
-
highlight={true}
|
|
44
|
-
icon={<LightBulb />}
|
|
45
|
-
>
|
|
46
|
-
<MainOne title={false} />
|
|
47
|
-
</Panel>
|
|
48
|
-
<Panel title={"Proin accumsan"} anchor={"proin-accumsan"}>
|
|
49
|
-
<MainTwo title={false} />
|
|
50
|
-
</Panel>
|
|
51
|
-
<Panel
|
|
52
|
-
title={"Maecenas in pretium"}
|
|
53
|
-
anchor={"maecenas-in-pretium"}
|
|
54
|
-
icon={<Telephone />}
|
|
55
|
-
>
|
|
56
|
-
<MainThree title={false} />
|
|
57
|
-
</Panel>
|
|
58
|
-
</Section>
|
|
59
|
-
<Section right sticky>
|
|
60
|
-
<Right />
|
|
61
|
-
</Section>
|
|
62
|
-
</Layout>
|
|
63
|
-
);
|
|
64
|
-
|
|
65
|
-
export const ReactRouter = () => (
|
|
66
|
-
<Layout title={"Nunc et lorem"}>
|
|
67
|
-
<Section left sticky withPadding={false}>
|
|
68
|
-
<Menu>
|
|
69
|
-
<Item component={Link} to="/link1">
|
|
70
|
-
Leo quis
|
|
71
|
-
</Item>
|
|
72
|
-
<Collapsable title={"Proin accumsan"}>
|
|
73
|
-
<Item component={Link} to="/link2">
|
|
74
|
-
Nulla pariatur
|
|
75
|
-
</Item>
|
|
76
|
-
<Item component={Link} to="/link3">
|
|
77
|
-
Luctus justo
|
|
78
|
-
</Item>
|
|
79
|
-
</Collapsable>
|
|
80
|
-
<Collapsable title={"Sint cupidatat"}>
|
|
81
|
-
<Item component={Link} to="/link4">
|
|
82
|
-
Nulla pariatur
|
|
83
|
-
</Item>
|
|
84
|
-
<Item component={Link} to="/link5">
|
|
85
|
-
Luctus justo
|
|
86
|
-
</Item>
|
|
87
|
-
</Collapsable>
|
|
88
|
-
<Item component={Link} to="/link6">
|
|
89
|
-
Maecenas in pretium
|
|
90
|
-
</Item>
|
|
91
|
-
</Menu>
|
|
92
|
-
</Section>
|
|
93
|
-
<Section whiteBackground={false} withPadding={false}>
|
|
94
|
-
<Panel
|
|
95
|
-
title={"Leo quis"}
|
|
96
|
-
anchor={"leo-quis"}
|
|
97
|
-
highlight={true}
|
|
98
|
-
icon={<LightBulb />}
|
|
99
|
-
>
|
|
100
|
-
<MainOne title={false} />
|
|
101
|
-
</Panel>
|
|
102
|
-
<Panel title={"Proin accumsan"} anchor={"proin-accumsan"}>
|
|
103
|
-
<MainTwo title={false} />
|
|
104
|
-
</Panel>
|
|
105
|
-
<Panel
|
|
106
|
-
title={"Maecenas in pretium"}
|
|
107
|
-
anchor={"maecenas-in-pretium"}
|
|
108
|
-
icon={<Telephone />}
|
|
109
|
-
>
|
|
110
|
-
<MainThree title={false} />
|
|
111
|
-
</Panel>
|
|
112
|
-
</Section>
|
|
113
|
-
<Section right sticky>
|
|
114
|
-
<Right />
|
|
115
|
-
</Section>
|
|
116
|
-
</Layout>
|
|
117
|
-
);
|
|
118
|
-
|
|
119
|
-
ReactRouter.decorators = [
|
|
120
|
-
(Story) => (
|
|
121
|
-
<Router>
|
|
122
|
-
<Story />
|
|
123
|
-
</Router>
|
|
124
|
-
),
|
|
125
|
-
];
|
|
@@ -1,31 +0,0 @@
|
|
|
1
|
-
import { Meta, Canvas } from "@storybook/addon-docs";
|
|
2
|
-
|
|
3
|
-
<Meta title="ds-react/content-container/intro" />
|
|
4
|
-
|
|
5
|
-
# Hvordan ta i bruk ContentContainer
|
|
6
|
-
|
|
7
|
-
```jsx
|
|
8
|
-
<ContentContainer>
|
|
9
|
-
<div>innhold...</div>
|
|
10
|
-
</ContentContainer>
|
|
11
|
-
```
|
|
12
|
-
|
|
13
|
-
## Bruk
|
|
14
|
-
|
|
15
|
-
Komponenten fungerer som en wrapper rundt innholdet ditt på siden for å
|
|
16
|
-
justere padding og max-width. Dette er all stylingen som blir applied
|
|
17
|
-
|
|
18
|
-
```css
|
|
19
|
-
.navds-content-container {
|
|
20
|
-
margin-left: auto;
|
|
21
|
-
margin-right: auto;
|
|
22
|
-
max-width: var(--navds-content-container-max-width);
|
|
23
|
-
padding: var(--navds-content-container-padding-small);
|
|
24
|
-
}
|
|
25
|
-
|
|
26
|
-
@media (min-width: 448px) {
|
|
27
|
-
.navds-content-container {
|
|
28
|
-
padding: var(--navds-content-container-padding-medium-and-larger);
|
|
29
|
-
}
|
|
30
|
-
}
|
|
31
|
-
```
|