@kolkrabbi/kol-component 0.377.0 → 0.379.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +5 -4
- package/src/atoms/BezierPathEditor.jsx +1 -1
- package/src/atoms/Button.jsx +84 -1
- package/src/atoms/Figure.jsx +19 -1
- package/src/atoms/FunctionPlot.jsx +1 -1
- package/src/atoms/Input.jsx +105 -1
- package/src/atoms/Kbd.jsx +42 -2
- package/src/atoms/Link.jsx +20 -0
- package/src/atoms/OriginPicker.jsx +9 -5
- package/src/atoms/SectionFooter.jsx +22 -0
- package/src/atoms/SectionHeader.jsx +24 -0
- package/src/atoms/SizeOrDownload.jsx +1 -1
- package/src/atoms/Textarea.jsx +11 -2
- package/src/atoms/ToggleCheckbox.jsx +23 -1
- package/src/atoms/ToggleSwitch.jsx +39 -0
- package/src/atoms/ViewToggle.jsx +2 -2
- package/src/atoms/XYPad.jsx +25 -0
- package/src/hooks/useDragResize.js +1 -1
- package/src/index.js +26 -3
- package/src/molecules/AccountMenu.jsx +14 -1
- package/src/molecules/AlignmentGrid.jsx +13 -1
- package/src/molecules/ButtonGroup.jsx +73 -1
- package/src/molecules/ButtonSplit.jsx +64 -3
- package/src/molecules/Chip.jsx +26 -0
- package/src/molecules/CodeBlock.jsx +39 -2
- package/src/molecules/ColorInputRow.jsx +125 -4
- package/src/molecules/ColorSwatch.jsx +43 -2
- package/src/molecules/ContentCard.jsx +104 -3
- package/src/molecules/ContentMedia.jsx +1 -1
- package/src/molecules/ContentRow.jsx +3 -3
- package/src/molecules/DividerLabel.jsx +19 -0
- package/src/molecules/Dropdown.jsx +111 -1
- package/src/molecules/DropdownStepper.jsx +29 -0
- package/src/molecules/FieldPair.jsx +41 -2
- package/src/molecules/Header.jsx +8 -4
- package/src/molecules/LabeledControl.jsx +51 -0
- package/src/molecules/Menu.jsx +239 -3
- package/src/molecules/Modal.jsx +216 -10
- package/src/molecules/ModalShell.jsx +21 -8
- package/src/molecules/OptionRow.jsx +1 -1
- package/src/molecules/ParamBindDot.jsx +29 -2
- package/src/molecules/QuantityInput.jsx +48 -0
- package/src/molecules/RailFloat.jsx +4 -3
- package/src/molecules/RailHeader.jsx +32 -2
- package/src/molecules/SectionText.jsx +54 -1
- package/src/molecules/Slider.jsx +101 -2
- package/src/molecules/SplitToolButton.jsx +4 -6
- package/src/molecules/SwatchControls.jsx +28 -0
- package/src/molecules/SwatchGrid.jsx +39 -0
- package/src/molecules/TabsDocument.jsx +131 -0
- package/src/molecules/TabsRow.jsx +35 -1
- package/src/molecules/Toast.jsx +55 -0
- package/src/molecules/TreeRow.jsx +87 -1
- package/src/organisms/AppItemMenuProvider.jsx +2 -2
- package/src/organisms/ColorPickerPopover.jsx +133 -4
- package/src/organisms/ColumnBrowser.jsx +1 -1
- package/src/organisms/CommandOverlay.jsx +396 -21
- package/src/organisms/FindBar.jsx +70 -0
- package/src/organisms/FramedMediaBand.jsx +2 -2
- package/src/organisms/GalleryCarousel.jsx +1 -1
- package/src/organisms/LogoSystem.jsx +38 -0
- package/src/organisms/LogoTuner.jsx +32 -0
- package/src/organisms/MediaLibrary.jsx +1 -1
- package/src/organisms/MediaLibraryPages.jsx +1 -1
- package/src/organisms/Rail.jsx +33 -1
- package/src/organisms/RailSwitcher.jsx +62 -0
- package/src/organisms/ReadingContents.jsx +63 -1
- package/src/organisms/SectionSplit.jsx +1 -1
- package/src/organisms/SettingsPanel.jsx +64 -6
- package/src/organisms/ShortcutsOverlay.jsx +46 -2
- package/src/organisms/SpectrumControls.jsx +112 -19
- package/src/organisms/StatusBar.jsx +30 -0
- package/src/organisms/Table.jsx +141 -2
- package/src/organisms/TimelineDock.jsx +281 -1
- package/src/organisms/logoBoard.jsx +61 -0
- package/src/utilities/AssetPlaceholder.jsx +1 -1
- package/src/utilities/EditorShell.jsx +42 -1
- package/src/utilities/OverlayGlassPanel.jsx +1 -1
- package/src/utilities/Popover.jsx +298 -2
- package/src/utilities/SelectionOverlay.jsx +74 -1
- package/src/utilities/kolboxGlyph.jsx +10 -0
package/src/molecules/Modal.jsx
CHANGED
|
@@ -1,11 +1,13 @@
|
|
|
1
|
-
import { createContext, useCallback, useContext, useEffect, useRef, useState } from 'react'
|
|
1
|
+
import { createContext, useCallback, useContext, useEffect, useLayoutEffect, useRef, useState } from 'react'
|
|
2
2
|
import { createPortal } from 'react-dom'
|
|
3
|
+
import { IconLoader } from '@kolkrabbi/kol-icons'
|
|
3
4
|
import Button from '../atoms/Button.jsx'
|
|
4
5
|
import Input from '../atoms/Input.jsx'
|
|
5
6
|
import ToggleCheckbox from '../atoms/ToggleCheckbox.jsx'
|
|
6
7
|
import ButtonGroup from './ButtonGroup.jsx'
|
|
7
8
|
import Header from './Header.jsx'
|
|
8
9
|
import ModalShell from './ModalShell.jsx'
|
|
10
|
+
import { KolboxShell, PopoverLayer } from '../utilities/Popover.jsx'
|
|
9
11
|
|
|
10
12
|
/**
|
|
11
13
|
* Modal — promise-based prompt + confirm + alert dialogs.
|
|
@@ -122,7 +124,7 @@ export function ModalProvider({ children, variant = 'bordered', container }) {
|
|
|
122
124
|
return (
|
|
123
125
|
<ModalCtx.Provider value={{ prompt, confirm, alert, form }}>
|
|
124
126
|
{children}
|
|
125
|
-
{state && typeof document !== 'undefined' && createPortal(
|
|
127
|
+
{variant === 'kolbox' ? <ModalViewKolbox state={state} closeWith={closeWith} /> : state && typeof document !== 'undefined' && createPortal(
|
|
126
128
|
<ModalView state={state} closeWith={closeWith} variant={state.variant ?? variant} contained={!!container} />,
|
|
127
129
|
container ?? document.body,
|
|
128
130
|
)}
|
|
@@ -292,6 +294,84 @@ function ModalView({ state, closeWith, variant, contained }) {
|
|
|
292
294
|
)
|
|
293
295
|
}
|
|
294
296
|
|
|
297
|
+
|
|
298
|
+
/* ── the kolbox look (plan-2026-11-18-kolbox-system W31.2 batch 4, 2026-11-18) ──
|
|
299
|
+
* `ModalProvider variant="kolbox"`: every prompt, confirm and alert is kolbox's ModalPrompt or ModalConfirm, carried line
|
|
300
|
+
* for line, in `ModalDialog variant="kolbox"`. The calls are useModal's, KOL's words: `confirm(title, { okLabel,
|
|
301
|
+
* cancelLabel, body })`, `alert(title, { okLabel, body })` (the action alone), `prompt(title, defaultValue, { okLabel,
|
|
302
|
+
* cancelLabel, placeholder })`. The confirm: the title as its heading, `body` under it, the cancel (ghost) and the action
|
|
303
|
+
* (primary); Enter confirms unless a button has the focus (it answers for itself); Escape and the dim cancel. The prompt:
|
|
304
|
+
* one Input with the value selected; Enter submits. The provider draws its two dialogs in place (they portal
|
|
305
|
+
* themselves); `container` and a per-call `variant` are not read in this look. */
|
|
306
|
+
function ModalConfirmKolbox({ open, title, message, action = 'OK', cancel = 'Cancel', onConfirm, onCancel }) {
|
|
307
|
+
const ok = useRef(onConfirm); ok.current = onConfirm
|
|
308
|
+
useEffect(() => {
|
|
309
|
+
if (!open) return
|
|
310
|
+
const onKey = (e) => {
|
|
311
|
+
if (e.key !== 'Enter' || e.target?.closest?.('button')) return
|
|
312
|
+
e.preventDefault()
|
|
313
|
+
ok.current?.()
|
|
314
|
+
}
|
|
315
|
+
document.addEventListener('keydown', onKey)
|
|
316
|
+
return () => document.removeEventListener('keydown', onKey)
|
|
317
|
+
}, [open])
|
|
318
|
+
return (
|
|
319
|
+
<ModalDialogKolbox
|
|
320
|
+
open={open}
|
|
321
|
+
onClose={onCancel}
|
|
322
|
+
title={title}
|
|
323
|
+
footer={(
|
|
324
|
+
<>
|
|
325
|
+
{cancel != null && <Button variant="kolbox" tone="ghost" onClick={onCancel}>{cancel}</Button>}
|
|
326
|
+
<Button variant="kolbox" tone="primary" onClick={onConfirm} data-modal-ok>{action}</Button>
|
|
327
|
+
</>
|
|
328
|
+
)}
|
|
329
|
+
>
|
|
330
|
+
{message && <p className="kol-modal-body--kolbox px-4 pb-4" data-modal-confirm>{message}</p>}
|
|
331
|
+
</ModalDialogKolbox>
|
|
332
|
+
)
|
|
333
|
+
}
|
|
334
|
+
|
|
335
|
+
function ModalPromptKolbox({ open, title, label, value = '', placeholder, action = 'OK', cancel = 'Cancel', onSubmit, onCancel }) {
|
|
336
|
+
const [draft, setDraft] = useState(value)
|
|
337
|
+
const field = useRef(null)
|
|
338
|
+
/* after the dialog has moved the focus into its shell, the field takes it with the value selected */
|
|
339
|
+
useEffect(() => { if (open) { setDraft(value ?? ''); setTimeout(() => field.current?.select(), 0) } }, [open]) // eslint-disable-line react-hooks/exhaustive-deps
|
|
340
|
+
return (
|
|
341
|
+
<ModalDialogKolbox
|
|
342
|
+
open={open}
|
|
343
|
+
onClose={onCancel}
|
|
344
|
+
title={title}
|
|
345
|
+
footer={(
|
|
346
|
+
<>
|
|
347
|
+
<Button variant="kolbox" tone="ghost" onClick={onCancel}>{cancel}</Button>
|
|
348
|
+
<Button variant="kolbox" tone="primary" onClick={() => onSubmit?.(draft)} data-modal-ok>{action}</Button>
|
|
349
|
+
</>
|
|
350
|
+
)}
|
|
351
|
+
>
|
|
352
|
+
<div className="px-4 pb-4" data-modal-prompt>
|
|
353
|
+
<Input variant="kolbox" ref={field} aria-label={label ?? title} placeholder={placeholder} value={draft} onChange={(e) => setDraft(e.target.value)} onKeyDown={(e) => e.key === 'Enter' && onSubmit?.(draft)} />
|
|
354
|
+
</div>
|
|
355
|
+
</ModalDialogKolbox>
|
|
356
|
+
)
|
|
357
|
+
}
|
|
358
|
+
|
|
359
|
+
function ModalViewKolbox({ state, closeWith }) {
|
|
360
|
+
const s = state ?? {}
|
|
361
|
+
const confirming = s.kind === 'confirm' || s.kind === 'alert'
|
|
362
|
+
const answer = (ok) => (s.options ? { ok, values: Object.fromEntries(s.options.map((o) => [o.id, !!o.defaultValue])) } : ok)
|
|
363
|
+
return (
|
|
364
|
+
<>
|
|
365
|
+
<ModalPromptKolbox open={s.kind === 'prompt'} title={s.title} value={s.defaultValue} placeholder={s.placeholder}
|
|
366
|
+
action={s.okLabel} cancel={s.cancelLabel} onSubmit={(v) => closeWith(v)} onCancel={() => closeWith(null)} />
|
|
367
|
+
<ModalConfirmKolbox open={confirming} title={s.title} message={s.body} action={s.okLabel}
|
|
368
|
+
cancel={s.kind === 'alert' ? null : s.cancelLabel}
|
|
369
|
+
onConfirm={() => closeWith(s.kind === 'alert' ? undefined : answer(true))}
|
|
370
|
+
onCancel={() => closeWith(s.kind === 'alert' ? undefined : answer(false))} />
|
|
371
|
+
</>
|
|
372
|
+
)
|
|
373
|
+
}
|
|
374
|
+
|
|
295
375
|
/* Warn once, not per call — the fallback swallowing a missing ModalProvider
|
|
296
376
|
* silently is how kol-fxr ran months on native window.confirm without
|
|
297
377
|
* noticing (ModalConfirmLabels, 2026-08-12). */
|
|
@@ -338,7 +418,8 @@ export function useModal() {
|
|
|
338
418
|
* variant="modal"` (`icon` · title · − when `onMinimise` · ×) over the children. `blocking` (default true) keeps the
|
|
339
419
|
* scrim: a blocking task dims the scene, a utility window does not (row 89) — `blocking={false}` drops the scrim and the
|
|
340
420
|
* press-outside close and leaves the scene live (QuickLookFrame float is the utility window proper).
|
|
341
|
-
* @param {'lift'|'bordered'|'float'} [variant='lift']
|
|
421
|
+
* @param {'lift'|'bordered'|'float'|'kolbox'|'folio'} [variant='lift'] `kolbox` (W31.2 batch 4): kolbox's Modal, see `ModalDialogKolbox`;
|
|
422
|
+
* `folio` (Folio migration batch B): Folio's dialog, `title`, `width` (720), `children`, see `ModalDialogFolio`
|
|
342
423
|
* @param {string} [icon] float: the header's glyph
|
|
343
424
|
* @param {Function} [onMinimise] float: the − control
|
|
344
425
|
* @param {boolean} [blocking=true]
|
|
@@ -352,16 +433,140 @@ export function useModal() {
|
|
|
352
433
|
* `[{ key, label, state }]` — the name and a one-line state, 6 apart; the lit one carries its 2px marker and no fill,
|
|
353
434
|
* hover the only fill (LAW 16, plan-2026-11-12-float-rails-figma W13.1; it sat on oq-12 until then); `section` /
|
|
354
435
|
* `onSection`), the body (`children`, 24 in, scrolling), an `aside` column 248 wide (the preview), and a 60 `footer`. The
|
|
355
|
-
* secondary surface, a
|
|
436
|
+
* secondary surface, a 20 round, no outer border (his mock 143:35343, W8.1), oq-16 rules between the parts; the footer hugs
|
|
437
|
+
* its 60 and the body fills the rest. `height` (default 656) and
|
|
356
438
|
* `width` (default 880) are its size; both shrink to the viewport.
|
|
357
439
|
* @param {string} [kind] settings: the line beside the title ("Generate")
|
|
358
440
|
* @param {ReactNode} [headerEnd] settings: the header's right side, before the × (the preset select)
|
|
359
441
|
* @param {Array} [sections] settings: `[{ key, label, state }]`
|
|
360
442
|
* @param {string} [section] · @param {Function} [onSection]
|
|
361
443
|
* @param {ReactNode} [aside] · @param {ReactNode} [footer] · @param {number} [height=656]
|
|
444
|
+
* @param {string} [sectionsLabel='Settings'] settings: the section list's title (the generator calls its list Steps, W23.3)
|
|
445
|
+
* @param {string} [movable] settings · kolbox: a key; the window drags by its header (see `useMovable`)
|
|
446
|
+
* @param {{x?: number, right?: number, y: number}} [place] kolbox: where the window opens until it is moved, in place of centred: its top at `y`, its left at `x` or its right edge at `right`; kept whole on screen
|
|
362
447
|
*/
|
|
363
|
-
|
|
448
|
+
/* `variant="kolbox"` (W31.2 batch 4): kolbox's Modal carried line for line: the kolbox panel shell (`ModalShell
|
|
449
|
+
* variant="kolbox"`) centred on the dim (fg-ab-24), 480 wide (`--kol-kolbox-modal-w`) unless `width` (any CSS length)
|
|
450
|
+
* says otherwise. Escape (the last layer's) and a click on the dim close it. `blocking={false}`: a window over a live
|
|
451
|
+
* scene, no dim; a press, scroll or pinch outside it reaches what is under it and never closes it. Focus moves into the dialog on open and back
|
|
452
|
+
* to whatever held it on close. The shell's `title`, `leading`, `actions`, `footer` and `aria-label` pass through;
|
|
453
|
+
* `className` reaches the dialog beside its own. */
|
|
454
|
+
/* A WINDOW THAT MOVES (plan-2026-11-18-kolbox-system W23.1, 2026-11-18; his "still cant grab this modal to move it out
|
|
455
|
+
* of the way"): `movable` (a key, e.g. "generator") lets a press on the window's header, outside its controls, drag it.
|
|
456
|
+
* It can be moved out of the way, never lost: its header stays on screen top to bottom, its left edge (the title,
|
|
457
|
+
* where it is grabbed) stays on screen, and it may hang off the right edge until 160 px of it are left, so it can
|
|
458
|
+
* always be grabbed back. Once moved it is fixed at its own left and top, so a
|
|
459
|
+
* change of content never re-centres it, and its place is kept per key while the app is open. Only the kolbox and
|
|
460
|
+
* settings variants take it; unset, nothing changes. */
|
|
461
|
+
const SPOTS = new Map()
|
|
462
|
+
const NO_DRAG = 'button, input, select, textarea, a, [role="button"], [role="combobox"], [role="tab"], [role="switch"], [contenteditable="true"], [data-no-drag]'
|
|
463
|
+
const KEEP = 160
|
|
464
|
+
function useMovable(key, ref, place) {
|
|
465
|
+
const [at, setAt] = useState(() => (key ? SPOTS.get(key) ?? null : null))
|
|
466
|
+
/* `place` (kolbox): where the window opens until it is moved, kept whole on screen (8 from each edge) */
|
|
467
|
+
const [placed, setPlaced] = useState(null)
|
|
468
|
+
useLayoutEffect(() => {
|
|
469
|
+
const el = ref.current
|
|
470
|
+
if (!place || at || !el) return
|
|
471
|
+
const m = 8
|
|
472
|
+
const x = place.x ?? place.right - el.offsetWidth
|
|
473
|
+
setPlaced({ x: Math.max(m, Math.min(x, window.innerWidth - el.offsetWidth - m)), y: Math.max(m, Math.min(place.y, window.innerHeight - el.offsetHeight - m)) })
|
|
474
|
+
}, [place?.x, place?.right, place?.y]) // eslint-disable-line react-hooks/exhaustive-deps
|
|
475
|
+
const moved = useRef(false)
|
|
476
|
+
const fit = (x, y, w) => {
|
|
477
|
+
const hh = ref.current?.firstElementChild?.offsetHeight ?? 0
|
|
478
|
+
return { x: Math.max(0, Math.min(x, window.innerWidth - KEEP)), y: Math.max(0, Math.min(y, window.innerHeight - hh)) }
|
|
479
|
+
}
|
|
480
|
+
useEffect(() => { if (key && at) SPOTS.set(key, at) }, [key, at])
|
|
481
|
+
useEffect(() => {
|
|
482
|
+
if (!key) return undefined
|
|
483
|
+
const onResize = () => setAt((a) => { const el = ref.current; return a && el ? fit(a.x, a.y, el.offsetWidth) : a })
|
|
484
|
+
window.addEventListener('resize', onResize)
|
|
485
|
+
return () => window.removeEventListener('resize', onResize)
|
|
486
|
+
}, [key]) // eslint-disable-line react-hooks/exhaustive-deps
|
|
487
|
+
const onPointerDown = (e) => {
|
|
488
|
+
const el = ref.current, head = el?.firstElementChild
|
|
489
|
+
if (!key || e.button !== 0 || !head?.contains(e.target) || e.target.closest(NO_DRAG)) return
|
|
490
|
+
e.preventDefault()
|
|
491
|
+
const r = el.getBoundingClientRect(), sx = e.clientX, sy = e.clientY
|
|
492
|
+
const move = (ev) => {
|
|
493
|
+
const p = fit(r.left + ev.clientX - sx, r.top + ev.clientY - sy, r.width)
|
|
494
|
+
if (p.x !== r.left || p.y !== r.top) moved.current = true
|
|
495
|
+
setAt(p)
|
|
496
|
+
}
|
|
497
|
+
const up = () => {
|
|
498
|
+
window.removeEventListener('pointermove', move)
|
|
499
|
+
window.removeEventListener('pointerup', up)
|
|
500
|
+
window.removeEventListener('pointercancel', up)
|
|
501
|
+
/* the click a drag's release raises on the dim is not a press outside */
|
|
502
|
+
setTimeout(() => { moved.current = false })
|
|
503
|
+
}
|
|
504
|
+
window.addEventListener('pointermove', move)
|
|
505
|
+
window.addEventListener('pointerup', up)
|
|
506
|
+
window.addEventListener('pointercancel', up)
|
|
507
|
+
}
|
|
508
|
+
const spot = at ?? placed
|
|
509
|
+
return {
|
|
510
|
+
style: spot ? { position: 'fixed', left: spot.x, top: spot.y, margin: 0 } : null,
|
|
511
|
+
onPointerDown: key ? onPointerDown : undefined,
|
|
512
|
+
handle: key ? '[&>header]:cursor-grab [&>header]:active:cursor-grabbing' : '',
|
|
513
|
+
dragged: () => moved.current,
|
|
514
|
+
}
|
|
515
|
+
}
|
|
516
|
+
|
|
517
|
+
function ModalDialogKolbox({ open, onClose, width = 'var(--kol-kolbox-modal-w)', className = '', variant, movable, blocking = true, place, ...shell }) {
|
|
518
|
+
const ref = useRef(null)
|
|
519
|
+
const mv = useMovable(movable, ref, place)
|
|
520
|
+
useEffect(() => {
|
|
521
|
+
if (!open) return
|
|
522
|
+
const back = document.activeElement
|
|
523
|
+
ref.current?.focus({ preventScroll: true })
|
|
524
|
+
return () => back?.focus?.({ preventScroll: true })
|
|
525
|
+
}, [open])
|
|
526
|
+
const close = () => { if (!mv.dragged()) onClose?.() }
|
|
527
|
+
return (
|
|
528
|
+
<PopoverLayer open={open} onClose={close} placement="center" kind="modal" blocking={blocking}>
|
|
529
|
+
<KolboxShell ref={ref} tabIndex={-1} aria-modal={blocking ? 'true' : undefined} onClose={onClose} width={width} className={`outline-none ${mv.handle} ${className}`}
|
|
530
|
+
{...shell} style={mv.style ? { width, ...mv.style } : { width }} onPointerDown={mv.onPointerDown} />
|
|
531
|
+
</PopoverLayer>
|
|
532
|
+
)
|
|
533
|
+
}
|
|
534
|
+
|
|
535
|
+
/* `variant="folio"` (Folio migration batch B, 2026-11-22): Folio's New overlay carried class for class (kol-theme
|
|
536
|
+
* `.kol-modal-dialog--folio`): `ModalShell variant="folio"` 14% down on the Folio dim, `width` wide (720) and never wider
|
|
537
|
+
* than the window, a 64 header (the title, the 32 ×) over a rule, then `children`. Drawn in place, never portalled, so
|
|
538
|
+
* it keeps the frame's `data-folio-*`. Escape and a press on the dim close it. */
|
|
539
|
+
function ModalDialogFolio({ open, onClose, title, width = 720, children }) {
|
|
540
|
+
useEffect(() => {
|
|
541
|
+
if (!open) return undefined
|
|
542
|
+
const esc = (e) => e.key === 'Escape' && onClose?.()
|
|
543
|
+
addEventListener('keydown', esc)
|
|
544
|
+
return () => removeEventListener('keydown', esc)
|
|
545
|
+
}, [open, onClose])
|
|
546
|
+
if (!open) return null
|
|
547
|
+
return (
|
|
548
|
+
<div className="kol-modal-dim--folio fixed inset-0 z-50 flex items-start justify-center px-[16px] pt-[14vh]" onMouseDown={onClose}>
|
|
549
|
+
<ModalShell variant="folio" role="dialog" aria-label={title} onMouseDown={(e) => e.stopPropagation()} className="kol-modal-dialog--folio max-w-full" style={{ width }}>
|
|
550
|
+
<div className="kol-modal-head--folio flex h-[64px] items-center justify-between border-b pl-[24px] pr-[16px]">
|
|
551
|
+
<p className="kol-modal-title--folio">{title}</p>
|
|
552
|
+
<button type="button" aria-label="Close" onClick={onClose} className="kol-modal-close--folio flex size-[32px] items-center justify-center rounded-[3px]"><IconLoader name="x" size={14} /></button>
|
|
553
|
+
</div>
|
|
554
|
+
{children}
|
|
555
|
+
</ModalShell>
|
|
556
|
+
</div>
|
|
557
|
+
)
|
|
558
|
+
}
|
|
559
|
+
|
|
560
|
+
export function ModalDialog(props) {
|
|
561
|
+
if (props.variant === 'kolbox') return <ModalDialogKolbox {...props} />
|
|
562
|
+
if (props.variant === 'folio') return <ModalDialogFolio {...props} />
|
|
563
|
+
return <ModalDialogOn {...props} />
|
|
564
|
+
}
|
|
565
|
+
|
|
566
|
+
function ModalDialogOn({ open, onClose, title, width, variant = 'lift', icon, onMinimise, blocking = true, container, kind, headerEnd, sections, section, onSection, aside, footer, height = 656, movable, sectionsLabel = 'Settings', children }) {
|
|
364
567
|
const look = variant === 'settings' ? 'settings' : modalVariant(variant, 'lift')
|
|
568
|
+
const shellRef = useRef(null)
|
|
569
|
+
const mv = useMovable(variant === 'settings' && !container ? movable : undefined, shellRef)
|
|
365
570
|
const float = look === 'float'
|
|
366
571
|
useEffect(() => {
|
|
367
572
|
if (!open) return undefined
|
|
@@ -376,15 +581,16 @@ export function ModalDialog({ open, onClose, title, width, variant = 'lift', ico
|
|
|
376
581
|
return createPortal(
|
|
377
582
|
<div onMouseDown={blocking ? onClose : undefined} className={blocking ? 'kol-overlay-scrim' : 'pointer-events-none'}
|
|
378
583
|
style={{ position: container ? 'absolute' : 'fixed', inset: 0, zIndex: 150, display: 'flex', alignItems: 'center', justifyContent: 'center' }}>
|
|
379
|
-
<ModalShell variant="settings" role="dialog" aria-modal={blocking ? 'true' : undefined} aria-label={title} data-dialog onMouseDown={(e) => e.stopPropagation()}
|
|
380
|
-
|
|
381
|
-
|
|
584
|
+
<ModalShell ref={shellRef} variant="settings" role="dialog" aria-modal={blocking ? 'true' : undefined} aria-label={title} data-dialog onMouseDown={(e) => e.stopPropagation()}
|
|
585
|
+
onPointerDown={mv.onPointerDown}
|
|
586
|
+
className={`kol-settings-window pointer-events-auto overflow-hidden ${mv.handle}`.trim()}
|
|
587
|
+
style={{ width: `min(${width ?? 880}px, calc(${within} - 32px))`, height: `min(${height}px, calc(${withinH} - 32px))`, ...mv.style }}
|
|
382
588
|
header={<Header variant="settings" title={title} kind={kind} end={headerEnd} onClose={onClose} />}
|
|
383
589
|
footer={footer && <footer className="flex items-center gap-3 h-[60px] shrink-0 px-6 border-t border-oq-16">{footer}</footer>}>
|
|
384
590
|
<div className="flex flex-1 min-h-0">
|
|
385
591
|
{sections?.length > 0 && (
|
|
386
|
-
<nav aria-label=
|
|
387
|
-
<p className="pl-[10px] pb-[14px] text-[9px] font-medium leading-[11px] uppercase text-oq-64">
|
|
592
|
+
<nav aria-label={sectionsLabel} className="w-[156px] shrink-0 overflow-y-auto bg-surface-primary border-r border-oq-16 px-2 pt-[21px] pb-4">
|
|
593
|
+
<p className="pl-[10px] pb-[14px] text-[9px] font-medium leading-[11px] uppercase text-oq-64">{sectionsLabel}</p>
|
|
388
594
|
<div role="tablist" aria-orientation="vertical" className="flex flex-col gap-1.5"
|
|
389
595
|
onKeyDown={(e) => {
|
|
390
596
|
const dir = { ArrowDown: 1, ArrowUp: -1 }[e.key]
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { forwardRef } from 'react'
|
|
2
|
+
import { KolboxShell } from '../utilities/Popover.jsx'
|
|
2
3
|
|
|
3
4
|
/* taxonomy-ok: molecule — the modal family's panel: the surface every modal, dialog and sheet window draws its parts on */
|
|
4
5
|
|
|
@@ -13,14 +14,20 @@ import { forwardRef } from 'react'
|
|
|
13
14
|
* …body
|
|
14
15
|
* </ModalShell>
|
|
15
16
|
*
|
|
16
|
-
* ONE RADIUS: `--kol-radius-
|
|
17
|
-
* float window radius (`float`, 28) and the generator settings window its
|
|
17
|
+
* ONE RADIUS: `--kol-radius-4` (4px) — the radius Modal's prompts and Dialog wore. The float style's windows keep the
|
|
18
|
+
* float window radius (`float`, 28) and the generator settings window its 20 (`settings`, no outer border — his mock 143:35343, plan-2026-11-12-one-header W8.1); both are the float style's
|
|
18
19
|
* own, drawn in its Figma.
|
|
19
20
|
*
|
|
20
|
-
* @param {'lift'|'bordered'|'float'|'settings'} [variant='lift']
|
|
21
|
+
* @param {'lift'|'bordered'|'float'|'settings'|'kolbox'|'folio'} [variant='lift']
|
|
21
22
|
* `lift` — the overlay panel every KOL overlay wears (`.kol-overlay-panel`: oq-04, no border, the scrim is the edge);
|
|
22
23
|
* `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,
|
|
24
|
+
* (`kol-float-solid`); `settings` — the generator settings window (the secondary surface, radius 20, the float shadow, no border).
|
|
25
|
+
* `kolbox` (plan-2026-11-18-kolbox-system W31.2 batch 4, 2026-11-18) — kolbox's panel shell (its PopoverShell, carried
|
|
26
|
+
* line for line): radius 16, the secondary surface on the one floating surface, 240 wide (`--kol-kolbox-popover-w`)
|
|
27
|
+
* unless `width` says; it draws its own header from `leading`, `title`, `actions` and the close (`onClose`), the body,
|
|
28
|
+
* and `footer` as a row of buttons; `aria-label` defaults to the title. The panel every kolbox popover and window is.
|
|
29
|
+
* `folio` (Folio migration batch B, 2026-11-22) — Folio's overlay panel: `bordered`'s hairline and radius 4 on Folio's
|
|
30
|
+
* paper and rule (`.kol-modal--folio`); its ink and shadow are the caller's (the search modal's, the dialog's).
|
|
24
31
|
* @param {ReactNode} [header] drawn first
|
|
25
32
|
* @param {ReactNode} [footer] drawn last
|
|
26
33
|
* @param {string} [className] the caller's layout: padding, gap, size
|
|
@@ -28,13 +35,19 @@ import { forwardRef } from 'react'
|
|
|
28
35
|
* Any other prop (role, aria-*, onMouseDown, data-*) lands on the panel; the ref is the panel.
|
|
29
36
|
*/
|
|
30
37
|
const VARIANTS = {
|
|
31
|
-
lift: { className: 'kol-overlay-panel rounded-[var(--kol-radius-
|
|
32
|
-
bordered: { className: 'border border-fg-08 rounded-[var(--kol-radius-
|
|
38
|
+
lift: { className: 'kol-overlay-panel rounded-[var(--kol-radius-4)]', style: {} },
|
|
39
|
+
bordered: { className: 'border border-fg-08 rounded-[var(--kol-radius-4)]', style: { background: 'var(--kol-surface-primary)', color: 'var(--kol-surface-on-primary)' } },
|
|
33
40
|
float: { className: 'kol-float-solid !rounded-[var(--kol-float-window-r)] text-fg-emphasis', style: {} },
|
|
34
|
-
|
|
41
|
+
folio: { className: 'kol-modal--folio border rounded-[var(--kol-radius-4)]', style: {} },
|
|
42
|
+
settings: { className: 'rounded-[20px] bg-surface-secondary text-fg-96 font-(family-name:--kol-font-family-float) shadow-[var(--kol-shadow-float)]', style: {} },
|
|
35
43
|
}
|
|
36
44
|
|
|
37
|
-
const ModalShell = forwardRef(function ModalShell(
|
|
45
|
+
const ModalShell = forwardRef(function ModalShell(props, ref) {
|
|
46
|
+
if (props.variant === 'kolbox') {
|
|
47
|
+
const { variant, ...shell } = props
|
|
48
|
+
return <KolboxShell ref={ref} {...shell} />
|
|
49
|
+
}
|
|
50
|
+
const { variant = 'lift', header, footer, className = '', style, children, ...rest } = props
|
|
38
51
|
const look = VARIANTS[variant] ?? VARIANTS.lift
|
|
39
52
|
return (
|
|
40
53
|
<div ref={ref} {...rest} className={`kol-modal flex flex-col ${look.className} ${className}`.trim()} style={{ ...look.style, ...style }}>
|
|
@@ -78,7 +78,7 @@ export default function OptionRow({
|
|
|
78
78
|
const lead = leading ?? (icon && <IconLoader name={icon} size={glyphSize(size)} />)
|
|
79
79
|
return (
|
|
80
80
|
<Tag
|
|
81
|
-
className={`flex items-center gap-2 px-4 border border-transparent ${ROW_HEIGHT[size] ?? ROW_HEIGHT.md} rounded-[var(--kol-radius-
|
|
81
|
+
className={`flex items-center gap-2 px-4 border border-transparent ${ROW_HEIGHT[size] ?? ROW_HEIGHT.md} rounded-[var(--kol-radius-4)] ${disabled ? 'cursor-not-allowed' : 'cursor-pointer'} text-left ${type ?? ROW_TYPE[size] ?? ROW_TYPE.md} transition-colors ${state} ${className}`.trim()}
|
|
82
82
|
{...rest}
|
|
83
83
|
>
|
|
84
84
|
{/* the glyph takes the row's ink when selected — a grey mark on a white fill reads as a hole */}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { useRef, useState } from 'react'
|
|
1
2
|
import { Menu } from './Menu.jsx'
|
|
2
3
|
import { Tooltip } from '../utilities/Popover.jsx'
|
|
3
4
|
|
|
@@ -39,7 +40,7 @@ const SIZE = {
|
|
|
39
40
|
* @param {number} [minWidth=180] - The menu's minimum width
|
|
40
41
|
* @param {string} [className] - Extra classes on the trigger
|
|
41
42
|
*/
|
|
42
|
-
|
|
43
|
+
function ParamBindDotDefault({
|
|
43
44
|
bound = false,
|
|
44
45
|
mode,
|
|
45
46
|
items = [],
|
|
@@ -60,7 +61,7 @@ export default function ParamBindDot({
|
|
|
60
61
|
aria-label={name}
|
|
61
62
|
{...props}
|
|
62
63
|
className={[
|
|
63
|
-
'kol-param-bind-dot group inline-flex shrink-0 items-center justify-center p-0 border-0 bg-transparent cursor-pointer rounded-[var(--kol-radius-
|
|
64
|
+
'kol-param-bind-dot group inline-flex shrink-0 items-center justify-center p-0 border-0 bg-transparent cursor-pointer rounded-[var(--kol-radius-2)] outline-none',
|
|
64
65
|
'focus-visible:outline focus-visible:outline-1 focus-visible:outline-[var(--kol-focus-ring-quiet)]',
|
|
65
66
|
SIZE[size] ?? SIZE.sm,
|
|
66
67
|
className,
|
|
@@ -77,3 +78,29 @@ export default function ParamBindDot({
|
|
|
77
78
|
)} />
|
|
78
79
|
)
|
|
79
80
|
}
|
|
81
|
+
|
|
82
|
+
/* kolbox (plan-2026-11-18-kolbox-system W31.2 batch 5, 2026-11-18): kolbox's BindDot (round 4, W5), its drawing carried
|
|
83
|
+
* from apps/kolbox/src/labs/Params.jsx (the binding itself stays the caller's): a 16 hit box, a 6 dot hollow on the muted
|
|
84
|
+
* ring, filled in the accent once `bound`; the kolbox Tooltip (`tooltip`, else "Modulate"); a press opens Menu kolbox
|
|
85
|
+
* beside it with `items` ({ label, checked, onClick }) as one group. */
|
|
86
|
+
function ParamBindDotKolbox({ bound = false, items = [], label, tooltip, minWidth = 180 }) {
|
|
87
|
+
const ref = useRef(null)
|
|
88
|
+
const [open, setOpen] = useState(false)
|
|
89
|
+
return (
|
|
90
|
+
<>
|
|
91
|
+
<Tooltip variant="kolbox" label={tooltip ?? 'Modulate'}>
|
|
92
|
+
<button ref={ref} type="button" aria-label={`Modulate${label ? ` ${label}` : ''}`} aria-haspopup="menu" aria-expanded={open} data-bind-dot
|
|
93
|
+
onClick={() => setOpen((o) => !o)}
|
|
94
|
+
className="kol-bind-dot--kolbox inline-flex size-4 shrink-0 items-center justify-center rounded-full outline-none focus-visible:outline-solid focus-visible:outline-1">
|
|
95
|
+
<span className={`kol-bind-dot-mark${bound ? ' is-bound' : ''} size-1.5 rounded-full`} />
|
|
96
|
+
</button>
|
|
97
|
+
</Tooltip>
|
|
98
|
+
<Menu variant="kolbox" aria-label="Modulate" anchor={ref} open={open} onClose={() => setOpen(false)} minWidth={minWidth}
|
|
99
|
+
groups={[items.map((it, i) => ({ label: it.label, value: i, check: !!it.checked }))]} onSelect={(r) => items[r.value]?.onClick?.()} />
|
|
100
|
+
</>
|
|
101
|
+
)
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
export default function ParamBindDot(props) {
|
|
105
|
+
return props.variant === 'kolbox' ? <ParamBindDotKolbox {...props} /> : <ParamBindDotDefault {...props} />
|
|
106
|
+
}
|
|
@@ -23,9 +23,26 @@ import { useEffect, useState } from 'react'
|
|
|
23
23
|
* well, − value + in Inter 500 (the glyphs oq, 40% at a bound), the float heights by `size`
|
|
24
24
|
* @param {string} unit FLOAT: a word after the value (`22 px` — the reader's text size, W11 row 151, 2026-11-04)
|
|
25
25
|
* @param {string} ariaLabel FLOAT: what the value is; the − + read `Decrease <it>` / `Increase <it>` (default quantity)
|
|
26
|
+
* @param {'folio'} variant also `folio` (Folio migration batch A, 2026-11-22): Folio's stepper, two 32 squares at radius
|
|
27
|
+
* 4 with the rule line round the value (JetBrains Mono 12 / 16), the step glyphs 12 / 500;
|
|
28
|
+
* 8 apart, the root as wide as its row; a bound dims its square to 40%
|
|
29
|
+
* @param {number} step FOLIO: how far one press moves the value (default 1; the reader's sizes step by 2)
|
|
30
|
+
* @param {ReactNode} down FOLIO: the − square's text (`A−`)
|
|
31
|
+
* @param {ReactNode} up FOLIO: the + square's text (`A+`)
|
|
32
|
+
* @param {string} downLabel FOLIO: the − square's name (`Smaller text`)
|
|
33
|
+
* @param {string} upLabel FOLIO: the + square's name (`Larger text`)
|
|
34
|
+
* @param {'kolbox'} variant also `kolbox` (Folio on kolbox, 2026-11-22): kolbox has no stepper of its own, so it is built
|
|
35
|
+
* from its parts: `Input variant="kolbox"` (its sm field, `--kol-kolbox-ctl` high: the value
|
|
36
|
+
* in mono with `unit` after it, typed and committed on Enter or leaving, ↑↓ step it) between
|
|
37
|
+
* two kolbox icon Buttons, − and + (your icons' `minus` and `plus`), 4 apart, the root as wide
|
|
38
|
+
* as its row. `step`, `min`, `max` as folio's: a typed value is held to the range and the step;
|
|
39
|
+
* a button at a bound is disabled. `downLabel`, `upLabel` name the buttons (else
|
|
40
|
+
* `Decrease <ariaLabel>`, `Increase <ariaLabel>`); `down`, `up` are not drawn (the set's glyphs are)
|
|
26
41
|
* @param {string} className extra classes on the root
|
|
27
42
|
*/
|
|
28
43
|
import { IconLoader } from '@kolkrabbi/kol-icons'
|
|
44
|
+
import Input from '../atoms/Input.jsx'
|
|
45
|
+
import Button from '../atoms/Button.jsx'
|
|
29
46
|
const FLOAT_H = { sm: 'h-[var(--kol-float-h-sm)]', md: 'h-[var(--kol-float-h-md)]', lg: 'h-[var(--kol-float-h-lg)]' }
|
|
30
47
|
|
|
31
48
|
const SIZE_MAP = {
|
|
@@ -44,6 +61,11 @@ const QuantityInput = ({
|
|
|
44
61
|
variant,
|
|
45
62
|
unit,
|
|
46
63
|
ariaLabel = 'quantity',
|
|
64
|
+
step = 1,
|
|
65
|
+
down,
|
|
66
|
+
up,
|
|
67
|
+
downLabel,
|
|
68
|
+
upLabel,
|
|
47
69
|
className = '',
|
|
48
70
|
}) => {
|
|
49
71
|
const [resolvedSize, setResolvedSize] = useState('md')
|
|
@@ -90,6 +112,32 @@ const QuantityInput = ({
|
|
|
90
112
|
)
|
|
91
113
|
}
|
|
92
114
|
|
|
115
|
+
/* folio (Folio migration batch A, 2026-11-22): Folio's Stepper carried class for class (apps/folio Chrome.jsx), two 32
|
|
116
|
+
* squares round the value, stepping by `step`; the chrome in kol-theme `.kol-quantity-input--folio` */
|
|
117
|
+
if (variant === 'folio') {
|
|
118
|
+
const stepCls = 'kol-quantity-input-step flex size-[32px] items-center justify-center rounded-[4px] border disabled:opacity-40'
|
|
119
|
+
return (
|
|
120
|
+
<div className={`kol-quantity-input--folio flex items-center gap-[8px] ${className}`.trim()}>
|
|
121
|
+
<button type="button" aria-label={downLabel} disabled={value <= min} onClick={() => onChange?.(value - step)} className={stepCls}>{down}</button>
|
|
122
|
+
<p className="kol-quantity-input-value flex-1 text-center tabular-nums">{value}{unit ? ` ${unit}` : ''}</p>
|
|
123
|
+
<button type="button" aria-label={upLabel} disabled={value >= max} onClick={() => onChange?.(value + step)} className={stepCls}>{up}</button>
|
|
124
|
+
</div>
|
|
125
|
+
)
|
|
126
|
+
}
|
|
127
|
+
|
|
128
|
+
/* kolbox (Folio on kolbox, 2026-11-22): kolbox's field between its two icon buttons */
|
|
129
|
+
if (variant === 'kolbox') {
|
|
130
|
+
const to = (n) => Math.min(max, Math.max(min, min + Math.round((n - min) / step) * step))
|
|
131
|
+
const commit = (text) => { const n = parseFloat(text); if (Number.isFinite(n) && to(n) !== value) onChange?.(to(n)) }
|
|
132
|
+
return (
|
|
133
|
+
<div className={`flex min-w-0 items-center gap-1 ${className}`.trim()}>
|
|
134
|
+
<Button variant="kolbox" iconOnly="minus" aria-label={downLabel ?? `Decrease ${ariaLabel}`} disabled={value <= min} onClick={() => onChange?.(to(value - step))} />
|
|
135
|
+
<Input variant="kolbox" aria-label={ariaLabel} value={value} onCommit={commit} suffix={unit} className="flex-1" />
|
|
136
|
+
<Button variant="kolbox" iconOnly="plus" aria-label={upLabel ?? `Increase ${ariaLabel}`} disabled={value >= max} onClick={() => onChange?.(to(value + step))} />
|
|
137
|
+
</div>
|
|
138
|
+
)
|
|
139
|
+
}
|
|
140
|
+
|
|
93
141
|
/* controls="split" — the − value + pill (formerly QuantityStepper). */
|
|
94
142
|
if (controls === 'split') {
|
|
95
143
|
const btn = (disabled) => ({
|
|
@@ -26,6 +26,7 @@ import { floatSurfaceClass } from '../utilities/tone.js'
|
|
|
26
26
|
* @param {'property'|'nav'} [headerVariant='property'] the Header's variant while open (`nav`: NavRail float's switcher,
|
|
27
27
|
* with `icon` and `onSwitch`); collapsed-v, the pill is always the plain title
|
|
28
28
|
* @param {ReactNode} [title] the header's title, and the collapsed pill's
|
|
29
|
+
* @param {ReactNode} [kind] the quiet second text beside the title (the preset beside the effect, W10.1)
|
|
29
30
|
* @param {ReactNode} [head] replaces the title in the open header (a consumer's own switcher)
|
|
30
31
|
* @param {ReactNode} [actions] the Header's `end`: before the toggles; not on the collapsed pill
|
|
31
32
|
* @param {Function} [onExpand] · {Function} [onCollapseH] the Header's expand and collapse-h; not on the collapsed pill
|
|
@@ -43,7 +44,7 @@ import { floatSurfaceClass } from '../utilities/tone.js'
|
|
|
43
44
|
*/
|
|
44
45
|
const INSET = { md: 'p-4', sm: 'p-3', none: '' }
|
|
45
46
|
|
|
46
|
-
export default function RailFloat({ header, headerVariant = 'property', icon, onSwitch, title, head, actions, onExpand, onCollapseH, collapsibleV, collapsedV, defaultCollapsedV, onCollapseV, foldable, folded, defaultFolded, onFold, compact = false, wide = false, width, inset = 'md', surface = 'solid', footer, as: Tag = 'section', className = '', bodyClassName = '', style, 'aria-label': ariaLabel, children }) {
|
|
47
|
+
export default function RailFloat({ header, headerVariant = 'property', icon, onSwitch, title, kind, head, actions, onExpand, onCollapseH, collapsibleV, collapsedV, defaultCollapsedV, onCollapseV, foldable, folded, defaultFolded, onFold, compact = false, wide = false, width, inset = 'md', surface = 'solid', footer, as: Tag = 'section', className = '', bodyClassName = '', style, 'aria-label': ariaLabel, children }) {
|
|
47
48
|
const canV = collapsibleV ?? foldable ?? false
|
|
48
49
|
const ctlV = collapsedV ?? folded
|
|
49
50
|
const [ownV, setOwnV] = useState(defaultCollapsedV ?? defaultFolded ?? false)
|
|
@@ -53,8 +54,8 @@ export default function RailFloat({ header, headerVariant = 'property', icon, on
|
|
|
53
54
|
const label = ariaLabel ?? (typeof title === 'string' ? title : undefined)
|
|
54
55
|
const gap = compact ? 'gap-2' : 'gap-[var(--kol-float-module-gap)]'
|
|
55
56
|
const headerSlot = header ?? ((head || title || actions || canV || onExpand || onCollapseH) && (isV
|
|
56
|
-
? <Header variant="property" title={title} collapsedV onCollapseV={toggleV} />
|
|
57
|
-
: <Header variant={headerVariant} icon={icon} onSwitch={onSwitch} title={head ?? title} end={actions} onExpand={onExpand} onCollapseH={onCollapseH} onCollapseV={canV ? toggleV : undefined} />
|
|
57
|
+
? <Header variant="property" title={title} kind={kind} collapsedV onCollapseV={toggleV} />
|
|
58
|
+
: <Header variant={headerVariant} icon={icon} onSwitch={onSwitch} title={head ?? title} kind={head ? undefined : kind} end={actions} onExpand={onExpand} onCollapseH={onCollapseH} onCollapseV={canV ? toggleV : undefined} />
|
|
58
59
|
))
|
|
59
60
|
const shape = isV
|
|
60
61
|
? 'flex-row items-center rounded-full pl-4 pr-1.5'
|
|
@@ -10,10 +10,40 @@ import Header from './Header.jsx'
|
|
|
10
10
|
* retirement ledger: `actions` → `end`, `collapsedV` / `onCollapseV` (the old `folded` / `onFold` still accepted).
|
|
11
11
|
* The default line stays here: it is not one of Header's four variants.
|
|
12
12
|
*
|
|
13
|
-
*
|
|
13
|
+
* `variant="kolbox"` (W31.2 batch 5): kolbox's rail header, with `leading` and `size` md · sm (below).
|
|
14
|
+
*
|
|
15
|
+
* @param {'default'|'float'|'kolbox'} [variant='default']
|
|
14
16
|
* @param {ReactNode} [title] · {ReactNode} [subtitle] · {ReactNode} [actions] · {string} [className]
|
|
15
17
|
*/
|
|
16
|
-
export default function RailHeader({ variant = 'default', title, subtitle, actions, collapsedV, onCollapseV, folded, onFold, className = '' }) {
|
|
18
|
+
export default function RailHeader({ variant = 'default', title, subtitle, actions, leading, size = 'md', collapsedV, onCollapseV, folded, onFold, className = '' }) {
|
|
19
|
+
/* kolbox (plan-2026-11-18-kolbox-system W31.2 batch 5, 2026-11-18): kolbox's RailHeader, carried from
|
|
20
|
+
* apps/kolbox/src/ui/RailHeader.jsx: a `leading` slot, the title, the `subtitle` as a quiet meta line at the right,
|
|
21
|
+
* the actions; inset 16. `size` md the plain header (48 high), sm the document header (the file's RailHeader 61:11315:
|
|
22
|
+
* 65 high as Figma's, the title on the document voice 13 / 22; below). */
|
|
23
|
+
if (variant === 'kolbox') {
|
|
24
|
+
const sm = size === 'sm'
|
|
25
|
+
return (
|
|
26
|
+
<div className={`kol-rail-header--kolbox flex items-center ${sm ? 'items-start! gap-2 pt-[13px] pb-[9px] pr-2 pl-4' : 'h-12 gap-2 px-4'} ${className}`.trim()} data-rail-header>
|
|
27
|
+
{leading}
|
|
28
|
+
{sm ? (
|
|
29
|
+
/* sm, the document header: the subtitle is a quiet line UNDER the title, as his reference draws it (2026-11-19);
|
|
30
|
+
the header grows by that line only when there is one. As Figma's file header measures (plan-2026-11-23-editor-
|
|
31
|
+
measured-against-figma W3): 240 x 65, the title row 22 at 13 down, 5 to the line, the line 16, 9 under it; 16
|
|
32
|
+
left, 8 right, the actions 8 down */
|
|
33
|
+
<span className="flex! h-auto! min-w-0 flex-1 flex-col">
|
|
34
|
+
<span className="kol-rail-header-title--sm flex h-[22px] min-w-0 items-center">{title}</span>
|
|
35
|
+
{subtitle && <span className="kol-rail-header-sub truncate">{subtitle}</span>}
|
|
36
|
+
</span>
|
|
37
|
+
) : (
|
|
38
|
+
<>
|
|
39
|
+
<span className="kol-rail-header-title--md min-w-0 truncate">{title}</span>
|
|
40
|
+
<span className="kol-rail-header-meta min-w-0 flex-1 truncate text-right">{subtitle}</span>
|
|
41
|
+
</>
|
|
42
|
+
)}
|
|
43
|
+
{actions && <span className={`flex shrink-0 items-center ${sm ? '-mt-[5px]' : '-mr-1'}`}>{actions}</span>}
|
|
44
|
+
</div>
|
|
45
|
+
)
|
|
46
|
+
}
|
|
17
47
|
if (variant !== 'float') {
|
|
18
48
|
return (
|
|
19
49
|
<div className={`flex min-w-0 items-center gap-2 ${className}`.trim()}>
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import KolboxGlyph from '../utilities/kolboxGlyph.jsx'
|
|
1
2
|
/**
|
|
2
3
|
* SectionText — The label, headline and body block. the ruled text block of the SECTION family (SectionSet,
|
|
3
4
|
* kol-website 2026-08-26): label · headline · body · actions, every slot
|
|
@@ -85,7 +86,7 @@ export const SECTION_TEXT_LEVELS = {
|
|
|
85
86
|
float: { title: 'kol-float-sheet', lede: 'kol-float-body text-fg-64', eyebrow: 'kol-float-ruler text-fg-64', gap: 'gap-2', mb: '24px' },
|
|
86
87
|
}
|
|
87
88
|
|
|
88
|
-
|
|
89
|
+
function SectionTextDefault({
|
|
89
90
|
eyebrow,
|
|
90
91
|
label,
|
|
91
92
|
headline,
|
|
@@ -219,3 +220,55 @@ export default function SectionText({
|
|
|
219
220
|
</div>
|
|
220
221
|
)
|
|
221
222
|
}
|
|
223
|
+
|
|
224
|
+
/* kolbox's title row (W31.2 batch 5), below */
|
|
225
|
+
function SectionTextKolbox({ headline, menu, actions, className = '' }) {
|
|
226
|
+
/* kolbox (plan-2026-11-18-kolbox-system W31.2 batch 5, 2026-11-18): kolbox's BrowserTitleRow (Figma `BrowserTitleRow`),
|
|
227
|
+
* carried from apps/kolbox/src/home/BrowserTitleRow.jsx: 64 high, 12 under the top bar, inset 32; the 40 folder glyph,
|
|
228
|
+
* the `headline` (22 / 28, read off the Figma build) and its `menu` (the chevron node) at the left; `actions` (the
|
|
229
|
+
* filters and the view switch) at the right. Under 768 it wraps. */
|
|
230
|
+
return (
|
|
231
|
+
<div className={`kol-section-text--kolbox mt-3 flex h-16 shrink-0 items-center gap-4 px-8 max-md:h-auto max-md:flex-wrap max-md:gap-y-2 max-md:px-4 ${className}`.trim()} data-browser-title-row>
|
|
232
|
+
<KolboxGlyph name="folder" size={40} className="kol-section-text-glyph" />
|
|
233
|
+
<div className="flex min-w-0 flex-1 items-center gap-1 max-md:flex-wrap">
|
|
234
|
+
<h1 className="kol-section-text-title truncate">{headline}</h1>
|
|
235
|
+
{menu}
|
|
236
|
+
</div>
|
|
237
|
+
<div className="flex shrink-0 items-center gap-2 max-md:w-full max-md:flex-wrap">{actions}</div>
|
|
238
|
+
</div>
|
|
239
|
+
)
|
|
240
|
+
}
|
|
241
|
+
|
|
242
|
+
/* folio (Folio batch E, 2026-11-22): Folio's page titles and section heads, carried from apps/folio's FolioShelf (the
|
|
243
|
+
* shelf's title block and its numbered `Heading`) and FolioDocument (a chapter's and an article's head). The `eyebrow`
|
|
244
|
+
* in Folio's label over the `headline` over the `body`, muted; `children` (the document's date row) after the body.
|
|
245
|
+
* `headlineSize` is Folio's type step: `title` (the default, a page's), `chapter` or `section`; `headlineAs` h1 by
|
|
246
|
+
* default. `inline` (Folio's, no twin) sets the three on one baseline row, the numbered section head: the eyebrow its
|
|
247
|
+
* number, `meta` the quiet fact after the headline. `gap` is the rhythm and `slotClass.headline` the headline's extra
|
|
248
|
+
* classes (a title that carries the language flags lays them in a row), as in the default. */
|
|
249
|
+
const FOLIO_HEADLINE = { title: 'kol-folio-title', chapter: 'kol-folio-chapter', section: 'kol-folio-section' }
|
|
250
|
+
function SectionTextFolio({ eyebrow, label, headline, headlineSize = 'title', headlineAs: H = 'h1', body, meta, inline = false, gap = 'gap-[12px]', slotClass = {}, className = '', children }) {
|
|
251
|
+
const eb = eyebrow ?? label
|
|
252
|
+
if (inline) {
|
|
253
|
+
return (
|
|
254
|
+
<div className={`kol-section-text--folio flex items-baseline whitespace-nowrap ${gap} ${className}`.trim()}>
|
|
255
|
+
{eb != null && <p className="kol-folio-label kol-section-text-muted">{eb}</p>}
|
|
256
|
+
<H className={FOLIO_HEADLINE[headlineSize]}>{headline}</H>
|
|
257
|
+
{meta && <p className="kol-folio-meta kol-section-text-muted">{meta}</p>}
|
|
258
|
+
</div>
|
|
259
|
+
)
|
|
260
|
+
}
|
|
261
|
+
return (
|
|
262
|
+
<div className={`kol-section-text--folio flex flex-col ${gap} ${className}`.trim()}>
|
|
263
|
+
{eb != null && <p className="kol-folio-label kol-section-text-muted">{eb}</p>}
|
|
264
|
+
<H className={`${FOLIO_HEADLINE[headlineSize]} ${slotClass.headline ?? ''}`.trim()}>{headline}</H>
|
|
265
|
+
{body && <p className="kol-folio-body kol-section-text-muted">{body}</p>}
|
|
266
|
+
{children}
|
|
267
|
+
</div>
|
|
268
|
+
)
|
|
269
|
+
}
|
|
270
|
+
|
|
271
|
+
export default function SectionText(props) {
|
|
272
|
+
if (props.variant === 'folio') return <SectionTextFolio {...props} />
|
|
273
|
+
return props.variant === 'kolbox' ? <SectionTextKolbox {...props} /> : <SectionTextDefault {...props} />
|
|
274
|
+
}
|