@pokela/components 1.2.0 → 2.1.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/Accordion.js CHANGED
@@ -4,7 +4,7 @@ import { useId, useState } from 'react';
4
4
  import Icon from './Icon';
5
5
  export function Accordion({ number, title, description, meta, children, open, onToggle, labels, }) {
6
6
  const id = useId();
7
- return (_jsxs("div", { className: "accordion", children: [_jsxs("button", { type: "button", className: "list-row list-row--numbered list-row--expandable bleed", "aria-expanded": open, "aria-controls": id, onClick: onToggle, children: [_jsx("span", { className: "meta list-row__number", children: number }), _jsxs("span", { className: "list-row__main", children: [_jsx("span", { className: "list-row__title", children: title }), _jsx("span", { className: "list-row__description", children: description })] }), _jsx("span", { className: "meta list-row__meta", children: meta }), _jsx(Icon, { name: open ? 'minus' : 'plus', size: "l", className: "list-row__icon" }), _jsx("span", { className: "visually-hidden", children: open ? labels.close : labels.open })] }), open ? (_jsx("div", { id: id, className: "accordion__panel page", role: "region", "aria-label": title, children: children })) : null] }));
7
+ return (_jsxs("div", { className: "accordion", children: [_jsxs("button", { type: "button", className: "list-row list-row--numbered list-row--expandable bleed", "aria-expanded": open, "aria-controls": id, onClick: onToggle, children: [_jsx("span", { className: "meta list-row__number", children: number }), _jsxs("span", { className: "list-row__main", children: [_jsx("span", { className: "display-s list-row__title", children: title }), _jsx("span", { className: "body-s muted list-row__description", children: description })] }), _jsx("span", { className: "meta list-row__meta", children: meta }), _jsx(Icon, { name: open ? 'minus' : 'plus', size: "l", className: "list-row__icon" }), _jsx("span", { className: "visually-hidden", children: open ? labels.close : labels.open })] }), open ? (_jsx("div", { id: id, className: "accordion__panel page", role: "region", "aria-label": title, children: children })) : null] }));
8
8
  }
9
9
  /** Pitää huolen että vain yksi rivi on auki kerrallaan. */
10
10
  export function useAccordionGroup() {
package/ListRow.js CHANGED
@@ -30,5 +30,5 @@ export default function ListRow({ title, number, description, meta, size = 's',
30
30
  className,
31
31
  ]
32
32
  .filter(Boolean)
33
- .join(' '), children: [number ? _jsx("span", { className: "meta list-row__number", children: number }) : null, _jsxs("span", { className: "list-row__main", children: [_jsx("span", { className: "list-row__title", children: title }), description ? _jsx("span", { className: "list-row__description", children: description }) : null] }), meta ? _jsx("span", { className: "meta list-row__meta", children: meta }) : null] }));
33
+ .join(' '), children: [number ? _jsx("span", { className: "meta list-row__number", children: number }) : null, _jsxs("span", { className: "list-row__main", children: [_jsx("span", { className: `list-row__title ${size === 'm' ? 'display-m' : 'display-s'}`, children: title }), description ? _jsx("span", { className: "body-s muted list-row__description", children: description }) : null] }), meta ? _jsx("span", { className: "meta list-row__meta", children: meta }) : null] }));
34
34
  }
package/README.md CHANGED
@@ -1,6 +1,6 @@
1
1
  # @pokela/components
2
2
 
3
- React-komponentit: **Pokela Design System**, versio 1.2.0.
3
+ React-komponentit: **Pokela Design System**, versio 2.1.0.
4
4
 
5
5
  > Generoitu hakemistosta `components/` — samoista tiedostoista joita sivusto
6
6
  > ajaa. Älä muokkaa käsin: muutokset tehdään lähteeseen ja paketti
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pokela/components",
3
- "version": "1.2.0",
3
+ "version": "2.1.0",
4
4
  "description": "React-komponentit: Pokela Design System. Generoitu tiedostoista components/, ei käsin ylläpidetty.",
5
5
  "license": "MIT",
6
6
  "author": "Veli-Matti Pokela",
@@ -25,7 +25,7 @@
25
25
  "LICENSE"
26
26
  ],
27
27
  "dependencies": {
28
- "@pokela/tokens": "^1.2.0"
28
+ "@pokela/tokens": "^2.1.0"
29
29
  },
30
30
  "peerDependencies": {
31
31
  "react": ">=18"
@@ -20,11 +20,10 @@
20
20
  .detail__role { display: grid; grid-template-columns: minmax(0, 1fr); gap: var(--space-32); }
21
21
  @media (min-width: 900px) { .detail__role { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: var(--space-40); } }
22
22
  .detail__role-col { display: flex; flex-direction: column; gap: var(--space-12); }
23
- .detail__role-title { margin: 0; font-size: var(--text-body-l); }
24
23
  .detail__role-note { color: var(--ink-faint); margin: 0; }
25
24
 
26
25
  .detail__list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: var(--space-8); }
27
- .detail__list li { font-size: var(--text-body-s); line-height: var(--lh-body-s); padding-left: var(--space-16); position: relative; }
26
+ .detail__list li { padding-left: var(--space-16); position: relative; }
28
27
  .detail__list li::before { content: '—'; position: absolute; left: 0; color: var(--ink-faint); }
29
28
  .detail__list--muted li { color: var(--ink-muted); }
30
29
 
@@ -33,7 +32,7 @@
33
32
  .detail__sections-body { display: flex; flex-direction: column; }
34
33
  .detail__section { padding-block: var(--space-24); border-top: var(--hairline) solid var(--line); }
35
34
  .detail__section:first-child { border-top: 0; padding-top: 0; }
36
- .detail__section-title { margin: 0 0 var(--space-8); font-size: var(--text-body-l); font-weight: var(--weight-500); }
35
+ .detail__section-title { margin: 0 0 var(--space-8); }
37
36
  .detail__section-body { margin: 0; color: var(--ink-muted); }
38
37
 
39
38
  .detail__media { display: grid; grid-template-columns: minmax(0, 1fr); gap: var(--space-24); }
package/styles/base.css CHANGED
@@ -53,6 +53,14 @@ img, svg, video { display: block; max-width: 100%; }
53
53
  .body-l { font-size: var(--text-body-l); line-height: var(--lh-body-l); margin: 0; }
54
54
  .body-s { font-size: var(--text-body-s); line-height: var(--lh-body-s); margin: 0; }
55
55
 
56
+ /* Pieni otsikko joka ei ole display: UI-fontti painolla 500. Tätä
57
+ yhdistelmää käytettiin neljässä paikassa ilman nimeä, joten Figmassa
58
+ ei voinut olla sille tyyliä — nimetön ei ole peilattavissa.
59
+
60
+ Fonttiperhe on mukana vaikka body antaa sen perintönä — <h3> ja <h4>
61
+ eivät peri sitä kaikissa selaimissa. */
62
+ .title { font-family: var(--font-ui); font-size: var(--text-body-l); line-height: var(--lh-body-l); font-weight: var(--weight-500); margin: 0; }
63
+
56
64
  /* Leipätekstin mitta. Ei koskaan yli 62 merkkiä. */
57
65
  .measure { max-width: var(--measure); }
58
66
 
@@ -70,7 +78,16 @@ img, svg, video { display: block; max-width: 100%; }
70
78
  color: var(--ink-faint);
71
79
  }
72
80
  .meta--s { font-size: var(--text-meta-s); line-height: var(--lh-meta-s); letter-spacing: var(--tr-meta-s); }
73
- .meta--ink { color: var(--ink); }
81
+
82
+ /* ---- värit -----------------------------------------------------------
83
+ Nimetty tokenin mukaan, ei paikan. Seitsemän komponenttiluokkaa teki
84
+ tämän omalla nimellään — seitsemän nimeä yhdelle tehtävälle.
85
+
86
+ Järjestys on merkitsevä: .meta asettaa oman värinsä, ja nämä ovat
87
+ samaa tarkkuutta, joten niiden on tultava sen jälkeen voittaakseen. */
88
+ .ink { color: var(--ink); }
89
+ .muted { color: var(--ink-muted); }
90
+ .faint { color: var(--ink-faint); }
74
91
 
75
92
  a { color: inherit; text-decoration: none; }
76
93
  a:hover { text-decoration: underline; text-underline-offset: var(--space-4); }
@@ -64,18 +64,7 @@
64
64
  min-width: 0;
65
65
  }
66
66
 
67
- .list-row__title {
68
- font-family: var(--font-display);
69
- font-size: var(--text-display-s);
70
- line-height: var(--lh-display-s);
71
- letter-spacing: var(--tr-display-s);
72
- }
73
67
 
74
- .list-row__description {
75
- font-size: var(--text-body-s);
76
- line-height: var(--lh-body-s);
77
- color: var(--ink-muted);
78
- }
79
68
 
80
69
  /* ---- numerollinen -------------------------------------------------- */
81
70
 
@@ -103,11 +92,6 @@
103
92
  .list-row--m.list-row--numbered { grid-template-columns: var(--space-56) minmax(0, 1fr) 260px; }
104
93
  }
105
94
  .list-row--m .list-row__main { gap: var(--space-12); }
106
- .list-row--m .list-row__title {
107
- font-size: var(--text-display-m);
108
- line-height: var(--lh-display-m);
109
- letter-spacing: var(--tr-display-m);
110
- }
111
95
  .list-row--m .list-row__description { max-width: var(--measure); }
112
96
 
113
97
  /* ---- avautuva ------------------------------------------------------
@@ -146,59 +130,54 @@
146
130
  pystykeskelle. Koko tulee .icon--l:stä. */
147
131
  }
148
132
 
149
- /* ---- käännös ------------------------------------------------------- */
133
+ /* ---- hover ja käännös ---------------------------------------------
134
+
135
+ Hover on hiljainen pinta (--badge-surface), ei käännös. Täysi
136
+ musta/valkoinen-käännös jokaisella hiirenliikkeellä oli liian raju
137
+ molemmissa teemoissa. Käännös jää tilalle joka on oikeasti päällä:
138
+ avattu rivi (`aria-expanded`) ja staattinen `.invert`. */
139
+ .list-row:hover,
140
+ .list-row:focus-visible {
141
+ background: var(--badge-surface);
142
+ text-decoration: none;
143
+ }
144
+ /* Meta tummuu pinnalla: --ink-faint jäisi vaaleassa teemassa
145
+ --badge-surfacen päällä alle AA:n (4,49:1). */
146
+ .list-row:hover .meta,
147
+ .list-row:focus-visible .meta { color: var(--ink-muted); }
150
148
 
151
149
  /* `.invert` on mukana, jotta tila voidaan näyttää myös staattisena
152
150
  (esim. dokumentaatiossa) ilman omaa sääntöä — muuten .list-row:n
153
151
  oma `color` voittaisi utilityn samalla spesifisyydellä ja teksti
154
152
  jäisi näkymättömiin. `aria-expanded` on avatun rivin sama tila. */
155
- .list-row:hover,
156
- .list-row:focus-visible,
157
153
  .list-row.invert,
158
154
  .list-row[aria-expanded='true'] {
159
155
  background: var(--invert-surface);
160
156
  color: var(--invert-ink);
161
157
  text-decoration: none;
162
158
  }
163
- .list-row:hover .list-row__description,
164
- .list-row:focus-visible .list-row__description,
165
159
  .list-row.invert .list-row__description,
166
160
  .list-row[aria-expanded='true'] .list-row__description,
167
- .list-row:hover .meta,
168
- .list-row:focus-visible .meta,
169
161
  .list-row.invert .meta,
170
162
  .list-row[aria-expanded='true'] .meta { color: var(--invert-faint); }
171
163
 
172
- /* Focus-renkaan pitää näkyä käännetyllä pinnalla. */
173
- .list-row:focus-visible {
174
- outline-color: var(--invert-ink);
175
- outline-offset: calc(var(--focus-offset) * -2);
176
- }
164
+ /* Focus-renkaan pitää näkyä myös käännetyllä pinnalla. */
165
+ .list-row:focus-visible { outline-offset: calc(var(--focus-offset) * -2); }
166
+ .list-row[aria-expanded='true']:focus-visible { outline-color: var(--invert-ink); }
177
167
 
178
168
  /* Sisarrivit vaimennetaan hoverin aikana. */
179
169
  .list-rows:hover .list-row:not(:hover) { color: var(--ink-faint); }
180
170
  .list-rows:hover .list-row:not(:hover) .list-row__description { color: var(--ink-faint); }
181
171
 
182
- /* Kosketus: ei hoveria, käännös :active-tilassa. Viimeisenä = voittaa. */
172
+ /* Kosketus: ei hoveria, hiljainen pinta :active-tilassa. Viimeisenä = voittaa. */
183
173
  @media (hover: none) {
184
- .list-row:hover {
185
- background: transparent;
186
- color: var(--ink);
187
- }
188
- .list-row:hover .list-row__description { color: var(--ink-muted); }
174
+ .list-row:hover { background: transparent; }
189
175
  .list-row:hover .meta { color: var(--ink-faint); }
190
176
  .list-rows:hover .list-row:not(:hover) { color: var(--ink); }
191
177
  .list-rows:hover .list-row:not(:hover) .list-row__description { color: var(--ink-muted); }
192
178
 
193
- .list-row:active,
194
- .list-row[aria-expanded='true'] {
195
- background: var(--invert-surface);
196
- color: var(--invert-ink);
197
- }
198
- .list-row:active .list-row__description,
199
- .list-row[aria-expanded='true'] .list-row__description,
200
- .list-row:active .meta,
201
- .list-row[aria-expanded='true'] .meta { color: var(--invert-faint); }
179
+ .list-row:active { background: var(--badge-surface); }
180
+ .list-row:active .meta { color: var(--ink-muted); }
202
181
  }
203
182
 
204
183
  @media (prefers-reduced-motion: reduce) {