@dorsk/tsumikit 0.14.0 → 0.15.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/README.md CHANGED
@@ -129,6 +129,10 @@ triggers, and `SegmentedControl`. Each renders an exact
129
129
  original ghost icon-button default. Use `control` on `Button` or `Popover` when
130
130
  the roomier shared `--control-height` composer contract is required.
131
131
 
132
+ Button and Popover share the same semantic tones. For a confirmed positive
133
+ action, `tone="success"` gives neutral controls a success tint; combine it with
134
+ `variant="primary"` for a filled success action without consumer CSS.
135
+
132
136
  ## Built on the platform
133
137
 
134
138
  Interactive components lean on modern web features rather than reimplementing
@@ -6,8 +6,8 @@
6
6
  variant?: 'default' | 'primary' | 'ghost' | 'danger';
7
7
  // Semantic state tint layered on top of the variant: tints text/border and
8
8
  // adds a subtle fill on hover. For stateful controls — an "on"/active toggle
9
- // (`accent`), or cost/severity states (`info`, `warn`).
10
- tone?: 'none' | 'accent' | 'info' | 'warn' | 'danger';
9
+ // (`accent`), positive actions (`success`), or cost/severity states.
10
+ tone?: 'none' | 'accent' | 'success' | 'info' | 'warn' | 'danger';
11
11
  size?: 'sm' | 'md' | 'lg';
12
12
  control?: boolean;
13
13
  block?: boolean;
@@ -66,6 +66,7 @@
66
66
  class:btn-icon={icon}
67
67
  class:btn-chip={chip}
68
68
  class:btn-tone-accent={tone === 'accent'}
69
+ class:btn-tone-success={tone === 'success'}
69
70
  class:btn-tone-info={tone === 'info'}
70
71
  class:btn-tone-warn={tone === 'warn'}
71
72
  class:btn-tone-danger={tone === 'danger'}
@@ -156,6 +157,9 @@
156
157
  .btn-tone-accent {
157
158
  --btn-tone: var(--accent);
158
159
  }
160
+ .btn-tone-success {
161
+ --btn-tone: var(--ok);
162
+ }
159
163
  .btn-tone-info {
160
164
  --btn-tone: var(--info);
161
165
  }
@@ -166,6 +170,7 @@
166
170
  --btn-tone: var(--danger);
167
171
  }
168
172
  .btn-tone-accent,
173
+ .btn-tone-success,
169
174
  .btn-tone-info,
170
175
  .btn-tone-warn,
171
176
  .btn-tone-danger {
@@ -173,6 +178,7 @@
173
178
  border-color: color-mix(in srgb, var(--btn-tone) 50%, var(--border));
174
179
  }
175
180
  .btn-tone-accent:hover:not(:disabled),
181
+ .btn-tone-success:hover:not(:disabled),
176
182
  .btn-tone-info:hover:not(:disabled),
177
183
  .btn-tone-warn:hover:not(:disabled),
178
184
  .btn-tone-danger:hover:not(:disabled) {
@@ -234,6 +240,26 @@
234
240
  border-color: var(--accent);
235
241
  filter: brightness(1.08);
236
242
  }
243
+ .btn-control.btn-tone-success {
244
+ color: var(--ok);
245
+ border-color: color-mix(in srgb, var(--ok) 50%, var(--border));
246
+ }
247
+ .btn-control.btn-tone-success:hover:not(:disabled) {
248
+ background: color-mix(in srgb, var(--ok) 14%, transparent);
249
+ border-color: var(--ok);
250
+ }
251
+ /* A positive primary action uses success as its fill, not merely as the
252
+ neutral tint. This follows the control override so both heights match. */
253
+ .btn-primary.btn-tone-success {
254
+ background: var(--ok);
255
+ border-color: var(--ok);
256
+ color: var(--text-on-success);
257
+ }
258
+ .btn-primary.btn-tone-success:hover:not(:disabled) {
259
+ background: var(--ok);
260
+ border-color: var(--ok);
261
+ filter: brightness(1.08);
262
+ }
237
263
 
238
264
  /* Icon-only buttons (IconButton). Square box = consistent 2.25rem tap target. */
239
265
  .btn-icon {
@@ -2,7 +2,7 @@ import type { Snippet } from 'svelte';
2
2
  import type { HTMLButtonAttributes } from 'svelte/elements';
3
3
  type ButtonProps = HTMLButtonAttributes & {
4
4
  variant?: 'default' | 'primary' | 'ghost' | 'danger';
5
- tone?: 'none' | 'accent' | 'info' | 'warn' | 'danger';
5
+ tone?: 'none' | 'accent' | 'success' | 'info' | 'warn' | 'danger';
6
6
  size?: 'sm' | 'md' | 'lg';
7
7
  control?: boolean;
8
8
  block?: boolean;
@@ -13,7 +13,7 @@
13
13
 
14
14
  type Placement = 'bottom-start' | 'bottom-end' | 'top-start' | 'top-end';
15
15
  type TriggerVariant = 'default' | 'primary' | 'ghost' | 'danger';
16
- type TriggerTone = 'none' | 'accent' | 'info' | 'warn' | 'danger';
16
+ type TriggerTone = 'none' | 'accent' | 'success' | 'info' | 'warn' | 'danger';
17
17
  type TriggerSize = 'sm' | 'md' | 'lg';
18
18
 
19
19
  let {
@@ -101,6 +101,7 @@
101
101
  class:trigger-control={control}
102
102
  class:trigger-block={block}
103
103
  class:trigger-tone-accent={tone === 'accent'}
104
+ class:trigger-tone-success={tone === 'success'}
104
105
  class:trigger-tone-info={tone === 'info'}
105
106
  class:trigger-tone-warn={tone === 'warn'}
106
107
  class:trigger-tone-danger={tone === 'danger'}
@@ -212,6 +213,9 @@
212
213
  .pop-trigger.trigger-tone-accent {
213
214
  --pop-trigger-tone: var(--accent);
214
215
  }
216
+ .pop-trigger.trigger-tone-success {
217
+ --pop-trigger-tone: var(--ok);
218
+ }
215
219
  .pop-trigger.trigger-tone-info {
216
220
  --pop-trigger-tone: var(--info);
217
221
  }
@@ -222,6 +226,7 @@
222
226
  --pop-trigger-tone: var(--danger);
223
227
  }
224
228
  .pop-trigger.trigger-tone-accent,
229
+ .pop-trigger.trigger-tone-success,
225
230
  .pop-trigger.trigger-tone-info,
226
231
  .pop-trigger.trigger-tone-warn,
227
232
  .pop-trigger.trigger-tone-danger {
@@ -229,12 +234,23 @@
229
234
  border-color: color-mix(in srgb, var(--pop-trigger-tone) 50%, var(--border));
230
235
  }
231
236
  .pop-trigger.trigger-tone-accent:hover:not(:disabled),
237
+ .pop-trigger.trigger-tone-success:hover:not(:disabled),
232
238
  .pop-trigger.trigger-tone-info:hover:not(:disabled),
233
239
  .pop-trigger.trigger-tone-warn:hover:not(:disabled),
234
240
  .pop-trigger.trigger-tone-danger:hover:not(:disabled) {
235
241
  background: color-mix(in srgb, var(--pop-trigger-tone) 14%, transparent);
236
242
  border-color: var(--pop-trigger-tone);
237
243
  }
244
+ .pop-trigger.trigger-primary.trigger-tone-success {
245
+ background: var(--ok);
246
+ border-color: var(--ok);
247
+ color: var(--text-on-success);
248
+ }
249
+ .pop-trigger.trigger-primary.trigger-tone-success:hover:not(:disabled) {
250
+ background: var(--ok);
251
+ border-color: var(--ok);
252
+ filter: brightness(1.08);
253
+ }
238
254
  .pop-trigger:disabled {
239
255
  opacity: 0.45;
240
256
  cursor: not-allowed;
@@ -1,7 +1,7 @@
1
1
  import type { Snippet } from 'svelte';
2
2
  type Placement = 'bottom-start' | 'bottom-end' | 'top-start' | 'top-end';
3
3
  type TriggerVariant = 'default' | 'primary' | 'ghost' | 'danger';
4
- type TriggerTone = 'none' | 'accent' | 'info' | 'warn' | 'danger';
4
+ type TriggerTone = 'none' | 'accent' | 'success' | 'info' | 'warn' | 'danger';
5
5
  type TriggerSize = 'sm' | 'md' | 'lg';
6
6
  type $$ComponentProps = {
7
7
  placement?: Placement;
@@ -73,6 +73,9 @@
73
73
  --text-muted: var(--c-text-muted);
74
74
  --text-faint: var(--c-text-faint);
75
75
  --text-on-accent: var(--c-accent-ink);
76
+ /* Adaptive ink for filled positive actions: dark canvas ink on bright greens,
77
+ light canvas ink on the darker greens used by light themes. */
78
+ --text-on-success: var(--bg);
76
79
 
77
80
  --accent: var(--c-accent);
78
81
  --accent-dim: var(--c-accent-dim);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dorsk/tsumikit",
3
- "version": "0.14.0",
3
+ "version": "0.15.0",
4
4
  "description": "Minimal, dependency-free Svelte 5 + pure-CSS UI kit. Token-driven atoms, molecules & layouts with theming out of the box.",
5
5
  "type": "module",
6
6
  "license": "MIT",