@navikt/ds-css 8.3.0 → 8.4.1

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@navikt/ds-css",
3
- "version": "8.3.0",
3
+ "version": "8.4.1",
4
4
  "description": "CSS for Nav Designsystem",
5
5
  "author": "Aksel | Nav designsystem team",
6
6
  "keywords": [
@@ -30,9 +30,9 @@
30
30
  "css:get-version": "node config/get-version.js"
31
31
  },
32
32
  "devDependencies": {
33
- "@navikt/ds-tokens": "^8.3.0",
33
+ "@navikt/ds-tokens": "^8.4.1",
34
34
  "browserslist": "^4.25.0",
35
- "esbuild": "^0.25.11",
35
+ "esbuild": "^0.27.2",
36
36
  "fast-glob": "3.3.3",
37
37
  "lightningcss": "^1.30.1",
38
38
  "normalize.css": "^8.0.1",
@@ -4,31 +4,16 @@
4
4
  border-radius: var(--ax-radius-12);
5
5
  border: 1px solid var(--ax-border-neutral-subtleA);
6
6
  box-shadow: var(--ax-shadow-dialog);
7
- transition: transform 250ms cubic-bezier(0, 0, 0, 1) allow-discrete;
7
+ /* stylelint-disable-next-line csstools/value-no-unknown-custom-properties */
8
+ transform-origin: var(--__axc-action-menu-content-transform-origin);
9
+ transition:
10
+ transform 150ms ease allow-discrete,
11
+ opacity 150ms ease allow-discrete;
8
12
 
9
13
  &[data-state="open"] {
10
- &[data-side="bottom"] {
11
- @starting-style {
12
- transform: translateY(-4px);
13
- }
14
- }
15
-
16
- &[data-side="top"] {
17
- @starting-style {
18
- transform: translateY(4px);
19
- }
20
- }
21
-
22
- &[data-side="right"] {
23
- @starting-style {
24
- transform: translateX(-4px);
25
- }
26
- }
27
-
28
- &[data-side="left"] {
29
- @starting-style {
30
- transform: translateX(4px);
31
- }
14
+ @starting-style {
15
+ opacity: 0.8;
16
+ transform: scale3d(0.94, 0.94, 0.94);
32
17
  }
33
18
  }
34
19
  }
@@ -43,8 +28,6 @@
43
28
  background-color: var(--ax-bg-raised);
44
29
  min-width: 128px;
45
30
  max-width: min(95vw, 640px);
46
- /* stylelint-disable-next-line csstools/value-no-unknown-custom-properties */
47
- transform-origin: var(--__axc-action-menu-content-transform-origin);
48
31
  animation-duration: 160ms;
49
32
  animation-timing-function: cubic-bezier(0.16, 1, 0.3, 1);
50
33
  padding: var(--__axc-action-menu-content-p);
@@ -133,7 +116,7 @@
133
116
 
134
117
  .aksel-action-menu__marker-icon {
135
118
  svg {
136
- font-size: 18px;
119
+ font-size: 1.125rem;
137
120
  flex-shrink: 0;
138
121
  }
139
122
 
@@ -143,6 +126,13 @@
143
126
  }
144
127
  }
145
128
 
129
+ .aksel-action-menu__sub-icon {
130
+ display: grid;
131
+ place-content: center;
132
+ font-size: 1.125rem;
133
+ margin-left: auto;
134
+ }
135
+
146
136
  /* --------------------------- ActionMenu shortcut -------------------------- */
147
137
  .aksel-action-menu__shortcut {
148
138
  background-color: var(--ax-bg-neutral-moderateA);
@@ -1,48 +1,103 @@
1
- /* TODO: Overflow does not currently work with fixed table layout. No idea why... */
2
- .aksel-data-table__wrapper {
3
- overflow-x: auto;
1
+ .aksel-data-table__border-wrapper {
2
+ border: 1px solid var(--ax-border-neutral-subtle);
3
+ border-radius: var(--ax-radius-12);
4
+ overflow: hidden;
5
+ flex-grow: 1;
6
+ }
7
+
8
+ .aksel-data-table__scroll-wrapper {
9
+ overflow: auto;
4
10
  width: 100%;
11
+ height: 100%;
5
12
  position: relative;
6
13
  }
7
14
 
8
15
  .aksel-data-table {
9
16
  border-collapse: collapse;
10
17
  border-spacing: 0;
11
- inline-size: 100%;
12
18
  table-layout: fixed;
13
- width: 100%;
19
+ width: 1px; /* This is for some reason needed to make the browser respect the column width. TODO: Test in all browsers */
20
+
21
+ /*
22
+ We should NOT set min-width:100% b.c. it will cause inconsistencies in column resizing.
23
+ We could discuss whether it matters, though. But it feels buggy.
24
+ Downside is that it looks weird when the table is smaller than the container.
25
+ Maybe we could "manually" resize the other columns so that it fills the container? But that would add a lot of complexity.
26
+ We could have a toggle for the resize feature, and let the consumer decide which downside they prefer. Might need that anyways.
27
+ */
28
+
29
+ --__axc-data-table-density: var(--ax-space-16) 0;
30
+
31
+ &[data-density="condensed"] {
32
+ --__axc-data-table-density: 0 0;
33
+ }
34
+
35
+ &[data-density="spacious"] {
36
+ --__axc-data-table-density: var(--ax-space-32) 0;
37
+ }
38
+ }
39
+
40
+ .aksel-data-table--zebra-stripes {
41
+ & .aksel-data-table__tbody :where(.aksel-data-table__tr:nth-child(odd)) {
42
+ background-color: var(--ax-bg-neutral-softA);
43
+ }
44
+ }
45
+
46
+ .aksel-data-table--truncate-content {
47
+ .aksel-data-table__td > div:not(:has(> .aksel-checkbox)) {
48
+ text-overflow: ellipsis;
49
+ white-space: nowrap;
50
+ overflow: hidden;
51
+ }
14
52
  }
15
53
 
16
54
  .aksel-data-table__thead {
17
55
  background-color: var(--ax-bg-raised);
56
+ position: sticky;
57
+ top: 0;
58
+ box-shadow: 0 1px 0 0 var(--ax-border-neutral-subtle);
18
59
  }
19
60
 
20
61
  .aksel-data-table__tbody {
21
- inline-size: 100%;
22
62
  background-color: var(--ax-bg-raised);
23
63
  }
24
64
 
25
65
  .aksel-data-table__tr {
26
66
  border: none;
27
- block-size: 3rem;
28
- inline-size: 100%;
67
+ }
68
+
69
+ .aksel-data-table__tr--selected {
70
+ background-color: var(--ax-bg-softA);
71
+ box-shadow:
72
+ inset 1px 0 0 0 var(--ax-border-default),
73
+ inset -1px 0 0 0 var(--ax-border-default);
74
+
75
+ &:first-of-type {
76
+ box-shadow:
77
+ inset 1px 0 0 0 var(--ax-border-default),
78
+ inset -1px 0 0 0 var(--ax-border-default),
79
+ inset 0 1px 0 0 var(--ax-border-default);
80
+ }
81
+
82
+ & :is(.aksel-data-table__td, .aksel-data-table__th) {
83
+ border-color: var(--ax-border-default);
84
+ }
29
85
  }
30
86
 
31
87
  .aksel-data-table__th {
32
88
  position: relative;
33
89
  background-color: var(--ax-bg-neutral-soft);
34
90
  color: var(--ax-text-neutral);
35
- padding-inline: var(--ax-space-16);
91
+ padding: var(--ax-space-8) var(--ax-space-16);
36
92
  text-align: start;
37
- border-inline-end: 1px solid var(--ax-border-neutral-subtle);
38
- overflow: hidden;
93
+ border-block-end: 1px solid var(--ax-border-neutral-subtle);
39
94
 
40
- &:first-child {
95
+ &:not(:first-child) {
41
96
  border-inline-start: 1px solid var(--ax-border-neutral-subtle);
42
97
  }
43
98
  }
44
99
 
45
- .aksel-data-table__th-content {
100
+ .aksel-data-table__th-content:not(:has(> .aksel-checkbox)) {
46
101
  text-overflow: ellipsis;
47
102
  white-space: nowrap;
48
103
  overflow: hidden;
@@ -51,17 +106,31 @@
51
106
  .aksel-data-table__th-resize-handle {
52
107
  z-index: 2;
53
108
  position: absolute;
54
- inset-block: 0;
55
- inset-inline-end: -3px;
56
109
  cursor: col-resize;
57
110
  margin: 0;
58
111
  padding: 0;
59
- width: 5px;
60
- background: var(--ax-bg-neutral-strong);
61
112
  border: none;
113
+ background: transparent;
114
+ display: flex;
115
+ justify-content: center;
116
+ inset-block: 0;
117
+ inset-inline-end: -10px;
118
+ width: 19px; /* TODO: Violation of WCAG SC 2.5.8 Target Size? https://www.w3.org/WAI/WCAG22/Understanding/target-size-minimum.html */
119
+
120
+ &::after {
121
+ content: "";
122
+ position: absolute;
123
+ inset-block: 0;
124
+ width: 3px;
125
+ }
126
+
127
+ &:hover::after {
128
+ /* TODO: Consider if the resize-handle should be visible already when hovering the column header */
129
+ background: var(--ax-bg-strong);
130
+ }
62
131
 
63
- &:hover {
64
- background: var(--ax-bg-neutral-strong-pressed);
132
+ &:active::after {
133
+ background: var(--ax-bg-strong-pressed);
65
134
  }
66
135
  }
67
136
 
@@ -75,7 +144,8 @@
75
144
  transition: none;
76
145
  }
77
146
 
78
- &:not(.aksel-data-table__th:hover &, &:focus-visible, &[data-expanded="true"]) {
147
+ &:not(.aksel-data-table__th:is(:hover, :focus-within) &, &:focus-visible, &[data-expanded="true"]),
148
+ .aksel-data-table__th:has(.aksel-data-table__th-resize-handle:hover:not(:focus)) & {
79
149
  opacity: 0;
80
150
  min-width: 0;
81
151
  max-width: 0;
@@ -90,18 +160,30 @@
90
160
  border-block-end: 1px solid var(--ax-border-neutral-subtle);
91
161
  border-block-start: 1px solid var(--ax-bg-raised);
92
162
  color: var(--ax-text-neutral-subtle);
163
+ padding: var(--__axc-data-table-density);
93
164
  padding-inline: 1rem;
94
- overflow: hidden;
95
- border-inline-end: 1px solid var(--ax-border-neutral-subtle);
96
165
 
97
- &:first-child {
166
+ &:not(:first-child) {
98
167
  border-inline-start: 1px solid var(--ax-border-neutral-subtle);
99
168
  }
100
169
 
101
- & > div {
102
- text-overflow: ellipsis;
103
- white-space: nowrap;
104
- overflow: hidden;
170
+ .aksel-data-table__tfoot .aksel-data-table__tr:last-child & {
171
+ border-block-end: none;
172
+ }
173
+
174
+ .aksel-data-table:not(:has(.aksel-data-table__tfoot)) .aksel-data-table__tr:not(.aksel-data-table__tr--selected):last-child & {
175
+ border-block-end: none;
176
+ }
177
+ }
178
+
179
+ .aksel-data-table__td,
180
+ .aksel-data-table__th {
181
+ scroll-margin-block: var(--ax-space-0);
182
+ scroll-margin-inline: var(--ax-space-0);
183
+
184
+ &:focus-visible {
185
+ outline: 2px solid var(--ax-border-focus);
186
+ outline-offset: -4px;
105
187
  }
106
188
  }
107
189
 
@@ -157,6 +157,11 @@
157
157
  line-height: var(--ax-font-line-height-large);
158
158
  margin: 0;
159
159
  padding-left: 0.25rem;
160
+
161
+ .aksel-form-field--small & {
162
+ font-size: var(--ax-font-size-medium);
163
+ line-height: var(--ax-font-line-height-medium);
164
+ }
160
165
  }
161
166
 
162
167
  .aksel-combobox__input-wrapper {