@kolkrabbi/kol-component 0.375.0 → 0.377.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 +3 -3
- package/src/atoms/ToggleSwitch.jsx +10 -0
- package/src/index.js +9 -1
- package/src/molecules/ButtonGroup.jsx +5 -1
- package/src/molecules/ButtonSplit.jsx +63 -0
- package/src/molecules/Header.jsx +96 -0
- package/src/molecules/MenuFloat.jsx +164 -0
- package/src/molecules/Modal.jsx +18 -26
- package/src/molecules/ModalHeader.jsx +5 -14
- package/src/molecules/QuickLookFrame.jsx +4 -3
- package/src/molecules/RailFloat.jsx +30 -23
- package/src/molecules/RailHeader.jsx +10 -33
- package/src/molecules/SettingsControls.jsx +100 -155
- package/src/molecules/Slider.jsx +32 -8
- package/src/organisms/NavRailFloat.jsx +9 -14
- package/src/organisms/ReadingContents.jsx +1 -1
- package/src/organisms/ReadingPanel.jsx +8 -9
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@kolkrabbi/kol-component",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.377.0",
|
|
4
4
|
"description": "The core component library",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"type": "module",
|
|
@@ -32,9 +32,9 @@
|
|
|
32
32
|
"embla-carousel-react": "^8.6.0",
|
|
33
33
|
"pdfjs-dist": "^6.3.289",
|
|
34
34
|
"react-syntax-highlighter": "^16.1.1",
|
|
35
|
+
"@kolkrabbi/kol-markdown": "^0.2.0",
|
|
35
36
|
"@kolkrabbi/kol-search": "^0.3.0",
|
|
36
|
-
"@kolkrabbi/kol-growth": "^0.5.0"
|
|
37
|
-
"@kolkrabbi/kol-markdown": "^0.2.0"
|
|
37
|
+
"@kolkrabbi/kol-growth": "^0.5.0"
|
|
38
38
|
},
|
|
39
39
|
"peerDependencies": {
|
|
40
40
|
"@kolkrabbi/kol-icons": ">=0.69.0",
|
|
@@ -14,6 +14,10 @@ import React from 'react'
|
|
|
14
14
|
* (22/26/32/40); the track scales with size in all variants. xs is the
|
|
15
15
|
* panel rung (2026-09-01).
|
|
16
16
|
*
|
|
17
|
+
* `label` (and its `hint`) is DEPRECATED 2026-11-12 (plan-2026-11-12-one-header W6.1, LAW 17 — the user: *"illegal
|
|
18
|
+
* toggleswitch that has LABEL!! no toggle with label is LABELEDCONTROL"*): a switch is the bare control; its words are a
|
|
19
|
+
* `LabeledControl` (`horizontal`) around it. It still draws, and warns once in dev.
|
|
20
|
+
*
|
|
17
21
|
* Legacy aliases: 'plain' → bare · 'default' (the old boxed look) → outline.
|
|
18
22
|
* Type via kol-mono-{12,14,16}; no auto-uppercase — casing is authored at
|
|
19
23
|
* the call site (KOL no-auto-casing rule).
|
|
@@ -21,6 +25,7 @@ import React from 'react'
|
|
|
21
25
|
|
|
22
26
|
const SIZE_TYPE = { xs: 'kol-mono-8', sm: 'kol-mono-12', md: 'kol-mono-14', lg: 'kol-mono-16' }
|
|
23
27
|
const LEGACY_VARIANTS = { plain: 'bare', default: 'outline' }
|
|
28
|
+
let warnedLabel = false
|
|
24
29
|
|
|
25
30
|
const ToggleSwitch = ({
|
|
26
31
|
label,
|
|
@@ -38,6 +43,11 @@ const ToggleSwitch = ({
|
|
|
38
43
|
if (onChange) onChange(!checked)
|
|
39
44
|
}
|
|
40
45
|
|
|
46
|
+
if (import.meta.env?.DEV && (label != null || hint != null) && !warnedLabel) {
|
|
47
|
+
warnedLabel = true
|
|
48
|
+
console.warn('ToggleSwitch: `label` is deprecated — wrap the switch in <LabeledControl horizontal label="…">')
|
|
49
|
+
}
|
|
50
|
+
|
|
41
51
|
const resolvedVariant = LEGACY_VARIANTS[variant] || variant
|
|
42
52
|
const float = resolvedVariant === 'float'
|
|
43
53
|
|
package/src/index.js
CHANGED
|
@@ -182,7 +182,8 @@ export { Menu, MenuTrigger, MenuPanel, MenuLabel, MenuFilter, MenuDatePicker, Me
|
|
|
182
182
|
export { MenuList } from './molecules/MenuList.jsx'
|
|
183
183
|
export { ModalProvider, useModal, ModalDialog, ModalDialog as Dialog } from './molecules/Modal.jsx'
|
|
184
184
|
export { default as ModalShell } from './molecules/ModalShell.jsx'
|
|
185
|
-
/* the generator settings window's
|
|
185
|
+
/* the generator settings window's composite parts (plan-2026-11-05-float-editor W7.2); SettingsCell · SettingsSlider · SettingsRange ·
|
|
186
|
+
* SettingsSelect · SettingsSegmented · SettingsToggle · SettingsText are deprecated aliases of their bases (plan-2026-11-12-one-header W6.1) */
|
|
186
187
|
export {
|
|
187
188
|
SettingsGrid, SettingsCell, SettingsSlider, SettingsRange, SettingsSelect, SettingsSegmented, SettingsToggle,
|
|
188
189
|
SettingsText, SettingsPoint, SettingsRamp, SettingsRampHead, SettingsLights, SettingsFieldMap,
|
|
@@ -287,6 +288,13 @@ export { default as SettingsSections } from './organisms/SettingsSections.jsx'
|
|
|
287
288
|
* LabeledControlSection and SettingsRow. @deprecated 2026-11-08: the RailSection / RailRow aliases below are retired by
|
|
288
289
|
* the user's ruling ("I always called it labeledControl and LabeledControlSection… I never approved the rename") */
|
|
289
290
|
export { default as RailHeader } from './molecules/RailHeader.jsx'
|
|
291
|
+
/* Header — the one header, variant nav · property · modal · settings (plan-2026-11-12-one-header W1.1) */
|
|
292
|
+
export { default as Header } from './molecules/Header.jsx'
|
|
293
|
+
/* ButtonSplit — the main action, a divider and a ⌄ menu (plan-2026-11-12-one-header W4.1) */
|
|
294
|
+
export { default as ButtonSplit } from './molecules/ButtonSplit.jsx'
|
|
295
|
+
/* MenuFloat + MenuFloatRows — the float menu card and its rows, moved from kol-shell 2026-11-12 so ButtonSplit's float menu
|
|
296
|
+
* is the same menu (plan-2026-11-12-one-header W6.1); kol-shell re-exports both */
|
|
297
|
+
export { default as MenuFloatRows, MenuFloat } from './molecules/MenuFloat.jsx'
|
|
290
298
|
export { RailTabs, RailHint, RailActions, RailFoot, RailNav } from './organisms/RailKit.jsx'
|
|
291
299
|
export { LabeledControlSection as RailSection, SettingsRow as RailRow } from './organisms/SettingsPanel.jsx'
|
|
292
300
|
export { default as SectionNewsletter } from './organisms/SectionNewsletter.jsx'
|
|
@@ -15,7 +15,9 @@
|
|
|
15
15
|
* ledger): joined cells, no gap, built from `options` instead of children. See below.
|
|
16
16
|
*
|
|
17
17
|
* row / stack props:
|
|
18
|
-
* @param {'left'|'center'|'right'} align horizontal alignment + container layout mode (default 'center')
|
|
18
|
+
* @param {'left'|'center'|'right'|'between'} align horizontal alignment + container layout mode (default 'center'); `between`
|
|
19
|
+
* (2026-11-12, plan-2026-11-12-one-header W6.1) sets the first button at the left and the last at the right — a float
|
|
20
|
+
* window's Cancel · Export row
|
|
19
21
|
* @param {string} title optional heading rendered above the group, authored at the call site
|
|
20
22
|
* @param {string} className extra container classes (appended) — note this lands on the OUTER
|
|
21
23
|
* container, not the flex row that carries the gap; the gap is responsive by default (8 stacked,
|
|
@@ -95,12 +97,14 @@ const CONTAINER = {
|
|
|
95
97
|
left: 'flex flex-col w-full',
|
|
96
98
|
center: 'flex sm:inline-flex flex-col w-full sm:w-auto sm:mx-auto',
|
|
97
99
|
right: 'flex flex-col w-full',
|
|
100
|
+
between: 'flex flex-col w-full',
|
|
98
101
|
}
|
|
99
102
|
|
|
100
103
|
const JUSTIFY = {
|
|
101
104
|
left: 'sm:justify-start',
|
|
102
105
|
center: 'sm:justify-center',
|
|
103
106
|
right: 'sm:justify-end',
|
|
107
|
+
between: 'sm:justify-between',
|
|
104
108
|
}
|
|
105
109
|
|
|
106
110
|
export default function ButtonGroup({ layout = 'row', align = 'center', title, className = '', children, ...joined }) {
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
import { useState } from 'react'
|
|
2
|
+
import Button from '../atoms/Button.jsx'
|
|
3
|
+
import { PopoverPanel, usePopover } from '../utilities/Popover.jsx'
|
|
4
|
+
import { floatSurfaceClass } from '../utilities/tone.js'
|
|
5
|
+
import MenuFloatRows from './MenuFloat.jsx'
|
|
6
|
+
|
|
7
|
+
/* taxonomy-ok: molecule — two Buttons (atoms) and a divider, the ⌄ opening a PopoverPanel (utility) of rows (MenuFloatRows on a float) */
|
|
8
|
+
|
|
9
|
+
/**
|
|
10
|
+
* ButtonSplit — the main action, a 1px divider and a ⌄ that opens a menu of the other actions (plan-2026-11-12-one-header
|
|
11
|
+
* W4.1; the user: *"its basically 4 exports and 1 open, isnt that just 2 buttons with menufloat?"*). One shape, two looks:
|
|
12
|
+
*
|
|
13
|
+
* default the app's square Buttons at `size`, the menu a plain list (SplitToolButton's rows)
|
|
14
|
+
* float the float capsule (`variant="float"`, sm), the menu on the float sheet (`kol-more-sheet-float`): `items` drawn
|
|
15
|
+
* by MenuFloatRows — the one float menu, beside it in kol-component since 2026-11-12 (it lived in kol-shell and
|
|
16
|
+
* was redrawn here). `menu(close)` still replaces the rows
|
|
17
|
+
*
|
|
18
|
+
* `tone` is the Buttons' ground (Button's tones); `grey` is the float well on a float (the secondary look).
|
|
19
|
+
* The ⌄ is 12 (`--kol-float-chev-sm` on a float), never the button's glyph.
|
|
20
|
+
*
|
|
21
|
+
* @param {ReactNode} children the main action's label
|
|
22
|
+
* @param {string} [icon] the main action's glyph
|
|
23
|
+
* @param {Function} onClick the main action
|
|
24
|
+
* @param {Array} [items] `[{ label, icon?, onPress, disabled? }]` — the menu's rows
|
|
25
|
+
* @param {Function} [menu] `(close) => ReactNode` — the menu's content instead of `items` (MenuFloatRows on a float)
|
|
26
|
+
* @param {'default'|'float'} [variant='default']
|
|
27
|
+
* @param {string} [tone] · {'xs'|'sm'|'md'|'lg'} [size='md'] (default only; a float is sm)
|
|
28
|
+
* @param {boolean} [disabled] the main action off; the menu still opens
|
|
29
|
+
* @param {string} [menuLabel='More actions'] the ⌄'s aria-label
|
|
30
|
+
* @param {string} [placement='bottom-end'] · {string} [className]
|
|
31
|
+
*/
|
|
32
|
+
const WELL = { '--kol-tone-bg': 'var(--kol-float-well)', '--kol-tone-fg': 'var(--kol-surface-on-primary)' }
|
|
33
|
+
|
|
34
|
+
export default function ButtonSplit({ children, icon, onClick, items = [], menu, variant = 'default', tone, size = 'md', disabled = false, menuLabel = 'More actions', placement = 'bottom-end', className = '' }) {
|
|
35
|
+
const [open, setOpen] = useState(false)
|
|
36
|
+
const popover = usePopover({ open, onOpenChange: setOpen, placement, offset: 6, role: 'menu' })
|
|
37
|
+
const close = () => setOpen(false)
|
|
38
|
+
const float = variant === 'float'
|
|
39
|
+
const shared = float
|
|
40
|
+
? { variant: 'float', tone: tone === 'grey' ? undefined : tone, size: 'sm', style: tone === 'grey' ? WELL : undefined }
|
|
41
|
+
: { tone, size }
|
|
42
|
+
const pick = (it) => () => { if (it.disabled) return; it.onPress?.(); close() }
|
|
43
|
+
return (
|
|
44
|
+
<div className={`kol-btn-split inline-flex items-stretch ${className}`.trim()}>
|
|
45
|
+
<Button {...shared} iconLeft={icon} iconSize={float ? undefined : 12} disabled={disabled} onClick={onClick} className="flex-1 min-w-0 rounded-r-none">{children}</Button>
|
|
46
|
+
<span aria-hidden="true" className="w-px shrink-0 bg-oq-16" />
|
|
47
|
+
<span ref={popover.refs.setReference} {...popover.getReferenceProps()} className="inline-flex">
|
|
48
|
+
<Button {...shared} iconOnly="chevron-down" iconSize={float ? undefined : 12} pressed={open} aria-label={menuLabel}
|
|
49
|
+
className={`rounded-l-none ${float ? '[--kol-float-ic:var(--kol-float-chev-sm)]' : ''}`.trim()} />
|
|
50
|
+
</span>
|
|
51
|
+
<PopoverPanel popover={popover} panel={false} focus={false}
|
|
52
|
+
className={float ? `kol-more-sheet kol-more-sheet-float ${floatSurfaceClass('solid', true)}` : 'w-max bg-surface-secondary border border-oq-08 rounded shadow-lg'}
|
|
53
|
+
style={float ? { minWidth: 220 } : undefined}>
|
|
54
|
+
{menu ? menu(close) : float ? <MenuFloatRows variant="float" actions={items} onPick={close} /> : items.map((it) => (
|
|
55
|
+
<button key={it.label} type="button" disabled={it.disabled} onClick={pick(it)}
|
|
56
|
+
className="w-full kol-helper-12 px-3 h-8 flex items-center gap-2 text-body hover:text-emphasis disabled:opacity-40 disabled:cursor-not-allowed disabled:hover:text-body text-left">
|
|
57
|
+
<span className="flex-1 truncate">{it.label}</span>
|
|
58
|
+
</button>
|
|
59
|
+
))}
|
|
60
|
+
</PopoverPanel>
|
|
61
|
+
</div>
|
|
62
|
+
)
|
|
63
|
+
}
|
|
@@ -0,0 +1,96 @@
|
|
|
1
|
+
import { isValidElement } from 'react'
|
|
2
|
+
import { IconLoader } from '@kolkrabbi/kol-icons'
|
|
3
|
+
import Button from '../atoms/Button.jsx'
|
|
4
|
+
|
|
5
|
+
/* taxonomy-ok: molecule — a title slot and the header's toggles (Button atoms, kol-icons's IconLoader); the one header of every Rail, modal and settings window */
|
|
6
|
+
|
|
7
|
+
/**
|
|
8
|
+
* Header — THE header (plan-2026-11-12-one-header W1.1; the user: *"I JUST WANT ONE MOTHERFUCKING COMPONENT FOR THE FUCKING
|
|
9
|
+
* HEADERS"*). One component, `variant` picks the row; the toggles render only when given:
|
|
10
|
+
*
|
|
11
|
+
* nav NavRail float's switcher row — the glyph (18) · the title (`kol-float-body-lg`) · the ⌄ when `onSwitch`, one
|
|
12
|
+
* press filling the title position; then `end` and the toggles. The ⌄ is 12 (`--kol-float-chev-sm`), never lg
|
|
13
|
+
* property every float Rail's header (RailFloat, PropertyRail, MenuFloat's card) — the title in `kol-float-panel`
|
|
14
|
+
* filling the row and truncating, then `end` and the toggles, 4 apart, 8 off the title
|
|
15
|
+
* modal the float window's row (ModalDialog float, the useModal float prompts, QuickLookFrame float) — the glyph (16,
|
|
16
|
+
* oq-64) · the title in `kol-float-panel` · `end` · − (`onMinimise`) · ×, 12 apart, quiet on oq-64
|
|
17
|
+
* settings ModalDialog settings' 60 header — the title (Inter 14 semibold) · `kind` in the hint ink · `end` (the preset
|
|
18
|
+
* select) · ×, an oq-16 rule under it
|
|
19
|
+
*
|
|
20
|
+
* The title is a SLOT: text takes the variant's type, a node fills the title position as it is.
|
|
21
|
+
*
|
|
22
|
+
* The toggles, in this order after `end`:
|
|
23
|
+
* expand ↗ `onExpand` — the tool's expanded form
|
|
24
|
+
* collapse-h the panel button `onCollapseH` — the Rail collapses sideways out of view
|
|
25
|
+
* collapse-v the chevron `onCollapseV` (`collapsedV` its state) — the Rail collapses up to its header bar; ⌄ "Expand"
|
|
26
|
+
* while collapsed, ⌃ "Collapse" while open; 12 (`--kol-float-chev-sm`, 14 on touch), never the button's 18
|
|
27
|
+
* close × `onClose`
|
|
28
|
+
*
|
|
29
|
+
* @param {'nav'|'property'|'modal'|'settings'} [variant='property']
|
|
30
|
+
* @param {string} [icon] nav · modal: the lead glyph
|
|
31
|
+
* @param {ReactNode} [title] the title slot — text, or a node in the title position
|
|
32
|
+
* @param {ReactNode} [kind] settings: the line beside the title
|
|
33
|
+
* @param {Function} [onSwitch] nav: the switcher's press; shows the ⌄
|
|
34
|
+
* @param {ReactNode} [end] the end slot — before the toggles
|
|
35
|
+
* @param {Function} [onExpand] · {Function} [onCollapseH] · {boolean} [collapsedV] · {Function} [onCollapseV]
|
|
36
|
+
* @param {Function} [onMinimise] modal: the −
|
|
37
|
+
* @param {Function} [onClose] the ×
|
|
38
|
+
* @param {string} [className]
|
|
39
|
+
*/
|
|
40
|
+
const CTL = 'inline-flex size-6 shrink-0 items-center justify-center rounded-full text-oq-64 hover:text-oq-96 hover:bg-fg-08 focus-visible:outline-none focus-visible:shadow-[var(--kol-float-focus)] cursor-pointer'
|
|
41
|
+
const CHEV = '[--kol-float-ic:var(--kol-float-chev-sm)]'
|
|
42
|
+
|
|
43
|
+
export default function Header({ variant = 'property', icon, title, kind, onSwitch, end, onExpand, onCollapseH, collapsedV = false, onCollapseV, onMinimise, onClose, className = '' }) {
|
|
44
|
+
const toggles = <>
|
|
45
|
+
{onExpand && <Button variant="float" tone="ghost" size="sm" iconOnly="arrow-upright" aria-label="Expand" onClick={onExpand} />}
|
|
46
|
+
{onCollapseH && <Button variant="float" tone="ghost" size="sm" iconOnly={variant === 'nav' ? 'panel-left' : 'panel-right'} aria-label="Collapse" onClick={onCollapseH} />}
|
|
47
|
+
{onCollapseV && <Button variant="float" tone="ghost" size="sm" iconOnly={collapsedV ? 'chevron-down' : 'chevron-up'} className={CHEV}
|
|
48
|
+
aria-label={collapsedV ? 'Expand' : 'Collapse'} aria-expanded={!collapsedV} onClick={onCollapseV} />}
|
|
49
|
+
</>
|
|
50
|
+
const any = end || onExpand || onCollapseH || onCollapseV
|
|
51
|
+
|
|
52
|
+
if (variant === 'settings') return (
|
|
53
|
+
<header className={`flex items-center gap-4 h-[60px] shrink-0 pl-6 pr-[22px] border-b border-oq-16 ${className}`.trim()}>
|
|
54
|
+
<h2 className="text-[14px] font-semibold leading-none">{title}</h2>
|
|
55
|
+
{kind && <span className="text-[11px] text-oq-64 leading-none mt-px">{kind}</span>}
|
|
56
|
+
{/* `end`: the header's right side pushed by its own margin, no spacer (LAW 10) */}
|
|
57
|
+
<div className="ml-auto flex items-center gap-4">
|
|
58
|
+
{end}{toggles}
|
|
59
|
+
{onClose && <button type="button" aria-label="Close" onClick={onClose}
|
|
60
|
+
className="ml-3 size-7 -mr-[7px] inline-flex items-center justify-center rounded-md text-[20px] leading-none text-oq-64 hover:text-(--kol-fg-96) hover:bg-(--kol-oq-08) focus-visible:outline-none focus-visible:shadow-[var(--kol-float-focus)]">×</button>}
|
|
61
|
+
</div>
|
|
62
|
+
</header>
|
|
63
|
+
)
|
|
64
|
+
|
|
65
|
+
if (variant === 'modal') return (
|
|
66
|
+
<div className={`flex min-h-6 w-full items-center gap-3 ${className}`.trim()}>
|
|
67
|
+
{icon && <IconLoader name={icon} size={16} className="shrink-0 text-oq-64" />}
|
|
68
|
+
{isValidElement(title) ? <div className="flex min-w-0 flex-1">{title}</div> : <span className="kol-float-panel min-w-0 flex-1 truncate text-fg-emphasis">{title}</span>}
|
|
69
|
+
{end}{toggles}
|
|
70
|
+
{onMinimise && <button type="button" aria-label="Minimise" onClick={onMinimise} className={CTL}><IconLoader name="minus" size={14} /></button>}
|
|
71
|
+
{onClose && <button type="button" aria-label="Close" onClick={onClose} className={CTL}><IconLoader name="x" size={16} /></button>}
|
|
72
|
+
</div>
|
|
73
|
+
)
|
|
74
|
+
|
|
75
|
+
/* nav · property: the Rail's row */
|
|
76
|
+
const slot = variant === 'nav' && !isValidElement(title) && title != null && title !== false
|
|
77
|
+
? (
|
|
78
|
+
<button type="button" onClick={onSwitch} className="flex h-10 w-full items-center gap-2.5 rounded-[var(--kol-float-list-r)] px-2.5 text-left cursor-pointer hover:bg-fg-08 focus-visible:outline-none focus-visible:shadow-[var(--kol-float-focus)]">
|
|
79
|
+
{icon && <IconLoader name={icon} size={18} className="shrink-0 text-oq-96" />}
|
|
80
|
+
<span className="kol-float-body-lg min-w-0 flex-1 truncate text-fg-emphasis">{title}</span>
|
|
81
|
+
{onSwitch && <IconLoader name="chevron-down" size="var(--kol-float-chev-sm)" className="shrink-0 text-oq-64" />}
|
|
82
|
+
</button>
|
|
83
|
+
)
|
|
84
|
+
: title
|
|
85
|
+
return (
|
|
86
|
+
<div data-float-module-header="" className={`flex w-full min-w-0 shrink-0 items-center justify-between gap-2 ${className}`.trim()}>
|
|
87
|
+
{slot != null && slot !== false && (isValidElement(slot)
|
|
88
|
+
? <div data-rail-header-title="" className="flex min-w-0 flex-1">{slot}</div>
|
|
89
|
+
: <span className="kol-float-panel text-emphasis min-w-0 flex-1 truncate">{slot}</span>)}
|
|
90
|
+
{(any || onClose) && <span className="ml-auto flex shrink-0 items-center gap-1">
|
|
91
|
+
{end}{toggles}
|
|
92
|
+
{onClose && <Button variant="float" tone="ghost" size="sm" iconOnly="x" aria-label="Close" onClick={onClose} />}
|
|
93
|
+
</span>}
|
|
94
|
+
</div>
|
|
95
|
+
)
|
|
96
|
+
}
|
|
@@ -0,0 +1,164 @@
|
|
|
1
|
+
import { createContext, useContext, useEffect, useRef, useState } from 'react'
|
|
2
|
+
import Button from '../atoms/Button.jsx'
|
|
3
|
+
import Header from './Header.jsx'
|
|
4
|
+
import ModalHeader from './ModalHeader.jsx'
|
|
5
|
+
import { usePopover, PopoverPanel } from '../utilities/Popover.jsx'
|
|
6
|
+
import { IconLoader } from '@kolkrabbi/kol-icons'
|
|
7
|
+
|
|
8
|
+
/* the open level a row sits in (MenuFloat); null outside one, where a row's `sub` is ignored as before */
|
|
9
|
+
const Level = (globalThis[Symbol.for('@kolkrabbi/kol-shell/FloatMenuLevel')] ??= createContext(null))
|
|
10
|
+
const FLOAT_ROW = 'w-full justify-start kol-btn-float'
|
|
11
|
+
|
|
12
|
+
/* taxonomy-ok: molecule — a column of nav Buttons (moved from kol-shell 2026-11-12 so ButtonSplit's float menu is this one;
|
|
13
|
+
* kol-shell re-exports both names) */
|
|
14
|
+
|
|
15
|
+
/**
|
|
16
|
+
* MenuFloatRows — The sheet's rows, wherever the sheet opens. the one list of 44px nav rows (mono-16, 22px glyphs,
|
|
17
|
+
* the pill's rounding on each) that the phone bar's More sheet and Home's masthead button both draw
|
|
18
|
+
* (user 2026-10-23: *"we could even make similar dropdown as we use in phone nav"*). The sheet's chrome is
|
|
19
|
+
* `.kol-more-sheet` — the pill's ground and hairline, a 24px rounding, 8px pad — on whatever box holds the rows.
|
|
20
|
+
*
|
|
21
|
+
* @param {Array} actions `[{ label, icon?, avatar?, onPress, checked?, disabled? }]` — the page's own buttons, first. `avatar` (a picture
|
|
22
|
+
* url — the account row) draws in the glyph's place. A row with `checked`
|
|
23
|
+
* (a pick list — TransportPill's loop lengths) draws the 22px check, or keeps its space when false
|
|
24
|
+
* @param {Array} items `[{ path, label, icon? }]` — destinations, after a divider's worth of nothing
|
|
25
|
+
* @param {string} active the item path that is current
|
|
26
|
+
* @param {Function} onPick `(item | action) => void` — after the row's own press; the sheet closes here
|
|
27
|
+
* @param {'float'} variant the floating style (round 3, W16 2026-10-31): each row a `kol-btn-float` pill — 40 (48 on touch)
|
|
28
|
+
* tall, 12 in, an 18 (20) glyph, the current row oq-16 — in a `.kol-more-sheet-float`; AppFloatNav
|
|
29
|
+
* and the signed-out Home pass it. Unset, the rows are A
|
|
30
|
+
* @param {boolean} itemsFirst the destinations above the actions (PhoneNav's More, 2026-10-28: the whole nav, then the
|
|
31
|
+
* page's buttons); Home's masthead button keeps actions first
|
|
32
|
+
*/
|
|
33
|
+
export default function MenuFloatRows({ actions = [], items = [], active, onPick, itemsFirst = false, variant }) {
|
|
34
|
+
/* the float row's height, inset and gap are the theme's (`.kol-more-sheet-float`, round 3) — no h-11 / gap-3 utility,
|
|
35
|
+
* which would outrank the components layer */
|
|
36
|
+
const float = variant === 'float'
|
|
37
|
+
const rowCls = float ? FLOAT_ROW : 'w-full justify-start h-11 gap-3'
|
|
38
|
+
const level = useContext(Level)
|
|
39
|
+
const glyph = float ? 'var(--kol-float-ic)' : 22
|
|
40
|
+
const acts = (
|
|
41
|
+
<>
|
|
42
|
+
{actions.map((a) => {
|
|
43
|
+
/* a row with `sub` inside a MenuFloat opens its level instead of picking — the chevron at the row's end */
|
|
44
|
+
const nests = level && a.sub?.length > 0
|
|
45
|
+
/* the account row is the ModalHeader (menu-system W4.1) — avatar · title, pressable */
|
|
46
|
+
if (a.avatar && !nests) return <ModalHeader key={a.label} variant={float ? 'float' : 'default'} avatar={a.avatar} title={a.label} onClick={() => { onPick?.(a); a.onPress?.() }} />
|
|
47
|
+
return (
|
|
48
|
+
/* a nesting row draws its own glyph so the label can take the room between it and the chevron; 8 apart, as Button's */
|
|
49
|
+
<Button key={a.label} variant="nav" size="lg" iconLeft={a.checked === undefined && !nests ? a.icon : undefined} iconSize={glyph} disabled={a.disabled}
|
|
50
|
+
className={rowCls} style={nests ? { gap: 8 } : undefined}
|
|
51
|
+
aria-haspopup={nests ? 'menu' : undefined} aria-expanded={nests ? level.isOpen(a) : undefined}
|
|
52
|
+
onClick={(e) => { if (nests) { level.open(a, e.currentTarget); return } onPick?.(a); a.onPress?.() }}>
|
|
53
|
+
{a.checked !== undefined && (
|
|
54
|
+
<span className="inline-flex items-center justify-center shrink-0" style={{ width: float ? 'var(--kol-float-ic)' : 22, height: float ? 'var(--kol-float-ic)' : 22 }}>{a.checked && <IconLoader name="check" size={22} />}</span>
|
|
55
|
+
)}
|
|
56
|
+
{nests ? <>{a.icon && <IconLoader name={a.icon} size={glyph} />}<span className="flex-1 text-left">{a.label}</span><IconLoader name="chevron-right" size={glyph} className="shrink-0 text-oq-48" /></> : a.label}
|
|
57
|
+
</Button>
|
|
58
|
+
)
|
|
59
|
+
})}
|
|
60
|
+
</>
|
|
61
|
+
)
|
|
62
|
+
const dests = (
|
|
63
|
+
<>
|
|
64
|
+
{items.map((i) => (
|
|
65
|
+
<Button
|
|
66
|
+
key={i.path ?? i.id ?? i.label}
|
|
67
|
+
variant="nav"
|
|
68
|
+
size="lg"
|
|
69
|
+
iconLeft={i.icon}
|
|
70
|
+
iconSize={glyph}
|
|
71
|
+
aria-current={i.path != null && i.path === active ? 'page' : undefined}
|
|
72
|
+
className={rowCls}
|
|
73
|
+
onClick={() => onPick?.(i)}
|
|
74
|
+
>
|
|
75
|
+
{i.label}
|
|
76
|
+
</Button>
|
|
77
|
+
))}
|
|
78
|
+
</>
|
|
79
|
+
)
|
|
80
|
+
return itemsFirst ? <>{dests}{acts}</> : <>{acts}{dests}</>
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
const rowKey = (r) => r.id ?? r.path ?? r.label
|
|
84
|
+
|
|
85
|
+
/**
|
|
86
|
+
* MenuFloat — A float's card with NESTED LEVELS (FloatsOwnItems, kol-fxr 2026-10-31 — *"does the float nav offer nested
|
|
87
|
+
* menus"*). Wraps the card's first level (`children`, MenuFloatRows); a MenuFloatRows action with `sub` opens the next level, the same
|
|
88
|
+
* row shape to any depth (`sub[].sub[].sub…`). How a level opens is one rule, by room:
|
|
89
|
+
* - `beside` (the desk's `dock`) — a card of the same chrome beside its parent row, right of it, the bottom edges on one
|
|
90
|
+
* line, through the existing popover (`usePopover` + `PopoverPanel`, flips and shifts at the window's edge);
|
|
91
|
+
* - else (every phone variant) — the level REPLACES the card's rows, under a Back row naming the parent.
|
|
92
|
+
* A leaf runs its `onPress`, then `onLeaf(row)` closes every level (the caller closes the card — Escape and an outside press
|
|
93
|
+
* are the card's, and closing it closes everything). Keys: ↑ ↓ move, → or Enter opens a level, ← goes back one.
|
|
94
|
+
*
|
|
95
|
+
* @param {boolean} beside levels open beside their row (else they replace the card's rows)
|
|
96
|
+
* @param {string} cardClass a beside level's chrome — the first card's classes
|
|
97
|
+
* @param {Function} onLeaf `(row) => void` — a nested leaf was picked (its `onPress` has run); close everything here
|
|
98
|
+
* @param {ReactNode} [title] the card's header — Header variant="property", the header every float Rail wears (the user
|
|
99
|
+
* 2026-11-12: *"why is it so hard TO USE THE SAME FUCKING HEADER"*); each opener passes the label of
|
|
100
|
+
* the button that opened it. Unset, no header
|
|
101
|
+
* @param {ReactNode} [titleActions] the header's actions slot (RailTrigger's ×)
|
|
102
|
+
*/
|
|
103
|
+
export function MenuFloat({ beside = false, cardClass = '', onLeaf, title, titleActions, children }) {
|
|
104
|
+
/* the open rows, outermost first — `{ row, el }`, `el` the row a beside level hangs off.
|
|
105
|
+
* ponytail: the row object is kept as opened; a consumer that rebuilds its rows mid-open sees the old `sub` until reopened */
|
|
106
|
+
const [trail, setTrail] = useState([])
|
|
107
|
+
const at = (depth) => ({
|
|
108
|
+
open: (row, el) => setTrail((t) => (t[depth] && rowKey(t[depth].row) === rowKey(row) ? t.slice(0, depth) : [...t.slice(0, depth), { row, el }])),
|
|
109
|
+
isOpen: (row) => !!trail[depth] && rowKey(trail[depth].row) === rowKey(row),
|
|
110
|
+
})
|
|
111
|
+
const back = (depth) => { const parent = trail[depth - 1]?.el; setTrail((t) => t.slice(0, depth - 1)); if (beside) parent?.focus({ preventScroll: true }) }
|
|
112
|
+
const keys = (depth) => (e) => {
|
|
113
|
+
const rows = [...e.currentTarget.querySelectorAll('button')]
|
|
114
|
+
const i = rows.indexOf(document.activeElement)
|
|
115
|
+
if (e.key === 'ArrowDown' || e.key === 'ArrowUp') rows[(i + (e.key === 'ArrowDown' ? 1 : -1) + rows.length) % rows.length]?.focus()
|
|
116
|
+
else if (e.key === 'ArrowRight' && e.target.getAttribute?.('aria-haspopup')) { if (e.target.getAttribute('aria-expanded') !== 'true') e.target.click() }
|
|
117
|
+
else if (e.key === 'ArrowLeft' && depth > 0) back(depth)
|
|
118
|
+
else return
|
|
119
|
+
e.preventDefault()
|
|
120
|
+
e.stopPropagation()
|
|
121
|
+
}
|
|
122
|
+
const level = (depth, rows, lead) => (
|
|
123
|
+
<Level.Provider value={at(depth)}>
|
|
124
|
+
<LevelRows key={`${depth}:${rowKey(trail[depth - 1].row)}`} onKeyDown={keys(depth)}>
|
|
125
|
+
{lead}
|
|
126
|
+
<MenuFloatRows variant="float" actions={rows} onPick={onLeaf} />
|
|
127
|
+
</LevelRows>
|
|
128
|
+
</Level.Provider>
|
|
129
|
+
)
|
|
130
|
+
|
|
131
|
+
/* the header stays on top while a level replaces the rows; title 12 in, as the rows' labels */
|
|
132
|
+
const head = title != null && title !== false && (
|
|
133
|
+
<Header variant="property" title={title} end={titleActions} className={`pl-3 ${titleActions ? 'pr-1' : 'pr-3'} pt-1 pb-2`} />
|
|
134
|
+
)
|
|
135
|
+
if (!beside && trail.length) {
|
|
136
|
+
const d = trail.length
|
|
137
|
+
return <>{head}{level(d, trail[d - 1].row.sub, (
|
|
138
|
+
<Button variant="nav" size="lg" iconLeft="chevron-left" iconSize="var(--kol-float-ic)" className={FLOAT_ROW} onClick={() => back(d)}>{trail[d - 1].row.label}</Button>
|
|
139
|
+
))}</>
|
|
140
|
+
}
|
|
141
|
+
return (
|
|
142
|
+
<Level.Provider value={at(0)}>
|
|
143
|
+
{head}
|
|
144
|
+
<div className="contents" onKeyDown={keys(0)}>{children}</div>
|
|
145
|
+
{beside && trail.map((s, i) => (
|
|
146
|
+
<Beside key={i} anchor={s.el} cardClass={cardClass}>{level(i + 1, s.row.sub)}</Beside>
|
|
147
|
+
))}
|
|
148
|
+
</Level.Provider>
|
|
149
|
+
)
|
|
150
|
+
}
|
|
151
|
+
|
|
152
|
+
/* a nested level's rows — its first row takes the focus when it opens, so the keys carry on in it */
|
|
153
|
+
function LevelRows({ onKeyDown, children }) {
|
|
154
|
+
const ref = useRef(null)
|
|
155
|
+
useEffect(() => { ref.current?.querySelector('button')?.focus({ preventScroll: true }) }, [])
|
|
156
|
+
return <div ref={ref} className="contents" onKeyDown={onKeyDown}>{children}</div>
|
|
157
|
+
}
|
|
158
|
+
|
|
159
|
+
/* a level beside its row — the + menu's popover: right of the row, 12 off the card (the row sits 6 in), the bottom edges on
|
|
160
|
+
* one line. `kol-float-level` marks it so a parent popover's outside press lets it be */
|
|
161
|
+
function Beside({ anchor, cardClass, children }) {
|
|
162
|
+
const pop = usePopover({ open: true, placement: 'right-end', offset: { mainAxis: 18, crossAxis: 6 }, click: false, dismiss: false, role: 'menu', referenceElement: anchor })
|
|
163
|
+
return <PopoverPanel popover={pop} panel={false} focus={false} className={`kol-float-level ${cardClass}`} style={{ minWidth: 220, maxWidth: 'calc(100vw - 24px)' }}>{children}</PopoverPanel>
|
|
164
|
+
}
|
package/src/molecules/Modal.jsx
CHANGED
|
@@ -3,7 +3,8 @@ import { createPortal } from 'react-dom'
|
|
|
3
3
|
import Button from '../atoms/Button.jsx'
|
|
4
4
|
import Input from '../atoms/Input.jsx'
|
|
5
5
|
import ToggleCheckbox from '../atoms/ToggleCheckbox.jsx'
|
|
6
|
-
import
|
|
6
|
+
import ButtonGroup from './ButtonGroup.jsx'
|
|
7
|
+
import Header from './Header.jsx'
|
|
7
8
|
import ModalShell from './ModalShell.jsx'
|
|
8
9
|
|
|
9
10
|
/**
|
|
@@ -62,7 +63,7 @@ import ModalShell from './ModalShell.jsx'
|
|
|
62
63
|
*
|
|
63
64
|
* THE FLOAT (`variant: 'float'` on any call or on the provider, float-everything W6 rows 84 · 85 · 89 · 90, 2026-11-04 —
|
|
64
65
|
* kol-float--style 46:2795): the window on `kol-float-solid` at `--kol-float-window-r`, 24 in, 18 between its parts.
|
|
65
|
-
* A `header` (with its `icon`) draws `
|
|
66
|
+
* A `header` (with its `icon`) draws `Header variant="modal"` over the title; the title is the heading
|
|
66
67
|
* (`kol-float-section`… at 20: Inter 500), `body` a line under it in the hint ink; fields are float Inputs, toggles float
|
|
67
68
|
* ToggleCheckboxes; the actions sit apart — the quiet cancel at the left (`tone="ghost"`), the next step at the right
|
|
68
69
|
* (`inverted`, or `danger` when `tone: 'danger'` — the destructive confirm). Still a blocking task, so the scrim
|
|
@@ -221,15 +222,15 @@ function ModalView({ state, closeWith, variant, contained }) {
|
|
|
221
222
|
style={{
|
|
222
223
|
minWidth: 320,
|
|
223
224
|
maxWidth: contained ? '90%' : '90vw',
|
|
224
|
-
...(float ? { width:
|
|
225
|
+
...(float ? { width: 'var(--kol-float-window-w)' } : {}),
|
|
225
226
|
}}
|
|
226
|
-
header={float && state.header && <
|
|
227
|
+
header={float && state.header && <Header variant="modal" icon={state.icon} title={state.header} onClose={cancel} />}
|
|
227
228
|
footer={float ? (
|
|
228
|
-
/* the float's actions sit apart: recovery quiet at the left, the next step at the right */
|
|
229
|
-
<
|
|
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">
|
|
230
231
|
{state.kind !== 'alert' ? <Button variant="float" tone="ghost" size="md" onClick={cancel}>{state.cancelLabel ?? 'Cancel'}</Button> : <span />}
|
|
231
232
|
<Button variant="float" tone={state.tone === 'danger' ? 'danger' : 'inverted'} size="md" onClick={submit} data-modal-ok>{state.okLabel ?? 'OK'}</Button>
|
|
232
|
-
</
|
|
233
|
+
</ButtonGroup>
|
|
233
234
|
) : (
|
|
234
235
|
<div className="flex gap-2 justify-end">
|
|
235
236
|
{state.kind !== 'alert' && <Button size="sm" onClick={cancel}>{state.cancelLabel ?? 'Cancel'}</Button>}
|
|
@@ -332,8 +333,9 @@ export function useModal() {
|
|
|
332
333
|
* <ModalDialog open={open} onClose={() => setOpen(false)} title="Filter by page" width={560}>…</ModalDialog>
|
|
333
334
|
*
|
|
334
335
|
* `variant="float"` (float-everything W6 rows 83 · 84 · 89, 2026-11-04 — kol-float--style 46:2655): the float window —
|
|
335
|
-
* `kol-float-solid` on `--kol-float-window-r`,
|
|
336
|
-
*
|
|
336
|
+
* `kol-float-solid` on `--kol-float-window-r`, `--kol-float-window-w` wide unless `width` says otherwise (plan-2026-11-12-one-header
|
|
337
|
+
* W6.1), 24 in, 18 between its parts, the title drawn as `Header
|
|
338
|
+
* variant="modal"` (`icon` · title · − when `onMinimise` · ×) over the children. `blocking` (default true) keeps the
|
|
337
339
|
* scrim: a blocking task dims the scene, a utility window does not (row 89) — `blocking={false}` drops the scrim and the
|
|
338
340
|
* press-outside close and leaves the scene live (QuickLookFrame float is the utility window proper).
|
|
339
341
|
* @param {'lift'|'bordered'|'float'} [variant='lift']
|
|
@@ -345,7 +347,7 @@ export function useModal() {
|
|
|
345
347
|
*/
|
|
346
348
|
/*
|
|
347
349
|
* `variant="settings"` (plan-2026-11-05-float-editor W7.1 — his "Stripe Array settings modal", Figma 7K5v68l4tblHPFuiLdokRu
|
|
348
|
-
* 12:2282, 880 × 656): the generator's settings window. A 60 header (the `title` in Inter 14 semibold, `kind` beside it in
|
|
350
|
+
* 12:2282, 880 × 656): the generator's settings window. A 60 header — `Header variant="settings"` (the `title` in Inter 14 semibold, `kind` beside it in
|
|
349
351
|
* the hint ink, `headerEnd` — the preset select — and the ×), a 156 section list on the primary surface (`sections`
|
|
350
352
|
* `[{ key, label, state }]` — the name and a one-line state, 6 apart; the lit one carries its 2px marker and no fill,
|
|
351
353
|
* hover the only fill (LAW 16, plan-2026-11-12-float-rails-figma W13.1; it sat on oq-12 until then); `section` /
|
|
@@ -358,7 +360,7 @@ export function useModal() {
|
|
|
358
360
|
* @param {string} [section] · @param {Function} [onSection]
|
|
359
361
|
* @param {ReactNode} [aside] · @param {ReactNode} [footer] · @param {number} [height=656]
|
|
360
362
|
*/
|
|
361
|
-
export function ModalDialog({ open, onClose, title, width
|
|
363
|
+
export function ModalDialog({ open, onClose, title, width, variant = 'lift', icon, onMinimise, blocking = true, container, kind, headerEnd, sections, section, onSection, aside, footer, height = 656, children }) {
|
|
362
364
|
const look = variant === 'settings' ? 'settings' : modalVariant(variant, 'lift')
|
|
363
365
|
const float = look === 'float'
|
|
364
366
|
useEffect(() => {
|
|
@@ -376,19 +378,8 @@ export function ModalDialog({ open, onClose, title, width = 560, variant = 'lift
|
|
|
376
378
|
style={{ position: container ? 'absolute' : 'fixed', inset: 0, zIndex: 150, display: 'flex', alignItems: 'center', justifyContent: 'center' }}>
|
|
377
379
|
<ModalShell variant="settings" role="dialog" aria-modal={blocking ? 'true' : undefined} aria-label={title} data-dialog onMouseDown={(e) => e.stopPropagation()}
|
|
378
380
|
className="kol-settings-window pointer-events-auto overflow-hidden"
|
|
379
|
-
style={{ width: `min(${width}px, calc(${within} - 32px))`, height: `min(${height}px, calc(${withinH} - 32px))` }}
|
|
380
|
-
header={
|
|
381
|
-
<header className="flex items-center gap-4 h-[60px] shrink-0 pl-6 pr-[22px] border-b border-oq-16">
|
|
382
|
-
<h2 className="text-[14px] font-semibold leading-none">{title}</h2>
|
|
383
|
-
{kind && <span className="text-[11px] text-oq-64 leading-none mt-px">{kind}</span>}
|
|
384
|
-
{/* `end`: the header's right side pushed by its own margin, no spacer (LAW 10) */}
|
|
385
|
-
<div className="ml-auto flex items-center gap-4">
|
|
386
|
-
{headerEnd}
|
|
387
|
-
<button type="button" aria-label="Close" onClick={onClose}
|
|
388
|
-
className="ml-3 size-7 -mr-[7px] inline-flex items-center justify-center rounded-md text-[20px] leading-none text-oq-64 hover:text-(--kol-fg-96) hover:bg-(--kol-oq-08) focus-visible:outline-none focus-visible:shadow-[var(--kol-float-focus)]">×</button>
|
|
389
|
-
</div>
|
|
390
|
-
</header>
|
|
391
|
-
)}
|
|
381
|
+
style={{ width: `min(${width ?? 880}px, calc(${within} - 32px))`, height: `min(${height}px, calc(${withinH} - 32px))` }}
|
|
382
|
+
header={<Header variant="settings" title={title} kind={kind} end={headerEnd} onClose={onClose} />}
|
|
392
383
|
footer={footer && <footer className="flex items-center gap-3 h-[60px] shrink-0 px-6 border-t border-oq-16">{footer}</footer>}>
|
|
393
384
|
<div className="flex flex-1 min-h-0">
|
|
394
385
|
{sections?.length > 0 && (
|
|
@@ -444,8 +435,9 @@ export function ModalDialog({ open, onClose, title, width = 560, variant = 'lift
|
|
|
444
435
|
* mid-page"): it painted the page's own surface behind an fg-08 hairline, so on a dark page it was the page.
|
|
445
436
|
* `.kol-overlay-panel` is the lift every KOL overlay wears (oq-04, no border — the scrim is the edge). */
|
|
446
437
|
className={float ? `pointer-events-auto gap-[18px] p-6 ${container ? 'max-h-[85%]' : 'max-h-[85vh]'} overflow-auto` : `${container ? 'max-h-[85%]' : 'max-h-[85vh]'}${blocking ? '' : ' pointer-events-auto'}`}
|
|
447
|
-
|
|
448
|
-
|
|
438
|
+
/* the float window's width is the token (P8: *"why doesnt it use width?"*); `width` (px) still overrides */
|
|
439
|
+
style={{ width: `min(${width != null ? `${width}px` : float ? 'var(--kol-float-window-w)' : '560px'}, calc(${container ? '100%' : '100vw'} - 32px))` }}
|
|
440
|
+
header={float && title && <Header variant="modal" icon={icon} title={title} onMinimise={onMinimise} onClose={onClose} />}
|
|
449
441
|
>
|
|
450
442
|
{children}
|
|
451
443
|
</ModalShell>
|
|
@@ -1,9 +1,10 @@
|
|
|
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'
|
|
4
5
|
import { IconLoader } from '@kolkrabbi/kol-icons'
|
|
5
6
|
|
|
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) */
|
|
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); the float window row is Header variant="modal" */
|
|
7
8
|
|
|
8
9
|
/* class-for-class MenuFloatRows' avatar row (menu-system W4.1, 2026-11-07): the nav Button's lg row, `kol-btn-float` on the float */
|
|
9
10
|
const ROW = { float: 'w-full justify-start kol-btn-float', default: 'w-full justify-start h-11 gap-3' }
|
|
@@ -23,7 +24,8 @@ const WINDOW = ['meta', 'nav', 'onMinimise', 'onClose']
|
|
|
23
24
|
* `avatar` or `onClick` is set, or when no window control is passed.
|
|
24
25
|
*
|
|
25
26
|
* THE WINDOW ROW (Dialog float, the useModal float prompts, QuickLookFrame) — drawn when `meta`, `nav`, `onMinimise` or
|
|
26
|
-
* `onClose` is passed.
|
|
27
|
+
* `onClose` is passed. Float, it IS `Header variant="modal"` (plan-2026-11-12-one-header W1.1 — deprecated here, use Header).
|
|
28
|
+
* Default: ‹ › n / N · the file's name · its facts · the actions · the close, on
|
|
27
29
|
* `.kol-quicklook-header`. Float (kol-float--style 46:2500): the window's glyph (16, oq-64) · its title in
|
|
28
30
|
* `kol-float-panel` (Inter 13/500) · − minimise · × close, 12 apart, the controls quiet on oq-64 and bright under the
|
|
29
31
|
* pointer. No rule under it — the no-borders law holds on float.
|
|
@@ -44,18 +46,7 @@ export default function ModalHeader(props) {
|
|
|
44
46
|
const { title, avatar, icon, actions, variant = 'default', onClick, meta, nav, onMinimise, onClose, className = '' } = props
|
|
45
47
|
const float = variant === 'float'
|
|
46
48
|
if (avatar == null && !onClick && WINDOW.some((k) => k in props)) {
|
|
47
|
-
if (float) {
|
|
48
|
-
const ctl = 'inline-flex size-6 shrink-0 items-center justify-center rounded-full text-oq-64 hover:text-oq-96 hover:bg-fg-08 focus-visible:outline-none focus-visible:shadow-[var(--kol-float-focus)] cursor-pointer'
|
|
49
|
-
return (
|
|
50
|
-
<div className={`flex min-h-6 w-full items-center gap-3 ${className}`.trim()}>
|
|
51
|
-
{icon && <IconLoader name={icon} size={16} className="shrink-0 text-oq-64" />}
|
|
52
|
-
<span className="kol-float-panel min-w-0 flex-1 truncate text-fg-emphasis">{title}</span>
|
|
53
|
-
{actions}
|
|
54
|
-
{onMinimise && <button type="button" aria-label="Minimise" onClick={onMinimise} className={ctl}><IconLoader name="minus" size={14} /></button>}
|
|
55
|
-
{onClose && <button type="button" aria-label="Close" onClick={onClose} className={ctl}><IconLoader name="x" size={16} /></button>}
|
|
56
|
-
</div>
|
|
57
|
-
)
|
|
58
|
-
}
|
|
49
|
+
if (float) return <Header variant="modal" icon={icon} title={title} end={actions} onMinimise={onMinimise} onClose={onClose} className={className} />
|
|
59
50
|
return (
|
|
60
51
|
<div className={`kol-quicklook-header ${className}`.trim()}>
|
|
61
52
|
{nav?.total > 1 && (
|
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
import { useRef, useState } from 'react'
|
|
2
2
|
import { IconLoader } from '@kolkrabbi/kol-icons'
|
|
3
3
|
import ModalHeader from './ModalHeader.jsx'
|
|
4
|
+
import Header from './Header.jsx'
|
|
4
5
|
import ModalShell from './ModalShell.jsx'
|
|
5
6
|
|
|
6
|
-
/* taxonomy-ok: molecule — ModalHeader (
|
|
7
|
+
/* taxonomy-ok: molecule — Header · ModalHeader (molecules) on ModalShell (molecule) + kol-icons's IconLoader. */
|
|
7
8
|
|
|
8
9
|
/**
|
|
9
10
|
* QuickLookFrame — The preview window. the Finder Quick Look window (user 2026-09-23: *"put them in a container LIKE
|
|
@@ -34,7 +35,7 @@ import ModalShell from './ModalShell.jsx'
|
|
|
34
35
|
*
|
|
35
36
|
* THE UTILITY WINDOW (`variant="float"`, float-everything W6 rows 86 · 88, 2026-11-04 — kol-float--style 46:2840): a
|
|
36
37
|
* non-modal float window — no scrim, the scene stays live under it. `kol-float-solid` on `--kol-float-window-r`, 20 in,
|
|
37
|
-
* 18 between its parts; the header is `
|
|
38
|
+
* 18 between its parts; the header is `Header variant="modal"` (`icon` · title · `onMinimise` · `onClose`); the
|
|
38
39
|
* body is the caller's (chip tabs, float fields); `status` is the footer line (`Changes saved automatically`, the
|
|
39
40
|
* `kol-float-label` role on fg-64) with the resize corner as its glyph at the right — the same drag as the default grip.
|
|
40
41
|
* @param {'float'} [variant]
|
|
@@ -71,7 +72,7 @@ export default function QuickLookFrame({ variant, icon, onMinimise, status, titl
|
|
|
71
72
|
return (
|
|
72
73
|
<ModalShell ref={ref} variant="float" style={size ? { width: size.w, height: size.h } : undefined}
|
|
73
74
|
className={`w-full max-w-[562px] gap-[18px] p-5 ${className}`.trim()}
|
|
74
|
-
header={header && <
|
|
75
|
+
header={header && <Header variant="modal" icon={icon} title={title} end={actions} onMinimise={onMinimise} onClose={onClose} />}
|
|
75
76
|
footer={(
|
|
76
77
|
<>
|
|
77
78
|
{footer}
|