@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
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import React, { forwardRef } from "react";
|
|
2
|
+
import cl from "classnames";
|
|
3
|
+
|
|
4
|
+
export interface ModalContentProps
|
|
5
|
+
extends React.HTMLAttributes<HTMLDivElement> {
|
|
6
|
+
/**
|
|
7
|
+
* Modal.Content content
|
|
8
|
+
*/
|
|
9
|
+
children: React.ReactNode;
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
export type ModalContentType = React.ForwardRefExoticComponent<
|
|
13
|
+
ModalContentProps & React.RefAttributes<HTMLDivElement>
|
|
14
|
+
>;
|
|
15
|
+
|
|
16
|
+
const ModalContent: ModalContentType = forwardRef(
|
|
17
|
+
({ className, ...rest }, ref) => (
|
|
18
|
+
<div
|
|
19
|
+
{...rest}
|
|
20
|
+
ref={ref}
|
|
21
|
+
className={cl("navds-modal__content", className)}
|
|
22
|
+
/>
|
|
23
|
+
)
|
|
24
|
+
);
|
|
25
|
+
|
|
26
|
+
export default ModalContent;
|
package/src/modal/index.ts
CHANGED
|
@@ -15,9 +15,18 @@ vil `onClose`-triggre og det er opp til systemet å håndtere det.
|
|
|
15
15
|
|
|
16
16
|
```jsx
|
|
17
17
|
<Modal open={open} onClose={() => setOpen(false)}>
|
|
18
|
+
<Modal.Content>
|
|
19
|
+
<h2>Heading</h2>
|
|
20
|
+
<p>
|
|
21
|
+
Cupidatat irure ipsum veniam ad in esse. Voluptate do nulla amet
|
|
22
|
+
laboriselit sit dolor aliquip velit esse. Excepteur sint non minim nulla
|
|
23
|
+
excepteur labore non magna eu.
|
|
24
|
+
</p>
|
|
25
|
+
</Modal.Content>
|
|
26
|
+
</Modal>
|
|
18
27
|
```
|
|
19
28
|
|
|
20
29
|
## shouldCloseOnOverlayClick
|
|
21
30
|
|
|
22
31
|
Proppen `shouldCloseOnOverlayClick` toggler om `onClose` skal triggres
|
|
23
|
-
når bruker trykker utenfor modalen (overlayet).
|
|
32
|
+
når bruker trykker utenfor modalen (overlayet). Er default: true .
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import React, { useState } from "react";
|
|
2
|
-
import { Modal } from "
|
|
2
|
+
import { Modal } from "../..";
|
|
3
3
|
|
|
4
4
|
export default {
|
|
5
5
|
title: "ds-react/modal",
|
|
@@ -16,17 +16,12 @@ export const All = () => {
|
|
|
16
16
|
<>
|
|
17
17
|
<button onClick={() => setOpen(true)}>Open modal</button>
|
|
18
18
|
<Modal open={open} onClose={() => setOpen(false)}>
|
|
19
|
-
<
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
Cupidatat irure ipsum veniam ad in esse
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
anim cupidatat. Adipisicing ut aliqua cillum nulla elit. Mollit et id
|
|
26
|
-
duis cupidatat labore magna consectetur et veniam tempor. In minim
|
|
27
|
-
exercitation id irure velit sit dolor aliquip velit esse. Excepteur
|
|
28
|
-
sint non minim nulla excepteur labore non magna eu.
|
|
29
|
-
</p>
|
|
19
|
+
<Modal.Content>
|
|
20
|
+
<h1>Header</h1>
|
|
21
|
+
<h2>subheader</h2>
|
|
22
|
+
<p>Cupidatat irure ipsum veniam ad in esse.</p>
|
|
23
|
+
<p>Cillum tempor pariatur amet ut laborum Lorem enim enim.</p>
|
|
24
|
+
</Modal.Content>
|
|
30
25
|
</Modal>
|
|
31
26
|
|
|
32
27
|
<button onClick={() => setOpenTwo(true)}>
|
|
@@ -37,17 +32,19 @@ export const All = () => {
|
|
|
37
32
|
open={openTwo}
|
|
38
33
|
onClose={() => setOpenTwo(false)}
|
|
39
34
|
>
|
|
40
|
-
<
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
35
|
+
<Modal.Content>
|
|
36
|
+
<h1>Header</h1>
|
|
37
|
+
<h2>subheader</h2>
|
|
38
|
+
<p>
|
|
39
|
+
Cupidatat irure ipsum veniam ad in esse. Voluptate do nulla amet
|
|
40
|
+
laboris ea ex aliquip. Dolore dolore reprehenderit sint esse commodo
|
|
41
|
+
aliqua cupidatat incididunt proident laborum qui. Officia fugiat non
|
|
42
|
+
anim cupidatat. Adipisicing ut aliqua cillum nulla elit. Mollit et
|
|
43
|
+
id duis cupidatat labore magna consectetur et veniam tempor. In
|
|
44
|
+
minim exercitation id irure velit sit dolor aliquip velit esse.
|
|
45
|
+
Excepteur sint non minim nulla excepteur labore non magna eu.
|
|
46
|
+
</p>
|
|
47
|
+
</Modal.Content>
|
|
51
48
|
</Modal>
|
|
52
49
|
</>
|
|
53
50
|
);
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
import React, { forwardRef, HTMLAttributes } from "react";
|
|
2
|
+
import cl from "classnames";
|
|
3
|
+
import { BodyShort, Heading } from "..";
|
|
4
|
+
|
|
5
|
+
export interface PageHeaderProps extends HTMLAttributes<HTMLDivElement> {
|
|
6
|
+
/**
|
|
7
|
+
* PageHeader title
|
|
8
|
+
*/
|
|
9
|
+
children: string;
|
|
10
|
+
/**
|
|
11
|
+
* Pictogram placed in PageHeader
|
|
12
|
+
*/
|
|
13
|
+
illustration?: React.ReactNode;
|
|
14
|
+
/**
|
|
15
|
+
* Short text placed under title
|
|
16
|
+
*/
|
|
17
|
+
description?: string;
|
|
18
|
+
/**
|
|
19
|
+
* Predefined variants for PageHeader
|
|
20
|
+
* @default "guide"
|
|
21
|
+
*/
|
|
22
|
+
variant?: "situation" | "product" | "guide";
|
|
23
|
+
/**
|
|
24
|
+
* Decides how to align content
|
|
25
|
+
* @default "left"
|
|
26
|
+
*/
|
|
27
|
+
align?: "left" | "center";
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
const PageHeader = forwardRef<HTMLDivElement, PageHeaderProps>(
|
|
31
|
+
(
|
|
32
|
+
{
|
|
33
|
+
children,
|
|
34
|
+
className,
|
|
35
|
+
illustration,
|
|
36
|
+
description,
|
|
37
|
+
variant = "guide",
|
|
38
|
+
align = "left",
|
|
39
|
+
...rest
|
|
40
|
+
},
|
|
41
|
+
ref
|
|
42
|
+
) => {
|
|
43
|
+
return (
|
|
44
|
+
<div
|
|
45
|
+
ref={ref}
|
|
46
|
+
className={cl(
|
|
47
|
+
"navds-page-header",
|
|
48
|
+
className,
|
|
49
|
+
`navds-page-header--${variant}`,
|
|
50
|
+
`navds-page-header--${align}`
|
|
51
|
+
)}
|
|
52
|
+
{...rest}
|
|
53
|
+
>
|
|
54
|
+
{illustration && (
|
|
55
|
+
<div className="navds-page-header__illustration">{illustration}</div>
|
|
56
|
+
)}
|
|
57
|
+
<div className="navds-page-header__wrapper">
|
|
58
|
+
<Heading
|
|
59
|
+
className="navds-page-header__title"
|
|
60
|
+
size="2xlarge"
|
|
61
|
+
level="1"
|
|
62
|
+
>
|
|
63
|
+
{children}
|
|
64
|
+
</Heading>
|
|
65
|
+
{description && (
|
|
66
|
+
<BodyShort className="navds-page-header__description">
|
|
67
|
+
{description}
|
|
68
|
+
</BodyShort>
|
|
69
|
+
)}
|
|
70
|
+
</div>
|
|
71
|
+
</div>
|
|
72
|
+
);
|
|
73
|
+
}
|
|
74
|
+
);
|
|
75
|
+
|
|
76
|
+
export default PageHeader;
|
|
@@ -1,38 +1,38 @@
|
|
|
1
1
|
import { Meta, Canvas } from "@storybook/addon-docs";
|
|
2
|
-
import {
|
|
2
|
+
import { PageHeader } from "../index";
|
|
3
3
|
import { illustrationPictogram } from "./pictogram";
|
|
4
4
|
|
|
5
|
-
<Meta title="ds-react/header/intro" />
|
|
5
|
+
<Meta title="ds-react/page-header/intro" />
|
|
6
6
|
|
|
7
|
-
# Hvordan ta i bruk
|
|
7
|
+
# Hvordan ta i bruk PageHeader
|
|
8
8
|
|
|
9
|
-
Denne
|
|
9
|
+
Denne PageHeader-komponenten er utviklet i sammenheng med nye produktsider på NAV og
|
|
10
10
|
vil sannsynligvis forgå en del endringer før de er ferdige.
|
|
11
11
|
|
|
12
12
|
```jsx
|
|
13
|
-
<
|
|
13
|
+
<PageHeader description="LABORIS AUTE DESERUNT ID AUTE OFFICIA SINT SUNT FUGIAT EX ET CUPIDATAT CONSEQUAT DOLORE.">
|
|
14
14
|
AUTE OFFICIA SINT SUNT FUGIAT
|
|
15
|
-
</
|
|
15
|
+
</PageHeader>
|
|
16
16
|
```
|
|
17
17
|
|
|
18
18
|
<Canvas>
|
|
19
|
-
<
|
|
19
|
+
<PageHeader description="LABORIS AUTE DESERUNT ID AUTE OFFICIA SINT SUNT FUGIAT EX ET CUPIDATAT CONSEQUAT DOLORE.">
|
|
20
20
|
AUTE OFFICIA SINT SUNT FUGIAT
|
|
21
|
-
</
|
|
21
|
+
</PageHeader>
|
|
22
22
|
</Canvas>
|
|
23
23
|
|
|
24
24
|
## Med illustrasjon
|
|
25
25
|
|
|
26
|
-
Illustrasjonene brukt i
|
|
26
|
+
Illustrasjonene brukt i PageHeader er "Pictogram" som er designet for den sepsifikke siden og
|
|
27
27
|
man skal da ikke bare velge et fra figma vilkårlig.
|
|
28
28
|
|
|
29
29
|
<Canvas>
|
|
30
|
-
<
|
|
30
|
+
<PageHeader
|
|
31
31
|
illustration={illustrationPictogram}
|
|
32
32
|
description="LABORIS AUTE DESERUNT ID AUTE OFFICIA SINT SUNT FUGIAT EX ET CUPIDATAT CONSEQUAT DOLORE."
|
|
33
33
|
>
|
|
34
34
|
AUTE OFFICIA SINT SUNT FUGIAT
|
|
35
|
-
</
|
|
35
|
+
</PageHeader>
|
|
36
36
|
</Canvas>
|
|
37
37
|
|
|
38
38
|
## Temaer
|
|
@@ -40,35 +40,42 @@ man skal da ikke bare velge et fra figma vilkårlig.
|
|
|
40
40
|
Headeren kommer i tre tema: `guide`, `product` og `situation`
|
|
41
41
|
|
|
42
42
|
<Canvas>
|
|
43
|
-
<
|
|
43
|
+
<PageHeader
|
|
44
44
|
description="LABORIS AUTE DESERUNT ID AUTE OFFICIA SINT SUNT FUGIAT EX ET CUPIDATAT CONSEQUAT DOLORE."
|
|
45
|
-
|
|
45
|
+
variant="guide"
|
|
46
46
|
>
|
|
47
47
|
AUTE OFFICIA SINT SUNT FUGIAT
|
|
48
|
-
</
|
|
49
|
-
<
|
|
48
|
+
</PageHeader>
|
|
49
|
+
<PageHeader
|
|
50
50
|
description="LABORIS AUTE DESERUNT ID AUTE OFFICIA SINT SUNT FUGIAT EX ET CUPIDATAT CONSEQUAT DOLORE."
|
|
51
|
-
|
|
51
|
+
variant="product"
|
|
52
52
|
>
|
|
53
53
|
AUTE OFFICIA SINT SUNT FUGIAT
|
|
54
|
-
</
|
|
55
|
-
<
|
|
54
|
+
</PageHeader>
|
|
55
|
+
<PageHeader
|
|
56
56
|
description="LABORIS AUTE DESERUNT ID AUTE OFFICIA SINT SUNT FUGIAT EX ET CUPIDATAT CONSEQUAT DOLORE."
|
|
57
|
-
|
|
57
|
+
variant="situation"
|
|
58
58
|
>
|
|
59
59
|
AUTE OFFICIA SINT SUNT FUGIAT
|
|
60
|
-
</
|
|
60
|
+
</PageHeader>
|
|
61
61
|
</Canvas>
|
|
62
62
|
|
|
63
63
|
## Sentrert
|
|
64
64
|
|
|
65
|
-
Innhold kan sentreres med `
|
|
65
|
+
Innhold kan sentreres med `align="center"`-prop
|
|
66
66
|
|
|
67
67
|
<Canvas>
|
|
68
|
-
<
|
|
68
|
+
<PageHeader
|
|
69
69
|
description="LABORIS AUTE DESERUNT ID AUTE OFFICIA SINT SUNT FUGIAT EX ET CUPIDATAT CONSEQUAT DOLORE."
|
|
70
|
-
|
|
70
|
+
align="center"
|
|
71
71
|
>
|
|
72
72
|
AUTE OFFICIA SINT SUNT FUGIAT
|
|
73
|
-
</
|
|
73
|
+
</PageHeader>
|
|
74
|
+
<PageHeader
|
|
75
|
+
illustration={illustrationPictogram}
|
|
76
|
+
description="LABORIS AUTE DESERUNT ID AUTE OFFICIA SINT SUNT FUGIAT EX ET CUPIDATAT CONSEQUAT DOLORE."
|
|
77
|
+
align="center"
|
|
78
|
+
>
|
|
79
|
+
AUTE OFFICIA SINT SUNT FUGIAT
|
|
80
|
+
</PageHeader>
|
|
74
81
|
</Canvas>
|
|
@@ -1,61 +1,61 @@
|
|
|
1
1
|
import React from "react";
|
|
2
|
-
import {
|
|
2
|
+
import { PageHeader } from "../index";
|
|
3
3
|
import { Meta } from "@storybook/react/types-6-0";
|
|
4
4
|
import { illustrationPictogram } from "./pictogram";
|
|
5
5
|
export default {
|
|
6
|
-
title: "ds-react/header",
|
|
7
|
-
component:
|
|
6
|
+
title: "ds-react/page-header",
|
|
7
|
+
component: PageHeader,
|
|
8
8
|
} as Meta;
|
|
9
9
|
|
|
10
10
|
export const All = () => {
|
|
11
11
|
return (
|
|
12
12
|
<div>
|
|
13
|
-
<h2>
|
|
14
|
-
<
|
|
13
|
+
<h2>PageHeader</h2>
|
|
14
|
+
<PageHeader description="LABORIS AUTE DESERUNT ID AUTE OFFICIA SINT SUNT FUGIAT EX ET CUPIDATAT CONSEQUAT DOLORE.">
|
|
15
15
|
AUTE OFFICIA SINT SUNT FUGIAT
|
|
16
|
-
</
|
|
16
|
+
</PageHeader>
|
|
17
17
|
<br />
|
|
18
|
-
<h2>
|
|
19
|
-
<
|
|
18
|
+
<h2>PageHeader m/illustration</h2>
|
|
19
|
+
<PageHeader
|
|
20
20
|
illustration={illustrationPictogram}
|
|
21
21
|
description="LABORIS AUTE DESERUNT ID AUTE OFFICIA SINT SUNT FUGIAT EX ET CUPIDATAT CONSEQUAT DOLORE."
|
|
22
22
|
>
|
|
23
23
|
AUTE OFFICIA SINT SUNT FUGIAT
|
|
24
|
-
</
|
|
25
|
-
<h2>
|
|
26
|
-
<
|
|
24
|
+
</PageHeader>
|
|
25
|
+
<h2>PageHeader center</h2>
|
|
26
|
+
<PageHeader
|
|
27
27
|
description="LABORIS AUTE DESERUNT ID AUTE OFFICIA SINT SUNT FUGIAT EX ET CUPIDATAT CONSEQUAT DOLORE."
|
|
28
|
-
|
|
28
|
+
align="center"
|
|
29
29
|
>
|
|
30
30
|
AUTE OFFICIA SINT SUNT FUGIAT
|
|
31
|
-
</
|
|
32
|
-
<h2>
|
|
33
|
-
<
|
|
31
|
+
</PageHeader>
|
|
32
|
+
<h2>PageHeader center m/illustration</h2>
|
|
33
|
+
<PageHeader
|
|
34
34
|
illustration={illustrationPictogram}
|
|
35
35
|
description="LABORIS AUTE DESERUNT ID AUTE OFFICIA SINT SUNT FUGIAT EX ET CUPIDATAT CONSEQUAT DOLORE."
|
|
36
|
-
|
|
36
|
+
align="center"
|
|
37
37
|
>
|
|
38
38
|
AUTE OFFICIA SINT SUNT FUGIAT
|
|
39
|
-
</
|
|
40
|
-
<h2>
|
|
41
|
-
<
|
|
39
|
+
</PageHeader>
|
|
40
|
+
<h2>PageHeader variants</h2>
|
|
41
|
+
<PageHeader
|
|
42
42
|
description="LABORIS AUTE DESERUNT ID AUTE OFFICIA SINT SUNT FUGIAT EX ET CUPIDATAT CONSEQUAT DOLORE."
|
|
43
|
-
|
|
43
|
+
variant="guide"
|
|
44
44
|
>
|
|
45
45
|
AUTE OFFICIA SINT SUNT FUGIAT
|
|
46
|
-
</
|
|
47
|
-
<
|
|
46
|
+
</PageHeader>
|
|
47
|
+
<PageHeader
|
|
48
48
|
description="LABORIS AUTE DESERUNT ID AUTE OFFICIA SINT SUNT FUGIAT EX ET CUPIDATAT CONSEQUAT DOLORE."
|
|
49
|
-
|
|
49
|
+
variant="product"
|
|
50
50
|
>
|
|
51
51
|
AUTE OFFICIA SINT SUNT FUGIAT
|
|
52
|
-
</
|
|
53
|
-
<
|
|
52
|
+
</PageHeader>
|
|
53
|
+
<PageHeader
|
|
54
54
|
description="LABORIS AUTE DESERUNT ID AUTE OFFICIA SINT SUNT FUGIAT EX ET CUPIDATAT CONSEQUAT DOLORE."
|
|
55
|
-
|
|
55
|
+
variant="situation"
|
|
56
56
|
>
|
|
57
57
|
AUTE OFFICIA SINT SUNT FUGIAT
|
|
58
|
-
</
|
|
58
|
+
</PageHeader>
|
|
59
59
|
</div>
|
|
60
60
|
);
|
|
61
61
|
};
|
|
File without changes
|
package/src/panel/Panel.tsx
CHANGED
|
@@ -1,33 +1,24 @@
|
|
|
1
1
|
import React, { forwardRef } from "react";
|
|
2
2
|
import cl from "classnames";
|
|
3
|
-
import { OverridableComponent } from "
|
|
3
|
+
import { OverridableComponent } from "..";
|
|
4
4
|
|
|
5
|
-
export
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
* @default false
|
|
16
|
-
*/
|
|
17
|
-
border?: boolean;
|
|
18
|
-
} & React.HTMLAttributes<HTMLElement>;
|
|
19
|
-
defaultComponent: "div";
|
|
5
|
+
export interface PanelProps extends React.HTMLAttributes<HTMLElement> {
|
|
6
|
+
/**
|
|
7
|
+
* Panel content
|
|
8
|
+
*/
|
|
9
|
+
children: React.ReactNode;
|
|
10
|
+
/**
|
|
11
|
+
* Toggles border on panel
|
|
12
|
+
* @default false
|
|
13
|
+
*/
|
|
14
|
+
border?: boolean;
|
|
20
15
|
}
|
|
21
16
|
|
|
17
|
+
export type PanelType = OverridableComponent<PanelProps, HTMLElement>;
|
|
18
|
+
|
|
22
19
|
const Panel: PanelType = forwardRef(
|
|
23
20
|
(
|
|
24
|
-
{
|
|
25
|
-
children,
|
|
26
|
-
className,
|
|
27
|
-
border = false,
|
|
28
|
-
component: Component = "div",
|
|
29
|
-
...rest
|
|
30
|
-
},
|
|
21
|
+
{ children, className, border = false, as: Component = "div", ...rest },
|
|
31
22
|
ref
|
|
32
23
|
) => {
|
|
33
24
|
return (
|
package/src/popover/Popover.tsx
CHANGED
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
import { Placement } from "@popperjs/core";
|
|
2
|
+
import cl from "classnames";
|
|
1
3
|
import React, {
|
|
2
4
|
forwardRef,
|
|
3
5
|
HTMLAttributes,
|
|
@@ -5,26 +7,26 @@ import React, {
|
|
|
5
7
|
useEffect,
|
|
6
8
|
useRef,
|
|
7
9
|
} from "react";
|
|
8
|
-
import { usePopper } from "react-popper";
|
|
9
|
-
import { Placement } from "@popperjs/core";
|
|
10
10
|
import mergeRefs from "react-merge-refs";
|
|
11
|
-
import
|
|
11
|
+
import { usePopper } from "react-popper";
|
|
12
|
+
import { useClientLayoutEffect } from "..";
|
|
13
|
+
import PopoverContent, { PopoverContentType } from "./PopoverContent";
|
|
12
14
|
|
|
13
15
|
export interface PopoverProps extends HTMLAttributes<HTMLDivElement> {
|
|
14
16
|
/**
|
|
15
|
-
* Element
|
|
17
|
+
* Element popover anchors to
|
|
16
18
|
*/
|
|
17
19
|
anchorEl: HTMLElement | null;
|
|
18
20
|
/**
|
|
19
|
-
* Open state
|
|
21
|
+
* Open state
|
|
20
22
|
*/
|
|
21
23
|
open: boolean;
|
|
22
24
|
/**
|
|
23
|
-
*
|
|
25
|
+
* onClose callback
|
|
24
26
|
*/
|
|
25
27
|
onClose: () => void;
|
|
26
28
|
/**
|
|
27
|
-
*
|
|
29
|
+
* Popover content
|
|
28
30
|
*/
|
|
29
31
|
children: React.ReactNode;
|
|
30
32
|
/**
|
|
@@ -33,12 +35,13 @@ export interface PopoverProps extends HTMLAttributes<HTMLDivElement> {
|
|
|
33
35
|
*/
|
|
34
36
|
placement?: Placement;
|
|
35
37
|
/**
|
|
36
|
-
*
|
|
38
|
+
* Toggles rendering of arrow
|
|
39
|
+
* @default true
|
|
37
40
|
*/
|
|
38
41
|
arrow?: boolean;
|
|
39
42
|
/**
|
|
40
43
|
* Distance from anchor to popover
|
|
41
|
-
* @default 16 w/arrow, 4
|
|
44
|
+
* @default 16 w/arrow, 4 w/no-arrow
|
|
42
45
|
*/
|
|
43
46
|
offset?: number;
|
|
44
47
|
}
|
|
@@ -51,6 +54,13 @@ const useEventLister = (event: string, callback) =>
|
|
|
51
54
|
};
|
|
52
55
|
}, [event, callback]);
|
|
53
56
|
|
|
57
|
+
interface PopoverComponent
|
|
58
|
+
extends React.ForwardRefExoticComponent<
|
|
59
|
+
PopoverProps & React.RefAttributes<HTMLDivElement>
|
|
60
|
+
> {
|
|
61
|
+
Content: PopoverContentType;
|
|
62
|
+
}
|
|
63
|
+
|
|
54
64
|
const Popover = forwardRef<HTMLDivElement, PopoverProps>(
|
|
55
65
|
(
|
|
56
66
|
{
|
|
@@ -120,11 +130,17 @@ const Popover = forwardRef<HTMLDivElement, PopoverProps>(
|
|
|
120
130
|
offset: [0, offset ?? (arrow ? 16 : 4)],
|
|
121
131
|
},
|
|
122
132
|
},
|
|
133
|
+
{
|
|
134
|
+
name: "arrow",
|
|
135
|
+
options: {
|
|
136
|
+
padding: 8,
|
|
137
|
+
},
|
|
138
|
+
},
|
|
123
139
|
],
|
|
124
140
|
}
|
|
125
141
|
);
|
|
126
142
|
|
|
127
|
-
|
|
143
|
+
useClientLayoutEffect(() => {
|
|
128
144
|
open && update && update();
|
|
129
145
|
}, [open, update]);
|
|
130
146
|
|
|
@@ -152,6 +168,8 @@ const Popover = forwardRef<HTMLDivElement, PopoverProps>(
|
|
|
152
168
|
</div>
|
|
153
169
|
);
|
|
154
170
|
}
|
|
155
|
-
);
|
|
171
|
+
) as PopoverComponent;
|
|
172
|
+
|
|
173
|
+
Popover.Content = PopoverContent;
|
|
156
174
|
|
|
157
175
|
export default Popover;
|