@navikt/ds-css 7.8.0 → 7.8.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.
Files changed (208) hide show
  1. package/CHANGELOG.md +8 -0
  2. package/config/bundle.darkside.ts +270 -0
  3. package/config/tests/bundle.test.ts +46 -0
  4. package/darkside/baseline/{utilities.darkside.css → baseline.darkside.css} +9 -0
  5. package/darkside/baseline/tokens.darkside.css +1 -0
  6. package/darkside/button.darkside.css +1 -1
  7. package/darkside/copybutton.darkside.css +1 -1
  8. package/darkside/dropdown.darkside.css +1 -1
  9. package/darkside/form/combobox.darkside.css +1 -1
  10. package/darkside/form/fieldset.darkside.css +1 -1
  11. package/darkside/form/form.darkside.css +2 -2
  12. package/darkside/form/radio-checkbox.darkside.css +1 -1
  13. package/darkside/form/search.darkside.css +2 -2
  14. package/darkside/form/switch.darkside.css +1 -1
  15. package/darkside/index.css +9 -11
  16. package/darkside/link.darkside.css +2 -2
  17. package/darkside/tag.darkside.css +85 -147
  18. package/darkside/timeline.darkside.css +118 -211
  19. package/darkside/tooltip.darkside.css +82 -57
  20. package/darkside/typography.darkside.css +0 -12
  21. package/dist/component/link.css +1 -1
  22. package/dist/component/link.min.css +1 -1
  23. package/dist/component/table.css +1 -1
  24. package/dist/component/table.min.css +1 -1
  25. package/dist/component/tag.css +12 -6
  26. package/dist/component/tag.min.css +1 -1
  27. package/dist/components.css +14 -8
  28. package/dist/components.min.css +1 -1
  29. package/dist/darkside/component/accordion.css +174 -0
  30. package/dist/darkside/component/accordion.min.css +1 -0
  31. package/dist/darkside/component/actionmenu.css +182 -0
  32. package/dist/darkside/component/actionmenu.min.css +1 -0
  33. package/dist/darkside/component/alert.css +105 -0
  34. package/dist/darkside/component/alert.min.css +1 -0
  35. package/dist/darkside/component/button.css +271 -0
  36. package/dist/darkside/component/button.min.css +1 -0
  37. package/dist/darkside/component/chat.css +103 -0
  38. package/dist/darkside/component/chat.min.css +1 -0
  39. package/dist/darkside/component/chips.css +176 -0
  40. package/dist/darkside/component/chips.min.css +1 -0
  41. package/dist/darkside/component/copybutton.css +176 -0
  42. package/dist/darkside/component/copybutton.min.css +1 -0
  43. package/dist/darkside/component/date.css +262 -0
  44. package/dist/darkside/component/date.min.css +1 -0
  45. package/dist/darkside/component/dropdown.css +92 -0
  46. package/dist/darkside/component/dropdown.min.css +1 -0
  47. package/dist/darkside/component/expansioncard.css +167 -0
  48. package/dist/darkside/component/expansioncard.min.css +1 -0
  49. package/dist/darkside/component/form.css +1871 -0
  50. package/dist/darkside/component/form.min.css +1 -0
  51. package/dist/darkside/component/guidepanel.css +113 -0
  52. package/dist/darkside/component/guidepanel.min.css +1 -0
  53. package/dist/darkside/component/helptext.css +53 -0
  54. package/dist/darkside/component/helptext.min.css +1 -0
  55. package/dist/darkside/component/internalheader.css +100 -0
  56. package/dist/darkside/component/internalheader.min.css +1 -0
  57. package/dist/darkside/component/link.css +60 -0
  58. package/dist/darkside/component/link.min.css +1 -0
  59. package/dist/darkside/component/linkpanel.css +48 -0
  60. package/dist/darkside/component/linkpanel.min.css +1 -0
  61. package/dist/darkside/component/list.css +88 -0
  62. package/dist/darkside/component/list.min.css +1 -0
  63. package/dist/darkside/component/loader.css +119 -0
  64. package/dist/darkside/component/loader.min.css +1 -0
  65. package/dist/darkside/component/modal.css +175 -0
  66. package/dist/darkside/component/modal.min.css +1 -0
  67. package/dist/darkside/component/pagination.css +43 -0
  68. package/dist/darkside/component/pagination.min.css +1 -0
  69. package/dist/darkside/component/panel.css +12 -0
  70. package/dist/darkside/component/panel.min.css +1 -0
  71. package/dist/darkside/component/popover.css +18 -0
  72. package/dist/darkside/component/popover.min.css +1 -0
  73. package/dist/darkside/component/primitives.css +1291 -0
  74. package/dist/darkside/component/primitives.min.css +1 -0
  75. package/dist/darkside/component/progressbar.css +106 -0
  76. package/dist/darkside/component/progressbar.min.css +1 -0
  77. package/dist/darkside/component/readmore.css +95 -0
  78. package/dist/darkside/component/readmore.min.css +1 -0
  79. package/dist/darkside/component/skeleton.css +66 -0
  80. package/dist/darkside/component/skeleton.min.css +1 -0
  81. package/dist/darkside/component/stepper.css +234 -0
  82. package/dist/darkside/component/stepper.min.css +1 -0
  83. package/dist/darkside/component/table.css +225 -0
  84. package/dist/darkside/component/table.min.css +1 -0
  85. package/dist/darkside/component/tabs.css +138 -0
  86. package/dist/darkside/component/tabs.min.css +1 -0
  87. package/dist/darkside/component/tag.css +128 -0
  88. package/dist/darkside/component/tag.min.css +1 -0
  89. package/dist/darkside/component/theme.css +17 -0
  90. package/dist/darkside/component/theme.min.css +1 -0
  91. package/dist/darkside/component/timeline.css +338 -0
  92. package/dist/darkside/component/timeline.min.css +1 -0
  93. package/dist/darkside/component/togglegroup.css +105 -0
  94. package/dist/darkside/component/togglegroup.min.css +1 -0
  95. package/dist/darkside/component/tooltip.css +108 -0
  96. package/dist/darkside/component/tooltip.min.css +1 -0
  97. package/dist/darkside/component/typography.css +242 -0
  98. package/dist/darkside/component/typography.min.css +1 -0
  99. package/dist/darkside/components.css +7471 -0
  100. package/dist/darkside/components.min.css +1 -0
  101. package/dist/darkside/global/baseline.css +47 -0
  102. package/dist/darkside/global/baseline.min.css +1 -0
  103. package/dist/darkside/global/fonts.css +109 -0
  104. package/dist/darkside/global/fonts.min.css +1 -0
  105. package/dist/darkside/global/print.css +52 -0
  106. package/dist/darkside/global/print.min.css +1 -0
  107. package/dist/darkside/global/reset.css +93 -0
  108. package/dist/darkside/global/reset.min.css +1 -0
  109. package/dist/darkside/global/tokens.css +895 -0
  110. package/dist/darkside/global/tokens.min.css +1 -0
  111. package/dist/darkside/index.css +8670 -0
  112. package/dist/darkside/index.min.css +1 -0
  113. package/dist/darkside/version/7.8.1/component/accordion.css +174 -0
  114. package/dist/darkside/version/7.8.1/component/accordion.min.css +1 -0
  115. package/dist/darkside/version/7.8.1/component/actionmenu.css +182 -0
  116. package/dist/darkside/version/7.8.1/component/actionmenu.min.css +1 -0
  117. package/dist/darkside/version/7.8.1/component/alert.css +105 -0
  118. package/dist/darkside/version/7.8.1/component/alert.min.css +1 -0
  119. package/dist/darkside/version/7.8.1/component/button.css +271 -0
  120. package/dist/darkside/version/7.8.1/component/button.min.css +1 -0
  121. package/dist/darkside/version/7.8.1/component/chat.css +103 -0
  122. package/dist/darkside/version/7.8.1/component/chat.min.css +1 -0
  123. package/dist/darkside/version/7.8.1/component/chips.css +176 -0
  124. package/dist/darkside/version/7.8.1/component/chips.min.css +1 -0
  125. package/dist/darkside/version/7.8.1/component/copybutton.css +176 -0
  126. package/dist/darkside/version/7.8.1/component/copybutton.min.css +1 -0
  127. package/dist/darkside/version/7.8.1/component/date.css +262 -0
  128. package/dist/darkside/version/7.8.1/component/date.min.css +1 -0
  129. package/dist/darkside/version/7.8.1/component/dropdown.css +92 -0
  130. package/dist/darkside/version/7.8.1/component/dropdown.min.css +1 -0
  131. package/dist/darkside/version/7.8.1/component/expansioncard.css +167 -0
  132. package/dist/darkside/version/7.8.1/component/expansioncard.min.css +1 -0
  133. package/dist/darkside/version/7.8.1/component/form.css +1871 -0
  134. package/dist/darkside/version/7.8.1/component/form.min.css +1 -0
  135. package/dist/darkside/version/7.8.1/component/guidepanel.css +113 -0
  136. package/dist/darkside/version/7.8.1/component/guidepanel.min.css +1 -0
  137. package/dist/darkside/version/7.8.1/component/helptext.css +53 -0
  138. package/dist/darkside/version/7.8.1/component/helptext.min.css +1 -0
  139. package/dist/darkside/version/7.8.1/component/internalheader.css +100 -0
  140. package/dist/darkside/version/7.8.1/component/internalheader.min.css +1 -0
  141. package/dist/darkside/version/7.8.1/component/link.css +60 -0
  142. package/dist/darkside/version/7.8.1/component/link.min.css +1 -0
  143. package/dist/darkside/version/7.8.1/component/linkpanel.css +48 -0
  144. package/dist/darkside/version/7.8.1/component/linkpanel.min.css +1 -0
  145. package/dist/darkside/version/7.8.1/component/list.css +88 -0
  146. package/dist/darkside/version/7.8.1/component/list.min.css +1 -0
  147. package/dist/darkside/version/7.8.1/component/loader.css +119 -0
  148. package/dist/darkside/version/7.8.1/component/loader.min.css +1 -0
  149. package/dist/darkside/version/7.8.1/component/modal.css +175 -0
  150. package/dist/darkside/version/7.8.1/component/modal.min.css +1 -0
  151. package/dist/darkside/version/7.8.1/component/pagination.css +43 -0
  152. package/dist/darkside/version/7.8.1/component/pagination.min.css +1 -0
  153. package/dist/darkside/version/7.8.1/component/panel.css +12 -0
  154. package/dist/darkside/version/7.8.1/component/panel.min.css +1 -0
  155. package/dist/darkside/version/7.8.1/component/popover.css +18 -0
  156. package/dist/darkside/version/7.8.1/component/popover.min.css +1 -0
  157. package/dist/darkside/version/7.8.1/component/primitives.css +1291 -0
  158. package/dist/darkside/version/7.8.1/component/primitives.min.css +1 -0
  159. package/dist/darkside/version/7.8.1/component/progressbar.css +106 -0
  160. package/dist/darkside/version/7.8.1/component/progressbar.min.css +1 -0
  161. package/dist/darkside/version/7.8.1/component/readmore.css +95 -0
  162. package/dist/darkside/version/7.8.1/component/readmore.min.css +1 -0
  163. package/dist/darkside/version/7.8.1/component/skeleton.css +66 -0
  164. package/dist/darkside/version/7.8.1/component/skeleton.min.css +1 -0
  165. package/dist/darkside/version/7.8.1/component/stepper.css +234 -0
  166. package/dist/darkside/version/7.8.1/component/stepper.min.css +1 -0
  167. package/dist/darkside/version/7.8.1/component/table.css +225 -0
  168. package/dist/darkside/version/7.8.1/component/table.min.css +1 -0
  169. package/dist/darkside/version/7.8.1/component/tabs.css +138 -0
  170. package/dist/darkside/version/7.8.1/component/tabs.min.css +1 -0
  171. package/dist/darkside/version/7.8.1/component/tag.css +128 -0
  172. package/dist/darkside/version/7.8.1/component/tag.min.css +1 -0
  173. package/dist/darkside/version/7.8.1/component/theme.css +17 -0
  174. package/dist/darkside/version/7.8.1/component/theme.min.css +1 -0
  175. package/dist/darkside/version/7.8.1/component/timeline.css +338 -0
  176. package/dist/darkside/version/7.8.1/component/timeline.min.css +1 -0
  177. package/dist/darkside/version/7.8.1/component/togglegroup.css +105 -0
  178. package/dist/darkside/version/7.8.1/component/togglegroup.min.css +1 -0
  179. package/dist/darkside/version/7.8.1/component/tooltip.css +108 -0
  180. package/dist/darkside/version/7.8.1/component/tooltip.min.css +1 -0
  181. package/dist/darkside/version/7.8.1/component/typography.css +242 -0
  182. package/dist/darkside/version/7.8.1/component/typography.min.css +1 -0
  183. package/dist/darkside/version/7.8.1/components.css +7471 -0
  184. package/dist/darkside/version/7.8.1/components.min.css +1 -0
  185. package/dist/darkside/version/7.8.1/global/baseline.css +47 -0
  186. package/dist/darkside/version/7.8.1/global/baseline.min.css +1 -0
  187. package/dist/darkside/version/7.8.1/global/fonts.css +109 -0
  188. package/dist/darkside/version/7.8.1/global/fonts.min.css +1 -0
  189. package/dist/darkside/version/7.8.1/global/print.css +52 -0
  190. package/dist/darkside/version/7.8.1/global/print.min.css +1 -0
  191. package/dist/darkside/version/7.8.1/global/reset.css +93 -0
  192. package/dist/darkside/version/7.8.1/global/reset.min.css +1 -0
  193. package/dist/darkside/version/7.8.1/global/tokens.css +895 -0
  194. package/dist/darkside/version/7.8.1/global/tokens.min.css +1 -0
  195. package/dist/darkside/version/7.8.1/index.css +8670 -0
  196. package/dist/darkside/version/7.8.1/index.min.css +1 -0
  197. package/dist/global/tokens.css +1 -1
  198. package/dist/global/tokens.min.css +1 -1
  199. package/dist/index.css +15 -9
  200. package/dist/index.min.css +2 -2
  201. package/link.css +1 -1
  202. package/package.json +23 -9
  203. package/table.css +1 -1
  204. package/tag.css +12 -6
  205. package/darkside/index copy.css +0 -37
  206. package/dist/component/index.css +0 -10103
  207. package/dist/component/index.min.css +0 -9
  208. /package/darkside/{baseline/theme.darkside.css → theme.darkside.css} +0 -0
package/CHANGELOG.md CHANGED
@@ -1,5 +1,13 @@
1
1
  # @navikt/ds-css
2
2
 
3
+ ## 7.8.1
4
+
5
+ ### Patch Changes
6
+
7
+ - Alert: Link-components used within Alert variant='inline' now preserves default coloring ([#3461](https://github.com/navikt/aksel/pull/3461))
8
+
9
+ - Table: :fire: Removed cursor 'pointer' when 'ExpandableRow' is disabled. ([#3462](https://github.com/navikt/aksel/pull/3462))
10
+
3
11
  ## 7.8.0
4
12
 
5
13
  ### Minor Changes
@@ -0,0 +1,270 @@
1
+ import browserslist from "browserslist";
2
+ import CleanCss from "clean-css";
3
+ import fastglob from "fast-glob";
4
+ import fs from "fs";
5
+ import { Features, browserslistToTargets, bundleAsync } from "lightningcss";
6
+ import path from "path";
7
+ import {
8
+ StyleMappings,
9
+ componentsCss,
10
+ formCss,
11
+ primitivesCss,
12
+ } from "../config/_mappings";
13
+ import packageJSON from "../package.json";
14
+
15
+ bundleDarkside();
16
+
17
+ async function bundleDarkside() {
18
+ const buildDir = path.join(__dirname, "..", "dist/darkside");
19
+ const darksideDir = path.join(__dirname, "..", "darkside");
20
+
21
+ /* Make sure every dir is created to make node happy */
22
+ [buildDir, `${buildDir}/global`, `${buildDir}/component`].forEach((dir) => {
23
+ if (!fs.existsSync(dir)) {
24
+ fs.mkdirSync(dir, { recursive: true });
25
+ }
26
+ });
27
+
28
+ /**
29
+ * Bundles the ./index.css file with LightningCSS.
30
+ * @param rootParser: Custom parsers that allows for editing the index.css file before bundling it. This allows removing unwanted CSS from being bundled.
31
+ * @returns Parsed CSS file output. Must be valid CSS.
32
+ */
33
+ async function bundleCSS(rootParser?: (rootFile: string) => string) {
34
+ const { code } = await bundleAsync({
35
+ filename: `${darksideDir}/index.css`,
36
+ minify: false,
37
+ include:
38
+ Features.Nesting | Features.MediaRangeSyntax | Features.HexAlphaColors,
39
+
40
+ drafts: {
41
+ customMedia: false,
42
+ },
43
+ targets: browserslistToTargets(
44
+ browserslist(">= 0.5% in NO, safari >= 15.4, iOS >= 15.4, not dead"),
45
+ ),
46
+ resolver: {
47
+ read(filePath) {
48
+ const file = fs.readFileSync(filePath, "utf8");
49
+ if (filePath === `${darksideDir}/index.css` && rootParser) {
50
+ return rootParser(file);
51
+ }
52
+
53
+ return file;
54
+ },
55
+ },
56
+ });
57
+
58
+ let codeString = code.toString();
59
+
60
+ /**
61
+ * LightningCSS adds these tokens to the bundle that we want removed:
62
+ * --lightningcss-light: initial;
63
+ * --lightningcss-dark: ;
64
+ */
65
+ codeString = codeString
66
+ .split("\n")
67
+ .filter((line) => !line.includes("--lightningcss-"))
68
+ .join("\n");
69
+
70
+ return codeString;
71
+ }
72
+
73
+ /**
74
+ * Writes the CSS file to the build directory. Includes a minified version with the .min.css suffix.
75
+ * @param file: CSS file content
76
+ * @param filePath: Path to the file in the build directory
77
+ */
78
+ function writeFile({ file, filePath }: { file: string; filePath: string }) {
79
+ fs.writeFileSync(`${buildDir}/${filePath}`, file);
80
+
81
+ /**
82
+ * We use CleanCss package here since we only want it to optimize filesize, not transform any CSS like LightningCSS minifier does.
83
+ * This is because we want to keep the CSS as close to the original as possible.
84
+ * Since CleanCSS is not part of the PostCSS ecosystem, we use it in replacement for cssnano.
85
+ */
86
+ const minifiedCss = new CleanCss({}).minify(file);
87
+
88
+ if (minifiedCss.errors.length > 0) {
89
+ throw new Error(
90
+ `Errors found when minifying for ${filePath} CSS. Stopped bundling\n${minifiedCss.errors}`,
91
+ );
92
+ }
93
+
94
+ fs.writeFileSync(
95
+ `${buildDir}/${filePath.replace(".css", ".min.css")}`,
96
+ minifiedCss.styles,
97
+ );
98
+ }
99
+
100
+ /* ----------------------------- index.css build ---------------------------- */
101
+ await bundleCSS().then((file) => {
102
+ writeFile({
103
+ file,
104
+ filePath: "index.css",
105
+ });
106
+ });
107
+
108
+ /* --------------------------- component.css build -------------------------- */
109
+ function rootComponentsParser(rootString: string) {
110
+ let parsed = rootString
111
+ .split("\n")
112
+ .filter((line) => {
113
+ /* We assume that all components is added under the layer components or layout */
114
+ return (
115
+ line.endsWith("layer(aksel.components);") ||
116
+ line.endsWith("layer(aksel.layout);")
117
+ );
118
+ })
119
+ .join("\n");
120
+
121
+ /* If one imports this file standalone, we would like to make sure the layering order is included. */
122
+ const layerDefinition = rootString
123
+ .split("\n")
124
+ .find((line) => line.startsWith("@layer"));
125
+
126
+ if (!layerDefinition) {
127
+ throw new Error(
128
+ "No layer definition found in index.css. Stopped bundling",
129
+ );
130
+ }
131
+
132
+ parsed = layerDefinition + "\n" + parsed;
133
+
134
+ return parsed;
135
+ }
136
+
137
+ await bundleCSS(rootComponentsParser).then((file) => {
138
+ writeFile({
139
+ file,
140
+ filePath: componentsCss,
141
+ });
142
+ });
143
+
144
+ /* ------------------------------ /global build ----------------------------- */
145
+ for (const style of StyleMappings.baseline) {
146
+ // eslint-disable-next-line no-inner-declarations
147
+ function parser(input: string) {
148
+ return input
149
+ .split("\n")
150
+ .filter((line) => line.startsWith("@import"))
151
+ .filter((line) =>
152
+ line.replace(".darkside.css", ".css").includes(style.main),
153
+ )
154
+ .join("\n");
155
+ }
156
+
157
+ await bundleCSS(parser).then((file) => {
158
+ writeFile({
159
+ file,
160
+ filePath: `global/${style.main}`,
161
+ });
162
+ });
163
+ }
164
+
165
+ /* ------------------------------ form build ----------------------------- */
166
+ function rootFormParser(input: string) {
167
+ return input
168
+ .split("\n")
169
+ .filter((line) => line.startsWith("@import"))
170
+ .filter((line) => line.includes("form/index.css"))
171
+ .join("\n");
172
+ }
173
+
174
+ await bundleCSS(rootFormParser).then((file) => {
175
+ writeFile({
176
+ file,
177
+ filePath: `component/${formCss}`,
178
+ });
179
+ });
180
+
181
+ /* ------------------------------ Primitives build ----------------------------- */
182
+ function rootPrimitivesParser(input: string) {
183
+ return input
184
+ .split("\n")
185
+ .filter((line) => line.startsWith("@import"))
186
+ .filter((line) => line.includes("primitives/index.css"))
187
+ .join("\n");
188
+ }
189
+
190
+ await bundleCSS(rootPrimitivesParser).then((file) => {
191
+ writeFile({
192
+ file,
193
+ filePath: `component/${primitivesCss}`,
194
+ });
195
+ });
196
+
197
+ /* ---------------------------- /component build ---------------------------- */
198
+
199
+ function componentFiles(): string[] {
200
+ const indexFile = fs.readFileSync(`${darksideDir}/index.css`, "utf8");
201
+
202
+ /* Since forms and primitives is under the same layers, but diffferent files we filter them out to avoid duplicates */
203
+ const formLine = rootFormParser(indexFile);
204
+ const primitivesLine = rootPrimitivesParser(indexFile);
205
+
206
+ return indexFile
207
+ .split("\n")
208
+ .filter((line) => line.startsWith("@import"))
209
+ .filter((line) => !formLine.includes(line))
210
+ .filter((line) => !primitivesLine.includes(line))
211
+ .filter((line) => line.endsWith("layer(aksel.components);"));
212
+ }
213
+
214
+ for (const componentLine of componentFiles()) {
215
+ // eslint-disable-next-line no-inner-declarations
216
+ function parser(input: string) {
217
+ return input
218
+ .split("\n")
219
+ .filter((line) => line === componentLine)
220
+ .join("\n");
221
+ }
222
+
223
+ await bundleCSS(parser).then((file) => {
224
+ const componentName = componentLine
225
+ /* Matches everything between " */
226
+ .match(/".*"/gm)?.[0]
227
+ /* Replaces every " with nothing */
228
+ .replace(/"/gm, "")
229
+ /* Removes start of import-string */
230
+ .replace("./", "")
231
+ .replace(".darkside.css", ".css");
232
+
233
+ if (!componentName) {
234
+ throw new Error(
235
+ `Could not find component name for line: ${componentLine}`,
236
+ );
237
+ }
238
+
239
+ const sanitizedName = componentName
240
+ /*
241
+ * https://regex101.com/r/MAj58n/1
242
+ * Removes every - and space
243
+ */
244
+ .replace(/[\s-]/g, "")
245
+ .replace(".css", "")
246
+ .toLowerCase();
247
+
248
+ writeFile({
249
+ file,
250
+ filePath: `component/${sanitizedName}.css`,
251
+ });
252
+ });
253
+ }
254
+
255
+ const version = packageJSON.version;
256
+
257
+ const files = fastglob.sync("**/*.css", {
258
+ cwd: buildDir,
259
+ ignore: ["**/version/**"],
260
+ });
261
+
262
+ for (const file of files) {
263
+ const css = fs.readFileSync(`${buildDir}/${file}`, "utf-8");
264
+
265
+ const filename = `${buildDir}/version/${version}/${file}`;
266
+ fs.mkdirSync(path.dirname(filename), { recursive: true });
267
+
268
+ fs.writeFileSync(filename, css);
269
+ }
270
+ }
@@ -0,0 +1,46 @@
1
+ import fastglob from "fast-glob";
2
+ import path from "path";
3
+ import { describe, expect, test } from "vitest";
4
+
5
+ /**
6
+ * Darkside config might have some new files added. We can skip these when checking for equality.
7
+ */
8
+ const newFiles = ["theme"];
9
+
10
+ describe("Check that old and new (darkside) bundle matches", () => {
11
+ test("Darkside includes the same files as old bundle", () => {
12
+ const oldBundleDir = path.join(__dirname, "../../dist");
13
+ const darksideDir = path.join(__dirname, "../../dist/darkside");
14
+
15
+ const oldFiles = fastglob.sync("**/*.css", {
16
+ cwd: oldBundleDir,
17
+ ignore: ["**/version/**", "**/darkside/**"],
18
+ });
19
+
20
+ const darksideFiles = fastglob.sync("**/*.css", {
21
+ cwd: darksideDir,
22
+ ignore: ["**/version/**"],
23
+ });
24
+
25
+ expect(oldFiles.length).toBeGreaterThan(0);
26
+ expect(darksideFiles.length).toBeGreaterThan(0);
27
+
28
+ // Compare file names
29
+ oldFiles.forEach((file) => {
30
+ expect(darksideFiles).toContain(file);
31
+ });
32
+
33
+ darksideFiles.forEach((file) => {
34
+ if (newFiles.find((newFile) => file.includes(newFile))) {
35
+ return;
36
+ }
37
+ expect(oldFiles).toContain(file);
38
+ });
39
+
40
+ /**
41
+ * Check that darkside has the same amount of files as old bundle
42
+ * (minus the new files * 2 since .min.css is also included)
43
+ */
44
+ expect(darksideFiles.length - newFiles.length * 2).toBe(oldFiles.length);
45
+ });
46
+ });
@@ -1,3 +1,12 @@
1
+ /* ------------------------- Global typo-definitions ------------------------ */
2
+ body,
3
+ :host {
4
+ font-family: var(--ax-font-family, "Source Sans 3", "Source Sans Pro", Arial, sans-serif);
5
+ line-height: 1.333;
6
+ font-size: 1.125rem;
7
+ }
8
+
9
+ /* ---------------------------- Inline utilities ---------------------------- */
1
10
  [hidden] {
2
11
  display: none !important;
3
12
  }
@@ -0,0 +1 @@
1
+ @import "../../../tokens/dist/darkside/tokens.css";
@@ -260,7 +260,7 @@
260
260
  }
261
261
 
262
262
  .navds-button:not(.navds-button--loading):where(:disabled, .navds-button--disabled) {
263
- opacity: 0.3;
263
+ opacity: var(--ax-opacity-disabled);
264
264
  }
265
265
 
266
266
  /* Loader overrides */
@@ -31,7 +31,7 @@
31
31
 
32
32
  &:disabled {
33
33
  cursor: not-allowed;
34
- opacity: 0.3;
34
+ opacity: var(--ax-opacity-disabled);
35
35
  }
36
36
 
37
37
  &:disabled:hover {
@@ -74,7 +74,7 @@
74
74
 
75
75
  .navds-dropdown__item:disabled {
76
76
  color: var(--ac-dropdown-item-text, var(--a-text-action));
77
- opacity: 0.3;
77
+ opacity: var(--ax-opacity-disabled);
78
78
  background: transparent;
79
79
  cursor: not-allowed;
80
80
  }
@@ -28,7 +28,7 @@
28
28
  }
29
29
 
30
30
  .navds-combobox--disabled {
31
- opacity: 0.3;
31
+ opacity: var(--ax-opacity-disabled);
32
32
 
33
33
  & .navds-combobox__wrapper {
34
34
  & *:hover {
@@ -32,7 +32,7 @@
32
32
 
33
33
  .navds-fieldset:disabled > .navds-fieldset__legend,
34
34
  .navds-fieldset:disabled > .navds-fieldset__description {
35
- opacity: 0.3;
35
+ opacity: var(--ax-opacity-disabled);
36
36
  }
37
37
 
38
38
  @media (forced-colors: active) {
@@ -23,7 +23,7 @@
23
23
  }
24
24
 
25
25
  .navds-form-field--disabled {
26
- opacity: 0.3;
26
+ opacity: var(--ax-opacity-disabled);
27
27
  cursor: not-allowed;
28
28
  }
29
29
 
@@ -41,7 +41,7 @@
41
41
 
42
42
  .navds-form-field__readonly-icon {
43
43
  margin-top: var(--ax-spacing-05);
44
- margin-right: var(--ax-spacing-2);
44
+ margin-right: var(--ax-spacing-1);
45
45
  flex-shrink: 0;
46
46
  align-self: flex-start;
47
47
  }
@@ -172,7 +172,7 @@
172
172
 
173
173
  .navds-checkbox--disabled,
174
174
  .navds-radio--disabled {
175
- opacity: 0.3;
175
+ opacity: var(--ax-opacity-disabled);
176
176
  }
177
177
 
178
178
  .navds-checkbox--disabled > .navds-checkbox__input,
@@ -81,7 +81,7 @@
81
81
  font-size: 1.5rem;
82
82
 
83
83
  .navds-search--disabled & {
84
- opacity: 0.3;
84
+ opacity: var(--ax-opacity-disabled);
85
85
  }
86
86
  }
87
87
 
@@ -148,7 +148,7 @@
148
148
  /* We can't re-use disabled-state for form-fields since opacity multiplies on search-button */
149
149
  .navds-search--disabled {
150
150
  .navds-search__input {
151
- opacity: 0.3;
151
+ opacity: var(--ax-opacity-disabled);
152
152
  cursor: not-allowed;
153
153
  }
154
154
  }
@@ -169,7 +169,7 @@
169
169
  }
170
170
 
171
171
  .navds-switch--disabled:not(.navds-switch--loading) {
172
- opacity: 0.3;
172
+ opacity: var(--ax-opacity-disabled);
173
173
  }
174
174
 
175
175
  .navds-switch__input:disabled,
@@ -1,23 +1,23 @@
1
1
  @charset "UTF-8";
2
2
 
3
3
  /* CSS is ordered by specificity, so that browsers without layers fall backs to good defaults */
4
- @layer aksel.reset, aksel.typography, aksel.theme, aksel.components, aksel.layout, aksel.utilities;
4
+ @layer aksel.reset, aksel.theming, aksel.baseline, aksel.print, aksel.typography, aksel.components, aksel.layout;
5
5
 
6
6
  /* ----------------------------- CSS foundations ---------------------------- */
7
- @import "./baseline/reset.darkside.css" layer(aksel.reset);
8
- @import "./baseline/print.darkside.css" layer(aksel.reset);
9
7
  @import "./baseline/fonts.darkside.css" layer(aksel.typography);
10
- @import "./typography.darkside.css" layer(aksel.typography);
11
-
12
- /* --------------------------------- Theming -------------------------------- */
13
- @import "@navikt/ds-tokens/dist/darkside/tokens.css" layer(aksel.theme);
14
- @import "./baseline/theme.darkside.css" layer(aksel.theme);
8
+ @import "./baseline/reset.darkside.css" layer(aksel.reset);
9
+ @import "./baseline/tokens.darkside.css" layer(aksel.theming);
10
+ @import "./baseline/baseline.darkside.css" layer(aksel.baseline);
11
+ @import "./baseline/print.darkside.css" layer(aksel.print);
15
12
 
16
13
  /* ------------------------------- Components ------------------------------- */
14
+ @import "./typography.darkside.css" layer(aksel.components);
17
15
  @import "./button.darkside.css" layer(aksel.components);
18
16
  @import "./chips.darkside.css" layer(aksel.components);
19
17
 
20
18
  /**
19
+ * Most components depend on typo-styles, so we import them first.
20
+ *
21
21
  * `./form/index.css` edits the following components:
22
22
  * - Button
23
23
  * - Chips
@@ -53,9 +53,7 @@
53
53
  @import "./table.darkside.css" layer(aksel.components);
54
54
  @import "./tabs.darkside.css" layer(aksel.components);
55
55
  @import "./list.darkside.css" layer(aksel.components);
56
+ @import "./theme.darkside.css" layer(aksel.components);
56
57
 
57
58
  /* --------------------------------- Layout --------------------------------- */
58
59
  @import "./primitives/index.css" layer(aksel.layout);
59
-
60
- /* --------------------------------- Utility -------------------------------- */
61
- @import "./baseline/utilities.darkside.css" layer(aksel.utilities);
@@ -2,7 +2,7 @@
2
2
  color: var(--ax-text-accent);
3
3
  display: inline-flex;
4
4
  align-items: center;
5
- gap: var(--ax-spacing-1);
5
+ gap: var(--ax-spacing-05);
6
6
  text-decoration: underline;
7
7
  text-underline-offset: 0.1em;
8
8
  text-decoration-thickness: 0.05em;
@@ -43,7 +43,7 @@
43
43
  }
44
44
  }
45
45
 
46
- .navds-alert,
46
+ .navds-alert:not(.navds-alert--inline),
47
47
  .navds-confirmation-panel {
48
48
  & .navds-link {
49
49
  color: var(--ax-text-default);