@kolkrabbi/kol-component 0.377.0 → 0.379.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.
Files changed (81) hide show
  1. package/package.json +5 -4
  2. package/src/atoms/BezierPathEditor.jsx +1 -1
  3. package/src/atoms/Button.jsx +84 -1
  4. package/src/atoms/Figure.jsx +19 -1
  5. package/src/atoms/FunctionPlot.jsx +1 -1
  6. package/src/atoms/Input.jsx +105 -1
  7. package/src/atoms/Kbd.jsx +42 -2
  8. package/src/atoms/Link.jsx +20 -0
  9. package/src/atoms/OriginPicker.jsx +9 -5
  10. package/src/atoms/SectionFooter.jsx +22 -0
  11. package/src/atoms/SectionHeader.jsx +24 -0
  12. package/src/atoms/SizeOrDownload.jsx +1 -1
  13. package/src/atoms/Textarea.jsx +11 -2
  14. package/src/atoms/ToggleCheckbox.jsx +23 -1
  15. package/src/atoms/ToggleSwitch.jsx +39 -0
  16. package/src/atoms/ViewToggle.jsx +2 -2
  17. package/src/atoms/XYPad.jsx +25 -0
  18. package/src/hooks/useDragResize.js +1 -1
  19. package/src/index.js +26 -3
  20. package/src/molecules/AccountMenu.jsx +14 -1
  21. package/src/molecules/AlignmentGrid.jsx +13 -1
  22. package/src/molecules/ButtonGroup.jsx +73 -1
  23. package/src/molecules/ButtonSplit.jsx +64 -3
  24. package/src/molecules/Chip.jsx +26 -0
  25. package/src/molecules/CodeBlock.jsx +39 -2
  26. package/src/molecules/ColorInputRow.jsx +125 -4
  27. package/src/molecules/ColorSwatch.jsx +43 -2
  28. package/src/molecules/ContentCard.jsx +104 -3
  29. package/src/molecules/ContentMedia.jsx +1 -1
  30. package/src/molecules/ContentRow.jsx +3 -3
  31. package/src/molecules/DividerLabel.jsx +19 -0
  32. package/src/molecules/Dropdown.jsx +111 -1
  33. package/src/molecules/DropdownStepper.jsx +29 -0
  34. package/src/molecules/FieldPair.jsx +41 -2
  35. package/src/molecules/Header.jsx +8 -4
  36. package/src/molecules/LabeledControl.jsx +51 -0
  37. package/src/molecules/Menu.jsx +239 -3
  38. package/src/molecules/Modal.jsx +216 -10
  39. package/src/molecules/ModalShell.jsx +21 -8
  40. package/src/molecules/OptionRow.jsx +1 -1
  41. package/src/molecules/ParamBindDot.jsx +29 -2
  42. package/src/molecules/QuantityInput.jsx +48 -0
  43. package/src/molecules/RailFloat.jsx +4 -3
  44. package/src/molecules/RailHeader.jsx +32 -2
  45. package/src/molecules/SectionText.jsx +54 -1
  46. package/src/molecules/Slider.jsx +101 -2
  47. package/src/molecules/SplitToolButton.jsx +4 -6
  48. package/src/molecules/SwatchControls.jsx +28 -0
  49. package/src/molecules/SwatchGrid.jsx +39 -0
  50. package/src/molecules/TabsDocument.jsx +131 -0
  51. package/src/molecules/TabsRow.jsx +35 -1
  52. package/src/molecules/Toast.jsx +55 -0
  53. package/src/molecules/TreeRow.jsx +87 -1
  54. package/src/organisms/AppItemMenuProvider.jsx +2 -2
  55. package/src/organisms/ColorPickerPopover.jsx +133 -4
  56. package/src/organisms/ColumnBrowser.jsx +1 -1
  57. package/src/organisms/CommandOverlay.jsx +396 -21
  58. package/src/organisms/FindBar.jsx +70 -0
  59. package/src/organisms/FramedMediaBand.jsx +2 -2
  60. package/src/organisms/GalleryCarousel.jsx +1 -1
  61. package/src/organisms/LogoSystem.jsx +38 -0
  62. package/src/organisms/LogoTuner.jsx +32 -0
  63. package/src/organisms/MediaLibrary.jsx +1 -1
  64. package/src/organisms/MediaLibraryPages.jsx +1 -1
  65. package/src/organisms/Rail.jsx +33 -1
  66. package/src/organisms/RailSwitcher.jsx +62 -0
  67. package/src/organisms/ReadingContents.jsx +63 -1
  68. package/src/organisms/SectionSplit.jsx +1 -1
  69. package/src/organisms/SettingsPanel.jsx +64 -6
  70. package/src/organisms/ShortcutsOverlay.jsx +46 -2
  71. package/src/organisms/SpectrumControls.jsx +112 -19
  72. package/src/organisms/StatusBar.jsx +30 -0
  73. package/src/organisms/Table.jsx +141 -2
  74. package/src/organisms/TimelineDock.jsx +281 -1
  75. package/src/organisms/logoBoard.jsx +61 -0
  76. package/src/utilities/AssetPlaceholder.jsx +1 -1
  77. package/src/utilities/EditorShell.jsx +42 -1
  78. package/src/utilities/OverlayGlassPanel.jsx +1 -1
  79. package/src/utilities/Popover.jsx +298 -2
  80. package/src/utilities/SelectionOverlay.jsx +74 -1
  81. package/src/utilities/kolboxGlyph.jsx +10 -0
@@ -1,5 +1,5 @@
1
1
  import { useCallback, useEffect, useId, useMemo, useRef, useState } from 'react'
2
- import Input from '../atoms/Input.jsx'
2
+ import Input, { selectOnFirstPress } from '../atoms/Input.jsx'
3
3
  import SliderPanel from './SliderPanel.jsx'
4
4
  import LabeledControl from './LabeledControl.jsx'
5
5
 
@@ -47,7 +47,9 @@ import LabeledControl from './LabeledControl.jsx'
47
47
  * @param {Object} props.style - forwarded to the wrapper; the seam for `--kol-slider-track` / `--kol-slider-playhead`
48
48
  * @param {number} props.defaultValue - alt-click the control resets to this (falls back to `min`). Same contract on Knob
49
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`. On `float` unset is `none`; `input` puts the value as an `Input variant="float"` pill at the track's right, sized in `ch` to the widest value (plan-2026-11-12-one-header W6.1 — the settings window's rows; typed values commit on Enter or blur, clamped, Escape reverts)
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
+ * @param {'minimal'|'dual'|'scrub'|'panel'|'float'|'kolbox'} props.variant - `kolbox` (W31.2 batch 3): kolbox's track (2px oq-24, the run in the ink to the value, a 12 ink thumb) in a 24 row (`--kol-kolbox-ctl`); `readout` `value` (its default) the mono 12 value beside it, 40 wide, or `input` the track in an oq-16 field and the value in a text field 2 apart; no visible label (`aria-label` names it), `formatValue` defaults to the raw value · `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%`)
51
+ * @param {'folio'} props.variant - also `folio` (Folio migration batch A, 2026-11-22): Folio's slider, a 24 row, the 2px track in the rule with the run in the accent to a 12 accent thumb, the value (JetBrains Mono 12 / 16, `formatValue` its words, raw by default) 32 wide at the right, 12 off; no visible label (`aria-label`). Chrome in kol-theme `.kol-slider--folio`
52
+ * @param {number[]} props.stops - kolbox only: values marked on the track, a 2 mark each under the thumb's centre (a variable font's named weights)
51
53
  * @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
52
54
  * @param {number} props.height - vertical only — the track's length in px (default 96; panel 60)
53
55
  * @param {string} props['aria-label'] - names the range when there is no visible `label`
@@ -59,6 +61,84 @@ import LabeledControl from './LabeledControl.jsx'
59
61
  * @param {number|null} props.playhead - dual only — marker position in min…max; null renders nothing and attaches no listeners
60
62
  * @param {Function} props.onPlayheadChange - dual only — (next: number) => void; omit and the marker is not draggable and the rail does not seek
61
63
  */
64
+ /* `variant="kolbox"` (plan-2026-11-18-kolbox-system W31.2 batch 3, 2026-11-18): kolbox's Slider carried class for
65
+ * class, its own component so its draft is its own state. `readout` value (its default): the bare track, the value
66
+ * beside it, 12 apart; `input`: the track in its own field, then 2 apart the number in a field as wide as its value
67
+ * and at least 48. The number is a text field, not type="number": Chrome draws a number field's value in the OS
68
+ * region's format ("0,08" on an Icelandic Mac) whatever the page's lang. A draft holds what is typed until it reads
69
+ * as a number; kolbox's field keys: one press selects it, the arrows step it (Shift ten steps), Escape restores the value
70
+ * from before the edit. Chrome in kol-theme `.kol-slider--kolbox`. */
71
+ function SliderKolbox({ value, min, max, step, onChange, formatValue, readout = 'value', ariaLabel, stops, className = '' }) {
72
+ const [draft, setDraft] = useState(null)
73
+ const before = useRef(value)
74
+ const format = formatValue ?? ((v) => v)
75
+ const p = Math.min(100, Math.max(0, ((value - min) / (max - min)) * 100))
76
+ /* a stop: a 2 mark on the track, under the thumb's centre at that value (the thumb is 12, so its centre runs 6 to
77
+ the width less 6) */
78
+ const marks = stops?.length > 0 && stops.map((v) => (
79
+ <span key={v} data-slider-stop={v} className="pointer-events-none absolute top-1/2 size-0.5 -translate-x-1/2 -translate-y-1/2 rounded-full bg-oq-64"
80
+ style={{ left: `calc(6px + (100% - 12px) * ${(v - min) / (max - min)})` }} />
81
+ ))
82
+ const input = (
83
+ <input
84
+ type="range"
85
+ className="kol-slider-input min-w-0 flex-1"
86
+ style={{ '--p': `${p}%` }}
87
+ aria-label={ariaLabel}
88
+ value={value}
89
+ min={min}
90
+ max={max}
91
+ step={step}
92
+ onChange={(e) => onChange?.(Number(e.target.value))}
93
+ />
94
+ )
95
+ const range = marks ? <span className="relative flex min-w-0 flex-1 items-center">{input}{marks}</span> : input
96
+ if (readout === 'input') {
97
+ return (
98
+ <div className={`kol-slider--kolbox flex h-(--kol-kolbox-ctl) min-w-0 items-center gap-0.5 ${className}`}>
99
+ <div className="kol-slider-field flex h-(--kol-kolbox-ctl) min-w-0 flex-1 items-center px-2">{range}</div>
100
+ <input
101
+ type="text"
102
+ inputMode="decimal"
103
+ aria-label={ariaLabel}
104
+ className="kol-slider-number field-sizing-content h-(--kol-kolbox-ctl) min-w-12 shrink-0 px-2 text-left outline-none focus-visible:outline-1 focus-visible:-outline-offset-1"
105
+ value={draft ?? String(format(value))}
106
+ onChange={(e) => {
107
+ /* parseFloat: a formatted value keeps its unit while it is typed ("45°") */
108
+ const s = e.target.value, n = parseFloat(s)
109
+ setDraft(s)
110
+ if (s.trim() !== '' && Number.isFinite(n)) onChange?.(n)
111
+ }}
112
+ onMouseDown={selectOnFirstPress}
113
+ onFocus={() => { before.current = value }}
114
+ onBlur={() => setDraft(null)}
115
+ onKeyDown={(e) => {
116
+ if (e.key === 'Enter') { e.preventDefault(); e.currentTarget.blur(); return }
117
+ /* Escape puts back the value from before the edit and leaves the field (kolbox's field, useKolboxField) */
118
+ if (e.key === 'Escape') { e.preventDefault(); e.stopPropagation(); setDraft(null); if (before.current !== value) onChange?.(before.current); e.currentTarget.blur(); return }
119
+ if (e.key !== 'ArrowUp' && e.key !== 'ArrowDown') return
120
+ e.preventDefault()
121
+ const dec = String(step).split('.')[1]?.length ?? 0
122
+ const by = (e.shiftKey ? 10 : 1) * (e.key === 'ArrowUp' ? step : -step)
123
+ const n = Math.min(max, Math.max(min, value + by))
124
+ setDraft(null)
125
+ before.current = Number(n.toFixed(dec))
126
+ onChange?.(before.current)
127
+ const el = e.currentTarget
128
+ requestAnimationFrame(() => { if (document.activeElement === el) el.select() })
129
+ }}
130
+ />
131
+ </div>
132
+ )
133
+ }
134
+ return (
135
+ <div className={`kol-slider--kolbox flex h-(--kol-kolbox-ctl) min-w-0 items-center gap-3 ${className}`}>
136
+ {range}
137
+ <span className="kol-slider-value w-10 shrink-0 text-right">{format(value)}</span>
138
+ </div>
139
+ )
140
+ }
141
+
62
142
  const Slider = ({
63
143
  label,
64
144
  min = 0,
@@ -86,6 +166,7 @@ const Slider = ({
86
166
  direction,
87
167
  height,
88
168
  onHold,
169
+ stops,
89
170
  'aria-label': ariaLabel,
90
171
  }) => {
91
172
  /* Label ↔ input pairing — the <label> is a sibling of the range input, so
@@ -184,6 +265,24 @@ const Slider = ({
184
265
  onChange(defaultValue ?? min)
185
266
  }
186
267
 
268
+ if (variant === 'kolbox') {
269
+ return <SliderKolbox value={value} min={min} max={max} step={step} onChange={onChange} formatValue={formatValue} readout={readout} ariaLabel={ariaLabel} stops={stops} className={className} />
270
+ }
271
+
272
+ /* folio (Folio migration batch A, 2026-11-22): Folio's Slider carried class for class (apps/folio Chrome.jsx): a 24
273
+ * row, the native range (its track and thumb in kol-theme `.kol-slider--folio`), the value beside it, 32 wide */
274
+ if (variant === 'folio') {
275
+ const format = formatValue ?? ((n) => n)
276
+ const run = `${((value - min) / (max - min)) * 100}%`
277
+ return (
278
+ <div className={`kol-slider--folio flex h-[24px] w-full items-center gap-[12px] ${className}`}>
279
+ <input type="range" min={min} max={max} step={step} value={value} onChange={handleChange} aria-label={ariaLabel} style={{ '--run': run }}
280
+ className="kol-slider-input h-[24px] min-w-0 flex-1 cursor-pointer appearance-none bg-transparent" />
281
+ <span className="kol-slider-value w-[32px] shrink-0 text-right tabular-nums">{format(value)}</span>
282
+ </div>
283
+ )
284
+ }
285
+
187
286
  if (variant === 'panel') {
188
287
  return <SliderPanel value={value} onChange={onChange} min={min} max={max} step={step} label={label} direction={direction} height={height} onHold={onHold} />
189
288
  }
@@ -66,14 +66,12 @@ import { glyphSize } from '../hooks/glyphLadders.js'
66
66
  * @param {string} props.className - Additional classes on the trigger
67
67
  */
68
68
 
69
- /* Corner fold marker — `fold-indicator`, promoted into kol-icon-set-interface
70
- * 2026-09-03 from kol-fxr's own drawing (editor-set-is-behind-its-source); the
71
- * comment that stood here said it did not exist yet and should be promoted, so
72
- * this is that. Lives inside the button so it dims with kol-btn-quiet and
73
- * inverts with kol-btn-pressed (currentColor). */
69
+ /* Corner fold marker — drawn here, not an icon: it belongs to this button only
70
+ * (out of the icon set 2026-11-23, his ruling). Lives inside the button so it dims
71
+ * with kol-btn-quiet and inverts with kol-btn-pressed (currentColor). */
74
72
  const FoldIndicator = () => (
75
73
  <span aria-hidden="true" className="pointer-events-none absolute right-0.5 bottom-0.5 opacity-70 inline-flex">
76
- <IconLoader name="fold-indicator" size={4} />
74
+ <svg width="4" height="4" viewBox="0 0 4 4" fill="none"><path d="M0 4L4 4L4 0Z" fill="currentColor" /></svg>
77
75
  </span>
78
76
  )
79
77
 
@@ -68,6 +68,11 @@ function PaintChip({ id, label, color, slot, onSwap }) {
68
68
  * @param {'fill'|'stroke'} activePaint which chip paints on top. Default 'fill'
69
69
  * @param {Function} onSwap () => void — either chip or the swap arrow
70
70
  * @param {Function} onClear () => void — the "set to none" marker
71
+ * @param {'default'|'kolbox'} variant `kolbox` (kolbox's SwatchStack, plan-2026-11-18-kolbox-system W31.2, 2026-11-18,
72
+ * carried class for class): the stack scaled into the 32 dock cell, 16 chips at 4 / 4 and 12 / 11, each with a halo of
73
+ * the ground then the oq-24 line; the swap arrow (your icons' `swap`, 12) top right in oq-64, the ink on hover; the
74
+ * none marker an 8 disc of the ink with the error slash. Chrome in kol-theme `.kol-swatch-stack--kolbox`.
75
+ * @param {string} className kolbox: extra classes on the stack
71
76
  */
72
77
  export function SwatchStack({
73
78
  fillColor = '#FFFFFF',
@@ -75,7 +80,30 @@ export function SwatchStack({
75
80
  activePaint = 'fill',
76
81
  onSwap,
77
82
  onClear,
83
+ variant = 'default',
84
+ className = '',
78
85
  }) {
86
+ if (variant === 'kolbox') {
87
+ const chip = (key, label, pos) => (
88
+ <button key={key} type="button" aria-label={label} onClick={onSwap} data-paint={label}
89
+ className={`kol-swatch-stack-chip absolute size-4 rounded-full outline-none focus-visible:outline-solid focus-visible:outline-1 ${pos}`}
90
+ style={{ background: key === 'fill' ? fillColor : strokeColor }} />
91
+ )
92
+ const fill = chip('fill', 'Fill color', 'top-1 left-1')
93
+ const stroke = chip('stroke', 'Stroke color', 'top-3 left-[11px]')
94
+ return (
95
+ <div className={`kol-swatch-stack--kolbox relative size-8 shrink-0 ${className}`.trim()} data-swatch-stack={activePaint}>
96
+ {activePaint === 'fill' ? [stroke, fill] : [fill, stroke]}
97
+ <button type="button" aria-label="Swap colors" onClick={onSwap}
98
+ className="kol-swatch-stack-swap absolute top-0 right-0 inline-flex outline-none focus-visible:outline-solid focus-visible:outline-1">
99
+ <IconLoader name="swap" size={12} className="kol-kolbox-icon shrink-0" />
100
+ </button>
101
+ <button type="button" aria-label="Clear color" onClick={onClear}
102
+ className="kol-swatch-stack-none absolute bottom-0 left-0 size-2 overflow-hidden rounded-full" />
103
+ </div>
104
+ )
105
+ }
106
+
79
107
  const fill = <PaintChip key="fill" id="fill" label="Fill color" color={fillColor} slot={FILL_SLOT} onSwap={onSwap} />
80
108
  const stroke = <PaintChip key="stroke" id="stroke" label="Stroke color" color={strokeColor} slot={STROKE_SLOT} onSwap={onSwap} />
81
109
 
@@ -0,0 +1,39 @@
1
+ /* taxonomy-ok: molecule — a listbox of swatches, the current one ringed */
2
+
3
+ /**
4
+ * SwatchGrid — Pick one color from a grid of swatches (plan-2026-11-18-kolbox-system W31.2 batch 4, 2026-11-18;
5
+ * kolbox's, the swatches under "On this page" in its color popover). Squares at radius 2, 8 across, 8 apart; each ringed
6
+ * by a 1px oq-24 line inside it, the current one by a 2px accent ring 1 off the secondary surface. A listbox of options,
7
+ * each named by its color. Its one look. Input.
8
+ *
9
+ * @param {string[]} colors any CSS colors
10
+ * @param {string} [value] the current one
11
+ * @param {Function} [onChange] `(color)`
12
+ * @param {string} [className]
13
+ * @param {'folio'|'kolbox'} [variant] `folio` (Folio's Swatches, Folio batch C, 2026-11-22, carried class for class): a row of
14
+ * the caller's swatches (`children`, each a `ColorSwatch variant="folio"`), 8 apart, a group named by `aria-label`;
15
+ * `colors`, `value` and `onChange` are not read. `kolbox` with `children` (Folio on kolbox, 2026-11-22): the same row of
16
+ * the caller's swatches (`ColorSwatch variant="kolbox"`), 8 apart; without children, kolbox's grid as above.
17
+ */
18
+ export default function SwatchGrid({ colors = [], value, onChange, className = '', variant, children, ...rest }) {
19
+ /* kolbox (Folio on kolbox, 2026-11-22) with `children`: a row of the caller's swatches (`ColorSwatch variant="kolbox"`),
20
+ 8 apart as the grid's, wrapping; a group named by `aria-label` */
21
+ if (variant === 'kolbox' && children) return <div role="group" aria-label={rest['aria-label']} className={`flex flex-wrap gap-2 ${className}`.trim()}>{children}</div>
22
+ if (variant === 'folio') return <div role="group" aria-label={rest['aria-label']} className={`flex gap-[8px] ${className}`.trim()}>{children}</div>
23
+ return (
24
+ <div role="listbox" aria-label="Swatches" className={`grid grid-cols-8 gap-2 ${className}`}>
25
+ {colors.map((c) => (
26
+ <button
27
+ key={c}
28
+ type="button"
29
+ role="option"
30
+ aria-label={c}
31
+ aria-selected={c === value}
32
+ onClick={() => onChange?.(c)}
33
+ className={`kol-swatch-grid-cell${c === value ? ' is-current ring-2 ring-offset-1' : ' ring-1 ring-inset'} aspect-square outline-none`}
34
+ style={{ background: c }}
35
+ />
36
+ ))}
37
+ </div>
38
+ )
39
+ }
@@ -0,0 +1,131 @@
1
+ import { IconLoader } from '@kolkrabbi/kol-icons'
2
+ import Button from '../atoms/Button.jsx'
3
+ import KolboxGlyph from '../utilities/kolboxGlyph.jsx'
4
+
5
+ /**
6
+ * TabsDocument — A strip of open documents. One tab per open document (its glyph, its name, its close), the current one
7
+ * on its own ground, a plus after the last that opens a new one (plan-2026-11-22 folio-on-kolbox; drawn after Figma's
8
+ * desktop tab strip, his reference). Holds no document state and no router: the host passes the tabs and answers the
9
+ * callbacks. `TabsRow` switches views inside a page; this strip switches documents, so it carries close, unsaved, open
10
+ * beside and drag, which TabsRow does not.
11
+ *
12
+ * A tablist of tabs: arrow keys, Home and End move between the tabs (Enter or Space opens one); each tab's close button
13
+ * is in the Tab order, named "Close <name>".
14
+ *
15
+ * <TabsDocument variant="kolbox" tabs={[{ value: '/a', label: 'notes.md', icon: 'file-md', dirty: true }]}
16
+ * value="/a" onChange={open} onClose={close} onNew={create} />
17
+ *
18
+ * @param {'kolbox'|'folio'} [variant='folio'] - The look. `kolbox` (the editor style): a 40 strip on the panel ground with
19
+ * the field line under it, tabs 12 / 16, the current one on the field wash (light: the top rail's track pair, canvas
20
+ * strip and ground tab), the others flat in oq-64; the glyph 16, the close a kolbox icon button; an unsaved tab shows a
21
+ * dot in the close's place until hovered. `folio` (the default): Folio's own strip, carried class for class from
22
+ * apps/folio's FolioWrite (44 high, 36 tabs on the paper, Inter 11, a text "New"); it draws no glyph.
23
+ * @param {Array<{ value: string, label: string, icon?: string, dirty?: boolean }>} tabs - The open documents, in order.
24
+ * `icon` is the document kind's glyph by your icons' name (kolbox only; `file` when unset); `dirty` shows the unsaved dot
25
+ * @param {string} [value] - The current tab's value
26
+ * @param {(value: string) => void} [onChange] - A tab pressed (the current one included, as Folio's tab button is)
27
+ * @param {(value: string) => void} [onClose] - A tab's close pressed; no close button without it
28
+ * @param {() => void} [onNew] - The plus after the last tab; none without it
29
+ * @param {string} [newLabel='New'] - The plus's name (folio: its visible text)
30
+ * @param {string} [paired] - The tab open beside the current one (a split): drawn on the current ground; folio chains the two
31
+ * with its green line
32
+ * @param {(value: string) => void} [onOpenBeside] - A tab's "Open beside" button (shown on hover, not on the current or the
33
+ * paired tab); none without it
34
+ * @param {() => void} [onCloseSplit] - With `paired`, a "Close split" button after the tabs
35
+ * @param {(event: MouseEvent, tab: object) => void} [onTabContextMenu] - A tab's context menu; the host opens its menu
36
+ * @param {(event: DragEvent, tab: object) => void} [onTabDragStart] - Makes the other tabs draggable (not the current one);
37
+ * the host sets the drag data
38
+ * @param {string} [ariaLabel='Open documents'] - Names the tablist
39
+ * @param {string} [className] - Extra classes on the strip
40
+ */
41
+ export default function TabsDocument({
42
+ variant = 'folio', tabs = [], value, onChange, onClose, onNew, newLabel = 'New', paired,
43
+ onOpenBeside, onCloseSplit, onTabContextMenu, onTabDragStart, ariaLabel = 'Open documents', className = '',
44
+ }) {
45
+ const kolbox = variant === 'kolbox'
46
+ const focusable = tabs.some((t) => t.value === value) ? value : tabs[0]?.value
47
+ /* arrows, Home and End move the focus between the tabs; the host opens one on Enter or Space (the tab is a button) */
48
+ const onKeyDown = (e) => {
49
+ const all = [...e.currentTarget.querySelectorAll('[role="tab"]')]
50
+ const at = all.indexOf(document.activeElement)
51
+ if (at < 0) return
52
+ const to = { ArrowRight: at + 1, ArrowLeft: at - 1, Home: 0, End: all.length - 1 }[e.key]
53
+ if (to == null) return
54
+ e.preventDefault()
55
+ all[(to + all.length) % all.length]?.focus()
56
+ }
57
+ const cell = (t) => ({
58
+ onContextMenu: onTabContextMenu ? (e) => onTabContextMenu(e, t) : undefined,
59
+ draggable: Boolean(onTabDragStart) && t.value !== value,
60
+ onDragStart: onTabDragStart ? (e) => onTabDragStart(e, t) : undefined,
61
+ })
62
+ const tabProps = (t) => ({
63
+ type: 'button', role: 'tab', 'aria-selected': t.value === value, tabIndex: t.value === focusable ? 0 : -1,
64
+ onClick: () => onChange?.(t.value),
65
+ })
66
+
67
+ if (kolbox) {
68
+ return (
69
+ <div role="tablist" aria-label={ariaLabel} onKeyDown={onKeyDown}
70
+ className={`kol-tabs-document--kolbox relative flex h-10 shrink-0 items-stretch overflow-x-auto [scrollbar-width:none] after:pointer-events-none after:absolute after:inset-x-0 after:bottom-0 after:h-px after:content-[''] ${className}`.trim()}>
71
+ {tabs.map((t) => {
72
+ const on = t.value === value
73
+ const lit = on || t.value === paired
74
+ const closeShown = on && !t.dirty
75
+ return (
76
+ <div key={t.value} role="presentation" {...cell(t)}
77
+ className={`kol-tabs-document-tab${lit ? ' is-active' : ''} group relative flex shrink-0 items-center gap-1 pr-2 pl-3`}>
78
+ <button {...tabProps(t)} className="kol-tabs-document-label flex min-w-0 items-center gap-2 self-stretch outline-none focus-visible:outline-solid focus-visible:outline-1">
79
+ <KolboxGlyph name={t.icon || 'file'} className="kol-tabs-document-glyph" />
80
+ <span className="max-w-[220px] truncate">{t.label}</span>
81
+ </button>
82
+ {onOpenBeside && !lit && (
83
+ <Button variant="kolbox" iconOnly="panel-right" aria-label={`Open ${t.label} beside`} onClick={() => onOpenBeside(t.value)}
84
+ className="opacity-0 group-hover:opacity-100 focus-visible:opacity-100" />
85
+ )}
86
+ {onClose && (
87
+ <span className="relative flex size-(--kol-kolbox-ctl) items-center justify-center">
88
+ {t.dirty && <span aria-label="Unsaved changes" role="img" className="kol-tabs-document-dot pointer-events-none absolute size-1.5 rounded-full group-hover:opacity-0 group-focus-within:opacity-0" />}
89
+ <Button variant="kolbox" iconOnly="x" aria-label={`Close ${t.label}`} onClick={() => onClose(t.value)}
90
+ className={closeShown ? '' : 'opacity-0 group-hover:opacity-100 group-focus-within:opacity-100'} />
91
+ </span>
92
+ )}
93
+ </div>
94
+ )
95
+ })}
96
+ {paired && onCloseSplit && (
97
+ <span className="flex shrink-0 items-center px-2">
98
+ <Button variant="kolbox" tone="ghost" iconLeft="panel-right" onClick={onCloseSplit}>Close split</Button>
99
+ </span>
100
+ )}
101
+ {onNew && (
102
+ <span className="flex shrink-0 items-center px-2">
103
+ <Button variant="kolbox" iconOnly="plus" aria-label={newLabel} onClick={onNew} />
104
+ </span>
105
+ )}
106
+ </div>
107
+ )
108
+ }
109
+
110
+ /* folio: FolioWrite's strip (13.3, W18) class for class; its colors are rules on the folio tokens (kol-components-molecules.css) */
111
+ return (
112
+ <div role="tablist" aria-label={ariaLabel} onKeyDown={onKeyDown}
113
+ className={`kol-tabs-document--folio flex h-[44px] shrink-0 items-end gap-[2px] overflow-x-auto px-[56px] [scrollbar-width:none] ${className}`.trim()}>
114
+ {tabs.map((t) => {
115
+ const on = t.value === value
116
+ const chained = paired && (on || t.value === paired)
117
+ return (
118
+ <div key={t.value} role="presentation" {...cell(t)}
119
+ className={`kol-tabs-document-tab${on || t.value === paired ? ' is-active' : ''}${chained ? ' is-chained' : ''} group flex h-[36px] shrink-0 items-center gap-[8px] rounded-t-[3px] pl-[14px] pr-[6px]`}>
120
+ <button {...tabProps(t)} className={`kol-tabs-document-label kol-folio-meta max-w-[220px] truncate${on ? ' is-current font-semibold' : ''}`}>{t.label}</button>
121
+ {t.dirty && <span aria-label="Unsaved changes" role="img" className="kol-tabs-document-dot size-[6px] rounded-full" />}
122
+ {onOpenBeside && !on && t.value !== paired && <button type="button" aria-label={`Open ${t.label} beside`} title="Open beside" onClick={() => onOpenBeside(t.value)} className="kol-tabs-document-btn flex size-[20px] items-center justify-center rounded-[3px] opacity-0 group-hover:opacity-100"><IconLoader name="panel-right" size={12} /></button>}
123
+ {onClose && <button type="button" aria-label={`Close ${t.label}`} onClick={() => onClose(t.value)} className="kol-tabs-document-btn flex size-[20px] items-center justify-center rounded-[3px] opacity-60 hover:opacity-100"><IconLoader name="x" size={12} /></button>}
124
+ </div>
125
+ )
126
+ })}
127
+ {paired && onCloseSplit && <button type="button" onClick={onCloseSplit} className="kol-tabs-document-text kol-folio-meta flex h-[36px] shrink-0 items-center gap-[6px] px-[12px]"><IconLoader name="panel-right" size={12} />Close split</button>}
128
+ {onNew && <button type="button" onClick={onNew} className="kol-tabs-document-text kol-folio-meta flex h-[36px] shrink-0 items-center gap-[6px] px-[12px]"><IconLoader name="plus" size={12} />{newLabel}</button>}
129
+ </div>
130
+ )
131
+ }
@@ -34,7 +34,7 @@ import { floatSurfaceClass } from '../utilities/tone.js'
34
34
  * keeps one line that scrolls sideways with no scrollbar, `.kol-scroll-fade--x` fading the clipped edge(s), and the
35
35
  * active tab scrolled into view when it changes — arrow keys included; `wrap` breaks the tabs onto a second line.
36
36
  * Every variant but `stacked`, which has its phone bar
37
- * @param {'underline'|'chip'|'text'|'stacked'|'float'} [variant='underline'] `float` (W16, round 3): `chip`'s row as the floating
37
+ * @param {'underline'|'chip'|'text'|'stacked'|'float'|'kolbox'} [variant='underline'] `kolbox` (W31.2 batch 3): kolbox's tab track, see `TabsKolbox` below; takes `tabs`, `value`, `onChange`, `size` (sm, md) and `className` only. `float` (W16, round 3): `chip`'s row as the floating
38
38
  * style's capsules — float heights (28/36/44, touch 36/44/52), 4 apart, the selected one oq-16
39
39
  * @param {string} [look] @deprecated 2026-10-30 — the old spelling of `variant`; `variant` wins when both are passed
40
40
  * @param {'mono'|'sans'|'mono-light'} [type='mono'] `underline` only: the tab's type — `mono-light` is `sans`'s row on JetBrains Mono at 300 (his word, 2026-10-30)
@@ -94,6 +94,39 @@ import { floatSurfaceClass } from '../utilities/tone.js'
94
94
  * Tabs are `{ id, label }` or `{ value, label }` (either key), plus `icon` for stacked; a stacked tab's `selected`
95
95
  * lights it whatever `value` is — action slots (the transport) light more than one.
96
96
  */
97
+ /* `variant="kolbox"` (plan-2026-11-18-kolbox-system W31.2 batch 3, 2026-11-18): kolbox's Tabs carried class for class,
98
+ * chrome in kol-theme `.kol-tabs--kolbox`. `size` sm (its default) the tab track: the kolbox control height (`--kol-kolbox-ctl`, 24) on the oq-16 field, radius 6,
99
+ * 2 in, the tabs 1 apart at radius 4, 12 in, the current one oq-24 in the ink; md the top rail's mode track: 32 on the
100
+ * ground (24 tabs, as every control; 36 until 2026-11-19, plan-2026-11-19 C9.1), radius 8, 4 in, the tabs touching, 8 in, the current one oq-16 with the accent label. Inter 12 / 16 / 500, the
101
+ * rest oq-64, the ink on hover. Tabs are strings or `{ value, label, disabled, tooltip }`: a disabled tab is 40%, takes
102
+ * no hover or focus and shows its `tooltip` in `Tooltip variant="kolbox"` (batch 4; the `tooltipComponent` seam is gone). In a track narrower than the labels and their padding the tabs share it
103
+ * equally and the padding gives way. */
104
+ function TabsKolbox({ tabs = [], value, onChange, size = 'sm', className = '' }) {
105
+ const md = size === 'md'
106
+ return (
107
+ <div role="tablist" className={`kol-tabs--kolbox kol-tabs--kolbox-${md ? 'md' : 'sm'} inline-flex items-center ${md ? 'h-8 p-1' : 'h-(--kol-kolbox-ctl) gap-px p-0.5'} ${className}`}>
108
+ {tabs.map((t) => {
109
+ const { value: v, label, disabled, tooltip } = typeof t === 'string' ? { value: t, label: t } : t
110
+ const on = v === value
111
+ const tab = (
112
+ <button
113
+ key={v}
114
+ type="button"
115
+ role="tab"
116
+ aria-selected={on}
117
+ disabled={disabled}
118
+ onClick={() => onChange?.(v)}
119
+ className={`kol-tabs-tab${on ? ' is-active' : ''} flex h-full min-w-0 flex-1 items-center justify-center ${md ? 'px-2' : 'px-3'} whitespace-nowrap outline-none focus-visible:outline-solid focus-visible:outline-1 disabled:opacity-40`}
120
+ >
121
+ {label}
122
+ </button>
123
+ )
124
+ return tooltip ? <span key={v} className="flex h-full flex-1 [&>span]:h-full [&>span]:flex-1 [&_button]:w-full">{<Tooltip variant="kolbox" label={tooltip}>{tab}</Tooltip>}</span> : tab
125
+ })}
126
+ </div>
127
+ )
128
+ }
129
+
97
130
  export const TABBAR_H = 56
98
131
  /* the pill's height (W16, round 3 — fxr's live nav: was TABBAR_H) — a page under it owes TABBAR_PILL_H + TABBAR_PILL_INSET */
99
132
  export const TABBAR_PILL_H = 66
@@ -119,6 +152,7 @@ export const tabbarPillSlot = (at, { count, labels = false, split = false } = {}
119
152
  const COLLAPSE_MS = 300
120
153
 
121
154
  export default function TabsRow({ tabs: raw = [], value, onChange, onClose, onMinimise, variant, look: lookLegacy, type, trailing, filled = false, placement = 'inline', shape = 'bar', collapsed = false, onExpand, edge, border, shadow, dock, active, foldable, folded, onFoldChange, foldSide, foldTone, surface, split, labels, size, tracked = false, overflow = 'scroll', ariaLabel, className, style }) {
155
+ if (variant === 'kolbox') return <TabsKolbox tabs={raw} value={value} onChange={onChange} size={size} className={className} />
122
156
  const tabs = raw.map((t) => ({ ...t, id: t.id ?? t.value }))
123
157
  const look = variant ?? lookLegacy ?? 'underline'
124
158
  const wrap = overflow === 'wrap'
@@ -0,0 +1,55 @@
1
+ import { useEffect, useState } from 'react'
2
+ import Link from '../atoms/Link.jsx'
3
+
4
+ /* taxonomy-ok: molecule — a message and a Link on one floating row */
5
+
6
+ /**
7
+ * Toast — One short message on a floating row, with one action (plan-2026-11-18-kolbox-system W31.2 batch 4,
8
+ * 2026-11-18; kolbox's Toast, Figma 288:7452). One row: the message (Inter 11 / 15 medium, the ink) then one `Link`,
9
+ * 12 apart; padding 8 top and bottom, 12 right, 16 left; radius 12; the secondary surface on the one floating surface
10
+ * (`.kol-kolbox-surface`), clipped. Its one look. Feedback.
11
+ *
12
+ * toast({ message: 'Saved', action: 'Show in Files', onAction }) // from anywhere: raises it in the ToastHost
13
+ * <ToastHost /> // once, at the app's root
14
+ *
15
+ * @param {string} [message] the message
16
+ * @param {string} [action] the Link's words; none, no Link
17
+ * @param {Function} [onAction] the Link's press
18
+ */
19
+ export default function Toast({ message = 'File moved', action = 'Show in kol-ds-ui [library files]', onAction }) {
20
+ return (
21
+ <div role="status" data-toast
22
+ className="kol-toast kol-kolbox-surface flex items-center gap-3 overflow-clip py-2 pr-3 pl-4">
23
+ <span className="kol-toast-message shrink-0 whitespace-nowrap">{message}</span>
24
+ {action && <Link onClick={onAction}>{action}</Link>}
25
+ </div>
26
+ )
27
+ }
28
+
29
+ /* The window event a toast rides on (kolbox's was `kolbox:toast`; KOL's events are `kol:`). */
30
+ const TOAST_EVENT = 'kol:toast'
31
+
32
+ /** toast — raise one Toast in the ToastHost: `toast({ message, action, onAction })`. */
33
+ export const toast = (detail) => window.dispatchEvent(new CustomEvent(TOAST_EVENT, { detail }))
34
+
35
+ /**
36
+ * ToastHost — The one toast on screen: at the foot of the window, centred, 80 up so it clears an editor's dock, for
37
+ * 4 s or until the next one. Mount it once.
38
+ */
39
+ export function ToastHost() {
40
+ const [t, setT] = useState(null)
41
+ useEffect(() => {
42
+ let timer
43
+ const on = (e) => { clearTimeout(timer); setT({ ...e.detail, key: Date.now() }); timer = setTimeout(() => setT(null), 4000) }
44
+ window.addEventListener(TOAST_EVENT, on)
45
+ return () => { window.removeEventListener(TOAST_EVENT, on); clearTimeout(timer) }
46
+ }, [])
47
+ if (!t) return null
48
+ return (
49
+ <div className="pointer-events-none fixed inset-x-0 bottom-20 z-50 flex justify-center">
50
+ <div className="pointer-events-auto">
51
+ <Toast key={t.key} message={t.message} action={t.action} onAction={() => { t.onAction?.(); setT(null) }} />
52
+ </div>
53
+ </div>
54
+ )
55
+ }
@@ -1,4 +1,5 @@
1
1
  import { IconLoader } from '@kolkrabbi/kol-icons'
2
+ import KolboxGlyph from '../utilities/kolboxGlyph.jsx'
2
3
 
3
4
  /* taxonomy-ok: molecule — nests kol-icons's Icon. */
4
5
 
@@ -17,6 +18,11 @@ import { IconLoader } from '@kolkrabbi/kol-icons'
17
18
  * of the active row: the emphasis ink, no lift. `count` sits right in mono (`kol-float-ruler`, fg-64). A row with
18
19
  * `expanded` defined draws the chevron at its end — right when shut, down when open — and `onToggle` is its press.
19
20
  *
21
+ * `variant="kolbox"` (W31.2 batch 5): kolbox's ListRow, below.
22
+ *
23
+ * `variant="folio"` (Folio migration batch D): Folio's library tree rows, below; `linkComponent` is its router seam.
24
+ *
25
+ * @param {'default'|'kolbox'|'folio'} [variant]
20
26
  * @param {'xs'|'sm'|'md'|'lg'} [size='sm']
21
27
  * @param {string} [icon]
22
28
  * @param {ReactNode} label
@@ -38,7 +44,7 @@ export const TREE_ROW = {
38
44
  lg: { h: 'h-10', ic: 18, type: 'font-[family-name:var(--kol-font-family-float)] text-[13px] leading-[18px]' },
39
45
  }
40
46
 
41
- export default function TreeRow({ size = 'sm', icon, label, count, active = false, open = false, expanded, onToggle, depth = 0, href, onClick, trailing, className = '', ...rest }) {
47
+ function TreeRowDefault({ size = 'sm', icon, label, count, active = false, open = false, expanded, onToggle, depth = 0, href, onClick, trailing, className = '', ...rest }) {
42
48
  const S = TREE_ROW[size] ?? TREE_ROW.sm
43
49
  const bright = active || open
44
50
  const Tag = href ? 'a' : 'button'
@@ -70,3 +76,83 @@ export default function TreeRow({ size = 'sm', icon, label, count, active = fals
70
76
  </Tag>
71
77
  )
72
78
  }
79
+
80
+ /* `variant="kolbox"` (plan-2026-11-18-kolbox-system W31.2 batch 5, 2026-11-18): kolbox's ListRow (the file's ListRow
81
+ * 27:9332), carried from apps/kolbox/src/ui/ListRow.jsx. Its four rows are `size`: xs 24 (the plain row, 8 in, a 16
82
+ * glyph), sm 28 (HomeRail's row, a 20 glyph, 6 in), md 30 (the Styles rows, 6 in), lg 40 (the search modal's result, a
83
+ * 20 glyph, 12 in). `active` is the field fill and, on xs and sm, the accent label with a 2 by 14 accent bar at the left
84
+ * edge. `tree` is a 32 row (Figma's layer row, W3) with a 36 lead (the 12 chevron at its left, the 16 type glyph at its right), 8 in, and 24 of indent
85
+ * per `depth`; `expanded` turns the chevron, and a row with no children (`expanded` undefined) keeps its place empty.
86
+ * `onToggle` makes the chevron its own target (the row's click still selects). `dimmed`: the lead and label at 40%.
87
+ * Glyphs are your icons by the set's name (KolboxGlyph). Other props land on the row's button. */
88
+ const TREE_ROW_KOLBOX = {
89
+ xs: { row: 'h-6 gap-2', bar: 'before:absolute before:top-1/2 before:-translate-y-1/2 before:left-0 before:h-3.5 before:w-0.5 before:rounded-xs', icon: 16, pad: 'var(--kol-spacing-2)' },
90
+ sm: { row: 'relative h-7 gap-2.5', bar: 'before:absolute before:top-1.75 before:left-0 before:h-3.5 before:w-0.5', icon: 18, pad: '6px' },
91
+ lg: { row: 'h-10 gap-3', bar: '', icon: 20, pad: 'var(--kol-spacing-3)' },
92
+ md: { row: 'h-7.5 gap-2', bar: '', icon: 16, pad: '6px' },
93
+ }
94
+ function TreeRowKolbox({ size = 'xs', icon, label, depth = 0, tree: treeProp = false, expanded, onToggle, active = false, dimmed = false, disabled = false, onClick, trailing, count, href, linkComponent: Link = 'a', className = '', ...rest }) {
95
+ const v = TREE_ROW_KOLBOX[size] ?? TREE_ROW_KOLBOX.xs
96
+ /* Folio on kolbox (2026-11-22): a folder row (`expanded` defined) or a link row (`href`) of a caller that does not say
97
+ `tree` is drawn on the tree lead, so a library tree's shelves and their documents share kolbox's layer tree's column;
98
+ the folder's press is its toggle. `href` makes the row a link through `linkComponent` (a router's Link, given `to`;
99
+ else an anchor). `count` (when the caller does not say `tree`) sits at the right in the meta role. */
100
+ const implied = !treeProp && (expanded !== undefined || href != null)
101
+ const tree = treeProp || implied
102
+ const Tag = href != null ? Link : 'button'
103
+ const own = href != null ? (Link === 'a' ? { href } : { to: href }) : { type: 'button', disabled }
104
+ return (
105
+ <Tag
106
+ {...own}
107
+ aria-current={active || undefined}
108
+ aria-expanded={tree && expanded !== undefined ? expanded : undefined}
109
+ onClick={onClick ?? (implied && expanded !== undefined ? onToggle : undefined)}
110
+ className={`kol-tree-row--kolbox kol-tree-row--kolbox-${size} kol-tree-row--type-${tree ? 'xs' : size}${active ? ` is-active ${v.bar}` : ''} relative flex w-full min-w-0 shrink-0 items-center ${tree ? 'h-8 gap-2' : v.row} pr-2 text-left outline-none focus-visible:outline-solid focus-visible:outline-1 disabled:opacity-40 ${className}`.trim()}
111
+ style={{ paddingLeft: `calc(${tree ? 'var(--kol-spacing-2)' : v.pad} + ${depth} * var(--kol-spacing-6))` }}
112
+ {...rest}
113
+ >
114
+ {tree ? (
115
+ <span className={`relative h-4 w-9 shrink-0 ${dimmed ? 'opacity-40' : ''}`}>
116
+ {expanded !== undefined && (onToggle ? (
117
+ <span
118
+ role="button"
119
+ aria-label={expanded ? 'Collapse' : 'Expand'}
120
+ aria-expanded={expanded}
121
+ onClick={(e) => { e.stopPropagation(); onToggle() }}
122
+ onDoubleClick={(e) => e.stopPropagation()}
123
+ className="kol-tree-row-toggle absolute -top-0.5 -left-1 flex size-5 items-center justify-center"
124
+ >
125
+ <KolboxGlyph name={expanded ? 'chevron-down' : 'chevron-right'} />
126
+ </span>
127
+ ) : <KolboxGlyph name={expanded ? 'chevron-down' : 'chevron-right'} className="absolute top-0.5 left-0" />)}
128
+ {icon && <KolboxGlyph name={icon} className="kol-tree-row-type absolute top-0 right-0" />}
129
+ </span>
130
+ ) : icon && <KolboxGlyph name={icon} size={v.icon} className={size === 'sm' && !active ? 'kol-tree-row-icon--muted' : ''} />}
131
+ <span className={`min-w-0 flex-1 truncate ${dimmed ? 'opacity-40' : ''}`}>{label}</span>
132
+ {!treeProp && count != null && <span className="kol-tree-row-count--kolbox shrink-0 tabular-nums">{count}</span>}
133
+ {trailing}
134
+ </Tag>
135
+ )
136
+ }
137
+ /* `variant="folio"` (Folio migration batch D, 2026-11-22): the library tree's two rows, carried from apps/folio's
138
+ * EditorChrome.jsx LibraryTree. A row with `expanded` defined is a shelf: 32 high, 8 in, the 12 chevron leading (right
139
+ * when shut, down when open), the label in the ink, `count` at the right in the muted ink, `onToggle` its press. A row
140
+ * without is a document: 6 over and under, 28 in (under the shelf's label), truncated, the muted ink brightening on
141
+ * hover; `active` is the mint fill and the green ink. `href` makes it a link, through `linkComponent` (a router's Link,
142
+ * given `to`; else an anchor, given `href`). Type 11 / 400 (`kol-folio-meta`), in its own rule. Other props land on the
143
+ * row (Folio's `title`, `onContextMenu`). */
144
+ function TreeRowFolio({ label, count, expanded, onToggle, active = false, href, linkComponent: Link = 'a', className = '', ...rest }) {
145
+ const { variant: _v, ...own } = rest
146
+ if (expanded !== undefined) return (
147
+ <button type="button" aria-expanded={Boolean(expanded)} onClick={onToggle} className={`kol-tree-row--folio kol-tree-row--folio-shelf flex h-[32px] w-full items-center gap-[8px] rounded-[3px] px-[8px] text-left ${className}`.trim()} {...own}>
148
+ <IconLoader name={expanded ? 'chevron-down' : 'chevron-right'} size={12} />{label}{count != null && <span className="kol-tree-row-count ml-auto">{count}</span>}
149
+ </button>
150
+ )
151
+ const target = Link === 'a' ? { href } : { to: href }
152
+ return <Link {...target} aria-current={active ? 'page' : undefined} className={`kol-tree-row--folio${active ? ' is-active' : ''} block truncate rounded-[3px] py-[6px] pl-[28px] pr-[8px] ${className}`.trim()} {...own}>{label}</Link>
153
+ }
154
+
155
+ export default function TreeRow(props) {
156
+ if (props.variant === 'folio') return <TreeRowFolio {...props} />
157
+ return props.variant === 'kolbox' ? <TreeRowKolbox {...props} /> : <TreeRowDefault {...props} />
158
+ }
@@ -98,7 +98,7 @@ function FileImages({ images, cover, back, editing, onImages, onCover, onBack })
98
98
  return (
99
99
  <figure key={img.id} className="flex min-w-0 flex-col gap-1.5">
100
100
  <div className="relative">
101
- <button type="button" className="block aspect-square w-full overflow-hidden rounded-[var(--kol-radius-sm)] bg-fg-04" onClick={() => setLook(i)} aria-label={`Open ${label}`}>
101
+ <button type="button" className="block aspect-square w-full overflow-hidden rounded-[var(--kol-radius-4)] bg-fg-04" onClick={() => setLook(i)} aria-label={`Open ${label}`}>
102
102
  <img src={img.src} alt="" className="size-full object-cover" style={{ objectPosition: 'var(--kol-media-focus, center)' }} />
103
103
  </button>
104
104
  {/* the × in the card's own media-corner chrome (the download's plate), so it reads on a dark picture —
@@ -124,7 +124,7 @@ function FileImages({ images, cover, back, editing, onImages, onCover, onBack })
124
124
  {canEdit && (
125
125
  <figure className="flex min-w-0 flex-col gap-1.5">
126
126
  <button type="button" onClick={add} aria-label="Upload image"
127
- className="flex aspect-square w-full items-center justify-center rounded-[var(--kol-radius-sm)] border border-dashed border-[var(--kol-fg-24)] bg-[var(--kol-fg-02)] text-fg-48">
127
+ className="flex aspect-square w-full items-center justify-center rounded-[var(--kol-radius-4)] border border-dashed border-[var(--kol-fg-24)] bg-[var(--kol-fg-02)] text-fg-48">
128
128
  <IconLoader name="plus" size={20} />
129
129
  </button>
130
130
  <figcaption className="kol-mono-12 text-meta">Upload image</figcaption>