@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
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@kolkrabbi/kol-component",
3
- "version": "0.377.0",
3
+ "version": "0.379.0",
4
4
  "description": "The core component library",
5
5
  "license": "MIT",
6
6
  "type": "module",
@@ -32,9 +32,10 @@
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",
37
- "@kolkrabbi/kol-growth": "^0.5.0"
36
+ "@kolkrabbi/kol-markdown": "^0.2.0",
37
+ "@kolkrabbi/kol-growth": "^0.5.0",
38
+ "@kolkrabbi/kol-tuner": "^0.1.0"
38
39
  },
39
40
  "peerDependencies": {
40
41
  "@kolkrabbi/kol-icons": ">=0.69.0",
@@ -45,7 +46,7 @@
45
46
  "react-dom": "^18.3.0 || ^19.0.0"
46
47
  },
47
48
  "devDependencies": {
48
- "@kolkrabbi/kol-icons": "^0.71.0"
49
+ "@kolkrabbi/kol-icons": "^0.72.0"
49
50
  },
50
51
  "files": [
51
52
  "src",
@@ -140,7 +140,7 @@ export default function BezierPathEditor({
140
140
  ref={ref}
141
141
  role="group"
142
142
  aria-label={ariaLabel}
143
- className={`kol-bezier-path-editor relative w-full overflow-hidden touch-none select-none rounded-[var(--kol-radius-sm)] bg-[var(--kol-tone-bg,var(--kol-surface-secondary))] ${className}`.trim()}
143
+ className={`kol-bezier-path-editor relative w-full overflow-hidden touch-none select-none rounded-[var(--kol-radius-4)] bg-[var(--kol-tone-bg,var(--kol-surface-secondary))] ${className}`.trim()}
144
144
  style={{ aspectRatio: String(aspect) }}
145
145
  onPointerMove={onMove}
146
146
  onPointerUp={onUp}
@@ -1,8 +1,10 @@
1
- import { isValidElement } from 'react'
1
+ import { isValidElement, useContext } from 'react'
2
2
  import { toneClass, VARIANT_TONE } from '../utilities/tone.js'
3
3
  import { IconLoader } from '@kolkrabbi/kol-icons'
4
4
  import { glyphSize } from '../hooks/glyphLadders.js'
5
5
  import Kbd from './Kbd.jsx'
6
+ import KolboxGlyph from '../utilities/kolboxGlyph.jsx'
7
+ import { InTooltipKolbox, Tooltip } from '../utilities/Popover.jsx'
6
8
 
7
9
  /**
8
10
  * Button — canonical KOL button. Emits kol-btn* classes (CSS in @kol/theme).
@@ -36,9 +38,17 @@ import Kbd from './Kbd.jsx'
36
38
  * @param {boolean} props.selected - Selected/active state (toggle highlight)
37
39
  * @param {ElementType|ReactNode} props.iconComponent - Icon renderer seam — a component that receives `{ name, size, className, style }` in place of the DS Icon (custom icon registries plug in here), or a pre-rendered node dropped in verbatim where the glyph would go. Defaults to DS Icon.
38
40
  * @param {boolean} props.pressed - Toggle state — sets `aria-pressed` (true/false) and `kol-btn-pressed`; a `quiet` button drops its dimming while pressed. Leave undefined for non-toggle buttons.
41
+ * @param {'kolbox'} props.variant - also `kolbox` (plan-2026-11-18-kolbox-system W31.2 batch 3, 2026-11-18): kolbox's button, `--kol-kolbox-ctl` high (24), 12 in, radius 4, a 1px line, Inter 12 / 16 / 500, one size. Its grounds are tones: `primary` the accent with the on-accent ink (110% brightness on hover), `secondary` (also unset) the oq-16 field with the oq-24 line (the line's oq-24 on hover), `ghost` bare in oq-64 (the field and the ink on hover); `pressed` is its lit look (the accent tint, the accent ink) and sets aria-pressed. `iconLeft` is a 16 glyph 8 off the label. With `iconOnly` it is kolbox's icon button: a 28 box, the glyph in oq-64, the ink on hover over a 28 oq-16 frame drawn centred on the glyph, so a caller may set a 16 or 24 box and the frame still lights 28; `pressed` lights the frame in the accent tint with the accent glyph; `aria-pressed` is always set; `children` stand in for a glyph that is not an icon. The glyph is your icons by the set's name at 16 with the stroke lift (`.kol-kolbox-icon`, KolboxGlyph); `iconComponent` is not read here (C9.2: kolbox's data carries the set's names).
42
+ * @param {'folio'} props.variant - also `folio` (Folio migration batch A, 2026-11-22): Folio's buttons carried class for class, the chrome in kol-theme `.kol-btn--folio` and `.kol-icon-btn--folio`, the colors Folio's (`--kol-folio-*`). `size` picks the shape: `md` (default) Folio's editor tool, 32 high, 10 in, radius 3, Inter 11, a 16 `iconLeft` 8 off the label; `lg` Folio's page action, 42 high, 16 in, radius 3, a 1px line, the label 12 / 600 and its `glyph` (a character, 16) 12 after it. Grounds are tones: `ghost` (md's default) bare in the ink, the surface on hover; `outline` (lg's default) the paper with the rule line; `primary` the accent fill with the paper ink. `pressed` is its lit look (the accent's soft ground and strong ink) and sets aria-pressed. With `iconOnly` it is Folio's tool icon: a 32 square at radius 4, the glyph 20, the paper on hover, lit when `pressed`. A press does not take the focus (`mousedown` is prevented), so the editor's selection stays.
43
+ * @param {string} props.glyph - folio `lg` only: the character after the label (`+`, `⌄`, `→`)
39
44
  * @param {string} props.kbd - a key cap after the label, inside the button (float-everything W2 row 12, 2026-11-04): `Kbd size="sm"`, a leading ⌘ drawn as the `command` icon. On `variant="float"` the cap takes the button's own ink (`.kol-btn-kbd`). The float roles are tones (W0.5): primary `tone="inverted"` · secondary `tone="secondary"` · quiet `tone="ghost"` · destructive `tone="danger"` — `danger` is accepted as a tone on a float button so the role and the shape are two props.
40
45
  */
41
46
  const warned = new Set()
47
+ /* kolbox's grounds, by KOL's tone names; unset is its secondary. `outline` the line with no fill (Figma's browser
48
+ top bar: Share, the adjust and star boxes, 2026-11-23) */
49
+ const KOLBOX_TONES = ['primary', 'secondary', 'outline', 'ghost']
50
+ /* Folio's three grounds; unset is the shape's own (md ghost, lg outline) */
51
+ const FOLIO_TONES = ['primary', 'outline', 'ghost']
42
52
 
43
53
  const Button = ({
44
54
  children,
@@ -66,8 +76,11 @@ const Button = ({
66
76
  pressed,
67
77
  tone = 'default',
68
78
  kbd,
79
+ glyph,
69
80
  ...props
70
81
  }) => {
82
+ /* an icon-only kolbox button names itself in a tooltip unless it already sits in one */
83
+ const inTip = useContext(InTooltipKolbox)
71
84
  /* `variant="bare"` (MetricRebuild, 2026-10-31): a pressable SURFACE — a stat tile, a bar row, a column head — that
72
85
  * draws itself. No kol-btn chrome (ground, size, type, radius); the button keeps its type, the KOL focus ring
73
86
  * (`kol-menu-btn`, as MenuItem's rows) and `disabled`;
@@ -75,6 +88,76 @@ const Button = ({
75
88
  if (variant === 'bare') {
76
89
  return <button type={type} onClick={onClick} disabled={disabled} className={`kol-menu-btn kol-menu-btn--bare ${className}`.trim()} style={style} {...props}>{children}</button>
77
90
  }
91
+ /* `variant="kolbox"` (plan-2026-11-18-kolbox-system W31.2 batch 3, 2026-11-18): kolbox's Button and IconButton carried
92
+ * class for class, the chrome in kol-theme `.kol-btn--kolbox` and `.kol-icon-btn--kolbox`. */
93
+ if (variant === 'kolbox') {
94
+ const on = Boolean(pressed !== undefined ? pressed : selected)
95
+ /* your icons as kolbox draws them (KolboxGlyph: the stroke lift, every chevron 12 at the dock chevron's stroke) */
96
+ const glyph = (name) => <KolboxGlyph name={name} />
97
+ /* IconButton: a box at the kolbox control height (`--kol-kolbox-ctl`, 24) whose hover and pressed fill is its own
98
+ layer (::before) at the same height, centred on the glyph, so a caller's 16 box keeps its size in the layout and
99
+ still lights 24 */
100
+ if (iconOnly) {
101
+ const tip = !inTip && props['aria-label'] && props['aria-hidden'] == null ? props['aria-label'] : null
102
+ const btn = (
103
+ <button
104
+ type={type}
105
+ onClick={onClick}
106
+ disabled={disabled}
107
+ style={style}
108
+ aria-pressed={on}
109
+ className={`kol-icon-btn--kolbox${on ? ' is-pressed' : ''} relative inline-flex size-(--kol-kolbox-ctl) shrink-0 items-center justify-center outline-none focus-visible:outline-solid focus-visible:outline-1 disabled:opacity-40 disabled:pointer-events-none isolate before:absolute before:top-1/2 before:left-1/2 before:-z-10 before:size-(--kol-kolbox-ctl) before:-translate-1/2 before:content-[''] ${className}`}
110
+ {...props}
111
+ >
112
+ {children ?? glyph(iconOnly)}
113
+ </button>
114
+ )
115
+ return tip ? <Tooltip variant="kolbox" asChild label={tip}>{btn}</Tooltip> : btn
116
+ }
117
+ const look = on ? 'lit' : KOLBOX_TONES.includes(tone) ? tone : 'secondary'
118
+ /* the secondary tone is fill only, no border in any state (W15.4, his "I dont like borders with fill") */
119
+ return (
120
+ <button
121
+ type={type}
122
+ onClick={onClick}
123
+ disabled={disabled}
124
+ style={style}
125
+ aria-pressed={pressed}
126
+ className={`kol-btn--kolbox kol-btn--kolbox-${look} inline-flex h-(--kol-kolbox-ctl) shrink-0 items-center justify-center gap-2 ${look === 'secondary' ? 'border-0' : 'border'} px-3 whitespace-nowrap outline-none focus-visible:outline-solid focus-visible:outline-1 focus-visible:outline-offset-1 disabled:opacity-40${look === 'primary' ? ' enabled:hover:brightness-110' : ''} ${className}`}
127
+ {...props}
128
+ >
129
+ {iconLeft && glyph(iconLeft)}
130
+ {children}
131
+ </button>
132
+ )
133
+ }
134
+ /* `variant="folio"` (Folio migration batch A, 2026-11-22): Folio's Action, Tool and ToolIcon carried class for class
135
+ * (apps/folio parts.jsx, EditorChrome.jsx), the chrome in kol-theme `.kol-btn--folio` and `.kol-icon-btn--folio`. */
136
+ if (variant === 'folio') {
137
+ const on = pressed !== undefined ? pressed : (selected || undefined)
138
+ const keep = (e) => e.preventDefault()
139
+ if (iconOnly) {
140
+ return (
141
+ <button type={type} onMouseDown={keep} onClick={onClick} disabled={disabled} style={style} aria-pressed={on} {...props} className={`kol-icon-btn--folio flex size-[32px] shrink-0 items-center justify-center rounded-[4px] ${className}`}>
142
+ {children ?? <IconLoader name={iconOnly} size={20} />}
143
+ </button>
144
+ )
145
+ }
146
+ const look = FOLIO_TONES.includes(tone) ? tone : size === 'lg' ? 'outline' : 'ghost'
147
+ if (size === 'lg') {
148
+ return (
149
+ <button type={type} onClick={onClick} disabled={disabled} style={style} aria-pressed={on} {...props} className={`kol-btn--folio kol-btn--folio-lg kol-btn--folio-${look} flex h-[42px] shrink-0 items-center gap-[12px] whitespace-nowrap rounded-[3px] border px-[16px] ${className}`}>
150
+ <span className="kol-btn-label">{children}</span>
151
+ <span className="kol-btn-glyph">{glyph}</span>
152
+ </button>
153
+ )
154
+ }
155
+ return (
156
+ <button type={type} onMouseDown={keep} onClick={onClick} disabled={disabled} style={style} aria-pressed={on} {...props} className={`kol-btn--folio kol-btn--folio-md kol-btn--folio-${look} flex h-[32px] shrink-0 items-center gap-[8px] whitespace-nowrap rounded-[3px] px-[10px] disabled:opacity-30 ${className}`}>
157
+ {iconLeft && <IconLoader name={iconLeft} size={16} />}{children}
158
+ </button>
159
+ )
160
+ }
78
161
  // Two ladders, split on whether a label sits beside the glyph. An icon-only
79
162
  // button is a solo glyph in a pinned square, so it takes SOLO (16/20/24) —
80
163
  // it took the text-adjacent ladder until component 0.20.0, which put a 14px
@@ -11,7 +11,7 @@
11
11
  * @param {string} caption figcaption below the frame
12
12
  * @param {string} aspect CSS aspect-ratio value, e.g. '5/3' (default)
13
13
  */
14
- export default function Figure({ label, caption, aspect = '5/3', className = '', children }) {
14
+ function FigureDefault({ label, caption, aspect = '5/3', className = '', children }) {
15
15
  return (
16
16
  <figure className={`kol-prose-figure ${className}`.trim()}>
17
17
  {label && <div className="kol-doc-eyebrow mb-2">{label}</div>}
@@ -25,3 +25,21 @@ export default function Figure({ label, caption, aspect = '5/3', className = '',
25
25
  </figure>
26
26
  )
27
27
  }
28
+
29
+ /* folio (Folio batch E, 2026-11-22): Folio's figure, carried from apps/folio's Media.jsx: the image on a hairline at
30
+ * radius 2, as wide as it is or `width` px, its caption 10 under it in Folio's meta type, muted. Spans, not <figure>:
31
+ * an image that shares a line with text sits inside a <p>, where a figure is not allowed. Figure's word: `caption`.
32
+ * Folio's own: `src`, `alt`, `width` (the caller reads them off its Markdown). `data-wide` lets Folio's prose grid run it
33
+ * full width. */
34
+ function FigureFolio({ src, alt, caption, width }) {
35
+ return (
36
+ <span data-wide role="figure" aria-label={caption || undefined} className="kol-figure--folio flex flex-col items-start gap-[10px]">
37
+ <img src={src} alt={alt ?? ''} loading="lazy" className="kol-figure-image max-w-full rounded-[2px] border" style={width ? { width: `${width}px` } : undefined} />
38
+ {caption && <span className="kol-folio-meta kol-figure-caption block">{caption}</span>}
39
+ </span>
40
+ )
41
+ }
42
+
43
+ export default function Figure(props) {
44
+ return props.variant === 'folio' ? <FigureFolio {...props} /> : <FigureDefault {...props} />
45
+ }
@@ -76,7 +76,7 @@ export default function FunctionPlot({
76
76
  ref={ref}
77
77
  role="img"
78
78
  aria-label={ariaLabel}
79
- className={`kol-function-plot relative w-full overflow-hidden rounded-[var(--kol-radius-xs)] bg-[var(--kol-oq-04)] ${className}`.trim()}
79
+ className={`kol-function-plot relative w-full overflow-hidden rounded-[var(--kol-radius-2)] bg-[var(--kol-oq-04)] ${className}`.trim()}
80
80
  style={{ height }}
81
81
  >
82
82
  {w > 0 && (
@@ -14,6 +14,23 @@ import { glyphSize } from '../hooks/glyphLadders.js'
14
14
  * variant="float" — the floating style (round 3, W16 2026-10-31): a capsule on the float's well
15
15
  * (`--kol-float-well`), 16 in, sm · md · lg 28 · 36 · 44 (touch 36 · 44 · 52) with
16
16
  * 12 · 13 · 14 (13 · 15 · 16) type; AccountForm's box passes it
17
+ * variant="kolbox" — kolbox's field (plan-2026-11-18-kolbox-system W31.2 batch 3, 2026-11-18), carried class
18
+ * for class: the oq-16 fill, no outline. `size` sm (its default) the 28 field, radius 4,
19
+ * 8 in, 4 between, the value JetBrains Mono 12 / 16, the accent line inside the box when
20
+ * focused; md the rail's search, 32, radius 8, 4 in, 8 between, the value 12 / 16 in the
21
+ * row's family; lg the search modal's field, 44, radius 8, 12 in and between, a 20 glyph,
22
+ * the value Inter 16 / 22 / 500, no ring. `prefix` is the 16 letter slot (mono 12, oq-64),
23
+ * `iconLeft` the glyph, `suffix` a unit (mono 12, oq-64), `slotRight` a node at the right;
24
+ * `hug` sizes the value to its text (a number field, its unit right after it);
25
+ * the glyph is your icons with the stroke lift. The press that focuses the field selects
26
+ * its whole value, a second press places the caret. With `onCommit` (the field's commit,
27
+ * `(text) => void`) it is kolbox's field (`useKolboxField`): Enter or leaving commits a
28
+ * changed value, Escape restores the value from before the edit and leaves, ArrowUp and
29
+ * ArrowDown step a number by 1 (Shift 10) and commit. Chrome in kol-theme `.kol-input--kolbox`.
30
+ * variant="folio" — Folio's field (Folio migration batch A, 2026-11-22), carried class for class: a bare
31
+ * <input> 32 high, 16 in, radius 4, the rule line on the paper, the value JetBrains Mono
32
+ * 12 / 16 in the ink, the accent line focused; no shell, so the slots and `size` are not
33
+ * read and the width is the caller's `className`. Chrome in kol-theme `.kol-input--folio`.
17
34
  * tone="inverse" — the dark chip (`fg-ab-24`) for a washed plane
18
35
  * (ControlToneInverse, 2026-08-27); same prop on ViewToggle · Dropdown
19
36
  * size="xs" — the panel rung (ControlsXsRung, 2026-09-01):
@@ -73,8 +90,66 @@ import { glyphSize } from '../hooks/glyphLadders.js'
73
90
  * Input owns prefix/suffix/icon layout + the inner <input> styling.
74
91
  */
75
92
 
93
+ /* kolbox: each size's box (radius, fill and type in the theme rule) and its glyph */
94
+ const KOLBOX_SIZE = {
95
+ sm: { box: 'h-(--kol-kolbox-ctl) gap-1 px-2 focus-within:outline-1 focus-within:-outline-offset-1', icon: 16 },
96
+ md: { box: 'h-8 gap-2 px-1 focus-within:outline-1 focus-within:-outline-offset-1', icon: 18 },
97
+ lg: { box: 'h-11 gap-3 px-3', icon: 20 },
98
+ }
99
+
76
100
  const SIZE_TYPE = { xs: 'kol-mono-8', sm: 'kol-mono-12', md: 'kol-mono-14', lg: 'kol-mono-16' }
77
101
 
102
+ /* kolbox's fields: the press that focuses a field selects its whole value; a press in a focused field places the caret.
103
+ A mousedown handler for any kolbox <input> (ColorInputRow's hex and opacity take it too). */
104
+ export function selectOnFirstPress(e) {
105
+ const el = e.currentTarget
106
+ if (e.button !== 0 || document.activeElement === el || el.disabled || el.readOnly) return
107
+ e.preventDefault()
108
+ el.focus()
109
+ el.select()
110
+ }
111
+
112
+ /* kolbox's arrow step: a number, alone or with a unit after it (12, -4.5, 45°, 50%), moves by `by`; anything else
113
+ (a hex, a word, empty) does not step and gives null */
114
+ const STEPPABLE = /^\s*(-?\d*\.?\d+)\s*(°|%|px|pt|ms|s|x)?\s*$/
115
+ export function stepText(text, by) {
116
+ const m = STEPPABLE.exec(String(text ?? ''))
117
+ if (!m) return null
118
+ const places = (m[1].split('.')[1] ?? '').length
119
+ return `${Number((parseFloat(m[1]) + by).toFixed(places))}${m[2] ?? ''}`
120
+ }
121
+
122
+ /* kolbox's field behaviour, one place for every kolbox field (Input's own, ColorInputRow's hex and opacity): a draft
123
+ while editing; Enter or leaving commits it, when it differs; Escape puts back the value from before the edit and
124
+ leaves the field; ArrowUp and ArrowDown step a number by 1, with Shift by 10, and commit at once (`step: false`
125
+ for a value that is not a number). `commit(text)` gets the trimmed text. Returns the <input>'s props. */
126
+ export function useKolboxField(value, commit, { step = true } = {}) {
127
+ const shown = value == null ? '' : String(value)
128
+ const [draft, setDraft] = useState(null)
129
+ const live = useRef(null)
130
+ const end = (text) => { live.current = null; setDraft(null); if (text != null && text.trim() !== shown) commit?.(text.trim()) }
131
+ return {
132
+ value: draft ?? shown,
133
+ onChange: (e) => { live.current = e.target.value; setDraft(e.target.value) },
134
+ onBlur: () => end(live.current),
135
+ onKeyDown: (e) => {
136
+ if (e.key === 'Enter') { e.preventDefault(); e.currentTarget.blur() }
137
+ else if (e.key === 'Escape') {
138
+ /* the field takes this Escape: a window or the editor hears the next one */
139
+ e.preventDefault(); e.stopPropagation()
140
+ live.current = null; setDraft(null); e.currentTarget.blur()
141
+ } else if (step && (e.key === 'ArrowUp' || e.key === 'ArrowDown') && !e.metaKey && !e.ctrlKey && !e.altKey) {
142
+ const next = stepText(live.current ?? shown, (e.key === 'ArrowUp' ? 1 : -1) * (e.shiftKey ? 10 : 1))
143
+ if (next == null) return
144
+ e.preventDefault(); e.stopPropagation()
145
+ const el = e.currentTarget
146
+ live.current = null; setDraft(null); commit?.(next)
147
+ requestAnimationFrame(() => { if (document.activeElement === el) el.select() })
148
+ }
149
+ },
150
+ }
151
+ }
152
+
78
153
  export default function Input({
79
154
  type = 'text',
80
155
  value,
@@ -83,7 +158,7 @@ export default function Input({
83
158
  variant,
84
159
  preset,
85
160
  tone = 'default',
86
- size = 'md',
161
+ size: sizeProp,
87
162
  chars,
88
163
  prefix,
89
164
  suffix,
@@ -99,8 +174,11 @@ export default function Input({
99
174
  width,
100
175
  className = '',
101
176
  inputClassName = '',
177
+ hug = false,
102
178
  ...inputProps
103
179
  }) {
180
+ /* kolbox's field is its own default size (sm); every other look defaults to md */
181
+ const size = sizeProp ?? (variant === 'kolbox' ? 'sm' : 'md')
104
182
  const isNumber = type === 'number'
105
183
  const fixedChars = typeof chars === 'number'
106
184
  // The text-adjacent ladder — an Input's icon sits in the rung's line box
@@ -141,6 +219,7 @@ export default function Input({
141
219
  /* the ref mirrors the draft so a blur that lands in the same tick as the
142
220
  * last keystroke commits what was typed, not the last RENDER's draft */
143
221
  const draftRef = useRef(value ?? '')
222
+ const kolboxField = useKolboxField(value, onCommit)
144
223
  useEffect(() => { if (onCommit) { setDraft(value ?? ''); draftRef.current = value ?? '' } }, [value, onCommit])
145
224
  const commitProps = onCommit
146
225
  ? {
@@ -164,6 +243,31 @@ export default function Input({
164
243
  }
165
244
  : null
166
245
 
246
+ /* `variant="kolbox"` (plan-2026-11-18-kolbox-system W31.2 batch 3, 2026-11-18): kolbox's Input carried class for
247
+ * class, the chrome in kol-theme `.kol-input--kolbox`. Its sizes are its three fields: sm the field (`--kol-kolbox-ctl`, 24), md the rail's
248
+ * search (32), lg the search modal's (44). A slot that holds nothing is not drawn, so it takes no space. */
249
+ if (variant === 'kolbox') {
250
+ const k = KOLBOX_SIZE[size] ?? KOLBOX_SIZE.sm
251
+ return (
252
+ <label className={`kol-input--kolbox kol-input--kolbox-${KOLBOX_SIZE[size] ? size : 'sm'} flex min-w-0 items-center has-disabled:opacity-40 ${k.box} ${className}`}>
253
+ {iconLeft && <IconLoader name={iconLeft} size={k.icon} className="kol-input-icon kol-kolbox-icon shrink-0" />}
254
+ {prefix !== undefined && <span className="kol-input-lead w-4 shrink-0">{prefix}</span>}
255
+ <input type={type} value={value} onChange={onChange} placeholder={placeholder} disabled={disabled} className={`kol-input-value min-w-0 ${hug ? 'field-sizing-content' : 'flex-1'} bg-transparent text-left outline-none`} {...inputProps}
256
+ {...(onCommit ? kolboxField : null)}
257
+ onMouseDown={(e) => { inputProps.onMouseDown?.(e); selectOnFirstPress(e) }} />
258
+ {suffix !== undefined && <span className="kol-input-suffix shrink-0">{suffix}</span>}
259
+ {slotRight}
260
+ </label>
261
+ )
262
+ }
263
+
264
+ /* `variant="folio"` (Folio migration batch A, 2026-11-22): Folio's text field carried class for class (apps/folio
265
+ * EditorChrome.jsx Input), the bare field with no shell, the chrome in kol-theme `.kol-input--folio`. The width is the
266
+ * caller's `className`. */
267
+ if (variant === 'folio') {
268
+ return <input type={type} value={value} onChange={onChange} placeholder={placeholder} disabled={disabled} {...inputProps} className={`kol-input--folio h-[32px] rounded-[4px] border px-[16px] outline-none ${className}`} />
269
+ }
270
+
167
271
  const propertyLen = Math.max(String(value ?? placeholder ?? '').length, 1)
168
272
 
169
273
  /* the error: a mark inside, a message under (row 36) */
package/src/atoms/Kbd.jsx CHANGED
@@ -13,6 +13,13 @@
13
13
  * is a GLYPH, never a typed character in the mono face.
14
14
  * It follows the cap: 10 in `sm`, 12 in `md` (2026-10-02 —
15
15
  * it was 12 in both, so in the small ⌘K cap the ⌘ outgrew the K)
16
+ * @param {'default'|'kolbox'} variant `kolbox` (plan-2026-11-18-kolbox-system W31.2, 2026-11-18): kolbox's cap carried
17
+ * class for class, the same sizes in kolbox's mono steps (sm 10 / 14, md 12 / 16), no gap; chrome
18
+ * in kol-theme `.kol-kbd--kolbox`.
19
+ * @param {boolean} onAccent kolbox only: on a lit accent row the cap takes the on-accent ink over a 15% wash of it.
20
+ *
21
+ * KbdKeys (a member of Kbd): a drawn shortcut ('⌘⇧S') split into one cap per key, each modifier its own and the rest
22
+ * one key; ⌘ is the `command` glyph. `keys`, `size`, `onAccent`, `variant`, `className`.
16
23
  */
17
24
  import { IconLoader } from '@kolkrabbi/kol-icons'
18
25
 
@@ -21,12 +28,26 @@ const SIZE = {
21
28
  md: 'h-5 min-w-5 px-1.5 kol-helper-12',
22
29
  }
23
30
  const GLYPH = { sm: 10, md: 12 }
31
+ /* kolbox: the same boxes, its type in the theme rule */
32
+ const KOLBOX_SIZE = { sm: 'h-4 min-w-4 px-1', md: 'h-5 min-w-5 px-1.5' }
24
33
 
25
- export default function Kbd({ size = 'md', icon, className = '', children, ...rest }) {
34
+ export default function Kbd({ size = 'md', icon, variant = 'default', onAccent = false, className = '', children, ...rest }) {
35
+ if (variant === 'kolbox') {
36
+ return (
37
+ <kbd
38
+ aria-hidden="true"
39
+ className={`kol-kbd--kolbox kol-kbd--kolbox-${size}${onAccent ? ' kol-kbd--kolbox-on-accent' : ''} inline-flex shrink-0 items-center justify-center ${KOLBOX_SIZE[size] ?? KOLBOX_SIZE.md} ${className}`.trim()}
40
+ {...rest}
41
+ >
42
+ {icon && <IconLoader name={icon} size={GLYPH[size] ?? GLYPH.md} className="kol-kolbox-icon shrink-0" />}
43
+ {children}
44
+ </kbd>
45
+ )
46
+ }
26
47
  return (
27
48
  <kbd
28
49
  aria-hidden="true"
29
- className={`inline-flex items-center justify-center gap-0.5 shrink-0 rounded-[var(--kol-radius-xs)] bg-oq-08 text-oq-64 ${SIZE[size] ?? SIZE.md} ${className}`.trim()}
50
+ className={`inline-flex items-center justify-center gap-0.5 shrink-0 rounded-[var(--kol-radius-2)] bg-oq-08 text-oq-64 ${SIZE[size] ?? SIZE.md} ${className}`.trim()}
30
51
  {...rest}
31
52
  >
32
53
  {icon && <IconLoader name={icon} size={GLYPH[size] ?? GLYPH.md} />}
@@ -34,3 +55,22 @@ export default function Kbd({ size = 'md', icon, className = '', children, ...re
34
55
  </kbd>
35
56
  )
36
57
  }
58
+
59
+ /* '⌘⇧S' → ['⌘', '⇧', 'S'] */
60
+ const keysOf = (s) => {
61
+ const m = String(s).match(/^[⌘⇧⌥⌃]*/)[0]
62
+ const rest = String(s).slice(m.length)
63
+ return [...m, ...(rest ? [rest] : [])]
64
+ }
65
+
66
+ export function KbdKeys({ keys, size, onAccent, variant, className = '' }) {
67
+ return (
68
+ <span aria-hidden className={`inline-flex shrink-0 items-center gap-0.5 ${className}`} data-keys={keys}>
69
+ {keysOf(keys).map((k, i) => (
70
+ k === '⌘'
71
+ ? <Kbd key={i} size={size} variant={variant} onAccent={onAccent} icon="command" />
72
+ : <Kbd key={i} size={size} variant={variant} onAccent={onAccent}>{k}</Kbd>
73
+ ))}
74
+ </span>
75
+ )
76
+ }
@@ -0,0 +1,20 @@
1
+ /**
2
+ * Link — A text action in the link color. a button drawn as a link: a short action inside a line of text, a toast's
3
+ * "Show in …" or a share sheet's "Copy link" (kolbox's Link, Figma 188:20997, carried class for class:
4
+ * plan-2026-11-18-kolbox-system W31.2, 2026-11-18). Size 11 on a 15 line in the link color, no underline until hover,
5
+ * one line; the family and weight are the row's. The focus ring is the accent's. Chrome in kol-theme `.kol-link`.
6
+ *
7
+ * <Link onClick={reveal}>Show in folder</Link>
8
+ *
9
+ * A link that navigates is an <a>; this is an action, so it is a button.
10
+ *
11
+ * @param {ReactNode} children - The words
12
+ * @param {string} [className] - Extra classes on the button
13
+ */
14
+ export default function Link({ children, className = '', ...rest }) {
15
+ return (
16
+ <button type="button" className={`kol-link shrink-0 whitespace-nowrap outline-none hover:underline focus-visible:outline-solid focus-visible:outline-1 ${className}`} {...rest}>
17
+ {children}
18
+ </button>
19
+ )
20
+ }
@@ -9,9 +9,12 @@ const pointName = (xi, yi) => (xi === 1 && yi === 1 ? 'center' : `${X_NAME[xi]}
9
9
  /* box padding + cell + dot per rung: 2·pad + 3·cell = the field's height (22 · 26 · 32; touch 32 · 32 · 36).
10
10
  * The xs touch lift skips a hardware panel, as Input's does. */
11
11
  const SIZE = {
12
- xs: 'p-[2px] [--op-cell:6px] [--op-dot:4px] rounded-[var(--kol-radius-xs)] pointer-coarse:not-[.kol-hw-panel_*]:p-px pointer-coarse:not-[.kol-hw-panel_*]:[--op-cell:10px] pointer-coarse:not-[.kol-hw-panel_*]:[--op-dot:6px]',
13
- sm: 'p-px [--op-cell:8px] [--op-dot:4px] rounded-[var(--kol-radius-sm)] pointer-coarse:[--op-cell:10px] pointer-coarse:[--op-dot:6px]',
14
- md: 'p-px [--op-cell:10px] [--op-dot:6px] rounded-[var(--kol-radius-sm)] pointer-coarse:p-[3px]',
12
+ /* 2xs: the 16 icon slot a rail row's third cell takes (kolbox, plan-2026-11-18-kolbox-system W31.2): nine 4 dots 2 apart,
13
+ * no ground and no touch lift, as an icon has none */
14
+ '2xs': 'gap-0.5 [--op-cell:4px] [--op-dot:4px] [--kol-tone-bg:transparent] rounded-[var(--kol-radius-2)]',
15
+ xs: 'p-[2px] [--op-cell:6px] [--op-dot:4px] rounded-[var(--kol-radius-2)] pointer-coarse:not-[.kol-hw-panel_*]:p-px pointer-coarse:not-[.kol-hw-panel_*]:[--op-cell:10px] pointer-coarse:not-[.kol-hw-panel_*]:[--op-dot:6px]',
16
+ sm: 'p-px [--op-cell:8px] [--op-dot:4px] rounded-[var(--kol-radius-4)] pointer-coarse:[--op-cell:10px] pointer-coarse:[--op-dot:6px]',
17
+ md: 'p-px [--op-cell:10px] [--op-dot:6px] rounded-[var(--kol-radius-4)] pointer-coarse:p-[3px]',
15
18
  }
16
19
 
17
20
  /**
@@ -22,7 +25,8 @@ const SIZE = {
22
25
  * that fires align actions and holds no value; this holds one.
23
26
  *
24
27
  * ON THE CONTROL RAMP. The square is exactly a field's height at the same `size`, so it sits beside
25
- * an `Input` without a step: xs 22 · sm 26 · md 32 (touch 32 · 32 · 36, as the fields grow). The
28
+ * an `Input` without a step: xs 22 · sm 26 · md 32 (touch 32 · 32 · 36, as the fields grow). Below the ramp, `2xs` is
29
+ * the 16 icon slot (kolbox's rail row, 2026-11-18): nine 4 dots 2 apart on no ground. The
26
30
  * ground is the control's (`--kol-tone-bg`, else surface-secondary), so `tone` and a toned wrapper
27
31
  * reach it as they reach an Input. No border — the field family has none.
28
32
  *
@@ -36,7 +40,7 @@ const SIZE = {
36
40
  *
37
41
  * @param {[number, number]} value - The selected point `[x, y]`, each 0 · 0.5 · 1 (0 = left / top)
38
42
  * @param {(value:[number, number]) => void} onChange - Fired with the new `[x, y]` on click or arrow key
39
- * @param {'xs'|'sm'|'md'} [size='sm'] - The control rung — the square matches a field of this size
43
+ * @param {'2xs'|'xs'|'sm'|'md'} [size='sm'] - The control rung — the square matches a field of this size; `2xs` is the 16 icon slot
40
44
  * @param {string} [tone='default'] - The control set's tone (the ground); default inherits a wrapper's
41
45
  * @param {string} [ariaLabel='Origin'] - The group's accessible name
42
46
  * @param {string} [className] - Extra classes on the square
@@ -0,0 +1,22 @@
1
+ /**
2
+ * SectionFooter — A section's foot: the rule above, then a leading slot, the label and a trailing slot.
3
+ *
4
+ * The library master `SectionFooter` (Atoms page, 2169:1251; type-ramp plan 6.8): `SectionHeader`'s partner, the same
5
+ * row with the fg-08 rule drawn on top, 13 above the row.
6
+ *
7
+ * @param {React.ReactNode} [leading] the start slot (an `IconFrame`); omitted, nothing is drawn
8
+ * @param {string} label
9
+ * @param {React.ReactNode} [trailing] the end slot
10
+ * @param {string} [className]
11
+ */
12
+ export default function SectionFooter({ leading, label, trailing, className = '', ...rest }) {
13
+ return (
14
+ <div className={`flex w-full flex-row flex-wrap items-end justify-between gap-4 border-t border-fg-08 pt-[13px] ${className}`.trim()} {...rest}>
15
+ <div className="flex items-center gap-3 md:gap-4">
16
+ {leading}
17
+ <span className="kol-btn kol-btn-md kol-helper-16">{label}</span>
18
+ </div>
19
+ {trailing != null && <div className="flex flex-wrap items-center gap-4">{trailing}</div>}
20
+ </div>
21
+ )
22
+ }
@@ -0,0 +1,24 @@
1
+ /**
2
+ * SectionHeader — A section's head: a leading slot, the label, a trailing slot and the rule beneath.
3
+ *
4
+ * The library master `SectionHeader` (Atoms page, 2169:1239; type-ramp plan 6.8), copied from kol-foundry's
5
+ * `SpecimenSectionHeader` at size md: the label in the text-button shell at helper-16, the two ends apart, the rule an
6
+ * fg-08 line 13 below the row. The component draws the rule itself (no nested `Divider`), which keeps it an atom.
7
+ * `SectionFooter` is its partner with the rule above. Not kol-dashboards' `SectionHead` (the float card's section head).
8
+ *
9
+ * @param {React.ReactNode} [leading] the start slot (an `IconFrame`); omitted, nothing is drawn
10
+ * @param {string} label
11
+ * @param {React.ReactNode} [trailing] the end slot (page number, section name, controls)
12
+ * @param {string} [className]
13
+ */
14
+ export default function SectionHeader({ leading, label, trailing, className = '', ...rest }) {
15
+ return (
16
+ <div className={`flex w-full flex-row flex-wrap items-end justify-between gap-4 border-b border-fg-08 pb-[13px] ${className}`.trim()} {...rest}>
17
+ <div className="flex items-center gap-3 md:gap-4">
18
+ {leading}
19
+ <span className="kol-btn kol-btn-md kol-helper-16">{label}</span>
20
+ </div>
21
+ {trailing != null && <div className="flex flex-wrap items-center gap-4">{trailing}</div>}
22
+ </div>
23
+ )
24
+ }
@@ -54,7 +54,7 @@ export default function SizeOrDownload({
54
54
  href={href ?? '#'}
55
55
  onClick={click}
56
56
  aria-label={done ? confirmLabel : label}
57
- className="group/size -mx-1 inline-grid items-end justify-items-start rounded-[var(--kol-radius-sm)] px-1 transition-colors duration-500 ease-[var(--kol-ease-house)] hover:bg-oq-04 active:bg-oq-08"
57
+ className="group/size -mx-1 inline-grid items-end justify-items-start rounded-[var(--kol-radius-4)] px-1 transition-colors duration-500 ease-[var(--kol-ease-house)] hover:bg-oq-04 active:bg-oq-08"
58
58
  >
59
59
  <span
60
60
  className="kol-mono-12 text-oq-80 group-hover/size:opacity-0"
@@ -11,6 +11,11 @@ import { IconLoader } from '@kolkrabbi/kol-icons'
11
11
  * variant="float" — the note field (float-everything W3 row 42, 2026-11-04): the float well on the
12
12
  * sheet radius (`--kol-float-menu-r`), Inter 500 at the md float type, 12 / 16 in;
13
13
  * the grip stays, the focus ring is the float's
14
+ * variant="kolbox" — kolbox's field (plan-2026-11-18-kolbox-system W31.2, 2026-11-18), carried class for
15
+ * class: a bare <textarea> filling its row (flex-1), the field's oq-16 fill, an oq-24 line,
16
+ * radius 4, 8 by 4 in, JetBrains Mono 12 / 16 in the ink, the accent line while focused,
17
+ * native vertical resize, the browser's own rows unless `rows` is given. No size, no grip.
18
+ * Chrome in kol-theme `.kol-textarea--kolbox`.
14
19
  *
15
20
  * size="sm" / "md" (default) / "lg" — padding + type class
16
21
  *
@@ -41,13 +46,17 @@ export default function Textarea({
41
46
  onChange,
42
47
  variant = 'filled',
43
48
  size = 'md',
44
- rows = 3,
49
+ rows,
45
50
  axis = 'both',
46
51
  placeholder,
47
52
  disabled = false,
48
53
  className = '',
49
54
  ...props
50
55
  }) {
56
+ if (variant === 'kolbox') {
57
+ return <textarea value={value} onChange={onChange} rows={rows} placeholder={placeholder} disabled={disabled} className={`kol-textarea--kolbox min-w-0 flex-1 resize-y border px-2 py-1 outline-none ${className}`} {...props} />
58
+ }
59
+
51
60
  // ghost folds into outline (2026-07-08 chrome law): one secondary treatment.
52
61
  const resolvedVariant = variant === 'ghost' ? 'outline' : variant
53
62
 
@@ -72,7 +81,7 @@ export default function Textarea({
72
81
  <label className={wrapperCls} aria-disabled={disabled || undefined}>
73
82
  <textarea
74
83
  {...valueProps}
75
- rows={rows}
84
+ rows={rows ?? 3}
76
85
  placeholder={placeholder}
77
86
  disabled={disabled}
78
87
  spellCheck={false}
@@ -1,11 +1,16 @@
1
1
  import React from 'react'
2
+ import { IconLoader } from '@kolkrabbi/kol-icons'
2
3
 
3
4
  /* `variant="media"` (ContentFiltersCollection, kol-r2b2 2026-08-27): inside a
4
5
  * media frame the unchecked hairline vanished over a photo; this variant's
5
6
  * UNCHECKED box carries the media control's solid plate (`--kol-oq-12`) so it
6
7
  * reads over any image. Checked stays the white plate + black check.
7
8
  * `variant="float"` (float-everything W2 row 22, 2026-11-04): an 18 plate on oq-08 with no hairline; checked is the
8
- * bare check glyph on nothing; the label is the float panel role (Inter 13/500); focus ring on the plate, disabled 40%. */
9
+ * bare check glyph on nothing; the label is the float panel role (Inter 13/500); focus ring on the plate, disabled 40%.
10
+ * `variant="kolbox"` (plan-2026-11-18-kolbox-system W31.2, 2026-11-18), carried class for class: a 16 box at radius 4 in a
11
+ * 28 hit box, unchecked the field's oq-16 fill with an oq-24 line, checked the accent fill and line with your icons'
12
+ * `check` at 12 in the on-accent ink; no label of its own (name it with `aria-label`; a row labels it), a role="checkbox"
13
+ * button with aria-checked, the focus ring the accent's. Chrome in kol-theme `.kol-toggle-checkbox--kolbox`. */
9
14
  const VARIANT_CLASS = { media: 'toggle-checkbox--media', float: 'toggle-checkbox--float' }
10
15
  const ToggleCheckbox = ({
11
16
  label,
@@ -16,6 +21,23 @@ const ToggleCheckbox = ({
16
21
  hint,
17
22
  ...props
18
23
  }) => {
24
+ if (variant === 'kolbox') {
25
+ return (
26
+ <button
27
+ type="button"
28
+ role="checkbox"
29
+ aria-checked={checked}
30
+ onClick={() => onChange?.(!checked)}
31
+ className={`kol-toggle-checkbox--kolbox${checked ? ' is-active' : ''} inline-flex size-(--kol-kolbox-ctl) shrink-0 items-center justify-center outline-none focus-visible:outline-solid focus-visible:outline-1 ${className}`}
32
+ {...props}
33
+ >
34
+ <span className="kol-toggle-checkbox-box flex size-4 items-center justify-center border">
35
+ {checked && <IconLoader name="check" size={12} className="kol-kolbox-icon shrink-0" />}
36
+ </span>
37
+ </button>
38
+ )
39
+ }
40
+
19
41
  const handleChange = (event) => {
20
42
  const next = event.target.checked
21
43
  if (onChange) onChange(next)