@klodd/ds 3.21.1 → 3.21.2

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.
@@ -131,3 +131,109 @@
131
131
  .score-pill--na.is-loading {
132
132
  background: var(--surface-active);
133
133
  }
134
+
135
+
136
+ /* ================================================================
137
+ .score-circle - cirkulär relevance-score-display (v3.21.2)
138
+ Standardstorlek 36x36 matchar .avatar default. Tabular-nums för
139
+ visuellt-jämn siffer-rendering. Klickbart fall (--na) triggar
140
+ rescore med is-loading spinning animation.
141
+
142
+ Modifiers: --strong (grön), --medium (gul), --low (grå), --na (klickbar)
143
+ States på --na: :hover, :active, :focus-visible, :disabled, .is-loading
144
+
145
+ Användning:
146
+ <span class="score-circle score-circle--strong">8.4</span>
147
+ <button class="score-circle score-circle--na" data-action="rescore"
148
+ data-job-id="X" aria-label="Bedöm jobbet">N/A</button>
149
+ ================================================================ */
150
+ .score-circle {
151
+ display: inline-flex;
152
+ align-items: center;
153
+ justify-content: center;
154
+ flex-shrink: 0;
155
+ width: 36px;
156
+ height: 36px;
157
+ font-size: var(--fs-13);
158
+ font-weight: var(--fw-medium);
159
+ font-variant-numeric: tabular-nums;
160
+ line-height: 1;
161
+ border: 1px solid transparent;
162
+ border-radius: 50%;
163
+ white-space: nowrap;
164
+ position: relative;
165
+ overflow: hidden;
166
+ }
167
+
168
+ .score-circle--strong {
169
+ color: var(--positive);
170
+ background: var(--positive-dim);
171
+ border-color: var(--positive-border);
172
+ }
173
+
174
+ .score-circle--medium {
175
+ color: var(--warning);
176
+ background: var(--warning-dim);
177
+ border-color: var(--warning-border);
178
+ }
179
+
180
+ .score-circle--low {
181
+ color: var(--text-muted);
182
+ background: var(--surface-default);
183
+ border-color: var(--border-subtle);
184
+ }
185
+
186
+ /* --na: klickbar (button-element) som triggar rescore via JS. Dashed
187
+ border signalerar "bedömning saknas, klicka för att försöka". */
188
+ .score-circle--na {
189
+ color: var(--text-muted);
190
+ background: var(--surface-default);
191
+ border: 1px dashed var(--border-default);
192
+ cursor: pointer;
193
+ font-size: var(--fs-11);
194
+ font-family: inherit;
195
+ transition: background var(--dur-fast) var(--ease-default),
196
+ color var(--dur-fast) var(--ease-default);
197
+ }
198
+ @media (hover: hover) and (pointer: fine) {
199
+ .score-circle--na:hover {
200
+ background: var(--surface-hover);
201
+ color: var(--text-default);
202
+ }
203
+ }
204
+ .score-circle--na:active { transform: scale(0.96); }
205
+ .score-circle--na:focus-visible {
206
+ outline: 2px solid var(--border-focus);
207
+ outline-offset: 2px;
208
+ }
209
+ .score-circle--na:disabled,
210
+ .score-circle--na[aria-disabled="true"] {
211
+ cursor: progress;
212
+ }
213
+
214
+ /* is-loading: spinning border-segment medan AI bedömer. Texten döljs
215
+ visuellt (transparent) men ::after-pseudo ritar en roterande ring.
216
+ prefers-reduced-motion slowar ner animationen markant. */
217
+ .score-circle--na.is-loading {
218
+ color: transparent;
219
+ background: var(--surface-default);
220
+ border-color: var(--border-default);
221
+ border-style: solid;
222
+ }
223
+ .score-circle--na.is-loading::after {
224
+ content: '';
225
+ position: absolute;
226
+ inset: 2px;
227
+ border-radius: 50%;
228
+ border: 2px solid transparent;
229
+ border-top-color: var(--accent-9);
230
+ animation: score-circle-spin 0.8s linear infinite;
231
+ }
232
+ @media (prefers-reduced-motion: reduce) {
233
+ .score-circle--na.is-loading::after {
234
+ animation-duration: 2s;
235
+ }
236
+ }
237
+ @keyframes score-circle-spin {
238
+ to { transform: rotate(360deg); }
239
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@klodd/ds",
3
- "version": "3.21.1",
3
+ "version": "3.21.2",
4
4
  "description": "Klodd shared design system - tokens, components, JS",
5
5
  "main": "css/index.css",
6
6
  "bin": {
@@ -33,12 +33,12 @@ För varje entry gäller:
33
33
  - **Tokens:** `--surface-sunken/-default`, `--accent-9`, `--accent-a3` (focus-ring), `--bg-danger` (error-state)
34
34
 
35
35
  ### badge (`badge.css`)
36
- - **Blocks:** `.badge`, `.score-pill` (sibling, kanonisk definition)
37
- - **Modifiers:** `.badge--neutral/-success/-warning/-danger/-accent`, `.score-pill--strong/-medium/-low`, `.score-pill--na` (v3.21.1 - klickbar N/A för rescore-trigger)
38
- - **States på `.score-pill--na`:** `.is-loading`, `[aria-disabled="true"]`, `:disabled` (cursor: progress)
39
- - **Anvand:** Status-pills (statiska) + score-pill--na som klickbar rescore-trigger (vanligtvis som `<button>`-element med `data-action="rescore"`)
36
+ - **Blocks:** `.badge`, `.score-pill` (legacy rectangular form, behålls för bakåtkompat), `.score-circle` (v3.21.2 - cirkulär form, ersätter score-pill för relevance-displays)
37
+ - **Modifiers:** `.badge--neutral/-success/-warning/-danger/-accent`, `.score-pill--strong/-medium/-low/-na`, `.score-circle--strong/-medium/-low/-na`
38
+ - **States på `.score-pill--na` + `.score-circle--na`:** `.is-loading` (spinning animation), `[aria-disabled="true"]`, `:disabled` (cursor: progress)
39
+ - **Anvand:** Status-pills (statiska) + score-circle--na som klickbar rescore-trigger med spinning loading-animation. Standardstorlek 36x36 matchar .avatar default.
40
40
  - **INTE:** Klickbara chips (anvand `.chip`)
41
- - **Tokens:** `--positive/-dim/-border`, `--warning/-dim/-border`, `--bg-danger`, `--accent-text/-a2/-a6`, `--surface-default/-hover/-active`, `--border-default/-focus/-subtle`
41
+ - **Tokens:** `--positive/-dim/-border`, `--warning/-dim/-border`, `--bg-danger`, `--accent-text/-a2/-a6/--accent-9`, `--surface-default/-hover/-active`, `--border-default/-focus/-subtle`, `--dur-fast`, `--ease-default`
42
42
 
43
43
  ### card (`card.css`)
44
44
  - **Blocks:** `.card`