@kolkrabbi/kol-component 0.160.0 → 0.161.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 +1 -1
- package/src/molecules/Stepper.jsx +27 -0
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@kolkrabbi/kol-component",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.161.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",
|
|
@@ -12,6 +12,15 @@
|
|
|
12
12
|
* at both ends, and `onChange` reports the option in the same event shape
|
|
13
13
|
* as the number path — `{ target: { value: option } }`.
|
|
14
14
|
*
|
|
15
|
+
* layout="inline" — `‹ value ›` on ONE line (StepperInlineVariant, kol-monitor
|
|
16
|
+
* 2026-09-02; the rack's Selector shape, the other half of its collapse onto
|
|
17
|
+
* this): the chevrons flank the value as left/right hit targets, the value is
|
|
18
|
+
* centred in a 3ch floor so the row does not jitter as it steps, and there is
|
|
19
|
+
* NO `.kol-control` field chrome — it is inline text on the panel. Value
|
|
20
|
+
* `text-fg-64`, chevrons `text-fg-40`, type from the size ladder; casing is the
|
|
21
|
+
* caller's. Works for `options` and for the number range alike. Default
|
|
22
|
+
* `stacked` is the field with the chevron stack, exactly as before.
|
|
23
|
+
*
|
|
15
24
|
* Loaded from `00-kol/chevron-{up,down}.svg` via the Icon registry — first
|
|
16
25
|
* stroke icons in the kol curated set. For a plain number input without
|
|
17
26
|
* bump affordance, use `<Input type="number" />`.
|
|
@@ -28,6 +37,7 @@ export default function Stepper({
|
|
|
28
37
|
max,
|
|
29
38
|
step = 1,
|
|
30
39
|
options,
|
|
40
|
+
layout = 'stacked',
|
|
31
41
|
size = 'sm',
|
|
32
42
|
className = '',
|
|
33
43
|
style = {},
|
|
@@ -63,6 +73,23 @@ export default function Stepper({
|
|
|
63
73
|
onChange?.(e)
|
|
64
74
|
}
|
|
65
75
|
|
|
76
|
+
/* INLINE — ‹ value › with no field: the chevrons are the hit targets, the
|
|
77
|
+
* value is text on the panel. `min-w-[3ch]` holds the width across steps. */
|
|
78
|
+
if (layout === 'inline') {
|
|
79
|
+
const chev = CHEVRON_SIZE[size]
|
|
80
|
+
return (
|
|
81
|
+
<div className={`inline-flex items-center justify-center gap-0.5 select-none ${SIZE_TYPE[size]} ${className}`.trim()} style={style}>
|
|
82
|
+
<button type="button" onClick={handleDecrement} className="inline-flex items-center justify-center px-0.5 text-fg-40 hover:text-emphasis transition-colors" aria-label="Previous">
|
|
83
|
+
<Icon name="chevron-left" size={chev} />
|
|
84
|
+
</button>
|
|
85
|
+
<span className="min-w-[3ch] text-center text-fg-64" {...props}>{value ?? ''}</span>
|
|
86
|
+
<button type="button" onClick={handleIncrement} className="inline-flex items-center justify-center px-0.5 text-fg-40 hover:text-emphasis transition-colors" aria-label="Next">
|
|
87
|
+
<Icon name="chevron-right" size={chev} />
|
|
88
|
+
</button>
|
|
89
|
+
</div>
|
|
90
|
+
)
|
|
91
|
+
}
|
|
92
|
+
|
|
66
93
|
const shellCls = [
|
|
67
94
|
'kol-control',
|
|
68
95
|
'kol-control--filled',
|