@kolkrabbi/kol-component 0.387.0 → 0.389.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.387.0",
3
+ "version": "0.389.0",
4
4
  "description": "The core component library",
5
5
  "license": "MIT",
6
6
  "type": "module",
package/src/index.js CHANGED
@@ -192,7 +192,7 @@ export { default as ContentRow } from './molecules/ContentRow.jsx'
192
192
  export { default as ContentItem } from './molecules/ContentItem.jsx'
193
193
  export { default as ContentCollection } from './organisms/ContentCollection.jsx'
194
194
  export { MenuItem, MenuRow, MenuDivider, MenuFlyout, MenuDropdownItem, MenuDropdownDivider, MenuDropdownNest } from './molecules/MenuItem.jsx'
195
- export { Menu, MenuTrigger, MenuPanel, MenuLabel, MenuFilter, MenuDatePicker, MenuMore, MenuScroll } from './molecules/Menu.jsx'
195
+ export { Menu, MenuTrigger, MenuPanel, MenuLabel, MenuFilter, MenuDatePicker, MenuMore, MenuScroll, MenuKolbox, MenuFolio } from './molecules/Menu.jsx'
196
196
  export { MenuList } from './molecules/MenuList.jsx'
197
197
  export { ModalProvider, useModal, ModalDialog, ModalDialog as Dialog } from './molecules/Modal.jsx'
198
198
  export { default as ModalShell } from './molecules/ModalShell.jsx'
@@ -16,16 +16,21 @@ import KolboxGlyph from '../utilities/kolboxGlyph.jsx'
16
16
  * @param {'start'|'end'} [align] default `end`
17
17
  * @param {'sm'|'md'|'lg'} [size] the circle (default md)
18
18
  * @param {string} [className]
19
- * @param {'kolbox'} [variant] `kolbox` (plan-2026-11-18-kolbox-system W31.2 batch 4, 2026-11-18): kolbox's AccountChip, the
20
- * trigger only: the xs Avatar (20) on oq-16 then the 12 chevron in oq-64, 4 apart, the accent's focus line. No menu yet
21
- * (kolbox has none to open, its no-function list); `items` and `align` are not read. Other props land on the button.
19
+ * @param {boolean} [compact] the chip (kolbox's AccountChip, W31.2 batch 4, 2026-11-18; a plain prop since
20
+ * plan-2026-11-29-one-set-fold W3 run 2), the trigger only: the xs Avatar (20) on the chip's fill then the 12 chevron in
21
+ * oq-64, 4 apart, the accent's focus line. No menu (its host has none to open); `items` and `align` are not read. Other
22
+ * props land on the button. Chrome in kol-theme `.kol-account-chip`, the fill `--kol-account-chip-fill` (kolbox the field)
23
+ * @param {'kolbox'|'folio'} [variant] accepted (on the retirement ledger): `kolbox` draws `compact`
22
24
  */
23
- export default function AccountMenu({ initial, src, name = 'Account', items = [], align = 'end', size = 'md', className = '', variant, accent, ...rest }) {
25
+ /* the old theme word: `kolbox` draws the chip (W3 run 2, on the retirement ledger) */
26
+ const THEME_WORDS = ['kolbox']
27
+
28
+ export default function AccountMenu({ initial, src, name = 'Account', items = [], align = 'end', size = 'md', className = '', variant, compact, accent, ...rest }) {
24
29
  if (accent === 'secondary') rest['data-accent'] = accent
25
- if (variant === 'kolbox') {
30
+ if (compact ?? THEME_WORDS.includes(variant)) {
26
31
  return (
27
32
  <button type="button" aria-label={name} aria-haspopup="menu" data-account-chip
28
- className={`kol-account-chip--kolbox inline-flex shrink-0 items-center gap-1 rounded-full outline-none focus-visible:outline-solid focus-visible:outline-1 focus-visible:outline-offset-1 ${className}`.trim()} {...rest}>
33
+ className={`kol-account-chip inline-flex shrink-0 items-center gap-1 rounded-full outline-none focus-visible:outline-solid focus-visible:outline-1 focus-visible:outline-offset-1 ${className}`.trim()} {...rest}>
29
34
  <Avatar initial={initial} src={src} size="xs" />
30
35
  <KolboxGlyph name="chevron-down" size={12} className="kol-account-chip-caret" />
31
36
  </button>
@@ -27,8 +27,8 @@ import { glyphSize } from '../hooks/glyphLadders.js'
27
27
  * @param {'stacked'|'strips'} [layout='stacked'] - `stacked`: the X strip over the Y strip. `strips` (kolbox's align row,
28
28
  * plan-2026-11-18-kolbox-system W31.2 batch 3; a layout of its own since plan-2026-11-29-one-set-fold W2 run 4): the X
29
29
  * and Y strips side by side, each filling its cell of a slot `FieldPair` (two cells 8 apart), each cell its own action;
30
- * `items` carry the set's glyph names. The strips are ButtonGroup's icon group, which still takes its theme word until
31
- * ButtonGroup folds (W3). `variant="kolbox"` and `"folio"` are accepted and draw `strips`; the old branch is in
30
+ * `items` carry the set's glyph names. The strips are ButtonGroup's icon group (`variant="icons"`, W3 run 2).
31
+ * `variant="kolbox"` and `"folio"` are accepted and draw `strips`; the old branch is in
32
32
  * `_tmp/2026-11-29-one-set-fold/AlignmentGrid.pre-fields3.jsx`.
33
33
  */
34
34
  const THEME_WORDS = ['kolbox', 'folio']
@@ -44,11 +44,11 @@ const ALIGN_BUTTONS = [
44
44
  export default function AlignmentGrid({ onAlign, items = ALIGN_BUTTONS, size = 'sm', className = '', layout: layoutProp, variant }) {
45
45
  const strip = (axis) => items.filter((b) => b.axis === axis)
46
46
  const layout = layoutProp ?? (THEME_WORDS.includes(variant) ? 'strips' : 'stacked')
47
- /* layout="strips" (kolbox's AlignmentRow carried): the two strips as icon groups, each filling its cell of a slot
48
- * FieldPair (two cells 8 apart). `variant="kolbox"` on the ButtonGroup names its icon group build until W3 folds it. */
47
+ /* layout="strips" (kolbox's AlignmentRow carried): the two strips as ButtonGroup's icon groups, each filling its cell of
48
+ * a slot FieldPair (two cells 8 apart) */
49
49
  if (layout === 'strips') {
50
50
  const group = (axis) => (
51
- <ButtonGroup layout="joined" variant="kolbox" className="w-full"
51
+ <ButtonGroup layout="joined" variant="icons" className="w-full"
52
52
  options={strip(axis).map((b) => ({ icon: b.icon, ariaLabel: b.title, onPress: () => onAlign?.(b.axis, b.mode) }))} />
53
53
  )
54
54
  return <FieldPair className={className} first={group('h')} second={group('v')} />
@@ -87,12 +87,13 @@
87
87
  * `kol-tone-sunken` wrapper reaches it too. Unset = inherit.
88
88
  * ariaLabel — accessible name for the group
89
89
  * className — additional classes on the outer shell
90
- * variant="kolbox" — kolbox's icon group (W31.2 batch 3): `options` `[{ icon, ariaLabel, pressed, onPress }]`, each its
91
- * own action; `tone` unset (cells) or `sunken` (the track). With `value` (Folio on kolbox, 2026-11-22) kolbox's
92
- * choice that stays, its tab track: `options` `[{ value, label }]`, the picked cell lit, aria-pressed
93
- * variant="folio" — Folio's (batch A, 2026-11-22), by the state law: with `value` its segmented choice (`options`
94
- * `[{ value, label }]`, the picked cell lit, aria-pressed); without, its tool icons joined (`options`
95
- * `[{ icon, ariaLabel, pressed, onPress }]`)
90
+ * variant="icons" — the icon group (kolbox's IconGroup, a plain variant since plan-2026-11-29-one-set-fold W3 run 2):
91
+ * `options` `[{ icon, ariaLabel, pressed, onPress }]`, each its own action; `tone` unset (cells) or `sunken`
92
+ * (the track). Chrome in kol-theme `.kol-btn-group--icons`, its look `--kol-btn-group-*`
93
+ * variant="track" — a choice that stays, drawn on the tab track (TabsRow `variant="track"`'s sm track and cells):
94
+ * `options` `[{ value, label, disabled? }]`, the picked cell lit and aria-pressed, `ariaLabel` names it
95
+ * variant="kolbox" | "folio" — accepted (on the retirement ledger): without `value` they draw `icons`, with one `track`.
96
+ * Folio's own segmented row and frameless tool row went to `_tmp/2026-11-29-one-set-fold/ButtonGroup.pre-w3b.jsx`
96
97
  */
97
98
  import { toneClass } from '../utilities/tone.js'
98
99
  import { Tooltip } from '../utilities/Popover.jsx'
@@ -142,53 +143,31 @@ export default function ButtonGroup({ layout = 'row', align = 'center', title, c
142
143
  )
143
144
  }
144
145
 
145
- /* layout="joined" variant="kolbox" (plan-2026-11-18-kolbox-system W31.2 batch 3, 2026-11-18): kolbox's IconGroup carried
146
- * class for class. Each option is its own action, a kolbox icon Button (`{ icon, ariaLabel, pressed, onPress }`): no
147
- * `value`, every option lights by its own `pressed`. Unset tone: each glyph in its own oq-16 cell, 1px apart so the
148
- * ground shows between them, radius 4 on the group's outer corners only, a pressed cell the accent tint. `tone="sunken"`:
149
- * Home's view switch, square cells the group's height (24, Figma's view toggles measured, plan-2026-11-23-editor-measured-
150
- * against-figma W7), side by side on the ground, the pressed cell (aria-pressed only) the oq-16 field
151
- * with its glyph in the ink, the others bare. Chrome in kol-theme `.kol-btn-group--kolbox`. */
152
- function JoinedKolbox({ options, tone, className }) {
146
+ /* layout="joined" variant="icons" (kolbox's IconGroup, W31.2 batch 3, 2026-11-18; a plain variant since plan-2026-11-29-one-set-fold
147
+ * W3 run 2). Each option is its own action, an icon Button (`{ icon, ariaLabel, pressed, onPress }`): no `value`, every
148
+ * option lights by its own `pressed`. Unset tone: each glyph in its own cell on the group's fill, 1px apart so the ground
149
+ * shows between them, radius 4 on the group's outer corners only. `tone="sunken"`: square cells the group's height side
150
+ * by side on the fill, the pressed cell (aria-pressed only) the ground inside the group's line, the others bare. Chrome
151
+ * in kol-theme `.kol-btn-group--icons`, its look `--kol-btn-group-*` (kolbox: the field fill, the one edge, the control
152
+ * height). */
153
+ function JoinedIcons({ options, tone, className }) {
153
154
  const sunken = tone === 'sunken'
154
155
  return (
155
- <div className={`kol-btn-group--kolbox${sunken ? ' kol-btn-group--kolbox-sunken' : ' gap-px overflow-hidden'} inline-flex h-(--kol-kolbox-ctl) shrink-0 ${className}`}>
156
+ <div className={`kol-btn-group--icons${sunken ? ' kol-btn-group--icons-sunken' : ' gap-px overflow-hidden'} inline-flex shrink-0 ${className}`}>
156
157
  {options.map(({ icon, ariaLabel, pressed, onPress }) => (sunken
157
- ? <Button key={ariaLabel} variant="kolbox" iconOnly={icon} aria-label={ariaLabel} aria-pressed={!!pressed} onClick={onPress} className="aspect-square h-full! w-auto!" />
158
- : <Button key={ariaLabel} variant="kolbox" iconOnly={icon} aria-label={ariaLabel} pressed={pressed} onClick={onPress} className="flex-1 rounded-none" />))}
158
+ ? <Button key={ariaLabel} iconOnly={icon} aria-label={ariaLabel} aria-pressed={!!pressed} onClick={onPress} className="aspect-square h-full! w-auto!" />
159
+ : <Button key={ariaLabel} iconOnly={icon} aria-label={ariaLabel} pressed={pressed} onClick={onPress} className="flex-1 rounded-none" />))}
159
160
  </div>
160
161
  )
161
162
  }
162
163
 
163
- /* layout="joined" variant="folio" (Folio migration batch A, 2026-11-22): Folio's two joined parts, split by the segmented
164
- * state law. With a `value` it is Folio's Seg (apps/folio Chrome.jsx), a choice that stays: 32 high, radius 4, the rule
165
- * line round equal cells padded 16, the picked one the accent's soft ground and strong ink (aria-pressed, as Folio's),
166
- * the rest muted, the ink on hover. Stateless it is Folio's ToolGroup (EditorChrome.jsx): Folio's tool icons side by side,
167
- * no gap, `options` `[{ icon, ariaLabel, pressed, onPress }]`, each its own action. Chrome in kol-theme
168
- * `.kol-btn-group--folio`. */
169
- function JoinedFolio({ value, onChange, options, ariaLabel, className }) {
170
- if (value == null) {
171
- return (
172
- <span role="group" aria-label={ariaLabel} className={`flex shrink-0 items-center ${className}`.trim()}>
173
- {options.map(({ icon, ariaLabel: name, pressed, onPress }) => <Button key={name} variant="folio" keepFocus iconOnly={icon} aria-label={name} pressed={pressed} onClick={onPress} />)}
174
- </span>
175
- )
176
- }
177
- return (
178
- <div role="group" aria-label={ariaLabel} className={`kol-btn-group--folio flex h-[32px] overflow-hidden rounded-[4px] border ${className}`.trim()}>
179
- {options.map((opt) => (
180
- <button key={opt.value} type="button" aria-pressed={value === opt.value} onClick={() => onChange?.(opt.value)} className="kol-btn-group-cell flex-1 whitespace-nowrap px-[16px]">{opt.label}</button>
181
- ))}
182
- </div>
183
- )
184
- }
185
- /* layout="joined" variant="kolbox" with a `value` (Folio on kolbox, 2026-11-22): kolbox's choice that stays (Off and On,
186
- * Miter, Round and Bevel) is its tab track, so this draws TabsRow kolbox sm's track and cells (its chrome,
187
- * `.kol-tabs--kolbox-sm`, kol-components-molecules.css) as a group: `options` `[{ value, label }]`, the picked cell lit and
188
- * aria-pressed, `ariaLabel` names it. */
189
- function JoinedKolboxChoice({ value, onChange, options, ariaLabel, className }) {
164
+ /* layout="joined" variant="track" (Folio on kolbox, 2026-11-22; a plain variant since W3 run 2): a choice that stays (Off
165
+ * and On, Miter, Round and Bevel) on the tab track, TabsRow `variant="track"` sm's track and cells (`.kol-tabs-track`,
166
+ * kol-components-molecules.css) as a group: `options` `[{ value, label }]`, the picked cell lit and aria-pressed,
167
+ * `ariaLabel` names it. `kol-tabs--kolbox-sm` stays on the box as a hook for kol-fxr's touch height (retirement ledger). */
168
+ function JoinedTrack({ value, onChange, options, ariaLabel, className }) {
190
169
  return (
191
- <div role="group" aria-label={ariaLabel} className={`kol-tabs--kolbox kol-tabs--kolbox-sm inline-flex h-(--kol-kolbox-ctl) items-center gap-px p-0.5 ${className}`.trim()}>
170
+ <div role="group" aria-label={ariaLabel} className={`kol-tabs-track kol-tabs-track--sm kol-tabs--kolbox-sm inline-flex items-center gap-px p-0.5 ${className}`.trim()}>
192
171
  {options.map((opt) => (
193
172
  <button key={opt.value} type="button" aria-pressed={opt.value === value} disabled={opt.disabled} onClick={() => onChange?.(opt.value)}
194
173
  className={`kol-tabs-tab${opt.value === value ? ' is-active' : ''} flex h-full min-w-0 flex-1 items-center justify-center px-3 whitespace-nowrap outline-none focus-visible:outline-solid focus-visible:outline-1 disabled:opacity-40`}>{opt.label}</button>
@@ -197,11 +176,14 @@ function JoinedKolboxChoice({ value, onChange, options, ariaLabel, className })
197
176
  )
198
177
  }
199
178
 
179
+ /* the old theme words: accepted, `icons` without a value, `track` with one (W3 run 2, on the retirement ledger) */
180
+ const THEME_WORDS = ['kolbox', 'folio']
200
181
 
201
182
  /* layout="joined" — the segmented control (SegmentedToggle's implementation, moved here 2026-11-06) */
202
- function Joined({ value, onChange, options = [], variant = 'default', size = 'md', tone = 'default', ariaLabel, className = '' }) {
203
- if (variant === 'kolbox') return value == null ? <JoinedKolbox options={options} tone={tone} className={className} /> : <JoinedKolboxChoice value={value} onChange={onChange} options={options} ariaLabel={ariaLabel} className={className} />
204
- if (variant === 'folio') return <JoinedFolio value={value} onChange={onChange} options={options} ariaLabel={ariaLabel} className={className} />
183
+ function Joined({ value, onChange, options = [], variant: variantProp = 'default', size = 'md', tone = 'default', ariaLabel, className = '' }) {
184
+ const variant = THEME_WORDS.includes(variantProp) ? (value == null ? 'icons' : 'track') : variantProp
185
+ if (variant === 'icons') return <JoinedIcons options={options} tone={tone} className={className} />
186
+ if (variant === 'track') return <JoinedTrack value={value} onChange={onChange} options={options} ariaLabel={ariaLabel} className={className} />
205
187
  const cellType = { xs: 'kol-mono-8', sm: 'kol-mono-12', md: 'kol-mono-14', lg: 'kol-mono-16' }[size]
206
188
  const stateless = value == null
207
189
  const focusIdx = Math.max(0, options.findIndex((opt) => opt.value === value))
@@ -3,7 +3,6 @@ import Button from '../atoms/Button.jsx'
3
3
  import { IconLoader } from '@kolkrabbi/kol-icons'
4
4
  import { PopoverPanel, Tooltip, usePopover } from '../utilities/Popover.jsx'
5
5
  import KolboxGlyph from '../utilities/kolboxGlyph.jsx'
6
- import { Menu } from './Menu.jsx'
7
6
 
8
7
  /* taxonomy-ok: molecule — two Buttons (atoms) and a divider, the ⌄ opening a PopoverPanel (utility) of rows */
9
8
 
@@ -18,94 +17,95 @@ import { Menu } from './Menu.jsx'
18
17
  * @param {Function} onClick the main action
19
18
  * @param {Array} [items] `[{ label, icon?, onPress, disabled? }]` — the menu's rows
20
19
  * @param {Function} [menu] `(close) => ReactNode` — the menu's content instead of `items`
21
- * @param {'default'|'kolbox'|'folio'} [variant='default'] `folio`: Folio's split (see its branch), `tone`
22
- * primary or unset, `items` on Menu folio; `kolbox`: see the branch below; takes `tone` (primary, secondary), `icon`,
23
- * `onClick`, `onMenu` (the ⌄'s press; the host opens its menu), `menuLabel`; with `iconOnly`
24
- * (a glyph name) it is the tool dock's slot: `pressed` the armed look, `tooltip` the
25
- * main half's tooltip label, `aria-label` the main half's name, `menuOpen` the ⌄'s
26
- * menu is open (its quiet fill)
20
+ * ONE SPLIT, THREE SHAPES (plan-2026-11-29-one-set-fold W3 run 2), picked by what the caller passes, never by a theme:
21
+ * - the menu its own (the default): `items` (or `menu`) open under the ⌄ in a PopoverPanel at `placement`
22
+ * (`bottom-end`, the list's right edge under the split's right edge)
23
+ * - `onMenu` (kolbox's SplitButton): the host opens its own menu, the ⌄'s press is `onMenu`; the action and a narrow ⌄
24
+ * are two Buttons of one tone 1px apart, square where they meet, the hovered half the fg-04 hover over its fill, the
25
+ * ghost tone filling both halves on hover or `is-open` (kol-theme `.kol-btn-split--narrow`, its fill
26
+ * `--kol-btn-split-fill`)
27
+ * - `iconOnly` (a glyph name, the tool dock's slot): a 32 tile and a 16 by 32 ⌄, 1 apart; `pressed` the armed look,
28
+ * `tooltip` the main half's tooltip label, `aria-label` the main half's name, `menuOpen` the ⌄'s menu is open (its
29
+ * quiet fill); the ⌄ is `onMenu`, else it opens `items` as above (`.kol-btn-split--icon`)
30
+ * @param {Function} [onMenu] the ⌄'s press when the host opens its menu
31
+ * @param {'kolbox'|'folio'} [variant] accepted (on the retirement ledger): `kolbox` draws the `onMenu` shape, `folio` the
32
+ * default. Folio's own split (its line, its green) is in `_tmp/2026-11-29-one-set-fold/`
27
33
  * @param {string} [tone] · {'xs'|'sm'|'md'|'lg'} [size='md']
28
34
  * @param {boolean} [disabled] the main action off; the menu still opens
29
35
  * @param {string} [menuLabel='More actions'] the ⌄'s aria-label
30
36
  * @param {string} [placement='bottom-end'] · {string} [className]
31
37
  * @param {'primary'|'secondary'} [accent='primary'] the theme's accent the split draws (data-accent, kol-color.css)
32
38
  */
33
- export default function ButtonSplit({ children, icon, onClick, items = [], menu, variant = 'default', tone, size = 'md', disabled = false, menuLabel = 'More actions', placement = 'bottom-end', className = '', accent, onMenu, menuOpen, iconOnly, pressed, tooltip, 'aria-label': ariaLabel }) {
39
+ /* the old theme words: `kolbox` the host-menu shape, `folio` the default (W3 run 2, on the retirement ledger) */
40
+ const THEME_WORDS = ['kolbox', 'folio']
41
+
42
+ export default function ButtonSplit({ children, icon, onClick, items = [], menu, variant, tone, size = 'md', disabled = false, menuLabel = 'More actions', placement = 'bottom-end', className = '', accent, onMenu, menuOpen, iconOnly, pressed, tooltip, 'aria-label': ariaLabel }) {
34
43
  const [open, setOpen] = useState(false)
35
44
  const popover = usePopover({ open, onOpenChange: setOpen, placement, offset: 6, role: 'menu' })
36
- /* `variant="kolbox"` (plan-2026-11-18-kolbox-system W31.2 batch 3, 2026-11-18): kolbox's SplitButton carried class for
37
- * class, the action and its ⌄ as two kolbox Buttons of one tone, 1px apart, square where they meet; the hovered half
38
- * takes the fg-04 hover over its own fill (kol-theme `.kol-btn-split--kolbox`). The host opens its own menu: `onMenu`
39
- * is the ⌄'s press. */
40
- if (variant === 'kolbox') {
41
- /* the icon-only form (the tool dock's slot with a fold), Figma's dock as measured 2026-11-20 (W16.3): two boxes 1
42
- * apart, no divider and no joined half. The tool a 32 tile with the 22 glyph (Figma's draw 16 to 18, W2), rounded on all four corners, solid
43
- * accent while `pressed`; the ⌄ its own 16 by 32 button, no fill at rest (pressed or not), the quiet fill on hover
44
- * and while its menu is open (`menuOpen`); `tooltip` names the main half */
45
- if (iconOnly) {
46
- const main = (
47
- <button type="button" aria-label={ariaLabel} aria-pressed={!!pressed} disabled={disabled} onClick={onClick}
48
- className="kol-btn-split-main inline-flex size-8 shrink-0 items-center justify-center outline-none focus-visible:outline-solid focus-visible:outline-1">
49
- <IconLoader name={iconOnly} size={22} className="kol-kolbox-icon shrink-0" />
50
- </button>
51
- )
52
- return (
53
- <div data-accent={accent === 'secondary' ? accent : undefined} className={`kol-btn-split--kolbox kol-btn-split--kolbox-icon${pressed ? ' is-pressed' : ''} inline-flex shrink-0 gap-px ${className}`.trim()}>
54
- {tooltip ? <Tooltip variant="kolbox" label={tooltip}>{main}</Tooltip> : main}
55
- <Tooltip variant="kolbox" asChild label={menuLabel}>
56
- <button type="button" aria-label={menuLabel} aria-expanded={!!menuOpen} onClick={onMenu}
57
- className={`kol-btn-split-menu${menuOpen ? ' is-open' : ''} inline-flex h-8 w-4 shrink-0 items-center justify-center outline-none focus-visible:outline-solid focus-visible:outline-1`}>
58
- <KolboxGlyph name="chevron-down" />
59
- </button>
60
- </Tooltip>
61
- </div>
62
- )
63
- }
45
+ const dataAccent = accent === 'secondary' ? accent : undefined
46
+ const close = () => setOpen(false)
47
+ const pick = (it) => () => { if (it.disabled) return; it.onPress?.(); close() }
48
+ /* the menu its own: the rows of `items` (or `menu`) in a PopoverPanel under the ⌄ */
49
+ const panel = (
50
+ <PopoverPanel popover={popover} panel={false} focus={false}
51
+ className="w-max bg-surface-secondary border border-oq-08 rounded shadow-lg">
52
+ {menu ? menu(close) : items.map((it) => (
53
+ <button key={it.label} type="button" disabled={it.disabled} onClick={pick(it)}
54
+ className="w-full kol-helper-12 px-3 h-8 flex items-center gap-2 text-body hover:text-emphasis disabled:opacity-40 disabled:cursor-not-allowed disabled:hover:text-body text-left">
55
+ <span className="flex-1 truncate">{it.label}</span>
56
+ </button>
57
+ ))}
58
+ </PopoverPanel>
59
+ )
60
+ /* the icon-only form (the tool dock's slot with a fold), Figma's dock as measured 2026-11-20 (W16.3): two boxes 1
61
+ * apart, no divider and no joined half. The tool a 32 tile with the 22 glyph (Figma's draw 16 to 18, W2), rounded on all
62
+ * four corners, solid accent while `pressed`; the ⌄ its own 16 by 32 button, no fill at rest (pressed or not), the quiet
63
+ * fill on hover and while its menu is open (`menuOpen`); `tooltip` names the main half */
64
+ if (iconOnly) {
65
+ const main = (
66
+ <button type="button" aria-label={ariaLabel} aria-pressed={!!pressed} disabled={disabled} onClick={onClick}
67
+ className="kol-btn-split-main inline-flex size-8 shrink-0 items-center justify-center outline-none focus-visible:outline-solid focus-visible:outline-1">
68
+ <IconLoader name={iconOnly} size={22} className="kol-kolbox-icon shrink-0" />
69
+ </button>
70
+ )
71
+ const lit = menuOpen ?? (!onMenu && open)
72
+ const chevron = (
73
+ <button type="button" aria-label={menuLabel} aria-expanded={!!lit} onClick={onMenu}
74
+ className={`kol-btn-split-menu${lit ? ' is-open' : ''} inline-flex h-8 w-4 shrink-0 items-center justify-center outline-none focus-visible:outline-solid focus-visible:outline-1`}>
75
+ <KolboxGlyph name="chevron-down" />
76
+ </button>
77
+ )
64
78
  return (
65
- <div data-accent={accent === 'secondary' ? accent : undefined} className={`kol-btn-split--kolbox inline-flex shrink-0 gap-px ${className}`}>
66
- <Button variant="kolbox" tone={tone} iconLeft={icon} onClick={onClick} className="rounded-r-none">{children}</Button>
67
- <Tooltip variant="kolbox" asChild label={menuLabel}><Button variant="kolbox" tone={tone} iconLeft="chevron-down" onClick={onMenu} aria-label={menuLabel} className="rounded-l-none px-1" /></Tooltip>
79
+ <div data-accent={dataAccent} className={`kol-btn-split--narrow kol-btn-split--icon${pressed ? ' is-pressed' : ''} inline-flex shrink-0 gap-px ${className}`.trim()}>
80
+ {tooltip ? <Tooltip label={tooltip}>{main}</Tooltip> : main}
81
+ {onMenu
82
+ ? <Tooltip asChild label={menuLabel}>{chevron}</Tooltip>
83
+ : <span ref={popover.refs.setReference} {...popover.getReferenceProps()} className="inline-flex"><Tooltip asChild label={menuLabel}>{chevron}</Tooltip></span>}
84
+ {!onMenu && panel}
68
85
  </div>
69
86
  )
70
87
  }
71
- /* `variant="folio"` (Folio migration batch B, 2026-11-22): Folio's ActionSplit carried class for class (kol-theme
72
- * `.kol-btn-split--folio`): two joined 32-high halves at radius 4 inside one line, the label padded 16, the ⌄ a 32
73
- * square, a hairline in the ink at 20% between; `tone="primary"` the green ground, unset the paper. The ⌄ opens
74
- * `items` on `Menu variant="folio"` under its right edge, in place (never portalled). Esc or a press outside closes. */
75
- if (variant === 'folio') {
88
+ /* the host opens its menu (kolbox's SplitButton, W31.2 batch 3, 2026-11-18): the action and its ⌄ as two Buttons of one
89
+ * tone, 1px apart, square where they meet; the hovered half takes the fg-04 hover over its own fill (kol-theme
90
+ * `.kol-btn-split--narrow`). `onMenu` is the ⌄'s press. */
91
+ if (onMenu || variant === THEME_WORDS[0]) {
76
92
  return (
77
- <span data-accent={accent === 'secondary' ? accent : undefined} className={`kol-btn-split--folio${tone === 'primary' ? ' kol-btn-split--folio-primary' : ''} relative inline-flex ${className}`.trim()}>
78
- <span className="kol-btn-split-box flex h-[32px] shrink-0 overflow-hidden rounded-[4px] border">
79
- <button type="button" onClick={onClick} className="kol-btn-split-main whitespace-nowrap px-[16px]">{children}</button>
80
- <span aria-hidden className="w-px bg-current opacity-20" />
81
- <button type="button" aria-label={menuLabel} aria-haspopup="menu" aria-expanded={open} onClick={() => setOpen(!open)} className="flex w-[32px] items-center justify-center"><IconLoader name="chevron-down" size={16} /></button>
82
- </span>
83
- <Menu variant="folio" open={open} onClose={() => setOpen(false)} aria-label={menuLabel} minWidth={160}
84
- panelClassName="absolute right-0 top-[calc(100%+4px)] whitespace-nowrap"
85
- items={items.map((it) => ({ label: it.label, onClick: it.onPress, disabled: it.disabled }))} />
86
- </span>
93
+ <div data-accent={dataAccent} className={`kol-btn-split--narrow inline-flex shrink-0 gap-px ${className}`}>
94
+ <Button tone={tone} iconLeft={icon} onClick={onClick} className="rounded-r-none">{children}</Button>
95
+ <Tooltip asChild label={menuLabel}><Button tone={tone} iconLeft="chevron-down" onClick={onMenu} aria-label={menuLabel} className="rounded-l-none px-1" /></Tooltip>
96
+ </div>
87
97
  )
88
98
  }
89
- const close = () => setOpen(false)
90
99
  const shared = { tone, size }
91
- const pick = (it) => () => { if (it.disabled) return; it.onPress?.(); close() }
92
100
  return (
93
- <div data-accent={accent === 'secondary' ? accent : undefined} className={`kol-btn-split inline-flex items-stretch ${className}`.trim()}>
101
+ <div data-accent={dataAccent} className={`kol-btn-split inline-flex items-stretch ${className}`.trim()}>
94
102
  <Button {...shared} iconLeft={icon} iconSize={12} disabled={disabled} onClick={onClick} className="flex-1 min-w-0 rounded-r-none">{children}</Button>
95
103
  <span aria-hidden="true" className="w-px shrink-0 bg-oq-16" />
96
104
  <span ref={popover.refs.setReference} {...popover.getReferenceProps()} className="inline-flex">
97
105
  <Button {...shared} iconOnly="chevron-down" iconSize={12} pressed={open} aria-label={menuLabel}
98
106
  className="rounded-l-none" />
99
107
  </span>
100
- <PopoverPanel popover={popover} panel={false} focus={false}
101
- className="w-max bg-surface-secondary border border-oq-08 rounded shadow-lg">
102
- {menu ? menu(close) : items.map((it) => (
103
- <button key={it.label} type="button" disabled={it.disabled} onClick={pick(it)}
104
- className="w-full kol-helper-12 px-3 h-8 flex items-center gap-2 text-body hover:text-emphasis disabled:opacity-40 disabled:cursor-not-allowed disabled:hover:text-body text-left">
105
- <span className="flex-1 truncate">{it.label}</span>
106
- </button>
107
- ))}
108
- </PopoverPanel>
108
+ {panel}
109
109
  </div>
110
110
  )
111
111
  }
@@ -50,7 +50,7 @@ export default function ContextMenu({ menu, children, variant, className = '' })
50
50
  }, [menu.open])
51
51
  if (!menu.open) return null
52
52
  return (
53
- <Menu anchor={{ x: menu.x, y: menu.y }} open onOpenChange={(v) => { if (!v) menu.close() }} variant={variant} panelClassName={`min-w-44 ${className}`.trim()}>
53
+ <Menu anchor={{ x: menu.x, y: menu.y }} placement="right-start" offset={2} open onOpenChange={(v) => { if (!v) menu.close() }} variant={variant} panelClassName={`min-w-44 ${className}`.trim()}>
54
54
  {/* Any click inside closes — a menu item that leaves the menu open after acting is the one interaction people
55
55
  * report as broken. Items keep their own onClick; this runs after it on the way up. */}
56
56
  <div onClick={menu.close} role="none" className="flex flex-col gap-[var(--kol-spacing-0-5)]">
@@ -61,25 +61,24 @@ const ROW = { xs: `kol-mono-8 ${ROW_PAD.xs} ${ROW_H.xs}`, sm: `kol-mono-12 ${ROW
61
61
 
62
62
  const LEGACY_VARIANTS = { default: 'primary', subtle: 'primary', minimal: 'outline' }
63
63
 
64
- /* `variant="kolbox"` (plan-2026-11-18-kolbox-system W31.2 batch 4, 2026-11-18): kolbox's Dropdown carried line for line,
65
- * the chrome in kol-theme `.kol-dd--kolbox`. The closed field with the 12 chevron at the right: a button that opens
66
- * `Menu variant="kolbox"` UNDER itself, 4 apart, and over it only when there is no room under (KolboxDropdownOpensUnder,
67
- * kol-fxr 2026-11-28, as Figma's lists; it lay over the field, the chosen row on it, until then), at least as wide as the
68
- * field, with a check on the current option.
69
- * align left (unset): the list's left edge on the field's; right: its right edge on the field's.
70
- * `options` strings or `{ value, label }`; `onChange` gets the value as a string. Enter, Space or ArrowDown opens; in the
71
- * menu the arrows move, Enter picks, a letter jumps, Escape closes; focus comes back to the field.
72
- * size sm (unset) the 28 field; xs the 24 filter (Home's), no fill, Figma's filter measured (plan-2026-11-23-editor-
64
+ /* THE FIELD (plan-2026-11-29-one-set-fold W3; kolbox's Dropdown, W31.2 batch 4, carried line for line): `fused={false}`.
65
+ * The closed field with the 12 chevron at the right: a button that opens the one `Menu` UNDER itself, 4 apart, and over
66
+ * it only when there is no room under (KolboxDropdownOpensUnder, kol-fxr 2026-11-28, as Figma's lists), at least as wide
67
+ * as the field, with a check on the current option. Its look is the theme's (`--kol-dd-field-*`, kol-theme `.kol-dd-field`):
68
+ * the default theme draws KOL's field, `data-theme-variant="kolbox"` kolbox's (28, xs the 24 filter, the kolbox line).
69
+ * align left (unset): the list's left edge on the field's; right (or Folio's bottom-right): its right edge on the field's.
70
+ * `options` strings or `{ value, label }`; `onChange` gets the value as a string (a number option's as a number). Enter,
71
+ * Space or ArrowDown opens; in the menu the arrows move, Enter picks, a letter jumps, Escape closes; focus comes back to
72
+ * the field.
73
+ * size sm (unset) the field; xs the filter (Home's), no fill, Figma's filter measured (plan-2026-11-23-editor-
73
74
  * measured-against-figma W7): the value 8 in, the chevron's glyph 5 after it and 7 off the right edge
74
- * tone unset: the outlined field, the oq-24 line only (the master's default), the line the accent while open or
75
- * focused; `grey`: the unbordered field (oq-16 at sm, bare at xs), padding 12 left and 4 right, the chevron 4
76
- * after the value, so it hugs its value (the top rail's zoom)
75
+ * tone unset: the outlined field, the line only; `grey`: the unbordered field (the field fill at sm, bare at xs),
76
+ * padding 12 left and 4 right, the chevron 4 after the value, so it hugs its value (the top rail's zoom)
77
77
  * menu a trigger for its own overlay instead of the option list (the zoom's): menu({ anchor, open, onClose }) is drawn
78
78
  * in place of the Menu, and the field reads `value` as it is
79
79
  * ariaLabel what it chooses, as KOL's Dropdown; other props (disabled, data-*) land on the button
80
- * Folio on kolbox (2026-11-22): a number option's value reaches `onChange` as a number (every other as a string); a
81
- * `value` no option holds is shown as it is */
82
- function DropdownKolbox({ size, tone, value, options = [], onChange, menu, ariaLabel, align = 'left', className = '', variant, accent, ...rest }) {
80
+ * a `value` no option holds is shown as it is (Folio on kolbox, 2026-11-22) */
81
+ function DropdownField({ size, tone, value, options = [], onChange, menu, ariaLabel, align = 'left', className = '', variant, accent, ...rest }) { // eslint-disable-line no-unused-vars
83
82
  const ref = useRef(null)
84
83
  const [open, setOpen] = useState(false)
85
84
  const outlined = tone !== 'grey'
@@ -98,6 +97,7 @@ function DropdownKolbox({ size, tone, value, options = [], onChange, menu, ariaL
98
97
  const on = o === current
99
98
  groups.at(-1).push({ label: o.label, value: o.value, check: held ? on : undefined, highlighted: on })
100
99
  }
100
+ /* `kol-dd--kolbox` and `kol-dd-caret--kolbox` ride along as hooks for kol-fxr's own rules, on the retirement ledger */
101
101
  return (
102
102
  <>
103
103
  <button
@@ -115,20 +115,19 @@ function DropdownKolbox({ size, tone, value, options = [], onChange, menu, ariaL
115
115
  e.preventDefault(); e.stopPropagation()
116
116
  if (e.key !== 'ArrowUp') setOpen(true)
117
117
  }}
118
- className={`kol-dd--kolbox${outlined ? ' kol-dd--kolbox-outlined' : ''}${outlined && open ? ' is-open' : ''}${!outlined && !xs ? ' kol-dd--kolbox-filled' : ''} relative flex min-w-0 cursor-pointer items-center disabled:cursor-default disabled:opacity-40 ${xs ? 'h-6 bg-transparent' : 'h-(--kol-kolbox-ctl)'} text-left outline-none ${outlined ? (xs ? 'gap-0.5 border pr-[3px] pl-[7px]' : 'gap-2 border px-2') : 'gap-1 pr-1 pl-3 focus-visible:outline-1'} ${className}`}
118
+ className={`kol-dd-field kol-dd--kolbox${outlined ? ' kol-dd-field--outlined' : ''}${outlined && open ? ' is-open' : ''}${!outlined && !xs ? ' kol-dd-field--filled' : ''} relative flex min-w-0 cursor-pointer items-center disabled:cursor-default disabled:opacity-40 ${xs ? 'h-[var(--kol-dd-field-xs-h,var(--kol-ctl-xs))] bg-transparent' : 'h-[var(--kol-dd-field-h,var(--kol-ctl-sm))]'} text-left outline-none ${outlined ? (xs ? 'gap-0.5 border pr-[3px] pl-[7px]' : 'gap-2 border px-2') : 'gap-1 pr-1 pl-3 focus-visible:outline-1'} ${className}`}
119
119
  {...rest}
120
120
  >
121
121
  <span className="min-w-0 flex-1 truncate">{current?.label}</span>
122
- <KolboxGlyph name="chevron-down" className="kol-dd-caret--kolbox pointer-events-none" />
122
+ <KolboxGlyph name="chevron-down" className="kol-dd-field-caret kol-dd-caret--kolbox pointer-events-none" />
123
123
  </button>
124
124
  {menu ? menu({ anchor: ref, open, onClose: close }) : <Menu
125
- variant="kolbox"
126
125
  anchor={ref}
127
126
  open={open}
128
127
  onClose={close}
129
128
  onSelect={(row) => onChange?.(typeof row.value === 'number' ? row.value : String(row.value))}
130
129
  groups={groups}
131
- placement={align === 'right' ? 'bottom-end' : 'bottom-start'}
130
+ placement={/right/.test(align) ? 'bottom-end' : 'bottom-start'}
132
131
  accent={accent}
133
132
  aria-label={ariaLabel}
134
133
  minWidth={ref.current?.offsetWidth}
@@ -137,42 +136,11 @@ function DropdownKolbox({ size, tone, value, options = [], onChange, menu, ariaL
137
136
  )
138
137
  }
139
138
 
140
- /* `variant="folio"` (Folio migration batch B, 2026-11-22): Folio's Choice carried class for class, the chrome in kol-theme
141
- * `.kol-dd--folio`. The button is as wide as its text (its type is the caller's or the row's), the ⌄ after it; the list
142
- * opens under it in place (never portalled, so it keeps the frame's `data-folio-*`), the current row green with its ✓.
143
- * Esc or a press outside closes. `options` `{ value, label }` (a label may be a node; `value` reaches `onChange` as it
144
- * is), `ariaLabel`, `disabled`, `className` (the button's). Folio's own word: `align` left (unset), right, bottom-left,
145
- * bottom-right: the list's edge and side. */
146
- function DropdownFolio({ value, options = [], onChange, ariaLabel, disabled, align = 'left', className = '', accent }) {
147
- const [open, setOpen] = useState(false)
148
- const box = useRef(null)
149
- useEffect(() => {
150
- if (!open) return undefined
151
- const off = (e) => { if (!box.current?.contains(e.target)) setOpen(false) }
152
- const esc = (e) => e.key === 'Escape' && setOpen(false)
153
- addEventListener('mousedown', off); addEventListener('keydown', esc)
154
- return () => { removeEventListener('mousedown', off); removeEventListener('keydown', esc) }
155
- }, [open])
156
- const current = options.find((o) => o.value === value)?.label ?? value
157
- return (
158
- <span data-accent={accent === 'secondary' ? accent : undefined} ref={box} className="relative inline-flex">
159
- <button type="button" aria-label={ariaLabel} aria-haspopup="listbox" aria-expanded={open} disabled={disabled} onClick={() => setOpen(!open)} className={`kol-dd--folio inline-flex items-center gap-[4px] rounded-[3px] disabled:cursor-default ${className}`}>
160
- {current}{!disabled && <span aria-hidden className="kol-dd-caret--folio">⌄</span>}
161
- </button>
162
- {open && (
163
- <span role="listbox" aria-label={ariaLabel} className={`kol-dd-list--folio absolute z-50 flex min-w-[160px] flex-col rounded-[3px] border py-[4px] ${/right/.test(align) ? 'right-0' : 'left-0'} ${/bottom/.test(align) ? 'bottom-[calc(100%+6px)]' : 'top-[calc(100%+6px)]'}`}>
164
- {options.map((o) => (
165
- <button key={o.value} type="button" role="option" aria-selected={o.value === value} onClick={() => { setOpen(false); onChange?.(o.value) }} className={`kol-dd-option--folio${o.value === value ? ' is-current' : ''} flex items-center gap-[8px] whitespace-nowrap px-[12px] py-[7px] text-left`}>
166
- <span aria-hidden className="kol-dd-check--folio inline-flex size-[16px] shrink-0 items-center justify-center">{o.value === value ? '✓' : ''}</span>{o.label}
167
- </button>
168
- ))}
169
- </span>
170
- )}
171
- </span>
172
- )
173
- }
174
-
175
- const Dropdown = (props) => (props.variant === 'kolbox' ? <DropdownKolbox {...props} /> : props.variant === 'folio' ? <DropdownFolio {...props} /> : <DropdownOn {...props} />)
139
+ /* the old theme words in `variant`: accepted, and they ask for the field (`fused={false}`), the build kolbox and Folio
140
+ * drew (W3, on the retirement ledger); the theme draws its look. Folio's own list went to _tmp/2026-11-29-one-set-fold/. */
141
+ const THEME_WORDS = ['kolbox', 'folio']
142
+ /* `fused` (true unset): the one-piece select, its list continuing the trigger; false: the field, its list a Menu under it */
143
+ const Dropdown = ({ fused, ...props }) => ((fused ?? !THEME_WORDS.includes(props.variant)) ? <DropdownOn {...props} /> : <DropdownField {...props} />)
176
144
 
177
145
  const DropdownOn = ({
178
146
  options = [],
@@ -271,7 +239,7 @@ const DropdownOn = ({
271
239
 
272
240
  /* `variant="raised"` retires into `tone="faint"` (2026-10-31) — the alias, until nobody passes it */
273
241
  if (variant === 'raised') { variant = undefined; tone = 'faint' }
274
- const resolvedVariant = LEGACY_VARIANTS[variant] || variant
242
+ const resolvedVariant = THEME_WORDS.includes(variant) ? undefined : LEGACY_VARIANTS[variant] || variant
275
243
 
276
244
  /* The panel is `Menu fused` (plan-2026-10-31-menu-engine W1.3): below the trigger, never flipped (the fused edge
277
245
  * assumes below), the trigger's width, a listbox. */