@kolkrabbi/kol-component 0.361.1 → 0.363.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.361.1",
3
+ "version": "0.363.0",
4
4
  "description": "The core component library",
5
5
  "license": "MIT",
6
6
  "type": "module",
@@ -32,8 +32,8 @@
32
32
  "embla-carousel-react": "^8.6.0",
33
33
  "pdfjs-dist": "^6.3.289",
34
34
  "react-syntax-highlighter": "^16.1.1",
35
- "@kolkrabbi/kol-markdown": "^0.2.0",
36
35
  "@kolkrabbi/kol-search": "^0.3.0",
36
+ "@kolkrabbi/kol-markdown": "^0.2.0",
37
37
  "@kolkrabbi/kol-growth": "^0.5.0"
38
38
  },
39
39
  "peerDependencies": {
@@ -45,7 +45,7 @@
45
45
  "react-dom": "^18.3.0 || ^19.0.0"
46
46
  },
47
47
  "devDependencies": {
48
- "@kolkrabbi/kol-icons": "^0.69.0"
48
+ "@kolkrabbi/kol-icons": "^0.70.1"
49
49
  },
50
50
  "files": [
51
51
  "src",
@@ -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, 8 above the control, no uppercase, no tracking; `inline` keeps the same label.
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 = 48,
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 = labelWidth === 'auto'
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: labelWidth }}
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
  )}
@@ -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): the label and a mono readout on one line, the 3px capsule track under them — the run fg-64 to a 12 thumb (`.kol-slider-float`); `readout` is `value` there, `formatValue` its words (`65%`)
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: label · readout above, the capsule track below; the run is the value as a percent on the track */
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
- <div className={`flex flex-col gap-1 ${disabled ? 'opacity-40' : ''} ${className}`.trim()} style={{ ...(length ? { width: length } : null), ...style }} onClick={onAltReset}>
266
- {(label || readout !== 'none') && (
267
- <div className="flex items-center justify-between gap-3">
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
 
@@ -22,15 +22,26 @@ import TocRow from '../molecules/TocRow.jsx'
22
22
  * @param {ReactNode} [status] `Reading position saved`
23
23
  * @param {Function} [onFold]
24
24
  * @param {number} [width] default 304
25
+ * @param {boolean} [bare] the body only — book, chapters, progress, status — with no sheet and no header, for
26
+ * kol-shell's PropertyRail, the float module that carries the title and the fold (2026-11-12)
25
27
  * @param {string} [className]
26
28
  */
27
- export default function ReadingContents({ title = 'Contents', book, author, count, chapters = [], current, onSelect, progress, progressLabel = 'Through the book', status, onFold, width = 304, className = '' }) {
29
+ export default function ReadingContents({ title = 'Contents', book, author, count, chapters = [], current, onSelect, progress, progressLabel = 'Through the book', status, onFold, width = 304, bare = false, className = '' }) {
30
+ if (bare) return <div className={`flex flex-col ${className}`.trim()}><Body {...{ title, book, author, count, chapters, current, onSelect, progress, progressLabel, status }} /></div>
28
31
  return (
29
32
  <aside className={`flex flex-col rounded-[var(--kol-float-menu-r)] bg-surface-secondary p-5 ${className}`.trim()} style={{ width }} aria-label={title}>
30
33
  <div className="flex h-7 items-center justify-between">
31
34
  <span className="kol-float-body-lg text-fg-emphasis">{title}</span>
32
35
  {onFold && <Button variant="float" tone="ghost" size="sm" iconOnly="chevron-up" aria-label="Fold" onClick={onFold} className="-mr-1.5" />}
33
36
  </div>
37
+ <Body {...{ title, book, author, count, chapters, current, onSelect, progress, progressLabel, status }} />
38
+ </aside>
39
+ )
40
+ }
41
+
42
+ function Body({ title, book, author, count, chapters, current, onSelect, progress, progressLabel, status }) {
43
+ return (
44
+ <>
34
45
  {book && <span className="kol-float-section mt-8 text-fg-emphasis">{book}</span>}
35
46
  {author && <span className="kol-float-hint mt-1 text-fg-64">{author}</span>}
36
47
  {count && <span className="kol-float-ruler mt-6 uppercase text-fg-64">{count}</span>}
@@ -49,6 +60,6 @@ export default function ReadingContents({ title = 'Contents', book, author, coun
49
60
  </div>
50
61
  )}
51
62
  {status && <span className="kol-float-label mt-5 text-fg-64">{status}</span>}
52
- </aside>
63
+ </>
53
64
  )
54
65
  }