@statsbygg/layout 0.1.18 → 0.1.19

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 CHANGED
@@ -267,7 +267,7 @@ npm run lint
267
267
  ## Dependencies
268
268
 
269
269
  This package includes:
270
- - `@digdir/designsystemet-react` 1.9.0
270
+ - `@digdir/designsystemet-react` 1.12.1
271
271
  - `@statsbygg/design-tokens` ^0.2.0
272
272
  - `clsx` ^2.0.0
273
273
  - `zustand` ^5.0.4
@@ -1,6 +1,5 @@
1
1
  .breadcrumbs {
2
2
  --dsc-breadcrumbs-color: var(--ds-color-text-default);
3
- padding: 2.5rem 0 0 0;
4
3
  }
5
4
 
6
5
  .link {
@@ -16,7 +15,6 @@
16
15
 
17
16
  .currentLink {
18
17
  text-decoration: none;
19
- font-weight: 500;
20
18
  pointer-events: none;
21
19
  color: var(--ds-color-text-default);
22
20
  }
@@ -1,25 +1,70 @@
1
1
  .header {
2
+ position: relative;
3
+ min-height: 179px;
4
+ min-width: 360px;
2
5
  background-color: var(--ds-color-background-tinted);
3
- border-bottom: 1px solid var(--ds-color-neutral-border-subtle);
4
6
  top: 0;
5
7
  z-index: 100;
8
+
9
+ }
10
+
11
+ .topBarFixedWrapper {
12
+ position: relative;
13
+ left: 0;
14
+ right: 0;
15
+ background: var(--ds-color-background-tinted);
16
+ }
17
+
18
+ .topBarFixed {
19
+ position: fixed;
20
+ top: 0;
21
+ }
22
+
23
+ .topBarContainer {
24
+ max-height: 10rem;
25
+ max-width: 90rem;
26
+ margin: 0 auto;
27
+ padding: 0 var(--ds-size-30);
28
+ }
29
+
30
+ .topBarContainer.topBarHidden {
31
+ max-height: 0;
32
+ opacity: 0;
6
33
  }
7
34
 
8
35
  .header.menuOpen {
9
36
  background-color: var(--ds-color-accent-surface-tinted);
37
+ position: fixed;
38
+ left: 0;
39
+ right: 0;
10
40
  }
11
41
 
12
- .headerContainer {
42
+ .header.menuOpen .topBarFixedWrapper {
43
+ background-color: var(--ds-color-accent-surface-tinted);
44
+ }
45
+
46
+ .headerBreadcrumbs {
47
+ max-width: 90rem;
48
+ padding: var(--ds-size-6) var(--ds-size-30) 0;
49
+ display: block;
13
50
  max-width: 90rem;
14
51
  margin: 0 auto;
15
- padding: 0 var(--ds-size-30);
16
52
  }
17
53
 
18
- .topBarContainer {
54
+ .headerContainer {
55
+ position: absolute;
56
+ left: 0;
57
+ right: 0;
58
+ top: 0;
59
+ background-color: var(--ds-color-background-tinted);
60
+ }
61
+
62
+ .topBarInner {
19
63
  display: flex;
64
+ min-width: 19rem;
20
65
  justify-content: space-between;
21
66
  align-items: center;
22
- padding: 1.25rem 0;
67
+ padding: var(--ds-size-10) 0;
23
68
  }
24
69
 
25
70
  .logo {
@@ -33,7 +78,7 @@
33
78
  .actionsContainer {
34
79
  display: flex;
35
80
  align-items: stretch;
36
- gap: var(--ds-size-9);
81
+ gap: var(--ds-size-8);
37
82
  min-height: inherit;
38
83
  }
39
84
 
@@ -47,21 +92,43 @@
47
92
  background: transparent;
48
93
  }
49
94
 
95
+ @media (max-width: 1024px) {
96
+
97
+ .header {
98
+ min-height: 155px;
99
+ }
100
+
101
+ .topBarContainer {
102
+ padding: 0 var(--ds-size-10);
103
+ }
104
+
105
+ .topBarInner {
106
+ padding: var(--ds-size-8) 0;
107
+ }
108
+
109
+ .headerBreadcrumbs {
110
+ padding: var(--ds-size-6) var(--ds-size-10) 0;
111
+ }
112
+ }
113
+
50
114
  @media (max-width: 768px) {
51
- .headerContainer {
52
- padding: 0 var(--ds-spacing-4);
115
+
116
+ .header {
117
+ min-height: 144px;
53
118
  }
54
119
 
55
120
  .topBarContainer {
121
+ padding: 0 var(--ds-size-8);
122
+ }
123
+
124
+ .topBarInner {
56
125
  flex-wrap: wrap;
57
- padding: var(--ds-spacing-4) 0;
126
+ padding: var(--ds-size-6) 0;
58
127
  }
59
128
 
60
129
  .actionsContainer {
61
130
  order: 3;
62
- width: 100%;
63
- flex-direction: column;
64
- gap: var(--ds-spacing-3);
131
+ gap: var(--ds-size-6);
65
132
  }
66
133
 
67
134
  .searchInput {
@@ -69,6 +136,54 @@
69
136
  min-width: auto;
70
137
  }
71
138
 
139
+ .searchButtonLabel {
140
+ display: none;
141
+ }
142
+
72
143
 
73
144
  .logo { inline-size: 8rem; }
145
+
146
+ .headerBreadcrumbs {
147
+ padding: var(--ds-size-6) var(--ds-size-8) 0;
148
+ }
149
+ }
150
+
151
+ @media (max-width: 600px) {
152
+
153
+ .header {
154
+ min-height: 128px;
155
+ }
156
+
157
+ .topBarInner {
158
+ padding: var(--ds-size-4) 0;
159
+ }
160
+
161
+ .topBarContainer {
162
+ padding: 0 var(--ds-size-6);
163
+ }
164
+
165
+ .headerBreadcrumbs {
166
+ padding: var(--ds-size-6) var(--ds-size-6);
167
+ }
168
+
169
+ }
170
+
171
+ @media (max-width: 360px) {
172
+
173
+ .header {
174
+ min-height: 122px;
175
+ }
176
+
177
+ .topBarContainer {
178
+ padding: 0 var(--ds-size-4);
179
+ }
180
+
181
+ .topBarInner {
182
+ padding: var(--ds-size-4) 0;
183
+ }
184
+
185
+ .headerBreadcrumbs {
186
+ padding: var(--ds-size-6) var(--ds-size-4) 0;
187
+ }
188
+
74
189
  }
@@ -20,6 +20,12 @@
20
20
  background-color: var(--ds-color-neutral-base-default);
21
21
  }
22
22
 
23
+ @media (max-width: 768px) {
24
+ .menuButtonLabel {
25
+ display: none;
26
+ }
27
+ }
28
+
23
29
  .devContainer {
24
30
  display: flex;
25
31
  gap: var(--ds-spacing-4);
@@ -1,16 +1,16 @@
1
1
  .menuOverlay {
2
- position: fixed;
3
- top: 5rem;
2
+ position: absolute;
3
+ top: 70%;
4
4
  left: 0;
5
5
  right: 0;
6
6
  margin: 0 auto;
7
- bottom: 0;
7
+ height: calc(100vh - 5rem);
8
+ height: calc(100dvh - 5rem);
8
9
  background-color: var(--ds-color-accent-surface-tinted);
9
10
  z-index: 99;
10
11
  overflow-y: auto;
11
12
  transform-origin: top right;
12
13
  border-radius: 0;
13
- max-width: 90rem;
14
14
  opacity: 1;
15
15
  transform: scale(1);
16
16
  transition: opacity 0.3s ease-in-out, transform 0.3s ease-in-out;
@@ -25,31 +25,32 @@
25
25
 
26
26
  .container {
27
27
  margin: 0 auto;
28
- padding: var(--ds-size-18) var(--ds-size-8);
28
+ padding: var(--ds-size-22) var(--ds-size-18);
29
29
  display: flex;
30
30
  flex-direction: column;
31
- gap: var(--ds-size-18);
31
+ max-width: 900px;
32
+ gap: var(--ds-size-22);
32
33
  }
33
34
 
34
35
  .searchSection {
35
36
  display: flex;
36
37
  flex-direction: column;
37
38
  align-items: flex-start;
38
- gap: var(--ds-size-8);
39
+ gap: var(--ds-size-2);
39
40
  opacity: 0;
40
41
  animation: fadeInScale 0.35s ease-out 0.1s forwards;
41
42
 
42
- & h1 {
43
- font-size: var(--ds-font-size-7);
44
- font-weight: 500;
45
- font-family: Arial, Helvetica, sans-serif;
46
- line-height: 130%;
47
- letter-spacing: -0.00469rem;
48
- }
43
+
44
+ }
45
+
46
+ .helpTitle {
47
+ color: var(--ds-color-text-default);
48
+ font-weight: 700;
49
+ letter-spacing: 0.105px;
49
50
  }
50
51
 
51
52
  .searchField {
52
- max-width: 32rem;
53
+ max-width: 37.5rem;
53
54
  width: 100%;
54
55
  }
55
56
 
@@ -81,9 +82,9 @@
81
82
  }
82
83
 
83
84
  .itemsGrid {
84
- display: flex;
85
+ display: grid;
86
+ grid-template-columns: repeat(3, 1fr);
85
87
  gap: var(--ds-size-8);
86
- flex-wrap: wrap;
87
88
  }
88
89
 
89
90
  .itemsGridThreeCol {
@@ -124,20 +125,9 @@
124
125
  gap: var(--ds-size-3);
125
126
  }
126
127
 
127
- @media (max-width: 768px) {
128
- .subsectionsGrid {
129
- flex-direction: column;
130
- gap: 2rem;
131
- }
132
-
133
- .subsection {
134
- min-width: 100%;
135
- }
136
- }
137
-
138
128
  .backdrop {
139
129
  position: fixed;
140
- top: 5rem;
130
+ top: 8rem;
141
131
 
142
132
  left: 0;
143
133
  right: 0;
@@ -194,19 +184,27 @@
194
184
  }
195
185
 
196
186
  @media (max-width: 1024px) {
197
- .container {
198
- padding: 2.5rem 3.75rem 3.5rem;
199
- }
187
+
188
+
200
189
  }
201
190
 
202
191
  @media (max-width: 768px) {
192
+ .subsectionsGrid {
193
+ flex-direction: column;
194
+ gap: var(--ds-size-12);
195
+ }
196
+
197
+ .subsection {
198
+ min-width: 100%;
199
+ }
200
+
203
201
  .menuOverlay {
204
- top: 4rem;
202
+ top: 5rem;
205
203
  }
206
204
 
207
205
  .container {
208
- padding: 2rem 1.5rem 3rem;
209
- gap: 2.5rem;
206
+ padding: var(--ds-size-12) var(--ds-size-12);
207
+ gap: var(--ds-size-18);
210
208
  }
211
209
 
212
210
  .searchSection {
@@ -219,6 +217,36 @@
219
217
 
220
218
  .itemsGrid {
221
219
  flex-direction: column;
222
- gap: 1.5rem;
220
+ }
221
+
222
+ .searchField {
223
+ max-width: 48rem;
224
+ }
225
+ }
226
+
227
+ @media (max-width: 600px) {
228
+ .itemsGrid {
229
+ grid-template-columns: 1fr;
230
+ gap: var(--ds-size-7);
231
+ }
232
+
233
+ .container {
234
+ padding: var(--ds-size-18) var(--ds-size-12);
235
+ gap: var(--ds-size-18);
236
+ }
237
+
238
+ .searchField {
239
+ max-width: 48rem;
240
+ }
241
+ }
242
+
243
+ @media (max-width: 360px) {
244
+ .itemsGrid {
245
+ grid-template-columns: 1fr;
246
+ }
247
+
248
+ .container {
249
+ padding: var(--ds-size-18) var(--ds-size-4);
250
+ gap: var(--ds-size-18);
223
251
  }
224
252
  }
@@ -10,17 +10,25 @@
10
10
 
11
11
  .parentLink {
12
12
  color: var(--ds-color-text-subtle);
13
- font-size: var(--ds-font-size-5);
14
- line-height: var(--ds-line-height-sm);
15
- text-decoration: underline;
13
+ font-size: var(--ds-font-size-4);
14
+ line-height: 150%;
15
+ text-decoration: none;
16
16
  display: inline-flex;
17
- align-items: center;
18
- gap: var(--ds-size-2);
17
+ align-self: flex-start;
18
+ gap: var(--ds-size-1);
19
19
  line-height: 150%;
20
20
  letter-spacing: 0.00656rem;
21
21
  text-underline-offset: 6px;
22
22
  }
23
23
 
24
+ .arrowIcon {
25
+ width: 1.6875rem; /* 27px */
26
+ height: 1.6875rem;
27
+ flex-shrink: 0;
28
+ margin-left: auto;
29
+ margin-top: 3px;
30
+ }
31
+
24
32
  .childItems {
25
33
  list-style: none;
26
34
  margin: 0;
package/dist/index.d.ts CHANGED
@@ -1,7 +1,7 @@
1
1
  import * as react_jsx_runtime from 'react/jsx-runtime';
2
2
  import * as zustand_middleware from 'zustand/middleware';
3
3
  import * as zustand from 'zustand';
4
- import { ReactNode } from 'react';
4
+ import { RefObject, ReactNode } from 'react';
5
5
 
6
6
  type RouteNode = {
7
7
  path: string;
@@ -57,6 +57,8 @@ type GlobalState = {
57
57
  locale: string;
58
58
  isMenuOpen: boolean;
59
59
  breadcrumbs: BreadcrumbItem[] | null;
60
+ searchInputRef: RefObject<HTMLInputElement | null> | null;
61
+ setSearchInputRef: (ref: RefObject<HTMLInputElement | null> | null) => void;
60
62
  setUser: (user: GlobalState['user']) => void;
61
63
  setTheme: (theme: Theme) => void;
62
64
  setLocale: (locale: string) => void;
@@ -112,6 +114,7 @@ type MenuSubsection = {
112
114
  };
113
115
  type MenuSection = {
114
116
  title: string;
117
+ hideTitle?: boolean;
115
118
  layout?: 'columns' | 'subsections';
116
119
  items?: MenuItem[];
117
120
  subsections?: MenuSubsection[];