@kolkrabbi/kol-component 0.362.0 → 0.364.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
|
@@ -29,7 +29,9 @@ import { glyphSize, indicatorSize } from '../hooks/glyphLadders.js'
|
|
|
29
29
|
* variant="float" — the float select (float-everything W2 row 25 · W4 row 54, 2026-11-04): the
|
|
30
30
|
* trigger a `kol-btn-float` capsule on the float well (a `tone` still wins), the float heights by `size`
|
|
31
31
|
* (sm 28 · md 36 · lg 44); its list opens 8 under it on `--kol-float-list-r`, the trigger's width, 34 rows
|
|
32
|
-
* in Inter,
|
|
32
|
+
* in Inter, no hairline. Still rest and open only. The caret is the float spec's chevron for the trigger's size
|
|
33
|
+
* (`--kol-float-chev-*`, 12 at sm — plan-2026-11-12-float-system W3.1); in the list hover is the only fill, the
|
|
34
|
+
* current row carries its dot and no fill (`--kol-float-row-hover` · `-row-selected`).
|
|
33
35
|
*
|
|
34
36
|
* Legacy aliases (pre-law variants, kept so call-sites don't break):
|
|
35
37
|
* default → primary · subtle → primary · minimal → outline
|
|
@@ -265,7 +267,7 @@ const Dropdown = ({
|
|
|
265
267
|
</span>
|
|
266
268
|
{/* chrome lives in .kol-dd-caret (trailing edge + open-state flip) —
|
|
267
269
|
* keyed off the trigger's data-state, no inline styles */}
|
|
268
|
-
<IconLoader name="chevron-down" size={float ?
|
|
270
|
+
<IconLoader name="chevron-down" size={float ? `var(--kol-float-chev-${resolvedSize === 'md' || resolvedSize === 'lg' ? resolvedSize : 'sm'})` : indicatorSize(resolvedSize)} className="kol-dd-caret" />
|
|
269
271
|
</>
|
|
270
272
|
)}
|
|
271
273
|
{/* a consumer's own trigger mark — the tool-palette corner fold rides
|
|
@@ -286,7 +288,7 @@ const Dropdown = ({
|
|
|
286
288
|
hover: false,
|
|
287
289
|
size: resolvedSize,
|
|
288
290
|
/* a float row is the float list's (`.kol-menu-panel--float .kol-menu-row`), whatever the trigger's rung; the
|
|
289
|
-
* current one
|
|
291
|
+
* current one carries its dot and no fill (W3.1, P2: "it dosnt highlight selected, only hover") */
|
|
290
292
|
rowClass: float ? `kol-menu-row${isActive ? ' kol-menu-row--current' : ''}` : (ROW[resolvedSize] ?? ROW.sm),
|
|
291
293
|
height: rowHeight,
|
|
292
294
|
onPointerEnter: onOptionHover ? () => reportHover(option.value) : undefined,
|
|
@@ -32,7 +32,10 @@
|
|
|
32
32
|
* 2026-10-01): `kol-helper-8`, uppercase, hugging the control; it takes
|
|
33
33
|
* `labelPosition` (`top · bottom · left · right`, default bottom), `labelClass` and `gap`.
|
|
34
34
|
* `'float'` (float-everything W3 row 37, 2026-11-04): the label over a capsule — the float hint role
|
|
35
|
-
* (Inter 12) at fg-64,
|
|
35
|
+
* (Inter 12) at fg-64, no uppercase, no tracking, `--kol-float-label-gap` from the control; `inline` keeps
|
|
36
|
+
* the same label in the `--kol-float-label-w` column (a `labelWidth` still wins), the row at least the float
|
|
37
|
+
* sm height. Every float row is this (plan-2026-11-12-float-system W2.1); the wrapper carries
|
|
38
|
+
* `data-labeled-control`.
|
|
36
39
|
* children — the control body.
|
|
37
40
|
* className — additional classes on the wrapper.
|
|
38
41
|
*/
|
|
@@ -40,7 +43,7 @@ export default function LabeledControl({
|
|
|
40
43
|
label,
|
|
41
44
|
hint,
|
|
42
45
|
inline = false,
|
|
43
|
-
labelWidth
|
|
46
|
+
labelWidth,
|
|
44
47
|
children,
|
|
45
48
|
className = '',
|
|
46
49
|
text = false,
|
|
@@ -66,6 +69,9 @@ export default function LabeledControl({
|
|
|
66
69
|
}
|
|
67
70
|
const showLabel = !!label
|
|
68
71
|
const float = variant === 'float'
|
|
72
|
+
const lw = labelWidth ?? (float ? 'var(--kol-float-label-w)' : 48)
|
|
73
|
+
const gapClass = float ? 'gap-[var(--kol-float-label-gap)]' : null
|
|
74
|
+
const mark = float ? { 'data-labeled-control': '' } : undefined
|
|
69
75
|
const labelType = float ? 'kol-float-hint text-fg-64' : 'kol-helper-10 tracking-widest text-meta'
|
|
70
76
|
const labelInner = (
|
|
71
77
|
<>
|
|
@@ -84,15 +90,15 @@ export default function LabeledControl({
|
|
|
84
90
|
* BELOW `sm` IT STACKS (apps review, 2026-09-29): the yielding label yielded to
|
|
85
91
|
* nothing on a phone — a sentence-long combo took the whole row and the label
|
|
86
92
|
* showed as "C" or not at all. Label on its line, the value under it. */
|
|
87
|
-
const labelAuto =
|
|
93
|
+
const labelAuto = lw === 'auto'
|
|
88
94
|
return (
|
|
89
|
-
<div className={`flex ${labelAuto ? `flex-col items-start gap-1 sm:flex-row ${text ? 'sm:items-baseline' : 'sm:items-center'} sm:gap-3` : `${text ? 'items-baseline' : 'items-center'} gap-3`} ${className}`}>
|
|
95
|
+
<div {...mark} className={`flex ${labelAuto ? `flex-col items-start gap-1 sm:flex-row ${text ? 'sm:items-baseline' : 'sm:items-center'} sm:gap-3` : `${text ? 'items-baseline' : 'items-center'} ${gapClass ?? 'gap-3'}`}${float ? ' min-h-[var(--kol-float-h-sm)]' : ''} ${className}`}>
|
|
90
96
|
{showLabel && (
|
|
91
97
|
<span
|
|
92
98
|
/* A LABEL NEVER WRAPS (review 2, § 6.2 — the helper law by construction, 01-foundations/03-typography.md:29):
|
|
93
99
|
* `whitespace-nowrap truncate`, so a long one ends in an ellipsis instead of breaking onto a second line */
|
|
94
100
|
className={`${labelType} whitespace-nowrap truncate${text ? ' leading-4' : ''} ${labelAuto ? 'max-w-full min-w-0 sm:flex-1' : 'shrink-0'}`}
|
|
95
|
-
style={labelAuto ? undefined : { width:
|
|
101
|
+
style={labelAuto ? undefined : { width: lw }}
|
|
96
102
|
>
|
|
97
103
|
{labelInner}
|
|
98
104
|
</span>
|
|
@@ -103,7 +109,7 @@ export default function LabeledControl({
|
|
|
103
109
|
}
|
|
104
110
|
|
|
105
111
|
return (
|
|
106
|
-
<div className={`flex flex-col gap-2 ${className}`}>
|
|
112
|
+
<div {...mark} className={`flex flex-col ${gapClass ?? 'gap-2'} ${className}`}>
|
|
107
113
|
{showLabel && (
|
|
108
114
|
<span className={labelType}>{labelInner}</span>
|
|
109
115
|
)}
|
package/src/molecules/Slider.jsx
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { useCallback, useEffect, useId, useMemo, useRef, useState } from 'react'
|
|
2
2
|
import Input from '../atoms/Input.jsx'
|
|
3
3
|
import SliderPanel from './SliderPanel.jsx'
|
|
4
|
+
import LabeledControl from './LabeledControl.jsx'
|
|
4
5
|
|
|
5
6
|
/**
|
|
6
7
|
* Slider — range slider with label and a value readout. The LINEAR VARIANT of
|
|
@@ -46,7 +47,7 @@ import SliderPanel from './SliderPanel.jsx'
|
|
|
46
47
|
* @param {Object} props.style - forwarded to the wrapper; the seam for `--kol-slider-track` / `--kol-slider-playhead`
|
|
47
48
|
* @param {number} props.defaultValue - alt-click the control resets to this (falls back to `min`). Same contract on Knob
|
|
48
49
|
* @param {'input'|'value'|'none'} props.readout - `input` (default) an editable Input · `value` a plain right-aligned span, Knob's own display-only readout · `none`
|
|
49
|
-
* @param {'minimal'|'dual'|'scrub'|'panel'|'float'} props.variant - `dual` = two thumbs on one rail · `scrub` = a media scrubber: the thin track with the 4 × 28 pill knob (`.kol-playback-scrub`; `PlaybackBar`'s, 2026-10-02) · `panel` = the rack slider (was kol-hardware `Fader`, merged 2026-10-01): a drawn 2px track for a hardware panel; takes `value · onChange · min · max · step · label` plus `onHold` · `float` (float-everything W2 row 23, 2026-11-04
|
|
50
|
+
* @param {'minimal'|'dual'|'scrub'|'panel'|'float'} props.variant - `dual` = two thumbs on one rail · `scrub` = a media scrubber: the thin track with the 4 × 28 pill knob (`.kol-playback-scrub`; `PlaybackBar`'s, 2026-10-02) · `panel` = the rack slider (was kol-hardware `Fader`, merged 2026-10-01): a drawn 2px track for a hardware panel; takes `value · onChange · min · max · step · label` plus `onHold` · `float` (float-everything W2 row 23, 2026-11-04; track only since 2026-11-12): the 3px capsule track at the float sm height — the run fg-64 to a 12 thumb (`.kol-slider-float`); a `label` is drawn by `LabeledControl variant="float"`, a `value` readout as its hint, `formatValue` its words (`65%`)
|
|
50
51
|
* @param {'horizontal'|'vertical'} props.direction - `vertical` stands the track upright at `height`, label above and readout below (2026-10-02 — the volume ranges were hand-drawn for want of it). On `panel`, horizontal takes the row and shows a readout
|
|
51
52
|
* @param {number} props.height - vertical only — the track's length in px (default 96; panel 60)
|
|
52
53
|
* @param {string} props['aria-label'] - names the range when there is no visible `label`
|
|
@@ -258,28 +259,30 @@ const Slider = ({
|
|
|
258
259
|
const scrub = variant === 'scrub'
|
|
259
260
|
const length = vertical ? height ?? 96 : size
|
|
260
261
|
|
|
261
|
-
/* the float slider:
|
|
262
|
+
/* the float slider: track and thumb only, at the float sm height (plan-2026-11-12-float-system W2.1 — the label head it
|
|
263
|
+
* carried went; the user: "SOME IDIOT tried to put label on the slider instead of using a fucking LABELEDCONTROL").
|
|
264
|
+
* Its name is a LabeledControl's: a `label` passed here is drawn by `LabeledControl variant="float"`, the `value`
|
|
265
|
+
* readout as its hint. The run is the value as a percent on the track. */
|
|
262
266
|
if (variant === 'float') {
|
|
263
267
|
const pct = max > min ? ((value - min) / (max - min)) * 100 : 0
|
|
268
|
+
const track = (
|
|
269
|
+
<input
|
|
270
|
+
id={sliderId}
|
|
271
|
+
type="range"
|
|
272
|
+
min={min} max={max} step={step} value={value}
|
|
273
|
+
onChange={handleChange}
|
|
274
|
+
onClick={onAltReset}
|
|
275
|
+
disabled={disabled}
|
|
276
|
+
aria-label={ariaLabel ?? (typeof label === 'string' ? label : undefined)}
|
|
277
|
+
className={`kol-slider-float block min-w-0 ${label ? 'w-full' : className || 'w-full'}`.trim()}
|
|
278
|
+
style={{ '--kol-slider-pct': `${pct}%`, ...(length ? { width: length } : null), ...(label ? null : style) }}
|
|
279
|
+
/>
|
|
280
|
+
)
|
|
281
|
+
if (!label) return track
|
|
264
282
|
return (
|
|
265
|
-
<
|
|
266
|
-
{
|
|
267
|
-
|
|
268
|
-
{label && <label htmlFor={sliderId} className="kol-float-hint text-fg-emphasis whitespace-nowrap">{label}</label>}
|
|
269
|
-
{readout !== 'none' && <span className="kol-float-timecode text-fg-emphasis">{displayValue}</span>}
|
|
270
|
-
</div>
|
|
271
|
-
)}
|
|
272
|
-
<input
|
|
273
|
-
id={sliderId}
|
|
274
|
-
type="range"
|
|
275
|
-
min={min} max={max} step={step} value={value}
|
|
276
|
-
onChange={handleChange}
|
|
277
|
-
disabled={disabled}
|
|
278
|
-
aria-label={ariaLabel}
|
|
279
|
-
className="kol-slider-float w-full min-w-0"
|
|
280
|
-
style={{ '--kol-slider-pct': `${pct}%` }}
|
|
281
|
-
/>
|
|
282
|
-
</div>
|
|
283
|
+
<LabeledControl variant="float" label={label} hint={readout === 'value' ? displayValue : undefined} className={`${disabled ? 'opacity-40' : ''} ${className}`.trim()}>
|
|
284
|
+
{track}
|
|
285
|
+
</LabeledControl>
|
|
283
286
|
)
|
|
284
287
|
}
|
|
285
288
|
|
|
@@ -85,7 +85,7 @@ export default function NavRailFloat({ items = [], currentPath = '', onNavigate,
|
|
|
85
85
|
<button type="button" onClick={onSwitch} className="flex h-10 w-full items-center gap-2.5 rounded-[var(--kol-float-list-r)] px-2.5 text-left cursor-pointer hover:bg-fg-08 focus-visible:outline-none focus-visible:shadow-[var(--kol-float-focus)]">
|
|
86
86
|
<IconLoader name={icon} size={18} className="shrink-0 text-oq-96" />
|
|
87
87
|
<span className="kol-float-body-lg min-w-0 flex-1 truncate text-fg-emphasis">{title}</span>
|
|
88
|
-
{onSwitch && <IconLoader name="chevron-down" size=
|
|
88
|
+
{onSwitch && <IconLoader name="chevron-down" size="var(--kol-float-chev-lg)" className="shrink-0 text-oq-64" />}
|
|
89
89
|
</button>
|
|
90
90
|
))}
|
|
91
91
|
{onSearch && (
|