@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
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
import { IconLoader } from '@kolkrabbi/kol-icons'
|
|
2
|
+
import Input from '../atoms/Input.jsx'
|
|
3
|
+
import Button from '../atoms/Button.jsx'
|
|
4
|
+
import ButtonGroup from '../molecules/ButtonGroup.jsx'
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* FindBar — find and replace over a document, one bar across its top (Folio's FindBar, 2026-11-22). It holds no
|
|
8
|
+
* document state: the host keeps the query, the replacement, the count and match case, and does the finding.
|
|
9
|
+
*
|
|
10
|
+
* The find field takes focus when the bar mounts. In either field Enter is the next match, Shift+Enter the previous;
|
|
11
|
+
* Escape anywhere in the bar closes it. Chrome in kol-theme `.kol-find-bar--kolbox` and `.kol-find-bar--folio`.
|
|
12
|
+
*
|
|
13
|
+
* <FindBar query={q} onQueryChange={setQ} replacement={r} onReplacementChange={setR} count="3 found"
|
|
14
|
+
* onPrev={prev} onNext={next} onReplace={one} onReplaceAll={all} matchCase={mc} onMatchCase={setMc} onClose={close} />
|
|
15
|
+
*
|
|
16
|
+
* @param {'kolbox'|'folio'} [variant='kolbox'] - kolbox: 48 high on the rail ground, the kolbox line under it, kolbox's
|
|
17
|
+
* Input md (the rail's search) and Buttons. folio: Folio's bar carried class for class (48, its surface, its rule).
|
|
18
|
+
* @param {string} query - The find field's text
|
|
19
|
+
* @param {(value: string) => void} onQueryChange
|
|
20
|
+
* @param {string} replacement - The replace field's text
|
|
21
|
+
* @param {(value: string) => void} onReplacementChange
|
|
22
|
+
* @param {ReactNode} [count] - What the find matched, as the host words it ("3 found", "none")
|
|
23
|
+
* @param {() => void} onPrev - The previous match
|
|
24
|
+
* @param {() => void} onNext - The next match
|
|
25
|
+
* @param {() => void} onReplace - Replace the current match
|
|
26
|
+
* @param {() => void} onReplaceAll - Replace every match
|
|
27
|
+
* @param {boolean} matchCase
|
|
28
|
+
* @param {(on: boolean) => void} onMatchCase
|
|
29
|
+
* @param {() => void} onClose
|
|
30
|
+
* @param {string} [className] - Extra classes on the bar
|
|
31
|
+
*/
|
|
32
|
+
export default function FindBar({ variant = 'kolbox', query, onQueryChange, replacement, onReplacementChange, count, onPrev, onNext, onReplace, onReplaceAll, matchCase, onMatchCase, onClose, className = '' }) {
|
|
33
|
+
/* Enter steps only from a field, so a focused button still presses on Enter */
|
|
34
|
+
const onKeyDown = (e) => {
|
|
35
|
+
if (e.key === 'Escape') { e.preventDefault(); onClose?.() }
|
|
36
|
+
if (e.key === 'Enter' && e.target.tagName === 'INPUT') { e.preventDefault(); e.shiftKey ? onPrev?.() : onNext?.() }
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
if (variant === 'folio') return (
|
|
40
|
+
<div className={`kol-find-bar--folio flex h-[48px] shrink-0 items-center gap-[10px] border-b px-[56px] ${className}`.trim()} onKeyDown={onKeyDown}>
|
|
41
|
+
<IconLoader name="search" size={16} />
|
|
42
|
+
<Input variant="folio" autoFocus aria-label="Find" placeholder="Find" value={query} onChange={(e) => onQueryChange(e.target.value)} className="w-[220px]" />
|
|
43
|
+
<span className="kol-find-bar-count w-[64px] tabular-nums">{count}</span>
|
|
44
|
+
<ButtonGroup layout="joined" variant="folio" ariaLabel="Matches" options={[{ icon: 'arrow-left', ariaLabel: 'Previous match', onPress: onPrev }, { icon: 'arrow-right', ariaLabel: 'Next match', onPress: onNext }]} />
|
|
45
|
+
<button type="button" aria-pressed={matchCase} onClick={() => onMatchCase(!matchCase)} className={`kol-find-bar-case${matchCase ? ' is-on' : ''} h-[28px] rounded-[3px] px-[8px]`}>Aa</button>
|
|
46
|
+
<span className="kol-find-bar-rule mx-[8px] h-[20px] w-px" />
|
|
47
|
+
<Input variant="folio" aria-label="Replace with" placeholder="Replace with" value={replacement} onChange={(e) => onReplacementChange(e.target.value)} className="w-[220px]" />
|
|
48
|
+
<Button variant="folio" onClick={onReplace}>Replace</Button>
|
|
49
|
+
<Button variant="folio" onClick={onReplaceAll}>Replace all</Button>
|
|
50
|
+
<Button variant="folio" iconOnly="x" aria-label="Close find" onClick={onClose} className="kol-find-bar-close ml-auto" />
|
|
51
|
+
</div>
|
|
52
|
+
)
|
|
53
|
+
|
|
54
|
+
/* kolbox: the rail header's 48 and its insets (12 in, 8 at the end), the rail's search field (Input md) and kolbox's
|
|
55
|
+
own find's buttons; Folio's order and words */
|
|
56
|
+
return (
|
|
57
|
+
<div className={`kol-find-bar--kolbox flex h-12 shrink-0 items-center gap-2 border-b pr-2 pl-3 ${className}`.trim()} onKeyDown={onKeyDown}>
|
|
58
|
+
<Input variant="kolbox" size="md" iconLeft="search" autoFocus aria-label="Find" placeholder="Find" value={query} onChange={(e) => onQueryChange(e.target.value)} className="w-60" />
|
|
59
|
+
<span className="kol-find-bar-count kol-kolbox-row w-16 shrink-0 tabular-nums">{count}</span>
|
|
60
|
+
<Button variant="kolbox" iconOnly="chevron-up" aria-label="Previous match" onClick={onPrev} />
|
|
61
|
+
<Button variant="kolbox" iconOnly="chevron-down" aria-label="Next match" onClick={onNext} />
|
|
62
|
+
<Button variant="kolbox" tone="ghost" pressed={Boolean(matchCase)} aria-label="Match case" onClick={() => onMatchCase(!matchCase)}>Aa</Button>
|
|
63
|
+
<span className="kol-find-bar-rule mx-2 h-5 w-px shrink-0" />
|
|
64
|
+
<Input variant="kolbox" size="md" iconLeft="arrow-right" aria-label="Replace with" placeholder="Replace with" value={replacement} onChange={(e) => onReplacementChange(e.target.value)} className="w-60" />
|
|
65
|
+
<Button variant="kolbox" onClick={onReplace}>Replace</Button>
|
|
66
|
+
<Button variant="kolbox" onClick={onReplaceAll}>Replace all</Button>
|
|
67
|
+
<Button variant="kolbox" iconOnly="x" aria-label="Close find" onClick={onClose} className="ml-auto" />
|
|
68
|
+
</div>
|
|
69
|
+
)
|
|
70
|
+
}
|
|
@@ -5,7 +5,7 @@ import Image from '../atoms/Image.jsx'
|
|
|
5
5
|
* frame (bordered surface-secondary panel, rounded) holding one object-cover
|
|
6
6
|
* image. Extracted from the foundry TypefacePage, where it sat inlined 5x
|
|
7
7
|
* verbatim between content sections. The double radius (`rounded` panel,
|
|
8
|
-
* `rounded-[var(--kol-radius-
|
|
8
|
+
* `rounded-[var(--kol-radius-4)]` image) is intentional — the image nests inside the border.
|
|
9
9
|
*
|
|
10
10
|
* Presentational — the caller passes finished `src`/`srcSet` strings; any
|
|
11
11
|
* CDN size-ladder generation stays at the call site. `media` swaps an
|
|
@@ -44,7 +44,7 @@ export default function FramedMediaBand({
|
|
|
44
44
|
srcSet={srcSet}
|
|
45
45
|
sizes={sizes}
|
|
46
46
|
alt={alt}
|
|
47
|
-
className="w-full h-full object-cover rounded-[var(--kol-radius-
|
|
47
|
+
className="w-full h-full object-cover rounded-[var(--kol-radius-4)]"
|
|
48
48
|
/>
|
|
49
49
|
)}
|
|
50
50
|
</div>
|
|
@@ -58,7 +58,7 @@ export default function GalleryCarousel({ media = [], title = '', defaultAspect
|
|
|
58
58
|
return (
|
|
59
59
|
<div
|
|
60
60
|
key={item.url || i}
|
|
61
|
-
className="w-full overflow-hidden rounded-[var(--kol-radius-
|
|
61
|
+
className="w-full overflow-hidden rounded-[var(--kol-radius-2)] cursor-pointer"
|
|
62
62
|
style={{ aspectRatio: aspect }}
|
|
63
63
|
onPointerDown={onPointerDown}
|
|
64
64
|
onPointerMove={onPointerMove}
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import { useMemo, useRef } from 'react'
|
|
2
|
+
import { system, systemDrag, grid } from '@kolkrabbi/kol-tuner'
|
|
3
|
+
import { Board, Keylines, Labels, inksOf, useLight } from './logoBoard.jsx'
|
|
4
|
+
|
|
5
|
+
/* LOGOSYSTEM (W27.4, 2026-11-19): the System board of @kolkrabbi/kol-tuner (the canvas's system-01-arcs), a mark built
|
|
6
|
+
* from measures, nothing placed by hand. It draws the form, the wedges, the construction and the math, the grid, the
|
|
7
|
+
* keylines, a reference image and the six handles (y, axisAt, x, angle, footAt, footSize). The settings are the host's:
|
|
8
|
+
* `settings` is the engine's System props as they stand, a handle drag calls `onDrag(key, value)` with the measure under
|
|
9
|
+
* the pointer, a double-click on a handle calls `onDragReset()`, a file dropped on the board calls `onFile(file)`.
|
|
10
|
+
* `reference` is `{ src, w, h }`, drawn faint behind the form. `peek` draws the form alone. */
|
|
11
|
+
export default function LogoSystem({ settings: p, reference, peek = false, onDrag, onDragReset, onFile, className = '' }) {
|
|
12
|
+
const inks = inksOf(p), themeLight = useLight(), light = inks ? inks.light : themeLight, svg = useRef(null), dragging = useRef(null)
|
|
13
|
+
const v = useMemo(() => system(p), [p])
|
|
14
|
+
const grey = p.fill === 'grey', strokeAlpha = grey ? 0.85 : 0.5
|
|
15
|
+
const gridD = p.grid && p.grid !== 'off' && !peek && v.measures ? grid(p.grid, (+p.gridStep || 1) * v.measures.x * (v.box || 480), +p.gridTurn || 0) : ''
|
|
16
|
+
const at = (e) => { const pt = svg.current.createSVGPoint(); pt.x = e.clientX; pt.y = e.clientY; const q = pt.matrixTransform(svg.current.getScreenCTM().inverse()); return [q.x - 600, q.y - 400] }
|
|
17
|
+
const move = (e) => { const k = dragging.current; if (!k) return; const m = at(e); onDrag?.(k, systemDrag(p, k, m[0], m[1])) }
|
|
18
|
+
const refBox = reference && (() => { const k = Math.min(v.box / reference.w, v.box / reference.h), w = reference.w * k, h = reference.h * k; return { x: -w / 2, y: -h / 2, w, h } })()
|
|
19
|
+
|
|
20
|
+
return (
|
|
21
|
+
<div className={`h-full w-full ${className}`.trim()} onDragOver={(e) => e.preventDefault()} onDrop={(e) => { e.preventDefault(); onFile?.(e.dataTransfer.files[0]) }}>
|
|
22
|
+
<Board svgRef={svg} inks={inks} label="Mark built from a few measures">
|
|
23
|
+
{refBox && <image href={reference.src} x={refBox.x} y={refBox.y} width={refBox.w} height={refBox.h} className="kol-logo-ref" />}
|
|
24
|
+
{gridD && <path d={gridD} className="kol-logo-grid" />}
|
|
25
|
+
<path d={v.d} className={`kol-logo-form${grey && !peek ? ' is-grey' : ''}`} />
|
|
26
|
+
{!peek && p.math && <path d={v.wedges} className="kol-logo-wedges" />}
|
|
27
|
+
{!peek && <path d={(p.construction ? v.guides : '') + (p.math ? v.dims : '')} className="kol-logo-lines" opacity={strokeAlpha} />}
|
|
28
|
+
{!peek && p.handles && v.handlePts.map((h) => (
|
|
29
|
+
<circle key={h.k} data-handle={h.k} cx={h.p[0]} cy={h.p[1]} r="9" className="kol-logo-handle"
|
|
30
|
+
onPointerDown={(e) => { e.preventDefault(); e.stopPropagation(); dragging.current = h.k; e.currentTarget.setPointerCapture(e.pointerId) }}
|
|
31
|
+
onPointerMove={move} onPointerUp={() => { dragging.current = null }} onDoubleClick={(e) => { e.preventDefault(); dragging.current = null; onDragReset?.() }} />
|
|
32
|
+
))}
|
|
33
|
+
{p.keylines && !peek && <Keylines box={(v.box || 480) * 1.2} light={light} />}
|
|
34
|
+
{!peek && p.math && <Labels list={v.dimLabels} />}
|
|
35
|
+
</Board>
|
|
36
|
+
</div>
|
|
37
|
+
)
|
|
38
|
+
}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import { useMemo } from 'react'
|
|
2
|
+
import { tuner } from '@kolkrabbi/kol-tuner'
|
|
3
|
+
import { Board, Keylines, Labels, inksOf, useLight } from './logoBoard.jsx'
|
|
4
|
+
|
|
5
|
+
/* LOGOTUNER (W27.4, 2026-11-19): the Tuner board of @kolkrabbi/kol-tuner (the canvas's tuner-01-form), a dropped logo
|
|
6
|
+
* rebuilt from circles and lines on one ladder. It draws the form, the traced line, the circles and dots, the curvature
|
|
7
|
+
* comb, the grid, the keylines and the labels. The settings are the host's: `settings` is the engine's Tuner props,
|
|
8
|
+
* `image` the `Image` it reads (an SVG carries its text as `image.__svg`), and a file dropped on the board or picked by
|
|
9
|
+
* a click calls `onFile(file)`; the host reads it into `image`. `peek` draws the tuned form alone. */
|
|
10
|
+
export default function LogoTuner({ settings: p, image = null, peek = false, onFile, className = '' }) {
|
|
11
|
+
const inks = inksOf(p), themeLight = useLight(), light = inks ? inks.light : themeLight
|
|
12
|
+
const v = useMemo(() => tuner(peek ? { ...p, view: 'tuned' } : p, image), [p, image, peek])
|
|
13
|
+
const grey = p.fill !== 'ink', strokeAlpha = grey ? 0.85 : 0.5
|
|
14
|
+
const pick = (e) => { onFile?.(e.target.files[0]); e.target.value = '' }
|
|
15
|
+
|
|
16
|
+
return (
|
|
17
|
+
<label className={`block h-full w-full cursor-pointer ${className}`.trim()} title="Choose a logo: an SVG or a black and white image"
|
|
18
|
+
onDragOver={(e) => e.preventDefault()} onDrop={(e) => { e.preventDefault(); onFile?.(e.dataTransfer.files[0]) }}>
|
|
19
|
+
<Board inks={inks} label="A form rebuilt from circles and lines">
|
|
20
|
+
{!peek && v.gridD && <path d={v.gridD} className="kol-logo-grid" />}
|
|
21
|
+
<path d={v.d} className={`kol-logo-form${grey && !peek ? ' is-grey' : ''}`} fillRule={v.fillRule || 'evenodd'} />
|
|
22
|
+
{!peek && [v.comb0, v.comb1, v.comb2].map((d, i) => d && <path key={i} d={d} className={`kol-logo-comb is-${i}`} />)}
|
|
23
|
+
{!peek && p.outline && p.view !== 'original' && <path d={v.orig} className="kol-logo-trace" />}
|
|
24
|
+
{!peek && <path d={(p.construction ? v.circles : '') + (p.math ? v.guides : '')} className="kol-logo-lines" opacity={strokeAlpha} />}
|
|
25
|
+
{!peek && p.construction && <path d={v.dots} className="kol-logo-dots" />}
|
|
26
|
+
{!peek && p.keylines && <Keylines box={(v.box || 480) * 1.2} ox={v.boxX} oy={v.boxY} light={light} />}
|
|
27
|
+
{!peek && p.math && <Labels list={v.labels} />}
|
|
28
|
+
</Board>
|
|
29
|
+
<input type="file" accept="image/*,.svg" aria-label="Choose a logo: an SVG or a black and white image" className="sr-only" onChange={pick} />
|
|
30
|
+
</label>
|
|
31
|
+
)
|
|
32
|
+
}
|
|
@@ -6,7 +6,6 @@ import Divider from '../atoms/Divider.jsx'
|
|
|
6
6
|
import Dropdown from '../molecules/Dropdown.jsx'
|
|
7
7
|
import Input from '../atoms/Input.jsx'
|
|
8
8
|
import ViewToggle from '../atoms/ViewToggle.jsx'
|
|
9
|
-
import SearchInput from '../molecules/SearchInput.jsx'
|
|
10
9
|
import FullscreenOverlay from '../molecules/FullscreenOverlay.jsx'
|
|
11
10
|
import ModalShell from '../molecules/ModalShell.jsx'
|
|
12
11
|
import { Tooltip } from '../utilities/Popover.jsx'
|
|
@@ -864,7 +863,7 @@ function BrowserShell({ onSelect }) {
|
|
|
864
863
|
|
|
865
864
|
const VIEW_OPTIONS = [
|
|
866
865
|
{ value: 'grid', icon: 'grid', label: 'Grid' },
|
|
867
|
-
{ value: 'list', icon: '
|
|
866
|
+
{ value: 'list', icon: 'list-bullet', label: 'List' },
|
|
868
867
|
]
|
|
869
868
|
|
|
870
869
|
/* The path at the FOOT of the picker card; the hidden-system count rides it —
|
|
@@ -1051,14 +1050,6 @@ function PickerShell({ onClose, onPick }) {
|
|
|
1051
1050
|
* @param {boolean} flat start in flat mode
|
|
1052
1051
|
* @param {Function} onClose modal only — Esc, backdrop, close button
|
|
1053
1052
|
* @param {Function} onSelect `(url, { contentType, kind })`. In `modal` it also closes.
|
|
1054
|
-
*
|
|
1055
|
-
* `float` (float-everything W6 row 87, 2026-11-04 — kol-float--style 46:2960): the asset window — a 310 float panel,
|
|
1056
|
-
* non-modal (no scrim, the scene stays live), `kol-float-solid` on the sheet radius, 20 in. The title in
|
|
1057
|
-
* `kol-float-window` with the × · a float SearchInput · the files as rows (a 44 × 54 cover on 6, the name in Inter 13,
|
|
1058
|
-
* `ext · size` in mono 10, a check on the picked one) — a press picks (`onSelect`) · `onImport` draws `+ Import`
|
|
1059
|
-
* (a float button, secondary) beside the count. Same `open` · `client` · `accept` · `onClose` · `onSelect` as `modal`.
|
|
1060
|
-
* @param {string} title float: the window's title (default `Assets`)
|
|
1061
|
-
* @param {Function} onImport float: shows the import button · {string} importLabel (default `Import`)
|
|
1062
1053
|
*/
|
|
1063
1054
|
export default function MediaLibrary({
|
|
1064
1055
|
variant = 'page',
|
|
@@ -1073,7 +1064,6 @@ export default function MediaLibrary({
|
|
|
1073
1064
|
...pageProps
|
|
1074
1065
|
}) {
|
|
1075
1066
|
const opts = { client, accept, pageSize, defaultSort, flat }
|
|
1076
|
-
if (variant === 'float') return open ? withProvider(<FloatPicker onClose={onClose} onPick={onSelect} {...pageProps} />, opts) : null
|
|
1077
1067
|
if (variant === 'modal') {
|
|
1078
1068
|
if (!open) return null
|
|
1079
1069
|
return withProvider(<PickerShell onClose={onClose} onPick={onSelect} />, opts)
|
|
@@ -1150,51 +1140,6 @@ function PickerBrowse({ client, accept, onClose, onSelect, title = 'MEDIA', ...b
|
|
|
1150
1140
|
)
|
|
1151
1141
|
}
|
|
1152
1142
|
|
|
1153
|
-
/* THE ASSET WINDOW (`variant="float"`, W6 row 87) — read-only, a picker: rows from the provider, the search its own */
|
|
1154
|
-
function FloatPicker({ onClose, onPick, onImport, importLabel = 'Import', title = 'Assets', className = '' }) {
|
|
1155
|
-
const { sorted, search, setSearch, mediaUrl, loading, error } = useMediaLibrary()
|
|
1156
|
-
const [picked, setPicked] = useState(null)
|
|
1157
|
-
const files = sorted.filter((o) => o.type !== 'folder')
|
|
1158
|
-
const pick = (o) => { setPicked(o.key); onPick?.(mediaUrl(o.fullKey ?? o.key), { contentType: o.contentType, kind: o.kind }) }
|
|
1159
|
-
return (
|
|
1160
|
-
<section role="dialog" aria-label={title} className={`kol-float-solid flex w-[310px] max-w-full flex-col gap-4 rounded-[var(--kol-float-menu-r)] p-5 ${className}`.trim()}>
|
|
1161
|
-
<div className="flex items-center gap-3">
|
|
1162
|
-
<span className="kol-float-window min-w-0 flex-1 truncate text-fg-emphasis">{title}</span>
|
|
1163
|
-
{onClose && (
|
|
1164
|
-
<button type="button" aria-label="Close" onClick={onClose} className="inline-flex size-6 shrink-0 items-center justify-center rounded-full text-oq-64 hover:bg-fg-08 hover:text-oq-96 cursor-pointer focus-visible:outline-none focus-visible:shadow-[var(--kol-float-focus)]">
|
|
1165
|
-
<IconLoader name="x" size={16} />
|
|
1166
|
-
</button>
|
|
1167
|
-
)}
|
|
1168
|
-
</div>
|
|
1169
|
-
<SearchInput variant="float" value={search ?? ''} onChange={(e) => setSearch(e.target.value)} placeholder="Search assets…" />
|
|
1170
|
-
<ul className="m-0 flex max-h-[320px] list-none flex-col gap-1 overflow-y-auto p-0 [scrollbar-width:none]">
|
|
1171
|
-
{error && <li className="kol-float-hint text-ui-error">Couldn’t load: {error}</li>}
|
|
1172
|
-
{!error && loading && <li className="kol-float-hint text-fg-64">Loading…</li>}
|
|
1173
|
-
{!error && !loading && files.length === 0 && <li className="kol-float-hint text-fg-64">Nothing here.</li>}
|
|
1174
|
-
{files.map((o) => (
|
|
1175
|
-
<li key={o.key}>
|
|
1176
|
-
<button type="button" onClick={() => pick(o)} aria-pressed={picked === o.key}
|
|
1177
|
-
className={`flex w-full items-center gap-3 rounded-[var(--kol-float-list-r)] p-1 text-left cursor-pointer focus-visible:outline-none focus-visible:shadow-[var(--kol-float-focus)] ${picked === o.key ? 'bg-fg-12' : 'hover:bg-fg-04'}`}>
|
|
1178
|
-
<span className="h-[54px] w-11 shrink-0 overflow-hidden rounded-md bg-fg-08"><Thumb row={o} mediaUrl={mediaUrl} /></span>
|
|
1179
|
-
<span className="flex min-w-0 flex-1 flex-col gap-0.5">
|
|
1180
|
-
<span className="kol-float-hint truncate text-fg-emphasis" style={{ fontSize: 13 }}>{o.displayKey}</span>
|
|
1181
|
-
<span className="kol-float-ruler truncate uppercase text-fg-64">{[o.key.split('.').pop(), formatSize(o.size)].filter(Boolean).join(' · ')}</span>
|
|
1182
|
-
</span>
|
|
1183
|
-
{picked === o.key && <IconLoader name="check" size={14} className="mr-2 shrink-0 text-oq-96" />}
|
|
1184
|
-
</button>
|
|
1185
|
-
</li>
|
|
1186
|
-
))}
|
|
1187
|
-
</ul>
|
|
1188
|
-
{(onImport || files.length > 0) && (
|
|
1189
|
-
<div className="flex items-center gap-3">
|
|
1190
|
-
{onImport && <Button variant="float" tone="secondary" size="md" iconLeft="plus" onClick={onImport}>{importLabel}</Button>}
|
|
1191
|
-
<span className="kol-float-label text-fg-64">{files.length} {files.length === 1 ? 'asset' : 'assets'}</span>
|
|
1192
|
-
</div>
|
|
1193
|
-
)}
|
|
1194
|
-
</section>
|
|
1195
|
-
)
|
|
1196
|
-
}
|
|
1197
|
-
|
|
1198
1143
|
/** @deprecated 2026-08-01 — alias of `MediaLibrary variant="modal"`. Kept so
|
|
1199
1144
|
* existing call sites and the fxr editor's `onPick` naming keep working;
|
|
1200
1145
|
* drops when nobody imports it (04-retirements.md). */
|
|
@@ -141,7 +141,7 @@ const VIEW_OPTIONS = [
|
|
|
141
141
|
|
|
142
142
|
const LAYOUT_OPTIONS = [
|
|
143
143
|
{ value: 'grid', label: 'Grid', icon: 'grid' },
|
|
144
|
-
{ value: 'list', label: 'List', icon: '
|
|
144
|
+
{ value: 'list', label: 'List', icon: 'list-bullet' },
|
|
145
145
|
{ value: 'off', label: 'Off', icon: 'eye-off' },
|
|
146
146
|
]
|
|
147
147
|
/* the stack view the `···` switches (item 15) — the same two ColumnBrowser
|
|
@@ -18,7 +18,6 @@ import VectorLoader from '../atoms/VectorLoader.jsx'
|
|
|
18
18
|
import { useRailSlot } from '../hooks/railSlot.jsx'
|
|
19
19
|
import { RAIL_ROW } from '../hooks/railRow.js'
|
|
20
20
|
import NavRailSite from './NavRailSite.jsx'
|
|
21
|
-
import NavRailFloat from './NavRailFloat.jsx'
|
|
22
21
|
|
|
23
22
|
/**
|
|
24
23
|
* NavRail — the flat rail. ONE fixed column, every child a direct child of it
|
|
@@ -83,8 +82,7 @@ import NavRailFloat from './NavRailFloat.jsx'
|
|
|
83
82
|
* EXPANDS (its rows open under it in place) and COLLAPSES. No other words, in code or docs.
|
|
84
83
|
*
|
|
85
84
|
* @param {'app'|'site'|'workshop'} preset which rail (default `app`); `variant="site"` is the old spelling of `preset="site"`
|
|
86
|
-
* @param {'top'
|
|
87
|
-
* `float` — the float sidebar, expanded 264 · collapsed 72 (NavRailFloat.jsx, float-everything W9 rows 127 · 128)
|
|
85
|
+
* @param {'top'} variant `top` — the horizontal top rail (TopRail): logomark · items · `actions` (the right slot)
|
|
88
86
|
* @param {Array} items `{ icon, path, label, sub?: [{ icon?, path, label }] }`
|
|
89
87
|
* a section (`sub`) with `to` is a FOLDER NOTE: its icon and label open `to`, its chevron expands or enters
|
|
90
88
|
* @param {Array} bottomItems pinned below the rule (Settings)
|
|
@@ -331,7 +329,6 @@ export function registerRailPreset(name, Component) { RAIL_PRESETS[name] = { ...
|
|
|
331
329
|
|
|
332
330
|
export default function NavRail({ variant, preset, ...props }) {
|
|
333
331
|
if (variant === 'top') return <TopRail {...props} />
|
|
334
|
-
if (variant === 'float') return <NavRailFloat {...props} />
|
|
335
332
|
const name = preset ?? (variant === 'site' ? 'site' : 'app')
|
|
336
333
|
if (name === 'app') return <AppRail {...props} sections={props.sections ?? RAIL_PRESETS.app.sections} />
|
|
337
334
|
const Named = RAIL_PRESETS[name]?.component
|
package/src/organisms/Rail.jsx
CHANGED
|
@@ -57,7 +57,7 @@ const FOCUSABLE =
|
|
|
57
57
|
* @param {ReactNode} nav A RAIL INSIDE THE RAIL (review 2, 2026-10-25 — *"like a siderail in the bottom rail"*): `RailNav`, the
|
|
58
58
|
* collapsed nav rail's 48 icon column, stood at the panel's edge with the header, body and foot
|
|
59
59
|
* padded beside it — so a bottom rail over the nav rail carries its views as glyphs under it
|
|
60
|
-
* @param {'app'|'site'} variant THE TIER (RailKit, kol-monitor 2026-10-24): its width when `width` / `height` is not given
|
|
60
|
+
* @param {'app'|'site'|'kolbox'|'folio'} variant `kolbox` and `folio` are those looks (below). THE TIER (RailKit, kol-monitor 2026-10-24): its width when `width` / `height` is not given
|
|
61
61
|
* (`--kol-rail-w-app` 320 · `--kol-rail-w-site` 380) and its padding (`--kol-pad-rail-app` ·
|
|
62
62
|
* `--kol-pad-rail-site`), kol-theme's tokens — so the settings rail and a page rail of one
|
|
63
63
|
* app are one size. Unset = the rail as before (`--kol-pad-overlay`, the width yours)
|
|
@@ -139,8 +139,40 @@ export function useRailKey(role, onToggle, enabled = true) {
|
|
|
139
139
|
}, [role, enabled])
|
|
140
140
|
}
|
|
141
141
|
|
|
142
|
+
/* `variant="kolbox"` (plan-2026-11-18-kolbox-system W31.2 batch 5, 2026-11-18): kolbox's one rail shell, carried from
|
|
143
|
+
* apps/kolbox/src/ui/Rail.jsx. It alone draws the panel fill, the edge line, the 240 width (`--kol-kolbox-rail-w`) and
|
|
144
|
+
* the clip. Slots: `header` and `footer` stay put, the body scrolls. `side` left draws its edge line on the right, right
|
|
145
|
+
* on the left, in the field ink, over the rail's own edge so the content keeps the full 240. `collapsed` the narrow
|
|
146
|
+
* strip, 49 (`--kol-kolbox-rail-w-collapsed`). Under 768 a rail lies along the bottom or stacks in a column: the full
|
|
147
|
+
* width, as tall as its content, its edge line along its top. `aria-label` names it. None of the roles, the scrim, the
|
|
148
|
+
* resize or the phone rule: the look's rails are docked frames. */
|
|
149
|
+
function RailKolbox({ side = 'left', 'aria-label': ariaLabel, header, footer, collapsed = false, children, className = '' }) {
|
|
150
|
+
return (
|
|
151
|
+
<aside
|
|
152
|
+
aria-label={ariaLabel}
|
|
153
|
+
data-rail={side}
|
|
154
|
+
data-collapsed={collapsed || undefined}
|
|
155
|
+
className={`kol-rail--kolbox${collapsed ? ' is-collapsed' : ''} relative flex h-full shrink-0 flex-col overflow-hidden max-md:h-auto before:absolute before:inset-y-0 before:z-10 before:w-px ${side === 'left' ? 'before:right-0' : 'before:left-0'} max-md:before:inset-x-0 max-md:before:top-0 max-md:before:bottom-auto max-md:before:h-px max-md:before:w-auto ${className}`.trim()}
|
|
156
|
+
>
|
|
157
|
+
{header && <div className="shrink-0">{header}</div>}
|
|
158
|
+
<div className="min-h-0 flex-1 overflow-y-auto" data-rail-body>{children}</div>
|
|
159
|
+
{footer && <div className="shrink-0">{footer}</div>}
|
|
160
|
+
</aside>
|
|
161
|
+
)
|
|
162
|
+
}
|
|
163
|
+
|
|
164
|
+
/* `variant="folio"` (Folio migration batch D, 2026-11-22): Folio's edge Rail, carried from apps/folio's EditorChrome.jsx.
|
|
165
|
+
* The bare aside, a column that clips: no fill, no edge, no width, no padding (its content brings Folio's 16, its edge
|
|
166
|
+
* line and width are the caller's `className`). `aria-label` names it (Folio's `label`). None of the roles, the scrim,
|
|
167
|
+
* the resize or the phone rule. */
|
|
168
|
+
function RailFolio({ 'aria-label': ariaLabel, children, className = '' }) {
|
|
169
|
+
return <aside aria-label={ariaLabel} className={`kol-rail--folio flex min-w-0 flex-col overflow-hidden ${className}`.trim()}>{children}</aside>
|
|
170
|
+
}
|
|
171
|
+
|
|
142
172
|
/* the role's shell, the phone rule over it, then whatever the call site passed (an `undefined` prop is not a pass) */
|
|
143
173
|
export default function Rail({ role, ...props }) {
|
|
174
|
+
if (props.variant === 'kolbox') return <RailKolbox {...props} />
|
|
175
|
+
if (props.variant === 'folio') return <RailFolio {...props} />
|
|
144
176
|
const phone = useMediaQuery('(max-width: 767px)')
|
|
145
177
|
const r = role ? RAIL_ROLES[role] : null
|
|
146
178
|
if (role && !r && import.meta.env?.DEV) console.warn(`Rail: no role "${role}" — patch · page · settings · bottom`)
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
import { forwardRef } from 'react'
|
|
2
|
+
/* taxonomy-ok: organism — nests Tooltip (utility) and IconLoader (atom) in a full-height Rail of its own. */
|
|
3
|
+
import { IconLoader } from '@kolkrabbi/kol-icons'
|
|
4
|
+
import { Tooltip } from '../utilities/Popover.jsx'
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* RailSwitcher — the narrow Rail at the far left that switches spaces (plan-2026-11-20-kolbox-everything-left W1.1). Top
|
|
8
|
+
* to bottom: the mark (it opens the host's main menu), a divider, the spaces, and the foot rows at the bottom. Measured
|
|
9
|
+
* on Figma's own navigation bar in Chrome 2026-11-20, and again by the rig 2026-11-23 (plan-2026-11-23-editor-measured-
|
|
10
|
+
* against-figma W2, _tmp/2026-11-23-editor-diff): 48 wide plus its 1 edge line (49), the mark a 32 square at 8 in and 8
|
|
11
|
+
* down (4 padding round its glyph); the divider 16 by 1 under it. Each space is a 48 by 40 row, the full width, 4 above
|
|
12
|
+
* and below, the rows touching, the first at 56; its lit and hover wash a 32 tile centred in it (the kit's track radius).
|
|
13
|
+
* The glyph is drawn at 20: Figma's read 10 to 14 inside their 24 box, the set's at 20 draws 12 to 15.
|
|
14
|
+
* The host owns the list: a space is added by adding a row.
|
|
15
|
+
*
|
|
16
|
+
* @param {'kolbox'} variant the one look so far: kolbox's panel, its edge line (`--kol-kolbox-line`), the lit tile a neutral wash
|
|
17
|
+
* (the field fill) with the plain ink, Figma's way (plan-2026-11-23-editor-measured-against-figma W4: the accent is kept for
|
|
18
|
+
* the primary button, the active tool and selection).
|
|
19
|
+
* @param {string} markIcon the mark's glyph (your icons), plain, no tile fill (W4)
|
|
20
|
+
* @param {string} [markLabel] its tooltip and name (default "Main menu")
|
|
21
|
+
* @param {boolean} [markOpen] the main menu is open (the tile stays lit)
|
|
22
|
+
* @param {Function} [onMark] a press on the mark
|
|
23
|
+
* @param {Array} items the spaces [{ value, icon, label }]
|
|
24
|
+
* @param {Array} [foot] the rows at the foot [{ value?, icon, label, onClick? }]
|
|
25
|
+
* @param {string} [value] the current space's value (lit)
|
|
26
|
+
* @param {Function} [onSelect] called with the pressed row (a space, or a foot row without its own onClick)
|
|
27
|
+
* The mark's element is the forwarded ref, so a host anchors its menu on it.
|
|
28
|
+
*/
|
|
29
|
+
const tile = 'inline-flex size-8 items-center justify-center rounded-track'
|
|
30
|
+
const rowCls = 'group flex h-10 w-12 shrink-0 items-center justify-center gap-0.5 py-1'
|
|
31
|
+
const focus = 'outline-none focus-visible:outline-solid focus-visible:outline-1 focus-visible:outline-offset-1 focus-visible:outline-accent'
|
|
32
|
+
|
|
33
|
+
function Row({ row, lit, onSelect }) {
|
|
34
|
+
return (
|
|
35
|
+
<Tooltip variant="kolbox" asChild label={row.label}>
|
|
36
|
+
<button type="button" aria-label={row.label} aria-current={lit ? 'page' : undefined} data-space={row.value}
|
|
37
|
+
onClick={() => (row.onClick ? row.onClick() : onSelect?.(row))}
|
|
38
|
+
className={`${rowCls} ${focus}`}>
|
|
39
|
+
<span className={`${tile} ${lit ? 'bg-field text-text' : 'text-text group-hover:bg-field'}`}><IconLoader name={row.icon} size={18} /></span>
|
|
40
|
+
</button>
|
|
41
|
+
</Tooltip>
|
|
42
|
+
)
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
const RailSwitcher = forwardRef(function RailSwitcher({ variant = 'kolbox', markIcon = 'wave', markLabel = 'Main menu', markOpen = false, onMark, items = [], foot = [], value, onSelect, className = '', ...rest }, ref) {
|
|
46
|
+
return (
|
|
47
|
+
<nav aria-label="Spaces" data-rail-switcher={variant}
|
|
48
|
+
className={`relative flex h-full w-(--kol-kolbox-rail-w-collapsed) shrink-0 flex-col items-start bg-panel pt-2 pb-1 after:absolute after:inset-y-0 after:right-0 after:w-px after:bg-(--kol-kolbox-line) ${className}`.trim()} {...rest}>
|
|
49
|
+
<Tooltip variant="kolbox" asChild label={markLabel}>
|
|
50
|
+
<button ref={ref} type="button" aria-label={markLabel} aria-haspopup="menu" aria-expanded={markOpen} onClick={onMark} data-mark
|
|
51
|
+
className={`${tile} ml-2 shrink-0 p-1 text-text hover:bg-field ${markOpen ? 'bg-field' : ''} ${focus}`}>
|
|
52
|
+
<IconLoader name={markIcon} size={18} />
|
|
53
|
+
</button>
|
|
54
|
+
</Tooltip>
|
|
55
|
+
<span aria-hidden className="mx-4 mt-2 mb-[7px] h-px w-4 shrink-0 bg-(--kol-kolbox-line)" data-rail-switcher-divider />
|
|
56
|
+
<div className="flex flex-col">{items.map((r) => <Row key={r.value} row={r} lit={r.value === value} onSelect={onSelect} />)}</div>
|
|
57
|
+
{foot.length > 0 && <div className="mt-auto flex flex-col">{foot.map((r) => <Row key={r.value ?? r.label} row={r} lit={r.value != null && r.value === value} onSelect={onSelect} />)}</div>}
|
|
58
|
+
</nav>
|
|
59
|
+
)
|
|
60
|
+
})
|
|
61
|
+
|
|
62
|
+
export default RailSwitcher
|
|
@@ -28,7 +28,7 @@ import { LabeledControlSection } from './SettingsPanel.jsx'
|
|
|
28
28
|
* @param {string} [progressLabel] default `Through the book`
|
|
29
29
|
* @param {string} [className]
|
|
30
30
|
*/
|
|
31
|
-
|
|
31
|
+
function ReadingContentsDefault({ book, author, count, chapters = [], current, onSelect, progress, progressLabel = 'Through the book', className = '' }) {
|
|
32
32
|
return (
|
|
33
33
|
<div data-reading-contents="" className={`flex flex-col gap-6 ${className}`.trim()}>
|
|
34
34
|
{(book || author) && (
|
|
@@ -38,7 +38,7 @@ export default function ReadingContents({ book, author, count, chapters = [], cu
|
|
|
38
38
|
</div>
|
|
39
39
|
)}
|
|
40
40
|
{(count || chapters.length > 0) && (
|
|
41
|
-
<LabeledControlSection
|
|
41
|
+
<LabeledControlSection as="nav" aria-label="Contents" rowGap={1}
|
|
42
42
|
label={count && <span className="kol-float-ruler uppercase text-fg-64">{count}</span>}>
|
|
43
43
|
{chapters.map((c, i) => (
|
|
44
44
|
<TocRow key={c.id} number={i + 1} label={c.label} href={c.href} current={c.id === current} onClick={onSelect ? () => onSelect(c.id) : undefined} className="h-9" />
|
|
@@ -51,9 +51,71 @@ export default function ReadingContents({ book, author, count, chapters = [], cu
|
|
|
51
51
|
<span className="kol-float-hint text-fg-64">{progressLabel}</span>
|
|
52
52
|
<span className="kol-float-timecode tabular-nums text-fg-emphasis">{Math.round(progress)}%</span>
|
|
53
53
|
</div>
|
|
54
|
-
<ProgressBar
|
|
54
|
+
<ProgressBar value={progress} ariaLabel={progressLabel} />
|
|
55
55
|
</div>
|
|
56
56
|
)}
|
|
57
57
|
</div>
|
|
58
58
|
)
|
|
59
59
|
}
|
|
60
|
+
|
|
61
|
+
/* ── folio (Folio batch E, 2026-11-22) ─────────────────────────────────────────────────────────────────────────────
|
|
62
|
+
* Folio's contents, carried from apps/folio's FolioDocument (the reader's left Rail, above the library tree): the
|
|
63
|
+
* `eyebrow` in Folio's label, the `book` title, the `author` line (Folio puts its chapter count or the document's kind
|
|
64
|
+
* there), 12 apart; then the list under its head (`title`, `Contents` by default, and the `count`, over a rule in the
|
|
65
|
+
* ink); then, for a book, `progress` (0 to 100) under `progressLabel` and its figure (`progressText`, the reader's
|
|
66
|
+
* "1 / 3"). Parts 28 apart, each drawn only when given. ReadingContents' words: `chapters` ({ id, label, href }),
|
|
67
|
+
* `current`. Folio's own: `sections` (the current chapter's headings, { id, label }, as anchors under it), `headings` (a
|
|
68
|
+
* document's headings when it is not a book, drawn quieter), `empty` (the line when there are neither), `linkComponent`
|
|
69
|
+
* (a router's Link for a chapter; default `a`) and `progressText`. */
|
|
70
|
+
function ReadingContentsFolio({ eyebrow, book, author, title = 'Contents', count, chapters = [], current, sections = [], headings = [], empty, linkComponent: L = 'a', progress, progressLabel = 'Through the book', progressText, className = '' }) {
|
|
71
|
+
const go = (href) => (L === 'a' ? { href } : { to: href })
|
|
72
|
+
return (
|
|
73
|
+
<div className={`kol-reading-contents--folio flex flex-col gap-[28px] ${className}`.trim()}>
|
|
74
|
+
<div className="flex flex-col gap-[12px]">
|
|
75
|
+
{eyebrow != null && <p className="kol-folio-label kol-reading-contents-muted">{eyebrow}</p>}
|
|
76
|
+
{book != null && <p className="kol-folio-book break-words">{book}</p>}
|
|
77
|
+
{author != null && <p className="kol-folio-body kol-reading-contents-muted">{author}</p>}
|
|
78
|
+
</div>
|
|
79
|
+
<nav aria-label="Contents" className="flex flex-col gap-[4px]">
|
|
80
|
+
<div className="kol-reading-contents-head flex justify-between border-b pb-[15px]">
|
|
81
|
+
<p className="kol-folio-nav">{title}</p>
|
|
82
|
+
<p className="kol-folio-meta kol-reading-contents-muted">{count}</p>
|
|
83
|
+
</div>
|
|
84
|
+
{chapters.length ? chapters.map((c, n) => {
|
|
85
|
+
const on = c.id === current
|
|
86
|
+
return (
|
|
87
|
+
<div key={c.id} className="flex flex-col">
|
|
88
|
+
<L {...go(c.href)} aria-current={on ? 'page' : undefined} className={`kol-reading-contents-row flex gap-[14px] rounded-[3px] px-[12px] py-[11px] ${on ? 'is-current' : ''}`.trim()}>
|
|
89
|
+
<span className="kol-folio-meta kol-reading-contents-number tabular-nums">{String(n + 1).padStart(2, '0')}</span>
|
|
90
|
+
<span className="kol-folio-nav min-w-0 flex-1">{c.label}</span>
|
|
91
|
+
</L>
|
|
92
|
+
{on && sections.length > 0 && (
|
|
93
|
+
<div className="kol-reading-contents-sections ml-[38px] flex flex-col border-l py-[4px]">
|
|
94
|
+
{sections.map((h) => <a key={h.id} href={`#${h.id}`} className="kol-folio-meta kol-reading-contents-quiet py-[6px] pl-[12px]">{h.label}</a>)}
|
|
95
|
+
</div>
|
|
96
|
+
)}
|
|
97
|
+
</div>
|
|
98
|
+
)
|
|
99
|
+
}) : headings.length ? headings.map((h, n) => (
|
|
100
|
+
<a key={h.id} href={`#${h.id}`} className="kol-reading-contents-heading kol-reading-contents-quiet flex gap-[12px] rounded-[3px] px-[12px] py-[9px]">
|
|
101
|
+
<span className="kol-folio-meta tabular-nums">{String(n + 1).padStart(2, '0')}</span>
|
|
102
|
+
<span className="kol-folio-nav min-w-0 flex-1">{h.label}</span>
|
|
103
|
+
</a>
|
|
104
|
+
)) : <p className="kol-folio-meta kol-reading-contents-muted px-[12px] py-[9px]">{empty}</p>}
|
|
105
|
+
</nav>
|
|
106
|
+
{progress != null && (
|
|
107
|
+
<div className="kol-reading-contents-progress flex flex-col gap-[12px] border-t pt-[19px]">
|
|
108
|
+
<div className="kol-folio-meta flex justify-between">
|
|
109
|
+
<p className="kol-reading-contents-muted">{progressLabel}</p>
|
|
110
|
+
<p className="kol-reading-contents-figure font-bold">{progressText}</p>
|
|
111
|
+
</div>
|
|
112
|
+
<div className="kol-reading-contents-track h-[4px]"><div className="kol-reading-contents-fill h-full" style={{ width: `${progress}%` }} /></div>
|
|
113
|
+
</div>
|
|
114
|
+
)}
|
|
115
|
+
</div>
|
|
116
|
+
)
|
|
117
|
+
}
|
|
118
|
+
|
|
119
|
+
export default function ReadingContents(props) {
|
|
120
|
+
return props.variant === 'folio' ? <ReadingContentsFolio {...props} /> : <ReadingContentsDefault {...props} />
|
|
121
|
+
}
|
|
@@ -28,13 +28,13 @@ import { floatSurfaceClass } from '../utilities/tone.js'
|
|
|
28
28
|
export default function ReadingOverview({ onBack, backLabel = 'Back to my library', cover, title, author, meta = [], description, place, onResume, resumeLabel = 'Resume reading', onCollect, collectLabel = 'Add to collection', font = "'Literata', Georgia, serif", className = '' }) {
|
|
29
29
|
return (
|
|
30
30
|
<section className={`flex flex-col gap-8 ${className}`.trim()}>
|
|
31
|
-
{onBack && <Button
|
|
31
|
+
{onBack && <Button tone="ghost" size="sm" iconLeft="arrow-left" onClick={onBack} className="-ml-3 self-start">{backLabel}</Button>}
|
|
32
32
|
<div className="flex flex-col gap-8 md:flex-row md:gap-[52px]">
|
|
33
33
|
{cover && <div className="aspect-[300/420] w-full max-w-[300px] shrink-0 self-start overflow-hidden rounded-sm">{cover}</div>}
|
|
34
34
|
<div className="flex min-w-0 flex-1 flex-col">
|
|
35
35
|
<h1 className="m-0 text-[52px] font-normal leading-[1.45] text-fg-emphasis" style={{ fontFamily: font }}>{title}</h1>
|
|
36
36
|
{author && <span className="kol-float-window mt-3 font-normal text-fg-64">{author}</span>}
|
|
37
|
-
{meta.length > 0 && <div className="mt-5 flex flex-wrap gap-3">{meta.map((m) => <Tag key={m}
|
|
37
|
+
{meta.length > 0 && <div className="mt-5 flex flex-wrap gap-3">{meta.map((m) => <Tag key={m} size="md" hash={false}>{m}</Tag>)}</div>}
|
|
38
38
|
{description && <p className="kol-float-body-lg m-0 mt-6 text-fg-64">{description}</p>}
|
|
39
39
|
{place && (
|
|
40
40
|
<div className="mt-10 flex flex-col rounded-[var(--kol-float-menu-r)] bg-surface-secondary px-6 py-4">
|
|
@@ -44,13 +44,13 @@ export default function ReadingOverview({ onBack, backLabel = 'Back to my librar
|
|
|
44
44
|
<span className="kol-float-hint text-fg-64">{place.line}</span>
|
|
45
45
|
{place.progress != null && <span className="kol-float-timecode tabular-nums text-fg-emphasis">{Math.round(place.progress)}%</span>}
|
|
46
46
|
</div>
|
|
47
|
-
{place.progress != null && <ProgressBar
|
|
47
|
+
{place.progress != null && <ProgressBar value={place.progress} ariaLabel={place.label ?? 'Your place'} className="mt-2" />}
|
|
48
48
|
</div>
|
|
49
49
|
)}
|
|
50
50
|
{(onResume || onCollect) && (
|
|
51
51
|
<div className="mt-5 flex flex-wrap gap-4">
|
|
52
|
-
{onResume && <Button
|
|
53
|
-
{onCollect && <Button
|
|
52
|
+
{onResume && <Button size="lg" iconRight="arrow-right" onClick={onResume}>{resumeLabel}</Button>}
|
|
53
|
+
{onCollect && <Button tone="secondary" size="lg" onClick={onCollect} className={floatSurfaceClass('solid')}>{collectLabel}</Button>}
|
|
54
54
|
</div>
|
|
55
55
|
)}
|
|
56
56
|
</div>
|
|
@@ -28,7 +28,7 @@ export default function ReadingPanel({ title = 'Reading panel', tabs = TABS, tab
|
|
|
28
28
|
{/* the one Header (property), its collapse-v chevron the 12 token (plan-2026-11-12-one-header W1.1 leftover); the title
|
|
29
29
|
* keeps its body-lg face as the title slot */}
|
|
30
30
|
<Header variant="property" title={<span className="kol-float-body-lg text-fg-emphasis truncate">{title}</span>} onCollapseV={onCollapseV ?? onFold} className="h-7 [&>span:last-child]:-mr-1.5" />
|
|
31
|
-
<TabsRow
|
|
31
|
+
<TabsRow size="xs" overflow="wrap" tabs={tabs} value={tab} onChange={onTab} ariaLabel={title} className={`mt-4 ${TRACK}`} />
|
|
32
32
|
<div className="mt-6">{children}</div>
|
|
33
33
|
</aside>
|
|
34
34
|
)
|
|
@@ -272,7 +272,7 @@ export default function SectionSplit({
|
|
|
272
272
|
* the rung-minus-padding height made a fixed window over a card with its own height —
|
|
273
273
|
* /studio's 621px ProfileCard showed as a 104px strip at 1440. Auto media takes the
|
|
274
274
|
* column's width and its own height, at every width; a ratio keeps the bounded rule. */
|
|
275
|
-
className={`kol-section-split-visual relative w-full max-w-full justify-self-center rounded-[var(--kol-radius-
|
|
275
|
+
className={`kol-section-split-visual relative w-full max-w-full justify-self-center rounded-[var(--kol-radius-4)] ${ratio === 'auto' ? '' : 'min-[901px]:w-auto min-[901px]:h-[calc(var(--kol-section-h,60vh)_-_2*var(--kol-section-py,4rem))]'} ${mediaClip ? 'overflow-hidden' : ''} ${mediaHover ? 'is-hoverable' : ''} ${mediaFirst ? 'order-1' : ''} ${centred ? 'max-w-[640px]' : ''}`.replace(/\s+/g, ' ').trim()}
|
|
276
276
|
style={ratio === 'auto' ? undefined : { aspectRatio: ratio }}
|
|
277
277
|
>
|
|
278
278
|
{media ?? (placeholder === true
|