@kolkrabbi/kol-component 0.355.0 → 0.357.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.355.0",
3
+ "version": "0.357.0",
4
4
  "description": "The core component library",
5
5
  "license": "MIT",
6
6
  "type": "module",
package/src/index.js CHANGED
@@ -84,10 +84,10 @@ export { default as InlineAddRow } from './molecules/InlineAddRow.jsx'
84
84
  export { default as LinkAddRow } from './molecules/LinkAddRow.jsx'
85
85
  export { default as ColorField } from './molecules/ColorField.jsx'
86
86
  export { default as PanelsMenu } from './molecules/PanelsMenu.jsx'
87
- export { default as ModalHeader } from './molecules/ModalHeader.jsx'
87
+ /* ModalHeader is the one modal header (2026-11-08); `QuickLookHeader` is its deprecated alias on the retirement ledger */
88
+ export { default as ModalHeader, default as QuickLookHeader } from './molecules/ModalHeader.jsx'
88
89
  /* float-everything W6 · W8 (0.335.0) */
89
90
  export { default as SummaryLine } from './molecules/SummaryLine.jsx'
90
- export { default as QuickLookHeader } from './molecules/QuickLookHeader.jsx'
91
91
  export { default as NoticeBanner } from './molecules/NoticeBanner.jsx'
92
92
  export { default as TreeRow, TREE_ROW } from './molecules/TreeRow.jsx'
93
93
  export { default as FlyoutRow } from './molecules/FlyoutRow.jsx'
@@ -179,6 +179,7 @@ export { MenuItem, MenuRow, MenuDivider, MenuFlyout, MenuDropdownItem, MenuDropd
179
179
  export { Menu, MenuTrigger, MenuPanel, MenuLabel, MenuFilter, MenuDatePicker, MenuMore } from './molecules/Menu.jsx'
180
180
  export { MenuList } from './molecules/MenuList.jsx'
181
181
  export { ModalProvider, useModal, Dialog } from './molecules/Modal.jsx'
182
+ export { default as ModalShell } from './molecules/ModalShell.jsx'
182
183
  /* the generator settings window's controls (plan-2026-11-05-float-editor W7.2) — `Dialog variant="settings"`'s rows */
183
184
  export {
184
185
  SettingsGroup, SettingsGrid, SettingsCell, SettingsSlider, SettingsRange, SettingsSelect, SettingsSegmented, SettingsToggle,
@@ -3,7 +3,8 @@ import { createPortal } from 'react-dom'
3
3
  import Button from '../atoms/Button.jsx'
4
4
  import Input from '../atoms/Input.jsx'
5
5
  import ToggleCheckbox from '../atoms/ToggleCheckbox.jsx'
6
- import QuickLookHeader from './QuickLookHeader.jsx'
6
+ import ModalHeader from './ModalHeader.jsx'
7
+ import ModalShell from './ModalShell.jsx'
7
8
 
8
9
  /**
9
10
  * Modal — promise-based prompt + confirm + alert dialogs.
@@ -61,7 +62,7 @@ import QuickLookHeader from './QuickLookHeader.jsx'
61
62
  *
62
63
  * THE FLOAT (`variant: 'float'` on any call or on the provider, float-everything W6 rows 84 · 85 · 89 · 90, 2026-11-04 —
63
64
  * kol-float--style 46:2795): the window on `kol-float-solid` at `--kol-float-window-r`, 24 in, 18 between its parts.
64
- * A `header` (with its `icon`) draws `QuickLookHeader variant="float"` over the title; the title is the heading
65
+ * A `header` (with its `icon`) draws `ModalHeader variant="float"` over the title; the title is the heading
65
66
  * (`kol-float-section`… at 20: Inter 500), `body` a line under it in the hint ink; fields are float Inputs, toggles float
66
67
  * ToggleCheckboxes; the actions sit apart — the quiet cancel at the left (`tone="ghost"`), the next step at the right
67
68
  * (`inverted`, or `danger` when `tone: 'danger'` — the destructive confirm). Still a blocking task, so the scrim
@@ -85,16 +86,11 @@ import QuickLookHeader from './QuickLookHeader.jsx'
85
86
 
86
87
  const ModalCtx = (globalThis[Symbol.for('@kolkrabbi/kol-component/ModalCtx')] ??= createContext(null))
87
88
 
88
- /* THE MODAL VARIANTS (user 2026-10-31: *"do we not use variants for different styles?"*). `lift` — the overlay panel
89
- * every KOL overlay wears (oq-04, no border, the scrim is the edge); `bordered` — the page surface behind an fg-08
90
- * hairline. Each modal keeps its own default (prompts bordered, Dialog lift) until he picks one. */
91
- const MODAL_VARIANTS = {
92
- lift: { className: 'kol-overlay-panel', style: {} },
93
- /* float (W6, 2026-11-04): the float window — solid ground + the float shadow, the window radius, no edge */
94
- float: { className: 'kol-float-solid !rounded-[var(--kol-float-window-r)] text-fg-emphasis', style: {} },
95
- bordered: { className: 'border border-fg-08', style: { background: 'var(--kol-surface-primary)', color: 'var(--kol-surface-on-primary)' } },
96
- }
97
- const modalVariant = (v, fallback) => MODAL_VARIANTS[v] ?? MODAL_VARIANTS[fallback]
89
+ /* THE MODAL VARIANTS (user 2026-10-31: *"do we not use variants for different styles?"*) live on ModalShell (W2.1,
90
+ * 2026-11-08) — the one panel: `lift`, `bordered`, `float`. Each modal keeps its own default (prompts bordered, Dialog
91
+ * lift) until he picks one; an unknown name falls back to that default. */
92
+ const KNOWN = new Set(['lift', 'bordered', 'float'])
93
+ const modalVariant = (v, fallback) => (KNOWN.has(v) ? v : fallback)
98
94
 
99
95
  export function ModalProvider({ children, variant = 'bordered', container }) {
100
96
  const [state, setState] = useState(null)
@@ -135,7 +131,7 @@ export function ModalProvider({ children, variant = 'bordered', container }) {
135
131
 
136
132
  function ModalView({ state, closeWith, variant, contained }) {
137
133
  const look = modalVariant(variant, 'bordered')
138
- const float = variant === 'float'
134
+ const float = look === 'float'
139
135
  const [val, setVal] = useState(state.defaultValue ?? '')
140
136
  const [values, setValues] = useState(() => Object.fromEntries((state.options ?? []).map((o) => [o.id, !!o.defaultValue])))
141
137
  const [fieldVals, setFieldVals] = useState(() => Object.fromEntries((state.fields ?? []).map((f) => [f.id, f.defaultValue ?? ''])))
@@ -214,21 +210,35 @@ function ModalView({ state, closeWith, variant, contained }) {
214
210
  display: 'flex', alignItems: 'center', justifyContent: 'center',
215
211
  }}
216
212
  >
217
- <div
213
+ <ModalShell
218
214
  ref={dialogRef}
215
+ variant={look}
219
216
  role={typing ? 'dialog' : 'alertdialog'}
220
217
  aria-modal="true"
221
218
  aria-labelledby="kol-modal-title"
222
219
  onMouseDown={(e) => e.stopPropagation()}
223
- className={float ? `kol-modal flex flex-col gap-[18px] p-6 ${look.className}` : `kol-modal flex flex-col gap-4 p-5 rounded ${look.className}`}
220
+ className={float ? 'gap-[18px] p-6' : 'gap-4 p-5'}
224
221
  style={{
225
- ...look.style,
226
222
  minWidth: 320,
227
223
  maxWidth: contained ? '90%' : '90vw',
228
224
  ...(float ? { width: 562 } : {}),
229
225
  }}
226
+ header={float && state.header && <ModalHeader variant="float" icon={state.icon} title={state.header} onClose={cancel} />}
227
+ footer={float ? (
228
+ /* the float's actions sit apart: recovery quiet at the left, the next step at the right */
229
+ <div className="flex items-center justify-between gap-3">
230
+ {state.kind !== 'alert' ? <Button variant="float" tone="ghost" size="md" onClick={cancel}>{state.cancelLabel ?? 'Cancel'}</Button> : <span />}
231
+ <Button variant="float" tone={state.tone === 'danger' ? 'danger' : 'inverted'} size="md" onClick={submit} data-modal-ok>{state.okLabel ?? 'OK'}</Button>
232
+ </div>
233
+ ) : (
234
+ <div className="flex gap-2 justify-end">
235
+ {state.kind !== 'alert' && <Button size="sm" onClick={cancel}>{state.cancelLabel ?? 'Cancel'}</Button>}
236
+ {/* inverted, not primary: since tone-is-the-ground-axis (2026-09-03) primary is the
237
+ * dark ground, so OK drew the same as Cancel and nothing showed what Enter does */}
238
+ <Button tone="inverted" size="sm" onClick={submit} data-modal-ok>{state.okLabel ?? 'OK'}</Button>
239
+ </div>
240
+ )}
230
241
  >
231
- {float && state.header && <QuickLookHeader variant="float" icon={state.icon} title={state.header} onClose={cancel} />}
232
242
  {/* kol-mono-12, not helper: dialog copy WRAPS, and helper's
233
243
  * line-height 1 is single-line chrome only (type protocol). */}
234
244
  {/* pre-line: an alert can carry a failure list, one per line */}
@@ -276,21 +286,7 @@ function ModalView({ state, closeWith, variant, contained }) {
276
286
  ))}
277
287
  </div>
278
288
  )}
279
- {float ? (
280
- /* the float's actions sit apart: recovery quiet at the left, the next step at the right */
281
- <div className="flex items-center justify-between gap-3">
282
- {state.kind !== 'alert' ? <Button variant="float" tone="ghost" size="md" onClick={cancel}>{state.cancelLabel ?? 'Cancel'}</Button> : <span />}
283
- <Button variant="float" tone={state.tone === 'danger' ? 'danger' : 'inverted'} size="md" onClick={submit} data-modal-ok>{state.okLabel ?? 'OK'}</Button>
284
- </div>
285
- ) : (
286
- <div className="flex gap-2 justify-end">
287
- {state.kind !== 'alert' && <Button size="sm" onClick={cancel}>{state.cancelLabel ?? 'Cancel'}</Button>}
288
- {/* inverted, not primary: since tone-is-the-ground-axis (2026-09-03) primary is the
289
- * dark ground, so OK drew the same as Cancel and nothing showed what Enter does */}
290
- <Button tone="inverted" size="sm" onClick={submit} data-modal-ok>{state.okLabel ?? 'OK'}</Button>
291
- </div>
292
- )}
293
- </div>
289
+ </ModalShell>
294
290
  </div>
295
291
  )
296
292
  }
@@ -329,14 +325,14 @@ export function useModal() {
329
325
  /**
330
326
  * Dialog — Modal's shell holding any content (MetricDashboardUpstream, kol-website 2026-10-31 — metric's filter and
331
327
  * segment dialogs). The same `.kol-overlay-scrim` + `.kol-modal` surface as the prompts above, with `children` in place
332
- * of a prompt. **z 150, not Modal's 1000**, so KOL's portalled floats (z 210+) open ABOVE it — a Dropdown or Combobox
328
+ * of a prompt — both draw their panel through `ModalShell` (W2.1, 2026-11-08). **z 150, not Modal's 1000**, so KOL's portalled floats (z 210+) open ABOVE it — a Dropdown or Combobox
333
329
  * inside a dialog has to show its list (a native `<dialog>` cannot: `showModal()` puts it in the top layer, over every
334
330
  * portal). Esc and a press on the scrim close it; Esc is left to an open float inside first.
335
331
  *
336
332
  * <Dialog open={open} onClose={() => setOpen(false)} title="Filter by page" width={560}>…</Dialog>
337
333
  *
338
334
  * `variant="float"` (float-everything W6 rows 83 · 84 · 89, 2026-11-04 — kol-float--style 46:2655): the float window —
339
- * `kol-float-solid` on `--kol-float-window-r`, 24 in, 18 between its parts, the title drawn as `QuickLookHeader
335
+ * `kol-float-solid` on `--kol-float-window-r`, 24 in, 18 between its parts, the title drawn as `ModalHeader
340
336
  * variant="float"` (`icon` · title · − when `onMinimise` · ×) over the children. `blocking` (default true) keeps the
341
337
  * scrim: a blocking task dims the scene, a utility window does not (row 89) — `blocking={false}` drops the scrim and the
342
338
  * press-outside close and leaves the scene live (QuickLookFrame float is the utility window proper).
@@ -362,8 +358,8 @@ export function useModal() {
362
358
  * @param {ReactNode} [aside] · @param {ReactNode} [footer] · @param {number} [height=656]
363
359
  */
364
360
  export function Dialog({ open, onClose, title, width = 560, variant = 'lift', icon, onMinimise, blocking = true, container, kind, headerEnd, sections, section, onSection, aside, footer, height = 656, children }) {
365
- const look = modalVariant(variant, 'lift')
366
- const float = variant === 'float'
361
+ const look = variant === 'settings' ? 'settings' : modalVariant(variant, 'lift')
362
+ const float = look === 'float'
367
363
  useEffect(() => {
368
364
  if (!open) return undefined
369
365
  const onKey = (e) => { if (e.key === 'Escape' && !document.querySelector('.kol-popover-float, [data-state="open"].kol-dd-trigger')) onClose() }
@@ -377,17 +373,20 @@ export function Dialog({ open, onClose, title, width = 560, variant = 'lift', ic
377
373
  return createPortal(
378
374
  <div onMouseDown={blocking ? onClose : undefined} className={blocking ? 'kol-overlay-scrim' : 'pointer-events-none'}
379
375
  style={{ position: container ? 'absolute' : 'fixed', inset: 0, zIndex: 150, display: 'flex', alignItems: 'center', justifyContent: 'center' }}>
380
- <div role="dialog" aria-modal={blocking ? 'true' : undefined} aria-label={title} data-dialog onMouseDown={(e) => e.stopPropagation()}
381
- className="kol-modal kol-settings-window pointer-events-auto flex flex-col overflow-hidden rounded-2xl border border-oq-16 bg-surface-secondary text-fg-96 font-(family-name:--kol-font-family-float) shadow-[var(--kol-shadow-float)]"
382
- style={{ width: `min(${width}px, calc(${within} - 32px))`, height: `min(${height}px, calc(${withinH} - 32px))` }}>
383
- <header className="flex items-center gap-4 h-[60px] shrink-0 pl-6 pr-[22px] border-b border-oq-16">
384
- <h2 className="text-[14px] font-semibold leading-none">{title}</h2>
385
- {kind && <span className="text-[11px] text-oq-64 leading-none mt-px">{kind}</span>}
386
- <span className="flex-1" />
387
- {headerEnd}
388
- <button type="button" aria-label="Close" onClick={onClose}
389
- className="ml-3 size-7 -mr-[7px] inline-flex items-center justify-center rounded-md text-[20px] leading-none text-oq-64 hover:text-(--kol-fg-96) hover:bg-(--kol-oq-08) focus-visible:outline-none focus-visible:shadow-[var(--kol-float-focus)]">×</button>
390
- </header>
376
+ <ModalShell variant="settings" role="dialog" aria-modal={blocking ? 'true' : undefined} aria-label={title} data-dialog onMouseDown={(e) => e.stopPropagation()}
377
+ className="kol-settings-window pointer-events-auto overflow-hidden"
378
+ style={{ width: `min(${width}px, calc(${within} - 32px))`, height: `min(${height}px, calc(${withinH} - 32px))` }}
379
+ header={(
380
+ <header className="flex items-center gap-4 h-[60px] shrink-0 pl-6 pr-[22px] border-b border-oq-16">
381
+ <h2 className="text-[14px] font-semibold leading-none">{title}</h2>
382
+ {kind && <span className="text-[11px] text-oq-64 leading-none mt-px">{kind}</span>}
383
+ <span className="flex-1" />
384
+ {headerEnd}
385
+ <button type="button" aria-label="Close" onClick={onClose}
386
+ className="ml-3 size-7 -mr-[7px] inline-flex items-center justify-center rounded-md text-[20px] leading-none text-oq-64 hover:text-(--kol-fg-96) hover:bg-(--kol-oq-08) focus-visible:outline-none focus-visible:shadow-[var(--kol-float-focus)]">×</button>
387
+ </header>
388
+ )}
389
+ footer={footer && <footer className="flex items-center gap-3 h-[60px] shrink-0 px-6 border-t border-oq-16">{footer}</footer>}>
391
390
  <div className="flex flex-1 min-h-0">
392
391
  {sections?.length > 0 && (
393
392
  <nav aria-label="Settings" className="w-[156px] shrink-0 overflow-y-auto bg-surface-primary border-r border-oq-16 px-2 pt-[21px] pb-4">
@@ -420,8 +419,7 @@ export function Dialog({ open, onClose, title, width = 560, variant = 'lift', ic
420
419
  <div className="flex-1 min-w-0 overflow-y-auto pl-6 pr-5 pt-6 pb-6">{children}</div>
421
420
  {aside && <aside className="w-[248px] shrink-0 mr-6 pt-6 pb-6 overflow-y-auto">{aside}</aside>}
422
421
  </div>
423
- {footer && <footer className="flex items-center gap-3 h-[60px] shrink-0 px-6 border-t border-oq-16">{footer}</footer>}
424
- </div>
422
+ </ModalShell>
425
423
  </div>,
426
424
  container ?? document.body,
427
425
  )
@@ -432,7 +430,8 @@ export function Dialog({ open, onClose, title, width = 560, variant = 'lift', ic
432
430
  className={blocking ? 'kol-overlay-scrim' : 'pointer-events-none'}
433
431
  style={{ position: container ? 'absolute' : 'fixed', inset: 0, zIndex: 150, display: 'flex', alignItems: 'center', justifyContent: 'center' }}
434
432
  >
435
- <div
433
+ <ModalShell
434
+ variant={look}
436
435
  role="dialog"
437
436
  aria-modal={blocking ? 'true' : undefined}
438
437
  aria-label={title}
@@ -441,12 +440,12 @@ export function Dialog({ open, onClose, title, width = 560, variant = 'lift', ic
441
440
  /* THE OVERLAY PANEL (MetricRebuild, 2026-10-31 — user: the filter dialog read as "a borderless box floating
442
441
  * mid-page"): it painted the page's own surface behind an fg-08 hairline, so on a dark page it was the page.
443
442
  * `.kol-overlay-panel` is the lift every KOL overlay wears (oq-04, no border — the scrim is the edge). */
444
- className={float ? `kol-modal pointer-events-auto flex flex-col gap-[18px] p-6 ${container ? 'max-h-[85%]' : 'max-h-[85vh]'} overflow-auto ${look.className}` : `kol-modal flex flex-col rounded ${container ? 'max-h-[85%]' : 'max-h-[85vh]'} ${look.className}${blocking ? '' : ' pointer-events-auto'}`}
445
- style={{ ...look.style, width: `min(${width}px, calc(${container ? '100%' : '100vw'} - 32px))` }}
443
+ className={float ? `pointer-events-auto gap-[18px] p-6 ${container ? 'max-h-[85%]' : 'max-h-[85vh]'} overflow-auto` : `${container ? 'max-h-[85%]' : 'max-h-[85vh]'}${blocking ? '' : ' pointer-events-auto'}`}
444
+ style={{ width: `min(${width}px, calc(${container ? '100%' : '100vw'} - 32px))` }}
445
+ header={float && title && <ModalHeader variant="float" icon={icon} title={title} onMinimise={onMinimise} onClose={onClose} />}
446
446
  >
447
- {float && title && <QuickLookHeader variant="float" icon={icon} title={title} onMinimise={onMinimise} onClose={onClose} />}
448
447
  {children}
449
- </div>
448
+ </ModalShell>
450
449
  </div>,
451
450
  container ?? document.body,
452
451
  )
@@ -1,31 +1,83 @@
1
1
  import Button from '../atoms/Button.jsx'
2
2
  import Avatar from '../atoms/Avatar.jsx'
3
+ import CloseButton from './CloseButton.jsx'
3
4
  import { IconLoader } from '@kolkrabbi/kol-icons'
4
5
 
5
- /* taxonomy-ok: molecule — Avatar (atom) or kol-icons's Icon, a title and trailing actions on Button's nav row */
6
+ /* taxonomy-ok: molecule — Avatar (atom) or kol-icons's IconLoader, a title and trailing actions on Button's nav row; the window row nests Button (atom) + CloseButton (molecule) */
6
7
 
7
8
  /* class-for-class MoreRows' avatar row (menu-system W4.1, 2026-11-07): the nav Button's lg row, `kol-btn-float` on the float */
8
9
  const ROW = { float: 'w-full justify-start kol-btn-float', default: 'w-full justify-start h-11 gap-3' }
9
10
  /* the classes Button emits for `variant="nav" size="lg"` — the static header draws the same row without the press */
10
11
  const NAV_LG = 'kol-btn kol-btn-nav kol-btn-lg kol-mono-16'
11
12
  const isSrc = (a) => /[/.:]/.test(a)
13
+ /* a window's controls — passing any of them (even undefined, as QuickLookFrame does) draws the window row */
14
+ const WINDOW = ['meta', 'nav', 'onMinimise', 'onClose']
12
15
 
13
16
  /**
14
- * ModalHeader — The top row of a floating surface: an avatar or a glyph, the title, and trailing actions (a close).
15
- * One header for every float sheet and modal (menu-system W4, user 2026-11-07: *"why not just modalheader?"*) —
16
- * MoreRows' account row and PanelsMenu's title draw it. With `onClick` the row is the pressable nav Button it was in
17
- * MoreRows; without, the same row as a heading that takes no press.
17
+ * ModalHeader — The top row of every float sheet and modal: one header, two looks (`default` · `float`), two rows.
18
+ * User 2026-11-07: *"why not just modalheader?"*; 2026-11-08: *"are you both accounting for default and float?"* — the
19
+ * window row that was QuickLookHeader folded in, class for class (QuickLookHeader is its deprecated alias).
18
20
  *
19
- * @param {string} title
20
- * @param {string|ReactNode} [avatar] a picture url, initials, or a node drawn as is
21
- * @param {string} [icon] a kol-icons name, in the avatar's place when there is none
22
- * @param {ReactNode} [actions] trailing node — a close button
23
- * @param {'float'|'default'} [variant='default'] `float` the float row (`kol-btn-float`), else the 44px nav row
24
- * @param {Function} [onClick] makes the row a press (the account row)
21
+ * THE MENU ROW (MoreRows' account row, PanelsMenu's title) — an avatar or a glyph, the title, trailing `actions`. With
22
+ * `onClick` the row is the pressable nav Button; without, the same row as a heading that takes no press. Drawn when
23
+ * `avatar` or `onClick` is set, or when no window control is passed.
24
+ *
25
+ * THE WINDOW ROW (Dialog float, the useModal float prompts, QuickLookFrame) — drawn when `meta`, `nav`, `onMinimise` or
26
+ * `onClose` is passed. Default: ‹ › n / N · the file's name · its facts · the actions · the close, on
27
+ * `.kol-quicklook-header`. Float (kol-float--style 46:2500): the window's glyph (16, oq-64) · its title in
28
+ * `kol-float-panel` (Inter 13/500) · − minimise · × close, 12 apart, the controls quiet on oq-64 and bright under the
29
+ * pointer. No rule under it — the no-borders law holds on float.
30
+ *
31
+ * @param {ReactNode} title
32
+ * @param {'float'|'default'} [variant='default']
33
+ * @param {string|ReactNode} [avatar] menu row: a picture url, initials, or a node drawn as is
34
+ * @param {string} [icon] a kol-icons name — the menu row's lead when there is no avatar; the float window's glyph
35
+ * @param {ReactNode} [actions] trailing controls (before the close on the window row)
36
+ * @param {Function} [onClick] menu row: makes the row a press (the account row)
37
+ * @param {ReactNode} [meta] window, default look: the facts after the name
38
+ * @param {Object} [nav] window, default look: `{ index, total, onPrev, onNext }`
39
+ * @param {Function} [onMinimise] window, float: shows the − control
40
+ * @param {Function} [onClose] window: shows the × control
25
41
  * @param {string} [className]
26
42
  */
27
- export default function ModalHeader({ title, avatar, icon, actions, variant = 'default', onClick, className = '' }) {
43
+ export default function ModalHeader(props) {
44
+ const { title, avatar, icon, actions, variant = 'default', onClick, meta, nav, onMinimise, onClose, className = '' } = props
28
45
  const float = variant === 'float'
46
+ if (avatar == null && !onClick && WINDOW.some((k) => k in props)) {
47
+ if (float) {
48
+ const ctl = 'inline-flex size-6 shrink-0 items-center justify-center rounded-full text-oq-64 hover:text-oq-96 hover:bg-fg-08 focus-visible:outline-none focus-visible:shadow-[var(--kol-float-focus)] cursor-pointer'
49
+ return (
50
+ <div className={`flex min-h-6 w-full items-center gap-3 ${className}`.trim()}>
51
+ {icon && <IconLoader name={icon} size={16} className="shrink-0 text-oq-64" />}
52
+ <span className="kol-float-panel min-w-0 flex-1 truncate text-fg-emphasis">{title}</span>
53
+ {actions}
54
+ {onMinimise && <button type="button" aria-label="Minimise" onClick={onMinimise} className={ctl}><IconLoader name="minus" size={14} /></button>}
55
+ {onClose && <button type="button" aria-label="Close" onClick={onClose} className={ctl}><IconLoader name="x" size={16} /></button>}
56
+ </div>
57
+ )
58
+ }
59
+ return (
60
+ <div className={`kol-quicklook-header ${className}`.trim()}>
61
+ {nav?.total > 1 && (
62
+ /* the pager is its own group: the count sits off the chevrons, and the group sits clear of
63
+ * the file's name (user 2026-09-23) */
64
+ <span className="flex items-center gap-1 mr-3">
65
+ <Button variant="nav" size="sm" iconOnly="chevron-left" onClick={nav.onPrev} aria-label="Previous" />
66
+ <Button variant="nav" size="sm" iconOnly="chevron-right" onClick={nav.onNext} aria-label="Next" />
67
+ <span className="kol-mono-12 text-meta tabular-nums ml-3">{nav.index + 1} / {nav.total}</span>
68
+ </span>
69
+ )}
70
+ {title && <span className="kol-mono-12 text-strong truncate">{title}</span>}
71
+ {meta && <span className="kol-mono-12 text-meta truncate">{meta}</span>}
72
+ <span className="flex-1" />
73
+ {actions}
74
+ {/* THE ESTATE'S CLOSE IDIOM, and every header control wears it (user 2026-09-23): bare at
75
+ * rest, a wash on hover — a filled container read as a second surface on the header. LAST, at the
76
+ * far right (user 2026-10-18: *"X should be space between justify on the right"*) */}
77
+ {onClose && <CloseButton size="sm" onClick={onClose} />}
78
+ </div>
79
+ )
80
+ }
29
81
  const cls = `${ROW[float ? 'float' : 'default']} ${className}`.trim()
30
82
  const lead = avatar != null
31
83
  ? (typeof avatar === 'string' ? <Avatar {...(isSrc(avatar) ? { src: avatar } : { initial: avatar })} alt="" size="xs" /> : avatar)
@@ -0,0 +1,48 @@
1
+ import { forwardRef } from 'react'
2
+
3
+ /* taxonomy-ok: molecule — the modal family's panel: the surface every modal, dialog and sheet window draws its parts on */
4
+
5
+ /**
6
+ * ModalShell — The one modal panel (plan-2026-11-08-outstanding W2.1, his Figma issue 52: *"modals not built on one
7
+ * modal"*). The surface, the radius, a header slot, the body and a footer slot — nothing else. The scrim, the portal,
8
+ * the keys and the size stay the caller's (Modal, Dialog, FullscreenOverlay), so every overlay can wear it whatever
9
+ * layer it sits in. Padding and the gap between the parts are the caller's too (`className`): a prompt and a media
10
+ * window do not share them.
11
+ *
12
+ * <ModalShell header={<ModalHeader … />} footer={<div>…actions</div>} className="gap-4 p-5" style={{ width: 560 }}>
13
+ * …body
14
+ * </ModalShell>
15
+ *
16
+ * ONE RADIUS: `--kol-radius-sm` (4px) — the radius Modal's prompts and Dialog wore. The float style's windows keep the
17
+ * float window radius (`float`, 28) and the generator settings window its 16 (`settings`); both are the float style's
18
+ * own, drawn in its Figma.
19
+ *
20
+ * @param {'lift'|'bordered'|'float'|'settings'} [variant='lift']
21
+ * `lift` — the overlay panel every KOL overlay wears (`.kol-overlay-panel`: oq-04, no border, the scrim is the edge);
22
+ * `bordered` — the page surface behind an fg-08 hairline (Modal's prompts); `float` — the float window
23
+ * (`kol-float-solid`); `settings` — the generator settings window (the secondary surface, oq-16 edge, the float shadow).
24
+ * @param {ReactNode} [header] drawn first
25
+ * @param {ReactNode} [footer] drawn last
26
+ * @param {string} [className] the caller's layout: padding, gap, size
27
+ * @param {Object} [style]
28
+ * Any other prop (role, aria-*, onMouseDown, data-*) lands on the panel; the ref is the panel.
29
+ */
30
+ const VARIANTS = {
31
+ lift: { className: 'kol-overlay-panel rounded-[var(--kol-radius-sm)]', style: {} },
32
+ bordered: { className: 'border border-fg-08 rounded-[var(--kol-radius-sm)]', style: { background: 'var(--kol-surface-primary)', color: 'var(--kol-surface-on-primary)' } },
33
+ float: { className: 'kol-float-solid !rounded-[var(--kol-float-window-r)] text-fg-emphasis', style: {} },
34
+ settings: { className: 'rounded-2xl border border-oq-16 bg-surface-secondary text-fg-96 font-(family-name:--kol-font-family-float) shadow-[var(--kol-shadow-float)]', style: {} },
35
+ }
36
+
37
+ const ModalShell = forwardRef(function ModalShell({ variant = 'lift', header, footer, className = '', style, children, ...rest }, ref) {
38
+ const look = VARIANTS[variant] ?? VARIANTS.lift
39
+ return (
40
+ <div ref={ref} {...rest} className={`kol-modal flex flex-col ${look.className} ${className}`.trim()} style={{ ...look.style, ...style }}>
41
+ {header}
42
+ {children}
43
+ {footer}
44
+ </div>
45
+ )
46
+ })
47
+
48
+ export default ModalShell
@@ -1,8 +1,9 @@
1
1
  import { useRef, useState } from 'react'
2
2
  import { IconLoader } from '@kolkrabbi/kol-icons'
3
- import QuickLookHeader from './QuickLookHeader.jsx'
3
+ import ModalHeader from './ModalHeader.jsx'
4
+ import ModalShell from './ModalShell.jsx'
4
5
 
5
- /* taxonomy-ok: molecule — nests QuickLookHeader (molecule) + kol-icons's Icon. */
6
+ /* taxonomy-ok: molecule — ModalHeader (molecule) on ModalShell (molecule) + kol-icons's IconLoader. */
6
7
 
7
8
  /**
8
9
  * QuickLookFrame — The preview window. the Finder Quick Look window (user 2026-09-23: *"put them in a container LIKE
@@ -33,7 +34,7 @@ import QuickLookHeader from './QuickLookHeader.jsx'
33
34
  *
34
35
  * THE UTILITY WINDOW (`variant="float"`, float-everything W6 rows 86 · 88, 2026-11-04 — kol-float--style 46:2840): a
35
36
  * non-modal float window — no scrim, the scene stays live under it. `kol-float-solid` on `--kol-float-window-r`, 20 in,
36
- * 18 between its parts; the header is `QuickLookHeader variant="float"` (`icon` · title · `onMinimise` · `onClose`); the
37
+ * 18 between its parts; the header is `ModalHeader variant="float"` (`icon` · title · `onMinimise` · `onClose`); the
37
38
  * body is the caller's (chip tabs, float fields); `status` is the footer line (`Changes saved automatically`, the
38
39
  * `kol-float-label` role on fg-64) with the resize corner as its glyph at the right — the same drag as the default grip.
39
40
  * @param {'float'} [variant]
@@ -68,26 +69,31 @@ export default function QuickLookFrame({ variant, icon, onMinimise, status, titl
68
69
  const grip = { role: 'separator', 'aria-label': 'Resize', onPointerDown, onPointerMove, onPointerUp, onPointerCancel: onPointerUp }
69
70
  if (variant === 'float') {
70
71
  return (
71
- <div ref={ref} style={size ? { width: size.w, height: size.h } : undefined}
72
- className={`kol-float-solid flex w-full max-w-[562px] flex-col gap-[18px] rounded-[var(--kol-float-window-r)] p-5 text-fg-emphasis ${className}`.trim()}>
73
- {header && <QuickLookHeader variant="float" icon={icon} title={title} actions={actions} onMinimise={onMinimise} onClose={onClose} />}
72
+ <ModalShell ref={ref} variant="float" style={size ? { width: size.w, height: size.h } : undefined}
73
+ className={`w-full max-w-[562px] gap-[18px] p-5 ${className}`.trim()}
74
+ header={header && <ModalHeader variant="float" icon={icon} title={title} actions={actions} onMinimise={onMinimise} onClose={onClose} />}
75
+ footer={(
76
+ <>
77
+ {footer}
78
+ <div className="flex items-center gap-3">
79
+ <span className="kol-float-label min-w-0 flex-1 truncate text-fg-64">{status}</span>
80
+ <span {...grip} className="inline-flex size-4 cursor-nwse-resize touch-none items-center justify-center text-oq-64 hover:text-oq-96"><IconLoader name="expand" size={13} /></span>
81
+ </div>
82
+ </>
83
+ )}>
74
84
  <div className="flex min-h-0 flex-1 flex-col gap-[18px]">{children}</div>
75
- {footer}
76
- <div className="flex items-center gap-3">
77
- <span className="kol-float-label min-w-0 flex-1 truncate text-fg-64">{status}</span>
78
- <span {...grip} className="inline-flex size-4 cursor-nwse-resize touch-none items-center justify-center text-oq-64 hover:text-oq-96"><IconLoader name="expand" size={13} /></span>
79
- </div>
80
- </div>
85
+ </ModalShell>
81
86
  )
82
87
  }
83
- const style = size ? { width: size.w, height: size.h, '--kol-ql-frame-h': `${size.h}px`, '--kol-ql-max-w': `${size.w - 2}px` } : undefined
88
+ /* THE PANEL IS ModalShell's (W2.2, 2026-11-08): the lift surface and the one modal radius; the oq-12 hairline the
89
+ * window wore went with its own panel style — the scrim is the edge, as on every other KOL overlay */
90
+ const style = size ? { width: size.w, height: size.h, '--kol-ql-frame-h': `${size.h}px`, '--kol-ql-max-w': `${size.w}px` } : undefined
84
91
  return (
85
- <div ref={ref} style={style}
86
- className={`kol-quicklook${footer ? ' kol-quicklook--footer' : ''}${size ? ' kol-quicklook--sized' : ''} ${className}`.trim()}>
87
- {header && <QuickLookHeader title={title} meta={meta} actions={actions} nav={nav} onClose={onClose} />}
92
+ <ModalShell ref={ref} style={style}
93
+ className={`kol-quicklook${footer ? ' kol-quicklook--footer' : ''}${size ? ' kol-quicklook--sized' : ''} ${className}`.trim()}
94
+ header={header && <ModalHeader title={title} meta={meta} actions={actions} nav={nav} onClose={onClose} />}
95
+ footer={<>{footer && <div className="kol-quicklook-footer">{footer}</div>}<span className="kol-quicklook-grip" {...grip} /></>}>
88
96
  <div className="kol-quicklook-body">{children}</div>
89
- {footer && <div className="kol-quicklook-footer">{footer}</div>}
90
- <span className="kol-quicklook-grip" {...grip} />
91
- </div>
97
+ </ModalShell>
92
98
  )
93
99
  }
@@ -8,6 +8,7 @@ import Input from '../atoms/Input.jsx'
8
8
  import ViewToggle from '../atoms/ViewToggle.jsx'
9
9
  import SearchInput from '../molecules/SearchInput.jsx'
10
10
  import FullscreenOverlay from '../molecules/FullscreenOverlay.jsx'
11
+ import ModalShell from '../molecules/ModalShell.jsx'
11
12
  import { Tooltip } from '../utilities/Popover.jsx'
12
13
  import MediaTile from '../molecules/MediaTile.jsx'
13
14
  import ContentRow from '../molecules/ContentRow.jsx'
@@ -992,9 +993,9 @@ function PickerShell({ onClose, onPick }) {
992
993
  {/* `scrim` — a modal OVER the page it was opened from, not an opaque surface in its place
993
994
  * (user, 2026-10-07, on labs: "its not overlay, its complete full screen") */}
994
995
  <FullscreenOverlay open scrim onClose={viewerIndex === null ? onClose : () => {}}>
995
- <div className="kol-media-picker">
996
+ <ModalShell className="kol-media-picker max-md:rounded-none">
996
997
  <LibraryChrome onOpen={setViewerIndex} onPick={pick} />
997
- </div>
998
+ </ModalShell>
998
999
  </FullscreenOverlay>
999
1000
 
1000
1001
  {viewerIndex !== null && viewable[viewerIndex] && (
@@ -1115,7 +1116,14 @@ function PickerBrowse({ client, accept, onClose, onSelect, title = 'MEDIA', ...b
1115
1116
  * The X moved three times (overlay corner → title row, 2026-10-10 → beside the gear → corner again)
1116
1117
  * and was wrong each time; without it the card's block-start lane goes too (`pt-5`). */
1117
1118
  <FullscreenOverlay open scrim onClose={onClose} closeButton={false}>
1118
- <div className="kol-media-picker gap-4 pt-5">
1119
+ <ModalShell className="kol-media-picker max-md:rounded-none gap-4 pt-5"
1120
+ footer={!phone && (
1121
+ <div className="mt-auto flex items-center justify-end gap-4">
1122
+ <span className="kol-mono-12 text-fg-48 truncate mr-auto">{file ? file.key : 'Select a file'}</span>
1123
+ <Button tone="grey" size="md" onClick={onClose}>Cancel</Button>
1124
+ <Button size="md" disabled={!ok} onClick={() => use()}>Use</Button>
1125
+ </div>
1126
+ )}>
1119
1127
  {/* THE PICKER READS AS THE MEDIA APP (user 2026-10-23, beside kol-r2b2 on a phone): the title in the display voice —
1120
1128
  * a modal card, not a page of the app, so the shell's masthead does not reach it — and the listing opening at
1121
1129
  * the title root, the buckets as rows (the database glyph), each with its count. The browse surface's own
@@ -1137,14 +1145,7 @@ function PickerBrowse({ client, accept, onClose, onSelect, title = 'MEDIA', ...b
1137
1145
  canInsert={fits}
1138
1146
  />
1139
1147
  </MastheadContext.Provider>
1140
- {!phone && (
1141
- <div className="mt-auto flex items-center justify-end gap-4">
1142
- <span className="kol-mono-12 text-fg-48 truncate mr-auto">{file ? file.key : 'Select a file'}</span>
1143
- <Button tone="grey" size="md" onClick={onClose}>Cancel</Button>
1144
- <Button size="md" disabled={!ok} onClick={() => use()}>Use</Button>
1145
- </div>
1146
- )}
1147
- </div>
1148
+ </ModalShell>
1148
1149
  </FullscreenOverlay>
1149
1150
  )
1150
1151
  }
@@ -7,6 +7,7 @@ import LabeledControl from '../molecules/LabeledControl.jsx'
7
7
  import ToggleSwitch from '../atoms/ToggleSwitch.jsx'
8
8
  import Rail from './Rail.jsx'
9
9
  import FullscreenOverlay from '../molecules/FullscreenOverlay.jsx'
10
+ import ModalShell from '../molecules/ModalShell.jsx'
10
11
  import { Tooltip } from '../utilities/Popover.jsx'
11
12
  import { RailHeader } from './RailKit.jsx'
12
13
 
@@ -97,16 +98,19 @@ export default function SettingsPanel({
97
98
  const width = widthProp ?? 'min(32rem, calc(100vw - 32px))'
98
99
  return (
99
100
  <FullscreenOverlay open scrim closeButton={false} onClose={onClose}>
100
- <div
101
- className={`kol-overlay-panel flex flex-col p-[var(--kol-pad-overlay)] ${className}`}
101
+ {/* the panel is ModalShell's (W2.2, 2026-11-08) — the lift and the one modal radius; ShortcutsOverlay draws here */}
102
+ <ModalShell
103
+ className={`p-[var(--kol-pad-overlay)] ${className}`}
102
104
  style={{ width: typeof width === 'number' ? `${width}px` : width, maxWidth: '100%', maxHeight: '85vh', overflowY: 'auto' }}
105
+ header={(
106
+ <div className="mb-6 flex items-center gap-4">
107
+ <div className="min-w-0 flex-1">{header}</div>
108
+ <CloseButton onClick={onClose} hover={false} className="shrink-0" />
109
+ </div>
110
+ )}
103
111
  >
104
- <div className="mb-6 flex items-center gap-4">
105
- <div className="min-w-0 flex-1">{header}</div>
106
- <CloseButton onClick={onClose} hover={false} className="shrink-0" />
107
- </div>
108
112
  <div className="flex flex-col gap-4"><Divider />{body}{footer && <div className="mt-2">{footer}</div>}</div>
109
- </div>
113
+ </ModalShell>
110
114
  </FullscreenOverlay>
111
115
  )
112
116
  }
@@ -1,60 +0,0 @@
1
- import { IconLoader } from '@kolkrabbi/kol-icons'
2
- import Button from '../atoms/Button.jsx'
3
- import CloseButton from './CloseButton.jsx'
4
-
5
- /* taxonomy-ok: molecule — nests Button (atom) + CloseButton (utility). */
6
-
7
- /**
8
- * QuickLookHeader — A window's title row. Lifted out of QuickLookFrame (float-everything W6 row 82, 2026-11-04) so a
9
- * Dialog, a confirm and the utility window wear the same header. Unset `variant` is QuickLookFrame's header as it was,
10
- * class for class: ‹ › n / N · the file's name · its facts · the actions · the close, on `.kol-quicklook-header`.
11
- *
12
- * `variant="float"` is the exploration's window header (kol-float--style 46:2500): the window's glyph (16, oq-64) · its
13
- * title in `kol-float-panel` (Inter 13/500) · − minimise · × close, 12 apart, the controls quiet on oq-64 and bright
14
- * under the pointer. No rule under it — the no-borders law holds on float.
15
- *
16
- * @param {'float'} [variant]
17
- * @param {string} [icon] float: the window's glyph (`user`, `alert-triangle`, …)
18
- * @param {ReactNode} title
19
- * @param {ReactNode} [meta] default look: the facts after the name
20
- * @param {ReactNode} [actions] controls before the close
21
- * @param {Object} [nav] default look: `{ index, total, onPrev, onNext }`
22
- * @param {Function} [onMinimise] float: shows the − control
23
- * @param {Function} [onClose] shows the × control
24
- * @param {string} [className]
25
- */
26
- export default function QuickLookHeader({ variant, icon, title, meta, actions, nav, onMinimise, onClose, className = '' }) {
27
- if (variant === 'float') {
28
- const ctl = 'inline-flex size-6 shrink-0 items-center justify-center rounded-full text-oq-64 hover:text-oq-96 hover:bg-fg-08 focus-visible:outline-none focus-visible:shadow-[var(--kol-float-focus)] cursor-pointer'
29
- return (
30
- <div className={`flex min-h-6 w-full items-center gap-3 ${className}`.trim()}>
31
- {icon && <IconLoader name={icon} size={16} className="shrink-0 text-oq-64" />}
32
- <span className="kol-float-panel min-w-0 flex-1 truncate text-fg-emphasis">{title}</span>
33
- {actions}
34
- {onMinimise && <button type="button" aria-label="Minimise" onClick={onMinimise} className={ctl}><IconLoader name="minus" size={14} /></button>}
35
- {onClose && <button type="button" aria-label="Close" onClick={onClose} className={ctl}><IconLoader name="x" size={16} /></button>}
36
- </div>
37
- )
38
- }
39
- return (
40
- <div className={`kol-quicklook-header ${className}`.trim()}>
41
- {nav?.total > 1 && (
42
- /* the pager is its own group: the count sits off the chevrons, and the group sits clear of
43
- * the file's name (user 2026-09-23) */
44
- <span className="flex items-center gap-1 mr-3">
45
- <Button variant="nav" size="sm" iconOnly="chevron-left" onClick={nav.onPrev} aria-label="Previous" />
46
- <Button variant="nav" size="sm" iconOnly="chevron-right" onClick={nav.onNext} aria-label="Next" />
47
- <span className="kol-mono-12 text-meta tabular-nums ml-3">{nav.index + 1} / {nav.total}</span>
48
- </span>
49
- )}
50
- {title && <span className="kol-mono-12 text-strong truncate">{title}</span>}
51
- {meta && <span className="kol-mono-12 text-meta truncate">{meta}</span>}
52
- <span className="flex-1" />
53
- {actions}
54
- {/* THE ESTATE'S CLOSE IDIOM, and every header control wears it (user 2026-09-23): bare at
55
- * rest, a wash on hover — a filled container read as a second surface on the header. LAST, at the
56
- * far right (user 2026-10-18: *"X should be space between justify on the right"*) */}
57
- {onClose && <CloseButton size="sm" onClick={onClose} />}
58
- </div>
59
- )
60
- }