@navikt/ds-react 6.11.0 → 6.12.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 (123) hide show
  1. package/cjs/alert/Alert.d.ts +5 -0
  2. package/cjs/alert/Alert.js +5 -3
  3. package/cjs/alert/Alert.js.map +1 -1
  4. package/cjs/layout/base/BasePrimitive.d.ts +35 -3
  5. package/cjs/layout/base/BasePrimitive.js +33 -3
  6. package/cjs/layout/base/BasePrimitive.js.map +1 -1
  7. package/cjs/layout/base/PrimitiveAsChildProps.d.ts +41 -0
  8. package/cjs/layout/base/PrimitiveAsChildProps.js +3 -0
  9. package/cjs/layout/base/PrimitiveAsChildProps.js.map +1 -0
  10. package/cjs/layout/box/Box.d.ts +5 -32
  11. package/cjs/layout/box/Box.js +15 -4
  12. package/cjs/layout/box/Box.js.map +1 -1
  13. package/cjs/layout/grid/HGrid.d.ts +7 -5
  14. package/cjs/layout/grid/HGrid.js +7 -2
  15. package/cjs/layout/grid/HGrid.js.map +1 -1
  16. package/cjs/layout/stack/HStack.d.ts +2 -1
  17. package/cjs/layout/stack/HStack.js.map +1 -1
  18. package/cjs/layout/stack/Stack.d.ts +8 -5
  19. package/cjs/layout/stack/Stack.js +10 -5
  20. package/cjs/layout/stack/Stack.js.map +1 -1
  21. package/cjs/layout/stack/VStack.d.ts +2 -1
  22. package/cjs/layout/stack/VStack.js.map +1 -1
  23. package/cjs/layout/utilities/css.js +3 -0
  24. package/cjs/layout/utilities/css.js.map +1 -1
  25. package/cjs/toggle-group/parts/useToggleItem.js +1 -1
  26. package/cjs/toggle-group/parts/useToggleItem.js.map +1 -1
  27. package/cjs/util/types/AsChildProps.d.ts +1 -0
  28. package/esm/alert/Alert.d.ts +5 -0
  29. package/esm/alert/Alert.js +5 -3
  30. package/esm/alert/Alert.js.map +1 -1
  31. package/esm/layout/base/BasePrimitive.d.ts +35 -3
  32. package/esm/layout/base/BasePrimitive.js +32 -2
  33. package/esm/layout/base/BasePrimitive.js.map +1 -1
  34. package/esm/layout/base/PrimitiveAsChildProps.d.ts +41 -0
  35. package/esm/layout/base/PrimitiveAsChildProps.js +2 -0
  36. package/esm/layout/base/PrimitiveAsChildProps.js.map +1 -0
  37. package/esm/layout/box/Box.d.ts +5 -32
  38. package/esm/layout/box/Box.js +15 -4
  39. package/esm/layout/box/Box.js.map +1 -1
  40. package/esm/layout/grid/HGrid.d.ts +7 -5
  41. package/esm/layout/grid/HGrid.js +7 -2
  42. package/esm/layout/grid/HGrid.js.map +1 -1
  43. package/esm/layout/stack/HStack.d.ts +2 -1
  44. package/esm/layout/stack/HStack.js.map +1 -1
  45. package/esm/layout/stack/Stack.d.ts +8 -5
  46. package/esm/layout/stack/Stack.js +10 -5
  47. package/esm/layout/stack/Stack.js.map +1 -1
  48. package/esm/layout/stack/VStack.d.ts +2 -1
  49. package/esm/layout/stack/VStack.js.map +1 -1
  50. package/esm/layout/utilities/css.js +3 -0
  51. package/esm/layout/utilities/css.js.map +1 -1
  52. package/esm/toggle-group/parts/useToggleItem.js +1 -1
  53. package/esm/toggle-group/parts/useToggleItem.js.map +1 -1
  54. package/esm/util/types/AsChildProps.d.ts +1 -0
  55. package/package.json +3 -3
  56. package/src/alert/Alert.tsx +23 -2
  57. package/src/layout/base/BasePrimitive.tsx +84 -2
  58. package/src/layout/base/PrimitiveAsChildProps.ts +42 -0
  59. package/src/layout/box/Box.tsx +64 -81
  60. package/src/layout/grid/HGrid.tsx +73 -45
  61. package/src/layout/stack/HStack.tsx +2 -1
  62. package/src/layout/stack/Stack.tsx +80 -62
  63. package/src/layout/stack/VStack.tsx +3 -1
  64. package/src/layout/utilities/css.ts +3 -0
  65. package/src/toggle-group/parts/useToggleItem.ts +4 -1
  66. package/src/util/types/AsChildProps.ts +1 -0
  67. package/cjs/layout/sidemal-test/AvatarPanel.d.ts +0 -4
  68. package/cjs/layout/sidemal-test/AvatarPanel.js +0 -19
  69. package/cjs/layout/sidemal-test/AvatarPanel.js.map +0 -1
  70. package/cjs/layout/sidemal-test/Content.d.ts +0 -2
  71. package/cjs/layout/sidemal-test/Content.js +0 -67
  72. package/cjs/layout/sidemal-test/Content.js.map +0 -1
  73. package/cjs/layout/sidemal-test/Filter.d.ts +0 -2
  74. package/cjs/layout/sidemal-test/Filter.js +0 -49
  75. package/cjs/layout/sidemal-test/Filter.js.map +0 -1
  76. package/cjs/layout/sidemal-test/Header.d.ts +0 -2
  77. package/cjs/layout/sidemal-test/Header.js +0 -49
  78. package/cjs/layout/sidemal-test/Header.js.map +0 -1
  79. package/cjs/layout/sidemal-test/Intro.d.ts +0 -2
  80. package/cjs/layout/sidemal-test/Intro.js +0 -37
  81. package/cjs/layout/sidemal-test/Intro.js.map +0 -1
  82. package/cjs/layout/sidemal-test/Sidebar.d.ts +0 -4
  83. package/cjs/layout/sidemal-test/Sidebar.js +0 -50
  84. package/cjs/layout/sidemal-test/Sidebar.js.map +0 -1
  85. package/cjs/layout/sidemal-test/content-box/ContentBox.d.ts +0 -8
  86. package/cjs/layout/sidemal-test/content-box/ContentBox.js +0 -66
  87. package/cjs/layout/sidemal-test/content-box/ContentBox.js.map +0 -1
  88. package/cjs/layout/sidemal-test/content-box/index.d.ts +0 -1
  89. package/cjs/layout/sidemal-test/content-box/index.js +0 -9
  90. package/cjs/layout/sidemal-test/content-box/index.js.map +0 -1
  91. package/esm/layout/sidemal-test/AvatarPanel.d.ts +0 -4
  92. package/esm/layout/sidemal-test/AvatarPanel.js +0 -12
  93. package/esm/layout/sidemal-test/AvatarPanel.js.map +0 -1
  94. package/esm/layout/sidemal-test/Content.d.ts +0 -2
  95. package/esm/layout/sidemal-test/Content.js +0 -60
  96. package/esm/layout/sidemal-test/Content.js.map +0 -1
  97. package/esm/layout/sidemal-test/Filter.d.ts +0 -2
  98. package/esm/layout/sidemal-test/Filter.js +0 -22
  99. package/esm/layout/sidemal-test/Filter.js.map +0 -1
  100. package/esm/layout/sidemal-test/Header.d.ts +0 -2
  101. package/esm/layout/sidemal-test/Header.js +0 -42
  102. package/esm/layout/sidemal-test/Header.js.map +0 -1
  103. package/esm/layout/sidemal-test/Intro.d.ts +0 -2
  104. package/esm/layout/sidemal-test/Intro.js +0 -30
  105. package/esm/layout/sidemal-test/Intro.js.map +0 -1
  106. package/esm/layout/sidemal-test/Sidebar.d.ts +0 -4
  107. package/esm/layout/sidemal-test/Sidebar.js +0 -41
  108. package/esm/layout/sidemal-test/Sidebar.js.map +0 -1
  109. package/esm/layout/sidemal-test/content-box/ContentBox.d.ts +0 -8
  110. package/esm/layout/sidemal-test/content-box/ContentBox.js +0 -37
  111. package/esm/layout/sidemal-test/content-box/ContentBox.js.map +0 -1
  112. package/esm/layout/sidemal-test/content-box/index.d.ts +0 -1
  113. package/esm/layout/sidemal-test/content-box/index.js +0 -2
  114. package/esm/layout/sidemal-test/content-box/index.js.map +0 -1
  115. package/src/layout/sidemal-test/AvatarPanel.tsx +0 -27
  116. package/src/layout/sidemal-test/Content.tsx +0 -129
  117. package/src/layout/sidemal-test/Filter.tsx +0 -46
  118. package/src/layout/sidemal-test/Header.tsx +0 -96
  119. package/src/layout/sidemal-test/Intro.tsx +0 -91
  120. package/src/layout/sidemal-test/Sidebar.tsx +0 -77
  121. package/src/layout/sidemal-test/content-box/ContentBox.tsx +0 -46
  122. package/src/layout/sidemal-test/content-box/index.ts +0 -1
  123. package/src/layout/sidemal-test/styling.css +0 -43
@@ -1,46 +0,0 @@
1
- import React, { useState } from "react";
2
- import { InformationSquareIcon } from "@navikt/aksel-icons";
3
- import { Checkbox, CheckboxGroup } from "../../form/checkbox";
4
- import { BodyLong, Detail, Heading } from "../../typography";
5
- import { Box } from "../box";
6
- import { HStack, VStack } from "../stack";
7
-
8
- export function FilterCard() {
9
- const [filter, setFilter] = useState<any[]>([]);
10
-
11
- return (
12
- <Box
13
- background="bg-default"
14
- padding={{ xs: "4", md: "5" }}
15
- borderWidth="5"
16
- borderColor="border-alt-3"
17
- borderRadius="medium"
18
- >
19
- <VStack gap="6">
20
- <Heading size="large">Fortell oss om situasjonen din</Heading>
21
- <BodyLong>
22
- Fortell oss litt om situasjonen din, så viser vi bare den
23
- informasjonen som er relevant for deg.
24
- </BodyLong>
25
- <div>
26
- <CheckboxGroup
27
- legend="Hva er situasjonen din?"
28
- size="small"
29
- onChange={setFilter}
30
- >
31
- <Checkbox value="box1">Jeg er arbeidsledig</Checkbox>
32
- <Checkbox value="box2">Jeg er permittert</Checkbox>
33
- </CheckboxGroup>
34
- {!filter.length && (
35
- <Box paddingBlock="2 0">
36
- <HStack gap="2" align="center">
37
- <InformationSquareIcon aria-hidden />
38
- <Detail>Ingen filtre er valgt, så alt innhold vises.</Detail>
39
- </HStack>
40
- </Box>
41
- )}
42
- </div>
43
- </VStack>
44
- </Box>
45
- );
46
- }
@@ -1,96 +0,0 @@
1
- import React from "react";
2
- import { BodyShort, Detail, Heading } from "../../typography";
3
- import { Box } from "../box";
4
- import { Hide, Show } from "../responsive";
5
- import { HStack, VStack } from "../stack";
6
- import { ContentBox } from "./content-box";
7
-
8
- export function Header() {
9
- return (
10
- <Box
11
- as="header"
12
- borderWidth="0 0 4 0"
13
- borderColor="border-success"
14
- paddingBlock="12 0"
15
- >
16
- <ContentBox maxWidth="lg">
17
- <Box background="surface-default" paddingInline="4" paddingBlock="0 6">
18
- <HStack align="start" gap="8">
19
- <Hide below="md">
20
- <Pictogram />
21
- </Hide>
22
-
23
- <VStack gap={{ xs: "4", md: "5" }}>
24
- <Heading level="1" size="xlarge">
25
- Dagpenger
26
- </Heading>
27
-
28
- <Hide below="md">
29
- <HStack gap="4" align="center">
30
- <BodyShort size="small">PENGESTØTTE</BodyShort>
31
- <span aria-hidden="true">|</span>
32
- <Detail>Oppdatert 5. juli 2023</Detail>
33
- </HStack>
34
- </Hide>
35
- <Show below="md">
36
- <VStack gap="2">
37
- <BodyShort size="small">PENGESTØTTE</BodyShort>
38
- <Detail>Oppdatert 24. august 2023</Detail>
39
- </VStack>
40
- </Show>
41
- </VStack>
42
- </HStack>
43
- </Box>
44
- </ContentBox>
45
- </Box>
46
- );
47
- }
48
-
49
- function Pictogram() {
50
- return (
51
- <svg
52
- aria-hidden
53
- xmlns="http://www.w3.org/2000/svg"
54
- fill="none"
55
- width="80"
56
- height="80"
57
- viewBox="0 0 96.45 96.44"
58
- >
59
- <g clipPath="url(#clip0_4486_7567)">
60
- <path
61
- d="M37.6276 55.6806L12.707 30.76L31.2599 12.2071L56.1805 37.1277L66.7031 26.6052L75.0165 74.5166L27.1051 66.2031L37.6276 55.6806Z"
62
- fill="#CCF1D6"
63
- />
64
- <path d="M41 11V33H2L2 9H27.5072" stroke="#262626" strokeWidth="3" />
65
- <circle cx="22" cy="16" r="6.5" stroke="#262626" strokeWidth="3" />
66
- <circle cx="35" cy="9" r="6.5" stroke="#262626" strokeWidth="3" />
67
- <circle cx="62" cy="63" r="22.5" stroke="#262626" strokeWidth="3" />
68
- <path
69
- d="M77.8105 77.7964L94.9534 94.9392"
70
- stroke="#262626"
71
- strokeWidth="3"
72
- />
73
- <path
74
- d="M47.6311 59.1036L72.7452 52.3743C73.0119 52.3028 73.2861 52.4611 73.3576 52.7279L75.1693 59.4894C75.3837 60.2896 74.9088 61.1121 74.1086 61.3265L50.9264 67.5381C50.1262 67.7525 49.3037 67.2777 49.0893 66.4775L47.2776 59.716C47.2061 59.4493 47.3644 59.1751 47.6311 59.1036Z"
75
- stroke="#262626"
76
- strokeWidth="3"
77
- />
78
- <path
79
- d="M52.3847 74.912L50.4436 67.6676L74.5917 61.1971L76.5329 68.4416C76.7473 69.2418 76.2724 70.0643 75.4722 70.2787L54.2218 75.9727C53.4216 76.1871 52.5991 75.7122 52.3847 74.912Z"
80
- stroke="#262626"
81
- strokeWidth="3"
82
- />
83
- <path
84
- d="M64.1814 55.1864L63.6638 53.2546C63.092 51.1207 60.8987 49.8544 58.7648 50.4261V50.4261C56.631 50.9979 55.3646 53.1913 55.9364 55.3251L56.454 57.257"
85
- stroke="#262626"
86
- strokeWidth="3"
87
- />
88
- </g>
89
- <defs>
90
- <clipPath id="clip0_4486_7567">
91
- <rect width="96" height="96" fill="white" />
92
- </clipPath>
93
- </defs>
94
- </svg>
95
- );
96
- }
@@ -1,91 +0,0 @@
1
- import React from "react";
2
- import { LinkIcon } from "@navikt/aksel-icons";
3
- import { CopyButton } from "../../copybutton";
4
- import { BodyLong, Detail, Heading, Label } from "../../typography";
5
- import { Box } from "../box";
6
- import { HStack, VStack } from "../stack";
7
-
8
- export function IntroCard() {
9
- return (
10
- <Box
11
- background="bg-default"
12
- padding={{ xs: "4", md: "10" }}
13
- borderRadius="medium"
14
- >
15
- <VStack gap="6">
16
- <VStack gap="3" align="start">
17
- <Heading size="large">Kort om dagpenger</Heading>
18
- <CopyButton
19
- copyText="#"
20
- text="Kopier lenke"
21
- activeText="Lenken er kopiert"
22
- size="small"
23
- icon={<LinkIcon aria-hidden />}
24
- />
25
- </VStack>
26
- <BodyLong>
27
- Dagpenger er en pengestøtte du kan få hvis du er arbeidsledig eller
28
- permittert.
29
- </BodyLong>
30
- <div>
31
- <Label as="p" spacing>
32
- Dagpenger er aktuelt for deg som
33
- </Label>
34
- <HStack wrap gap="4">
35
- <Box
36
- borderRadius="full"
37
- shadow="small"
38
- borderWidth="1"
39
- borderColor="border-subtle"
40
- paddingBlock="1"
41
- paddingInline="2"
42
- >
43
- <HStack gap="2" align="center">
44
- <Box
45
- borderRadius="full"
46
- background="surface-warning"
47
- padding="1"
48
- />
49
- <Detail as="span">Er arbeidsledig eller permitert</Detail>
50
- </HStack>
51
- </Box>
52
- <Box
53
- borderRadius="full"
54
- shadow="small"
55
- borderWidth="1"
56
- borderColor="border-subtle"
57
- paddingBlock="1"
58
- paddingInline="2"
59
- >
60
- <HStack gap="2" align="center">
61
- <Box
62
- borderRadius="full"
63
- background="surface-warning"
64
- padding="1"
65
- />
66
- <Detail as="span">Søker jobb</Detail>
67
- </HStack>
68
- </Box>
69
- <Box
70
- borderRadius="full"
71
- shadow="small"
72
- borderWidth="1"
73
- borderColor="border-subtle"
74
- paddingBlock="1"
75
- paddingInline="2"
76
- >
77
- <HStack gap="2" align="center">
78
- <Box
79
- borderRadius="full"
80
- background="surface-warning"
81
- padding="1"
82
- />
83
- <Detail as="span">Trenger hjelp til å komme i jobb</Detail>
84
- </HStack>
85
- </Box>
86
- </HStack>
87
- </div>
88
- </VStack>
89
- </Box>
90
- );
91
- }
@@ -1,77 +0,0 @@
1
- import React from "react";
2
- import { Link } from "../../link";
3
- import { Heading, Label } from "../../typography";
4
- import { Box } from "../box";
5
- import { VStack } from "../stack";
6
-
7
- const LinkElement = ({ children }) => {
8
- return (
9
- <Label as="li" className="sidebarlink">
10
- {children}
11
- </Label>
12
- );
13
- };
14
-
15
- export function Sidebar() {
16
- return (
17
- <VStack gap="4" className="sidebar">
18
- <ContentPanel />
19
- <NewsPanel />
20
- </VStack>
21
- );
22
- }
23
-
24
- export function ContentPanel() {
25
- return (
26
- <Box
27
- as="nav"
28
- aria-label="innhold"
29
- paddingInline="2"
30
- paddingBlock="8 4"
31
- background="surface-default"
32
- borderRadius="medium"
33
- >
34
- <Box paddingBlock="0 4" paddingInline="2 0">
35
- <Heading size="medium">Innhold</Heading>
36
- </Box>
37
- <ul className="reset-list">
38
- <LinkElement>Kort om dagpenger</LinkElement>
39
- <LinkElement>Hvem kan få?</LinkElement>
40
- <LinkElement>Hvor mye kan du få?</LinkElement>
41
- <LinkElement>Når utbetales pengene?</LinkElement>
42
- <LinkElement>Hvor lenge kan du få?</LinkElement>
43
- <LinkElement>Slik søker du</LinkElement>
44
- <LinkElement>Hva må du gjøre for å få dagpenger?</LinkElement>
45
- <LinkElement>Gi beskjed om endringer</LinkElement>
46
- <LinkElement>Jobb i kombinasjon med dagpenger</LinkElement>
47
- <LinkElement>Utdanning og opplæring</LinkElement>
48
- <LinkElement>Ferie og utenlandsopphold</LinkElement>
49
- <LinkElement>Slik klager du</LinkElement>
50
- </ul>
51
- </Box>
52
- );
53
- }
54
-
55
- export function NewsPanel() {
56
- return (
57
- <Box
58
- paddingBlock="4"
59
- paddingInline="2"
60
- background="surface-default"
61
- aria-label="Nyttig å vite"
62
- as="section"
63
- borderRadius="medium"
64
- >
65
- <Box paddingBlock="0 3" paddingInline="2">
66
- <Heading size="small">Nyttig å vite</Heading>
67
- </Box>
68
- <nav aria-label="innhold">
69
- <ul className="reset-list">
70
- <Box paddingBlock="2" paddingInline="2">
71
- <Link>Hva sier loven?</Link>
72
- </Box>
73
- </ul>
74
- </nav>
75
- </Box>
76
- );
77
- }
@@ -1,46 +0,0 @@
1
- import cl from "clsx";
2
- import React, { HTMLAttributes, forwardRef } from "react";
3
- import { OverridableComponent } from "../../../util";
4
-
5
- export interface ContentBoxProps extends HTMLAttributes<HTMLDivElement> {
6
- children: React.ReactNode;
7
- maxWidth?: "3xl" | "2xl" | "xl" | "lg";
8
- }
9
-
10
- export const ContentBox: OverridableComponent<ContentBoxProps, HTMLDivElement> =
11
- forwardRef(
12
- ({ as: Component = "div", className, maxWidth = "xl", ...rest }, ref) => {
13
- const getMaxWidth = () => {
14
- return maxWidth === "3xl"
15
- ? "1920px"
16
- : maxWidth === "2xl"
17
- ? "1440px"
18
- : maxWidth === "xl"
19
- ? "1280px"
20
- : "1024px";
21
- };
22
-
23
- return (
24
- <>
25
- <Component
26
- {...rest}
27
- ref={ref}
28
- style={{ "--__ac-contentbox--max-width": getMaxWidth() }}
29
- className={cl("navds-contentbox", className)}
30
- />
31
- <style>
32
- {`
33
- .navds-contentbox {
34
- --__ac-contentbox--max-width: initial;
35
-
36
- margin: 0 auto;
37
- max-width: var(--__ac-contentbox--max-width);
38
- }
39
- `}
40
- </style>
41
- </>
42
- );
43
- },
44
- );
45
-
46
- export default ContentBox;
@@ -1 +0,0 @@
1
- export { default as ContentBox, type ContentBoxProps } from "./ContentBox";
@@ -1,43 +0,0 @@
1
- .reset-list {
2
- list-style: none;
3
- margin: 0;
4
- padding: 0;
5
- }
6
-
7
- /* Sidebars */
8
- .sidebar {
9
- position: sticky;
10
- top: 1rem;
11
- bottom: 1rem;
12
- max-height: calc(100vh - 2rem);
13
- overflow: auto;
14
- }
15
-
16
- .sidebarlink {
17
- color: var(--a-text-action);
18
- cursor: pointer;
19
- padding: var(--a-spacing-3) var(--a-spacing-2);
20
- }
21
-
22
- .sidebarlink:hover {
23
- text-decoration: underline;
24
- background-color: var(--a-surface-action-subtle);
25
- color: var(--a-text-default);
26
- }
27
-
28
- /* Cards */
29
- .avatar-card {
30
- --avatar-size: 4rem;
31
-
32
- position: relative;
33
- margin-top: calc(var(--avatar-size) / 2);
34
- }
35
-
36
- .avatar {
37
- position: absolute;
38
- top: calc((var(--avatar-size) / 2) * -1);
39
- height: var(--avatar-size);
40
- width: var(--avatar-size);
41
- display: grid;
42
- place-content: center;
43
- }