@kolkrabbi/kol-component 0.265.0 → 0.266.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.265.0",
3
+ "version": "0.266.0",
4
4
  "description": "The core component library",
5
5
  "license": "MIT",
6
6
  "type": "module",
@@ -151,8 +151,15 @@ export default function useDragResize(ref, options = {}) {
151
151
  lineRef.current = line
152
152
  /* -1 on a right-hand rail: the same rightward pointer travel that widens a
153
153
  * left rail must NARROW a right one, because its handle faces the canvas. */
154
- const dir = side === 'right' ? -1 : 1
155
- const names = useMemo(() => buildNames(token), [token])
154
+ /* ANY EDGE (RailOverlay, kol-monitor 2026-10-17): `top` / `bottom` rails resize on Y — the handle on a bottom
155
+ * rail is its TOP edge, so upward travel grows it. The size goes to `--<token>-h` (and `-h-collapsed`) instead
156
+ * of `-w`; every other token is shared. */
157
+ const vertical = side === 'top' || side === 'bottom'
158
+ const dir = side === 'right' || side === 'bottom' ? -1 : 1
159
+ const names = useMemo(() => {
160
+ const n = buildNames(token)
161
+ return vertical ? { ...n, widthKey: `${token}-h`, wVar: `--${token}-h`, collapsedVar: `--${token}-h-collapsed` } : n
162
+ }, [token, vertical])
156
163
 
157
164
  /* the handle's own ref, so the shared gesture can find it. Returned in
158
165
  * `grabProps`, so a consumer already spreading those gets the wake, the
@@ -210,7 +217,7 @@ export default function useDragResize(ref, options = {}) {
210
217
  const onMove = (e) => {
211
218
  if (!drag.current) return
212
219
  const d = drag.current
213
- const dx = e.clientX - d.startX
220
+ const dx = (vertical ? e.clientY : e.clientX) - d.startX
214
221
  /* Below the slop the pointer is still a CLICK — resizing from the
215
222
  * first pixel would jitter the rail on every toggle press. */
216
223
  if (!d.moved) {
@@ -248,15 +255,15 @@ export default function useDragResize(ref, options = {}) {
248
255
  window.removeEventListener('pointermove', onMove)
249
256
  window.removeEventListener('pointerup', onUp)
250
257
  }
251
- }, [names, dir])
258
+ }, [names, dir, vertical])
252
259
 
253
260
  const onPointerDown = (e) => {
254
261
  const snapPx = readVarPx(names.snapVar)
255
262
  if (defaultPx.current == null || snapPx == null) return // tokens absent → inert
256
263
  e.preventDefault()
257
264
  drag.current = {
258
- startX: e.clientX,
259
- startW: ref.current?.getBoundingClientRect().width ?? defaultPx.current,
265
+ startX: vertical ? e.clientY : e.clientX,
266
+ startW: (vertical ? ref.current?.getBoundingClientRect().height : ref.current?.getBoundingClientRect().width) ?? defaultPx.current,
260
267
  snapPx,
261
268
  /* mirror's ceiling (default × 3), resolved from the token not hardcoded */
262
269
  maxPx: defaultPx.current * 3,
@@ -284,8 +291,8 @@ export default function useDragResize(ref, options = {}) {
284
291
  /* The arrow that GROWS is the one pointing away from the rail's own edge —
285
292
  * ArrowRight on a left rail, ArrowLeft on a right one. Same inversion the
286
293
  * pointer gets, so keyboard and drag never disagree. */
287
- const growKey = dir === 1 ? 'ArrowRight' : 'ArrowLeft'
288
- const shrinkKey = dir === 1 ? 'ArrowLeft' : 'ArrowRight'
294
+ const growKey = vertical ? (dir === 1 ? 'ArrowDown' : 'ArrowUp') : (dir === 1 ? 'ArrowRight' : 'ArrowLeft')
295
+ const shrinkKey = vertical ? (dir === 1 ? 'ArrowUp' : 'ArrowDown') : (dir === 1 ? 'ArrowLeft' : 'ArrowRight')
289
296
  if (e.key === growKey) {
290
297
  e.preventDefault()
291
298
  if (c) stampCollapsed(names, false)
package/src/index.js CHANGED
@@ -125,7 +125,11 @@ export { ModalProvider, useModal } from './molecules/Modal.jsx'
125
125
  export { default as PaletteHarmonyWheel } from './molecules/PaletteHarmonyWheel.jsx'
126
126
  export { default as PropertyInput } from './molecules/PropertyInput.jsx'
127
127
  export { default as ShapeDropdown } from './molecules/ShapeDropdown.jsx'
128
+ export { default as Rail } from './molecules/Rail.jsx'
129
+ /** @deprecated 2026-10-17 — alias of Rail */
128
130
  export { default as ShellDrawer } from './molecules/ShellDrawer.jsx'
131
+ export { default as CommandOverlay } from './organisms/CommandOverlay.jsx'
132
+ /** @deprecated 2026-10-17 — alias of CommandOverlay */
129
133
  export { default as ShellSearchOverlay } from './organisms/ShellSearchOverlay.jsx'
130
134
  /* the keymap sheet — moved in from kol-shell 2026-09-28 so the workshop shell and the apps open ONE sheet on S */
131
135
  export { default as ShortcutsOverlay, shortcutInScope } from './organisms/ShortcutsOverlay.jsx'
@@ -138,8 +142,8 @@ export { default as SplitToolButton } from './molecules/SplitToolButton.jsx'
138
142
  export { default as ToolPalette } from './organisms/ToolPalette.jsx'
139
143
  export { default as DocumentEditor } from './organisms/DocumentEditor.jsx'
140
144
  export { default as SwatchControls, SwatchStack, EyedropPick } from './molecules/SwatchControls.jsx'
141
- export { default as TabsRow } from './molecules/TabsRow.jsx'
142
- /* TabChips — tabs as chips, for inside a toolbar (2026-10-01; was the showcase's local DocTabs) */
145
+ export { default as TabsRow, TABBAR_H } from './molecules/TabsRow.jsx'
146
+ /** @deprecated 2026-10-17 — alias of `TabsRow look="chip"` */
143
147
  export { default as TabChips } from './molecules/TabChips.jsx'
144
148
 
145
149
  // organisms
@@ -164,7 +168,8 @@ export { default as Carousel } from './molecules/Carousel.jsx'
164
168
  * stage reaches for it instead of re-typing the button markup, which is how the
165
169
  * three in-package copies (and kol-website's CarouselNavigation) happened. */
166
170
  export { default as EmblaNav } from './molecules/EmblaNav.jsx'
167
- export { default as MobileTabBar, TABBAR_H } from './molecules/MobileTabBar.jsx'
171
+ /** @deprecated 2026-10-17 — alias of `TabsRow look="stacked" placement="phone"` */
172
+ export { default as MobileTabBar } from './molecules/MobileTabBar.jsx'
168
173
  export { default as ContentFilters } from './organisms/ContentFilters.jsx'
169
174
  export { default as PageHeader } from './molecules/PageHeader.jsx'
170
175
  export { MastheadContext, MASTHEADS, useMasthead, mastheadTitleClass } from './utilities/masthead.js'
@@ -1,67 +1,10 @@
1
- import { Icon } from '@kolkrabbi/kol-icons'
1
+ import TabsRow, { TABBAR_H } from './TabsRow.jsx'
2
2
 
3
3
  /**
4
- * MobileTabBar — the floating bottom tab pill, below `md` only.
5
- *
6
- * Both references end the same way: neither iOS Files nor Dropbox stacks two
7
- * full-height surfaces on a phone. Each floats a pill at the bottom and gives
8
- * every surface a tab — Files `Recents · Shared · Browse`, Dropbox `Home ·
9
- * Files · Photos · Account` (ColumnBrowserMobileViews §5, kol-r2b2, user-ruled
10
- * 2026-09-03). It is what answers the question `ColumnBrowserStackMode` left
11
- * open: the library wall does NOT stay stacked under the browser.
12
- *
13
- * WHAT A TAB MEANS IS THE CONSUMER'S. This ships the pill — the shape, the
14
- * float, the states, the breakpoint — and takes a list. A repo whose surfaces
15
- * are routes wires it to its router; one whose surfaces are variants swaps a
16
- * variant. The DS deciding that a media library has exactly three surfaces
17
- * called Browse, Files and Kinds is the kind of guess that makes an organism
18
- * un-reusable.
19
- *
20
- * FLOATS, not a layout row: it sits over the list on `position: fixed` so the
21
- * list scrolls under it, which is what both references do. The consumer owes
22
- * the list bottom padding — `--kol-tabbar-h` is published for exactly that, so
23
- * nobody hardcodes 56.
24
- *
25
- * @param {Array<{value: string, label: string, icon?: string}>} tabs
26
- * @param {string} value the active tab
27
- * @param {Function} onChange (value) => void
28
- * @param {string} className extra classes on the pill
4
+ * @deprecated 2026-10-17 — alias of `TabsRow look="stacked" placement="phone"` (TabsStackedLayout). Drops when nobody imports it (04-retirements.md).
5
+ * MobileTabBar — Old name for the stacked phone bar. Same props: `tabs` (`{ value, label, icon }`) · `value` · `onChange` · `className`.
29
6
  */
30
-
31
- export const TABBAR_H = 56
32
-
33
- export default function MobileTabBar({ tabs = [], value, onChange, className = '' }) {
34
- if (tabs.length === 0) return null
35
- return (
36
- <nav
37
- className={`kol-mobile-tabbar md:hidden fixed inset-x-0 bottom-0 z-[var(--kol-z-sticky)] flex items-stretch ${className}`.trim()}
38
- style={{
39
- height: TABBAR_H,
40
- /* the pill's own ground, not the page's — it floats OVER content, so a
41
- * transparent bar would show rows sliding through the labels */
42
- background: 'var(--kol-surface-primary)',
43
- borderTop: '1px solid var(--kol-oq-08)',
44
- paddingBottom: 'env(safe-area-inset-bottom, 0px)',
45
- }}
46
- aria-label="Sections"
47
- >
48
- {tabs.map((t) => {
49
- const active = t.value === value
50
- return (
51
- <button
52
- key={t.value}
53
- type="button"
54
- onClick={() => onChange?.(t.value)}
55
- aria-current={active ? 'page' : undefined}
56
- className="flex-1 min-w-0 flex flex-col items-center justify-center gap-1 cursor-pointer"
57
- style={{ background: 'transparent', border: 'none', color: active ? 'var(--kol-fg-default)' : 'var(--kol-fg-48)' }}
58
- >
59
- {t.icon && <Icon name={t.icon} size={18} />}
60
- {/* helper is single-line chrome, which a tab label always is */}
61
- <span className="kol-helper-10 truncate max-w-full px-1">{t.label}</span>
62
- </button>
63
- )
64
- })}
65
- </nav>
66
- )
7
+ export { TABBAR_H }
8
+ export default function MobileTabBar(props) {
9
+ return <TabsRow look="stacked" placement="phone" {...props} />
67
10
  }
@@ -0,0 +1,301 @@
1
+ import { useEffect, useRef, useState } from 'react'
2
+ import { pushLayer, popLayer, isTopLayer } from '../utilities/layerStack.js'
3
+ import { createPortal } from 'react-dom'
4
+ import { Icon } from '@kolkrabbi/kol-icons'
5
+ import CloseButton from '../atoms/CloseButton.jsx'
6
+ import usePrefersReducedMotion from '../hooks/usePrefersReducedMotion.js'
7
+
8
+ /* taxonomy-ok: nests kol-icons's Icon (a package import the relative-import
9
+ * check can't see). */
10
+
11
+ const FOCUSABLE =
12
+ 'a[href], button:not([disabled]), input:not([disabled]), select:not([disabled]), textarea:not([disabled]), [tabindex]:not([tabindex="-1"])'
13
+
14
+ /**
15
+ * Rail — A surface docked to an edge (RailOverlay, kol-monitor 2026-10-17 — user ruling: *"rail and overlay"*).
16
+ * Anything docked to an edge — left, right, top or bottom — that collapses and expands is a rail; anything
17
+ * floating over the page that closes is an overlay. Drawer, shelf, panel and sheet are retired as names
18
+ * (`ShellDrawer` is this component's old name, an alias).
19
+ *
20
+ * mode="over" (default) — the rail slides over the page on a scrim, with focus trap, Escape and scroll lock:
21
+ * what ShellDrawer always was.
22
+ * mode="push" — the rail sits in the layout and pushes it: inline, no scrim, no trap; `open`
23
+ * expands it, closed it collapses to nothing. Its parent owns the flex row/column.
24
+ * resizable — a grab line on the inner edge (the edge facing the page) drags the rail's size
25
+ * between `minSize` and `maxSize`; on a bottom rail that is its TOP edge.
26
+ *
27
+ * Formerly — the edge drawer: a portalled panel that slides in from the
28
+ * left, right or BOTTOM viewport edge over a dimming backdrop. Distinct from Modal
29
+ * (centered prompt/confirm) and FullscreenOverlay (fills the whole viewport,
30
+ * not an edge sheet). Escape, backdrop click and the built-in close button
31
+ * all call `onClose`; body scroll locks while open; focus moves into the
32
+ * panel on open, is trapped there, and returns to the opener on close.
33
+ *
34
+ * The slide transition is gated on prefers-reduced-motion: reduced users get
35
+ * an instant mount/unmount with no transform animation.
36
+ *
37
+ * Presentational shell — the parent owns the open state and supplies the
38
+ * header slot and body; no navigation or routing logic lives here.
39
+ *
40
+ * @param {boolean} open drawer visible (drives slide in/out)
41
+ * @param {Function} onClose close request (Esc / backdrop / close button)
42
+ * @param {string} side 'left' | 'right' | 'bottom' — edge the panel slides from.
43
+ * `bottom` (ShellDrawerBottomSide, kol-mirror 2026-09-01) is the
44
+ * phone's sheet: full viewport width, slides up from +100% on Y,
45
+ * takes `height` where the sides take `width`, and pads its foot by
46
+ * `env(safe-area-inset-bottom)` so the last row clears the home bar.
47
+ * ONE DETENT — open or closed. A collapsed bar that grows on tap is
48
+ * a second height the consumer owns (mirror's 56px → 68dvh); this
49
+ * sheet does not carry it, and says so rather than half-build it.
50
+ * @param {number|string} width panel width (px number or CSS length); omit for full-width sheet — sides only
51
+ * @param {number|string} height panel height (px number or CSS length); omit for a content-sized sheet — `bottom` only
52
+ * @param {ReactNode} header header-row content beside the close button (replaces the source's baked-in wordmark)
53
+ * @param {boolean} backdrop render the dimming scrim (default true); false = panel alone, no darken/blur, close via × / Esc
54
+ * @param {'xs'|'sm'|'md'|'lg'} closeSize the close control's rung (default 'sm' — match the controls in the panel)
55
+ * @param {ReactNode} children scrollable panel body
56
+ * @param {string} className extra classes on the panel
57
+ */
58
+ const clamp = (v, lo, hi) => Math.max(lo, Math.min(hi, v))
59
+ const px = (v) => (v == null ? undefined : typeof v === 'number' ? `${v}px` : v)
60
+
61
+ export default function Rail({
62
+ open,
63
+ onClose,
64
+ side = 'left',
65
+ mode = 'over',
66
+ resizable = false,
67
+ minSize = 120,
68
+ maxSize = 960,
69
+ onResize,
70
+ width,
71
+ height,
72
+ header,
73
+ closeSide = 'end',
74
+ backdrop = true,
75
+ /* THE CLOSE SITS ON THE ROW'S RUNG (user 2026-09-03, on the settings drawer:
76
+ * *"does this button follow the size ladder?"*). It was pinned `md` (32) while
77
+ * every control in the panel below it — the switches, the dropdowns, the reset
78
+ * frame — is `sm` (26), so the one control that is not a setting was the
79
+ * largest thing on the surface. A size is a height and a row is one height;
80
+ * `sm` is the default because a drawer header sits over its own controls.
81
+ * Named `closeSize`, not `size` — `size` is already the panel's own box. */
82
+ closeSize = 'sm',
83
+ children,
84
+ className = '',
85
+ /* SettingsPanelApproved (2026-08-27): the settings drawer has neither */
86
+ edge = true,
87
+ shadow = true,
88
+ }) {
89
+ const reduced = usePrefersReducedMotion()
90
+ const panelRef = useRef(null)
91
+ const vertical = side === 'top' || side === 'bottom'
92
+ /* the rail's own size once dragged; null = the `width` / `height` given */
93
+ const [dragged, setDragged] = useState(null)
94
+ const startResize = (e) => {
95
+ if (!resizable) return
96
+ e.preventDefault()
97
+ const box = panelRef.current?.getBoundingClientRect()
98
+ const start = { x: e.clientX, y: e.clientY, size: vertical ? box?.height ?? 0 : box?.width ?? 0 }
99
+ /* the inner edge faces the page: dragging toward the page grows a left/top rail, away grows right/bottom */
100
+ const sign = side === 'left' || side === 'top' ? 1 : -1
101
+ const move = (ev) => {
102
+ const d = vertical ? ev.clientY - start.y : ev.clientX - start.x
103
+ const next = clamp(start.size + d * sign, minSize, maxSize)
104
+ setDragged(next)
105
+ onResize?.(next)
106
+ }
107
+ const up = () => { window.removeEventListener('pointermove', move); window.removeEventListener('pointerup', up); document.body.style.cursor = ''; document.body.style.userSelect = '' }
108
+ document.body.style.cursor = vertical ? 'row-resize' : 'col-resize'
109
+ document.body.style.userSelect = 'none'
110
+ window.addEventListener('pointermove', move)
111
+ window.addEventListener('pointerup', up)
112
+ }
113
+ const grab = resizable && (
114
+ <span
115
+ role="separator"
116
+ aria-orientation={vertical ? 'horizontal' : 'vertical'}
117
+ aria-label="Resize"
118
+ onPointerDown={startResize}
119
+ className={`absolute z-10 touch-none transition-colors hover:bg-oq-16 active:bg-oq-24 ${vertical ? 'inset-x-0 h-1.5 cursor-row-resize' : 'inset-y-0 w-1.5 cursor-col-resize'} ${side === 'bottom' ? 'top-0' : side === 'top' ? 'bottom-0' : side === 'right' ? 'left-0' : 'right-0'}`}
120
+ />
121
+ )
122
+ const push = mode === 'push'
123
+
124
+ /* Mount/slide state machine: `present` keeps the portal mounted through
125
+ * the exit slide; `shown` drives the transform/opacity classes. Reduced
126
+ * motion collapses both onto `open` — instant show/hide, no transform. */
127
+ const [present, setPresent] = useState(open)
128
+ const [shown, setShown] = useState(open)
129
+
130
+ useEffect(() => {
131
+ if (reduced) {
132
+ setPresent(open)
133
+ setShown(open)
134
+ return undefined
135
+ }
136
+ if (open) {
137
+ setPresent(true)
138
+ // double rAF: let the off-screen position paint before sliding in
139
+ let raf2
140
+ const raf1 = requestAnimationFrame(() => {
141
+ raf2 = requestAnimationFrame(() => setShown(true))
142
+ })
143
+ return () => {
144
+ cancelAnimationFrame(raf1)
145
+ if (raf2) cancelAnimationFrame(raf2)
146
+ }
147
+ }
148
+ setShown(false)
149
+ const t = setTimeout(() => setPresent(false), 200) // matches duration-200
150
+ return () => clearTimeout(t)
151
+ }, [open, reduced])
152
+
153
+ // Escape closes; Tab is trapped inside the panel while open — while this is the TOP layer
154
+ // (`layerStack`: a sheet opened over the drawer owns the keyboard until it closes)
155
+ const onCloseRef = useRef(onClose)
156
+ onCloseRef.current = onClose
157
+ useEffect(() => {
158
+ if (!open || push) return undefined
159
+ const layer = pushLayer()
160
+ const onKey = (e) => {
161
+ if (!isTopLayer(layer)) return
162
+ if (e.key === 'Escape') {
163
+ onCloseRef.current?.()
164
+ return
165
+ }
166
+ if (e.key !== 'Tab') return
167
+ const panel = panelRef.current
168
+ if (!panel) return
169
+ const nodes = panel.querySelectorAll(FOCUSABLE)
170
+ if (!nodes.length) {
171
+ e.preventDefault()
172
+ panel.focus()
173
+ return
174
+ }
175
+ const first = nodes[0]
176
+ const last = nodes[nodes.length - 1]
177
+ const active = document.activeElement
178
+ if (!panel.contains(active)) {
179
+ e.preventDefault()
180
+ first.focus()
181
+ } else if (e.shiftKey && (active === first || active === panel)) {
182
+ e.preventDefault()
183
+ last.focus()
184
+ } else if (!e.shiftKey && active === last) {
185
+ e.preventDefault()
186
+ first.focus()
187
+ }
188
+ }
189
+ document.addEventListener('keydown', onKey)
190
+ return () => { popLayer(layer); document.removeEventListener('keydown', onKey) }
191
+ }, [open])
192
+
193
+ /* Body scroll-lock + focus in/out. Gated on `present` too so the panel
194
+ * exists before we focus it (it mounts one commit after `open` flips). */
195
+ useEffect(() => {
196
+ if (!(open && present) || push) return undefined
197
+ const prevOverflow = document.body.style.overflow
198
+ document.body.style.overflow = 'hidden'
199
+ const prevFocus = document.activeElement
200
+ panelRef.current?.focus()
201
+ return () => {
202
+ document.body.style.overflow = prevOverflow
203
+ if (prevFocus instanceof HTMLElement) prevFocus.focus()
204
+ }
205
+ }, [open, present, push])
206
+
207
+ const extent = dragged ?? (vertical ? height : width)
208
+ /* the edge that faces the page carries the border, on every side */
209
+ const edgeCls = edge ? ({ left: 'border-r', right: 'border-l', top: 'border-b', bottom: 'border-t' })[side] : ''
210
+
211
+ if (push) {
212
+ /* in the layout: the rail's size animates between 0 and its extent; its parent owns the row/column */
213
+ const sizeStyle = vertical ? { height: open ? px(extent) ?? 'auto' : 0 } : { width: open ? px(extent) ?? 'auto' : 0 }
214
+ return (
215
+ <div
216
+ ref={panelRef}
217
+ aria-hidden={!open || undefined}
218
+ className={`relative shrink-0 overflow-hidden bg-surface-primary border-oq-08 ${open ? edgeCls : ''} ${reduced ? '' : 'transition-[width,height] duration-200 ease-out'} ${className}`}
219
+ style={sizeStyle}
220
+ >
221
+ {grab}
222
+ <div className="flex h-full flex-col px-4 py-4 md:px-5 lg:px-6">
223
+ {header != null && <div className="mb-6 min-w-0">{header}</div>}
224
+ <div className="flex-1 overflow-auto" style={{ overflowAnchor: 'none' }}>{children}</div>
225
+ </div>
226
+ </div>
227
+ )
228
+ }
229
+
230
+ if (!present || typeof document === 'undefined') return null
231
+
232
+ const slideOut = { bottom: 'translate-y-full', top: '-translate-y-full', right: 'translate-x-full', left: '-translate-x-full' }[side] ?? '-translate-x-full'
233
+ const motionPanel = reduced
234
+ ? ''
235
+ : `transition-transform duration-200 ease-out ${shown ? (vertical ? 'translate-y-0' : 'translate-x-0') : slideOut}`
236
+ const place = vertical
237
+ ? `inset-x-0 ${side === 'bottom' ? 'bottom-0' : 'top-0'} w-full max-h-full ${edgeCls}`
238
+ : `inset-y-0 max-w-full ${side === 'right' ? 'right-0' : 'left-0'} ${edgeCls} ${extent == null ? 'w-full' : ''}`
239
+ /* padding per side (RailOverlay): a bottom rail clears the home bar at its foot; a top rail its notch */
240
+ const size = vertical
241
+ ? { ...(extent != null ? { height: px(extent) } : {}), ...(side === 'bottom' ? { paddingBottom: 'calc(1rem + env(safe-area-inset-bottom, 0px))' } : { paddingTop: 'calc(1rem + env(safe-area-inset-top, 0px))' }) }
242
+ : extent != null ? { width: px(extent) } : undefined
243
+ const motionBackdrop = reduced
244
+ ? ''
245
+ : `transition-opacity duration-200 ease-out ${shown ? 'opacity-100' : 'opacity-0'}`
246
+
247
+ return createPortal(
248
+ <>
249
+ {backdrop && (
250
+ /* A BUTTON, not a div (OverlayScrimTapDismiss, 2026-09-01): iOS Safari
251
+ * does not bubble tap-clicks from non-interactive elements, so a div
252
+ * scrim's onClick never fires on a phone — the same line that broke
253
+ * the search overlay's dismiss. */
254
+ <button
255
+ type="button"
256
+ aria-label="Close"
257
+ className={`fixed inset-0 z-[100] kol-overlay-scrim ${motionBackdrop}`}
258
+ onClick={onClose}
259
+ />
260
+ )}
261
+ <div
262
+ ref={panelRef}
263
+ role="dialog"
264
+ aria-modal="true"
265
+ tabIndex={-1}
266
+ /* `edge` / `shadow` (SettingsPanelApproved, 2026-08-27): the approved settings
267
+ * drawer has neither — the sheet meets the page flat */
268
+ className={`fixed z-[200] flex flex-col bg-surface-primary px-4 py-4 outline-none md:px-5 lg:px-6 ${backdrop && shadow ? 'shadow-2xl' : ''} ${place} border-oq-08 ${motionPanel} ${className}`}
269
+ style={size}
270
+ >
271
+ {grab}
272
+ {/* closeSide="start": the reference sets the × glyph ~9px deeper than
273
+ * the label column's edge, with extra top air (both reference frames
274
+ * 2026-08-09 measure the same inset) */}
275
+ <div className={`mb-6 flex items-center gap-4${closeSide === 'start' ? ' pt-3 pl-2' : ''}`}>
276
+ {/* closeSide="start" — the record-surface anatomy (reference frame,
277
+ * 2026-08-09): × leads, the header's actions sit at the far end. */}
278
+ {closeSide === 'start' && (
279
+ /* bare glyph, no container (user 2026-08-09: "the X close icon
280
+ * does not need a container") — body ink at rest, emphasis on hover */
281
+ <CloseButton onClick={onClose} size={closeSize} className="shrink-0" />
282
+ )}
283
+ {header != null && <div className="min-w-0 flex-1">{header}</div>}
284
+ {/* A NORMAL ICON BUTTON (user 2026-09-02: *"it should just be like a
285
+ * normal button with a close icon, its not new?"*). It carried
286
+ * `iconSize={14}` — kept in 2026-08-01 to preserve the glyph size the
287
+ * hand-rolled button before it happened to have — so the box sat at
288
+ * the md rung's 32px around a glyph six under it, and it read as an
289
+ * oversized empty square. No override: the rung sets both. */}
290
+ {closeSide !== 'start' && (
291
+ <CloseButton onClick={onClose} size={closeSize} className="ml-auto shrink-0" />
292
+ )}
293
+ </div>
294
+ <div className="flex-1 overflow-y-auto pr-1" style={{ overflowAnchor: 'none' }}>
295
+ {children}
296
+ </div>
297
+ </div>
298
+ </>,
299
+ document.body,
300
+ )
301
+ }