@kolkrabbi/kol-component 0.379.0 → 0.381.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 (65) hide show
  1. package/package.json +4 -4
  2. package/src/atoms/Badge.jsx +1 -5
  3. package/src/atoms/Button.jsx +4 -11
  4. package/src/atoms/Input.jsx +2 -6
  5. package/src/atoms/Pill.jsx +1 -3
  6. package/src/atoms/ProgressBar.jsx +3 -6
  7. package/src/atoms/SectionLabel.jsx +0 -22
  8. package/src/atoms/Tag.jsx +4 -7
  9. package/src/atoms/Textarea.jsx +1 -5
  10. package/src/atoms/ToggleCheckbox.jsx +3 -5
  11. package/src/atoms/ToggleSwitch.jsx +2 -7
  12. package/src/atoms/ViewToggle.jsx +0 -27
  13. package/src/index.js +1 -1
  14. package/src/molecules/AccountMenu.jsx +2 -2
  15. package/src/molecules/ButtonGroup.jsx +5 -14
  16. package/src/molecules/ButtonSplit.jsx +12 -26
  17. package/src/molecules/ContentRow.jsx +1 -29
  18. package/src/molecules/ContextMenu.jsx +0 -1
  19. package/src/molecules/DocsToc.jsx +1 -16
  20. package/src/molecules/Dropdown.jsx +4 -17
  21. package/src/molecules/EmptyState.jsx +1 -15
  22. package/src/molecules/FieldPair.jsx +1 -1
  23. package/src/molecules/Header.jsx +4 -4
  24. package/src/molecules/IndexRow.jsx +1 -1
  25. package/src/molecules/InlineAddRow.jsx +2 -2
  26. package/src/molecules/LabeledControl.jsx +5 -11
  27. package/src/molecules/LayerRow.jsx +1 -1
  28. package/src/molecules/LinkAddRow.jsx +5 -7
  29. package/src/molecules/Menu.jsx +11 -30
  30. package/src/molecules/MenuFloat.jsx +6 -12
  31. package/src/molecules/MenuList.jsx +5 -11
  32. package/src/molecules/Modal.jsx +16 -48
  33. package/src/molecules/ModalHeader.jsx +12 -20
  34. package/src/molecules/ModalShell.jsx +4 -7
  35. package/src/molecules/NoticeBanner.jsx +1 -1
  36. package/src/molecules/PanelsMenu.jsx +2 -2
  37. package/src/molecules/PasswordInput.jsx +1 -1
  38. package/src/molecules/QuantityInput.jsx +2 -18
  39. package/src/molecules/QuickLookFrame.jsx +2 -31
  40. package/src/molecules/RailHeader.jsx +11 -20
  41. package/src/molecules/ReadingActions.jsx +2 -2
  42. package/src/molecules/ReadingNotes.jsx +3 -3
  43. package/src/molecules/ReadingSettings.jsx +8 -8
  44. package/src/molecules/SearchInput.jsx +4 -5
  45. package/src/molecules/SectionText.jsx +2 -9
  46. package/src/molecules/SettingsControls.jsx +23 -23
  47. package/src/molecules/Slider.jsx +3 -54
  48. package/src/molecules/SpecList.jsx +1 -21
  49. package/src/molecules/TabsRow.jsx +6 -50
  50. package/src/molecules/TaskRow.jsx +2 -2
  51. package/src/molecules/TocRow.jsx +1 -1
  52. package/src/molecules/WorkspaceSwitcher.jsx +3 -6
  53. package/src/organisms/CommandOverlay.jsx +16 -116
  54. package/src/organisms/ContentFilters.jsx +4 -12
  55. package/src/organisms/MediaLibrary.jsx +0 -55
  56. package/src/organisms/NavRail.jsx +1 -4
  57. package/src/organisms/ReadingContents.jsx +2 -2
  58. package/src/organisms/ReadingOverview.jsx +5 -5
  59. package/src/organisms/ReadingPanel.jsx +1 -1
  60. package/src/organisms/SettingsPanel.jsx +19 -40
  61. package/src/organisms/Table.jsx +1 -49
  62. package/src/utilities/Popover.jsx +2 -4
  63. package/src/utilities/SelectionOverlay.jsx +1 -45
  64. package/src/molecules/FloatModuleHeader.jsx +0 -11
  65. package/src/organisms/NavRailFloat.jsx +0 -139
@@ -21,15 +21,6 @@ import { fileAgo } from '../molecules/ContentCard.jsx'
21
21
  * sorts itself needs no state from the page. Pass `sortValue(row)` when the
22
22
  * rendered cell is not what should be compared (a chip, a link, a date
23
23
  * string).
24
- *
25
- * FLOAT (`variant="float"`, float-everything W8 rows 115 · 116, 2026-11-04 — kol-float--style 48:2780 analytics,
26
- * 48:3257 catalog): its own render, none of `.kol-table`'s rules. The head in mono (`kol-float-ruler`, 10, uppercase
27
- * by the table's role) on the emphasis ink; body cells in `kol-float-timecode` (mono 12) on fg-64, or the float sans
28
- * (`kol-float-hint`) for a column with `sans: true`; 12 · 16 in a cell, no rules between rows (the no-borders law —
29
- * rows lift fg-08 under the pointer instead). `align: 'right'` right-aligns a column (the numbers, the share). A cell's
30
- * `render` draws covers and status pills (`Pill variant="float"`) — the catalog's cover · title · status row.
31
- * `framed` sets it on a sheet (surface-secondary on `--kol-float-menu-r`, 8 in) — the catalog; unframed it sits on
32
- * whatever float holds it — the analytics card.
33
24
  */
34
25
  const collator = new Intl.Collator(undefined, { numeric: true, sensitivity: 'base' })
35
26
 
@@ -46,7 +37,7 @@ const WIDTHS = {
46
37
  column: '',
47
38
  }
48
39
 
49
- const TableDefault = ({ caption, columns, rows, variant = 'default', className = '', width = 'panel', rowClassName, compact = false, lastRule = false, framed = false }) => {
40
+ const TableDefault = ({ caption, columns, rows, variant = 'default', className = '', width = 'panel', rowClassName, compact = false, lastRule = false }) => {
50
41
  const [sort, setSort] = useState({ key: null, dir: null })
51
42
 
52
43
  const cycle = (key) =>
@@ -68,7 +59,6 @@ const TableDefault = ({ caption, columns, rows, variant = 'default', className =
68
59
  })
69
60
  }, [rows, columns, sort])
70
61
 
71
- if (variant === 'float') return <FloatTable caption={caption} columns={columns} rows={sorted} sort={sort} cycle={cycle} framed={framed} rowClassName={rowClassName} className={`${WIDTHS[width] ?? WIDTHS.panel} ${className}`.trim()} />
72
62
 
73
63
  const variantClass = variant === 'simple' ? 'kol-table--simple' : ''
74
64
  /* compact — record-surface density (RecordManager, 2026-08-09): the default
@@ -128,44 +118,6 @@ const TableDefault = ({ caption, columns, rows, variant = 'default', className =
128
118
  )
129
119
  }
130
120
 
131
- function FloatTable({ caption, columns, rows, sort, cycle, framed, rowClassName, className }) {
132
- const align = (c) => (c.align === 'right' ? 'text-right' : 'text-left')
133
- return (
134
- <div className={`w-full overflow-x-auto ${framed ? 'rounded-[var(--kol-float-menu-r)] bg-surface-secondary p-2' : ''} ${className}`.trim()}>
135
- <table className="w-full border-collapse">
136
- {caption ? <caption className="sr-only">{caption}</caption> : null}
137
- <thead>
138
- <tr>
139
- {columns.map((c) => (
140
- <th key={c.accessor} scope="col" style={c.style} className={`kol-float-ruler whitespace-nowrap px-4 py-3 font-normal uppercase text-fg-emphasis first:pl-3 ${align(c)}`}
141
- aria-sort={sort.key === c.accessor ? (sort.dir === 'asc' ? 'ascending' : 'descending') : undefined}>
142
- {c.sortable ? (
143
- <button type="button" onClick={() => cycle(c.accessor)} className="inline-flex items-center gap-1 uppercase cursor-pointer">
144
- {c.header}
145
- <IconLoader name={sort.key === c.accessor && sort.dir === 'desc' ? 'arrow-down' : 'arrow-up'} size={10} className={sort.key === c.accessor ? 'text-oq-96' : 'opacity-0'} />
146
- </button>
147
- ) : c.header}
148
- </th>
149
- ))}
150
- </tr>
151
- </thead>
152
- <tbody>
153
- {rows.map((row, i) => (
154
- <tr key={row.id ?? row.token ?? i} className={`group${rowClassName ? ` ${rowClassName(row, i)}` : ''}`}>
155
- {columns.map((c) => (
156
- <td key={c.accessor} style={c.style}
157
- className={`${c.sans ? 'kol-float-hint' : 'kol-float-timecode'} whitespace-nowrap px-4 py-3 text-fg-64 group-hover:bg-fg-08 group-hover:text-fg-emphasis first:rounded-l-[var(--kol-float-list-r)] first:pl-3 last:rounded-r-[var(--kol-float-list-r)] ${align(c)}`}>
158
- {c.render ? c.render(row) : row[c.accessor] ?? '—'}
159
- </td>
160
- ))}
161
- </tr>
162
- ))}
163
- </tbody>
164
- </table>
165
- </div>
166
- )
167
- }
168
-
169
121
 
170
122
  /* ── kolbox (plan-2026-11-18-kolbox-system W31.2 batch 5, 2026-11-18) ─────────────────────────────────────────────────
171
123
  * kolbox's FileList with its FileListHeader and FileListRow (Figma `FileList`), carried from apps/kolbox/src/home: 20
@@ -144,7 +144,7 @@ export function usePopover({
144
144
  * kolbox's OverlayLayer carried line for line: the layer `Menu`, `PopoverPanel` and `ModalDialog` draw their kolbox look
145
145
  * in. Not floating-ui: its placements (`over`, a Dropdown's list lying over its field, 28.5; `beside`, a child menu
146
146
  * beside its parent panel) and its press-outside (on the window in the capture phase, 28.4) are kolbox's behavior and
147
- * belong to its variant only; KOL's default and float keep usePopover.
147
+ * belong to its variant only; KOL's default keeps usePopover.
148
148
  *
149
149
  * A portal to document.body (never inside a rail), fixed at its anchor (an element, a ref, or anything with
150
150
  * getBoundingClientRect), closing on a press outside it and its anchor, and on Escape. placement: bottom-start (a menu
@@ -427,8 +427,6 @@ function TooltipOn({
427
427
  triggerClassName = 'inline-flex',
428
428
  asChild = false,
429
429
  disabled = false,
430
- /* `float` (W16, round 3 — 2026-10-31): the floating style's tooltip, an inverted pill 24 (28 on touch) tall, 11 (12) type */
431
- variant,
432
430
  }) {
433
431
  const [open, setOpen] = useState(false)
434
432
  const [covered, setCovered] = useState(false)
@@ -490,7 +488,7 @@ function TooltipOn({
490
488
  popover={popover}
491
489
  focus={false}
492
490
  panel={false}
493
- className={variant === 'float' ? 'kol-tooltip kol-tooltip-float' : 'kol-tooltip'}
491
+ className="kol-tooltip"
494
492
  style={ambient ?? undefined}
495
493
  >
496
494
  <span>{label}</span>
@@ -51,11 +51,7 @@ import { Tooltip } from '../utilities/Popover.jsx'
51
51
  * @param {string} accentColor outline + handle + label color (default var(--kol-accent-primary))
52
52
  * @param {Function} labelFormatter (box) => string — dimension readout (default `${round(w)} × ${round(h)}`)
53
53
  * @param {string} rotateTitle tooltip on the rotate handle (default 'Rotate')
54
- * @param {'float'|'kolbox'} variant THE FLOAT LOOK (plan-2026-11-05-float-editor W2.6; his frame 19:6066 — "New text" ·
55
- * "600 × 160"): a solid 1px oq-64 outline, 6 square handles filled at full ink, the
56
- * rotate handle a 6 circle, `name` above the box's top-left (`kol-float-label`, oq-64) and
57
- * the size cap under it (`kol-float-ruler` on oq-08, the float list round). Unset, as before
58
- * @param {string} name the object's name, drawn above the box by the float look
54
+ * @param {'kolbox'} variant the look (see THE KOLBOX LOOK below); unset, the default look
59
55
  * @param {number} scale screen px per virtual px (default: the zoom); a host whose stage is also fitted passes
60
56
  * fit × zoom so 1 screen px stays 1
61
57
  *
@@ -92,7 +88,6 @@ export default function SelectionOverlay({
92
88
  labelFormatter = (b) => `${Math.round(b.w)} × ${Math.round(b.h)}`,
93
89
  rotateTitle = 'Rotate',
94
90
  variant,
95
- name,
96
91
  scale,
97
92
  }) {
98
93
  /* Chrome renders in virtual px inside the zoomed transform — divide by zoom
@@ -102,7 +97,6 @@ export default function SelectionOverlay({
102
97
 
103
98
  if (!box || box.x == null) return null /* no positional box → no chrome */
104
99
  if (variant === 'kolbox') return <KolboxSelection box={box} s={scale || zoom || 1} showHandles={showHandles} showRotate={showRotate} showLabel={showLabel} labelFormatter={labelFormatter} />
105
- if (variant === 'float') return <FloatSelection box={box} zoom={zoom} showHandles={showHandles} showRotate={showRotate} showLabel={showLabel} name={name} labelFormatter={labelFormatter} rotateTitle={rotateTitle} />
106
100
 
107
101
  const { x, y, w, h } = box
108
102
  const size = handleSize / zoom
@@ -217,44 +211,6 @@ export default function SelectionOverlay({
217
211
  )
218
212
  }
219
213
 
220
- /* the float look — the same handles and data-handle routing, drawn as his frame draws the selection; every screen-constant
221
- * size divides by the zoom (6 handles, the 1px outline) and the two labels counter-scale, as the default look does */
222
- function FloatSelection({ box, zoom, showHandles = true, showRotate, showLabel = true, name, labelFormatter, rotateTitle }) {
223
- const { x, y, w, h } = box
224
- const size = 6 / zoom
225
- const rotate = showRotate ?? showHandles
226
- const rot = typeof box.rotation === 'number' ? box.rotation : 0
227
- const ink = 'var(--kol-surface-on-primary)'
228
- const counter = { transform: `scale(${1 / zoom})`, pointerEvents: 'none', whiteSpace: 'nowrap', zIndex: 100 }
229
- return (
230
- <>
231
- <div style={{ position: 'absolute', left: x, top: y, width: w, height: h, transform: rot ? `rotate(${rot}deg)` : undefined, pointerEvents: 'none', zIndex: 100 }}>
232
- <div style={{ position: 'absolute', inset: 0, boxShadow: `0 0 0 ${1 / zoom}px var(--kol-oq-64)` }} />
233
- {rotate && (
234
- <Tooltip label={rotateTitle} asChild>
235
- <div data-handle="ROT" style={{ position: 'absolute', left: `calc(50% - ${size / 2}px)`, top: -(ROTATE_OFFSET / zoom), width: size, height: size, borderRadius: '50%', background: ink, cursor: 'grab', pointerEvents: 'auto' }} />
236
- </Tooltip>
237
- )}
238
- {showHandles && HANDLE_DIRS.map(({ dir, cursor, x: hx, y: hy }) => (
239
- <div key={dir} data-handle={dir} style={{ position: 'absolute', left: `calc(${hx * 100}% - ${size / 2}px)`, top: `calc(${hy * 100}% - ${size / 2}px)`, width: size, height: size, background: ink, cursor, pointerEvents: 'auto' }} />
240
- ))}
241
- </div>
242
- {/* each label hangs off a zero-size anchor so the counter-scale keeps its edge on the anchor */}
243
- {showLabel && name && (
244
- <div style={{ position: 'absolute', left: x, top: y - 8 / zoom, width: 0, height: 0, zIndex: 100 }}>
245
- <span className="kol-float-label text-oq-64" style={{ ...counter, position: 'absolute', left: 0, bottom: 0, transformOrigin: 'left bottom' }}>{name}</span>
246
- </div>
247
- )}
248
- {showLabel && (
249
- <div style={{ position: 'absolute', left: x + w / 2, top: y + h + 8 / zoom, width: 0, height: 0, zIndex: 100 }}>
250
- <span className="kol-float-ruler text-emphasis bg-oq-08 rounded-[var(--kol-float-list-r)] px-2 py-1"
251
- style={{ ...counter, position: 'absolute', left: 0, top: 0, transform: `translateX(-50%) scale(${1 / zoom})`, transformOrigin: 'top center' }}>{labelFormatter(box)}</span>
252
- </div>
253
- )}
254
- </>
255
- )
256
- }
257
-
258
214
  /* the kolbox look (see the header): every screen-constant size is `n * px`, px being one screen px in virtual px */
259
215
  const KOLBOX_CORNERS = [
260
216
  { dir: 'NW', cursor: 'nwse-resize', x: 0, y: 0 },
@@ -1,11 +0,0 @@
1
- /**
2
- * @deprecated 2026-11-12 — `FloatModuleHeader` is `RailHeader variant="float"` under its old name (the family word leads).
3
- * Drops when nobody imports it (04-retirements.md).
4
- */
5
- import RailHeader from './RailHeader.jsx'
6
-
7
- /* taxonomy-ok: molecule — the deprecated name of RailHeader variant="float" */
8
-
9
- export default function FloatModuleHeader(props) {
10
- return <RailHeader variant="float" {...props} />
11
- }
@@ -1,139 +0,0 @@
1
- import { useState } from 'react'
2
- import { IconLoader } from '@kolkrabbi/kol-icons'
3
- import Kbd from '../atoms/Kbd.jsx'
4
- import TreeRow from '../molecules/TreeRow.jsx'
5
- import RailFloat from '../molecules/RailFloat.jsx'
6
- import { LabeledControlSection } from './SettingsPanel.jsx'
7
- import { Tooltip } from '../utilities/Popover.jsx'
8
- import { floatMotion } from '../utilities/motion.js'
9
-
10
- /* taxonomy-ok: organism — nests RailFloat + TreeRow (molecules) + LabeledControlSection (organism) + Kbd (atom) + Tooltip (utility) + kol-icons's Icon. */
11
-
12
- /**
13
- * NavRailFloat — the float sidebar, `NavRail variant="float"` (float-everything W9 rows 122 · 127 · 128 · 131,
14
- * 2026-11-04 — kol-float--style 48:4015 expanded, 48:4277 rail). Its own path: none of the app rail's grab, drag or
15
- * width token. Two states, the rail's words — EXPANDED (264) and COLLAPSED (72):
16
- *
17
- * expanded the switcher row — Header variant="nav" (glyph · title · ⌄ 12, or your `switcher`) · the search capsule (`Search pages ⌘K`) · the
18
- * tree: a `{ heading }` entry opens a group, a float `LabeledControlSection` whose label is the heading
19
- * (`kol-float-ruler`, fg-64, as authored) over the items under it; an item a
20
- * `TreeRow size="lg"` (40 · 18 glyph · Inter 13 · count · chevron), its `sub` rows `TreeRow size="sm"`
21
- * indented under it · `footer` at the foot (kol-shell's RailDisplayControls, a theme row)
22
- * collapsed 44 round slots on a 72 rail, 20 glyphs; the lit slot fg-16 with a 3 × 14 bar at the rail's edge — a
23
- * section with the current page inside lights too; each group is a LabeledControlSection without its
24
- * label, 24 apart. Expand on top and search ·
25
- * hide at the foot, on the well. Each slot names itself in the float Tooltip
26
- *
27
- * On `surface-secondary` lifted by the float shadow (`--kol-shadow-float`, the pill's and the card's — FloatRailOverlayShadowRestore,
28
- * 2026-11-04) at the sheet radius, 12 in, full height of its container. Nothing auto-expands: a section
29
- * opens by its chevron, or by `defaultExpanded`.
30
- *
31
- * @param {Array} items `{ heading }` | `{ icon, label, path, count?, sub?: [{ icon, label, path, count? }] }`
32
- * @param {string} currentPath the active path (exact match)
33
- * @param {Function} onNavigate `(path) => void`
34
- * @param {boolean} [collapsed] the 72 rail · {Function} [onCollapsedChange]
35
- * @param {string} [title] · {string} [icon='grid'] · {Function} [onSwitch] the switcher row; `switcher` replaces it
36
- * @param {Function} [onSearch] shows the search capsule (and the rail's search slot)
37
- * @param {Function} [onHide] the rail's hide slot (expanded: put kol-shell's RailDisplayControls in `footer`)
38
- * @param {Array} [defaultExpanded] paths of sections open at mount
39
- * @param {ReactNode} [footer]
40
- * @param {Function} [onItemHover] collapsed only: `(item, element)` when the pointer enters a slot, `(null, null)` when it
41
- * leaves — the seam a hover flyout hangs off (kol-shell's RailFlyout, FloatLayout 2026-11-04)
42
- * @param {boolean} [collapsibleV] the collapse-v chevron beside the switcher row (plan-2026-11-12-one-header W2.1): the rail
43
- * collapses up to RailFloat's pill — `title` and ⌄ at the expanded width — apart from its
44
- * 72 collapse and its hide. `collapsedV` controlled, `defaultCollapsedV` uncontrolled,
45
- * `onCollapseV(collapsedV)`. Deprecated aliases: `foldable` · `folded` · `defaultFolded` · `onFold`
46
- * @param {boolean|Object} [motion=true] expand ↔ collapse eases the width and fades the new rows in, and the slots and rows ease
47
- * their hover (`.kol-float-rail`, FloatActionStatesAndMotion 2026-11-04): `true` the
48
- * `--kol-float-*` tokens · `false` none · `{ duration, ease }` per app. Hide and show are
49
- * FloatLayout's (it holds the rail while it leaves)
50
- */
51
- const isOn = (path, current) => !!path && path === current
52
- /* the flat item list in groups: the items before the first `{ heading }`, then each heading with the items under it —
53
- * each group one float LabeledControlSection (plan-2026-11-12-float-rails-figma W10.1), never a loose heading */
54
- const groupsOf = (items) => {
55
- const out = [{ items: [] }]
56
- for (const it of items) it.heading ? out.push({ heading: it.heading, items: [] }) : out[out.length - 1].items.push(it)
57
- return out[0].items.length ? out : out.slice(1)
58
- }
59
-
60
- export default function NavRailFloat({ items = [], currentPath = '', onNavigate, collapsed = false, onCollapsedChange, title, icon = 'grid', onSwitch, switcher, onSearch, onHide, defaultExpanded = [], footer, onItemHover, motion = true, collapsibleV, collapsedV, defaultCollapsedV, onCollapseV, foldable, folded, defaultFolded, onFold, className = '' }) {
61
- const motionStyle = floatMotion(motion).style
62
- const [open, setOpen] = useState(() => new Set(defaultExpanded))
63
- const toggle = (path) => setOpen((s) => { const n = new Set(s); n.has(path) ? n.delete(path) : n.add(path); return n })
64
- const go = (path) => () => onNavigate?.(path)
65
-
66
- if (collapsed) {
67
- const slot = (key, label, glyph, { on = false, well = false, onClick } = {}) => (
68
- <Tooltip key={key} label={label} placement="right" variant="float" asChild>
69
- <button type="button" aria-label={label} aria-current={on ? 'page' : undefined} onClick={onClick}
70
- className={`relative inline-flex size-11 shrink-0 items-center justify-center rounded-full cursor-pointer focus-visible:outline-none focus-visible:shadow-[var(--kol-float-focus)] ${on ? 'bg-fg-16 text-oq-96' : well ? 'bg-[var(--kol-float-well)] text-oq-64 hover:text-oq-96' : 'text-oq-64 hover:bg-fg-08 hover:text-oq-96'}`}>
71
- <IconLoader name={glyph} size={well ? 18 : 20} />
72
- </button>
73
- </Tooltip>
74
- )
75
- return (
76
- <RailFloat as="nav" aria-label="Navigation" inset="none" width="var(--kol-shell-float-rail-width, 72px)" style={motionStyle} bodyClassName="items-center !gap-1"
77
- className={`kol-float-rail h-full !gap-1 items-center py-3.5 ${className}`.trim()}>
78
- {onCollapsedChange && slot('expand', 'Expand', 'panel-left', { well: true, onClick: () => onCollapsedChange(false) })}
79
- <div className="flex min-h-0 w-full flex-1 flex-col gap-6 overflow-y-auto py-3 [scrollbar-width:none]">
80
- {groupsOf(items).map((g, gi) => (
81
- <LabeledControlSection key={gi} variant="float" rowGap={1} className="w-full">
82
- {g.items.map((it) => {
83
- const on = isOn(it.path, currentPath) || !!it.sub?.some((c) => isOn(c.path, currentPath))
84
- return (
85
- <span key={it.path ?? it.label} className="relative flex w-full justify-center"
86
- onMouseEnter={onItemHover && ((e) => onItemHover(it, e.currentTarget))} onMouseLeave={onItemHover && (() => onItemHover(null, null))}>
87
- {on && <span className="absolute left-[5px] top-1/2 h-3.5 w-[3px] -translate-y-1/2 rounded-full bg-[var(--kol-surface-on-primary)]" aria-hidden />}
88
- {slot(it.path ?? it.label, it.label, it.icon, { on, onClick: go(it.path) })}
89
- </span>
90
- )
91
- })}
92
- </LabeledControlSection>
93
- ))}
94
- </div>
95
- {onSearch && slot('search', 'Search pages', 'search', { well: true, onClick: onSearch })}
96
- {onHide && slot('hide', 'Hide', 'hamburger', { well: true, onClick: onHide })}
97
- </RailFloat>
98
- )
99
- }
100
-
101
- return (
102
- <RailFloat as="nav" aria-label="Navigation" inset="sm" width="var(--kol-shell-float-rail-open, 264px)" style={motionStyle}
103
- headerVariant="nav" icon={icon} onSwitch={onSwitch} title={title} head={switcher}
104
- collapsibleV={collapsibleV ?? foldable} collapsedV={collapsedV ?? folded} defaultCollapsedV={defaultCollapsedV ?? defaultFolded} onCollapseV={onCollapseV ?? onFold}
105
- bodyClassName="!gap-3" className={`kol-float-rail h-full !gap-3 ${className}`.trim()}
106
- footer={footer && <div className="flex shrink-0 flex-col gap-2">{footer}</div>}>
107
- {onSearch && (
108
- <button type="button" onClick={onSearch} className="flex h-[var(--kol-float-h-md)] w-full items-center gap-2.5 rounded-full bg-[var(--kol-float-well)] px-3 text-left cursor-pointer hover:bg-fg-08 focus-visible:outline-none focus-visible:shadow-[var(--kol-float-focus)]">
109
- <IconLoader name="search" size={16} className="shrink-0 text-oq-64" />
110
- <span className="kol-float-hint min-w-0 flex-1 truncate text-fg-64">Search pages</span>
111
- <Kbd size="sm" icon="command">K</Kbd>
112
- </button>
113
- )}
114
- <div className="flex min-h-0 flex-1 flex-col gap-[18px] overflow-y-auto [scrollbar-width:none]">
115
- {groupsOf(items).map((g, gi) => (
116
- <LabeledControlSection key={gi} variant="float" gap={1.5} rowGap={0.5} className={gi === 0 && g.heading ? 'pt-1' : ''}
117
- label={g.heading && <span className="kol-float-ruler px-2.5 text-fg-64">{g.heading}</span>}>
118
- {g.items.map((it) => {
119
- const kids = it.sub ?? []
120
- const isOpen = open.has(it.path)
121
- const childOn = kids.some((c) => isOn(c.path, currentPath))
122
- return (
123
- <div key={it.path ?? it.label} className="flex flex-col gap-0.5">
124
- <TreeRow size="lg" icon={it.icon} label={it.label} count={it.count}
125
- active={isOn(it.path, currentPath)} open={childOn && isOpen}
126
- expanded={kids.length ? isOpen : undefined} onToggle={kids.length ? () => toggle(it.path) : undefined}
127
- onClick={kids.length && !it.to ? () => toggle(it.path) : go(it.to ?? it.path)} />
128
- {isOpen && kids.map((c) => (
129
- <TreeRow key={c.path} size="sm" depth={1} icon={c.icon} label={c.label} count={c.count} active={isOn(c.path, currentPath)} onClick={go(c.path)} />
130
- ))}
131
- </div>
132
- )
133
- })}
134
- </LabeledControlSection>
135
- ))}
136
- </div>
137
- </RailFloat>
138
- )
139
- }