@klodd/ds 4.4.0 → 4.5.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.
@@ -438,3 +438,29 @@
438
438
  --surface-medium: color-mix(in oklch, white 8%, transparent);
439
439
  --surface-strong: color-mix(in oklch, white 12%, transparent);
440
440
  }
441
+
442
+
443
+ /* ================================================================
444
+ ==== BAR-FAMILJEN (v4.5.0, ADR 0021)
445
+ Shared tokens som alla bar-komponenter (progress, hbar, split-bar,
446
+ colored-bar, column-bar, dual-bar) lasr istallet for att duplicera
447
+ bg-/radius-/color-varden. Andra en token, andras overallt.
448
+
449
+ Komponenter som har medvetet annorlunda track-bg (column-bar,
450
+ dual-bar = sunken; progress = raised) override:ar --bar-track-color
451
+ pa block-roten. Steg 1 (no visual change). Steg 2 senare: harmonisera
452
+ till EN default om Calle vill.
453
+
454
+ Komponenter med specifika fill-tjocklekar (4/6/8/12px / vertical-flex)
455
+ behaller dessa lokalt - tjocklek ar designval per komponent-typ.
456
+ ================================================================ */
457
+ :root {
458
+ --bar-track-color: var(--surface-active);
459
+ --bar-track-radius: var(--radius-full);
460
+ --bar-fill-radius: var(--radius-full);
461
+ --bar-fill-color: var(--accent-9);
462
+ --bar-fill-color-positive: var(--positive);
463
+ --bar-fill-color-warning: var(--warning);
464
+ --bar-fill-color-negative: var(--negative);
465
+ --bar-fill-transition: width var(--dur-medium) var(--ease-spring-snappy);
466
+ }
@@ -20,9 +20,11 @@
20
20
  Se references/02-components.md "Kategori-monstret".
21
21
  ================================================================ */
22
22
  .colored-bar {
23
- background: var(--bar-accent, var(--accent-9));
23
+ /* v4.5.0 (ADR 0021): konsumerar shared --bar-fill-color istallet for
24
+ direkt --accent-9. --bar-accent-binding bevaras for app-domain-tokens. */
25
+ background: var(--bar-accent, var(--bar-fill-color));
24
26
  height: 100%;
25
- border-radius: var(--radius-full);
27
+ border-radius: var(--bar-fill-radius);
26
28
  transition: width var(--dur-base) var(--ease-out);
27
29
  }
28
30
 
@@ -46,10 +46,15 @@
46
46
  }
47
47
 
48
48
  .column-bar__track {
49
+ /* v4.5.0 (ADR 0021): per-komponent override av --bar-track-color
50
+ (sunken vs default-active) och --bar-track-radius (4px vs full) -
51
+ vertikal stapel skulle bli oval med radius-full. */
52
+ --bar-track-color: var(--surface-sunken);
53
+ --bar-track-radius: var(--radius-4);
49
54
  width: 100%;
50
55
  flex: 1;
51
- background: var(--surface-sunken);
52
- border-radius: var(--radius-4);
56
+ background: var(--bar-track-color);
57
+ border-radius: var(--bar-track-radius);
53
58
  overflow: hidden;
54
59
  display: flex;
55
60
  align-items: flex-end;
@@ -58,7 +63,7 @@
58
63
 
59
64
  .column-bar__fill {
60
65
  width: 100%;
61
- background: var(--positive);
66
+ background: var(--bar-fill-color-positive);
62
67
  border-radius: var(--radius-4);
63
68
  transition: var(--tr-height-slower);
64
69
  }
@@ -31,22 +31,25 @@
31
31
  }
32
32
 
33
33
  .dual-bar__track {
34
+ /* v4.5.0 (ADR 0021): per-komponent override av --bar-track-color
35
+ (sunken vs default-active). */
36
+ --bar-track-color: var(--surface-sunken);
34
37
  flex: 1;
35
38
  height: 12px;
36
- background: var(--surface-sunken);
37
- border-radius: var(--radius-full);
39
+ background: var(--bar-track-color);
40
+ border-radius: var(--bar-track-radius);
38
41
  overflow: hidden;
39
42
  }
40
43
 
41
44
  .dual-bar__fill {
42
45
  height: 100%;
43
- border-radius: var(--radius-full);
44
- background: var(--positive);
46
+ border-radius: var(--bar-fill-radius);
47
+ background: var(--bar-fill-color-positive);
45
48
  transition: var(--tr-width-slower);
46
49
  }
47
50
 
48
- .dual-bar__fill--amort { background: var(--positive); }
49
- .dual-bar__fill--apprec { background: var(--accent-9); }
51
+ .dual-bar__fill--amort { background: var(--bar-fill-color-positive); }
52
+ .dual-bar__fill--apprec { background: var(--bar-fill-color); }
50
53
 
51
54
  .dual-bar__meta {
52
55
  display: flex;
@@ -43,24 +43,26 @@
43
43
  .hbar__track {
44
44
  width: 100%;
45
45
  height: var(--space-6);
46
- background: var(--surface-active);
47
- border-radius: var(--radius-full);
46
+ background: var(--bar-track-color);
47
+ border-radius: var(--bar-track-radius);
48
48
  overflow: hidden;
49
49
  }
50
50
 
51
51
  .hbar__fill {
52
52
  height: 100%;
53
53
  /* v4.4.0 (ADR 0020): --bar-accent-binding for app-domain-kategorier.
54
- Default --accent-9 om bindning saknas. App-domain CSS satter
55
- --bar-accent via wrapper-klass: <div class="hbar__fill cat-mat">. */
56
- background: var(--bar-accent, var(--accent-9));
57
- border-radius: var(--radius-full);
58
- transition: width var(--dur-medium) var(--ease-spring-snappy);
54
+ Default --bar-fill-color (=--accent-9) om bindning saknas. App-domain
55
+ CSS satter --bar-accent via wrapper-klass: <div class="hbar__fill cat-mat">.
56
+ v4.5.0 (ADR 0021): konsumerar shared --bar-fill-color istallet for
57
+ direkt --accent-9. */
58
+ background: var(--bar-accent, var(--bar-fill-color));
59
+ border-radius: var(--bar-fill-radius);
60
+ transition: var(--bar-fill-transition);
59
61
  }
60
62
 
61
- .hbar__fill--positive { background: var(--positive); }
62
- .hbar__fill--warning { background: var(--warning); }
63
- .hbar__fill--negative { background: var(--negative); }
63
+ .hbar__fill--positive { background: var(--bar-fill-color-positive); }
64
+ .hbar__fill--warning { background: var(--bar-fill-color-warning); }
65
+ .hbar__fill--negative { background: var(--bar-fill-color-negative); }
64
66
 
65
67
  @media (prefers-reduced-motion: reduce) {
66
68
  .hbar__fill { transition: none; }
@@ -25,20 +25,26 @@
25
25
  Respekterar prefers-reduced-motion (transition tas bort).
26
26
  ================================================================ */
27
27
  .progress {
28
+ /* v4.5.0 (ADR 0021): per-komponent override av --bar-track-color
29
+ for att behalla raised-bg (var-skillnad mot active default). */
30
+ --bar-track-color: var(--surface-raised);
28
31
  width: 100%;
29
32
  height: var(--space-6);
30
- background: var(--surface-raised);
31
- border-radius: var(--radius-full);
33
+ background: var(--bar-track-color);
34
+ border-radius: var(--bar-track-radius);
32
35
  overflow: hidden;
33
36
  }
34
37
 
35
38
  .progress__bar {
36
39
  height: 100%;
37
- background: var(--accent-9);
38
- border-radius: var(--radius-full);
40
+ background: var(--bar-fill-color);
41
+ border-radius: var(--bar-fill-radius);
39
42
  transition: width var(--dur-base) var(--ease-out);
40
43
  }
41
44
 
45
+ /* Progress-specifika status-modifiers behaller --bg-X (solid status-bg-
46
+ tema istallet for --positive/--warning/--negative som ar text-color-
47
+ varianter). Medvetet annorlunda fran hbar/split-bar/dual-bar. */
42
48
  .progress__bar--success { background: var(--bg-success); }
43
49
  .progress__bar--warning { background: var(--bg-warning); }
44
50
  .progress__bar--danger { background: var(--bg-danger); }
@@ -10,22 +10,24 @@
10
10
  .split-bar {
11
11
  display: flex;
12
12
  height: 8px;
13
- border-radius: var(--radius-full);
13
+ border-radius: var(--bar-track-radius);
14
14
  overflow: hidden;
15
- background: var(--surface-active);
15
+ background: var(--bar-track-color);
16
16
  margin: var(--space-8) 0 var(--space-12);
17
17
  }
18
18
 
19
19
  .split-bar__segment {
20
20
  height: 100%;
21
- transition: width var(--dur-medium) var(--ease-spring-snappy);
21
+ transition: var(--bar-fill-transition);
22
22
  }
23
23
 
24
- .split-bar__segment--primary { background: var(--accent-9); }
24
+ /* v4.5.0 (ADR 0021): segments konsumerar shared --bar-fill-color-X.
25
+ --secondary anvander --text-disabled (gray-out-look, inte stadard-color). */
26
+ .split-bar__segment--primary { background: var(--bar-fill-color); }
25
27
  .split-bar__segment--secondary { background: var(--text-disabled); flex: 1; }
26
- .split-bar__segment--positive { background: var(--positive); }
27
- .split-bar__segment--negative { background: var(--negative); }
28
- .split-bar__segment--warning { background: var(--warning); }
28
+ .split-bar__segment--positive { background: var(--bar-fill-color-positive); }
29
+ .split-bar__segment--negative { background: var(--bar-fill-color-negative); }
30
+ .split-bar__segment--warning { background: var(--bar-fill-color-warning); }
29
31
 
30
32
  .split-bar__label {
31
33
  font-size: var(--fs-13);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@klodd/ds",
3
- "version": "4.4.0",
3
+ "version": "4.5.0",
4
4
  "description": "Klodd shared design system - tokens, components, JS",
5
5
  "main": "css/index.css",
6
6
  "bin": {
@@ -0,0 +1,133 @@
1
+ # 0021 - Bar-familjen: gemensamma tokens (Steg 1)
2
+
3
+ ## Status
4
+ Locked. Minor version-bump (4.5.0) - additive, no visual change.
5
+
6
+ ## Context
7
+
8
+ Audit 2026-05-14 (sen kvall, fas 3) raknade 6 bar-komponenter i
9
+ paketet (progress, colored-bar, hbar, split-bar, column-bar,
10
+ dual-bar) plus 2 Ekonom-domain-wrappers. Calle's observation:
11
+ "manga bars - finns det dubbletter?".
12
+
13
+ Konkreta dubletter i nuvarande bar-CSS:
14
+
15
+ **Track-bg-varierar:**
16
+ | Komponent | Track-bg |
17
+ |---|---|
18
+ | progress | `--surface-raised` |
19
+ | hbar | `--surface-active` |
20
+ | split-bar | `--surface-active` |
21
+ | column-bar | `--surface-sunken` |
22
+ | dual-bar | `--surface-sunken` |
23
+
24
+ Tre olika value:r utan dokumenterad rationale. Inkonsekvens.
25
+
26
+ **Fill-color-default varierar:**
27
+ | Komponent | Fill-default |
28
+ |---|---|
29
+ | progress | `--accent-9` |
30
+ | hbar | `--bar-accent || --accent-9` |
31
+ | colored-bar | `--bar-accent || --accent-9` |
32
+ | split-bar (primary) | `--accent-9` |
33
+ | column-bar | `--positive` |
34
+ | dual-bar | `--positive` |
35
+
36
+ **Status-modifier-color varierar:**
37
+ | Komponent | Positive | Warning | Negative |
38
+ |---|---|---|---|
39
+ | progress | `--bg-success` | `--bg-warning` | `--bg-danger` |
40
+ | hbar | `--positive` | `--warning` | `--negative` |
41
+ | split-bar | `--positive` | `--warning` | `--negative` |
42
+
43
+ Tva olika status-tema (solid bg-X vs text-color-X) utan klar rationale.
44
+
45
+ Per Calle 2026-05-14 (sen kvall): "Jag hade kunnat se att man har
46
+ en stor bar-samling, dar storlek, farg etc bestams med olika tokens."
47
+
48
+ Calles intuition stamde - shared tokens ar standard i moderna design-
49
+ system. Men full one-class-many-modifiers-konsolidering ar breaking
50
+ MAJOR-bump. Steg 1 levererar SHARED TOKENS utan att andra struktur
51
+ eller visual.
52
+
53
+ ## Decision
54
+
55
+ **Steg 1 (denna ADR, v4.5.0):** Lyfta 8 shared tokens till
56
+ `:root` i `10-semantic.css`. Refaktorera alla 6 bar-komponenter att
57
+ lasa dem. Komponenter med medvetet annorlunda varden override:ar
58
+ pa block-roten (`--bar-track-color: var(--surface-sunken)` etc).
59
+
60
+ ```css
61
+ :root {
62
+ --bar-track-color: var(--surface-active);
63
+ --bar-track-radius: var(--radius-full);
64
+ --bar-fill-radius: var(--radius-full);
65
+ --bar-fill-color: var(--accent-9);
66
+ --bar-fill-color-positive: var(--positive);
67
+ --bar-fill-color-warning: var(--warning);
68
+ --bar-fill-color-negative: var(--negative);
69
+ --bar-fill-transition: width var(--dur-medium) var(--ease-spring-snappy);
70
+ }
71
+ ```
72
+
73
+ ### Per-komponent-changes
74
+
75
+ | Komponent | Track-color | Fill-default | Status-modifier |
76
+ |---|---|---|---|
77
+ | progress | OVERRIDE: `--bar-track-color: var(--surface-raised)` | `--bar-fill-color` | Behaller `--bg-success/-warning/-danger` (solid status-bg-tema, medvetet annorlunda fran text-color-tema) |
78
+ | hbar | DEFAULT (active) | `--bar-fill-color` med `--bar-accent`-binding | `--bar-fill-color-positive/-warning/-negative` |
79
+ | split-bar | DEFAULT (active) | `--bar-fill-color` (primary) | `--bar-fill-color-positive/-negative/-warning` |
80
+ | colored-bar | n/a (no track) | `--bar-fill-color` med `--bar-accent`-binding | n/a |
81
+ | column-bar | OVERRIDE: `--bar-track-color: var(--surface-sunken)` + `--bar-track-radius: var(--radius-4)` | `--bar-fill-color-positive` | n/a |
82
+ | dual-bar | OVERRIDE: `--bar-track-color: var(--surface-sunken)` | `--bar-fill-color-positive` (default + --amort), `--bar-fill-color` (--apprec) | n/a |
83
+
84
+ ### Future steps (NOT in scope for v4.5.0)
85
+
86
+ **Steg 2:** Konsolidera till 1 `.bar`-namespace med modifiers
87
+ `--vertical/-multi-segment/-with-meta/-with-label`. Breaking MAJOR-bump.
88
+ Konsumeras vid framtida sprint nar Calle vill exekvera.
89
+
90
+ **Steg 3:** Eliminera duplikat-komponenter (colored-bar = hbar__fill
91
+ standalone). Mindre breaking. Optional cleanup.
92
+
93
+ ## Konsekvenser
94
+
95
+ **Bra:**
96
+ - Endpoint-shape uppfyller Calle's intuition - tokens styr utseende.
97
+ - Konsekvens via en token-andring framover (andra
98
+ --bar-fill-color-positive pa root - andras pa hbar/split-bar/
99
+ column-bar/dual-bar samtidigt).
100
+ - Inga visuella andringar (komponenter override:ar default per behov).
101
+ - Backwards-compat - app-domain CSS som anvander direkta tokens
102
+ (Ekonoms `--bar-accent`-bindings) fortsatter funka.
103
+ - Future Steg 2/3 kan byggas pa shared-token-foundation.
104
+
105
+ **Trade-offs:**
106
+ - 6 komponenter har fortfarande egen file/namespace - inte unifierat.
107
+ - Per-komponent-override (--bar-track-color: var(--surface-X)) tilltager
108
+ CSS-storlek marginellt jamfort med hardkodad value.
109
+ - Override-pattern kraver discipline - om someone andra `.column-bar`
110
+ utan att inse override:n kan bryta sunken-bg.
111
+
112
+ ## Migration
113
+
114
+ **Klodd-ds v4.4.0 -> v4.5.0:** additive token-tillagg + per-komponent-
115
+ refaktor. Inga template-andringar i appar. Inga visual changes.
116
+
117
+ **Apparna:** bumpa till 4.5.0, build:ds, verify - ingen template-
118
+ migration.
119
+
120
+ ## Verifiering
121
+
122
+ - 0 visual changes per Calle's krav (Steg 1 = "no visual change").
123
+ - Stylelint-plugin: 0 errors (alla tokens lagliga).
124
+ - Manuell visual QA pa /design (alla 6 bar-sektioner ser identiska
125
+ ut pre/post-bump).
126
+
127
+ ## References
128
+
129
+ - ADR 0020 (domain-to-package-lift) - inforde --bar-accent-binding
130
+ - DESIGN-LANGUAGE.md sektion 4 (padding-rytm) - liknande shared-token-
131
+ approach for spacing
132
+ - Calle's beslut 2026-05-14 (sen kvall): "Det later bra" pa Steg 1-
133
+ forslag