@helsenorge/designsystem-react 16.0.0 → 16.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/Button.js +8 -9
- package/lib/Button.js.map +1 -1
- package/lib/CHANGELOG.md +24 -0
- package/lib/Checkbox.js +0 -2
- package/lib/Checkbox.js.map +1 -1
- package/lib/Drawer.js +30 -30
- package/lib/Drawer.js.map +1 -1
- package/lib/Expander.js +1 -0
- package/lib/Expander.js.map +1 -1
- package/lib/HorizontalScroll.js +6 -10
- package/lib/HorizontalScroll.js.map +1 -1
- package/lib/PopOver.js +2 -3
- package/lib/PopOver.js.map +1 -1
- package/lib/Radio.js +0 -2
- package/lib/Radio.js.map +1 -1
- package/lib/StackedCellContent.js +15 -0
- package/lib/StackedCellContent.js.map +1 -0
- package/lib/TabPanel.js +1 -0
- package/lib/TabPanel.js.map +1 -1
- package/lib/TableContext.js +26 -0
- package/lib/TableContext.js.map +1 -0
- package/lib/UNSAFE_TableBody.js +22 -0
- package/lib/UNSAFE_TableBody.js.map +1 -0
- package/lib/UNSAFE_TableCell.js +26 -0
- package/lib/UNSAFE_TableCell.js.map +1 -0
- package/lib/UNSAFE_TableDetail.js +17 -0
- package/lib/UNSAFE_TableDetail.js.map +1 -0
- package/lib/UNSAFE_TableExpandedRow.js +46 -0
- package/lib/UNSAFE_TableExpandedRow.js.map +1 -0
- package/lib/UNSAFE_TableHead.js +25 -0
- package/lib/UNSAFE_TableHead.js.map +1 -0
- package/lib/UNSAFE_TableHeadCell.js +182 -0
- package/lib/UNSAFE_TableHeadCell.js.map +1 -0
- package/lib/UNSAFE_TableRow.js +130 -0
- package/lib/UNSAFE_TableRow.js.map +1 -0
- package/lib/__mocks__/ResizeObserver.js +4 -1
- package/lib/__mocks__/ResizeObserver.js.map +1 -1
- package/lib/components/Button/Button.d.ts +1 -1
- package/lib/components/Button/styles.module.scss +0 -4
- package/lib/components/Button/styles.module.scss.d.ts +0 -1
- package/lib/components/Checkbox/styles.module.scss +5 -5
- package/lib/components/Checkbox/styles.module.scss.d.ts +12 -1
- package/lib/components/Drawer/DrawerHeaderContent.module.scss +10 -1
- package/lib/components/Drawer/styles.module.scss +6 -2
- package/lib/components/Duolist/styles.module.scss +3 -7
- package/lib/components/Expander/styles.module.scss.d.ts +0 -1
- package/lib/components/ExpanderHierarchy/index.js +1 -0
- package/lib/components/ExpanderHierarchy/index.js.map +1 -1
- package/lib/components/ExpanderList/index.js +1 -0
- package/lib/components/ExpanderList/index.js.map +1 -1
- package/lib/components/ExpanderList/styles.module.scss +1 -0
- package/lib/components/HorizontalScroll/HorizontalScroll.d.ts +0 -4
- package/lib/components/HorizontalScroll/styles.module.scss +1 -4
- package/lib/components/HorizontalScroll/styles.module.scss.d.ts +0 -1
- package/lib/components/Label/Label.d.ts +2 -0
- package/lib/components/Label/styles.module.scss +16 -0
- package/lib/components/Label/utils.d.ts +0 -1
- package/lib/components/Modal/index.js +5 -2
- package/lib/components/Modal/index.js.map +1 -1
- package/lib/components/Panel/styles.module.scss.d.ts +0 -1
- package/lib/components/PopMenu/PopMenu.d.ts +4 -0
- package/lib/components/PopMenu/index.js +3 -1
- package/lib/components/PopMenu/index.js.map +1 -1
- package/lib/components/Radio/styles.module.scss +6 -6
- package/lib/components/Radio/styles.module.scss.d.ts +12 -1
- package/lib/components/Table/index.js +0 -1
- package/lib/components/Table/index.js.map +1 -1
- package/lib/components/UNSAFE_Table/StackedCellContent.d.ts +9 -0
- package/lib/components/UNSAFE_Table/TableCaption.d.ts +10 -0
- package/lib/components/UNSAFE_Table/TableContext.d.ts +22 -0
- package/lib/components/UNSAFE_Table/UNSAFE_Table.d.ts +37 -0
- package/lib/components/UNSAFE_Table/UNSAFE_TableBody/UNSAFE_TableBody.d.ts +10 -0
- package/lib/components/UNSAFE_Table/UNSAFE_TableBody/index.d.ts +3 -0
- package/lib/components/UNSAFE_Table/UNSAFE_TableBody/index.js +2 -0
- package/lib/components/UNSAFE_Table/UNSAFE_TableCell/UNSAFE_TableCell.d.ts +15 -0
- package/lib/components/UNSAFE_Table/UNSAFE_TableCell/index.d.ts +3 -0
- package/lib/components/UNSAFE_Table/UNSAFE_TableCell/index.js +7 -0
- package/lib/components/UNSAFE_Table/UNSAFE_TableCell/index.js.map +1 -0
- package/lib/components/UNSAFE_Table/UNSAFE_TableDetail/UNSAFE_TableDetail.d.ts +12 -0
- package/lib/components/UNSAFE_Table/UNSAFE_TableDetail/index.d.ts +3 -0
- package/lib/components/UNSAFE_Table/UNSAFE_TableDetail/index.js +7 -0
- package/lib/components/UNSAFE_Table/UNSAFE_TableDetail/index.js.map +1 -0
- package/lib/components/UNSAFE_Table/UNSAFE_TableExpandedRow/UNSAFE_TableExpandedRow.d.ts +17 -0
- package/lib/components/UNSAFE_Table/UNSAFE_TableExpandedRow/index.d.ts +3 -0
- package/lib/components/UNSAFE_Table/UNSAFE_TableExpandedRow/index.js +7 -0
- package/lib/components/UNSAFE_Table/UNSAFE_TableExpandedRow/index.js.map +1 -0
- package/lib/components/UNSAFE_Table/UNSAFE_TableExpanderCell/UNSAFE_TableExpanderCellMobile.d.ts +4 -0
- package/lib/components/UNSAFE_Table/UNSAFE_TableHead/UNSAFE_TableHead.d.ts +8 -0
- package/lib/components/UNSAFE_Table/UNSAFE_TableHead/index.d.ts +3 -0
- package/lib/components/UNSAFE_Table/UNSAFE_TableHead/index.js +7 -0
- package/lib/components/UNSAFE_Table/UNSAFE_TableHead/index.js.map +1 -0
- package/lib/components/UNSAFE_Table/UNSAFE_TableHeadCell/UNSAFE_TableHeadCell.d.ts +15 -0
- package/lib/components/UNSAFE_Table/UNSAFE_TableHeadCell/index.d.ts +3 -0
- package/lib/components/UNSAFE_Table/UNSAFE_TableHeadCell/index.js +2 -0
- package/lib/components/UNSAFE_Table/UNSAFE_TablePopMenuCell/UNSAFE_TablePopMenuCell.d.ts +8 -0
- package/lib/components/UNSAFE_Table/UNSAFE_TableRow/UNSAFE_TableRow.d.ts +20 -0
- package/lib/components/UNSAFE_Table/UNSAFE_TableRow/index.d.ts +3 -0
- package/lib/components/UNSAFE_Table/UNSAFE_TableRow/index.js +2 -0
- package/lib/components/UNSAFE_Table/constants.d.ts +29 -0
- package/lib/components/UNSAFE_Table/index.d.ts +19 -0
- package/lib/components/UNSAFE_Table/index.js +182 -0
- package/lib/components/UNSAFE_Table/index.js.map +1 -0
- package/lib/components/UNSAFE_Table/resourceHelper.d.ts +3 -0
- package/lib/components/UNSAFE_Table/styles.module.scss +621 -0
- package/lib/components/UNSAFE_Table/styles.module.scss.d.ts +62 -0
- package/lib/components/UNSAFE_Table/useTableExpandedRows.d.ts +12 -0
- package/lib/components/UNSAFE_Table/useTableShowMore.d.ts +25 -0
- package/lib/components/UNSAFE_Table/utils.d.ts +47 -0
- package/lib/constants3.js +42 -0
- package/lib/constants3.js.map +1 -0
- package/lib/floating-ui.react.js +2 -2
- package/lib/floating-ui.react.js.map +1 -1
- package/lib/hooks/useSort.d.ts +88 -0
- package/lib/hooks/useSort.js +91 -0
- package/lib/hooks/useSort.js.map +1 -0
- package/lib/hooks/useSort.test.js +11739 -0
- package/lib/hooks/useSort.test.js.map +1 -0
- package/lib/hooks/useSynchronousResizeObserver.d.ts +11 -0
- package/lib/hooks/useSynchronousResizeObserver.js +29 -0
- package/lib/hooks/useSynchronousResizeObserver.js.map +1 -0
- package/lib/resources/HN.Designsystem.Table.nb-NO.json.d.ts +9 -0
- package/lib/resources/Resources.d.ts +19 -0
- package/lib/rolldown-runtime.js +33 -0
- package/lib/scss/_font-mixins.scss +28 -1
- package/lib/scss/typography.module.scss +8 -0
- package/lib/scss/typography.module.scss.d.ts +2 -0
- package/lib/scss/typography.stories.tsx +8 -0
- package/lib/utils/uuid.js +1 -12
- package/lib/utils/uuid.js.map +1 -1
- package/lib/utils2.js +18 -14
- package/lib/utils2.js.map +1 -1
- package/package.json +54 -2
- package/scss/_font-mixins.scss +28 -1
- package/scss/typography.module.scss +8 -0
- package/scss/typography.module.scss.d.ts +2 -0
- package/scss/typography.stories.tsx +8 -0
|
@@ -0,0 +1,621 @@
|
|
|
1
|
+
@use 'sass:map';
|
|
2
|
+
@use '../../scss/font-settings' as font-settings;
|
|
3
|
+
@use '../../scss/font-mixins' as fonts;
|
|
4
|
+
@use '../../scss/screen-reader' as sr;
|
|
5
|
+
@import '../../scss/breakpoints';
|
|
6
|
+
@import '../../scss/grid';
|
|
7
|
+
|
|
8
|
+
$table-border: 1px solid var(--color-base-neutral-border-normal);
|
|
9
|
+
$expanded-row-shadow: inset 3px 0 var(--color-base-neutral-border-normal);
|
|
10
|
+
$zebra-background: var(--color-base-neutral-background-light);
|
|
11
|
+
$zebra-cell-hover: var(--color-action-background-light-plus1-hover);
|
|
12
|
+
$zebra-cell-active: var(--color-action-background-light-plus1-active);
|
|
13
|
+
|
|
14
|
+
.table-caption {
|
|
15
|
+
@include sr.sr-only;
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
.table__cell {
|
|
19
|
+
@include fonts.table-cell;
|
|
20
|
+
|
|
21
|
+
height: 2.6875rem;
|
|
22
|
+
padding: var(--core-space-2xs) var(--core-space-xs);
|
|
23
|
+
border: 0 solid var(--color-base-neutral-border-normal);
|
|
24
|
+
border-width: 1px 0 0 1px;
|
|
25
|
+
vertical-align: top;
|
|
26
|
+
text-align: left;
|
|
27
|
+
|
|
28
|
+
&--transparent {
|
|
29
|
+
background: transparent;
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
&--center {
|
|
33
|
+
text-align: center;
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
&--right {
|
|
37
|
+
text-align: right;
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
&--nowrap {
|
|
41
|
+
white-space: nowrap;
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
@media (min-width: map.get($grid-breakpoints, md)) {
|
|
45
|
+
height: 2.6875rem;
|
|
46
|
+
padding: var(--core-space-s);
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
&--compact {
|
|
50
|
+
height: 1.75rem;
|
|
51
|
+
padding: var(--core-space-3xs);
|
|
52
|
+
|
|
53
|
+
@media (min-width: map.get($grid-breakpoints, md)) {
|
|
54
|
+
height: 2.375rem;
|
|
55
|
+
padding: var(--core-space-3xs);
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
// På cellen, innenfor kantlinjen, slik at den er like bred som skyggen på expander-knappen i raden over
|
|
61
|
+
.table__expanded-row--expanded > .table__cell {
|
|
62
|
+
box-shadow: $expanded-row-shadow;
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
// Krymper Button sitt indre element slik at Button sin egen fokusmarkering legger seg rundt knappen og ikke hele cellen.
|
|
66
|
+
@mixin table-button-content-reset {
|
|
67
|
+
width: auto;
|
|
68
|
+
background: none;
|
|
69
|
+
|
|
70
|
+
@media (min-width: map.get($grid-breakpoints, md)) {
|
|
71
|
+
margin-top: 0.19rem;
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
@mixin table-button-content-no-hover-fill {
|
|
76
|
+
&:hover,
|
|
77
|
+
&:active {
|
|
78
|
+
background: none;
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
@mixin centeredoverflow {
|
|
83
|
+
position: relative;
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
@mixin stack {
|
|
87
|
+
display: block;
|
|
88
|
+
clear: both;
|
|
89
|
+
border-width: 0;
|
|
90
|
+
|
|
91
|
+
.table__head {
|
|
92
|
+
display: none;
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
.table__head-cell {
|
|
96
|
+
display: block;
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
.table-body {
|
|
100
|
+
display: grid;
|
|
101
|
+
grid-template-columns: var(--table-stack-columns, minmax(30%, max-content) minmax(30%, auto));
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
.table__row {
|
|
105
|
+
display: grid;
|
|
106
|
+
grid-template-columns: subgrid;
|
|
107
|
+
grid-column: 1 / -1;
|
|
108
|
+
padding: 0;
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
.table__cell {
|
|
112
|
+
position: relative;
|
|
113
|
+
grid-column: 1 / -1;
|
|
114
|
+
align-items: baseline;
|
|
115
|
+
box-sizing: border-box;
|
|
116
|
+
display: block;
|
|
117
|
+
height: auto;
|
|
118
|
+
padding: var(--core-space-2xs) var(--core-space-xs);
|
|
119
|
+
float: none;
|
|
120
|
+
clear: both;
|
|
121
|
+
width: 100%;
|
|
122
|
+
border-width: 0 1px;
|
|
123
|
+
outline: 0;
|
|
124
|
+
|
|
125
|
+
&--stacked {
|
|
126
|
+
// Arver kolonnesporene fra .table-body
|
|
127
|
+
// slik at ledetekstkolonnen er like bred i alle rader
|
|
128
|
+
display: grid;
|
|
129
|
+
grid-template-columns: subgrid;
|
|
130
|
+
|
|
131
|
+
&:nth-child(1 of .table__cell--stacked) {
|
|
132
|
+
padding-block-start: var(--core-space-xs);
|
|
133
|
+
}
|
|
134
|
+
|
|
135
|
+
&:nth-last-child(1 of .table__cell--stacked) {
|
|
136
|
+
padding-block-end: var(--core-space-xs);
|
|
137
|
+
}
|
|
138
|
+
}
|
|
139
|
+
|
|
140
|
+
@media (min-width: map.get($grid-breakpoints, md)) {
|
|
141
|
+
padding: var(--core-space-xs);
|
|
142
|
+
}
|
|
143
|
+
|
|
144
|
+
&--compact {
|
|
145
|
+
padding-block: var(--core-space-3xs);
|
|
146
|
+
|
|
147
|
+
&:nth-child(1 of .table__cell--compact):not(.table__cell-pop-menu, .table__expander-cell-mobile) {
|
|
148
|
+
padding-block-start: var(--core-space-2xs);
|
|
149
|
+
}
|
|
150
|
+
|
|
151
|
+
&:nth-last-child(1 of .table__cell--compact):not(.table__cell-pop-menu, .table__expander-cell-mobile) {
|
|
152
|
+
padding-block-end: var(--core-space-2xs);
|
|
153
|
+
}
|
|
154
|
+
}
|
|
155
|
+
|
|
156
|
+
&--center {
|
|
157
|
+
text-align: left;
|
|
158
|
+
}
|
|
159
|
+
|
|
160
|
+
&--right {
|
|
161
|
+
text-align: left;
|
|
162
|
+
}
|
|
163
|
+
|
|
164
|
+
&:not(.expandable-container) {
|
|
165
|
+
font-weight: 400;
|
|
166
|
+
}
|
|
167
|
+
|
|
168
|
+
> .table__cell-heading-text {
|
|
169
|
+
@include fonts.table-header-stack;
|
|
170
|
+
|
|
171
|
+
display: block;
|
|
172
|
+
box-sizing: border-box;
|
|
173
|
+
padding-right: var(--core-space-xs);
|
|
174
|
+
overflow-wrap: break-word;
|
|
175
|
+
}
|
|
176
|
+
|
|
177
|
+
> .table__cell-content {
|
|
178
|
+
min-width: 0;
|
|
179
|
+
overflow-wrap: break-word;
|
|
180
|
+
}
|
|
181
|
+
}
|
|
182
|
+
|
|
183
|
+
// Celler markert med hideBehindExpander vises i den utvidbare raden i stedet
|
|
184
|
+
.table__cell--behind-expander {
|
|
185
|
+
display: none;
|
|
186
|
+
}
|
|
187
|
+
|
|
188
|
+
.table__cell-expander {
|
|
189
|
+
display: none;
|
|
190
|
+
}
|
|
191
|
+
|
|
192
|
+
.table__expander-cell-mobile,
|
|
193
|
+
.table__cell-pop-menu {
|
|
194
|
+
display: block;
|
|
195
|
+
float: none;
|
|
196
|
+
clear: both;
|
|
197
|
+
grid-column: 1 / -1;
|
|
198
|
+
box-sizing: border-box;
|
|
199
|
+
width: 100%;
|
|
200
|
+
min-width: 0;
|
|
201
|
+
max-width: 100%;
|
|
202
|
+
padding: 0;
|
|
203
|
+
}
|
|
204
|
+
|
|
205
|
+
.table__expander-cell-mobile {
|
|
206
|
+
height: auto;
|
|
207
|
+
border-bottom: $table-border;
|
|
208
|
+
|
|
209
|
+
&--expanded {
|
|
210
|
+
border-bottom: 0;
|
|
211
|
+
}
|
|
212
|
+
|
|
213
|
+
.table__expander-trigger {
|
|
214
|
+
display: flex;
|
|
215
|
+
width: 100%;
|
|
216
|
+
justify-content: center;
|
|
217
|
+
}
|
|
218
|
+
}
|
|
219
|
+
|
|
220
|
+
.table__cell-pop-menu {
|
|
221
|
+
height: auto;
|
|
222
|
+
|
|
223
|
+
.table__pop-menu {
|
|
224
|
+
position: static;
|
|
225
|
+
display: flex;
|
|
226
|
+
|
|
227
|
+
.table__pop-menu__trigger {
|
|
228
|
+
height: auto;
|
|
229
|
+
justify-content: flex-start;
|
|
230
|
+
}
|
|
231
|
+
|
|
232
|
+
.table__pop-menu__content {
|
|
233
|
+
width: 100%;
|
|
234
|
+
}
|
|
235
|
+
}
|
|
236
|
+
}
|
|
237
|
+
|
|
238
|
+
.table__expanded-row > .table__cell {
|
|
239
|
+
height: auto;
|
|
240
|
+
text-align: left;
|
|
241
|
+
padding: 0.75rem;
|
|
242
|
+
}
|
|
243
|
+
|
|
244
|
+
.table__row--expanded > .table__cell {
|
|
245
|
+
border-left: $table-border;
|
|
246
|
+
box-shadow: $expanded-row-shadow;
|
|
247
|
+
}
|
|
248
|
+
|
|
249
|
+
.table__expanded-row--expanded {
|
|
250
|
+
box-shadow: none;
|
|
251
|
+
|
|
252
|
+
> .table__cell {
|
|
253
|
+
border-left: $table-border;
|
|
254
|
+
box-shadow: $expanded-row-shadow;
|
|
255
|
+
}
|
|
256
|
+
}
|
|
257
|
+
|
|
258
|
+
.table__cell:first-child {
|
|
259
|
+
border-top: $table-border;
|
|
260
|
+
}
|
|
261
|
+
|
|
262
|
+
.table__expanded-row {
|
|
263
|
+
display: none;
|
|
264
|
+
|
|
265
|
+
&--expanded {
|
|
266
|
+
display: grid;
|
|
267
|
+
grid-template-columns: subgrid;
|
|
268
|
+
grid-column: 1 / -1;
|
|
269
|
+
border-bottom: $table-border;
|
|
270
|
+
|
|
271
|
+
> .table__cell:first-child {
|
|
272
|
+
border-top: 0;
|
|
273
|
+
}
|
|
274
|
+
}
|
|
275
|
+
}
|
|
276
|
+
|
|
277
|
+
.table__row:last-child .table__cell:last-child {
|
|
278
|
+
border-bottom: $table-border;
|
|
279
|
+
}
|
|
280
|
+
|
|
281
|
+
.table__row--expandable + .table__row > .table__cell:first-child {
|
|
282
|
+
border-top: 0;
|
|
283
|
+
}
|
|
284
|
+
|
|
285
|
+
.table__row--expanded .table__expander-trigger,
|
|
286
|
+
.table__row--expanded .table__cell-pop-menu > .table__pop-menu .table__pop-menu__trigger {
|
|
287
|
+
box-shadow: $expanded-row-shadow;
|
|
288
|
+
}
|
|
289
|
+
|
|
290
|
+
// UNSAFE_TableDetail i utvidet rad: samme kolonnebredder som resten av tabellen
|
|
291
|
+
.table__expanded-row > td.table__expanded-row__cell:has(> .table__detail) {
|
|
292
|
+
display: grid;
|
|
293
|
+
grid-template-columns: subgrid;
|
|
294
|
+
padding: 0;
|
|
295
|
+
|
|
296
|
+
> .table__cell {
|
|
297
|
+
border: 0;
|
|
298
|
+
}
|
|
299
|
+
|
|
300
|
+
> :not(.table__detail, button) {
|
|
301
|
+
grid-column: 1 / -1;
|
|
302
|
+
|
|
303
|
+
// Innholdet skal ikke påvirke kolonnebreddene som resten av tabellen bruker
|
|
304
|
+
contain: inline-size;
|
|
305
|
+
padding: 0 0.75rem;
|
|
306
|
+
}
|
|
307
|
+
|
|
308
|
+
> button {
|
|
309
|
+
grid-column: 1 / -1;
|
|
310
|
+
justify-self: start;
|
|
311
|
+
margin: 0 var(--core-space-xs);
|
|
312
|
+
|
|
313
|
+
&:last-child {
|
|
314
|
+
margin: var(--core-space-xs);
|
|
315
|
+
}
|
|
316
|
+
}
|
|
317
|
+
}
|
|
318
|
+
|
|
319
|
+
.table__row--expandable + .table__expanded-row + .table__row > .table__cell:first-child {
|
|
320
|
+
border-top: 0;
|
|
321
|
+
}
|
|
322
|
+
|
|
323
|
+
.table-body > .table__row--expandable:first-child {
|
|
324
|
+
border-top: $table-border;
|
|
325
|
+
}
|
|
326
|
+
|
|
327
|
+
.table-body > .table__row--expandable:first-child > .table__cell:first-child {
|
|
328
|
+
border-top: 0;
|
|
329
|
+
}
|
|
330
|
+
|
|
331
|
+
.table-body--zebra > .table__row:nth-child(even of .table__row:not(.table__row--expanded)) > .table__cell {
|
|
332
|
+
background: $zebra-background;
|
|
333
|
+
}
|
|
334
|
+
|
|
335
|
+
select {
|
|
336
|
+
max-width: 100%;
|
|
337
|
+
}
|
|
338
|
+
}
|
|
339
|
+
|
|
340
|
+
.table {
|
|
341
|
+
width: 100%;
|
|
342
|
+
|
|
343
|
+
// Separate i stedet for collapse: sammenslåtte borders deles i halve piksler og kan bli 2px på enkelte skjermer
|
|
344
|
+
border-collapse: separate;
|
|
345
|
+
border-spacing: 0;
|
|
346
|
+
|
|
347
|
+
// Høyre og nederste linje tegnes av tabellen, så de ikke avhenger av hvilken celle som er sist
|
|
348
|
+
border: 0 solid var(--color-base-neutral-border-normal);
|
|
349
|
+
border-width: 0 1px 1px 0;
|
|
350
|
+
|
|
351
|
+
@each $breakpoint in map.keys($grid-breakpoints) {
|
|
352
|
+
&--centeredoverflow-#{$breakpoint} {
|
|
353
|
+
@include media-breakpoint-down($breakpoint) {
|
|
354
|
+
@include centeredoverflow;
|
|
355
|
+
}
|
|
356
|
+
}
|
|
357
|
+
|
|
358
|
+
&--stack-#{$breakpoint} {
|
|
359
|
+
@include media-breakpoint-down($breakpoint) {
|
|
360
|
+
@include stack;
|
|
361
|
+
}
|
|
362
|
+
}
|
|
363
|
+
}
|
|
364
|
+
|
|
365
|
+
&__expander-cell-mobile {
|
|
366
|
+
position: relative;
|
|
367
|
+
display: none;
|
|
368
|
+
}
|
|
369
|
+
}
|
|
370
|
+
|
|
371
|
+
.table__head-cell {
|
|
372
|
+
height: 2.6875rem;
|
|
373
|
+
padding: var(--core-space-2xs) var(--core-space-xs);
|
|
374
|
+
background: var(--color-base-neutral-background-light);
|
|
375
|
+
border: 0 solid var(--color-base-neutral-border-normal);
|
|
376
|
+
border-width: 1px 0 0 1px;
|
|
377
|
+
text-align: left;
|
|
378
|
+
vertical-align: bottom;
|
|
379
|
+
|
|
380
|
+
@include fonts.table-header;
|
|
381
|
+
|
|
382
|
+
&--transparent {
|
|
383
|
+
background: transparent;
|
|
384
|
+
}
|
|
385
|
+
|
|
386
|
+
@media (min-width: map.get($grid-breakpoints, md)) {
|
|
387
|
+
height: 2.6875rem;
|
|
388
|
+
padding: var(--core-space-s);
|
|
389
|
+
}
|
|
390
|
+
|
|
391
|
+
&--compact {
|
|
392
|
+
height: 1.75rem;
|
|
393
|
+
padding: var(--core-space-3xs);
|
|
394
|
+
vertical-align: top;
|
|
395
|
+
|
|
396
|
+
@media (min-width: map.get($grid-breakpoints, md)) {
|
|
397
|
+
height: 2.6875rem;
|
|
398
|
+
}
|
|
399
|
+
}
|
|
400
|
+
}
|
|
401
|
+
|
|
402
|
+
.table__cell-heading-text {
|
|
403
|
+
display: none;
|
|
404
|
+
}
|
|
405
|
+
|
|
406
|
+
.table__cell-expander,
|
|
407
|
+
.table__cell-pop-menu {
|
|
408
|
+
position: relative;
|
|
409
|
+
padding: 0;
|
|
410
|
+
width: 2.75rem;
|
|
411
|
+
min-width: 2.75rem;
|
|
412
|
+
|
|
413
|
+
@media (min-width: map.get($grid-breakpoints, md)) {
|
|
414
|
+
width: 3.375rem;
|
|
415
|
+
min-width: 3.375rem;
|
|
416
|
+
}
|
|
417
|
+
|
|
418
|
+
&:where(.table__cell--compact) {
|
|
419
|
+
height: 2.75rem;
|
|
420
|
+
|
|
421
|
+
@media (min-width: map.get($grid-breakpoints, md)) {
|
|
422
|
+
height: 2.75rem;
|
|
423
|
+
}
|
|
424
|
+
}
|
|
425
|
+
}
|
|
426
|
+
|
|
427
|
+
.table__expander-button {
|
|
428
|
+
position: absolute;
|
|
429
|
+
inset: 0;
|
|
430
|
+
display: flex;
|
|
431
|
+
align-items: flex-start;
|
|
432
|
+
justify-content: center;
|
|
433
|
+
min-width: 0;
|
|
434
|
+
min-height: 0;
|
|
435
|
+
background: none;
|
|
436
|
+
border: 0;
|
|
437
|
+
padding: 0;
|
|
438
|
+
cursor: pointer;
|
|
439
|
+
|
|
440
|
+
&:hover {
|
|
441
|
+
background: var(--color-action-background-light-hover);
|
|
442
|
+
}
|
|
443
|
+
|
|
444
|
+
&:active {
|
|
445
|
+
background: var(--color-action-background-light-active);
|
|
446
|
+
}
|
|
447
|
+
}
|
|
448
|
+
|
|
449
|
+
.table__expander-button__content {
|
|
450
|
+
@include table-button-content-reset;
|
|
451
|
+
@include table-button-content-no-hover-fill;
|
|
452
|
+
}
|
|
453
|
+
|
|
454
|
+
.table__expander-trigger {
|
|
455
|
+
&:hover {
|
|
456
|
+
background: var(--color-action-background-light-hover);
|
|
457
|
+
}
|
|
458
|
+
|
|
459
|
+
&:active {
|
|
460
|
+
background: var(--color-action-background-light-active);
|
|
461
|
+
}
|
|
462
|
+
}
|
|
463
|
+
|
|
464
|
+
.table__expander-trigger__content {
|
|
465
|
+
background: none;
|
|
466
|
+
|
|
467
|
+
@include table-button-content-no-hover-fill;
|
|
468
|
+
}
|
|
469
|
+
|
|
470
|
+
.table__pop-menu {
|
|
471
|
+
position: absolute;
|
|
472
|
+
inset: 0;
|
|
473
|
+
|
|
474
|
+
// Trekkerknappen skal fylle hele cellen, overstyrer Button-stilene
|
|
475
|
+
.table__pop-menu__trigger {
|
|
476
|
+
width: 100%;
|
|
477
|
+
height: 100%;
|
|
478
|
+
min-width: 0;
|
|
479
|
+
min-height: 0;
|
|
480
|
+
padding: 0;
|
|
481
|
+
border-radius: 0;
|
|
482
|
+
align-items: flex-start;
|
|
483
|
+
justify-content: center;
|
|
484
|
+
|
|
485
|
+
&:hover {
|
|
486
|
+
background: var(--color-action-background-light-hover);
|
|
487
|
+
box-shadow: none;
|
|
488
|
+
}
|
|
489
|
+
|
|
490
|
+
&:active {
|
|
491
|
+
background: var(--color-action-background-light-active);
|
|
492
|
+
}
|
|
493
|
+
}
|
|
494
|
+
|
|
495
|
+
.table__pop-menu__content {
|
|
496
|
+
@include table-button-content-reset;
|
|
497
|
+
}
|
|
498
|
+
}
|
|
499
|
+
|
|
500
|
+
.table__row {
|
|
501
|
+
background: var(--color-action-background-light-normal);
|
|
502
|
+
|
|
503
|
+
&--transparent {
|
|
504
|
+
background: transparent;
|
|
505
|
+
}
|
|
506
|
+
|
|
507
|
+
&--expanded {
|
|
508
|
+
background: var(--color-action-background-light-plus2-normal);
|
|
509
|
+
|
|
510
|
+
.table__expander-button,
|
|
511
|
+
.table__expander-trigger {
|
|
512
|
+
box-shadow: $expanded-row-shadow;
|
|
513
|
+
}
|
|
514
|
+
|
|
515
|
+
.table__expander-button:hover,
|
|
516
|
+
.table__expander-trigger:hover {
|
|
517
|
+
background: var(--color-action-background-light-plus2-hover);
|
|
518
|
+
box-shadow: $expanded-row-shadow;
|
|
519
|
+
}
|
|
520
|
+
|
|
521
|
+
.table__expander-button:active,
|
|
522
|
+
.table__expander-trigger:active {
|
|
523
|
+
background: var(--color-action-background-light-plus2-active);
|
|
524
|
+
box-shadow: $expanded-row-shadow;
|
|
525
|
+
}
|
|
526
|
+
|
|
527
|
+
.table__pop-menu .table__pop-menu__trigger:hover {
|
|
528
|
+
background: var(--color-action-background-light-plus2-hover);
|
|
529
|
+
}
|
|
530
|
+
|
|
531
|
+
.table__pop-menu .table__pop-menu__trigger:active {
|
|
532
|
+
background: var(--color-action-background-light-plus2-active);
|
|
533
|
+
}
|
|
534
|
+
}
|
|
535
|
+
}
|
|
536
|
+
|
|
537
|
+
.table__cell-expander:focus-within,
|
|
538
|
+
.table__cell-pop-menu:focus-within,
|
|
539
|
+
.table__expander-cell-mobile:focus-within {
|
|
540
|
+
z-index: 1;
|
|
541
|
+
}
|
|
542
|
+
|
|
543
|
+
.table-body--zebra {
|
|
544
|
+
> .table__row:nth-child(even of .table__row:not(.table__row--expanded)) {
|
|
545
|
+
background: $zebra-background;
|
|
546
|
+
|
|
547
|
+
> .table__cell-expander,
|
|
548
|
+
> .table__cell-pop-menu,
|
|
549
|
+
> .table__expander-cell-mobile {
|
|
550
|
+
background: $zebra-background;
|
|
551
|
+
}
|
|
552
|
+
|
|
553
|
+
.table__expander-button:hover,
|
|
554
|
+
.table__expander-trigger:hover,
|
|
555
|
+
.table__pop-menu .table__pop-menu__trigger:hover {
|
|
556
|
+
background: $zebra-cell-hover;
|
|
557
|
+
}
|
|
558
|
+
|
|
559
|
+
.table__expander-button:active,
|
|
560
|
+
.table__expander-trigger:active,
|
|
561
|
+
.table__pop-menu .table__pop-menu__trigger:active {
|
|
562
|
+
background: $zebra-cell-active;
|
|
563
|
+
}
|
|
564
|
+
}
|
|
565
|
+
}
|
|
566
|
+
|
|
567
|
+
// Vises kun i stack-visning
|
|
568
|
+
.table__detail {
|
|
569
|
+
display: none;
|
|
570
|
+
}
|
|
571
|
+
|
|
572
|
+
.table__expanded-row {
|
|
573
|
+
display: none;
|
|
574
|
+
|
|
575
|
+
&--expanded {
|
|
576
|
+
display: table-row;
|
|
577
|
+
background: var(--color-base-blueberry-background-light);
|
|
578
|
+
}
|
|
579
|
+
|
|
580
|
+
// Skjul-knappen ligger alltid på egen linje, også når innholdet inneholder knapper
|
|
581
|
+
&__cell > button:last-child {
|
|
582
|
+
display: flex;
|
|
583
|
+
width: fit-content;
|
|
584
|
+
margin-top: var(--core-space-xs);
|
|
585
|
+
}
|
|
586
|
+
|
|
587
|
+
// Kolonner bak expander vises i selve raden utenfor stack-visning
|
|
588
|
+
&--stack-only {
|
|
589
|
+
display: none;
|
|
590
|
+
}
|
|
591
|
+
|
|
592
|
+
&-details {
|
|
593
|
+
margin: 0;
|
|
594
|
+
|
|
595
|
+
dt {
|
|
596
|
+
font-weight: 600;
|
|
597
|
+
}
|
|
598
|
+
|
|
599
|
+
dd {
|
|
600
|
+
margin: 0 0 var(--core-space-2xs);
|
|
601
|
+
|
|
602
|
+
&:last-child {
|
|
603
|
+
margin-bottom: 0;
|
|
604
|
+
}
|
|
605
|
+
}
|
|
606
|
+
}
|
|
607
|
+
|
|
608
|
+
&-container {
|
|
609
|
+
padding: 0.5rem;
|
|
610
|
+
|
|
611
|
+
@media (min-width: map.get($grid-breakpoints, md)) {
|
|
612
|
+
&--open {
|
|
613
|
+
border-bottom: 1px solid var(--color-base-neutral-border-normal);
|
|
614
|
+
}
|
|
615
|
+
}
|
|
616
|
+
}
|
|
617
|
+
|
|
618
|
+
&__cell {
|
|
619
|
+
padding: var(--core-space-s);
|
|
620
|
+
}
|
|
621
|
+
}
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
export type Styles = {
|
|
2
|
+
'expandable-container': string;
|
|
3
|
+
table: string;
|
|
4
|
+
table__cell: string;
|
|
5
|
+
'table__cell--behind-expander': string;
|
|
6
|
+
'table__cell--center': string;
|
|
7
|
+
'table__cell--compact': string;
|
|
8
|
+
'table__cell--nowrap': string;
|
|
9
|
+
'table__cell--right': string;
|
|
10
|
+
'table__cell--stacked': string;
|
|
11
|
+
'table__cell--transparent': string;
|
|
12
|
+
'table__cell-content': string;
|
|
13
|
+
'table__cell-expander': string;
|
|
14
|
+
'table__cell-heading-text': string;
|
|
15
|
+
'table__cell-pop-menu': string;
|
|
16
|
+
table__detail: string;
|
|
17
|
+
'table__expanded-row': string;
|
|
18
|
+
'table__expanded-row__cell': string;
|
|
19
|
+
'table__expanded-row--expanded': string;
|
|
20
|
+
'table__expanded-row--stack-only': string;
|
|
21
|
+
'table__expanded-row-container': string;
|
|
22
|
+
'table__expanded-row-container--open': string;
|
|
23
|
+
'table__expanded-row-details': string;
|
|
24
|
+
'table__expander-button': string;
|
|
25
|
+
'table__expander-button__content': string;
|
|
26
|
+
'table__expander-cell-mobile': string;
|
|
27
|
+
'table__expander-cell-mobile--expanded': string;
|
|
28
|
+
'table__expander-trigger': string;
|
|
29
|
+
'table__expander-trigger__content': string;
|
|
30
|
+
table__head: string;
|
|
31
|
+
'table__head-cell': string;
|
|
32
|
+
'table__head-cell--compact': string;
|
|
33
|
+
'table__head-cell--transparent': string;
|
|
34
|
+
'table__pop-menu': string;
|
|
35
|
+
'table__pop-menu__content': string;
|
|
36
|
+
'table__pop-menu__trigger': string;
|
|
37
|
+
table__row: string;
|
|
38
|
+
'table__row--expandable': string;
|
|
39
|
+
'table__row--expanded': string;
|
|
40
|
+
'table__row--transparent': string;
|
|
41
|
+
'table--centeredoverflow-lg': string;
|
|
42
|
+
'table--centeredoverflow-md': string;
|
|
43
|
+
'table--centeredoverflow-sm': string;
|
|
44
|
+
'table--centeredoverflow-xl': string;
|
|
45
|
+
'table--centeredoverflow-xs': string;
|
|
46
|
+
'table--centeredoverflow-xxs': string;
|
|
47
|
+
'table--stack-lg': string;
|
|
48
|
+
'table--stack-md': string;
|
|
49
|
+
'table--stack-sm': string;
|
|
50
|
+
'table--stack-xl': string;
|
|
51
|
+
'table--stack-xs': string;
|
|
52
|
+
'table--stack-xxs': string;
|
|
53
|
+
'table-body': string;
|
|
54
|
+
'table-body--zebra': string;
|
|
55
|
+
'table-caption': string;
|
|
56
|
+
};
|
|
57
|
+
|
|
58
|
+
export type ClassNames = keyof Styles;
|
|
59
|
+
|
|
60
|
+
declare const styles: Styles;
|
|
61
|
+
|
|
62
|
+
export default styles;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
export interface UseTableExpandedRowsReturn {
|
|
2
|
+
/** Current expanded state per row key */
|
|
3
|
+
expandedRows: Record<string, boolean>;
|
|
4
|
+
/** Whether a row is expanded */
|
|
5
|
+
isExpanded: (rowKey: string) => boolean;
|
|
6
|
+
/** Toggle the expanded state of a row */
|
|
7
|
+
toggleExpanded: (rowKey: string) => void;
|
|
8
|
+
/** Collapse all rows, e.g. when the table is re-sorted */
|
|
9
|
+
collapseAll: () => void;
|
|
10
|
+
}
|
|
11
|
+
/** Expanded state per row for tables with expandable rows (UNSAFE_TableRow expandedContent/hideBehindExpander). */
|
|
12
|
+
export declare const useTableExpandedRows: () => UseTableExpandedRowsReturn;
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
export interface UseTableShowMoreOptions<TData> {
|
|
2
|
+
/** All rows */
|
|
3
|
+
data: TData[];
|
|
4
|
+
/** Number of rows to show initially and to reveal per showMore(). Shows all rows when not set. */
|
|
5
|
+
pageSize?: number;
|
|
6
|
+
}
|
|
7
|
+
export interface UseTableShowMoreReturn<TData, TElement extends HTMLElement> {
|
|
8
|
+
/** The rows that are currently visible */
|
|
9
|
+
visibleData: TData[];
|
|
10
|
+
/** Whether there are more rows to show */
|
|
11
|
+
hasMore: boolean;
|
|
12
|
+
/** Reveal the next page of rows */
|
|
13
|
+
showMore: () => void;
|
|
14
|
+
/** Reset to the initial number of visible rows */
|
|
15
|
+
reset: () => void;
|
|
16
|
+
/** Index of the first row revealed by the last showMore() call */
|
|
17
|
+
newRowsStartIndex?: number;
|
|
18
|
+
/**
|
|
19
|
+
* Attach to a focusable element in the first newly revealed row (index === newRowsStartIndex).
|
|
20
|
+
* The element receives focus when the last page is revealed and the show more button disappears.
|
|
21
|
+
*/
|
|
22
|
+
firstNewRowRef: React.RefObject<TElement | null>;
|
|
23
|
+
}
|
|
24
|
+
/** Progressive disclosure ("show more") of table rows, with focus management when the show more button disappears. */
|
|
25
|
+
export declare const useTableShowMore: <TData, TElement extends HTMLElement = HTMLElement>({ data, pageSize, }: UseTableShowMoreOptions<TData>) => UseTableShowMoreReturn<TData, TElement>;
|