@navikt/ds-css 7.8.0 → 7.9.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.
Files changed (222) hide show
  1. package/CHANGELOG.md +23 -0
  2. package/button.css +9 -1
  3. package/config/bundle.darkside.ts +270 -0
  4. package/config/tests/bundle.test.ts +46 -0
  5. package/darkside/baseline/{utilities.darkside.css → baseline.darkside.css} +9 -0
  6. package/darkside/baseline/tokens.darkside.css +1 -0
  7. package/darkside/button.darkside.css +10 -2
  8. package/darkside/copybutton.darkside.css +1 -1
  9. package/darkside/dropdown.darkside.css +1 -1
  10. package/darkside/form/combobox.darkside.css +1 -1
  11. package/darkside/form/fieldset.darkside.css +1 -1
  12. package/darkside/form/form.darkside.css +2 -15
  13. package/darkside/form/radio-checkbox.darkside.css +1 -1
  14. package/darkside/form/search.darkside.css +2 -2
  15. package/darkside/form/switch.darkside.css +1 -1
  16. package/darkside/index.css +9 -11
  17. package/darkside/link.darkside.css +2 -2
  18. package/darkside/tag.darkside.css +85 -147
  19. package/darkside/timeline.darkside.css +118 -211
  20. package/darkside/toggle-group.darkside.css +19 -9
  21. package/darkside/tooltip.darkside.css +82 -57
  22. package/darkside/typography.darkside.css +12 -12
  23. package/dist/component/button.css +9 -1
  24. package/dist/component/button.min.css +2 -2
  25. package/dist/component/form.css +37 -37
  26. package/dist/component/form.min.css +1 -1
  27. package/dist/component/link.css +1 -1
  28. package/dist/component/link.min.css +1 -1
  29. package/dist/component/table.css +1 -1
  30. package/dist/component/table.min.css +1 -1
  31. package/dist/component/tag.css +12 -6
  32. package/dist/component/tag.min.css +1 -1
  33. package/dist/component/typography.css +12 -0
  34. package/dist/component/typography.min.css +1 -1
  35. package/dist/components.css +73 -48
  36. package/dist/components.min.css +3 -3
  37. package/dist/darkside/component/accordion.css +174 -0
  38. package/dist/darkside/component/accordion.min.css +1 -0
  39. package/dist/darkside/component/actionmenu.css +182 -0
  40. package/dist/darkside/component/actionmenu.min.css +1 -0
  41. package/dist/darkside/component/alert.css +105 -0
  42. package/dist/darkside/component/alert.min.css +1 -0
  43. package/dist/darkside/component/button.css +279 -0
  44. package/dist/darkside/component/button.min.css +1 -0
  45. package/dist/darkside/component/chat.css +103 -0
  46. package/dist/darkside/component/chat.min.css +1 -0
  47. package/dist/darkside/component/chips.css +176 -0
  48. package/dist/darkside/component/chips.min.css +1 -0
  49. package/dist/darkside/component/copybutton.css +176 -0
  50. package/dist/darkside/component/copybutton.min.css +1 -0
  51. package/dist/darkside/component/date.css +262 -0
  52. package/dist/darkside/component/date.min.css +1 -0
  53. package/dist/darkside/component/dropdown.css +92 -0
  54. package/dist/darkside/component/dropdown.min.css +1 -0
  55. package/dist/darkside/component/expansioncard.css +167 -0
  56. package/dist/darkside/component/expansioncard.min.css +1 -0
  57. package/dist/darkside/component/form.css +1862 -0
  58. package/dist/darkside/component/form.min.css +1 -0
  59. package/dist/darkside/component/guidepanel.css +113 -0
  60. package/dist/darkside/component/guidepanel.min.css +1 -0
  61. package/dist/darkside/component/helptext.css +53 -0
  62. package/dist/darkside/component/helptext.min.css +1 -0
  63. package/dist/darkside/component/internalheader.css +100 -0
  64. package/dist/darkside/component/internalheader.min.css +1 -0
  65. package/dist/darkside/component/link.css +60 -0
  66. package/dist/darkside/component/link.min.css +1 -0
  67. package/dist/darkside/component/linkpanel.css +48 -0
  68. package/dist/darkside/component/linkpanel.min.css +1 -0
  69. package/dist/darkside/component/list.css +88 -0
  70. package/dist/darkside/component/list.min.css +1 -0
  71. package/dist/darkside/component/loader.css +119 -0
  72. package/dist/darkside/component/loader.min.css +1 -0
  73. package/dist/darkside/component/modal.css +175 -0
  74. package/dist/darkside/component/modal.min.css +1 -0
  75. package/dist/darkside/component/pagination.css +43 -0
  76. package/dist/darkside/component/pagination.min.css +1 -0
  77. package/dist/darkside/component/panel.css +12 -0
  78. package/dist/darkside/component/panel.min.css +1 -0
  79. package/dist/darkside/component/popover.css +18 -0
  80. package/dist/darkside/component/popover.min.css +1 -0
  81. package/dist/darkside/component/primitives.css +1291 -0
  82. package/dist/darkside/component/primitives.min.css +1 -0
  83. package/dist/darkside/component/progressbar.css +106 -0
  84. package/dist/darkside/component/progressbar.min.css +1 -0
  85. package/dist/darkside/component/readmore.css +95 -0
  86. package/dist/darkside/component/readmore.min.css +1 -0
  87. package/dist/darkside/component/skeleton.css +66 -0
  88. package/dist/darkside/component/skeleton.min.css +1 -0
  89. package/dist/darkside/component/stepper.css +234 -0
  90. package/dist/darkside/component/stepper.min.css +1 -0
  91. package/dist/darkside/component/table.css +225 -0
  92. package/dist/darkside/component/table.min.css +1 -0
  93. package/dist/darkside/component/tabs.css +138 -0
  94. package/dist/darkside/component/tabs.min.css +1 -0
  95. package/dist/darkside/component/tag.css +128 -0
  96. package/dist/darkside/component/tag.min.css +1 -0
  97. package/dist/darkside/component/theme.css +17 -0
  98. package/dist/darkside/component/theme.min.css +1 -0
  99. package/dist/darkside/component/timeline.css +338 -0
  100. package/dist/darkside/component/timeline.min.css +1 -0
  101. package/dist/darkside/component/togglegroup.css +116 -0
  102. package/dist/darkside/component/togglegroup.min.css +1 -0
  103. package/dist/darkside/component/tooltip.css +108 -0
  104. package/dist/darkside/component/tooltip.min.css +1 -0
  105. package/dist/darkside/component/typography.css +254 -0
  106. package/dist/darkside/component/typography.min.css +1 -0
  107. package/dist/darkside/components.css +7493 -0
  108. package/dist/darkside/components.min.css +1 -0
  109. package/dist/darkside/global/baseline.css +47 -0
  110. package/dist/darkside/global/baseline.min.css +1 -0
  111. package/dist/darkside/global/fonts.css +109 -0
  112. package/dist/darkside/global/fonts.min.css +1 -0
  113. package/dist/darkside/global/print.css +52 -0
  114. package/dist/darkside/global/print.min.css +1 -0
  115. package/dist/darkside/global/reset.css +93 -0
  116. package/dist/darkside/global/reset.min.css +1 -0
  117. package/dist/darkside/global/tokens.css +896 -0
  118. package/dist/darkside/global/tokens.min.css +1 -0
  119. package/dist/darkside/index.css +8693 -0
  120. package/dist/darkside/index.min.css +1 -0
  121. package/dist/darkside/version/7.9.0/component/accordion.css +174 -0
  122. package/dist/darkside/version/7.9.0/component/accordion.min.css +1 -0
  123. package/dist/darkside/version/7.9.0/component/actionmenu.css +182 -0
  124. package/dist/darkside/version/7.9.0/component/actionmenu.min.css +1 -0
  125. package/dist/darkside/version/7.9.0/component/alert.css +105 -0
  126. package/dist/darkside/version/7.9.0/component/alert.min.css +1 -0
  127. package/dist/darkside/version/7.9.0/component/button.css +279 -0
  128. package/dist/darkside/version/7.9.0/component/button.min.css +1 -0
  129. package/dist/darkside/version/7.9.0/component/chat.css +103 -0
  130. package/dist/darkside/version/7.9.0/component/chat.min.css +1 -0
  131. package/dist/darkside/version/7.9.0/component/chips.css +176 -0
  132. package/dist/darkside/version/7.9.0/component/chips.min.css +1 -0
  133. package/dist/darkside/version/7.9.0/component/copybutton.css +176 -0
  134. package/dist/darkside/version/7.9.0/component/copybutton.min.css +1 -0
  135. package/dist/darkside/version/7.9.0/component/date.css +262 -0
  136. package/dist/darkside/version/7.9.0/component/date.min.css +1 -0
  137. package/dist/darkside/version/7.9.0/component/dropdown.css +92 -0
  138. package/dist/darkside/version/7.9.0/component/dropdown.min.css +1 -0
  139. package/dist/darkside/version/7.9.0/component/expansioncard.css +167 -0
  140. package/dist/darkside/version/7.9.0/component/expansioncard.min.css +1 -0
  141. package/dist/darkside/version/7.9.0/component/form.css +1862 -0
  142. package/dist/darkside/version/7.9.0/component/form.min.css +1 -0
  143. package/dist/darkside/version/7.9.0/component/guidepanel.css +113 -0
  144. package/dist/darkside/version/7.9.0/component/guidepanel.min.css +1 -0
  145. package/dist/darkside/version/7.9.0/component/helptext.css +53 -0
  146. package/dist/darkside/version/7.9.0/component/helptext.min.css +1 -0
  147. package/dist/darkside/version/7.9.0/component/internalheader.css +100 -0
  148. package/dist/darkside/version/7.9.0/component/internalheader.min.css +1 -0
  149. package/dist/darkside/version/7.9.0/component/link.css +60 -0
  150. package/dist/darkside/version/7.9.0/component/link.min.css +1 -0
  151. package/dist/darkside/version/7.9.0/component/linkpanel.css +48 -0
  152. package/dist/darkside/version/7.9.0/component/linkpanel.min.css +1 -0
  153. package/dist/darkside/version/7.9.0/component/list.css +88 -0
  154. package/dist/darkside/version/7.9.0/component/list.min.css +1 -0
  155. package/dist/darkside/version/7.9.0/component/loader.css +119 -0
  156. package/dist/darkside/version/7.9.0/component/loader.min.css +1 -0
  157. package/dist/darkside/version/7.9.0/component/modal.css +175 -0
  158. package/dist/darkside/version/7.9.0/component/modal.min.css +1 -0
  159. package/dist/darkside/version/7.9.0/component/pagination.css +43 -0
  160. package/dist/darkside/version/7.9.0/component/pagination.min.css +1 -0
  161. package/dist/darkside/version/7.9.0/component/panel.css +12 -0
  162. package/dist/darkside/version/7.9.0/component/panel.min.css +1 -0
  163. package/dist/darkside/version/7.9.0/component/popover.css +18 -0
  164. package/dist/darkside/version/7.9.0/component/popover.min.css +1 -0
  165. package/dist/darkside/version/7.9.0/component/primitives.css +1291 -0
  166. package/dist/darkside/version/7.9.0/component/primitives.min.css +1 -0
  167. package/dist/darkside/version/7.9.0/component/progressbar.css +106 -0
  168. package/dist/darkside/version/7.9.0/component/progressbar.min.css +1 -0
  169. package/dist/darkside/version/7.9.0/component/readmore.css +95 -0
  170. package/dist/darkside/version/7.9.0/component/readmore.min.css +1 -0
  171. package/dist/darkside/version/7.9.0/component/skeleton.css +66 -0
  172. package/dist/darkside/version/7.9.0/component/skeleton.min.css +1 -0
  173. package/dist/darkside/version/7.9.0/component/stepper.css +234 -0
  174. package/dist/darkside/version/7.9.0/component/stepper.min.css +1 -0
  175. package/dist/darkside/version/7.9.0/component/table.css +225 -0
  176. package/dist/darkside/version/7.9.0/component/table.min.css +1 -0
  177. package/dist/darkside/version/7.9.0/component/tabs.css +138 -0
  178. package/dist/darkside/version/7.9.0/component/tabs.min.css +1 -0
  179. package/dist/darkside/version/7.9.0/component/tag.css +128 -0
  180. package/dist/darkside/version/7.9.0/component/tag.min.css +1 -0
  181. package/dist/darkside/version/7.9.0/component/theme.css +17 -0
  182. package/dist/darkside/version/7.9.0/component/theme.min.css +1 -0
  183. package/dist/darkside/version/7.9.0/component/timeline.css +338 -0
  184. package/dist/darkside/version/7.9.0/component/timeline.min.css +1 -0
  185. package/dist/darkside/version/7.9.0/component/togglegroup.css +116 -0
  186. package/dist/darkside/version/7.9.0/component/togglegroup.min.css +1 -0
  187. package/dist/darkside/version/7.9.0/component/tooltip.css +108 -0
  188. package/dist/darkside/version/7.9.0/component/tooltip.min.css +1 -0
  189. package/dist/darkside/version/7.9.0/component/typography.css +254 -0
  190. package/dist/darkside/version/7.9.0/component/typography.min.css +1 -0
  191. package/dist/darkside/version/7.9.0/components.css +7493 -0
  192. package/dist/darkside/version/7.9.0/components.min.css +1 -0
  193. package/dist/darkside/version/7.9.0/global/baseline.css +47 -0
  194. package/dist/darkside/version/7.9.0/global/baseline.min.css +1 -0
  195. package/dist/darkside/version/7.9.0/global/fonts.css +109 -0
  196. package/dist/darkside/version/7.9.0/global/fonts.min.css +1 -0
  197. package/dist/darkside/version/7.9.0/global/print.css +52 -0
  198. package/dist/darkside/version/7.9.0/global/print.min.css +1 -0
  199. package/dist/darkside/version/7.9.0/global/reset.css +93 -0
  200. package/dist/darkside/version/7.9.0/global/reset.min.css +1 -0
  201. package/dist/darkside/version/7.9.0/global/tokens.css +896 -0
  202. package/dist/darkside/version/7.9.0/global/tokens.min.css +1 -0
  203. package/dist/darkside/version/7.9.0/index.css +8693 -0
  204. package/dist/darkside/version/7.9.0/index.min.css +1 -0
  205. package/dist/global/tokens.css +1 -1
  206. package/dist/global/tokens.min.css +1 -1
  207. package/dist/index.css +74 -49
  208. package/dist/index.min.css +4 -4
  209. package/form/form.css +0 -13
  210. package/form/select.css +5 -1
  211. package/form/switch.css +30 -19
  212. package/form/textarea.css +3 -6
  213. package/link.css +1 -1
  214. package/package.json +23 -9
  215. package/table.css +1 -1
  216. package/tag.css +12 -6
  217. package/tokens.json +3 -3
  218. package/typography.css +12 -0
  219. package/darkside/index copy.css +0 -37
  220. package/dist/component/index.css +0 -10103
  221. package/dist/component/index.min.css +0 -9
  222. /package/darkside/{baseline/theme.darkside.css → theme.darkside.css} +0 -0
package/CHANGELOG.md CHANGED
@@ -1,5 +1,28 @@
1
1
  # @navikt/ds-css
2
2
 
3
+ ## 7.9.0
4
+
5
+ ### Minor Changes
6
+
7
+ - ErrorSummary: :sparkles: new prop to prefix error with a warning icon. ([#3445](https://github.com/navikt/aksel/pull/3445))
8
+ All form components: replace dot with warning icon in error message.
9
+
10
+ ### Patch Changes
11
+
12
+ - Switch: Update switch to better reflect unchecked state. ([#3468](https://github.com/navikt/aksel/pull/3468))
13
+
14
+ - Select: :bug: Focus-border no longer cancels out error-border. ([#3465](https://github.com/navikt/aksel/pull/3465))
15
+
16
+ - Textarea: :bug: Focus-border no longer cancels out error-border. ([#3465](https://github.com/navikt/aksel/pull/3465))
17
+
18
+ ## 7.8.1
19
+
20
+ ### Patch Changes
21
+
22
+ - Alert: Link-components used within Alert variant='inline' now preserves default coloring ([#3461](https://github.com/navikt/aksel/pull/3461))
23
+
24
+ - Table: :fire: Removed cursor 'pointer' when 'ExpandableRow' is disabled. ([#3462](https://github.com/navikt/aksel/pull/3462))
25
+
3
26
  ## 7.8.0
4
27
 
5
28
  ### Minor Changes
package/button.css CHANGED
@@ -109,7 +109,7 @@
109
109
  margin-right: var(--ac-button-icon-margin);
110
110
  }
111
111
 
112
- .navds-button__icon:only-child {
112
+ .navds-button--icon-only .navds-button__icon {
113
113
  margin: 0;
114
114
  }
115
115
 
@@ -497,6 +497,10 @@
497
497
  }
498
498
 
499
499
  /* Loader overrides */
500
+ .navds-button .navds-loader {
501
+ position: absolute;
502
+ }
503
+
500
504
  .navds-button .navds-loader .navds-loader__foreground {
501
505
  stroke: var(--ac-button-loader-stroke, currentColor);
502
506
  }
@@ -506,6 +510,10 @@
506
510
  stroke: var(--ac-button-primary-loader-stroke-bg, rgb(255 255 255 / 0.3));
507
511
  }
508
512
 
513
+ .navds-button--loading > :not(.navds-loader) {
514
+ visibility: hidden;
515
+ }
516
+
509
517
  @media (forced-colors: active) {
510
518
  .navds-button:not(.navds-button--loading):where(:disabled, .navds-button--disabled) {
511
519
  opacity: 1;
@@ -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";
@@ -69,7 +69,7 @@
69
69
  margin-right: var(--__axc-button-icon-margin);
70
70
  }
71
71
 
72
- &:only-child {
72
+ .navds-button--icon-only & {
73
73
  margin: 0;
74
74
  }
75
75
  }
@@ -260,10 +260,14 @@
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 */
267
+ .navds-button .navds-loader {
268
+ position: absolute;
269
+ }
270
+
267
271
  .navds-button .navds-loader .navds-loader__foreground {
268
272
  stroke: currentColor;
269
273
  }
@@ -273,6 +277,10 @@
273
277
  stroke: rgb(255 255 255 / 0.3);
274
278
  }
275
279
 
280
+ .navds-button--loading > :not(.navds-loader) {
281
+ visibility: hidden;
282
+ }
283
+
276
284
  @media (forced-colors: active) {
277
285
  .navds-button:not(.navds-button--loading):where(:disabled, .navds-button--disabled) {
278
286
  opacity: 1;
@@ -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) {
@@ -9,21 +9,8 @@
9
9
  color: var(--ax-text-subtle);
10
10
  }
11
11
 
12
- .navds-form-field .navds-error-message,
13
- .navds-fieldset .navds-error-message,
14
- .navds-file-item .navds-error-message {
15
- display: flex;
16
- gap: var(--ax-spacing-2);
17
- }
18
-
19
- .navds-form-field .navds-error-message::before,
20
- .navds-fieldset .navds-error-message::before,
21
- .navds-file-item .navds-error-message::before {
22
- content: "•";
23
- }
24
-
25
12
  .navds-form-field--disabled {
26
- opacity: 0.3;
13
+ opacity: var(--ax-opacity-disabled);
27
14
  cursor: not-allowed;
28
15
  }
29
16
 
@@ -41,7 +28,7 @@
41
28
 
42
29
  .navds-form-field__readonly-icon {
43
30
  margin-top: var(--ax-spacing-05);
44
- margin-right: var(--ax-spacing-2);
31
+ margin-right: var(--ax-spacing-1);
45
32
  flex-shrink: 0;
46
33
  align-self: flex-start;
47
34
  }
@@ -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);