@altinn/altinn-components 0.52.4 → 0.52.6

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/README.md CHANGED
@@ -12,7 +12,7 @@ We already have the amazing [Norwegian public sector's Design System](https://de
12
12
 
13
13
  ## Strategy for Adopting Designsystemet
14
14
 
15
- As of April 10th, 2024, we’ve decided to start importing components from the [Norwegian public sector’s Design System](https://designsystemet.no/) as needed. These components will be exported from our own library using the `DS<Component>` prefix.
15
+ As of April 10th, 2025, we’ve decided to start importing components from the [Norwegian public sector’s Design System](https://designsystemet.no/) as needed. These components will be exported from our own library using the `DS<Component>` prefix.
16
16
  Consumers of `altinn-components` will be able to use these components directly, without needing `@digdir/designsystemet` as a dependency.
17
17
 
18
18
  This approach allows us to:
@@ -26,6 +26,37 @@ This approach allows us to:
26
26
  This strategy is a natural progression from our previous approach, where we did not use components from `@digdir/designsystemet` directly but relied on its token structure and explored opportunities for deeper integration.
27
27
  That approach helped us move faster and build understanding — and now we're ready to take the next step.
28
28
 
29
+ ## Design tokens and CSS build process
30
+
31
+ This package builds on the Norwegian public sector’s Design System by combining
32
+ upstream design tokens with Altinn-specific extensions and overrides.
33
+
34
+ To support this, we maintain a small internal build script that:
35
+
36
+ - Imports and syncs tokens from `@digdir/designsystemet`
37
+ - Applies Altinn brand specifics and overrides (from `./lib/css/tokens/altinn-design-tokens`)
38
+ - Builds the final CSS and tokens used by this library
39
+
40
+ ### How to use
41
+
42
+ 1. Go to https://theme.designsystemet.no/no/
43
+ 2. Select "Continue from config file".
44
+ 3. Paste the config from `./lib/css/tokens/designsystemet.config.json` and load theme.
45
+ 4. Do your magic
46
+ 5. Settings (cog) and "Ta i bruk tema", and replace updated content with `./lib/css/tokens/designsystemet.config.json`
47
+ 6. Run `pnpm build-tokens` - This will generate updated tokens and css in the `design-tokens-build` directory.
48
+
49
+ CSS is already loaded through `./lib/css/global.css`. You are good to go!
50
+
51
+ ### Directory structure
52
+
53
+ ```txt
54
+ lib/css/tokens/
55
+ base/ # Tokens originating from @digdir/designsystemet
56
+ extensions/ # Altinn-specific additions and overrides
57
+ build/ # Generated output (CSS + tokens)
58
+
59
+
29
60
  ## Feedback and questions
30
61
 
31
62
  Keep in mind that this package is a work in progress and will be updated continuously.
@@ -48,7 +79,7 @@ Tested with Node.js 20.x <
48
79
 
49
80
  ## Requirements
50
81
 
51
- `React` `>=18`in your project as a peer dependency. And `react-dom` if needed.
82
+ `React` `>=18`in your project as a peer dependency. And `react-dom` if needed. We do strongly recommend using `React` `>=19`.
52
83
 
53
84
  ## Usage
54
85
 
@@ -1 +1 @@
1
- ._label_e847b_1{font-weight:500;padding:0 .25em;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}._label_e847b_1[data-size=xs]{font-size:.875rem}._label_e847b_1[data-size=sm]{font-size:1rem}._label_e847b_1[data-size=md]{font-size:1.125rem}._label_e847b_1[data-size=lg]{font-size:1.25rem}
1
+ ._label_1pa3c_1{font-weight:500;padding:0 .25em;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;line-height:unset}._label_1pa3c_1[data-size=xs]{font-size:.875rem}._label_1pa3c_1[data-size=sm]{font-size:1rem}._label_1pa3c_1[data-size=md]{font-size:1.125rem}._label_1pa3c_1[data-size=lg]{font-size:1.25rem}
@@ -1,8 +1,8 @@
1
- import { jsx as s } from "react/jsx-runtime";
2
- import { c as t } from "../../index-p1eeF8LQ.js";
3
- import '../../assets/ButtonLabel.css';const o = "_label_e847b_1", r = {
1
+ import { jsx as t } from "react/jsx-runtime";
2
+ import { c as e } from "../../index-p1eeF8LQ.js";
3
+ import '../../assets/ButtonLabel.css';const o = "_label_1pa3c_1", c = {
4
4
  label: o
5
- }, n = ({ className: a, size: e, children: l }) => /* @__PURE__ */ s("span", { className: t(r.label, a), "data-size": e, children: l });
5
+ }, b = ({ className: a, size: l, children: s }) => /* @__PURE__ */ t("span", { className: e(c.label, a), "data-size": l, children: s });
6
6
  export {
7
- n as ButtonLabel
7
+ b as ButtonLabel
8
8
  };
@@ -1,11 +1,11 @@
1
- import { jsx as n, jsxs as m } from "react/jsx-runtime";
1
+ import { jsx as o, jsxs as m } from "react/jsx-runtime";
2
2
  import { c as p } from "../../index-p1eeF8LQ.js";
3
3
  import { Icon as _ } from "../Icon/Icon.js";
4
4
  import "react";
5
5
  import { IconButton as u } from "../Button/IconButton.js";
6
6
  import "../RootProvider/RootProvider.js";
7
- import { Input as f } from "./Input.js";
8
- import { FieldBase as d } from "./FieldBase.js";
7
+ import { Input as d } from "./Input.js";
8
+ import { FieldBase as f } from "./FieldBase.js";
9
9
  import "../Snackbar/useSnackbar.js";
10
10
  import { S as h } from "../../MagnifyingGlass-bwVhw07z.js";
11
11
  import { S as z } from "../../XMark-tKk6aExO.js";
@@ -18,16 +18,16 @@ import '../../assets/SearchField.css';const B = "_container_1lz5b_1", N = "_icon
18
18
  }, G = ({
19
19
  className: c,
20
20
  size: e,
21
- color: a = "neutral",
22
- label: i,
23
- value: o,
21
+ color: i = "neutral",
22
+ label: a,
23
+ value: n,
24
24
  onClear: r,
25
25
  clearButtonAltText: s = "Clear search",
26
26
  ...l
27
- }) => /* @__PURE__ */ n(d, { size: e, color: a, label: i, className: p(t.field, c), children: /* @__PURE__ */ m("span", { className: t.container, children: [
28
- /* @__PURE__ */ n(f, { ...l, type: "search", value: o, className: t.input }),
29
- /* @__PURE__ */ n(_, { svgElement: h, className: t.icon }),
30
- r && !!o && /* @__PURE__ */ n("span", { className: t.clear, children: /* @__PURE__ */ n(
27
+ }) => /* @__PURE__ */ o(f, { size: e, color: i, label: a, className: p(t.field, c), children: /* @__PURE__ */ m("div", { className: t.container, children: [
28
+ /* @__PURE__ */ o(d, { ...l, type: "search", value: n, className: t.input }),
29
+ /* @__PURE__ */ o(_, { svgElement: h, className: t.icon }),
30
+ r && !!n && /* @__PURE__ */ o("span", { className: t.clear, children: /* @__PURE__ */ o(
31
31
  u,
32
32
  {
33
33
  size: "custom",
package/dist/global.css CHANGED
@@ -1,7 +1,7 @@
1
1
  @import "@digdir/designsystemet-css/index.css";
2
2
  @import "@digdir/designsystemet-theme";
3
3
 
4
- @import "./tokens/design-tokens-build/theme.css";
4
+ @import "tokens/design-tokens-build/theme.css";
5
5
 
6
6
  @import "./data-theme.css";
7
7
  @import "./data-padding.css";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@altinn/altinn-components",
3
- "version": "0.52.4",
3
+ "version": "0.52.6",
4
4
  "main": "dist/index.js",
5
5
  "files": [
6
6
  "dist/",
@@ -38,6 +38,7 @@
38
38
  "@storybook/addon-vitest": "^10.1.11",
39
39
  "@storybook/react-vite": "10.1.11",
40
40
  "@testing-library/react": "^16.3.0",
41
+ "@types/node": "^25.0.7",
41
42
  "@types/react": "^19.1.5",
42
43
  "@types/react-dom": "^19.1.5",
43
44
  "@vitejs/plugin-react-swc": "^3.9.0",
@@ -53,6 +54,7 @@
53
54
  "storybook": "^10.1.11",
54
55
  "storybook-addon-tag-badges": "^3.0.4",
55
56
  "storybook-addon-theme-provider": "^0.2.10",
57
+ "tsx": "^4.21.0",
56
58
  "typescript": "^5.8.3",
57
59
  "vite": "7.3.1",
58
60
  "vite-plugin-dts": "^4.5.4",
@@ -85,6 +87,7 @@
85
87
  "test-storybook": "vitest --run --project=storybook",
86
88
  "test-storybook-watch": "vitest --project=storybook",
87
89
  "ci:test-storybook": "pnpm dlx concurrently -k -s first \"pnpm storybook\" \"pnpm dlx wait-on http://localhost:6006 && pnpm test-storybook\"",
88
- "install:browsers": "pnpm exec playwright install"
90
+ "install:browsers": "pnpm exec playwright install",
91
+ "build-tokens": "node --import tsx scripts/build-tokens.ts && pnpm biome check ./lib/css/tokens/design-tokens-build/. --write"
89
92
  }
90
93
  }