@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
package/src/alert/Alert.tsx
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import React, { forwardRef } from "react";
|
|
1
|
+
import React, { createContext, forwardRef } from "react";
|
|
2
2
|
import cl from "classnames";
|
|
3
3
|
import {
|
|
4
4
|
ErrorFilled,
|
|
@@ -6,80 +6,103 @@ import {
|
|
|
6
6
|
InformationFilled,
|
|
7
7
|
SuccessFilled,
|
|
8
8
|
} from "@navikt/ds-icons";
|
|
9
|
+
import AlertContent, { AlertContentType } from "./AlertContent";
|
|
10
|
+
import AlertTitle, { AlertTitleType } from "./AlertTitle";
|
|
11
|
+
import { BodyLong } from "..";
|
|
9
12
|
|
|
10
13
|
export interface AlertProps extends React.HTMLAttributes<HTMLDivElement> {
|
|
14
|
+
/**
|
|
15
|
+
* Alert content
|
|
16
|
+
*/
|
|
17
|
+
children: React.ReactNode;
|
|
11
18
|
/**
|
|
12
19
|
* Decides what design the alert will have
|
|
13
20
|
*/
|
|
14
21
|
variant: "error" | "warning" | "info" | "success";
|
|
15
|
-
children: React.ReactNode;
|
|
16
22
|
/**
|
|
17
23
|
* Changes padding and font-sizes
|
|
18
|
-
* @default "
|
|
24
|
+
* @default "medium"
|
|
25
|
+
*/
|
|
26
|
+
size?: "medium" | "small";
|
|
27
|
+
/**
|
|
28
|
+
* Toggles full-width Alert
|
|
29
|
+
* @default false
|
|
30
|
+
*/
|
|
31
|
+
fullWidth?: boolean;
|
|
32
|
+
/**
|
|
33
|
+
* Removes background from Alert
|
|
19
34
|
*/
|
|
20
|
-
|
|
35
|
+
inline?: boolean;
|
|
21
36
|
}
|
|
22
37
|
|
|
23
|
-
const Icon = ({ variant }) => {
|
|
38
|
+
const Icon = ({ variant, ...props }) => {
|
|
24
39
|
switch (variant) {
|
|
25
40
|
case "error":
|
|
26
|
-
return
|
|
27
|
-
<ErrorFilled
|
|
28
|
-
aria-label={`${variant}-ikon`}
|
|
29
|
-
focusable="false"
|
|
30
|
-
role="img"
|
|
31
|
-
/>
|
|
32
|
-
);
|
|
41
|
+
return <ErrorFilled {...props} />;
|
|
33
42
|
case "warning":
|
|
34
|
-
return
|
|
35
|
-
<WarningFilled
|
|
36
|
-
aria-label={`${variant}-ikon`}
|
|
37
|
-
focusable="false"
|
|
38
|
-
role="img"
|
|
39
|
-
/>
|
|
40
|
-
);
|
|
43
|
+
return <WarningFilled {...props} />;
|
|
41
44
|
case "info":
|
|
42
|
-
return
|
|
43
|
-
<InformationFilled
|
|
44
|
-
aria-label={`${variant}-ikon`}
|
|
45
|
-
focusable="false"
|
|
46
|
-
role="img"
|
|
47
|
-
/>
|
|
48
|
-
);
|
|
45
|
+
return <InformationFilled {...props} />;
|
|
49
46
|
case "success":
|
|
50
|
-
return
|
|
51
|
-
<SuccessFilled
|
|
52
|
-
aria-label={`${variant}-ikon`}
|
|
53
|
-
focusable="false"
|
|
54
|
-
role="img"
|
|
55
|
-
/>
|
|
56
|
-
);
|
|
47
|
+
return <SuccessFilled {...props} />;
|
|
57
48
|
default:
|
|
58
49
|
return null;
|
|
59
50
|
}
|
|
60
51
|
};
|
|
61
52
|
|
|
53
|
+
export interface AlertContextProps {
|
|
54
|
+
size: "medium" | "small";
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
export const AlertContext = createContext<AlertContextProps | null>(null);
|
|
58
|
+
interface AlertComponent
|
|
59
|
+
extends React.ForwardRefExoticComponent<
|
|
60
|
+
AlertProps & React.RefAttributes<HTMLDivElement>
|
|
61
|
+
> {
|
|
62
|
+
Title: AlertTitleType;
|
|
63
|
+
Content: AlertContentType;
|
|
64
|
+
}
|
|
65
|
+
|
|
62
66
|
const Alert = forwardRef<HTMLDivElement, AlertProps>(
|
|
63
|
-
(
|
|
67
|
+
(
|
|
68
|
+
{
|
|
69
|
+
children,
|
|
70
|
+
className,
|
|
71
|
+
variant,
|
|
72
|
+
size = "medium",
|
|
73
|
+
fullWidth = false,
|
|
74
|
+
inline = false,
|
|
75
|
+
...rest
|
|
76
|
+
},
|
|
77
|
+
ref
|
|
78
|
+
) => (
|
|
64
79
|
<div
|
|
80
|
+
{...rest}
|
|
65
81
|
ref={ref}
|
|
66
82
|
className={cl(
|
|
67
83
|
className,
|
|
68
84
|
"navds-alert",
|
|
69
85
|
`navds-alert--${variant}`,
|
|
70
86
|
`navds-alert--${size}`,
|
|
71
|
-
"navds-
|
|
72
|
-
{ "navds-body--s": size === "s" }
|
|
87
|
+
{ "navds-alert--full-width": fullWidth, "navds-alert--inline": inline }
|
|
73
88
|
)}
|
|
74
|
-
{...rest}
|
|
75
89
|
>
|
|
76
|
-
<
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
90
|
+
<Icon
|
|
91
|
+
aria-label={`${variant}-ikon`}
|
|
92
|
+
focusable="false"
|
|
93
|
+
role="img"
|
|
94
|
+
variant={variant}
|
|
95
|
+
alt={`${variant}-ikon`}
|
|
96
|
+
className="navds-alert__icon"
|
|
97
|
+
/>
|
|
98
|
+
<BodyLong as="div" size={size} className="navds-alert__wrapper">
|
|
99
|
+
{children}
|
|
100
|
+
</BodyLong>
|
|
81
101
|
</div>
|
|
82
102
|
)
|
|
83
|
-
);
|
|
103
|
+
) as AlertComponent;
|
|
104
|
+
|
|
105
|
+
Alert.Title = AlertTitle;
|
|
106
|
+
Alert.Content = AlertContent;
|
|
84
107
|
|
|
85
108
|
export default Alert;
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import React, { forwardRef, useContext } from "react";
|
|
2
|
+
import cl from "classnames";
|
|
3
|
+
import { BodyLong } from "..";
|
|
4
|
+
import { AlertContext } from ".";
|
|
5
|
+
|
|
6
|
+
export interface AlertContentProps
|
|
7
|
+
extends React.HTMLAttributes<HTMLDivElement> {
|
|
8
|
+
/**
|
|
9
|
+
* Alert content
|
|
10
|
+
*/
|
|
11
|
+
children: React.ReactNode;
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
export type AlertContentType = React.ForwardRefExoticComponent<
|
|
15
|
+
AlertContentProps & React.RefAttributes<HTMLDivElement>
|
|
16
|
+
>;
|
|
17
|
+
|
|
18
|
+
const AlertContent: AlertContentType = forwardRef(
|
|
19
|
+
({ children, className, ...rest }, ref) => {
|
|
20
|
+
const context = useContext(AlertContext);
|
|
21
|
+
|
|
22
|
+
if (context === null) {
|
|
23
|
+
console.warn("AlertContent has to be wrapped in <Alert />");
|
|
24
|
+
return null;
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
return (
|
|
28
|
+
<BodyLong
|
|
29
|
+
{...rest}
|
|
30
|
+
as="div"
|
|
31
|
+
className={cl(className, "navds-alert__content")}
|
|
32
|
+
ref={ref}
|
|
33
|
+
size={context.size ?? "medium"}
|
|
34
|
+
>
|
|
35
|
+
{children}
|
|
36
|
+
</BodyLong>
|
|
37
|
+
);
|
|
38
|
+
}
|
|
39
|
+
);
|
|
40
|
+
|
|
41
|
+
export default AlertContent;
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import React, { forwardRef, useContext } from "react";
|
|
2
|
+
import cl from "classnames";
|
|
3
|
+
import { AlertContext, Heading } from "..";
|
|
4
|
+
|
|
5
|
+
export interface AlertTitleProps extends React.HTMLAttributes<HTMLDivElement> {
|
|
6
|
+
/**
|
|
7
|
+
* Alert content
|
|
8
|
+
*/
|
|
9
|
+
children: React.ReactNode;
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
export type AlertTitleType = React.ForwardRefExoticComponent<
|
|
13
|
+
AlertTitleProps & React.RefAttributes<HTMLDivElement>
|
|
14
|
+
>;
|
|
15
|
+
|
|
16
|
+
const AlertTitle: AlertTitleType = forwardRef(
|
|
17
|
+
({ children, className, ...rest }, ref) => {
|
|
18
|
+
const context = useContext(AlertContext);
|
|
19
|
+
|
|
20
|
+
if (context === null) {
|
|
21
|
+
console.warn("AlertTitle has to be wrapped in <Alert />");
|
|
22
|
+
return null;
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
const size = context.size === "medium" ? "small" : "xsmall";
|
|
26
|
+
|
|
27
|
+
return (
|
|
28
|
+
<Heading
|
|
29
|
+
{...rest}
|
|
30
|
+
ref={ref}
|
|
31
|
+
className={cl(className, "navds-alert__title")}
|
|
32
|
+
as="div"
|
|
33
|
+
size={size}
|
|
34
|
+
>
|
|
35
|
+
{children}
|
|
36
|
+
</Heading>
|
|
37
|
+
);
|
|
38
|
+
}
|
|
39
|
+
);
|
|
40
|
+
|
|
41
|
+
export default AlertTitle;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { Meta, Canvas } from "@storybook/addon-docs";
|
|
2
|
-
import { Alert } from "../../index";
|
|
2
|
+
import { Alert, Heading, BodyLong } from "../../index";
|
|
3
3
|
|
|
4
4
|
<Meta title="ds-react/alert/intro" />
|
|
5
5
|
|
|
@@ -26,7 +26,7 @@ import { Alert } from "../../index";
|
|
|
26
26
|
## Varianter
|
|
27
27
|
|
|
28
28
|
`variants`-prop kan brukes for å endre utseende mellom
|
|
29
|
-
`info`, `success`, `warning` og `error
|
|
29
|
+
`info`, `success`, `warning` og `error`.
|
|
30
30
|
|
|
31
31
|
<Canvas>
|
|
32
32
|
<Alert variant="info">Id elit esse enim reprehenderit.</Alert>
|
|
@@ -37,19 +37,60 @@ import { Alert } from "../../index";
|
|
|
37
37
|
|
|
38
38
|
## Sizing
|
|
39
39
|
|
|
40
|
-
Alert har to størrelser: Default 64px
|
|
40
|
+
Alert har to størrelser: Default 64px height og small 32px height default.
|
|
41
41
|
|
|
42
42
|
<Canvas>
|
|
43
|
-
<Alert size="
|
|
43
|
+
<Alert size="small" variant="info">
|
|
44
44
|
Id elit esse enim reprehenderit.
|
|
45
45
|
</Alert>
|
|
46
|
-
<Alert size="
|
|
46
|
+
<Alert size="small" variant="success">
|
|
47
47
|
Id elit esse enim reprehenderit.
|
|
48
48
|
</Alert>
|
|
49
|
-
<Alert size="
|
|
49
|
+
<Alert size="small" variant="warning">
|
|
50
50
|
Id elit esse enim reprehenderit.
|
|
51
51
|
</Alert>
|
|
52
|
-
<Alert size="
|
|
52
|
+
<Alert size="small" variant="error">
|
|
53
53
|
Id elit esse enim reprehenderit.
|
|
54
54
|
</Alert>
|
|
55
55
|
</Canvas>
|
|
56
|
+
|
|
57
|
+
## fullWidth
|
|
58
|
+
|
|
59
|
+
<Canvas>
|
|
60
|
+
<div style={{ margin: 32, display: "grid", gap: 16 }}>
|
|
61
|
+
<Alert fullWidth variant="info">
|
|
62
|
+
Id elit esse enim reprehenderit.
|
|
63
|
+
</Alert>
|
|
64
|
+
<Alert fullWidth size="small" variant="info">
|
|
65
|
+
Id elit esse enim reprehenderit.
|
|
66
|
+
</Alert>
|
|
67
|
+
</div>
|
|
68
|
+
</Canvas>
|
|
69
|
+
|
|
70
|
+
## Med heading
|
|
71
|
+
|
|
72
|
+
```jsx
|
|
73
|
+
<Alert variant="info">
|
|
74
|
+
<Heading spacing size="small" level="2">
|
|
75
|
+
Aliquip duis est in commodo pariatur
|
|
76
|
+
</Heading>
|
|
77
|
+
<BodyLong>
|
|
78
|
+
Ullamco ullamco laborum et commodo sint culpa cupidatat culpa qui laboris
|
|
79
|
+
ex. Labore ex occaecat proident qui qui fugiat magna. Fugiat sint commodo
|
|
80
|
+
consequat eu aute.
|
|
81
|
+
</BodyLong>
|
|
82
|
+
</Alert>
|
|
83
|
+
```
|
|
84
|
+
|
|
85
|
+
<Canvas>
|
|
86
|
+
<Alert variant="info">
|
|
87
|
+
<Heading spacing size="small" level="3">
|
|
88
|
+
Aliquip duis est in commodo pariatur
|
|
89
|
+
</Heading>
|
|
90
|
+
<BodyLong>
|
|
91
|
+
Ullamco ullamco laborum et commodo sint culpa cupidatat culpa qui laboris
|
|
92
|
+
ex. Labore ex occaecat proident qui qui fugiat magna. Fugiat sint commodo
|
|
93
|
+
consequat eu aute.
|
|
94
|
+
</BodyLong>
|
|
95
|
+
</Alert>
|
|
96
|
+
</Canvas>
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import React from "react";
|
|
2
|
-
import { Alert } from "
|
|
2
|
+
import { Alert } from "..";
|
|
3
|
+
import { BodyLong, Heading } from "../..";
|
|
3
4
|
|
|
4
5
|
export default {
|
|
5
6
|
title: "ds-react/alert",
|
|
@@ -17,21 +18,104 @@ export const All = () => {
|
|
|
17
18
|
return (
|
|
18
19
|
<>
|
|
19
20
|
<h1>Alert</h1>
|
|
20
|
-
{variants.map((variant) => (
|
|
21
|
+
{variants.map((variant, i) => (
|
|
21
22
|
<Alert key={variant} variant={variant}>
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
eiusmod Lorem amet ad esse.
|
|
23
|
+
{new Array(i + 1).fill(
|
|
24
|
+
"Id elit esse enim reprehenderit enim nisi veniam nostrud."
|
|
25
|
+
)}
|
|
26
26
|
</Alert>
|
|
27
27
|
))}
|
|
28
28
|
<h2>Small</h2>
|
|
29
29
|
<div>
|
|
30
|
-
{variants.map((variant) => (
|
|
31
|
-
<Alert key={variant} variant={variant} size="
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
30
|
+
{variants.map((variant, i) => (
|
|
31
|
+
<Alert key={variant} variant={variant} size="small">
|
|
32
|
+
{new Array(i + 1).fill(
|
|
33
|
+
"Id elit esse enim reprehenderit enim nisi veniam nostrud."
|
|
34
|
+
)}
|
|
35
|
+
</Alert>
|
|
36
|
+
))}
|
|
37
|
+
</div>
|
|
38
|
+
<h2>Alert fullWidth</h2>
|
|
39
|
+
{variants.map((variant, i) => (
|
|
40
|
+
<Alert fullWidth key={variant} variant={variant}>
|
|
41
|
+
{new Array(i + 1).fill(
|
|
42
|
+
"Id elit esse enim reprehenderit enim nisi veniam nostrud."
|
|
43
|
+
)}
|
|
44
|
+
</Alert>
|
|
45
|
+
))}
|
|
46
|
+
<h2>Small</h2>
|
|
47
|
+
<div>
|
|
48
|
+
{variants.map((variant, i) => (
|
|
49
|
+
<Alert fullWidth key={variant} variant={variant} size="small">
|
|
50
|
+
{new Array(i + 1).fill(
|
|
51
|
+
"Id elit esse enim reprehenderit enim nisi veniam nostrud."
|
|
52
|
+
)}
|
|
53
|
+
</Alert>
|
|
54
|
+
))}
|
|
55
|
+
</div>
|
|
56
|
+
<h2>Inline</h2>
|
|
57
|
+
<div>
|
|
58
|
+
{variants.map((variant, i) => (
|
|
59
|
+
<Alert inline key={variant} variant={variant}>
|
|
60
|
+
{new Array(i + 1).fill(
|
|
61
|
+
"Id elit esse enim reprehenderit enim nisi veniam nostrud."
|
|
62
|
+
)}
|
|
63
|
+
</Alert>
|
|
64
|
+
))}
|
|
65
|
+
</div>
|
|
66
|
+
<h2>Inline small</h2>
|
|
67
|
+
<div>
|
|
68
|
+
{variants.map((variant, i) => (
|
|
69
|
+
<Alert inline key={variant} variant={variant} size="small">
|
|
70
|
+
{new Array(i + 1).fill(
|
|
71
|
+
"Id elit esse enim reprehenderit enim nisi veniam nostrud."
|
|
72
|
+
)}
|
|
73
|
+
</Alert>
|
|
74
|
+
))}
|
|
75
|
+
</div>
|
|
76
|
+
<h2>Med Heading</h2>
|
|
77
|
+
<div>
|
|
78
|
+
{variants.map((variant, i) => (
|
|
79
|
+
<Alert key={variant} variant={variant}>
|
|
80
|
+
<Heading spacing size="small" level="3">
|
|
81
|
+
Aliquip duis est in commodo pariatur
|
|
82
|
+
</Heading>
|
|
83
|
+
<BodyLong spacing>
|
|
84
|
+
Ullamco ullamco laborum et commodo sint culpa cupidatat culpa qui
|
|
85
|
+
laboris ex. Labore ex occaecat proident qui qui fugiat magna.
|
|
86
|
+
Fugiat sint commodo consequat eu aute.
|
|
87
|
+
</BodyLong>
|
|
88
|
+
<Heading level="4" size="xsmall" spacing>
|
|
89
|
+
Ullamco eiusmod Lorem eiusmod eu.
|
|
90
|
+
</Heading>
|
|
91
|
+
<BodyLong>
|
|
92
|
+
Ullamco ullamco laborum et commodo sint culpa cupidatat culpa qui
|
|
93
|
+
laboris ex. Labore ex occaecat proident qui qui fugiat magna.
|
|
94
|
+
Fugiat sint commodo consequat eu aute.
|
|
95
|
+
</BodyLong>
|
|
96
|
+
</Alert>
|
|
97
|
+
))}
|
|
98
|
+
</div>
|
|
99
|
+
<h2>Med Heading small</h2>
|
|
100
|
+
<div>
|
|
101
|
+
{variants.map((variant, i) => (
|
|
102
|
+
<Alert key={variant} variant={variant} size="small">
|
|
103
|
+
<Heading spacing size="small" level="3">
|
|
104
|
+
Aliquip duis est in commodo pariatur
|
|
105
|
+
</Heading>
|
|
106
|
+
<BodyLong spacing>
|
|
107
|
+
Ullamco ullamco laborum et commodo sint culpa cupidatat culpa qui
|
|
108
|
+
laboris ex. Labore ex occaecat proident qui qui fugiat magna.
|
|
109
|
+
Fugiat sint commodo consequat eu aute.
|
|
110
|
+
</BodyLong>
|
|
111
|
+
<Heading level="4" size="xsmall" spacing>
|
|
112
|
+
Ullamco eiusmod Lorem eiusmod eu.
|
|
113
|
+
</Heading>
|
|
114
|
+
<BodyLong>
|
|
115
|
+
Ullamco ullamco laborum et commodo sint culpa cupidatat culpa qui
|
|
116
|
+
laboris ex. Labore ex occaecat proident qui qui fugiat magna.
|
|
117
|
+
Fugiat sint commodo consequat eu aute.
|
|
118
|
+
</BodyLong>
|
|
35
119
|
</Alert>
|
|
36
120
|
))}
|
|
37
121
|
</div>
|
package/src/button/Button.tsx
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import React, { forwardRef } from "react";
|
|
2
2
|
import cl from "classnames";
|
|
3
|
+
import { BodyShort, OverridableComponent } from "../";
|
|
3
4
|
|
|
4
5
|
export interface ButtonProps
|
|
5
6
|
extends React.ButtonHTMLAttributes<HTMLButtonElement> {
|
|
@@ -11,12 +12,12 @@ export interface ButtonProps
|
|
|
11
12
|
* Changes design and interactions
|
|
12
13
|
* @default "primary"
|
|
13
14
|
*/
|
|
14
|
-
variant?: "primary" | "secondary" | "
|
|
15
|
+
variant?: "primary" | "secondary" | "tertiary" | "danger";
|
|
15
16
|
/**
|
|
16
17
|
* Changes padding, height and font-size
|
|
17
|
-
* @default "
|
|
18
|
+
* @default "medium"
|
|
18
19
|
*/
|
|
19
|
-
size?: "
|
|
20
|
+
size?: "medium" | "small";
|
|
20
21
|
/**
|
|
21
22
|
* Prevent the user from interacting with the button: it cannot be pressed or focused.
|
|
22
23
|
* @note Avoid using if possible for accessibility purposes
|
|
@@ -25,20 +26,32 @@ export interface ButtonProps
|
|
|
25
26
|
disabled?: boolean;
|
|
26
27
|
}
|
|
27
28
|
|
|
28
|
-
const Button
|
|
29
|
-
(
|
|
30
|
-
|
|
29
|
+
const Button: OverridableComponent<ButtonProps, HTMLButtonElement> = forwardRef(
|
|
30
|
+
(
|
|
31
|
+
{
|
|
32
|
+
as: Component = "button",
|
|
33
|
+
variant = "primary",
|
|
34
|
+
className,
|
|
35
|
+
children,
|
|
36
|
+
size = "medium",
|
|
37
|
+
...rest
|
|
38
|
+
},
|
|
39
|
+
ref
|
|
40
|
+
) => (
|
|
41
|
+
<Component
|
|
42
|
+
{...rest}
|
|
31
43
|
ref={ref}
|
|
32
44
|
className={cl(
|
|
33
45
|
className,
|
|
34
46
|
"navds-button",
|
|
35
47
|
`navds-button--${variant}`,
|
|
36
|
-
`navds-button--${size}
|
|
37
|
-
"navds-body-short",
|
|
38
|
-
{ "navds-body--s": size === "s" }
|
|
48
|
+
`navds-button--${size}`
|
|
39
49
|
)}
|
|
40
|
-
|
|
41
|
-
|
|
50
|
+
>
|
|
51
|
+
<BodyShort as="span" className="navds-button__inner" size={size}>
|
|
52
|
+
{children}
|
|
53
|
+
</BodyShort>
|
|
54
|
+
</Component>
|
|
42
55
|
)
|
|
43
56
|
);
|
|
44
57
|
|