@navikt/ds-css 8.3.0 → 8.4.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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@navikt/ds-css",
3
- "version": "8.3.0",
3
+ "version": "8.4.0",
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.0",
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,43 +1,81 @@
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 {
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%;
29
67
  }
30
68
 
31
69
  .aksel-data-table__th {
32
70
  position: relative;
33
71
  background-color: var(--ax-bg-neutral-soft);
34
72
  color: var(--ax-text-neutral);
35
- padding-inline: var(--ax-space-16);
73
+ padding: var(--ax-space-8) var(--ax-space-16);
36
74
  text-align: start;
37
- border-inline-end: 1px solid var(--ax-border-neutral-subtle);
75
+ border-block-end: 1px solid var(--ax-border-neutral-subtle);
38
76
  overflow: hidden;
39
77
 
40
- &:first-child {
78
+ &:not(:first-child) {
41
79
  border-inline-start: 1px solid var(--ax-border-neutral-subtle);
42
80
  }
43
81
  }
@@ -52,16 +90,29 @@
52
90
  z-index: 2;
53
91
  position: absolute;
54
92
  inset-block: 0;
55
- inset-inline-end: -3px;
93
+ inset-inline-end: 0; /* TODO: See if we can make the handle appear right between the columns */
56
94
  cursor: col-resize;
57
95
  margin: 0;
58
96
  padding: 0;
59
- width: 5px;
60
- background: var(--ax-bg-neutral-strong);
97
+ width: 12px; /* TODO: Violation of WCAG SC 2.5.8 Target Size https://www.w3.org/WAI/WCAG22/Understanding/target-size-minimum.html */
61
98
  border: none;
99
+ background: transparent;
100
+
101
+ &::after {
102
+ content: "";
103
+ position: absolute;
104
+ inset-block: 0;
105
+ inset-inline-end: 0;
106
+ width: 4px;
107
+ }
62
108
 
63
- &:hover {
64
- background: var(--ax-bg-neutral-strong-pressed);
109
+ &:hover::after {
110
+ /* TODO: Consider if the resize-handle should be visible already when hovering the column header */
111
+ background: var(--ax-bg-accent-strong);
112
+ }
113
+
114
+ &:active::after {
115
+ background: var(--ax-bg-accent-strong-pressed);
65
116
  }
66
117
  }
67
118
 
@@ -75,7 +126,7 @@
75
126
  transition: none;
76
127
  }
77
128
 
78
- &:not(.aksel-data-table__th:hover &, &:focus-visible, &[data-expanded="true"]) {
129
+ &:not(.aksel-data-table__th:is(:hover, :focus-within) &, &:focus-visible, &[data-expanded="true"]) {
79
130
  opacity: 0;
80
131
  min-width: 0;
81
132
  max-width: 0;
@@ -90,18 +141,31 @@
90
141
  border-block-end: 1px solid var(--ax-border-neutral-subtle);
91
142
  border-block-start: 1px solid var(--ax-bg-raised);
92
143
  color: var(--ax-text-neutral-subtle);
144
+ padding: var(--__axc-data-table-density);
93
145
  padding-inline: 1rem;
94
146
  overflow: hidden;
95
- border-inline-end: 1px solid var(--ax-border-neutral-subtle);
96
147
 
97
- &:first-child {
148
+ &:not(:first-child) {
98
149
  border-inline-start: 1px solid var(--ax-border-neutral-subtle);
99
150
  }
100
151
 
101
- & > div {
102
- text-overflow: ellipsis;
103
- white-space: nowrap;
104
- overflow: hidden;
152
+ .aksel-data-table__tfoot .aksel-data-table__tr:last-child & {
153
+ border-block-end: none;
154
+ }
155
+
156
+ .aksel-data-table:not(:has(.aksel-data-table__tfoot)) .aksel-data-table__tr:last-child & {
157
+ border-block-end: none;
158
+ }
159
+ }
160
+
161
+ .aksel-data-table__td,
162
+ .aksel-data-table__th {
163
+ scroll-margin-block: var(--ax-space-0);
164
+ scroll-margin-inline: var(--ax-space-0);
165
+
166
+ &:focus-visible {
167
+ outline: 2px solid var(--ax-border-focus);
168
+ outline-offset: -4px;
105
169
  }
106
170
  }
107
171