@navikt/ds-react 0.19.25 → 1.0.0-rc.3
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/README.md +43 -0
- package/_docs.json +364 -520
- package/cjs/accordion/Accordion.js +2 -2
- package/cjs/accordion/AccordionContent.js +5 -9
- package/cjs/accordion/AccordionHeader.js +5 -10
- package/cjs/accordion/AccordionItem.js +3 -7
- package/cjs/alert/Alert.js +2 -2
- package/cjs/button/Button.js +9 -7
- package/cjs/{speech-bubble → chat}/Bubble.js +7 -4
- package/cjs/{speech-bubble/SpeechBubble.js → chat/Chat.js} +11 -10
- package/cjs/{menu → chat}/index.js +3 -3
- package/cjs/chat/package.json +6 -0
- package/cjs/form/ConfirmationPanel.js +3 -3
- package/cjs/form/Fieldset/Fieldset.js +6 -6
- package/cjs/form/Select.js +6 -6
- package/cjs/form/Switch.js +4 -4
- package/cjs/form/TextField.js +6 -6
- package/cjs/form/Textarea.js +14 -14
- package/cjs/form/checkbox/Checkbox.js +3 -3
- package/cjs/form/checkbox/CheckboxGroup.js +2 -2
- package/cjs/form/error-summary/ErrorSummary.js +3 -3
- package/cjs/form/error-summary/ErrorSummaryItem.js +2 -2
- package/cjs/form/radio/Radio.js +2 -2
- package/cjs/form/radio/RadioGroup.js +2 -2
- package/cjs/form/search/Search.js +6 -7
- package/cjs/form/search/SearchButton.js +2 -4
- package/cjs/form/useFormField.js +2 -2
- package/cjs/grid/Cell.js +2 -2
- package/cjs/grid/ContentContainer.js +2 -2
- package/cjs/grid/Grid.js +2 -2
- package/cjs/guide-panel/Guide.js +3 -3
- package/cjs/guide-panel/GuidePanel.js +2 -2
- package/cjs/help-text/HelpText.js +5 -5
- package/cjs/index.js +1 -6
- package/cjs/link/Link.js +2 -2
- package/cjs/link-panel/LinkPanel.js +2 -2
- package/cjs/link-panel/LinkPanelDescription.js +2 -2
- package/cjs/link-panel/LinkPanelTitle.js +2 -2
- package/cjs/loader/Loader.js +2 -2
- package/cjs/modal/Modal.js +5 -7
- package/cjs/modal/ModalContent.js +2 -2
- package/cjs/pagination/Pagination.js +18 -23
- package/cjs/{menu/MenuItem.js → pagination/PaginationItem.js} +5 -4
- package/cjs/panel/Panel.js +2 -2
- package/cjs/popover/Popover.js +55 -45
- package/cjs/popover/PopoverContent.js +2 -2
- package/cjs/read-more/ReadMore.js +7 -11
- package/cjs/stepper/Step.js +2 -2
- package/cjs/stepper/Stepper.js +3 -3
- package/cjs/table/Body.js +2 -2
- package/cjs/table/DataCell.js +2 -2
- package/cjs/table/ExpandableRow.js +9 -12
- package/cjs/table/Header.js +2 -2
- package/cjs/table/HeaderCell.js +2 -2
- package/cjs/table/Row.js +2 -2
- package/cjs/table/Table.js +2 -2
- package/cjs/tabs/Tab.js +4 -4
- package/cjs/tabs/TabList.js +8 -7
- package/cjs/tabs/TabPanel.js +2 -2
- package/cjs/tabs/Tabs.js +5 -3
- package/cjs/tag/Tag.js +2 -2
- package/cjs/toggle-group/ToggleGroup.js +5 -5
- package/cjs/toggle-group/ToggleItem.js +2 -2
- package/cjs/tooltip/Tooltip.js +45 -92
- package/cjs/typography/BodyLong.js +2 -2
- package/cjs/typography/BodyShort.js +2 -2
- package/cjs/typography/Detail.js +2 -2
- package/cjs/typography/ErrorMessage.js +2 -2
- package/cjs/typography/Heading.js +2 -2
- package/cjs/typography/Ingress.js +2 -2
- package/cjs/typography/Label.js +2 -2
- package/cjs/util/AnimateHeight.js +204 -0
- package/cjs/util/TextareaAutoSize.js +174 -0
- package/cjs/util/debounce.js +18 -0
- package/cjs/util/index.js +14 -1
- package/cjs/util/mergeRefs.js +16 -0
- package/cjs/util/useId.js +60 -17
- package/esm/accordion/Accordion.js +1 -1
- package/esm/accordion/Accordion.js.map +1 -1
- package/esm/accordion/AccordionContent.d.ts +0 -2
- package/esm/accordion/AccordionContent.js +5 -9
- package/esm/accordion/AccordionContent.js.map +1 -1
- package/esm/accordion/AccordionHeader.js +5 -10
- package/esm/accordion/AccordionHeader.js.map +1 -1
- package/esm/accordion/AccordionItem.d.ts +0 -8
- package/esm/accordion/AccordionItem.js +2 -6
- package/esm/accordion/AccordionItem.js.map +1 -1
- package/esm/alert/Alert.d.ts +1 -1
- package/esm/alert/Alert.js +1 -1
- package/esm/alert/Alert.js.map +1 -1
- package/esm/button/Button.d.ts +10 -1
- package/esm/button/Button.js +10 -8
- package/esm/button/Button.js.map +1 -1
- package/esm/{speech-bubble → chat}/Bubble.d.ts +7 -3
- package/esm/{speech-bubble → chat}/Bubble.js +7 -4
- package/esm/chat/Bubble.js.map +1 -0
- package/esm/chat/Chat.d.ts +38 -0
- package/esm/chat/Chat.js +28 -0
- package/esm/chat/Chat.js.map +1 -0
- package/esm/chat/index.d.ts +1 -0
- package/esm/chat/index.js +2 -0
- package/esm/chat/index.js.map +1 -0
- package/esm/form/ConfirmationPanel.d.ts +1 -1
- package/esm/form/ConfirmationPanel.js +3 -3
- package/esm/form/ConfirmationPanel.js.map +1 -1
- package/esm/form/Fieldset/Fieldset.js +1 -1
- package/esm/form/Fieldset/Fieldset.js.map +1 -1
- package/esm/form/Select.js +1 -1
- package/esm/form/Select.js.map +1 -1
- package/esm/form/Switch.js +1 -1
- package/esm/form/Switch.js.map +1 -1
- package/esm/form/TextField.js +1 -1
- package/esm/form/TextField.js.map +1 -1
- package/esm/form/Textarea.js +6 -6
- 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/error-summary/ErrorSummary.js +3 -3
- package/esm/form/error-summary/ErrorSummary.js.map +1 -1
- 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/search/Search.js +4 -5
- package/esm/form/search/Search.js.map +1 -1
- package/esm/form/search/SearchButton.d.ts +1 -1
- package/esm/form/search/SearchButton.js +2 -4
- package/esm/form/search/SearchButton.js.map +1 -1
- 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/grid/ContentContainer.js +1 -1
- package/esm/grid/ContentContainer.js.map +1 -1
- package/esm/grid/Grid.js +1 -1
- package/esm/grid/Grid.js.map +1 -1
- package/esm/guide-panel/Guide.js +1 -1
- package/esm/guide-panel/Guide.js.map +1 -1
- package/esm/guide-panel/GuidePanel.js +1 -1
- package/esm/guide-panel/GuidePanel.js.map +1 -1
- package/esm/help-text/HelpText.d.ts +1 -2
- package/esm/help-text/HelpText.js +7 -7
- package/esm/help-text/HelpText.js.map +1 -1
- package/esm/index.d.ts +1 -5
- package/esm/index.js +1 -6
- package/esm/index.js.map +1 -1
- package/esm/link/Link.js +1 -1
- package/esm/link/Link.js.map +1 -1
- package/esm/link-panel/LinkPanel.js +1 -1
- package/esm/link-panel/LinkPanel.js.map +1 -1
- package/esm/link-panel/LinkPanelDescription.js +1 -1
- package/esm/link-panel/LinkPanelDescription.js.map +1 -1
- package/esm/link-panel/LinkPanelTitle.js +1 -1
- package/esm/link-panel/LinkPanelTitle.js.map +1 -1
- package/esm/loader/Loader.js +1 -1
- package/esm/loader/Loader.js.map +1 -1
- package/esm/modal/Modal.js +5 -7
- package/esm/modal/Modal.js.map +1 -1
- package/esm/modal/ModalContent.js +1 -1
- package/esm/modal/ModalContent.js.map +1 -1
- package/esm/pagination/Pagination.d.ts +12 -3
- package/esm/pagination/Pagination.js +17 -22
- package/esm/pagination/Pagination.js.map +1 -1
- package/esm/pagination/PaginationItem.d.ts +22 -0
- package/esm/{menu/MenuItem.js → pagination/PaginationItem.js} +6 -5
- package/esm/pagination/PaginationItem.js.map +1 -0
- package/esm/pagination/index.d.ts +1 -2
- package/esm/pagination/index.js.map +1 -1
- package/esm/panel/Panel.js +1 -1
- package/esm/panel/Panel.js.map +1 -1
- package/esm/popover/Popover.d.ts +2 -3
- package/esm/popover/Popover.js +56 -46
- package/esm/popover/Popover.js.map +1 -1
- package/esm/popover/PopoverContent.js +1 -1
- package/esm/popover/PopoverContent.js.map +1 -1
- package/esm/read-more/ReadMore.d.ts +0 -5
- package/esm/read-more/ReadMore.js +7 -11
- package/esm/read-more/ReadMore.js.map +1 -1
- package/esm/stepper/Step.js +1 -1
- package/esm/stepper/Step.js.map +1 -1
- package/esm/stepper/Stepper.js +1 -1
- package/esm/stepper/Stepper.js.map +1 -1
- package/esm/table/Body.js +1 -1
- package/esm/table/Body.js.map +1 -1
- package/esm/table/DataCell.js +1 -1
- package/esm/table/DataCell.js.map +1 -1
- package/esm/table/ExpandableRow.js +7 -10
- package/esm/table/ExpandableRow.js.map +1 -1
- package/esm/table/Header.js +1 -1
- package/esm/table/Header.js.map +1 -1
- package/esm/table/HeaderCell.js +1 -1
- package/esm/table/HeaderCell.js.map +1 -1
- package/esm/table/Row.js +1 -1
- package/esm/table/Row.js.map +1 -1
- package/esm/table/Table.js +1 -1
- package/esm/table/Table.js.map +1 -1
- package/esm/tabs/Tab.d.ts +0 -5
- package/esm/tabs/Tab.js +5 -5
- package/esm/tabs/Tab.js.map +1 -1
- package/esm/tabs/TabList.d.ts +0 -4
- package/esm/tabs/TabList.js +7 -6
- package/esm/tabs/TabList.js.map +1 -1
- package/esm/tabs/TabPanel.js +1 -1
- package/esm/tabs/TabPanel.js.map +1 -1
- package/esm/tabs/Tabs.d.ts +12 -0
- package/esm/tabs/Tabs.js +4 -2
- package/esm/tabs/Tabs.js.map +1 -1
- package/esm/tag/Tag.js +1 -1
- package/esm/tag/Tag.js.map +1 -1
- package/esm/toggle-group/ToggleGroup.js +3 -3
- package/esm/toggle-group/ToggleGroup.js.map +1 -1
- package/esm/toggle-group/ToggleItem.js +1 -1
- package/esm/toggle-group/ToggleItem.js.map +1 -1
- package/esm/tooltip/Tooltip.js +44 -91
- package/esm/tooltip/Tooltip.js.map +1 -1
- package/esm/typography/BodyLong.js +1 -1
- package/esm/typography/BodyLong.js.map +1 -1
- package/esm/typography/BodyShort.js +1 -1
- package/esm/typography/BodyShort.js.map +1 -1
- package/esm/typography/Detail.js +1 -1
- package/esm/typography/Detail.js.map +1 -1
- package/esm/typography/ErrorMessage.js +1 -1
- package/esm/typography/ErrorMessage.js.map +1 -1
- package/esm/typography/Heading.js +1 -1
- package/esm/typography/Heading.js.map +1 -1
- package/esm/typography/Ingress.js +1 -1
- package/esm/typography/Ingress.js.map +1 -1
- package/esm/typography/Label.js +1 -1
- package/esm/typography/Label.js.map +1 -1
- package/esm/util/AnimateHeight.d.ts +10 -0
- package/esm/util/AnimateHeight.js +180 -0
- package/esm/util/AnimateHeight.js.map +1 -0
- package/esm/util/TextareaAutoSize.d.ts +14 -0
- package/esm/util/TextareaAutoSize.js +150 -0
- package/esm/util/TextareaAutoSize.js.map +1 -0
- package/esm/util/debounce.d.ts +4 -0
- package/esm/util/debounce.js +16 -0
- package/esm/util/debounce.js.map +1 -0
- package/esm/util/index.d.ts +4 -0
- package/esm/util/index.js +9 -1
- package/esm/util/index.js.map +1 -1
- package/esm/util/mergeRefs.d.ts +2 -0
- package/esm/util/mergeRefs.js +14 -0
- package/esm/util/mergeRefs.js.map +1 -0
- package/esm/util/useId.d.ts +7 -3
- package/esm/util/useId.js +36 -16
- package/esm/util/useId.js.map +1 -1
- package/package.json +13 -15
- package/src/accordion/Accordion.tsx +1 -1
- package/src/accordion/AccordionContent.tsx +13 -19
- package/src/accordion/AccordionHeader.tsx +11 -18
- package/src/accordion/AccordionItem.tsx +2 -23
- package/src/accordion/accordion.stories.tsx +30 -31
- package/src/alert/Alert.tsx +2 -2
- package/src/alert/alert.stories.tsx +7 -0
- package/src/button/Button.tsx +39 -14
- package/src/button/button.stories.tsx +55 -28
- package/src/chat/Bubble.tsx +52 -0
- package/src/chat/Chat.tsx +96 -0
- package/src/chat/chat.stories.tsx +202 -0
- package/src/chat/index.ts +1 -0
- package/src/form/ConfirmationPanel.tsx +9 -4
- package/src/form/Fieldset/Fieldset.tsx +1 -1
- package/src/form/Select.tsx +1 -1
- package/src/form/Switch.tsx +1 -1
- package/src/form/TextField.tsx +1 -1
- package/src/form/Textarea.tsx +6 -6
- package/src/form/checkbox/Checkbox.test.tsx +20 -17
- package/src/form/checkbox/Checkbox.tsx +1 -1
- package/src/form/checkbox/CheckboxGroup.tsx +1 -1
- package/src/form/error-summary/ErrorSummary.tsx +3 -3
- package/src/form/error-summary/ErrorSummaryItem.tsx +1 -1
- package/src/form/radio/Radio.tsx +1 -1
- package/src/form/radio/RadioGroup.tsx +1 -1
- package/src/form/search/Search.tsx +11 -4
- package/src/form/search/SearchButton.tsx +8 -4
- package/src/form/useFormField.ts +1 -1
- package/src/grid/Cell.tsx +1 -1
- package/src/grid/ContentContainer.tsx +1 -1
- package/src/grid/Grid.tsx +1 -1
- package/src/grid/grid.stories.tsx +68 -0
- package/src/guide-panel/Guide.tsx +1 -1
- package/src/guide-panel/GuidePanel.tsx +1 -1
- package/src/help-text/HelpText.tsx +22 -8
- package/src/help-text/help-text.stories.tsx +12 -16
- package/src/index.ts +1 -7
- package/src/link/Link.tsx +1 -1
- package/src/link-panel/LinkPanel.tsx +1 -1
- package/src/link-panel/LinkPanelDescription.tsx +1 -1
- package/src/link-panel/LinkPanelTitle.tsx +1 -1
- package/src/loader/Loader.tsx +1 -1
- package/src/modal/Modal.tsx +6 -8
- package/src/modal/ModalContent.tsx +1 -1
- package/src/pagination/Pagination.tsx +87 -72
- package/src/pagination/PaginationItem.tsx +56 -0
- package/src/pagination/index.ts +1 -2
- package/src/pagination/pagination.stories.tsx +90 -16
- package/src/panel/Panel.tsx +1 -1
- package/src/popover/Popover.test.tsx +143 -0
- package/src/popover/Popover.tsx +107 -73
- package/src/popover/PopoverContent.tsx +1 -1
- package/src/popover/popover.stories.tsx +22 -27
- package/src/read-more/ReadMore.tsx +19 -30
- package/src/read-more/readmore.stories.tsx +3 -10
- package/src/stepper/Step.tsx +1 -1
- package/src/stepper/Stepper.tsx +1 -1
- package/src/table/Body.tsx +1 -1
- package/src/table/DataCell.tsx +1 -1
- package/src/table/ExpandableRow.tsx +12 -13
- package/src/table/Header.tsx +1 -1
- package/src/table/HeaderCell.tsx +1 -1
- package/src/table/Row.tsx +1 -1
- package/src/table/Table.tsx +1 -1
- package/src/tabs/Tab.tsx +6 -19
- package/src/tabs/TabList.tsx +14 -9
- package/src/tabs/TabPanel.tsx +1 -1
- package/src/tabs/Tabs.stories.tsx +94 -117
- package/src/tabs/Tabs.tsx +17 -1
- package/src/tag/Tag.tsx +1 -1
- package/src/toggle-group/ToggleGroup.tsx +3 -3
- package/src/toggle-group/ToggleItem.tsx +1 -1
- package/src/tooltip/Tooltip.test.tsx +167 -0
- package/src/tooltip/Tooltip.tsx +106 -173
- package/src/tooltip/tooltip.stories.tsx +15 -1
- package/src/typography/BodyLong.tsx +1 -1
- package/src/typography/BodyShort.tsx +1 -1
- package/src/typography/Detail.tsx +1 -1
- package/src/typography/ErrorMessage.tsx +1 -1
- package/src/typography/Heading.tsx +1 -1
- package/src/typography/Ingress.tsx +1 -1
- package/src/typography/Label.tsx +1 -1
- package/src/util/AnimateHeight.tsx +240 -0
- package/src/util/TextareaAutoSize.tsx +224 -0
- package/src/util/debounce.ts +17 -0
- package/src/util/index.ts +14 -2
- package/src/util/mergeRefs.tsx +14 -0
- package/src/util/useId.ts +37 -20
- package/cjs/card/MicroCard.js +0 -47
- package/cjs/card/index.js +0 -8
- package/cjs/card/package.json +0 -6
- package/cjs/menu/Menu.js +0 -53
- package/cjs/menu/MenuCollapse.js +0 -65
- package/cjs/menu/MenuItems.js +0 -23
- package/cjs/menu/package.json +0 -6
- package/cjs/page-header/PageHeader.js +0 -51
- package/cjs/page-header/index.js +0 -8
- package/cjs/page-header/package.json +0 -6
- package/cjs/speech-bubble/index.js +0 -8
- package/cjs/speech-bubble/package.json +0 -6
- package/cjs/step-indicator/Step.js +0 -67
- package/cjs/step-indicator/StepIndicator.js +0 -80
- package/cjs/step-indicator/index.js +0 -8
- package/cjs/step-indicator/package.json +0 -6
- package/esm/card/MicroCard.d.ts +0 -10
- package/esm/card/MicroCard.js +0 -19
- package/esm/card/MicroCard.js.map +0 -1
- package/esm/card/index.d.ts +0 -2
- package/esm/card/index.js +0 -2
- package/esm/card/index.js.map +0 -1
- package/esm/menu/Menu.d.ts +0 -12
- package/esm/menu/Menu.js +0 -25
- package/esm/menu/Menu.js.map +0 -1
- package/esm/menu/MenuCollapse.d.ts +0 -12
- package/esm/menu/MenuCollapse.js +0 -37
- package/esm/menu/MenuCollapse.js.map +0 -1
- package/esm/menu/MenuItem.d.ts +0 -13
- package/esm/menu/MenuItem.js.map +0 -1
- package/esm/menu/MenuItems.d.ts +0 -6
- package/esm/menu/MenuItems.js +0 -19
- package/esm/menu/MenuItems.js.map +0 -1
- package/esm/menu/index.d.ts +0 -3
- package/esm/menu/index.js +0 -2
- package/esm/menu/index.js.map +0 -1
- package/esm/page-header/PageHeader.d.ts +0 -27
- package/esm/page-header/PageHeader.js +0 -24
- package/esm/page-header/PageHeader.js.map +0 -1
- package/esm/page-header/index.d.ts +0 -2
- package/esm/page-header/index.js +0 -2
- package/esm/page-header/index.js.map +0 -1
- package/esm/speech-bubble/Bubble.js.map +0 -1
- package/esm/speech-bubble/SpeechBubble.d.ts +0 -34
- package/esm/speech-bubble/SpeechBubble.js +0 -27
- package/esm/speech-bubble/SpeechBubble.js.map +0 -1
- package/esm/speech-bubble/index.d.ts +0 -1
- package/esm/speech-bubble/index.js +0 -2
- package/esm/speech-bubble/index.js.map +0 -1
- package/esm/step-indicator/Step.d.ts +0 -23
- package/esm/step-indicator/Step.js +0 -39
- package/esm/step-indicator/Step.js.map +0 -1
- package/esm/step-indicator/StepIndicator.d.ts +0 -41
- package/esm/step-indicator/StepIndicator.js +0 -52
- package/esm/step-indicator/StepIndicator.js.map +0 -1
- package/esm/step-indicator/index.d.ts +0 -1
- package/esm/step-indicator/index.js +0 -2
- package/esm/step-indicator/index.js.map +0 -1
- package/src/card/MicroCard.tsx +0 -32
- package/src/card/index.ts +0 -2
- package/src/card/stories/card.stories.mdx +0 -26
- package/src/card/stories/card.stories.tsx +0 -16
- package/src/grid/stories/grid.stories.mdx +0 -79
- package/src/grid/stories/grid.stories.tsx +0 -51
- package/src/grid/stories/styles.css +0 -21
- package/src/menu/Menu.tsx +0 -36
- package/src/menu/MenuCollapse.tsx +0 -80
- package/src/menu/MenuItem.tsx +0 -39
- package/src/menu/MenuItems.tsx +0 -21
- package/src/menu/index.ts +0 -3
- package/src/menu/stories/menu.stories.mdx +0 -93
- package/src/menu/stories/menu.stories.tsx +0 -139
- package/src/page-header/PageHeader.tsx +0 -72
- package/src/page-header/index.ts +0 -2
- package/src/page-header/stories/header.stories.mdx +0 -81
- package/src/page-header/stories/header.stories.tsx +0 -61
- package/src/page-header/stories/pictogram.tsx +0 -14
- package/src/speech-bubble/Bubble.tsx +0 -48
- package/src/speech-bubble/SpeechBubble.tsx +0 -93
- package/src/speech-bubble/index.ts +0 -1
- package/src/speech-bubble/stories/illustration.tsx +0 -66
- package/src/speech-bubble/stories/speechbubble.stories.mdx +0 -184
- package/src/speech-bubble/stories/speechbubble.stories.tsx +0 -104
- package/src/step-indicator/Step.tsx +0 -81
- package/src/step-indicator/StepIndicator.tsx +0 -148
- package/src/step-indicator/index.ts +0 -1
- package/src/step-indicator/stories/Example.tsx +0 -23
- package/src/step-indicator/stories/step-indicator.stories.mdx +0 -122
- package/src/step-indicator/stories/step-indicator.stories.tsx +0 -104
|
@@ -1,80 +0,0 @@
|
|
|
1
|
-
import React, {
|
|
2
|
-
createContext,
|
|
3
|
-
forwardRef,
|
|
4
|
-
HTMLAttributes,
|
|
5
|
-
useContext,
|
|
6
|
-
useState,
|
|
7
|
-
} from "react";
|
|
8
|
-
import cl from "classnames";
|
|
9
|
-
import { Expand, ExpandFilled } from "@navikt/ds-icons";
|
|
10
|
-
import MenuItems from "./MenuItems";
|
|
11
|
-
|
|
12
|
-
export const NestingContext = createContext<{ depth: number }>({ depth: 1 });
|
|
13
|
-
|
|
14
|
-
const NestingProvider = ({ children }) => {
|
|
15
|
-
const context = useContext(NestingContext);
|
|
16
|
-
|
|
17
|
-
return (
|
|
18
|
-
<NestingContext.Provider
|
|
19
|
-
value={{
|
|
20
|
-
depth: context.depth + 1,
|
|
21
|
-
}}
|
|
22
|
-
>
|
|
23
|
-
{children}
|
|
24
|
-
</NestingContext.Provider>
|
|
25
|
-
);
|
|
26
|
-
};
|
|
27
|
-
|
|
28
|
-
export interface MenuCollapseProps extends HTMLAttributes<HTMLDivElement> {
|
|
29
|
-
title: string;
|
|
30
|
-
defaultOpen?: boolean;
|
|
31
|
-
children: React.ReactNode;
|
|
32
|
-
}
|
|
33
|
-
|
|
34
|
-
export type MenuCollapseType = React.ForwardRefExoticComponent<
|
|
35
|
-
MenuCollapseProps & React.RefAttributes<HTMLDivElement>
|
|
36
|
-
>;
|
|
37
|
-
|
|
38
|
-
export const Collapse: MenuCollapseType = forwardRef(
|
|
39
|
-
({ children, defaultOpen = false, title, className, ...rest }, ref) => {
|
|
40
|
-
const [isOpen, setIsOpen] = useState(defaultOpen);
|
|
41
|
-
const context = useContext(NestingContext);
|
|
42
|
-
|
|
43
|
-
return (
|
|
44
|
-
<div
|
|
45
|
-
{...rest}
|
|
46
|
-
ref={ref}
|
|
47
|
-
className={cl("navds-menu-collapse", className, {
|
|
48
|
-
"navds-menu-collapse--open": isOpen,
|
|
49
|
-
})}
|
|
50
|
-
>
|
|
51
|
-
<button
|
|
52
|
-
onClick={() => setIsOpen(!isOpen)}
|
|
53
|
-
className="navds-menu-collapse__button"
|
|
54
|
-
>
|
|
55
|
-
{title}
|
|
56
|
-
<Expand
|
|
57
|
-
title={isOpen ? "lukk navigasjons-skuff" : "åpne navigason-skuff"}
|
|
58
|
-
className="navds-menu-collapse__expand-icon"
|
|
59
|
-
/>
|
|
60
|
-
<ExpandFilled
|
|
61
|
-
title={isOpen ? "lukk navigasjons-skuff" : "åpne navigason-skuff"}
|
|
62
|
-
className="navds-menu-collapse__expand-icon navds-menu-collapse__expand-icon--filled"
|
|
63
|
-
/>
|
|
64
|
-
</button>
|
|
65
|
-
<NestingProvider>
|
|
66
|
-
{isOpen && (
|
|
67
|
-
<MenuItems
|
|
68
|
-
data-depth={context.depth}
|
|
69
|
-
className="navds-menu__list--inner"
|
|
70
|
-
>
|
|
71
|
-
{children}
|
|
72
|
-
</MenuItems>
|
|
73
|
-
)}
|
|
74
|
-
</NestingProvider>
|
|
75
|
-
</div>
|
|
76
|
-
);
|
|
77
|
-
}
|
|
78
|
-
);
|
|
79
|
-
|
|
80
|
-
export default Collapse;
|
package/src/menu/MenuItem.tsx
DELETED
|
@@ -1,39 +0,0 @@
|
|
|
1
|
-
import React, { forwardRef } from "react";
|
|
2
|
-
import { OverridableComponent } from "..";
|
|
3
|
-
import cl from "classnames";
|
|
4
|
-
|
|
5
|
-
export interface MenuItemProps
|
|
6
|
-
extends React.AnchorHTMLAttributes<HTMLAnchorElement> {
|
|
7
|
-
children: React.ReactNode;
|
|
8
|
-
/**
|
|
9
|
-
* Sets active styling if true
|
|
10
|
-
* @default false
|
|
11
|
-
*/
|
|
12
|
-
active?: boolean;
|
|
13
|
-
}
|
|
14
|
-
|
|
15
|
-
export type MenuItemType = OverridableComponent<
|
|
16
|
-
MenuItemProps,
|
|
17
|
-
HTMLAnchorElement
|
|
18
|
-
>;
|
|
19
|
-
|
|
20
|
-
export const Item: MenuItemType = forwardRef(
|
|
21
|
-
(
|
|
22
|
-
{ children, as: Component = "a", active = false, className, ...rest },
|
|
23
|
-
ref
|
|
24
|
-
) => {
|
|
25
|
-
return (
|
|
26
|
-
<Component
|
|
27
|
-
ref={ref}
|
|
28
|
-
className={cl("navds-menu-item", className, {
|
|
29
|
-
"navds-menu-item--active": active,
|
|
30
|
-
})}
|
|
31
|
-
{...rest}
|
|
32
|
-
>
|
|
33
|
-
{children}
|
|
34
|
-
</Component>
|
|
35
|
-
);
|
|
36
|
-
}
|
|
37
|
-
);
|
|
38
|
-
|
|
39
|
-
export default Item;
|
package/src/menu/MenuItems.tsx
DELETED
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
import cl from "classnames";
|
|
2
|
-
import React from "react";
|
|
3
|
-
|
|
4
|
-
const MenuItems = ({
|
|
5
|
-
children,
|
|
6
|
-
className,
|
|
7
|
-
...rest
|
|
8
|
-
}: {
|
|
9
|
-
children: React.ReactNode;
|
|
10
|
-
className?: string;
|
|
11
|
-
}) => (
|
|
12
|
-
<ul {...rest} className={cl("navds-menu__list", className)}>
|
|
13
|
-
{React.Children.toArray(children).map((child, i) => (
|
|
14
|
-
<li key={i} className="navds-menu__list-item">
|
|
15
|
-
{child}
|
|
16
|
-
</li>
|
|
17
|
-
))}
|
|
18
|
-
</ul>
|
|
19
|
-
);
|
|
20
|
-
|
|
21
|
-
export default MenuItems;
|
package/src/menu/index.ts
DELETED
|
@@ -1,93 +0,0 @@
|
|
|
1
|
-
import { Meta, Canvas } from "@storybook/addon-docs";
|
|
2
|
-
import { Menu } from "../../index";
|
|
3
|
-
|
|
4
|
-
<Meta title="ds-react/menu/intro" />
|
|
5
|
-
|
|
6
|
-
# Hvordan ta i bruk Menu
|
|
7
|
-
|
|
8
|
-
```jsx
|
|
9
|
-
<Menu>
|
|
10
|
-
<Menu.Item href="#leo">Leo</Menu.Item>
|
|
11
|
-
<Menu.Collapse title="Proin">
|
|
12
|
-
<Menu.Item href="#nulla" active>
|
|
13
|
-
Nulla
|
|
14
|
-
</Menu.Item>
|
|
15
|
-
<Menu.Item href="#luctus">Luctus</Menu.Item>
|
|
16
|
-
</Menu.Collapse>
|
|
17
|
-
<Menu.Collapse title="Accumsan">
|
|
18
|
-
<Menu.Item href="#justo" aria-current="page">
|
|
19
|
-
Justo
|
|
20
|
-
</Menu.Item>
|
|
21
|
-
<Menu.Collapse title="Proin">
|
|
22
|
-
<Menu.Item href="#nulla">Nulla</Menu.Item>
|
|
23
|
-
<Menu.Item href="#luctus">Luctus</Menu.Item>
|
|
24
|
-
</Menu.Collapse>
|
|
25
|
-
</Menu.Collapse>
|
|
26
|
-
</Menu>
|
|
27
|
-
```
|
|
28
|
-
|
|
29
|
-
<Canvas>
|
|
30
|
-
<Menu>
|
|
31
|
-
<Menu.Item href="#leo">Leo</Menu.Item>
|
|
32
|
-
<Menu.Collapse title="Proin">
|
|
33
|
-
<Menu.Item href="#nulla" active>
|
|
34
|
-
Nulla
|
|
35
|
-
</Menu.Item>
|
|
36
|
-
<Menu.Item href="#luctus">Luctus</Menu.Item>
|
|
37
|
-
</Menu.Collapse>
|
|
38
|
-
<Menu.Collapse title="Accumsan">
|
|
39
|
-
<Menu.Item href="#justo">Justo</Menu.Item>
|
|
40
|
-
<Menu.Collapse title="Proin">
|
|
41
|
-
<Menu.Item href="#nulla">Nulla</Menu.Item>
|
|
42
|
-
<Menu.Item href="#luctus">Luctus</Menu.Item>
|
|
43
|
-
</Menu.Collapse>
|
|
44
|
-
</Menu.Collapse>
|
|
45
|
-
</Menu>
|
|
46
|
-
</Canvas>
|
|
47
|
-
|
|
48
|
-
## Elementer i menyen
|
|
49
|
-
|
|
50
|
-
Menyen har to typer elementer man kan bruke: `Collapse` for nesting og `Item` for navigasjonslenker på siden.
|
|
51
|
-
|
|
52
|
-
<Canvas>
|
|
53
|
-
<div>
|
|
54
|
-
<h2>Item</h2>
|
|
55
|
-
<Menu>
|
|
56
|
-
<Menu.Item href="#leo">Lenke</Menu.Item>
|
|
57
|
-
<Menu.Item href="#leo">Lenke</Menu.Item>
|
|
58
|
-
<Menu.Item href="#leo">Lenke</Menu.Item>
|
|
59
|
-
<Menu.Item href="#leo">Lenke</Menu.Item>
|
|
60
|
-
<Menu.Item href="#leo">Lenke</Menu.Item>
|
|
61
|
-
</Menu>
|
|
62
|
-
<h2>Collapses + Item</h2>
|
|
63
|
-
<Menu>
|
|
64
|
-
<Menu.Collapse title="Proin">
|
|
65
|
-
<Menu.Item href="#nulla" active>
|
|
66
|
-
Nulla
|
|
67
|
-
</Menu.Item>
|
|
68
|
-
<Menu.Item href="#luctus">Luctus</Menu.Item>
|
|
69
|
-
</Menu.Collapse>
|
|
70
|
-
<Menu.Collapse title="Accumsan">
|
|
71
|
-
<Menu.Item href="#justo">Justo</Menu.Item>
|
|
72
|
-
<Menu.Collapse title="Proin">
|
|
73
|
-
<Menu.Item href="#nulla">Nulla</Menu.Item>
|
|
74
|
-
<Menu.Item href="#luctus">Luctus</Menu.Item>
|
|
75
|
-
</Menu.Collapse>
|
|
76
|
-
</Menu.Collapse>
|
|
77
|
-
<Menu.Item href="#leo">Lenke</Menu.Item>
|
|
78
|
-
<Menu.Item href="#leo">Lenke</Menu.Item>
|
|
79
|
-
</Menu>
|
|
80
|
-
</div>
|
|
81
|
-
</Canvas>
|
|
82
|
-
|
|
83
|
-
`Menu.Item` er implementert med `OverridableComponent`, noe som
|
|
84
|
-
gjør at man kan ta i bruk eks react-router slik:
|
|
85
|
-
|
|
86
|
-
```jsx
|
|
87
|
-
<Menu.Item as={NavLink} activeClassName="navds-menu-item--active" to="/1">
|
|
88
|
-
Lenketekst
|
|
89
|
-
</Menu.Item>
|
|
90
|
-
```
|
|
91
|
-
|
|
92
|
-
Her er `NavLink` fra `react-router-dom` brukt, og man får da
|
|
93
|
-
samtidig bruke alle propsene til denne komponenten som da er `activeClassName` her.
|
|
@@ -1,139 +0,0 @@
|
|
|
1
|
-
import * as React from "react";
|
|
2
|
-
import cl from "classnames";
|
|
3
|
-
import { Menu } from "../index";
|
|
4
|
-
import { NavLink, HashRouter as Router } from "react-router-dom";
|
|
5
|
-
import { MenuItemProps } from "../MenuItem";
|
|
6
|
-
|
|
7
|
-
export default {
|
|
8
|
-
title: "ds-react/menu",
|
|
9
|
-
component: { Menu },
|
|
10
|
-
};
|
|
11
|
-
|
|
12
|
-
export const All = () => (
|
|
13
|
-
<div
|
|
14
|
-
style={{
|
|
15
|
-
background: "white",
|
|
16
|
-
maxWidth: 288,
|
|
17
|
-
}}
|
|
18
|
-
>
|
|
19
|
-
<h2>Only Menu.Items</h2>
|
|
20
|
-
<Menu>
|
|
21
|
-
<Menu.Item href="#leo">Leo</Menu.Item>
|
|
22
|
-
|
|
23
|
-
<Menu.Item href="#justo">Justo</Menu.Item>
|
|
24
|
-
<Menu.Item href="#pariatur" active aria-current="page">
|
|
25
|
-
Pariatur
|
|
26
|
-
</Menu.Item>
|
|
27
|
-
<Menu.Item href="#nulla">Nulla</Menu.Item>
|
|
28
|
-
<Menu.Item href="#luctus">Luctus</Menu.Item>
|
|
29
|
-
<Menu.Item href="#justo">Justo</Menu.Item>
|
|
30
|
-
<Menu.Item href="#pariatur">Pariatur</Menu.Item>
|
|
31
|
-
</Menu>
|
|
32
|
-
|
|
33
|
-
<h2>With Collapse</h2>
|
|
34
|
-
<Menu>
|
|
35
|
-
<Menu.Item href="#leo">Leo</Menu.Item>
|
|
36
|
-
<Menu.Collapse title="Proin">
|
|
37
|
-
<Menu.Item href="#nulla" active>
|
|
38
|
-
Nulla
|
|
39
|
-
</Menu.Item>
|
|
40
|
-
<Menu.Item href="#luctus">Luctus</Menu.Item>
|
|
41
|
-
</Menu.Collapse>
|
|
42
|
-
<Menu.Collapse title="Accumsan">
|
|
43
|
-
<Menu.Item href="#justo" aria-current="page">
|
|
44
|
-
Justo
|
|
45
|
-
</Menu.Item>
|
|
46
|
-
<Menu.Item href="#pariatur" active aria-current="page">
|
|
47
|
-
Pariatur
|
|
48
|
-
</Menu.Item>
|
|
49
|
-
<Menu.Collapse title="Proin">
|
|
50
|
-
<Menu.Item href="#nulla" active>
|
|
51
|
-
Nulla
|
|
52
|
-
</Menu.Item>
|
|
53
|
-
<Menu.Collapse title="Proin">
|
|
54
|
-
<Menu.Item href="#nulla" active>
|
|
55
|
-
Nulla
|
|
56
|
-
</Menu.Item>
|
|
57
|
-
<Menu.Item href="#luctus">Luctus</Menu.Item>
|
|
58
|
-
</Menu.Collapse>
|
|
59
|
-
<Menu.Item href="#luctus">Luctus</Menu.Item>
|
|
60
|
-
</Menu.Collapse>
|
|
61
|
-
</Menu.Collapse>
|
|
62
|
-
<Menu.Item href="#justo" active>
|
|
63
|
-
Justo
|
|
64
|
-
</Menu.Item>
|
|
65
|
-
<Menu.Item href="#pariatur">Pariatur</Menu.Item>
|
|
66
|
-
</Menu>
|
|
67
|
-
</div>
|
|
68
|
-
);
|
|
69
|
-
|
|
70
|
-
export const ReactRouter = () => {
|
|
71
|
-
const MenuItemLink = (props: MenuItemProps & { to: string }) => {
|
|
72
|
-
const { to } = props;
|
|
73
|
-
|
|
74
|
-
const CustomLink = React.useMemo(
|
|
75
|
-
() => (props: MenuItemProps) => (
|
|
76
|
-
<NavLink
|
|
77
|
-
{...props}
|
|
78
|
-
to={to}
|
|
79
|
-
className={({ isActive }) =>
|
|
80
|
-
cl(props.className, {
|
|
81
|
-
"navds-menu-item--active": isActive,
|
|
82
|
-
})
|
|
83
|
-
}
|
|
84
|
-
/>
|
|
85
|
-
),
|
|
86
|
-
[to]
|
|
87
|
-
);
|
|
88
|
-
|
|
89
|
-
return (
|
|
90
|
-
<Menu.Item {...props} as={CustomLink}>
|
|
91
|
-
Nivå 2 innrykk 2 rems
|
|
92
|
-
</Menu.Item>
|
|
93
|
-
);
|
|
94
|
-
};
|
|
95
|
-
|
|
96
|
-
return (
|
|
97
|
-
<Menu>
|
|
98
|
-
<Menu.Collapse title="Nivå 1 - 3 rems høy">
|
|
99
|
-
<MenuItemLink to="/1">Nivå 2 innrykk 2 rems</MenuItemLink>
|
|
100
|
-
<MenuItemLink to="/2">Subtitle 3</MenuItemLink>
|
|
101
|
-
</Menu.Collapse>
|
|
102
|
-
<Menu.Collapse title="Skjema og søknad">
|
|
103
|
-
<Menu.Collapse title="Satser">
|
|
104
|
-
<MenuItemLink to="/3">
|
|
105
|
-
Nivå 3 - 3 rems innrykk Har du rett til dagpenger når du mottar
|
|
106
|
-
annen økonomisk støtte fra NAV?
|
|
107
|
-
</MenuItemLink>
|
|
108
|
-
</Menu.Collapse>
|
|
109
|
-
<MenuItemLink to="/4">Subtitle 2</MenuItemLink>
|
|
110
|
-
<MenuItemLink to="/5">Subtitle 3</MenuItemLink>
|
|
111
|
-
</Menu.Collapse>
|
|
112
|
-
<Menu.Collapse title="Sakbehandlingstider">
|
|
113
|
-
<Menu.Collapse title="Subtitle 4 Lang tittel på andre nivå lorem ipsum">
|
|
114
|
-
<MenuItemLink to="/6">Subtitle 5</MenuItemLink>
|
|
115
|
-
</Menu.Collapse>
|
|
116
|
-
</Menu.Collapse>
|
|
117
|
-
<MenuItemLink to="/7">Internasjonalt</MenuItemLink>
|
|
118
|
-
<Menu.Collapse title="Meld fra om endringer lang tittel på første nivå">
|
|
119
|
-
<MenuItemLink to="/8">Subtitle 6</MenuItemLink>
|
|
120
|
-
</Menu.Collapse>
|
|
121
|
-
<MenuItemLink to="/9">Nivå 1</MenuItemLink>
|
|
122
|
-
</Menu>
|
|
123
|
-
);
|
|
124
|
-
};
|
|
125
|
-
|
|
126
|
-
ReactRouter.decorators = [
|
|
127
|
-
(Story) => (
|
|
128
|
-
<Router>
|
|
129
|
-
<div
|
|
130
|
-
style={{
|
|
131
|
-
background: "white",
|
|
132
|
-
maxWidth: 288,
|
|
133
|
-
}}
|
|
134
|
-
>
|
|
135
|
-
<Story />
|
|
136
|
-
</div>
|
|
137
|
-
</Router>
|
|
138
|
-
),
|
|
139
|
-
];
|
|
@@ -1,72 +0,0 @@
|
|
|
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 className="navds-page-header__title" size="xlarge" level="1">
|
|
59
|
-
{children}
|
|
60
|
-
</Heading>
|
|
61
|
-
{description && (
|
|
62
|
-
<BodyShort className="navds-page-header__description">
|
|
63
|
-
{description}
|
|
64
|
-
</BodyShort>
|
|
65
|
-
)}
|
|
66
|
-
</div>
|
|
67
|
-
</div>
|
|
68
|
-
);
|
|
69
|
-
}
|
|
70
|
-
);
|
|
71
|
-
|
|
72
|
-
export default PageHeader;
|
package/src/page-header/index.ts
DELETED
|
@@ -1,81 +0,0 @@
|
|
|
1
|
-
import { Meta, Canvas } from "@storybook/addon-docs";
|
|
2
|
-
import { PageHeader } from "../index";
|
|
3
|
-
import { illustrationPictogram } from "./pictogram";
|
|
4
|
-
|
|
5
|
-
<Meta title="ds-react(deprecated)/page-header/intro" />
|
|
6
|
-
|
|
7
|
-
# Hvordan ta i bruk PageHeader
|
|
8
|
-
|
|
9
|
-
Denne PageHeader-komponenten er utviklet i sammenheng med nye produktsider på NAV og
|
|
10
|
-
vil sannsynligvis forgå en del endringer før de er ferdige.
|
|
11
|
-
|
|
12
|
-
```jsx
|
|
13
|
-
<PageHeader description="LABORIS AUTE DESERUNT ID AUTE OFFICIA SINT SUNT FUGIAT EX ET CUPIDATAT CONSEQUAT DOLORE.">
|
|
14
|
-
AUTE OFFICIA SINT SUNT FUGIAT
|
|
15
|
-
</PageHeader>
|
|
16
|
-
```
|
|
17
|
-
|
|
18
|
-
<Canvas>
|
|
19
|
-
<PageHeader description="LABORIS AUTE DESERUNT ID AUTE OFFICIA SINT SUNT FUGIAT EX ET CUPIDATAT CONSEQUAT DOLORE.">
|
|
20
|
-
AUTE OFFICIA SINT SUNT FUGIAT
|
|
21
|
-
</PageHeader>
|
|
22
|
-
</Canvas>
|
|
23
|
-
|
|
24
|
-
## Med illustrasjon
|
|
25
|
-
|
|
26
|
-
Illustrasjonene brukt i PageHeader er "Pictogram" som er designet for den sepsifikke siden og
|
|
27
|
-
man skal da ikke bare velge et fra figma vilkårlig.
|
|
28
|
-
|
|
29
|
-
<Canvas>
|
|
30
|
-
<PageHeader
|
|
31
|
-
illustration={illustrationPictogram}
|
|
32
|
-
description="LABORIS AUTE DESERUNT ID AUTE OFFICIA SINT SUNT FUGIAT EX ET CUPIDATAT CONSEQUAT DOLORE."
|
|
33
|
-
>
|
|
34
|
-
AUTE OFFICIA SINT SUNT FUGIAT
|
|
35
|
-
</PageHeader>
|
|
36
|
-
</Canvas>
|
|
37
|
-
|
|
38
|
-
## Temaer
|
|
39
|
-
|
|
40
|
-
Headeren kommer i tre tema: `guide`, `product` og `situation`
|
|
41
|
-
|
|
42
|
-
<Canvas>
|
|
43
|
-
<PageHeader
|
|
44
|
-
description="LABORIS AUTE DESERUNT ID AUTE OFFICIA SINT SUNT FUGIAT EX ET CUPIDATAT CONSEQUAT DOLORE."
|
|
45
|
-
variant="guide"
|
|
46
|
-
>
|
|
47
|
-
AUTE OFFICIA SINT SUNT FUGIAT
|
|
48
|
-
</PageHeader>
|
|
49
|
-
<PageHeader
|
|
50
|
-
description="LABORIS AUTE DESERUNT ID AUTE OFFICIA SINT SUNT FUGIAT EX ET CUPIDATAT CONSEQUAT DOLORE."
|
|
51
|
-
variant="product"
|
|
52
|
-
>
|
|
53
|
-
AUTE OFFICIA SINT SUNT FUGIAT
|
|
54
|
-
</PageHeader>
|
|
55
|
-
<PageHeader
|
|
56
|
-
description="LABORIS AUTE DESERUNT ID AUTE OFFICIA SINT SUNT FUGIAT EX ET CUPIDATAT CONSEQUAT DOLORE."
|
|
57
|
-
variant="situation"
|
|
58
|
-
>
|
|
59
|
-
AUTE OFFICIA SINT SUNT FUGIAT
|
|
60
|
-
</PageHeader>
|
|
61
|
-
</Canvas>
|
|
62
|
-
|
|
63
|
-
## Sentrert
|
|
64
|
-
|
|
65
|
-
Innhold kan sentreres med `align="center"`-prop
|
|
66
|
-
|
|
67
|
-
<Canvas>
|
|
68
|
-
<PageHeader
|
|
69
|
-
description="LABORIS AUTE DESERUNT ID AUTE OFFICIA SINT SUNT FUGIAT EX ET CUPIDATAT CONSEQUAT DOLORE."
|
|
70
|
-
align="center"
|
|
71
|
-
>
|
|
72
|
-
AUTE OFFICIA SINT SUNT FUGIAT
|
|
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>
|
|
81
|
-
</Canvas>
|
|
@@ -1,61 +0,0 @@
|
|
|
1
|
-
import React from "react";
|
|
2
|
-
import { PageHeader } from "../index";
|
|
3
|
-
import { Meta } from "@storybook/react/types-6-0";
|
|
4
|
-
import { illustrationPictogram } from "./pictogram";
|
|
5
|
-
export default {
|
|
6
|
-
title: "ds-react(deprecated)/page-header",
|
|
7
|
-
component: PageHeader,
|
|
8
|
-
} as Meta;
|
|
9
|
-
|
|
10
|
-
export const All = () => {
|
|
11
|
-
return (
|
|
12
|
-
<div>
|
|
13
|
-
<h2>PageHeader</h2>
|
|
14
|
-
<PageHeader description="LABORIS AUTE DESERUNT ID AUTE OFFICIA SINT SUNT FUGIAT EX ET CUPIDATAT CONSEQUAT DOLORE.">
|
|
15
|
-
AUTE OFFICIA SINT SUNT FUGIAT
|
|
16
|
-
</PageHeader>
|
|
17
|
-
<br />
|
|
18
|
-
<h2>PageHeader m/illustration</h2>
|
|
19
|
-
<PageHeader
|
|
20
|
-
illustration={illustrationPictogram}
|
|
21
|
-
description="LABORIS AUTE DESERUNT ID AUTE OFFICIA SINT SUNT FUGIAT EX ET CUPIDATAT CONSEQUAT DOLORE."
|
|
22
|
-
>
|
|
23
|
-
AUTE OFFICIA SINT SUNT FUGIAT
|
|
24
|
-
</PageHeader>
|
|
25
|
-
<h2>PageHeader center</h2>
|
|
26
|
-
<PageHeader
|
|
27
|
-
description="LABORIS AUTE DESERUNT ID AUTE OFFICIA SINT SUNT FUGIAT EX ET CUPIDATAT CONSEQUAT DOLORE."
|
|
28
|
-
align="center"
|
|
29
|
-
>
|
|
30
|
-
AUTE OFFICIA SINT SUNT FUGIAT
|
|
31
|
-
</PageHeader>
|
|
32
|
-
<h2>PageHeader center m/illustration</h2>
|
|
33
|
-
<PageHeader
|
|
34
|
-
illustration={illustrationPictogram}
|
|
35
|
-
description="LABORIS AUTE DESERUNT ID AUTE OFFICIA SINT SUNT FUGIAT EX ET CUPIDATAT CONSEQUAT DOLORE."
|
|
36
|
-
align="center"
|
|
37
|
-
>
|
|
38
|
-
AUTE OFFICIA SINT SUNT FUGIAT
|
|
39
|
-
</PageHeader>
|
|
40
|
-
<h2>PageHeader variants</h2>
|
|
41
|
-
<PageHeader
|
|
42
|
-
description="LABORIS AUTE DESERUNT ID AUTE OFFICIA SINT SUNT FUGIAT EX ET CUPIDATAT CONSEQUAT DOLORE."
|
|
43
|
-
variant="guide"
|
|
44
|
-
>
|
|
45
|
-
AUTE OFFICIA SINT SUNT FUGIAT
|
|
46
|
-
</PageHeader>
|
|
47
|
-
<PageHeader
|
|
48
|
-
description="LABORIS AUTE DESERUNT ID AUTE OFFICIA SINT SUNT FUGIAT EX ET CUPIDATAT CONSEQUAT DOLORE."
|
|
49
|
-
variant="product"
|
|
50
|
-
>
|
|
51
|
-
AUTE OFFICIA SINT SUNT FUGIAT
|
|
52
|
-
</PageHeader>
|
|
53
|
-
<PageHeader
|
|
54
|
-
description="LABORIS AUTE DESERUNT ID AUTE OFFICIA SINT SUNT FUGIAT EX ET CUPIDATAT CONSEQUAT DOLORE."
|
|
55
|
-
variant="situation"
|
|
56
|
-
>
|
|
57
|
-
AUTE OFFICIA SINT SUNT FUGIAT
|
|
58
|
-
</PageHeader>
|
|
59
|
-
</div>
|
|
60
|
-
);
|
|
61
|
-
};
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
import React from "react";
|
|
2
|
-
/* prettier-ignore */
|
|
3
|
-
export const illustrationPictogram = <svg width="96" height="96" viewBox="0 0 96 96" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
4
|
-
<path d="M37.6697 60.6469L9 31.9772L30.9772 10L59.6469 38.6697L72.1116 26.205L81 82L25.205 73.1116L37.6697 60.6469Z" fill="#FFECCC"/>
|
|
5
|
-
<path d="M94.5 64.0584C94.5 72.104 88.003 78.6169 80 78.6169C71.997 78.6169 65.5 72.104 65.5 64.0584C65.5 56.0129 71.997 49.5 80 49.5C88.003 49.5 94.5 56.0129 94.5 64.0584Z" stroke="#262626" stroke-width="3"/>
|
|
6
|
-
<path d="M91.9999 95.9999V95.9999C91.9999 89.3725 86.6274 83.9561 79.9999 83.9561V83.9561C73.3725 83.9561 67.9999 89.3725 67.9999 95.9999V95.9999" stroke="#262626" stroke-width="3"/>
|
|
7
|
-
<ellipse cx="76.0001" cy="63.5566" rx="2" ry="2.00731" fill="#262626"/>
|
|
8
|
-
<ellipse cx="84" cy="63.5566" rx="2" ry="2.00731" fill="#262626"/>
|
|
9
|
-
<path d="M29 29.488V30C29 25.0515 25.866 22 22 22C18.134 22 15 25.0515 15 30V29.488" stroke="#262626" stroke-width="3"/>
|
|
10
|
-
<circle cx="22" cy="15" r="5.5" stroke="#262626" stroke-width="3"/>
|
|
11
|
-
<rect x="1.5" y="1.5" width="41" height="56" stroke="#262626" stroke-width="3"/>
|
|
12
|
-
<path d="M10 37H27" stroke="#262626" stroke-width="3"/>
|
|
13
|
-
<path d="M10 47H18.5" stroke="#262626" stroke-width="3"/>
|
|
14
|
-
</svg>
|
|
@@ -1,48 +0,0 @@
|
|
|
1
|
-
import React, { forwardRef, HTMLAttributes } from "react";
|
|
2
|
-
import cl from "classnames";
|
|
3
|
-
|
|
4
|
-
export interface BubbleProps extends HTMLAttributes<HTMLDivElement> {
|
|
5
|
-
/**
|
|
6
|
-
* Bubble text
|
|
7
|
-
*/
|
|
8
|
-
children: React.ReactNode;
|
|
9
|
-
/**
|
|
10
|
-
* User defined toptext, normally "name + date"
|
|
11
|
-
*/
|
|
12
|
-
topText?: React.ReactNode;
|
|
13
|
-
/**
|
|
14
|
-
* Background color bubble
|
|
15
|
-
*/
|
|
16
|
-
backgroundColor?: string;
|
|
17
|
-
}
|
|
18
|
-
|
|
19
|
-
export type BubbleType = React.ForwardRefExoticComponent<
|
|
20
|
-
BubbleProps & React.RefAttributes<HTMLDivElement>
|
|
21
|
-
>;
|
|
22
|
-
|
|
23
|
-
const Bubble: BubbleType = forwardRef(
|
|
24
|
-
({ children, className, topText, backgroundColor, ...rest }, ref) => {
|
|
25
|
-
return (
|
|
26
|
-
<div
|
|
27
|
-
ref={ref}
|
|
28
|
-
className={cl(
|
|
29
|
-
"navds-speechbubble__bubble",
|
|
30
|
-
className,
|
|
31
|
-
"navds-body-long"
|
|
32
|
-
)}
|
|
33
|
-
style={{ backgroundColor: backgroundColor }}
|
|
34
|
-
tabIndex={0}
|
|
35
|
-
{...rest}
|
|
36
|
-
>
|
|
37
|
-
{topText && (
|
|
38
|
-
<span className="navds-speechbubble__top-text navds-detail">
|
|
39
|
-
{topText}
|
|
40
|
-
</span>
|
|
41
|
-
)}
|
|
42
|
-
{children}
|
|
43
|
-
</div>
|
|
44
|
-
);
|
|
45
|
-
}
|
|
46
|
-
);
|
|
47
|
-
|
|
48
|
-
export default Bubble;
|