@kolkrabbi/kol-component 0.179.0 → 0.180.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/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@kolkrabbi/kol-component",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.180.0",
|
|
4
4
|
"description": "KOL design-system components — atoms through organisms, emitting canonical kol-* classes. Pairs with @kolkrabbi/kol-theme for styling.",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"type": "module",
|
|
@@ -43,10 +43,18 @@
|
|
|
43
43
|
* mono-16, 8/20 pad). Same cell padding + mono type as the
|
|
44
44
|
* matching `.kol-btn-{sm,md,lg}`, so a segmented strip lines
|
|
45
45
|
* up with a Button of the same size.
|
|
46
|
+
* tone — the ground (segmented-toggle-sunken-tone, kol-client-olina 2026-09-03: the one
|
|
47
|
+
* control ControlToneSunken skipped; kol-fxr and olina carried the same three CSS
|
|
48
|
+
* lines to fake it). `sunken` (alias `inverse`): shell border transparent, the
|
|
49
|
+
* selected cell on `--kol-surface-sunken` / `fg-96`, rest cells as the default paints
|
|
50
|
+
* them; `filled` and `tonal` keep their own selected law. Through `toneClass`, so a
|
|
51
|
+
* `kol-tone-sunken` wrapper reaches it too. Unset = inherit.
|
|
46
52
|
* ariaLabel — accessible name for the group
|
|
47
53
|
* className — additional classes on the outer shell
|
|
48
54
|
*/
|
|
49
|
-
|
|
55
|
+
import { toneClass } from '../utilities/tone.js'
|
|
56
|
+
|
|
57
|
+
export default function SegmentedToggle({ value, onChange, options = [], variant = 'default', size = 'md', tone = 'default', ariaLabel, className = '' }) {
|
|
50
58
|
const cellType = { xs: 'kol-mono-8', sm: 'kol-mono-12', md: 'kol-mono-14', lg: 'kol-mono-16' }[size]
|
|
51
59
|
const stateless = value == null
|
|
52
60
|
const focusIdx = Math.max(0, options.findIndex((opt) => opt.value === value))
|
|
@@ -71,6 +79,7 @@ export default function SegmentedToggle({ value, onChange, options = [], variant
|
|
|
71
79
|
(variant === 'filled' || variant === 'tonal') && 'kol-seg--filled',
|
|
72
80
|
variant === 'tonal' && 'kol-seg--tonal',
|
|
73
81
|
size !== 'md' && `kol-seg--${size}`,
|
|
82
|
+
toneClass(tone),
|
|
74
83
|
className,
|
|
75
84
|
].filter(Boolean).join(' ')}
|
|
76
85
|
>
|