@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.
- package/CHANGELOG.md +23 -0
- package/button.css +9 -1
- package/config/bundle.darkside.ts +270 -0
- package/config/tests/bundle.test.ts +46 -0
- package/darkside/baseline/{utilities.darkside.css → baseline.darkside.css} +9 -0
- package/darkside/baseline/tokens.darkside.css +1 -0
- package/darkside/button.darkside.css +10 -2
- package/darkside/copybutton.darkside.css +1 -1
- package/darkside/dropdown.darkside.css +1 -1
- package/darkside/form/combobox.darkside.css +1 -1
- package/darkside/form/fieldset.darkside.css +1 -1
- package/darkside/form/form.darkside.css +2 -15
- package/darkside/form/radio-checkbox.darkside.css +1 -1
- package/darkside/form/search.darkside.css +2 -2
- package/darkside/form/switch.darkside.css +1 -1
- package/darkside/index.css +9 -11
- package/darkside/link.darkside.css +2 -2
- package/darkside/tag.darkside.css +85 -147
- package/darkside/timeline.darkside.css +118 -211
- package/darkside/toggle-group.darkside.css +19 -9
- package/darkside/tooltip.darkside.css +82 -57
- package/darkside/typography.darkside.css +12 -12
- package/dist/component/button.css +9 -1
- package/dist/component/button.min.css +2 -2
- package/dist/component/form.css +37 -37
- package/dist/component/form.min.css +1 -1
- package/dist/component/link.css +1 -1
- package/dist/component/link.min.css +1 -1
- package/dist/component/table.css +1 -1
- package/dist/component/table.min.css +1 -1
- package/dist/component/tag.css +12 -6
- package/dist/component/tag.min.css +1 -1
- package/dist/component/typography.css +12 -0
- package/dist/component/typography.min.css +1 -1
- package/dist/components.css +73 -48
- package/dist/components.min.css +3 -3
- package/dist/darkside/component/accordion.css +174 -0
- package/dist/darkside/component/accordion.min.css +1 -0
- package/dist/darkside/component/actionmenu.css +182 -0
- package/dist/darkside/component/actionmenu.min.css +1 -0
- package/dist/darkside/component/alert.css +105 -0
- package/dist/darkside/component/alert.min.css +1 -0
- package/dist/darkside/component/button.css +279 -0
- package/dist/darkside/component/button.min.css +1 -0
- package/dist/darkside/component/chat.css +103 -0
- package/dist/darkside/component/chat.min.css +1 -0
- package/dist/darkside/component/chips.css +176 -0
- package/dist/darkside/component/chips.min.css +1 -0
- package/dist/darkside/component/copybutton.css +176 -0
- package/dist/darkside/component/copybutton.min.css +1 -0
- package/dist/darkside/component/date.css +262 -0
- package/dist/darkside/component/date.min.css +1 -0
- package/dist/darkside/component/dropdown.css +92 -0
- package/dist/darkside/component/dropdown.min.css +1 -0
- package/dist/darkside/component/expansioncard.css +167 -0
- package/dist/darkside/component/expansioncard.min.css +1 -0
- package/dist/darkside/component/form.css +1862 -0
- package/dist/darkside/component/form.min.css +1 -0
- package/dist/darkside/component/guidepanel.css +113 -0
- package/dist/darkside/component/guidepanel.min.css +1 -0
- package/dist/darkside/component/helptext.css +53 -0
- package/dist/darkside/component/helptext.min.css +1 -0
- package/dist/darkside/component/internalheader.css +100 -0
- package/dist/darkside/component/internalheader.min.css +1 -0
- package/dist/darkside/component/link.css +60 -0
- package/dist/darkside/component/link.min.css +1 -0
- package/dist/darkside/component/linkpanel.css +48 -0
- package/dist/darkside/component/linkpanel.min.css +1 -0
- package/dist/darkside/component/list.css +88 -0
- package/dist/darkside/component/list.min.css +1 -0
- package/dist/darkside/component/loader.css +119 -0
- package/dist/darkside/component/loader.min.css +1 -0
- package/dist/darkside/component/modal.css +175 -0
- package/dist/darkside/component/modal.min.css +1 -0
- package/dist/darkside/component/pagination.css +43 -0
- package/dist/darkside/component/pagination.min.css +1 -0
- package/dist/darkside/component/panel.css +12 -0
- package/dist/darkside/component/panel.min.css +1 -0
- package/dist/darkside/component/popover.css +18 -0
- package/dist/darkside/component/popover.min.css +1 -0
- package/dist/darkside/component/primitives.css +1291 -0
- package/dist/darkside/component/primitives.min.css +1 -0
- package/dist/darkside/component/progressbar.css +106 -0
- package/dist/darkside/component/progressbar.min.css +1 -0
- package/dist/darkside/component/readmore.css +95 -0
- package/dist/darkside/component/readmore.min.css +1 -0
- package/dist/darkside/component/skeleton.css +66 -0
- package/dist/darkside/component/skeleton.min.css +1 -0
- package/dist/darkside/component/stepper.css +234 -0
- package/dist/darkside/component/stepper.min.css +1 -0
- package/dist/darkside/component/table.css +225 -0
- package/dist/darkside/component/table.min.css +1 -0
- package/dist/darkside/component/tabs.css +138 -0
- package/dist/darkside/component/tabs.min.css +1 -0
- package/dist/darkside/component/tag.css +128 -0
- package/dist/darkside/component/tag.min.css +1 -0
- package/dist/darkside/component/theme.css +17 -0
- package/dist/darkside/component/theme.min.css +1 -0
- package/dist/darkside/component/timeline.css +338 -0
- package/dist/darkside/component/timeline.min.css +1 -0
- package/dist/darkside/component/togglegroup.css +116 -0
- package/dist/darkside/component/togglegroup.min.css +1 -0
- package/dist/darkside/component/tooltip.css +108 -0
- package/dist/darkside/component/tooltip.min.css +1 -0
- package/dist/darkside/component/typography.css +254 -0
- package/dist/darkside/component/typography.min.css +1 -0
- package/dist/darkside/components.css +7493 -0
- package/dist/darkside/components.min.css +1 -0
- package/dist/darkside/global/baseline.css +47 -0
- package/dist/darkside/global/baseline.min.css +1 -0
- package/dist/darkside/global/fonts.css +109 -0
- package/dist/darkside/global/fonts.min.css +1 -0
- package/dist/darkside/global/print.css +52 -0
- package/dist/darkside/global/print.min.css +1 -0
- package/dist/darkside/global/reset.css +93 -0
- package/dist/darkside/global/reset.min.css +1 -0
- package/dist/darkside/global/tokens.css +896 -0
- package/dist/darkside/global/tokens.min.css +1 -0
- package/dist/darkside/index.css +8693 -0
- package/dist/darkside/index.min.css +1 -0
- package/dist/darkside/version/7.9.0/component/accordion.css +174 -0
- package/dist/darkside/version/7.9.0/component/accordion.min.css +1 -0
- package/dist/darkside/version/7.9.0/component/actionmenu.css +182 -0
- package/dist/darkside/version/7.9.0/component/actionmenu.min.css +1 -0
- package/dist/darkside/version/7.9.0/component/alert.css +105 -0
- package/dist/darkside/version/7.9.0/component/alert.min.css +1 -0
- package/dist/darkside/version/7.9.0/component/button.css +279 -0
- package/dist/darkside/version/7.9.0/component/button.min.css +1 -0
- package/dist/darkside/version/7.9.0/component/chat.css +103 -0
- package/dist/darkside/version/7.9.0/component/chat.min.css +1 -0
- package/dist/darkside/version/7.9.0/component/chips.css +176 -0
- package/dist/darkside/version/7.9.0/component/chips.min.css +1 -0
- package/dist/darkside/version/7.9.0/component/copybutton.css +176 -0
- package/dist/darkside/version/7.9.0/component/copybutton.min.css +1 -0
- package/dist/darkside/version/7.9.0/component/date.css +262 -0
- package/dist/darkside/version/7.9.0/component/date.min.css +1 -0
- package/dist/darkside/version/7.9.0/component/dropdown.css +92 -0
- package/dist/darkside/version/7.9.0/component/dropdown.min.css +1 -0
- package/dist/darkside/version/7.9.0/component/expansioncard.css +167 -0
- package/dist/darkside/version/7.9.0/component/expansioncard.min.css +1 -0
- package/dist/darkside/version/7.9.0/component/form.css +1862 -0
- package/dist/darkside/version/7.9.0/component/form.min.css +1 -0
- package/dist/darkside/version/7.9.0/component/guidepanel.css +113 -0
- package/dist/darkside/version/7.9.0/component/guidepanel.min.css +1 -0
- package/dist/darkside/version/7.9.0/component/helptext.css +53 -0
- package/dist/darkside/version/7.9.0/component/helptext.min.css +1 -0
- package/dist/darkside/version/7.9.0/component/internalheader.css +100 -0
- package/dist/darkside/version/7.9.0/component/internalheader.min.css +1 -0
- package/dist/darkside/version/7.9.0/component/link.css +60 -0
- package/dist/darkside/version/7.9.0/component/link.min.css +1 -0
- package/dist/darkside/version/7.9.0/component/linkpanel.css +48 -0
- package/dist/darkside/version/7.9.0/component/linkpanel.min.css +1 -0
- package/dist/darkside/version/7.9.0/component/list.css +88 -0
- package/dist/darkside/version/7.9.0/component/list.min.css +1 -0
- package/dist/darkside/version/7.9.0/component/loader.css +119 -0
- package/dist/darkside/version/7.9.0/component/loader.min.css +1 -0
- package/dist/darkside/version/7.9.0/component/modal.css +175 -0
- package/dist/darkside/version/7.9.0/component/modal.min.css +1 -0
- package/dist/darkside/version/7.9.0/component/pagination.css +43 -0
- package/dist/darkside/version/7.9.0/component/pagination.min.css +1 -0
- package/dist/darkside/version/7.9.0/component/panel.css +12 -0
- package/dist/darkside/version/7.9.0/component/panel.min.css +1 -0
- package/dist/darkside/version/7.9.0/component/popover.css +18 -0
- package/dist/darkside/version/7.9.0/component/popover.min.css +1 -0
- package/dist/darkside/version/7.9.0/component/primitives.css +1291 -0
- package/dist/darkside/version/7.9.0/component/primitives.min.css +1 -0
- package/dist/darkside/version/7.9.0/component/progressbar.css +106 -0
- package/dist/darkside/version/7.9.0/component/progressbar.min.css +1 -0
- package/dist/darkside/version/7.9.0/component/readmore.css +95 -0
- package/dist/darkside/version/7.9.0/component/readmore.min.css +1 -0
- package/dist/darkside/version/7.9.0/component/skeleton.css +66 -0
- package/dist/darkside/version/7.9.0/component/skeleton.min.css +1 -0
- package/dist/darkside/version/7.9.0/component/stepper.css +234 -0
- package/dist/darkside/version/7.9.0/component/stepper.min.css +1 -0
- package/dist/darkside/version/7.9.0/component/table.css +225 -0
- package/dist/darkside/version/7.9.0/component/table.min.css +1 -0
- package/dist/darkside/version/7.9.0/component/tabs.css +138 -0
- package/dist/darkside/version/7.9.0/component/tabs.min.css +1 -0
- package/dist/darkside/version/7.9.0/component/tag.css +128 -0
- package/dist/darkside/version/7.9.0/component/tag.min.css +1 -0
- package/dist/darkside/version/7.9.0/component/theme.css +17 -0
- package/dist/darkside/version/7.9.0/component/theme.min.css +1 -0
- package/dist/darkside/version/7.9.0/component/timeline.css +338 -0
- package/dist/darkside/version/7.9.0/component/timeline.min.css +1 -0
- package/dist/darkside/version/7.9.0/component/togglegroup.css +116 -0
- package/dist/darkside/version/7.9.0/component/togglegroup.min.css +1 -0
- package/dist/darkside/version/7.9.0/component/tooltip.css +108 -0
- package/dist/darkside/version/7.9.0/component/tooltip.min.css +1 -0
- package/dist/darkside/version/7.9.0/component/typography.css +254 -0
- package/dist/darkside/version/7.9.0/component/typography.min.css +1 -0
- package/dist/darkside/version/7.9.0/components.css +7493 -0
- package/dist/darkside/version/7.9.0/components.min.css +1 -0
- package/dist/darkside/version/7.9.0/global/baseline.css +47 -0
- package/dist/darkside/version/7.9.0/global/baseline.min.css +1 -0
- package/dist/darkside/version/7.9.0/global/fonts.css +109 -0
- package/dist/darkside/version/7.9.0/global/fonts.min.css +1 -0
- package/dist/darkside/version/7.9.0/global/print.css +52 -0
- package/dist/darkside/version/7.9.0/global/print.min.css +1 -0
- package/dist/darkside/version/7.9.0/global/reset.css +93 -0
- package/dist/darkside/version/7.9.0/global/reset.min.css +1 -0
- package/dist/darkside/version/7.9.0/global/tokens.css +896 -0
- package/dist/darkside/version/7.9.0/global/tokens.min.css +1 -0
- package/dist/darkside/version/7.9.0/index.css +8693 -0
- package/dist/darkside/version/7.9.0/index.min.css +1 -0
- package/dist/global/tokens.css +1 -1
- package/dist/global/tokens.min.css +1 -1
- package/dist/index.css +74 -49
- package/dist/index.min.css +4 -4
- package/form/form.css +0 -13
- package/form/select.css +5 -1
- package/form/switch.css +30 -19
- package/form/textarea.css +3 -6
- package/link.css +1 -1
- package/package.json +23 -9
- package/table.css +1 -1
- package/tag.css +12 -6
- package/tokens.json +3 -3
- package/typography.css +12 -0
- package/darkside/index copy.css +0 -37
- package/dist/component/index.css +0 -10103
- package/dist/component/index.min.css +0 -9
- /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-
|
|
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
|
-
|
|
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:
|
|
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;
|
|
@@ -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:
|
|
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-
|
|
31
|
+
margin-right: var(--ax-spacing-1);
|
|
45
32
|
flex-shrink: 0;
|
|
46
33
|
align-self: flex-start;
|
|
47
34
|
}
|
|
@@ -81,7 +81,7 @@
|
|
|
81
81
|
font-size: 1.5rem;
|
|
82
82
|
|
|
83
83
|
.navds-search--disabled & {
|
|
84
|
-
opacity:
|
|
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:
|
|
151
|
+
opacity: var(--ax-opacity-disabled);
|
|
152
152
|
cursor: not-allowed;
|
|
153
153
|
}
|
|
154
154
|
}
|
package/darkside/index.css
CHANGED
|
@@ -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.
|
|
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 "./
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
@import "
|
|
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-
|
|
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);
|