@navikt/ds-react 6.5.0 → 6.6.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.
Files changed (153) hide show
  1. package/cjs/form/combobox/FilteredOptions/filteredOptionsContext.js +2 -4
  2. package/cjs/form/combobox/FilteredOptions/filteredOptionsContext.js.map +1 -1
  3. package/cjs/form/combobox/Input/Input.js +6 -1
  4. package/cjs/form/combobox/Input/Input.js.map +1 -1
  5. package/cjs/form/form-summary/FormSummary.d.ts +82 -0
  6. package/cjs/form/form-summary/FormSummary.js +81 -0
  7. package/cjs/form/form-summary/FormSummary.js.map +1 -0
  8. package/cjs/form/form-summary/FormSummaryAnswer.d.ts +11 -0
  9. package/cjs/form/form-summary/FormSummaryAnswer.js +25 -0
  10. package/cjs/form/form-summary/FormSummaryAnswer.js.map +1 -0
  11. package/cjs/form/form-summary/FormSummaryAnswers.d.ts +9 -0
  12. package/cjs/form/form-summary/FormSummaryAnswers.js +48 -0
  13. package/cjs/form/form-summary/FormSummaryAnswers.js.map +1 -0
  14. package/cjs/form/form-summary/FormSummaryEditLink.d.ts +17 -0
  15. package/cjs/form/form-summary/FormSummaryEditLink.js +49 -0
  16. package/cjs/form/form-summary/FormSummaryEditLink.js.map +1 -0
  17. package/cjs/form/form-summary/FormSummaryHeader.d.ts +9 -0
  18. package/cjs/form/form-summary/FormSummaryHeader.js +48 -0
  19. package/cjs/form/form-summary/FormSummaryHeader.js.map +1 -0
  20. package/cjs/form/form-summary/FormSummaryHeading.d.ts +14 -0
  21. package/cjs/form/form-summary/FormSummaryHeading.js +31 -0
  22. package/cjs/form/form-summary/FormSummaryHeading.js.map +1 -0
  23. package/cjs/form/form-summary/FormSummaryLabel.d.ts +6 -0
  24. package/cjs/form/form-summary/FormSummaryLabel.js +45 -0
  25. package/cjs/form/form-summary/FormSummaryLabel.js.map +1 -0
  26. package/cjs/form/form-summary/FormSummaryValue.d.ts +6 -0
  27. package/cjs/form/form-summary/FormSummaryValue.js +49 -0
  28. package/cjs/form/form-summary/FormSummaryValue.js.map +1 -0
  29. package/cjs/form/form-summary/index.d.ts +8 -0
  30. package/cjs/form/form-summary/index.js +24 -0
  31. package/cjs/form/form-summary/index.js.map +1 -0
  32. package/cjs/index.d.ts +3 -2
  33. package/cjs/index.js +5 -3
  34. package/cjs/index.js.map +1 -1
  35. package/cjs/util/hooks/descendants/descendant.js +10 -1
  36. package/cjs/util/hooks/descendants/descendant.js.map +1 -1
  37. package/cjs/util/hooks/descendants/useDescendant.js +0 -5
  38. package/cjs/util/hooks/descendants/useDescendant.js.map +1 -1
  39. package/esm/form/combobox/FilteredOptions/filteredOptionsContext.js +2 -4
  40. package/esm/form/combobox/FilteredOptions/filteredOptionsContext.js.map +1 -1
  41. package/esm/form/combobox/Input/Input.js +6 -1
  42. package/esm/form/combobox/Input/Input.js.map +1 -1
  43. package/esm/form/form-summary/FormSummary.d.ts +82 -0
  44. package/esm/form/form-summary/FormSummary.js +52 -0
  45. package/esm/form/form-summary/FormSummary.js.map +1 -0
  46. package/esm/form/form-summary/FormSummaryAnswer.d.ts +11 -0
  47. package/esm/form/form-summary/FormSummaryAnswer.js +19 -0
  48. package/esm/form/form-summary/FormSummaryAnswer.js.map +1 -0
  49. package/esm/form/form-summary/FormSummaryAnswers.d.ts +9 -0
  50. package/esm/form/form-summary/FormSummaryAnswers.js +19 -0
  51. package/esm/form/form-summary/FormSummaryAnswers.js.map +1 -0
  52. package/esm/form/form-summary/FormSummaryEditLink.d.ts +17 -0
  53. package/esm/form/form-summary/FormSummaryEditLink.js +20 -0
  54. package/esm/form/form-summary/FormSummaryEditLink.js.map +1 -0
  55. package/esm/form/form-summary/FormSummaryHeader.d.ts +9 -0
  56. package/esm/form/form-summary/FormSummaryHeader.js +19 -0
  57. package/esm/form/form-summary/FormSummaryHeader.js.map +1 -0
  58. package/esm/form/form-summary/FormSummaryHeading.d.ts +14 -0
  59. package/esm/form/form-summary/FormSummaryHeading.js +5 -0
  60. package/esm/form/form-summary/FormSummaryHeading.js.map +1 -0
  61. package/esm/form/form-summary/FormSummaryLabel.d.ts +6 -0
  62. package/esm/form/form-summary/FormSummaryLabel.js +19 -0
  63. package/esm/form/form-summary/FormSummaryLabel.js.map +1 -0
  64. package/esm/form/form-summary/FormSummaryValue.d.ts +6 -0
  65. package/esm/form/form-summary/FormSummaryValue.js +20 -0
  66. package/esm/form/form-summary/FormSummaryValue.js.map +1 -0
  67. package/esm/form/form-summary/index.d.ts +8 -0
  68. package/esm/form/form-summary/index.js +10 -0
  69. package/esm/form/form-summary/index.js.map +1 -0
  70. package/esm/index.d.ts +3 -2
  71. package/esm/index.js +2 -1
  72. package/esm/index.js.map +1 -1
  73. package/esm/util/hooks/descendants/descendant.js +10 -1
  74. package/esm/util/hooks/descendants/descendant.js.map +1 -1
  75. package/esm/util/hooks/descendants/useDescendant.js +0 -5
  76. package/esm/util/hooks/descendants/useDescendant.js.map +1 -1
  77. package/package.json +15 -4
  78. package/src/form/combobox/FilteredOptions/filteredOptionsContext.tsx +9 -1
  79. package/src/form/combobox/Input/Input.tsx +5 -0
  80. package/src/form/form-summary/FormSummary.tsx +106 -0
  81. package/src/form/form-summary/FormSummaryAnswer.tsx +27 -0
  82. package/src/form/form-summary/FormSummaryAnswers.tsx +25 -0
  83. package/src/form/form-summary/FormSummaryEditLink.tsx +35 -0
  84. package/src/form/form-summary/FormSummaryHeader.tsx +25 -0
  85. package/src/form/form-summary/FormSummaryHeading.tsx +23 -0
  86. package/src/form/form-summary/FormSummaryLabel.tsx +17 -0
  87. package/src/form/form-summary/FormSummaryValue.tsx +24 -0
  88. package/src/form/form-summary/index.ts +30 -0
  89. package/src/index.ts +16 -15
  90. package/src/util/hooks/descendants/descendant.ts +15 -1
  91. package/src/util/hooks/descendants/useDescendant.tsx +0 -5
  92. package/src/accordion/accordion.stories.tsx +0 -286
  93. package/src/alert/alert.stories.tsx +0 -306
  94. package/src/button/button.stories.tsx +0 -185
  95. package/src/chat/chat.stories.tsx +0 -341
  96. package/src/chips/chips.stories.tsx +0 -260
  97. package/src/copybutton/copy-button.stories.tsx +0 -261
  98. package/src/date/datepicker/datepicker.stories.tsx +0 -614
  99. package/src/date/monthpicker/monthpicker.stories.tsx +0 -221
  100. package/src/dropdown/dropdown.stories.tsx +0 -124
  101. package/src/expansion-card/expansion-card.stories.tsx +0 -282
  102. package/src/form/checkbox/checkbox.stories.tsx +0 -281
  103. package/src/form/combobox/combobox.stories.tsx +0 -626
  104. package/src/form/confirmation-panel/confirmation-panel.stories.tsx +0 -128
  105. package/src/form/error-summary/error-summary.stories.tsx +0 -81
  106. package/src/form/fieldset/fieldset.stories.tsx +0 -157
  107. package/src/form/file-upload/file-upload-dropzone.stories.tsx +0 -123
  108. package/src/form/file-upload/file-upload-item.stories.tsx +0 -148
  109. package/src/form/file-upload/file-upload.stories.tsx +0 -248
  110. package/src/form/radio/radio.stories.tsx +0 -230
  111. package/src/form/search/search.stories.tsx +0 -238
  112. package/src/form/select/select.stories.tsx +0 -172
  113. package/src/form/switch/switch.stories.tsx +0 -171
  114. package/src/form/textarea/textarea.stories.tsx +0 -254
  115. package/src/form/textfield/text-field.stories.tsx +0 -143
  116. package/src/guide-panel/guidepanel.stories.tsx +0 -90
  117. package/src/help-text/help-text.stories.tsx +0 -91
  118. package/src/internal-header/header.stories.tsx +0 -229
  119. package/src/layout/bleed/Bleed.stories.tsx +0 -395
  120. package/src/layout/box/Box.stories.tsx +0 -380
  121. package/src/layout/grid/h-grid.stories.tsx +0 -122
  122. package/src/layout/page/Page.stories.tsx +0 -271
  123. package/src/layout/responsive/hide.stories.tsx +0 -80
  124. package/src/layout/responsive/show.stories.tsx +0 -80
  125. package/src/layout/sidemal-test/navno-sidemal.stories.tsx +0 -69
  126. package/src/layout/stack/stack.stories.tsx +0 -183
  127. package/src/link/stories/link.stories.tsx +0 -304
  128. package/src/link-panel/link-panel.stories.tsx +0 -59
  129. package/src/list/list.stories.tsx +0 -280
  130. package/src/loader/loader.stories.tsx +0 -82
  131. package/src/modal/modal.stories.tsx +0 -391
  132. package/src/pagination/pagination.stories.tsx +0 -110
  133. package/src/popover/popover.stories.tsx +0 -113
  134. package/src/portal/Portal.stories.tsx +0 -102
  135. package/src/read-more/readmore.stories.tsx +0 -91
  136. package/src/skeleton/skeleton.stories.tsx +0 -130
  137. package/src/stepper/stepper.stories.tsx +0 -200
  138. package/src/table/stories/table-1.stories.tsx +0 -292
  139. package/src/table/stories/table-2-expandable.stories.tsx +0 -298
  140. package/src/table/stories/table-3-async.stories.tsx +0 -179
  141. package/src/table/stories/tests/table.stories.tsx +0 -102
  142. package/src/tabs/Tabs.stories.tsx +0 -311
  143. package/src/tag/tag.stories.tsx +0 -126
  144. package/src/timeline/timeline.stories.tsx +0 -445
  145. package/src/toggle-group/ToggleGroup.stories.tsx +0 -198
  146. package/src/tooltip/tooltip.stories.tsx +0 -101
  147. package/src/typography/stories/bodylong.stories.tsx +0 -209
  148. package/src/typography/stories/bodyshort.stories.tsx +0 -208
  149. package/src/typography/stories/detail.stories.tsx +0 -115
  150. package/src/typography/stories/error-message.stories.tsx +0 -122
  151. package/src/typography/stories/heading.stories.tsx +0 -169
  152. package/src/typography/stories/label.stories.tsx +0 -131
  153. package/src/util/hooks/descendants/descendant.stories.tsx +0 -147
@@ -1,143 +0,0 @@
1
- import { Meta, StoryObj } from "@storybook/react";
2
- import React from "react";
3
- import TextField from "./TextField";
4
-
5
- export default {
6
- title: "ds-react/TextField",
7
- component: TextField,
8
- argTypes: {
9
- size: {
10
- control: {
11
- type: "radio",
12
- options: ["medium", "small"],
13
- },
14
- },
15
- description: {
16
- type: "string",
17
- },
18
- error: {
19
- type: "string",
20
- },
21
- hideLabel: {
22
- type: "boolean",
23
- },
24
- disabled: {
25
- type: "boolean",
26
- },
27
- },
28
- parameters: {
29
- chromatic: { disable: true },
30
- },
31
- } as Meta;
32
-
33
- type Story = StoryObj<typeof TextField>;
34
-
35
- export const Default = {
36
- render: (props) => {
37
- return <TextField {...props} label="Ipsum enim quis culpa" />;
38
- },
39
-
40
- args: {},
41
- };
42
-
43
- export const Small = () => {
44
- return <TextField size="small" label="Ipsum enim quis culpa" />;
45
- };
46
-
47
- export const Description = () => {
48
- return (
49
- <div className="colgap">
50
- <TextField
51
- label="Ipsum enim quis culpa"
52
- description="Consectetur labore velit eiusmod Lorem ut nostrud mollit labore ullamco laboris laboris in."
53
- />
54
- <TextField
55
- label="Ipsum enim quis culpa"
56
- description="Consectetur labore velit eiusmod Lorem ut nostrud mollit labore ullamco laboris laboris in."
57
- size="small"
58
- />
59
- </div>
60
- );
61
- };
62
-
63
- export const Error = () => {
64
- return (
65
- <div className="colgap">
66
- <TextField
67
- label="Ipsum enim quis culpa"
68
- error="Consectetur labore velit eiusmod Lorem ut nostrud mollit labore ullamco laboris laboris in."
69
- />
70
-
71
- <TextField
72
- label="Ipsum enim quis culpa"
73
- error="Consectetur labore velit eiusmod Lorem ut nostrud mollit labore ullamco laboris laboris in."
74
- size="small"
75
- />
76
- </div>
77
- );
78
- };
79
-
80
- export const Disabled = () => {
81
- return (
82
- <div className="colgap">
83
- <TextField label="Ipsum enim quis culpa" disabled />
84
- <TextField label="Ipsum enim quis culpa" disabled size="small" />
85
- </div>
86
- );
87
- };
88
-
89
- export const HideLabel = () => {
90
- return <TextField label="Ipsum enim quis culpa" hideLabel />;
91
- };
92
-
93
- export const Readonly = () => {
94
- return (
95
- <div className="colgap">
96
- <TextField
97
- label="Bosted"
98
- description="Skriv bosted i Norge"
99
- readOnly
100
- value="Oslo"
101
- />
102
- <TextField label="Bosted" readOnly error="feilmelding" value="Oslo" />
103
- </div>
104
- );
105
- };
106
-
107
- export const Chromatic: Story = {
108
- render: () => (
109
- <div>
110
- <div>
111
- <h2>Default</h2>
112
- {Default?.render({})}
113
- </div>
114
- <div>
115
- <h2>Small</h2>
116
- <Small />
117
- </div>
118
- <div>
119
- <h2>Description</h2>
120
- <Description />
121
- </div>
122
- <div>
123
- <h2>Error</h2>
124
- <Error />
125
- </div>
126
- <div>
127
- <h2>Disabled</h2>
128
- <Disabled />
129
- </div>
130
- <div>
131
- <h2>HideLabel</h2>
132
- <HideLabel />
133
- </div>
134
- <div>
135
- <h2>Readonly</h2>
136
- <Readonly />
137
- </div>
138
- </div>
139
- ),
140
- parameters: {
141
- chromatic: { disable: false },
142
- },
143
- };
@@ -1,90 +0,0 @@
1
- import { Meta } from "@storybook/react";
2
- import React from "react";
3
- import { InformationIcon } from "@navikt/aksel-icons";
4
- import { VStack } from "../layout/stack";
5
- import { BodyLong } from "../typography";
6
- import GuidePanel from "./GuidePanel";
7
-
8
- export default {
9
- title: "ds-react/GuidePanel",
10
- component: GuidePanel,
11
- } satisfies Meta<typeof GuidePanel>;
12
-
13
- const panelText = `Sit sint eu dolore reprehenderit exercitation labore aute anim sit
14
- adipisicing proident. Tempor ipsum ea cupidatat qui esse do veniam
15
- cupidatat. Excepteur irure reprehenderit esse tempor nisi duis qui ea
16
- enim id.`;
17
-
18
- export const Default = {
19
- render: (props: { poster: boolean; colorOverride: boolean }) => {
20
- const style = props.colorOverride
21
- ? {
22
- "--ac-guide-panel-illustration-bg": "var(--a-purple-200)",
23
- "--ac-guide-panel-border": "var(--a-purple-400)",
24
- }
25
- : {};
26
-
27
- return (
28
- <GuidePanel style={style} poster={props?.poster}>
29
- {panelText}
30
- </GuidePanel>
31
- );
32
- },
33
-
34
- args: {
35
- poster: false,
36
- colorOverride: false,
37
- },
38
- };
39
-
40
- export const PosterVariants = {
41
- render: () => (
42
- <VStack gap="6" align="start">
43
- <GuidePanel>
44
- If you exclude the `poster` prop, you will get the poster variant on
45
- mobile (&lt;480px) and the non-poster variant otherwise.
46
- </GuidePanel>
47
- <GuidePanel poster>
48
- Use the `poster` prop to get the poster variant on all viewports.
49
- </GuidePanel>
50
- <GuidePanel poster={false}>
51
- Set `poster=false` to get the non-poster variant on all viewports.
52
- </GuidePanel>
53
- </VStack>
54
- ),
55
-
56
- parameters: {
57
- chromatic: { viewports: [479, 800] },
58
- },
59
- };
60
-
61
- export const ColorOverride = () => (
62
- <GuidePanel
63
- style={{
64
- "--ac-guide-panel-illustration-bg": "var(--a-purple-200)",
65
- "--ac-guide-panel-border": "var(--a-purple-400)",
66
- }}
67
- >
68
- {panelText}
69
- </GuidePanel>
70
- );
71
-
72
- export const Content = () => (
73
- <GuidePanel>
74
- <BodyLong spacing>
75
- Duis et ex ad magna nostrud ut officia nulla cillum commodo sint irure
76
- elit nulla. Ad proident nulla ex sunt exercitation sunt Lorem non laboris
77
- ea ex cillum nulla consequat. Enim pariatur eiusmod quis est fugiat
78
- officia nostrud dolore occaecat nisi.
79
- </BodyLong>
80
- <BodyLong>
81
- Do esse magna nulla amet excepteur. Tempor laboris ipsum magna velit
82
- dolore nulla id ex mollit. Deserunt ut esse laboris pariatur tempor
83
- laborum veniam enim. Nisi deserunt officia minim enim.
84
- </BodyLong>
85
- </GuidePanel>
86
- );
87
-
88
- export const CustomIllustration = () => (
89
- <GuidePanel illustration={<InformationIcon />}>{panelText}</GuidePanel>
90
- );
@@ -1,91 +0,0 @@
1
- import { Meta, StoryFn, StoryObj } from "@storybook/react";
2
- import React, { useEffect, useRef } from "react";
3
- import { BodyLong, Heading } from "../typography";
4
- import HelpText from "./HelpText";
5
-
6
- const meta: Meta<typeof HelpText> = {
7
- title: "ds-react/HelpText",
8
- component: HelpText,
9
- parameters: {
10
- chromatic: { delay: 300 },
11
- },
12
- };
13
- export default meta;
14
-
15
- export const Default: StoryObj<typeof HelpText> = {
16
- render: (props) => (
17
- <HelpText {...props}>Id ullamco excepteur elit fugiat labore.</HelpText>
18
- ),
19
-
20
- args: {
21
- title: "Show tooltip",
22
- },
23
- argTypes: {
24
- placement: {
25
- control: { type: "radio" },
26
- options: [
27
- "top",
28
- "bottom",
29
- "right",
30
- "left",
31
- "top-start",
32
- "top-end",
33
- "bottom-start",
34
- "bottom-end",
35
- "right-start",
36
- "right-end",
37
- "left-start",
38
- "left-end",
39
- ],
40
- },
41
- strategy: {
42
- control: { type: "radio" },
43
- options: ["fixed", "absolute"],
44
- },
45
- },
46
- };
47
-
48
- export const Open: StoryFn = () => {
49
- const ref = useRef<HTMLButtonElement | null>(null);
50
- useEffect(() => {
51
- ref.current && ref.current.click();
52
- }, []);
53
-
54
- return (
55
- <HelpText ref={ref} title="Show tooltip" strategy="fixed">
56
- Incididunt laborum eiusmod ullamco id aliquip officia ex irure aliqua
57
- laboris id ea do nisi. Ex esse ad duis culpa non aliquip exercitation eu
58
- culpa cupidatat nisi. Deserunt voluptate consectetur cillum elit qui ad
59
- voluptate pariatur.
60
- </HelpText>
61
- );
62
- };
63
-
64
- export const WrapperClassName: StoryFn = () => (
65
- <div>
66
- <BodyLong spacing>
67
- Lorem ipsum dolor sit amet consectetur adipisicing elit. Soluta
68
- perspiciatis vero voluptatum, asperiores cumque, deserunt accusantium
69
- ullam ipsa accusamus officia cupiditate quae unde esse culpa, ratione ab
70
- quam ea quas?
71
- </BodyLong>
72
-
73
- <Heading level="2" size="medium">
74
- 67 år og 1 måneder øklasdjkl askdak døkasøk daøkdkølasøkld asølkdøka
75
- <HelpText wrapperClassName="testClass">
76
- Lorem ipsum dolor sit amet consectetur adipisicing elit. Soluta
77
- perspiciatis vero voluptatum, asperiores cumque, deserunt accusantium
78
- ullam ipsa accusamus officia cupiditate quae unde esse culpa, ratione ab
79
- quam ea quas?
80
- </HelpText>
81
- <style>{`.testClass {display: inline-block; margin-left: 0.5rem; vertical-align: middle;}`}</style>
82
- </Heading>
83
-
84
- <BodyLong spacing>
85
- Lorem ipsum dolor sit amet consectetur adipisicing elit. Soluta
86
- perspiciatis vero voluptatum, asperiores cumque, deserunt accusantium
87
- ullam ipsa accusamus officia cupiditate quae unde esse culpa, ratione ab
88
- quam ea quas?
89
- </BodyLong>
90
- </div>
91
- );
@@ -1,229 +0,0 @@
1
- import { Meta } from "@storybook/react";
2
- import React from "react";
3
- import {
4
- ChevronDownIcon,
5
- CogIcon,
6
- ExternalLinkIcon,
7
- LeaveIcon,
8
- MenuGridIcon,
9
- } from "@navikt/aksel-icons";
10
- import { BodyLong, BodyShort, Detail, Spacer } from "@navikt/ds-react";
11
- import { Dropdown } from "../dropdown";
12
- import InternalHeader from "./InternalHeader";
13
-
14
- export default {
15
- title: "ds-react/InternalHeader",
16
- component: InternalHeader,
17
- argTypes: {
18
- user: {
19
- control: {
20
- type: "radio",
21
- options: ["simple", "with description", "with dropdown"],
22
- },
23
- },
24
- },
25
- } as Meta;
26
-
27
- export const Default = {
28
- render: (props) => {
29
- return (
30
- <InternalHeader style={{ width: 600 }}>
31
- {props?.titleAsHeading ? (
32
- <InternalHeader.Title as="h1">Tittel</InternalHeader.Title>
33
- ) : (
34
- <InternalHeader.Title href="/#home">
35
- Tittel med lenke
36
- </InternalHeader.Title>
37
- )}
38
- {props.systemMenu && (
39
- <Dropdown>
40
- <InternalHeader.Button
41
- as={Dropdown.Toggle}
42
- style={{ marginLeft: "auto" }}
43
- >
44
- <MenuGridIcon
45
- style={{ fontSize: "1.5rem" }}
46
- title="MenuGridIconer og oppslagsverk"
47
- />
48
- </InternalHeader.Button>
49
- <Dropdown.Menu strategy="fixed">
50
- <Dropdown.Menu.List>
51
- <Dropdown.Menu.List.Item>
52
- <span>A.Inntekt</span>
53
- <ExternalLinkIcon style={{ fontSize: "0.875rem" }} />
54
- </Dropdown.Menu.List.Item>
55
- <Dropdown.Menu.List.Item>
56
- <span>Aa-registeret</span>
57
- <ExternalLinkIcon style={{ fontSize: "0.875rem" }} />
58
- </Dropdown.Menu.List.Item>
59
- <Dropdown.Menu.List.Item>
60
- <span>Gosys</span>
61
- <ExternalLinkIcon style={{ fontSize: "0.875rem" }} />
62
- </Dropdown.Menu.List.Item>
63
- </Dropdown.Menu.List>
64
- </Dropdown.Menu>
65
- </Dropdown>
66
- )}
67
- {(!props.user || props.user === "simple") && (
68
- <InternalHeader.User
69
- name="Ola Normann"
70
- style={{ marginLeft: props.systemMenu ? "none" : "auto" }}
71
- />
72
- )}
73
- {props.user === "with description" && (
74
- <InternalHeader.User
75
- name="Ola Normann"
76
- description="0123456"
77
- style={{ marginLeft: props.systemMenu ? "none" : "auto" }}
78
- />
79
- )}
80
- {props.user === "with dropdown" && (
81
- <Dropdown>
82
- <InternalHeader.Button
83
- as={Dropdown.Toggle}
84
- style={{
85
- marginLeft: props.systemMenu ? "none" : "auto",
86
- paddingRight: "1.5rem",
87
- paddingLeft: "1.5rem",
88
- gap: "1rem",
89
- }}
90
- >
91
- <BodyShort title="Ola Normann">KH</BodyShort>
92
- <ChevronDownIcon />
93
- </InternalHeader.Button>
94
- <Dropdown.Menu strategy="fixed">
95
- <div>
96
- <BodyLong size="small" as="div">
97
- Ola Normann 16px
98
- </BodyLong>
99
- <Detail size="small" as="div">
100
- <div>Ident nr 14px</div>
101
- <div>Enhet: Skien</div>
102
- </Detail>
103
- </div>
104
- <Dropdown.Menu.Divider />
105
- <Dropdown.Menu.List>
106
- <Dropdown.Menu.List.Item as="a" href="/#settings">
107
- Innstillinger <Spacer />{" "}
108
- <CogIcon aria-hidden fontSize="1.5rem" />
109
- </Dropdown.Menu.List.Item>
110
- <Dropdown.Menu.List.Item onClick={() => console.log("logg ut")}>
111
- Logg ut <Spacer /> <LeaveIcon aria-hidden fontSize="1.5rem" />
112
- </Dropdown.Menu.List.Item>
113
- </Dropdown.Menu.List>
114
- </Dropdown.Menu>
115
- </Dropdown>
116
- )}
117
- </InternalHeader>
118
- );
119
- },
120
-
121
- args: {
122
- titleAsHeading: false,
123
- systemMenu: false,
124
- },
125
- };
126
-
127
- export const TitleAsHeading = () => (
128
- <InternalHeader style={{ width: 600 }}>
129
- <InternalHeader.Title as="h1">Tittel</InternalHeader.Title>
130
- </InternalHeader>
131
- );
132
-
133
- export const TitleAsLink = () => (
134
- <InternalHeader style={{ width: 600 }}>
135
- <InternalHeader.Title href="/#home">Tittel med lenke</InternalHeader.Title>
136
- </InternalHeader>
137
- );
138
-
139
- export const User = () => (
140
- <InternalHeader style={{ width: 600 }}>
141
- <InternalHeader.Title href="/#home">Tittel med lenke</InternalHeader.Title>
142
- <InternalHeader.User name="Ola Normann" style={{ marginLeft: "auto" }} />
143
- </InternalHeader>
144
- );
145
-
146
- export const UserWithDescription = () => (
147
- <InternalHeader style={{ width: 600 }}>
148
- <InternalHeader.Title href="/#home">Tittel med lenke</InternalHeader.Title>
149
- <InternalHeader.User
150
- name="Ola Normann"
151
- description="id: 123456"
152
- style={{ marginLeft: "auto" }}
153
- />
154
- </InternalHeader>
155
- );
156
-
157
- export const UserWithMenu = () => (
158
- <InternalHeader style={{ width: 600 }}>
159
- <InternalHeader.Title href="/#home">Tittel med lenke</InternalHeader.Title>
160
- <Dropdown>
161
- <InternalHeader.Button
162
- as={Dropdown.Toggle}
163
- style={{
164
- marginLeft: "auto",
165
- paddingRight: "1.5rem",
166
- paddingLeft: "1.5rem",
167
- gap: "1rem",
168
- }}
169
- >
170
- <BodyShort title="Ola Normann">KH</BodyShort>
171
- <ChevronDownIcon />
172
- </InternalHeader.Button>
173
- <Dropdown.Menu strategy="fixed">
174
- <div>
175
- <BodyLong size="small" as="div">
176
- Ola Normann 16px
177
- </BodyLong>
178
- <Detail size="small" as="div">
179
- <div>Ident nr 14px</div>
180
- <div>Enhet: Skien</div>
181
- </Detail>
182
- </div>
183
- <Dropdown.Menu.Divider />
184
- <Dropdown.Menu.List>
185
- <Dropdown.Menu.List.Item as="a" href="/#settings">
186
- Innstillinger <Spacer /> <CogIcon aria-hidden fontSize="1.5rem" />
187
- </Dropdown.Menu.List.Item>
188
- <Dropdown.Menu.List.Item onClick={() => console.log("logg ut")}>
189
- Logg ut <Spacer /> <LeaveIcon aria-hidden fontSize="1.5rem" />
190
- </Dropdown.Menu.List.Item>
191
- </Dropdown.Menu.List>
192
- </Dropdown.Menu>
193
- </Dropdown>
194
- </InternalHeader>
195
- );
196
-
197
- export const UserWithMenuGridIconMenu = () => (
198
- <InternalHeader style={{ width: 600 }}>
199
- <InternalHeader.Title href="/#home">Tittel med lenke</InternalHeader.Title>
200
- <Dropdown>
201
- <InternalHeader.Button
202
- as={Dropdown.Toggle}
203
- style={{ marginLeft: "auto" }}
204
- >
205
- <MenuGridIcon
206
- style={{ fontSize: "1.5rem" }}
207
- title="MenuGridIconer og oppslagsverk"
208
- />
209
- </InternalHeader.Button>
210
- <Dropdown.Menu strategy="fixed">
211
- <Dropdown.Menu.List>
212
- <Dropdown.Menu.List.Item>
213
- <span>A.Inntekt</span>
214
- <ExternalLinkIcon style={{ fontSize: "0.875rem" }} />
215
- </Dropdown.Menu.List.Item>
216
- <Dropdown.Menu.List.Item>
217
- <span>Aa-registeret</span>
218
- <ExternalLinkIcon style={{ fontSize: "0.875rem" }} />
219
- </Dropdown.Menu.List.Item>
220
- <Dropdown.Menu.List.Item>
221
- <span>Gosys</span>
222
- <ExternalLinkIcon style={{ fontSize: "0.875rem" }} />
223
- </Dropdown.Menu.List.Item>
224
- </Dropdown.Menu.List>
225
- </Dropdown.Menu>
226
- </Dropdown>
227
- <InternalHeader.User name="Ola Normann" description="id: 123456" />
228
- </InternalHeader>
229
- );