@kolkrabbi/kol-component 0.374.0 → 0.376.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 +1 -1
- package/src/index.js +4 -0
- package/src/molecules/ButtonSplit.jsx +64 -0
- package/src/molecules/Header.jsx +96 -0
- package/src/molecules/Modal.jsx +8 -19
- 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/organisms/NavRailFloat.jsx +10 -15
- package/src/organisms/ReadingContents.jsx +1 -1
- package/src/organisms/ReadingPanel.jsx +5 -5
package/package.json
CHANGED
package/src/index.js
CHANGED
|
@@ -287,6 +287,10 @@ export { default as SettingsSections } from './organisms/SettingsSections.jsx'
|
|
|
287
287
|
* LabeledControlSection and SettingsRow. @deprecated 2026-11-08: the RailSection / RailRow aliases below are retired by
|
|
288
288
|
* the user's ruling ("I always called it labeledControl and LabeledControlSection… I never approved the rename") */
|
|
289
289
|
export { default as RailHeader } from './molecules/RailHeader.jsx'
|
|
290
|
+
/* Header — the one header, variant nav · property · modal · settings (plan-2026-11-12-one-header W1.1) */
|
|
291
|
+
export { default as Header } from './molecules/Header.jsx'
|
|
292
|
+
/* ButtonSplit — the main action, a divider and a ⌄ menu (plan-2026-11-12-one-header W4.1) */
|
|
293
|
+
export { default as ButtonSplit } from './molecules/ButtonSplit.jsx'
|
|
290
294
|
export { RailTabs, RailHint, RailActions, RailFoot, RailNav } from './organisms/RailKit.jsx'
|
|
291
295
|
export { LabeledControlSection as RailSection, SettingsRow as RailRow } from './organisms/SettingsPanel.jsx'
|
|
292
296
|
export { default as SectionNewsletter } from './organisms/SectionNewsletter.jsx'
|
|
@@ -0,0 +1,64 @@
|
|
|
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
|
+
|
|
6
|
+
/* taxonomy-ok: molecule — two Buttons (atoms) and a divider, the ⌄ opening a PopoverPanel (utility) of rows */
|
|
7
|
+
|
|
8
|
+
/**
|
|
9
|
+
* ButtonSplit — the main action, a 1px divider and a ⌄ that opens a menu of the other actions (plan-2026-11-12-one-header
|
|
10
|
+
* W4.1; the user: *"its basically 4 exports and 1 open, isnt that just 2 buttons with menufloat?"*). One shape, two looks:
|
|
11
|
+
*
|
|
12
|
+
* default the app's square Buttons at `size`, the menu a plain list (SplitToolButton's rows)
|
|
13
|
+
* float the float capsule (`variant="float"`, sm), the menu on the float sheet (`kol-more-sheet-float`). kol-component
|
|
14
|
+
* cannot import kol-shell, so the float menu's rows come from the caller: `menu(close)` returns MenuFloatRows
|
|
15
|
+
* (kol-shell). Without `menu`, `items` are drawn as MenuFloatRows' row, class for class
|
|
16
|
+
*
|
|
17
|
+
* `tone` is the Buttons' ground (Button's tones); `grey` is the float well on a float (the secondary look).
|
|
18
|
+
* The ⌄ is 12 (`--kol-float-chev-sm` on a float), never the button's glyph.
|
|
19
|
+
*
|
|
20
|
+
* @param {ReactNode} children the main action's label
|
|
21
|
+
* @param {string} [icon] the main action's glyph
|
|
22
|
+
* @param {Function} onClick the main action
|
|
23
|
+
* @param {Array} [items] `[{ label, icon?, onPress, disabled? }]` — the menu's rows
|
|
24
|
+
* @param {Function} [menu] `(close) => ReactNode` — the menu's content instead of `items` (MenuFloatRows on a float)
|
|
25
|
+
* @param {'default'|'float'} [variant='default']
|
|
26
|
+
* @param {string} [tone] · {'xs'|'sm'|'md'|'lg'} [size='md'] (default only; a float is sm)
|
|
27
|
+
* @param {boolean} [disabled] the main action off; the menu still opens
|
|
28
|
+
* @param {string} [menuLabel='More actions'] the ⌄'s aria-label
|
|
29
|
+
* @param {string} [placement='bottom-end'] · {string} [className]
|
|
30
|
+
*/
|
|
31
|
+
const WELL = { '--kol-tone-bg': 'var(--kol-float-well)', '--kol-tone-fg': 'var(--kol-surface-on-primary)' }
|
|
32
|
+
|
|
33
|
+
export default function ButtonSplit({ children, icon, onClick, items = [], menu, variant = 'default', tone, size = 'md', disabled = false, menuLabel = 'More actions', placement = 'bottom-end', className = '' }) {
|
|
34
|
+
const [open, setOpen] = useState(false)
|
|
35
|
+
const popover = usePopover({ open, onOpenChange: setOpen, placement, offset: 6, role: 'menu' })
|
|
36
|
+
const close = () => setOpen(false)
|
|
37
|
+
const float = variant === 'float'
|
|
38
|
+
const shared = float
|
|
39
|
+
? { variant: 'float', tone: tone === 'grey' ? undefined : tone, size: 'sm', style: tone === 'grey' ? WELL : undefined }
|
|
40
|
+
: { tone, size }
|
|
41
|
+
const pick = (it) => () => { if (it.disabled) return; it.onPress?.(); close() }
|
|
42
|
+
return (
|
|
43
|
+
<div className={`kol-btn-split inline-flex items-stretch ${className}`.trim()}>
|
|
44
|
+
<Button {...shared} iconLeft={icon} iconSize={float ? undefined : 12} disabled={disabled} onClick={onClick} className="flex-1 min-w-0 rounded-r-none">{children}</Button>
|
|
45
|
+
<span aria-hidden="true" className="w-px shrink-0 bg-oq-16" />
|
|
46
|
+
<span ref={popover.refs.setReference} {...popover.getReferenceProps()} className="inline-flex">
|
|
47
|
+
<Button {...shared} iconOnly="chevron-down" iconSize={float ? undefined : 12} pressed={open} aria-label={menuLabel}
|
|
48
|
+
className={`rounded-l-none ${float ? '[--kol-float-ic:var(--kol-float-chev-sm)]' : ''}`.trim()} />
|
|
49
|
+
</span>
|
|
50
|
+
<PopoverPanel popover={popover} panel={false} focus={false}
|
|
51
|
+
className={float ? `kol-more-sheet kol-more-sheet-float ${floatSurfaceClass('solid', true)}` : 'w-max bg-surface-secondary border border-oq-08 rounded shadow-lg'}
|
|
52
|
+
style={float ? { minWidth: 220 } : undefined}>
|
|
53
|
+
{menu ? menu(close) : items.map((it) => (float
|
|
54
|
+
? <Button key={it.label} variant="nav" size="lg" iconLeft={it.icon} iconSize="var(--kol-float-ic)" disabled={it.disabled} className="w-full justify-start kol-btn-float" onClick={pick(it)}>{it.label}</Button>
|
|
55
|
+
: (
|
|
56
|
+
<button key={it.label} type="button" disabled={it.disabled} onClick={pick(it)}
|
|
57
|
+
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">
|
|
58
|
+
<span className="flex-1 truncate">{it.label}</span>
|
|
59
|
+
</button>
|
|
60
|
+
)))}
|
|
61
|
+
</PopoverPanel>
|
|
62
|
+
</div>
|
|
63
|
+
)
|
|
64
|
+
}
|
|
@@ -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
|
+
}
|
package/src/molecules/Modal.jsx
CHANGED
|
@@ -3,7 +3,7 @@ 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 Header from './Header.jsx'
|
|
7
7
|
import ModalShell from './ModalShell.jsx'
|
|
8
8
|
|
|
9
9
|
/**
|
|
@@ -62,7 +62,7 @@ import ModalShell from './ModalShell.jsx'
|
|
|
62
62
|
*
|
|
63
63
|
* THE FLOAT (`variant: 'float'` on any call or on the provider, float-everything W6 rows 84 · 85 · 89 · 90, 2026-11-04 —
|
|
64
64
|
* 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 `
|
|
65
|
+
* A `header` (with its `icon`) draws `Header variant="modal"` over the title; the title is the heading
|
|
66
66
|
* (`kol-float-section`… at 20: Inter 500), `body` a line under it in the hint ink; fields are float Inputs, toggles float
|
|
67
67
|
* ToggleCheckboxes; the actions sit apart — the quiet cancel at the left (`tone="ghost"`), the next step at the right
|
|
68
68
|
* (`inverted`, or `danger` when `tone: 'danger'` — the destructive confirm). Still a blocking task, so the scrim
|
|
@@ -223,7 +223,7 @@ function ModalView({ state, closeWith, variant, contained }) {
|
|
|
223
223
|
maxWidth: contained ? '90%' : '90vw',
|
|
224
224
|
...(float ? { width: 562 } : {}),
|
|
225
225
|
}}
|
|
226
|
-
header={float && state.header && <
|
|
226
|
+
header={float && state.header && <Header variant="modal" icon={state.icon} title={state.header} onClose={cancel} />}
|
|
227
227
|
footer={float ? (
|
|
228
228
|
/* the float's actions sit apart: recovery quiet at the left, the next step at the right */
|
|
229
229
|
<div className="flex items-center justify-between gap-3">
|
|
@@ -332,8 +332,8 @@ export function useModal() {
|
|
|
332
332
|
* <ModalDialog open={open} onClose={() => setOpen(false)} title="Filter by page" width={560}>…</ModalDialog>
|
|
333
333
|
*
|
|
334
334
|
* `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`, 24 in, 18 between its parts, the title drawn as `
|
|
336
|
-
* variant="
|
|
335
|
+
* `kol-float-solid` on `--kol-float-window-r`, 24 in, 18 between its parts, the title drawn as `Header
|
|
336
|
+
* variant="modal"` (`icon` · title · − when `onMinimise` · ×) over the children. `blocking` (default true) keeps the
|
|
337
337
|
* scrim: a blocking task dims the scene, a utility window does not (row 89) — `blocking={false}` drops the scrim and the
|
|
338
338
|
* press-outside close and leaves the scene live (QuickLookFrame float is the utility window proper).
|
|
339
339
|
* @param {'lift'|'bordered'|'float'} [variant='lift']
|
|
@@ -345,7 +345,7 @@ export function useModal() {
|
|
|
345
345
|
*/
|
|
346
346
|
/*
|
|
347
347
|
* `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
|
|
348
|
+
* 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
349
|
* the hint ink, `headerEnd` — the preset select — and the ×), a 156 section list on the primary surface (`sections`
|
|
350
350
|
* `[{ key, label, state }]` — the name and a one-line state, 6 apart; the lit one carries its 2px marker and no fill,
|
|
351
351
|
* hover the only fill (LAW 16, plan-2026-11-12-float-rails-figma W13.1; it sat on oq-12 until then); `section` /
|
|
@@ -377,18 +377,7 @@ export function ModalDialog({ open, onClose, title, width = 560, variant = 'lift
|
|
|
377
377
|
<ModalShell variant="settings" role="dialog" aria-modal={blocking ? 'true' : undefined} aria-label={title} data-dialog onMouseDown={(e) => e.stopPropagation()}
|
|
378
378
|
className="kol-settings-window pointer-events-auto overflow-hidden"
|
|
379
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
|
-
)}
|
|
380
|
+
header={<Header variant="settings" title={title} kind={kind} end={headerEnd} onClose={onClose} />}
|
|
392
381
|
footer={footer && <footer className="flex items-center gap-3 h-[60px] shrink-0 px-6 border-t border-oq-16">{footer}</footer>}>
|
|
393
382
|
<div className="flex flex-1 min-h-0">
|
|
394
383
|
{sections?.length > 0 && (
|
|
@@ -445,7 +434,7 @@ export function ModalDialog({ open, onClose, title, width = 560, variant = 'lift
|
|
|
445
434
|
* `.kol-overlay-panel` is the lift every KOL overlay wears (oq-04, no border — the scrim is the edge). */
|
|
446
435
|
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
436
|
style={{ width: `min(${width}px, calc(${container ? '100%' : '100vw'} - 32px))` }}
|
|
448
|
-
header={float && title && <
|
|
437
|
+
header={float && title && <Header variant="modal" icon={icon} title={title} onMinimise={onMinimise} onClose={onClose} />}
|
|
449
438
|
>
|
|
450
439
|
{children}
|
|
451
440
|
</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}
|
|
@@ -1,33 +1,37 @@
|
|
|
1
1
|
import { useState } from 'react'
|
|
2
|
-
import
|
|
2
|
+
import Header from './Header.jsx'
|
|
3
3
|
import { floatSurfaceClass } from '../utilities/tone.js'
|
|
4
4
|
|
|
5
|
-
/* taxonomy-ok: molecule —
|
|
5
|
+
/* taxonomy-ok: molecule — Header (molecule) in the header slot over a body and a footer slot; the float module every float Rail is drawn on */
|
|
6
6
|
|
|
7
7
|
/**
|
|
8
8
|
* RailFloat (was `FloatModule`, renamed 2026-11-12; the old name stays a deprecated alias) — the one float Rail shell (plan-2026-11-12-float-system W4.1; the user: *"why arent all rails in the same
|
|
9
9
|
* shell? also the floating nav?? because it should ALSO have a collapsed state"*). Three slots on the float surface at the
|
|
10
10
|
* sheet radius (plan-2026-11-12-float-rails-figma W4.1, his approved tree):
|
|
11
11
|
*
|
|
12
|
-
* header `header`, default a `
|
|
12
|
+
* header `header`, default a `Header` (the title, `actions`, expand, collapse-h, collapse-v); renders when any is given
|
|
13
13
|
* body the children, scrolling under the header with its scrollbar hidden
|
|
14
14
|
* footer `footer`, after the body, outside its scroll; renders only when given
|
|
15
15
|
*
|
|
16
|
-
*
|
|
17
|
-
* the footer hidden (never removed), drawn as the pill of `--kol-float-
|
|
16
|
+
* Collapsed-v is the SAME component (P14 *"EVEN THE FOLDED will get header body and footer"*): the same header, the body
|
|
17
|
+
* and the footer hidden (never removed), drawn as the pill of `--kol-float-collapsed-h`, fully round, at the module's width.
|
|
18
18
|
* PropertyRail (kol-shell), NavRail float and the reader's Contents draw on it. It lives in kol-component so NavRail float
|
|
19
19
|
* can use it without a reverse dependency; kol-shell re-exports it (the way NavRail itself moved, ARCHITECTURE §3 2026-10-22).
|
|
20
20
|
*
|
|
21
21
|
* Every size is a token of the float spec (docs/documentation/04-compositions/25-float-spec.md): the width
|
|
22
22
|
* `--kol-float-module-w` (`wide` `--kol-float-module-w-wide`), the radius `--kol-float-menu-r`, the rows
|
|
23
|
-
* `--kol-float-module-gap` (`compact` spacing-2), the
|
|
23
|
+
* `--kol-float-module-gap` (`compact` spacing-2), the collapsed-v pill `--kol-float-collapsed-h`.
|
|
24
24
|
*
|
|
25
|
-
* @param {ReactNode} [header] the header slot; unset, a
|
|
26
|
-
* @param {
|
|
27
|
-
*
|
|
28
|
-
* @param {ReactNode} [
|
|
29
|
-
* @param {
|
|
30
|
-
*
|
|
25
|
+
* @param {ReactNode} [header] the header slot; unset, a Header of `title` · `head` · `actions` · the toggles
|
|
26
|
+
* @param {'property'|'nav'} [headerVariant='property'] the Header's variant while open (`nav`: NavRail float's switcher,
|
|
27
|
+
* with `icon` and `onSwitch`); collapsed-v, the pill is always the plain title
|
|
28
|
+
* @param {ReactNode} [title] the header's title, and the collapsed pill's
|
|
29
|
+
* @param {ReactNode} [head] replaces the title in the open header (a consumer's own switcher)
|
|
30
|
+
* @param {ReactNode} [actions] the Header's `end`: before the toggles; not on the collapsed pill
|
|
31
|
+
* @param {Function} [onExpand] · {Function} [onCollapseH] the Header's expand and collapse-h; not on the collapsed pill
|
|
32
|
+
* @param {boolean} [collapsibleV] the collapse-v chevron in the header; `collapsedV` controlled, `defaultCollapsedV`
|
|
33
|
+
* uncontrolled, `onCollapseV(collapsedV)` on every press. Deprecated aliases: `foldable` ·
|
|
34
|
+
* `folded` · `defaultFolded` · `onFold`
|
|
31
35
|
* @param {boolean} [compact] the tool Rail's rhythm: rows spacing-2 apart (default `--kol-float-module-gap`)
|
|
32
36
|
* @param {boolean} [wide] the wide module width
|
|
33
37
|
* @param {number|string} [width] an explicit width (a phone's `100%`, a footprint token); unset, the module width
|
|
@@ -39,27 +43,30 @@ import { floatSurfaceClass } from '../utilities/tone.js'
|
|
|
39
43
|
*/
|
|
40
44
|
const INSET = { md: 'p-4', sm: 'p-3', none: '' }
|
|
41
45
|
|
|
42
|
-
export default function RailFloat({ header, title, head, actions,
|
|
43
|
-
const
|
|
44
|
-
const
|
|
45
|
-
const
|
|
46
|
+
export default function RailFloat({ header, headerVariant = 'property', icon, onSwitch, title, head, actions, onExpand, onCollapseH, collapsibleV, collapsedV, defaultCollapsedV, onCollapseV, foldable, folded, defaultFolded, onFold, compact = false, wide = false, width, inset = 'md', surface = 'solid', footer, as: Tag = 'section', className = '', bodyClassName = '', style, 'aria-label': ariaLabel, children }) {
|
|
47
|
+
const canV = collapsibleV ?? foldable ?? false
|
|
48
|
+
const ctlV = collapsedV ?? folded
|
|
49
|
+
const [ownV, setOwnV] = useState(defaultCollapsedV ?? defaultFolded ?? false)
|
|
50
|
+
const isV = canV && (ctlV ?? ownV)
|
|
51
|
+
const toggleV = () => { const next = !isV; if (ctlV === undefined) setOwnV(next); (onCollapseV ?? onFold)?.(next) }
|
|
46
52
|
const w = width ?? `var(--kol-float-module-w${wide ? '-wide' : ''})`
|
|
47
53
|
const label = ariaLabel ?? (typeof title === 'string' ? title : undefined)
|
|
48
54
|
const gap = compact ? 'gap-2' : 'gap-[var(--kol-float-module-gap)]'
|
|
49
|
-
const headerSlot = header ?? ((head || title || actions ||
|
|
50
|
-
<
|
|
55
|
+
const headerSlot = header ?? ((head || title || actions || canV || onExpand || onCollapseH) && (isV
|
|
56
|
+
? <Header variant="property" title={title} collapsedV onCollapseV={toggleV} />
|
|
57
|
+
: <Header variant={headerVariant} icon={icon} onSwitch={onSwitch} title={head ?? title} end={actions} onExpand={onExpand} onCollapseH={onCollapseH} onCollapseV={canV ? toggleV : undefined} />
|
|
51
58
|
))
|
|
52
|
-
const shape =
|
|
59
|
+
const shape = isV
|
|
53
60
|
? 'flex-row items-center rounded-full pl-4 pr-1.5'
|
|
54
61
|
: `flex-col ${gap} rounded-[var(--kol-float-menu-r)] ${INSET[inset] ?? INSET.md}`
|
|
55
62
|
return (
|
|
56
|
-
<Tag data-float-module={
|
|
57
|
-
className={`kol-float-module kol-float-chrome flex min-h-0 ${
|
|
63
|
+
<Tag data-float-module={isV ? 'collapsed' : 'open'} aria-label={label} style={{ ...style, width: w, ...(isV && { height: 'var(--kol-float-collapsed-h)' }) }}
|
|
64
|
+
className={`kol-float-module kol-float-chrome flex min-h-0 ${isV ? 'shrink-0' : ''} ${shape} ${floatSurfaceClass(surface, true)} ${className}`.replace(/\s+/g, ' ').trim()}>
|
|
58
65
|
{headerSlot}
|
|
59
|
-
<div data-float-module-body="" hidden={
|
|
66
|
+
<div data-float-module-body="" hidden={isV} className={`flex min-h-0 flex-1 flex-col overflow-y-auto [scrollbar-width:none] ${gap} ${bodyClassName}`.trim()}>
|
|
60
67
|
{children}
|
|
61
68
|
</div>
|
|
62
|
-
{footer && <div data-float-module-footer="" hidden={
|
|
69
|
+
{footer && <div data-float-module-footer="" hidden={isV} className="flex shrink-0 flex-col">{footer}</div>}
|
|
63
70
|
</Tag>
|
|
64
71
|
)
|
|
65
72
|
}
|
|
@@ -1,31 +1,19 @@
|
|
|
1
|
-
import
|
|
2
|
-
import Button from '../atoms/Button.jsx'
|
|
1
|
+
import Header from './Header.jsx'
|
|
3
2
|
|
|
4
|
-
/* taxonomy-ok: molecule — the
|
|
3
|
+
/* taxonomy-ok: molecule — the rail kit's title line; `variant="float"` is Header variant="property" */
|
|
5
4
|
|
|
6
5
|
/**
|
|
7
|
-
* RailHeader —
|
|
8
|
-
*
|
|
6
|
+
* RailHeader — the rail kit's title line (RailKit 2026-10-24): title (helper-14 uppercase), a subtitle, the header's
|
|
7
|
+
* actions before the × (which Rail draws). The node Rail's `header` slot takes it; SettingsPanel wears it.
|
|
9
8
|
*
|
|
10
|
-
* `variant="
|
|
11
|
-
*
|
|
12
|
-
*
|
|
13
|
-
* `variant="float"` (plan-2026-11-12-float-rails-figma W4.1; the user: *"why is header not component?"*) — RailFloat's
|
|
14
|
-
* header, open and folded alike: the title slot filling the row and truncating (`kol-float-panel`, the emphasis ink), then
|
|
15
|
-
* `end`: the actions and the fold, 4 apart, 8 off the title. The TITLE IS A SLOT: text takes the panel role, a node
|
|
16
|
-
* (NavRail float's switcher row) fills the title position as it is. The fold is a float ghost sm Button whose glyph is the
|
|
17
|
-
* 12 chevron token (`--kol-float-chev-sm`, 14 on touch), never the float button's 18 glyph (P15 *"USE 12px chevron"*).
|
|
18
|
-
* Each part renders only when given: no `onFold`, no fold; no `actions`, no slot.
|
|
9
|
+
* `variant="float"` is `Header variant="property"` (plan-2026-11-12-one-header W1.1) — deprecated under this name, on the
|
|
10
|
+
* retirement ledger: `actions` → `end`, `collapsedV` / `onCollapseV` (the old `folded` / `onFold` still accepted).
|
|
11
|
+
* The default line stays here: it is not one of Header's four variants.
|
|
19
12
|
*
|
|
20
13
|
* @param {'default'|'float'} [variant='default']
|
|
21
|
-
* @param {ReactNode} [title]
|
|
22
|
-
* @param {ReactNode} [subtitle] default: the line under the title
|
|
23
|
-
* @param {ReactNode} [actions] default: before the ×; float: before the fold (expand, collapse)
|
|
24
|
-
* @param {boolean} [folded] float: the fold's state — ⌄ (Open) when folded, ⌃ (Fold) when open
|
|
25
|
-
* @param {Function} [onFold] float: the fold's press; unset, no fold
|
|
26
|
-
* @param {string} [className]
|
|
14
|
+
* @param {ReactNode} [title] · {ReactNode} [subtitle] · {ReactNode} [actions] · {string} [className]
|
|
27
15
|
*/
|
|
28
|
-
export default function RailHeader({ variant = 'default', title, subtitle, actions,
|
|
16
|
+
export default function RailHeader({ variant = 'default', title, subtitle, actions, collapsedV, onCollapseV, folded, onFold, className = '' }) {
|
|
29
17
|
if (variant !== 'float') {
|
|
30
18
|
return (
|
|
31
19
|
<div className={`flex min-w-0 items-center gap-2 ${className}`.trim()}>
|
|
@@ -37,16 +25,5 @@ export default function RailHeader({ variant = 'default', title, subtitle, actio
|
|
|
37
25
|
</div>
|
|
38
26
|
)
|
|
39
27
|
}
|
|
40
|
-
|
|
41
|
-
<Button variant="float" tone="ghost" size="sm" iconOnly={folded ? 'chevron-down' : 'chevron-up'} className="[--kol-float-ic:var(--kol-float-chev-sm)]"
|
|
42
|
-
aria-label={folded ? 'Open' : 'Fold'} aria-expanded={!folded} onClick={onFold} />
|
|
43
|
-
)
|
|
44
|
-
return (
|
|
45
|
-
<div data-float-module-header="" className={`flex w-full min-w-0 shrink-0 items-center justify-between gap-2 ${className}`.trim()}>
|
|
46
|
-
{title != null && title !== false && (isValidElement(title)
|
|
47
|
-
? <div data-rail-header-title="" className="flex min-w-0 flex-1">{title}</div>
|
|
48
|
-
: <span className="kol-float-panel text-emphasis min-w-0 flex-1 truncate">{title}</span>)}
|
|
49
|
-
{(actions || fold) && <span className="ml-auto flex shrink-0 items-center gap-1">{actions}{fold}</span>}
|
|
50
|
-
</div>
|
|
51
|
-
)
|
|
28
|
+
return <Header variant="property" title={title} end={actions} collapsedV={collapsedV ?? folded ?? false} onCollapseV={onCollapseV ?? onFold} className={className} />
|
|
52
29
|
}
|
|
@@ -14,7 +14,7 @@ import { floatMotion } from '../utilities/motion.js'
|
|
|
14
14
|
* 2026-11-04 — kol-float--style 48:4015 expanded, 48:4277 rail). Its own path: none of the app rail's grab, drag or
|
|
15
15
|
* width token. Two states, the rail's words — EXPANDED (264) and COLLAPSED (72):
|
|
16
16
|
*
|
|
17
|
-
* expanded the switcher row (glyph · title ·
|
|
17
|
+
* expanded the switcher row — Header variant="nav" (glyph · title · ⌄ 12, or your `switcher`) · the search capsule (`Search pages ⌘K`) · the
|
|
18
18
|
* tree: a `{ heading }` entry opens a group, a float `LabeledControlSection` whose label is the heading
|
|
19
19
|
* (`kol-float-ruler`, fg-64, as authored) over the items under it; an item a
|
|
20
20
|
* `TreeRow size="lg"` (40 · 18 glyph · Inter 13 · count · chevron), its `sub` rows `TreeRow size="sm"`
|
|
@@ -39,9 +39,10 @@ import { floatMotion } from '../utilities/motion.js'
|
|
|
39
39
|
* @param {ReactNode} [footer]
|
|
40
40
|
* @param {Function} [onItemHover] collapsed only: `(item, element)` when the pointer enters a slot, `(null, null)` when it
|
|
41
41
|
* leaves — the seam a hover flyout hangs off (kol-shell's RailFlyout, FloatLayout 2026-11-04)
|
|
42
|
-
* @param {boolean} [
|
|
43
|
-
* RailFloat's pill — `title` and ⌄ at the expanded width — apart from its
|
|
44
|
-
* and its hide. `
|
|
42
|
+
* @param {boolean} [collapsibleV] the collapse-v chevron beside the switcher row (plan-2026-11-12-one-header W2.1): the rail
|
|
43
|
+
* collapses up to RailFloat's pill — `title` and ⌄ at the expanded width — apart from its
|
|
44
|
+
* 72 collapse and its hide. `collapsedV` controlled, `defaultCollapsedV` uncontrolled,
|
|
45
|
+
* `onCollapseV(collapsedV)`. Deprecated aliases: `foldable` · `folded` · `defaultFolded` · `onFold`
|
|
45
46
|
* @param {boolean|Object} [motion=true] expand ↔ collapse eases the width and fades the new rows in, and the slots and rows ease
|
|
46
47
|
* their hover (`.kol-float-rail`, FloatActionStatesAndMotion 2026-11-04): `true` the
|
|
47
48
|
* `--kol-float-*` tokens · `false` none · `{ duration, ease }` per app. Hide and show are
|
|
@@ -56,7 +57,7 @@ const groupsOf = (items) => {
|
|
|
56
57
|
return out[0].items.length ? out : out.slice(1)
|
|
57
58
|
}
|
|
58
59
|
|
|
59
|
-
export default function NavRailFloat({ items = [], currentPath = '', onNavigate, collapsed = false, onCollapsedChange, title, icon = 'grid', onSwitch, switcher, onSearch, onHide, defaultExpanded = [], footer, onItemHover, motion = true,
|
|
60
|
+
export default function NavRailFloat({ items = [], currentPath = '', onNavigate, collapsed = false, onCollapsedChange, title, icon = 'grid', onSwitch, switcher, onSearch, onHide, defaultExpanded = [], footer, onItemHover, motion = true, collapsibleV, collapsedV, defaultCollapsedV, onCollapseV, foldable, folded, defaultFolded, onFold, className = '' }) {
|
|
60
61
|
const motionStyle = floatMotion(motion).style
|
|
61
62
|
const [open, setOpen] = useState(() => new Set(defaultExpanded))
|
|
62
63
|
const toggle = (path) => setOpen((s) => { const n = new Set(s); n.has(path) ? n.delete(path) : n.add(path); return n })
|
|
@@ -99,18 +100,12 @@ export default function NavRailFloat({ items = [], currentPath = '', onNavigate,
|
|
|
99
100
|
|
|
100
101
|
return (
|
|
101
102
|
<RailFloat as="nav" aria-label="Navigation" inset="sm" width="var(--kol-shell-float-rail-open, 264px)" style={motionStyle}
|
|
102
|
-
|
|
103
|
+
headerVariant="nav" icon={icon} onSwitch={onSwitch} title={title} head={switcher}
|
|
104
|
+
collapsibleV={collapsibleV ?? foldable} collapsedV={collapsedV ?? folded} defaultCollapsedV={defaultCollapsedV ?? defaultFolded} onCollapseV={onCollapseV ?? onFold}
|
|
103
105
|
bodyClassName="!gap-3" className={`kol-float-rail h-full !gap-3 ${className}`.trim()}
|
|
104
|
-
footer={footer && <div className="flex shrink-0 flex-col gap-2">{footer}</div>}
|
|
105
|
-
head={switcher ?? (title && (
|
|
106
|
-
<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)]">
|
|
107
|
-
<IconLoader name={icon} size={18} className="shrink-0 text-oq-96" />
|
|
108
|
-
<span className="kol-float-body-lg min-w-0 flex-1 truncate text-fg-emphasis">{title}</span>
|
|
109
|
-
{onSwitch && <IconLoader name="chevron-down" size="var(--kol-float-chev-lg)" className="shrink-0 text-oq-64" />}
|
|
110
|
-
</button>
|
|
111
|
-
))}>
|
|
106
|
+
footer={footer && <div className="flex shrink-0 flex-col gap-2">{footer}</div>}>
|
|
112
107
|
{onSearch && (
|
|
113
|
-
<button type="button" onClick={onSearch} className="flex h-[var(--kol-float-h-md)] w-full items-center gap-2.5 rounded-full bg-[var(--kol-float-well)]
|
|
108
|
+
<button type="button" onClick={onSearch} className="flex h-[var(--kol-float-h-md)] w-full items-center gap-2.5 rounded-full bg-[var(--kol-float-well)] px-3 text-left cursor-pointer hover:bg-fg-08 focus-visible:outline-none focus-visible:shadow-[var(--kol-float-focus)]">
|
|
114
109
|
<IconLoader name="search" size={16} className="shrink-0 text-oq-64" />
|
|
115
110
|
<span className="kol-float-hint min-w-0 flex-1 truncate text-fg-64">Search pages</span>
|
|
116
111
|
<Kbd size="sm" icon="command">K</Kbd>
|
|
@@ -11,7 +11,7 @@ import { LabeledControlSection } from './SettingsPanel.jsx'
|
|
|
11
11
|
* own. It goes in a `RailFloat`'s body, the module carrying the title (`Contents`), the fold and the status line in its
|
|
12
12
|
* footer:
|
|
13
13
|
*
|
|
14
|
-
* <RailFloat title="Contents"
|
|
14
|
+
* <RailFloat title="Contents" collapsibleV footer={<span className="kol-float-label text-fg-64">Reading position saved</span>}>
|
|
15
15
|
* <ReadingContents book="The Waves" author="Virginia Woolf" count="9 interludes" chapters={chapters} … />
|
|
16
16
|
* </RailFloat>
|
|
17
17
|
*
|
|
@@ -1,33 +1,33 @@
|
|
|
1
1
|
import Button from '../atoms/Button.jsx'
|
|
2
2
|
import TabsRow from '../molecules/TabsRow.jsx'
|
|
3
3
|
|
|
4
|
-
/* taxonomy-ok: organism — the reader's side sheet: header,
|
|
4
|
+
/* taxonomy-ok: organism — the reader's side sheet: header, collapse-v, chip track, body */
|
|
5
5
|
|
|
6
6
|
const TRACK = 'w-full rounded-full bg-[var(--kol-float-well)] p-1 [&>button]:flex-1 [&>button]:justify-center'
|
|
7
7
|
|
|
8
8
|
/**
|
|
9
9
|
* ReadingPanel — The reader's side sheet: Notes and Reading behind one track (float-everything W11 rows 150 · 151,
|
|
10
10
|
* 2026-11-04 — kol-float--style W2.9 `Contextual reading panel`). A 320 sheet on `surface-secondary` at the sheet
|
|
11
|
-
* radius (`--kol-float-menu-r`), 20 in: the title in `kol-float-body-lg` with the
|
|
11
|
+
* radius (`--kol-float-menu-r`), 20 in: the title in `kol-float-body-lg` with the collapse-v ⌃ (a quiet float round) at the
|
|
12
12
|
* end, the float chip track under it (fg-16 on the well, the halves equal), then the body — `ReadingNotes` or
|
|
13
13
|
* `ReadingSettings` as `children`. No hairline edge.
|
|
14
14
|
*
|
|
15
15
|
* @param {string} [title] default `Reading panel`
|
|
16
16
|
* @param {Array} [tabs] `[{ value, label }]` (default Notes · Reading)
|
|
17
17
|
* @param {string} [tab] · {Function} [onTab] `(value) => void`
|
|
18
|
-
* @param {Function} [
|
|
18
|
+
* @param {Function} [onCollapseV] the ⌃ press (collapse-v); unset, none. `onFold` is its deprecated alias
|
|
19
19
|
* @param {ReactNode} children the open side's body
|
|
20
20
|
* @param {number} [width] default 320
|
|
21
21
|
* @param {string} [className]
|
|
22
22
|
*/
|
|
23
23
|
const TABS = [{ value: 'notes', label: 'Notes' }, { value: 'reading', label: 'Reading' }]
|
|
24
24
|
|
|
25
|
-
export default function ReadingPanel({ title = 'Reading panel', tabs = TABS, tab = 'notes', onTab, onFold, children, width = 320, className = '' }) {
|
|
25
|
+
export default function ReadingPanel({ title = 'Reading panel', tabs = TABS, tab = 'notes', onTab, onCollapseV, onFold, children, width = 320, className = '' }) {
|
|
26
26
|
return (
|
|
27
27
|
<aside className={`flex flex-col rounded-[var(--kol-float-menu-r)] bg-surface-secondary p-5 ${className}`.trim()} style={{ width }} aria-label={title}>
|
|
28
28
|
<div className="flex h-7 items-center justify-between">
|
|
29
29
|
<span className="kol-float-body-lg text-fg-emphasis">{title}</span>
|
|
30
|
-
{onFold && <Button variant="float" tone="ghost" size="sm" iconOnly="chevron-up" aria-label="
|
|
30
|
+
{(onCollapseV ?? onFold) && <Button variant="float" tone="ghost" size="sm" iconOnly="chevron-up" aria-label="Collapse" onClick={onCollapseV ?? onFold} className="-mr-1.5" />}
|
|
31
31
|
</div>
|
|
32
32
|
<TabsRow variant="float" size="xs" overflow="wrap" tabs={tabs} value={tab} onChange={onTab} ariaLabel={title} className={`mt-4 ${TRACK}`} />
|
|
33
33
|
<div className="mt-6">{children}</div>
|