@kolkrabbi/kol-component 0.378.0 → 0.380.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/Badge.jsx +1 -5
- package/src/atoms/BezierPathEditor.jsx +1 -1
- package/src/atoms/Button.jsx +88 -12
- package/src/atoms/Figure.jsx +19 -1
- package/src/atoms/FunctionPlot.jsx +1 -1
- package/src/atoms/Input.jsx +107 -7
- package/src/atoms/Kbd.jsx +42 -2
- package/src/atoms/Link.jsx +20 -0
- package/src/atoms/OriginPicker.jsx +9 -5
- package/src/atoms/Pill.jsx +1 -3
- package/src/atoms/ProgressBar.jsx +3 -6
- package/src/atoms/SectionFooter.jsx +22 -0
- package/src/atoms/SectionHeader.jsx +24 -0
- package/src/atoms/SectionLabel.jsx +0 -22
- package/src/atoms/SizeOrDownload.jsx +1 -1
- package/src/atoms/Tag.jsx +4 -7
- package/src/atoms/Textarea.jsx +12 -7
- package/src/atoms/ToggleCheckbox.jsx +25 -5
- package/src/atoms/ToggleSwitch.jsx +41 -7
- package/src/atoms/ViewToggle.jsx +2 -29
- package/src/atoms/XYPad.jsx +25 -0
- package/src/hooks/useDragResize.js +1 -1
- package/src/index.js +26 -4
- package/src/molecules/AccountMenu.jsx +16 -3
- package/src/molecules/AlignmentGrid.jsx +13 -1
- package/src/molecules/ButtonGroup.jsx +78 -15
- package/src/molecules/ButtonSplit.jsx +75 -28
- 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 +4 -32
- package/src/molecules/ContextMenu.jsx +0 -1
- package/src/molecules/DividerLabel.jsx +19 -0
- package/src/molecules/DocsToc.jsx +1 -16
- package/src/molecules/Dropdown.jsx +115 -18
- package/src/molecules/DropdownStepper.jsx +29 -0
- package/src/molecules/EmptyState.jsx +1 -15
- package/src/molecules/FieldPair.jsx +41 -2
- package/src/molecules/Header.jsx +4 -4
- package/src/molecules/IndexRow.jsx +1 -1
- package/src/molecules/InlineAddRow.jsx +2 -2
- package/src/molecules/LabeledControl.jsx +56 -11
- package/src/molecules/LayerRow.jsx +1 -1
- package/src/molecules/LinkAddRow.jsx +5 -7
- package/src/molecules/Menu.jsx +250 -33
- package/src/molecules/MenuFloat.jsx +6 -12
- package/src/molecules/MenuList.jsx +5 -11
- package/src/molecules/Modal.jsx +228 -55
- package/src/molecules/ModalHeader.jsx +12 -20
- package/src/molecules/ModalShell.jsx +20 -10
- package/src/molecules/NoticeBanner.jsx +1 -1
- package/src/molecules/OptionRow.jsx +1 -1
- package/src/molecules/PanelsMenu.jsx +2 -2
- package/src/molecules/ParamBindDot.jsx +29 -2
- package/src/molecules/PasswordInput.jsx +1 -1
- package/src/molecules/QuantityInput.jsx +45 -13
- package/src/molecules/QuickLookFrame.jsx +2 -31
- package/src/molecules/RailHeader.jsx +37 -16
- package/src/molecules/ReadingActions.jsx +2 -2
- package/src/molecules/ReadingNotes.jsx +3 -3
- package/src/molecules/ReadingSettings.jsx +8 -8
- package/src/molecules/SearchInput.jsx +4 -5
- package/src/molecules/SectionText.jsx +56 -10
- package/src/molecules/SettingsControls.jsx +23 -23
- package/src/molecules/Slider.jsx +103 -55
- package/src/molecules/SpecList.jsx +1 -21
- 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 +40 -50
- package/src/molecules/TaskRow.jsx +2 -2
- package/src/molecules/Toast.jsx +55 -0
- package/src/molecules/TocRow.jsx +1 -1
- package/src/molecules/TreeRow.jsx +87 -1
- package/src/molecules/WorkspaceSwitcher.jsx +3 -6
- 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 +362 -87
- package/src/organisms/ContentFilters.jsx +4 -12
- 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 -56
- package/src/organisms/MediaLibraryPages.jsx +1 -1
- package/src/organisms/NavRail.jsx +1 -4
- package/src/organisms/Rail.jsx +33 -1
- package/src/organisms/RailSwitcher.jsx +62 -0
- package/src/organisms/ReadingContents.jsx +65 -3
- package/src/organisms/ReadingOverview.jsx +5 -5
- package/src/organisms/ReadingPanel.jsx +1 -1
- package/src/organisms/SectionSplit.jsx +1 -1
- package/src/organisms/SettingsPanel.jsx +64 -41
- 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 +136 -45
- 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 +299 -5
- package/src/utilities/SelectionOverlay.jsx +60 -31
- package/src/utilities/kolboxGlyph.jsx +10 -0
- package/src/molecules/FloatModuleHeader.jsx +0 -11
- package/src/organisms/NavRailFloat.jsx +0 -139
|
@@ -8,7 +8,7 @@ import { Tooltip } from '../utilities/Popover.jsx'
|
|
|
8
8
|
* MenuList — THE rows of every menu (plan-2026-11-07-menu-system W1.1). `Menu`, `Dropdown` and `ContextMenu` (through
|
|
9
9
|
* `Menu`) render it inside their PopoverPanel; nothing else maps rows. It is the list only — no panel, no trigger.
|
|
10
10
|
*
|
|
11
|
-
* <MenuList
|
|
11
|
+
* <MenuList search={{ placeholder: 'Find' }} items={[
|
|
12
12
|
* { heading: 'Graph interval' }, // a MenuLabel
|
|
13
13
|
* { label: 'Days', current: true, indicator: 'dot', onClick },
|
|
14
14
|
* { divider: true }, // a MenuDivider
|
|
@@ -21,14 +21,10 @@ import { Tooltip } from '../utilities/Popover.jsx'
|
|
|
21
21
|
* · `size` · `height` · `shortcut` · `prefix` · `onPointerEnter` / `onPointerLeave` (Dropdown's rows do).
|
|
22
22
|
* search `{ placeholder, empty }` — a search field above the rows that filters them by label
|
|
23
23
|
* children sit above the rows (under the search)
|
|
24
|
-
* variant 'float' the float list's rows and flyouts · 'sheet' the More sheet's (the same rows)
|
|
25
24
|
* dividerClassName the rule's class, whole (default `kol-menu-rule` — the panel's edge-to-edge rule)
|
|
26
25
|
* headingClassName the heading's class, whole (default the MenuLabel's)
|
|
27
26
|
*/
|
|
28
27
|
|
|
29
|
-
/* `variant="float"` the list (8) · `sheet` the More sheet (20) on it */
|
|
30
|
-
export const panelClass = (variant, sheet) => (variant === 'float' ? `kol-menu-panel--float${sheet ? ' kol-menu-panel--sheet' : ''}` : '')
|
|
31
|
-
|
|
32
28
|
export const MenuLabel = ({ className = 'kol-menu-label kol-helper-12', children }) => <div className={className}>{children}</div>
|
|
33
29
|
|
|
34
30
|
const glyph = (icon, size) => (typeof icon === 'string' ? <IconLoader name={icon} size={size} /> : icon)
|
|
@@ -36,8 +32,7 @@ const glyph = (icon, size) => (typeof icon === 'string' ? <IconLoader name={icon
|
|
|
36
32
|
* `kbd` a key cap, `trailing` an icon name for an action (download) */
|
|
37
33
|
const indicatorOf = (it) => it.indicator ?? (it.checked ? 'check' : undefined)
|
|
38
34
|
|
|
39
|
-
export function MenuList({ items = [], search,
|
|
40
|
-
const float = variant === 'float' || variant === 'sheet'
|
|
35
|
+
export function MenuList({ items = [], search, dividerClassName = 'kol-menu-rule', headingClassName, children }) {
|
|
41
36
|
const [q, setQ] = useState('')
|
|
42
37
|
let rows = items
|
|
43
38
|
if (search) {
|
|
@@ -47,7 +42,7 @@ export function MenuList({ items = [], search, variant, dividerClassName = 'kol-
|
|
|
47
42
|
}
|
|
48
43
|
return (
|
|
49
44
|
<>
|
|
50
|
-
{search && <div className="pb-1"><SearchInput variant=
|
|
45
|
+
{search && <div className="pb-1"><SearchInput variant="outline" size="sm" value={q} onChange={(e) => setQ(e.target?.value ?? e)} onClear={() => setQ('')} placeholder={search.placeholder || 'Search'} /></div>}
|
|
51
46
|
{children}
|
|
52
47
|
{rows.map((it, i) => {
|
|
53
48
|
if (it.divider) return <MenuDivider key={it.key ?? `d${i}`} className={dividerClassName} />
|
|
@@ -55,9 +50,8 @@ export function MenuList({ items = [], search, variant, dividerClassName = 'kol-
|
|
|
55
50
|
const icon = it.icon && <span className="text-oq-88 inline-flex">{glyph(it.icon, 16)}</span>
|
|
56
51
|
const cls = it.rowClass ?? `kol-menu-row kol-helper-12${it.current ? ' kol-menu-row--current' : ''}${it.tone === 'danger' ? ' kol-menu-row--danger' : ''}`
|
|
57
52
|
const row = it.items?.length && !it.disabled ? (
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
<MenuList items={it.items} variant={variant} dividerClassName={dividerClassName} headingClassName={headingClassName} />
|
|
53
|
+
<MenuFlyout flyout iconLeft={icon} label={it.label} rowClass={cls} panelClassName="kol-menu-panel min-w-[200px]" panelStyle={{ marginLeft: 4 }}>
|
|
54
|
+
<MenuList items={it.items} dividerClassName={dividerClassName} headingClassName={headingClassName} />
|
|
61
55
|
</MenuFlyout>
|
|
62
56
|
) : (
|
|
63
57
|
<MenuRow href={it.href} disabled={it.disabled} rowClass={cls} onClick={it.onClick} iconLeft={icon} prefix={it.prefix}
|
package/src/molecules/Modal.jsx
CHANGED
|
@@ -1,11 +1,12 @@
|
|
|
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
|
-
import ButtonGroup from './ButtonGroup.jsx'
|
|
7
7
|
import Header from './Header.jsx'
|
|
8
8
|
import ModalShell from './ModalShell.jsx'
|
|
9
|
+
import { KolboxShell, PopoverLayer } from '../utilities/Popover.jsx'
|
|
9
10
|
|
|
10
11
|
/**
|
|
11
12
|
* Modal — promise-based prompt + confirm + alert dialogs.
|
|
@@ -61,17 +62,6 @@ import ModalShell from './ModalShell.jsx'
|
|
|
61
62
|
* `values` comes back on cancel too (the toggles as left), so a consumer can remember them either
|
|
62
63
|
* way. Without `options`, confirm still resolves a plain boolean — existing callers untouched.
|
|
63
64
|
*
|
|
64
|
-
* THE FLOAT (`variant: 'float'` on any call or on the provider, float-everything W6 rows 84 · 85 · 89 · 90, 2026-11-04 —
|
|
65
|
-
* kol-float--style 46:2795): the window on `kol-float-solid` at `--kol-float-window-r`, 24 in, 18 between its parts.
|
|
66
|
-
* A `header` (with its `icon`) draws `Header variant="modal"` over the title; the title is the heading
|
|
67
|
-
* (`kol-float-section`… at 20: Inter 500), `body` a line under it in the hint ink; fields are float Inputs, toggles float
|
|
68
|
-
* ToggleCheckboxes; the actions sit apart — the quiet cancel at the left (`tone="ghost"`), the next step at the right
|
|
69
|
-
* (`inverted`, or `danger` when `tone: 'danger'` — the destructive confirm). Still a blocking task, so the scrim
|
|
70
|
-
* stays: the scrim rule is "only when blocking", and a prompt always blocks.
|
|
71
|
-
*
|
|
72
|
-
* await confirm('Delete “Orbit field”?', { variant: 'float', header: 'Delete layer', icon: 'alert-triangle',
|
|
73
|
-
* body: 'This removes the layer and its 4 keyframes from Scene 01.', tone: 'danger', okLabel: 'Delete layer', cancelLabel: 'Keep layer' })
|
|
74
|
-
*
|
|
75
65
|
* Mounted once at the app root (BrandLayout). Renders into `document.body`
|
|
76
66
|
* via portal, so it floats above any rail / scroll-context.
|
|
77
67
|
*
|
|
@@ -88,9 +78,9 @@ import ModalShell from './ModalShell.jsx'
|
|
|
88
78
|
const ModalCtx = (globalThis[Symbol.for('@kolkrabbi/kol-component/ModalCtx')] ??= createContext(null))
|
|
89
79
|
|
|
90
80
|
/* THE MODAL VARIANTS (user 2026-10-31: *"do we not use variants for different styles?"*) live on ModalShell (W2.1,
|
|
91
|
-
* 2026-11-08) — the one panel: `lift`, `bordered
|
|
81
|
+
* 2026-11-08) — the one panel: `lift`, `bordered`. Each modal keeps its own default (prompts bordered, Dialog
|
|
92
82
|
* lift) until he picks one; an unknown name falls back to that default. */
|
|
93
|
-
const KNOWN = new Set(['lift', 'bordered'
|
|
83
|
+
const KNOWN = new Set(['lift', 'bordered'])
|
|
94
84
|
const modalVariant = (v, fallback) => (KNOWN.has(v) ? v : fallback)
|
|
95
85
|
|
|
96
86
|
export function ModalProvider({ children, variant = 'bordered', container }) {
|
|
@@ -122,7 +112,7 @@ export function ModalProvider({ children, variant = 'bordered', container }) {
|
|
|
122
112
|
return (
|
|
123
113
|
<ModalCtx.Provider value={{ prompt, confirm, alert, form }}>
|
|
124
114
|
{children}
|
|
125
|
-
{state && typeof document !== 'undefined' && createPortal(
|
|
115
|
+
{variant === 'kolbox' ? <ModalViewKolbox state={state} closeWith={closeWith} /> : state && typeof document !== 'undefined' && createPortal(
|
|
126
116
|
<ModalView state={state} closeWith={closeWith} variant={state.variant ?? variant} contained={!!container} />,
|
|
127
117
|
container ?? document.body,
|
|
128
118
|
)}
|
|
@@ -132,7 +122,6 @@ export function ModalProvider({ children, variant = 'bordered', container }) {
|
|
|
132
122
|
|
|
133
123
|
function ModalView({ state, closeWith, variant, contained }) {
|
|
134
124
|
const look = modalVariant(variant, 'bordered')
|
|
135
|
-
const float = look === 'float'
|
|
136
125
|
const [val, setVal] = useState(state.defaultValue ?? '')
|
|
137
126
|
const [values, setValues] = useState(() => Object.fromEntries((state.options ?? []).map((o) => [o.id, !!o.defaultValue])))
|
|
138
127
|
const [fieldVals, setFieldVals] = useState(() => Object.fromEntries((state.fields ?? []).map((f) => [f.id, f.defaultValue ?? ''])))
|
|
@@ -218,41 +207,32 @@ function ModalView({ state, closeWith, variant, contained }) {
|
|
|
218
207
|
aria-modal="true"
|
|
219
208
|
aria-labelledby="kol-modal-title"
|
|
220
209
|
onMouseDown={(e) => e.stopPropagation()}
|
|
221
|
-
className=
|
|
210
|
+
className="gap-4 p-5"
|
|
222
211
|
style={{
|
|
223
212
|
minWidth: 320,
|
|
224
213
|
maxWidth: contained ? '90%' : '90vw',
|
|
225
|
-
...(float ? { width: 'var(--kol-float-window-w)' } : {}),
|
|
226
214
|
}}
|
|
227
|
-
|
|
228
|
-
footer={float ? (
|
|
229
|
-
/* the float's actions sit apart: recovery quiet at the left, the next step at the right — one ButtonGroup (LAW 17) */
|
|
230
|
-
<ButtonGroup align="between">
|
|
231
|
-
{state.kind !== 'alert' ? <Button variant="float" tone="ghost" size="md" onClick={cancel}>{state.cancelLabel ?? 'Cancel'}</Button> : <span />}
|
|
232
|
-
<Button variant="float" tone={state.tone === 'danger' ? 'danger' : 'inverted'} size="md" onClick={submit} data-modal-ok>{state.okLabel ?? 'OK'}</Button>
|
|
233
|
-
</ButtonGroup>
|
|
234
|
-
) : (
|
|
215
|
+
footer={
|
|
235
216
|
<div className="flex gap-2 justify-end">
|
|
236
217
|
{state.kind !== 'alert' && <Button size="sm" onClick={cancel}>{state.cancelLabel ?? 'Cancel'}</Button>}
|
|
237
218
|
{/* inverted, not primary: since tone-is-the-ground-axis (2026-09-03) primary is the
|
|
238
219
|
* dark ground, so OK drew the same as Cancel and nothing showed what Enter does */}
|
|
239
220
|
<Button tone="inverted" size="sm" onClick={submit} data-modal-ok>{state.okLabel ?? 'OK'}</Button>
|
|
240
221
|
</div>
|
|
241
|
-
|
|
222
|
+
}
|
|
242
223
|
>
|
|
243
224
|
{/* kol-mono-12, not helper: dialog copy WRAPS, and helper's
|
|
244
225
|
* line-height 1 is single-line chrome only (type protocol). */}
|
|
245
226
|
{/* pre-line: an alert can carry a failure list, one per line */}
|
|
246
|
-
<p id="kol-modal-title" className=
|
|
247
|
-
{float && state.body && <p className="kol-float-body text-fg-64 whitespace-pre-line">{state.body}</p>}
|
|
227
|
+
<p id="kol-modal-title" className="kol-mono-12 text-emphasis whitespace-pre-line">{state.title}</p>
|
|
248
228
|
{state.kind === 'prompt' && (
|
|
249
229
|
<Input
|
|
250
230
|
ref={inputRef}
|
|
251
231
|
type={state.type}
|
|
252
232
|
autoComplete={state.type === 'password' ? 'current-password' : undefined}
|
|
253
233
|
placeholder={state.placeholder}
|
|
254
|
-
variant=
|
|
255
|
-
size=
|
|
234
|
+
variant="outline"
|
|
235
|
+
size="sm"
|
|
256
236
|
value={val}
|
|
257
237
|
onChange={(e) => setVal(e.target.value)}
|
|
258
238
|
className="w-full"
|
|
@@ -266,8 +246,8 @@ function ModalView({ state, closeWith, variant, contained }) {
|
|
|
266
246
|
autoComplete={f.autoComplete}
|
|
267
247
|
placeholder={f.placeholder}
|
|
268
248
|
aria-label={f.placeholder ?? f.id}
|
|
269
|
-
variant=
|
|
270
|
-
size=
|
|
249
|
+
variant="outline"
|
|
250
|
+
size="sm"
|
|
271
251
|
value={fieldVals[f.id]}
|
|
272
252
|
onChange={(e) => setFieldVals((v) => ({ ...v, [f.id]: e.target.value }))}
|
|
273
253
|
className="w-full"
|
|
@@ -280,7 +260,6 @@ function ModalView({ state, closeWith, variant, contained }) {
|
|
|
280
260
|
key={o.id}
|
|
281
261
|
label={o.label}
|
|
282
262
|
hint={o.hint}
|
|
283
|
-
variant={float ? 'float' : undefined}
|
|
284
263
|
checked={values[o.id]}
|
|
285
264
|
onChange={(next) => setValues((v) => ({ ...v, [o.id]: next }))}
|
|
286
265
|
/>
|
|
@@ -292,6 +271,84 @@ function ModalView({ state, closeWith, variant, contained }) {
|
|
|
292
271
|
)
|
|
293
272
|
}
|
|
294
273
|
|
|
274
|
+
|
|
275
|
+
/* ── the kolbox look (plan-2026-11-18-kolbox-system W31.2 batch 4, 2026-11-18) ──
|
|
276
|
+
* `ModalProvider variant="kolbox"`: every prompt, confirm and alert is kolbox's ModalPrompt or ModalConfirm, carried line
|
|
277
|
+
* for line, in `ModalDialog variant="kolbox"`. The calls are useModal's, KOL's words: `confirm(title, { okLabel,
|
|
278
|
+
* cancelLabel, body })`, `alert(title, { okLabel, body })` (the action alone), `prompt(title, defaultValue, { okLabel,
|
|
279
|
+
* cancelLabel, placeholder })`. The confirm: the title as its heading, `body` under it, the cancel (ghost) and the action
|
|
280
|
+
* (primary); Enter confirms unless a button has the focus (it answers for itself); Escape and the dim cancel. The prompt:
|
|
281
|
+
* one Input with the value selected; Enter submits. The provider draws its two dialogs in place (they portal
|
|
282
|
+
* themselves); `container` and a per-call `variant` are not read in this look. */
|
|
283
|
+
function ModalConfirmKolbox({ open, title, message, action = 'OK', cancel = 'Cancel', onConfirm, onCancel }) {
|
|
284
|
+
const ok = useRef(onConfirm); ok.current = onConfirm
|
|
285
|
+
useEffect(() => {
|
|
286
|
+
if (!open) return
|
|
287
|
+
const onKey = (e) => {
|
|
288
|
+
if (e.key !== 'Enter' || e.target?.closest?.('button')) return
|
|
289
|
+
e.preventDefault()
|
|
290
|
+
ok.current?.()
|
|
291
|
+
}
|
|
292
|
+
document.addEventListener('keydown', onKey)
|
|
293
|
+
return () => document.removeEventListener('keydown', onKey)
|
|
294
|
+
}, [open])
|
|
295
|
+
return (
|
|
296
|
+
<ModalDialogKolbox
|
|
297
|
+
open={open}
|
|
298
|
+
onClose={onCancel}
|
|
299
|
+
title={title}
|
|
300
|
+
footer={(
|
|
301
|
+
<>
|
|
302
|
+
{cancel != null && <Button variant="kolbox" tone="ghost" onClick={onCancel}>{cancel}</Button>}
|
|
303
|
+
<Button variant="kolbox" tone="primary" onClick={onConfirm} data-modal-ok>{action}</Button>
|
|
304
|
+
</>
|
|
305
|
+
)}
|
|
306
|
+
>
|
|
307
|
+
{message && <p className="kol-modal-body--kolbox px-4 pb-4" data-modal-confirm>{message}</p>}
|
|
308
|
+
</ModalDialogKolbox>
|
|
309
|
+
)
|
|
310
|
+
}
|
|
311
|
+
|
|
312
|
+
function ModalPromptKolbox({ open, title, label, value = '', placeholder, action = 'OK', cancel = 'Cancel', onSubmit, onCancel }) {
|
|
313
|
+
const [draft, setDraft] = useState(value)
|
|
314
|
+
const field = useRef(null)
|
|
315
|
+
/* after the dialog has moved the focus into its shell, the field takes it with the value selected */
|
|
316
|
+
useEffect(() => { if (open) { setDraft(value ?? ''); setTimeout(() => field.current?.select(), 0) } }, [open]) // eslint-disable-line react-hooks/exhaustive-deps
|
|
317
|
+
return (
|
|
318
|
+
<ModalDialogKolbox
|
|
319
|
+
open={open}
|
|
320
|
+
onClose={onCancel}
|
|
321
|
+
title={title}
|
|
322
|
+
footer={(
|
|
323
|
+
<>
|
|
324
|
+
<Button variant="kolbox" tone="ghost" onClick={onCancel}>{cancel}</Button>
|
|
325
|
+
<Button variant="kolbox" tone="primary" onClick={() => onSubmit?.(draft)} data-modal-ok>{action}</Button>
|
|
326
|
+
</>
|
|
327
|
+
)}
|
|
328
|
+
>
|
|
329
|
+
<div className="px-4 pb-4" data-modal-prompt>
|
|
330
|
+
<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)} />
|
|
331
|
+
</div>
|
|
332
|
+
</ModalDialogKolbox>
|
|
333
|
+
)
|
|
334
|
+
}
|
|
335
|
+
|
|
336
|
+
function ModalViewKolbox({ state, closeWith }) {
|
|
337
|
+
const s = state ?? {}
|
|
338
|
+
const confirming = s.kind === 'confirm' || s.kind === 'alert'
|
|
339
|
+
const answer = (ok) => (s.options ? { ok, values: Object.fromEntries(s.options.map((o) => [o.id, !!o.defaultValue])) } : ok)
|
|
340
|
+
return (
|
|
341
|
+
<>
|
|
342
|
+
<ModalPromptKolbox open={s.kind === 'prompt'} title={s.title} value={s.defaultValue} placeholder={s.placeholder}
|
|
343
|
+
action={s.okLabel} cancel={s.cancelLabel} onSubmit={(v) => closeWith(v)} onCancel={() => closeWith(null)} />
|
|
344
|
+
<ModalConfirmKolbox open={confirming} title={s.title} message={s.body} action={s.okLabel}
|
|
345
|
+
cancel={s.kind === 'alert' ? null : s.cancelLabel}
|
|
346
|
+
onConfirm={() => closeWith(s.kind === 'alert' ? undefined : answer(true))}
|
|
347
|
+
onCancel={() => closeWith(s.kind === 'alert' ? undefined : answer(false))} />
|
|
348
|
+
</>
|
|
349
|
+
)
|
|
350
|
+
}
|
|
351
|
+
|
|
295
352
|
/* Warn once, not per call — the fallback swallowing a missing ModalProvider
|
|
296
353
|
* silently is how kol-fxr ran months on native window.confirm without
|
|
297
354
|
* noticing (ModalConfirmLabels, 2026-08-12). */
|
|
@@ -332,15 +389,10 @@ export function useModal() {
|
|
|
332
389
|
*
|
|
333
390
|
* <ModalDialog open={open} onClose={() => setOpen(false)} title="Filter by page" width={560}>…</ModalDialog>
|
|
334
391
|
*
|
|
335
|
-
* `
|
|
336
|
-
* `
|
|
337
|
-
*
|
|
338
|
-
*
|
|
339
|
-
* scrim: a blocking task dims the scene, a utility window does not (row 89) — `blocking={false}` drops the scrim and the
|
|
340
|
-
* press-outside close and leaves the scene live (QuickLookFrame float is the utility window proper).
|
|
341
|
-
* @param {'lift'|'bordered'|'float'} [variant='lift']
|
|
342
|
-
* @param {string} [icon] float: the header's glyph
|
|
343
|
-
* @param {Function} [onMinimise] float: the − control
|
|
392
|
+
* `blocking` (default true) keeps the scrim: a blocking task dims the scene, a utility window does not —
|
|
393
|
+
* `blocking={false}` drops the scrim and the press-outside close and leaves the scene live.
|
|
394
|
+
* @param {'lift'|'bordered'|'kolbox'|'folio'} [variant='lift'] `kolbox` (W31.2 batch 4): kolbox's Modal, see `ModalDialogKolbox`;
|
|
395
|
+
* `folio` (Folio migration batch B): Folio's dialog, `title`, `width` (720), `children`, see `ModalDialogFolio`
|
|
344
396
|
* @param {boolean} [blocking=true]
|
|
345
397
|
* @param {Element} [container] the portal target instead of `<body>` (float-operational W2, 2026-11-04): the layer turns
|
|
346
398
|
* `absolute` and fills it — a specimen box (`position: relative`, a height) shows the window open in place. Unset, unchanged.
|
|
@@ -360,10 +412,132 @@ export function useModal() {
|
|
|
360
412
|
* @param {Array} [sections] settings: `[{ key, label, state }]`
|
|
361
413
|
* @param {string} [section] · @param {Function} [onSection]
|
|
362
414
|
* @param {ReactNode} [aside] · @param {ReactNode} [footer] · @param {number} [height=656]
|
|
415
|
+
* @param {string} [sectionsLabel='Settings'] settings: the section list's title (the generator calls its list Steps, W23.3)
|
|
416
|
+
* @param {string} [movable] settings · kolbox: a key; the window drags by its header (see `useMovable`)
|
|
417
|
+
* @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
|
|
363
418
|
*/
|
|
364
|
-
|
|
419
|
+
/* `variant="kolbox"` (W31.2 batch 4): kolbox's Modal carried line for line: the kolbox panel shell (`ModalShell
|
|
420
|
+
* variant="kolbox"`) centred on the dim (fg-ab-24), 480 wide (`--kol-kolbox-modal-w`) unless `width` (any CSS length)
|
|
421
|
+
* says otherwise. Escape (the last layer's) and a click on the dim close it. `blocking={false}`: a window over a live
|
|
422
|
+
* 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
|
|
423
|
+
* to whatever held it on close. The shell's `title`, `leading`, `actions`, `footer` and `aria-label` pass through;
|
|
424
|
+
* `className` reaches the dialog beside its own. */
|
|
425
|
+
/* 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
|
|
426
|
+
* of the way"): `movable` (a key, e.g. "generator") lets a press on the window's header, outside its controls, drag it.
|
|
427
|
+
* It can be moved out of the way, never lost: its header stays on screen top to bottom, its left edge (the title,
|
|
428
|
+
* 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
|
|
429
|
+
* always be grabbed back. Once moved it is fixed at its own left and top, so a
|
|
430
|
+
* change of content never re-centres it, and its place is kept per key while the app is open. Only the kolbox and
|
|
431
|
+
* settings variants take it; unset, nothing changes. */
|
|
432
|
+
const SPOTS = new Map()
|
|
433
|
+
const NO_DRAG = 'button, input, select, textarea, a, [role="button"], [role="combobox"], [role="tab"], [role="switch"], [contenteditable="true"], [data-no-drag]'
|
|
434
|
+
const KEEP = 160
|
|
435
|
+
function useMovable(key, ref, place) {
|
|
436
|
+
const [at, setAt] = useState(() => (key ? SPOTS.get(key) ?? null : null))
|
|
437
|
+
/* `place` (kolbox): where the window opens until it is moved, kept whole on screen (8 from each edge) */
|
|
438
|
+
const [placed, setPlaced] = useState(null)
|
|
439
|
+
useLayoutEffect(() => {
|
|
440
|
+
const el = ref.current
|
|
441
|
+
if (!place || at || !el) return
|
|
442
|
+
const m = 8
|
|
443
|
+
const x = place.x ?? place.right - el.offsetWidth
|
|
444
|
+
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)) })
|
|
445
|
+
}, [place?.x, place?.right, place?.y]) // eslint-disable-line react-hooks/exhaustive-deps
|
|
446
|
+
const moved = useRef(false)
|
|
447
|
+
const fit = (x, y, w) => {
|
|
448
|
+
const hh = ref.current?.firstElementChild?.offsetHeight ?? 0
|
|
449
|
+
return { x: Math.max(0, Math.min(x, window.innerWidth - KEEP)), y: Math.max(0, Math.min(y, window.innerHeight - hh)) }
|
|
450
|
+
}
|
|
451
|
+
useEffect(() => { if (key && at) SPOTS.set(key, at) }, [key, at])
|
|
452
|
+
useEffect(() => {
|
|
453
|
+
if (!key) return undefined
|
|
454
|
+
const onResize = () => setAt((a) => { const el = ref.current; return a && el ? fit(a.x, a.y, el.offsetWidth) : a })
|
|
455
|
+
window.addEventListener('resize', onResize)
|
|
456
|
+
return () => window.removeEventListener('resize', onResize)
|
|
457
|
+
}, [key]) // eslint-disable-line react-hooks/exhaustive-deps
|
|
458
|
+
const onPointerDown = (e) => {
|
|
459
|
+
const el = ref.current, head = el?.firstElementChild
|
|
460
|
+
if (!key || e.button !== 0 || !head?.contains(e.target) || e.target.closest(NO_DRAG)) return
|
|
461
|
+
e.preventDefault()
|
|
462
|
+
const r = el.getBoundingClientRect(), sx = e.clientX, sy = e.clientY
|
|
463
|
+
const move = (ev) => {
|
|
464
|
+
const p = fit(r.left + ev.clientX - sx, r.top + ev.clientY - sy, r.width)
|
|
465
|
+
if (p.x !== r.left || p.y !== r.top) moved.current = true
|
|
466
|
+
setAt(p)
|
|
467
|
+
}
|
|
468
|
+
const up = () => {
|
|
469
|
+
window.removeEventListener('pointermove', move)
|
|
470
|
+
window.removeEventListener('pointerup', up)
|
|
471
|
+
window.removeEventListener('pointercancel', up)
|
|
472
|
+
/* the click a drag's release raises on the dim is not a press outside */
|
|
473
|
+
setTimeout(() => { moved.current = false })
|
|
474
|
+
}
|
|
475
|
+
window.addEventListener('pointermove', move)
|
|
476
|
+
window.addEventListener('pointerup', up)
|
|
477
|
+
window.addEventListener('pointercancel', up)
|
|
478
|
+
}
|
|
479
|
+
const spot = at ?? placed
|
|
480
|
+
return {
|
|
481
|
+
style: spot ? { position: 'fixed', left: spot.x, top: spot.y, margin: 0 } : null,
|
|
482
|
+
onPointerDown: key ? onPointerDown : undefined,
|
|
483
|
+
handle: key ? '[&>header]:cursor-grab [&>header]:active:cursor-grabbing' : '',
|
|
484
|
+
dragged: () => moved.current,
|
|
485
|
+
}
|
|
486
|
+
}
|
|
487
|
+
|
|
488
|
+
function ModalDialogKolbox({ open, onClose, width = 'var(--kol-kolbox-modal-w)', className = '', variant, movable, blocking = true, place, ...shell }) {
|
|
489
|
+
const ref = useRef(null)
|
|
490
|
+
const mv = useMovable(movable, ref, place)
|
|
491
|
+
useEffect(() => {
|
|
492
|
+
if (!open) return
|
|
493
|
+
const back = document.activeElement
|
|
494
|
+
ref.current?.focus({ preventScroll: true })
|
|
495
|
+
return () => back?.focus?.({ preventScroll: true })
|
|
496
|
+
}, [open])
|
|
497
|
+
const close = () => { if (!mv.dragged()) onClose?.() }
|
|
498
|
+
return (
|
|
499
|
+
<PopoverLayer open={open} onClose={close} placement="center" kind="modal" blocking={blocking}>
|
|
500
|
+
<KolboxShell ref={ref} tabIndex={-1} aria-modal={blocking ? 'true' : undefined} onClose={onClose} width={width} className={`outline-none ${mv.handle} ${className}`}
|
|
501
|
+
{...shell} style={mv.style ? { width, ...mv.style } : { width }} onPointerDown={mv.onPointerDown} />
|
|
502
|
+
</PopoverLayer>
|
|
503
|
+
)
|
|
504
|
+
}
|
|
505
|
+
|
|
506
|
+
/* `variant="folio"` (Folio migration batch B, 2026-11-22): Folio's New overlay carried class for class (kol-theme
|
|
507
|
+
* `.kol-modal-dialog--folio`): `ModalShell variant="folio"` 14% down on the Folio dim, `width` wide (720) and never wider
|
|
508
|
+
* than the window, a 64 header (the title, the 32 ×) over a rule, then `children`. Drawn in place, never portalled, so
|
|
509
|
+
* it keeps the frame's `data-folio-*`. Escape and a press on the dim close it. */
|
|
510
|
+
function ModalDialogFolio({ open, onClose, title, width = 720, children }) {
|
|
511
|
+
useEffect(() => {
|
|
512
|
+
if (!open) return undefined
|
|
513
|
+
const esc = (e) => e.key === 'Escape' && onClose?.()
|
|
514
|
+
addEventListener('keydown', esc)
|
|
515
|
+
return () => removeEventListener('keydown', esc)
|
|
516
|
+
}, [open, onClose])
|
|
517
|
+
if (!open) return null
|
|
518
|
+
return (
|
|
519
|
+
<div className="kol-modal-dim--folio fixed inset-0 z-50 flex items-start justify-center px-[16px] pt-[14vh]" onMouseDown={onClose}>
|
|
520
|
+
<ModalShell variant="folio" role="dialog" aria-label={title} onMouseDown={(e) => e.stopPropagation()} className="kol-modal-dialog--folio max-w-full" style={{ width }}>
|
|
521
|
+
<div className="kol-modal-head--folio flex h-[64px] items-center justify-between border-b pl-[24px] pr-[16px]">
|
|
522
|
+
<p className="kol-modal-title--folio">{title}</p>
|
|
523
|
+
<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>
|
|
524
|
+
</div>
|
|
525
|
+
{children}
|
|
526
|
+
</ModalShell>
|
|
527
|
+
</div>
|
|
528
|
+
)
|
|
529
|
+
}
|
|
530
|
+
|
|
531
|
+
export function ModalDialog(props) {
|
|
532
|
+
if (props.variant === 'kolbox') return <ModalDialogKolbox {...props} />
|
|
533
|
+
if (props.variant === 'folio') return <ModalDialogFolio {...props} />
|
|
534
|
+
return <ModalDialogOn {...props} />
|
|
535
|
+
}
|
|
536
|
+
|
|
537
|
+
function ModalDialogOn({ open, onClose, title, width, variant = 'lift', blocking = true, container, kind, headerEnd, sections, section, onSection, aside, footer, height = 656, movable, sectionsLabel = 'Settings', children }) {
|
|
365
538
|
const look = variant === 'settings' ? 'settings' : modalVariant(variant, 'lift')
|
|
366
|
-
const
|
|
539
|
+
const shellRef = useRef(null)
|
|
540
|
+
const mv = useMovable(variant === 'settings' && !container ? movable : undefined, shellRef)
|
|
367
541
|
useEffect(() => {
|
|
368
542
|
if (!open) return undefined
|
|
369
543
|
const onKey = (e) => { if (e.key === 'Escape' && !document.querySelector('.kol-popover-float, [data-state="open"].kol-dd-trigger')) onClose() }
|
|
@@ -377,15 +551,16 @@ export function ModalDialog({ open, onClose, title, width, variant = 'lift', ico
|
|
|
377
551
|
return createPortal(
|
|
378
552
|
<div onMouseDown={blocking ? onClose : undefined} className={blocking ? 'kol-overlay-scrim' : 'pointer-events-none'}
|
|
379
553
|
style={{ position: container ? 'absolute' : 'fixed', inset: 0, zIndex: 150, display: 'flex', alignItems: 'center', justifyContent: 'center' }}>
|
|
380
|
-
<ModalShell variant="settings" role="dialog" aria-modal={blocking ? 'true' : undefined} aria-label={title} data-dialog onMouseDown={(e) => e.stopPropagation()}
|
|
381
|
-
|
|
382
|
-
|
|
554
|
+
<ModalShell ref={shellRef} variant="settings" role="dialog" aria-modal={blocking ? 'true' : undefined} aria-label={title} data-dialog onMouseDown={(e) => e.stopPropagation()}
|
|
555
|
+
onPointerDown={mv.onPointerDown}
|
|
556
|
+
className={`kol-settings-window pointer-events-auto overflow-hidden ${mv.handle}`.trim()}
|
|
557
|
+
style={{ width: `min(${width ?? 880}px, calc(${within} - 32px))`, height: `min(${height}px, calc(${withinH} - 32px))`, ...mv.style }}
|
|
383
558
|
header={<Header variant="settings" title={title} kind={kind} end={headerEnd} onClose={onClose} />}
|
|
384
559
|
footer={footer && <footer className="flex items-center gap-3 h-[60px] shrink-0 px-6 border-t border-oq-16">{footer}</footer>}>
|
|
385
560
|
<div className="flex flex-1 min-h-0">
|
|
386
561
|
{sections?.length > 0 && (
|
|
387
|
-
<nav aria-label=
|
|
388
|
-
<p className="pl-[10px] pb-[14px] text-[9px] font-medium leading-[11px] uppercase text-oq-64">
|
|
562
|
+
<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">
|
|
563
|
+
<p className="pl-[10px] pb-[14px] text-[9px] font-medium leading-[11px] uppercase text-oq-64">{sectionsLabel}</p>
|
|
389
564
|
<div role="tablist" aria-orientation="vertical" className="flex flex-col gap-1.5"
|
|
390
565
|
onKeyDown={(e) => {
|
|
391
566
|
const dir = { ArrowDown: 1, ArrowUp: -1 }[e.key]
|
|
@@ -435,10 +610,8 @@ export function ModalDialog({ open, onClose, title, width, variant = 'lift', ico
|
|
|
435
610
|
/* THE OVERLAY PANEL (MetricRebuild, 2026-10-31 — user: the filter dialog read as "a borderless box floating
|
|
436
611
|
* mid-page"): it painted the page's own surface behind an fg-08 hairline, so on a dark page it was the page.
|
|
437
612
|
* `.kol-overlay-panel` is the lift every KOL overlay wears (oq-04, no border — the scrim is the edge). */
|
|
438
|
-
className={
|
|
439
|
-
|
|
440
|
-
style={{ width: `min(${width != null ? `${width}px` : float ? 'var(--kol-float-window-w)' : '560px'}, calc(${container ? '100%' : '100vw'} - 32px))` }}
|
|
441
|
-
header={float && title && <Header variant="modal" icon={icon} title={title} onMinimise={onMinimise} onClose={onClose} />}
|
|
613
|
+
className={`${container ? 'max-h-[85%]' : 'max-h-[85vh]'}${blocking ? '' : ' pointer-events-auto'}`}
|
|
614
|
+
style={{ width: `min(${width != null ? `${width}px` : '560px'}, calc(${container ? '100%' : '100vw'} - 32px))` }}
|
|
442
615
|
>
|
|
443
616
|
{children}
|
|
444
617
|
</ModalShell>
|
|
@@ -1,13 +1,12 @@
|
|
|
1
1
|
import Button from '../atoms/Button.jsx'
|
|
2
2
|
import Avatar from '../atoms/Avatar.jsx'
|
|
3
3
|
import CloseButton from './CloseButton.jsx'
|
|
4
|
-
import Header from './Header.jsx'
|
|
5
4
|
import { IconLoader } from '@kolkrabbi/kol-icons'
|
|
6
5
|
|
|
7
|
-
/* 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
|
+
/* 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) */
|
|
8
7
|
|
|
9
|
-
/* class-for-class MenuFloatRows' avatar row (menu-system W4.1, 2026-11-07): the nav Button's lg row
|
|
10
|
-
const ROW =
|
|
8
|
+
/* class-for-class MenuFloatRows' avatar row (menu-system W4.1, 2026-11-07): the nav Button's lg row */
|
|
9
|
+
const ROW = 'w-full justify-start h-11 gap-3'
|
|
11
10
|
/* the classes Button emits for `variant="nav" size="lg"` — the static header draws the same row without the press */
|
|
12
11
|
const NAV_LG = 'kol-btn kol-btn-nav kol-btn-lg kol-mono-16'
|
|
13
12
|
const isSrc = (a) => /[/.:]/.test(a)
|
|
@@ -15,38 +14,31 @@ const isSrc = (a) => /[/.:]/.test(a)
|
|
|
15
14
|
const WINDOW = ['meta', 'nav', 'onMinimise', 'onClose']
|
|
16
15
|
|
|
17
16
|
/**
|
|
18
|
-
* ModalHeader — The top row of every
|
|
19
|
-
* User 2026-11-07: *"why not just modalheader?"*; 2026-11-08
|
|
17
|
+
* ModalHeader — The top row of every sheet and modal: two rows.
|
|
18
|
+
* User 2026-11-07: *"why not just modalheader?"*; 2026-11-08 — the
|
|
20
19
|
* window row that was QuickLookHeader folded in, class for class (QuickLookHeader is its deprecated alias).
|
|
21
20
|
*
|
|
22
21
|
* THE MENU ROW (MenuFloatRows' account row, PanelsMenu's title) — an avatar or a glyph, the title, trailing `actions`. With
|
|
23
22
|
* `onClick` the row is the pressable nav Button; without, the same row as a heading that takes no press. Drawn when
|
|
24
23
|
* `avatar` or `onClick` is set, or when no window control is passed.
|
|
25
24
|
*
|
|
26
|
-
* THE WINDOW ROW (
|
|
27
|
-
* `onClose` is passed
|
|
28
|
-
* Default: ‹ › n / N · the file's name · its facts · the actions · the close, on
|
|
29
|
-
* `.kol-quicklook-header`. Float (kol-float--style 46:2500): the window's glyph (16, oq-64) · its title in
|
|
30
|
-
* `kol-float-panel` (Inter 13/500) · − minimise · × close, 12 apart, the controls quiet on oq-64 and bright under the
|
|
31
|
-
* pointer. No rule under it — the no-borders law holds on float.
|
|
25
|
+
* THE WINDOW ROW (QuickLookFrame) — drawn when `meta`, `nav`, `onMinimise` or
|
|
26
|
+
* `onClose` is passed: ‹ › n / N · the file's name · its facts · the actions · the close, on `.kol-quicklook-header`.
|
|
32
27
|
*
|
|
33
28
|
* @param {ReactNode} title
|
|
34
|
-
* @param {'float'|'default'} [variant='default']
|
|
35
29
|
* @param {string|ReactNode} [avatar] menu row: a picture url, initials, or a node drawn as is
|
|
36
|
-
* @param {string} [icon] a kol-icons name — the menu row's lead when there is no avatar
|
|
30
|
+
* @param {string} [icon] a kol-icons name — the menu row's lead when there is no avatar
|
|
37
31
|
* @param {ReactNode} [actions] trailing controls (before the close on the window row)
|
|
38
32
|
* @param {Function} [onClick] menu row: makes the row a press (the account row)
|
|
39
33
|
* @param {ReactNode} [meta] window, default look: the facts after the name
|
|
40
34
|
* @param {Object} [nav] window, default look: `{ index, total, onPrev, onNext }`
|
|
41
|
-
* @param {Function} [onMinimise] window
|
|
35
|
+
* @param {Function} [onMinimise] window: shows the − control
|
|
42
36
|
* @param {Function} [onClose] window: shows the × control
|
|
43
37
|
* @param {string} [className]
|
|
44
38
|
*/
|
|
45
39
|
export default function ModalHeader(props) {
|
|
46
|
-
const { title, avatar, icon, actions,
|
|
47
|
-
const float = variant === 'float'
|
|
40
|
+
const { title, avatar, icon, actions, onClick, meta, nav, onMinimise, onClose, className = '' } = props
|
|
48
41
|
if (avatar == null && !onClick && WINDOW.some((k) => k in props)) {
|
|
49
|
-
if (float) return <Header variant="modal" icon={icon} title={title} end={actions} onMinimise={onMinimise} onClose={onClose} className={className} />
|
|
50
42
|
return (
|
|
51
43
|
<div className={`kol-quicklook-header ${className}`.trim()}>
|
|
52
44
|
{nav?.total > 1 && (
|
|
@@ -69,10 +61,10 @@ export default function ModalHeader(props) {
|
|
|
69
61
|
</div>
|
|
70
62
|
)
|
|
71
63
|
}
|
|
72
|
-
const cls = `${ROW
|
|
64
|
+
const cls = `${ROW} ${className}`.trim()
|
|
73
65
|
const lead = avatar != null
|
|
74
66
|
? (typeof avatar === 'string' ? <Avatar {...(isSrc(avatar) ? { src: avatar } : { initial: avatar })} alt="" size="xs" /> : avatar)
|
|
75
|
-
: icon && <IconLoader name={icon} size={
|
|
67
|
+
: icon && <IconLoader name={icon} size={22} />
|
|
76
68
|
const body = <>{lead}{actions ? <span className="flex-1 text-left">{title}</span> : title}{actions && <span className="ml-auto flex shrink-0 items-center pointer-events-auto">{actions}</span>}</>
|
|
77
69
|
if (onClick) return <Button variant="nav" size="lg" className={cls} onClick={onClick}>{body}</Button>
|
|
78
70
|
return <div role="heading" aria-level={2} className={`${NAV_LG} ${cls} cursor-default pointer-events-none`}>{body}</div>
|
|
@@ -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,18 @@ import { forwardRef } from 'react'
|
|
|
13
14
|
* …body
|
|
14
15
|
* </ModalShell>
|
|
15
16
|
*
|
|
16
|
-
* ONE RADIUS: `--kol-radius-
|
|
17
|
-
*
|
|
18
|
-
* own, drawn in its Figma.
|
|
17
|
+
* ONE RADIUS: `--kol-radius-4` (4px) — the radius Modal's prompts and Dialog wore. The generator settings window keeps
|
|
18
|
+
* its 20 (`settings`, no outer border — his mock 143:35343, plan-2026-11-12-one-header W8.1).
|
|
19
19
|
*
|
|
20
|
-
* @param {'lift'|'bordered'|'
|
|
20
|
+
* @param {'lift'|'bordered'|'settings'|'kolbox'|'folio'} [variant='lift']
|
|
21
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); `
|
|
23
|
-
* (
|
|
22
|
+
* `bordered` — the page surface behind an fg-08 hairline (Modal's prompts); `settings` — the generator settings window (the secondary surface, radius 20, the float shadow, no border).
|
|
23
|
+
* `kolbox` (plan-2026-11-18-kolbox-system W31.2 batch 4, 2026-11-18) — kolbox's panel shell (its PopoverShell, carried
|
|
24
|
+
* line for line): radius 16, the secondary surface on the one floating surface, 240 wide (`--kol-kolbox-popover-w`)
|
|
25
|
+
* unless `width` says; it draws its own header from `leading`, `title`, `actions` and the close (`onClose`), the body,
|
|
26
|
+
* and `footer` as a row of buttons; `aria-label` defaults to the title. The panel every kolbox popover and window is.
|
|
27
|
+
* `folio` (Folio migration batch B, 2026-11-22) — Folio's overlay panel: `bordered`'s hairline and radius 4 on Folio's
|
|
28
|
+
* paper and rule (`.kol-modal--folio`); its ink and shadow are the caller's (the search modal's, the dialog's).
|
|
24
29
|
* @param {ReactNode} [header] drawn first
|
|
25
30
|
* @param {ReactNode} [footer] drawn last
|
|
26
31
|
* @param {string} [className] the caller's layout: padding, gap, size
|
|
@@ -28,13 +33,18 @@ import { forwardRef } from 'react'
|
|
|
28
33
|
* Any other prop (role, aria-*, onMouseDown, data-*) lands on the panel; the ref is the panel.
|
|
29
34
|
*/
|
|
30
35
|
const VARIANTS = {
|
|
31
|
-
lift: { className: 'kol-overlay-panel rounded-[var(--kol-radius-
|
|
32
|
-
bordered: { className: 'border border-fg-08 rounded-[var(--kol-radius-
|
|
33
|
-
|
|
36
|
+
lift: { className: 'kol-overlay-panel rounded-[var(--kol-radius-4)]', style: {} },
|
|
37
|
+
bordered: { className: 'border border-fg-08 rounded-[var(--kol-radius-4)]', style: { background: 'var(--kol-surface-primary)', color: 'var(--kol-surface-on-primary)' } },
|
|
38
|
+
folio: { className: 'kol-modal--folio border rounded-[var(--kol-radius-4)]', style: {} },
|
|
34
39
|
settings: { className: 'rounded-[20px] bg-surface-secondary text-fg-96 font-(family-name:--kol-font-family-float) shadow-[var(--kol-shadow-float)]', style: {} },
|
|
35
40
|
}
|
|
36
41
|
|
|
37
|
-
const ModalShell = forwardRef(function ModalShell(
|
|
42
|
+
const ModalShell = forwardRef(function ModalShell(props, ref) {
|
|
43
|
+
if (props.variant === 'kolbox') {
|
|
44
|
+
const { variant, ...shell } = props
|
|
45
|
+
return <KolboxShell ref={ref} {...shell} />
|
|
46
|
+
}
|
|
47
|
+
const { variant = 'lift', header, footer, className = '', style, children, ...rest } = props
|
|
38
48
|
const look = VARIANTS[variant] ?? VARIANTS.lift
|
|
39
49
|
return (
|
|
40
50
|
<div ref={ref} {...rest} className={`kol-modal flex flex-col ${look.className} ${className}`.trim()} style={{ ...look.style, ...style }}>
|
|
@@ -22,7 +22,7 @@ export default function NoticeBanner({ title, body, action, onAction, className
|
|
|
22
22
|
<span className="kol-float-hint truncate text-fg-emphasis">{title}</span>
|
|
23
23
|
{body && <span className="kol-float-label truncate text-fg-64">{body}</span>}
|
|
24
24
|
</span>
|
|
25
|
-
{action && <Button
|
|
25
|
+
{action && <Button tone="secondary" size="md" className="shrink-0" onClick={onAction}>{action}</Button>}
|
|
26
26
|
</div>
|
|
27
27
|
)
|
|
28
28
|
}
|
|
@@ -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 */}
|